@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.
Files changed (59) hide show
  1. package/README.md +4 -4
  2. package/dist/cjs/api-codecs.cjs +90 -787
  3. package/dist/cjs/api-codecs.d.cts +117 -290
  4. package/dist/cjs/index.cjs +102 -947
  5. package/dist/cjs/index.d.cts +89 -7
  6. package/dist/cjs/nsid.cjs +8 -18
  7. package/dist/cjs/nsid.d.cts +8 -17
  8. package/dist/cjs/types/audio.cjs +77 -662
  9. package/dist/cjs/types/audio.d.cts +285 -203
  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 -370
  13. package/dist/cjs/types/records.d.cts +1 -825
  14. package/dist/esm/api-codecs.d.ts +117 -290
  15. package/dist/esm/api-codecs.js +5 -6
  16. package/dist/esm/{chunk-ORMEWXMH.js → chunk-5JBD5THX.js} +1 -16
  17. package/dist/esm/{chunk-F2CANZZ7.js → chunk-BNNLHRH7.js} +1 -1
  18. package/dist/esm/chunk-D655OH2I.js +35 -0
  19. package/dist/esm/chunk-RUUHUNZ6.js +37 -0
  20. package/dist/esm/chunk-SBYNIQRZ.js +23 -0
  21. package/dist/esm/chunk-SMK4OZNU.js +17 -0
  22. package/dist/esm/{chunk-BUNMR4ZO.js → chunk-WL2GSPGC.js} +81 -12
  23. package/dist/esm/errors/index.js +1 -1
  24. package/dist/esm/index.d.ts +89 -7
  25. package/dist/esm/index.js +7 -9
  26. package/dist/esm/nsid.d.ts +8 -17
  27. package/dist/esm/nsid.js +2 -2
  28. package/dist/esm/observability/index.js +2 -2
  29. package/dist/esm/observability/report-error.js +2 -2
  30. package/dist/esm/types/audio.d.ts +285 -203
  31. package/dist/esm/types/audio.js +4 -5
  32. package/dist/esm/types/blob.d.ts +21 -21
  33. package/dist/esm/types/blob.js +2 -2
  34. package/dist/esm/types/records.d.ts +1 -825
  35. package/dist/esm/types/records.js +2 -3
  36. package/dist/esm/utils/index.js +1 -1
  37. package/package.json +90 -26
  38. package/dist/cjs/types/api.cjs +0 -726
  39. package/dist/cjs/types/api.d.cts +0 -494
  40. package/dist/cjs/types/channels.cjs +0 -170
  41. package/dist/cjs/types/channels.d.cts +0 -262
  42. package/dist/cjs/types/storage.cjs +0 -414
  43. package/dist/cjs/types/storage.d.cts +0 -197
  44. package/dist/cjs/types/views.cjs +0 -820
  45. package/dist/cjs/types/views.d.cts +0 -9806
  46. package/dist/esm/chunk-3WZJXJNU.js +0 -378
  47. package/dist/esm/chunk-5EHV73BA.js +0 -20
  48. package/dist/esm/chunk-7V44CPRR.js +0 -132
  49. package/dist/esm/chunk-EA4OONDV.js +0 -380
  50. package/dist/esm/chunk-TIZRJORN.js +0 -24
  51. package/dist/esm/chunk-XDBKR6LW.js +0 -32
  52. package/dist/esm/types/api.d.ts +0 -494
  53. package/dist/esm/types/api.js +0 -5
  54. package/dist/esm/types/channels.d.ts +0 -262
  55. package/dist/esm/types/channels.js +0 -162
  56. package/dist/esm/types/storage.d.ts +0 -197
  57. package/dist/esm/types/storage.js +0 -26
  58. package/dist/esm/types/views.d.ts +0 -9806
  59. package/dist/esm/types/views.js +0 -4
@@ -1,5 +1,4 @@
1
- export { ActorProfileRecordSchema, AudioEmbedSchema, AudioEmbedViewSchema, AudioPostRecordSchema, AudioPostViewSchema, PostRecordPublicSchema, ReplyRefSchema, StrongRefSchema, TimedTranscriptSchema, TranscriptEnrichmentRecordSchema, TranscriptSegmentSchema, ViewerStateSchema } from '../chunk-BUNMR4ZO.js';
2
- import '../chunk-EA4OONDV.js';
3
- import '../chunk-3WZJXJNU.js';
4
- import '../chunk-5EHV73BA.js';
5
- import '../chunk-ORMEWXMH.js';
1
+ export { ActorProfileRecordSchema, AudioEmbedSchema, AudioEmbedViewSchema, AudioPostRecordSchema, AudioPostViewSchema, PostRecordPublicSchema, ReplyRefSchema, StrongRefSchema, TimedTranscriptSchema, TranscriptEnrichmentRecordSchema, TranscriptSegmentSchema, ViewerStateSchema } from '../chunk-WL2GSPGC.js';
2
+ import '../chunk-D655OH2I.js';
3
+ import '../chunk-SMK4OZNU.js';
4
+ import '../chunk-5JBD5THX.js';
@@ -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 };
@@ -1,2 +1,2 @@
1
- export { BlobRefSchema, resolveAudioUrl } from '../chunk-5EHV73BA.js';
2
- import '../chunk-ORMEWXMH.js';
1
+ export { BlobRefSchema } from '../chunk-SMK4OZNU.js';
2
+ import '../chunk-5JBD5THX.js';