@antiphony/shared 0.3.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.
Files changed (44) hide show
  1. package/README.md +4 -4
  2. package/dist/cjs/api-codecs.cjs +74 -147
  3. package/dist/cjs/api-codecs.d.cts +105 -60
  4. package/dist/cjs/index.cjs +84 -197
  5. package/dist/cjs/index.d.cts +89 -7
  6. package/dist/cjs/nsid.cjs +6 -9
  7. package/dist/cjs/nsid.d.cts +7 -8
  8. package/dist/cjs/types/audio.cjs +60 -124
  9. package/dist/cjs/types/audio.d.cts +226 -185
  10. package/dist/cjs/types/blob.cjs +5 -9
  11. package/dist/cjs/types/blob.d.cts +21 -21
  12. package/dist/cjs/types/records.cjs +0 -45
  13. package/dist/cjs/types/records.d.cts +1 -103
  14. package/dist/esm/api-codecs.d.ts +135 -90
  15. package/dist/esm/api-codecs.js +4 -5
  16. package/dist/esm/chunk-D655OH2I.js +35 -0
  17. package/dist/esm/chunk-RUUHUNZ6.js +37 -0
  18. package/dist/esm/{chunk-6LROFBKK.js → chunk-SBYNIQRZ.js} +7 -9
  19. package/dist/esm/chunk-SMK4OZNU.js +17 -0
  20. package/dist/esm/{chunk-F7IHVM34.js → chunk-WL2GSPGC.js} +64 -12
  21. package/dist/esm/index.d.ts +89 -7
  22. package/dist/esm/index.js +5 -7
  23. package/dist/esm/nsid.d.ts +7 -8
  24. package/dist/esm/nsid.js +1 -1
  25. package/dist/esm/types/audio.d.ts +303 -262
  26. package/dist/esm/types/audio.js +3 -4
  27. package/dist/esm/types/blob.d.ts +21 -21
  28. package/dist/esm/types/blob.js +1 -1
  29. package/dist/esm/types/records.d.ts +1 -103
  30. package/dist/esm/types/records.js +1 -1
  31. package/package.json +90 -26
  32. package/dist/cjs/types/api.cjs +0 -166
  33. package/dist/cjs/types/api.d.cts +0 -242
  34. package/dist/cjs/types/views.cjs +0 -179
  35. package/dist/cjs/types/views.d.cts +0 -726
  36. package/dist/esm/chunk-5EHV73BA.js +0 -20
  37. package/dist/esm/chunk-FDM5FDN4.js +0 -46
  38. package/dist/esm/chunk-IHIBHQBJ.js +0 -78
  39. package/dist/esm/chunk-R6SBR3IG.js +0 -97
  40. package/dist/esm/chunk-Y6HNNRVD.js +0 -12
  41. package/dist/esm/types/api.d.ts +0 -242
  42. package/dist/esm/types/api.js +0 -4
  43. package/dist/esm/types/views.d.ts +0 -726
  44. package/dist/esm/types/views.js +0 -3
@@ -6,18 +6,14 @@ var zod = require('zod');
6
6
  var BlobRefSchema = zod.z.object({
7
7
  /** Discriminator for AT Protocol type system */
8
8
  $type: zod.z.literal("blob"),
9
- /** Content Identifier (CID) or URL pointing to the blob */
10
- ref: zod.z.string(),
9
+ /** IPLD link to the blob bytes: the content CID. */
10
+ ref: zod.z.object({
11
+ $link: zod.z.string().min(1)
12
+ }),
11
13
  /** MIME type of the blob (e.g., 'audio/webm') */
12
14
  mimeType: zod.z.string(),
13
15
  /** Size of the blob in bytes */
14
- size: zod.z.number()
16
+ size: zod.z.number().int().min(0)
15
17
  });
16
- function resolveAudioUrl(record) {
17
- var _a;
18
- if ((_a = record.audio) == null ? void 0 : _a.ref) return record.audio.ref;
19
- return record.audioUrl;
20
- }
21
18
 
22
19
  exports.BlobRefSchema = BlobRefSchema;
23
- exports.resolveAudioUrl = resolveAudioUrl;
@@ -1,45 +1,45 @@
1
1
  import { z } from 'zod';
2
2
 
3
3
  /**
4
- * AT Protocol Blob Reference.
4
+ * AT Protocol Blob Reference — the canonical atproto JSON shape:
5
5
  *
6
- * Represents a reference to a binary blob (audio, image, etc.) stored
7
- * outside the record itself. This aligns with AT Protocol's blob handling
8
- * where binary data is stored in the PDS blob store with a CID reference.
6
+ * { "$type": "blob", "ref": { "$link": "<cid>" }, "mimeType", "size" }
9
7
  *
10
- * During the transition from `audioUrl: string` to `audio: BlobRef`,
11
- * both fields coexist. Use `resolveAudioUrl()` to get the correct URL.
8
+ * `ref.$link` is a REAL content CID (CIDv1, raw codec, sha2-256 over the
9
+ * blob bytes), computed at upload time. Storage location is derived from the
10
+ * CID (`blobs/{originAppId}/{cid}`), never stored on the record — records
11
+ * carry content addresses, not provider URLs, so they stay portable.
12
12
  */
13
13
  declare const BlobRefSchema: z.ZodObject<{
14
14
  /** Discriminator for AT Protocol type system */
15
15
  $type: z.ZodLiteral<"blob">;
16
- /** Content Identifier (CID) or URL pointing to the blob */
17
- ref: z.ZodString;
16
+ /** IPLD link to the blob bytes: the content CID. */
17
+ ref: z.ZodObject<{
18
+ $link: z.ZodString;
19
+ }, "strip", z.ZodTypeAny, {
20
+ $link: string;
21
+ }, {
22
+ $link: string;
23
+ }>;
18
24
  /** MIME type of the blob (e.g., 'audio/webm') */
19
25
  mimeType: z.ZodString;
20
26
  /** Size of the blob in bytes */
21
27
  size: z.ZodNumber;
22
28
  }, "strip", z.ZodTypeAny, {
23
29
  $type: "blob";
24
- ref: string;
30
+ ref: {
31
+ $link: string;
32
+ };
25
33
  mimeType: string;
26
34
  size: number;
27
35
  }, {
28
36
  $type: "blob";
29
- ref: string;
37
+ ref: {
38
+ $link: string;
39
+ };
30
40
  mimeType: string;
31
41
  size: number;
32
42
  }>;
33
43
  type BlobRef = z.infer<typeof BlobRefSchema>;
34
- /**
35
- * Resolve the audio URL from a record that may have either `audio` (BlobRef)
36
- * or `audioUrl` (legacy string) field.
37
- *
38
- * Prefers BlobRef.ref if present, falls back to audioUrl.
39
- */
40
- declare function resolveAudioUrl(record: {
41
- audio?: BlobRef;
42
- audioUrl?: string;
43
- }): string | undefined;
44
44
 
45
- export { type BlobRef, BlobRefSchema, resolveAudioUrl };
45
+ export { type BlobRef, BlobRefSchema };
@@ -3,11 +3,6 @@
3
3
  var zod = require('zod');
4
4
 
5
5
  // types/records.ts
6
- function httpsUrl() {
7
- return zod.z.string().trim().url().refine((u) => /^https?:\/\//i.test(u), {
8
- message: "URL must use the http or https scheme"
9
- });
10
- }
11
6
  var FirestoreTimestampSchema = zod.z.union([
12
7
  zod.z.custom((data) => {
13
8
  return data && typeof data === "object" && (typeof data.toDate === "function" || "seconds" in data && "nanoseconds" in data);
@@ -38,45 +33,5 @@ var FirestoreTimestampSchema = zod.z.union([
38
33
  }
39
34
  return date;
40
35
  });
41
- var UserRecordSchema = zod.z.object({
42
- /** Unique Firebase UID */
43
- id: zod.z.string(),
44
- /** Public handle (e.g. @brad). Optional for Lite Users. */
45
- handle: zod.z.string().min(3).max(20).regex(/^[a-zA-Z0-9_]+$/).nullable().optional(),
46
- /** User stated intent (e.g. "Podcaster", "Listener") */
47
- usageIntent: zod.z.string().nullable().optional(),
48
- /** Domain for federated handle support. */
49
- domain: zod.z.string().default("antiphony.dev"),
50
- /**
51
- * Display Name (e.g. "Brad Thorson"). Nullable: Firestore stores `null`
52
- * when the user clears this field via the settings form, and the schema
53
- * must match storage reality or `UserRecordSchema.parse` (in
54
- * `getUserRecordByUid`) will throw.
55
- */
56
- displayName: zod.z.string().max(50).nullable().optional(),
57
- /** Short bio/description — nullable for the same reason as displayName. */
58
- bio: zod.z.string().max(160).nullable().optional(),
59
- /** URL to avatar image — nullable for the same reason as displayName. */
60
- avatarUrl: zod.z.string().url().nullable().optional(),
61
- /** Optional personal website surfaced on the public profile. */
62
- website: httpsUrl().nullable().optional(),
63
- /** Up to 5 additional public links (label + URL) shown under the bio. */
64
- links: zod.z.array(zod.z.object({
65
- label: zod.z.string().min(1).max(40),
66
- url: httpsUrl()
67
- })).max(5).optional(),
68
- /** When true and a Bluesky identity is linked, surfaces it on the public profile. */
69
- showBlueskyPublicly: zod.z.boolean().optional(),
70
- /** Server timestamp of creation */
71
- createdAt: FirestoreTimestampSchema,
72
- /** Individual account tier — free or creator_pro */
73
- tier: zod.z.enum(["free", "creator_pro"]).default("free"),
74
- /** Account status. Deactivated accounts retain data but are excluded from lookups. */
75
- status: zod.z.enum(["active", "deactivated"]).default("active"),
76
- /** Timestamp when the account was deactivated (soft deleted) */
77
- deactivatedAt: FirestoreTimestampSchema.optional()
78
- });
79
36
 
80
37
  exports.FirestoreTimestampSchema = FirestoreTimestampSchema;
81
- exports.UserRecordSchema = UserRecordSchema;
82
- exports.httpsUrl = httpsUrl;
@@ -1,19 +1,5 @@
1
1
  import { z } from 'zod';
2
2
 
3
- /**
4
- * Reusable http/https scheme allowlist refinement.
5
- *
6
- * `z.string().url()` accepts any scheme including `javascript:`, `data:`, and
7
- * `vbscript:`, which are stored-XSS vectors when values land in an `<a href>`.
8
- * Wrap any user-supplied URL field with this helper instead of bare `.url()`.
9
- *
10
- * Usage:
11
- * website: httpsUrl().nullable().optional()
12
- * url: httpsUrl()
13
- *
14
- * Audit ref: M7 — javascript: URLs in profile links.
15
- */
16
- declare function httpsUrl(): z.ZodEffects<z.ZodString, string, string>;
17
3
  /**
18
4
  * Firestore Timestamp schema (strict).
19
5
  *
@@ -26,93 +12,5 @@ declare function httpsUrl(): z.ZodEffects<z.ZodString, string, string>;
26
12
  */
27
13
  declare const FirestoreTimestampSchema: z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>;
28
14
  type FirestoreTimestamp = Date;
29
- /**
30
- * The raw actor (user) identity record stored in Firestore.
31
- *
32
- * This is the canonical identity record for the Antiphony actor surface.
33
- * Audio content lives in `dev.antiphony.audio.post` (see `types/audio.ts`),
34
- * never on the user record.
35
- */
36
- declare const UserRecordSchema: z.ZodObject<{
37
- /** Unique Firebase UID */
38
- id: z.ZodString;
39
- /** Public handle (e.g. @brad). Optional for Lite Users. */
40
- handle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
41
- /** User stated intent (e.g. "Podcaster", "Listener") */
42
- usageIntent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
43
- /** Domain for federated handle support. */
44
- domain: z.ZodDefault<z.ZodString>;
45
- /**
46
- * Display Name (e.g. "Brad Thorson"). Nullable: Firestore stores `null`
47
- * when the user clears this field via the settings form, and the schema
48
- * must match storage reality or `UserRecordSchema.parse` (in
49
- * `getUserRecordByUid`) will throw.
50
- */
51
- displayName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
- /** Short bio/description — nullable for the same reason as displayName. */
53
- bio: z.ZodOptional<z.ZodNullable<z.ZodString>>;
54
- /** URL to avatar image — nullable for the same reason as displayName. */
55
- avatarUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
56
- /** Optional personal website surfaced on the public profile. */
57
- website: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
58
- /** Up to 5 additional public links (label + URL) shown under the bio. */
59
- links: z.ZodOptional<z.ZodArray<z.ZodObject<{
60
- label: z.ZodString;
61
- url: z.ZodEffects<z.ZodString, string, string>;
62
- }, "strip", z.ZodTypeAny, {
63
- label: string;
64
- url: string;
65
- }, {
66
- label: string;
67
- url: string;
68
- }>, "many">>;
69
- /** When true and a Bluesky identity is linked, surfaces it on the public profile. */
70
- showBlueskyPublicly: z.ZodOptional<z.ZodBoolean>;
71
- /** Server timestamp of creation */
72
- createdAt: z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>;
73
- /** Individual account tier — free or creator_pro */
74
- tier: z.ZodDefault<z.ZodEnum<["free", "creator_pro"]>>;
75
- /** Account status. Deactivated accounts retain data but are excluded from lookups. */
76
- status: z.ZodDefault<z.ZodEnum<["active", "deactivated"]>>;
77
- /** Timestamp when the account was deactivated (soft deleted) */
78
- deactivatedAt: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>>;
79
- }, "strip", z.ZodTypeAny, {
80
- status: "active" | "deactivated";
81
- id: string;
82
- domain: string;
83
- createdAt: Date;
84
- tier: "free" | "creator_pro";
85
- handle?: string | null | undefined;
86
- usageIntent?: string | null | undefined;
87
- displayName?: string | null | undefined;
88
- bio?: string | null | undefined;
89
- avatarUrl?: string | null | undefined;
90
- website?: string | null | undefined;
91
- links?: {
92
- label: string;
93
- url: string;
94
- }[] | undefined;
95
- showBlueskyPublicly?: boolean | undefined;
96
- deactivatedAt?: Date | undefined;
97
- }, {
98
- id: string;
99
- status?: "active" | "deactivated" | undefined;
100
- handle?: string | null | undefined;
101
- usageIntent?: string | null | undefined;
102
- domain?: string | undefined;
103
- displayName?: string | null | undefined;
104
- bio?: string | null | undefined;
105
- avatarUrl?: string | null | undefined;
106
- website?: string | null | undefined;
107
- links?: {
108
- label: string;
109
- url: string;
110
- }[] | undefined;
111
- showBlueskyPublicly?: boolean | undefined;
112
- createdAt?: unknown;
113
- tier?: "free" | "creator_pro" | undefined;
114
- deactivatedAt?: unknown;
115
- }>;
116
- type UserRecord = z.infer<typeof UserRecordSchema>;
117
15
 
118
- export { type FirestoreTimestamp, FirestoreTimestampSchema, type UserRecord, UserRecordSchema, httpsUrl };
16
+ export { type FirestoreTimestamp, FirestoreTimestampSchema };
@@ -16,17 +16,27 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
16
16
  $type: z.ZodLiteral<"dev.antiphony.embed.audio">;
17
17
  audio: z.ZodObject<{
18
18
  $type: z.ZodLiteral<"blob">;
19
- ref: z.ZodString;
19
+ ref: z.ZodObject<{
20
+ $link: z.ZodString;
21
+ }, "strip", z.ZodTypeAny, {
22
+ $link: string;
23
+ }, {
24
+ $link: string;
25
+ }>;
20
26
  mimeType: z.ZodString;
21
27
  size: z.ZodNumber;
22
28
  }, "strip", z.ZodTypeAny, {
23
29
  $type: "blob";
24
- ref: string;
30
+ ref: {
31
+ $link: string;
32
+ };
25
33
  mimeType: string;
26
34
  size: number;
27
35
  }, {
28
36
  $type: "blob";
29
- ref: string;
37
+ ref: {
38
+ $link: string;
39
+ };
30
40
  mimeType: string;
31
41
  size: number;
32
42
  }>;
@@ -37,7 +47,9 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
37
47
  $type: "dev.antiphony.embed.audio";
38
48
  audio: {
39
49
  $type: "blob";
40
- ref: string;
50
+ ref: {
51
+ $link: string;
52
+ };
41
53
  mimeType: string;
42
54
  size: number;
43
55
  };
@@ -48,7 +60,9 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
48
60
  $type: "dev.antiphony.embed.audio";
49
61
  audio: {
50
62
  $type: "blob";
51
- ref: string;
63
+ ref: {
64
+ $link: string;
65
+ };
52
66
  mimeType: string;
53
67
  size: number;
54
68
  };
@@ -101,14 +115,46 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
101
115
  langs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
102
116
  /** Author self-label values (content warnings). */
103
117
  selfLabels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
118
+ /**
119
+ * Opt-in audio processing for this post's audio (transcribe / denoise).
120
+ * Both default off. Stages the deployment can't provide come back marked
121
+ * `skipped` on the view rather than failing the create. See
122
+ * `types/processing.ts`.
123
+ */
124
+ processing: z.ZodOptional<z.ZodObject<{
125
+ transcribe: z.ZodOptional<z.ZodBoolean>;
126
+ denoise: z.ZodOptional<z.ZodBoolean>;
127
+ }, "strip", z.ZodTypeAny, {
128
+ transcribe?: boolean | undefined;
129
+ denoise?: boolean | undefined;
130
+ }, {
131
+ transcribe?: boolean | undefined;
132
+ denoise?: boolean | undefined;
133
+ }>>;
104
134
  }, "strip", z.ZodTypeAny, {
105
135
  text: string;
136
+ processing?: {
137
+ transcribe?: boolean | undefined;
138
+ denoise?: boolean | undefined;
139
+ } | undefined;
140
+ reply?: {
141
+ root: {
142
+ uri: string;
143
+ cid: string;
144
+ };
145
+ parent: {
146
+ uri: string;
147
+ cid: string;
148
+ };
149
+ } | undefined;
106
150
  title?: string | undefined;
107
151
  embed?: {
108
152
  $type: "dev.antiphony.embed.audio";
109
153
  audio: {
110
154
  $type: "blob";
111
- ref: string;
155
+ ref: {
156
+ $link: string;
157
+ };
112
158
  mimeType: string;
113
159
  size: number;
114
160
  };
@@ -116,6 +162,14 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
116
162
  alt?: string | undefined;
117
163
  waveform?: number[] | undefined;
118
164
  } | undefined;
165
+ langs?: string[] | undefined;
166
+ selfLabels?: string[] | undefined;
167
+ }, {
168
+ text?: string | undefined;
169
+ processing?: {
170
+ transcribe?: boolean | undefined;
171
+ denoise?: boolean | undefined;
172
+ } | undefined;
119
173
  reply?: {
120
174
  root: {
121
175
  uri: string;
@@ -126,16 +180,14 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
126
180
  cid: string;
127
181
  };
128
182
  } | undefined;
129
- langs?: string[] | undefined;
130
- selfLabels?: string[] | undefined;
131
- }, {
132
- text?: string | undefined;
133
183
  title?: string | undefined;
134
184
  embed?: {
135
185
  $type: "dev.antiphony.embed.audio";
136
186
  audio: {
137
187
  $type: "blob";
138
- ref: string;
188
+ ref: {
189
+ $link: string;
190
+ };
139
191
  mimeType: string;
140
192
  size: number;
141
193
  };
@@ -143,6 +195,14 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
143
195
  alt?: string | undefined;
144
196
  waveform?: number[] | undefined;
145
197
  } | undefined;
198
+ langs?: string[] | undefined;
199
+ selfLabels?: string[] | undefined;
200
+ }>, {
201
+ text: string;
202
+ processing?: {
203
+ transcribe?: boolean | undefined;
204
+ denoise?: boolean | undefined;
205
+ } | undefined;
146
206
  reply?: {
147
207
  root: {
148
208
  uri: string;
@@ -153,16 +213,14 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
153
213
  cid: string;
154
214
  };
155
215
  } | undefined;
156
- langs?: string[] | undefined;
157
- selfLabels?: string[] | undefined;
158
- }>, {
159
- text: string;
160
216
  title?: string | undefined;
161
217
  embed?: {
162
218
  $type: "dev.antiphony.embed.audio";
163
219
  audio: {
164
220
  $type: "blob";
165
- ref: string;
221
+ ref: {
222
+ $link: string;
223
+ };
166
224
  mimeType: string;
167
225
  size: number;
168
226
  };
@@ -170,6 +228,14 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
170
228
  alt?: string | undefined;
171
229
  waveform?: number[] | undefined;
172
230
  } | undefined;
231
+ langs?: string[] | undefined;
232
+ selfLabels?: string[] | undefined;
233
+ }, {
234
+ text?: string | undefined;
235
+ processing?: {
236
+ transcribe?: boolean | undefined;
237
+ denoise?: boolean | undefined;
238
+ } | undefined;
173
239
  reply?: {
174
240
  root: {
175
241
  uri: string;
@@ -180,16 +246,14 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
180
246
  cid: string;
181
247
  };
182
248
  } | undefined;
183
- langs?: string[] | undefined;
184
- selfLabels?: string[] | undefined;
185
- }, {
186
- text?: string | undefined;
187
249
  title?: string | undefined;
188
250
  embed?: {
189
251
  $type: "dev.antiphony.embed.audio";
190
252
  audio: {
191
253
  $type: "blob";
192
- ref: string;
254
+ ref: {
255
+ $link: string;
256
+ };
193
257
  mimeType: string;
194
258
  size: number;
195
259
  };
@@ -197,6 +261,14 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
197
261
  alt?: string | undefined;
198
262
  waveform?: number[] | undefined;
199
263
  } | undefined;
264
+ langs?: string[] | undefined;
265
+ selfLabels?: string[] | undefined;
266
+ }>, {
267
+ text: string;
268
+ processing?: {
269
+ transcribe?: boolean | undefined;
270
+ denoise?: boolean | undefined;
271
+ } | undefined;
200
272
  reply?: {
201
273
  root: {
202
274
  uri: string;
@@ -207,16 +279,14 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
207
279
  cid: string;
208
280
  };
209
281
  } | undefined;
210
- langs?: string[] | undefined;
211
- selfLabels?: string[] | undefined;
212
- }>, {
213
- text: string;
214
282
  title?: string | undefined;
215
283
  embed?: {
216
284
  $type: "dev.antiphony.embed.audio";
217
285
  audio: {
218
286
  $type: "blob";
219
- ref: string;
287
+ ref: {
288
+ $link: string;
289
+ };
220
290
  mimeType: string;
221
291
  size: number;
222
292
  };
@@ -224,6 +294,14 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
224
294
  alt?: string | undefined;
225
295
  waveform?: number[] | undefined;
226
296
  } | undefined;
297
+ langs?: string[] | undefined;
298
+ selfLabels?: string[] | undefined;
299
+ }, {
300
+ text?: string | undefined;
301
+ processing?: {
302
+ transcribe?: boolean | undefined;
303
+ denoise?: boolean | undefined;
304
+ } | undefined;
227
305
  reply?: {
228
306
  root: {
229
307
  uri: string;
@@ -234,16 +312,14 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
234
312
  cid: string;
235
313
  };
236
314
  } | undefined;
237
- langs?: string[] | undefined;
238
- selfLabels?: string[] | undefined;
239
- }, {
240
- text?: string | undefined;
241
315
  title?: string | undefined;
242
316
  embed?: {
243
317
  $type: "dev.antiphony.embed.audio";
244
318
  audio: {
245
319
  $type: "blob";
246
- ref: string;
320
+ ref: {
321
+ $link: string;
322
+ };
247
323
  mimeType: string;
248
324
  size: number;
249
325
  };
@@ -251,74 +327,43 @@ declare const CreateAudioPostRequestSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
251
327
  alt?: string | undefined;
252
328
  waveform?: number[] | undefined;
253
329
  } | undefined;
254
- reply?: {
255
- root: {
256
- uri: string;
257
- cid: string;
258
- };
259
- parent: {
260
- uri: string;
261
- cid: string;
262
- };
263
- } | undefined;
264
330
  langs?: string[] | undefined;
265
331
  selfLabels?: string[] | undefined;
266
332
  }>;
267
333
  type CreateAudioPostRequest = z.infer<typeof CreateAudioPostRequestSchema>;
268
334
  /**
269
- * Update-request codec for the authenticated actor's own profile
270
- * (`PATCH /api/v1/users/me`). Partial-update of identity fields only.
335
+ * Patch-request codec for the canonical Antiphony `dev.antiphony.audio.post`
336
+ * model. **Processing opt-in is the ONLY thing a PATCH may change** — it
337
+ * re-triggers async audio enrichment (transcribe / denoise) on an existing
338
+ * post. No lexicon fields are editable here: those feed the record CID (its
339
+ * content address / identity), so a content edit would mint a different record.
340
+ * Processing state is storage-layer, so this changes no CID. See
341
+ * `types/processing.ts`.
271
342
  */
272
- declare const UpdateProfileRequestSchema: z.ZodObject<{
273
- handle: z.ZodOptional<z.ZodString>;
274
- displayName: z.ZodOptional<z.ZodString>;
275
- bio: z.ZodOptional<z.ZodString>;
276
- avatarUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
277
- usageIntent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
278
- /**
279
- * Personal website surfaced on the public profile. Accepts a URL, empty
280
- * string, or null from the client; normalizes empty string → null so the
281
- * value stored on `UserRecord` (which requires `.url() | null`) round-trips
282
- * cleanly through `UserRecordSchema.parse` on subsequent reads.
283
- */
284
- website: z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<"">, z.ZodNull]>>, string | null | undefined, string | null | undefined>;
285
- /** Up to 5 public links (label + URL) shown under the bio. */
286
- links: z.ZodOptional<z.ZodArray<z.ZodObject<{
287
- label: z.ZodString;
288
- url: z.ZodString;
343
+ declare const PatchAudioPostRequestSchema: z.ZodObject<{
344
+ /** Opt-in audio processing to (re)run for this post's audio. Required — a
345
+ * PATCH with no processing request is a no-op and rejected as invalid. */
346
+ processing: z.ZodObject<{
347
+ transcribe: z.ZodOptional<z.ZodBoolean>;
348
+ denoise: z.ZodOptional<z.ZodBoolean>;
289
349
  }, "strip", z.ZodTypeAny, {
290
- label: string;
291
- url: string;
350
+ transcribe?: boolean | undefined;
351
+ denoise?: boolean | undefined;
292
352
  }, {
293
- label: string;
294
- url: string;
295
- }>, "many">>;
296
- /** When true, surfaces the linked Bluesky identity on the public profile. */
297
- showBlueskyPublicly: z.ZodOptional<z.ZodBoolean>;
353
+ transcribe?: boolean | undefined;
354
+ denoise?: boolean | undefined;
355
+ }>;
298
356
  }, "strip", z.ZodTypeAny, {
299
- handle?: string | undefined;
300
- displayName?: string | undefined;
301
- bio?: string | undefined;
302
- avatarUrl?: string | null | undefined;
303
- usageIntent?: string | null | undefined;
304
- website?: string | null | undefined;
305
- links?: {
306
- label: string;
307
- url: string;
308
- }[] | undefined;
309
- showBlueskyPublicly?: boolean | undefined;
357
+ processing: {
358
+ transcribe?: boolean | undefined;
359
+ denoise?: boolean | undefined;
360
+ };
310
361
  }, {
311
- handle?: string | undefined;
312
- displayName?: string | undefined;
313
- bio?: string | undefined;
314
- avatarUrl?: string | null | undefined;
315
- usageIntent?: string | null | undefined;
316
- website?: string | null | undefined;
317
- links?: {
318
- label: string;
319
- url: string;
320
- }[] | undefined;
321
- showBlueskyPublicly?: boolean | undefined;
362
+ processing: {
363
+ transcribe?: boolean | undefined;
364
+ denoise?: boolean | undefined;
365
+ };
322
366
  }>;
367
+ type PatchAudioPostRequest = z.infer<typeof PatchAudioPostRequestSchema>;
323
368
 
324
- export { type CreateAudioPostRequest, CreateAudioPostRequestSchema, UpdateProfileRequestSchema };
369
+ export { type CreateAudioPostRequest, CreateAudioPostRequestSchema, type PatchAudioPostRequest, PatchAudioPostRequestSchema };
@@ -1,6 +1,5 @@
1
- export { CreateAudioPostRequestSchema, UpdateProfileRequestSchema } from './chunk-FDM5FDN4.js';
2
- import './chunk-F7IHVM34.js';
3
- import './chunk-5EHV73BA.js';
4
- import './chunk-R6SBR3IG.js';
5
- import './chunk-IHIBHQBJ.js';
1
+ export { CreateAudioPostRequestSchema, PatchAudioPostRequestSchema } from './chunk-RUUHUNZ6.js';
2
+ import './chunk-WL2GSPGC.js';
3
+ import './chunk-D655OH2I.js';
4
+ import './chunk-SMK4OZNU.js';
6
5
  import './chunk-5JBD5THX.js';
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+
3
+ // types/records.ts
4
+ var FirestoreTimestampSchema = z.union([
5
+ z.custom((data) => {
6
+ return data && typeof data === "object" && (typeof data.toDate === "function" || "seconds" in data && "nanoseconds" in data);
7
+ }),
8
+ z.string(),
9
+ z.number(),
10
+ z.date()
11
+ ]).transform((data, ctx) => {
12
+ let date;
13
+ if (data instanceof Date) {
14
+ date = data;
15
+ } else if (typeof data === "string") {
16
+ date = new Date(data);
17
+ } else if (typeof data === "number") {
18
+ date = new Date(data);
19
+ } else if (typeof data.toDate === "function") {
20
+ date = data.toDate();
21
+ } else {
22
+ const timestamp = data;
23
+ date = new Date(timestamp.seconds * 1e3 + timestamp.nanoseconds / 1e6);
24
+ }
25
+ if (Number.isNaN(date.getTime())) {
26
+ ctx.addIssue({
27
+ code: z.ZodIssueCode.custom,
28
+ message: "FirestoreTimestamp coerced to Invalid Date"
29
+ });
30
+ return z.NEVER;
31
+ }
32
+ return date;
33
+ });
34
+
35
+ export { FirestoreTimestampSchema };