@hexclave/shared 1.0.53 → 1.0.54
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/{admin-interface-D9wMduWc.d.ts → admin-interface-DuboQXpC.d.ts} +11 -11
- package/dist/{admin-interface-D9wMduWc.d.ts.map → admin-interface-DuboQXpC.d.ts.map} +1 -1
- package/dist/{admin-metrics-bsOkw4YQ.d.ts → admin-metrics-IxLyJ-cP.d.ts} +18 -18
- package/dist/{admin-metrics-bsOkw4YQ.d.ts.map → admin-metrics-IxLyJ-cP.d.ts.map} +1 -1
- package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js +4 -4
- package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js.map +1 -1
- package/dist/{client-interface-BQz4jNAC.d.ts → client-interface-Ca6UZywk.d.ts} +9 -9
- package/dist/{client-interface-BQz4jNAC.d.ts.map → client-interface-Ca6UZywk.d.ts.map} +1 -1
- package/dist/config/schema.d.ts +1 -1
- package/dist/config-authoring.d.ts +1 -1
- package/dist/config-rendering.d.ts +9 -1
- package/dist/config-rendering.d.ts.map +1 -1
- package/dist/config-rendering.js +2 -2
- package/dist/config-rendering.js.map +1 -1
- package/dist/{current-user-BBoN3hsn.d.ts → current-user-DNxac4sS.d.ts} +15 -15
- package/dist/{current-user-BBoN3hsn.d.ts.map → current-user-DNxac4sS.d.ts.map} +1 -1
- package/dist/dates-BRAvSk6L.d.ts.map +1 -1
- package/dist/{email-outbox-B1wmVPRG.d.ts → email-outbox-ILs0LlGd.d.ts} +185 -185
- package/dist/{email-outbox-B1wmVPRG.d.ts.map → email-outbox-ILs0LlGd.d.ts.map} +1 -1
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js +4 -4
- package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js.map +1 -1
- package/dist/esm/config/schema.d.ts +99 -99
- package/dist/esm/config-rendering.d.ts +9 -1
- package/dist/esm/config-rendering.d.ts.map +1 -1
- package/dist/esm/config-rendering.js +2 -3
- package/dist/esm/config-rendering.js.map +1 -1
- package/dist/esm/interface/admin-metrics.d.ts +17 -17
- package/dist/esm/interface/conversations.d.ts +10 -10
- package/dist/esm/interface/crud/current-user.d.ts +14 -14
- package/dist/esm/interface/crud/email-outbox.d.ts +184 -184
- package/dist/esm/interface/crud/products.d.ts +17 -17
- package/dist/esm/interface/crud/project-api-keys.d.ts +4 -4
- package/dist/esm/interface/crud/projects.d.ts +28 -28
- package/dist/esm/interface/crud/team-member-profiles.d.ts +24 -24
- package/dist/esm/interface/crud/transactions.d.ts +15 -15
- package/dist/esm/interface/crud/transactions.d.ts.map +1 -1
- package/dist/esm/interface/crud/users.d.ts +16 -16
- package/dist/esm/interface/plan-usage.d.ts +1 -1
- package/dist/esm/interface/webhooks.d.ts +2 -2
- package/dist/esm/known-errors.d.ts +3 -3
- package/dist/esm/package.json +18 -0
- package/dist/esm/schema-fields.d.ts +5 -5
- package/dist/esm/sessions.d.ts +8 -8
- package/dist/esm/utils/dates.d.ts.map +1 -1
- package/dist/esm/utils/dates.js +2 -1
- package/dist/esm/utils/dates.js.map +1 -1
- package/dist/helpers/password.d.ts +1 -1
- package/dist/helpers/production-mode.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/interface/admin-interface.d.ts +2 -2
- package/dist/interface/admin-metrics.d.ts +1 -1
- package/dist/interface/client-interface.d.ts +1 -1
- package/dist/interface/conversations.d.ts +10 -10
- package/dist/interface/crud/current-user.d.ts +1 -1
- package/dist/interface/crud/email-outbox.d.ts +1 -1
- package/dist/interface/crud/products.d.ts +1 -1
- package/dist/interface/crud/project-api-keys.d.ts +1 -1
- package/dist/interface/crud/projects.d.ts +1 -1
- package/dist/interface/crud/team-member-profiles.d.ts +1 -1
- package/dist/interface/crud/transactions.d.ts +1 -1
- package/dist/interface/crud/users.d.ts +1 -1
- package/dist/interface/plan-usage.d.ts +1 -1
- package/dist/interface/server-interface.d.ts +1 -1
- package/dist/interface/webhooks.d.ts +1 -1
- package/dist/{known-errors-Bm4a61wL.d.ts → known-errors-g7JC8z58.d.ts} +4 -4
- package/dist/{known-errors-Bm4a61wL.d.ts.map → known-errors-g7JC8z58.d.ts.map} +1 -1
- package/dist/known-errors.d.ts +1 -1
- package/dist/{plan-usage-BaDxcLZ1.d.ts → plan-usage-D0kWw4HR.d.ts} +2 -2
- package/dist/{plan-usage-BaDxcLZ1.d.ts.map → plan-usage-D0kWw4HR.d.ts.map} +1 -1
- package/dist/{products-D4o8A2W0.d.ts → products-C98fCS-1.d.ts} +18 -18
- package/dist/{products-D4o8A2W0.d.ts.map → products-C98fCS-1.d.ts.map} +1 -1
- package/dist/{project-api-keys--7V5X_UW.d.ts → project-api-keys-P97ElZZe.d.ts} +5 -5
- package/dist/{project-api-keys--7V5X_UW.d.ts.map → project-api-keys-P97ElZZe.d.ts.map} +1 -1
- package/dist/{projects-CFTNXRfG.d.ts → projects-BM2a4sfO.d.ts} +29 -29
- package/dist/{projects-CFTNXRfG.d.ts.map → projects-BM2a4sfO.d.ts.map} +1 -1
- package/dist/{schema-DV0SQUbY.d.ts → schema-Bq1TSMFV.d.ts} +100 -100
- package/dist/{schema-DV0SQUbY.d.ts.map → schema-Bq1TSMFV.d.ts.map} +1 -1
- package/dist/{schema-fields-DZtDQEEO.d.ts → schema-fields-Cch3V5nd.d.ts} +6 -6
- package/dist/{schema-fields-DZtDQEEO.d.ts.map → schema-fields-Cch3V5nd.d.ts.map} +1 -1
- package/dist/schema-fields.d.ts +1 -1
- package/dist/{server-interface-BjY-eS4Q.d.ts → server-interface-yKuDPrQI.d.ts} +8 -8
- package/dist/{server-interface-BjY-eS4Q.d.ts.map → server-interface-yKuDPrQI.d.ts.map} +1 -1
- package/dist/{sessions-CI-0TBQb.d.ts → sessions-DCTyJhi3.d.ts} +10 -10
- package/dist/{sessions-CI-0TBQb.d.ts.map → sessions-DCTyJhi3.d.ts.map} +1 -1
- package/dist/sessions.d.ts +1 -1
- package/dist/{team-member-profiles-BoDEqx-0.d.ts → team-member-profiles-CaD1OJqt.d.ts} +25 -25
- package/dist/{team-member-profiles-BoDEqx-0.d.ts.map → team-member-profiles-CaD1OJqt.d.ts.map} +1 -1
- package/dist/{transactions-CHNUJ42J.d.ts → transactions-CrAZLdGo.d.ts} +16 -16
- package/dist/transactions-CrAZLdGo.d.ts.map +1 -0
- package/dist/{users-DHNRwoSz.d.ts → users-DSpJgn9Z.d.ts} +18 -18
- package/dist/{users-DHNRwoSz.d.ts.map → users-DSpJgn9Z.d.ts.map} +1 -1
- package/dist/utils/dates.js +2 -1
- package/dist/utils/dates.js.map +1 -1
- package/dist/{webhooks-8Ts1Clcb.d.ts → webhooks-_aXIgZBW.d.ts} +3 -3
- package/dist/{webhooks-8Ts1Clcb.d.ts.map → webhooks-_aXIgZBW.d.ts.map} +1 -1
- package/package.json +1 -1
- package/src/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.ts +4 -4
- package/src/config-rendering.ts +5 -6
- package/src/utils/dates.tsx +22 -1
- package/dist/transactions-CHNUJ42J.d.ts.map +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hexclave/shared",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"exports": {
|
|
5
|
+
".": {
|
|
6
|
+
"types": "./index.d.ts",
|
|
7
|
+
"default": "./index.js"
|
|
8
|
+
},
|
|
9
|
+
"./config": {
|
|
10
|
+
"types": "./config-authoring.d.ts",
|
|
11
|
+
"default": "./config-authoring.js"
|
|
12
|
+
},
|
|
13
|
+
"./dist/*": {
|
|
14
|
+
"types": "./*.d.ts",
|
|
15
|
+
"default": "./*.js"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -174,7 +174,7 @@ declare const customDashboardsSchema: yup$1.MixedSchema<Record<string, {
|
|
|
174
174
|
displayName: string;
|
|
175
175
|
tsxSource: string;
|
|
176
176
|
}>, yup$1.AnyObject, undefined, "">;
|
|
177
|
-
declare const customerTypeSchema: yup$1.StringSchema<"
|
|
177
|
+
declare const customerTypeSchema: yup$1.StringSchema<"user" | "team" | "custom" | undefined, yup$1.AnyObject, undefined, "">;
|
|
178
178
|
/**
|
|
179
179
|
* Schema for a single product price. Each currency field (USD, EUR, etc.) is a decimal string
|
|
180
180
|
* like `"9.99"` or `"1000"` — never cent integers. See `MoneyAmount` for the exact format.
|
|
@@ -218,7 +218,7 @@ declare const productSchema: yup$1.ObjectSchema<{
|
|
|
218
218
|
displayName: string | undefined;
|
|
219
219
|
productLineId: string | undefined;
|
|
220
220
|
isAddOnTo: false | Record<string, true> | undefined;
|
|
221
|
-
customerType: "
|
|
221
|
+
customerType: "user" | "team" | "custom";
|
|
222
222
|
freeTrial: DayInterval | undefined;
|
|
223
223
|
serverOnly: boolean | undefined;
|
|
224
224
|
stackable: boolean | undefined;
|
|
@@ -257,7 +257,7 @@ declare const productSchemaWithMetadata: yup$1.ObjectSchema<{
|
|
|
257
257
|
displayName: string | undefined;
|
|
258
258
|
productLineId: string | undefined;
|
|
259
259
|
isAddOnTo: false | Record<string, true> | undefined;
|
|
260
|
-
customerType: "
|
|
260
|
+
customerType: "user" | "team" | "custom";
|
|
261
261
|
freeTrial: DayInterval | undefined;
|
|
262
262
|
serverOnly: boolean | undefined;
|
|
263
263
|
stackable: boolean | undefined;
|
|
@@ -298,7 +298,7 @@ declare const productSchemaWithMetadata: yup$1.ObjectSchema<{
|
|
|
298
298
|
}, "">;
|
|
299
299
|
declare const inlineProductSchema: yup$1.ObjectSchema<{
|
|
300
300
|
display_name: string;
|
|
301
|
-
customer_type: "
|
|
301
|
+
customer_type: "user" | "team" | "custom";
|
|
302
302
|
free_trial: DayInterval | undefined;
|
|
303
303
|
server_only: boolean;
|
|
304
304
|
stackable: boolean;
|
|
@@ -314,8 +314,8 @@ declare const inlineProductSchema: yup$1.ObjectSchema<{
|
|
|
314
314
|
free_trial?: DayInterval | undefined;
|
|
315
315
|
}>;
|
|
316
316
|
included_items: Record<string, {
|
|
317
|
-
quantity?: number | undefined;
|
|
318
317
|
repeat?: "never" | DayInterval | undefined;
|
|
318
|
+
quantity?: number | undefined;
|
|
319
319
|
expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
|
|
320
320
|
}>;
|
|
321
321
|
client_metadata: {} | null | undefined;
|
package/dist/esm/sessions.d.ts
CHANGED
|
@@ -9,24 +9,24 @@ declare class AccessToken {
|
|
|
9
9
|
private constructor();
|
|
10
10
|
get payload(): {
|
|
11
11
|
exp?: number | undefined;
|
|
12
|
-
|
|
13
|
-
refresh_token_id: string;
|
|
14
|
-
email: string | null;
|
|
15
|
-
restricted_reason: {
|
|
16
|
-
type: "anonymous" | "email_not_verified" | "restricted_by_administrator";
|
|
17
|
-
} | null;
|
|
18
|
-
branch_id: string;
|
|
12
|
+
name: string | null;
|
|
19
13
|
sub: string;
|
|
20
14
|
iat: number;
|
|
21
15
|
iss: string;
|
|
22
16
|
aud: string;
|
|
17
|
+
project_id: string;
|
|
18
|
+
branch_id: string;
|
|
19
|
+
refresh_token_id: string;
|
|
23
20
|
role: "authenticated";
|
|
24
|
-
|
|
21
|
+
email: string | null;
|
|
25
22
|
email_verified: boolean;
|
|
26
23
|
selected_team_id: string | null;
|
|
27
24
|
signed_up_at: number;
|
|
28
25
|
is_anonymous: boolean;
|
|
29
26
|
is_restricted: boolean;
|
|
27
|
+
restricted_reason: {
|
|
28
|
+
type: "anonymous" | "email_not_verified" | "restricted_by_administrator";
|
|
29
|
+
} | null;
|
|
30
30
|
requires_totp_mfa: boolean;
|
|
31
31
|
};
|
|
32
32
|
get expiresAt(): Date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dates.d.ts","names":[],"sources":["../../../src/utils/dates.tsx"],"mappings":";iBAIgB,SAAA,CAAU,IAAU,EAAJ,IAAI;AAAA,iBAuBpB,OAAA,CAAQ,IAAU,EAAJ,IAAI;AAAA,iBAiClB,eAAA,CAAgB,IAAA,EAAM,IAAI;EACxC,MAAA;EAzD8B;AAAI;AAuBpC;EAsCE,kBAAA;AAAA;;AAtCgC;AAiClC;iBAkDgB,2BAAA,CAA4B,IAAU,EAAJ,IAAI;AAAA,KAkC1C,QAAA;AAAA,KACA,WAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"dates.d.ts","names":[],"sources":["../../../src/utils/dates.tsx"],"mappings":";iBAIgB,SAAA,CAAU,IAAU,EAAJ,IAAI;AAAA,iBAuBpB,OAAA,CAAQ,IAAU,EAAJ,IAAI;AAAA,iBAiClB,eAAA,CAAgB,IAAA,EAAM,IAAI;EACxC,MAAA;EAzD8B;AAAI;AAuBpC;EAsCE,kBAAA;AAAA;;AAtCgC;AAiClC;iBAkDgB,2BAAA,CAA4B,IAAU,EAAJ,IAAI;AAAA,KAkC1C,QAAA;AAAA,KACA,WAAA;AAAA,iBAmDI,gBAAA,CAAiB,IAAA,EAAM,IAAA,EAAM,QAAA,EAAU,QAAA,GAAW,IAAA;AAAA,iBASlD,WAAA,CAAY,IAAA,EAAM,IAAA,EAAM,QAAA,EAAU,QAAA,GAAW,IAAA;AAAA,cAqBhD,eAAA,EAAe,IAA6B;AAAA,iBAgBzC,mBAAA,CAAoB,MAAA,EAAQ,IAAA,EAAM,EAAA,EAAI,IAAA,EAAM,MAAA,EAAQ,WAAA;;AAjLhD;AA6CpB;;;;AAAsD;AAkCtD;;;;AAAoB;AACpB;;;;iBAkJgB,oBAAA,CAAqB,YAAA,UAAsB,QAAA,EAAU,WAAW,EAAE,UAAA"}
|
package/dist/esm/utils/dates.js
CHANGED
|
@@ -54,8 +54,9 @@ function getInputDatetimeLocalString(date) {
|
|
|
54
54
|
date.setMinutes(date.getMinutes() - date.getTimezoneOffset());
|
|
55
55
|
return date.toISOString().slice(0, 19);
|
|
56
56
|
}
|
|
57
|
-
function applyInterval(
|
|
57
|
+
function applyInterval(inputDate, times, interval) {
|
|
58
58
|
if (!intervalSchema.isValidSync(interval)) throw new HexclaveAssertionError(`Invalid interval`, { interval });
|
|
59
|
+
const date = new Date(inputDate);
|
|
59
60
|
const [amount, unit] = interval;
|
|
60
61
|
switch (unit) {
|
|
61
62
|
case "millisecond":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dates.js","names":[],"sources":["../../../src/utils/dates.tsx"],"sourcesContent":["import { intervalSchema } from \"../schema-fields\";\nimport { HexclaveAssertionError } from \"./errors\";\nimport { remainder } from \"./math\";\n\nexport function isWeekend(date: Date): boolean {\n return date.getDay() === 0 || date.getDay() === 6;\n}\n\nimport.meta.vitest?.test(\"isWeekend\", ({ expect }) => {\n // Sunday (day 0)\n expect(isWeekend(new Date(2023, 0, 1))).toBe(true);\n // Saturday (day 6)\n expect(isWeekend(new Date(2023, 0, 7))).toBe(true);\n // Monday (day 1)\n expect(isWeekend(new Date(2023, 0, 2))).toBe(false);\n // Friday (day 5)\n expect(isWeekend(new Date(2023, 0, 6))).toBe(false);\n});\n\nconst agoUnits = [\n [60, 'second'],\n [60, 'minute'],\n [24, 'hour'],\n [7, 'day'],\n [5, 'week'],\n] as const;\n\nexport function fromNow(date: Date): string {\n return fromNowDetailed(date).result;\n}\n\nimport.meta.vitest?.test(\"fromNow\", ({ expect }) => {\n // Set a fixed date for testing\n const fixedDate = new Date(\"2023-01-15T12:00:00.000Z\");\n\n // Use Vitest's fake timers\n import.meta.vitest?.vi.useFakeTimers();\n import.meta.vitest?.vi.setSystemTime(fixedDate);\n\n // Test past times\n expect(fromNow(new Date(\"2023-01-15T11:59:50.000Z\"))).toBe(\"just now\");\n expect(fromNow(new Date(\"2023-01-15T11:59:00.000Z\"))).toBe(\"1 minute ago\");\n expect(fromNow(new Date(\"2023-01-15T11:00:00.000Z\"))).toBe(\"1 hour ago\");\n expect(fromNow(new Date(\"2023-01-14T12:00:00.000Z\"))).toBe(\"1 day ago\");\n expect(fromNow(new Date(\"2023-01-08T12:00:00.000Z\"))).toBe(\"1 week ago\");\n\n // Test future times\n expect(fromNow(new Date(\"2023-01-15T12:00:10.000Z\"))).toBe(\"just now\");\n expect(fromNow(new Date(\"2023-01-15T12:01:00.000Z\"))).toBe(\"in 1 minute\");\n expect(fromNow(new Date(\"2023-01-15T13:00:00.000Z\"))).toBe(\"in 1 hour\");\n expect(fromNow(new Date(\"2023-01-16T12:00:00.000Z\"))).toBe(\"in 1 day\");\n expect(fromNow(new Date(\"2023-01-22T12:00:00.000Z\"))).toBe(\"in 1 week\");\n\n // Test very old dates (should use date format)\n expect(fromNow(new Date(\"2022-01-15T12:00:00.000Z\"))).toMatch(/Jan 15, 2022/);\n\n // Restore real timers\n import.meta.vitest?.vi.useRealTimers();\n});\n\nexport function fromNowDetailed(date: Date): {\n result: string,\n /**\n * May be Infinity if the result will never change.\n */\n secondsUntilChange: number,\n} {\n if (!(date instanceof Date)) {\n throw new Error(`fromNow only accepts Date objects (received: ${date})`);\n }\n\n const now = new Date();\n const elapsed = now.getTime() - date.getTime();\n\n let remainingInUnit = Math.abs(elapsed) / 1000;\n if (remainingInUnit < 15) {\n return {\n result: 'just now',\n secondsUntilChange: 15 - remainingInUnit,\n };\n }\n let unitInSeconds = 1;\n for (const [nextUnitSize, unitName] of agoUnits) {\n const rounded = Math.round(remainingInUnit);\n if (rounded < nextUnitSize) {\n if (elapsed < 0) {\n return {\n result: `in ${rounded} ${unitName}${rounded === 1 ? '' : 's'}`,\n secondsUntilChange: remainder((remainingInUnit - rounded + 0.5) * unitInSeconds, unitInSeconds),\n };\n } else {\n return {\n result: `${rounded} ${unitName}${rounded === 1 ? '' : 's'} ago`,\n secondsUntilChange: remainder((rounded - remainingInUnit - 0.5) * unitInSeconds, unitInSeconds),\n };\n }\n }\n unitInSeconds *= nextUnitSize;\n remainingInUnit /= nextUnitSize;\n }\n\n return {\n result: date.toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' }),\n secondsUntilChange: Infinity,\n };\n}\n\n/**\n * Returns a string representation of the given date in the format expected by the `datetime-local` input type.\n */\nexport function getInputDatetimeLocalString(date: Date): string {\n date = new Date(date);\n date.setMinutes(date.getMinutes() - date.getTimezoneOffset());\n return date.toISOString().slice(0, 19);\n}\n\nimport.meta.vitest?.test(\"getInputDatetimeLocalString\", ({ expect }) => {\n // Use Vitest's fake timers to ensure consistent timezone behavior\n import.meta.vitest?.vi.useFakeTimers();\n\n // Test with a specific date\n const mockDate = new Date(\"2023-01-15T12:30:45.000Z\");\n const result = getInputDatetimeLocalString(mockDate);\n\n // The result should be in the format YYYY-MM-DDTHH:MM:SS\n expect(result).toMatch(/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$/);\n\n // Test with different dates\n const dates = [\n new Date(\"2023-01-01T00:00:00.000Z\"),\n new Date(\"2023-06-15T23:59:59.000Z\"),\n new Date(\"2023-12-31T12:34:56.000Z\"),\n ];\n\n for (const date of dates) {\n const result = getInputDatetimeLocalString(date);\n expect(result).toMatch(/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$/);\n }\n\n // Restore real timers\n import.meta.vitest?.vi.useRealTimers();\n});\n\n\nexport type Interval = [number, 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'];\nexport type DayInterval = [number, 'day' | 'week' | 'month' | 'year'];\n\nfunction applyInterval(date: Date, times: number, interval: Interval): Date {\n if (!intervalSchema.isValidSync(interval)) {\n throw new HexclaveAssertionError(`Invalid interval`, { interval });\n }\n const [amount, unit] = interval;\n switch (unit) {\n case 'millisecond': {\n date.setMilliseconds(date.getMilliseconds() + amount * times);\n break;\n }\n case 'second': {\n date.setSeconds(date.getSeconds() + amount * times);\n break;\n }\n case 'minute': {\n date.setMinutes(date.getMinutes() + amount * times);\n break;\n }\n case 'hour': {\n date.setHours(date.getHours() + amount * times);\n break;\n }\n case 'day': {\n date.setDate(date.getDate() + amount * times);\n break;\n }\n case 'week': {\n date.setDate(date.getDate() + amount * times * 7);\n break;\n }\n case 'month': {\n date.setMonth(date.getMonth() + amount * times);\n break;\n }\n case 'year': {\n date.setFullYear(date.getFullYear() + amount * times);\n break;\n }\n default: {\n throw new HexclaveAssertionError(`Invalid interval despite schema validation`, { interval });\n }\n }\n return date;\n}\n\nexport function subtractInterval(date: Date, interval: Interval): Date {\n return applyInterval(date, -1, interval);\n}\n\n// One-shot local-time interval arithmetic that OVERFLOWS (Jan 31 + 1 month -> Mar 3, via\n// Date#setMonth) rather than clamping. Use this for single-step period math where JS/Stripe overflow\n// semantics are what we want (e.g. computing a subscription's currentPeriodEnd). For recurring\n// grant/reset BOUNDARIES, use `nthDayIntervalMillis` / `getIntervalsElapsed` instead — they clamp to\n// month-end and compute in UTC from a fixed anchor, and mixing the two would drift.\nexport function addInterval(date: Date, interval: Interval): Date {\n return applyInterval(date, 1, interval);\n}\n\nexport const FAR_FUTURE_DATE = new Date(8640000000000000); // 13 Sep 275760 00:00:00 UTC\n\nfunction getMsPerDayIntervalUnit(unit: 'day' | 'week'): number {\n if (unit === 'day') {\n return 24 * 60 * 60 * 1000;\n }\n return 7 * 24 * 60 * 60 * 1000;\n}\n\n\n// The number of full `repeat` intervals elapsed from `anchor` up to (and including) `to`, i.e. the\n// largest n >= 0 with the n-th boundary <= to. Boundaries are the SAME ones `nthDayIntervalMillis`\n// computes (anchor-relative, UTC, month-end clamped), so counting and boundary-computation never\n// disagree — a Jan 31 monthly anchor has elapsed one interval by Feb 28, matching the reset the\n// bulldozer item-repeat fold actually emits. (This is why it must NOT be built on `addInterval`,\n// which is local-time and overflows instead of clamping.)\nexport function getIntervalsElapsed(anchor: Date, to: Date, repeat: DayInterval): number {\n const [amount, unit] = repeat;\n const toMillis = to.getTime();\n if (toMillis <= anchor.getTime()) return 0;\n if (unit === 'day' || unit === 'week') {\n const msPerUnit = getMsPerDayIntervalUnit(unit);\n const diffMs = toMillis - anchor.getTime();\n return Math.floor(diffMs / (msPerUnit * amount));\n }\n // month/year: walk anchor-relative boundaries. The count is small in practice (bounded by the\n // number of billing periods since the anchor), so a linear walk is fine.\n let count = 0;\n while (nthDayIntervalMillis(anchor.getTime(), repeat, count + 1) <= toMillis) count += 1;\n return count;\n}\n\nimport.meta.vitest?.test(\"getIntervalsElapsed\", ({ expect }) => {\n const anchor = new Date('2025-01-01T00:00:00.000Z');\n const to = new Date('2025-01-15T00:00:00.000Z');\n expect(getIntervalsElapsed(anchor, to, [1, 'week'])).toBe(2);\n expect(getIntervalsElapsed(anchor, to, [3, 'day'])).toBe(4);\n\n // Jan 31 monthly anchor: the first boundary is clamped to Feb 28, which is <= Mar 1, so one\n // interval has elapsed (anchor-relative clamped math, consistent with nthDayIntervalMillis).\n const mAnchor = new Date('2023-01-31T00:00:00.000Z');\n const mTo = new Date('2023-03-01T00:00:00.000Z');\n expect(getIntervalsElapsed(mAnchor, mTo, [1, 'month'])).toBe(1);\n\n const yAnchor = new Date('2020-01-01T00:00:00.000Z');\n const yTo = new Date('2022-06-01T00:00:00.000Z');\n expect(getIntervalsElapsed(yAnchor, yTo, [1, 'year'])).toBe(2);\n});\n\n/**\n * The UTC millis of the `occurrence`-th (1-based) repeat of `interval` after `anchorMillis`.\n *\n * Each boundary is computed from the *original* anchor (never by stepping off the previous, possibly\n * clamped, boundary) so the anchor's day-of-month is preserved across resets: a Jan 31 anchor yields\n * Feb 28, Mar 31, Apr 30, ... (matching Stripe's billing-cycle behavior) rather than drifting to\n * Feb 28, Mar 28, ... . Month/year overflow (e.g. Jan 31 -> Feb) is clamped to the target month's\n * last day. Day/week are exact multiples (no calendar involved, so no drift possible).\n *\n * Everything is done in UTC (unlike `addInterval`, which uses local-time Date accessors) so the\n * result is deterministic regardless of the server's timezone — this is relied upon by bulldozer\n * folds, which must be reproducible across machines.\n *\n * `occurrence` 0 returns the anchor itself; `getIntervalsElapsed` counts these same boundaries, so\n * the two are always consistent for a given DayInterval.\n */\nexport function nthDayIntervalMillis(anchorMillis: number, interval: DayInterval, occurrence: number): number {\n const [count, unit] = interval;\n const totalUnits = count * occurrence;\n if (unit === 'day' || unit === 'week') {\n return anchorMillis + totalUnits * getMsPerDayIntervalUnit(unit);\n }\n const anchor = new Date(anchorMillis);\n const monthsToAdd = unit === 'year' ? totalUnits * 12 : totalUnits;\n const absoluteMonth = anchor.getUTCFullYear() * 12 + anchor.getUTCMonth() + monthsToAdd;\n const targetYear = Math.floor(absoluteMonth / 12);\n const targetMonth = absoluteMonth - targetYear * 12;\n // Day 0 of the following month is the last day of the target month, so this gives its length.\n const daysInTargetMonth = new Date(Date.UTC(targetYear, targetMonth + 1, 0)).getUTCDate();\n const clampedDay = Math.min(anchor.getUTCDate(), daysInTargetMonth);\n return Date.UTC(\n targetYear,\n targetMonth,\n clampedDay,\n anchor.getUTCHours(),\n anchor.getUTCMinutes(),\n anchor.getUTCSeconds(),\n anchor.getUTCMilliseconds(),\n );\n}\n\nimport.meta.vitest?.test(\"nthDayIntervalMillis\", ({ expect }) => {\n const at = (iso: string) => new Date(iso).getTime();\n const iso = (millis: number) => new Date(millis).toISOString();\n\n // day / week are exact multiples (no drift), and honor the count.\n const dayAnchor = at('2025-01-01T08:30:00.000Z');\n expect(iso(nthDayIntervalMillis(dayAnchor, [1, 'day'], 1))).toBe('2025-01-02T08:30:00.000Z');\n expect(iso(nthDayIntervalMillis(dayAnchor, [3, 'day'], 4))).toBe('2025-01-13T08:30:00.000Z');\n expect(iso(nthDayIntervalMillis(dayAnchor, [2, 'week'], 3))).toBe('2025-02-12T08:30:00.000Z'); // 6 weeks = 42 days after Jan 1\n\n // Jan 31 monthly: clamp in short months, restore to the anchor day in long ones.\n const jan31 = at('2025-01-31T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(jan31, [1, 'month'], 1))).toBe('2025-02-28T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(jan31, [1, 'month'], 2))).toBe('2025-03-31T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(jan31, [1, 'month'], 3))).toBe('2025-04-30T00:00:00.000Z');\n\n // Anchor-day preservation: a Feb 28 anchor stays on day 28 (never jumps to Mar 31), unlike the\n // Jan 31 anchor above which restores to Mar 31. This is the evidence we compute from the anchor.\n const feb28 = at('2025-02-28T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(feb28, [1, 'month'], 1))).toBe('2025-03-28T00:00:00.000Z');\n\n // Leap-year Feb: Feb 29 anchor clamps to Feb 28 in a non-leap year and restores in the next leap year.\n const feb29 = at('2024-02-29T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(feb29, [1, 'year'], 1))).toBe('2025-02-28T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(feb29, [1, 'year'], 4))).toBe('2028-02-29T00:00:00.000Z');\n // Jan 31 monthly landing in a leap February clamps to Feb 29, not Feb 28.\n const jan31Leap = at('2024-01-31T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(jan31Leap, [1, 'month'], 1))).toBe('2024-02-29T00:00:00.000Z');\n\n // End-of-December rollover: absolute-month math carries the year.\n const dec31 = at('2025-12-31T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(dec31, [1, 'month'], 1))).toBe('2026-01-31T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(dec31, [1, 'month'], 2))).toBe('2026-02-28T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(dec31, [1, 'month'], 3))).toBe('2026-03-31T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(dec31, [1, 'year'], 1))).toBe('2026-12-31T00:00:00.000Z');\n\n // Time-of-day is preserved through month clamping.\n const withTime = at('2025-01-31T13:45:59.123Z');\n expect(iso(nthDayIntervalMillis(withTime, [1, 'month'], 1))).toBe('2025-02-28T13:45:59.123Z');\n});\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"dates.js","names":[],"sources":["../../../src/utils/dates.tsx"],"sourcesContent":["import { intervalSchema } from \"../schema-fields\";\nimport { HexclaveAssertionError } from \"./errors\";\nimport { remainder } from \"./math\";\n\nexport function isWeekend(date: Date): boolean {\n return date.getDay() === 0 || date.getDay() === 6;\n}\n\nimport.meta.vitest?.test(\"isWeekend\", ({ expect }) => {\n // Sunday (day 0)\n expect(isWeekend(new Date(2023, 0, 1))).toBe(true);\n // Saturday (day 6)\n expect(isWeekend(new Date(2023, 0, 7))).toBe(true);\n // Monday (day 1)\n expect(isWeekend(new Date(2023, 0, 2))).toBe(false);\n // Friday (day 5)\n expect(isWeekend(new Date(2023, 0, 6))).toBe(false);\n});\n\nconst agoUnits = [\n [60, 'second'],\n [60, 'minute'],\n [24, 'hour'],\n [7, 'day'],\n [5, 'week'],\n] as const;\n\nexport function fromNow(date: Date): string {\n return fromNowDetailed(date).result;\n}\n\nimport.meta.vitest?.test(\"fromNow\", ({ expect }) => {\n // Set a fixed date for testing\n const fixedDate = new Date(\"2023-01-15T12:00:00.000Z\");\n\n // Use Vitest's fake timers\n import.meta.vitest?.vi.useFakeTimers();\n import.meta.vitest?.vi.setSystemTime(fixedDate);\n\n // Test past times\n expect(fromNow(new Date(\"2023-01-15T11:59:50.000Z\"))).toBe(\"just now\");\n expect(fromNow(new Date(\"2023-01-15T11:59:00.000Z\"))).toBe(\"1 minute ago\");\n expect(fromNow(new Date(\"2023-01-15T11:00:00.000Z\"))).toBe(\"1 hour ago\");\n expect(fromNow(new Date(\"2023-01-14T12:00:00.000Z\"))).toBe(\"1 day ago\");\n expect(fromNow(new Date(\"2023-01-08T12:00:00.000Z\"))).toBe(\"1 week ago\");\n\n // Test future times\n expect(fromNow(new Date(\"2023-01-15T12:00:10.000Z\"))).toBe(\"just now\");\n expect(fromNow(new Date(\"2023-01-15T12:01:00.000Z\"))).toBe(\"in 1 minute\");\n expect(fromNow(new Date(\"2023-01-15T13:00:00.000Z\"))).toBe(\"in 1 hour\");\n expect(fromNow(new Date(\"2023-01-16T12:00:00.000Z\"))).toBe(\"in 1 day\");\n expect(fromNow(new Date(\"2023-01-22T12:00:00.000Z\"))).toBe(\"in 1 week\");\n\n // Test very old dates (should use date format)\n expect(fromNow(new Date(\"2022-01-15T12:00:00.000Z\"))).toMatch(/Jan 15, 2022/);\n\n // Restore real timers\n import.meta.vitest?.vi.useRealTimers();\n});\n\nexport function fromNowDetailed(date: Date): {\n result: string,\n /**\n * May be Infinity if the result will never change.\n */\n secondsUntilChange: number,\n} {\n if (!(date instanceof Date)) {\n throw new Error(`fromNow only accepts Date objects (received: ${date})`);\n }\n\n const now = new Date();\n const elapsed = now.getTime() - date.getTime();\n\n let remainingInUnit = Math.abs(elapsed) / 1000;\n if (remainingInUnit < 15) {\n return {\n result: 'just now',\n secondsUntilChange: 15 - remainingInUnit,\n };\n }\n let unitInSeconds = 1;\n for (const [nextUnitSize, unitName] of agoUnits) {\n const rounded = Math.round(remainingInUnit);\n if (rounded < nextUnitSize) {\n if (elapsed < 0) {\n return {\n result: `in ${rounded} ${unitName}${rounded === 1 ? '' : 's'}`,\n secondsUntilChange: remainder((remainingInUnit - rounded + 0.5) * unitInSeconds, unitInSeconds),\n };\n } else {\n return {\n result: `${rounded} ${unitName}${rounded === 1 ? '' : 's'} ago`,\n secondsUntilChange: remainder((rounded - remainingInUnit - 0.5) * unitInSeconds, unitInSeconds),\n };\n }\n }\n unitInSeconds *= nextUnitSize;\n remainingInUnit /= nextUnitSize;\n }\n\n return {\n result: date.toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' }),\n secondsUntilChange: Infinity,\n };\n}\n\n/**\n * Returns a string representation of the given date in the format expected by the `datetime-local` input type.\n */\nexport function getInputDatetimeLocalString(date: Date): string {\n date = new Date(date);\n date.setMinutes(date.getMinutes() - date.getTimezoneOffset());\n return date.toISOString().slice(0, 19);\n}\n\nimport.meta.vitest?.test(\"getInputDatetimeLocalString\", ({ expect }) => {\n // Use Vitest's fake timers to ensure consistent timezone behavior\n import.meta.vitest?.vi.useFakeTimers();\n\n // Test with a specific date\n const mockDate = new Date(\"2023-01-15T12:30:45.000Z\");\n const result = getInputDatetimeLocalString(mockDate);\n\n // The result should be in the format YYYY-MM-DDTHH:MM:SS\n expect(result).toMatch(/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$/);\n\n // Test with different dates\n const dates = [\n new Date(\"2023-01-01T00:00:00.000Z\"),\n new Date(\"2023-06-15T23:59:59.000Z\"),\n new Date(\"2023-12-31T12:34:56.000Z\"),\n ];\n\n for (const date of dates) {\n const result = getInputDatetimeLocalString(date);\n expect(result).toMatch(/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$/);\n }\n\n // Restore real timers\n import.meta.vitest?.vi.useRealTimers();\n});\n\n\nexport type Interval = [number, 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'];\nexport type DayInterval = [number, 'day' | 'week' | 'month' | 'year'];\n\nfunction applyInterval(inputDate: Date, times: number, interval: Interval): Date {\n if (!intervalSchema.isValidSync(interval)) {\n throw new HexclaveAssertionError(`Invalid interval`, { interval });\n }\n // Operate on a copy: the Date setters below mutate in place, and callers routinely pass a date they\n // also keep a reference to (e.g. `{ currentPeriodStart: now, currentPeriodEnd: addInterval(now, ...) }`).\n // Mutating the input would alias both fields to the same advanced date, silently collapsing the period.\n const date = new Date(inputDate);\n const [amount, unit] = interval;\n switch (unit) {\n case 'millisecond': {\n date.setMilliseconds(date.getMilliseconds() + amount * times);\n break;\n }\n case 'second': {\n date.setSeconds(date.getSeconds() + amount * times);\n break;\n }\n case 'minute': {\n date.setMinutes(date.getMinutes() + amount * times);\n break;\n }\n case 'hour': {\n date.setHours(date.getHours() + amount * times);\n break;\n }\n case 'day': {\n date.setDate(date.getDate() + amount * times);\n break;\n }\n case 'week': {\n date.setDate(date.getDate() + amount * times * 7);\n break;\n }\n case 'month': {\n date.setMonth(date.getMonth() + amount * times);\n break;\n }\n case 'year': {\n date.setFullYear(date.getFullYear() + amount * times);\n break;\n }\n default: {\n throw new HexclaveAssertionError(`Invalid interval despite schema validation`, { interval });\n }\n }\n return date;\n}\n\nexport function subtractInterval(date: Date, interval: Interval): Date {\n return applyInterval(date, -1, interval);\n}\n\n// One-shot local-time interval arithmetic that OVERFLOWS (Jan 31 + 1 month -> Mar 3, via\n// Date#setMonth) rather than clamping. Use this for single-step period math where JS/Stripe overflow\n// semantics are what we want (e.g. computing a subscription's currentPeriodEnd). For recurring\n// grant/reset BOUNDARIES, use `nthDayIntervalMillis` / `getIntervalsElapsed` instead — they clamp to\n// month-end and compute in UTC from a fixed anchor, and mixing the two would drift.\nexport function addInterval(date: Date, interval: Interval): Date {\n return applyInterval(date, 1, interval);\n}\n\nimport.meta.vitest?.test(\"addInterval/subtractInterval do not mutate their input\", ({ expect }) => {\n const original = new Date('2026-07-20T00:00:00.000Z');\n const originalMillis = original.getTime();\n\n const later = addInterval(original, [1, 'month']);\n const earlier = subtractInterval(original, [1, 'month']);\n\n // The input must be untouched, and the result must be a distinct object. This guards the aliasing\n // footgun in `{ currentPeriodStart: now, currentPeriodEnd: addInterval(now, ...) }`, where mutating\n // `now` would collapse both fields to the same advanced instant (a zero-width period).\n expect(original.getTime()).toBe(originalMillis);\n expect(later).not.toBe(original);\n expect(earlier).not.toBe(original);\n expect(later).toEqual(new Date('2026-08-20T00:00:00.000Z'));\n expect(earlier).toEqual(new Date('2026-06-20T00:00:00.000Z'));\n});\n\nexport const FAR_FUTURE_DATE = new Date(8640000000000000); // 13 Sep 275760 00:00:00 UTC\n\nfunction getMsPerDayIntervalUnit(unit: 'day' | 'week'): number {\n if (unit === 'day') {\n return 24 * 60 * 60 * 1000;\n }\n return 7 * 24 * 60 * 60 * 1000;\n}\n\n\n// The number of full `repeat` intervals elapsed from `anchor` up to (and including) `to`, i.e. the\n// largest n >= 0 with the n-th boundary <= to. Boundaries are the SAME ones `nthDayIntervalMillis`\n// computes (anchor-relative, UTC, month-end clamped), so counting and boundary-computation never\n// disagree — a Jan 31 monthly anchor has elapsed one interval by Feb 28, matching the reset the\n// bulldozer item-repeat fold actually emits. (This is why it must NOT be built on `addInterval`,\n// which is local-time and overflows instead of clamping.)\nexport function getIntervalsElapsed(anchor: Date, to: Date, repeat: DayInterval): number {\n const [amount, unit] = repeat;\n const toMillis = to.getTime();\n if (toMillis <= anchor.getTime()) return 0;\n if (unit === 'day' || unit === 'week') {\n const msPerUnit = getMsPerDayIntervalUnit(unit);\n const diffMs = toMillis - anchor.getTime();\n return Math.floor(diffMs / (msPerUnit * amount));\n }\n // month/year: walk anchor-relative boundaries. The count is small in practice (bounded by the\n // number of billing periods since the anchor), so a linear walk is fine.\n let count = 0;\n while (nthDayIntervalMillis(anchor.getTime(), repeat, count + 1) <= toMillis) count += 1;\n return count;\n}\n\nimport.meta.vitest?.test(\"getIntervalsElapsed\", ({ expect }) => {\n const anchor = new Date('2025-01-01T00:00:00.000Z');\n const to = new Date('2025-01-15T00:00:00.000Z');\n expect(getIntervalsElapsed(anchor, to, [1, 'week'])).toBe(2);\n expect(getIntervalsElapsed(anchor, to, [3, 'day'])).toBe(4);\n\n // Jan 31 monthly anchor: the first boundary is clamped to Feb 28, which is <= Mar 1, so one\n // interval has elapsed (anchor-relative clamped math, consistent with nthDayIntervalMillis).\n const mAnchor = new Date('2023-01-31T00:00:00.000Z');\n const mTo = new Date('2023-03-01T00:00:00.000Z');\n expect(getIntervalsElapsed(mAnchor, mTo, [1, 'month'])).toBe(1);\n\n const yAnchor = new Date('2020-01-01T00:00:00.000Z');\n const yTo = new Date('2022-06-01T00:00:00.000Z');\n expect(getIntervalsElapsed(yAnchor, yTo, [1, 'year'])).toBe(2);\n});\n\n/**\n * The UTC millis of the `occurrence`-th (1-based) repeat of `interval` after `anchorMillis`.\n *\n * Each boundary is computed from the *original* anchor (never by stepping off the previous, possibly\n * clamped, boundary) so the anchor's day-of-month is preserved across resets: a Jan 31 anchor yields\n * Feb 28, Mar 31, Apr 30, ... (matching Stripe's billing-cycle behavior) rather than drifting to\n * Feb 28, Mar 28, ... . Month/year overflow (e.g. Jan 31 -> Feb) is clamped to the target month's\n * last day. Day/week are exact multiples (no calendar involved, so no drift possible).\n *\n * Everything is done in UTC (unlike `addInterval`, which uses local-time Date accessors) so the\n * result is deterministic regardless of the server's timezone — this is relied upon by bulldozer\n * folds, which must be reproducible across machines.\n *\n * `occurrence` 0 returns the anchor itself; `getIntervalsElapsed` counts these same boundaries, so\n * the two are always consistent for a given DayInterval.\n */\nexport function nthDayIntervalMillis(anchorMillis: number, interval: DayInterval, occurrence: number): number {\n const [count, unit] = interval;\n const totalUnits = count * occurrence;\n if (unit === 'day' || unit === 'week') {\n return anchorMillis + totalUnits * getMsPerDayIntervalUnit(unit);\n }\n const anchor = new Date(anchorMillis);\n const monthsToAdd = unit === 'year' ? totalUnits * 12 : totalUnits;\n const absoluteMonth = anchor.getUTCFullYear() * 12 + anchor.getUTCMonth() + monthsToAdd;\n const targetYear = Math.floor(absoluteMonth / 12);\n const targetMonth = absoluteMonth - targetYear * 12;\n // Day 0 of the following month is the last day of the target month, so this gives its length.\n const daysInTargetMonth = new Date(Date.UTC(targetYear, targetMonth + 1, 0)).getUTCDate();\n const clampedDay = Math.min(anchor.getUTCDate(), daysInTargetMonth);\n return Date.UTC(\n targetYear,\n targetMonth,\n clampedDay,\n anchor.getUTCHours(),\n anchor.getUTCMinutes(),\n anchor.getUTCSeconds(),\n anchor.getUTCMilliseconds(),\n );\n}\n\nimport.meta.vitest?.test(\"nthDayIntervalMillis\", ({ expect }) => {\n const at = (iso: string) => new Date(iso).getTime();\n const iso = (millis: number) => new Date(millis).toISOString();\n\n // day / week are exact multiples (no drift), and honor the count.\n const dayAnchor = at('2025-01-01T08:30:00.000Z');\n expect(iso(nthDayIntervalMillis(dayAnchor, [1, 'day'], 1))).toBe('2025-01-02T08:30:00.000Z');\n expect(iso(nthDayIntervalMillis(dayAnchor, [3, 'day'], 4))).toBe('2025-01-13T08:30:00.000Z');\n expect(iso(nthDayIntervalMillis(dayAnchor, [2, 'week'], 3))).toBe('2025-02-12T08:30:00.000Z'); // 6 weeks = 42 days after Jan 1\n\n // Jan 31 monthly: clamp in short months, restore to the anchor day in long ones.\n const jan31 = at('2025-01-31T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(jan31, [1, 'month'], 1))).toBe('2025-02-28T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(jan31, [1, 'month'], 2))).toBe('2025-03-31T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(jan31, [1, 'month'], 3))).toBe('2025-04-30T00:00:00.000Z');\n\n // Anchor-day preservation: a Feb 28 anchor stays on day 28 (never jumps to Mar 31), unlike the\n // Jan 31 anchor above which restores to Mar 31. This is the evidence we compute from the anchor.\n const feb28 = at('2025-02-28T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(feb28, [1, 'month'], 1))).toBe('2025-03-28T00:00:00.000Z');\n\n // Leap-year Feb: Feb 29 anchor clamps to Feb 28 in a non-leap year and restores in the next leap year.\n const feb29 = at('2024-02-29T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(feb29, [1, 'year'], 1))).toBe('2025-02-28T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(feb29, [1, 'year'], 4))).toBe('2028-02-29T00:00:00.000Z');\n // Jan 31 monthly landing in a leap February clamps to Feb 29, not Feb 28.\n const jan31Leap = at('2024-01-31T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(jan31Leap, [1, 'month'], 1))).toBe('2024-02-29T00:00:00.000Z');\n\n // End-of-December rollover: absolute-month math carries the year.\n const dec31 = at('2025-12-31T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(dec31, [1, 'month'], 1))).toBe('2026-01-31T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(dec31, [1, 'month'], 2))).toBe('2026-02-28T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(dec31, [1, 'month'], 3))).toBe('2026-03-31T00:00:00.000Z');\n expect(iso(nthDayIntervalMillis(dec31, [1, 'year'], 1))).toBe('2026-12-31T00:00:00.000Z');\n\n // Time-of-day is preserved through month clamping.\n const withTime = at('2025-01-31T13:45:59.123Z');\n expect(iso(nthDayIntervalMillis(withTime, [1, 'month'], 1))).toBe('2025-02-28T13:45:59.123Z');\n});\n"],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as KnownErrors } from "../known-errors-
|
|
1
|
+
import { a as KnownErrors } from "../known-errors-g7JC8z58.js";
|
|
2
2
|
//#region src/helpers/password.d.ts
|
|
3
3
|
declare function getPasswordError(password: string): KnownErrors["PasswordRequirementsNotMet"] | undefined;
|
|
4
4
|
//#endregion
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as KnownErrors, n as KnownError } from "./known-errors-
|
|
2
|
-
import { n as HexclaveClientInterface } from "./client-interface-
|
|
3
|
-
import { t as HexclaveServerInterface } from "./server-interface-
|
|
4
|
-
import { r as HexclaveAdminInterface } from "./admin-interface-
|
|
1
|
+
import { a as KnownErrors, n as KnownError } from "./known-errors-g7JC8z58.js";
|
|
2
|
+
import { n as HexclaveClientInterface } from "./client-interface-Ca6UZywk.js";
|
|
3
|
+
import { t as HexclaveServerInterface } from "./server-interface-yKuDPrQI.js";
|
|
4
|
+
import { r as HexclaveAdminInterface } from "./admin-interface-DuboQXpC.js";
|
|
5
5
|
export { HexclaveAdminInterface, HexclaveClientInterface, HexclaveServerInterface, KnownError, KnownErrors };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as PlanUsageResponse } from "../plan-usage-
|
|
2
|
-
import { a as InternalApiKeyCreateCrudResponse, i as InternalApiKeyCreateCrudRequest, n as ChatContent, r as HexclaveAdminInterface, t as AdminAuthApplicationOptions } from "../admin-interface-
|
|
1
|
+
import { n as PlanUsageResponse } from "../plan-usage-D0kWw4HR.js";
|
|
2
|
+
import { a as InternalApiKeyCreateCrudResponse, i as InternalApiKeyCreateCrudRequest, n as ChatContent, r as HexclaveAdminInterface, t as AdminAuthApplicationOptions } from "../admin-interface-DuboQXpC.js";
|
|
3
3
|
export { AdminAuthApplicationOptions, ChatContent, HexclaveAdminInterface, InternalApiKeyCreateCrudRequest, InternalApiKeyCreateCrudResponse, type PlanUsageResponse };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as MetricsNamedCount, B as MetricsTopCountry, C as MetricsDataPoint, D as MetricsEmailOverviewSchema, E as MetricsEmailOverview, F as MetricsRecentEmailSchema, G as MetricsTopRegionSchema, H as MetricsTopReferrer, I as MetricsRecentUser, J as UserActivityResponse, K as MetricsUserCounts, L as MetricsRecentUserSchema, M as MetricsPaymentsOverview, N as MetricsPaymentsOverviewSchema, O as MetricsLoginMethodEntry, P as MetricsRecentEmail, R as MetricsResponse, S as MetricsDailyRevenuePointSchema, T as MetricsDataPointsSchema, U as MetricsTopReferrerSchema, V as MetricsTopCountrySchema, W as MetricsTopRegion, Y as UserActivityResponseBodySchema, _ as MetricsAuthOverview, a as AnalyticsClickmapKind, b as MetricsDailyEmailStatusBreakdownSchema, c as AnalyticsClickmapResponse, d as AnalyticsClickmapTokenResponseBodySchema, f as MetricsActiveUsersByCountrySchema, g as MetricsAnalyticsOverviewSchema, h as MetricsAnalyticsOverview, i as AnalyticsClickmapDeviceSchema, j as MetricsNamedCountSchema, k as MetricsLoginMethodEntrySchema, l as AnalyticsClickmapResponseBodySchema, m as MetricsActivitySplitSchema, n as AnalyticsClickmapCellSchema, o as AnalyticsClickmapKindSchema, p as MetricsActivitySplit, q as MetricsUserCountsSchema, r as AnalyticsClickmapDevice, s as AnalyticsClickmapOptions, t as AnalyticsClickmapCell, u as AnalyticsClickmapTokenResponse, v as MetricsAuthOverviewSchema, w as MetricsDataPointSchema, x as MetricsDailyRevenuePoint, y as MetricsDailyEmailStatusBreakdown, z as MetricsResponseBodySchema } from "../admin-metrics-
|
|
1
|
+
import { A as MetricsNamedCount, B as MetricsTopCountry, C as MetricsDataPoint, D as MetricsEmailOverviewSchema, E as MetricsEmailOverview, F as MetricsRecentEmailSchema, G as MetricsTopRegionSchema, H as MetricsTopReferrer, I as MetricsRecentUser, J as UserActivityResponse, K as MetricsUserCounts, L as MetricsRecentUserSchema, M as MetricsPaymentsOverview, N as MetricsPaymentsOverviewSchema, O as MetricsLoginMethodEntry, P as MetricsRecentEmail, R as MetricsResponse, S as MetricsDailyRevenuePointSchema, T as MetricsDataPointsSchema, U as MetricsTopReferrerSchema, V as MetricsTopCountrySchema, W as MetricsTopRegion, Y as UserActivityResponseBodySchema, _ as MetricsAuthOverview, a as AnalyticsClickmapKind, b as MetricsDailyEmailStatusBreakdownSchema, c as AnalyticsClickmapResponse, d as AnalyticsClickmapTokenResponseBodySchema, f as MetricsActiveUsersByCountrySchema, g as MetricsAnalyticsOverviewSchema, h as MetricsAnalyticsOverview, i as AnalyticsClickmapDeviceSchema, j as MetricsNamedCountSchema, k as MetricsLoginMethodEntrySchema, l as AnalyticsClickmapResponseBodySchema, m as MetricsActivitySplitSchema, n as AnalyticsClickmapCellSchema, o as AnalyticsClickmapKindSchema, p as MetricsActivitySplit, q as MetricsUserCountsSchema, r as AnalyticsClickmapDevice, s as AnalyticsClickmapOptions, t as AnalyticsClickmapCell, u as AnalyticsClickmapTokenResponse, v as MetricsAuthOverviewSchema, w as MetricsDataPointSchema, x as MetricsDailyRevenuePoint, y as MetricsDailyEmailStatusBreakdown, z as MetricsResponseBodySchema } from "../admin-metrics-IxLyJ-cP.js";
|
|
2
2
|
export { AnalyticsClickmapCell, AnalyticsClickmapCellSchema, AnalyticsClickmapDevice, AnalyticsClickmapDeviceSchema, AnalyticsClickmapKind, AnalyticsClickmapKindSchema, AnalyticsClickmapOptions, AnalyticsClickmapResponse, AnalyticsClickmapResponseBodySchema, AnalyticsClickmapTokenResponse, AnalyticsClickmapTokenResponseBodySchema, MetricsActiveUsersByCountrySchema, MetricsActivitySplit, MetricsActivitySplitSchema, MetricsAnalyticsOverview, MetricsAnalyticsOverviewSchema, MetricsAuthOverview, MetricsAuthOverviewSchema, MetricsDailyEmailStatusBreakdown, MetricsDailyEmailStatusBreakdownSchema, MetricsDailyRevenuePoint, MetricsDailyRevenuePointSchema, MetricsDataPoint, MetricsDataPointSchema, MetricsDataPointsSchema, MetricsEmailOverview, MetricsEmailOverviewSchema, MetricsLoginMethodEntry, MetricsLoginMethodEntrySchema, MetricsNamedCount, MetricsNamedCountSchema, MetricsPaymentsOverview, MetricsPaymentsOverviewSchema, MetricsRecentEmail, MetricsRecentEmailSchema, MetricsRecentUser, MetricsRecentUserSchema, MetricsResponse, MetricsResponseBodySchema, MetricsTopCountry, MetricsTopCountrySchema, MetricsTopReferrer, MetricsTopReferrerSchema, MetricsTopRegion, MetricsTopRegionSchema, MetricsUserCounts, MetricsUserCountsSchema, UserActivityResponse, UserActivityResponseBodySchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as RequestLogEntry, n as HexclaveClientInterface, r as RequestListener, t as ClientInterfaceOptions } from "../client-interface-
|
|
1
|
+
import { i as RequestLogEntry, n as HexclaveClientInterface, r as RequestListener, t as ClientInterfaceOptions } from "../client-interface-Ca6UZywk.js";
|
|
2
2
|
export { ClientInterfaceOptions, HexclaveClientInterface, RequestListener, RequestLogEntry };
|
|
@@ -49,7 +49,7 @@ declare const conversationSummarySchema: yup$1.ObjectSchema<{
|
|
|
49
49
|
userPrimaryEmail: string | null;
|
|
50
50
|
userProfileImageUrl: string | null;
|
|
51
51
|
subject: string;
|
|
52
|
-
status: "
|
|
52
|
+
status: "pending" | "open" | "closed";
|
|
53
53
|
priority: "low" | "normal" | "high" | "urgent";
|
|
54
54
|
source: "email" | "manual" | "chat" | "api";
|
|
55
55
|
lastMessageType: "message" | "internal-note" | "status-change";
|
|
@@ -129,7 +129,7 @@ declare const conversationMessageSchema: yup$1.ObjectSchema<{
|
|
|
129
129
|
userId: string | null;
|
|
130
130
|
teamId: string | null;
|
|
131
131
|
subject: string;
|
|
132
|
-
status: "
|
|
132
|
+
status: "pending" | "open" | "closed";
|
|
133
133
|
priority: "low" | "normal" | "high" | "urgent";
|
|
134
134
|
source: "email" | "manual" | "chat" | "api";
|
|
135
135
|
messageType: "message" | "internal-note" | "status-change";
|
|
@@ -139,8 +139,8 @@ declare const conversationMessageSchema: yup$1.ObjectSchema<{
|
|
|
139
139
|
createdAt: string;
|
|
140
140
|
sender: {
|
|
141
141
|
type: "user" | "agent" | "system";
|
|
142
|
-
displayName: string | null;
|
|
143
142
|
id: string | null;
|
|
143
|
+
displayName: string | null;
|
|
144
144
|
primaryEmail: string | null;
|
|
145
145
|
};
|
|
146
146
|
}, yup$1.AnyObject, {
|
|
@@ -173,8 +173,7 @@ declare const conversationListResponseSchema: yup$1.ObjectSchema<{
|
|
|
173
173
|
lastOutboundAt?: string | null | undefined;
|
|
174
174
|
closedAt?: string | null | undefined;
|
|
175
175
|
recordMetadata?: {} | null | undefined;
|
|
176
|
-
status: "
|
|
177
|
-
priority: "low" | "normal" | "high" | "urgent";
|
|
176
|
+
status: "pending" | "open" | "closed";
|
|
178
177
|
subject: string;
|
|
179
178
|
conversationId: string;
|
|
180
179
|
userId: string | null;
|
|
@@ -182,6 +181,7 @@ declare const conversationListResponseSchema: yup$1.ObjectSchema<{
|
|
|
182
181
|
userDisplayName: string | null;
|
|
183
182
|
userPrimaryEmail: string | null;
|
|
184
183
|
userProfileImageUrl: string | null;
|
|
184
|
+
priority: "low" | "normal" | "high" | "urgent";
|
|
185
185
|
source: "email" | "manual" | "chat" | "api";
|
|
186
186
|
lastMessageType: "message" | "internal-note" | "status-change";
|
|
187
187
|
preview: string | null;
|
|
@@ -211,8 +211,7 @@ declare const conversationDetailResponseSchema: yup$1.ObjectSchema<{
|
|
|
211
211
|
lastOutboundAt?: string | null | undefined;
|
|
212
212
|
closedAt?: string | null | undefined;
|
|
213
213
|
recordMetadata?: {} | null | undefined;
|
|
214
|
-
status: "
|
|
215
|
-
priority: "low" | "normal" | "high" | "urgent";
|
|
214
|
+
status: "pending" | "open" | "closed";
|
|
216
215
|
subject: string;
|
|
217
216
|
conversationId: string;
|
|
218
217
|
userId: string | null;
|
|
@@ -220,6 +219,7 @@ declare const conversationDetailResponseSchema: yup$1.ObjectSchema<{
|
|
|
220
219
|
userDisplayName: string | null;
|
|
221
220
|
userPrimaryEmail: string | null;
|
|
222
221
|
userProfileImageUrl: string | null;
|
|
222
|
+
priority: "low" | "normal" | "high" | "urgent";
|
|
223
223
|
source: "email" | "manual" | "chat" | "api";
|
|
224
224
|
lastMessageType: "message" | "internal-note" | "status-change";
|
|
225
225
|
preview: string | null;
|
|
@@ -236,13 +236,13 @@ declare const conversationDetailResponseSchema: yup$1.ObjectSchema<{
|
|
|
236
236
|
};
|
|
237
237
|
};
|
|
238
238
|
messages: {
|
|
239
|
-
status: "open" | "pending" | "closed";
|
|
240
239
|
id: string;
|
|
241
|
-
|
|
240
|
+
status: "pending" | "open" | "closed";
|
|
242
241
|
subject: string;
|
|
243
242
|
conversationId: string;
|
|
244
243
|
userId: string | null;
|
|
245
244
|
teamId: string | null;
|
|
245
|
+
priority: "low" | "normal" | "high" | "urgent";
|
|
246
246
|
source: "email" | "manual" | "chat" | "api";
|
|
247
247
|
metadata: {} | null;
|
|
248
248
|
createdAt: string;
|
|
@@ -251,8 +251,8 @@ declare const conversationDetailResponseSchema: yup$1.ObjectSchema<{
|
|
|
251
251
|
attachments: {}[];
|
|
252
252
|
sender: {
|
|
253
253
|
type: "user" | "agent" | "system";
|
|
254
|
-
displayName: string | null;
|
|
255
254
|
id: string | null;
|
|
255
|
+
displayName: string | null;
|
|
256
256
|
primaryEmail: string | null;
|
|
257
257
|
};
|
|
258
258
|
}[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as currentUserCrud, t as CurrentUserCrud } from "../../current-user-
|
|
1
|
+
import { n as currentUserCrud, t as CurrentUserCrud } from "../../current-user-DNxac4sS.js";
|
|
2
2
|
export { CurrentUserCrud, currentUserCrud };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as emailOutboxUpdateSchema, n as emailOutboxCrud, r as emailOutboxReadSchema, t as EmailOutboxCrud } from "../../email-outbox-
|
|
1
|
+
import { i as emailOutboxUpdateSchema, n as emailOutboxCrud, r as emailOutboxReadSchema, t as EmailOutboxCrud } from "../../email-outbox-ILs0LlGd.js";
|
|
2
2
|
export { EmailOutboxCrud, emailOutboxCrud, emailOutboxReadSchema, emailOutboxUpdateSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as customerProductsListResponseSchema, i as customerProductReadSchema, n as CustomerProductsListResponse, r as ListCustomerProductsOptions, t as CustomerProductRead } from "../../products-
|
|
1
|
+
import { a as customerProductsListResponseSchema, i as customerProductReadSchema, n as CustomerProductsListResponse, r as ListCustomerProductsOptions, t as CustomerProductRead } from "../../products-C98fCS-1.js";
|
|
2
2
|
export { CustomerProductRead, CustomerProductsListResponse, ListCustomerProductsOptions, customerProductReadSchema, customerProductsListResponseSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as teamApiKeysCrud, c as userApiKeysCrud, i as teamApiKeysCreateOutputSchema, n as UserApiKeysCrud, o as userApiKeysCreateInputSchema, r as teamApiKeysCreateInputSchema, s as userApiKeysCreateOutputSchema, t as TeamApiKeysCrud } from "../../project-api-keys
|
|
1
|
+
import { a as teamApiKeysCrud, c as userApiKeysCrud, i as teamApiKeysCreateOutputSchema, n as UserApiKeysCrud, o as userApiKeysCreateInputSchema, r as teamApiKeysCreateInputSchema, s as userApiKeysCreateOutputSchema, t as TeamApiKeysCrud } from "../../project-api-keys-P97ElZZe.js";
|
|
2
2
|
export { TeamApiKeysCrud, UserApiKeysCrud, teamApiKeysCreateInputSchema, teamApiKeysCreateOutputSchema, teamApiKeysCrud, userApiKeysCreateInputSchema, userApiKeysCreateOutputSchema, userApiKeysCrud };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as clientProjectsCrud, c as projectsCrud, d as projectsCrudAdminReadSchema, f as projectsCrudAdminUpdateSchema, i as adminUserProjectsCrud, l as projectsCrudAdminCreateSchema, n as ClientProjectsCrud, o as emailConfigSchema, p as projectsCrudClientReadSchema, r as ProjectsCrud, s as emailConfigWithoutPasswordSchema, t as AdminUserProjectsCrud, u as projectsCrudAdminDeleteSchema } from "../../projects-
|
|
1
|
+
import { a as clientProjectsCrud, c as projectsCrud, d as projectsCrudAdminReadSchema, f as projectsCrudAdminUpdateSchema, i as adminUserProjectsCrud, l as projectsCrudAdminCreateSchema, n as ClientProjectsCrud, o as emailConfigSchema, p as projectsCrudClientReadSchema, r as ProjectsCrud, s as emailConfigWithoutPasswordSchema, t as AdminUserProjectsCrud, u as projectsCrudAdminDeleteSchema } from "../../projects-BM2a4sfO.js";
|
|
2
2
|
export { AdminUserProjectsCrud, ClientProjectsCrud, ProjectsCrud, adminUserProjectsCrud, clientProjectsCrud, emailConfigSchema, emailConfigWithoutPasswordSchema, projectsCrud, projectsCrudAdminCreateSchema, projectsCrudAdminDeleteSchema, projectsCrudAdminReadSchema, projectsCrudAdminUpdateSchema, projectsCrudClientReadSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as teamMemberProfilesCrudServerReadSchema, i as teamMemberProfilesCrudClientUpdateSchema, n as teamMemberProfilesCrud, r as teamMemberProfilesCrudClientReadSchema, t as TeamMemberProfilesCrud } from "../../team-member-profiles-
|
|
1
|
+
import { a as teamMemberProfilesCrudServerReadSchema, i as teamMemberProfilesCrudClientUpdateSchema, n as teamMemberProfilesCrud, r as teamMemberProfilesCrudClientReadSchema, t as TeamMemberProfilesCrud } from "../../team-member-profiles-CaD1OJqt.js";
|
|
2
2
|
export { TeamMemberProfilesCrud, teamMemberProfilesCrud, teamMemberProfilesCrudClientReadSchema, teamMemberProfilesCrudClientUpdateSchema, teamMemberProfilesCrudServerReadSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as transactionEntrySchema, i as TransactionType, n as Transaction, o as transactionSchema, r as TransactionEntry, t as TRANSACTION_TYPES } from "../../transactions-
|
|
1
|
+
import { a as transactionEntrySchema, i as TransactionType, n as Transaction, o as transactionSchema, r as TransactionEntry, t as TRANSACTION_TYPES } from "../../transactions-CrAZLdGo.js";
|
|
2
2
|
export { TRANSACTION_TYPES, Transaction, TransactionEntry, TransactionType, transactionEntrySchema, transactionSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as userCreatedWebhookEvent, c as usersCrud, d as usersCrudServerReadSchema, f as usersCrudServerUpdateSchema, i as signUpRiskScoresSchema, l as usersCrudServerCreateSchema, n as UsersCrud, o as userDeletedWebhookEvent, r as riskScoreFieldSchema, s as userUpdatedWebhookEvent, t as SignUpRiskScoresCrud, u as usersCrudServerDeleteSchema } from "../../users-
|
|
1
|
+
import { a as userCreatedWebhookEvent, c as usersCrud, d as usersCrudServerReadSchema, f as usersCrudServerUpdateSchema, i as signUpRiskScoresSchema, l as usersCrudServerCreateSchema, n as UsersCrud, o as userDeletedWebhookEvent, r as riskScoreFieldSchema, s as userUpdatedWebhookEvent, t as SignUpRiskScoresCrud, u as usersCrudServerDeleteSchema } from "../../users-DSpJgn9Z.js";
|
|
2
2
|
export { SignUpRiskScoresCrud, UsersCrud, riskScoreFieldSchema, signUpRiskScoresSchema, userCreatedWebhookEvent, userDeletedWebhookEvent, userUpdatedWebhookEvent, usersCrud, usersCrudServerCreateSchema, usersCrudServerDeleteSchema, usersCrudServerReadSchema, usersCrudServerUpdateSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as planUsageResponseSchema, i as planUsageKindSchema, n as PlanUsageResponse, o as planUsageRowSchema, r as PlanUsageRow, t as PlanUsageKind } from "../plan-usage-
|
|
1
|
+
import { a as planUsageResponseSchema, i as planUsageKindSchema, n as PlanUsageResponse, o as planUsageRowSchema, r as PlanUsageRow, t as PlanUsageKind } from "../plan-usage-D0kWw4HR.js";
|
|
2
2
|
export { PlanUsageKind, PlanUsageResponse, PlanUsageRow, planUsageKindSchema, planUsageResponseSchema, planUsageRowSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as ServerAuthApplicationOptions, t as HexclaveServerInterface } from "../server-interface-
|
|
1
|
+
import { n as ServerAuthApplicationOptions, t as HexclaveServerInterface } from "../server-interface-yKuDPrQI.js";
|
|
2
2
|
export { HexclaveServerInterface, ServerAuthApplicationOptions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as webhookEvents, t as WebhookEvent } from "../webhooks-
|
|
1
|
+
import { n as webhookEvents, t as WebhookEvent } from "../webhooks-_aXIgZBW.js";
|
|
2
2
|
export { WebhookEvent, webhookEvents };
|
|
@@ -512,7 +512,7 @@ declare const KnownErrors: {
|
|
|
512
512
|
ItemNotFound: KnownErrorConstructor<KnownError & KnownErrorBrand<"ITEM_NOT_FOUND">, [itemId: string]> & {
|
|
513
513
|
errorCode: "ITEM_NOT_FOUND";
|
|
514
514
|
};
|
|
515
|
-
ItemCustomerTypeDoesNotMatch: KnownErrorConstructor<KnownError & KnownErrorBrand<"ITEM_CUSTOMER_TYPE_DOES_NOT_MATCH">, [itemId: string, customerId: string, itemCustomerType: "
|
|
515
|
+
ItemCustomerTypeDoesNotMatch: KnownErrorConstructor<KnownError & KnownErrorBrand<"ITEM_CUSTOMER_TYPE_DOES_NOT_MATCH">, [itemId: string, customerId: string, itemCustomerType: "user" | "team" | "custom" | undefined, actualCustomerType: "user" | "team" | "custom"]> & {
|
|
516
516
|
errorCode: "ITEM_CUSTOMER_TYPE_DOES_NOT_MATCH";
|
|
517
517
|
};
|
|
518
518
|
CustomerDoesNotExist: KnownErrorConstructor<KnownError & KnownErrorBrand<"CUSTOMER_DOES_NOT_EXIST">, [customerId: string]> & {
|
|
@@ -521,7 +521,7 @@ declare const KnownErrors: {
|
|
|
521
521
|
ProductDoesNotExist: KnownErrorConstructor<KnownError & KnownErrorBrand<"PRODUCT_DOES_NOT_EXIST">, [productId: string, context: "item_exists" | "server_only" | null]> & {
|
|
522
522
|
errorCode: "PRODUCT_DOES_NOT_EXIST";
|
|
523
523
|
};
|
|
524
|
-
ProductCustomerTypeDoesNotMatch: KnownErrorConstructor<KnownError & KnownErrorBrand<"PRODUCT_CUSTOMER_TYPE_DOES_NOT_MATCH">, [productId: string | undefined, customerId: string, productCustomerType: "
|
|
524
|
+
ProductCustomerTypeDoesNotMatch: KnownErrorConstructor<KnownError & KnownErrorBrand<"PRODUCT_CUSTOMER_TYPE_DOES_NOT_MATCH">, [productId: string | undefined, customerId: string, productCustomerType: "user" | "team" | "custom" | undefined, actualCustomerType: "user" | "team" | "custom"]> & {
|
|
525
525
|
errorCode: "PRODUCT_CUSTOMER_TYPE_DOES_NOT_MATCH";
|
|
526
526
|
};
|
|
527
527
|
ProductAlreadyGranted: KnownErrorConstructor<KnownError & KnownErrorBrand<"PRODUCT_ALREADY_GRANTED">, [productId: string, customerId: string]> & {
|
|
@@ -548,7 +548,7 @@ declare const KnownErrors: {
|
|
|
548
548
|
StripeAccountInfoNotFound: KnownErrorConstructor<KnownError & KnownErrorBrand<"STRIPE_ACCOUNT_INFO_NOT_FOUND">, []> & {
|
|
549
549
|
errorCode: "STRIPE_ACCOUNT_INFO_NOT_FOUND";
|
|
550
550
|
};
|
|
551
|
-
DefaultPaymentMethodRequired: KnownErrorConstructor<KnownError & KnownErrorBrand<"DEFAULT_PAYMENT_METHOD_REQUIRED">, [customerType: "
|
|
551
|
+
DefaultPaymentMethodRequired: KnownErrorConstructor<KnownError & KnownErrorBrand<"DEFAULT_PAYMENT_METHOD_REQUIRED">, [customerType: "user" | "team", customerId: string]> & {
|
|
552
552
|
errorCode: "DEFAULT_PAYMENT_METHOD_REQUIRED";
|
|
553
553
|
};
|
|
554
554
|
NewPurchasesBlocked: KnownErrorConstructor<KnownError & KnownErrorBrand<"NEW_PURCHASES_BLOCKED">, []> & {
|
|
@@ -572,4 +572,4 @@ declare const KnownErrors: {
|
|
|
572
572
|
};
|
|
573
573
|
//#endregion
|
|
574
574
|
export { KnownErrors as a, KnownErrorJson as i, KnownError as n, KnownErrorConstructor as r, AbstractKnownErrorConstructor as t };
|
|
575
|
-
//# sourceMappingURL=known-errors-
|
|
575
|
+
//# sourceMappingURL=known-errors-g7JC8z58.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"known-errors-
|
|
1
|
+
{"version":3,"file":"known-errors-g7JC8z58.d.ts","names":[],"sources":["../src/known-errors.tsx"],"mappings":";;;;KAKY,cAAA;EACV,IAAA;EACA,OAAA;EACA,OAAA,GAAU,IAAI;AAAA;AAAA,KAGJ,6BAAA,yCACU,IAAA,EAAM,IAAA,KAAS,UAAA;EAEjC,uBAAA,GAA0B,IAAA,EAAM,cAAA,KAAmB,IAAA;AAAA;AAAA,KAG3C,qBAAA,uBAA4C,UAAA;EAAA,QAC/C,IAAA,EAAM,IAAA,GAAO,aAAA;IAAkB,eAAA,EAAiB,IAAA;EAAA;EACvD,SAAA;EACA,uBAAA,GAA0B,IAAA,EAAM,cAAA,KAAmB,IAAA;EACnD,UAAA,GAAa,KAAA,cAAmB,KAAA,IAAS,aAAA;IAAkB,eAAA,EAAiB,IAAA;EAAA;AAAA;AAAA,uBAGxD,UAAA,SAAmB,WAAA;EAAA,SAKrB,UAAA;EAAA,SACA,oBAAA;EAAA,SACA,OAAA,GAAU,IAAA;EAAA,iBANX,sBAAA;EACV,IAAA;cAGW,UAAA,UACA,oBAAA,UACA,OAAA,GAAU,IAAA;EAAA,OAQd,YAAA,CAAa,KAAA,YAAiB,KAAA,IAAS,UAAA;EAKrC,OAAA,IAAW,UAAA;EAIX,UAAA,IAAc,MAAA;EASd,iBAAA,IAAqB,IAAA;EAAA,IAQjC,SAAA;EAAA,OAIU,uBAAA,CAAwB,IAAA,EAAM,cAAA,GAAiB,qBAAA,QAA6B,UAAA;EAAA,OAQ5E,QAAA,CAAS,IAAA,EAAM,cAAA,GAAiB,UAAA;AAAA;AAAA,cAe1C,sCAAA;;;;KAID,eAAA;EA5E6B;;;;;EAAA,CAkF/B,sCAAsC,WAC/B,SAAA;AAAA;AAAA,KA2uDE,WAAA,wBACS,WAAA,GAAc,YAAA,QAAoB,WAAA,CAAY,CAAA;AAAA,cAGtD,WAAA"}
|
package/dist/known-errors.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as KnownErrors, i as KnownErrorJson, n as KnownError, r as KnownErrorConstructor, t as AbstractKnownErrorConstructor } from "./known-errors-
|
|
1
|
+
import { a as KnownErrors, i as KnownErrorJson, n as KnownError, r as KnownErrorConstructor, t as AbstractKnownErrorConstructor } from "./known-errors-g7JC8z58.js";
|
|
2
2
|
export { AbstractKnownErrorConstructor, KnownError, KnownErrorConstructor, KnownErrorJson, KnownErrors };
|
|
@@ -31,9 +31,9 @@ declare const planUsageResponseSchema: yup$1.ObjectSchema<{
|
|
|
31
31
|
next_plan_id: "team" | "growth" | null;
|
|
32
32
|
are_plan_limits_enforced: boolean;
|
|
33
33
|
rows: {
|
|
34
|
-
item_id: "dashboard_admins" | "auth_users" | "emails_per_month" | "analytics_timeout_seconds" | "analytics_events" | "session_replays" | "onboarding_call";
|
|
35
34
|
display_name: string;
|
|
36
35
|
kind: "current" | "metered" | "capability";
|
|
36
|
+
item_id: "dashboard_admins" | "auth_users" | "emails_per_month" | "analytics_timeout_seconds" | "analytics_events" | "session_replays" | "onboarding_call";
|
|
37
37
|
used: number | null;
|
|
38
38
|
limit: number | null;
|
|
39
39
|
remaining: number | null;
|
|
@@ -56,4 +56,4 @@ type PlanUsageRow = yup$1.InferType<typeof planUsageRowSchema>;
|
|
|
56
56
|
type PlanUsageResponse = yup$1.InferType<typeof planUsageResponseSchema>;
|
|
57
57
|
//#endregion
|
|
58
58
|
export { planUsageResponseSchema as a, planUsageKindSchema as i, PlanUsageResponse as n, planUsageRowSchema as o, PlanUsageRow as r, PlanUsageKind as t };
|
|
59
|
-
//# sourceMappingURL=plan-usage-
|
|
59
|
+
//# sourceMappingURL=plan-usage-D0kWw4HR.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-usage-
|
|
1
|
+
{"version":3,"file":"plan-usage-D0kWw4HR.d.ts","names":[],"sources":["../src/interface/plan-usage.ts"],"mappings":";;;cAOa,mBAAA,EAAmB,KAAA,CAAA,YAAA,uCAAA,KAAA,CAAA,SAAA;AAAA,cAEnB,kBAAA,EAAkB,KAAA,CAAA,YAAA;;;;;;;;;GASnB,KAAA,CAAA,SAAA;;;;;;;;;;cAEC,uBAAA,EAAuB,KAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;;GAUxB,KAAA,CAAA,SAAA;;;;;;;;;;;KAEA,aAAA,GAAgB,KAAA,CAAI,SAAS,QAAQ,mBAAA;AAAA,KACrC,YAAA,GAAe,KAAA,CAAI,SAAS,QAAQ,kBAAA;AAAA,KACpC,iBAAA,GAAoB,KAAA,CAAI,SAAS,QAAQ,uBAAA"}
|
|
@@ -6,12 +6,13 @@ declare const customerProductReadSchema: yup$1.ObjectSchema<{
|
|
|
6
6
|
id: string | null;
|
|
7
7
|
quantity: number;
|
|
8
8
|
product: {
|
|
9
|
-
free_trial?: DayInterval | undefined;
|
|
10
9
|
client_metadata?: {} | null | undefined;
|
|
11
10
|
client_read_only_metadata?: {} | null | undefined;
|
|
12
11
|
server_metadata?: {} | null | undefined;
|
|
12
|
+
free_trial?: DayInterval | undefined;
|
|
13
|
+
display_name: string;
|
|
13
14
|
server_only: boolean;
|
|
14
|
-
customer_type: "
|
|
15
|
+
customer_type: "user" | "team" | "custom";
|
|
15
16
|
stackable: boolean;
|
|
16
17
|
prices: Record<string, {
|
|
17
18
|
USD?: string | undefined;
|
|
@@ -24,10 +25,9 @@ declare const customerProductReadSchema: yup$1.ObjectSchema<{
|
|
|
24
25
|
interval?: DayInterval | undefined;
|
|
25
26
|
free_trial?: DayInterval | undefined;
|
|
26
27
|
}>;
|
|
27
|
-
display_name: string;
|
|
28
28
|
included_items: Record<string, {
|
|
29
|
-
quantity?: number | undefined;
|
|
30
29
|
repeat?: "never" | DayInterval | undefined;
|
|
30
|
+
quantity?: number | undefined;
|
|
31
31
|
expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
|
|
32
32
|
}>;
|
|
33
33
|
};
|
|
@@ -41,12 +41,13 @@ declare const customerProductReadSchema: yup$1.ObjectSchema<{
|
|
|
41
41
|
switch_options: {
|
|
42
42
|
product_id: string;
|
|
43
43
|
product: {
|
|
44
|
-
free_trial?: DayInterval | undefined;
|
|
45
44
|
client_metadata?: {} | null | undefined;
|
|
46
45
|
client_read_only_metadata?: {} | null | undefined;
|
|
47
46
|
server_metadata?: {} | null | undefined;
|
|
47
|
+
free_trial?: DayInterval | undefined;
|
|
48
|
+
display_name: string;
|
|
48
49
|
server_only: boolean;
|
|
49
|
-
customer_type: "
|
|
50
|
+
customer_type: "user" | "team" | "custom";
|
|
50
51
|
stackable: boolean;
|
|
51
52
|
prices: Record<string, {
|
|
52
53
|
USD?: string | undefined;
|
|
@@ -59,10 +60,9 @@ declare const customerProductReadSchema: yup$1.ObjectSchema<{
|
|
|
59
60
|
interval?: DayInterval | undefined;
|
|
60
61
|
free_trial?: DayInterval | undefined;
|
|
61
62
|
}>;
|
|
62
|
-
display_name: string;
|
|
63
63
|
included_items: Record<string, {
|
|
64
|
-
quantity?: number | undefined;
|
|
65
64
|
repeat?: "never" | DayInterval | undefined;
|
|
65
|
+
quantity?: number | undefined;
|
|
66
66
|
expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
|
|
67
67
|
}>;
|
|
68
68
|
};
|
|
@@ -104,12 +104,13 @@ declare const customerProductsListResponseSchema: yup$1.ObjectSchema<{
|
|
|
104
104
|
switch_options?: {
|
|
105
105
|
product_id: string;
|
|
106
106
|
product: {
|
|
107
|
-
free_trial?: DayInterval | undefined;
|
|
108
107
|
client_metadata?: {} | null | undefined;
|
|
109
108
|
client_read_only_metadata?: {} | null | undefined;
|
|
110
109
|
server_metadata?: {} | null | undefined;
|
|
110
|
+
free_trial?: DayInterval | undefined;
|
|
111
|
+
display_name: string;
|
|
111
112
|
server_only: boolean;
|
|
112
|
-
customer_type: "
|
|
113
|
+
customer_type: "user" | "team" | "custom";
|
|
113
114
|
stackable: boolean;
|
|
114
115
|
prices: Record<string, {
|
|
115
116
|
USD?: string | undefined;
|
|
@@ -122,22 +123,23 @@ declare const customerProductsListResponseSchema: yup$1.ObjectSchema<{
|
|
|
122
123
|
interval?: DayInterval | undefined;
|
|
123
124
|
free_trial?: DayInterval | undefined;
|
|
124
125
|
}>;
|
|
125
|
-
display_name: string;
|
|
126
126
|
included_items: Record<string, {
|
|
127
|
-
quantity?: number | undefined;
|
|
128
127
|
repeat?: "never" | DayInterval | undefined;
|
|
128
|
+
quantity?: number | undefined;
|
|
129
129
|
expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
|
|
130
130
|
}>;
|
|
131
131
|
};
|
|
132
132
|
}[] | undefined;
|
|
133
|
+
id: string | null;
|
|
133
134
|
quantity: number;
|
|
134
135
|
product: {
|
|
135
|
-
free_trial?: DayInterval | undefined;
|
|
136
136
|
client_metadata?: {} | null | undefined;
|
|
137
137
|
client_read_only_metadata?: {} | null | undefined;
|
|
138
138
|
server_metadata?: {} | null | undefined;
|
|
139
|
+
free_trial?: DayInterval | undefined;
|
|
140
|
+
display_name: string;
|
|
139
141
|
server_only: boolean;
|
|
140
|
-
customer_type: "
|
|
142
|
+
customer_type: "user" | "team" | "custom";
|
|
141
143
|
stackable: boolean;
|
|
142
144
|
prices: Record<string, {
|
|
143
145
|
USD?: string | undefined;
|
|
@@ -150,14 +152,12 @@ declare const customerProductsListResponseSchema: yup$1.ObjectSchema<{
|
|
|
150
152
|
interval?: DayInterval | undefined;
|
|
151
153
|
free_trial?: DayInterval | undefined;
|
|
152
154
|
}>;
|
|
153
|
-
display_name: string;
|
|
154
155
|
included_items: Record<string, {
|
|
155
|
-
quantity?: number | undefined;
|
|
156
156
|
repeat?: "never" | DayInterval | undefined;
|
|
157
|
+
quantity?: number | undefined;
|
|
157
158
|
expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
|
|
158
159
|
}>;
|
|
159
160
|
};
|
|
160
|
-
id: string | null;
|
|
161
161
|
}[];
|
|
162
162
|
is_paginated: boolean;
|
|
163
163
|
pagination: {
|
|
@@ -179,4 +179,4 @@ type ListCustomerProductsOptions = {
|
|
|
179
179
|
};
|
|
180
180
|
//#endregion
|
|
181
181
|
export { customerProductsListResponseSchema as a, customerProductReadSchema as i, CustomerProductsListResponse as n, ListCustomerProductsOptions as r, CustomerProductRead as t };
|
|
182
|
-
//# sourceMappingURL=products-
|
|
182
|
+
//# sourceMappingURL=products-C98fCS-1.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products-
|
|
1
|
+
{"version":3,"file":"products-C98fCS-1.d.ts","names":[],"sources":["../src/interface/crud/products.ts"],"mappings":";;;;cAQa,yBAAA,EAAyB,KAAA,CAAA,YAAA;;;;;;;iBAc1B,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEA,mBAAA,GAAsB,KAAA,CAAI,SAAS,QAAQ,yBAAA;AAAA,cAE1C,kCAAA,EAAkC,KAAA,CAAA,YAAA;;;;;;;;;;;;;;;qBAMnC,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEA,4BAAA,GAA+B,KAAA,CAAI,SAAS,QAAQ,kCAAA;AAAA,KAEpD,2BAAA;EACV,aAAA;EACA,WAAA;EACA,MAAA;EACA,KAAA;AAAA"}
|