@antiphony/shared 0.1.0 → 0.3.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/dist/cjs/api-codecs.cjs +26 -650
- package/dist/cjs/api-codecs.d.cts +15 -233
- package/dist/cjs/index.cjs +29 -761
- package/dist/cjs/index.d.cts +4 -4
- package/dist/cjs/nsid.cjs +3 -10
- package/dist/cjs/nsid.d.cts +1 -9
- package/dist/cjs/types/api.cjs +11 -571
- package/dist/cjs/types/api.d.cts +13 -265
- package/dist/cjs/types/audio.cjs +26 -547
- package/dist/cjs/types/audio.d.cts +93 -52
- package/dist/cjs/types/records.cjs +3 -328
- package/dist/cjs/types/records.d.cts +7 -729
- package/dist/cjs/types/views.cjs +8 -649
- package/dist/cjs/types/views.d.cts +43 -9123
- package/dist/esm/api-codecs.d.ts +46 -264
- package/dist/esm/api-codecs.js +5 -5
- package/dist/esm/{chunk-ORMEWXMH.js → chunk-5JBD5THX.js} +1 -16
- package/dist/esm/{chunk-XDBKR6LW.js → chunk-6LROFBKK.js} +3 -10
- package/dist/esm/{chunk-F2CANZZ7.js → chunk-BNNLHRH7.js} +1 -1
- package/dist/esm/{chunk-BUNMR4ZO.js → chunk-F7IHVM34.js} +20 -3
- package/dist/esm/chunk-FDM5FDN4.js +46 -0
- package/dist/esm/chunk-IHIBHQBJ.js +78 -0
- package/dist/esm/chunk-R6SBR3IG.js +97 -0
- package/dist/esm/chunk-Y6HNNRVD.js +12 -0
- package/dist/esm/errors/index.js +1 -1
- package/dist/esm/index.d.ts +4 -4
- package/dist/esm/index.js +8 -8
- package/dist/esm/nsid.d.ts +1 -9
- package/dist/esm/nsid.js +2 -2
- package/dist/esm/observability/index.js +2 -2
- package/dist/esm/observability/report-error.js +2 -2
- package/dist/esm/types/api.d.ts +15 -267
- package/dist/esm/types/api.js +4 -5
- package/dist/esm/types/audio.d.ts +170 -129
- package/dist/esm/types/audio.js +4 -4
- package/dist/esm/types/blob.js +1 -1
- package/dist/esm/types/records.d.ts +10 -732
- package/dist/esm/types/records.js +2 -3
- package/dist/esm/types/views.d.ts +51 -9131
- package/dist/esm/types/views.js +3 -4
- package/dist/esm/utils/index.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/types/channels.cjs +0 -170
- package/dist/cjs/types/channels.d.cts +0 -262
- package/dist/cjs/types/storage.cjs +0 -414
- package/dist/cjs/types/storage.d.cts +0 -197
- package/dist/esm/chunk-3WZJXJNU.js +0 -378
- package/dist/esm/chunk-7V44CPRR.js +0 -132
- package/dist/esm/chunk-EA4OONDV.js +0 -380
- package/dist/esm/chunk-TIZRJORN.js +0 -24
- package/dist/esm/types/channels.d.ts +0 -262
- package/dist/esm/types/channels.js +0 -162
- package/dist/esm/types/storage.d.ts +0 -197
- package/dist/esm/types/storage.js +0 -26
package/dist/cjs/api-codecs.cjs
CHANGED
|
@@ -13,8 +13,6 @@ var BlobRefSchema = zod.z.object({
|
|
|
13
13
|
/** Size of the blob in bytes */
|
|
14
14
|
size: zod.z.number()
|
|
15
15
|
});
|
|
16
|
-
|
|
17
|
-
// types/records.ts
|
|
18
16
|
function httpsUrl() {
|
|
19
17
|
return zod.z.string().trim().url().refine((u) => /^https?:\/\//i.test(u), {
|
|
20
18
|
message: "URL must use the http or https scheme"
|
|
@@ -57,11 +55,8 @@ zod.z.object({
|
|
|
57
55
|
handle: zod.z.string().min(3).max(20).regex(/^[a-zA-Z0-9_]+$/).nullable().optional(),
|
|
58
56
|
/** User stated intent (e.g. "Podcaster", "Listener") */
|
|
59
57
|
usageIntent: zod.z.string().nullable().optional(),
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
* Defaults to 'voxpop.com'.
|
|
63
|
-
*/
|
|
64
|
-
domain: zod.z.string().default("voxpop.com"),
|
|
58
|
+
/** Domain for federated handle support. */
|
|
59
|
+
domain: zod.z.string().default("antiphony.dev"),
|
|
65
60
|
/**
|
|
66
61
|
* Display Name (e.g. "Brad Thorson"). Nullable: Firestore stores `null`
|
|
67
62
|
* when the user clears this field via the settings form, and the schema
|
|
@@ -89,313 +84,14 @@ zod.z.object({
|
|
|
89
84
|
/** Account status. Deactivated accounts retain data but are excluded from lookups. */
|
|
90
85
|
status: zod.z.enum(["active", "deactivated"]).default("active"),
|
|
91
86
|
/** Timestamp when the account was deactivated (soft deleted) */
|
|
92
|
-
deactivatedAt: FirestoreTimestampSchema.optional()
|
|
93
|
-
/**
|
|
94
|
-
* Denormalized org memberships — { orgId: role } for fast lookup.
|
|
95
|
-
* Source of truth is organizations/{orgId}/members/{userId}.
|
|
96
|
-
* Kept in sync by Cloud Function trigger.
|
|
97
|
-
*/
|
|
98
|
-
orgMemberships: zod.z.record(zod.z.string(), zod.z.enum(["owner", "admin", "member"])).optional()
|
|
99
|
-
});
|
|
100
|
-
var PromptRecordSchema = zod.z.object({
|
|
101
|
-
/** Unique Prompt ID */
|
|
102
|
-
id: zod.z.string(),
|
|
103
|
-
/** ID of the User who created this prompt. Always a user ID, never an org ID. @see UserRecord */
|
|
104
|
-
authorId: zod.z.string(),
|
|
105
|
-
/** Organization context this prompt belongs to (null = personal/no org) */
|
|
106
|
-
orgId: zod.z.string().nullable().optional(),
|
|
107
|
-
/** The main text of the question/prompt */
|
|
108
|
-
title: zod.z.string().min(3),
|
|
109
|
-
/** Optional extra context */
|
|
110
|
-
description: zod.z.string().nullable().optional(),
|
|
111
|
-
/** User who created this prompt (differs from authorId when org-owned) */
|
|
112
|
-
createdBy: zod.z.string().optional(),
|
|
113
|
-
/** URL to the recorded audio file (GCS) */
|
|
114
|
-
audioUrl: zod.z.string().url().or(zod.z.literal("")),
|
|
115
|
-
/** AT Protocol blob reference (future replacement for audioUrl) */
|
|
116
|
-
audio: BlobRefSchema.optional(),
|
|
117
|
-
/**
|
|
118
|
-
* AT Protocol URI returned by the publisher after a successful
|
|
119
|
-
* `repo.putRecord` against the author's PDS — e.g.
|
|
120
|
-
* `at://did:plc:abc123/com.voxpop.audio.prompt/3kj4...`. Optional,
|
|
121
|
-
* no migration: existing rows leave it unset. Format-validated so
|
|
122
|
-
* malformed strings surface at the schema-parse boundary rather than
|
|
123
|
-
* being silently stored.
|
|
124
|
-
*/
|
|
125
|
-
atprotoUri: zod.z.string().regex(/^at:\/\/.+/).optional(),
|
|
126
|
-
/** Server timestamp of creation */
|
|
127
|
-
createdAt: FirestoreTimestampSchema,
|
|
128
|
-
/**
|
|
129
|
-
* Life-cycle status.
|
|
130
|
-
* - `live`: Visible and accepting replies.
|
|
131
|
-
* - `archived`: Visible but closed for new replies.
|
|
132
|
-
* - `deleted`: Soft deleted.
|
|
133
|
-
*/
|
|
134
|
-
status: zod.z.enum(["live", "archived", "deleted"]).default("live"),
|
|
135
|
-
/** AI Enrichment Fields */
|
|
136
|
-
aiStatus: zod.z.enum(["pending", "complete", "error"]).optional(),
|
|
137
|
-
aiError: zod.z.string().optional(),
|
|
138
|
-
aiSummary: zod.z.string().optional(),
|
|
139
|
-
aiLabels: zod.z.array(zod.z.string()).optional(),
|
|
140
|
-
transcription: zod.z.string().optional(),
|
|
141
|
-
/** Pre-computed waveform peaks (normalized 0–1) for instant audio visualization */
|
|
142
|
-
waveformPeaks: zod.z.array(zod.z.number()).optional(),
|
|
143
|
-
/** Social Share Video Fields */
|
|
144
|
-
socialVideoUrl: zod.z.string().url().optional(),
|
|
145
|
-
socialVideoStoragePath: zod.z.string().optional(),
|
|
146
|
-
socialVideoStatus: zod.z.enum(["pending", "complete", "error"]).optional(),
|
|
147
|
-
socialVideoError: zod.z.string().optional(),
|
|
148
|
-
/** The audio URL/path used to generate the current video (for cache invalidation) */
|
|
149
|
-
socialVideoSourceAudio: zod.z.string().optional()
|
|
150
|
-
});
|
|
151
|
-
var ReplyRecordSchema = zod.z.object({
|
|
152
|
-
/** Unique Reply ID */
|
|
153
|
-
id: zod.z.string(),
|
|
154
|
-
/** The Prompt being replied to. @see PromptRecord */
|
|
155
|
-
promptId: zod.z.string(),
|
|
156
|
-
/** The User who replied. @see UserRecord */
|
|
157
|
-
authorId: zod.z.string(),
|
|
158
|
-
/** URL to the recorded audio file (GCS) */
|
|
159
|
-
audioUrl: zod.z.string().url(),
|
|
160
|
-
/** AT Protocol blob reference (future replacement for audioUrl) */
|
|
161
|
-
audio: BlobRefSchema.optional(),
|
|
162
|
-
/** Server timestamp of creation */
|
|
163
|
-
createdAt: FirestoreTimestampSchema,
|
|
164
|
-
/**
|
|
165
|
-
* Life-cycle status.
|
|
166
|
-
* - `live`: Visible and accepting replies.
|
|
167
|
-
* - `archived`: Visible but closed for new replies.
|
|
168
|
-
* - `deleted`: Soft deleted.
|
|
169
|
-
*/
|
|
170
|
-
status: zod.z.enum(["live", "archived", "deleted"]).default("live"),
|
|
171
|
-
/**
|
|
172
|
-
* Pre-computed waveform peaks (normalized 0–1) for instant audio
|
|
173
|
-
* visualization. **Stays on canonical** (does NOT move to the
|
|
174
|
-
* enrichment doc) — produced by a plain ffmpeg pass at ingestion,
|
|
175
|
-
* not an AI step; a self-hoster without paid-tier AI still needs
|
|
176
|
-
* this on every reply for the audio player. See
|
|
177
|
-
* `specs/ai-enrichment-split.md` § 5.
|
|
178
|
-
*/
|
|
179
|
-
waveformPeaks: zod.z.array(zod.z.number()).optional(),
|
|
180
|
-
/**
|
|
181
|
-
* Duration of the audio in seconds, computed server-side from
|
|
182
|
-
* ffmpeg. **Stays on canonical** (same reasoning as `waveformPeaks`
|
|
183
|
-
* above — ingestion ffmpeg output, not an AI enrichment). See
|
|
184
|
-
* `specs/ai-enrichment-split.md` § 5.
|
|
185
|
-
*/
|
|
186
|
-
audioDurationSec: zod.z.number().optional()
|
|
187
|
-
});
|
|
188
|
-
zod.z.object({
|
|
189
|
-
id: zod.z.string(),
|
|
190
|
-
/** Private notes by the prompt author about this reply. */
|
|
191
|
-
notes: zod.z.string().optional(),
|
|
192
|
-
// === AI-enrichment fields (sole source of truth post Stage 4) ===
|
|
193
|
-
//
|
|
194
|
-
// These lifted off canonical in Stage 4 of `specs/ai-enrichment-split.md`.
|
|
195
|
-
// Writers (`functions/`) route AI updates here via the split-write
|
|
196
|
-
// helper in `functions/src/services/replyEnrichmentDualWrite.ts`;
|
|
197
|
-
// readers source them via the hydrator's enrichment branch (see
|
|
198
|
-
// `packages/core/services/hydration.ts`).
|
|
199
|
-
// --- AI core (Gemini-generated) ---
|
|
200
|
-
aiStatus: zod.z.enum(["pending", "complete", "error", "skipped_too_short"]).optional(),
|
|
201
|
-
aiError: zod.z.string().optional(),
|
|
202
|
-
aiSummary: zod.z.string().optional(),
|
|
203
|
-
aiLabels: zod.z.array(zod.z.string()).optional(),
|
|
204
|
-
transcription: zod.z.string().optional(),
|
|
205
|
-
sentiment: zod.z.enum(["Positive", "Negative", "Neutral"]).optional(),
|
|
206
|
-
/** Must match the widened enum in `ReplyRecordSchema.energyLevel`. */
|
|
207
|
-
energyLevel: zod.z.enum(["High", "Low", "Neutral"]).optional(),
|
|
208
|
-
engagementScore: zod.z.number().min(1).max(10).optional(),
|
|
209
|
-
// --- Voice isolation (ElevenLabs, paid tier) ---
|
|
210
|
-
/** Noise-reduced audio URL — replaces `audioUrl` for downstream players when present. PUBLIC. */
|
|
211
|
-
enhancedAudioUrl: zod.z.string().url().optional(),
|
|
212
|
-
/** Storage path companion to `enhancedAudioUrl` — private. */
|
|
213
|
-
enhancedStoragePath: zod.z.string().optional(),
|
|
214
|
-
// --- Social-share video (paid tier) ---
|
|
215
|
-
//
|
|
216
|
-
// All `socialVideo*` fields are creator-only. The URL points at the
|
|
217
|
-
// generated artifact (a video file the creator can download and post
|
|
218
|
-
// to social media); the reply detail page does NOT render it.
|
|
219
|
-
socialVideoUrl: zod.z.string().url().optional(),
|
|
220
|
-
socialVideoStoragePath: zod.z.string().optional(),
|
|
221
|
-
socialVideoStatus: zod.z.enum(["pending", "complete", "error"]).optional(),
|
|
222
|
-
socialVideoError: zod.z.string().optional(),
|
|
223
|
-
/** The audio URL/path used to generate the current video (for cache invalidation). */
|
|
224
|
-
socialVideoSourceAudio: zod.z.string().optional()
|
|
225
|
-
});
|
|
226
|
-
zod.z.object({
|
|
227
|
-
/** Composite key `${viewerUid}_${targetUid}`. */
|
|
228
|
-
id: zod.z.string(),
|
|
229
|
-
/** Per-viewer CRM notes about the target. */
|
|
230
|
-
notes: zod.z.string().optional(),
|
|
231
|
-
/** Per-viewer freeform tags about the target. */
|
|
232
|
-
tags: zod.z.array(zod.z.string()).optional(),
|
|
233
|
-
// === Identity-merge: alias set ===
|
|
234
|
-
//
|
|
235
|
-
// Other identifiers the viewer has declared to be the SAME person as
|
|
236
|
-
// this entry's `targetUid`. vCard/URI-aligned: each entry is a
|
|
237
|
-
// scheme-prefixed identifier, so one field generalizes across networks
|
|
238
|
-
// AND across the future contact-sync import (which carries phone/email):
|
|
239
|
-
// "uid:<firebaseUid>" | "did:plc:…" | "handle:bob.bsky.social"
|
|
240
|
-
// | "tel:+15551234567" | "mailto:x@example.com"
|
|
241
|
-
// Mirrors vCard 4.0's `UID` + `CLIENTPIDMAP`/`PID` source-tracking
|
|
242
|
-
// (RFC 6350) — the standard answer to "the same person from multiple
|
|
243
|
-
// sources". See `specs/people-lexicon-prior-art.md`. The People
|
|
244
|
-
// read-path collapses any replier whose "uid:<uid>" appears here into
|
|
245
|
-
// this primary entry. Empty until the merge feature is used.
|
|
246
|
-
aliases: zod.z.array(zod.z.string()).optional(),
|
|
247
|
-
lastUpdated: FirestoreTimestampSchema.optional()
|
|
248
|
-
});
|
|
249
|
-
zod.z.object({
|
|
250
|
-
sipUri: zod.z.string(),
|
|
251
|
-
sipUsername: zod.z.string(),
|
|
252
|
-
sipSecret: zod.z.string(),
|
|
253
|
-
provider: zod.z.enum(["twilio", "plivo", "internal"])
|
|
254
|
-
});
|
|
255
|
-
zod.z.object({
|
|
256
|
-
/** User's personal phone number (E.164) */
|
|
257
|
-
phoneNumber: zod.z.string(),
|
|
258
|
-
/** Line type from Twilio Lookup v2 */
|
|
259
|
-
lineType: zod.z.string().nullable(),
|
|
260
|
-
/** Carrier name from Twilio Lookup v2 */
|
|
261
|
-
carrier: zod.z.string().nullable(),
|
|
262
|
-
/** free = shared Twilio number (ForwardedFrom routing), paid = dedicated number */
|
|
263
|
-
tier: zod.z.enum(["free", "paid"]),
|
|
264
|
-
/** The VoxPop Twilio number calls forward to (E.164) */
|
|
265
|
-
voxpopNumber: zod.z.string(),
|
|
266
|
-
/** Twilio Phone Number SID (paid tier only) */
|
|
267
|
-
twilioNumberSid: zod.z.string().nullable().optional(),
|
|
268
|
-
/** Forwarding verification state */
|
|
269
|
-
verificationStatus: zod.z.enum(["pending", "verifying", "verified", "failed"]).default("pending"),
|
|
270
|
-
/** Last verification attempt timestamp */
|
|
271
|
-
lastVerificationAt: FirestoreTimestampSchema.optional(),
|
|
272
|
-
/** Number of verification attempts */
|
|
273
|
-
verificationAttempts: zod.z.number().default(0),
|
|
274
|
-
/** Reason for verification failure */
|
|
275
|
-
failureReason: zod.z.string().nullable().optional(),
|
|
276
|
-
/** Whether call forwarding is active */
|
|
277
|
-
enabled: zod.z.boolean().default(false),
|
|
278
|
-
createdAt: FirestoreTimestampSchema,
|
|
279
|
-
updatedAt: FirestoreTimestampSchema
|
|
280
|
-
});
|
|
281
|
-
var ConnectorTypeSchema = zod.z.enum(["telephony"]);
|
|
282
|
-
var ConnectorStatusSchema = zod.z.object({
|
|
283
|
-
/** Coarse, generic lifecycle the control-plane UI can render without
|
|
284
|
-
* connector-specific knowledge. */
|
|
285
|
-
state: zod.z.enum(["unconfigured", "pending", "active", "error", "disabled"]).default("unconfigured"),
|
|
286
|
-
detail: zod.z.string().nullable().optional(),
|
|
287
|
-
/** Opaque, connector-specific status detail (e.g. telephony's
|
|
288
|
-
* `{ verificationStatus, verificationAttempts, failureReason }`). Connector-
|
|
289
|
-
* owned like the rest of `status` — never user-writable. Nullable so a doc
|
|
290
|
-
* that stored `data: null` round-trips without a parse error. */
|
|
291
|
-
data: zod.z.record(zod.z.unknown()).nullable().optional(),
|
|
292
|
-
updatedAt: FirestoreTimestampSchema.optional()
|
|
293
|
-
});
|
|
294
|
-
var ConnectorConfigRecordSchema = zod.z.object({
|
|
295
|
-
connectorType: ConnectorTypeSchema,
|
|
296
|
-
/** The owning user. Org-scoping (ownerId as an orgId) is a later step. */
|
|
297
|
-
ownerId: zod.z.string(),
|
|
298
|
-
/** Opaque, connector-specific blob. Core does not interpret this. */
|
|
299
|
-
settings: zod.z.record(zod.z.unknown()).default({}),
|
|
300
|
-
/** Reference into a secret store (e.g. Secret Manager key). Never a raw secret. */
|
|
301
|
-
secretRef: zod.z.string().nullable().optional(),
|
|
302
|
-
enabled: zod.z.boolean().default(false),
|
|
303
|
-
status: ConnectorStatusSchema.default({ state: "unconfigured" }),
|
|
304
|
-
createdAt: FirestoreTimestampSchema,
|
|
305
|
-
updatedAt: FirestoreTimestampSchema
|
|
306
|
-
});
|
|
307
|
-
zod.z.object({
|
|
308
|
-
id: zod.z.string(),
|
|
309
|
-
ownerId: zod.z.string(),
|
|
310
|
-
/** The caller number this rule matches (E.164). Format-enforced at the
|
|
311
|
-
* record level so any writer (API, future contact-sync/callback) can't
|
|
312
|
-
* persist a malformed number. */
|
|
313
|
-
e164: zod.z.string().regex(/^\+[1-9]\d{6,14}$/, "Must be an E.164 phone number"),
|
|
314
|
-
/** Display label, e.g. "Mom" / "Delta Airlines". null = unlabeled. */
|
|
315
|
-
label: zod.z.string().nullable().optional(),
|
|
316
|
-
/** `allow` = ring through; `screen` = async voicemail. */
|
|
317
|
-
action: zod.z.enum(["allow", "screen"]),
|
|
318
|
-
/** Provenance. `manual` = user-created; the others are future writers. */
|
|
319
|
-
source: zod.z.enum(["manual", "contact-sync", "callback"]),
|
|
320
|
-
/** null = permanent; a date = self-expiring exception. */
|
|
321
|
-
expiresAt: FirestoreTimestampSchema.nullable().optional(),
|
|
322
|
-
createdAt: FirestoreTimestampSchema
|
|
323
|
-
});
|
|
324
|
-
var OrganizationRecordSchema = zod.z.object({
|
|
325
|
-
id: zod.z.string(),
|
|
326
|
-
/** Display name of the organization */
|
|
327
|
-
name: zod.z.string().min(3).max(50),
|
|
328
|
-
/**
|
|
329
|
-
* Unique handle for the organization (e.g. voxpop.com/@mypodcast).
|
|
330
|
-
* Used for public URLs.
|
|
331
|
-
*/
|
|
332
|
-
slug: zod.z.string().min(3).max(30).regex(/^[a-z0-9-]+$/),
|
|
333
|
-
/** URL to avatar/logo */
|
|
334
|
-
avatarUrl: zod.z.string().url().optional(),
|
|
335
|
-
/** URL to the podcast RSS feed */
|
|
336
|
-
rssFeedUrl: zod.z.string().url().optional(),
|
|
337
|
-
/** External website URL */
|
|
338
|
-
websiteUrl: httpsUrl().optional(),
|
|
339
|
-
/** Description or tagline */
|
|
340
|
-
description: zod.z.string().optional(),
|
|
341
|
-
/** Owner ID (User ID) */
|
|
342
|
-
ownerId: zod.z.string(),
|
|
343
|
-
/** Server timestamp of creation */
|
|
344
|
-
createdAt: FirestoreTimestampSchema,
|
|
345
|
-
/** Verified domain (e.g., "acme.com") — enables auto-join, enterprise features */
|
|
346
|
-
domain: zod.z.string().nullable().optional(),
|
|
347
|
-
/** Whether the domain has been verified via DNS TXT record */
|
|
348
|
-
domainVerified: zod.z.boolean().default(false),
|
|
349
|
-
/** DNS verification token (stored server-side until verification completes) */
|
|
350
|
-
domainVerificationToken: zod.z.string().optional(),
|
|
351
|
-
/** Billing email — required for paid orgs, where invoices go */
|
|
352
|
-
billingEmail: zod.z.string().email().nullable().optional(),
|
|
353
|
-
/**
|
|
354
|
-
* Tier determines isolation and feature set. Orgs are meant to be paid
|
|
355
|
-
* (business or enterprise); free/pro exist on the enum for the individual track.
|
|
356
|
-
* Default is provisionally `business` (the entry paid tier) — it's assigned at
|
|
357
|
-
* creation with no subscription behind it yet, so it stays provisional until billing
|
|
358
|
-
* promotes/reconciles the org. See docs/tech-debt.md "Org tier billing reconciliation".
|
|
359
|
-
*/
|
|
360
|
-
tier: zod.z.enum(["free", "pro", "business", "enterprise"]).default("business"),
|
|
361
|
-
/** Stripe Customer ID */
|
|
362
|
-
stripeCustomerId: zod.z.string().optional(),
|
|
363
|
-
/** Subscription Status */
|
|
364
|
-
subscriptionStatus: zod.z.enum(["active", "trialing", "past_due", "canceled", "unpaid"]).optional()
|
|
365
|
-
});
|
|
366
|
-
var OrganizationMemberRecordSchema = zod.z.object({
|
|
367
|
-
orgId: zod.z.string(),
|
|
368
|
-
userId: zod.z.string(),
|
|
369
|
-
/** Role in the organization */
|
|
370
|
-
role: zod.z.enum(["owner", "admin", "member"]),
|
|
371
|
-
/** Server timestamp of joining */
|
|
372
|
-
joinedAt: FirestoreTimestampSchema,
|
|
373
|
-
invitedBy: zod.z.string().optional()
|
|
374
|
-
});
|
|
375
|
-
var OrgInviteRecordSchema = zod.z.object({
|
|
376
|
-
id: zod.z.string(),
|
|
377
|
-
orgId: zod.z.string(),
|
|
378
|
-
/** Email the invite was sent to */
|
|
379
|
-
email: zod.z.string().email(),
|
|
380
|
-
/** Role to assign on acceptance */
|
|
381
|
-
role: zod.z.enum(["admin", "member"]),
|
|
382
|
-
/** User ID of who sent the invite */
|
|
383
|
-
invitedBy: zod.z.string(),
|
|
384
|
-
/** Invite lifecycle status */
|
|
385
|
-
status: zod.z.enum(["pending", "accepted", "expired", "revoked"]).default("pending"),
|
|
386
|
-
/** Server timestamp of creation */
|
|
387
|
-
createdAt: FirestoreTimestampSchema,
|
|
388
|
-
/** When this invite expires */
|
|
389
|
-
expiresAt: FirestoreTimestampSchema
|
|
87
|
+
deactivatedAt: FirestoreTimestampSchema.optional()
|
|
390
88
|
});
|
|
391
89
|
var ProfileViewBasicSchema = zod.z.object({
|
|
392
90
|
id: zod.z.string(),
|
|
393
91
|
handle: zod.z.string().nullable().optional(),
|
|
394
92
|
// `displayName` and `bio` are `.nullable()` — Firestore stores `null` for
|
|
395
93
|
// empty values on these fields (see users-dependencies.ts), and Zod's
|
|
396
|
-
// `.optional()` alone rejects `null`.
|
|
397
|
-
// Phase 3.1 HTTP cutover, when transport-layer Zod validation started
|
|
398
|
-
// actually exercising the wire shape. Consumers already use truthy
|
|
94
|
+
// `.optional()` alone rejects `null`. Consumers already use truthy
|
|
399
95
|
// checks / `??` / `||`, so widening the type to include `null` is safe.
|
|
400
96
|
displayName: zod.z.string().nullable().optional(),
|
|
401
97
|
avatarUrl: zod.z.string().nullable().optional(),
|
|
@@ -431,24 +127,7 @@ var ProfileViewDetailedSchema = ProfileViewBasicSchema.extend({
|
|
|
431
127
|
handle: zod.z.string(),
|
|
432
128
|
did: zod.z.string()
|
|
433
129
|
}).optional(),
|
|
434
|
-
usageIntent: zod.z.string().nullable().optional()
|
|
435
|
-
/** Hydrated RSS Data (fetched from sub-collection) */
|
|
436
|
-
rssSummary: zod.z.object({
|
|
437
|
-
title: zod.z.string().optional(),
|
|
438
|
-
description: zod.z.string().optional(),
|
|
439
|
-
items: zod.z.array(zod.z.object({
|
|
440
|
-
title: zod.z.string().optional(),
|
|
441
|
-
link: zod.z.string().optional(),
|
|
442
|
-
content: zod.z.string().optional(),
|
|
443
|
-
pubDate: zod.z.string().optional()
|
|
444
|
-
})).optional(),
|
|
445
|
-
lastFetchedAt: FirestoreTimestampSchema.optional()
|
|
446
|
-
}).optional(),
|
|
447
|
-
promptAudioUrl: zod.z.string().optional(),
|
|
448
|
-
/** @deprecated Use stats.prompts from ProfileViewBasic instead */
|
|
449
|
-
totalPrompts: zod.z.number().optional(),
|
|
450
|
-
totalReplies: zod.z.number().optional(),
|
|
451
|
-
favoritePromptId: zod.z.string().optional()
|
|
130
|
+
usageIntent: zod.z.string().nullable().optional()
|
|
452
131
|
});
|
|
453
132
|
var ProfileViewSelfSchema = ProfileViewDetailedSchema.extend({
|
|
454
133
|
phoneNumber: zod.z.string().nullable().optional(),
|
|
@@ -459,9 +138,8 @@ var ProfileViewSelfSchema = ProfileViewDetailedSchema.extend({
|
|
|
459
138
|
newReplierCount: zod.z.number().default(0),
|
|
460
139
|
/**
|
|
461
140
|
* Account tier from UserRecord — surfaced on the self profile so the
|
|
462
|
-
* client can gate paid features
|
|
463
|
-
*
|
|
464
|
-
* missing as `'free'`.
|
|
141
|
+
* client can gate paid features. Optional for legacy docs without the
|
|
142
|
+
* field; consumers should treat missing as `'free'`.
|
|
465
143
|
*/
|
|
466
144
|
tier: zod.z.enum(["free", "creator_pro"]).optional(),
|
|
467
145
|
/**
|
|
@@ -475,231 +153,13 @@ var ProfileViewSelfSchema = ProfileViewDetailedSchema.extend({
|
|
|
475
153
|
theme: zod.z.string().optional()
|
|
476
154
|
}).optional()
|
|
477
155
|
});
|
|
478
|
-
|
|
156
|
+
ProfileViewSelfSchema.extend({
|
|
479
157
|
blockedUsers: zod.z.array(zod.z.string()).optional(),
|
|
480
158
|
followers: zod.z.array(zod.z.string()).optional(),
|
|
481
159
|
following: zod.z.array(zod.z.string()).optional(),
|
|
482
160
|
reportCount: zod.z.number().optional(),
|
|
483
161
|
isBanned: zod.z.boolean().optional()
|
|
484
162
|
});
|
|
485
|
-
var ProfileViewSchema = ProfileViewAdminSchema;
|
|
486
|
-
var PromptViewSchema = zod.z.object({
|
|
487
|
-
/** AT Protocol URI (e.g. at://did:plc.../app.../123) */
|
|
488
|
-
uri: zod.z.string().optional(),
|
|
489
|
-
/** IPFS Content ID */
|
|
490
|
-
cid: zod.z.string().optional(),
|
|
491
|
-
/** The raw prompt data */
|
|
492
|
-
record: PromptRecordSchema,
|
|
493
|
-
/** The hydrated author profile */
|
|
494
|
-
author: ProfileViewSchema,
|
|
495
|
-
/** Total number of replies */
|
|
496
|
-
replyCount: zod.z.number().default(0),
|
|
497
|
-
likeCount: zod.z.number().default(0),
|
|
498
|
-
updatedAt: FirestoreTimestampSchema.optional(),
|
|
499
|
-
lastReplyAt: FirestoreTimestampSchema.optional(),
|
|
500
|
-
tags: zod.z.array(zod.z.string()).optional(),
|
|
501
|
-
visibility: zod.z.enum(["public", "private", "unlisted", "archived"]).default("public"),
|
|
502
|
-
analytics: zod.z.object({
|
|
503
|
-
views: zod.z.number().default(0),
|
|
504
|
-
listens: zod.z.number().default(0),
|
|
505
|
-
/**
|
|
506
|
-
* Mean engagementScore (1–10) across this prompt's `status: 'live'`
|
|
507
|
-
* replies that completed AI enrichment. `null` when no such replies
|
|
508
|
-
* exist (0 would alias a valid bottom-of-range score). Derived in
|
|
509
|
-
* hydration from the prompt doc's `engagementScoreSum / Count`.
|
|
510
|
-
*/
|
|
511
|
-
avgEngagementScore: zod.z.number().nullable().optional(),
|
|
512
|
-
/**
|
|
513
|
-
* Counts of `status: 'live'` AI-enriched replies grouped by sentiment.
|
|
514
|
-
* Keys lowercase by convention; source enum
|
|
515
|
-
* (`Positive | Neutral | Negative`) is mapped at the write site.
|
|
516
|
-
*/
|
|
517
|
-
sentimentBreakdown: zod.z.object({
|
|
518
|
-
positive: zod.z.number(),
|
|
519
|
-
neutral: zod.z.number(),
|
|
520
|
-
negative: zod.z.number()
|
|
521
|
-
}).optional()
|
|
522
|
-
}).optional(),
|
|
523
|
-
moderation: zod.z.object({
|
|
524
|
-
flagged: zod.z.boolean().default(false),
|
|
525
|
-
reason: zod.z.string().optional()
|
|
526
|
-
}).optional(),
|
|
527
|
-
// AI Enrichment Fields (Hydrated from Record but hidden from Record Schema)
|
|
528
|
-
aiLabels: zod.z.array(zod.z.string()).optional(),
|
|
529
|
-
aiSummary: zod.z.string().optional(),
|
|
530
|
-
aiStatus: zod.z.enum(["pending", "complete", "error"]).optional(),
|
|
531
|
-
aiError: zod.z.string().optional(),
|
|
532
|
-
transcription: zod.z.string().optional()
|
|
533
|
-
});
|
|
534
|
-
var PromptViewPublicSchema = PromptViewSchema.omit({
|
|
535
|
-
analytics: true,
|
|
536
|
-
moderation: true,
|
|
537
|
-
aiLabels: true,
|
|
538
|
-
aiSummary: true,
|
|
539
|
-
aiStatus: true,
|
|
540
|
-
aiError: true,
|
|
541
|
-
transcription: true
|
|
542
|
-
}).extend({
|
|
543
|
-
author: ProfileViewBasicSchema
|
|
544
|
-
});
|
|
545
|
-
var ReplyViewSchema = zod.z.object({
|
|
546
|
-
record: ReplyRecordSchema,
|
|
547
|
-
author: ProfileViewSchema,
|
|
548
|
-
recipient: ProfileViewSchema,
|
|
549
|
-
/** GCS Storage Path for audio file */
|
|
550
|
-
storagePath: zod.z.string().optional(),
|
|
551
|
-
duration: zod.z.number().optional(),
|
|
552
|
-
updatedAt: FirestoreTimestampSchema.optional(),
|
|
553
|
-
isRead: zod.z.boolean(),
|
|
554
|
-
readBy: zod.z.array(zod.z.string()).default([]),
|
|
555
|
-
isDeleted: zod.z.boolean().default(false),
|
|
556
|
-
reactions: zod.z.record(zod.z.string(), zod.z.number()).optional(),
|
|
557
|
-
moderation: zod.z.object({
|
|
558
|
-
flagged: zod.z.boolean().default(false),
|
|
559
|
-
reason: zod.z.string().optional()
|
|
560
|
-
}).optional(),
|
|
561
|
-
// AI Enrichment Fields (Hydrated from Record but hidden from Record Schema)
|
|
562
|
-
aiLabels: zod.z.array(zod.z.string()).optional(),
|
|
563
|
-
aiSummary: zod.z.string().optional(),
|
|
564
|
-
aiStatus: zod.z.enum(["pending", "complete", "error", "skipped_too_short"]).optional(),
|
|
565
|
-
aiError: zod.z.string().optional(),
|
|
566
|
-
transcription: zod.z.string().optional(),
|
|
567
|
-
sentiment: zod.z.enum(["Positive", "Negative", "Neutral"]).optional(),
|
|
568
|
-
/** Must match the widened enum in `ReplyRecordSchema.energyLevel`. */
|
|
569
|
-
energyLevel: zod.z.enum(["High", "Low", "Neutral"]).optional(),
|
|
570
|
-
engagementScore: zod.z.number().min(1).max(10).optional(),
|
|
571
|
-
// === Voice-isolation enrichment (lifted; see specs/ai-enrichment-split.md) ===
|
|
572
|
-
//
|
|
573
|
-
// `enhancedAudioUrl` is the only one of these the public view keeps —
|
|
574
|
-
// it replaces `audioUrl` for downstream players when present.
|
|
575
|
-
// `enhancedStoragePath` is private (storage paths are server-side
|
|
576
|
-
// bookkeeping).
|
|
577
|
-
enhancedAudioUrl: zod.z.string().url().optional(),
|
|
578
|
-
enhancedStoragePath: zod.z.string().optional(),
|
|
579
|
-
// === Social-share video enrichment (lifted; creator-only) ===
|
|
580
|
-
//
|
|
581
|
-
// All `socialVideo*` fields are stripped by `toReplyViewPublic` —
|
|
582
|
-
// the URL points at a generated artifact the creator may share to
|
|
583
|
-
// social media, NOT at content the reply page should render. Status /
|
|
584
|
-
// error / source-audio are job-tracking state.
|
|
585
|
-
socialVideoUrl: zod.z.string().url().optional(),
|
|
586
|
-
socialVideoStoragePath: zod.z.string().optional(),
|
|
587
|
-
socialVideoStatus: zod.z.enum(["pending", "complete", "error"]).optional(),
|
|
588
|
-
socialVideoError: zod.z.string().optional(),
|
|
589
|
-
socialVideoSourceAudio: zod.z.string().optional(),
|
|
590
|
-
/** @private Confirmed listener phone number (never exposed publicly) */
|
|
591
|
-
listenerPhoneNumber: zod.z.string().regex(/^\+[1-9]\d{1,14}$/).optional(),
|
|
592
|
-
/**
|
|
593
|
-
* @private Per-viewer private notes about this reply (CRM enrichment).
|
|
594
|
-
* Lifted into the view from `enrichments/replies/{id}.notes` by the
|
|
595
|
-
* hydrator when the viewer is the prompt author. Never populated for
|
|
596
|
-
* non-author viewers; defensively stripped by `toReplyViewPublic`.
|
|
597
|
-
*/
|
|
598
|
-
notes: zod.z.string().optional()
|
|
599
|
-
});
|
|
600
|
-
var ReplyViewPublicSchema = ReplyViewSchema.omit({
|
|
601
|
-
listenerPhoneNumber: true,
|
|
602
|
-
notes: true,
|
|
603
|
-
// AI cluster — only `transcription` survives.
|
|
604
|
-
aiStatus: true,
|
|
605
|
-
aiError: true,
|
|
606
|
-
aiSummary: true,
|
|
607
|
-
aiLabels: true,
|
|
608
|
-
sentiment: true,
|
|
609
|
-
energyLevel: true,
|
|
610
|
-
engagementScore: true,
|
|
611
|
-
// Voice isolation — keep enhancedAudioUrl, strip the path.
|
|
612
|
-
enhancedStoragePath: true,
|
|
613
|
-
// Social-video — entire cluster is creator-only.
|
|
614
|
-
socialVideoUrl: true,
|
|
615
|
-
socialVideoStoragePath: true,
|
|
616
|
-
socialVideoStatus: true,
|
|
617
|
-
socialVideoError: true,
|
|
618
|
-
socialVideoSourceAudio: true
|
|
619
|
-
});
|
|
620
|
-
var OrganizationViewSchema = zod.z.object({
|
|
621
|
-
record: OrganizationRecordSchema,
|
|
622
|
-
memberCount: zod.z.number().default(1),
|
|
623
|
-
currentUserRole: zod.z.enum(["owner", "admin", "member"]).optional()
|
|
624
|
-
});
|
|
625
|
-
zod.z.object({
|
|
626
|
-
record: OrganizationMemberRecordSchema,
|
|
627
|
-
profile: ProfileViewBasicSchema
|
|
628
|
-
});
|
|
629
|
-
zod.z.object({
|
|
630
|
-
record: OrgInviteRecordSchema,
|
|
631
|
-
/** Display name of the user who sent the invite */
|
|
632
|
-
inviterName: zod.z.string().optional(),
|
|
633
|
-
/** Name of the organization */
|
|
634
|
-
orgName: zod.z.string()
|
|
635
|
-
});
|
|
636
|
-
zod.z.object({
|
|
637
|
-
promptId: zod.z.string(),
|
|
638
|
-
repliers: zod.z.record(zod.z.string(), zod.z.object({
|
|
639
|
-
firstReplyAt: FirestoreTimestampSchema,
|
|
640
|
-
lastReplyAt: FirestoreTimestampSchema,
|
|
641
|
-
replyCount: zod.z.number()
|
|
642
|
-
}))
|
|
643
|
-
});
|
|
644
|
-
PromptViewSchema.extend({
|
|
645
|
-
replies: zod.z.array(ReplyViewSchema)
|
|
646
|
-
});
|
|
647
|
-
var ReplierSchema = zod.z.object({
|
|
648
|
-
handle: zod.z.string(),
|
|
649
|
-
/** ISO date string */
|
|
650
|
-
lastReplyDate: zod.z.string(),
|
|
651
|
-
/** ISO date string */
|
|
652
|
-
firstReplyAt: zod.z.string(),
|
|
653
|
-
totalReplies: zod.z.number()
|
|
654
|
-
});
|
|
655
|
-
zod.z.discriminatedUnion("type", [
|
|
656
|
-
// Public endpoint (`GET /resolve/:handle`) — project to the basic shape so
|
|
657
|
-
// PII/admin fields (email, phoneNumber, settings, blockedUsers, …) never
|
|
658
|
-
// cross the public API boundary. See `toProfileViewBasic`.
|
|
659
|
-
zod.z.object({ type: zod.z.literal("user"), profile: ProfileViewBasicSchema }),
|
|
660
|
-
zod.z.object({ type: zod.z.literal("org"), org: OrganizationViewSchema })
|
|
661
|
-
]);
|
|
662
|
-
zod.z.object({
|
|
663
|
-
// Public endpoint (`GET /users/:handle/profile`) — basic shape only, so the
|
|
664
|
-
// owner's PII/admin fields never serialize to anonymous callers.
|
|
665
|
-
profileUser: ProfileViewBasicSchema,
|
|
666
|
-
// Each prompt's nested `author` is the profile owner, hydrated from the
|
|
667
|
-
// wide admin profile (`getPromptsForUser` prefetches via getUserDataByUid).
|
|
668
|
-
// Use the PUBLIC prompt/reply shapes so that nested author PII (email,
|
|
669
|
-
// phoneNumber, settings, …) and owner-only prompt enrichment never leak.
|
|
670
|
-
allPromptsWithReplies: zod.z.array(PromptViewPublicSchema.extend({
|
|
671
|
-
replies: zod.z.array(ReplyViewPublicSchema)
|
|
672
|
-
})),
|
|
673
|
-
repliers: zod.z.array(ReplierSchema)
|
|
674
|
-
});
|
|
675
|
-
var RssSummarySchema = zod.z.object({
|
|
676
|
-
title: zod.z.string().optional(),
|
|
677
|
-
description: zod.z.string().optional(),
|
|
678
|
-
image: zod.z.string().optional(),
|
|
679
|
-
link: zod.z.string().optional(),
|
|
680
|
-
items: zod.z.array(zod.z.object({
|
|
681
|
-
title: zod.z.string().optional(),
|
|
682
|
-
link: zod.z.string().optional(),
|
|
683
|
-
content: zod.z.string().optional(),
|
|
684
|
-
pubDate: zod.z.string().optional()
|
|
685
|
-
})).optional(),
|
|
686
|
-
lastFetchedAt: FirestoreTimestampSchema.optional()
|
|
687
|
-
});
|
|
688
|
-
zod.z.object({
|
|
689
|
-
org: OrganizationViewSchema,
|
|
690
|
-
prompts: zod.z.array(PromptViewSchema),
|
|
691
|
-
rssSummary: RssSummarySchema.nullable()
|
|
692
|
-
});
|
|
693
|
-
zod.z.object({
|
|
694
|
-
profile: ProfileViewBasicSchema,
|
|
695
|
-
totalReplies: zod.z.number(),
|
|
696
|
-
/** ISO date string */
|
|
697
|
-
lastReplyDate: zod.z.string(),
|
|
698
|
-
/** ISO date string */
|
|
699
|
-
firstReplyAt: zod.z.string(),
|
|
700
|
-
/** Phone number for anonymous repliers (from Firebase Auth, only visible to prompt author) */
|
|
701
|
-
phoneNumber: zod.z.string().optional()
|
|
702
|
-
});
|
|
703
163
|
|
|
704
164
|
// types/audio.ts
|
|
705
165
|
var StrongRefSchema = zod.z.object({
|
|
@@ -758,6 +218,15 @@ zod.z.object({
|
|
|
758
218
|
orgId: zod.z.string().nullable().optional(),
|
|
759
219
|
/** Denormalized from `reply` presence: `reply` set ⇒ 'reply', else 'prompt'. */
|
|
760
220
|
kind: zod.z.enum(["prompt", "reply"]),
|
|
221
|
+
/**
|
|
222
|
+
* Branch participant pair (author ids) for reply gating — the parties to a
|
|
223
|
+
* reply's sub-thread: the creator (thread-root author) + the responder who
|
|
224
|
+
* opened the branch. Set on replies (deduped, 1–2 ids); absent on prompts
|
|
225
|
+
* (a prompt's repliers are the app's audience policy, not a fixed pair).
|
|
226
|
+
* Inherited down the branch so reply gating is an O(1) field check, never a
|
|
227
|
+
* thread walk. See `specs/antiphony-data-model.md` §6 "Reply gating".
|
|
228
|
+
*/
|
|
229
|
+
threadParticipants: zod.z.array(zod.z.string()).optional(),
|
|
761
230
|
// --- Lexicon fields (public contract) ---
|
|
762
231
|
/** User-authored text (bsky-semantic). May be empty for pure-audio posts. NEVER the transcript. */
|
|
763
232
|
text: zod.z.string().max(3e3),
|
|
@@ -801,7 +270,15 @@ zod.z.object({
|
|
|
801
270
|
});
|
|
802
271
|
var ViewerStateSchema = zod.z.object({
|
|
803
272
|
/** True when the authenticated caller authored this post. */
|
|
804
|
-
isAuthor: zod.z.boolean().default(false)
|
|
273
|
+
isAuthor: zod.z.boolean().default(false),
|
|
274
|
+
/**
|
|
275
|
+
* Whether the caller may reply to this post (reply gating, §6). A prompt is
|
|
276
|
+
* repliable by any authenticated viewer (the app's audience-policy default);
|
|
277
|
+
* a reply only by its branch participants (`{ creator, branch responder }`).
|
|
278
|
+
*/
|
|
279
|
+
canReply: zod.z.boolean().default(false),
|
|
280
|
+
/** Why `canReply` is false, when it is (omitted when the caller can reply). */
|
|
281
|
+
replyDisabledReason: zod.z.enum(["unauthenticated", "not_a_participant"]).optional()
|
|
805
282
|
});
|
|
806
283
|
var PostRecordPublicSchema = zod.z.object({
|
|
807
284
|
text: zod.z.string(),
|
|
@@ -844,19 +321,6 @@ var CreateAudioPostRequestSchema = zod.z.object({
|
|
|
844
321
|
message: "Post must have text or an audio embed",
|
|
845
322
|
path: ["text"]
|
|
846
323
|
});
|
|
847
|
-
var CreatePromptRequestSchema = zod.z.object({
|
|
848
|
-
// Bounds chosen so the public prompt hero never needs to clip: title +
|
|
849
|
-
// description sit between the two dots inside an h-dvh, overflow-hidden
|
|
850
|
-
// layout. 80/200 keeps typical content to a few lines on short phones.
|
|
851
|
-
// (Record-level schema stays unbounded so any pre-existing longer values
|
|
852
|
-
// still read cleanly — this only gates new writes.)
|
|
853
|
-
title: zod.z.string().min(3).max(80),
|
|
854
|
-
description: zod.z.string().max(200).optional(),
|
|
855
|
-
audioUrl: zod.z.string().url().or(zod.z.literal("")),
|
|
856
|
-
setAsGreeting: zod.z.union([zod.z.boolean(), zod.z.string().transform((val) => val === "true")]).optional(),
|
|
857
|
-
/** Explicit org context override (normally inferred from auth.currentOrg) */
|
|
858
|
-
orgId: zod.z.string().nullable().optional()
|
|
859
|
-
});
|
|
860
324
|
var UpdateProfileRequestSchema = zod.z.object({
|
|
861
325
|
handle: zod.z.string().min(3).max(20).regex(/^[a-zA-Z0-9_]+$/).optional(),
|
|
862
326
|
displayName: zod.z.string().max(50).optional(),
|
|
@@ -878,94 +342,6 @@ var UpdateProfileRequestSchema = zod.z.object({
|
|
|
878
342
|
/** When true, surfaces the linked Bluesky identity on the public profile. */
|
|
879
343
|
showBlueskyPublicly: zod.z.boolean().optional()
|
|
880
344
|
});
|
|
881
|
-
var FcmTokenRequestSchema = zod.z.object({
|
|
882
|
-
// FCM registration tokens are typically ~163–200 chars; Google's docs
|
|
883
|
-
// don't publish a hard max but 4096 is a safe upper bound that prevents
|
|
884
|
-
// multi-MB payloads while accommodating any plausible FCM token format.
|
|
885
|
-
token: zod.z.string().min(1).max(4096)
|
|
886
|
-
});
|
|
887
|
-
var BadgeResetRequestSchema = zod.z.object({
|
|
888
|
-
type: zod.z.enum(["new_replier", "unread_reply"])
|
|
889
|
-
});
|
|
890
|
-
var CreateOrgRequestSchema = zod.z.object({
|
|
891
|
-
name: zod.z.string().min(3).max(50),
|
|
892
|
-
slug: zod.z.string().min(3).max(30).regex(/^[a-z0-9-]+$/),
|
|
893
|
-
avatarUrl: zod.z.string().url().optional(),
|
|
894
|
-
rssFeedUrl: zod.z.string().url().optional(),
|
|
895
|
-
websiteUrl: zod.z.string().url().optional(),
|
|
896
|
-
// 500 chars — enough for a multi-sentence blurb, prevents multi-MB writes.
|
|
897
|
-
description: zod.z.string().max(500).optional()
|
|
898
|
-
});
|
|
899
|
-
var UpdateOrgRequestSchema = zod.z.object({
|
|
900
|
-
name: zod.z.string().min(3).max(50).optional(),
|
|
901
|
-
slug: zod.z.string().min(3).max(30).regex(/^[a-z0-9-]+$/).optional(),
|
|
902
|
-
// 500 chars — matches CreateOrgRequestSchema.description.
|
|
903
|
-
description: zod.z.string().max(500).optional(),
|
|
904
|
-
avatarUrl: zod.z.string().url().nullable().optional(),
|
|
905
|
-
rssFeedUrl: zod.z.string().url().nullable().optional(),
|
|
906
|
-
websiteUrl: zod.z.string().url().nullable().optional(),
|
|
907
|
-
billingEmail: zod.z.string().email().nullable().optional(),
|
|
908
|
-
// 253 chars — the DNS spec maximum for a fully-qualified domain name.
|
|
909
|
-
domain: zod.z.string().max(253).nullable().optional()
|
|
910
|
-
});
|
|
911
|
-
var CreateOrgInviteRequestSchema = zod.z.object({
|
|
912
|
-
email: zod.z.string().email(),
|
|
913
|
-
role: zod.z.enum(["admin", "member"])
|
|
914
|
-
});
|
|
915
|
-
var UpdateMemberRoleRequestSchema = zod.z.object({
|
|
916
|
-
role: zod.z.enum(["admin", "member"])
|
|
917
|
-
});
|
|
918
|
-
var SwitchOrgRequestSchema = zod.z.object({
|
|
919
|
-
/** orgId to switch to, or null to switch to personal context */
|
|
920
|
-
orgId: zod.z.string().nullable()
|
|
921
|
-
});
|
|
922
|
-
var ConnectorConfigInputSchema = ConnectorConfigRecordSchema.omit({
|
|
923
|
-
connectorType: true,
|
|
924
|
-
ownerId: true,
|
|
925
|
-
status: true,
|
|
926
|
-
createdAt: true,
|
|
927
|
-
updatedAt: true
|
|
928
|
-
});
|
|
929
|
-
var ConnectorConfigUpdateSchema = ConnectorConfigInputSchema.partial();
|
|
930
|
-
var PersonNotesUpdateSchema = zod.z.object({
|
|
931
|
-
notes: zod.z.string().max(1e4).optional(),
|
|
932
|
-
tags: zod.z.array(zod.z.string().max(64)).max(50).optional()
|
|
933
|
-
});
|
|
934
|
-
var PersonMergeRequestSchema = zod.z.object({
|
|
935
|
-
alternateUid: zod.z.string().min(1)
|
|
936
|
-
});
|
|
937
|
-
var ScreeningRuleInputSchema = zod.z.object({
|
|
938
|
-
e164: zod.z.string().regex(/^\+[1-9]\d{6,14}$/, "Must be an E.164 phone number"),
|
|
939
|
-
label: zod.z.string().max(120).nullable().optional(),
|
|
940
|
-
action: zod.z.enum(["allow", "screen"]),
|
|
941
|
-
expiresAt: zod.z.union([zod.z.string(), zod.z.number()]).nullable().optional().refine((v) => v == null || !Number.isNaN(new Date(v).getTime()), {
|
|
942
|
-
message: "Must be a valid ISO date string or epoch-ms timestamp"
|
|
943
|
-
})
|
|
944
|
-
});
|
|
945
|
-
var ScreeningRuleUpdateSchema = ScreeningRuleInputSchema.partial();
|
|
946
|
-
var UpdateReplyStatusRequestSchema = zod.z.object({
|
|
947
|
-
status: zod.z.enum(["live", "archived", "deleted"])
|
|
948
|
-
});
|
|
949
|
-
var BulkReplyActionRequestSchema = zod.z.object({
|
|
950
|
-
replyIds: zod.z.array(zod.z.string()).min(1).max(100),
|
|
951
|
-
action: zod.z.enum(["markRead", "archive", "delete", "restore"])
|
|
952
|
-
});
|
|
953
345
|
|
|
954
|
-
exports.BadgeResetRequestSchema = BadgeResetRequestSchema;
|
|
955
|
-
exports.BulkReplyActionRequestSchema = BulkReplyActionRequestSchema;
|
|
956
|
-
exports.ConnectorConfigInputSchema = ConnectorConfigInputSchema;
|
|
957
|
-
exports.ConnectorConfigUpdateSchema = ConnectorConfigUpdateSchema;
|
|
958
346
|
exports.CreateAudioPostRequestSchema = CreateAudioPostRequestSchema;
|
|
959
|
-
exports.CreateOrgInviteRequestSchema = CreateOrgInviteRequestSchema;
|
|
960
|
-
exports.CreateOrgRequestSchema = CreateOrgRequestSchema;
|
|
961
|
-
exports.CreatePromptRequestSchema = CreatePromptRequestSchema;
|
|
962
|
-
exports.FcmTokenRequestSchema = FcmTokenRequestSchema;
|
|
963
|
-
exports.PersonMergeRequestSchema = PersonMergeRequestSchema;
|
|
964
|
-
exports.PersonNotesUpdateSchema = PersonNotesUpdateSchema;
|
|
965
|
-
exports.ScreeningRuleInputSchema = ScreeningRuleInputSchema;
|
|
966
|
-
exports.ScreeningRuleUpdateSchema = ScreeningRuleUpdateSchema;
|
|
967
|
-
exports.SwitchOrgRequestSchema = SwitchOrgRequestSchema;
|
|
968
|
-
exports.UpdateMemberRoleRequestSchema = UpdateMemberRoleRequestSchema;
|
|
969
|
-
exports.UpdateOrgRequestSchema = UpdateOrgRequestSchema;
|
|
970
347
|
exports.UpdateProfileRequestSchema = UpdateProfileRequestSchema;
|
|
971
|
-
exports.UpdateReplyStatusRequestSchema = UpdateReplyStatusRequestSchema;
|