@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
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,11 +1,93 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { ContactCrmData, EnrichedReplier, EnrichedReplierSchema, HandleResolution, HandleResolutionSchema, OrgInviteView, OrgInviteViewSchema, OrgProfileData, OrgProfileDataSchema, OrganizationMemberView, OrganizationMemberViewSchema, OrganizationView, OrganizationViewSchema, ProfileView, ProfileViewAdmin, ProfileViewAdminSchema, ProfileViewBasic, ProfileViewBasicSchema, ProfileViewDetailed, ProfileViewDetailedSchema, ProfileViewSchema, ProfileViewSelf, ProfileViewSelfSchema, PromptRepliers, PromptRepliersSchema, PromptView, PromptViewPublic, PromptViewPublicSchema, PromptViewSchema, PromptWithReplies, PromptWithRepliesSchema, Replier, ReplierSchema, ReplyView, ReplyViewPublic, ReplyViewPublicSchema, ReplyViewSchema, RssSummary, RssSummarySchema, UserProfileData, UserProfileDataSchema, VoxPopEmbedWidgetProps, toProfileViewBasic, toPromptViewPublic, toReplyViewPublic } from './types/views.cjs';
|
|
1
|
+
export { CreateAudioPostRequest, CreateAudioPostRequestSchema, PatchAudioPostRequest, PatchAudioPostRequestSchema } from './api-codecs.cjs';
|
|
2
|
+
export { FirestoreTimestamp, FirestoreTimestampSchema } from './types/records.cjs';
|
|
4
3
|
export { ActorProfileRecord, ActorProfileRecordSchema, AudioEmbed, AudioEmbedSchema, AudioEmbedView, AudioEmbedViewSchema, AudioPostRecord, AudioPostRecordSchema, AudioPostView, AudioPostViewSchema, PostRecordPublic, PostRecordPublicSchema, ReplyRef, ReplyRefSchema, StrongRef, StrongRefSchema, TimedTranscript, TimedTranscriptSchema, TranscriptEnrichmentRecord, TranscriptEnrichmentRecordSchema, TranscriptSegment, TranscriptSegmentSchema, ViewerState, ViewerStateSchema } from './types/audio.cjs';
|
|
5
|
-
|
|
6
|
-
export {
|
|
7
|
-
export { COLLECTIONS, EMBED_NSID, NSID, NsidValue,
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
export { BlobRef, BlobRefSchema } from './types/blob.cjs';
|
|
6
|
+
export { COLLECTIONS, EMBED_NSID, NSID, NsidValue, StoredNsidValue } from './nsid.cjs';
|
|
8
7
|
export { ConflictError, ForbiddenError, NotFoundError, RateLimitError, ServiceError, UnauthorizedError, ValidationError } from './errors/index.cjs';
|
|
9
8
|
export { isFirestoreTimestamp } from './utils/index.cjs';
|
|
10
9
|
export { ReportedErrorEvent, buildReportedErrorEvent, reportError } from './observability/report-error.cjs';
|
|
11
|
-
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Audio hygiene / enrichment processing (B5).
|
|
13
|
+
*
|
|
14
|
+
* Antiphony can, when the calling app opts in, run two pieces of audio
|
|
15
|
+
* processing on a post's audio: **transcription** (machine transcript, the
|
|
16
|
+
* `dev.antiphony.audio.transcript` enrichment) and **denoise** (a cleaned
|
|
17
|
+
* audio variant for playback). Both are OFF by default — the app asks for
|
|
18
|
+
* them per post via `CreateAudioPostRequest.processing`.
|
|
19
|
+
*
|
|
20
|
+
* The work runs asynchronously (outside the create request), so a post
|
|
21
|
+
* carries a mutable `processing` state that starts `pending` and settles to
|
|
22
|
+
* `ready`/`failed`/`skipped` per stage. That state is a storage-layer field —
|
|
23
|
+
* it is NOT part of the canonical lexicon record and never enters the record
|
|
24
|
+
* CID (like `kind` and `threadParticipants`), so processing can update it
|
|
25
|
+
* without changing the post's content address.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Per-stage status.
|
|
29
|
+
* - `pending` — requested, not yet done (the worker acts on these).
|
|
30
|
+
* - `ready` — completed.
|
|
31
|
+
* - `failed` — attempted and errored.
|
|
32
|
+
* - `skipped` — requested but this deployment has no provider for it.
|
|
33
|
+
*/
|
|
34
|
+
declare const ProcessingStageStatusSchema: z.ZodEnum<["pending", "ready", "failed", "skipped"]>;
|
|
35
|
+
type ProcessingStageStatus = z.infer<typeof ProcessingStageStatusSchema>;
|
|
36
|
+
/**
|
|
37
|
+
* What the calling app opts into, on `CreateAudioPostRequest`. Both default
|
|
38
|
+
* off; only `true` values request a stage.
|
|
39
|
+
*/
|
|
40
|
+
declare const ProcessingRequestSchema: z.ZodObject<{
|
|
41
|
+
transcribe: z.ZodOptional<z.ZodBoolean>;
|
|
42
|
+
denoise: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
transcribe?: boolean | undefined;
|
|
45
|
+
denoise?: boolean | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
transcribe?: boolean | undefined;
|
|
48
|
+
denoise?: boolean | undefined;
|
|
49
|
+
}>;
|
|
50
|
+
type ProcessingRequest = z.infer<typeof ProcessingRequestSchema>;
|
|
51
|
+
/**
|
|
52
|
+
* Stored processing state on the post record (storage-layer; not in the CID).
|
|
53
|
+
* A stage key is present iff that stage was requested. `denoisedBlobCid`
|
|
54
|
+
* points at the cleaned audio variant once denoise completes — the record's
|
|
55
|
+
* own `embed.audio.ref.$link` stays the ORIGINAL CID (immutable content
|
|
56
|
+
* address); only the read-time view swaps playback to the cleaned variant.
|
|
57
|
+
*/
|
|
58
|
+
declare const ProcessingStateSchema: z.ZodObject<{
|
|
59
|
+
transcribe: z.ZodOptional<z.ZodEnum<["pending", "ready", "failed", "skipped"]>>;
|
|
60
|
+
denoise: z.ZodOptional<z.ZodEnum<["pending", "ready", "failed", "skipped"]>>;
|
|
61
|
+
/** Content CID of the denoised audio variant, once `denoise === 'ready'`. */
|
|
62
|
+
denoisedBlobCid: z.ZodOptional<z.ZodString>;
|
|
63
|
+
updatedAt: z.ZodEffects<z.ZodUnion<[z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodString, z.ZodNumber, z.ZodDate]>, Date, unknown>;
|
|
64
|
+
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
updatedAt: Date;
|
|
66
|
+
transcribe?: "pending" | "ready" | "failed" | "skipped" | undefined;
|
|
67
|
+
denoise?: "pending" | "ready" | "failed" | "skipped" | undefined;
|
|
68
|
+
denoisedBlobCid?: string | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
transcribe?: "pending" | "ready" | "failed" | "skipped" | undefined;
|
|
71
|
+
denoise?: "pending" | "ready" | "failed" | "skipped" | undefined;
|
|
72
|
+
denoisedBlobCid?: string | undefined;
|
|
73
|
+
updatedAt?: unknown;
|
|
74
|
+
}>;
|
|
75
|
+
type ProcessingState = z.infer<typeof ProcessingStateSchema>;
|
|
76
|
+
/**
|
|
77
|
+
* The processing status surfaced on the hydrated view — the per-stage status
|
|
78
|
+
* only (no internal storage fields). Absent when no processing was requested.
|
|
79
|
+
* Clients treat any `pending` stage as "still working".
|
|
80
|
+
*/
|
|
81
|
+
declare const ProcessingViewSchema: z.ZodObject<{
|
|
82
|
+
transcribe: z.ZodOptional<z.ZodEnum<["pending", "ready", "failed", "skipped"]>>;
|
|
83
|
+
denoise: z.ZodOptional<z.ZodEnum<["pending", "ready", "failed", "skipped"]>>;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
transcribe?: "pending" | "ready" | "failed" | "skipped" | undefined;
|
|
86
|
+
denoise?: "pending" | "ready" | "failed" | "skipped" | undefined;
|
|
87
|
+
}, {
|
|
88
|
+
transcribe?: "pending" | "ready" | "failed" | "skipped" | undefined;
|
|
89
|
+
denoise?: "pending" | "ready" | "failed" | "skipped" | undefined;
|
|
90
|
+
}>;
|
|
91
|
+
type ProcessingView = z.infer<typeof ProcessingViewSchema>;
|
|
92
|
+
|
|
93
|
+
export { type ProcessingRequest, ProcessingRequestSchema, type ProcessingStageStatus, ProcessingStageStatusSchema, type ProcessingState, ProcessingStateSchema, type ProcessingView, ProcessingViewSchema };
|
package/dist/cjs/nsid.cjs
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
// nsid.ts
|
|
4
4
|
var NSID = {
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
Reply: "com.voxpop.audio.reply",
|
|
8
|
-
Profile: "com.voxpop.actor.profile",
|
|
9
|
-
// Antiphony canonical record types (dev.antiphony.*). Added additively in
|
|
10
|
-
// Stream 1; see lexicons/dev/antiphony/ + packages/shared/types/audio.ts.
|
|
5
|
+
// Antiphony canonical record types (dev.antiphony.*).
|
|
6
|
+
// See lexicons/dev/antiphony/ + packages/shared/types/audio.ts.
|
|
11
7
|
AudioPost: "dev.antiphony.audio.post",
|
|
12
8
|
AudioTranscript: "dev.antiphony.audio.transcript",
|
|
9
|
+
// Portable lexicon only — the core never stores actor profiles; the
|
|
10
|
+
// caller BFF is the sole authority for profile data (see
|
|
11
|
+
// specs/core-bff-boundary.md, "actor.profile lexicon"). Hence no
|
|
12
|
+
// COLLECTIONS entry below.
|
|
13
13
|
ActorProfile: "dev.antiphony.actor.profile"
|
|
14
14
|
};
|
|
15
15
|
var EMBED_NSID = {
|
|
@@ -17,21 +17,11 @@ var EMBED_NSID = {
|
|
|
17
17
|
RecordWithAudio: "dev.antiphony.embed.recordWithAudio"
|
|
18
18
|
};
|
|
19
19
|
var COLLECTIONS = {
|
|
20
|
-
|
|
21
|
-
[NSID.Reply]: "replies",
|
|
22
|
-
[NSID.Profile]: "users",
|
|
23
|
-
// Antiphony: one post collection + the transcript enrichment namespace.
|
|
20
|
+
// One post collection + the transcript enrichment namespace.
|
|
24
21
|
[NSID.AudioPost]: "posts",
|
|
25
|
-
[NSID.AudioTranscript]: "audio_transcripts"
|
|
26
|
-
[NSID.ActorProfile]: "users"
|
|
22
|
+
[NSID.AudioTranscript]: "audio_transcripts"
|
|
27
23
|
};
|
|
28
|
-
function nsidForCollection(collection) {
|
|
29
|
-
const entries = Object.entries(COLLECTIONS);
|
|
30
|
-
const match = entries.find(([, col]) => col === collection);
|
|
31
|
-
return match == null ? void 0 : match[0];
|
|
32
|
-
}
|
|
33
24
|
|
|
34
25
|
exports.COLLECTIONS = COLLECTIONS;
|
|
35
26
|
exports.EMBED_NSID = EMBED_NSID;
|
|
36
27
|
exports.NSID = NSID;
|
|
37
|
-
exports.nsidForCollection = nsidForCollection;
|
package/dist/cjs/nsid.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AT Protocol Namespaced Identifiers (NSIDs) for
|
|
2
|
+
* AT Protocol Namespaced Identifiers (NSIDs) for Antiphony record types.
|
|
3
3
|
*
|
|
4
4
|
* NSIDs are the canonical way to identify record types in AT Protocol.
|
|
5
5
|
* This mapping connects AT Protocol NSIDs to Firestore collection names,
|
|
@@ -8,14 +8,13 @@
|
|
|
8
8
|
* @see https://atproto.com/specs/nsid
|
|
9
9
|
*/
|
|
10
10
|
declare const NSID: {
|
|
11
|
-
readonly Prompt: "com.voxpop.audio.prompt";
|
|
12
|
-
readonly Reply: "com.voxpop.audio.reply";
|
|
13
|
-
readonly Profile: "com.voxpop.actor.profile";
|
|
14
11
|
readonly AudioPost: "dev.antiphony.audio.post";
|
|
15
12
|
readonly AudioTranscript: "dev.antiphony.audio.transcript";
|
|
16
13
|
readonly ActorProfile: "dev.antiphony.actor.profile";
|
|
17
14
|
};
|
|
18
15
|
type NsidValue = typeof NSID[keyof typeof NSID];
|
|
16
|
+
/** The subset of record NSIDs the core actually stores. */
|
|
17
|
+
type StoredNsidValue = typeof NSID.AudioPost | typeof NSID.AudioTranscript;
|
|
19
18
|
/**
|
|
20
19
|
* Antiphony embed NSIDs. Embeds live inline on a post's `embed` field, not in
|
|
21
20
|
* their own collection — kept out of `NSID`/`COLLECTIONS`.
|
|
@@ -25,18 +24,10 @@ declare const EMBED_NSID: {
|
|
|
25
24
|
readonly RecordWithAudio: "dev.antiphony.embed.recordWithAudio";
|
|
26
25
|
};
|
|
27
26
|
/**
|
|
28
|
-
* Maps AT Protocol record-type NSIDs to Firestore collection
|
|
29
|
-
* When migrating to a PDS, this mapping becomes the adapter layer.
|
|
30
|
-
*
|
|
31
|
-
* Note: `dev.antiphony.actor.profile` and the legacy `com.voxpop.actor.profile`
|
|
32
|
-
* both map to `users`. `nsidForCollection('users')` returns the legacy NSID
|
|
33
|
-
* (listed first) — preserving today's reverse-lookup behavior until Stream 4
|
|
34
|
-
* removes the legacy entry.
|
|
35
|
-
*/
|
|
36
|
-
declare const COLLECTIONS: Record<NsidValue, string>;
|
|
37
|
-
/**
|
|
38
|
-
* Reverse lookup: get the NSID for a Firestore collection name.
|
|
27
|
+
* Maps the STORED AT Protocol record-type NSIDs to Firestore collection
|
|
28
|
+
* names. When migrating to a PDS, this mapping becomes the adapter layer.
|
|
29
|
+
* `actor.profile` is deliberately absent — portable schema, no core storage.
|
|
39
30
|
*/
|
|
40
|
-
declare
|
|
31
|
+
declare const COLLECTIONS: Record<StoredNsidValue, string>;
|
|
41
32
|
|
|
42
|
-
export { COLLECTIONS, EMBED_NSID, NSID, type NsidValue,
|
|
33
|
+
export { COLLECTIONS, EMBED_NSID, NSID, type NsidValue, type StoredNsidValue };
|