@base44-preview/cli 0.0.31-pr.241.c74aebb → 0.0.31-pr.242.7d2e6b5
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/cli/index.js +975 -548
- package/dist/cli/index.js.map +14 -7
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -9653,12 +9653,12 @@ var require_schema = __commonJS((exports, module) => {
|
|
|
9653
9653
|
var common = require_common3();
|
|
9654
9654
|
var YAMLException = require_exception();
|
|
9655
9655
|
var Type = require_type();
|
|
9656
|
-
function compileList(
|
|
9656
|
+
function compileList(schema5, name2, result) {
|
|
9657
9657
|
var exclude = [];
|
|
9658
|
-
|
|
9658
|
+
schema5.include.forEach(function(includedSchema) {
|
|
9659
9659
|
result = compileList(includedSchema, name2, result);
|
|
9660
9660
|
});
|
|
9661
|
-
|
|
9661
|
+
schema5[name2].forEach(function(currentType) {
|
|
9662
9662
|
result.forEach(function(previousType, previousIndex) {
|
|
9663
9663
|
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
|
|
9664
9664
|
exclude.push(previousIndex);
|
|
@@ -9715,8 +9715,8 @@ var require_schema = __commonJS((exports, module) => {
|
|
|
9715
9715
|
}
|
|
9716
9716
|
schemas3 = common.toArray(schemas3);
|
|
9717
9717
|
types = common.toArray(types);
|
|
9718
|
-
if (!schemas3.every(function(
|
|
9719
|
-
return
|
|
9718
|
+
if (!schemas3.every(function(schema5) {
|
|
9719
|
+
return schema5 instanceof Schema;
|
|
9720
9720
|
})) {
|
|
9721
9721
|
throw new YAMLException("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");
|
|
9722
9722
|
}
|
|
@@ -11737,7 +11737,7 @@ var require_dumper = __commonJS((exports, module) => {
|
|
|
11737
11737
|
"Off",
|
|
11738
11738
|
"OFF"
|
|
11739
11739
|
];
|
|
11740
|
-
function compileStyleMap(
|
|
11740
|
+
function compileStyleMap(schema5, map2) {
|
|
11741
11741
|
var result, keys, index, length, tag, style, type;
|
|
11742
11742
|
if (map2 === null)
|
|
11743
11743
|
return {};
|
|
@@ -11749,7 +11749,7 @@ var require_dumper = __commonJS((exports, module) => {
|
|
|
11749
11749
|
if (tag.slice(0, 2) === "!!") {
|
|
11750
11750
|
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
11751
11751
|
}
|
|
11752
|
-
type =
|
|
11752
|
+
type = schema5.compiledTypeMap["fallback"][tag];
|
|
11753
11753
|
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
|
11754
11754
|
style = type.styleAliases[style];
|
|
11755
11755
|
}
|
|
@@ -108409,11 +108409,11 @@ function chooseDescription(descriptions, printWidth) {
|
|
|
108409
108409
|
return firstWidth > printWidth && firstWidth > secondWidth ? secondDescription : firstDescription;
|
|
108410
108410
|
}
|
|
108411
108411
|
function createSchema(SchemaConstructor, parameters) {
|
|
108412
|
-
const
|
|
108413
|
-
const subSchema = Object.create(
|
|
108412
|
+
const schema8 = new SchemaConstructor(parameters);
|
|
108413
|
+
const subSchema = Object.create(schema8);
|
|
108414
108414
|
for (const handlerKey of HANDLER_KEYS) {
|
|
108415
108415
|
if (handlerKey in parameters) {
|
|
108416
|
-
subSchema[handlerKey] = normalizeHandler(parameters[handlerKey],
|
|
108416
|
+
subSchema[handlerKey] = normalizeHandler(parameters[handlerKey], schema8, Schema.prototype[handlerKey].length);
|
|
108417
108417
|
}
|
|
108418
108418
|
}
|
|
108419
108419
|
return subSchema;
|
|
@@ -108670,8 +108670,8 @@ async function loadEditorconfigInternal(file2, { shouldCache }) {
|
|
|
108670
108670
|
const directory = path52.dirname(file2);
|
|
108671
108671
|
const root2 = await findProjectRoot2(directory, { shouldCache });
|
|
108672
108672
|
const editorConfig = await import_editorconfig.default.parse(file2, { root: root2 });
|
|
108673
|
-
const
|
|
108674
|
-
return
|
|
108673
|
+
const config10 = editorconfig_to_prettier_default(editorConfig);
|
|
108674
|
+
return config10;
|
|
108675
108675
|
}
|
|
108676
108676
|
function loadEditorconfig(file2, { shouldCache }) {
|
|
108677
108677
|
file2 = path52.resolve(file2);
|
|
@@ -108855,7 +108855,7 @@ function unicodeEscape() {
|
|
|
108855
108855
|
}
|
|
108856
108856
|
return String.fromCodePoint(parseInt(buffer2, 16));
|
|
108857
108857
|
}
|
|
108858
|
-
function
|
|
108858
|
+
function push3() {
|
|
108859
108859
|
let value;
|
|
108860
108860
|
switch (token.type) {
|
|
108861
108861
|
case "punctuator":
|
|
@@ -110661,18 +110661,18 @@ async function loadConfig(configFile) {
|
|
|
110661
110661
|
if (!load2) {
|
|
110662
110662
|
throw new Error(`No loader specified for extension "${extension || "noExt"}"`);
|
|
110663
110663
|
}
|
|
110664
|
-
let
|
|
110665
|
-
if (!
|
|
110664
|
+
let config10 = await load2(configFile);
|
|
110665
|
+
if (!config10) {
|
|
110666
110666
|
return;
|
|
110667
110667
|
}
|
|
110668
|
-
if (typeof
|
|
110669
|
-
|
|
110668
|
+
if (typeof config10 === "string") {
|
|
110669
|
+
config10 = await load_external_config_default(config10, configFile);
|
|
110670
110670
|
}
|
|
110671
|
-
if (typeof
|
|
110672
|
-
throw new TypeError(`Config is only allowed to be an object, but received ${typeof
|
|
110671
|
+
if (typeof config10 !== "object") {
|
|
110672
|
+
throw new TypeError(`Config is only allowed to be an object, but received ${typeof config10} in "${configFile}"`);
|
|
110673
110673
|
}
|
|
110674
|
-
delete
|
|
110675
|
-
return
|
|
110674
|
+
delete config10.$schema;
|
|
110675
|
+
return config10;
|
|
110676
110676
|
}
|
|
110677
110677
|
function clearPrettierConfigCache() {
|
|
110678
110678
|
loadCache.clear();
|
|
@@ -110722,8 +110722,8 @@ async function loadPrettierConfig2(file2, options8) {
|
|
|
110722
110722
|
return;
|
|
110723
110723
|
}
|
|
110724
110724
|
configFile = toPath3(configFile);
|
|
110725
|
-
const
|
|
110726
|
-
return { config:
|
|
110725
|
+
const config10 = await loadPrettierConfig(configFile, { shouldCache });
|
|
110726
|
+
return { config: config10, configFile };
|
|
110727
110727
|
}
|
|
110728
110728
|
async function resolveConfig(fileUrlOrPath, options8) {
|
|
110729
110729
|
options8 = { useCache: true, ...options8 };
|
|
@@ -110750,8 +110750,8 @@ async function resolveConfigFile(fileUrlOrPath) {
|
|
|
110750
110750
|
return result ?? null;
|
|
110751
110751
|
}
|
|
110752
110752
|
function mergeOverrides(configResult, filePath) {
|
|
110753
|
-
const { config:
|
|
110754
|
-
const { overrides, ...options8 } =
|
|
110753
|
+
const { config: config10, configFile } = configResult || {};
|
|
110754
|
+
const { overrides, ...options8 } = config10 || {};
|
|
110755
110755
|
if (filePath && overrides) {
|
|
110756
110756
|
const relativeFilePath = path102.relative(path102.dirname(configFile), filePath);
|
|
110757
110757
|
for (const override of overrides) {
|
|
@@ -111753,9 +111753,9 @@ function optionInfoToSchema(optionInfo, {
|
|
|
111753
111753
|
throw new Error(`Unexpected type ${optionInfo.type}`);
|
|
111754
111754
|
}
|
|
111755
111755
|
if (optionInfo.exception) {
|
|
111756
|
-
parameters.validate = (value,
|
|
111756
|
+
parameters.validate = (value, schema8, utils3) => optionInfo.exception(value) || schema8.validate(value, utils3);
|
|
111757
111757
|
} else {
|
|
111758
|
-
parameters.validate = (value,
|
|
111758
|
+
parameters.validate = (value, schema8, utils3) => value === undefined || schema8.validate(value, utils3);
|
|
111759
111759
|
}
|
|
111760
111760
|
if (optionInfo.redirect) {
|
|
111761
111761
|
handlers.redirect = (value) => !value ? undefined : {
|
|
@@ -111770,7 +111770,7 @@ function optionInfoToSchema(optionInfo, {
|
|
|
111770
111770
|
}
|
|
111771
111771
|
if (isCLI && !optionInfo.array) {
|
|
111772
111772
|
const originalPreprocess = parameters.preprocess || ((x9) => x9);
|
|
111773
|
-
parameters.preprocess = (value,
|
|
111773
|
+
parameters.preprocess = (value, schema8, utils3) => schema8.preprocess(originalPreprocess(Array.isArray(value) ? method_at_default2(0, value, -1) : value), utils3);
|
|
111774
111774
|
}
|
|
111775
111775
|
return optionInfo.array ? ArraySchema.create({
|
|
111776
111776
|
...isCLI ? {
|
|
@@ -112860,16 +112860,16 @@ async function getFileInfo(file2, options8 = {}) {
|
|
|
112860
112860
|
};
|
|
112861
112861
|
}
|
|
112862
112862
|
async function getParser(file2, options8) {
|
|
112863
|
-
let
|
|
112863
|
+
let config10;
|
|
112864
112864
|
if (options8.resolveConfig !== false) {
|
|
112865
|
-
|
|
112865
|
+
config10 = await resolveConfig(file2, {
|
|
112866
112866
|
editorconfig: false
|
|
112867
112867
|
});
|
|
112868
112868
|
}
|
|
112869
|
-
if (
|
|
112870
|
-
return
|
|
112869
|
+
if (config10?.parser) {
|
|
112870
|
+
return config10.parser;
|
|
112871
112871
|
}
|
|
112872
|
-
let plugins = options8.plugins ??
|
|
112872
|
+
let plugins = options8.plugins ?? config10?.plugins ?? [];
|
|
112873
112873
|
plugins = (await Promise.all([load_builtin_plugins_default(), load_plugins_default(plugins)])).flat();
|
|
112874
112874
|
return infer_parser_default({ plugins }, { physicalFile: file2 });
|
|
112875
112875
|
}
|
|
@@ -113347,9 +113347,9 @@ var require2, __filename2, __dirname4, __create2, __defProp3, __getOwnPropDesc,
|
|
|
113347
113347
|
};
|
|
113348
113348
|
applyNormalization();
|
|
113349
113349
|
for (const key2 of Object.keys(this._utils.schemas)) {
|
|
113350
|
-
const
|
|
113350
|
+
const schema8 = this._utils.schemas[key2];
|
|
113351
113351
|
if (!(key2 in newOptions)) {
|
|
113352
|
-
const defaultResult = normalizeDefaultResult(
|
|
113352
|
+
const defaultResult = normalizeDefaultResult(schema8.default(this._utils));
|
|
113353
113353
|
if ("value" in defaultResult) {
|
|
113354
113354
|
restOptionsArray.push({ [key2]: defaultResult.value });
|
|
113355
113355
|
}
|
|
@@ -113360,13 +113360,13 @@ var require2, __filename2, __dirname4, __create2, __defProp3, __getOwnPropDesc,
|
|
|
113360
113360
|
if (!(key2 in newOptions)) {
|
|
113361
113361
|
continue;
|
|
113362
113362
|
}
|
|
113363
|
-
const
|
|
113363
|
+
const schema8 = this._utils.schemas[key2];
|
|
113364
113364
|
const value = newOptions[key2];
|
|
113365
|
-
const newValue =
|
|
113365
|
+
const newValue = schema8.postprocess(value, this._utils);
|
|
113366
113366
|
if (newValue === VALUE_UNCHANGED) {
|
|
113367
113367
|
continue;
|
|
113368
113368
|
}
|
|
113369
|
-
this._applyValidation(newValue, key2,
|
|
113369
|
+
this._applyValidation(newValue, key2, schema8);
|
|
113370
113370
|
newOptions[key2] = newValue;
|
|
113371
113371
|
}
|
|
113372
113372
|
this._applyPostprocess(newOptions);
|
|
@@ -113377,14 +113377,14 @@ var require2, __filename2, __dirname4, __create2, __defProp3, __getOwnPropDesc,
|
|
|
113377
113377
|
const transferredOptionsArray = [];
|
|
113378
113378
|
const { knownKeys, unknownKeys } = this._partitionOptionKeys(options8);
|
|
113379
113379
|
for (const key2 of knownKeys) {
|
|
113380
|
-
const
|
|
113381
|
-
const value =
|
|
113382
|
-
this._applyValidation(value, key2,
|
|
113380
|
+
const schema8 = this._utils.schemas[key2];
|
|
113381
|
+
const value = schema8.preprocess(options8[key2], this._utils);
|
|
113382
|
+
this._applyValidation(value, key2, schema8);
|
|
113383
113383
|
const appendTransferredOptions = ({ from, to: to5 }) => {
|
|
113384
113384
|
transferredOptionsArray.push(typeof to5 === "string" ? { [to5]: from } : { [to5.key]: to5.value });
|
|
113385
113385
|
};
|
|
113386
113386
|
const warnDeprecated = ({ value: currentValue, redirectTo }) => {
|
|
113387
|
-
const deprecatedResult = normalizeDeprecatedResult(
|
|
113387
|
+
const deprecatedResult = normalizeDeprecatedResult(schema8.deprecated(currentValue, this._utils), value, true);
|
|
113388
113388
|
if (deprecatedResult === false) {
|
|
113389
113389
|
return;
|
|
113390
113390
|
}
|
|
@@ -113402,13 +113402,13 @@ var require2, __filename2, __dirname4, __create2, __defProp3, __getOwnPropDesc,
|
|
|
113402
113402
|
}
|
|
113403
113403
|
}
|
|
113404
113404
|
};
|
|
113405
|
-
const forwardResult = normalizeForwardResult(
|
|
113405
|
+
const forwardResult = normalizeForwardResult(schema8.forward(value, this._utils), value);
|
|
113406
113406
|
forwardResult.forEach(appendTransferredOptions);
|
|
113407
|
-
const redirectResult = normalizeRedirectResult(
|
|
113407
|
+
const redirectResult = normalizeRedirectResult(schema8.redirect(value, this._utils), value);
|
|
113408
113408
|
redirectResult.redirect.forEach(appendTransferredOptions);
|
|
113409
113409
|
if ("remain" in redirectResult) {
|
|
113410
113410
|
const remainingValue = redirectResult.remain;
|
|
113411
|
-
newOptions[key2] = key2 in newOptions ?
|
|
113411
|
+
newOptions[key2] = key2 in newOptions ? schema8.overlap(newOptions[key2], remainingValue, this._utils) : remainingValue;
|
|
113412
113412
|
warnDeprecated({ value: remainingValue });
|
|
113413
113413
|
}
|
|
113414
113414
|
for (const { from, to: to5 } of redirectResult.redirect) {
|
|
@@ -113436,8 +113436,8 @@ var require2, __filename2, __dirname4, __create2, __defProp3, __getOwnPropDesc,
|
|
|
113436
113436
|
const [knownKeys, unknownKeys] = partition(Object.keys(options8).filter((key2) => !this._identifyMissing(key2, options8)), (key2) => (key2 in this._utils.schemas));
|
|
113437
113437
|
return { knownKeys, unknownKeys };
|
|
113438
113438
|
}
|
|
113439
|
-
_applyValidation(value, key2,
|
|
113440
|
-
const validateResult = normalizeValidateResult(
|
|
113439
|
+
_applyValidation(value, key2, schema8) {
|
|
113440
|
+
const validateResult = normalizeValidateResult(schema8.validate(value, this._utils), value);
|
|
113441
113441
|
if (validateResult !== true) {
|
|
113442
113442
|
throw this._invalidHandler(key2, validateResult.value, this._utils);
|
|
113443
113443
|
}
|
|
@@ -113479,8 +113479,8 @@ var require2, __filename2, __dirname4, __create2, __defProp3, __getOwnPropDesc,
|
|
|
113479
113479
|
for (const key2 of unknownKeys) {
|
|
113480
113480
|
const value = postprocessed.override[key2];
|
|
113481
113481
|
this._applyUnknownHandler(key2, value, options8, (knownResultKey, knownResultValue) => {
|
|
113482
|
-
const
|
|
113483
|
-
this._applyValidation(knownResultValue, knownResultKey,
|
|
113482
|
+
const schema8 = this._utils.schemas[knownResultKey];
|
|
113483
|
+
this._applyValidation(knownResultValue, knownResultKey, schema8);
|
|
113484
113484
|
options8[knownResultKey] = knownResultValue;
|
|
113485
113485
|
});
|
|
113486
113486
|
}
|
|
@@ -114538,12 +114538,12 @@ var init_prettier = __esm(() => {
|
|
|
114538
114538
|
return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options8);
|
|
114539
114539
|
}
|
|
114540
114540
|
let parts = { negatives: [], positives: [] };
|
|
114541
|
-
let
|
|
114541
|
+
let push22 = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
|
|
114542
114542
|
let range = [];
|
|
114543
114543
|
let index = 0;
|
|
114544
114544
|
while (descending ? a5 >= b9 : a5 <= b9) {
|
|
114545
114545
|
if (options8.toRegex === true && step > 1) {
|
|
114546
|
-
|
|
114546
|
+
push22(a5);
|
|
114547
114547
|
} else {
|
|
114548
114548
|
range.push(pad(format3(a5, index), maxLen, toNumber));
|
|
114549
114549
|
}
|
|
@@ -114844,7 +114844,7 @@ var init_prettier = __esm(() => {
|
|
|
114844
114844
|
let depth = 0;
|
|
114845
114845
|
let value;
|
|
114846
114846
|
const advance = () => input[index++];
|
|
114847
|
-
const
|
|
114847
|
+
const push22 = (node) => {
|
|
114848
114848
|
if (node.type === "text" && prev.type === "dot") {
|
|
114849
114849
|
prev.type = "text";
|
|
114850
114850
|
}
|
|
@@ -114858,7 +114858,7 @@ var init_prettier = __esm(() => {
|
|
|
114858
114858
|
prev = node;
|
|
114859
114859
|
return node;
|
|
114860
114860
|
};
|
|
114861
|
-
|
|
114861
|
+
push22({ type: "bos" });
|
|
114862
114862
|
while (index < length) {
|
|
114863
114863
|
block = stack2[stack2.length - 1];
|
|
114864
114864
|
value = advance();
|
|
@@ -114866,11 +114866,11 @@ var init_prettier = __esm(() => {
|
|
|
114866
114866
|
continue;
|
|
114867
114867
|
}
|
|
114868
114868
|
if (value === CHAR_BACKSLASH) {
|
|
114869
|
-
|
|
114869
|
+
push22({ type: "text", value: (options8.keepEscaping ? value : "") + advance() });
|
|
114870
114870
|
continue;
|
|
114871
114871
|
}
|
|
114872
114872
|
if (value === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
114873
|
-
|
|
114873
|
+
push22({ type: "text", value: "\\" + value });
|
|
114874
114874
|
continue;
|
|
114875
114875
|
}
|
|
114876
114876
|
if (value === CHAR_LEFT_SQUARE_BRACKET) {
|
|
@@ -114893,22 +114893,22 @@ var init_prettier = __esm(() => {
|
|
|
114893
114893
|
}
|
|
114894
114894
|
}
|
|
114895
114895
|
}
|
|
114896
|
-
|
|
114896
|
+
push22({ type: "text", value });
|
|
114897
114897
|
continue;
|
|
114898
114898
|
}
|
|
114899
114899
|
if (value === CHAR_LEFT_PARENTHESES) {
|
|
114900
|
-
block =
|
|
114900
|
+
block = push22({ type: "paren", nodes: [] });
|
|
114901
114901
|
stack2.push(block);
|
|
114902
|
-
|
|
114902
|
+
push22({ type: "text", value });
|
|
114903
114903
|
continue;
|
|
114904
114904
|
}
|
|
114905
114905
|
if (value === CHAR_RIGHT_PARENTHESES) {
|
|
114906
114906
|
if (block.type !== "paren") {
|
|
114907
|
-
|
|
114907
|
+
push22({ type: "text", value });
|
|
114908
114908
|
continue;
|
|
114909
114909
|
}
|
|
114910
114910
|
block = stack2.pop();
|
|
114911
|
-
|
|
114911
|
+
push22({ type: "text", value });
|
|
114912
114912
|
block = stack2[stack2.length - 1];
|
|
114913
114913
|
continue;
|
|
114914
114914
|
}
|
|
@@ -114930,7 +114930,7 @@ var init_prettier = __esm(() => {
|
|
|
114930
114930
|
}
|
|
114931
114931
|
value += next;
|
|
114932
114932
|
}
|
|
114933
|
-
|
|
114933
|
+
push22({ type: "text", value });
|
|
114934
114934
|
continue;
|
|
114935
114935
|
}
|
|
114936
114936
|
if (value === CHAR_LEFT_CURLY_BRACE) {
|
|
@@ -114946,20 +114946,20 @@ var init_prettier = __esm(() => {
|
|
|
114946
114946
|
ranges: 0,
|
|
114947
114947
|
nodes: []
|
|
114948
114948
|
};
|
|
114949
|
-
block =
|
|
114949
|
+
block = push22(brace);
|
|
114950
114950
|
stack2.push(block);
|
|
114951
|
-
|
|
114951
|
+
push22({ type: "open", value });
|
|
114952
114952
|
continue;
|
|
114953
114953
|
}
|
|
114954
114954
|
if (value === CHAR_RIGHT_CURLY_BRACE) {
|
|
114955
114955
|
if (block.type !== "brace") {
|
|
114956
|
-
|
|
114956
|
+
push22({ type: "text", value });
|
|
114957
114957
|
continue;
|
|
114958
114958
|
}
|
|
114959
114959
|
const type = "close";
|
|
114960
114960
|
block = stack2.pop();
|
|
114961
114961
|
block.close = true;
|
|
114962
|
-
|
|
114962
|
+
push22({ type, value });
|
|
114963
114963
|
depth--;
|
|
114964
114964
|
block = stack2[stack2.length - 1];
|
|
114965
114965
|
continue;
|
|
@@ -114970,14 +114970,14 @@ var init_prettier = __esm(() => {
|
|
|
114970
114970
|
const open2 = block.nodes.shift();
|
|
114971
114971
|
block.nodes = [open2, { type: "text", value: stringify2(block) }];
|
|
114972
114972
|
}
|
|
114973
|
-
|
|
114973
|
+
push22({ type: "comma", value });
|
|
114974
114974
|
block.commas++;
|
|
114975
114975
|
continue;
|
|
114976
114976
|
}
|
|
114977
114977
|
if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
|
|
114978
114978
|
const siblings = block.nodes;
|
|
114979
114979
|
if (depth === 0 || siblings.length === 0) {
|
|
114980
|
-
|
|
114980
|
+
push22({ type: "text", value });
|
|
114981
114981
|
continue;
|
|
114982
114982
|
}
|
|
114983
114983
|
if (prev.type === "dot") {
|
|
@@ -115002,10 +115002,10 @@ var init_prettier = __esm(() => {
|
|
|
115002
115002
|
block.ranges--;
|
|
115003
115003
|
continue;
|
|
115004
115004
|
}
|
|
115005
|
-
|
|
115005
|
+
push22({ type: "dot", value });
|
|
115006
115006
|
continue;
|
|
115007
115007
|
}
|
|
115008
|
-
|
|
115008
|
+
push22({ type: "text", value });
|
|
115009
115009
|
}
|
|
115010
115010
|
do {
|
|
115011
115011
|
block = stack2.pop();
|
|
@@ -115026,7 +115026,7 @@ var init_prettier = __esm(() => {
|
|
|
115026
115026
|
parent.nodes.splice(index2, 1, ...block.nodes);
|
|
115027
115027
|
}
|
|
115028
115028
|
} while (stack2.length > 0);
|
|
115029
|
-
|
|
115029
|
+
push22({ type: "eos" });
|
|
115030
115030
|
return ast;
|
|
115031
115031
|
};
|
|
115032
115032
|
module.exports = parse72;
|
|
@@ -115735,7 +115735,7 @@ var init_prettier = __esm(() => {
|
|
|
115735
115735
|
state[type]--;
|
|
115736
115736
|
stack2.pop();
|
|
115737
115737
|
};
|
|
115738
|
-
const
|
|
115738
|
+
const push22 = (tok) => {
|
|
115739
115739
|
if (prev.type === "globstar") {
|
|
115740
115740
|
const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
|
|
115741
115741
|
const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
|
|
@@ -115768,8 +115768,8 @@ var init_prettier = __esm(() => {
|
|
|
115768
115768
|
token2.output = state.output;
|
|
115769
115769
|
const output = (opts.capture ? "(" : "") + token2.open;
|
|
115770
115770
|
increment2("parens");
|
|
115771
|
-
|
|
115772
|
-
|
|
115771
|
+
push22({ type, value: value2, output: state.output ? "" : ONE_CHAR });
|
|
115772
|
+
push22({ type: "paren", extglob: true, value: advance(), output });
|
|
115773
115773
|
extglobs.push(token2);
|
|
115774
115774
|
};
|
|
115775
115775
|
const extglobClose = (token2) => {
|
|
@@ -115791,7 +115791,7 @@ var init_prettier = __esm(() => {
|
|
|
115791
115791
|
state.negatedExtglob = true;
|
|
115792
115792
|
}
|
|
115793
115793
|
}
|
|
115794
|
-
|
|
115794
|
+
push22({ type: "paren", extglob: true, value, output });
|
|
115795
115795
|
decrement("parens");
|
|
115796
115796
|
};
|
|
115797
115797
|
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
@@ -115852,7 +115852,7 @@ var init_prettier = __esm(() => {
|
|
|
115852
115852
|
}
|
|
115853
115853
|
if (!next) {
|
|
115854
115854
|
value += "\\";
|
|
115855
|
-
|
|
115855
|
+
push22({ type: "text", value });
|
|
115856
115856
|
continue;
|
|
115857
115857
|
}
|
|
115858
115858
|
const match = /^\\+/.exec(remaining());
|
|
@@ -115870,7 +115870,7 @@ var init_prettier = __esm(() => {
|
|
|
115870
115870
|
value += advance();
|
|
115871
115871
|
}
|
|
115872
115872
|
if (state.brackets === 0) {
|
|
115873
|
-
|
|
115873
|
+
push22({ type: "text", value });
|
|
115874
115874
|
continue;
|
|
115875
115875
|
}
|
|
115876
115876
|
}
|
|
@@ -115918,13 +115918,13 @@ var init_prettier = __esm(() => {
|
|
|
115918
115918
|
if (value === '"') {
|
|
115919
115919
|
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
115920
115920
|
if (opts.keepQuotes === true) {
|
|
115921
|
-
|
|
115921
|
+
push22({ type: "text", value });
|
|
115922
115922
|
}
|
|
115923
115923
|
continue;
|
|
115924
115924
|
}
|
|
115925
115925
|
if (value === "(") {
|
|
115926
115926
|
increment2("parens");
|
|
115927
|
-
|
|
115927
|
+
push22({ type: "paren", value });
|
|
115928
115928
|
continue;
|
|
115929
115929
|
}
|
|
115930
115930
|
if (value === ")") {
|
|
@@ -115936,7 +115936,7 @@ var init_prettier = __esm(() => {
|
|
|
115936
115936
|
extglobClose(extglobs.pop());
|
|
115937
115937
|
continue;
|
|
115938
115938
|
}
|
|
115939
|
-
|
|
115939
|
+
push22({ type: "paren", value, output: state.parens ? ")" : "\\)" });
|
|
115940
115940
|
decrement("parens");
|
|
115941
115941
|
continue;
|
|
115942
115942
|
}
|
|
@@ -115949,19 +115949,19 @@ var init_prettier = __esm(() => {
|
|
|
115949
115949
|
} else {
|
|
115950
115950
|
increment2("brackets");
|
|
115951
115951
|
}
|
|
115952
|
-
|
|
115952
|
+
push22({ type: "bracket", value });
|
|
115953
115953
|
continue;
|
|
115954
115954
|
}
|
|
115955
115955
|
if (value === "]") {
|
|
115956
115956
|
if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
|
|
115957
|
-
|
|
115957
|
+
push22({ type: "text", value, output: `\\${value}` });
|
|
115958
115958
|
continue;
|
|
115959
115959
|
}
|
|
115960
115960
|
if (state.brackets === 0) {
|
|
115961
115961
|
if (opts.strictBrackets === true) {
|
|
115962
115962
|
throw new SyntaxError(syntaxError2("opening", "["));
|
|
115963
115963
|
}
|
|
115964
|
-
|
|
115964
|
+
push22({ type: "text", value, output: `\\${value}` });
|
|
115965
115965
|
continue;
|
|
115966
115966
|
}
|
|
115967
115967
|
decrement("brackets");
|
|
@@ -115995,13 +115995,13 @@ var init_prettier = __esm(() => {
|
|
|
115995
115995
|
tokensIndex: state.tokens.length
|
|
115996
115996
|
};
|
|
115997
115997
|
braces.push(open2);
|
|
115998
|
-
|
|
115998
|
+
push22(open2);
|
|
115999
115999
|
continue;
|
|
116000
116000
|
}
|
|
116001
116001
|
if (value === "}") {
|
|
116002
116002
|
const brace = braces[braces.length - 1];
|
|
116003
116003
|
if (opts.nobrace === true || !brace) {
|
|
116004
|
-
|
|
116004
|
+
push22({ type: "text", value, output: value });
|
|
116005
116005
|
continue;
|
|
116006
116006
|
}
|
|
116007
116007
|
let output = ")";
|
|
@@ -116030,7 +116030,7 @@ var init_prettier = __esm(() => {
|
|
|
116030
116030
|
state.output += t25.output || t25.value;
|
|
116031
116031
|
}
|
|
116032
116032
|
}
|
|
116033
|
-
|
|
116033
|
+
push22({ type: "brace", value, output });
|
|
116034
116034
|
decrement("braces");
|
|
116035
116035
|
braces.pop();
|
|
116036
116036
|
continue;
|
|
@@ -116039,7 +116039,7 @@ var init_prettier = __esm(() => {
|
|
|
116039
116039
|
if (extglobs.length > 0) {
|
|
116040
116040
|
extglobs[extglobs.length - 1].conditions++;
|
|
116041
116041
|
}
|
|
116042
|
-
|
|
116042
|
+
push22({ type: "text", value });
|
|
116043
116043
|
continue;
|
|
116044
116044
|
}
|
|
116045
116045
|
if (value === ",") {
|
|
@@ -116049,7 +116049,7 @@ var init_prettier = __esm(() => {
|
|
|
116049
116049
|
brace.comma = true;
|
|
116050
116050
|
output = "|";
|
|
116051
116051
|
}
|
|
116052
|
-
|
|
116052
|
+
push22({ type: "comma", value, output });
|
|
116053
116053
|
continue;
|
|
116054
116054
|
}
|
|
116055
116055
|
if (value === "/") {
|
|
@@ -116061,7 +116061,7 @@ var init_prettier = __esm(() => {
|
|
|
116061
116061
|
prev = bos;
|
|
116062
116062
|
continue;
|
|
116063
116063
|
}
|
|
116064
|
-
|
|
116064
|
+
push22({ type: "slash", value, output: SLASH_LITERAL });
|
|
116065
116065
|
continue;
|
|
116066
116066
|
}
|
|
116067
116067
|
if (value === ".") {
|
|
@@ -116076,10 +116076,10 @@ var init_prettier = __esm(() => {
|
|
|
116076
116076
|
continue;
|
|
116077
116077
|
}
|
|
116078
116078
|
if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
|
|
116079
|
-
|
|
116079
|
+
push22({ type: "text", value, output: DOT_LITERAL });
|
|
116080
116080
|
continue;
|
|
116081
116081
|
}
|
|
116082
|
-
|
|
116082
|
+
push22({ type: "dot", value, output: DOT_LITERAL });
|
|
116083
116083
|
continue;
|
|
116084
116084
|
}
|
|
116085
116085
|
if (value === "?") {
|
|
@@ -116097,14 +116097,14 @@ var init_prettier = __esm(() => {
|
|
|
116097
116097
|
if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
|
|
116098
116098
|
output = `\\${value}`;
|
|
116099
116099
|
}
|
|
116100
|
-
|
|
116100
|
+
push22({ type: "text", value, output });
|
|
116101
116101
|
continue;
|
|
116102
116102
|
}
|
|
116103
116103
|
if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
|
|
116104
|
-
|
|
116104
|
+
push22({ type: "qmark", value, output: QMARK_NO_DOT });
|
|
116105
116105
|
continue;
|
|
116106
116106
|
}
|
|
116107
|
-
|
|
116107
|
+
push22({ type: "qmark", value, output: QMARK });
|
|
116108
116108
|
continue;
|
|
116109
116109
|
}
|
|
116110
116110
|
if (value === "!") {
|
|
@@ -116125,22 +116125,22 @@ var init_prettier = __esm(() => {
|
|
|
116125
116125
|
continue;
|
|
116126
116126
|
}
|
|
116127
116127
|
if (prev && prev.value === "(" || opts.regex === false) {
|
|
116128
|
-
|
|
116128
|
+
push22({ type: "plus", value, output: PLUS_LITERAL });
|
|
116129
116129
|
continue;
|
|
116130
116130
|
}
|
|
116131
116131
|
if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
|
|
116132
|
-
|
|
116132
|
+
push22({ type: "plus", value });
|
|
116133
116133
|
continue;
|
|
116134
116134
|
}
|
|
116135
|
-
|
|
116135
|
+
push22({ type: "plus", value: PLUS_LITERAL });
|
|
116136
116136
|
continue;
|
|
116137
116137
|
}
|
|
116138
116138
|
if (value === "@") {
|
|
116139
116139
|
if (opts.noextglob !== true && peek2() === "(" && peek2(2) !== "?") {
|
|
116140
|
-
|
|
116140
|
+
push22({ type: "at", extglob: true, value, output: "" });
|
|
116141
116141
|
continue;
|
|
116142
116142
|
}
|
|
116143
|
-
|
|
116143
|
+
push22({ type: "text", value });
|
|
116144
116144
|
continue;
|
|
116145
116145
|
}
|
|
116146
116146
|
if (value !== "*") {
|
|
@@ -116152,7 +116152,7 @@ var init_prettier = __esm(() => {
|
|
|
116152
116152
|
value += match[0];
|
|
116153
116153
|
state.index += match[0].length;
|
|
116154
116154
|
}
|
|
116155
|
-
|
|
116155
|
+
push22({ type: "text", value });
|
|
116156
116156
|
continue;
|
|
116157
116157
|
}
|
|
116158
116158
|
if (prev && (prev.type === "globstar" || prev.star === true)) {
|
|
@@ -116180,13 +116180,13 @@ var init_prettier = __esm(() => {
|
|
|
116180
116180
|
const isStart = prior.type === "slash" || prior.type === "bos";
|
|
116181
116181
|
const afterStar = before && (before.type === "star" || before.type === "globstar");
|
|
116182
116182
|
if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
|
|
116183
|
-
|
|
116183
|
+
push22({ type: "star", value, output: "" });
|
|
116184
116184
|
continue;
|
|
116185
116185
|
}
|
|
116186
116186
|
const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
|
|
116187
116187
|
const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
|
|
116188
116188
|
if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
|
|
116189
|
-
|
|
116189
|
+
push22({ type: "star", value, output: "" });
|
|
116190
116190
|
continue;
|
|
116191
116191
|
}
|
|
116192
116192
|
while (rest.slice(0, 3) === "/**") {
|
|
@@ -116227,7 +116227,7 @@ var init_prettier = __esm(() => {
|
|
|
116227
116227
|
state.output += prior.output + prev.output;
|
|
116228
116228
|
state.globstar = true;
|
|
116229
116229
|
consume(value + advance());
|
|
116230
|
-
|
|
116230
|
+
push22({ type: "slash", value: "/", output: "" });
|
|
116231
116231
|
continue;
|
|
116232
116232
|
}
|
|
116233
116233
|
if (prior.type === "bos" && rest[0] === "/") {
|
|
@@ -116237,7 +116237,7 @@ var init_prettier = __esm(() => {
|
|
|
116237
116237
|
state.output = prev.output;
|
|
116238
116238
|
state.globstar = true;
|
|
116239
116239
|
consume(value + advance());
|
|
116240
|
-
|
|
116240
|
+
push22({ type: "slash", value: "/", output: "" });
|
|
116241
116241
|
continue;
|
|
116242
116242
|
}
|
|
116243
116243
|
state.output = state.output.slice(0, -prev.output.length);
|
|
@@ -116255,12 +116255,12 @@ var init_prettier = __esm(() => {
|
|
|
116255
116255
|
if (prev.type === "bos" || prev.type === "slash") {
|
|
116256
116256
|
token2.output = nodot + token2.output;
|
|
116257
116257
|
}
|
|
116258
|
-
|
|
116258
|
+
push22(token2);
|
|
116259
116259
|
continue;
|
|
116260
116260
|
}
|
|
116261
116261
|
if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
|
|
116262
116262
|
token2.output = value;
|
|
116263
|
-
|
|
116263
|
+
push22(token2);
|
|
116264
116264
|
continue;
|
|
116265
116265
|
}
|
|
116266
116266
|
if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
|
|
@@ -116279,7 +116279,7 @@ var init_prettier = __esm(() => {
|
|
|
116279
116279
|
prev.output += ONE_CHAR;
|
|
116280
116280
|
}
|
|
116281
116281
|
}
|
|
116282
|
-
|
|
116282
|
+
push22(token2);
|
|
116283
116283
|
}
|
|
116284
116284
|
while (state.brackets > 0) {
|
|
116285
116285
|
if (opts.strictBrackets === true)
|
|
@@ -116300,7 +116300,7 @@ var init_prettier = __esm(() => {
|
|
|
116300
116300
|
decrement("braces");
|
|
116301
116301
|
}
|
|
116302
116302
|
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
|
|
116303
|
-
|
|
116303
|
+
push22({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
|
|
116304
116304
|
}
|
|
116305
116305
|
if (state.backtrack === true) {
|
|
116306
116306
|
state.output = "";
|
|
@@ -117648,7 +117648,7 @@ var init_prettier = __esm(() => {
|
|
|
117648
117648
|
var _running = 0;
|
|
117649
117649
|
var errorHandler = null;
|
|
117650
117650
|
var self2 = {
|
|
117651
|
-
push:
|
|
117651
|
+
push: push22,
|
|
117652
117652
|
drain: noop22,
|
|
117653
117653
|
saturated: noop22,
|
|
117654
117654
|
pause,
|
|
@@ -117721,7 +117721,7 @@ var init_prettier = __esm(() => {
|
|
|
117721
117721
|
function idle() {
|
|
117722
117722
|
return _running === 0 && self2.length() === 0;
|
|
117723
117723
|
}
|
|
117724
|
-
function
|
|
117724
|
+
function push22(value, done) {
|
|
117725
117725
|
var current = cache3.get();
|
|
117726
117726
|
current.context = context;
|
|
117727
117727
|
current.release = release;
|
|
@@ -117837,11 +117837,11 @@ var init_prettier = __esm(() => {
|
|
|
117837
117837
|
var queue = fastqueue(context, asyncWrapper, _concurrency);
|
|
117838
117838
|
var pushCb = queue.push;
|
|
117839
117839
|
var unshiftCb = queue.unshift;
|
|
117840
|
-
queue.push =
|
|
117840
|
+
queue.push = push22;
|
|
117841
117841
|
queue.unshift = unshift2;
|
|
117842
117842
|
queue.drained = drained;
|
|
117843
117843
|
return queue;
|
|
117844
|
-
function
|
|
117844
|
+
function push22(value) {
|
|
117845
117845
|
var p4 = new Promise(function(resolve32, reject) {
|
|
117846
117846
|
pushCb(value, function(err, result) {
|
|
117847
117847
|
if (err) {
|
|
@@ -119683,7 +119683,7 @@ var init_prettier = __esm(() => {
|
|
|
119683
119683
|
};
|
|
119684
119684
|
Yallist2.prototype.push = function() {
|
|
119685
119685
|
for (var i5 = 0, l7 = arguments.length;i5 < l7; i5++) {
|
|
119686
|
-
|
|
119686
|
+
push22(this, arguments[i5]);
|
|
119687
119687
|
}
|
|
119688
119688
|
return this.length;
|
|
119689
119689
|
};
|
|
@@ -119885,7 +119885,7 @@ var init_prettier = __esm(() => {
|
|
|
119885
119885
|
this.tail = head;
|
|
119886
119886
|
return this;
|
|
119887
119887
|
};
|
|
119888
|
-
function
|
|
119888
|
+
function push22(self2, item) {
|
|
119889
119889
|
self2.tail = new Node2(item, self2.tail, null, self2);
|
|
119890
119890
|
if (!self2.head) {
|
|
119891
119891
|
self2.head = self2.tail;
|
|
@@ -123177,7 +123177,7 @@ globstar while`, file2, fr10, pattern, pr8, swallowee);
|
|
|
123177
123177
|
if (token.type === "eof") {
|
|
123178
123178
|
throw invalidEOF();
|
|
123179
123179
|
}
|
|
123180
|
-
|
|
123180
|
+
push3();
|
|
123181
123181
|
},
|
|
123182
123182
|
beforePropertyName() {
|
|
123183
123183
|
switch (token.type) {
|
|
@@ -123203,7 +123203,7 @@ globstar while`, file2, fr10, pattern, pr8, swallowee);
|
|
|
123203
123203
|
if (token.type === "eof") {
|
|
123204
123204
|
throw invalidEOF();
|
|
123205
123205
|
}
|
|
123206
|
-
|
|
123206
|
+
push3();
|
|
123207
123207
|
},
|
|
123208
123208
|
beforeArrayValue() {
|
|
123209
123209
|
if (token.type === "eof") {
|
|
@@ -123213,7 +123213,7 @@ globstar while`, file2, fr10, pattern, pr8, swallowee);
|
|
|
123213
123213
|
pop();
|
|
123214
123214
|
return;
|
|
123215
123215
|
}
|
|
123216
|
-
|
|
123216
|
+
push3();
|
|
123217
123217
|
},
|
|
123218
123218
|
afterPropertyValue() {
|
|
123219
123219
|
if (token.type === "eof") {
|
|
@@ -127193,23 +127193,23 @@ var require_JSONSchema = __commonJS((exports) => {
|
|
|
127193
127193
|
exports.Parent = Symbol("Parent");
|
|
127194
127194
|
exports.Types = Symbol("Types");
|
|
127195
127195
|
exports.Intersection = Symbol("Intersection");
|
|
127196
|
-
exports.getRootSchema = (0, lodash_1.memoize)((
|
|
127197
|
-
const parent =
|
|
127196
|
+
exports.getRootSchema = (0, lodash_1.memoize)((schema8) => {
|
|
127197
|
+
const parent = schema8[exports.Parent];
|
|
127198
127198
|
if (!parent) {
|
|
127199
|
-
return
|
|
127199
|
+
return schema8;
|
|
127200
127200
|
}
|
|
127201
127201
|
return (0, exports.getRootSchema)(parent);
|
|
127202
127202
|
});
|
|
127203
|
-
function isBoolean(
|
|
127204
|
-
return
|
|
127203
|
+
function isBoolean(schema8) {
|
|
127204
|
+
return schema8 === true || schema8 === false;
|
|
127205
127205
|
}
|
|
127206
127206
|
exports.isBoolean = isBoolean;
|
|
127207
|
-
function isPrimitive(
|
|
127208
|
-
return !(0, lodash_1.isPlainObject)(
|
|
127207
|
+
function isPrimitive(schema8) {
|
|
127208
|
+
return !(0, lodash_1.isPlainObject)(schema8);
|
|
127209
127209
|
}
|
|
127210
127210
|
exports.isPrimitive = isPrimitive;
|
|
127211
|
-
function isCompound(
|
|
127212
|
-
return Array.isArray(
|
|
127211
|
+
function isCompound(schema8) {
|
|
127212
|
+
return Array.isArray(schema8.type) || "anyOf" in schema8 || "oneOf" in schema8;
|
|
127213
127213
|
}
|
|
127214
127214
|
exports.isCompound = isCompound;
|
|
127215
127215
|
});
|
|
@@ -127436,9 +127436,9 @@ var require_type2 = __commonJS((exports, module) => {
|
|
|
127436
127436
|
var require_schema2 = __commonJS((exports, module) => {
|
|
127437
127437
|
var YAMLException = require_exception2();
|
|
127438
127438
|
var Type = require_type2();
|
|
127439
|
-
function compileList(
|
|
127439
|
+
function compileList(schema8, name2) {
|
|
127440
127440
|
var result = [];
|
|
127441
|
-
|
|
127441
|
+
schema8[name2].forEach(function(currentType) {
|
|
127442
127442
|
var newIndex = result.length;
|
|
127443
127443
|
result.forEach(function(previousType, previousIndex) {
|
|
127444
127444
|
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
|
@@ -129383,7 +129383,7 @@ var require_dumper2 = __commonJS((exports, module) => {
|
|
|
129383
129383
|
"OFF"
|
|
129384
129384
|
];
|
|
129385
129385
|
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
129386
|
-
function compileStyleMap(
|
|
129386
|
+
function compileStyleMap(schema8, map2) {
|
|
129387
129387
|
var result, keys, index, length, tag, style, type;
|
|
129388
129388
|
if (map2 === null)
|
|
129389
129389
|
return {};
|
|
@@ -129395,7 +129395,7 @@ var require_dumper2 = __commonJS((exports, module) => {
|
|
|
129395
129395
|
if (tag.slice(0, 2) === "!!") {
|
|
129396
129396
|
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
129397
129397
|
}
|
|
129398
|
-
type =
|
|
129398
|
+
type = schema8.compiledTypeMap["fallback"][tag];
|
|
129399
129399
|
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
|
129400
129400
|
style = type.styleAliases[style];
|
|
129401
129401
|
}
|
|
@@ -130054,11 +130054,11 @@ var require_utils7 = __commonJS((exports) => {
|
|
|
130054
130054
|
function traverseArray(arr, callback, processed) {
|
|
130055
130055
|
arr.forEach((s5, k10) => traverse(s5, callback, processed, k10.toString()));
|
|
130056
130056
|
}
|
|
130057
|
-
function traverseIntersection(
|
|
130058
|
-
if (typeof
|
|
130057
|
+
function traverseIntersection(schema8, callback, processed) {
|
|
130058
|
+
if (typeof schema8 !== "object" || !schema8) {
|
|
130059
130059
|
return;
|
|
130060
130060
|
}
|
|
130061
|
-
const r5 =
|
|
130061
|
+
const r5 = schema8;
|
|
130062
130062
|
const intersection2 = r5[JSONSchema_1.Intersection];
|
|
130063
130063
|
if (!intersection2) {
|
|
130064
130064
|
return;
|
|
@@ -130067,60 +130067,60 @@ var require_utils7 = __commonJS((exports) => {
|
|
|
130067
130067
|
traverseArray(intersection2.allOf, callback, processed);
|
|
130068
130068
|
}
|
|
130069
130069
|
}
|
|
130070
|
-
function traverse(
|
|
130071
|
-
if (processed.has(
|
|
130070
|
+
function traverse(schema8, callback, processed = new Set, key2) {
|
|
130071
|
+
if (processed.has(schema8)) {
|
|
130072
130072
|
return;
|
|
130073
130073
|
}
|
|
130074
|
-
processed.add(
|
|
130075
|
-
callback(
|
|
130076
|
-
if (
|
|
130077
|
-
traverseArray(
|
|
130074
|
+
processed.add(schema8);
|
|
130075
|
+
callback(schema8, key2 !== null && key2 !== undefined ? key2 : null);
|
|
130076
|
+
if (schema8.anyOf) {
|
|
130077
|
+
traverseArray(schema8.anyOf, callback, processed);
|
|
130078
130078
|
}
|
|
130079
|
-
if (
|
|
130080
|
-
traverseArray(
|
|
130079
|
+
if (schema8.allOf) {
|
|
130080
|
+
traverseArray(schema8.allOf, callback, processed);
|
|
130081
130081
|
}
|
|
130082
|
-
if (
|
|
130083
|
-
traverseArray(
|
|
130082
|
+
if (schema8.oneOf) {
|
|
130083
|
+
traverseArray(schema8.oneOf, callback, processed);
|
|
130084
130084
|
}
|
|
130085
|
-
if (
|
|
130086
|
-
traverseObjectKeys(
|
|
130085
|
+
if (schema8.properties) {
|
|
130086
|
+
traverseObjectKeys(schema8.properties, callback, processed);
|
|
130087
130087
|
}
|
|
130088
|
-
if (
|
|
130089
|
-
traverseObjectKeys(
|
|
130088
|
+
if (schema8.patternProperties) {
|
|
130089
|
+
traverseObjectKeys(schema8.patternProperties, callback, processed);
|
|
130090
130090
|
}
|
|
130091
|
-
if (
|
|
130092
|
-
traverse(
|
|
130091
|
+
if (schema8.additionalProperties && typeof schema8.additionalProperties === "object") {
|
|
130092
|
+
traverse(schema8.additionalProperties, callback, processed);
|
|
130093
130093
|
}
|
|
130094
|
-
if (
|
|
130095
|
-
const { items } =
|
|
130094
|
+
if (schema8.items) {
|
|
130095
|
+
const { items } = schema8;
|
|
130096
130096
|
if (Array.isArray(items)) {
|
|
130097
130097
|
traverseArray(items, callback, processed);
|
|
130098
130098
|
} else {
|
|
130099
130099
|
traverse(items, callback, processed);
|
|
130100
130100
|
}
|
|
130101
130101
|
}
|
|
130102
|
-
if (
|
|
130103
|
-
traverse(
|
|
130102
|
+
if (schema8.additionalItems && typeof schema8.additionalItems === "object") {
|
|
130103
|
+
traverse(schema8.additionalItems, callback, processed);
|
|
130104
130104
|
}
|
|
130105
|
-
if (
|
|
130106
|
-
if (Array.isArray(
|
|
130107
|
-
traverseArray(
|
|
130105
|
+
if (schema8.dependencies) {
|
|
130106
|
+
if (Array.isArray(schema8.dependencies)) {
|
|
130107
|
+
traverseArray(schema8.dependencies, callback, processed);
|
|
130108
130108
|
} else {
|
|
130109
|
-
traverseObjectKeys(
|
|
130109
|
+
traverseObjectKeys(schema8.dependencies, callback, processed);
|
|
130110
130110
|
}
|
|
130111
130111
|
}
|
|
130112
|
-
if (
|
|
130113
|
-
traverseObjectKeys(
|
|
130112
|
+
if (schema8.definitions) {
|
|
130113
|
+
traverseObjectKeys(schema8.definitions, callback, processed);
|
|
130114
130114
|
}
|
|
130115
|
-
if (
|
|
130116
|
-
traverseObjectKeys(
|
|
130115
|
+
if (schema8.$defs) {
|
|
130116
|
+
traverseObjectKeys(schema8.$defs, callback, processed);
|
|
130117
130117
|
}
|
|
130118
|
-
if (
|
|
130119
|
-
traverse(
|
|
130118
|
+
if (schema8.not) {
|
|
130119
|
+
traverse(schema8.not, callback, processed);
|
|
130120
130120
|
}
|
|
130121
|
-
traverseIntersection(
|
|
130122
|
-
Object.keys(
|
|
130123
|
-
const child =
|
|
130121
|
+
traverseIntersection(schema8, callback, processed);
|
|
130122
|
+
Object.keys(schema8).filter((key3) => !BLACKLISTED_KEYS.has(key3)).forEach((key3) => {
|
|
130123
|
+
const child = schema8[key3];
|
|
130124
130124
|
if (child && typeof child === "object") {
|
|
130125
130125
|
traverseObjectKeys(child, callback, processed);
|
|
130126
130126
|
}
|
|
@@ -130202,14 +130202,14 @@ var require_utils7 = __commonJS((exports) => {
|
|
|
130202
130202
|
return (_g2 = color()) === null || _g2 === undefined ? undefined : _g2.whiteBright.bgYellow;
|
|
130203
130203
|
}
|
|
130204
130204
|
}
|
|
130205
|
-
function escapeBlockComment(
|
|
130205
|
+
function escapeBlockComment(schema8) {
|
|
130206
130206
|
const replacer = "* /";
|
|
130207
|
-
if (
|
|
130207
|
+
if (schema8 === null || typeof schema8 !== "object") {
|
|
130208
130208
|
return;
|
|
130209
130209
|
}
|
|
130210
|
-
for (const key2 of Object.keys(
|
|
130211
|
-
if (key2 === "description" && typeof
|
|
130212
|
-
|
|
130210
|
+
for (const key2 of Object.keys(schema8)) {
|
|
130211
|
+
if (key2 === "description" && typeof schema8[key2] === "string") {
|
|
130212
|
+
schema8[key2] = schema8[key2].replace(/\*\//g, replacer);
|
|
130213
130213
|
}
|
|
130214
130214
|
}
|
|
130215
130215
|
}
|
|
@@ -130221,45 +130221,45 @@ var require_utils7 = __commonJS((exports) => {
|
|
|
130221
130221
|
return path_1.posix.join(path_1.posix.normalize(outputPath), ...filePathRel);
|
|
130222
130222
|
}
|
|
130223
130223
|
exports.pathTransform = pathTransform;
|
|
130224
|
-
function maybeStripDefault(
|
|
130225
|
-
if (!("default" in
|
|
130226
|
-
return
|
|
130224
|
+
function maybeStripDefault(schema8) {
|
|
130225
|
+
if (!("default" in schema8)) {
|
|
130226
|
+
return schema8;
|
|
130227
130227
|
}
|
|
130228
|
-
switch (
|
|
130228
|
+
switch (schema8.type) {
|
|
130229
130229
|
case "array":
|
|
130230
|
-
if (Array.isArray(
|
|
130231
|
-
return
|
|
130230
|
+
if (Array.isArray(schema8.default)) {
|
|
130231
|
+
return schema8;
|
|
130232
130232
|
}
|
|
130233
130233
|
break;
|
|
130234
130234
|
case "boolean":
|
|
130235
|
-
if (typeof
|
|
130236
|
-
return
|
|
130235
|
+
if (typeof schema8.default === "boolean") {
|
|
130236
|
+
return schema8;
|
|
130237
130237
|
}
|
|
130238
130238
|
break;
|
|
130239
130239
|
case "integer":
|
|
130240
130240
|
case "number":
|
|
130241
|
-
if (typeof
|
|
130242
|
-
return
|
|
130241
|
+
if (typeof schema8.default === "number") {
|
|
130242
|
+
return schema8;
|
|
130243
130243
|
}
|
|
130244
130244
|
break;
|
|
130245
130245
|
case "string":
|
|
130246
|
-
if (typeof
|
|
130247
|
-
return
|
|
130246
|
+
if (typeof schema8.default === "string") {
|
|
130247
|
+
return schema8;
|
|
130248
130248
|
}
|
|
130249
130249
|
break;
|
|
130250
130250
|
case "null":
|
|
130251
|
-
if (
|
|
130252
|
-
return
|
|
130251
|
+
if (schema8.default === null) {
|
|
130252
|
+
return schema8;
|
|
130253
130253
|
}
|
|
130254
130254
|
break;
|
|
130255
130255
|
case "object":
|
|
130256
|
-
if ((0, lodash_1.isPlainObject)(
|
|
130257
|
-
return
|
|
130256
|
+
if ((0, lodash_1.isPlainObject)(schema8.default)) {
|
|
130257
|
+
return schema8;
|
|
130258
130258
|
}
|
|
130259
130259
|
break;
|
|
130260
130260
|
}
|
|
130261
|
-
delete
|
|
130262
|
-
return
|
|
130261
|
+
delete schema8.default;
|
|
130262
|
+
return schema8;
|
|
130263
130263
|
}
|
|
130264
130264
|
exports.maybeStripDefault = maybeStripDefault;
|
|
130265
130265
|
function appendToDescription(existingDescription, ...values) {
|
|
@@ -130273,11 +130273,11 @@ ${values.join(`
|
|
|
130273
130273
|
`);
|
|
130274
130274
|
}
|
|
130275
130275
|
exports.appendToDescription = appendToDescription;
|
|
130276
|
-
function isSchemaLike(
|
|
130277
|
-
if (!(0, lodash_1.isPlainObject)(
|
|
130276
|
+
function isSchemaLike(schema8) {
|
|
130277
|
+
if (!(0, lodash_1.isPlainObject)(schema8)) {
|
|
130278
130278
|
return false;
|
|
130279
130279
|
}
|
|
130280
|
-
const parent =
|
|
130280
|
+
const parent = schema8[JSONSchema_1.Parent];
|
|
130281
130281
|
if (parent === null) {
|
|
130282
130282
|
return true;
|
|
130283
130283
|
}
|
|
@@ -130294,7 +130294,7 @@ ${values.join(`
|
|
|
130294
130294
|
"properties",
|
|
130295
130295
|
"required"
|
|
130296
130296
|
];
|
|
130297
|
-
if (JSON_SCHEMA_KEYWORDS.some((_11) => parent[_11] ===
|
|
130297
|
+
if (JSON_SCHEMA_KEYWORDS.some((_11) => parent[_11] === schema8)) {
|
|
130298
130298
|
return false;
|
|
130299
130299
|
}
|
|
130300
130300
|
return true;
|
|
@@ -130592,13 +130592,13 @@ var require_typesOfSchema = __commonJS((exports) => {
|
|
|
130592
130592
|
exports.typesOfSchema = undefined;
|
|
130593
130593
|
var lodash_1 = require_lodash2();
|
|
130594
130594
|
var JSONSchema_1 = require_JSONSchema();
|
|
130595
|
-
function typesOfSchema(
|
|
130596
|
-
if (
|
|
130595
|
+
function typesOfSchema(schema8) {
|
|
130596
|
+
if (schema8.tsType) {
|
|
130597
130597
|
return new Set(["CUSTOM_TYPE"]);
|
|
130598
130598
|
}
|
|
130599
130599
|
const matchedTypes = new Set;
|
|
130600
130600
|
for (const [schemaType, f7] of Object.entries(matchers)) {
|
|
130601
|
-
if (f7(
|
|
130601
|
+
if (f7(schema8)) {
|
|
130602
130602
|
matchedTypes.add(schemaType);
|
|
130603
130603
|
}
|
|
130604
130604
|
}
|
|
@@ -130609,26 +130609,26 @@ var require_typesOfSchema = __commonJS((exports) => {
|
|
|
130609
130609
|
}
|
|
130610
130610
|
exports.typesOfSchema = typesOfSchema;
|
|
130611
130611
|
var matchers = {
|
|
130612
|
-
ALL_OF(
|
|
130613
|
-
return "allOf" in
|
|
130612
|
+
ALL_OF(schema8) {
|
|
130613
|
+
return "allOf" in schema8;
|
|
130614
130614
|
},
|
|
130615
|
-
ANY(
|
|
130616
|
-
if (Object.keys(
|
|
130615
|
+
ANY(schema8) {
|
|
130616
|
+
if (Object.keys(schema8).length === 0) {
|
|
130617
130617
|
return true;
|
|
130618
130618
|
}
|
|
130619
|
-
return
|
|
130619
|
+
return schema8.type === "any";
|
|
130620
130620
|
},
|
|
130621
|
-
ANY_OF(
|
|
130622
|
-
return "anyOf" in
|
|
130621
|
+
ANY_OF(schema8) {
|
|
130622
|
+
return "anyOf" in schema8;
|
|
130623
130623
|
},
|
|
130624
|
-
BOOLEAN(
|
|
130625
|
-
if ("enum" in
|
|
130624
|
+
BOOLEAN(schema8) {
|
|
130625
|
+
if ("enum" in schema8) {
|
|
130626
130626
|
return false;
|
|
130627
130627
|
}
|
|
130628
|
-
if (
|
|
130628
|
+
if (schema8.type === "boolean") {
|
|
130629
130629
|
return true;
|
|
130630
130630
|
}
|
|
130631
|
-
if (!(0, JSONSchema_1.isCompound)(
|
|
130631
|
+
if (!(0, JSONSchema_1.isCompound)(schema8) && typeof schema8.default === "boolean") {
|
|
130632
130632
|
return true;
|
|
130633
130633
|
}
|
|
130634
130634
|
return false;
|
|
@@ -130636,74 +130636,74 @@ var require_typesOfSchema = __commonJS((exports) => {
|
|
|
130636
130636
|
CUSTOM_TYPE() {
|
|
130637
130637
|
return false;
|
|
130638
130638
|
},
|
|
130639
|
-
NAMED_ENUM(
|
|
130640
|
-
return "enum" in
|
|
130639
|
+
NAMED_ENUM(schema8) {
|
|
130640
|
+
return "enum" in schema8 && "tsEnumNames" in schema8;
|
|
130641
130641
|
},
|
|
130642
|
-
NAMED_SCHEMA(
|
|
130643
|
-
return "$id" in
|
|
130642
|
+
NAMED_SCHEMA(schema8) {
|
|
130643
|
+
return "$id" in schema8 && (("patternProperties" in schema8) || ("properties" in schema8));
|
|
130644
130644
|
},
|
|
130645
|
-
NEVER(
|
|
130646
|
-
return
|
|
130645
|
+
NEVER(schema8) {
|
|
130646
|
+
return schema8 === false;
|
|
130647
130647
|
},
|
|
130648
|
-
NULL(
|
|
130649
|
-
return
|
|
130648
|
+
NULL(schema8) {
|
|
130649
|
+
return schema8.type === "null";
|
|
130650
130650
|
},
|
|
130651
|
-
NUMBER(
|
|
130652
|
-
if ("enum" in
|
|
130651
|
+
NUMBER(schema8) {
|
|
130652
|
+
if ("enum" in schema8) {
|
|
130653
130653
|
return false;
|
|
130654
130654
|
}
|
|
130655
|
-
if (
|
|
130655
|
+
if (schema8.type === "integer" || schema8.type === "number") {
|
|
130656
130656
|
return true;
|
|
130657
130657
|
}
|
|
130658
|
-
if (!(0, JSONSchema_1.isCompound)(
|
|
130658
|
+
if (!(0, JSONSchema_1.isCompound)(schema8) && typeof schema8.default === "number") {
|
|
130659
130659
|
return true;
|
|
130660
130660
|
}
|
|
130661
130661
|
return false;
|
|
130662
130662
|
},
|
|
130663
|
-
OBJECT(
|
|
130664
|
-
return
|
|
130663
|
+
OBJECT(schema8) {
|
|
130664
|
+
return schema8.type === "object" && !(0, lodash_1.isPlainObject)(schema8.additionalProperties) && !schema8.allOf && !schema8.anyOf && !schema8.oneOf && !schema8.patternProperties && !schema8.properties && !schema8.required;
|
|
130665
130665
|
},
|
|
130666
|
-
ONE_OF(
|
|
130667
|
-
return "oneOf" in
|
|
130666
|
+
ONE_OF(schema8) {
|
|
130667
|
+
return "oneOf" in schema8;
|
|
130668
130668
|
},
|
|
130669
|
-
REFERENCE(
|
|
130670
|
-
return "$ref" in
|
|
130669
|
+
REFERENCE(schema8) {
|
|
130670
|
+
return "$ref" in schema8;
|
|
130671
130671
|
},
|
|
130672
|
-
STRING(
|
|
130673
|
-
if ("enum" in
|
|
130672
|
+
STRING(schema8) {
|
|
130673
|
+
if ("enum" in schema8) {
|
|
130674
130674
|
return false;
|
|
130675
130675
|
}
|
|
130676
|
-
if (
|
|
130676
|
+
if (schema8.type === "string") {
|
|
130677
130677
|
return true;
|
|
130678
130678
|
}
|
|
130679
|
-
if (!(0, JSONSchema_1.isCompound)(
|
|
130679
|
+
if (!(0, JSONSchema_1.isCompound)(schema8) && typeof schema8.default === "string") {
|
|
130680
130680
|
return true;
|
|
130681
130681
|
}
|
|
130682
130682
|
return false;
|
|
130683
130683
|
},
|
|
130684
|
-
TYPED_ARRAY(
|
|
130685
|
-
if (
|
|
130684
|
+
TYPED_ARRAY(schema8) {
|
|
130685
|
+
if (schema8.type && schema8.type !== "array") {
|
|
130686
130686
|
return false;
|
|
130687
130687
|
}
|
|
130688
|
-
return "items" in
|
|
130688
|
+
return "items" in schema8;
|
|
130689
130689
|
},
|
|
130690
|
-
UNION(
|
|
130691
|
-
return Array.isArray(
|
|
130690
|
+
UNION(schema8) {
|
|
130691
|
+
return Array.isArray(schema8.type);
|
|
130692
130692
|
},
|
|
130693
|
-
UNNAMED_ENUM(
|
|
130694
|
-
if ("tsEnumNames" in
|
|
130693
|
+
UNNAMED_ENUM(schema8) {
|
|
130694
|
+
if ("tsEnumNames" in schema8) {
|
|
130695
130695
|
return false;
|
|
130696
130696
|
}
|
|
130697
|
-
if (
|
|
130697
|
+
if (schema8.type && schema8.type !== "boolean" && schema8.type !== "integer" && schema8.type !== "number" && schema8.type !== "string") {
|
|
130698
130698
|
return false;
|
|
130699
130699
|
}
|
|
130700
|
-
return "enum" in
|
|
130700
|
+
return "enum" in schema8;
|
|
130701
130701
|
},
|
|
130702
130702
|
UNNAMED_SCHEMA() {
|
|
130703
130703
|
return false;
|
|
130704
130704
|
},
|
|
130705
|
-
UNTYPED_ARRAY(
|
|
130706
|
-
return
|
|
130705
|
+
UNTYPED_ARRAY(schema8) {
|
|
130706
|
+
return schema8.type === "array" && !("items" in schema8);
|
|
130707
130707
|
}
|
|
130708
130708
|
};
|
|
130709
130709
|
});
|
|
@@ -130714,10 +130714,10 @@ var require_applySchemaTyping = __commonJS((exports) => {
|
|
|
130714
130714
|
exports.applySchemaTyping = undefined;
|
|
130715
130715
|
var JSONSchema_1 = require_JSONSchema();
|
|
130716
130716
|
var typesOfSchema_1 = require_typesOfSchema();
|
|
130717
|
-
function applySchemaTyping(
|
|
130717
|
+
function applySchemaTyping(schema8) {
|
|
130718
130718
|
var _a7;
|
|
130719
|
-
const types = (0, typesOfSchema_1.typesOfSchema)(
|
|
130720
|
-
Object.defineProperty(
|
|
130719
|
+
const types = (0, typesOfSchema_1.typesOfSchema)(schema8);
|
|
130720
|
+
Object.defineProperty(schema8, JSONSchema_1.Types, {
|
|
130721
130721
|
enumerable: false,
|
|
130722
130722
|
value: types,
|
|
130723
130723
|
writable: false
|
|
@@ -130726,23 +130726,23 @@ var require_applySchemaTyping = __commonJS((exports) => {
|
|
|
130726
130726
|
return;
|
|
130727
130727
|
}
|
|
130728
130728
|
const intersection2 = {
|
|
130729
|
-
[JSONSchema_1.Parent]:
|
|
130729
|
+
[JSONSchema_1.Parent]: schema8,
|
|
130730
130730
|
[JSONSchema_1.Types]: new Set(["ALL_OF"]),
|
|
130731
|
-
$id:
|
|
130732
|
-
description:
|
|
130733
|
-
name:
|
|
130734
|
-
title:
|
|
130735
|
-
allOf: (_a7 =
|
|
130731
|
+
$id: schema8.$id,
|
|
130732
|
+
description: schema8.description,
|
|
130733
|
+
name: schema8.name,
|
|
130734
|
+
title: schema8.title,
|
|
130735
|
+
allOf: (_a7 = schema8.allOf) !== null && _a7 !== undefined ? _a7 : [],
|
|
130736
130736
|
required: [],
|
|
130737
130737
|
additionalProperties: false
|
|
130738
130738
|
};
|
|
130739
130739
|
types.delete("ALL_OF");
|
|
130740
|
-
delete
|
|
130741
|
-
delete
|
|
130742
|
-
delete
|
|
130743
|
-
delete
|
|
130744
|
-
delete
|
|
130745
|
-
Object.defineProperty(
|
|
130740
|
+
delete schema8.allOf;
|
|
130741
|
+
delete schema8.$id;
|
|
130742
|
+
delete schema8.description;
|
|
130743
|
+
delete schema8.name;
|
|
130744
|
+
delete schema8.title;
|
|
130745
|
+
Object.defineProperty(schema8, JSONSchema_1.Intersection, {
|
|
130746
130746
|
enumerable: false,
|
|
130747
130747
|
value: intersection2,
|
|
130748
130748
|
writable: false
|
|
@@ -130760,186 +130760,186 @@ var require_normalizer = __commonJS((exports) => {
|
|
|
130760
130760
|
var applySchemaTyping_1 = require_applySchemaTyping();
|
|
130761
130761
|
var util_1 = __require("util");
|
|
130762
130762
|
var rules = new Map;
|
|
130763
|
-
function hasType(
|
|
130764
|
-
return
|
|
130763
|
+
function hasType(schema8, type) {
|
|
130764
|
+
return schema8.type === type || Array.isArray(schema8.type) && schema8.type.includes(type);
|
|
130765
130765
|
}
|
|
130766
|
-
function isObjectType(
|
|
130767
|
-
return
|
|
130766
|
+
function isObjectType(schema8) {
|
|
130767
|
+
return schema8.properties !== undefined || hasType(schema8, "object") || hasType(schema8, "any");
|
|
130768
130768
|
}
|
|
130769
|
-
function isArrayType(
|
|
130770
|
-
return
|
|
130769
|
+
function isArrayType(schema8) {
|
|
130770
|
+
return schema8.items !== undefined || hasType(schema8, "array") || hasType(schema8, "any");
|
|
130771
130771
|
}
|
|
130772
|
-
function isEnumTypeWithoutTsEnumNames(
|
|
130773
|
-
return
|
|
130772
|
+
function isEnumTypeWithoutTsEnumNames(schema8) {
|
|
130773
|
+
return schema8.type === "string" && schema8.enum !== undefined && schema8.tsEnumNames === undefined;
|
|
130774
130774
|
}
|
|
130775
|
-
rules.set('Remove `type=["null"]` if `enum=[null]`', (
|
|
130776
|
-
if (Array.isArray(
|
|
130777
|
-
|
|
130775
|
+
rules.set('Remove `type=["null"]` if `enum=[null]`', (schema8) => {
|
|
130776
|
+
if (Array.isArray(schema8.enum) && schema8.enum.some((e8) => e8 === null) && Array.isArray(schema8.type) && schema8.type.includes("null")) {
|
|
130777
|
+
schema8.type = schema8.type.filter((type) => type !== "null");
|
|
130778
130778
|
}
|
|
130779
130779
|
});
|
|
130780
|
-
rules.set("Destructure unary types", (
|
|
130781
|
-
if (
|
|
130782
|
-
|
|
130780
|
+
rules.set("Destructure unary types", (schema8) => {
|
|
130781
|
+
if (schema8.type && Array.isArray(schema8.type) && schema8.type.length === 1) {
|
|
130782
|
+
schema8.type = schema8.type[0];
|
|
130783
130783
|
}
|
|
130784
130784
|
});
|
|
130785
|
-
rules.set("Add empty `required` property if none is defined", (
|
|
130786
|
-
if (isObjectType(
|
|
130787
|
-
|
|
130785
|
+
rules.set("Add empty `required` property if none is defined", (schema8) => {
|
|
130786
|
+
if (isObjectType(schema8) && !("required" in schema8)) {
|
|
130787
|
+
schema8.required = [];
|
|
130788
130788
|
}
|
|
130789
130789
|
});
|
|
130790
|
-
rules.set("Transform `required`=false to `required`=[]", (
|
|
130791
|
-
if (
|
|
130792
|
-
|
|
130790
|
+
rules.set("Transform `required`=false to `required`=[]", (schema8) => {
|
|
130791
|
+
if (schema8.required === false) {
|
|
130792
|
+
schema8.required = [];
|
|
130793
130793
|
}
|
|
130794
130794
|
});
|
|
130795
|
-
rules.set("Default additionalProperties", (
|
|
130796
|
-
if (isObjectType(
|
|
130797
|
-
|
|
130795
|
+
rules.set("Default additionalProperties", (schema8, _11, options8) => {
|
|
130796
|
+
if (isObjectType(schema8) && !("additionalProperties" in schema8) && schema8.patternProperties === undefined) {
|
|
130797
|
+
schema8.additionalProperties = options8.additionalProperties;
|
|
130798
130798
|
}
|
|
130799
130799
|
});
|
|
130800
|
-
rules.set("Transform id to $id", (
|
|
130801
|
-
if (!(0, utils_1.isSchemaLike)(
|
|
130800
|
+
rules.set("Transform id to $id", (schema8, fileName) => {
|
|
130801
|
+
if (!(0, utils_1.isSchemaLike)(schema8)) {
|
|
130802
130802
|
return;
|
|
130803
130803
|
}
|
|
130804
|
-
if (
|
|
130805
|
-
throw ReferenceError(`Schema must define either id or $id, not both. Given id=${
|
|
130804
|
+
if (schema8.id && schema8.$id && schema8.id !== schema8.$id) {
|
|
130805
|
+
throw ReferenceError(`Schema must define either id or $id, not both. Given id=${schema8.id}, $id=${schema8.$id} in ${fileName}`);
|
|
130806
130806
|
}
|
|
130807
|
-
if (
|
|
130808
|
-
|
|
130809
|
-
delete
|
|
130807
|
+
if (schema8.id) {
|
|
130808
|
+
schema8.$id = schema8.id;
|
|
130809
|
+
delete schema8.id;
|
|
130810
130810
|
}
|
|
130811
130811
|
});
|
|
130812
|
-
rules.set("Add an $id to anything that needs it", (
|
|
130813
|
-
if (!(0, utils_1.isSchemaLike)(
|
|
130812
|
+
rules.set("Add an $id to anything that needs it", (schema8, fileName, _options, _key, dereferencedPaths) => {
|
|
130813
|
+
if (!(0, utils_1.isSchemaLike)(schema8)) {
|
|
130814
130814
|
return;
|
|
130815
130815
|
}
|
|
130816
|
-
if (!
|
|
130817
|
-
|
|
130816
|
+
if (!schema8.$id && !schema8[JSONSchema_1.Parent]) {
|
|
130817
|
+
schema8.$id = (0, utils_1.toSafeString)((0, utils_1.justName)(fileName));
|
|
130818
130818
|
return;
|
|
130819
130819
|
}
|
|
130820
|
-
if (!isArrayType(
|
|
130820
|
+
if (!isArrayType(schema8) && !isObjectType(schema8)) {
|
|
130821
130821
|
return;
|
|
130822
130822
|
}
|
|
130823
|
-
const dereferencedName = dereferencedPaths.get(
|
|
130824
|
-
if (!
|
|
130825
|
-
|
|
130823
|
+
const dereferencedName = dereferencedPaths.get(schema8);
|
|
130824
|
+
if (!schema8.$id && !schema8.title && dereferencedName) {
|
|
130825
|
+
schema8.$id = (0, utils_1.toSafeString)((0, utils_1.justName)(dereferencedName));
|
|
130826
130826
|
}
|
|
130827
130827
|
if (dereferencedName) {
|
|
130828
|
-
dereferencedPaths.delete(
|
|
130828
|
+
dereferencedPaths.delete(schema8);
|
|
130829
130829
|
}
|
|
130830
130830
|
});
|
|
130831
|
-
rules.set("Escape closing JSDoc comment", (
|
|
130832
|
-
(0, utils_1.escapeBlockComment)(
|
|
130831
|
+
rules.set("Escape closing JSDoc comment", (schema8) => {
|
|
130832
|
+
(0, utils_1.escapeBlockComment)(schema8);
|
|
130833
130833
|
});
|
|
130834
|
-
rules.set("Add JSDoc comments for minItems and maxItems", (
|
|
130835
|
-
if (!isArrayType(
|
|
130834
|
+
rules.set("Add JSDoc comments for minItems and maxItems", (schema8) => {
|
|
130835
|
+
if (!isArrayType(schema8)) {
|
|
130836
130836
|
return;
|
|
130837
130837
|
}
|
|
130838
130838
|
const commentsToAppend = [
|
|
130839
|
-
"minItems" in
|
|
130840
|
-
"maxItems" in
|
|
130839
|
+
"minItems" in schema8 ? `@minItems ${schema8.minItems}` : "",
|
|
130840
|
+
"maxItems" in schema8 ? `@maxItems ${schema8.maxItems}` : ""
|
|
130841
130841
|
].filter(Boolean);
|
|
130842
130842
|
if (commentsToAppend.length) {
|
|
130843
|
-
|
|
130843
|
+
schema8.description = (0, utils_1.appendToDescription)(schema8.description, ...commentsToAppend);
|
|
130844
130844
|
}
|
|
130845
130845
|
});
|
|
130846
|
-
rules.set("Optionally remove maxItems and minItems", (
|
|
130847
|
-
if (!isArrayType(
|
|
130846
|
+
rules.set("Optionally remove maxItems and minItems", (schema8, _fileName, options8) => {
|
|
130847
|
+
if (!isArrayType(schema8)) {
|
|
130848
130848
|
return;
|
|
130849
130849
|
}
|
|
130850
|
-
if ("minItems" in
|
|
130851
|
-
delete
|
|
130850
|
+
if ("minItems" in schema8 && options8.ignoreMinAndMaxItems) {
|
|
130851
|
+
delete schema8.minItems;
|
|
130852
130852
|
}
|
|
130853
|
-
if ("maxItems" in
|
|
130854
|
-
delete
|
|
130853
|
+
if ("maxItems" in schema8 && (options8.ignoreMinAndMaxItems || options8.maxItems === -1)) {
|
|
130854
|
+
delete schema8.maxItems;
|
|
130855
130855
|
}
|
|
130856
130856
|
});
|
|
130857
|
-
rules.set("Normalize schema.minItems", (
|
|
130857
|
+
rules.set("Normalize schema.minItems", (schema8, _fileName, options8) => {
|
|
130858
130858
|
if (options8.ignoreMinAndMaxItems) {
|
|
130859
130859
|
return;
|
|
130860
130860
|
}
|
|
130861
|
-
if (!isArrayType(
|
|
130861
|
+
if (!isArrayType(schema8)) {
|
|
130862
130862
|
return;
|
|
130863
130863
|
}
|
|
130864
|
-
const { minItems } =
|
|
130865
|
-
|
|
130864
|
+
const { minItems } = schema8;
|
|
130865
|
+
schema8.minItems = typeof minItems === "number" ? minItems : 0;
|
|
130866
130866
|
});
|
|
130867
|
-
rules.set("Remove maxItems if it is big enough to likely cause OOMs", (
|
|
130867
|
+
rules.set("Remove maxItems if it is big enough to likely cause OOMs", (schema8, _fileName, options8) => {
|
|
130868
130868
|
if (options8.ignoreMinAndMaxItems || options8.maxItems === -1) {
|
|
130869
130869
|
return;
|
|
130870
130870
|
}
|
|
130871
|
-
if (!isArrayType(
|
|
130871
|
+
if (!isArrayType(schema8)) {
|
|
130872
130872
|
return;
|
|
130873
130873
|
}
|
|
130874
|
-
const { maxItems, minItems } =
|
|
130874
|
+
const { maxItems, minItems } = schema8;
|
|
130875
130875
|
if (maxItems !== undefined && maxItems - minItems > options8.maxItems) {
|
|
130876
|
-
delete
|
|
130876
|
+
delete schema8.maxItems;
|
|
130877
130877
|
}
|
|
130878
130878
|
});
|
|
130879
|
-
rules.set("Normalize schema.items", (
|
|
130879
|
+
rules.set("Normalize schema.items", (schema8, _fileName, options8) => {
|
|
130880
130880
|
if (options8.ignoreMinAndMaxItems) {
|
|
130881
130881
|
return;
|
|
130882
130882
|
}
|
|
130883
|
-
const { maxItems, minItems } =
|
|
130883
|
+
const { maxItems, minItems } = schema8;
|
|
130884
130884
|
const hasMaxItems = typeof maxItems === "number" && maxItems >= 0;
|
|
130885
130885
|
const hasMinItems = typeof minItems === "number" && minItems > 0;
|
|
130886
|
-
if (
|
|
130887
|
-
const items =
|
|
130886
|
+
if (schema8.items && !Array.isArray(schema8.items) && (hasMaxItems || hasMinItems)) {
|
|
130887
|
+
const items = schema8.items;
|
|
130888
130888
|
const newItems = Array(maxItems || minItems || 0).fill(items);
|
|
130889
130889
|
if (!hasMaxItems) {
|
|
130890
|
-
|
|
130890
|
+
schema8.additionalItems = items;
|
|
130891
130891
|
}
|
|
130892
|
-
|
|
130892
|
+
schema8.items = newItems;
|
|
130893
130893
|
}
|
|
130894
|
-
if (Array.isArray(
|
|
130895
|
-
|
|
130894
|
+
if (Array.isArray(schema8.items) && hasMaxItems && maxItems < schema8.items.length) {
|
|
130895
|
+
schema8.items = schema8.items.slice(0, maxItems);
|
|
130896
130896
|
}
|
|
130897
|
-
return
|
|
130897
|
+
return schema8;
|
|
130898
130898
|
});
|
|
130899
|
-
rules.set("Remove extends, if it is empty", (
|
|
130900
|
-
if (!
|
|
130899
|
+
rules.set("Remove extends, if it is empty", (schema8) => {
|
|
130900
|
+
if (!schema8.hasOwnProperty("extends")) {
|
|
130901
130901
|
return;
|
|
130902
130902
|
}
|
|
130903
|
-
if (
|
|
130904
|
-
delete
|
|
130903
|
+
if (schema8.extends == null || Array.isArray(schema8.extends) && schema8.extends.length === 0) {
|
|
130904
|
+
delete schema8.extends;
|
|
130905
130905
|
}
|
|
130906
130906
|
});
|
|
130907
|
-
rules.set("Make extends always an array, if it is defined", (
|
|
130908
|
-
if (
|
|
130907
|
+
rules.set("Make extends always an array, if it is defined", (schema8) => {
|
|
130908
|
+
if (schema8.extends == null) {
|
|
130909
130909
|
return;
|
|
130910
130910
|
}
|
|
130911
|
-
if (!Array.isArray(
|
|
130912
|
-
|
|
130911
|
+
if (!Array.isArray(schema8.extends)) {
|
|
130912
|
+
schema8.extends = [schema8.extends];
|
|
130913
130913
|
}
|
|
130914
130914
|
});
|
|
130915
|
-
rules.set("Transform definitions to $defs", (
|
|
130916
|
-
if (
|
|
130917
|
-
throw ReferenceError(`Schema must define either definitions or $defs, not both. Given id=${
|
|
130915
|
+
rules.set("Transform definitions to $defs", (schema8, fileName) => {
|
|
130916
|
+
if (schema8.definitions && schema8.$defs && !(0, util_1.isDeepStrictEqual)(schema8.definitions, schema8.$defs)) {
|
|
130917
|
+
throw ReferenceError(`Schema must define either definitions or $defs, not both. Given id=${schema8.id} in ${fileName}`);
|
|
130918
130918
|
}
|
|
130919
|
-
if (
|
|
130920
|
-
|
|
130921
|
-
delete
|
|
130919
|
+
if (schema8.definitions) {
|
|
130920
|
+
schema8.$defs = schema8.definitions;
|
|
130921
|
+
delete schema8.definitions;
|
|
130922
130922
|
}
|
|
130923
130923
|
});
|
|
130924
|
-
rules.set("Transform const to singleton enum", (
|
|
130925
|
-
if (
|
|
130926
|
-
|
|
130927
|
-
delete
|
|
130924
|
+
rules.set("Transform const to singleton enum", (schema8) => {
|
|
130925
|
+
if (schema8.const !== undefined) {
|
|
130926
|
+
schema8.enum = [schema8.const];
|
|
130927
|
+
delete schema8.const;
|
|
130928
130928
|
}
|
|
130929
130929
|
});
|
|
130930
|
-
rules.set("Add tsEnumNames to enum types", (
|
|
130930
|
+
rules.set("Add tsEnumNames to enum types", (schema8, _11, options8) => {
|
|
130931
130931
|
var _a7;
|
|
130932
|
-
if (isEnumTypeWithoutTsEnumNames(
|
|
130933
|
-
|
|
130932
|
+
if (isEnumTypeWithoutTsEnumNames(schema8) && options8.inferStringEnumKeysFromValues) {
|
|
130933
|
+
schema8.tsEnumNames = (_a7 = schema8.enum) === null || _a7 === undefined ? undefined : _a7.map(String);
|
|
130934
130934
|
}
|
|
130935
130935
|
});
|
|
130936
|
-
rules.set("Pre-calculate schema types and intersections", (
|
|
130937
|
-
if (
|
|
130938
|
-
(0, applySchemaTyping_1.applySchemaTyping)(
|
|
130936
|
+
rules.set("Pre-calculate schema types and intersections", (schema8) => {
|
|
130937
|
+
if (schema8 !== null && typeof schema8 === "object") {
|
|
130938
|
+
(0, applySchemaTyping_1.applySchemaTyping)(schema8);
|
|
130939
130939
|
}
|
|
130940
130940
|
});
|
|
130941
130941
|
function normalize(rootSchema, dereferencedPaths, filename, options8) {
|
|
130942
|
-
rules.forEach((rule) => (0, utils_1.traverse)(rootSchema, (
|
|
130942
|
+
rules.forEach((rule) => (0, utils_1.traverse)(rootSchema, (schema8, key2) => rule(schema8, filename, options8, key2, dereferencedPaths)));
|
|
130943
130943
|
return rootSchema;
|
|
130944
130944
|
}
|
|
130945
130945
|
exports.normalize = normalize;
|
|
@@ -131021,37 +131021,37 @@ var require_parser = __commonJS((exports) => {
|
|
|
131021
131021
|
var AST_1 = require_AST();
|
|
131022
131022
|
var JSONSchema_1 = require_JSONSchema();
|
|
131023
131023
|
var utils_1 = require_utils7();
|
|
131024
|
-
function parse10(
|
|
131025
|
-
if ((0, JSONSchema_1.isPrimitive)(
|
|
131026
|
-
if ((0, JSONSchema_1.isBoolean)(
|
|
131027
|
-
return parseBooleanSchema(
|
|
131024
|
+
function parse10(schema8, options8, keyName, processed = new Map, usedNames = new Set) {
|
|
131025
|
+
if ((0, JSONSchema_1.isPrimitive)(schema8)) {
|
|
131026
|
+
if ((0, JSONSchema_1.isBoolean)(schema8)) {
|
|
131027
|
+
return parseBooleanSchema(schema8, keyName, options8);
|
|
131028
131028
|
}
|
|
131029
|
-
return parseLiteral(
|
|
131029
|
+
return parseLiteral(schema8, keyName);
|
|
131030
131030
|
}
|
|
131031
|
-
const intersection2 =
|
|
131032
|
-
const types =
|
|
131031
|
+
const intersection2 = schema8[JSONSchema_1.Intersection];
|
|
131032
|
+
const types = schema8[JSONSchema_1.Types];
|
|
131033
131033
|
if (intersection2) {
|
|
131034
131034
|
const ast = parseAsTypeWithCache(intersection2, "ALL_OF", options8, keyName, processed, usedNames);
|
|
131035
131035
|
types.forEach((type) => {
|
|
131036
|
-
ast.params.push(parseAsTypeWithCache(
|
|
131036
|
+
ast.params.push(parseAsTypeWithCache(schema8, type, options8, keyName, processed, usedNames));
|
|
131037
131037
|
});
|
|
131038
|
-
(0, utils_1.log)("blue", "parser", "Types:", [...types], "Input:",
|
|
131038
|
+
(0, utils_1.log)("blue", "parser", "Types:", [...types], "Input:", schema8, "Output:", ast);
|
|
131039
131039
|
return ast;
|
|
131040
131040
|
}
|
|
131041
131041
|
if (types.size === 1) {
|
|
131042
131042
|
const type = [...types][0];
|
|
131043
|
-
const ast = parseAsTypeWithCache(
|
|
131044
|
-
(0, utils_1.log)("blue", "parser", "Type:", type, "Input:",
|
|
131043
|
+
const ast = parseAsTypeWithCache(schema8, type, options8, keyName, processed, usedNames);
|
|
131044
|
+
(0, utils_1.log)("blue", "parser", "Type:", type, "Input:", schema8, "Output:", ast);
|
|
131045
131045
|
return ast;
|
|
131046
131046
|
}
|
|
131047
131047
|
throw new ReferenceError("Expected intersection schema. Please file an issue on GitHub.");
|
|
131048
131048
|
}
|
|
131049
131049
|
exports.parse = parse10;
|
|
131050
|
-
function parseAsTypeWithCache(
|
|
131051
|
-
let cachedTypeMap = processed.get(
|
|
131050
|
+
function parseAsTypeWithCache(schema8, type, options8, keyName, processed = new Map, usedNames = new Set) {
|
|
131051
|
+
let cachedTypeMap = processed.get(schema8);
|
|
131052
131052
|
if (!cachedTypeMap) {
|
|
131053
131053
|
cachedTypeMap = new Map;
|
|
131054
|
-
processed.set(
|
|
131054
|
+
processed.set(schema8, cachedTypeMap);
|
|
131055
131055
|
}
|
|
131056
131056
|
const cachedAST = cachedTypeMap.get(type);
|
|
131057
131057
|
if (cachedAST) {
|
|
@@ -131059,10 +131059,10 @@ var require_parser = __commonJS((exports) => {
|
|
|
131059
131059
|
}
|
|
131060
131060
|
const ast = {};
|
|
131061
131061
|
cachedTypeMap.set(type, ast);
|
|
131062
|
-
return Object.assign(ast, parseNonLiteral(
|
|
131062
|
+
return Object.assign(ast, parseNonLiteral(schema8, type, options8, keyName, processed, usedNames));
|
|
131063
131063
|
}
|
|
131064
|
-
function parseBooleanSchema(
|
|
131065
|
-
if (
|
|
131064
|
+
function parseBooleanSchema(schema8, keyName, options8) {
|
|
131065
|
+
if (schema8) {
|
|
131066
131066
|
return {
|
|
131067
131067
|
keyName,
|
|
131068
131068
|
type: options8.unknownAny ? "UNKNOWN" : "ANY"
|
|
@@ -131073,157 +131073,157 @@ var require_parser = __commonJS((exports) => {
|
|
|
131073
131073
|
type: "NEVER"
|
|
131074
131074
|
};
|
|
131075
131075
|
}
|
|
131076
|
-
function parseLiteral(
|
|
131076
|
+
function parseLiteral(schema8, keyName) {
|
|
131077
131077
|
return {
|
|
131078
131078
|
keyName,
|
|
131079
|
-
params:
|
|
131079
|
+
params: schema8,
|
|
131080
131080
|
type: "LITERAL"
|
|
131081
131081
|
};
|
|
131082
131082
|
}
|
|
131083
|
-
function parseNonLiteral(
|
|
131084
|
-
const definitions = getDefinitionsMemoized((0, JSONSchema_1.getRootSchema)(
|
|
131085
|
-
const keyNameFromDefinition = (0, lodash_1.findKey)(definitions, (_11) => _11 ===
|
|
131083
|
+
function parseNonLiteral(schema8, type, options8, keyName, processed, usedNames) {
|
|
131084
|
+
const definitions = getDefinitionsMemoized((0, JSONSchema_1.getRootSchema)(schema8));
|
|
131085
|
+
const keyNameFromDefinition = (0, lodash_1.findKey)(definitions, (_11) => _11 === schema8);
|
|
131086
131086
|
switch (type) {
|
|
131087
131087
|
case "ALL_OF":
|
|
131088
131088
|
return {
|
|
131089
|
-
comment:
|
|
131090
|
-
deprecated:
|
|
131089
|
+
comment: schema8.description,
|
|
131090
|
+
deprecated: schema8.deprecated,
|
|
131091
131091
|
keyName,
|
|
131092
|
-
standaloneName: standaloneName(
|
|
131093
|
-
params:
|
|
131092
|
+
standaloneName: standaloneName(schema8, keyNameFromDefinition, usedNames, options8),
|
|
131093
|
+
params: schema8.allOf.map((_11) => parse10(_11, options8, undefined, processed, usedNames)),
|
|
131094
131094
|
type: "INTERSECTION"
|
|
131095
131095
|
};
|
|
131096
131096
|
case "ANY":
|
|
131097
|
-
return Object.assign(Object.assign({}, options8.unknownAny ? AST_1.T_UNKNOWN : AST_1.T_ANY), { comment:
|
|
131097
|
+
return Object.assign(Object.assign({}, options8.unknownAny ? AST_1.T_UNKNOWN : AST_1.T_ANY), { comment: schema8.description, deprecated: schema8.deprecated, keyName, standaloneName: standaloneName(schema8, keyNameFromDefinition, usedNames, options8) });
|
|
131098
131098
|
case "ANY_OF":
|
|
131099
131099
|
return {
|
|
131100
|
-
comment:
|
|
131101
|
-
deprecated:
|
|
131100
|
+
comment: schema8.description,
|
|
131101
|
+
deprecated: schema8.deprecated,
|
|
131102
131102
|
keyName,
|
|
131103
|
-
standaloneName: standaloneName(
|
|
131104
|
-
params:
|
|
131103
|
+
standaloneName: standaloneName(schema8, keyNameFromDefinition, usedNames, options8),
|
|
131104
|
+
params: schema8.anyOf.map((_11) => parse10(_11, options8, undefined, processed, usedNames)),
|
|
131105
131105
|
type: "UNION"
|
|
131106
131106
|
};
|
|
131107
131107
|
case "BOOLEAN":
|
|
131108
131108
|
return {
|
|
131109
|
-
comment:
|
|
131110
|
-
deprecated:
|
|
131109
|
+
comment: schema8.description,
|
|
131110
|
+
deprecated: schema8.deprecated,
|
|
131111
131111
|
keyName,
|
|
131112
|
-
standaloneName: standaloneName(
|
|
131112
|
+
standaloneName: standaloneName(schema8, keyNameFromDefinition, usedNames, options8),
|
|
131113
131113
|
type: "BOOLEAN"
|
|
131114
131114
|
};
|
|
131115
131115
|
case "CUSTOM_TYPE":
|
|
131116
131116
|
return {
|
|
131117
|
-
comment:
|
|
131118
|
-
deprecated:
|
|
131117
|
+
comment: schema8.description,
|
|
131118
|
+
deprecated: schema8.deprecated,
|
|
131119
131119
|
keyName,
|
|
131120
|
-
params:
|
|
131121
|
-
standaloneName: standaloneName(
|
|
131120
|
+
params: schema8.tsType,
|
|
131121
|
+
standaloneName: standaloneName(schema8, keyNameFromDefinition, usedNames, options8),
|
|
131122
131122
|
type: "CUSTOM_TYPE"
|
|
131123
131123
|
};
|
|
131124
131124
|
case "NAMED_ENUM":
|
|
131125
131125
|
return {
|
|
131126
|
-
comment:
|
|
131127
|
-
deprecated:
|
|
131126
|
+
comment: schema8.description,
|
|
131127
|
+
deprecated: schema8.deprecated,
|
|
131128
131128
|
keyName,
|
|
131129
|
-
standaloneName: standaloneName(
|
|
131130
|
-
params:
|
|
131129
|
+
standaloneName: standaloneName(schema8, keyNameFromDefinition !== null && keyNameFromDefinition !== undefined ? keyNameFromDefinition : keyName, usedNames, options8),
|
|
131130
|
+
params: schema8.enum.map((_11, n5) => ({
|
|
131131
131131
|
ast: parseLiteral(_11, undefined),
|
|
131132
|
-
keyName:
|
|
131132
|
+
keyName: schema8.tsEnumNames[n5]
|
|
131133
131133
|
})),
|
|
131134
131134
|
type: "ENUM"
|
|
131135
131135
|
};
|
|
131136
131136
|
case "NAMED_SCHEMA":
|
|
131137
|
-
return newInterface(
|
|
131137
|
+
return newInterface(schema8, options8, processed, usedNames, keyName);
|
|
131138
131138
|
case "NEVER":
|
|
131139
131139
|
return {
|
|
131140
|
-
comment:
|
|
131141
|
-
deprecated:
|
|
131140
|
+
comment: schema8.description,
|
|
131141
|
+
deprecated: schema8.deprecated,
|
|
131142
131142
|
keyName,
|
|
131143
|
-
standaloneName: standaloneName(
|
|
131143
|
+
standaloneName: standaloneName(schema8, keyNameFromDefinition, usedNames, options8),
|
|
131144
131144
|
type: "NEVER"
|
|
131145
131145
|
};
|
|
131146
131146
|
case "NULL":
|
|
131147
131147
|
return {
|
|
131148
|
-
comment:
|
|
131149
|
-
deprecated:
|
|
131148
|
+
comment: schema8.description,
|
|
131149
|
+
deprecated: schema8.deprecated,
|
|
131150
131150
|
keyName,
|
|
131151
|
-
standaloneName: standaloneName(
|
|
131151
|
+
standaloneName: standaloneName(schema8, keyNameFromDefinition, usedNames, options8),
|
|
131152
131152
|
type: "NULL"
|
|
131153
131153
|
};
|
|
131154
131154
|
case "NUMBER":
|
|
131155
131155
|
return {
|
|
131156
|
-
comment:
|
|
131157
|
-
deprecated:
|
|
131156
|
+
comment: schema8.description,
|
|
131157
|
+
deprecated: schema8.deprecated,
|
|
131158
131158
|
keyName,
|
|
131159
|
-
standaloneName: standaloneName(
|
|
131159
|
+
standaloneName: standaloneName(schema8, keyNameFromDefinition, usedNames, options8),
|
|
131160
131160
|
type: "NUMBER"
|
|
131161
131161
|
};
|
|
131162
131162
|
case "OBJECT":
|
|
131163
131163
|
return {
|
|
131164
|
-
comment:
|
|
131164
|
+
comment: schema8.description,
|
|
131165
131165
|
keyName,
|
|
131166
|
-
standaloneName: standaloneName(
|
|
131166
|
+
standaloneName: standaloneName(schema8, keyNameFromDefinition, usedNames, options8),
|
|
131167
131167
|
type: "OBJECT",
|
|
131168
|
-
deprecated:
|
|
131168
|
+
deprecated: schema8.deprecated
|
|
131169
131169
|
};
|
|
131170
131170
|
case "ONE_OF":
|
|
131171
131171
|
return {
|
|
131172
|
-
comment:
|
|
131173
|
-
deprecated:
|
|
131172
|
+
comment: schema8.description,
|
|
131173
|
+
deprecated: schema8.deprecated,
|
|
131174
131174
|
keyName,
|
|
131175
|
-
standaloneName: standaloneName(
|
|
131176
|
-
params:
|
|
131175
|
+
standaloneName: standaloneName(schema8, keyNameFromDefinition, usedNames, options8),
|
|
131176
|
+
params: schema8.oneOf.map((_11) => parse10(_11, options8, undefined, processed, usedNames)),
|
|
131177
131177
|
type: "UNION"
|
|
131178
131178
|
};
|
|
131179
131179
|
case "REFERENCE":
|
|
131180
|
-
throw Error((0, util_1.format)("Refs should have been resolved by the resolver!",
|
|
131180
|
+
throw Error((0, util_1.format)("Refs should have been resolved by the resolver!", schema8));
|
|
131181
131181
|
case "STRING":
|
|
131182
131182
|
return {
|
|
131183
|
-
comment:
|
|
131184
|
-
deprecated:
|
|
131183
|
+
comment: schema8.description,
|
|
131184
|
+
deprecated: schema8.deprecated,
|
|
131185
131185
|
keyName,
|
|
131186
|
-
standaloneName: standaloneName(
|
|
131186
|
+
standaloneName: standaloneName(schema8, keyNameFromDefinition, usedNames, options8),
|
|
131187
131187
|
type: "STRING"
|
|
131188
131188
|
};
|
|
131189
131189
|
case "TYPED_ARRAY":
|
|
131190
|
-
if (Array.isArray(
|
|
131191
|
-
const minItems2 =
|
|
131192
|
-
const maxItems2 =
|
|
131190
|
+
if (Array.isArray(schema8.items)) {
|
|
131191
|
+
const minItems2 = schema8.minItems;
|
|
131192
|
+
const maxItems2 = schema8.maxItems;
|
|
131193
131193
|
const arrayType = {
|
|
131194
|
-
comment:
|
|
131195
|
-
deprecated:
|
|
131194
|
+
comment: schema8.description,
|
|
131195
|
+
deprecated: schema8.deprecated,
|
|
131196
131196
|
keyName,
|
|
131197
131197
|
maxItems: maxItems2,
|
|
131198
131198
|
minItems: minItems2,
|
|
131199
|
-
standaloneName: standaloneName(
|
|
131200
|
-
params:
|
|
131199
|
+
standaloneName: standaloneName(schema8, keyNameFromDefinition, usedNames, options8),
|
|
131200
|
+
params: schema8.items.map((_11) => parse10(_11, options8, undefined, processed, usedNames)),
|
|
131201
131201
|
type: "TUPLE"
|
|
131202
131202
|
};
|
|
131203
|
-
if (
|
|
131203
|
+
if (schema8.additionalItems === true) {
|
|
131204
131204
|
arrayType.spreadParam = options8.unknownAny ? AST_1.T_UNKNOWN : AST_1.T_ANY;
|
|
131205
|
-
} else if (
|
|
131206
|
-
arrayType.spreadParam = parse10(
|
|
131205
|
+
} else if (schema8.additionalItems) {
|
|
131206
|
+
arrayType.spreadParam = parse10(schema8.additionalItems, options8, undefined, processed, usedNames);
|
|
131207
131207
|
}
|
|
131208
131208
|
return arrayType;
|
|
131209
131209
|
} else {
|
|
131210
131210
|
return {
|
|
131211
|
-
comment:
|
|
131212
|
-
deprecated:
|
|
131211
|
+
comment: schema8.description,
|
|
131212
|
+
deprecated: schema8.deprecated,
|
|
131213
131213
|
keyName,
|
|
131214
|
-
standaloneName: standaloneName(
|
|
131215
|
-
params: parse10(
|
|
131214
|
+
standaloneName: standaloneName(schema8, keyNameFromDefinition, usedNames, options8),
|
|
131215
|
+
params: parse10(schema8.items, options8, `{keyNameFromDefinition}Items`, processed, usedNames),
|
|
131216
131216
|
type: "ARRAY"
|
|
131217
131217
|
};
|
|
131218
131218
|
}
|
|
131219
131219
|
case "UNION":
|
|
131220
131220
|
return {
|
|
131221
|
-
comment:
|
|
131222
|
-
deprecated:
|
|
131221
|
+
comment: schema8.description,
|
|
131222
|
+
deprecated: schema8.deprecated,
|
|
131223
131223
|
keyName,
|
|
131224
|
-
standaloneName: standaloneName(
|
|
131225
|
-
params:
|
|
131226
|
-
const member = Object.assign(Object.assign({}, (0, lodash_1.omit)(
|
|
131224
|
+
standaloneName: standaloneName(schema8, keyNameFromDefinition, usedNames, options8),
|
|
131225
|
+
params: schema8.type.map((type2) => {
|
|
131226
|
+
const member = Object.assign(Object.assign({}, (0, lodash_1.omit)(schema8, "$id", "description", "title")), { type: type2 });
|
|
131227
131227
|
(0, utils_1.maybeStripDefault)(member);
|
|
131228
131228
|
(0, applySchemaTyping_1.applySchemaTyping)(member);
|
|
131229
131229
|
return parse10(member, options8, undefined, processed, usedNames);
|
|
@@ -131232,80 +131232,80 @@ var require_parser = __commonJS((exports) => {
|
|
|
131232
131232
|
};
|
|
131233
131233
|
case "UNNAMED_ENUM":
|
|
131234
131234
|
return {
|
|
131235
|
-
comment:
|
|
131236
|
-
deprecated:
|
|
131235
|
+
comment: schema8.description,
|
|
131236
|
+
deprecated: schema8.deprecated,
|
|
131237
131237
|
keyName,
|
|
131238
|
-
standaloneName: standaloneName(
|
|
131239
|
-
params:
|
|
131238
|
+
standaloneName: standaloneName(schema8, keyNameFromDefinition, usedNames, options8),
|
|
131239
|
+
params: schema8.enum.map((_11) => parseLiteral(_11, undefined)),
|
|
131240
131240
|
type: "UNION"
|
|
131241
131241
|
};
|
|
131242
131242
|
case "UNNAMED_SCHEMA":
|
|
131243
|
-
return newInterface(
|
|
131243
|
+
return newInterface(schema8, options8, processed, usedNames, keyName, keyNameFromDefinition);
|
|
131244
131244
|
case "UNTYPED_ARRAY":
|
|
131245
|
-
const minItems =
|
|
131246
|
-
const maxItems = typeof
|
|
131245
|
+
const minItems = schema8.minItems;
|
|
131246
|
+
const maxItems = typeof schema8.maxItems === "number" ? schema8.maxItems : -1;
|
|
131247
131247
|
const params = options8.unknownAny ? AST_1.T_UNKNOWN : AST_1.T_ANY;
|
|
131248
131248
|
if (minItems > 0 || maxItems >= 0) {
|
|
131249
131249
|
return {
|
|
131250
|
-
comment:
|
|
131251
|
-
deprecated:
|
|
131250
|
+
comment: schema8.description,
|
|
131251
|
+
deprecated: schema8.deprecated,
|
|
131252
131252
|
keyName,
|
|
131253
|
-
maxItems:
|
|
131253
|
+
maxItems: schema8.maxItems,
|
|
131254
131254
|
minItems,
|
|
131255
131255
|
params: Array(Math.max(maxItems, minItems) || 0).fill(params),
|
|
131256
131256
|
spreadParam: maxItems >= 0 ? undefined : params,
|
|
131257
|
-
standaloneName: standaloneName(
|
|
131257
|
+
standaloneName: standaloneName(schema8, keyNameFromDefinition, usedNames, options8),
|
|
131258
131258
|
type: "TUPLE"
|
|
131259
131259
|
};
|
|
131260
131260
|
}
|
|
131261
131261
|
return {
|
|
131262
|
-
comment:
|
|
131263
|
-
deprecated:
|
|
131262
|
+
comment: schema8.description,
|
|
131263
|
+
deprecated: schema8.deprecated,
|
|
131264
131264
|
keyName,
|
|
131265
131265
|
params,
|
|
131266
|
-
standaloneName: standaloneName(
|
|
131266
|
+
standaloneName: standaloneName(schema8, keyNameFromDefinition, usedNames, options8),
|
|
131267
131267
|
type: "ARRAY"
|
|
131268
131268
|
};
|
|
131269
131269
|
}
|
|
131270
131270
|
}
|
|
131271
|
-
function standaloneName(
|
|
131271
|
+
function standaloneName(schema8, keyNameFromDefinition, usedNames, options8) {
|
|
131272
131272
|
var _a7;
|
|
131273
|
-
const name2 = ((_a7 = options8.customName) === null || _a7 === undefined ? undefined : _a7.call(options8,
|
|
131273
|
+
const name2 = ((_a7 = options8.customName) === null || _a7 === undefined ? undefined : _a7.call(options8, schema8, keyNameFromDefinition)) || schema8.title || schema8.$id || keyNameFromDefinition;
|
|
131274
131274
|
if (name2) {
|
|
131275
131275
|
return (0, utils_1.generateName)(name2, usedNames);
|
|
131276
131276
|
}
|
|
131277
131277
|
}
|
|
131278
|
-
function newInterface(
|
|
131279
|
-
const name2 = standaloneName(
|
|
131278
|
+
function newInterface(schema8, options8, processed, usedNames, keyName, keyNameFromDefinition) {
|
|
131279
|
+
const name2 = standaloneName(schema8, keyNameFromDefinition, usedNames, options8);
|
|
131280
131280
|
return {
|
|
131281
|
-
comment:
|
|
131282
|
-
deprecated:
|
|
131281
|
+
comment: schema8.description,
|
|
131282
|
+
deprecated: schema8.deprecated,
|
|
131283
131283
|
keyName,
|
|
131284
|
-
params: parseSchema(
|
|
131284
|
+
params: parseSchema(schema8, options8, processed, usedNames, name2),
|
|
131285
131285
|
standaloneName: name2,
|
|
131286
|
-
superTypes: parseSuperTypes(
|
|
131286
|
+
superTypes: parseSuperTypes(schema8, options8, processed, usedNames),
|
|
131287
131287
|
type: "INTERFACE"
|
|
131288
131288
|
};
|
|
131289
131289
|
}
|
|
131290
|
-
function parseSuperTypes(
|
|
131291
|
-
const superTypes =
|
|
131290
|
+
function parseSuperTypes(schema8, options8, processed, usedNames) {
|
|
131291
|
+
const superTypes = schema8.extends;
|
|
131292
131292
|
if (!superTypes) {
|
|
131293
131293
|
return [];
|
|
131294
131294
|
}
|
|
131295
131295
|
return superTypes.map((_11) => parse10(_11, options8, undefined, processed, usedNames));
|
|
131296
131296
|
}
|
|
131297
|
-
function parseSchema(
|
|
131298
|
-
let asts = (0, lodash_1.map)(
|
|
131297
|
+
function parseSchema(schema8, options8, processed, usedNames, parentSchemaName) {
|
|
131298
|
+
let asts = (0, lodash_1.map)(schema8.properties, (value, key2) => ({
|
|
131299
131299
|
ast: parse10(value, options8, key2, processed, usedNames),
|
|
131300
131300
|
isPatternProperty: false,
|
|
131301
|
-
isRequired: (0, lodash_1.includes)(
|
|
131301
|
+
isRequired: (0, lodash_1.includes)(schema8.required || [], key2),
|
|
131302
131302
|
isUnreachableDefinition: false,
|
|
131303
131303
|
keyName: key2
|
|
131304
131304
|
}));
|
|
131305
131305
|
let singlePatternProperty = false;
|
|
131306
|
-
if (
|
|
131307
|
-
singlePatternProperty = !
|
|
131308
|
-
asts = asts.concat((0, lodash_1.map)(
|
|
131306
|
+
if (schema8.patternProperties) {
|
|
131307
|
+
singlePatternProperty = !schema8.additionalProperties && Object.keys(schema8.patternProperties).length === 1;
|
|
131308
|
+
asts = asts.concat((0, lodash_1.map)(schema8.patternProperties, (value, key2) => {
|
|
131309
131309
|
const ast = parse10(value, options8, key2, processed, usedNames);
|
|
131310
131310
|
const comment = `This interface was referenced by \`${parentSchemaName}\`'s JSON-Schema definition
|
|
131311
131311
|
via the \`patternProperty\` "${key2.replace("*/", "*\\/")}".`;
|
|
@@ -131315,14 +131315,14 @@ ${comment}` : comment;
|
|
|
131315
131315
|
return {
|
|
131316
131316
|
ast,
|
|
131317
131317
|
isPatternProperty: !singlePatternProperty,
|
|
131318
|
-
isRequired: singlePatternProperty || (0, lodash_1.includes)(
|
|
131318
|
+
isRequired: singlePatternProperty || (0, lodash_1.includes)(schema8.required || [], key2),
|
|
131319
131319
|
isUnreachableDefinition: false,
|
|
131320
131320
|
keyName: singlePatternProperty ? "[k: string]" : key2
|
|
131321
131321
|
};
|
|
131322
131322
|
}));
|
|
131323
131323
|
}
|
|
131324
131324
|
if (options8.unreachableDefinitions) {
|
|
131325
|
-
asts = asts.concat((0, lodash_1.map)(
|
|
131325
|
+
asts = asts.concat((0, lodash_1.map)(schema8.$defs, (value, key2) => {
|
|
131326
131326
|
const ast = parse10(value, options8, key2, processed, usedNames);
|
|
131327
131327
|
const comment = `This interface was referenced by \`${parentSchemaName}\`'s JSON-Schema
|
|
131328
131328
|
via the \`definition\` "${key2}".`;
|
|
@@ -131332,13 +131332,13 @@ ${comment}` : comment;
|
|
|
131332
131332
|
return {
|
|
131333
131333
|
ast,
|
|
131334
131334
|
isPatternProperty: false,
|
|
131335
|
-
isRequired: (0, lodash_1.includes)(
|
|
131335
|
+
isRequired: (0, lodash_1.includes)(schema8.required || [], key2),
|
|
131336
131336
|
isUnreachableDefinition: true,
|
|
131337
131337
|
keyName: key2
|
|
131338
131338
|
};
|
|
131339
131339
|
}));
|
|
131340
131340
|
}
|
|
131341
|
-
switch (
|
|
131341
|
+
switch (schema8.additionalProperties) {
|
|
131342
131342
|
case undefined:
|
|
131343
131343
|
case true:
|
|
131344
131344
|
if (singlePatternProperty) {
|
|
@@ -131355,7 +131355,7 @@ ${comment}` : comment;
|
|
|
131355
131355
|
return asts;
|
|
131356
131356
|
default:
|
|
131357
131357
|
return asts.concat({
|
|
131358
|
-
ast: parse10(
|
|
131358
|
+
ast: parse10(schema8.additionalProperties, options8, "[k: string]", processed, usedNames),
|
|
131359
131359
|
isPatternProperty: false,
|
|
131360
131360
|
isRequired: true,
|
|
131361
131361
|
isUnreachableDefinition: false,
|
|
@@ -131363,22 +131363,22 @@ ${comment}` : comment;
|
|
|
131363
131363
|
});
|
|
131364
131364
|
}
|
|
131365
131365
|
}
|
|
131366
|
-
function getDefinitions(
|
|
131367
|
-
if (processed.has(
|
|
131366
|
+
function getDefinitions(schema8, isSchema = true, processed = new Set) {
|
|
131367
|
+
if (processed.has(schema8)) {
|
|
131368
131368
|
return {};
|
|
131369
131369
|
}
|
|
131370
|
-
processed.add(
|
|
131371
|
-
if (Array.isArray(
|
|
131372
|
-
return
|
|
131370
|
+
processed.add(schema8);
|
|
131371
|
+
if (Array.isArray(schema8)) {
|
|
131372
|
+
return schema8.reduce((prev, cur) => Object.assign(Object.assign({}, prev), getDefinitions(cur, false, processed)), {});
|
|
131373
131373
|
}
|
|
131374
|
-
if ((0, lodash_1.isPlainObject)(
|
|
131375
|
-
return Object.assign(Object.assign({}, isSchema && hasDefinitions(
|
|
131374
|
+
if ((0, lodash_1.isPlainObject)(schema8)) {
|
|
131375
|
+
return Object.assign(Object.assign({}, isSchema && hasDefinitions(schema8) ? schema8.$defs : {}), Object.keys(schema8).reduce((prev, cur) => Object.assign(Object.assign({}, prev), getDefinitions(schema8[cur], false, processed)), {}));
|
|
131376
131376
|
}
|
|
131377
131377
|
return {};
|
|
131378
131378
|
}
|
|
131379
131379
|
var getDefinitionsMemoized = (0, lodash_1.memoize)(getDefinitions);
|
|
131380
|
-
function hasDefinitions(
|
|
131381
|
-
return "$defs" in
|
|
131380
|
+
function hasDefinitions(schema8) {
|
|
131381
|
+
return "$defs" in schema8;
|
|
131382
131382
|
}
|
|
131383
131383
|
});
|
|
131384
131384
|
|
|
@@ -133083,9 +133083,9 @@ var require_type3 = __commonJS((exports, module) => {
|
|
|
133083
133083
|
var require_schema3 = __commonJS((exports, module) => {
|
|
133084
133084
|
var YAMLException = require_exception3();
|
|
133085
133085
|
var Type = require_type3();
|
|
133086
|
-
function compileList(
|
|
133086
|
+
function compileList(schema8, name2) {
|
|
133087
133087
|
var result = [];
|
|
133088
|
-
|
|
133088
|
+
schema8[name2].forEach(function(currentType) {
|
|
133089
133089
|
var newIndex = result.length;
|
|
133090
133090
|
result.forEach(function(previousType, previousIndex) {
|
|
133091
133091
|
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
|
@@ -135030,7 +135030,7 @@ var require_dumper3 = __commonJS((exports, module) => {
|
|
|
135030
135030
|
"OFF"
|
|
135031
135031
|
];
|
|
135032
135032
|
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
135033
|
-
function compileStyleMap(
|
|
135033
|
+
function compileStyleMap(schema8, map2) {
|
|
135034
135034
|
var result, keys, index, length, tag, style, type;
|
|
135035
135035
|
if (map2 === null)
|
|
135036
135036
|
return {};
|
|
@@ -135042,7 +135042,7 @@ var require_dumper3 = __commonJS((exports, module) => {
|
|
|
135042
135042
|
if (tag.slice(0, 2) === "!!") {
|
|
135043
135043
|
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
135044
135044
|
}
|
|
135045
|
-
type =
|
|
135045
|
+
type = schema8.compiledTypeMap["fallback"][tag];
|
|
135046
135046
|
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
|
135047
135047
|
style = type.styleAliases[style];
|
|
135048
135048
|
}
|
|
@@ -135977,7 +135977,7 @@ var require_normalize_args = __commonJS((exports) => {
|
|
|
135977
135977
|
var options_js_1 = require_options();
|
|
135978
135978
|
function normalizeArgs(_args) {
|
|
135979
135979
|
let path18;
|
|
135980
|
-
let
|
|
135980
|
+
let schema8;
|
|
135981
135981
|
let options8;
|
|
135982
135982
|
let callback;
|
|
135983
135983
|
const args = Array.prototype.slice.call(_args);
|
|
@@ -135987,15 +135987,15 @@ var require_normalize_args = __commonJS((exports) => {
|
|
|
135987
135987
|
if (typeof args[0] === "string") {
|
|
135988
135988
|
path18 = args[0];
|
|
135989
135989
|
if (typeof args[2] === "object") {
|
|
135990
|
-
|
|
135990
|
+
schema8 = args[1];
|
|
135991
135991
|
options8 = args[2];
|
|
135992
135992
|
} else {
|
|
135993
|
-
|
|
135993
|
+
schema8 = undefined;
|
|
135994
135994
|
options8 = args[1];
|
|
135995
135995
|
}
|
|
135996
135996
|
} else {
|
|
135997
135997
|
path18 = "";
|
|
135998
|
-
|
|
135998
|
+
schema8 = args[0];
|
|
135999
135999
|
options8 = args[1];
|
|
136000
136000
|
}
|
|
136001
136001
|
try {
|
|
@@ -136003,12 +136003,12 @@ var require_normalize_args = __commonJS((exports) => {
|
|
|
136003
136003
|
} catch (e8) {
|
|
136004
136004
|
console.error(`JSON Schema Ref Parser: Error normalizing options: ${e8}`);
|
|
136005
136005
|
}
|
|
136006
|
-
if (!options8.mutateInputSchema && typeof
|
|
136007
|
-
|
|
136006
|
+
if (!options8.mutateInputSchema && typeof schema8 === "object") {
|
|
136007
|
+
schema8 = JSON.parse(JSON.stringify(schema8));
|
|
136008
136008
|
}
|
|
136009
136009
|
return {
|
|
136010
136010
|
path: path18,
|
|
136011
|
-
schema:
|
|
136011
|
+
schema: schema8,
|
|
136012
136012
|
options: options8,
|
|
136013
136013
|
callback
|
|
136014
136014
|
};
|
|
@@ -136797,12 +136797,12 @@ var require_resolver = __commonJS((exports) => {
|
|
|
136797
136797
|
var json_schema_ref_parser_1 = require_lib3();
|
|
136798
136798
|
var utils_1 = require_utils7();
|
|
136799
136799
|
function dereference(schema_1, _a7) {
|
|
136800
|
-
return __awaiter(this, arguments, undefined, function* (
|
|
136801
|
-
(0, utils_1.log)("green", "dereferencer", "Dereferencing input schema:", cwd,
|
|
136800
|
+
return __awaiter(this, arguments, undefined, function* (schema8, { cwd, $refOptions }) {
|
|
136801
|
+
(0, utils_1.log)("green", "dereferencer", "Dereferencing input schema:", cwd, schema8);
|
|
136802
136802
|
const parser = new json_schema_ref_parser_1.$RefParser;
|
|
136803
136803
|
const dereferencedPaths = new WeakMap;
|
|
136804
|
-
const dereferencedSchema = yield parser.dereference(cwd,
|
|
136805
|
-
dereferencedPaths.set(
|
|
136804
|
+
const dereferencedSchema = yield parser.dereference(cwd, schema8, Object.assign(Object.assign({}, $refOptions), { dereference: Object.assign(Object.assign({}, $refOptions.dereference), { onDereference($ref, schema9) {
|
|
136805
|
+
dereferencedPaths.set(schema9, $ref);
|
|
136806
136806
|
} }) }));
|
|
136807
136807
|
return { dereferencedPaths, dereferencedSchema };
|
|
136808
136808
|
});
|
|
@@ -136816,46 +136816,46 @@ var require_validator = __commonJS((exports) => {
|
|
|
136816
136816
|
exports.validate = undefined;
|
|
136817
136817
|
var utils_1 = require_utils7();
|
|
136818
136818
|
var rules = new Map;
|
|
136819
|
-
rules.set("Enum members and tsEnumNames must be of the same length", (
|
|
136820
|
-
if (
|
|
136819
|
+
rules.set("Enum members and tsEnumNames must be of the same length", (schema8) => {
|
|
136820
|
+
if (schema8.enum && schema8.tsEnumNames && schema8.enum.length !== schema8.tsEnumNames.length) {
|
|
136821
136821
|
return false;
|
|
136822
136822
|
}
|
|
136823
136823
|
});
|
|
136824
|
-
rules.set("tsEnumNames must be an array of strings", (
|
|
136825
|
-
if (
|
|
136824
|
+
rules.set("tsEnumNames must be an array of strings", (schema8) => {
|
|
136825
|
+
if (schema8.tsEnumNames && schema8.tsEnumNames.some((_11) => typeof _11 !== "string")) {
|
|
136826
136826
|
return false;
|
|
136827
136827
|
}
|
|
136828
136828
|
});
|
|
136829
|
-
rules.set("When both maxItems and minItems are present, maxItems >= minItems", (
|
|
136830
|
-
const { maxItems, minItems } =
|
|
136829
|
+
rules.set("When both maxItems and minItems are present, maxItems >= minItems", (schema8) => {
|
|
136830
|
+
const { maxItems, minItems } = schema8;
|
|
136831
136831
|
if (typeof maxItems === "number" && typeof minItems === "number") {
|
|
136832
136832
|
return maxItems >= minItems;
|
|
136833
136833
|
}
|
|
136834
136834
|
});
|
|
136835
|
-
rules.set("When maxItems exists, maxItems >= 0", (
|
|
136836
|
-
const { maxItems } =
|
|
136835
|
+
rules.set("When maxItems exists, maxItems >= 0", (schema8) => {
|
|
136836
|
+
const { maxItems } = schema8;
|
|
136837
136837
|
if (typeof maxItems === "number") {
|
|
136838
136838
|
return maxItems >= 0;
|
|
136839
136839
|
}
|
|
136840
136840
|
});
|
|
136841
|
-
rules.set("When minItems exists, minItems >= 0", (
|
|
136842
|
-
const { minItems } =
|
|
136841
|
+
rules.set("When minItems exists, minItems >= 0", (schema8) => {
|
|
136842
|
+
const { minItems } = schema8;
|
|
136843
136843
|
if (typeof minItems === "number") {
|
|
136844
136844
|
return minItems >= 0;
|
|
136845
136845
|
}
|
|
136846
136846
|
});
|
|
136847
|
-
rules.set("deprecated must be a boolean", (
|
|
136848
|
-
const typeOfDeprecated = typeof
|
|
136847
|
+
rules.set("deprecated must be a boolean", (schema8) => {
|
|
136848
|
+
const typeOfDeprecated = typeof schema8.deprecated;
|
|
136849
136849
|
return typeOfDeprecated === "boolean" || typeOfDeprecated === "undefined";
|
|
136850
136850
|
});
|
|
136851
|
-
function validate2(
|
|
136851
|
+
function validate2(schema8, filename) {
|
|
136852
136852
|
const errors4 = [];
|
|
136853
136853
|
rules.forEach((rule, ruleName) => {
|
|
136854
|
-
(0, utils_1.traverse)(
|
|
136855
|
-
if (rule(
|
|
136854
|
+
(0, utils_1.traverse)(schema8, (schema9, key2) => {
|
|
136855
|
+
if (rule(schema9) === false) {
|
|
136856
136856
|
errors4.push(`Error at key "${key2}" in file "${filename}": ${ruleName}`);
|
|
136857
136857
|
}
|
|
136858
|
-
return
|
|
136858
|
+
return schema9;
|
|
136859
136859
|
});
|
|
136860
136860
|
});
|
|
136861
136861
|
return errors4;
|
|
@@ -136869,25 +136869,25 @@ var require_linker = __commonJS((exports) => {
|
|
|
136869
136869
|
exports.link = undefined;
|
|
136870
136870
|
var JSONSchema_1 = require_JSONSchema();
|
|
136871
136871
|
var lodash_1 = require_lodash2();
|
|
136872
|
-
function link2(
|
|
136873
|
-
if (!Array.isArray(
|
|
136874
|
-
return
|
|
136872
|
+
function link2(schema8, parent = null) {
|
|
136873
|
+
if (!Array.isArray(schema8) && !(0, lodash_1.isPlainObject)(schema8)) {
|
|
136874
|
+
return schema8;
|
|
136875
136875
|
}
|
|
136876
|
-
if (
|
|
136877
|
-
return
|
|
136876
|
+
if (schema8.hasOwnProperty(JSONSchema_1.Parent)) {
|
|
136877
|
+
return schema8;
|
|
136878
136878
|
}
|
|
136879
|
-
Object.defineProperty(
|
|
136879
|
+
Object.defineProperty(schema8, JSONSchema_1.Parent, {
|
|
136880
136880
|
enumerable: false,
|
|
136881
136881
|
value: parent,
|
|
136882
136882
|
writable: false
|
|
136883
136883
|
});
|
|
136884
|
-
if (Array.isArray(
|
|
136885
|
-
|
|
136884
|
+
if (Array.isArray(schema8)) {
|
|
136885
|
+
schema8.forEach((child) => link2(child, schema8));
|
|
136886
136886
|
}
|
|
136887
|
-
for (const key2 in
|
|
136888
|
-
link2(
|
|
136887
|
+
for (const key2 in schema8) {
|
|
136888
|
+
link2(schema8[key2], schema8);
|
|
136889
136889
|
}
|
|
136890
|
-
return
|
|
136890
|
+
return schema8;
|
|
136891
136891
|
}
|
|
136892
136892
|
exports.link = link2;
|
|
136893
136893
|
});
|
|
@@ -136979,8 +136979,8 @@ var require_src3 = __commonJS((exports) => {
|
|
|
136979
136979
|
unknownAny: true
|
|
136980
136980
|
};
|
|
136981
136981
|
function compileFromFile(filename, options8 = exports.DEFAULT_OPTIONS) {
|
|
136982
|
-
const
|
|
136983
|
-
return compile(
|
|
136982
|
+
const schema8 = parseAsJSONSchema(filename);
|
|
136983
|
+
return compile(schema8, (0, utils_1.stripExtension)(filename), Object.assign({ cwd: (0, path_1.dirname)(filename) }, options8));
|
|
136984
136984
|
}
|
|
136985
136985
|
exports.compileFromFile = compileFromFile;
|
|
136986
136986
|
function parseAsJSONSchema(filename) {
|
|
@@ -136990,7 +136990,7 @@ var require_src3 = __commonJS((exports) => {
|
|
|
136990
136990
|
return (0, utils_1.parseFileAsJSONSchema)(filename, contents.toString());
|
|
136991
136991
|
}
|
|
136992
136992
|
function compile(schema_1, name_1) {
|
|
136993
|
-
return __awaiter(this, arguments, undefined, function* (
|
|
136993
|
+
return __awaiter(this, arguments, undefined, function* (schema8, name2, options8 = {}) {
|
|
136994
136994
|
(0, optionValidator_1.validateOptions)(options8);
|
|
136995
136995
|
const _options = (0, lodash_1.merge)({}, exports.DEFAULT_OPTIONS, options8);
|
|
136996
136996
|
const start = Date.now();
|
|
@@ -137000,7 +137000,7 @@ var require_src3 = __commonJS((exports) => {
|
|
|
137000
137000
|
if (!(0, lodash_1.endsWith)(_options.cwd, "/")) {
|
|
137001
137001
|
_options.cwd += "/";
|
|
137002
137002
|
}
|
|
137003
|
-
const _schema = (0, lodash_1.cloneDeep)(
|
|
137003
|
+
const _schema = (0, lodash_1.cloneDeep)(schema8);
|
|
137004
137004
|
const { dereferencedPaths, dereferencedSchema } = yield (0, resolver_1.dereference)(_schema, _options);
|
|
137005
137005
|
if (process.env.VERBOSE) {
|
|
137006
137006
|
if ((0, util_1.isDeepStrictEqual)(_schema, dereferencedSchema)) {
|
|
@@ -154726,9 +154726,9 @@ var require_stringify4 = __commonJS((exports, module) => {
|
|
|
154726
154726
|
}
|
|
154727
154727
|
};
|
|
154728
154728
|
var isArray = Array.isArray;
|
|
154729
|
-
var
|
|
154729
|
+
var push4 = Array.prototype.push;
|
|
154730
154730
|
var pushToArray = function(arr, valueOrArray) {
|
|
154731
|
-
|
|
154731
|
+
push4.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
|
|
154732
154732
|
};
|
|
154733
154733
|
var toISO = Date.prototype.toISOString;
|
|
154734
154734
|
var defaultFormat = formats["default"];
|
|
@@ -160853,18 +160853,18 @@ var require_common8 = __commonJS((exports) => {
|
|
|
160853
160853
|
retSegs.push.apply(retSegs, lastSegs);
|
|
160854
160854
|
return retSegs.join("?");
|
|
160855
160855
|
};
|
|
160856
|
-
common2.rewriteCookieProperty = function rewriteCookieProperty(header2,
|
|
160856
|
+
common2.rewriteCookieProperty = function rewriteCookieProperty(header2, config10, property) {
|
|
160857
160857
|
if (Array.isArray(header2)) {
|
|
160858
160858
|
return header2.map(function(headerElement) {
|
|
160859
|
-
return rewriteCookieProperty(headerElement,
|
|
160859
|
+
return rewriteCookieProperty(headerElement, config10, property);
|
|
160860
160860
|
});
|
|
160861
160861
|
}
|
|
160862
160862
|
return header2.replace(new RegExp("(;\\s*" + property + "=)([^;]+)", "i"), function(match, prefix, previousValue) {
|
|
160863
160863
|
var newValue;
|
|
160864
|
-
if (previousValue in
|
|
160865
|
-
newValue =
|
|
160866
|
-
} else if ("*" in
|
|
160867
|
-
newValue =
|
|
160864
|
+
if (previousValue in config10) {
|
|
160865
|
+
newValue = config10[previousValue];
|
|
160866
|
+
} else if ("*" in config10) {
|
|
160867
|
+
newValue = config10["*"];
|
|
160868
160868
|
} else {
|
|
160869
160869
|
return match;
|
|
160870
160870
|
}
|
|
@@ -162229,9 +162229,9 @@ var require_router2 = __commonJS((exports) => {
|
|
|
162229
162229
|
var is_plain_object_1 = require_is_plain_object();
|
|
162230
162230
|
var debug_1 = require_debug3();
|
|
162231
162231
|
var debug = debug_1.Debug.extend("router");
|
|
162232
|
-
async function getTarget(req,
|
|
162232
|
+
async function getTarget(req, config10) {
|
|
162233
162233
|
let newTarget;
|
|
162234
|
-
const router =
|
|
162234
|
+
const router = config10.router;
|
|
162235
162235
|
if ((0, is_plain_object_1.isPlainObject)(router)) {
|
|
162236
162236
|
newTarget = getTargetFromProxyTable(req, router);
|
|
162237
162237
|
} else if (typeof router === "function") {
|
|
@@ -177926,7 +177926,8 @@ var ProjectConfigSchema = exports_external.object({
|
|
|
177926
177926
|
site: SiteConfigSchema.optional(),
|
|
177927
177927
|
entitiesDir: exports_external.string().optional().default("entities"),
|
|
177928
177928
|
functionsDir: exports_external.string().optional().default("functions"),
|
|
177929
|
-
agentsDir: exports_external.string().optional().default("agents")
|
|
177929
|
+
agentsDir: exports_external.string().optional().default("agents"),
|
|
177930
|
+
connectorsDir: exports_external.string().optional().default("connectors")
|
|
177930
177931
|
});
|
|
177931
177932
|
var AppConfigSchema = exports_external.object({
|
|
177932
177933
|
id: exports_external.string().min(1, "id cannot be empty")
|
|
@@ -184994,6 +184995,305 @@ var agentResource = {
|
|
|
184994
184995
|
readAll: readAllAgents,
|
|
184995
184996
|
push: pushAgents
|
|
184996
184997
|
};
|
|
184998
|
+
// src/core/resources/connector/schema.ts
|
|
184999
|
+
var GoogleCalendarConnectorSchema = exports_external.object({
|
|
185000
|
+
type: exports_external.literal("googlecalendar"),
|
|
185001
|
+
scopes: exports_external.array(exports_external.string()).default([])
|
|
185002
|
+
});
|
|
185003
|
+
var GoogleDriveConnectorSchema = exports_external.object({
|
|
185004
|
+
type: exports_external.literal("googledrive"),
|
|
185005
|
+
scopes: exports_external.array(exports_external.string()).default([])
|
|
185006
|
+
});
|
|
185007
|
+
var GmailConnectorSchema = exports_external.object({
|
|
185008
|
+
type: exports_external.literal("gmail"),
|
|
185009
|
+
scopes: exports_external.array(exports_external.string()).default([])
|
|
185010
|
+
});
|
|
185011
|
+
var GoogleSheetsConnectorSchema = exports_external.object({
|
|
185012
|
+
type: exports_external.literal("googlesheets"),
|
|
185013
|
+
scopes: exports_external.array(exports_external.string()).default([])
|
|
185014
|
+
});
|
|
185015
|
+
var GoogleDocsConnectorSchema = exports_external.object({
|
|
185016
|
+
type: exports_external.literal("googledocs"),
|
|
185017
|
+
scopes: exports_external.array(exports_external.string()).default([])
|
|
185018
|
+
});
|
|
185019
|
+
var GoogleSlidesConnectorSchema = exports_external.object({
|
|
185020
|
+
type: exports_external.literal("googleslides"),
|
|
185021
|
+
scopes: exports_external.array(exports_external.string()).default([])
|
|
185022
|
+
});
|
|
185023
|
+
var SlackConnectorSchema = exports_external.object({
|
|
185024
|
+
type: exports_external.literal("slack"),
|
|
185025
|
+
scopes: exports_external.array(exports_external.string()).default([])
|
|
185026
|
+
});
|
|
185027
|
+
var NotionConnectorSchema = exports_external.object({
|
|
185028
|
+
type: exports_external.literal("notion"),
|
|
185029
|
+
scopes: exports_external.array(exports_external.string()).default([]).optional()
|
|
185030
|
+
});
|
|
185031
|
+
var SalesforceConnectorSchema = exports_external.object({
|
|
185032
|
+
type: exports_external.literal("salesforce"),
|
|
185033
|
+
scopes: exports_external.array(exports_external.string()).default([])
|
|
185034
|
+
});
|
|
185035
|
+
var HubspotConnectorSchema = exports_external.object({
|
|
185036
|
+
type: exports_external.literal("hubspot"),
|
|
185037
|
+
scopes: exports_external.array(exports_external.string()).default([])
|
|
185038
|
+
});
|
|
185039
|
+
var LinkedInConnectorSchema = exports_external.object({
|
|
185040
|
+
type: exports_external.literal("linkedin"),
|
|
185041
|
+
scopes: exports_external.array(exports_external.string()).default([])
|
|
185042
|
+
});
|
|
185043
|
+
var TikTokConnectorSchema = exports_external.object({
|
|
185044
|
+
type: exports_external.literal("tiktok"),
|
|
185045
|
+
scopes: exports_external.array(exports_external.string()).default([])
|
|
185046
|
+
});
|
|
185047
|
+
var CustomTypeSchema = exports_external.string().min(1).regex(/^[a-z0-9_-]+$/i);
|
|
185048
|
+
var GenericConnectorSchema = exports_external.object({
|
|
185049
|
+
type: CustomTypeSchema,
|
|
185050
|
+
scopes: exports_external.array(exports_external.string()).default([])
|
|
185051
|
+
});
|
|
185052
|
+
var ConnectorResourceSchema = exports_external.union([
|
|
185053
|
+
GoogleCalendarConnectorSchema,
|
|
185054
|
+
GoogleDriveConnectorSchema,
|
|
185055
|
+
GmailConnectorSchema,
|
|
185056
|
+
GoogleSheetsConnectorSchema,
|
|
185057
|
+
GoogleDocsConnectorSchema,
|
|
185058
|
+
GoogleSlidesConnectorSchema,
|
|
185059
|
+
SlackConnectorSchema,
|
|
185060
|
+
NotionConnectorSchema,
|
|
185061
|
+
SalesforceConnectorSchema,
|
|
185062
|
+
HubspotConnectorSchema,
|
|
185063
|
+
LinkedInConnectorSchema,
|
|
185064
|
+
TikTokConnectorSchema,
|
|
185065
|
+
GenericConnectorSchema
|
|
185066
|
+
]);
|
|
185067
|
+
var KnownIntegrationTypes = [
|
|
185068
|
+
"googlecalendar",
|
|
185069
|
+
"googledrive",
|
|
185070
|
+
"gmail",
|
|
185071
|
+
"googlesheets",
|
|
185072
|
+
"googledocs",
|
|
185073
|
+
"googleslides",
|
|
185074
|
+
"slack",
|
|
185075
|
+
"notion",
|
|
185076
|
+
"salesforce",
|
|
185077
|
+
"hubspot",
|
|
185078
|
+
"linkedin",
|
|
185079
|
+
"tiktok"
|
|
185080
|
+
];
|
|
185081
|
+
var IntegrationTypeSchema = exports_external.union([
|
|
185082
|
+
exports_external.enum(KnownIntegrationTypes),
|
|
185083
|
+
CustomTypeSchema
|
|
185084
|
+
]);
|
|
185085
|
+
var ConnectorStatusSchema = exports_external.enum(["active", "disconnected", "expired"]);
|
|
185086
|
+
var UpstreamConnectorSchema = exports_external.object({
|
|
185087
|
+
integration_type: IntegrationTypeSchema,
|
|
185088
|
+
status: ConnectorStatusSchema,
|
|
185089
|
+
scopes: exports_external.array(exports_external.string()),
|
|
185090
|
+
user_email: exports_external.string().optional()
|
|
185091
|
+
});
|
|
185092
|
+
var ListConnectorsResponseSchema = exports_external.object({
|
|
185093
|
+
integrations: exports_external.array(UpstreamConnectorSchema)
|
|
185094
|
+
}).transform((data) => ({
|
|
185095
|
+
integrations: data.integrations.map((i) => ({
|
|
185096
|
+
integrationType: i.integration_type,
|
|
185097
|
+
status: i.status,
|
|
185098
|
+
scopes: i.scopes,
|
|
185099
|
+
userEmail: i.user_email
|
|
185100
|
+
}))
|
|
185101
|
+
}));
|
|
185102
|
+
var SetConnectorResponseSchema = exports_external.object({
|
|
185103
|
+
redirect_url: exports_external.string().nullable(),
|
|
185104
|
+
connection_id: exports_external.string().nullable(),
|
|
185105
|
+
already_authorized: exports_external.boolean(),
|
|
185106
|
+
error: exports_external.string().nullable(),
|
|
185107
|
+
error_message: exports_external.string().nullable(),
|
|
185108
|
+
other_user_email: exports_external.string().nullable()
|
|
185109
|
+
}).transform((data) => ({
|
|
185110
|
+
redirectUrl: data.redirect_url,
|
|
185111
|
+
connectionId: data.connection_id,
|
|
185112
|
+
alreadyAuthorized: data.already_authorized,
|
|
185113
|
+
error: data.error,
|
|
185114
|
+
errorMessage: data.error_message,
|
|
185115
|
+
otherUserEmail: data.other_user_email
|
|
185116
|
+
}));
|
|
185117
|
+
var ConnectorOAuthStatusSchema = exports_external.enum([
|
|
185118
|
+
"ACTIVE",
|
|
185119
|
+
"FAILED",
|
|
185120
|
+
"PENDING"
|
|
185121
|
+
]);
|
|
185122
|
+
var OAuthStatusResponseSchema = exports_external.object({
|
|
185123
|
+
status: ConnectorOAuthStatusSchema
|
|
185124
|
+
});
|
|
185125
|
+
var RemoveConnectorResponseSchema = exports_external.object({
|
|
185126
|
+
status: exports_external.literal("removed"),
|
|
185127
|
+
integration_type: IntegrationTypeSchema
|
|
185128
|
+
}).transform((data) => ({
|
|
185129
|
+
status: data.status,
|
|
185130
|
+
integrationType: data.integration_type
|
|
185131
|
+
}));
|
|
185132
|
+
|
|
185133
|
+
// src/core/resources/connector/api.ts
|
|
185134
|
+
async function listConnectors() {
|
|
185135
|
+
const appClient = getAppClient();
|
|
185136
|
+
let response;
|
|
185137
|
+
try {
|
|
185138
|
+
response = await appClient.get("external-auth/list");
|
|
185139
|
+
} catch (error48) {
|
|
185140
|
+
throw await ApiError.fromHttpError(error48, "listing connectors");
|
|
185141
|
+
}
|
|
185142
|
+
const result = ListConnectorsResponseSchema.safeParse(await response.json());
|
|
185143
|
+
if (!result.success) {
|
|
185144
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
185145
|
+
}
|
|
185146
|
+
return result.data;
|
|
185147
|
+
}
|
|
185148
|
+
async function setConnector(integrationType, scopes) {
|
|
185149
|
+
const appClient = getAppClient();
|
|
185150
|
+
let response;
|
|
185151
|
+
try {
|
|
185152
|
+
response = await appClient.put(`external-auth/integrations/${integrationType}`, {
|
|
185153
|
+
json: {
|
|
185154
|
+
scopes
|
|
185155
|
+
}
|
|
185156
|
+
});
|
|
185157
|
+
} catch (error48) {
|
|
185158
|
+
throw await ApiError.fromHttpError(error48, "setting connector");
|
|
185159
|
+
}
|
|
185160
|
+
const result = SetConnectorResponseSchema.safeParse(await response.json());
|
|
185161
|
+
if (!result.success) {
|
|
185162
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
185163
|
+
}
|
|
185164
|
+
return result.data;
|
|
185165
|
+
}
|
|
185166
|
+
async function getOAuthStatus(integrationType, connectionId) {
|
|
185167
|
+
const appClient = getAppClient();
|
|
185168
|
+
let response;
|
|
185169
|
+
try {
|
|
185170
|
+
response = await appClient.get("external-auth/status", {
|
|
185171
|
+
searchParams: {
|
|
185172
|
+
integration_type: integrationType,
|
|
185173
|
+
connection_id: connectionId
|
|
185174
|
+
}
|
|
185175
|
+
});
|
|
185176
|
+
} catch (error48) {
|
|
185177
|
+
throw await ApiError.fromHttpError(error48, "checking OAuth status");
|
|
185178
|
+
}
|
|
185179
|
+
const result = OAuthStatusResponseSchema.safeParse(await response.json());
|
|
185180
|
+
if (!result.success) {
|
|
185181
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
185182
|
+
}
|
|
185183
|
+
return result.data;
|
|
185184
|
+
}
|
|
185185
|
+
async function removeConnector(integrationType) {
|
|
185186
|
+
const appClient = getAppClient();
|
|
185187
|
+
let response;
|
|
185188
|
+
try {
|
|
185189
|
+
response = await appClient.delete(`external-auth/integrations/${integrationType}/remove`);
|
|
185190
|
+
} catch (error48) {
|
|
185191
|
+
throw await ApiError.fromHttpError(error48, "removing connector");
|
|
185192
|
+
}
|
|
185193
|
+
const result = RemoveConnectorResponseSchema.safeParse(await response.json());
|
|
185194
|
+
if (!result.success) {
|
|
185195
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
185196
|
+
}
|
|
185197
|
+
return result.data;
|
|
185198
|
+
}
|
|
185199
|
+
// src/core/resources/connector/config.ts
|
|
185200
|
+
async function readConnectorFile(connectorPath) {
|
|
185201
|
+
const parsed = await readJsonFile(connectorPath);
|
|
185202
|
+
const result = ConnectorResourceSchema.safeParse(parsed);
|
|
185203
|
+
if (!result.success) {
|
|
185204
|
+
throw new SchemaValidationError("Invalid connector file", result.error, connectorPath);
|
|
185205
|
+
}
|
|
185206
|
+
return result.data;
|
|
185207
|
+
}
|
|
185208
|
+
async function readAllConnectors(connectorsDir) {
|
|
185209
|
+
if (!await pathExists(connectorsDir)) {
|
|
185210
|
+
return [];
|
|
185211
|
+
}
|
|
185212
|
+
const files = await globby(`*.${CONFIG_FILE_EXTENSION_GLOB}`, {
|
|
185213
|
+
cwd: connectorsDir,
|
|
185214
|
+
absolute: true
|
|
185215
|
+
});
|
|
185216
|
+
const connectors = await Promise.all(files.map((filePath) => readConnectorFile(filePath)));
|
|
185217
|
+
assertNoDuplicateConnectors(connectors);
|
|
185218
|
+
return connectors;
|
|
185219
|
+
}
|
|
185220
|
+
function assertNoDuplicateConnectors(connectors) {
|
|
185221
|
+
const types = new Set;
|
|
185222
|
+
for (const connector of connectors) {
|
|
185223
|
+
if (types.has(connector.type)) {
|
|
185224
|
+
throw new InvalidInputError(`Duplicate connector type "${connector.type}"`, {
|
|
185225
|
+
hints: [
|
|
185226
|
+
{
|
|
185227
|
+
message: `Remove duplicate connectors with type "${connector.type}" - only one connector per type is allowed`
|
|
185228
|
+
}
|
|
185229
|
+
]
|
|
185230
|
+
});
|
|
185231
|
+
}
|
|
185232
|
+
types.add(connector.type);
|
|
185233
|
+
}
|
|
185234
|
+
}
|
|
185235
|
+
// src/core/resources/connector/push.ts
|
|
185236
|
+
async function pushConnectors(connectors) {
|
|
185237
|
+
const results = [];
|
|
185238
|
+
const upstream = await listConnectors();
|
|
185239
|
+
const localTypes = new Set(connectors.map((c) => c.type));
|
|
185240
|
+
for (const connector of connectors) {
|
|
185241
|
+
try {
|
|
185242
|
+
const response = await setConnector(connector.type, connector.scopes ?? []);
|
|
185243
|
+
results.push(getConnectorSyncResult(connector.type, response));
|
|
185244
|
+
} catch (err) {
|
|
185245
|
+
results.push({
|
|
185246
|
+
type: connector.type,
|
|
185247
|
+
action: "error",
|
|
185248
|
+
error: err instanceof Error ? err.message : String(err)
|
|
185249
|
+
});
|
|
185250
|
+
}
|
|
185251
|
+
}
|
|
185252
|
+
for (const upstreamConnector of upstream.integrations) {
|
|
185253
|
+
if (!localTypes.has(upstreamConnector.integrationType)) {
|
|
185254
|
+
try {
|
|
185255
|
+
await removeConnector(upstreamConnector.integrationType);
|
|
185256
|
+
results.push({
|
|
185257
|
+
type: upstreamConnector.integrationType,
|
|
185258
|
+
action: "removed"
|
|
185259
|
+
});
|
|
185260
|
+
} catch (err) {
|
|
185261
|
+
results.push({
|
|
185262
|
+
type: upstreamConnector.integrationType,
|
|
185263
|
+
action: "error",
|
|
185264
|
+
error: err instanceof Error ? err.message : String(err)
|
|
185265
|
+
});
|
|
185266
|
+
}
|
|
185267
|
+
}
|
|
185268
|
+
}
|
|
185269
|
+
return { results };
|
|
185270
|
+
}
|
|
185271
|
+
function getConnectorSyncResult(type, response) {
|
|
185272
|
+
if (response.error === "different_user") {
|
|
185273
|
+
return {
|
|
185274
|
+
type,
|
|
185275
|
+
action: "error",
|
|
185276
|
+
error: response.errorMessage || `Already connected by ${response.otherUserEmail ?? "another user"}`
|
|
185277
|
+
};
|
|
185278
|
+
}
|
|
185279
|
+
if (response.alreadyAuthorized) {
|
|
185280
|
+
return { type, action: "synced" };
|
|
185281
|
+
}
|
|
185282
|
+
if (response.redirectUrl) {
|
|
185283
|
+
return {
|
|
185284
|
+
type,
|
|
185285
|
+
action: "needs_oauth",
|
|
185286
|
+
redirectUrl: response.redirectUrl,
|
|
185287
|
+
connectionId: response.connectionId ?? undefined
|
|
185288
|
+
};
|
|
185289
|
+
}
|
|
185290
|
+
return { type, action: "synced" };
|
|
185291
|
+
}
|
|
185292
|
+
// src/core/resources/connector/resource.ts
|
|
185293
|
+
var connectorResource = {
|
|
185294
|
+
readAll: readAllConnectors,
|
|
185295
|
+
push: pushConnectors
|
|
185296
|
+
};
|
|
184997
185297
|
// src/core/resources/entity/schema.ts
|
|
184998
185298
|
var FieldConditionSchema = exports_external.union([
|
|
184999
185299
|
exports_external.string(),
|
|
@@ -185281,9 +185581,9 @@ async function readFunctionConfig(configPath) {
|
|
|
185281
185581
|
return result.data;
|
|
185282
185582
|
}
|
|
185283
185583
|
async function readFunction(configPath) {
|
|
185284
|
-
const
|
|
185584
|
+
const config5 = await readFunctionConfig(configPath);
|
|
185285
185585
|
const functionDir = dirname4(configPath);
|
|
185286
|
-
const entryPath = join4(functionDir,
|
|
185586
|
+
const entryPath = join4(functionDir, config5.entry);
|
|
185287
185587
|
if (!await pathExists(entryPath)) {
|
|
185288
185588
|
throw new FileNotFoundError(`Function entry file not found: ${entryPath} (referenced in ${configPath})`);
|
|
185289
185589
|
}
|
|
@@ -185291,7 +185591,7 @@ async function readFunction(configPath) {
|
|
|
185291
185591
|
cwd: functionDir,
|
|
185292
185592
|
absolute: true
|
|
185293
185593
|
});
|
|
185294
|
-
const functionData = { ...
|
|
185594
|
+
const functionData = { ...config5, entryPath, filePaths };
|
|
185295
185595
|
return functionData;
|
|
185296
185596
|
}
|
|
185297
185597
|
async function readAllFunctions(functionsDir) {
|
|
@@ -185371,16 +185671,18 @@ async function readProjectConfig(projectRoot) {
|
|
|
185371
185671
|
}
|
|
185372
185672
|
const project = result.data;
|
|
185373
185673
|
const configDir = dirname5(configPath);
|
|
185374
|
-
const [entities, functions, agents] = await Promise.all([
|
|
185674
|
+
const [entities, functions, agents, connectors] = await Promise.all([
|
|
185375
185675
|
entityResource.readAll(join5(configDir, project.entitiesDir)),
|
|
185376
185676
|
functionResource.readAll(join5(configDir, project.functionsDir)),
|
|
185377
|
-
agentResource.readAll(join5(configDir, project.agentsDir))
|
|
185677
|
+
agentResource.readAll(join5(configDir, project.agentsDir)),
|
|
185678
|
+
connectorResource.readAll(join5(configDir, project.connectorsDir))
|
|
185378
185679
|
]);
|
|
185379
185680
|
return {
|
|
185380
185681
|
project: { ...project, root, configPath },
|
|
185381
185682
|
entities,
|
|
185382
185683
|
functions,
|
|
185383
|
-
agents
|
|
185684
|
+
agents,
|
|
185685
|
+
connectors
|
|
185384
185686
|
};
|
|
185385
185687
|
}
|
|
185386
185688
|
|
|
@@ -185405,9 +185707,9 @@ async function initAppConfig() {
|
|
|
185405
185707
|
if (!projectRoot) {
|
|
185406
185708
|
throw new ConfigNotFoundError("No Base44 project found. Run this command from a project directory with a config.jsonc file.");
|
|
185407
185709
|
}
|
|
185408
|
-
const
|
|
185710
|
+
const config6 = await readAppConfig(projectRoot.root);
|
|
185409
185711
|
const appConfigPath = await findAppConfigPath(projectRoot.root);
|
|
185410
|
-
if (!
|
|
185712
|
+
if (!config6?.id) {
|
|
185411
185713
|
throw new ConfigInvalidError("App not configured. Create a .app.jsonc file or run 'base44 link' to link this project.", appConfigPath, {
|
|
185412
185714
|
hints: [
|
|
185413
185715
|
{
|
|
@@ -185417,7 +185719,7 @@ async function initAppConfig() {
|
|
|
185417
185719
|
]
|
|
185418
185720
|
});
|
|
185419
185721
|
}
|
|
185420
|
-
cache2 = { projectRoot: projectRoot.root, id:
|
|
185722
|
+
cache2 = { projectRoot: projectRoot.root, id: config6.id };
|
|
185421
185723
|
return cache2;
|
|
185422
185724
|
}
|
|
185423
185725
|
function getAppConfig() {
|
|
@@ -185426,8 +185728,8 @@ function getAppConfig() {
|
|
|
185426
185728
|
}
|
|
185427
185729
|
return cache2;
|
|
185428
185730
|
}
|
|
185429
|
-
function setAppConfig(
|
|
185430
|
-
cache2 =
|
|
185731
|
+
function setAppConfig(config6) {
|
|
185732
|
+
cache2 = config6;
|
|
185431
185733
|
}
|
|
185432
185734
|
function generateAppConfigContent(id) {
|
|
185433
185735
|
return `// Base44 App Configuration
|
|
@@ -185681,6 +185983,7 @@ async function handleUnauthorized(request, _options, response) {
|
|
|
185681
185983
|
}
|
|
185682
185984
|
var base44Client = distribution_default.create({
|
|
185683
185985
|
prefixUrl: getBase44ApiUrl(),
|
|
185986
|
+
timeout: 180000,
|
|
185684
185987
|
headers: {
|
|
185685
185988
|
"User-Agent": "Base44 CLI"
|
|
185686
185989
|
},
|
|
@@ -193990,6 +194293,129 @@ defineLazyProperty(apps, "safari", () => detectPlatformBinary({
|
|
|
193990
194293
|
}));
|
|
193991
194294
|
var open_default = open;
|
|
193992
194295
|
|
|
194296
|
+
// src/cli/commands/connectors/push.ts
|
|
194297
|
+
function isPendingOAuth(r2) {
|
|
194298
|
+
return r2.action === "needs_oauth" && !!r2.redirectUrl && !!r2.connectionId;
|
|
194299
|
+
}
|
|
194300
|
+
function printSummary(results, oauthOutcomes) {
|
|
194301
|
+
const synced = [];
|
|
194302
|
+
const added = [];
|
|
194303
|
+
const removed = [];
|
|
194304
|
+
const failed = [];
|
|
194305
|
+
for (const r2 of results) {
|
|
194306
|
+
const oauthStatus = oauthOutcomes.get(r2.type);
|
|
194307
|
+
if (r2.action === "synced") {
|
|
194308
|
+
synced.push(r2.type);
|
|
194309
|
+
} else if (r2.action === "removed") {
|
|
194310
|
+
removed.push(r2.type);
|
|
194311
|
+
} else if (r2.action === "error") {
|
|
194312
|
+
failed.push({ type: r2.type, error: r2.error });
|
|
194313
|
+
} else if (r2.action === "needs_oauth") {
|
|
194314
|
+
if (oauthStatus === "ACTIVE") {
|
|
194315
|
+
added.push(r2.type);
|
|
194316
|
+
} else if (oauthStatus === "PENDING") {
|
|
194317
|
+
failed.push({ type: r2.type, error: "authorization timed out" });
|
|
194318
|
+
} else if (oauthStatus === "FAILED") {
|
|
194319
|
+
failed.push({ type: r2.type, error: "authorization failed" });
|
|
194320
|
+
} else {
|
|
194321
|
+
failed.push({ type: r2.type, error: "needs authorization" });
|
|
194322
|
+
}
|
|
194323
|
+
}
|
|
194324
|
+
}
|
|
194325
|
+
M2.info("");
|
|
194326
|
+
M2.info(theme.styles.bold("Summary:"));
|
|
194327
|
+
if (synced.length > 0) {
|
|
194328
|
+
M2.success(`Synced: ${synced.join(", ")}`);
|
|
194329
|
+
}
|
|
194330
|
+
if (added.length > 0) {
|
|
194331
|
+
M2.success(`Added: ${added.join(", ")}`);
|
|
194332
|
+
}
|
|
194333
|
+
if (removed.length > 0) {
|
|
194334
|
+
M2.info(theme.styles.dim(`Removed: ${removed.join(", ")}`));
|
|
194335
|
+
}
|
|
194336
|
+
for (const r2 of failed) {
|
|
194337
|
+
M2.error(`Failed: ${r2.type}${r2.error ? ` - ${r2.error}` : ""}`);
|
|
194338
|
+
}
|
|
194339
|
+
}
|
|
194340
|
+
async function pushConnectorsAction() {
|
|
194341
|
+
const { connectors } = await readProjectConfig();
|
|
194342
|
+
if (connectors.length === 0) {
|
|
194343
|
+
M2.info("No local connectors found - checking for remote connectors to remove");
|
|
194344
|
+
} else {
|
|
194345
|
+
const connectorNames = connectors.map((c3) => c3.type).join(", ");
|
|
194346
|
+
M2.info(`Found ${connectors.length} connectors to push: ${connectorNames}`);
|
|
194347
|
+
}
|
|
194348
|
+
const { results } = await runTask("Pushing connectors to Base44", async () => {
|
|
194349
|
+
return await pushConnectors(connectors);
|
|
194350
|
+
});
|
|
194351
|
+
const oauthOutcomes = new Map;
|
|
194352
|
+
const needsOAuth = results.filter(isPendingOAuth);
|
|
194353
|
+
let outroMessage = "Connectors pushed to Base44";
|
|
194354
|
+
if (needsOAuth.length === 0) {
|
|
194355
|
+
printSummary(results, oauthOutcomes);
|
|
194356
|
+
return { outroMessage };
|
|
194357
|
+
}
|
|
194358
|
+
M2.warn(`${needsOAuth.length} connector(s) require authorization in your browser:`);
|
|
194359
|
+
for (const connector2 of needsOAuth) {
|
|
194360
|
+
M2.info(` '${connector2.type}': ${theme.styles.dim(connector2.redirectUrl)}`);
|
|
194361
|
+
}
|
|
194362
|
+
const pending = needsOAuth.map((c3) => c3.type).join(", ");
|
|
194363
|
+
if (process.env.CI) {
|
|
194364
|
+
outroMessage = `Skipped OAuth in CI. Pending: ${pending}. Run 'base44 connectors push' locally to authorize.`;
|
|
194365
|
+
} else {
|
|
194366
|
+
const shouldAuth = await ye({
|
|
194367
|
+
message: "Open browser to authorize now?"
|
|
194368
|
+
});
|
|
194369
|
+
if (pD(shouldAuth) || !shouldAuth) {
|
|
194370
|
+
outroMessage = `Authorization skipped. Pending: ${pending}. Run 'base44 connectors push' again to complete.`;
|
|
194371
|
+
} else {
|
|
194372
|
+
for (const connector2 of needsOAuth) {
|
|
194373
|
+
try {
|
|
194374
|
+
M2.info(`
|
|
194375
|
+
Opening browser for '${connector2.type}'...`);
|
|
194376
|
+
await open_default(connector2.redirectUrl);
|
|
194377
|
+
let finalStatus = "PENDING";
|
|
194378
|
+
await runTask(`Waiting for '${connector2.type}' authorization...`, async () => {
|
|
194379
|
+
await pWaitFor(async () => {
|
|
194380
|
+
const response = await getOAuthStatus(connector2.type, connector2.connectionId);
|
|
194381
|
+
finalStatus = response.status;
|
|
194382
|
+
return response.status !== "PENDING";
|
|
194383
|
+
}, {
|
|
194384
|
+
interval: 2000,
|
|
194385
|
+
timeout: 2 * 60 * 1000
|
|
194386
|
+
});
|
|
194387
|
+
}, {
|
|
194388
|
+
successMessage: `'${connector2.type}' authorization complete`,
|
|
194389
|
+
errorMessage: `'${connector2.type}' authorization failed`
|
|
194390
|
+
}).catch((err) => {
|
|
194391
|
+
if (err instanceof TimeoutError2) {
|
|
194392
|
+
finalStatus = "PENDING";
|
|
194393
|
+
} else {
|
|
194394
|
+
throw err;
|
|
194395
|
+
}
|
|
194396
|
+
});
|
|
194397
|
+
oauthOutcomes.set(connector2.type, finalStatus);
|
|
194398
|
+
} catch (err) {
|
|
194399
|
+
M2.error(`Failed to authorize '${connector2.type}': ${err instanceof Error ? err.message : String(err)}`);
|
|
194400
|
+
oauthOutcomes.set(connector2.type, "FAILED");
|
|
194401
|
+
}
|
|
194402
|
+
}
|
|
194403
|
+
}
|
|
194404
|
+
}
|
|
194405
|
+
printSummary(results, oauthOutcomes);
|
|
194406
|
+
return { outroMessage };
|
|
194407
|
+
}
|
|
194408
|
+
function getConnectorsPushCommand(context) {
|
|
194409
|
+
return new Command("push").description("Push local connectors to Base44 (overwrites connectors on Base44)").action(async () => {
|
|
194410
|
+
await runCommand(pushConnectorsAction, { requireAuth: true }, context);
|
|
194411
|
+
});
|
|
194412
|
+
}
|
|
194413
|
+
|
|
194414
|
+
// src/cli/commands/connectors/index.ts
|
|
194415
|
+
function getConnectorsCommand(context) {
|
|
194416
|
+
return new Command("connectors").description("Manage project connectors (OAuth integrations)").addCommand(getConnectorsPushCommand(context));
|
|
194417
|
+
}
|
|
194418
|
+
|
|
193993
194419
|
// src/cli/commands/dashboard/open.ts
|
|
193994
194420
|
async function openDashboard() {
|
|
193995
194421
|
const dashboardUrl = getDashboardUrl();
|
|
@@ -194569,9 +194995,9 @@ async function generateContent(input) {
|
|
|
194569
194995
|
`);
|
|
194570
194996
|
}
|
|
194571
194997
|
async function compileEntity(entity2) {
|
|
194572
|
-
const { name: name2, ...
|
|
194998
|
+
const { name: name2, ...schema8 } = entity2;
|
|
194573
194999
|
const jsonSchema = {
|
|
194574
|
-
...
|
|
195000
|
+
...schema8,
|
|
194575
195001
|
title: name2,
|
|
194576
195002
|
additionalProperties: false
|
|
194577
195003
|
};
|
|
@@ -194666,8 +195092,8 @@ var getLocalHosts = () => {
|
|
|
194666
195092
|
const interfaces = os9.networkInterfaces();
|
|
194667
195093
|
const results = new Set([undefined, "0.0.0.0"]);
|
|
194668
195094
|
for (const _interface of Object.values(interfaces)) {
|
|
194669
|
-
for (const
|
|
194670
|
-
results.add(
|
|
195095
|
+
for (const config10 of _interface) {
|
|
195096
|
+
results.add(config10.address);
|
|
194671
195097
|
}
|
|
194672
195098
|
}
|
|
194673
195099
|
return results;
|
|
@@ -194927,6 +195353,7 @@ function createProgram(context) {
|
|
|
194927
195353
|
program2.addCommand(getEjectCommand(context));
|
|
194928
195354
|
program2.addCommand(getEntitiesPushCommand(context));
|
|
194929
195355
|
program2.addCommand(getAgentsCommand(context));
|
|
195356
|
+
program2.addCommand(getConnectorsCommand(context));
|
|
194930
195357
|
program2.addCommand(getFunctionsDeployCommand(context));
|
|
194931
195358
|
program2.addCommand(getSiteCommand(context));
|
|
194932
195359
|
program2.addCommand(getTypesCommand(context), { hidden: true });
|
|
@@ -199197,4 +199624,4 @@ export {
|
|
|
199197
199624
|
CLIExitError
|
|
199198
199625
|
};
|
|
199199
199626
|
|
|
199200
|
-
//# debugId=
|
|
199627
|
+
//# debugId=7A9ABB53BDDC483064756E2164756E21
|