founder-schema 0.17.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +186 -17
- package/dist/access/access.d.ts +1 -1
- package/dist/access/access.d.ts.map +1 -1
- package/dist/access/access.js +4 -1
- package/dist/access/access.js.map +1 -1
- package/dist/access/permissions.d.ts +27 -29
- package/dist/access/permissions.d.ts.map +1 -1
- package/dist/access/permissions.js +39 -3
- package/dist/access/permissions.js.map +1 -1
- package/dist/core/common.d.ts +54 -23
- package/dist/core/common.d.ts.map +1 -1
- package/dist/core/common.js +49 -24
- package/dist/core/common.js.map +1 -1
- package/dist/core/errors.d.ts +7 -5
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +17 -11
- package/dist/core/errors.js.map +1 -1
- package/dist/core/limits.d.ts +73 -17
- package/dist/core/limits.d.ts.map +1 -1
- package/dist/core/limits.js +77 -22
- package/dist/core/limits.js.map +1 -1
- package/dist/core/money.d.ts +33 -0
- package/dist/core/money.d.ts.map +1 -0
- package/dist/core/money.js +36 -0
- package/dist/core/money.js.map +1 -0
- package/dist/core/responses.d.ts +14 -4
- package/dist/core/responses.d.ts.map +1 -1
- package/dist/core/responses.js.map +1 -1
- package/dist/core/validation.d.ts +19 -2
- package/dist/core/validation.d.ts.map +1 -1
- package/dist/core/validation.js +19 -2
- package/dist/core/validation.js.map +1 -1
- package/dist/domains/billing/billing.d.ts +61 -8
- package/dist/domains/billing/billing.d.ts.map +1 -1
- package/dist/domains/billing/billing.js +58 -22
- package/dist/domains/billing/billing.js.map +1 -1
- package/dist/domains/billing/gst.d.ts.map +1 -1
- package/dist/domains/billing/gst.js +4 -3
- package/dist/domains/billing/gst.js.map +1 -1
- package/dist/domains/chat/chat.d.ts +0 -21
- package/dist/domains/chat/chat.d.ts.map +1 -1
- package/dist/domains/chat/chat.js +0 -20
- package/dist/domains/chat/chat.js.map +1 -1
- package/dist/domains/communities/communities.d.ts +30 -12
- package/dist/domains/communities/communities.d.ts.map +1 -1
- package/dist/domains/communities/communities.js +43 -15
- package/dist/domains/communities/communities.js.map +1 -1
- package/dist/domains/contributions/contributions.d.ts +1 -1
- package/dist/domains/contributions/contributions.js +1 -1
- package/dist/domains/contributions/contributions.js.map +1 -1
- package/dist/domains/dashboard/dashboard.d.ts +3 -1
- package/dist/domains/dashboard/dashboard.d.ts.map +1 -1
- package/dist/domains/dashboard/dashboard.js +23 -7
- package/dist/domains/dashboard/dashboard.js.map +1 -1
- package/dist/domains/discover/discover.d.ts +8 -8
- package/dist/domains/feed/feed.d.ts +55 -153
- package/dist/domains/feed/feed.d.ts.map +1 -1
- package/dist/domains/feed/feed.js +53 -58
- package/dist/domains/feed/feed.js.map +1 -1
- package/dist/domains/location/areas.d.ts +331 -0
- package/dist/domains/location/areas.d.ts.map +1 -0
- package/dist/domains/location/areas.js +238 -0
- package/dist/domains/location/areas.js.map +1 -0
- package/dist/domains/location/india.d.ts +41 -123
- package/dist/domains/location/india.d.ts.map +1 -1
- package/dist/domains/location/india.js +121 -59
- package/dist/domains/location/india.js.map +1 -1
- package/dist/domains/members/members.d.ts +2 -2
- package/dist/domains/membership/membership.d.ts +26 -0
- package/dist/domains/membership/membership.d.ts.map +1 -1
- package/dist/domains/membership/membership.js +55 -1
- package/dist/domains/membership/membership.js.map +1 -1
- package/dist/domains/moderation/moderation.d.ts +2 -2
- package/dist/domains/moderation/moderation.js +3 -3
- package/dist/domains/moderation/moderation.js.map +1 -1
- package/dist/domains/notifications/notifications.d.ts +1 -10
- package/dist/domains/notifications/notifications.d.ts.map +1 -1
- package/dist/domains/notifications/notifications.js +2 -3
- package/dist/domains/notifications/notifications.js.map +1 -1
- package/dist/domains/onboarding/onboarding-answers.d.ts +42 -14
- package/dist/domains/onboarding/onboarding-answers.d.ts.map +1 -1
- package/dist/domains/onboarding/onboarding-answers.js +49 -33
- package/dist/domains/onboarding/onboarding-answers.js.map +1 -1
- package/dist/domains/onboarding/onboarding.d.ts +332 -138
- package/dist/domains/onboarding/onboarding.d.ts.map +1 -1
- package/dist/domains/onboarding/onboarding.js +47 -59
- package/dist/domains/onboarding/onboarding.js.map +1 -1
- package/dist/domains/products/products.d.ts +43 -8
- package/dist/domains/products/products.d.ts.map +1 -1
- package/dist/domains/products/products.js +57 -11
- package/dist/domains/products/products.js.map +1 -1
- package/dist/domains/profile/founder-profile.d.ts +123 -143
- package/dist/domains/profile/founder-profile.d.ts.map +1 -1
- package/dist/domains/profile/founder-profile.js +77 -35
- package/dist/domains/profile/founder-profile.js.map +1 -1
- package/dist/domains/profile/my-profile.d.ts +3 -3
- package/dist/domains/reviews/reviews.d.ts +1 -1
- package/dist/domains/reviews/reviews.d.ts.map +1 -1
- package/dist/domains/reviews/reviews.js +2 -2
- package/dist/domains/reviews/reviews.js.map +1 -1
- package/dist/domains/support/support.d.ts +22 -3
- package/dist/domains/support/support.d.ts.map +1 -1
- package/dist/domains/support/support.js +19 -5
- package/dist/domains/support/support.js.map +1 -1
- package/dist/domains/team/team.d.ts.map +1 -1
- package/dist/domains/team/team.js +3 -6
- package/dist/domains/team/team.js.map +1 -1
- package/dist/domains/uploads/uploads.d.ts +7 -22
- package/dist/domains/uploads/uploads.d.ts.map +1 -1
- package/dist/domains/uploads/uploads.js +7 -21
- package/dist/domains/uploads/uploads.js.map +1 -1
- package/dist/env.d.ts +26 -13
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +58 -23
- package/dist/env.js.map +1 -1
- package/dist/index.d.ts +19 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* founder-schema: money as people read it (0.18.0)
|
|
3
|
+
*
|
|
4
|
+
* Every amount crosses the wire and is stored in PAISE, an integer, never a
|
|
5
|
+
* float of rupees. This is the one way it is written for a person: "₹3,999",
|
|
6
|
+
* or "₹338.14" when there are paise, Indian digit grouping. The backend's
|
|
7
|
+
* receipts and the web's screens and legal pages each kept a copy before.
|
|
8
|
+
*
|
|
9
|
+
* @module founder-schema/core/money
|
|
10
|
+
*/
|
|
11
|
+
/** "₹3,999", or "₹338.14" when there are paise. Paise in, never a float of rupees. */
|
|
12
|
+
export function rupees(paise) {
|
|
13
|
+
const whole = paise % 100 === 0;
|
|
14
|
+
return `₹${(paise / 100).toLocaleString('en-IN', {
|
|
15
|
+
minimumFractionDigits: whole ? 0 : 2,
|
|
16
|
+
maximumFractionDigits: 2,
|
|
17
|
+
})}`;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* What is LEFT TO REFUND of a payment, in paise (0.18.0): what was taken, less
|
|
21
|
+
* what refunds made in the Razorpay dashboard already gave back. THE amount a
|
|
22
|
+
* refund (or a retry of a failed one) returns, and the one its confirm states;
|
|
23
|
+
* never zeroed by a credit note, which a failed refund already carries.
|
|
24
|
+
*/
|
|
25
|
+
export function refundLeftPaise(payment) {
|
|
26
|
+
return payment.paid - payment.refunded;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* What Founder Circle KEEPS of a payment, in paise (0.18.0): what is left to
|
|
30
|
+
* refund, and nothing once it was refunded through Founder Circle (a credit
|
|
31
|
+
* note). The Overview's revenue; NOT a refund's amount (`refundLeftPaise`).
|
|
32
|
+
*/
|
|
33
|
+
export function keptPaise(payment) {
|
|
34
|
+
return payment.creditNoted ? 0 : refundLeftPaise(payment);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=money.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"money.js","sourceRoot":"","sources":["../../src/core/money.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,sFAAsF;AACtF,MAAM,UAAU,MAAM,CAAC,KAAa;IAClC,MAAM,KAAK,GAAG,KAAK,GAAG,GAAG,KAAK,CAAC,CAAC;IAChC,OAAO,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,cAAc,CAAC,OAAO,EAAE;QAC/C,qBAAqB,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,qBAAqB,EAAE,CAAC;KACzB,CAAC,EAAE,CAAC;AACP,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,OAA2C;IACzE,OAAO,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,OAIzB;IACC,OAAO,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["/**\n * founder-schema: money as people read it (0.18.0)\n *\n * Every amount crosses the wire and is stored in PAISE, an integer, never a\n * float of rupees. This is the one way it is written for a person: \"₹3,999\",\n * or \"₹338.14\" when there are paise, Indian digit grouping. The backend's\n * receipts and the web's screens and legal pages each kept a copy before.\n *\n * @module founder-schema/core/money\n */\n\n/** \"₹3,999\", or \"₹338.14\" when there are paise. Paise in, never a float of rupees. */\nexport function rupees(paise: number): string {\n const whole = paise % 100 === 0;\n return `₹${(paise / 100).toLocaleString('en-IN', {\n minimumFractionDigits: whole ? 0 : 2,\n maximumFractionDigits: 2,\n })}`;\n}\n\n/**\n * What is LEFT TO REFUND of a payment, in paise (0.18.0): what was taken, less\n * what refunds made in the Razorpay dashboard already gave back. THE amount a\n * refund (or a retry of a failed one) returns, and the one its confirm states;\n * never zeroed by a credit note, which a failed refund already carries.\n */\nexport function refundLeftPaise(payment: { paid: number; refunded: number }): number {\n return payment.paid - payment.refunded;\n}\n\n/**\n * What Founder Circle KEEPS of a payment, in paise (0.18.0): what is left to\n * refund, and nothing once it was refunded through Founder Circle (a credit\n * note). The Overview's revenue; NOT a refund's amount (`refundLeftPaise`).\n */\nexport function keptPaise(payment: {\n paid: number;\n refunded: number;\n creditNoted: boolean;\n}): number {\n return payment.creditNoted ? 0 : refundLeftPaise(payment);\n}\n"]}
|
package/dist/core/responses.d.ts
CHANGED
|
@@ -110,7 +110,6 @@ export declare const apiErrorSchema: z.ZodObject<{
|
|
|
110
110
|
COUPON_ALREADY_USED: "COUPON_ALREADY_USED";
|
|
111
111
|
COUPON_CODE_TAKEN: "COUPON_CODE_TAKEN";
|
|
112
112
|
USERNAME_TAKEN: "USERNAME_TAKEN";
|
|
113
|
-
COUPON_FOUNDING_EXISTS: "COUPON_FOUNDING_EXISTS";
|
|
114
113
|
COUPON_FOUNDING_RETIRED: "COUPON_FOUNDING_RETIRED";
|
|
115
114
|
PLAN_UPGRADE_INSTEAD: "PLAN_UPGRADE_INSTEAD";
|
|
116
115
|
PLAN_NOTHING_TO_UPGRADE: "PLAN_NOTHING_TO_UPGRADE";
|
|
@@ -118,7 +117,6 @@ export declare const apiErrorSchema: z.ZodObject<{
|
|
|
118
117
|
PLAN_CHANGED: "PLAN_CHANGED";
|
|
119
118
|
PAYMENTS_UNAVAILABLE: "PAYMENTS_UNAVAILABLE";
|
|
120
119
|
PAYMENT_NOT_VERIFIED: "PAYMENT_NOT_VERIFIED";
|
|
121
|
-
ORDER_EXPIRED: "ORDER_EXPIRED";
|
|
122
120
|
REFUND_WINDOW_CLOSED: "REFUND_WINDOW_CLOSED";
|
|
123
121
|
PAYMENT_NOT_REFUNDABLE: "PAYMENT_NOT_REFUNDABLE";
|
|
124
122
|
REFUND_FAILED: "REFUND_FAILED";
|
|
@@ -132,6 +130,8 @@ export declare const apiErrorSchema: z.ZodObject<{
|
|
|
132
130
|
COMMUNITY_MEMBER_BANNED: "COMMUNITY_MEMBER_BANNED";
|
|
133
131
|
COMMUNITY_INVITE_NOT_NEEDED: "COMMUNITY_INVITE_NOT_NEEDED";
|
|
134
132
|
COMMUNITY_LAST_ADMIN: "COMMUNITY_LAST_ADMIN";
|
|
133
|
+
COMMUNITY_NOT_ON_YOURSELF: "COMMUNITY_NOT_ON_YOURSELF";
|
|
134
|
+
HIDDEN_BY_STAFF: "HIDDEN_BY_STAFF";
|
|
135
135
|
COMMUNITY_ARCHIVED: "COMMUNITY_ARCHIVED";
|
|
136
136
|
COMMUNITY_EXPOSURE_UNCONFIRMED: "COMMUNITY_EXPOSURE_UNCONFIRMED";
|
|
137
137
|
COMMUNITY_PINS_FULL: "COMMUNITY_PINS_FULL";
|
|
@@ -154,6 +154,7 @@ export declare const apiErrorSchema: z.ZodObject<{
|
|
|
154
154
|
CANNOT_CHANGE_OWN_CAPABILITIES: "CANNOT_CHANGE_OWN_CAPABILITIES";
|
|
155
155
|
CAPABILITY_NOT_GRANTABLE: "CAPABILITY_NOT_GRANTABLE";
|
|
156
156
|
TICKET_FULL: "TICKET_FULL";
|
|
157
|
+
TICKET_MEMBER_ONLY: "TICKET_MEMBER_ONLY";
|
|
157
158
|
SAVED_REPLIES_FULL: "SAVED_REPLIES_FULL";
|
|
158
159
|
NOT_LAUNCHED: "NOT_LAUNCHED";
|
|
159
160
|
WAITLIST_CLOSED: "WAITLIST_CLOSED";
|
|
@@ -258,7 +259,6 @@ export declare const errorResponseSchema: z.ZodObject<{
|
|
|
258
259
|
COUPON_ALREADY_USED: "COUPON_ALREADY_USED";
|
|
259
260
|
COUPON_CODE_TAKEN: "COUPON_CODE_TAKEN";
|
|
260
261
|
USERNAME_TAKEN: "USERNAME_TAKEN";
|
|
261
|
-
COUPON_FOUNDING_EXISTS: "COUPON_FOUNDING_EXISTS";
|
|
262
262
|
COUPON_FOUNDING_RETIRED: "COUPON_FOUNDING_RETIRED";
|
|
263
263
|
PLAN_UPGRADE_INSTEAD: "PLAN_UPGRADE_INSTEAD";
|
|
264
264
|
PLAN_NOTHING_TO_UPGRADE: "PLAN_NOTHING_TO_UPGRADE";
|
|
@@ -266,7 +266,6 @@ export declare const errorResponseSchema: z.ZodObject<{
|
|
|
266
266
|
PLAN_CHANGED: "PLAN_CHANGED";
|
|
267
267
|
PAYMENTS_UNAVAILABLE: "PAYMENTS_UNAVAILABLE";
|
|
268
268
|
PAYMENT_NOT_VERIFIED: "PAYMENT_NOT_VERIFIED";
|
|
269
|
-
ORDER_EXPIRED: "ORDER_EXPIRED";
|
|
270
269
|
REFUND_WINDOW_CLOSED: "REFUND_WINDOW_CLOSED";
|
|
271
270
|
PAYMENT_NOT_REFUNDABLE: "PAYMENT_NOT_REFUNDABLE";
|
|
272
271
|
REFUND_FAILED: "REFUND_FAILED";
|
|
@@ -280,6 +279,8 @@ export declare const errorResponseSchema: z.ZodObject<{
|
|
|
280
279
|
COMMUNITY_MEMBER_BANNED: "COMMUNITY_MEMBER_BANNED";
|
|
281
280
|
COMMUNITY_INVITE_NOT_NEEDED: "COMMUNITY_INVITE_NOT_NEEDED";
|
|
282
281
|
COMMUNITY_LAST_ADMIN: "COMMUNITY_LAST_ADMIN";
|
|
282
|
+
COMMUNITY_NOT_ON_YOURSELF: "COMMUNITY_NOT_ON_YOURSELF";
|
|
283
|
+
HIDDEN_BY_STAFF: "HIDDEN_BY_STAFF";
|
|
283
284
|
COMMUNITY_ARCHIVED: "COMMUNITY_ARCHIVED";
|
|
284
285
|
COMMUNITY_EXPOSURE_UNCONFIRMED: "COMMUNITY_EXPOSURE_UNCONFIRMED";
|
|
285
286
|
COMMUNITY_PINS_FULL: "COMMUNITY_PINS_FULL";
|
|
@@ -302,6 +303,7 @@ export declare const errorResponseSchema: z.ZodObject<{
|
|
|
302
303
|
CANNOT_CHANGE_OWN_CAPABILITIES: "CANNOT_CHANGE_OWN_CAPABILITIES";
|
|
303
304
|
CAPABILITY_NOT_GRANTABLE: "CAPABILITY_NOT_GRANTABLE";
|
|
304
305
|
TICKET_FULL: "TICKET_FULL";
|
|
306
|
+
TICKET_MEMBER_ONLY: "TICKET_MEMBER_ONLY";
|
|
305
307
|
SAVED_REPLIES_FULL: "SAVED_REPLIES_FULL";
|
|
306
308
|
NOT_LAUNCHED: "NOT_LAUNCHED";
|
|
307
309
|
WAITLIST_CLOSED: "WAITLIST_CLOSED";
|
|
@@ -369,4 +371,12 @@ export declare const idResponseSchema: z.ZodObject<{
|
|
|
369
371
|
id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
370
372
|
}, z.core.$strip>;
|
|
371
373
|
export type IdResponse = z.infer<typeof idResponseSchema>;
|
|
374
|
+
/**
|
|
375
|
+
* What a client passes to build a list query (0.18.0): the query schema's
|
|
376
|
+
* PARSED shape, every field optional. Not `z.input`: a query field is read
|
|
377
|
+
* through `z.preprocess` (a repeated key, an emptied control), so its input
|
|
378
|
+
* type is `unknown` and typing by it would lose every enum check. A client
|
|
379
|
+
* sends values of the parsed type; the server reads them back with the schema.
|
|
380
|
+
*/
|
|
381
|
+
export type QueryArgs<S extends z.ZodType> = Partial<z.output<S>>;
|
|
372
382
|
//# sourceMappingURL=responses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/core/responses.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqBhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/core/responses.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqBhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;GAGG;AACH,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AAQ,EAAE,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAC;AAGH;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,qBAAqB,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAC;AAGH,mDAAmD;AACnD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAsB,IAAO,EAAE,EAAE,CACpE,CAAC,CAAC,MAAM,CAAC;IACP,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IACxB,IAAI;IACJ,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IACzB,KAAK,EAAE,cAAc;CACtB,CAAC,CAAC;AAGH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAsB,IAAO,EAAE,EAAE,CAC9D,CAAC,CAAC,MAAM,CAAC;IACP,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;IACpB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAEL;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC","sourcesContent":["/**\n * founder-schema — API response envelope\n *\n * Every Founder Circle endpoint answers in this shape. The clients read the\n * failure reason at `error.message`, so a handler must never return a bare\n * string body.\n *\n * @module founder-schema/core/responses\n */\n\nimport { z } from 'zod';\nimport { objectIdSchema, productListingRequirementSchema } from './common.js';\nimport { apiErrorCodeSchema } from './errors.js';\nimport { validationIssueSchema } from './validation.js';\n\n/**\n * What an error carries beyond its code, each field named by the code that\n * sends it. Declared here, not loosely typed, because a client parses errors\n * with this schema and Zod drops a key the schema does not name.\n *\n * `issues` is EVERY problem of a 400, each with its path, built on the server\n * by `toValidationIssues`. Until 0.2.0 this was typed as a record of strings\n * that nothing ever sent, while the real 400s carried only the first issue's\n * message, so a client could not tell which field to mark.\n */\nexport const apiErrorDetailsSchema = z.object({\n issues: z.array(validationIssueSchema).optional(),\n /** `MPIN_INCORRECT`: wrong tries left before the MPIN locks. */\n attemptsLeft: z.number().int().min(0).optional(),\n /** `MPIN_LOCKED`: when the MPIN can be tried again. */\n lockedUntil: z.iso.datetime().optional(),\n /** `PRODUCT_NOT_LISTABLE`: what the product lacks to be (or stay) listed. */\n missing: z.array(productListingRequirementSchema).optional(),\n /** `COMMUNITY_ANNOUNCE_TOO_SOON` (0.9.0): when notifying every member is allowed again. */\n nextAt: z.iso.datetime().optional(),\n /**\n * `COMMUNITY_LAST_ADMIN` on an account deletion (0.9.0): the communities the\n * member is the only admin of, to hand over first.\n */\n communities: z.array(z.object({ id: objectIdSchema, name: z.string() })).optional(),\n /** `PRODUCT_LIMIT_REACHED` (0.12.0): the live products their plan keeps. */\n limit: z.number().int().min(0).optional(),\n /** `MESSAGE_ALLOWANCE_UNCONFIRMED` (0.12.0): new people left this month, this one included. */\n left: z.number().int().min(0).optional(),\n /** `MESSAGE_ALLOWANCE_EXHAUSTED` and `..._UNCONFIRMED` (0.12.0): when the month's count starts again. */\n resetsAt: z.iso.datetime().optional(),\n});\nexport type ApiErrorDetails = z.infer<typeof apiErrorDetailsSchema>;\n\n/**\n * `code` is one of `API_ERROR_CODE_VALUES`, and it is what a client acts on.\n * `message` is English, for logs and for a client that predates the code.\n */\nexport const apiErrorSchema = z.object({\n code: apiErrorCodeSchema,\n message: z.string(),\n details: apiErrorDetailsSchema.optional(),\n});\nexport type ApiError = z.infer<typeof apiErrorSchema>;\n\n/** Success envelope. `T` is the payload schema. */\nexport const successResponseSchema = <T extends z.ZodType>(data: T) =>\n z.object({\n success: z.literal(true),\n data,\n message: z.string().optional(),\n });\n\nexport const errorResponseSchema = z.object({\n success: z.literal(false),\n error: apiErrorSchema,\n});\nexport type ErrorResponse = z.infer<typeof errorResponseSchema>;\n\n/**\n * Cursor-paginated list envelope.\n *\n * `nextCursor` is REQUIRED and is `null` at the end of the list. Omitting the\n * key is not the same thing and does not validate: a handler must decide\n * whether there is another page and say so, because \"the key is missing\" and\n * \"there are no more results\" are indistinguishable to a client that has to\n * choose between showing a Load more button and not showing one.\n *\n * An earlier version of this comment said absence and null were equivalent.\n * They never were; the schema has always required the key. Corrected\n * 2026-09-21, and pinned by a test.\n */\nexport const paginatedSchema = <T extends z.ZodType>(item: T) =>\n z.object({\n items: z.array(item),\n nextCursor: z.string().nullable(),\n });\n\n/**\n * What a create, an edit or a delete answers: the id of the thing it touched.\n * A client that needs the whole item reads it, so a write never ships a second\n * projection of it that could drift from the read path's.\n */\nexport const idResponseSchema = z.object({ id: objectIdSchema });\nexport type IdResponse = z.infer<typeof idResponseSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../src/core/responses.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,QAAQ,EAAE;IACjD,gEAAgE;IAChE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,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AAC,IAAI,CAAC;IACxB,IAAI;IACJ,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IACzB,KAAK,EAAE,cAAc;CACtB,CAAC,CAAC;AAGH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAsB,IAAO,EAAE,EAAE,CAC9D,CAAC,CAAC,MAAM,CAAC;IACP,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;IACpB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAEL;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC","sourcesContent":["/**\n * founder-schema — API response envelope\n *\n * Every Founder Circle endpoint answers in this shape. The clients read the\n * failure reason at `error.message`, so a handler must never return a bare\n * string body.\n *\n * @module founder-schema/core/responses\n */\n\nimport { z } from 'zod';\nimport { objectIdSchema, productListingRequirementSchema } from './common.js';\nimport { apiErrorCodeSchema } from './errors.js';\nimport { validationIssueSchema } from './validation.js';\n\n/**\n * What an error carries beyond its code, each field named by the code that\n * sends it. Declared here, not loosely typed, because a client parses errors\n * with this schema and Zod drops a key the schema does not name.\n *\n * `issues` is EVERY problem of a 400, each with its path, built on the server\n * by `toValidationIssues`. Until 0.2.0 this was typed as a record of strings\n * that nothing ever sent, while the real 400s carried only the first issue's\n * message, so a client could not tell which field to mark.\n */\nexport const apiErrorDetailsSchema = z.object({\n issues: z.array(validationIssueSchema).optional(),\n /** `MPIN_INCORRECT`: wrong tries left before the MPIN locks. */\n attemptsLeft: z.number().int().min(0).optional(),\n /** `MPIN_LOCKED`: when the MPIN can be tried again. */\n lockedUntil: z.iso.datetime().optional(),\n /** `PRODUCT_NOT_LISTABLE`: what the product lacks to be (or stay) listed. */\n missing: z.array(productListingRequirementSchema).optional(),\n /** `COMMUNITY_ANNOUNCE_TOO_SOON` (0.9.0): when notifying every member is allowed again. */\n nextAt: z.iso.datetime().optional(),\n /**\n * `COMMUNITY_LAST_ADMIN` on an account deletion (0.9.0): the communities the\n * member is the only admin of, to hand over first.\n */\n communities: z.array(z.object({ id: objectIdSchema, name: z.string() })).optional(),\n /** `PRODUCT_LIMIT_REACHED` (0.12.0): the live products their plan keeps. */\n limit: z.number().int().min(0).optional(),\n /** `MESSAGE_ALLOWANCE_UNCONFIRMED` (0.12.0): new people left this month, this one included. */\n left: z.number().int().min(0).optional(),\n /** `MESSAGE_ALLOWANCE_EXHAUSTED` and `..._UNCONFIRMED` (0.12.0): when the month's count starts again. */\n resetsAt: z.iso.datetime().optional(),\n});\nexport type ApiErrorDetails = z.infer<typeof apiErrorDetailsSchema>;\n\n/**\n * `code` is one of `API_ERROR_CODE_VALUES`, and it is what a client acts on.\n * `message` is English, for logs and for a client that predates the code.\n */\nexport const apiErrorSchema = z.object({\n code: apiErrorCodeSchema,\n message: z.string(),\n details: apiErrorDetailsSchema.optional(),\n});\nexport type ApiError = z.infer<typeof apiErrorSchema>;\n\n/** Success envelope. `T` is the payload schema. */\nexport const successResponseSchema = <T extends z.ZodType>(data: T) =>\n z.object({\n success: z.literal(true),\n data,\n message: z.string().optional(),\n });\n\nexport const errorResponseSchema = z.object({\n success: z.literal(false),\n error: apiErrorSchema,\n});\nexport type ErrorResponse = z.infer<typeof errorResponseSchema>;\n\n/**\n * Cursor-paginated list envelope.\n *\n * `nextCursor` is REQUIRED and is `null` at the end of the list. Omitting the\n * key is not the same thing and does not validate: a handler must decide\n * whether there is another page and say so, because \"the key is missing\" and\n * \"there are no more results\" are indistinguishable to a client that has to\n * choose between showing a Load more button and not showing one.\n *\n * An earlier version of this comment said absence and null were equivalent.\n * They never were; the schema has always required the key. Corrected\n * 2026-09-21, and pinned by a test.\n */\nexport const paginatedSchema = <T extends z.ZodType>(item: T) =>\n z.object({\n items: z.array(item),\n nextCursor: z.string().nullable(),\n });\n\n/**\n * What a create, an edit or a delete answers: the id of the thing it touched.\n * A client that needs the whole item reads it, so a write never ships a second\n * projection of it that could drift from the read path's.\n */\nexport const idResponseSchema = z.object({ id: objectIdSchema });\nexport type IdResponse = z.infer<typeof idResponseSchema>;\n\n/**\n * What a client passes to build a list query (0.18.0): the query schema's\n * PARSED shape, every field optional. Not `z.input`: a query field is read\n * through `z.preprocess` (a repeated key, an emptied control), so its input\n * type is `unknown` and typing by it would lose every enum check. A client\n * sends values of the parsed type; the server reads them back with the schema.\n */\nexport type QueryArgs<S extends z.ZodType> = Partial<z.output<S>>;\n"]}
|
|
@@ -55,8 +55,12 @@ export declare const VALIDATION_MESSAGE: {
|
|
|
55
55
|
readonly dobTooOld: "dobTooOld";
|
|
56
56
|
/** A founding year after this year. */
|
|
57
57
|
readonly foundedYearFuture: "foundedYearFuture";
|
|
58
|
-
/**
|
|
59
|
-
readonly
|
|
58
|
+
/** A request body over the server's size limit (0.18.0: it answered in English). On `body`. */
|
|
59
|
+
readonly bodyTooLarge: "bodyTooLarge";
|
|
60
|
+
/** A request body that is not valid JSON (0.18.0: it answered in English). On `body`. */
|
|
61
|
+
readonly bodyNotJson: "bodyNotJson";
|
|
62
|
+
/** The same option twice in one vote (0.18.0). */
|
|
63
|
+
readonly pollVoteDuplicate: "pollVoteDuplicate";
|
|
60
64
|
/** The same uploaded image attached twice to one post. */
|
|
61
65
|
readonly mediaDuplicate: "mediaDuplicate";
|
|
62
66
|
/** A post with neither text nor media. */
|
|
@@ -139,6 +143,19 @@ export declare const VALIDATION_MESSAGE: {
|
|
|
139
143
|
* Its own key, so the refusal does not carry all 36 names as its message.
|
|
140
144
|
*/
|
|
141
145
|
readonly stateRequired: "stateRequired";
|
|
146
|
+
/** A location picked without its district (0.19.0: state, district, then locality). */
|
|
147
|
+
readonly districtRequired: "districtRequired";
|
|
148
|
+
/**
|
|
149
|
+
* A pick that does not say its locality: a locality's id, or `null` for the
|
|
150
|
+
* whole district (0.19.0). Worded as the choice it is.
|
|
151
|
+
*/
|
|
152
|
+
readonly localityRequired: "localityRequired";
|
|
153
|
+
/**
|
|
154
|
+
* An area id the tree does not have, or not where the pick puts it (a
|
|
155
|
+
* district outside the chosen state, a locality outside the district):
|
|
156
|
+
* "choose it again" (0.19.0).
|
|
157
|
+
*/
|
|
158
|
+
readonly areaNotListed: "areaNotListed";
|
|
142
159
|
};
|
|
143
160
|
export type ValidationMessageKey = (typeof VALIDATION_MESSAGE)[keyof typeof VALIDATION_MESSAGE];
|
|
144
161
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/core/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;IAC7B,6BAA6B;;IAE7B,6DAA6D;;IAE7D,2CAA2C;;IAE3C,+BAA+B;;IAE/B,uDAAuD;;IAEvD,6BAA6B;;IAE7B,8DAA8D;;IAE9D,uCAAuC;;IAEvC,
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/core/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;IAC7B,6BAA6B;;IAE7B,6DAA6D;;IAE7D,2CAA2C;;IAE3C,+BAA+B;;IAE/B,uDAAuD;;IAEvD,6BAA6B;;IAE7B,8DAA8D;;IAE9D,uCAAuC;;IAEvC,+FAA+F;;IAE/F,yFA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MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAKD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE;IAAE,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;CAAE,EAC1C,QAAQ,CAAC,EAAE,WAAW,GACrB,eAAe,EAAE,CAkBnB"}
|
package/dist/core/validation.js
CHANGED
|
@@ -55,8 +55,12 @@ export const VALIDATION_MESSAGE = {
|
|
|
55
55
|
dobTooOld: 'dobTooOld',
|
|
56
56
|
/** A founding year after this year. */
|
|
57
57
|
foundedYearFuture: 'foundedYearFuture',
|
|
58
|
-
/**
|
|
59
|
-
|
|
58
|
+
/** A request body over the server's size limit (0.18.0: it answered in English). On `body`. */
|
|
59
|
+
bodyTooLarge: 'bodyTooLarge',
|
|
60
|
+
/** A request body that is not valid JSON (0.18.0: it answered in English). On `body`. */
|
|
61
|
+
bodyNotJson: 'bodyNotJson',
|
|
62
|
+
/** The same option twice in one vote (0.18.0). */
|
|
63
|
+
pollVoteDuplicate: 'pollVoteDuplicate',
|
|
60
64
|
/** The same uploaded image attached twice to one post. */
|
|
61
65
|
mediaDuplicate: 'mediaDuplicate',
|
|
62
66
|
/** A post with neither text nor media. */
|
|
@@ -139,6 +143,19 @@ export const VALIDATION_MESSAGE = {
|
|
|
139
143
|
* Its own key, so the refusal does not carry all 36 names as its message.
|
|
140
144
|
*/
|
|
141
145
|
stateRequired: 'stateRequired',
|
|
146
|
+
/** A location picked without its district (0.19.0: state, district, then locality). */
|
|
147
|
+
districtRequired: 'districtRequired',
|
|
148
|
+
/**
|
|
149
|
+
* A pick that does not say its locality: a locality's id, or `null` for the
|
|
150
|
+
* whole district (0.19.0). Worded as the choice it is.
|
|
151
|
+
*/
|
|
152
|
+
localityRequired: 'localityRequired',
|
|
153
|
+
/**
|
|
154
|
+
* An area id the tree does not have, or not where the pick puts it (a
|
|
155
|
+
* district outside the chosen state, a locality outside the district):
|
|
156
|
+
* "choose it again" (0.19.0).
|
|
157
|
+
*/
|
|
158
|
+
areaNotListed: 'areaNotListed',
|
|
142
159
|
};
|
|
143
160
|
/**
|
|
144
161
|
* Which part of the request an issue is about.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/core/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,6BAA6B;IAC7B,SAAS,EAAE,WAAW;IACtB,6DAA6D;IAC7D,eAAe,EAAE,iBAAiB;IAClC,2CAA2C;IAC3C,YAAY,EAAE,cAAc;IAC5B,+BAA+B;IAC/B,WAAW,EAAE,aAAa;IAC1B,uDAAuD;IACvD,UAAU,EAAE,YAAY;IACxB,6BAA6B;IAC7B,WAAW,EAAE,aAAa;IAC1B,8DAA8D;IAC9D,SAAS,EAAE,WAAW;IACtB,uCAAuC;IACvC,iBAAiB,EAAE,mBAAmB;IACtC,wDAAwD;IACxD,gBAAgB,EAAE,kBAAkB;IACpC,0DAA0D;IAC1D,cAAc,EAAE,gBAAgB;IAChC,0CAA0C;IAC1C,SAAS,EAAE,WAAW;IACtB,4CAA4C;IAC5C,oBAAoB,EAAE,sBAAsB;IAC5C,uEAAuE;IACvE,aAAa,EAAE,eAAe;IAC9B,uFAAuF;IACvF,UAAU,EAAE,YAAY;IACxB,sEAAsE;IACtE,gBAAgB,EAAE,kBAAkB;IACpC,yEAAyE;IACzE,kBAAkB,EAAE,oBAAoB;IACxC,8CAA8C;IAC9C,WAAW,EAAE,aAAa;IAC1B,4CAA4C;IAC5C,YAAY,EAAE,cAAc;IAC5B,kDAAkD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AAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACjC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACzB,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,IAAI,EAAE,CAAC,CACpF;YACD,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC;QACF,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxC,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,OAAO,KAAK,SAAS;YAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACjD,IAAI,OAAO,KAAK,SAAS;YAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACjD,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ;YAAE,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAChE,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ;YAAE,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAChE,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * founder-schema — How a validation failure is described, on both sides\n *\n * TWO RULES, and they are what let the web client show any error, its own or\n * the server's, on the right field in the member's language:\n *\n * 1. A CUSTOM MESSAGE IS A KEY, NEVER A SENTENCE. Where a schema needs its own\n * message (a refine, a regex), the message is one of `VALIDATION_MESSAGE`,\n * such as `phoneInvalid`. The client turns the key into text in English or\n * Hindi. Before 0.2.0 these were English sentences, so a Hindi screen showed\n * an English error, and a client that wanted to translate one had to match\n * on the wording.\n *\n * Plain bounds carry NO custom message. `.min(1)` and `.max(80)` produce\n * Zod's own `too_small` / `too_big` issues, which already say which bound\n * and what it was (`minimum`, `maximum`, `origin`), and the client words\n * them from those. A hand-written \"at most 80 characters\" would only\n * restate the number in one language.\n *\n * 2. THE SERVER SENDS EVERY ISSUE, IN THIS SHAPE. A 400 answers with\n * `error.details.issues`, built by `toValidationIssues`, so the client can\n * put each one under its field. Until 0.2.0 the backend sent only the\n * first issue's message, with no path at all.\n *\n * ⚠️ `toValidationIssues` COPIES A WHITELIST OF FIELDS, it never spreads an\n * issue. Zod can carry the rejected `input` on an issue, and these bodies hold a\n * date of birth and a phone number. Echoing them into an error response sends\n * them back to the client, into logs and into any proxy in between. A test\n * proves `input` never survives.\n *\n * @module founder-schema/core/validation\n */\n\nimport { z } from 'zod';\n\n/**\n * Every custom message a schema in this package can produce. Each is a\n * translation key the clients define in every language they ship.\n *\n * ⚠️ Append only, and add the translation in the same change. Renaming one\n * shows the raw key to every member until each client ships the new name.\n */\nexport const VALIDATION_MESSAGE = {\n /** Not a 24-hex Mongo id. */\n invalidId: 'invalidId',\n /** Handle: wrong characters, or a dot in the wrong place. */\n usernameInvalid: 'usernameInvalid',\n /** Not a 10-digit Indian mobile number. */\n phoneInvalid: 'phoneInvalid',\n /** Not a `YYYY-MM-DD` date. */\n dateInvalid: 'dateInvalid',\n /** A date that does not exist, such as 30 February. */\n dobInvalid: 'dobInvalid',\n /** Under the minimum age. */\n dobUnderAge: 'dobUnderAge',\n /** Over the sanity ceiling: almost always a mistyped year. */\n dobTooOld: 'dobTooOld',\n /** A founding year after this year. */\n foundedYearFuture: 'foundedYearFuture',\n /** An upload key that is not one this product mints. */\n uploadKeyInvalid: 'uploadKeyInvalid',\n /** The same uploaded image attached twice to one post. */\n mediaDuplicate: 'mediaDuplicate',\n /** A post with neither text nor media. */\n postEmpty: 'postEmpty',\n /** Two poll options with the same label. */\n pollOptionsDuplicate: 'pollOptionsDuplicate',\n /** An empty string sent to clear a patch field; clearing is `null`. */\n clearWithNull: 'clearWithNull',\n /** Not a plain http(s) URL on a real domain (`javascript:`, `localhost`, an IP...). */\n urlInvalid: 'urlInvalid',\n /** A handle this product keeps for itself (`admin`, `support`...). */\n usernameReserved: 'usernameReserved',\n /** Agreed to a version of the guidelines that is not the current one. */\n guidelinesOutdated: 'guidelinesOutdated',\n /** An MPIN that is not exactly six digits. */\n mpinInvalid: 'mpinInvalid',\n /** The MPIN and its confirmation differ. */\n mpinMismatch: 'mpinMismatch',\n /** Switching to a staff role without the MPIN. */\n mpinRequired: 'mpinRequired',\n /** The same role twice in one list. */\n rolesDuplicate: 'rolesDuplicate',\n /** An ask (\"testers wanted\") on a post or poll that names no product. */\n askWithoutProduct: 'askWithoutProduct',\n /** An App Store link that is not on apps.apple.com. */\n appStoreLinkHost: 'appStoreLinkHost',\n /** A Play Store link that is not on play.google.com. */\n playStoreLinkHost: 'playStoreLinkHost',\n /** A GitHub link that is not on github.com. */\n githubLinkHost: 'githubLinkHost',\n /** A demo video that is not a YouTube link. Video is shared, never uploaded. */\n videoLinkHost: 'videoLinkHost',\n /** The same screenshot twice in one gallery. */\n screenshotsDuplicate: 'screenshotsDuplicate',\n /** The same platform twice in one list. */\n platformsDuplicate: 'platformsDuplicate',\n /** The same topic twice in one list (0.9.0). */\n topicsDuplicate: 'topicsDuplicate',\n /** A post or poll in a community naming a product or an ask (0.9.0): community content carries neither. */\n communityWithProduct: 'communityWithProduct',\n /** The same capability twice in one list (0.9.0). */\n capabilitiesDuplicate: 'capabilitiesDuplicate',\n /** Not a GSTIN: 15 characters in its pattern, with a check character that adds up (0.12.0). */\n gstinInvalid: 'gstinInvalid',\n /** A GSTIN registered in another state than the one chosen: the state is the GSTIN's own (0.12.0). */\n gstinStateMismatch: 'gstinStateMismatch',\n /** A GSTIN without the legal name and address a B2B invoice must carry (0.12.0). */\n gstinNeedsNameAndAddress: 'gstinNeedsNameAndAddress',\n /** A coupon code with characters other than letters, digits and hyphens (0.12.0). */\n couponCodeInvalid: 'couponCodeInvalid',\n /** A coupon window that ends before it starts (0.12.0). */\n couponWindowInvalid: 'couponWindowInvalid',\n /** The same item twice in a coupon's list of what it applies to (0.12.0). */\n couponTargetsDuplicate: 'couponTargetsDuplicate',\n /** A paid purchase without the buyer's state: the invoice's place of supply (0.12.0). */\n billingStateRequired: 'billingStateRequired',\n /**\n * The guidelines not agreed to at all: the tick box left empty (0.17.0).\n * Distinct from `guidelinesOutdated`, which is agreement to an OLDER text;\n * \"the guidelines have changed\" is the wrong thing to tell someone who has\n * not ticked the box yet.\n */\n guidelinesRequired: 'guidelinesRequired',\n /**\n * The photo cannot be used (0.17.0): it is not the member's processed avatar\n * upload any more, most often because it expired before it was saved. Sent\n * by the server on the photo field with `UPLOAD_NOT_ATTACHABLE`.\n */\n photoUnavailable: 'photoUnavailable',\n /** A business type or registration with no business to describe (0.17.0). */\n ventureRequired: 'ventureRequired',\n /** A state that is not one of India's states and union territories (0.17.0). */\n stateUnknown: 'stateUnknown',\n /** The same goal twice in one list (0.17.0). */\n goalsDuplicate: 'goalsDuplicate',\n /** The same skill twice in one list (0.17.0). */\n skillsDuplicate: 'skillsDuplicate',\n /**\n * A location with no state (0.17.0): India's places are chosen state first.\n * Its own key, so the refusal does not carry all 36 names as its message.\n */\n stateRequired: 'stateRequired',\n} as const;\nexport type ValidationMessageKey = (typeof VALIDATION_MESSAGE)[keyof typeof VALIDATION_MESSAGE];\n\n/**\n * Which part of the request an issue is about.\n *\n * ONE PATH CONVENTION: `path` is ALWAYS relative to this part, so a body field\n * reads `['venture', 'name']` with `location: 'body'`, never\n * `['body', 'venture', 'name']`. A form maps body issues straight onto its\n * fields without stripping a prefix, and a client that sees `query` or\n * `params` knows the problem is the URL, not anything the member typed.\n */\nexport const REQUEST_PART_VALUES = ['body', 'query', 'params'] as const;\nexport const requestPartSchema = z.enum(REQUEST_PART_VALUES);\nexport type RequestPart = z.infer<typeof requestPartSchema>;\n\n/**\n * One problem with one field, as it crosses the wire.\n *\n * `code` is Zod's issue code (`too_small`, `too_big`, `invalid_type`,\n * `invalid_format`, `custom`...). `message` is either one of\n * `VALIDATION_MESSAGE` or, for a plain bound, Zod's own English text, which the\n * client ignores in favour of `code` plus `minimum` / `maximum`.\n */\nexport const validationIssueSchema = z.object({\n /** Set by the server on every issue it sends; absent on a client's own parse. */\n location: requestPartSchema.optional(),\n /**\n * Where the problem is, RELATIVE TO `location`: `['venture', 'name']`,\n * `['options', 2, 'label']`, `['contentId']`.\n */\n path: z.array(z.union([z.string(), z.number()])),\n code: z.string(),\n message: z.string(),\n /** `too_small`: the bound that was missed. */\n minimum: z.number().optional(),\n /** `too_big`: the bound that was passed. */\n maximum: z.number().optional(),\n /** What was measured: `string`, `array`, `number`... */\n origin: z.string().optional(),\n /** `invalid_format`: which format, e.g. `url`, `regex`, `email`. */\n format: z.string().optional(),\n});\nexport type ValidationIssue = z.infer<typeof validationIssueSchema>;\n\n/** The loosest shape this needs from a Zod issue, so it works across 4.x. */\ninterface ZodIssueLike {\n path: readonly PropertyKey[];\n code: string;\n message: string;\n minimum?: unknown;\n maximum?: unknown;\n origin?: unknown;\n format?: unknown;\n}\n\nconst toNumber = (v: unknown): number | undefined =>\n typeof v === 'number' ? v : typeof v === 'bigint' ? Number(v) : undefined;\n\n/**\n * A Zod error as the wire shape. Use this on the server for every 400, and on\n * the client to treat its own errors and the server's the same way.\n *\n * `location` is stamped on every issue when given; the server always gives it.\n *\n * Copies a WHITELIST of fields (see the module note). A path segment that is a\n * symbol, which JSON cannot carry, becomes its description.\n */\nexport function toValidationIssues(\n error: { issues: readonly ZodIssueLike[] },\n location?: RequestPart,\n): ValidationIssue[] {\n return error.issues.map((issue) => {\n const out: ValidationIssue = {\n ...(location ? { location } : {}),\n path: issue.path.map((p) =>\n typeof p === 'number' ? p : typeof p === 'string' ? p : String(p.description ?? ''),\n ),\n code: issue.code,\n message: issue.message,\n };\n const minimum = toNumber(issue.minimum);\n const maximum = toNumber(issue.maximum);\n if (minimum !== undefined) out.minimum = minimum;\n if (maximum !== undefined) out.maximum = maximum;\n if (typeof issue.origin === 'string') out.origin = issue.origin;\n if (typeof issue.format === 'string') out.format = issue.format;\n return out;\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/core/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,6BAA6B;IAC7B,SAAS,EAAE,WAAW;IACtB,6DAA6D;IAC7D,eAAe,EAAE,iBAAiB;IAClC,2CAA2C;IAC3C,YAAY,EAAE,cAAc;IAC5B,+BAA+B;IAC/B,WAAW,EAAE,aAAa;IAC1B,uDAAuD;IACvD,UAAU,EAAE,YAAY;IACxB,6BAA6B;IAC7B,WAAW,EAAE,aAAa;IAC1B,8DAA8D;IAC9D,SAAS,EAAE,WAAW;IACtB,uCAAuC;IACvC,iBAAiB,EAAE,mBAAmB;IACtC,+FAA+F;IAC/F,YAAY,EAAE,cAAc;IAC5B,yFAAyF;IACzF,WAAW,EAAE,aAAa;IAC1B,kDAAkD;IAClD,iBAAiB,EAAE,mBAAmB;IACtC,0DAA0D;IAC1D,cAAc,EAAE,gBAAgB;IAChC,0CAA0C;IAC1C,SAAS,EAAE,WAAW;IACtB,4CAA4C;IAC5C,oBAAoB,EAAE,sBAAsB;IAC5C,uEAAuE;IACvE,aAAa,EAAE,eAAe;IAC9B,uFAAuF;IACvF,UAAU,EAAE,YAAY;IACxB,sEAAsE;IACtE,gBAAgB,EAAE,kBAAkB;IACpC,yEAAyE;IACzE,kBAAkB,EAAE,oBAAoB;IACxC,8CAA8C;IAC9C,WAAW,EAAE,aAAa;IAC1B,4CAA4C;IAC5C,YAAY,EAAE,cAAc;IAC5B,kDAAkD;IAClD,YAAY,EAAE,cAAc;IAC5B,uCA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AAE;QAChC,MAAM,GAAG,GAAoB;YAC3B,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACjC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACzB,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,IAAI,EAAE,CAAC,CACpF;YACD,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC;QACF,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxC,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,OAAO,KAAK,SAAS;YAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACjD,IAAI,OAAO,KAAK,SAAS;YAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACjD,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ;YAAE,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAChE,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ;YAAE,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAChE,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * founder-schema — How a validation failure is described, on both sides\n *\n * TWO RULES, and they are what let the web client show any error, its own or\n * the server's, on the right field in the member's language:\n *\n * 1. A CUSTOM MESSAGE IS A KEY, NEVER A SENTENCE. Where a schema needs its own\n * message (a refine, a regex), the message is one of `VALIDATION_MESSAGE`,\n * such as `phoneInvalid`. The client turns the key into text in English or\n * Hindi. Before 0.2.0 these were English sentences, so a Hindi screen showed\n * an English error, and a client that wanted to translate one had to match\n * on the wording.\n *\n * Plain bounds carry NO custom message. `.min(1)` and `.max(80)` produce\n * Zod's own `too_small` / `too_big` issues, which already say which bound\n * and what it was (`minimum`, `maximum`, `origin`), and the client words\n * them from those. A hand-written \"at most 80 characters\" would only\n * restate the number in one language.\n *\n * 2. THE SERVER SENDS EVERY ISSUE, IN THIS SHAPE. A 400 answers with\n * `error.details.issues`, built by `toValidationIssues`, so the client can\n * put each one under its field. Until 0.2.0 the backend sent only the\n * first issue's message, with no path at all.\n *\n * ⚠️ `toValidationIssues` COPIES A WHITELIST OF FIELDS, it never spreads an\n * issue. Zod can carry the rejected `input` on an issue, and these bodies hold a\n * date of birth and a phone number. Echoing them into an error response sends\n * them back to the client, into logs and into any proxy in between. A test\n * proves `input` never survives.\n *\n * @module founder-schema/core/validation\n */\n\nimport { z } from 'zod';\n\n/**\n * Every custom message a schema in this package can produce. Each is a\n * translation key the clients define in every language they ship.\n *\n * ⚠️ Append only, and add the translation in the same change. Renaming one\n * shows the raw key to every member until each client ships the new name.\n */\nexport const VALIDATION_MESSAGE = {\n /** Not a 24-hex Mongo id. */\n invalidId: 'invalidId',\n /** Handle: wrong characters, or a dot in the wrong place. */\n usernameInvalid: 'usernameInvalid',\n /** Not a 10-digit Indian mobile number. */\n phoneInvalid: 'phoneInvalid',\n /** Not a `YYYY-MM-DD` date. */\n dateInvalid: 'dateInvalid',\n /** A date that does not exist, such as 30 February. */\n dobInvalid: 'dobInvalid',\n /** Under the minimum age. */\n dobUnderAge: 'dobUnderAge',\n /** Over the sanity ceiling: almost always a mistyped year. */\n dobTooOld: 'dobTooOld',\n /** A founding year after this year. */\n foundedYearFuture: 'foundedYearFuture',\n /** A request body over the server's size limit (0.18.0: it answered in English). On `body`. */\n bodyTooLarge: 'bodyTooLarge',\n /** A request body that is not valid JSON (0.18.0: it answered in English). On `body`. */\n bodyNotJson: 'bodyNotJson',\n /** The same option twice in one vote (0.18.0). */\n pollVoteDuplicate: 'pollVoteDuplicate',\n /** The same uploaded image attached twice to one post. */\n mediaDuplicate: 'mediaDuplicate',\n /** A post with neither text nor media. */\n postEmpty: 'postEmpty',\n /** Two poll options with the same label. */\n pollOptionsDuplicate: 'pollOptionsDuplicate',\n /** An empty string sent to clear a patch field; clearing is `null`. */\n clearWithNull: 'clearWithNull',\n /** Not a plain http(s) URL on a real domain (`javascript:`, `localhost`, an IP...). */\n urlInvalid: 'urlInvalid',\n /** A handle this product keeps for itself (`admin`, `support`...). */\n usernameReserved: 'usernameReserved',\n /** Agreed to a version of the guidelines that is not the current one. */\n guidelinesOutdated: 'guidelinesOutdated',\n /** An MPIN that is not exactly six digits. */\n mpinInvalid: 'mpinInvalid',\n /** The MPIN and its confirmation differ. */\n mpinMismatch: 'mpinMismatch',\n /** Switching to a staff role without the MPIN. */\n mpinRequired: 'mpinRequired',\n /** The same role twice in one list. */\n rolesDuplicate: 'rolesDuplicate',\n /** An ask (\"testers wanted\") on a post or poll that names no product. */\n askWithoutProduct: 'askWithoutProduct',\n /** An App Store link that is not on apps.apple.com. */\n appStoreLinkHost: 'appStoreLinkHost',\n /** A Play Store link that is not on play.google.com. */\n playStoreLinkHost: 'playStoreLinkHost',\n /** A GitHub link that is not on github.com. */\n githubLinkHost: 'githubLinkHost',\n /** A demo video that is not a YouTube link. Video is shared, never uploaded. */\n videoLinkHost: 'videoLinkHost',\n /** The same screenshot twice in one gallery. */\n screenshotsDuplicate: 'screenshotsDuplicate',\n /** The same platform twice in one list. */\n platformsDuplicate: 'platformsDuplicate',\n /** The same topic twice in one list (0.9.0). */\n topicsDuplicate: 'topicsDuplicate',\n /** A post or poll in a community naming a product or an ask (0.9.0): community content carries neither. */\n communityWithProduct: 'communityWithProduct',\n /** The same capability twice in one list (0.9.0). */\n capabilitiesDuplicate: 'capabilitiesDuplicate',\n /** Not a GSTIN: 15 characters in its pattern, with a check character that adds up (0.12.0). */\n gstinInvalid: 'gstinInvalid',\n /** A GSTIN registered in another state than the one chosen: the state is the GSTIN's own (0.12.0). */\n gstinStateMismatch: 'gstinStateMismatch',\n /** A GSTIN without the legal name and address a B2B invoice must carry (0.12.0). */\n gstinNeedsNameAndAddress: 'gstinNeedsNameAndAddress',\n /** A coupon code with characters other than letters, digits and hyphens (0.12.0). */\n couponCodeInvalid: 'couponCodeInvalid',\n /** A coupon window that ends before it starts (0.12.0). */\n couponWindowInvalid: 'couponWindowInvalid',\n /** The same item twice in a coupon's list of what it applies to (0.12.0). */\n couponTargetsDuplicate: 'couponTargetsDuplicate',\n /** A paid purchase without the buyer's state: the invoice's place of supply (0.12.0). */\n billingStateRequired: 'billingStateRequired',\n /**\n * The guidelines not agreed to at all: the tick box left empty (0.17.0).\n * Distinct from `guidelinesOutdated`, which is agreement to an OLDER text;\n * \"the guidelines have changed\" is the wrong thing to tell someone who has\n * not ticked the box yet.\n */\n guidelinesRequired: 'guidelinesRequired',\n /**\n * The photo cannot be used (0.17.0): it is not the member's processed avatar\n * upload any more, most often because it expired before it was saved. Sent\n * by the server on the photo field with `UPLOAD_NOT_ATTACHABLE`.\n */\n photoUnavailable: 'photoUnavailable',\n /** A business type or registration with no business to describe (0.17.0). */\n ventureRequired: 'ventureRequired',\n /** A state that is not one of India's states and union territories (0.17.0). */\n stateUnknown: 'stateUnknown',\n /** The same goal twice in one list (0.17.0). */\n goalsDuplicate: 'goalsDuplicate',\n /** The same skill twice in one list (0.17.0). */\n skillsDuplicate: 'skillsDuplicate',\n /**\n * A location with no state (0.17.0): India's places are chosen state first.\n * Its own key, so the refusal does not carry all 36 names as its message.\n */\n stateRequired: 'stateRequired',\n /** A location picked without its district (0.19.0: state, district, then locality). */\n districtRequired: 'districtRequired',\n /**\n * A pick that does not say its locality: a locality's id, or `null` for the\n * whole district (0.19.0). Worded as the choice it is.\n */\n localityRequired: 'localityRequired',\n /**\n * An area id the tree does not have, or not where the pick puts it (a\n * district outside the chosen state, a locality outside the district):\n * \"choose it again\" (0.19.0).\n */\n areaNotListed: 'areaNotListed',\n} as const;\nexport type ValidationMessageKey = (typeof VALIDATION_MESSAGE)[keyof typeof VALIDATION_MESSAGE];\n\n/**\n * Which part of the request an issue is about.\n *\n * ONE PATH CONVENTION: `path` is ALWAYS relative to this part, so a body field\n * reads `['venture', 'name']` with `location: 'body'`, never\n * `['body', 'venture', 'name']`. A form maps body issues straight onto its\n * fields without stripping a prefix, and a client that sees `query` or\n * `params` knows the problem is the URL, not anything the member typed.\n */\nexport const REQUEST_PART_VALUES = ['body', 'query', 'params'] as const;\nexport const requestPartSchema = z.enum(REQUEST_PART_VALUES);\nexport type RequestPart = z.infer<typeof requestPartSchema>;\n\n/**\n * One problem with one field, as it crosses the wire.\n *\n * `code` is Zod's issue code (`too_small`, `too_big`, `invalid_type`,\n * `invalid_format`, `custom`...). `message` is either one of\n * `VALIDATION_MESSAGE` or, for a plain bound, Zod's own English text, which the\n * client ignores in favour of `code` plus `minimum` / `maximum`.\n */\nexport const validationIssueSchema = z.object({\n /** Set by the server on every issue it sends; absent on a client's own parse. */\n location: requestPartSchema.optional(),\n /**\n * Where the problem is, RELATIVE TO `location`: `['venture', 'name']`,\n * `['options', 2, 'label']`, `['contentId']`.\n */\n path: z.array(z.union([z.string(), z.number()])),\n code: z.string(),\n message: z.string(),\n /** `too_small`: the bound that was missed. */\n minimum: z.number().optional(),\n /** `too_big`: the bound that was passed. */\n maximum: z.number().optional(),\n /** What was measured: `string`, `array`, `number`... */\n origin: z.string().optional(),\n /** `invalid_format`: which format, e.g. `url`, `regex`, `email`. */\n format: z.string().optional(),\n});\nexport type ValidationIssue = z.infer<typeof validationIssueSchema>;\n\n/** The loosest shape this needs from a Zod issue, so it works across 4.x. */\ninterface ZodIssueLike {\n path: readonly PropertyKey[];\n code: string;\n message: string;\n minimum?: unknown;\n maximum?: unknown;\n origin?: unknown;\n format?: unknown;\n}\n\nconst toNumber = (v: unknown): number | undefined =>\n typeof v === 'number' ? v : typeof v === 'bigint' ? Number(v) : undefined;\n\n/**\n * A Zod error as the wire shape. Use this on the server for every 400, and on\n * the client to treat its own errors and the server's the same way.\n *\n * `location` is stamped on every issue when given; the server always gives it.\n *\n * Copies a WHITELIST of fields (see the module note). A path segment that is a\n * symbol, which JSON cannot carry, becomes its description.\n */\nexport function toValidationIssues(\n error: { issues: readonly ZodIssueLike[] },\n location?: RequestPart,\n): ValidationIssue[] {\n return error.issues.map((issue) => {\n const out: ValidationIssue = {\n ...(location ? { location } : {}),\n path: issue.path.map((p) =>\n typeof p === 'number' ? p : typeof p === 'string' ? p : String(p.description ?? ''),\n ),\n code: issue.code,\n message: issue.message,\n };\n const minimum = toNumber(issue.minimum);\n const maximum = toNumber(issue.maximum);\n if (minimum !== undefined) out.minimum = minimum;\n if (maximum !== undefined) out.maximum = maximum;\n if (typeof issue.origin === 'string') out.origin = issue.origin;\n if (typeof issue.format === 'string') out.format = issue.format;\n return out;\n });\n}\n"]}
|
|
@@ -37,12 +37,7 @@ import { z } from 'zod';
|
|
|
37
37
|
export { type BillingDetails, billingDetailsSchema, GST_RATE_PERCENT, GST_STATE_CODE_VALUES, GST_STATES, type GstStateCode, gstinChecksumValid, gstinSchema, gstStateCodeSchema, gstStateName, } from './gst.js';
|
|
38
38
|
/** ⚠ Stored on every order: append only. */
|
|
39
39
|
export declare const PURCHASE_KIND_VALUES: readonly ["membership", "plan", "upgrade"];
|
|
40
|
-
export
|
|
41
|
-
membership: "membership";
|
|
42
|
-
plan: "plan";
|
|
43
|
-
upgrade: "upgrade";
|
|
44
|
-
}>;
|
|
45
|
-
export type PurchaseKind = z.infer<typeof purchaseKindSchema>;
|
|
40
|
+
export type PurchaseKind = (typeof PURCHASE_KIND_VALUES)[number];
|
|
46
41
|
/**
|
|
47
42
|
* The thing asked for.
|
|
48
43
|
*
|
|
@@ -150,6 +145,44 @@ export declare const planEffectSchema: z.ZodObject<{
|
|
|
150
145
|
upgradedDays: z.ZodNullable<z.ZodNumber>;
|
|
151
146
|
}, z.core.$strip>;
|
|
152
147
|
export type PlanEffect = z.infer<typeof planEffectSchema>;
|
|
148
|
+
/** A coupon as a purchase carries it: its code and staff's name for it. */
|
|
149
|
+
export declare const appliedCouponSchema: z.ZodObject<{
|
|
150
|
+
code: z.ZodString;
|
|
151
|
+
label: z.ZodString;
|
|
152
|
+
}, z.core.$strip>;
|
|
153
|
+
export type AppliedCoupon = z.infer<typeof appliedCouponSchema>;
|
|
154
|
+
/**
|
|
155
|
+
* Why a captured payment was NOT applied (`grantFailed`), and so refunded
|
|
156
|
+
* (0.18.0: the one list; the backend wrote two of these as loose strings and
|
|
157
|
+
* the contract said `string`). Stored on the order: append only.
|
|
158
|
+
*
|
|
159
|
+
* AMOUNT_MISMATCH the gateway captured another amount than the price
|
|
160
|
+
* ACCOUNT_DELETED paid after the account was deleted
|
|
161
|
+
* COUPON_ALREADY_USED the code went to another of their orders, paid first
|
|
162
|
+
* MEMBERSHIP_REQUIRED a plan, but the membership is gone (refunded, withdrawn)
|
|
163
|
+
* ALREADY_MEMBER a membership, but they are a member already
|
|
164
|
+
* PLAN_CHANGED an upgrade priced on a plan that has since changed
|
|
165
|
+
* PLAN_NOTHING_TO_UPGRADE an upgrade with no Premium time left
|
|
166
|
+
* PLAN_TERM_LIMIT past `PLAN_AHEAD_MAX_YEARS` of plan time
|
|
167
|
+
* PLAN_UPGRADE_INSTEAD Business bought while on Premium (that is an upgrade)
|
|
168
|
+
* GRANT_REFUSED any other refusal of the grant: still recorded and
|
|
169
|
+
* refunded, never left captured for nothing (the
|
|
170
|
+
* server logs which one, to add it here)
|
|
171
|
+
*/
|
|
172
|
+
export declare const GRANT_FAILURE_VALUES: readonly ["AMOUNT_MISMATCH", "ACCOUNT_DELETED", "COUPON_ALREADY_USED", "MEMBERSHIP_REQUIRED", "ALREADY_MEMBER", "PLAN_CHANGED", "PLAN_NOTHING_TO_UPGRADE", "PLAN_TERM_LIMIT", "PLAN_UPGRADE_INSTEAD", "GRANT_REFUSED"];
|
|
173
|
+
export declare const grantFailureSchema: z.ZodEnum<{
|
|
174
|
+
MEMBERSHIP_REQUIRED: "MEMBERSHIP_REQUIRED";
|
|
175
|
+
ALREADY_MEMBER: "ALREADY_MEMBER";
|
|
176
|
+
COUPON_ALREADY_USED: "COUPON_ALREADY_USED";
|
|
177
|
+
PLAN_UPGRADE_INSTEAD: "PLAN_UPGRADE_INSTEAD";
|
|
178
|
+
PLAN_NOTHING_TO_UPGRADE: "PLAN_NOTHING_TO_UPGRADE";
|
|
179
|
+
PLAN_TERM_LIMIT: "PLAN_TERM_LIMIT";
|
|
180
|
+
PLAN_CHANGED: "PLAN_CHANGED";
|
|
181
|
+
AMOUNT_MISMATCH: "AMOUNT_MISMATCH";
|
|
182
|
+
ACCOUNT_DELETED: "ACCOUNT_DELETED";
|
|
183
|
+
GRANT_REFUSED: "GRANT_REFUSED";
|
|
184
|
+
}>;
|
|
185
|
+
export type GrantFailure = z.infer<typeof grantFailureSchema>;
|
|
153
186
|
export declare const quoteSchema: z.ZodObject<{
|
|
154
187
|
item: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
155
188
|
kind: z.ZodLiteral<"membership">;
|
|
@@ -398,6 +431,13 @@ export declare const invoicePartySchema: z.ZodObject<{
|
|
|
398
431
|
stateName: z.ZodString;
|
|
399
432
|
}, z.core.$strip>;
|
|
400
433
|
export type InvoiceParty = z.infer<typeof invoicePartySchema>;
|
|
434
|
+
/** B2B with the buyer's GSTIN, B2C without (0.18.0: the values, for the backend's model). */
|
|
435
|
+
export declare const INVOICE_KIND_VALUES: readonly ["b2b", "b2c"];
|
|
436
|
+
export declare const invoiceKindSchema: z.ZodEnum<{
|
|
437
|
+
b2b: "b2b";
|
|
438
|
+
b2c: "b2c";
|
|
439
|
+
}>;
|
|
440
|
+
export type InvoiceKind = z.infer<typeof invoiceKindSchema>;
|
|
401
441
|
/** A tax invoice, frozen when the payment was captured. */
|
|
402
442
|
export declare const invoiceSchema: z.ZodObject<{
|
|
403
443
|
number: z.ZodString;
|
|
@@ -765,7 +805,7 @@ export declare const payerSchema: z.ZodObject<{
|
|
|
765
805
|
export type Payer = z.infer<typeof payerSchema>;
|
|
766
806
|
export declare const staffPaymentsQuerySchema: z.ZodObject<{
|
|
767
807
|
limit: z.ZodPreprocess<z.ZodDefault<z.ZodCoercedNumber<unknown>>, unknown>;
|
|
768
|
-
cursor: z.ZodOptional<z.ZodString>;
|
|
808
|
+
cursor: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
|
|
769
809
|
status: z.ZodOptional<z.ZodEnum<{
|
|
770
810
|
paid: "paid";
|
|
771
811
|
created: "created";
|
|
@@ -1032,7 +1072,18 @@ export declare const staffPaymentDetailSchema: z.ZodObject<{
|
|
|
1032
1072
|
refundId: z.ZodNullable<z.ZodString>;
|
|
1033
1073
|
}, z.core.$strip>;
|
|
1034
1074
|
refundReason: z.ZodNullable<z.ZodString>;
|
|
1035
|
-
grantFailed: z.ZodNullable<z.
|
|
1075
|
+
grantFailed: z.ZodNullable<z.ZodEnum<{
|
|
1076
|
+
MEMBERSHIP_REQUIRED: "MEMBERSHIP_REQUIRED";
|
|
1077
|
+
ALREADY_MEMBER: "ALREADY_MEMBER";
|
|
1078
|
+
COUPON_ALREADY_USED: "COUPON_ALREADY_USED";
|
|
1079
|
+
PLAN_UPGRADE_INSTEAD: "PLAN_UPGRADE_INSTEAD";
|
|
1080
|
+
PLAN_NOTHING_TO_UPGRADE: "PLAN_NOTHING_TO_UPGRADE";
|
|
1081
|
+
PLAN_TERM_LIMIT: "PLAN_TERM_LIMIT";
|
|
1082
|
+
PLAN_CHANGED: "PLAN_CHANGED";
|
|
1083
|
+
AMOUNT_MISMATCH: "AMOUNT_MISMATCH";
|
|
1084
|
+
ACCOUNT_DELETED: "ACCOUNT_DELETED";
|
|
1085
|
+
GRANT_REFUSED: "GRANT_REFUSED";
|
|
1086
|
+
}>>;
|
|
1036
1087
|
disputedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
1037
1088
|
refundedOutside: z.ZodNumber;
|
|
1038
1089
|
strayPayments: z.ZodArray<z.ZodObject<{
|
|
@@ -1080,6 +1131,8 @@ export type CouponTarget = z.infer<typeof couponTargetSchema>;
|
|
|
1080
1131
|
* stored coupons carry it.
|
|
1081
1132
|
* percent_off a share off the listed price of what it applies to
|
|
1082
1133
|
*/
|
|
1134
|
+
export declare const COUPON_KIND_VALUES: readonly ["free_membership", "percent_off"];
|
|
1135
|
+
export type CouponKind = (typeof COUPON_KIND_VALUES)[number];
|
|
1083
1136
|
export declare const couponBenefitSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1084
1137
|
kind: z.ZodLiteral<"free_membership">;
|
|
1085
1138
|
founding: z.ZodBoolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../../src/domains/billing/billing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../../src/domains/billing/billing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0BxB,OAAO,EACL,KAAK,cAAc,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACV,KAAK,YAAY,EACjB,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,YAAY,GACb,MAAM,UAAU,CAAC;AAIlB,4CAA4C;AAC5C,eAAO,MAAM,oBAAoB,4CAA6C,CAAC;AAC/E,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;2BA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