spectrum-ts 1.17.1 → 2.0.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 (36) hide show
  1. package/README.md +11 -1
  2. package/dist/{attachment-DfWSZS5L.d.ts → attachment-B4nSrKVd.d.ts} +1 -1
  3. package/dist/{authoring-C9uDdZ2F.d.ts → authoring-BjE5BvlO.d.ts} +2 -2
  4. package/dist/authoring.d.ts +3 -3
  5. package/dist/authoring.js +6 -3
  6. package/dist/chunk-34FQGGD7.js +34 -0
  7. package/dist/chunk-3B4QH4JG.js +35 -0
  8. package/dist/chunk-3GEJYGZK.js +84 -0
  9. package/dist/chunk-5LT5J3NR.js +695 -0
  10. package/dist/{chunk-MC6ZKFSG.js → chunk-5XEFJBN2.js} +25 -103
  11. package/dist/{chunk-JQN6CRSC.js → chunk-6BI4PFTP.js} +10 -39
  12. package/dist/{chunk-QGJFZMD5.js → chunk-6UZFVXQF.js} +17 -101
  13. package/dist/{chunk-YJMPSD3S.js → chunk-ATNAE7OR.js} +196 -47
  14. package/dist/{chunk-IPOFBAIM.js → chunk-NGC4DJIX.js} +23 -19
  15. package/dist/{chunk-5TIF3FIE.js → chunk-Q537JPTG.js} +8 -6
  16. package/dist/{chunk-5BKZJMZV.js → chunk-U3LXXT3W.js} +61 -32
  17. package/dist/chunk-U7AWXDH6.js +91 -0
  18. package/dist/{chunk-3OTECDNH.js → chunk-WXY5QP3M.js} +5 -3
  19. package/dist/index.d.ts +71 -126
  20. package/dist/index.js +350 -90
  21. package/dist/manifest.json +6 -0
  22. package/dist/providers/imessage/index.d.ts +75 -3
  23. package/dist/providers/imessage/index.js +10 -5
  24. package/dist/providers/index.d.ts +5 -2
  25. package/dist/providers/index.js +16 -8
  26. package/dist/providers/slack/index.d.ts +1 -1
  27. package/dist/providers/slack/index.js +4 -3
  28. package/dist/providers/telegram/index.d.ts +47 -0
  29. package/dist/providers/telegram/index.js +13 -0
  30. package/dist/providers/terminal/index.d.ts +17 -419
  31. package/dist/providers/terminal/index.js +5 -3
  32. package/dist/providers/whatsapp-business/index.d.ts +1 -1
  33. package/dist/providers/whatsapp-business/index.js +6 -4
  34. package/dist/types-BD0-kKyv.d.ts +82 -0
  35. package/dist/{types-DcQ5a7PK.d.ts → types-Bje8aq1k.d.ts} +34 -4
  36. package/package.json +3 -2
@@ -1,4 +1,4 @@
1
- import { P as Platform, a as PlatformDef, M as Message, U as User, b as Space } from '../../types-DcQ5a7PK.js';
1
+ import { P as Platform, a as PlatformDef, f as contentSchema } from '../../types-Bje8aq1k.js';
2
2
  import { ChildProcess } from 'node:child_process';
3
3
  import z__default from 'zod';
4
4
  import { Socket } from 'node:net';
@@ -86,6 +86,21 @@ interface TerminalClient {
86
86
  proc: ChildProcess;
87
87
  session: RpcSession;
88
88
  }
89
+ type SpectrumContent = z__default.infer<typeof contentSchema>;
90
+ interface TerminalInboundMessage {
91
+ content: SpectrumContent;
92
+ id: string;
93
+ replyTo?: {
94
+ messageId: string;
95
+ };
96
+ sender: {
97
+ id: string;
98
+ };
99
+ space: {
100
+ id: string;
101
+ };
102
+ timestamp: Date;
103
+ }
89
104
  declare const terminal: Platform<PlatformDef<"Terminal", z__default.ZodObject<{
90
105
  commands: z__default.ZodOptional<z__default.ZodArray<z__default.ZodObject<{
91
106
  name: z__default.ZodString;
@@ -101,423 +116,6 @@ declare const terminal: Platform<PlatformDef<"Terminal", z__default.ZodObject<{
101
116
  replyTo: z__default.ZodOptional<z__default.ZodObject<{
102
117
  messageId: z__default.ZodString;
103
118
  }, z__default.core.$strip>>;
104
- }, z__default.core.$strip>, {
105
- replyTo?: {
106
- messageId: string;
107
- } | undefined;
108
- id: string;
109
- content: {
110
- type: "avatar";
111
- action: {
112
- kind: "set";
113
- read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
114
- mimeType: string;
115
- } | {
116
- kind: "clear";
117
- };
118
- } | {
119
- type: "text";
120
- text: string;
121
- } | {
122
- type: "attachment";
123
- id: string;
124
- name: string;
125
- mimeType: string;
126
- read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
127
- stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
128
- size?: number | undefined;
129
- } | {
130
- type: "custom";
131
- raw: unknown;
132
- } | {
133
- type: "contact";
134
- user?: {
135
- __platform: string;
136
- id: string;
137
- } | undefined;
138
- name?: {
139
- formatted?: string | undefined;
140
- first?: string | undefined;
141
- last?: string | undefined;
142
- middle?: string | undefined;
143
- prefix?: string | undefined;
144
- suffix?: string | undefined;
145
- } | undefined;
146
- phones?: {
147
- value: string;
148
- type?: "mobile" | "home" | "work" | "other" | undefined;
149
- }[] | undefined;
150
- emails?: {
151
- value: string;
152
- type?: "home" | "work" | "other" | undefined;
153
- }[] | undefined;
154
- addresses?: {
155
- street?: string | undefined;
156
- city?: string | undefined;
157
- region?: string | undefined;
158
- postalCode?: string | undefined;
159
- country?: string | undefined;
160
- type?: "home" | "work" | "other" | undefined;
161
- }[] | undefined;
162
- org?: {
163
- name?: string | undefined;
164
- title?: string | undefined;
165
- department?: string | undefined;
166
- } | undefined;
167
- urls?: string[] | undefined;
168
- birthday?: string | undefined;
169
- note?: string | undefined;
170
- photo?: {
171
- mimeType: string;
172
- read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
173
- } | undefined;
174
- raw?: unknown;
175
- } | {
176
- type: "voice";
177
- mimeType: string;
178
- read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
179
- stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
180
- name?: string | undefined;
181
- duration?: number | undefined;
182
- size?: number | undefined;
183
- } | {
184
- type: "richlink";
185
- url: string;
186
- title: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodString>>>;
187
- summary: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodString>>>;
188
- cover: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodObject<{
189
- mimeType: z__default.ZodOptional<z__default.ZodString>;
190
- read: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
191
- stream: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
192
- }, z__default.core.$strip>>>>;
193
- } | {
194
- type: "reaction";
195
- emoji: string;
196
- target: Message<string, User, Space<unknown>>;
197
- } | {
198
- type: "group";
199
- items: Message<string, User, Space<unknown>>[];
200
- } | {
201
- type: "poll";
202
- title: string;
203
- options: {
204
- title: string;
205
- }[];
206
- } | {
207
- type: "poll_option";
208
- option: {
209
- title: string;
210
- };
211
- poll: {
212
- type: "poll";
213
- title: string;
214
- options: {
215
- title: string;
216
- }[];
217
- };
218
- selected: boolean;
219
- title: string;
220
- } | {
221
- type: "effect";
222
- content: {
223
- type: "text";
224
- text: string;
225
- } | {
226
- type: "attachment";
227
- id: string;
228
- name: string;
229
- mimeType: string;
230
- read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
231
- stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
232
- size?: number | undefined;
233
- };
234
- effect: string;
235
- } | {
236
- type: "typing";
237
- state: "start" | "stop";
238
- } | {
239
- type: "rename";
240
- displayName: string;
241
- } | {
242
- type: "reply";
243
- content: {
244
- type: "avatar";
245
- action: {
246
- kind: "set";
247
- read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
248
- mimeType: string;
249
- } | {
250
- kind: "clear";
251
- };
252
- } | {
253
- type: "text";
254
- text: string;
255
- } | {
256
- type: "attachment";
257
- id: string;
258
- name: string;
259
- mimeType: string;
260
- read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
261
- stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
262
- size?: number | undefined;
263
- } | {
264
- type: "custom";
265
- raw: unknown;
266
- } | {
267
- type: "contact";
268
- user?: {
269
- __platform: string;
270
- id: string;
271
- } | undefined;
272
- name?: {
273
- formatted?: string | undefined;
274
- first?: string | undefined;
275
- last?: string | undefined;
276
- middle?: string | undefined;
277
- prefix?: string | undefined;
278
- suffix?: string | undefined;
279
- } | undefined;
280
- phones?: {
281
- value: string;
282
- type?: "mobile" | "home" | "work" | "other" | undefined;
283
- }[] | undefined;
284
- emails?: {
285
- value: string;
286
- type?: "home" | "work" | "other" | undefined;
287
- }[] | undefined;
288
- addresses?: {
289
- street?: string | undefined;
290
- city?: string | undefined;
291
- region?: string | undefined;
292
- postalCode?: string | undefined;
293
- country?: string | undefined;
294
- type?: "home" | "work" | "other" | undefined;
295
- }[] | undefined;
296
- org?: {
297
- name?: string | undefined;
298
- title?: string | undefined;
299
- department?: string | undefined;
300
- } | undefined;
301
- urls?: string[] | undefined;
302
- birthday?: string | undefined;
303
- note?: string | undefined;
304
- photo?: {
305
- mimeType: string;
306
- read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
307
- } | undefined;
308
- raw?: unknown;
309
- } | {
310
- type: "voice";
311
- mimeType: string;
312
- read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
313
- stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
314
- name?: string | undefined;
315
- duration?: number | undefined;
316
- size?: number | undefined;
317
- } | {
318
- type: "richlink";
319
- url: string;
320
- title: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodString>>>;
321
- summary: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodString>>>;
322
- cover: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodObject<{
323
- mimeType: z__default.ZodOptional<z__default.ZodString>;
324
- read: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
325
- stream: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
326
- }, z__default.core.$strip>>>>;
327
- } | {
328
- type: "reaction";
329
- emoji: string;
330
- target: Message<string, User, Space<unknown>>;
331
- } | {
332
- type: "group";
333
- items: Message<string, User, Space<unknown>>[];
334
- } | {
335
- type: "poll";
336
- title: string;
337
- options: {
338
- title: string;
339
- }[];
340
- } | {
341
- type: "poll_option";
342
- option: {
343
- title: string;
344
- };
345
- poll: {
346
- type: "poll";
347
- title: string;
348
- options: {
349
- title: string;
350
- }[];
351
- };
352
- selected: boolean;
353
- title: string;
354
- } | {
355
- type: "effect";
356
- content: {
357
- type: "text";
358
- text: string;
359
- } | {
360
- type: "attachment";
361
- id: string;
362
- name: string;
363
- mimeType: string;
364
- read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
365
- stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
366
- size?: number | undefined;
367
- };
368
- effect: string;
369
- } | {
370
- type: "typing";
371
- state: "start" | "stop";
372
- } | {
373
- type: "rename";
374
- displayName: string;
375
- };
376
- target: Message<string, User, Space<unknown>>;
377
- } | {
378
- type: "edit";
379
- content: {
380
- type: "avatar";
381
- action: {
382
- kind: "set";
383
- read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
384
- mimeType: string;
385
- } | {
386
- kind: "clear";
387
- };
388
- } | {
389
- type: "text";
390
- text: string;
391
- } | {
392
- type: "attachment";
393
- id: string;
394
- name: string;
395
- mimeType: string;
396
- read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
397
- stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
398
- size?: number | undefined;
399
- } | {
400
- type: "custom";
401
- raw: unknown;
402
- } | {
403
- type: "contact";
404
- user?: {
405
- __platform: string;
406
- id: string;
407
- } | undefined;
408
- name?: {
409
- formatted?: string | undefined;
410
- first?: string | undefined;
411
- last?: string | undefined;
412
- middle?: string | undefined;
413
- prefix?: string | undefined;
414
- suffix?: string | undefined;
415
- } | undefined;
416
- phones?: {
417
- value: string;
418
- type?: "mobile" | "home" | "work" | "other" | undefined;
419
- }[] | undefined;
420
- emails?: {
421
- value: string;
422
- type?: "home" | "work" | "other" | undefined;
423
- }[] | undefined;
424
- addresses?: {
425
- street?: string | undefined;
426
- city?: string | undefined;
427
- region?: string | undefined;
428
- postalCode?: string | undefined;
429
- country?: string | undefined;
430
- type?: "home" | "work" | "other" | undefined;
431
- }[] | undefined;
432
- org?: {
433
- name?: string | undefined;
434
- title?: string | undefined;
435
- department?: string | undefined;
436
- } | undefined;
437
- urls?: string[] | undefined;
438
- birthday?: string | undefined;
439
- note?: string | undefined;
440
- photo?: {
441
- mimeType: string;
442
- read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
443
- } | undefined;
444
- raw?: unknown;
445
- } | {
446
- type: "voice";
447
- mimeType: string;
448
- read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
449
- stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
450
- name?: string | undefined;
451
- duration?: number | undefined;
452
- size?: number | undefined;
453
- } | {
454
- type: "richlink";
455
- url: string;
456
- title: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodString>>>;
457
- summary: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodString>>>;
458
- cover: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodObject<{
459
- mimeType: z__default.ZodOptional<z__default.ZodString>;
460
- read: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
461
- stream: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
462
- }, z__default.core.$strip>>>>;
463
- } | {
464
- type: "reaction";
465
- emoji: string;
466
- target: Message<string, User, Space<unknown>>;
467
- } | {
468
- type: "group";
469
- items: Message<string, User, Space<unknown>>[];
470
- } | {
471
- type: "poll";
472
- title: string;
473
- options: {
474
- title: string;
475
- }[];
476
- } | {
477
- type: "poll_option";
478
- option: {
479
- title: string;
480
- };
481
- poll: {
482
- type: "poll";
483
- title: string;
484
- options: {
485
- title: string;
486
- }[];
487
- };
488
- selected: boolean;
489
- title: string;
490
- } | {
491
- type: "effect";
492
- content: {
493
- type: "text";
494
- text: string;
495
- } | {
496
- type: "attachment";
497
- id: string;
498
- name: string;
499
- mimeType: string;
500
- read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
501
- stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
502
- size?: number | undefined;
503
- };
504
- effect: string;
505
- } | {
506
- type: "typing";
507
- state: "start" | "stop";
508
- } | {
509
- type: "rename";
510
- displayName: string;
511
- };
512
- target: Message<string, User, Space<unknown>>;
513
- };
514
- sender: {
515
- id: string;
516
- };
517
- space: {
518
- id: string;
519
- };
520
- timestamp: Date;
521
- }, undefined, Record<never, never>, Record<never, never>, Record<never, never>>> & Readonly<Record<never, never>>;
119
+ }, z__default.core.$strip>, TerminalInboundMessage, undefined, Record<never, never>, Record<never, never>, Record<never, never>>> & Readonly<Record<never, never>>;
522
120
 
523
121
  export { terminal };
@@ -1,10 +1,12 @@
1
1
  import { createRequire as __spectrumCreateRequire } from "node:module"; const require = __spectrumCreateRequire(import.meta.url);
2
2
  import {
3
3
  terminal
4
- } from "../../chunk-5BKZJMZV.js";
4
+ } from "../../chunk-U3LXXT3W.js";
5
5
  import "../../chunk-NNY6LMSC.js";
6
- import "../../chunk-QGJFZMD5.js";
7
- import "../../chunk-IPOFBAIM.js";
6
+ import "../../chunk-U7AWXDH6.js";
7
+ import "../../chunk-5XEFJBN2.js";
8
+ import "../../chunk-6UZFVXQF.js";
9
+ import "../../chunk-NGC4DJIX.js";
8
10
  import "../../chunk-2ILTJC35.js";
9
11
  export {
10
12
  terminal
@@ -1,4 +1,4 @@
1
- import { S as SchemaMessage, P as Platform, a as PlatformDef } from '../../types-DcQ5a7PK.js';
1
+ import { S as SchemaMessage, P as Platform, a as PlatformDef } from '../../types-Bje8aq1k.js';
2
2
  import { WhatsAppClient } from '@photon-ai/whatsapp-business';
3
3
  import * as z from 'zod';
4
4
  import z__default from 'zod';
@@ -1,11 +1,13 @@
1
1
  import { createRequire as __spectrumCreateRequire } from "node:module"; const require = __spectrumCreateRequire(import.meta.url);
2
2
  import {
3
3
  whatsappBusiness
4
- } from "../../chunk-5TIF3FIE.js";
4
+ } from "../../chunk-Q537JPTG.js";
5
5
  import "../../chunk-2D27WW5B.js";
6
- import "../../chunk-MC6ZKFSG.js";
7
- import "../../chunk-QGJFZMD5.js";
8
- import "../../chunk-IPOFBAIM.js";
6
+ import "../../chunk-3GEJYGZK.js";
7
+ import "../../chunk-U7AWXDH6.js";
8
+ import "../../chunk-5XEFJBN2.js";
9
+ import "../../chunk-6UZFVXQF.js";
10
+ import "../../chunk-NGC4DJIX.js";
9
11
  import "../../chunk-2ILTJC35.js";
10
12
  export {
11
13
  whatsappBusiness
@@ -0,0 +1,82 @@
1
+ import { b as ProjectData, c as Store, d as ProviderMessageRecord, e as Space, M as Message } from './types-Bje8aq1k.js';
2
+
3
+ declare const FUSOR_EVENT_BRAND: unique symbol;
4
+ interface FusorEvent<TName extends string = string, TData = unknown> {
5
+ readonly data: TData;
6
+ readonly name: TName;
7
+ readonly [FUSOR_EVENT_BRAND]: true;
8
+ }
9
+ declare function fusorEvent<TName extends string, TData>(name: TName, data: TData): FusorEvent<TName, TData>;
10
+ declare function isFusorEvent(value: unknown): value is FusorEvent;
11
+
12
+ interface FusorVerifyRequest {
13
+ headers: Record<string, string>;
14
+ method: string;
15
+ path: string;
16
+ rawBody: Uint8Array;
17
+ }
18
+ type FusorVerify<TPayload = unknown> = (req: FusorVerifyRequest) => TPayload | Promise<TPayload>;
19
+ interface FusorReply {
20
+ body?: string | Uint8Array;
21
+ headers?: Record<string, string>;
22
+ status?: number;
23
+ }
24
+ type FusorRespond = (reply: FusorReply) => void;
25
+ interface FusorMessagesCtx<TPayload, TConfig = unknown> {
26
+ /** Parsed provider config (`z.infer` of the platform's config schema). */
27
+ config: TConfig;
28
+ payload: TPayload;
29
+ /**
30
+ * Spectrum Cloud project metadata, fetched once at `Spectrum()` init.
31
+ * `undefined` for local-only setups (no `projectId`/`projectSecret`). Read
32
+ * project-level toggles from `projectConfig.profile.<key>`.
33
+ */
34
+ projectConfig: ProjectData | undefined;
35
+ respond: FusorRespond;
36
+ /** Per-platform in-memory key/value store, shared with the rest of the platform. */
37
+ store: Store;
38
+ }
39
+ type FusorMessagesReturn = ProviderMessageRecord | FusorEvent | (ProviderMessageRecord | FusorEvent)[] | undefined;
40
+ type FusorMessages<TPayload, TConfig = unknown> = (ctx: FusorMessagesCtx<TPayload, TConfig>) => FusorMessagesReturn | Promise<FusorMessagesReturn>;
41
+ declare const FUSOR_BRAND: unique symbol;
42
+ interface FusorClient<TPayload = unknown> {
43
+ readonly platform: string;
44
+ readonly verify: FusorVerify<TPayload>;
45
+ readonly [FUSOR_BRAND]: true;
46
+ }
47
+ /**
48
+ * Request-scoped handler invoked once per inbound message that
49
+ * `spectrum.webhook()` resolves. Receives the same fully-built `[space,
50
+ * message]` pair that `spectrum.messages` yields.
51
+ *
52
+ * Runs **fire-and-forget**: it is dispatched after the HTTP response (the
53
+ * platform's `respond()` reply) has already been computed, so its outcome never
54
+ * affects the response, and a throw is caught + logged rather than surfaced —
55
+ * mirroring the body of a `for await (… of spectrum.messages)` loop.
56
+ *
57
+ * On a long-running server the event loop keeps the handler alive. On
58
+ * serverless/edge runtimes the function may be frozen once the response is
59
+ * returned, so keeping background work alive is the caller's responsibility —
60
+ * the usual pattern is to enqueue the work and process it in a separate worker.
61
+ */
62
+ type WebhookHandler = (space: Space, message: Message) => void | Promise<void>;
63
+ /**
64
+ * Raw webhook input for HTTP servers without Web `Request`/`Response` (Express,
65
+ * raw Node). `body` MUST be the exact bytes fusor POSTed — never a re-encoded
66
+ * JSON/text body — so the protobuf decode works. `headers` are accepted (so the
67
+ * natural `{ headers: req.headers, body: req.body }` shape keeps working) but are
68
+ * not read: inbound authenticity is established by the per-platform `verify()`,
69
+ * which reads the inner request reconstructed from the envelope.
70
+ */
71
+ interface WebhookRawRequest {
72
+ body: Uint8Array | ArrayBuffer;
73
+ headers?: Record<string, string>;
74
+ }
75
+ /** Raw webhook result, written back by the caller as the HTTP response. */
76
+ interface WebhookRawResult {
77
+ body: Uint8Array;
78
+ headers: Record<string, string>;
79
+ status: number;
80
+ }
81
+
82
+ export { type FusorClient as F, type WebhookHandler as W, type FusorVerify as a, type FusorMessages as b, type WebhookRawRequest as c, type WebhookRawResult as d, type FusorEvent as e, type FusorMessagesCtx as f, type FusorMessagesReturn as g, type FusorReply as h, type FusorRespond as i, type FusorVerifyRequest as j, fusorEvent as k, isFusorEvent as l };