@antiphony/shared 0.1.0 → 0.4.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/README.md +4 -4
- package/dist/cjs/api-codecs.cjs +90 -787
- package/dist/cjs/api-codecs.d.cts +117 -290
- package/dist/cjs/index.cjs +102 -947
- package/dist/cjs/index.d.cts +89 -7
- package/dist/cjs/nsid.cjs +8 -18
- package/dist/cjs/nsid.d.cts +8 -17
- package/dist/cjs/types/audio.cjs +77 -662
- package/dist/cjs/types/audio.d.cts +285 -203
- package/dist/cjs/types/blob.cjs +5 -9
- package/dist/cjs/types/blob.d.cts +21 -21
- package/dist/cjs/types/records.cjs +0 -370
- package/dist/cjs/types/records.d.cts +1 -825
- package/dist/esm/api-codecs.d.ts +117 -290
- package/dist/esm/api-codecs.js +5 -6
- package/dist/esm/{chunk-ORMEWXMH.js → chunk-5JBD5THX.js} +1 -16
- package/dist/esm/{chunk-F2CANZZ7.js → chunk-BNNLHRH7.js} +1 -1
- package/dist/esm/chunk-D655OH2I.js +35 -0
- package/dist/esm/chunk-RUUHUNZ6.js +37 -0
- package/dist/esm/chunk-SBYNIQRZ.js +23 -0
- package/dist/esm/chunk-SMK4OZNU.js +17 -0
- package/dist/esm/{chunk-BUNMR4ZO.js → chunk-WL2GSPGC.js} +81 -12
- package/dist/esm/errors/index.js +1 -1
- package/dist/esm/index.d.ts +89 -7
- package/dist/esm/index.js +7 -9
- package/dist/esm/nsid.d.ts +8 -17
- 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/audio.d.ts +285 -203
- package/dist/esm/types/audio.js +4 -5
- package/dist/esm/types/blob.d.ts +21 -21
- package/dist/esm/types/blob.js +2 -2
- package/dist/esm/types/records.d.ts +1 -825
- package/dist/esm/types/records.js +2 -3
- package/dist/esm/utils/index.js +1 -1
- package/package.json +90 -26
- package/dist/cjs/types/api.cjs +0 -726
- package/dist/cjs/types/api.d.cts +0 -494
- 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/cjs/types/views.cjs +0 -820
- package/dist/cjs/types/views.d.cts +0 -9806
- package/dist/esm/chunk-3WZJXJNU.js +0 -378
- package/dist/esm/chunk-5EHV73BA.js +0 -20
- 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/chunk-XDBKR6LW.js +0 -32
- package/dist/esm/types/api.d.ts +0 -494
- package/dist/esm/types/api.js +0 -5
- 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/esm/types/views.d.ts +0 -9806
- package/dist/esm/types/views.js +0 -4
|
@@ -1,378 +0,0 @@
|
|
|
1
|
-
import { BlobRefSchema } from './chunk-5EHV73BA.js';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
function httpsUrl() {
|
|
5
|
-
return z.string().trim().url().refine((u) => /^https?:\/\//i.test(u), {
|
|
6
|
-
message: "URL must use the http or https scheme"
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
var FirestoreTimestampSchema = z.union([
|
|
10
|
-
z.custom((data) => {
|
|
11
|
-
return data && typeof data === "object" && (typeof data.toDate === "function" || "seconds" in data && "nanoseconds" in data);
|
|
12
|
-
}),
|
|
13
|
-
z.string(),
|
|
14
|
-
z.number(),
|
|
15
|
-
z.date()
|
|
16
|
-
]).transform((data, ctx) => {
|
|
17
|
-
let date;
|
|
18
|
-
if (data instanceof Date) {
|
|
19
|
-
date = data;
|
|
20
|
-
} else if (typeof data === "string") {
|
|
21
|
-
date = new Date(data);
|
|
22
|
-
} else if (typeof data === "number") {
|
|
23
|
-
date = new Date(data);
|
|
24
|
-
} else if (typeof data.toDate === "function") {
|
|
25
|
-
date = data.toDate();
|
|
26
|
-
} else {
|
|
27
|
-
const timestamp = data;
|
|
28
|
-
date = new Date(timestamp.seconds * 1e3 + timestamp.nanoseconds / 1e6);
|
|
29
|
-
}
|
|
30
|
-
if (Number.isNaN(date.getTime())) {
|
|
31
|
-
ctx.addIssue({
|
|
32
|
-
code: z.ZodIssueCode.custom,
|
|
33
|
-
message: "FirestoreTimestamp coerced to Invalid Date"
|
|
34
|
-
});
|
|
35
|
-
return z.NEVER;
|
|
36
|
-
}
|
|
37
|
-
return date;
|
|
38
|
-
});
|
|
39
|
-
var UserRecordSchema = z.object({
|
|
40
|
-
/** Unique Firebase UID */
|
|
41
|
-
id: z.string(),
|
|
42
|
-
/** Public handle (e.g. @brad). Optional for Lite Users. */
|
|
43
|
-
handle: z.string().min(3).max(20).regex(/^[a-zA-Z0-9_]+$/).nullable().optional(),
|
|
44
|
-
/** User stated intent (e.g. "Podcaster", "Listener") */
|
|
45
|
-
usageIntent: z.string().nullable().optional(),
|
|
46
|
-
/**
|
|
47
|
-
* Domain for federated handle support.
|
|
48
|
-
* Defaults to 'voxpop.com'.
|
|
49
|
-
*/
|
|
50
|
-
domain: z.string().default("voxpop.com"),
|
|
51
|
-
/**
|
|
52
|
-
* Display Name (e.g. "Brad Thorson"). Nullable: Firestore stores `null`
|
|
53
|
-
* when the user clears this field via the settings form, and the schema
|
|
54
|
-
* must match storage reality or `UserRecordSchema.parse` (in
|
|
55
|
-
* `getUserRecordByUid`) will throw.
|
|
56
|
-
*/
|
|
57
|
-
displayName: z.string().max(50).nullable().optional(),
|
|
58
|
-
/** Short bio/description — nullable for the same reason as displayName. */
|
|
59
|
-
bio: z.string().max(160).nullable().optional(),
|
|
60
|
-
/** URL to avatar image — nullable for the same reason as displayName. */
|
|
61
|
-
avatarUrl: z.string().url().nullable().optional(),
|
|
62
|
-
/** Optional personal website surfaced on the public profile. */
|
|
63
|
-
website: httpsUrl().nullable().optional(),
|
|
64
|
-
/** Up to 5 additional public links (label + URL) shown under the bio. */
|
|
65
|
-
links: z.array(z.object({
|
|
66
|
-
label: z.string().min(1).max(40),
|
|
67
|
-
url: httpsUrl()
|
|
68
|
-
})).max(5).optional(),
|
|
69
|
-
/** When true and a Bluesky identity is linked, surfaces it on the public profile. */
|
|
70
|
-
showBlueskyPublicly: z.boolean().optional(),
|
|
71
|
-
/** Server timestamp of creation */
|
|
72
|
-
createdAt: FirestoreTimestampSchema,
|
|
73
|
-
/** Individual account tier — free or creator_pro */
|
|
74
|
-
tier: z.enum(["free", "creator_pro"]).default("free"),
|
|
75
|
-
/** Account status. Deactivated accounts retain data but are excluded from lookups. */
|
|
76
|
-
status: z.enum(["active", "deactivated"]).default("active"),
|
|
77
|
-
/** Timestamp when the account was deactivated (soft deleted) */
|
|
78
|
-
deactivatedAt: FirestoreTimestampSchema.optional(),
|
|
79
|
-
/**
|
|
80
|
-
* Denormalized org memberships — { orgId: role } for fast lookup.
|
|
81
|
-
* Source of truth is organizations/{orgId}/members/{userId}.
|
|
82
|
-
* Kept in sync by Cloud Function trigger.
|
|
83
|
-
*/
|
|
84
|
-
orgMemberships: z.record(z.string(), z.enum(["owner", "admin", "member"])).optional()
|
|
85
|
-
});
|
|
86
|
-
var PromptRecordSchema = z.object({
|
|
87
|
-
/** Unique Prompt ID */
|
|
88
|
-
id: z.string(),
|
|
89
|
-
/** ID of the User who created this prompt. Always a user ID, never an org ID. @see UserRecord */
|
|
90
|
-
authorId: z.string(),
|
|
91
|
-
/** Organization context this prompt belongs to (null = personal/no org) */
|
|
92
|
-
orgId: z.string().nullable().optional(),
|
|
93
|
-
/** The main text of the question/prompt */
|
|
94
|
-
title: z.string().min(3),
|
|
95
|
-
/** Optional extra context */
|
|
96
|
-
description: z.string().nullable().optional(),
|
|
97
|
-
/** User who created this prompt (differs from authorId when org-owned) */
|
|
98
|
-
createdBy: z.string().optional(),
|
|
99
|
-
/** URL to the recorded audio file (GCS) */
|
|
100
|
-
audioUrl: z.string().url().or(z.literal("")),
|
|
101
|
-
/** AT Protocol blob reference (future replacement for audioUrl) */
|
|
102
|
-
audio: BlobRefSchema.optional(),
|
|
103
|
-
/**
|
|
104
|
-
* AT Protocol URI returned by the publisher after a successful
|
|
105
|
-
* `repo.putRecord` against the author's PDS — e.g.
|
|
106
|
-
* `at://did:plc:abc123/com.voxpop.audio.prompt/3kj4...`. Optional,
|
|
107
|
-
* no migration: existing rows leave it unset. Format-validated so
|
|
108
|
-
* malformed strings surface at the schema-parse boundary rather than
|
|
109
|
-
* being silently stored.
|
|
110
|
-
*/
|
|
111
|
-
atprotoUri: z.string().regex(/^at:\/\/.+/).optional(),
|
|
112
|
-
/** Server timestamp of creation */
|
|
113
|
-
createdAt: FirestoreTimestampSchema,
|
|
114
|
-
/**
|
|
115
|
-
* Life-cycle status.
|
|
116
|
-
* - `live`: Visible and accepting replies.
|
|
117
|
-
* - `archived`: Visible but closed for new replies.
|
|
118
|
-
* - `deleted`: Soft deleted.
|
|
119
|
-
*/
|
|
120
|
-
status: z.enum(["live", "archived", "deleted"]).default("live"),
|
|
121
|
-
/** AI Enrichment Fields */
|
|
122
|
-
aiStatus: z.enum(["pending", "complete", "error"]).optional(),
|
|
123
|
-
aiError: z.string().optional(),
|
|
124
|
-
aiSummary: z.string().optional(),
|
|
125
|
-
aiLabels: z.array(z.string()).optional(),
|
|
126
|
-
transcription: z.string().optional(),
|
|
127
|
-
/** Pre-computed waveform peaks (normalized 0–1) for instant audio visualization */
|
|
128
|
-
waveformPeaks: z.array(z.number()).optional(),
|
|
129
|
-
/** Social Share Video Fields */
|
|
130
|
-
socialVideoUrl: z.string().url().optional(),
|
|
131
|
-
socialVideoStoragePath: z.string().optional(),
|
|
132
|
-
socialVideoStatus: z.enum(["pending", "complete", "error"]).optional(),
|
|
133
|
-
socialVideoError: z.string().optional(),
|
|
134
|
-
/** The audio URL/path used to generate the current video (for cache invalidation) */
|
|
135
|
-
socialVideoSourceAudio: z.string().optional()
|
|
136
|
-
});
|
|
137
|
-
var ReplyRecordSchema = z.object({
|
|
138
|
-
/** Unique Reply ID */
|
|
139
|
-
id: z.string(),
|
|
140
|
-
/** The Prompt being replied to. @see PromptRecord */
|
|
141
|
-
promptId: z.string(),
|
|
142
|
-
/** The User who replied. @see UserRecord */
|
|
143
|
-
authorId: z.string(),
|
|
144
|
-
/** URL to the recorded audio file (GCS) */
|
|
145
|
-
audioUrl: z.string().url(),
|
|
146
|
-
/** AT Protocol blob reference (future replacement for audioUrl) */
|
|
147
|
-
audio: BlobRefSchema.optional(),
|
|
148
|
-
/** Server timestamp of creation */
|
|
149
|
-
createdAt: FirestoreTimestampSchema,
|
|
150
|
-
/**
|
|
151
|
-
* Life-cycle status.
|
|
152
|
-
* - `live`: Visible and accepting replies.
|
|
153
|
-
* - `archived`: Visible but closed for new replies.
|
|
154
|
-
* - `deleted`: Soft deleted.
|
|
155
|
-
*/
|
|
156
|
-
status: z.enum(["live", "archived", "deleted"]).default("live"),
|
|
157
|
-
/**
|
|
158
|
-
* Pre-computed waveform peaks (normalized 0–1) for instant audio
|
|
159
|
-
* visualization. **Stays on canonical** (does NOT move to the
|
|
160
|
-
* enrichment doc) — produced by a plain ffmpeg pass at ingestion,
|
|
161
|
-
* not an AI step; a self-hoster without paid-tier AI still needs
|
|
162
|
-
* this on every reply for the audio player. See
|
|
163
|
-
* `specs/ai-enrichment-split.md` § 5.
|
|
164
|
-
*/
|
|
165
|
-
waveformPeaks: z.array(z.number()).optional(),
|
|
166
|
-
/**
|
|
167
|
-
* Duration of the audio in seconds, computed server-side from
|
|
168
|
-
* ffmpeg. **Stays on canonical** (same reasoning as `waveformPeaks`
|
|
169
|
-
* above — ingestion ffmpeg output, not an AI enrichment). See
|
|
170
|
-
* `specs/ai-enrichment-split.md` § 5.
|
|
171
|
-
*/
|
|
172
|
-
audioDurationSec: z.number().optional()
|
|
173
|
-
});
|
|
174
|
-
var ReplyEnrichmentRecordSchema = z.object({
|
|
175
|
-
id: z.string(),
|
|
176
|
-
/** Private notes by the prompt author about this reply. */
|
|
177
|
-
notes: z.string().optional(),
|
|
178
|
-
// === AI-enrichment fields (sole source of truth post Stage 4) ===
|
|
179
|
-
//
|
|
180
|
-
// These lifted off canonical in Stage 4 of `specs/ai-enrichment-split.md`.
|
|
181
|
-
// Writers (`functions/`) route AI updates here via the split-write
|
|
182
|
-
// helper in `functions/src/services/replyEnrichmentDualWrite.ts`;
|
|
183
|
-
// readers source them via the hydrator's enrichment branch (see
|
|
184
|
-
// `packages/core/services/hydration.ts`).
|
|
185
|
-
// --- AI core (Gemini-generated) ---
|
|
186
|
-
aiStatus: z.enum(["pending", "complete", "error", "skipped_too_short"]).optional(),
|
|
187
|
-
aiError: z.string().optional(),
|
|
188
|
-
aiSummary: z.string().optional(),
|
|
189
|
-
aiLabels: z.array(z.string()).optional(),
|
|
190
|
-
transcription: z.string().optional(),
|
|
191
|
-
sentiment: z.enum(["Positive", "Negative", "Neutral"]).optional(),
|
|
192
|
-
/** Must match the widened enum in `ReplyRecordSchema.energyLevel`. */
|
|
193
|
-
energyLevel: z.enum(["High", "Low", "Neutral"]).optional(),
|
|
194
|
-
engagementScore: z.number().min(1).max(10).optional(),
|
|
195
|
-
// --- Voice isolation (ElevenLabs, paid tier) ---
|
|
196
|
-
/** Noise-reduced audio URL — replaces `audioUrl` for downstream players when present. PUBLIC. */
|
|
197
|
-
enhancedAudioUrl: z.string().url().optional(),
|
|
198
|
-
/** Storage path companion to `enhancedAudioUrl` — private. */
|
|
199
|
-
enhancedStoragePath: z.string().optional(),
|
|
200
|
-
// --- Social-share video (paid tier) ---
|
|
201
|
-
//
|
|
202
|
-
// All `socialVideo*` fields are creator-only. The URL points at the
|
|
203
|
-
// generated artifact (a video file the creator can download and post
|
|
204
|
-
// to social media); the reply detail page does NOT render it.
|
|
205
|
-
socialVideoUrl: z.string().url().optional(),
|
|
206
|
-
socialVideoStoragePath: z.string().optional(),
|
|
207
|
-
socialVideoStatus: z.enum(["pending", "complete", "error"]).optional(),
|
|
208
|
-
socialVideoError: z.string().optional(),
|
|
209
|
-
/** The audio URL/path used to generate the current video (for cache invalidation). */
|
|
210
|
-
socialVideoSourceAudio: z.string().optional()
|
|
211
|
-
});
|
|
212
|
-
var PersonEnrichmentRecordSchema = z.object({
|
|
213
|
-
/** Composite key `${viewerUid}_${targetUid}`. */
|
|
214
|
-
id: z.string(),
|
|
215
|
-
/** Per-viewer CRM notes about the target. */
|
|
216
|
-
notes: z.string().optional(),
|
|
217
|
-
/** Per-viewer freeform tags about the target. */
|
|
218
|
-
tags: z.array(z.string()).optional(),
|
|
219
|
-
// === Identity-merge: alias set ===
|
|
220
|
-
//
|
|
221
|
-
// Other identifiers the viewer has declared to be the SAME person as
|
|
222
|
-
// this entry's `targetUid`. vCard/URI-aligned: each entry is a
|
|
223
|
-
// scheme-prefixed identifier, so one field generalizes across networks
|
|
224
|
-
// AND across the future contact-sync import (which carries phone/email):
|
|
225
|
-
// "uid:<firebaseUid>" | "did:plc:…" | "handle:bob.bsky.social"
|
|
226
|
-
// | "tel:+15551234567" | "mailto:x@example.com"
|
|
227
|
-
// Mirrors vCard 4.0's `UID` + `CLIENTPIDMAP`/`PID` source-tracking
|
|
228
|
-
// (RFC 6350) — the standard answer to "the same person from multiple
|
|
229
|
-
// sources". See `specs/people-lexicon-prior-art.md`. The People
|
|
230
|
-
// read-path collapses any replier whose "uid:<uid>" appears here into
|
|
231
|
-
// this primary entry. Empty until the merge feature is used.
|
|
232
|
-
aliases: z.array(z.string()).optional(),
|
|
233
|
-
lastUpdated: FirestoreTimestampSchema.optional()
|
|
234
|
-
});
|
|
235
|
-
var SipEnrichmentSchema = z.object({
|
|
236
|
-
sipUri: z.string(),
|
|
237
|
-
sipUsername: z.string(),
|
|
238
|
-
sipSecret: z.string(),
|
|
239
|
-
provider: z.enum(["twilio", "plivo", "internal"])
|
|
240
|
-
});
|
|
241
|
-
var CallForwardingConfigSchema = z.object({
|
|
242
|
-
/** User's personal phone number (E.164) */
|
|
243
|
-
phoneNumber: z.string(),
|
|
244
|
-
/** Line type from Twilio Lookup v2 */
|
|
245
|
-
lineType: z.string().nullable(),
|
|
246
|
-
/** Carrier name from Twilio Lookup v2 */
|
|
247
|
-
carrier: z.string().nullable(),
|
|
248
|
-
/** free = shared Twilio number (ForwardedFrom routing), paid = dedicated number */
|
|
249
|
-
tier: z.enum(["free", "paid"]),
|
|
250
|
-
/** The VoxPop Twilio number calls forward to (E.164) */
|
|
251
|
-
voxpopNumber: z.string(),
|
|
252
|
-
/** Twilio Phone Number SID (paid tier only) */
|
|
253
|
-
twilioNumberSid: z.string().nullable().optional(),
|
|
254
|
-
/** Forwarding verification state */
|
|
255
|
-
verificationStatus: z.enum(["pending", "verifying", "verified", "failed"]).default("pending"),
|
|
256
|
-
/** Last verification attempt timestamp */
|
|
257
|
-
lastVerificationAt: FirestoreTimestampSchema.optional(),
|
|
258
|
-
/** Number of verification attempts */
|
|
259
|
-
verificationAttempts: z.number().default(0),
|
|
260
|
-
/** Reason for verification failure */
|
|
261
|
-
failureReason: z.string().nullable().optional(),
|
|
262
|
-
/** Whether call forwarding is active */
|
|
263
|
-
enabled: z.boolean().default(false),
|
|
264
|
-
createdAt: FirestoreTimestampSchema,
|
|
265
|
-
updatedAt: FirestoreTimestampSchema
|
|
266
|
-
});
|
|
267
|
-
var ConnectorTypeSchema = z.enum(["telephony"]);
|
|
268
|
-
var ConnectorStatusSchema = z.object({
|
|
269
|
-
/** Coarse, generic lifecycle the control-plane UI can render without
|
|
270
|
-
* connector-specific knowledge. */
|
|
271
|
-
state: z.enum(["unconfigured", "pending", "active", "error", "disabled"]).default("unconfigured"),
|
|
272
|
-
detail: z.string().nullable().optional(),
|
|
273
|
-
/** Opaque, connector-specific status detail (e.g. telephony's
|
|
274
|
-
* `{ verificationStatus, verificationAttempts, failureReason }`). Connector-
|
|
275
|
-
* owned like the rest of `status` — never user-writable. Nullable so a doc
|
|
276
|
-
* that stored `data: null` round-trips without a parse error. */
|
|
277
|
-
data: z.record(z.unknown()).nullable().optional(),
|
|
278
|
-
updatedAt: FirestoreTimestampSchema.optional()
|
|
279
|
-
});
|
|
280
|
-
var ConnectorConfigRecordSchema = z.object({
|
|
281
|
-
connectorType: ConnectorTypeSchema,
|
|
282
|
-
/** The owning user. Org-scoping (ownerId as an orgId) is a later step. */
|
|
283
|
-
ownerId: z.string(),
|
|
284
|
-
/** Opaque, connector-specific blob. Core does not interpret this. */
|
|
285
|
-
settings: z.record(z.unknown()).default({}),
|
|
286
|
-
/** Reference into a secret store (e.g. Secret Manager key). Never a raw secret. */
|
|
287
|
-
secretRef: z.string().nullable().optional(),
|
|
288
|
-
enabled: z.boolean().default(false),
|
|
289
|
-
status: ConnectorStatusSchema.default({ state: "unconfigured" }),
|
|
290
|
-
createdAt: FirestoreTimestampSchema,
|
|
291
|
-
updatedAt: FirestoreTimestampSchema
|
|
292
|
-
});
|
|
293
|
-
var ScreeningRuleRecordSchema = z.object({
|
|
294
|
-
id: z.string(),
|
|
295
|
-
ownerId: z.string(),
|
|
296
|
-
/** The caller number this rule matches (E.164). Format-enforced at the
|
|
297
|
-
* record level so any writer (API, future contact-sync/callback) can't
|
|
298
|
-
* persist a malformed number. */
|
|
299
|
-
e164: z.string().regex(/^\+[1-9]\d{6,14}$/, "Must be an E.164 phone number"),
|
|
300
|
-
/** Display label, e.g. "Mom" / "Delta Airlines". null = unlabeled. */
|
|
301
|
-
label: z.string().nullable().optional(),
|
|
302
|
-
/** `allow` = ring through; `screen` = async voicemail. */
|
|
303
|
-
action: z.enum(["allow", "screen"]),
|
|
304
|
-
/** Provenance. `manual` = user-created; the others are future writers. */
|
|
305
|
-
source: z.enum(["manual", "contact-sync", "callback"]),
|
|
306
|
-
/** null = permanent; a date = self-expiring exception. */
|
|
307
|
-
expiresAt: FirestoreTimestampSchema.nullable().optional(),
|
|
308
|
-
createdAt: FirestoreTimestampSchema
|
|
309
|
-
});
|
|
310
|
-
var OrganizationRecordSchema = z.object({
|
|
311
|
-
id: z.string(),
|
|
312
|
-
/** Display name of the organization */
|
|
313
|
-
name: z.string().min(3).max(50),
|
|
314
|
-
/**
|
|
315
|
-
* Unique handle for the organization (e.g. voxpop.com/@mypodcast).
|
|
316
|
-
* Used for public URLs.
|
|
317
|
-
*/
|
|
318
|
-
slug: z.string().min(3).max(30).regex(/^[a-z0-9-]+$/),
|
|
319
|
-
/** URL to avatar/logo */
|
|
320
|
-
avatarUrl: z.string().url().optional(),
|
|
321
|
-
/** URL to the podcast RSS feed */
|
|
322
|
-
rssFeedUrl: z.string().url().optional(),
|
|
323
|
-
/** External website URL */
|
|
324
|
-
websiteUrl: httpsUrl().optional(),
|
|
325
|
-
/** Description or tagline */
|
|
326
|
-
description: z.string().optional(),
|
|
327
|
-
/** Owner ID (User ID) */
|
|
328
|
-
ownerId: z.string(),
|
|
329
|
-
/** Server timestamp of creation */
|
|
330
|
-
createdAt: FirestoreTimestampSchema,
|
|
331
|
-
/** Verified domain (e.g., "acme.com") — enables auto-join, enterprise features */
|
|
332
|
-
domain: z.string().nullable().optional(),
|
|
333
|
-
/** Whether the domain has been verified via DNS TXT record */
|
|
334
|
-
domainVerified: z.boolean().default(false),
|
|
335
|
-
/** DNS verification token (stored server-side until verification completes) */
|
|
336
|
-
domainVerificationToken: z.string().optional(),
|
|
337
|
-
/** Billing email — required for paid orgs, where invoices go */
|
|
338
|
-
billingEmail: z.string().email().nullable().optional(),
|
|
339
|
-
/**
|
|
340
|
-
* Tier determines isolation and feature set. Orgs are meant to be paid
|
|
341
|
-
* (business or enterprise); free/pro exist on the enum for the individual track.
|
|
342
|
-
* Default is provisionally `business` (the entry paid tier) — it's assigned at
|
|
343
|
-
* creation with no subscription behind it yet, so it stays provisional until billing
|
|
344
|
-
* promotes/reconciles the org. See docs/tech-debt.md "Org tier billing reconciliation".
|
|
345
|
-
*/
|
|
346
|
-
tier: z.enum(["free", "pro", "business", "enterprise"]).default("business"),
|
|
347
|
-
/** Stripe Customer ID */
|
|
348
|
-
stripeCustomerId: z.string().optional(),
|
|
349
|
-
/** Subscription Status */
|
|
350
|
-
subscriptionStatus: z.enum(["active", "trialing", "past_due", "canceled", "unpaid"]).optional()
|
|
351
|
-
});
|
|
352
|
-
var OrganizationMemberRecordSchema = z.object({
|
|
353
|
-
orgId: z.string(),
|
|
354
|
-
userId: z.string(),
|
|
355
|
-
/** Role in the organization */
|
|
356
|
-
role: z.enum(["owner", "admin", "member"]),
|
|
357
|
-
/** Server timestamp of joining */
|
|
358
|
-
joinedAt: FirestoreTimestampSchema,
|
|
359
|
-
invitedBy: z.string().optional()
|
|
360
|
-
});
|
|
361
|
-
var OrgInviteRecordSchema = z.object({
|
|
362
|
-
id: z.string(),
|
|
363
|
-
orgId: z.string(),
|
|
364
|
-
/** Email the invite was sent to */
|
|
365
|
-
email: z.string().email(),
|
|
366
|
-
/** Role to assign on acceptance */
|
|
367
|
-
role: z.enum(["admin", "member"]),
|
|
368
|
-
/** User ID of who sent the invite */
|
|
369
|
-
invitedBy: z.string(),
|
|
370
|
-
/** Invite lifecycle status */
|
|
371
|
-
status: z.enum(["pending", "accepted", "expired", "revoked"]).default("pending"),
|
|
372
|
-
/** Server timestamp of creation */
|
|
373
|
-
createdAt: FirestoreTimestampSchema,
|
|
374
|
-
/** When this invite expires */
|
|
375
|
-
expiresAt: FirestoreTimestampSchema
|
|
376
|
-
});
|
|
377
|
-
|
|
378
|
-
export { CallForwardingConfigSchema, ConnectorConfigRecordSchema, ConnectorStatusSchema, ConnectorTypeSchema, FirestoreTimestampSchema, OrgInviteRecordSchema, OrganizationMemberRecordSchema, OrganizationRecordSchema, PersonEnrichmentRecordSchema, PromptRecordSchema, ReplyEnrichmentRecordSchema, ReplyRecordSchema, ScreeningRuleRecordSchema, SipEnrichmentSchema, UserRecordSchema, httpsUrl };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
// types/blob.ts
|
|
4
|
-
var BlobRefSchema = z.object({
|
|
5
|
-
/** Discriminator for AT Protocol type system */
|
|
6
|
-
$type: z.literal("blob"),
|
|
7
|
-
/** Content Identifier (CID) or URL pointing to the blob */
|
|
8
|
-
ref: z.string(),
|
|
9
|
-
/** MIME type of the blob (e.g., 'audio/webm') */
|
|
10
|
-
mimeType: z.string(),
|
|
11
|
-
/** Size of the blob in bytes */
|
|
12
|
-
size: z.number()
|
|
13
|
-
});
|
|
14
|
-
function resolveAudioUrl(record) {
|
|
15
|
-
var _a;
|
|
16
|
-
if ((_a = record.audio) == null ? void 0 : _a.ref) return record.audio.ref;
|
|
17
|
-
return record.audioUrl;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { BlobRefSchema, resolveAudioUrl };
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { ReplyRefSchema, AudioEmbedSchema } from './chunk-BUNMR4ZO.js';
|
|
2
|
-
import { ConnectorConfigRecordSchema } from './chunk-3WZJXJNU.js';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
|
|
5
|
-
var CreateAudioPostRequestSchema = z.object({
|
|
6
|
-
/** User-authored text; may be empty for pure-audio posts. */
|
|
7
|
-
text: z.string().max(3e3).default(""),
|
|
8
|
-
/** Optional headline (prompt feature). */
|
|
9
|
-
title: z.string().max(3e3).optional(),
|
|
10
|
-
/** The uploaded audio attachment. */
|
|
11
|
-
embed: AudioEmbedSchema.optional(),
|
|
12
|
-
/** Present ⇒ this is a reply (StrongRef root + parent). */
|
|
13
|
-
reply: ReplyRefSchema.optional(),
|
|
14
|
-
/** BCP-47 language tags. */
|
|
15
|
-
langs: z.array(z.string()).max(3).optional(),
|
|
16
|
-
/** Author self-label values (content warnings). */
|
|
17
|
-
selfLabels: z.array(z.string()).optional()
|
|
18
|
-
}).refine((d) => !(d.reply && d.title), {
|
|
19
|
-
message: "Replies cannot have a title",
|
|
20
|
-
path: ["title"]
|
|
21
|
-
}).refine((d) => d.text.trim().length > 0 || !!d.embed, {
|
|
22
|
-
message: "Post must have text or an audio embed",
|
|
23
|
-
path: ["text"]
|
|
24
|
-
});
|
|
25
|
-
var CreatePromptRequestSchema = z.object({
|
|
26
|
-
// Bounds chosen so the public prompt hero never needs to clip: title +
|
|
27
|
-
// description sit between the two dots inside an h-dvh, overflow-hidden
|
|
28
|
-
// layout. 80/200 keeps typical content to a few lines on short phones.
|
|
29
|
-
// (Record-level schema stays unbounded so any pre-existing longer values
|
|
30
|
-
// still read cleanly — this only gates new writes.)
|
|
31
|
-
title: z.string().min(3).max(80),
|
|
32
|
-
description: z.string().max(200).optional(),
|
|
33
|
-
audioUrl: z.string().url().or(z.literal("")),
|
|
34
|
-
setAsGreeting: z.union([z.boolean(), z.string().transform((val) => val === "true")]).optional(),
|
|
35
|
-
/** Explicit org context override (normally inferred from auth.currentOrg) */
|
|
36
|
-
orgId: z.string().nullable().optional()
|
|
37
|
-
});
|
|
38
|
-
var UpdateProfileRequestSchema = z.object({
|
|
39
|
-
handle: z.string().min(3).max(20).regex(/^[a-zA-Z0-9_]+$/).optional(),
|
|
40
|
-
displayName: z.string().max(50).optional(),
|
|
41
|
-
bio: z.string().max(160).optional(),
|
|
42
|
-
avatarUrl: z.string().url().nullable().optional(),
|
|
43
|
-
usageIntent: z.string().max(200).nullable().optional(),
|
|
44
|
-
/**
|
|
45
|
-
* Personal website surfaced on the public profile. Accepts a URL, empty
|
|
46
|
-
* string, or null from the client; normalizes empty string → null so the
|
|
47
|
-
* value stored on `UserRecord` (which requires `.url() | null`) round-trips
|
|
48
|
-
* cleanly through `UserRecordSchema.parse` on subsequent reads.
|
|
49
|
-
*/
|
|
50
|
-
website: z.union([z.string().url(), z.literal(""), z.null()]).optional().transform((v) => v === "" ? null : v),
|
|
51
|
-
/** Up to 5 public links (label + URL) shown under the bio. */
|
|
52
|
-
links: z.array(z.object({
|
|
53
|
-
label: z.string().min(1).max(40),
|
|
54
|
-
url: z.string().url()
|
|
55
|
-
})).max(5).optional(),
|
|
56
|
-
/** When true, surfaces the linked Bluesky identity on the public profile. */
|
|
57
|
-
showBlueskyPublicly: z.boolean().optional()
|
|
58
|
-
});
|
|
59
|
-
var FcmTokenRequestSchema = z.object({
|
|
60
|
-
// FCM registration tokens are typically ~163–200 chars; Google's docs
|
|
61
|
-
// don't publish a hard max but 4096 is a safe upper bound that prevents
|
|
62
|
-
// multi-MB payloads while accommodating any plausible FCM token format.
|
|
63
|
-
token: z.string().min(1).max(4096)
|
|
64
|
-
});
|
|
65
|
-
var BadgeResetRequestSchema = z.object({
|
|
66
|
-
type: z.enum(["new_replier", "unread_reply"])
|
|
67
|
-
});
|
|
68
|
-
var CreateOrgRequestSchema = z.object({
|
|
69
|
-
name: z.string().min(3).max(50),
|
|
70
|
-
slug: z.string().min(3).max(30).regex(/^[a-z0-9-]+$/),
|
|
71
|
-
avatarUrl: z.string().url().optional(),
|
|
72
|
-
rssFeedUrl: z.string().url().optional(),
|
|
73
|
-
websiteUrl: z.string().url().optional(),
|
|
74
|
-
// 500 chars — enough for a multi-sentence blurb, prevents multi-MB writes.
|
|
75
|
-
description: z.string().max(500).optional()
|
|
76
|
-
});
|
|
77
|
-
var UpdateOrgRequestSchema = z.object({
|
|
78
|
-
name: z.string().min(3).max(50).optional(),
|
|
79
|
-
slug: z.string().min(3).max(30).regex(/^[a-z0-9-]+$/).optional(),
|
|
80
|
-
// 500 chars — matches CreateOrgRequestSchema.description.
|
|
81
|
-
description: z.string().max(500).optional(),
|
|
82
|
-
avatarUrl: z.string().url().nullable().optional(),
|
|
83
|
-
rssFeedUrl: z.string().url().nullable().optional(),
|
|
84
|
-
websiteUrl: z.string().url().nullable().optional(),
|
|
85
|
-
billingEmail: z.string().email().nullable().optional(),
|
|
86
|
-
// 253 chars — the DNS spec maximum for a fully-qualified domain name.
|
|
87
|
-
domain: z.string().max(253).nullable().optional()
|
|
88
|
-
});
|
|
89
|
-
var CreateOrgInviteRequestSchema = z.object({
|
|
90
|
-
email: z.string().email(),
|
|
91
|
-
role: z.enum(["admin", "member"])
|
|
92
|
-
});
|
|
93
|
-
var UpdateMemberRoleRequestSchema = z.object({
|
|
94
|
-
role: z.enum(["admin", "member"])
|
|
95
|
-
});
|
|
96
|
-
var SwitchOrgRequestSchema = z.object({
|
|
97
|
-
/** orgId to switch to, or null to switch to personal context */
|
|
98
|
-
orgId: z.string().nullable()
|
|
99
|
-
});
|
|
100
|
-
var ConnectorConfigInputSchema = ConnectorConfigRecordSchema.omit({
|
|
101
|
-
connectorType: true,
|
|
102
|
-
ownerId: true,
|
|
103
|
-
status: true,
|
|
104
|
-
createdAt: true,
|
|
105
|
-
updatedAt: true
|
|
106
|
-
});
|
|
107
|
-
var ConnectorConfigUpdateSchema = ConnectorConfigInputSchema.partial();
|
|
108
|
-
var PersonNotesUpdateSchema = z.object({
|
|
109
|
-
notes: z.string().max(1e4).optional(),
|
|
110
|
-
tags: z.array(z.string().max(64)).max(50).optional()
|
|
111
|
-
});
|
|
112
|
-
var PersonMergeRequestSchema = z.object({
|
|
113
|
-
alternateUid: z.string().min(1)
|
|
114
|
-
});
|
|
115
|
-
var ScreeningRuleInputSchema = z.object({
|
|
116
|
-
e164: z.string().regex(/^\+[1-9]\d{6,14}$/, "Must be an E.164 phone number"),
|
|
117
|
-
label: z.string().max(120).nullable().optional(),
|
|
118
|
-
action: z.enum(["allow", "screen"]),
|
|
119
|
-
expiresAt: z.union([z.string(), z.number()]).nullable().optional().refine((v) => v == null || !Number.isNaN(new Date(v).getTime()), {
|
|
120
|
-
message: "Must be a valid ISO date string or epoch-ms timestamp"
|
|
121
|
-
})
|
|
122
|
-
});
|
|
123
|
-
var ScreeningRuleUpdateSchema = ScreeningRuleInputSchema.partial();
|
|
124
|
-
var UpdateReplyStatusRequestSchema = z.object({
|
|
125
|
-
status: z.enum(["live", "archived", "deleted"])
|
|
126
|
-
});
|
|
127
|
-
var BulkReplyActionRequestSchema = z.object({
|
|
128
|
-
replyIds: z.array(z.string()).min(1).max(100),
|
|
129
|
-
action: z.enum(["markRead", "archive", "delete", "restore"])
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
export { BadgeResetRequestSchema, BulkReplyActionRequestSchema, ConnectorConfigInputSchema, ConnectorConfigUpdateSchema, CreateAudioPostRequestSchema, CreateOrgInviteRequestSchema, CreateOrgRequestSchema, CreatePromptRequestSchema, FcmTokenRequestSchema, PersonMergeRequestSchema, PersonNotesUpdateSchema, ScreeningRuleInputSchema, ScreeningRuleUpdateSchema, SwitchOrgRequestSchema, UpdateMemberRoleRequestSchema, UpdateOrgRequestSchema, UpdateProfileRequestSchema, UpdateReplyStatusRequestSchema };
|