@m5kdev/commons 0.38.17 → 0.38.18
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.d.cts +5 -5
- package/dist/src/modules/billing/billing.schema.d.mts +5 -5
- package/dist/src/modules/billing/billing.utils.cjs +5 -2
- package/dist/src/modules/billing/billing.utils.cjs.map +1 -1
- package/dist/src/modules/billing/billing.utils.d.cts +3 -1
- package/dist/src/modules/billing/billing.utils.d.mts +3 -1
- package/dist/src/modules/billing/billing.utils.mjs +5 -2
- package/dist/src/modules/billing/billing.utils.mjs.map +1 -1
- package/dist/src/modules/notification/notification.schema.d.cts +3 -3
- package/dist/src/modules/notification/notification.schema.d.mts +3 -3
- package/dist/src/modules/recurrence/recurrence.schema.d.cts +2 -2
- package/dist/src/modules/recurrence/recurrence.schema.d.mts +2 -2
- package/dist/src/modules/workflow/workflow.schema.d.cts +4 -4
- package/dist/src/modules/workflow/workflow.schema.d.mts +4 -4
- package/package.json +2 -2
|
@@ -4,10 +4,12 @@ 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
6
|
const USER_CURRENCY_HEADER = "User-Currency";
|
|
7
|
+
const USER_PRICE_ID_HEADER = "User-Price-Id";
|
|
7
8
|
//#endregion
|
|
8
9
|
exports.ADMIN_CREATE_VERIFIED_USER_HEADER = ADMIN_CREATE_VERIFIED_USER_HEADER;
|
|
9
10
|
exports.ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE = ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE;
|
|
10
11
|
exports.USER_CURRENCY_HEADER = USER_CURRENCY_HEADER;
|
|
11
12
|
exports.USER_LOCALE_HEADER = USER_LOCALE_HEADER;
|
|
13
|
+
exports.USER_PRICE_ID_HEADER = USER_PRICE_ID_HEADER;
|
|
12
14
|
|
|
13
15
|
//# 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\nexport const USER_CURRENCY_HEADER = \"User-Currency\" as const;\r\n"],"mappings":";;AAAA,MAAa,oCAAoC;AACjD,MAAa,0CAA0C;AACvD,MAAa,qBAAqB;AAClC,MAAa,uBAAuB"}
|
|
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\nexport const USER_PRICE_ID_HEADER = \"User-Price-Id\" as const;\r\n"],"mappings":";;AAAA,MAAa,oCAAoC;AACjD,MAAa,0CAA0C;AACvD,MAAa,qBAAqB;AAClC,MAAa,uBAAuB;AACpC,MAAa,uBAAuB"}
|
|
@@ -3,6 +3,7 @@ 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
5
|
declare const USER_CURRENCY_HEADER: "User-Currency";
|
|
6
|
+
declare const USER_PRICE_ID_HEADER: "User-Price-Id";
|
|
6
7
|
//#endregion
|
|
7
|
-
export { ADMIN_CREATE_VERIFIED_USER_HEADER, ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE, USER_CURRENCY_HEADER, USER_LOCALE_HEADER };
|
|
8
|
+
export { ADMIN_CREATE_VERIFIED_USER_HEADER, ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE, USER_CURRENCY_HEADER, USER_LOCALE_HEADER, USER_PRICE_ID_HEADER };
|
|
8
9
|
//# sourceMappingURL=auth.constants.d.cts.map
|
|
@@ -3,6 +3,7 @@ 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
5
|
declare const USER_CURRENCY_HEADER: "User-Currency";
|
|
6
|
+
declare const USER_PRICE_ID_HEADER: "User-Price-Id";
|
|
6
7
|
//#endregion
|
|
7
|
-
export { ADMIN_CREATE_VERIFIED_USER_HEADER, ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE, USER_CURRENCY_HEADER, USER_LOCALE_HEADER };
|
|
8
|
+
export { ADMIN_CREATE_VERIFIED_USER_HEADER, ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE, USER_CURRENCY_HEADER, USER_LOCALE_HEADER, USER_PRICE_ID_HEADER };
|
|
8
9
|
//# sourceMappingURL=auth.constants.d.mts.map
|
|
@@ -3,7 +3,8 @@ 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
5
|
const USER_CURRENCY_HEADER = "User-Currency";
|
|
6
|
+
const USER_PRICE_ID_HEADER = "User-Price-Id";
|
|
6
7
|
//#endregion
|
|
7
|
-
export { ADMIN_CREATE_VERIFIED_USER_HEADER, ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE, USER_CURRENCY_HEADER, USER_LOCALE_HEADER };
|
|
8
|
+
export { ADMIN_CREATE_VERIFIED_USER_HEADER, ADMIN_CREATE_VERIFIED_USER_HEADER_VALUE, USER_CURRENCY_HEADER, USER_LOCALE_HEADER, USER_PRICE_ID_HEADER };
|
|
8
9
|
|
|
9
10
|
//# 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\nexport const USER_CURRENCY_HEADER = \"User-Currency\" as const;\r\n"],"mappings":";AAAA,MAAa,oCAAoC;AACjD,MAAa,0CAA0C;AACvD,MAAa,qBAAqB;AAClC,MAAa,uBAAuB"}
|
|
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\nexport const USER_PRICE_ID_HEADER = \"User-Price-Id\" as const;\r\n"],"mappings":";AAAA,MAAa,oCAAoC;AACjD,MAAa,0CAA0C;AACvD,MAAa,qBAAqB;AAClC,MAAa,uBAAuB;AACpC,MAAa,uBAAuB"}
|
|
@@ -2,8 +2,8 @@ import { z } from "zod";
|
|
|
2
2
|
|
|
3
3
|
//#region src/modules/billing/billing.schema.d.ts
|
|
4
4
|
declare const stripeEnvironmentSchema: z.ZodEnum<{
|
|
5
|
-
sandbox: "sandbox";
|
|
6
5
|
production: "production";
|
|
6
|
+
sandbox: "sandbox";
|
|
7
7
|
}>;
|
|
8
8
|
declare const billingSchema: z.ZodObject<{
|
|
9
9
|
id: z.ZodString;
|
|
@@ -28,8 +28,8 @@ declare const billingSchema: z.ZodObject<{
|
|
|
28
28
|
unitAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
29
29
|
discounts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
30
30
|
environment: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
31
|
-
sandbox: "sandbox";
|
|
32
31
|
production: "production";
|
|
32
|
+
sandbox: "sandbox";
|
|
33
33
|
}>>>;
|
|
34
34
|
}, z.core.$strip>;
|
|
35
35
|
type BillingSchema = z.infer<typeof billingSchema>;
|
|
@@ -122,8 +122,8 @@ declare const adminOrganizationBillingRowSchema: z.ZodObject<{
|
|
|
122
122
|
unitAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
123
123
|
discounts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
124
124
|
environment: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
125
|
-
sandbox: "sandbox";
|
|
126
125
|
production: "production";
|
|
126
|
+
sandbox: "sandbox";
|
|
127
127
|
}>>>;
|
|
128
128
|
}, z.core.$strip>>;
|
|
129
129
|
coupon: z.ZodNullable<z.ZodObject<{
|
|
@@ -216,8 +216,8 @@ declare const billingAdminListOutputSchema: z.ZodObject<{
|
|
|
216
216
|
unitAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
217
217
|
discounts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
218
218
|
environment: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
219
|
-
sandbox: "sandbox";
|
|
220
219
|
production: "production";
|
|
220
|
+
sandbox: "sandbox";
|
|
221
221
|
}>>>;
|
|
222
222
|
}, z.core.$strip>>;
|
|
223
223
|
coupon: z.ZodNullable<z.ZodObject<{
|
|
@@ -237,8 +237,8 @@ declare const billingAdminListOutputSchema: z.ZodObject<{
|
|
|
237
237
|
}, z.core.$strip>>;
|
|
238
238
|
total: z.ZodNumber;
|
|
239
239
|
environment: z.ZodEnum<{
|
|
240
|
-
sandbox: "sandbox";
|
|
241
240
|
production: "production";
|
|
241
|
+
sandbox: "sandbox";
|
|
242
242
|
}>;
|
|
243
243
|
}, z.core.$strip>;
|
|
244
244
|
type BillingCoupon = z.infer<typeof billingCouponSchema>;
|
|
@@ -2,8 +2,8 @@ import { z } from "zod";
|
|
|
2
2
|
|
|
3
3
|
//#region src/modules/billing/billing.schema.d.ts
|
|
4
4
|
declare const stripeEnvironmentSchema: z.ZodEnum<{
|
|
5
|
-
sandbox: "sandbox";
|
|
6
5
|
production: "production";
|
|
6
|
+
sandbox: "sandbox";
|
|
7
7
|
}>;
|
|
8
8
|
declare const billingSchema: z.ZodObject<{
|
|
9
9
|
id: z.ZodString;
|
|
@@ -28,8 +28,8 @@ declare const billingSchema: z.ZodObject<{
|
|
|
28
28
|
unitAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
29
29
|
discounts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
30
30
|
environment: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
31
|
-
sandbox: "sandbox";
|
|
32
31
|
production: "production";
|
|
32
|
+
sandbox: "sandbox";
|
|
33
33
|
}>>>;
|
|
34
34
|
}, z.core.$strip>;
|
|
35
35
|
type BillingSchema = z.infer<typeof billingSchema>;
|
|
@@ -122,8 +122,8 @@ declare const adminOrganizationBillingRowSchema: z.ZodObject<{
|
|
|
122
122
|
unitAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
123
123
|
discounts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
124
124
|
environment: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
125
|
-
sandbox: "sandbox";
|
|
126
125
|
production: "production";
|
|
126
|
+
sandbox: "sandbox";
|
|
127
127
|
}>>>;
|
|
128
128
|
}, z.core.$strip>>;
|
|
129
129
|
coupon: z.ZodNullable<z.ZodObject<{
|
|
@@ -216,8 +216,8 @@ declare const billingAdminListOutputSchema: z.ZodObject<{
|
|
|
216
216
|
unitAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
217
217
|
discounts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
218
218
|
environment: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
219
|
-
sandbox: "sandbox";
|
|
220
219
|
production: "production";
|
|
220
|
+
sandbox: "sandbox";
|
|
221
221
|
}>>>;
|
|
222
222
|
}, z.core.$strip>>;
|
|
223
223
|
coupon: z.ZodNullable<z.ZodObject<{
|
|
@@ -237,8 +237,8 @@ declare const billingAdminListOutputSchema: z.ZodObject<{
|
|
|
237
237
|
}, z.core.$strip>>;
|
|
238
238
|
total: z.ZodNumber;
|
|
239
239
|
environment: z.ZodEnum<{
|
|
240
|
-
sandbox: "sandbox";
|
|
241
240
|
production: "production";
|
|
241
|
+
sandbox: "sandbox";
|
|
242
242
|
}>;
|
|
243
243
|
}, z.core.$strip>;
|
|
244
244
|
type BillingCoupon = z.infer<typeof billingCouponSchema>;
|
|
@@ -45,10 +45,13 @@ function findDefaultTrialPrice({ plan, currency }) {
|
|
|
45
45
|
if (!product?.defaultPriceId) return void 0;
|
|
46
46
|
return product.prices.find((price) => price.priceId === product.defaultPriceId);
|
|
47
47
|
}
|
|
48
|
-
function listPlanSelectPrices({ plan, currency, trialRequiresPaymentMethod }) {
|
|
48
|
+
function listPlanSelectPrices({ plan, currency, trialRequiresPaymentMethod, trialPriceId }) {
|
|
49
49
|
const product = plan.products[currency];
|
|
50
50
|
if (!product) return [];
|
|
51
|
-
if (trialRequiresPaymentMethod && product.defaultPriceId)
|
|
51
|
+
if (trialRequiresPaymentMethod && product.defaultPriceId) {
|
|
52
|
+
const shownPriceId = product.prices.find((price) => price.priceId === trialPriceId)?.priceId ?? product.defaultPriceId;
|
|
53
|
+
return product.prices.filter((price) => price.priceId === shownPriceId);
|
|
54
|
+
}
|
|
52
55
|
return product.prices;
|
|
53
56
|
}
|
|
54
57
|
function formatBillingInterval({ interval, intervalCount }) {
|
|
@@ -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 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
|
|
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 trialPriceId,\r\n}: {\r\n plan: StripePlan;\r\n currency: string;\r\n trialRequiresPaymentMethod?: boolean;\r\n trialPriceId?: string | null;\r\n}): StripePlanPrice[] {\r\n const product = plan.products[currency];\r\n if (!product) return [];\r\n if (trialRequiresPaymentMethod && product.defaultPriceId) {\r\n const picked = product.prices.find((price) => price.priceId === trialPriceId);\r\n const shownPriceId = picked?.priceId ?? product.defaultPriceId;\r\n return product.prices.filter((price) => price.priceId === shownPriceId);\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,4BACA,gBAMoB;CACpB,MAAM,UAAU,KAAK,SAAS;AAC9B,KAAI,CAAC,QAAS,QAAO,EAAE;AACvB,KAAI,8BAA8B,QAAQ,gBAAgB;EAExD,MAAM,eADS,QAAQ,OAAO,MAAM,UAAU,MAAM,YAAY,aAAa,EAChD,WAAW,QAAQ;AAChD,SAAO,QAAQ,OAAO,QAAQ,UAAU,MAAM,YAAY,aAAa;;AAEzE,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"}
|
|
@@ -32,11 +32,13 @@ declare function findDefaultTrialPrice({
|
|
|
32
32
|
declare function listPlanSelectPrices({
|
|
33
33
|
plan,
|
|
34
34
|
currency,
|
|
35
|
-
trialRequiresPaymentMethod
|
|
35
|
+
trialRequiresPaymentMethod,
|
|
36
|
+
trialPriceId
|
|
36
37
|
}: {
|
|
37
38
|
plan: StripePlan;
|
|
38
39
|
currency: string;
|
|
39
40
|
trialRequiresPaymentMethod?: boolean;
|
|
41
|
+
trialPriceId?: string | null;
|
|
40
42
|
}): StripePlanPrice[];
|
|
41
43
|
declare function formatBillingInterval({
|
|
42
44
|
interval,
|
|
@@ -32,11 +32,13 @@ declare function findDefaultTrialPrice({
|
|
|
32
32
|
declare function listPlanSelectPrices({
|
|
33
33
|
plan,
|
|
34
34
|
currency,
|
|
35
|
-
trialRequiresPaymentMethod
|
|
35
|
+
trialRequiresPaymentMethod,
|
|
36
|
+
trialPriceId
|
|
36
37
|
}: {
|
|
37
38
|
plan: StripePlan;
|
|
38
39
|
currency: string;
|
|
39
40
|
trialRequiresPaymentMethod?: boolean;
|
|
41
|
+
trialPriceId?: string | null;
|
|
40
42
|
}): StripePlanPrice[];
|
|
41
43
|
declare function formatBillingInterval({
|
|
42
44
|
interval,
|
|
@@ -44,10 +44,13 @@ function findDefaultTrialPrice({ plan, currency }) {
|
|
|
44
44
|
if (!product?.defaultPriceId) return void 0;
|
|
45
45
|
return product.prices.find((price) => price.priceId === product.defaultPriceId);
|
|
46
46
|
}
|
|
47
|
-
function listPlanSelectPrices({ plan, currency, trialRequiresPaymentMethod }) {
|
|
47
|
+
function listPlanSelectPrices({ plan, currency, trialRequiresPaymentMethod, trialPriceId }) {
|
|
48
48
|
const product = plan.products[currency];
|
|
49
49
|
if (!product) return [];
|
|
50
|
-
if (trialRequiresPaymentMethod && product.defaultPriceId)
|
|
50
|
+
if (trialRequiresPaymentMethod && product.defaultPriceId) {
|
|
51
|
+
const shownPriceId = product.prices.find((price) => price.priceId === trialPriceId)?.priceId ?? product.defaultPriceId;
|
|
52
|
+
return product.prices.filter((price) => price.priceId === shownPriceId);
|
|
53
|
+
}
|
|
51
54
|
return product.prices;
|
|
52
55
|
}
|
|
53
56
|
function formatBillingInterval({ interval, intervalCount }) {
|
|
@@ -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 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
|
|
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 trialPriceId,\r\n}: {\r\n plan: StripePlan;\r\n currency: string;\r\n trialRequiresPaymentMethod?: boolean;\r\n trialPriceId?: string | null;\r\n}): StripePlanPrice[] {\r\n const product = plan.products[currency];\r\n if (!product) return [];\r\n if (trialRequiresPaymentMethod && product.defaultPriceId) {\r\n const picked = product.prices.find((price) => price.priceId === trialPriceId);\r\n const shownPriceId = picked?.priceId ?? product.defaultPriceId;\r\n return product.prices.filter((price) => price.priceId === shownPriceId);\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,4BACA,gBAMoB;CACpB,MAAM,UAAU,KAAK,SAAS;AAC9B,KAAI,CAAC,QAAS,QAAO,EAAE;AACvB,KAAI,8BAA8B,QAAQ,gBAAgB;EAExD,MAAM,eADS,QAAQ,OAAO,MAAM,UAAU,MAAM,YAAY,aAAa,EAChD,WAAW,QAAQ;AAChD,SAAO,QAAQ,OAAO,QAAQ,UAAU,MAAM,YAAY,aAAa;;AAEzE,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<{
|
|
@@ -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>;
|
|
@@ -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>;
|
|
@@ -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<{
|
|
@@ -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>;
|
|
@@ -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>;
|
|
@@ -38,6 +38,7 @@ declare const recurrenceRulesSchema: z.ZodObject<{
|
|
|
38
38
|
}, z.core.$strip>;
|
|
39
39
|
declare const updateRecurrenceRulesSchema: z.ZodObject<{
|
|
40
40
|
id: z.ZodString;
|
|
41
|
+
interval: z.ZodNumber;
|
|
41
42
|
bysetpos: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
42
43
|
bymonth: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
43
44
|
bymonthday: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
@@ -49,7 +50,6 @@ declare const updateRecurrenceRulesSchema: z.ZodObject<{
|
|
|
49
50
|
bysecond: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
50
51
|
freq: z.ZodNumber;
|
|
51
52
|
dtstart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
52
|
-
interval: z.ZodNumber;
|
|
53
53
|
wkst: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
54
54
|
count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
55
55
|
until: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
@@ -61,6 +61,7 @@ declare const createRecurrenceSchema: z.ZodObject<{
|
|
|
61
61
|
enabled: z.ZodBoolean;
|
|
62
62
|
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
63
63
|
recurrenceRules: z.ZodArray<z.ZodObject<{
|
|
64
|
+
interval: z.ZodNumber;
|
|
64
65
|
bysetpos: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
65
66
|
bymonth: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
66
67
|
bymonthday: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
@@ -72,7 +73,6 @@ declare const createRecurrenceSchema: z.ZodObject<{
|
|
|
72
73
|
bysecond: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
73
74
|
freq: z.ZodNumber;
|
|
74
75
|
dtstart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
75
|
-
interval: z.ZodNumber;
|
|
76
76
|
wkst: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
77
77
|
count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
78
78
|
until: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
@@ -38,6 +38,7 @@ declare const recurrenceRulesSchema: z.ZodObject<{
|
|
|
38
38
|
}, z.core.$strip>;
|
|
39
39
|
declare const updateRecurrenceRulesSchema: z.ZodObject<{
|
|
40
40
|
id: z.ZodString;
|
|
41
|
+
interval: z.ZodNumber;
|
|
41
42
|
bysetpos: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
42
43
|
bymonth: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
43
44
|
bymonthday: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
@@ -49,7 +50,6 @@ declare const updateRecurrenceRulesSchema: z.ZodObject<{
|
|
|
49
50
|
bysecond: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
50
51
|
freq: z.ZodNumber;
|
|
51
52
|
dtstart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
52
|
-
interval: z.ZodNumber;
|
|
53
53
|
wkst: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
54
54
|
count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
55
55
|
until: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
@@ -61,6 +61,7 @@ declare const createRecurrenceSchema: z.ZodObject<{
|
|
|
61
61
|
enabled: z.ZodBoolean;
|
|
62
62
|
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
63
63
|
recurrenceRules: z.ZodArray<z.ZodObject<{
|
|
64
|
+
interval: z.ZodNumber;
|
|
64
65
|
bysetpos: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
65
66
|
bymonth: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
66
67
|
bymonthday: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
@@ -72,7 +73,6 @@ declare const createRecurrenceSchema: z.ZodObject<{
|
|
|
72
73
|
bysecond: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
73
74
|
freq: z.ZodNumber;
|
|
74
75
|
dtstart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
75
|
-
interval: z.ZodNumber;
|
|
76
76
|
wkst: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
77
77
|
count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
78
78
|
until: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
@@ -11,10 +11,10 @@ declare const workflowSelectSchema: z.ZodObject<{
|
|
|
11
11
|
input: z.ZodUnknown;
|
|
12
12
|
output: z.ZodUnknown;
|
|
13
13
|
status: z.ZodEnum<{
|
|
14
|
-
failed: "failed";
|
|
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.18",
|
|
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.18"
|
|
25
25
|
},
|
|
26
26
|
"exports": {
|
|
27
27
|
"./utils/*": {
|