@zuplo/cli 6.70.15 → 6.70.21

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.
Files changed (203) hide show
  1. package/dist/ca-certificate/create/handler.d.ts +3 -0
  2. package/dist/ca-certificate/create/handler.d.ts.map +1 -0
  3. package/dist/ca-certificate/create/handler.js +46 -0
  4. package/dist/ca-certificate/create/handler.js.map +1 -0
  5. package/dist/ca-certificate/delete/handler.d.ts +3 -0
  6. package/dist/ca-certificate/delete/handler.d.ts.map +1 -0
  7. package/dist/ca-certificate/delete/handler.js +18 -0
  8. package/dist/ca-certificate/delete/handler.js.map +1 -0
  9. package/dist/ca-certificate/describe/handler.d.ts +3 -0
  10. package/dist/ca-certificate/describe/handler.d.ts.map +1 -0
  11. package/dist/ca-certificate/describe/handler.js +32 -0
  12. package/dist/ca-certificate/describe/handler.js.map +1 -0
  13. package/dist/ca-certificate/list/handler.d.ts +3 -0
  14. package/dist/ca-certificate/list/handler.d.ts.map +1 -0
  15. package/dist/ca-certificate/list/handler.js +28 -0
  16. package/dist/ca-certificate/list/handler.js.map +1 -0
  17. package/dist/ca-certificate/models.d.ts +51 -0
  18. package/dist/ca-certificate/models.d.ts.map +1 -0
  19. package/dist/ca-certificate/models.js +2 -0
  20. package/dist/ca-certificate/models.js.map +1 -0
  21. package/dist/ca-certificate/update/handler.d.ts +3 -0
  22. package/dist/ca-certificate/update/handler.d.ts.map +1 -0
  23. package/dist/ca-certificate/update/handler.js +26 -0
  24. package/dist/ca-certificate/update/handler.js.map +1 -0
  25. package/dist/ca-certificate/validation.d.ts +21 -0
  26. package/dist/ca-certificate/validation.d.ts.map +1 -0
  27. package/dist/ca-certificate/validation.js +135 -0
  28. package/dist/ca-certificate/validation.js.map +1 -0
  29. package/dist/ca-certificate/validation.test.d.ts +2 -0
  30. package/dist/ca-certificate/validation.test.d.ts.map +1 -0
  31. package/dist/ca-certificate/validation.test.js +131 -0
  32. package/dist/ca-certificate/validation.test.js.map +1 -0
  33. package/dist/cli.js +2 -6
  34. package/dist/cli.js.map +1 -1
  35. package/dist/cmds/ca-certificate/create.d.ts +9 -0
  36. package/dist/cmds/ca-certificate/create.d.ts.map +1 -0
  37. package/dist/cmds/ca-certificate/create.js +66 -0
  38. package/dist/cmds/ca-certificate/create.js.map +1 -0
  39. package/dist/cmds/ca-certificate/delete.d.ts +9 -0
  40. package/dist/cmds/ca-certificate/delete.d.ts.map +1 -0
  41. package/dist/cmds/ca-certificate/delete.js +56 -0
  42. package/dist/cmds/ca-certificate/delete.js.map +1 -0
  43. package/dist/cmds/ca-certificate/describe.d.ts +9 -0
  44. package/dist/cmds/ca-certificate/describe.d.ts.map +1 -0
  45. package/dist/cmds/ca-certificate/describe.js +56 -0
  46. package/dist/cmds/ca-certificate/describe.js.map +1 -0
  47. package/dist/cmds/ca-certificate/index.d.ts +4 -0
  48. package/dist/cmds/ca-certificate/index.d.ts.map +1 -0
  49. package/dist/cmds/ca-certificate/index.js +18 -0
  50. package/dist/cmds/ca-certificate/index.js.map +1 -0
  51. package/dist/cmds/ca-certificate/list.d.ts +9 -0
  52. package/dist/cmds/ca-certificate/list.d.ts.map +1 -0
  53. package/dist/cmds/ca-certificate/list.js +48 -0
  54. package/dist/cmds/ca-certificate/list.js.map +1 -0
  55. package/dist/cmds/ca-certificate/update.d.ts +9 -0
  56. package/dist/cmds/ca-certificate/update.d.ts.map +1 -0
  57. package/dist/cmds/ca-certificate/update.js +56 -0
  58. package/dist/cmds/ca-certificate/update.js.map +1 -0
  59. package/dist/cmds/mtls-certificates/index.js +1 -1
  60. package/dist/cmds/mtls-certificates/index.js.map +1 -1
  61. package/dist/tsconfig.tsbuildinfo +1 -1
  62. package/node_modules/@cfworker/json-schema/README.md +75 -0
  63. package/node_modules/@cfworker/json-schema/dist/commonjs/deep-compare-strict.d.ts +1 -0
  64. package/node_modules/@cfworker/json-schema/dist/commonjs/deep-compare-strict.js +42 -0
  65. package/node_modules/@cfworker/json-schema/dist/commonjs/dereference.d.ts +7 -0
  66. package/node_modules/@cfworker/json-schema/dist/commonjs/dereference.js +147 -0
  67. package/node_modules/@cfworker/json-schema/dist/commonjs/format.d.ts +1 -0
  68. package/node_modules/@cfworker/json-schema/dist/commonjs/format.js +111 -0
  69. package/node_modules/@cfworker/json-schema/dist/commonjs/index.d.ts +8 -0
  70. package/node_modules/@cfworker/json-schema/dist/commonjs/index.js +24 -0
  71. package/node_modules/@cfworker/json-schema/dist/commonjs/package.json +3 -0
  72. package/node_modules/@cfworker/json-schema/dist/commonjs/pointer.d.ts +2 -0
  73. package/node_modules/@cfworker/json-schema/dist/commonjs/pointer.js +10 -0
  74. package/node_modules/@cfworker/json-schema/dist/commonjs/types.d.ts +72 -0
  75. package/node_modules/@cfworker/json-schema/dist/commonjs/types.js +9 -0
  76. package/node_modules/@cfworker/json-schema/dist/commonjs/ucs2-length.d.ts +1 -0
  77. package/node_modules/@cfworker/json-schema/dist/commonjs/ucs2-length.js +20 -0
  78. package/node_modules/@cfworker/json-schema/dist/commonjs/validate.d.ts +3 -0
  79. package/node_modules/@cfworker/json-schema/dist/commonjs/validate.js +805 -0
  80. package/node_modules/@cfworker/json-schema/dist/commonjs/validator.d.ts +10 -0
  81. package/node_modules/@cfworker/json-schema/dist/commonjs/validator.js +27 -0
  82. package/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.d.ts +1 -0
  83. package/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js +39 -0
  84. package/node_modules/@cfworker/json-schema/dist/esm/dereference.d.ts +7 -0
  85. package/node_modules/@cfworker/json-schema/dist/esm/dereference.js +143 -0
  86. package/node_modules/@cfworker/json-schema/dist/esm/format.d.ts +1 -0
  87. package/node_modules/@cfworker/json-schema/dist/esm/format.js +108 -0
  88. package/node_modules/@cfworker/json-schema/dist/esm/index.d.ts +8 -0
  89. package/node_modules/@cfworker/json-schema/dist/esm/index.js +8 -0
  90. package/node_modules/@cfworker/json-schema/dist/esm/package.json +3 -0
  91. package/node_modules/@cfworker/json-schema/dist/esm/pointer.d.ts +2 -0
  92. package/node_modules/@cfworker/json-schema/dist/esm/pointer.js +6 -0
  93. package/node_modules/@cfworker/json-schema/dist/esm/types.d.ts +72 -0
  94. package/node_modules/@cfworker/json-schema/dist/esm/types.js +6 -0
  95. package/node_modules/@cfworker/json-schema/dist/esm/ucs2-length.d.ts +1 -0
  96. package/node_modules/@cfworker/json-schema/dist/esm/ucs2-length.js +17 -0
  97. package/node_modules/@cfworker/json-schema/dist/esm/validate.d.ts +3 -0
  98. package/node_modules/@cfworker/json-schema/dist/esm/validate.js +802 -0
  99. package/node_modules/@cfworker/json-schema/dist/esm/validator.d.ts +10 -0
  100. package/node_modules/@cfworker/json-schema/dist/esm/validator.js +23 -0
  101. package/node_modules/@cfworker/json-schema/package.json +68 -0
  102. package/node_modules/@cfworker/json-schema/src/deep-compare-strict.d.ts +1 -0
  103. package/node_modules/@cfworker/json-schema/src/deep-compare-strict.ts +39 -0
  104. package/node_modules/@cfworker/json-schema/src/dereference.d.ts +12 -0
  105. package/node_modules/@cfworker/json-schema/src/dereference.ts +188 -0
  106. package/node_modules/@cfworker/json-schema/src/format.d.ts +2 -0
  107. package/node_modules/@cfworker/json-schema/src/format.ts +164 -0
  108. package/node_modules/@cfworker/json-schema/src/index.d.ts +8 -0
  109. package/node_modules/@cfworker/json-schema/src/index.ts +8 -0
  110. package/node_modules/@cfworker/json-schema/src/pointer.d.ts +2 -0
  111. package/node_modules/@cfworker/json-schema/src/pointer.ts +7 -0
  112. package/node_modules/@cfworker/json-schema/src/types.d.ts +79 -0
  113. package/node_modules/@cfworker/json-schema/src/types.ts +92 -0
  114. package/node_modules/@cfworker/json-schema/src/ucs2-length.d.ts +1 -0
  115. package/node_modules/@cfworker/json-schema/src/ucs2-length.ts +24 -0
  116. package/node_modules/@cfworker/json-schema/src/validate.d.ts +13 -0
  117. package/node_modules/@cfworker/json-schema/src/validate.ts +1168 -0
  118. package/node_modules/@cfworker/json-schema/src/validator.d.ts +14 -0
  119. package/node_modules/@cfworker/json-schema/src/validator.ts +32 -0
  120. package/node_modules/@zuplo/core/package.json +1 -1
  121. package/node_modules/@zuplo/graphql/package.json +1 -1
  122. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  123. package/node_modules/@zuplo/otel/package.json +1 -1
  124. package/node_modules/@zuplo/runtime/out/esm/{chunk-YJ3VHQXF.js → chunk-2ZQVIVZ3.js} +2 -2
  125. package/node_modules/@zuplo/runtime/out/esm/{chunk-STBDRSX7.js → chunk-UMZORQLU.js} +67 -66
  126. package/node_modules/@zuplo/runtime/out/esm/chunk-UMZORQLU.js.map +1 -0
  127. package/node_modules/@zuplo/runtime/out/esm/{chunk-KWR5BV7H.js → chunk-YGYFQCBA.js} +6 -6
  128. package/node_modules/@zuplo/runtime/out/esm/chunk-YGYFQCBA.js.map +1 -0
  129. package/node_modules/@zuplo/runtime/out/esm/{chunk-NJNTFB34.js → chunk-ZS34EO4B.js} +2 -2
  130. package/node_modules/@zuplo/runtime/out/esm/{chunk-NJNTFB34.js.map → chunk-ZS34EO4B.js.map} +1 -1
  131. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  132. package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
  133. package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
  134. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +208 -72
  135. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
  136. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  137. package/node_modules/@zuplo/runtime/out/types/index.d.ts +61 -12
  138. package/node_modules/@zuplo/runtime/out/types/mcp-gateway/index.d.ts +8 -17
  139. package/node_modules/@zuplo/runtime/out/types/mocks/index.d.ts +3 -12
  140. package/node_modules/@zuplo/runtime/package.json +3 -2
  141. package/node_modules/agent-base/README.md +145 -0
  142. package/node_modules/agent-base/dist/src/index.d.ts +78 -0
  143. package/node_modules/agent-base/dist/src/index.js +203 -0
  144. package/node_modules/agent-base/dist/src/index.js.map +1 -0
  145. package/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
  146. package/node_modules/agent-base/dist/src/promisify.js +18 -0
  147. package/node_modules/agent-base/dist/src/promisify.js.map +1 -0
  148. package/node_modules/agent-base/package.json +64 -0
  149. package/node_modules/agent-base/src/index.ts +345 -0
  150. package/node_modules/agent-base/src/promisify.ts +33 -0
  151. package/node_modules/axios/CHANGELOG.md +71 -0
  152. package/node_modules/axios/README.md +46 -11
  153. package/node_modules/axios/dist/axios.js +81 -53
  154. package/node_modules/axios/dist/axios.js.map +1 -1
  155. package/node_modules/axios/dist/axios.min.js +2 -2
  156. package/node_modules/axios/dist/axios.min.js.map +1 -1
  157. package/node_modules/axios/dist/browser/axios.cjs +96 -64
  158. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  159. package/node_modules/axios/dist/esm/axios.js +96 -64
  160. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  161. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  162. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  163. package/node_modules/axios/dist/node/axios.cjs +206 -85
  164. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  165. package/node_modules/axios/index.d.cts +1 -1
  166. package/node_modules/axios/index.d.ts +1 -1
  167. package/node_modules/axios/lib/adapters/fetch.js +6 -2
  168. package/node_modules/axios/lib/adapters/http.js +139 -29
  169. package/node_modules/axios/lib/adapters/xhr.js +2 -1
  170. package/node_modules/axios/lib/core/AxiosHeaders.js +1 -33
  171. package/node_modules/axios/lib/env/data.js +1 -1
  172. package/node_modules/axios/lib/helpers/composeSignals.js +48 -47
  173. package/node_modules/axios/lib/helpers/formDataToJSON.js +1 -1
  174. package/node_modules/axios/lib/helpers/fromDataURI.js +18 -5
  175. package/node_modules/axios/lib/helpers/progressEventReducer.js +3 -0
  176. package/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
  177. package/node_modules/axios/lib/utils.js +8 -7
  178. package/node_modules/axios/package.json +3 -1
  179. package/node_modules/https-proxy-agent/README.md +137 -0
  180. package/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
  181. package/node_modules/https-proxy-agent/dist/agent.js +177 -0
  182. package/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
  183. package/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
  184. package/node_modules/https-proxy-agent/dist/index.js +14 -0
  185. package/node_modules/https-proxy-agent/dist/index.js.map +1 -0
  186. package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
  187. package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
  188. package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
  189. package/node_modules/https-proxy-agent/package.json +56 -0
  190. package/node_modules/type-is/index.js +8 -18
  191. package/node_modules/type-is/node_modules/content-type/LICENSE +22 -0
  192. package/node_modules/type-is/node_modules/content-type/README.md +69 -0
  193. package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +26 -0
  194. package/node_modules/type-is/node_modules/content-type/dist/index.js +170 -0
  195. package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -0
  196. package/node_modules/type-is/node_modules/content-type/package.json +52 -0
  197. package/node_modules/type-is/package.json +9 -5
  198. package/package.json +6 -6
  199. package/node_modules/@zuplo/runtime/out/esm/chunk-KWR5BV7H.js.map +0 -1
  200. package/node_modules/@zuplo/runtime/out/esm/chunk-STBDRSX7.js.map +0 -1
  201. /package/node_modules/@zuplo/runtime/out/esm/{chunk-YJ3VHQXF.js.map → chunk-2ZQVIVZ3.js.map} +0 -0
  202. /package/node_modules/@zuplo/runtime/out/esm/{chunk-STBDRSX7.js.LEGAL.txt → chunk-UMZORQLU.js.LEGAL.txt} +0 -0
  203. /package/node_modules/@zuplo/runtime/out/esm/{chunk-KWR5BV7H.js.LEGAL.txt → chunk-YGYFQCBA.js.LEGAL.txt} +0 -0
@@ -0,0 +1,10 @@
1
+ import { Schema, SchemaDraft, ValidationResult } from './types.js';
2
+ export declare class Validator {
3
+ private readonly schema;
4
+ private readonly draft;
5
+ private readonly shortCircuit;
6
+ private readonly lookup;
7
+ constructor(schema: Schema | boolean, draft?: SchemaDraft, shortCircuit?: boolean);
8
+ validate(instance: any): ValidationResult;
9
+ addSchema(schema: Schema, id?: string): void;
10
+ }
@@ -0,0 +1,23 @@
1
+ import { dereference } from './dereference.js';
2
+ import { validate } from './validate.js';
3
+ export class Validator {
4
+ schema;
5
+ draft;
6
+ shortCircuit;
7
+ lookup;
8
+ constructor(schema, draft = '2019-09', shortCircuit = true) {
9
+ this.schema = schema;
10
+ this.draft = draft;
11
+ this.shortCircuit = shortCircuit;
12
+ this.lookup = dereference(schema);
13
+ }
14
+ validate(instance) {
15
+ return validate(instance, this.schema, this.draft, this.lookup, this.shortCircuit);
16
+ }
17
+ addSchema(schema, id) {
18
+ if (id) {
19
+ schema = { ...schema, $id: id };
20
+ }
21
+ dereference(schema, this.lookup);
22
+ }
23
+ }
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@cfworker/json-schema",
3
+ "version": "4.1.1",
4
+ "description": "A JSON schema validator that will run on Cloudflare workers. Supports drafts 4, 7, 2019-09, and 2020-12.",
5
+ "keywords": [
6
+ "json-schema",
7
+ "jsonschema",
8
+ "json",
9
+ "schema",
10
+ "cloudflare",
11
+ "worker",
12
+ "workers",
13
+ "service-worker"
14
+ ],
15
+ "repository": "https://github.com/cfworker/cfworker",
16
+ "author": "Jeremy Danyow <jdanyow@gmail.com>",
17
+ "homepage": "https://github.com/cfworker/cfworker/tree/master/packages/json-schema/README.md",
18
+ "license": "MIT",
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "type": "module",
23
+ "sideEffects": false,
24
+ "main": "./dist/commonjs/index.js",
25
+ "types": "./dist/commonjs/index.d.ts",
26
+ "module": "./dist/esm/index.js",
27
+ "exports": {
28
+ "./package.json": "./package.json",
29
+ ".": {
30
+ "import": {
31
+ "types": "./dist/esm/index.d.ts",
32
+ "default": "./dist/esm/index.js"
33
+ },
34
+ "require": {
35
+ "types": "./dist/commonjs/index.d.ts",
36
+ "default": "./dist/commonjs/index.js"
37
+ }
38
+ }
39
+ },
40
+ "files": [
41
+ "dist",
42
+ "src",
43
+ "README.md"
44
+ ],
45
+ "scripts": {
46
+ "prepare": "tshy",
47
+ "build": "tsc --build",
48
+ "clean": "tsc --build --clean",
49
+ "pretest": "node --experimental-import-meta-resolve suite-gen.mjs && esbuild test/test.ts --target=esnext --bundle --format=esm --conditions=worker,browser --outdir=dist-test --ignore-annotations",
50
+ "test": "node ../../test.mjs"
51
+ },
52
+ "devDependencies": {
53
+ "@types/chai": "^5.0.1",
54
+ "@types/mocha": "^10.0.10",
55
+ "chai": "^5.1.2",
56
+ "json-schema-test-suite": "git+https://github.com/json-schema-org/JSON-Schema-Test-Suite#76b529f",
57
+ "esbuild": "^0.24.2",
58
+ "mocha": "^11.1.0",
59
+ "typescript": "^5.7.3",
60
+ "wrangler": "^3.107.2"
61
+ },
62
+ "tshy": {
63
+ "exports": {
64
+ "./package.json": "./package.json",
65
+ ".": "./src/index.ts"
66
+ }
67
+ }
68
+ }
@@ -0,0 +1 @@
1
+ export declare function deepCompareStrict(a: any, b: any): boolean;
@@ -0,0 +1,39 @@
1
+ export function deepCompareStrict(a: any, b: any): boolean {
2
+ const typeofa = typeof a;
3
+ if (typeofa !== typeof b) {
4
+ return false;
5
+ }
6
+ if (Array.isArray(a)) {
7
+ if (!Array.isArray(b)) {
8
+ return false;
9
+ }
10
+ const length = a.length;
11
+ if (length !== b.length) {
12
+ return false;
13
+ }
14
+ for (let i = 0; i < length; i++) {
15
+ if (!deepCompareStrict(a[i], b[i])) {
16
+ return false;
17
+ }
18
+ }
19
+ return true;
20
+ }
21
+ if (typeofa === 'object') {
22
+ if (!a || !b) {
23
+ return a === b;
24
+ }
25
+ const aKeys = Object.keys(a);
26
+ const bKeys = Object.keys(b);
27
+ const length = aKeys.length;
28
+ if (length !== bKeys.length) {
29
+ return false;
30
+ }
31
+ for (const k of aKeys) {
32
+ if (!deepCompareStrict(a[k], b[k])) {
33
+ return false;
34
+ }
35
+ }
36
+ return true;
37
+ }
38
+ return a === b;
39
+ }
@@ -0,0 +1,12 @@
1
+ import { Schema } from './types.js';
2
+ export declare const schemaKeyword: Record<string, boolean>;
3
+ export declare const schemaArrayKeyword: Record<string, boolean>;
4
+ export declare const schemaMapKeyword: Record<string, boolean>;
5
+ export declare const ignoredKeyword: Record<string, boolean>;
6
+ export declare let initialBaseURI: URL;
7
+ export declare function dereference(
8
+ schema: Schema | boolean,
9
+ lookup?: Record<string, Schema | boolean>,
10
+ baseURI?: URL,
11
+ basePointer?: string
12
+ ): Record<string, Schema | boolean>;
@@ -0,0 +1,188 @@
1
+ import { encodePointer } from './pointer.js';
2
+ import { Schema } from './types.js';
3
+
4
+ export const schemaKeyword: Record<string, boolean> = {
5
+ additionalItems: true,
6
+ unevaluatedItems: true,
7
+ items: true,
8
+ contains: true,
9
+ additionalProperties: true,
10
+ unevaluatedProperties: true,
11
+ propertyNames: true,
12
+ not: true,
13
+ if: true,
14
+ then: true,
15
+ else: true
16
+ };
17
+
18
+ export const schemaArrayKeyword: Record<string, boolean> = {
19
+ prefixItems: true,
20
+ items: true,
21
+ allOf: true,
22
+ anyOf: true,
23
+ oneOf: true
24
+ };
25
+
26
+ export const schemaMapKeyword: Record<string, boolean> = {
27
+ $defs: true,
28
+ definitions: true,
29
+ properties: true,
30
+ patternProperties: true,
31
+ dependentSchemas: true
32
+ };
33
+
34
+ export const ignoredKeyword: Record<string, boolean> = {
35
+ id: true,
36
+ $id: true,
37
+ $ref: true,
38
+ $schema: true,
39
+ $anchor: true,
40
+ $vocabulary: true,
41
+ $comment: true,
42
+ default: true,
43
+ enum: true,
44
+ const: true,
45
+ required: true,
46
+ type: true,
47
+ maximum: true,
48
+ minimum: true,
49
+ exclusiveMaximum: true,
50
+ exclusiveMinimum: true,
51
+ multipleOf: true,
52
+ maxLength: true,
53
+ minLength: true,
54
+ pattern: true,
55
+ format: true,
56
+ maxItems: true,
57
+ minItems: true,
58
+ uniqueItems: true,
59
+ maxProperties: true,
60
+ minProperties: true
61
+ };
62
+
63
+ /**
64
+ * Default base URI for schemas without an $id.
65
+ * https://json-schema.org/draft/2019-09/json-schema-core.html#initial-base
66
+ * https://tools.ietf.org/html/rfc3986#section-5.1
67
+ */
68
+ export let initialBaseURI: URL =
69
+ // @ts-ignore
70
+ typeof self !== 'undefined' &&
71
+ self.location &&
72
+ self.location.origin !== 'null'
73
+ ? //@ts-ignore
74
+ new URL(self.location.origin + self.location.pathname + location.search)
75
+ : new URL('https://github.com/cfworker');
76
+
77
+ export function dereference(
78
+ schema: Schema | boolean,
79
+ lookup: Record<string, Schema | boolean> = Object.create(null),
80
+ baseURI: URL = initialBaseURI,
81
+ basePointer = ''
82
+ ): Record<string, Schema | boolean> {
83
+ if (schema && typeof schema === 'object' && !Array.isArray(schema)) {
84
+ const id: string = schema.$id || schema.id;
85
+ if (id) {
86
+ const url = new URL(id, baseURI.href);
87
+ if (url.hash.length > 1) {
88
+ lookup[url.href] = schema;
89
+ } else {
90
+ url.hash = ''; // normalize hash https://url.spec.whatwg.org/#dom-url-hash
91
+ if (basePointer === '') {
92
+ baseURI = url;
93
+ } else {
94
+ dereference(schema, lookup, baseURI);
95
+ }
96
+ }
97
+ }
98
+ } else if (schema !== true && schema !== false) {
99
+ return lookup;
100
+ }
101
+
102
+ // compute the schema's URI and add it to the mapping.
103
+ const schemaURI = baseURI.href + (basePointer ? '#' + basePointer : '');
104
+ if (lookup[schemaURI] !== undefined) {
105
+ throw new Error(`Duplicate schema URI "${schemaURI}".`);
106
+ }
107
+ lookup[schemaURI] = schema;
108
+
109
+ // exit early if this is a boolean schema.
110
+ if (schema === true || schema === false) {
111
+ return lookup;
112
+ }
113
+
114
+ // set the schema's absolute URI.
115
+ if (schema.__absolute_uri__ === undefined) {
116
+ Object.defineProperty(schema, '__absolute_uri__', {
117
+ enumerable: false,
118
+ value: schemaURI
119
+ });
120
+ }
121
+
122
+ // if a $ref is found, resolve it's absolute URI.
123
+ if (schema.$ref && schema.__absolute_ref__ === undefined) {
124
+ const url = new URL(schema.$ref, baseURI.href);
125
+ url.hash = url.hash; // normalize hash https://url.spec.whatwg.org/#dom-url-hash
126
+ Object.defineProperty(schema, '__absolute_ref__', {
127
+ enumerable: false,
128
+ value: url.href
129
+ });
130
+ }
131
+
132
+ // if a $recursiveRef is found, resolve it's absolute URI.
133
+ if (schema.$recursiveRef && schema.__absolute_recursive_ref__ === undefined) {
134
+ const url = new URL(schema.$recursiveRef, baseURI.href);
135
+ url.hash = url.hash; // normalize hash https://url.spec.whatwg.org/#dom-url-hash
136
+ Object.defineProperty(schema, '__absolute_recursive_ref__', {
137
+ enumerable: false,
138
+ value: url.href
139
+ });
140
+ }
141
+
142
+ // if an $anchor is found, compute it's URI and add it to the mapping.
143
+ if (schema.$anchor) {
144
+ const url = new URL('#' + schema.$anchor, baseURI.href);
145
+ lookup[url.href] = schema;
146
+ }
147
+
148
+ // process subschemas.
149
+ for (let key in schema) {
150
+ if (ignoredKeyword[key]) {
151
+ continue;
152
+ }
153
+ const keyBase = `${basePointer}/${encodePointer(key)}`;
154
+ const subSchema = schema[key];
155
+ if (Array.isArray(subSchema)) {
156
+ if (schemaArrayKeyword[key]) {
157
+ const length = subSchema.length;
158
+ for (let i = 0; i < length; i++) {
159
+ dereference(subSchema[i], lookup, baseURI, `${keyBase}/${i}`);
160
+ }
161
+ }
162
+ } else if (schemaMapKeyword[key]) {
163
+ for (let subKey in subSchema) {
164
+ dereference(
165
+ subSchema[subKey],
166
+ lookup,
167
+ baseURI,
168
+ `${keyBase}/${encodePointer(subKey)}`
169
+ );
170
+ }
171
+ } else {
172
+ dereference(subSchema, lookup, baseURI, keyBase);
173
+ }
174
+ }
175
+
176
+ return lookup;
177
+ }
178
+
179
+ // schema identification examples
180
+ // https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.appendix.A
181
+ // $ref delegation
182
+ // https://github.com/json-schema-org/json-schema-spec/issues/514
183
+ // output format
184
+ // https://json-schema.org/draft/2019-09/json-schema-core.html#output
185
+ // JSON pointer
186
+ // https://tools.ietf.org/html/rfc6901
187
+ // JSON relative pointer
188
+ // https://tools.ietf.org/html/draft-handrews-relative-json-pointer-01
@@ -0,0 +1,2 @@
1
+ export declare const fullFormat: Record<string, (s: string) => boolean>;
2
+ export declare const fastFormat: Record<string, (s: string) => boolean>;
@@ -0,0 +1,164 @@
1
+ // based on https://github.com/epoberezkin/ajv/blob/master/lib/compile/formats.js
2
+
3
+ const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
4
+ const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
5
+ const TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
6
+ const HOSTNAME =
7
+ /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;
8
+ // const URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
9
+ const URIREF =
10
+ /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
11
+ // uri-template: https://tools.ietf.org/html/rfc6570
12
+ const URITEMPLATE =
13
+ /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;
14
+ // For the source: https://gist.github.com/dperini/729294
15
+ // For test cases: https://mathiasbynens.be/demo/url-regex
16
+ const URL_ =
17
+ /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
18
+ const UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
19
+ const JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
20
+ const JSON_POINTER_URI_FRAGMENT =
21
+ /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
22
+ const RELATIVE_JSON_POINTER =
23
+ /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
24
+
25
+ // // date: http://tools.ietf.org/html/rfc3339#section-5.6
26
+ // const FASTDATE = /^\d\d\d\d-[0-1]\d-[0-3]\d$/;
27
+ // // date-time: http://tools.ietf.org/html/rfc3339#section-5.6
28
+ // const FASTTIME =
29
+ // /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i;
30
+ // const FASTDATETIME =
31
+ // /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i;
32
+ // // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js
33
+ // // const FASTURI = /^(?:[a-z][a-z0-9+-.]*:)(?:\/?\/)?[^\s]*$/i;
34
+ // const FASTURIREFERENCE =
35
+ // /^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i;
36
+
37
+ // https://github.com/ExodusMovement/schemasafe/blob/master/src/formats.js
38
+ const EMAIL = (input: string) => {
39
+ if (input[0] === '"') return false;
40
+ const [name, host, ...rest] = input.split('@');
41
+ if (
42
+ !name ||
43
+ !host ||
44
+ rest.length !== 0 ||
45
+ name.length > 64 ||
46
+ host.length > 253
47
+ )
48
+ return false;
49
+ if (name[0] === '.' || name.endsWith('.') || name.includes('..'))
50
+ return false;
51
+ if (
52
+ !/^[a-z0-9.-]+$/i.test(host) ||
53
+ !/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(name)
54
+ )
55
+ return false;
56
+ return host
57
+ .split('.')
58
+ .every(part => /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(part));
59
+ };
60
+
61
+ // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
62
+ const IPV4 =
63
+ /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
64
+ // optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses
65
+ const IPV6 =
66
+ /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;
67
+
68
+ // https://github.com/ExodusMovement/schemasafe/blob/master/src/formats.js
69
+ const DURATION = (input: string) =>
70
+ input.length > 1 &&
71
+ input.length < 80 &&
72
+ (/^P\d+([.,]\d+)?W$/.test(input) ||
73
+ (/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(input) &&
74
+ /^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(
75
+ input
76
+ )));
77
+
78
+ function bind(r: RegExp) {
79
+ return r.test.bind(r);
80
+ }
81
+
82
+ export const format: Record<string, (s: string) => boolean> = {
83
+ date,
84
+ time: time.bind(undefined, false),
85
+ 'date-time': date_time,
86
+ duration: DURATION,
87
+ uri,
88
+ 'uri-reference': bind(URIREF),
89
+ 'uri-template': bind(URITEMPLATE),
90
+ url: bind(URL_),
91
+ email: EMAIL,
92
+ hostname: bind(HOSTNAME),
93
+ ipv4: bind(IPV4),
94
+ ipv6: bind(IPV6),
95
+ regex: regex,
96
+ uuid: bind(UUID),
97
+ 'json-pointer': bind(JSON_POINTER),
98
+ 'json-pointer-uri-fragment': bind(JSON_POINTER_URI_FRAGMENT),
99
+ 'relative-json-pointer': bind(RELATIVE_JSON_POINTER)
100
+ };
101
+
102
+ function isLeapYear(year: number) {
103
+ // https://tools.ietf.org/html/rfc3339#appendix-C
104
+ return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
105
+ }
106
+
107
+ function date(str: string) {
108
+ // full-date from http://tools.ietf.org/html/rfc3339#section-5.6
109
+ const matches = str.match(DATE);
110
+ if (!matches) return false;
111
+
112
+ const year = +matches[1];
113
+ const month = +matches[2];
114
+ const day = +matches[3];
115
+
116
+ return (
117
+ month >= 1 &&
118
+ month <= 12 &&
119
+ day >= 1 &&
120
+ day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month])
121
+ );
122
+ }
123
+
124
+ function time(full: boolean, str: string) {
125
+ const matches = str.match(TIME);
126
+ if (!matches) return false;
127
+
128
+ const hour = +matches[1];
129
+ const minute = +matches[2];
130
+ const second = +matches[3];
131
+ const timeZone = !!matches[5];
132
+ return (
133
+ ((hour <= 23 && minute <= 59 && second <= 59) ||
134
+ (hour == 23 && minute == 59 && second == 60)) &&
135
+ (!full || timeZone)
136
+ );
137
+ }
138
+
139
+ const DATE_TIME_SEPARATOR = /t|\s/i;
140
+ function date_time(str: string) {
141
+ // http://tools.ietf.org/html/rfc3339#section-5.6
142
+ const dateTime = str.split(DATE_TIME_SEPARATOR);
143
+ return dateTime.length == 2 && date(dateTime[0]) && time(true, dateTime[1]);
144
+ }
145
+
146
+ const NOT_URI_FRAGMENT = /\/|:/;
147
+ const URI_PATTERN =
148
+ /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
149
+
150
+ function uri(str: string): boolean {
151
+ // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "."
152
+ return NOT_URI_FRAGMENT.test(str) && URI_PATTERN.test(str);
153
+ }
154
+
155
+ const Z_ANCHOR = /[^\\]\\Z/;
156
+ function regex(str: string) {
157
+ if (Z_ANCHOR.test(str)) return false;
158
+ try {
159
+ new RegExp(str, 'u');
160
+ return true;
161
+ } catch (e) {
162
+ return false;
163
+ }
164
+ }
@@ -0,0 +1,8 @@
1
+ export * from './deep-compare-strict.js';
2
+ export * from './dereference.js';
3
+ export * from './format.js';
4
+ export * from './pointer.js';
5
+ export * from './types.js';
6
+ export * from './ucs2-length.js';
7
+ export * from './validate.js';
8
+ export * from './validator.js';
@@ -0,0 +1,8 @@
1
+ export * from './deep-compare-strict.js';
2
+ export * from './dereference.js';
3
+ export * from './format.js';
4
+ export * from './pointer.js';
5
+ export * from './types.js';
6
+ export * from './ucs2-length.js';
7
+ export * from './validate.js';
8
+ export * from './validator.js';
@@ -0,0 +1,2 @@
1
+ export declare function encodePointer(p: string): string;
2
+ export declare function escapePointer(p: string): string;
@@ -0,0 +1,7 @@
1
+ export function encodePointer(p: string): string {
2
+ return encodeURI(escapePointer(p));
3
+ }
4
+
5
+ export function escapePointer(p: string): string {
6
+ return p.replace(/~/g, '~0').replace(/\//g, '~1');
7
+ }
@@ -0,0 +1,79 @@
1
+ export type SchemaDraft = '4' | '7' | '2019-09' | '2020-12';
2
+ export declare const enum OutputFormat {
3
+ Flag = 1,
4
+ Basic = 2,
5
+ Detailed = 4
6
+ }
7
+ export type InstanceType =
8
+ | 'array'
9
+ | 'boolean'
10
+ | 'integer'
11
+ | 'null'
12
+ | 'number'
13
+ | 'object'
14
+ | 'string';
15
+ export interface Schema {
16
+ $id?: string;
17
+ $anchor?: string;
18
+ $recursiveAnchor?: boolean;
19
+ $ref?: string;
20
+ $recursiveRef?: '#';
21
+ $schema?: string;
22
+ $comment?: string;
23
+ $defs?: any;
24
+ $vocabulary?: Record<string, boolean>;
25
+ type?: InstanceType | InstanceType[];
26
+ const?: any;
27
+ enum?: any[];
28
+ required?: string[];
29
+ not?: Schema;
30
+ anyOf?: Schema[];
31
+ allOf?: Schema[];
32
+ oneOf?: Schema[];
33
+ if?: Schema;
34
+ then?: Schema;
35
+ else?: Schema;
36
+ format?: string;
37
+ properties?: Record<string | number, Schema | boolean>;
38
+ patternProperties?: Record<string, Schema | boolean>;
39
+ additionalProperties?: Schema | boolean;
40
+ unevaluatedProperties?: Schema | boolean;
41
+ minProperties?: number;
42
+ maxProperties?: number;
43
+ propertyNames?: Schema;
44
+ dependentRequired?: Record<string, string[]>;
45
+ dependentSchemas?: Record<string, Schema>;
46
+ dependencies?: Record<string, Schema | string[]>;
47
+ prefixItems?: Array<Schema | boolean>;
48
+ items?: Schema | boolean | Array<Schema | boolean>;
49
+ additionalItems?: Schema | boolean;
50
+ unevaluatedItems?: Schema | boolean;
51
+ contains?: Schema | boolean;
52
+ minContains?: number;
53
+ maxContains?: number;
54
+ minItems?: number;
55
+ maxItems?: number;
56
+ uniqueItems?: boolean;
57
+ minimum?: number;
58
+ maximum?: number;
59
+ exclusiveMinimum?: number | boolean;
60
+ exclusiveMaximum?: number | boolean;
61
+ multipleOf?: number;
62
+ minLength?: number;
63
+ maxLength?: number;
64
+ pattern?: string;
65
+ __absolute_ref__?: string;
66
+ __absolute_recursive_ref__?: string;
67
+ __absolute_uri__?: string;
68
+ [key: string]: any;
69
+ }
70
+ export interface OutputUnit {
71
+ keyword: string;
72
+ keywordLocation: string;
73
+ instanceLocation: string;
74
+ error: string;
75
+ }
76
+ export interface ValidationResult {
77
+ valid: boolean;
78
+ errors: OutputUnit[];
79
+ }