@cfworker/json-schema 1.12.8 → 2.0.1
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/types.d.ts +2 -2
- package/dist/validate.d.ts +1 -1
- package/dist/validator.js +4 -0
- package/package.json +10 -10
- package/tsconfig.json +0 -16
package/dist/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type SchemaDraft = '4' | '7' | '2019-09' | '2020-12';
|
|
2
2
|
export declare const enum OutputFormat {
|
|
3
3
|
Flag = 1,
|
|
4
4
|
Basic = 2,
|
|
5
5
|
Detailed = 4
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export type InstanceType = 'array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string';
|
|
8
8
|
export interface Schema {
|
|
9
9
|
$id?: string;
|
|
10
10
|
$anchor?: string;
|
package/dist/validate.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Schema, SchemaDraft, ValidationResult } from './types.js';
|
|
2
|
-
export
|
|
2
|
+
export type Evaluated = Record<string | number, boolean>;
|
|
3
3
|
export declare function validate(instance: any, schema: Schema | boolean, draft?: SchemaDraft, lookup?: Record<string, boolean | Schema>, shortCircuit?: boolean, recursiveAnchor?: Schema | null, instanceLocation?: string, schemaLocation?: string, evaluated?: Evaluated): ValidationResult;
|
package/dist/validator.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { dereference } from './dereference.js';
|
|
2
2
|
import { validate } from './validate.js';
|
|
3
3
|
export class Validator {
|
|
4
|
+
schema;
|
|
5
|
+
draft;
|
|
6
|
+
shortCircuit;
|
|
7
|
+
lookup;
|
|
4
8
|
constructor(schema, draft = '2019-09', shortCircuit = true) {
|
|
5
9
|
this.schema = schema;
|
|
6
10
|
this.draft = draft;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cfworker/json-schema",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"description": "A JSON schema validator that will run on Cloudflare workers. Supports drafts 4, 7, 2019-09, and 2020-12.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"json-schema",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"files": [
|
|
21
21
|
"dist/**/*",
|
|
22
22
|
"src/**/*",
|
|
23
|
-
"tsconfig.json",
|
|
24
23
|
"README.md",
|
|
25
24
|
"package.json"
|
|
26
25
|
],
|
|
@@ -34,16 +33,17 @@
|
|
|
34
33
|
"scripts": {
|
|
35
34
|
"build": "tsc --build",
|
|
36
35
|
"clean": "tsc --build --clean",
|
|
37
|
-
"pretest": "node --experimental-import-meta-resolve suite-gen.js",
|
|
38
|
-
"test": "
|
|
36
|
+
"pretest": "node --experimental-import-meta-resolve suite-gen.js && esbuild test/test.ts --target=esnext --bundle --format=esm --conditions=worker,browser --outdir=dist-test --ignore-annotations",
|
|
37
|
+
"test": "node ../../test.mjs"
|
|
39
38
|
},
|
|
40
39
|
"devDependencies": {
|
|
41
|
-
"@
|
|
42
|
-
"@types/
|
|
43
|
-
"
|
|
44
|
-
"chai": "^4.3.6",
|
|
40
|
+
"@types/chai": "^4.3.17",
|
|
41
|
+
"@types/mocha": "^10.0.7",
|
|
42
|
+
"chai": "^5.1.1",
|
|
45
43
|
"json-schema-test-suite": "git+https://github.com/json-schema-org/JSON-Schema-Test-Suite#76b529f",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
44
|
+
"esbuild": "^0.23.1",
|
|
45
|
+
"mocha": "^10.7.3",
|
|
46
|
+
"typescript": "^5.5.4",
|
|
47
|
+
"wrangler": "^3.72.0"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/tsconfig.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig-base",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "ES2021",
|
|
5
|
-
"lib": ["ESNext", "WebWorker", "Webworker.Iterable"],
|
|
6
|
-
"types": [
|
|
7
|
-
"chai",
|
|
8
|
-
"mocha",
|
|
9
|
-
"@cfworker/worker-types",
|
|
10
|
-
"@cloudflare/workers-types"
|
|
11
|
-
],
|
|
12
|
-
"outDir": "dist",
|
|
13
|
-
"rootDir": "./src"
|
|
14
|
-
},
|
|
15
|
-
"include": ["src"]
|
|
16
|
-
}
|