Files
headroom/frontend/node_modules/@ark/schema/out/shared/toJsonSchema.js
Santhosh Janardhanan de2d83092e feat: Reinitialize frontend with SvelteKit and TypeScript
- Delete old Vite+Svelte frontend
- Initialize new SvelteKit project with TypeScript
- Configure Tailwind CSS v4 + DaisyUI
- Implement JWT authentication with auto-refresh
- Create login page with form validation (Zod)
- Add protected route guards
- Update Docker configuration for single-stage build
- Add E2E tests with Playwright (6/11 passing)
- Fix Svelte 5 reactivity with $state() runes

Known issues:
- 5 E2E tests failing (timing/async issues)
- Token refresh implementation needs debugging
- Validation error display timing
2026-02-17 16:19:59 -05:00

41 lines
1.5 KiB
JavaScript

import { printable, throwInternalError } from "@ark/util";
class ToJsonSchemaError extends Error {
name = "ToJsonSchemaError";
code;
context;
constructor(code, context) {
super(printable(context, { quoteKeys: false, indent: 4 }));
this.code = code;
this.context = context;
}
hasCode(code) {
return this.code === code;
}
}
const defaultConfig = {
target: "draft-2020-12",
dialect: "https://json-schema.org/draft/2020-12/schema",
useRefs: false,
fallback: {
arrayObject: ctx => ToJsonSchema.throw("arrayObject", ctx),
arrayPostfix: ctx => ToJsonSchema.throw("arrayPostfix", ctx),
defaultValue: ctx => ToJsonSchema.throw("defaultValue", ctx),
domain: ctx => ToJsonSchema.throw("domain", ctx),
morph: ctx => ToJsonSchema.throw("morph", ctx),
patternIntersection: ctx => ToJsonSchema.throw("patternIntersection", ctx),
predicate: ctx => ToJsonSchema.throw("predicate", ctx),
proto: ctx => ToJsonSchema.throw("proto", ctx),
symbolKey: ctx => ToJsonSchema.throw("symbolKey", ctx),
unit: ctx => ToJsonSchema.throw("unit", ctx),
date: ctx => ToJsonSchema.throw("date", ctx)
}
};
export const ToJsonSchema = {
Error: ToJsonSchemaError,
throw: (...args) => {
throw new ToJsonSchema.Error(...args);
},
throwInternalOperandError: (kind, schema) => throwInternalError(`Unexpected JSON Schema input for ${kind}: ${printable(schema)}`),
defaultConfig
};