@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.
- package/dist/ca-certificate/create/handler.d.ts +3 -0
- package/dist/ca-certificate/create/handler.d.ts.map +1 -0
- package/dist/ca-certificate/create/handler.js +46 -0
- package/dist/ca-certificate/create/handler.js.map +1 -0
- package/dist/ca-certificate/delete/handler.d.ts +3 -0
- package/dist/ca-certificate/delete/handler.d.ts.map +1 -0
- package/dist/ca-certificate/delete/handler.js +18 -0
- package/dist/ca-certificate/delete/handler.js.map +1 -0
- package/dist/ca-certificate/describe/handler.d.ts +3 -0
- package/dist/ca-certificate/describe/handler.d.ts.map +1 -0
- package/dist/ca-certificate/describe/handler.js +32 -0
- package/dist/ca-certificate/describe/handler.js.map +1 -0
- package/dist/ca-certificate/list/handler.d.ts +3 -0
- package/dist/ca-certificate/list/handler.d.ts.map +1 -0
- package/dist/ca-certificate/list/handler.js +28 -0
- package/dist/ca-certificate/list/handler.js.map +1 -0
- package/dist/ca-certificate/models.d.ts +51 -0
- package/dist/ca-certificate/models.d.ts.map +1 -0
- package/dist/ca-certificate/models.js +2 -0
- package/dist/ca-certificate/models.js.map +1 -0
- package/dist/ca-certificate/update/handler.d.ts +3 -0
- package/dist/ca-certificate/update/handler.d.ts.map +1 -0
- package/dist/ca-certificate/update/handler.js +26 -0
- package/dist/ca-certificate/update/handler.js.map +1 -0
- package/dist/ca-certificate/validation.d.ts +21 -0
- package/dist/ca-certificate/validation.d.ts.map +1 -0
- package/dist/ca-certificate/validation.js +135 -0
- package/dist/ca-certificate/validation.js.map +1 -0
- package/dist/ca-certificate/validation.test.d.ts +2 -0
- package/dist/ca-certificate/validation.test.d.ts.map +1 -0
- package/dist/ca-certificate/validation.test.js +131 -0
- package/dist/ca-certificate/validation.test.js.map +1 -0
- package/dist/cli.js +2 -6
- package/dist/cli.js.map +1 -1
- package/dist/cmds/ca-certificate/create.d.ts +9 -0
- package/dist/cmds/ca-certificate/create.d.ts.map +1 -0
- package/dist/cmds/ca-certificate/create.js +66 -0
- package/dist/cmds/ca-certificate/create.js.map +1 -0
- package/dist/cmds/ca-certificate/delete.d.ts +9 -0
- package/dist/cmds/ca-certificate/delete.d.ts.map +1 -0
- package/dist/cmds/ca-certificate/delete.js +56 -0
- package/dist/cmds/ca-certificate/delete.js.map +1 -0
- package/dist/cmds/ca-certificate/describe.d.ts +9 -0
- package/dist/cmds/ca-certificate/describe.d.ts.map +1 -0
- package/dist/cmds/ca-certificate/describe.js +56 -0
- package/dist/cmds/ca-certificate/describe.js.map +1 -0
- package/dist/cmds/ca-certificate/index.d.ts +4 -0
- package/dist/cmds/ca-certificate/index.d.ts.map +1 -0
- package/dist/cmds/ca-certificate/index.js +18 -0
- package/dist/cmds/ca-certificate/index.js.map +1 -0
- package/dist/cmds/ca-certificate/list.d.ts +9 -0
- package/dist/cmds/ca-certificate/list.d.ts.map +1 -0
- package/dist/cmds/ca-certificate/list.js +48 -0
- package/dist/cmds/ca-certificate/list.js.map +1 -0
- package/dist/cmds/ca-certificate/update.d.ts +9 -0
- package/dist/cmds/ca-certificate/update.d.ts.map +1 -0
- package/dist/cmds/ca-certificate/update.js +56 -0
- package/dist/cmds/ca-certificate/update.js.map +1 -0
- package/dist/cmds/mtls-certificates/index.js +1 -1
- package/dist/cmds/mtls-certificates/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@cfworker/json-schema/README.md +75 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/deep-compare-strict.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/deep-compare-strict.js +42 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/dereference.d.ts +7 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/dereference.js +147 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/format.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/format.js +111 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/index.d.ts +8 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/index.js +24 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/package.json +3 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/pointer.d.ts +2 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/pointer.js +10 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/types.d.ts +72 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/types.js +9 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/ucs2-length.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/ucs2-length.js +20 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/validate.d.ts +3 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/validate.js +805 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/validator.d.ts +10 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/validator.js +27 -0
- package/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js +39 -0
- package/node_modules/@cfworker/json-schema/dist/esm/dereference.d.ts +7 -0
- package/node_modules/@cfworker/json-schema/dist/esm/dereference.js +143 -0
- package/node_modules/@cfworker/json-schema/dist/esm/format.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/dist/esm/format.js +108 -0
- package/node_modules/@cfworker/json-schema/dist/esm/index.d.ts +8 -0
- package/node_modules/@cfworker/json-schema/dist/esm/index.js +8 -0
- package/node_modules/@cfworker/json-schema/dist/esm/package.json +3 -0
- package/node_modules/@cfworker/json-schema/dist/esm/pointer.d.ts +2 -0
- package/node_modules/@cfworker/json-schema/dist/esm/pointer.js +6 -0
- package/node_modules/@cfworker/json-schema/dist/esm/types.d.ts +72 -0
- package/node_modules/@cfworker/json-schema/dist/esm/types.js +6 -0
- package/node_modules/@cfworker/json-schema/dist/esm/ucs2-length.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/dist/esm/ucs2-length.js +17 -0
- package/node_modules/@cfworker/json-schema/dist/esm/validate.d.ts +3 -0
- package/node_modules/@cfworker/json-schema/dist/esm/validate.js +802 -0
- package/node_modules/@cfworker/json-schema/dist/esm/validator.d.ts +10 -0
- package/node_modules/@cfworker/json-schema/dist/esm/validator.js +23 -0
- package/node_modules/@cfworker/json-schema/package.json +68 -0
- package/node_modules/@cfworker/json-schema/src/deep-compare-strict.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/src/deep-compare-strict.ts +39 -0
- package/node_modules/@cfworker/json-schema/src/dereference.d.ts +12 -0
- package/node_modules/@cfworker/json-schema/src/dereference.ts +188 -0
- package/node_modules/@cfworker/json-schema/src/format.d.ts +2 -0
- package/node_modules/@cfworker/json-schema/src/format.ts +164 -0
- package/node_modules/@cfworker/json-schema/src/index.d.ts +8 -0
- package/node_modules/@cfworker/json-schema/src/index.ts +8 -0
- package/node_modules/@cfworker/json-schema/src/pointer.d.ts +2 -0
- package/node_modules/@cfworker/json-schema/src/pointer.ts +7 -0
- package/node_modules/@cfworker/json-schema/src/types.d.ts +79 -0
- package/node_modules/@cfworker/json-schema/src/types.ts +92 -0
- package/node_modules/@cfworker/json-schema/src/ucs2-length.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/src/ucs2-length.ts +24 -0
- package/node_modules/@cfworker/json-schema/src/validate.d.ts +13 -0
- package/node_modules/@cfworker/json-schema/src/validate.ts +1168 -0
- package/node_modules/@cfworker/json-schema/src/validator.d.ts +14 -0
- package/node_modules/@cfworker/json-schema/src/validator.ts +32 -0
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-YJ3VHQXF.js → chunk-2ZQVIVZ3.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-STBDRSX7.js → chunk-UMZORQLU.js} +67 -66
- package/node_modules/@zuplo/runtime/out/esm/chunk-UMZORQLU.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/{chunk-KWR5BV7H.js → chunk-YGYFQCBA.js} +6 -6
- package/node_modules/@zuplo/runtime/out/esm/chunk-YGYFQCBA.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/{chunk-NJNTFB34.js → chunk-ZS34EO4B.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-NJNTFB34.js.map → chunk-ZS34EO4B.js.map} +1 -1
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +208 -72
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +61 -12
- package/node_modules/@zuplo/runtime/out/types/mcp-gateway/index.d.ts +8 -17
- package/node_modules/@zuplo/runtime/out/types/mocks/index.d.ts +3 -12
- package/node_modules/@zuplo/runtime/package.json +3 -2
- package/node_modules/agent-base/README.md +145 -0
- package/node_modules/agent-base/dist/src/index.d.ts +78 -0
- package/node_modules/agent-base/dist/src/index.js +203 -0
- package/node_modules/agent-base/dist/src/index.js.map +1 -0
- package/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
- package/node_modules/agent-base/dist/src/promisify.js +18 -0
- package/node_modules/agent-base/dist/src/promisify.js.map +1 -0
- package/node_modules/agent-base/package.json +64 -0
- package/node_modules/agent-base/src/index.ts +345 -0
- package/node_modules/agent-base/src/promisify.ts +33 -0
- package/node_modules/axios/CHANGELOG.md +71 -0
- package/node_modules/axios/README.md +46 -11
- package/node_modules/axios/dist/axios.js +81 -53
- package/node_modules/axios/dist/axios.js.map +1 -1
- package/node_modules/axios/dist/axios.min.js +2 -2
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +96 -64
- package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
- package/node_modules/axios/dist/esm/axios.js +96 -64
- package/node_modules/axios/dist/esm/axios.js.map +1 -1
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +206 -85
- package/node_modules/axios/dist/node/axios.cjs.map +1 -1
- package/node_modules/axios/index.d.cts +1 -1
- package/node_modules/axios/index.d.ts +1 -1
- package/node_modules/axios/lib/adapters/fetch.js +6 -2
- package/node_modules/axios/lib/adapters/http.js +139 -29
- package/node_modules/axios/lib/adapters/xhr.js +2 -1
- package/node_modules/axios/lib/core/AxiosHeaders.js +1 -33
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/composeSignals.js +48 -47
- package/node_modules/axios/lib/helpers/formDataToJSON.js +1 -1
- package/node_modules/axios/lib/helpers/fromDataURI.js +18 -5
- package/node_modules/axios/lib/helpers/progressEventReducer.js +3 -0
- package/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
- package/node_modules/axios/lib/utils.js +8 -7
- package/node_modules/axios/package.json +3 -1
- package/node_modules/https-proxy-agent/README.md +137 -0
- package/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
- package/node_modules/https-proxy-agent/dist/agent.js +177 -0
- package/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
- package/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
- package/node_modules/https-proxy-agent/dist/index.js +14 -0
- package/node_modules/https-proxy-agent/dist/index.js.map +1 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
- package/node_modules/https-proxy-agent/package.json +56 -0
- package/node_modules/type-is/index.js +8 -18
- package/node_modules/type-is/node_modules/content-type/LICENSE +22 -0
- package/node_modules/type-is/node_modules/content-type/README.md +69 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +26 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.js +170 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/type-is/node_modules/content-type/package.json +52 -0
- package/node_modules/type-is/package.json +9 -5
- package/package.json +6 -6
- package/node_modules/@zuplo/runtime/out/esm/chunk-KWR5BV7H.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-STBDRSX7.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-YJ3VHQXF.js.map → chunk-2ZQVIVZ3.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-STBDRSX7.js.LEGAL.txt → chunk-UMZORQLU.js.LEGAL.txt} +0 -0
- /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,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Validator = void 0;
|
|
4
|
+
const dereference_js_1 = require("./dereference.js");
|
|
5
|
+
const validate_js_1 = require("./validate.js");
|
|
6
|
+
class Validator {
|
|
7
|
+
schema;
|
|
8
|
+
draft;
|
|
9
|
+
shortCircuit;
|
|
10
|
+
lookup;
|
|
11
|
+
constructor(schema, draft = '2019-09', shortCircuit = true) {
|
|
12
|
+
this.schema = schema;
|
|
13
|
+
this.draft = draft;
|
|
14
|
+
this.shortCircuit = shortCircuit;
|
|
15
|
+
this.lookup = (0, dereference_js_1.dereference)(schema);
|
|
16
|
+
}
|
|
17
|
+
validate(instance) {
|
|
18
|
+
return (0, validate_js_1.validate)(instance, this.schema, this.draft, this.lookup, this.shortCircuit);
|
|
19
|
+
}
|
|
20
|
+
addSchema(schema, id) {
|
|
21
|
+
if (id) {
|
|
22
|
+
schema = { ...schema, $id: id };
|
|
23
|
+
}
|
|
24
|
+
(0, dereference_js_1.dereference)(schema, this.lookup);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.Validator = Validator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function deepCompareStrict(a: any, b: any): boolean;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export function deepCompareStrict(a, b) {
|
|
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,7 @@
|
|
|
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(schema: Schema | boolean, lookup?: Record<string, Schema | boolean>, baseURI?: URL, basePointer?: string): Record<string, Schema | boolean>;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { encodePointer } from './pointer.js';
|
|
2
|
+
export const schemaKeyword = {
|
|
3
|
+
additionalItems: true,
|
|
4
|
+
unevaluatedItems: true,
|
|
5
|
+
items: true,
|
|
6
|
+
contains: true,
|
|
7
|
+
additionalProperties: true,
|
|
8
|
+
unevaluatedProperties: true,
|
|
9
|
+
propertyNames: true,
|
|
10
|
+
not: true,
|
|
11
|
+
if: true,
|
|
12
|
+
then: true,
|
|
13
|
+
else: true
|
|
14
|
+
};
|
|
15
|
+
export const schemaArrayKeyword = {
|
|
16
|
+
prefixItems: true,
|
|
17
|
+
items: true,
|
|
18
|
+
allOf: true,
|
|
19
|
+
anyOf: true,
|
|
20
|
+
oneOf: true
|
|
21
|
+
};
|
|
22
|
+
export const schemaMapKeyword = {
|
|
23
|
+
$defs: true,
|
|
24
|
+
definitions: true,
|
|
25
|
+
properties: true,
|
|
26
|
+
patternProperties: true,
|
|
27
|
+
dependentSchemas: true
|
|
28
|
+
};
|
|
29
|
+
export const ignoredKeyword = {
|
|
30
|
+
id: true,
|
|
31
|
+
$id: true,
|
|
32
|
+
$ref: true,
|
|
33
|
+
$schema: true,
|
|
34
|
+
$anchor: true,
|
|
35
|
+
$vocabulary: true,
|
|
36
|
+
$comment: true,
|
|
37
|
+
default: true,
|
|
38
|
+
enum: true,
|
|
39
|
+
const: true,
|
|
40
|
+
required: true,
|
|
41
|
+
type: true,
|
|
42
|
+
maximum: true,
|
|
43
|
+
minimum: true,
|
|
44
|
+
exclusiveMaximum: true,
|
|
45
|
+
exclusiveMinimum: true,
|
|
46
|
+
multipleOf: true,
|
|
47
|
+
maxLength: true,
|
|
48
|
+
minLength: true,
|
|
49
|
+
pattern: true,
|
|
50
|
+
format: true,
|
|
51
|
+
maxItems: true,
|
|
52
|
+
minItems: true,
|
|
53
|
+
uniqueItems: true,
|
|
54
|
+
maxProperties: true,
|
|
55
|
+
minProperties: true
|
|
56
|
+
};
|
|
57
|
+
export let initialBaseURI = typeof self !== 'undefined' &&
|
|
58
|
+
self.location &&
|
|
59
|
+
self.location.origin !== 'null'
|
|
60
|
+
?
|
|
61
|
+
new URL(self.location.origin + self.location.pathname + location.search)
|
|
62
|
+
: new URL('https://github.com/cfworker');
|
|
63
|
+
export function dereference(schema, lookup = Object.create(null), baseURI = initialBaseURI, basePointer = '') {
|
|
64
|
+
if (schema && typeof schema === 'object' && !Array.isArray(schema)) {
|
|
65
|
+
const id = schema.$id || schema.id;
|
|
66
|
+
if (id) {
|
|
67
|
+
const url = new URL(id, baseURI.href);
|
|
68
|
+
if (url.hash.length > 1) {
|
|
69
|
+
lookup[url.href] = schema;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
url.hash = '';
|
|
73
|
+
if (basePointer === '') {
|
|
74
|
+
baseURI = url;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
dereference(schema, lookup, baseURI);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else if (schema !== true && schema !== false) {
|
|
83
|
+
return lookup;
|
|
84
|
+
}
|
|
85
|
+
const schemaURI = baseURI.href + (basePointer ? '#' + basePointer : '');
|
|
86
|
+
if (lookup[schemaURI] !== undefined) {
|
|
87
|
+
throw new Error(`Duplicate schema URI "${schemaURI}".`);
|
|
88
|
+
}
|
|
89
|
+
lookup[schemaURI] = schema;
|
|
90
|
+
if (schema === true || schema === false) {
|
|
91
|
+
return lookup;
|
|
92
|
+
}
|
|
93
|
+
if (schema.__absolute_uri__ === undefined) {
|
|
94
|
+
Object.defineProperty(schema, '__absolute_uri__', {
|
|
95
|
+
enumerable: false,
|
|
96
|
+
value: schemaURI
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (schema.$ref && schema.__absolute_ref__ === undefined) {
|
|
100
|
+
const url = new URL(schema.$ref, baseURI.href);
|
|
101
|
+
url.hash = url.hash;
|
|
102
|
+
Object.defineProperty(schema, '__absolute_ref__', {
|
|
103
|
+
enumerable: false,
|
|
104
|
+
value: url.href
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
if (schema.$recursiveRef && schema.__absolute_recursive_ref__ === undefined) {
|
|
108
|
+
const url = new URL(schema.$recursiveRef, baseURI.href);
|
|
109
|
+
url.hash = url.hash;
|
|
110
|
+
Object.defineProperty(schema, '__absolute_recursive_ref__', {
|
|
111
|
+
enumerable: false,
|
|
112
|
+
value: url.href
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
if (schema.$anchor) {
|
|
116
|
+
const url = new URL('#' + schema.$anchor, baseURI.href);
|
|
117
|
+
lookup[url.href] = schema;
|
|
118
|
+
}
|
|
119
|
+
for (let key in schema) {
|
|
120
|
+
if (ignoredKeyword[key]) {
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
const keyBase = `${basePointer}/${encodePointer(key)}`;
|
|
124
|
+
const subSchema = schema[key];
|
|
125
|
+
if (Array.isArray(subSchema)) {
|
|
126
|
+
if (schemaArrayKeyword[key]) {
|
|
127
|
+
const length = subSchema.length;
|
|
128
|
+
for (let i = 0; i < length; i++) {
|
|
129
|
+
dereference(subSchema[i], lookup, baseURI, `${keyBase}/${i}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else if (schemaMapKeyword[key]) {
|
|
134
|
+
for (let subKey in subSchema) {
|
|
135
|
+
dereference(subSchema[subKey], lookup, baseURI, `${keyBase}/${encodePointer(subKey)}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
dereference(subSchema, lookup, baseURI, keyBase);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return lookup;
|
|
143
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const format: Record<string, (s: string) => boolean>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
2
|
+
const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
3
|
+
const TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
|
|
4
|
+
const HOSTNAME = /^(?=.{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;
|
|
5
|
+
const URIREF = /^(?:[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;
|
|
6
|
+
const URITEMPLATE = /^(?:(?:[^\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;
|
|
7
|
+
const URL_ = /^(?:(?: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;
|
|
8
|
+
const UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
|
|
9
|
+
const JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
|
|
10
|
+
const JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
|
|
11
|
+
const RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
|
|
12
|
+
const EMAIL = (input) => {
|
|
13
|
+
if (input[0] === '"')
|
|
14
|
+
return false;
|
|
15
|
+
const [name, host, ...rest] = input.split('@');
|
|
16
|
+
if (!name ||
|
|
17
|
+
!host ||
|
|
18
|
+
rest.length !== 0 ||
|
|
19
|
+
name.length > 64 ||
|
|
20
|
+
host.length > 253)
|
|
21
|
+
return false;
|
|
22
|
+
if (name[0] === '.' || name.endsWith('.') || name.includes('..'))
|
|
23
|
+
return false;
|
|
24
|
+
if (!/^[a-z0-9.-]+$/i.test(host) ||
|
|
25
|
+
!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(name))
|
|
26
|
+
return false;
|
|
27
|
+
return host
|
|
28
|
+
.split('.')
|
|
29
|
+
.every(part => /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(part));
|
|
30
|
+
};
|
|
31
|
+
const IPV4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
|
|
32
|
+
const IPV6 = /^((([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;
|
|
33
|
+
const DURATION = (input) => input.length > 1 &&
|
|
34
|
+
input.length < 80 &&
|
|
35
|
+
(/^P\d+([.,]\d+)?W$/.test(input) ||
|
|
36
|
+
(/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(input) &&
|
|
37
|
+
/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(input)));
|
|
38
|
+
function bind(r) {
|
|
39
|
+
return r.test.bind(r);
|
|
40
|
+
}
|
|
41
|
+
export const format = {
|
|
42
|
+
date,
|
|
43
|
+
time: time.bind(undefined, false),
|
|
44
|
+
'date-time': date_time,
|
|
45
|
+
duration: DURATION,
|
|
46
|
+
uri,
|
|
47
|
+
'uri-reference': bind(URIREF),
|
|
48
|
+
'uri-template': bind(URITEMPLATE),
|
|
49
|
+
url: bind(URL_),
|
|
50
|
+
email: EMAIL,
|
|
51
|
+
hostname: bind(HOSTNAME),
|
|
52
|
+
ipv4: bind(IPV4),
|
|
53
|
+
ipv6: bind(IPV6),
|
|
54
|
+
regex: regex,
|
|
55
|
+
uuid: bind(UUID),
|
|
56
|
+
'json-pointer': bind(JSON_POINTER),
|
|
57
|
+
'json-pointer-uri-fragment': bind(JSON_POINTER_URI_FRAGMENT),
|
|
58
|
+
'relative-json-pointer': bind(RELATIVE_JSON_POINTER)
|
|
59
|
+
};
|
|
60
|
+
function isLeapYear(year) {
|
|
61
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
62
|
+
}
|
|
63
|
+
function date(str) {
|
|
64
|
+
const matches = str.match(DATE);
|
|
65
|
+
if (!matches)
|
|
66
|
+
return false;
|
|
67
|
+
const year = +matches[1];
|
|
68
|
+
const month = +matches[2];
|
|
69
|
+
const day = +matches[3];
|
|
70
|
+
return (month >= 1 &&
|
|
71
|
+
month <= 12 &&
|
|
72
|
+
day >= 1 &&
|
|
73
|
+
day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]));
|
|
74
|
+
}
|
|
75
|
+
function time(full, str) {
|
|
76
|
+
const matches = str.match(TIME);
|
|
77
|
+
if (!matches)
|
|
78
|
+
return false;
|
|
79
|
+
const hour = +matches[1];
|
|
80
|
+
const minute = +matches[2];
|
|
81
|
+
const second = +matches[3];
|
|
82
|
+
const timeZone = !!matches[5];
|
|
83
|
+
return (((hour <= 23 && minute <= 59 && second <= 59) ||
|
|
84
|
+
(hour == 23 && minute == 59 && second == 60)) &&
|
|
85
|
+
(!full || timeZone));
|
|
86
|
+
}
|
|
87
|
+
const DATE_TIME_SEPARATOR = /t|\s/i;
|
|
88
|
+
function date_time(str) {
|
|
89
|
+
const dateTime = str.split(DATE_TIME_SEPARATOR);
|
|
90
|
+
return dateTime.length == 2 && date(dateTime[0]) && time(true, dateTime[1]);
|
|
91
|
+
}
|
|
92
|
+
const NOT_URI_FRAGMENT = /\/|:/;
|
|
93
|
+
const URI_PATTERN = /^(?:[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;
|
|
94
|
+
function uri(str) {
|
|
95
|
+
return NOT_URI_FRAGMENT.test(str) && URI_PATTERN.test(str);
|
|
96
|
+
}
|
|
97
|
+
const Z_ANCHOR = /[^\\]\\Z/;
|
|
98
|
+
function regex(str) {
|
|
99
|
+
if (Z_ANCHOR.test(str))
|
|
100
|
+
return false;
|
|
101
|
+
try {
|
|
102
|
+
new RegExp(str, 'u');
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -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,72 @@
|
|
|
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 = 'array' | 'boolean' | 'integer' | 'null' | 'number' | 'object' | 'string';
|
|
8
|
+
export interface Schema {
|
|
9
|
+
$id?: string;
|
|
10
|
+
$anchor?: string;
|
|
11
|
+
$recursiveAnchor?: boolean;
|
|
12
|
+
$ref?: string;
|
|
13
|
+
$recursiveRef?: '#';
|
|
14
|
+
$schema?: string;
|
|
15
|
+
$comment?: string;
|
|
16
|
+
$defs?: any;
|
|
17
|
+
$vocabulary?: Record<string, boolean>;
|
|
18
|
+
type?: InstanceType | InstanceType[];
|
|
19
|
+
const?: any;
|
|
20
|
+
enum?: any[];
|
|
21
|
+
required?: string[];
|
|
22
|
+
not?: Schema;
|
|
23
|
+
anyOf?: Schema[];
|
|
24
|
+
allOf?: Schema[];
|
|
25
|
+
oneOf?: Schema[];
|
|
26
|
+
if?: Schema;
|
|
27
|
+
then?: Schema;
|
|
28
|
+
else?: Schema;
|
|
29
|
+
format?: string;
|
|
30
|
+
properties?: Record<string | number, Schema | boolean>;
|
|
31
|
+
patternProperties?: Record<string, Schema | boolean>;
|
|
32
|
+
additionalProperties?: Schema | boolean;
|
|
33
|
+
unevaluatedProperties?: Schema | boolean;
|
|
34
|
+
minProperties?: number;
|
|
35
|
+
maxProperties?: number;
|
|
36
|
+
propertyNames?: Schema;
|
|
37
|
+
dependentRequired?: Record<string, string[]>;
|
|
38
|
+
dependentSchemas?: Record<string, Schema>;
|
|
39
|
+
dependencies?: Record<string, Schema | string[]>;
|
|
40
|
+
prefixItems?: Array<Schema | boolean>;
|
|
41
|
+
items?: Schema | boolean | Array<Schema | boolean>;
|
|
42
|
+
additionalItems?: Schema | boolean;
|
|
43
|
+
unevaluatedItems?: Schema | boolean;
|
|
44
|
+
contains?: Schema | boolean;
|
|
45
|
+
minContains?: number;
|
|
46
|
+
maxContains?: number;
|
|
47
|
+
minItems?: number;
|
|
48
|
+
maxItems?: number;
|
|
49
|
+
uniqueItems?: boolean;
|
|
50
|
+
minimum?: number;
|
|
51
|
+
maximum?: number;
|
|
52
|
+
exclusiveMinimum?: number | boolean;
|
|
53
|
+
exclusiveMaximum?: number | boolean;
|
|
54
|
+
multipleOf?: number;
|
|
55
|
+
minLength?: number;
|
|
56
|
+
maxLength?: number;
|
|
57
|
+
pattern?: string;
|
|
58
|
+
__absolute_ref__?: string;
|
|
59
|
+
__absolute_recursive_ref__?: string;
|
|
60
|
+
__absolute_uri__?: string;
|
|
61
|
+
[key: string]: any;
|
|
62
|
+
}
|
|
63
|
+
export interface OutputUnit {
|
|
64
|
+
keyword: string;
|
|
65
|
+
keywordLocation: string;
|
|
66
|
+
instanceLocation: string;
|
|
67
|
+
error: string;
|
|
68
|
+
}
|
|
69
|
+
export interface ValidationResult {
|
|
70
|
+
valid: boolean;
|
|
71
|
+
errors: OutputUnit[];
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ucs2length(s: string): number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function ucs2length(s) {
|
|
2
|
+
let result = 0;
|
|
3
|
+
let length = s.length;
|
|
4
|
+
let index = 0;
|
|
5
|
+
let charCode;
|
|
6
|
+
while (index < length) {
|
|
7
|
+
result++;
|
|
8
|
+
charCode = s.charCodeAt(index++);
|
|
9
|
+
if (charCode >= 0xd800 && charCode <= 0xdbff && index < length) {
|
|
10
|
+
charCode = s.charCodeAt(index);
|
|
11
|
+
if ((charCode & 0xfc00) == 0xdc00) {
|
|
12
|
+
index++;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Schema, SchemaDraft, ValidationResult } from './types.js';
|
|
2
|
+
export type Evaluated = Record<string | number, boolean>;
|
|
3
|
+
export declare function validate(instance: any, schema: Schema | boolean, draft?: SchemaDraft, lookup?: Record<string, Schema | boolean>, shortCircuit?: boolean, recursiveAnchor?: Schema | null, instanceLocation?: string, schemaLocation?: string, evaluated?: Evaluated): ValidationResult;
|