getstream
Advanced tools
Comparing version 7.3.1 to 7.4.0
@@ -29,2 +29,5 @@ import { StreamClient, APIResponse, UR } from './client'; | ||
}; | ||
export declare type UpsertManyCollectionRequest<CollectionType extends UR = UR> = { | ||
[collection: string]: NewCollectionEntry<CollectionType>[]; | ||
}; | ||
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> { | ||
@@ -146,2 +149,12 @@ id: string; | ||
/** | ||
* UpsertMany one or more items into many collections. | ||
* @link https://getstream.io/activity-feeds/docs/node/collections_batch/?language=js#upsert | ||
* @method upsert | ||
* @memberof Collections.prototype | ||
* @param {string} collection collection name | ||
* @param {UpsertManyCollectionRequest} data - A single json object that contains information of many collections | ||
* @return {Promise<UpsertCollectionAPIResponse<CollectionType>>} | ||
*/ | ||
upsertMany(data: UpsertManyCollectionRequest): Promise<UpsertCollectionAPIResponse<CollectionType>>; | ||
/** | ||
* Select all objects with ids from the collection. | ||
@@ -148,0 +161,0 @@ * @link https://getstream.io/activity-feeds/docs/node/collections_batch/?language=js#select |
@@ -433,2 +433,28 @@ "use strict"; | ||
/** | ||
* UpsertMany one or more items into many collections. | ||
* @link https://getstream.io/activity-feeds/docs/node/collections_batch/?language=js#upsert | ||
* @method upsert | ||
* @memberof Collections.prototype | ||
* @param {string} collection collection name | ||
* @param {UpsertManyCollectionRequest} data - A single json object that contains information of many collections | ||
* @return {Promise<UpsertCollectionAPIResponse<CollectionType>>} | ||
*/ | ||
}, { | ||
key: "upsertMany", | ||
value: function upsertMany(data) { | ||
if (!this.client.usingApiSecret) { | ||
throw new _errors.SiteError('This method can only be used server-side using your API Secret'); | ||
} | ||
return this.client.post({ | ||
url: 'collections/', | ||
serviceName: 'api', | ||
body: { | ||
data: data | ||
}, | ||
token: this.client.getCollectionsToken() | ||
}); | ||
} | ||
/** | ||
* Select all objects with ids from the collection. | ||
@@ -435,0 +461,0 @@ * @link https://getstream.io/activity-feeds/docs/node/collections_batch/?language=js#select |
@@ -52,8 +52,8 @@ import { AxiosResponse } from 'axios'; | ||
*/ | ||
export declare class StreamApiError extends ErrorAbstract { | ||
export declare class StreamApiError<T> extends ErrorAbstract { | ||
error: unknown; | ||
response: AxiosResponse; | ||
constructor(msg: string, data: unknown, response: AxiosResponse); | ||
response: AxiosResponse<T>; | ||
constructor(msg: string, data: unknown, response: AxiosResponse<T>); | ||
} | ||
export {}; | ||
//# sourceMappingURL=errors.d.ts.map |
@@ -20,9 +20,10 @@ import { StreamClient, APIResponse, UR } from './client'; | ||
export declare type ReactionAPIResponse<T extends UR = UR> = APIResponse & Reaction<T>; | ||
export declare type ChildReactionsRecords<ReactionType extends UR = UR, ChildReactionType extends UR = UR, UserType extends UR = UR> = Record<string, EnrichedReaction<ReactionType, ChildReactionType, UserType>[]>; | ||
export declare type EnrichedReaction<ReactionType extends UR = UR, ChildReactionType extends UR = UR, UserType extends UR = UR> = Reaction<ReactionType | ChildReactionType> & { | ||
children_counts: Record<string, number>; | ||
latest_children: Record<string, ChildReactionType>; | ||
latest_children: ChildReactionsRecords<ReactionType, ChildReactionType, UserType>; | ||
latest_children_extra?: Record<string, { | ||
next?: string; | ||
}>; | ||
own_children?: Record<string, ChildReactionType>; | ||
own_children?: ChildReactionsRecords<ReactionType, ChildReactionType, UserType>; | ||
user?: EnrichedUser<UserType>; | ||
@@ -29,0 +30,0 @@ }; |
@@ -14,3 +14,3 @@ { | ||
"license": "BSD-3-Clause", | ||
"version": "7.3.1", | ||
"version": "7.4.0", | ||
"scripts": { | ||
@@ -110,3 +110,3 @@ "transpile": "babel src --out-dir lib --extensions '.ts'", | ||
"@types/qs": "^6.9.6", | ||
"axios": "^0.21.1", | ||
"axios": "^0.22.0", | ||
"faye": "^1.4.0", | ||
@@ -113,0 +113,0 @@ "form-data": "^4.0.0", |
@@ -671,3 +671,3 @@ /// <reference path="../types/modules.d.ts" /> | ||
throw new StreamApiError( | ||
throw new StreamApiError<T>( | ||
`${JSON.stringify(response.data)} with HTTP status code ${response.status}`, | ||
@@ -674,0 +674,0 @@ response.data, |
@@ -37,2 +37,6 @@ import { StreamClient, APIResponse, UR } from './client'; | ||
export type UpsertManyCollectionRequest<CollectionType extends UR = UR> = { | ||
[collection: string]: NewCollectionEntry<CollectionType>[]; | ||
}; | ||
export class CollectionEntry< | ||
@@ -285,2 +289,24 @@ UserType extends UR = UR, | ||
/** | ||
* UpsertMany one or more items into many collections. | ||
* @link https://getstream.io/activity-feeds/docs/node/collections_batch/?language=js#upsert | ||
* @method upsert | ||
* @memberof Collections.prototype | ||
* @param {string} collection collection name | ||
* @param {UpsertManyCollectionRequest} data - A single json object that contains information of many collections | ||
* @return {Promise<UpsertCollectionAPIResponse<CollectionType>>} | ||
*/ | ||
upsertMany(data: UpsertManyCollectionRequest) { | ||
if (!this.client.usingApiSecret) { | ||
throw new SiteError('This method can only be used server-side using your API Secret'); | ||
} | ||
return this.client.post<UpsertCollectionAPIResponse<CollectionType>>({ | ||
url: 'collections/', | ||
serviceName: 'api', | ||
body: { data }, | ||
token: this.client.getCollectionsToken(), | ||
}); | ||
} | ||
/** | ||
* Select all objects with ids from the collection. | ||
@@ -287,0 +313,0 @@ * @link https://getstream.io/activity-feeds/docs/node/collections_batch/?language=js#select |
@@ -70,7 +70,7 @@ import { AxiosResponse } from 'axios'; | ||
*/ | ||
export class StreamApiError extends ErrorAbstract { | ||
export class StreamApiError<T> extends ErrorAbstract { | ||
error: unknown; | ||
response: AxiosResponse; | ||
response: AxiosResponse<T>; | ||
constructor(msg: string, data: unknown, response: AxiosResponse) { | ||
constructor(msg: string, data: unknown, response: AxiosResponse<T>) { | ||
super(msg); | ||
@@ -77,0 +77,0 @@ |
@@ -38,2 +38,9 @@ import { StreamClient, APIResponse, UR } from './client'; | ||
export type ChildReactionsRecords< | ||
ReactionType extends UR = UR, | ||
ChildReactionType extends UR = UR, | ||
UserType extends UR = UR | ||
// eslint-disable-next-line no-use-before-define | ||
> = Record<string, EnrichedReaction<ReactionType, ChildReactionType, UserType>[]>; | ||
export type EnrichedReaction< | ||
@@ -45,5 +52,5 @@ ReactionType extends UR = UR, | ||
children_counts: Record<string, number>; | ||
latest_children: Record<string, ChildReactionType>; | ||
latest_children: ChildReactionsRecords<ReactionType, ChildReactionType, UserType>; | ||
latest_children_extra?: Record<string, { next?: string }>; | ||
own_children?: Record<string, ChildReactionType>; | ||
own_children?: ChildReactionsRecords<ReactionType, ChildReactionType, UserType>; | ||
user?: EnrichedUser<UserType>; | ||
@@ -50,0 +57,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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
799636
67
15710
+ Addedaxios@0.22.0(transitive)
- Removedaxios@0.21.4(transitive)
Updatedaxios@^0.22.0