getstream
Advanced tools
Comparing version 7.4.0 to 7.4.1
@@ -8,2 +8,8 @@ # CHANGELOG | ||
## [7.4.1](https://github.com/GetStream/stream-js/releases/tag/v7.4.1) - 2021-12-21 | ||
### Fix | ||
- Correct types of collections in upsert request and response [#487](https://github.com/GetStream/stream-js/pull/487) | ||
## [7.4.0](https://github.com/GetStream/stream-js/releases/tag/v7.4.0) - 2021-12-15 | ||
@@ -10,0 +16,0 @@ |
@@ -7,2 +7,6 @@ import { StreamClient, APIResponse, UR } from './client'; | ||
}; | ||
export declare type CollectionItem<CollectionType extends UR = UR> = CollectionType & { | ||
id: string; | ||
user_id?: string; | ||
}; | ||
export declare type CollectionResponse<CollectionType extends UR = UR> = BaseCollection<CollectionType> & { | ||
@@ -24,10 +28,7 @@ created_at: string; | ||
data: { | ||
[key: string]: { | ||
data: CollectionType; | ||
id: string; | ||
}[]; | ||
[key: string]: CollectionItem<CollectionType>[]; | ||
}; | ||
}; | ||
export declare type UpsertManyCollectionRequest<CollectionType extends UR = UR> = { | ||
[collection: string]: NewCollectionEntry<CollectionType>[]; | ||
[collection: string]: CollectionItem<CollectionType>[]; | ||
}; | ||
@@ -148,3 +149,3 @@ export declare class CollectionEntry<UserType extends UR = UR, ActivityType extends UR = UR, CollectionType extends UR = UR, ReactionType extends UR = UR, ChildReactionType extends UR = UR, PersonalizationType extends UR = UR> { | ||
*/ | ||
upsert(collection: string, data: NewCollectionEntry<CollectionType> | NewCollectionEntry<CollectionType>[]): Promise<UpsertCollectionAPIResponse<CollectionType>>; | ||
upsert(collection: string, data: CollectionItem<CollectionType> | CollectionItem<CollectionType>[]): Promise<UpsertCollectionAPIResponse<CollectionType>>; | ||
/** | ||
@@ -156,6 +157,6 @@ * UpsertMany one or more items into many collections. | ||
* @param {string} collection collection name | ||
* @param {UpsertManyCollectionRequest} data - A single json object that contains information of many collections | ||
* @param {UpsertManyCollectionRequest} items - A single json object that contains information of many collections | ||
* @return {Promise<UpsertCollectionAPIResponse<CollectionType>>} | ||
*/ | ||
upsertMany(data: UpsertManyCollectionRequest): Promise<UpsertCollectionAPIResponse<CollectionType>>; | ||
upsertMany(items: UpsertManyCollectionRequest): Promise<UpsertCollectionAPIResponse<CollectionType>>; | ||
/** | ||
@@ -162,0 +163,0 @@ * Select all objects with ids from the collection. |
@@ -438,3 +438,3 @@ "use strict"; | ||
* @param {string} collection collection name | ||
* @param {UpsertManyCollectionRequest} data - A single json object that contains information of many collections | ||
* @param {UpsertManyCollectionRequest} items - A single json object that contains information of many collections | ||
* @return {Promise<UpsertCollectionAPIResponse<CollectionType>>} | ||
@@ -445,3 +445,3 @@ */ | ||
key: "upsertMany", | ||
value: function upsertMany(data) { | ||
value: function upsertMany(items) { | ||
if (!this.client.usingApiSecret) { | ||
@@ -455,3 +455,3 @@ throw new _errors.SiteError('This method can only be used server-side using your API Secret'); | ||
body: { | ||
data: data | ||
data: items | ||
}, | ||
@@ -458,0 +458,0 @@ token: this.client.getCollectionsToken() |
@@ -14,3 +14,3 @@ { | ||
"license": "BSD-3-Clause", | ||
"version": "7.4.0", | ||
"version": "7.4.1", | ||
"scripts": { | ||
@@ -17,0 +17,0 @@ "transpile": "babel src --out-dir lib --extensions '.ts'", |
@@ -10,2 +10,7 @@ import { StreamClient, APIResponse, UR } from './client'; | ||
export type CollectionItem<CollectionType extends UR = UR> = CollectionType & { | ||
id: string; | ||
user_id?: string; | ||
}; | ||
export type CollectionResponse<CollectionType extends UR = UR> = BaseCollection<CollectionType> & { | ||
@@ -31,6 +36,3 @@ created_at: string; | ||
data: { | ||
[key: string]: { | ||
data: CollectionType; | ||
id: string; | ||
}[]; | ||
[key: string]: CollectionItem<CollectionType>[]; | ||
}; | ||
@@ -40,3 +42,3 @@ }; | ||
export type UpsertManyCollectionRequest<CollectionType extends UR = UR> = { | ||
[collection: string]: NewCollectionEntry<CollectionType>[]; | ||
[collection: string]: CollectionItem<CollectionType>[]; | ||
}; | ||
@@ -275,3 +277,3 @@ | ||
*/ | ||
upsert(collection: string, data: NewCollectionEntry<CollectionType> | NewCollectionEntry<CollectionType>[]) { | ||
upsert(collection: string, data: CollectionItem<CollectionType> | CollectionItem<CollectionType>[]) { | ||
if (!this.client.usingApiSecret) { | ||
@@ -297,6 +299,6 @@ throw new SiteError('This method can only be used server-side using your API Secret'); | ||
* @param {string} collection collection name | ||
* @param {UpsertManyCollectionRequest} data - A single json object that contains information of many collections | ||
* @param {UpsertManyCollectionRequest} items - A single json object that contains information of many collections | ||
* @return {Promise<UpsertCollectionAPIResponse<CollectionType>>} | ||
*/ | ||
upsertMany(data: UpsertManyCollectionRequest) { | ||
upsertMany(items: UpsertManyCollectionRequest) { | ||
if (!this.client.usingApiSecret) { | ||
@@ -309,3 +311,3 @@ throw new SiteError('This method can only be used server-side using your API Secret'); | ||
serviceName: 'api', | ||
body: { data }, | ||
body: { data: items }, | ||
token: this.client.getCollectionsToken(), | ||
@@ -312,0 +314,0 @@ }); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Possible typosquat attack
Supply chain riskThere is a package with a similar name that is downloaded much more often.
Did you mean |
---|
get-stream |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
800114
15712
1