@activepieces/piece-knock 0.1.0

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.
Files changed (37) hide show
  1. package/package.json +16 -0
  2. package/src/index.d.ts +2 -0
  3. package/src/index.d.ts.map +1 -0
  4. package/src/index.js +38 -0
  5. package/src/index.js.map +1 -0
  6. package/src/lib/actions/delete-user.d.ts +4 -0
  7. package/src/lib/actions/delete-user.d.ts.map +1 -0
  8. package/src/lib/actions/delete-user.js +31 -0
  9. package/src/lib/actions/delete-user.js.map +1 -0
  10. package/src/lib/actions/get-message.d.ts +4 -0
  11. package/src/lib/actions/get-message.d.ts.map +1 -0
  12. package/src/lib/actions/get-message.js +31 -0
  13. package/src/lib/actions/get-message.js.map +1 -0
  14. package/src/lib/actions/get-user.d.ts +4 -0
  15. package/src/lib/actions/get-user.d.ts.map +1 -0
  16. package/src/lib/actions/get-user.js +31 -0
  17. package/src/lib/actions/get-user.js.map +1 -0
  18. package/src/lib/actions/identify-user.d.ts +9 -0
  19. package/src/lib/actions/identify-user.d.ts.map +1 -0
  20. package/src/lib/actions/identify-user.js +71 -0
  21. package/src/lib/actions/identify-user.js.map +1 -0
  22. package/src/lib/actions/list-messages.d.ts +9 -0
  23. package/src/lib/actions/list-messages.d.ts.map +1 -0
  24. package/src/lib/actions/list-messages.js +80 -0
  25. package/src/lib/actions/list-messages.js.map +1 -0
  26. package/src/lib/actions/trigger-workflow.d.ts +8 -0
  27. package/src/lib/actions/trigger-workflow.d.ts.map +1 -0
  28. package/src/lib/actions/trigger-workflow.js +65 -0
  29. package/src/lib/actions/trigger-workflow.js.map +1 -0
  30. package/src/lib/auth.d.ts +4 -0
  31. package/src/lib/auth.d.ts.map +1 -0
  32. package/src/lib/auth.js +48 -0
  33. package/src/lib/auth.js.map +1 -0
  34. package/src/lib/common/client.d.ts +11 -0
  35. package/src/lib/common/client.d.ts.map +1 -0
  36. package/src/lib/common/client.js +35 -0
  37. package/src/lib/common/client.js.map +1 -0
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@activepieces/piece-knock",
3
+ "version": "0.1.0",
4
+ "main": "./src/index.js",
5
+ "types": "./src/index.d.ts",
6
+ "dependencies": {
7
+ "@activepieces/pieces-common": "0.12.0",
8
+ "@activepieces/pieces-framework": "0.26.0",
9
+ "@activepieces/shared": "0.51.0",
10
+ "tslib": "^2.3.0"
11
+ },
12
+ "scripts": {
13
+ "build": "tsc -p tsconfig.lib.json && cp package.json dist/",
14
+ "lint": "eslint 'src/**/*.ts'"
15
+ }
16
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare const knock: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,KAAK,mHAuBhB,CAAC"}
package/src/index.js ADDED
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.knock = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const shared_1 = require("@activepieces/shared");
7
+ const pieces_common_1 = require("@activepieces/pieces-common");
8
+ const auth_1 = require("./lib/auth");
9
+ const trigger_workflow_1 = require("./lib/actions/trigger-workflow");
10
+ const identify_user_1 = require("./lib/actions/identify-user");
11
+ const get_user_1 = require("./lib/actions/get-user");
12
+ const delete_user_1 = require("./lib/actions/delete-user");
13
+ const get_message_1 = require("./lib/actions/get-message");
14
+ const list_messages_1 = require("./lib/actions/list-messages");
15
+ exports.knock = (0, pieces_framework_1.createPiece)({
16
+ displayName: 'Knock',
17
+ description: 'Notification infrastructure for developers. Manage users, trigger workflows, and track messages.',
18
+ auth: auth_1.knockAuth,
19
+ minimumSupportedRelease: '0.36.1',
20
+ logoUrl: 'https://cdn.activepieces.com/pieces/knock.png',
21
+ categories: [shared_1.PieceCategory.COMMUNICATION],
22
+ authors: ['Harmatta'],
23
+ actions: [
24
+ trigger_workflow_1.triggerWorkflow,
25
+ identify_user_1.identifyUser,
26
+ get_user_1.getUser,
27
+ delete_user_1.deleteUser,
28
+ get_message_1.getMessage,
29
+ list_messages_1.listMessages,
30
+ (0, pieces_common_1.createCustomApiCallAction)({
31
+ baseUrl: () => auth_1.KNOCK_API_BASE_URL,
32
+ auth: auth_1.knockAuth,
33
+ authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return (0, auth_1.knockHeaders)(auth.secret_text); }),
34
+ }),
35
+ ],
36
+ triggers: [],
37
+ });
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA6D;AAC7D,iDAAqD;AACrD,+DAAwE;AACxE,qCAAyE;AACzE,qEAAiE;AACjE,+DAA2D;AAC3D,qDAAiD;AACjD,2DAAuD;AACvD,2DAAuD;AACvD,+DAA2D;AAE9C,QAAA,KAAK,GAAG,IAAA,8BAAW,EAAC;IAC/B,WAAW,EAAE,OAAO;IACpB,WAAW,EACT,kGAAkG;IACpG,IAAI,EAAE,gBAAS;IACf,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,+CAA+C;IACxD,UAAU,EAAE,CAAC,sBAAa,CAAC,aAAa,CAAC;IACzC,OAAO,EAAE,CAAC,UAAU,CAAC;IACrB,OAAO,EAAE;QACP,kCAAe;QACf,4BAAY;QACZ,kBAAO;QACP,wBAAU;QACV,wBAAU;QACV,4BAAY;QACZ,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,yBAAkB;YACjC,IAAI,EAAE,gBAAS;YACf,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE,0DAAC,OAAA,IAAA,mBAAY,EAAC,IAAI,CAAC,WAAW,CAAC,CAAA,GAAA;SAC5D,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const deleteUser: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ userId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ }>;
4
+ //# sourceMappingURL=delete-user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-user.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/delete-user.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU;;EAmBrB,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteUser = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
7
+ const auth_1 = require("../auth");
8
+ const client_1 = require("../common/client");
9
+ exports.deleteUser = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.knockAuth,
11
+ name: 'delete_user',
12
+ displayName: 'Delete User',
13
+ description: 'Delete a user from Knock by their ID.',
14
+ props: {
15
+ userId: pieces_framework_1.Property.ShortText({
16
+ displayName: 'User ID',
17
+ description: 'The unique identifier of the user to delete.',
18
+ required: true,
19
+ }),
20
+ },
21
+ run(context) {
22
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
+ return (0, client_1.knockApiCall)({
24
+ apiKey: context.auth.secret_text,
25
+ method: pieces_common_1.HttpMethod.DELETE,
26
+ path: `/users/${encodeURIComponent(context.propsValue.userId)}`,
27
+ });
28
+ });
29
+ },
30
+ });
31
+ //# sourceMappingURL=delete-user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-user.js","sourceRoot":"","sources":["../../../../src/lib/actions/delete-user.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,kCAAoC;AACpC,6CAAgD;AAEnC,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,uCAAuC;IACpD,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,8CAA8C;YAC3D,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,IAAA,qBAAY,EAAC;gBAClB,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAChC,MAAM,EAAE,0BAAU,CAAC,MAAM;gBACzB,IAAI,EAAE,UAAU,kBAAkB,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;aAChE,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const getMessage: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ messageId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ }>;
4
+ //# sourceMappingURL=get-message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-message.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-message.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,UAAU;;EAmBrB,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMessage = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
7
+ const auth_1 = require("../auth");
8
+ const client_1 = require("../common/client");
9
+ exports.getMessage = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.knockAuth,
11
+ name: 'get_message',
12
+ displayName: 'Get Message',
13
+ description: 'Retrieve a Knock message by its ID.',
14
+ props: {
15
+ messageId: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Message ID',
17
+ description: 'The unique identifier of the message.',
18
+ required: true,
19
+ }),
20
+ },
21
+ run(context) {
22
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
+ return (0, client_1.knockApiCall)({
24
+ apiKey: context.auth.secret_text,
25
+ method: pieces_common_1.HttpMethod.GET,
26
+ path: `/messages/${encodeURIComponent(context.propsValue.messageId)}`,
27
+ });
28
+ });
29
+ },
30
+ });
31
+ //# sourceMappingURL=get-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-message.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-message.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,kCAAoC;AACpC,6CAAgD;AAEnC,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,qCAAqC;IAClD,KAAK,EAAE;QACL,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,IAAA,qBAAY,EAAC;gBAClB,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAChC,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,aAAa,kBAAkB,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;aACtE,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const getUser: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ userId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ }>;
4
+ //# sourceMappingURL=get-user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-user.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-user.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO;;EAmBlB,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getUser = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
7
+ const auth_1 = require("../auth");
8
+ const client_1 = require("../common/client");
9
+ exports.getUser = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.knockAuth,
11
+ name: 'get_user',
12
+ displayName: 'Get User',
13
+ description: 'Retrieve a user from Knock by their ID.',
14
+ props: {
15
+ userId: pieces_framework_1.Property.ShortText({
16
+ displayName: 'User ID',
17
+ description: 'The unique identifier of the user to retrieve.',
18
+ required: true,
19
+ }),
20
+ },
21
+ run(context) {
22
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
+ return (0, client_1.knockApiCall)({
24
+ apiKey: context.auth.secret_text,
25
+ method: pieces_common_1.HttpMethod.GET,
26
+ path: `/users/${encodeURIComponent(context.propsValue.userId)}`,
27
+ });
28
+ });
29
+ },
30
+ });
31
+ //# sourceMappingURL=get-user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-user.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-user.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,kCAAoC;AACpC,6CAAgD;AAEnC,QAAA,OAAO,GAAG,IAAA,+BAAY,EAAC;IAClC,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,yCAAyC;IACtD,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,gDAAgD;YAC7D,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,IAAA,qBAAY,EAAC;gBAClB,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAChC,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,UAAU,kBAAkB,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;aAChE,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare const identifyUser: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ userId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
4
+ email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
+ phoneNumber: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
+ avatar: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
+ customProperties: import("@activepieces/pieces-framework").ObjectProperty<false>;
8
+ }>;
9
+ //# sourceMappingURL=identify-user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identify-user.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/identify-user.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY;;;;;;;EA4DvB,CAAC"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.identifyUser = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
7
+ const auth_1 = require("../auth");
8
+ const client_1 = require("../common/client");
9
+ exports.identifyUser = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.knockAuth,
11
+ name: 'identify_user',
12
+ displayName: 'Identify User',
13
+ description: 'Create or update a user in Knock.',
14
+ props: {
15
+ userId: pieces_framework_1.Property.ShortText({
16
+ displayName: 'User ID',
17
+ description: 'A unique identifier for the user in your system.',
18
+ required: true,
19
+ }),
20
+ name: pieces_framework_1.Property.ShortText({
21
+ displayName: 'Name',
22
+ description: 'The user display name.',
23
+ required: false,
24
+ }),
25
+ email: pieces_framework_1.Property.ShortText({
26
+ displayName: 'Email',
27
+ description: 'The user email address.',
28
+ required: false,
29
+ }),
30
+ phoneNumber: pieces_framework_1.Property.ShortText({
31
+ displayName: 'Phone Number',
32
+ description: 'Phone number in E.164 format (e.g. +14155552671).',
33
+ required: false,
34
+ }),
35
+ avatar: pieces_framework_1.Property.ShortText({
36
+ displayName: 'Avatar URL',
37
+ description: 'URL to the user avatar image.',
38
+ required: false,
39
+ }),
40
+ customProperties: pieces_framework_1.Property.Object({
41
+ displayName: 'Custom Properties',
42
+ description: 'Additional key-value properties to set on the user.',
43
+ required: false,
44
+ }),
45
+ },
46
+ run(context) {
47
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
48
+ const { userId, name, email, phoneNumber, avatar, customProperties } = context.propsValue;
49
+ const body = {};
50
+ // Spread custom properties first so explicit fields always win
51
+ if (customProperties && Object.keys(customProperties).length > 0) {
52
+ Object.assign(body, customProperties);
53
+ }
54
+ if (name)
55
+ body['name'] = name;
56
+ if (email)
57
+ body['email'] = email;
58
+ if (phoneNumber)
59
+ body['phone_number'] = phoneNumber;
60
+ if (avatar)
61
+ body['avatar'] = avatar;
62
+ return (0, client_1.knockApiCall)({
63
+ apiKey: context.auth.secret_text,
64
+ method: pieces_common_1.HttpMethod.PUT,
65
+ path: `/users/${encodeURIComponent(userId)}`,
66
+ body,
67
+ });
68
+ });
69
+ },
70
+ });
71
+ //# sourceMappingURL=identify-user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identify-user.js","sourceRoot":"","sources":["../../../../src/lib/actions/identify-user.ts"],"names":[],"mappings":";;;;AAA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AgB,IAAI,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACjE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;YACxC,CAAC;YAED,IAAI,IAAI;gBAAE,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;YAC9B,IAAI,KAAK;gBAAE,IAAI,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;YACjC,IAAI,WAAW;gBAAE,IAAI,CAAC,cAAc,CAAC,GAAG,WAAW,CAAC;YACpD,IAAI,MAAM;gBAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;YAEpC,OAAO,IAAA,qBAAY,EAAC;gBAClB,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAChC,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,UAAU,kBAAkB,CAAC,MAAM,CAAC,EAAE;gBAC5C,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare const listMessages: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ channel_id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
3
+ status: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
4
+ source: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
+ tenant: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
+ page_size: import("@activepieces/pieces-framework").NumberProperty<false>;
7
+ after: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
+ }>;
9
+ //# sourceMappingURL=list-messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-messages.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/list-messages.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY;;;;;;;EAwEvB,CAAC"}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listMessages = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
7
+ const auth_1 = require("../auth");
8
+ const client_1 = require("../common/client");
9
+ exports.listMessages = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.knockAuth,
11
+ name: 'list_messages',
12
+ displayName: 'List Messages',
13
+ description: 'List Knock messages with optional filters and pagination.',
14
+ props: {
15
+ channel_id: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Channel ID',
17
+ description: 'Filter messages by channel ID.',
18
+ required: false,
19
+ }),
20
+ status: pieces_framework_1.Property.StaticDropdown({
21
+ displayName: 'Status',
22
+ description: 'Filter messages by delivery status.',
23
+ required: false,
24
+ options: {
25
+ disabled: false,
26
+ options: [
27
+ { label: 'Queued', value: 'queued' },
28
+ { label: 'Sent', value: 'sent' },
29
+ { label: 'Delivered', value: 'delivered' },
30
+ { label: 'Bounced', value: 'bounced' },
31
+ { label: 'Undelivered', value: 'undelivered' },
32
+ { label: 'Not sent', value: 'not_sent' },
33
+ ],
34
+ },
35
+ }),
36
+ source: pieces_framework_1.Property.ShortText({
37
+ displayName: 'Workflow Key',
38
+ description: 'Filter by the workflow that generated the message.',
39
+ required: false,
40
+ }),
41
+ tenant: pieces_framework_1.Property.ShortText({
42
+ displayName: 'Tenant',
43
+ description: 'Filter messages by tenant.',
44
+ required: false,
45
+ }),
46
+ page_size: pieces_framework_1.Property.Number({
47
+ displayName: 'Page Size',
48
+ description: 'Number of messages per page (1–50, default 50).',
49
+ required: false,
50
+ defaultValue: 50,
51
+ }),
52
+ after: pieces_framework_1.Property.ShortText({
53
+ displayName: 'After Cursor',
54
+ description: 'Cursor for forward pagination.',
55
+ required: false,
56
+ }),
57
+ },
58
+ run(context) {
59
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
60
+ const { channel_id, status, source, tenant, page_size, after } = context.propsValue;
61
+ const rawPageSize = page_size !== null && page_size !== void 0 ? page_size : 50;
62
+ const clampedPageSize = Math.max(1, Math.min(50, rawPageSize));
63
+ const query = {
64
+ channel_id: channel_id || undefined,
65
+ status: status || undefined,
66
+ source: source || undefined,
67
+ tenant: tenant || undefined,
68
+ page_size: String(clampedPageSize),
69
+ after: after || undefined,
70
+ };
71
+ return (0, client_1.knockApiCall)({
72
+ apiKey: context.auth.secret_text,
73
+ method: pieces_common_1.HttpMethod.GET,
74
+ path: '/messages',
75
+ query,
76
+ });
77
+ });
78
+ },
79
+ });
80
+ //# sourceMappingURL=list-messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-messages.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-messages.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,kCAAoC;AACpC,6CAAgD;AAEnC,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,2DAA2D;IACxE,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,gCAAgC;YAC7C,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC9B,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,qCAAqC;YAClD,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;oBACpC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;oBAChC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;oBAC1C,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AS;gBAC3B,MAAM,EAAE,MAAM,IAAI,SAAS;gBAC3B,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC;gBAClC,KAAK,EAAE,KAAK,IAAI,SAAS;aAC1B,CAAC;YAEF,OAAO,IAAA,qBAAY,EAAC;gBAClB,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAChC,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,WAAW;gBACjB,KAAK;aACN,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const triggerWorkflow: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ workflowKey: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ recipients: import("@activepieces/pieces-framework").ArrayProperty<true>;
4
+ actorId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
+ data: import("@activepieces/pieces-framework").ObjectProperty<false>;
6
+ tenant: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
+ }>;
8
+ //# sourceMappingURL=trigger-workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trigger-workflow.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/trigger-workflow.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe;;;;;;EAyD1B,CAAC"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.triggerWorkflow = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
7
+ const auth_1 = require("../auth");
8
+ const client_1 = require("../common/client");
9
+ exports.triggerWorkflow = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.knockAuth,
11
+ name: 'trigger_workflow',
12
+ displayName: 'Trigger Workflow',
13
+ description: 'Trigger a Knock notification workflow for one or more recipients.',
14
+ props: {
15
+ workflowKey: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Workflow Key',
17
+ description: 'The key of the workflow to trigger (e.g. "new-comment").',
18
+ required: true,
19
+ }),
20
+ recipients: pieces_framework_1.Property.Array({
21
+ displayName: 'Recipient IDs',
22
+ description: 'One or more user IDs to receive the notification.',
23
+ required: true,
24
+ }),
25
+ actorId: pieces_framework_1.Property.ShortText({
26
+ displayName: 'Actor ID',
27
+ description: 'The user ID of the person performing the action (optional).',
28
+ required: false,
29
+ }),
30
+ data: pieces_framework_1.Property.Object({
31
+ displayName: 'Data',
32
+ description: 'Key-value data passed to the workflow template (optional).',
33
+ required: false,
34
+ }),
35
+ tenant: pieces_framework_1.Property.ShortText({
36
+ displayName: 'Tenant',
37
+ description: 'Optional tenant identifier for multi-tenant workflows.',
38
+ required: false,
39
+ }),
40
+ },
41
+ run(context) {
42
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
43
+ const { workflowKey, recipients, actorId, data, tenant } = context.propsValue;
44
+ const body = {
45
+ recipients,
46
+ };
47
+ if (actorId) {
48
+ body['actor'] = actorId;
49
+ }
50
+ if (data && Object.keys(data).length > 0) {
51
+ body['data'] = data;
52
+ }
53
+ if (tenant) {
54
+ body['tenant'] = tenant;
55
+ }
56
+ return (0, client_1.knockApiCall)({
57
+ apiKey: context.auth.secret_text,
58
+ method: pieces_common_1.HttpMethod.POST,
59
+ path: `/workflows/${encodeURIComponent(workflowKey)}/trigger`,
60
+ body,
61
+ });
62
+ });
63
+ },
64
+ });
65
+ //# sourceMappingURL=trigger-workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trigger-workflow.js","sourceRoot":"","sources":["../../../../src/lib/actions/trigger-workflow.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,kCAAoC;AACpC,6CAAgD;AAEnC,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE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AAC,GAAG,MAAM,CAAC;YAC1B,CAAC;YAED,OAAO,IAAA,qBAAY,EAAC;gBAClB,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAChC,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,IAAI,EAAE,cAAc,kBAAkB,CAAC,WAAW,CAAC,UAAU;gBAC7D,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const KNOCK_API_BASE_URL = "https://api.knock.app/v1";
2
+ export declare const knockAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
3
+ export declare function knockHeaders(apiKey: string): Record<string, string>;
4
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAE7D,eAAO,MAAM,SAAS,mEAgCpB,CAAC;AAEH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMnE"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.knockAuth = exports.KNOCK_API_BASE_URL = void 0;
4
+ exports.knockHeaders = knockHeaders;
5
+ const tslib_1 = require("tslib");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
8
+ exports.KNOCK_API_BASE_URL = 'https://api.knock.app/v1';
9
+ exports.knockAuth = pieces_framework_1.PieceAuth.SecretText({
10
+ displayName: 'Knock Secret API Key',
11
+ description: 'Your Knock secret API key (starts with sk_). Found under Developer > API Keys in the Knock dashboard.',
12
+ required: true,
13
+ validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
14
+ var _b, _c;
15
+ if (!auth) {
16
+ return { valid: false, error: 'API key is required.' };
17
+ }
18
+ try {
19
+ yield pieces_common_1.httpClient.sendRequest({
20
+ method: pieces_common_1.HttpMethod.GET,
21
+ url: `${exports.KNOCK_API_BASE_URL}/users?page_size=1`,
22
+ headers: knockHeaders(auth),
23
+ });
24
+ return { valid: true };
25
+ }
26
+ catch (e) {
27
+ const err = e;
28
+ if (((_b = err.response) === null || _b === void 0 ? void 0 : _b.status) === 401 || ((_c = err.response) === null || _c === void 0 ? void 0 : _c.status) === 403) {
29
+ return {
30
+ valid: false,
31
+ error: 'Invalid API key or insufficient permissions.',
32
+ };
33
+ }
34
+ return {
35
+ valid: false,
36
+ error: `Connection failed: ${String(e).slice(0, 100)}`,
37
+ };
38
+ }
39
+ }),
40
+ });
41
+ function knockHeaders(apiKey) {
42
+ return {
43
+ Authorization: `Bearer ${apiKey}`,
44
+ 'Content-Type': 'application/json',
45
+ Accept: 'application/json',
46
+ };
47
+ }
48
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;AAuCA,oCAMC;;AA7CD,+DAAqE;AACrE,qEAA2D;AAE9C,QAAA,kBAAkB,GAAG,0BAA0B,CAAC;AAEhD,QAAA,SAAS,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC5C,WAAW,EAAE,sBAAsB;IACnC,WAAW,EACT,uGAAuG;IACzG,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;;QACvB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,sBAAsB,EAAE,CAAC;QACzD,CAAC;QAED,IAAI,CAAC;YACH,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC3B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,0BAAkB,oBAAoB;gBAC9C,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC;aAC5B,CAAC,CAAC;YAEH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YACpB,MAAM,GAAG,GAAG,CAAuC,CAAC;YACpD,IAAI,CAAA,MAAA,GAAG,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,IAAI,CAAA,MAAA,GAAG,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;gBACjE,OAAO;oBACL,KAAK,EAAE,KAAK;oBACZ,KAAK,EAAE,8CAA8C;iBACtD,CAAC;YACJ,CAAC;YACD,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,sBAAsB,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;aACvD,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC;AAEH,SAAgB,YAAY,CAAC,MAAc;IACzC,OAAO;QACL,aAAa,EAAE,UAAU,MAAM,EAAE;QACjC,cAAc,EAAE,kBAAkB;QAClC,MAAM,EAAE,kBAAkB;KAC3B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { HttpMethod } from '@activepieces/pieces-common';
2
+ interface KnockApiCallParams {
3
+ apiKey: string;
4
+ method: HttpMethod;
5
+ path: string;
6
+ body?: unknown;
7
+ query?: Record<string, string | string[] | undefined>;
8
+ }
9
+ export declare function knockApiCall(params: KnockApiCallParams): Promise<unknown>;
10
+ export {};
11
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2B,MAAM,6BAA6B,CAAC;AAGlF,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;CACvD;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CA2B/E"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.knockApiCall = knockApiCall;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ const auth_1 = require("../auth");
7
+ function knockApiCall(params) {
8
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
+ const { apiKey, method, path, body, query } = params;
10
+ const url = new URL(`${auth_1.KNOCK_API_BASE_URL}${path}`);
11
+ if (query) {
12
+ for (const [key, value] of Object.entries(query)) {
13
+ if (value === undefined)
14
+ continue;
15
+ if (Array.isArray(value)) {
16
+ for (const v of value) {
17
+ url.searchParams.append(key, v);
18
+ }
19
+ }
20
+ else {
21
+ url.searchParams.set(key, value);
22
+ }
23
+ }
24
+ }
25
+ const request = {
26
+ method,
27
+ url: url.toString(),
28
+ headers: (0, auth_1.knockHeaders)(apiKey),
29
+ body: body !== null && body !== void 0 ? body : undefined,
30
+ };
31
+ const response = yield pieces_common_1.httpClient.sendRequest(request);
32
+ return response.body;
33
+ });
34
+ }
35
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":";;AAWA,oCA2BC;;AAtCD,+DAAkF;AAClF,kCAA2D;AAU3D,SAAsB,YAAY,CAAC,MAA0B;;QAC3D,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;QAErD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,yBAAkB,GAAG,IAAI,EAAE,CAAC,CAAC;QAEpD,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjD,IAAI,KAAK,KAAK,SAAS;oBAAE,SAAS;gBAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBACzB,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;wBACtB,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;oBAClC,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;gBACnC,CAAC;YACH,CAAC;QACH,CAAC;QAED,MAAM,OAAO,GAAgB;YAC3B,MAAM;YACN,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE;YACnB,OAAO,EAAE,IAAA,mBAAY,EAAC,MAAM,CAAC;YAC7B,IAAI,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,SAAS;SACxB,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACvD,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CAAA"}