@m5kdev/commons 0.38.9 → 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 +56 -0
- package/dist/src/modules/billing/billing.schema.cjs.map +1 -1
- package/dist/src/modules/billing/billing.schema.d.cts +190 -1
- package/dist/src/modules/billing/billing.schema.d.mts +190 -1
- package/dist/src/modules/billing/billing.schema.mjs +47 -1
- 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 +11 -11
- package/dist/src/modules/notification/notification.schema.d.mts +11 -11
- package/dist/src/modules/schemas/query.schema.d.cts +9 -9
- package/dist/src/modules/schemas/query.schema.d.mts +9 -9
- package/dist/src/modules/tag/tag.schema.d.cts +3 -3
- package/dist/src/modules/tag/tag.schema.d.mts +3 -3
- 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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_src_modules_schemas_query_schema = require("../schemas/query.schema.cjs");
|
|
2
3
|
let zod = require("zod");
|
|
3
4
|
//#region src/modules/billing/billing.schema.ts
|
|
4
5
|
const billingSchema = zod.z.object({
|
|
@@ -24,7 +25,62 @@ const billingSchema = zod.z.object({
|
|
|
24
25
|
unitAmount: zod.z.number().nullish(),
|
|
25
26
|
discounts: zod.z.array(zod.z.string()).nullish()
|
|
26
27
|
});
|
|
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({
|
|
45
|
+
organizationId: zod.z.string(),
|
|
46
|
+
priceId: zod.z.string(),
|
|
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()
|
|
56
|
+
});
|
|
57
|
+
const cancelAdminSubscriptionInputSchema = zod.z.object({
|
|
58
|
+
organizationId: zod.z.string(),
|
|
59
|
+
when: zod.z.enum(["immediate", "period_end"])
|
|
60
|
+
});
|
|
61
|
+
const adminOrganizationBillingRowSchema = zod.z.object({
|
|
62
|
+
id: zod.z.string(),
|
|
63
|
+
organizationId: zod.z.string(),
|
|
64
|
+
organizationName: zod.z.string(),
|
|
65
|
+
currency: zod.z.string().nullable(),
|
|
66
|
+
stripeCustomerId: zod.z.string().nullable(),
|
|
67
|
+
openSubscription: zod.z.boolean(),
|
|
68
|
+
subscription: billingSchema.nullable(),
|
|
69
|
+
coupon: billingCouponSchema.nullable()
|
|
70
|
+
});
|
|
71
|
+
const billingAdminListInputSchema = require_src_modules_schemas_query_schema.querySchema;
|
|
72
|
+
const billingAdminListOutputSchema = require_src_modules_schemas_query_schema.queryListOutput(adminOrganizationBillingRowSchema);
|
|
27
73
|
//#endregion
|
|
74
|
+
exports.adminOrganizationBillingRowSchema = adminOrganizationBillingRowSchema;
|
|
75
|
+
exports.applyAdminCouponInputSchema = applyAdminCouponInputSchema;
|
|
76
|
+
exports.billingAdminListInputSchema = billingAdminListInputSchema;
|
|
77
|
+
exports.billingAdminListOutputSchema = billingAdminListOutputSchema;
|
|
78
|
+
exports.billingCouponListOutputSchema = billingCouponListOutputSchema;
|
|
79
|
+
exports.billingCouponSchema = billingCouponSchema;
|
|
28
80
|
exports.billingSchema = billingSchema;
|
|
81
|
+
exports.cancelAdminSubscriptionInputSchema = cancelAdminSubscriptionInputSchema;
|
|
82
|
+
exports.createAdminSubscriptionInputSchema = createAdminSubscriptionInputSchema;
|
|
83
|
+
exports.organizationIdInputSchema = organizationIdInputSchema;
|
|
84
|
+
exports.setOrganizationCurrencyInputSchema = setOrganizationCurrencyInputSchema;
|
|
29
85
|
|
|
30
86
|
//# sourceMappingURL=billing.schema.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.schema.cjs","names":["z"],"sources":["../../../../src/modules/billing/billing.schema.ts"],"sourcesContent":["import { z } from \"zod\";\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"],"mappings":"
|
|
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,6 +25,195 @@ 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 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<{
|
|
60
|
+
organizationId: z.ZodString;
|
|
61
|
+
priceId: z.ZodString;
|
|
62
|
+
couponId: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
declare const applyAdminCouponInputSchema: z.ZodObject<{
|
|
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;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
declare const cancelAdminSubscriptionInputSchema: z.ZodObject<{
|
|
73
|
+
organizationId: z.ZodString;
|
|
74
|
+
when: z.ZodEnum<{
|
|
75
|
+
immediate: "immediate";
|
|
76
|
+
period_end: "period_end";
|
|
77
|
+
}>;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
declare const adminOrganizationBillingRowSchema: z.ZodObject<{
|
|
80
|
+
id: z.ZodString;
|
|
81
|
+
organizationId: z.ZodString;
|
|
82
|
+
organizationName: z.ZodString;
|
|
83
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
84
|
+
stripeCustomerId: z.ZodNullable<z.ZodString>;
|
|
85
|
+
openSubscription: z.ZodBoolean;
|
|
86
|
+
subscription: z.ZodNullable<z.ZodObject<{
|
|
87
|
+
id: z.ZodString;
|
|
88
|
+
plan: z.ZodString;
|
|
89
|
+
referenceId: z.ZodString;
|
|
90
|
+
stripeCustomerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
91
|
+
stripeSubscriptionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
92
|
+
status: z.ZodString;
|
|
93
|
+
periodStart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
94
|
+
periodEnd: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
95
|
+
cancelAtPeriodEnd: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
96
|
+
cancelAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
97
|
+
canceledAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
98
|
+
seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
99
|
+
memberId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
100
|
+
trialStart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
101
|
+
trialEnd: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
102
|
+
priceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
103
|
+
interval: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
104
|
+
intervalCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
105
|
+
intervalPicked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
106
|
+
unitAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
107
|
+
discounts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
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>>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
declare const billingAdminListInputSchema: z.ZodObject<{
|
|
125
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
126
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
127
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
128
|
+
order: z.ZodOptional<z.ZodEnum<{
|
|
129
|
+
asc: "asc";
|
|
130
|
+
desc: "desc";
|
|
131
|
+
}>>;
|
|
132
|
+
filters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
133
|
+
columnId: z.ZodString;
|
|
134
|
+
type: z.ZodEnum<{
|
|
135
|
+
string: "string";
|
|
136
|
+
number: "number";
|
|
137
|
+
boolean: "boolean";
|
|
138
|
+
enum: "enum";
|
|
139
|
+
date: "date";
|
|
140
|
+
jsonArray: "jsonArray";
|
|
141
|
+
}>;
|
|
142
|
+
method: z.ZodEnum<{
|
|
143
|
+
starts_with: "starts_with";
|
|
144
|
+
ends_with: "ends_with";
|
|
145
|
+
contains: "contains";
|
|
146
|
+
equals: "equals";
|
|
147
|
+
greater_than: "greater_than";
|
|
148
|
+
less_than: "less_than";
|
|
149
|
+
on: "on";
|
|
150
|
+
between: "between";
|
|
151
|
+
before: "before";
|
|
152
|
+
after: "after";
|
|
153
|
+
oneOf: "oneOf";
|
|
154
|
+
intersect: "intersect";
|
|
155
|
+
isEmpty: "isEmpty";
|
|
156
|
+
isNotEmpty: "isNotEmpty";
|
|
157
|
+
is_null: "is_null";
|
|
158
|
+
is_not_null: "is_not_null";
|
|
159
|
+
}>;
|
|
160
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>;
|
|
161
|
+
valueTo: z.ZodOptional<z.ZodString>;
|
|
162
|
+
endColumnId: z.ZodOptional<z.ZodString>;
|
|
163
|
+
}, z.core.$strip>>>;
|
|
164
|
+
q: z.ZodOptional<z.ZodString>;
|
|
165
|
+
}, z.core.$strip>;
|
|
166
|
+
declare const billingAdminListOutputSchema: z.ZodObject<{
|
|
167
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
168
|
+
id: z.ZodString;
|
|
169
|
+
organizationId: z.ZodString;
|
|
170
|
+
organizationName: z.ZodString;
|
|
171
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
172
|
+
stripeCustomerId: z.ZodNullable<z.ZodString>;
|
|
173
|
+
openSubscription: z.ZodBoolean;
|
|
174
|
+
subscription: z.ZodNullable<z.ZodObject<{
|
|
175
|
+
id: z.ZodString;
|
|
176
|
+
plan: z.ZodString;
|
|
177
|
+
referenceId: z.ZodString;
|
|
178
|
+
stripeCustomerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
179
|
+
stripeSubscriptionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
180
|
+
status: z.ZodString;
|
|
181
|
+
periodStart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
182
|
+
periodEnd: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
183
|
+
cancelAtPeriodEnd: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
184
|
+
cancelAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
185
|
+
canceledAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
186
|
+
seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
187
|
+
memberId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
188
|
+
trialStart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
189
|
+
trialEnd: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
190
|
+
priceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
191
|
+
interval: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
192
|
+
intervalCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
193
|
+
intervalPicked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
194
|
+
unitAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
195
|
+
discounts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
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>>;
|
|
211
|
+
}, z.core.$strip>>;
|
|
212
|
+
total: z.ZodNumber;
|
|
213
|
+
}, z.core.$strip>;
|
|
214
|
+
type BillingCoupon = z.infer<typeof billingCouponSchema>;
|
|
215
|
+
type CreateAdminSubscriptionInput = z.infer<typeof createAdminSubscriptionInputSchema>;
|
|
216
|
+
type AdminOrganizationBillingRow = z.infer<typeof adminOrganizationBillingRowSchema>;
|
|
28
217
|
//#endregion
|
|
29
|
-
export { BillingSchema, billingSchema };
|
|
218
|
+
export { AdminOrganizationBillingRow, BillingCoupon, BillingSchema, CreateAdminSubscriptionInput, adminOrganizationBillingRowSchema, applyAdminCouponInputSchema, billingAdminListInputSchema, billingAdminListOutputSchema, billingCouponListOutputSchema, billingCouponSchema, billingSchema, cancelAdminSubscriptionInputSchema, createAdminSubscriptionInputSchema, organizationIdInputSchema, setOrganizationCurrencyInputSchema };
|
|
30
219
|
//# sourceMappingURL=billing.schema.d.cts.map
|
|
@@ -25,6 +25,195 @@ 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 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<{
|
|
60
|
+
organizationId: z.ZodString;
|
|
61
|
+
priceId: z.ZodString;
|
|
62
|
+
couponId: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
declare const applyAdminCouponInputSchema: z.ZodObject<{
|
|
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;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
declare const cancelAdminSubscriptionInputSchema: z.ZodObject<{
|
|
73
|
+
organizationId: z.ZodString;
|
|
74
|
+
when: z.ZodEnum<{
|
|
75
|
+
immediate: "immediate";
|
|
76
|
+
period_end: "period_end";
|
|
77
|
+
}>;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
declare const adminOrganizationBillingRowSchema: z.ZodObject<{
|
|
80
|
+
id: z.ZodString;
|
|
81
|
+
organizationId: z.ZodString;
|
|
82
|
+
organizationName: z.ZodString;
|
|
83
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
84
|
+
stripeCustomerId: z.ZodNullable<z.ZodString>;
|
|
85
|
+
openSubscription: z.ZodBoolean;
|
|
86
|
+
subscription: z.ZodNullable<z.ZodObject<{
|
|
87
|
+
id: z.ZodString;
|
|
88
|
+
plan: z.ZodString;
|
|
89
|
+
referenceId: z.ZodString;
|
|
90
|
+
stripeCustomerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
91
|
+
stripeSubscriptionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
92
|
+
status: z.ZodString;
|
|
93
|
+
periodStart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
94
|
+
periodEnd: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
95
|
+
cancelAtPeriodEnd: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
96
|
+
cancelAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
97
|
+
canceledAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
98
|
+
seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
99
|
+
memberId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
100
|
+
trialStart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
101
|
+
trialEnd: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
102
|
+
priceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
103
|
+
interval: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
104
|
+
intervalCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
105
|
+
intervalPicked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
106
|
+
unitAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
107
|
+
discounts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
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>>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
declare const billingAdminListInputSchema: z.ZodObject<{
|
|
125
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
126
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
127
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
128
|
+
order: z.ZodOptional<z.ZodEnum<{
|
|
129
|
+
asc: "asc";
|
|
130
|
+
desc: "desc";
|
|
131
|
+
}>>;
|
|
132
|
+
filters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
133
|
+
columnId: z.ZodString;
|
|
134
|
+
type: z.ZodEnum<{
|
|
135
|
+
string: "string";
|
|
136
|
+
number: "number";
|
|
137
|
+
boolean: "boolean";
|
|
138
|
+
enum: "enum";
|
|
139
|
+
date: "date";
|
|
140
|
+
jsonArray: "jsonArray";
|
|
141
|
+
}>;
|
|
142
|
+
method: z.ZodEnum<{
|
|
143
|
+
starts_with: "starts_with";
|
|
144
|
+
ends_with: "ends_with";
|
|
145
|
+
contains: "contains";
|
|
146
|
+
equals: "equals";
|
|
147
|
+
greater_than: "greater_than";
|
|
148
|
+
less_than: "less_than";
|
|
149
|
+
on: "on";
|
|
150
|
+
between: "between";
|
|
151
|
+
before: "before";
|
|
152
|
+
after: "after";
|
|
153
|
+
oneOf: "oneOf";
|
|
154
|
+
intersect: "intersect";
|
|
155
|
+
isEmpty: "isEmpty";
|
|
156
|
+
isNotEmpty: "isNotEmpty";
|
|
157
|
+
is_null: "is_null";
|
|
158
|
+
is_not_null: "is_not_null";
|
|
159
|
+
}>;
|
|
160
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>;
|
|
161
|
+
valueTo: z.ZodOptional<z.ZodString>;
|
|
162
|
+
endColumnId: z.ZodOptional<z.ZodString>;
|
|
163
|
+
}, z.core.$strip>>>;
|
|
164
|
+
q: z.ZodOptional<z.ZodString>;
|
|
165
|
+
}, z.core.$strip>;
|
|
166
|
+
declare const billingAdminListOutputSchema: z.ZodObject<{
|
|
167
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
168
|
+
id: z.ZodString;
|
|
169
|
+
organizationId: z.ZodString;
|
|
170
|
+
organizationName: z.ZodString;
|
|
171
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
172
|
+
stripeCustomerId: z.ZodNullable<z.ZodString>;
|
|
173
|
+
openSubscription: z.ZodBoolean;
|
|
174
|
+
subscription: z.ZodNullable<z.ZodObject<{
|
|
175
|
+
id: z.ZodString;
|
|
176
|
+
plan: z.ZodString;
|
|
177
|
+
referenceId: z.ZodString;
|
|
178
|
+
stripeCustomerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
179
|
+
stripeSubscriptionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
180
|
+
status: z.ZodString;
|
|
181
|
+
periodStart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
182
|
+
periodEnd: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
183
|
+
cancelAtPeriodEnd: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
184
|
+
cancelAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
185
|
+
canceledAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
186
|
+
seats: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
187
|
+
memberId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
188
|
+
trialStart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
189
|
+
trialEnd: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
190
|
+
priceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
191
|
+
interval: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
192
|
+
intervalCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
193
|
+
intervalPicked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
194
|
+
unitAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
195
|
+
discounts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
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>>;
|
|
211
|
+
}, z.core.$strip>>;
|
|
212
|
+
total: z.ZodNumber;
|
|
213
|
+
}, z.core.$strip>;
|
|
214
|
+
type BillingCoupon = z.infer<typeof billingCouponSchema>;
|
|
215
|
+
type CreateAdminSubscriptionInput = z.infer<typeof createAdminSubscriptionInputSchema>;
|
|
216
|
+
type AdminOrganizationBillingRow = z.infer<typeof adminOrganizationBillingRowSchema>;
|
|
28
217
|
//#endregion
|
|
29
|
-
export { BillingSchema, billingSchema };
|
|
218
|
+
export { AdminOrganizationBillingRow, BillingCoupon, BillingSchema, CreateAdminSubscriptionInput, adminOrganizationBillingRowSchema, applyAdminCouponInputSchema, billingAdminListInputSchema, billingAdminListOutputSchema, billingCouponListOutputSchema, billingCouponSchema, billingSchema, cancelAdminSubscriptionInputSchema, createAdminSubscriptionInputSchema, organizationIdInputSchema, setOrganizationCurrencyInputSchema };
|
|
30
219
|
//# sourceMappingURL=billing.schema.d.mts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { queryListOutput, querySchema } from "../schemas/query.schema.mjs";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
//#region src/modules/billing/billing.schema.ts
|
|
3
4
|
const billingSchema = z.object({
|
|
@@ -23,7 +24,52 @@ const billingSchema = z.object({
|
|
|
23
24
|
unitAmount: z.number().nullish(),
|
|
24
25
|
discounts: z.array(z.string()).nullish()
|
|
25
26
|
});
|
|
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({
|
|
44
|
+
organizationId: z.string(),
|
|
45
|
+
priceId: z.string(),
|
|
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()
|
|
55
|
+
});
|
|
56
|
+
const cancelAdminSubscriptionInputSchema = z.object({
|
|
57
|
+
organizationId: z.string(),
|
|
58
|
+
when: z.enum(["immediate", "period_end"])
|
|
59
|
+
});
|
|
60
|
+
const adminOrganizationBillingRowSchema = z.object({
|
|
61
|
+
id: z.string(),
|
|
62
|
+
organizationId: z.string(),
|
|
63
|
+
organizationName: z.string(),
|
|
64
|
+
currency: z.string().nullable(),
|
|
65
|
+
stripeCustomerId: z.string().nullable(),
|
|
66
|
+
openSubscription: z.boolean(),
|
|
67
|
+
subscription: billingSchema.nullable(),
|
|
68
|
+
coupon: billingCouponSchema.nullable()
|
|
69
|
+
});
|
|
70
|
+
const billingAdminListInputSchema = querySchema;
|
|
71
|
+
const billingAdminListOutputSchema = queryListOutput(adminOrganizationBillingRowSchema);
|
|
26
72
|
//#endregion
|
|
27
|
-
export { billingSchema };
|
|
73
|
+
export { adminOrganizationBillingRowSchema, applyAdminCouponInputSchema, billingAdminListInputSchema, billingAdminListOutputSchema, billingCouponListOutputSchema, billingCouponSchema, billingSchema, cancelAdminSubscriptionInputSchema, createAdminSubscriptionInputSchema, organizationIdInputSchema, setOrganizationCurrencyInputSchema };
|
|
28
74
|
|
|
29
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\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"],"mappings":"
|
|
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<{
|
|
@@ -87,10 +87,10 @@ declare const notificationVapidPublicKeyOutputSchema: z.ZodObject<{
|
|
|
87
87
|
publicKey: z.ZodString;
|
|
88
88
|
}, z.core.$strip>;
|
|
89
89
|
declare const notificationChannelSchema: z.ZodEnum<{
|
|
90
|
+
email: "email";
|
|
90
91
|
"in-app": "in-app";
|
|
91
92
|
"web-push": "web-push";
|
|
92
93
|
"mobile-push": "mobile-push";
|
|
93
|
-
email: "email";
|
|
94
94
|
}>;
|
|
95
95
|
declare const notificationSendLogSelectSchema: z.ZodObject<{
|
|
96
96
|
id: z.ZodString;
|
|
@@ -99,10 +99,10 @@ declare const notificationSendLogSelectSchema: z.ZodObject<{
|
|
|
99
99
|
userId: z.ZodString;
|
|
100
100
|
deviceId: z.ZodNullable<z.ZodString>;
|
|
101
101
|
channel: z.ZodEnum<{
|
|
102
|
+
email: "email";
|
|
102
103
|
"in-app": "in-app";
|
|
103
104
|
"web-push": "web-push";
|
|
104
105
|
"mobile-push": "mobile-push";
|
|
105
|
-
email: "email";
|
|
106
106
|
}>;
|
|
107
107
|
provider: z.ZodNullable<z.ZodEnum<{
|
|
108
108
|
web: "web";
|
|
@@ -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>;
|
|
@@ -133,10 +133,10 @@ declare const notificationListSendLogsOutputSchema: z.ZodArray<z.ZodObject<{
|
|
|
133
133
|
userId: z.ZodString;
|
|
134
134
|
deviceId: z.ZodNullable<z.ZodString>;
|
|
135
135
|
channel: z.ZodEnum<{
|
|
136
|
+
email: "email";
|
|
136
137
|
"in-app": "in-app";
|
|
137
138
|
"web-push": "web-push";
|
|
138
139
|
"mobile-push": "mobile-push";
|
|
139
|
-
email: "email";
|
|
140
140
|
}>;
|
|
141
141
|
provider: z.ZodNullable<z.ZodEnum<{
|
|
142
142
|
web: "web";
|
|
@@ -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>;
|
|
@@ -203,10 +203,10 @@ declare const notificationSendTestOutputSchema: z.ZodObject<{
|
|
|
203
203
|
}, z.core.$strip>;
|
|
204
204
|
declare const notificationKindPreferenceChannelSchema: z.ZodObject<{
|
|
205
205
|
channel: z.ZodEnum<{
|
|
206
|
+
email: "email";
|
|
206
207
|
"in-app": "in-app";
|
|
207
208
|
"web-push": "web-push";
|
|
208
209
|
"mobile-push": "mobile-push";
|
|
209
|
-
email: "email";
|
|
210
210
|
}>;
|
|
211
211
|
enabled: z.ZodBoolean;
|
|
212
212
|
}, z.core.$strip>;
|
|
@@ -214,10 +214,10 @@ declare const notificationKindPreferenceSchema: z.ZodObject<{
|
|
|
214
214
|
kind: z.ZodString;
|
|
215
215
|
channels: z.ZodArray<z.ZodObject<{
|
|
216
216
|
channel: z.ZodEnum<{
|
|
217
|
+
email: "email";
|
|
217
218
|
"in-app": "in-app";
|
|
218
219
|
"web-push": "web-push";
|
|
219
220
|
"mobile-push": "mobile-push";
|
|
220
|
-
email: "email";
|
|
221
221
|
}>;
|
|
222
222
|
enabled: z.ZodBoolean;
|
|
223
223
|
}, z.core.$strip>>;
|
|
@@ -226,10 +226,10 @@ declare const notificationListPreferencesOutputSchema: z.ZodArray<z.ZodObject<{
|
|
|
226
226
|
kind: z.ZodString;
|
|
227
227
|
channels: z.ZodArray<z.ZodObject<{
|
|
228
228
|
channel: z.ZodEnum<{
|
|
229
|
+
email: "email";
|
|
229
230
|
"in-app": "in-app";
|
|
230
231
|
"web-push": "web-push";
|
|
231
232
|
"mobile-push": "mobile-push";
|
|
232
|
-
email: "email";
|
|
233
233
|
}>;
|
|
234
234
|
enabled: z.ZodBoolean;
|
|
235
235
|
}, z.core.$strip>>;
|
|
@@ -237,10 +237,10 @@ declare const notificationListPreferencesOutputSchema: z.ZodArray<z.ZodObject<{
|
|
|
237
237
|
declare const notificationSetPreferenceInputSchema: z.ZodObject<{
|
|
238
238
|
kind: z.ZodString;
|
|
239
239
|
channel: z.ZodEnum<{
|
|
240
|
+
email: "email";
|
|
240
241
|
"in-app": "in-app";
|
|
241
242
|
"web-push": "web-push";
|
|
242
243
|
"mobile-push": "mobile-push";
|
|
243
|
-
email: "email";
|
|
244
244
|
}>;
|
|
245
245
|
enabled: z.ZodBoolean;
|
|
246
246
|
}, z.core.$strip>;
|
|
@@ -248,10 +248,10 @@ declare const notificationSetPreferenceOutputSchema: z.ZodObject<{
|
|
|
248
248
|
kind: z.ZodString;
|
|
249
249
|
channels: z.ZodArray<z.ZodObject<{
|
|
250
250
|
channel: z.ZodEnum<{
|
|
251
|
+
email: "email";
|
|
251
252
|
"in-app": "in-app";
|
|
252
253
|
"web-push": "web-push";
|
|
253
254
|
"mobile-push": "mobile-push";
|
|
254
|
-
email: "email";
|
|
255
255
|
}>;
|
|
256
256
|
enabled: z.ZodBoolean;
|
|
257
257
|
}, z.core.$strip>>;
|
|
@@ -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<{
|
|
@@ -87,10 +87,10 @@ declare const notificationVapidPublicKeyOutputSchema: z.ZodObject<{
|
|
|
87
87
|
publicKey: z.ZodString;
|
|
88
88
|
}, z.core.$strip>;
|
|
89
89
|
declare const notificationChannelSchema: z.ZodEnum<{
|
|
90
|
+
email: "email";
|
|
90
91
|
"in-app": "in-app";
|
|
91
92
|
"web-push": "web-push";
|
|
92
93
|
"mobile-push": "mobile-push";
|
|
93
|
-
email: "email";
|
|
94
94
|
}>;
|
|
95
95
|
declare const notificationSendLogSelectSchema: z.ZodObject<{
|
|
96
96
|
id: z.ZodString;
|
|
@@ -99,10 +99,10 @@ declare const notificationSendLogSelectSchema: z.ZodObject<{
|
|
|
99
99
|
userId: z.ZodString;
|
|
100
100
|
deviceId: z.ZodNullable<z.ZodString>;
|
|
101
101
|
channel: z.ZodEnum<{
|
|
102
|
+
email: "email";
|
|
102
103
|
"in-app": "in-app";
|
|
103
104
|
"web-push": "web-push";
|
|
104
105
|
"mobile-push": "mobile-push";
|
|
105
|
-
email: "email";
|
|
106
106
|
}>;
|
|
107
107
|
provider: z.ZodNullable<z.ZodEnum<{
|
|
108
108
|
web: "web";
|
|
@@ -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>;
|
|
@@ -133,10 +133,10 @@ declare const notificationListSendLogsOutputSchema: z.ZodArray<z.ZodObject<{
|
|
|
133
133
|
userId: z.ZodString;
|
|
134
134
|
deviceId: z.ZodNullable<z.ZodString>;
|
|
135
135
|
channel: z.ZodEnum<{
|
|
136
|
+
email: "email";
|
|
136
137
|
"in-app": "in-app";
|
|
137
138
|
"web-push": "web-push";
|
|
138
139
|
"mobile-push": "mobile-push";
|
|
139
|
-
email: "email";
|
|
140
140
|
}>;
|
|
141
141
|
provider: z.ZodNullable<z.ZodEnum<{
|
|
142
142
|
web: "web";
|
|
@@ -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>;
|
|
@@ -203,10 +203,10 @@ declare const notificationSendTestOutputSchema: z.ZodObject<{
|
|
|
203
203
|
}, z.core.$strip>;
|
|
204
204
|
declare const notificationKindPreferenceChannelSchema: z.ZodObject<{
|
|
205
205
|
channel: z.ZodEnum<{
|
|
206
|
+
email: "email";
|
|
206
207
|
"in-app": "in-app";
|
|
207
208
|
"web-push": "web-push";
|
|
208
209
|
"mobile-push": "mobile-push";
|
|
209
|
-
email: "email";
|
|
210
210
|
}>;
|
|
211
211
|
enabled: z.ZodBoolean;
|
|
212
212
|
}, z.core.$strip>;
|
|
@@ -214,10 +214,10 @@ declare const notificationKindPreferenceSchema: z.ZodObject<{
|
|
|
214
214
|
kind: z.ZodString;
|
|
215
215
|
channels: z.ZodArray<z.ZodObject<{
|
|
216
216
|
channel: z.ZodEnum<{
|
|
217
|
+
email: "email";
|
|
217
218
|
"in-app": "in-app";
|
|
218
219
|
"web-push": "web-push";
|
|
219
220
|
"mobile-push": "mobile-push";
|
|
220
|
-
email: "email";
|
|
221
221
|
}>;
|
|
222
222
|
enabled: z.ZodBoolean;
|
|
223
223
|
}, z.core.$strip>>;
|
|
@@ -226,10 +226,10 @@ declare const notificationListPreferencesOutputSchema: z.ZodArray<z.ZodObject<{
|
|
|
226
226
|
kind: z.ZodString;
|
|
227
227
|
channels: z.ZodArray<z.ZodObject<{
|
|
228
228
|
channel: z.ZodEnum<{
|
|
229
|
+
email: "email";
|
|
229
230
|
"in-app": "in-app";
|
|
230
231
|
"web-push": "web-push";
|
|
231
232
|
"mobile-push": "mobile-push";
|
|
232
|
-
email: "email";
|
|
233
233
|
}>;
|
|
234
234
|
enabled: z.ZodBoolean;
|
|
235
235
|
}, z.core.$strip>>;
|
|
@@ -237,10 +237,10 @@ declare const notificationListPreferencesOutputSchema: z.ZodArray<z.ZodObject<{
|
|
|
237
237
|
declare const notificationSetPreferenceInputSchema: z.ZodObject<{
|
|
238
238
|
kind: z.ZodString;
|
|
239
239
|
channel: z.ZodEnum<{
|
|
240
|
+
email: "email";
|
|
240
241
|
"in-app": "in-app";
|
|
241
242
|
"web-push": "web-push";
|
|
242
243
|
"mobile-push": "mobile-push";
|
|
243
|
-
email: "email";
|
|
244
244
|
}>;
|
|
245
245
|
enabled: z.ZodBoolean;
|
|
246
246
|
}, z.core.$strip>;
|
|
@@ -248,10 +248,10 @@ declare const notificationSetPreferenceOutputSchema: z.ZodObject<{
|
|
|
248
248
|
kind: z.ZodString;
|
|
249
249
|
channels: z.ZodArray<z.ZodObject<{
|
|
250
250
|
channel: z.ZodEnum<{
|
|
251
|
+
email: "email";
|
|
251
252
|
"in-app": "in-app";
|
|
252
253
|
"web-push": "web-push";
|
|
253
254
|
"mobile-push": "mobile-push";
|
|
254
|
-
email: "email";
|
|
255
255
|
}>;
|
|
256
256
|
enabled: z.ZodBoolean;
|
|
257
257
|
}, z.core.$strip>>;
|
|
@@ -7,15 +7,15 @@ declare const filterSchema: z.ZodObject<{
|
|
|
7
7
|
string: "string";
|
|
8
8
|
number: "number";
|
|
9
9
|
boolean: "boolean";
|
|
10
|
-
date: "date";
|
|
11
10
|
enum: "enum";
|
|
11
|
+
date: "date";
|
|
12
12
|
jsonArray: "jsonArray";
|
|
13
13
|
}>;
|
|
14
14
|
method: z.ZodEnum<{
|
|
15
|
-
contains: "contains";
|
|
16
|
-
equals: "equals";
|
|
17
15
|
starts_with: "starts_with";
|
|
18
16
|
ends_with: "ends_with";
|
|
17
|
+
contains: "contains";
|
|
18
|
+
equals: "equals";
|
|
19
19
|
greater_than: "greater_than";
|
|
20
20
|
less_than: "less_than";
|
|
21
21
|
on: "on";
|
|
@@ -39,15 +39,15 @@ declare const filtersSchema: z.ZodArray<z.ZodObject<{
|
|
|
39
39
|
string: "string";
|
|
40
40
|
number: "number";
|
|
41
41
|
boolean: "boolean";
|
|
42
|
-
date: "date";
|
|
43
42
|
enum: "enum";
|
|
43
|
+
date: "date";
|
|
44
44
|
jsonArray: "jsonArray";
|
|
45
45
|
}>;
|
|
46
46
|
method: z.ZodEnum<{
|
|
47
|
-
contains: "contains";
|
|
48
|
-
equals: "equals";
|
|
49
47
|
starts_with: "starts_with";
|
|
50
48
|
ends_with: "ends_with";
|
|
49
|
+
contains: "contains";
|
|
50
|
+
equals: "equals";
|
|
51
51
|
greater_than: "greater_than";
|
|
52
52
|
less_than: "less_than";
|
|
53
53
|
on: "on";
|
|
@@ -79,15 +79,15 @@ declare const querySchema: z.ZodObject<{
|
|
|
79
79
|
string: "string";
|
|
80
80
|
number: "number";
|
|
81
81
|
boolean: "boolean";
|
|
82
|
-
date: "date";
|
|
83
82
|
enum: "enum";
|
|
83
|
+
date: "date";
|
|
84
84
|
jsonArray: "jsonArray";
|
|
85
85
|
}>;
|
|
86
86
|
method: z.ZodEnum<{
|
|
87
|
-
contains: "contains";
|
|
88
|
-
equals: "equals";
|
|
89
87
|
starts_with: "starts_with";
|
|
90
88
|
ends_with: "ends_with";
|
|
89
|
+
contains: "contains";
|
|
90
|
+
equals: "equals";
|
|
91
91
|
greater_than: "greater_than";
|
|
92
92
|
less_than: "less_than";
|
|
93
93
|
on: "on";
|
|
@@ -7,15 +7,15 @@ declare const filterSchema: z.ZodObject<{
|
|
|
7
7
|
string: "string";
|
|
8
8
|
number: "number";
|
|
9
9
|
boolean: "boolean";
|
|
10
|
-
date: "date";
|
|
11
10
|
enum: "enum";
|
|
11
|
+
date: "date";
|
|
12
12
|
jsonArray: "jsonArray";
|
|
13
13
|
}>;
|
|
14
14
|
method: z.ZodEnum<{
|
|
15
|
-
contains: "contains";
|
|
16
|
-
equals: "equals";
|
|
17
15
|
starts_with: "starts_with";
|
|
18
16
|
ends_with: "ends_with";
|
|
17
|
+
contains: "contains";
|
|
18
|
+
equals: "equals";
|
|
19
19
|
greater_than: "greater_than";
|
|
20
20
|
less_than: "less_than";
|
|
21
21
|
on: "on";
|
|
@@ -39,15 +39,15 @@ declare const filtersSchema: z.ZodArray<z.ZodObject<{
|
|
|
39
39
|
string: "string";
|
|
40
40
|
number: "number";
|
|
41
41
|
boolean: "boolean";
|
|
42
|
-
date: "date";
|
|
43
42
|
enum: "enum";
|
|
43
|
+
date: "date";
|
|
44
44
|
jsonArray: "jsonArray";
|
|
45
45
|
}>;
|
|
46
46
|
method: z.ZodEnum<{
|
|
47
|
-
contains: "contains";
|
|
48
|
-
equals: "equals";
|
|
49
47
|
starts_with: "starts_with";
|
|
50
48
|
ends_with: "ends_with";
|
|
49
|
+
contains: "contains";
|
|
50
|
+
equals: "equals";
|
|
51
51
|
greater_than: "greater_than";
|
|
52
52
|
less_than: "less_than";
|
|
53
53
|
on: "on";
|
|
@@ -79,15 +79,15 @@ declare const querySchema: z.ZodObject<{
|
|
|
79
79
|
string: "string";
|
|
80
80
|
number: "number";
|
|
81
81
|
boolean: "boolean";
|
|
82
|
-
date: "date";
|
|
83
82
|
enum: "enum";
|
|
83
|
+
date: "date";
|
|
84
84
|
jsonArray: "jsonArray";
|
|
85
85
|
}>;
|
|
86
86
|
method: z.ZodEnum<{
|
|
87
|
-
contains: "contains";
|
|
88
|
-
equals: "equals";
|
|
89
87
|
starts_with: "starts_with";
|
|
90
88
|
ends_with: "ends_with";
|
|
89
|
+
contains: "contains";
|
|
90
|
+
equals: "equals";
|
|
91
91
|
greater_than: "greater_than";
|
|
92
92
|
less_than: "less_than";
|
|
93
93
|
on: "on";
|
|
@@ -37,15 +37,15 @@ declare const tagListInputSchema: z.ZodObject<{
|
|
|
37
37
|
string: "string";
|
|
38
38
|
number: "number";
|
|
39
39
|
boolean: "boolean";
|
|
40
|
-
date: "date";
|
|
41
40
|
enum: "enum";
|
|
41
|
+
date: "date";
|
|
42
42
|
jsonArray: "jsonArray";
|
|
43
43
|
}>;
|
|
44
44
|
method: z.ZodEnum<{
|
|
45
|
-
contains: "contains";
|
|
46
|
-
equals: "equals";
|
|
47
45
|
starts_with: "starts_with";
|
|
48
46
|
ends_with: "ends_with";
|
|
47
|
+
contains: "contains";
|
|
48
|
+
equals: "equals";
|
|
49
49
|
greater_than: "greater_than";
|
|
50
50
|
less_than: "less_than";
|
|
51
51
|
on: "on";
|
|
@@ -37,15 +37,15 @@ declare const tagListInputSchema: z.ZodObject<{
|
|
|
37
37
|
string: "string";
|
|
38
38
|
number: "number";
|
|
39
39
|
boolean: "boolean";
|
|
40
|
-
date: "date";
|
|
41
40
|
enum: "enum";
|
|
41
|
+
date: "date";
|
|
42
42
|
jsonArray: "jsonArray";
|
|
43
43
|
}>;
|
|
44
44
|
method: z.ZodEnum<{
|
|
45
|
-
contains: "contains";
|
|
46
|
-
equals: "equals";
|
|
47
45
|
starts_with: "starts_with";
|
|
48
46
|
ends_with: "ends_with";
|
|
47
|
+
contains: "contains";
|
|
48
|
+
equals: "equals";
|
|
49
49
|
greater_than: "greater_than";
|
|
50
50
|
less_than: "less_than";
|
|
51
51
|
on: "on";
|
|
@@ -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/*": {
|