@scalar/openapi-parser 0.7.1 → 0.8.1
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/CHANGELOG.md +26 -0
- package/LICENSE +1 -1
- package/README.md +193 -24
- package/dist/{configuration.d.ts → configuration/index.d.ts} +9 -7
- package/dist/configuration/index.d.ts.map +1 -0
- package/dist/configuration/index.js +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/Validator/Validator.d.ts +6 -8
- package/dist/lib/Validator/Validator.d.ts.map +1 -0
- package/dist/lib/Validator/Validator.js +1 -0
- package/dist/lib/Validator/index.d.ts +3 -0
- package/dist/lib/Validator/index.d.ts.map +1 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/polyfills/index.d.ts +2 -0
- package/dist/polyfills/index.d.ts.map +1 -0
- package/dist/polyfills/path.d.ts +24 -0
- package/dist/polyfills/path.d.ts.map +1 -0
- package/dist/polyfills/path.js +1 -0
- package/dist/schemas/v2.0/schema.json.js +1 -1623
- package/dist/schemas/v3.0/schema.json.js +1 -1673
- package/dist/schemas/v3.1/schema.json.js +1 -1452
- package/dist/types/index.d.ts +24 -18
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/betterAjvErrors/helpers.d.ts +7 -0
- package/dist/utils/betterAjvErrors/helpers.d.ts.map +1 -0
- package/dist/utils/betterAjvErrors/helpers.js +1 -0
- package/dist/utils/betterAjvErrors/index.d.ts +17 -0
- package/dist/utils/betterAjvErrors/index.d.ts.map +1 -0
- package/dist/utils/betterAjvErrors/index.js +1 -0
- package/dist/utils/betterAjvErrors/utils.js +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/additional-prop.js +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/base.js +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/default.js +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/enum.js +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/pattern.js +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/required.js +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/unevaluated-prop.js +1 -0
- package/dist/utils/dereference.d.ts +3 -5
- package/dist/utils/dereference.d.ts.map +1 -0
- package/dist/utils/dereference.js +1 -0
- package/dist/utils/details.d.ts +3 -5
- package/dist/utils/details.d.ts.map +1 -0
- package/dist/utils/details.js +1 -0
- package/dist/utils/escapeJsonPointer.d.ts +2 -3
- package/dist/utils/escapeJsonPointer.d.ts.map +1 -0
- package/dist/utils/escapeJsonPointer.js +1 -0
- package/dist/utils/filter.d.ts +3 -5
- package/dist/utils/filter.d.ts.map +1 -0
- package/dist/utils/filter.js +1 -0
- package/dist/utils/getEntrypoint.d.ts +3 -5
- package/dist/utils/getEntrypoint.d.ts.map +1 -0
- package/dist/utils/getEntrypoint.js +1 -0
- package/dist/utils/getListOfReferences.d.ts +3 -5
- package/dist/utils/getListOfReferences.d.ts.map +1 -0
- package/dist/utils/getListOfReferences.js +1 -0
- package/dist/utils/getSegmentsFromPath.d.ts +2 -3
- package/dist/utils/getSegmentsFromPath.d.ts.map +1 -0
- package/dist/utils/getSegmentsFromPath.js +1 -0
- package/dist/utils/index.d.ts +26 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/isFilesystem.d.ts +2 -3
- package/dist/utils/isFilesystem.d.ts.map +1 -0
- package/dist/utils/isFilesystem.js +1 -0
- package/dist/utils/isJson.d.ts +2 -3
- package/dist/utils/isJson.d.ts.map +1 -0
- package/dist/utils/isJson.js +1 -0
- package/dist/utils/isObject.d.ts +2 -3
- package/dist/utils/isObject.d.ts.map +1 -0
- package/dist/utils/isObject.js +1 -0
- package/dist/utils/isYaml.d.ts +2 -3
- package/dist/utils/isYaml.d.ts.map +1 -0
- package/dist/utils/isYaml.js +1 -0
- package/dist/utils/load/index.d.ts +2 -0
- package/dist/utils/load/index.d.ts.map +1 -0
- package/dist/utils/load/load.d.ts +5 -7
- package/dist/utils/load/load.d.ts.map +1 -0
- package/dist/utils/load/load.js +1 -0
- package/dist/{src/utils → utils}/load/plugins/fetchUrls.d.ts +4 -6
- package/dist/utils/load/plugins/fetchUrls.d.ts.map +1 -0
- package/dist/utils/load/plugins/fetchUrls.js +1 -0
- package/dist/utils/load/plugins/readFiles.d.ts +3 -0
- package/dist/utils/load/plugins/readFiles.d.ts.map +1 -0
- package/dist/utils/load/plugins/readFiles.js +1 -0
- package/dist/utils/makeFilesystem.d.ts +3 -0
- package/dist/utils/makeFilesystem.d.ts.map +1 -0
- package/dist/utils/makeFilesystem.js +1 -0
- package/dist/utils/normalize.d.ts +3 -5
- package/dist/utils/normalize.d.ts.map +1 -0
- package/dist/utils/normalize.js +1 -0
- package/dist/utils/openapi.d.ts +183 -0
- package/dist/utils/openapi.d.ts.map +1 -0
- package/dist/utils/openapi.js +1 -0
- package/dist/utils/resolveReferences.d.ts +5 -7
- package/dist/utils/resolveReferences.d.ts.map +1 -0
- package/dist/utils/resolveReferences.js +1 -0
- package/dist/utils/toJson.d.ts +3 -5
- package/dist/utils/toJson.d.ts.map +1 -0
- package/dist/utils/toJson.js +1 -0
- package/dist/utils/toYaml.d.ts +3 -5
- package/dist/utils/toYaml.d.ts.map +1 -0
- package/dist/utils/toYaml.js +1 -0
- package/dist/utils/transformErrors.d.ts +3 -5
- package/dist/utils/transformErrors.d.ts.map +1 -0
- package/dist/utils/transformErrors.js +1 -0
- package/dist/utils/traverse.d.ts +3 -5
- package/dist/utils/traverse.d.ts.map +1 -0
- package/dist/utils/traverse.js +1 -0
- package/dist/utils/unescapeJsonPointer.d.ts +2 -3
- package/dist/utils/unescapeJsonPointer.d.ts.map +1 -0
- package/dist/utils/unescapeJsonPointer.js +1 -0
- package/dist/utils/upgrade.d.ts +4 -5
- package/dist/utils/upgrade.d.ts.map +1 -0
- package/dist/utils/upgrade.js +1 -0
- package/dist/utils/upgrade.test-d.d.ts +2 -0
- package/dist/utils/upgrade.test-d.d.ts.map +1 -0
- package/dist/utils/upgradeFromThreeToThreeOne.d.ts +3 -5
- package/dist/utils/upgradeFromThreeToThreeOne.d.ts.map +1 -0
- package/dist/utils/upgradeFromThreeToThreeOne.js +1 -0
- package/dist/utils/upgradeFromTwoToThree.d.ts +3 -5
- package/dist/utils/upgradeFromTwoToThree.d.ts.map +1 -0
- package/dist/utils/upgradeFromTwoToThree.js +1 -0
- package/dist/utils/validate.d.ts +3 -5
- package/dist/utils/validate.d.ts.map +1 -0
- package/dist/utils/validate.js +1 -0
- package/dist/utils/workThroughQueue.d.ts +11 -0
- package/dist/utils/workThroughQueue.d.ts.map +1 -0
- package/dist/utils/workThroughQueue.js +1 -0
- package/package.json +44 -36
- package/dist/pipeline.d.ts +0 -388
- package/dist/src/configuration.js +0 -22
- package/dist/src/index.d.ts +0 -27
- package/dist/src/index.js +0 -25
- package/dist/src/lib/Validator/Validator.js +0 -94
- package/dist/src/pipeline.js +0 -121
- package/dist/src/polyfills/path.js +0 -80
- package/dist/src/utils/betterAjvErrors/helpers.js +0 -89
- package/dist/src/utils/betterAjvErrors/index.js +0 -15
- package/dist/src/utils/betterAjvErrors/utils.js +0 -17
- package/dist/src/utils/betterAjvErrors/validation-errors/additional-prop.js +0 -18
- package/dist/src/utils/betterAjvErrors/validation-errors/base.js +0 -23
- package/dist/src/utils/betterAjvErrors/validation-errors/default.js +0 -18
- package/dist/src/utils/betterAjvErrors/validation-errors/enum.js +0 -41
- package/dist/src/utils/betterAjvErrors/validation-errors/pattern.js +0 -18
- package/dist/src/utils/betterAjvErrors/validation-errors/required.js +0 -17
- package/dist/src/utils/betterAjvErrors/validation-errors/unevaluated-prop.js +0 -18
- package/dist/src/utils/dereference.js +0 -18
- package/dist/src/utils/details.js +0 -22
- package/dist/src/utils/escapeJsonPointer.js +0 -5
- package/dist/src/utils/filter.js +0 -17
- package/dist/src/utils/getEntrypoint.js +0 -5
- package/dist/src/utils/getListOfReferences.js +0 -17
- package/dist/src/utils/getSegmentsFromPath.js +0 -10
- package/dist/src/utils/isFilesystem.js +0 -5
- package/dist/src/utils/isJson.js +0 -10
- package/dist/src/utils/isObject.js +0 -3
- package/dist/src/utils/isYaml.js +0 -17
- package/dist/src/utils/load/load.js +0 -59
- package/dist/src/utils/load/plugins/fetchUrls.js +0 -38
- package/dist/src/utils/load/plugins/readFiles.d.ts +0 -5
- package/dist/src/utils/load/plugins/readFiles.js +0 -50
- package/dist/src/utils/makeFilesystem.js +0 -22
- package/dist/src/utils/normalize.js +0 -20
- package/dist/src/utils/resolveReferences.js +0 -106
- package/dist/src/utils/toJson.js +0 -3
- package/dist/src/utils/toYaml.js +0 -5
- package/dist/src/utils/transformErrors.js +0 -19
- package/dist/src/utils/traverse.js +0 -20
- package/dist/src/utils/unescapeJsonPointer.js +0 -5
- package/dist/src/utils/upgrade.js +0 -19
- package/dist/src/utils/upgradeFromThreeToThreeOne.js +0 -70
- package/dist/src/utils/upgradeFromTwoToThree.js +0 -5
- package/dist/src/utils/validate.js +0 -15
- package/dist/src/utils/workThroughQueue.js +0 -24
- package/dist/types/openapi-types.d.ts +0 -747
- package/dist/webpack-stats.json +0 -1
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { getListOfReferences } from './getListOfReferences.js';
|
|
2
|
-
import { isFilesystem } from './isFilesystem.js';
|
|
3
|
-
import { normalize } from './normalize.js';
|
|
4
|
-
|
|
5
|
-
function makeFilesystem(value, overwrites = {}) {
|
|
6
|
-
if (isFilesystem(value)) {
|
|
7
|
-
return value;
|
|
8
|
-
}
|
|
9
|
-
const specification = normalize(value);
|
|
10
|
-
return [
|
|
11
|
-
{
|
|
12
|
-
isEntrypoint: true,
|
|
13
|
-
specification,
|
|
14
|
-
filename: null,
|
|
15
|
-
dir: "./",
|
|
16
|
-
references: getListOfReferences(specification),
|
|
17
|
-
...overwrites
|
|
18
|
-
}
|
|
19
|
-
];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { makeFilesystem };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { parse } from 'yaml';
|
|
2
|
-
import { isFilesystem } from './isFilesystem.js';
|
|
3
|
-
|
|
4
|
-
function normalize(specification) {
|
|
5
|
-
if (isFilesystem(specification)) {
|
|
6
|
-
return specification;
|
|
7
|
-
}
|
|
8
|
-
if (typeof specification === "string") {
|
|
9
|
-
try {
|
|
10
|
-
return JSON.parse(specification);
|
|
11
|
-
} catch (error) {
|
|
12
|
-
return parse(specification, {
|
|
13
|
-
maxAliasCount: 1e4
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return specification;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { normalize };
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { ERRORS } from '../configuration.js';
|
|
2
|
-
import { getEntrypoint } from './getEntrypoint.js';
|
|
3
|
-
import { getSegmentsFromPath } from './getSegmentsFromPath.js';
|
|
4
|
-
import { makeFilesystem } from './makeFilesystem.js';
|
|
5
|
-
|
|
6
|
-
function resolveReferences(input, file, errors) {
|
|
7
|
-
if (errors === void 0) {
|
|
8
|
-
errors = [];
|
|
9
|
-
}
|
|
10
|
-
const clonedInput = structuredClone(input);
|
|
11
|
-
const filesystem = makeFilesystem(clonedInput);
|
|
12
|
-
const entrypoint = getEntrypoint(filesystem);
|
|
13
|
-
resolve(
|
|
14
|
-
file?.specification ?? entrypoint.specification,
|
|
15
|
-
filesystem,
|
|
16
|
-
file ?? entrypoint
|
|
17
|
-
);
|
|
18
|
-
resolve(
|
|
19
|
-
file?.specification ?? entrypoint.specification,
|
|
20
|
-
filesystem,
|
|
21
|
-
file ?? entrypoint
|
|
22
|
-
);
|
|
23
|
-
errors = errors.filter(
|
|
24
|
-
(error, index, self) => index === self.findIndex(
|
|
25
|
-
(t) => t.message === error.message && t.code === error.code
|
|
26
|
-
)
|
|
27
|
-
);
|
|
28
|
-
return {
|
|
29
|
-
valid: errors.length === 0,
|
|
30
|
-
errors,
|
|
31
|
-
schema: (file ?? getEntrypoint(filesystem)).specification
|
|
32
|
-
};
|
|
33
|
-
function resolve(schema, filesystem2, file2) {
|
|
34
|
-
let result;
|
|
35
|
-
Object.entries(schema ?? {}).forEach(([_, value]) => {
|
|
36
|
-
if (schema.$ref !== void 0) {
|
|
37
|
-
const target = resolveUri(schema.$ref, file2, filesystem2, errors);
|
|
38
|
-
if (target === void 0) {
|
|
39
|
-
return void 0;
|
|
40
|
-
}
|
|
41
|
-
delete schema.$ref;
|
|
42
|
-
if (typeof target === "object") {
|
|
43
|
-
Object.keys(target).forEach((key) => {
|
|
44
|
-
if (schema[key] === void 0) {
|
|
45
|
-
schema[key] = target[key];
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (typeof value === "object" && !isCircular(value)) {
|
|
51
|
-
result = resolve(value, filesystem2, file2);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
return {
|
|
55
|
-
errors: result?.errors ?? []
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function isCircular(schema) {
|
|
60
|
-
try {
|
|
61
|
-
JSON.stringify(schema);
|
|
62
|
-
return false;
|
|
63
|
-
} catch (error) {
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function resolveUri(uri, file, filesystem, errors) {
|
|
68
|
-
if (typeof uri !== "string") {
|
|
69
|
-
errors.push({
|
|
70
|
-
code: "INVALID_REFERENCE",
|
|
71
|
-
message: ERRORS.INVALID_REFERENCE.replace("%s", uri)
|
|
72
|
-
});
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
const [prefix, path] = uri.split("#", 2);
|
|
76
|
-
if (prefix) {
|
|
77
|
-
const externalReference = filesystem.find((entry) => {
|
|
78
|
-
return entry.filename === prefix;
|
|
79
|
-
});
|
|
80
|
-
if (!externalReference) {
|
|
81
|
-
errors.push({
|
|
82
|
-
code: "EXTERNAL_REFERENCE_NOT_FOUND",
|
|
83
|
-
message: ERRORS.EXTERNAL_REFERENCE_NOT_FOUND.replace("%s", prefix)
|
|
84
|
-
});
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
const result = resolveReferences(filesystem, externalReference, errors);
|
|
88
|
-
if (path === void 0) {
|
|
89
|
-
return result.schema;
|
|
90
|
-
}
|
|
91
|
-
return resolveUri(`#${path}`, externalReference, filesystem, errors);
|
|
92
|
-
}
|
|
93
|
-
const segments = getSegmentsFromPath(path);
|
|
94
|
-
try {
|
|
95
|
-
return segments.reduce((acc, key) => {
|
|
96
|
-
return acc[key];
|
|
97
|
-
}, file.specification);
|
|
98
|
-
} catch (error) {
|
|
99
|
-
errors.push({
|
|
100
|
-
code: "INVALID_REFERENCE",
|
|
101
|
-
message: ERRORS.INVALID_REFERENCE.replace("%s", uri)
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export { resolveReferences };
|
package/dist/src/utils/toJson.js
DELETED
package/dist/src/utils/toYaml.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { betterAjvErrors } from './betterAjvErrors/index.js';
|
|
2
|
-
|
|
3
|
-
function transformErrors(specification, errors) {
|
|
4
|
-
if (typeof errors === "string") {
|
|
5
|
-
return [
|
|
6
|
-
{
|
|
7
|
-
message: errors
|
|
8
|
-
}
|
|
9
|
-
];
|
|
10
|
-
}
|
|
11
|
-
return betterAjvErrors(specification, null, errors, {
|
|
12
|
-
indent: 2
|
|
13
|
-
}).map((error) => {
|
|
14
|
-
error.message = error.message.trim();
|
|
15
|
-
return error;
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { transformErrors };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
function traverse(specification, transform) {
|
|
2
|
-
const result = {};
|
|
3
|
-
for (const [key, value] of Object.entries(specification)) {
|
|
4
|
-
if (Array.isArray(value)) {
|
|
5
|
-
result[key] = value.map((item) => {
|
|
6
|
-
if (typeof item === "object" && item !== null) {
|
|
7
|
-
return traverse(item, transform);
|
|
8
|
-
}
|
|
9
|
-
return item;
|
|
10
|
-
});
|
|
11
|
-
} else if (typeof value === "object" && value !== null) {
|
|
12
|
-
result[key] = traverse(value, transform);
|
|
13
|
-
} else {
|
|
14
|
-
result[key] = value;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return transform(result);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { traverse };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { getEntrypoint } from './getEntrypoint.js';
|
|
2
|
-
import { makeFilesystem } from './makeFilesystem.js';
|
|
3
|
-
import { upgradeFromThreeToThreeOne } from './upgradeFromThreeToThreeOne.js';
|
|
4
|
-
import { upgradeFromTwoToThree } from './upgradeFromTwoToThree.js';
|
|
5
|
-
|
|
6
|
-
function upgrade(specification, _options) {
|
|
7
|
-
const upgraders = [upgradeFromTwoToThree, upgradeFromThreeToThreeOne];
|
|
8
|
-
const result = upgraders.reduce(
|
|
9
|
-
(specification2, upgrader) => upgrader(specification2),
|
|
10
|
-
getEntrypoint(makeFilesystem(specification)).specification
|
|
11
|
-
);
|
|
12
|
-
return {
|
|
13
|
-
specification: result,
|
|
14
|
-
// TODO: Make dynamic
|
|
15
|
-
version: "3.1"
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { upgrade };
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { traverse } from './traverse.js';
|
|
2
|
-
|
|
3
|
-
function upgradeFromThreeToThreeOne(specification) {
|
|
4
|
-
if (specification.openapi?.startsWith("3.0")) {
|
|
5
|
-
specification.openapi = "3.1.0";
|
|
6
|
-
} else {
|
|
7
|
-
return specification;
|
|
8
|
-
}
|
|
9
|
-
specification = traverse(specification, (schema) => {
|
|
10
|
-
if (schema.type !== "undefined" && schema.nullable === true) {
|
|
11
|
-
schema.type = ["null", schema.type];
|
|
12
|
-
delete schema.nullable;
|
|
13
|
-
}
|
|
14
|
-
return schema;
|
|
15
|
-
});
|
|
16
|
-
specification = traverse(specification, (schema) => {
|
|
17
|
-
if (schema.exclusiveMinimum === true) {
|
|
18
|
-
schema.exclusiveMinimum = schema.minimum;
|
|
19
|
-
delete schema.minimum;
|
|
20
|
-
} else if (schema.exclusiveMinimum === false) {
|
|
21
|
-
delete schema.exclusiveMinimum;
|
|
22
|
-
}
|
|
23
|
-
if (schema.exclusiveMaximum === true) {
|
|
24
|
-
schema.exclusiveMaximum = schema.maximum;
|
|
25
|
-
delete schema.maximum;
|
|
26
|
-
} else if (schema.exclusiveMaximum === false) {
|
|
27
|
-
delete schema.exclusiveMaximum;
|
|
28
|
-
}
|
|
29
|
-
return schema;
|
|
30
|
-
});
|
|
31
|
-
specification = traverse(specification, (schema) => {
|
|
32
|
-
if (schema.example !== void 0) {
|
|
33
|
-
schema.examples = {
|
|
34
|
-
default: schema.example
|
|
35
|
-
};
|
|
36
|
-
delete schema.example;
|
|
37
|
-
}
|
|
38
|
-
return schema;
|
|
39
|
-
});
|
|
40
|
-
specification = traverse(specification, (schema) => {
|
|
41
|
-
if (schema.type === "object" && schema.properties !== void 0) {
|
|
42
|
-
const entries = Object.entries(schema.properties);
|
|
43
|
-
for (const [_, value] of entries) {
|
|
44
|
-
if (typeof value === "object" && value.type === "string" && value.format === "binary") {
|
|
45
|
-
value.contentEncoding = "application/octet-stream";
|
|
46
|
-
delete value.format;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return schema;
|
|
51
|
-
});
|
|
52
|
-
specification = traverse(specification, (schema) => {
|
|
53
|
-
if (schema.type === "string" && schema.format === "binary") {
|
|
54
|
-
return void 0;
|
|
55
|
-
}
|
|
56
|
-
return schema;
|
|
57
|
-
});
|
|
58
|
-
specification = traverse(specification, (schema) => {
|
|
59
|
-
if (schema.type === "string" && schema.format === "base64") {
|
|
60
|
-
return {
|
|
61
|
-
type: "string",
|
|
62
|
-
contentEncoding: "base64"
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
return schema;
|
|
66
|
-
});
|
|
67
|
-
return specification;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export { upgradeFromThreeToThreeOne };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { makeFilesystem } from './makeFilesystem.js';
|
|
2
|
-
import { Validator } from '../lib/Validator/Validator.js';
|
|
3
|
-
|
|
4
|
-
async function validate(value) {
|
|
5
|
-
const filesystem = makeFilesystem(value);
|
|
6
|
-
const validator = new Validator();
|
|
7
|
-
const result = await validator.validate(filesystem);
|
|
8
|
-
return {
|
|
9
|
-
...result,
|
|
10
|
-
specification: validator.specification,
|
|
11
|
-
version: validator.version
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { validate };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
async function workThroughQueue(queue) {
|
|
2
|
-
let specification = queue.specification;
|
|
3
|
-
let result;
|
|
4
|
-
for (const { action, options } of queue.tasks) {
|
|
5
|
-
if (typeof action !== "function") {
|
|
6
|
-
console.warn("[queue] The given action is not a function:", action);
|
|
7
|
-
continue;
|
|
8
|
-
}
|
|
9
|
-
if (action.constructor.name === "AsyncFunction") {
|
|
10
|
-
result = {
|
|
11
|
-
...result,
|
|
12
|
-
...await action(result?.filesystem ?? specification, options)
|
|
13
|
-
};
|
|
14
|
-
} else {
|
|
15
|
-
result = {
|
|
16
|
-
...result,
|
|
17
|
-
...action(result?.filesystem ?? specification, options)
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { workThroughQueue };
|