spectrum-ts 1.5.0 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-NIIJ6U34.js → chunk-2SB6VN7J.js} +48 -50
- package/dist/{chunk-NNRUJOPT.js → chunk-ET42EGIA.js} +27 -26
- package/dist/{chunk-L6LUFBLF.js → chunk-HWADNTQF.js} +4 -4
- package/dist/{chunk-LH4YEBG3.js → chunk-JWWIFSI7.js} +173 -185
- package/dist/{chunk-66GJ45ZZ.js → chunk-VO43HJ5B.js} +1 -1
- package/dist/{chunk-B4MHPWPZ.js → chunk-VVXMZYDH.js} +2 -2
- package/dist/{chunk-4U4RINOV.js → chunk-ZDNX3S3H.js} +224 -103
- package/dist/index.d.ts +549 -8
- package/dist/index.js +87 -92
- package/dist/providers/imessage/index.d.ts +31 -35
- package/dist/providers/imessage/index.js +6 -4
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.js +7 -7
- package/dist/providers/terminal/index.d.ts +256 -28
- package/dist/providers/terminal/index.js +3 -3
- package/dist/providers/whatsapp-business/index.d.ts +2 -16
- package/dist/providers/whatsapp-business/index.js +3 -3
- package/dist/types-lUyzRurY.d.ts +1029 -0
- package/package.json +1 -1
- package/dist/types-D0QSU6kb.d.ts +0 -490
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as AnyPlatformDef, B as Broadcaster,
|
|
1
|
+
import { C as ContentBuilder, U as User, M as Message, b as ContentInput, O as OutboundMessage, c as Content, d as ProviderMessage, E as EventProducer, e as CreateClientContext, f as Store, a as PlatformDef, P as Platform, g as PlatformProviderConfig, h as SpectrumLike, i as CustomEventStreams, j as Space, I as InboundMessage } from './types-lUyzRurY.js';
|
|
2
|
+
export { A as AnyPlatformDef, B as Broadcaster, k as InboundPlatformMessage, l as ManagedStream, m as PlatformInstance, n as PlatformMessage, o as PlatformRuntime, p as PlatformSpace, q as PlatformUser, S as SchemaMessage, r as broadcast, s as mergeStreams, t as stream } from './types-lUyzRurY.js';
|
|
3
3
|
import vCard from 'vcf';
|
|
4
4
|
import z__default from 'zod';
|
|
5
5
|
import 'hotscript';
|
|
@@ -121,6 +121,269 @@ declare function contact(input: string | ContactInput | vCard): ContentBuilder;
|
|
|
121
121
|
|
|
122
122
|
declare function custom(raw: unknown): ContentBuilder;
|
|
123
123
|
|
|
124
|
+
/**
|
|
125
|
+
* An `edit` rewrites the content of a previously-sent outbound message.
|
|
126
|
+
*
|
|
127
|
+
* `space.send(edit(newContent, message))` is the canonical outbound API;
|
|
128
|
+
* `message.edit(newContent)` and `space.edit(message, newContent)` are
|
|
129
|
+
* sugar that delegate here. Edits are fire-and-forget — providers handle
|
|
130
|
+
* them inside their `send` action and the resolved value is `undefined`
|
|
131
|
+
* (no new message id is produced; the existing message mutates in place).
|
|
132
|
+
*
|
|
133
|
+
* Edit cannot wrap `edit`, `reply`, `reaction`, `group`, or `typing`.
|
|
134
|
+
*/
|
|
135
|
+
declare const editSchema: z__default.ZodObject<{
|
|
136
|
+
type: z__default.ZodLiteral<"edit">;
|
|
137
|
+
content: z__default.ZodCustom<{
|
|
138
|
+
type: "contact";
|
|
139
|
+
user?: {
|
|
140
|
+
__platform: string;
|
|
141
|
+
id: string;
|
|
142
|
+
} | undefined;
|
|
143
|
+
name?: {
|
|
144
|
+
formatted?: string | undefined;
|
|
145
|
+
first?: string | undefined;
|
|
146
|
+
last?: string | undefined;
|
|
147
|
+
middle?: string | undefined;
|
|
148
|
+
prefix?: string | undefined;
|
|
149
|
+
suffix?: string | undefined;
|
|
150
|
+
} | undefined;
|
|
151
|
+
phones?: {
|
|
152
|
+
value: string;
|
|
153
|
+
type?: "mobile" | "home" | "work" | "other" | undefined;
|
|
154
|
+
}[] | undefined;
|
|
155
|
+
emails?: {
|
|
156
|
+
value: string;
|
|
157
|
+
type?: "home" | "work" | "other" | undefined;
|
|
158
|
+
}[] | undefined;
|
|
159
|
+
addresses?: {
|
|
160
|
+
street?: string | undefined;
|
|
161
|
+
city?: string | undefined;
|
|
162
|
+
region?: string | undefined;
|
|
163
|
+
postalCode?: string | undefined;
|
|
164
|
+
country?: string | undefined;
|
|
165
|
+
type?: "home" | "work" | "other" | undefined;
|
|
166
|
+
}[] | undefined;
|
|
167
|
+
org?: {
|
|
168
|
+
name?: string | undefined;
|
|
169
|
+
title?: string | undefined;
|
|
170
|
+
department?: string | undefined;
|
|
171
|
+
} | undefined;
|
|
172
|
+
urls?: string[] | undefined;
|
|
173
|
+
birthday?: string | undefined;
|
|
174
|
+
note?: string | undefined;
|
|
175
|
+
photo?: {
|
|
176
|
+
mimeType: string;
|
|
177
|
+
read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
178
|
+
} | undefined;
|
|
179
|
+
raw?: unknown;
|
|
180
|
+
} | {
|
|
181
|
+
type: "text";
|
|
182
|
+
text: string;
|
|
183
|
+
} | {
|
|
184
|
+
type: "attachment";
|
|
185
|
+
name: string;
|
|
186
|
+
mimeType: string;
|
|
187
|
+
read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
188
|
+
stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
189
|
+
size?: number | undefined;
|
|
190
|
+
} | {
|
|
191
|
+
type: "custom";
|
|
192
|
+
raw: unknown;
|
|
193
|
+
} | {
|
|
194
|
+
type: "voice";
|
|
195
|
+
mimeType: string;
|
|
196
|
+
read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
197
|
+
stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
198
|
+
name?: string | undefined;
|
|
199
|
+
duration?: number | undefined;
|
|
200
|
+
size?: number | undefined;
|
|
201
|
+
} | {
|
|
202
|
+
type: "richlink";
|
|
203
|
+
url: string;
|
|
204
|
+
title: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodString>>>;
|
|
205
|
+
summary: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodString>>>;
|
|
206
|
+
cover: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodObject<{
|
|
207
|
+
mimeType: z__default.ZodOptional<z__default.ZodString>;
|
|
208
|
+
read: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
209
|
+
stream: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
210
|
+
}, z__default.core.$strip>>>>;
|
|
211
|
+
} | {
|
|
212
|
+
type: "reaction";
|
|
213
|
+
emoji: string;
|
|
214
|
+
target: Message;
|
|
215
|
+
} | {
|
|
216
|
+
type: "group";
|
|
217
|
+
items: Message[];
|
|
218
|
+
} | {
|
|
219
|
+
type: "poll";
|
|
220
|
+
title: string;
|
|
221
|
+
options: {
|
|
222
|
+
title: string;
|
|
223
|
+
}[];
|
|
224
|
+
} | {
|
|
225
|
+
type: "poll_option";
|
|
226
|
+
option: {
|
|
227
|
+
title: string;
|
|
228
|
+
};
|
|
229
|
+
poll: {
|
|
230
|
+
type: "poll";
|
|
231
|
+
title: string;
|
|
232
|
+
options: {
|
|
233
|
+
title: string;
|
|
234
|
+
}[];
|
|
235
|
+
};
|
|
236
|
+
selected: boolean;
|
|
237
|
+
title: string;
|
|
238
|
+
} | {
|
|
239
|
+
type: "effect";
|
|
240
|
+
content: {
|
|
241
|
+
type: "text";
|
|
242
|
+
text: string;
|
|
243
|
+
} | {
|
|
244
|
+
type: "attachment";
|
|
245
|
+
name: string;
|
|
246
|
+
mimeType: string;
|
|
247
|
+
read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
248
|
+
stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
249
|
+
size?: number | undefined;
|
|
250
|
+
};
|
|
251
|
+
effect: string;
|
|
252
|
+
} | {
|
|
253
|
+
type: "typing";
|
|
254
|
+
state: "start" | "stop";
|
|
255
|
+
}, {
|
|
256
|
+
type: "contact";
|
|
257
|
+
user?: {
|
|
258
|
+
__platform: string;
|
|
259
|
+
id: string;
|
|
260
|
+
} | undefined;
|
|
261
|
+
name?: {
|
|
262
|
+
formatted?: string | undefined;
|
|
263
|
+
first?: string | undefined;
|
|
264
|
+
last?: string | undefined;
|
|
265
|
+
middle?: string | undefined;
|
|
266
|
+
prefix?: string | undefined;
|
|
267
|
+
suffix?: string | undefined;
|
|
268
|
+
} | undefined;
|
|
269
|
+
phones?: {
|
|
270
|
+
value: string;
|
|
271
|
+
type?: "mobile" | "home" | "work" | "other" | undefined;
|
|
272
|
+
}[] | undefined;
|
|
273
|
+
emails?: {
|
|
274
|
+
value: string;
|
|
275
|
+
type?: "home" | "work" | "other" | undefined;
|
|
276
|
+
}[] | undefined;
|
|
277
|
+
addresses?: {
|
|
278
|
+
street?: string | undefined;
|
|
279
|
+
city?: string | undefined;
|
|
280
|
+
region?: string | undefined;
|
|
281
|
+
postalCode?: string | undefined;
|
|
282
|
+
country?: string | undefined;
|
|
283
|
+
type?: "home" | "work" | "other" | undefined;
|
|
284
|
+
}[] | undefined;
|
|
285
|
+
org?: {
|
|
286
|
+
name?: string | undefined;
|
|
287
|
+
title?: string | undefined;
|
|
288
|
+
department?: string | undefined;
|
|
289
|
+
} | undefined;
|
|
290
|
+
urls?: string[] | undefined;
|
|
291
|
+
birthday?: string | undefined;
|
|
292
|
+
note?: string | undefined;
|
|
293
|
+
photo?: {
|
|
294
|
+
mimeType: string;
|
|
295
|
+
read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
296
|
+
} | undefined;
|
|
297
|
+
raw?: unknown;
|
|
298
|
+
} | {
|
|
299
|
+
type: "text";
|
|
300
|
+
text: string;
|
|
301
|
+
} | {
|
|
302
|
+
type: "attachment";
|
|
303
|
+
name: string;
|
|
304
|
+
mimeType: string;
|
|
305
|
+
read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
306
|
+
stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
307
|
+
size?: number | undefined;
|
|
308
|
+
} | {
|
|
309
|
+
type: "custom";
|
|
310
|
+
raw: unknown;
|
|
311
|
+
} | {
|
|
312
|
+
type: "voice";
|
|
313
|
+
mimeType: string;
|
|
314
|
+
read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
315
|
+
stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
316
|
+
name?: string | undefined;
|
|
317
|
+
duration?: number | undefined;
|
|
318
|
+
size?: number | undefined;
|
|
319
|
+
} | {
|
|
320
|
+
type: "richlink";
|
|
321
|
+
url: string;
|
|
322
|
+
title: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodString>>>;
|
|
323
|
+
summary: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodString>>>;
|
|
324
|
+
cover: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodObject<{
|
|
325
|
+
mimeType: z__default.ZodOptional<z__default.ZodString>;
|
|
326
|
+
read: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
327
|
+
stream: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
328
|
+
}, z__default.core.$strip>>>>;
|
|
329
|
+
} | {
|
|
330
|
+
type: "reaction";
|
|
331
|
+
emoji: string;
|
|
332
|
+
target: Message;
|
|
333
|
+
} | {
|
|
334
|
+
type: "group";
|
|
335
|
+
items: Message[];
|
|
336
|
+
} | {
|
|
337
|
+
type: "poll";
|
|
338
|
+
title: string;
|
|
339
|
+
options: {
|
|
340
|
+
title: string;
|
|
341
|
+
}[];
|
|
342
|
+
} | {
|
|
343
|
+
type: "poll_option";
|
|
344
|
+
option: {
|
|
345
|
+
title: string;
|
|
346
|
+
};
|
|
347
|
+
poll: {
|
|
348
|
+
type: "poll";
|
|
349
|
+
title: string;
|
|
350
|
+
options: {
|
|
351
|
+
title: string;
|
|
352
|
+
}[];
|
|
353
|
+
};
|
|
354
|
+
selected: boolean;
|
|
355
|
+
title: string;
|
|
356
|
+
} | {
|
|
357
|
+
type: "effect";
|
|
358
|
+
content: {
|
|
359
|
+
type: "text";
|
|
360
|
+
text: string;
|
|
361
|
+
} | {
|
|
362
|
+
type: "attachment";
|
|
363
|
+
name: string;
|
|
364
|
+
mimeType: string;
|
|
365
|
+
read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
366
|
+
stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
367
|
+
size?: number | undefined;
|
|
368
|
+
};
|
|
369
|
+
effect: string;
|
|
370
|
+
} | {
|
|
371
|
+
type: "typing";
|
|
372
|
+
state: "start" | "stop";
|
|
373
|
+
}>;
|
|
374
|
+
target: z__default.ZodCustom<Message, Message>;
|
|
375
|
+
}, z__default.core.$strip>;
|
|
376
|
+
type Edit = z__default.infer<typeof editSchema>;
|
|
377
|
+
/**
|
|
378
|
+
* Construct an `edit` content value rewriting `target`'s content.
|
|
379
|
+
*
|
|
380
|
+
* `target` is typed as `OutboundMessage` because only messages you sent can
|
|
381
|
+
* be edited; the schema field stays loose at `Message` (matching
|
|
382
|
+
* reply/reaction) so providers receive the same shape regardless of
|
|
383
|
+
* direction.
|
|
384
|
+
*/
|
|
385
|
+
declare function edit(content: ContentInput, target: OutboundMessage): ContentBuilder;
|
|
386
|
+
|
|
124
387
|
/**
|
|
125
388
|
* A `group` bundles multiple messages into one logical unit (e.g. an album
|
|
126
389
|
* of images sent together). Each item is a full `Message` — addressable by
|
|
@@ -190,6 +453,259 @@ type Reaction = z__default.infer<typeof reactionSchema>;
|
|
|
190
453
|
*/
|
|
191
454
|
declare function reaction(emoji: string, target: Message): ContentBuilder;
|
|
192
455
|
|
|
456
|
+
/**
|
|
457
|
+
* A `reply` wraps inner content with the message it replies to.
|
|
458
|
+
*
|
|
459
|
+
* `space.send(reply(content, message))` is the canonical outbound API;
|
|
460
|
+
* `message.reply(content)` is sugar that delegates here. Providers see
|
|
461
|
+
* `reply` like any other content type and route to a threaded send.
|
|
462
|
+
*
|
|
463
|
+
* Reply cannot wrap `reply`, `reaction`, or `group` content.
|
|
464
|
+
*/
|
|
465
|
+
declare const replySchema: z__default.ZodObject<{
|
|
466
|
+
type: z__default.ZodLiteral<"reply">;
|
|
467
|
+
content: z__default.ZodCustom<{
|
|
468
|
+
type: "contact";
|
|
469
|
+
user?: {
|
|
470
|
+
__platform: string;
|
|
471
|
+
id: string;
|
|
472
|
+
} | undefined;
|
|
473
|
+
name?: {
|
|
474
|
+
formatted?: string | undefined;
|
|
475
|
+
first?: string | undefined;
|
|
476
|
+
last?: string | undefined;
|
|
477
|
+
middle?: string | undefined;
|
|
478
|
+
prefix?: string | undefined;
|
|
479
|
+
suffix?: string | undefined;
|
|
480
|
+
} | undefined;
|
|
481
|
+
phones?: {
|
|
482
|
+
value: string;
|
|
483
|
+
type?: "mobile" | "home" | "work" | "other" | undefined;
|
|
484
|
+
}[] | undefined;
|
|
485
|
+
emails?: {
|
|
486
|
+
value: string;
|
|
487
|
+
type?: "home" | "work" | "other" | undefined;
|
|
488
|
+
}[] | undefined;
|
|
489
|
+
addresses?: {
|
|
490
|
+
street?: string | undefined;
|
|
491
|
+
city?: string | undefined;
|
|
492
|
+
region?: string | undefined;
|
|
493
|
+
postalCode?: string | undefined;
|
|
494
|
+
country?: string | undefined;
|
|
495
|
+
type?: "home" | "work" | "other" | undefined;
|
|
496
|
+
}[] | undefined;
|
|
497
|
+
org?: {
|
|
498
|
+
name?: string | undefined;
|
|
499
|
+
title?: string | undefined;
|
|
500
|
+
department?: string | undefined;
|
|
501
|
+
} | undefined;
|
|
502
|
+
urls?: string[] | undefined;
|
|
503
|
+
birthday?: string | undefined;
|
|
504
|
+
note?: string | undefined;
|
|
505
|
+
photo?: {
|
|
506
|
+
mimeType: string;
|
|
507
|
+
read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
508
|
+
} | undefined;
|
|
509
|
+
raw?: unknown;
|
|
510
|
+
} | {
|
|
511
|
+
type: "text";
|
|
512
|
+
text: string;
|
|
513
|
+
} | {
|
|
514
|
+
type: "attachment";
|
|
515
|
+
name: string;
|
|
516
|
+
mimeType: string;
|
|
517
|
+
read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
518
|
+
stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
519
|
+
size?: number | undefined;
|
|
520
|
+
} | {
|
|
521
|
+
type: "custom";
|
|
522
|
+
raw: unknown;
|
|
523
|
+
} | {
|
|
524
|
+
type: "voice";
|
|
525
|
+
mimeType: string;
|
|
526
|
+
read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
527
|
+
stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
528
|
+
name?: string | undefined;
|
|
529
|
+
duration?: number | undefined;
|
|
530
|
+
size?: number | undefined;
|
|
531
|
+
} | {
|
|
532
|
+
type: "richlink";
|
|
533
|
+
url: string;
|
|
534
|
+
title: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodString>>>;
|
|
535
|
+
summary: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodString>>>;
|
|
536
|
+
cover: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodObject<{
|
|
537
|
+
mimeType: z__default.ZodOptional<z__default.ZodString>;
|
|
538
|
+
read: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
539
|
+
stream: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
540
|
+
}, z__default.core.$strip>>>>;
|
|
541
|
+
} | {
|
|
542
|
+
type: "reaction";
|
|
543
|
+
emoji: string;
|
|
544
|
+
target: Message;
|
|
545
|
+
} | {
|
|
546
|
+
type: "group";
|
|
547
|
+
items: Message[];
|
|
548
|
+
} | {
|
|
549
|
+
type: "poll";
|
|
550
|
+
title: string;
|
|
551
|
+
options: {
|
|
552
|
+
title: string;
|
|
553
|
+
}[];
|
|
554
|
+
} | {
|
|
555
|
+
type: "poll_option";
|
|
556
|
+
option: {
|
|
557
|
+
title: string;
|
|
558
|
+
};
|
|
559
|
+
poll: {
|
|
560
|
+
type: "poll";
|
|
561
|
+
title: string;
|
|
562
|
+
options: {
|
|
563
|
+
title: string;
|
|
564
|
+
}[];
|
|
565
|
+
};
|
|
566
|
+
selected: boolean;
|
|
567
|
+
title: string;
|
|
568
|
+
} | {
|
|
569
|
+
type: "effect";
|
|
570
|
+
content: {
|
|
571
|
+
type: "text";
|
|
572
|
+
text: string;
|
|
573
|
+
} | {
|
|
574
|
+
type: "attachment";
|
|
575
|
+
name: string;
|
|
576
|
+
mimeType: string;
|
|
577
|
+
read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
578
|
+
stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
579
|
+
size?: number | undefined;
|
|
580
|
+
};
|
|
581
|
+
effect: string;
|
|
582
|
+
} | {
|
|
583
|
+
type: "typing";
|
|
584
|
+
state: "start" | "stop";
|
|
585
|
+
}, {
|
|
586
|
+
type: "contact";
|
|
587
|
+
user?: {
|
|
588
|
+
__platform: string;
|
|
589
|
+
id: string;
|
|
590
|
+
} | undefined;
|
|
591
|
+
name?: {
|
|
592
|
+
formatted?: string | undefined;
|
|
593
|
+
first?: string | undefined;
|
|
594
|
+
last?: string | undefined;
|
|
595
|
+
middle?: string | undefined;
|
|
596
|
+
prefix?: string | undefined;
|
|
597
|
+
suffix?: string | undefined;
|
|
598
|
+
} | undefined;
|
|
599
|
+
phones?: {
|
|
600
|
+
value: string;
|
|
601
|
+
type?: "mobile" | "home" | "work" | "other" | undefined;
|
|
602
|
+
}[] | undefined;
|
|
603
|
+
emails?: {
|
|
604
|
+
value: string;
|
|
605
|
+
type?: "home" | "work" | "other" | undefined;
|
|
606
|
+
}[] | undefined;
|
|
607
|
+
addresses?: {
|
|
608
|
+
street?: string | undefined;
|
|
609
|
+
city?: string | undefined;
|
|
610
|
+
region?: string | undefined;
|
|
611
|
+
postalCode?: string | undefined;
|
|
612
|
+
country?: string | undefined;
|
|
613
|
+
type?: "home" | "work" | "other" | undefined;
|
|
614
|
+
}[] | undefined;
|
|
615
|
+
org?: {
|
|
616
|
+
name?: string | undefined;
|
|
617
|
+
title?: string | undefined;
|
|
618
|
+
department?: string | undefined;
|
|
619
|
+
} | undefined;
|
|
620
|
+
urls?: string[] | undefined;
|
|
621
|
+
birthday?: string | undefined;
|
|
622
|
+
note?: string | undefined;
|
|
623
|
+
photo?: {
|
|
624
|
+
mimeType: string;
|
|
625
|
+
read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
626
|
+
} | undefined;
|
|
627
|
+
raw?: unknown;
|
|
628
|
+
} | {
|
|
629
|
+
type: "text";
|
|
630
|
+
text: string;
|
|
631
|
+
} | {
|
|
632
|
+
type: "attachment";
|
|
633
|
+
name: string;
|
|
634
|
+
mimeType: string;
|
|
635
|
+
read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
636
|
+
stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
637
|
+
size?: number | undefined;
|
|
638
|
+
} | {
|
|
639
|
+
type: "custom";
|
|
640
|
+
raw: unknown;
|
|
641
|
+
} | {
|
|
642
|
+
type: "voice";
|
|
643
|
+
mimeType: string;
|
|
644
|
+
read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
645
|
+
stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
646
|
+
name?: string | undefined;
|
|
647
|
+
duration?: number | undefined;
|
|
648
|
+
size?: number | undefined;
|
|
649
|
+
} | {
|
|
650
|
+
type: "richlink";
|
|
651
|
+
url: string;
|
|
652
|
+
title: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodString>>>;
|
|
653
|
+
summary: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodString>>>;
|
|
654
|
+
cover: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodObject<{
|
|
655
|
+
mimeType: z__default.ZodOptional<z__default.ZodString>;
|
|
656
|
+
read: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
657
|
+
stream: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
658
|
+
}, z__default.core.$strip>>>>;
|
|
659
|
+
} | {
|
|
660
|
+
type: "reaction";
|
|
661
|
+
emoji: string;
|
|
662
|
+
target: Message;
|
|
663
|
+
} | {
|
|
664
|
+
type: "group";
|
|
665
|
+
items: Message[];
|
|
666
|
+
} | {
|
|
667
|
+
type: "poll";
|
|
668
|
+
title: string;
|
|
669
|
+
options: {
|
|
670
|
+
title: string;
|
|
671
|
+
}[];
|
|
672
|
+
} | {
|
|
673
|
+
type: "poll_option";
|
|
674
|
+
option: {
|
|
675
|
+
title: string;
|
|
676
|
+
};
|
|
677
|
+
poll: {
|
|
678
|
+
type: "poll";
|
|
679
|
+
title: string;
|
|
680
|
+
options: {
|
|
681
|
+
title: string;
|
|
682
|
+
}[];
|
|
683
|
+
};
|
|
684
|
+
selected: boolean;
|
|
685
|
+
title: string;
|
|
686
|
+
} | {
|
|
687
|
+
type: "effect";
|
|
688
|
+
content: {
|
|
689
|
+
type: "text";
|
|
690
|
+
text: string;
|
|
691
|
+
} | {
|
|
692
|
+
type: "attachment";
|
|
693
|
+
name: string;
|
|
694
|
+
mimeType: string;
|
|
695
|
+
read: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
|
|
696
|
+
stream: z__default.core.$InferOuterFunctionType<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
|
|
697
|
+
size?: number | undefined;
|
|
698
|
+
};
|
|
699
|
+
effect: string;
|
|
700
|
+
} | {
|
|
701
|
+
type: "typing";
|
|
702
|
+
state: "start" | "stop";
|
|
703
|
+
}>;
|
|
704
|
+
target: z__default.ZodCustom<Message, Message>;
|
|
705
|
+
}, z__default.core.$strip>;
|
|
706
|
+
type Reply = z__default.infer<typeof replySchema>;
|
|
707
|
+
declare function reply(content: ContentInput, target: Message): ContentBuilder;
|
|
708
|
+
|
|
193
709
|
declare const resolveContents: (items: readonly ContentInput[]) => Promise<Content[]>;
|
|
194
710
|
|
|
195
711
|
declare const richlinkSchema: z__default.ZodObject<{
|
|
@@ -208,6 +724,33 @@ declare function richlink(url: string): ContentBuilder;
|
|
|
208
724
|
|
|
209
725
|
declare function text(text: string): ContentBuilder;
|
|
210
726
|
|
|
727
|
+
/**
|
|
728
|
+
* A `typing` content value carries a typing-indicator signal — either
|
|
729
|
+
* `"start"` or `"stop"`. Like `reaction`, it's fire-and-forget: providers
|
|
730
|
+
* dispatch on `content.type === "typing"` inside their `send()` action and
|
|
731
|
+
* `space.send(typing(...))` resolves to `undefined`.
|
|
732
|
+
*
|
|
733
|
+
* `space.startTyping()` / `space.stopTyping()` / `space.responding()` are
|
|
734
|
+
* sugar over `space.send(typing("start" | "stop"))`. Platforms that have no
|
|
735
|
+
* typing-indicator API (e.g. WhatsApp Business) silently no-op so the
|
|
736
|
+
* signal is best-effort everywhere.
|
|
737
|
+
*/
|
|
738
|
+
declare const typingSchema: z__default.ZodObject<{
|
|
739
|
+
type: z__default.ZodLiteral<"typing">;
|
|
740
|
+
state: z__default.ZodEnum<{
|
|
741
|
+
start: "start";
|
|
742
|
+
stop: "stop";
|
|
743
|
+
}>;
|
|
744
|
+
}, z__default.core.$strip>;
|
|
745
|
+
type Typing = z__default.infer<typeof typingSchema>;
|
|
746
|
+
/**
|
|
747
|
+
* Construct a `typing` content value. Defaults to `"start"`.
|
|
748
|
+
*
|
|
749
|
+
* `space.send(typing())` is equivalent to `space.startTyping()`;
|
|
750
|
+
* `space.send(typing("stop"))` is equivalent to `space.stopTyping()`.
|
|
751
|
+
*/
|
|
752
|
+
declare function typing(state?: "start" | "stop"): ContentBuilder;
|
|
753
|
+
|
|
211
754
|
declare const voiceSchema: z__default.ZodObject<{
|
|
212
755
|
type: z__default.ZodLiteral<"voice">;
|
|
213
756
|
name: z__default.ZodOptional<z__default.ZodString>;
|
|
@@ -2153,11 +2696,9 @@ declare function definePlatform<_Name extends string, _ConfigSchema extends z__d
|
|
|
2153
2696
|
id: string;
|
|
2154
2697
|
}, _ResolvedSpace extends {
|
|
2155
2698
|
id: string;
|
|
2156
|
-
}, _MessageSchema extends z__default.ZodType<object> | undefined = undefined, _MessageType extends ProviderMessage<_ResolvedUser, _ResolvedSpace, _MessageSchema extends z__default.ZodType<object> ? z__default.infer<_MessageSchema> : Record<never, never>> = ProviderMessage<_ResolvedUser, _ResolvedSpace, _MessageSchema extends z__default.ZodType<object> ? z__default.infer<_MessageSchema> : Record<never, never>>, _Events extends {
|
|
2157
|
-
messages
|
|
2158
|
-
} = {
|
|
2159
|
-
messages: EventProducer<_MessageType, _Client, z__default.infer<_ConfigSchema>>;
|
|
2160
|
-
}, _Static extends Record<string, unknown> = Record<never, never>>(name: _Name, def: {
|
|
2699
|
+
}, _MessageSchema extends z__default.ZodType<object> | undefined = undefined, _MessageType extends ProviderMessage<_ResolvedUser, _ResolvedSpace, _MessageSchema extends z__default.ZodType<object> ? z__default.infer<_MessageSchema> : Record<never, never>> = ProviderMessage<_ResolvedUser, _ResolvedSpace, _MessageSchema extends z__default.ZodType<object> ? z__default.infer<_MessageSchema> : Record<never, never>>, _Events extends (Record<string, EventProducer<unknown, _Client, z__default.infer<_ConfigSchema>>> & {
|
|
2700
|
+
messages?: never;
|
|
2701
|
+
}) | undefined = undefined, _Static extends Record<string, unknown> = Record<never, never>>(name: _Name, def: {
|
|
2161
2702
|
lifecycle: {
|
|
2162
2703
|
createClient: (ctx: CreateClientContext<_ConfigSchema>) => Promise<_Client>;
|
|
2163
2704
|
destroyClient?: (ctx: {
|
|
@@ -2272,4 +2813,4 @@ declare class UnsupportedError extends Error {
|
|
|
2272
2813
|
declare const fromVCard: (vcf: string) => ContactInput;
|
|
2273
2814
|
declare const toVCard: (contact: Contact) => Promise<string>;
|
|
2274
2815
|
|
|
2275
|
-
export { type CloudPlatform, type Contact, type ContactAddress, type ContactDetails, type ContactEmail, type ContactInput, type ContactName, type ContactOrg, type ContactPhone, Content, ContentBuilder, ContentInput, type DedicatedTokenData, Emoji, type EmojiKey, EventProducer, type Group, type ImessageInfoData, Message, Platform, PlatformDef, PlatformProviderConfig, type PlatformStatus, type PlatformsData, type Poll, type PollChoice, type PollChoiceInput, type PollOption, type Reaction, type Richlink, type SharedTokenData, Space, Spectrum, SpectrumCloudError, type SpectrumInstance, type SubscriptionData, type SubscriptionStatus, type TokenData, UnsupportedError, type UnsupportedKind, User, type Voice, attachment, cloud, contact, custom, definePlatform, fromVCard, group, option, poll, reaction, resolveContents, richlink, text, toVCard, voice };
|
|
2816
|
+
export { type CloudPlatform, type Contact, type ContactAddress, type ContactDetails, type ContactEmail, type ContactInput, type ContactName, type ContactOrg, type ContactPhone, Content, ContentBuilder, ContentInput, type DedicatedTokenData, type Edit, Emoji, type EmojiKey, EventProducer, type Group, type ImessageInfoData, Message, Platform, PlatformDef, PlatformProviderConfig, type PlatformStatus, type PlatformsData, type Poll, type PollChoice, type PollChoiceInput, type PollOption, type Reaction, type Reply, type Richlink, type SharedTokenData, Space, Spectrum, SpectrumCloudError, type SpectrumInstance, type SubscriptionData, type SubscriptionStatus, type TokenData, type Typing, UnsupportedError, type UnsupportedKind, User, type Voice, attachment, cloud, contact, custom, definePlatform, edit, fromVCard, group, option, poll, reaction, reply, resolveContents, richlink, text, toVCard, typing, voice };
|