@base44-preview/cli 0.1.4-pr.567.6b2480e → 0.1.5-pr.555.c1867e2
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/assets/deno-runtime/exec.ts +9 -0
- package/dist/cli/index.js +1392 -930
- package/dist/cli/index.js.map +37 -27
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -12980,10 +12980,10 @@ var require_ejs = __commonJS((exports) => {
|
|
|
12980
12980
|
exports.localsName = _DEFAULT_LOCALS_NAME;
|
|
12981
12981
|
exports.promiseImpl = new Function("return this;")().Promise;
|
|
12982
12982
|
exports.resolveInclude = function(name2, filename, isDir) {
|
|
12983
|
-
var
|
|
12983
|
+
var dirname11 = path11.dirname;
|
|
12984
12984
|
var extname = path11.extname;
|
|
12985
12985
|
var resolve3 = path11.resolve;
|
|
12986
|
-
var includePath = resolve3(isDir ? filename :
|
|
12986
|
+
var includePath = resolve3(isDir ? filename : dirname11(filename), name2);
|
|
12987
12987
|
var ext = extname(name2);
|
|
12988
12988
|
if (!ext) {
|
|
12989
12989
|
includePath += ".ejs";
|
|
@@ -13361,10 +13361,10 @@ var require_ejs = __commonJS((exports) => {
|
|
|
13361
13361
|
};
|
|
13362
13362
|
if (opts.filename && typeof Object.defineProperty === "function") {
|
|
13363
13363
|
var filename = opts.filename;
|
|
13364
|
-
var
|
|
13364
|
+
var basename5 = path11.basename(filename, path11.extname(filename));
|
|
13365
13365
|
try {
|
|
13366
13366
|
Object.defineProperty(returnedFn, "name", {
|
|
13367
|
-
value:
|
|
13367
|
+
value: basename5,
|
|
13368
13368
|
writable: false,
|
|
13369
13369
|
enumerable: false,
|
|
13370
13370
|
configurable: true
|
|
@@ -13718,12 +13718,12 @@ var require_schema = __commonJS((exports, module) => {
|
|
|
13718
13718
|
var common = require_common3();
|
|
13719
13719
|
var YAMLException = require_exception();
|
|
13720
13720
|
var Type = require_type();
|
|
13721
|
-
function compileList(
|
|
13721
|
+
function compileList(schema8, name2, result) {
|
|
13722
13722
|
var exclude = [];
|
|
13723
|
-
|
|
13723
|
+
schema8.include.forEach(function(includedSchema) {
|
|
13724
13724
|
result = compileList(includedSchema, name2, result);
|
|
13725
13725
|
});
|
|
13726
|
-
|
|
13726
|
+
schema8[name2].forEach(function(currentType) {
|
|
13727
13727
|
result.forEach(function(previousType, previousIndex) {
|
|
13728
13728
|
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
|
|
13729
13729
|
exclude.push(previousIndex);
|
|
@@ -13780,8 +13780,8 @@ var require_schema = __commonJS((exports, module) => {
|
|
|
13780
13780
|
}
|
|
13781
13781
|
schemas3 = common.toArray(schemas3);
|
|
13782
13782
|
types = common.toArray(types);
|
|
13783
|
-
if (!schemas3.every(function(
|
|
13784
|
-
return
|
|
13783
|
+
if (!schemas3.every(function(schema8) {
|
|
13784
|
+
return schema8 instanceof Schema;
|
|
13785
13785
|
})) {
|
|
13786
13786
|
throw new YAMLException("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");
|
|
13787
13787
|
}
|
|
@@ -15802,7 +15802,7 @@ var require_dumper = __commonJS((exports, module) => {
|
|
|
15802
15802
|
"Off",
|
|
15803
15803
|
"OFF"
|
|
15804
15804
|
];
|
|
15805
|
-
function compileStyleMap(
|
|
15805
|
+
function compileStyleMap(schema8, map2) {
|
|
15806
15806
|
var result, keys, index, length, tag, style, type;
|
|
15807
15807
|
if (map2 === null)
|
|
15808
15808
|
return {};
|
|
@@ -15814,7 +15814,7 @@ var require_dumper = __commonJS((exports, module) => {
|
|
|
15814
15814
|
if (tag.slice(0, 2) === "!!") {
|
|
15815
15815
|
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
15816
15816
|
}
|
|
15817
|
-
type =
|
|
15817
|
+
type = schema8.compiledTypeMap["fallback"][tag];
|
|
15818
15818
|
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
|
15819
15819
|
style = type.styleAliases[style];
|
|
15820
15820
|
}
|
|
@@ -20114,7 +20114,7 @@ var require_lodash8 = __commonJS((exports, module) => {
|
|
|
20114
20114
|
}
|
|
20115
20115
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
20116
20116
|
});
|
|
20117
|
-
function
|
|
20117
|
+
function join15(array2, separator) {
|
|
20118
20118
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
20119
20119
|
}
|
|
20120
20120
|
function last(array2) {
|
|
@@ -22046,7 +22046,7 @@ __p += '`;
|
|
|
22046
22046
|
lodash.isUndefined = isUndefined;
|
|
22047
22047
|
lodash.isWeakMap = isWeakMap;
|
|
22048
22048
|
lodash.isWeakSet = isWeakSet;
|
|
22049
|
-
lodash.join =
|
|
22049
|
+
lodash.join = join15;
|
|
22050
22050
|
lodash.kebabCase = kebabCase;
|
|
22051
22051
|
lodash.last = last;
|
|
22052
22052
|
lodash.lastIndexOf = lastIndexOf;
|
|
@@ -23001,7 +23001,7 @@ var require_createNode = __commonJS((exports) => {
|
|
|
23001
23001
|
if (value instanceof String || value instanceof Number || value instanceof Boolean || typeof BigInt !== "undefined" && value instanceof BigInt) {
|
|
23002
23002
|
value = value.valueOf();
|
|
23003
23003
|
}
|
|
23004
|
-
const { aliasDuplicateObjects, onAnchor, onTagObj, schema:
|
|
23004
|
+
const { aliasDuplicateObjects, onAnchor, onTagObj, schema: schema11, sourceObjects } = ctx;
|
|
23005
23005
|
let ref = undefined;
|
|
23006
23006
|
if (aliasDuplicateObjects && value && typeof value === "object") {
|
|
23007
23007
|
ref = sourceObjects.get(value);
|
|
@@ -23015,7 +23015,7 @@ var require_createNode = __commonJS((exports) => {
|
|
|
23015
23015
|
}
|
|
23016
23016
|
if (tagName?.startsWith("!!"))
|
|
23017
23017
|
tagName = defaultTagPrefix + tagName.slice(2);
|
|
23018
|
-
let tagObj = findTagObject(value, tagName,
|
|
23018
|
+
let tagObj = findTagObject(value, tagName, schema11.tags);
|
|
23019
23019
|
if (!tagObj) {
|
|
23020
23020
|
if (value && typeof value.toJSON === "function") {
|
|
23021
23021
|
value = value.toJSON();
|
|
@@ -23026,7 +23026,7 @@ var require_createNode = __commonJS((exports) => {
|
|
|
23026
23026
|
ref.node = node2;
|
|
23027
23027
|
return node2;
|
|
23028
23028
|
}
|
|
23029
|
-
tagObj = value instanceof Map ?
|
|
23029
|
+
tagObj = value instanceof Map ? schema11[identity3.MAP] : (Symbol.iterator in Object(value)) ? schema11[identity3.SEQ] : schema11[identity3.MAP];
|
|
23030
23030
|
}
|
|
23031
23031
|
if (onTagObj) {
|
|
23032
23032
|
onTagObj(tagObj);
|
|
@@ -23049,7 +23049,7 @@ var require_Collection = __commonJS((exports) => {
|
|
|
23049
23049
|
var createNode = require_createNode();
|
|
23050
23050
|
var identity3 = require_identity();
|
|
23051
23051
|
var Node2 = require_Node();
|
|
23052
|
-
function collectionFromPath(
|
|
23052
|
+
function collectionFromPath(schema11, path16, value) {
|
|
23053
23053
|
let v = value;
|
|
23054
23054
|
for (let i2 = path16.length - 1;i2 >= 0; --i2) {
|
|
23055
23055
|
const k2 = path16[i2];
|
|
@@ -23067,27 +23067,27 @@ var require_Collection = __commonJS((exports) => {
|
|
|
23067
23067
|
onAnchor: () => {
|
|
23068
23068
|
throw new Error("This should not happen, please report a bug.");
|
|
23069
23069
|
},
|
|
23070
|
-
schema:
|
|
23070
|
+
schema: schema11,
|
|
23071
23071
|
sourceObjects: new Map
|
|
23072
23072
|
});
|
|
23073
23073
|
}
|
|
23074
23074
|
var isEmptyPath = (path16) => path16 == null || typeof path16 === "object" && !!path16[Symbol.iterator]().next().done;
|
|
23075
23075
|
|
|
23076
23076
|
class Collection extends Node2.NodeBase {
|
|
23077
|
-
constructor(type,
|
|
23077
|
+
constructor(type, schema11) {
|
|
23078
23078
|
super(type);
|
|
23079
23079
|
Object.defineProperty(this, "schema", {
|
|
23080
|
-
value:
|
|
23080
|
+
value: schema11,
|
|
23081
23081
|
configurable: true,
|
|
23082
23082
|
enumerable: false,
|
|
23083
23083
|
writable: true
|
|
23084
23084
|
});
|
|
23085
23085
|
}
|
|
23086
|
-
clone(
|
|
23086
|
+
clone(schema11) {
|
|
23087
23087
|
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
23088
|
-
if (
|
|
23089
|
-
copy.schema =
|
|
23090
|
-
copy.items = copy.items.map((it3) => identity3.isNode(it3) || identity3.isPair(it3) ? it3.clone(
|
|
23088
|
+
if (schema11)
|
|
23089
|
+
copy.schema = schema11;
|
|
23090
|
+
copy.items = copy.items.map((it3) => identity3.isNode(it3) || identity3.isPair(it3) ? it3.clone(schema11) : it3);
|
|
23091
23091
|
if (this.range)
|
|
23092
23092
|
copy.range = this.range.slice();
|
|
23093
23093
|
return copy;
|
|
@@ -24019,12 +24019,12 @@ var require_Pair = __commonJS((exports) => {
|
|
|
24019
24019
|
this.key = key;
|
|
24020
24020
|
this.value = value;
|
|
24021
24021
|
}
|
|
24022
|
-
clone(
|
|
24022
|
+
clone(schema11) {
|
|
24023
24023
|
let { key, value } = this;
|
|
24024
24024
|
if (identity3.isNode(key))
|
|
24025
|
-
key = key.clone(
|
|
24025
|
+
key = key.clone(schema11);
|
|
24026
24026
|
if (identity3.isNode(value))
|
|
24027
|
-
value = value.clone(
|
|
24027
|
+
value = value.clone(schema11);
|
|
24028
24028
|
return new Pair(key, value);
|
|
24029
24029
|
}
|
|
24030
24030
|
toJSON(_2, ctx) {
|
|
@@ -24209,13 +24209,13 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
24209
24209
|
static get tagName() {
|
|
24210
24210
|
return "tag:yaml.org,2002:map";
|
|
24211
24211
|
}
|
|
24212
|
-
constructor(
|
|
24213
|
-
super(identity3.MAP,
|
|
24212
|
+
constructor(schema11) {
|
|
24213
|
+
super(identity3.MAP, schema11);
|
|
24214
24214
|
this.items = [];
|
|
24215
24215
|
}
|
|
24216
|
-
static from(
|
|
24216
|
+
static from(schema11, obj, ctx) {
|
|
24217
24217
|
const { keepUndefined, replacer } = ctx;
|
|
24218
|
-
const map2 = new this(
|
|
24218
|
+
const map2 = new this(schema11);
|
|
24219
24219
|
const add = (key, value) => {
|
|
24220
24220
|
if (typeof replacer === "function")
|
|
24221
24221
|
value = replacer.call(obj, key, value);
|
|
@@ -24231,8 +24231,8 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
24231
24231
|
for (const key of Object.keys(obj))
|
|
24232
24232
|
add(key, obj[key]);
|
|
24233
24233
|
}
|
|
24234
|
-
if (typeof
|
|
24235
|
-
map2.items.sort(
|
|
24234
|
+
if (typeof schema11.sortMapEntries === "function") {
|
|
24235
|
+
map2.items.sort(schema11.sortMapEntries);
|
|
24236
24236
|
}
|
|
24237
24237
|
return map2;
|
|
24238
24238
|
}
|
|
@@ -24325,7 +24325,7 @@ var require_map2 = __commonJS((exports) => {
|
|
|
24325
24325
|
onError("Expected a mapping for this tag");
|
|
24326
24326
|
return map3;
|
|
24327
24327
|
},
|
|
24328
|
-
createNode: (
|
|
24328
|
+
createNode: (schema11, obj, ctx) => YAMLMap.YAMLMap.from(schema11, obj, ctx)
|
|
24329
24329
|
};
|
|
24330
24330
|
exports.map = map2;
|
|
24331
24331
|
});
|
|
@@ -24343,8 +24343,8 @@ var require_YAMLSeq = __commonJS((exports) => {
|
|
|
24343
24343
|
static get tagName() {
|
|
24344
24344
|
return "tag:yaml.org,2002:seq";
|
|
24345
24345
|
}
|
|
24346
|
-
constructor(
|
|
24347
|
-
super(identity3.SEQ,
|
|
24346
|
+
constructor(schema11) {
|
|
24347
|
+
super(identity3.SEQ, schema11);
|
|
24348
24348
|
this.items = [];
|
|
24349
24349
|
}
|
|
24350
24350
|
add(value) {
|
|
@@ -24398,9 +24398,9 @@ var require_YAMLSeq = __commonJS((exports) => {
|
|
|
24398
24398
|
onComment
|
|
24399
24399
|
});
|
|
24400
24400
|
}
|
|
24401
|
-
static from(
|
|
24401
|
+
static from(schema11, obj, ctx) {
|
|
24402
24402
|
const { replacer } = ctx;
|
|
24403
|
-
const seq = new this(
|
|
24403
|
+
const seq = new this(schema11);
|
|
24404
24404
|
if (obj && Symbol.iterator in Object(obj)) {
|
|
24405
24405
|
let i2 = 0;
|
|
24406
24406
|
for (let it3 of obj) {
|
|
@@ -24437,7 +24437,7 @@ var require_seq2 = __commonJS((exports) => {
|
|
|
24437
24437
|
onError("Expected a sequence for this tag");
|
|
24438
24438
|
return seq2;
|
|
24439
24439
|
},
|
|
24440
|
-
createNode: (
|
|
24440
|
+
createNode: (schema11, obj, ctx) => YAMLSeq.YAMLSeq.from(schema11, obj, ctx)
|
|
24441
24441
|
};
|
|
24442
24442
|
exports.seq = seq;
|
|
24443
24443
|
});
|
|
@@ -24612,7 +24612,7 @@ var require_schema2 = __commonJS((exports) => {
|
|
|
24612
24612
|
var bool = require_bool2();
|
|
24613
24613
|
var float = require_float2();
|
|
24614
24614
|
var int2 = require_int2();
|
|
24615
|
-
var
|
|
24615
|
+
var schema11 = [
|
|
24616
24616
|
map2.map,
|
|
24617
24617
|
seq.seq,
|
|
24618
24618
|
string4.string,
|
|
@@ -24625,7 +24625,7 @@ var require_schema2 = __commonJS((exports) => {
|
|
|
24625
24625
|
float.floatExp,
|
|
24626
24626
|
float.float
|
|
24627
24627
|
];
|
|
24628
|
-
exports.schema =
|
|
24628
|
+
exports.schema = schema11;
|
|
24629
24629
|
});
|
|
24630
24630
|
|
|
24631
24631
|
// ../../node_modules/yaml/dist/schema/json/schema.js
|
|
@@ -24688,8 +24688,8 @@ var require_schema3 = __commonJS((exports) => {
|
|
|
24688
24688
|
return str;
|
|
24689
24689
|
}
|
|
24690
24690
|
};
|
|
24691
|
-
var
|
|
24692
|
-
exports.schema =
|
|
24691
|
+
var schema11 = [map2.map, seq.seq].concat(jsonScalars, jsonError);
|
|
24692
|
+
exports.schema = schema11;
|
|
24693
24693
|
});
|
|
24694
24694
|
|
|
24695
24695
|
// ../../node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
@@ -24779,9 +24779,9 @@ ${cn.comment}` : item.comment;
|
|
|
24779
24779
|
onError("Expected a sequence for this tag");
|
|
24780
24780
|
return seq;
|
|
24781
24781
|
}
|
|
24782
|
-
function createPairs(
|
|
24782
|
+
function createPairs(schema11, iterable, ctx) {
|
|
24783
24783
|
const { replacer } = ctx;
|
|
24784
|
-
const pairs2 = new YAMLSeq.YAMLSeq(
|
|
24784
|
+
const pairs2 = new YAMLSeq.YAMLSeq(schema11);
|
|
24785
24785
|
pairs2.tag = "tag:yaml.org,2002:pairs";
|
|
24786
24786
|
let i2 = 0;
|
|
24787
24787
|
if (iterable && Symbol.iterator in Object(iterable))
|
|
@@ -24860,8 +24860,8 @@ var require_omap2 = __commonJS((exports) => {
|
|
|
24860
24860
|
}
|
|
24861
24861
|
return map2;
|
|
24862
24862
|
}
|
|
24863
|
-
static from(
|
|
24864
|
-
const pairs$1 = pairs.createPairs(
|
|
24863
|
+
static from(schema11, iterable, ctx) {
|
|
24864
|
+
const pairs$1 = pairs.createPairs(schema11, iterable, ctx);
|
|
24865
24865
|
const omap2 = new this;
|
|
24866
24866
|
omap2.items = pairs$1.items;
|
|
24867
24867
|
return omap2;
|
|
@@ -24888,7 +24888,7 @@ var require_omap2 = __commonJS((exports) => {
|
|
|
24888
24888
|
}
|
|
24889
24889
|
return Object.assign(new YAMLOMap, pairs$1);
|
|
24890
24890
|
},
|
|
24891
|
-
createNode: (
|
|
24891
|
+
createNode: (schema11, iterable, ctx) => YAMLOMap.from(schema11, iterable, ctx)
|
|
24892
24892
|
};
|
|
24893
24893
|
exports.YAMLOMap = YAMLOMap;
|
|
24894
24894
|
exports.omap = omap;
|
|
@@ -25052,8 +25052,8 @@ var require_set2 = __commonJS((exports) => {
|
|
|
25052
25052
|
var YAMLMap = require_YAMLMap();
|
|
25053
25053
|
|
|
25054
25054
|
class YAMLSet extends YAMLMap.YAMLMap {
|
|
25055
|
-
constructor(
|
|
25056
|
-
super(
|
|
25055
|
+
constructor(schema11) {
|
|
25056
|
+
super(schema11);
|
|
25057
25057
|
this.tag = YAMLSet.tag;
|
|
25058
25058
|
}
|
|
25059
25059
|
add(key) {
|
|
@@ -25093,9 +25093,9 @@ var require_set2 = __commonJS((exports) => {
|
|
|
25093
25093
|
else
|
|
25094
25094
|
throw new Error("Set items must all have null values");
|
|
25095
25095
|
}
|
|
25096
|
-
static from(
|
|
25096
|
+
static from(schema11, iterable, ctx) {
|
|
25097
25097
|
const { replacer } = ctx;
|
|
25098
|
-
const set3 = new this(
|
|
25098
|
+
const set3 = new this(schema11);
|
|
25099
25099
|
if (iterable && Symbol.iterator in Object(iterable))
|
|
25100
25100
|
for (let value of iterable) {
|
|
25101
25101
|
if (typeof replacer === "function")
|
|
@@ -25112,7 +25112,7 @@ var require_set2 = __commonJS((exports) => {
|
|
|
25112
25112
|
nodeClass: YAMLSet,
|
|
25113
25113
|
default: false,
|
|
25114
25114
|
tag: "tag:yaml.org,2002:set",
|
|
25115
|
-
createNode: (
|
|
25115
|
+
createNode: (schema11, iterable, ctx) => YAMLSet.from(schema11, iterable, ctx),
|
|
25116
25116
|
resolve(map2, onError) {
|
|
25117
25117
|
if (identity3.isMap(map2)) {
|
|
25118
25118
|
if (map2.hasAllNullValues(true))
|
|
@@ -25225,7 +25225,7 @@ var require_schema4 = __commonJS((exports) => {
|
|
|
25225
25225
|
var pairs = require_pairs2();
|
|
25226
25226
|
var set2 = require_set2();
|
|
25227
25227
|
var timestamp = require_timestamp2();
|
|
25228
|
-
var
|
|
25228
|
+
var schema11 = [
|
|
25229
25229
|
map2.map,
|
|
25230
25230
|
seq.seq,
|
|
25231
25231
|
string4.string,
|
|
@@ -25248,7 +25248,7 @@ var require_schema4 = __commonJS((exports) => {
|
|
|
25248
25248
|
timestamp.floatTime,
|
|
25249
25249
|
timestamp.timestamp
|
|
25250
25250
|
];
|
|
25251
|
-
exports.schema =
|
|
25251
|
+
exports.schema = schema11;
|
|
25252
25252
|
});
|
|
25253
25253
|
|
|
25254
25254
|
// ../../node_modules/yaml/dist/schema/tags.js
|
|
@@ -25260,7 +25260,7 @@ var require_tags = __commonJS((exports) => {
|
|
|
25260
25260
|
var bool = require_bool2();
|
|
25261
25261
|
var float = require_float2();
|
|
25262
25262
|
var int2 = require_int2();
|
|
25263
|
-
var
|
|
25263
|
+
var schema11 = require_schema2();
|
|
25264
25264
|
var schema$1 = require_schema3();
|
|
25265
25265
|
var binary = require_binary2();
|
|
25266
25266
|
var merge3 = require_merge3();
|
|
@@ -25270,7 +25270,7 @@ var require_tags = __commonJS((exports) => {
|
|
|
25270
25270
|
var set2 = require_set2();
|
|
25271
25271
|
var timestamp = require_timestamp2();
|
|
25272
25272
|
var schemas3 = new Map([
|
|
25273
|
-
["core",
|
|
25273
|
+
["core", schema11.schema],
|
|
25274
25274
|
["failsafe", [map2.map, seq.seq, string4.string]],
|
|
25275
25275
|
["json", schema$1.schema],
|
|
25276
25276
|
["yaml11", schema$2.schema],
|
|
@@ -25352,9 +25352,9 @@ var require_Schema = __commonJS((exports) => {
|
|
|
25352
25352
|
var sortMapEntriesByKey = (a2, b) => a2.key < b.key ? -1 : a2.key > b.key ? 1 : 0;
|
|
25353
25353
|
|
|
25354
25354
|
class Schema {
|
|
25355
|
-
constructor({ compat: compat2, customTags, merge: merge3, resolveKnownTags, schema:
|
|
25355
|
+
constructor({ compat: compat2, customTags, merge: merge3, resolveKnownTags, schema: schema11, sortMapEntries, toStringDefaults }) {
|
|
25356
25356
|
this.compat = Array.isArray(compat2) ? tags.getTags(compat2, "compat") : compat2 ? tags.getTags(null, compat2) : null;
|
|
25357
|
-
this.name = typeof
|
|
25357
|
+
this.name = typeof schema11 === "string" && schema11 || "core";
|
|
25358
25358
|
this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
|
|
25359
25359
|
this.tags = tags.getTags(customTags, this.name, merge3);
|
|
25360
25360
|
this.toStringOptions = toStringDefaults ?? null;
|
|
@@ -26846,11 +26846,11 @@ var require_compose_scalar = __commonJS((exports) => {
|
|
|
26846
26846
|
scalar.comment = comment;
|
|
26847
26847
|
return scalar;
|
|
26848
26848
|
}
|
|
26849
|
-
function findScalarTagByName(
|
|
26849
|
+
function findScalarTagByName(schema11, value, tagName, tagToken, onError) {
|
|
26850
26850
|
if (tagName === "!")
|
|
26851
|
-
return
|
|
26851
|
+
return schema11[identity3.SCALAR];
|
|
26852
26852
|
const matchWithTest = [];
|
|
26853
|
-
for (const tag of
|
|
26853
|
+
for (const tag of schema11.tags) {
|
|
26854
26854
|
if (!tag.collection && tag.tag === tagName) {
|
|
26855
26855
|
if (tag.default && tag.test)
|
|
26856
26856
|
matchWithTest.push(tag);
|
|
@@ -26861,18 +26861,18 @@ var require_compose_scalar = __commonJS((exports) => {
|
|
|
26861
26861
|
for (const tag of matchWithTest)
|
|
26862
26862
|
if (tag.test?.test(value))
|
|
26863
26863
|
return tag;
|
|
26864
|
-
const kt3 =
|
|
26864
|
+
const kt3 = schema11.knownTags[tagName];
|
|
26865
26865
|
if (kt3 && !kt3.collection) {
|
|
26866
|
-
|
|
26866
|
+
schema11.tags.push(Object.assign({}, kt3, { default: false, test: undefined }));
|
|
26867
26867
|
return kt3;
|
|
26868
26868
|
}
|
|
26869
26869
|
onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, tagName !== "tag:yaml.org,2002:str");
|
|
26870
|
-
return
|
|
26870
|
+
return schema11[identity3.SCALAR];
|
|
26871
26871
|
}
|
|
26872
|
-
function findScalarTagByTest({ atKey, directives, schema:
|
|
26873
|
-
const tag =
|
|
26874
|
-
if (
|
|
26875
|
-
const compat2 =
|
|
26872
|
+
function findScalarTagByTest({ atKey, directives, schema: schema11 }, value, token, onError) {
|
|
26873
|
+
const tag = schema11.tags.find((tag2) => (tag2.default === true || atKey && tag2.default === "key") && tag2.test?.test(value)) || schema11[identity3.SCALAR];
|
|
26874
|
+
if (schema11.compat) {
|
|
26875
|
+
const compat2 = schema11.compat.find((tag2) => tag2.default && tag2.test?.test(value)) ?? schema11[identity3.SCALAR];
|
|
26876
26876
|
if (tag.tag !== compat2.tag) {
|
|
26877
26877
|
const ts = directives.tagString(tag.tag);
|
|
26878
26878
|
const cs = directives.tagString(compat2.tag);
|
|
@@ -31158,7 +31158,7 @@ function cleanDoc(doc2) {
|
|
|
31158
31158
|
return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
|
|
31159
31159
|
}
|
|
31160
31160
|
function replaceEndOfLine(doc2, replacement = literalline) {
|
|
31161
|
-
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
31161
|
+
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join24(replacement, currentDoc.split(`
|
|
31162
31162
|
`)) : currentDoc);
|
|
31163
31163
|
}
|
|
31164
31164
|
function canBreakFn(doc2) {
|
|
@@ -31238,7 +31238,7 @@ function indentIfBreak(contents, options) {
|
|
|
31238
31238
|
negate: options.negate
|
|
31239
31239
|
};
|
|
31240
31240
|
}
|
|
31241
|
-
function
|
|
31241
|
+
function join24(separator, docs) {
|
|
31242
31242
|
assertDoc(separator);
|
|
31243
31243
|
assertDocArray(docs);
|
|
31244
31244
|
const parts = [];
|
|
@@ -31949,7 +31949,7 @@ var init_doc = __esm(() => {
|
|
|
31949
31949
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
31950
31950
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
31951
31951
|
builders = {
|
|
31952
|
-
join:
|
|
31952
|
+
join: join24,
|
|
31953
31953
|
line,
|
|
31954
31954
|
softline,
|
|
31955
31955
|
hardline,
|
|
@@ -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 schema12 = new SchemaConstructor(parameters);
|
|
119564
|
+
const subSchema = Object.create(schema12);
|
|
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], schema12, Schema2.prototype[handlerKey].length);
|
|
119568
119568
|
}
|
|
119569
119569
|
}
|
|
119570
119570
|
return subSchema;
|
|
@@ -119821,8 +119821,8 @@ async function loadEditorconfigInternal(file2, { shouldCache }) {
|
|
|
119821
119821
|
const directory = path52.dirname(file2);
|
|
119822
119822
|
const root2 = await findProjectRoot2(directory, { shouldCache });
|
|
119823
119823
|
const editorConfig = await import_editorconfig.default.parse(file2, { root: root2 });
|
|
119824
|
-
const
|
|
119825
|
-
return
|
|
119824
|
+
const config13 = editorconfig_to_prettier_default(editorConfig);
|
|
119825
|
+
return config13;
|
|
119826
119826
|
}
|
|
119827
119827
|
function loadEditorconfig(file2, { shouldCache }) {
|
|
119828
119828
|
file2 = path52.resolve(file2);
|
|
@@ -121812,18 +121812,18 @@ async function loadConfig(configFile) {
|
|
|
121812
121812
|
if (!load2) {
|
|
121813
121813
|
throw new Error(`No loader specified for extension "${extension || "noExt"}"`);
|
|
121814
121814
|
}
|
|
121815
|
-
let
|
|
121816
|
-
if (!
|
|
121815
|
+
let config13 = await load2(configFile);
|
|
121816
|
+
if (!config13) {
|
|
121817
121817
|
return;
|
|
121818
121818
|
}
|
|
121819
|
-
if (typeof
|
|
121820
|
-
|
|
121819
|
+
if (typeof config13 === "string") {
|
|
121820
|
+
config13 = await load_external_config_default(config13, configFile);
|
|
121821
121821
|
}
|
|
121822
|
-
if (typeof
|
|
121823
|
-
throw new TypeError(`Config is only allowed to be an object, but received ${typeof
|
|
121822
|
+
if (typeof config13 !== "object") {
|
|
121823
|
+
throw new TypeError(`Config is only allowed to be an object, but received ${typeof config13} in "${configFile}"`);
|
|
121824
121824
|
}
|
|
121825
|
-
delete
|
|
121826
|
-
return
|
|
121825
|
+
delete config13.$schema;
|
|
121826
|
+
return config13;
|
|
121827
121827
|
}
|
|
121828
121828
|
function clearPrettierConfigCache() {
|
|
121829
121829
|
loadCache.clear();
|
|
@@ -121873,8 +121873,8 @@ async function loadPrettierConfig2(file2, options8) {
|
|
|
121873
121873
|
return;
|
|
121874
121874
|
}
|
|
121875
121875
|
configFile = toPath3(configFile);
|
|
121876
|
-
const
|
|
121877
|
-
return { config:
|
|
121876
|
+
const config13 = await loadPrettierConfig(configFile, { shouldCache });
|
|
121877
|
+
return { config: config13, configFile };
|
|
121878
121878
|
}
|
|
121879
121879
|
async function resolveConfig(fileUrlOrPath, options8) {
|
|
121880
121880
|
options8 = { useCache: true, ...options8 };
|
|
@@ -121901,8 +121901,8 @@ async function resolveConfigFile(fileUrlOrPath) {
|
|
|
121901
121901
|
return result ?? null;
|
|
121902
121902
|
}
|
|
121903
121903
|
function mergeOverrides(configResult, filePath) {
|
|
121904
|
-
const { config:
|
|
121905
|
-
const { overrides, ...options8 } =
|
|
121904
|
+
const { config: config13, configFile } = configResult || {};
|
|
121905
|
+
const { overrides, ...options8 } = config13 || {};
|
|
121906
121906
|
if (filePath && overrides) {
|
|
121907
121907
|
const relativeFilePath = path102.relative(path102.dirname(configFile), filePath);
|
|
121908
121908
|
for (const override of overrides) {
|
|
@@ -122718,12 +122718,12 @@ function getLanguageByFileName(languages2, file2) {
|
|
|
122718
122718
|
if (!file2) {
|
|
122719
122719
|
return;
|
|
122720
122720
|
}
|
|
122721
|
-
const
|
|
122721
|
+
const basename7 = getFileBasename(file2).toLowerCase();
|
|
122722
122722
|
return languages2.find(({
|
|
122723
122723
|
filenames
|
|
122724
|
-
}) => filenames?.some((name2) => name2.toLowerCase() ===
|
|
122724
|
+
}) => filenames?.some((name2) => name2.toLowerCase() === basename7)) ?? languages2.find(({
|
|
122725
122725
|
extensions
|
|
122726
|
-
}) => extensions?.some((extension) =>
|
|
122726
|
+
}) => extensions?.some((extension) => basename7.endsWith(extension)));
|
|
122727
122727
|
}
|
|
122728
122728
|
function getLanguageByLanguageName(languages2, languageName) {
|
|
122729
122729
|
if (!languageName) {
|
|
@@ -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, schema12, utils3) => optionInfo.exception(value) || schema12.validate(value, utils3);
|
|
122908
122908
|
} else {
|
|
122909
|
-
parameters.validate = (value,
|
|
122909
|
+
parameters.validate = (value, schema12, utils3) => value === undefined || schema12.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, schema12, utils3) => schema12.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 ? {
|
|
@@ -124011,16 +124011,16 @@ async function getFileInfo(file2, options8 = {}) {
|
|
|
124011
124011
|
};
|
|
124012
124012
|
}
|
|
124013
124013
|
async function getParser(file2, options8) {
|
|
124014
|
-
let
|
|
124014
|
+
let config13;
|
|
124015
124015
|
if (options8.resolveConfig !== false) {
|
|
124016
|
-
|
|
124016
|
+
config13 = await resolveConfig(file2, {
|
|
124017
124017
|
editorconfig: false
|
|
124018
124018
|
});
|
|
124019
124019
|
}
|
|
124020
|
-
if (
|
|
124021
|
-
return
|
|
124020
|
+
if (config13?.parser) {
|
|
124021
|
+
return config13.parser;
|
|
124022
124022
|
}
|
|
124023
|
-
let plugins = options8.plugins ??
|
|
124023
|
+
let plugins = options8.plugins ?? config13?.plugins ?? [];
|
|
124024
124024
|
plugins = (await Promise.all([load_builtin_plugins_default(), load_plugins_default(plugins)])).flat();
|
|
124025
124025
|
return infer_parser_default({ plugins }, { physicalFile: file2 });
|
|
124026
124026
|
}
|
|
@@ -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 schema12 = this._utils.schemas[key2];
|
|
124502
124502
|
if (!(key2 in newOptions)) {
|
|
124503
|
-
const defaultResult = normalizeDefaultResult(
|
|
124503
|
+
const defaultResult = normalizeDefaultResult(schema12.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 schema12 = this._utils.schemas[key2];
|
|
124515
124515
|
const value = newOptions[key2];
|
|
124516
|
-
const newValue =
|
|
124516
|
+
const newValue = schema12.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, schema12);
|
|
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 schema12 = this._utils.schemas[key2];
|
|
124532
|
+
const value = schema12.preprocess(options8[key2], this._utils);
|
|
124533
|
+
this._applyValidation(value, key2, schema12);
|
|
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(schema12.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(schema12.forward(value, this._utils), value);
|
|
124557
124557
|
forwardResult.forEach(appendTransferredOptions);
|
|
124558
|
-
const redirectResult = normalizeRedirectResult(
|
|
124558
|
+
const redirectResult = normalizeRedirectResult(schema12.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 ? schema12.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, schema12) {
|
|
124591
|
+
const validateResult = normalizeValidateResult(schema12.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 schema12 = this._utils.schemas[knownResultKey];
|
|
124634
|
+
this._applyValidation(knownResultValue, knownResultKey, schema12);
|
|
124635
124635
|
options8[knownResultKey] = knownResultValue;
|
|
124636
124636
|
});
|
|
124637
124637
|
}
|
|
@@ -127945,8 +127945,8 @@ var init_prettier = __esm(() => {
|
|
|
127945
127945
|
}
|
|
127946
127946
|
exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
|
127947
127947
|
function isAffectDepthOfReadingPattern(pattern) {
|
|
127948
|
-
const
|
|
127949
|
-
return endsWithSlashGlobStar(pattern) || isStaticPattern(
|
|
127948
|
+
const basename7 = path152.basename(pattern);
|
|
127949
|
+
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename7);
|
|
127950
127950
|
}
|
|
127951
127951
|
exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
|
127952
127952
|
function expandPatternsWithBraceExpansion(patterns) {
|
|
@@ -136863,7 +136863,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
136863
136863
|
return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
|
|
136864
136864
|
}
|
|
136865
136865
|
function replaceEndOfLine2(doc2, replacement = literalline2) {
|
|
136866
|
-
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
136866
|
+
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join26(replacement, currentDoc.split(`
|
|
136867
136867
|
`)) : currentDoc);
|
|
136868
136868
|
}
|
|
136869
136869
|
function canBreakFn2(doc2) {
|
|
@@ -136949,7 +136949,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
136949
136949
|
negate: options8.negate
|
|
136950
136950
|
};
|
|
136951
136951
|
}
|
|
136952
|
-
function
|
|
136952
|
+
function join26(separator, docs) {
|
|
136953
136953
|
assertDoc2(separator);
|
|
136954
136954
|
assertDocArray2(docs);
|
|
136955
136955
|
const parts = [];
|
|
@@ -137614,7 +137614,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
137614
137614
|
}
|
|
137615
137615
|
}
|
|
137616
137616
|
var builders2 = {
|
|
137617
|
-
join:
|
|
137617
|
+
join: join26,
|
|
137618
137618
|
line: line3,
|
|
137619
137619
|
softline: softline2,
|
|
137620
137620
|
hardline: hardline4,
|
|
@@ -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)((schema12) => {
|
|
138348
|
+
const parent = schema12[exports.Parent];
|
|
138349
138349
|
if (!parent) {
|
|
138350
|
-
return
|
|
138350
|
+
return schema12;
|
|
138351
138351
|
}
|
|
138352
138352
|
return (0, exports.getRootSchema)(parent);
|
|
138353
138353
|
});
|
|
138354
|
-
function isBoolean(
|
|
138355
|
-
return
|
|
138354
|
+
function isBoolean(schema12) {
|
|
138355
|
+
return schema12 === true || schema12 === false;
|
|
138356
138356
|
}
|
|
138357
138357
|
exports.isBoolean = isBoolean;
|
|
138358
|
-
function isPrimitive(
|
|
138359
|
-
return !(0, lodash_1.isPlainObject)(
|
|
138358
|
+
function isPrimitive(schema12) {
|
|
138359
|
+
return !(0, lodash_1.isPlainObject)(schema12);
|
|
138360
138360
|
}
|
|
138361
138361
|
exports.isPrimitive = isPrimitive;
|
|
138362
|
-
function isCompound(
|
|
138363
|
-
return Array.isArray(
|
|
138362
|
+
function isCompound(schema12) {
|
|
138363
|
+
return Array.isArray(schema12.type) || "anyOf" in schema12 || "oneOf" in schema12;
|
|
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(schema12, name2) {
|
|
138591
138591
|
var result = [];
|
|
138592
|
-
|
|
138592
|
+
schema12[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(schema12, 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 = schema12.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(schema12, callback, processed) {
|
|
141209
|
+
if (typeof schema12 !== "object" || !schema12) {
|
|
141210
141210
|
return;
|
|
141211
141211
|
}
|
|
141212
|
-
const r5 =
|
|
141212
|
+
const r5 = schema12;
|
|
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(schema12, callback, processed = new Set, key2) {
|
|
141222
|
+
if (processed.has(schema12)) {
|
|
141223
141223
|
return;
|
|
141224
141224
|
}
|
|
141225
|
-
processed.add(
|
|
141226
|
-
callback(
|
|
141227
|
-
if (
|
|
141228
|
-
traverseArray(
|
|
141225
|
+
processed.add(schema12);
|
|
141226
|
+
callback(schema12, key2 !== null && key2 !== undefined ? key2 : null);
|
|
141227
|
+
if (schema12.anyOf) {
|
|
141228
|
+
traverseArray(schema12.anyOf, callback, processed);
|
|
141229
141229
|
}
|
|
141230
|
-
if (
|
|
141231
|
-
traverseArray(
|
|
141230
|
+
if (schema12.allOf) {
|
|
141231
|
+
traverseArray(schema12.allOf, callback, processed);
|
|
141232
141232
|
}
|
|
141233
|
-
if (
|
|
141234
|
-
traverseArray(
|
|
141233
|
+
if (schema12.oneOf) {
|
|
141234
|
+
traverseArray(schema12.oneOf, callback, processed);
|
|
141235
141235
|
}
|
|
141236
|
-
if (
|
|
141237
|
-
traverseObjectKeys(
|
|
141236
|
+
if (schema12.properties) {
|
|
141237
|
+
traverseObjectKeys(schema12.properties, callback, processed);
|
|
141238
141238
|
}
|
|
141239
|
-
if (
|
|
141240
|
-
traverseObjectKeys(
|
|
141239
|
+
if (schema12.patternProperties) {
|
|
141240
|
+
traverseObjectKeys(schema12.patternProperties, callback, processed);
|
|
141241
141241
|
}
|
|
141242
|
-
if (
|
|
141243
|
-
traverse(
|
|
141242
|
+
if (schema12.additionalProperties && typeof schema12.additionalProperties === "object") {
|
|
141243
|
+
traverse(schema12.additionalProperties, callback, processed);
|
|
141244
141244
|
}
|
|
141245
|
-
if (
|
|
141246
|
-
const { items } =
|
|
141245
|
+
if (schema12.items) {
|
|
141246
|
+
const { items } = schema12;
|
|
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 (schema12.additionalItems && typeof schema12.additionalItems === "object") {
|
|
141254
|
+
traverse(schema12.additionalItems, callback, processed);
|
|
141255
141255
|
}
|
|
141256
|
-
if (
|
|
141257
|
-
if (Array.isArray(
|
|
141258
|
-
traverseArray(
|
|
141256
|
+
if (schema12.dependencies) {
|
|
141257
|
+
if (Array.isArray(schema12.dependencies)) {
|
|
141258
|
+
traverseArray(schema12.dependencies, callback, processed);
|
|
141259
141259
|
} else {
|
|
141260
|
-
traverseObjectKeys(
|
|
141260
|
+
traverseObjectKeys(schema12.dependencies, callback, processed);
|
|
141261
141261
|
}
|
|
141262
141262
|
}
|
|
141263
|
-
if (
|
|
141264
|
-
traverseObjectKeys(
|
|
141263
|
+
if (schema12.definitions) {
|
|
141264
|
+
traverseObjectKeys(schema12.definitions, callback, processed);
|
|
141265
141265
|
}
|
|
141266
|
-
if (
|
|
141267
|
-
traverseObjectKeys(
|
|
141266
|
+
if (schema12.$defs) {
|
|
141267
|
+
traverseObjectKeys(schema12.$defs, callback, processed);
|
|
141268
141268
|
}
|
|
141269
|
-
if (
|
|
141270
|
-
traverse(
|
|
141269
|
+
if (schema12.not) {
|
|
141270
|
+
traverse(schema12.not, callback, processed);
|
|
141271
141271
|
}
|
|
141272
|
-
traverseIntersection(
|
|
141273
|
-
Object.keys(
|
|
141274
|
-
const child =
|
|
141272
|
+
traverseIntersection(schema12, callback, processed);
|
|
141273
|
+
Object.keys(schema12).filter((key3) => !BLACKLISTED_KEYS.has(key3)).forEach((key3) => {
|
|
141274
|
+
const child = schema12[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(schema12) {
|
|
141357
141357
|
const replacer = "* /";
|
|
141358
|
-
if (
|
|
141358
|
+
if (schema12 === null || typeof schema12 !== "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(schema12)) {
|
|
141362
|
+
if (key2 === "description" && typeof schema12[key2] === "string") {
|
|
141363
|
+
schema12[key2] = schema12[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(schema12) {
|
|
141376
|
+
if (!("default" in schema12)) {
|
|
141377
|
+
return schema12;
|
|
141378
141378
|
}
|
|
141379
|
-
switch (
|
|
141379
|
+
switch (schema12.type) {
|
|
141380
141380
|
case "array":
|
|
141381
|
-
if (Array.isArray(
|
|
141382
|
-
return
|
|
141381
|
+
if (Array.isArray(schema12.default)) {
|
|
141382
|
+
return schema12;
|
|
141383
141383
|
}
|
|
141384
141384
|
break;
|
|
141385
141385
|
case "boolean":
|
|
141386
|
-
if (typeof
|
|
141387
|
-
return
|
|
141386
|
+
if (typeof schema12.default === "boolean") {
|
|
141387
|
+
return schema12;
|
|
141388
141388
|
}
|
|
141389
141389
|
break;
|
|
141390
141390
|
case "integer":
|
|
141391
141391
|
case "number":
|
|
141392
|
-
if (typeof
|
|
141393
|
-
return
|
|
141392
|
+
if (typeof schema12.default === "number") {
|
|
141393
|
+
return schema12;
|
|
141394
141394
|
}
|
|
141395
141395
|
break;
|
|
141396
141396
|
case "string":
|
|
141397
|
-
if (typeof
|
|
141398
|
-
return
|
|
141397
|
+
if (typeof schema12.default === "string") {
|
|
141398
|
+
return schema12;
|
|
141399
141399
|
}
|
|
141400
141400
|
break;
|
|
141401
141401
|
case "null":
|
|
141402
|
-
if (
|
|
141403
|
-
return
|
|
141402
|
+
if (schema12.default === null) {
|
|
141403
|
+
return schema12;
|
|
141404
141404
|
}
|
|
141405
141405
|
break;
|
|
141406
141406
|
case "object":
|
|
141407
|
-
if ((0, lodash_1.isPlainObject)(
|
|
141408
|
-
return
|
|
141407
|
+
if ((0, lodash_1.isPlainObject)(schema12.default)) {
|
|
141408
|
+
return schema12;
|
|
141409
141409
|
}
|
|
141410
141410
|
break;
|
|
141411
141411
|
}
|
|
141412
|
-
delete
|
|
141413
|
-
return
|
|
141412
|
+
delete schema12.default;
|
|
141413
|
+
return schema12;
|
|
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(schema12) {
|
|
141428
|
+
if (!(0, lodash_1.isPlainObject)(schema12)) {
|
|
141429
141429
|
return false;
|
|
141430
141430
|
}
|
|
141431
|
-
const parent =
|
|
141431
|
+
const parent = schema12[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] === schema12)) {
|
|
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(schema12) {
|
|
141747
|
+
if (schema12.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(schema12)) {
|
|
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(schema12) {
|
|
141764
|
+
return "allOf" in schema12;
|
|
141765
141765
|
},
|
|
141766
|
-
ANY(
|
|
141767
|
-
if (Object.keys(
|
|
141766
|
+
ANY(schema12) {
|
|
141767
|
+
if (Object.keys(schema12).length === 0) {
|
|
141768
141768
|
return true;
|
|
141769
141769
|
}
|
|
141770
|
-
return
|
|
141770
|
+
return schema12.type === "any";
|
|
141771
141771
|
},
|
|
141772
|
-
ANY_OF(
|
|
141773
|
-
return "anyOf" in
|
|
141772
|
+
ANY_OF(schema12) {
|
|
141773
|
+
return "anyOf" in schema12;
|
|
141774
141774
|
},
|
|
141775
|
-
BOOLEAN(
|
|
141776
|
-
if ("enum" in
|
|
141775
|
+
BOOLEAN(schema12) {
|
|
141776
|
+
if ("enum" in schema12) {
|
|
141777
141777
|
return false;
|
|
141778
141778
|
}
|
|
141779
|
-
if (
|
|
141779
|
+
if (schema12.type === "boolean") {
|
|
141780
141780
|
return true;
|
|
141781
141781
|
}
|
|
141782
|
-
if (!(0, JSONSchema_1.isCompound)(
|
|
141782
|
+
if (!(0, JSONSchema_1.isCompound)(schema12) && typeof schema12.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(schema12) {
|
|
141791
|
+
return "enum" in schema12 && "tsEnumNames" in schema12;
|
|
141792
141792
|
},
|
|
141793
|
-
NAMED_SCHEMA(
|
|
141794
|
-
return "$id" in
|
|
141793
|
+
NAMED_SCHEMA(schema12) {
|
|
141794
|
+
return "$id" in schema12 && (("patternProperties" in schema12) || ("properties" in schema12));
|
|
141795
141795
|
},
|
|
141796
|
-
NEVER(
|
|
141797
|
-
return
|
|
141796
|
+
NEVER(schema12) {
|
|
141797
|
+
return schema12 === false;
|
|
141798
141798
|
},
|
|
141799
|
-
NULL(
|
|
141800
|
-
return
|
|
141799
|
+
NULL(schema12) {
|
|
141800
|
+
return schema12.type === "null";
|
|
141801
141801
|
},
|
|
141802
|
-
NUMBER(
|
|
141803
|
-
if ("enum" in
|
|
141802
|
+
NUMBER(schema12) {
|
|
141803
|
+
if ("enum" in schema12) {
|
|
141804
141804
|
return false;
|
|
141805
141805
|
}
|
|
141806
|
-
if (
|
|
141806
|
+
if (schema12.type === "integer" || schema12.type === "number") {
|
|
141807
141807
|
return true;
|
|
141808
141808
|
}
|
|
141809
|
-
if (!(0, JSONSchema_1.isCompound)(
|
|
141809
|
+
if (!(0, JSONSchema_1.isCompound)(schema12) && typeof schema12.default === "number") {
|
|
141810
141810
|
return true;
|
|
141811
141811
|
}
|
|
141812
141812
|
return false;
|
|
141813
141813
|
},
|
|
141814
|
-
OBJECT(
|
|
141815
|
-
return
|
|
141814
|
+
OBJECT(schema12) {
|
|
141815
|
+
return schema12.type === "object" && !(0, lodash_1.isPlainObject)(schema12.additionalProperties) && !schema12.allOf && !schema12.anyOf && !schema12.oneOf && !schema12.patternProperties && !schema12.properties && !schema12.required;
|
|
141816
141816
|
},
|
|
141817
|
-
ONE_OF(
|
|
141818
|
-
return "oneOf" in
|
|
141817
|
+
ONE_OF(schema12) {
|
|
141818
|
+
return "oneOf" in schema12;
|
|
141819
141819
|
},
|
|
141820
|
-
REFERENCE(
|
|
141821
|
-
return "$ref" in
|
|
141820
|
+
REFERENCE(schema12) {
|
|
141821
|
+
return "$ref" in schema12;
|
|
141822
141822
|
},
|
|
141823
|
-
STRING(
|
|
141824
|
-
if ("enum" in
|
|
141823
|
+
STRING(schema12) {
|
|
141824
|
+
if ("enum" in schema12) {
|
|
141825
141825
|
return false;
|
|
141826
141826
|
}
|
|
141827
|
-
if (
|
|
141827
|
+
if (schema12.type === "string") {
|
|
141828
141828
|
return true;
|
|
141829
141829
|
}
|
|
141830
|
-
if (!(0, JSONSchema_1.isCompound)(
|
|
141830
|
+
if (!(0, JSONSchema_1.isCompound)(schema12) && typeof schema12.default === "string") {
|
|
141831
141831
|
return true;
|
|
141832
141832
|
}
|
|
141833
141833
|
return false;
|
|
141834
141834
|
},
|
|
141835
|
-
TYPED_ARRAY(
|
|
141836
|
-
if (
|
|
141835
|
+
TYPED_ARRAY(schema12) {
|
|
141836
|
+
if (schema12.type && schema12.type !== "array") {
|
|
141837
141837
|
return false;
|
|
141838
141838
|
}
|
|
141839
|
-
return "items" in
|
|
141839
|
+
return "items" in schema12;
|
|
141840
141840
|
},
|
|
141841
|
-
UNION(
|
|
141842
|
-
return Array.isArray(
|
|
141841
|
+
UNION(schema12) {
|
|
141842
|
+
return Array.isArray(schema12.type);
|
|
141843
141843
|
},
|
|
141844
|
-
UNNAMED_ENUM(
|
|
141845
|
-
if ("tsEnumNames" in
|
|
141844
|
+
UNNAMED_ENUM(schema12) {
|
|
141845
|
+
if ("tsEnumNames" in schema12) {
|
|
141846
141846
|
return false;
|
|
141847
141847
|
}
|
|
141848
|
-
if (
|
|
141848
|
+
if (schema12.type && schema12.type !== "boolean" && schema12.type !== "integer" && schema12.type !== "number" && schema12.type !== "string") {
|
|
141849
141849
|
return false;
|
|
141850
141850
|
}
|
|
141851
|
-
return "enum" in
|
|
141851
|
+
return "enum" in schema12;
|
|
141852
141852
|
},
|
|
141853
141853
|
UNNAMED_SCHEMA() {
|
|
141854
141854
|
return false;
|
|
141855
141855
|
},
|
|
141856
|
-
UNTYPED_ARRAY(
|
|
141857
|
-
return
|
|
141856
|
+
UNTYPED_ARRAY(schema12) {
|
|
141857
|
+
return schema12.type === "array" && !("items" in schema12);
|
|
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(schema12) {
|
|
141869
141869
|
var _a7;
|
|
141870
|
-
const types = (0, typesOfSchema_1.typesOfSchema)(
|
|
141871
|
-
Object.defineProperty(
|
|
141870
|
+
const types = (0, typesOfSchema_1.typesOfSchema)(schema12);
|
|
141871
|
+
Object.defineProperty(schema12, 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]: schema12,
|
|
141881
141881
|
[JSONSchema_1.Types]: new Set(["ALL_OF"]),
|
|
141882
|
-
$id:
|
|
141883
|
-
description:
|
|
141884
|
-
name:
|
|
141885
|
-
title:
|
|
141886
|
-
allOf: (_a7 =
|
|
141882
|
+
$id: schema12.$id,
|
|
141883
|
+
description: schema12.description,
|
|
141884
|
+
name: schema12.name,
|
|
141885
|
+
title: schema12.title,
|
|
141886
|
+
allOf: (_a7 = schema12.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 schema12.allOf;
|
|
141892
|
+
delete schema12.$id;
|
|
141893
|
+
delete schema12.description;
|
|
141894
|
+
delete schema12.name;
|
|
141895
|
+
delete schema12.title;
|
|
141896
|
+
Object.defineProperty(schema12, 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(schema12, type) {
|
|
141915
|
+
return schema12.type === type || Array.isArray(schema12.type) && schema12.type.includes(type);
|
|
141916
141916
|
}
|
|
141917
|
-
function isObjectType(
|
|
141918
|
-
return
|
|
141917
|
+
function isObjectType(schema12) {
|
|
141918
|
+
return schema12.properties !== undefined || hasType(schema12, "object") || hasType(schema12, "any");
|
|
141919
141919
|
}
|
|
141920
|
-
function isArrayType(
|
|
141921
|
-
return
|
|
141920
|
+
function isArrayType(schema12) {
|
|
141921
|
+
return schema12.items !== undefined || hasType(schema12, "array") || hasType(schema12, "any");
|
|
141922
141922
|
}
|
|
141923
|
-
function isEnumTypeWithoutTsEnumNames(
|
|
141924
|
-
return
|
|
141923
|
+
function isEnumTypeWithoutTsEnumNames(schema12) {
|
|
141924
|
+
return schema12.type === "string" && schema12.enum !== undefined && schema12.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]`', (schema12) => {
|
|
141927
|
+
if (Array.isArray(schema12.enum) && schema12.enum.some((e8) => e8 === null) && Array.isArray(schema12.type) && schema12.type.includes("null")) {
|
|
141928
|
+
schema12.type = schema12.type.filter((type) => type !== "null");
|
|
141929
141929
|
}
|
|
141930
141930
|
});
|
|
141931
|
-
rules.set("Destructure unary types", (
|
|
141932
|
-
if (
|
|
141933
|
-
|
|
141931
|
+
rules.set("Destructure unary types", (schema12) => {
|
|
141932
|
+
if (schema12.type && Array.isArray(schema12.type) && schema12.type.length === 1) {
|
|
141933
|
+
schema12.type = schema12.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", (schema12) => {
|
|
141937
|
+
if (isObjectType(schema12) && !("required" in schema12)) {
|
|
141938
|
+
schema12.required = [];
|
|
141939
141939
|
}
|
|
141940
141940
|
});
|
|
141941
|
-
rules.set("Transform `required`=false to `required`=[]", (
|
|
141942
|
-
if (
|
|
141943
|
-
|
|
141941
|
+
rules.set("Transform `required`=false to `required`=[]", (schema12) => {
|
|
141942
|
+
if (schema12.required === false) {
|
|
141943
|
+
schema12.required = [];
|
|
141944
141944
|
}
|
|
141945
141945
|
});
|
|
141946
|
-
rules.set("Default additionalProperties", (
|
|
141947
|
-
if (isObjectType(
|
|
141948
|
-
|
|
141946
|
+
rules.set("Default additionalProperties", (schema12, _10, options8) => {
|
|
141947
|
+
if (isObjectType(schema12) && !("additionalProperties" in schema12) && schema12.patternProperties === undefined) {
|
|
141948
|
+
schema12.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", (schema12, fileName) => {
|
|
141952
|
+
if (!(0, utils_1.isSchemaLike)(schema12)) {
|
|
141953
141953
|
return;
|
|
141954
141954
|
}
|
|
141955
|
-
if (
|
|
141956
|
-
throw ReferenceError(`Schema must define either id or $id, not both. Given id=${
|
|
141955
|
+
if (schema12.id && schema12.$id && schema12.id !== schema12.$id) {
|
|
141956
|
+
throw ReferenceError(`Schema must define either id or $id, not both. Given id=${schema12.id}, $id=${schema12.$id} in ${fileName}`);
|
|
141957
141957
|
}
|
|
141958
|
-
if (
|
|
141959
|
-
|
|
141960
|
-
delete
|
|
141958
|
+
if (schema12.id) {
|
|
141959
|
+
schema12.$id = schema12.id;
|
|
141960
|
+
delete schema12.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", (schema12, fileName, _options, _key, dereferencedPaths) => {
|
|
141964
|
+
if (!(0, utils_1.isSchemaLike)(schema12)) {
|
|
141965
141965
|
return;
|
|
141966
141966
|
}
|
|
141967
|
-
if (!
|
|
141968
|
-
|
|
141967
|
+
if (!schema12.$id && !schema12[JSONSchema_1.Parent]) {
|
|
141968
|
+
schema12.$id = (0, utils_1.toSafeString)((0, utils_1.justName)(fileName));
|
|
141969
141969
|
return;
|
|
141970
141970
|
}
|
|
141971
|
-
if (!isArrayType(
|
|
141971
|
+
if (!isArrayType(schema12) && !isObjectType(schema12)) {
|
|
141972
141972
|
return;
|
|
141973
141973
|
}
|
|
141974
|
-
const dereferencedName = dereferencedPaths.get(
|
|
141975
|
-
if (!
|
|
141976
|
-
|
|
141974
|
+
const dereferencedName = dereferencedPaths.get(schema12);
|
|
141975
|
+
if (!schema12.$id && !schema12.title && dereferencedName) {
|
|
141976
|
+
schema12.$id = (0, utils_1.toSafeString)((0, utils_1.justName)(dereferencedName));
|
|
141977
141977
|
}
|
|
141978
141978
|
if (dereferencedName) {
|
|
141979
|
-
dereferencedPaths.delete(
|
|
141979
|
+
dereferencedPaths.delete(schema12);
|
|
141980
141980
|
}
|
|
141981
141981
|
});
|
|
141982
|
-
rules.set("Escape closing JSDoc comment", (
|
|
141983
|
-
(0, utils_1.escapeBlockComment)(
|
|
141982
|
+
rules.set("Escape closing JSDoc comment", (schema12) => {
|
|
141983
|
+
(0, utils_1.escapeBlockComment)(schema12);
|
|
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", (schema12) => {
|
|
141986
|
+
if (!isArrayType(schema12)) {
|
|
141987
141987
|
return;
|
|
141988
141988
|
}
|
|
141989
141989
|
const commentsToAppend = [
|
|
141990
|
-
"minItems" in
|
|
141991
|
-
"maxItems" in
|
|
141990
|
+
"minItems" in schema12 ? `@minItems ${schema12.minItems}` : "",
|
|
141991
|
+
"maxItems" in schema12 ? `@maxItems ${schema12.maxItems}` : ""
|
|
141992
141992
|
].filter(Boolean);
|
|
141993
141993
|
if (commentsToAppend.length) {
|
|
141994
|
-
|
|
141994
|
+
schema12.description = (0, utils_1.appendToDescription)(schema12.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", (schema12, _fileName, options8) => {
|
|
141998
|
+
if (!isArrayType(schema12)) {
|
|
141999
141999
|
return;
|
|
142000
142000
|
}
|
|
142001
|
-
if ("minItems" in
|
|
142002
|
-
delete
|
|
142001
|
+
if ("minItems" in schema12 && options8.ignoreMinAndMaxItems) {
|
|
142002
|
+
delete schema12.minItems;
|
|
142003
142003
|
}
|
|
142004
|
-
if ("maxItems" in
|
|
142005
|
-
delete
|
|
142004
|
+
if ("maxItems" in schema12 && (options8.ignoreMinAndMaxItems || options8.maxItems === -1)) {
|
|
142005
|
+
delete schema12.maxItems;
|
|
142006
142006
|
}
|
|
142007
142007
|
});
|
|
142008
|
-
rules.set("Normalize schema.minItems", (
|
|
142008
|
+
rules.set("Normalize schema.minItems", (schema12, _fileName, options8) => {
|
|
142009
142009
|
if (options8.ignoreMinAndMaxItems) {
|
|
142010
142010
|
return;
|
|
142011
142011
|
}
|
|
142012
|
-
if (!isArrayType(
|
|
142012
|
+
if (!isArrayType(schema12)) {
|
|
142013
142013
|
return;
|
|
142014
142014
|
}
|
|
142015
|
-
const { minItems } =
|
|
142016
|
-
|
|
142015
|
+
const { minItems } = schema12;
|
|
142016
|
+
schema12.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", (schema12, _fileName, options8) => {
|
|
142019
142019
|
if (options8.ignoreMinAndMaxItems || options8.maxItems === -1) {
|
|
142020
142020
|
return;
|
|
142021
142021
|
}
|
|
142022
|
-
if (!isArrayType(
|
|
142022
|
+
if (!isArrayType(schema12)) {
|
|
142023
142023
|
return;
|
|
142024
142024
|
}
|
|
142025
|
-
const { maxItems, minItems } =
|
|
142025
|
+
const { maxItems, minItems } = schema12;
|
|
142026
142026
|
if (maxItems !== undefined && maxItems - minItems > options8.maxItems) {
|
|
142027
|
-
delete
|
|
142027
|
+
delete schema12.maxItems;
|
|
142028
142028
|
}
|
|
142029
142029
|
});
|
|
142030
|
-
rules.set("Normalize schema.items", (
|
|
142030
|
+
rules.set("Normalize schema.items", (schema12, _fileName, options8) => {
|
|
142031
142031
|
if (options8.ignoreMinAndMaxItems) {
|
|
142032
142032
|
return;
|
|
142033
142033
|
}
|
|
142034
|
-
const { maxItems, minItems } =
|
|
142034
|
+
const { maxItems, minItems } = schema12;
|
|
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 (schema12.items && !Array.isArray(schema12.items) && (hasMaxItems || hasMinItems)) {
|
|
142038
|
+
const items = schema12.items;
|
|
142039
142039
|
const newItems = Array(maxItems || minItems || 0).fill(items);
|
|
142040
142040
|
if (!hasMaxItems) {
|
|
142041
|
-
|
|
142041
|
+
schema12.additionalItems = items;
|
|
142042
142042
|
}
|
|
142043
|
-
|
|
142043
|
+
schema12.items = newItems;
|
|
142044
142044
|
}
|
|
142045
|
-
if (Array.isArray(
|
|
142046
|
-
|
|
142045
|
+
if (Array.isArray(schema12.items) && hasMaxItems && maxItems < schema12.items.length) {
|
|
142046
|
+
schema12.items = schema12.items.slice(0, maxItems);
|
|
142047
142047
|
}
|
|
142048
|
-
return
|
|
142048
|
+
return schema12;
|
|
142049
142049
|
});
|
|
142050
|
-
rules.set("Remove extends, if it is empty", (
|
|
142051
|
-
if (!
|
|
142050
|
+
rules.set("Remove extends, if it is empty", (schema12) => {
|
|
142051
|
+
if (!schema12.hasOwnProperty("extends")) {
|
|
142052
142052
|
return;
|
|
142053
142053
|
}
|
|
142054
|
-
if (
|
|
142055
|
-
delete
|
|
142054
|
+
if (schema12.extends == null || Array.isArray(schema12.extends) && schema12.extends.length === 0) {
|
|
142055
|
+
delete schema12.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", (schema12) => {
|
|
142059
|
+
if (schema12.extends == null) {
|
|
142060
142060
|
return;
|
|
142061
142061
|
}
|
|
142062
|
-
if (!Array.isArray(
|
|
142063
|
-
|
|
142062
|
+
if (!Array.isArray(schema12.extends)) {
|
|
142063
|
+
schema12.extends = [schema12.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", (schema12, fileName) => {
|
|
142067
|
+
if (schema12.definitions && schema12.$defs && !(0, util_1.isDeepStrictEqual)(schema12.definitions, schema12.$defs)) {
|
|
142068
|
+
throw ReferenceError(`Schema must define either definitions or $defs, not both. Given id=${schema12.id} in ${fileName}`);
|
|
142069
142069
|
}
|
|
142070
|
-
if (
|
|
142071
|
-
|
|
142072
|
-
delete
|
|
142070
|
+
if (schema12.definitions) {
|
|
142071
|
+
schema12.$defs = schema12.definitions;
|
|
142072
|
+
delete schema12.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", (schema12) => {
|
|
142076
|
+
if (schema12.const !== undefined) {
|
|
142077
|
+
schema12.enum = [schema12.const];
|
|
142078
|
+
delete schema12.const;
|
|
142079
142079
|
}
|
|
142080
142080
|
});
|
|
142081
|
-
rules.set("Add tsEnumNames to enum types", (
|
|
142081
|
+
rules.set("Add tsEnumNames to enum types", (schema12, _10, options8) => {
|
|
142082
142082
|
var _a7;
|
|
142083
|
-
if (isEnumTypeWithoutTsEnumNames(
|
|
142084
|
-
|
|
142083
|
+
if (isEnumTypeWithoutTsEnumNames(schema12) && options8.inferStringEnumKeysFromValues) {
|
|
142084
|
+
schema12.tsEnumNames = (_a7 = schema12.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", (schema12) => {
|
|
142088
|
+
if (schema12 !== null && typeof schema12 === "object") {
|
|
142089
|
+
(0, applySchemaTyping_1.applySchemaTyping)(schema12);
|
|
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, (schema12, key2) => rule(schema12, 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(schema12, options8, keyName, processed = new Map, usedNames = new Set) {
|
|
142176
|
+
if ((0, JSONSchema_1.isPrimitive)(schema12)) {
|
|
142177
|
+
if ((0, JSONSchema_1.isBoolean)(schema12)) {
|
|
142178
|
+
return parseBooleanSchema(schema12, keyName, options8);
|
|
142179
142179
|
}
|
|
142180
|
-
return parseLiteral(
|
|
142180
|
+
return parseLiteral(schema12, keyName);
|
|
142181
142181
|
}
|
|
142182
|
-
const intersection2 =
|
|
142183
|
-
const types =
|
|
142182
|
+
const intersection2 = schema12[JSONSchema_1.Intersection];
|
|
142183
|
+
const types = schema12[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(schema12, 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:", schema12, "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(schema12, type, options8, keyName, processed, usedNames);
|
|
142195
|
+
(0, utils_1.log)("blue", "parser", "Type:", type, "Input:", schema12, "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(schema12, type, options8, keyName, processed = new Map, usedNames = new Set) {
|
|
142202
|
+
let cachedTypeMap = processed.get(schema12);
|
|
142203
142203
|
if (!cachedTypeMap) {
|
|
142204
142204
|
cachedTypeMap = new Map;
|
|
142205
|
-
processed.set(
|
|
142205
|
+
processed.set(schema12, 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(schema12, type, options8, keyName, processed, usedNames));
|
|
142214
142214
|
}
|
|
142215
|
-
function parseBooleanSchema(
|
|
142216
|
-
if (
|
|
142215
|
+
function parseBooleanSchema(schema12, keyName, options8) {
|
|
142216
|
+
if (schema12) {
|
|
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(schema12, keyName) {
|
|
142228
142228
|
return {
|
|
142229
142229
|
keyName,
|
|
142230
|
-
params:
|
|
142230
|
+
params: schema12,
|
|
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(schema12, type, options8, keyName, processed, usedNames) {
|
|
142235
|
+
const definitions = getDefinitionsMemoized((0, JSONSchema_1.getRootSchema)(schema12));
|
|
142236
|
+
const keyNameFromDefinition = (0, lodash_1.findKey)(definitions, (_10) => _10 === schema12);
|
|
142237
142237
|
switch (type) {
|
|
142238
142238
|
case "ALL_OF":
|
|
142239
142239
|
return {
|
|
142240
|
-
comment:
|
|
142241
|
-
deprecated:
|
|
142240
|
+
comment: schema12.description,
|
|
142241
|
+
deprecated: schema12.deprecated,
|
|
142242
142242
|
keyName,
|
|
142243
|
-
standaloneName: standaloneName(
|
|
142244
|
-
params:
|
|
142243
|
+
standaloneName: standaloneName(schema12, keyNameFromDefinition, usedNames, options8),
|
|
142244
|
+
params: schema12.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: schema12.description, deprecated: schema12.deprecated, keyName, standaloneName: standaloneName(schema12, keyNameFromDefinition, usedNames, options8) });
|
|
142249
142249
|
case "ANY_OF":
|
|
142250
142250
|
return {
|
|
142251
|
-
comment:
|
|
142252
|
-
deprecated:
|
|
142251
|
+
comment: schema12.description,
|
|
142252
|
+
deprecated: schema12.deprecated,
|
|
142253
142253
|
keyName,
|
|
142254
|
-
standaloneName: standaloneName(
|
|
142255
|
-
params:
|
|
142254
|
+
standaloneName: standaloneName(schema12, keyNameFromDefinition, usedNames, options8),
|
|
142255
|
+
params: schema12.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: schema12.description,
|
|
142261
|
+
deprecated: schema12.deprecated,
|
|
142262
142262
|
keyName,
|
|
142263
|
-
standaloneName: standaloneName(
|
|
142263
|
+
standaloneName: standaloneName(schema12, keyNameFromDefinition, usedNames, options8),
|
|
142264
142264
|
type: "BOOLEAN"
|
|
142265
142265
|
};
|
|
142266
142266
|
case "CUSTOM_TYPE":
|
|
142267
142267
|
return {
|
|
142268
|
-
comment:
|
|
142269
|
-
deprecated:
|
|
142268
|
+
comment: schema12.description,
|
|
142269
|
+
deprecated: schema12.deprecated,
|
|
142270
142270
|
keyName,
|
|
142271
|
-
params:
|
|
142272
|
-
standaloneName: standaloneName(
|
|
142271
|
+
params: schema12.tsType,
|
|
142272
|
+
standaloneName: standaloneName(schema12, keyNameFromDefinition, usedNames, options8),
|
|
142273
142273
|
type: "CUSTOM_TYPE"
|
|
142274
142274
|
};
|
|
142275
142275
|
case "NAMED_ENUM":
|
|
142276
142276
|
return {
|
|
142277
|
-
comment:
|
|
142278
|
-
deprecated:
|
|
142277
|
+
comment: schema12.description,
|
|
142278
|
+
deprecated: schema12.deprecated,
|
|
142279
142279
|
keyName,
|
|
142280
|
-
standaloneName: standaloneName(
|
|
142281
|
-
params:
|
|
142280
|
+
standaloneName: standaloneName(schema12, keyNameFromDefinition !== null && keyNameFromDefinition !== undefined ? keyNameFromDefinition : keyName, usedNames, options8),
|
|
142281
|
+
params: schema12.enum.map((_10, n5) => ({
|
|
142282
142282
|
ast: parseLiteral(_10, undefined),
|
|
142283
|
-
keyName:
|
|
142283
|
+
keyName: schema12.tsEnumNames[n5]
|
|
142284
142284
|
})),
|
|
142285
142285
|
type: "ENUM"
|
|
142286
142286
|
};
|
|
142287
142287
|
case "NAMED_SCHEMA":
|
|
142288
|
-
return newInterface(
|
|
142288
|
+
return newInterface(schema12, options8, processed, usedNames, keyName);
|
|
142289
142289
|
case "NEVER":
|
|
142290
142290
|
return {
|
|
142291
|
-
comment:
|
|
142292
|
-
deprecated:
|
|
142291
|
+
comment: schema12.description,
|
|
142292
|
+
deprecated: schema12.deprecated,
|
|
142293
142293
|
keyName,
|
|
142294
|
-
standaloneName: standaloneName(
|
|
142294
|
+
standaloneName: standaloneName(schema12, keyNameFromDefinition, usedNames, options8),
|
|
142295
142295
|
type: "NEVER"
|
|
142296
142296
|
};
|
|
142297
142297
|
case "NULL":
|
|
142298
142298
|
return {
|
|
142299
|
-
comment:
|
|
142300
|
-
deprecated:
|
|
142299
|
+
comment: schema12.description,
|
|
142300
|
+
deprecated: schema12.deprecated,
|
|
142301
142301
|
keyName,
|
|
142302
|
-
standaloneName: standaloneName(
|
|
142302
|
+
standaloneName: standaloneName(schema12, keyNameFromDefinition, usedNames, options8),
|
|
142303
142303
|
type: "NULL"
|
|
142304
142304
|
};
|
|
142305
142305
|
case "NUMBER":
|
|
142306
142306
|
return {
|
|
142307
|
-
comment:
|
|
142308
|
-
deprecated:
|
|
142307
|
+
comment: schema12.description,
|
|
142308
|
+
deprecated: schema12.deprecated,
|
|
142309
142309
|
keyName,
|
|
142310
|
-
standaloneName: standaloneName(
|
|
142310
|
+
standaloneName: standaloneName(schema12, keyNameFromDefinition, usedNames, options8),
|
|
142311
142311
|
type: "NUMBER"
|
|
142312
142312
|
};
|
|
142313
142313
|
case "OBJECT":
|
|
142314
142314
|
return {
|
|
142315
|
-
comment:
|
|
142315
|
+
comment: schema12.description,
|
|
142316
142316
|
keyName,
|
|
142317
|
-
standaloneName: standaloneName(
|
|
142317
|
+
standaloneName: standaloneName(schema12, keyNameFromDefinition, usedNames, options8),
|
|
142318
142318
|
type: "OBJECT",
|
|
142319
|
-
deprecated:
|
|
142319
|
+
deprecated: schema12.deprecated
|
|
142320
142320
|
};
|
|
142321
142321
|
case "ONE_OF":
|
|
142322
142322
|
return {
|
|
142323
|
-
comment:
|
|
142324
|
-
deprecated:
|
|
142323
|
+
comment: schema12.description,
|
|
142324
|
+
deprecated: schema12.deprecated,
|
|
142325
142325
|
keyName,
|
|
142326
|
-
standaloneName: standaloneName(
|
|
142327
|
-
params:
|
|
142326
|
+
standaloneName: standaloneName(schema12, keyNameFromDefinition, usedNames, options8),
|
|
142327
|
+
params: schema12.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!", schema12));
|
|
142332
142332
|
case "STRING":
|
|
142333
142333
|
return {
|
|
142334
|
-
comment:
|
|
142335
|
-
deprecated:
|
|
142334
|
+
comment: schema12.description,
|
|
142335
|
+
deprecated: schema12.deprecated,
|
|
142336
142336
|
keyName,
|
|
142337
|
-
standaloneName: standaloneName(
|
|
142337
|
+
standaloneName: standaloneName(schema12, 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(schema12.items)) {
|
|
142342
|
+
const minItems2 = schema12.minItems;
|
|
142343
|
+
const maxItems2 = schema12.maxItems;
|
|
142344
142344
|
const arrayType = {
|
|
142345
|
-
comment:
|
|
142346
|
-
deprecated:
|
|
142345
|
+
comment: schema12.description,
|
|
142346
|
+
deprecated: schema12.deprecated,
|
|
142347
142347
|
keyName,
|
|
142348
142348
|
maxItems: maxItems2,
|
|
142349
142349
|
minItems: minItems2,
|
|
142350
|
-
standaloneName: standaloneName(
|
|
142351
|
-
params:
|
|
142350
|
+
standaloneName: standaloneName(schema12, keyNameFromDefinition, usedNames, options8),
|
|
142351
|
+
params: schema12.items.map((_10) => parse11(_10, options8, undefined, processed, usedNames)),
|
|
142352
142352
|
type: "TUPLE"
|
|
142353
142353
|
};
|
|
142354
|
-
if (
|
|
142354
|
+
if (schema12.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 (schema12.additionalItems) {
|
|
142357
|
+
arrayType.spreadParam = parse11(schema12.additionalItems, options8, undefined, processed, usedNames);
|
|
142358
142358
|
}
|
|
142359
142359
|
return arrayType;
|
|
142360
142360
|
} else {
|
|
142361
142361
|
return {
|
|
142362
|
-
comment:
|
|
142363
|
-
deprecated:
|
|
142362
|
+
comment: schema12.description,
|
|
142363
|
+
deprecated: schema12.deprecated,
|
|
142364
142364
|
keyName,
|
|
142365
|
-
standaloneName: standaloneName(
|
|
142366
|
-
params: parse11(
|
|
142365
|
+
standaloneName: standaloneName(schema12, keyNameFromDefinition, usedNames, options8),
|
|
142366
|
+
params: parse11(schema12.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: schema12.description,
|
|
142373
|
+
deprecated: schema12.deprecated,
|
|
142374
142374
|
keyName,
|
|
142375
|
-
standaloneName: standaloneName(
|
|
142376
|
-
params:
|
|
142377
|
-
const member = Object.assign(Object.assign({}, (0, lodash_1.omit)(
|
|
142375
|
+
standaloneName: standaloneName(schema12, keyNameFromDefinition, usedNames, options8),
|
|
142376
|
+
params: schema12.type.map((type2) => {
|
|
142377
|
+
const member = Object.assign(Object.assign({}, (0, lodash_1.omit)(schema12, "$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: schema12.description,
|
|
142387
|
+
deprecated: schema12.deprecated,
|
|
142388
142388
|
keyName,
|
|
142389
|
-
standaloneName: standaloneName(
|
|
142390
|
-
params:
|
|
142389
|
+
standaloneName: standaloneName(schema12, keyNameFromDefinition, usedNames, options8),
|
|
142390
|
+
params: schema12.enum.map((_10) => parseLiteral(_10, undefined)),
|
|
142391
142391
|
type: "UNION"
|
|
142392
142392
|
};
|
|
142393
142393
|
case "UNNAMED_SCHEMA":
|
|
142394
|
-
return newInterface(
|
|
142394
|
+
return newInterface(schema12, options8, processed, usedNames, keyName, keyNameFromDefinition);
|
|
142395
142395
|
case "UNTYPED_ARRAY":
|
|
142396
|
-
const minItems =
|
|
142397
|
-
const maxItems = typeof
|
|
142396
|
+
const minItems = schema12.minItems;
|
|
142397
|
+
const maxItems = typeof schema12.maxItems === "number" ? schema12.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: schema12.description,
|
|
142402
|
+
deprecated: schema12.deprecated,
|
|
142403
142403
|
keyName,
|
|
142404
|
-
maxItems:
|
|
142404
|
+
maxItems: schema12.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(schema12, keyNameFromDefinition, usedNames, options8),
|
|
142409
142409
|
type: "TUPLE"
|
|
142410
142410
|
};
|
|
142411
142411
|
}
|
|
142412
142412
|
return {
|
|
142413
|
-
comment:
|
|
142414
|
-
deprecated:
|
|
142413
|
+
comment: schema12.description,
|
|
142414
|
+
deprecated: schema12.deprecated,
|
|
142415
142415
|
keyName,
|
|
142416
142416
|
params,
|
|
142417
|
-
standaloneName: standaloneName(
|
|
142417
|
+
standaloneName: standaloneName(schema12, keyNameFromDefinition, usedNames, options8),
|
|
142418
142418
|
type: "ARRAY"
|
|
142419
142419
|
};
|
|
142420
142420
|
}
|
|
142421
142421
|
}
|
|
142422
|
-
function standaloneName(
|
|
142422
|
+
function standaloneName(schema12, 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, schema12, keyNameFromDefinition)) || schema12.title || schema12.$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(schema12, options8, processed, usedNames, keyName, keyNameFromDefinition) {
|
|
142430
|
+
const name2 = standaloneName(schema12, keyNameFromDefinition, usedNames, options8);
|
|
142431
142431
|
return {
|
|
142432
|
-
comment:
|
|
142433
|
-
deprecated:
|
|
142432
|
+
comment: schema12.description,
|
|
142433
|
+
deprecated: schema12.deprecated,
|
|
142434
142434
|
keyName,
|
|
142435
|
-
params: parseSchema(
|
|
142435
|
+
params: parseSchema(schema12, options8, processed, usedNames, name2),
|
|
142436
142436
|
standaloneName: name2,
|
|
142437
|
-
superTypes: parseSuperTypes(
|
|
142437
|
+
superTypes: parseSuperTypes(schema12, options8, processed, usedNames),
|
|
142438
142438
|
type: "INTERFACE"
|
|
142439
142439
|
};
|
|
142440
142440
|
}
|
|
142441
|
-
function parseSuperTypes(
|
|
142442
|
-
const superTypes =
|
|
142441
|
+
function parseSuperTypes(schema12, options8, processed, usedNames) {
|
|
142442
|
+
const superTypes = schema12.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(schema12, options8, processed, usedNames, parentSchemaName) {
|
|
142449
|
+
let asts = (0, lodash_1.map)(schema12.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)(schema12.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 (schema12.patternProperties) {
|
|
142458
|
+
singlePatternProperty = !schema12.additionalProperties && Object.keys(schema12.patternProperties).length === 1;
|
|
142459
|
+
asts = asts.concat((0, lodash_1.map)(schema12.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)(schema12.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)(schema12.$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)(schema12.required || [], key2),
|
|
142487
142487
|
isUnreachableDefinition: true,
|
|
142488
142488
|
keyName: key2
|
|
142489
142489
|
};
|
|
142490
142490
|
}));
|
|
142491
142491
|
}
|
|
142492
|
-
switch (
|
|
142492
|
+
switch (schema12.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(schema12.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(schema12, isSchema = true, processed = new Set) {
|
|
142518
|
+
if (processed.has(schema12)) {
|
|
142519
142519
|
return {};
|
|
142520
142520
|
}
|
|
142521
|
-
processed.add(
|
|
142522
|
-
if (Array.isArray(
|
|
142523
|
-
return
|
|
142521
|
+
processed.add(schema12);
|
|
142522
|
+
if (Array.isArray(schema12)) {
|
|
142523
|
+
return schema12.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)(schema12)) {
|
|
142526
|
+
return Object.assign(Object.assign({}, isSchema && hasDefinitions(schema12) ? schema12.$defs : {}), Object.keys(schema12).reduce((prev, cur) => Object.assign(Object.assign({}, prev), getDefinitions(schema12[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(schema12) {
|
|
142532
|
+
return "$defs" in schema12;
|
|
142533
142533
|
}
|
|
142534
142534
|
});
|
|
142535
142535
|
|
|
@@ -142954,7 +142954,7 @@ var require_url = __commonJS((exports) => {
|
|
|
142954
142954
|
exports.fromFileSystemPath = fromFileSystemPath;
|
|
142955
142955
|
exports.toFileSystemPath = toFileSystemPath;
|
|
142956
142956
|
exports.safePointerToPath = safePointerToPath;
|
|
142957
|
-
exports.relative =
|
|
142957
|
+
exports.relative = relative6;
|
|
142958
142958
|
var convert_path_to_posix_1 = __importDefault(require_convert_path_to_posix());
|
|
142959
142959
|
var path_1 = __importStar(__require("path"));
|
|
142960
142960
|
var forwardSlashPattern = /\//g;
|
|
@@ -143104,7 +143104,7 @@ var require_url = __commonJS((exports) => {
|
|
|
143104
143104
|
return decodeURIComponent(value).replace(jsonPointerSlash, "/").replace(jsonPointerTilde, "~");
|
|
143105
143105
|
});
|
|
143106
143106
|
}
|
|
143107
|
-
function
|
|
143107
|
+
function relative6(from, to5) {
|
|
143108
143108
|
if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
|
|
143109
143109
|
return resolve13(from, to5);
|
|
143110
143110
|
}
|
|
@@ -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 schema12;
|
|
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
|
+
schema12 = args[1];
|
|
144367
144367
|
options8 = args[2];
|
|
144368
144368
|
} else {
|
|
144369
|
-
|
|
144369
|
+
schema12 = undefined;
|
|
144370
144370
|
options8 = args[1];
|
|
144371
144371
|
}
|
|
144372
144372
|
} else {
|
|
144373
144373
|
path18 = "";
|
|
144374
|
-
|
|
144374
|
+
schema12 = 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 schema12 === "object") {
|
|
144383
|
+
schema12 = JSON.parse(JSON.stringify(schema12));
|
|
144384
144384
|
}
|
|
144385
144385
|
return {
|
|
144386
144386
|
path: path18,
|
|
144387
|
-
schema:
|
|
144387
|
+
schema: schema12,
|
|
144388
144388
|
options: options8,
|
|
144389
144389
|
callback
|
|
144390
144390
|
};
|
|
@@ -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* (schema12, { cwd, $refOptions }) {
|
|
145177
|
+
(0, utils_1.log)("green", "dereferencer", "Dereferencing input schema:", cwd, schema12);
|
|
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, schema12, Object.assign(Object.assign({}, $refOptions), { dereference: Object.assign(Object.assign({}, $refOptions.dereference), { onDereference($ref, schema13) {
|
|
145181
|
+
dereferencedPaths.set(schema13, $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", (schema12) => {
|
|
145196
|
+
if (schema12.enum && schema12.tsEnumNames && schema12.enum.length !== schema12.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", (schema12) => {
|
|
145201
|
+
if (schema12.tsEnumNames && schema12.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", (schema12) => {
|
|
145206
|
+
const { maxItems, minItems } = schema12;
|
|
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", (schema12) => {
|
|
145212
|
+
const { maxItems } = schema12;
|
|
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", (schema12) => {
|
|
145218
|
+
const { minItems } = schema12;
|
|
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", (schema12) => {
|
|
145224
|
+
const typeOfDeprecated = typeof schema12.deprecated;
|
|
145225
145225
|
return typeOfDeprecated === "boolean" || typeOfDeprecated === "undefined";
|
|
145226
145226
|
});
|
|
145227
|
-
function validate2(
|
|
145227
|
+
function validate2(schema12, filename) {
|
|
145228
145228
|
const errors5 = [];
|
|
145229
145229
|
rules.forEach((rule, ruleName) => {
|
|
145230
|
-
(0, utils_1.traverse)(
|
|
145231
|
-
if (rule(
|
|
145230
|
+
(0, utils_1.traverse)(schema12, (schema13, key2) => {
|
|
145231
|
+
if (rule(schema13) === false) {
|
|
145232
145232
|
errors5.push(`Error at key "${key2}" in file "${filename}": ${ruleName}`);
|
|
145233
145233
|
}
|
|
145234
|
-
return
|
|
145234
|
+
return schema13;
|
|
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(schema12, parent = null) {
|
|
145249
|
+
if (!Array.isArray(schema12) && !(0, lodash_1.isPlainObject)(schema12)) {
|
|
145250
|
+
return schema12;
|
|
145251
145251
|
}
|
|
145252
|
-
if (
|
|
145253
|
-
return
|
|
145252
|
+
if (schema12.hasOwnProperty(JSONSchema_1.Parent)) {
|
|
145253
|
+
return schema12;
|
|
145254
145254
|
}
|
|
145255
|
-
Object.defineProperty(
|
|
145255
|
+
Object.defineProperty(schema12, 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(schema12)) {
|
|
145261
|
+
schema12.forEach((child) => link2(child, schema12));
|
|
145262
145262
|
}
|
|
145263
|
-
for (const key2 in
|
|
145264
|
-
link2(
|
|
145263
|
+
for (const key2 in schema12) {
|
|
145264
|
+
link2(schema12[key2], schema12);
|
|
145265
145265
|
}
|
|
145266
|
-
return
|
|
145266
|
+
return schema12;
|
|
145267
145267
|
}
|
|
145268
145268
|
exports.link = link2;
|
|
145269
145269
|
});
|
|
@@ -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 schema12 = parseAsJSONSchema(filename);
|
|
145359
|
+
return compile(schema12, (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* (schema12, 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)(schema12);
|
|
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)) {
|
|
@@ -146286,7 +146286,7 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
146286
146286
|
* Copyright(c) 2014-2018 Douglas Christopher Wilson
|
|
146287
146287
|
* MIT Licensed
|
|
146288
146288
|
*/
|
|
146289
|
-
var
|
|
146289
|
+
var relative6 = __require("path").relative;
|
|
146290
146290
|
module.exports = depd;
|
|
146291
146291
|
var basePath = process.cwd();
|
|
146292
146292
|
function containsNamespace(str, namespace) {
|
|
@@ -146482,7 +146482,7 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
146482
146482
|
return formatted;
|
|
146483
146483
|
}
|
|
146484
146484
|
function formatLocation(callSite) {
|
|
146485
|
-
return
|
|
146485
|
+
return relative6(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
|
|
146486
146486
|
}
|
|
146487
146487
|
function getStack() {
|
|
146488
146488
|
var limit = Error.stackTraceLimit;
|
|
@@ -161113,11 +161113,11 @@ var require_json4 = __commonJS((exports, module) => {
|
|
|
161113
161113
|
var debug = require_src4()("body-parser:json");
|
|
161114
161114
|
var read3 = require_read();
|
|
161115
161115
|
var { normalizeOptions: normalizeOptions5 } = require_utils8();
|
|
161116
|
-
module.exports =
|
|
161116
|
+
module.exports = json3;
|
|
161117
161117
|
var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/;
|
|
161118
161118
|
var JSON_SYNTAX_CHAR = "#";
|
|
161119
161119
|
var JSON_SYNTAX_REGEXP = /#+/g;
|
|
161120
|
-
function
|
|
161120
|
+
function json3(options8) {
|
|
161121
161121
|
const normalizedOptions = normalizeOptions5(options8, "application/json");
|
|
161122
161122
|
var reviver = options8?.reviver;
|
|
161123
161123
|
var strict = options8?.strict !== false;
|
|
@@ -163944,10 +163944,10 @@ var require_view = __commonJS((exports, module) => {
|
|
|
163944
163944
|
var debug = require_src4()("express:view");
|
|
163945
163945
|
var path18 = __require("node:path");
|
|
163946
163946
|
var fs28 = __require("node:fs");
|
|
163947
|
-
var
|
|
163948
|
-
var
|
|
163947
|
+
var dirname22 = path18.dirname;
|
|
163948
|
+
var basename7 = path18.basename;
|
|
163949
163949
|
var extname2 = path18.extname;
|
|
163950
|
-
var
|
|
163950
|
+
var join28 = path18.join;
|
|
163951
163951
|
var resolve13 = path18.resolve;
|
|
163952
163952
|
module.exports = View;
|
|
163953
163953
|
function View(name2, options8) {
|
|
@@ -163983,8 +163983,8 @@ var require_view = __commonJS((exports, module) => {
|
|
|
163983
163983
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
163984
163984
|
var root2 = roots[i5];
|
|
163985
163985
|
var loc = resolve13(root2, name2);
|
|
163986
|
-
var dir =
|
|
163987
|
-
var file2 =
|
|
163986
|
+
var dir = dirname22(loc);
|
|
163987
|
+
var file2 = basename7(loc);
|
|
163988
163988
|
path19 = this.resolve(dir, file2);
|
|
163989
163989
|
}
|
|
163990
163990
|
return path19;
|
|
@@ -164009,12 +164009,12 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164009
164009
|
};
|
|
164010
164010
|
View.prototype.resolve = function resolve14(dir, file2) {
|
|
164011
164011
|
var ext = this.ext;
|
|
164012
|
-
var path19 =
|
|
164012
|
+
var path19 = join28(dir, file2);
|
|
164013
164013
|
var stat2 = tryStat(path19);
|
|
164014
164014
|
if (stat2 && stat2.isFile()) {
|
|
164015
164015
|
return path19;
|
|
164016
164016
|
}
|
|
164017
|
-
path19 =
|
|
164017
|
+
path19 = join28(dir, basename7(file2, ext), "index" + ext);
|
|
164018
164018
|
stat2 = tryStat(path19);
|
|
164019
164019
|
if (stat2 && stat2.isFile()) {
|
|
164020
164020
|
return path19;
|
|
@@ -167335,7 +167335,7 @@ var require_content_disposition = __commonJS((exports, module) => {
|
|
|
167335
167335
|
*/
|
|
167336
167336
|
module.exports = contentDisposition;
|
|
167337
167337
|
module.exports.parse = parse11;
|
|
167338
|
-
var
|
|
167338
|
+
var basename7 = __require("path").basename;
|
|
167339
167339
|
var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g;
|
|
167340
167340
|
var HEX_ESCAPE_REGEXP = /%[0-9A-Fa-f]{2}/;
|
|
167341
167341
|
var HEX_ESCAPE_REPLACE_REGEXP = /%([0-9A-Fa-f]{2})/g;
|
|
@@ -167370,9 +167370,9 @@ var require_content_disposition = __commonJS((exports, module) => {
|
|
|
167370
167370
|
if (typeof fallback === "string" && NON_LATIN1_REGEXP.test(fallback)) {
|
|
167371
167371
|
throw new TypeError("fallback must be ISO-8859-1 string");
|
|
167372
167372
|
}
|
|
167373
|
-
var name2 =
|
|
167373
|
+
var name2 = basename7(filename);
|
|
167374
167374
|
var isQuotedString = TEXT_REGEXP.test(name2);
|
|
167375
|
-
var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name2) :
|
|
167375
|
+
var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name2) : basename7(fallback);
|
|
167376
167376
|
var hasFallback = typeof fallbackName === "string" && fallbackName !== name2;
|
|
167377
167377
|
if (hasFallback || !isQuotedString || HEX_ESCAPE_REGEXP.test(name2)) {
|
|
167378
167378
|
params["filename*"] = name2;
|
|
@@ -167709,7 +167709,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167709
167709
|
var Stream2 = __require("stream");
|
|
167710
167710
|
var util2 = __require("util");
|
|
167711
167711
|
var extname2 = path18.extname;
|
|
167712
|
-
var
|
|
167712
|
+
var join28 = path18.join;
|
|
167713
167713
|
var normalize2 = path18.normalize;
|
|
167714
167714
|
var resolve13 = path18.resolve;
|
|
167715
167715
|
var sep = path18.sep;
|
|
@@ -167881,7 +167881,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167881
167881
|
return res;
|
|
167882
167882
|
}
|
|
167883
167883
|
parts = path19.split(sep);
|
|
167884
|
-
path19 = normalize2(
|
|
167884
|
+
path19 = normalize2(join28(root2, path19));
|
|
167885
167885
|
} else {
|
|
167886
167886
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
167887
167887
|
debug('malicious path "%s"', path19);
|
|
@@ -168021,7 +168021,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168021
168021
|
return self2.onStatError(err);
|
|
168022
168022
|
return self2.error(404);
|
|
168023
168023
|
}
|
|
168024
|
-
var p4 =
|
|
168024
|
+
var p4 = join28(path19, self2._index[i5]);
|
|
168025
168025
|
debug('stat "%s"', p4);
|
|
168026
168026
|
fs28.stat(p4, function(err2, stat2) {
|
|
168027
168027
|
if (err2)
|
|
@@ -168320,7 +168320,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168320
168320
|
}
|
|
168321
168321
|
return this;
|
|
168322
168322
|
};
|
|
168323
|
-
res.json = function
|
|
168323
|
+
res.json = function json3(obj) {
|
|
168324
168324
|
var app = this.app;
|
|
168325
168325
|
var escape3 = app.get("json escape");
|
|
168326
168326
|
var replacer = app.get("json replacer");
|
|
@@ -168656,9 +168656,9 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168656
168656
|
file2.pipe(res2);
|
|
168657
168657
|
}
|
|
168658
168658
|
function stringify(value, replacer, spaces, escape3) {
|
|
168659
|
-
var
|
|
168660
|
-
if (escape3 && typeof
|
|
168661
|
-
|
|
168659
|
+
var json3 = replacer || spaces ? JSON.stringify(value, replacer, spaces) : JSON.stringify(value);
|
|
168660
|
+
if (escape3 && typeof json3 === "string") {
|
|
168661
|
+
json3 = json3.replace(/[<>&]/g, function(c8) {
|
|
168662
168662
|
switch (c8.charCodeAt(0)) {
|
|
168663
168663
|
case 60:
|
|
168664
168664
|
return "\\u003c";
|
|
@@ -168671,7 +168671,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168671
168671
|
}
|
|
168672
168672
|
});
|
|
168673
168673
|
}
|
|
168674
|
-
return
|
|
168674
|
+
return json3;
|
|
168675
168675
|
}
|
|
168676
168676
|
});
|
|
168677
168677
|
|
|
@@ -169119,18 +169119,18 @@ var require_common7 = __commonJS((exports) => {
|
|
|
169119
169119
|
retSegs.push.apply(retSegs, lastSegs);
|
|
169120
169120
|
return retSegs.join("?");
|
|
169121
169121
|
};
|
|
169122
|
-
common2.rewriteCookieProperty = function rewriteCookieProperty(header2,
|
|
169122
|
+
common2.rewriteCookieProperty = function rewriteCookieProperty(header2, config13, property) {
|
|
169123
169123
|
if (Array.isArray(header2)) {
|
|
169124
169124
|
return header2.map(function(headerElement) {
|
|
169125
|
-
return rewriteCookieProperty(headerElement,
|
|
169125
|
+
return rewriteCookieProperty(headerElement, config13, property);
|
|
169126
169126
|
});
|
|
169127
169127
|
}
|
|
169128
169128
|
return header2.replace(new RegExp("(;\\s*" + property + "=)([^;]+)", "i"), function(match, prefix, previousValue) {
|
|
169129
169129
|
var newValue;
|
|
169130
|
-
if (previousValue in
|
|
169131
|
-
newValue =
|
|
169132
|
-
} else if ("*" in
|
|
169133
|
-
newValue =
|
|
169130
|
+
if (previousValue in config13) {
|
|
169131
|
+
newValue = config13[previousValue];
|
|
169132
|
+
} else if ("*" in config13) {
|
|
169133
|
+
newValue = config13["*"];
|
|
169134
169134
|
} else {
|
|
169135
169135
|
return match;
|
|
169136
169136
|
}
|
|
@@ -169630,8 +169630,8 @@ var require_follow_redirects = __commonJS((exports, module) => {
|
|
|
169630
169630
|
}
|
|
169631
169631
|
return parsed;
|
|
169632
169632
|
}
|
|
169633
|
-
function resolveUrl(
|
|
169634
|
-
return useNativeURL ? new URL2(
|
|
169633
|
+
function resolveUrl(relative6, base) {
|
|
169634
|
+
return useNativeURL ? new URL2(relative6, base) : parseUrl(url3.resolve(base, relative6));
|
|
169635
169635
|
}
|
|
169636
169636
|
function validateUrl(input) {
|
|
169637
169637
|
if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
|
|
@@ -170495,9 +170495,9 @@ var require_router2 = __commonJS((exports) => {
|
|
|
170495
170495
|
var is_plain_object_1 = require_is_plain_object();
|
|
170496
170496
|
var debug_1 = require_debug4();
|
|
170497
170497
|
var debug = debug_1.Debug.extend("router");
|
|
170498
|
-
async function getTarget(req,
|
|
170498
|
+
async function getTarget(req, config13) {
|
|
170499
170499
|
let newTarget;
|
|
170500
|
-
const router =
|
|
170500
|
+
const router = config13.router;
|
|
170501
170501
|
if ((0, is_plain_object_1.isPlainObject)(router)) {
|
|
170502
170502
|
newTarget = getTargetFromProxyTable(req, router);
|
|
170503
170503
|
} else if (typeof router === "function") {
|
|
@@ -171269,8 +171269,8 @@ var require_tmp = __commonJS((exports, module) => {
|
|
|
171269
171269
|
const name2 = options8.name;
|
|
171270
171270
|
if (path18.isAbsolute(name2))
|
|
171271
171271
|
throw new Error(`name option must not contain an absolute path, found "${name2}".`);
|
|
171272
|
-
const
|
|
171273
|
-
if (
|
|
171272
|
+
const basename7 = path18.basename(name2);
|
|
171273
|
+
if (basename7 === ".." || basename7 === "." || basename7 !== name2)
|
|
171274
171274
|
throw new Error(`name option must not contain a path, found "${name2}".`);
|
|
171275
171275
|
}
|
|
171276
171276
|
if (!_isUndefined(options8.template) && !options8.template.match(TEMPLATE_PATTERN)) {
|
|
@@ -210550,7 +210550,7 @@ var require_utils12 = __commonJS((exports, module) => {
|
|
|
210550
210550
|
if (decode4)
|
|
210551
210551
|
return decode4(data, hint);
|
|
210552
210552
|
}
|
|
210553
|
-
function
|
|
210553
|
+
function basename7(path18) {
|
|
210554
210554
|
if (typeof path18 !== "string")
|
|
210555
210555
|
return "";
|
|
210556
210556
|
for (let i5 = path18.length - 1;i5 >= 0; --i5) {
|
|
@@ -211854,7 +211854,7 @@ var require_utils12 = __commonJS((exports, module) => {
|
|
|
211854
211854
|
-1
|
|
211855
211855
|
];
|
|
211856
211856
|
module.exports = {
|
|
211857
|
-
basename:
|
|
211857
|
+
basename: basename7,
|
|
211858
211858
|
convertToUTF8,
|
|
211859
211859
|
getDecoder,
|
|
211860
211860
|
parseContentType,
|
|
@@ -212262,7 +212262,7 @@ var require_multipart = __commonJS((exports, module) => {
|
|
|
212262
212262
|
var { Readable: Readable6, Writable: Writable4 } = __require("stream");
|
|
212263
212263
|
var StreamSearch = require_sbmh();
|
|
212264
212264
|
var {
|
|
212265
|
-
basename:
|
|
212265
|
+
basename: basename7,
|
|
212266
212266
|
convertToUTF8,
|
|
212267
212267
|
getDecoder,
|
|
212268
212268
|
parseContentType,
|
|
@@ -212524,7 +212524,7 @@ var require_multipart = __commonJS((exports, module) => {
|
|
|
212524
212524
|
else if (disp.params.filename)
|
|
212525
212525
|
filename = disp.params.filename;
|
|
212526
212526
|
if (filename !== undefined && !preservePath)
|
|
212527
|
-
filename =
|
|
212527
|
+
filename = basename7(filename);
|
|
212528
212528
|
}
|
|
212529
212529
|
if (header2["content-type"]) {
|
|
212530
212530
|
const conType = parseContentType(header2["content-type"][0]);
|
|
@@ -214616,7 +214616,7 @@ var require_buffer_list = __commonJS((exports, module) => {
|
|
|
214616
214616
|
}
|
|
214617
214617
|
}, {
|
|
214618
214618
|
key: "join",
|
|
214619
|
-
value: function
|
|
214619
|
+
value: function join28(s5) {
|
|
214620
214620
|
if (this.length === 0)
|
|
214621
214621
|
return "";
|
|
214622
214622
|
var p4 = this.head;
|
|
@@ -218287,6 +218287,7 @@ var PROJECT_CONFIG_PATTERNS = [
|
|
|
218287
218287
|
`config.${CONFIG_FILE_EXTENSION_GLOB}`
|
|
218288
218288
|
];
|
|
218289
218289
|
var BASE44_APP_ID_ENV_VAR = "BASE44_APP_ID";
|
|
218290
|
+
var DEFAULT_DEV_SERVER_PORT = 4400;
|
|
218290
218291
|
var TYPES_OUTPUT_SUBDIR = ".types";
|
|
218291
218292
|
var TYPES_FILENAME = "types.d.ts";
|
|
218292
218293
|
var AUTH_CLIENT_ID = "base44_cli";
|
|
@@ -234032,7 +234033,7 @@ function normalizeBase44Env() {
|
|
|
234032
234033
|
loadProjectEnvFiles();
|
|
234033
234034
|
|
|
234034
234035
|
// src/cli/index.ts
|
|
234035
|
-
import { dirname as
|
|
234036
|
+
import { dirname as dirname26, join as join31 } from "node:path";
|
|
234036
234037
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
234037
234038
|
|
|
234038
234039
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -235239,8 +235240,15 @@ var {
|
|
|
235239
235240
|
Help
|
|
235240
235241
|
} = import__.default;
|
|
235241
235242
|
|
|
235242
|
-
// src/cli/
|
|
235243
|
-
|
|
235243
|
+
// src/cli/errors.ts
|
|
235244
|
+
class CLIExitError extends Error {
|
|
235245
|
+
code;
|
|
235246
|
+
constructor(code) {
|
|
235247
|
+
super(`CLI exited with code ${code}`);
|
|
235248
|
+
this.code = code;
|
|
235249
|
+
this.name = "CLIExitError";
|
|
235250
|
+
}
|
|
235251
|
+
}
|
|
235244
235252
|
// ../../node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
235245
235253
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
235246
235254
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
@@ -236054,6 +236062,7 @@ var ProjectConfigSchema = exports_external.object({
|
|
|
236054
236062
|
site: SiteConfigSchema.optional(),
|
|
236055
236063
|
entitiesDir: exports_external.string().optional().default("entities"),
|
|
236056
236064
|
functionsDir: exports_external.string().optional().default("functions"),
|
|
236065
|
+
actorsDir: exports_external.string().optional().default("actors"),
|
|
236057
236066
|
agentsDir: exports_external.string().optional().default("agents"),
|
|
236058
236067
|
connectorsDir: exports_external.string().optional().default("connectors"),
|
|
236059
236068
|
authDir: exports_external.string().optional().default("auth"),
|
|
@@ -241964,7 +241973,7 @@ async function getSiteUrl() {
|
|
|
241964
241973
|
return result.data.url;
|
|
241965
241974
|
}
|
|
241966
241975
|
// src/core/project/config.ts
|
|
241967
|
-
import { dirname as
|
|
241976
|
+
import { dirname as dirname10, join as join11 } from "node:path";
|
|
241968
241977
|
|
|
241969
241978
|
// src/core/project/plugins.ts
|
|
241970
241979
|
import { createRequire as createRequire2 } from "node:module";
|
|
@@ -242002,6 +242011,165 @@ function markPluginEntities(entities, pluginNamespace) {
|
|
|
242002
242011
|
}));
|
|
242003
242012
|
}
|
|
242004
242013
|
|
|
242014
|
+
// src/core/resources/types.ts
|
|
242015
|
+
var ResourceSourceSchema = exports_external.discriminatedUnion("type", [
|
|
242016
|
+
exports_external.object({
|
|
242017
|
+
type: exports_external.literal("project")
|
|
242018
|
+
}),
|
|
242019
|
+
exports_external.object({
|
|
242020
|
+
type: exports_external.literal("plugin"),
|
|
242021
|
+
namespace: exports_external.string().min(1, "Plugin namespace cannot be empty")
|
|
242022
|
+
})
|
|
242023
|
+
]);
|
|
242024
|
+
|
|
242025
|
+
// src/core/resources/actor/schema.ts
|
|
242026
|
+
var ActorConfigSchema = exports_external.object({
|
|
242027
|
+
name: exports_external.string().min(1),
|
|
242028
|
+
entry: exports_external.string().min(1)
|
|
242029
|
+
});
|
|
242030
|
+
var ActorSchemaFileSchema = exports_external.object({
|
|
242031
|
+
types: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
|
|
242032
|
+
toClient: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
|
|
242033
|
+
toServer: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
|
|
242034
|
+
});
|
|
242035
|
+
var DeployActorResponseSchema = exports_external.object({
|
|
242036
|
+
status: exports_external.enum(["deployed", "unchanged"]),
|
|
242037
|
+
handler_name: exports_external.string().optional()
|
|
242038
|
+
});
|
|
242039
|
+
var ActorSchema = ActorConfigSchema.extend({
|
|
242040
|
+
entryPath: exports_external.string().min(1),
|
|
242041
|
+
filePaths: exports_external.array(exports_external.string()).min(1),
|
|
242042
|
+
source: ResourceSourceSchema,
|
|
242043
|
+
messageSchema: exports_external.unknown().optional()
|
|
242044
|
+
});
|
|
242045
|
+
|
|
242046
|
+
// src/core/resources/actor/api.ts
|
|
242047
|
+
async function deploySingleActor(name2, payload) {
|
|
242048
|
+
const appClient = getAppClient();
|
|
242049
|
+
let response;
|
|
242050
|
+
try {
|
|
242051
|
+
response = await appClient.put(`actors/${encodeURIComponent(name2)}`, {
|
|
242052
|
+
json: payload,
|
|
242053
|
+
timeout: false
|
|
242054
|
+
});
|
|
242055
|
+
} catch (error48) {
|
|
242056
|
+
throw await ApiError.fromHttpError(error48, `deploying actor "${name2}"`);
|
|
242057
|
+
}
|
|
242058
|
+
const result = DeployActorResponseSchema.safeParse(await response.json());
|
|
242059
|
+
if (!result.success) {
|
|
242060
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
242061
|
+
}
|
|
242062
|
+
return result.data;
|
|
242063
|
+
}
|
|
242064
|
+
// src/core/resources/actor/config.ts
|
|
242065
|
+
import { basename as basename3, dirname as dirname6, join as join5, relative } from "node:path";
|
|
242066
|
+
async function readActor(entryFile, actorsDir) {
|
|
242067
|
+
const actorDir = dirname6(entryFile);
|
|
242068
|
+
const filePaths = await globby("**/*.ts", {
|
|
242069
|
+
cwd: actorDir,
|
|
242070
|
+
absolute: true
|
|
242071
|
+
});
|
|
242072
|
+
const name2 = relative(actorsDir, actorDir).split(/[/\\]/).join("/");
|
|
242073
|
+
if (!name2) {
|
|
242074
|
+
throw new InvalidInputError("entry.ts found directly in the actors directory — it must be inside a named subfolder", {
|
|
242075
|
+
hints: [
|
|
242076
|
+
{
|
|
242077
|
+
message: `Move ${entryFile} into a subfolder (e.g. actors/MyActor/entry.ts)`
|
|
242078
|
+
}
|
|
242079
|
+
]
|
|
242080
|
+
});
|
|
242081
|
+
}
|
|
242082
|
+
const entry = basename3(entryFile);
|
|
242083
|
+
const schemaPath = join5(actorDir, "schema.jsonc");
|
|
242084
|
+
let messageSchema;
|
|
242085
|
+
if (await pathExists(schemaPath)) {
|
|
242086
|
+
const parsed = await readJsonFile(schemaPath);
|
|
242087
|
+
const result = ActorSchemaFileSchema.safeParse(parsed);
|
|
242088
|
+
if (result.success) {
|
|
242089
|
+
messageSchema = {
|
|
242090
|
+
types: result.data.types,
|
|
242091
|
+
toClient: result.data.toClient,
|
|
242092
|
+
toServer: result.data.toServer
|
|
242093
|
+
};
|
|
242094
|
+
}
|
|
242095
|
+
}
|
|
242096
|
+
return {
|
|
242097
|
+
name: name2,
|
|
242098
|
+
entry,
|
|
242099
|
+
entryPath: entryFile,
|
|
242100
|
+
filePaths,
|
|
242101
|
+
source: { type: "project" },
|
|
242102
|
+
messageSchema
|
|
242103
|
+
};
|
|
242104
|
+
}
|
|
242105
|
+
async function readAllActors(actorsDir) {
|
|
242106
|
+
if (!await pathExists(actorsDir)) {
|
|
242107
|
+
return [];
|
|
242108
|
+
}
|
|
242109
|
+
const entryFiles = await globby(ENTRY_FILE_GLOB, {
|
|
242110
|
+
cwd: actorsDir,
|
|
242111
|
+
absolute: true,
|
|
242112
|
+
ignore: ENTRY_IGNORE_DOT_PATHS
|
|
242113
|
+
});
|
|
242114
|
+
const actors = await Promise.all(entryFiles.map((entryFile) => readActor(entryFile, actorsDir)));
|
|
242115
|
+
const names = new Set;
|
|
242116
|
+
for (const actor of actors) {
|
|
242117
|
+
if (names.has(actor.name)) {
|
|
242118
|
+
throw new InvalidInputError(`Duplicate actor name "${actor.name}" in ${actorsDir}`);
|
|
242119
|
+
}
|
|
242120
|
+
names.add(actor.name);
|
|
242121
|
+
}
|
|
242122
|
+
return actors;
|
|
242123
|
+
}
|
|
242124
|
+
// src/core/resources/actor/deploy.ts
|
|
242125
|
+
import { dirname as dirname7, relative as relative2 } from "node:path";
|
|
242126
|
+
async function loadActorCode(actor) {
|
|
242127
|
+
const actorDir = dirname7(actor.entryPath);
|
|
242128
|
+
const resolvedFiles = await Promise.all(actor.filePaths.map(async (filePath) => {
|
|
242129
|
+
const content = await readTextFile(filePath);
|
|
242130
|
+
const path11 = relative2(actorDir, filePath).split(/[/\\]/).join("/");
|
|
242131
|
+
return { path: path11, content };
|
|
242132
|
+
}));
|
|
242133
|
+
return { name: actor.name, entry: actor.entry, files: resolvedFiles };
|
|
242134
|
+
}
|
|
242135
|
+
async function deployOne(actor) {
|
|
242136
|
+
const start = Date.now();
|
|
242137
|
+
try {
|
|
242138
|
+
const loaded = await loadActorCode(actor);
|
|
242139
|
+
const response = await deploySingleActor(loaded.name, {
|
|
242140
|
+
entry: loaded.entry,
|
|
242141
|
+
files: loaded.files
|
|
242142
|
+
});
|
|
242143
|
+
return {
|
|
242144
|
+
name: loaded.name,
|
|
242145
|
+
status: response.status,
|
|
242146
|
+
durationMs: Date.now() - start
|
|
242147
|
+
};
|
|
242148
|
+
} catch (error48) {
|
|
242149
|
+
return {
|
|
242150
|
+
name: actor.name,
|
|
242151
|
+
status: "error",
|
|
242152
|
+
error: error48 instanceof Error ? error48.message : String(error48)
|
|
242153
|
+
};
|
|
242154
|
+
}
|
|
242155
|
+
}
|
|
242156
|
+
async function deployActorsSequentially(actors, options) {
|
|
242157
|
+
if (actors.length === 0)
|
|
242158
|
+
return [];
|
|
242159
|
+
const results = [];
|
|
242160
|
+
for (const actor of actors) {
|
|
242161
|
+
options?.onStart?.([actor.name]);
|
|
242162
|
+
const result = await deployOne(actor);
|
|
242163
|
+
results.push(result);
|
|
242164
|
+
options?.onResult?.(result);
|
|
242165
|
+
}
|
|
242166
|
+
return results;
|
|
242167
|
+
}
|
|
242168
|
+
// src/core/resources/actor/resource.ts
|
|
242169
|
+
var actorResource = {
|
|
242170
|
+
readAll: readAllActors,
|
|
242171
|
+
push: (actors) => deployActorsSequentially(actors)
|
|
242172
|
+
};
|
|
242005
242173
|
// src/core/resources/agent/schema.ts
|
|
242006
242174
|
var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
|
|
242007
242175
|
var EntityToolConfigSchema = exports_external.object({
|
|
@@ -242079,7 +242247,7 @@ async function fetchAgents() {
|
|
|
242079
242247
|
return result.data;
|
|
242080
242248
|
}
|
|
242081
242249
|
// src/core/resources/agent/config.ts
|
|
242082
|
-
import { join as
|
|
242250
|
+
import { join as join6, normalize } from "node:path";
|
|
242083
242251
|
import { isDeepStrictEqual } from "node:util";
|
|
242084
242252
|
async function readAgentFile(agentPath) {
|
|
242085
242253
|
const raw2 = await readJsonFile(agentPath);
|
|
@@ -242124,12 +242292,12 @@ async function readAllAgents(agentsDir) {
|
|
|
242124
242292
|
return [...nameToEntry.values()].map((e2) => e2.data);
|
|
242125
242293
|
}
|
|
242126
242294
|
function findAvailablePath(agentsDir, name2, claimedPaths) {
|
|
242127
|
-
const base =
|
|
242295
|
+
const base = join6(agentsDir, `${name2}.${CONFIG_FILE_EXTENSION}`);
|
|
242128
242296
|
if (!claimedPaths.has(base)) {
|
|
242129
242297
|
return base;
|
|
242130
242298
|
}
|
|
242131
242299
|
for (let i = 1;; i++) {
|
|
242132
|
-
const candidate =
|
|
242300
|
+
const candidate = join6(agentsDir, `${name2}_${i}.${CONFIG_FILE_EXTENSION}`);
|
|
242133
242301
|
if (!claimedPaths.has(candidate)) {
|
|
242134
242302
|
return candidate;
|
|
242135
242303
|
}
|
|
@@ -242212,8 +242380,8 @@ var AppAuthConfigResponseSchema = exports_external.object({
|
|
|
242212
242380
|
}).transform((data) => ({
|
|
242213
242381
|
authConfig: data.auth_config
|
|
242214
242382
|
}));
|
|
242215
|
-
function hasAnyLoginMethod(
|
|
242216
|
-
return
|
|
242383
|
+
function hasAnyLoginMethod(config5) {
|
|
242384
|
+
return config5.enableUsernamePassword || config5.enableGoogleLogin || config5.enableMicrosoftLogin || config5.enableFacebookLogin || config5.enableAppleLogin || config5.enableSSOLogin;
|
|
242217
242385
|
}
|
|
242218
242386
|
var SOCIAL_PROVIDERS = {
|
|
242219
242387
|
google: {
|
|
@@ -242228,18 +242396,18 @@ var SOCIAL_PROVIDERS = {
|
|
|
242228
242396
|
facebook: { field: "enableFacebookLogin" },
|
|
242229
242397
|
apple: { field: "enableAppleLogin" }
|
|
242230
242398
|
};
|
|
242231
|
-
function toAuthConfigPayload(
|
|
242399
|
+
function toAuthConfigPayload(config5) {
|
|
242232
242400
|
return {
|
|
242233
|
-
enable_username_password:
|
|
242234
|
-
enable_google_login:
|
|
242235
|
-
enable_microsoft_login:
|
|
242236
|
-
enable_facebook_login:
|
|
242237
|
-
enable_apple_login:
|
|
242238
|
-
sso_provider_name:
|
|
242239
|
-
enable_sso_login:
|
|
242240
|
-
google_oauth_mode:
|
|
242241
|
-
google_oauth_client_id:
|
|
242242
|
-
use_workspace_sso:
|
|
242401
|
+
enable_username_password: config5.enableUsernamePassword,
|
|
242402
|
+
enable_google_login: config5.enableGoogleLogin,
|
|
242403
|
+
enable_microsoft_login: config5.enableMicrosoftLogin,
|
|
242404
|
+
enable_facebook_login: config5.enableFacebookLogin,
|
|
242405
|
+
enable_apple_login: config5.enableAppleLogin,
|
|
242406
|
+
sso_provider_name: config5.ssoProviderName,
|
|
242407
|
+
enable_sso_login: config5.enableSSOLogin,
|
|
242408
|
+
google_oauth_mode: config5.googleOAuthMode,
|
|
242409
|
+
google_oauth_client_id: config5.googleOAuthClientId,
|
|
242410
|
+
use_workspace_sso: config5.useWorkspaceSSO
|
|
242243
242411
|
};
|
|
242244
242412
|
}
|
|
242245
242413
|
|
|
@@ -242258,9 +242426,9 @@ async function getAuthConfig() {
|
|
|
242258
242426
|
}
|
|
242259
242427
|
return result.data.authConfig;
|
|
242260
242428
|
}
|
|
242261
|
-
async function pushAuthConfigToApi(
|
|
242429
|
+
async function pushAuthConfigToApi(config5) {
|
|
242262
242430
|
const { id } = getAppContext();
|
|
242263
|
-
const payload = toAuthConfigPayload(
|
|
242431
|
+
const payload = toAuthConfigPayload(config5);
|
|
242264
242432
|
if (hasWorkspaceApiKeyAuth()) {
|
|
242265
242433
|
try {
|
|
242266
242434
|
await base44Client.put(`api/apps/${id}/deployment/auth-configuration`, {
|
|
@@ -242269,7 +242437,7 @@ async function pushAuthConfigToApi(config4) {
|
|
|
242269
242437
|
} catch (error48) {
|
|
242270
242438
|
throw await ApiError.fromHttpError(error48, "updating auth config");
|
|
242271
242439
|
}
|
|
242272
|
-
return
|
|
242440
|
+
return config5;
|
|
242273
242441
|
}
|
|
242274
242442
|
let response;
|
|
242275
242443
|
try {
|
|
@@ -242286,7 +242454,7 @@ async function pushAuthConfigToApi(config4) {
|
|
|
242286
242454
|
return result.data.authConfig;
|
|
242287
242455
|
}
|
|
242288
242456
|
// src/core/resources/auth-config/config.ts
|
|
242289
|
-
import { join as
|
|
242457
|
+
import { join as join7 } from "node:path";
|
|
242290
242458
|
import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
|
|
242291
242459
|
var AUTH_CONFIG_FILENAME = `config.${CONFIG_FILE_EXTENSION}`;
|
|
242292
242460
|
var DEFAULT_AUTH_CONFIG = {
|
|
@@ -242302,7 +242470,7 @@ var DEFAULT_AUTH_CONFIG = {
|
|
|
242302
242470
|
useWorkspaceSSO: false
|
|
242303
242471
|
};
|
|
242304
242472
|
function getAuthConfigPath(authDir) {
|
|
242305
|
-
return
|
|
242473
|
+
return join7(authDir, AUTH_CONFIG_FILENAME);
|
|
242306
242474
|
}
|
|
242307
242475
|
async function readAuthConfig(authDir) {
|
|
242308
242476
|
const filePath = getAuthConfigPath(authDir);
|
|
@@ -242316,16 +242484,16 @@ async function readAuthConfig(authDir) {
|
|
|
242316
242484
|
}
|
|
242317
242485
|
return result.data;
|
|
242318
242486
|
}
|
|
242319
|
-
async function writeAuthConfig(authDir,
|
|
242487
|
+
async function writeAuthConfig(authDir, config5) {
|
|
242320
242488
|
const filePath = getAuthConfigPath(authDir);
|
|
242321
242489
|
if (await pathExists(filePath)) {
|
|
242322
242490
|
const existing = await readJsonFile(filePath);
|
|
242323
242491
|
const existingResult = AuthConfigFileSchema.safeParse(existing);
|
|
242324
|
-
if (existingResult.success && isDeepStrictEqual2(existingResult.data,
|
|
242492
|
+
if (existingResult.success && isDeepStrictEqual2(existingResult.data, config5)) {
|
|
242325
242493
|
return { written: false };
|
|
242326
242494
|
}
|
|
242327
242495
|
}
|
|
242328
|
-
await writeJsonFile(filePath,
|
|
242496
|
+
await writeJsonFile(filePath, config5);
|
|
242329
242497
|
return { written: true };
|
|
242330
242498
|
}
|
|
242331
242499
|
// src/core/resources/auth-config/pull.ts
|
|
@@ -242333,17 +242501,17 @@ async function pullAuthConfig() {
|
|
|
242333
242501
|
return await getAuthConfig();
|
|
242334
242502
|
}
|
|
242335
242503
|
// src/core/resources/auth-config/push.ts
|
|
242336
|
-
async function pushAuthConfig(
|
|
242337
|
-
if (!
|
|
242504
|
+
async function pushAuthConfig(config5) {
|
|
242505
|
+
if (!config5) {
|
|
242338
242506
|
return;
|
|
242339
242507
|
}
|
|
242340
|
-
await pushAuthConfigToApi(
|
|
242508
|
+
await pushAuthConfigToApi(config5);
|
|
242341
242509
|
}
|
|
242342
242510
|
// src/core/resources/auth-config/resource.ts
|
|
242343
242511
|
var authConfigResource = {
|
|
242344
242512
|
readAll: async (dir) => {
|
|
242345
|
-
const
|
|
242346
|
-
return
|
|
242513
|
+
const config5 = await readAuthConfig(dir);
|
|
242514
|
+
return config5 ? [config5] : [];
|
|
242347
242515
|
},
|
|
242348
242516
|
push: async (items) => {
|
|
242349
242517
|
await pushAuthConfig(items[0] ?? null);
|
|
@@ -242583,7 +242751,7 @@ class MissingSSOFieldsError extends InvalidInputError {
|
|
|
242583
242751
|
}
|
|
242584
242752
|
}
|
|
242585
242753
|
function buildSSOSecrets(provider, options) {
|
|
242586
|
-
const
|
|
242754
|
+
const schema4 = SSO_PROVIDER_SCHEMAS[provider];
|
|
242587
242755
|
const secrets = {};
|
|
242588
242756
|
secrets["sso_name" /* Name */] = options.ssoName ?? provider;
|
|
242589
242757
|
secrets["sso_client_id" /* ClientId */] = options.clientId;
|
|
@@ -242594,21 +242762,21 @@ function buildSSOSecrets(provider, options) {
|
|
|
242594
242762
|
secrets[secretKey] = value;
|
|
242595
242763
|
}
|
|
242596
242764
|
}
|
|
242597
|
-
if (
|
|
242598
|
-
const derived =
|
|
242765
|
+
if (schema4.deriveDefaults) {
|
|
242766
|
+
const derived = schema4.deriveDefaults(secrets);
|
|
242599
242767
|
for (const [key, val] of Object.entries(derived)) {
|
|
242600
242768
|
if (!secrets[key]) {
|
|
242601
242769
|
secrets[key] = val;
|
|
242602
242770
|
}
|
|
242603
242771
|
}
|
|
242604
242772
|
}
|
|
242605
|
-
for (const [key, val] of Object.entries(
|
|
242773
|
+
for (const [key, val] of Object.entries(schema4.defaults)) {
|
|
242606
242774
|
if (!secrets[key]) {
|
|
242607
242775
|
secrets[key] = val;
|
|
242608
242776
|
}
|
|
242609
242777
|
}
|
|
242610
242778
|
const missing = [];
|
|
242611
|
-
for (const key of
|
|
242779
|
+
for (const key of schema4.requiredKeys) {
|
|
242612
242780
|
if (!secrets[key]) {
|
|
242613
242781
|
missing.push(key);
|
|
242614
242782
|
}
|
|
@@ -242954,7 +243122,7 @@ async function removeStripe() {
|
|
|
242954
243122
|
return result.data;
|
|
242955
243123
|
}
|
|
242956
243124
|
// src/core/resources/connector/config.ts
|
|
242957
|
-
import { join as
|
|
243125
|
+
import { join as join8 } from "node:path";
|
|
242958
243126
|
import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
|
|
242959
243127
|
async function readConnectorFile(connectorPath) {
|
|
242960
243128
|
const parsed = await readJsonFile(connectorPath);
|
|
@@ -243015,7 +243183,7 @@ async function writeConnectors(connectorsDir, remoteConnectors) {
|
|
|
243015
243183
|
if (existing && isDeepStrictEqual3(existing.data, connector)) {
|
|
243016
243184
|
continue;
|
|
243017
243185
|
}
|
|
243018
|
-
const filePath = existing?.filePath ??
|
|
243186
|
+
const filePath = existing?.filePath ?? join8(connectorsDir, `${connector.type}.${CONFIG_FILE_EXTENSION}`);
|
|
243019
243187
|
await writeJsonFile(filePath, connector);
|
|
243020
243188
|
written.push(connector.type);
|
|
243021
243189
|
}
|
|
@@ -243170,17 +243338,6 @@ var connectorResource = {
|
|
|
243170
243338
|
readAll: readAllConnectors,
|
|
243171
243339
|
push: pushConnectors
|
|
243172
243340
|
};
|
|
243173
|
-
// src/core/resources/types.ts
|
|
243174
|
-
var ResourceSourceSchema = exports_external.discriminatedUnion("type", [
|
|
243175
|
-
exports_external.object({
|
|
243176
|
-
type: exports_external.literal("project")
|
|
243177
|
-
}),
|
|
243178
|
-
exports_external.object({
|
|
243179
|
-
type: exports_external.literal("plugin"),
|
|
243180
|
-
namespace: exports_external.string().min(1, "Plugin namespace cannot be empty")
|
|
243181
|
-
})
|
|
243182
|
-
]);
|
|
243183
|
-
|
|
243184
243341
|
// src/core/resources/entity/schema.ts
|
|
243185
243342
|
var FieldConditionSchema = exports_external.union([
|
|
243186
243343
|
exports_external.string(),
|
|
@@ -243617,7 +243774,7 @@ async function fetchFunctionLogs(functionName, filters = {}) {
|
|
|
243617
243774
|
return result.data;
|
|
243618
243775
|
}
|
|
243619
243776
|
// src/core/resources/function/config.ts
|
|
243620
|
-
import { basename as
|
|
243777
|
+
import { basename as basename4, dirname as dirname8, join as join9, relative as relative3, resolve as resolve2 } from "node:path";
|
|
243621
243778
|
async function readSharedFiles(functionsDir) {
|
|
243622
243779
|
const sharedDir = resolve2(functionsDir, "..", "shared");
|
|
243623
243780
|
if (!await pathExists(sharedDir)) {
|
|
@@ -243634,9 +243791,9 @@ async function readFunctionConfig(configPath) {
|
|
|
243634
243791
|
return result.data;
|
|
243635
243792
|
}
|
|
243636
243793
|
async function readFunction(configPath, sharedFiles) {
|
|
243637
|
-
const
|
|
243638
|
-
const functionDir =
|
|
243639
|
-
const entryPath =
|
|
243794
|
+
const config8 = await readFunctionConfig(configPath);
|
|
243795
|
+
const functionDir = dirname8(configPath);
|
|
243796
|
+
const entryPath = join9(functionDir, config8.entry);
|
|
243640
243797
|
if (!await pathExists(entryPath)) {
|
|
243641
243798
|
throw new InvalidInputError(`Function entry file not found: ${entryPath} (referenced in ${configPath})`, {
|
|
243642
243799
|
hints: [{ message: "Check the 'entry' field in your function config" }]
|
|
@@ -243648,7 +243805,7 @@ async function readFunction(configPath, sharedFiles) {
|
|
|
243648
243805
|
});
|
|
243649
243806
|
const allFilePaths = [...new Set([...filePaths, ...sharedFiles])];
|
|
243650
243807
|
const functionData = {
|
|
243651
|
-
...
|
|
243808
|
+
...config8,
|
|
243652
243809
|
entryPath,
|
|
243653
243810
|
filePaths: allFilePaths,
|
|
243654
243811
|
source: { type: "project" }
|
|
@@ -243668,18 +243825,18 @@ async function readAllFunctions(functionsDir) {
|
|
|
243668
243825
|
absolute: true,
|
|
243669
243826
|
ignore: ENTRY_IGNORE_DOT_PATHS
|
|
243670
243827
|
});
|
|
243671
|
-
const configFilesDirs = new Set(configFiles.map((f) =>
|
|
243672
|
-
const entryFilesWithoutConfig = entryFiles.filter((entryFile) => !configFilesDirs.has(
|
|
243828
|
+
const configFilesDirs = new Set(configFiles.map((f) => dirname8(f)));
|
|
243829
|
+
const entryFilesWithoutConfig = entryFiles.filter((entryFile) => !configFilesDirs.has(dirname8(entryFile)));
|
|
243673
243830
|
const sharedFiles = await readSharedFiles(functionsDir);
|
|
243674
243831
|
const functionsFromConfig = await Promise.all(configFiles.map((configPath) => readFunction(configPath, sharedFiles)));
|
|
243675
243832
|
const functionsWithoutConfig = await Promise.all(entryFilesWithoutConfig.map(async (entryFile) => {
|
|
243676
|
-
const functionDir =
|
|
243833
|
+
const functionDir = dirname8(entryFile);
|
|
243677
243834
|
const filePaths = await globby(BACKEND_FILE_GLOB, {
|
|
243678
243835
|
cwd: functionDir,
|
|
243679
243836
|
absolute: true
|
|
243680
243837
|
});
|
|
243681
243838
|
const allFilePaths = [...new Set([...filePaths, ...sharedFiles])];
|
|
243682
|
-
const name2 =
|
|
243839
|
+
const name2 = relative3(functionsDir, functionDir).split(/[/\\]/).join("/");
|
|
243683
243840
|
if (!name2) {
|
|
243684
243841
|
throw new InvalidInputError("entry.ts found directly in the functions directory — it must be inside a named subfolder", {
|
|
243685
243842
|
hints: [
|
|
@@ -243689,7 +243846,7 @@ async function readAllFunctions(functionsDir) {
|
|
|
243689
243846
|
]
|
|
243690
243847
|
});
|
|
243691
243848
|
}
|
|
243692
|
-
const entry =
|
|
243849
|
+
const entry = basename4(entryFile);
|
|
243693
243850
|
const functionData = {
|
|
243694
243851
|
name: name2,
|
|
243695
243852
|
entry,
|
|
@@ -243716,17 +243873,17 @@ async function readAllFunctions(functionsDir) {
|
|
|
243716
243873
|
return functions;
|
|
243717
243874
|
}
|
|
243718
243875
|
// src/core/resources/function/deploy.ts
|
|
243719
|
-
import { dirname as
|
|
243876
|
+
import { dirname as dirname9, relative as relative4 } from "node:path";
|
|
243720
243877
|
async function loadFunctionCode(fn) {
|
|
243721
|
-
const functionDir =
|
|
243878
|
+
const functionDir = dirname9(fn.entryPath);
|
|
243722
243879
|
const resolvedFiles = await Promise.all(fn.filePaths.map(async (filePath) => {
|
|
243723
243880
|
const content = await readTextFile(filePath);
|
|
243724
|
-
const path11 =
|
|
243881
|
+
const path11 = relative4(functionDir, filePath).split(/[/\\]/).join("/");
|
|
243725
243882
|
return { path: path11, content };
|
|
243726
243883
|
}));
|
|
243727
243884
|
return { ...fn, files: resolvedFiles };
|
|
243728
243885
|
}
|
|
243729
|
-
async function
|
|
243886
|
+
async function deployOne2(fn) {
|
|
243730
243887
|
const start = Date.now();
|
|
243731
243888
|
try {
|
|
243732
243889
|
const functionWithCode = await loadFunctionCode(fn);
|
|
@@ -243754,7 +243911,7 @@ async function deployFunctionsSequentially(functions, options) {
|
|
|
243754
243911
|
const results = [];
|
|
243755
243912
|
for (const fn of functions) {
|
|
243756
243913
|
options?.onStart?.([fn.name]);
|
|
243757
|
-
const result = await
|
|
243914
|
+
const result = await deployOne2(fn);
|
|
243758
243915
|
results.push(result);
|
|
243759
243916
|
options?.onResult?.(result);
|
|
243760
243917
|
}
|
|
@@ -243785,28 +243942,28 @@ async function pruneRemovedFunctions(localFunctionNames, options) {
|
|
|
243785
243942
|
return results;
|
|
243786
243943
|
}
|
|
243787
243944
|
// src/core/resources/function/pull.ts
|
|
243788
|
-
import { join as
|
|
243945
|
+
import { join as join10 } from "node:path";
|
|
243789
243946
|
import { isDeepStrictEqual as isDeepStrictEqual4 } from "node:util";
|
|
243790
243947
|
async function writeFunctions(functionsDir, functions) {
|
|
243791
243948
|
const written = [];
|
|
243792
243949
|
const skipped = [];
|
|
243793
243950
|
for (const fn of functions) {
|
|
243794
|
-
const functionDir =
|
|
243795
|
-
const configPath =
|
|
243951
|
+
const functionDir = join10(functionsDir, fn.name);
|
|
243952
|
+
const configPath = join10(functionDir, "function.jsonc");
|
|
243796
243953
|
if (await isFunctionUnchanged(functionDir, fn)) {
|
|
243797
243954
|
skipped.push(fn.name);
|
|
243798
243955
|
continue;
|
|
243799
243956
|
}
|
|
243800
|
-
const
|
|
243957
|
+
const config8 = {
|
|
243801
243958
|
name: fn.name,
|
|
243802
243959
|
entry: fn.entry
|
|
243803
243960
|
};
|
|
243804
243961
|
if (fn.automations.length > 0) {
|
|
243805
|
-
|
|
243962
|
+
config8.automations = fn.automations;
|
|
243806
243963
|
}
|
|
243807
|
-
await writeJsonFile(configPath,
|
|
243964
|
+
await writeJsonFile(configPath, config8);
|
|
243808
243965
|
for (const file2 of fn.files) {
|
|
243809
|
-
await writeFile(
|
|
243966
|
+
await writeFile(join10(functionDir, file2.path), file2.content);
|
|
243810
243967
|
}
|
|
243811
243968
|
written.push(fn.name);
|
|
243812
243969
|
}
|
|
@@ -243816,7 +243973,7 @@ async function isFunctionUnchanged(functionDir, fn) {
|
|
|
243816
243973
|
if (!await pathExists(functionDir)) {
|
|
243817
243974
|
return false;
|
|
243818
243975
|
}
|
|
243819
|
-
const configPath =
|
|
243976
|
+
const configPath = join10(functionDir, "function.jsonc");
|
|
243820
243977
|
try {
|
|
243821
243978
|
const localConfig = await readJsonFile(configPath);
|
|
243822
243979
|
if (localConfig.entry !== fn.entry) {
|
|
@@ -243829,7 +243986,7 @@ async function isFunctionUnchanged(functionDir, fn) {
|
|
|
243829
243986
|
return false;
|
|
243830
243987
|
}
|
|
243831
243988
|
for (const file2 of fn.files) {
|
|
243832
|
-
const filePath =
|
|
243989
|
+
const filePath = join10(functionDir, file2.path);
|
|
243833
243990
|
if (!await pathExists(filePath)) {
|
|
243834
243991
|
return false;
|
|
243835
243992
|
}
|
|
@@ -243868,6 +244025,7 @@ class ProjectConfigReader {
|
|
|
243868
244025
|
project: { ...project, root, configPath },
|
|
243869
244026
|
entities,
|
|
243870
244027
|
functions,
|
|
244028
|
+
actors: localResources.actors,
|
|
243871
244029
|
agents: localResources.agents,
|
|
243872
244030
|
connectors: localResources.connectors,
|
|
243873
244031
|
authConfig: localResources.authConfig
|
|
@@ -243895,15 +244053,23 @@ class ProjectConfigReader {
|
|
|
243895
244053
|
return result.data;
|
|
243896
244054
|
}
|
|
243897
244055
|
async readProjectResources(configPath, project) {
|
|
243898
|
-
const configDir =
|
|
243899
|
-
const [entities, functions, agents, connectors, authConfig] = await Promise.all([
|
|
243900
|
-
entityResource.readAll(
|
|
243901
|
-
functionResource.readAll(
|
|
243902
|
-
|
|
243903
|
-
|
|
243904
|
-
|
|
244056
|
+
const configDir = dirname10(configPath);
|
|
244057
|
+
const [entities, functions, actors, agents, connectors, authConfig] = await Promise.all([
|
|
244058
|
+
entityResource.readAll(join11(configDir, project.entitiesDir)),
|
|
244059
|
+
functionResource.readAll(join11(configDir, project.functionsDir)),
|
|
244060
|
+
actorResource.readAll(join11(configDir, project.actorsDir)),
|
|
244061
|
+
agentResource.readAll(join11(configDir, project.agentsDir)),
|
|
244062
|
+
connectorResource.readAll(join11(configDir, project.connectorsDir)),
|
|
244063
|
+
authConfigResource.readAll(join11(configDir, project.authDir))
|
|
243905
244064
|
]);
|
|
243906
|
-
return {
|
|
244065
|
+
return {
|
|
244066
|
+
entities,
|
|
244067
|
+
functions,
|
|
244068
|
+
actors,
|
|
244069
|
+
agents,
|
|
244070
|
+
connectors,
|
|
244071
|
+
authConfig
|
|
244072
|
+
};
|
|
243907
244073
|
}
|
|
243908
244074
|
assertPluginProjectDoesNotLoadPlugins(project, configPath) {
|
|
243909
244075
|
if (project.plugin && project.plugins.length > 0) {
|
|
@@ -243924,7 +244090,7 @@ class ProjectConfigReader {
|
|
|
243924
244090
|
this.pluginSourceByNamespace.set(namespace, source);
|
|
243925
244091
|
}
|
|
243926
244092
|
async readPluginConfig(plugin, hostConfigPath) {
|
|
243927
|
-
const pluginRoot = resolvePluginRoot(plugin.source,
|
|
244093
|
+
const pluginRoot = resolvePluginRoot(plugin.source, dirname10(hostConfigPath));
|
|
243928
244094
|
const { configPath } = await this.findConfigOrThrow(pluginRoot);
|
|
243929
244095
|
const project = await this.readConfigFile(configPath);
|
|
243930
244096
|
const namespace = requirePluginNamespace(project, plugin.source, configPath);
|
|
@@ -243936,6 +244102,7 @@ class ProjectConfigReader {
|
|
|
243936
244102
|
return {
|
|
243937
244103
|
entities: markPluginEntities(resources.entities, namespace),
|
|
243938
244104
|
functions: namespacePluginFunctions(resources.functions, namespace),
|
|
244105
|
+
actors: [],
|
|
243939
244106
|
agents: [],
|
|
243940
244107
|
connectors: [],
|
|
243941
244108
|
authConfig: []
|
|
@@ -243973,6 +244140,7 @@ class ProjectConfigReader {
|
|
|
243973
244140
|
return {
|
|
243974
244141
|
entities,
|
|
243975
244142
|
functions,
|
|
244143
|
+
actors: [],
|
|
243976
244144
|
agents: [],
|
|
243977
244145
|
connectors: [],
|
|
243978
244146
|
authConfig: []
|
|
@@ -244002,16 +244170,16 @@ async function readProjectConfig(projectRoot) {
|
|
|
244002
244170
|
// src/core/project/template.ts
|
|
244003
244171
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
244004
244172
|
var import_front_matter = __toESM(require_front_matter(), 1);
|
|
244005
|
-
import { dirname as
|
|
244173
|
+
import { dirname as dirname11, join as join13 } from "node:path";
|
|
244006
244174
|
|
|
244007
244175
|
// src/core/assets.ts
|
|
244008
244176
|
import { cpSync, existsSync } from "node:fs";
|
|
244009
244177
|
import { homedir as homedir2 } from "node:os";
|
|
244010
|
-
import { join as
|
|
244178
|
+
import { join as join12 } from "node:path";
|
|
244011
244179
|
// package.json
|
|
244012
244180
|
var package_default = {
|
|
244013
244181
|
name: "base44",
|
|
244014
|
-
version: "0.1.
|
|
244182
|
+
version: "0.1.5",
|
|
244015
244183
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
244016
244184
|
type: "module",
|
|
244017
244185
|
bin: {
|
|
@@ -244108,18 +244276,18 @@ var package_default = {
|
|
|
244108
244276
|
};
|
|
244109
244277
|
|
|
244110
244278
|
// src/core/assets.ts
|
|
244111
|
-
var ASSETS_DIR =
|
|
244279
|
+
var ASSETS_DIR = join12(homedir2(), ".base44", "assets", package_default.version);
|
|
244112
244280
|
function getTemplatesDir() {
|
|
244113
|
-
return
|
|
244281
|
+
return join12(ASSETS_DIR, "templates");
|
|
244114
244282
|
}
|
|
244115
244283
|
function getTemplatesIndexPath() {
|
|
244116
|
-
return
|
|
244284
|
+
return join12(ASSETS_DIR, "templates", "templates.json");
|
|
244117
244285
|
}
|
|
244118
244286
|
function getDenoWrapperPath() {
|
|
244119
|
-
return
|
|
244287
|
+
return join12(ASSETS_DIR, "deno-runtime", "main.ts");
|
|
244120
244288
|
}
|
|
244121
244289
|
function getExecWrapperPath() {
|
|
244122
|
-
return
|
|
244290
|
+
return join12(ASSETS_DIR, "deno-runtime", "exec.ts");
|
|
244123
244291
|
}
|
|
244124
244292
|
function ensureNpmAssets(sourceDir) {
|
|
244125
244293
|
if (existsSync(ASSETS_DIR))
|
|
@@ -244141,7 +244309,7 @@ async function listTemplates() {
|
|
|
244141
244309
|
}
|
|
244142
244310
|
async function renderTemplate(template, destPath, data, options = {}) {
|
|
244143
244311
|
const { skipExisting = false } = options;
|
|
244144
|
-
const templateDir =
|
|
244312
|
+
const templateDir = join13(getTemplatesDir(), template.path);
|
|
244145
244313
|
const files = await globby("**/*", {
|
|
244146
244314
|
cwd: templateDir,
|
|
244147
244315
|
dot: true,
|
|
@@ -244149,20 +244317,20 @@ async function renderTemplate(template, destPath, data, options = {}) {
|
|
|
244149
244317
|
});
|
|
244150
244318
|
const skipped = [];
|
|
244151
244319
|
for (const file2 of files) {
|
|
244152
|
-
const srcPath =
|
|
244320
|
+
const srcPath = join13(templateDir, file2);
|
|
244153
244321
|
try {
|
|
244154
244322
|
if (file2.endsWith(".ejs")) {
|
|
244155
244323
|
const rendered = await import_ejs.default.renderFile(srcPath, data);
|
|
244156
244324
|
const { attributes, body } = import_front_matter.default(rendered);
|
|
244157
|
-
const destFile = attributes.outputFileName ?
|
|
244158
|
-
const destFilePath =
|
|
244325
|
+
const destFile = attributes.outputFileName ? join13(dirname11(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
|
|
244326
|
+
const destFilePath = join13(destPath, destFile);
|
|
244159
244327
|
if (skipExisting && await pathExists(destFilePath)) {
|
|
244160
244328
|
skipped.push(destFile);
|
|
244161
244329
|
continue;
|
|
244162
244330
|
}
|
|
244163
244331
|
await writeFile(destFilePath, body);
|
|
244164
244332
|
} else {
|
|
244165
|
-
const destFilePath =
|
|
244333
|
+
const destFilePath = join13(destPath, file2);
|
|
244166
244334
|
if (skipExisting && await pathExists(destFilePath)) {
|
|
244167
244335
|
skipped.push(file2);
|
|
244168
244336
|
continue;
|
|
@@ -244262,7 +244430,7 @@ async function getSiteFilePaths(outputDir) {
|
|
|
244262
244430
|
// src/core/site/deploy.ts
|
|
244263
244431
|
import { randomUUID } from "node:crypto";
|
|
244264
244432
|
import { tmpdir } from "node:os";
|
|
244265
|
-
import { join as
|
|
244433
|
+
import { join as join14 } from "node:path";
|
|
244266
244434
|
async function deploySite(siteOutputDir) {
|
|
244267
244435
|
if (!await pathExists(siteOutputDir)) {
|
|
244268
244436
|
throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
|
|
@@ -244279,7 +244447,7 @@ async function deploySite(siteOutputDir) {
|
|
|
244279
244447
|
]
|
|
244280
244448
|
});
|
|
244281
244449
|
}
|
|
244282
|
-
const archivePath =
|
|
244450
|
+
const archivePath = join14(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
|
|
244283
244451
|
try {
|
|
244284
244452
|
await createArchive(siteOutputDir, archivePath);
|
|
244285
244453
|
return await uploadSite(archivePath);
|
|
@@ -244296,18 +244464,35 @@ async function createArchive(pathToArchive, targetArchivePath) {
|
|
|
244296
244464
|
}
|
|
244297
244465
|
// src/core/project/deploy.ts
|
|
244298
244466
|
function hasResourcesToDeploy(projectData) {
|
|
244299
|
-
const {
|
|
244467
|
+
const {
|
|
244468
|
+
project,
|
|
244469
|
+
entities,
|
|
244470
|
+
functions,
|
|
244471
|
+
actors,
|
|
244472
|
+
agents,
|
|
244473
|
+
connectors,
|
|
244474
|
+
authConfig
|
|
244475
|
+
} = projectData;
|
|
244300
244476
|
const hasSite = Boolean(project.site?.outputDirectory);
|
|
244301
244477
|
const hasEntities = entities.length > 0;
|
|
244302
244478
|
const hasFunctions = functions.length > 0;
|
|
244479
|
+
const hasActors = actors.length > 0;
|
|
244303
244480
|
const hasAgents = agents.length > 0;
|
|
244304
244481
|
const hasConnectors = connectors.length > 0;
|
|
244305
244482
|
const hasAuthConfig = authConfig.length > 0;
|
|
244306
244483
|
const hasVisibility = Boolean(project.visibility);
|
|
244307
|
-
return hasEntities || hasFunctions || hasAgents || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
|
|
244484
|
+
return hasEntities || hasFunctions || hasActors || hasAgents || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
|
|
244308
244485
|
}
|
|
244309
244486
|
async function deployAll(projectData, options) {
|
|
244310
|
-
const {
|
|
244487
|
+
const {
|
|
244488
|
+
project,
|
|
244489
|
+
entities,
|
|
244490
|
+
functions,
|
|
244491
|
+
actors,
|
|
244492
|
+
agents,
|
|
244493
|
+
connectors,
|
|
244494
|
+
authConfig
|
|
244495
|
+
} = projectData;
|
|
244311
244496
|
await setAppVisibility(project.visibility);
|
|
244312
244497
|
if (project.visibility) {
|
|
244313
244498
|
options?.onVisibilitySet?.(project.visibility);
|
|
@@ -244317,6 +244502,7 @@ async function deployAll(projectData, options) {
|
|
|
244317
244502
|
onStart: options?.onFunctionStart,
|
|
244318
244503
|
onResult: options?.onFunctionResult
|
|
244319
244504
|
});
|
|
244505
|
+
await deployActorsSequentially(actors);
|
|
244320
244506
|
await agentResource.push(agents);
|
|
244321
244507
|
await authConfigResource.push(authConfig);
|
|
244322
244508
|
const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
|
|
@@ -251341,16 +251527,30 @@ class Base44Command extends Command {
|
|
|
251341
251527
|
});
|
|
251342
251528
|
}
|
|
251343
251529
|
}
|
|
251344
|
-
// src/cli/
|
|
251345
|
-
|
|
251346
|
-
|
|
251347
|
-
|
|
251348
|
-
|
|
251349
|
-
|
|
251350
|
-
|
|
251530
|
+
// src/cli/utils/confirm-push.ts
|
|
251531
|
+
async function confirmPush({
|
|
251532
|
+
isNonInteractive,
|
|
251533
|
+
yes,
|
|
251534
|
+
log,
|
|
251535
|
+
warning
|
|
251536
|
+
}) {
|
|
251537
|
+
if (isNonInteractive && !yes) {
|
|
251538
|
+
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
251539
|
+
}
|
|
251540
|
+
if (yes) {
|
|
251541
|
+
return true;
|
|
251351
251542
|
}
|
|
251543
|
+
log.warn(warning);
|
|
251544
|
+
const proceed = await Re({
|
|
251545
|
+
message: "Are you sure you want to continue?"
|
|
251546
|
+
});
|
|
251547
|
+
return !Ct(proceed) && proceed;
|
|
251548
|
+
}
|
|
251549
|
+
// src/cli/utils/json.ts
|
|
251550
|
+
function toJsonStdout(result) {
|
|
251551
|
+
return `${JSON.stringify(result, null, 2)}
|
|
251552
|
+
`;
|
|
251352
251553
|
}
|
|
251353
|
-
|
|
251354
251554
|
// src/cli/utils/prompts.ts
|
|
251355
251555
|
var onPromptCancel = () => {
|
|
251356
251556
|
Ne("Operation cancelled.");
|
|
@@ -251550,10 +251750,6 @@ var MoveAppResponseSchema = exports_external.looseObject({
|
|
|
251550
251750
|
appId: data.app_id,
|
|
251551
251751
|
newWorkspaceId: data.new_workspace_id
|
|
251552
251752
|
}));
|
|
251553
|
-
var APP_EDITOR_ROLES = ["owner", "admin", "editor"];
|
|
251554
|
-
function canCreateAppsInWorkspace(role) {
|
|
251555
|
-
return role !== undefined && APP_EDITOR_ROLES.includes(role.toLowerCase());
|
|
251556
|
-
}
|
|
251557
251753
|
|
|
251558
251754
|
// src/core/workspace/api.ts
|
|
251559
251755
|
async function listWorkspaces() {
|
|
@@ -251594,14 +251790,136 @@ async function moveAppToWorkspace(appId, targetWorkspaceId, options = {}) {
|
|
|
251594
251790
|
}
|
|
251595
251791
|
return result.data;
|
|
251596
251792
|
}
|
|
251793
|
+
// src/cli/commands/actor/deploy.ts
|
|
251794
|
+
function parseNames(args) {
|
|
251795
|
+
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
251796
|
+
}
|
|
251797
|
+
function resolveActorsToDeploy(names, allActors) {
|
|
251798
|
+
if (names.length === 0)
|
|
251799
|
+
return allActors;
|
|
251800
|
+
const notFound = names.filter((n2) => !allActors.some((a2) => a2.name === n2));
|
|
251801
|
+
if (notFound.length > 0) {
|
|
251802
|
+
throw new InvalidInputError(`Actor${notFound.length > 1 ? "s" : ""} not found in project: ${notFound.join(", ")}`);
|
|
251803
|
+
}
|
|
251804
|
+
return allActors.filter((a2) => names.includes(a2.name));
|
|
251805
|
+
}
|
|
251806
|
+
function formatDeployResult(result, log) {
|
|
251807
|
+
const label = result.name.padEnd(25);
|
|
251808
|
+
if (result.status === "deployed") {
|
|
251809
|
+
const timing = result.durationMs ? theme.styles.dim(` (${(result.durationMs / 1000).toFixed(1)}s)`) : "";
|
|
251810
|
+
log.success(`${label} deployed${timing}`);
|
|
251811
|
+
} else if (result.status === "unchanged") {
|
|
251812
|
+
log.success(`${label} unchanged`);
|
|
251813
|
+
} else {
|
|
251814
|
+
log.error(`${label} error: ${result.error}`);
|
|
251815
|
+
}
|
|
251816
|
+
}
|
|
251817
|
+
function buildDeploySummary(results) {
|
|
251818
|
+
const deployed = results.filter((r) => r.status === "deployed").length;
|
|
251819
|
+
const unchanged = results.filter((r) => r.status === "unchanged").length;
|
|
251820
|
+
const failed = results.filter((r) => r.status === "error").length;
|
|
251821
|
+
const parts = [];
|
|
251822
|
+
if (deployed > 0)
|
|
251823
|
+
parts.push(`${deployed} deployed`);
|
|
251824
|
+
if (unchanged > 0)
|
|
251825
|
+
parts.push(`${unchanged} unchanged`);
|
|
251826
|
+
if (failed > 0)
|
|
251827
|
+
parts.push(`${failed} error${failed !== 1 ? "s" : ""}`);
|
|
251828
|
+
return parts.join(", ") || "No actors deployed";
|
|
251829
|
+
}
|
|
251830
|
+
async function deployActorAction({ log }, names) {
|
|
251831
|
+
const { actors } = await readProjectConfig();
|
|
251832
|
+
const toDeploy = resolveActorsToDeploy(names, actors);
|
|
251833
|
+
if (toDeploy.length === 0) {
|
|
251834
|
+
return {
|
|
251835
|
+
outroMessage: "No actors found. Create actors in the 'actors' directory."
|
|
251836
|
+
};
|
|
251837
|
+
}
|
|
251838
|
+
log.info(`Found ${toDeploy.length} ${toDeploy.length === 1 ? "actor" : "actors"} to deploy`);
|
|
251839
|
+
let completed = 0;
|
|
251840
|
+
const total = toDeploy.length;
|
|
251841
|
+
const results = await deployActorsSequentially(toDeploy, {
|
|
251842
|
+
onStart: (startNames) => {
|
|
251843
|
+
const label = startNames.length === 1 ? startNames[0] : `${startNames.length} actors`;
|
|
251844
|
+
log.step(theme.styles.dim(`[${completed + 1}/${total}] Deploying ${label}...`));
|
|
251845
|
+
},
|
|
251846
|
+
onResult: (result) => {
|
|
251847
|
+
completed++;
|
|
251848
|
+
formatDeployResult(result, log);
|
|
251849
|
+
}
|
|
251850
|
+
});
|
|
251851
|
+
const hasFailures = results.some((r) => r.status === "error");
|
|
251852
|
+
if (hasFailures) {
|
|
251853
|
+
log.message(buildDeploySummary(results));
|
|
251854
|
+
throw new CLIExitError(1);
|
|
251855
|
+
}
|
|
251856
|
+
return { outroMessage: buildDeploySummary(results) };
|
|
251857
|
+
}
|
|
251858
|
+
function getDeployCommand() {
|
|
251859
|
+
return new Base44Command("deploy").description("Deploy actors to Base44").argument("[names...]", "Actor names to deploy (deploys all if omitted)").action(async (ctx, rawNames) => {
|
|
251860
|
+
const names = parseNames(rawNames);
|
|
251861
|
+
return deployActorAction(ctx, names);
|
|
251862
|
+
});
|
|
251863
|
+
}
|
|
251864
|
+
|
|
251865
|
+
// src/cli/commands/actor/new.ts
|
|
251866
|
+
import { dirname as dirname12, join as join15 } from "node:path";
|
|
251867
|
+
function buildActorScaffold(actorName) {
|
|
251868
|
+
return `import { Actor, type Conn } from "@base44/sdk";
|
|
251869
|
+
|
|
251870
|
+
interface State {
|
|
251871
|
+
// shared state broadcast to all clients
|
|
251872
|
+
}
|
|
251873
|
+
|
|
251874
|
+
interface Message {
|
|
251875
|
+
// messages sent from clients
|
|
251876
|
+
}
|
|
251877
|
+
|
|
251878
|
+
export class ${actorName} extends Actor<State, Message> {
|
|
251879
|
+
handleConnect(conn: Conn) {
|
|
251880
|
+
console.log("Connected:", conn.userId);
|
|
251881
|
+
}
|
|
251882
|
+
handleMessage(conn: Conn, msg: Message) {
|
|
251883
|
+
console.log("Message:", msg);
|
|
251884
|
+
}
|
|
251885
|
+
handleTick() {}
|
|
251886
|
+
handleClose(conn: Conn) {}
|
|
251887
|
+
}
|
|
251888
|
+
`;
|
|
251889
|
+
}
|
|
251890
|
+
async function newActorAction(_ctx, actorName) {
|
|
251891
|
+
const { project: project2 } = await readProjectConfig();
|
|
251892
|
+
const actorsDir = join15(dirname12(project2.configPath), project2.actorsDir);
|
|
251893
|
+
const actorDir = join15(actorsDir, actorName);
|
|
251894
|
+
if (await pathExists(actorDir)) {
|
|
251895
|
+
throw new InvalidInputError(`Actor "${actorName}" already exists at ${actorDir}`);
|
|
251896
|
+
}
|
|
251897
|
+
const entryPath = join15(actorDir, "entry.ts");
|
|
251898
|
+
await writeFile(entryPath, buildActorScaffold(actorName));
|
|
251899
|
+
return {
|
|
251900
|
+
outroMessage: `Created actor "${actorName}" at ${entryPath}`
|
|
251901
|
+
};
|
|
251902
|
+
}
|
|
251903
|
+
function getNewCommand() {
|
|
251904
|
+
return new Base44Command("new").description("Create a new actor scaffold").argument("<ActorName>", "Name of the actor class").action(async (ctx, actorName) => {
|
|
251905
|
+
return newActorAction(ctx, actorName);
|
|
251906
|
+
});
|
|
251907
|
+
}
|
|
251908
|
+
|
|
251909
|
+
// src/cli/commands/actor/index.ts
|
|
251910
|
+
function getActorCommand() {
|
|
251911
|
+
return new Command("actor").description("Manage actors").addCommand(getNewCommand()).addCommand(getDeployCommand());
|
|
251912
|
+
}
|
|
251913
|
+
|
|
251597
251914
|
// src/cli/commands/agents/pull.ts
|
|
251915
|
+
import { dirname as dirname13, join as join16 } from "node:path";
|
|
251598
251916
|
async function pullAgentsAction({
|
|
251599
251917
|
log,
|
|
251600
251918
|
runTask: runTask2
|
|
251601
251919
|
}) {
|
|
251602
251920
|
const { project: project2 } = await readProjectConfig();
|
|
251603
|
-
const configDir =
|
|
251604
|
-
const agentsDir =
|
|
251921
|
+
const configDir = dirname13(project2.configPath);
|
|
251922
|
+
const agentsDir = join16(configDir, project2.agentsDir);
|
|
251605
251923
|
const remoteAgents = await runTask2("Fetching agents from Base44", async () => {
|
|
251606
251924
|
return await fetchAgents();
|
|
251607
251925
|
}, {
|
|
@@ -251632,12 +251950,18 @@ function getAgentsPullCommand() {
|
|
|
251632
251950
|
}
|
|
251633
251951
|
|
|
251634
251952
|
// src/cli/commands/agents/push.ts
|
|
251635
|
-
async function pushAgentsAction({
|
|
251636
|
-
log,
|
|
251637
|
-
runTask: runTask2
|
|
251638
|
-
}) {
|
|
251953
|
+
async function pushAgentsAction({ isNonInteractive, log, runTask: runTask2 }, options) {
|
|
251639
251954
|
const { agents } = await readProjectConfig();
|
|
251640
251955
|
log.info(agents.length === 0 ? "No local agents found - this will delete all remote agents" : `Found ${agents.length} agents to push`);
|
|
251956
|
+
const proceed = await confirmPush({
|
|
251957
|
+
isNonInteractive,
|
|
251958
|
+
yes: options.yes,
|
|
251959
|
+
log,
|
|
251960
|
+
warning: "This will replace all remote agent configs with your local agents and delete any not present locally."
|
|
251961
|
+
});
|
|
251962
|
+
if (!proceed) {
|
|
251963
|
+
return { outroMessage: "Push cancelled" };
|
|
251964
|
+
}
|
|
251641
251965
|
const result = await runTask2("Pushing agents to Base44", async () => {
|
|
251642
251966
|
return await pushAgents(agents);
|
|
251643
251967
|
}, {
|
|
@@ -251656,7 +251980,7 @@ async function pushAgentsAction({
|
|
|
251656
251980
|
return { outroMessage: "Agents pushed to Base44" };
|
|
251657
251981
|
}
|
|
251658
251982
|
function getAgentsPushCommand() {
|
|
251659
|
-
return new Base44Command("push").description("Push local agents to Base44 (replaces all remote agent configs)").action(pushAgentsAction);
|
|
251983
|
+
return new Base44Command("push").description("Push local agents to Base44 (replaces all remote agent configs)").option("-y, --yes", "Skip confirmation prompt").action(pushAgentsAction);
|
|
251660
251984
|
}
|
|
251661
251985
|
|
|
251662
251986
|
// src/cli/commands/agents/index.ts
|
|
@@ -251665,12 +251989,12 @@ function getAgentsCommand() {
|
|
|
251665
251989
|
}
|
|
251666
251990
|
|
|
251667
251991
|
// src/cli/commands/auth/password-login.ts
|
|
251668
|
-
import { dirname as
|
|
251992
|
+
import { dirname as dirname14, join as join17 } from "node:path";
|
|
251669
251993
|
async function passwordLoginAction({ log, runTask: runTask2 }, action) {
|
|
251670
251994
|
const shouldEnable = action === "enable";
|
|
251671
251995
|
const { project: project2 } = await readProjectConfig();
|
|
251672
|
-
const configDir =
|
|
251673
|
-
const authDir =
|
|
251996
|
+
const configDir = dirname14(project2.configPath);
|
|
251997
|
+
const authDir = join17(configDir, project2.authDir);
|
|
251674
251998
|
const updated = await runTask2("Updating local auth config", async () => {
|
|
251675
251999
|
const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
|
|
251676
252000
|
const merged = { ...current, enableUsernamePassword: shouldEnable };
|
|
@@ -251690,14 +252014,14 @@ function getPasswordLoginCommand() {
|
|
|
251690
252014
|
}
|
|
251691
252015
|
|
|
251692
252016
|
// src/cli/commands/auth/pull.ts
|
|
251693
|
-
import { dirname as
|
|
252017
|
+
import { dirname as dirname15, join as join18 } from "node:path";
|
|
251694
252018
|
async function pullAuthAction({
|
|
251695
252019
|
log,
|
|
251696
252020
|
runTask: runTask2
|
|
251697
252021
|
}) {
|
|
251698
252022
|
const { project: project2 } = await readProjectConfig();
|
|
251699
|
-
const configDir =
|
|
251700
|
-
const authDir =
|
|
252023
|
+
const configDir = dirname15(project2.configPath);
|
|
252024
|
+
const authDir = join18(configDir, project2.authDir);
|
|
251701
252025
|
const remoteConfig = await runTask2("Fetching auth config from Base44", async () => {
|
|
251702
252026
|
return await pullAuthConfig();
|
|
251703
252027
|
}, {
|
|
@@ -251761,7 +252085,7 @@ function getAuthPushCommand() {
|
|
|
251761
252085
|
}
|
|
251762
252086
|
|
|
251763
252087
|
// src/cli/commands/auth/social-login.ts
|
|
251764
|
-
import { dirname as
|
|
252088
|
+
import { dirname as dirname16, join as join19, resolve as resolve4 } from "node:path";
|
|
251765
252089
|
var PROVIDER_LABELS = {
|
|
251766
252090
|
google: "Google",
|
|
251767
252091
|
microsoft: "Microsoft",
|
|
@@ -251831,8 +252155,8 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
|
|
|
251831
252155
|
}
|
|
251832
252156
|
}
|
|
251833
252157
|
const { project: project2 } = await readProjectConfig();
|
|
251834
|
-
const configDir =
|
|
251835
|
-
const authDir =
|
|
252158
|
+
const configDir = dirname16(project2.configPath);
|
|
252159
|
+
const authDir = join19(configDir, project2.authDir);
|
|
251836
252160
|
const { config: updated } = await runTask2("Updating local auth config", async () => updateSocialLoginConfig(authDir, provider, shouldEnable, useCustomOAuth && options.clientId ? { clientId: options.clientId } : undefined));
|
|
251837
252161
|
if (clientSecret) {
|
|
251838
252162
|
await runTask2("Saving client secret", async () => pushCustomOAuthSecret(provider, clientSecret));
|
|
@@ -251857,7 +252181,7 @@ function getSocialLoginCommand() {
|
|
|
251857
252181
|
}
|
|
251858
252182
|
|
|
251859
252183
|
// src/cli/commands/auth/sso.ts
|
|
251860
|
-
import { dirname as
|
|
252184
|
+
import { dirname as dirname17, join as join20, resolve as resolve5 } from "node:path";
|
|
251861
252185
|
var SSOConfigFileSchema = exports_external.object({
|
|
251862
252186
|
provider: exports_external.enum(Object.values(KNOWN_SSO_PROVIDERS)),
|
|
251863
252187
|
clientId: exports_external.string(),
|
|
@@ -252020,8 +252344,8 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
|
|
|
252020
252344
|
throw error48;
|
|
252021
252345
|
}
|
|
252022
252346
|
const { project: project2 } = await readProjectConfig();
|
|
252023
|
-
const configDir =
|
|
252024
|
-
const authDir =
|
|
252347
|
+
const configDir = dirname17(project2.configPath);
|
|
252348
|
+
const authDir = join20(configDir, project2.authDir);
|
|
252025
252349
|
await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, provider, true));
|
|
252026
252350
|
await runTask2("Saving SSO credentials", async () => pushSSOSecrets(secrets));
|
|
252027
252351
|
return {
|
|
@@ -252036,8 +252360,8 @@ async function ssoDisableAction({ log, runTask: runTask2 }, options) {
|
|
|
252036
252360
|
throw new InvalidInputError("Configuration options cannot be used with disable. To disable SSO: base44 auth sso disable");
|
|
252037
252361
|
}
|
|
252038
252362
|
const { project: project2 } = await readProjectConfig();
|
|
252039
|
-
const configDir =
|
|
252040
|
-
const authDir =
|
|
252363
|
+
const configDir = dirname17(project2.configPath);
|
|
252364
|
+
const authDir = join20(configDir, project2.authDir);
|
|
252041
252365
|
const updated = await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, null, false));
|
|
252042
252366
|
await runTask2("Removing SSO credentials", async () => deleteSSOSecrets());
|
|
252043
252367
|
if (!hasAnyLoginMethod(updated)) {
|
|
@@ -252894,13 +253218,13 @@ function getConnectorsListAvailableCommand() {
|
|
|
252894
253218
|
}
|
|
252895
253219
|
|
|
252896
253220
|
// src/cli/commands/connectors/pull.ts
|
|
252897
|
-
import { dirname as
|
|
253221
|
+
import { dirname as dirname18, join as join21, resolve as resolve6 } from "node:path";
|
|
252898
253222
|
async function resolveConnectorsDir(options) {
|
|
252899
253223
|
if (!getAppContext().projectRoot) {
|
|
252900
253224
|
return resolve6(options.dir ?? "connectors");
|
|
252901
253225
|
}
|
|
252902
253226
|
const { project: project2 } = await readProjectConfig();
|
|
252903
|
-
return
|
|
253227
|
+
return join21(dirname18(project2.configPath), project2.connectorsDir);
|
|
252904
253228
|
}
|
|
252905
253229
|
async function pullConnectorsAction({ log, runTask: runTask2, jsonMode }, options) {
|
|
252906
253230
|
const connectorsDir = await resolveConnectorsDir(options);
|
|
@@ -253021,6 +253345,15 @@ async function pushConnectorsAction({ isNonInteractive, log, runTask: runTask2,
|
|
|
253021
253345
|
log.info(`Found ${connectors.length} connectors to push: ${connectorNames}`);
|
|
253022
253346
|
}
|
|
253023
253347
|
}
|
|
253348
|
+
const proceed = await confirmPush({
|
|
253349
|
+
isNonInteractive,
|
|
253350
|
+
yes: options.yes,
|
|
253351
|
+
log,
|
|
253352
|
+
warning: "This will overwrite your app's connectors with your local copy and remove any not present locally."
|
|
253353
|
+
});
|
|
253354
|
+
if (!proceed) {
|
|
253355
|
+
return { outroMessage: "Push cancelled" };
|
|
253356
|
+
}
|
|
253024
253357
|
const { results } = await runTask2("Pushing connectors to Base44", async () => {
|
|
253025
253358
|
return await pushConnectors(connectors);
|
|
253026
253359
|
});
|
|
@@ -253044,7 +253377,7 @@ async function pushConnectorsAction({ isNonInteractive, log, runTask: runTask2,
|
|
|
253044
253377
|
return { outroMessage };
|
|
253045
253378
|
}
|
|
253046
253379
|
function getConnectorsPushCommand() {
|
|
253047
|
-
return new Base44Command("push").description("Push local connectors to Base44 (overwrites connectors on Base44)").option("--dir <path>", "Directory to read connector files from (default: ./connectors when using --app-id)").action(pushConnectorsAction);
|
|
253380
|
+
return new Base44Command("push").description("Push local connectors to Base44 (overwrites connectors on Base44)").option("--dir <path>", "Directory to read connector files from (default: ./connectors when using --app-id)").option("-y, --yes", "Skip confirmation prompt").action(pushConnectorsAction);
|
|
253048
253381
|
}
|
|
253049
253382
|
|
|
253050
253383
|
// src/cli/commands/connectors/index.ts
|
|
@@ -253072,16 +253405,22 @@ function getDashboardCommand() {
|
|
|
253072
253405
|
}
|
|
253073
253406
|
|
|
253074
253407
|
// src/cli/commands/entities/push.ts
|
|
253075
|
-
async function pushEntitiesAction({
|
|
253076
|
-
log,
|
|
253077
|
-
runTask: runTask2
|
|
253078
|
-
}) {
|
|
253408
|
+
async function pushEntitiesAction({ isNonInteractive, log, runTask: runTask2 }, options) {
|
|
253079
253409
|
const { entities } = await readProjectConfig();
|
|
253080
253410
|
if (entities.length === 0) {
|
|
253081
253411
|
return { outroMessage: "No entities found in project" };
|
|
253082
253412
|
}
|
|
253083
253413
|
const entityNames = entities.map((e2) => e2.name).join(", ");
|
|
253084
253414
|
log.info(`Found ${entities.length} entities to push: ${entityNames}`);
|
|
253415
|
+
const proceed = await confirmPush({
|
|
253416
|
+
isNonInteractive,
|
|
253417
|
+
yes: options.yes,
|
|
253418
|
+
log,
|
|
253419
|
+
warning: "This will overwrite your app's entities with your local copy and delete any not present locally."
|
|
253420
|
+
});
|
|
253421
|
+
if (!proceed) {
|
|
253422
|
+
return { outroMessage: "Push cancelled" };
|
|
253423
|
+
}
|
|
253085
253424
|
const result = await runTask2("Pushing entities to Base44", async () => {
|
|
253086
253425
|
return await pushEntities(entities);
|
|
253087
253426
|
}, {
|
|
@@ -253100,7 +253439,7 @@ async function pushEntitiesAction({
|
|
|
253100
253439
|
return { outroMessage: "Entities pushed to Base44" };
|
|
253101
253440
|
}
|
|
253102
253441
|
function getEntitiesPushCommand() {
|
|
253103
|
-
return new Command("entities").description("Manage project entities").addCommand(new Base44Command("push").description("Push local entities to Base44").action(pushEntitiesAction));
|
|
253442
|
+
return new Command("entities").description("Manage project entities").addCommand(new Base44Command("push").description("Push local entities to Base44").option("-y, --yes", "Skip confirmation prompt").action(pushEntitiesAction));
|
|
253104
253443
|
}
|
|
253105
253444
|
|
|
253106
253445
|
// src/cli/commands/functions/delete.ts
|
|
@@ -253140,18 +253479,18 @@ async function deleteFunctionsAction({ runTask: runTask2 }, names) {
|
|
|
253140
253479
|
parts.push(`${errors5} error${errors5 !== 1 ? "s" : ""}`);
|
|
253141
253480
|
return { outroMessage: parts.join(", ") };
|
|
253142
253481
|
}
|
|
253143
|
-
function
|
|
253482
|
+
function parseNames2(args) {
|
|
253144
253483
|
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
253145
253484
|
}
|
|
253146
253485
|
function validateNames(command2) {
|
|
253147
|
-
const names =
|
|
253486
|
+
const names = parseNames2(command2.args);
|
|
253148
253487
|
if (names.length === 0) {
|
|
253149
253488
|
command2.error("At least one function name is required");
|
|
253150
253489
|
}
|
|
253151
253490
|
}
|
|
253152
253491
|
function getDeleteCommand() {
|
|
253153
253492
|
return new Base44Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").hook("preAction", validateNames).action(async (ctx, rawNames) => {
|
|
253154
|
-
const names =
|
|
253493
|
+
const names = parseNames2(rawNames);
|
|
253155
253494
|
return deleteFunctionsAction(ctx, names);
|
|
253156
253495
|
});
|
|
253157
253496
|
}
|
|
@@ -253160,7 +253499,7 @@ function getDeleteCommand() {
|
|
|
253160
253499
|
function formatDuration(ms) {
|
|
253161
253500
|
return `${(ms / 1000).toFixed(1)}s`;
|
|
253162
253501
|
}
|
|
253163
|
-
function
|
|
253502
|
+
function formatDeployResult2(result, log) {
|
|
253164
253503
|
const label = result.name.padEnd(25);
|
|
253165
253504
|
if (result.status === "deployed") {
|
|
253166
253505
|
const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
|
|
@@ -253173,7 +253512,7 @@ function formatDeployResult(result, log) {
|
|
|
253173
253512
|
}
|
|
253174
253513
|
|
|
253175
253514
|
// src/cli/commands/functions/parseNames.ts
|
|
253176
|
-
function
|
|
253515
|
+
function parseNames3(args) {
|
|
253177
253516
|
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
253178
253517
|
}
|
|
253179
253518
|
|
|
@@ -253200,7 +253539,7 @@ function formatPruneSummary(pruneResults, log) {
|
|
|
253200
253539
|
log.info(`${pruned} deleted`);
|
|
253201
253540
|
}
|
|
253202
253541
|
}
|
|
253203
|
-
function
|
|
253542
|
+
function buildDeploySummary2(results) {
|
|
253204
253543
|
const deployed = results.filter((r) => r.status === "deployed").length;
|
|
253205
253544
|
const unchanged = results.filter((r) => r.status === "unchanged").length;
|
|
253206
253545
|
const failed = results.filter((r) => r.status === "error").length;
|
|
@@ -253234,12 +253573,12 @@ async function deployFunctionsAction({ log }, names, options) {
|
|
|
253234
253573
|
},
|
|
253235
253574
|
onResult: (result) => {
|
|
253236
253575
|
completed++;
|
|
253237
|
-
|
|
253576
|
+
formatDeployResult2(result, log);
|
|
253238
253577
|
}
|
|
253239
253578
|
});
|
|
253240
253579
|
const hasFailures = results.some((r) => r.status === "error");
|
|
253241
253580
|
if (hasFailures) {
|
|
253242
|
-
log.message(
|
|
253581
|
+
log.message(buildDeploySummary2(results));
|
|
253243
253582
|
throw new CLIExitError(1);
|
|
253244
253583
|
}
|
|
253245
253584
|
if (options.force) {
|
|
@@ -253261,11 +253600,11 @@ async function deployFunctionsAction({ log }, names, options) {
|
|
|
253261
253600
|
});
|
|
253262
253601
|
formatPruneSummary(pruneResults, log);
|
|
253263
253602
|
}
|
|
253264
|
-
return { outroMessage:
|
|
253603
|
+
return { outroMessage: buildDeploySummary2(results) };
|
|
253265
253604
|
}
|
|
253266
|
-
function
|
|
253605
|
+
function getDeployCommand2() {
|
|
253267
253606
|
return new Base44Command("deploy").description("Deploy functions to Base44").argument("[names...]", "Function names to deploy (deploys all if omitted)").option("--force", "Delete remote functions not found locally").action(async (ctx, rawNames, options) => {
|
|
253268
|
-
const names =
|
|
253607
|
+
const names = parseNames3(rawNames);
|
|
253269
253608
|
return deployFunctionsAction(ctx, names, options);
|
|
253270
253609
|
});
|
|
253271
253610
|
}
|
|
@@ -253293,11 +253632,11 @@ function getListCommand() {
|
|
|
253293
253632
|
}
|
|
253294
253633
|
|
|
253295
253634
|
// src/cli/commands/functions/pull.ts
|
|
253296
|
-
import { dirname as
|
|
253635
|
+
import { dirname as dirname19, join as join22 } from "node:path";
|
|
253297
253636
|
async function pullFunctionsAction({ log, runTask: runTask2 }, name2) {
|
|
253298
253637
|
const { project: project2, functions } = await readProjectConfig();
|
|
253299
|
-
const configDir =
|
|
253300
|
-
const functionsDir =
|
|
253638
|
+
const configDir = dirname19(project2.configPath);
|
|
253639
|
+
const functionsDir = join22(configDir, project2.functionsDir);
|
|
253301
253640
|
const pluginFunctionNames = new Set(functions.filter((fn) => fn.source.type === "plugin").map((fn) => fn.name));
|
|
253302
253641
|
const remoteFunctions = await runTask2("Fetching functions from Base44", async () => {
|
|
253303
253642
|
const { functions: functions2 } = await listDeployedFunctions();
|
|
@@ -253352,15 +253691,15 @@ function getPullCommand() {
|
|
|
253352
253691
|
|
|
253353
253692
|
// src/cli/commands/functions/index.ts
|
|
253354
253693
|
function getFunctionsCommand() {
|
|
253355
|
-
return new Command("functions").description("Manage backend functions").addCommand(
|
|
253694
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand2()).addCommand(getDeleteCommand()).addCommand(getListCommand()).addCommand(getPullCommand());
|
|
253356
253695
|
}
|
|
253357
253696
|
|
|
253358
253697
|
// src/cli/commands/project/create.ts
|
|
253359
|
-
import { basename as
|
|
253698
|
+
import { basename as basename5, resolve as resolve8 } from "node:path";
|
|
253360
253699
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
253361
253700
|
|
|
253362
253701
|
// src/cli/commands/project/scaffold-shared.ts
|
|
253363
|
-
import { join as
|
|
253702
|
+
import { join as join23 } from "node:path";
|
|
253364
253703
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
253365
253704
|
async function getTemplateById(templateId) {
|
|
253366
253705
|
const templates = await listTemplates();
|
|
@@ -253377,7 +253716,7 @@ async function completeProjectSetup({
|
|
|
253377
253716
|
projectId,
|
|
253378
253717
|
name: name2,
|
|
253379
253718
|
resolvedPath,
|
|
253380
|
-
deploy:
|
|
253719
|
+
deploy: deploy6,
|
|
253381
253720
|
skills,
|
|
253382
253721
|
isInteractive
|
|
253383
253722
|
}, { runTask: runTask2 }) {
|
|
@@ -253391,7 +253730,7 @@ async function completeProjectSetup({
|
|
|
253391
253730
|
});
|
|
253392
253731
|
shouldPushEntities = !Ct(result) && result;
|
|
253393
253732
|
} else {
|
|
253394
|
-
shouldPushEntities = !!
|
|
253733
|
+
shouldPushEntities = !!deploy6;
|
|
253395
253734
|
}
|
|
253396
253735
|
if (shouldPushEntities) {
|
|
253397
253736
|
await runTask2(`Pushing ${entities.length} data models to Base44...`, async () => {
|
|
@@ -253411,7 +253750,7 @@ async function completeProjectSetup({
|
|
|
253411
253750
|
});
|
|
253412
253751
|
shouldDeploy = !Ct(result) && result;
|
|
253413
253752
|
} else {
|
|
253414
|
-
shouldDeploy = !!
|
|
253753
|
+
shouldDeploy = !!deploy6;
|
|
253415
253754
|
}
|
|
253416
253755
|
if (shouldDeploy && installCommand && buildCommand && outputDirectory) {
|
|
253417
253756
|
const { appUrl } = await runTask2("Installing dependencies...", async (updateMessage) => {
|
|
@@ -253419,7 +253758,7 @@ async function completeProjectSetup({
|
|
|
253419
253758
|
updateMessage("Building project...");
|
|
253420
253759
|
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
253421
253760
|
updateMessage("Deploying site...");
|
|
253422
|
-
return await deploySite(
|
|
253761
|
+
return await deploySite(join23(resolvedPath, outputDirectory));
|
|
253423
253762
|
}, {
|
|
253424
253763
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
253425
253764
|
errorMessage: "Failed to deploy site"
|
|
@@ -253461,44 +253800,29 @@ function fetchWorkspaces(ctx) {
|
|
|
253461
253800
|
errorMessage: "Failed to fetch workspaces"
|
|
253462
253801
|
});
|
|
253463
253802
|
}
|
|
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
253803
|
function workspaceLabel(workspace2) {
|
|
253471
253804
|
const suffix = workspace2.isPersonal ? "personal" : workspace2.userRole ?? "member";
|
|
253472
253805
|
return `${workspace2.name} (${suffix})`;
|
|
253473
253806
|
}
|
|
253474
253807
|
async function resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive) {
|
|
253475
253808
|
if (flagWorkspaceId) {
|
|
253476
|
-
|
|
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;
|
|
253809
|
+
return flagWorkspaceId;
|
|
253485
253810
|
}
|
|
253486
253811
|
if (!isInteractive) {
|
|
253487
253812
|
return;
|
|
253488
253813
|
}
|
|
253489
253814
|
const workspaces = await fetchWorkspaces(ctx);
|
|
253490
|
-
|
|
253491
|
-
if (eligible.length <= 1) {
|
|
253815
|
+
if (workspaces.length <= 1) {
|
|
253492
253816
|
return;
|
|
253493
253817
|
}
|
|
253494
|
-
const options =
|
|
253818
|
+
const options = workspaces.map((w) => ({
|
|
253495
253819
|
value: w.id,
|
|
253496
253820
|
label: workspaceLabel(w)
|
|
253497
253821
|
}));
|
|
253498
253822
|
const selected = await Je({
|
|
253499
253823
|
message: "Which workspace should this app belong to?",
|
|
253500
253824
|
options,
|
|
253501
|
-
initialValue:
|
|
253825
|
+
initialValue: workspaces[0].id
|
|
253502
253826
|
});
|
|
253503
253827
|
if (Ct(selected)) {
|
|
253504
253828
|
onPromptCancel();
|
|
@@ -253532,8 +253856,8 @@ async function createInteractive(options, ctx) {
|
|
|
253532
253856
|
name: () => {
|
|
253533
253857
|
return options.name ? Promise.resolve(options.name) : Ze({
|
|
253534
253858
|
message: "What is the name of your project?",
|
|
253535
|
-
placeholder:
|
|
253536
|
-
initialValue:
|
|
253859
|
+
placeholder: basename5(process.cwd()),
|
|
253860
|
+
initialValue: basename5(process.cwd()),
|
|
253537
253861
|
validate: (value) => {
|
|
253538
253862
|
if (!value || value.trim().length === 0) {
|
|
253539
253863
|
return "Every project deserves a name";
|
|
@@ -253580,7 +253904,7 @@ async function executeCreate({
|
|
|
253580
253904
|
name: rawName,
|
|
253581
253905
|
description,
|
|
253582
253906
|
projectPath,
|
|
253583
|
-
deploy:
|
|
253907
|
+
deploy: deploy6,
|
|
253584
253908
|
skills,
|
|
253585
253909
|
workspaceId: flagWorkspaceId,
|
|
253586
253910
|
isInteractive
|
|
@@ -253602,7 +253926,7 @@ async function executeCreate({
|
|
|
253602
253926
|
errorMessage: "Failed to create project"
|
|
253603
253927
|
});
|
|
253604
253928
|
setAppContext({ id: projectId, projectRoot: resolvedPath });
|
|
253605
|
-
const summary = await completeProjectSetup({ projectId, name: name2, resolvedPath, deploy:
|
|
253929
|
+
const summary = await completeProjectSetup({ projectId, name: name2, resolvedPath, deploy: deploy6, skills, isInteractive }, ctx);
|
|
253606
253930
|
printProjectSummary(summary, log);
|
|
253607
253931
|
return { outroMessage: "Your project is set up and ready to use" };
|
|
253608
253932
|
}
|
|
@@ -253648,7 +253972,15 @@ async function deployAction({ isNonInteractive, log }, options = {}) {
|
|
|
253648
253972
|
outroMessage: "No resources found to deploy"
|
|
253649
253973
|
};
|
|
253650
253974
|
}
|
|
253651
|
-
const {
|
|
253975
|
+
const {
|
|
253976
|
+
project: project2,
|
|
253977
|
+
entities,
|
|
253978
|
+
functions,
|
|
253979
|
+
actors,
|
|
253980
|
+
agents,
|
|
253981
|
+
connectors,
|
|
253982
|
+
authConfig
|
|
253983
|
+
} = projectData;
|
|
253652
253984
|
const summaryLines = [];
|
|
253653
253985
|
if (entities.length > 0) {
|
|
253654
253986
|
summaryLines.push(` - ${entities.length} ${entities.length === 1 ? "entity" : "entities"}`);
|
|
@@ -253656,6 +253988,9 @@ async function deployAction({ isNonInteractive, log }, options = {}) {
|
|
|
253656
253988
|
if (functions.length > 0) {
|
|
253657
253989
|
summaryLines.push(` - ${functions.length} ${functions.length === 1 ? "function" : "functions"}`);
|
|
253658
253990
|
}
|
|
253991
|
+
if (actors.length > 0) {
|
|
253992
|
+
summaryLines.push(` - ${actors.length} ${actors.length === 1 ? "actor" : "actors"}`);
|
|
253993
|
+
}
|
|
253659
253994
|
if (agents.length > 0) {
|
|
253660
253995
|
summaryLines.push(` - ${agents.length} ${agents.length === 1 ? "agent" : "agents"}`);
|
|
253661
253996
|
}
|
|
@@ -253698,7 +254033,7 @@ ${summaryLines.join(`
|
|
|
253698
254033
|
},
|
|
253699
254034
|
onFunctionResult: (r) => {
|
|
253700
254035
|
functionCompleted++;
|
|
253701
|
-
|
|
254036
|
+
formatDeployResult2(r, log);
|
|
253702
254037
|
}
|
|
253703
254038
|
});
|
|
253704
254039
|
const connectorResults = result.connectorResults ?? [];
|
|
@@ -253713,7 +254048,7 @@ ${summaryLines.join(`
|
|
|
253713
254048
|
}
|
|
253714
254049
|
return { outroMessage: "App deployed successfully" };
|
|
253715
254050
|
}
|
|
253716
|
-
function
|
|
254051
|
+
function getDeployCommand3() {
|
|
253717
254052
|
return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(deployAction);
|
|
253718
254053
|
}
|
|
253719
254054
|
async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
|
|
@@ -254107,7 +254442,7 @@ function getLogsCommand() {
|
|
|
254107
254442
|
}
|
|
254108
254443
|
|
|
254109
254444
|
// src/cli/commands/project/scaffold.ts
|
|
254110
|
-
import { basename as
|
|
254445
|
+
import { basename as basename6, resolve as resolve9 } from "node:path";
|
|
254111
254446
|
function resolveAppId(options) {
|
|
254112
254447
|
const appId = options.appId;
|
|
254113
254448
|
if (!appId) {
|
|
@@ -254124,7 +254459,7 @@ async function scaffoldAction(ctx, name2, options, command2) {
|
|
|
254124
254459
|
const { log, runTask: runTask2 } = ctx;
|
|
254125
254460
|
const appId = resolveAppId(command2.optsWithGlobals());
|
|
254126
254461
|
const resolvedPath = resolve9("./");
|
|
254127
|
-
const projectName = (name2 ??
|
|
254462
|
+
const projectName = (name2 ?? basename6(resolvedPath)).trim();
|
|
254128
254463
|
const template2 = await getTemplateById("backend-only");
|
|
254129
254464
|
log.info(`Scaffolding project at ${resolvedPath}`);
|
|
254130
254465
|
const { projectId } = await runTask2("Setting up your project...", async () => {
|
|
@@ -254289,7 +254624,7 @@ function withSandboxAuthHint(error48) {
|
|
|
254289
254624
|
cause: error48
|
|
254290
254625
|
});
|
|
254291
254626
|
}
|
|
254292
|
-
async function callTool(appId, tool, payload,
|
|
254627
|
+
async function callTool(appId, tool, payload, schema12, context, timeout2 = 60000) {
|
|
254293
254628
|
const client = getSandboxClient(appId);
|
|
254294
254629
|
let response;
|
|
254295
254630
|
try {
|
|
@@ -254297,7 +254632,7 @@ async function callTool(appId, tool, payload, schema11, context, timeout2 = 6000
|
|
|
254297
254632
|
} catch (error48) {
|
|
254298
254633
|
throw withSandboxAuthHint(await ApiError.fromHttpError(error48, context));
|
|
254299
254634
|
}
|
|
254300
|
-
const result =
|
|
254635
|
+
const result = schema12.safeParse(await response.json());
|
|
254301
254636
|
if (!result.success) {
|
|
254302
254637
|
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
254303
254638
|
}
|
|
@@ -254335,10 +254670,6 @@ async function resolveFlagOrStdin(flagValue, flagName) {
|
|
|
254335
254670
|
}
|
|
254336
254671
|
return readStdin(flagName, { trim: false });
|
|
254337
254672
|
}
|
|
254338
|
-
function toJsonStdout(result) {
|
|
254339
|
-
return `${JSON.stringify(result, null, 2)}
|
|
254340
|
-
`;
|
|
254341
|
-
}
|
|
254342
254673
|
function parsePositiveInt(value, flagName) {
|
|
254343
254674
|
if (value === undefined) {
|
|
254344
254675
|
return;
|
|
@@ -254642,6 +254973,7 @@ function getSiteCommand() {
|
|
|
254642
254973
|
// src/core/types/generator.ts
|
|
254643
254974
|
var import_common_tags = __toESM(require_lib2(), 1);
|
|
254644
254975
|
var import_json_schema_to_typescript = __toESM(require_src3(), 1);
|
|
254976
|
+
import { join as join26 } from "node:path";
|
|
254645
254977
|
var HEADER2 = import_common_tags.stripIndent`
|
|
254646
254978
|
// Auto-generated by Base44 CLI - DO NOT EDIT
|
|
254647
254979
|
// Regenerate with: base44 types generate
|
|
@@ -254650,24 +254982,43 @@ var EMPTY_TEMPLATE = import_common_tags.stripIndent`
|
|
|
254650
254982
|
// Auto-generated by Base44 CLI - DO NOT EDIT
|
|
254651
254983
|
// Regenerate with: base44 types
|
|
254652
254984
|
//
|
|
254653
|
-
// No entities, functions, agents, or
|
|
254654
|
-
// Add resources to base44/entities/, base44/functions/, base44/agents/, or base44/
|
|
254985
|
+
// No entities, functions, agents, connectors, or actors found in project.
|
|
254986
|
+
// Add resources to base44/entities/, base44/functions/, base44/agents/, base44/connectors/, or base44/actors/
|
|
254655
254987
|
// and run \`base44 types generate\` again.
|
|
254656
254988
|
|
|
254657
254989
|
declare module '@base44/sdk' {
|
|
254658
254990
|
// No types to augment - add resources and regenerate
|
|
254659
254991
|
}
|
|
254660
254992
|
`;
|
|
254993
|
+
var SDK_PACKAGE_NAMES = ["@base44/sdk", "@base44-preview/sdk"];
|
|
254994
|
+
async function detectSdkPackageName(projectRoot) {
|
|
254995
|
+
try {
|
|
254996
|
+
const pkg = await readJsonFile(join26(projectRoot, "package.json"));
|
|
254997
|
+
const deps = {
|
|
254998
|
+
...pkg.dependencies,
|
|
254999
|
+
...pkg.devDependencies
|
|
255000
|
+
};
|
|
255001
|
+
for (const name2 of SDK_PACKAGE_NAMES) {
|
|
255002
|
+
if (name2 in deps)
|
|
255003
|
+
return name2;
|
|
255004
|
+
}
|
|
255005
|
+
} catch {}
|
|
255006
|
+
return "@base44/sdk";
|
|
255007
|
+
}
|
|
254661
255008
|
async function generateTypesFile(input) {
|
|
254662
255009
|
const content = await generateContent(input);
|
|
254663
255010
|
await writeFile(getTypesOutputPath(input.projectRoot), content);
|
|
254664
255011
|
}
|
|
254665
255012
|
async function generateContent(input) {
|
|
254666
|
-
const { entities, functions, agents, connectors } = input;
|
|
254667
|
-
|
|
255013
|
+
const { entities, functions, agents, connectors, actors } = input;
|
|
255014
|
+
const sdkPackage = await detectSdkPackageName(input.projectRoot);
|
|
255015
|
+
if (!entities.length && !functions.length && !agents.length && !connectors.length && !actors.length) {
|
|
254668
255016
|
return EMPTY_TEMPLATE;
|
|
254669
255017
|
}
|
|
254670
|
-
const entityInterfaces = await Promise.all(
|
|
255018
|
+
const [entityInterfaces, actorResults] = await Promise.all([
|
|
255019
|
+
Promise.all(entities.map((e8) => compileEntity(e8))),
|
|
255020
|
+
Promise.all(actors.map((a5) => compileActor(a5)))
|
|
255021
|
+
]);
|
|
254671
255022
|
const registryEntries = [
|
|
254672
255023
|
[
|
|
254673
255024
|
"EntityTypeRegistry",
|
|
@@ -254675,29 +255026,48 @@ async function generateContent(input) {
|
|
|
254675
255026
|
],
|
|
254676
255027
|
["FunctionNameRegistry", functions.map((f7) => `"${f7.name}": true;`)],
|
|
254677
255028
|
["AgentNameRegistry", agents.map((a5) => `"${a5.name}": true;`)],
|
|
254678
|
-
["ConnectorTypeRegistry", connectors.map((c8) => `"${c8.type}": true;`)]
|
|
255029
|
+
["ConnectorTypeRegistry", connectors.map((c8) => `"${c8.type}": true;`)],
|
|
255030
|
+
["ActorNameRegistry", actors.map((a5) => `"${a5.name}": true;`)],
|
|
255031
|
+
[
|
|
255032
|
+
"ActorRegistry",
|
|
255033
|
+
actors.filter((a5) => a5.messageSchema).map((a5) => {
|
|
255034
|
+
const idx = actors.indexOf(a5);
|
|
255035
|
+
return `"${a5.name}": ${actorResults[idx].entry};`;
|
|
255036
|
+
})
|
|
255037
|
+
]
|
|
254679
255038
|
];
|
|
254680
255039
|
const registries2 = registryEntries.filter(([, entries]) => entries.length > 0).map(([name2, entries]) => registry2(name2, entries));
|
|
255040
|
+
const actorInterfaces = actorResults.map((r5) => r5.decls).filter(Boolean);
|
|
255041
|
+
const actorRuntimeModule = actors.length ? import_common_tags.source`
|
|
255042
|
+
declare module 'base44:runtime/actors' {
|
|
255043
|
+
export { Actor, type Conn, type ActorRegistry } from '${sdkPackage}';
|
|
255044
|
+
}
|
|
255045
|
+
` : "";
|
|
254681
255046
|
return [
|
|
254682
255047
|
HEADER2,
|
|
255048
|
+
"export {};",
|
|
254683
255049
|
entityInterfaces.join(`
|
|
254684
255050
|
|
|
255051
|
+
`),
|
|
255052
|
+
actorInterfaces.join(`
|
|
255053
|
+
|
|
254685
255054
|
`),
|
|
254686
255055
|
import_common_tags.source`
|
|
254687
|
-
declare module '
|
|
255056
|
+
declare module '${sdkPackage}' {
|
|
254688
255057
|
${registries2.join(`
|
|
254689
255058
|
|
|
254690
255059
|
`)}
|
|
254691
255060
|
}
|
|
254692
|
-
|
|
255061
|
+
`,
|
|
255062
|
+
actorRuntimeModule
|
|
254693
255063
|
].filter(Boolean).join(`
|
|
254694
255064
|
|
|
254695
255065
|
`);
|
|
254696
255066
|
}
|
|
254697
255067
|
async function compileEntity(entity2) {
|
|
254698
|
-
const { name: name2, source: _source, ...
|
|
255068
|
+
const { name: name2, source: _source, ...schema12 } = entity2;
|
|
254699
255069
|
const jsonSchema = {
|
|
254700
|
-
...
|
|
255070
|
+
...schema12,
|
|
254701
255071
|
title: name2,
|
|
254702
255072
|
additionalProperties: false
|
|
254703
255073
|
};
|
|
@@ -254712,6 +255082,81 @@ async function compileEntity(entity2) {
|
|
|
254712
255082
|
throw new TypeGenerationError(`Failed to generate types for entity "${name2}"`, name2, error48);
|
|
254713
255083
|
}
|
|
254714
255084
|
}
|
|
255085
|
+
async function compileActor(actor) {
|
|
255086
|
+
const { messageSchema } = actor;
|
|
255087
|
+
if (!messageSchema) {
|
|
255088
|
+
return { decls: "", entry: "{ toClient: unknown; toServer: unknown }" };
|
|
255089
|
+
}
|
|
255090
|
+
const prefix = toPascalCase(actor.name);
|
|
255091
|
+
const types = messageSchema.types ?? {};
|
|
255092
|
+
const toClient = messageSchema.toClient ?? {};
|
|
255093
|
+
const toServer = messageSchema.toServer ?? {};
|
|
255094
|
+
const typeName = (key2) => `${prefix}${toPascalCase(key2)}`;
|
|
255095
|
+
const msgName = (dir, key2) => `${prefix}${dir}${toPascalCase(key2)}`;
|
|
255096
|
+
const defs = {};
|
|
255097
|
+
const add = (name2, schema12) => {
|
|
255098
|
+
if (name2 in defs) {
|
|
255099
|
+
throw new TypeGenerationError(`Duplicate generated type "${name2}" in actor "${actor.name}" — a shared type and a message resolve to the same name.`, actor.name);
|
|
255100
|
+
}
|
|
255101
|
+
defs[name2] = { ...schema12, title: name2 };
|
|
255102
|
+
};
|
|
255103
|
+
for (const [key2, schema12] of Object.entries(types)) {
|
|
255104
|
+
add(typeName(key2), rewriteTypeRefs(schema12, typeName));
|
|
255105
|
+
}
|
|
255106
|
+
const compileMessages = (msgs, dir) => Object.entries(msgs).map(([key2, schema12]) => {
|
|
255107
|
+
const name2 = msgName(dir, key2);
|
|
255108
|
+
const rewritten = rewriteTypeRefs(schema12, typeName);
|
|
255109
|
+
add(name2, {
|
|
255110
|
+
type: "object",
|
|
255111
|
+
...rewritten,
|
|
255112
|
+
properties: { type: { const: key2 }, ...rewritten.properties ?? {} },
|
|
255113
|
+
required: [
|
|
255114
|
+
"type",
|
|
255115
|
+
...rewritten.required ?? []
|
|
255116
|
+
],
|
|
255117
|
+
additionalProperties: false
|
|
255118
|
+
});
|
|
255119
|
+
return name2;
|
|
255120
|
+
});
|
|
255121
|
+
const toClientNames = compileMessages(toClient, "ToClient");
|
|
255122
|
+
const toServerNames = compileMessages(toServer, "ToServer");
|
|
255123
|
+
const allNames = [...toClientNames, ...toServerNames];
|
|
255124
|
+
const rootName = `${prefix}Message`;
|
|
255125
|
+
const rootSchema = {
|
|
255126
|
+
title: rootName,
|
|
255127
|
+
$defs: defs,
|
|
255128
|
+
oneOf: allNames.map((n5) => ({ $ref: `#/$defs/${n5}` }))
|
|
255129
|
+
};
|
|
255130
|
+
let decls = "";
|
|
255131
|
+
try {
|
|
255132
|
+
decls = (await import_json_schema_to_typescript.compile(rootSchema, rootName, {
|
|
255133
|
+
bannerComment: "",
|
|
255134
|
+
additionalProperties: false,
|
|
255135
|
+
strictIndexSignatures: true
|
|
255136
|
+
})).trim();
|
|
255137
|
+
} catch (error48) {
|
|
255138
|
+
throw new TypeGenerationError(`Failed to generate types for actor "${actor.name}"`, actor.name, error48);
|
|
255139
|
+
}
|
|
255140
|
+
const union2 = (names) => names.length ? names.join(" | ") : "never";
|
|
255141
|
+
return {
|
|
255142
|
+
decls,
|
|
255143
|
+
entry: `{ toClient: ${union2(toClientNames)}; toServer: ${union2(toServerNames)} }`
|
|
255144
|
+
};
|
|
255145
|
+
}
|
|
255146
|
+
function rewriteTypeRefs(node, defName) {
|
|
255147
|
+
if (Array.isArray(node)) {
|
|
255148
|
+
return node.map((n5) => rewriteTypeRefs(n5, defName));
|
|
255149
|
+
}
|
|
255150
|
+
if (node && typeof node === "object") {
|
|
255151
|
+
const out = {};
|
|
255152
|
+
for (const [key2, value] of Object.entries(node)) {
|
|
255153
|
+
const match = key2 === "$ref" && typeof value === "string" ? value.match(/^#\/types\/(.+)$/) : null;
|
|
255154
|
+
out[key2] = match ? `#/$defs/${defName(match[1])}` : rewriteTypeRefs(value, defName);
|
|
255155
|
+
}
|
|
255156
|
+
return out;
|
|
255157
|
+
}
|
|
255158
|
+
return node;
|
|
255159
|
+
}
|
|
254715
255160
|
function registry2(name2, entries) {
|
|
254716
255161
|
return import_common_tags.source`
|
|
254717
255162
|
interface ${name2} {
|
|
@@ -254724,10 +255169,10 @@ function toPascalCase(name2) {
|
|
|
254724
255169
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
254725
255170
|
}
|
|
254726
255171
|
// src/core/types/update-project.ts
|
|
254727
|
-
import { join as
|
|
255172
|
+
import { join as join27 } from "node:path";
|
|
254728
255173
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
254729
255174
|
async function updateProjectConfig(projectRoot) {
|
|
254730
|
-
const tsconfigPath =
|
|
255175
|
+
const tsconfigPath = join27(projectRoot, "tsconfig.json");
|
|
254731
255176
|
if (!await pathExists(tsconfigPath)) {
|
|
254732
255177
|
return false;
|
|
254733
255178
|
}
|
|
@@ -254751,14 +255196,15 @@ var TYPES_FILE_PATH = "base44/.types/types.d.ts";
|
|
|
254751
255196
|
async function generateTypesAction({
|
|
254752
255197
|
runTask: runTask2
|
|
254753
255198
|
}) {
|
|
254754
|
-
const { entities, functions, agents, connectors, project: project2 } = await readProjectConfig();
|
|
255199
|
+
const { entities, functions, agents, connectors, actors, project: project2 } = await readProjectConfig();
|
|
254755
255200
|
await runTask2("Generating types", async () => {
|
|
254756
255201
|
await generateTypesFile({
|
|
254757
255202
|
projectRoot: project2.root,
|
|
254758
255203
|
entities,
|
|
254759
255204
|
functions,
|
|
254760
255205
|
agents,
|
|
254761
|
-
connectors
|
|
255206
|
+
connectors,
|
|
255207
|
+
actors
|
|
254762
255208
|
});
|
|
254763
255209
|
});
|
|
254764
255210
|
const tsconfigUpdated = await updateProjectConfig(project2.root);
|
|
@@ -254776,10 +255222,6 @@ function getTypesCommand() {
|
|
|
254776
255222
|
}
|
|
254777
255223
|
|
|
254778
255224
|
// src/cli/commands/workspace/shared.ts
|
|
254779
|
-
function toJsonStdout2(result) {
|
|
254780
|
-
return `${JSON.stringify(result, null, 2)}
|
|
254781
|
-
`;
|
|
254782
|
-
}
|
|
254783
255225
|
function workspaceTag(workspace2) {
|
|
254784
255226
|
const role = workspace2.userRole ?? "member";
|
|
254785
255227
|
return workspace2.isPersonal ? `personal, ${role}` : role;
|
|
@@ -254798,7 +255240,7 @@ async function getWorkspaceAction({ runTask: runTask2, log, jsonMode }, workspac
|
|
|
254798
255240
|
if (jsonMode) {
|
|
254799
255241
|
return {
|
|
254800
255242
|
outroMessage: workspace2.name,
|
|
254801
|
-
stdout:
|
|
255243
|
+
stdout: toJsonStdout(workspace2)
|
|
254802
255244
|
};
|
|
254803
255245
|
}
|
|
254804
255246
|
log.message(` ${theme.styles.bold(workspace2.name)} ${theme.styles.dim(`[${workspaceTag(workspace2)}]`)}
|
|
@@ -254811,71 +255253,40 @@ function getWorkspaceGetCommand() {
|
|
|
254811
255253
|
}
|
|
254812
255254
|
|
|
254813
255255
|
// src/cli/commands/workspace/list.ts
|
|
254814
|
-
function pluralize2(n5) {
|
|
254815
|
-
return `${n5} workspace${n5 !== 1 ? "s" : ""}`;
|
|
254816
|
-
}
|
|
254817
255256
|
async function listWorkspacesAction({ log, runTask: runTask2, jsonMode }, options8) {
|
|
254818
255257
|
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
255258
|
if (options8.role) {
|
|
254823
255259
|
const role = options8.role.toLowerCase();
|
|
254824
255260
|
workspaces = workspaces.filter((w8) => w8.userRole?.toLowerCase() === role);
|
|
254825
255261
|
}
|
|
255262
|
+
const summary = `${workspaces.length} workspace${workspaces.length !== 1 ? "s" : ""}`;
|
|
254826
255263
|
if (jsonMode) {
|
|
254827
|
-
return {
|
|
254828
|
-
outroMessage: pluralize2(workspaces.length),
|
|
254829
|
-
stdout: toJsonStdout2(workspaces)
|
|
254830
|
-
};
|
|
255264
|
+
return { outroMessage: summary, stdout: toJsonStdout(workspaces) };
|
|
254831
255265
|
}
|
|
254832
255266
|
for (const workspace2 of workspaces) {
|
|
254833
255267
|
log.message(` ${theme.styles.bold(workspace2.name)} ${theme.styles.dim(`[${workspaceTag(workspace2)}]`)}
|
|
254834
255268
|
${theme.styles.dim(workspace2.id)}`);
|
|
254835
255269
|
}
|
|
254836
|
-
return { outroMessage:
|
|
255270
|
+
return { outroMessage: summary };
|
|
254837
255271
|
}
|
|
254838
255272
|
function getWorkspaceListCommand() {
|
|
254839
|
-
return new Base44Command("list", { requireAppContext: false }).description("List the workspaces you belong to").option("--
|
|
255273
|
+
return new Base44Command("list", { requireAppContext: false }).description("List the workspaces you belong to").option("--role <role>", "Only workspaces where your role matches (owner, admin, editor, viewer)").action(listWorkspacesAction);
|
|
254840
255274
|
}
|
|
254841
255275
|
|
|
254842
255276
|
// src/cli/commands/workspace/move.ts
|
|
254843
|
-
function
|
|
254844
|
-
|
|
254845
|
-
|
|
254846
|
-
|
|
254847
|
-
|
|
254848
|
-
|
|
254849
|
-
|
|
254850
|
-
|
|
254851
|
-
|
|
254852
|
-
|
|
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) {
|
|
255277
|
+
async function promptForTargetWorkspace(ctx, appId) {
|
|
255278
|
+
const { workspaces, currentWorkspaceId } = await ctx.runTask("Fetching workspaces...", async () => {
|
|
255279
|
+
const [workspaces2, app] = await Promise.all([
|
|
255280
|
+
listWorkspaces(),
|
|
255281
|
+
getApp(appId)
|
|
255282
|
+
]);
|
|
255283
|
+
return { workspaces: workspaces2, currentWorkspaceId: app.organizationId };
|
|
255284
|
+
}, { errorMessage: "Failed to fetch workspaces" });
|
|
255285
|
+
const destinations = workspaces.filter((w8) => w8.id !== currentWorkspaceId);
|
|
255286
|
+
if (destinations.length === 0) {
|
|
254876
255287
|
throw new InvalidInputError("No other workspaces available to move this app into.");
|
|
254877
255288
|
}
|
|
254878
|
-
const options8 =
|
|
255289
|
+
const options8 = destinations.map((w8) => ({
|
|
254879
255290
|
value: w8.id,
|
|
254880
255291
|
label: `${w8.name} (${w8.userRole ?? "member"})`
|
|
254881
255292
|
}));
|
|
@@ -254886,42 +255297,64 @@ async function resolveTargetWorkspace(target, workspaces, currentWorkspaceId, is
|
|
|
254886
255297
|
if (Ct(selected)) {
|
|
254887
255298
|
onPromptCancel();
|
|
254888
255299
|
}
|
|
254889
|
-
|
|
255300
|
+
const targetWorkspaceId = selected;
|
|
255301
|
+
const nameOf = (id2) => workspaces.find((w8) => w8.id === id2)?.name ?? id2 ?? "unknown workspace";
|
|
255302
|
+
return {
|
|
255303
|
+
targetWorkspaceId,
|
|
255304
|
+
fromName: nameOf(currentWorkspaceId),
|
|
255305
|
+
toName: nameOf(targetWorkspaceId)
|
|
255306
|
+
};
|
|
254890
255307
|
}
|
|
254891
255308
|
async function moveAction(ctx, target, options8) {
|
|
254892
255309
|
const { runTask: runTask2, isNonInteractive, jsonMode } = ctx;
|
|
254893
255310
|
const isInteractive = !isNonInteractive && !jsonMode;
|
|
254894
255311
|
const { id: appId } = getAppContext();
|
|
254895
|
-
|
|
254896
|
-
|
|
254897
|
-
|
|
254898
|
-
|
|
254899
|
-
|
|
254900
|
-
|
|
254901
|
-
|
|
254902
|
-
|
|
254903
|
-
|
|
254904
|
-
|
|
254905
|
-
|
|
254906
|
-
|
|
254907
|
-
|
|
254908
|
-
|
|
255312
|
+
let targetWorkspaceId;
|
|
255313
|
+
let toLabel;
|
|
255314
|
+
if (target) {
|
|
255315
|
+
targetWorkspaceId = target;
|
|
255316
|
+
toLabel = target;
|
|
255317
|
+
if (isInteractive && !options8.yes) {
|
|
255318
|
+
const proceed = await Re({
|
|
255319
|
+
message: `Move this app to workspace ${theme.styles.bold(target)}?`
|
|
255320
|
+
});
|
|
255321
|
+
if (Ct(proceed)) {
|
|
255322
|
+
onPromptCancel();
|
|
255323
|
+
}
|
|
255324
|
+
if (!proceed) {
|
|
255325
|
+
return { outroMessage: "Move cancelled" };
|
|
255326
|
+
}
|
|
254909
255327
|
}
|
|
254910
|
-
|
|
254911
|
-
|
|
255328
|
+
} else if (isInteractive) {
|
|
255329
|
+
const picked = await promptForTargetWorkspace(ctx, appId);
|
|
255330
|
+
targetWorkspaceId = picked.targetWorkspaceId;
|
|
255331
|
+
toLabel = picked.toName;
|
|
255332
|
+
if (!options8.yes) {
|
|
255333
|
+
const proceed = await Re({
|
|
255334
|
+
message: `Move this app from ${theme.styles.bold(picked.fromName)} to ${theme.styles.bold(picked.toName)}?`
|
|
255335
|
+
});
|
|
255336
|
+
if (Ct(proceed)) {
|
|
255337
|
+
onPromptCancel();
|
|
255338
|
+
}
|
|
255339
|
+
if (!proceed) {
|
|
255340
|
+
return { outroMessage: "Move cancelled" };
|
|
255341
|
+
}
|
|
254912
255342
|
}
|
|
255343
|
+
} else {
|
|
255344
|
+
throw new InvalidInputError("A target workspace ID is required in non-interactive mode.", {
|
|
255345
|
+
hints: [
|
|
255346
|
+
{ message: "Usage: base44 workspace move <workspace-id>" },
|
|
255347
|
+
{ message: "Run 'base44 workspace list' to see your workspaces" }
|
|
255348
|
+
]
|
|
255349
|
+
});
|
|
254913
255350
|
}
|
|
254914
255351
|
const result = await runTask2("Moving app to workspace...", () => moveAppToWorkspace(appId, targetWorkspaceId, {
|
|
254915
255352
|
disconnectIntegrations: options8.disconnectIntegrations
|
|
254916
255353
|
}), { errorMessage: "Failed to move app" });
|
|
254917
|
-
const targetName = workspaceName(workspaces, targetWorkspaceId);
|
|
254918
255354
|
if (jsonMode) {
|
|
254919
|
-
return {
|
|
254920
|
-
outroMessage: `App moved to ${targetName}`,
|
|
254921
|
-
stdout: toJsonStdout2(result)
|
|
254922
|
-
};
|
|
255355
|
+
return { outroMessage: "App moved", stdout: toJsonStdout(result) };
|
|
254923
255356
|
}
|
|
254924
|
-
return { outroMessage: `App moved to ${theme.styles.bold(
|
|
255357
|
+
return { outroMessage: `App moved to ${theme.styles.bold(toLabel)}` };
|
|
254925
255358
|
}
|
|
254926
255359
|
function getWorkspaceMoveCommand() {
|
|
254927
255360
|
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", `
|
|
@@ -254938,7 +255371,7 @@ function getWorkspaceCommand() {
|
|
|
254938
255371
|
// src/cli/dev/dev-server/main.ts
|
|
254939
255372
|
var import_cors = __toESM(require_lib4(), 1);
|
|
254940
255373
|
var import_express6 = __toESM(require_express(), 1);
|
|
254941
|
-
import { dirname as
|
|
255374
|
+
import { dirname as dirname24, join as join30 } from "node:path";
|
|
254942
255375
|
|
|
254943
255376
|
// ../../node_modules/get-port/index.js
|
|
254944
255377
|
import net from "node:net";
|
|
@@ -254959,8 +255392,8 @@ var getLocalHosts = () => {
|
|
|
254959
255392
|
const interfaces = os9.networkInterfaces();
|
|
254960
255393
|
const results = new Set([undefined, "0.0.0.0"]);
|
|
254961
255394
|
for (const _interface of Object.values(interfaces)) {
|
|
254962
|
-
for (const
|
|
254963
|
-
results.add(
|
|
255395
|
+
for (const config13 of _interface) {
|
|
255396
|
+
results.add(config13.address);
|
|
254964
255397
|
}
|
|
254965
255398
|
}
|
|
254966
255399
|
return results;
|
|
@@ -255600,22 +256033,22 @@ class Database {
|
|
|
255600
256033
|
this.schemas.clear();
|
|
255601
256034
|
}
|
|
255602
256035
|
validate(entityName, record2, partial2 = false) {
|
|
255603
|
-
const
|
|
255604
|
-
if (!
|
|
256036
|
+
const schema12 = this.schemas.get(this.normalizeName(entityName));
|
|
256037
|
+
if (!schema12) {
|
|
255605
256038
|
throw new Error(`Entity "${entityName}" not found`);
|
|
255606
256039
|
}
|
|
255607
|
-
return this.validator.validate(record2,
|
|
256040
|
+
return this.validator.validate(record2, schema12, partial2);
|
|
255608
256041
|
}
|
|
255609
256042
|
prepareRecord(entityName, record2, partial2 = false) {
|
|
255610
|
-
const
|
|
255611
|
-
if (!
|
|
256043
|
+
const schema12 = this.schemas.get(this.normalizeName(entityName));
|
|
256044
|
+
if (!schema12) {
|
|
255612
256045
|
throw new Error(`Entity "${entityName}" not found`);
|
|
255613
256046
|
}
|
|
255614
|
-
const filteredRecord = this.validator.filterFields(record2,
|
|
256047
|
+
const filteredRecord = this.validator.filterFields(record2, schema12);
|
|
255615
256048
|
if (partial2) {
|
|
255616
256049
|
return filteredRecord;
|
|
255617
256050
|
}
|
|
255618
|
-
return this.validator.applyDefaults(filteredRecord,
|
|
256051
|
+
return this.validator.applyDefaults(filteredRecord, schema12);
|
|
255619
256052
|
}
|
|
255620
256053
|
normalizeName(entityName) {
|
|
255621
256054
|
return entityName.toLowerCase();
|
|
@@ -255909,13 +256342,13 @@ function checkRLS(rule, record2, user) {
|
|
|
255909
256342
|
return false;
|
|
255910
256343
|
return evaluateCondition(rule, record2, user);
|
|
255911
256344
|
}
|
|
255912
|
-
function applyFLS(record2,
|
|
256345
|
+
function applyFLS(record2, schema12, user, operation) {
|
|
255913
256346
|
if (Array.isArray(record2)) {
|
|
255914
|
-
return record2.map((r5) => applyFLS(r5,
|
|
256347
|
+
return record2.map((r5) => applyFLS(r5, schema12, user, operation));
|
|
255915
256348
|
}
|
|
255916
256349
|
const result = {};
|
|
255917
256350
|
for (const [key2, value] of Object.entries(record2)) {
|
|
255918
|
-
const rule =
|
|
256351
|
+
const rule = schema12.properties[key2]?.rls?.[operation];
|
|
255919
256352
|
if (rule === undefined || checkRLS(rule, record2, user)) {
|
|
255920
256353
|
result[key2] = value;
|
|
255921
256354
|
}
|
|
@@ -256143,14 +256576,14 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
256143
256576
|
res.status(404).json({ error: `Entity "${entityName}" not found` });
|
|
256144
256577
|
return;
|
|
256145
256578
|
}
|
|
256146
|
-
const
|
|
256147
|
-
if (!
|
|
256579
|
+
const schema12 = db2.getSchema(entityName);
|
|
256580
|
+
if (!schema12) {
|
|
256148
256581
|
res.status(404).json({ error: `Schema for "${entityName}" not found` });
|
|
256149
256582
|
return;
|
|
256150
256583
|
}
|
|
256151
256584
|
const currentUserResult = await resolveCurrentUser(db2, req);
|
|
256152
256585
|
const currentUser = currentUserResult.ok ? currentUserResult.user : undefined;
|
|
256153
|
-
await handler(req, res, collection,
|
|
256586
|
+
await handler(req, res, collection, schema12, currentUser);
|
|
256154
256587
|
};
|
|
256155
256588
|
}
|
|
256156
256589
|
function emit(appId, entityName, type, data) {
|
|
@@ -256168,19 +256601,19 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
256168
256601
|
}
|
|
256169
256602
|
broadcast(appId, entityName, createData(data));
|
|
256170
256603
|
}
|
|
256171
|
-
function prepareCreateRecord(entityName, body,
|
|
256604
|
+
function prepareCreateRecord(entityName, body, schema12, currentUser, now) {
|
|
256172
256605
|
const { _id, ...recordBody } = body;
|
|
256173
256606
|
const ownerFields = {
|
|
256174
256607
|
created_by: currentUser?.email,
|
|
256175
256608
|
created_by_id: currentUser?.id
|
|
256176
256609
|
};
|
|
256177
|
-
if (!checkRLS(
|
|
256610
|
+
if (!checkRLS(schema12.rls?.create, {
|
|
256178
256611
|
...recordBody,
|
|
256179
256612
|
...ownerFields
|
|
256180
256613
|
}, currentUser)) {
|
|
256181
256614
|
return;
|
|
256182
256615
|
}
|
|
256183
|
-
const filteredBody = applyFLS(db2.prepareRecord(entityName, recordBody),
|
|
256616
|
+
const filteredBody = applyFLS(db2.prepareRecord(entityName, recordBody), schema12, currentUser, "write");
|
|
256184
256617
|
db2.validate(entityName, filteredBody);
|
|
256185
256618
|
return {
|
|
256186
256619
|
...filteredBody,
|
|
@@ -256192,7 +256625,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
256192
256625
|
}
|
|
256193
256626
|
const userRouter = createUserRouter(db2, logger2);
|
|
256194
256627
|
router.use("/User", userRouter);
|
|
256195
|
-
router.get("/:entityName/:id", withCollection(async (req, res, collection,
|
|
256628
|
+
router.get("/:entityName/:id", withCollection(async (req, res, collection, schema12, currentUser) => {
|
|
256196
256629
|
const { entityName, id: id2 } = req.params;
|
|
256197
256630
|
try {
|
|
256198
256631
|
const doc2 = await collection.findOneAsync({ id: id2 });
|
|
@@ -256200,27 +256633,27 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
256200
256633
|
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
256201
256634
|
return;
|
|
256202
256635
|
}
|
|
256203
|
-
if (!checkRLS(
|
|
256636
|
+
if (!checkRLS(schema12.rls?.read, doc2, currentUser)) {
|
|
256204
256637
|
res.status(404).json({
|
|
256205
256638
|
message: `Entity ${entityName} with ID ${id2} not found`
|
|
256206
256639
|
});
|
|
256207
256640
|
return;
|
|
256208
256641
|
}
|
|
256209
|
-
const result = applyFLS(stripInternalFields(doc2),
|
|
256642
|
+
const result = applyFLS(stripInternalFields(doc2), schema12, currentUser, "read");
|
|
256210
256643
|
res.json(result);
|
|
256211
256644
|
} catch (error48) {
|
|
256212
256645
|
logger2.error(`Error in GET /${entityName}/${id2}:`, error48);
|
|
256213
256646
|
res.status(500).json({ error: "Internal server error" });
|
|
256214
256647
|
}
|
|
256215
256648
|
}));
|
|
256216
|
-
router.get("/:entityName", withCollection(async (req, res, collection,
|
|
256649
|
+
router.get("/:entityName", withCollection(async (req, res, collection, schema12, currentUser) => {
|
|
256217
256650
|
const { entityName } = req.params;
|
|
256218
256651
|
try {
|
|
256219
256652
|
let results = stripInternalFields(await queryEntity(collection, req.query));
|
|
256220
|
-
if (
|
|
256221
|
-
results = results.filter((doc2) => checkRLS(
|
|
256653
|
+
if (schema12.rls?.read !== undefined && schema12.rls.read !== true) {
|
|
256654
|
+
results = results.filter((doc2) => checkRLS(schema12.rls.read, doc2, currentUser));
|
|
256222
256655
|
}
|
|
256223
|
-
results = results.map((doc2) => applyFLS(doc2,
|
|
256656
|
+
results = results.map((doc2) => applyFLS(doc2, schema12, currentUser, "read"));
|
|
256224
256657
|
res.json(results);
|
|
256225
256658
|
} catch (error48) {
|
|
256226
256659
|
if (error48 instanceof InvalidInputError) {
|
|
@@ -256231,16 +256664,16 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
256231
256664
|
}
|
|
256232
256665
|
}
|
|
256233
256666
|
}));
|
|
256234
|
-
router.post("/:entityName", parseBody, withCollection(async (req, res, collection,
|
|
256667
|
+
router.post("/:entityName", parseBody, withCollection(async (req, res, collection, schema12, currentUser) => {
|
|
256235
256668
|
const { appId, entityName } = req.params;
|
|
256236
256669
|
try {
|
|
256237
256670
|
const now = new Date().toISOString();
|
|
256238
|
-
const record2 = prepareCreateRecord(entityName, req.body,
|
|
256671
|
+
const record2 = prepareCreateRecord(entityName, req.body, schema12, currentUser, now);
|
|
256239
256672
|
if (!record2) {
|
|
256240
256673
|
res.status(403).json({ error: "Permission denied" });
|
|
256241
256674
|
return;
|
|
256242
256675
|
}
|
|
256243
|
-
const inserted = applyFLS(stripInternalFields(await collection.insertAsync(record2)),
|
|
256676
|
+
const inserted = applyFLS(stripInternalFields(await collection.insertAsync(record2)), schema12, currentUser, "read");
|
|
256244
256677
|
emit(appId, entityName, "create", inserted);
|
|
256245
256678
|
res.status(201).json(inserted);
|
|
256246
256679
|
} catch (error48) {
|
|
@@ -256252,7 +256685,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
256252
256685
|
res.status(500).json({ error: "Internal server error" });
|
|
256253
256686
|
}
|
|
256254
256687
|
}));
|
|
256255
|
-
router.post("/:entityName/bulk", parseBody, withCollection(async (req, res, collection,
|
|
256688
|
+
router.post("/:entityName/bulk", parseBody, withCollection(async (req, res, collection, schema12, currentUser) => {
|
|
256256
256689
|
const { appId, entityName } = req.params;
|
|
256257
256690
|
if (!Array.isArray(req.body)) {
|
|
256258
256691
|
res.status(400).json({ error: "Request body must be an array" });
|
|
@@ -256262,14 +256695,14 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
256262
256695
|
const now = new Date().toISOString();
|
|
256263
256696
|
const records = [];
|
|
256264
256697
|
for (const body of req.body) {
|
|
256265
|
-
const record2 = prepareCreateRecord(entityName, body,
|
|
256698
|
+
const record2 = prepareCreateRecord(entityName, body, schema12, currentUser, now);
|
|
256266
256699
|
if (!record2) {
|
|
256267
256700
|
res.status(403).json({ error: "Permission denied" });
|
|
256268
256701
|
return;
|
|
256269
256702
|
}
|
|
256270
256703
|
records.push(record2);
|
|
256271
256704
|
}
|
|
256272
|
-
const inserted = applyFLS(stripInternalFields(await collection.insertAsync(records)),
|
|
256705
|
+
const inserted = applyFLS(stripInternalFields(await collection.insertAsync(records)), schema12, currentUser, "read");
|
|
256273
256706
|
emit(appId, entityName, "create", inserted);
|
|
256274
256707
|
res.status(201).json(inserted);
|
|
256275
256708
|
} catch (error48) {
|
|
@@ -256281,24 +256714,24 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
256281
256714
|
res.status(500).json({ error: "Internal server error" });
|
|
256282
256715
|
}
|
|
256283
256716
|
}));
|
|
256284
|
-
router.put("/:entityName/:id", parseBody, withCollection(async (req, res, collection,
|
|
256717
|
+
router.put("/:entityName/:id", parseBody, withCollection(async (req, res, collection, schema12, currentUser) => {
|
|
256285
256718
|
const { appId, entityName, id: id2 } = req.params;
|
|
256286
256719
|
const { id: _id, created_date: _created_date, ...body } = req.body;
|
|
256287
256720
|
try {
|
|
256288
|
-
if (
|
|
256721
|
+
if (schema12.rls?.update !== undefined) {
|
|
256289
256722
|
const existing = await collection.findOneAsync({ id: id2 });
|
|
256290
256723
|
if (!existing) {
|
|
256291
256724
|
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
256292
256725
|
return;
|
|
256293
256726
|
}
|
|
256294
|
-
if (!checkRLS(
|
|
256727
|
+
if (!checkRLS(schema12.rls.update, existing, currentUser)) {
|
|
256295
256728
|
res.status(404).json({
|
|
256296
256729
|
message: `Entity ${entityName} with ID ${id2} not found`
|
|
256297
256730
|
});
|
|
256298
256731
|
return;
|
|
256299
256732
|
}
|
|
256300
256733
|
}
|
|
256301
|
-
const filteredBody = applyFLS(db2.prepareRecord(entityName, body, true),
|
|
256734
|
+
const filteredBody = applyFLS(db2.prepareRecord(entityName, body, true), schema12, currentUser, "write");
|
|
256302
256735
|
db2.validate(entityName, filteredBody, true);
|
|
256303
256736
|
const updateData = {
|
|
256304
256737
|
...filteredBody,
|
|
@@ -256309,7 +256742,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
256309
256742
|
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
256310
256743
|
return;
|
|
256311
256744
|
}
|
|
256312
|
-
const updated = applyFLS(stripInternalFields(result.affectedDocuments),
|
|
256745
|
+
const updated = applyFLS(stripInternalFields(result.affectedDocuments), schema12, currentUser, "read");
|
|
256313
256746
|
emit(appId, entityName, "update", updated);
|
|
256314
256747
|
res.json(updated);
|
|
256315
256748
|
} catch (error48) {
|
|
@@ -256321,7 +256754,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
256321
256754
|
res.status(500).json({ error: "Internal server error" });
|
|
256322
256755
|
}
|
|
256323
256756
|
}));
|
|
256324
|
-
router.delete("/:entityName/:id", withCollection(async (req, res, collection,
|
|
256757
|
+
router.delete("/:entityName/:id", withCollection(async (req, res, collection, schema12, currentUser) => {
|
|
256325
256758
|
const { appId, entityName, id: id2 } = req.params;
|
|
256326
256759
|
try {
|
|
256327
256760
|
const doc2 = await collection.findOneAsync({ id: id2 });
|
|
@@ -256329,7 +256762,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
256329
256762
|
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
256330
256763
|
return;
|
|
256331
256764
|
}
|
|
256332
|
-
if (!checkRLS(
|
|
256765
|
+
if (!checkRLS(schema12.rls?.delete, doc2, currentUser)) {
|
|
256333
256766
|
res.status(404).json({
|
|
256334
256767
|
message: `Entity ${entityName} with ID ${id2} not found`
|
|
256335
256768
|
});
|
|
@@ -256343,11 +256776,11 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
256343
256776
|
res.status(500).json({ error: "Internal server error" });
|
|
256344
256777
|
}
|
|
256345
256778
|
}));
|
|
256346
|
-
router.delete("/:entityName", parseBody, withCollection(async (req, res, collection,
|
|
256779
|
+
router.delete("/:entityName", parseBody, withCollection(async (req, res, collection, schema12, currentUser) => {
|
|
256347
256780
|
const { entityName } = req.params;
|
|
256348
256781
|
try {
|
|
256349
256782
|
const query = req.body || {};
|
|
256350
|
-
const rlsDelete =
|
|
256783
|
+
const rlsDelete = schema12?.rls?.delete;
|
|
256351
256784
|
if (rlsDelete !== undefined && rlsDelete !== true) {
|
|
256352
256785
|
if (rlsDelete === false && currentUser?.is_service !== true) {
|
|
256353
256786
|
res.status(403).json({ error: "Permission denied" });
|
|
@@ -256566,7 +256999,7 @@ class ServeRunner {
|
|
|
256566
256999
|
|
|
256567
257000
|
// src/cli/dev/dev-server/watcher.ts
|
|
256568
257001
|
import { EventEmitter as EventEmitter4 } from "node:events";
|
|
256569
|
-
import { relative as
|
|
257002
|
+
import { relative as relative8 } from "node:path";
|
|
256570
257003
|
|
|
256571
257004
|
// ../../node_modules/chokidar/index.js
|
|
256572
257005
|
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
@@ -256736,10 +257169,10 @@ class ReaddirpStream extends Readable6 {
|
|
|
256736
257169
|
}
|
|
256737
257170
|
async _formatEntry(dirent, path19) {
|
|
256738
257171
|
let entry;
|
|
256739
|
-
const
|
|
257172
|
+
const basename7 = this._isDirent ? dirent.name : dirent;
|
|
256740
257173
|
try {
|
|
256741
|
-
const fullPath = presolve(pjoin(path19,
|
|
256742
|
-
entry = { path: prelative(this._root, fullPath), fullPath, basename:
|
|
257174
|
+
const fullPath = presolve(pjoin(path19, basename7));
|
|
257175
|
+
entry = { path: prelative(this._root, fullPath), fullPath, basename: basename7 };
|
|
256743
257176
|
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
256744
257177
|
} catch (err) {
|
|
256745
257178
|
this._onError(err);
|
|
@@ -257266,9 +257699,9 @@ class NodeFsHandler {
|
|
|
257266
257699
|
_watchWithNodeFs(path19, listener) {
|
|
257267
257700
|
const opts = this.fsw.options;
|
|
257268
257701
|
const directory = sp2.dirname(path19);
|
|
257269
|
-
const
|
|
257702
|
+
const basename8 = sp2.basename(path19);
|
|
257270
257703
|
const parent = this.fsw._getWatchedDir(directory);
|
|
257271
|
-
parent.add(
|
|
257704
|
+
parent.add(basename8);
|
|
257272
257705
|
const absolutePath = sp2.resolve(path19);
|
|
257273
257706
|
const options8 = {
|
|
257274
257707
|
persistent: opts.persistent
|
|
@@ -257278,7 +257711,7 @@ class NodeFsHandler {
|
|
|
257278
257711
|
let closer;
|
|
257279
257712
|
if (opts.usePolling) {
|
|
257280
257713
|
const enableBin = opts.interval !== opts.binaryInterval;
|
|
257281
|
-
options8.interval = enableBin && isBinaryPath(
|
|
257714
|
+
options8.interval = enableBin && isBinaryPath(basename8) ? opts.binaryInterval : opts.interval;
|
|
257282
257715
|
closer = setFsWatchFileListener(path19, absolutePath, options8, {
|
|
257283
257716
|
listener,
|
|
257284
257717
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -257296,11 +257729,11 @@ class NodeFsHandler {
|
|
|
257296
257729
|
if (this.fsw.closed) {
|
|
257297
257730
|
return;
|
|
257298
257731
|
}
|
|
257299
|
-
const
|
|
257300
|
-
const
|
|
257301
|
-
const parent = this.fsw._getWatchedDir(
|
|
257732
|
+
const dirname23 = sp2.dirname(file2);
|
|
257733
|
+
const basename8 = sp2.basename(file2);
|
|
257734
|
+
const parent = this.fsw._getWatchedDir(dirname23);
|
|
257302
257735
|
let prevStats = stats;
|
|
257303
|
-
if (parent.has(
|
|
257736
|
+
if (parent.has(basename8))
|
|
257304
257737
|
return;
|
|
257305
257738
|
const listener = async (path19, newStats) => {
|
|
257306
257739
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
|
|
@@ -257325,9 +257758,9 @@ class NodeFsHandler {
|
|
|
257325
257758
|
prevStats = newStats2;
|
|
257326
257759
|
}
|
|
257327
257760
|
} catch (error48) {
|
|
257328
|
-
this.fsw._remove(
|
|
257761
|
+
this.fsw._remove(dirname23, basename8);
|
|
257329
257762
|
}
|
|
257330
|
-
} else if (parent.has(
|
|
257763
|
+
} else if (parent.has(basename8)) {
|
|
257331
257764
|
const at13 = newStats.atimeMs;
|
|
257332
257765
|
const mt12 = newStats.mtimeMs;
|
|
257333
257766
|
if (!at13 || at13 <= mt12 || mt12 !== prevStats.mtimeMs) {
|
|
@@ -257548,11 +257981,11 @@ function createPattern(matcher) {
|
|
|
257548
257981
|
if (matcher.path === string4)
|
|
257549
257982
|
return true;
|
|
257550
257983
|
if (matcher.recursive) {
|
|
257551
|
-
const
|
|
257552
|
-
if (!
|
|
257984
|
+
const relative8 = sp3.relative(matcher.path, string4);
|
|
257985
|
+
if (!relative8) {
|
|
257553
257986
|
return false;
|
|
257554
257987
|
}
|
|
257555
|
-
return !
|
|
257988
|
+
return !relative8.startsWith("..") && !sp3.isAbsolute(relative8);
|
|
257556
257989
|
}
|
|
257557
257990
|
return false;
|
|
257558
257991
|
};
|
|
@@ -258251,7 +258684,7 @@ class WatchBase44 extends EventEmitter4 {
|
|
|
258251
258684
|
ignoreInitial: true
|
|
258252
258685
|
});
|
|
258253
258686
|
watcher.on("all", import_debounce.default(async (_event, path19) => {
|
|
258254
|
-
this.emit("change", name2,
|
|
258687
|
+
this.emit("change", name2, relative8(targetPath, path19));
|
|
258255
258688
|
}, WATCH_DEBOUNCE_MS));
|
|
258256
258689
|
watcher.on("error", (err) => {
|
|
258257
258690
|
this.logger.error(`Watch handler failed for ${targetPath}`, err);
|
|
@@ -258358,8 +258791,8 @@ async function createDevServer(options8) {
|
|
|
258358
258791
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
258359
258792
|
};
|
|
258360
258793
|
const base44ConfigWatcher = new WatchBase44({
|
|
258361
|
-
functions:
|
|
258362
|
-
entities:
|
|
258794
|
+
functions: join30(dirname24(project2.configPath), project2.functionsDir),
|
|
258795
|
+
entities: join30(dirname24(project2.configPath), project2.entitiesDir)
|
|
258363
258796
|
}, devLogger);
|
|
258364
258797
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
258365
258798
|
try {
|
|
@@ -258488,17 +258921,14 @@ function getDevCommand() {
|
|
|
258488
258921
|
import { spawn as spawn4 } from "node:child_process";
|
|
258489
258922
|
import { copyFileSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
258490
258923
|
async function runScript(options8) {
|
|
258491
|
-
const { appId, code: code2 } = options8;
|
|
258924
|
+
const { appId, code: code2, local, privileged, dataEnv } = options8;
|
|
258492
258925
|
verifyDenoInstalled("to run scripts with exec");
|
|
258493
258926
|
const cleanupFns = [];
|
|
258494
258927
|
const tempScript = await $file({ postfix: ".ts" });
|
|
258495
258928
|
cleanupFns.push(tempScript.cleanup);
|
|
258496
258929
|
writeFileSync2(tempScript.path, code2, "utf-8");
|
|
258497
258930
|
const scriptPath = `file://${tempScript.path}`;
|
|
258498
|
-
const [appUserToken, appBaseUrl] = await Promise.all([
|
|
258499
|
-
getAppUserToken(),
|
|
258500
|
-
getSiteUrl()
|
|
258501
|
-
]);
|
|
258931
|
+
const [appUserToken, appBaseUrl] = local ? [local.token, local.serverUrl] : await Promise.all([getAppUserToken(), getSiteUrl()]);
|
|
258502
258932
|
const tempWrapper = await $file({ postfix: ".ts" });
|
|
258503
258933
|
cleanupFns.push(tempWrapper.cleanup);
|
|
258504
258934
|
copyFileSync(getExecWrapperPath(), tempWrapper.path);
|
|
@@ -258510,7 +258940,9 @@ async function runScript(options8) {
|
|
|
258510
258940
|
SCRIPT_PATH: scriptPath,
|
|
258511
258941
|
BASE44_APP_ID: appId,
|
|
258512
258942
|
BASE44_ACCESS_TOKEN: appUserToken,
|
|
258513
|
-
BASE44_APP_BASE_URL: appBaseUrl
|
|
258943
|
+
BASE44_APP_BASE_URL: appBaseUrl,
|
|
258944
|
+
...privileged ? { BASE44_PRIVILEGED: "true" } : {},
|
|
258945
|
+
...dataEnv ? { BASE44_DATA_ENV: dataEnv } : {}
|
|
258514
258946
|
},
|
|
258515
258947
|
stdio: "inherit"
|
|
258516
258948
|
});
|
|
@@ -258537,10 +258969,28 @@ function readStdin2() {
|
|
|
258537
258969
|
process.stdin.on("error", reject);
|
|
258538
258970
|
});
|
|
258539
258971
|
}
|
|
258540
|
-
|
|
258541
|
-
|
|
258542
|
-
|
|
258543
|
-
}
|
|
258972
|
+
function parsePort(value) {
|
|
258973
|
+
const port = Number(value);
|
|
258974
|
+
if (!Number.isInteger(port) || port <= 0 || port > 65535) {
|
|
258975
|
+
throw new InvalidInputError(`Invalid --port value: "${value}".`, {
|
|
258976
|
+
hints: [{ message: "Pass a port number, e.g. --port 4400" }]
|
|
258977
|
+
});
|
|
258978
|
+
}
|
|
258979
|
+
return port;
|
|
258980
|
+
}
|
|
258981
|
+
async function resolveLocalTarget(port) {
|
|
258982
|
+
const { email: email3 } = await readAuth();
|
|
258983
|
+
return {
|
|
258984
|
+
serverUrl: `http://localhost:${port}`,
|
|
258985
|
+
token: createJwtToken(email3)
|
|
258986
|
+
};
|
|
258987
|
+
}
|
|
258988
|
+
async function execAction({ app, isNonInteractive }, options8) {
|
|
258989
|
+
if (options8.port !== undefined && !options8.local) {
|
|
258990
|
+
throw new InvalidInputError("--port can only be used with --local.", {
|
|
258991
|
+
hints: [{ message: "Usage: base44 exec --local --port <port>" }]
|
|
258992
|
+
});
|
|
258993
|
+
}
|
|
258544
258994
|
const noInputError = new InvalidInputError("No input provided. Pipe a script to stdin.", {
|
|
258545
258995
|
hints: [
|
|
258546
258996
|
{ message: "File: cat ./script.ts | base44 exec" },
|
|
@@ -258556,22 +259006,33 @@ async function execAction({
|
|
|
258556
259006
|
if (!code2.trim()) {
|
|
258557
259007
|
throw noInputError;
|
|
258558
259008
|
}
|
|
258559
|
-
const
|
|
259009
|
+
const local = options8.local ? await resolveLocalTarget(options8.port !== undefined ? parsePort(options8.port) : DEFAULT_DEV_SERVER_PORT) : undefined;
|
|
259010
|
+
const { exitCode } = await runScript({
|
|
259011
|
+
appId: app.id,
|
|
259012
|
+
code: code2,
|
|
259013
|
+
local,
|
|
259014
|
+
privileged: options8.privileged,
|
|
259015
|
+
dataEnv: options8.dataEnv
|
|
259016
|
+
});
|
|
258560
259017
|
if (exitCode !== 0) {
|
|
258561
259018
|
process.exitCode = exitCode;
|
|
258562
259019
|
}
|
|
258563
259020
|
return {};
|
|
258564
259021
|
}
|
|
258565
259022
|
function getExecCommand() {
|
|
258566
|
-
return new Base44Command("exec").description("Run a script with the Base44 SDK pre-authenticated as the current user").addHelpText("after", `
|
|
259023
|
+
return new Base44Command("exec").description("Run a script with the Base44 SDK pre-authenticated as the current user").option("--local", "Run against the local `base44 dev` server instead of the deployed app").option("--port <number>", `Port the local dev server is on (with --local; defaults to ${DEFAULT_DEV_SERVER_PORT})`).option("--privileged", "Run with admin privileges (bypass RLS). Requires app owner/editor role.").option("--data-env <environment>", "Data environment to run against (e.g. dev, prod)").addHelpText("after", `
|
|
258567
259024
|
Examples:
|
|
258568
259025
|
Run a script file:
|
|
258569
259026
|
$ cat ./script.ts | base44 exec
|
|
258570
259027
|
|
|
258571
259028
|
Inline script:
|
|
258572
|
-
$ echo "const users = await base44.entities.User.list()" | base44 exec
|
|
258573
|
-
|
|
258574
|
-
|
|
259029
|
+
$ echo "const users = await base44.entities.User.list()" | base44 exec
|
|
259030
|
+
|
|
259031
|
+
Against the local dev server (base44 dev must be running):
|
|
259032
|
+
$ echo "await base44.entities.Task.create({ title: 'seed' })" | base44 exec --local
|
|
259033
|
+
|
|
259034
|
+
With privileged access (bypass RLS):
|
|
259035
|
+
$ echo "const all = await base44.entities.Task.list()" | base44 exec --privileged`).action(execAction);
|
|
258575
259036
|
}
|
|
258576
259037
|
|
|
258577
259038
|
// src/cli/commands/project/eject.ts
|
|
@@ -258701,7 +259162,7 @@ function createProgram(context) {
|
|
|
258701
259162
|
program2.addCommand(getCreateCommand());
|
|
258702
259163
|
program2.addCommand(getScaffoldCommand());
|
|
258703
259164
|
program2.addCommand(getDashboardCommand());
|
|
258704
|
-
program2.addCommand(
|
|
259165
|
+
program2.addCommand(getDeployCommand3());
|
|
258705
259166
|
program2.addCommand(getVisibilityCommand());
|
|
258706
259167
|
program2.addCommand(getLinkCommand());
|
|
258707
259168
|
program2.addCommand(getEjectCommand());
|
|
@@ -258710,6 +259171,7 @@ function createProgram(context) {
|
|
|
258710
259171
|
program2.addCommand(getAgentsCommand());
|
|
258711
259172
|
program2.addCommand(getConnectorsCommand());
|
|
258712
259173
|
program2.addCommand(getFunctionsCommand());
|
|
259174
|
+
program2.addCommand(getActorCommand());
|
|
258713
259175
|
program2.addCommand(getSecretsCommand());
|
|
258714
259176
|
program2.addCommand(getSandboxCommand());
|
|
258715
259177
|
program2.addCommand(getAuthCommand());
|
|
@@ -258726,7 +259188,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
258726
259188
|
import { release, type } from "node:os";
|
|
258727
259189
|
|
|
258728
259190
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
258729
|
-
import { dirname as
|
|
259191
|
+
import { dirname as dirname25, posix, sep } from "path";
|
|
258730
259192
|
function createModulerModifier() {
|
|
258731
259193
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
258732
259194
|
return async (frames) => {
|
|
@@ -258735,7 +259197,7 @@ function createModulerModifier() {
|
|
|
258735
259197
|
return frames;
|
|
258736
259198
|
};
|
|
258737
259199
|
}
|
|
258738
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
259200
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname25(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
|
|
258739
259201
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
258740
259202
|
return (filename) => {
|
|
258741
259203
|
if (!filename)
|
|
@@ -262924,9 +263386,9 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
262924
263386
|
});
|
|
262925
263387
|
}
|
|
262926
263388
|
// src/cli/index.ts
|
|
262927
|
-
var __dirname4 =
|
|
263389
|
+
var __dirname4 = dirname26(fileURLToPath6(import.meta.url));
|
|
262928
263390
|
async function runCLI(options8) {
|
|
262929
|
-
ensureNpmAssets(
|
|
263391
|
+
ensureNpmAssets(join31(__dirname4, "../assets"));
|
|
262930
263392
|
const errorReporter = new ErrorReporter;
|
|
262931
263393
|
errorReporter.registerProcessErrorHandlers();
|
|
262932
263394
|
const jsonMode = process.argv.includes("--json");
|
|
@@ -262965,4 +263427,4 @@ export {
|
|
|
262965
263427
|
CLIExitError
|
|
262966
263428
|
};
|
|
262967
263429
|
|
|
262968
|
-
//# debugId=
|
|
263430
|
+
//# debugId=DEF1A357833E27DE64756E2164756E21
|