diff --git a/next/package.json b/next/package.json index 7b9484d..7bc2aca 100644 --- a/next/package.json +++ b/next/package.json @@ -36,6 +36,7 @@ "babel-jest": "^29.7.0", "eslint": "^9.18.0", "jest": "^29.7.0", + "json-schema-typed": "^8.0.1", "tsup": "^8.3.5", "typescript": "^5.7.3" } diff --git a/next/pnpm-lock.yaml b/next/pnpm-lock.yaml index f039c5a..a995f49 100644 --- a/next/pnpm-lock.yaml +++ b/next/pnpm-lock.yaml @@ -32,6 +32,9 @@ importers: jest: specifier: ^29.7.0 version: 29.7.0(@types/node@22.10.7)(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3)) + json-schema-typed: + specifier: ^8.0.1 + version: 8.0.1 tsup: specifier: ^8.3.5 version: 8.3.5(postcss@8.5.1)(typescript@5.7.3)(yaml@2.7.0) @@ -2276,6 +2279,9 @@ packages: json-schema-traverse@0.4.1: resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} + json-schema-typed@8.0.1: + resolution: {integrity: sha512-XQmWYj2Sm4kn4WeTYvmpKEbyPsL7nBsb647c7pMe6l02/yx2+Jfc4dT6UZkEXnIUb5LhD55r2HPsJ1milQ4rDg==} + json-stable-stringify-without-jsonify@1.0.1: resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} @@ -5901,6 +5907,8 @@ snapshots: json-schema-traverse@0.4.1: {} + json-schema-typed@8.0.1: {} + json-stable-stringify-without-jsonify@1.0.1: {} json5@2.2.3: {} diff --git a/next/src/form.ts b/next/src/form.ts index 4d31a46..48e84e5 100644 --- a/next/src/form.ts +++ b/next/src/form.ts @@ -1,3 +1,5 @@ -export function createHeadlessForm(): never { +import type { JsfSchema } from './types' + +export function createHeadlessForm(_schema: JsfSchema): never { throw new Error('Not implemented') } diff --git a/next/src/types.ts b/next/src/types.ts new file mode 100644 index 0000000..e8c456d --- /dev/null +++ b/next/src/types.ts @@ -0,0 +1,9 @@ +import type { JSONSchema } from 'json-schema-typed/draft-2020-12' + +export type JsfSchema = Exclude & { + 'x-jsf-logic'?: { + validations: Record + computedValues: Record + } + 'x-jsf-order'?: string[] +} diff --git a/next/tsconfig.json b/next/tsconfig.json index db4b8b7..b2cd795 100644 --- a/next/tsconfig.json +++ b/next/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "target": "ES2020", "module": "ESNext", + "moduleResolution": "bundler", "strict": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true,