founder-schema 0.35.0 → 0.37.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/dist/access/permissions.d.ts +5 -1
- package/dist/access/permissions.d.ts.map +1 -1
- package/dist/access/permissions.js +2 -0
- package/dist/access/permissions.js.map +1 -1
- package/dist/access/standing.d.ts +1 -1
- package/dist/access/standing.js +1 -1
- package/dist/access/standing.js.map +1 -1
- package/dist/domains/audit/audit.d.ts +6 -1
- package/dist/domains/audit/audit.d.ts.map +1 -1
- package/dist/domains/audit/audit.js +8 -0
- package/dist/domains/audit/audit.js.map +1 -1
- package/dist/domains/billing/billing.d.ts +35 -2
- package/dist/domains/billing/billing.d.ts.map +1 -1
- package/dist/domains/billing/billing.js +5 -3
- package/dist/domains/billing/billing.js.map +1 -1
- package/dist/domains/members/signups.d.ts +113 -0
- package/dist/domains/members/signups.d.ts.map +1 -0
- package/dist/domains/members/signups.js +69 -0
- package/dist/domains/members/signups.js.map +1 -0
- package/dist/domains/membership/membership.d.ts +74 -16
- package/dist/domains/membership/membership.d.ts.map +1 -1
- package/dist/domains/membership/membership.js +136 -34
- package/dist/domains/membership/membership.js.map +1 -1
- package/dist/domains/onboarding/onboarding.d.ts +142 -93
- package/dist/domains/onboarding/onboarding.d.ts.map +1 -1
- package/dist/domains/onboarding/onboarding.js +107 -20
- package/dist/domains/onboarding/onboarding.js.map +1 -1
- package/dist/domains/profile/founder-profile.d.ts +3 -3
- package/dist/domains/profile/founder-profile.js +3 -3
- package/dist/domains/profile/founder-profile.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -76,8 +76,9 @@ export type Action = (typeof ACTION_VALUES)[number];
|
|
|
76
76
|
* Coupon a code that gives a membership or a discount (0.12.0)
|
|
77
77
|
* ProductInsights a product's views, visitors and trends, for its team (0.32.0)
|
|
78
78
|
* ProfileViewers who viewed a member's profile, for that member (0.32.0)
|
|
79
|
+
* Signup someone's unfinished sign-up, for staff to reach them (2026-12-06)
|
|
79
80
|
*/
|
|
80
|
-
export declare const SUBJECT_VALUES: readonly ["all", "Dashboard", "Member", "FounderProfile", "Post", "Poll", "Comment", "Report", "SupportTicket", "SavedReply", "PlatformRole", "AuditEntry", "PlatformSettings", "Product", "Review", "Community", "CommunitySuggestion", "Membership", "Payment", "Coupon", "ProductInsights", "ProfileViewers"];
|
|
81
|
+
export declare const SUBJECT_VALUES: readonly ["all", "Dashboard", "Member", "FounderProfile", "Post", "Poll", "Comment", "Report", "SupportTicket", "SavedReply", "PlatformRole", "AuditEntry", "PlatformSettings", "Product", "Review", "Community", "CommunitySuggestion", "Membership", "Payment", "Coupon", "ProductInsights", "ProfileViewers", "Signup"];
|
|
81
82
|
export declare const subjectSchema: z.ZodEnum<{
|
|
82
83
|
all: "all";
|
|
83
84
|
Dashboard: "Dashboard";
|
|
@@ -101,6 +102,7 @@ export declare const subjectSchema: z.ZodEnum<{
|
|
|
101
102
|
Coupon: "Coupon";
|
|
102
103
|
ProductInsights: "ProductInsights";
|
|
103
104
|
ProfileViewers: "ProfileViewers";
|
|
105
|
+
Signup: "Signup";
|
|
104
106
|
}>;
|
|
105
107
|
export type Subject = z.infer<typeof subjectSchema>;
|
|
106
108
|
/**
|
|
@@ -226,6 +228,8 @@ export interface SubjectFields {
|
|
|
226
228
|
ProfileViewers: {
|
|
227
229
|
userId: string;
|
|
228
230
|
};
|
|
231
|
+
/** Every platform role reads them all, a member none: no condition is ever written on one. */
|
|
232
|
+
Signup: Record<never, never>;
|
|
229
233
|
}
|
|
230
234
|
/** A document tagged with its subject type, as CASL's `subject('Post', doc)` makes one. */
|
|
231
235
|
export type SubjectInstance = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/access/permissions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;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's views, visitors and trends, for its team (0.32.0)
|
|
91
91
|
* ProfileViewers who viewed a member's profile, for that member (0.32.0)
|
|
92
|
+
* Signup someone's unfinished sign-up, for staff to reach them (2026-12-06)
|
|
92
93
|
*/
|
|
93
94
|
export const SUBJECT_VALUES = [
|
|
94
95
|
'all',
|
|
@@ -113,6 +114,7 @@ export const SUBJECT_VALUES = [
|
|
|
113
114
|
'Coupon',
|
|
114
115
|
'ProductInsights',
|
|
115
116
|
'ProfileViewers',
|
|
117
|
+
'Signup',
|
|
116
118
|
];
|
|
117
119
|
export const subjectSchema = z.enum(SUBJECT_VALUES);
|
|
118
120
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../src/access/permissions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,SAAS;IACT,SAAS;IACT,OAAO;IACP,WAAW;IACX,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,SAAS;CACD,CAAC;AAGX;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,KAAK;IACL,WAAW;IACX,QAAQ;IACR,gBAAgB;IAChB,MAAM;IACN,MAAM;IACN,SAAS;IACT,QAAQ;IACR,eAAe;IACf,YAAY;IACZ,cAAc;IACd,YAAY;IACZ,kBAAkB;IAClB,SAAS;IACT,QAAQ;IACR,WAAW;IACX,qBAAqB;IACrB,YAAY;IACZ,SAAS;IACT,QAAQ;IACR,iBAAiB;IACjB,gBAAgB;CACR,CAAC;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AC,CAAC;QACjB,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACjB,CAAC,CAAC,OAAO,EAAE;QACX,SAAS;QACT,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC,MAAM,EAAE;KACX,CAAC;CACH,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AAM3D,MAAM,UAAU,GAAwB,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;AAC/D,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC,cAAc,CAAC,CAAC;AACjE,MAAM,OAAO,GAAG,CAAC,KAAoC,EAAE,KAA0B,EAAE,EAAE,CACnF,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7F;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,IAG5B;IACC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AAChF,CAAC","sourcesContent":["/**\n * founder-schema: what a role may do, in CASL's terms\n *\n * Permissions are ACTION on SUBJECT, optionally narrowed by conditions on the\n * subject's fields (\"update a Post whose authorId is mine\"). The backend writes\n * one small policy per role from these words; the web receives the resulting\n * rules and asks the same questions to decide what to draw. Because both sides\n * spell actions and subjects from this file, a permission check with a typo is\n * a compile error, not a button that silently never shows.\n *\n * The SERVER decides; the web only mirrors. Every rule the web holds came from\n * the server for the role being acted as, and every request is checked again\n * on the server, so a tampered client can show itself a button and nothing\n * more.\n *\n * @module founder-schema/access/permissions\n */\n\nimport type { ForcedSubject, MongoAbility, RawRuleOf } from '@casl/ability';\nimport { z } from 'zod';\nimport type { OrderStatus, PurchaseKind } from '../domains/billing/billing.js';\nimport type { CommunitySuggestionStatus } from '../domains/communities/communities.js';\nimport type { ReportStatus } from '../domains/feed/feed.js';\nimport type { PlatformRole } from './roles.js';\nimport type { Standing } from './standing.js';\n\n/**\n * The verbs.\n *\n * manage every action (CASL's wildcard). Only superadmin holds it on `all`.\n * create, read, update, delete\n * moderate hide, restore or remove someone else's content, act on a report\n * assign grant or revoke (a platform role); take or hand over (a ticket)\n * suspend stop a member signing in to the product, and lift it\n * resolve close a support ticket or a report\n * reset clear a credential its owner forgot (a staff member's MPIN)\n * represent act for a product as one of its team: tag a post with it, reply\n * to its reviews, mark feedback helpful, confirm a tester\n *\n * Taking part (0.12.0, membership): the verbs a viewer is refused and a member\n * holds. Creating content stays `create`; these are the rest.\n *\n * react a reaction on a post, poll or comment; an upvote on a product;\n * marking a review helpful\n * vote vote in a poll\n * save bookmark a post or poll\n * join join a community, ask to, or accept its invitation; accept an\n * invitation to a product's team\n * message start a conversation with a Member\n * refund give a payment's money back (staff)\n * follow follow a Member: see their posts, hear when they post (2026-11-20)\n * feature put a Product in Discover's \"Featured\" row (0.32.0, a paid plan's)\n *\n * Append only: a stored or packed rule names these.\n */\nexport const ACTION_VALUES = [\n 'manage',\n 'create',\n 'read',\n 'update',\n 'delete',\n 'moderate',\n 'assign',\n 'suspend',\n 'resolve',\n 'reset',\n 'represent',\n 'react',\n 'vote',\n 'save',\n 'join',\n 'message',\n 'refund',\n 'follow',\n 'feature',\n] as const;\nexport type Action = (typeof ACTION_VALUES)[number];\n\n/**\n * The things.\n *\n * all CASL's wildcard subject\n * Dashboard the staff overview: counts and trends\n * Member a person's account in this product\n * FounderProfile a member's public profile\n * Post, Poll, Comment\n * Report a member's report of a post, poll or comment\n * SupportTicket a member's request for help\n * SavedReply a support agent's reusable answer\n * PlatformRole a staff role, as something granted and revoked\n * AuditEntry the record of a staff action\n * PlatformSettings product-wide configuration\n * Product something a founder builds, with its team\n * Review a member's stars and words on a product\n * Community an official community (0.9.0)\n * CommunitySuggestion a member's suggestion for a new community (0.9.0)\n * Membership a person's platform membership: granted, revoked (0.12.0)\n * Payment a purchase and its invoice, and its refund (0.12.0)\n * Coupon a code that gives a membership or a discount (0.12.0)\n * ProductInsights a product's views, visitors and trends, for its team (0.32.0)\n * ProfileViewers who viewed a member's profile, for that member (0.32.0)\n */\nexport const SUBJECT_VALUES = [\n 'all',\n 'Dashboard',\n 'Member',\n 'FounderProfile',\n 'Post',\n 'Poll',\n 'Comment',\n 'Report',\n 'SupportTicket',\n 'SavedReply',\n 'PlatformRole',\n 'AuditEntry',\n 'PlatformSettings',\n 'Product',\n 'Review',\n 'Community',\n 'CommunitySuggestion',\n 'Membership',\n 'Payment',\n 'Coupon',\n 'ProductInsights',\n 'ProfileViewers',\n] as const;\nexport const subjectSchema = z.enum(SUBJECT_VALUES);\nexport type Subject = z.infer<typeof subjectSchema>;\n\n/**\n * The fields a rule may set CONDITIONS on, per subject: the server's stored\n * names, ids as strings. Declared here so a condition on a field the subject\n * does not have (`{ ownerId: me }` on a Post) is a compile error, on both sides.\n *\n * A web screen does not evaluate these against an API response: a response\n * names things differently (`author.userId`, not `authorId`). Row-level answers\n * come from the server on the item itself (`viewer.canEdit`); the web's own\n * checks are type-level (\"may I moderate Reports at all\").\n */\nexport interface SubjectFields {\n Dashboard: Record<never, never>;\n /**\n * `roles` is the staff roles held (0.20.0: from their access grant; `appRoles`\n * until 0.19.0), so a rule can protect a role (\"never suspend a superadmin\").\n *\n * For `message` (0.12.0), what the asker's relation to them is:\n * `contact` says the asker knows them (a teammate, a private community in\n * common, a conversation already); `standing` is theirs, so nobody starts a\n * conversation with a viewer, who cannot chat; `acceptsStrangers` is their\n * own setting (Premium and Business members may start one, or only people\n * they know). Optional because only the messaging check computes them: a\n * rule on a field that is absent never matches, so a check that forgets them\n * is refused, never let through.\n */\n Member: {\n _id: string;\n roles: PlatformRole[];\n contact?: boolean;\n standing?: Standing;\n acceptsStrangers?: boolean;\n };\n FounderProfile: { userId: string };\n Post: { authorId: string };\n Poll: { authorId: string };\n Comment: { authorId: string };\n Report: { reporterId: string; status: ReportStatus };\n SupportTicket: { memberId: string; assigneeId: string | null };\n SavedReply: { authorId: string };\n /** One role on one person: `memberId` is whose, so \"never your own\" is a rule too. */\n PlatformRole: { role: PlatformRole; memberId: string };\n /** `actorId` is null for an entry a server script wrote. */\n AuditEntry: { actorId: string | null };\n PlatformSettings: Record<never, never>;\n /**\n * The team, as three lists of member ids, so a rule reads \"a product whose\n * managers include me\" (`{ managerIds: me }`). `managerIds` is the owner and\n * the co-founders; `memberIds` is everyone on the team, owner included.\n */\n Product: { ownerId: string; managerIds: string[]; memberIds: string[] };\n Review: { authorId: string };\n /**\n * Its admins and moderators as id lists (0.9.0), so a rule reads \"a\n * community whose admins include me\" (`{ adminIds: me }`). Both short by\n * nature; ordinary members are never listed here (a community has no cap).\n */\n Community: { _id: string; adminIds: string[]; moderatorIds: string[] };\n /** `suggestedBy` so \"your own\" is a rule; `status` so only open ones are decided. */\n CommunitySuggestion: { suggestedBy: string; status: CommunitySuggestionStatus };\n /** Whose membership (0.12.0), so \"never your own\" is a rule. */\n Membership: { userId: string };\n /**\n * Who pays (0.12.0), what for, and where it stands: a viewer may buy only a\n * membership (a plan needs one), only a paid one is refunded, and never by\n * its own payer.\n */\n Payment: { userId: string; status: OrderStatus; kind: PurchaseKind };\n /** Coupons are the platform's (0.12.0): no condition is ever written on one. */\n Coupon: Record<never, never>;\n /**\n * A product's insights (0.32.0), by its team as the Product's lists say, so a\n * rule reads \"a product whose team includes me\" (`{ memberIds: me }`). How\n * MUCH they see (days, sources) is the owner's plan, counted by the service.\n */\n ProductInsights: { productId: string; managerIds: string[]; memberIds: string[] };\n /** Whose profile's viewers (0.32.0): only their own (`{ userId: me }`). */\n ProfileViewers: { userId: string };\n}\n\n/** A document tagged with its subject type, as CASL's `subject('Post', doc)` makes one. */\nexport type SubjectInstance = {\n [K in keyof SubjectFields]: SubjectFields[K] & ForcedSubject<K>;\n}[keyof SubjectFields];\n\n/**\n * The ability both sides build: the backend from its policy, the web from the\n * rules the backend sends. Mongo-style conditions, typed by `SubjectFields`.\n */\nexport type AppAbility = MongoAbility<[Action, Subject | SubjectInstance]>;\n\n/**\n * Compile-time proof that `SubjectFields` names exactly the subjects, no more\n * and no fewer: adding a subject without its fields fails the build here.\n */\ntype Same<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;\ntype Assert<T extends true> = T;\nexport type EverySubjectHasFields = Assert<Same<keyof SubjectFields, Exclude<Subject, 'all'>>>;\n\n/**\n * Rules as they cross the wire: CASL's `packRules` output, an array of\n * compact arrays. The web unpacks them with `unpackRules` before building its\n * ability. Each starts with its action(s) and subject(s), comma-joined\n * strings (checked, 0.18.0: an unchecked rule list could silently turn staff\n * routing off); what follows (conditions, inverted, fields, reason) is CASL's\n * own compact form.\n */\nconst zeroOrOne = z.union([z.literal(0), z.literal(1)]);\n/**\n * One packed rule, in exactly the shapes CASL's `PackRule` takes (a union of\n * tuples, not a rest: `unpackRules` needs one of these), with `conditions` as\n * `unknown`, which `isAppRawRule` and the ability itself then judge.\n */\nexport const packedRuleSchema = z.union([\n z.tuple([z.string().min(1), z.string().min(1)]),\n z.tuple([z.string().min(1), z.string().min(1), z.unknown()]),\n z.tuple([z.string().min(1), z.string().min(1), z.unknown(), z.literal(1)]),\n z.tuple([z.string().min(1), z.string().min(1), z.unknown(), zeroOrOne, z.string()]),\n z.tuple([\n z.string().min(1),\n z.string().min(1),\n z.unknown(),\n zeroOrOne,\n z.union([z.string(), z.literal(0)]),\n z.string(),\n ]),\n]);\nexport const packedRulesSchema = z.array(packedRuleSchema);\nexport type PackedRules = z.infer<typeof packedRulesSchema>;\n\n/** One rule as CASL's `unpackRules` gives it back, typed for this app. */\nexport type AppRawRule = RawRuleOf<AppAbility>;\n\nconst ACTION_SET: ReadonlySet<string> = new Set(ACTION_VALUES);\nconst SUBJECT_SET: ReadonlySet<string> = new Set(SUBJECT_VALUES);\nconst everyIn = (value: string | string[] | undefined, known: ReadonlySet<string>) =>\n value !== undefined && (Array.isArray(value) ? value : [value]).every((v) => known.has(v));\n\n/**\n * Whether an UNPACKED rule names only this app's actions and subjects\n * (0.18.0). Packed rules cross the wire as strings (`packRules` joins several\n * actions or subjects with commas, so the wire shape cannot be an enum); this\n * is the check that turns them back into `AppRawRule`s, with no cast:\n * `rules.every(isAppRawRule)` narrows the list, and a list that fails is a\n * contract mismatch, never an ability built from it.\n */\nexport function isAppRawRule(rule: {\n action: string | string[];\n subject?: string | string[];\n}): rule is AppRawRule {\n return everyIn(rule.action, ACTION_SET) && everyIn(rule.subject, SUBJECT_SET);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../src/access/permissions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,SAAS;IACT,SAAS;IACT,OAAO;IACP,WAAW;IACX,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,SAAS;CACD,CAAC;AAGX;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,KAAK;IACL,WAAW;IACX,QAAQ;IACR,gBAAgB;IAChB,MAAM;IACN,MAAM;IACN,SAAS;IACT,QAAQ;IACR,eAAe;IACf,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AC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IACnF,CAAC,CAAC,KAAK,CAAC;QACN,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACjB,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACjB,CAAC,CAAC,OAAO,EAAE;QACX,SAAS;QACT,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC,MAAM,EAAE;KACX,CAAC;CACH,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AAM3D,MAAM,UAAU,GAAwB,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;AAC/D,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC,cAAc,CAAC,CAAC;AACjE,MAAM,OAAO,GAAG,CAAC,KAAoC,EAAE,KAA0B,EAAE,EAAE,CACnF,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7F;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,IAG5B;IACC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AAChF,CAAC","sourcesContent":["/**\n * founder-schema: what a role may do, in CASL's terms\n *\n * Permissions are ACTION on SUBJECT, optionally narrowed by conditions on the\n * subject's fields (\"update a Post whose authorId is mine\"). The backend writes\n * one small policy per role from these words; the web receives the resulting\n * rules and asks the same questions to decide what to draw. Because both sides\n * spell actions and subjects from this file, a permission check with a typo is\n * a compile error, not a button that silently never shows.\n *\n * The SERVER decides; the web only mirrors. Every rule the web holds came from\n * the server for the role being acted as, and every request is checked again\n * on the server, so a tampered client can show itself a button and nothing\n * more.\n *\n * @module founder-schema/access/permissions\n */\n\nimport type { ForcedSubject, MongoAbility, RawRuleOf } from '@casl/ability';\nimport { z } from 'zod';\nimport type { OrderStatus, PurchaseKind } from '../domains/billing/billing.js';\nimport type { CommunitySuggestionStatus } from '../domains/communities/communities.js';\nimport type { ReportStatus } from '../domains/feed/feed.js';\nimport type { PlatformRole } from './roles.js';\nimport type { Standing } from './standing.js';\n\n/**\n * The verbs.\n *\n * manage every action (CASL's wildcard). Only superadmin holds it on `all`.\n * create, read, update, delete\n * moderate hide, restore or remove someone else's content, act on a report\n * assign grant or revoke (a platform role); take or hand over (a ticket)\n * suspend stop a member signing in to the product, and lift it\n * resolve close a support ticket or a report\n * reset clear a credential its owner forgot (a staff member's MPIN)\n * represent act for a product as one of its team: tag a post with it, reply\n * to its reviews, mark feedback helpful, confirm a tester\n *\n * Taking part (0.12.0, membership): the verbs a viewer is refused and a member\n * holds. Creating content stays `create`; these are the rest.\n *\n * react a reaction on a post, poll or comment; an upvote on a product;\n * marking a review helpful\n * vote vote in a poll\n * save bookmark a post or poll\n * join join a community, ask to, or accept its invitation; accept an\n * invitation to a product's team\n * message start a conversation with a Member\n * refund give a payment's money back (staff)\n * follow follow a Member: see their posts, hear when they post (2026-11-20)\n * feature put a Product in Discover's \"Featured\" row (0.32.0, a paid plan's)\n *\n * Append only: a stored or packed rule names these.\n */\nexport const ACTION_VALUES = [\n 'manage',\n 'create',\n 'read',\n 'update',\n 'delete',\n 'moderate',\n 'assign',\n 'suspend',\n 'resolve',\n 'reset',\n 'represent',\n 'react',\n 'vote',\n 'save',\n 'join',\n 'message',\n 'refund',\n 'follow',\n 'feature',\n] as const;\nexport type Action = (typeof ACTION_VALUES)[number];\n\n/**\n * The things.\n *\n * all CASL's wildcard subject\n * Dashboard the staff overview: counts and trends\n * Member a person's account in this product\n * FounderProfile a member's public profile\n * Post, Poll, Comment\n * Report a member's report of a post, poll or comment\n * SupportTicket a member's request for help\n * SavedReply a support agent's reusable answer\n * PlatformRole a staff role, as something granted and revoked\n * AuditEntry the record of a staff action\n * PlatformSettings product-wide configuration\n * Product something a founder builds, with its team\n * Review a member's stars and words on a product\n * Community an official community (0.9.0)\n * CommunitySuggestion a member's suggestion for a new community (0.9.0)\n * Membership a person's platform membership: granted, revoked (0.12.0)\n * Payment a purchase and its invoice, and its refund (0.12.0)\n * Coupon a code that gives a membership or a discount (0.12.0)\n * ProductInsights a product's views, visitors and trends, for its team (0.32.0)\n * ProfileViewers who viewed a member's profile, for that member (0.32.0)\n * Signup someone's unfinished sign-up, for staff to reach them (2026-12-06)\n */\nexport const SUBJECT_VALUES = [\n 'all',\n 'Dashboard',\n 'Member',\n 'FounderProfile',\n 'Post',\n 'Poll',\n 'Comment',\n 'Report',\n 'SupportTicket',\n 'SavedReply',\n 'PlatformRole',\n 'AuditEntry',\n 'PlatformSettings',\n 'Product',\n 'Review',\n 'Community',\n 'CommunitySuggestion',\n 'Membership',\n 'Payment',\n 'Coupon',\n 'ProductInsights',\n 'ProfileViewers',\n 'Signup',\n] as const;\nexport const subjectSchema = z.enum(SUBJECT_VALUES);\nexport type Subject = z.infer<typeof subjectSchema>;\n\n/**\n * The fields a rule may set CONDITIONS on, per subject: the server's stored\n * names, ids as strings. Declared here so a condition on a field the subject\n * does not have (`{ ownerId: me }` on a Post) is a compile error, on both sides.\n *\n * A web screen does not evaluate these against an API response: a response\n * names things differently (`author.userId`, not `authorId`). Row-level answers\n * come from the server on the item itself (`viewer.canEdit`); the web's own\n * checks are type-level (\"may I moderate Reports at all\").\n */\nexport interface SubjectFields {\n Dashboard: Record<never, never>;\n /**\n * `roles` is the staff roles held (0.20.0: from their access grant; `appRoles`\n * until 0.19.0), so a rule can protect a role (\"never suspend a superadmin\").\n *\n * For `message` (0.12.0), what the asker's relation to them is:\n * `contact` says the asker knows them (a teammate, a private community in\n * common, a conversation already); `standing` is theirs, so nobody starts a\n * conversation with a viewer, who cannot chat; `acceptsStrangers` is their\n * own setting (Premium and Business members may start one, or only people\n * they know). Optional because only the messaging check computes them: a\n * rule on a field that is absent never matches, so a check that forgets them\n * is refused, never let through.\n */\n Member: {\n _id: string;\n roles: PlatformRole[];\n contact?: boolean;\n standing?: Standing;\n acceptsStrangers?: boolean;\n };\n FounderProfile: { userId: string };\n Post: { authorId: string };\n Poll: { authorId: string };\n Comment: { authorId: string };\n Report: { reporterId: string; status: ReportStatus };\n SupportTicket: { memberId: string; assigneeId: string | null };\n SavedReply: { authorId: string };\n /** One role on one person: `memberId` is whose, so \"never your own\" is a rule too. */\n PlatformRole: { role: PlatformRole; memberId: string };\n /** `actorId` is null for an entry a server script wrote. */\n AuditEntry: { actorId: string | null };\n PlatformSettings: Record<never, never>;\n /**\n * The team, as three lists of member ids, so a rule reads \"a product whose\n * managers include me\" (`{ managerIds: me }`). `managerIds` is the owner and\n * the co-founders; `memberIds` is everyone on the team, owner included.\n */\n Product: { ownerId: string; managerIds: string[]; memberIds: string[] };\n Review: { authorId: string };\n /**\n * Its admins and moderators as id lists (0.9.0), so a rule reads \"a\n * community whose admins include me\" (`{ adminIds: me }`). Both short by\n * nature; ordinary members are never listed here (a community has no cap).\n */\n Community: { _id: string; adminIds: string[]; moderatorIds: string[] };\n /** `suggestedBy` so \"your own\" is a rule; `status` so only open ones are decided. */\n CommunitySuggestion: { suggestedBy: string; status: CommunitySuggestionStatus };\n /** Whose membership (0.12.0), so \"never your own\" is a rule. */\n Membership: { userId: string };\n /**\n * Who pays (0.12.0), what for, and where it stands: a viewer may buy only a\n * membership (a plan needs one), only a paid one is refunded, and never by\n * its own payer.\n */\n Payment: { userId: string; status: OrderStatus; kind: PurchaseKind };\n /** Coupons are the platform's (0.12.0): no condition is ever written on one. */\n Coupon: Record<never, never>;\n /**\n * A product's insights (0.32.0), by its team as the Product's lists say, so a\n * rule reads \"a product whose team includes me\" (`{ memberIds: me }`). How\n * MUCH they see (days, sources) is the owner's plan, counted by the service.\n */\n ProductInsights: { productId: string; managerIds: string[]; memberIds: string[] };\n /** Whose profile's viewers (0.32.0): only their own (`{ userId: me }`). */\n ProfileViewers: { userId: string };\n /** Every platform role reads them all, a member none: no condition is ever written on one. */\n Signup: Record<never, never>;\n}\n\n/** A document tagged with its subject type, as CASL's `subject('Post', doc)` makes one. */\nexport type SubjectInstance = {\n [K in keyof SubjectFields]: SubjectFields[K] & ForcedSubject<K>;\n}[keyof SubjectFields];\n\n/**\n * The ability both sides build: the backend from its policy, the web from the\n * rules the backend sends. Mongo-style conditions, typed by `SubjectFields`.\n */\nexport type AppAbility = MongoAbility<[Action, Subject | SubjectInstance]>;\n\n/**\n * Compile-time proof that `SubjectFields` names exactly the subjects, no more\n * and no fewer: adding a subject without its fields fails the build here.\n */\ntype Same<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;\ntype Assert<T extends true> = T;\nexport type EverySubjectHasFields = Assert<Same<keyof SubjectFields, Exclude<Subject, 'all'>>>;\n\n/**\n * Rules as they cross the wire: CASL's `packRules` output, an array of\n * compact arrays. The web unpacks them with `unpackRules` before building its\n * ability. Each starts with its action(s) and subject(s), comma-joined\n * strings (checked, 0.18.0: an unchecked rule list could silently turn staff\n * routing off); what follows (conditions, inverted, fields, reason) is CASL's\n * own compact form.\n */\nconst zeroOrOne = z.union([z.literal(0), z.literal(1)]);\n/**\n * One packed rule, in exactly the shapes CASL's `PackRule` takes (a union of\n * tuples, not a rest: `unpackRules` needs one of these), with `conditions` as\n * `unknown`, which `isAppRawRule` and the ability itself then judge.\n */\nexport const packedRuleSchema = z.union([\n z.tuple([z.string().min(1), z.string().min(1)]),\n z.tuple([z.string().min(1), z.string().min(1), z.unknown()]),\n z.tuple([z.string().min(1), z.string().min(1), z.unknown(), z.literal(1)]),\n z.tuple([z.string().min(1), z.string().min(1), z.unknown(), zeroOrOne, z.string()]),\n z.tuple([\n z.string().min(1),\n z.string().min(1),\n z.unknown(),\n zeroOrOne,\n z.union([z.string(), z.literal(0)]),\n z.string(),\n ]),\n]);\nexport const packedRulesSchema = z.array(packedRuleSchema);\nexport type PackedRules = z.infer<typeof packedRulesSchema>;\n\n/** One rule as CASL's `unpackRules` gives it back, typed for this app. */\nexport type AppRawRule = RawRuleOf<AppAbility>;\n\nconst ACTION_SET: ReadonlySet<string> = new Set(ACTION_VALUES);\nconst SUBJECT_SET: ReadonlySet<string> = new Set(SUBJECT_VALUES);\nconst everyIn = (value: string | string[] | undefined, known: ReadonlySet<string>) =>\n value !== undefined && (Array.isArray(value) ? value : [value]).every((v) => known.has(v));\n\n/**\n * Whether an UNPACKED rule names only this app's actions and subjects\n * (0.18.0). Packed rules cross the wire as strings (`packRules` joins several\n * actions or subjects with commas, so the wire shape cannot be an enum); this\n * is the check that turns them back into `AppRawRule`s, with no cast:\n * `rules.every(isAppRawRule)` narrows the list, and a list that fails is a\n * contract mismatch, never an ability built from it.\n */\nexport function isAppRawRule(rule: {\n action: string | string[];\n subject?: string | string[];\n}): rule is AppRawRule {\n return everyIn(rule.action, ACTION_SET) && everyIn(rule.subject, SUBJECT_SET);\n}\n"]}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* viewer signed in and onboarded, no membership: reads everything a member
|
|
8
8
|
* reads, reports, asks support, manages their own account; takes
|
|
9
9
|
* part in nothing
|
|
10
|
-
* member holds a platform membership (
|
|
10
|
+
* member holds a platform membership (paid once, a founding coupon, a
|
|
11
11
|
* grant) or any staff role: takes part
|
|
12
12
|
*
|
|
13
13
|
* The server builds it into the CASL ability on every request, from the
|
package/dist/access/standing.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* viewer signed in and onboarded, no membership: reads everything a member
|
|
8
8
|
* reads, reports, asks support, manages their own account; takes
|
|
9
9
|
* part in nothing
|
|
10
|
-
* member holds a platform membership (
|
|
10
|
+
* member holds a platform membership (paid once, a founding coupon, a
|
|
11
11
|
* grant) or any staff role: takes part
|
|
12
12
|
*
|
|
13
13
|
* The server builds it into the CASL ability on every request, from the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standing.js","sourceRoot":"","sources":["../../src/access/standing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,qFAAqF;AACrF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAC7D,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AAGtD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,qBAAqB;IACrB,eAAe;IACf,sBAAsB;CACd,CAAC;AACX,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;AAO/D,kFAAkF;AAClF,MAAM,UAAU,cAAc,CAAC,MAAe;IAC5C,MAAM,MAAM,GAAG,kBAAkB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACpD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7C,CAAC","sourcesContent":["/**\n * founder-schema: standing, whether someone takes part or only looks (0.12.0)\n *\n * The user's ruling (2026-10-11): LOOKING IS FREE, TAKING PART IS PAID. Every\n * signed-in person has a standing:\n *\n * viewer signed in and onboarded, no membership: reads everything a member\n * reads, reports, asks support, manages their own account; takes\n * part in nothing\n * member holds a platform membership (
|
|
1
|
+
{"version":3,"file":"standing.js","sourceRoot":"","sources":["../../src/access/standing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,qFAAqF;AACrF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAC7D,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AAGtD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,qBAAqB;IACrB,eAAe;IACf,sBAAsB;CACd,CAAC;AACX,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;AAO/D,kFAAkF;AAClF,MAAM,UAAU,cAAc,CAAC,MAAe;IAC5C,MAAM,MAAM,GAAG,kBAAkB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACpD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7C,CAAC","sourcesContent":["/**\n * founder-schema: standing, whether someone takes part or only looks (0.12.0)\n *\n * The user's ruling (2026-10-11): LOOKING IS FREE, TAKING PART IS PAID. Every\n * signed-in person has a standing:\n *\n * viewer signed in and onboarded, no membership: reads everything a member\n * reads, reports, asks support, manages their own account; takes\n * part in nothing\n * member holds a platform membership (paid once, a founding coupon, a\n * grant) or any staff role: takes part\n *\n * The server builds it into the CASL ability on every request, from the\n * member's record; the web learns it from `GET /me/access` and from the rules\n * themselves. A refusal for want of it is not a bare \"forbidden\": the rule\n * carries a REASON (`ACCESS_REASON_VALUES`), packed with the rules, so the web\n * can open the Join sheet or the Upgrade tab instead of drawing a dead button,\n * and the server answers that same reason as the error code.\n *\n * @module founder-schema/access/standing\n */\n\nimport { z } from 'zod';\nimport type { ApiErrorCode } from '../core/errors.js';\n\n/** ⚠ Read back from packed rules (a condition on `Member.standing`): append only. */\nexport const STANDING_VALUES = ['viewer', 'member'] as const;\nexport const standingSchema = z.enum(STANDING_VALUES);\nexport type Standing = z.infer<typeof standingSchema>;\n\n/**\n * Why a rule refuses, as CASL's `because()` carries it. Each is also an API\n * error code (checked below), so the server answers the reason as the code\n * and the web maps both to the same sheet.\n *\n * MEMBERSHIP_REQUIRED a viewer taking part: offer the membership\n * PLAN_REQUIRED a member without a plan starting a conversation with\n * someone they do not know: offer Premium or Business\n * MESSAGE_NOT_ACCEPTED starting a conversation with someone who cannot chat\n * (a viewer): nothing to offer\n *\n * ⚠ When several refusals match, CASL reports the LAST one written. The\n * server writes the viewer's refusals after everything else, so a viewer is\n * always told about the membership first.\n */\nexport const ACCESS_REASON_VALUES = [\n 'MEMBERSHIP_REQUIRED',\n 'PLAN_REQUIRED',\n 'MESSAGE_NOT_ACCEPTED',\n] as const;\nexport const accessReasonSchema = z.enum(ACCESS_REASON_VALUES);\nexport type AccessReason = z.infer<typeof accessReasonSchema>;\n\n/** Compile-time proof that every reason is an error code the API answers. */\ntype Assert<T extends true> = T;\nexport type EveryReasonIsAnErrorCode = Assert<AccessReason extends ApiErrorCode ? true : false>;\n\n/** A reason off a rule (`relevantRuleFor(...)?.reason`), if it is one of ours. */\nexport function accessReasonOf(reason: unknown): AccessReason | null {\n const parsed = accessReasonSchema.safeParse(reason);\n return parsed.success ? parsed.data : null;\n}\n"]}
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* @module founder-schema/domains/audit
|
|
23
23
|
*/
|
|
24
24
|
import { z } from 'zod';
|
|
25
|
-
export declare const AUDIT_ACTION_VALUES: readonly ["role.granted", "role.revoked", "mpin.cleared", "content.removed", "content.hidden", "content.restored", "report.dismissed", "member.suspended", "member.unsuspended", "ticket.claimed", "ticket.resolved", "capability.granted", "capability.revoked", "community.created", "community.visibility_changed", "community.archived", "community.restored", "community.deleted", "community_suggestion.declined", "community.orphaned", "membership.granted", "membership.revoked", "payment.refunded", "coupon.created", "coupon.updated", "poll.closed"];
|
|
25
|
+
export declare const AUDIT_ACTION_VALUES: readonly ["role.granted", "role.revoked", "mpin.cleared", "content.removed", "content.hidden", "content.restored", "report.dismissed", "member.suspended", "member.unsuspended", "ticket.claimed", "ticket.resolved", "capability.granted", "capability.revoked", "community.created", "community.visibility_changed", "community.archived", "community.restored", "community.deleted", "community_suggestion.declined", "community.orphaned", "membership.granted", "membership.revoked", "payment.refunded", "coupon.created", "coupon.updated", "poll.closed", "signups.viewed"];
|
|
26
26
|
export declare const auditActionSchema: z.ZodEnum<{
|
|
27
27
|
"role.granted": "role.granted";
|
|
28
28
|
"role.revoked": "role.revoked";
|
|
@@ -50,6 +50,7 @@ export declare const auditActionSchema: z.ZodEnum<{
|
|
|
50
50
|
"coupon.created": "coupon.created";
|
|
51
51
|
"coupon.updated": "coupon.updated";
|
|
52
52
|
"poll.closed": "poll.closed";
|
|
53
|
+
"signups.viewed": "signups.viewed";
|
|
53
54
|
}>;
|
|
54
55
|
export type AuditAction = z.infer<typeof auditActionSchema>;
|
|
55
56
|
/**
|
|
@@ -157,6 +158,7 @@ export declare const auditEntrySchema: z.ZodObject<{
|
|
|
157
158
|
"coupon.created": "coupon.created";
|
|
158
159
|
"coupon.updated": "coupon.updated";
|
|
159
160
|
"poll.closed": "poll.closed";
|
|
161
|
+
"signups.viewed": "signups.viewed";
|
|
160
162
|
}>;
|
|
161
163
|
target: z.ZodObject<{
|
|
162
164
|
subject: z.ZodEnum<{
|
|
@@ -182,6 +184,7 @@ export declare const auditEntrySchema: z.ZodObject<{
|
|
|
182
184
|
Coupon: "Coupon";
|
|
183
185
|
ProductInsights: "ProductInsights";
|
|
184
186
|
ProfileViewers: "ProfileViewers";
|
|
187
|
+
Signup: "Signup";
|
|
185
188
|
}>;
|
|
186
189
|
id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
187
190
|
label: z.ZodNullable<z.ZodString>;
|
|
@@ -255,6 +258,7 @@ export declare const auditPageSchema: z.ZodObject<{
|
|
|
255
258
|
"coupon.created": "coupon.created";
|
|
256
259
|
"coupon.updated": "coupon.updated";
|
|
257
260
|
"poll.closed": "poll.closed";
|
|
261
|
+
"signups.viewed": "signups.viewed";
|
|
258
262
|
}>;
|
|
259
263
|
target: z.ZodObject<{
|
|
260
264
|
subject: z.ZodEnum<{
|
|
@@ -280,6 +284,7 @@ export declare const auditPageSchema: z.ZodObject<{
|
|
|
280
284
|
Coupon: "Coupon";
|
|
281
285
|
ProductInsights: "ProductInsights";
|
|
282
286
|
ProfileViewers: "ProfileViewers";
|
|
287
|
+
Signup: "Signup";
|
|
283
288
|
}>;
|
|
284
289
|
id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
285
290
|
label: z.ZodNullable<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../../src/domains/audit/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../../src/domains/audit/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,mBAAmB,qjBAiFtB,CAAC;AACX,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA8B,CAAC;AAC7D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAuB3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAS3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAoC,CAAC;AACjE,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -100,6 +100,14 @@ export const AUDIT_ACTION_VALUES = [
|
|
|
100
100
|
* closed). Its author closing their own is not audited.
|
|
101
101
|
*/
|
|
102
102
|
'poll.closed',
|
|
103
|
+
/**
|
|
104
|
+
* Staff read a page of unfinished sign-ups (2026-12-06): names, phones and
|
|
105
|
+
* emails, so every read is on record (DPDP). Target subject `Signup`, its id
|
|
106
|
+
* the READER's own account (a list has no one id). `detail.rows` (how many
|
|
107
|
+
* people were shown), `detail.searched`. Never the search text: it may be a
|
|
108
|
+
* phone number or an email.
|
|
109
|
+
*/
|
|
110
|
+
'signups.viewed',
|
|
103
111
|
];
|
|
104
112
|
export const auditActionSchema = z.enum(AUDIT_ACTION_VALUES);
|
|
105
113
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../src/domains/audit/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,kDAAkD;IAClD,cAAc;IACd,qDAAqD;IACrD,cAAc;IACd,uEAAuE;IACvE,cAAc;IACd,gGAAgG;IAChG,iBAAiB;IACjB;;;;;OAKG;IACH,gBAAgB;IAChB,uGAAuG;IACvG,kBAAkB;IAClB,2FAA2F;IAC3F,kBAAkB;IAClB,gEAAgE;IAChE,kBAAkB;IAClB,+BAA+B;IAC/B,oBAAoB;IACpB,qCAAqC;IACrC,gBAAgB;IAChB,mDAAmD;IACnD,iBAAiB;IACjB,6DAA6D;IAC7D,oBAAoB;IACpB,gEAAgE;IAChE,oBAAoB;IACpB,0GAA0G;IAC1G,mBAAmB;IACnB,wFAAwF;IACxF,8BAA8B;IAC9B,0CAA0C;IAC1C,oBAAoB;IACpB,oDAAoD;IACpD,oBAAoB;IACpB,yCAAyC;IACzC,mBAAmB;IACnB,wGAAwG;IACxG,+BAA+B;IAC/B;;;;OAIG;IACH,oBAAoB;IACpB,8FAA8F;IAC9F,oBAAoB;IACpB;;;;OAIG;IACH,oBAAoB;IACpB;;;OAGG;IACH,kBAAkB;IAClB,sFAAsF;IACtF,gBAAgB;IAChB,0GAA0G;IAC1G,gBAAgB;IAChB;;;;OAIG;IACH,aAAa;
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../src/domains/audit/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EA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AO,CAAC;QACxB,oCAAoC;QACpC,QAAQ,EAAE,UAAU;KACrB,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;QACzB,6CAA6C;QAC7C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;KACjB,CAAC;IACF;;;;OAIG;IACH,uEAAuE;IACvE,YAAY,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;CACnD,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,EAAE,EAAE,cAAc;IAClB,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE,iBAAiB;IACzB,6EAA6E;IAC7E,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;IAC9F,mFAAmF;IACnF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACtF,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;CACrB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["/**\n * founder-schema: the audit log\n *\n * GET /api/v1/audit staff actions, newest first\n *\n * Every action a staff member takes on a MEMBER or on what a member wrote\n * (roles, MPIN resets, suspensions, moderation decisions, taking and closing\n * tickets) is written here, at the moment it happens, by the server: who did\n * it, AS WHICH ROLE, what they did, to what, and anything that explains it.\n * The support team's own library (saved replies) is not a member's, so its\n * edits are not entries. Entries are never edited or\n * deleted. It is how a dispute (\"who removed my post, and why\") gets an\n * answer, and how a misused staff account is noticed.\n *\n * WHO READS WHAT is the reader's permissions, applied to the query: a\n * superadmin reads every entry; any other staff role reads the entries it\n * wrote itself (its History).\n *\n * The action list grows with the staff features; it never shrinks, because an\n * old entry must still parse.\n *\n * @module founder-schema/domains/audit\n */\n\nimport { z } from 'zod';\nimport { subjectSchema } from '../../access/permissions.js';\nimport { roleSchema } from '../../access/roles.js';\nimport { objectIdSchema } from '../../core/common.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { personSchema } from '../people/person.js';\n\nexport const AUDIT_ACTION_VALUES = [\n /** A platform role was granted. `detail.role`. */\n 'role.granted',\n /** A platform role was taken away. `detail.role`. */\n 'role.revoked',\n /** Someone's forgotten MPIN was cleared, so they can set a new one. */\n 'mpin.cleared',\n /** Staff removed someone else's post, poll, comment or review (`target.subject` says which). */\n 'content.removed',\n /**\n * Staff hid a post, poll, comment, product or review: out of every feed and\n * list, restorable. `detail.note`. Since 0.9.0 also a community's\n * moderators hiding a post, poll or comment in it (actor kind `member`, or\n * staff), with `detail.communityId`.\n */\n 'content.hidden',\n /** Hidden content (a product or review too) put back, by staff or (0.9.0) a community's moderators. */\n 'content.restored',\n /** Staff looked at what was reported and left it up. `detail.reports`: how many closed. */\n 'report.dismissed',\n /** A member was suspended from the product. `detail.reason`. */\n 'member.suspended',\n /** A suspension was lifted. */\n 'member.unsuspended',\n /** A support agent took a ticket. */\n 'ticket.claimed',\n /** A support agent closed a ticket as resolved. */\n 'ticket.resolved',\n /** A capability was granted (0.9.0). `detail.capability`. */\n 'capability.granted',\n /** A capability was taken away (0.9.0). `detail.capability`. */\n 'capability.revoked',\n /** A community was created (0.9.0). `detail.visibility`; `detail.suggestionId` when from a suggestion. */\n 'community.created',\n /** A community's type changed (0.9.0). `detail.from`, `detail.to`, `detail.exposed`. */\n 'community.visibility_changed',\n /** Staff archived a community (0.9.0). */\n 'community.archived',\n /** Staff restored an archived community (0.9.0). */\n 'community.restored',\n /** Staff deleted a community (0.9.0). */\n 'community.deleted',\n /** Staff declined a community suggestion (0.9.0). `detail.reason`. Approving is `community.created`. */\n 'community_suggestion.declined',\n /**\n * A community was left with no admin (0.9.0): its last admin's account was\n * deleted where that cannot be refused. Written by the deletion (actor\n * kind `script`); managers then make a member admin.\n */\n 'community.orphaned',\n /** Staff gave someone a membership (0.12.0). `detail.reason`. Target subject `Membership`. */\n 'membership.granted',\n /**\n * Staff took a founding, coupon or granted membership away (0.12.0): a fake\n * or duplicate account. `detail.reason`, `detail.kind`. A paid one is\n * refunded instead (`payment.refunded`).\n */\n 'membership.revoked',\n /**\n * Staff refunded a payment (0.12.0). `detail.reason`, `detail.amount`\n * (paise), `detail.item`. Target subject `Payment`.\n */\n 'payment.refunded',\n /** Staff created a coupon (0.12.0). `detail.code`, `detail.benefit`, `detail.max`. */\n 'coupon.created',\n /** Staff changed a coupon (0.12.0): switched it off or on, its cap, window or label. `detail.changes`. */\n 'coupon.updated',\n /**\n * Staff closed someone else's poll before its time (2026-11-23). Target\n * subject `Poll`; `detail.authorId`, `detail.closesAt` (when it would have\n * closed). Its author closing their own is not audited.\n */\n 'poll.closed',\n /**\n * Staff read a page of unfinished sign-ups (2026-12-06): names, phones and\n * emails, so every read is on record (DPDP). Target subject `Signup`, its id\n * the READER's own account (a list has no one id). `detail.rows` (how many\n * people were shown), `detail.searched`. Never the search text: it may be a\n * phone number or an email.\n */\n 'signups.viewed',\n] as const;\nexport const auditActionSchema = z.enum(AUDIT_ACTION_VALUES);\nexport type AuditAction = z.infer<typeof auditActionSchema>;\n\n/**\n * Who did it. A person, acting as one of their roles; a server script, which\n * is the only way a superadmin is ever made; or (0.9.0) a member acting in a\n * community they run, who is not staff.\n */\nexport const auditActorSchema = z.discriminatedUnion('kind', [\n /**\n * The person (0.20.0, `personSchema`). ⚠ `displayName` and `firstName` are\n * their name WHEN THEY DID IT: an entry is a record, so it is not renamed\n * later. The picture and handle are live, and empty once the account is gone.\n */\n personSchema.extend({\n kind: z.literal('staff'),\n /** The role they were acting as. */\n actingAs: roleSchema,\n }),\n z.object({\n kind: z.literal('script'),\n /** Which script, e.g. `grant-superadmin`. */\n name: z.string(),\n }),\n /**\n * A member who is not acting as staff (0.9.0): a community's admin changing\n * its type, say. Its own kind, so nobody reading the log mistakes a\n * community admin for staff.\n */\n /** The person; their name as it was when they did it, like `staff`. */\n personSchema.extend({ kind: z.literal('member') }),\n]);\nexport type AuditActor = z.infer<typeof auditActorSchema>;\n\nexport const auditEntrySchema = z.object({\n id: objectIdSchema,\n actor: auditActorSchema,\n action: auditActionSchema,\n /** What it was done to. `label` is its name at the time, when it has one. */\n target: z.object({ subject: subjectSchema, id: objectIdSchema, label: z.string().nullable() }),\n /** The specifics, by action (the role granted, a reason given). Never a secret. */\n detail: z.record(z.string(), z.union([z.string(), z.number(), z.boolean(), z.null()])),\n at: z.iso.datetime(),\n});\nexport type AuditEntry = z.infer<typeof auditEntrySchema>;\n\nexport const auditPageSchema = paginatedSchema(auditEntrySchema);\nexport type AuditPage = z.infer<typeof auditPageSchema>;\n"]}
|
|
@@ -49,7 +49,7 @@ export type PurchaseKind = (typeof PURCHASE_KIND_VALUES)[number];
|
|
|
49
49
|
/**
|
|
50
50
|
* The thing asked for.
|
|
51
51
|
*
|
|
52
|
-
* membership Rs
|
|
52
|
+
* membership paid once (Rs 299 in the launch offer, 2026-12-06)
|
|
53
53
|
* plan a month or a year of Premium or Business, appended
|
|
54
54
|
* upgrade the Premium time left, turned into Business, for the difference
|
|
55
55
|
*/
|
|
@@ -64,6 +64,8 @@ export declare const purchaseItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
64
64
|
period: z.ZodEnum<{
|
|
65
65
|
month: "month";
|
|
66
66
|
year: "year";
|
|
67
|
+
quarter: "quarter";
|
|
68
|
+
half_year: "half_year";
|
|
67
69
|
}>;
|
|
68
70
|
}, z.core.$strip>, z.ZodObject<{
|
|
69
71
|
kind: z.ZodLiteral<"upgrade">;
|
|
@@ -101,6 +103,8 @@ export declare const quoteBodySchema: z.ZodObject<{
|
|
|
101
103
|
period: z.ZodEnum<{
|
|
102
104
|
month: "month";
|
|
103
105
|
year: "year";
|
|
106
|
+
quarter: "quarter";
|
|
107
|
+
half_year: "half_year";
|
|
104
108
|
}>;
|
|
105
109
|
}, z.core.$strip>, z.ZodObject<{
|
|
106
110
|
kind: z.ZodLiteral<"upgrade">;
|
|
@@ -219,6 +223,8 @@ export declare const autoRenewTermsSchema: z.ZodObject<{
|
|
|
219
223
|
period: z.ZodEnum<{
|
|
220
224
|
month: "month";
|
|
221
225
|
year: "year";
|
|
226
|
+
quarter: "quarter";
|
|
227
|
+
half_year: "half_year";
|
|
222
228
|
}>;
|
|
223
229
|
chargesNow: z.ZodBoolean;
|
|
224
230
|
firstChargeAt: z.ZodISODateTime;
|
|
@@ -237,6 +243,8 @@ export declare const quoteSchema: z.ZodObject<{
|
|
|
237
243
|
period: z.ZodEnum<{
|
|
238
244
|
month: "month";
|
|
239
245
|
year: "year";
|
|
246
|
+
quarter: "quarter";
|
|
247
|
+
half_year: "half_year";
|
|
240
248
|
}>;
|
|
241
249
|
}, z.core.$strip>, z.ZodObject<{
|
|
242
250
|
kind: z.ZodLiteral<"upgrade">;
|
|
@@ -272,6 +280,8 @@ export declare const quoteSchema: z.ZodObject<{
|
|
|
272
280
|
period: z.ZodEnum<{
|
|
273
281
|
month: "month";
|
|
274
282
|
year: "year";
|
|
283
|
+
quarter: "quarter";
|
|
284
|
+
half_year: "half_year";
|
|
275
285
|
}>;
|
|
276
286
|
chargesNow: z.ZodBoolean;
|
|
277
287
|
firstChargeAt: z.ZodISODateTime;
|
|
@@ -319,6 +329,8 @@ export declare const createOrderBodySchema: z.ZodObject<{
|
|
|
319
329
|
period: z.ZodEnum<{
|
|
320
330
|
month: "month";
|
|
321
331
|
year: "year";
|
|
332
|
+
quarter: "quarter";
|
|
333
|
+
half_year: "half_year";
|
|
322
334
|
}>;
|
|
323
335
|
}, z.core.$strip>, z.ZodObject<{
|
|
324
336
|
kind: z.ZodLiteral<"upgrade">;
|
|
@@ -405,6 +417,8 @@ export declare const createOrderResponseSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
405
417
|
period: z.ZodEnum<{
|
|
406
418
|
month: "month";
|
|
407
419
|
year: "year";
|
|
420
|
+
quarter: "quarter";
|
|
421
|
+
half_year: "half_year";
|
|
408
422
|
}>;
|
|
409
423
|
chargesNow: z.ZodBoolean;
|
|
410
424
|
firstChargeAt: z.ZodISODateTime;
|
|
@@ -451,7 +465,8 @@ export type AutoRenewalParams = z.infer<typeof autoRenewalParamsSchema>;
|
|
|
451
465
|
* Refused (`AUTO_RENEW_NOT_OFFERED`) with no plan time held (buy the plan with
|
|
452
466
|
* `autoRenew` instead), for Business while only Premium is held (that is an
|
|
453
467
|
* upgrade), while another auto-renewal holds the slot (one whose stop is
|
|
454
|
-
* already requested does not),
|
|
468
|
+
* already requested does not), for a term not in the catalog's
|
|
469
|
+
* `autoRenewPeriods`, or while auto-renew is off on this server.
|
|
455
470
|
*
|
|
456
471
|
* `billing`: the place of supply every renewal's invoice needs. Without it the
|
|
457
472
|
* member's saved details are used; with neither, `VALIDATION_ERROR` on
|
|
@@ -465,6 +480,8 @@ export declare const startAutoRenewalBodySchema: z.ZodObject<{
|
|
|
465
480
|
period: z.ZodEnum<{
|
|
466
481
|
month: "month";
|
|
467
482
|
year: "year";
|
|
483
|
+
quarter: "quarter";
|
|
484
|
+
half_year: "half_year";
|
|
468
485
|
}>;
|
|
469
486
|
billing: z.ZodOptional<z.ZodObject<{
|
|
470
487
|
stateCode: z.ZodEnum<{
|
|
@@ -544,6 +561,8 @@ export declare const autoRenewalStateSchema: z.ZodObject<{
|
|
|
544
561
|
period: z.ZodEnum<{
|
|
545
562
|
month: "month";
|
|
546
563
|
year: "year";
|
|
564
|
+
quarter: "quarter";
|
|
565
|
+
half_year: "half_year";
|
|
547
566
|
}>;
|
|
548
567
|
orderId: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
549
568
|
nextChargeAt: z.ZodNullable<z.ZodISODateTime>;
|
|
@@ -597,6 +616,8 @@ export declare const orderStateSchema: z.ZodObject<{
|
|
|
597
616
|
period: z.ZodEnum<{
|
|
598
617
|
month: "month";
|
|
599
618
|
year: "year";
|
|
619
|
+
quarter: "quarter";
|
|
620
|
+
half_year: "half_year";
|
|
600
621
|
}>;
|
|
601
622
|
}, z.core.$strip>, z.ZodObject<{
|
|
602
623
|
kind: z.ZodLiteral<"upgrade">;
|
|
@@ -806,6 +827,8 @@ export declare const paymentSummarySchema: z.ZodObject<{
|
|
|
806
827
|
period: z.ZodEnum<{
|
|
807
828
|
month: "month";
|
|
808
829
|
year: "year";
|
|
830
|
+
quarter: "quarter";
|
|
831
|
+
half_year: "half_year";
|
|
809
832
|
}>;
|
|
810
833
|
}, z.core.$strip>, z.ZodObject<{
|
|
811
834
|
kind: z.ZodLiteral<"upgrade">;
|
|
@@ -862,6 +885,8 @@ export declare const paymentPageSchema: z.ZodObject<{
|
|
|
862
885
|
period: z.ZodEnum<{
|
|
863
886
|
month: "month";
|
|
864
887
|
year: "year";
|
|
888
|
+
quarter: "quarter";
|
|
889
|
+
half_year: "half_year";
|
|
865
890
|
}>;
|
|
866
891
|
}, z.core.$strip>, z.ZodObject<{
|
|
867
892
|
kind: z.ZodLiteral<"upgrade">;
|
|
@@ -919,6 +944,8 @@ export declare const paymentDetailSchema: z.ZodObject<{
|
|
|
919
944
|
period: z.ZodEnum<{
|
|
920
945
|
month: "month";
|
|
921
946
|
year: "year";
|
|
947
|
+
quarter: "quarter";
|
|
948
|
+
half_year: "half_year";
|
|
922
949
|
}>;
|
|
923
950
|
}, z.core.$strip>, z.ZodObject<{
|
|
924
951
|
kind: z.ZodLiteral<"upgrade">;
|
|
@@ -1135,6 +1162,8 @@ export declare const staffPaymentSummarySchema: z.ZodObject<{
|
|
|
1135
1162
|
period: z.ZodEnum<{
|
|
1136
1163
|
month: "month";
|
|
1137
1164
|
year: "year";
|
|
1165
|
+
quarter: "quarter";
|
|
1166
|
+
half_year: "half_year";
|
|
1138
1167
|
}>;
|
|
1139
1168
|
}, z.core.$strip>, z.ZodObject<{
|
|
1140
1169
|
kind: z.ZodLiteral<"upgrade">;
|
|
@@ -1205,6 +1234,8 @@ export declare const staffPaymentPageSchema: z.ZodObject<{
|
|
|
1205
1234
|
period: z.ZodEnum<{
|
|
1206
1235
|
month: "month";
|
|
1207
1236
|
year: "year";
|
|
1237
|
+
quarter: "quarter";
|
|
1238
|
+
half_year: "half_year";
|
|
1208
1239
|
}>;
|
|
1209
1240
|
}, z.core.$strip>, z.ZodObject<{
|
|
1210
1241
|
kind: z.ZodLiteral<"upgrade">;
|
|
@@ -1276,6 +1307,8 @@ export declare const staffPaymentDetailSchema: z.ZodObject<{
|
|
|
1276
1307
|
period: z.ZodEnum<{
|
|
1277
1308
|
month: "month";
|
|
1278
1309
|
year: "year";
|
|
1310
|
+
quarter: "quarter";
|
|
1311
|
+
half_year: "half_year";
|
|
1279
1312
|
}>;
|
|
1280
1313
|
}, z.core.$strip>, z.ZodObject<{
|
|
1281
1314
|
kind: z.ZodLiteral<"upgrade">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../../src/domains/billing/billing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiCxB,OAAO,EACL,KAAK,cAAc,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACV,KAAK,YAAY,EACjB,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,YAAY,GACb,MAAM,UAA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,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,eAAO,MAAM,mBAAmB;;;;;;;;;;;2BAa9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;iBAavB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD,kDAAkD;AAClD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;iBAA6C,CAAC;AAC3E,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,kBAAkB;;iBAAyC,CAAC;AACzE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAK9D,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;iBAS4D,CAAC;AAChG,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;;;iBAQ4D,CAAC;AAChG,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -57,7 +57,7 @@ export const PURCHASE_KIND_VALUES = ['membership', 'plan', 'upgrade'];
|
|
|
57
57
|
/**
|
|
58
58
|
* The thing asked for.
|
|
59
59
|
*
|
|
60
|
-
* membership Rs
|
|
60
|
+
* membership paid once (Rs 299 in the launch offer, 2026-12-06)
|
|
61
61
|
* plan a month or a year of Premium or Business, appended
|
|
62
62
|
* upgrade the Premium time left, turned into Business, for the difference
|
|
63
63
|
*/
|
|
@@ -233,7 +233,8 @@ export const createOrderBodySchema = z.object({
|
|
|
233
233
|
* Buy the plan as an AUTO-RENEWAL (0.31.0): consent, said explicitly on the
|
|
234
234
|
* wire (the web's switch is on by default, the user's ruling; the request
|
|
235
235
|
* still says it). Only for `item.kind: 'plan'`, without a coupon, while the
|
|
236
|
-
* catalog's `autoRenewEnabled
|
|
236
|
+
* catalog's `autoRenewEnabled`, for a term in its `autoRenewPeriods`:
|
|
237
|
+
* otherwise `AUTO_RENEW_NOT_OFFERED`. The
|
|
237
238
|
* answer is then `status: 'subscription'`.
|
|
238
239
|
*/
|
|
239
240
|
autoRenew: z.boolean().optional(),
|
|
@@ -315,7 +316,8 @@ export const autoRenewalParamsSchema = z.object({ autoRenewalId: objectIdSchema
|
|
|
315
316
|
* Refused (`AUTO_RENEW_NOT_OFFERED`) with no plan time held (buy the plan with
|
|
316
317
|
* `autoRenew` instead), for Business while only Premium is held (that is an
|
|
317
318
|
* upgrade), while another auto-renewal holds the slot (one whose stop is
|
|
318
|
-
* already requested does not),
|
|
319
|
+
* already requested does not), for a term not in the catalog's
|
|
320
|
+
* `autoRenewPeriods`, or while auto-renew is off on this server.
|
|
319
321
|
*
|
|
320
322
|
* `billing`: the place of supply every renewal's invoice needs. Without it the
|
|
321
323
|
* member's saved details are used; with neither, `VALIDATION_ERROR` on
|