piece-signal-cli-rest-api 0.2.0 → 0.2.1

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 (179) hide show
  1. package/package.json +26 -4
  2. package/src/index.d.ts +8 -0
  3. package/src/index.js +90 -0
  4. package/src/index.js.map +1 -0
  5. package/src/lib/actions/add-admins-to-group.d.ts +12 -0
  6. package/src/lib/actions/add-admins-to-group.js +45 -0
  7. package/src/lib/actions/add-admins-to-group.js.map +1 -0
  8. package/src/lib/actions/add-device.d.ts +11 -0
  9. package/src/lib/actions/add-device.js +40 -0
  10. package/src/lib/actions/add-device.js.map +1 -0
  11. package/src/lib/actions/add-members-to-group.d.ts +12 -0
  12. package/src/lib/actions/add-members-to-group.js +45 -0
  13. package/src/lib/actions/add-members-to-group.js.map +1 -0
  14. package/src/lib/actions/block-group.d.ts +11 -0
  15. package/src/lib/actions/block-group.js +37 -0
  16. package/src/lib/actions/block-group.js.map +1 -0
  17. package/src/lib/actions/create-group.d.ts +18 -0
  18. package/src/lib/actions/create-group.js +117 -0
  19. package/src/lib/actions/create-group.js.map +1 -0
  20. package/src/lib/actions/delete-group.d.ts +11 -0
  21. package/src/lib/actions/delete-group.js +37 -0
  22. package/src/lib/actions/delete-group.js.map +1 -0
  23. package/src/lib/actions/get-contact.d.ts +11 -0
  24. package/src/lib/actions/get-contact.js +37 -0
  25. package/src/lib/actions/get-contact.js.map +1 -0
  26. package/src/lib/actions/get-group.d.ts +11 -0
  27. package/src/lib/actions/get-group.js +37 -0
  28. package/src/lib/actions/get-group.js.map +1 -0
  29. package/src/lib/actions/get-qr-code-link.d.ts +11 -0
  30. package/src/lib/actions/get-qr-code-link.js +60 -0
  31. package/src/lib/actions/get-qr-code-link.js.map +1 -0
  32. package/src/lib/actions/join-group.d.ts +11 -0
  33. package/src/lib/actions/join-group.js +37 -0
  34. package/src/lib/actions/join-group.js.map +1 -0
  35. package/src/lib/actions/list-accounts.d.ts +8 -0
  36. package/src/lib/actions/list-accounts.js +23 -0
  37. package/src/lib/actions/list-accounts.js.map +1 -0
  38. package/src/lib/actions/list-attachments.d.ts +8 -0
  39. package/src/lib/actions/list-attachments.js +23 -0
  40. package/src/lib/actions/list-attachments.js.map +1 -0
  41. package/src/lib/actions/list-contacts.d.ts +10 -0
  42. package/src/lib/actions/list-contacts.js +32 -0
  43. package/src/lib/actions/list-contacts.js.map +1 -0
  44. package/src/lib/actions/list-devices.d.ts +10 -0
  45. package/src/lib/actions/list-devices.js +32 -0
  46. package/src/lib/actions/list-devices.js.map +1 -0
  47. package/src/lib/actions/list-groups.d.ts +10 -0
  48. package/src/lib/actions/list-groups.js +32 -0
  49. package/src/lib/actions/list-groups.js.map +1 -0
  50. package/src/lib/actions/list-identities.d.ts +10 -0
  51. package/src/lib/actions/list-identities.js +32 -0
  52. package/src/lib/actions/list-identities.js.map +1 -0
  53. package/src/lib/actions/quit-group.d.ts +11 -0
  54. package/src/lib/actions/quit-group.js +37 -0
  55. package/src/lib/actions/quit-group.js.map +1 -0
  56. package/src/lib/actions/receive-messages.d.ts +15 -0
  57. package/src/lib/actions/receive-messages.js +100 -0
  58. package/src/lib/actions/receive-messages.js.map +1 -0
  59. package/src/lib/actions/remote-delete-message.d.ts +12 -0
  60. package/src/lib/actions/remote-delete-message.js +46 -0
  61. package/src/lib/actions/remote-delete-message.js.map +1 -0
  62. package/src/lib/actions/remove-admins-from-group.d.ts +12 -0
  63. package/src/lib/actions/remove-admins-from-group.js +45 -0
  64. package/src/lib/actions/remove-admins-from-group.js.map +1 -0
  65. package/src/lib/actions/remove-device.d.ts +11 -0
  66. package/src/lib/actions/remove-device.js +37 -0
  67. package/src/lib/actions/remove-device.js.map +1 -0
  68. package/src/lib/actions/remove-members-from-group.d.ts +12 -0
  69. package/src/lib/actions/remove-members-from-group.js +45 -0
  70. package/src/lib/actions/remove-members-from-group.js.map +1 -0
  71. package/src/lib/actions/remove-reaction.d.ts +13 -0
  72. package/src/lib/actions/remove-reaction.js +52 -0
  73. package/src/lib/actions/remove-reaction.js.map +1 -0
  74. package/src/lib/actions/request-approval-message.d.ts +15 -0
  75. package/src/lib/actions/request-approval-message.js +184 -0
  76. package/src/lib/actions/request-approval-message.js.map +1 -0
  77. package/src/lib/actions/resume-approval-flow.d.ts +11 -0
  78. package/src/lib/actions/resume-approval-flow.js +181 -0
  79. package/src/lib/actions/resume-approval-flow.js.map +1 -0
  80. package/src/lib/actions/search-numbers.d.ts +11 -0
  81. package/src/lib/actions/search-numbers.js +42 -0
  82. package/src/lib/actions/search-numbers.js.map +1 -0
  83. package/src/lib/actions/send-message.d.ts +27 -0
  84. package/src/lib/actions/send-message.js +176 -0
  85. package/src/lib/actions/send-message.js.map +1 -0
  86. package/src/lib/actions/send-reaction.d.ts +14 -0
  87. package/src/lib/actions/send-reaction.js +58 -0
  88. package/src/lib/actions/send-reaction.js.map +1 -0
  89. package/src/lib/actions/send-receipt.d.ts +13 -0
  90. package/src/lib/actions/send-receipt.js +58 -0
  91. package/src/lib/actions/send-receipt.js.map +1 -0
  92. package/src/lib/actions/start-typing.d.ts +11 -0
  93. package/src/lib/actions/start-typing.js +40 -0
  94. package/src/lib/actions/start-typing.js.map +1 -0
  95. package/src/lib/actions/stop-typing.d.ts +11 -0
  96. package/src/lib/actions/stop-typing.js +40 -0
  97. package/src/lib/actions/stop-typing.js.map +1 -0
  98. package/src/lib/actions/sync-contacts.d.ts +10 -0
  99. package/src/lib/actions/sync-contacts.js +32 -0
  100. package/src/lib/actions/sync-contacts.js.map +1 -0
  101. package/src/lib/actions/update-account-settings.d.ts +12 -0
  102. package/src/lib/actions/update-account-settings.js +49 -0
  103. package/src/lib/actions/update-account-settings.js.map +1 -0
  104. package/src/lib/actions/update-contact.d.ts +13 -0
  105. package/src/lib/actions/update-contact.js +56 -0
  106. package/src/lib/actions/update-contact.js.map +1 -0
  107. package/src/lib/actions/update-group.d.ts +19 -0
  108. package/src/lib/actions/update-group.js +125 -0
  109. package/src/lib/actions/update-group.js.map +1 -0
  110. package/src/lib/actions/update-profile.d.ts +13 -0
  111. package/src/lib/actions/update-profile.js +56 -0
  112. package/src/lib/actions/update-profile.js.map +1 -0
  113. package/src/lib/common/api-client.d.ts +24 -0
  114. package/src/lib/common/api-client.js +103 -0
  115. package/src/lib/common/api-client.js.map +1 -0
  116. package/src/lib/common/auth.d.ts +8 -0
  117. package/src/lib/common/auth.js +68 -0
  118. package/src/lib/common/auth.js.map +1 -0
  119. package/src/lib/common/message-utils.d.ts +81 -0
  120. package/src/lib/common/message-utils.js +327 -0
  121. package/src/lib/common/message-utils.js.map +1 -0
  122. package/src/lib/common/types.d.ts +65 -0
  123. package/src/lib/common/types.js +3 -0
  124. package/src/lib/common/types.js.map +1 -0
  125. package/src/lib/common/utils.d.ts +23 -0
  126. package/src/lib/common/utils.js +105 -0
  127. package/src/lib/common/utils.js.map +1 -0
  128. package/src/lib/triggers/new-group-member.d.ts +50 -0
  129. package/src/lib/triggers/new-group-member.js +155 -0
  130. package/src/lib/triggers/new-group-member.js.map +1 -0
  131. package/src/lib/triggers/new-message-received.d.ts +58 -0
  132. package/src/lib/triggers/new-message-received.js +469 -0
  133. package/src/lib/triggers/new-message-received.js.map +1 -0
  134. package/project.json +0 -58
  135. package/src/index.ts +0 -87
  136. package/src/lib/actions/add-admins-to-group.ts +0 -50
  137. package/src/lib/actions/add-device.ts +0 -45
  138. package/src/lib/actions/add-members-to-group.ts +0 -50
  139. package/src/lib/actions/block-group.ts +0 -36
  140. package/src/lib/actions/create-group.ts +0 -139
  141. package/src/lib/actions/delete-group.ts +0 -36
  142. package/src/lib/actions/get-contact.ts +0 -42
  143. package/src/lib/actions/get-group.ts +0 -37
  144. package/src/lib/actions/get-qr-code-link.ts +0 -62
  145. package/src/lib/actions/join-group.ts +0 -36
  146. package/src/lib/actions/list-accounts.ts +0 -20
  147. package/src/lib/actions/list-attachments.ts +0 -20
  148. package/src/lib/actions/list-contacts.ts +0 -37
  149. package/src/lib/actions/list-devices.ts +0 -38
  150. package/src/lib/actions/list-groups.ts +0 -32
  151. package/src/lib/actions/list-identities.ts +0 -32
  152. package/src/lib/actions/quit-group.ts +0 -36
  153. package/src/lib/actions/receive-messages.ts +0 -108
  154. package/src/lib/actions/remote-delete-message.ts +0 -56
  155. package/src/lib/actions/remove-admins-from-group.ts +0 -50
  156. package/src/lib/actions/remove-device.ts +0 -36
  157. package/src/lib/actions/remove-members-from-group.ts +0 -50
  158. package/src/lib/actions/remove-reaction.ts +0 -59
  159. package/src/lib/actions/request-approval-message.ts +0 -215
  160. package/src/lib/actions/search-numbers.ts +0 -47
  161. package/src/lib/actions/send-message.ts +0 -189
  162. package/src/lib/actions/send-reaction.ts +0 -66
  163. package/src/lib/actions/send-receipt.ts +0 -65
  164. package/src/lib/actions/start-typing.ts +0 -45
  165. package/src/lib/actions/stop-typing.ts +0 -45
  166. package/src/lib/actions/sync-contacts.ts +0 -31
  167. package/src/lib/actions/update-account-settings.ts +0 -57
  168. package/src/lib/actions/update-contact.ts +0 -65
  169. package/src/lib/actions/update-group.ts +0 -145
  170. package/src/lib/actions/update-profile.ts +0 -65
  171. package/src/lib/common/api-client.ts +0 -150
  172. package/src/lib/common/auth.ts +0 -66
  173. package/src/lib/common/message-utils.ts +0 -449
  174. package/src/lib/common/types.ts +0 -73
  175. package/src/lib/common/utils.ts +0 -106
  176. package/src/lib/triggers/new-group-member.ts +0 -176
  177. package/src/lib/triggers/new-message-received.ts +0 -618
  178. package/tsconfig.json +0 -19
  179. package/tsconfig.lib.json +0 -11
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.receiveMessages = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ const utils_1 = require("../common/utils");
8
+ const message_utils_1 = require("../common/message-utils");
9
+ exports.receiveMessages = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.signalCliRestApiAuth,
11
+ name: 'receiveMessages',
12
+ displayName: 'Receive Messages',
13
+ description: 'Receive new messages from Signal. Automatically resumes approval flows if a message is a reaction to an approval request. Can be called manually, e.g., from a webhook or scheduler.',
14
+ props: {
15
+ number: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Phone Number',
17
+ description: 'Registered phone number in international format (e.g., +43123456789)',
18
+ required: true,
19
+ }),
20
+ timeout: pieces_framework_1.Property.Number({
21
+ displayName: 'Timeout (seconds)',
22
+ description: 'Receive timeout in seconds (default: 1)',
23
+ required: false,
24
+ defaultValue: 1,
25
+ }),
26
+ ignore_attachments: pieces_framework_1.Property.Checkbox({
27
+ displayName: 'Ignore Attachments',
28
+ description: 'Ignore attachments when receiving messages',
29
+ required: false,
30
+ defaultValue: false,
31
+ }),
32
+ ignore_stories: pieces_framework_1.Property.Checkbox({
33
+ displayName: 'Ignore Stories',
34
+ description: 'Ignore stories when receiving messages',
35
+ required: false,
36
+ defaultValue: false,
37
+ }),
38
+ max_messages: pieces_framework_1.Property.Number({
39
+ displayName: 'Max Messages',
40
+ description: 'Maximum number of messages to receive (default: unlimited)',
41
+ required: false,
42
+ }),
43
+ send_read_receipts: pieces_framework_1.Property.Checkbox({
44
+ displayName: 'Send Read Receipts',
45
+ description: 'Automatically send read receipts when receiving messages',
46
+ required: false,
47
+ defaultValue: false,
48
+ }),
49
+ },
50
+ run(context) {
51
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
52
+ var _a;
53
+ const { baseUrl, useBasicAuth, basicAuthUsername, basicAuthPassword, mode = 'normal' } = context.auth.props;
54
+ const { number, timeout = 1, ignore_attachments = false, ignore_stories = false, max_messages, send_read_receipts = false } = context.propsValue;
55
+ const formattedNumber = (0, utils_1.formatPhoneNumber)(number);
56
+ // Build query parameters
57
+ const queryParams = new URLSearchParams();
58
+ queryParams.append('timeout', timeout.toString());
59
+ queryParams.append('ignore_attachments', ignore_attachments.toString());
60
+ queryParams.append('ignore_stories', ignore_stories.toString());
61
+ if (max_messages) {
62
+ queryParams.append('max_messages', max_messages.toString());
63
+ }
64
+ queryParams.append('send_read_receipts', send_read_receipts.toString());
65
+ const baseUrlClean = baseUrl.replace(/\/$/, '');
66
+ const httpUrl = `${baseUrlClean}/v1/receive/${encodeURIComponent(formattedNumber)}?${queryParams.toString()}`;
67
+ // Build headers
68
+ const headers = {};
69
+ // Add Basic Auth header if configured
70
+ if (useBasicAuth && basicAuthUsername && basicAuthPassword) {
71
+ const credentials = Buffer.from(`${basicAuthUsername}:${basicAuthPassword}`).toString('base64');
72
+ headers['Authorization'] = `Basic ${credentials}`;
73
+ }
74
+ // Use the configured mode to determine which method to use
75
+ let messages;
76
+ if (mode === 'json-rpc') {
77
+ // Use WebSocket for json-rpc mode
78
+ messages = yield (0, message_utils_1.tryWebSocketReceive)(httpUrl, headers, timeout, max_messages);
79
+ }
80
+ else {
81
+ // Use HTTP GET for normal/native mode
82
+ messages = yield (0, message_utils_1.tryHttpReceive)(httpUrl, headers);
83
+ }
84
+ // Process each message: try to resume approval flows if applicable
85
+ // Messages are still returned regardless of whether they triggered a resume
86
+ // Debug information is output via console.log (visible in Docker logs)
87
+ const apiUrl = ((_a = context.server) === null || _a === void 0 ? void 0 : _a.apiUrl) || '';
88
+ for (const message of messages) {
89
+ // This will output debug info via console.log
90
+ yield (0, message_utils_1.tryResumeApprovalFlow)(message, context.store, apiUrl);
91
+ }
92
+ // Return messages
93
+ return {
94
+ messages,
95
+ count: messages.length,
96
+ };
97
+ });
98
+ },
99
+ });
100
+ //# sourceMappingURL=receive-messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receive-messages.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/signal-cli-rest-api/src/lib/actions/receive-messages.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAsD;AACtD,2CAAoD;AACpD,2DAKiC;AAEpB,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,2BAAoB;IAC1B,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,QAAyB,CAAC;YAC9B,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;gBACzB,kCAAkC;gBAClC,QAAQ,GAAG,MAAM,IAAA,mCAAmB,EAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;YAC/E,CAAC;iBAAM,CAAC;gBACP,sCAAsC;gBACtC,QAAQ,GAAG,MAAM,IAAA,8BAAc,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACnD,CAAC;YAED,mEAAmE;YACnE,4EAA4E;YAC5E,uEAAuE;YACvE,MAAM,MAAM,GAAG,CAAA,MAAA,OAAO,CAAC,MAAM,0CAAE,MAAM,KAAI,EAAE,CAAC;YAE5C,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;gBAChC,8CAA8C;gBAC9C,MAAM,IAAA,qCAAqB,EAAC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YAC7D,CAAC;YAED,kBAAkB;YAClB,OAAO;gBACN,QAAQ;gBACR,KAAK,EAAE,QAAQ,CAAC,MAAM;aACtB,CAAC;QACH,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare const remoteDeleteMessage: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ useBasicAuth: import("@activepieces/pieces-framework").CheckboxProperty<false>;
4
+ basicAuthUsername: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
+ basicAuthPassword: import("@activepieces/pieces-framework").SecretTextProperty<false>;
6
+ defaultNumber: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
+ mode: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
8
+ }>, {
9
+ number: import("@activepieces/pieces-framework").ShortTextProperty<true>;
10
+ recipient: import("@activepieces/pieces-framework").ShortTextProperty<true>;
11
+ timestamp: import("@activepieces/pieces-framework").NumberProperty<true>;
12
+ }>;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.remoteDeleteMessage = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ const api_client_1 = require("../common/api-client");
8
+ const utils_1 = require("../common/utils");
9
+ exports.remoteDeleteMessage = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.signalCliRestApiAuth,
11
+ name: 'remoteDeleteMessage',
12
+ displayName: 'Remote Delete Message',
13
+ description: 'Delete a message remotely',
14
+ props: {
15
+ number: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Phone Number',
17
+ description: 'Registered phone number in international format',
18
+ required: true,
19
+ }),
20
+ recipient: pieces_framework_1.Property.ShortText({
21
+ displayName: 'Recipient',
22
+ description: 'Phone number or group ID of the recipient',
23
+ required: true,
24
+ }),
25
+ timestamp: pieces_framework_1.Property.Number({
26
+ displayName: 'Timestamp',
27
+ description: 'Timestamp of the message to delete',
28
+ required: true,
29
+ }),
30
+ },
31
+ run(context) {
32
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
33
+ const { number, recipient, timestamp } = context.propsValue;
34
+ // Auth props are passed directly to API client
35
+ const apiClient = new api_client_1.SignalCliApiClient(context.auth.props);
36
+ const formattedNumber = (0, utils_1.formatPhoneNumber)(number);
37
+ const requestBody = {
38
+ recipient,
39
+ timestamp,
40
+ };
41
+ const response = yield apiClient.delete(`/v1/remote-delete/${encodeURIComponent(formattedNumber)}`, requestBody);
42
+ return response;
43
+ });
44
+ },
45
+ });
46
+ //# sourceMappingURL=remote-delete-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-delete-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/signal-cli-rest-api/src/lib/actions/remote-delete-message.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAsD;AACtD,qDAA0D;AAC1D,2CAAoD;AAWvC,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,uBAAuB;IACpC,WAAW,EAAE,2BAA2B;IACxC,KAAK,EAAE;QACN,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,iDAAiD;YAC9D,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,2CAA2C;YACxD,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC1B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,oCAAoC;YACjD,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC5D,+CAA+C;YAE/C,MAAM,SAAS,GAAG,IAAI,+BAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC7D,MAAM,eAAe,GAAG,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC;YAElD,MAAM,WAAW,GAAwB;gBACxC,SAAS;gBACT,SAAS;aACT,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,MAAM,CACtC,qBAAqB,kBAAkB,CAAC,eAAe,CAAC,EAAE,EAC1D,WAAW,CACX,CAAC;YAEF,OAAO,QAAQ,CAAC;QACjB,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare const removeAdminsFromGroup: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ useBasicAuth: import("@activepieces/pieces-framework").CheckboxProperty<false>;
4
+ basicAuthUsername: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
+ basicAuthPassword: import("@activepieces/pieces-framework").SecretTextProperty<false>;
6
+ defaultNumber: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
+ mode: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
8
+ }>, {
9
+ number: import("@activepieces/pieces-framework").ShortTextProperty<true>;
10
+ groupid: import("@activepieces/pieces-framework").ShortTextProperty<true>;
11
+ admins: import("@activepieces/pieces-framework").ArrayProperty<true>;
12
+ }>;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeAdminsFromGroup = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ const api_client_1 = require("../common/api-client");
8
+ const utils_1 = require("../common/utils");
9
+ exports.removeAdminsFromGroup = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.signalCliRestApiAuth,
11
+ name: 'removeAdminsFromGroup',
12
+ displayName: 'Remove Admins from Group',
13
+ description: 'Remove one or more admins from a Signal group',
14
+ props: {
15
+ number: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Phone Number',
17
+ description: 'Registered phone number in international format',
18
+ required: true,
19
+ }),
20
+ groupid: pieces_framework_1.Property.ShortText({
21
+ displayName: 'Group ID',
22
+ description: 'Group ID (base64 encoded)',
23
+ required: true,
24
+ }),
25
+ admins: pieces_framework_1.Property.Array({
26
+ displayName: 'Admins',
27
+ description: 'Array of phone numbers to remove as admins',
28
+ required: true,
29
+ }),
30
+ },
31
+ run(context) {
32
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
33
+ const { number, groupid, admins } = context.propsValue;
34
+ // Auth props are passed directly to API client
35
+ const apiClient = new api_client_1.SignalCliApiClient(context.auth.props);
36
+ const formattedNumber = (0, utils_1.formatPhoneNumber)(number);
37
+ const requestBody = {
38
+ admins: admins,
39
+ };
40
+ yield apiClient.delete(`/v1/groups/${encodeURIComponent(formattedNumber)}/${encodeURIComponent(groupid)}/admins`, requestBody);
41
+ return { success: true };
42
+ });
43
+ },
44
+ });
45
+ //# sourceMappingURL=remove-admins-from-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-admins-from-group.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/signal-cli-rest-api/src/lib/actions/remove-admins-from-group.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAsD;AACtD,qDAA0D;AAC1D,2CAAoD;AAMvC,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IACjD,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,0BAA0B;IACvC,WAAW,EAAE,+CAA+C;IAC5D,KAAK,EAAE;QACN,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,iDAAiD;YAC9D,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACtB,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,4CAA4C;YACzD,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACvD,+CAA+C;YAE/C,MAAM,SAAS,GAAG,IAAI,+BAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC7D,MAAM,eAAe,GAAG,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC;YAElD,MAAM,WAAW,GAA6B;gBAC7C,MAAM,EAAE,MAAkB;aAC1B,CAAC;YAEF,MAAM,SAAS,CAAC,MAAM,CACrB,cAAc,kBAAkB,CAAC,eAAe,CAAC,IAAI,kBAAkB,CAAC,OAAO,CAAC,SAAS,EACzF,WAAW,CACX,CAAC;YAEF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC1B,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare const removeDevice: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ useBasicAuth: import("@activepieces/pieces-framework").CheckboxProperty<false>;
4
+ basicAuthUsername: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
+ basicAuthPassword: import("@activepieces/pieces-framework").SecretTextProperty<false>;
6
+ defaultNumber: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
+ mode: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
8
+ }>, {
9
+ number: import("@activepieces/pieces-framework").ShortTextProperty<true>;
10
+ deviceId: import("@activepieces/pieces-framework").NumberProperty<true>;
11
+ }>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeDevice = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ const api_client_1 = require("../common/api-client");
8
+ const utils_1 = require("../common/utils");
9
+ exports.removeDevice = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.signalCliRestApiAuth,
11
+ name: 'removeDevice',
12
+ displayName: 'Remove Device',
13
+ description: 'Remove a linked device from the primary account',
14
+ props: {
15
+ number: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Phone Number',
17
+ description: 'Registered phone number in international format',
18
+ required: true,
19
+ }),
20
+ deviceId: pieces_framework_1.Property.Number({
21
+ displayName: 'Device ID',
22
+ description: 'Device ID from listDevices',
23
+ required: true,
24
+ }),
25
+ },
26
+ run(context) {
27
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
28
+ const { number, deviceId } = context.propsValue;
29
+ // Auth props are passed directly to API client
30
+ const apiClient = new api_client_1.SignalCliApiClient(context.auth.props);
31
+ const formattedNumber = (0, utils_1.formatPhoneNumber)(number);
32
+ yield apiClient.delete(`/v1/devices/${encodeURIComponent(formattedNumber)}/${deviceId}`);
33
+ return { success: true };
34
+ });
35
+ },
36
+ });
37
+ //# sourceMappingURL=remove-device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-device.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/signal-cli-rest-api/src/lib/actions/remove-device.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAsD;AACtD,qDAA0D;AAC1D,2CAAoD;AAEvC,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,iDAAiD;IAC9D,KAAK,EAAE;QACN,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,iDAAiD;YAC9D,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACzB,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAChD,+CAA+C;YAE/C,MAAM,SAAS,GAAG,IAAI,+BAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC7D,MAAM,eAAe,GAAG,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC;YAElD,MAAM,SAAS,CAAC,MAAM,CACrB,eAAe,kBAAkB,CAAC,eAAe,CAAC,IAAI,QAAQ,EAAE,CAChE,CAAC;YAEF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC1B,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare const removeMembersFromGroup: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ useBasicAuth: import("@activepieces/pieces-framework").CheckboxProperty<false>;
4
+ basicAuthUsername: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
+ basicAuthPassword: import("@activepieces/pieces-framework").SecretTextProperty<false>;
6
+ defaultNumber: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
+ mode: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
8
+ }>, {
9
+ number: import("@activepieces/pieces-framework").ShortTextProperty<true>;
10
+ groupid: import("@activepieces/pieces-framework").ShortTextProperty<true>;
11
+ members: import("@activepieces/pieces-framework").ArrayProperty<true>;
12
+ }>;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeMembersFromGroup = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ const api_client_1 = require("../common/api-client");
8
+ const utils_1 = require("../common/utils");
9
+ exports.removeMembersFromGroup = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.signalCliRestApiAuth,
11
+ name: 'removeMembersFromGroup',
12
+ displayName: 'Remove Members from Group',
13
+ description: 'Remove one or more members from a Signal group',
14
+ props: {
15
+ number: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Phone Number',
17
+ description: 'Registered phone number in international format',
18
+ required: true,
19
+ }),
20
+ groupid: pieces_framework_1.Property.ShortText({
21
+ displayName: 'Group ID',
22
+ description: 'Group ID (base64 encoded)',
23
+ required: true,
24
+ }),
25
+ members: pieces_framework_1.Property.Array({
26
+ displayName: 'Members',
27
+ description: 'Array of phone numbers to remove',
28
+ required: true,
29
+ }),
30
+ },
31
+ run(context) {
32
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
33
+ const { number, groupid, members } = context.propsValue;
34
+ // Auth props are passed directly to API client
35
+ const apiClient = new api_client_1.SignalCliApiClient(context.auth.props);
36
+ const formattedNumber = (0, utils_1.formatPhoneNumber)(number);
37
+ const requestBody = {
38
+ members: members,
39
+ };
40
+ yield apiClient.delete(`/v1/groups/${encodeURIComponent(formattedNumber)}/${encodeURIComponent(groupid)}/members`, requestBody);
41
+ return { success: true };
42
+ });
43
+ },
44
+ });
45
+ //# sourceMappingURL=remove-members-from-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-members-from-group.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/signal-cli-rest-api/src/lib/actions/remove-members-from-group.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAsD;AACtD,qDAA0D;AAC1D,2CAAoD;AAMvC,QAAA,sBAAsB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,2BAA2B;IACxC,WAAW,EAAE,gDAAgD;IAC7D,KAAK,EAAE;QACN,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,iDAAiD;YAC9D,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACvB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACxD,+CAA+C;YAE/C,MAAM,SAAS,GAAG,IAAI,+BAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC7D,MAAM,eAAe,GAAG,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC;YAElD,MAAM,WAAW,GAA8B;gBAC9C,OAAO,EAAE,OAAmB;aAC5B,CAAC;YAEF,MAAM,SAAS,CAAC,MAAM,CACrB,cAAc,kBAAkB,CAAC,eAAe,CAAC,IAAI,kBAAkB,CAAC,OAAO,CAAC,UAAU,EAC1F,WAAW,CACX,CAAC;YAEF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC1B,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ export declare const removeReaction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ useBasicAuth: import("@activepieces/pieces-framework").CheckboxProperty<false>;
4
+ basicAuthUsername: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
+ basicAuthPassword: import("@activepieces/pieces-framework").SecretTextProperty<false>;
6
+ defaultNumber: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
+ mode: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
8
+ }>, {
9
+ number: import("@activepieces/pieces-framework").ShortTextProperty<true>;
10
+ recipient: import("@activepieces/pieces-framework").ShortTextProperty<true>;
11
+ target_author: import("@activepieces/pieces-framework").ShortTextProperty<true>;
12
+ timestamp: import("@activepieces/pieces-framework").NumberProperty<true>;
13
+ }>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeReaction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ const api_client_1 = require("../common/api-client");
8
+ const utils_1 = require("../common/utils");
9
+ exports.removeReaction = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.signalCliRestApiAuth,
11
+ name: 'removeReaction',
12
+ displayName: 'Remove Reaction',
13
+ description: 'Remove a reaction from a message',
14
+ props: {
15
+ number: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Phone Number',
17
+ description: 'Registered phone number in international format',
18
+ required: true,
19
+ }),
20
+ recipient: pieces_framework_1.Property.ShortText({
21
+ displayName: 'Recipient',
22
+ description: 'Phone number or group ID of the recipient',
23
+ required: true,
24
+ }),
25
+ target_author: pieces_framework_1.Property.ShortText({
26
+ displayName: 'Target Author',
27
+ description: 'Phone number of the message author',
28
+ required: true,
29
+ }),
30
+ timestamp: pieces_framework_1.Property.Number({
31
+ displayName: 'Timestamp',
32
+ description: 'Timestamp of the message',
33
+ required: true,
34
+ }),
35
+ },
36
+ run(context) {
37
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
38
+ const { number, recipient, target_author, timestamp } = context.propsValue;
39
+ // Auth props are passed directly to API client
40
+ const apiClient = new api_client_1.SignalCliApiClient(context.auth.props);
41
+ const formattedNumber = (0, utils_1.formatPhoneNumber)(number);
42
+ const requestBody = {
43
+ recipient,
44
+ target_author,
45
+ timestamp,
46
+ };
47
+ yield apiClient.delete(`/v1/reactions/${encodeURIComponent(formattedNumber)}`, requestBody);
48
+ return { success: true };
49
+ });
50
+ },
51
+ });
52
+ //# sourceMappingURL=remove-reaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-reaction.js","sourceRoot":"","sources":["../../../../../../../../packages/pie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kB,CAAC,eAAe,CAAC,EAAE,EACtD,WAAW,CACX,CAAC;YAEF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC1B,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ export declare const requestApprovalMessage: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ useBasicAuth: import("@activepieces/pieces-framework").CheckboxProperty<false>;
4
+ basicAuthUsername: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
+ basicAuthPassword: import("@activepieces/pieces-framework").SecretTextProperty<false>;
6
+ defaultNumber: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
+ mode: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
8
+ }>, {
9
+ number: import("@activepieces/pieces-framework").ShortTextProperty<false>;
10
+ recipients: import("@activepieces/pieces-framework").ArrayProperty<true>;
11
+ message: import("@activepieces/pieces-framework").LongTextProperty<true>;
12
+ approve_emoji: import("@activepieces/pieces-framework").ShortTextProperty<false>;
13
+ disapprove_emoji: import("@activepieces/pieces-framework").ShortTextProperty<false>;
14
+ timeout_seconds: import("@activepieces/pieces-framework").NumberProperty<false>;
15
+ }>;
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requestApprovalMessage = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ const api_client_1 = require("../common/api-client");
8
+ const utils_1 = require("../common/utils");
9
+ const shared_1 = require("@activepieces/shared");
10
+ const shared_2 = require("@activepieces/shared");
11
+ exports.requestApprovalMessage = (0, pieces_framework_1.createAction)({
12
+ auth: auth_1.signalCliRestApiAuth,
13
+ name: 'request_approval_message',
14
+ displayName: 'Request Approval (Signal)',
15
+ description: 'Send an approval message via Signal and wait for a reaction response. This action sends a message and pauses the flow until the recipient reacts with an approve or disapprove emoji.',
16
+ props: {
17
+ number: pieces_framework_1.Property.ShortText({
18
+ displayName: 'Phone Number',
19
+ description: 'Registered phone number in international format (e.g., +43123456789). If not provided, uses the default number from the connection.',
20
+ required: false,
21
+ }),
22
+ recipients: utils_1.commonProps.recipients,
23
+ message: utils_1.commonProps.message,
24
+ approve_emoji: pieces_framework_1.Property.ShortText({
25
+ displayName: 'Approve Emoji',
26
+ description: 'Emoji for approval (e.g., 👍)',
27
+ required: false,
28
+ defaultValue: '👍',
29
+ }),
30
+ disapprove_emoji: pieces_framework_1.Property.ShortText({
31
+ displayName: 'Disapprove Emoji',
32
+ description: 'Emoji for disapproval (e.g., 👎)',
33
+ required: false,
34
+ defaultValue: '👎',
35
+ }),
36
+ timeout_seconds: pieces_framework_1.Property.Number({
37
+ displayName: 'Timeout (seconds)',
38
+ description: 'Timeout in seconds after which the approval expires (default: 86400 = 24 hours)',
39
+ required: false,
40
+ defaultValue: 86400,
41
+ }),
42
+ },
43
+ run(context) {
44
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
45
+ if (context.executionType === shared_1.ExecutionType.BEGIN) {
46
+ const { number, recipients, message, approve_emoji = '👍', disapprove_emoji = '👎', timeout_seconds = 86400 } = context.propsValue;
47
+ (0, shared_2.assertNotNullOrUndefined)(message, 'message');
48
+ (0, shared_2.assertNotNullOrUndefined)(recipients, 'recipients');
49
+ const apiClient = new api_client_1.SignalCliApiClient(context.auth.props);
50
+ // Use number from props or fallback to default from connection
51
+ const phoneNumber = number || context.auth.props.defaultNumber;
52
+ if (!phoneNumber) {
53
+ throw new Error('Phone number is required. Please provide it in the action or set a default in the connection settings.');
54
+ }
55
+ const formattedNumber = (0, utils_1.formatPhoneNumber)(phoneNumber);
56
+ // Generate resume URL to extract requestId
57
+ const resumeUrl = context.generateResumeUrl({
58
+ queryParams: { action: 'approve' },
59
+ });
60
+ // Extract requestId from URL: /v1/flow-runs/{flowRunId}/requests/{requestId}
61
+ const urlMatch = resumeUrl.match(/\/flow-runs\/[^/]+\/requests\/([^/?]+)/);
62
+ if (!urlMatch || !urlMatch[1]) {
63
+ throw new Error('Failed to extract requestId from resume URL');
64
+ }
65
+ const requestId = urlMatch[1];
66
+ // Prepare request body - send message exactly as user entered it
67
+ const requestBody = {
68
+ number: formattedNumber,
69
+ recipients: recipients,
70
+ message: message || '',
71
+ };
72
+ // Send the message
73
+ const response = yield apiClient.post('/v2/send', requestBody);
74
+ // Extract messageTimestamp from response
75
+ // Signal API returns timestamp in milliseconds as a string, convert to seconds (Unix timestamp)
76
+ const timestampMs = typeof response.timestamp === 'string'
77
+ ? parseInt(response.timestamp, 10)
78
+ : Math.floor(response.timestamp);
79
+ const messageTimestamp = Math.floor(timestampMs / 1000); // Convert milliseconds to seconds
80
+ // targetAuthor is the phone number of the sender
81
+ const targetAuthor = formattedNumber;
82
+ const createdAt = Math.floor(Date.now() / 1000); // Unix timestamp in seconds
83
+ // Create store key
84
+ const storeKey = `approval:${messageTimestamp}:${targetAuthor}`;
85
+ // DEBUG: Log storing approval mapping
86
+ console.log('[RequestApprovalMessage] DEBUG - Storing approval mapping:', {
87
+ storeKey,
88
+ timestampMs,
89
+ messageTimestamp,
90
+ targetAuthor,
91
+ formattedNumber,
92
+ flowRunId: context.run.id,
93
+ requestId,
94
+ responseTimestamp: response.timestamp,
95
+ responseTimestampType: typeof response.timestamp
96
+ });
97
+ // Create mapping value
98
+ const mapping = {
99
+ flowRunId: context.run.id,
100
+ requestId: requestId,
101
+ approveEmoji: approve_emoji,
102
+ disapproveEmoji: disapprove_emoji,
103
+ targetAuthor: targetAuthor,
104
+ messageTimestamp: messageTimestamp,
105
+ timeoutSeconds: timeout_seconds,
106
+ createdAt: createdAt,
107
+ };
108
+ // DEBUG: Log full mapping
109
+ console.log('[RequestApprovalMessage] DEBUG - Full mapping object:', mapping);
110
+ // Save mapping in Store (PROJECT-scoped)
111
+ yield context.store.put(storeKey, mapping, pieces_framework_1.StoreScope.PROJECT);
112
+ // DEBUG: Verify it was stored
113
+ const verifyMapping = yield context.store.get(storeKey, pieces_framework_1.StoreScope.PROJECT);
114
+ console.log('[RequestApprovalMessage] DEBUG - Verified stored mapping:', verifyMapping);
115
+ // Add key to approval keys list
116
+ const keysListKey = 'approval:keys';
117
+ const existingKeys = (yield context.store.get(keysListKey, pieces_framework_1.StoreScope.PROJECT)) || [];
118
+ if (!existingKeys.includes(storeKey)) {
119
+ existingKeys.push(storeKey);
120
+ yield context.store.put(keysListKey, existingKeys, pieces_framework_1.StoreScope.PROJECT);
121
+ }
122
+ // Also save mapping from flowRunId to storeKey for easy lookup in RESUME phase
123
+ const flowRunMappingKey = `approval:flowRun:${context.run.id}`;
124
+ yield context.store.put(flowRunMappingKey, storeKey, pieces_framework_1.StoreScope.PROJECT);
125
+ const output = {
126
+ messageTimestamp,
127
+ targetAuthor,
128
+ flowRunId: context.run.id,
129
+ requestId,
130
+ debug: {
131
+ timestampMs,
132
+ messageTimestamp,
133
+ storeKey,
134
+ formattedNumber,
135
+ responseTimestamp: response.timestamp,
136
+ responseTimestampType: typeof response.timestamp,
137
+ approveEmoji: approve_emoji,
138
+ disapproveEmoji: disapprove_emoji,
139
+ timeoutSeconds: timeout_seconds,
140
+ createdAt,
141
+ mapping: mapping,
142
+ verifiedMapping: verifyMapping,
143
+ },
144
+ };
145
+ // Pause the flow and wait for approval
146
+ context.run.pause({
147
+ pauseMetadata: {
148
+ type: shared_1.PauseType.WEBHOOK,
149
+ response: {},
150
+ },
151
+ });
152
+ return output;
153
+ }
154
+ else {
155
+ // RESUME-Phase: Flow was resumed by Resume-Action
156
+ const action = context.resumePayload.queryParams['action'];
157
+ const approved = action === 'approve';
158
+ // Find the storeKey for this flowRunId
159
+ const flowRunMappingKey = `approval:flowRun:${context.run.id}`;
160
+ const storeKey = yield context.store.get(flowRunMappingKey, pieces_framework_1.StoreScope.PROJECT);
161
+ if (storeKey) {
162
+ // Delete mapping from Store
163
+ yield context.store.delete(storeKey, pieces_framework_1.StoreScope.PROJECT);
164
+ // Delete flowRunId mapping
165
+ yield context.store.delete(flowRunMappingKey, pieces_framework_1.StoreScope.PROJECT);
166
+ // Remove key from approval keys list
167
+ const keysListKey = 'approval:keys';
168
+ const existingKeys = (yield context.store.get(keysListKey, pieces_framework_1.StoreScope.PROJECT)) || [];
169
+ const updatedKeys = existingKeys.filter(key => key !== storeKey);
170
+ yield context.store.put(keysListKey, updatedKeys, pieces_framework_1.StoreScope.PROJECT);
171
+ }
172
+ return {
173
+ approved,
174
+ debug: {
175
+ action,
176
+ storeKey: storeKey || null,
177
+ flowRunId: context.run.id,
178
+ },
179
+ };
180
+ }
181
+ });
182
+ },
183
+ });
184
+ //# sourceMappingURL=request-approval-message.js.map