@antiphony/shared 0.1.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.
- package/LICENSE +21 -0
- package/README.md +50 -0
- package/dist/cjs/api-codecs.cjs +971 -0
- package/dist/cjs/api-codecs.d.cts +542 -0
- package/dist/cjs/errors/index.cjs +56 -0
- package/dist/cjs/errors/index.d.cts +45 -0
- package/dist/cjs/index.cjs +1276 -0
- package/dist/cjs/index.d.cts +11 -0
- package/dist/cjs/nsid.cjs +37 -0
- package/dist/cjs/nsid.d.cts +42 -0
- package/dist/cjs/observability/index.cjs +58 -0
- package/dist/cjs/observability/index.d.cts +1 -0
- package/dist/cjs/observability/report-error.cjs +58 -0
- package/dist/cjs/observability/report-error.d.cts +48 -0
- package/dist/cjs/types/api.cjs +726 -0
- package/dist/cjs/types/api.d.cts +494 -0
- package/dist/cjs/types/audio.cjs +835 -0
- package/dist/cjs/types/audio.d.cts +1149 -0
- package/dist/cjs/types/blob.cjs +23 -0
- package/dist/cjs/types/blob.d.cts +45 -0
- package/dist/cjs/types/channels.cjs +170 -0
- package/dist/cjs/types/channels.d.cts +262 -0
- package/dist/cjs/types/records.cjs +407 -0
- package/dist/cjs/types/records.d.cts +840 -0
- package/dist/cjs/types/storage.cjs +414 -0
- package/dist/cjs/types/storage.d.cts +197 -0
- package/dist/cjs/types/views.cjs +820 -0
- package/dist/cjs/types/views.d.cts +9806 -0
- package/dist/cjs/utils/index.cjs +8 -0
- package/dist/cjs/utils/index.d.cts +7 -0
- package/dist/esm/api-codecs.d.ts +542 -0
- package/dist/esm/api-codecs.js +6 -0
- package/dist/esm/chunk-24KIXQZK.js +6 -0
- package/dist/esm/chunk-3WZJXJNU.js +378 -0
- package/dist/esm/chunk-5EHV73BA.js +20 -0
- package/dist/esm/chunk-72G3LBUQ.js +1 -0
- package/dist/esm/chunk-7LW2FHLD.js +48 -0
- package/dist/esm/chunk-7V44CPRR.js +132 -0
- package/dist/esm/chunk-BUNMR4ZO.js +127 -0
- package/dist/esm/chunk-EA4OONDV.js +380 -0
- package/dist/esm/chunk-F2CANZZ7.js +40 -0
- package/dist/esm/chunk-ORMEWXMH.js +33 -0
- package/dist/esm/chunk-TIZRJORN.js +24 -0
- package/dist/esm/chunk-XDBKR6LW.js +32 -0
- package/dist/esm/errors/index.d.ts +45 -0
- package/dist/esm/errors/index.js +2 -0
- package/dist/esm/index.d.ts +11 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/nsid.d.ts +42 -0
- package/dist/esm/nsid.js +2 -0
- package/dist/esm/observability/index.d.ts +1 -0
- package/dist/esm/observability/index.js +3 -0
- package/dist/esm/observability/report-error.d.ts +48 -0
- package/dist/esm/observability/report-error.js +2 -0
- package/dist/esm/types/api.d.ts +494 -0
- package/dist/esm/types/api.js +5 -0
- package/dist/esm/types/audio.d.ts +1149 -0
- package/dist/esm/types/audio.js +5 -0
- package/dist/esm/types/blob.d.ts +45 -0
- package/dist/esm/types/blob.js +2 -0
- package/dist/esm/types/channels.d.ts +262 -0
- package/dist/esm/types/channels.js +162 -0
- package/dist/esm/types/records.d.ts +840 -0
- package/dist/esm/types/records.js +3 -0
- package/dist/esm/types/storage.d.ts +197 -0
- package/dist/esm/types/storage.js +26 -0
- package/dist/esm/types/views.d.ts +9806 -0
- package/dist/esm/types/views.js +4 -0
- package/dist/esm/utils/index.d.ts +7 -0
- package/dist/esm/utils/index.js +2 -0
- package/package.json +82 -0
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Create-request codec for the new Antiphony `dev.antiphony.audio.post` model
|
|
5
|
+
* (Stream 1, additive — does not replace `CreatePromptRequestSchema`). The
|
|
6
|
+
* audio is uploaded first (signed-URL flow); the request references it as the
|
|
7
|
+
* embed. `reply` presence makes the new post a reply; absence makes it a
|
|
8
|
+
* prompt. `originAppId`/`authorId`/`kind` are stamped server-side, not sent.
|
|
9
|
+
*/
|
|
10
|
+
declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
11
|
+
/** User-authored text; may be empty for pure-audio posts. */
|
|
12
|
+
text: z.ZodDefault<z.ZodString>;
|
|
13
|
+
/** Optional headline (prompt feature). */
|
|
14
|
+
title: z.ZodOptional<z.ZodString>;
|
|
15
|
+
/** The uploaded audio attachment. */
|
|
16
|
+
embed: z.ZodOptional<z.ZodObject<{
|
|
17
|
+
$type: z.ZodLiteral<"dev.antiphony.embed.audio">;
|
|
18
|
+
audio: z.ZodObject<{
|
|
19
|
+
$type: z.ZodLiteral<"blob">;
|
|
20
|
+
ref: z.ZodString;
|
|
21
|
+
mimeType: z.ZodString;
|
|
22
|
+
size: z.ZodNumber;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
$type: "blob";
|
|
25
|
+
ref: string;
|
|
26
|
+
mimeType: string;
|
|
27
|
+
size: number;
|
|
28
|
+
}, {
|
|
29
|
+
$type: "blob";
|
|
30
|
+
ref: string;
|
|
31
|
+
mimeType: string;
|
|
32
|
+
size: number;
|
|
33
|
+
}>;
|
|
34
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
36
|
+
waveform: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
$type: "dev.antiphony.embed.audio";
|
|
39
|
+
audio: {
|
|
40
|
+
$type: "blob";
|
|
41
|
+
ref: string;
|
|
42
|
+
mimeType: string;
|
|
43
|
+
size: number;
|
|
44
|
+
};
|
|
45
|
+
durationMs?: number | undefined;
|
|
46
|
+
alt?: string | undefined;
|
|
47
|
+
waveform?: number[] | undefined;
|
|
48
|
+
}, {
|
|
49
|
+
$type: "dev.antiphony.embed.audio";
|
|
50
|
+
audio: {
|
|
51
|
+
$type: "blob";
|
|
52
|
+
ref: string;
|
|
53
|
+
mimeType: string;
|
|
54
|
+
size: number;
|
|
55
|
+
};
|
|
56
|
+
durationMs?: number | undefined;
|
|
57
|
+
alt?: string | undefined;
|
|
58
|
+
waveform?: number[] | undefined;
|
|
59
|
+
}>>;
|
|
60
|
+
/** Present ⇒ this is a reply (StrongRef root + parent). */
|
|
61
|
+
reply: z.ZodOptional<z.ZodObject<{
|
|
62
|
+
root: z.ZodObject<{
|
|
63
|
+
uri: z.ZodString;
|
|
64
|
+
cid: z.ZodString;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
uri: string;
|
|
67
|
+
cid: string;
|
|
68
|
+
}, {
|
|
69
|
+
uri: string;
|
|
70
|
+
cid: string;
|
|
71
|
+
}>;
|
|
72
|
+
parent: z.ZodObject<{
|
|
73
|
+
uri: z.ZodString;
|
|
74
|
+
cid: z.ZodString;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
uri: string;
|
|
77
|
+
cid: string;
|
|
78
|
+
}, {
|
|
79
|
+
uri: string;
|
|
80
|
+
cid: string;
|
|
81
|
+
}>;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
root: {
|
|
84
|
+
uri: string;
|
|
85
|
+
cid: string;
|
|
86
|
+
};
|
|
87
|
+
parent: {
|
|
88
|
+
uri: string;
|
|
89
|
+
cid: string;
|
|
90
|
+
};
|
|
91
|
+
}, {
|
|
92
|
+
root: {
|
|
93
|
+
uri: string;
|
|
94
|
+
cid: string;
|
|
95
|
+
};
|
|
96
|
+
parent: {
|
|
97
|
+
uri: string;
|
|
98
|
+
cid: string;
|
|
99
|
+
};
|
|
100
|
+
}>>;
|
|
101
|
+
/** BCP-47 language tags. */
|
|
102
|
+
langs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
103
|
+
/** Author self-label values (content warnings). */
|
|
104
|
+
selfLabels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
text: string;
|
|
107
|
+
title?: string | undefined;
|
|
108
|
+
reply?: {
|
|
109
|
+
root: {
|
|
110
|
+
uri: string;
|
|
111
|
+
cid: string;
|
|
112
|
+
};
|
|
113
|
+
parent: {
|
|
114
|
+
uri: string;
|
|
115
|
+
cid: string;
|
|
116
|
+
};
|
|
117
|
+
} | undefined;
|
|
118
|
+
embed?: {
|
|
119
|
+
$type: "dev.antiphony.embed.audio";
|
|
120
|
+
audio: {
|
|
121
|
+
$type: "blob";
|
|
122
|
+
ref: string;
|
|
123
|
+
mimeType: string;
|
|
124
|
+
size: number;
|
|
125
|
+
};
|
|
126
|
+
durationMs?: number | undefined;
|
|
127
|
+
alt?: string | undefined;
|
|
128
|
+
waveform?: number[] | undefined;
|
|
129
|
+
} | undefined;
|
|
130
|
+
langs?: string[] | undefined;
|
|
131
|
+
selfLabels?: string[] | undefined;
|
|
132
|
+
}, {
|
|
133
|
+
title?: string | undefined;
|
|
134
|
+
text?: string | undefined;
|
|
135
|
+
reply?: {
|
|
136
|
+
root: {
|
|
137
|
+
uri: string;
|
|
138
|
+
cid: string;
|
|
139
|
+
};
|
|
140
|
+
parent: {
|
|
141
|
+
uri: string;
|
|
142
|
+
cid: string;
|
|
143
|
+
};
|
|
144
|
+
} | undefined;
|
|
145
|
+
embed?: {
|
|
146
|
+
$type: "dev.antiphony.embed.audio";
|
|
147
|
+
audio: {
|
|
148
|
+
$type: "blob";
|
|
149
|
+
ref: string;
|
|
150
|
+
mimeType: string;
|
|
151
|
+
size: number;
|
|
152
|
+
};
|
|
153
|
+
durationMs?: number | undefined;
|
|
154
|
+
alt?: string | undefined;
|
|
155
|
+
waveform?: number[] | undefined;
|
|
156
|
+
} | undefined;
|
|
157
|
+
langs?: string[] | undefined;
|
|
158
|
+
selfLabels?: string[] | undefined;
|
|
159
|
+
}>, {
|
|
160
|
+
text: string;
|
|
161
|
+
title?: string | undefined;
|
|
162
|
+
reply?: {
|
|
163
|
+
root: {
|
|
164
|
+
uri: string;
|
|
165
|
+
cid: string;
|
|
166
|
+
};
|
|
167
|
+
parent: {
|
|
168
|
+
uri: string;
|
|
169
|
+
cid: string;
|
|
170
|
+
};
|
|
171
|
+
} | undefined;
|
|
172
|
+
embed?: {
|
|
173
|
+
$type: "dev.antiphony.embed.audio";
|
|
174
|
+
audio: {
|
|
175
|
+
$type: "blob";
|
|
176
|
+
ref: string;
|
|
177
|
+
mimeType: string;
|
|
178
|
+
size: number;
|
|
179
|
+
};
|
|
180
|
+
durationMs?: number | undefined;
|
|
181
|
+
alt?: string | undefined;
|
|
182
|
+
waveform?: number[] | undefined;
|
|
183
|
+
} | undefined;
|
|
184
|
+
langs?: string[] | undefined;
|
|
185
|
+
selfLabels?: string[] | undefined;
|
|
186
|
+
}, {
|
|
187
|
+
title?: string | undefined;
|
|
188
|
+
text?: string | undefined;
|
|
189
|
+
reply?: {
|
|
190
|
+
root: {
|
|
191
|
+
uri: string;
|
|
192
|
+
cid: string;
|
|
193
|
+
};
|
|
194
|
+
parent: {
|
|
195
|
+
uri: string;
|
|
196
|
+
cid: string;
|
|
197
|
+
};
|
|
198
|
+
} | undefined;
|
|
199
|
+
embed?: {
|
|
200
|
+
$type: "dev.antiphony.embed.audio";
|
|
201
|
+
audio: {
|
|
202
|
+
$type: "blob";
|
|
203
|
+
ref: string;
|
|
204
|
+
mimeType: string;
|
|
205
|
+
size: number;
|
|
206
|
+
};
|
|
207
|
+
durationMs?: number | undefined;
|
|
208
|
+
alt?: string | undefined;
|
|
209
|
+
waveform?: number[] | undefined;
|
|
210
|
+
} | undefined;
|
|
211
|
+
langs?: string[] | undefined;
|
|
212
|
+
selfLabels?: string[] | undefined;
|
|
213
|
+
}>, {
|
|
214
|
+
text: string;
|
|
215
|
+
title?: string | undefined;
|
|
216
|
+
reply?: {
|
|
217
|
+
root: {
|
|
218
|
+
uri: string;
|
|
219
|
+
cid: string;
|
|
220
|
+
};
|
|
221
|
+
parent: {
|
|
222
|
+
uri: string;
|
|
223
|
+
cid: string;
|
|
224
|
+
};
|
|
225
|
+
} | undefined;
|
|
226
|
+
embed?: {
|
|
227
|
+
$type: "dev.antiphony.embed.audio";
|
|
228
|
+
audio: {
|
|
229
|
+
$type: "blob";
|
|
230
|
+
ref: string;
|
|
231
|
+
mimeType: string;
|
|
232
|
+
size: number;
|
|
233
|
+
};
|
|
234
|
+
durationMs?: number | undefined;
|
|
235
|
+
alt?: string | undefined;
|
|
236
|
+
waveform?: number[] | undefined;
|
|
237
|
+
} | undefined;
|
|
238
|
+
langs?: string[] | undefined;
|
|
239
|
+
selfLabels?: string[] | undefined;
|
|
240
|
+
}, {
|
|
241
|
+
title?: string | undefined;
|
|
242
|
+
text?: string | undefined;
|
|
243
|
+
reply?: {
|
|
244
|
+
root: {
|
|
245
|
+
uri: string;
|
|
246
|
+
cid: string;
|
|
247
|
+
};
|
|
248
|
+
parent: {
|
|
249
|
+
uri: string;
|
|
250
|
+
cid: string;
|
|
251
|
+
};
|
|
252
|
+
} | undefined;
|
|
253
|
+
embed?: {
|
|
254
|
+
$type: "dev.antiphony.embed.audio";
|
|
255
|
+
audio: {
|
|
256
|
+
$type: "blob";
|
|
257
|
+
ref: string;
|
|
258
|
+
mimeType: string;
|
|
259
|
+
size: number;
|
|
260
|
+
};
|
|
261
|
+
durationMs?: number | undefined;
|
|
262
|
+
alt?: string | undefined;
|
|
263
|
+
waveform?: number[] | undefined;
|
|
264
|
+
} | undefined;
|
|
265
|
+
langs?: string[] | undefined;
|
|
266
|
+
selfLabels?: string[] | undefined;
|
|
267
|
+
}>;
|
|
268
|
+
type CreateAudioPostRequest = z.infer<typeof CreateAudioPostRequestSchema>;
|
|
269
|
+
declare const CreatePromptRequestSchema: z.ZodObject<{
|
|
270
|
+
title: z.ZodString;
|
|
271
|
+
description: z.ZodOptional<z.ZodString>;
|
|
272
|
+
audioUrl: z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>;
|
|
273
|
+
setAsGreeting: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodString, boolean, string>]>>;
|
|
274
|
+
/** Explicit org context override (normally inferred from auth.currentOrg) */
|
|
275
|
+
orgId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
276
|
+
}, "strip", z.ZodTypeAny, {
|
|
277
|
+
title: string;
|
|
278
|
+
audioUrl: string;
|
|
279
|
+
orgId?: string | null | undefined;
|
|
280
|
+
description?: string | undefined;
|
|
281
|
+
setAsGreeting?: boolean | undefined;
|
|
282
|
+
}, {
|
|
283
|
+
title: string;
|
|
284
|
+
audioUrl: string;
|
|
285
|
+
orgId?: string | null | undefined;
|
|
286
|
+
description?: string | undefined;
|
|
287
|
+
setAsGreeting?: string | boolean | undefined;
|
|
288
|
+
}>;
|
|
289
|
+
declare const UpdateProfileRequestSchema: z.ZodObject<{
|
|
290
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
291
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
292
|
+
bio: z.ZodOptional<z.ZodString>;
|
|
293
|
+
avatarUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
294
|
+
usageIntent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
295
|
+
/**
|
|
296
|
+
* Personal website surfaced on the public profile. Accepts a URL, empty
|
|
297
|
+
* string, or null from the client; normalizes empty string → null so the
|
|
298
|
+
* value stored on `UserRecord` (which requires `.url() | null`) round-trips
|
|
299
|
+
* cleanly through `UserRecordSchema.parse` on subsequent reads.
|
|
300
|
+
*/
|
|
301
|
+
website: z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<"">, z.ZodNull]>>, string | null | undefined, string | null | undefined>;
|
|
302
|
+
/** Up to 5 public links (label + URL) shown under the bio. */
|
|
303
|
+
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
304
|
+
label: z.ZodString;
|
|
305
|
+
url: z.ZodString;
|
|
306
|
+
}, "strip", z.ZodTypeAny, {
|
|
307
|
+
label: string;
|
|
308
|
+
url: string;
|
|
309
|
+
}, {
|
|
310
|
+
label: string;
|
|
311
|
+
url: string;
|
|
312
|
+
}>, "many">>;
|
|
313
|
+
/** When true, surfaces the linked Bluesky identity on the public profile. */
|
|
314
|
+
showBlueskyPublicly: z.ZodOptional<z.ZodBoolean>;
|
|
315
|
+
}, "strip", z.ZodTypeAny, {
|
|
316
|
+
handle?: string | undefined;
|
|
317
|
+
usageIntent?: string | null | undefined;
|
|
318
|
+
displayName?: string | undefined;
|
|
319
|
+
bio?: string | undefined;
|
|
320
|
+
avatarUrl?: string | null | undefined;
|
|
321
|
+
website?: string | null | undefined;
|
|
322
|
+
links?: {
|
|
323
|
+
label: string;
|
|
324
|
+
url: string;
|
|
325
|
+
}[] | undefined;
|
|
326
|
+
showBlueskyPublicly?: boolean | undefined;
|
|
327
|
+
}, {
|
|
328
|
+
handle?: string | undefined;
|
|
329
|
+
usageIntent?: string | null | undefined;
|
|
330
|
+
displayName?: string | undefined;
|
|
331
|
+
bio?: string | undefined;
|
|
332
|
+
avatarUrl?: string | null | undefined;
|
|
333
|
+
website?: string | null | undefined;
|
|
334
|
+
links?: {
|
|
335
|
+
label: string;
|
|
336
|
+
url: string;
|
|
337
|
+
}[] | undefined;
|
|
338
|
+
showBlueskyPublicly?: boolean | undefined;
|
|
339
|
+
}>;
|
|
340
|
+
declare const FcmTokenRequestSchema: z.ZodObject<{
|
|
341
|
+
token: z.ZodString;
|
|
342
|
+
}, "strip", z.ZodTypeAny, {
|
|
343
|
+
token: string;
|
|
344
|
+
}, {
|
|
345
|
+
token: string;
|
|
346
|
+
}>;
|
|
347
|
+
declare const BadgeResetRequestSchema: z.ZodObject<{
|
|
348
|
+
type: z.ZodEnum<["new_replier", "unread_reply"]>;
|
|
349
|
+
}, "strip", z.ZodTypeAny, {
|
|
350
|
+
type: "new_replier" | "unread_reply";
|
|
351
|
+
}, {
|
|
352
|
+
type: "new_replier" | "unread_reply";
|
|
353
|
+
}>;
|
|
354
|
+
declare const CreateOrgRequestSchema: z.ZodObject<{
|
|
355
|
+
name: z.ZodString;
|
|
356
|
+
slug: z.ZodString;
|
|
357
|
+
avatarUrl: z.ZodOptional<z.ZodString>;
|
|
358
|
+
rssFeedUrl: z.ZodOptional<z.ZodString>;
|
|
359
|
+
websiteUrl: z.ZodOptional<z.ZodString>;
|
|
360
|
+
description: z.ZodOptional<z.ZodString>;
|
|
361
|
+
}, "strip", z.ZodTypeAny, {
|
|
362
|
+
name: string;
|
|
363
|
+
slug: string;
|
|
364
|
+
avatarUrl?: string | undefined;
|
|
365
|
+
description?: string | undefined;
|
|
366
|
+
rssFeedUrl?: string | undefined;
|
|
367
|
+
websiteUrl?: string | undefined;
|
|
368
|
+
}, {
|
|
369
|
+
name: string;
|
|
370
|
+
slug: string;
|
|
371
|
+
avatarUrl?: string | undefined;
|
|
372
|
+
description?: string | undefined;
|
|
373
|
+
rssFeedUrl?: string | undefined;
|
|
374
|
+
websiteUrl?: string | undefined;
|
|
375
|
+
}>;
|
|
376
|
+
declare const UpdateOrgRequestSchema: z.ZodObject<{
|
|
377
|
+
name: z.ZodOptional<z.ZodString>;
|
|
378
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
379
|
+
description: z.ZodOptional<z.ZodString>;
|
|
380
|
+
avatarUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
381
|
+
rssFeedUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
382
|
+
websiteUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
383
|
+
billingEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
384
|
+
domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
385
|
+
}, "strip", z.ZodTypeAny, {
|
|
386
|
+
domain?: string | null | undefined;
|
|
387
|
+
avatarUrl?: string | null | undefined;
|
|
388
|
+
description?: string | undefined;
|
|
389
|
+
name?: string | undefined;
|
|
390
|
+
slug?: string | undefined;
|
|
391
|
+
rssFeedUrl?: string | null | undefined;
|
|
392
|
+
websiteUrl?: string | null | undefined;
|
|
393
|
+
billingEmail?: string | null | undefined;
|
|
394
|
+
}, {
|
|
395
|
+
domain?: string | null | undefined;
|
|
396
|
+
avatarUrl?: string | null | undefined;
|
|
397
|
+
description?: string | undefined;
|
|
398
|
+
name?: string | undefined;
|
|
399
|
+
slug?: string | undefined;
|
|
400
|
+
rssFeedUrl?: string | null | undefined;
|
|
401
|
+
websiteUrl?: string | null | undefined;
|
|
402
|
+
billingEmail?: string | null | undefined;
|
|
403
|
+
}>;
|
|
404
|
+
declare const CreateOrgInviteRequestSchema: z.ZodObject<{
|
|
405
|
+
email: z.ZodString;
|
|
406
|
+
role: z.ZodEnum<["admin", "member"]>;
|
|
407
|
+
}, "strip", z.ZodTypeAny, {
|
|
408
|
+
role: "admin" | "member";
|
|
409
|
+
email: string;
|
|
410
|
+
}, {
|
|
411
|
+
role: "admin" | "member";
|
|
412
|
+
email: string;
|
|
413
|
+
}>;
|
|
414
|
+
declare const UpdateMemberRoleRequestSchema: z.ZodObject<{
|
|
415
|
+
role: z.ZodEnum<["admin", "member"]>;
|
|
416
|
+
}, "strip", z.ZodTypeAny, {
|
|
417
|
+
role: "admin" | "member";
|
|
418
|
+
}, {
|
|
419
|
+
role: "admin" | "member";
|
|
420
|
+
}>;
|
|
421
|
+
declare const SwitchOrgRequestSchema: z.ZodObject<{
|
|
422
|
+
/** orgId to switch to, or null to switch to personal context */
|
|
423
|
+
orgId: z.ZodNullable<z.ZodString>;
|
|
424
|
+
}, "strip", z.ZodTypeAny, {
|
|
425
|
+
orgId: string | null;
|
|
426
|
+
}, {
|
|
427
|
+
orgId: string | null;
|
|
428
|
+
}>;
|
|
429
|
+
declare const ConnectorConfigInputSchema: z.ZodObject<Omit<{
|
|
430
|
+
connectorType: z.ZodEnum<["telephony"]>;
|
|
431
|
+
ownerId: z.ZodString;
|
|
432
|
+
settings: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
433
|
+
secretRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
434
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
435
|
+
status: z.ZodDefault<z.ZodObject<{
|
|
436
|
+
state: z.ZodDefault<z.ZodEnum<["unconfigured", "pending", "active", "error", "disabled"]>>;
|
|
437
|
+
detail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
438
|
+
data: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
439
|
+
updatedAt: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>>;
|
|
440
|
+
}, "strip", z.ZodTypeAny, {
|
|
441
|
+
state: "active" | "pending" | "error" | "unconfigured" | "disabled";
|
|
442
|
+
updatedAt?: Date | undefined;
|
|
443
|
+
detail?: string | null | undefined;
|
|
444
|
+
data?: Record<string, unknown> | null | undefined;
|
|
445
|
+
}, {
|
|
446
|
+
updatedAt?: unknown;
|
|
447
|
+
state?: "active" | "pending" | "error" | "unconfigured" | "disabled" | undefined;
|
|
448
|
+
detail?: string | null | undefined;
|
|
449
|
+
data?: Record<string, unknown> | null | undefined;
|
|
450
|
+
}>>;
|
|
451
|
+
createdAt: z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>;
|
|
452
|
+
updatedAt: z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>;
|
|
453
|
+
}, "status" | "createdAt" | "updatedAt" | "connectorType" | "ownerId">, "strip", z.ZodTypeAny, {
|
|
454
|
+
enabled: boolean;
|
|
455
|
+
settings: Record<string, unknown>;
|
|
456
|
+
secretRef?: string | null | undefined;
|
|
457
|
+
}, {
|
|
458
|
+
enabled?: boolean | undefined;
|
|
459
|
+
settings?: Record<string, unknown> | undefined;
|
|
460
|
+
secretRef?: string | null | undefined;
|
|
461
|
+
}>;
|
|
462
|
+
declare const ConnectorConfigUpdateSchema: z.ZodObject<{
|
|
463
|
+
enabled: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
464
|
+
settings: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
465
|
+
secretRef: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
466
|
+
}, "strip", z.ZodTypeAny, {
|
|
467
|
+
enabled?: boolean | undefined;
|
|
468
|
+
settings?: Record<string, unknown> | undefined;
|
|
469
|
+
secretRef?: string | null | undefined;
|
|
470
|
+
}, {
|
|
471
|
+
enabled?: boolean | undefined;
|
|
472
|
+
settings?: Record<string, unknown> | undefined;
|
|
473
|
+
secretRef?: string | null | undefined;
|
|
474
|
+
}>;
|
|
475
|
+
declare const PersonNotesUpdateSchema: z.ZodObject<{
|
|
476
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
477
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
478
|
+
}, "strip", z.ZodTypeAny, {
|
|
479
|
+
notes?: string | undefined;
|
|
480
|
+
tags?: string[] | undefined;
|
|
481
|
+
}, {
|
|
482
|
+
notes?: string | undefined;
|
|
483
|
+
tags?: string[] | undefined;
|
|
484
|
+
}>;
|
|
485
|
+
declare const PersonMergeRequestSchema: z.ZodObject<{
|
|
486
|
+
alternateUid: z.ZodString;
|
|
487
|
+
}, "strip", z.ZodTypeAny, {
|
|
488
|
+
alternateUid: string;
|
|
489
|
+
}, {
|
|
490
|
+
alternateUid: string;
|
|
491
|
+
}>;
|
|
492
|
+
declare const ScreeningRuleInputSchema: z.ZodObject<{
|
|
493
|
+
e164: z.ZodString;
|
|
494
|
+
label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
495
|
+
action: z.ZodEnum<["allow", "screen"]>;
|
|
496
|
+
expiresAt: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>>, string | number | null | undefined, string | number | null | undefined>;
|
|
497
|
+
}, "strip", z.ZodTypeAny, {
|
|
498
|
+
e164: string;
|
|
499
|
+
action: "allow" | "screen";
|
|
500
|
+
label?: string | null | undefined;
|
|
501
|
+
expiresAt?: string | number | null | undefined;
|
|
502
|
+
}, {
|
|
503
|
+
e164: string;
|
|
504
|
+
action: "allow" | "screen";
|
|
505
|
+
label?: string | null | undefined;
|
|
506
|
+
expiresAt?: string | number | null | undefined;
|
|
507
|
+
}>;
|
|
508
|
+
declare const ScreeningRuleUpdateSchema: z.ZodObject<{
|
|
509
|
+
e164: z.ZodOptional<z.ZodString>;
|
|
510
|
+
label: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
511
|
+
action: z.ZodOptional<z.ZodEnum<["allow", "screen"]>>;
|
|
512
|
+
expiresAt: z.ZodOptional<z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>>, string | number | null | undefined, string | number | null | undefined>>;
|
|
513
|
+
}, "strip", z.ZodTypeAny, {
|
|
514
|
+
label?: string | null | undefined;
|
|
515
|
+
e164?: string | undefined;
|
|
516
|
+
action?: "allow" | "screen" | undefined;
|
|
517
|
+
expiresAt?: string | number | null | undefined;
|
|
518
|
+
}, {
|
|
519
|
+
label?: string | null | undefined;
|
|
520
|
+
e164?: string | undefined;
|
|
521
|
+
action?: "allow" | "screen" | undefined;
|
|
522
|
+
expiresAt?: string | number | null | undefined;
|
|
523
|
+
}>;
|
|
524
|
+
declare const UpdateReplyStatusRequestSchema: z.ZodObject<{
|
|
525
|
+
status: z.ZodEnum<["live", "archived", "deleted"]>;
|
|
526
|
+
}, "strip", z.ZodTypeAny, {
|
|
527
|
+
status: "live" | "archived" | "deleted";
|
|
528
|
+
}, {
|
|
529
|
+
status: "live" | "archived" | "deleted";
|
|
530
|
+
}>;
|
|
531
|
+
declare const BulkReplyActionRequestSchema: z.ZodObject<{
|
|
532
|
+
replyIds: z.ZodArray<z.ZodString, "many">;
|
|
533
|
+
action: z.ZodEnum<["markRead", "archive", "delete", "restore"]>;
|
|
534
|
+
}, "strip", z.ZodTypeAny, {
|
|
535
|
+
action: "markRead" | "archive" | "delete" | "restore";
|
|
536
|
+
replyIds: string[];
|
|
537
|
+
}, {
|
|
538
|
+
action: "markRead" | "archive" | "delete" | "restore";
|
|
539
|
+
replyIds: string[];
|
|
540
|
+
}>;
|
|
541
|
+
|
|
542
|
+
export { BadgeResetRequestSchema, BulkReplyActionRequestSchema, ConnectorConfigInputSchema, ConnectorConfigUpdateSchema, type CreateAudioPostRequest, CreateAudioPostRequestSchema, CreateOrgInviteRequestSchema, CreateOrgRequestSchema, CreatePromptRequestSchema, FcmTokenRequestSchema, PersonMergeRequestSchema, PersonNotesUpdateSchema, ScreeningRuleInputSchema, ScreeningRuleUpdateSchema, SwitchOrgRequestSchema, UpdateMemberRoleRequestSchema, UpdateOrgRequestSchema, UpdateProfileRequestSchema, UpdateReplyStatusRequestSchema };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// errors/index.ts
|
|
4
|
+
var ServiceError = class extends Error {
|
|
5
|
+
constructor(message, status, details, code) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "ServiceError";
|
|
8
|
+
this.status = status;
|
|
9
|
+
this.details = details;
|
|
10
|
+
this.code = code;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
var ValidationError = class extends ServiceError {
|
|
14
|
+
constructor(message, details) {
|
|
15
|
+
super(message, 400, details, "VALIDATION_ERROR");
|
|
16
|
+
this.name = "ValidationError";
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var UnauthorizedError = class extends ServiceError {
|
|
20
|
+
constructor(message = "Unauthorized") {
|
|
21
|
+
super(message, 401, void 0, "UNAUTHORIZED");
|
|
22
|
+
this.name = "UnauthorizedError";
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
var ForbiddenError = class extends ServiceError {
|
|
26
|
+
constructor(message = "Forbidden") {
|
|
27
|
+
super(message, 403, void 0, "FORBIDDEN");
|
|
28
|
+
this.name = "ForbiddenError";
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var NotFoundError = class extends ServiceError {
|
|
32
|
+
constructor(message = "Resource not found") {
|
|
33
|
+
super(message, 404, void 0, "NOT_FOUND");
|
|
34
|
+
this.name = "NotFoundError";
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var ConflictError = class extends ServiceError {
|
|
38
|
+
constructor(message = "Conflict") {
|
|
39
|
+
super(message, 409, void 0, "CONFLICT");
|
|
40
|
+
this.name = "ConflictError";
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var RateLimitError = class extends ServiceError {
|
|
44
|
+
constructor(message = "Too many requests") {
|
|
45
|
+
super(message, 429, void 0, "RATE_LIMIT");
|
|
46
|
+
this.name = "RateLimitError";
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
exports.ConflictError = ConflictError;
|
|
51
|
+
exports.ForbiddenError = ForbiddenError;
|
|
52
|
+
exports.NotFoundError = NotFoundError;
|
|
53
|
+
exports.RateLimitError = RateLimitError;
|
|
54
|
+
exports.ServiceError = ServiceError;
|
|
55
|
+
exports.UnauthorizedError = UnauthorizedError;
|
|
56
|
+
exports.ValidationError = ValidationError;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed service errors for consistent error handling across the API layer.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* throw new NotFoundError('Prompt not found');
|
|
6
|
+
* throw new ConflictError('Handle is already taken');
|
|
7
|
+
*
|
|
8
|
+
* The `withErrorHandler` middleware catches these and maps `error.status`
|
|
9
|
+
* directly to the HTTP response status code.
|
|
10
|
+
*/
|
|
11
|
+
declare class ServiceError extends Error {
|
|
12
|
+
/** HTTP status code to return when this error reaches the API layer. */
|
|
13
|
+
readonly status: number;
|
|
14
|
+
/** Optional structured details (e.g., Zod issues). */
|
|
15
|
+
readonly details?: unknown;
|
|
16
|
+
/** Stable, machine-readable error identifier surfaced in the response envelope's `error.code`. */
|
|
17
|
+
readonly code?: string;
|
|
18
|
+
constructor(message: string, status: number, details?: unknown, code?: string);
|
|
19
|
+
}
|
|
20
|
+
/** 400 — Invalid input or Zod validation failure. */
|
|
21
|
+
declare class ValidationError extends ServiceError {
|
|
22
|
+
constructor(message: string, details?: unknown);
|
|
23
|
+
}
|
|
24
|
+
/** 401 — Missing or invalid authentication credentials. */
|
|
25
|
+
declare class UnauthorizedError extends ServiceError {
|
|
26
|
+
constructor(message?: string);
|
|
27
|
+
}
|
|
28
|
+
/** 403 — Authenticated but insufficient permissions. */
|
|
29
|
+
declare class ForbiddenError extends ServiceError {
|
|
30
|
+
constructor(message?: string);
|
|
31
|
+
}
|
|
32
|
+
/** 404 — Resource does not exist. */
|
|
33
|
+
declare class NotFoundError extends ServiceError {
|
|
34
|
+
constructor(message?: string);
|
|
35
|
+
}
|
|
36
|
+
/** 409 — Conflict with existing state (e.g., handle already taken). */
|
|
37
|
+
declare class ConflictError extends ServiceError {
|
|
38
|
+
constructor(message?: string);
|
|
39
|
+
}
|
|
40
|
+
/** 429 — Client has sent too many requests. */
|
|
41
|
+
declare class RateLimitError extends ServiceError {
|
|
42
|
+
constructor(message?: string);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { ConflictError, ForbiddenError, NotFoundError, RateLimitError, ServiceError, UnauthorizedError, ValidationError };
|