Initial commit
This commit is contained in:
21
node_modules/ajv-draft-04/LICENSE
generated
vendored
Normal file
21
node_modules/ajv-draft-04/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Evgeny Poberezkin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
40
node_modules/ajv-draft-04/README.md
generated
vendored
Normal file
40
node_modules/ajv-draft-04/README.md
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
# ajv-draft-04
|
||||
|
||||
Ajv with JSON Schema draft-04 support
|
||||
|
||||
[](https://github.com/ajv-validator/ajv-draft-04/actions/workflows/build.yml)
|
||||
[](https://www.npmjs.com/package/ajv-draft-04)
|
||||
[](https://coveralls.io/github/ajv-validator/ajv-draft-04?branch=master)
|
||||
[](https://gitter.im/ajv-validator/ajv)
|
||||
[](https://github.com/sponsors/epoberezkin)
|
||||
|
||||
## Usage
|
||||
|
||||
You need to install both ajv and this package (to allow upgrading ajv without upgrading this package):
|
||||
|
||||
```shell
|
||||
npm i ajv ajv-draft-04
|
||||
```
|
||||
|
||||
```javascript
|
||||
// ESM/TypeScript import
|
||||
import Ajv from "ajv-draft-04"
|
||||
// Node.js require:
|
||||
const Ajv = require("ajv-draft-04")
|
||||
|
||||
const ajv = new Ajv()
|
||||
```
|
||||
|
||||
See [ajv site](https://ajv.js.org) for documentation.
|
||||
|
||||
## Tests
|
||||
|
||||
```bash
|
||||
npm install
|
||||
git submodule update --init
|
||||
npm test
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/ajv-validator/ajv-formats/blob/master/LICENSE)
|
||||
17
node_modules/ajv-draft-04/dist/index.d.ts
generated
vendored
Normal file
17
node_modules/ajv-draft-04/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { AnySchemaObject, Options } from "ajv/dist/core";
|
||||
import AjvCore from "ajv/dist/core";
|
||||
declare class Ajv extends AjvCore {
|
||||
constructor(opts?: Options);
|
||||
_addVocabularies(): void;
|
||||
_addDefaultMetaSchema(): void;
|
||||
defaultMeta(): string | AnySchemaObject | undefined;
|
||||
}
|
||||
export default Ajv;
|
||||
export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, SchemaValidateFunction, ErrorObject, ErrorNoParams, } from "ajv/dist/types";
|
||||
export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions, } from "ajv/dist/core";
|
||||
export { SchemaCxt, SchemaObjCxt } from "ajv/dist/core";
|
||||
export { KeywordCxt } from "ajv/dist/core";
|
||||
export { DefinedError } from "ajv/dist/core";
|
||||
export { JSONType } from "ajv/dist/core";
|
||||
export { JSONSchemaType } from "ajv/dist/core";
|
||||
export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "ajv/dist/core";
|
||||
50
node_modules/ajv-draft-04/dist/index.js
generated
vendored
Normal file
50
node_modules/ajv-draft-04/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
|
||||
const core_1 = require("ajv/dist/core");
|
||||
const draft4_1 = require("./vocabulary/draft4");
|
||||
const discriminator_1 = require("ajv/dist/vocabularies/discriminator");
|
||||
const draft4MetaSchema = require("./refs/json-schema-draft-04.json");
|
||||
const META_SUPPORT_DATA = ["/properties"];
|
||||
const META_SCHEMA_ID = "http://json-schema.org/draft-04/schema";
|
||||
class Ajv extends core_1.default {
|
||||
constructor(opts = {}) {
|
||||
super({
|
||||
...opts,
|
||||
schemaId: "id",
|
||||
});
|
||||
}
|
||||
_addVocabularies() {
|
||||
super._addVocabularies();
|
||||
draft4_1.default.forEach((v) => this.addVocabulary(v));
|
||||
if (this.opts.discriminator)
|
||||
this.addKeyword(discriminator_1.default);
|
||||
}
|
||||
_addDefaultMetaSchema() {
|
||||
super._addDefaultMetaSchema();
|
||||
if (!this.opts.meta)
|
||||
return;
|
||||
const metaSchema = this.opts.$data
|
||||
? this.$dataMetaSchema(draft4MetaSchema, META_SUPPORT_DATA)
|
||||
: draft4MetaSchema;
|
||||
this.addMetaSchema(metaSchema, META_SCHEMA_ID, false);
|
||||
this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
|
||||
}
|
||||
defaultMeta() {
|
||||
return (this.opts.defaultMeta =
|
||||
super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));
|
||||
}
|
||||
}
|
||||
module.exports = exports = Ajv;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Ajv;
|
||||
var core_2 = require("ajv/dist/core");
|
||||
Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return core_2.KeywordCxt; } });
|
||||
var core_3 = require("ajv/dist/core");
|
||||
Object.defineProperty(exports, "_", { enumerable: true, get: function () { return core_3._; } });
|
||||
Object.defineProperty(exports, "str", { enumerable: true, get: function () { return core_3.str; } });
|
||||
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return core_3.stringify; } });
|
||||
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return core_3.nil; } });
|
||||
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return core_3.Name; } });
|
||||
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return core_3.CodeGen; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/ajv-draft-04/dist/index.js.map
generated
vendored
Normal file
1
node_modules/ajv-draft-04/dist/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,wCAAmC;AACnC,gDAAoD;AACpD,uEAA+D;AAC/D,qEAAoE;AAEpE,MAAM,iBAAiB,GAAG,CAAC,aAAa,CAAC,CAAA;AAEzC,MAAM,cAAc,GAAG,wCAAwC,CAAA;AAE/D,MAAM,GAAI,SAAQ,cAAO;IACvB,YAAY,OAAgB,EAAE;QAC5B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,QAAQ,EAAE,IAAI;SACf,CAAC,CAAA;IACJ,CAAC;IAED,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,gBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;QACxD,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,UAAU,CAAC,uBAAa,CAAC,CAAA;IAC7D,CAAC;IAED,qBAAqB;QACnB,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAM;QAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK;YAChC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;YAC3D,CAAC,CAAC,gBAAgB,CAAA;QACpB,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,cAAc,EAAE,KAAK,CAAC,CAAA;QACrD,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,GAAG,cAAc,CAAA;IAC7D,CAAC;IAED,WAAW;QACT,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;YAC3B,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;IACzF,CAAC;CACF;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,GAAG,CAAA;AAC9B,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,GAAG,CAAA;AAiClB,sCAAwC;AAAhC,kGAAA,UAAU,OAAA;AAIlB,sCAAyF;AAAjF,yFAAA,CAAC,OAAA;AAAE,2FAAA,GAAG,OAAA;AAAE,iGAAA,SAAS,OAAA;AAAE,2FAAA,GAAG,OAAA;AAAE,4FAAA,IAAI,OAAA;AAAQ,+FAAA,OAAO,OAAA"}
|
||||
138
node_modules/ajv-draft-04/dist/refs/json-schema-draft-04.json
generated
vendored
Normal file
138
node_modules/ajv-draft-04/dist/refs/json-schema-draft-04.json
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
{
|
||||
"id": "http://json-schema.org/draft-04/schema#",
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"description": "Core schema meta-schema",
|
||||
"definitions": {
|
||||
"schemaArray": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {"$ref": "#"}
|
||||
},
|
||||
"positiveInteger": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"positiveIntegerDefault0": {
|
||||
"allOf": [{"$ref": "#/definitions/positiveInteger"}, {"default": 0}]
|
||||
},
|
||||
"simpleTypes": {
|
||||
"enum": ["array", "boolean", "integer", "null", "number", "object", "string"]
|
||||
},
|
||||
"stringArray": {
|
||||
"type": "array",
|
||||
"items": {"type": "string"},
|
||||
"minItems": 1,
|
||||
"uniqueItems": true
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
},
|
||||
"$schema": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"default": {},
|
||||
"multipleOf": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"exclusiveMinimum": true
|
||||
},
|
||||
"maximum": {
|
||||
"type": "number"
|
||||
},
|
||||
"exclusiveMaximum": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"minimum": {
|
||||
"type": "number"
|
||||
},
|
||||
"exclusiveMinimum": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"maxLength": {"$ref": "#/definitions/positiveInteger"},
|
||||
"minLength": {"$ref": "#/definitions/positiveIntegerDefault0"},
|
||||
"pattern": {
|
||||
"type": "string",
|
||||
"format": "regex"
|
||||
},
|
||||
"additionalItems": {
|
||||
"anyOf": [{"type": "boolean"}, {"$ref": "#"}],
|
||||
"default": {}
|
||||
},
|
||||
"items": {
|
||||
"anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}],
|
||||
"default": {}
|
||||
},
|
||||
"maxItems": {"$ref": "#/definitions/positiveInteger"},
|
||||
"minItems": {"$ref": "#/definitions/positiveIntegerDefault0"},
|
||||
"uniqueItems": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"maxProperties": {"$ref": "#/definitions/positiveInteger"},
|
||||
"minProperties": {"$ref": "#/definitions/positiveIntegerDefault0"},
|
||||
"required": {"$ref": "#/definitions/stringArray"},
|
||||
"additionalProperties": {
|
||||
"anyOf": [{"type": "boolean"}, {"$ref": "#"}],
|
||||
"default": {}
|
||||
},
|
||||
"definitions": {
|
||||
"type": "object",
|
||||
"additionalProperties": {"$ref": "#"},
|
||||
"default": {}
|
||||
},
|
||||
"properties": {
|
||||
"type": "object",
|
||||
"additionalProperties": {"$ref": "#"},
|
||||
"default": {}
|
||||
},
|
||||
"patternProperties": {
|
||||
"type": "object",
|
||||
"additionalProperties": {"$ref": "#"},
|
||||
"default": {}
|
||||
},
|
||||
"dependencies": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}]
|
||||
}
|
||||
},
|
||||
"enum": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"uniqueItems": true
|
||||
},
|
||||
"type": {
|
||||
"anyOf": [
|
||||
{"$ref": "#/definitions/simpleTypes"},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {"$ref": "#/definitions/simpleTypes"},
|
||||
"minItems": 1,
|
||||
"uniqueItems": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"allOf": {"$ref": "#/definitions/schemaArray"},
|
||||
"anyOf": {"$ref": "#/definitions/schemaArray"},
|
||||
"oneOf": {"$ref": "#/definitions/schemaArray"},
|
||||
"not": {"$ref": "#"}
|
||||
},
|
||||
"dependencies": {
|
||||
"exclusiveMaximum": ["maximum"],
|
||||
"exclusiveMinimum": ["minimum"]
|
||||
},
|
||||
"default": {}
|
||||
}
|
||||
3
node_modules/ajv-draft-04/dist/vocabulary/core.d.ts
generated
vendored
Normal file
3
node_modules/ajv-draft-04/dist/vocabulary/core.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Vocabulary } from "ajv/dist/core";
|
||||
declare const core: Vocabulary;
|
||||
export default core;
|
||||
13
node_modules/ajv-draft-04/dist/vocabulary/core.js
generated
vendored
Normal file
13
node_modules/ajv-draft-04/dist/vocabulary/core.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const ref_1 = require("ajv/dist/vocabularies/core/ref");
|
||||
const core = [
|
||||
"$schema",
|
||||
"id",
|
||||
"$defs",
|
||||
{ keyword: "$comment" },
|
||||
"definitions",
|
||||
ref_1.default,
|
||||
];
|
||||
exports.default = core;
|
||||
//# sourceMappingURL=core.js.map
|
||||
1
node_modules/ajv-draft-04/dist/vocabulary/core.js.map
generated
vendored
Normal file
1
node_modules/ajv-draft-04/dist/vocabulary/core.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/vocabulary/core.ts"],"names":[],"mappings":";;AACA,wDAAuD;AAEvD,MAAM,IAAI,GAAe;IACvB,SAAS;IACT,IAAI;IACJ,OAAO;IACP,EAAC,OAAO,EAAE,UAAU,EAAC;IACrB,aAAa;IACb,aAAU;CACX,CAAA;AAED,kBAAe,IAAI,CAAA"}
|
||||
3
node_modules/ajv-draft-04/dist/vocabulary/draft4.d.ts
generated
vendored
Normal file
3
node_modules/ajv-draft-04/dist/vocabulary/draft4.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Vocabulary } from "ajv/dist/core";
|
||||
declare const draft4Vocabularies: Vocabulary[];
|
||||
export default draft4Vocabularies;
|
||||
16
node_modules/ajv-draft-04/dist/vocabulary/draft4.js
generated
vendored
Normal file
16
node_modules/ajv-draft-04/dist/vocabulary/draft4.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core_1 = require("./core");
|
||||
const validation_1 = require("./validation");
|
||||
const applicator_1 = require("ajv/dist/vocabularies/applicator");
|
||||
const format_1 = require("ajv/dist/vocabularies/format");
|
||||
const metadataVocabulary = ["title", "description", "default"];
|
||||
const draft4Vocabularies = [
|
||||
core_1.default,
|
||||
validation_1.default,
|
||||
applicator_1.default(),
|
||||
format_1.default,
|
||||
metadataVocabulary,
|
||||
];
|
||||
exports.default = draft4Vocabularies;
|
||||
//# sourceMappingURL=draft4.js.map
|
||||
1
node_modules/ajv-draft-04/dist/vocabulary/draft4.js.map
generated
vendored
Normal file
1
node_modules/ajv-draft-04/dist/vocabulary/draft4.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"draft4.js","sourceRoot":"","sources":["../../src/vocabulary/draft4.ts"],"names":[],"mappings":";;AACA,iCAAmC;AACnC,6CAA2C;AAC3C,iEAAsE;AACtE,yDAA2D;AAE3D,MAAM,kBAAkB,GAAe,CAAC,OAAO,EAAE,aAAa,EAAE,SAAS,CAAC,CAAA;AAE1E,MAAM,kBAAkB,GAAiB;IACvC,cAAc;IACd,oBAAgB;IAChB,oBAAuB,EAAE;IACzB,gBAAgB;IAChB,kBAAkB;CACnB,CAAA;AAED,kBAAe,kBAAkB,CAAA"}
|
||||
16
node_modules/ajv-draft-04/dist/vocabulary/validation/index.d.ts
generated
vendored
Normal file
16
node_modules/ajv-draft-04/dist/vocabulary/validation/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { ErrorObject, Vocabulary } from "ajv/dist/core";
|
||||
import { LimitNumberError } from "./limitNumber";
|
||||
import { MultipleOfError } from "ajv/dist/vocabularies/validation/multipleOf";
|
||||
import { PatternError } from "ajv/dist/vocabularies/validation/pattern";
|
||||
import { RequiredError } from "ajv/dist/vocabularies/validation/required";
|
||||
import { UniqueItemsError } from "ajv/dist/vocabularies/validation/uniqueItems";
|
||||
import { ConstError } from "ajv/dist/vocabularies/validation/const";
|
||||
import { EnumError } from "ajv/dist/vocabularies/validation/enum";
|
||||
declare const validation: Vocabulary;
|
||||
export default validation;
|
||||
declare type LimitError = ErrorObject<"maxItems" | "minItems" | "minProperties" | "maxProperties" | "minLength" | "maxLength", {
|
||||
limit: number;
|
||||
}, number | {
|
||||
$data: string;
|
||||
}>;
|
||||
export declare type ValidationKeywordError = LimitError | LimitNumberError | MultipleOfError | PatternError | RequiredError | UniqueItemsError | ConstError | EnumError;
|
||||
35
node_modules/ajv-draft-04/dist/vocabulary/validation/index.js
generated
vendored
Normal file
35
node_modules/ajv-draft-04/dist/vocabulary/validation/index.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const limitNumber_1 = require("./limitNumber");
|
||||
const limitNumberExclusive_1 = require("./limitNumberExclusive");
|
||||
const multipleOf_1 = require("ajv/dist/vocabularies/validation/multipleOf");
|
||||
const limitLength_1 = require("ajv/dist/vocabularies/validation/limitLength");
|
||||
const pattern_1 = require("ajv/dist/vocabularies/validation/pattern");
|
||||
const limitProperties_1 = require("ajv/dist/vocabularies/validation/limitProperties");
|
||||
const required_1 = require("ajv/dist/vocabularies/validation/required");
|
||||
const limitItems_1 = require("ajv/dist/vocabularies/validation/limitItems");
|
||||
const uniqueItems_1 = require("ajv/dist/vocabularies/validation/uniqueItems");
|
||||
const const_1 = require("ajv/dist/vocabularies/validation/const");
|
||||
const enum_1 = require("ajv/dist/vocabularies/validation/enum");
|
||||
const validation = [
|
||||
// number
|
||||
limitNumber_1.default,
|
||||
limitNumberExclusive_1.default,
|
||||
multipleOf_1.default,
|
||||
// string
|
||||
limitLength_1.default,
|
||||
pattern_1.default,
|
||||
// object
|
||||
limitProperties_1.default,
|
||||
required_1.default,
|
||||
// array
|
||||
limitItems_1.default,
|
||||
uniqueItems_1.default,
|
||||
// any
|
||||
{ keyword: "type", schemaType: ["string", "array"] },
|
||||
{ keyword: "nullable", schemaType: "boolean" },
|
||||
const_1.default,
|
||||
enum_1.default,
|
||||
];
|
||||
exports.default = validation;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/ajv-draft-04/dist/vocabulary/validation/index.js.map
generated
vendored
Normal file
1
node_modules/ajv-draft-04/dist/vocabulary/validation/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/vocabulary/validation/index.ts"],"names":[],"mappings":";;AACA,+CAA2D;AAC3D,iEAAyD;AACzD,4EAAuF;AACvF,8EAAsE;AACtE,sEAA8E;AAC9E,sFAA8E;AAC9E,wEAAiF;AACjF,4EAAoE;AACpE,8EAA0F;AAC1F,kEAA+E;AAC/E,gEAA4E;AAE5E,MAAM,UAAU,GAAe;IAC7B,SAAS;IACT,qBAAW;IACX,8BAAoB;IACpB,oBAAU;IACV,SAAS;IACT,qBAAW;IACX,iBAAO;IACP,SAAS;IACT,yBAAe;IACf,kBAAQ;IACR,QAAQ;IACR,oBAAU;IACV,qBAAW;IACX,MAAM;IACN,EAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAC;IAClD,EAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAC;IAC5C,eAAY;IACZ,cAAW;CACZ,CAAA;AAED,kBAAe,UAAU,CAAA"}
|
||||
12
node_modules/ajv-draft-04/dist/vocabulary/validation/limitNumber.d.ts
generated
vendored
Normal file
12
node_modules/ajv-draft-04/dist/vocabulary/validation/limitNumber.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { CodeKeywordDefinition, ErrorObject } from "ajv/dist/core";
|
||||
export declare type LimitKwd = "maximum" | "minimum";
|
||||
export declare type ExclusiveLimitKwd = "exclusiveMaximum" | "exclusiveMinimum";
|
||||
declare type Comparison = "<=" | ">=" | "<" | ">";
|
||||
export declare type LimitNumberError = ErrorObject<LimitKwd, {
|
||||
limit: number;
|
||||
comparison: Comparison;
|
||||
}, number | {
|
||||
$data: string;
|
||||
}>;
|
||||
declare const def: CodeKeywordDefinition;
|
||||
export default def;
|
||||
44
node_modules/ajv-draft-04/dist/vocabulary/validation/limitNumber.js
generated
vendored
Normal file
44
node_modules/ajv-draft-04/dist/vocabulary/validation/limitNumber.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core_1 = require("ajv/dist/core");
|
||||
const codegen_1 = require("ajv/dist/compile/codegen");
|
||||
const ops = codegen_1.operators;
|
||||
const KWDs = {
|
||||
maximum: {
|
||||
exclusive: "exclusiveMaximum",
|
||||
ops: [
|
||||
{ okStr: "<=", ok: ops.LTE, fail: ops.GT },
|
||||
{ okStr: "<", ok: ops.LT, fail: ops.GTE },
|
||||
],
|
||||
},
|
||||
minimum: {
|
||||
exclusive: "exclusiveMinimum",
|
||||
ops: [
|
||||
{ okStr: ">=", ok: ops.GTE, fail: ops.LT },
|
||||
{ okStr: ">", ok: ops.GT, fail: ops.LTE },
|
||||
],
|
||||
},
|
||||
};
|
||||
const error = {
|
||||
message: (cxt) => core_1.str `must be ${kwdOp(cxt).okStr} ${cxt.schemaCode}`,
|
||||
params: (cxt) => core_1._ `{comparison: ${kwdOp(cxt).okStr}, limit: ${cxt.schemaCode}}`,
|
||||
};
|
||||
const def = {
|
||||
keyword: Object.keys(KWDs),
|
||||
type: "number",
|
||||
schemaType: "number",
|
||||
$data: true,
|
||||
error,
|
||||
code(cxt) {
|
||||
const { data, schemaCode } = cxt;
|
||||
cxt.fail$data(core_1._ `${data} ${kwdOp(cxt).fail} ${schemaCode} || isNaN(${data})`);
|
||||
},
|
||||
};
|
||||
function kwdOp(cxt) {
|
||||
var _a;
|
||||
const keyword = cxt.keyword;
|
||||
const opsIdx = ((_a = cxt.parentSchema) === null || _a === void 0 ? void 0 : _a[KWDs[keyword].exclusive]) ? 1 : 0;
|
||||
return KWDs[keyword].ops[opsIdx];
|
||||
}
|
||||
exports.default = def;
|
||||
//# sourceMappingURL=limitNumber.js.map
|
||||
1
node_modules/ajv-draft-04/dist/vocabulary/validation/limitNumber.js.map
generated
vendored
Normal file
1
node_modules/ajv-draft-04/dist/vocabulary/validation/limitNumber.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"limitNumber.js","sourceRoot":"","sources":["../../../src/vocabulary/validation/limitNumber.ts"],"names":[],"mappings":";;AAOA,wCAA0C;AAC1C,sDAAkD;AAElD,MAAM,GAAG,GAAG,mBAAS,CAAA;AAmBrB,MAAM,IAAI,GAA8B;IACtC,OAAO,EAAE;QACP,SAAS,EAAE,kBAAkB;QAC7B,GAAG,EAAE;YACH,EAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,EAAC;YACxC,EAAC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,GAAG,EAAC;SACxC;KACF;IACD,OAAO,EAAE;QACP,SAAS,EAAE,kBAAkB;QAC7B,GAAG,EAAE;YACH,EAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,EAAC;YACxC,EAAC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,GAAG,EAAC;SACxC;KACF;CACF,CAAA;AAQD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,UAAG,CAAA,WAAW,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,UAAU,EAAE;IACpE,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAC,CAAA,gBAAgB,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,YAAY,GAAG,CAAC,UAAU,GAAG;CAChF,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;IAC1B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,IAAI,EAAE,UAAU,EAAC,GAAG,GAAG,CAAA;QAC9B,GAAG,CAAC,SAAS,CAAC,QAAC,CAAA,GAAG,IAAI,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,UAAU,aAAa,IAAI,GAAG,CAAC,CAAA;IAC9E,CAAC;CACF,CAAA;AAED,SAAS,KAAK,CAAC,GAAoB;;IACjC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAmB,CAAA;IACvC,MAAM,MAAM,GAAG,CAAA,MAAA,GAAG,CAAC,YAAY,0CAAG,IAAI,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAClE,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AAClC,CAAC;AAED,kBAAe,GAAG,CAAA"}
|
||||
3
node_modules/ajv-draft-04/dist/vocabulary/validation/limitNumberExclusive.d.ts
generated
vendored
Normal file
3
node_modules/ajv-draft-04/dist/vocabulary/validation/limitNumberExclusive.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { CodeKeywordDefinition } from "ajv/dist/core";
|
||||
declare const def: CodeKeywordDefinition;
|
||||
export default def;
|
||||
19
node_modules/ajv-draft-04/dist/vocabulary/validation/limitNumberExclusive.js
generated
vendored
Normal file
19
node_modules/ajv-draft-04/dist/vocabulary/validation/limitNumberExclusive.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const KWDs = {
|
||||
exclusiveMaximum: "maximum",
|
||||
exclusiveMinimum: "minimum",
|
||||
};
|
||||
const def = {
|
||||
keyword: Object.keys(KWDs),
|
||||
type: "number",
|
||||
schemaType: "boolean",
|
||||
code({ keyword, parentSchema }) {
|
||||
const limitKwd = KWDs[keyword];
|
||||
if (parentSchema[limitKwd] === undefined) {
|
||||
throw new Error(`${keyword} can only be used with ${limitKwd}`);
|
||||
}
|
||||
},
|
||||
};
|
||||
exports.default = def;
|
||||
//# sourceMappingURL=limitNumberExclusive.js.map
|
||||
1
node_modules/ajv-draft-04/dist/vocabulary/validation/limitNumberExclusive.js.map
generated
vendored
Normal file
1
node_modules/ajv-draft-04/dist/vocabulary/validation/limitNumberExclusive.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"limitNumberExclusive.js","sourceRoot":"","sources":["../../../src/vocabulary/validation/limitNumberExclusive.ts"],"names":[],"mappings":";;AAQA,MAAM,IAAI,GAAyC;IACjD,gBAAgB,EAAE,SAAS;IAC3B,gBAAgB,EAAE,SAAS;CAC5B,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;IAC1B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,SAAS;IACrB,IAAI,CAAC,EAAC,OAAO,EAAE,YAAY,EAAa;QACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAA4B,CAAC,CAAA;QACnD,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE;YACxC,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,0BAA0B,QAAQ,EAAE,CAAC,CAAA;SAChE;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"}
|
||||
74
node_modules/ajv-draft-04/package.json
generated
vendored
Normal file
74
node_modules/ajv-draft-04/package.json
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"name": "ajv-draft-04",
|
||||
"version": "1.0.0",
|
||||
"description": "Ajv class for JSON Schema draft-04",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"src/",
|
||||
"dist/"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "rm -rf dist && tsc && cp -r src/refs dist",
|
||||
"prettier:write": "prettier --write \"./**/*.{json,yaml,js,ts}\"",
|
||||
"prettier:check": "prettier --list-different \"./**/*.{json,yaml,js,ts}\"",
|
||||
"eslint": "eslint \"./{src,tests,scripts}/**/*.{ts,js}\"",
|
||||
"json-tests": "rm -rf tests/_json/*.js && node scripts/jsontests",
|
||||
"test-spec": "jest",
|
||||
"test-cov": "jest --coverage",
|
||||
"test-debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
|
||||
"test": "npm run json-tests && npm run prettier:check && npm run build && npm run eslint && npm run test-cov",
|
||||
"test-ci": "AJV_FULL_TEST=true npm test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ajv-validator/ajv-draft-04.git"
|
||||
},
|
||||
"keywords": [
|
||||
"Ajv",
|
||||
"JSON-Schema",
|
||||
"validation",
|
||||
"draft-04"
|
||||
],
|
||||
"author": "Evgeny Poberezkin",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ajv-validator/ajv-draft-04/issues"
|
||||
},
|
||||
"homepage": "https://github.com/ajv-validator/ajv-draft-04#readme",
|
||||
"dependencies": {},
|
||||
"peerDependencies": {
|
||||
"ajv": "^8.5.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"ajv": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ajv-validator/config": "^0.3.0",
|
||||
"@types/jest": "^26.0.5",
|
||||
"@types/node": "^14.10.1",
|
||||
"@typescript-eslint/eslint-plugin": "^3.7.0",
|
||||
"@typescript-eslint/parser": "^3.7.0",
|
||||
"ajv-formats": "^2.0.0",
|
||||
"eslint": "^7.5.0",
|
||||
"eslint-config-prettier": "^6.11.0",
|
||||
"husky": "^4.2.5",
|
||||
"jest": "^26.1.0",
|
||||
"json-schema-test": "^2.0.0",
|
||||
"lint-staged": "^10.2.11",
|
||||
"prettier": "^2.0.5",
|
||||
"ts-jest": "^26.1.3",
|
||||
"typescript": "^4.0.0"
|
||||
},
|
||||
"prettier": "@ajv-validator/config/prettierrc.json",
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged && npm test"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{json,yaml,js,ts}": "prettier --write"
|
||||
}
|
||||
}
|
||||
81
node_modules/ajv-draft-04/src/index.ts
generated
vendored
Normal file
81
node_modules/ajv-draft-04/src/index.ts
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
import type {AnySchemaObject, Options} from "ajv/dist/core"
|
||||
import AjvCore from "ajv/dist/core"
|
||||
import draft4Vocabularies from "./vocabulary/draft4"
|
||||
import discriminator from "ajv/dist/vocabularies/discriminator"
|
||||
import * as draft4MetaSchema from "./refs/json-schema-draft-04.json"
|
||||
|
||||
const META_SUPPORT_DATA = ["/properties"]
|
||||
|
||||
const META_SCHEMA_ID = "http://json-schema.org/draft-04/schema"
|
||||
|
||||
class Ajv extends AjvCore {
|
||||
constructor(opts: Options = {}) {
|
||||
super({
|
||||
...opts,
|
||||
schemaId: "id",
|
||||
})
|
||||
}
|
||||
|
||||
_addVocabularies(): void {
|
||||
super._addVocabularies()
|
||||
draft4Vocabularies.forEach((v) => this.addVocabulary(v))
|
||||
if (this.opts.discriminator) this.addKeyword(discriminator)
|
||||
}
|
||||
|
||||
_addDefaultMetaSchema(): void {
|
||||
super._addDefaultMetaSchema()
|
||||
if (!this.opts.meta) return
|
||||
const metaSchema = this.opts.$data
|
||||
? this.$dataMetaSchema(draft4MetaSchema, META_SUPPORT_DATA)
|
||||
: draft4MetaSchema
|
||||
this.addMetaSchema(metaSchema, META_SCHEMA_ID, false)
|
||||
this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID
|
||||
}
|
||||
|
||||
defaultMeta(): string | AnySchemaObject | undefined {
|
||||
return (this.opts.defaultMeta =
|
||||
super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined))
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = Ajv
|
||||
Object.defineProperty(exports, "__esModule", {value: true})
|
||||
|
||||
export default Ajv
|
||||
|
||||
export {
|
||||
Format,
|
||||
FormatDefinition,
|
||||
AsyncFormatDefinition,
|
||||
KeywordDefinition,
|
||||
KeywordErrorDefinition,
|
||||
CodeKeywordDefinition,
|
||||
MacroKeywordDefinition,
|
||||
FuncKeywordDefinition,
|
||||
Vocabulary,
|
||||
Schema,
|
||||
SchemaObject,
|
||||
AnySchemaObject,
|
||||
AsyncSchema,
|
||||
AnySchema,
|
||||
ValidateFunction,
|
||||
AsyncValidateFunction,
|
||||
SchemaValidateFunction,
|
||||
ErrorObject,
|
||||
ErrorNoParams,
|
||||
} from "ajv/dist/types"
|
||||
|
||||
export {
|
||||
Plugin,
|
||||
Options,
|
||||
CodeOptions,
|
||||
InstanceOptions,
|
||||
Logger,
|
||||
ErrorsTextOptions,
|
||||
} from "ajv/dist/core"
|
||||
export {SchemaCxt, SchemaObjCxt} from "ajv/dist/core"
|
||||
export {KeywordCxt} from "ajv/dist/core"
|
||||
export {DefinedError} from "ajv/dist/core"
|
||||
export {JSONType} from "ajv/dist/core"
|
||||
export {JSONSchemaType} from "ajv/dist/core"
|
||||
export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "ajv/dist/core"
|
||||
138
node_modules/ajv-draft-04/src/refs/json-schema-draft-04.json
generated
vendored
Normal file
138
node_modules/ajv-draft-04/src/refs/json-schema-draft-04.json
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
{
|
||||
"id": "http://json-schema.org/draft-04/schema#",
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"description": "Core schema meta-schema",
|
||||
"definitions": {
|
||||
"schemaArray": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {"$ref": "#"}
|
||||
},
|
||||
"positiveInteger": {
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"positiveIntegerDefault0": {
|
||||
"allOf": [{"$ref": "#/definitions/positiveInteger"}, {"default": 0}]
|
||||
},
|
||||
"simpleTypes": {
|
||||
"enum": ["array", "boolean", "integer", "null", "number", "object", "string"]
|
||||
},
|
||||
"stringArray": {
|
||||
"type": "array",
|
||||
"items": {"type": "string"},
|
||||
"minItems": 1,
|
||||
"uniqueItems": true
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
},
|
||||
"$schema": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"default": {},
|
||||
"multipleOf": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"exclusiveMinimum": true
|
||||
},
|
||||
"maximum": {
|
||||
"type": "number"
|
||||
},
|
||||
"exclusiveMaximum": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"minimum": {
|
||||
"type": "number"
|
||||
},
|
||||
"exclusiveMinimum": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"maxLength": {"$ref": "#/definitions/positiveInteger"},
|
||||
"minLength": {"$ref": "#/definitions/positiveIntegerDefault0"},
|
||||
"pattern": {
|
||||
"type": "string",
|
||||
"format": "regex"
|
||||
},
|
||||
"additionalItems": {
|
||||
"anyOf": [{"type": "boolean"}, {"$ref": "#"}],
|
||||
"default": {}
|
||||
},
|
||||
"items": {
|
||||
"anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}],
|
||||
"default": {}
|
||||
},
|
||||
"maxItems": {"$ref": "#/definitions/positiveInteger"},
|
||||
"minItems": {"$ref": "#/definitions/positiveIntegerDefault0"},
|
||||
"uniqueItems": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"maxProperties": {"$ref": "#/definitions/positiveInteger"},
|
||||
"minProperties": {"$ref": "#/definitions/positiveIntegerDefault0"},
|
||||
"required": {"$ref": "#/definitions/stringArray"},
|
||||
"additionalProperties": {
|
||||
"anyOf": [{"type": "boolean"}, {"$ref": "#"}],
|
||||
"default": {}
|
||||
},
|
||||
"definitions": {
|
||||
"type": "object",
|
||||
"additionalProperties": {"$ref": "#"},
|
||||
"default": {}
|
||||
},
|
||||
"properties": {
|
||||
"type": "object",
|
||||
"additionalProperties": {"$ref": "#"},
|
||||
"default": {}
|
||||
},
|
||||
"patternProperties": {
|
||||
"type": "object",
|
||||
"additionalProperties": {"$ref": "#"},
|
||||
"default": {}
|
||||
},
|
||||
"dependencies": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}]
|
||||
}
|
||||
},
|
||||
"enum": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"uniqueItems": true
|
||||
},
|
||||
"type": {
|
||||
"anyOf": [
|
||||
{"$ref": "#/definitions/simpleTypes"},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {"$ref": "#/definitions/simpleTypes"},
|
||||
"minItems": 1,
|
||||
"uniqueItems": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"allOf": {"$ref": "#/definitions/schemaArray"},
|
||||
"anyOf": {"$ref": "#/definitions/schemaArray"},
|
||||
"oneOf": {"$ref": "#/definitions/schemaArray"},
|
||||
"not": {"$ref": "#"}
|
||||
},
|
||||
"dependencies": {
|
||||
"exclusiveMaximum": ["maximum"],
|
||||
"exclusiveMinimum": ["minimum"]
|
||||
},
|
||||
"default": {}
|
||||
}
|
||||
13
node_modules/ajv-draft-04/src/vocabulary/core.ts
generated
vendored
Normal file
13
node_modules/ajv-draft-04/src/vocabulary/core.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import type {Vocabulary} from "ajv/dist/core"
|
||||
import refKeyword from "ajv/dist/vocabularies/core/ref"
|
||||
|
||||
const core: Vocabulary = [
|
||||
"$schema",
|
||||
"id",
|
||||
"$defs",
|
||||
{keyword: "$comment"},
|
||||
"definitions",
|
||||
refKeyword,
|
||||
]
|
||||
|
||||
export default core
|
||||
17
node_modules/ajv-draft-04/src/vocabulary/draft4.ts
generated
vendored
Normal file
17
node_modules/ajv-draft-04/src/vocabulary/draft4.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import type {Vocabulary} from "ajv/dist/core"
|
||||
import coreVocabulary from "./core"
|
||||
import validationDraft4 from "./validation"
|
||||
import getApplicatorVocabulary from "ajv/dist/vocabularies/applicator"
|
||||
import formatVocabulary from "ajv/dist/vocabularies/format"
|
||||
|
||||
const metadataVocabulary: Vocabulary = ["title", "description", "default"]
|
||||
|
||||
const draft4Vocabularies: Vocabulary[] = [
|
||||
coreVocabulary,
|
||||
validationDraft4,
|
||||
getApplicatorVocabulary(),
|
||||
formatVocabulary,
|
||||
metadataVocabulary,
|
||||
]
|
||||
|
||||
export default draft4Vocabularies
|
||||
51
node_modules/ajv-draft-04/src/vocabulary/validation/index.ts
generated
vendored
Normal file
51
node_modules/ajv-draft-04/src/vocabulary/validation/index.ts
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import type {ErrorObject, Vocabulary} from "ajv/dist/core"
|
||||
import limitNumber, {LimitNumberError} from "./limitNumber"
|
||||
import limitNumberExclusive from "./limitNumberExclusive"
|
||||
import multipleOf, {MultipleOfError} from "ajv/dist/vocabularies/validation/multipleOf"
|
||||
import limitLength from "ajv/dist/vocabularies/validation/limitLength"
|
||||
import pattern, {PatternError} from "ajv/dist/vocabularies/validation/pattern"
|
||||
import limitProperties from "ajv/dist/vocabularies/validation/limitProperties"
|
||||
import required, {RequiredError} from "ajv/dist/vocabularies/validation/required"
|
||||
import limitItems from "ajv/dist/vocabularies/validation/limitItems"
|
||||
import uniqueItems, {UniqueItemsError} from "ajv/dist/vocabularies/validation/uniqueItems"
|
||||
import constKeyword, {ConstError} from "ajv/dist/vocabularies/validation/const"
|
||||
import enumKeyword, {EnumError} from "ajv/dist/vocabularies/validation/enum"
|
||||
|
||||
const validation: Vocabulary = [
|
||||
// number
|
||||
limitNumber,
|
||||
limitNumberExclusive,
|
||||
multipleOf,
|
||||
// string
|
||||
limitLength,
|
||||
pattern,
|
||||
// object
|
||||
limitProperties,
|
||||
required,
|
||||
// array
|
||||
limitItems,
|
||||
uniqueItems,
|
||||
// any
|
||||
{keyword: "type", schemaType: ["string", "array"]},
|
||||
{keyword: "nullable", schemaType: "boolean"},
|
||||
constKeyword,
|
||||
enumKeyword,
|
||||
]
|
||||
|
||||
export default validation
|
||||
|
||||
type LimitError = ErrorObject<
|
||||
"maxItems" | "minItems" | "minProperties" | "maxProperties" | "minLength" | "maxLength",
|
||||
{limit: number},
|
||||
number | {$data: string}
|
||||
>
|
||||
|
||||
export type ValidationKeywordError =
|
||||
| LimitError
|
||||
| LimitNumberError
|
||||
| MultipleOfError
|
||||
| PatternError
|
||||
| RequiredError
|
||||
| UniqueItemsError
|
||||
| ConstError
|
||||
| EnumError
|
||||
76
node_modules/ajv-draft-04/src/vocabulary/validation/limitNumber.ts
generated
vendored
Normal file
76
node_modules/ajv-draft-04/src/vocabulary/validation/limitNumber.ts
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
import type {
|
||||
CodeKeywordDefinition,
|
||||
ErrorObject,
|
||||
KeywordCxt,
|
||||
KeywordErrorDefinition,
|
||||
} from "ajv/dist/core"
|
||||
import type {KeywordErrorCxt} from "ajv/dist/types"
|
||||
import {_, str, Code} from "ajv/dist/core"
|
||||
import {operators} from "ajv/dist/compile/codegen"
|
||||
|
||||
const ops = operators
|
||||
|
||||
export type LimitKwd = "maximum" | "minimum"
|
||||
|
||||
export type ExclusiveLimitKwd = "exclusiveMaximum" | "exclusiveMinimum"
|
||||
|
||||
type Comparison = "<=" | ">=" | "<" | ">"
|
||||
|
||||
interface KwdOp {
|
||||
okStr: Comparison
|
||||
ok: Code
|
||||
fail: Code
|
||||
}
|
||||
|
||||
interface KwdDef {
|
||||
exclusive: ExclusiveLimitKwd
|
||||
ops: [KwdOp, KwdOp]
|
||||
}
|
||||
|
||||
const KWDs: {[K in LimitKwd]: KwdDef} = {
|
||||
maximum: {
|
||||
exclusive: "exclusiveMaximum",
|
||||
ops: [
|
||||
{okStr: "<=", ok: ops.LTE, fail: ops.GT},
|
||||
{okStr: "<", ok: ops.LT, fail: ops.GTE},
|
||||
],
|
||||
},
|
||||
minimum: {
|
||||
exclusive: "exclusiveMinimum",
|
||||
ops: [
|
||||
{okStr: ">=", ok: ops.GTE, fail: ops.LT},
|
||||
{okStr: ">", ok: ops.GT, fail: ops.LTE},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
export type LimitNumberError = ErrorObject<
|
||||
LimitKwd,
|
||||
{limit: number; comparison: Comparison},
|
||||
number | {$data: string}
|
||||
>
|
||||
|
||||
const error: KeywordErrorDefinition = {
|
||||
message: (cxt) => str`must be ${kwdOp(cxt).okStr} ${cxt.schemaCode}`,
|
||||
params: (cxt) => _`{comparison: ${kwdOp(cxt).okStr}, limit: ${cxt.schemaCode}}`,
|
||||
}
|
||||
|
||||
const def: CodeKeywordDefinition = {
|
||||
keyword: Object.keys(KWDs),
|
||||
type: "number",
|
||||
schemaType: "number",
|
||||
$data: true,
|
||||
error,
|
||||
code(cxt: KeywordCxt) {
|
||||
const {data, schemaCode} = cxt
|
||||
cxt.fail$data(_`${data} ${kwdOp(cxt).fail} ${schemaCode} || isNaN(${data})`)
|
||||
},
|
||||
}
|
||||
|
||||
function kwdOp(cxt: KeywordErrorCxt): KwdOp {
|
||||
const keyword = cxt.keyword as LimitKwd
|
||||
const opsIdx = cxt.parentSchema?.[KWDs[keyword].exclusive] ? 1 : 0
|
||||
return KWDs[keyword].ops[opsIdx]
|
||||
}
|
||||
|
||||
export default def
|
||||
26
node_modules/ajv-draft-04/src/vocabulary/validation/limitNumberExclusive.ts
generated
vendored
Normal file
26
node_modules/ajv-draft-04/src/vocabulary/validation/limitNumberExclusive.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import type {
|
||||
CodeKeywordDefinition,
|
||||
// ErrorObject,
|
||||
KeywordCxt,
|
||||
// KeywordErrorDefinition,
|
||||
} from "ajv/dist/core"
|
||||
import {LimitKwd, ExclusiveLimitKwd} from "./limitNumber"
|
||||
|
||||
const KWDs: {[K in ExclusiveLimitKwd]: LimitKwd} = {
|
||||
exclusiveMaximum: "maximum",
|
||||
exclusiveMinimum: "minimum",
|
||||
}
|
||||
|
||||
const def: CodeKeywordDefinition = {
|
||||
keyword: Object.keys(KWDs),
|
||||
type: "number",
|
||||
schemaType: "boolean",
|
||||
code({keyword, parentSchema}: KeywordCxt) {
|
||||
const limitKwd = KWDs[keyword as ExclusiveLimitKwd]
|
||||
if (parentSchema[limitKwd] === undefined) {
|
||||
throw new Error(`${keyword} can only be used with ${limitKwd}`)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
export default def
|
||||
Reference in New Issue
Block a user