@cfworker/json-schema 1.12.8 → 2.0.0

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 CHANGED
@@ -1,10 +1,10 @@
1
- export declare type SchemaDraft = '4' | '7' | '2019-09' | '2020-12';
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 declare type InstanceType = 'array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string';
7
+ export type InstanceType = 'array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string';
8
8
  export interface Schema {
9
9
  $id?: string;
10
10
  $anchor?: string;
@@ -1,3 +1,3 @@
1
1
  import { Schema, SchemaDraft, ValidationResult } from './types.js';
2
- export declare type Evaluated = Record<string | number, boolean>;
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": "1.12.8",
4
+ "version": "2.0.0",
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",
@@ -34,16 +34,17 @@
34
34
  "scripts": {
35
35
  "build": "tsc --build",
36
36
  "clean": "tsc --build --clean",
37
- "pretest": "node --experimental-import-meta-resolve suite-gen.js",
38
- "test": "cfworker test test/**/*.spec.ts --nocheck"
37
+ "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",
38
+ "test": "node ../../test.mjs"
39
39
  },
40
40
  "devDependencies": {
41
- "@cfworker/dev": "^1.14.2",
42
- "@types/chai": "^4.3.3",
43
- "@types/mocha": "^10.0.0",
44
- "chai": "^4.3.6",
41
+ "@types/chai": "^4.3.17",
42
+ "@types/mocha": "^10.0.7",
43
+ "chai": "^5.1.1",
45
44
  "json-schema-test-suite": "git+https://github.com/json-schema-org/JSON-Schema-Test-Suite#76b529f",
46
- "mocha": "^10.0.0",
47
- "typescript": "^4.8.4"
45
+ "esbuild": "^0.23.1",
46
+ "mocha": "^10.7.3",
47
+ "typescript": "^5.5.4",
48
+ "wrangler": "^3.72.0"
48
49
  }
49
50
  }
package/tsconfig.json CHANGED
@@ -1,14 +1,8 @@
1
1
  {
2
2
  "extends": "../../tsconfig-base",
3
3
  "compilerOptions": {
4
- "target": "ES2021",
4
+ "target": "ESNext",
5
5
  "lib": ["ESNext", "WebWorker", "Webworker.Iterable"],
6
- "types": [
7
- "chai",
8
- "mocha",
9
- "@cfworker/worker-types",
10
- "@cloudflare/workers-types"
11
- ],
12
6
  "outDir": "dist",
13
7
  "rootDir": "./src"
14
8
  },