aboutsummaryrefslogtreecommitdiff
path: root/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator
diff options
context:
space:
mode:
authorDanijel Andjelkovic <adanijel99@gmail.com>2022-03-01 20:21:29 +0000
committerDanijel Andjelkovic <adanijel99@gmail.com>2022-03-01 20:21:29 +0000
commit61cb1570a3410c85a4489b97c172e3a50715f36c (patch)
tree8fe4a5b77ea54bba80abc817ce2c9ef0e79e7e66 /sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator
parent21a53d349788c99d2007cba91a923db982353b31 (diff)
parenta9ee9e0a500a4a15bd0b5dcaf041f827228ed309 (diff)
Merge branch 'researchML' into 'dev'
Research ml See merge request igrannonica/neuronstellar!6
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator')
-rw-r--r--sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts5
-rw-r--r--sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/index.js100
-rw-r--r--sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/index.js.map1
-rw-r--r--sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts10
-rw-r--r--sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/types.js9
-rw-r--r--sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/types.js.map1
6 files changed, 126 insertions, 0 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts b/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts
new file mode 100644
index 00000000..656b2da5
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts
@@ -0,0 +1,5 @@
+import type { CodeKeywordDefinition } from "../../types";
+import { DiscrError, DiscrErrorObj } from "../discriminator/types";
+export declare type DiscriminatorError = DiscrErrorObj<DiscrError.Tag> | DiscrErrorObj<DiscrError.Mapping>;
+declare const def: CodeKeywordDefinition;
+export default def;
diff --git a/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/index.js b/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/index.js
new file mode 100644
index 00000000..a45d917b
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/index.js
@@ -0,0 +1,100 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+const codegen_1 = require("../../compile/codegen");
+const types_1 = require("../discriminator/types");
+const compile_1 = require("../../compile");
+const util_1 = require("../../compile/util");
+const error = {
+ message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag
+ ? `tag "${tagName}" must be string`
+ : `value of tag "${tagName}" must be in oneOf`,
+ params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._) `{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`,
+};
+const def = {
+ keyword: "discriminator",
+ type: "object",
+ schemaType: "object",
+ error,
+ code(cxt) {
+ const { gen, data, schema, parentSchema, it } = cxt;
+ const { oneOf } = parentSchema;
+ if (!it.opts.discriminator) {
+ throw new Error("discriminator: requires discriminator option");
+ }
+ const tagName = schema.propertyName;
+ if (typeof tagName != "string")
+ throw new Error("discriminator: requires propertyName");
+ if (schema.mapping)
+ throw new Error("discriminator: mapping is not supported");
+ if (!oneOf)
+ throw new Error("discriminator: requires oneOf keyword");
+ const valid = gen.let("valid", false);
+ const tag = gen.const("tag", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(tagName)}`);
+ gen.if((0, codegen_1._) `typeof ${tag} == "string"`, () => validateMapping(), () => cxt.error(false, { discrError: types_1.DiscrError.Tag, tag, tagName }));
+ cxt.ok(valid);
+ function validateMapping() {
+ const mapping = getMapping();
+ gen.if(false);
+ for (const tagValue in mapping) {
+ gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`);
+ gen.assign(valid, applyTagSchema(mapping[tagValue]));
+ }
+ gen.else();
+ cxt.error(false, { discrError: types_1.DiscrError.Mapping, tag, tagName });
+ gen.endIf();
+ }
+ function applyTagSchema(schemaProp) {
+ const _valid = gen.name("valid");
+ const schCxt = cxt.subschema({ keyword: "oneOf", schemaProp }, _valid);
+ cxt.mergeEvaluated(schCxt, codegen_1.Name);
+ return _valid;
+ }
+ function getMapping() {
+ var _a;
+ const oneOfMapping = {};
+ const topRequired = hasRequired(parentSchema);
+ let tagRequired = true;
+ for (let i = 0; i < oneOf.length; i++) {
+ let sch = oneOf[i];
+ if ((sch === null || sch === void 0 ? void 0 : sch.$ref) && !(0, util_1.schemaHasRulesButRef)(sch, it.self.RULES)) {
+ sch = compile_1.resolveRef.call(it.self, it.schemaEnv, it.baseId, sch === null || sch === void 0 ? void 0 : sch.$ref);
+ if (sch instanceof compile_1.SchemaEnv)
+ sch = sch.schema;
+ }
+ const propSch = (_a = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a === void 0 ? void 0 : _a[tagName];
+ if (typeof propSch != "object") {
+ throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`);
+ }
+ tagRequired = tagRequired && (topRequired || hasRequired(sch));
+ addMappings(propSch, i);
+ }
+ if (!tagRequired)
+ throw new Error(`discriminator: "${tagName}" must be required`);
+ return oneOfMapping;
+ function hasRequired({ required }) {
+ return Array.isArray(required) && required.includes(tagName);
+ }
+ function addMappings(sch, i) {
+ if (sch.const) {
+ addMapping(sch.const, i);
+ }
+ else if (sch.enum) {
+ for (const tagValue of sch.enum) {
+ addMapping(tagValue, i);
+ }
+ }
+ else {
+ throw new Error(`discriminator: "properties/${tagName}" must have "const" or "enum"`);
+ }
+ }
+ function addMapping(tagValue, i) {
+ if (typeof tagValue != "string" || tagValue in oneOfMapping) {
+ throw new Error(`discriminator: "${tagName}" values must be unique strings`);
+ }
+ oneOfMapping[tagValue] = i;
+ }
+ }
+ },
+};
+exports.default = def;
+//# sourceMappingURL=index.js.map \ No newline at end of file
diff --git a/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/index.js.map b/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/index.js.map
new file mode 100644
index 00000000..dddd342b
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/discriminator/index.ts"],"names":[],"mappings":";;AAEA,mDAA0D;AAC1D,kDAAgE;AAChE,2CAAmD;AACnD,6CAAuD;AAIvD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,UAAU,EAAE,OAAO,EAAC,EAAC,EAAE,EAAE,CAC3C,UAAU,KAAK,kBAAU,CAAC,GAAG;QAC3B,CAAC,CAAC,QAAQ,OAAO,kBAAkB;QACnC,CAAC,CAAC,iBAAiB,OAAO,oBAAoB;IAClD,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,UAAU,EAAE,GAAG,EAAE,OAAO,EAAC,EAAC,EAAE,EAAE,CAC/C,IAAA,WAAC,EAAA,WAAW,UAAU,UAAU,OAAO,eAAe,GAAG,GAAG;CAC/D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,eAAe;IACxB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACjD,MAAM,EAAC,KAAK,EAAC,GAAG,YAAY,CAAA;QAC5B,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;SAChE;QACD,MAAM,OAAO,GAAG,MAAM,CAAC,YAAY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ox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts b/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts
new file mode 100644
index 00000000..6cf5ea51
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts
@@ -0,0 +1,10 @@
+import type { ErrorObject } from "../../types";
+export declare enum DiscrError {
+ Tag = "tag",
+ Mapping = "mapping"
+}
+export declare type DiscrErrorObj<E extends DiscrError> = ErrorObject<"discriminator", {
+ error: E;
+ tag: string;
+ tagValue: unknown;
+}, string>;
diff --git a/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/types.js b/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/types.js
new file mode 100644
index 00000000..d538f0ce
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/types.js
@@ -0,0 +1,9 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.DiscrError = void 0;
+var DiscrError;
+(function (DiscrError) {
+ DiscrError["Tag"] = "tag";
+ DiscrError["Mapping"] = "mapping";
+})(DiscrError = exports.DiscrError || (exports.DiscrError = {}));
+//# sourceMappingURL=types.js.map \ No newline at end of file
diff --git a/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/types.js.map b/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/types.js.map
new file mode 100644
index 00000000..4908a4e9
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/ajv/dist/vocabularies/discriminator/types.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/vocabularies/discriminator/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,iCAAmB,CAAA;AACrB,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB"} \ No newline at end of file