@ttt-productions/ttt-core 0.79.39 → 0.79.40
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/doc-schemas/chat-sync.d.ts +81 -9
- package/dist/doc-schemas/chat-sync.d.ts.map +1 -1
- package/dist/doc-schemas/chat-sync.js +39 -8
- package/dist/doc-schemas/chat-sync.js.map +1 -1
- package/dist/doc-schemas/content.d.ts +12 -6
- package/dist/doc-schemas/content.d.ts.map +1 -1
- package/dist/doc-schemas/content.js +65 -4
- package/dist/doc-schemas/content.js.map +1 -1
- package/dist/doc-schemas/media-activation-jobs.d.ts +1 -1
- package/dist/doc-schemas/media-assets.d.ts +6 -6
- package/dist/doc-schemas/registry.d.ts +93 -21
- package/dist/doc-schemas/registry.d.ts.map +1 -1
- package/dist/doc-schemas/safety/evidence.d.ts +4 -4
- package/dist/doc-schemas/work-project.d.ts +1 -1
- package/dist/paths/collection-refs.d.ts +2 -0
- package/dist/paths/collection-refs.d.ts.map +1 -1
- package/dist/paths/collection-refs.js +4 -0
- package/dist/paths/collection-refs.js.map +1 -1
- package/dist/paths/path-builders.d.ts +2 -0
- package/dist/paths/path-builders.d.ts.map +1 -1
- package/dist/paths/path-builders.js +4 -0
- package/dist/paths/path-builders.js.map +1 -1
- package/dist/schemas/admin.d.ts +8 -9
- package/dist/schemas/admin.d.ts.map +1 -1
- package/dist/schemas/admin.js +2 -2
- package/dist/schemas/admin.js.map +1 -1
- package/dist/schemas/hall-library.d.ts +14 -1
- package/dist/schemas/hall-library.d.ts.map +1 -1
- package/dist/schemas/hall-library.js +37 -12
- package/dist/schemas/hall-library.js.map +1 -1
- package/dist/schemas/notification.d.ts +1 -1
- package/dist/types/admin-ops.d.ts +4 -3
- package/dist/types/admin-ops.d.ts.map +1 -1
- package/dist/types/admin-ops.js.map +1 -1
- package/dist/upload-variables/update-episode-media-variables.d.ts +1 -1
- package/package.json +1 -1
|
@@ -71,18 +71,65 @@ export declare const ChatSyncEventSchema: z.ZodObject<{
|
|
|
71
71
|
expireAt: z.ZodOptional<z.ZodUnknown>;
|
|
72
72
|
}, z.core.$strip>;
|
|
73
73
|
export type ChatSyncEvent = z.infer<typeof ChatSyncEventSchema>;
|
|
74
|
-
export declare const ChatSyncFanoutJobSchema: z.ZodObject<{
|
|
74
|
+
export declare const ChatSyncFanoutJobSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
75
|
+
selectorKind: z.ZodLiteral<"channelMembers">;
|
|
76
|
+
selectorArgs: z.ZodObject<{
|
|
77
|
+
workProjectId: z.ZodString;
|
|
78
|
+
guildChatChannelId: z.ZodString;
|
|
79
|
+
channelKey: z.ZodString;
|
|
80
|
+
}, z.core.$strict>;
|
|
75
81
|
jobId: z.ZodString;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
causeVersion: z.ZodNumber;
|
|
83
|
+
cursor: z.ZodObject<{
|
|
84
|
+
pageIndex: z.ZodNumber;
|
|
85
|
+
lastDocId: z.ZodNullable<z.ZodString>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
revision: z.ZodNumber;
|
|
88
|
+
status: z.ZodEnum<{
|
|
89
|
+
pending: "pending";
|
|
90
|
+
complete: "complete";
|
|
91
|
+
deadLetter: "deadLetter";
|
|
80
92
|
}>;
|
|
93
|
+
attemptCount: z.ZodNumber;
|
|
94
|
+
nextAttemptAt: z.ZodNumber;
|
|
95
|
+
lastError: z.ZodNullable<z.ZodString>;
|
|
96
|
+
createdAt: z.ZodNumber;
|
|
97
|
+
completedAt: z.ZodNullable<z.ZodNumber>;
|
|
98
|
+
deadLetteredAt: z.ZodNullable<z.ZodNumber>;
|
|
99
|
+
expireAt: z.ZodOptional<z.ZodUnknown>;
|
|
100
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
101
|
+
selectorKind: z.ZodLiteral<"policyEditAffectedUsers">;
|
|
81
102
|
selectorArgs: z.ZodObject<{
|
|
82
|
-
workProjectId: z.
|
|
83
|
-
|
|
84
|
-
|
|
103
|
+
workProjectId: z.ZodString;
|
|
104
|
+
guildChatChannelId: z.ZodString;
|
|
105
|
+
channelKey: z.ZodString;
|
|
106
|
+
}, z.core.$strict>;
|
|
107
|
+
jobId: z.ZodString;
|
|
108
|
+
causeVersion: z.ZodNumber;
|
|
109
|
+
cursor: z.ZodObject<{
|
|
110
|
+
pageIndex: z.ZodNumber;
|
|
111
|
+
lastDocId: z.ZodNullable<z.ZodString>;
|
|
85
112
|
}, z.core.$strip>;
|
|
113
|
+
revision: z.ZodNumber;
|
|
114
|
+
status: z.ZodEnum<{
|
|
115
|
+
pending: "pending";
|
|
116
|
+
complete: "complete";
|
|
117
|
+
deadLetter: "deadLetter";
|
|
118
|
+
}>;
|
|
119
|
+
attemptCount: z.ZodNumber;
|
|
120
|
+
nextAttemptAt: z.ZodNumber;
|
|
121
|
+
lastError: z.ZodNullable<z.ZodString>;
|
|
122
|
+
createdAt: z.ZodNumber;
|
|
123
|
+
completedAt: z.ZodNullable<z.ZodNumber>;
|
|
124
|
+
deadLetteredAt: z.ZodNullable<z.ZodNumber>;
|
|
125
|
+
expireAt: z.ZodOptional<z.ZodUnknown>;
|
|
126
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
127
|
+
selectorKind: z.ZodLiteral<"workChannelsForUser">;
|
|
128
|
+
selectorArgs: z.ZodObject<{
|
|
129
|
+
uid: z.ZodString;
|
|
130
|
+
workProjectId: z.ZodString;
|
|
131
|
+
}, z.core.$strict>;
|
|
132
|
+
jobId: z.ZodString;
|
|
86
133
|
causeVersion: z.ZodNumber;
|
|
87
134
|
cursor: z.ZodObject<{
|
|
88
135
|
pageIndex: z.ZodNumber;
|
|
@@ -101,7 +148,32 @@ export declare const ChatSyncFanoutJobSchema: z.ZodObject<{
|
|
|
101
148
|
completedAt: z.ZodNullable<z.ZodNumber>;
|
|
102
149
|
deadLetteredAt: z.ZodNullable<z.ZodNumber>;
|
|
103
150
|
expireAt: z.ZodOptional<z.ZodUnknown>;
|
|
104
|
-
}, z.core.$
|
|
151
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
152
|
+
selectorKind: z.ZodLiteral<"inviteParticipants">;
|
|
153
|
+
selectorArgs: z.ZodObject<{
|
|
154
|
+
guildInviteId: z.ZodString;
|
|
155
|
+
participantUids: z.ZodArray<z.ZodString>;
|
|
156
|
+
}, z.core.$strict>;
|
|
157
|
+
jobId: z.ZodString;
|
|
158
|
+
causeVersion: z.ZodNumber;
|
|
159
|
+
cursor: z.ZodObject<{
|
|
160
|
+
pageIndex: z.ZodNumber;
|
|
161
|
+
lastDocId: z.ZodNullable<z.ZodString>;
|
|
162
|
+
}, z.core.$strip>;
|
|
163
|
+
revision: z.ZodNumber;
|
|
164
|
+
status: z.ZodEnum<{
|
|
165
|
+
pending: "pending";
|
|
166
|
+
complete: "complete";
|
|
167
|
+
deadLetter: "deadLetter";
|
|
168
|
+
}>;
|
|
169
|
+
attemptCount: z.ZodNumber;
|
|
170
|
+
nextAttemptAt: z.ZodNumber;
|
|
171
|
+
lastError: z.ZodNullable<z.ZodString>;
|
|
172
|
+
createdAt: z.ZodNumber;
|
|
173
|
+
completedAt: z.ZodNullable<z.ZodNumber>;
|
|
174
|
+
deadLetteredAt: z.ZodNullable<z.ZodNumber>;
|
|
175
|
+
expireAt: z.ZodOptional<z.ZodUnknown>;
|
|
176
|
+
}, z.core.$strict>], "selectorKind">;
|
|
105
177
|
export type ChatSyncFanoutJob = z.infer<typeof ChatSyncFanoutJobSchema>;
|
|
106
178
|
export declare const ChatMessageOutboxSchema: z.ZodObject<{
|
|
107
179
|
commandId: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-sync.d.ts","sourceRoot":"","sources":["../../src/doc-schemas/chat-sync.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;iB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,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAwBlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAGxE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;iBAclC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAKxE,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqCvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAgBlF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsB5C,CAAC;AACH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAK5F,eAAO,MAAM,2CAA2C;;;;;;;;;;;;;;iBAQtD,CAAC;AACH,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2CAA2C,CAAC,CAAC"}
|
|
@@ -66,14 +66,11 @@ export const ChatSyncEventSchema = z.object({
|
|
|
66
66
|
expireAt: expireAtField,
|
|
67
67
|
});
|
|
68
68
|
// ── chatSyncFanoutJobs/{jobId} ──────────────────────────────────────────────
|
|
69
|
-
|
|
69
|
+
// The selector is a closed discriminated contract. The worker has different expansion
|
|
70
|
+
// semantics for a Work-channel page, a member-in-Work page, and the fixed two-person
|
|
71
|
+
// invite re-drive; a loose optional bag lets malformed persisted jobs silently wedge.
|
|
72
|
+
const ChatSyncFanoutJobBaseShape = {
|
|
70
73
|
jobId: z.string(),
|
|
71
|
-
selectorKind: z.enum(['channelMembers', 'workChannelsForUser', 'policyEditAffectedUsers']),
|
|
72
|
-
selectorArgs: z.object({
|
|
73
|
-
workProjectId: z.string().optional(),
|
|
74
|
-
channelKey: z.string().optional(),
|
|
75
|
-
uid: z.string().optional(),
|
|
76
|
-
}),
|
|
77
74
|
causeVersion: z.number(),
|
|
78
75
|
cursor: z.object({ pageIndex: z.number(), lastDocId: z.string().nullable() }),
|
|
79
76
|
revision: z.number(),
|
|
@@ -85,7 +82,41 @@ export const ChatSyncFanoutJobSchema = z.object({
|
|
|
85
82
|
completedAt: z.number().nullable(),
|
|
86
83
|
deadLetteredAt: z.number().nullable(),
|
|
87
84
|
expireAt: expireAtField,
|
|
88
|
-
}
|
|
85
|
+
};
|
|
86
|
+
const channelFanoutSelectorArgs = z.object({
|
|
87
|
+
workProjectId: z.string().min(1),
|
|
88
|
+
guildChatChannelId: z.string().min(1),
|
|
89
|
+
channelKey: z.string().min(1),
|
|
90
|
+
}).strict();
|
|
91
|
+
const inviteParticipantsSelectorArgs = z.object({
|
|
92
|
+
guildInviteId: z.string().min(1),
|
|
93
|
+
participantUids: z.array(z.string().min(1)).length(2).refine((uids) => new Set(uids).size === uids.length, { message: 'Invite participant uids must be distinct.' }),
|
|
94
|
+
}).strict();
|
|
95
|
+
export const ChatSyncFanoutJobSchema = z.discriminatedUnion('selectorKind', [
|
|
96
|
+
z.object({
|
|
97
|
+
...ChatSyncFanoutJobBaseShape,
|
|
98
|
+
selectorKind: z.literal('channelMembers'),
|
|
99
|
+
selectorArgs: channelFanoutSelectorArgs,
|
|
100
|
+
}).strict(),
|
|
101
|
+
z.object({
|
|
102
|
+
...ChatSyncFanoutJobBaseShape,
|
|
103
|
+
selectorKind: z.literal('policyEditAffectedUsers'),
|
|
104
|
+
selectorArgs: channelFanoutSelectorArgs,
|
|
105
|
+
}).strict(),
|
|
106
|
+
z.object({
|
|
107
|
+
...ChatSyncFanoutJobBaseShape,
|
|
108
|
+
selectorKind: z.literal('workChannelsForUser'),
|
|
109
|
+
selectorArgs: z.object({
|
|
110
|
+
uid: z.string().min(1),
|
|
111
|
+
workProjectId: z.string().min(1),
|
|
112
|
+
}).strict(),
|
|
113
|
+
}).strict(),
|
|
114
|
+
z.object({
|
|
115
|
+
...ChatSyncFanoutJobBaseShape,
|
|
116
|
+
selectorKind: z.literal('inviteParticipants'),
|
|
117
|
+
selectorArgs: inviteParticipantsSelectorArgs,
|
|
118
|
+
}).strict(),
|
|
119
|
+
]);
|
|
89
120
|
// ── chatMessageOutbox/{commandId} ───────────────────────────────────────────
|
|
90
121
|
export const ChatMessageOutboxSchema = z.object({
|
|
91
122
|
commandId: z.string(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-sync.js","sourceRoot":"","sources":["../../src/doc-schemas/chat-sync.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,+EAA+E;AAC/E,gFAAgF;AAChF,mFAAmF;AACnF,+EAA+E;AAC/E,iFAAiF;AACjF,iFAAiF;AACjF,gEAAgE;AAEhE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,6GAA6G;AAC7G,MAAM,aAAa,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC;AAE7C,+EAA+E;AAC/E,+EAA+E;AAC/E,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC9C,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,GAAG,EAAE,CAAC,CAAC,MAAM,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AAQ,EAAE;IAChC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,aAAa;CACxB,CAAC,CAAC;AAGH,gFAAgF;AAChF,iFAAiF;AACjF,yFAAyF;AACzF,MAAM,CAAC,MAAM,2CAA2C,GAAG,CAAC,CAAC,MAAM,CAAC;IAClE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1C,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxC,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACzC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;CACzC,CAAC,CAAC","sourcesContent":["// Chat realtime SYNC / projection / command Firestore schemas (chat-edge-rebuild P1).\n// The chat sync / projection / command (Firestore-side) field lists are FROZEN\n// here — this file is their single source; the durable design owner is ttt-prod\n// docs/design/chat-realtime-system.md. All of these collections are Admin-SDK-only\n// (`allow read, write: if false`). Per the TTT timestamp convention every time\n// field is epoch-ms `number`; the SINGLE exception is the native-TTL `expireAt`,\n// which is a real Firestore `Timestamp` (modeled as `unknown` so the drift-check\n// does not false-flag a Timestamp object against `z.number()`).\n\nimport { z } from 'zod';\nimport { systemRoleSchema } from '../schemas/atoms.js';\n\n/** Native-TTL field — a real Firestore Timestamp (NOT epoch-ms). Absent until the terminal that sets TTL. */\nconst expireAtField = z.unknown().optional();\n\n// ── chatChannelAuthProjections/{authPairKey} ────────────────────────────────\n// Per-(user, channel) authorization FACT. Absent ⇒ removed/deny (fail-closed).\nexport const ChatChannelAuthProjectionSchema = z.object({\n channelRefScope: z.enum(['channel', 'invite']),\n workProjectId: z.string().nullable(),\n guildChatChannelId: z.string().nullable(),\n guildInviteId: z.string().nullable(),\n uid: z.string(),\n channelKey: z.string(),\n channelAuthState: z.enum(['authorized', 'removed']),\n channelAuthVersion: z.number(),\n inputFingerprint: z.string(),\n updatedAt: z.number(),\n // Reconcile cursor — advanced on every reconciler visit, including a no-op one, so a stuck\n // window rotates. Absent until the reconciler first reaches the projection.\n lastReconciledAt: z.number().optional(),\n});\nexport type ChatChannelAuthProjection = z.infer<typeof ChatChannelAuthProjectionSchema>;\n\n// ── chatScopeDegraded/{scopeKey} (+ causes/{causeId}) ───────────────────────\n// Exists IFF unresolvedCauseCount > 0. Grant mints fail closed while it exists.\nexport const ChatScopeDegradedSchema = z.object({\n scopeKey: z.string(),\n scopeKind: z.enum(['channel', 'memberInWork']),\n // channel scope carries the channelRef tuple; memberInWork carries {uid, workProjectId}.\n workProjectId: z.string().nullable(),\n guildChatChannelId: z.string().nullable(),\n guildInviteId: z.string().nullable(),\n uid: z.string().nullable(),\n unresolvedCauseCount: z.number(),\n updatedAt: z.number(),\n});\nexport type ChatScopeDegraded = z.infer<typeof ChatScopeDegradedSchema>;\n\nexport const ChatScopeDegradedCauseSchema = z.object({\n causeId: z.string(),\n kind: z.enum(['syncEvent', 'fanoutJob']),\n ref: z.string(),\n deadLetteredAt: z.number(),\n});\nexport type ChatScopeDegradedCause = z.infer<typeof ChatScopeDegradedCauseSchema>;\n\n// ── chatSyncEvents/{eventId} ────────────────────────────────────────────────\nexport const ChatSyncEventSchema = z.object({\n eventId: z.string(),\n targetDo: z.string(),\n kind: z.enum(['channelAuth', 'accountAccess', 'config', 'serverMessage']),\n version: z.number(),\n payload: z.record(z.string(), z.unknown()).nullable(),\n tombstone: z.boolean().optional(),\n payloadHash: z.string(),\n status: z.enum(['pending', 'delivered', 'deadLetter']),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n createdAt: z.number(),\n deliveredResult: z.record(z.string(), z.unknown()).nullable(),\n deliveredAt: z.number().nullable(),\n deadLetteredAt: z.number().nullable(),\n expireAt: expireAtField,\n});\nexport type ChatSyncEvent = z.infer<typeof ChatSyncEventSchema>;\n\n// ── chatSyncFanoutJobs/{jobId} ──────────────────────────────────────────────\nexport const ChatSyncFanoutJobSchema = z.object({\n jobId: z.string(),\n selectorKind: z.enum(['channelMembers', 'workChannelsForUser', 'policyEditAffectedUsers']),\n selectorArgs: z.object({\n workProjectId: z.string().optional(),\n channelKey: z.string().optional(),\n uid: z.string().optional(),\n }),\n causeVersion: z.number(),\n cursor: z.object({ pageIndex: z.number(), lastDocId: z.string().nullable() }),\n revision: z.number(),\n status: z.enum(['pending', 'complete', 'deadLetter']),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n createdAt: z.number(),\n completedAt: z.number().nullable(),\n deadLetteredAt: z.number().nullable(),\n expireAt: expireAtField,\n});\nexport type ChatSyncFanoutJob = z.infer<typeof ChatSyncFanoutJobSchema>;\n\n// ── chatMessageOutbox/{commandId} ───────────────────────────────────────────\nexport const ChatMessageOutboxSchema = z.object({\n commandId: z.string(),\n kind: z.enum(['userMsg', 'systemMsg']),\n threadRef: z.string(),\n payload: z.record(z.string(), z.unknown()),\n payloadVersion: z.number(),\n status: z.enum(['pending', 'applied', 'deadLetter']),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n createdAt: z.number(),\n appliedAt: z.number().nullable(),\n deadLetteredAt: z.number().nullable(),\n expireAt: expireAtField,\n});\nexport type ChatMessageOutbox = z.infer<typeof ChatMessageOutboxSchema>;\n\n// ── chatAdminActionCommands/{requestId} ─────────────────────────────────────\n// `requestId` IS the doc id + DO dedup key. `delivering` is NOT a lease (it sets\n// nextAttemptAt = now + DELIVERY_TIMEOUT). terminalFailureGeneration default 0.\nexport const ChatAdminActionCommandSchema = z.object({\n requestId: z.string(),\n actorUid: z.string(),\n actorMode: z.enum(['adminReview', 'adminOverride']),\n systemRole: systemRoleSchema,\n channelRef: z.record(z.string(), z.unknown()),\n messageSeq: z.number(),\n action: z.enum(['hide', 'delete']),\n caseId: z.string(),\n reason: z.string(),\n expectedMessageRevision: z.number(),\n payloadHash: z.string(),\n // `safetyRepair` is the NONTERMINAL stall loop: a RESERVED command whose reconcile\n // leg (PROBE → FINALIZE) failed past ADMIN_COMMAND_MAX_ATTEMPTS. Drained like\n // `delivering`; never dead-letters.\n state: z.enum(['queued', 'delivering', 'safetyRepair', 'applied', 'failed', 'deadLetter']),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n result: z.record(z.string(), z.unknown()).nullable(),\n doRevisionId: z.string().nullable(),\n terminalFailureGeneration: z.number(),\n createdAt: z.number(),\n appliedAt: z.number().nullable(),\n failedAt: z.number().nullable(),\n deadLetteredAt: z.number().nullable(),\n reconciled: z.boolean(),\n reconciledAt: z.number().nullable(),\n safetyRepair: z.boolean(),\n // Monotonic counter of distinct entries into the safety-repair loop — keys the\n // per-entry idempotent failure audit.\n safetyRepairGeneration: z.number(),\n // Failed reconcile passes on an already-reserved command. Separate from\n // `attemptCount` (delivery attempts, which dead-letter); at the cap it escalates\n // once into `safetyRepair` instead of dead-lettering.\n reconcileAttemptCount: z.number(),\n expireAt: expireAtField,\n});\nexport type ChatAdminActionCommand = z.infer<typeof ChatAdminActionCommandSchema>;\n\n// ── chatHistoryAnonymizationJobs/{jobId} ────────────────────────────────────\n// Account-deletion history anonymization (Contract F; P8). Resumable + crash-safe:\n// the recorded source-manifest identity (key/hash/generation) + the three cursors\n// (scan/rewrite/delete) make every boundary restartable. jobId =\n// hash('chat-anonymize', channelDoId, epoch, anonymizedUid). `expireAt` (native TTL)\n// is set ONLY when the job reaches `done`.\n//\n// C-B1: the replacement generation is DO-OWNED — the Channel DO (single-threaded per\n// channel) allocates a DISTINCT monotonic generation per erasure off the epoch row and\n// rewrites against the CURRENT live manifest, so two erasures on one epoch chain instead\n// of colliding on a shared `anon-1` keyspace. These four fields are therefore RECORDED AT\n// SCAN (null until the DO reports/allocates them), not pinned at enqueue; if a concurrent\n// anonymization supersedes the source between scan and swap, the job resets to `scanning`\n// to re-derive against the new current manifest (keeping its own allocated generation).\nexport const ChatHistoryAnonymizationJobSchema = z.object({\n jobId: z.string(),\n channelDoId: z.string(),\n epoch: z.number(),\n anonymizedUid: z.string(),\n sourceManifestKey: z.string().nullable(),\n sourceManifestHash: z.string().nullable(),\n sourceGeneration: z.number().nullable(),\n replacementGeneration: z.number().nullable(),\n newManifestKey: z.string().nullable(),\n scanCursor: z.number(),\n rewriteCursor: z.number(),\n deleteCursor: z.number(),\n swappedAt: z.number().nullable(),\n state: z.enum(['scanning', 'rewriting', 'swapping', 'deleting', 'done', 'failed']),\n legalHoldPaused: z.boolean(),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n createdAt: z.number(),\n updatedAt: z.number(),\n expireAt: expireAtField,\n});\nexport type ChatHistoryAnonymizationJob = z.infer<typeof ChatHistoryAnonymizationJobSchema>;\n\n// ── chatHistoryAnonymizationJobs/{jobId}/affectedChunks/{chunkOrdinal} ───────\n// The non-contiguous affected-chunk set (round-16 finding 7) — a crash after the\n// manifest swap resumes deletion from these rows + `deleteCursor` without re-listing R2.\nexport const ChatHistoryAnonymizationAffectedChunkSchema = z.object({\n chunkOrdinal: z.number(),\n sourceChunkKey: z.string(),\n sourceSha256: z.string(),\n replacementChunkKey: z.string().nullable(),\n replacementSha256: z.string().nullable(),\n rewriteState: z.enum(['pending', 'done']),\n deleteState: z.enum(['pending', 'done']),\n});\nexport type ChatHistoryAnonymizationAffectedChunk = z.infer<typeof ChatHistoryAnonymizationAffectedChunkSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"chat-sync.js","sourceRoot":"","sources":["../../src/doc-schemas/chat-sync.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,+EAA+E;AAC/E,gFAAgF;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E;IAC1C,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxC,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACzC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;CACzC,CAAC,CAAC","sourcesContent":["// Chat realtime SYNC / projection / command Firestore schemas (chat-edge-rebuild P1).\n// The chat sync / projection / command (Firestore-side) field lists are FROZEN\n// here — this file is their single source; the durable design owner is ttt-prod\n// docs/design/chat-realtime-system.md. All of these collections are Admin-SDK-only\n// (`allow read, write: if false`). Per the TTT timestamp convention every time\n// field is epoch-ms `number`; the SINGLE exception is the native-TTL `expireAt`,\n// which is a real Firestore `Timestamp` (modeled as `unknown` so the drift-check\n// does not false-flag a Timestamp object against `z.number()`).\n\nimport { z } from 'zod';\nimport { systemRoleSchema } from '../schemas/atoms.js';\n\n/** Native-TTL field — a real Firestore Timestamp (NOT epoch-ms). Absent until the terminal that sets TTL. */\nconst expireAtField = z.unknown().optional();\n\n// ── chatChannelAuthProjections/{authPairKey} ────────────────────────────────\n// Per-(user, channel) authorization FACT. Absent ⇒ removed/deny (fail-closed).\nexport const ChatChannelAuthProjectionSchema = z.object({\n channelRefScope: z.enum(['channel', 'invite']),\n workProjectId: z.string().nullable(),\n guildChatChannelId: z.string().nullable(),\n guildInviteId: z.string().nullable(),\n uid: z.string(),\n channelKey: z.string(),\n channelAuthState: z.enum(['authorized', 'removed']),\n channelAuthVersion: z.number(),\n inputFingerprint: z.string(),\n updatedAt: z.number(),\n // Reconcile cursor — advanced on every reconciler visit, including a no-op one, so a stuck\n // window rotates. Absent until the reconciler first reaches the projection.\n lastReconciledAt: z.number().optional(),\n});\nexport type ChatChannelAuthProjection = z.infer<typeof ChatChannelAuthProjectionSchema>;\n\n// ── chatScopeDegraded/{scopeKey} (+ causes/{causeId}) ───────────────────────\n// Exists IFF unresolvedCauseCount > 0. Grant mints fail closed while it exists.\nexport const ChatScopeDegradedSchema = z.object({\n scopeKey: z.string(),\n scopeKind: z.enum(['channel', 'memberInWork']),\n // channel scope carries the channelRef tuple; memberInWork carries {uid, workProjectId}.\n workProjectId: z.string().nullable(),\n guildChatChannelId: z.string().nullable(),\n guildInviteId: z.string().nullable(),\n uid: z.string().nullable(),\n unresolvedCauseCount: z.number(),\n updatedAt: z.number(),\n});\nexport type ChatScopeDegraded = z.infer<typeof ChatScopeDegradedSchema>;\n\nexport const ChatScopeDegradedCauseSchema = z.object({\n causeId: z.string(),\n kind: z.enum(['syncEvent', 'fanoutJob']),\n ref: z.string(),\n deadLetteredAt: z.number(),\n});\nexport type ChatScopeDegradedCause = z.infer<typeof ChatScopeDegradedCauseSchema>;\n\n// ── chatSyncEvents/{eventId} ────────────────────────────────────────────────\nexport const ChatSyncEventSchema = z.object({\n eventId: z.string(),\n targetDo: z.string(),\n kind: z.enum(['channelAuth', 'accountAccess', 'config', 'serverMessage']),\n version: z.number(),\n payload: z.record(z.string(), z.unknown()).nullable(),\n tombstone: z.boolean().optional(),\n payloadHash: z.string(),\n status: z.enum(['pending', 'delivered', 'deadLetter']),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n createdAt: z.number(),\n deliveredResult: z.record(z.string(), z.unknown()).nullable(),\n deliveredAt: z.number().nullable(),\n deadLetteredAt: z.number().nullable(),\n expireAt: expireAtField,\n});\nexport type ChatSyncEvent = z.infer<typeof ChatSyncEventSchema>;\n\n// ── chatSyncFanoutJobs/{jobId} ──────────────────────────────────────────────\n// The selector is a closed discriminated contract. The worker has different expansion\n// semantics for a Work-channel page, a member-in-Work page, and the fixed two-person\n// invite re-drive; a loose optional bag lets malformed persisted jobs silently wedge.\nconst ChatSyncFanoutJobBaseShape = {\n jobId: z.string(),\n causeVersion: z.number(),\n cursor: z.object({ pageIndex: z.number(), lastDocId: z.string().nullable() }),\n revision: z.number(),\n status: z.enum(['pending', 'complete', 'deadLetter']),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n createdAt: z.number(),\n completedAt: z.number().nullable(),\n deadLetteredAt: z.number().nullable(),\n expireAt: expireAtField,\n};\n\nconst channelFanoutSelectorArgs = z.object({\n workProjectId: z.string().min(1),\n guildChatChannelId: z.string().min(1),\n channelKey: z.string().min(1),\n}).strict();\n\nconst inviteParticipantsSelectorArgs = z.object({\n guildInviteId: z.string().min(1),\n participantUids: z.array(z.string().min(1)).length(2).refine(\n (uids) => new Set(uids).size === uids.length,\n { message: 'Invite participant uids must be distinct.' },\n ),\n}).strict();\n\nexport const ChatSyncFanoutJobSchema = z.discriminatedUnion('selectorKind', [\n z.object({\n ...ChatSyncFanoutJobBaseShape,\n selectorKind: z.literal('channelMembers'),\n selectorArgs: channelFanoutSelectorArgs,\n }).strict(),\n z.object({\n ...ChatSyncFanoutJobBaseShape,\n selectorKind: z.literal('policyEditAffectedUsers'),\n selectorArgs: channelFanoutSelectorArgs,\n }).strict(),\n z.object({\n ...ChatSyncFanoutJobBaseShape,\n selectorKind: z.literal('workChannelsForUser'),\n selectorArgs: z.object({\n uid: z.string().min(1),\n workProjectId: z.string().min(1),\n }).strict(),\n }).strict(),\n z.object({\n ...ChatSyncFanoutJobBaseShape,\n selectorKind: z.literal('inviteParticipants'),\n selectorArgs: inviteParticipantsSelectorArgs,\n }).strict(),\n]);\nexport type ChatSyncFanoutJob = z.infer<typeof ChatSyncFanoutJobSchema>;\n\n// ── chatMessageOutbox/{commandId} ───────────────────────────────────────────\nexport const ChatMessageOutboxSchema = z.object({\n commandId: z.string(),\n kind: z.enum(['userMsg', 'systemMsg']),\n threadRef: z.string(),\n payload: z.record(z.string(), z.unknown()),\n payloadVersion: z.number(),\n status: z.enum(['pending', 'applied', 'deadLetter']),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n createdAt: z.number(),\n appliedAt: z.number().nullable(),\n deadLetteredAt: z.number().nullable(),\n expireAt: expireAtField,\n});\nexport type ChatMessageOutbox = z.infer<typeof ChatMessageOutboxSchema>;\n\n// ── chatAdminActionCommands/{requestId} ─────────────────────────────────────\n// `requestId` IS the doc id + DO dedup key. `delivering` is NOT a lease (it sets\n// nextAttemptAt = now + DELIVERY_TIMEOUT). terminalFailureGeneration default 0.\nexport const ChatAdminActionCommandSchema = z.object({\n requestId: z.string(),\n actorUid: z.string(),\n actorMode: z.enum(['adminReview', 'adminOverride']),\n systemRole: systemRoleSchema,\n channelRef: z.record(z.string(), z.unknown()),\n messageSeq: z.number(),\n action: z.enum(['hide', 'delete']),\n caseId: z.string(),\n reason: z.string(),\n expectedMessageRevision: z.number(),\n payloadHash: z.string(),\n // `safetyRepair` is the NONTERMINAL stall loop: a RESERVED command whose reconcile\n // leg (PROBE → FINALIZE) failed past ADMIN_COMMAND_MAX_ATTEMPTS. Drained like\n // `delivering`; never dead-letters.\n state: z.enum(['queued', 'delivering', 'safetyRepair', 'applied', 'failed', 'deadLetter']),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n result: z.record(z.string(), z.unknown()).nullable(),\n doRevisionId: z.string().nullable(),\n terminalFailureGeneration: z.number(),\n createdAt: z.number(),\n appliedAt: z.number().nullable(),\n failedAt: z.number().nullable(),\n deadLetteredAt: z.number().nullable(),\n reconciled: z.boolean(),\n reconciledAt: z.number().nullable(),\n safetyRepair: z.boolean(),\n // Monotonic counter of distinct entries into the safety-repair loop — keys the\n // per-entry idempotent failure audit.\n safetyRepairGeneration: z.number(),\n // Failed reconcile passes on an already-reserved command. Separate from\n // `attemptCount` (delivery attempts, which dead-letter); at the cap it escalates\n // once into `safetyRepair` instead of dead-lettering.\n reconcileAttemptCount: z.number(),\n expireAt: expireAtField,\n});\nexport type ChatAdminActionCommand = z.infer<typeof ChatAdminActionCommandSchema>;\n\n// ── chatHistoryAnonymizationJobs/{jobId} ────────────────────────────────────\n// Account-deletion history anonymization (Contract F; P8). Resumable + crash-safe:\n// the recorded source-manifest identity (key/hash/generation) + the three cursors\n// (scan/rewrite/delete) make every boundary restartable. jobId =\n// hash('chat-anonymize', channelDoId, epoch, anonymizedUid). `expireAt` (native TTL)\n// is set ONLY when the job reaches `done`.\n//\n// C-B1: the replacement generation is DO-OWNED — the Channel DO (single-threaded per\n// channel) allocates a DISTINCT monotonic generation per erasure off the epoch row and\n// rewrites against the CURRENT live manifest, so two erasures on one epoch chain instead\n// of colliding on a shared `anon-1` keyspace. These four fields are therefore RECORDED AT\n// SCAN (null until the DO reports/allocates them), not pinned at enqueue; if a concurrent\n// anonymization supersedes the source between scan and swap, the job resets to `scanning`\n// to re-derive against the new current manifest (keeping its own allocated generation).\nexport const ChatHistoryAnonymizationJobSchema = z.object({\n jobId: z.string(),\n channelDoId: z.string(),\n epoch: z.number(),\n anonymizedUid: z.string(),\n sourceManifestKey: z.string().nullable(),\n sourceManifestHash: z.string().nullable(),\n sourceGeneration: z.number().nullable(),\n replacementGeneration: z.number().nullable(),\n newManifestKey: z.string().nullable(),\n scanCursor: z.number(),\n rewriteCursor: z.number(),\n deleteCursor: z.number(),\n swappedAt: z.number().nullable(),\n state: z.enum(['scanning', 'rewriting', 'swapping', 'deleting', 'done', 'failed']),\n legalHoldPaused: z.boolean(),\n attemptCount: z.number(),\n nextAttemptAt: z.number(),\n lastError: z.string().nullable(),\n createdAt: z.number(),\n updatedAt: z.number(),\n expireAt: expireAtField,\n});\nexport type ChatHistoryAnonymizationJob = z.infer<typeof ChatHistoryAnonymizationJobSchema>;\n\n// ── chatHistoryAnonymizationJobs/{jobId}/affectedChunks/{chunkOrdinal} ───────\n// The non-contiguous affected-chunk set (round-16 finding 7) — a crash after the\n// manifest swap resumes deletion from these rows + `deleteCursor` without re-listing R2.\nexport const ChatHistoryAnonymizationAffectedChunkSchema = z.object({\n chunkOrdinal: z.number(),\n sourceChunkKey: z.string(),\n sourceSha256: z.string(),\n replacementChunkKey: z.string().nullable(),\n replacementSha256: z.string().nullable(),\n rewriteState: z.enum(['pending', 'done']),\n deleteState: z.enum(['pending', 'done']),\n});\nexport type ChatHistoryAnonymizationAffectedChunk = z.infer<typeof ChatHistoryAnonymizationAffectedChunkSchema>;\n"]}
|
|
@@ -31,8 +31,8 @@ export declare const FullChapterSchema: z.ZodObject<{
|
|
|
31
31
|
photoAssetId: z.ZodOptional<z.ZodString>;
|
|
32
32
|
status: z.ZodEnum<{
|
|
33
33
|
unpublished: "unpublished";
|
|
34
|
-
pending_approval: "pending_approval";
|
|
35
34
|
published: "published";
|
|
35
|
+
pending_approval: "pending_approval";
|
|
36
36
|
}>;
|
|
37
37
|
createdOn: z.ZodNumber;
|
|
38
38
|
}, z.core.$strip>;
|
|
@@ -64,8 +64,8 @@ export declare const FullTuneTrackSchema: z.ZodObject<{
|
|
|
64
64
|
photoAssetId: z.ZodOptional<z.ZodString>;
|
|
65
65
|
status: z.ZodEnum<{
|
|
66
66
|
unpublished: "unpublished";
|
|
67
|
-
pending_approval: "pending_approval";
|
|
68
67
|
published: "published";
|
|
68
|
+
pending_approval: "pending_approval";
|
|
69
69
|
}>;
|
|
70
70
|
createdOn: z.ZodNumber;
|
|
71
71
|
}, z.core.$strip>;
|
|
@@ -97,8 +97,8 @@ export declare const FullTelevisionEpisodeSchema: z.ZodObject<{
|
|
|
97
97
|
photoAssetId: z.ZodOptional<z.ZodString>;
|
|
98
98
|
status: z.ZodEnum<{
|
|
99
99
|
unpublished: "unpublished";
|
|
100
|
-
pending_approval: "pending_approval";
|
|
101
100
|
published: "published";
|
|
101
|
+
pending_approval: "pending_approval";
|
|
102
102
|
}>;
|
|
103
103
|
createdOn: z.ZodNumber;
|
|
104
104
|
}, z.core.$strip>;
|
|
@@ -185,7 +185,13 @@ export declare const PublishedHallItemStatusSchema: z.ZodEnum<{
|
|
|
185
185
|
banned: "banned";
|
|
186
186
|
}>;
|
|
187
187
|
export type PublishedHallItemStatus = z.infer<typeof PublishedHallItemStatusSchema>;
|
|
188
|
-
|
|
188
|
+
/**
|
|
189
|
+
* Older valid rows stored the same closed fields directly as a map and already carry
|
|
190
|
+
* the authoritative request-level surface. Normalize that legacy representation while
|
|
191
|
+
* reading so deployment does not strand outstanding requests; all new writers use the
|
|
192
|
+
* closed discriminated patch above.
|
|
193
|
+
*/
|
|
194
|
+
export declare const HallContentChangeRequestSchema: z.ZodPreprocess<z.ZodObject<{
|
|
189
195
|
changeRequestId: z.ZodString;
|
|
190
196
|
requestKind: z.ZodLiteral<"text">;
|
|
191
197
|
targetKey: z.ZodString;
|
|
@@ -208,7 +214,7 @@ export declare const HallContentChangeRequestSchema: z.ZodObject<{
|
|
|
208
214
|
workRealmId: z.ZodNullable<z.ZodString>;
|
|
209
215
|
subItemId: z.ZodNullable<z.ZodString>;
|
|
210
216
|
proposerUid: z.ZodString;
|
|
211
|
-
proposedFields: z.
|
|
217
|
+
proposedFields: z.ZodUnion<[z.ZodType<import("../schemas/hall-library.js").HallContentTextPatch, unknown, z.core.$ZodTypeInternals<import("../schemas/hall-library.js").HallContentTextPatch, unknown>>, z.ZodType<import("../schemas/hall-library.js").HallContentTextPatch, unknown, z.core.$ZodTypeInternals<import("../schemas/hall-library.js").HallContentTextPatch, unknown>>, ...z.ZodType<import("../schemas/hall-library.js").HallContentTextPatch, unknown, z.core.$ZodTypeInternals<import("../schemas/hall-library.js").HallContentTextPatch, unknown>>[]]>;
|
|
212
218
|
status: z.ZodEnum<{
|
|
213
219
|
approved: "approved";
|
|
214
220
|
denied: "denied";
|
|
@@ -219,7 +225,7 @@ export declare const HallContentChangeRequestSchema: z.ZodObject<{
|
|
|
219
225
|
resolvedAt: z.ZodOptional<z.ZodNumber>;
|
|
220
226
|
resolvedBy: z.ZodOptional<z.ZodString>;
|
|
221
227
|
resolutionReason: z.ZodOptional<z.ZodString>;
|
|
222
|
-
}, z.core.$strip
|
|
228
|
+
}, z.core.$strip>>;
|
|
223
229
|
export type HallContentChangeRequest = z.infer<typeof HallContentChangeRequestSchema>;
|
|
224
230
|
export declare const PublishedHallItemSchema: z.ZodObject<{
|
|
225
231
|
hallItemId: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/doc-schemas/content.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/doc-schemas/content.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,eAAO,MAAM,cAAc;;;;EAA2D,CAAC;AACvF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAItD,eAAO,MAAM,cAAc;;;;;;;;;;;;iBAWzB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;iBAW5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,cAAc;;;;;;;;;;;;iBAWzB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;iBAY9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;iBAW/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;iBAYtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG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pSchema, ModerationEdgeSyncStateSchema } from './moderation.js';
|
|
9
|
+
import { HallContentTextPatchSchema } from '../schemas/hall-library.js';
|
|
10
|
+
import { HALL_CONTENT_SURFACES_BY_WORK_TYPE } from '../constants/business-content.js';
|
|
9
11
|
const contentStatusSchema = z.enum(['unpublished', 'pending_approval', 'published']);
|
|
10
12
|
// Per-field moderation text-clear remedy (shared shape across the content family — Tale/Tune/
|
|
11
13
|
// Television details, their chapter/track/episode sub-items, and the published Hall projections of
|
|
@@ -167,7 +169,7 @@ export const PublishedHallItemStatusSchema = z.enum(['published', 'paused', 'ban
|
|
|
167
169
|
// item + its live in-Work source doc; deny = nothing changes, `resolutionReason` shown
|
|
168
170
|
// to the member. Writes are callable-only; reads are the owning work's active guildmates
|
|
169
171
|
// + admins. `requestKind` future-proofs a media variant (new kind, no schema break).
|
|
170
|
-
|
|
172
|
+
const HallContentChangeRequestCanonicalSchema = z.object({
|
|
171
173
|
changeRequestId: z.string(),
|
|
172
174
|
requestKind: z.literal('text'),
|
|
173
175
|
// One-open-per-target enforcement/query key. Hall grains:
|
|
@@ -188,9 +190,9 @@ export const HallContentChangeRequestSchema = z.object({
|
|
|
188
190
|
// chapter/track/episode sub-item.
|
|
189
191
|
subItemId: z.string().nullable(),
|
|
190
192
|
proposerUid: z.string(),
|
|
191
|
-
//
|
|
192
|
-
//
|
|
193
|
-
proposedFields:
|
|
193
|
+
// Closed, surface-discriminated text patch. The persisted surface and patch surface must
|
|
194
|
+
// agree, and the patch contains only fields that surface owns.
|
|
195
|
+
proposedFields: HallContentTextPatchSchema,
|
|
194
196
|
status: z.enum(['requested', 'approved', 'denied']),
|
|
195
197
|
createdAt: z.number(),
|
|
196
198
|
lastUpdatedAt: z.number(),
|
|
@@ -198,7 +200,66 @@ export const HallContentChangeRequestSchema = z.object({
|
|
|
198
200
|
resolvedBy: z.string().optional(),
|
|
199
201
|
// Admin's reason, surfaced to the member (required on a deny).
|
|
200
202
|
resolutionReason: z.string().optional(),
|
|
203
|
+
}).superRefine((value, ctx) => {
|
|
204
|
+
const patchSurface = value.proposedFields.surface;
|
|
205
|
+
if (patchSurface !== value.surface) {
|
|
206
|
+
ctx.addIssue({
|
|
207
|
+
code: z.ZodIssueCode.custom,
|
|
208
|
+
message: 'The proposed text patch surface must match the request surface.',
|
|
209
|
+
path: ['proposedFields', 'surface'],
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
if (value.surface === 'workRealm') {
|
|
213
|
+
if (value.hallItemId !== null || value.workProjectType !== null || value.workRealmId === null || value.subItemId !== null) {
|
|
214
|
+
ctx.addIssue({
|
|
215
|
+
code: z.ZodIssueCode.custom,
|
|
216
|
+
message: 'A workRealm request must carry only the realm target grain.',
|
|
217
|
+
path: ['surface'],
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (value.hallItemId === null || value.workProjectType === null || value.workRealmId !== null) {
|
|
223
|
+
ctx.addIssue({
|
|
224
|
+
code: z.ZodIssueCode.custom,
|
|
225
|
+
message: 'A Hall request must carry a hall item and work-project type, not a realm.',
|
|
226
|
+
path: ['surface'],
|
|
227
|
+
});
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const routing = HALL_CONTENT_SURFACES_BY_WORK_TYPE[value.workProjectType];
|
|
231
|
+
const expectedSurface = value.subItemId === null ? routing.detailSurface : routing.subItemSurface;
|
|
232
|
+
if (value.surface !== expectedSurface) {
|
|
233
|
+
ctx.addIssue({
|
|
234
|
+
code: z.ZodIssueCode.custom,
|
|
235
|
+
message: `The target grain requires the ${expectedSurface} surface.`,
|
|
236
|
+
path: ['surface'],
|
|
237
|
+
});
|
|
238
|
+
}
|
|
201
239
|
});
|
|
240
|
+
/**
|
|
241
|
+
* Older valid rows stored the same closed fields directly as a map and already carry
|
|
242
|
+
* the authoritative request-level surface. Normalize that legacy representation while
|
|
243
|
+
* reading so deployment does not strand outstanding requests; all new writers use the
|
|
244
|
+
* closed discriminated patch above.
|
|
245
|
+
*/
|
|
246
|
+
export const HallContentChangeRequestSchema = z.preprocess((raw) => {
|
|
247
|
+
if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
|
|
248
|
+
return raw;
|
|
249
|
+
const value = raw;
|
|
250
|
+
const proposedFields = value.proposedFields;
|
|
251
|
+
if (typeof proposedFields === 'object'
|
|
252
|
+
&& proposedFields !== null
|
|
253
|
+
&& !Array.isArray(proposedFields)
|
|
254
|
+
&& !Object.prototype.hasOwnProperty.call(proposedFields, 'surface')
|
|
255
|
+
&& typeof value.surface === 'string') {
|
|
256
|
+
return {
|
|
257
|
+
...value,
|
|
258
|
+
proposedFields: { surface: value.surface, fields: proposedFields },
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
return raw;
|
|
262
|
+
}, HallContentChangeRequestCanonicalSchema);
|
|
202
263
|
export const PublishedHallItemSchema = z.object({
|
|
203
264
|
hallItemId: z.string(),
|
|
204
265
|
workProjectId: z.string(),
|