@m5kdev/commons 0.38.10 → 0.38.11
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/src/modules/billing/billing.schema.cjs +35 -11
- package/dist/src/modules/billing/billing.schema.cjs.map +1 -1
- package/dist/src/modules/billing/billing.schema.d.cts +74 -11
- package/dist/src/modules/billing/billing.schema.d.mts +74 -11
- package/dist/src/modules/billing/billing.schema.mjs +31 -10
- package/dist/src/modules/billing/billing.schema.mjs.map +1 -1
- package/dist/src/modules/billing/billing.types.d.cts +3 -1
- package/dist/src/modules/billing/billing.types.d.mts +3 -1
- package/dist/src/modules/billing/billing.utils.cjs +4 -1
- package/dist/src/modules/billing/billing.utils.cjs.map +1 -1
- package/dist/src/modules/billing/billing.utils.mjs +4 -1
- package/dist/src/modules/billing/billing.utils.mjs.map +1 -1
- package/dist/src/modules/notification/notification.schema.d.cts +3 -3
- package/dist/src/modules/notification/notification.schema.d.mts +3 -3
- package/dist/src/modules/recurrence/recurrence.schema.d.cts +2 -2
- package/dist/src/modules/recurrence/recurrence.schema.d.mts +2 -2
- package/dist/src/modules/workflow/workflow.schema.d.cts +4 -4
- package/dist/src/modules/workflow/workflow.schema.d.mts +4 -4
- package/package.json +2 -2
|
@@ -25,17 +25,35 @@ const billingSchema = zod.z.object({
|
|
|
25
25
|
unitAmount: zod.z.number().nullish(),
|
|
26
26
|
discounts: zod.z.array(zod.z.string()).nullish()
|
|
27
27
|
});
|
|
28
|
-
const
|
|
29
|
-
zod.z.
|
|
30
|
-
zod.z.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
const billingCouponSchema = zod.z.object({
|
|
29
|
+
id: zod.z.string(),
|
|
30
|
+
name: zod.z.string().nullable(),
|
|
31
|
+
percentOff: zod.z.number().nullable(),
|
|
32
|
+
amountOff: zod.z.number().nullable(),
|
|
33
|
+
currency: zod.z.string().nullable(),
|
|
34
|
+
duration: zod.z.enum([
|
|
35
|
+
"forever",
|
|
36
|
+
"once",
|
|
37
|
+
"repeating"
|
|
38
|
+
]).nullable(),
|
|
39
|
+
durationInMonths: zod.z.number().nullable(),
|
|
40
|
+
valid: zod.z.boolean()
|
|
41
|
+
});
|
|
42
|
+
const billingCouponListOutputSchema = zod.z.array(billingCouponSchema);
|
|
43
|
+
const organizationIdInputSchema = zod.z.object({ organizationId: zod.z.string() });
|
|
44
|
+
const createAdminSubscriptionInputSchema = zod.z.object({
|
|
34
45
|
organizationId: zod.z.string(),
|
|
35
46
|
priceId: zod.z.string(),
|
|
36
|
-
|
|
47
|
+
couponId: zod.z.string().optional()
|
|
48
|
+
});
|
|
49
|
+
const applyAdminCouponInputSchema = zod.z.object({
|
|
50
|
+
organizationId: zod.z.string(),
|
|
51
|
+
couponId: zod.z.string()
|
|
52
|
+
});
|
|
53
|
+
const setOrganizationCurrencyInputSchema = zod.z.object({
|
|
54
|
+
organizationId: zod.z.string(),
|
|
55
|
+
currency: zod.z.string()
|
|
37
56
|
});
|
|
38
|
-
const organizationIdInputSchema = zod.z.object({ organizationId: zod.z.string() });
|
|
39
57
|
const cancelAdminSubscriptionInputSchema = zod.z.object({
|
|
40
58
|
organizationId: zod.z.string(),
|
|
41
59
|
when: zod.z.enum(["immediate", "period_end"])
|
|
@@ -45,18 +63,24 @@ const adminOrganizationBillingRowSchema = zod.z.object({
|
|
|
45
63
|
organizationId: zod.z.string(),
|
|
46
64
|
organizationName: zod.z.string(),
|
|
47
65
|
currency: zod.z.string().nullable(),
|
|
48
|
-
|
|
66
|
+
stripeCustomerId: zod.z.string().nullable(),
|
|
67
|
+
openSubscription: zod.z.boolean(),
|
|
68
|
+
subscription: billingSchema.nullable(),
|
|
69
|
+
coupon: billingCouponSchema.nullable()
|
|
49
70
|
});
|
|
50
71
|
const billingAdminListInputSchema = require_src_modules_schemas_query_schema.querySchema;
|
|
51
72
|
const billingAdminListOutputSchema = require_src_modules_schemas_query_schema.queryListOutput(adminOrganizationBillingRowSchema);
|
|
52
73
|
//#endregion
|
|
53
74
|
exports.adminOrganizationBillingRowSchema = adminOrganizationBillingRowSchema;
|
|
75
|
+
exports.applyAdminCouponInputSchema = applyAdminCouponInputSchema;
|
|
54
76
|
exports.billingAdminListInputSchema = billingAdminListInputSchema;
|
|
55
77
|
exports.billingAdminListOutputSchema = billingAdminListOutputSchema;
|
|
78
|
+
exports.billingCouponListOutputSchema = billingCouponListOutputSchema;
|
|
79
|
+
exports.billingCouponSchema = billingCouponSchema;
|
|
56
80
|
exports.billingSchema = billingSchema;
|
|
57
81
|
exports.cancelAdminSubscriptionInputSchema = cancelAdminSubscriptionInputSchema;
|
|
58
|
-
exports.
|
|
59
|
-
exports.enrollComplimentaryInputSchema = enrollComplimentaryInputSchema;
|
|
82
|
+
exports.createAdminSubscriptionInputSchema = createAdminSubscriptionInputSchema;
|
|
60
83
|
exports.organizationIdInputSchema = organizationIdInputSchema;
|
|
84
|
+
exports.setOrganizationCurrencyInputSchema = setOrganizationCurrencyInputSchema;
|
|
61
85
|
|
|
62
86
|
//# sourceMappingURL=billing.schema.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.schema.cjs","names":["z","querySchema","queryListOutput"],"sources":["../../../../src/modules/billing/billing.schema.ts"],"sourcesContent":["import { z } from \"zod\";\r\nimport { queryListOutput, querySchema } from \"../schemas/query.schema\";\r\n\r\nexport const billingSchema = z.object({\r\n id: z.string(),\r\n plan: z.string(),\r\n referenceId: z.string(),\r\n stripeCustomerId: z.string().nullish(),\r\n stripeSubscriptionId: z.string().nullish(),\r\n status: z.string(),\r\n periodStart: z.date().nullish(),\r\n periodEnd: z.date().nullish(),\r\n cancelAtPeriodEnd: z.boolean().nullish(),\r\n cancelAt: z.date().nullish(),\r\n canceledAt: z.date().nullish(),\r\n seats: z.number().nullish(),\r\n memberId: z.string().nullish(),\r\n trialStart: z.date().nullish(),\r\n trialEnd: z.date().nullish(),\r\n priceId: z.string().nullish(),\r\n interval: z.string().nullish(),\r\n intervalCount: z.number().nullish(),\r\n intervalPicked: z.boolean().nullish(),\r\n unitAmount: z.number().nullish(),\r\n discounts: z.array(z.string()).nullish(),\r\n});\r\n\r\nexport type BillingSchema = z.infer<typeof billingSchema>;\r\n\r\nexport const
|
|
1
|
+
{"version":3,"file":"billing.schema.cjs","names":["z","querySchema","queryListOutput"],"sources":["../../../../src/modules/billing/billing.schema.ts"],"sourcesContent":["import { z } from \"zod\";\r\nimport { queryListOutput, querySchema } from \"../schemas/query.schema\";\r\n\r\nexport const billingSchema = z.object({\r\n id: z.string(),\r\n plan: z.string(),\r\n referenceId: z.string(),\r\n stripeCustomerId: z.string().nullish(),\r\n stripeSubscriptionId: z.string().nullish(),\r\n status: z.string(),\r\n periodStart: z.date().nullish(),\r\n periodEnd: z.date().nullish(),\r\n cancelAtPeriodEnd: z.boolean().nullish(),\r\n cancelAt: z.date().nullish(),\r\n canceledAt: z.date().nullish(),\r\n seats: z.number().nullish(),\r\n memberId: z.string().nullish(),\r\n trialStart: z.date().nullish(),\r\n trialEnd: z.date().nullish(),\r\n priceId: z.string().nullish(),\r\n interval: z.string().nullish(),\r\n intervalCount: z.number().nullish(),\r\n intervalPicked: z.boolean().nullish(),\r\n unitAmount: z.number().nullish(),\r\n discounts: z.array(z.string()).nullish(),\r\n});\r\n\r\nexport type BillingSchema = z.infer<typeof billingSchema>;\r\n\r\nexport const billingCouponSchema = z.object({\r\n id: z.string(),\r\n name: z.string().nullable(),\r\n percentOff: z.number().nullable(),\r\n amountOff: z.number().nullable(),\r\n currency: z.string().nullable(),\r\n duration: z.enum([\"forever\", \"once\", \"repeating\"]).nullable(),\r\n durationInMonths: z.number().nullable(),\r\n valid: z.boolean(),\r\n});\r\n\r\nexport const billingCouponListOutputSchema = z.array(billingCouponSchema);\r\n\r\nexport const organizationIdInputSchema = z.object({\r\n organizationId: z.string(),\r\n});\r\n\r\nexport const createAdminSubscriptionInputSchema = z.object({\r\n organizationId: z.string(),\r\n priceId: z.string(),\r\n couponId: z.string().optional(),\r\n});\r\n\r\nexport const applyAdminCouponInputSchema = z.object({\r\n organizationId: z.string(),\r\n couponId: z.string(),\r\n});\r\n\r\nexport const setOrganizationCurrencyInputSchema = z.object({\r\n organizationId: z.string(),\r\n currency: z.string(),\r\n});\r\n\r\nexport const cancelAdminSubscriptionInputSchema = z.object({\r\n organizationId: z.string(),\r\n when: z.enum([\"immediate\", \"period_end\"]),\r\n});\r\n\r\nexport const adminOrganizationBillingRowSchema = z.object({\r\n id: z.string(),\r\n organizationId: z.string(),\r\n organizationName: z.string(),\r\n currency: z.string().nullable(),\r\n stripeCustomerId: z.string().nullable(),\r\n openSubscription: z.boolean(),\r\n subscription: billingSchema.nullable(),\r\n coupon: billingCouponSchema.nullable(),\r\n});\r\n\r\nexport const billingAdminListInputSchema = querySchema;\r\nexport const billingAdminListOutputSchema = queryListOutput(adminOrganizationBillingRowSchema);\r\n\r\nexport type BillingCoupon = z.infer<typeof billingCouponSchema>;\r\nexport type CreateAdminSubscriptionInput = z.infer<typeof createAdminSubscriptionInputSchema>;\r\nexport type AdminOrganizationBillingRow = z.infer<typeof adminOrganizationBillingRowSchema>;\r\n"],"mappings":";;;;AAGA,MAAa,gBAAgBA,IAAAA,EAAE,OAAO;CACpC,IAAIA,IAAAA,EAAE,QAAQ;CACd,MAAMA,IAAAA,EAAE,QAAQ;CAChB,aAAaA,IAAAA,EAAE,QAAQ;CACvB,kBAAkBA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CACtC,sBAAsBA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CAC1C,QAAQA,IAAAA,EAAE,QAAQ;CAClB,aAAaA,IAAAA,EAAE,MAAM,CAAC,SAAS;CAC/B,WAAWA,IAAAA,EAAE,MAAM,CAAC,SAAS;CAC7B,mBAAmBA,IAAAA,EAAE,SAAS,CAAC,SAAS;CACxC,UAAUA,IAAAA,EAAE,MAAM,CAAC,SAAS;CAC5B,YAAYA,IAAAA,EAAE,MAAM,CAAC,SAAS;CAC9B,OAAOA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CAC3B,UAAUA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CAC9B,YAAYA,IAAAA,EAAE,MAAM,CAAC,SAAS;CAC9B,UAAUA,IAAAA,EAAE,MAAM,CAAC,SAAS;CAC5B,SAASA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CAC7B,UAAUA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CAC9B,eAAeA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CACnC,gBAAgBA,IAAAA,EAAE,SAAS,CAAC,SAAS;CACrC,YAAYA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CAChC,WAAWA,IAAAA,EAAE,MAAMA,IAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS;CACzC,CAAC;AAIF,MAAa,sBAAsBA,IAAAA,EAAE,OAAO;CAC1C,IAAIA,IAAAA,EAAE,QAAQ;CACd,MAAMA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAC3B,YAAYA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CACjC,WAAWA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAChC,UAAUA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAC/B,UAAUA,IAAAA,EAAE,KAAK;EAAC;EAAW;EAAQ;EAAY,CAAC,CAAC,UAAU;CAC7D,kBAAkBA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CACvC,OAAOA,IAAAA,EAAE,SAAS;CACnB,CAAC;AAEF,MAAa,gCAAgCA,IAAAA,EAAE,MAAM,oBAAoB;AAEzE,MAAa,4BAA4BA,IAAAA,EAAE,OAAO,EAChD,gBAAgBA,IAAAA,EAAE,QAAQ,EAC3B,CAAC;AAEF,MAAa,qCAAqCA,IAAAA,EAAE,OAAO;CACzD,gBAAgBA,IAAAA,EAAE,QAAQ;CAC1B,SAASA,IAAAA,EAAE,QAAQ;CACnB,UAAUA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAChC,CAAC;AAEF,MAAa,8BAA8BA,IAAAA,EAAE,OAAO;CAClD,gBAAgBA,IAAAA,EAAE,QAAQ;CAC1B,UAAUA,IAAAA,EAAE,QAAQ;CACrB,CAAC;AAEF,MAAa,qCAAqCA,IAAAA,EAAE,OAAO;CACzD,gBAAgBA,IAAAA,EAAE,QAAQ;CAC1B,UAAUA,IAAAA,EAAE,QAAQ;CACrB,CAAC;AAEF,MAAa,qCAAqCA,IAAAA,EAAE,OAAO;CACzD,gBAAgBA,IAAAA,EAAE,QAAQ;CAC1B,MAAMA,IAAAA,EAAE,KAAK,CAAC,aAAa,aAAa,CAAC;CAC1C,CAAC;AAEF,MAAa,oCAAoCA,IAAAA,EAAE,OAAO;CACxD,IAAIA,IAAAA,EAAE,QAAQ;CACd,gBAAgBA,IAAAA,EAAE,QAAQ;CAC1B,kBAAkBA,IAAAA,EAAE,QAAQ;CAC5B,UAAUA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAC/B,kBAAkBA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CACvC,kBAAkBA,IAAAA,EAAE,SAAS;CAC7B,cAAc,cAAc,UAAU;CACtC,QAAQ,oBAAoB,UAAU;CACvC,CAAC;AAEF,MAAa,8BAA8BC,yCAAAA;AAC3C,MAAa,+BAA+BC,yCAAAA,gBAAgB,kCAAkC"}
|
|
@@ -25,18 +25,49 @@ declare const billingSchema: z.ZodObject<{
|
|
|
25
25
|
discounts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
26
26
|
}, z.core.$strip>;
|
|
27
27
|
type BillingSchema = z.infer<typeof billingSchema>;
|
|
28
|
-
declare const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
declare const billingCouponSchema: z.ZodObject<{
|
|
29
|
+
id: z.ZodString;
|
|
30
|
+
name: z.ZodNullable<z.ZodString>;
|
|
31
|
+
percentOff: z.ZodNullable<z.ZodNumber>;
|
|
32
|
+
amountOff: z.ZodNullable<z.ZodNumber>;
|
|
33
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
34
|
+
duration: z.ZodNullable<z.ZodEnum<{
|
|
35
|
+
forever: "forever";
|
|
36
|
+
once: "once";
|
|
37
|
+
repeating: "repeating";
|
|
38
|
+
}>>;
|
|
39
|
+
durationInMonths: z.ZodNullable<z.ZodNumber>;
|
|
40
|
+
valid: z.ZodBoolean;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
declare const billingCouponListOutputSchema: z.ZodArray<z.ZodObject<{
|
|
43
|
+
id: z.ZodString;
|
|
44
|
+
name: z.ZodNullable<z.ZodString>;
|
|
45
|
+
percentOff: z.ZodNullable<z.ZodNumber>;
|
|
46
|
+
amountOff: z.ZodNullable<z.ZodNumber>;
|
|
47
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
48
|
+
duration: z.ZodNullable<z.ZodEnum<{
|
|
49
|
+
forever: "forever";
|
|
50
|
+
once: "once";
|
|
51
|
+
repeating: "repeating";
|
|
52
|
+
}>>;
|
|
53
|
+
durationInMonths: z.ZodNullable<z.ZodNumber>;
|
|
54
|
+
valid: z.ZodBoolean;
|
|
55
|
+
}, z.core.$strip>>;
|
|
56
|
+
declare const organizationIdInputSchema: z.ZodObject<{
|
|
57
|
+
organizationId: z.ZodString;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
declare const createAdminSubscriptionInputSchema: z.ZodObject<{
|
|
32
60
|
organizationId: z.ZodString;
|
|
33
61
|
priceId: z.ZodString;
|
|
34
|
-
|
|
35
|
-
months: z.ZodNumber;
|
|
36
|
-
}, z.core.$strip>]>;
|
|
62
|
+
couponId: z.ZodOptional<z.ZodString>;
|
|
37
63
|
}, z.core.$strip>;
|
|
38
|
-
declare const
|
|
64
|
+
declare const applyAdminCouponInputSchema: z.ZodObject<{
|
|
39
65
|
organizationId: z.ZodString;
|
|
66
|
+
couponId: z.ZodString;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
declare const setOrganizationCurrencyInputSchema: z.ZodObject<{
|
|
69
|
+
organizationId: z.ZodString;
|
|
70
|
+
currency: z.ZodString;
|
|
40
71
|
}, z.core.$strip>;
|
|
41
72
|
declare const cancelAdminSubscriptionInputSchema: z.ZodObject<{
|
|
42
73
|
organizationId: z.ZodString;
|
|
@@ -50,6 +81,8 @@ declare const adminOrganizationBillingRowSchema: z.ZodObject<{
|
|
|
50
81
|
organizationId: z.ZodString;
|
|
51
82
|
organizationName: z.ZodString;
|
|
52
83
|
currency: z.ZodNullable<z.ZodString>;
|
|
84
|
+
stripeCustomerId: z.ZodNullable<z.ZodString>;
|
|
85
|
+
openSubscription: z.ZodBoolean;
|
|
53
86
|
subscription: z.ZodNullable<z.ZodObject<{
|
|
54
87
|
id: z.ZodString;
|
|
55
88
|
plan: z.ZodString;
|
|
@@ -73,6 +106,20 @@ declare const adminOrganizationBillingRowSchema: z.ZodObject<{
|
|
|
73
106
|
unitAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
74
107
|
discounts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
75
108
|
}, z.core.$strip>>;
|
|
109
|
+
coupon: z.ZodNullable<z.ZodObject<{
|
|
110
|
+
id: z.ZodString;
|
|
111
|
+
name: z.ZodNullable<z.ZodString>;
|
|
112
|
+
percentOff: z.ZodNullable<z.ZodNumber>;
|
|
113
|
+
amountOff: z.ZodNullable<z.ZodNumber>;
|
|
114
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
115
|
+
duration: z.ZodNullable<z.ZodEnum<{
|
|
116
|
+
forever: "forever";
|
|
117
|
+
once: "once";
|
|
118
|
+
repeating: "repeating";
|
|
119
|
+
}>>;
|
|
120
|
+
durationInMonths: z.ZodNullable<z.ZodNumber>;
|
|
121
|
+
valid: z.ZodBoolean;
|
|
122
|
+
}, z.core.$strip>>;
|
|
76
123
|
}, z.core.$strip>;
|
|
77
124
|
declare const billingAdminListInputSchema: z.ZodObject<{
|
|
78
125
|
page: z.ZodOptional<z.ZodNumber>;
|
|
@@ -122,6 +169,8 @@ declare const billingAdminListOutputSchema: z.ZodObject<{
|
|
|
122
169
|
organizationId: z.ZodString;
|
|
123
170
|
organizationName: z.ZodString;
|
|
124
171
|
currency: z.ZodNullable<z.ZodString>;
|
|
172
|
+
stripeCustomerId: z.ZodNullable<z.ZodString>;
|
|
173
|
+
openSubscription: z.ZodBoolean;
|
|
125
174
|
subscription: z.ZodNullable<z.ZodObject<{
|
|
126
175
|
id: z.ZodString;
|
|
127
176
|
plan: z.ZodString;
|
|
@@ -145,12 +194,26 @@ declare const billingAdminListOutputSchema: z.ZodObject<{
|
|
|
145
194
|
unitAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
146
195
|
discounts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
147
196
|
}, z.core.$strip>>;
|
|
197
|
+
coupon: z.ZodNullable<z.ZodObject<{
|
|
198
|
+
id: z.ZodString;
|
|
199
|
+
name: z.ZodNullable<z.ZodString>;
|
|
200
|
+
percentOff: z.ZodNullable<z.ZodNumber>;
|
|
201
|
+
amountOff: z.ZodNullable<z.ZodNumber>;
|
|
202
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
203
|
+
duration: z.ZodNullable<z.ZodEnum<{
|
|
204
|
+
forever: "forever";
|
|
205
|
+
once: "once";
|
|
206
|
+
repeating: "repeating";
|
|
207
|
+
}>>;
|
|
208
|
+
durationInMonths: z.ZodNullable<z.ZodNumber>;
|
|
209
|
+
valid: z.ZodBoolean;
|
|
210
|
+
}, z.core.$strip>>;
|
|
148
211
|
}, z.core.$strip>>;
|
|
149
212
|
total: z.ZodNumber;
|
|
150
213
|
}, z.core.$strip>;
|
|
151
|
-
type
|
|
152
|
-
type
|
|
214
|
+
type BillingCoupon = z.infer<typeof billingCouponSchema>;
|
|
215
|
+
type CreateAdminSubscriptionInput = z.infer<typeof createAdminSubscriptionInputSchema>;
|
|
153
216
|
type AdminOrganizationBillingRow = z.infer<typeof adminOrganizationBillingRowSchema>;
|
|
154
217
|
//#endregion
|
|
155
|
-
export { AdminOrganizationBillingRow,
|
|
218
|
+
export { AdminOrganizationBillingRow, BillingCoupon, BillingSchema, CreateAdminSubscriptionInput, adminOrganizationBillingRowSchema, applyAdminCouponInputSchema, billingAdminListInputSchema, billingAdminListOutputSchema, billingCouponListOutputSchema, billingCouponSchema, billingSchema, cancelAdminSubscriptionInputSchema, createAdminSubscriptionInputSchema, organizationIdInputSchema, setOrganizationCurrencyInputSchema };
|
|
156
219
|
//# sourceMappingURL=billing.schema.d.cts.map
|
|
@@ -25,18 +25,49 @@ declare const billingSchema: z.ZodObject<{
|
|
|
25
25
|
discounts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
26
26
|
}, z.core.$strip>;
|
|
27
27
|
type BillingSchema = z.infer<typeof billingSchema>;
|
|
28
|
-
declare const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
declare const billingCouponSchema: z.ZodObject<{
|
|
29
|
+
id: z.ZodString;
|
|
30
|
+
name: z.ZodNullable<z.ZodString>;
|
|
31
|
+
percentOff: z.ZodNullable<z.ZodNumber>;
|
|
32
|
+
amountOff: z.ZodNullable<z.ZodNumber>;
|
|
33
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
34
|
+
duration: z.ZodNullable<z.ZodEnum<{
|
|
35
|
+
forever: "forever";
|
|
36
|
+
once: "once";
|
|
37
|
+
repeating: "repeating";
|
|
38
|
+
}>>;
|
|
39
|
+
durationInMonths: z.ZodNullable<z.ZodNumber>;
|
|
40
|
+
valid: z.ZodBoolean;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
declare const billingCouponListOutputSchema: z.ZodArray<z.ZodObject<{
|
|
43
|
+
id: z.ZodString;
|
|
44
|
+
name: z.ZodNullable<z.ZodString>;
|
|
45
|
+
percentOff: z.ZodNullable<z.ZodNumber>;
|
|
46
|
+
amountOff: z.ZodNullable<z.ZodNumber>;
|
|
47
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
48
|
+
duration: z.ZodNullable<z.ZodEnum<{
|
|
49
|
+
forever: "forever";
|
|
50
|
+
once: "once";
|
|
51
|
+
repeating: "repeating";
|
|
52
|
+
}>>;
|
|
53
|
+
durationInMonths: z.ZodNullable<z.ZodNumber>;
|
|
54
|
+
valid: z.ZodBoolean;
|
|
55
|
+
}, z.core.$strip>>;
|
|
56
|
+
declare const organizationIdInputSchema: z.ZodObject<{
|
|
57
|
+
organizationId: z.ZodString;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
declare const createAdminSubscriptionInputSchema: z.ZodObject<{
|
|
32
60
|
organizationId: z.ZodString;
|
|
33
61
|
priceId: z.ZodString;
|
|
34
|
-
|
|
35
|
-
months: z.ZodNumber;
|
|
36
|
-
}, z.core.$strip>]>;
|
|
62
|
+
couponId: z.ZodOptional<z.ZodString>;
|
|
37
63
|
}, z.core.$strip>;
|
|
38
|
-
declare const
|
|
64
|
+
declare const applyAdminCouponInputSchema: z.ZodObject<{
|
|
39
65
|
organizationId: z.ZodString;
|
|
66
|
+
couponId: z.ZodString;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
declare const setOrganizationCurrencyInputSchema: z.ZodObject<{
|
|
69
|
+
organizationId: z.ZodString;
|
|
70
|
+
currency: z.ZodString;
|
|
40
71
|
}, z.core.$strip>;
|
|
41
72
|
declare const cancelAdminSubscriptionInputSchema: z.ZodObject<{
|
|
42
73
|
organizationId: z.ZodString;
|
|
@@ -50,6 +81,8 @@ declare const adminOrganizationBillingRowSchema: z.ZodObject<{
|
|
|
50
81
|
organizationId: z.ZodString;
|
|
51
82
|
organizationName: z.ZodString;
|
|
52
83
|
currency: z.ZodNullable<z.ZodString>;
|
|
84
|
+
stripeCustomerId: z.ZodNullable<z.ZodString>;
|
|
85
|
+
openSubscription: z.ZodBoolean;
|
|
53
86
|
subscription: z.ZodNullable<z.ZodObject<{
|
|
54
87
|
id: z.ZodString;
|
|
55
88
|
plan: z.ZodString;
|
|
@@ -73,6 +106,20 @@ declare const adminOrganizationBillingRowSchema: z.ZodObject<{
|
|
|
73
106
|
unitAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
74
107
|
discounts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
75
108
|
}, z.core.$strip>>;
|
|
109
|
+
coupon: z.ZodNullable<z.ZodObject<{
|
|
110
|
+
id: z.ZodString;
|
|
111
|
+
name: z.ZodNullable<z.ZodString>;
|
|
112
|
+
percentOff: z.ZodNullable<z.ZodNumber>;
|
|
113
|
+
amountOff: z.ZodNullable<z.ZodNumber>;
|
|
114
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
115
|
+
duration: z.ZodNullable<z.ZodEnum<{
|
|
116
|
+
forever: "forever";
|
|
117
|
+
once: "once";
|
|
118
|
+
repeating: "repeating";
|
|
119
|
+
}>>;
|
|
120
|
+
durationInMonths: z.ZodNullable<z.ZodNumber>;
|
|
121
|
+
valid: z.ZodBoolean;
|
|
122
|
+
}, z.core.$strip>>;
|
|
76
123
|
}, z.core.$strip>;
|
|
77
124
|
declare const billingAdminListInputSchema: z.ZodObject<{
|
|
78
125
|
page: z.ZodOptional<z.ZodNumber>;
|
|
@@ -122,6 +169,8 @@ declare const billingAdminListOutputSchema: z.ZodObject<{
|
|
|
122
169
|
organizationId: z.ZodString;
|
|
123
170
|
organizationName: z.ZodString;
|
|
124
171
|
currency: z.ZodNullable<z.ZodString>;
|
|
172
|
+
stripeCustomerId: z.ZodNullable<z.ZodString>;
|
|
173
|
+
openSubscription: z.ZodBoolean;
|
|
125
174
|
subscription: z.ZodNullable<z.ZodObject<{
|
|
126
175
|
id: z.ZodString;
|
|
127
176
|
plan: z.ZodString;
|
|
@@ -145,12 +194,26 @@ declare const billingAdminListOutputSchema: z.ZodObject<{
|
|
|
145
194
|
unitAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
146
195
|
discounts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
147
196
|
}, z.core.$strip>>;
|
|
197
|
+
coupon: z.ZodNullable<z.ZodObject<{
|
|
198
|
+
id: z.ZodString;
|
|
199
|
+
name: z.ZodNullable<z.ZodString>;
|
|
200
|
+
percentOff: z.ZodNullable<z.ZodNumber>;
|
|
201
|
+
amountOff: z.ZodNullable<z.ZodNumber>;
|
|
202
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
203
|
+
duration: z.ZodNullable<z.ZodEnum<{
|
|
204
|
+
forever: "forever";
|
|
205
|
+
once: "once";
|
|
206
|
+
repeating: "repeating";
|
|
207
|
+
}>>;
|
|
208
|
+
durationInMonths: z.ZodNullable<z.ZodNumber>;
|
|
209
|
+
valid: z.ZodBoolean;
|
|
210
|
+
}, z.core.$strip>>;
|
|
148
211
|
}, z.core.$strip>>;
|
|
149
212
|
total: z.ZodNumber;
|
|
150
213
|
}, z.core.$strip>;
|
|
151
|
-
type
|
|
152
|
-
type
|
|
214
|
+
type BillingCoupon = z.infer<typeof billingCouponSchema>;
|
|
215
|
+
type CreateAdminSubscriptionInput = z.infer<typeof createAdminSubscriptionInputSchema>;
|
|
153
216
|
type AdminOrganizationBillingRow = z.infer<typeof adminOrganizationBillingRowSchema>;
|
|
154
217
|
//#endregion
|
|
155
|
-
export { AdminOrganizationBillingRow,
|
|
218
|
+
export { AdminOrganizationBillingRow, BillingCoupon, BillingSchema, CreateAdminSubscriptionInput, adminOrganizationBillingRowSchema, applyAdminCouponInputSchema, billingAdminListInputSchema, billingAdminListOutputSchema, billingCouponListOutputSchema, billingCouponSchema, billingSchema, cancelAdminSubscriptionInputSchema, createAdminSubscriptionInputSchema, organizationIdInputSchema, setOrganizationCurrencyInputSchema };
|
|
156
219
|
//# sourceMappingURL=billing.schema.d.mts.map
|
|
@@ -24,17 +24,35 @@ const billingSchema = z.object({
|
|
|
24
24
|
unitAmount: z.number().nullish(),
|
|
25
25
|
discounts: z.array(z.string()).nullish()
|
|
26
26
|
});
|
|
27
|
-
const
|
|
28
|
-
z.
|
|
29
|
-
z.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
const billingCouponSchema = z.object({
|
|
28
|
+
id: z.string(),
|
|
29
|
+
name: z.string().nullable(),
|
|
30
|
+
percentOff: z.number().nullable(),
|
|
31
|
+
amountOff: z.number().nullable(),
|
|
32
|
+
currency: z.string().nullable(),
|
|
33
|
+
duration: z.enum([
|
|
34
|
+
"forever",
|
|
35
|
+
"once",
|
|
36
|
+
"repeating"
|
|
37
|
+
]).nullable(),
|
|
38
|
+
durationInMonths: z.number().nullable(),
|
|
39
|
+
valid: z.boolean()
|
|
40
|
+
});
|
|
41
|
+
const billingCouponListOutputSchema = z.array(billingCouponSchema);
|
|
42
|
+
const organizationIdInputSchema = z.object({ organizationId: z.string() });
|
|
43
|
+
const createAdminSubscriptionInputSchema = z.object({
|
|
33
44
|
organizationId: z.string(),
|
|
34
45
|
priceId: z.string(),
|
|
35
|
-
|
|
46
|
+
couponId: z.string().optional()
|
|
47
|
+
});
|
|
48
|
+
const applyAdminCouponInputSchema = z.object({
|
|
49
|
+
organizationId: z.string(),
|
|
50
|
+
couponId: z.string()
|
|
51
|
+
});
|
|
52
|
+
const setOrganizationCurrencyInputSchema = z.object({
|
|
53
|
+
organizationId: z.string(),
|
|
54
|
+
currency: z.string()
|
|
36
55
|
});
|
|
37
|
-
const organizationIdInputSchema = z.object({ organizationId: z.string() });
|
|
38
56
|
const cancelAdminSubscriptionInputSchema = z.object({
|
|
39
57
|
organizationId: z.string(),
|
|
40
58
|
when: z.enum(["immediate", "period_end"])
|
|
@@ -44,11 +62,14 @@ const adminOrganizationBillingRowSchema = z.object({
|
|
|
44
62
|
organizationId: z.string(),
|
|
45
63
|
organizationName: z.string(),
|
|
46
64
|
currency: z.string().nullable(),
|
|
47
|
-
|
|
65
|
+
stripeCustomerId: z.string().nullable(),
|
|
66
|
+
openSubscription: z.boolean(),
|
|
67
|
+
subscription: billingSchema.nullable(),
|
|
68
|
+
coupon: billingCouponSchema.nullable()
|
|
48
69
|
});
|
|
49
70
|
const billingAdminListInputSchema = querySchema;
|
|
50
71
|
const billingAdminListOutputSchema = queryListOutput(adminOrganizationBillingRowSchema);
|
|
51
72
|
//#endregion
|
|
52
|
-
export { adminOrganizationBillingRowSchema, billingAdminListInputSchema, billingAdminListOutputSchema, billingSchema, cancelAdminSubscriptionInputSchema,
|
|
73
|
+
export { adminOrganizationBillingRowSchema, applyAdminCouponInputSchema, billingAdminListInputSchema, billingAdminListOutputSchema, billingCouponListOutputSchema, billingCouponSchema, billingSchema, cancelAdminSubscriptionInputSchema, createAdminSubscriptionInputSchema, organizationIdInputSchema, setOrganizationCurrencyInputSchema };
|
|
53
74
|
|
|
54
75
|
//# sourceMappingURL=billing.schema.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.schema.mjs","names":[],"sources":["../../../../src/modules/billing/billing.schema.ts"],"sourcesContent":["import { z } from \"zod\";\r\nimport { queryListOutput, querySchema } from \"../schemas/query.schema\";\r\n\r\nexport const billingSchema = z.object({\r\n id: z.string(),\r\n plan: z.string(),\r\n referenceId: z.string(),\r\n stripeCustomerId: z.string().nullish(),\r\n stripeSubscriptionId: z.string().nullish(),\r\n status: z.string(),\r\n periodStart: z.date().nullish(),\r\n periodEnd: z.date().nullish(),\r\n cancelAtPeriodEnd: z.boolean().nullish(),\r\n cancelAt: z.date().nullish(),\r\n canceledAt: z.date().nullish(),\r\n seats: z.number().nullish(),\r\n memberId: z.string().nullish(),\r\n trialStart: z.date().nullish(),\r\n trialEnd: z.date().nullish(),\r\n priceId: z.string().nullish(),\r\n interval: z.string().nullish(),\r\n intervalCount: z.number().nullish(),\r\n intervalPicked: z.boolean().nullish(),\r\n unitAmount: z.number().nullish(),\r\n discounts: z.array(z.string()).nullish(),\r\n});\r\n\r\nexport type BillingSchema = z.infer<typeof billingSchema>;\r\n\r\nexport const
|
|
1
|
+
{"version":3,"file":"billing.schema.mjs","names":[],"sources":["../../../../src/modules/billing/billing.schema.ts"],"sourcesContent":["import { z } from \"zod\";\r\nimport { queryListOutput, querySchema } from \"../schemas/query.schema\";\r\n\r\nexport const billingSchema = z.object({\r\n id: z.string(),\r\n plan: z.string(),\r\n referenceId: z.string(),\r\n stripeCustomerId: z.string().nullish(),\r\n stripeSubscriptionId: z.string().nullish(),\r\n status: z.string(),\r\n periodStart: z.date().nullish(),\r\n periodEnd: z.date().nullish(),\r\n cancelAtPeriodEnd: z.boolean().nullish(),\r\n cancelAt: z.date().nullish(),\r\n canceledAt: z.date().nullish(),\r\n seats: z.number().nullish(),\r\n memberId: z.string().nullish(),\r\n trialStart: z.date().nullish(),\r\n trialEnd: z.date().nullish(),\r\n priceId: z.string().nullish(),\r\n interval: z.string().nullish(),\r\n intervalCount: z.number().nullish(),\r\n intervalPicked: z.boolean().nullish(),\r\n unitAmount: z.number().nullish(),\r\n discounts: z.array(z.string()).nullish(),\r\n});\r\n\r\nexport type BillingSchema = z.infer<typeof billingSchema>;\r\n\r\nexport const billingCouponSchema = z.object({\r\n id: z.string(),\r\n name: z.string().nullable(),\r\n percentOff: z.number().nullable(),\r\n amountOff: z.number().nullable(),\r\n currency: z.string().nullable(),\r\n duration: z.enum([\"forever\", \"once\", \"repeating\"]).nullable(),\r\n durationInMonths: z.number().nullable(),\r\n valid: z.boolean(),\r\n});\r\n\r\nexport const billingCouponListOutputSchema = z.array(billingCouponSchema);\r\n\r\nexport const organizationIdInputSchema = z.object({\r\n organizationId: z.string(),\r\n});\r\n\r\nexport const createAdminSubscriptionInputSchema = z.object({\r\n organizationId: z.string(),\r\n priceId: z.string(),\r\n couponId: z.string().optional(),\r\n});\r\n\r\nexport const applyAdminCouponInputSchema = z.object({\r\n organizationId: z.string(),\r\n couponId: z.string(),\r\n});\r\n\r\nexport const setOrganizationCurrencyInputSchema = z.object({\r\n organizationId: z.string(),\r\n currency: z.string(),\r\n});\r\n\r\nexport const cancelAdminSubscriptionInputSchema = z.object({\r\n organizationId: z.string(),\r\n when: z.enum([\"immediate\", \"period_end\"]),\r\n});\r\n\r\nexport const adminOrganizationBillingRowSchema = z.object({\r\n id: z.string(),\r\n organizationId: z.string(),\r\n organizationName: z.string(),\r\n currency: z.string().nullable(),\r\n stripeCustomerId: z.string().nullable(),\r\n openSubscription: z.boolean(),\r\n subscription: billingSchema.nullable(),\r\n coupon: billingCouponSchema.nullable(),\r\n});\r\n\r\nexport const billingAdminListInputSchema = querySchema;\r\nexport const billingAdminListOutputSchema = queryListOutput(adminOrganizationBillingRowSchema);\r\n\r\nexport type BillingCoupon = z.infer<typeof billingCouponSchema>;\r\nexport type CreateAdminSubscriptionInput = z.infer<typeof createAdminSubscriptionInputSchema>;\r\nexport type AdminOrganizationBillingRow = z.infer<typeof adminOrganizationBillingRowSchema>;\r\n"],"mappings":";;;AAGA,MAAa,gBAAgB,EAAE,OAAO;CACpC,IAAI,EAAE,QAAQ;CACd,MAAM,EAAE,QAAQ;CAChB,aAAa,EAAE,QAAQ;CACvB,kBAAkB,EAAE,QAAQ,CAAC,SAAS;CACtC,sBAAsB,EAAE,QAAQ,CAAC,SAAS;CAC1C,QAAQ,EAAE,QAAQ;CAClB,aAAa,EAAE,MAAM,CAAC,SAAS;CAC/B,WAAW,EAAE,MAAM,CAAC,SAAS;CAC7B,mBAAmB,EAAE,SAAS,CAAC,SAAS;CACxC,UAAU,EAAE,MAAM,CAAC,SAAS;CAC5B,YAAY,EAAE,MAAM,CAAC,SAAS;CAC9B,OAAO,EAAE,QAAQ,CAAC,SAAS;CAC3B,UAAU,EAAE,QAAQ,CAAC,SAAS;CAC9B,YAAY,EAAE,MAAM,CAAC,SAAS;CAC9B,UAAU,EAAE,MAAM,CAAC,SAAS;CAC5B,SAAS,EAAE,QAAQ,CAAC,SAAS;CAC7B,UAAU,EAAE,QAAQ,CAAC,SAAS;CAC9B,eAAe,EAAE,QAAQ,CAAC,SAAS;CACnC,gBAAgB,EAAE,SAAS,CAAC,SAAS;CACrC,YAAY,EAAE,QAAQ,CAAC,SAAS;CAChC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,SAAS;CACzC,CAAC;AAIF,MAAa,sBAAsB,EAAE,OAAO;CAC1C,IAAI,EAAE,QAAQ;CACd,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,YAAY,EAAE,QAAQ,CAAC,UAAU;CACjC,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,UAAU,EAAE,QAAQ,CAAC,UAAU;CAC/B,UAAU,EAAE,KAAK;EAAC;EAAW;EAAQ;EAAY,CAAC,CAAC,UAAU;CAC7D,kBAAkB,EAAE,QAAQ,CAAC,UAAU;CACvC,OAAO,EAAE,SAAS;CACnB,CAAC;AAEF,MAAa,gCAAgC,EAAE,MAAM,oBAAoB;AAEzE,MAAa,4BAA4B,EAAE,OAAO,EAChD,gBAAgB,EAAE,QAAQ,EAC3B,CAAC;AAEF,MAAa,qCAAqC,EAAE,OAAO;CACzD,gBAAgB,EAAE,QAAQ;CAC1B,SAAS,EAAE,QAAQ;CACnB,UAAU,EAAE,QAAQ,CAAC,UAAU;CAChC,CAAC;AAEF,MAAa,8BAA8B,EAAE,OAAO;CAClD,gBAAgB,EAAE,QAAQ;CAC1B,UAAU,EAAE,QAAQ;CACrB,CAAC;AAEF,MAAa,qCAAqC,EAAE,OAAO;CACzD,gBAAgB,EAAE,QAAQ;CAC1B,UAAU,EAAE,QAAQ;CACrB,CAAC;AAEF,MAAa,qCAAqC,EAAE,OAAO;CACzD,gBAAgB,EAAE,QAAQ;CAC1B,MAAM,EAAE,KAAK,CAAC,aAAa,aAAa,CAAC;CAC1C,CAAC;AAEF,MAAa,oCAAoC,EAAE,OAAO;CACxD,IAAI,EAAE,QAAQ;CACd,gBAAgB,EAAE,QAAQ;CAC1B,kBAAkB,EAAE,QAAQ;CAC5B,UAAU,EAAE,QAAQ,CAAC,UAAU;CAC/B,kBAAkB,EAAE,QAAQ,CAAC,UAAU;CACvC,kBAAkB,EAAE,SAAS;CAC7B,cAAc,cAAc,UAAU;CACtC,QAAQ,oBAAoB,UAAU;CACvC,CAAC;AAEF,MAAa,8BAA8B;AAC3C,MAAa,+BAA+B,gBAAgB,kCAAkC"}
|
|
@@ -27,7 +27,9 @@ type StripePlansConfig = {
|
|
|
27
27
|
production: StripePlan[];
|
|
28
28
|
sandbox: StripePlan[];
|
|
29
29
|
};
|
|
30
|
+
type StripeEnvironment = "production" | "sandbox";
|
|
30
31
|
type ResolvedStripePlans = {
|
|
32
|
+
environment: StripeEnvironment;
|
|
31
33
|
plans: StripePlan[];
|
|
32
34
|
trialPlanName: Record<string, string>;
|
|
33
35
|
trialRequiresPaymentMethod: boolean;
|
|
@@ -36,5 +38,5 @@ type ResolvedStripePlans = {
|
|
|
36
38
|
nonBillableRoleKeys: readonly string[];
|
|
37
39
|
};
|
|
38
40
|
//#endregion
|
|
39
|
-
export { ResolvedStripePlans, StripePlan, StripePlanPrice, StripePlanProduct, StripePlansConfig };
|
|
41
|
+
export { ResolvedStripePlans, StripeEnvironment, StripePlan, StripePlanPrice, StripePlanProduct, StripePlansConfig };
|
|
40
42
|
//# sourceMappingURL=billing.types.d.cts.map
|
|
@@ -27,7 +27,9 @@ type StripePlansConfig = {
|
|
|
27
27
|
production: StripePlan[];
|
|
28
28
|
sandbox: StripePlan[];
|
|
29
29
|
};
|
|
30
|
+
type StripeEnvironment = "production" | "sandbox";
|
|
30
31
|
type ResolvedStripePlans = {
|
|
32
|
+
environment: StripeEnvironment;
|
|
31
33
|
plans: StripePlan[];
|
|
32
34
|
trialPlanName: Record<string, string>;
|
|
33
35
|
trialRequiresPaymentMethod: boolean;
|
|
@@ -36,5 +38,5 @@ type ResolvedStripePlans = {
|
|
|
36
38
|
nonBillableRoleKeys: readonly string[];
|
|
37
39
|
};
|
|
38
40
|
//#endregion
|
|
39
|
-
export { ResolvedStripePlans, StripePlan, StripePlanPrice, StripePlanProduct, StripePlansConfig };
|
|
41
|
+
export { ResolvedStripePlans, StripeEnvironment, StripePlan, StripePlanPrice, StripePlanProduct, StripePlansConfig };
|
|
40
42
|
//# sourceMappingURL=billing.types.d.mts.map
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/modules/billing/billing.utils.ts
|
|
3
3
|
const getEnvironmentPlans = (plansConfig, environment = "sandbox") => {
|
|
4
|
+
const isProduction = environment === "production";
|
|
5
|
+
const plans = isProduction ? plansConfig.production : plansConfig.sandbox;
|
|
4
6
|
return {
|
|
5
|
-
|
|
7
|
+
environment: isProduction ? "production" : "sandbox",
|
|
8
|
+
plans,
|
|
6
9
|
trialPlanName: plansConfig.trialPlanName ?? {},
|
|
7
10
|
trialRequiresPaymentMethod: plansConfig.trialRequiresPaymentMethod ?? false,
|
|
8
11
|
defaultCurrency: plansConfig.defaultCurrency,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.utils.cjs","names":[],"sources":["../../../../src/modules/billing/billing.utils.ts"],"sourcesContent":["import type {\r\n ResolvedStripePlans,\r\n StripePlan,\r\n StripePlanPrice,\r\n StripePlansConfig,\r\n} from \"./billing.types\";\r\n\r\nexport const getEnvironmentPlans = (\r\n plansConfig: StripePlansConfig,\r\n environment = \"sandbox\"\r\n): ResolvedStripePlans => {\r\n const isProduction = environment === \"production\";\r\n const plans = isProduction ? plansConfig.production : plansConfig.sandbox;\r\n return {\r\n plans,\r\n trialPlanName: plansConfig.trialPlanName ?? {},\r\n trialRequiresPaymentMethod: plansConfig.trialRequiresPaymentMethod ?? false,\r\n defaultCurrency: plansConfig.defaultCurrency,\r\n seatBilling: plansConfig.seatBilling ?? false,\r\n nonBillableRoleKeys: plansConfig.nonBillableRoleKeys ?? [],\r\n };\r\n};\r\n\r\nexport const formatPlanAmount = ({\r\n unitAmount,\r\n currency,\r\n}: {\r\n unitAmount: number;\r\n currency: string;\r\n}): string => {\r\n return new Intl.NumberFormat(\"en-US\", {\r\n style: \"currency\",\r\n currency: currency.toUpperCase(),\r\n minimumFractionDigits: 0,\r\n maximumFractionDigits: 2,\r\n }).format(unitAmount / 100);\r\n};\r\n\r\nexport function listPlanPrices(plan: StripePlan): StripePlanPrice[] {\r\n return Object.values(plan.products).flatMap((product) => product.prices);\r\n}\r\n\r\nexport function catalogCurrencyKeys(plans: readonly StripePlan[]): string[] {\r\n const keys = new Set<string>();\r\n for (const plan of plans) {\r\n for (const currency of Object.keys(plan.products)) {\r\n keys.add(currency);\r\n }\r\n }\r\n return [...keys];\r\n}\r\n\r\nexport function findPlanByPriceId(\r\n plans: readonly StripePlan[],\r\n priceId: string\r\n): StripePlan | undefined {\r\n return plans.find((plan) => listPlanPrices(plan).some((price) => price.priceId === priceId));\r\n}\r\n\r\nexport function findPriceCurrency(plan: StripePlan, priceId: string): string | undefined {\r\n for (const [currency, product] of Object.entries(plan.products)) {\r\n if (product.prices.some((price) => price.priceId === priceId)) return currency;\r\n }\r\n return undefined;\r\n}\r\n\r\nexport function findTrialPlan({\r\n plans,\r\n trialPlanName,\r\n currency,\r\n}: {\r\n plans: readonly StripePlan[];\r\n trialPlanName: Record<string, string>;\r\n currency: string;\r\n}): StripePlan | undefined {\r\n const name = trialPlanName[currency];\r\n if (!name) return undefined;\r\n return plans.find((plan) => plan.name === name);\r\n}\r\n\r\nexport function findDefaultTrialPrice({\r\n plan,\r\n currency,\r\n}: {\r\n plan: StripePlan;\r\n currency: string;\r\n}): StripePlanPrice | undefined {\r\n const product = plan.products[currency];\r\n if (!product?.defaultPriceId) return undefined;\r\n return product.prices.find((price) => price.priceId === product.defaultPriceId);\r\n}\r\n\r\nexport function listPlanSelectPrices({\r\n plan,\r\n currency,\r\n trialRequiresPaymentMethod,\r\n}: {\r\n plan: StripePlan;\r\n currency: string;\r\n trialRequiresPaymentMethod?: boolean;\r\n}): StripePlanPrice[] {\r\n const product = plan.products[currency];\r\n if (!product) return [];\r\n if (trialRequiresPaymentMethod && product.defaultPriceId) {\r\n return product.prices.filter((price) => price.priceId === product.defaultPriceId);\r\n }\r\n return product.prices;\r\n}\r\n\r\nexport function formatBillingInterval({\r\n interval,\r\n intervalCount,\r\n}: {\r\n interval?: string | null;\r\n intervalCount?: number | null;\r\n}): string {\r\n const count = intervalCount ?? 1;\r\n if (!interval) return \"\";\r\n if (count === 1 && interval === \"month\") return \"Monthly\";\r\n if (count === 1 && interval === \"year\") return \"Yearly\";\r\n if (count === 1 && interval === \"week\") return \"Weekly\";\r\n if (count === 1 && interval === \"day\") return \"Daily\";\r\n if (interval === \"month\" && count === 3) return \"Every 3 months\";\r\n return `Every ${count} ${interval}${count === 1 ? \"\" : \"s\"}`;\r\n}\r\n"],"mappings":";;AAOA,MAAa,uBACX,aACA,cAAc,cACU;
|
|
1
|
+
{"version":3,"file":"billing.utils.cjs","names":[],"sources":["../../../../src/modules/billing/billing.utils.ts"],"sourcesContent":["import type {\r\n ResolvedStripePlans,\r\n StripePlan,\r\n StripePlanPrice,\r\n StripePlansConfig,\r\n} from \"./billing.types\";\r\n\r\nexport const getEnvironmentPlans = (\r\n plansConfig: StripePlansConfig,\r\n environment = \"sandbox\"\r\n): ResolvedStripePlans => {\r\n const isProduction = environment === \"production\";\r\n const plans = isProduction ? plansConfig.production : plansConfig.sandbox;\r\n return {\r\n environment: isProduction ? \"production\" : \"sandbox\",\r\n plans,\r\n trialPlanName: plansConfig.trialPlanName ?? {},\r\n trialRequiresPaymentMethod: plansConfig.trialRequiresPaymentMethod ?? false,\r\n defaultCurrency: plansConfig.defaultCurrency,\r\n seatBilling: plansConfig.seatBilling ?? false,\r\n nonBillableRoleKeys: plansConfig.nonBillableRoleKeys ?? [],\r\n };\r\n};\r\n\r\nexport const formatPlanAmount = ({\r\n unitAmount,\r\n currency,\r\n}: {\r\n unitAmount: number;\r\n currency: string;\r\n}): string => {\r\n return new Intl.NumberFormat(\"en-US\", {\r\n style: \"currency\",\r\n currency: currency.toUpperCase(),\r\n minimumFractionDigits: 0,\r\n maximumFractionDigits: 2,\r\n }).format(unitAmount / 100);\r\n};\r\n\r\nexport function listPlanPrices(plan: StripePlan): StripePlanPrice[] {\r\n return Object.values(plan.products).flatMap((product) => product.prices);\r\n}\r\n\r\nexport function catalogCurrencyKeys(plans: readonly StripePlan[]): string[] {\r\n const keys = new Set<string>();\r\n for (const plan of plans) {\r\n for (const currency of Object.keys(plan.products)) {\r\n keys.add(currency);\r\n }\r\n }\r\n return [...keys];\r\n}\r\n\r\nexport function findPlanByPriceId(\r\n plans: readonly StripePlan[],\r\n priceId: string\r\n): StripePlan | undefined {\r\n return plans.find((plan) => listPlanPrices(plan).some((price) => price.priceId === priceId));\r\n}\r\n\r\nexport function findPriceCurrency(plan: StripePlan, priceId: string): string | undefined {\r\n for (const [currency, product] of Object.entries(plan.products)) {\r\n if (product.prices.some((price) => price.priceId === priceId)) return currency;\r\n }\r\n return undefined;\r\n}\r\n\r\nexport function findTrialPlan({\r\n plans,\r\n trialPlanName,\r\n currency,\r\n}: {\r\n plans: readonly StripePlan[];\r\n trialPlanName: Record<string, string>;\r\n currency: string;\r\n}): StripePlan | undefined {\r\n const name = trialPlanName[currency];\r\n if (!name) return undefined;\r\n return plans.find((plan) => plan.name === name);\r\n}\r\n\r\nexport function findDefaultTrialPrice({\r\n plan,\r\n currency,\r\n}: {\r\n plan: StripePlan;\r\n currency: string;\r\n}): StripePlanPrice | undefined {\r\n const product = plan.products[currency];\r\n if (!product?.defaultPriceId) return undefined;\r\n return product.prices.find((price) => price.priceId === product.defaultPriceId);\r\n}\r\n\r\nexport function listPlanSelectPrices({\r\n plan,\r\n currency,\r\n trialRequiresPaymentMethod,\r\n}: {\r\n plan: StripePlan;\r\n currency: string;\r\n trialRequiresPaymentMethod?: boolean;\r\n}): StripePlanPrice[] {\r\n const product = plan.products[currency];\r\n if (!product) return [];\r\n if (trialRequiresPaymentMethod && product.defaultPriceId) {\r\n return product.prices.filter((price) => price.priceId === product.defaultPriceId);\r\n }\r\n return product.prices;\r\n}\r\n\r\nexport function formatBillingInterval({\r\n interval,\r\n intervalCount,\r\n}: {\r\n interval?: string | null;\r\n intervalCount?: number | null;\r\n}): string {\r\n const count = intervalCount ?? 1;\r\n if (!interval) return \"\";\r\n if (count === 1 && interval === \"month\") return \"Monthly\";\r\n if (count === 1 && interval === \"year\") return \"Yearly\";\r\n if (count === 1 && interval === \"week\") return \"Weekly\";\r\n if (count === 1 && interval === \"day\") return \"Daily\";\r\n if (interval === \"month\" && count === 3) return \"Every 3 months\";\r\n return `Every ${count} ${interval}${count === 1 ? \"\" : \"s\"}`;\r\n}\r\n"],"mappings":";;AAOA,MAAa,uBACX,aACA,cAAc,cACU;CACxB,MAAM,eAAe,gBAAgB;CACrC,MAAM,QAAQ,eAAe,YAAY,aAAa,YAAY;AAClE,QAAO;EACL,aAAa,eAAe,eAAe;EAC3C;EACA,eAAe,YAAY,iBAAiB,EAAE;EAC9C,4BAA4B,YAAY,8BAA8B;EACtE,iBAAiB,YAAY;EAC7B,aAAa,YAAY,eAAe;EACxC,qBAAqB,YAAY,uBAAuB,EAAE;EAC3D;;AAGH,MAAa,oBAAoB,EAC/B,YACA,eAIY;AACZ,QAAO,IAAI,KAAK,aAAa,SAAS;EACpC,OAAO;EACP,UAAU,SAAS,aAAa;EAChC,uBAAuB;EACvB,uBAAuB;EACxB,CAAC,CAAC,OAAO,aAAa,IAAI;;AAG7B,SAAgB,eAAe,MAAqC;AAClE,QAAO,OAAO,OAAO,KAAK,SAAS,CAAC,SAAS,YAAY,QAAQ,OAAO;;AAG1E,SAAgB,oBAAoB,OAAwC;CAC1E,MAAM,uBAAO,IAAI,KAAa;AAC9B,MAAK,MAAM,QAAQ,MACjB,MAAK,MAAM,YAAY,OAAO,KAAK,KAAK,SAAS,CAC/C,MAAK,IAAI,SAAS;AAGtB,QAAO,CAAC,GAAG,KAAK;;AAGlB,SAAgB,kBACd,OACA,SACwB;AACxB,QAAO,MAAM,MAAM,SAAS,eAAe,KAAK,CAAC,MAAM,UAAU,MAAM,YAAY,QAAQ,CAAC;;AAG9F,SAAgB,kBAAkB,MAAkB,SAAqC;AACvF,MAAK,MAAM,CAAC,UAAU,YAAY,OAAO,QAAQ,KAAK,SAAS,CAC7D,KAAI,QAAQ,OAAO,MAAM,UAAU,MAAM,YAAY,QAAQ,CAAE,QAAO;;AAK1E,SAAgB,cAAc,EAC5B,OACA,eACA,YAKyB;CACzB,MAAM,OAAO,cAAc;AAC3B,KAAI,CAAC,KAAM,QAAO,KAAA;AAClB,QAAO,MAAM,MAAM,SAAS,KAAK,SAAS,KAAK;;AAGjD,SAAgB,sBAAsB,EACpC,MACA,YAI8B;CAC9B,MAAM,UAAU,KAAK,SAAS;AAC9B,KAAI,CAAC,SAAS,eAAgB,QAAO,KAAA;AACrC,QAAO,QAAQ,OAAO,MAAM,UAAU,MAAM,YAAY,QAAQ,eAAe;;AAGjF,SAAgB,qBAAqB,EACnC,MACA,UACA,8BAKoB;CACpB,MAAM,UAAU,KAAK,SAAS;AAC9B,KAAI,CAAC,QAAS,QAAO,EAAE;AACvB,KAAI,8BAA8B,QAAQ,eACxC,QAAO,QAAQ,OAAO,QAAQ,UAAU,MAAM,YAAY,QAAQ,eAAe;AAEnF,QAAO,QAAQ;;AAGjB,SAAgB,sBAAsB,EACpC,UACA,iBAIS;CACT,MAAM,QAAQ,iBAAiB;AAC/B,KAAI,CAAC,SAAU,QAAO;AACtB,KAAI,UAAU,KAAK,aAAa,QAAS,QAAO;AAChD,KAAI,UAAU,KAAK,aAAa,OAAQ,QAAO;AAC/C,KAAI,UAAU,KAAK,aAAa,OAAQ,QAAO;AAC/C,KAAI,UAAU,KAAK,aAAa,MAAO,QAAO;AAC9C,KAAI,aAAa,WAAW,UAAU,EAAG,QAAO;AAChD,QAAO,SAAS,MAAM,GAAG,WAAW,UAAU,IAAI,KAAK"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
//#region src/modules/billing/billing.utils.ts
|
|
2
2
|
const getEnvironmentPlans = (plansConfig, environment = "sandbox") => {
|
|
3
|
+
const isProduction = environment === "production";
|
|
4
|
+
const plans = isProduction ? plansConfig.production : plansConfig.sandbox;
|
|
3
5
|
return {
|
|
4
|
-
|
|
6
|
+
environment: isProduction ? "production" : "sandbox",
|
|
7
|
+
plans,
|
|
5
8
|
trialPlanName: plansConfig.trialPlanName ?? {},
|
|
6
9
|
trialRequiresPaymentMethod: plansConfig.trialRequiresPaymentMethod ?? false,
|
|
7
10
|
defaultCurrency: plansConfig.defaultCurrency,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.utils.mjs","names":[],"sources":["../../../../src/modules/billing/billing.utils.ts"],"sourcesContent":["import type {\r\n ResolvedStripePlans,\r\n StripePlan,\r\n StripePlanPrice,\r\n StripePlansConfig,\r\n} from \"./billing.types\";\r\n\r\nexport const getEnvironmentPlans = (\r\n plansConfig: StripePlansConfig,\r\n environment = \"sandbox\"\r\n): ResolvedStripePlans => {\r\n const isProduction = environment === \"production\";\r\n const plans = isProduction ? plansConfig.production : plansConfig.sandbox;\r\n return {\r\n plans,\r\n trialPlanName: plansConfig.trialPlanName ?? {},\r\n trialRequiresPaymentMethod: plansConfig.trialRequiresPaymentMethod ?? false,\r\n defaultCurrency: plansConfig.defaultCurrency,\r\n seatBilling: plansConfig.seatBilling ?? false,\r\n nonBillableRoleKeys: plansConfig.nonBillableRoleKeys ?? [],\r\n };\r\n};\r\n\r\nexport const formatPlanAmount = ({\r\n unitAmount,\r\n currency,\r\n}: {\r\n unitAmount: number;\r\n currency: string;\r\n}): string => {\r\n return new Intl.NumberFormat(\"en-US\", {\r\n style: \"currency\",\r\n currency: currency.toUpperCase(),\r\n minimumFractionDigits: 0,\r\n maximumFractionDigits: 2,\r\n }).format(unitAmount / 100);\r\n};\r\n\r\nexport function listPlanPrices(plan: StripePlan): StripePlanPrice[] {\r\n return Object.values(plan.products).flatMap((product) => product.prices);\r\n}\r\n\r\nexport function catalogCurrencyKeys(plans: readonly StripePlan[]): string[] {\r\n const keys = new Set<string>();\r\n for (const plan of plans) {\r\n for (const currency of Object.keys(plan.products)) {\r\n keys.add(currency);\r\n }\r\n }\r\n return [...keys];\r\n}\r\n\r\nexport function findPlanByPriceId(\r\n plans: readonly StripePlan[],\r\n priceId: string\r\n): StripePlan | undefined {\r\n return plans.find((plan) => listPlanPrices(plan).some((price) => price.priceId === priceId));\r\n}\r\n\r\nexport function findPriceCurrency(plan: StripePlan, priceId: string): string | undefined {\r\n for (const [currency, product] of Object.entries(plan.products)) {\r\n if (product.prices.some((price) => price.priceId === priceId)) return currency;\r\n }\r\n return undefined;\r\n}\r\n\r\nexport function findTrialPlan({\r\n plans,\r\n trialPlanName,\r\n currency,\r\n}: {\r\n plans: readonly StripePlan[];\r\n trialPlanName: Record<string, string>;\r\n currency: string;\r\n}): StripePlan | undefined {\r\n const name = trialPlanName[currency];\r\n if (!name) return undefined;\r\n return plans.find((plan) => plan.name === name);\r\n}\r\n\r\nexport function findDefaultTrialPrice({\r\n plan,\r\n currency,\r\n}: {\r\n plan: StripePlan;\r\n currency: string;\r\n}): StripePlanPrice | undefined {\r\n const product = plan.products[currency];\r\n if (!product?.defaultPriceId) return undefined;\r\n return product.prices.find((price) => price.priceId === product.defaultPriceId);\r\n}\r\n\r\nexport function listPlanSelectPrices({\r\n plan,\r\n currency,\r\n trialRequiresPaymentMethod,\r\n}: {\r\n plan: StripePlan;\r\n currency: string;\r\n trialRequiresPaymentMethod?: boolean;\r\n}): StripePlanPrice[] {\r\n const product = plan.products[currency];\r\n if (!product) return [];\r\n if (trialRequiresPaymentMethod && product.defaultPriceId) {\r\n return product.prices.filter((price) => price.priceId === product.defaultPriceId);\r\n }\r\n return product.prices;\r\n}\r\n\r\nexport function formatBillingInterval({\r\n interval,\r\n intervalCount,\r\n}: {\r\n interval?: string | null;\r\n intervalCount?: number | null;\r\n}): string {\r\n const count = intervalCount ?? 1;\r\n if (!interval) return \"\";\r\n if (count === 1 && interval === \"month\") return \"Monthly\";\r\n if (count === 1 && interval === \"year\") return \"Yearly\";\r\n if (count === 1 && interval === \"week\") return \"Weekly\";\r\n if (count === 1 && interval === \"day\") return \"Daily\";\r\n if (interval === \"month\" && count === 3) return \"Every 3 months\";\r\n return `Every ${count} ${interval}${count === 1 ? \"\" : \"s\"}`;\r\n}\r\n"],"mappings":";AAOA,MAAa,uBACX,aACA,cAAc,cACU;
|
|
1
|
+
{"version":3,"file":"billing.utils.mjs","names":[],"sources":["../../../../src/modules/billing/billing.utils.ts"],"sourcesContent":["import type {\r\n ResolvedStripePlans,\r\n StripePlan,\r\n StripePlanPrice,\r\n StripePlansConfig,\r\n} from \"./billing.types\";\r\n\r\nexport const getEnvironmentPlans = (\r\n plansConfig: StripePlansConfig,\r\n environment = \"sandbox\"\r\n): ResolvedStripePlans => {\r\n const isProduction = environment === \"production\";\r\n const plans = isProduction ? plansConfig.production : plansConfig.sandbox;\r\n return {\r\n environment: isProduction ? \"production\" : \"sandbox\",\r\n plans,\r\n trialPlanName: plansConfig.trialPlanName ?? {},\r\n trialRequiresPaymentMethod: plansConfig.trialRequiresPaymentMethod ?? false,\r\n defaultCurrency: plansConfig.defaultCurrency,\r\n seatBilling: plansConfig.seatBilling ?? false,\r\n nonBillableRoleKeys: plansConfig.nonBillableRoleKeys ?? [],\r\n };\r\n};\r\n\r\nexport const formatPlanAmount = ({\r\n unitAmount,\r\n currency,\r\n}: {\r\n unitAmount: number;\r\n currency: string;\r\n}): string => {\r\n return new Intl.NumberFormat(\"en-US\", {\r\n style: \"currency\",\r\n currency: currency.toUpperCase(),\r\n minimumFractionDigits: 0,\r\n maximumFractionDigits: 2,\r\n }).format(unitAmount / 100);\r\n};\r\n\r\nexport function listPlanPrices(plan: StripePlan): StripePlanPrice[] {\r\n return Object.values(plan.products).flatMap((product) => product.prices);\r\n}\r\n\r\nexport function catalogCurrencyKeys(plans: readonly StripePlan[]): string[] {\r\n const keys = new Set<string>();\r\n for (const plan of plans) {\r\n for (const currency of Object.keys(plan.products)) {\r\n keys.add(currency);\r\n }\r\n }\r\n return [...keys];\r\n}\r\n\r\nexport function findPlanByPriceId(\r\n plans: readonly StripePlan[],\r\n priceId: string\r\n): StripePlan | undefined {\r\n return plans.find((plan) => listPlanPrices(plan).some((price) => price.priceId === priceId));\r\n}\r\n\r\nexport function findPriceCurrency(plan: StripePlan, priceId: string): string | undefined {\r\n for (const [currency, product] of Object.entries(plan.products)) {\r\n if (product.prices.some((price) => price.priceId === priceId)) return currency;\r\n }\r\n return undefined;\r\n}\r\n\r\nexport function findTrialPlan({\r\n plans,\r\n trialPlanName,\r\n currency,\r\n}: {\r\n plans: readonly StripePlan[];\r\n trialPlanName: Record<string, string>;\r\n currency: string;\r\n}): StripePlan | undefined {\r\n const name = trialPlanName[currency];\r\n if (!name) return undefined;\r\n return plans.find((plan) => plan.name === name);\r\n}\r\n\r\nexport function findDefaultTrialPrice({\r\n plan,\r\n currency,\r\n}: {\r\n plan: StripePlan;\r\n currency: string;\r\n}): StripePlanPrice | undefined {\r\n const product = plan.products[currency];\r\n if (!product?.defaultPriceId) return undefined;\r\n return product.prices.find((price) => price.priceId === product.defaultPriceId);\r\n}\r\n\r\nexport function listPlanSelectPrices({\r\n plan,\r\n currency,\r\n trialRequiresPaymentMethod,\r\n}: {\r\n plan: StripePlan;\r\n currency: string;\r\n trialRequiresPaymentMethod?: boolean;\r\n}): StripePlanPrice[] {\r\n const product = plan.products[currency];\r\n if (!product) return [];\r\n if (trialRequiresPaymentMethod && product.defaultPriceId) {\r\n return product.prices.filter((price) => price.priceId === product.defaultPriceId);\r\n }\r\n return product.prices;\r\n}\r\n\r\nexport function formatBillingInterval({\r\n interval,\r\n intervalCount,\r\n}: {\r\n interval?: string | null;\r\n intervalCount?: number | null;\r\n}): string {\r\n const count = intervalCount ?? 1;\r\n if (!interval) return \"\";\r\n if (count === 1 && interval === \"month\") return \"Monthly\";\r\n if (count === 1 && interval === \"year\") return \"Yearly\";\r\n if (count === 1 && interval === \"week\") return \"Weekly\";\r\n if (count === 1 && interval === \"day\") return \"Daily\";\r\n if (interval === \"month\" && count === 3) return \"Every 3 months\";\r\n return `Every ${count} ${interval}${count === 1 ? \"\" : \"s\"}`;\r\n}\r\n"],"mappings":";AAOA,MAAa,uBACX,aACA,cAAc,cACU;CACxB,MAAM,eAAe,gBAAgB;CACrC,MAAM,QAAQ,eAAe,YAAY,aAAa,YAAY;AAClE,QAAO;EACL,aAAa,eAAe,eAAe;EAC3C;EACA,eAAe,YAAY,iBAAiB,EAAE;EAC9C,4BAA4B,YAAY,8BAA8B;EACtE,iBAAiB,YAAY;EAC7B,aAAa,YAAY,eAAe;EACxC,qBAAqB,YAAY,uBAAuB,EAAE;EAC3D;;AAGH,MAAa,oBAAoB,EAC/B,YACA,eAIY;AACZ,QAAO,IAAI,KAAK,aAAa,SAAS;EACpC,OAAO;EACP,UAAU,SAAS,aAAa;EAChC,uBAAuB;EACvB,uBAAuB;EACxB,CAAC,CAAC,OAAO,aAAa,IAAI;;AAG7B,SAAgB,eAAe,MAAqC;AAClE,QAAO,OAAO,OAAO,KAAK,SAAS,CAAC,SAAS,YAAY,QAAQ,OAAO;;AAG1E,SAAgB,oBAAoB,OAAwC;CAC1E,MAAM,uBAAO,IAAI,KAAa;AAC9B,MAAK,MAAM,QAAQ,MACjB,MAAK,MAAM,YAAY,OAAO,KAAK,KAAK,SAAS,CAC/C,MAAK,IAAI,SAAS;AAGtB,QAAO,CAAC,GAAG,KAAK;;AAGlB,SAAgB,kBACd,OACA,SACwB;AACxB,QAAO,MAAM,MAAM,SAAS,eAAe,KAAK,CAAC,MAAM,UAAU,MAAM,YAAY,QAAQ,CAAC;;AAG9F,SAAgB,kBAAkB,MAAkB,SAAqC;AACvF,MAAK,MAAM,CAAC,UAAU,YAAY,OAAO,QAAQ,KAAK,SAAS,CAC7D,KAAI,QAAQ,OAAO,MAAM,UAAU,MAAM,YAAY,QAAQ,CAAE,QAAO;;AAK1E,SAAgB,cAAc,EAC5B,OACA,eACA,YAKyB;CACzB,MAAM,OAAO,cAAc;AAC3B,KAAI,CAAC,KAAM,QAAO,KAAA;AAClB,QAAO,MAAM,MAAM,SAAS,KAAK,SAAS,KAAK;;AAGjD,SAAgB,sBAAsB,EACpC,MACA,YAI8B;CAC9B,MAAM,UAAU,KAAK,SAAS;AAC9B,KAAI,CAAC,SAAS,eAAgB,QAAO,KAAA;AACrC,QAAO,QAAQ,OAAO,MAAM,UAAU,MAAM,YAAY,QAAQ,eAAe;;AAGjF,SAAgB,qBAAqB,EACnC,MACA,UACA,8BAKoB;CACpB,MAAM,UAAU,KAAK,SAAS;AAC9B,KAAI,CAAC,QAAS,QAAO,EAAE;AACvB,KAAI,8BAA8B,QAAQ,eACxC,QAAO,QAAQ,OAAO,QAAQ,UAAU,MAAM,YAAY,QAAQ,eAAe;AAEnF,QAAO,QAAQ;;AAGjB,SAAgB,sBAAsB,EACpC,UACA,iBAIS;CACT,MAAM,QAAQ,iBAAiB;AAC/B,KAAI,CAAC,SAAU,QAAO;AACtB,KAAI,UAAU,KAAK,aAAa,QAAS,QAAO;AAChD,KAAI,UAAU,KAAK,aAAa,OAAQ,QAAO;AAC/C,KAAI,UAAU,KAAK,aAAa,OAAQ,QAAO;AAC/C,KAAI,UAAU,KAAK,aAAa,MAAO,QAAO;AAC9C,KAAI,aAAa,WAAW,UAAU,EAAG,QAAO;AAChD,QAAO,SAAS,MAAM,GAAG,WAAW,UAAU,IAAI,KAAK"}
|
|
@@ -12,9 +12,9 @@ declare const notificationProviderSchema: z.ZodEnum<{
|
|
|
12
12
|
fcm: "fcm";
|
|
13
13
|
}>;
|
|
14
14
|
declare const notificationSendStatusSchema: z.ZodEnum<{
|
|
15
|
-
failed: "failed";
|
|
16
15
|
pending: "pending";
|
|
17
16
|
sent: "sent";
|
|
17
|
+
failed: "failed";
|
|
18
18
|
}>;
|
|
19
19
|
/** Web Push `PushSubscriptionJSON` subset we persist and accept from clients. */
|
|
20
20
|
declare const pushSubscriptionJsonSchema: z.ZodObject<{
|
|
@@ -113,9 +113,9 @@ declare const notificationSendLogSelectSchema: z.ZodObject<{
|
|
|
113
113
|
body: z.ZodString;
|
|
114
114
|
data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
115
115
|
status: z.ZodEnum<{
|
|
116
|
-
failed: "failed";
|
|
117
116
|
pending: "pending";
|
|
118
117
|
sent: "sent";
|
|
118
|
+
failed: "failed";
|
|
119
119
|
}>;
|
|
120
120
|
error: z.ZodNullable<z.ZodString>;
|
|
121
121
|
jobId: z.ZodNullable<z.ZodString>;
|
|
@@ -147,9 +147,9 @@ declare const notificationListSendLogsOutputSchema: z.ZodArray<z.ZodObject<{
|
|
|
147
147
|
body: z.ZodString;
|
|
148
148
|
data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
149
149
|
status: z.ZodEnum<{
|
|
150
|
-
failed: "failed";
|
|
151
150
|
pending: "pending";
|
|
152
151
|
sent: "sent";
|
|
152
|
+
failed: "failed";
|
|
153
153
|
}>;
|
|
154
154
|
error: z.ZodNullable<z.ZodString>;
|
|
155
155
|
jobId: z.ZodNullable<z.ZodString>;
|
|
@@ -12,9 +12,9 @@ declare const notificationProviderSchema: z.ZodEnum<{
|
|
|
12
12
|
fcm: "fcm";
|
|
13
13
|
}>;
|
|
14
14
|
declare const notificationSendStatusSchema: z.ZodEnum<{
|
|
15
|
-
failed: "failed";
|
|
16
15
|
pending: "pending";
|
|
17
16
|
sent: "sent";
|
|
17
|
+
failed: "failed";
|
|
18
18
|
}>;
|
|
19
19
|
/** Web Push `PushSubscriptionJSON` subset we persist and accept from clients. */
|
|
20
20
|
declare const pushSubscriptionJsonSchema: z.ZodObject<{
|
|
@@ -113,9 +113,9 @@ declare const notificationSendLogSelectSchema: z.ZodObject<{
|
|
|
113
113
|
body: z.ZodString;
|
|
114
114
|
data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
115
115
|
status: z.ZodEnum<{
|
|
116
|
-
failed: "failed";
|
|
117
116
|
pending: "pending";
|
|
118
117
|
sent: "sent";
|
|
118
|
+
failed: "failed";
|
|
119
119
|
}>;
|
|
120
120
|
error: z.ZodNullable<z.ZodString>;
|
|
121
121
|
jobId: z.ZodNullable<z.ZodString>;
|
|
@@ -147,9 +147,9 @@ declare const notificationListSendLogsOutputSchema: z.ZodArray<z.ZodObject<{
|
|
|
147
147
|
body: z.ZodString;
|
|
148
148
|
data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
149
149
|
status: z.ZodEnum<{
|
|
150
|
-
failed: "failed";
|
|
151
150
|
pending: "pending";
|
|
152
151
|
sent: "sent";
|
|
152
|
+
failed: "failed";
|
|
153
153
|
}>;
|
|
154
154
|
error: z.ZodNullable<z.ZodString>;
|
|
155
155
|
jobId: z.ZodNullable<z.ZodString>;
|
|
@@ -38,7 +38,6 @@ declare const recurrenceRulesSchema: z.ZodObject<{
|
|
|
38
38
|
}, z.core.$strip>;
|
|
39
39
|
declare const updateRecurrenceRulesSchema: z.ZodObject<{
|
|
40
40
|
id: z.ZodString;
|
|
41
|
-
interval: z.ZodNumber;
|
|
42
41
|
bysetpos: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
43
42
|
bymonth: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
44
43
|
bymonthday: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
@@ -50,6 +49,7 @@ declare const updateRecurrenceRulesSchema: z.ZodObject<{
|
|
|
50
49
|
bysecond: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
51
50
|
freq: z.ZodNumber;
|
|
52
51
|
dtstart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
52
|
+
interval: z.ZodNumber;
|
|
53
53
|
wkst: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
54
54
|
count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
55
55
|
until: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
@@ -61,7 +61,6 @@ declare const createRecurrenceSchema: z.ZodObject<{
|
|
|
61
61
|
enabled: z.ZodBoolean;
|
|
62
62
|
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
63
63
|
recurrenceRules: z.ZodArray<z.ZodObject<{
|
|
64
|
-
interval: z.ZodNumber;
|
|
65
64
|
bysetpos: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
66
65
|
bymonth: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
67
66
|
bymonthday: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
@@ -73,6 +72,7 @@ declare const createRecurrenceSchema: z.ZodObject<{
|
|
|
73
72
|
bysecond: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
74
73
|
freq: z.ZodNumber;
|
|
75
74
|
dtstart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
75
|
+
interval: z.ZodNumber;
|
|
76
76
|
wkst: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
77
77
|
count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
78
78
|
until: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
@@ -38,7 +38,6 @@ declare const recurrenceRulesSchema: z.ZodObject<{
|
|
|
38
38
|
}, z.core.$strip>;
|
|
39
39
|
declare const updateRecurrenceRulesSchema: z.ZodObject<{
|
|
40
40
|
id: z.ZodString;
|
|
41
|
-
interval: z.ZodNumber;
|
|
42
41
|
bysetpos: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
43
42
|
bymonth: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
44
43
|
bymonthday: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
@@ -50,6 +49,7 @@ declare const updateRecurrenceRulesSchema: z.ZodObject<{
|
|
|
50
49
|
bysecond: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
51
50
|
freq: z.ZodNumber;
|
|
52
51
|
dtstart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
52
|
+
interval: z.ZodNumber;
|
|
53
53
|
wkst: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
54
54
|
count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
55
55
|
until: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
@@ -61,7 +61,6 @@ declare const createRecurrenceSchema: z.ZodObject<{
|
|
|
61
61
|
enabled: z.ZodBoolean;
|
|
62
62
|
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
63
63
|
recurrenceRules: z.ZodArray<z.ZodObject<{
|
|
64
|
-
interval: z.ZodNumber;
|
|
65
64
|
bysetpos: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
66
65
|
bymonth: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
67
66
|
bymonthday: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
@@ -73,6 +72,7 @@ declare const createRecurrenceSchema: z.ZodObject<{
|
|
|
73
72
|
bysecond: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
74
73
|
freq: z.ZodNumber;
|
|
75
74
|
dtstart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
75
|
+
interval: z.ZodNumber;
|
|
76
76
|
wkst: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
77
77
|
count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
78
78
|
until: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
@@ -11,10 +11,10 @@ declare const workflowSelectSchema: z.ZodObject<{
|
|
|
11
11
|
input: z.ZodUnknown;
|
|
12
12
|
output: z.ZodUnknown;
|
|
13
13
|
status: z.ZodEnum<{
|
|
14
|
+
failed: "failed";
|
|
14
15
|
queued: "queued";
|
|
15
16
|
running: "running";
|
|
16
17
|
completed: "completed";
|
|
17
|
-
failed: "failed";
|
|
18
18
|
}>;
|
|
19
19
|
error: z.ZodNullable<z.ZodString>;
|
|
20
20
|
retries: z.ZodNumber;
|
|
@@ -28,10 +28,10 @@ declare const workflowReadInputSchema: z.ZodObject<{
|
|
|
28
28
|
}, z.core.$strip>;
|
|
29
29
|
declare const workflowListInputSchema: z.ZodObject<{
|
|
30
30
|
status: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
31
|
+
failed: "failed";
|
|
31
32
|
queued: "queued";
|
|
32
33
|
running: "running";
|
|
33
34
|
completed: "completed";
|
|
34
|
-
failed: "failed";
|
|
35
35
|
}>>>;
|
|
36
36
|
jobName: z.ZodOptional<z.ZodString>;
|
|
37
37
|
}, z.core.$strip>;
|
|
@@ -51,10 +51,10 @@ declare const workflowReadOutputSchema: z.ZodObject<{
|
|
|
51
51
|
input: z.ZodUnknown;
|
|
52
52
|
output: z.ZodUnknown;
|
|
53
53
|
status: z.ZodEnum<{
|
|
54
|
+
failed: "failed";
|
|
54
55
|
queued: "queued";
|
|
55
56
|
running: "running";
|
|
56
57
|
completed: "completed";
|
|
57
|
-
failed: "failed";
|
|
58
58
|
}>;
|
|
59
59
|
error: z.ZodNullable<z.ZodString>;
|
|
60
60
|
retries: z.ZodNumber;
|
|
@@ -73,10 +73,10 @@ declare const workflowListOutputSchema: z.ZodArray<z.ZodObject<{
|
|
|
73
73
|
input: z.ZodUnknown;
|
|
74
74
|
output: z.ZodUnknown;
|
|
75
75
|
status: z.ZodEnum<{
|
|
76
|
+
failed: "failed";
|
|
76
77
|
queued: "queued";
|
|
77
78
|
running: "running";
|
|
78
79
|
completed: "completed";
|
|
79
|
-
failed: "failed";
|
|
80
80
|
}>;
|
|
81
81
|
error: z.ZodNullable<z.ZodString>;
|
|
82
82
|
retries: z.ZodNumber;
|
|
@@ -11,10 +11,10 @@ declare const workflowSelectSchema: z.ZodObject<{
|
|
|
11
11
|
input: z.ZodUnknown;
|
|
12
12
|
output: z.ZodUnknown;
|
|
13
13
|
status: z.ZodEnum<{
|
|
14
|
+
failed: "failed";
|
|
14
15
|
queued: "queued";
|
|
15
16
|
running: "running";
|
|
16
17
|
completed: "completed";
|
|
17
|
-
failed: "failed";
|
|
18
18
|
}>;
|
|
19
19
|
error: z.ZodNullable<z.ZodString>;
|
|
20
20
|
retries: z.ZodNumber;
|
|
@@ -28,10 +28,10 @@ declare const workflowReadInputSchema: z.ZodObject<{
|
|
|
28
28
|
}, z.core.$strip>;
|
|
29
29
|
declare const workflowListInputSchema: z.ZodObject<{
|
|
30
30
|
status: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
31
|
+
failed: "failed";
|
|
31
32
|
queued: "queued";
|
|
32
33
|
running: "running";
|
|
33
34
|
completed: "completed";
|
|
34
|
-
failed: "failed";
|
|
35
35
|
}>>>;
|
|
36
36
|
jobName: z.ZodOptional<z.ZodString>;
|
|
37
37
|
}, z.core.$strip>;
|
|
@@ -51,10 +51,10 @@ declare const workflowReadOutputSchema: z.ZodObject<{
|
|
|
51
51
|
input: z.ZodUnknown;
|
|
52
52
|
output: z.ZodUnknown;
|
|
53
53
|
status: z.ZodEnum<{
|
|
54
|
+
failed: "failed";
|
|
54
55
|
queued: "queued";
|
|
55
56
|
running: "running";
|
|
56
57
|
completed: "completed";
|
|
57
|
-
failed: "failed";
|
|
58
58
|
}>;
|
|
59
59
|
error: z.ZodNullable<z.ZodString>;
|
|
60
60
|
retries: z.ZodNumber;
|
|
@@ -73,10 +73,10 @@ declare const workflowListOutputSchema: z.ZodArray<z.ZodObject<{
|
|
|
73
73
|
input: z.ZodUnknown;
|
|
74
74
|
output: z.ZodUnknown;
|
|
75
75
|
status: z.ZodEnum<{
|
|
76
|
+
failed: "failed";
|
|
76
77
|
queued: "queued";
|
|
77
78
|
running: "running";
|
|
78
79
|
completed: "completed";
|
|
79
|
-
failed: "failed";
|
|
80
80
|
}>;
|
|
81
81
|
error: z.ZodNullable<z.ZodString>;
|
|
82
82
|
retries: z.ZodNumber;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m5kdev/commons",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.11",
|
|
4
4
|
"license": "GPL-3.0-only",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"tsdown": "0.21.7",
|
|
22
22
|
"typescript": "6.0.3",
|
|
23
23
|
"zod": "4.4.3",
|
|
24
|
-
"@m5kdev/config": "0.38.
|
|
24
|
+
"@m5kdev/config": "0.38.11"
|
|
25
25
|
},
|
|
26
26
|
"exports": {
|
|
27
27
|
"./utils/*": {
|