@hexclave/shared 1.0.53 → 1.0.55
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-DIt0PvhC.d.ts} +4 -4
- package/dist/{admin-interface-D9wMduWc.d.ts.map → admin-interface-DIt0PvhC.d.ts.map} +1 -1
- package/dist/ai/unified-prompts/reminders.js +1 -1
- package/dist/ai/unified-prompts/reminders.js.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/config/schema-fuzzer.test.js +1 -1
- package/dist/config/schema.d.ts +1 -1
- package/dist/config/schema.js +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/dates-BRAvSk6L.d.ts.map +1 -1
- package/dist/{email-outbox-B1wmVPRG.d.ts → email-outbox-CqzwInBL.d.ts} +91 -91
- package/dist/{email-outbox-B1wmVPRG.d.ts.map → email-outbox-CqzwInBL.d.ts.map} +1 -1
- package/dist/esm/ai/unified-prompts/reminders.js +1 -1
- package/dist/esm/ai/unified-prompts/reminders.js.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-fuzzer.test.js +1 -1
- package/dist/esm/config/schema.d.ts +28 -28
- package/dist/esm/config/schema.js +1 -1
- 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-interface.js +1 -1
- package/dist/esm/interface/client-interface.js +2 -2
- package/dist/esm/interface/crud/email-outbox.d.ts +90 -90
- package/dist/esm/interface/plan-usage.d.ts +1 -1
- package/dist/esm/interface/server-interface.js +1 -1
- package/dist/esm/package.json +18 -0
- 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/index.d.ts +1 -1
- package/dist/interface/admin-interface.d.ts +2 -2
- package/dist/interface/admin-interface.js +1 -1
- package/dist/interface/client-interface.js +2 -2
- package/dist/interface/crud/email-outbox.d.ts +1 -1
- package/dist/interface/plan-usage.d.ts +1 -1
- package/dist/interface/server-interface.js +1 -1
- package/dist/{plan-usage-BaDxcLZ1.d.ts → plan-usage-BO2GsKlN.d.ts} +2 -2
- package/dist/{plan-usage-BaDxcLZ1.d.ts.map → plan-usage-BO2GsKlN.d.ts.map} +1 -1
- package/dist/{schema-DV0SQUbY.d.ts → schema-CLmaZetm.d.ts} +29 -29
- package/dist/{schema-DV0SQUbY.d.ts.map → schema-CLmaZetm.d.ts.map} +1 -1
- package/dist/utils/dates.js +2 -1
- package/dist/utils/dates.js.map +1 -1
- package/package.json +1 -1
- package/src/ai/unified-prompts/reminders.ts +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/src/config-rendering.ts
CHANGED
|
@@ -9,7 +9,7 @@ const DEFAULT_CONFIG_IMPORT_PACKAGE = "@hexclave/js";
|
|
|
9
9
|
* so projects pinned to the last legacy release still render a config file
|
|
10
10
|
* that compiles against their installed SDK.
|
|
11
11
|
*/
|
|
12
|
-
const CONFIG_IMPORT_PACKAGES = [
|
|
12
|
+
export const CONFIG_IMPORT_PACKAGES = [
|
|
13
13
|
"@hexclave/next",
|
|
14
14
|
"@hexclave/react",
|
|
15
15
|
"@hexclave/tanstack-start",
|
|
@@ -53,8 +53,7 @@ export function renderConfigFileContent(config: unknown, importPackage?: string)
|
|
|
53
53
|
throw new Error(`Config has conflicting keys that would be dropped during normalization: ${droppedKeys.map(k => JSON.stringify(k)).join(", ")}`);
|
|
54
54
|
}
|
|
55
55
|
const pkg = importPackage ?? DEFAULT_CONFIG_IMPORT_PACKAGE;
|
|
56
|
-
const
|
|
57
|
-
const importLine = `import type { HexclaveConfig } from "${importSpecifier}";`;
|
|
56
|
+
const importLine = `import type { HexclaveConfig } from "${pkg}";`;
|
|
58
57
|
return `${importLine}\n\nexport const config: HexclaveConfig = ${JSON.stringify(normalizedConfig, null, 2)};\n`;
|
|
59
58
|
}
|
|
60
59
|
|
|
@@ -91,15 +90,15 @@ import.meta.vitest?.test("renderConfigFileContent rejects invalid config exports
|
|
|
91
90
|
|
|
92
91
|
import.meta.vitest?.test("renderConfigFileContent uses custom import package", ({ expect }) => {
|
|
93
92
|
const content = renderConfigFileContent({}, "@hexclave/next");
|
|
94
|
-
expect(content).toContain('import type { HexclaveConfig } from "@hexclave/next
|
|
93
|
+
expect(content).toContain('import type { HexclaveConfig } from "@hexclave/next";');
|
|
95
94
|
});
|
|
96
95
|
|
|
97
96
|
import.meta.vitest?.test("renderConfigFileContent defaults to @hexclave/js", ({ expect }) => {
|
|
98
97
|
const content = renderConfigFileContent({});
|
|
99
|
-
expect(content).toContain('import type { HexclaveConfig } from "@hexclave/js
|
|
98
|
+
expect(content).toContain('import type { HexclaveConfig } from "@hexclave/js";');
|
|
100
99
|
});
|
|
101
100
|
|
|
102
|
-
import.meta.vitest?.test("renderConfigFileContent
|
|
101
|
+
import.meta.vitest?.test("renderConfigFileContent imports from the SDK package root", ({ expect }) => {
|
|
103
102
|
const content = renderConfigFileContent({}, "@stackframe/next");
|
|
104
103
|
expect(content).toContain('import type { HexclaveConfig } from "@stackframe/next";');
|
|
105
104
|
});
|
package/src/utils/dates.tsx
CHANGED
|
@@ -145,10 +145,14 @@ import.meta.vitest?.test("getInputDatetimeLocalString", ({ expect }) => {
|
|
|
145
145
|
export type Interval = [number, 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'];
|
|
146
146
|
export type DayInterval = [number, 'day' | 'week' | 'month' | 'year'];
|
|
147
147
|
|
|
148
|
-
function applyInterval(
|
|
148
|
+
function applyInterval(inputDate: Date, times: number, interval: Interval): Date {
|
|
149
149
|
if (!intervalSchema.isValidSync(interval)) {
|
|
150
150
|
throw new HexclaveAssertionError(`Invalid interval`, { interval });
|
|
151
151
|
}
|
|
152
|
+
// Operate on a copy: the Date setters below mutate in place, and callers routinely pass a date they
|
|
153
|
+
// also keep a reference to (e.g. `{ currentPeriodStart: now, currentPeriodEnd: addInterval(now, ...) }`).
|
|
154
|
+
// Mutating the input would alias both fields to the same advanced date, silently collapsing the period.
|
|
155
|
+
const date = new Date(inputDate);
|
|
152
156
|
const [amount, unit] = interval;
|
|
153
157
|
switch (unit) {
|
|
154
158
|
case 'millisecond': {
|
|
@@ -203,6 +207,23 @@ export function addInterval(date: Date, interval: Interval): Date {
|
|
|
203
207
|
return applyInterval(date, 1, interval);
|
|
204
208
|
}
|
|
205
209
|
|
|
210
|
+
import.meta.vitest?.test("addInterval/subtractInterval do not mutate their input", ({ expect }) => {
|
|
211
|
+
const original = new Date('2026-07-20T00:00:00.000Z');
|
|
212
|
+
const originalMillis = original.getTime();
|
|
213
|
+
|
|
214
|
+
const later = addInterval(original, [1, 'month']);
|
|
215
|
+
const earlier = subtractInterval(original, [1, 'month']);
|
|
216
|
+
|
|
217
|
+
// The input must be untouched, and the result must be a distinct object. This guards the aliasing
|
|
218
|
+
// footgun in `{ currentPeriodStart: now, currentPeriodEnd: addInterval(now, ...) }`, where mutating
|
|
219
|
+
// `now` would collapse both fields to the same advanced instant (a zero-width period).
|
|
220
|
+
expect(original.getTime()).toBe(originalMillis);
|
|
221
|
+
expect(later).not.toBe(original);
|
|
222
|
+
expect(earlier).not.toBe(original);
|
|
223
|
+
expect(later).toEqual(new Date('2026-08-20T00:00:00.000Z'));
|
|
224
|
+
expect(earlier).toEqual(new Date('2026-06-20T00:00:00.000Z'));
|
|
225
|
+
});
|
|
226
|
+
|
|
206
227
|
export const FAR_FUTURE_DATE = new Date(8640000000000000); // 13 Sep 275760 00:00:00 UTC
|
|
207
228
|
|
|
208
229
|
function getMsPerDayIntervalUnit(unit: 'day' | 'week'): number {
|