@m5kdev/commons 0.38.19 → 0.38.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/modules/billing/billing.schema.d.cts +7 -7
- package/dist/src/modules/billing/billing.schema.d.mts +7 -7
- package/dist/src/modules/billing/billing.types.d.cts +2 -1
- package/dist/src/modules/billing/billing.types.d.mts +2 -1
- package/dist/src/modules/billing/billing.utils.cjs +14 -0
- package/dist/src/modules/billing/billing.utils.cjs.map +1 -1
- package/dist/src/modules/billing/billing.utils.d.cts +19 -1
- package/dist/src/modules/billing/billing.utils.d.mts +19 -1
- package/dist/src/modules/billing/billing.utils.mjs +13 -1
- package/dist/src/modules/billing/billing.utils.mjs.map +1 -1
- 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/schemas/query.schema.d.cts +6 -6
- package/dist/src/modules/schemas/query.schema.d.mts +6 -6
- package/dist/src/modules/tag/tag.schema.d.cts +2 -2
- package/dist/src/modules/tag/tag.schema.d.mts +2 -2
- package/package.json +2 -2
|
@@ -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
|
-
production: "production";
|
|
6
5
|
sandbox: "sandbox";
|
|
6
|
+
production: "production";
|
|
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
|
-
production: "production";
|
|
32
31
|
sandbox: "sandbox";
|
|
32
|
+
production: "production";
|
|
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
|
-
production: "production";
|
|
126
125
|
sandbox: "sandbox";
|
|
126
|
+
production: "production";
|
|
127
127
|
}>>>;
|
|
128
128
|
}, z.core.$strip>>;
|
|
129
129
|
coupon: z.ZodNullable<z.ZodObject<{
|
|
@@ -160,10 +160,10 @@ declare const billingAdminListInputSchema: z.ZodObject<{
|
|
|
160
160
|
jsonArray: "jsonArray";
|
|
161
161
|
}>;
|
|
162
162
|
method: z.ZodEnum<{
|
|
163
|
-
contains: "contains";
|
|
164
|
-
equals: "equals";
|
|
165
163
|
starts_with: "starts_with";
|
|
166
164
|
ends_with: "ends_with";
|
|
165
|
+
contains: "contains";
|
|
166
|
+
equals: "equals";
|
|
167
167
|
greater_than: "greater_than";
|
|
168
168
|
less_than: "less_than";
|
|
169
169
|
on: "on";
|
|
@@ -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
|
-
production: "production";
|
|
220
219
|
sandbox: "sandbox";
|
|
220
|
+
production: "production";
|
|
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
|
-
production: "production";
|
|
241
240
|
sandbox: "sandbox";
|
|
241
|
+
production: "production";
|
|
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
|
-
production: "production";
|
|
6
5
|
sandbox: "sandbox";
|
|
6
|
+
production: "production";
|
|
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
|
-
production: "production";
|
|
32
31
|
sandbox: "sandbox";
|
|
32
|
+
production: "production";
|
|
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
|
-
production: "production";
|
|
126
125
|
sandbox: "sandbox";
|
|
126
|
+
production: "production";
|
|
127
127
|
}>>>;
|
|
128
128
|
}, z.core.$strip>>;
|
|
129
129
|
coupon: z.ZodNullable<z.ZodObject<{
|
|
@@ -160,10 +160,10 @@ declare const billingAdminListInputSchema: z.ZodObject<{
|
|
|
160
160
|
jsonArray: "jsonArray";
|
|
161
161
|
}>;
|
|
162
162
|
method: z.ZodEnum<{
|
|
163
|
-
contains: "contains";
|
|
164
|
-
equals: "equals";
|
|
165
163
|
starts_with: "starts_with";
|
|
166
164
|
ends_with: "ends_with";
|
|
165
|
+
contains: "contains";
|
|
166
|
+
equals: "equals";
|
|
167
167
|
greater_than: "greater_than";
|
|
168
168
|
less_than: "less_than";
|
|
169
169
|
on: "on";
|
|
@@ -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
|
-
production: "production";
|
|
220
219
|
sandbox: "sandbox";
|
|
220
|
+
production: "production";
|
|
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
|
-
production: "production";
|
|
241
240
|
sandbox: "sandbox";
|
|
241
|
+
production: "production";
|
|
242
242
|
}>;
|
|
243
243
|
}, z.core.$strip>;
|
|
244
244
|
type BillingCoupon = z.infer<typeof billingCouponSchema>;
|
|
@@ -6,7 +6,8 @@ type StripePlanPrice = {
|
|
|
6
6
|
priceId: string;
|
|
7
7
|
interval: "day" | "week" | "month" | "year";
|
|
8
8
|
intervalCount: number;
|
|
9
|
-
unitAmount?: number;
|
|
9
|
+
unitAmount?: number; /** 0 means no trial for this Price. Omit to fall back to plan `freeTrial.days`. */
|
|
10
|
+
freeTrialDays?: number;
|
|
10
11
|
};
|
|
11
12
|
type StripePlanProduct = {
|
|
12
13
|
id: string;
|
|
@@ -6,7 +6,8 @@ type StripePlanPrice = {
|
|
|
6
6
|
priceId: string;
|
|
7
7
|
interval: "day" | "week" | "month" | "year";
|
|
8
8
|
intervalCount: number;
|
|
9
|
-
unitAmount?: number;
|
|
9
|
+
unitAmount?: number; /** 0 means no trial for this Price. Omit to fall back to plan `freeTrial.days`. */
|
|
10
|
+
freeTrialDays?: number;
|
|
10
11
|
};
|
|
11
12
|
type StripePlanProduct = {
|
|
12
13
|
id: string;
|
|
@@ -24,6 +24,18 @@ const formatPlanAmount = ({ unitAmount, currency }) => {
|
|
|
24
24
|
function listPlanPrices(plan) {
|
|
25
25
|
return Object.values(plan.products).flatMap((product) => product.prices);
|
|
26
26
|
}
|
|
27
|
+
function findPlanPrice({ plan, priceId }) {
|
|
28
|
+
return listPlanPrices(plan).find((price) => price.priceId === priceId);
|
|
29
|
+
}
|
|
30
|
+
function resolveTrialDays({ plan, price, priceId, fallbackDays }) {
|
|
31
|
+
const resolvedPrice = price ?? (priceId != null ? findPlanPrice({
|
|
32
|
+
plan,
|
|
33
|
+
priceId
|
|
34
|
+
}) : void 0);
|
|
35
|
+
if (resolvedPrice?.freeTrialDays != null) return resolvedPrice.freeTrialDays > 0 ? resolvedPrice.freeTrialDays : void 0;
|
|
36
|
+
if (plan.freeTrial?.days != null) return plan.freeTrial.days > 0 ? plan.freeTrial.days : void 0;
|
|
37
|
+
return fallbackDays != null && fallbackDays > 0 ? fallbackDays : void 0;
|
|
38
|
+
}
|
|
27
39
|
function catalogCurrencyKeys(plans) {
|
|
28
40
|
const keys = /* @__PURE__ */ new Set();
|
|
29
41
|
for (const plan of plans) for (const currency of Object.keys(plan.products)) keys.add(currency);
|
|
@@ -68,6 +80,7 @@ function formatBillingInterval({ interval, intervalCount }) {
|
|
|
68
80
|
exports.catalogCurrencyKeys = catalogCurrencyKeys;
|
|
69
81
|
exports.findDefaultTrialPrice = findDefaultTrialPrice;
|
|
70
82
|
exports.findPlanByPriceId = findPlanByPriceId;
|
|
83
|
+
exports.findPlanPrice = findPlanPrice;
|
|
71
84
|
exports.findPriceCurrency = findPriceCurrency;
|
|
72
85
|
exports.findTrialPlan = findTrialPlan;
|
|
73
86
|
exports.formatBillingInterval = formatBillingInterval;
|
|
@@ -75,5 +88,6 @@ exports.formatPlanAmount = formatPlanAmount;
|
|
|
75
88
|
exports.getEnvironmentPlans = getEnvironmentPlans;
|
|
76
89
|
exports.listPlanPrices = listPlanPrices;
|
|
77
90
|
exports.listPlanSelectPrices = listPlanSelectPrices;
|
|
91
|
+
exports.resolveTrialDays = resolveTrialDays;
|
|
78
92
|
|
|
79
93
|
//# 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 {\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,M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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
|
+
{"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 findPlanPrice({\r\n plan,\r\n priceId,\r\n}: {\r\n plan: StripePlan;\r\n priceId: string;\r\n}): StripePlanPrice | undefined {\r\n return listPlanPrices(plan).find((price) => price.priceId === priceId);\r\n}\r\n\r\nexport function resolveTrialDays({\r\n plan,\r\n price,\r\n priceId,\r\n fallbackDays,\r\n}: {\r\n plan: StripePlan;\r\n price?: StripePlanPrice;\r\n priceId?: string;\r\n fallbackDays?: number;\r\n}): number | undefined {\r\n const resolvedPrice = price ?? (priceId != null ? findPlanPrice({ plan, priceId }) : undefined);\r\n if (resolvedPrice?.freeTrialDays != null) {\r\n return resolvedPrice.freeTrialDays > 0 ? resolvedPrice.freeTrialDays : undefined;\r\n }\r\n if (plan.freeTrial?.days != null) {\r\n return plan.freeTrial.days > 0 ? plan.freeTrial.days : undefined;\r\n }\r\n return fallbackDays != null && fallbackDays > 0 ? fallbackDays : undefined;\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,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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"}
|
|
@@ -10,6 +10,24 @@ declare const formatPlanAmount: ({
|
|
|
10
10
|
currency: string;
|
|
11
11
|
}) => string;
|
|
12
12
|
declare function listPlanPrices(plan: StripePlan): StripePlanPrice[];
|
|
13
|
+
declare function findPlanPrice({
|
|
14
|
+
plan,
|
|
15
|
+
priceId
|
|
16
|
+
}: {
|
|
17
|
+
plan: StripePlan;
|
|
18
|
+
priceId: string;
|
|
19
|
+
}): StripePlanPrice | undefined;
|
|
20
|
+
declare function resolveTrialDays({
|
|
21
|
+
plan,
|
|
22
|
+
price,
|
|
23
|
+
priceId,
|
|
24
|
+
fallbackDays
|
|
25
|
+
}: {
|
|
26
|
+
plan: StripePlan;
|
|
27
|
+
price?: StripePlanPrice;
|
|
28
|
+
priceId?: string;
|
|
29
|
+
fallbackDays?: number;
|
|
30
|
+
}): number | undefined;
|
|
13
31
|
declare function catalogCurrencyKeys(plans: readonly StripePlan[]): string[];
|
|
14
32
|
declare function findPlanByPriceId(plans: readonly StripePlan[], priceId: string): StripePlan | undefined;
|
|
15
33
|
declare function findPriceCurrency(plan: StripePlan, priceId: string): string | undefined;
|
|
@@ -48,5 +66,5 @@ declare function formatBillingInterval({
|
|
|
48
66
|
intervalCount?: number | null;
|
|
49
67
|
}): string;
|
|
50
68
|
//#endregion
|
|
51
|
-
export { catalogCurrencyKeys, findDefaultTrialPrice, findPlanByPriceId, findPriceCurrency, findTrialPlan, formatBillingInterval, formatPlanAmount, getEnvironmentPlans, listPlanPrices, listPlanSelectPrices };
|
|
69
|
+
export { catalogCurrencyKeys, findDefaultTrialPrice, findPlanByPriceId, findPlanPrice, findPriceCurrency, findTrialPlan, formatBillingInterval, formatPlanAmount, getEnvironmentPlans, listPlanPrices, listPlanSelectPrices, resolveTrialDays };
|
|
52
70
|
//# sourceMappingURL=billing.utils.d.cts.map
|
|
@@ -10,6 +10,24 @@ declare const formatPlanAmount: ({
|
|
|
10
10
|
currency: string;
|
|
11
11
|
}) => string;
|
|
12
12
|
declare function listPlanPrices(plan: StripePlan): StripePlanPrice[];
|
|
13
|
+
declare function findPlanPrice({
|
|
14
|
+
plan,
|
|
15
|
+
priceId
|
|
16
|
+
}: {
|
|
17
|
+
plan: StripePlan;
|
|
18
|
+
priceId: string;
|
|
19
|
+
}): StripePlanPrice | undefined;
|
|
20
|
+
declare function resolveTrialDays({
|
|
21
|
+
plan,
|
|
22
|
+
price,
|
|
23
|
+
priceId,
|
|
24
|
+
fallbackDays
|
|
25
|
+
}: {
|
|
26
|
+
plan: StripePlan;
|
|
27
|
+
price?: StripePlanPrice;
|
|
28
|
+
priceId?: string;
|
|
29
|
+
fallbackDays?: number;
|
|
30
|
+
}): number | undefined;
|
|
13
31
|
declare function catalogCurrencyKeys(plans: readonly StripePlan[]): string[];
|
|
14
32
|
declare function findPlanByPriceId(plans: readonly StripePlan[], priceId: string): StripePlan | undefined;
|
|
15
33
|
declare function findPriceCurrency(plan: StripePlan, priceId: string): string | undefined;
|
|
@@ -48,5 +66,5 @@ declare function formatBillingInterval({
|
|
|
48
66
|
intervalCount?: number | null;
|
|
49
67
|
}): string;
|
|
50
68
|
//#endregion
|
|
51
|
-
export { catalogCurrencyKeys, findDefaultTrialPrice, findPlanByPriceId, findPriceCurrency, findTrialPlan, formatBillingInterval, formatPlanAmount, getEnvironmentPlans, listPlanPrices, listPlanSelectPrices };
|
|
69
|
+
export { catalogCurrencyKeys, findDefaultTrialPrice, findPlanByPriceId, findPlanPrice, findPriceCurrency, findTrialPlan, formatBillingInterval, formatPlanAmount, getEnvironmentPlans, listPlanPrices, listPlanSelectPrices, resolveTrialDays };
|
|
52
70
|
//# sourceMappingURL=billing.utils.d.mts.map
|
|
@@ -23,6 +23,18 @@ const formatPlanAmount = ({ unitAmount, currency }) => {
|
|
|
23
23
|
function listPlanPrices(plan) {
|
|
24
24
|
return Object.values(plan.products).flatMap((product) => product.prices);
|
|
25
25
|
}
|
|
26
|
+
function findPlanPrice({ plan, priceId }) {
|
|
27
|
+
return listPlanPrices(plan).find((price) => price.priceId === priceId);
|
|
28
|
+
}
|
|
29
|
+
function resolveTrialDays({ plan, price, priceId, fallbackDays }) {
|
|
30
|
+
const resolvedPrice = price ?? (priceId != null ? findPlanPrice({
|
|
31
|
+
plan,
|
|
32
|
+
priceId
|
|
33
|
+
}) : void 0);
|
|
34
|
+
if (resolvedPrice?.freeTrialDays != null) return resolvedPrice.freeTrialDays > 0 ? resolvedPrice.freeTrialDays : void 0;
|
|
35
|
+
if (plan.freeTrial?.days != null) return plan.freeTrial.days > 0 ? plan.freeTrial.days : void 0;
|
|
36
|
+
return fallbackDays != null && fallbackDays > 0 ? fallbackDays : void 0;
|
|
37
|
+
}
|
|
26
38
|
function catalogCurrencyKeys(plans) {
|
|
27
39
|
const keys = /* @__PURE__ */ new Set();
|
|
28
40
|
for (const plan of plans) for (const currency of Object.keys(plan.products)) keys.add(currency);
|
|
@@ -64,6 +76,6 @@ function formatBillingInterval({ interval, intervalCount }) {
|
|
|
64
76
|
return `Every ${count} ${interval}${count === 1 ? "" : "s"}`;
|
|
65
77
|
}
|
|
66
78
|
//#endregion
|
|
67
|
-
export { catalogCurrencyKeys, findDefaultTrialPrice, findPlanByPriceId, findPriceCurrency, findTrialPlan, formatBillingInterval, formatPlanAmount, getEnvironmentPlans, listPlanPrices, listPlanSelectPrices };
|
|
79
|
+
export { catalogCurrencyKeys, findDefaultTrialPrice, findPlanByPriceId, findPlanPrice, findPriceCurrency, findTrialPlan, formatBillingInterval, formatPlanAmount, getEnvironmentPlans, listPlanPrices, listPlanSelectPrices, resolveTrialDays };
|
|
68
80
|
|
|
69
81
|
//# 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 {\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;CAC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S,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
|
+
{"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 findPlanPrice({\r\n plan,\r\n priceId,\r\n}: {\r\n plan: StripePlan;\r\n priceId: string;\r\n}): StripePlanPrice | undefined {\r\n return listPlanPrices(plan).find((price) => price.priceId === priceId);\r\n}\r\n\r\nexport function resolveTrialDays({\r\n plan,\r\n price,\r\n priceId,\r\n fallbackDays,\r\n}: {\r\n plan: StripePlan;\r\n price?: StripePlanPrice;\r\n priceId?: string;\r\n fallbackDays?: number;\r\n}): number | undefined {\r\n const resolvedPrice = price ?? (priceId != null ? findPlanPrice({ plan, priceId }) : undefined);\r\n if (resolvedPrice?.freeTrialDays != null) {\r\n return resolvedPrice.freeTrialDays > 0 ? resolvedPrice.freeTrialDays : undefined;\r\n }\r\n if (plan.freeTrial?.days != null) {\r\n return plan.freeTrial.days > 0 ? plan.freeTrial.days : undefined;\r\n }\r\n return fallbackDays != null && fallbackDays > 0 ? fallbackDays : undefined;\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;EACv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,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"}
|
|
@@ -38,7 +38,6 @@ declare const recurrenceRulesSchema: z.ZodObject<{
|
|
|
38
38
|
}, z.core.$strip>;
|
|
39
39
|
declare const updateRecurrenceRulesSchema: z.ZodObject<{
|
|
40
40
|
id: z.ZodString;
|
|
41
|
-
interval: z.ZodNumber;
|
|
42
41
|
bysetpos: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
43
42
|
bymonth: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
44
43
|
bymonthday: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
@@ -50,6 +49,7 @@ declare const updateRecurrenceRulesSchema: z.ZodObject<{
|
|
|
50
49
|
bysecond: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
51
50
|
freq: z.ZodNumber;
|
|
52
51
|
dtstart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
52
|
+
interval: z.ZodNumber;
|
|
53
53
|
wkst: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
54
54
|
count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
55
55
|
until: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
@@ -61,7 +61,6 @@ declare const createRecurrenceSchema: z.ZodObject<{
|
|
|
61
61
|
enabled: z.ZodBoolean;
|
|
62
62
|
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
63
63
|
recurrenceRules: z.ZodArray<z.ZodObject<{
|
|
64
|
-
interval: z.ZodNumber;
|
|
65
64
|
bysetpos: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
66
65
|
bymonth: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
67
66
|
bymonthday: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
@@ -73,6 +72,7 @@ declare const createRecurrenceSchema: z.ZodObject<{
|
|
|
73
72
|
bysecond: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
74
73
|
freq: z.ZodNumber;
|
|
75
74
|
dtstart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
75
|
+
interval: z.ZodNumber;
|
|
76
76
|
wkst: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
77
77
|
count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
78
78
|
until: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
@@ -38,7 +38,6 @@ declare const recurrenceRulesSchema: z.ZodObject<{
|
|
|
38
38
|
}, z.core.$strip>;
|
|
39
39
|
declare const updateRecurrenceRulesSchema: z.ZodObject<{
|
|
40
40
|
id: z.ZodString;
|
|
41
|
-
interval: z.ZodNumber;
|
|
42
41
|
bysetpos: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
43
42
|
bymonth: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
44
43
|
bymonthday: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
@@ -50,6 +49,7 @@ declare const updateRecurrenceRulesSchema: z.ZodObject<{
|
|
|
50
49
|
bysecond: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
51
50
|
freq: z.ZodNumber;
|
|
52
51
|
dtstart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
52
|
+
interval: z.ZodNumber;
|
|
53
53
|
wkst: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
54
54
|
count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
55
55
|
until: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
@@ -61,7 +61,6 @@ declare const createRecurrenceSchema: z.ZodObject<{
|
|
|
61
61
|
enabled: z.ZodBoolean;
|
|
62
62
|
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
63
63
|
recurrenceRules: z.ZodArray<z.ZodObject<{
|
|
64
|
-
interval: z.ZodNumber;
|
|
65
64
|
bysetpos: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
66
65
|
bymonth: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
67
66
|
bymonthday: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
@@ -73,6 +72,7 @@ declare const createRecurrenceSchema: z.ZodObject<{
|
|
|
73
72
|
bysecond: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
74
73
|
freq: z.ZodNumber;
|
|
75
74
|
dtstart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
75
|
+
interval: z.ZodNumber;
|
|
76
76
|
wkst: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
77
77
|
count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
78
78
|
until: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
@@ -12,10 +12,10 @@ declare const filterSchema: z.ZodObject<{
|
|
|
12
12
|
jsonArray: "jsonArray";
|
|
13
13
|
}>;
|
|
14
14
|
method: z.ZodEnum<{
|
|
15
|
-
contains: "contains";
|
|
16
|
-
equals: "equals";
|
|
17
15
|
starts_with: "starts_with";
|
|
18
16
|
ends_with: "ends_with";
|
|
17
|
+
contains: "contains";
|
|
18
|
+
equals: "equals";
|
|
19
19
|
greater_than: "greater_than";
|
|
20
20
|
less_than: "less_than";
|
|
21
21
|
on: "on";
|
|
@@ -44,10 +44,10 @@ declare const filtersSchema: z.ZodArray<z.ZodObject<{
|
|
|
44
44
|
jsonArray: "jsonArray";
|
|
45
45
|
}>;
|
|
46
46
|
method: z.ZodEnum<{
|
|
47
|
-
contains: "contains";
|
|
48
|
-
equals: "equals";
|
|
49
47
|
starts_with: "starts_with";
|
|
50
48
|
ends_with: "ends_with";
|
|
49
|
+
contains: "contains";
|
|
50
|
+
equals: "equals";
|
|
51
51
|
greater_than: "greater_than";
|
|
52
52
|
less_than: "less_than";
|
|
53
53
|
on: "on";
|
|
@@ -84,10 +84,10 @@ declare const querySchema: z.ZodObject<{
|
|
|
84
84
|
jsonArray: "jsonArray";
|
|
85
85
|
}>;
|
|
86
86
|
method: z.ZodEnum<{
|
|
87
|
-
contains: "contains";
|
|
88
|
-
equals: "equals";
|
|
89
87
|
starts_with: "starts_with";
|
|
90
88
|
ends_with: "ends_with";
|
|
89
|
+
contains: "contains";
|
|
90
|
+
equals: "equals";
|
|
91
91
|
greater_than: "greater_than";
|
|
92
92
|
less_than: "less_than";
|
|
93
93
|
on: "on";
|
|
@@ -12,10 +12,10 @@ declare const filterSchema: z.ZodObject<{
|
|
|
12
12
|
jsonArray: "jsonArray";
|
|
13
13
|
}>;
|
|
14
14
|
method: z.ZodEnum<{
|
|
15
|
-
contains: "contains";
|
|
16
|
-
equals: "equals";
|
|
17
15
|
starts_with: "starts_with";
|
|
18
16
|
ends_with: "ends_with";
|
|
17
|
+
contains: "contains";
|
|
18
|
+
equals: "equals";
|
|
19
19
|
greater_than: "greater_than";
|
|
20
20
|
less_than: "less_than";
|
|
21
21
|
on: "on";
|
|
@@ -44,10 +44,10 @@ declare const filtersSchema: z.ZodArray<z.ZodObject<{
|
|
|
44
44
|
jsonArray: "jsonArray";
|
|
45
45
|
}>;
|
|
46
46
|
method: z.ZodEnum<{
|
|
47
|
-
contains: "contains";
|
|
48
|
-
equals: "equals";
|
|
49
47
|
starts_with: "starts_with";
|
|
50
48
|
ends_with: "ends_with";
|
|
49
|
+
contains: "contains";
|
|
50
|
+
equals: "equals";
|
|
51
51
|
greater_than: "greater_than";
|
|
52
52
|
less_than: "less_than";
|
|
53
53
|
on: "on";
|
|
@@ -84,10 +84,10 @@ declare const querySchema: z.ZodObject<{
|
|
|
84
84
|
jsonArray: "jsonArray";
|
|
85
85
|
}>;
|
|
86
86
|
method: z.ZodEnum<{
|
|
87
|
-
contains: "contains";
|
|
88
|
-
equals: "equals";
|
|
89
87
|
starts_with: "starts_with";
|
|
90
88
|
ends_with: "ends_with";
|
|
89
|
+
contains: "contains";
|
|
90
|
+
equals: "equals";
|
|
91
91
|
greater_than: "greater_than";
|
|
92
92
|
less_than: "less_than";
|
|
93
93
|
on: "on";
|
|
@@ -42,10 +42,10 @@ declare const tagListInputSchema: z.ZodObject<{
|
|
|
42
42
|
jsonArray: "jsonArray";
|
|
43
43
|
}>;
|
|
44
44
|
method: z.ZodEnum<{
|
|
45
|
-
contains: "contains";
|
|
46
|
-
equals: "equals";
|
|
47
45
|
starts_with: "starts_with";
|
|
48
46
|
ends_with: "ends_with";
|
|
47
|
+
contains: "contains";
|
|
48
|
+
equals: "equals";
|
|
49
49
|
greater_than: "greater_than";
|
|
50
50
|
less_than: "less_than";
|
|
51
51
|
on: "on";
|
|
@@ -42,10 +42,10 @@ declare const tagListInputSchema: z.ZodObject<{
|
|
|
42
42
|
jsonArray: "jsonArray";
|
|
43
43
|
}>;
|
|
44
44
|
method: z.ZodEnum<{
|
|
45
|
-
contains: "contains";
|
|
46
|
-
equals: "equals";
|
|
47
45
|
starts_with: "starts_with";
|
|
48
46
|
ends_with: "ends_with";
|
|
47
|
+
contains: "contains";
|
|
48
|
+
equals: "equals";
|
|
49
49
|
greater_than: "greater_than";
|
|
50
50
|
less_than: "less_than";
|
|
51
51
|
on: "on";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m5kdev/commons",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.20",
|
|
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.20"
|
|
25
25
|
},
|
|
26
26
|
"exports": {
|
|
27
27
|
"./utils/*": {
|