@m5kdev/commons 0.38.7 → 0.38.9
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/auth/auth.constants.cjs +2 -0
- package/dist/src/modules/auth/auth.constants.cjs.map +1 -1
- package/dist/src/modules/auth/auth.constants.d.cts +2 -1
- package/dist/src/modules/auth/auth.constants.d.mts +2 -1
- package/dist/src/modules/auth/auth.constants.mjs +2 -1
- package/dist/src/modules/auth/auth.constants.mjs.map +1 -1
- package/dist/src/modules/billing/billing.schema.cjs +2 -0
- package/dist/src/modules/billing/billing.schema.cjs.map +1 -1
- package/dist/src/modules/billing/billing.schema.d.cts +2 -0
- package/dist/src/modules/billing/billing.schema.d.mts +2 -0
- package/dist/src/modules/billing/billing.schema.mjs +2 -0
- package/dist/src/modules/billing/billing.schema.mjs.map +1 -1
- package/dist/src/modules/billing/billing.types.d.cts +19 -9
- package/dist/src/modules/billing/billing.types.d.mts +19 -9
- package/dist/src/modules/billing/billing.utils.cjs +52 -4
- package/dist/src/modules/billing/billing.utils.cjs.map +1 -1
- package/dist/src/modules/billing/billing.utils.d.cts +38 -2
- package/dist/src/modules/billing/billing.utils.d.mts +38 -2
- package/dist/src/modules/billing/billing.utils.mjs +45 -5
- 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
|
@@ -3,9 +3,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const ADMIN_CREATE_VERIFIED_USER_HEADER = "Admin-Create-Verified-User";
|
|
4
4
|
const ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE = "true";
|
|
5
5
|
const USER_LOCALE_HEADER = "User-Locale";
|
|
6
|
+
const USER_CURRENCY_HEADER = "User-Currency";
|
|
6
7
|
//#endregion
|
|
7
8
|
exports.ADMIN_CREATE_VERIFIED_USER_HEADER = ADMIN_CREATE_VERIFIED_USER_HEADER;
|
|
8
9
|
exports.ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE = ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE;
|
|
10
|
+
exports.USER_CURRENCY_HEADER = USER_CURRENCY_HEADER;
|
|
9
11
|
exports.USER_LOCALE_HEADER = USER_LOCALE_HEADER;
|
|
10
12
|
|
|
11
13
|
//# sourceMappingURL=auth.constants.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.constants.cjs","names":[],"sources":["../../../../src/modules/auth/auth.constants.ts"],"sourcesContent":["export const ADMIN_CREATE_VERIFIED_USER_HEADER = \"Admin-Create-Verified-User\" as const;\r\nexport const ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE = \"true\" as const;\r\nexport const USER_LOCALE_HEADER = \"User-Locale\" as const;\r\n"],"mappings":";;AAAA,MAAa,oCAAoC;AACjD,MAAa,0CAA0C;AACvD,MAAa,qBAAqB"}
|
|
1
|
+
{"version":3,"file":"auth.constants.cjs","names":[],"sources":["../../../../src/modules/auth/auth.constants.ts"],"sourcesContent":["export const ADMIN_CREATE_VERIFIED_USER_HEADER = \"Admin-Create-Verified-User\" as const;\r\nexport const ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE = \"true\" as const;\r\nexport const USER_LOCALE_HEADER = \"User-Locale\" as const;\r\nexport const USER_CURRENCY_HEADER = \"User-Currency\" as const;\r\n"],"mappings":";;AAAA,MAAa,oCAAoC;AACjD,MAAa,0CAA0C;AACvD,MAAa,qBAAqB;AAClC,MAAa,uBAAuB"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
declare const ADMIN_CREATE_VERIFIED_USER_HEADER: "Admin-Create-Verified-User";
|
|
3
3
|
declare const ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE: "true";
|
|
4
4
|
declare const USER_LOCALE_HEADER: "User-Locale";
|
|
5
|
+
declare const USER_CURRENCY_HEADER: "User-Currency";
|
|
5
6
|
//#endregion
|
|
6
|
-
export { ADMIN_CREATE_VERIFIED_USER_HEADER, ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE, USER_LOCALE_HEADER };
|
|
7
|
+
export { ADMIN_CREATE_VERIFIED_USER_HEADER, ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE, USER_CURRENCY_HEADER, USER_LOCALE_HEADER };
|
|
7
8
|
//# sourceMappingURL=auth.constants.d.cts.map
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
declare const ADMIN_CREATE_VERIFIED_USER_HEADER: "Admin-Create-Verified-User";
|
|
3
3
|
declare const ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE: "true";
|
|
4
4
|
declare const USER_LOCALE_HEADER: "User-Locale";
|
|
5
|
+
declare const USER_CURRENCY_HEADER: "User-Currency";
|
|
5
6
|
//#endregion
|
|
6
|
-
export { ADMIN_CREATE_VERIFIED_USER_HEADER, ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE, USER_LOCALE_HEADER };
|
|
7
|
+
export { ADMIN_CREATE_VERIFIED_USER_HEADER, ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE, USER_CURRENCY_HEADER, USER_LOCALE_HEADER };
|
|
7
8
|
//# sourceMappingURL=auth.constants.d.mts.map
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
const ADMIN_CREATE_VERIFIED_USER_HEADER = "Admin-Create-Verified-User";
|
|
3
3
|
const ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE = "true";
|
|
4
4
|
const USER_LOCALE_HEADER = "User-Locale";
|
|
5
|
+
const USER_CURRENCY_HEADER = "User-Currency";
|
|
5
6
|
//#endregion
|
|
6
|
-
export { ADMIN_CREATE_VERIFIED_USER_HEADER, ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE, USER_LOCALE_HEADER };
|
|
7
|
+
export { ADMIN_CREATE_VERIFIED_USER_HEADER, ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE, USER_CURRENCY_HEADER, USER_LOCALE_HEADER };
|
|
7
8
|
|
|
8
9
|
//# sourceMappingURL=auth.constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.constants.mjs","names":[],"sources":["../../../../src/modules/auth/auth.constants.ts"],"sourcesContent":["export const ADMIN_CREATE_VERIFIED_USER_HEADER = \"Admin-Create-Verified-User\" as const;\r\nexport const ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE = \"true\" as const;\r\nexport const USER_LOCALE_HEADER = \"User-Locale\" as const;\r\n"],"mappings":";AAAA,MAAa,oCAAoC;AACjD,MAAa,0CAA0C;AACvD,MAAa,qBAAqB"}
|
|
1
|
+
{"version":3,"file":"auth.constants.mjs","names":[],"sources":["../../../../src/modules/auth/auth.constants.ts"],"sourcesContent":["export const ADMIN_CREATE_VERIFIED_USER_HEADER = \"Admin-Create-Verified-User\" as const;\r\nexport const ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE = \"true\" as const;\r\nexport const USER_LOCALE_HEADER = \"User-Locale\" as const;\r\nexport const USER_CURRENCY_HEADER = \"User-Currency\" as const;\r\n"],"mappings":";AAAA,MAAa,oCAAoC;AACjD,MAAa,0CAA0C;AACvD,MAAa,qBAAqB;AAClC,MAAa,uBAAuB"}
|
|
@@ -19,6 +19,8 @@ const billingSchema = zod.z.object({
|
|
|
19
19
|
trialEnd: zod.z.date().nullish(),
|
|
20
20
|
priceId: zod.z.string().nullish(),
|
|
21
21
|
interval: zod.z.string().nullish(),
|
|
22
|
+
intervalCount: zod.z.number().nullish(),
|
|
23
|
+
intervalPicked: zod.z.boolean().nullish(),
|
|
22
24
|
unitAmount: zod.z.number().nullish(),
|
|
23
25
|
discounts: zod.z.array(zod.z.string()).nullish()
|
|
24
26
|
});
|
|
@@ -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 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":";;;AAEA,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,YAAYA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CAChC,WAAWA,IAAAA,EAAE,MAAMA,IAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS;CACzC,CAAC"}
|
|
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":";;;AAEA,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"}
|
|
@@ -19,6 +19,8 @@ declare const billingSchema: z.ZodObject<{
|
|
|
19
19
|
trialEnd: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
20
20
|
priceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
21
21
|
interval: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
|
+
intervalCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
23
|
+
intervalPicked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
22
24
|
unitAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
23
25
|
discounts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
24
26
|
}, z.core.$strip>;
|
|
@@ -19,6 +19,8 @@ declare const billingSchema: z.ZodObject<{
|
|
|
19
19
|
trialEnd: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
20
20
|
priceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
21
21
|
interval: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
|
+
intervalCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
23
|
+
intervalPicked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
22
24
|
unitAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
23
25
|
discounts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
24
26
|
}, z.core.$strip>;
|
|
@@ -18,6 +18,8 @@ const billingSchema = z.object({
|
|
|
18
18
|
trialEnd: z.date().nullish(),
|
|
19
19
|
priceId: z.string().nullish(),
|
|
20
20
|
interval: z.string().nullish(),
|
|
21
|
+
intervalCount: z.number().nullish(),
|
|
22
|
+
intervalPicked: z.boolean().nullish(),
|
|
21
23
|
unitAmount: z.number().nullish(),
|
|
22
24
|
discounts: z.array(z.string()).nullish()
|
|
23
25
|
});
|
|
@@ -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 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":";;AAEA,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,YAAY,EAAE,QAAQ,CAAC,SAAS;CAChC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,SAAS;CACzC,CAAC"}
|
|
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":";;AAEA,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"}
|
|
@@ -1,30 +1,40 @@
|
|
|
1
1
|
//#region src/modules/billing/billing.types.d.ts
|
|
2
|
+
type StripePlanPrice = {
|
|
3
|
+
priceId: string;
|
|
4
|
+
interval: "day" | "week" | "month" | "year";
|
|
5
|
+
intervalCount: number;
|
|
6
|
+
unitAmount?: number;
|
|
7
|
+
};
|
|
8
|
+
type StripePlanProduct = {
|
|
9
|
+
id: string;
|
|
10
|
+
prices: StripePlanPrice[];
|
|
11
|
+
defaultPriceId?: string;
|
|
12
|
+
};
|
|
2
13
|
type StripePlan = {
|
|
3
14
|
name: string;
|
|
4
|
-
|
|
5
|
-
priceUnitAmount?: number;
|
|
6
|
-
annualDiscountPriceId?: string;
|
|
7
|
-
annualPriceUnitAmount?: number;
|
|
15
|
+
products: Record<string, StripePlanProduct>;
|
|
8
16
|
freeTrial?: {
|
|
9
17
|
days: number;
|
|
10
18
|
seats?: number;
|
|
11
19
|
};
|
|
12
20
|
};
|
|
13
21
|
type StripePlansConfig = {
|
|
14
|
-
|
|
22
|
+
defaultCurrency: string;
|
|
23
|
+
trialRequiresPaymentMethod?: boolean;
|
|
24
|
+
trialPlanName?: Record<string, string>;
|
|
15
25
|
seatBilling?: boolean;
|
|
16
26
|
nonBillableRoleKeys?: readonly string[];
|
|
17
27
|
production: StripePlan[];
|
|
18
28
|
sandbox: StripePlan[];
|
|
19
|
-
trialPlanName?: string;
|
|
20
29
|
};
|
|
21
30
|
type ResolvedStripePlans = {
|
|
22
31
|
plans: StripePlan[];
|
|
23
|
-
|
|
24
|
-
|
|
32
|
+
trialPlanName: Record<string, string>;
|
|
33
|
+
trialRequiresPaymentMethod: boolean;
|
|
34
|
+
defaultCurrency: string;
|
|
25
35
|
seatBilling: boolean;
|
|
26
36
|
nonBillableRoleKeys: readonly string[];
|
|
27
37
|
};
|
|
28
38
|
//#endregion
|
|
29
|
-
export { ResolvedStripePlans, StripePlan, StripePlansConfig };
|
|
39
|
+
export { ResolvedStripePlans, StripePlan, StripePlanPrice, StripePlanProduct, StripePlansConfig };
|
|
30
40
|
//# sourceMappingURL=billing.types.d.cts.map
|
|
@@ -1,30 +1,40 @@
|
|
|
1
1
|
//#region src/modules/billing/billing.types.d.ts
|
|
2
|
+
type StripePlanPrice = {
|
|
3
|
+
priceId: string;
|
|
4
|
+
interval: "day" | "week" | "month" | "year";
|
|
5
|
+
intervalCount: number;
|
|
6
|
+
unitAmount?: number;
|
|
7
|
+
};
|
|
8
|
+
type StripePlanProduct = {
|
|
9
|
+
id: string;
|
|
10
|
+
prices: StripePlanPrice[];
|
|
11
|
+
defaultPriceId?: string;
|
|
12
|
+
};
|
|
2
13
|
type StripePlan = {
|
|
3
14
|
name: string;
|
|
4
|
-
|
|
5
|
-
priceUnitAmount?: number;
|
|
6
|
-
annualDiscountPriceId?: string;
|
|
7
|
-
annualPriceUnitAmount?: number;
|
|
15
|
+
products: Record<string, StripePlanProduct>;
|
|
8
16
|
freeTrial?: {
|
|
9
17
|
days: number;
|
|
10
18
|
seats?: number;
|
|
11
19
|
};
|
|
12
20
|
};
|
|
13
21
|
type StripePlansConfig = {
|
|
14
|
-
|
|
22
|
+
defaultCurrency: string;
|
|
23
|
+
trialRequiresPaymentMethod?: boolean;
|
|
24
|
+
trialPlanName?: Record<string, string>;
|
|
15
25
|
seatBilling?: boolean;
|
|
16
26
|
nonBillableRoleKeys?: readonly string[];
|
|
17
27
|
production: StripePlan[];
|
|
18
28
|
sandbox: StripePlan[];
|
|
19
|
-
trialPlanName?: string;
|
|
20
29
|
};
|
|
21
30
|
type ResolvedStripePlans = {
|
|
22
31
|
plans: StripePlan[];
|
|
23
|
-
|
|
24
|
-
|
|
32
|
+
trialPlanName: Record<string, string>;
|
|
33
|
+
trialRequiresPaymentMethod: boolean;
|
|
34
|
+
defaultCurrency: string;
|
|
25
35
|
seatBilling: boolean;
|
|
26
36
|
nonBillableRoleKeys: readonly string[];
|
|
27
37
|
};
|
|
28
38
|
//#endregion
|
|
29
|
-
export { ResolvedStripePlans, StripePlan, StripePlansConfig };
|
|
39
|
+
export { ResolvedStripePlans, StripePlan, StripePlanPrice, StripePlanProduct, StripePlansConfig };
|
|
30
40
|
//# sourceMappingURL=billing.types.d.mts.map
|
|
@@ -1,11 +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 plans = environment === "production" ? plansConfig.production : plansConfig.sandbox;
|
|
5
4
|
return {
|
|
6
|
-
plans,
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
plans: environment === "production" ? plansConfig.production : plansConfig.sandbox,
|
|
6
|
+
trialPlanName: plansConfig.trialPlanName ?? {},
|
|
7
|
+
trialRequiresPaymentMethod: plansConfig.trialRequiresPaymentMethod ?? false,
|
|
8
|
+
defaultCurrency: plansConfig.defaultCurrency,
|
|
9
9
|
seatBilling: plansConfig.seatBilling ?? false,
|
|
10
10
|
nonBillableRoleKeys: plansConfig.nonBillableRoleKeys ?? []
|
|
11
11
|
};
|
|
@@ -18,8 +18,56 @@ const formatPlanAmount = ({ unitAmount, currency }) => {
|
|
|
18
18
|
maximumFractionDigits: 2
|
|
19
19
|
}).format(unitAmount / 100);
|
|
20
20
|
};
|
|
21
|
+
function listPlanPrices(plan) {
|
|
22
|
+
return Object.values(plan.products).flatMap((product) => product.prices);
|
|
23
|
+
}
|
|
24
|
+
function catalogCurrencyKeys(plans) {
|
|
25
|
+
const keys = /* @__PURE__ */ new Set();
|
|
26
|
+
for (const plan of plans) for (const currency of Object.keys(plan.products)) keys.add(currency);
|
|
27
|
+
return [...keys];
|
|
28
|
+
}
|
|
29
|
+
function findPlanByPriceId(plans, priceId) {
|
|
30
|
+
return plans.find((plan) => listPlanPrices(plan).some((price) => price.priceId === priceId));
|
|
31
|
+
}
|
|
32
|
+
function findPriceCurrency(plan, priceId) {
|
|
33
|
+
for (const [currency, product] of Object.entries(plan.products)) if (product.prices.some((price) => price.priceId === priceId)) return currency;
|
|
34
|
+
}
|
|
35
|
+
function findTrialPlan({ plans, trialPlanName, currency }) {
|
|
36
|
+
const name = trialPlanName[currency];
|
|
37
|
+
if (!name) return void 0;
|
|
38
|
+
return plans.find((plan) => plan.name === name);
|
|
39
|
+
}
|
|
40
|
+
function findDefaultTrialPrice({ plan, currency }) {
|
|
41
|
+
const product = plan.products[currency];
|
|
42
|
+
if (!product?.defaultPriceId) return void 0;
|
|
43
|
+
return product.prices.find((price) => price.priceId === product.defaultPriceId);
|
|
44
|
+
}
|
|
45
|
+
function listPlanSelectPrices({ plan, currency, trialRequiresPaymentMethod }) {
|
|
46
|
+
const product = plan.products[currency];
|
|
47
|
+
if (!product) return [];
|
|
48
|
+
if (trialRequiresPaymentMethod && product.defaultPriceId) return product.prices.filter((price) => price.priceId === product.defaultPriceId);
|
|
49
|
+
return product.prices;
|
|
50
|
+
}
|
|
51
|
+
function formatBillingInterval({ interval, intervalCount }) {
|
|
52
|
+
const count = intervalCount ?? 1;
|
|
53
|
+
if (!interval) return "";
|
|
54
|
+
if (count === 1 && interval === "month") return "Monthly";
|
|
55
|
+
if (count === 1 && interval === "year") return "Yearly";
|
|
56
|
+
if (count === 1 && interval === "week") return "Weekly";
|
|
57
|
+
if (count === 1 && interval === "day") return "Daily";
|
|
58
|
+
if (interval === "month" && count === 3) return "Every 3 months";
|
|
59
|
+
return `Every ${count} ${interval}${count === 1 ? "" : "s"}`;
|
|
60
|
+
}
|
|
21
61
|
//#endregion
|
|
62
|
+
exports.catalogCurrencyKeys = catalogCurrencyKeys;
|
|
63
|
+
exports.findDefaultTrialPrice = findDefaultTrialPrice;
|
|
64
|
+
exports.findPlanByPriceId = findPlanByPriceId;
|
|
65
|
+
exports.findPriceCurrency = findPriceCurrency;
|
|
66
|
+
exports.findTrialPlan = findTrialPlan;
|
|
67
|
+
exports.formatBillingInterval = formatBillingInterval;
|
|
22
68
|
exports.formatPlanAmount = formatPlanAmount;
|
|
23
69
|
exports.getEnvironmentPlans = getEnvironmentPlans;
|
|
70
|
+
exports.listPlanPrices = listPlanPrices;
|
|
71
|
+
exports.listPlanSelectPrices = listPlanSelectPrices;
|
|
24
72
|
|
|
25
73
|
//# sourceMappingURL=billing.utils.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.utils.cjs","names":[],"sources":["../../../../src/modules/billing/billing.utils.ts"],"sourcesContent":["import type {
|
|
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;AAGxB,QAAO;EACL,OAHmB,gBAAgB,eACR,YAAY,aAAa,YAAY;EAGhE,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,4 +1,4 @@
|
|
|
1
|
-
import { ResolvedStripePlans, StripePlansConfig } from "./billing.types.cjs";
|
|
1
|
+
import { ResolvedStripePlans, StripePlan, StripePlanPrice, StripePlansConfig } from "./billing.types.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/modules/billing/billing.utils.d.ts
|
|
4
4
|
declare const getEnvironmentPlans: (plansConfig: StripePlansConfig, environment?: string) => ResolvedStripePlans;
|
|
@@ -9,6 +9,42 @@ declare const formatPlanAmount: ({
|
|
|
9
9
|
unitAmount: number;
|
|
10
10
|
currency: string;
|
|
11
11
|
}) => string;
|
|
12
|
+
declare function listPlanPrices(plan: StripePlan): StripePlanPrice[];
|
|
13
|
+
declare function catalogCurrencyKeys(plans: readonly StripePlan[]): string[];
|
|
14
|
+
declare function findPlanByPriceId(plans: readonly StripePlan[], priceId: string): StripePlan | undefined;
|
|
15
|
+
declare function findPriceCurrency(plan: StripePlan, priceId: string): string | undefined;
|
|
16
|
+
declare function findTrialPlan({
|
|
17
|
+
plans,
|
|
18
|
+
trialPlanName,
|
|
19
|
+
currency
|
|
20
|
+
}: {
|
|
21
|
+
plans: readonly StripePlan[];
|
|
22
|
+
trialPlanName: Record<string, string>;
|
|
23
|
+
currency: string;
|
|
24
|
+
}): StripePlan | undefined;
|
|
25
|
+
declare function findDefaultTrialPrice({
|
|
26
|
+
plan,
|
|
27
|
+
currency
|
|
28
|
+
}: {
|
|
29
|
+
plan: StripePlan;
|
|
30
|
+
currency: string;
|
|
31
|
+
}): StripePlanPrice | undefined;
|
|
32
|
+
declare function listPlanSelectPrices({
|
|
33
|
+
plan,
|
|
34
|
+
currency,
|
|
35
|
+
trialRequiresPaymentMethod
|
|
36
|
+
}: {
|
|
37
|
+
plan: StripePlan;
|
|
38
|
+
currency: string;
|
|
39
|
+
trialRequiresPaymentMethod?: boolean;
|
|
40
|
+
}): StripePlanPrice[];
|
|
41
|
+
declare function formatBillingInterval({
|
|
42
|
+
interval,
|
|
43
|
+
intervalCount
|
|
44
|
+
}: {
|
|
45
|
+
interval?: string | null;
|
|
46
|
+
intervalCount?: number | null;
|
|
47
|
+
}): string;
|
|
12
48
|
//#endregion
|
|
13
|
-
export { formatPlanAmount, getEnvironmentPlans };
|
|
49
|
+
export { catalogCurrencyKeys, findDefaultTrialPrice, findPlanByPriceId, findPriceCurrency, findTrialPlan, formatBillingInterval, formatPlanAmount, getEnvironmentPlans, listPlanPrices, listPlanSelectPrices };
|
|
14
50
|
//# sourceMappingURL=billing.utils.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ResolvedStripePlans, StripePlansConfig } from "./billing.types.mjs";
|
|
1
|
+
import { ResolvedStripePlans, StripePlan, StripePlanPrice, StripePlansConfig } from "./billing.types.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/modules/billing/billing.utils.d.ts
|
|
4
4
|
declare const getEnvironmentPlans: (plansConfig: StripePlansConfig, environment?: string) => ResolvedStripePlans;
|
|
@@ -9,6 +9,42 @@ declare const formatPlanAmount: ({
|
|
|
9
9
|
unitAmount: number;
|
|
10
10
|
currency: string;
|
|
11
11
|
}) => string;
|
|
12
|
+
declare function listPlanPrices(plan: StripePlan): StripePlanPrice[];
|
|
13
|
+
declare function catalogCurrencyKeys(plans: readonly StripePlan[]): string[];
|
|
14
|
+
declare function findPlanByPriceId(plans: readonly StripePlan[], priceId: string): StripePlan | undefined;
|
|
15
|
+
declare function findPriceCurrency(plan: StripePlan, priceId: string): string | undefined;
|
|
16
|
+
declare function findTrialPlan({
|
|
17
|
+
plans,
|
|
18
|
+
trialPlanName,
|
|
19
|
+
currency
|
|
20
|
+
}: {
|
|
21
|
+
plans: readonly StripePlan[];
|
|
22
|
+
trialPlanName: Record<string, string>;
|
|
23
|
+
currency: string;
|
|
24
|
+
}): StripePlan | undefined;
|
|
25
|
+
declare function findDefaultTrialPrice({
|
|
26
|
+
plan,
|
|
27
|
+
currency
|
|
28
|
+
}: {
|
|
29
|
+
plan: StripePlan;
|
|
30
|
+
currency: string;
|
|
31
|
+
}): StripePlanPrice | undefined;
|
|
32
|
+
declare function listPlanSelectPrices({
|
|
33
|
+
plan,
|
|
34
|
+
currency,
|
|
35
|
+
trialRequiresPaymentMethod
|
|
36
|
+
}: {
|
|
37
|
+
plan: StripePlan;
|
|
38
|
+
currency: string;
|
|
39
|
+
trialRequiresPaymentMethod?: boolean;
|
|
40
|
+
}): StripePlanPrice[];
|
|
41
|
+
declare function formatBillingInterval({
|
|
42
|
+
interval,
|
|
43
|
+
intervalCount
|
|
44
|
+
}: {
|
|
45
|
+
interval?: string | null;
|
|
46
|
+
intervalCount?: number | null;
|
|
47
|
+
}): string;
|
|
12
48
|
//#endregion
|
|
13
|
-
export { formatPlanAmount, getEnvironmentPlans };
|
|
49
|
+
export { catalogCurrencyKeys, findDefaultTrialPrice, findPlanByPriceId, findPriceCurrency, findTrialPlan, formatBillingInterval, formatPlanAmount, getEnvironmentPlans, listPlanPrices, listPlanSelectPrices };
|
|
14
50
|
//# sourceMappingURL=billing.utils.d.mts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
//#region src/modules/billing/billing.utils.ts
|
|
2
2
|
const getEnvironmentPlans = (plansConfig, environment = "sandbox") => {
|
|
3
|
-
const plans = environment === "production" ? plansConfig.production : plansConfig.sandbox;
|
|
4
3
|
return {
|
|
5
|
-
plans,
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
plans: environment === "production" ? plansConfig.production : plansConfig.sandbox,
|
|
5
|
+
trialPlanName: plansConfig.trialPlanName ?? {},
|
|
6
|
+
trialRequiresPaymentMethod: plansConfig.trialRequiresPaymentMethod ?? false,
|
|
7
|
+
defaultCurrency: plansConfig.defaultCurrency,
|
|
8
8
|
seatBilling: plansConfig.seatBilling ?? false,
|
|
9
9
|
nonBillableRoleKeys: plansConfig.nonBillableRoleKeys ?? []
|
|
10
10
|
};
|
|
@@ -17,7 +17,47 @@ const formatPlanAmount = ({ unitAmount, currency }) => {
|
|
|
17
17
|
maximumFractionDigits: 2
|
|
18
18
|
}).format(unitAmount / 100);
|
|
19
19
|
};
|
|
20
|
+
function listPlanPrices(plan) {
|
|
21
|
+
return Object.values(plan.products).flatMap((product) => product.prices);
|
|
22
|
+
}
|
|
23
|
+
function catalogCurrencyKeys(plans) {
|
|
24
|
+
const keys = /* @__PURE__ */ new Set();
|
|
25
|
+
for (const plan of plans) for (const currency of Object.keys(plan.products)) keys.add(currency);
|
|
26
|
+
return [...keys];
|
|
27
|
+
}
|
|
28
|
+
function findPlanByPriceId(plans, priceId) {
|
|
29
|
+
return plans.find((plan) => listPlanPrices(plan).some((price) => price.priceId === priceId));
|
|
30
|
+
}
|
|
31
|
+
function findPriceCurrency(plan, priceId) {
|
|
32
|
+
for (const [currency, product] of Object.entries(plan.products)) if (product.prices.some((price) => price.priceId === priceId)) return currency;
|
|
33
|
+
}
|
|
34
|
+
function findTrialPlan({ plans, trialPlanName, currency }) {
|
|
35
|
+
const name = trialPlanName[currency];
|
|
36
|
+
if (!name) return void 0;
|
|
37
|
+
return plans.find((plan) => plan.name === name);
|
|
38
|
+
}
|
|
39
|
+
function findDefaultTrialPrice({ plan, currency }) {
|
|
40
|
+
const product = plan.products[currency];
|
|
41
|
+
if (!product?.defaultPriceId) return void 0;
|
|
42
|
+
return product.prices.find((price) => price.priceId === product.defaultPriceId);
|
|
43
|
+
}
|
|
44
|
+
function listPlanSelectPrices({ plan, currency, trialRequiresPaymentMethod }) {
|
|
45
|
+
const product = plan.products[currency];
|
|
46
|
+
if (!product) return [];
|
|
47
|
+
if (trialRequiresPaymentMethod && product.defaultPriceId) return product.prices.filter((price) => price.priceId === product.defaultPriceId);
|
|
48
|
+
return product.prices;
|
|
49
|
+
}
|
|
50
|
+
function formatBillingInterval({ interval, intervalCount }) {
|
|
51
|
+
const count = intervalCount ?? 1;
|
|
52
|
+
if (!interval) return "";
|
|
53
|
+
if (count === 1 && interval === "month") return "Monthly";
|
|
54
|
+
if (count === 1 && interval === "year") return "Yearly";
|
|
55
|
+
if (count === 1 && interval === "week") return "Weekly";
|
|
56
|
+
if (count === 1 && interval === "day") return "Daily";
|
|
57
|
+
if (interval === "month" && count === 3) return "Every 3 months";
|
|
58
|
+
return `Every ${count} ${interval}${count === 1 ? "" : "s"}`;
|
|
59
|
+
}
|
|
20
60
|
//#endregion
|
|
21
|
-
export { formatPlanAmount, getEnvironmentPlans };
|
|
61
|
+
export { catalogCurrencyKeys, findDefaultTrialPrice, findPlanByPriceId, findPriceCurrency, findTrialPlan, formatBillingInterval, formatPlanAmount, getEnvironmentPlans, listPlanPrices, listPlanSelectPrices };
|
|
22
62
|
|
|
23
63
|
//# sourceMappingURL=billing.utils.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.utils.mjs","names":[],"sources":["../../../../src/modules/billing/billing.utils.ts"],"sourcesContent":["import type {
|
|
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;AAGxB,QAAO;EACL,OAHmB,gBAAgB,eACR,YAAY,aAAa,YAAY;EAGhE,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";
|
|
15
16
|
pending: "pending";
|
|
16
17
|
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";
|
|
91
90
|
"in-app": "in-app";
|
|
92
91
|
"web-push": "web-push";
|
|
93
92
|
"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";
|
|
103
102
|
"in-app": "in-app";
|
|
104
103
|
"web-push": "web-push";
|
|
105
104
|
"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";
|
|
116
117
|
pending: "pending";
|
|
117
118
|
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";
|
|
137
136
|
"in-app": "in-app";
|
|
138
137
|
"web-push": "web-push";
|
|
139
138
|
"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";
|
|
150
151
|
pending: "pending";
|
|
151
152
|
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";
|
|
207
206
|
"in-app": "in-app";
|
|
208
207
|
"web-push": "web-push";
|
|
209
208
|
"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";
|
|
218
217
|
"in-app": "in-app";
|
|
219
218
|
"web-push": "web-push";
|
|
220
219
|
"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";
|
|
230
229
|
"in-app": "in-app";
|
|
231
230
|
"web-push": "web-push";
|
|
232
231
|
"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";
|
|
241
240
|
"in-app": "in-app";
|
|
242
241
|
"web-push": "web-push";
|
|
243
242
|
"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";
|
|
252
251
|
"in-app": "in-app";
|
|
253
252
|
"web-push": "web-push";
|
|
254
253
|
"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";
|
|
15
16
|
pending: "pending";
|
|
16
17
|
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";
|
|
91
90
|
"in-app": "in-app";
|
|
92
91
|
"web-push": "web-push";
|
|
93
92
|
"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";
|
|
103
102
|
"in-app": "in-app";
|
|
104
103
|
"web-push": "web-push";
|
|
105
104
|
"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";
|
|
116
117
|
pending: "pending";
|
|
117
118
|
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";
|
|
137
136
|
"in-app": "in-app";
|
|
138
137
|
"web-push": "web-push";
|
|
139
138
|
"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";
|
|
150
151
|
pending: "pending";
|
|
151
152
|
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";
|
|
207
206
|
"in-app": "in-app";
|
|
208
207
|
"web-push": "web-push";
|
|
209
208
|
"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";
|
|
218
217
|
"in-app": "in-app";
|
|
219
218
|
"web-push": "web-push";
|
|
220
219
|
"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";
|
|
230
229
|
"in-app": "in-app";
|
|
231
230
|
"web-push": "web-push";
|
|
232
231
|
"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";
|
|
241
240
|
"in-app": "in-app";
|
|
242
241
|
"web-push": "web-push";
|
|
243
242
|
"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";
|
|
252
251
|
"in-app": "in-app";
|
|
253
252
|
"web-push": "web-push";
|
|
254
253
|
"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
|
-
enum: "enum";
|
|
11
10
|
date: "date";
|
|
11
|
+
enum: "enum";
|
|
12
12
|
jsonArray: "jsonArray";
|
|
13
13
|
}>;
|
|
14
14
|
method: z.ZodEnum<{
|
|
15
|
-
starts_with: "starts_with";
|
|
16
|
-
ends_with: "ends_with";
|
|
17
15
|
contains: "contains";
|
|
18
16
|
equals: "equals";
|
|
17
|
+
starts_with: "starts_with";
|
|
18
|
+
ends_with: "ends_with";
|
|
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
|
-
enum: "enum";
|
|
43
42
|
date: "date";
|
|
43
|
+
enum: "enum";
|
|
44
44
|
jsonArray: "jsonArray";
|
|
45
45
|
}>;
|
|
46
46
|
method: z.ZodEnum<{
|
|
47
|
-
starts_with: "starts_with";
|
|
48
|
-
ends_with: "ends_with";
|
|
49
47
|
contains: "contains";
|
|
50
48
|
equals: "equals";
|
|
49
|
+
starts_with: "starts_with";
|
|
50
|
+
ends_with: "ends_with";
|
|
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
|
-
enum: "enum";
|
|
83
82
|
date: "date";
|
|
83
|
+
enum: "enum";
|
|
84
84
|
jsonArray: "jsonArray";
|
|
85
85
|
}>;
|
|
86
86
|
method: z.ZodEnum<{
|
|
87
|
-
starts_with: "starts_with";
|
|
88
|
-
ends_with: "ends_with";
|
|
89
87
|
contains: "contains";
|
|
90
88
|
equals: "equals";
|
|
89
|
+
starts_with: "starts_with";
|
|
90
|
+
ends_with: "ends_with";
|
|
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
|
-
enum: "enum";
|
|
11
10
|
date: "date";
|
|
11
|
+
enum: "enum";
|
|
12
12
|
jsonArray: "jsonArray";
|
|
13
13
|
}>;
|
|
14
14
|
method: z.ZodEnum<{
|
|
15
|
-
starts_with: "starts_with";
|
|
16
|
-
ends_with: "ends_with";
|
|
17
15
|
contains: "contains";
|
|
18
16
|
equals: "equals";
|
|
17
|
+
starts_with: "starts_with";
|
|
18
|
+
ends_with: "ends_with";
|
|
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
|
-
enum: "enum";
|
|
43
42
|
date: "date";
|
|
43
|
+
enum: "enum";
|
|
44
44
|
jsonArray: "jsonArray";
|
|
45
45
|
}>;
|
|
46
46
|
method: z.ZodEnum<{
|
|
47
|
-
starts_with: "starts_with";
|
|
48
|
-
ends_with: "ends_with";
|
|
49
47
|
contains: "contains";
|
|
50
48
|
equals: "equals";
|
|
49
|
+
starts_with: "starts_with";
|
|
50
|
+
ends_with: "ends_with";
|
|
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
|
-
enum: "enum";
|
|
83
82
|
date: "date";
|
|
83
|
+
enum: "enum";
|
|
84
84
|
jsonArray: "jsonArray";
|
|
85
85
|
}>;
|
|
86
86
|
method: z.ZodEnum<{
|
|
87
|
-
starts_with: "starts_with";
|
|
88
|
-
ends_with: "ends_with";
|
|
89
87
|
contains: "contains";
|
|
90
88
|
equals: "equals";
|
|
89
|
+
starts_with: "starts_with";
|
|
90
|
+
ends_with: "ends_with";
|
|
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
|
-
enum: "enum";
|
|
41
40
|
date: "date";
|
|
41
|
+
enum: "enum";
|
|
42
42
|
jsonArray: "jsonArray";
|
|
43
43
|
}>;
|
|
44
44
|
method: z.ZodEnum<{
|
|
45
|
-
starts_with: "starts_with";
|
|
46
|
-
ends_with: "ends_with";
|
|
47
45
|
contains: "contains";
|
|
48
46
|
equals: "equals";
|
|
47
|
+
starts_with: "starts_with";
|
|
48
|
+
ends_with: "ends_with";
|
|
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
|
-
enum: "enum";
|
|
41
40
|
date: "date";
|
|
41
|
+
enum: "enum";
|
|
42
42
|
jsonArray: "jsonArray";
|
|
43
43
|
}>;
|
|
44
44
|
method: z.ZodEnum<{
|
|
45
|
-
starts_with: "starts_with";
|
|
46
|
-
ends_with: "ends_with";
|
|
47
45
|
contains: "contains";
|
|
48
46
|
equals: "equals";
|
|
47
|
+
starts_with: "starts_with";
|
|
48
|
+
ends_with: "ends_with";
|
|
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";
|
|
15
14
|
queued: "queued";
|
|
16
15
|
running: "running";
|
|
17
16
|
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";
|
|
32
31
|
queued: "queued";
|
|
33
32
|
running: "running";
|
|
34
33
|
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";
|
|
55
54
|
queued: "queued";
|
|
56
55
|
running: "running";
|
|
57
56
|
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";
|
|
77
76
|
queued: "queued";
|
|
78
77
|
running: "running";
|
|
79
78
|
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";
|
|
15
14
|
queued: "queued";
|
|
16
15
|
running: "running";
|
|
17
16
|
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";
|
|
32
31
|
queued: "queued";
|
|
33
32
|
running: "running";
|
|
34
33
|
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";
|
|
55
54
|
queued: "queued";
|
|
56
55
|
running: "running";
|
|
57
56
|
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";
|
|
77
76
|
queued: "queued";
|
|
78
77
|
running: "running";
|
|
79
78
|
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.9",
|
|
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.9"
|
|
25
25
|
},
|
|
26
26
|
"exports": {
|
|
27
27
|
"./utils/*": {
|