@hexclave/shared 1.0.45 → 1.0.47
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-B-UjGQ0i.d.ts → admin-interface-DH4uLcZ3.d.ts} +11 -11
- package/dist/{admin-interface-B-UjGQ0i.d.ts.map → admin-interface-DH4uLcZ3.d.ts.map} +1 -1
- package/dist/{admin-metrics-1yiWGq9z.d.ts → admin-metrics-pphx-0AE.d.ts} +11 -11
- package/dist/{admin-metrics-1yiWGq9z.d.ts.map → admin-metrics-pphx-0AE.d.ts.map} +1 -1
- package/dist/ai/unified-prompts/reminders.js +2 -1
- package/dist/ai/unified-prompts/reminders.js.map +1 -1
- package/dist/{client-interface-DjVtlQix.d.ts → client-interface-BmHWUJhv.d.ts} +10 -10
- package/dist/{client-interface-DjVtlQix.d.ts.map → client-interface-BmHWUJhv.d.ts.map} +1 -1
- package/dist/config/schema.d.ts +1 -1
- package/dist/config-authoring.d.ts +1 -1
- package/dist/{current-user-BCkMYzHx.d.ts → current-user-Dvf8Ttjo.d.ts} +15 -15
- package/dist/{current-user-BCkMYzHx.d.ts.map → current-user-Dvf8Ttjo.d.ts.map} +1 -1
- package/dist/dates-BRAvSk6L.d.ts +40 -0
- package/dist/{dates-B6ne9iOR.d.ts.map → dates-BRAvSk6L.d.ts.map} +1 -1
- package/dist/{email-outbox-BRZiK0ZG.d.ts → email-outbox-DoxRUJop.d.ts} +179 -179
- package/dist/{email-outbox-BRZiK0ZG.d.ts.map → email-outbox-DoxRUJop.d.ts.map} +1 -1
- package/dist/esm/ai/unified-prompts/reminders.js +1 -1
- package/dist/esm/config/schema.d.ts +92 -92
- package/dist/esm/interface/admin-interface.js +1 -1
- package/dist/esm/interface/admin-metrics.d.ts +10 -10
- package/dist/esm/interface/client-interface.js +1 -1
- package/dist/esm/interface/conversations.d.ts +7 -7
- package/dist/esm/interface/crud/current-user.d.ts +14 -14
- package/dist/esm/interface/crud/email-outbox.d.ts +178 -178
- package/dist/esm/interface/crud/invoices.d.ts +1 -1
- package/dist/esm/interface/crud/products.d.ts +21 -21
- package/dist/esm/interface/crud/project-api-keys.d.ts +4 -4
- package/dist/esm/interface/crud/projects.d.ts +16 -16
- package/dist/esm/interface/crud/team-member-profiles.d.ts +22 -22
- package/dist/esm/interface/crud/transactions.d.ts +17 -17
- package/dist/esm/interface/crud/transactions.d.ts.map +1 -1
- package/dist/esm/interface/crud/users.d.ts +12 -12
- package/dist/esm/interface/plan-usage.d.ts +3 -1
- package/dist/esm/interface/plan-usage.d.ts.map +1 -1
- package/dist/esm/interface/plan-usage.js +1 -0
- package/dist/esm/interface/plan-usage.js.map +1 -1
- package/dist/esm/interface/server-interface.js +1 -1
- package/dist/esm/interface/webhooks.d.ts +2 -2
- package/dist/esm/known-errors.d.ts +3 -3
- package/dist/esm/schema-fields.d.ts +12 -12
- package/dist/esm/schema-fields.d.ts.map +1 -1
- package/dist/esm/schema-fields.js +2 -2
- package/dist/esm/schema-fields.js.map +1 -1
- package/dist/esm/sessions.d.ts +9 -9
- package/dist/esm/utils/currencies.d.ts +16 -1
- package/dist/esm/utils/currencies.d.ts.map +1 -1
- package/dist/esm/utils/currencies.js +24 -1
- package/dist/esm/utils/currencies.js.map +1 -1
- package/dist/esm/utils/dates.d.ts +18 -1
- package/dist/esm/utils/dates.d.ts.map +1 -1
- package/dist/esm/utils/dates.js +36 -15
- 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-interface.js +1 -1
- package/dist/interface/admin-metrics.d.ts +1 -1
- package/dist/interface/client-interface.d.ts +1 -1
- package/dist/interface/client-interface.js +1 -1
- package/dist/interface/conversations.d.ts +7 -7
- package/dist/interface/crud/current-user.d.ts +1 -1
- package/dist/interface/crud/email-outbox.d.ts +1 -1
- package/dist/interface/crud/invoices.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/plan-usage.js +1 -0
- package/dist/interface/plan-usage.js.map +1 -1
- package/dist/interface/server-interface.d.ts +1 -1
- package/dist/interface/server-interface.js +1 -1
- package/dist/interface/webhooks.d.ts +1 -1
- package/dist/{invoices-BGLLnTlR.d.ts → invoices-U65KzAZX.d.ts} +2 -2
- package/dist/{invoices-BGLLnTlR.d.ts.map → invoices-U65KzAZX.d.ts.map} +1 -1
- package/dist/{known-errors-g7JC8z58.d.ts → known-errors-Bm4a61wL.d.ts} +4 -4
- package/dist/{known-errors-g7JC8z58.d.ts.map → known-errors-Bm4a61wL.d.ts.map} +1 -1
- package/dist/known-errors.d.ts +1 -1
- package/dist/{plan-usage-BigvGIcT.d.ts → plan-usage-BaDxcLZ1.d.ts} +4 -2
- package/dist/plan-usage-BaDxcLZ1.d.ts.map +1 -0
- package/dist/{products-D_fcxfR0.d.ts → products-D4o8A2W0.d.ts} +23 -23
- package/dist/{products-D_fcxfR0.d.ts.map → products-D4o8A2W0.d.ts.map} +1 -1
- package/dist/{project-api-keys-OQqmKtMS.d.ts → project-api-keys--7V5X_UW.d.ts} +5 -5
- package/dist/{project-api-keys-OQqmKtMS.d.ts.map → project-api-keys--7V5X_UW.d.ts.map} +1 -1
- package/dist/{projects-C42SVFvm.d.ts → projects-dH9I0bcX.d.ts} +17 -17
- package/dist/{projects-C42SVFvm.d.ts.map → projects-dH9I0bcX.d.ts.map} +1 -1
- package/dist/{schema-Bgy-GC70.d.ts → schema-BSb4tzx3.d.ts} +94 -94
- package/dist/{schema-Bgy-GC70.d.ts.map → schema-BSb4tzx3.d.ts.map} +1 -1
- package/dist/{schema-fields-BljhsWsa.d.ts → schema-fields-DZtDQEEO.d.ts} +14 -14
- package/dist/schema-fields-DZtDQEEO.d.ts.map +1 -0
- package/dist/schema-fields.d.ts +1 -1
- package/dist/schema-fields.js +2 -2
- package/dist/schema-fields.js.map +1 -1
- package/dist/{server-interface-C1W1tZ_y.d.ts → server-interface-CxorzgTW.d.ts} +8 -8
- package/dist/{server-interface-C1W1tZ_y.d.ts.map → server-interface-CxorzgTW.d.ts.map} +1 -1
- package/dist/{sessions-C0nM8bE_.d.ts → sessions-CI-0TBQb.d.ts} +11 -11
- package/dist/{sessions-C0nM8bE_.d.ts.map → sessions-CI-0TBQb.d.ts.map} +1 -1
- package/dist/sessions.d.ts +1 -1
- package/dist/{team-member-profiles-CgYXR-Rx.d.ts → team-member-profiles-uTluO8XI.d.ts} +23 -23
- package/dist/{team-member-profiles-CgYXR-Rx.d.ts.map → team-member-profiles-uTluO8XI.d.ts.map} +1 -1
- package/dist/{transactions-BomBBiph.d.ts → transactions-CHNUJ42J.d.ts} +19 -19
- package/dist/transactions-CHNUJ42J.d.ts.map +1 -0
- package/dist/{users-7MKfEyyq.d.ts → users-CmBBuF00.d.ts} +14 -14
- package/dist/{users-7MKfEyyq.d.ts.map → users-CmBBuF00.d.ts.map} +1 -1
- package/dist/utils/currencies.d.ts +16 -1
- package/dist/utils/currencies.d.ts.map +1 -1
- package/dist/utils/currencies.js +24 -0
- package/dist/utils/currencies.js.map +1 -1
- package/dist/utils/dates.d.ts +2 -2
- package/dist/utils/dates.js +36 -14
- package/dist/utils/dates.js.map +1 -1
- package/dist/{webhooks-C5gG85Ce.d.ts → webhooks-ByXrdSOx.d.ts} +3 -3
- package/dist/{webhooks-C5gG85Ce.d.ts.map → webhooks-ByXrdSOx.d.ts.map} +1 -1
- package/package.json +1 -1
- package/src/interface/plan-usage.ts +1 -0
- package/src/schema-fields.ts +13 -2
- package/src/utils/currencies.tsx +69 -0
- package/src/utils/dates.tsx +104 -15
- package/dist/dates-B6ne9iOR.d.ts +0 -23
- package/dist/plan-usage-BigvGIcT.d.ts.map +0 -1
- package/dist/schema-fields-BljhsWsa.d.ts.map +0 -1
- package/dist/transactions-BomBBiph.d.ts.map +0 -1
|
@@ -18,6 +18,23 @@ declare function subtractInterval(date: Date, interval: Interval): Date;
|
|
|
18
18
|
declare function addInterval(date: Date, interval: Interval): Date;
|
|
19
19
|
declare const FAR_FUTURE_DATE: Date;
|
|
20
20
|
declare function getIntervalsElapsed(anchor: Date, to: Date, repeat: DayInterval): number;
|
|
21
|
+
/**
|
|
22
|
+
* The UTC millis of the `occurrence`-th (1-based) repeat of `interval` after `anchorMillis`.
|
|
23
|
+
*
|
|
24
|
+
* Each boundary is computed from the *original* anchor (never by stepping off the previous, possibly
|
|
25
|
+
* clamped, boundary) so the anchor's day-of-month is preserved across resets: a Jan 31 anchor yields
|
|
26
|
+
* Feb 28, Mar 31, Apr 30, ... (matching Stripe's billing-cycle behavior) rather than drifting to
|
|
27
|
+
* Feb 28, Mar 28, ... . Month/year overflow (e.g. Jan 31 -> Feb) is clamped to the target month's
|
|
28
|
+
* last day. Day/week are exact multiples (no calendar involved, so no drift possible).
|
|
29
|
+
*
|
|
30
|
+
* Everything is done in UTC (unlike `addInterval`, which uses local-time Date accessors) so the
|
|
31
|
+
* result is deterministic regardless of the server's timezone — this is relied upon by bulldozer
|
|
32
|
+
* folds, which must be reproducible across machines.
|
|
33
|
+
*
|
|
34
|
+
* `occurrence` 0 returns the anchor itself; `getIntervalsElapsed` counts these same boundaries, so
|
|
35
|
+
* the two are always consistent for a given DayInterval.
|
|
36
|
+
*/
|
|
37
|
+
declare function nthDayIntervalMillis(anchorMillis: number, interval: DayInterval, occurrence: number): number;
|
|
21
38
|
//#endregion
|
|
22
|
-
export { DayInterval, FAR_FUTURE_DATE, Interval, addInterval, fromNow, fromNowDetailed, getInputDatetimeLocalString, getIntervalsElapsed, isWeekend, subtractInterval };
|
|
39
|
+
export { DayInterval, FAR_FUTURE_DATE, Interval, addInterval, fromNow, fromNowDetailed, getInputDatetimeLocalString, getIntervalsElapsed, isWeekend, nthDayIntervalMillis, subtractInterval };
|
|
23
40
|
//# sourceMappingURL=dates.d.ts.map
|
|
@@ -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,iBA+CI,gBAAA,CAAiB,IAAA,EAAM,IAAA,EAAM,QAAA,EAAU,QAAA,GAAW,IAAA;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,iBA+CI,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,cAIhD,eAAA,EAAe,IAA6B;AAAA,iBAgBzC,mBAAA,CAAoB,MAAA,EAAQ,IAAA,EAAM,EAAA,EAAI,IAAA,EAAM,MAAA,EAAQ,WAAA;;AA5JhD;AA6CpB;;;;AAAsD;AAkCtD;;;;AAAoB;AACpB;;;;iBA6HgB,oBAAA,CAAqB,YAAA,UAAsB,QAAA,EAAU,WAAW,EAAE,UAAA"}
|
package/dist/esm/utils/dates.js
CHANGED
|
@@ -99,26 +99,47 @@ function getMsPerDayIntervalUnit(unit) {
|
|
|
99
99
|
}
|
|
100
100
|
function getIntervalsElapsed(anchor, to, repeat) {
|
|
101
101
|
const [amount, unit] = repeat;
|
|
102
|
-
|
|
102
|
+
const toMillis = to.getTime();
|
|
103
|
+
if (toMillis <= anchor.getTime()) return 0;
|
|
103
104
|
if (unit === "day" || unit === "week") {
|
|
104
105
|
const msPerUnit = getMsPerDayIntervalUnit(unit);
|
|
105
|
-
const diffMs =
|
|
106
|
+
const diffMs = toMillis - anchor.getTime();
|
|
106
107
|
return Math.floor(diffMs / (msPerUnit * amount));
|
|
107
108
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
109
|
+
let count = 0;
|
|
110
|
+
while (nthDayIntervalMillis(anchor.getTime(), repeat, count + 1) <= toMillis) count += 1;
|
|
111
|
+
return count;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The UTC millis of the `occurrence`-th (1-based) repeat of `interval` after `anchorMillis`.
|
|
115
|
+
*
|
|
116
|
+
* Each boundary is computed from the *original* anchor (never by stepping off the previous, possibly
|
|
117
|
+
* clamped, boundary) so the anchor's day-of-month is preserved across resets: a Jan 31 anchor yields
|
|
118
|
+
* Feb 28, Mar 31, Apr 30, ... (matching Stripe's billing-cycle behavior) rather than drifting to
|
|
119
|
+
* Feb 28, Mar 28, ... . Month/year overflow (e.g. Jan 31 -> Feb) is clamped to the target month's
|
|
120
|
+
* last day. Day/week are exact multiples (no calendar involved, so no drift possible).
|
|
121
|
+
*
|
|
122
|
+
* Everything is done in UTC (unlike `addInterval`, which uses local-time Date accessors) so the
|
|
123
|
+
* result is deterministic regardless of the server's timezone — this is relied upon by bulldozer
|
|
124
|
+
* folds, which must be reproducible across machines.
|
|
125
|
+
*
|
|
126
|
+
* `occurrence` 0 returns the anchor itself; `getIntervalsElapsed` counts these same boundaries, so
|
|
127
|
+
* the two are always consistent for a given DayInterval.
|
|
128
|
+
*/
|
|
129
|
+
function nthDayIntervalMillis(anchorMillis, interval, occurrence) {
|
|
130
|
+
const [count, unit] = interval;
|
|
131
|
+
const totalUnits = count * occurrence;
|
|
132
|
+
if (unit === "day" || unit === "week") return anchorMillis + totalUnits * getMsPerDayIntervalUnit(unit);
|
|
133
|
+
const anchor = new Date(anchorMillis);
|
|
134
|
+
const monthsToAdd = unit === "year" ? totalUnits * 12 : totalUnits;
|
|
135
|
+
const absoluteMonth = anchor.getUTCFullYear() * 12 + anchor.getUTCMonth() + monthsToAdd;
|
|
136
|
+
const targetYear = Math.floor(absoluteMonth / 12);
|
|
137
|
+
const targetMonth = absoluteMonth - targetYear * 12;
|
|
138
|
+
const daysInTargetMonth = new Date(Date.UTC(targetYear, targetMonth + 1, 0)).getUTCDate();
|
|
139
|
+
const clampedDay = Math.min(anchor.getUTCDate(), daysInTargetMonth);
|
|
140
|
+
return Date.UTC(targetYear, targetMonth, clampedDay, anchor.getUTCHours(), anchor.getUTCMinutes(), anchor.getUTCSeconds(), anchor.getUTCMilliseconds());
|
|
120
141
|
}
|
|
121
142
|
//#endregion
|
|
122
|
-
export { FAR_FUTURE_DATE, addInterval, fromNow, fromNowDetailed, getInputDatetimeLocalString, getIntervalsElapsed, isWeekend, subtractInterval };
|
|
143
|
+
export { FAR_FUTURE_DATE, addInterval, fromNow, fromNowDetailed, getInputDatetimeLocalString, getIntervalsElapsed, isWeekend, nthDayIntervalMillis, subtractInterval };
|
|
123
144
|
|
|
124
145
|
//# sourceMappingURL=dates.js.map
|
|
@@ -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\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\nexport function getIntervalsElapsed(anchor: Date, to: Date, repeat: DayInterval): number {\n const [amount, unit] = repeat;\n if (to <= anchor) return 0;\n if (unit === 'day' || unit === 'week') {\n const msPerUnit = getMsPerDayIntervalUnit(unit);\n const diffMs = to.getTime() - anchor.getTime();\n return Math.floor(diffMs / (msPerUnit * amount));\n }\n if ([\"month\", \"year\"].includes(unit)) {\n let count = 0;\n let current = new Date(anchor);\n for (; ;) {\n const next = addInterval(new Date(current), [amount, unit]);\n if (next > to) break;\n current = next;\n count += 1;\n }\n return count;\n }\n return 0;\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 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(0);\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"],"mappings":";;;;AAIA,SAAgB,UAAU,MAAqB;CAC7C,OAAO,KAAK,OAAO,MAAM,KAAK,KAAK,OAAO,MAAM;AAClD;AAaA,MAAM,WAAW;CACf,CAAC,IAAI,QAAQ;CACb,CAAC,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AAM,SAAS,GAAG,QAAQ,IAAI,OAAO,QAAQ;EAC7C,OAAO,KAAK,MAAM,UAAU,YAAY,OAAO;CACjD;CACA,IAAI,CAAC,SAAS,MAAM,CAAC,CAAC,SAAS,IAAI,GAAG;EACpC,IAAI,QAAQ;EACZ,IAAI,UAAU,IAAI,KAAK,MAAM;EAC7B,SAAU;GACR,MAAM,OAAO,YAAY,IAAI,KAAK,OAAO,GAAG,CAAC,QAAQ,IAAI,CAAC;GAC1D,IAAI,OAAO,IAAI;GACf,UAAU;GACV,SAAS;EACX;EACA,OAAO;CACT;CACA,OAAO;AACT"}
|
|
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.123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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-Bm4a61wL.js";
|
|
2
|
+
import { n as HexclaveClientInterface } from "./client-interface-BmHWUJhv.js";
|
|
3
|
+
import { t as HexclaveServerInterface } from "./server-interface-CxorzgTW.js";
|
|
4
|
+
import { r as HexclaveAdminInterface } from "./admin-interface-DH4uLcZ3.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-BaDxcLZ1.js";
|
|
2
|
+
import { a as InternalApiKeyCreateCrudResponse, i as InternalApiKeyCreateCrudRequest, n as ChatContent, r as HexclaveAdminInterface, t as AdminAuthApplicationOptions } from "../admin-interface-DH4uLcZ3.js";
|
|
3
3
|
export { AdminAuthApplicationOptions, ChatContent, HexclaveAdminInterface, InternalApiKeyCreateCrudRequest, InternalApiKeyCreateCrudResponse, type PlanUsageResponse };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let ___utils_results_js = require("../utils/results.js");
|
|
3
|
-
let ___utils_urls_js = require("../utils/urls.js");
|
|
4
3
|
let ___known_errors_js = require("../known-errors.js");
|
|
4
|
+
let ___utils_urls_js = require("../utils/urls.js");
|
|
5
5
|
let __server_interface_js = require("./server-interface.js");
|
|
6
6
|
//#region src/interface/admin-interface.ts
|
|
7
7
|
var HexclaveAdminInterface = class extends __server_interface_js.HexclaveServerInterface {
|
|
@@ -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-pphx-0AE.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-BmHWUJhv.js";
|
|
2
2
|
export { ClientInterfaceOptions, HexclaveClientInterface, RequestListener, RequestLogEntry };
|
|
@@ -4,8 +4,8 @@ let ___utils_objects_js = require("../utils/objects.js");
|
|
|
4
4
|
let ___utils_strings_js = require("../utils/strings.js");
|
|
5
5
|
let ___utils_oauth_js = require("../utils/oauth.js");
|
|
6
6
|
let ___utils_results_js = require("../utils/results.js");
|
|
7
|
-
let ___utils_urls_js = require("../utils/urls.js");
|
|
8
7
|
let ___known_errors_js = require("../known-errors.js");
|
|
8
|
+
let ___utils_urls_js = require("../utils/urls.js");
|
|
9
9
|
let ___sessions_js = require("../sessions.js");
|
|
10
10
|
let ___utils_crypto_js = require("../utils/crypto.js");
|
|
11
11
|
let ___utils_globals_js = require("../utils/globals.js");
|
|
@@ -139,8 +139,8 @@ declare const conversationMessageSchema: yup$1.ObjectSchema<{
|
|
|
139
139
|
createdAt: string;
|
|
140
140
|
sender: {
|
|
141
141
|
type: "user" | "agent" | "system";
|
|
142
|
-
id: string | null;
|
|
143
142
|
displayName: string | null;
|
|
143
|
+
id: string | null;
|
|
144
144
|
primaryEmail: string | null;
|
|
145
145
|
};
|
|
146
146
|
}, yup$1.AnyObject, {
|
|
@@ -173,6 +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: "pending" | "open" | "closed";
|
|
176
177
|
source: "email" | "manual" | "chat" | "api";
|
|
177
178
|
metadata: {
|
|
178
179
|
tags: string[];
|
|
@@ -184,7 +185,6 @@ declare const conversationListResponseSchema: yup$1.ObjectSchema<{
|
|
|
184
185
|
lastCustomerReplyAt: string | null;
|
|
185
186
|
lastAgentReplyAt: string | null;
|
|
186
187
|
};
|
|
187
|
-
status: "pending" | "open" | "closed";
|
|
188
188
|
subject: string;
|
|
189
189
|
priority: "low" | "normal" | "high" | "urgent";
|
|
190
190
|
conversationId: string;
|
|
@@ -211,6 +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: "pending" | "open" | "closed";
|
|
214
215
|
source: "email" | "manual" | "chat" | "api";
|
|
215
216
|
metadata: {
|
|
216
217
|
tags: string[];
|
|
@@ -222,7 +223,6 @@ declare const conversationDetailResponseSchema: yup$1.ObjectSchema<{
|
|
|
222
223
|
lastCustomerReplyAt: string | null;
|
|
223
224
|
lastAgentReplyAt: string | null;
|
|
224
225
|
};
|
|
225
|
-
status: "pending" | "open" | "closed";
|
|
226
226
|
subject: string;
|
|
227
227
|
priority: "low" | "normal" | "high" | "urgent";
|
|
228
228
|
conversationId: string;
|
|
@@ -236,11 +236,11 @@ declare const conversationDetailResponseSchema: yup$1.ObjectSchema<{
|
|
|
236
236
|
lastActivityAt: string;
|
|
237
237
|
};
|
|
238
238
|
messages: {
|
|
239
|
+
status: "pending" | "open" | "closed";
|
|
240
|
+
id: string;
|
|
239
241
|
body: string | null;
|
|
240
242
|
source: "email" | "manual" | "chat" | "api";
|
|
241
243
|
metadata: {} | null;
|
|
242
|
-
id: string;
|
|
243
|
-
status: "pending" | "open" | "closed";
|
|
244
244
|
subject: string;
|
|
245
245
|
priority: "low" | "normal" | "high" | "urgent";
|
|
246
246
|
conversationId: string;
|
|
@@ -251,14 +251,14 @@ declare const conversationDetailResponseSchema: yup$1.ObjectSchema<{
|
|
|
251
251
|
attachments: {}[];
|
|
252
252
|
sender: {
|
|
253
253
|
type: "user" | "agent" | "system";
|
|
254
|
-
id: string | null;
|
|
255
254
|
displayName: string | null;
|
|
255
|
+
id: string | null;
|
|
256
256
|
primaryEmail: string | null;
|
|
257
257
|
};
|
|
258
258
|
}[];
|
|
259
259
|
entryPoints: {
|
|
260
|
-
metadata: {} | null;
|
|
261
260
|
id: string;
|
|
261
|
+
metadata: {} | null;
|
|
262
262
|
createdAt: string;
|
|
263
263
|
updatedAt: string;
|
|
264
264
|
channelType: string;
|
|
@@ -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-Dvf8Ttjo.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-DoxRUJop.js";
|
|
2
2
|
export { EmailOutboxCrud, emailOutboxCrud, emailOutboxReadSchema, emailOutboxUpdateSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as customerInvoicesListResponseSchema, i as customerInvoiceReadSchema, n as CustomerInvoicesListResponse, r as ListCustomerInvoicesOptions, t as CustomerInvoiceRead } from "../../invoices-
|
|
1
|
+
import { a as customerInvoicesListResponseSchema, i as customerInvoiceReadSchema, n as CustomerInvoicesListResponse, r as ListCustomerInvoicesOptions, t as CustomerInvoiceRead } from "../../invoices-U65KzAZX.js";
|
|
2
2
|
export { CustomerInvoiceRead, CustomerInvoicesListResponse, ListCustomerInvoicesOptions, customerInvoiceReadSchema, customerInvoicesListResponseSchema };
|
|
@@ -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-D4o8A2W0.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--7V5X_UW.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-dH9I0bcX.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-uTluO8XI.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-CHNUJ42J.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-CmBBuF00.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-BaDxcLZ1.js";
|
|
2
2
|
export { PlanUsageKind, PlanUsageResponse, PlanUsageRow, planUsageKindSchema, planUsageResponseSchema, planUsageRowSchema };
|
|
@@ -27,6 +27,7 @@ const planUsageResponseSchema = (0, ___schema_fields_js.yupObject)({
|
|
|
27
27
|
period_start_millis: (0, ___schema_fields_js.yupNumber)().integer().defined(),
|
|
28
28
|
period_end_millis: (0, ___schema_fields_js.yupNumber)().integer().defined(),
|
|
29
29
|
next_plan_id: (0, ___schema_fields_js.yupString)().oneOf(UPGRADE_PLAN_IDS).nullable().defined(),
|
|
30
|
+
are_plan_limits_enforced: (0, ___schema_fields_js.yupBoolean)().optional().default(true),
|
|
30
31
|
rows: (0, ___schema_fields_js.yupArray)(planUsageRowSchema).defined()
|
|
31
32
|
}).defined();
|
|
32
33
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-usage.js","names":["PLAN_LIMITS","ITEM_IDS"],"sources":["../../src/interface/plan-usage.ts"],"sourcesContent":["import * as yup from \"yup\";\nimport { ITEM_IDS, PLAN_LIMITS } from \"../plans\";\nimport { yupArray, yupBoolean, yupNumber, yupObject, yupString } from \"../schema-fields\";\n\nconst PLAN_IDS = Object.keys(PLAN_LIMITS) as (keyof typeof PLAN_LIMITS)[];\nconst UPGRADE_PLAN_IDS = PLAN_IDS.filter((id): id is Exclude<keyof typeof PLAN_LIMITS, \"free\"> => id !== \"free\");\n\nexport const planUsageKindSchema = yupString().oneOf([\"current\", \"metered\", \"capability\"]).defined();\n\nexport const planUsageRowSchema = yupObject({\n item_id: yupString().oneOf(Object.values(ITEM_IDS)).defined(),\n display_name: yupString().defined(),\n kind: planUsageKindSchema,\n used: yupNumber().integer().nullable().defined(),\n limit: yupNumber().integer().nullable().defined(),\n remaining: yupNumber().integer().nullable().defined(),\n overage: yupNumber().integer().nullable().defined(),\n is_unlimited: yupBoolean().defined(),\n}).defined();\n\nexport const planUsageResponseSchema = yupObject({\n owner_team_id: yupString().uuid().defined(),\n owner_team_display_name: yupString().defined(),\n plan_id: yupString().oneOf(PLAN_IDS).defined(),\n plan_display_name: yupString().defined(),\n period_start_millis: yupNumber().integer().defined(),\n period_end_millis: yupNumber().integer().defined(),\n next_plan_id: yupString().oneOf(UPGRADE_PLAN_IDS).nullable().defined(),\n rows: yupArray(planUsageRowSchema).defined(),\n}).defined();\n\nexport type PlanUsageKind = yup.InferType<typeof planUsageKindSchema>;\nexport type PlanUsageRow = yup.InferType<typeof planUsageRowSchema>;\nexport type PlanUsageResponse = yup.InferType<typeof planUsageResponseSchema>;\n"],"mappings":";;;;AAIA,MAAM,WAAW,OAAO,KAAKA,YAAAA,WAAW;AACxC,MAAM,mBAAmB,SAAS,QAAQ,OAAwD,OAAO,MAAM;AAE/G,MAAa,uBAAA,GAAA,oBAAA,UAAA,CAAgC,CAAC,CAAC,MAAM;CAAC;CAAW;CAAW;AAAY,CAAC,CAAC,CAAC,QAAQ;AAEnG,MAAa,sBAAA,GAAA,oBAAA,UAAA,CAA+B;CAC1C,UAAA,GAAA,oBAAA,UAAA,CAAmB,CAAC,CAAC,MAAM,OAAO,OAAOC,YAAAA,QAAQ,CAAC,CAAC,CAAC,QAAQ;CAC5D,eAAA,GAAA,oBAAA,UAAA,CAAwB,CAAC,CAAC,QAAQ;CAClC,MAAM;CACN,OAAA,GAAA,oBAAA,UAAA,CAAgB,CAAC,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ;CAC/C,QAAA,GAAA,oBAAA,UAAA,CAAiB,CAAC,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ;CAChD,YAAA,GAAA,oBAAA,UAAA,CAAqB,CAAC,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ;CACpD,UAAA,GAAA,oBAAA,UAAA,CAAmB,CAAC,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ;CAClD,eAAA,GAAA,oBAAA,WAAA,CAAyB,CAAC,CAAC,QAAQ;AACrC,CAAC,CAAC,CAAC,QAAQ;AAEX,MAAa,2BAAA,GAAA,oBAAA,UAAA,CAAoC;CAC/C,gBAAA,GAAA,oBAAA,UAAA,CAAyB,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ;CAC1C,0BAAA,GAAA,oBAAA,UAAA,CAAmC,CAAC,CAAC,QAAQ;CAC7C,UAAA,GAAA,oBAAA,UAAA,CAAmB,CAAC,CAAC,MAAM,QAAQ,CAAC,CAAC,QAAQ;CAC7C,oBAAA,GAAA,oBAAA,UAAA,CAA6B,CAAC,CAAC,QAAQ;CACvC,sBAAA,GAAA,oBAAA,UAAA,CAA+B,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ;CACnD,oBAAA,GAAA,oBAAA,UAAA,CAA6B,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ;CACjD,eAAA,GAAA,oBAAA,UAAA,CAAwB,CAAC,CAAC,MAAM,gBAAgB,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ;CACrE,OAAA,GAAA,oBAAA,SAAA,CAAe,kBAAkB,CAAC,CAAC,QAAQ;AAC7C,CAAC,CAAC,CAAC,QAAQ"}
|
|
1
|
+
{"version":3,"file":"plan-usage.js","names":["PLAN_LIMITS","ITEM_IDS"],"sources":["../../src/interface/plan-usage.ts"],"sourcesContent":["import * as yup from \"yup\";\nimport { ITEM_IDS, PLAN_LIMITS } from \"../plans\";\nimport { yupArray, yupBoolean, yupNumber, yupObject, yupString } from \"../schema-fields\";\n\nconst PLAN_IDS = Object.keys(PLAN_LIMITS) as (keyof typeof PLAN_LIMITS)[];\nconst UPGRADE_PLAN_IDS = PLAN_IDS.filter((id): id is Exclude<keyof typeof PLAN_LIMITS, \"free\"> => id !== \"free\");\n\nexport const planUsageKindSchema = yupString().oneOf([\"current\", \"metered\", \"capability\"]).defined();\n\nexport const planUsageRowSchema = yupObject({\n item_id: yupString().oneOf(Object.values(ITEM_IDS)).defined(),\n display_name: yupString().defined(),\n kind: planUsageKindSchema,\n used: yupNumber().integer().nullable().defined(),\n limit: yupNumber().integer().nullable().defined(),\n remaining: yupNumber().integer().nullable().defined(),\n overage: yupNumber().integer().nullable().defined(),\n is_unlimited: yupBoolean().defined(),\n}).defined();\n\nexport const planUsageResponseSchema = yupObject({\n owner_team_id: yupString().uuid().defined(),\n owner_team_display_name: yupString().defined(),\n plan_id: yupString().oneOf(PLAN_IDS).defined(),\n plan_display_name: yupString().defined(),\n period_start_millis: yupNumber().integer().defined(),\n period_end_millis: yupNumber().integer().defined(),\n next_plan_id: yupString().oneOf(UPGRADE_PLAN_IDS).nullable().defined(),\n are_plan_limits_enforced: yupBoolean().optional().default(true),\n rows: yupArray(planUsageRowSchema).defined(),\n}).defined();\n\nexport type PlanUsageKind = yup.InferType<typeof planUsageKindSchema>;\nexport type PlanUsageRow = yup.InferType<typeof planUsageRowSchema>;\nexport type PlanUsageResponse = yup.InferType<typeof planUsageResponseSchema>;\n"],"mappings":";;;;AAIA,MAAM,WAAW,OAAO,KAAKA,YAAAA,WAAW;AACxC,MAAM,mBAAmB,SAAS,QAAQ,OAAwD,OAAO,MAAM;AAE/G,MAAa,uBAAA,GAAA,oBAAA,UAAA,CAAgC,CAAC,CAAC,MAAM;CAAC;CAAW;CAAW;AAAY,CAAC,CAAC,CAAC,QAAQ;AAEnG,MAAa,sBAAA,GAAA,oBAAA,UAAA,CAA+B;CAC1C,UAAA,GAAA,oBAAA,UAAA,CAAmB,CAAC,CAAC,MAAM,OAAO,OAAOC,YAAAA,QAAQ,CAAC,CAAC,CAAC,QAAQ;CAC5D,eAAA,GAAA,oBAAA,UAAA,CAAwB,CAAC,CAAC,QAAQ;CAClC,MAAM;CACN,OAAA,GAAA,oBAAA,UAAA,CAAgB,CAAC,CAAC,QAA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ServerAuthApplicationOptions, t as HexclaveServerInterface } from "../server-interface-
|
|
1
|
+
import { n as ServerAuthApplicationOptions, t as HexclaveServerInterface } from "../server-interface-CxorzgTW.js";
|
|
2
2
|
export { HexclaveServerInterface, ServerAuthApplicationOptions };
|
|
@@ -2,8 +2,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
let ___utils_errors_js = require("../utils/errors.js");
|
|
3
3
|
let ___utils_objects_js = require("../utils/objects.js");
|
|
4
4
|
let ___utils_results_js = require("../utils/results.js");
|
|
5
|
-
let ___utils_urls_js = require("../utils/urls.js");
|
|
6
5
|
let ___known_errors_js = require("../known-errors.js");
|
|
6
|
+
let ___utils_urls_js = require("../utils/urls.js");
|
|
7
7
|
let ___sessions_js = require("../sessions.js");
|
|
8
8
|
let __client_interface_js = require("./client-interface.js");
|
|
9
9
|
let ___helpers_vault_client_side_js = require("../helpers/vault/client-side.js");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as webhookEvents, t as WebhookEvent } from "../webhooks-
|
|
1
|
+
import { n as webhookEvents, t as WebhookEvent } from "../webhooks-ByXrdSOx.js";
|
|
2
2
|
export { WebhookEvent, webhookEvents };
|
|
@@ -15,8 +15,8 @@ declare const customerInvoiceReadSchema: yup$1.ObjectSchema<{
|
|
|
15
15
|
type CustomerInvoiceRead = yup$1.InferType<typeof customerInvoiceReadSchema>;
|
|
16
16
|
declare const customerInvoicesListResponseSchema: yup$1.ObjectSchema<{
|
|
17
17
|
items: {
|
|
18
|
-
created_at_millis: number;
|
|
19
18
|
status: "draft" | "open" | "paid" | "uncollectible" | "void" | null;
|
|
19
|
+
created_at_millis: number;
|
|
20
20
|
amount_total: number;
|
|
21
21
|
hosted_invoice_url: string | null;
|
|
22
22
|
}[];
|
|
@@ -40,4 +40,4 @@ type ListCustomerInvoicesOptions = {
|
|
|
40
40
|
};
|
|
41
41
|
//#endregion
|
|
42
42
|
export { customerInvoicesListResponseSchema as a, customerInvoiceReadSchema as i, CustomerInvoicesListResponse as n, ListCustomerInvoicesOptions as r, CustomerInvoiceRead as t };
|
|
43
|
-
//# sourceMappingURL=invoices-
|
|
43
|
+
//# sourceMappingURL=invoices-U65KzAZX.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoices-
|
|
1
|
+
{"version":3,"file":"invoices-U65KzAZX.d.ts","names":[],"sources":["../src/interface/crud/invoices.ts"],"mappings":";;;cAWa,yBAAA,EAAyB,KAAA,CAAA,YAAA;;;;;GAK1B,KAAA,CAAA,SAAA;;;;;;KAEA,mBAAA,GAAsB,KAAA,CAAI,SAAS,QAAQ,yBAAA;AAAA,cAE1C,kCAAA,EAAkC,KAAA,CAAA,YAAA;;;;;;;;;;;GAMnC,KAAA,CAAA,SAAA;;;;;;;KAEA,4BAAA,GAA+B,KAAA,CAAI,SAAS,QAAQ,kCAAA;AAAA,KAEpD,2BAAA;EACV,aAAA;EACA,WAAA;EACA,MAAA;EACA,KAAA;AAAA"}
|
|
@@ -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: "team" | "user" | "custom" | undefined, actualCustomerType: "team" | "user" | "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: "team" | "user" | "custom" | undefined, actualCustomerType: "team" | "user" | "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: "team" | "user", 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-Bm4a61wL.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"known-errors-
|
|
1
|
+
{"version":3,"file":"known-errors-Bm4a61wL.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-Bm4a61wL.js";
|
|
2
2
|
export { AbstractKnownErrorConstructor, KnownError, KnownErrorConstructor, KnownErrorJson, KnownErrors };
|
|
@@ -29,9 +29,10 @@ declare const planUsageResponseSchema: yup$1.ObjectSchema<{
|
|
|
29
29
|
period_start_millis: number;
|
|
30
30
|
period_end_millis: number;
|
|
31
31
|
next_plan_id: "team" | "growth" | null;
|
|
32
|
+
are_plan_limits_enforced: boolean;
|
|
32
33
|
rows: {
|
|
33
|
-
display_name: string;
|
|
34
34
|
item_id: "dashboard_admins" | "auth_users" | "emails_per_month" | "analytics_timeout_seconds" | "analytics_events" | "session_replays" | "onboarding_call";
|
|
35
|
+
display_name: string;
|
|
35
36
|
kind: "current" | "metered" | "capability";
|
|
36
37
|
used: number | null;
|
|
37
38
|
limit: number | null;
|
|
@@ -47,6 +48,7 @@ declare const planUsageResponseSchema: yup$1.ObjectSchema<{
|
|
|
47
48
|
period_start_millis: undefined;
|
|
48
49
|
period_end_millis: undefined;
|
|
49
50
|
next_plan_id: undefined;
|
|
51
|
+
are_plan_limits_enforced: true;
|
|
50
52
|
rows: undefined;
|
|
51
53
|
}, "">;
|
|
52
54
|
type PlanUsageKind = yup$1.InferType<typeof planUsageKindSchema>;
|
|
@@ -54,4 +56,4 @@ type PlanUsageRow = yup$1.InferType<typeof planUsageRowSchema>;
|
|
|
54
56
|
type PlanUsageResponse = yup$1.InferType<typeof planUsageResponseSchema>;
|
|
55
57
|
//#endregion
|
|
56
58
|
export { planUsageResponseSchema as a, planUsageKindSchema as i, PlanUsageResponse as n, planUsageRowSchema as o, PlanUsageRow as r, PlanUsageKind as t };
|
|
57
|
-
//# sourceMappingURL=plan-usage-
|
|
59
|
+
//# sourceMappingURL=plan-usage-BaDxcLZ1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-usage-BaDxcLZ1.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"}
|