@bubblelab/bubble-core 0.1.159 → 0.1.161

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 (171) hide show
  1. package/dist/bubble-bundle.d.ts +187 -165
  2. package/dist/bubble-factory.d.ts.map +1 -1
  3. package/dist/bubble-factory.js +4 -0
  4. package/dist/bubble-factory.js.map +1 -1
  5. package/dist/bubble-flow/bubble-flow-class.js.map +1 -1
  6. package/dist/bubbles/service-bubble/agi-inc.d.ts +60 -60
  7. package/dist/bubbles/service-bubble/ai-agent.d.ts +8 -8
  8. package/dist/bubbles/service-bubble/airtable.d.ts +50 -50
  9. package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.d.ts +2 -2
  10. package/dist/bubbles/service-bubble/apify/actors/instagram-hashtag-scraper.d.ts +4 -4
  11. package/dist/bubbles/service-bubble/apify/actors/instagram-scraper.d.ts +12 -12
  12. package/dist/bubbles/service-bubble/apify/actors/linkedin-jobs-scraper.d.ts +2 -2
  13. package/dist/bubbles/service-bubble/apify/actors/linkedin-posts-search.d.ts +8 -8
  14. package/dist/bubbles/service-bubble/apify/actors/linkedin-profile-detail.d.ts +52 -52
  15. package/dist/bubbles/service-bubble/apify/actors/linkedin-profile-posts.d.ts +18 -18
  16. package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.d.ts +10 -10
  17. package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.d.ts +27 -27
  18. package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.d.ts +8 -8
  19. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.d.ts +131 -131
  20. package/dist/bubbles/service-bubble/apify/apify.d.ts +12 -12
  21. package/dist/bubbles/service-bubble/ashby/ashby.d.ts +62 -62
  22. package/dist/bubbles/service-bubble/ashby/ashby.schema.d.ts +84 -84
  23. package/dist/bubbles/service-bubble/browserbase/browserbase.d.ts +28 -28
  24. package/dist/bubbles/service-bubble/browserbase/browserbase.d.ts.map +1 -1
  25. package/dist/bubbles/service-bubble/browserbase/browserbase.js +2 -4
  26. package/dist/bubbles/service-bubble/browserbase/browserbase.js.map +1 -1
  27. package/dist/bubbles/service-bubble/browserbase/browserbase.schema.d.ts +30 -30
  28. package/dist/bubbles/service-bubble/confluence/confluence.d.ts +24 -24
  29. package/dist/bubbles/service-bubble/confluence/confluence.d.ts.map +1 -1
  30. package/dist/bubbles/service-bubble/confluence/confluence.js +2 -3
  31. package/dist/bubbles/service-bubble/confluence/confluence.js.map +1 -1
  32. package/dist/bubbles/service-bubble/confluence/confluence.schema.d.ts +24 -24
  33. package/dist/bubbles/service-bubble/crustdata/crustdata.d.ts +126 -126
  34. package/dist/bubbles/service-bubble/crustdata/crustdata.schema.d.ts +158 -158
  35. package/dist/bubbles/service-bubble/eleven-labs.d.ts +28 -28
  36. package/dist/bubbles/service-bubble/firecrawl.d.ts +628 -628
  37. package/dist/bubbles/service-bubble/followupboss.d.ts +140 -140
  38. package/dist/bubbles/service-bubble/fullenrich/fullenrich.d.ts +68 -68
  39. package/dist/bubbles/service-bubble/fullenrich/fullenrich.schema.d.ts +108 -108
  40. package/dist/bubbles/service-bubble/github.d.ts +76 -76
  41. package/dist/bubbles/service-bubble/gmail.d.ts +80 -80
  42. package/dist/bubbles/service-bubble/google-calendar.d.ts +138 -138
  43. package/dist/bubbles/service-bubble/google-drive.d.ts +60 -60
  44. package/dist/bubbles/service-bubble/google-sheets/google-sheets.d.ts +44 -44
  45. package/dist/bubbles/service-bubble/google-sheets/google-sheets.schema.d.ts +48 -48
  46. package/dist/bubbles/service-bubble/hello-world.d.ts +8 -8
  47. package/dist/bubbles/service-bubble/http.d.ts +16 -16
  48. package/dist/bubbles/service-bubble/insforge-db.d.ts +8 -8
  49. package/dist/bubbles/service-bubble/jira/jira.d.ts +86 -86
  50. package/dist/bubbles/service-bubble/jira/jira.d.ts.map +1 -1
  51. package/dist/bubbles/service-bubble/jira/jira.js +2 -4
  52. package/dist/bubbles/service-bubble/jira/jira.js.map +1 -1
  53. package/dist/bubbles/service-bubble/jira/jira.schema.d.ts +94 -94
  54. package/dist/bubbles/service-bubble/notion/notion.d.ts +522 -522
  55. package/dist/bubbles/service-bubble/notion/property-schemas.d.ts +8 -8
  56. package/dist/bubbles/service-bubble/postgresql.d.ts +8 -8
  57. package/dist/bubbles/service-bubble/posthog/posthog.d.ts +20 -20
  58. package/dist/bubbles/service-bubble/posthog/posthog.schema.d.ts +24 -24
  59. package/dist/bubbles/service-bubble/resend.d.ts +28 -28
  60. package/dist/bubbles/service-bubble/sendsafely/index.d.ts +4 -0
  61. package/dist/bubbles/service-bubble/sendsafely/index.d.ts.map +1 -0
  62. package/dist/bubbles/service-bubble/sendsafely/index.js +4 -0
  63. package/dist/bubbles/service-bubble/sendsafely/index.js.map +1 -0
  64. package/dist/bubbles/service-bubble/sendsafely/sendsafely.d.ts +247 -0
  65. package/dist/bubbles/service-bubble/sendsafely/sendsafely.d.ts.map +1 -0
  66. package/dist/bubbles/service-bubble/sendsafely/sendsafely.js +212 -0
  67. package/dist/bubbles/service-bubble/sendsafely/sendsafely.js.map +1 -0
  68. package/dist/bubbles/service-bubble/sendsafely/sendsafely.schema.d.ts +270 -0
  69. package/dist/bubbles/service-bubble/sendsafely/sendsafely.schema.d.ts.map +1 -0
  70. package/dist/bubbles/service-bubble/sendsafely/sendsafely.schema.js +144 -0
  71. package/dist/bubbles/service-bubble/sendsafely/sendsafely.schema.js.map +1 -0
  72. package/dist/bubbles/service-bubble/sendsafely/sendsafely.utils.d.ts +80 -0
  73. package/dist/bubbles/service-bubble/sendsafely/sendsafely.utils.d.ts.map +1 -0
  74. package/dist/bubbles/service-bubble/sendsafely/sendsafely.utils.js +168 -0
  75. package/dist/bubbles/service-bubble/sendsafely/sendsafely.utils.js.map +1 -0
  76. package/dist/bubbles/service-bubble/slack/slack.d.ts +252 -252
  77. package/dist/bubbles/service-bubble/storage.d.ts +20 -20
  78. package/dist/bubbles/service-bubble/stripe/stripe.d.ts +125 -125
  79. package/dist/bubbles/service-bubble/stripe/stripe.schema.d.ts +143 -143
  80. package/dist/bubbles/service-bubble/telegram.d.ts +1537 -1537
  81. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.d.ts +13 -13
  82. package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.schema.d.ts +13 -13
  83. package/dist/bubbles/tool-bubble/browser-tools/_shared/schema.d.ts +2 -2
  84. package/dist/bubbles/tool-bubble/browser-tools/linkedin-accept-invitations/schema.d.ts +2 -2
  85. package/dist/bubbles/tool-bubble/browser-tools/linkedin-accept-invitations/tool.d.ts +2 -2
  86. package/dist/bubbles/tool-bubble/browser-tools/linkedin-connection/schema.d.ts +2 -2
  87. package/dist/bubbles/tool-bubble/browser-tools/linkedin-connection/tool.d.ts +2 -2
  88. package/dist/bubbles/tool-bubble/browser-tools/linkedin-received-invitations/schema.d.ts +2 -2
  89. package/dist/bubbles/tool-bubble/browser-tools/linkedin-received-invitations/tool.d.ts +2 -2
  90. package/dist/bubbles/tool-bubble/browser-tools/linkedin-sent-invitations/schema.d.ts +2 -2
  91. package/dist/bubbles/tool-bubble/browser-tools/linkedin-sent-invitations/tool.d.ts +2 -2
  92. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +16 -16
  93. package/dist/bubbles/tool-bubble/chart-js-tool.d.ts +26 -26
  94. package/dist/bubbles/tool-bubble/code-edit-tool.d.ts +8 -8
  95. package/dist/bubbles/tool-bubble/company-enrichment-tool.d.ts +22 -22
  96. package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts +4 -4
  97. package/dist/bubbles/tool-bubble/get-trigger-detail-tool.d.ts +4 -4
  98. package/dist/bubbles/tool-bubble/google-maps-tool.d.ts +4 -4
  99. package/dist/bubbles/tool-bubble/instagram-tool.d.ts +14 -14
  100. package/dist/bubbles/tool-bubble/linkedin-tool.d.ts +186 -186
  101. package/dist/bubbles/tool-bubble/list-airtable-bases-tool.d.ts +4 -4
  102. package/dist/bubbles/tool-bubble/list-airtable-tables-tool.d.ts +4 -4
  103. package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts +4 -4
  104. package/dist/bubbles/tool-bubble/list-capabilities-tool.d.ts +4 -4
  105. package/dist/bubbles/tool-bubble/people-search-tool.d.ts +14 -14
  106. package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +28 -28
  107. package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +8 -8
  108. package/dist/bubbles/tool-bubble/sql-query-tool.d.ts +4 -4
  109. package/dist/bubbles/tool-bubble/tiktok-tool.d.ts +28 -28
  110. package/dist/bubbles/tool-bubble/tool-template.d.ts +4 -4
  111. package/dist/bubbles/tool-bubble/twitter-tool.d.ts +54 -54
  112. package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts +22 -22
  113. package/dist/bubbles/tool-bubble/web-extract-tool.d.ts +8 -8
  114. package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +8 -8
  115. package/dist/bubbles/tool-bubble/web-search-tool.d.ts +8 -8
  116. package/dist/bubbles/tool-bubble/yc-scraper-tool.d.ts +22 -22
  117. package/dist/bubbles/tool-bubble/youtube-tool.d.ts +18 -18
  118. package/dist/bubbles/workflow-bubble/database-analyzer.workflow.d.ts +4 -4
  119. package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts +28 -28
  120. package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts +8 -8
  121. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +72 -72
  122. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +32 -32
  123. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +34 -34
  124. package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +90 -90
  125. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts +8 -8
  126. package/dist/bubbles.json +316 -2
  127. package/dist/index.d.ts +1 -0
  128. package/dist/index.d.ts.map +1 -1
  129. package/dist/index.js +1 -0
  130. package/dist/index.js.map +1 -1
  131. package/package.json +3 -2
  132. package/dist/bubble-trigger/index.d.ts +0 -2
  133. package/dist/bubble-trigger/index.d.ts.map +0 -1
  134. package/dist/bubble-trigger/index.js +0 -2
  135. package/dist/bubble-trigger/index.js.map +0 -1
  136. package/dist/bubble-trigger/types.d.ts +0 -87
  137. package/dist/bubble-trigger/types.d.ts.map +0 -1
  138. package/dist/bubble-trigger/types.js +0 -14
  139. package/dist/bubble-trigger/types.js.map +0 -1
  140. package/dist/bubbles/service-bubble/google-sheets.d.ts +0 -1811
  141. package/dist/bubbles/service-bubble/google-sheets.d.ts.map +0 -1
  142. package/dist/bubbles/service-bubble/google-sheets.js +0 -904
  143. package/dist/bubbles/service-bubble/google-sheets.js.map +0 -1
  144. package/dist/bubbles/service-bubble/slack.d.ts +0 -5869
  145. package/dist/bubbles/service-bubble/slack.d.ts.map +0 -1
  146. package/dist/bubbles/service-bubble/slack.js +0 -1536
  147. package/dist/bubbles/service-bubble/slack.js.map +0 -1
  148. package/dist/bubbles/tool-bubble/linkedin-connection-tool/index.d.ts +0 -3
  149. package/dist/bubbles/tool-bubble/linkedin-connection-tool/index.d.ts.map +0 -1
  150. package/dist/bubbles/tool-bubble/linkedin-connection-tool/index.js +0 -3
  151. package/dist/bubbles/tool-bubble/linkedin-connection-tool/index.js.map +0 -1
  152. package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.d.ts +0 -160
  153. package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.d.ts.map +0 -1
  154. package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.js +0 -706
  155. package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.js.map +0 -1
  156. package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.schema.d.ts +0 -93
  157. package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.schema.d.ts.map +0 -1
  158. package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.schema.js +0 -50
  159. package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.schema.js.map +0 -1
  160. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts +0 -114
  161. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts.map +0 -1
  162. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js +0 -777
  163. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js.map +0 -1
  164. package/dist/types/ai-models.d.ts +0 -4
  165. package/dist/types/ai-models.d.ts.map +0 -1
  166. package/dist/types/ai-models.js +0 -16
  167. package/dist/types/ai-models.js.map +0 -1
  168. package/dist/utils/param-helper.d.ts +0 -2
  169. package/dist/utils/param-helper.d.ts.map +0 -1
  170. package/dist/utils/param-helper.js +0 -5
  171. package/dist/utils/param-helper.js.map +0 -1
@@ -0,0 +1,270 @@
1
+ import { z } from 'zod';
2
+ import { CredentialType } from '@bubblelab/shared-schemas';
3
+ export declare const SendSafelyPackageInfoSchema: z.ZodObject<{
4
+ packageId: z.ZodString;
5
+ packageCode: z.ZodOptional<z.ZodString>;
6
+ serverSecret: z.ZodOptional<z.ZodString>;
7
+ recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
8
+ recipientId: z.ZodString;
9
+ email: z.ZodString;
10
+ }, "strip", z.ZodTypeAny, {
11
+ email: string;
12
+ recipientId: string;
13
+ }, {
14
+ email: string;
15
+ recipientId: string;
16
+ }>, "many">>;
17
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
18
+ fileId: z.ZodString;
19
+ fileName: z.ZodString;
20
+ fileSize: z.ZodOptional<z.ZodNumber>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ fileName: string;
23
+ fileId: string;
24
+ fileSize?: number | undefined;
25
+ }, {
26
+ fileName: string;
27
+ fileId: string;
28
+ fileSize?: number | undefined;
29
+ }>, "many">>;
30
+ state: z.ZodOptional<z.ZodString>;
31
+ life: z.ZodOptional<z.ZodNumber>;
32
+ secureLink: z.ZodOptional<z.ZodString>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ packageId: string;
35
+ files?: {
36
+ fileName: string;
37
+ fileId: string;
38
+ fileSize?: number | undefined;
39
+ }[] | undefined;
40
+ state?: string | undefined;
41
+ packageCode?: string | undefined;
42
+ serverSecret?: string | undefined;
43
+ recipients?: {
44
+ email: string;
45
+ recipientId: string;
46
+ }[] | undefined;
47
+ life?: number | undefined;
48
+ secureLink?: string | undefined;
49
+ }, {
50
+ packageId: string;
51
+ files?: {
52
+ fileName: string;
53
+ fileId: string;
54
+ fileSize?: number | undefined;
55
+ }[] | undefined;
56
+ state?: string | undefined;
57
+ packageCode?: string | undefined;
58
+ serverSecret?: string | undefined;
59
+ recipients?: {
60
+ email: string;
61
+ recipientId: string;
62
+ }[] | undefined;
63
+ life?: number | undefined;
64
+ secureLink?: string | undefined;
65
+ }>;
66
+ export declare const SendSafelyParamsSchema: z.ZodDiscriminatedUnion<"operation", [z.ZodObject<{
67
+ operation: z.ZodLiteral<"send_file">;
68
+ recipientEmail: z.ZodString;
69
+ fileName: z.ZodString;
70
+ fileData: z.ZodString;
71
+ message: z.ZodOptional<z.ZodString>;
72
+ lifeDays: z.ZodOptional<z.ZodNumber>;
73
+ credentials: z.ZodOptional<z.ZodRecord<z.ZodNativeEnum<typeof CredentialType>, z.ZodString>>;
74
+ }, "strip", z.ZodTypeAny, {
75
+ operation: "send_file";
76
+ fileName: string;
77
+ recipientEmail: string;
78
+ fileData: string;
79
+ message?: string | undefined;
80
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
81
+ lifeDays?: number | undefined;
82
+ }, {
83
+ operation: "send_file";
84
+ fileName: string;
85
+ recipientEmail: string;
86
+ fileData: string;
87
+ message?: string | undefined;
88
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
89
+ lifeDays?: number | undefined;
90
+ }>, z.ZodObject<{
91
+ operation: z.ZodLiteral<"send_message">;
92
+ recipientEmail: z.ZodString;
93
+ message: z.ZodString;
94
+ lifeDays: z.ZodOptional<z.ZodNumber>;
95
+ credentials: z.ZodOptional<z.ZodRecord<z.ZodNativeEnum<typeof CredentialType>, z.ZodString>>;
96
+ }, "strip", z.ZodTypeAny, {
97
+ message: string;
98
+ operation: "send_message";
99
+ recipientEmail: string;
100
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
101
+ lifeDays?: number | undefined;
102
+ }, {
103
+ message: string;
104
+ operation: "send_message";
105
+ recipientEmail: string;
106
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
107
+ lifeDays?: number | undefined;
108
+ }>, z.ZodObject<{
109
+ operation: z.ZodLiteral<"get_package">;
110
+ package_id: z.ZodString;
111
+ credentials: z.ZodOptional<z.ZodRecord<z.ZodNativeEnum<typeof CredentialType>, z.ZodString>>;
112
+ }, "strip", z.ZodTypeAny, {
113
+ operation: "get_package";
114
+ package_id: string;
115
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
116
+ }, {
117
+ operation: "get_package";
118
+ package_id: string;
119
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
120
+ }>]>;
121
+ export declare const SendSafelyResultSchema: z.ZodDiscriminatedUnion<"operation", [z.ZodObject<{
122
+ operation: z.ZodLiteral<"send_file">;
123
+ success: z.ZodBoolean;
124
+ packageId: z.ZodOptional<z.ZodString>;
125
+ secureLink: z.ZodOptional<z.ZodString>;
126
+ error: z.ZodString;
127
+ }, "strip", z.ZodTypeAny, {
128
+ error: string;
129
+ success: boolean;
130
+ operation: "send_file";
131
+ packageId?: string | undefined;
132
+ secureLink?: string | undefined;
133
+ }, {
134
+ error: string;
135
+ success: boolean;
136
+ operation: "send_file";
137
+ packageId?: string | undefined;
138
+ secureLink?: string | undefined;
139
+ }>, z.ZodObject<{
140
+ operation: z.ZodLiteral<"send_message">;
141
+ success: z.ZodBoolean;
142
+ packageId: z.ZodOptional<z.ZodString>;
143
+ secureLink: z.ZodOptional<z.ZodString>;
144
+ error: z.ZodString;
145
+ }, "strip", z.ZodTypeAny, {
146
+ error: string;
147
+ success: boolean;
148
+ operation: "send_message";
149
+ packageId?: string | undefined;
150
+ secureLink?: string | undefined;
151
+ }, {
152
+ error: string;
153
+ success: boolean;
154
+ operation: "send_message";
155
+ packageId?: string | undefined;
156
+ secureLink?: string | undefined;
157
+ }>, z.ZodObject<{
158
+ operation: z.ZodLiteral<"get_package">;
159
+ success: z.ZodBoolean;
160
+ package: z.ZodOptional<z.ZodObject<{
161
+ packageId: z.ZodString;
162
+ packageCode: z.ZodOptional<z.ZodString>;
163
+ serverSecret: z.ZodOptional<z.ZodString>;
164
+ recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
165
+ recipientId: z.ZodString;
166
+ email: z.ZodString;
167
+ }, "strip", z.ZodTypeAny, {
168
+ email: string;
169
+ recipientId: string;
170
+ }, {
171
+ email: string;
172
+ recipientId: string;
173
+ }>, "many">>;
174
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
175
+ fileId: z.ZodString;
176
+ fileName: z.ZodString;
177
+ fileSize: z.ZodOptional<z.ZodNumber>;
178
+ }, "strip", z.ZodTypeAny, {
179
+ fileName: string;
180
+ fileId: string;
181
+ fileSize?: number | undefined;
182
+ }, {
183
+ fileName: string;
184
+ fileId: string;
185
+ fileSize?: number | undefined;
186
+ }>, "many">>;
187
+ state: z.ZodOptional<z.ZodString>;
188
+ life: z.ZodOptional<z.ZodNumber>;
189
+ secureLink: z.ZodOptional<z.ZodString>;
190
+ }, "strip", z.ZodTypeAny, {
191
+ packageId: string;
192
+ files?: {
193
+ fileName: string;
194
+ fileId: string;
195
+ fileSize?: number | undefined;
196
+ }[] | undefined;
197
+ state?: string | undefined;
198
+ packageCode?: string | undefined;
199
+ serverSecret?: string | undefined;
200
+ recipients?: {
201
+ email: string;
202
+ recipientId: string;
203
+ }[] | undefined;
204
+ life?: number | undefined;
205
+ secureLink?: string | undefined;
206
+ }, {
207
+ packageId: string;
208
+ files?: {
209
+ fileName: string;
210
+ fileId: string;
211
+ fileSize?: number | undefined;
212
+ }[] | undefined;
213
+ state?: string | undefined;
214
+ packageCode?: string | undefined;
215
+ serverSecret?: string | undefined;
216
+ recipients?: {
217
+ email: string;
218
+ recipientId: string;
219
+ }[] | undefined;
220
+ life?: number | undefined;
221
+ secureLink?: string | undefined;
222
+ }>>;
223
+ error: z.ZodString;
224
+ }, "strip", z.ZodTypeAny, {
225
+ error: string;
226
+ success: boolean;
227
+ operation: "get_package";
228
+ package?: {
229
+ packageId: string;
230
+ files?: {
231
+ fileName: string;
232
+ fileId: string;
233
+ fileSize?: number | undefined;
234
+ }[] | undefined;
235
+ state?: string | undefined;
236
+ packageCode?: string | undefined;
237
+ serverSecret?: string | undefined;
238
+ recipients?: {
239
+ email: string;
240
+ recipientId: string;
241
+ }[] | undefined;
242
+ life?: number | undefined;
243
+ secureLink?: string | undefined;
244
+ } | undefined;
245
+ }, {
246
+ error: string;
247
+ success: boolean;
248
+ operation: "get_package";
249
+ package?: {
250
+ packageId: string;
251
+ files?: {
252
+ fileName: string;
253
+ fileId: string;
254
+ fileSize?: number | undefined;
255
+ }[] | undefined;
256
+ state?: string | undefined;
257
+ packageCode?: string | undefined;
258
+ serverSecret?: string | undefined;
259
+ recipients?: {
260
+ email: string;
261
+ recipientId: string;
262
+ }[] | undefined;
263
+ life?: number | undefined;
264
+ secureLink?: string | undefined;
265
+ } | undefined;
266
+ }>]>;
267
+ export type SendSafelyParamsInput = z.input<typeof SendSafelyParamsSchema>;
268
+ export type SendSafelyParams = z.output<typeof SendSafelyParamsSchema>;
269
+ export type SendSafelyResult = z.output<typeof SendSafelyResultSchema>;
270
+ //# sourceMappingURL=sendsafely.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendsafely.schema.d.ts","sourceRoot":"","sources":["../../../../src/bubbles/service-bubble/sendsafely/sendsafely.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAe3D,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCF,CAAC;AAMvC,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkEjC,CAAC;AAMH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgCjC,CAAC;AAMH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC3E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACvE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -0,0 +1,144 @@
1
+ import { z } from 'zod';
2
+ import { CredentialType } from '@bubblelab/shared-schemas';
3
+ // ============================================================================
4
+ // CREDENTIALS FIELD - Required for all operations
5
+ // ============================================================================
6
+ const credentialsField = z
7
+ .record(z.nativeEnum(CredentialType), z.string())
8
+ .optional()
9
+ .describe('Object mapping credential types to values (injected at runtime)');
10
+ // ============================================================================
11
+ // DATA SCHEMAS - SendSafely API Response Objects
12
+ // ============================================================================
13
+ export const SendSafelyPackageInfoSchema = z
14
+ .object({
15
+ packageId: z.string().describe('Unique SendSafely package identifier'),
16
+ packageCode: z.string().optional().describe('Package access code'),
17
+ serverSecret: z
18
+ .string()
19
+ .optional()
20
+ .describe('Server-side secret for encryption'),
21
+ recipients: z
22
+ .array(z.object({
23
+ recipientId: z.string().describe('Recipient identifier'),
24
+ email: z.string().describe('Recipient email address'),
25
+ }))
26
+ .optional()
27
+ .describe('List of package recipients'),
28
+ files: z
29
+ .array(z.object({
30
+ fileId: z.string().describe('File identifier'),
31
+ fileName: z.string().describe('Original file name'),
32
+ fileSize: z.number().optional().describe('File size in bytes'),
33
+ }))
34
+ .optional()
35
+ .describe('List of files in the package'),
36
+ state: z.string().optional().describe('Current package state'),
37
+ life: z.number().optional().describe('Package lifetime in days'),
38
+ secureLink: z
39
+ .string()
40
+ .optional()
41
+ .describe('Secure link URL for the package'),
42
+ })
43
+ .describe('SendSafely package info');
44
+ // ============================================================================
45
+ // PARAMETERS SCHEMA - All SendSafely Operations
46
+ // ============================================================================
47
+ export const SendSafelyParamsSchema = z.discriminatedUnion('operation', [
48
+ // Send File
49
+ z.object({
50
+ operation: z
51
+ .literal('send_file')
52
+ .describe('Create an encrypted package with a file and send to a recipient'),
53
+ recipientEmail: z
54
+ .string()
55
+ .email('Invalid email format')
56
+ .describe('Email address of the recipient'),
57
+ fileName: z
58
+ .string()
59
+ .min(1, 'File name is required')
60
+ .describe('Name of the file being sent'),
61
+ fileData: z
62
+ .string()
63
+ .min(1, 'File data is required')
64
+ .describe('Base64-encoded file content'),
65
+ message: z
66
+ .string()
67
+ .optional()
68
+ .describe('Optional secure message to include with the package'),
69
+ lifeDays: z
70
+ .number()
71
+ .int()
72
+ .min(1)
73
+ .max(365)
74
+ .optional()
75
+ .describe('Package lifetime in days (default set by SendSafely org)'),
76
+ credentials: credentialsField,
77
+ }),
78
+ // Send Message
79
+ z.object({
80
+ operation: z
81
+ .literal('send_message')
82
+ .describe('Create an encrypted package with a secure message'),
83
+ recipientEmail: z
84
+ .string()
85
+ .email('Invalid email format')
86
+ .describe('Email address of the recipient'),
87
+ message: z
88
+ .string()
89
+ .min(1, 'Message is required')
90
+ .describe('Secure message to send'),
91
+ lifeDays: z
92
+ .number()
93
+ .int()
94
+ .min(1)
95
+ .max(365)
96
+ .optional()
97
+ .describe('Package lifetime in days (default set by SendSafely org)'),
98
+ credentials: credentialsField,
99
+ }),
100
+ // Get Package
101
+ z.object({
102
+ operation: z.literal('get_package').describe('Retrieve package info by ID'),
103
+ package_id: z
104
+ .string()
105
+ .min(1, 'Package ID is required')
106
+ .describe('SendSafely package identifier'),
107
+ credentials: credentialsField,
108
+ }),
109
+ ]);
110
+ // ============================================================================
111
+ // RESULT SCHEMA - All SendSafely Operation Results
112
+ // ============================================================================
113
+ export const SendSafelyResultSchema = z.discriminatedUnion('operation', [
114
+ // Send File Result
115
+ z.object({
116
+ operation: z.literal('send_file'),
117
+ success: z.boolean().describe('Whether the operation succeeded'),
118
+ packageId: z.string().optional().describe('Created package identifier'),
119
+ secureLink: z
120
+ .string()
121
+ .optional()
122
+ .describe('Secure link URL for the package'),
123
+ error: z.string().describe('Error message if operation failed'),
124
+ }),
125
+ // Send Message Result
126
+ z.object({
127
+ operation: z.literal('send_message'),
128
+ success: z.boolean().describe('Whether the operation succeeded'),
129
+ packageId: z.string().optional().describe('Created package identifier'),
130
+ secureLink: z
131
+ .string()
132
+ .optional()
133
+ .describe('Secure link URL for the package'),
134
+ error: z.string().describe('Error message if operation failed'),
135
+ }),
136
+ // Get Package Result
137
+ z.object({
138
+ operation: z.literal('get_package'),
139
+ success: z.boolean().describe('Whether the operation succeeded'),
140
+ package: SendSafelyPackageInfoSchema.optional().describe('Package info'),
141
+ error: z.string().describe('Error message if operation failed'),
142
+ }),
143
+ ]);
144
+ //# sourceMappingURL=sendsafely.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendsafely.schema.js","sourceRoot":"","sources":["../../../../src/bubbles/service-bubble/sendsafely/sendsafely.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,+EAA+E;AAC/E,kDAAkD;AAClD,+EAA+E;AAE/E,MAAM,gBAAgB,GAAG,C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E,CAAC;aACV,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,iCAAiC,CAAC;QAC9C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;KAChE,CAAC;IAEF,sBAAsB;IACtB,CAAC,CAAC,MAAM,CAAC;QACP,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;QACpC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;QAChE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;QACvE,UAAU,EAAE,CAAC;aACV,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,iCAAiC,CAAC;QAC9C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;KAChE,CAAC;IAEF,qBAAqB;IACrB,CAAC,CAAC,MAAM,CAAC;QACP,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;QACnC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;QAChE,OAAO,EAAE,2BAA2B,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;QACxE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;KAChE,CAAC;CACH,CAAC,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * SendSafely Bubble Utility Functions
3
+ *
4
+ * Promise wrappers around the callback-based @sendsafely/sendsafely SDK
5
+ * and credential parsing helpers.
6
+ */
7
+ import SendSafely from '@sendsafely/sendsafely';
8
+ export interface SendSafelyCredentials {
9
+ host: string;
10
+ apiKey: string;
11
+ apiSecret: string;
12
+ }
13
+ /**
14
+ * Parse a multi-field credential value into typed SendSafely fields.
15
+ * Uses the shared decodeMultiFieldCredential() which handles both
16
+ * base64 (injection path) and raw JSON (validator path).
17
+ */
18
+ export declare function parseSendSafelyCredential(value: string): SendSafelyCredentials;
19
+ /**
20
+ * Create a SendSafely client instance from credentials
21
+ */
22
+ export declare function createClient(creds: SendSafelyCredentials): SendSafely;
23
+ /**
24
+ * Verify credentials by requesting the authenticated user email
25
+ */
26
+ export declare function verifyCredentials(client: SendSafely): Promise<string>;
27
+ /**
28
+ * Create a new empty package
29
+ */
30
+ export declare function createPackage(client: SendSafely): Promise<{
31
+ packageId: string;
32
+ serverSecret: string;
33
+ packageCode: string;
34
+ keyCode: string;
35
+ }>;
36
+ /**
37
+ * Add a recipient to a package
38
+ */
39
+ export declare function addRecipient(client: SendSafely, packageId: string, email: string): Promise<string>;
40
+ /**
41
+ * Encrypt and upload a file to a package
42
+ */
43
+ export declare function encryptAndUploadFile(client: SendSafely, packageId: string, packageCode: string, serverSecret: string, fileName: string, fileData: Buffer): Promise<{
44
+ fileId: string;
45
+ }>;
46
+ /**
47
+ * Encrypt a message client-side. Returns the encrypted text which must
48
+ * then be saved to the server via saveMessage().
49
+ */
50
+ export declare function encryptMessage(client: SendSafely, packageId: string, packageCode: string, serverSecret: string, message: string): Promise<string>;
51
+ /**
52
+ * Finalize a package (triggers notification to recipients).
53
+ *
54
+ * Uses the standard `finalizePackage` SDK method which:
55
+ * 1. Gets public keys for all recipients
56
+ * 2. Encrypts the keyCode with each recipient's public key
57
+ * 3. Uploads encrypted keycodes to the server
58
+ * 4. Calls the finalize HTTP endpoint
59
+ *
60
+ * Note: Requires a patched `keyGeneratorWorker.js` that exposes
61
+ * `self.send = send;` — otherwise the keycode encryption callback
62
+ * never fires because `self.send` is undefined in eval'd context.
63
+ */
64
+ export declare function finalizePackage(client: SendSafely, packageId: string, packageCode: string, keyCode: string): Promise<string>;
65
+ /**
66
+ * Save an encrypted message to a package on the server.
67
+ * Must be called after encryptMessage() to persist the encrypted text.
68
+ */
69
+ export declare function saveMessage(client: SendSafely, packageId: string, encryptedMessage: string): Promise<void>;
70
+ /**
71
+ * Update a package (e.g. set expiration via { life: N })
72
+ */
73
+ export declare function updatePackage(client: SendSafely, packageId: string, data: {
74
+ life: number;
75
+ }): Promise<Record<string, unknown>>;
76
+ /**
77
+ * Get package information by package ID
78
+ */
79
+ export declare function getPackageInfo(client: SendSafely, packageId: string): Promise<Record<string, unknown>>;
80
+ //# sourceMappingURL=sendsafely.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendsafely.utils.d.ts","sourceRoot":"","sources":["../../../../src/bubbles/service-bubble/sendsafely/sendsafely.utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAMhD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,MAAM,GACZ,qBAAqB,CAYvB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,qBAAqB,GAAG,UAAU,CAErE;AAkED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAQrE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC,CAgBD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,CAUjB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CA4B7B;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAejB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC,CAQf;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GACrB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAUlC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAUlC"}
@@ -0,0 +1,168 @@
1
+ /**
2
+ * SendSafely Bubble Utility Functions
3
+ *
4
+ * Promise wrappers around the callback-based @sendsafely/sendsafely SDK
5
+ * and credential parsing helpers.
6
+ */
7
+ import SendSafely from '@sendsafely/sendsafely';
8
+ import { decodeCredentialPayload } from '@bubblelab/shared-schemas';
9
+ /** Default timeout for SDK operations (30 seconds) */
10
+ const SDK_TIMEOUT_MS = 30_000;
11
+ /**
12
+ * Parse a multi-field credential value into typed SendSafely fields.
13
+ * Uses the shared decodeMultiFieldCredential() which handles both
14
+ * base64 (injection path) and raw JSON (validator path).
15
+ */
16
+ export function parseSendSafelyCredential(value) {
17
+ const parsed = decodeCredentialPayload(value);
18
+ if (!parsed.host || !parsed.apiKey || !parsed.apiSecret) {
19
+ throw new Error('SendSafely credential is missing required fields: host, apiKey, apiSecret');
20
+ }
21
+ return {
22
+ host: parsed.host,
23
+ apiKey: parsed.apiKey,
24
+ apiSecret: parsed.apiSecret,
25
+ };
26
+ }
27
+ /**
28
+ * Create a SendSafely client instance from credentials
29
+ */
30
+ export function createClient(creds) {
31
+ return new SendSafely(creds.host, creds.apiKey, creds.apiSecret);
32
+ }
33
+ /**
34
+ * Wrap a callback-based SDK call in a Promise with timeout and one-shot error handling.
35
+ * Prevents: (1) infinite hangs when callbacks never fire, (2) stacking error handlers.
36
+ */
37
+ function withTimeout(client, executor, operationName, timeoutMs = SDK_TIMEOUT_MS, additionalErrorEvents = []) {
38
+ return new Promise((resolve, reject) => {
39
+ let settled = false;
40
+ const settle = (fn) => {
41
+ if (!settled) {
42
+ settled = true;
43
+ fn();
44
+ }
45
+ };
46
+ // One-shot error handler — listens on general + operation-specific events
47
+ const errorHandler = (...args) => {
48
+ const msg = args
49
+ .map((a) => typeof a === 'object' && a !== null ? JSON.stringify(a) : String(a))
50
+ .join(', ');
51
+ settle(() => reject(new Error(`SendSafely ${operationName} error: ${msg}`)));
52
+ };
53
+ const errorEvents = ['sendsafely.error', ...additionalErrorEvents];
54
+ for (const evt of errorEvents) {
55
+ client.on(evt, errorHandler);
56
+ }
57
+ // Timeout guard
58
+ const timer = setTimeout(() => {
59
+ settle(() => reject(new Error(`SendSafely ${operationName} timed out after ${timeoutMs}ms`)));
60
+ }, timeoutMs);
61
+ executor((value) => {
62
+ clearTimeout(timer);
63
+ settle(() => resolve(value));
64
+ }, (reason) => {
65
+ clearTimeout(timer);
66
+ settle(() => reject(reason));
67
+ });
68
+ });
69
+ }
70
+ /**
71
+ * Verify credentials by requesting the authenticated user email
72
+ */
73
+ export function verifyCredentials(client) {
74
+ return withTimeout(client, (resolve) => {
75
+ client.verifyCredentials((email) => resolve(email));
76
+ }, 'verifyCredentials');
77
+ }
78
+ /**
79
+ * Create a new empty package
80
+ */
81
+ export function createPackage(client) {
82
+ return withTimeout(client, (resolve) => {
83
+ // Callback: (packageId, serverSecret, packageCode, keyCode)
84
+ client.createPackage((packageId, serverSecret, packageCode, keyCode) => resolve({ packageId, serverSecret, packageCode, keyCode }));
85
+ }, 'createPackage');
86
+ }
87
+ /**
88
+ * Add a recipient to a package
89
+ */
90
+ export function addRecipient(client, packageId, email) {
91
+ return withTimeout(client, (resolve) => {
92
+ client.addRecipient(packageId, email, undefined, (recipientId) => resolve(recipientId));
93
+ }, 'addRecipient');
94
+ }
95
+ /**
96
+ * Encrypt and upload a file to a package
97
+ */
98
+ export function encryptAndUploadFile(client, packageId, packageCode, serverSecret, fileName, fileData) {
99
+ return withTimeout(client, (resolve) => {
100
+ // The SDK's upload code calls _slice(currentFile.file.data, start, end)
101
+ // which expects a blob-like object with .slice(). Buffer has .slice()
102
+ // so we expose the raw buffer as `data`.
103
+ const file = {
104
+ name: fileName,
105
+ size: fileData.length,
106
+ data: fileData,
107
+ slice: (start, end) => fileData.subarray(start, end),
108
+ };
109
+ // SDK method is plural: encryptAndUploadFiles
110
+ // Signature: (packageId, keyCode, serverSecret, files[], uploadType, callback)
111
+ client.encryptAndUploadFiles(packageId, packageCode, serverSecret, [file], 'JavaScript', (fileId) => resolve({ fileId }));
112
+ }, 'encryptAndUploadFile', 120_000, // 2 minutes for file uploads
113
+ ['FILES_ENCRYPT_ERROR']);
114
+ }
115
+ /**
116
+ * Encrypt a message client-side. Returns the encrypted text which must
117
+ * then be saved to the server via saveMessage().
118
+ */
119
+ export function encryptMessage(client, packageId, packageCode, serverSecret, message) {
120
+ return withTimeout(client, (resolve) => {
121
+ client.encryptMessage(packageId, packageCode, serverSecret, message, (encryptedMessage) => resolve(encryptedMessage));
122
+ }, 'encryptMessage', SDK_TIMEOUT_MS, ['MESSAGE_ENCRYPT_ERROR']);
123
+ }
124
+ /**
125
+ * Finalize a package (triggers notification to recipients).
126
+ *
127
+ * Uses the standard `finalizePackage` SDK method which:
128
+ * 1. Gets public keys for all recipients
129
+ * 2. Encrypts the keyCode with each recipient's public key
130
+ * 3. Uploads encrypted keycodes to the server
131
+ * 4. Calls the finalize HTTP endpoint
132
+ *
133
+ * Note: Requires a patched `keyGeneratorWorker.js` that exposes
134
+ * `self.send = send;` — otherwise the keycode encryption callback
135
+ * never fires because `self.send` is undefined in eval'd context.
136
+ */
137
+ export function finalizePackage(client, packageId, packageCode, keyCode) {
138
+ return withTimeout(client, (resolve) => {
139
+ client.finalizePackage(packageId, packageCode, keyCode, (secureLink) => resolve(secureLink));
140
+ }, 'finalizePackage', 60_000, // 60 seconds — keycode encryption + upload can be slow
141
+ ['finalization.error']);
142
+ }
143
+ /**
144
+ * Save an encrypted message to a package on the server.
145
+ * Must be called after encryptMessage() to persist the encrypted text.
146
+ */
147
+ export function saveMessage(client, packageId, encryptedMessage) {
148
+ return withTimeout(client, (resolve) => {
149
+ client.saveMessage(packageId, encryptedMessage, () => resolve());
150
+ }, 'saveMessage');
151
+ }
152
+ /**
153
+ * Update a package (e.g. set expiration via { life: N })
154
+ */
155
+ export function updatePackage(client, packageId, data) {
156
+ return withTimeout(client, (resolve) => {
157
+ client.updatePackage(packageId, data, (info) => resolve(info));
158
+ }, 'updatePackage');
159
+ }
160
+ /**
161
+ * Get package information by package ID
162
+ */
163
+ export function getPackageInfo(client, packageId) {
164
+ return withTimeout(client, (resolve) => {
165
+ client.packageInformation(packageId, (info) => resolve(info));
166
+ }, 'getPackageInfo');
167
+ }
168
+ //# sourceMappingURL=sendsafely.utils.js.map