@base44-preview/cli 0.1.3-pr.565.21ee30e → 0.1.4-pr.567.1086443
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
CHANGED
|
@@ -12982,8 +12982,8 @@ var require_ejs = __commonJS((exports) => {
|
|
|
12982
12982
|
exports.resolveInclude = function(name2, filename, isDir) {
|
|
12983
12983
|
var dirname9 = path11.dirname;
|
|
12984
12984
|
var extname = path11.extname;
|
|
12985
|
-
var
|
|
12986
|
-
var includePath =
|
|
12985
|
+
var resolve3 = path11.resolve;
|
|
12986
|
+
var includePath = resolve3(isDir ? filename : dirname9(filename), name2);
|
|
12987
12987
|
var ext = extname(name2);
|
|
12988
12988
|
if (!ext) {
|
|
12989
12989
|
includePath += ".ejs";
|
|
@@ -13058,10 +13058,10 @@ var require_ejs = __commonJS((exports) => {
|
|
|
13058
13058
|
var result;
|
|
13059
13059
|
if (!cb) {
|
|
13060
13060
|
if (typeof exports.promiseImpl == "function") {
|
|
13061
|
-
return new exports.promiseImpl(function(
|
|
13061
|
+
return new exports.promiseImpl(function(resolve3, reject) {
|
|
13062
13062
|
try {
|
|
13063
13063
|
result = handleCache(options)(data);
|
|
13064
|
-
|
|
13064
|
+
resolve3(result);
|
|
13065
13065
|
} catch (err) {
|
|
13066
13066
|
reject(err);
|
|
13067
13067
|
}
|
|
@@ -16499,12 +16499,12 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
16499
16499
|
if (typeof Promise !== "function") {
|
|
16500
16500
|
throw new TypeError("callback not provided");
|
|
16501
16501
|
}
|
|
16502
|
-
return new Promise(function(
|
|
16502
|
+
return new Promise(function(resolve4, reject) {
|
|
16503
16503
|
isexe(path11, options || {}, function(er, is) {
|
|
16504
16504
|
if (er) {
|
|
16505
16505
|
reject(er);
|
|
16506
16506
|
} else {
|
|
16507
|
-
|
|
16507
|
+
resolve4(is);
|
|
16508
16508
|
}
|
|
16509
16509
|
});
|
|
16510
16510
|
});
|
|
@@ -16566,27 +16566,27 @@ var require_which = __commonJS((exports, module) => {
|
|
|
16566
16566
|
opt = {};
|
|
16567
16567
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
16568
16568
|
const found = [];
|
|
16569
|
-
const step = (i) => new Promise((
|
|
16569
|
+
const step = (i) => new Promise((resolve4, reject) => {
|
|
16570
16570
|
if (i === pathEnv.length)
|
|
16571
|
-
return opt.all && found.length ?
|
|
16571
|
+
return opt.all && found.length ? resolve4(found) : reject(getNotFoundError(cmd));
|
|
16572
16572
|
const ppRaw = pathEnv[i];
|
|
16573
16573
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
16574
16574
|
const pCmd = path11.join(pathPart, cmd);
|
|
16575
16575
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
16576
|
-
|
|
16576
|
+
resolve4(subStep(p, i, 0));
|
|
16577
16577
|
});
|
|
16578
|
-
const subStep = (p, i, ii) => new Promise((
|
|
16578
|
+
const subStep = (p, i, ii) => new Promise((resolve4, reject) => {
|
|
16579
16579
|
if (ii === pathExt.length)
|
|
16580
|
-
return
|
|
16580
|
+
return resolve4(step(i + 1));
|
|
16581
16581
|
const ext = pathExt[ii];
|
|
16582
16582
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
16583
16583
|
if (!er && is) {
|
|
16584
16584
|
if (opt.all)
|
|
16585
16585
|
found.push(p + ext);
|
|
16586
16586
|
else
|
|
16587
|
-
return
|
|
16587
|
+
return resolve4(p + ext);
|
|
16588
16588
|
}
|
|
16589
|
-
return
|
|
16589
|
+
return resolve4(subStep(p, i, ii + 1));
|
|
16590
16590
|
});
|
|
16591
16591
|
});
|
|
16592
16592
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -119560,11 +119560,11 @@ function chooseDescription(descriptions, printWidth) {
|
|
|
119560
119560
|
return firstWidth > printWidth && firstWidth > secondWidth ? secondDescription : firstDescription;
|
|
119561
119561
|
}
|
|
119562
119562
|
function createSchema(SchemaConstructor, parameters) {
|
|
119563
|
-
const
|
|
119564
|
-
const subSchema = Object.create(
|
|
119563
|
+
const schema11 = new SchemaConstructor(parameters);
|
|
119564
|
+
const subSchema = Object.create(schema11);
|
|
119565
119565
|
for (const handlerKey of HANDLER_KEYS) {
|
|
119566
119566
|
if (handlerKey in parameters) {
|
|
119567
|
-
subSchema[handlerKey] = normalizeHandler(parameters[handlerKey],
|
|
119567
|
+
subSchema[handlerKey] = normalizeHandler(parameters[handlerKey], schema11, Schema2.prototype[handlerKey].length);
|
|
119568
119568
|
}
|
|
119569
119569
|
}
|
|
119570
119570
|
return subSchema;
|
|
@@ -122904,9 +122904,9 @@ function optionInfoToSchema(optionInfo, {
|
|
|
122904
122904
|
throw new Error(`Unexpected type ${optionInfo.type}`);
|
|
122905
122905
|
}
|
|
122906
122906
|
if (optionInfo.exception) {
|
|
122907
|
-
parameters.validate = (value,
|
|
122907
|
+
parameters.validate = (value, schema11, utils3) => optionInfo.exception(value) || schema11.validate(value, utils3);
|
|
122908
122908
|
} else {
|
|
122909
|
-
parameters.validate = (value,
|
|
122909
|
+
parameters.validate = (value, schema11, utils3) => value === undefined || schema11.validate(value, utils3);
|
|
122910
122910
|
}
|
|
122911
122911
|
if (optionInfo.redirect) {
|
|
122912
122912
|
handlers.redirect = (value) => !value ? undefined : {
|
|
@@ -122921,7 +122921,7 @@ function optionInfoToSchema(optionInfo, {
|
|
|
122921
122921
|
}
|
|
122922
122922
|
if (isCLI && !optionInfo.array) {
|
|
122923
122923
|
const originalPreprocess = parameters.preprocess || ((x10) => x10);
|
|
122924
|
-
parameters.preprocess = (value,
|
|
122924
|
+
parameters.preprocess = (value, schema11, utils3) => schema11.preprocess(originalPreprocess(Array.isArray(value) ? method_at_default2(0, value, -1) : value), utils3);
|
|
122925
122925
|
}
|
|
122926
122926
|
return optionInfo.array ? ArraySchema.create({
|
|
122927
122927
|
...isCLI ? {
|
|
@@ -124498,9 +124498,9 @@ var require2, __filename2, __dirname3, __create2, __defProp3, __getOwnPropDesc,
|
|
|
124498
124498
|
};
|
|
124499
124499
|
applyNormalization();
|
|
124500
124500
|
for (const key2 of Object.keys(this._utils.schemas)) {
|
|
124501
|
-
const
|
|
124501
|
+
const schema11 = this._utils.schemas[key2];
|
|
124502
124502
|
if (!(key2 in newOptions)) {
|
|
124503
|
-
const defaultResult = normalizeDefaultResult(
|
|
124503
|
+
const defaultResult = normalizeDefaultResult(schema11.default(this._utils));
|
|
124504
124504
|
if ("value" in defaultResult) {
|
|
124505
124505
|
restOptionsArray.push({ [key2]: defaultResult.value });
|
|
124506
124506
|
}
|
|
@@ -124511,13 +124511,13 @@ var require2, __filename2, __dirname3, __create2, __defProp3, __getOwnPropDesc,
|
|
|
124511
124511
|
if (!(key2 in newOptions)) {
|
|
124512
124512
|
continue;
|
|
124513
124513
|
}
|
|
124514
|
-
const
|
|
124514
|
+
const schema11 = this._utils.schemas[key2];
|
|
124515
124515
|
const value = newOptions[key2];
|
|
124516
|
-
const newValue =
|
|
124516
|
+
const newValue = schema11.postprocess(value, this._utils);
|
|
124517
124517
|
if (newValue === VALUE_UNCHANGED) {
|
|
124518
124518
|
continue;
|
|
124519
124519
|
}
|
|
124520
|
-
this._applyValidation(newValue, key2,
|
|
124520
|
+
this._applyValidation(newValue, key2, schema11);
|
|
124521
124521
|
newOptions[key2] = newValue;
|
|
124522
124522
|
}
|
|
124523
124523
|
this._applyPostprocess(newOptions);
|
|
@@ -124528,14 +124528,14 @@ var require2, __filename2, __dirname3, __create2, __defProp3, __getOwnPropDesc,
|
|
|
124528
124528
|
const transferredOptionsArray = [];
|
|
124529
124529
|
const { knownKeys, unknownKeys } = this._partitionOptionKeys(options8);
|
|
124530
124530
|
for (const key2 of knownKeys) {
|
|
124531
|
-
const
|
|
124532
|
-
const value =
|
|
124533
|
-
this._applyValidation(value, key2,
|
|
124531
|
+
const schema11 = this._utils.schemas[key2];
|
|
124532
|
+
const value = schema11.preprocess(options8[key2], this._utils);
|
|
124533
|
+
this._applyValidation(value, key2, schema11);
|
|
124534
124534
|
const appendTransferredOptions = ({ from, to: to5 }) => {
|
|
124535
124535
|
transferredOptionsArray.push(typeof to5 === "string" ? { [to5]: from } : { [to5.key]: to5.value });
|
|
124536
124536
|
};
|
|
124537
124537
|
const warnDeprecated = ({ value: currentValue, redirectTo }) => {
|
|
124538
|
-
const deprecatedResult = normalizeDeprecatedResult(
|
|
124538
|
+
const deprecatedResult = normalizeDeprecatedResult(schema11.deprecated(currentValue, this._utils), value, true);
|
|
124539
124539
|
if (deprecatedResult === false) {
|
|
124540
124540
|
return;
|
|
124541
124541
|
}
|
|
@@ -124553,13 +124553,13 @@ var require2, __filename2, __dirname3, __create2, __defProp3, __getOwnPropDesc,
|
|
|
124553
124553
|
}
|
|
124554
124554
|
}
|
|
124555
124555
|
};
|
|
124556
|
-
const forwardResult = normalizeForwardResult(
|
|
124556
|
+
const forwardResult = normalizeForwardResult(schema11.forward(value, this._utils), value);
|
|
124557
124557
|
forwardResult.forEach(appendTransferredOptions);
|
|
124558
|
-
const redirectResult = normalizeRedirectResult(
|
|
124558
|
+
const redirectResult = normalizeRedirectResult(schema11.redirect(value, this._utils), value);
|
|
124559
124559
|
redirectResult.redirect.forEach(appendTransferredOptions);
|
|
124560
124560
|
if ("remain" in redirectResult) {
|
|
124561
124561
|
const remainingValue = redirectResult.remain;
|
|
124562
|
-
newOptions[key2] = key2 in newOptions ?
|
|
124562
|
+
newOptions[key2] = key2 in newOptions ? schema11.overlap(newOptions[key2], remainingValue, this._utils) : remainingValue;
|
|
124563
124563
|
warnDeprecated({ value: remainingValue });
|
|
124564
124564
|
}
|
|
124565
124565
|
for (const { from, to: to5 } of redirectResult.redirect) {
|
|
@@ -124587,8 +124587,8 @@ var require2, __filename2, __dirname3, __create2, __defProp3, __getOwnPropDesc,
|
|
|
124587
124587
|
const [knownKeys, unknownKeys] = partition(Object.keys(options8).filter((key2) => !this._identifyMissing(key2, options8)), (key2) => (key2 in this._utils.schemas));
|
|
124588
124588
|
return { knownKeys, unknownKeys };
|
|
124589
124589
|
}
|
|
124590
|
-
_applyValidation(value, key2,
|
|
124591
|
-
const validateResult = normalizeValidateResult(
|
|
124590
|
+
_applyValidation(value, key2, schema11) {
|
|
124591
|
+
const validateResult = normalizeValidateResult(schema11.validate(value, this._utils), value);
|
|
124592
124592
|
if (validateResult !== true) {
|
|
124593
124593
|
throw this._invalidHandler(key2, validateResult.value, this._utils);
|
|
124594
124594
|
}
|
|
@@ -124630,8 +124630,8 @@ var require2, __filename2, __dirname3, __create2, __defProp3, __getOwnPropDesc,
|
|
|
124630
124630
|
for (const key2 of unknownKeys) {
|
|
124631
124631
|
const value = postprocessed.override[key2];
|
|
124632
124632
|
this._applyUnknownHandler(key2, value, options8, (knownResultKey, knownResultValue) => {
|
|
124633
|
-
const
|
|
124634
|
-
this._applyValidation(knownResultValue, knownResultKey,
|
|
124633
|
+
const schema11 = this._utils.schemas[knownResultKey];
|
|
124634
|
+
this._applyValidation(knownResultValue, knownResultKey, schema11);
|
|
124635
124635
|
options8[knownResultKey] = knownResultValue;
|
|
124636
124636
|
});
|
|
124637
124637
|
}
|
|
@@ -138269,11 +138269,11 @@ var require_prettier = __commonJS((exports, module) => {
|
|
|
138269
138269
|
var require_formatter = __commonJS((exports) => {
|
|
138270
138270
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
138271
138271
|
function adopt(value) {
|
|
138272
|
-
return value instanceof P9 ? value : new P9(function(
|
|
138273
|
-
|
|
138272
|
+
return value instanceof P9 ? value : new P9(function(resolve13) {
|
|
138273
|
+
resolve13(value);
|
|
138274
138274
|
});
|
|
138275
138275
|
}
|
|
138276
|
-
return new (P9 || (P9 = Promise))(function(
|
|
138276
|
+
return new (P9 || (P9 = Promise))(function(resolve13, reject) {
|
|
138277
138277
|
function fulfilled(value) {
|
|
138278
138278
|
try {
|
|
138279
138279
|
step(generator.next(value));
|
|
@@ -138289,7 +138289,7 @@ var require_formatter = __commonJS((exports) => {
|
|
|
138289
138289
|
}
|
|
138290
138290
|
}
|
|
138291
138291
|
function step(result) {
|
|
138292
|
-
result.done ?
|
|
138292
|
+
result.done ? resolve13(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
138293
138293
|
}
|
|
138294
138294
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
138295
138295
|
});
|
|
@@ -138344,23 +138344,23 @@ var require_JSONSchema = __commonJS((exports) => {
|
|
|
138344
138344
|
exports.Parent = Symbol("Parent");
|
|
138345
138345
|
exports.Types = Symbol("Types");
|
|
138346
138346
|
exports.Intersection = Symbol("Intersection");
|
|
138347
|
-
exports.getRootSchema = (0, lodash_1.memoize)((
|
|
138348
|
-
const parent =
|
|
138347
|
+
exports.getRootSchema = (0, lodash_1.memoize)((schema11) => {
|
|
138348
|
+
const parent = schema11[exports.Parent];
|
|
138349
138349
|
if (!parent) {
|
|
138350
|
-
return
|
|
138350
|
+
return schema11;
|
|
138351
138351
|
}
|
|
138352
138352
|
return (0, exports.getRootSchema)(parent);
|
|
138353
138353
|
});
|
|
138354
|
-
function isBoolean(
|
|
138355
|
-
return
|
|
138354
|
+
function isBoolean(schema11) {
|
|
138355
|
+
return schema11 === true || schema11 === false;
|
|
138356
138356
|
}
|
|
138357
138357
|
exports.isBoolean = isBoolean;
|
|
138358
|
-
function isPrimitive(
|
|
138359
|
-
return !(0, lodash_1.isPlainObject)(
|
|
138358
|
+
function isPrimitive(schema11) {
|
|
138359
|
+
return !(0, lodash_1.isPlainObject)(schema11);
|
|
138360
138360
|
}
|
|
138361
138361
|
exports.isPrimitive = isPrimitive;
|
|
138362
|
-
function isCompound(
|
|
138363
|
-
return Array.isArray(
|
|
138362
|
+
function isCompound(schema11) {
|
|
138363
|
+
return Array.isArray(schema11.type) || "anyOf" in schema11 || "oneOf" in schema11;
|
|
138364
138364
|
}
|
|
138365
138365
|
exports.isCompound = isCompound;
|
|
138366
138366
|
});
|
|
@@ -138587,9 +138587,9 @@ var require_type2 = __commonJS((exports, module) => {
|
|
|
138587
138587
|
var require_schema5 = __commonJS((exports, module) => {
|
|
138588
138588
|
var YAMLException = require_exception2();
|
|
138589
138589
|
var Type = require_type2();
|
|
138590
|
-
function compileList(
|
|
138590
|
+
function compileList(schema11, name2) {
|
|
138591
138591
|
var result = [];
|
|
138592
|
-
|
|
138592
|
+
schema11[name2].forEach(function(currentType) {
|
|
138593
138593
|
var newIndex = result.length;
|
|
138594
138594
|
result.forEach(function(previousType, previousIndex) {
|
|
138595
138595
|
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
|
@@ -140534,7 +140534,7 @@ var require_dumper2 = __commonJS((exports, module) => {
|
|
|
140534
140534
|
"OFF"
|
|
140535
140535
|
];
|
|
140536
140536
|
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
140537
|
-
function compileStyleMap(
|
|
140537
|
+
function compileStyleMap(schema11, map2) {
|
|
140538
140538
|
var result, keys, index, length, tag, style, type;
|
|
140539
140539
|
if (map2 === null)
|
|
140540
140540
|
return {};
|
|
@@ -140546,7 +140546,7 @@ var require_dumper2 = __commonJS((exports, module) => {
|
|
|
140546
140546
|
if (tag.slice(0, 2) === "!!") {
|
|
140547
140547
|
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
140548
140548
|
}
|
|
140549
|
-
type =
|
|
140549
|
+
type = schema11.compiledTypeMap["fallback"][tag];
|
|
140550
140550
|
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
|
140551
140551
|
style = type.styleAliases[style];
|
|
140552
140552
|
}
|
|
@@ -141205,11 +141205,11 @@ var require_utils7 = __commonJS((exports) => {
|
|
|
141205
141205
|
function traverseArray(arr, callback, processed) {
|
|
141206
141206
|
arr.forEach((s5, k9) => traverse(s5, callback, processed, k9.toString()));
|
|
141207
141207
|
}
|
|
141208
|
-
function traverseIntersection(
|
|
141209
|
-
if (typeof
|
|
141208
|
+
function traverseIntersection(schema11, callback, processed) {
|
|
141209
|
+
if (typeof schema11 !== "object" || !schema11) {
|
|
141210
141210
|
return;
|
|
141211
141211
|
}
|
|
141212
|
-
const r5 =
|
|
141212
|
+
const r5 = schema11;
|
|
141213
141213
|
const intersection2 = r5[JSONSchema_1.Intersection];
|
|
141214
141214
|
if (!intersection2) {
|
|
141215
141215
|
return;
|
|
@@ -141218,60 +141218,60 @@ var require_utils7 = __commonJS((exports) => {
|
|
|
141218
141218
|
traverseArray(intersection2.allOf, callback, processed);
|
|
141219
141219
|
}
|
|
141220
141220
|
}
|
|
141221
|
-
function traverse(
|
|
141222
|
-
if (processed.has(
|
|
141221
|
+
function traverse(schema11, callback, processed = new Set, key2) {
|
|
141222
|
+
if (processed.has(schema11)) {
|
|
141223
141223
|
return;
|
|
141224
141224
|
}
|
|
141225
|
-
processed.add(
|
|
141226
|
-
callback(
|
|
141227
|
-
if (
|
|
141228
|
-
traverseArray(
|
|
141225
|
+
processed.add(schema11);
|
|
141226
|
+
callback(schema11, key2 !== null && key2 !== undefined ? key2 : null);
|
|
141227
|
+
if (schema11.anyOf) {
|
|
141228
|
+
traverseArray(schema11.anyOf, callback, processed);
|
|
141229
141229
|
}
|
|
141230
|
-
if (
|
|
141231
|
-
traverseArray(
|
|
141230
|
+
if (schema11.allOf) {
|
|
141231
|
+
traverseArray(schema11.allOf, callback, processed);
|
|
141232
141232
|
}
|
|
141233
|
-
if (
|
|
141234
|
-
traverseArray(
|
|
141233
|
+
if (schema11.oneOf) {
|
|
141234
|
+
traverseArray(schema11.oneOf, callback, processed);
|
|
141235
141235
|
}
|
|
141236
|
-
if (
|
|
141237
|
-
traverseObjectKeys(
|
|
141236
|
+
if (schema11.properties) {
|
|
141237
|
+
traverseObjectKeys(schema11.properties, callback, processed);
|
|
141238
141238
|
}
|
|
141239
|
-
if (
|
|
141240
|
-
traverseObjectKeys(
|
|
141239
|
+
if (schema11.patternProperties) {
|
|
141240
|
+
traverseObjectKeys(schema11.patternProperties, callback, processed);
|
|
141241
141241
|
}
|
|
141242
|
-
if (
|
|
141243
|
-
traverse(
|
|
141242
|
+
if (schema11.additionalProperties && typeof schema11.additionalProperties === "object") {
|
|
141243
|
+
traverse(schema11.additionalProperties, callback, processed);
|
|
141244
141244
|
}
|
|
141245
|
-
if (
|
|
141246
|
-
const { items } =
|
|
141245
|
+
if (schema11.items) {
|
|
141246
|
+
const { items } = schema11;
|
|
141247
141247
|
if (Array.isArray(items)) {
|
|
141248
141248
|
traverseArray(items, callback, processed);
|
|
141249
141249
|
} else {
|
|
141250
141250
|
traverse(items, callback, processed);
|
|
141251
141251
|
}
|
|
141252
141252
|
}
|
|
141253
|
-
if (
|
|
141254
|
-
traverse(
|
|
141253
|
+
if (schema11.additionalItems && typeof schema11.additionalItems === "object") {
|
|
141254
|
+
traverse(schema11.additionalItems, callback, processed);
|
|
141255
141255
|
}
|
|
141256
|
-
if (
|
|
141257
|
-
if (Array.isArray(
|
|
141258
|
-
traverseArray(
|
|
141256
|
+
if (schema11.dependencies) {
|
|
141257
|
+
if (Array.isArray(schema11.dependencies)) {
|
|
141258
|
+
traverseArray(schema11.dependencies, callback, processed);
|
|
141259
141259
|
} else {
|
|
141260
|
-
traverseObjectKeys(
|
|
141260
|
+
traverseObjectKeys(schema11.dependencies, callback, processed);
|
|
141261
141261
|
}
|
|
141262
141262
|
}
|
|
141263
|
-
if (
|
|
141264
|
-
traverseObjectKeys(
|
|
141263
|
+
if (schema11.definitions) {
|
|
141264
|
+
traverseObjectKeys(schema11.definitions, callback, processed);
|
|
141265
141265
|
}
|
|
141266
|
-
if (
|
|
141267
|
-
traverseObjectKeys(
|
|
141266
|
+
if (schema11.$defs) {
|
|
141267
|
+
traverseObjectKeys(schema11.$defs, callback, processed);
|
|
141268
141268
|
}
|
|
141269
|
-
if (
|
|
141270
|
-
traverse(
|
|
141269
|
+
if (schema11.not) {
|
|
141270
|
+
traverse(schema11.not, callback, processed);
|
|
141271
141271
|
}
|
|
141272
|
-
traverseIntersection(
|
|
141273
|
-
Object.keys(
|
|
141274
|
-
const child =
|
|
141272
|
+
traverseIntersection(schema11, callback, processed);
|
|
141273
|
+
Object.keys(schema11).filter((key3) => !BLACKLISTED_KEYS.has(key3)).forEach((key3) => {
|
|
141274
|
+
const child = schema11[key3];
|
|
141275
141275
|
if (child && typeof child === "object") {
|
|
141276
141276
|
traverseObjectKeys(child, callback, processed);
|
|
141277
141277
|
}
|
|
@@ -141353,14 +141353,14 @@ var require_utils7 = __commonJS((exports) => {
|
|
|
141353
141353
|
return (_g2 = color()) === null || _g2 === undefined ? undefined : _g2.whiteBright.bgYellow;
|
|
141354
141354
|
}
|
|
141355
141355
|
}
|
|
141356
|
-
function escapeBlockComment(
|
|
141356
|
+
function escapeBlockComment(schema11) {
|
|
141357
141357
|
const replacer = "* /";
|
|
141358
|
-
if (
|
|
141358
|
+
if (schema11 === null || typeof schema11 !== "object") {
|
|
141359
141359
|
return;
|
|
141360
141360
|
}
|
|
141361
|
-
for (const key2 of Object.keys(
|
|
141362
|
-
if (key2 === "description" && typeof
|
|
141363
|
-
|
|
141361
|
+
for (const key2 of Object.keys(schema11)) {
|
|
141362
|
+
if (key2 === "description" && typeof schema11[key2] === "string") {
|
|
141363
|
+
schema11[key2] = schema11[key2].replace(/\*\//g, replacer);
|
|
141364
141364
|
}
|
|
141365
141365
|
}
|
|
141366
141366
|
}
|
|
@@ -141372,45 +141372,45 @@ var require_utils7 = __commonJS((exports) => {
|
|
|
141372
141372
|
return path_1.posix.join(path_1.posix.normalize(outputPath), ...filePathRel);
|
|
141373
141373
|
}
|
|
141374
141374
|
exports.pathTransform = pathTransform;
|
|
141375
|
-
function maybeStripDefault(
|
|
141376
|
-
if (!("default" in
|
|
141377
|
-
return
|
|
141375
|
+
function maybeStripDefault(schema11) {
|
|
141376
|
+
if (!("default" in schema11)) {
|
|
141377
|
+
return schema11;
|
|
141378
141378
|
}
|
|
141379
|
-
switch (
|
|
141379
|
+
switch (schema11.type) {
|
|
141380
141380
|
case "array":
|
|
141381
|
-
if (Array.isArray(
|
|
141382
|
-
return
|
|
141381
|
+
if (Array.isArray(schema11.default)) {
|
|
141382
|
+
return schema11;
|
|
141383
141383
|
}
|
|
141384
141384
|
break;
|
|
141385
141385
|
case "boolean":
|
|
141386
|
-
if (typeof
|
|
141387
|
-
return
|
|
141386
|
+
if (typeof schema11.default === "boolean") {
|
|
141387
|
+
return schema11;
|
|
141388
141388
|
}
|
|
141389
141389
|
break;
|
|
141390
141390
|
case "integer":
|
|
141391
141391
|
case "number":
|
|
141392
|
-
if (typeof
|
|
141393
|
-
return
|
|
141392
|
+
if (typeof schema11.default === "number") {
|
|
141393
|
+
return schema11;
|
|
141394
141394
|
}
|
|
141395
141395
|
break;
|
|
141396
141396
|
case "string":
|
|
141397
|
-
if (typeof
|
|
141398
|
-
return
|
|
141397
|
+
if (typeof schema11.default === "string") {
|
|
141398
|
+
return schema11;
|
|
141399
141399
|
}
|
|
141400
141400
|
break;
|
|
141401
141401
|
case "null":
|
|
141402
|
-
if (
|
|
141403
|
-
return
|
|
141402
|
+
if (schema11.default === null) {
|
|
141403
|
+
return schema11;
|
|
141404
141404
|
}
|
|
141405
141405
|
break;
|
|
141406
141406
|
case "object":
|
|
141407
|
-
if ((0, lodash_1.isPlainObject)(
|
|
141408
|
-
return
|
|
141407
|
+
if ((0, lodash_1.isPlainObject)(schema11.default)) {
|
|
141408
|
+
return schema11;
|
|
141409
141409
|
}
|
|
141410
141410
|
break;
|
|
141411
141411
|
}
|
|
141412
|
-
delete
|
|
141413
|
-
return
|
|
141412
|
+
delete schema11.default;
|
|
141413
|
+
return schema11;
|
|
141414
141414
|
}
|
|
141415
141415
|
exports.maybeStripDefault = maybeStripDefault;
|
|
141416
141416
|
function appendToDescription(existingDescription, ...values) {
|
|
@@ -141424,11 +141424,11 @@ ${values.join(`
|
|
|
141424
141424
|
`);
|
|
141425
141425
|
}
|
|
141426
141426
|
exports.appendToDescription = appendToDescription;
|
|
141427
|
-
function isSchemaLike(
|
|
141428
|
-
if (!(0, lodash_1.isPlainObject)(
|
|
141427
|
+
function isSchemaLike(schema11) {
|
|
141428
|
+
if (!(0, lodash_1.isPlainObject)(schema11)) {
|
|
141429
141429
|
return false;
|
|
141430
141430
|
}
|
|
141431
|
-
const parent =
|
|
141431
|
+
const parent = schema11[JSONSchema_1.Parent];
|
|
141432
141432
|
if (parent === null) {
|
|
141433
141433
|
return true;
|
|
141434
141434
|
}
|
|
@@ -141445,7 +141445,7 @@ ${values.join(`
|
|
|
141445
141445
|
"properties",
|
|
141446
141446
|
"required"
|
|
141447
141447
|
];
|
|
141448
|
-
if (JSON_SCHEMA_KEYWORDS.some((_10) => parent[_10] ===
|
|
141448
|
+
if (JSON_SCHEMA_KEYWORDS.some((_10) => parent[_10] === schema11)) {
|
|
141449
141449
|
return false;
|
|
141450
141450
|
}
|
|
141451
141451
|
return true;
|
|
@@ -141743,13 +141743,13 @@ var require_typesOfSchema = __commonJS((exports) => {
|
|
|
141743
141743
|
exports.typesOfSchema = undefined;
|
|
141744
141744
|
var lodash_1 = require_lodash8();
|
|
141745
141745
|
var JSONSchema_1 = require_JSONSchema();
|
|
141746
|
-
function typesOfSchema(
|
|
141747
|
-
if (
|
|
141746
|
+
function typesOfSchema(schema11) {
|
|
141747
|
+
if (schema11.tsType) {
|
|
141748
141748
|
return new Set(["CUSTOM_TYPE"]);
|
|
141749
141749
|
}
|
|
141750
141750
|
const matchedTypes = new Set;
|
|
141751
141751
|
for (const [schemaType, f7] of Object.entries(matchers)) {
|
|
141752
|
-
if (f7(
|
|
141752
|
+
if (f7(schema11)) {
|
|
141753
141753
|
matchedTypes.add(schemaType);
|
|
141754
141754
|
}
|
|
141755
141755
|
}
|
|
@@ -141760,26 +141760,26 @@ var require_typesOfSchema = __commonJS((exports) => {
|
|
|
141760
141760
|
}
|
|
141761
141761
|
exports.typesOfSchema = typesOfSchema;
|
|
141762
141762
|
var matchers = {
|
|
141763
|
-
ALL_OF(
|
|
141764
|
-
return "allOf" in
|
|
141763
|
+
ALL_OF(schema11) {
|
|
141764
|
+
return "allOf" in schema11;
|
|
141765
141765
|
},
|
|
141766
|
-
ANY(
|
|
141767
|
-
if (Object.keys(
|
|
141766
|
+
ANY(schema11) {
|
|
141767
|
+
if (Object.keys(schema11).length === 0) {
|
|
141768
141768
|
return true;
|
|
141769
141769
|
}
|
|
141770
|
-
return
|
|
141770
|
+
return schema11.type === "any";
|
|
141771
141771
|
},
|
|
141772
|
-
ANY_OF(
|
|
141773
|
-
return "anyOf" in
|
|
141772
|
+
ANY_OF(schema11) {
|
|
141773
|
+
return "anyOf" in schema11;
|
|
141774
141774
|
},
|
|
141775
|
-
BOOLEAN(
|
|
141776
|
-
if ("enum" in
|
|
141775
|
+
BOOLEAN(schema11) {
|
|
141776
|
+
if ("enum" in schema11) {
|
|
141777
141777
|
return false;
|
|
141778
141778
|
}
|
|
141779
|
-
if (
|
|
141779
|
+
if (schema11.type === "boolean") {
|
|
141780
141780
|
return true;
|
|
141781
141781
|
}
|
|
141782
|
-
if (!(0, JSONSchema_1.isCompound)(
|
|
141782
|
+
if (!(0, JSONSchema_1.isCompound)(schema11) && typeof schema11.default === "boolean") {
|
|
141783
141783
|
return true;
|
|
141784
141784
|
}
|
|
141785
141785
|
return false;
|
|
@@ -141787,74 +141787,74 @@ var require_typesOfSchema = __commonJS((exports) => {
|
|
|
141787
141787
|
CUSTOM_TYPE() {
|
|
141788
141788
|
return false;
|
|
141789
141789
|
},
|
|
141790
|
-
NAMED_ENUM(
|
|
141791
|
-
return "enum" in
|
|
141790
|
+
NAMED_ENUM(schema11) {
|
|
141791
|
+
return "enum" in schema11 && "tsEnumNames" in schema11;
|
|
141792
141792
|
},
|
|
141793
|
-
NAMED_SCHEMA(
|
|
141794
|
-
return "$id" in
|
|
141793
|
+
NAMED_SCHEMA(schema11) {
|
|
141794
|
+
return "$id" in schema11 && (("patternProperties" in schema11) || ("properties" in schema11));
|
|
141795
141795
|
},
|
|
141796
|
-
NEVER(
|
|
141797
|
-
return
|
|
141796
|
+
NEVER(schema11) {
|
|
141797
|
+
return schema11 === false;
|
|
141798
141798
|
},
|
|
141799
|
-
NULL(
|
|
141800
|
-
return
|
|
141799
|
+
NULL(schema11) {
|
|
141800
|
+
return schema11.type === "null";
|
|
141801
141801
|
},
|
|
141802
|
-
NUMBER(
|
|
141803
|
-
if ("enum" in
|
|
141802
|
+
NUMBER(schema11) {
|
|
141803
|
+
if ("enum" in schema11) {
|
|
141804
141804
|
return false;
|
|
141805
141805
|
}
|
|
141806
|
-
if (
|
|
141806
|
+
if (schema11.type === "integer" || schema11.type === "number") {
|
|
141807
141807
|
return true;
|
|
141808
141808
|
}
|
|
141809
|
-
if (!(0, JSONSchema_1.isCompound)(
|
|
141809
|
+
if (!(0, JSONSchema_1.isCompound)(schema11) && typeof schema11.default === "number") {
|
|
141810
141810
|
return true;
|
|
141811
141811
|
}
|
|
141812
141812
|
return false;
|
|
141813
141813
|
},
|
|
141814
|
-
OBJECT(
|
|
141815
|
-
return
|
|
141814
|
+
OBJECT(schema11) {
|
|
141815
|
+
return schema11.type === "object" && !(0, lodash_1.isPlainObject)(schema11.additionalProperties) && !schema11.allOf && !schema11.anyOf && !schema11.oneOf && !schema11.patternProperties && !schema11.properties && !schema11.required;
|
|
141816
141816
|
},
|
|
141817
|
-
ONE_OF(
|
|
141818
|
-
return "oneOf" in
|
|
141817
|
+
ONE_OF(schema11) {
|
|
141818
|
+
return "oneOf" in schema11;
|
|
141819
141819
|
},
|
|
141820
|
-
REFERENCE(
|
|
141821
|
-
return "$ref" in
|
|
141820
|
+
REFERENCE(schema11) {
|
|
141821
|
+
return "$ref" in schema11;
|
|
141822
141822
|
},
|
|
141823
|
-
STRING(
|
|
141824
|
-
if ("enum" in
|
|
141823
|
+
STRING(schema11) {
|
|
141824
|
+
if ("enum" in schema11) {
|
|
141825
141825
|
return false;
|
|
141826
141826
|
}
|
|
141827
|
-
if (
|
|
141827
|
+
if (schema11.type === "string") {
|
|
141828
141828
|
return true;
|
|
141829
141829
|
}
|
|
141830
|
-
if (!(0, JSONSchema_1.isCompound)(
|
|
141830
|
+
if (!(0, JSONSchema_1.isCompound)(schema11) && typeof schema11.default === "string") {
|
|
141831
141831
|
return true;
|
|
141832
141832
|
}
|
|
141833
141833
|
return false;
|
|
141834
141834
|
},
|
|
141835
|
-
TYPED_ARRAY(
|
|
141836
|
-
if (
|
|
141835
|
+
TYPED_ARRAY(schema11) {
|
|
141836
|
+
if (schema11.type && schema11.type !== "array") {
|
|
141837
141837
|
return false;
|
|
141838
141838
|
}
|
|
141839
|
-
return "items" in
|
|
141839
|
+
return "items" in schema11;
|
|
141840
141840
|
},
|
|
141841
|
-
UNION(
|
|
141842
|
-
return Array.isArray(
|
|
141841
|
+
UNION(schema11) {
|
|
141842
|
+
return Array.isArray(schema11.type);
|
|
141843
141843
|
},
|
|
141844
|
-
UNNAMED_ENUM(
|
|
141845
|
-
if ("tsEnumNames" in
|
|
141844
|
+
UNNAMED_ENUM(schema11) {
|
|
141845
|
+
if ("tsEnumNames" in schema11) {
|
|
141846
141846
|
return false;
|
|
141847
141847
|
}
|
|
141848
|
-
if (
|
|
141848
|
+
if (schema11.type && schema11.type !== "boolean" && schema11.type !== "integer" && schema11.type !== "number" && schema11.type !== "string") {
|
|
141849
141849
|
return false;
|
|
141850
141850
|
}
|
|
141851
|
-
return "enum" in
|
|
141851
|
+
return "enum" in schema11;
|
|
141852
141852
|
},
|
|
141853
141853
|
UNNAMED_SCHEMA() {
|
|
141854
141854
|
return false;
|
|
141855
141855
|
},
|
|
141856
|
-
UNTYPED_ARRAY(
|
|
141857
|
-
return
|
|
141856
|
+
UNTYPED_ARRAY(schema11) {
|
|
141857
|
+
return schema11.type === "array" && !("items" in schema11);
|
|
141858
141858
|
}
|
|
141859
141859
|
};
|
|
141860
141860
|
});
|
|
@@ -141865,10 +141865,10 @@ var require_applySchemaTyping = __commonJS((exports) => {
|
|
|
141865
141865
|
exports.applySchemaTyping = undefined;
|
|
141866
141866
|
var JSONSchema_1 = require_JSONSchema();
|
|
141867
141867
|
var typesOfSchema_1 = require_typesOfSchema();
|
|
141868
|
-
function applySchemaTyping(
|
|
141868
|
+
function applySchemaTyping(schema11) {
|
|
141869
141869
|
var _a7;
|
|
141870
|
-
const types = (0, typesOfSchema_1.typesOfSchema)(
|
|
141871
|
-
Object.defineProperty(
|
|
141870
|
+
const types = (0, typesOfSchema_1.typesOfSchema)(schema11);
|
|
141871
|
+
Object.defineProperty(schema11, JSONSchema_1.Types, {
|
|
141872
141872
|
enumerable: false,
|
|
141873
141873
|
value: types,
|
|
141874
141874
|
writable: false
|
|
@@ -141877,23 +141877,23 @@ var require_applySchemaTyping = __commonJS((exports) => {
|
|
|
141877
141877
|
return;
|
|
141878
141878
|
}
|
|
141879
141879
|
const intersection2 = {
|
|
141880
|
-
[JSONSchema_1.Parent]:
|
|
141880
|
+
[JSONSchema_1.Parent]: schema11,
|
|
141881
141881
|
[JSONSchema_1.Types]: new Set(["ALL_OF"]),
|
|
141882
|
-
$id:
|
|
141883
|
-
description:
|
|
141884
|
-
name:
|
|
141885
|
-
title:
|
|
141886
|
-
allOf: (_a7 =
|
|
141882
|
+
$id: schema11.$id,
|
|
141883
|
+
description: schema11.description,
|
|
141884
|
+
name: schema11.name,
|
|
141885
|
+
title: schema11.title,
|
|
141886
|
+
allOf: (_a7 = schema11.allOf) !== null && _a7 !== undefined ? _a7 : [],
|
|
141887
141887
|
required: [],
|
|
141888
141888
|
additionalProperties: false
|
|
141889
141889
|
};
|
|
141890
141890
|
types.delete("ALL_OF");
|
|
141891
|
-
delete
|
|
141892
|
-
delete
|
|
141893
|
-
delete
|
|
141894
|
-
delete
|
|
141895
|
-
delete
|
|
141896
|
-
Object.defineProperty(
|
|
141891
|
+
delete schema11.allOf;
|
|
141892
|
+
delete schema11.$id;
|
|
141893
|
+
delete schema11.description;
|
|
141894
|
+
delete schema11.name;
|
|
141895
|
+
delete schema11.title;
|
|
141896
|
+
Object.defineProperty(schema11, JSONSchema_1.Intersection, {
|
|
141897
141897
|
enumerable: false,
|
|
141898
141898
|
value: intersection2,
|
|
141899
141899
|
writable: false
|
|
@@ -141911,186 +141911,186 @@ var require_normalizer = __commonJS((exports) => {
|
|
|
141911
141911
|
var applySchemaTyping_1 = require_applySchemaTyping();
|
|
141912
141912
|
var util_1 = __require("util");
|
|
141913
141913
|
var rules = new Map;
|
|
141914
|
-
function hasType(
|
|
141915
|
-
return
|
|
141914
|
+
function hasType(schema11, type) {
|
|
141915
|
+
return schema11.type === type || Array.isArray(schema11.type) && schema11.type.includes(type);
|
|
141916
141916
|
}
|
|
141917
|
-
function isObjectType(
|
|
141918
|
-
return
|
|
141917
|
+
function isObjectType(schema11) {
|
|
141918
|
+
return schema11.properties !== undefined || hasType(schema11, "object") || hasType(schema11, "any");
|
|
141919
141919
|
}
|
|
141920
|
-
function isArrayType(
|
|
141921
|
-
return
|
|
141920
|
+
function isArrayType(schema11) {
|
|
141921
|
+
return schema11.items !== undefined || hasType(schema11, "array") || hasType(schema11, "any");
|
|
141922
141922
|
}
|
|
141923
|
-
function isEnumTypeWithoutTsEnumNames(
|
|
141924
|
-
return
|
|
141923
|
+
function isEnumTypeWithoutTsEnumNames(schema11) {
|
|
141924
|
+
return schema11.type === "string" && schema11.enum !== undefined && schema11.tsEnumNames === undefined;
|
|
141925
141925
|
}
|
|
141926
|
-
rules.set('Remove `type=["null"]` if `enum=[null]`', (
|
|
141927
|
-
if (Array.isArray(
|
|
141928
|
-
|
|
141926
|
+
rules.set('Remove `type=["null"]` if `enum=[null]`', (schema11) => {
|
|
141927
|
+
if (Array.isArray(schema11.enum) && schema11.enum.some((e8) => e8 === null) && Array.isArray(schema11.type) && schema11.type.includes("null")) {
|
|
141928
|
+
schema11.type = schema11.type.filter((type) => type !== "null");
|
|
141929
141929
|
}
|
|
141930
141930
|
});
|
|
141931
|
-
rules.set("Destructure unary types", (
|
|
141932
|
-
if (
|
|
141933
|
-
|
|
141931
|
+
rules.set("Destructure unary types", (schema11) => {
|
|
141932
|
+
if (schema11.type && Array.isArray(schema11.type) && schema11.type.length === 1) {
|
|
141933
|
+
schema11.type = schema11.type[0];
|
|
141934
141934
|
}
|
|
141935
141935
|
});
|
|
141936
|
-
rules.set("Add empty `required` property if none is defined", (
|
|
141937
|
-
if (isObjectType(
|
|
141938
|
-
|
|
141936
|
+
rules.set("Add empty `required` property if none is defined", (schema11) => {
|
|
141937
|
+
if (isObjectType(schema11) && !("required" in schema11)) {
|
|
141938
|
+
schema11.required = [];
|
|
141939
141939
|
}
|
|
141940
141940
|
});
|
|
141941
|
-
rules.set("Transform `required`=false to `required`=[]", (
|
|
141942
|
-
if (
|
|
141943
|
-
|
|
141941
|
+
rules.set("Transform `required`=false to `required`=[]", (schema11) => {
|
|
141942
|
+
if (schema11.required === false) {
|
|
141943
|
+
schema11.required = [];
|
|
141944
141944
|
}
|
|
141945
141945
|
});
|
|
141946
|
-
rules.set("Default additionalProperties", (
|
|
141947
|
-
if (isObjectType(
|
|
141948
|
-
|
|
141946
|
+
rules.set("Default additionalProperties", (schema11, _10, options8) => {
|
|
141947
|
+
if (isObjectType(schema11) && !("additionalProperties" in schema11) && schema11.patternProperties === undefined) {
|
|
141948
|
+
schema11.additionalProperties = options8.additionalProperties;
|
|
141949
141949
|
}
|
|
141950
141950
|
});
|
|
141951
|
-
rules.set("Transform id to $id", (
|
|
141952
|
-
if (!(0, utils_1.isSchemaLike)(
|
|
141951
|
+
rules.set("Transform id to $id", (schema11, fileName) => {
|
|
141952
|
+
if (!(0, utils_1.isSchemaLike)(schema11)) {
|
|
141953
141953
|
return;
|
|
141954
141954
|
}
|
|
141955
|
-
if (
|
|
141956
|
-
throw ReferenceError(`Schema must define either id or $id, not both. Given id=${
|
|
141955
|
+
if (schema11.id && schema11.$id && schema11.id !== schema11.$id) {
|
|
141956
|
+
throw ReferenceError(`Schema must define either id or $id, not both. Given id=${schema11.id}, $id=${schema11.$id} in ${fileName}`);
|
|
141957
141957
|
}
|
|
141958
|
-
if (
|
|
141959
|
-
|
|
141960
|
-
delete
|
|
141958
|
+
if (schema11.id) {
|
|
141959
|
+
schema11.$id = schema11.id;
|
|
141960
|
+
delete schema11.id;
|
|
141961
141961
|
}
|
|
141962
141962
|
});
|
|
141963
|
-
rules.set("Add an $id to anything that needs it", (
|
|
141964
|
-
if (!(0, utils_1.isSchemaLike)(
|
|
141963
|
+
rules.set("Add an $id to anything that needs it", (schema11, fileName, _options, _key, dereferencedPaths) => {
|
|
141964
|
+
if (!(0, utils_1.isSchemaLike)(schema11)) {
|
|
141965
141965
|
return;
|
|
141966
141966
|
}
|
|
141967
|
-
if (!
|
|
141968
|
-
|
|
141967
|
+
if (!schema11.$id && !schema11[JSONSchema_1.Parent]) {
|
|
141968
|
+
schema11.$id = (0, utils_1.toSafeString)((0, utils_1.justName)(fileName));
|
|
141969
141969
|
return;
|
|
141970
141970
|
}
|
|
141971
|
-
if (!isArrayType(
|
|
141971
|
+
if (!isArrayType(schema11) && !isObjectType(schema11)) {
|
|
141972
141972
|
return;
|
|
141973
141973
|
}
|
|
141974
|
-
const dereferencedName = dereferencedPaths.get(
|
|
141975
|
-
if (!
|
|
141976
|
-
|
|
141974
|
+
const dereferencedName = dereferencedPaths.get(schema11);
|
|
141975
|
+
if (!schema11.$id && !schema11.title && dereferencedName) {
|
|
141976
|
+
schema11.$id = (0, utils_1.toSafeString)((0, utils_1.justName)(dereferencedName));
|
|
141977
141977
|
}
|
|
141978
141978
|
if (dereferencedName) {
|
|
141979
|
-
dereferencedPaths.delete(
|
|
141979
|
+
dereferencedPaths.delete(schema11);
|
|
141980
141980
|
}
|
|
141981
141981
|
});
|
|
141982
|
-
rules.set("Escape closing JSDoc comment", (
|
|
141983
|
-
(0, utils_1.escapeBlockComment)(
|
|
141982
|
+
rules.set("Escape closing JSDoc comment", (schema11) => {
|
|
141983
|
+
(0, utils_1.escapeBlockComment)(schema11);
|
|
141984
141984
|
});
|
|
141985
|
-
rules.set("Add JSDoc comments for minItems and maxItems", (
|
|
141986
|
-
if (!isArrayType(
|
|
141985
|
+
rules.set("Add JSDoc comments for minItems and maxItems", (schema11) => {
|
|
141986
|
+
if (!isArrayType(schema11)) {
|
|
141987
141987
|
return;
|
|
141988
141988
|
}
|
|
141989
141989
|
const commentsToAppend = [
|
|
141990
|
-
"minItems" in
|
|
141991
|
-
"maxItems" in
|
|
141990
|
+
"minItems" in schema11 ? `@minItems ${schema11.minItems}` : "",
|
|
141991
|
+
"maxItems" in schema11 ? `@maxItems ${schema11.maxItems}` : ""
|
|
141992
141992
|
].filter(Boolean);
|
|
141993
141993
|
if (commentsToAppend.length) {
|
|
141994
|
-
|
|
141994
|
+
schema11.description = (0, utils_1.appendToDescription)(schema11.description, ...commentsToAppend);
|
|
141995
141995
|
}
|
|
141996
141996
|
});
|
|
141997
|
-
rules.set("Optionally remove maxItems and minItems", (
|
|
141998
|
-
if (!isArrayType(
|
|
141997
|
+
rules.set("Optionally remove maxItems and minItems", (schema11, _fileName, options8) => {
|
|
141998
|
+
if (!isArrayType(schema11)) {
|
|
141999
141999
|
return;
|
|
142000
142000
|
}
|
|
142001
|
-
if ("minItems" in
|
|
142002
|
-
delete
|
|
142001
|
+
if ("minItems" in schema11 && options8.ignoreMinAndMaxItems) {
|
|
142002
|
+
delete schema11.minItems;
|
|
142003
142003
|
}
|
|
142004
|
-
if ("maxItems" in
|
|
142005
|
-
delete
|
|
142004
|
+
if ("maxItems" in schema11 && (options8.ignoreMinAndMaxItems || options8.maxItems === -1)) {
|
|
142005
|
+
delete schema11.maxItems;
|
|
142006
142006
|
}
|
|
142007
142007
|
});
|
|
142008
|
-
rules.set("Normalize schema.minItems", (
|
|
142008
|
+
rules.set("Normalize schema.minItems", (schema11, _fileName, options8) => {
|
|
142009
142009
|
if (options8.ignoreMinAndMaxItems) {
|
|
142010
142010
|
return;
|
|
142011
142011
|
}
|
|
142012
|
-
if (!isArrayType(
|
|
142012
|
+
if (!isArrayType(schema11)) {
|
|
142013
142013
|
return;
|
|
142014
142014
|
}
|
|
142015
|
-
const { minItems } =
|
|
142016
|
-
|
|
142015
|
+
const { minItems } = schema11;
|
|
142016
|
+
schema11.minItems = typeof minItems === "number" ? minItems : 0;
|
|
142017
142017
|
});
|
|
142018
|
-
rules.set("Remove maxItems if it is big enough to likely cause OOMs", (
|
|
142018
|
+
rules.set("Remove maxItems if it is big enough to likely cause OOMs", (schema11, _fileName, options8) => {
|
|
142019
142019
|
if (options8.ignoreMinAndMaxItems || options8.maxItems === -1) {
|
|
142020
142020
|
return;
|
|
142021
142021
|
}
|
|
142022
|
-
if (!isArrayType(
|
|
142022
|
+
if (!isArrayType(schema11)) {
|
|
142023
142023
|
return;
|
|
142024
142024
|
}
|
|
142025
|
-
const { maxItems, minItems } =
|
|
142025
|
+
const { maxItems, minItems } = schema11;
|
|
142026
142026
|
if (maxItems !== undefined && maxItems - minItems > options8.maxItems) {
|
|
142027
|
-
delete
|
|
142027
|
+
delete schema11.maxItems;
|
|
142028
142028
|
}
|
|
142029
142029
|
});
|
|
142030
|
-
rules.set("Normalize schema.items", (
|
|
142030
|
+
rules.set("Normalize schema.items", (schema11, _fileName, options8) => {
|
|
142031
142031
|
if (options8.ignoreMinAndMaxItems) {
|
|
142032
142032
|
return;
|
|
142033
142033
|
}
|
|
142034
|
-
const { maxItems, minItems } =
|
|
142034
|
+
const { maxItems, minItems } = schema11;
|
|
142035
142035
|
const hasMaxItems = typeof maxItems === "number" && maxItems >= 0;
|
|
142036
142036
|
const hasMinItems = typeof minItems === "number" && minItems > 0;
|
|
142037
|
-
if (
|
|
142038
|
-
const items =
|
|
142037
|
+
if (schema11.items && !Array.isArray(schema11.items) && (hasMaxItems || hasMinItems)) {
|
|
142038
|
+
const items = schema11.items;
|
|
142039
142039
|
const newItems = Array(maxItems || minItems || 0).fill(items);
|
|
142040
142040
|
if (!hasMaxItems) {
|
|
142041
|
-
|
|
142041
|
+
schema11.additionalItems = items;
|
|
142042
142042
|
}
|
|
142043
|
-
|
|
142043
|
+
schema11.items = newItems;
|
|
142044
142044
|
}
|
|
142045
|
-
if (Array.isArray(
|
|
142046
|
-
|
|
142045
|
+
if (Array.isArray(schema11.items) && hasMaxItems && maxItems < schema11.items.length) {
|
|
142046
|
+
schema11.items = schema11.items.slice(0, maxItems);
|
|
142047
142047
|
}
|
|
142048
|
-
return
|
|
142048
|
+
return schema11;
|
|
142049
142049
|
});
|
|
142050
|
-
rules.set("Remove extends, if it is empty", (
|
|
142051
|
-
if (!
|
|
142050
|
+
rules.set("Remove extends, if it is empty", (schema11) => {
|
|
142051
|
+
if (!schema11.hasOwnProperty("extends")) {
|
|
142052
142052
|
return;
|
|
142053
142053
|
}
|
|
142054
|
-
if (
|
|
142055
|
-
delete
|
|
142054
|
+
if (schema11.extends == null || Array.isArray(schema11.extends) && schema11.extends.length === 0) {
|
|
142055
|
+
delete schema11.extends;
|
|
142056
142056
|
}
|
|
142057
142057
|
});
|
|
142058
|
-
rules.set("Make extends always an array, if it is defined", (
|
|
142059
|
-
if (
|
|
142058
|
+
rules.set("Make extends always an array, if it is defined", (schema11) => {
|
|
142059
|
+
if (schema11.extends == null) {
|
|
142060
142060
|
return;
|
|
142061
142061
|
}
|
|
142062
|
-
if (!Array.isArray(
|
|
142063
|
-
|
|
142062
|
+
if (!Array.isArray(schema11.extends)) {
|
|
142063
|
+
schema11.extends = [schema11.extends];
|
|
142064
142064
|
}
|
|
142065
142065
|
});
|
|
142066
|
-
rules.set("Transform definitions to $defs", (
|
|
142067
|
-
if (
|
|
142068
|
-
throw ReferenceError(`Schema must define either definitions or $defs, not both. Given id=${
|
|
142066
|
+
rules.set("Transform definitions to $defs", (schema11, fileName) => {
|
|
142067
|
+
if (schema11.definitions && schema11.$defs && !(0, util_1.isDeepStrictEqual)(schema11.definitions, schema11.$defs)) {
|
|
142068
|
+
throw ReferenceError(`Schema must define either definitions or $defs, not both. Given id=${schema11.id} in ${fileName}`);
|
|
142069
142069
|
}
|
|
142070
|
-
if (
|
|
142071
|
-
|
|
142072
|
-
delete
|
|
142070
|
+
if (schema11.definitions) {
|
|
142071
|
+
schema11.$defs = schema11.definitions;
|
|
142072
|
+
delete schema11.definitions;
|
|
142073
142073
|
}
|
|
142074
142074
|
});
|
|
142075
|
-
rules.set("Transform const to singleton enum", (
|
|
142076
|
-
if (
|
|
142077
|
-
|
|
142078
|
-
delete
|
|
142075
|
+
rules.set("Transform const to singleton enum", (schema11) => {
|
|
142076
|
+
if (schema11.const !== undefined) {
|
|
142077
|
+
schema11.enum = [schema11.const];
|
|
142078
|
+
delete schema11.const;
|
|
142079
142079
|
}
|
|
142080
142080
|
});
|
|
142081
|
-
rules.set("Add tsEnumNames to enum types", (
|
|
142081
|
+
rules.set("Add tsEnumNames to enum types", (schema11, _10, options8) => {
|
|
142082
142082
|
var _a7;
|
|
142083
|
-
if (isEnumTypeWithoutTsEnumNames(
|
|
142084
|
-
|
|
142083
|
+
if (isEnumTypeWithoutTsEnumNames(schema11) && options8.inferStringEnumKeysFromValues) {
|
|
142084
|
+
schema11.tsEnumNames = (_a7 = schema11.enum) === null || _a7 === undefined ? undefined : _a7.map(String);
|
|
142085
142085
|
}
|
|
142086
142086
|
});
|
|
142087
|
-
rules.set("Pre-calculate schema types and intersections", (
|
|
142088
|
-
if (
|
|
142089
|
-
(0, applySchemaTyping_1.applySchemaTyping)(
|
|
142087
|
+
rules.set("Pre-calculate schema types and intersections", (schema11) => {
|
|
142088
|
+
if (schema11 !== null && typeof schema11 === "object") {
|
|
142089
|
+
(0, applySchemaTyping_1.applySchemaTyping)(schema11);
|
|
142090
142090
|
}
|
|
142091
142091
|
});
|
|
142092
142092
|
function normalize2(rootSchema, dereferencedPaths, filename, options8) {
|
|
142093
|
-
rules.forEach((rule) => (0, utils_1.traverse)(rootSchema, (
|
|
142093
|
+
rules.forEach((rule) => (0, utils_1.traverse)(rootSchema, (schema11, key2) => rule(schema11, filename, options8, key2, dereferencedPaths)));
|
|
142094
142094
|
return rootSchema;
|
|
142095
142095
|
}
|
|
142096
142096
|
exports.normalize = normalize2;
|
|
@@ -142172,37 +142172,37 @@ var require_parser2 = __commonJS((exports) => {
|
|
|
142172
142172
|
var AST_1 = require_AST();
|
|
142173
142173
|
var JSONSchema_1 = require_JSONSchema();
|
|
142174
142174
|
var utils_1 = require_utils7();
|
|
142175
|
-
function parse11(
|
|
142176
|
-
if ((0, JSONSchema_1.isPrimitive)(
|
|
142177
|
-
if ((0, JSONSchema_1.isBoolean)(
|
|
142178
|
-
return parseBooleanSchema(
|
|
142175
|
+
function parse11(schema11, options8, keyName, processed = new Map, usedNames = new Set) {
|
|
142176
|
+
if ((0, JSONSchema_1.isPrimitive)(schema11)) {
|
|
142177
|
+
if ((0, JSONSchema_1.isBoolean)(schema11)) {
|
|
142178
|
+
return parseBooleanSchema(schema11, keyName, options8);
|
|
142179
142179
|
}
|
|
142180
|
-
return parseLiteral(
|
|
142180
|
+
return parseLiteral(schema11, keyName);
|
|
142181
142181
|
}
|
|
142182
|
-
const intersection2 =
|
|
142183
|
-
const types =
|
|
142182
|
+
const intersection2 = schema11[JSONSchema_1.Intersection];
|
|
142183
|
+
const types = schema11[JSONSchema_1.Types];
|
|
142184
142184
|
if (intersection2) {
|
|
142185
142185
|
const ast = parseAsTypeWithCache(intersection2, "ALL_OF", options8, keyName, processed, usedNames);
|
|
142186
142186
|
types.forEach((type) => {
|
|
142187
|
-
ast.params.push(parseAsTypeWithCache(
|
|
142187
|
+
ast.params.push(parseAsTypeWithCache(schema11, type, options8, keyName, processed, usedNames));
|
|
142188
142188
|
});
|
|
142189
|
-
(0, utils_1.log)("blue", "parser", "Types:", [...types], "Input:",
|
|
142189
|
+
(0, utils_1.log)("blue", "parser", "Types:", [...types], "Input:", schema11, "Output:", ast);
|
|
142190
142190
|
return ast;
|
|
142191
142191
|
}
|
|
142192
142192
|
if (types.size === 1) {
|
|
142193
142193
|
const type = [...types][0];
|
|
142194
|
-
const ast = parseAsTypeWithCache(
|
|
142195
|
-
(0, utils_1.log)("blue", "parser", "Type:", type, "Input:",
|
|
142194
|
+
const ast = parseAsTypeWithCache(schema11, type, options8, keyName, processed, usedNames);
|
|
142195
|
+
(0, utils_1.log)("blue", "parser", "Type:", type, "Input:", schema11, "Output:", ast);
|
|
142196
142196
|
return ast;
|
|
142197
142197
|
}
|
|
142198
142198
|
throw new ReferenceError("Expected intersection schema. Please file an issue on GitHub.");
|
|
142199
142199
|
}
|
|
142200
142200
|
exports.parse = parse11;
|
|
142201
|
-
function parseAsTypeWithCache(
|
|
142202
|
-
let cachedTypeMap = processed.get(
|
|
142201
|
+
function parseAsTypeWithCache(schema11, type, options8, keyName, processed = new Map, usedNames = new Set) {
|
|
142202
|
+
let cachedTypeMap = processed.get(schema11);
|
|
142203
142203
|
if (!cachedTypeMap) {
|
|
142204
142204
|
cachedTypeMap = new Map;
|
|
142205
|
-
processed.set(
|
|
142205
|
+
processed.set(schema11, cachedTypeMap);
|
|
142206
142206
|
}
|
|
142207
142207
|
const cachedAST = cachedTypeMap.get(type);
|
|
142208
142208
|
if (cachedAST) {
|
|
@@ -142210,10 +142210,10 @@ var require_parser2 = __commonJS((exports) => {
|
|
|
142210
142210
|
}
|
|
142211
142211
|
const ast = {};
|
|
142212
142212
|
cachedTypeMap.set(type, ast);
|
|
142213
|
-
return Object.assign(ast, parseNonLiteral(
|
|
142213
|
+
return Object.assign(ast, parseNonLiteral(schema11, type, options8, keyName, processed, usedNames));
|
|
142214
142214
|
}
|
|
142215
|
-
function parseBooleanSchema(
|
|
142216
|
-
if (
|
|
142215
|
+
function parseBooleanSchema(schema11, keyName, options8) {
|
|
142216
|
+
if (schema11) {
|
|
142217
142217
|
return {
|
|
142218
142218
|
keyName,
|
|
142219
142219
|
type: options8.unknownAny ? "UNKNOWN" : "ANY"
|
|
@@ -142224,157 +142224,157 @@ var require_parser2 = __commonJS((exports) => {
|
|
|
142224
142224
|
type: "NEVER"
|
|
142225
142225
|
};
|
|
142226
142226
|
}
|
|
142227
|
-
function parseLiteral(
|
|
142227
|
+
function parseLiteral(schema11, keyName) {
|
|
142228
142228
|
return {
|
|
142229
142229
|
keyName,
|
|
142230
|
-
params:
|
|
142230
|
+
params: schema11,
|
|
142231
142231
|
type: "LITERAL"
|
|
142232
142232
|
};
|
|
142233
142233
|
}
|
|
142234
|
-
function parseNonLiteral(
|
|
142235
|
-
const definitions = getDefinitionsMemoized((0, JSONSchema_1.getRootSchema)(
|
|
142236
|
-
const keyNameFromDefinition = (0, lodash_1.findKey)(definitions, (_10) => _10 ===
|
|
142234
|
+
function parseNonLiteral(schema11, type, options8, keyName, processed, usedNames) {
|
|
142235
|
+
const definitions = getDefinitionsMemoized((0, JSONSchema_1.getRootSchema)(schema11));
|
|
142236
|
+
const keyNameFromDefinition = (0, lodash_1.findKey)(definitions, (_10) => _10 === schema11);
|
|
142237
142237
|
switch (type) {
|
|
142238
142238
|
case "ALL_OF":
|
|
142239
142239
|
return {
|
|
142240
|
-
comment:
|
|
142241
|
-
deprecated:
|
|
142240
|
+
comment: schema11.description,
|
|
142241
|
+
deprecated: schema11.deprecated,
|
|
142242
142242
|
keyName,
|
|
142243
|
-
standaloneName: standaloneName(
|
|
142244
|
-
params:
|
|
142243
|
+
standaloneName: standaloneName(schema11, keyNameFromDefinition, usedNames, options8),
|
|
142244
|
+
params: schema11.allOf.map((_10) => parse11(_10, options8, undefined, processed, usedNames)),
|
|
142245
142245
|
type: "INTERSECTION"
|
|
142246
142246
|
};
|
|
142247
142247
|
case "ANY":
|
|
142248
|
-
return Object.assign(Object.assign({}, options8.unknownAny ? AST_1.T_UNKNOWN : AST_1.T_ANY), { comment:
|
|
142248
|
+
return Object.assign(Object.assign({}, options8.unknownAny ? AST_1.T_UNKNOWN : AST_1.T_ANY), { comment: schema11.description, deprecated: schema11.deprecated, keyName, standaloneName: standaloneName(schema11, keyNameFromDefinition, usedNames, options8) });
|
|
142249
142249
|
case "ANY_OF":
|
|
142250
142250
|
return {
|
|
142251
|
-
comment:
|
|
142252
|
-
deprecated:
|
|
142251
|
+
comment: schema11.description,
|
|
142252
|
+
deprecated: schema11.deprecated,
|
|
142253
142253
|
keyName,
|
|
142254
|
-
standaloneName: standaloneName(
|
|
142255
|
-
params:
|
|
142254
|
+
standaloneName: standaloneName(schema11, keyNameFromDefinition, usedNames, options8),
|
|
142255
|
+
params: schema11.anyOf.map((_10) => parse11(_10, options8, undefined, processed, usedNames)),
|
|
142256
142256
|
type: "UNION"
|
|
142257
142257
|
};
|
|
142258
142258
|
case "BOOLEAN":
|
|
142259
142259
|
return {
|
|
142260
|
-
comment:
|
|
142261
|
-
deprecated:
|
|
142260
|
+
comment: schema11.description,
|
|
142261
|
+
deprecated: schema11.deprecated,
|
|
142262
142262
|
keyName,
|
|
142263
|
-
standaloneName: standaloneName(
|
|
142263
|
+
standaloneName: standaloneName(schema11, keyNameFromDefinition, usedNames, options8),
|
|
142264
142264
|
type: "BOOLEAN"
|
|
142265
142265
|
};
|
|
142266
142266
|
case "CUSTOM_TYPE":
|
|
142267
142267
|
return {
|
|
142268
|
-
comment:
|
|
142269
|
-
deprecated:
|
|
142268
|
+
comment: schema11.description,
|
|
142269
|
+
deprecated: schema11.deprecated,
|
|
142270
142270
|
keyName,
|
|
142271
|
-
params:
|
|
142272
|
-
standaloneName: standaloneName(
|
|
142271
|
+
params: schema11.tsType,
|
|
142272
|
+
standaloneName: standaloneName(schema11, keyNameFromDefinition, usedNames, options8),
|
|
142273
142273
|
type: "CUSTOM_TYPE"
|
|
142274
142274
|
};
|
|
142275
142275
|
case "NAMED_ENUM":
|
|
142276
142276
|
return {
|
|
142277
|
-
comment:
|
|
142278
|
-
deprecated:
|
|
142277
|
+
comment: schema11.description,
|
|
142278
|
+
deprecated: schema11.deprecated,
|
|
142279
142279
|
keyName,
|
|
142280
|
-
standaloneName: standaloneName(
|
|
142281
|
-
params:
|
|
142280
|
+
standaloneName: standaloneName(schema11, keyNameFromDefinition !== null && keyNameFromDefinition !== undefined ? keyNameFromDefinition : keyName, usedNames, options8),
|
|
142281
|
+
params: schema11.enum.map((_10, n5) => ({
|
|
142282
142282
|
ast: parseLiteral(_10, undefined),
|
|
142283
|
-
keyName:
|
|
142283
|
+
keyName: schema11.tsEnumNames[n5]
|
|
142284
142284
|
})),
|
|
142285
142285
|
type: "ENUM"
|
|
142286
142286
|
};
|
|
142287
142287
|
case "NAMED_SCHEMA":
|
|
142288
|
-
return newInterface(
|
|
142288
|
+
return newInterface(schema11, options8, processed, usedNames, keyName);
|
|
142289
142289
|
case "NEVER":
|
|
142290
142290
|
return {
|
|
142291
|
-
comment:
|
|
142292
|
-
deprecated:
|
|
142291
|
+
comment: schema11.description,
|
|
142292
|
+
deprecated: schema11.deprecated,
|
|
142293
142293
|
keyName,
|
|
142294
|
-
standaloneName: standaloneName(
|
|
142294
|
+
standaloneName: standaloneName(schema11, keyNameFromDefinition, usedNames, options8),
|
|
142295
142295
|
type: "NEVER"
|
|
142296
142296
|
};
|
|
142297
142297
|
case "NULL":
|
|
142298
142298
|
return {
|
|
142299
|
-
comment:
|
|
142300
|
-
deprecated:
|
|
142299
|
+
comment: schema11.description,
|
|
142300
|
+
deprecated: schema11.deprecated,
|
|
142301
142301
|
keyName,
|
|
142302
|
-
standaloneName: standaloneName(
|
|
142302
|
+
standaloneName: standaloneName(schema11, keyNameFromDefinition, usedNames, options8),
|
|
142303
142303
|
type: "NULL"
|
|
142304
142304
|
};
|
|
142305
142305
|
case "NUMBER":
|
|
142306
142306
|
return {
|
|
142307
|
-
comment:
|
|
142308
|
-
deprecated:
|
|
142307
|
+
comment: schema11.description,
|
|
142308
|
+
deprecated: schema11.deprecated,
|
|
142309
142309
|
keyName,
|
|
142310
|
-
standaloneName: standaloneName(
|
|
142310
|
+
standaloneName: standaloneName(schema11, keyNameFromDefinition, usedNames, options8),
|
|
142311
142311
|
type: "NUMBER"
|
|
142312
142312
|
};
|
|
142313
142313
|
case "OBJECT":
|
|
142314
142314
|
return {
|
|
142315
|
-
comment:
|
|
142315
|
+
comment: schema11.description,
|
|
142316
142316
|
keyName,
|
|
142317
|
-
standaloneName: standaloneName(
|
|
142317
|
+
standaloneName: standaloneName(schema11, keyNameFromDefinition, usedNames, options8),
|
|
142318
142318
|
type: "OBJECT",
|
|
142319
|
-
deprecated:
|
|
142319
|
+
deprecated: schema11.deprecated
|
|
142320
142320
|
};
|
|
142321
142321
|
case "ONE_OF":
|
|
142322
142322
|
return {
|
|
142323
|
-
comment:
|
|
142324
|
-
deprecated:
|
|
142323
|
+
comment: schema11.description,
|
|
142324
|
+
deprecated: schema11.deprecated,
|
|
142325
142325
|
keyName,
|
|
142326
|
-
standaloneName: standaloneName(
|
|
142327
|
-
params:
|
|
142326
|
+
standaloneName: standaloneName(schema11, keyNameFromDefinition, usedNames, options8),
|
|
142327
|
+
params: schema11.oneOf.map((_10) => parse11(_10, options8, undefined, processed, usedNames)),
|
|
142328
142328
|
type: "UNION"
|
|
142329
142329
|
};
|
|
142330
142330
|
case "REFERENCE":
|
|
142331
|
-
throw Error((0, util_1.format)("Refs should have been resolved by the resolver!",
|
|
142331
|
+
throw Error((0, util_1.format)("Refs should have been resolved by the resolver!", schema11));
|
|
142332
142332
|
case "STRING":
|
|
142333
142333
|
return {
|
|
142334
|
-
comment:
|
|
142335
|
-
deprecated:
|
|
142334
|
+
comment: schema11.description,
|
|
142335
|
+
deprecated: schema11.deprecated,
|
|
142336
142336
|
keyName,
|
|
142337
|
-
standaloneName: standaloneName(
|
|
142337
|
+
standaloneName: standaloneName(schema11, keyNameFromDefinition, usedNames, options8),
|
|
142338
142338
|
type: "STRING"
|
|
142339
142339
|
};
|
|
142340
142340
|
case "TYPED_ARRAY":
|
|
142341
|
-
if (Array.isArray(
|
|
142342
|
-
const minItems2 =
|
|
142343
|
-
const maxItems2 =
|
|
142341
|
+
if (Array.isArray(schema11.items)) {
|
|
142342
|
+
const minItems2 = schema11.minItems;
|
|
142343
|
+
const maxItems2 = schema11.maxItems;
|
|
142344
142344
|
const arrayType = {
|
|
142345
|
-
comment:
|
|
142346
|
-
deprecated:
|
|
142345
|
+
comment: schema11.description,
|
|
142346
|
+
deprecated: schema11.deprecated,
|
|
142347
142347
|
keyName,
|
|
142348
142348
|
maxItems: maxItems2,
|
|
142349
142349
|
minItems: minItems2,
|
|
142350
|
-
standaloneName: standaloneName(
|
|
142351
|
-
params:
|
|
142350
|
+
standaloneName: standaloneName(schema11, keyNameFromDefinition, usedNames, options8),
|
|
142351
|
+
params: schema11.items.map((_10) => parse11(_10, options8, undefined, processed, usedNames)),
|
|
142352
142352
|
type: "TUPLE"
|
|
142353
142353
|
};
|
|
142354
|
-
if (
|
|
142354
|
+
if (schema11.additionalItems === true) {
|
|
142355
142355
|
arrayType.spreadParam = options8.unknownAny ? AST_1.T_UNKNOWN : AST_1.T_ANY;
|
|
142356
|
-
} else if (
|
|
142357
|
-
arrayType.spreadParam = parse11(
|
|
142356
|
+
} else if (schema11.additionalItems) {
|
|
142357
|
+
arrayType.spreadParam = parse11(schema11.additionalItems, options8, undefined, processed, usedNames);
|
|
142358
142358
|
}
|
|
142359
142359
|
return arrayType;
|
|
142360
142360
|
} else {
|
|
142361
142361
|
return {
|
|
142362
|
-
comment:
|
|
142363
|
-
deprecated:
|
|
142362
|
+
comment: schema11.description,
|
|
142363
|
+
deprecated: schema11.deprecated,
|
|
142364
142364
|
keyName,
|
|
142365
|
-
standaloneName: standaloneName(
|
|
142366
|
-
params: parse11(
|
|
142365
|
+
standaloneName: standaloneName(schema11, keyNameFromDefinition, usedNames, options8),
|
|
142366
|
+
params: parse11(schema11.items, options8, `{keyNameFromDefinition}Items`, processed, usedNames),
|
|
142367
142367
|
type: "ARRAY"
|
|
142368
142368
|
};
|
|
142369
142369
|
}
|
|
142370
142370
|
case "UNION":
|
|
142371
142371
|
return {
|
|
142372
|
-
comment:
|
|
142373
|
-
deprecated:
|
|
142372
|
+
comment: schema11.description,
|
|
142373
|
+
deprecated: schema11.deprecated,
|
|
142374
142374
|
keyName,
|
|
142375
|
-
standaloneName: standaloneName(
|
|
142376
|
-
params:
|
|
142377
|
-
const member = Object.assign(Object.assign({}, (0, lodash_1.omit)(
|
|
142375
|
+
standaloneName: standaloneName(schema11, keyNameFromDefinition, usedNames, options8),
|
|
142376
|
+
params: schema11.type.map((type2) => {
|
|
142377
|
+
const member = Object.assign(Object.assign({}, (0, lodash_1.omit)(schema11, "$id", "description", "title")), { type: type2 });
|
|
142378
142378
|
(0, utils_1.maybeStripDefault)(member);
|
|
142379
142379
|
(0, applySchemaTyping_1.applySchemaTyping)(member);
|
|
142380
142380
|
return parse11(member, options8, undefined, processed, usedNames);
|
|
@@ -142383,80 +142383,80 @@ var require_parser2 = __commonJS((exports) => {
|
|
|
142383
142383
|
};
|
|
142384
142384
|
case "UNNAMED_ENUM":
|
|
142385
142385
|
return {
|
|
142386
|
-
comment:
|
|
142387
|
-
deprecated:
|
|
142386
|
+
comment: schema11.description,
|
|
142387
|
+
deprecated: schema11.deprecated,
|
|
142388
142388
|
keyName,
|
|
142389
|
-
standaloneName: standaloneName(
|
|
142390
|
-
params:
|
|
142389
|
+
standaloneName: standaloneName(schema11, keyNameFromDefinition, usedNames, options8),
|
|
142390
|
+
params: schema11.enum.map((_10) => parseLiteral(_10, undefined)),
|
|
142391
142391
|
type: "UNION"
|
|
142392
142392
|
};
|
|
142393
142393
|
case "UNNAMED_SCHEMA":
|
|
142394
|
-
return newInterface(
|
|
142394
|
+
return newInterface(schema11, options8, processed, usedNames, keyName, keyNameFromDefinition);
|
|
142395
142395
|
case "UNTYPED_ARRAY":
|
|
142396
|
-
const minItems =
|
|
142397
|
-
const maxItems = typeof
|
|
142396
|
+
const minItems = schema11.minItems;
|
|
142397
|
+
const maxItems = typeof schema11.maxItems === "number" ? schema11.maxItems : -1;
|
|
142398
142398
|
const params = options8.unknownAny ? AST_1.T_UNKNOWN : AST_1.T_ANY;
|
|
142399
142399
|
if (minItems > 0 || maxItems >= 0) {
|
|
142400
142400
|
return {
|
|
142401
|
-
comment:
|
|
142402
|
-
deprecated:
|
|
142401
|
+
comment: schema11.description,
|
|
142402
|
+
deprecated: schema11.deprecated,
|
|
142403
142403
|
keyName,
|
|
142404
|
-
maxItems:
|
|
142404
|
+
maxItems: schema11.maxItems,
|
|
142405
142405
|
minItems,
|
|
142406
142406
|
params: Array(Math.max(maxItems, minItems) || 0).fill(params),
|
|
142407
142407
|
spreadParam: maxItems >= 0 ? undefined : params,
|
|
142408
|
-
standaloneName: standaloneName(
|
|
142408
|
+
standaloneName: standaloneName(schema11, keyNameFromDefinition, usedNames, options8),
|
|
142409
142409
|
type: "TUPLE"
|
|
142410
142410
|
};
|
|
142411
142411
|
}
|
|
142412
142412
|
return {
|
|
142413
|
-
comment:
|
|
142414
|
-
deprecated:
|
|
142413
|
+
comment: schema11.description,
|
|
142414
|
+
deprecated: schema11.deprecated,
|
|
142415
142415
|
keyName,
|
|
142416
142416
|
params,
|
|
142417
|
-
standaloneName: standaloneName(
|
|
142417
|
+
standaloneName: standaloneName(schema11, keyNameFromDefinition, usedNames, options8),
|
|
142418
142418
|
type: "ARRAY"
|
|
142419
142419
|
};
|
|
142420
142420
|
}
|
|
142421
142421
|
}
|
|
142422
|
-
function standaloneName(
|
|
142422
|
+
function standaloneName(schema11, keyNameFromDefinition, usedNames, options8) {
|
|
142423
142423
|
var _a7;
|
|
142424
|
-
const name2 = ((_a7 = options8.customName) === null || _a7 === undefined ? undefined : _a7.call(options8,
|
|
142424
|
+
const name2 = ((_a7 = options8.customName) === null || _a7 === undefined ? undefined : _a7.call(options8, schema11, keyNameFromDefinition)) || schema11.title || schema11.$id || keyNameFromDefinition;
|
|
142425
142425
|
if (name2) {
|
|
142426
142426
|
return (0, utils_1.generateName)(name2, usedNames);
|
|
142427
142427
|
}
|
|
142428
142428
|
}
|
|
142429
|
-
function newInterface(
|
|
142430
|
-
const name2 = standaloneName(
|
|
142429
|
+
function newInterface(schema11, options8, processed, usedNames, keyName, keyNameFromDefinition) {
|
|
142430
|
+
const name2 = standaloneName(schema11, keyNameFromDefinition, usedNames, options8);
|
|
142431
142431
|
return {
|
|
142432
|
-
comment:
|
|
142433
|
-
deprecated:
|
|
142432
|
+
comment: schema11.description,
|
|
142433
|
+
deprecated: schema11.deprecated,
|
|
142434
142434
|
keyName,
|
|
142435
|
-
params: parseSchema(
|
|
142435
|
+
params: parseSchema(schema11, options8, processed, usedNames, name2),
|
|
142436
142436
|
standaloneName: name2,
|
|
142437
|
-
superTypes: parseSuperTypes(
|
|
142437
|
+
superTypes: parseSuperTypes(schema11, options8, processed, usedNames),
|
|
142438
142438
|
type: "INTERFACE"
|
|
142439
142439
|
};
|
|
142440
142440
|
}
|
|
142441
|
-
function parseSuperTypes(
|
|
142442
|
-
const superTypes =
|
|
142441
|
+
function parseSuperTypes(schema11, options8, processed, usedNames) {
|
|
142442
|
+
const superTypes = schema11.extends;
|
|
142443
142443
|
if (!superTypes) {
|
|
142444
142444
|
return [];
|
|
142445
142445
|
}
|
|
142446
142446
|
return superTypes.map((_10) => parse11(_10, options8, undefined, processed, usedNames));
|
|
142447
142447
|
}
|
|
142448
|
-
function parseSchema(
|
|
142449
|
-
let asts = (0, lodash_1.map)(
|
|
142448
|
+
function parseSchema(schema11, options8, processed, usedNames, parentSchemaName) {
|
|
142449
|
+
let asts = (0, lodash_1.map)(schema11.properties, (value, key2) => ({
|
|
142450
142450
|
ast: parse11(value, options8, key2, processed, usedNames),
|
|
142451
142451
|
isPatternProperty: false,
|
|
142452
|
-
isRequired: (0, lodash_1.includes)(
|
|
142452
|
+
isRequired: (0, lodash_1.includes)(schema11.required || [], key2),
|
|
142453
142453
|
isUnreachableDefinition: false,
|
|
142454
142454
|
keyName: key2
|
|
142455
142455
|
}));
|
|
142456
142456
|
let singlePatternProperty = false;
|
|
142457
|
-
if (
|
|
142458
|
-
singlePatternProperty = !
|
|
142459
|
-
asts = asts.concat((0, lodash_1.map)(
|
|
142457
|
+
if (schema11.patternProperties) {
|
|
142458
|
+
singlePatternProperty = !schema11.additionalProperties && Object.keys(schema11.patternProperties).length === 1;
|
|
142459
|
+
asts = asts.concat((0, lodash_1.map)(schema11.patternProperties, (value, key2) => {
|
|
142460
142460
|
const ast = parse11(value, options8, key2, processed, usedNames);
|
|
142461
142461
|
const comment = `This interface was referenced by \`${parentSchemaName}\`'s JSON-Schema definition
|
|
142462
142462
|
via the \`patternProperty\` "${key2.replace("*/", "*\\/")}".`;
|
|
@@ -142466,14 +142466,14 @@ ${comment}` : comment;
|
|
|
142466
142466
|
return {
|
|
142467
142467
|
ast,
|
|
142468
142468
|
isPatternProperty: !singlePatternProperty,
|
|
142469
|
-
isRequired: singlePatternProperty || (0, lodash_1.includes)(
|
|
142469
|
+
isRequired: singlePatternProperty || (0, lodash_1.includes)(schema11.required || [], key2),
|
|
142470
142470
|
isUnreachableDefinition: false,
|
|
142471
142471
|
keyName: singlePatternProperty ? "[k: string]" : key2
|
|
142472
142472
|
};
|
|
142473
142473
|
}));
|
|
142474
142474
|
}
|
|
142475
142475
|
if (options8.unreachableDefinitions) {
|
|
142476
|
-
asts = asts.concat((0, lodash_1.map)(
|
|
142476
|
+
asts = asts.concat((0, lodash_1.map)(schema11.$defs, (value, key2) => {
|
|
142477
142477
|
const ast = parse11(value, options8, key2, processed, usedNames);
|
|
142478
142478
|
const comment = `This interface was referenced by \`${parentSchemaName}\`'s JSON-Schema
|
|
142479
142479
|
via the \`definition\` "${key2}".`;
|
|
@@ -142483,13 +142483,13 @@ ${comment}` : comment;
|
|
|
142483
142483
|
return {
|
|
142484
142484
|
ast,
|
|
142485
142485
|
isPatternProperty: false,
|
|
142486
|
-
isRequired: (0, lodash_1.includes)(
|
|
142486
|
+
isRequired: (0, lodash_1.includes)(schema11.required || [], key2),
|
|
142487
142487
|
isUnreachableDefinition: true,
|
|
142488
142488
|
keyName: key2
|
|
142489
142489
|
};
|
|
142490
142490
|
}));
|
|
142491
142491
|
}
|
|
142492
|
-
switch (
|
|
142492
|
+
switch (schema11.additionalProperties) {
|
|
142493
142493
|
case undefined:
|
|
142494
142494
|
case true:
|
|
142495
142495
|
if (singlePatternProperty) {
|
|
@@ -142506,7 +142506,7 @@ ${comment}` : comment;
|
|
|
142506
142506
|
return asts;
|
|
142507
142507
|
default:
|
|
142508
142508
|
return asts.concat({
|
|
142509
|
-
ast: parse11(
|
|
142509
|
+
ast: parse11(schema11.additionalProperties, options8, "[k: string]", processed, usedNames),
|
|
142510
142510
|
isPatternProperty: false,
|
|
142511
142511
|
isRequired: true,
|
|
142512
142512
|
isUnreachableDefinition: false,
|
|
@@ -142514,22 +142514,22 @@ ${comment}` : comment;
|
|
|
142514
142514
|
});
|
|
142515
142515
|
}
|
|
142516
142516
|
}
|
|
142517
|
-
function getDefinitions(
|
|
142518
|
-
if (processed.has(
|
|
142517
|
+
function getDefinitions(schema11, isSchema = true, processed = new Set) {
|
|
142518
|
+
if (processed.has(schema11)) {
|
|
142519
142519
|
return {};
|
|
142520
142520
|
}
|
|
142521
|
-
processed.add(
|
|
142522
|
-
if (Array.isArray(
|
|
142523
|
-
return
|
|
142521
|
+
processed.add(schema11);
|
|
142522
|
+
if (Array.isArray(schema11)) {
|
|
142523
|
+
return schema11.reduce((prev, cur) => Object.assign(Object.assign({}, prev), getDefinitions(cur, false, processed)), {});
|
|
142524
142524
|
}
|
|
142525
|
-
if ((0, lodash_1.isPlainObject)(
|
|
142526
|
-
return Object.assign(Object.assign({}, isSchema && hasDefinitions(
|
|
142525
|
+
if ((0, lodash_1.isPlainObject)(schema11)) {
|
|
142526
|
+
return Object.assign(Object.assign({}, isSchema && hasDefinitions(schema11) ? schema11.$defs : {}), Object.keys(schema11).reduce((prev, cur) => Object.assign(Object.assign({}, prev), getDefinitions(schema11[cur], false, processed)), {}));
|
|
142527
142527
|
}
|
|
142528
142528
|
return {};
|
|
142529
142529
|
}
|
|
142530
142530
|
var getDefinitionsMemoized = (0, lodash_1.memoize)(getDefinitions);
|
|
142531
|
-
function hasDefinitions(
|
|
142532
|
-
return "$defs" in
|
|
142531
|
+
function hasDefinitions(schema11) {
|
|
142532
|
+
return "$defs" in schema11;
|
|
142533
142533
|
}
|
|
142534
142534
|
});
|
|
142535
142535
|
|
|
@@ -142942,7 +142942,7 @@ var require_url = __commonJS((exports) => {
|
|
|
142942
142942
|
};
|
|
142943
142943
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
142944
142944
|
exports.parse = undefined;
|
|
142945
|
-
exports.resolve =
|
|
142945
|
+
exports.resolve = resolve13;
|
|
142946
142946
|
exports.cwd = cwd;
|
|
142947
142947
|
exports.getProtocol = getProtocol;
|
|
142948
142948
|
exports.getExtension = getExtension;
|
|
@@ -142970,7 +142970,7 @@ var require_url = __commonJS((exports) => {
|
|
|
142970
142970
|
var urlDecodePatterns = [/%23/g, "#", /%24/g, "$", /%26/g, "&", /%2C/g, ",", /%40/g, "@"];
|
|
142971
142971
|
var parse11 = (u4) => new URL(u4);
|
|
142972
142972
|
exports.parse = parse11;
|
|
142973
|
-
function
|
|
142973
|
+
function resolve13(from, to5) {
|
|
142974
142974
|
const fromUrl = new URL((0, convert_path_to_posix_1.default)(from), "https://aaa.nonexistanturl.com");
|
|
142975
142975
|
const resolvedUrl = new URL((0, convert_path_to_posix_1.default)(to5), fromUrl);
|
|
142976
142976
|
const endSpaces = to5.match(/(\s*)$/)?.[1] || "";
|
|
@@ -143106,7 +143106,7 @@ var require_url = __commonJS((exports) => {
|
|
|
143106
143106
|
}
|
|
143107
143107
|
function relative4(from, to5) {
|
|
143108
143108
|
if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
|
|
143109
|
-
return
|
|
143109
|
+
return resolve13(from, to5);
|
|
143110
143110
|
}
|
|
143111
143111
|
const fromDir = path_1.default.dirname(stripHash(from));
|
|
143112
143112
|
const toPath4 = stripHash(to5);
|
|
@@ -143782,7 +143782,7 @@ var require_plugins = __commonJS((exports) => {
|
|
|
143782
143782
|
let plugin;
|
|
143783
143783
|
let lastError;
|
|
143784
143784
|
let index = 0;
|
|
143785
|
-
return new Promise((
|
|
143785
|
+
return new Promise((resolve13, reject) => {
|
|
143786
143786
|
runNextPlugin();
|
|
143787
143787
|
function runNextPlugin() {
|
|
143788
143788
|
plugin = plugins[index++];
|
|
@@ -143810,7 +143810,7 @@ var require_plugins = __commonJS((exports) => {
|
|
|
143810
143810
|
}
|
|
143811
143811
|
}
|
|
143812
143812
|
function onSuccess(result) {
|
|
143813
|
-
|
|
143813
|
+
resolve13({
|
|
143814
143814
|
plugin,
|
|
143815
143815
|
result
|
|
143816
143816
|
});
|
|
@@ -144353,7 +144353,7 @@ var require_normalize_args = __commonJS((exports) => {
|
|
|
144353
144353
|
var options_js_1 = require_options();
|
|
144354
144354
|
function normalizeArgs(_args) {
|
|
144355
144355
|
let path18;
|
|
144356
|
-
let
|
|
144356
|
+
let schema11;
|
|
144357
144357
|
let options8;
|
|
144358
144358
|
let callback;
|
|
144359
144359
|
const args = Array.prototype.slice.call(_args);
|
|
@@ -144363,15 +144363,15 @@ var require_normalize_args = __commonJS((exports) => {
|
|
|
144363
144363
|
if (typeof args[0] === "string") {
|
|
144364
144364
|
path18 = args[0];
|
|
144365
144365
|
if (typeof args[2] === "object") {
|
|
144366
|
-
|
|
144366
|
+
schema11 = args[1];
|
|
144367
144367
|
options8 = args[2];
|
|
144368
144368
|
} else {
|
|
144369
|
-
|
|
144369
|
+
schema11 = undefined;
|
|
144370
144370
|
options8 = args[1];
|
|
144371
144371
|
}
|
|
144372
144372
|
} else {
|
|
144373
144373
|
path18 = "";
|
|
144374
|
-
|
|
144374
|
+
schema11 = args[0];
|
|
144375
144375
|
options8 = args[1];
|
|
144376
144376
|
}
|
|
144377
144377
|
try {
|
|
@@ -144379,12 +144379,12 @@ var require_normalize_args = __commonJS((exports) => {
|
|
|
144379
144379
|
} catch (e8) {
|
|
144380
144380
|
console.error(`JSON Schema Ref Parser: Error normalizing options: ${e8}`);
|
|
144381
144381
|
}
|
|
144382
|
-
if (!options8.mutateInputSchema && typeof
|
|
144383
|
-
|
|
144382
|
+
if (!options8.mutateInputSchema && typeof schema11 === "object") {
|
|
144383
|
+
schema11 = JSON.parse(JSON.stringify(schema11));
|
|
144384
144384
|
}
|
|
144385
144385
|
return {
|
|
144386
144386
|
path: path18,
|
|
144387
|
-
schema:
|
|
144387
|
+
schema: schema11,
|
|
144388
144388
|
options: options8,
|
|
144389
144389
|
callback
|
|
144390
144390
|
};
|
|
@@ -145143,11 +145143,11 @@ var require_lib3 = __commonJS((exports) => {
|
|
|
145143
145143
|
var require_resolver = __commonJS((exports) => {
|
|
145144
145144
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
145145
145145
|
function adopt(value) {
|
|
145146
|
-
return value instanceof P9 ? value : new P9(function(
|
|
145147
|
-
|
|
145146
|
+
return value instanceof P9 ? value : new P9(function(resolve13) {
|
|
145147
|
+
resolve13(value);
|
|
145148
145148
|
});
|
|
145149
145149
|
}
|
|
145150
|
-
return new (P9 || (P9 = Promise))(function(
|
|
145150
|
+
return new (P9 || (P9 = Promise))(function(resolve13, reject) {
|
|
145151
145151
|
function fulfilled(value) {
|
|
145152
145152
|
try {
|
|
145153
145153
|
step(generator.next(value));
|
|
@@ -145163,7 +145163,7 @@ var require_resolver = __commonJS((exports) => {
|
|
|
145163
145163
|
}
|
|
145164
145164
|
}
|
|
145165
145165
|
function step(result) {
|
|
145166
|
-
result.done ?
|
|
145166
|
+
result.done ? resolve13(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
145167
145167
|
}
|
|
145168
145168
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
145169
145169
|
});
|
|
@@ -145173,12 +145173,12 @@ var require_resolver = __commonJS((exports) => {
|
|
|
145173
145173
|
var json_schema_ref_parser_1 = require_lib3();
|
|
145174
145174
|
var utils_1 = require_utils7();
|
|
145175
145175
|
function dereference(schema_1, _a7) {
|
|
145176
|
-
return __awaiter(this, arguments, undefined, function* (
|
|
145177
|
-
(0, utils_1.log)("green", "dereferencer", "Dereferencing input schema:", cwd,
|
|
145176
|
+
return __awaiter(this, arguments, undefined, function* (schema11, { cwd, $refOptions }) {
|
|
145177
|
+
(0, utils_1.log)("green", "dereferencer", "Dereferencing input schema:", cwd, schema11);
|
|
145178
145178
|
const parser2 = new json_schema_ref_parser_1.$RefParser;
|
|
145179
145179
|
const dereferencedPaths = new WeakMap;
|
|
145180
|
-
const dereferencedSchema = yield parser2.dereference(cwd,
|
|
145181
|
-
dereferencedPaths.set(
|
|
145180
|
+
const dereferencedSchema = yield parser2.dereference(cwd, schema11, Object.assign(Object.assign({}, $refOptions), { dereference: Object.assign(Object.assign({}, $refOptions.dereference), { onDereference($ref, schema12) {
|
|
145181
|
+
dereferencedPaths.set(schema12, $ref);
|
|
145182
145182
|
} }) }));
|
|
145183
145183
|
return { dereferencedPaths, dereferencedSchema };
|
|
145184
145184
|
});
|
|
@@ -145192,46 +145192,46 @@ var require_validator = __commonJS((exports) => {
|
|
|
145192
145192
|
exports.validate = undefined;
|
|
145193
145193
|
var utils_1 = require_utils7();
|
|
145194
145194
|
var rules = new Map;
|
|
145195
|
-
rules.set("Enum members and tsEnumNames must be of the same length", (
|
|
145196
|
-
if (
|
|
145195
|
+
rules.set("Enum members and tsEnumNames must be of the same length", (schema11) => {
|
|
145196
|
+
if (schema11.enum && schema11.tsEnumNames && schema11.enum.length !== schema11.tsEnumNames.length) {
|
|
145197
145197
|
return false;
|
|
145198
145198
|
}
|
|
145199
145199
|
});
|
|
145200
|
-
rules.set("tsEnumNames must be an array of strings", (
|
|
145201
|
-
if (
|
|
145200
|
+
rules.set("tsEnumNames must be an array of strings", (schema11) => {
|
|
145201
|
+
if (schema11.tsEnumNames && schema11.tsEnumNames.some((_10) => typeof _10 !== "string")) {
|
|
145202
145202
|
return false;
|
|
145203
145203
|
}
|
|
145204
145204
|
});
|
|
145205
|
-
rules.set("When both maxItems and minItems are present, maxItems >= minItems", (
|
|
145206
|
-
const { maxItems, minItems } =
|
|
145205
|
+
rules.set("When both maxItems and minItems are present, maxItems >= minItems", (schema11) => {
|
|
145206
|
+
const { maxItems, minItems } = schema11;
|
|
145207
145207
|
if (typeof maxItems === "number" && typeof minItems === "number") {
|
|
145208
145208
|
return maxItems >= minItems;
|
|
145209
145209
|
}
|
|
145210
145210
|
});
|
|
145211
|
-
rules.set("When maxItems exists, maxItems >= 0", (
|
|
145212
|
-
const { maxItems } =
|
|
145211
|
+
rules.set("When maxItems exists, maxItems >= 0", (schema11) => {
|
|
145212
|
+
const { maxItems } = schema11;
|
|
145213
145213
|
if (typeof maxItems === "number") {
|
|
145214
145214
|
return maxItems >= 0;
|
|
145215
145215
|
}
|
|
145216
145216
|
});
|
|
145217
|
-
rules.set("When minItems exists, minItems >= 0", (
|
|
145218
|
-
const { minItems } =
|
|
145217
|
+
rules.set("When minItems exists, minItems >= 0", (schema11) => {
|
|
145218
|
+
const { minItems } = schema11;
|
|
145219
145219
|
if (typeof minItems === "number") {
|
|
145220
145220
|
return minItems >= 0;
|
|
145221
145221
|
}
|
|
145222
145222
|
});
|
|
145223
|
-
rules.set("deprecated must be a boolean", (
|
|
145224
|
-
const typeOfDeprecated = typeof
|
|
145223
|
+
rules.set("deprecated must be a boolean", (schema11) => {
|
|
145224
|
+
const typeOfDeprecated = typeof schema11.deprecated;
|
|
145225
145225
|
return typeOfDeprecated === "boolean" || typeOfDeprecated === "undefined";
|
|
145226
145226
|
});
|
|
145227
|
-
function validate2(
|
|
145227
|
+
function validate2(schema11, filename) {
|
|
145228
145228
|
const errors5 = [];
|
|
145229
145229
|
rules.forEach((rule, ruleName) => {
|
|
145230
|
-
(0, utils_1.traverse)(
|
|
145231
|
-
if (rule(
|
|
145230
|
+
(0, utils_1.traverse)(schema11, (schema12, key2) => {
|
|
145231
|
+
if (rule(schema12) === false) {
|
|
145232
145232
|
errors5.push(`Error at key "${key2}" in file "${filename}": ${ruleName}`);
|
|
145233
145233
|
}
|
|
145234
|
-
return
|
|
145234
|
+
return schema12;
|
|
145235
145235
|
});
|
|
145236
145236
|
});
|
|
145237
145237
|
return errors5;
|
|
@@ -145245,25 +145245,25 @@ var require_linker = __commonJS((exports) => {
|
|
|
145245
145245
|
exports.link = undefined;
|
|
145246
145246
|
var JSONSchema_1 = require_JSONSchema();
|
|
145247
145247
|
var lodash_1 = require_lodash8();
|
|
145248
|
-
function link2(
|
|
145249
|
-
if (!Array.isArray(
|
|
145250
|
-
return
|
|
145248
|
+
function link2(schema11, parent = null) {
|
|
145249
|
+
if (!Array.isArray(schema11) && !(0, lodash_1.isPlainObject)(schema11)) {
|
|
145250
|
+
return schema11;
|
|
145251
145251
|
}
|
|
145252
|
-
if (
|
|
145253
|
-
return
|
|
145252
|
+
if (schema11.hasOwnProperty(JSONSchema_1.Parent)) {
|
|
145253
|
+
return schema11;
|
|
145254
145254
|
}
|
|
145255
|
-
Object.defineProperty(
|
|
145255
|
+
Object.defineProperty(schema11, JSONSchema_1.Parent, {
|
|
145256
145256
|
enumerable: false,
|
|
145257
145257
|
value: parent,
|
|
145258
145258
|
writable: false
|
|
145259
145259
|
});
|
|
145260
|
-
if (Array.isArray(
|
|
145261
|
-
|
|
145260
|
+
if (Array.isArray(schema11)) {
|
|
145261
|
+
schema11.forEach((child) => link2(child, schema11));
|
|
145262
145262
|
}
|
|
145263
|
-
for (const key2 in
|
|
145264
|
-
link2(
|
|
145263
|
+
for (const key2 in schema11) {
|
|
145264
|
+
link2(schema11[key2], schema11);
|
|
145265
145265
|
}
|
|
145266
|
-
return
|
|
145266
|
+
return schema11;
|
|
145267
145267
|
}
|
|
145268
145268
|
exports.link = link2;
|
|
145269
145269
|
});
|
|
@@ -145284,11 +145284,11 @@ var require_optionValidator = __commonJS((exports) => {
|
|
|
145284
145284
|
var require_src3 = __commonJS((exports) => {
|
|
145285
145285
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
145286
145286
|
function adopt(value) {
|
|
145287
|
-
return value instanceof P9 ? value : new P9(function(
|
|
145288
|
-
|
|
145287
|
+
return value instanceof P9 ? value : new P9(function(resolve13) {
|
|
145288
|
+
resolve13(value);
|
|
145289
145289
|
});
|
|
145290
145290
|
}
|
|
145291
|
-
return new (P9 || (P9 = Promise))(function(
|
|
145291
|
+
return new (P9 || (P9 = Promise))(function(resolve13, reject) {
|
|
145292
145292
|
function fulfilled(value) {
|
|
145293
145293
|
try {
|
|
145294
145294
|
step(generator.next(value));
|
|
@@ -145304,7 +145304,7 @@ var require_src3 = __commonJS((exports) => {
|
|
|
145304
145304
|
}
|
|
145305
145305
|
}
|
|
145306
145306
|
function step(result) {
|
|
145307
|
-
result.done ?
|
|
145307
|
+
result.done ? resolve13(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
145308
145308
|
}
|
|
145309
145309
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
145310
145310
|
});
|
|
@@ -145355,8 +145355,8 @@ var require_src3 = __commonJS((exports) => {
|
|
|
145355
145355
|
unknownAny: true
|
|
145356
145356
|
};
|
|
145357
145357
|
function compileFromFile(filename, options8 = exports.DEFAULT_OPTIONS) {
|
|
145358
|
-
const
|
|
145359
|
-
return compile(
|
|
145358
|
+
const schema11 = parseAsJSONSchema(filename);
|
|
145359
|
+
return compile(schema11, (0, utils_1.stripExtension)(filename), Object.assign({ cwd: (0, path_1.dirname)(filename) }, options8));
|
|
145360
145360
|
}
|
|
145361
145361
|
exports.compileFromFile = compileFromFile;
|
|
145362
145362
|
function parseAsJSONSchema(filename) {
|
|
@@ -145366,7 +145366,7 @@ var require_src3 = __commonJS((exports) => {
|
|
|
145366
145366
|
return (0, utils_1.parseFileAsJSONSchema)(filename, contents.toString());
|
|
145367
145367
|
}
|
|
145368
145368
|
function compile(schema_1, name_1) {
|
|
145369
|
-
return __awaiter(this, arguments, undefined, function* (
|
|
145369
|
+
return __awaiter(this, arguments, undefined, function* (schema11, name2, options8 = {}) {
|
|
145370
145370
|
(0, optionValidator_1.validateOptions)(options8);
|
|
145371
145371
|
const _options = (0, lodash_1.merge)({}, exports.DEFAULT_OPTIONS, options8);
|
|
145372
145372
|
const start = Date.now();
|
|
@@ -145376,7 +145376,7 @@ var require_src3 = __commonJS((exports) => {
|
|
|
145376
145376
|
if (!(0, lodash_1.endsWith)(_options.cwd, "/")) {
|
|
145377
145377
|
_options.cwd += "/";
|
|
145378
145378
|
}
|
|
145379
|
-
const _schema = (0, lodash_1.cloneDeep)(
|
|
145379
|
+
const _schema = (0, lodash_1.cloneDeep)(schema11);
|
|
145380
145380
|
const { dereferencedPaths, dereferencedSchema } = yield (0, resolver_1.dereference)(_schema, _options);
|
|
145381
145381
|
if (process.env.VERBOSE) {
|
|
145382
145382
|
if ((0, util_1.isDeepStrictEqual)(_schema, dereferencedSchema)) {
|
|
@@ -150819,11 +150819,11 @@ var require_raw_body = __commonJS((exports, module) => {
|
|
|
150819
150819
|
if (done) {
|
|
150820
150820
|
return readStream(stream, encoding, length, limit, wrap(done));
|
|
150821
150821
|
}
|
|
150822
|
-
return new Promise(function executor(
|
|
150822
|
+
return new Promise(function executor(resolve13, reject) {
|
|
150823
150823
|
readStream(stream, encoding, length, limit, function onRead2(err, buf) {
|
|
150824
150824
|
if (err)
|
|
150825
150825
|
return reject(err);
|
|
150826
|
-
|
|
150826
|
+
resolve13(buf);
|
|
150827
150827
|
});
|
|
150828
150828
|
});
|
|
150829
150829
|
}
|
|
@@ -163948,7 +163948,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
163948
163948
|
var basename6 = path18.basename;
|
|
163949
163949
|
var extname2 = path18.extname;
|
|
163950
163950
|
var join25 = path18.join;
|
|
163951
|
-
var
|
|
163951
|
+
var resolve13 = path18.resolve;
|
|
163952
163952
|
module.exports = View;
|
|
163953
163953
|
function View(name2, options8) {
|
|
163954
163954
|
var opts = options8 || {};
|
|
@@ -163982,7 +163982,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
163982
163982
|
debug('lookup "%s"', name2);
|
|
163983
163983
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
163984
163984
|
var root2 = roots[i5];
|
|
163985
|
-
var loc =
|
|
163985
|
+
var loc = resolve13(root2, name2);
|
|
163986
163986
|
var dir = dirname19(loc);
|
|
163987
163987
|
var file2 = basename6(loc);
|
|
163988
163988
|
path19 = this.resolve(dir, file2);
|
|
@@ -164007,7 +164007,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164007
164007
|
});
|
|
164008
164008
|
sync = false;
|
|
164009
164009
|
};
|
|
164010
|
-
View.prototype.resolve = function
|
|
164010
|
+
View.prototype.resolve = function resolve14(dir, file2) {
|
|
164011
164011
|
var ext = this.ext;
|
|
164012
164012
|
var path19 = join25(dir, file2);
|
|
164013
164013
|
var stat2 = tryStat(path19);
|
|
@@ -166166,7 +166166,7 @@ var require_application = __commonJS((exports, module) => {
|
|
|
166166
166166
|
var compileETag = require_utils10().compileETag;
|
|
166167
166167
|
var compileQueryParser = require_utils10().compileQueryParser;
|
|
166168
166168
|
var compileTrust = require_utils10().compileTrust;
|
|
166169
|
-
var
|
|
166169
|
+
var resolve13 = __require("node:path").resolve;
|
|
166170
166170
|
var once9 = require_once();
|
|
166171
166171
|
var Router = require_router();
|
|
166172
166172
|
var slice = Array.prototype.slice;
|
|
@@ -166220,7 +166220,7 @@ var require_application = __commonJS((exports, module) => {
|
|
|
166220
166220
|
this.mountpath = "/";
|
|
166221
166221
|
this.locals.settings = this.settings;
|
|
166222
166222
|
this.set("view", View);
|
|
166223
|
-
this.set("views",
|
|
166223
|
+
this.set("views", resolve13("views"));
|
|
166224
166224
|
this.set("jsonp callback name", "callback");
|
|
166225
166225
|
if (env3 === "production") {
|
|
166226
166226
|
this.enable("view cache");
|
|
@@ -167711,7 +167711,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167711
167711
|
var extname2 = path18.extname;
|
|
167712
167712
|
var join25 = path18.join;
|
|
167713
167713
|
var normalize2 = path18.normalize;
|
|
167714
|
-
var
|
|
167714
|
+
var resolve13 = path18.resolve;
|
|
167715
167715
|
var sep = path18.sep;
|
|
167716
167716
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
167717
167717
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1000;
|
|
@@ -167740,7 +167740,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167740
167740
|
this._maxage = opts.maxAge || opts.maxage;
|
|
167741
167741
|
this._maxage = typeof this._maxage === "string" ? ms9(this._maxage) : Number(this._maxage);
|
|
167742
167742
|
this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
|
|
167743
|
-
this._root = opts.root ?
|
|
167743
|
+
this._root = opts.root ? resolve13(opts.root) : null;
|
|
167744
167744
|
}
|
|
167745
167745
|
util2.inherits(SendStream, Stream2);
|
|
167746
167746
|
SendStream.prototype.error = function error48(status, err) {
|
|
@@ -167889,7 +167889,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167889
167889
|
return res;
|
|
167890
167890
|
}
|
|
167891
167891
|
parts = normalize2(path19).split(sep);
|
|
167892
|
-
path19 =
|
|
167892
|
+
path19 = resolve13(path19);
|
|
167893
167893
|
}
|
|
167894
167894
|
if (containsDotFile(parts)) {
|
|
167895
167895
|
debug('%s dotfile "%s"', this._dotfiles, path19);
|
|
@@ -168217,7 +168217,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168217
168217
|
var cookie = require_cookie();
|
|
168218
168218
|
var send = require_send();
|
|
168219
168219
|
var extname2 = path18.extname;
|
|
168220
|
-
var
|
|
168220
|
+
var resolve13 = path18.resolve;
|
|
168221
168221
|
var vary = require_vary();
|
|
168222
168222
|
var { Buffer: Buffer7 } = __require("node:buffer");
|
|
168223
168223
|
var res = Object.create(http.ServerResponse.prototype);
|
|
@@ -168426,7 +168426,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168426
168426
|
}
|
|
168427
168427
|
opts = Object.create(opts);
|
|
168428
168428
|
opts.headers = headers;
|
|
168429
|
-
var fullPath = !opts.root ?
|
|
168429
|
+
var fullPath = !opts.root ? resolve13(path19) : path19;
|
|
168430
168430
|
return this.sendFile(fullPath, opts, done);
|
|
168431
168431
|
};
|
|
168432
168432
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -168687,7 +168687,7 @@ var require_serve_static = __commonJS((exports, module) => {
|
|
|
168687
168687
|
var encodeUrl = require_encodeurl();
|
|
168688
168688
|
var escapeHtml = require_escape_html();
|
|
168689
168689
|
var parseUrl = require_parseurl();
|
|
168690
|
-
var
|
|
168690
|
+
var resolve13 = __require("path").resolve;
|
|
168691
168691
|
var send = require_send();
|
|
168692
168692
|
var url3 = __require("url");
|
|
168693
168693
|
module.exports = serveStatic;
|
|
@@ -168706,7 +168706,7 @@ var require_serve_static = __commonJS((exports, module) => {
|
|
|
168706
168706
|
throw new TypeError("option setHeaders must be function");
|
|
168707
168707
|
}
|
|
168708
168708
|
opts.maxage = opts.maxage || opts.maxAge || 0;
|
|
168709
|
-
opts.root =
|
|
168709
|
+
opts.root = resolve13(root2);
|
|
168710
168710
|
var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
|
|
168711
168711
|
return function serveStatic2(req, res, next) {
|
|
168712
168712
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
@@ -172080,8 +172080,8 @@ var require_executor = __commonJS((exports, module) => {
|
|
|
172080
172080
|
}
|
|
172081
172081
|
resetBuffer() {
|
|
172082
172082
|
this.buffer = new Waterfall;
|
|
172083
|
-
this.buffer.chain(new Promise((
|
|
172084
|
-
this._triggerBuffer =
|
|
172083
|
+
this.buffer.chain(new Promise((resolve13) => {
|
|
172084
|
+
this._triggerBuffer = resolve13;
|
|
172085
172085
|
}));
|
|
172086
172086
|
if (this.ready)
|
|
172087
172087
|
this._triggerBuffer();
|
|
@@ -173101,7 +173101,7 @@ var require_storage = __commonJS((exports, module) => {
|
|
|
173101
173101
|
throw e8;
|
|
173102
173102
|
}
|
|
173103
173103
|
};
|
|
173104
|
-
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((
|
|
173104
|
+
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((resolve13, reject) => {
|
|
173105
173105
|
try {
|
|
173106
173106
|
const stream = writeFileStream(filename, { mode });
|
|
173107
173107
|
const readable2 = Readable6.from(lines);
|
|
@@ -173118,7 +173118,7 @@ var require_storage = __commonJS((exports, module) => {
|
|
|
173118
173118
|
if (err)
|
|
173119
173119
|
reject(err);
|
|
173120
173120
|
else
|
|
173121
|
-
|
|
173121
|
+
resolve13();
|
|
173122
173122
|
});
|
|
173123
173123
|
});
|
|
173124
173124
|
readable2.on("error", (err) => {
|
|
@@ -173289,7 +173289,7 @@ var require_persistence = __commonJS((exports, module) => {
|
|
|
173289
173289
|
return { data: tdata, indexes };
|
|
173290
173290
|
}
|
|
173291
173291
|
treatRawStreamAsync(rawStream) {
|
|
173292
|
-
return new Promise((
|
|
173292
|
+
return new Promise((resolve13, reject) => {
|
|
173293
173293
|
const dataById = {};
|
|
173294
173294
|
const indexes = {};
|
|
173295
173295
|
let corruptItems = 0;
|
|
@@ -173332,7 +173332,7 @@ var require_persistence = __commonJS((exports, module) => {
|
|
|
173332
173332
|
}
|
|
173333
173333
|
}
|
|
173334
173334
|
const data = Object.values(dataById);
|
|
173335
|
-
|
|
173335
|
+
resolve13({ data, indexes });
|
|
173336
173336
|
});
|
|
173337
173337
|
lineStream.on("error", function(err) {
|
|
173338
173338
|
reject(err, null);
|
|
@@ -198943,13 +198943,13 @@ var require_broadcast_operator = __commonJS((exports) => {
|
|
|
198943
198943
|
return true;
|
|
198944
198944
|
}
|
|
198945
198945
|
emitWithAck(ev2, ...args) {
|
|
198946
|
-
return new Promise((
|
|
198946
|
+
return new Promise((resolve13, reject) => {
|
|
198947
198947
|
args.push((err, responses) => {
|
|
198948
198948
|
if (err) {
|
|
198949
198949
|
err.responses = responses;
|
|
198950
198950
|
return reject(err);
|
|
198951
198951
|
} else {
|
|
198952
|
-
return
|
|
198952
|
+
return resolve13(responses);
|
|
198953
198953
|
}
|
|
198954
198954
|
});
|
|
198955
198955
|
this.emit(ev2, ...args);
|
|
@@ -199137,12 +199137,12 @@ var require_socket2 = __commonJS((exports) => {
|
|
|
199137
199137
|
}
|
|
199138
199138
|
emitWithAck(ev2, ...args) {
|
|
199139
199139
|
const withErr = this.flags.timeout !== undefined;
|
|
199140
|
-
return new Promise((
|
|
199140
|
+
return new Promise((resolve13, reject) => {
|
|
199141
199141
|
args.push((arg1, arg2) => {
|
|
199142
199142
|
if (withErr) {
|
|
199143
|
-
return arg1 ? reject(arg1) :
|
|
199143
|
+
return arg1 ? reject(arg1) : resolve13(arg2);
|
|
199144
199144
|
} else {
|
|
199145
|
-
return
|
|
199145
|
+
return resolve13(arg1);
|
|
199146
199146
|
}
|
|
199147
199147
|
});
|
|
199148
199148
|
this.emit(ev2, ...args);
|
|
@@ -199597,13 +199597,13 @@ var require_namespace = __commonJS((exports) => {
|
|
|
199597
199597
|
return true;
|
|
199598
199598
|
}
|
|
199599
199599
|
serverSideEmitWithAck(ev2, ...args) {
|
|
199600
|
-
return new Promise((
|
|
199600
|
+
return new Promise((resolve13, reject) => {
|
|
199601
199601
|
args.push((err, responses) => {
|
|
199602
199602
|
if (err) {
|
|
199603
199603
|
err.responses = responses;
|
|
199604
199604
|
return reject(err);
|
|
199605
199605
|
} else {
|
|
199606
|
-
return
|
|
199606
|
+
return resolve13(responses);
|
|
199607
199607
|
}
|
|
199608
199608
|
});
|
|
199609
199609
|
this.serverSideEmit(ev2, ...args);
|
|
@@ -200287,7 +200287,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
200287
200287
|
return localSockets;
|
|
200288
200288
|
}
|
|
200289
200289
|
const requestId = randomId();
|
|
200290
|
-
return new Promise((
|
|
200290
|
+
return new Promise((resolve13, reject) => {
|
|
200291
200291
|
const timeout3 = setTimeout(() => {
|
|
200292
200292
|
const storedRequest2 = this.requests.get(requestId);
|
|
200293
200293
|
if (storedRequest2) {
|
|
@@ -200297,7 +200297,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
200297
200297
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
200298
200298
|
const storedRequest = {
|
|
200299
200299
|
type: MessageType.FETCH_SOCKETS,
|
|
200300
|
-
resolve:
|
|
200300
|
+
resolve: resolve13,
|
|
200301
200301
|
timeout: timeout3,
|
|
200302
200302
|
current: 0,
|
|
200303
200303
|
expected: expectedResponseCount,
|
|
@@ -200507,7 +200507,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
200507
200507
|
return localSockets;
|
|
200508
200508
|
}
|
|
200509
200509
|
const requestId = randomId();
|
|
200510
|
-
return new Promise((
|
|
200510
|
+
return new Promise((resolve13, reject) => {
|
|
200511
200511
|
const timeout3 = setTimeout(() => {
|
|
200512
200512
|
const storedRequest2 = this.customRequests.get(requestId);
|
|
200513
200513
|
if (storedRequest2) {
|
|
@@ -200517,7 +200517,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
200517
200517
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
200518
200518
|
const storedRequest = {
|
|
200519
200519
|
type: MessageType.FETCH_SOCKETS,
|
|
200520
|
-
resolve:
|
|
200520
|
+
resolve: resolve13,
|
|
200521
200521
|
timeout: timeout3,
|
|
200522
200522
|
missingUids: new Set([...this.nodesMap.keys()]),
|
|
200523
200523
|
responses: localSockets
|
|
@@ -201246,13 +201246,13 @@ var require_dist4 = __commonJS((exports, module) => {
|
|
|
201246
201246
|
this.engine.close();
|
|
201247
201247
|
(0, uws_1.restoreAdapter)();
|
|
201248
201248
|
if (this.httpServer) {
|
|
201249
|
-
return new Promise((
|
|
201249
|
+
return new Promise((resolve13) => {
|
|
201250
201250
|
this.httpServer.close((err) => {
|
|
201251
201251
|
fn9 && fn9(err);
|
|
201252
201252
|
if (err) {
|
|
201253
201253
|
debug("server was not running");
|
|
201254
201254
|
}
|
|
201255
|
-
|
|
201255
|
+
resolve13();
|
|
201256
201256
|
});
|
|
201257
201257
|
});
|
|
201258
201258
|
} else {
|
|
@@ -215914,14 +215914,14 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
215914
215914
|
};
|
|
215915
215915
|
}
|
|
215916
215916
|
function readAndResolve(iter) {
|
|
215917
|
-
var
|
|
215918
|
-
if (
|
|
215917
|
+
var resolve13 = iter[kLastResolve];
|
|
215918
|
+
if (resolve13 !== null) {
|
|
215919
215919
|
var data = iter[kStream].read();
|
|
215920
215920
|
if (data !== null) {
|
|
215921
215921
|
iter[kLastPromise] = null;
|
|
215922
215922
|
iter[kLastResolve] = null;
|
|
215923
215923
|
iter[kLastReject] = null;
|
|
215924
|
-
|
|
215924
|
+
resolve13(createIterResult(data, false));
|
|
215925
215925
|
}
|
|
215926
215926
|
}
|
|
215927
215927
|
}
|
|
@@ -215929,13 +215929,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
215929
215929
|
process.nextTick(readAndResolve, iter);
|
|
215930
215930
|
}
|
|
215931
215931
|
function wrapForNext(lastPromise, iter) {
|
|
215932
|
-
return function(
|
|
215932
|
+
return function(resolve13, reject) {
|
|
215933
215933
|
lastPromise.then(function() {
|
|
215934
215934
|
if (iter[kEnded]) {
|
|
215935
|
-
|
|
215935
|
+
resolve13(createIterResult(undefined, true));
|
|
215936
215936
|
return;
|
|
215937
215937
|
}
|
|
215938
|
-
iter[kHandlePromise](
|
|
215938
|
+
iter[kHandlePromise](resolve13, reject);
|
|
215939
215939
|
}, reject);
|
|
215940
215940
|
};
|
|
215941
215941
|
}
|
|
@@ -215954,12 +215954,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
215954
215954
|
return Promise.resolve(createIterResult(undefined, true));
|
|
215955
215955
|
}
|
|
215956
215956
|
if (this[kStream].destroyed) {
|
|
215957
|
-
return new Promise(function(
|
|
215957
|
+
return new Promise(function(resolve13, reject) {
|
|
215958
215958
|
process.nextTick(function() {
|
|
215959
215959
|
if (_this[kError]) {
|
|
215960
215960
|
reject(_this[kError]);
|
|
215961
215961
|
} else {
|
|
215962
|
-
|
|
215962
|
+
resolve13(createIterResult(undefined, true));
|
|
215963
215963
|
}
|
|
215964
215964
|
});
|
|
215965
215965
|
});
|
|
@@ -215982,13 +215982,13 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
215982
215982
|
return this;
|
|
215983
215983
|
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
215984
215984
|
var _this2 = this;
|
|
215985
|
-
return new Promise(function(
|
|
215985
|
+
return new Promise(function(resolve13, reject) {
|
|
215986
215986
|
_this2[kStream].destroy(null, function(err) {
|
|
215987
215987
|
if (err) {
|
|
215988
215988
|
reject(err);
|
|
215989
215989
|
return;
|
|
215990
215990
|
}
|
|
215991
|
-
|
|
215991
|
+
resolve13(createIterResult(undefined, true));
|
|
215992
215992
|
});
|
|
215993
215993
|
});
|
|
215994
215994
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
@@ -216010,15 +216010,15 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
216010
216010
|
value: stream._readableState.endEmitted,
|
|
216011
216011
|
writable: true
|
|
216012
216012
|
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
216013
|
-
value: function value(
|
|
216013
|
+
value: function value(resolve13, reject) {
|
|
216014
216014
|
var data = iterator[kStream].read();
|
|
216015
216015
|
if (data) {
|
|
216016
216016
|
iterator[kLastPromise] = null;
|
|
216017
216017
|
iterator[kLastResolve] = null;
|
|
216018
216018
|
iterator[kLastReject] = null;
|
|
216019
|
-
|
|
216019
|
+
resolve13(createIterResult(data, false));
|
|
216020
216020
|
} else {
|
|
216021
|
-
iterator[kLastResolve] =
|
|
216021
|
+
iterator[kLastResolve] = resolve13;
|
|
216022
216022
|
iterator[kLastReject] = reject;
|
|
216023
216023
|
}
|
|
216024
216024
|
},
|
|
@@ -216037,12 +216037,12 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
216037
216037
|
iterator[kError] = err;
|
|
216038
216038
|
return;
|
|
216039
216039
|
}
|
|
216040
|
-
var
|
|
216041
|
-
if (
|
|
216040
|
+
var resolve13 = iterator[kLastResolve];
|
|
216041
|
+
if (resolve13 !== null) {
|
|
216042
216042
|
iterator[kLastPromise] = null;
|
|
216043
216043
|
iterator[kLastResolve] = null;
|
|
216044
216044
|
iterator[kLastReject] = null;
|
|
216045
|
-
|
|
216045
|
+
resolve13(createIterResult(undefined, true));
|
|
216046
216046
|
}
|
|
216047
216047
|
iterator[kEnded] = true;
|
|
216048
216048
|
});
|
|
@@ -216054,7 +216054,7 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
216054
216054
|
|
|
216055
216055
|
// ../../node_modules/readable-stream/lib/internal/streams/from.js
|
|
216056
216056
|
var require_from = __commonJS((exports, module) => {
|
|
216057
|
-
function asyncGeneratorStep(gen,
|
|
216057
|
+
function asyncGeneratorStep(gen, resolve13, reject, _next, _throw, key2, arg) {
|
|
216058
216058
|
try {
|
|
216059
216059
|
var info = gen[key2](arg);
|
|
216060
216060
|
var value = info.value;
|
|
@@ -216063,7 +216063,7 @@ var require_from = __commonJS((exports, module) => {
|
|
|
216063
216063
|
return;
|
|
216064
216064
|
}
|
|
216065
216065
|
if (info.done) {
|
|
216066
|
-
|
|
216066
|
+
resolve13(value);
|
|
216067
216067
|
} else {
|
|
216068
216068
|
Promise.resolve(value).then(_next, _throw);
|
|
216069
216069
|
}
|
|
@@ -216071,13 +216071,13 @@ var require_from = __commonJS((exports, module) => {
|
|
|
216071
216071
|
function _asyncToGenerator(fn9) {
|
|
216072
216072
|
return function() {
|
|
216073
216073
|
var self2 = this, args = arguments;
|
|
216074
|
-
return new Promise(function(
|
|
216074
|
+
return new Promise(function(resolve13, reject) {
|
|
216075
216075
|
var gen = fn9.apply(self2, args);
|
|
216076
216076
|
function _next(value) {
|
|
216077
|
-
asyncGeneratorStep(gen,
|
|
216077
|
+
asyncGeneratorStep(gen, resolve13, reject, _next, _throw, "next", value);
|
|
216078
216078
|
}
|
|
216079
216079
|
function _throw(err) {
|
|
216080
|
-
asyncGeneratorStep(gen,
|
|
216080
|
+
asyncGeneratorStep(gen, resolve13, reject, _next, _throw, "throw", err);
|
|
216081
216081
|
}
|
|
216082
216082
|
_next(undefined);
|
|
216083
216083
|
});
|
|
@@ -218279,6 +218279,7 @@ var CONFIG_FILE_EXTENSION = "jsonc";
|
|
|
218279
218279
|
var CONFIG_FILE_EXTENSION_GLOB = "{json,jsonc}";
|
|
218280
218280
|
var FUNCTION_CONFIG_GLOB = `**/function.${CONFIG_FILE_EXTENSION_GLOB}`;
|
|
218281
218281
|
var ENTRY_FILE_GLOB = "**/entry.{js,ts}";
|
|
218282
|
+
var BACKEND_FILE_GLOB = "**/*.{js,ts,json,jsonc}";
|
|
218282
218283
|
var ENTRY_IGNORE_DOT_PATHS = ["**/*.*/**"];
|
|
218283
218284
|
var APP_CONFIG_PATTERN = `**/.app.${CONFIG_FILE_EXTENSION_GLOB}`;
|
|
218284
218285
|
var PROJECT_CONFIG_PATTERNS = [
|
|
@@ -233819,6 +233820,9 @@ class ApiError extends SystemError {
|
|
|
233819
233820
|
}
|
|
233820
233821
|
];
|
|
233821
233822
|
}
|
|
233823
|
+
if (statusCode && statusCode < 500) {
|
|
233824
|
+
return [];
|
|
233825
|
+
}
|
|
233822
233826
|
return [{ message: "Check your network connection and try again" }];
|
|
233823
233827
|
}
|
|
233824
233828
|
static getReasonHints(parsedResponse) {
|
|
@@ -236040,11 +236044,13 @@ var PluginMetadataSchema = exports_external.object({
|
|
|
236040
236044
|
var PluginReferenceSchema = exports_external.object({
|
|
236041
236045
|
source: exports_external.string().min(1, "Plugin source cannot be empty")
|
|
236042
236046
|
});
|
|
236047
|
+
var VISIBILITY_LEVELS = ["public", "private", "workspace"];
|
|
236043
236048
|
var ProjectConfigSchema = exports_external.object({
|
|
236044
236049
|
name: exports_external.string({
|
|
236045
236050
|
error: "App name cannot be empty"
|
|
236046
236051
|
}).min(1, "App name cannot be empty"),
|
|
236047
236052
|
description: exports_external.string().optional(),
|
|
236053
|
+
visibility: exports_external.enum(VISIBILITY_LEVELS).optional(),
|
|
236048
236054
|
site: SiteConfigSchema.optional(),
|
|
236049
236055
|
entitiesDir: exports_external.string().optional().default("entities"),
|
|
236050
236056
|
functionsDir: exports_external.string().optional().default("functions"),
|
|
@@ -236060,6 +236066,15 @@ var AppConfigSchema = exports_external.object({
|
|
|
236060
236066
|
var CreateProjectResponseSchema = exports_external.looseObject({
|
|
236061
236067
|
id: exports_external.string()
|
|
236062
236068
|
});
|
|
236069
|
+
var AppDetailSchema = exports_external.looseObject({
|
|
236070
|
+
id: exports_external.string(),
|
|
236071
|
+
name: exports_external.string().optional(),
|
|
236072
|
+
organization_id: exports_external.string().nullish()
|
|
236073
|
+
}).transform((data) => ({
|
|
236074
|
+
id: data.id,
|
|
236075
|
+
name: data.name,
|
|
236076
|
+
organizationId: data.organization_id ?? undefined
|
|
236077
|
+
}));
|
|
236063
236078
|
var ProjectSchema = exports_external.object({
|
|
236064
236079
|
id: exports_external.string(),
|
|
236065
236080
|
name: exports_external.string(),
|
|
@@ -241839,7 +241854,12 @@ var PublishedUrlResponseSchema = exports_external.object({
|
|
|
241839
241854
|
});
|
|
241840
241855
|
|
|
241841
241856
|
// src/core/project/api.ts
|
|
241842
|
-
|
|
241857
|
+
var PUBLIC_SETTINGS = {
|
|
241858
|
+
public: "public_without_login",
|
|
241859
|
+
private: "private_with_login",
|
|
241860
|
+
workspace: "workspace_with_login"
|
|
241861
|
+
};
|
|
241862
|
+
async function createProject(projectName, description, organizationId) {
|
|
241843
241863
|
let response;
|
|
241844
241864
|
try {
|
|
241845
241865
|
response = await base44Client.post("api/apps", {
|
|
@@ -241847,7 +241867,8 @@ async function createProject(projectName, description) {
|
|
|
241847
241867
|
name: projectName,
|
|
241848
241868
|
user_description: description ?? `Backend for '${projectName}'`,
|
|
241849
241869
|
is_managed_source_code: false,
|
|
241850
|
-
public_settings:
|
|
241870
|
+
public_settings: PUBLIC_SETTINGS.public,
|
|
241871
|
+
...organizationId ? { organization_id: organizationId } : {}
|
|
241851
241872
|
}
|
|
241852
241873
|
});
|
|
241853
241874
|
} catch (error48) {
|
|
@@ -241861,6 +241882,18 @@ async function createProject(projectName, description) {
|
|
|
241861
241882
|
projectId: result.data.id
|
|
241862
241883
|
};
|
|
241863
241884
|
}
|
|
241885
|
+
async function setAppVisibility(visibility) {
|
|
241886
|
+
if (!visibility)
|
|
241887
|
+
return;
|
|
241888
|
+
const { id } = getAppContext();
|
|
241889
|
+
try {
|
|
241890
|
+
await base44Client.put(`api/apps/${id}`, {
|
|
241891
|
+
json: { public_settings: PUBLIC_SETTINGS[visibility] }
|
|
241892
|
+
});
|
|
241893
|
+
} catch (error48) {
|
|
241894
|
+
throw await ApiError.fromHttpError(error48, "updating app visibility");
|
|
241895
|
+
}
|
|
241896
|
+
}
|
|
241864
241897
|
async function listProjects() {
|
|
241865
241898
|
let response;
|
|
241866
241899
|
try {
|
|
@@ -241880,6 +241913,21 @@ async function listProjects() {
|
|
|
241880
241913
|
}
|
|
241881
241914
|
return result.data;
|
|
241882
241915
|
}
|
|
241916
|
+
async function getApp(appId) {
|
|
241917
|
+
let response;
|
|
241918
|
+
try {
|
|
241919
|
+
response = await base44Client.get(`api/apps/${appId}`, {
|
|
241920
|
+
searchParams: { fields: "id,name,organization_id" }
|
|
241921
|
+
});
|
|
241922
|
+
} catch (error48) {
|
|
241923
|
+
throw await ApiError.fromHttpError(error48, "fetching app");
|
|
241924
|
+
}
|
|
241925
|
+
const result = AppDetailSchema.safeParse(await response.json());
|
|
241926
|
+
if (!result.success) {
|
|
241927
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
241928
|
+
}
|
|
241929
|
+
return result.data;
|
|
241930
|
+
}
|
|
241883
241931
|
async function downloadProject(projectId, projectPath) {
|
|
241884
241932
|
let response;
|
|
241885
241933
|
try {
|
|
@@ -243569,7 +243617,14 @@ async function fetchFunctionLogs(functionName, filters = {}) {
|
|
|
243569
243617
|
return result.data;
|
|
243570
243618
|
}
|
|
243571
243619
|
// src/core/resources/function/config.ts
|
|
243572
|
-
import { basename as basename3, dirname as dirname6, join as join8, relative } from "node:path";
|
|
243620
|
+
import { basename as basename3, dirname as dirname6, join as join8, relative, resolve as resolve2 } from "node:path";
|
|
243621
|
+
async function readSharedFiles(functionsDir) {
|
|
243622
|
+
const sharedDir = resolve2(functionsDir, "..", "shared");
|
|
243623
|
+
if (!await pathExists(sharedDir)) {
|
|
243624
|
+
return [];
|
|
243625
|
+
}
|
|
243626
|
+
return globby(BACKEND_FILE_GLOB, { cwd: sharedDir, absolute: true });
|
|
243627
|
+
}
|
|
243573
243628
|
async function readFunctionConfig(configPath) {
|
|
243574
243629
|
const parsed = await readJsonFile(configPath);
|
|
243575
243630
|
const result = FunctionConfigSchema.safeParse(parsed);
|
|
@@ -243578,7 +243633,7 @@ async function readFunctionConfig(configPath) {
|
|
|
243578
243633
|
}
|
|
243579
243634
|
return result.data;
|
|
243580
243635
|
}
|
|
243581
|
-
async function readFunction(configPath) {
|
|
243636
|
+
async function readFunction(configPath, sharedFiles) {
|
|
243582
243637
|
const config7 = await readFunctionConfig(configPath);
|
|
243583
243638
|
const functionDir = dirname6(configPath);
|
|
243584
243639
|
const entryPath = join8(functionDir, config7.entry);
|
|
@@ -243587,14 +243642,15 @@ async function readFunction(configPath) {
|
|
|
243587
243642
|
hints: [{ message: "Check the 'entry' field in your function config" }]
|
|
243588
243643
|
});
|
|
243589
243644
|
}
|
|
243590
|
-
const filePaths = await globby(
|
|
243645
|
+
const filePaths = await globby(BACKEND_FILE_GLOB, {
|
|
243591
243646
|
cwd: functionDir,
|
|
243592
243647
|
absolute: true
|
|
243593
243648
|
});
|
|
243649
|
+
const allFilePaths = [...new Set([...filePaths, ...sharedFiles])];
|
|
243594
243650
|
const functionData = {
|
|
243595
243651
|
...config7,
|
|
243596
243652
|
entryPath,
|
|
243597
|
-
filePaths,
|
|
243653
|
+
filePaths: allFilePaths,
|
|
243598
243654
|
source: { type: "project" }
|
|
243599
243655
|
};
|
|
243600
243656
|
return functionData;
|
|
@@ -243614,13 +243670,15 @@ async function readAllFunctions(functionsDir) {
|
|
|
243614
243670
|
});
|
|
243615
243671
|
const configFilesDirs = new Set(configFiles.map((f) => dirname6(f)));
|
|
243616
243672
|
const entryFilesWithoutConfig = entryFiles.filter((entryFile) => !configFilesDirs.has(dirname6(entryFile)));
|
|
243617
|
-
const
|
|
243673
|
+
const sharedFiles = await readSharedFiles(functionsDir);
|
|
243674
|
+
const functionsFromConfig = await Promise.all(configFiles.map((configPath) => readFunction(configPath, sharedFiles)));
|
|
243618
243675
|
const functionsWithoutConfig = await Promise.all(entryFilesWithoutConfig.map(async (entryFile) => {
|
|
243619
243676
|
const functionDir = dirname6(entryFile);
|
|
243620
|
-
const filePaths = await globby(
|
|
243677
|
+
const filePaths = await globby(BACKEND_FILE_GLOB, {
|
|
243621
243678
|
cwd: functionDir,
|
|
243622
243679
|
absolute: true
|
|
243623
243680
|
});
|
|
243681
|
+
const allFilePaths = [...new Set([...filePaths, ...sharedFiles])];
|
|
243624
243682
|
const name2 = relative(functionsDir, functionDir).split(/[/\\]/).join("/");
|
|
243625
243683
|
if (!name2) {
|
|
243626
243684
|
throw new InvalidInputError("entry.ts found directly in the functions directory — it must be inside a named subfolder", {
|
|
@@ -243636,7 +243694,7 @@ async function readAllFunctions(functionsDir) {
|
|
|
243636
243694
|
name: name2,
|
|
243637
243695
|
entry,
|
|
243638
243696
|
entryPath: entryFile,
|
|
243639
|
-
filePaths,
|
|
243697
|
+
filePaths: allFilePaths,
|
|
243640
243698
|
source: { type: "project" }
|
|
243641
243699
|
};
|
|
243642
243700
|
return functionData;
|
|
@@ -243953,7 +244011,7 @@ import { join as join11 } from "node:path";
|
|
|
243953
244011
|
// package.json
|
|
243954
244012
|
var package_default = {
|
|
243955
244013
|
name: "base44",
|
|
243956
|
-
version: "0.1.
|
|
244014
|
+
version: "0.1.4",
|
|
243957
244015
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
243958
244016
|
type: "module",
|
|
243959
244017
|
bin: {
|
|
@@ -244130,9 +244188,15 @@ async function assertProjectNotExists(dirPath) {
|
|
|
244130
244188
|
}
|
|
244131
244189
|
}
|
|
244132
244190
|
async function createProjectFiles(options) {
|
|
244133
|
-
const {
|
|
244191
|
+
const {
|
|
244192
|
+
name: name2,
|
|
244193
|
+
description,
|
|
244194
|
+
path: basePath,
|
|
244195
|
+
template,
|
|
244196
|
+
organizationId
|
|
244197
|
+
} = options;
|
|
244134
244198
|
await assertProjectNotExists(basePath);
|
|
244135
|
-
const { projectId } = await createProject(name2, description);
|
|
244199
|
+
const { projectId } = await createProject(name2, description, organizationId);
|
|
244136
244200
|
await renderTemplate(template, basePath, { name: name2, description, projectId });
|
|
244137
244201
|
return {
|
|
244138
244202
|
projectId,
|
|
@@ -244163,7 +244227,7 @@ async function createProjectFilesForExistingProject(options) {
|
|
|
244163
244227
|
};
|
|
244164
244228
|
}
|
|
244165
244229
|
// src/core/project/deploy.ts
|
|
244166
|
-
import { resolve as
|
|
244230
|
+
import { resolve as resolve3 } from "node:path";
|
|
244167
244231
|
|
|
244168
244232
|
// src/core/site/api.ts
|
|
244169
244233
|
async function uploadSite(archivePath) {
|
|
@@ -244239,10 +244303,15 @@ function hasResourcesToDeploy(projectData) {
|
|
|
244239
244303
|
const hasAgents = agents.length > 0;
|
|
244240
244304
|
const hasConnectors = connectors.length > 0;
|
|
244241
244305
|
const hasAuthConfig = authConfig.length > 0;
|
|
244242
|
-
|
|
244306
|
+
const hasVisibility = Boolean(project.visibility);
|
|
244307
|
+
return hasEntities || hasFunctions || hasAgents || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
|
|
244243
244308
|
}
|
|
244244
244309
|
async function deployAll(projectData, options) {
|
|
244245
244310
|
const { project, entities, functions, agents, connectors, authConfig } = projectData;
|
|
244311
|
+
await setAppVisibility(project.visibility);
|
|
244312
|
+
if (project.visibility) {
|
|
244313
|
+
options?.onVisibilitySet?.(project.visibility);
|
|
244314
|
+
}
|
|
244246
244315
|
await entityResource.push(entities);
|
|
244247
244316
|
await deployFunctionsSequentially(functions, {
|
|
244248
244317
|
onStart: options?.onFunctionStart,
|
|
@@ -244253,7 +244322,7 @@ async function deployAll(projectData, options) {
|
|
|
244253
244322
|
const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
|
|
244254
244323
|
const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
|
|
244255
244324
|
if (project.site?.outputDirectory) {
|
|
244256
|
-
const outputDir =
|
|
244325
|
+
const outputDir = resolve3(project.root, project.site.outputDirectory);
|
|
244257
244326
|
const { appUrl } = await deploySite(outputDir);
|
|
244258
244327
|
return { appUrl, connectorResults };
|
|
244259
244328
|
}
|
|
@@ -246089,8 +246158,8 @@ var disconnect = (anyProcess) => {
|
|
|
246089
246158
|
// ../../node_modules/execa/lib/utils/deferred.js
|
|
246090
246159
|
var createDeferred = () => {
|
|
246091
246160
|
const methods = {};
|
|
246092
|
-
const promise2 = new Promise((
|
|
246093
|
-
Object.assign(methods, { resolve:
|
|
246161
|
+
const promise2 = new Promise((resolve4, reject) => {
|
|
246162
|
+
Object.assign(methods, { resolve: resolve4, reject });
|
|
246094
246163
|
});
|
|
246095
246164
|
return Object.assign(promise2, methods);
|
|
246096
246165
|
};
|
|
@@ -250454,11 +250523,11 @@ var addConcurrentStream = (concurrentStreams, stream, waitName) => {
|
|
|
250454
250523
|
const promises = weakMap.get(stream);
|
|
250455
250524
|
const promise2 = createDeferred();
|
|
250456
250525
|
promises.push(promise2);
|
|
250457
|
-
const
|
|
250458
|
-
return { resolve:
|
|
250526
|
+
const resolve4 = promise2.resolve.bind(promise2);
|
|
250527
|
+
return { resolve: resolve4, promises };
|
|
250459
250528
|
};
|
|
250460
|
-
var waitForConcurrentStreams = async ({ resolve:
|
|
250461
|
-
|
|
250529
|
+
var waitForConcurrentStreams = async ({ resolve: resolve4, promises }, subprocess) => {
|
|
250530
|
+
resolve4();
|
|
250462
250531
|
const [isSubprocessExit] = await Promise.race([
|
|
250463
250532
|
Promise.allSettled([true, subprocess]),
|
|
250464
250533
|
Promise.all([false, ...promises])
|
|
@@ -251453,6 +251522,78 @@ function verifyDenoInstalled(context) {
|
|
|
251453
251522
|
});
|
|
251454
251523
|
}
|
|
251455
251524
|
}
|
|
251525
|
+
// src/core/workspace/schema.ts
|
|
251526
|
+
var WorkspaceSchema = exports_external.object({
|
|
251527
|
+
id: exports_external.string(),
|
|
251528
|
+
name: exports_external.string(),
|
|
251529
|
+
user_role: exports_external.string().nullish(),
|
|
251530
|
+
subscription_tier: exports_external.string().nullish(),
|
|
251531
|
+
is_enterprise: exports_external.boolean().nullish()
|
|
251532
|
+
}).transform((data) => ({
|
|
251533
|
+
id: data.id,
|
|
251534
|
+
name: data.name,
|
|
251535
|
+
userRole: data.user_role ?? undefined,
|
|
251536
|
+
subscriptionTier: data.subscription_tier ?? undefined,
|
|
251537
|
+
isEnterprise: data.is_enterprise ?? undefined
|
|
251538
|
+
}));
|
|
251539
|
+
var WorkspaceListResponseSchema = exports_external.object({
|
|
251540
|
+
workspaces: exports_external.array(WorkspaceSchema)
|
|
251541
|
+
});
|
|
251542
|
+
var MoveAppResponseSchema = exports_external.looseObject({
|
|
251543
|
+
success: exports_external.boolean().optional(),
|
|
251544
|
+
message: exports_external.string().optional(),
|
|
251545
|
+
app_id: exports_external.string().optional(),
|
|
251546
|
+
new_workspace_id: exports_external.string().optional()
|
|
251547
|
+
}).transform((data) => ({
|
|
251548
|
+
success: data.success ?? true,
|
|
251549
|
+
message: data.message,
|
|
251550
|
+
appId: data.app_id,
|
|
251551
|
+
newWorkspaceId: data.new_workspace_id
|
|
251552
|
+
}));
|
|
251553
|
+
var APP_EDITOR_ROLES = ["owner", "admin", "editor"];
|
|
251554
|
+
function canCreateAppsInWorkspace(role) {
|
|
251555
|
+
return role !== undefined && APP_EDITOR_ROLES.includes(role.toLowerCase());
|
|
251556
|
+
}
|
|
251557
|
+
|
|
251558
|
+
// src/core/workspace/api.ts
|
|
251559
|
+
async function listWorkspaces() {
|
|
251560
|
+
let response;
|
|
251561
|
+
try {
|
|
251562
|
+
response = await base44Client.get("api/workspace/workspaces");
|
|
251563
|
+
} catch (error48) {
|
|
251564
|
+
throw await ApiError.fromHttpError(error48, "listing workspaces");
|
|
251565
|
+
}
|
|
251566
|
+
const result = WorkspaceListResponseSchema.safeParse(await response.json());
|
|
251567
|
+
if (!result.success) {
|
|
251568
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
251569
|
+
}
|
|
251570
|
+
return result.data.workspaces.map((workspace, index) => ({
|
|
251571
|
+
...workspace,
|
|
251572
|
+
isPersonal: index === 0
|
|
251573
|
+
}));
|
|
251574
|
+
}
|
|
251575
|
+
async function getWorkspace(id) {
|
|
251576
|
+
const workspaces = await listWorkspaces();
|
|
251577
|
+
return workspaces.find((w) => w.id === id);
|
|
251578
|
+
}
|
|
251579
|
+
async function moveAppToWorkspace(appId, targetWorkspaceId, options = {}) {
|
|
251580
|
+
let response;
|
|
251581
|
+
try {
|
|
251582
|
+
response = await base44Client.post(`api/apps/${appId}/metadata/move-to-workspace`, {
|
|
251583
|
+
json: {
|
|
251584
|
+
target_workspace_id: targetWorkspaceId,
|
|
251585
|
+
disconnect_integrations: options.disconnectIntegrations ?? false
|
|
251586
|
+
}
|
|
251587
|
+
});
|
|
251588
|
+
} catch (error48) {
|
|
251589
|
+
throw await ApiError.fromHttpError(error48, "moving app to workspace");
|
|
251590
|
+
}
|
|
251591
|
+
const result = MoveAppResponseSchema.safeParse(await response.json());
|
|
251592
|
+
if (!result.success) {
|
|
251593
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
251594
|
+
}
|
|
251595
|
+
return result.data;
|
|
251596
|
+
}
|
|
251456
251597
|
// src/cli/commands/agents/pull.ts
|
|
251457
251598
|
async function pullAgentsAction({
|
|
251458
251599
|
log,
|
|
@@ -251620,7 +251761,7 @@ function getAuthPushCommand() {
|
|
|
251620
251761
|
}
|
|
251621
251762
|
|
|
251622
251763
|
// src/cli/commands/auth/social-login.ts
|
|
251623
|
-
import { dirname as dirname13, join as join17, resolve as
|
|
251764
|
+
import { dirname as dirname13, join as join17, resolve as resolve4 } from "node:path";
|
|
251624
251765
|
var PROVIDER_LABELS = {
|
|
251625
251766
|
google: "Google",
|
|
251626
251767
|
microsoft: "Microsoft",
|
|
@@ -251660,7 +251801,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
|
|
|
251660
251801
|
let clientSecret;
|
|
251661
251802
|
if (useCustomOAuth && oauth && oauthCli && hasSecretOptions(options)) {
|
|
251662
251803
|
if (options.envFile) {
|
|
251663
|
-
const secrets = await parseEnvFile(
|
|
251804
|
+
const secrets = await parseEnvFile(resolve4(options.envFile));
|
|
251664
251805
|
const value = secrets[oauthCli.envVar];
|
|
251665
251806
|
if (!value) {
|
|
251666
251807
|
throw new InvalidInputError(`Key "${oauthCli.envVar}" not found in ${options.envFile}.`);
|
|
@@ -251716,7 +251857,7 @@ function getSocialLoginCommand() {
|
|
|
251716
251857
|
}
|
|
251717
251858
|
|
|
251718
251859
|
// src/cli/commands/auth/sso.ts
|
|
251719
|
-
import { dirname as dirname14, join as join18, resolve as
|
|
251860
|
+
import { dirname as dirname14, join as join18, resolve as resolve5 } from "node:path";
|
|
251720
251861
|
var SSOConfigFileSchema = exports_external.object({
|
|
251721
251862
|
provider: exports_external.enum(Object.values(KNOWN_SSO_PROVIDERS)),
|
|
251722
251863
|
clientId: exports_external.string(),
|
|
@@ -251732,7 +251873,7 @@ var SSOConfigFileSchema = exports_external.object({
|
|
|
251732
251873
|
ssoName: exports_external.string().optional()
|
|
251733
251874
|
});
|
|
251734
251875
|
async function loadSSOConfigFile(filePath) {
|
|
251735
|
-
const resolved =
|
|
251876
|
+
const resolved = resolve5(filePath);
|
|
251736
251877
|
const raw2 = await readJsonFile(resolved);
|
|
251737
251878
|
const result = SSOConfigFileSchema.safeParse(raw2);
|
|
251738
251879
|
if (!result.success) {
|
|
@@ -251820,7 +251961,7 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
|
|
|
251820
251961
|
}
|
|
251821
251962
|
let clientSecret;
|
|
251822
251963
|
if (merged.envFile && !merged.clientSecret) {
|
|
251823
|
-
const secrets2 = await parseEnvFile(
|
|
251964
|
+
const secrets2 = await parseEnvFile(resolve5(merged.envFile));
|
|
251824
251965
|
const value = secrets2.sso_client_secret;
|
|
251825
251966
|
if (!value) {
|
|
251826
251967
|
throw new InvalidInputError(`Key "sso_client_secret" not found in ${merged.envFile}.`);
|
|
@@ -252458,19 +252599,19 @@ var baseOpen = async (options) => {
|
|
|
252458
252599
|
}
|
|
252459
252600
|
const subprocess = childProcess3.spawn(command2, cliArguments, childProcessOptions);
|
|
252460
252601
|
if (options.wait) {
|
|
252461
|
-
return new Promise((
|
|
252602
|
+
return new Promise((resolve6, reject) => {
|
|
252462
252603
|
subprocess.once("error", reject);
|
|
252463
252604
|
subprocess.once("close", (exitCode) => {
|
|
252464
252605
|
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
252465
252606
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
252466
252607
|
return;
|
|
252467
252608
|
}
|
|
252468
|
-
|
|
252609
|
+
resolve6(subprocess);
|
|
252469
252610
|
});
|
|
252470
252611
|
});
|
|
252471
252612
|
}
|
|
252472
252613
|
if (isFallbackAttempt) {
|
|
252473
|
-
return new Promise((
|
|
252614
|
+
return new Promise((resolve6, reject) => {
|
|
252474
252615
|
subprocess.once("error", reject);
|
|
252475
252616
|
subprocess.once("spawn", () => {
|
|
252476
252617
|
subprocess.once("close", (exitCode) => {
|
|
@@ -252480,17 +252621,17 @@ var baseOpen = async (options) => {
|
|
|
252480
252621
|
return;
|
|
252481
252622
|
}
|
|
252482
252623
|
subprocess.unref();
|
|
252483
|
-
|
|
252624
|
+
resolve6(subprocess);
|
|
252484
252625
|
});
|
|
252485
252626
|
});
|
|
252486
252627
|
});
|
|
252487
252628
|
}
|
|
252488
252629
|
subprocess.unref();
|
|
252489
|
-
return new Promise((
|
|
252630
|
+
return new Promise((resolve6, reject) => {
|
|
252490
252631
|
subprocess.once("error", reject);
|
|
252491
252632
|
subprocess.once("spawn", () => {
|
|
252492
252633
|
subprocess.off("error", reject);
|
|
252493
|
-
|
|
252634
|
+
resolve6(subprocess);
|
|
252494
252635
|
});
|
|
252495
252636
|
});
|
|
252496
252637
|
};
|
|
@@ -252753,10 +252894,10 @@ function getConnectorsListAvailableCommand() {
|
|
|
252753
252894
|
}
|
|
252754
252895
|
|
|
252755
252896
|
// src/cli/commands/connectors/pull.ts
|
|
252756
|
-
import { dirname as dirname15, join as join19, resolve as
|
|
252897
|
+
import { dirname as dirname15, join as join19, resolve as resolve6 } from "node:path";
|
|
252757
252898
|
async function resolveConnectorsDir(options) {
|
|
252758
252899
|
if (!getAppContext().projectRoot) {
|
|
252759
|
-
return
|
|
252900
|
+
return resolve6(options.dir ?? "connectors");
|
|
252760
252901
|
}
|
|
252761
252902
|
const { project: project2 } = await readProjectConfig();
|
|
252762
252903
|
return join19(dirname15(project2.configPath), project2.connectorsDir);
|
|
@@ -252800,10 +252941,10 @@ function getConnectorsPullCommand() {
|
|
|
252800
252941
|
}
|
|
252801
252942
|
|
|
252802
252943
|
// src/cli/commands/connectors/push.ts
|
|
252803
|
-
import { resolve as
|
|
252944
|
+
import { resolve as resolve7 } from "node:path";
|
|
252804
252945
|
async function readConnectorsToPush(options) {
|
|
252805
252946
|
if (!getAppContext().projectRoot) {
|
|
252806
|
-
return readAllConnectors(
|
|
252947
|
+
return readAllConnectors(resolve7(options.dir ?? "connectors"));
|
|
252807
252948
|
}
|
|
252808
252949
|
const { connectors } = await readProjectConfig();
|
|
252809
252950
|
return connectors;
|
|
@@ -253215,7 +253356,7 @@ function getFunctionsCommand() {
|
|
|
253215
253356
|
}
|
|
253216
253357
|
|
|
253217
253358
|
// src/cli/commands/project/create.ts
|
|
253218
|
-
import { basename as basename4, resolve as
|
|
253359
|
+
import { basename as basename4, resolve as resolve8 } from "node:path";
|
|
253219
253360
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
253220
253361
|
|
|
253221
253362
|
// src/cli/commands/project/scaffold-shared.ts
|
|
@@ -253313,6 +253454,58 @@ function printProjectSummary({ name: name2, dashboardUrl, appUrl }, log) {
|
|
|
253313
253454
|
}
|
|
253314
253455
|
}
|
|
253315
253456
|
|
|
253457
|
+
// src/cli/commands/project/workspace-select.ts
|
|
253458
|
+
function fetchWorkspaces(ctx) {
|
|
253459
|
+
return ctx.runTask("Fetching workspaces...", () => listWorkspaces(), {
|
|
253460
|
+
successMessage: "Workspaces fetched",
|
|
253461
|
+
errorMessage: "Failed to fetch workspaces"
|
|
253462
|
+
});
|
|
253463
|
+
}
|
|
253464
|
+
function workspaceHints(workspaces) {
|
|
253465
|
+
return [
|
|
253466
|
+
{ message: "Run 'base44 workspace list' to see available workspaces" },
|
|
253467
|
+
...workspaces.filter((w) => canCreateAppsInWorkspace(w.userRole)).map((w) => ({ message: `${w.name} — ${w.id}` }))
|
|
253468
|
+
];
|
|
253469
|
+
}
|
|
253470
|
+
function workspaceLabel(workspace2) {
|
|
253471
|
+
const suffix = workspace2.isPersonal ? "personal" : workspace2.userRole ?? "member";
|
|
253472
|
+
return `${workspace2.name} (${suffix})`;
|
|
253473
|
+
}
|
|
253474
|
+
async function resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive) {
|
|
253475
|
+
if (flagWorkspaceId) {
|
|
253476
|
+
const workspaces2 = await fetchWorkspaces(ctx);
|
|
253477
|
+
const match = workspaces2.find((w) => w.id === flagWorkspaceId);
|
|
253478
|
+
if (!match) {
|
|
253479
|
+
throw new InvalidInputError(`Workspace "${flagWorkspaceId}" not found, or you are not a member of it.`, { hints: workspaceHints(workspaces2) });
|
|
253480
|
+
}
|
|
253481
|
+
if (!canCreateAppsInWorkspace(match.userRole)) {
|
|
253482
|
+
throw new InvalidInputError(`You don't have permission to create apps in workspace "${match.name}" (your role: ${match.userRole ?? "unknown"}).`);
|
|
253483
|
+
}
|
|
253484
|
+
return match.id;
|
|
253485
|
+
}
|
|
253486
|
+
if (!isInteractive) {
|
|
253487
|
+
return;
|
|
253488
|
+
}
|
|
253489
|
+
const workspaces = await fetchWorkspaces(ctx);
|
|
253490
|
+
const eligible = workspaces.filter((w) => canCreateAppsInWorkspace(w.userRole));
|
|
253491
|
+
if (eligible.length <= 1) {
|
|
253492
|
+
return;
|
|
253493
|
+
}
|
|
253494
|
+
const options = eligible.map((w) => ({
|
|
253495
|
+
value: w.id,
|
|
253496
|
+
label: workspaceLabel(w)
|
|
253497
|
+
}));
|
|
253498
|
+
const selected = await Je({
|
|
253499
|
+
message: "Which workspace should this app belong to?",
|
|
253500
|
+
options,
|
|
253501
|
+
initialValue: eligible[0].id
|
|
253502
|
+
});
|
|
253503
|
+
if (Ct(selected)) {
|
|
253504
|
+
onPromptCancel();
|
|
253505
|
+
}
|
|
253506
|
+
return selected;
|
|
253507
|
+
}
|
|
253508
|
+
|
|
253316
253509
|
// src/cli/commands/project/create.ts
|
|
253317
253510
|
function validateCreateOptions(command2) {
|
|
253318
253511
|
const { appId } = command2.optsWithGlobals();
|
|
@@ -253365,11 +253558,12 @@ async function createInteractive(options, ctx) {
|
|
|
253365
253558
|
projectPath: result.projectPath,
|
|
253366
253559
|
deploy: options.deploy,
|
|
253367
253560
|
skills: options.skills,
|
|
253561
|
+
workspaceId: options.workspace ?? options.org,
|
|
253368
253562
|
isInteractive: true
|
|
253369
253563
|
}, ctx);
|
|
253370
253564
|
}
|
|
253371
253565
|
async function createNonInteractive(options, ctx) {
|
|
253372
|
-
ctx.log.info(`Creating a new project at ${
|
|
253566
|
+
ctx.log.info(`Creating a new project at ${resolve8(options.path)}`);
|
|
253373
253567
|
const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
253374
253568
|
return await executeCreate({
|
|
253375
253569
|
template: template2,
|
|
@@ -253377,6 +253571,7 @@ async function createNonInteractive(options, ctx) {
|
|
|
253377
253571
|
projectPath: options.path,
|
|
253378
253572
|
deploy: options.deploy,
|
|
253379
253573
|
skills: options.skills,
|
|
253574
|
+
workspaceId: options.workspace ?? options.org,
|
|
253380
253575
|
isInteractive: false
|
|
253381
253576
|
}, ctx);
|
|
253382
253577
|
}
|
|
@@ -253387,17 +253582,20 @@ async function executeCreate({
|
|
|
253387
253582
|
projectPath,
|
|
253388
253583
|
deploy: deploy5,
|
|
253389
253584
|
skills,
|
|
253585
|
+
workspaceId: flagWorkspaceId,
|
|
253390
253586
|
isInteractive
|
|
253391
253587
|
}, ctx) {
|
|
253392
253588
|
const { log, runTask: runTask2 } = ctx;
|
|
253393
253589
|
const name2 = rawName.trim();
|
|
253394
|
-
const resolvedPath =
|
|
253590
|
+
const resolvedPath = resolve8(projectPath);
|
|
253591
|
+
const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
|
|
253395
253592
|
const { projectId } = await runTask2("Setting up your project...", async () => {
|
|
253396
253593
|
return await createProjectFiles({
|
|
253397
253594
|
name: name2,
|
|
253398
253595
|
description: description?.trim(),
|
|
253399
253596
|
path: resolvedPath,
|
|
253400
|
-
template: template2
|
|
253597
|
+
template: template2,
|
|
253598
|
+
organizationId
|
|
253401
253599
|
});
|
|
253402
253600
|
}, {
|
|
253403
253601
|
successMessage: theme.colors.base44Orange("Project created successfully"),
|
|
@@ -253431,11 +253629,12 @@ function getCreateCommand() {
|
|
|
253431
253629
|
return new Base44Command("create", {
|
|
253432
253630
|
requireAppContext: false,
|
|
253433
253631
|
fullBanner: true
|
|
253434
|
-
}).description("Create a new Base44 project").addArgument(new Argument("name", "Project name").argOptional()).option("-p, --path <path>", "Path where to create the project").option("-t, --template <id>", "Template ID (e.g., backend-only, backend-and-client)").option("--deploy", "Build and deploy the site").option("--no-skills", "Skip AI agent skills installation").addHelpText("after", `
|
|
253632
|
+
}).description("Create a new Base44 project").addArgument(new Argument("name", "Project name").argOptional()).option("-p, --path <path>", "Path where to create the project").option("-t, --template <id>", "Template ID (e.g., backend-only, backend-and-client)").option("--deploy", "Build and deploy the site").option("--no-skills", "Skip AI agent skills installation").option("-w, --workspace <id>", "Workspace (organization) ID to create the app in (defaults to your personal workspace)").addOption(new Option("--org <id>", "Alias for --workspace").hideHelp()).addHelpText("after", `
|
|
253435
253633
|
Examples:
|
|
253436
253634
|
$ base44 create my-app Creates a base44 project at ./my-app
|
|
253437
253635
|
$ base44 create my-todo-app --template backend-and-client Creates a base44 backend-and-client project at ./my-todo-app
|
|
253438
|
-
$ base44 create my-app --path ./projects/my-app --deploy Creates a base44 project at ./project/my-app and deploys it
|
|
253636
|
+
$ base44 create my-app --path ./projects/my-app --deploy Creates a base44 project at ./project/my-app and deploys it
|
|
253637
|
+
$ base44 create my-app --workspace 507f1f77bcf86cd799439011 Creates a base44 project in the given workspace`).hook("preAction", validateCreateOptions).action(createAction);
|
|
253439
253638
|
}
|
|
253440
253639
|
|
|
253441
253640
|
// src/cli/commands/project/deploy.ts
|
|
@@ -253466,6 +253665,9 @@ async function deployAction({ isNonInteractive, log }, options = {}) {
|
|
|
253466
253665
|
if (authConfig.length > 0) {
|
|
253467
253666
|
summaryLines.push(" - Auth config");
|
|
253468
253667
|
}
|
|
253668
|
+
if (project2.visibility) {
|
|
253669
|
+
summaryLines.push(` - Visibility: ${project2.visibility}`);
|
|
253670
|
+
}
|
|
253469
253671
|
if (project2.site?.outputDirectory) {
|
|
253470
253672
|
summaryLines.push(` - Site from ${project2.site.outputDirectory}`);
|
|
253471
253673
|
}
|
|
@@ -253487,6 +253689,9 @@ ${summaryLines.join(`
|
|
|
253487
253689
|
let functionCompleted = 0;
|
|
253488
253690
|
const functionTotal = functions.length;
|
|
253489
253691
|
const result = await deployAll(projectData, {
|
|
253692
|
+
onVisibilitySet: (level) => {
|
|
253693
|
+
log.success(`App visibility set to ${level}`);
|
|
253694
|
+
},
|
|
253490
253695
|
onFunctionStart: (names) => {
|
|
253491
253696
|
const label = names.length === 1 ? names[0] : `${names.length} functions`;
|
|
253492
253697
|
log.step(theme.styles.dim(`[${functionCompleted + 1}/${functionTotal}] Deploying ${label}...`));
|
|
@@ -253685,8 +253890,9 @@ async function link(ctx, options, command2) {
|
|
|
253685
253890
|
}
|
|
253686
253891
|
if (action === "create") {
|
|
253687
253892
|
const { name: name2, description } = options.create ? { name: options.name.trim(), description: options.description?.trim() } : await promptForNewProjectDetails();
|
|
253893
|
+
const organizationId = await resolveWorkspaceId(ctx, options.workspace ?? options.org, !isNonInteractive);
|
|
253688
253894
|
const { projectId } = await runTask2("Creating project on Base44...", async () => {
|
|
253689
|
-
return await createProject(name2, description);
|
|
253895
|
+
return await createProject(name2, description, organizationId);
|
|
253690
253896
|
}, {
|
|
253691
253897
|
successMessage: "Project created successfully",
|
|
253692
253898
|
errorMessage: "Failed to create project"
|
|
@@ -253701,7 +253907,7 @@ async function link(ctx, options, command2) {
|
|
|
253701
253907
|
function getLinkCommand() {
|
|
253702
253908
|
return new Base44Command("link", {
|
|
253703
253909
|
requireAppContext: false
|
|
253704
|
-
}).description("Link a local project to a Base44 project (create new or link existing)").configureHelp({ showGlobalOptions: true }).option("-c, --create", "Create a new project (skip selection prompt)").option("-n, --name <name>", "Project name (required when --create is used)").option("-d, --description <description>", "Project description").addOption(new Option("-p, --project-id <id>", "Project ID to link to an existing project").hideHelp()).addOption(new Option("--projectId <id>", "Project ID to link to an existing project").hideHelp()).hook("preAction", validateNonInteractiveFlags).action(link);
|
|
253910
|
+
}).description("Link a local project to a Base44 project (create new or link existing)").configureHelp({ showGlobalOptions: true }).option("-c, --create", "Create a new project (skip selection prompt)").option("-n, --name <name>", "Project name (required when --create is used)").option("-d, --description <description>", "Project description").option("-w, --workspace <id>", "Workspace (organization) ID to create the app in when using --create (defaults to your personal workspace)").addOption(new Option("--org <id>", "Alias for --workspace").hideHelp()).addOption(new Option("-p, --project-id <id>", "Project ID to link to an existing project").hideHelp()).addOption(new Option("--projectId <id>", "Project ID to link to an existing project").hideHelp()).hook("preAction", validateNonInteractiveFlags).action(link);
|
|
253705
253911
|
}
|
|
253706
253912
|
|
|
253707
253913
|
// src/cli/commands/project/logs.ts
|
|
@@ -253787,7 +253993,7 @@ async function followLogs(functionNames, options, availableFunctionNames, jsonMo
|
|
|
253787
253993
|
for (const entry of fresh)
|
|
253788
253994
|
writeFollowLine(entry, jsonMode);
|
|
253789
253995
|
first = false;
|
|
253790
|
-
await new Promise((
|
|
253996
|
+
await new Promise((resolve9) => setTimeout(resolve9, 2000));
|
|
253791
253997
|
}
|
|
253792
253998
|
}
|
|
253793
253999
|
function formatLogs(entries, env3) {
|
|
@@ -253901,7 +254107,7 @@ function getLogsCommand() {
|
|
|
253901
254107
|
}
|
|
253902
254108
|
|
|
253903
254109
|
// src/cli/commands/project/scaffold.ts
|
|
253904
|
-
import { basename as basename5, resolve as
|
|
254110
|
+
import { basename as basename5, resolve as resolve9 } from "node:path";
|
|
253905
254111
|
function resolveAppId(options) {
|
|
253906
254112
|
const appId = options.appId;
|
|
253907
254113
|
if (!appId) {
|
|
@@ -253917,7 +254123,7 @@ function resolveAppId(options) {
|
|
|
253917
254123
|
async function scaffoldAction(ctx, name2, options, command2) {
|
|
253918
254124
|
const { log, runTask: runTask2 } = ctx;
|
|
253919
254125
|
const appId = resolveAppId(command2.optsWithGlobals());
|
|
253920
|
-
const resolvedPath =
|
|
254126
|
+
const resolvedPath = resolve9("./");
|
|
253921
254127
|
const projectName = (name2 ?? basename5(resolvedPath)).trim();
|
|
253922
254128
|
const template2 = await getTemplateById("backend-only");
|
|
253923
254129
|
log.info(`Scaffolding project at ${resolvedPath}`);
|
|
@@ -253954,6 +254160,17 @@ Examples:
|
|
|
253954
254160
|
$ base44 scaffold my-app --app-id app_123 Scaffolds the current dir, named "my-app"`).action(scaffoldAction);
|
|
253955
254161
|
}
|
|
253956
254162
|
|
|
254163
|
+
// src/cli/commands/project/visibility.ts
|
|
254164
|
+
async function setVisibility({ runTask: runTask2 }, level) {
|
|
254165
|
+
await runTask2(`Setting app visibility to ${level}`, () => setAppVisibility(level));
|
|
254166
|
+
return { outroMessage: `App visibility set to ${level}` };
|
|
254167
|
+
}
|
|
254168
|
+
function getVisibilityCommand() {
|
|
254169
|
+
return new Base44Command("visibility").description("Set the app's visibility on the server (public, private, or workspace)").addArgument(new Argument("<level>", "Visibility level").choices([
|
|
254170
|
+
...VISIBILITY_LEVELS
|
|
254171
|
+
])).action(setVisibility);
|
|
254172
|
+
}
|
|
254173
|
+
|
|
253957
254174
|
// src/core/resources/sandbox/schema.ts
|
|
253958
254175
|
var FileErrorSchema = exports_external.object({
|
|
253959
254176
|
code: exports_external.string(),
|
|
@@ -254072,7 +254289,7 @@ function withSandboxAuthHint(error48) {
|
|
|
254072
254289
|
cause: error48
|
|
254073
254290
|
});
|
|
254074
254291
|
}
|
|
254075
|
-
async function callTool(appId, tool, payload,
|
|
254292
|
+
async function callTool(appId, tool, payload, schema11, context, timeout2 = 60000) {
|
|
254076
254293
|
const client = getSandboxClient(appId);
|
|
254077
254294
|
let response;
|
|
254078
254295
|
try {
|
|
@@ -254080,7 +254297,7 @@ async function callTool(appId, tool, payload, schema10, context, timeout2 = 6000
|
|
|
254080
254297
|
} catch (error48) {
|
|
254081
254298
|
throw withSandboxAuthHint(await ApiError.fromHttpError(error48, context));
|
|
254082
254299
|
}
|
|
254083
|
-
const result =
|
|
254300
|
+
const result = schema11.safeParse(await response.json());
|
|
254084
254301
|
if (!result.success) {
|
|
254085
254302
|
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
254086
254303
|
}
|
|
@@ -254307,7 +254524,7 @@ function getSecretsListCommand() {
|
|
|
254307
254524
|
}
|
|
254308
254525
|
|
|
254309
254526
|
// src/cli/commands/secrets/set.ts
|
|
254310
|
-
import { resolve as
|
|
254527
|
+
import { resolve as resolve10 } from "node:path";
|
|
254311
254528
|
function parseEntries(entries) {
|
|
254312
254529
|
const secrets = {};
|
|
254313
254530
|
for (const entry of entries) {
|
|
@@ -254338,7 +254555,7 @@ async function setSecretsAction({ log, runTask: runTask2 }, entries, options) {
|
|
|
254338
254555
|
validateInput(entries, options);
|
|
254339
254556
|
let secrets;
|
|
254340
254557
|
if (options.envFile) {
|
|
254341
|
-
secrets = await parseEnvFile(
|
|
254558
|
+
secrets = await parseEnvFile(resolve10(options.envFile));
|
|
254342
254559
|
if (Object.keys(secrets).length === 0) {
|
|
254343
254560
|
throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
|
|
254344
254561
|
}
|
|
@@ -254367,7 +254584,7 @@ function getSecretsCommand() {
|
|
|
254367
254584
|
}
|
|
254368
254585
|
|
|
254369
254586
|
// src/cli/commands/site/deploy.ts
|
|
254370
|
-
import { resolve as
|
|
254587
|
+
import { resolve as resolve11 } from "node:path";
|
|
254371
254588
|
async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
|
|
254372
254589
|
if (isNonInteractive && !options.yes) {
|
|
254373
254590
|
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
@@ -254382,7 +254599,7 @@ async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
|
|
|
254382
254599
|
]
|
|
254383
254600
|
});
|
|
254384
254601
|
}
|
|
254385
|
-
const outputDir =
|
|
254602
|
+
const outputDir = resolve11(project2.root, project2.site.outputDirectory);
|
|
254386
254603
|
if (!options.yes) {
|
|
254387
254604
|
const shouldDeploy = await Re({
|
|
254388
254605
|
message: `Deploy site from ${project2.site.outputDirectory}?`
|
|
@@ -254478,9 +254695,9 @@ async function generateContent(input) {
|
|
|
254478
254695
|
`);
|
|
254479
254696
|
}
|
|
254480
254697
|
async function compileEntity(entity2) {
|
|
254481
|
-
const { name: name2, source: _source, ...
|
|
254698
|
+
const { name: name2, source: _source, ...schema11 } = entity2;
|
|
254482
254699
|
const jsonSchema = {
|
|
254483
|
-
...
|
|
254700
|
+
...schema11,
|
|
254484
254701
|
title: name2,
|
|
254485
254702
|
additionalProperties: false
|
|
254486
254703
|
};
|
|
@@ -254558,6 +254775,166 @@ function getTypesCommand() {
|
|
|
254558
254775
|
return new Command("types").description("Manage TypeScript type generation").addCommand(getTypesGenerateCommand());
|
|
254559
254776
|
}
|
|
254560
254777
|
|
|
254778
|
+
// src/cli/commands/workspace/shared.ts
|
|
254779
|
+
function toJsonStdout2(result) {
|
|
254780
|
+
return `${JSON.stringify(result, null, 2)}
|
|
254781
|
+
`;
|
|
254782
|
+
}
|
|
254783
|
+
function workspaceTag(workspace2) {
|
|
254784
|
+
const role = workspace2.userRole ?? "member";
|
|
254785
|
+
return workspace2.isPersonal ? `personal, ${role}` : role;
|
|
254786
|
+
}
|
|
254787
|
+
|
|
254788
|
+
// src/cli/commands/workspace/get.ts
|
|
254789
|
+
async function getWorkspaceAction({ runTask: runTask2, log, jsonMode }, workspaceId) {
|
|
254790
|
+
const workspace2 = await runTask2("Fetching workspace...", () => getWorkspace(workspaceId), { errorMessage: "Failed to fetch workspace" });
|
|
254791
|
+
if (!workspace2) {
|
|
254792
|
+
throw new InvalidInputError(`Workspace "${workspaceId}" not found, or you are not a member of it.`, {
|
|
254793
|
+
hints: [
|
|
254794
|
+
{ message: "Run 'base44 workspace list' to see your workspaces" }
|
|
254795
|
+
]
|
|
254796
|
+
});
|
|
254797
|
+
}
|
|
254798
|
+
if (jsonMode) {
|
|
254799
|
+
return {
|
|
254800
|
+
outroMessage: workspace2.name,
|
|
254801
|
+
stdout: toJsonStdout2(workspace2)
|
|
254802
|
+
};
|
|
254803
|
+
}
|
|
254804
|
+
log.message(` ${theme.styles.bold(workspace2.name)} ${theme.styles.dim(`[${workspaceTag(workspace2)}]`)}
|
|
254805
|
+
${theme.styles.dim(workspace2.id)}${workspace2.subscriptionTier ? theme.styles.dim(`
|
|
254806
|
+
tier: ${workspace2.subscriptionTier}`) : ""}`);
|
|
254807
|
+
return { outroMessage: workspace2.name };
|
|
254808
|
+
}
|
|
254809
|
+
function getWorkspaceGetCommand() {
|
|
254810
|
+
return new Base44Command("get", { requireAppContext: false }).description("Show details for a single workspace by ID").argument("<workspace-id>", "Workspace (organization) ID").action(getWorkspaceAction);
|
|
254811
|
+
}
|
|
254812
|
+
|
|
254813
|
+
// src/cli/commands/workspace/list.ts
|
|
254814
|
+
function pluralize2(n5) {
|
|
254815
|
+
return `${n5} workspace${n5 !== 1 ? "s" : ""}`;
|
|
254816
|
+
}
|
|
254817
|
+
async function listWorkspacesAction({ log, runTask: runTask2, jsonMode }, options8) {
|
|
254818
|
+
let workspaces = await runTask2("Fetching workspaces...", () => listWorkspaces(), { errorMessage: "Failed to fetch workspaces" });
|
|
254819
|
+
if (options8.canCreate) {
|
|
254820
|
+
workspaces = workspaces.filter((w8) => canCreateAppsInWorkspace(w8.userRole));
|
|
254821
|
+
}
|
|
254822
|
+
if (options8.role) {
|
|
254823
|
+
const role = options8.role.toLowerCase();
|
|
254824
|
+
workspaces = workspaces.filter((w8) => w8.userRole?.toLowerCase() === role);
|
|
254825
|
+
}
|
|
254826
|
+
if (jsonMode) {
|
|
254827
|
+
return {
|
|
254828
|
+
outroMessage: pluralize2(workspaces.length),
|
|
254829
|
+
stdout: toJsonStdout2(workspaces)
|
|
254830
|
+
};
|
|
254831
|
+
}
|
|
254832
|
+
for (const workspace2 of workspaces) {
|
|
254833
|
+
log.message(` ${theme.styles.bold(workspace2.name)} ${theme.styles.dim(`[${workspaceTag(workspace2)}]`)}
|
|
254834
|
+
${theme.styles.dim(workspace2.id)}`);
|
|
254835
|
+
}
|
|
254836
|
+
return { outroMessage: pluralize2(workspaces.length) };
|
|
254837
|
+
}
|
|
254838
|
+
function getWorkspaceListCommand() {
|
|
254839
|
+
return new Base44Command("list", { requireAppContext: false }).description("List the workspaces you belong to").option("--can-create", "Only workspaces you can create or move apps into (owner/admin/editor)").option("--role <role>", "Only workspaces where your role matches (owner, admin, editor, viewer)").action(listWorkspacesAction);
|
|
254840
|
+
}
|
|
254841
|
+
|
|
254842
|
+
// src/cli/commands/workspace/move.ts
|
|
254843
|
+
function workspaceName(workspaces, id2) {
|
|
254844
|
+
if (!id2)
|
|
254845
|
+
return "unknown workspace";
|
|
254846
|
+
return workspaces.find((w8) => w8.id === id2)?.name ?? id2;
|
|
254847
|
+
}
|
|
254848
|
+
async function resolveTargetWorkspace(target, workspaces, currentWorkspaceId, isInteractive) {
|
|
254849
|
+
const eligible = workspaces.filter((w8) => canCreateAppsInWorkspace(w8.userRole) && w8.id !== currentWorkspaceId);
|
|
254850
|
+
if (target) {
|
|
254851
|
+
const match = workspaces.find((w8) => w8.id === target);
|
|
254852
|
+
if (!match) {
|
|
254853
|
+
throw new InvalidInputError(`Workspace "${target}" not found, or you are not a member of it.`, {
|
|
254854
|
+
hints: [
|
|
254855
|
+
{ message: "Run 'base44 workspace list' to see your workspaces" }
|
|
254856
|
+
]
|
|
254857
|
+
});
|
|
254858
|
+
}
|
|
254859
|
+
if (target === currentWorkspaceId) {
|
|
254860
|
+
throw new InvalidInputError("The app is already in that workspace.");
|
|
254861
|
+
}
|
|
254862
|
+
if (!canCreateAppsInWorkspace(match.userRole)) {
|
|
254863
|
+
throw new InvalidInputError(`You don't have permission to move apps into workspace "${match.name}" (your role: ${match.userRole ?? "unknown"}).`);
|
|
254864
|
+
}
|
|
254865
|
+
return match.id;
|
|
254866
|
+
}
|
|
254867
|
+
if (!isInteractive) {
|
|
254868
|
+
throw new InvalidInputError("A target workspace ID is required in non-interactive mode.", {
|
|
254869
|
+
hints: [
|
|
254870
|
+
{ message: "Usage: base44 workspace move <workspace-id>" },
|
|
254871
|
+
{ message: "Run 'base44 workspace list' to see your workspaces" }
|
|
254872
|
+
]
|
|
254873
|
+
});
|
|
254874
|
+
}
|
|
254875
|
+
if (eligible.length === 0) {
|
|
254876
|
+
throw new InvalidInputError("No other workspaces available to move this app into.");
|
|
254877
|
+
}
|
|
254878
|
+
const options8 = eligible.map((w8) => ({
|
|
254879
|
+
value: w8.id,
|
|
254880
|
+
label: `${w8.name} (${w8.userRole ?? "member"})`
|
|
254881
|
+
}));
|
|
254882
|
+
const selected = await Je({
|
|
254883
|
+
message: "Move the app to which workspace?",
|
|
254884
|
+
options: options8
|
|
254885
|
+
});
|
|
254886
|
+
if (Ct(selected)) {
|
|
254887
|
+
onPromptCancel();
|
|
254888
|
+
}
|
|
254889
|
+
return selected;
|
|
254890
|
+
}
|
|
254891
|
+
async function moveAction(ctx, target, options8) {
|
|
254892
|
+
const { runTask: runTask2, isNonInteractive, jsonMode } = ctx;
|
|
254893
|
+
const isInteractive = !isNonInteractive && !jsonMode;
|
|
254894
|
+
const { id: appId } = getAppContext();
|
|
254895
|
+
const { workspaces, currentWorkspaceId } = await runTask2("Fetching workspaces...", async () => {
|
|
254896
|
+
const [workspaces2, app] = await Promise.all([
|
|
254897
|
+
listWorkspaces(),
|
|
254898
|
+
getApp(appId)
|
|
254899
|
+
]);
|
|
254900
|
+
return { workspaces: workspaces2, currentWorkspaceId: app.organizationId };
|
|
254901
|
+
}, { errorMessage: "Failed to fetch workspaces" });
|
|
254902
|
+
const targetWorkspaceId = await resolveTargetWorkspace(target, workspaces, currentWorkspaceId, isInteractive);
|
|
254903
|
+
if (isInteractive && !options8.yes) {
|
|
254904
|
+
const proceed = await Re({
|
|
254905
|
+
message: `Move this app from ${theme.styles.bold(workspaceName(workspaces, currentWorkspaceId))} to ${theme.styles.bold(workspaceName(workspaces, targetWorkspaceId))}?`
|
|
254906
|
+
});
|
|
254907
|
+
if (Ct(proceed)) {
|
|
254908
|
+
onPromptCancel();
|
|
254909
|
+
}
|
|
254910
|
+
if (!proceed) {
|
|
254911
|
+
return { outroMessage: "Move cancelled" };
|
|
254912
|
+
}
|
|
254913
|
+
}
|
|
254914
|
+
const result = await runTask2("Moving app to workspace...", () => moveAppToWorkspace(appId, targetWorkspaceId, {
|
|
254915
|
+
disconnectIntegrations: options8.disconnectIntegrations
|
|
254916
|
+
}), { errorMessage: "Failed to move app" });
|
|
254917
|
+
const targetName = workspaceName(workspaces, targetWorkspaceId);
|
|
254918
|
+
if (jsonMode) {
|
|
254919
|
+
return {
|
|
254920
|
+
outroMessage: `App moved to ${targetName}`,
|
|
254921
|
+
stdout: toJsonStdout2(result)
|
|
254922
|
+
};
|
|
254923
|
+
}
|
|
254924
|
+
return { outroMessage: `App moved to ${theme.styles.bold(targetName)}` };
|
|
254925
|
+
}
|
|
254926
|
+
function getWorkspaceMoveCommand() {
|
|
254927
|
+
return new Base44Command("move").description("Move the current app to another workspace").argument("[workspace-id]", "Target workspace (organization) ID").option("--disconnect-integrations", "Disconnect the app's OAuth integrations as part of the move").option("-y, --yes", "Skip the confirmation prompt").addHelpText("after", `
|
|
254928
|
+
Examples:
|
|
254929
|
+
$ base44 workspace move 507f1f77bcf86cd799439011 Move the linked app to the given workspace
|
|
254930
|
+
$ base44 workspace move --app-id <id> <workspace-id> Move a specific app`).action(moveAction);
|
|
254931
|
+
}
|
|
254932
|
+
|
|
254933
|
+
// src/cli/commands/workspace/index.ts
|
|
254934
|
+
function getWorkspaceCommand() {
|
|
254935
|
+
return new Command("workspace").description("List workspaces, inspect one, and move apps between them").addCommand(getWorkspaceListCommand()).addCommand(getWorkspaceGetCommand()).addCommand(getWorkspaceMoveCommand());
|
|
254936
|
+
}
|
|
254937
|
+
|
|
254561
254938
|
// src/cli/dev/dev-server/main.ts
|
|
254562
254939
|
var import_cors = __toESM(require_lib4(), 1);
|
|
254563
254940
|
var import_express6 = __toESM(require_express(), 1);
|
|
@@ -254588,14 +254965,14 @@ var getLocalHosts = () => {
|
|
|
254588
254965
|
}
|
|
254589
254966
|
return results;
|
|
254590
254967
|
};
|
|
254591
|
-
var checkAvailablePort = (options8) => new Promise((
|
|
254968
|
+
var checkAvailablePort = (options8) => new Promise((resolve13, reject) => {
|
|
254592
254969
|
const server = net.createServer();
|
|
254593
254970
|
server.unref();
|
|
254594
254971
|
server.on("error", reject);
|
|
254595
254972
|
server.listen(options8, () => {
|
|
254596
254973
|
const { port } = server.address();
|
|
254597
254974
|
server.close(() => {
|
|
254598
|
-
|
|
254975
|
+
resolve13(port);
|
|
254599
254976
|
});
|
|
254600
254977
|
});
|
|
254601
254978
|
});
|
|
@@ -254854,7 +255231,7 @@ class FunctionManager {
|
|
|
254854
255231
|
});
|
|
254855
255232
|
}
|
|
254856
255233
|
waitForReady(name2, runningFunc) {
|
|
254857
|
-
return new Promise((
|
|
255234
|
+
return new Promise((resolve13, reject) => {
|
|
254858
255235
|
runningFunc.process.on("exit", (code2) => {
|
|
254859
255236
|
if (!runningFunc.ready) {
|
|
254860
255237
|
clearTimeout(timeout3);
|
|
@@ -254877,7 +255254,7 @@ class FunctionManager {
|
|
|
254877
255254
|
runningFunc.ready = true;
|
|
254878
255255
|
clearTimeout(timeout3);
|
|
254879
255256
|
runningFunc.process.stdout?.off("data", onData);
|
|
254880
|
-
|
|
255257
|
+
resolve13(runningFunc.port);
|
|
254881
255258
|
}
|
|
254882
255259
|
};
|
|
254883
255260
|
runningFunc.process.stdout?.on("data", onData);
|
|
@@ -255223,22 +255600,22 @@ class Database {
|
|
|
255223
255600
|
this.schemas.clear();
|
|
255224
255601
|
}
|
|
255225
255602
|
validate(entityName, record2, partial2 = false) {
|
|
255226
|
-
const
|
|
255227
|
-
if (!
|
|
255603
|
+
const schema11 = this.schemas.get(this.normalizeName(entityName));
|
|
255604
|
+
if (!schema11) {
|
|
255228
255605
|
throw new Error(`Entity "${entityName}" not found`);
|
|
255229
255606
|
}
|
|
255230
|
-
return this.validator.validate(record2,
|
|
255607
|
+
return this.validator.validate(record2, schema11, partial2);
|
|
255231
255608
|
}
|
|
255232
255609
|
prepareRecord(entityName, record2, partial2 = false) {
|
|
255233
|
-
const
|
|
255234
|
-
if (!
|
|
255610
|
+
const schema11 = this.schemas.get(this.normalizeName(entityName));
|
|
255611
|
+
if (!schema11) {
|
|
255235
255612
|
throw new Error(`Entity "${entityName}" not found`);
|
|
255236
255613
|
}
|
|
255237
|
-
const filteredRecord = this.validator.filterFields(record2,
|
|
255614
|
+
const filteredRecord = this.validator.filterFields(record2, schema11);
|
|
255238
255615
|
if (partial2) {
|
|
255239
255616
|
return filteredRecord;
|
|
255240
255617
|
}
|
|
255241
|
-
return this.validator.applyDefaults(filteredRecord,
|
|
255618
|
+
return this.validator.applyDefaults(filteredRecord, schema11);
|
|
255242
255619
|
}
|
|
255243
255620
|
normalizeName(entityName) {
|
|
255244
255621
|
return entityName.toLowerCase();
|
|
@@ -255532,13 +255909,13 @@ function checkRLS(rule, record2, user) {
|
|
|
255532
255909
|
return false;
|
|
255533
255910
|
return evaluateCondition(rule, record2, user);
|
|
255534
255911
|
}
|
|
255535
|
-
function applyFLS(record2,
|
|
255912
|
+
function applyFLS(record2, schema11, user, operation) {
|
|
255536
255913
|
if (Array.isArray(record2)) {
|
|
255537
|
-
return record2.map((r5) => applyFLS(r5,
|
|
255914
|
+
return record2.map((r5) => applyFLS(r5, schema11, user, operation));
|
|
255538
255915
|
}
|
|
255539
255916
|
const result = {};
|
|
255540
255917
|
for (const [key2, value] of Object.entries(record2)) {
|
|
255541
|
-
const rule =
|
|
255918
|
+
const rule = schema11.properties[key2]?.rls?.[operation];
|
|
255542
255919
|
if (rule === undefined || checkRLS(rule, record2, user)) {
|
|
255543
255920
|
result[key2] = value;
|
|
255544
255921
|
}
|
|
@@ -255766,14 +256143,14 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
255766
256143
|
res.status(404).json({ error: `Entity "${entityName}" not found` });
|
|
255767
256144
|
return;
|
|
255768
256145
|
}
|
|
255769
|
-
const
|
|
255770
|
-
if (!
|
|
256146
|
+
const schema11 = db2.getSchema(entityName);
|
|
256147
|
+
if (!schema11) {
|
|
255771
256148
|
res.status(404).json({ error: `Schema for "${entityName}" not found` });
|
|
255772
256149
|
return;
|
|
255773
256150
|
}
|
|
255774
256151
|
const currentUserResult = await resolveCurrentUser(db2, req);
|
|
255775
256152
|
const currentUser = currentUserResult.ok ? currentUserResult.user : undefined;
|
|
255776
|
-
await handler(req, res, collection,
|
|
256153
|
+
await handler(req, res, collection, schema11, currentUser);
|
|
255777
256154
|
};
|
|
255778
256155
|
}
|
|
255779
256156
|
function emit(appId, entityName, type, data) {
|
|
@@ -255791,19 +256168,19 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
255791
256168
|
}
|
|
255792
256169
|
broadcast(appId, entityName, createData(data));
|
|
255793
256170
|
}
|
|
255794
|
-
function prepareCreateRecord(entityName, body,
|
|
256171
|
+
function prepareCreateRecord(entityName, body, schema11, currentUser, now) {
|
|
255795
256172
|
const { _id, ...recordBody } = body;
|
|
255796
256173
|
const ownerFields = {
|
|
255797
256174
|
created_by: currentUser?.email,
|
|
255798
256175
|
created_by_id: currentUser?.id
|
|
255799
256176
|
};
|
|
255800
|
-
if (!checkRLS(
|
|
256177
|
+
if (!checkRLS(schema11.rls?.create, {
|
|
255801
256178
|
...recordBody,
|
|
255802
256179
|
...ownerFields
|
|
255803
256180
|
}, currentUser)) {
|
|
255804
256181
|
return;
|
|
255805
256182
|
}
|
|
255806
|
-
const filteredBody = applyFLS(db2.prepareRecord(entityName, recordBody),
|
|
256183
|
+
const filteredBody = applyFLS(db2.prepareRecord(entityName, recordBody), schema11, currentUser, "write");
|
|
255807
256184
|
db2.validate(entityName, filteredBody);
|
|
255808
256185
|
return {
|
|
255809
256186
|
...filteredBody,
|
|
@@ -255815,7 +256192,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
255815
256192
|
}
|
|
255816
256193
|
const userRouter = createUserRouter(db2, logger2);
|
|
255817
256194
|
router.use("/User", userRouter);
|
|
255818
|
-
router.get("/:entityName/:id", withCollection(async (req, res, collection,
|
|
256195
|
+
router.get("/:entityName/:id", withCollection(async (req, res, collection, schema11, currentUser) => {
|
|
255819
256196
|
const { entityName, id: id2 } = req.params;
|
|
255820
256197
|
try {
|
|
255821
256198
|
const doc2 = await collection.findOneAsync({ id: id2 });
|
|
@@ -255823,27 +256200,27 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
255823
256200
|
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
255824
256201
|
return;
|
|
255825
256202
|
}
|
|
255826
|
-
if (!checkRLS(
|
|
256203
|
+
if (!checkRLS(schema11.rls?.read, doc2, currentUser)) {
|
|
255827
256204
|
res.status(404).json({
|
|
255828
256205
|
message: `Entity ${entityName} with ID ${id2} not found`
|
|
255829
256206
|
});
|
|
255830
256207
|
return;
|
|
255831
256208
|
}
|
|
255832
|
-
const result = applyFLS(stripInternalFields(doc2),
|
|
256209
|
+
const result = applyFLS(stripInternalFields(doc2), schema11, currentUser, "read");
|
|
255833
256210
|
res.json(result);
|
|
255834
256211
|
} catch (error48) {
|
|
255835
256212
|
logger2.error(`Error in GET /${entityName}/${id2}:`, error48);
|
|
255836
256213
|
res.status(500).json({ error: "Internal server error" });
|
|
255837
256214
|
}
|
|
255838
256215
|
}));
|
|
255839
|
-
router.get("/:entityName", withCollection(async (req, res, collection,
|
|
256216
|
+
router.get("/:entityName", withCollection(async (req, res, collection, schema11, currentUser) => {
|
|
255840
256217
|
const { entityName } = req.params;
|
|
255841
256218
|
try {
|
|
255842
256219
|
let results = stripInternalFields(await queryEntity(collection, req.query));
|
|
255843
|
-
if (
|
|
255844
|
-
results = results.filter((doc2) => checkRLS(
|
|
256220
|
+
if (schema11.rls?.read !== undefined && schema11.rls.read !== true) {
|
|
256221
|
+
results = results.filter((doc2) => checkRLS(schema11.rls.read, doc2, currentUser));
|
|
255845
256222
|
}
|
|
255846
|
-
results = results.map((doc2) => applyFLS(doc2,
|
|
256223
|
+
results = results.map((doc2) => applyFLS(doc2, schema11, currentUser, "read"));
|
|
255847
256224
|
res.json(results);
|
|
255848
256225
|
} catch (error48) {
|
|
255849
256226
|
if (error48 instanceof InvalidInputError) {
|
|
@@ -255854,16 +256231,16 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
255854
256231
|
}
|
|
255855
256232
|
}
|
|
255856
256233
|
}));
|
|
255857
|
-
router.post("/:entityName", parseBody, withCollection(async (req, res, collection,
|
|
256234
|
+
router.post("/:entityName", parseBody, withCollection(async (req, res, collection, schema11, currentUser) => {
|
|
255858
256235
|
const { appId, entityName } = req.params;
|
|
255859
256236
|
try {
|
|
255860
256237
|
const now = new Date().toISOString();
|
|
255861
|
-
const record2 = prepareCreateRecord(entityName, req.body,
|
|
256238
|
+
const record2 = prepareCreateRecord(entityName, req.body, schema11, currentUser, now);
|
|
255862
256239
|
if (!record2) {
|
|
255863
256240
|
res.status(403).json({ error: "Permission denied" });
|
|
255864
256241
|
return;
|
|
255865
256242
|
}
|
|
255866
|
-
const inserted = applyFLS(stripInternalFields(await collection.insertAsync(record2)),
|
|
256243
|
+
const inserted = applyFLS(stripInternalFields(await collection.insertAsync(record2)), schema11, currentUser, "read");
|
|
255867
256244
|
emit(appId, entityName, "create", inserted);
|
|
255868
256245
|
res.status(201).json(inserted);
|
|
255869
256246
|
} catch (error48) {
|
|
@@ -255875,7 +256252,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
255875
256252
|
res.status(500).json({ error: "Internal server error" });
|
|
255876
256253
|
}
|
|
255877
256254
|
}));
|
|
255878
|
-
router.post("/:entityName/bulk", parseBody, withCollection(async (req, res, collection,
|
|
256255
|
+
router.post("/:entityName/bulk", parseBody, withCollection(async (req, res, collection, schema11, currentUser) => {
|
|
255879
256256
|
const { appId, entityName } = req.params;
|
|
255880
256257
|
if (!Array.isArray(req.body)) {
|
|
255881
256258
|
res.status(400).json({ error: "Request body must be an array" });
|
|
@@ -255885,14 +256262,14 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
255885
256262
|
const now = new Date().toISOString();
|
|
255886
256263
|
const records = [];
|
|
255887
256264
|
for (const body of req.body) {
|
|
255888
|
-
const record2 = prepareCreateRecord(entityName, body,
|
|
256265
|
+
const record2 = prepareCreateRecord(entityName, body, schema11, currentUser, now);
|
|
255889
256266
|
if (!record2) {
|
|
255890
256267
|
res.status(403).json({ error: "Permission denied" });
|
|
255891
256268
|
return;
|
|
255892
256269
|
}
|
|
255893
256270
|
records.push(record2);
|
|
255894
256271
|
}
|
|
255895
|
-
const inserted = applyFLS(stripInternalFields(await collection.insertAsync(records)),
|
|
256272
|
+
const inserted = applyFLS(stripInternalFields(await collection.insertAsync(records)), schema11, currentUser, "read");
|
|
255896
256273
|
emit(appId, entityName, "create", inserted);
|
|
255897
256274
|
res.status(201).json(inserted);
|
|
255898
256275
|
} catch (error48) {
|
|
@@ -255904,24 +256281,24 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
255904
256281
|
res.status(500).json({ error: "Internal server error" });
|
|
255905
256282
|
}
|
|
255906
256283
|
}));
|
|
255907
|
-
router.put("/:entityName/:id", parseBody, withCollection(async (req, res, collection,
|
|
256284
|
+
router.put("/:entityName/:id", parseBody, withCollection(async (req, res, collection, schema11, currentUser) => {
|
|
255908
256285
|
const { appId, entityName, id: id2 } = req.params;
|
|
255909
256286
|
const { id: _id, created_date: _created_date, ...body } = req.body;
|
|
255910
256287
|
try {
|
|
255911
|
-
if (
|
|
256288
|
+
if (schema11.rls?.update !== undefined) {
|
|
255912
256289
|
const existing = await collection.findOneAsync({ id: id2 });
|
|
255913
256290
|
if (!existing) {
|
|
255914
256291
|
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
255915
256292
|
return;
|
|
255916
256293
|
}
|
|
255917
|
-
if (!checkRLS(
|
|
256294
|
+
if (!checkRLS(schema11.rls.update, existing, currentUser)) {
|
|
255918
256295
|
res.status(404).json({
|
|
255919
256296
|
message: `Entity ${entityName} with ID ${id2} not found`
|
|
255920
256297
|
});
|
|
255921
256298
|
return;
|
|
255922
256299
|
}
|
|
255923
256300
|
}
|
|
255924
|
-
const filteredBody = applyFLS(db2.prepareRecord(entityName, body, true),
|
|
256301
|
+
const filteredBody = applyFLS(db2.prepareRecord(entityName, body, true), schema11, currentUser, "write");
|
|
255925
256302
|
db2.validate(entityName, filteredBody, true);
|
|
255926
256303
|
const updateData = {
|
|
255927
256304
|
...filteredBody,
|
|
@@ -255932,7 +256309,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
255932
256309
|
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
255933
256310
|
return;
|
|
255934
256311
|
}
|
|
255935
|
-
const updated = applyFLS(stripInternalFields(result.affectedDocuments),
|
|
256312
|
+
const updated = applyFLS(stripInternalFields(result.affectedDocuments), schema11, currentUser, "read");
|
|
255936
256313
|
emit(appId, entityName, "update", updated);
|
|
255937
256314
|
res.json(updated);
|
|
255938
256315
|
} catch (error48) {
|
|
@@ -255944,7 +256321,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
255944
256321
|
res.status(500).json({ error: "Internal server error" });
|
|
255945
256322
|
}
|
|
255946
256323
|
}));
|
|
255947
|
-
router.delete("/:entityName/:id", withCollection(async (req, res, collection,
|
|
256324
|
+
router.delete("/:entityName/:id", withCollection(async (req, res, collection, schema11, currentUser) => {
|
|
255948
256325
|
const { appId, entityName, id: id2 } = req.params;
|
|
255949
256326
|
try {
|
|
255950
256327
|
const doc2 = await collection.findOneAsync({ id: id2 });
|
|
@@ -255952,7 +256329,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
255952
256329
|
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
255953
256330
|
return;
|
|
255954
256331
|
}
|
|
255955
|
-
if (!checkRLS(
|
|
256332
|
+
if (!checkRLS(schema11.rls?.delete, doc2, currentUser)) {
|
|
255956
256333
|
res.status(404).json({
|
|
255957
256334
|
message: `Entity ${entityName} with ID ${id2} not found`
|
|
255958
256335
|
});
|
|
@@ -255966,11 +256343,11 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
255966
256343
|
res.status(500).json({ error: "Internal server error" });
|
|
255967
256344
|
}
|
|
255968
256345
|
}));
|
|
255969
|
-
router.delete("/:entityName", parseBody, withCollection(async (req, res, collection,
|
|
256346
|
+
router.delete("/:entityName", parseBody, withCollection(async (req, res, collection, schema11, currentUser) => {
|
|
255970
256347
|
const { entityName } = req.params;
|
|
255971
256348
|
try {
|
|
255972
256349
|
const query = req.body || {};
|
|
255973
|
-
const rlsDelete =
|
|
256350
|
+
const rlsDelete = schema11?.rls?.delete;
|
|
255974
256351
|
if (rlsDelete !== undefined && rlsDelete !== true) {
|
|
255975
256352
|
if (rlsDelete === false && currentUser?.is_service !== true) {
|
|
255976
256353
|
res.status(403).json({ error: "Permission denied" });
|
|
@@ -256135,15 +256512,15 @@ class ServeRunner {
|
|
|
256135
256512
|
return;
|
|
256136
256513
|
}
|
|
256137
256514
|
this.stopping = true;
|
|
256138
|
-
const exited = new Promise((
|
|
256515
|
+
const exited = new Promise((resolve13) => child.once("exit", () => resolve13()));
|
|
256139
256516
|
if (process21.platform === "win32" && child.pid) {
|
|
256140
256517
|
const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
256141
256518
|
stdio: "ignore",
|
|
256142
256519
|
windowsHide: true
|
|
256143
256520
|
});
|
|
256144
|
-
await new Promise((
|
|
256145
|
-
taskkill.once("exit", () =>
|
|
256146
|
-
taskkill.once("error", () =>
|
|
256521
|
+
await new Promise((resolve13) => {
|
|
256522
|
+
taskkill.once("exit", () => resolve13());
|
|
256523
|
+
taskkill.once("error", () => resolve13());
|
|
256147
256524
|
});
|
|
256148
256525
|
} else if (child.pid) {
|
|
256149
256526
|
try {
|
|
@@ -257037,7 +257414,7 @@ class NodeFsHandler {
|
|
|
257037
257414
|
this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
|
|
257038
257415
|
}
|
|
257039
257416
|
}).on(EV.ERROR, this._boundHandleError);
|
|
257040
|
-
return new Promise((
|
|
257417
|
+
return new Promise((resolve14, reject) => {
|
|
257041
257418
|
if (!stream)
|
|
257042
257419
|
return reject();
|
|
257043
257420
|
stream.once(STR_END, () => {
|
|
@@ -257046,7 +257423,7 @@ class NodeFsHandler {
|
|
|
257046
257423
|
return;
|
|
257047
257424
|
}
|
|
257048
257425
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
257049
|
-
|
|
257426
|
+
resolve14(undefined);
|
|
257050
257427
|
previous.getChildren().filter((item) => {
|
|
257051
257428
|
return item !== directory && !current.has(item);
|
|
257052
257429
|
}).forEach((item) => {
|
|
@@ -257963,7 +258340,7 @@ async function createDevServer(options8) {
|
|
|
257963
258340
|
}
|
|
257964
258341
|
remoteProxy(req, res, next);
|
|
257965
258342
|
});
|
|
257966
|
-
const server = await new Promise((
|
|
258343
|
+
const server = await new Promise((resolve15, reject) => {
|
|
257967
258344
|
const s5 = app.listen(port, "127.0.0.1", (err) => {
|
|
257968
258345
|
if (err) {
|
|
257969
258346
|
if ("code" in err && err.code === "EADDRINUSE") {
|
|
@@ -257972,7 +258349,7 @@ async function createDevServer(options8) {
|
|
|
257972
258349
|
reject(err);
|
|
257973
258350
|
}
|
|
257974
258351
|
} else {
|
|
257975
|
-
|
|
258352
|
+
resolve15(s5);
|
|
257976
258353
|
}
|
|
257977
258354
|
});
|
|
257978
258355
|
});
|
|
@@ -258035,13 +258412,13 @@ async function createDevServer(options8) {
|
|
|
258035
258412
|
if (!server.listening) {
|
|
258036
258413
|
return;
|
|
258037
258414
|
}
|
|
258038
|
-
await new Promise((
|
|
258415
|
+
await new Promise((resolve15, reject) => {
|
|
258039
258416
|
server.close((error48) => {
|
|
258040
258417
|
if (error48) {
|
|
258041
258418
|
reject(error48);
|
|
258042
258419
|
return;
|
|
258043
258420
|
}
|
|
258044
|
-
|
|
258421
|
+
resolve15();
|
|
258045
258422
|
});
|
|
258046
258423
|
});
|
|
258047
258424
|
};
|
|
@@ -258150,13 +258527,13 @@ async function runScript(options8) {
|
|
|
258150
258527
|
}
|
|
258151
258528
|
// src/cli/commands/exec.ts
|
|
258152
258529
|
function readStdin2() {
|
|
258153
|
-
return new Promise((
|
|
258530
|
+
return new Promise((resolve15, reject) => {
|
|
258154
258531
|
let data = "";
|
|
258155
258532
|
process.stdin.setEncoding("utf-8");
|
|
258156
258533
|
process.stdin.on("data", (chunk) => {
|
|
258157
258534
|
data += chunk;
|
|
258158
258535
|
});
|
|
258159
|
-
process.stdin.on("end", () =>
|
|
258536
|
+
process.stdin.on("end", () => resolve15(data));
|
|
258160
258537
|
process.stdin.on("error", reject);
|
|
258161
258538
|
});
|
|
258162
258539
|
}
|
|
@@ -258198,7 +258575,7 @@ Examples:
|
|
|
258198
258575
|
}
|
|
258199
258576
|
|
|
258200
258577
|
// src/cli/commands/project/eject.ts
|
|
258201
|
-
import { resolve as
|
|
258578
|
+
import { resolve as resolve15 } from "node:path";
|
|
258202
258579
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
258203
258580
|
async function eject(ctx, options8, command2) {
|
|
258204
258581
|
const { log, runTask: runTask2, isNonInteractive } = ctx;
|
|
@@ -258262,7 +258639,7 @@ async function eject(ctx, options8, command2) {
|
|
|
258262
258639
|
Ne("Operation cancelled.");
|
|
258263
258640
|
throw new CLIExitError(0);
|
|
258264
258641
|
}
|
|
258265
|
-
const resolvedPath =
|
|
258642
|
+
const resolvedPath = resolve15(selectedPath);
|
|
258266
258643
|
await runTask2("Downloading your project's code...", async (updateMessage) => {
|
|
258267
258644
|
await createProjectFilesForExistingProject({
|
|
258268
258645
|
projectId,
|
|
@@ -258325,8 +258702,10 @@ function createProgram(context) {
|
|
|
258325
258702
|
program2.addCommand(getScaffoldCommand());
|
|
258326
258703
|
program2.addCommand(getDashboardCommand());
|
|
258327
258704
|
program2.addCommand(getDeployCommand2());
|
|
258705
|
+
program2.addCommand(getVisibilityCommand());
|
|
258328
258706
|
program2.addCommand(getLinkCommand());
|
|
258329
258707
|
program2.addCommand(getEjectCommand());
|
|
258708
|
+
program2.addCommand(getWorkspaceCommand());
|
|
258330
258709
|
program2.addCommand(getEntitiesPushCommand());
|
|
258331
258710
|
program2.addCommand(getAgentsCommand());
|
|
258332
258711
|
program2.addCommand(getConnectorsCommand());
|
|
@@ -260634,14 +261013,14 @@ async function addSourceContext(frames) {
|
|
|
260634
261013
|
return frames;
|
|
260635
261014
|
}
|
|
260636
261015
|
function getContextLinesFromFile(path19, ranges, output) {
|
|
260637
|
-
return new Promise((
|
|
261016
|
+
return new Promise((resolve16) => {
|
|
260638
261017
|
const stream = createReadStream2(path19);
|
|
260639
261018
|
const lineReaded = createInterface2({
|
|
260640
261019
|
input: stream
|
|
260641
261020
|
});
|
|
260642
261021
|
function destroyStreamAndResolve() {
|
|
260643
261022
|
stream.destroy();
|
|
260644
|
-
|
|
261023
|
+
resolve16();
|
|
260645
261024
|
}
|
|
260646
261025
|
let lineNumber = 0;
|
|
260647
261026
|
let currentRangeIndex = 0;
|
|
@@ -261753,15 +262132,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
261753
262132
|
return true;
|
|
261754
262133
|
if (this.featureFlagsPoller === undefined)
|
|
261755
262134
|
return false;
|
|
261756
|
-
return new Promise((
|
|
262135
|
+
return new Promise((resolve16) => {
|
|
261757
262136
|
const timeout3 = setTimeout(() => {
|
|
261758
262137
|
cleanup();
|
|
261759
|
-
|
|
262138
|
+
resolve16(false);
|
|
261760
262139
|
}, timeoutMs);
|
|
261761
262140
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
|
|
261762
262141
|
clearTimeout(timeout3);
|
|
261763
262142
|
cleanup();
|
|
261764
|
-
|
|
262143
|
+
resolve16(count2 > 0);
|
|
261765
262144
|
});
|
|
261766
262145
|
});
|
|
261767
262146
|
}
|
|
@@ -262586,4 +262965,4 @@ export {
|
|
|
262586
262965
|
CLIExitError
|
|
262587
262966
|
};
|
|
262588
262967
|
|
|
262589
|
-
//# debugId=
|
|
262968
|
+
//# debugId=B9D4F09248278B0364756E2164756E21
|