spectrum-ts 1.15.0 → 1.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/{photo-content-Deq7T2tO.d.ts → attachment-Bz66JIjW.d.ts} +10 -14
  2. package/dist/authoring-e7xyaumK.d.ts +269 -0
  3. package/dist/authoring.d.ts +6 -0
  4. package/dist/authoring.js +32 -0
  5. package/dist/{chunk-YFCDKZ6W.js → chunk-32H3VVUE.js} +48 -250
  6. package/dist/{chunk-2B76JFHX.js → chunk-5QSNQ6YN.js} +1 -1
  7. package/dist/{chunk-TSJKUFNE.js → chunk-6NGVREPQ.js} +6 -4
  8. package/dist/{chunk-YEQPATHB.js → chunk-753K5YPL.js} +7 -5
  9. package/dist/chunk-FTLJVVH7.js +259 -0
  10. package/dist/{chunk-JBMQ5GEW.js → chunk-LJM5D2T5.js} +1 -1
  11. package/dist/{chunk-BGV4SFVJ.js → chunk-PIULC4CM.js} +9 -7
  12. package/dist/{chunk-J2ANGYYW.js → chunk-RNGEA4UW.js} +1 -1
  13. package/dist/{chunk-VOAKCXBF.js → chunk-UFAZMTKC.js} +6 -4
  14. package/dist/{chunk-YKWKZ2PZ.js → chunk-VNMOZFWV.js} +128 -74
  15. package/dist/index.d.ts +167 -220
  16. package/dist/index.js +25872 -80
  17. package/dist/photo-content-BJKnqgN-.d.ts +13 -0
  18. package/dist/providers/imessage/index.d.ts +3 -2
  19. package/dist/providers/imessage/index.js +6 -5
  20. package/dist/providers/index.d.ts +3 -2
  21. package/dist/providers/index.js +10 -9
  22. package/dist/providers/slack/index.d.ts +1 -1
  23. package/dist/providers/slack/index.js +4 -3
  24. package/dist/providers/terminal/index.d.ts +26 -26
  25. package/dist/providers/terminal/index.js +5 -4
  26. package/dist/providers/whatsapp-business/index.d.ts +1 -1
  27. package/dist/providers/whatsapp-business/index.js +5 -4
  28. package/dist/{types-kk0L8kFG.d.ts → types-Dqv4Ffqg.d.ts} +11 -4
  29. package/package.json +8 -2
@@ -1,5 +1,5 @@
1
1
  import z__default from 'zod';
2
- import { C as ContentBuilder } from './types-kk0L8kFG.js';
2
+ import { C as ContentBuilder } from './types-Dqv4Ffqg.js';
3
3
 
4
4
  declare const attachmentSchema: z__default.ZodObject<{
5
5
  type: z__default.ZodLiteral<"attachment">;
@@ -12,22 +12,18 @@ declare const attachmentSchema: z__default.ZodObject<{
12
12
  }, z__default.core.$strip>;
13
13
  type Attachment = z__default.infer<typeof attachmentSchema>;
14
14
  type AttachmentInput = string | Buffer | URL;
15
+ declare const asAttachment: (input: {
16
+ id?: string;
17
+ name: string;
18
+ mimeType: string;
19
+ size?: number;
20
+ read: () => Promise<Buffer>;
21
+ stream?: () => Promise<ReadableStream<Uint8Array>>;
22
+ }) => Attachment;
15
23
  declare function attachment(input: AttachmentInput, options?: {
16
24
  id?: string;
17
25
  mimeType?: string;
18
26
  name?: string;
19
27
  }): ContentBuilder;
20
28
 
21
- /**
22
- * Shared building blocks for photo-style content (chat background, group
23
- * avatar/icon, …) whose builders all share the same `set | clear` shape and
24
- * the same `"clear"` reserved-string sentinel.
25
- *
26
- * Keeping the action schema and `buildPhotoAction` factory here means both
27
- * `background()` and `avatar()` parse against the same structural definition
28
- * and any DX fix (mime inference, read caching, sentinel docs) lands once.
29
- */
30
- declare const CLEAR_SENTINEL: "clear";
31
- type PhotoInput = typeof CLEAR_SENTINEL | string | Buffer | URL;
32
-
33
- export { type Attachment as A, type PhotoInput as P, type AttachmentInput as a, attachment as b };
29
+ export { type Attachment as A, type AttachmentInput as a, attachment as b, asAttachment as c };
@@ -0,0 +1,269 @@
1
+ import './attachment-Bz66JIjW.js';
2
+ import vCard from 'vcf';
3
+ import z__default from 'zod';
4
+ import { U as User, C as ContentBuilder, M as Message, b as Space, c as ContentInput } from './types-Dqv4Ffqg.js';
5
+
6
+ declare const nameSchema: z__default.ZodObject<{
7
+ formatted: z__default.ZodOptional<z__default.ZodString>;
8
+ first: z__default.ZodOptional<z__default.ZodString>;
9
+ last: z__default.ZodOptional<z__default.ZodString>;
10
+ middle: z__default.ZodOptional<z__default.ZodString>;
11
+ prefix: z__default.ZodOptional<z__default.ZodString>;
12
+ suffix: z__default.ZodOptional<z__default.ZodString>;
13
+ }, z__default.core.$strip>;
14
+ declare const phoneSchema: z__default.ZodObject<{
15
+ value: z__default.ZodString;
16
+ type: z__default.ZodOptional<z__default.ZodEnum<{
17
+ mobile: "mobile";
18
+ home: "home";
19
+ work: "work";
20
+ other: "other";
21
+ }>>;
22
+ }, z__default.core.$strip>;
23
+ declare const emailSchema: z__default.ZodObject<{
24
+ value: z__default.ZodString;
25
+ type: z__default.ZodOptional<z__default.ZodEnum<{
26
+ home: "home";
27
+ work: "work";
28
+ other: "other";
29
+ }>>;
30
+ }, z__default.core.$strip>;
31
+ declare const addressSchema: z__default.ZodObject<{
32
+ street: z__default.ZodOptional<z__default.ZodString>;
33
+ city: z__default.ZodOptional<z__default.ZodString>;
34
+ region: z__default.ZodOptional<z__default.ZodString>;
35
+ postalCode: z__default.ZodOptional<z__default.ZodString>;
36
+ country: z__default.ZodOptional<z__default.ZodString>;
37
+ type: z__default.ZodOptional<z__default.ZodEnum<{
38
+ home: "home";
39
+ work: "work";
40
+ other: "other";
41
+ }>>;
42
+ }, z__default.core.$strip>;
43
+ declare const orgSchema: z__default.ZodObject<{
44
+ name: z__default.ZodOptional<z__default.ZodString>;
45
+ title: z__default.ZodOptional<z__default.ZodString>;
46
+ department: z__default.ZodOptional<z__default.ZodString>;
47
+ }, z__default.core.$strip>;
48
+ declare const contactSchema: z__default.ZodObject<{
49
+ type: z__default.ZodLiteral<"contact">;
50
+ user: z__default.ZodOptional<z__default.ZodObject<{
51
+ __platform: z__default.ZodString;
52
+ id: z__default.ZodString;
53
+ }, z__default.core.$strip>>;
54
+ name: z__default.ZodOptional<z__default.ZodObject<{
55
+ formatted: z__default.ZodOptional<z__default.ZodString>;
56
+ first: z__default.ZodOptional<z__default.ZodString>;
57
+ last: z__default.ZodOptional<z__default.ZodString>;
58
+ middle: z__default.ZodOptional<z__default.ZodString>;
59
+ prefix: z__default.ZodOptional<z__default.ZodString>;
60
+ suffix: z__default.ZodOptional<z__default.ZodString>;
61
+ }, z__default.core.$strip>>;
62
+ phones: z__default.ZodOptional<z__default.ZodArray<z__default.ZodObject<{
63
+ value: z__default.ZodString;
64
+ type: z__default.ZodOptional<z__default.ZodEnum<{
65
+ mobile: "mobile";
66
+ home: "home";
67
+ work: "work";
68
+ other: "other";
69
+ }>>;
70
+ }, z__default.core.$strip>>>;
71
+ emails: z__default.ZodOptional<z__default.ZodArray<z__default.ZodObject<{
72
+ value: z__default.ZodString;
73
+ type: z__default.ZodOptional<z__default.ZodEnum<{
74
+ home: "home";
75
+ work: "work";
76
+ other: "other";
77
+ }>>;
78
+ }, z__default.core.$strip>>>;
79
+ addresses: z__default.ZodOptional<z__default.ZodArray<z__default.ZodObject<{
80
+ street: z__default.ZodOptional<z__default.ZodString>;
81
+ city: z__default.ZodOptional<z__default.ZodString>;
82
+ region: z__default.ZodOptional<z__default.ZodString>;
83
+ postalCode: z__default.ZodOptional<z__default.ZodString>;
84
+ country: z__default.ZodOptional<z__default.ZodString>;
85
+ type: z__default.ZodOptional<z__default.ZodEnum<{
86
+ home: "home";
87
+ work: "work";
88
+ other: "other";
89
+ }>>;
90
+ }, z__default.core.$strip>>>;
91
+ org: z__default.ZodOptional<z__default.ZodObject<{
92
+ name: z__default.ZodOptional<z__default.ZodString>;
93
+ title: z__default.ZodOptional<z__default.ZodString>;
94
+ department: z__default.ZodOptional<z__default.ZodString>;
95
+ }, z__default.core.$strip>>;
96
+ urls: z__default.ZodOptional<z__default.ZodArray<z__default.ZodString>>;
97
+ birthday: z__default.ZodOptional<z__default.ZodString>;
98
+ note: z__default.ZodOptional<z__default.ZodString>;
99
+ photo: z__default.ZodOptional<z__default.ZodObject<{
100
+ mimeType: z__default.ZodString;
101
+ read: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
102
+ }, z__default.core.$strip>>;
103
+ raw: z__default.ZodOptional<z__default.ZodUnknown>;
104
+ }, z__default.core.$strip>;
105
+ type Contact = z__default.infer<typeof contactSchema>;
106
+ type ContactName = z__default.infer<typeof nameSchema>;
107
+ type ContactPhone = z__default.infer<typeof phoneSchema>;
108
+ type ContactEmail = z__default.infer<typeof emailSchema>;
109
+ type ContactAddress = z__default.infer<typeof addressSchema>;
110
+ type ContactOrg = z__default.infer<typeof orgSchema>;
111
+ type ContactInput = Omit<Contact, "type">;
112
+ type ContactDetails = Omit<ContactInput, "user">;
113
+ declare const asContact: (input: ContactInput) => Contact;
114
+ declare function contact(user: User, details?: ContactDetails): ContentBuilder;
115
+ declare function contact(input: string | ContactInput | vCard): ContentBuilder;
116
+
117
+ declare const customSchema: z__default.ZodObject<{
118
+ type: z__default.ZodLiteral<"custom">;
119
+ raw: z__default.ZodUnknown;
120
+ }, z__default.core.$strip>;
121
+ declare const asCustom: (raw: unknown) => z__default.infer<typeof customSchema>;
122
+ declare function custom(raw: unknown): ContentBuilder;
123
+
124
+ /**
125
+ * A `group` bundles multiple messages into one logical unit (e.g. an album
126
+ * of images sent together). Each item is a full `Message` — addressable by
127
+ * id, reactable via `.react()`, replyable via `.reply()`.
128
+ *
129
+ * Groups do not nest, and reactions cannot be group members. Enforced by the
130
+ * `group()` builder; platforms may additionally reject unsupported item
131
+ * content types at send time.
132
+ */
133
+ declare const groupSchema: z__default.ZodObject<{
134
+ type: z__default.ZodLiteral<"group">;
135
+ items: z__default.ZodArray<z__default.ZodCustom<Message<string, User, Space<unknown>>, Message<string, User, Space<unknown>>>>;
136
+ }, z__default.core.$strip>;
137
+ type Group = z__default.infer<typeof groupSchema>;
138
+ declare const asGroup: (input: {
139
+ items: Message[];
140
+ }) => Group;
141
+ declare function group(...items: [ContentInput, ContentInput, ...ContentInput[]]): ContentBuilder;
142
+
143
+ declare const pollChoiceSchema: z__default.ZodObject<{
144
+ title: z__default.ZodString;
145
+ }, z__default.core.$strip>;
146
+ declare const pollSchema: z__default.ZodObject<{
147
+ type: z__default.ZodLiteral<"poll">;
148
+ title: z__default.ZodString;
149
+ options: z__default.ZodArray<z__default.ZodObject<{
150
+ title: z__default.ZodString;
151
+ }, z__default.core.$strip>>;
152
+ }, z__default.core.$strip>;
153
+ declare const pollOptionSchema: z__default.ZodObject<{
154
+ type: z__default.ZodLiteral<"poll_option">;
155
+ option: z__default.ZodObject<{
156
+ title: z__default.ZodString;
157
+ }, z__default.core.$strip>;
158
+ poll: z__default.ZodObject<{
159
+ type: z__default.ZodLiteral<"poll">;
160
+ title: z__default.ZodString;
161
+ options: z__default.ZodArray<z__default.ZodObject<{
162
+ title: z__default.ZodString;
163
+ }, z__default.core.$strip>>;
164
+ }, z__default.core.$strip>;
165
+ selected: z__default.ZodBoolean;
166
+ title: z__default.ZodString;
167
+ }, z__default.core.$strip>;
168
+ type Poll = z__default.infer<typeof pollSchema>;
169
+ type PollChoice = z__default.infer<typeof pollChoiceSchema>;
170
+ type PollOption = z__default.infer<typeof pollOptionSchema>;
171
+ type PollChoiceInput = string | {
172
+ title: string;
173
+ };
174
+ interface PollInput {
175
+ options: PollChoice[];
176
+ title: string;
177
+ }
178
+ declare const asPoll: (input: PollInput) => Poll;
179
+ declare const asPollOption: (input: {
180
+ option: PollChoice;
181
+ poll: Poll;
182
+ selected: boolean;
183
+ }) => PollOption;
184
+ declare const option: (title: string) => PollChoice;
185
+ declare function poll(title: string, options: PollChoiceInput[]): ContentBuilder;
186
+ declare function poll(title: string, ...options: PollChoiceInput[]): ContentBuilder;
187
+
188
+ declare const reactionSchema: z__default.ZodObject<{
189
+ type: z__default.ZodLiteral<"reaction">;
190
+ emoji: z__default.ZodString;
191
+ target: z__default.ZodCustom<Message<string, User, Space<unknown>>, Message<string, User, Space<unknown>>>;
192
+ }, z__default.core.$strip>;
193
+ type Reaction = z__default.infer<typeof reactionSchema>;
194
+ declare const asReaction: (input: {
195
+ emoji: string;
196
+ target: Message;
197
+ }) => Reaction;
198
+ /**
199
+ * Construct a `reaction` content value targeting the given message.
200
+ *
201
+ * `space.send(reaction(emoji, message))` is sugar for `message.react(emoji)`.
202
+ * Reactions are fire-and-forget — the returned `Message` will be `undefined`
203
+ * because platforms do not surface a message id for reactions.
204
+ *
205
+ * To react to a message known only by id, resolve it first via
206
+ * `space.getMessage(id)`.
207
+ */
208
+ declare function reaction(emoji: string, target: Message): ContentBuilder;
209
+
210
+ declare const richlinkSchema: z__default.ZodObject<{
211
+ type: z__default.ZodLiteral<"richlink">;
212
+ url: z__default.ZodURL;
213
+ title: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodString>>>;
214
+ summary: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodString>>>;
215
+ cover: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodOptional<z__default.ZodObject<{
216
+ mimeType: z__default.ZodOptional<z__default.ZodString>;
217
+ read: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
218
+ stream: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
219
+ }, z__default.core.$strip>>>>;
220
+ }, z__default.core.$strip>;
221
+ type Richlink = z__default.infer<typeof richlinkSchema>;
222
+ /**
223
+ * Construct a `richlink` content value.
224
+ *
225
+ * Accessors (`title`, `summary`, `cover`) are async and lazy: the first call
226
+ * issues a single network request to the URL; subsequent calls share the
227
+ * cached result. Network / parse failures resolve to `undefined` and are
228
+ * cached — no retries. Callers who only need `title` / `summary` never
229
+ * trigger an image download; calling `cover.read()` triggers one additional
230
+ * request to fetch the image bytes.
231
+ */
232
+ declare const asRichlink: (input: {
233
+ url: string;
234
+ }) => Richlink;
235
+ declare function richlink(url: string): ContentBuilder;
236
+
237
+ declare const textSchema: z__default.ZodObject<{
238
+ type: z__default.ZodLiteral<"text">;
239
+ text: z__default.ZodString;
240
+ }, z__default.core.$strip>;
241
+ declare const asText: (text: string) => z__default.infer<typeof textSchema>;
242
+ declare function text(text: string): ContentBuilder;
243
+
244
+ declare const voiceSchema: z__default.ZodObject<{
245
+ type: z__default.ZodLiteral<"voice">;
246
+ name: z__default.ZodOptional<z__default.ZodString>;
247
+ mimeType: z__default.ZodString;
248
+ duration: z__default.ZodOptional<z__default.ZodNumber>;
249
+ size: z__default.ZodOptional<z__default.ZodNumber>;
250
+ read: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>>>;
251
+ stream: z__default.ZodFunction<z__default.ZodTuple<readonly [], null>, z__default.ZodPromise<z__default.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>>>;
252
+ }, z__default.core.$strip>;
253
+ type Voice = z__default.infer<typeof voiceSchema>;
254
+ type VoiceInput = string | Buffer | URL;
255
+ declare const asVoice: (input: {
256
+ name?: string;
257
+ mimeType: string;
258
+ duration?: number;
259
+ size?: number;
260
+ read: () => Promise<Buffer>;
261
+ stream?: () => Promise<ReadableStream<Uint8Array>>;
262
+ }) => Voice;
263
+ declare function voice(input: VoiceInput, options?: {
264
+ mimeType?: string;
265
+ name?: string;
266
+ duration?: number;
267
+ }): ContentBuilder;
268
+
269
+ export { asRichlink as A, asText as B, type ContactInput as C, asVoice as D, type Group as G, type Poll as P, type Reaction as R, type Voice as V, type Contact as a, type ContactAddress as b, type ContactDetails as c, type ContactEmail as d, type ContactName as e, type ContactOrg as f, type ContactPhone as g, type PollChoice as h, type PollChoiceInput as i, type PollOption as j, type Richlink as k, contact as l, custom as m, group as n, option as o, poll as p, richlink as q, reaction as r, asContact as s, text as t, asCustom as u, voice as v, asGroup as w, asPoll as x, asPollOption as y, asReaction as z };
@@ -0,0 +1,6 @@
1
+ export { c as asAttachment } from './attachment-Bz66JIjW.js';
2
+ export { s as asContact, u as asCustom, w as asGroup, x as asPoll, y as asPollOption, z as asReaction, A as asRichlink, B as asText, D as asVoice } from './authoring-e7xyaumK.js';
3
+ export { f as ProviderMessageRecord } from './types-Dqv4Ffqg.js';
4
+ import 'zod';
5
+ import 'vcf';
6
+ import 'hotscript';
@@ -0,0 +1,32 @@
1
+ import {
2
+ asGroup,
3
+ asRichlink
4
+ } from "./chunk-LJM5D2T5.js";
5
+ import {
6
+ asVoice
7
+ } from "./chunk-5QSNQ6YN.js";
8
+ import {
9
+ asPoll,
10
+ asPollOption
11
+ } from "./chunk-KO67KDBD.js";
12
+ import {
13
+ asContact
14
+ } from "./chunk-RNGEA4UW.js";
15
+ import {
16
+ asAttachment,
17
+ asCustom,
18
+ asReaction,
19
+ asText
20
+ } from "./chunk-FTLJVVH7.js";
21
+ export {
22
+ asAttachment,
23
+ asContact,
24
+ asCustom,
25
+ asGroup,
26
+ asPoll,
27
+ asPollOption,
28
+ asReaction,
29
+ asRichlink,
30
+ asText,
31
+ asVoice
32
+ };