@knocklabs/node 0.4.22 → 0.4.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +1 -1
- package/dist/src/common/interfaces.d.ts +1 -1
- package/dist/src/resources/objects/index.d.ts +2 -1
- package/dist/src/resources/objects/index.js +9 -1
- package/dist/src/resources/objects/interfaces.d.ts +6 -1
- package/dist/src/resources/users/index.d.ts +3 -2
- package/dist/src/resources/users/interfaces.d.ts +2 -0
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -18,7 +18,7 @@ export interface UnprocessableEntityError {
|
|
|
18
18
|
type: string;
|
|
19
19
|
field: string;
|
|
20
20
|
}
|
|
21
|
-
export declare type ChannelType = "email" | "in_app_feed" | "sms" | "push" | "chat";
|
|
21
|
+
export declare type ChannelType = "email" | "in_app_feed" | "sms" | "push" | "chat" | "http";
|
|
22
22
|
export declare type CommonMetadata = Record<string, any>;
|
|
23
23
|
export interface ChannelData<T = CommonMetadata> {
|
|
24
24
|
channel_id: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChannelData, CommonMetadata, SetChannelDataProperties, PaginatedEntriesResponse, ChannelType, PaginatedItemsResponse } from "../../common/interfaces";
|
|
2
2
|
import { Knock } from "../../knock";
|
|
3
|
-
import { AddObjectSubscriptionProperties, BulkSetObjectOption, DeleteObjectSubscriptionProperties, ListObjectOptions, ListObjectSubscriptionsOptions, Object, ObjectSubscription, SetObjectProperties } from "./interfaces";
|
|
3
|
+
import { AddObjectSubscriptionProperties, BulkAddSubscriptionsOption, BulkSetObjectOption, DeleteObjectSubscriptionProperties, ListObjectOptions, ListObjectSubscriptionsOptions, Object, ObjectSubscription, SetObjectProperties } from "./interfaces";
|
|
4
4
|
import { BulkOperation } from "../bulk_operations/interfaces";
|
|
5
5
|
import { ListMessagesOptions, Message } from "../messages/interfaces";
|
|
6
6
|
import { ListSchedulesProps, Schedule } from "../workflows/interfaces";
|
|
@@ -14,6 +14,7 @@ export declare class Objects {
|
|
|
14
14
|
bulkSet(collection: string, objects: BulkSetObjectOption[]): Promise<BulkOperation>;
|
|
15
15
|
delete(collection: string, id: string): Promise<null>;
|
|
16
16
|
bulkDelete(collection: string, objectIds: string[]): Promise<BulkOperation>;
|
|
17
|
+
bulkAddSubscriptions<T = CommonMetadata>(collection: string, subscriptions: BulkAddSubscriptionsOption<T>[]): Promise<BulkOperation>;
|
|
17
18
|
getChannelData<T = CommonMetadata>(collection: string, id: string, channelId: string): Promise<ChannelData<T>>;
|
|
18
19
|
setChannelData<T = CommonMetadata>(collection: string, id: string, channelId: string, channelData: SetChannelDataProperties): Promise<ChannelData<T>>;
|
|
19
20
|
unsetChannelData(collection: string, id: string, channelId: string): Promise<any>;
|
|
@@ -33,6 +33,7 @@ class Objects {
|
|
|
33
33
|
return data;
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
+
// Bulk ops
|
|
36
37
|
bulkSet(collection, objects) {
|
|
37
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
39
|
const attrs = { objects };
|
|
@@ -55,6 +56,13 @@ class Objects {
|
|
|
55
56
|
return data;
|
|
56
57
|
});
|
|
57
58
|
}
|
|
59
|
+
bulkAddSubscriptions(collection, subscriptions) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const attrs = { subscriptions };
|
|
62
|
+
const { data } = yield this.knock.post(`/v1/objects/${collection}/bulk/subscriptions/add`, attrs);
|
|
63
|
+
return data;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
58
66
|
// Channel data
|
|
59
67
|
getChannelData(collection, id, channelId) {
|
|
60
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -171,7 +179,7 @@ class Objects {
|
|
|
171
179
|
}
|
|
172
180
|
getSubscriptions(collection, objectId, options = {}) {
|
|
173
181
|
return __awaiter(this, void 0, void 0, function* () {
|
|
174
|
-
const { data } = yield this.knock.get(`/v1/objects/${collection}/${objectId}/subscriptions`, Object.assign(Object.assign({}, options), { mode: "recipient" }));
|
|
182
|
+
const { data, } = yield this.knock.get(`/v1/objects/${collection}/${objectId}/subscriptions`, Object.assign(Object.assign({}, options), { mode: "recipient" }));
|
|
175
183
|
return data;
|
|
176
184
|
});
|
|
177
185
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommonMetadata, PaginationOptions } from "../../common/interfaces";
|
|
2
|
-
import { User } from "../users/interfaces";
|
|
2
|
+
import { User, IdentifyProperties as IdentifyUserProperties } from "../users/interfaces";
|
|
3
3
|
import { Recipient, RecipientWithUpsert } from "../workflows/interfaces";
|
|
4
4
|
export interface ObjectRef {
|
|
5
5
|
collection: string;
|
|
@@ -21,6 +21,11 @@ export interface BulkSetObjectOption {
|
|
|
21
21
|
name?: string;
|
|
22
22
|
[key: string]: any;
|
|
23
23
|
}
|
|
24
|
+
export interface BulkAddSubscriptionsOption<T = CommonMetadata> {
|
|
25
|
+
id: string;
|
|
26
|
+
properties?: T;
|
|
27
|
+
recipients: (IdentifyUserProperties | SetObjectProperties | string)[];
|
|
28
|
+
}
|
|
24
29
|
export interface ListObjectOptions extends PaginationOptions {
|
|
25
30
|
object_id?: string;
|
|
26
31
|
name?: string;
|
|
@@ -4,7 +4,8 @@ import { ChannelTypePreferences, PreferenceOptions, PreferenceSet, SetPreference
|
|
|
4
4
|
import { ListMessagesOptions, Message } from "../messages/interfaces";
|
|
5
5
|
import { ListSchedulesProps, Schedule } from "../workflows/interfaces";
|
|
6
6
|
import { Knock } from "../../knock";
|
|
7
|
-
import { BulkIdentifyUser, IdentifyProperties, ListUserOptions, User, UserFeedOptions } from "./interfaces";
|
|
7
|
+
import { BulkIdentifyUser, IdentifyProperties, ListSubscriptionsOptions, ListUserOptions, User, UserFeedOptions } from "./interfaces";
|
|
8
|
+
import { ObjectSubscription } from "../objects/interfaces";
|
|
8
9
|
export declare class Users {
|
|
9
10
|
readonly knock: Knock;
|
|
10
11
|
constructor(knock: Knock);
|
|
@@ -35,5 +36,5 @@ export declare class Users {
|
|
|
35
36
|
unsetChannelData(userId: string, channelId: string): Promise<any>;
|
|
36
37
|
getMessages(userId: string, filteringOptions?: ListMessagesOptions): Promise<PaginatedItemsResponse<Message>>;
|
|
37
38
|
getSchedules(userId: string, filteringOptions?: ListSchedulesProps): Promise<PaginatedEntriesResponse<Schedule>>;
|
|
38
|
-
getSubscriptions(userId: string, filteringOptions?:
|
|
39
|
+
getSubscriptions(userId: string, filteringOptions?: ListSubscriptionsOptions): Promise<PaginatedEntriesResponse<ObjectSubscription>>;
|
|
39
40
|
}
|