@ttt-productions/ttt-core 0.79.69 → 0.79.71
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/operational.d.ts +10 -3
- package/dist/doc-schemas/operational.d.ts.map +1 -1
- package/dist/doc-schemas/operational.js +10 -2
- package/dist/doc-schemas/operational.js.map +1 -1
- package/dist/doc-schemas/registry.d.ts +2 -1
- package/dist/doc-schemas/registry.d.ts.map +1 -1
- package/dist/utils/pledge-totals.d.ts +16 -3
- package/dist/utils/pledge-totals.d.ts.map +1 -1
- package/dist/utils/pledge-totals.js +20 -3
- package/dist/utils/pledge-totals.js.map +1 -1
- package/package.json +3 -3
|
@@ -60,19 +60,25 @@ export declare const StatusReconcileQueueAuthEffectSchema: z.ZodEnum<{
|
|
|
60
60
|
registeredMemberClaim: "registeredMemberClaim";
|
|
61
61
|
}>;
|
|
62
62
|
export type StatusReconcileQueueAuthEffect = z.infer<typeof StatusReconcileQueueAuthEffectSchema>;
|
|
63
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* A status change's Auth effect, owed until it lands. Written in the SAME transaction as the status
|
|
65
|
+
* change (so a committed status always has its entry), removed once the Auth effect lands. `writeId`
|
|
66
|
+
* names the status change that wrote it: a removal compares it, so finishing an older change never
|
|
67
|
+
* removes the entry a newer change wrote. The drain converges the account on its canonical status.
|
|
68
|
+
*/
|
|
64
69
|
export declare const StatusReconcileQueueAccountStatusEntrySchema: z.ZodObject<{
|
|
70
|
+
reason: z.ZodLiteral<"statusChangePending">;
|
|
65
71
|
authEffect: z.ZodOptional<z.ZodLiteral<"accountStatus">>;
|
|
66
72
|
targetStatus: z.ZodEnum<{
|
|
67
73
|
banned: "banned";
|
|
68
74
|
active: "active";
|
|
69
75
|
suspended: "suspended";
|
|
70
76
|
}>;
|
|
77
|
+
writeId: z.ZodString;
|
|
71
78
|
uid: z.ZodString;
|
|
72
79
|
enqueuedAt: z.ZodNumber;
|
|
73
80
|
lastAttemptAt: z.ZodOptional<z.ZodNumber>;
|
|
74
81
|
attemptCount: z.ZodNumber;
|
|
75
|
-
reason: z.ZodLiteral<"postCommitAuthEffectFailed">;
|
|
76
82
|
}, z.core.$strip>;
|
|
77
83
|
export type StatusReconcileQueueAccountStatusEntry = z.infer<typeof StatusReconcileQueueAccountStatusEntrySchema>;
|
|
78
84
|
/** A failed `docsAccepted` claim write. Strict: it carries no status, so no `targetStatus`. */
|
|
@@ -106,17 +112,18 @@ export declare const StatusReconcileQueueRegisteredMemberClaimEntrySchema: z.Zod
|
|
|
106
112
|
}, z.core.$strict>;
|
|
107
113
|
export type StatusReconcileQueueRegisteredMemberClaimEntry = z.infer<typeof StatusReconcileQueueRegisteredMemberClaimEntrySchema>;
|
|
108
114
|
export declare const StatusReconcileQueueEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
115
|
+
reason: z.ZodLiteral<"statusChangePending">;
|
|
109
116
|
authEffect: z.ZodOptional<z.ZodLiteral<"accountStatus">>;
|
|
110
117
|
targetStatus: z.ZodEnum<{
|
|
111
118
|
banned: "banned";
|
|
112
119
|
active: "active";
|
|
113
120
|
suspended: "suspended";
|
|
114
121
|
}>;
|
|
122
|
+
writeId: z.ZodString;
|
|
115
123
|
uid: z.ZodString;
|
|
116
124
|
enqueuedAt: z.ZodNumber;
|
|
117
125
|
lastAttemptAt: z.ZodOptional<z.ZodNumber>;
|
|
118
126
|
attemptCount: z.ZodNumber;
|
|
119
|
-
reason: z.ZodLiteral<"postCommitAuthEffectFailed">;
|
|
120
127
|
}, z.core.$strip>, z.ZodObject<{
|
|
121
128
|
authEffect: z.ZodLiteral<"publicDocumentsAcceptedClaim">;
|
|
122
129
|
uid: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operational.d.ts","sourceRoot":"","sources":["../../src/doc-schemas/operational.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMx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
});
|
|
58
58
|
// statusReconcileQueue/{uid} — backend-only retry queue for post-commit Auth-effect reconciliation.
|
|
59
|
-
//
|
|
59
|
+
// A status change writes its entry in the status transaction itself; the other effects are written
|
|
60
|
+
// when a change committed to Firestore but its follow-on Auth effect failed. The drain
|
|
60
61
|
// re-converges every Auth-side mirror of the uid from its canonical docs and deletes the entry on
|
|
61
62
|
// success. Keyed by the affected uid (doc id == uid; one entry per uid, whichever effect queued
|
|
62
63
|
// it); Admin-SDK-only. Timestamps are epoch-millis numbers (this repo never uses Firestore
|
|
@@ -83,11 +84,18 @@ const statusReconcileQueueEntryBase = {
|
|
|
83
84
|
attemptCount: z.number(),
|
|
84
85
|
reason: z.literal('postCommitAuthEffectFailed'),
|
|
85
86
|
};
|
|
86
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* A status change's Auth effect, owed until it lands. Written in the SAME transaction as the status
|
|
89
|
+
* change (so a committed status always has its entry), removed once the Auth effect lands. `writeId`
|
|
90
|
+
* names the status change that wrote it: a removal compares it, so finishing an older change never
|
|
91
|
+
* removes the entry a newer change wrote. The drain converges the account on its canonical status.
|
|
92
|
+
*/
|
|
87
93
|
export const StatusReconcileQueueAccountStatusEntrySchema = z.object({
|
|
88
94
|
...statusReconcileQueueEntryBase,
|
|
95
|
+
reason: z.literal('statusChangePending'),
|
|
89
96
|
authEffect: z.literal('accountStatus').optional(),
|
|
90
97
|
targetStatus: UserAccountStatusSchema,
|
|
98
|
+
writeId: z.string(),
|
|
91
99
|
});
|
|
92
100
|
/** A failed `docsAccepted` claim write. Strict: it carries no status, so no `targetStatus`. */
|
|
93
101
|
export const StatusReconcileQueuePublicDocumentsAcceptedClaimEntrySchema = z
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operational.js","sourceRoot":"","sources":["../../src/doc-schemas/operational.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,kGAAkG;AAElG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB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EAA+E;AAC/E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACtD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;CAC1B,CAAC,CAAC","sourcesContent":["// Operational / utility Firestore document SCHEMAS — small backend-written docs that aren't\n// part of a feature domain. Reverse-engineered from their backend write sites. Types via z.infer.\n\nimport { z } from 'zod';\nimport { UserAccountStatusSchema } from './user.js';\nimport { ShortLinkTargetTypeSchema } from '../schemas/atoms.js';\n\n// reservedDisplayNames/{displayNameUppercase} — uniqueness claim written in the registerUser\n// transaction; existence == name taken. (functions/src/users/registerUser.ts)\nexport const ReservedDisplayNameSchema = z.object({\n userId: z.string(),\n displayName: z.string(),\n});\nexport type ReservedDisplayName = z.infer<typeof ReservedDisplayNameSchema>;\n\n// reservedRealmNames/{workingTitleUppercase} — platform-wide Realm-name uniqueness claim, written\n// in the createWorkRealm transaction (existence == name taken). Mirrors reservedDisplayNames; key is\n// the UPPERCASE realm working title. (legal-convo [BUILD]: realm names unique platform-wide.)\nexport const ReservedRealmNameSchema = z.object({\n workRealmId: z.string(),\n workingTitle: z.string(),\n // RETIRED name (DJ ruling 2026-07-12, option B): set true when a moderation\n // force-retitle removes this name — the name is dead platform-wide FOREVER; no\n // realm (including the original owner) can ever claim it again, and no rename\n // path releases the reservation. Ordinary renames release un-retired\n // reservations normally. Backend-only-writable.\n retired: z.boolean().optional(),\n});\nexport type ReservedRealmName = z.infer<typeof ReservedRealmNameSchema>;\n\n// stakeShareAuditEvents/{eventId} — Firestore-trigger audit of guildmate stake-share changes.\n// (functions/src/audit/runWorkProjectGuildmateUserStakeShareAudit.ts)\nexport const StakeShareAuditEventSchema = z.object({\n eventId: z.string(),\n subtype: z.string(),\n reason: z.string(),\n workProjectId: z.string(),\n guildmateUserUid: z.string(),\n guildmateUserPath: z.string(),\n beforeStakeShares: z.number().nullable(),\n afterStakeShares: z.number().nullable(),\n createdAt: z.number(),\n source: z.string(),\n});\nexport type StakeShareAuditEvent = z.infer<typeof StakeShareAuditEventSchema>;\n\n// shortLinks/{shortId} — short link to a share target (an audition, an audition entry, a\n// commission listing, or a whole Hall entry), with a click counter. Written once by\n// `createShortLink` and never deleted. `type` is the create input's target type.\nexport const ShortLinkSchema = z.object({\n shortId: z.string(),\n shortUrl: z.string(),\n destinationUrl: z.string(),\n type: ShortLinkTargetTypeSchema,\n // The ids of what the link points at, one field per target kind, null where it does not apply.\n metadata: z.object({\n auditionId: z.string().nullable(),\n auditionEntryId: z.string().nullable(),\n commissionListingId: z.string().nullable(),\n hallItemId: z.string().nullable(),\n }),\n createdAt: z.number(),\n createdBy: z.string(),\n clicks: z.number(),\n});\nexport type ShortLink = z.infer<typeof ShortLinkSchema>;\n\n// statusReconcileQueue/{uid} — backend-only retry queue for post-commit Auth-effect reconciliation.\n// Written when a change committed to Firestore but its follow-on Auth effect failed; the drain\n// re-converges every Auth-side mirror of the uid from its canonical docs and deletes the entry on\n// success. Keyed by the affected uid (doc id == uid; one entry per uid, whichever effect queued\n// it); Admin-SDK-only. Timestamps are epoch-millis numbers (this repo never uses Firestore\n// Timestamps).\n\n/**\n * Which post-commit Auth effect failed and queued the uid:\n * - `accountStatus` — the status claim / `disabled` flag / token revocation after a status change;\n * - `publicDocumentsAcceptedClaim` — the `docsAccepted` claim after a public-document acceptance;\n * - `adminClaims` — the admin-role claims after an admin-roster change;\n * - `registeredMemberClaim` — the registered-member claim after a registration completed.\n * An entry without `authEffect` predates the field and is an `accountStatus` entry.\n */\nexport const STATUS_RECONCILE_QUEUE_AUTH_EFFECTS = [\n 'accountStatus',\n 'publicDocumentsAcceptedClaim',\n 'adminClaims',\n 'registeredMemberClaim',\n] as const;\nexport const StatusReconcileQueueAuthEffectSchema = z.enum(STATUS_RECONCILE_QUEUE_AUTH_EFFECTS);\nexport type StatusReconcileQueueAuthEffect = z.infer<typeof StatusReconcileQueueAuthEffectSchema>;\n\nconst statusReconcileQueueEntryBase = {\n uid: z.string(),\n enqueuedAt: z.number(),\n lastAttemptAt: z.number().optional(),\n attemptCount: z.number(),\n reason: z.literal('postCommitAuthEffectFailed'),\n};\n\n/** A failed status effect: the drain drives the account toward `targetStatus`. */\nexport const StatusReconcileQueueAccountStatusEntrySchema = z.object({\n ...statusReconcileQueueEntryBase,\n authEffect: z.literal('accountStatus' satisfies StatusReconcileQueueAuthEffect).optional(),\n targetStatus: UserAccountStatusSchema,\n});\nexport type StatusReconcileQueueAccountStatusEntry = z.infer<typeof StatusReconcileQueueAccountStatusEntrySchema>;\n\n/** A failed `docsAccepted` claim write. Strict: it carries no status, so no `targetStatus`. */\nexport const StatusReconcileQueuePublicDocumentsAcceptedClaimEntrySchema = z\n .object({\n ...statusReconcileQueueEntryBase,\n authEffect: z.literal('publicDocumentsAcceptedClaim' satisfies StatusReconcileQueueAuthEffect),\n })\n .strict();\nexport type StatusReconcileQueuePublicDocumentsAcceptedClaimEntry = z.infer<\n typeof StatusReconcileQueuePublicDocumentsAcceptedClaimEntrySchema\n>;\n\n/** A failed admin-role claim write. Strict: it carries no status. */\nexport const StatusReconcileQueueAdminClaimsEntrySchema = z\n .object({\n ...statusReconcileQueueEntryBase,\n authEffect: z.literal('adminClaims' satisfies StatusReconcileQueueAuthEffect),\n })\n .strict();\nexport type StatusReconcileQueueAdminClaimsEntry = z.infer<typeof StatusReconcileQueueAdminClaimsEntrySchema>;\n\n/** A failed registered-member claim write. Strict: it carries no status. */\nexport const StatusReconcileQueueRegisteredMemberClaimEntrySchema = z\n .object({\n ...statusReconcileQueueEntryBase,\n authEffect: z.literal('registeredMemberClaim' satisfies StatusReconcileQueueAuthEffect),\n })\n .strict();\nexport type StatusReconcileQueueRegisteredMemberClaimEntry = z.infer<\n typeof StatusReconcileQueueRegisteredMemberClaimEntrySchema\n>;\n\nexport const StatusReconcileQueueEntrySchema = z.discriminatedUnion('authEffect', [\n StatusReconcileQueueAccountStatusEntrySchema,\n StatusReconcileQueuePublicDocumentsAcceptedClaimEntrySchema,\n StatusReconcileQueueAdminClaimsEntrySchema,\n StatusReconcileQueueRegisteredMemberClaimEntrySchema,\n]);\nexport type StatusReconcileQueueEntry = z.infer<typeof StatusReconcileQueueEntrySchema>;\n\n// feedbackAliases/{aliasId} — Console-managed map collapsing a synonym suggestion onto a canonical\n// one; read by submitFeedback, no callable writes it. (firestore.rules §3F / submitFeedback.ts)\nexport const FeedbackAliasSchema = z.object({\n canonicalId: z.string(),\n originalType: z.string(),\n});\nexport type FeedbackAlias = z.infer<typeof FeedbackAliasSchema>;\n\n// feedbackSubmissions/{feedbackType}/userSuggestions/{suggestionId} — an aggregated user\n// suggestion with its deduped submitter list + count. The path nests the feedbackSubmissions +\n// userSuggestions registry segments. (functions/src/utility/submitFeedback.ts)\nexport const UserSuggestionSchema = z.object({\n suggestionText: z.string(),\n count: z.number(),\n submittedBy: z.array(z.object({ userId: z.string() })),\n lastSubmitted: z.number(),\n});\nexport type UserSuggestion = z.infer<typeof UserSuggestionSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"operational.js","sourceRoot":"","sources":["../../src/doc-schemas/operational.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,kGAAkG;AAElG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,6FAA6F;AAC7F,8EAA8E;AAC9E,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,WAAW,EAAE,CAA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,MAAM,EAAE;IACjB,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACtD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;CAC1B,CAAC,CAAC","sourcesContent":["// Operational / utility Firestore document SCHEMAS — small backend-written docs that aren't\n// part of a feature domain. Reverse-engineered from their backend write sites. Types via z.infer.\n\nimport { z } from 'zod';\nimport { UserAccountStatusSchema } from './user.js';\nimport { ShortLinkTargetTypeSchema } from '../schemas/atoms.js';\n\n// reservedDisplayNames/{displayNameUppercase} — uniqueness claim written in the registerUser\n// transaction; existence == name taken. (functions/src/users/registerUser.ts)\nexport const ReservedDisplayNameSchema = z.object({\n userId: z.string(),\n displayName: z.string(),\n});\nexport type ReservedDisplayName = z.infer<typeof ReservedDisplayNameSchema>;\n\n// reservedRealmNames/{workingTitleUppercase} — platform-wide Realm-name uniqueness claim, written\n// in the createWorkRealm transaction (existence == name taken). Mirrors reservedDisplayNames; key is\n// the UPPERCASE realm working title. (legal-convo [BUILD]: realm names unique platform-wide.)\nexport const ReservedRealmNameSchema = z.object({\n workRealmId: z.string(),\n workingTitle: z.string(),\n // RETIRED name (DJ ruling 2026-07-12, option B): set true when a moderation\n // force-retitle removes this name — the name is dead platform-wide FOREVER; no\n // realm (including the original owner) can ever claim it again, and no rename\n // path releases the reservation. Ordinary renames release un-retired\n // reservations normally. Backend-only-writable.\n retired: z.boolean().optional(),\n});\nexport type ReservedRealmName = z.infer<typeof ReservedRealmNameSchema>;\n\n// stakeShareAuditEvents/{eventId} — Firestore-trigger audit of guildmate stake-share changes.\n// (functions/src/audit/runWorkProjectGuildmateUserStakeShareAudit.ts)\nexport const StakeShareAuditEventSchema = z.object({\n eventId: z.string(),\n subtype: z.string(),\n reason: z.string(),\n workProjectId: z.string(),\n guildmateUserUid: z.string(),\n guildmateUserPath: z.string(),\n beforeStakeShares: z.number().nullable(),\n afterStakeShares: z.number().nullable(),\n createdAt: z.number(),\n source: z.string(),\n});\nexport type StakeShareAuditEvent = z.infer<typeof StakeShareAuditEventSchema>;\n\n// shortLinks/{shortId} — short link to a share target (an audition, an audition entry, a\n// commission listing, or a whole Hall entry), with a click counter. Written once by\n// `createShortLink` and never deleted. `type` is the create input's target type.\nexport const ShortLinkSchema = z.object({\n shortId: z.string(),\n shortUrl: z.string(),\n destinationUrl: z.string(),\n type: ShortLinkTargetTypeSchema,\n // The ids of what the link points at, one field per target kind, null where it does not apply.\n metadata: z.object({\n auditionId: z.string().nullable(),\n auditionEntryId: z.string().nullable(),\n commissionListingId: z.string().nullable(),\n hallItemId: z.string().nullable(),\n }),\n createdAt: z.number(),\n createdBy: z.string(),\n clicks: z.number(),\n});\nexport type ShortLink = z.infer<typeof ShortLinkSchema>;\n\n// statusReconcileQueue/{uid} — backend-only retry queue for post-commit Auth-effect reconciliation.\n// A status change writes its entry in the status transaction itself; the other effects are written\n// when a change committed to Firestore but its follow-on Auth effect failed. The drain\n// re-converges every Auth-side mirror of the uid from its canonical docs and deletes the entry on\n// success. Keyed by the affected uid (doc id == uid; one entry per uid, whichever effect queued\n// it); Admin-SDK-only. Timestamps are epoch-millis numbers (this repo never uses Firestore\n// Timestamps).\n\n/**\n * Which post-commit Auth effect failed and queued the uid:\n * - `accountStatus` — the status claim / `disabled` flag / token revocation after a status change;\n * - `publicDocumentsAcceptedClaim` — the `docsAccepted` claim after a public-document acceptance;\n * - `adminClaims` — the admin-role claims after an admin-roster change;\n * - `registeredMemberClaim` — the registered-member claim after a registration completed.\n * An entry without `authEffect` predates the field and is an `accountStatus` entry.\n */\nexport const STATUS_RECONCILE_QUEUE_AUTH_EFFECTS = [\n 'accountStatus',\n 'publicDocumentsAcceptedClaim',\n 'adminClaims',\n 'registeredMemberClaim',\n] as const;\nexport const StatusReconcileQueueAuthEffectSchema = z.enum(STATUS_RECONCILE_QUEUE_AUTH_EFFECTS);\nexport type StatusReconcileQueueAuthEffect = z.infer<typeof StatusReconcileQueueAuthEffectSchema>;\n\nconst statusReconcileQueueEntryBase = {\n uid: z.string(),\n enqueuedAt: z.number(),\n lastAttemptAt: z.number().optional(),\n attemptCount: z.number(),\n reason: z.literal('postCommitAuthEffectFailed'),\n};\n\n/**\n * A status change's Auth effect, owed until it lands. Written in the SAME transaction as the status\n * change (so a committed status always has its entry), removed once the Auth effect lands. `writeId`\n * names the status change that wrote it: a removal compares it, so finishing an older change never\n * removes the entry a newer change wrote. The drain converges the account on its canonical status.\n */\nexport const StatusReconcileQueueAccountStatusEntrySchema = z.object({\n ...statusReconcileQueueEntryBase,\n reason: z.literal('statusChangePending'),\n authEffect: z.literal('accountStatus' satisfies StatusReconcileQueueAuthEffect).optional(),\n targetStatus: UserAccountStatusSchema,\n writeId: z.string(),\n});\nexport type StatusReconcileQueueAccountStatusEntry = z.infer<typeof StatusReconcileQueueAccountStatusEntrySchema>;\n\n/** A failed `docsAccepted` claim write. Strict: it carries no status, so no `targetStatus`. */\nexport const StatusReconcileQueuePublicDocumentsAcceptedClaimEntrySchema = z\n .object({\n ...statusReconcileQueueEntryBase,\n authEffect: z.literal('publicDocumentsAcceptedClaim' satisfies StatusReconcileQueueAuthEffect),\n })\n .strict();\nexport type StatusReconcileQueuePublicDocumentsAcceptedClaimEntry = z.infer<\n typeof StatusReconcileQueuePublicDocumentsAcceptedClaimEntrySchema\n>;\n\n/** A failed admin-role claim write. Strict: it carries no status. */\nexport const StatusReconcileQueueAdminClaimsEntrySchema = z\n .object({\n ...statusReconcileQueueEntryBase,\n authEffect: z.literal('adminClaims' satisfies StatusReconcileQueueAuthEffect),\n })\n .strict();\nexport type StatusReconcileQueueAdminClaimsEntry = z.infer<typeof StatusReconcileQueueAdminClaimsEntrySchema>;\n\n/** A failed registered-member claim write. Strict: it carries no status. */\nexport const StatusReconcileQueueRegisteredMemberClaimEntrySchema = z\n .object({\n ...statusReconcileQueueEntryBase,\n authEffect: z.literal('registeredMemberClaim' satisfies StatusReconcileQueueAuthEffect),\n })\n .strict();\nexport type StatusReconcileQueueRegisteredMemberClaimEntry = z.infer<\n typeof StatusReconcileQueueRegisteredMemberClaimEntrySchema\n>;\n\nexport const StatusReconcileQueueEntrySchema = z.discriminatedUnion('authEffect', [\n StatusReconcileQueueAccountStatusEntrySchema,\n StatusReconcileQueuePublicDocumentsAcceptedClaimEntrySchema,\n StatusReconcileQueueAdminClaimsEntrySchema,\n StatusReconcileQueueRegisteredMemberClaimEntrySchema,\n]);\nexport type StatusReconcileQueueEntry = z.infer<typeof StatusReconcileQueueEntrySchema>;\n\n// feedbackAliases/{aliasId} — Console-managed map collapsing a synonym suggestion onto a canonical\n// one; read by submitFeedback, no callable writes it. (firestore.rules §3F / submitFeedback.ts)\nexport const FeedbackAliasSchema = z.object({\n canonicalId: z.string(),\n originalType: z.string(),\n});\nexport type FeedbackAlias = z.infer<typeof FeedbackAliasSchema>;\n\n// feedbackSubmissions/{feedbackType}/userSuggestions/{suggestionId} — an aggregated user\n// suggestion with its deduped submitter list + count. The path nests the feedbackSubmissions +\n// userSuggestions registry segments. (functions/src/utility/submitFeedback.ts)\nexport const UserSuggestionSchema = z.object({\n suggestionText: z.string(),\n count: z.number(),\n submittedBy: z.array(z.object({ userId: z.string() })),\n lastSubmitted: z.number(),\n});\nexport type UserSuggestion = z.infer<typeof UserSuggestionSchema>;\n"]}
|
|
@@ -5046,17 +5046,18 @@ export declare const COLLECTION_SCHEMAS: {
|
|
|
5046
5046
|
lastSubmitted: z.ZodNumber;
|
|
5047
5047
|
}, z.core.$strip>;
|
|
5048
5048
|
readonly 'statusReconcileQueue/{uid}': z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5049
|
+
reason: z.ZodLiteral<"statusChangePending">;
|
|
5049
5050
|
authEffect: z.ZodOptional<z.ZodLiteral<"accountStatus">>;
|
|
5050
5051
|
targetStatus: z.ZodEnum<{
|
|
5051
5052
|
banned: "banned";
|
|
5052
5053
|
active: "active";
|
|
5053
5054
|
suspended: "suspended";
|
|
5054
5055
|
}>;
|
|
5056
|
+
writeId: z.ZodString;
|
|
5055
5057
|
uid: z.ZodString;
|
|
5056
5058
|
enqueuedAt: z.ZodNumber;
|
|
5057
5059
|
lastAttemptAt: z.ZodOptional<z.ZodNumber>;
|
|
5058
5060
|
attemptCount: z.ZodNumber;
|
|
5059
|
-
reason: z.ZodLiteral<"postCommitAuthEffectFailed">;
|
|
5060
5061
|
}, z.core.$strip>, z.ZodObject<{
|
|
5061
5062
|
authEffect: z.ZodLiteral<"publicDocumentsAcceptedClaim">;
|
|
5062
5063
|
uid: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/doc-schemas/registry.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqN7B,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/doc-schemas/registry.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqN7B,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuQkB,CAAC;AAElD,MAAM,MAAM,wBAAwB,GAAG,MAAM,OAAO,kBAAkB,CAAC;AAEvE;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;CAmBiC,CAAC;AAEvE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAOvC,CAAC"}
|
|
@@ -6,9 +6,22 @@ export declare const PLEDGE_PAYMENT_SUMMED_AMOUNT_FIELDS: readonly ["amount", "n
|
|
|
6
6
|
export type PledgePaymentAmountSums = Pick<PledgePayment, (typeof PLEDGE_PAYMENT_SUMMED_AMOUNT_FIELDS)[number]>;
|
|
7
7
|
/**
|
|
8
8
|
* The counters from the summed pledge amounts. `totalRefunded` is money that left the platform:
|
|
9
|
-
* refunds plus funds withdrawn by a lost dispute.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* refunds plus funds withdrawn by a lost dispute. `pledgeCount` is the number of those pledges that
|
|
10
|
+
* still count (`isPledgePaymentCounted`) — a sum cannot say how many pledges kept money, so the
|
|
11
|
+
* caller counts them. The money formula is linear, so it gives the whole ledger's totals from the
|
|
12
|
+
* ledger's sums; one pledge's share is `pledgePaymentContributionOf`.
|
|
12
13
|
*/
|
|
13
14
|
export declare function pledgePaymentTotalsOf(sums: PledgePaymentAmountSums, pledgeCount: number): PledgePaymentTotals;
|
|
15
|
+
/**
|
|
16
|
+
* A pledge counts — in the pledge count and toward the Supporter badge — while it still holds money:
|
|
17
|
+
* a full refund or a lost dispute that leaves its net at 0 stops it counting, and a refund that
|
|
18
|
+
* fails restores it.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isPledgePaymentCounted(pledge: Pick<PledgePayment, 'netAmount'>): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* One pledge's contribution to the totals: its amounts, and 1 toward `pledgeCount` while it counts.
|
|
23
|
+
* The webhook's increment for an event is the pledge's contribution after it minus its contribution
|
|
24
|
+
* before, so a refund that ends the pledge's money also takes it out of the count.
|
|
25
|
+
*/
|
|
26
|
+
export declare function pledgePaymentContributionOf(pledge: PledgePaymentAmountSums): PledgePaymentTotals;
|
|
14
27
|
//# sourceMappingURL=pledge-totals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pledge-totals.d.ts","sourceRoot":"","sources":["../../src/utils/pledge-totals.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,iFAAiF;AACjF,eAAO,MAAM,mCAAmC,yEAKK,CAAC;AAEtD,4EAA4E;AAC5E,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC,OAAO,mCAAmC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAEhH
|
|
1
|
+
{"version":3,"file":"pledge-totals.d.ts","sourceRoot":"","sources":["../../src/utils/pledge-totals.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,iFAAiF;AACjF,eAAO,MAAM,mCAAmC,yEAKK,CAAC;AAEtD,4EAA4E;AAC5E,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC,OAAO,mCAAmC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAEhH;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,GAAG,mBAAmB,CAO7G;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,GAAG,OAAO,CAExF;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,uBAAuB,GAAG,mBAAmB,CAEhG"}
|
|
@@ -10,9 +10,10 @@ export const PLEDGE_PAYMENT_SUMMED_AMOUNT_FIELDS = [
|
|
|
10
10
|
];
|
|
11
11
|
/**
|
|
12
12
|
* The counters from the summed pledge amounts. `totalRefunded` is money that left the platform:
|
|
13
|
-
* refunds plus funds withdrawn by a lost dispute.
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* refunds plus funds withdrawn by a lost dispute. `pledgeCount` is the number of those pledges that
|
|
14
|
+
* still count (`isPledgePaymentCounted`) — a sum cannot say how many pledges kept money, so the
|
|
15
|
+
* caller counts them. The money formula is linear, so it gives the whole ledger's totals from the
|
|
16
|
+
* ledger's sums; one pledge's share is `pledgePaymentContributionOf`.
|
|
16
17
|
*/
|
|
17
18
|
export function pledgePaymentTotalsOf(sums, pledgeCount) {
|
|
18
19
|
return {
|
|
@@ -22,4 +23,20 @@ export function pledgePaymentTotalsOf(sums, pledgeCount) {
|
|
|
22
23
|
pledgeCount,
|
|
23
24
|
};
|
|
24
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* A pledge counts — in the pledge count and toward the Supporter badge — while it still holds money:
|
|
28
|
+
* a full refund or a lost dispute that leaves its net at 0 stops it counting, and a refund that
|
|
29
|
+
* fails restores it.
|
|
30
|
+
*/
|
|
31
|
+
export function isPledgePaymentCounted(pledge) {
|
|
32
|
+
return pledge.netAmount > 0;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* One pledge's contribution to the totals: its amounts, and 1 toward `pledgeCount` while it counts.
|
|
36
|
+
* The webhook's increment for an event is the pledge's contribution after it minus its contribution
|
|
37
|
+
* before, so a refund that ends the pledge's money also takes it out of the count.
|
|
38
|
+
*/
|
|
39
|
+
export function pledgePaymentContributionOf(pledge) {
|
|
40
|
+
return pledgePaymentTotalsOf(pledge, isPledgePaymentCounted(pledge) ? 1 : 0);
|
|
41
|
+
}
|
|
25
42
|
//# sourceMappingURL=pledge-totals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pledge-totals.js","sourceRoot":"","sources":["../../src/utils/pledge-totals.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,6FAA6F;AAC7F,oFAAoF;AAKpF,iFAAiF;AACjF,MAAM,CAAC,MAAM,mCAAmC,GAAG;IACjD,QAAQ;IACR,WAAW;IACX,gBAAgB;IAChB,mBAAmB;CACgC,CAAC;AAKtD
|
|
1
|
+
{"version":3,"file":"pledge-totals.js","sourceRoot":"","sources":["../../src/utils/pledge-totals.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,6FAA6F;AAC7F,oFAAoF;AAKpF,iFAAiF;AACjF,MAAM,CAAC,MAAM,mCAAmC,GAAG;IACjD,QAAQ;IACR,WAAW;IACX,gBAAgB;IAChB,mBAAmB;CACgC,CAAC;AAKtD;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAA6B,EAAE,WAAmB;IACtF,OAAO;QACL,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,WAAW,EAAE,IAAI,CAAC,MAAM;QACxB,aAAa,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,iBAAiB;QAC3D,WAAW;KACZ,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAwC;IAC7E,OAAO,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAA+B;IACzE,OAAO,qBAAqB,CAAC,MAAM,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/E,CAAC","sourcesContent":["// The ONE formula for the pledge-totals counters (`pledgePaymentTotals/summary` and the Ops\n// snapshot's `pledge`). The webhook's increments, the repair script's recompute, and the Ops\n// aggregate all derive from it, so the three can never count a counter differently.\n\nimport type { PledgePayment } from '../doc-schemas/payments.js';\nimport type { PledgePaymentTotals } from '../types/payments.js';\n\n/** The pledge fields the totals are built from — each summed over the ledger. */\nexport const PLEDGE_PAYMENT_SUMMED_AMOUNT_FIELDS = [\n 'amount',\n 'netAmount',\n 'refundedAmount',\n 'disputeLostAmount',\n] as const satisfies readonly (keyof PledgePayment)[];\n\n/** Those fields' values for one pledge, or their sums over many (cents). */\nexport type PledgePaymentAmountSums = Pick<PledgePayment, (typeof PLEDGE_PAYMENT_SUMMED_AMOUNT_FIELDS)[number]>;\n\n/**\n * The counters from the summed pledge amounts. `totalRefunded` is money that left the platform:\n * refunds plus funds withdrawn by a lost dispute. `pledgeCount` is the number of those pledges that\n * still count (`isPledgePaymentCounted`) — a sum cannot say how many pledges kept money, so the\n * caller counts them. The money formula is linear, so it gives the whole ledger's totals from the\n * ledger's sums; one pledge's share is `pledgePaymentContributionOf`.\n */\nexport function pledgePaymentTotalsOf(sums: PledgePaymentAmountSums, pledgeCount: number): PledgePaymentTotals {\n return {\n netRaised: sums.netAmount,\n grossRaised: sums.amount,\n totalRefunded: sums.refundedAmount + sums.disputeLostAmount,\n pledgeCount,\n };\n}\n\n/**\n * A pledge counts — in the pledge count and toward the Supporter badge — while it still holds money:\n * a full refund or a lost dispute that leaves its net at 0 stops it counting, and a refund that\n * fails restores it.\n */\nexport function isPledgePaymentCounted(pledge: Pick<PledgePayment, 'netAmount'>): boolean {\n return pledge.netAmount > 0;\n}\n\n/**\n * One pledge's contribution to the totals: its amounts, and 1 toward `pledgeCount` while it counts.\n * The webhook's increment for an event is the pledge's contribution after it minus its contribution\n * before, so a refund that ends the pledge's money also takes it out of the count.\n */\nexport function pledgePaymentContributionOf(pledge: PledgePaymentAmountSums): PledgePaymentTotals {\n return pledgePaymentTotalsOf(pledge, isPledgePaymentCounted(pledge) ? 1 : 0);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttt-productions/ttt-core",
|
|
3
|
-
"version": "0.79.
|
|
3
|
+
"version": "0.79.71",
|
|
4
4
|
"description": "Core types, Firestore path constants, and shared constants for TTT Productions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -117,8 +117,8 @@
|
|
|
117
117
|
"@ttt-productions/chat-schemas": "^0.10.5",
|
|
118
118
|
"@ttt-productions/edge-protocol-core": "^0.1.12",
|
|
119
119
|
"@ttt-productions/input-format-core": "^0.1.1",
|
|
120
|
-
"@ttt-productions/media-schemas": "^0.14.
|
|
121
|
-
"@ttt-productions/notification-core": "^0.15.
|
|
120
|
+
"@ttt-productions/media-schemas": "^0.14.9",
|
|
121
|
+
"@ttt-productions/notification-core": "^0.15.12",
|
|
122
122
|
"@ttt-productions/report-core": "^0.16.14",
|
|
123
123
|
"zod": "^4.4.3"
|
|
124
124
|
},
|