@base44-preview/cli 0.1.8-pr.589.9d22ef2 → 0.1.9-pr.555.465f5ca
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/README.md +2 -0
- package/dist/assets/templates/backend-and-client/package.json +2 -1
- package/dist/assets/templates/backend-and-client/src/api/base44Client.js +12 -0
- package/dist/assets/templates/backend-and-client/src/lib/app-params.js +28 -0
- package/dist/assets/templates/backend-and-client/vite.config.js +3 -8
- package/dist/cli/index.js +1524 -837
- package/dist/cli/index.js.map +46 -30
- package/package.json +1 -1
- package/dist/assets/templates/backend-and-client/src/api/base44Client.js.ejs +0 -5
package/dist/cli/index.js
CHANGED
|
@@ -12978,12 +12978,12 @@ var require_schema = __commonJS((exports, module) => {
|
|
|
12978
12978
|
var common = require_common3();
|
|
12979
12979
|
var YAMLException = require_exception();
|
|
12980
12980
|
var Type = require_type();
|
|
12981
|
-
function compileList(
|
|
12981
|
+
function compileList(schema3, name2, result) {
|
|
12982
12982
|
var exclude = [];
|
|
12983
|
-
|
|
12983
|
+
schema3.include.forEach(function(includedSchema) {
|
|
12984
12984
|
result = compileList(includedSchema, name2, result);
|
|
12985
12985
|
});
|
|
12986
|
-
|
|
12986
|
+
schema3[name2].forEach(function(currentType) {
|
|
12987
12987
|
result.forEach(function(previousType, previousIndex) {
|
|
12988
12988
|
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
|
|
12989
12989
|
exclude.push(previousIndex);
|
|
@@ -13040,8 +13040,8 @@ var require_schema = __commonJS((exports, module) => {
|
|
|
13040
13040
|
}
|
|
13041
13041
|
schemas3 = common.toArray(schemas3);
|
|
13042
13042
|
types = common.toArray(types);
|
|
13043
|
-
if (!schemas3.every(function(
|
|
13044
|
-
return
|
|
13043
|
+
if (!schemas3.every(function(schema3) {
|
|
13044
|
+
return schema3 instanceof Schema;
|
|
13045
13045
|
})) {
|
|
13046
13046
|
throw new YAMLException("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");
|
|
13047
13047
|
}
|
|
@@ -15062,7 +15062,7 @@ var require_dumper = __commonJS((exports, module) => {
|
|
|
15062
15062
|
"Off",
|
|
15063
15063
|
"OFF"
|
|
15064
15064
|
];
|
|
15065
|
-
function compileStyleMap(
|
|
15065
|
+
function compileStyleMap(schema3, map2) {
|
|
15066
15066
|
var result, keys, index, length, tag, style, type;
|
|
15067
15067
|
if (map2 === null)
|
|
15068
15068
|
return {};
|
|
@@ -15074,7 +15074,7 @@ var require_dumper = __commonJS((exports, module) => {
|
|
|
15074
15074
|
if (tag.slice(0, 2) === "!!") {
|
|
15075
15075
|
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
15076
15076
|
}
|
|
15077
|
-
type =
|
|
15077
|
+
type = schema3.compiledTypeMap["fallback"][tag];
|
|
15078
15078
|
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
|
15079
15079
|
style = type.styleAliases[style];
|
|
15080
15080
|
}
|
|
@@ -16369,7 +16369,7 @@ var require_createNode = __commonJS((exports) => {
|
|
|
16369
16369
|
if (value instanceof String || value instanceof Number || value instanceof Boolean || typeof BigInt !== "undefined" && value instanceof BigInt) {
|
|
16370
16370
|
value = value.valueOf();
|
|
16371
16371
|
}
|
|
16372
|
-
const { aliasDuplicateObjects, onAnchor, onTagObj, schema:
|
|
16372
|
+
const { aliasDuplicateObjects, onAnchor, onTagObj, schema: schema3, sourceObjects } = ctx;
|
|
16373
16373
|
let ref = undefined;
|
|
16374
16374
|
if (aliasDuplicateObjects && value && typeof value === "object") {
|
|
16375
16375
|
ref = sourceObjects.get(value);
|
|
@@ -16383,7 +16383,7 @@ var require_createNode = __commonJS((exports) => {
|
|
|
16383
16383
|
}
|
|
16384
16384
|
if (tagName?.startsWith("!!"))
|
|
16385
16385
|
tagName = defaultTagPrefix + tagName.slice(2);
|
|
16386
|
-
let tagObj = findTagObject(value, tagName,
|
|
16386
|
+
let tagObj = findTagObject(value, tagName, schema3.tags);
|
|
16387
16387
|
if (!tagObj) {
|
|
16388
16388
|
if (value && typeof value.toJSON === "function") {
|
|
16389
16389
|
value = value.toJSON();
|
|
@@ -16394,7 +16394,7 @@ var require_createNode = __commonJS((exports) => {
|
|
|
16394
16394
|
ref.node = node2;
|
|
16395
16395
|
return node2;
|
|
16396
16396
|
}
|
|
16397
|
-
tagObj = value instanceof Map ?
|
|
16397
|
+
tagObj = value instanceof Map ? schema3[identity.MAP] : (Symbol.iterator in Object(value)) ? schema3[identity.SEQ] : schema3[identity.MAP];
|
|
16398
16398
|
}
|
|
16399
16399
|
if (onTagObj) {
|
|
16400
16400
|
onTagObj(tagObj);
|
|
@@ -16417,7 +16417,7 @@ var require_Collection = __commonJS((exports) => {
|
|
|
16417
16417
|
var createNode = require_createNode();
|
|
16418
16418
|
var identity = require_identity();
|
|
16419
16419
|
var Node2 = require_Node();
|
|
16420
|
-
function collectionFromPath(
|
|
16420
|
+
function collectionFromPath(schema3, path11, value) {
|
|
16421
16421
|
let v = value;
|
|
16422
16422
|
for (let i = path11.length - 1;i >= 0; --i) {
|
|
16423
16423
|
const k2 = path11[i];
|
|
@@ -16435,27 +16435,27 @@ var require_Collection = __commonJS((exports) => {
|
|
|
16435
16435
|
onAnchor: () => {
|
|
16436
16436
|
throw new Error("This should not happen, please report a bug.");
|
|
16437
16437
|
},
|
|
16438
|
-
schema:
|
|
16438
|
+
schema: schema3,
|
|
16439
16439
|
sourceObjects: new Map
|
|
16440
16440
|
});
|
|
16441
16441
|
}
|
|
16442
16442
|
var isEmptyPath = (path11) => path11 == null || typeof path11 === "object" && !!path11[Symbol.iterator]().next().done;
|
|
16443
16443
|
|
|
16444
16444
|
class Collection extends Node2.NodeBase {
|
|
16445
|
-
constructor(type,
|
|
16445
|
+
constructor(type, schema3) {
|
|
16446
16446
|
super(type);
|
|
16447
16447
|
Object.defineProperty(this, "schema", {
|
|
16448
|
-
value:
|
|
16448
|
+
value: schema3,
|
|
16449
16449
|
configurable: true,
|
|
16450
16450
|
enumerable: false,
|
|
16451
16451
|
writable: true
|
|
16452
16452
|
});
|
|
16453
16453
|
}
|
|
16454
|
-
clone(
|
|
16454
|
+
clone(schema3) {
|
|
16455
16455
|
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
16456
|
-
if (
|
|
16457
|
-
copy.schema =
|
|
16458
|
-
copy.items = copy.items.map((it3) => identity.isNode(it3) || identity.isPair(it3) ? it3.clone(
|
|
16456
|
+
if (schema3)
|
|
16457
|
+
copy.schema = schema3;
|
|
16458
|
+
copy.items = copy.items.map((it3) => identity.isNode(it3) || identity.isPair(it3) ? it3.clone(schema3) : it3);
|
|
16459
16459
|
if (this.range)
|
|
16460
16460
|
copy.range = this.range.slice();
|
|
16461
16461
|
return copy;
|
|
@@ -17387,12 +17387,12 @@ var require_Pair = __commonJS((exports) => {
|
|
|
17387
17387
|
this.key = key;
|
|
17388
17388
|
this.value = value;
|
|
17389
17389
|
}
|
|
17390
|
-
clone(
|
|
17390
|
+
clone(schema3) {
|
|
17391
17391
|
let { key, value } = this;
|
|
17392
17392
|
if (identity.isNode(key))
|
|
17393
|
-
key = key.clone(
|
|
17393
|
+
key = key.clone(schema3);
|
|
17394
17394
|
if (identity.isNode(value))
|
|
17395
|
-
value = value.clone(
|
|
17395
|
+
value = value.clone(schema3);
|
|
17396
17396
|
return new Pair(key, value);
|
|
17397
17397
|
}
|
|
17398
17398
|
toJSON(_2, ctx) {
|
|
@@ -17577,13 +17577,13 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
17577
17577
|
static get tagName() {
|
|
17578
17578
|
return "tag:yaml.org,2002:map";
|
|
17579
17579
|
}
|
|
17580
|
-
constructor(
|
|
17581
|
-
super(identity.MAP,
|
|
17580
|
+
constructor(schema3) {
|
|
17581
|
+
super(identity.MAP, schema3);
|
|
17582
17582
|
this.items = [];
|
|
17583
17583
|
}
|
|
17584
|
-
static from(
|
|
17584
|
+
static from(schema3, obj, ctx) {
|
|
17585
17585
|
const { keepUndefined, replacer } = ctx;
|
|
17586
|
-
const map2 = new this(
|
|
17586
|
+
const map2 = new this(schema3);
|
|
17587
17587
|
const add = (key, value) => {
|
|
17588
17588
|
if (typeof replacer === "function")
|
|
17589
17589
|
value = replacer.call(obj, key, value);
|
|
@@ -17599,8 +17599,8 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
17599
17599
|
for (const key of Object.keys(obj))
|
|
17600
17600
|
add(key, obj[key]);
|
|
17601
17601
|
}
|
|
17602
|
-
if (typeof
|
|
17603
|
-
map2.items.sort(
|
|
17602
|
+
if (typeof schema3.sortMapEntries === "function") {
|
|
17603
|
+
map2.items.sort(schema3.sortMapEntries);
|
|
17604
17604
|
}
|
|
17605
17605
|
return map2;
|
|
17606
17606
|
}
|
|
@@ -17693,7 +17693,7 @@ var require_map2 = __commonJS((exports) => {
|
|
|
17693
17693
|
onError("Expected a mapping for this tag");
|
|
17694
17694
|
return map3;
|
|
17695
17695
|
},
|
|
17696
|
-
createNode: (
|
|
17696
|
+
createNode: (schema3, obj, ctx) => YAMLMap.YAMLMap.from(schema3, obj, ctx)
|
|
17697
17697
|
};
|
|
17698
17698
|
exports.map = map2;
|
|
17699
17699
|
});
|
|
@@ -17711,8 +17711,8 @@ var require_YAMLSeq = __commonJS((exports) => {
|
|
|
17711
17711
|
static get tagName() {
|
|
17712
17712
|
return "tag:yaml.org,2002:seq";
|
|
17713
17713
|
}
|
|
17714
|
-
constructor(
|
|
17715
|
-
super(identity.SEQ,
|
|
17714
|
+
constructor(schema3) {
|
|
17715
|
+
super(identity.SEQ, schema3);
|
|
17716
17716
|
this.items = [];
|
|
17717
17717
|
}
|
|
17718
17718
|
add(value) {
|
|
@@ -17766,9 +17766,9 @@ var require_YAMLSeq = __commonJS((exports) => {
|
|
|
17766
17766
|
onComment
|
|
17767
17767
|
});
|
|
17768
17768
|
}
|
|
17769
|
-
static from(
|
|
17769
|
+
static from(schema3, obj, ctx) {
|
|
17770
17770
|
const { replacer } = ctx;
|
|
17771
|
-
const seq = new this(
|
|
17771
|
+
const seq = new this(schema3);
|
|
17772
17772
|
if (obj && Symbol.iterator in Object(obj)) {
|
|
17773
17773
|
let i = 0;
|
|
17774
17774
|
for (let it3 of obj) {
|
|
@@ -17805,7 +17805,7 @@ var require_seq2 = __commonJS((exports) => {
|
|
|
17805
17805
|
onError("Expected a sequence for this tag");
|
|
17806
17806
|
return seq2;
|
|
17807
17807
|
},
|
|
17808
|
-
createNode: (
|
|
17808
|
+
createNode: (schema3, obj, ctx) => YAMLSeq.YAMLSeq.from(schema3, obj, ctx)
|
|
17809
17809
|
};
|
|
17810
17810
|
exports.seq = seq;
|
|
17811
17811
|
});
|
|
@@ -17980,7 +17980,7 @@ var require_schema2 = __commonJS((exports) => {
|
|
|
17980
17980
|
var bool = require_bool2();
|
|
17981
17981
|
var float = require_float2();
|
|
17982
17982
|
var int2 = require_int2();
|
|
17983
|
-
var
|
|
17983
|
+
var schema3 = [
|
|
17984
17984
|
map2.map,
|
|
17985
17985
|
seq.seq,
|
|
17986
17986
|
string4.string,
|
|
@@ -17993,7 +17993,7 @@ var require_schema2 = __commonJS((exports) => {
|
|
|
17993
17993
|
float.floatExp,
|
|
17994
17994
|
float.float
|
|
17995
17995
|
];
|
|
17996
|
-
exports.schema =
|
|
17996
|
+
exports.schema = schema3;
|
|
17997
17997
|
});
|
|
17998
17998
|
|
|
17999
17999
|
// ../../node_modules/yaml/dist/schema/json/schema.js
|
|
@@ -18056,8 +18056,8 @@ var require_schema3 = __commonJS((exports) => {
|
|
|
18056
18056
|
return str;
|
|
18057
18057
|
}
|
|
18058
18058
|
};
|
|
18059
|
-
var
|
|
18060
|
-
exports.schema =
|
|
18059
|
+
var schema3 = [map2.map, seq.seq].concat(jsonScalars, jsonError);
|
|
18060
|
+
exports.schema = schema3;
|
|
18061
18061
|
});
|
|
18062
18062
|
|
|
18063
18063
|
// ../../node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
@@ -18147,9 +18147,9 @@ ${cn.comment}` : item.comment;
|
|
|
18147
18147
|
onError("Expected a sequence for this tag");
|
|
18148
18148
|
return seq;
|
|
18149
18149
|
}
|
|
18150
|
-
function createPairs(
|
|
18150
|
+
function createPairs(schema3, iterable, ctx) {
|
|
18151
18151
|
const { replacer } = ctx;
|
|
18152
|
-
const pairs2 = new YAMLSeq.YAMLSeq(
|
|
18152
|
+
const pairs2 = new YAMLSeq.YAMLSeq(schema3);
|
|
18153
18153
|
pairs2.tag = "tag:yaml.org,2002:pairs";
|
|
18154
18154
|
let i = 0;
|
|
18155
18155
|
if (iterable && Symbol.iterator in Object(iterable))
|
|
@@ -18228,8 +18228,8 @@ var require_omap2 = __commonJS((exports) => {
|
|
|
18228
18228
|
}
|
|
18229
18229
|
return map2;
|
|
18230
18230
|
}
|
|
18231
|
-
static from(
|
|
18232
|
-
const pairs$1 = pairs.createPairs(
|
|
18231
|
+
static from(schema3, iterable, ctx) {
|
|
18232
|
+
const pairs$1 = pairs.createPairs(schema3, iterable, ctx);
|
|
18233
18233
|
const omap2 = new this;
|
|
18234
18234
|
omap2.items = pairs$1.items;
|
|
18235
18235
|
return omap2;
|
|
@@ -18256,7 +18256,7 @@ var require_omap2 = __commonJS((exports) => {
|
|
|
18256
18256
|
}
|
|
18257
18257
|
return Object.assign(new YAMLOMap, pairs$1);
|
|
18258
18258
|
},
|
|
18259
|
-
createNode: (
|
|
18259
|
+
createNode: (schema3, iterable, ctx) => YAMLOMap.from(schema3, iterable, ctx)
|
|
18260
18260
|
};
|
|
18261
18261
|
exports.YAMLOMap = YAMLOMap;
|
|
18262
18262
|
exports.omap = omap;
|
|
@@ -18420,8 +18420,8 @@ var require_set2 = __commonJS((exports) => {
|
|
|
18420
18420
|
var YAMLMap = require_YAMLMap();
|
|
18421
18421
|
|
|
18422
18422
|
class YAMLSet extends YAMLMap.YAMLMap {
|
|
18423
|
-
constructor(
|
|
18424
|
-
super(
|
|
18423
|
+
constructor(schema3) {
|
|
18424
|
+
super(schema3);
|
|
18425
18425
|
this.tag = YAMLSet.tag;
|
|
18426
18426
|
}
|
|
18427
18427
|
add(key) {
|
|
@@ -18461,9 +18461,9 @@ var require_set2 = __commonJS((exports) => {
|
|
|
18461
18461
|
else
|
|
18462
18462
|
throw new Error("Set items must all have null values");
|
|
18463
18463
|
}
|
|
18464
|
-
static from(
|
|
18464
|
+
static from(schema3, iterable, ctx) {
|
|
18465
18465
|
const { replacer } = ctx;
|
|
18466
|
-
const set3 = new this(
|
|
18466
|
+
const set3 = new this(schema3);
|
|
18467
18467
|
if (iterable && Symbol.iterator in Object(iterable))
|
|
18468
18468
|
for (let value of iterable) {
|
|
18469
18469
|
if (typeof replacer === "function")
|
|
@@ -18480,7 +18480,7 @@ var require_set2 = __commonJS((exports) => {
|
|
|
18480
18480
|
nodeClass: YAMLSet,
|
|
18481
18481
|
default: false,
|
|
18482
18482
|
tag: "tag:yaml.org,2002:set",
|
|
18483
|
-
createNode: (
|
|
18483
|
+
createNode: (schema3, iterable, ctx) => YAMLSet.from(schema3, iterable, ctx),
|
|
18484
18484
|
resolve(map2, onError) {
|
|
18485
18485
|
if (identity.isMap(map2)) {
|
|
18486
18486
|
if (map2.hasAllNullValues(true))
|
|
@@ -18593,7 +18593,7 @@ var require_schema4 = __commonJS((exports) => {
|
|
|
18593
18593
|
var pairs = require_pairs2();
|
|
18594
18594
|
var set2 = require_set2();
|
|
18595
18595
|
var timestamp = require_timestamp2();
|
|
18596
|
-
var
|
|
18596
|
+
var schema3 = [
|
|
18597
18597
|
map2.map,
|
|
18598
18598
|
seq.seq,
|
|
18599
18599
|
string4.string,
|
|
@@ -18616,7 +18616,7 @@ var require_schema4 = __commonJS((exports) => {
|
|
|
18616
18616
|
timestamp.floatTime,
|
|
18617
18617
|
timestamp.timestamp
|
|
18618
18618
|
];
|
|
18619
|
-
exports.schema =
|
|
18619
|
+
exports.schema = schema3;
|
|
18620
18620
|
});
|
|
18621
18621
|
|
|
18622
18622
|
// ../../node_modules/yaml/dist/schema/tags.js
|
|
@@ -18628,7 +18628,7 @@ var require_tags = __commonJS((exports) => {
|
|
|
18628
18628
|
var bool = require_bool2();
|
|
18629
18629
|
var float = require_float2();
|
|
18630
18630
|
var int2 = require_int2();
|
|
18631
|
-
var
|
|
18631
|
+
var schema3 = require_schema2();
|
|
18632
18632
|
var schema$1 = require_schema3();
|
|
18633
18633
|
var binary = require_binary2();
|
|
18634
18634
|
var merge3 = require_merge3();
|
|
@@ -18638,7 +18638,7 @@ var require_tags = __commonJS((exports) => {
|
|
|
18638
18638
|
var set2 = require_set2();
|
|
18639
18639
|
var timestamp = require_timestamp2();
|
|
18640
18640
|
var schemas3 = new Map([
|
|
18641
|
-
["core",
|
|
18641
|
+
["core", schema3.schema],
|
|
18642
18642
|
["failsafe", [map2.map, seq.seq, string4.string]],
|
|
18643
18643
|
["json", schema$1.schema],
|
|
18644
18644
|
["yaml11", schema$2.schema],
|
|
@@ -18720,9 +18720,9 @@ var require_Schema = __commonJS((exports) => {
|
|
|
18720
18720
|
var sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
|
|
18721
18721
|
|
|
18722
18722
|
class Schema {
|
|
18723
|
-
constructor({ compat: compat2, customTags, merge: merge3, resolveKnownTags, schema:
|
|
18723
|
+
constructor({ compat: compat2, customTags, merge: merge3, resolveKnownTags, schema: schema3, sortMapEntries, toStringDefaults }) {
|
|
18724
18724
|
this.compat = Array.isArray(compat2) ? tags.getTags(compat2, "compat") : compat2 ? tags.getTags(null, compat2) : null;
|
|
18725
|
-
this.name = typeof
|
|
18725
|
+
this.name = typeof schema3 === "string" && schema3 || "core";
|
|
18726
18726
|
this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
|
|
18727
18727
|
this.tags = tags.getTags(customTags, this.name, merge3);
|
|
18728
18728
|
this.toStringOptions = toStringDefaults ?? null;
|
|
@@ -20214,11 +20214,11 @@ var require_compose_scalar = __commonJS((exports) => {
|
|
|
20214
20214
|
scalar.comment = comment;
|
|
20215
20215
|
return scalar;
|
|
20216
20216
|
}
|
|
20217
|
-
function findScalarTagByName(
|
|
20217
|
+
function findScalarTagByName(schema3, value, tagName, tagToken, onError) {
|
|
20218
20218
|
if (tagName === "!")
|
|
20219
|
-
return
|
|
20219
|
+
return schema3[identity.SCALAR];
|
|
20220
20220
|
const matchWithTest = [];
|
|
20221
|
-
for (const tag of
|
|
20221
|
+
for (const tag of schema3.tags) {
|
|
20222
20222
|
if (!tag.collection && tag.tag === tagName) {
|
|
20223
20223
|
if (tag.default && tag.test)
|
|
20224
20224
|
matchWithTest.push(tag);
|
|
@@ -20229,18 +20229,18 @@ var require_compose_scalar = __commonJS((exports) => {
|
|
|
20229
20229
|
for (const tag of matchWithTest)
|
|
20230
20230
|
if (tag.test?.test(value))
|
|
20231
20231
|
return tag;
|
|
20232
|
-
const kt3 =
|
|
20232
|
+
const kt3 = schema3.knownTags[tagName];
|
|
20233
20233
|
if (kt3 && !kt3.collection) {
|
|
20234
|
-
|
|
20234
|
+
schema3.tags.push(Object.assign({}, kt3, { default: false, test: undefined }));
|
|
20235
20235
|
return kt3;
|
|
20236
20236
|
}
|
|
20237
20237
|
onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, tagName !== "tag:yaml.org,2002:str");
|
|
20238
|
-
return
|
|
20238
|
+
return schema3[identity.SCALAR];
|
|
20239
20239
|
}
|
|
20240
|
-
function findScalarTagByTest({ atKey, directives, schema:
|
|
20241
|
-
const tag =
|
|
20242
|
-
if (
|
|
20243
|
-
const compat2 =
|
|
20240
|
+
function findScalarTagByTest({ atKey, directives, schema: schema3 }, value, token, onError) {
|
|
20241
|
+
const tag = schema3.tags.find((tag2) => (tag2.default === true || atKey && tag2.default === "key") && tag2.test?.test(value)) || schema3[identity.SCALAR];
|
|
20242
|
+
if (schema3.compat) {
|
|
20243
|
+
const compat2 = schema3.compat.find((tag2) => tag2.default && tag2.test?.test(value)) ?? schema3[identity.SCALAR];
|
|
20244
20244
|
if (tag.tag !== compat2.tag) {
|
|
20245
20245
|
const ts = directives.tagString(tag.tag);
|
|
20246
20246
|
const cs = directives.tagString(compat2.tag);
|
|
@@ -22784,10 +22784,10 @@ var require_ejs = __commonJS((exports) => {
|
|
|
22784
22784
|
exports.localsName = _DEFAULT_LOCALS_NAME;
|
|
22785
22785
|
exports.promiseImpl = new Function("return this;")().Promise;
|
|
22786
22786
|
exports.resolveInclude = function(name2, filename, isDir) {
|
|
22787
|
-
var
|
|
22787
|
+
var dirname11 = path11.dirname;
|
|
22788
22788
|
var extname = path11.extname;
|
|
22789
22789
|
var resolve3 = path11.resolve;
|
|
22790
|
-
var includePath = resolve3(isDir ? filename :
|
|
22790
|
+
var includePath = resolve3(isDir ? filename : dirname11(filename), name2);
|
|
22791
22791
|
var ext = extname(name2);
|
|
22792
22792
|
if (!ext) {
|
|
22793
22793
|
includePath += ".ejs";
|
|
@@ -23165,10 +23165,10 @@ var require_ejs = __commonJS((exports) => {
|
|
|
23165
23165
|
};
|
|
23166
23166
|
if (opts.filename && typeof Object.defineProperty === "function") {
|
|
23167
23167
|
var filename = opts.filename;
|
|
23168
|
-
var
|
|
23168
|
+
var basename5 = path11.basename(filename, path11.extname(filename));
|
|
23169
23169
|
try {
|
|
23170
23170
|
Object.defineProperty(returnedFn, "name", {
|
|
23171
|
-
value:
|
|
23171
|
+
value: basename5,
|
|
23172
23172
|
writable: false,
|
|
23173
23173
|
enumerable: false,
|
|
23174
23174
|
configurable: true
|
|
@@ -119578,11 +119578,11 @@ function chooseDescription(descriptions, printWidth) {
|
|
|
119578
119578
|
return firstWidth > printWidth && firstWidth > secondWidth ? secondDescription : firstDescription;
|
|
119579
119579
|
}
|
|
119580
119580
|
function createSchema(SchemaConstructor, parameters) {
|
|
119581
|
-
const
|
|
119582
|
-
const subSchema = Object.create(
|
|
119581
|
+
const schema13 = new SchemaConstructor(parameters);
|
|
119582
|
+
const subSchema = Object.create(schema13);
|
|
119583
119583
|
for (const handlerKey of HANDLER_KEYS) {
|
|
119584
119584
|
if (handlerKey in parameters) {
|
|
119585
|
-
subSchema[handlerKey] = normalizeHandler(parameters[handlerKey],
|
|
119585
|
+
subSchema[handlerKey] = normalizeHandler(parameters[handlerKey], schema13, Schema2.prototype[handlerKey].length);
|
|
119586
119586
|
}
|
|
119587
119587
|
}
|
|
119588
119588
|
return subSchema;
|
|
@@ -119839,8 +119839,8 @@ async function loadEditorconfigInternal(file2, { shouldCache }) {
|
|
|
119839
119839
|
const directory = path52.dirname(file2);
|
|
119840
119840
|
const root2 = await findProjectRoot2(directory, { shouldCache });
|
|
119841
119841
|
const editorConfig = await import_editorconfig.default.parse(file2, { root: root2 });
|
|
119842
|
-
const
|
|
119843
|
-
return
|
|
119842
|
+
const config14 = editorconfig_to_prettier_default(editorConfig);
|
|
119843
|
+
return config14;
|
|
119844
119844
|
}
|
|
119845
119845
|
function loadEditorconfig(file2, { shouldCache }) {
|
|
119846
119846
|
file2 = path52.resolve(file2);
|
|
@@ -121830,18 +121830,18 @@ async function loadConfig(configFile) {
|
|
|
121830
121830
|
if (!load2) {
|
|
121831
121831
|
throw new Error(`No loader specified for extension "${extension || "noExt"}"`);
|
|
121832
121832
|
}
|
|
121833
|
-
let
|
|
121834
|
-
if (!
|
|
121833
|
+
let config14 = await load2(configFile);
|
|
121834
|
+
if (!config14) {
|
|
121835
121835
|
return;
|
|
121836
121836
|
}
|
|
121837
|
-
if (typeof
|
|
121838
|
-
|
|
121837
|
+
if (typeof config14 === "string") {
|
|
121838
|
+
config14 = await load_external_config_default(config14, configFile);
|
|
121839
121839
|
}
|
|
121840
|
-
if (typeof
|
|
121841
|
-
throw new TypeError(`Config is only allowed to be an object, but received ${typeof
|
|
121840
|
+
if (typeof config14 !== "object") {
|
|
121841
|
+
throw new TypeError(`Config is only allowed to be an object, but received ${typeof config14} in "${configFile}"`);
|
|
121842
121842
|
}
|
|
121843
|
-
delete
|
|
121844
|
-
return
|
|
121843
|
+
delete config14.$schema;
|
|
121844
|
+
return config14;
|
|
121845
121845
|
}
|
|
121846
121846
|
function clearPrettierConfigCache() {
|
|
121847
121847
|
loadCache.clear();
|
|
@@ -121891,8 +121891,8 @@ async function loadPrettierConfig2(file2, options8) {
|
|
|
121891
121891
|
return;
|
|
121892
121892
|
}
|
|
121893
121893
|
configFile = toPath3(configFile);
|
|
121894
|
-
const
|
|
121895
|
-
return { config:
|
|
121894
|
+
const config14 = await loadPrettierConfig(configFile, { shouldCache });
|
|
121895
|
+
return { config: config14, configFile };
|
|
121896
121896
|
}
|
|
121897
121897
|
async function resolveConfig(fileUrlOrPath, options8) {
|
|
121898
121898
|
options8 = { useCache: true, ...options8 };
|
|
@@ -121919,8 +121919,8 @@ async function resolveConfigFile(fileUrlOrPath) {
|
|
|
121919
121919
|
return result ?? null;
|
|
121920
121920
|
}
|
|
121921
121921
|
function mergeOverrides(configResult, filePath) {
|
|
121922
|
-
const { config:
|
|
121923
|
-
const { overrides, ...options8 } =
|
|
121922
|
+
const { config: config14, configFile } = configResult || {};
|
|
121923
|
+
const { overrides, ...options8 } = config14 || {};
|
|
121924
121924
|
if (filePath && overrides) {
|
|
121925
121925
|
const relativeFilePath = path102.relative(path102.dirname(configFile), filePath);
|
|
121926
121926
|
for (const override of overrides) {
|
|
@@ -122736,12 +122736,12 @@ function getLanguageByFileName(languages2, file2) {
|
|
|
122736
122736
|
if (!file2) {
|
|
122737
122737
|
return;
|
|
122738
122738
|
}
|
|
122739
|
-
const
|
|
122739
|
+
const basename8 = getFileBasename(file2).toLowerCase();
|
|
122740
122740
|
return languages2.find(({
|
|
122741
122741
|
filenames
|
|
122742
|
-
}) => filenames?.some((name2) => name2.toLowerCase() ===
|
|
122742
|
+
}) => filenames?.some((name2) => name2.toLowerCase() === basename8)) ?? languages2.find(({
|
|
122743
122743
|
extensions
|
|
122744
|
-
}) => extensions?.some((extension) =>
|
|
122744
|
+
}) => extensions?.some((extension) => basename8.endsWith(extension)));
|
|
122745
122745
|
}
|
|
122746
122746
|
function getLanguageByLanguageName(languages2, languageName) {
|
|
122747
122747
|
if (!languageName) {
|
|
@@ -122922,9 +122922,9 @@ function optionInfoToSchema(optionInfo, {
|
|
|
122922
122922
|
throw new Error(`Unexpected type ${optionInfo.type}`);
|
|
122923
122923
|
}
|
|
122924
122924
|
if (optionInfo.exception) {
|
|
122925
|
-
parameters.validate = (value,
|
|
122925
|
+
parameters.validate = (value, schema13, utils3) => optionInfo.exception(value) || schema13.validate(value, utils3);
|
|
122926
122926
|
} else {
|
|
122927
|
-
parameters.validate = (value,
|
|
122927
|
+
parameters.validate = (value, schema13, utils3) => value === undefined || schema13.validate(value, utils3);
|
|
122928
122928
|
}
|
|
122929
122929
|
if (optionInfo.redirect) {
|
|
122930
122930
|
handlers.redirect = (value) => !value ? undefined : {
|
|
@@ -122939,7 +122939,7 @@ function optionInfoToSchema(optionInfo, {
|
|
|
122939
122939
|
}
|
|
122940
122940
|
if (isCLI && !optionInfo.array) {
|
|
122941
122941
|
const originalPreprocess = parameters.preprocess || ((x10) => x10);
|
|
122942
|
-
parameters.preprocess = (value,
|
|
122942
|
+
parameters.preprocess = (value, schema13, utils3) => schema13.preprocess(originalPreprocess(Array.isArray(value) ? method_at_default2(0, value, -1) : value), utils3);
|
|
122943
122943
|
}
|
|
122944
122944
|
return optionInfo.array ? ArraySchema.create({
|
|
122945
122945
|
...isCLI ? {
|
|
@@ -124029,16 +124029,16 @@ async function getFileInfo(file2, options8 = {}) {
|
|
|
124029
124029
|
};
|
|
124030
124030
|
}
|
|
124031
124031
|
async function getParser(file2, options8) {
|
|
124032
|
-
let
|
|
124032
|
+
let config14;
|
|
124033
124033
|
if (options8.resolveConfig !== false) {
|
|
124034
|
-
|
|
124034
|
+
config14 = await resolveConfig(file2, {
|
|
124035
124035
|
editorconfig: false
|
|
124036
124036
|
});
|
|
124037
124037
|
}
|
|
124038
|
-
if (
|
|
124039
|
-
return
|
|
124038
|
+
if (config14?.parser) {
|
|
124039
|
+
return config14.parser;
|
|
124040
124040
|
}
|
|
124041
|
-
let plugins = options8.plugins ??
|
|
124041
|
+
let plugins = options8.plugins ?? config14?.plugins ?? [];
|
|
124042
124042
|
plugins = (await Promise.all([load_builtin_plugins_default(), load_plugins_default(plugins)])).flat();
|
|
124043
124043
|
return infer_parser_default({ plugins }, { physicalFile: file2 });
|
|
124044
124044
|
}
|
|
@@ -124516,9 +124516,9 @@ var require2, __filename2, __dirname3, __create2, __defProp3, __getOwnPropDesc2,
|
|
|
124516
124516
|
};
|
|
124517
124517
|
applyNormalization();
|
|
124518
124518
|
for (const key2 of Object.keys(this._utils.schemas)) {
|
|
124519
|
-
const
|
|
124519
|
+
const schema13 = this._utils.schemas[key2];
|
|
124520
124520
|
if (!(key2 in newOptions)) {
|
|
124521
|
-
const defaultResult = normalizeDefaultResult(
|
|
124521
|
+
const defaultResult = normalizeDefaultResult(schema13.default(this._utils));
|
|
124522
124522
|
if ("value" in defaultResult) {
|
|
124523
124523
|
restOptionsArray.push({ [key2]: defaultResult.value });
|
|
124524
124524
|
}
|
|
@@ -124529,13 +124529,13 @@ var require2, __filename2, __dirname3, __create2, __defProp3, __getOwnPropDesc2,
|
|
|
124529
124529
|
if (!(key2 in newOptions)) {
|
|
124530
124530
|
continue;
|
|
124531
124531
|
}
|
|
124532
|
-
const
|
|
124532
|
+
const schema13 = this._utils.schemas[key2];
|
|
124533
124533
|
const value = newOptions[key2];
|
|
124534
|
-
const newValue =
|
|
124534
|
+
const newValue = schema13.postprocess(value, this._utils);
|
|
124535
124535
|
if (newValue === VALUE_UNCHANGED) {
|
|
124536
124536
|
continue;
|
|
124537
124537
|
}
|
|
124538
|
-
this._applyValidation(newValue, key2,
|
|
124538
|
+
this._applyValidation(newValue, key2, schema13);
|
|
124539
124539
|
newOptions[key2] = newValue;
|
|
124540
124540
|
}
|
|
124541
124541
|
this._applyPostprocess(newOptions);
|
|
@@ -124546,14 +124546,14 @@ var require2, __filename2, __dirname3, __create2, __defProp3, __getOwnPropDesc2,
|
|
|
124546
124546
|
const transferredOptionsArray = [];
|
|
124547
124547
|
const { knownKeys, unknownKeys } = this._partitionOptionKeys(options8);
|
|
124548
124548
|
for (const key2 of knownKeys) {
|
|
124549
|
-
const
|
|
124550
|
-
const value =
|
|
124551
|
-
this._applyValidation(value, key2,
|
|
124549
|
+
const schema13 = this._utils.schemas[key2];
|
|
124550
|
+
const value = schema13.preprocess(options8[key2], this._utils);
|
|
124551
|
+
this._applyValidation(value, key2, schema13);
|
|
124552
124552
|
const appendTransferredOptions = ({ from, to: to5 }) => {
|
|
124553
124553
|
transferredOptionsArray.push(typeof to5 === "string" ? { [to5]: from } : { [to5.key]: to5.value });
|
|
124554
124554
|
};
|
|
124555
124555
|
const warnDeprecated = ({ value: currentValue, redirectTo }) => {
|
|
124556
|
-
const deprecatedResult = normalizeDeprecatedResult(
|
|
124556
|
+
const deprecatedResult = normalizeDeprecatedResult(schema13.deprecated(currentValue, this._utils), value, true);
|
|
124557
124557
|
if (deprecatedResult === false) {
|
|
124558
124558
|
return;
|
|
124559
124559
|
}
|
|
@@ -124571,13 +124571,13 @@ var require2, __filename2, __dirname3, __create2, __defProp3, __getOwnPropDesc2,
|
|
|
124571
124571
|
}
|
|
124572
124572
|
}
|
|
124573
124573
|
};
|
|
124574
|
-
const forwardResult = normalizeForwardResult(
|
|
124574
|
+
const forwardResult = normalizeForwardResult(schema13.forward(value, this._utils), value);
|
|
124575
124575
|
forwardResult.forEach(appendTransferredOptions);
|
|
124576
|
-
const redirectResult = normalizeRedirectResult(
|
|
124576
|
+
const redirectResult = normalizeRedirectResult(schema13.redirect(value, this._utils), value);
|
|
124577
124577
|
redirectResult.redirect.forEach(appendTransferredOptions);
|
|
124578
124578
|
if ("remain" in redirectResult) {
|
|
124579
124579
|
const remainingValue = redirectResult.remain;
|
|
124580
|
-
newOptions[key2] = key2 in newOptions ?
|
|
124580
|
+
newOptions[key2] = key2 in newOptions ? schema13.overlap(newOptions[key2], remainingValue, this._utils) : remainingValue;
|
|
124581
124581
|
warnDeprecated({ value: remainingValue });
|
|
124582
124582
|
}
|
|
124583
124583
|
for (const { from, to: to5 } of redirectResult.redirect) {
|
|
@@ -124605,8 +124605,8 @@ var require2, __filename2, __dirname3, __create2, __defProp3, __getOwnPropDesc2,
|
|
|
124605
124605
|
const [knownKeys, unknownKeys] = partition(Object.keys(options8).filter((key2) => !this._identifyMissing(key2, options8)), (key2) => (key2 in this._utils.schemas));
|
|
124606
124606
|
return { knownKeys, unknownKeys };
|
|
124607
124607
|
}
|
|
124608
|
-
_applyValidation(value, key2,
|
|
124609
|
-
const validateResult = normalizeValidateResult(
|
|
124608
|
+
_applyValidation(value, key2, schema13) {
|
|
124609
|
+
const validateResult = normalizeValidateResult(schema13.validate(value, this._utils), value);
|
|
124610
124610
|
if (validateResult !== true) {
|
|
124611
124611
|
throw this._invalidHandler(key2, validateResult.value, this._utils);
|
|
124612
124612
|
}
|
|
@@ -124648,8 +124648,8 @@ var require2, __filename2, __dirname3, __create2, __defProp3, __getOwnPropDesc2,
|
|
|
124648
124648
|
for (const key2 of unknownKeys) {
|
|
124649
124649
|
const value = postprocessed.override[key2];
|
|
124650
124650
|
this._applyUnknownHandler(key2, value, options8, (knownResultKey, knownResultValue) => {
|
|
124651
|
-
const
|
|
124652
|
-
this._applyValidation(knownResultValue, knownResultKey,
|
|
124651
|
+
const schema13 = this._utils.schemas[knownResultKey];
|
|
124652
|
+
this._applyValidation(knownResultValue, knownResultKey, schema13);
|
|
124653
124653
|
options8[knownResultKey] = knownResultValue;
|
|
124654
124654
|
});
|
|
124655
124655
|
}
|
|
@@ -127963,8 +127963,8 @@ var init_prettier = __esm(() => {
|
|
|
127963
127963
|
}
|
|
127964
127964
|
exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
|
127965
127965
|
function isAffectDepthOfReadingPattern(pattern) {
|
|
127966
|
-
const
|
|
127967
|
-
return endsWithSlashGlobStar(pattern) || isStaticPattern(
|
|
127966
|
+
const basename8 = path152.basename(pattern);
|
|
127967
|
+
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename8);
|
|
127968
127968
|
}
|
|
127969
127969
|
exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
|
127970
127970
|
function expandPatternsWithBraceExpansion(patterns) {
|
|
@@ -138362,23 +138362,23 @@ var require_JSONSchema = __commonJS((exports) => {
|
|
|
138362
138362
|
exports.Parent = Symbol("Parent");
|
|
138363
138363
|
exports.Types = Symbol("Types");
|
|
138364
138364
|
exports.Intersection = Symbol("Intersection");
|
|
138365
|
-
exports.getRootSchema = (0, lodash_1.memoize)((
|
|
138366
|
-
const parent =
|
|
138365
|
+
exports.getRootSchema = (0, lodash_1.memoize)((schema13) => {
|
|
138366
|
+
const parent = schema13[exports.Parent];
|
|
138367
138367
|
if (!parent) {
|
|
138368
|
-
return
|
|
138368
|
+
return schema13;
|
|
138369
138369
|
}
|
|
138370
138370
|
return (0, exports.getRootSchema)(parent);
|
|
138371
138371
|
});
|
|
138372
|
-
function isBoolean(
|
|
138373
|
-
return
|
|
138372
|
+
function isBoolean(schema13) {
|
|
138373
|
+
return schema13 === true || schema13 === false;
|
|
138374
138374
|
}
|
|
138375
138375
|
exports.isBoolean = isBoolean;
|
|
138376
|
-
function isPrimitive(
|
|
138377
|
-
return !(0, lodash_1.isPlainObject)(
|
|
138376
|
+
function isPrimitive(schema13) {
|
|
138377
|
+
return !(0, lodash_1.isPlainObject)(schema13);
|
|
138378
138378
|
}
|
|
138379
138379
|
exports.isPrimitive = isPrimitive;
|
|
138380
|
-
function isCompound(
|
|
138381
|
-
return Array.isArray(
|
|
138380
|
+
function isCompound(schema13) {
|
|
138381
|
+
return Array.isArray(schema13.type) || "anyOf" in schema13 || "oneOf" in schema13;
|
|
138382
138382
|
}
|
|
138383
138383
|
exports.isCompound = isCompound;
|
|
138384
138384
|
});
|
|
@@ -138605,9 +138605,9 @@ var require_type2 = __commonJS((exports, module) => {
|
|
|
138605
138605
|
var require_schema5 = __commonJS((exports, module) => {
|
|
138606
138606
|
var YAMLException = require_exception2();
|
|
138607
138607
|
var Type = require_type2();
|
|
138608
|
-
function compileList(
|
|
138608
|
+
function compileList(schema13, name2) {
|
|
138609
138609
|
var result = [];
|
|
138610
|
-
|
|
138610
|
+
schema13[name2].forEach(function(currentType) {
|
|
138611
138611
|
var newIndex = result.length;
|
|
138612
138612
|
result.forEach(function(previousType, previousIndex) {
|
|
138613
138613
|
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
|
@@ -140552,7 +140552,7 @@ var require_dumper2 = __commonJS((exports, module) => {
|
|
|
140552
140552
|
"OFF"
|
|
140553
140553
|
];
|
|
140554
140554
|
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
140555
|
-
function compileStyleMap(
|
|
140555
|
+
function compileStyleMap(schema13, map2) {
|
|
140556
140556
|
var result, keys, index, length, tag, style, type;
|
|
140557
140557
|
if (map2 === null)
|
|
140558
140558
|
return {};
|
|
@@ -140564,7 +140564,7 @@ var require_dumper2 = __commonJS((exports, module) => {
|
|
|
140564
140564
|
if (tag.slice(0, 2) === "!!") {
|
|
140565
140565
|
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
140566
140566
|
}
|
|
140567
|
-
type =
|
|
140567
|
+
type = schema13.compiledTypeMap["fallback"][tag];
|
|
140568
140568
|
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
|
140569
140569
|
style = type.styleAliases[style];
|
|
140570
140570
|
}
|
|
@@ -141223,11 +141223,11 @@ var require_utils7 = __commonJS((exports) => {
|
|
|
141223
141223
|
function traverseArray(arr, callback, processed) {
|
|
141224
141224
|
arr.forEach((s5, k9) => traverse(s5, callback, processed, k9.toString()));
|
|
141225
141225
|
}
|
|
141226
|
-
function traverseIntersection(
|
|
141227
|
-
if (typeof
|
|
141226
|
+
function traverseIntersection(schema13, callback, processed) {
|
|
141227
|
+
if (typeof schema13 !== "object" || !schema13) {
|
|
141228
141228
|
return;
|
|
141229
141229
|
}
|
|
141230
|
-
const r5 =
|
|
141230
|
+
const r5 = schema13;
|
|
141231
141231
|
const intersection2 = r5[JSONSchema_1.Intersection];
|
|
141232
141232
|
if (!intersection2) {
|
|
141233
141233
|
return;
|
|
@@ -141236,60 +141236,60 @@ var require_utils7 = __commonJS((exports) => {
|
|
|
141236
141236
|
traverseArray(intersection2.allOf, callback, processed);
|
|
141237
141237
|
}
|
|
141238
141238
|
}
|
|
141239
|
-
function traverse(
|
|
141240
|
-
if (processed.has(
|
|
141239
|
+
function traverse(schema13, callback, processed = new Set, key2) {
|
|
141240
|
+
if (processed.has(schema13)) {
|
|
141241
141241
|
return;
|
|
141242
141242
|
}
|
|
141243
|
-
processed.add(
|
|
141244
|
-
callback(
|
|
141245
|
-
if (
|
|
141246
|
-
traverseArray(
|
|
141243
|
+
processed.add(schema13);
|
|
141244
|
+
callback(schema13, key2 !== null && key2 !== undefined ? key2 : null);
|
|
141245
|
+
if (schema13.anyOf) {
|
|
141246
|
+
traverseArray(schema13.anyOf, callback, processed);
|
|
141247
141247
|
}
|
|
141248
|
-
if (
|
|
141249
|
-
traverseArray(
|
|
141248
|
+
if (schema13.allOf) {
|
|
141249
|
+
traverseArray(schema13.allOf, callback, processed);
|
|
141250
141250
|
}
|
|
141251
|
-
if (
|
|
141252
|
-
traverseArray(
|
|
141251
|
+
if (schema13.oneOf) {
|
|
141252
|
+
traverseArray(schema13.oneOf, callback, processed);
|
|
141253
141253
|
}
|
|
141254
|
-
if (
|
|
141255
|
-
traverseObjectKeys(
|
|
141254
|
+
if (schema13.properties) {
|
|
141255
|
+
traverseObjectKeys(schema13.properties, callback, processed);
|
|
141256
141256
|
}
|
|
141257
|
-
if (
|
|
141258
|
-
traverseObjectKeys(
|
|
141257
|
+
if (schema13.patternProperties) {
|
|
141258
|
+
traverseObjectKeys(schema13.patternProperties, callback, processed);
|
|
141259
141259
|
}
|
|
141260
|
-
if (
|
|
141261
|
-
traverse(
|
|
141260
|
+
if (schema13.additionalProperties && typeof schema13.additionalProperties === "object") {
|
|
141261
|
+
traverse(schema13.additionalProperties, callback, processed);
|
|
141262
141262
|
}
|
|
141263
|
-
if (
|
|
141264
|
-
const { items } =
|
|
141263
|
+
if (schema13.items) {
|
|
141264
|
+
const { items } = schema13;
|
|
141265
141265
|
if (Array.isArray(items)) {
|
|
141266
141266
|
traverseArray(items, callback, processed);
|
|
141267
141267
|
} else {
|
|
141268
141268
|
traverse(items, callback, processed);
|
|
141269
141269
|
}
|
|
141270
141270
|
}
|
|
141271
|
-
if (
|
|
141272
|
-
traverse(
|
|
141271
|
+
if (schema13.additionalItems && typeof schema13.additionalItems === "object") {
|
|
141272
|
+
traverse(schema13.additionalItems, callback, processed);
|
|
141273
141273
|
}
|
|
141274
|
-
if (
|
|
141275
|
-
if (Array.isArray(
|
|
141276
|
-
traverseArray(
|
|
141274
|
+
if (schema13.dependencies) {
|
|
141275
|
+
if (Array.isArray(schema13.dependencies)) {
|
|
141276
|
+
traverseArray(schema13.dependencies, callback, processed);
|
|
141277
141277
|
} else {
|
|
141278
|
-
traverseObjectKeys(
|
|
141278
|
+
traverseObjectKeys(schema13.dependencies, callback, processed);
|
|
141279
141279
|
}
|
|
141280
141280
|
}
|
|
141281
|
-
if (
|
|
141282
|
-
traverseObjectKeys(
|
|
141281
|
+
if (schema13.definitions) {
|
|
141282
|
+
traverseObjectKeys(schema13.definitions, callback, processed);
|
|
141283
141283
|
}
|
|
141284
|
-
if (
|
|
141285
|
-
traverseObjectKeys(
|
|
141284
|
+
if (schema13.$defs) {
|
|
141285
|
+
traverseObjectKeys(schema13.$defs, callback, processed);
|
|
141286
141286
|
}
|
|
141287
|
-
if (
|
|
141288
|
-
traverse(
|
|
141287
|
+
if (schema13.not) {
|
|
141288
|
+
traverse(schema13.not, callback, processed);
|
|
141289
141289
|
}
|
|
141290
|
-
traverseIntersection(
|
|
141291
|
-
Object.keys(
|
|
141292
|
-
const child =
|
|
141290
|
+
traverseIntersection(schema13, callback, processed);
|
|
141291
|
+
Object.keys(schema13).filter((key3) => !BLACKLISTED_KEYS.has(key3)).forEach((key3) => {
|
|
141292
|
+
const child = schema13[key3];
|
|
141293
141293
|
if (child && typeof child === "object") {
|
|
141294
141294
|
traverseObjectKeys(child, callback, processed);
|
|
141295
141295
|
}
|
|
@@ -141371,14 +141371,14 @@ var require_utils7 = __commonJS((exports) => {
|
|
|
141371
141371
|
return (_g2 = color()) === null || _g2 === undefined ? undefined : _g2.whiteBright.bgYellow;
|
|
141372
141372
|
}
|
|
141373
141373
|
}
|
|
141374
|
-
function escapeBlockComment(
|
|
141374
|
+
function escapeBlockComment(schema13) {
|
|
141375
141375
|
const replacer = "* /";
|
|
141376
|
-
if (
|
|
141376
|
+
if (schema13 === null || typeof schema13 !== "object") {
|
|
141377
141377
|
return;
|
|
141378
141378
|
}
|
|
141379
|
-
for (const key2 of Object.keys(
|
|
141380
|
-
if (key2 === "description" && typeof
|
|
141381
|
-
|
|
141379
|
+
for (const key2 of Object.keys(schema13)) {
|
|
141380
|
+
if (key2 === "description" && typeof schema13[key2] === "string") {
|
|
141381
|
+
schema13[key2] = schema13[key2].replace(/\*\//g, replacer);
|
|
141382
141382
|
}
|
|
141383
141383
|
}
|
|
141384
141384
|
}
|
|
@@ -141390,45 +141390,45 @@ var require_utils7 = __commonJS((exports) => {
|
|
|
141390
141390
|
return path_1.posix.join(path_1.posix.normalize(outputPath), ...filePathRel);
|
|
141391
141391
|
}
|
|
141392
141392
|
exports.pathTransform = pathTransform;
|
|
141393
|
-
function maybeStripDefault(
|
|
141394
|
-
if (!("default" in
|
|
141395
|
-
return
|
|
141393
|
+
function maybeStripDefault(schema13) {
|
|
141394
|
+
if (!("default" in schema13)) {
|
|
141395
|
+
return schema13;
|
|
141396
141396
|
}
|
|
141397
|
-
switch (
|
|
141397
|
+
switch (schema13.type) {
|
|
141398
141398
|
case "array":
|
|
141399
|
-
if (Array.isArray(
|
|
141400
|
-
return
|
|
141399
|
+
if (Array.isArray(schema13.default)) {
|
|
141400
|
+
return schema13;
|
|
141401
141401
|
}
|
|
141402
141402
|
break;
|
|
141403
141403
|
case "boolean":
|
|
141404
|
-
if (typeof
|
|
141405
|
-
return
|
|
141404
|
+
if (typeof schema13.default === "boolean") {
|
|
141405
|
+
return schema13;
|
|
141406
141406
|
}
|
|
141407
141407
|
break;
|
|
141408
141408
|
case "integer":
|
|
141409
141409
|
case "number":
|
|
141410
|
-
if (typeof
|
|
141411
|
-
return
|
|
141410
|
+
if (typeof schema13.default === "number") {
|
|
141411
|
+
return schema13;
|
|
141412
141412
|
}
|
|
141413
141413
|
break;
|
|
141414
141414
|
case "string":
|
|
141415
|
-
if (typeof
|
|
141416
|
-
return
|
|
141415
|
+
if (typeof schema13.default === "string") {
|
|
141416
|
+
return schema13;
|
|
141417
141417
|
}
|
|
141418
141418
|
break;
|
|
141419
141419
|
case "null":
|
|
141420
|
-
if (
|
|
141421
|
-
return
|
|
141420
|
+
if (schema13.default === null) {
|
|
141421
|
+
return schema13;
|
|
141422
141422
|
}
|
|
141423
141423
|
break;
|
|
141424
141424
|
case "object":
|
|
141425
|
-
if ((0, lodash_1.isPlainObject)(
|
|
141426
|
-
return
|
|
141425
|
+
if ((0, lodash_1.isPlainObject)(schema13.default)) {
|
|
141426
|
+
return schema13;
|
|
141427
141427
|
}
|
|
141428
141428
|
break;
|
|
141429
141429
|
}
|
|
141430
|
-
delete
|
|
141431
|
-
return
|
|
141430
|
+
delete schema13.default;
|
|
141431
|
+
return schema13;
|
|
141432
141432
|
}
|
|
141433
141433
|
exports.maybeStripDefault = maybeStripDefault;
|
|
141434
141434
|
function appendToDescription(existingDescription, ...values) {
|
|
@@ -141442,11 +141442,11 @@ ${values.join(`
|
|
|
141442
141442
|
`);
|
|
141443
141443
|
}
|
|
141444
141444
|
exports.appendToDescription = appendToDescription;
|
|
141445
|
-
function isSchemaLike(
|
|
141446
|
-
if (!(0, lodash_1.isPlainObject)(
|
|
141445
|
+
function isSchemaLike(schema13) {
|
|
141446
|
+
if (!(0, lodash_1.isPlainObject)(schema13)) {
|
|
141447
141447
|
return false;
|
|
141448
141448
|
}
|
|
141449
|
-
const parent =
|
|
141449
|
+
const parent = schema13[JSONSchema_1.Parent];
|
|
141450
141450
|
if (parent === null) {
|
|
141451
141451
|
return true;
|
|
141452
141452
|
}
|
|
@@ -141463,7 +141463,7 @@ ${values.join(`
|
|
|
141463
141463
|
"properties",
|
|
141464
141464
|
"required"
|
|
141465
141465
|
];
|
|
141466
|
-
if (JSON_SCHEMA_KEYWORDS.some((_10) => parent[_10] ===
|
|
141466
|
+
if (JSON_SCHEMA_KEYWORDS.some((_10) => parent[_10] === schema13)) {
|
|
141467
141467
|
return false;
|
|
141468
141468
|
}
|
|
141469
141469
|
return true;
|
|
@@ -141761,13 +141761,13 @@ var require_typesOfSchema = __commonJS((exports) => {
|
|
|
141761
141761
|
exports.typesOfSchema = undefined;
|
|
141762
141762
|
var lodash_1 = require_lodash8();
|
|
141763
141763
|
var JSONSchema_1 = require_JSONSchema();
|
|
141764
|
-
function typesOfSchema(
|
|
141765
|
-
if (
|
|
141764
|
+
function typesOfSchema(schema13) {
|
|
141765
|
+
if (schema13.tsType) {
|
|
141766
141766
|
return new Set(["CUSTOM_TYPE"]);
|
|
141767
141767
|
}
|
|
141768
141768
|
const matchedTypes = new Set;
|
|
141769
141769
|
for (const [schemaType, f7] of Object.entries(matchers)) {
|
|
141770
|
-
if (f7(
|
|
141770
|
+
if (f7(schema13)) {
|
|
141771
141771
|
matchedTypes.add(schemaType);
|
|
141772
141772
|
}
|
|
141773
141773
|
}
|
|
@@ -141778,26 +141778,26 @@ var require_typesOfSchema = __commonJS((exports) => {
|
|
|
141778
141778
|
}
|
|
141779
141779
|
exports.typesOfSchema = typesOfSchema;
|
|
141780
141780
|
var matchers = {
|
|
141781
|
-
ALL_OF(
|
|
141782
|
-
return "allOf" in
|
|
141781
|
+
ALL_OF(schema13) {
|
|
141782
|
+
return "allOf" in schema13;
|
|
141783
141783
|
},
|
|
141784
|
-
ANY(
|
|
141785
|
-
if (Object.keys(
|
|
141784
|
+
ANY(schema13) {
|
|
141785
|
+
if (Object.keys(schema13).length === 0) {
|
|
141786
141786
|
return true;
|
|
141787
141787
|
}
|
|
141788
|
-
return
|
|
141788
|
+
return schema13.type === "any";
|
|
141789
141789
|
},
|
|
141790
|
-
ANY_OF(
|
|
141791
|
-
return "anyOf" in
|
|
141790
|
+
ANY_OF(schema13) {
|
|
141791
|
+
return "anyOf" in schema13;
|
|
141792
141792
|
},
|
|
141793
|
-
BOOLEAN(
|
|
141794
|
-
if ("enum" in
|
|
141793
|
+
BOOLEAN(schema13) {
|
|
141794
|
+
if ("enum" in schema13) {
|
|
141795
141795
|
return false;
|
|
141796
141796
|
}
|
|
141797
|
-
if (
|
|
141797
|
+
if (schema13.type === "boolean") {
|
|
141798
141798
|
return true;
|
|
141799
141799
|
}
|
|
141800
|
-
if (!(0, JSONSchema_1.isCompound)(
|
|
141800
|
+
if (!(0, JSONSchema_1.isCompound)(schema13) && typeof schema13.default === "boolean") {
|
|
141801
141801
|
return true;
|
|
141802
141802
|
}
|
|
141803
141803
|
return false;
|
|
@@ -141805,74 +141805,74 @@ var require_typesOfSchema = __commonJS((exports) => {
|
|
|
141805
141805
|
CUSTOM_TYPE() {
|
|
141806
141806
|
return false;
|
|
141807
141807
|
},
|
|
141808
|
-
NAMED_ENUM(
|
|
141809
|
-
return "enum" in
|
|
141808
|
+
NAMED_ENUM(schema13) {
|
|
141809
|
+
return "enum" in schema13 && "tsEnumNames" in schema13;
|
|
141810
141810
|
},
|
|
141811
|
-
NAMED_SCHEMA(
|
|
141812
|
-
return "$id" in
|
|
141811
|
+
NAMED_SCHEMA(schema13) {
|
|
141812
|
+
return "$id" in schema13 && (("patternProperties" in schema13) || ("properties" in schema13));
|
|
141813
141813
|
},
|
|
141814
|
-
NEVER(
|
|
141815
|
-
return
|
|
141814
|
+
NEVER(schema13) {
|
|
141815
|
+
return schema13 === false;
|
|
141816
141816
|
},
|
|
141817
|
-
NULL(
|
|
141818
|
-
return
|
|
141817
|
+
NULL(schema13) {
|
|
141818
|
+
return schema13.type === "null";
|
|
141819
141819
|
},
|
|
141820
|
-
NUMBER(
|
|
141821
|
-
if ("enum" in
|
|
141820
|
+
NUMBER(schema13) {
|
|
141821
|
+
if ("enum" in schema13) {
|
|
141822
141822
|
return false;
|
|
141823
141823
|
}
|
|
141824
|
-
if (
|
|
141824
|
+
if (schema13.type === "integer" || schema13.type === "number") {
|
|
141825
141825
|
return true;
|
|
141826
141826
|
}
|
|
141827
|
-
if (!(0, JSONSchema_1.isCompound)(
|
|
141827
|
+
if (!(0, JSONSchema_1.isCompound)(schema13) && typeof schema13.default === "number") {
|
|
141828
141828
|
return true;
|
|
141829
141829
|
}
|
|
141830
141830
|
return false;
|
|
141831
141831
|
},
|
|
141832
|
-
OBJECT(
|
|
141833
|
-
return
|
|
141832
|
+
OBJECT(schema13) {
|
|
141833
|
+
return schema13.type === "object" && !(0, lodash_1.isPlainObject)(schema13.additionalProperties) && !schema13.allOf && !schema13.anyOf && !schema13.oneOf && !schema13.patternProperties && !schema13.properties && !schema13.required;
|
|
141834
141834
|
},
|
|
141835
|
-
ONE_OF(
|
|
141836
|
-
return "oneOf" in
|
|
141835
|
+
ONE_OF(schema13) {
|
|
141836
|
+
return "oneOf" in schema13;
|
|
141837
141837
|
},
|
|
141838
|
-
REFERENCE(
|
|
141839
|
-
return "$ref" in
|
|
141838
|
+
REFERENCE(schema13) {
|
|
141839
|
+
return "$ref" in schema13;
|
|
141840
141840
|
},
|
|
141841
|
-
STRING(
|
|
141842
|
-
if ("enum" in
|
|
141841
|
+
STRING(schema13) {
|
|
141842
|
+
if ("enum" in schema13) {
|
|
141843
141843
|
return false;
|
|
141844
141844
|
}
|
|
141845
|
-
if (
|
|
141845
|
+
if (schema13.type === "string") {
|
|
141846
141846
|
return true;
|
|
141847
141847
|
}
|
|
141848
|
-
if (!(0, JSONSchema_1.isCompound)(
|
|
141848
|
+
if (!(0, JSONSchema_1.isCompound)(schema13) && typeof schema13.default === "string") {
|
|
141849
141849
|
return true;
|
|
141850
141850
|
}
|
|
141851
141851
|
return false;
|
|
141852
141852
|
},
|
|
141853
|
-
TYPED_ARRAY(
|
|
141854
|
-
if (
|
|
141853
|
+
TYPED_ARRAY(schema13) {
|
|
141854
|
+
if (schema13.type && schema13.type !== "array") {
|
|
141855
141855
|
return false;
|
|
141856
141856
|
}
|
|
141857
|
-
return "items" in
|
|
141857
|
+
return "items" in schema13;
|
|
141858
141858
|
},
|
|
141859
|
-
UNION(
|
|
141860
|
-
return Array.isArray(
|
|
141859
|
+
UNION(schema13) {
|
|
141860
|
+
return Array.isArray(schema13.type);
|
|
141861
141861
|
},
|
|
141862
|
-
UNNAMED_ENUM(
|
|
141863
|
-
if ("tsEnumNames" in
|
|
141862
|
+
UNNAMED_ENUM(schema13) {
|
|
141863
|
+
if ("tsEnumNames" in schema13) {
|
|
141864
141864
|
return false;
|
|
141865
141865
|
}
|
|
141866
|
-
if (
|
|
141866
|
+
if (schema13.type && schema13.type !== "boolean" && schema13.type !== "integer" && schema13.type !== "number" && schema13.type !== "string") {
|
|
141867
141867
|
return false;
|
|
141868
141868
|
}
|
|
141869
|
-
return "enum" in
|
|
141869
|
+
return "enum" in schema13;
|
|
141870
141870
|
},
|
|
141871
141871
|
UNNAMED_SCHEMA() {
|
|
141872
141872
|
return false;
|
|
141873
141873
|
},
|
|
141874
|
-
UNTYPED_ARRAY(
|
|
141875
|
-
return
|
|
141874
|
+
UNTYPED_ARRAY(schema13) {
|
|
141875
|
+
return schema13.type === "array" && !("items" in schema13);
|
|
141876
141876
|
}
|
|
141877
141877
|
};
|
|
141878
141878
|
});
|
|
@@ -141883,10 +141883,10 @@ var require_applySchemaTyping = __commonJS((exports) => {
|
|
|
141883
141883
|
exports.applySchemaTyping = undefined;
|
|
141884
141884
|
var JSONSchema_1 = require_JSONSchema();
|
|
141885
141885
|
var typesOfSchema_1 = require_typesOfSchema();
|
|
141886
|
-
function applySchemaTyping(
|
|
141886
|
+
function applySchemaTyping(schema13) {
|
|
141887
141887
|
var _a7;
|
|
141888
|
-
const types = (0, typesOfSchema_1.typesOfSchema)(
|
|
141889
|
-
Object.defineProperty(
|
|
141888
|
+
const types = (0, typesOfSchema_1.typesOfSchema)(schema13);
|
|
141889
|
+
Object.defineProperty(schema13, JSONSchema_1.Types, {
|
|
141890
141890
|
enumerable: false,
|
|
141891
141891
|
value: types,
|
|
141892
141892
|
writable: false
|
|
@@ -141895,23 +141895,23 @@ var require_applySchemaTyping = __commonJS((exports) => {
|
|
|
141895
141895
|
return;
|
|
141896
141896
|
}
|
|
141897
141897
|
const intersection2 = {
|
|
141898
|
-
[JSONSchema_1.Parent]:
|
|
141898
|
+
[JSONSchema_1.Parent]: schema13,
|
|
141899
141899
|
[JSONSchema_1.Types]: new Set(["ALL_OF"]),
|
|
141900
|
-
$id:
|
|
141901
|
-
description:
|
|
141902
|
-
name:
|
|
141903
|
-
title:
|
|
141904
|
-
allOf: (_a7 =
|
|
141900
|
+
$id: schema13.$id,
|
|
141901
|
+
description: schema13.description,
|
|
141902
|
+
name: schema13.name,
|
|
141903
|
+
title: schema13.title,
|
|
141904
|
+
allOf: (_a7 = schema13.allOf) !== null && _a7 !== undefined ? _a7 : [],
|
|
141905
141905
|
required: [],
|
|
141906
141906
|
additionalProperties: false
|
|
141907
141907
|
};
|
|
141908
141908
|
types.delete("ALL_OF");
|
|
141909
|
-
delete
|
|
141910
|
-
delete
|
|
141911
|
-
delete
|
|
141912
|
-
delete
|
|
141913
|
-
delete
|
|
141914
|
-
Object.defineProperty(
|
|
141909
|
+
delete schema13.allOf;
|
|
141910
|
+
delete schema13.$id;
|
|
141911
|
+
delete schema13.description;
|
|
141912
|
+
delete schema13.name;
|
|
141913
|
+
delete schema13.title;
|
|
141914
|
+
Object.defineProperty(schema13, JSONSchema_1.Intersection, {
|
|
141915
141915
|
enumerable: false,
|
|
141916
141916
|
value: intersection2,
|
|
141917
141917
|
writable: false
|
|
@@ -141929,186 +141929,186 @@ var require_normalizer = __commonJS((exports) => {
|
|
|
141929
141929
|
var applySchemaTyping_1 = require_applySchemaTyping();
|
|
141930
141930
|
var util_1 = __require("util");
|
|
141931
141931
|
var rules = new Map;
|
|
141932
|
-
function hasType(
|
|
141933
|
-
return
|
|
141932
|
+
function hasType(schema13, type) {
|
|
141933
|
+
return schema13.type === type || Array.isArray(schema13.type) && schema13.type.includes(type);
|
|
141934
141934
|
}
|
|
141935
|
-
function isObjectType(
|
|
141936
|
-
return
|
|
141935
|
+
function isObjectType(schema13) {
|
|
141936
|
+
return schema13.properties !== undefined || hasType(schema13, "object") || hasType(schema13, "any");
|
|
141937
141937
|
}
|
|
141938
|
-
function isArrayType(
|
|
141939
|
-
return
|
|
141938
|
+
function isArrayType(schema13) {
|
|
141939
|
+
return schema13.items !== undefined || hasType(schema13, "array") || hasType(schema13, "any");
|
|
141940
141940
|
}
|
|
141941
|
-
function isEnumTypeWithoutTsEnumNames(
|
|
141942
|
-
return
|
|
141941
|
+
function isEnumTypeWithoutTsEnumNames(schema13) {
|
|
141942
|
+
return schema13.type === "string" && schema13.enum !== undefined && schema13.tsEnumNames === undefined;
|
|
141943
141943
|
}
|
|
141944
|
-
rules.set('Remove `type=["null"]` if `enum=[null]`', (
|
|
141945
|
-
if (Array.isArray(
|
|
141946
|
-
|
|
141944
|
+
rules.set('Remove `type=["null"]` if `enum=[null]`', (schema13) => {
|
|
141945
|
+
if (Array.isArray(schema13.enum) && schema13.enum.some((e8) => e8 === null) && Array.isArray(schema13.type) && schema13.type.includes("null")) {
|
|
141946
|
+
schema13.type = schema13.type.filter((type) => type !== "null");
|
|
141947
141947
|
}
|
|
141948
141948
|
});
|
|
141949
|
-
rules.set("Destructure unary types", (
|
|
141950
|
-
if (
|
|
141951
|
-
|
|
141949
|
+
rules.set("Destructure unary types", (schema13) => {
|
|
141950
|
+
if (schema13.type && Array.isArray(schema13.type) && schema13.type.length === 1) {
|
|
141951
|
+
schema13.type = schema13.type[0];
|
|
141952
141952
|
}
|
|
141953
141953
|
});
|
|
141954
|
-
rules.set("Add empty `required` property if none is defined", (
|
|
141955
|
-
if (isObjectType(
|
|
141956
|
-
|
|
141954
|
+
rules.set("Add empty `required` property if none is defined", (schema13) => {
|
|
141955
|
+
if (isObjectType(schema13) && !("required" in schema13)) {
|
|
141956
|
+
schema13.required = [];
|
|
141957
141957
|
}
|
|
141958
141958
|
});
|
|
141959
|
-
rules.set("Transform `required`=false to `required`=[]", (
|
|
141960
|
-
if (
|
|
141961
|
-
|
|
141959
|
+
rules.set("Transform `required`=false to `required`=[]", (schema13) => {
|
|
141960
|
+
if (schema13.required === false) {
|
|
141961
|
+
schema13.required = [];
|
|
141962
141962
|
}
|
|
141963
141963
|
});
|
|
141964
|
-
rules.set("Default additionalProperties", (
|
|
141965
|
-
if (isObjectType(
|
|
141966
|
-
|
|
141964
|
+
rules.set("Default additionalProperties", (schema13, _10, options8) => {
|
|
141965
|
+
if (isObjectType(schema13) && !("additionalProperties" in schema13) && schema13.patternProperties === undefined) {
|
|
141966
|
+
schema13.additionalProperties = options8.additionalProperties;
|
|
141967
141967
|
}
|
|
141968
141968
|
});
|
|
141969
|
-
rules.set("Transform id to $id", (
|
|
141970
|
-
if (!(0, utils_1.isSchemaLike)(
|
|
141969
|
+
rules.set("Transform id to $id", (schema13, fileName) => {
|
|
141970
|
+
if (!(0, utils_1.isSchemaLike)(schema13)) {
|
|
141971
141971
|
return;
|
|
141972
141972
|
}
|
|
141973
|
-
if (
|
|
141974
|
-
throw ReferenceError(`Schema must define either id or $id, not both. Given id=${
|
|
141973
|
+
if (schema13.id && schema13.$id && schema13.id !== schema13.$id) {
|
|
141974
|
+
throw ReferenceError(`Schema must define either id or $id, not both. Given id=${schema13.id}, $id=${schema13.$id} in ${fileName}`);
|
|
141975
141975
|
}
|
|
141976
|
-
if (
|
|
141977
|
-
|
|
141978
|
-
delete
|
|
141976
|
+
if (schema13.id) {
|
|
141977
|
+
schema13.$id = schema13.id;
|
|
141978
|
+
delete schema13.id;
|
|
141979
141979
|
}
|
|
141980
141980
|
});
|
|
141981
|
-
rules.set("Add an $id to anything that needs it", (
|
|
141982
|
-
if (!(0, utils_1.isSchemaLike)(
|
|
141981
|
+
rules.set("Add an $id to anything that needs it", (schema13, fileName, _options, _key, dereferencedPaths) => {
|
|
141982
|
+
if (!(0, utils_1.isSchemaLike)(schema13)) {
|
|
141983
141983
|
return;
|
|
141984
141984
|
}
|
|
141985
|
-
if (!
|
|
141986
|
-
|
|
141985
|
+
if (!schema13.$id && !schema13[JSONSchema_1.Parent]) {
|
|
141986
|
+
schema13.$id = (0, utils_1.toSafeString)((0, utils_1.justName)(fileName));
|
|
141987
141987
|
return;
|
|
141988
141988
|
}
|
|
141989
|
-
if (!isArrayType(
|
|
141989
|
+
if (!isArrayType(schema13) && !isObjectType(schema13)) {
|
|
141990
141990
|
return;
|
|
141991
141991
|
}
|
|
141992
|
-
const dereferencedName = dereferencedPaths.get(
|
|
141993
|
-
if (!
|
|
141994
|
-
|
|
141992
|
+
const dereferencedName = dereferencedPaths.get(schema13);
|
|
141993
|
+
if (!schema13.$id && !schema13.title && dereferencedName) {
|
|
141994
|
+
schema13.$id = (0, utils_1.toSafeString)((0, utils_1.justName)(dereferencedName));
|
|
141995
141995
|
}
|
|
141996
141996
|
if (dereferencedName) {
|
|
141997
|
-
dereferencedPaths.delete(
|
|
141997
|
+
dereferencedPaths.delete(schema13);
|
|
141998
141998
|
}
|
|
141999
141999
|
});
|
|
142000
|
-
rules.set("Escape closing JSDoc comment", (
|
|
142001
|
-
(0, utils_1.escapeBlockComment)(
|
|
142000
|
+
rules.set("Escape closing JSDoc comment", (schema13) => {
|
|
142001
|
+
(0, utils_1.escapeBlockComment)(schema13);
|
|
142002
142002
|
});
|
|
142003
|
-
rules.set("Add JSDoc comments for minItems and maxItems", (
|
|
142004
|
-
if (!isArrayType(
|
|
142003
|
+
rules.set("Add JSDoc comments for minItems and maxItems", (schema13) => {
|
|
142004
|
+
if (!isArrayType(schema13)) {
|
|
142005
142005
|
return;
|
|
142006
142006
|
}
|
|
142007
142007
|
const commentsToAppend = [
|
|
142008
|
-
"minItems" in
|
|
142009
|
-
"maxItems" in
|
|
142008
|
+
"minItems" in schema13 ? `@minItems ${schema13.minItems}` : "",
|
|
142009
|
+
"maxItems" in schema13 ? `@maxItems ${schema13.maxItems}` : ""
|
|
142010
142010
|
].filter(Boolean);
|
|
142011
142011
|
if (commentsToAppend.length) {
|
|
142012
|
-
|
|
142012
|
+
schema13.description = (0, utils_1.appendToDescription)(schema13.description, ...commentsToAppend);
|
|
142013
142013
|
}
|
|
142014
142014
|
});
|
|
142015
|
-
rules.set("Optionally remove maxItems and minItems", (
|
|
142016
|
-
if (!isArrayType(
|
|
142015
|
+
rules.set("Optionally remove maxItems and minItems", (schema13, _fileName, options8) => {
|
|
142016
|
+
if (!isArrayType(schema13)) {
|
|
142017
142017
|
return;
|
|
142018
142018
|
}
|
|
142019
|
-
if ("minItems" in
|
|
142020
|
-
delete
|
|
142019
|
+
if ("minItems" in schema13 && options8.ignoreMinAndMaxItems) {
|
|
142020
|
+
delete schema13.minItems;
|
|
142021
142021
|
}
|
|
142022
|
-
if ("maxItems" in
|
|
142023
|
-
delete
|
|
142022
|
+
if ("maxItems" in schema13 && (options8.ignoreMinAndMaxItems || options8.maxItems === -1)) {
|
|
142023
|
+
delete schema13.maxItems;
|
|
142024
142024
|
}
|
|
142025
142025
|
});
|
|
142026
|
-
rules.set("Normalize schema.minItems", (
|
|
142026
|
+
rules.set("Normalize schema.minItems", (schema13, _fileName, options8) => {
|
|
142027
142027
|
if (options8.ignoreMinAndMaxItems) {
|
|
142028
142028
|
return;
|
|
142029
142029
|
}
|
|
142030
|
-
if (!isArrayType(
|
|
142030
|
+
if (!isArrayType(schema13)) {
|
|
142031
142031
|
return;
|
|
142032
142032
|
}
|
|
142033
|
-
const { minItems } =
|
|
142034
|
-
|
|
142033
|
+
const { minItems } = schema13;
|
|
142034
|
+
schema13.minItems = typeof minItems === "number" ? minItems : 0;
|
|
142035
142035
|
});
|
|
142036
|
-
rules.set("Remove maxItems if it is big enough to likely cause OOMs", (
|
|
142036
|
+
rules.set("Remove maxItems if it is big enough to likely cause OOMs", (schema13, _fileName, options8) => {
|
|
142037
142037
|
if (options8.ignoreMinAndMaxItems || options8.maxItems === -1) {
|
|
142038
142038
|
return;
|
|
142039
142039
|
}
|
|
142040
|
-
if (!isArrayType(
|
|
142040
|
+
if (!isArrayType(schema13)) {
|
|
142041
142041
|
return;
|
|
142042
142042
|
}
|
|
142043
|
-
const { maxItems, minItems } =
|
|
142043
|
+
const { maxItems, minItems } = schema13;
|
|
142044
142044
|
if (maxItems !== undefined && maxItems - minItems > options8.maxItems) {
|
|
142045
|
-
delete
|
|
142045
|
+
delete schema13.maxItems;
|
|
142046
142046
|
}
|
|
142047
142047
|
});
|
|
142048
|
-
rules.set("Normalize schema.items", (
|
|
142048
|
+
rules.set("Normalize schema.items", (schema13, _fileName, options8) => {
|
|
142049
142049
|
if (options8.ignoreMinAndMaxItems) {
|
|
142050
142050
|
return;
|
|
142051
142051
|
}
|
|
142052
|
-
const { maxItems, minItems } =
|
|
142052
|
+
const { maxItems, minItems } = schema13;
|
|
142053
142053
|
const hasMaxItems = typeof maxItems === "number" && maxItems >= 0;
|
|
142054
142054
|
const hasMinItems = typeof minItems === "number" && minItems > 0;
|
|
142055
|
-
if (
|
|
142056
|
-
const items =
|
|
142055
|
+
if (schema13.items && !Array.isArray(schema13.items) && (hasMaxItems || hasMinItems)) {
|
|
142056
|
+
const items = schema13.items;
|
|
142057
142057
|
const newItems = Array(maxItems || minItems || 0).fill(items);
|
|
142058
142058
|
if (!hasMaxItems) {
|
|
142059
|
-
|
|
142059
|
+
schema13.additionalItems = items;
|
|
142060
142060
|
}
|
|
142061
|
-
|
|
142061
|
+
schema13.items = newItems;
|
|
142062
142062
|
}
|
|
142063
|
-
if (Array.isArray(
|
|
142064
|
-
|
|
142063
|
+
if (Array.isArray(schema13.items) && hasMaxItems && maxItems < schema13.items.length) {
|
|
142064
|
+
schema13.items = schema13.items.slice(0, maxItems);
|
|
142065
142065
|
}
|
|
142066
|
-
return
|
|
142066
|
+
return schema13;
|
|
142067
142067
|
});
|
|
142068
|
-
rules.set("Remove extends, if it is empty", (
|
|
142069
|
-
if (!
|
|
142068
|
+
rules.set("Remove extends, if it is empty", (schema13) => {
|
|
142069
|
+
if (!schema13.hasOwnProperty("extends")) {
|
|
142070
142070
|
return;
|
|
142071
142071
|
}
|
|
142072
|
-
if (
|
|
142073
|
-
delete
|
|
142072
|
+
if (schema13.extends == null || Array.isArray(schema13.extends) && schema13.extends.length === 0) {
|
|
142073
|
+
delete schema13.extends;
|
|
142074
142074
|
}
|
|
142075
142075
|
});
|
|
142076
|
-
rules.set("Make extends always an array, if it is defined", (
|
|
142077
|
-
if (
|
|
142076
|
+
rules.set("Make extends always an array, if it is defined", (schema13) => {
|
|
142077
|
+
if (schema13.extends == null) {
|
|
142078
142078
|
return;
|
|
142079
142079
|
}
|
|
142080
|
-
if (!Array.isArray(
|
|
142081
|
-
|
|
142080
|
+
if (!Array.isArray(schema13.extends)) {
|
|
142081
|
+
schema13.extends = [schema13.extends];
|
|
142082
142082
|
}
|
|
142083
142083
|
});
|
|
142084
|
-
rules.set("Transform definitions to $defs", (
|
|
142085
|
-
if (
|
|
142086
|
-
throw ReferenceError(`Schema must define either definitions or $defs, not both. Given id=${
|
|
142084
|
+
rules.set("Transform definitions to $defs", (schema13, fileName) => {
|
|
142085
|
+
if (schema13.definitions && schema13.$defs && !(0, util_1.isDeepStrictEqual)(schema13.definitions, schema13.$defs)) {
|
|
142086
|
+
throw ReferenceError(`Schema must define either definitions or $defs, not both. Given id=${schema13.id} in ${fileName}`);
|
|
142087
142087
|
}
|
|
142088
|
-
if (
|
|
142089
|
-
|
|
142090
|
-
delete
|
|
142088
|
+
if (schema13.definitions) {
|
|
142089
|
+
schema13.$defs = schema13.definitions;
|
|
142090
|
+
delete schema13.definitions;
|
|
142091
142091
|
}
|
|
142092
142092
|
});
|
|
142093
|
-
rules.set("Transform const to singleton enum", (
|
|
142094
|
-
if (
|
|
142095
|
-
|
|
142096
|
-
delete
|
|
142093
|
+
rules.set("Transform const to singleton enum", (schema13) => {
|
|
142094
|
+
if (schema13.const !== undefined) {
|
|
142095
|
+
schema13.enum = [schema13.const];
|
|
142096
|
+
delete schema13.const;
|
|
142097
142097
|
}
|
|
142098
142098
|
});
|
|
142099
|
-
rules.set("Add tsEnumNames to enum types", (
|
|
142099
|
+
rules.set("Add tsEnumNames to enum types", (schema13, _10, options8) => {
|
|
142100
142100
|
var _a7;
|
|
142101
|
-
if (isEnumTypeWithoutTsEnumNames(
|
|
142102
|
-
|
|
142101
|
+
if (isEnumTypeWithoutTsEnumNames(schema13) && options8.inferStringEnumKeysFromValues) {
|
|
142102
|
+
schema13.tsEnumNames = (_a7 = schema13.enum) === null || _a7 === undefined ? undefined : _a7.map(String);
|
|
142103
142103
|
}
|
|
142104
142104
|
});
|
|
142105
|
-
rules.set("Pre-calculate schema types and intersections", (
|
|
142106
|
-
if (
|
|
142107
|
-
(0, applySchemaTyping_1.applySchemaTyping)(
|
|
142105
|
+
rules.set("Pre-calculate schema types and intersections", (schema13) => {
|
|
142106
|
+
if (schema13 !== null && typeof schema13 === "object") {
|
|
142107
|
+
(0, applySchemaTyping_1.applySchemaTyping)(schema13);
|
|
142108
142108
|
}
|
|
142109
142109
|
});
|
|
142110
142110
|
function normalize2(rootSchema, dereferencedPaths, filename, options8) {
|
|
142111
|
-
rules.forEach((rule) => (0, utils_1.traverse)(rootSchema, (
|
|
142111
|
+
rules.forEach((rule) => (0, utils_1.traverse)(rootSchema, (schema13, key2) => rule(schema13, filename, options8, key2, dereferencedPaths)));
|
|
142112
142112
|
return rootSchema;
|
|
142113
142113
|
}
|
|
142114
142114
|
exports.normalize = normalize2;
|
|
@@ -142190,37 +142190,37 @@ var require_parser2 = __commonJS((exports) => {
|
|
|
142190
142190
|
var AST_1 = require_AST();
|
|
142191
142191
|
var JSONSchema_1 = require_JSONSchema();
|
|
142192
142192
|
var utils_1 = require_utils7();
|
|
142193
|
-
function parse11(
|
|
142194
|
-
if ((0, JSONSchema_1.isPrimitive)(
|
|
142195
|
-
if ((0, JSONSchema_1.isBoolean)(
|
|
142196
|
-
return parseBooleanSchema(
|
|
142193
|
+
function parse11(schema13, options8, keyName, processed = new Map, usedNames = new Set) {
|
|
142194
|
+
if ((0, JSONSchema_1.isPrimitive)(schema13)) {
|
|
142195
|
+
if ((0, JSONSchema_1.isBoolean)(schema13)) {
|
|
142196
|
+
return parseBooleanSchema(schema13, keyName, options8);
|
|
142197
142197
|
}
|
|
142198
|
-
return parseLiteral(
|
|
142198
|
+
return parseLiteral(schema13, keyName);
|
|
142199
142199
|
}
|
|
142200
|
-
const intersection2 =
|
|
142201
|
-
const types =
|
|
142200
|
+
const intersection2 = schema13[JSONSchema_1.Intersection];
|
|
142201
|
+
const types = schema13[JSONSchema_1.Types];
|
|
142202
142202
|
if (intersection2) {
|
|
142203
142203
|
const ast = parseAsTypeWithCache(intersection2, "ALL_OF", options8, keyName, processed, usedNames);
|
|
142204
142204
|
types.forEach((type) => {
|
|
142205
|
-
ast.params.push(parseAsTypeWithCache(
|
|
142205
|
+
ast.params.push(parseAsTypeWithCache(schema13, type, options8, keyName, processed, usedNames));
|
|
142206
142206
|
});
|
|
142207
|
-
(0, utils_1.log)("blue", "parser", "Types:", [...types], "Input:",
|
|
142207
|
+
(0, utils_1.log)("blue", "parser", "Types:", [...types], "Input:", schema13, "Output:", ast);
|
|
142208
142208
|
return ast;
|
|
142209
142209
|
}
|
|
142210
142210
|
if (types.size === 1) {
|
|
142211
142211
|
const type = [...types][0];
|
|
142212
|
-
const ast = parseAsTypeWithCache(
|
|
142213
|
-
(0, utils_1.log)("blue", "parser", "Type:", type, "Input:",
|
|
142212
|
+
const ast = parseAsTypeWithCache(schema13, type, options8, keyName, processed, usedNames);
|
|
142213
|
+
(0, utils_1.log)("blue", "parser", "Type:", type, "Input:", schema13, "Output:", ast);
|
|
142214
142214
|
return ast;
|
|
142215
142215
|
}
|
|
142216
142216
|
throw new ReferenceError("Expected intersection schema. Please file an issue on GitHub.");
|
|
142217
142217
|
}
|
|
142218
142218
|
exports.parse = parse11;
|
|
142219
|
-
function parseAsTypeWithCache(
|
|
142220
|
-
let cachedTypeMap = processed.get(
|
|
142219
|
+
function parseAsTypeWithCache(schema13, type, options8, keyName, processed = new Map, usedNames = new Set) {
|
|
142220
|
+
let cachedTypeMap = processed.get(schema13);
|
|
142221
142221
|
if (!cachedTypeMap) {
|
|
142222
142222
|
cachedTypeMap = new Map;
|
|
142223
|
-
processed.set(
|
|
142223
|
+
processed.set(schema13, cachedTypeMap);
|
|
142224
142224
|
}
|
|
142225
142225
|
const cachedAST = cachedTypeMap.get(type);
|
|
142226
142226
|
if (cachedAST) {
|
|
@@ -142228,10 +142228,10 @@ var require_parser2 = __commonJS((exports) => {
|
|
|
142228
142228
|
}
|
|
142229
142229
|
const ast = {};
|
|
142230
142230
|
cachedTypeMap.set(type, ast);
|
|
142231
|
-
return Object.assign(ast, parseNonLiteral(
|
|
142231
|
+
return Object.assign(ast, parseNonLiteral(schema13, type, options8, keyName, processed, usedNames));
|
|
142232
142232
|
}
|
|
142233
|
-
function parseBooleanSchema(
|
|
142234
|
-
if (
|
|
142233
|
+
function parseBooleanSchema(schema13, keyName, options8) {
|
|
142234
|
+
if (schema13) {
|
|
142235
142235
|
return {
|
|
142236
142236
|
keyName,
|
|
142237
142237
|
type: options8.unknownAny ? "UNKNOWN" : "ANY"
|
|
@@ -142242,157 +142242,157 @@ var require_parser2 = __commonJS((exports) => {
|
|
|
142242
142242
|
type: "NEVER"
|
|
142243
142243
|
};
|
|
142244
142244
|
}
|
|
142245
|
-
function parseLiteral(
|
|
142245
|
+
function parseLiteral(schema13, keyName) {
|
|
142246
142246
|
return {
|
|
142247
142247
|
keyName,
|
|
142248
|
-
params:
|
|
142248
|
+
params: schema13,
|
|
142249
142249
|
type: "LITERAL"
|
|
142250
142250
|
};
|
|
142251
142251
|
}
|
|
142252
|
-
function parseNonLiteral(
|
|
142253
|
-
const definitions = getDefinitionsMemoized((0, JSONSchema_1.getRootSchema)(
|
|
142254
|
-
const keyNameFromDefinition = (0, lodash_1.findKey)(definitions, (_10) => _10 ===
|
|
142252
|
+
function parseNonLiteral(schema13, type, options8, keyName, processed, usedNames) {
|
|
142253
|
+
const definitions = getDefinitionsMemoized((0, JSONSchema_1.getRootSchema)(schema13));
|
|
142254
|
+
const keyNameFromDefinition = (0, lodash_1.findKey)(definitions, (_10) => _10 === schema13);
|
|
142255
142255
|
switch (type) {
|
|
142256
142256
|
case "ALL_OF":
|
|
142257
142257
|
return {
|
|
142258
|
-
comment:
|
|
142259
|
-
deprecated:
|
|
142258
|
+
comment: schema13.description,
|
|
142259
|
+
deprecated: schema13.deprecated,
|
|
142260
142260
|
keyName,
|
|
142261
|
-
standaloneName: standaloneName(
|
|
142262
|
-
params:
|
|
142261
|
+
standaloneName: standaloneName(schema13, keyNameFromDefinition, usedNames, options8),
|
|
142262
|
+
params: schema13.allOf.map((_10) => parse11(_10, options8, undefined, processed, usedNames)),
|
|
142263
142263
|
type: "INTERSECTION"
|
|
142264
142264
|
};
|
|
142265
142265
|
case "ANY":
|
|
142266
|
-
return Object.assign(Object.assign({}, options8.unknownAny ? AST_1.T_UNKNOWN : AST_1.T_ANY), { comment:
|
|
142266
|
+
return Object.assign(Object.assign({}, options8.unknownAny ? AST_1.T_UNKNOWN : AST_1.T_ANY), { comment: schema13.description, deprecated: schema13.deprecated, keyName, standaloneName: standaloneName(schema13, keyNameFromDefinition, usedNames, options8) });
|
|
142267
142267
|
case "ANY_OF":
|
|
142268
142268
|
return {
|
|
142269
|
-
comment:
|
|
142270
|
-
deprecated:
|
|
142269
|
+
comment: schema13.description,
|
|
142270
|
+
deprecated: schema13.deprecated,
|
|
142271
142271
|
keyName,
|
|
142272
|
-
standaloneName: standaloneName(
|
|
142273
|
-
params:
|
|
142272
|
+
standaloneName: standaloneName(schema13, keyNameFromDefinition, usedNames, options8),
|
|
142273
|
+
params: schema13.anyOf.map((_10) => parse11(_10, options8, undefined, processed, usedNames)),
|
|
142274
142274
|
type: "UNION"
|
|
142275
142275
|
};
|
|
142276
142276
|
case "BOOLEAN":
|
|
142277
142277
|
return {
|
|
142278
|
-
comment:
|
|
142279
|
-
deprecated:
|
|
142278
|
+
comment: schema13.description,
|
|
142279
|
+
deprecated: schema13.deprecated,
|
|
142280
142280
|
keyName,
|
|
142281
|
-
standaloneName: standaloneName(
|
|
142281
|
+
standaloneName: standaloneName(schema13, keyNameFromDefinition, usedNames, options8),
|
|
142282
142282
|
type: "BOOLEAN"
|
|
142283
142283
|
};
|
|
142284
142284
|
case "CUSTOM_TYPE":
|
|
142285
142285
|
return {
|
|
142286
|
-
comment:
|
|
142287
|
-
deprecated:
|
|
142286
|
+
comment: schema13.description,
|
|
142287
|
+
deprecated: schema13.deprecated,
|
|
142288
142288
|
keyName,
|
|
142289
|
-
params:
|
|
142290
|
-
standaloneName: standaloneName(
|
|
142289
|
+
params: schema13.tsType,
|
|
142290
|
+
standaloneName: standaloneName(schema13, keyNameFromDefinition, usedNames, options8),
|
|
142291
142291
|
type: "CUSTOM_TYPE"
|
|
142292
142292
|
};
|
|
142293
142293
|
case "NAMED_ENUM":
|
|
142294
142294
|
return {
|
|
142295
|
-
comment:
|
|
142296
|
-
deprecated:
|
|
142295
|
+
comment: schema13.description,
|
|
142296
|
+
deprecated: schema13.deprecated,
|
|
142297
142297
|
keyName,
|
|
142298
|
-
standaloneName: standaloneName(
|
|
142299
|
-
params:
|
|
142298
|
+
standaloneName: standaloneName(schema13, keyNameFromDefinition !== null && keyNameFromDefinition !== undefined ? keyNameFromDefinition : keyName, usedNames, options8),
|
|
142299
|
+
params: schema13.enum.map((_10, n5) => ({
|
|
142300
142300
|
ast: parseLiteral(_10, undefined),
|
|
142301
|
-
keyName:
|
|
142301
|
+
keyName: schema13.tsEnumNames[n5]
|
|
142302
142302
|
})),
|
|
142303
142303
|
type: "ENUM"
|
|
142304
142304
|
};
|
|
142305
142305
|
case "NAMED_SCHEMA":
|
|
142306
|
-
return newInterface(
|
|
142306
|
+
return newInterface(schema13, options8, processed, usedNames, keyName);
|
|
142307
142307
|
case "NEVER":
|
|
142308
142308
|
return {
|
|
142309
|
-
comment:
|
|
142310
|
-
deprecated:
|
|
142309
|
+
comment: schema13.description,
|
|
142310
|
+
deprecated: schema13.deprecated,
|
|
142311
142311
|
keyName,
|
|
142312
|
-
standaloneName: standaloneName(
|
|
142312
|
+
standaloneName: standaloneName(schema13, keyNameFromDefinition, usedNames, options8),
|
|
142313
142313
|
type: "NEVER"
|
|
142314
142314
|
};
|
|
142315
142315
|
case "NULL":
|
|
142316
142316
|
return {
|
|
142317
|
-
comment:
|
|
142318
|
-
deprecated:
|
|
142317
|
+
comment: schema13.description,
|
|
142318
|
+
deprecated: schema13.deprecated,
|
|
142319
142319
|
keyName,
|
|
142320
|
-
standaloneName: standaloneName(
|
|
142320
|
+
standaloneName: standaloneName(schema13, keyNameFromDefinition, usedNames, options8),
|
|
142321
142321
|
type: "NULL"
|
|
142322
142322
|
};
|
|
142323
142323
|
case "NUMBER":
|
|
142324
142324
|
return {
|
|
142325
|
-
comment:
|
|
142326
|
-
deprecated:
|
|
142325
|
+
comment: schema13.description,
|
|
142326
|
+
deprecated: schema13.deprecated,
|
|
142327
142327
|
keyName,
|
|
142328
|
-
standaloneName: standaloneName(
|
|
142328
|
+
standaloneName: standaloneName(schema13, keyNameFromDefinition, usedNames, options8),
|
|
142329
142329
|
type: "NUMBER"
|
|
142330
142330
|
};
|
|
142331
142331
|
case "OBJECT":
|
|
142332
142332
|
return {
|
|
142333
|
-
comment:
|
|
142333
|
+
comment: schema13.description,
|
|
142334
142334
|
keyName,
|
|
142335
|
-
standaloneName: standaloneName(
|
|
142335
|
+
standaloneName: standaloneName(schema13, keyNameFromDefinition, usedNames, options8),
|
|
142336
142336
|
type: "OBJECT",
|
|
142337
|
-
deprecated:
|
|
142337
|
+
deprecated: schema13.deprecated
|
|
142338
142338
|
};
|
|
142339
142339
|
case "ONE_OF":
|
|
142340
142340
|
return {
|
|
142341
|
-
comment:
|
|
142342
|
-
deprecated:
|
|
142341
|
+
comment: schema13.description,
|
|
142342
|
+
deprecated: schema13.deprecated,
|
|
142343
142343
|
keyName,
|
|
142344
|
-
standaloneName: standaloneName(
|
|
142345
|
-
params:
|
|
142344
|
+
standaloneName: standaloneName(schema13, keyNameFromDefinition, usedNames, options8),
|
|
142345
|
+
params: schema13.oneOf.map((_10) => parse11(_10, options8, undefined, processed, usedNames)),
|
|
142346
142346
|
type: "UNION"
|
|
142347
142347
|
};
|
|
142348
142348
|
case "REFERENCE":
|
|
142349
|
-
throw Error((0, util_1.format)("Refs should have been resolved by the resolver!",
|
|
142349
|
+
throw Error((0, util_1.format)("Refs should have been resolved by the resolver!", schema13));
|
|
142350
142350
|
case "STRING":
|
|
142351
142351
|
return {
|
|
142352
|
-
comment:
|
|
142353
|
-
deprecated:
|
|
142352
|
+
comment: schema13.description,
|
|
142353
|
+
deprecated: schema13.deprecated,
|
|
142354
142354
|
keyName,
|
|
142355
|
-
standaloneName: standaloneName(
|
|
142355
|
+
standaloneName: standaloneName(schema13, keyNameFromDefinition, usedNames, options8),
|
|
142356
142356
|
type: "STRING"
|
|
142357
142357
|
};
|
|
142358
142358
|
case "TYPED_ARRAY":
|
|
142359
|
-
if (Array.isArray(
|
|
142360
|
-
const minItems2 =
|
|
142361
|
-
const maxItems2 =
|
|
142359
|
+
if (Array.isArray(schema13.items)) {
|
|
142360
|
+
const minItems2 = schema13.minItems;
|
|
142361
|
+
const maxItems2 = schema13.maxItems;
|
|
142362
142362
|
const arrayType = {
|
|
142363
|
-
comment:
|
|
142364
|
-
deprecated:
|
|
142363
|
+
comment: schema13.description,
|
|
142364
|
+
deprecated: schema13.deprecated,
|
|
142365
142365
|
keyName,
|
|
142366
142366
|
maxItems: maxItems2,
|
|
142367
142367
|
minItems: minItems2,
|
|
142368
|
-
standaloneName: standaloneName(
|
|
142369
|
-
params:
|
|
142368
|
+
standaloneName: standaloneName(schema13, keyNameFromDefinition, usedNames, options8),
|
|
142369
|
+
params: schema13.items.map((_10) => parse11(_10, options8, undefined, processed, usedNames)),
|
|
142370
142370
|
type: "TUPLE"
|
|
142371
142371
|
};
|
|
142372
|
-
if (
|
|
142372
|
+
if (schema13.additionalItems === true) {
|
|
142373
142373
|
arrayType.spreadParam = options8.unknownAny ? AST_1.T_UNKNOWN : AST_1.T_ANY;
|
|
142374
|
-
} else if (
|
|
142375
|
-
arrayType.spreadParam = parse11(
|
|
142374
|
+
} else if (schema13.additionalItems) {
|
|
142375
|
+
arrayType.spreadParam = parse11(schema13.additionalItems, options8, undefined, processed, usedNames);
|
|
142376
142376
|
}
|
|
142377
142377
|
return arrayType;
|
|
142378
142378
|
} else {
|
|
142379
142379
|
return {
|
|
142380
|
-
comment:
|
|
142381
|
-
deprecated:
|
|
142380
|
+
comment: schema13.description,
|
|
142381
|
+
deprecated: schema13.deprecated,
|
|
142382
142382
|
keyName,
|
|
142383
|
-
standaloneName: standaloneName(
|
|
142384
|
-
params: parse11(
|
|
142383
|
+
standaloneName: standaloneName(schema13, keyNameFromDefinition, usedNames, options8),
|
|
142384
|
+
params: parse11(schema13.items, options8, `{keyNameFromDefinition}Items`, processed, usedNames),
|
|
142385
142385
|
type: "ARRAY"
|
|
142386
142386
|
};
|
|
142387
142387
|
}
|
|
142388
142388
|
case "UNION":
|
|
142389
142389
|
return {
|
|
142390
|
-
comment:
|
|
142391
|
-
deprecated:
|
|
142390
|
+
comment: schema13.description,
|
|
142391
|
+
deprecated: schema13.deprecated,
|
|
142392
142392
|
keyName,
|
|
142393
|
-
standaloneName: standaloneName(
|
|
142394
|
-
params:
|
|
142395
|
-
const member = Object.assign(Object.assign({}, (0, lodash_1.omit)(
|
|
142393
|
+
standaloneName: standaloneName(schema13, keyNameFromDefinition, usedNames, options8),
|
|
142394
|
+
params: schema13.type.map((type2) => {
|
|
142395
|
+
const member = Object.assign(Object.assign({}, (0, lodash_1.omit)(schema13, "$id", "description", "title")), { type: type2 });
|
|
142396
142396
|
(0, utils_1.maybeStripDefault)(member);
|
|
142397
142397
|
(0, applySchemaTyping_1.applySchemaTyping)(member);
|
|
142398
142398
|
return parse11(member, options8, undefined, processed, usedNames);
|
|
@@ -142401,80 +142401,80 @@ var require_parser2 = __commonJS((exports) => {
|
|
|
142401
142401
|
};
|
|
142402
142402
|
case "UNNAMED_ENUM":
|
|
142403
142403
|
return {
|
|
142404
|
-
comment:
|
|
142405
|
-
deprecated:
|
|
142404
|
+
comment: schema13.description,
|
|
142405
|
+
deprecated: schema13.deprecated,
|
|
142406
142406
|
keyName,
|
|
142407
|
-
standaloneName: standaloneName(
|
|
142408
|
-
params:
|
|
142407
|
+
standaloneName: standaloneName(schema13, keyNameFromDefinition, usedNames, options8),
|
|
142408
|
+
params: schema13.enum.map((_10) => parseLiteral(_10, undefined)),
|
|
142409
142409
|
type: "UNION"
|
|
142410
142410
|
};
|
|
142411
142411
|
case "UNNAMED_SCHEMA":
|
|
142412
|
-
return newInterface(
|
|
142412
|
+
return newInterface(schema13, options8, processed, usedNames, keyName, keyNameFromDefinition);
|
|
142413
142413
|
case "UNTYPED_ARRAY":
|
|
142414
|
-
const minItems =
|
|
142415
|
-
const maxItems = typeof
|
|
142414
|
+
const minItems = schema13.minItems;
|
|
142415
|
+
const maxItems = typeof schema13.maxItems === "number" ? schema13.maxItems : -1;
|
|
142416
142416
|
const params = options8.unknownAny ? AST_1.T_UNKNOWN : AST_1.T_ANY;
|
|
142417
142417
|
if (minItems > 0 || maxItems >= 0) {
|
|
142418
142418
|
return {
|
|
142419
|
-
comment:
|
|
142420
|
-
deprecated:
|
|
142419
|
+
comment: schema13.description,
|
|
142420
|
+
deprecated: schema13.deprecated,
|
|
142421
142421
|
keyName,
|
|
142422
|
-
maxItems:
|
|
142422
|
+
maxItems: schema13.maxItems,
|
|
142423
142423
|
minItems,
|
|
142424
142424
|
params: Array(Math.max(maxItems, minItems) || 0).fill(params),
|
|
142425
142425
|
spreadParam: maxItems >= 0 ? undefined : params,
|
|
142426
|
-
standaloneName: standaloneName(
|
|
142426
|
+
standaloneName: standaloneName(schema13, keyNameFromDefinition, usedNames, options8),
|
|
142427
142427
|
type: "TUPLE"
|
|
142428
142428
|
};
|
|
142429
142429
|
}
|
|
142430
142430
|
return {
|
|
142431
|
-
comment:
|
|
142432
|
-
deprecated:
|
|
142431
|
+
comment: schema13.description,
|
|
142432
|
+
deprecated: schema13.deprecated,
|
|
142433
142433
|
keyName,
|
|
142434
142434
|
params,
|
|
142435
|
-
standaloneName: standaloneName(
|
|
142435
|
+
standaloneName: standaloneName(schema13, keyNameFromDefinition, usedNames, options8),
|
|
142436
142436
|
type: "ARRAY"
|
|
142437
142437
|
};
|
|
142438
142438
|
}
|
|
142439
142439
|
}
|
|
142440
|
-
function standaloneName(
|
|
142440
|
+
function standaloneName(schema13, keyNameFromDefinition, usedNames, options8) {
|
|
142441
142441
|
var _a7;
|
|
142442
|
-
const name2 = ((_a7 = options8.customName) === null || _a7 === undefined ? undefined : _a7.call(options8,
|
|
142442
|
+
const name2 = ((_a7 = options8.customName) === null || _a7 === undefined ? undefined : _a7.call(options8, schema13, keyNameFromDefinition)) || schema13.title || schema13.$id || keyNameFromDefinition;
|
|
142443
142443
|
if (name2) {
|
|
142444
142444
|
return (0, utils_1.generateName)(name2, usedNames);
|
|
142445
142445
|
}
|
|
142446
142446
|
}
|
|
142447
|
-
function newInterface(
|
|
142448
|
-
const name2 = standaloneName(
|
|
142447
|
+
function newInterface(schema13, options8, processed, usedNames, keyName, keyNameFromDefinition) {
|
|
142448
|
+
const name2 = standaloneName(schema13, keyNameFromDefinition, usedNames, options8);
|
|
142449
142449
|
return {
|
|
142450
|
-
comment:
|
|
142451
|
-
deprecated:
|
|
142450
|
+
comment: schema13.description,
|
|
142451
|
+
deprecated: schema13.deprecated,
|
|
142452
142452
|
keyName,
|
|
142453
|
-
params: parseSchema(
|
|
142453
|
+
params: parseSchema(schema13, options8, processed, usedNames, name2),
|
|
142454
142454
|
standaloneName: name2,
|
|
142455
|
-
superTypes: parseSuperTypes(
|
|
142455
|
+
superTypes: parseSuperTypes(schema13, options8, processed, usedNames),
|
|
142456
142456
|
type: "INTERFACE"
|
|
142457
142457
|
};
|
|
142458
142458
|
}
|
|
142459
|
-
function parseSuperTypes(
|
|
142460
|
-
const superTypes =
|
|
142459
|
+
function parseSuperTypes(schema13, options8, processed, usedNames) {
|
|
142460
|
+
const superTypes = schema13.extends;
|
|
142461
142461
|
if (!superTypes) {
|
|
142462
142462
|
return [];
|
|
142463
142463
|
}
|
|
142464
142464
|
return superTypes.map((_10) => parse11(_10, options8, undefined, processed, usedNames));
|
|
142465
142465
|
}
|
|
142466
|
-
function parseSchema(
|
|
142467
|
-
let asts = (0, lodash_1.map)(
|
|
142466
|
+
function parseSchema(schema13, options8, processed, usedNames, parentSchemaName) {
|
|
142467
|
+
let asts = (0, lodash_1.map)(schema13.properties, (value, key2) => ({
|
|
142468
142468
|
ast: parse11(value, options8, key2, processed, usedNames),
|
|
142469
142469
|
isPatternProperty: false,
|
|
142470
|
-
isRequired: (0, lodash_1.includes)(
|
|
142470
|
+
isRequired: (0, lodash_1.includes)(schema13.required || [], key2),
|
|
142471
142471
|
isUnreachableDefinition: false,
|
|
142472
142472
|
keyName: key2
|
|
142473
142473
|
}));
|
|
142474
142474
|
let singlePatternProperty = false;
|
|
142475
|
-
if (
|
|
142476
|
-
singlePatternProperty = !
|
|
142477
|
-
asts = asts.concat((0, lodash_1.map)(
|
|
142475
|
+
if (schema13.patternProperties) {
|
|
142476
|
+
singlePatternProperty = !schema13.additionalProperties && Object.keys(schema13.patternProperties).length === 1;
|
|
142477
|
+
asts = asts.concat((0, lodash_1.map)(schema13.patternProperties, (value, key2) => {
|
|
142478
142478
|
const ast = parse11(value, options8, key2, processed, usedNames);
|
|
142479
142479
|
const comment = `This interface was referenced by \`${parentSchemaName}\`'s JSON-Schema definition
|
|
142480
142480
|
via the \`patternProperty\` "${key2.replace("*/", "*\\/")}".`;
|
|
@@ -142484,14 +142484,14 @@ ${comment}` : comment;
|
|
|
142484
142484
|
return {
|
|
142485
142485
|
ast,
|
|
142486
142486
|
isPatternProperty: !singlePatternProperty,
|
|
142487
|
-
isRequired: singlePatternProperty || (0, lodash_1.includes)(
|
|
142487
|
+
isRequired: singlePatternProperty || (0, lodash_1.includes)(schema13.required || [], key2),
|
|
142488
142488
|
isUnreachableDefinition: false,
|
|
142489
142489
|
keyName: singlePatternProperty ? "[k: string]" : key2
|
|
142490
142490
|
};
|
|
142491
142491
|
}));
|
|
142492
142492
|
}
|
|
142493
142493
|
if (options8.unreachableDefinitions) {
|
|
142494
|
-
asts = asts.concat((0, lodash_1.map)(
|
|
142494
|
+
asts = asts.concat((0, lodash_1.map)(schema13.$defs, (value, key2) => {
|
|
142495
142495
|
const ast = parse11(value, options8, key2, processed, usedNames);
|
|
142496
142496
|
const comment = `This interface was referenced by \`${parentSchemaName}\`'s JSON-Schema
|
|
142497
142497
|
via the \`definition\` "${key2}".`;
|
|
@@ -142501,13 +142501,13 @@ ${comment}` : comment;
|
|
|
142501
142501
|
return {
|
|
142502
142502
|
ast,
|
|
142503
142503
|
isPatternProperty: false,
|
|
142504
|
-
isRequired: (0, lodash_1.includes)(
|
|
142504
|
+
isRequired: (0, lodash_1.includes)(schema13.required || [], key2),
|
|
142505
142505
|
isUnreachableDefinition: true,
|
|
142506
142506
|
keyName: key2
|
|
142507
142507
|
};
|
|
142508
142508
|
}));
|
|
142509
142509
|
}
|
|
142510
|
-
switch (
|
|
142510
|
+
switch (schema13.additionalProperties) {
|
|
142511
142511
|
case undefined:
|
|
142512
142512
|
case true:
|
|
142513
142513
|
if (singlePatternProperty) {
|
|
@@ -142524,7 +142524,7 @@ ${comment}` : comment;
|
|
|
142524
142524
|
return asts;
|
|
142525
142525
|
default:
|
|
142526
142526
|
return asts.concat({
|
|
142527
|
-
ast: parse11(
|
|
142527
|
+
ast: parse11(schema13.additionalProperties, options8, "[k: string]", processed, usedNames),
|
|
142528
142528
|
isPatternProperty: false,
|
|
142529
142529
|
isRequired: true,
|
|
142530
142530
|
isUnreachableDefinition: false,
|
|
@@ -142532,22 +142532,22 @@ ${comment}` : comment;
|
|
|
142532
142532
|
});
|
|
142533
142533
|
}
|
|
142534
142534
|
}
|
|
142535
|
-
function getDefinitions(
|
|
142536
|
-
if (processed.has(
|
|
142535
|
+
function getDefinitions(schema13, isSchema = true, processed = new Set) {
|
|
142536
|
+
if (processed.has(schema13)) {
|
|
142537
142537
|
return {};
|
|
142538
142538
|
}
|
|
142539
|
-
processed.add(
|
|
142540
|
-
if (Array.isArray(
|
|
142541
|
-
return
|
|
142539
|
+
processed.add(schema13);
|
|
142540
|
+
if (Array.isArray(schema13)) {
|
|
142541
|
+
return schema13.reduce((prev, cur) => Object.assign(Object.assign({}, prev), getDefinitions(cur, false, processed)), {});
|
|
142542
142542
|
}
|
|
142543
|
-
if ((0, lodash_1.isPlainObject)(
|
|
142544
|
-
return Object.assign(Object.assign({}, isSchema && hasDefinitions(
|
|
142543
|
+
if ((0, lodash_1.isPlainObject)(schema13)) {
|
|
142544
|
+
return Object.assign(Object.assign({}, isSchema && hasDefinitions(schema13) ? schema13.$defs : {}), Object.keys(schema13).reduce((prev, cur) => Object.assign(Object.assign({}, prev), getDefinitions(schema13[cur], false, processed)), {}));
|
|
142545
142545
|
}
|
|
142546
142546
|
return {};
|
|
142547
142547
|
}
|
|
142548
142548
|
var getDefinitionsMemoized = (0, lodash_1.memoize)(getDefinitions);
|
|
142549
|
-
function hasDefinitions(
|
|
142550
|
-
return "$defs" in
|
|
142549
|
+
function hasDefinitions(schema13) {
|
|
142550
|
+
return "$defs" in schema13;
|
|
142551
142551
|
}
|
|
142552
142552
|
});
|
|
142553
142553
|
|
|
@@ -142972,7 +142972,7 @@ var require_url = __commonJS((exports) => {
|
|
|
142972
142972
|
exports.fromFileSystemPath = fromFileSystemPath;
|
|
142973
142973
|
exports.toFileSystemPath = toFileSystemPath;
|
|
142974
142974
|
exports.safePointerToPath = safePointerToPath;
|
|
142975
|
-
exports.relative =
|
|
142975
|
+
exports.relative = relative6;
|
|
142976
142976
|
var convert_path_to_posix_1 = __importDefault(require_convert_path_to_posix());
|
|
142977
142977
|
var path_1 = __importStar(__require("path"));
|
|
142978
142978
|
var forwardSlashPattern = /\//g;
|
|
@@ -143122,7 +143122,7 @@ var require_url = __commonJS((exports) => {
|
|
|
143122
143122
|
return decodeURIComponent(value).replace(jsonPointerSlash, "/").replace(jsonPointerTilde, "~");
|
|
143123
143123
|
});
|
|
143124
143124
|
}
|
|
143125
|
-
function
|
|
143125
|
+
function relative6(from, to5) {
|
|
143126
143126
|
if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
|
|
143127
143127
|
return resolve13(from, to5);
|
|
143128
143128
|
}
|
|
@@ -144371,7 +144371,7 @@ var require_normalize_args = __commonJS((exports) => {
|
|
|
144371
144371
|
var options_js_1 = require_options();
|
|
144372
144372
|
function normalizeArgs(_args) {
|
|
144373
144373
|
let path18;
|
|
144374
|
-
let
|
|
144374
|
+
let schema13;
|
|
144375
144375
|
let options8;
|
|
144376
144376
|
let callback;
|
|
144377
144377
|
const args = Array.prototype.slice.call(_args);
|
|
@@ -144381,15 +144381,15 @@ var require_normalize_args = __commonJS((exports) => {
|
|
|
144381
144381
|
if (typeof args[0] === "string") {
|
|
144382
144382
|
path18 = args[0];
|
|
144383
144383
|
if (typeof args[2] === "object") {
|
|
144384
|
-
|
|
144384
|
+
schema13 = args[1];
|
|
144385
144385
|
options8 = args[2];
|
|
144386
144386
|
} else {
|
|
144387
|
-
|
|
144387
|
+
schema13 = undefined;
|
|
144388
144388
|
options8 = args[1];
|
|
144389
144389
|
}
|
|
144390
144390
|
} else {
|
|
144391
144391
|
path18 = "";
|
|
144392
|
-
|
|
144392
|
+
schema13 = args[0];
|
|
144393
144393
|
options8 = args[1];
|
|
144394
144394
|
}
|
|
144395
144395
|
try {
|
|
@@ -144397,12 +144397,12 @@ var require_normalize_args = __commonJS((exports) => {
|
|
|
144397
144397
|
} catch (e8) {
|
|
144398
144398
|
console.error(`JSON Schema Ref Parser: Error normalizing options: ${e8}`);
|
|
144399
144399
|
}
|
|
144400
|
-
if (!options8.mutateInputSchema && typeof
|
|
144401
|
-
|
|
144400
|
+
if (!options8.mutateInputSchema && typeof schema13 === "object") {
|
|
144401
|
+
schema13 = JSON.parse(JSON.stringify(schema13));
|
|
144402
144402
|
}
|
|
144403
144403
|
return {
|
|
144404
144404
|
path: path18,
|
|
144405
|
-
schema:
|
|
144405
|
+
schema: schema13,
|
|
144406
144406
|
options: options8,
|
|
144407
144407
|
callback
|
|
144408
144408
|
};
|
|
@@ -145191,12 +145191,12 @@ var require_resolver = __commonJS((exports) => {
|
|
|
145191
145191
|
var json_schema_ref_parser_1 = require_lib3();
|
|
145192
145192
|
var utils_1 = require_utils7();
|
|
145193
145193
|
function dereference(schema_1, _a7) {
|
|
145194
|
-
return __awaiter(this, arguments, undefined, function* (
|
|
145195
|
-
(0, utils_1.log)("green", "dereferencer", "Dereferencing input schema:", cwd,
|
|
145194
|
+
return __awaiter(this, arguments, undefined, function* (schema13, { cwd, $refOptions }) {
|
|
145195
|
+
(0, utils_1.log)("green", "dereferencer", "Dereferencing input schema:", cwd, schema13);
|
|
145196
145196
|
const parser2 = new json_schema_ref_parser_1.$RefParser;
|
|
145197
145197
|
const dereferencedPaths = new WeakMap;
|
|
145198
|
-
const dereferencedSchema = yield parser2.dereference(cwd,
|
|
145199
|
-
dereferencedPaths.set(
|
|
145198
|
+
const dereferencedSchema = yield parser2.dereference(cwd, schema13, Object.assign(Object.assign({}, $refOptions), { dereference: Object.assign(Object.assign({}, $refOptions.dereference), { onDereference($ref, schema14) {
|
|
145199
|
+
dereferencedPaths.set(schema14, $ref);
|
|
145200
145200
|
} }) }));
|
|
145201
145201
|
return { dereferencedPaths, dereferencedSchema };
|
|
145202
145202
|
});
|
|
@@ -145210,46 +145210,46 @@ var require_validator = __commonJS((exports) => {
|
|
|
145210
145210
|
exports.validate = undefined;
|
|
145211
145211
|
var utils_1 = require_utils7();
|
|
145212
145212
|
var rules = new Map;
|
|
145213
|
-
rules.set("Enum members and tsEnumNames must be of the same length", (
|
|
145214
|
-
if (
|
|
145213
|
+
rules.set("Enum members and tsEnumNames must be of the same length", (schema13) => {
|
|
145214
|
+
if (schema13.enum && schema13.tsEnumNames && schema13.enum.length !== schema13.tsEnumNames.length) {
|
|
145215
145215
|
return false;
|
|
145216
145216
|
}
|
|
145217
145217
|
});
|
|
145218
|
-
rules.set("tsEnumNames must be an array of strings", (
|
|
145219
|
-
if (
|
|
145218
|
+
rules.set("tsEnumNames must be an array of strings", (schema13) => {
|
|
145219
|
+
if (schema13.tsEnumNames && schema13.tsEnumNames.some((_10) => typeof _10 !== "string")) {
|
|
145220
145220
|
return false;
|
|
145221
145221
|
}
|
|
145222
145222
|
});
|
|
145223
|
-
rules.set("When both maxItems and minItems are present, maxItems >= minItems", (
|
|
145224
|
-
const { maxItems, minItems } =
|
|
145223
|
+
rules.set("When both maxItems and minItems are present, maxItems >= minItems", (schema13) => {
|
|
145224
|
+
const { maxItems, minItems } = schema13;
|
|
145225
145225
|
if (typeof maxItems === "number" && typeof minItems === "number") {
|
|
145226
145226
|
return maxItems >= minItems;
|
|
145227
145227
|
}
|
|
145228
145228
|
});
|
|
145229
|
-
rules.set("When maxItems exists, maxItems >= 0", (
|
|
145230
|
-
const { maxItems } =
|
|
145229
|
+
rules.set("When maxItems exists, maxItems >= 0", (schema13) => {
|
|
145230
|
+
const { maxItems } = schema13;
|
|
145231
145231
|
if (typeof maxItems === "number") {
|
|
145232
145232
|
return maxItems >= 0;
|
|
145233
145233
|
}
|
|
145234
145234
|
});
|
|
145235
|
-
rules.set("When minItems exists, minItems >= 0", (
|
|
145236
|
-
const { minItems } =
|
|
145235
|
+
rules.set("When minItems exists, minItems >= 0", (schema13) => {
|
|
145236
|
+
const { minItems } = schema13;
|
|
145237
145237
|
if (typeof minItems === "number") {
|
|
145238
145238
|
return minItems >= 0;
|
|
145239
145239
|
}
|
|
145240
145240
|
});
|
|
145241
|
-
rules.set("deprecated must be a boolean", (
|
|
145242
|
-
const typeOfDeprecated = typeof
|
|
145241
|
+
rules.set("deprecated must be a boolean", (schema13) => {
|
|
145242
|
+
const typeOfDeprecated = typeof schema13.deprecated;
|
|
145243
145243
|
return typeOfDeprecated === "boolean" || typeOfDeprecated === "undefined";
|
|
145244
145244
|
});
|
|
145245
|
-
function validate2(
|
|
145245
|
+
function validate2(schema13, filename) {
|
|
145246
145246
|
const errors5 = [];
|
|
145247
145247
|
rules.forEach((rule, ruleName) => {
|
|
145248
|
-
(0, utils_1.traverse)(
|
|
145249
|
-
if (rule(
|
|
145248
|
+
(0, utils_1.traverse)(schema13, (schema14, key2) => {
|
|
145249
|
+
if (rule(schema14) === false) {
|
|
145250
145250
|
errors5.push(`Error at key "${key2}" in file "${filename}": ${ruleName}`);
|
|
145251
145251
|
}
|
|
145252
|
-
return
|
|
145252
|
+
return schema14;
|
|
145253
145253
|
});
|
|
145254
145254
|
});
|
|
145255
145255
|
return errors5;
|
|
@@ -145263,25 +145263,25 @@ var require_linker = __commonJS((exports) => {
|
|
|
145263
145263
|
exports.link = undefined;
|
|
145264
145264
|
var JSONSchema_1 = require_JSONSchema();
|
|
145265
145265
|
var lodash_1 = require_lodash8();
|
|
145266
|
-
function link2(
|
|
145267
|
-
if (!Array.isArray(
|
|
145268
|
-
return
|
|
145266
|
+
function link2(schema13, parent = null) {
|
|
145267
|
+
if (!Array.isArray(schema13) && !(0, lodash_1.isPlainObject)(schema13)) {
|
|
145268
|
+
return schema13;
|
|
145269
145269
|
}
|
|
145270
|
-
if (
|
|
145271
|
-
return
|
|
145270
|
+
if (schema13.hasOwnProperty(JSONSchema_1.Parent)) {
|
|
145271
|
+
return schema13;
|
|
145272
145272
|
}
|
|
145273
|
-
Object.defineProperty(
|
|
145273
|
+
Object.defineProperty(schema13, JSONSchema_1.Parent, {
|
|
145274
145274
|
enumerable: false,
|
|
145275
145275
|
value: parent,
|
|
145276
145276
|
writable: false
|
|
145277
145277
|
});
|
|
145278
|
-
if (Array.isArray(
|
|
145279
|
-
|
|
145278
|
+
if (Array.isArray(schema13)) {
|
|
145279
|
+
schema13.forEach((child) => link2(child, schema13));
|
|
145280
145280
|
}
|
|
145281
|
-
for (const key2 in
|
|
145282
|
-
link2(
|
|
145281
|
+
for (const key2 in schema13) {
|
|
145282
|
+
link2(schema13[key2], schema13);
|
|
145283
145283
|
}
|
|
145284
|
-
return
|
|
145284
|
+
return schema13;
|
|
145285
145285
|
}
|
|
145286
145286
|
exports.link = link2;
|
|
145287
145287
|
});
|
|
@@ -145373,8 +145373,8 @@ var require_src3 = __commonJS((exports) => {
|
|
|
145373
145373
|
unknownAny: true
|
|
145374
145374
|
};
|
|
145375
145375
|
function compileFromFile(filename, options8 = exports.DEFAULT_OPTIONS) {
|
|
145376
|
-
const
|
|
145377
|
-
return compile(
|
|
145376
|
+
const schema13 = parseAsJSONSchema(filename);
|
|
145377
|
+
return compile(schema13, (0, utils_1.stripExtension)(filename), Object.assign({ cwd: (0, path_1.dirname)(filename) }, options8));
|
|
145378
145378
|
}
|
|
145379
145379
|
exports.compileFromFile = compileFromFile;
|
|
145380
145380
|
function parseAsJSONSchema(filename) {
|
|
@@ -145384,7 +145384,7 @@ var require_src3 = __commonJS((exports) => {
|
|
|
145384
145384
|
return (0, utils_1.parseFileAsJSONSchema)(filename, contents.toString());
|
|
145385
145385
|
}
|
|
145386
145386
|
function compile(schema_1, name_1) {
|
|
145387
|
-
return __awaiter(this, arguments, undefined, function* (
|
|
145387
|
+
return __awaiter(this, arguments, undefined, function* (schema13, name2, options8 = {}) {
|
|
145388
145388
|
(0, optionValidator_1.validateOptions)(options8);
|
|
145389
145389
|
const _options = (0, lodash_1.merge)({}, exports.DEFAULT_OPTIONS, options8);
|
|
145390
145390
|
const start = Date.now();
|
|
@@ -145394,7 +145394,7 @@ var require_src3 = __commonJS((exports) => {
|
|
|
145394
145394
|
if (!(0, lodash_1.endsWith)(_options.cwd, "/")) {
|
|
145395
145395
|
_options.cwd += "/";
|
|
145396
145396
|
}
|
|
145397
|
-
const _schema = (0, lodash_1.cloneDeep)(
|
|
145397
|
+
const _schema = (0, lodash_1.cloneDeep)(schema13);
|
|
145398
145398
|
const { dereferencedPaths, dereferencedSchema } = yield (0, resolver_1.dereference)(_schema, _options);
|
|
145399
145399
|
if (process.env.VERBOSE) {
|
|
145400
145400
|
if ((0, util_1.isDeepStrictEqual)(_schema, dereferencedSchema)) {
|
|
@@ -146451,7 +146451,7 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
146451
146451
|
* Copyright(c) 2014-2018 Douglas Christopher Wilson
|
|
146452
146452
|
* MIT Licensed
|
|
146453
146453
|
*/
|
|
146454
|
-
var
|
|
146454
|
+
var relative6 = __require("path").relative;
|
|
146455
146455
|
module.exports = depd;
|
|
146456
146456
|
var basePath = process.cwd();
|
|
146457
146457
|
function containsNamespace(str, namespace) {
|
|
@@ -146647,7 +146647,7 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
146647
146647
|
return formatted;
|
|
146648
146648
|
}
|
|
146649
146649
|
function formatLocation(callSite) {
|
|
146650
|
-
return
|
|
146650
|
+
return relative6(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
|
|
146651
146651
|
}
|
|
146652
146652
|
function getStack() {
|
|
146653
146653
|
var limit = Error.stackTraceLimit;
|
|
@@ -164109,8 +164109,8 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164109
164109
|
var debug = require_src4()("express:view");
|
|
164110
164110
|
var path18 = __require("node:path");
|
|
164111
164111
|
var fs28 = __require("node:fs");
|
|
164112
|
-
var
|
|
164113
|
-
var
|
|
164112
|
+
var dirname22 = path18.dirname;
|
|
164113
|
+
var basename8 = path18.basename;
|
|
164114
164114
|
var extname2 = path18.extname;
|
|
164115
164115
|
var join29 = path18.join;
|
|
164116
164116
|
var resolve13 = path18.resolve;
|
|
@@ -164148,8 +164148,8 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164148
164148
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
164149
164149
|
var root2 = roots[i5];
|
|
164150
164150
|
var loc = resolve13(root2, name2);
|
|
164151
|
-
var dir =
|
|
164152
|
-
var file2 =
|
|
164151
|
+
var dir = dirname22(loc);
|
|
164152
|
+
var file2 = basename8(loc);
|
|
164153
164153
|
path19 = this.resolve(dir, file2);
|
|
164154
164154
|
}
|
|
164155
164155
|
return path19;
|
|
@@ -164179,7 +164179,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164179
164179
|
if (stat3 && stat3.isFile()) {
|
|
164180
164180
|
return path19;
|
|
164181
164181
|
}
|
|
164182
|
-
path19 = join29(dir,
|
|
164182
|
+
path19 = join29(dir, basename8(file2, ext), "index" + ext);
|
|
164183
164183
|
stat3 = tryStat(path19);
|
|
164184
164184
|
if (stat3 && stat3.isFile()) {
|
|
164185
164185
|
return path19;
|
|
@@ -167500,7 +167500,7 @@ var require_content_disposition = __commonJS((exports, module) => {
|
|
|
167500
167500
|
*/
|
|
167501
167501
|
module.exports = contentDisposition;
|
|
167502
167502
|
module.exports.parse = parse11;
|
|
167503
|
-
var
|
|
167503
|
+
var basename8 = __require("path").basename;
|
|
167504
167504
|
var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g;
|
|
167505
167505
|
var HEX_ESCAPE_REGEXP = /%[0-9A-Fa-f]{2}/;
|
|
167506
167506
|
var HEX_ESCAPE_REPLACE_REGEXP = /%([0-9A-Fa-f]{2})/g;
|
|
@@ -167535,9 +167535,9 @@ var require_content_disposition = __commonJS((exports, module) => {
|
|
|
167535
167535
|
if (typeof fallback === "string" && NON_LATIN1_REGEXP.test(fallback)) {
|
|
167536
167536
|
throw new TypeError("fallback must be ISO-8859-1 string");
|
|
167537
167537
|
}
|
|
167538
|
-
var name2 =
|
|
167538
|
+
var name2 = basename8(filename);
|
|
167539
167539
|
var isQuotedString = TEXT_REGEXP.test(name2);
|
|
167540
|
-
var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name2) :
|
|
167540
|
+
var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name2) : basename8(fallback);
|
|
167541
167541
|
var hasFallback = typeof fallbackName === "string" && fallbackName !== name2;
|
|
167542
167542
|
if (hasFallback || !isQuotedString || HEX_ESCAPE_REGEXP.test(name2)) {
|
|
167543
167543
|
params["filename*"] = name2;
|
|
@@ -169284,18 +169284,18 @@ var require_common7 = __commonJS((exports) => {
|
|
|
169284
169284
|
retSegs.push.apply(retSegs, lastSegs);
|
|
169285
169285
|
return retSegs.join("?");
|
|
169286
169286
|
};
|
|
169287
|
-
common2.rewriteCookieProperty = function rewriteCookieProperty(header2,
|
|
169287
|
+
common2.rewriteCookieProperty = function rewriteCookieProperty(header2, config14, property) {
|
|
169288
169288
|
if (Array.isArray(header2)) {
|
|
169289
169289
|
return header2.map(function(headerElement) {
|
|
169290
|
-
return rewriteCookieProperty(headerElement,
|
|
169290
|
+
return rewriteCookieProperty(headerElement, config14, property);
|
|
169291
169291
|
});
|
|
169292
169292
|
}
|
|
169293
169293
|
return header2.replace(new RegExp("(;\\s*" + property + "=)([^;]+)", "i"), function(match, prefix, previousValue) {
|
|
169294
169294
|
var newValue;
|
|
169295
|
-
if (previousValue in
|
|
169296
|
-
newValue =
|
|
169297
|
-
} else if ("*" in
|
|
169298
|
-
newValue =
|
|
169295
|
+
if (previousValue in config14) {
|
|
169296
|
+
newValue = config14[previousValue];
|
|
169297
|
+
} else if ("*" in config14) {
|
|
169298
|
+
newValue = config14["*"];
|
|
169299
169299
|
} else {
|
|
169300
169300
|
return match;
|
|
169301
169301
|
}
|
|
@@ -169795,8 +169795,8 @@ var require_follow_redirects = __commonJS((exports, module) => {
|
|
|
169795
169795
|
}
|
|
169796
169796
|
return parsed;
|
|
169797
169797
|
}
|
|
169798
|
-
function resolveUrl(
|
|
169799
|
-
return useNativeURL ? new URL2(
|
|
169798
|
+
function resolveUrl(relative6, base) {
|
|
169799
|
+
return useNativeURL ? new URL2(relative6, base) : parseUrl(url3.resolve(base, relative6));
|
|
169800
169800
|
}
|
|
169801
169801
|
function validateUrl(input) {
|
|
169802
169802
|
if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
|
|
@@ -170660,9 +170660,9 @@ var require_router2 = __commonJS((exports) => {
|
|
|
170660
170660
|
var is_plain_object_1 = require_is_plain_object();
|
|
170661
170661
|
var debug_1 = require_debug4();
|
|
170662
170662
|
var debug = debug_1.Debug.extend("router");
|
|
170663
|
-
async function getTarget(req,
|
|
170663
|
+
async function getTarget(req, config14) {
|
|
170664
170664
|
let newTarget;
|
|
170665
|
-
const router =
|
|
170665
|
+
const router = config14.router;
|
|
170666
170666
|
if ((0, is_plain_object_1.isPlainObject)(router)) {
|
|
170667
170667
|
newTarget = getTargetFromProxyTable(req, router);
|
|
170668
170668
|
} else if (typeof router === "function") {
|
|
@@ -171434,8 +171434,8 @@ var require_tmp = __commonJS((exports, module) => {
|
|
|
171434
171434
|
const name2 = options8.name;
|
|
171435
171435
|
if (path18.isAbsolute(name2))
|
|
171436
171436
|
throw new Error(`name option must not contain an absolute path, found "${name2}".`);
|
|
171437
|
-
const
|
|
171438
|
-
if (
|
|
171437
|
+
const basename8 = path18.basename(name2);
|
|
171438
|
+
if (basename8 === ".." || basename8 === "." || basename8 !== name2)
|
|
171439
171439
|
throw new Error(`name option must not contain a path, found "${name2}".`);
|
|
171440
171440
|
}
|
|
171441
171441
|
if (!_isUndefined(options8.template) && !options8.template.match(TEMPLATE_PATTERN)) {
|
|
@@ -213566,7 +213566,7 @@ var require_utils12 = __commonJS((exports, module) => {
|
|
|
213566
213566
|
if (decode4)
|
|
213567
213567
|
return decode4(data, hint);
|
|
213568
213568
|
}
|
|
213569
|
-
function
|
|
213569
|
+
function basename8(path18) {
|
|
213570
213570
|
if (typeof path18 !== "string")
|
|
213571
213571
|
return "";
|
|
213572
213572
|
for (let i5 = path18.length - 1;i5 >= 0; --i5) {
|
|
@@ -214870,7 +214870,7 @@ var require_utils12 = __commonJS((exports, module) => {
|
|
|
214870
214870
|
-1
|
|
214871
214871
|
];
|
|
214872
214872
|
module.exports = {
|
|
214873
|
-
basename:
|
|
214873
|
+
basename: basename8,
|
|
214874
214874
|
convertToUTF8,
|
|
214875
214875
|
getDecoder,
|
|
214876
214876
|
parseContentType,
|
|
@@ -215278,7 +215278,7 @@ var require_multipart = __commonJS((exports, module) => {
|
|
|
215278
215278
|
var { Readable: Readable6, Writable: Writable4 } = __require("stream");
|
|
215279
215279
|
var StreamSearch = require_sbmh();
|
|
215280
215280
|
var {
|
|
215281
|
-
basename:
|
|
215281
|
+
basename: basename8,
|
|
215282
215282
|
convertToUTF8,
|
|
215283
215283
|
getDecoder,
|
|
215284
215284
|
parseContentType,
|
|
@@ -215540,7 +215540,7 @@ var require_multipart = __commonJS((exports, module) => {
|
|
|
215540
215540
|
else if (disp.params.filename)
|
|
215541
215541
|
filename = disp.params.filename;
|
|
215542
215542
|
if (filename !== undefined && !preservePath)
|
|
215543
|
-
filename =
|
|
215543
|
+
filename = basename8(filename);
|
|
215544
215544
|
}
|
|
215545
215545
|
if (header2["content-type"]) {
|
|
215546
215546
|
const conType = parseContentType(header2["content-type"][0]);
|
|
@@ -237657,6 +237657,21 @@ class ApiError extends SystemError {
|
|
|
237657
237657
|
}
|
|
237658
237658
|
}
|
|
237659
237659
|
|
|
237660
|
+
class ResourceDeployError extends SystemError {
|
|
237661
|
+
code = "RESOURCE_DEPLOY_FAILED";
|
|
237662
|
+
failures;
|
|
237663
|
+
constructor(resource, failures) {
|
|
237664
|
+
const label = failures.length === 1 ? resource : `${resource}s`;
|
|
237665
|
+
const hints = failures.flatMap((failure) => failure.cause instanceof CLIError ? failure.cause.hints : []);
|
|
237666
|
+
super(`Failed to deploy ${failures.length} ${label}`, {
|
|
237667
|
+
details: failures.map((failure) => `${failure.name}: ${failure.message}`),
|
|
237668
|
+
hints: hints.filter((hint, index, all) => all.findIndex((candidate) => candidate.message === hint.message && candidate.command === hint.command) === index),
|
|
237669
|
+
cause: failures.find((failure) => failure.cause)?.cause
|
|
237670
|
+
});
|
|
237671
|
+
this.failures = failures;
|
|
237672
|
+
}
|
|
237673
|
+
}
|
|
237674
|
+
|
|
237660
237675
|
class FileNotFoundError extends SystemError {
|
|
237661
237676
|
code = "FILE_NOT_FOUND";
|
|
237662
237677
|
constructor(message, options) {
|
|
@@ -237840,7 +237855,7 @@ function normalizeBase44Env() {
|
|
|
237840
237855
|
loadProjectEnvFiles();
|
|
237841
237856
|
|
|
237842
237857
|
// src/cli/index.ts
|
|
237843
|
-
import { dirname as
|
|
237858
|
+
import { dirname as dirname27, join as join36 } from "node:path";
|
|
237844
237859
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
237845
237860
|
|
|
237846
237861
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -239046,9 +239061,6 @@ var {
|
|
|
239046
239061
|
Option,
|
|
239047
239062
|
Help
|
|
239048
239063
|
} = import__.default;
|
|
239049
|
-
|
|
239050
|
-
// src/cli/commands/agent-skills/pull.ts
|
|
239051
|
-
import { dirname as dirname10, join as join17 } from "node:path";
|
|
239052
239064
|
// ../../node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
239053
239065
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
239054
239066
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
@@ -239862,6 +239874,7 @@ var ProjectConfigSchema = exports_external.object({
|
|
|
239862
239874
|
site: SiteConfigSchema.optional(),
|
|
239863
239875
|
entitiesDir: exports_external.string().optional().default("entities"),
|
|
239864
239876
|
functionsDir: exports_external.string().optional().default("functions"),
|
|
239877
|
+
actorsDir: exports_external.string().optional().default("actors"),
|
|
239865
239878
|
agentsDir: exports_external.string().optional().default("agents"),
|
|
239866
239879
|
agentSkillsDir: exports_external.string().optional().default("agent-skills"),
|
|
239867
239880
|
connectorsDir: exports_external.string().optional().default("connectors"),
|
|
@@ -245801,7 +245814,7 @@ async function getSiteUrl() {
|
|
|
245801
245814
|
return result.data.url;
|
|
245802
245815
|
}
|
|
245803
245816
|
// src/core/project/config.ts
|
|
245804
|
-
import { dirname as
|
|
245817
|
+
import { dirname as dirname10, join as join11 } from "node:path";
|
|
245805
245818
|
|
|
245806
245819
|
// src/core/project/plugins.ts
|
|
245807
245820
|
import { createRequire as createRequire2 } from "node:module";
|
|
@@ -245839,6 +245852,198 @@ function markPluginEntities(entities, pluginNamespace) {
|
|
|
245839
245852
|
}));
|
|
245840
245853
|
}
|
|
245841
245854
|
|
|
245855
|
+
// src/core/resources/types.ts
|
|
245856
|
+
var ResourceSourceSchema = exports_external.discriminatedUnion("type", [
|
|
245857
|
+
exports_external.object({
|
|
245858
|
+
type: exports_external.literal("project")
|
|
245859
|
+
}),
|
|
245860
|
+
exports_external.object({
|
|
245861
|
+
type: exports_external.literal("plugin"),
|
|
245862
|
+
namespace: exports_external.string().min(1, "Plugin namespace cannot be empty")
|
|
245863
|
+
})
|
|
245864
|
+
]);
|
|
245865
|
+
function throwIfDeployFailed(results, resource) {
|
|
245866
|
+
const failures = results.filter((result) => result.status === "error").map((result) => ({
|
|
245867
|
+
name: result.name,
|
|
245868
|
+
message: result.error ?? "Unknown deployment error",
|
|
245869
|
+
cause: result.cause
|
|
245870
|
+
}));
|
|
245871
|
+
if (failures.length > 0) {
|
|
245872
|
+
throw new ResourceDeployError(resource, failures);
|
|
245873
|
+
}
|
|
245874
|
+
}
|
|
245875
|
+
|
|
245876
|
+
// src/core/resources/actor/schema.ts
|
|
245877
|
+
var ActorSchema = exports_external.object({
|
|
245878
|
+
name: exports_external.string().min(1),
|
|
245879
|
+
entry: exports_external.string().min(1),
|
|
245880
|
+
entryPath: exports_external.string().min(1),
|
|
245881
|
+
filePaths: exports_external.array(exports_external.string()).min(1),
|
|
245882
|
+
source: ResourceSourceSchema
|
|
245883
|
+
});
|
|
245884
|
+
var DeployActorResponseSchema = exports_external.object({
|
|
245885
|
+
status: exports_external.enum(["deployed", "unchanged"])
|
|
245886
|
+
});
|
|
245887
|
+
|
|
245888
|
+
// src/core/resources/actor/api.ts
|
|
245889
|
+
async function deploySingleActor(name2, payload) {
|
|
245890
|
+
const appClient = getAppClient();
|
|
245891
|
+
let response;
|
|
245892
|
+
try {
|
|
245893
|
+
response = await appClient.put(`actors/${encodeURIComponent(name2)}`, {
|
|
245894
|
+
json: payload,
|
|
245895
|
+
timeout: false
|
|
245896
|
+
});
|
|
245897
|
+
} catch (error48) {
|
|
245898
|
+
throw await ApiError.fromHttpError(error48, `deploying actor "${name2}"`);
|
|
245899
|
+
}
|
|
245900
|
+
const result = DeployActorResponseSchema.safeParse(await response.json());
|
|
245901
|
+
if (!result.success) {
|
|
245902
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
245903
|
+
}
|
|
245904
|
+
return result.data;
|
|
245905
|
+
}
|
|
245906
|
+
async function deleteSingleActor(name2) {
|
|
245907
|
+
const appClient = getAppClient();
|
|
245908
|
+
try {
|
|
245909
|
+
await appClient.delete(`actors/${encodeURIComponent(name2)}`, {
|
|
245910
|
+
timeout: 60000
|
|
245911
|
+
});
|
|
245912
|
+
} catch (error48) {
|
|
245913
|
+
throw await ApiError.fromHttpError(error48, `deleting actor "${name2}"`);
|
|
245914
|
+
}
|
|
245915
|
+
}
|
|
245916
|
+
// src/core/resources/actor/config.ts
|
|
245917
|
+
import { basename as basename3, dirname as dirname6, relative } from "node:path";
|
|
245918
|
+
var VALID_ACTOR_NAME = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/;
|
|
245919
|
+
var JS_RESERVED_ACTOR_NAMES = new Set(("await break case catch class const continue debugger default delete do else " + "enum export extends false finally for function if import in instanceof let " + "new null return static super switch this throw true try typeof var void " + "while with yield implements interface package private protected public " + "eval arguments").split(" "));
|
|
245920
|
+
function assertValidActorName(name2) {
|
|
245921
|
+
if (name2.includes("/")) {
|
|
245922
|
+
throw new ConfigInvalidError(`Invalid actor name "${name2}" — actors cannot be nested in subfolders`, null, {
|
|
245923
|
+
hints: [
|
|
245924
|
+
{
|
|
245925
|
+
message: `Use a single folder level (e.g. actors/${name2.split("/").pop()}/entry.ts)`
|
|
245926
|
+
},
|
|
245927
|
+
{
|
|
245928
|
+
message: "A nested name can also mean a helper file was named entry.ts — every entry file under the actors directory is treated as an actor, so rename the helper"
|
|
245929
|
+
}
|
|
245930
|
+
]
|
|
245931
|
+
});
|
|
245932
|
+
}
|
|
245933
|
+
if (!VALID_ACTOR_NAME.test(name2)) {
|
|
245934
|
+
throw new ConfigInvalidError(`Invalid actor name "${name2}" — actor names become a JavaScript class binding, so they must match [A-Za-z_][A-Za-z0-9_]* (max 128 characters, no "-", "." or ":")`, null, {
|
|
245935
|
+
hints: [
|
|
245936
|
+
{ message: "Rename the folder in PascalCase (e.g. actors/ChatRoom)" }
|
|
245937
|
+
]
|
|
245938
|
+
});
|
|
245939
|
+
}
|
|
245940
|
+
if (JS_RESERVED_ACTOR_NAMES.has(name2)) {
|
|
245941
|
+
throw new ConfigInvalidError(`Invalid actor name "${name2}" — it is a reserved word in JavaScript, and actor names become a class binding`, null, {
|
|
245942
|
+
hints: [
|
|
245943
|
+
{ message: "Rename the folder in PascalCase (e.g. actors/ChatRoom)" }
|
|
245944
|
+
]
|
|
245945
|
+
});
|
|
245946
|
+
}
|
|
245947
|
+
}
|
|
245948
|
+
async function readActor(entryFile, actorsDir) {
|
|
245949
|
+
const actorDir = dirname6(entryFile);
|
|
245950
|
+
const name2 = relative(actorsDir, actorDir).split(/[/\\]/).join("/");
|
|
245951
|
+
if (!name2) {
|
|
245952
|
+
const entryName = basename3(entryFile);
|
|
245953
|
+
throw new InvalidInputError(`${entryName} found directly in the actors directory — it must be inside a named subfolder`, {
|
|
245954
|
+
hints: [
|
|
245955
|
+
{
|
|
245956
|
+
message: `Move ${entryFile} into a subfolder (e.g. actors/MyActor/entry.ts)`
|
|
245957
|
+
}
|
|
245958
|
+
]
|
|
245959
|
+
});
|
|
245960
|
+
}
|
|
245961
|
+
assertValidActorName(name2);
|
|
245962
|
+
const filePaths = await globby(BACKEND_FILE_GLOB, {
|
|
245963
|
+
cwd: actorDir,
|
|
245964
|
+
absolute: true
|
|
245965
|
+
});
|
|
245966
|
+
return {
|
|
245967
|
+
name: name2,
|
|
245968
|
+
entry: basename3(entryFile),
|
|
245969
|
+
entryPath: entryFile,
|
|
245970
|
+
filePaths,
|
|
245971
|
+
source: { type: "project" }
|
|
245972
|
+
};
|
|
245973
|
+
}
|
|
245974
|
+
async function readAllActors(actorsDir) {
|
|
245975
|
+
if (!await pathExists(actorsDir)) {
|
|
245976
|
+
return [];
|
|
245977
|
+
}
|
|
245978
|
+
const entryFiles = await globby(ENTRY_FILE_GLOB, {
|
|
245979
|
+
cwd: actorsDir,
|
|
245980
|
+
absolute: true,
|
|
245981
|
+
ignore: ENTRY_IGNORE_DOT_PATHS
|
|
245982
|
+
});
|
|
245983
|
+
const actors = await Promise.all(entryFiles.map((entryFile) => readActor(entryFile, actorsDir)));
|
|
245984
|
+
const names = new Set;
|
|
245985
|
+
for (const actor of actors) {
|
|
245986
|
+
if (names.has(actor.name)) {
|
|
245987
|
+
throw new ConfigInvalidError(`Duplicate actor name "${actor.name}" in ${actorsDir}`);
|
|
245988
|
+
}
|
|
245989
|
+
names.add(actor.name);
|
|
245990
|
+
}
|
|
245991
|
+
return actors;
|
|
245992
|
+
}
|
|
245993
|
+
// src/core/resources/actor/deploy.ts
|
|
245994
|
+
import { dirname as dirname7, relative as relative2 } from "node:path";
|
|
245995
|
+
async function loadActorCode(actor) {
|
|
245996
|
+
const actorDir = dirname7(actor.entryPath);
|
|
245997
|
+
const resolvedFiles = await Promise.all(actor.filePaths.map(async (filePath) => {
|
|
245998
|
+
const content = await readTextFile(filePath);
|
|
245999
|
+
const path11 = relative2(actorDir, filePath).split(/[/\\]/).join("/");
|
|
246000
|
+
return { path: path11, content };
|
|
246001
|
+
}));
|
|
246002
|
+
return { name: actor.name, entry: actor.entry, files: resolvedFiles };
|
|
246003
|
+
}
|
|
246004
|
+
async function deployOne(actor) {
|
|
246005
|
+
const start = Date.now();
|
|
246006
|
+
try {
|
|
246007
|
+
const loaded = await loadActorCode(actor);
|
|
246008
|
+
const response = await deploySingleActor(loaded.name, {
|
|
246009
|
+
entry: loaded.entry,
|
|
246010
|
+
files: loaded.files
|
|
246011
|
+
});
|
|
246012
|
+
return {
|
|
246013
|
+
name: loaded.name,
|
|
246014
|
+
status: response.status,
|
|
246015
|
+
durationMs: Date.now() - start
|
|
246016
|
+
};
|
|
246017
|
+
} catch (error48) {
|
|
246018
|
+
return {
|
|
246019
|
+
name: actor.name,
|
|
246020
|
+
status: "error",
|
|
246021
|
+
error: error48 instanceof Error ? error48.message : String(error48),
|
|
246022
|
+
cause: error48 instanceof Error ? error48 : undefined
|
|
246023
|
+
};
|
|
246024
|
+
}
|
|
246025
|
+
}
|
|
246026
|
+
async function deployActorsSequentially(actors, options) {
|
|
246027
|
+
if (actors.length === 0)
|
|
246028
|
+
return [];
|
|
246029
|
+
const results = [];
|
|
246030
|
+
for (const actor of actors) {
|
|
246031
|
+
options?.onStart?.([actor.name]);
|
|
246032
|
+
const result = await deployOne(actor);
|
|
246033
|
+
results.push(result);
|
|
246034
|
+
options?.onResult?.(result);
|
|
246035
|
+
}
|
|
246036
|
+
return results;
|
|
246037
|
+
}
|
|
246038
|
+
// src/core/resources/actor/resource.ts
|
|
246039
|
+
var actorResource = {
|
|
246040
|
+
readAll: readAllActors,
|
|
246041
|
+
push: async (actors) => {
|
|
246042
|
+
const results = await deployActorsSequentially(actors);
|
|
246043
|
+
throwIfDeployFailed(results, "actor");
|
|
246044
|
+
return results;
|
|
246045
|
+
}
|
|
246046
|
+
};
|
|
245842
246047
|
// src/core/resources/agent/schema.ts
|
|
245843
246048
|
var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
|
|
245844
246049
|
var EntityToolConfigSchema = exports_external.object({
|
|
@@ -246231,8 +246436,8 @@ var AppAuthConfigResponseSchema = exports_external.object({
|
|
|
246231
246436
|
}).transform((data) => ({
|
|
246232
246437
|
authConfig: data.auth_config
|
|
246233
246438
|
}));
|
|
246234
|
-
function hasAnyLoginMethod(
|
|
246235
|
-
return
|
|
246439
|
+
function hasAnyLoginMethod(config6) {
|
|
246440
|
+
return config6.enableUsernamePassword || config6.enableGoogleLogin || config6.enableMicrosoftLogin || config6.enableFacebookLogin || config6.enableAppleLogin || config6.enableSSOLogin;
|
|
246236
246441
|
}
|
|
246237
246442
|
var SOCIAL_PROVIDERS = {
|
|
246238
246443
|
google: {
|
|
@@ -246247,18 +246452,18 @@ var SOCIAL_PROVIDERS = {
|
|
|
246247
246452
|
facebook: { field: "enableFacebookLogin" },
|
|
246248
246453
|
apple: { field: "enableAppleLogin" }
|
|
246249
246454
|
};
|
|
246250
|
-
function toAuthConfigPayload(
|
|
246455
|
+
function toAuthConfigPayload(config6) {
|
|
246251
246456
|
return {
|
|
246252
|
-
enable_username_password:
|
|
246253
|
-
enable_google_login:
|
|
246254
|
-
enable_microsoft_login:
|
|
246255
|
-
enable_facebook_login:
|
|
246256
|
-
enable_apple_login:
|
|
246257
|
-
sso_provider_name:
|
|
246258
|
-
enable_sso_login:
|
|
246259
|
-
google_oauth_mode:
|
|
246260
|
-
google_oauth_client_id:
|
|
246261
|
-
use_workspace_sso:
|
|
246457
|
+
enable_username_password: config6.enableUsernamePassword,
|
|
246458
|
+
enable_google_login: config6.enableGoogleLogin,
|
|
246459
|
+
enable_microsoft_login: config6.enableMicrosoftLogin,
|
|
246460
|
+
enable_facebook_login: config6.enableFacebookLogin,
|
|
246461
|
+
enable_apple_login: config6.enableAppleLogin,
|
|
246462
|
+
sso_provider_name: config6.ssoProviderName,
|
|
246463
|
+
enable_sso_login: config6.enableSSOLogin,
|
|
246464
|
+
google_oauth_mode: config6.googleOAuthMode,
|
|
246465
|
+
google_oauth_client_id: config6.googleOAuthClientId,
|
|
246466
|
+
use_workspace_sso: config6.useWorkspaceSSO
|
|
246262
246467
|
};
|
|
246263
246468
|
}
|
|
246264
246469
|
|
|
@@ -246277,9 +246482,9 @@ async function getAuthConfig() {
|
|
|
246277
246482
|
}
|
|
246278
246483
|
return result.data.authConfig;
|
|
246279
246484
|
}
|
|
246280
|
-
async function pushAuthConfigToApi(
|
|
246485
|
+
async function pushAuthConfigToApi(config6) {
|
|
246281
246486
|
const { id } = getAppContext();
|
|
246282
|
-
const payload = toAuthConfigPayload(
|
|
246487
|
+
const payload = toAuthConfigPayload(config6);
|
|
246283
246488
|
if (hasWorkspaceApiKeyAuth()) {
|
|
246284
246489
|
try {
|
|
246285
246490
|
await base44Client.put(`api/apps/${id}/deployment/auth-configuration`, {
|
|
@@ -246288,7 +246493,7 @@ async function pushAuthConfigToApi(config5) {
|
|
|
246288
246493
|
} catch (error48) {
|
|
246289
246494
|
throw await ApiError.fromHttpError(error48, "updating auth config");
|
|
246290
246495
|
}
|
|
246291
|
-
return
|
|
246496
|
+
return config6;
|
|
246292
246497
|
}
|
|
246293
246498
|
let response;
|
|
246294
246499
|
try {
|
|
@@ -246335,16 +246540,16 @@ async function readAuthConfig(authDir) {
|
|
|
246335
246540
|
}
|
|
246336
246541
|
return result.data;
|
|
246337
246542
|
}
|
|
246338
|
-
async function writeAuthConfig(authDir,
|
|
246543
|
+
async function writeAuthConfig(authDir, config6) {
|
|
246339
246544
|
const filePath = getAuthConfigPath(authDir);
|
|
246340
246545
|
if (await pathExists(filePath)) {
|
|
246341
246546
|
const existing = await readJsonFile(filePath);
|
|
246342
246547
|
const existingResult = AuthConfigFileSchema.safeParse(existing);
|
|
246343
|
-
if (existingResult.success && isDeepStrictEqual2(existingResult.data,
|
|
246548
|
+
if (existingResult.success && isDeepStrictEqual2(existingResult.data, config6)) {
|
|
246344
246549
|
return { written: false };
|
|
246345
246550
|
}
|
|
246346
246551
|
}
|
|
246347
|
-
await writeJsonFile(filePath,
|
|
246552
|
+
await writeJsonFile(filePath, config6);
|
|
246348
246553
|
return { written: true };
|
|
246349
246554
|
}
|
|
246350
246555
|
// src/core/resources/auth-config/pull.ts
|
|
@@ -246352,17 +246557,17 @@ async function pullAuthConfig() {
|
|
|
246352
246557
|
return await getAuthConfig();
|
|
246353
246558
|
}
|
|
246354
246559
|
// src/core/resources/auth-config/push.ts
|
|
246355
|
-
async function pushAuthConfig(
|
|
246356
|
-
if (!
|
|
246560
|
+
async function pushAuthConfig(config6) {
|
|
246561
|
+
if (!config6) {
|
|
246357
246562
|
return;
|
|
246358
246563
|
}
|
|
246359
|
-
await pushAuthConfigToApi(
|
|
246564
|
+
await pushAuthConfigToApi(config6);
|
|
246360
246565
|
}
|
|
246361
246566
|
// src/core/resources/auth-config/resource.ts
|
|
246362
246567
|
var authConfigResource = {
|
|
246363
246568
|
readAll: async (dir) => {
|
|
246364
|
-
const
|
|
246365
|
-
return
|
|
246569
|
+
const config6 = await readAuthConfig(dir);
|
|
246570
|
+
return config6 ? [config6] : [];
|
|
246366
246571
|
},
|
|
246367
246572
|
push: async (items) => {
|
|
246368
246573
|
await pushAuthConfig(items[0] ?? null);
|
|
@@ -246602,7 +246807,7 @@ class MissingSSOFieldsError extends InvalidInputError {
|
|
|
246602
246807
|
}
|
|
246603
246808
|
}
|
|
246604
246809
|
function buildSSOSecrets(provider, options) {
|
|
246605
|
-
const
|
|
246810
|
+
const schema5 = SSO_PROVIDER_SCHEMAS[provider];
|
|
246606
246811
|
const secrets = {};
|
|
246607
246812
|
secrets["sso_name" /* Name */] = options.ssoName ?? provider;
|
|
246608
246813
|
secrets["sso_client_id" /* ClientId */] = options.clientId;
|
|
@@ -246613,21 +246818,21 @@ function buildSSOSecrets(provider, options) {
|
|
|
246613
246818
|
secrets[secretKey] = value;
|
|
246614
246819
|
}
|
|
246615
246820
|
}
|
|
246616
|
-
if (
|
|
246617
|
-
const derived =
|
|
246821
|
+
if (schema5.deriveDefaults) {
|
|
246822
|
+
const derived = schema5.deriveDefaults(secrets);
|
|
246618
246823
|
for (const [key, val] of Object.entries(derived)) {
|
|
246619
246824
|
if (!secrets[key]) {
|
|
246620
246825
|
secrets[key] = val;
|
|
246621
246826
|
}
|
|
246622
246827
|
}
|
|
246623
246828
|
}
|
|
246624
|
-
for (const [key, val] of Object.entries(
|
|
246829
|
+
for (const [key, val] of Object.entries(schema5.defaults)) {
|
|
246625
246830
|
if (!secrets[key]) {
|
|
246626
246831
|
secrets[key] = val;
|
|
246627
246832
|
}
|
|
246628
246833
|
}
|
|
246629
246834
|
const missing = [];
|
|
246630
|
-
for (const key of
|
|
246835
|
+
for (const key of schema5.requiredKeys) {
|
|
246631
246836
|
if (!secrets[key]) {
|
|
246632
246837
|
missing.push(key);
|
|
246633
246838
|
}
|
|
@@ -247189,36 +247394,34 @@ var connectorResource = {
|
|
|
247189
247394
|
readAll: readAllConnectors,
|
|
247190
247395
|
push: pushConnectors
|
|
247191
247396
|
};
|
|
247192
|
-
// src/core/resources/types.ts
|
|
247193
|
-
var ResourceSourceSchema = exports_external.discriminatedUnion("type", [
|
|
247194
|
-
exports_external.object({
|
|
247195
|
-
type: exports_external.literal("project")
|
|
247196
|
-
}),
|
|
247197
|
-
exports_external.object({
|
|
247198
|
-
type: exports_external.literal("plugin"),
|
|
247199
|
-
namespace: exports_external.string().min(1, "Plugin namespace cannot be empty")
|
|
247200
|
-
})
|
|
247201
|
-
]);
|
|
247202
|
-
|
|
247203
247397
|
// src/core/resources/entity/schema.ts
|
|
247204
|
-
var
|
|
247205
|
-
|
|
247206
|
-
|
|
247207
|
-
|
|
247208
|
-
|
|
247209
|
-
|
|
247210
|
-
|
|
247211
|
-
|
|
247212
|
-
|
|
247213
|
-
|
|
247214
|
-
|
|
247398
|
+
var fieldConditionOperators = new Set([
|
|
247399
|
+
"$eq",
|
|
247400
|
+
"$ne",
|
|
247401
|
+
"$in",
|
|
247402
|
+
"$nin",
|
|
247403
|
+
"$gt",
|
|
247404
|
+
"$gte",
|
|
247405
|
+
"$lt",
|
|
247406
|
+
"$lte",
|
|
247407
|
+
"$exists",
|
|
247408
|
+
"$all",
|
|
247409
|
+
"$size",
|
|
247410
|
+
"$elemMatch"
|
|
247215
247411
|
]);
|
|
247216
|
-
var
|
|
247217
|
-
var
|
|
247218
|
-
|
|
247219
|
-
|
|
247220
|
-
|
|
247221
|
-
|
|
247412
|
+
var isScalar = (value) => value === null || ["string", "number", "boolean"].includes(typeof value);
|
|
247413
|
+
var isValidFieldCondition = (value) => {
|
|
247414
|
+
if (isScalar(value)) {
|
|
247415
|
+
return true;
|
|
247416
|
+
}
|
|
247417
|
+
if (typeof value === "object" && !Array.isArray(value)) {
|
|
247418
|
+
return Object.keys(value).every((k2) => fieldConditionOperators.has(k2));
|
|
247419
|
+
}
|
|
247420
|
+
return false;
|
|
247421
|
+
};
|
|
247422
|
+
var supportedOperators = [...fieldConditionOperators].sort().join(", ");
|
|
247423
|
+
var FieldConditionSchema = exports_external.union([exports_external.string(), exports_external.number(), exports_external.boolean(), exports_external.null(), exports_external.looseObject({})]).refine(isValidFieldCondition, `Field condition values must be a primitive or an operator object (${supportedOperators})`);
|
|
247424
|
+
var UserConditionSchema = exports_external.looseObject({}).refine((val) => Object.keys(val).length > 0 && Object.entries(val).every(([key, value]) => !key.startsWith("$") && isScalar(value)), "user_condition compares user attributes by exact equality: a non-empty object of attribute: scalar pairs, no operators");
|
|
247222
247425
|
var rlsConditionAllowedKeys = new Set([
|
|
247223
247426
|
"user_condition",
|
|
247224
247427
|
"created_by",
|
|
@@ -247250,18 +247453,13 @@ var RLSConditionSchema = exports_external.looseObject({
|
|
|
247250
247453
|
return exports_external.array(RefineRLSConditionSchema).optional();
|
|
247251
247454
|
}
|
|
247252
247455
|
});
|
|
247253
|
-
var
|
|
247254
|
-
var
|
|
247255
|
-
|
|
247256
|
-
|
|
247257
|
-
|
|
247258
|
-
|
|
247259
|
-
|
|
247260
|
-
}
|
|
247261
|
-
return false;
|
|
247262
|
-
};
|
|
247263
|
-
var RefineRLSConditionSchema = RLSConditionSchema.refine((val) => Object.entries(val).every(([key, value]) => rlsConditionAllowedKeys.has(key) || isValidFieldCondition(value)), "Field condition values must be a primitive or an operator object ($in, $nin, $ne, $all)");
|
|
247264
|
-
var RLSRuleSchema = exports_external.union([exports_external.boolean(), RefineRLSConditionSchema]);
|
|
247456
|
+
var RefineRLSConditionSchema = RLSConditionSchema.refine((val) => Object.entries(val).every(([key, value]) => rlsConditionAllowedKeys.has(key) || isValidFieldCondition(value)), `Field condition values must be a primitive or an operator object (${supportedOperators})`);
|
|
247457
|
+
var RLSRuleSchema = exports_external.union([
|
|
247458
|
+
exports_external.boolean(),
|
|
247459
|
+
exports_external.null(),
|
|
247460
|
+
exports_external.literal(""),
|
|
247461
|
+
RefineRLSConditionSchema
|
|
247462
|
+
]);
|
|
247265
247463
|
var EntityRLSSchema = exports_external.looseObject({
|
|
247266
247464
|
create: RLSRuleSchema.optional(),
|
|
247267
247465
|
read: RLSRuleSchema.optional(),
|
|
@@ -247277,7 +247475,7 @@ var FieldRLSSchema = exports_external.looseObject({
|
|
|
247277
247475
|
delete: RLSRuleSchema.optional()
|
|
247278
247476
|
});
|
|
247279
247477
|
var PropertyDefinitionSchema = exports_external.looseObject({
|
|
247280
|
-
type: exports_external.string(),
|
|
247478
|
+
type: exports_external.union([exports_external.string(), exports_external.array(exports_external.string())]),
|
|
247281
247479
|
title: exports_external.string().optional(),
|
|
247282
247480
|
description: exports_external.string().optional(),
|
|
247283
247481
|
minLength: exports_external.number().int().min(0).optional(),
|
|
@@ -247301,7 +247499,7 @@ var PropertyDefinitionSchema = exports_external.looseObject({
|
|
|
247301
247499
|
});
|
|
247302
247500
|
var EntitySchema = exports_external.looseObject({
|
|
247303
247501
|
type: exports_external.literal("object").default("object"),
|
|
247304
|
-
name: exports_external.string().min(1).regex(
|
|
247502
|
+
name: exports_external.string().min(1).regex(/^\w+$/, "Entity name must contain only letters, numbers, and underscores"),
|
|
247305
247503
|
title: exports_external.string().optional(),
|
|
247306
247504
|
description: exports_external.string().optional(),
|
|
247307
247505
|
properties: exports_external.record(exports_external.string(), PropertyDefinitionSchema).default({}),
|
|
@@ -247636,7 +247834,7 @@ async function fetchFunctionLogs(functionName, filters = {}) {
|
|
|
247636
247834
|
return result.data;
|
|
247637
247835
|
}
|
|
247638
247836
|
// src/core/resources/function/config.ts
|
|
247639
|
-
import { basename as
|
|
247837
|
+
import { basename as basename4, dirname as dirname8, join as join9, relative as relative3, resolve as resolve2 } from "node:path";
|
|
247640
247838
|
async function readSharedFiles(functionsDir) {
|
|
247641
247839
|
const sharedDir = resolve2(functionsDir, "..", "shared");
|
|
247642
247840
|
if (!await pathExists(sharedDir)) {
|
|
@@ -247653,9 +247851,9 @@ async function readFunctionConfig(configPath) {
|
|
|
247653
247851
|
return result.data;
|
|
247654
247852
|
}
|
|
247655
247853
|
async function readFunction(configPath, sharedFiles) {
|
|
247656
|
-
const
|
|
247657
|
-
const functionDir =
|
|
247658
|
-
const entryPath = join9(functionDir,
|
|
247854
|
+
const config9 = await readFunctionConfig(configPath);
|
|
247855
|
+
const functionDir = dirname8(configPath);
|
|
247856
|
+
const entryPath = join9(functionDir, config9.entry);
|
|
247659
247857
|
if (!await pathExists(entryPath)) {
|
|
247660
247858
|
throw new InvalidInputError(`Function entry file not found: ${entryPath} (referenced in ${configPath})`, {
|
|
247661
247859
|
hints: [{ message: "Check the 'entry' field in your function config" }]
|
|
@@ -247667,7 +247865,7 @@ async function readFunction(configPath, sharedFiles) {
|
|
|
247667
247865
|
});
|
|
247668
247866
|
const allFilePaths = [...new Set([...filePaths, ...sharedFiles])];
|
|
247669
247867
|
const functionData = {
|
|
247670
|
-
...
|
|
247868
|
+
...config9,
|
|
247671
247869
|
entryPath,
|
|
247672
247870
|
filePaths: allFilePaths,
|
|
247673
247871
|
source: { type: "project" }
|
|
@@ -247687,18 +247885,18 @@ async function readAllFunctions(functionsDir) {
|
|
|
247687
247885
|
absolute: true,
|
|
247688
247886
|
ignore: ENTRY_IGNORE_DOT_PATHS
|
|
247689
247887
|
});
|
|
247690
|
-
const configFilesDirs = new Set(configFiles.map((f) =>
|
|
247691
|
-
const entryFilesWithoutConfig = entryFiles.filter((entryFile) => !configFilesDirs.has(
|
|
247888
|
+
const configFilesDirs = new Set(configFiles.map((f) => dirname8(f)));
|
|
247889
|
+
const entryFilesWithoutConfig = entryFiles.filter((entryFile) => !configFilesDirs.has(dirname8(entryFile)));
|
|
247692
247890
|
const sharedFiles = await readSharedFiles(functionsDir);
|
|
247693
247891
|
const functionsFromConfig = await Promise.all(configFiles.map((configPath) => readFunction(configPath, sharedFiles)));
|
|
247694
247892
|
const functionsWithoutConfig = await Promise.all(entryFilesWithoutConfig.map(async (entryFile) => {
|
|
247695
|
-
const functionDir =
|
|
247893
|
+
const functionDir = dirname8(entryFile);
|
|
247696
247894
|
const filePaths = await globby(BACKEND_FILE_GLOB, {
|
|
247697
247895
|
cwd: functionDir,
|
|
247698
247896
|
absolute: true
|
|
247699
247897
|
});
|
|
247700
247898
|
const allFilePaths = [...new Set([...filePaths, ...sharedFiles])];
|
|
247701
|
-
const name2 =
|
|
247899
|
+
const name2 = relative3(functionsDir, functionDir).split(/[/\\]/).join("/");
|
|
247702
247900
|
if (!name2) {
|
|
247703
247901
|
throw new InvalidInputError("entry.ts found directly in the functions directory — it must be inside a named subfolder", {
|
|
247704
247902
|
hints: [
|
|
@@ -247708,7 +247906,7 @@ async function readAllFunctions(functionsDir) {
|
|
|
247708
247906
|
]
|
|
247709
247907
|
});
|
|
247710
247908
|
}
|
|
247711
|
-
const entry =
|
|
247909
|
+
const entry = basename4(entryFile);
|
|
247712
247910
|
const functionData = {
|
|
247713
247911
|
name: name2,
|
|
247714
247912
|
entry,
|
|
@@ -247735,17 +247933,17 @@ async function readAllFunctions(functionsDir) {
|
|
|
247735
247933
|
return functions;
|
|
247736
247934
|
}
|
|
247737
247935
|
// src/core/resources/function/deploy.ts
|
|
247738
|
-
import { dirname as
|
|
247936
|
+
import { dirname as dirname9, relative as relative4 } from "node:path";
|
|
247739
247937
|
async function loadFunctionCode(fn) {
|
|
247740
|
-
const functionDir =
|
|
247938
|
+
const functionDir = dirname9(fn.entryPath);
|
|
247741
247939
|
const resolvedFiles = await Promise.all(fn.filePaths.map(async (filePath) => {
|
|
247742
247940
|
const content = await readTextFile(filePath);
|
|
247743
|
-
const path11 =
|
|
247941
|
+
const path11 = relative4(functionDir, filePath).split(/[/\\]/).join("/");
|
|
247744
247942
|
return { path: path11, content };
|
|
247745
247943
|
}));
|
|
247746
247944
|
return { ...fn, files: resolvedFiles };
|
|
247747
247945
|
}
|
|
247748
|
-
async function
|
|
247946
|
+
async function deployOne2(fn) {
|
|
247749
247947
|
const start = Date.now();
|
|
247750
247948
|
try {
|
|
247751
247949
|
const functionWithCode = await loadFunctionCode(fn);
|
|
@@ -247763,7 +247961,8 @@ async function deployOne(fn) {
|
|
|
247763
247961
|
return {
|
|
247764
247962
|
name: fn.name,
|
|
247765
247963
|
status: "error",
|
|
247766
|
-
error: error48 instanceof Error ? error48.message : String(error48)
|
|
247964
|
+
error: error48 instanceof Error ? error48.message : String(error48),
|
|
247965
|
+
cause: error48 instanceof Error ? error48 : undefined
|
|
247767
247966
|
};
|
|
247768
247967
|
}
|
|
247769
247968
|
}
|
|
@@ -247773,7 +247972,7 @@ async function deployFunctionsSequentially(functions, options) {
|
|
|
247773
247972
|
const results = [];
|
|
247774
247973
|
for (const fn of functions) {
|
|
247775
247974
|
options?.onStart?.([fn.name]);
|
|
247776
|
-
const result = await
|
|
247975
|
+
const result = await deployOne2(fn);
|
|
247777
247976
|
results.push(result);
|
|
247778
247977
|
options?.onResult?.(result);
|
|
247779
247978
|
}
|
|
@@ -247816,14 +248015,14 @@ async function writeFunctions(functionsDir, functions) {
|
|
|
247816
248015
|
skipped.push(fn.name);
|
|
247817
248016
|
continue;
|
|
247818
248017
|
}
|
|
247819
|
-
const
|
|
248018
|
+
const config9 = {
|
|
247820
248019
|
name: fn.name,
|
|
247821
248020
|
entry: fn.entry
|
|
247822
248021
|
};
|
|
247823
248022
|
if (fn.automations.length > 0) {
|
|
247824
|
-
|
|
248023
|
+
config9.automations = fn.automations;
|
|
247825
248024
|
}
|
|
247826
|
-
await writeJsonFile(configPath,
|
|
248025
|
+
await writeJsonFile(configPath, config9);
|
|
247827
248026
|
for (const file2 of fn.files) {
|
|
247828
248027
|
await writeFile(join10(functionDir, file2.path), file2.content);
|
|
247829
248028
|
}
|
|
@@ -247866,15 +248065,24 @@ async function isFunctionUnchanged(functionDir, fn) {
|
|
|
247866
248065
|
// src/core/resources/function/resource.ts
|
|
247867
248066
|
var functionResource = {
|
|
247868
248067
|
readAll: readAllFunctions,
|
|
247869
|
-
push: (functions) =>
|
|
248068
|
+
push: async (functions) => {
|
|
248069
|
+
const results = await deployFunctionsSequentially(functions);
|
|
248070
|
+
throwIfDeployFailed(results, "function");
|
|
248071
|
+
return results;
|
|
248072
|
+
}
|
|
247870
248073
|
};
|
|
247871
248074
|
// src/core/project/config.ts
|
|
247872
248075
|
class ProjectConfigReader {
|
|
247873
248076
|
pluginSourceByNamespace = new Map;
|
|
247874
|
-
async
|
|
248077
|
+
async readProjectSettings(projectRoot) {
|
|
247875
248078
|
const { root, configPath } = await this.findConfigOrThrow(projectRoot);
|
|
247876
248079
|
const project = await this.readConfigFile(configPath);
|
|
247877
248080
|
this.assertPluginProjectDoesNotLoadPlugins(project, configPath);
|
|
248081
|
+
return { ...project, root, configPath };
|
|
248082
|
+
}
|
|
248083
|
+
async readProjectConfig(projectRoot) {
|
|
248084
|
+
const project = await this.readProjectSettings(projectRoot);
|
|
248085
|
+
const { configPath } = project;
|
|
247878
248086
|
const localResources = await this.readProjectResources(configPath, project);
|
|
247879
248087
|
const pluginResources = await this.readPlugins(project.plugins, configPath);
|
|
247880
248088
|
const entities = mergeProjectAndPluginEntities(localResources.entities, pluginResources.entities, configPath);
|
|
@@ -247883,10 +248091,12 @@ class ProjectConfigReader {
|
|
|
247883
248091
|
...pluginResources.functions
|
|
247884
248092
|
];
|
|
247885
248093
|
this.validateFunctionNames(functions, configPath);
|
|
248094
|
+
this.validateActorNames(localResources.actors, functions, configPath);
|
|
247886
248095
|
return {
|
|
247887
|
-
project
|
|
248096
|
+
project,
|
|
247888
248097
|
entities,
|
|
247889
248098
|
functions,
|
|
248099
|
+
actors: localResources.actors,
|
|
247890
248100
|
agents: localResources.agents,
|
|
247891
248101
|
agentSkills: localResources.agentSkills,
|
|
247892
248102
|
connectors: localResources.connectors,
|
|
@@ -247915,16 +248125,33 @@ class ProjectConfigReader {
|
|
|
247915
248125
|
return result.data;
|
|
247916
248126
|
}
|
|
247917
248127
|
async readProjectResources(configPath, project) {
|
|
247918
|
-
const configDir =
|
|
247919
|
-
const [
|
|
248128
|
+
const configDir = dirname10(configPath);
|
|
248129
|
+
const [
|
|
248130
|
+
entities,
|
|
248131
|
+
functions,
|
|
248132
|
+
actors,
|
|
248133
|
+
agents,
|
|
248134
|
+
agentSkills,
|
|
248135
|
+
connectors,
|
|
248136
|
+
authConfig
|
|
248137
|
+
] = await Promise.all([
|
|
247920
248138
|
entityResource.readAll(join11(configDir, project.entitiesDir)),
|
|
247921
248139
|
functionResource.readAll(join11(configDir, project.functionsDir)),
|
|
248140
|
+
actorResource.readAll(join11(configDir, project.actorsDir)),
|
|
247922
248141
|
agentResource.readAll(join11(configDir, project.agentsDir)),
|
|
247923
248142
|
agentSkillResource.readAll(join11(configDir, project.agentSkillsDir)),
|
|
247924
248143
|
connectorResource.readAll(join11(configDir, project.connectorsDir)),
|
|
247925
248144
|
authConfigResource.readAll(join11(configDir, project.authDir))
|
|
247926
248145
|
]);
|
|
247927
|
-
return {
|
|
248146
|
+
return {
|
|
248147
|
+
entities,
|
|
248148
|
+
functions,
|
|
248149
|
+
actors,
|
|
248150
|
+
agents,
|
|
248151
|
+
agentSkills,
|
|
248152
|
+
connectors,
|
|
248153
|
+
authConfig
|
|
248154
|
+
};
|
|
247928
248155
|
}
|
|
247929
248156
|
assertPluginProjectDoesNotLoadPlugins(project, configPath) {
|
|
247930
248157
|
if (project.plugin && project.plugins.length > 0) {
|
|
@@ -247945,7 +248172,7 @@ class ProjectConfigReader {
|
|
|
247945
248172
|
this.pluginSourceByNamespace.set(namespace, source);
|
|
247946
248173
|
}
|
|
247947
248174
|
async readPluginConfig(plugin, hostConfigPath) {
|
|
247948
|
-
const pluginRoot = resolvePluginRoot(plugin.source,
|
|
248175
|
+
const pluginRoot = resolvePluginRoot(plugin.source, dirname10(hostConfigPath));
|
|
247949
248176
|
const { configPath } = await this.findConfigOrThrow(pluginRoot);
|
|
247950
248177
|
const project = await this.readConfigFile(configPath);
|
|
247951
248178
|
const namespace = requirePluginNamespace(project, plugin.source, configPath);
|
|
@@ -247957,6 +248184,7 @@ class ProjectConfigReader {
|
|
|
247957
248184
|
return {
|
|
247958
248185
|
entities: markPluginEntities(resources.entities, namespace),
|
|
247959
248186
|
functions: namespacePluginFunctions(resources.functions, namespace),
|
|
248187
|
+
actors: [],
|
|
247960
248188
|
agents: [],
|
|
247961
248189
|
agentSkills: [],
|
|
247962
248190
|
connectors: [],
|
|
@@ -247995,6 +248223,7 @@ class ProjectConfigReader {
|
|
|
247995
248223
|
return {
|
|
247996
248224
|
entities,
|
|
247997
248225
|
functions,
|
|
248226
|
+
actors: [],
|
|
247998
248227
|
agents: [],
|
|
247999
248228
|
agentSkills: [],
|
|
248000
248229
|
connectors: [],
|
|
@@ -248017,15 +248246,33 @@ class ProjectConfigReader {
|
|
|
248017
248246
|
functionsByName.set(fn.name, fn);
|
|
248018
248247
|
}
|
|
248019
248248
|
}
|
|
248249
|
+
validateActorNames(actors, functions, configPath) {
|
|
248250
|
+
const functionNames = new Set(functions.map((fn) => fn.name));
|
|
248251
|
+
for (const actor of actors) {
|
|
248252
|
+
if (functionNames.has(actor.name)) {
|
|
248253
|
+
throw new ConfigInvalidError(`"${actor.name}" exists as both a backend function and an actor.`, configPath, {
|
|
248254
|
+
hints: [
|
|
248255
|
+
{
|
|
248256
|
+
message: "Actors and functions share one deploy namespace — rename one of them."
|
|
248257
|
+
}
|
|
248258
|
+
]
|
|
248259
|
+
});
|
|
248260
|
+
}
|
|
248261
|
+
}
|
|
248262
|
+
}
|
|
248020
248263
|
}
|
|
248021
248264
|
async function readProjectConfig(projectRoot) {
|
|
248022
248265
|
const reader = new ProjectConfigReader;
|
|
248023
248266
|
return await reader.readProjectConfig(projectRoot);
|
|
248024
248267
|
}
|
|
248268
|
+
async function readProjectSettings(projectRoot) {
|
|
248269
|
+
const reader = new ProjectConfigReader;
|
|
248270
|
+
return await reader.readProjectSettings(projectRoot);
|
|
248271
|
+
}
|
|
248025
248272
|
// src/core/project/template.ts
|
|
248026
248273
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
248027
248274
|
var import_front_matter2 = __toESM(require_front_matter(), 1);
|
|
248028
|
-
import { dirname as
|
|
248275
|
+
import { dirname as dirname11, join as join13 } from "node:path";
|
|
248029
248276
|
|
|
248030
248277
|
// src/core/assets.ts
|
|
248031
248278
|
import { cpSync, existsSync } from "node:fs";
|
|
@@ -248034,7 +248281,7 @@ import { join as join12 } from "node:path";
|
|
|
248034
248281
|
// package.json
|
|
248035
248282
|
var package_default = {
|
|
248036
248283
|
name: "base44",
|
|
248037
|
-
version: "0.1.
|
|
248284
|
+
version: "0.1.9",
|
|
248038
248285
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
248039
248286
|
type: "module",
|
|
248040
248287
|
bin: {
|
|
@@ -248186,7 +248433,7 @@ async function renderTemplate(template, destPath, data, options = {}) {
|
|
|
248186
248433
|
if (file2.endsWith(".ejs")) {
|
|
248187
248434
|
const rendered = await import_ejs.default.renderFile(srcPath, data);
|
|
248188
248435
|
const { attributes, body } = import_front_matter2.default(rendered);
|
|
248189
|
-
const destFile = attributes.outputFileName ? join13(
|
|
248436
|
+
const destFile = attributes.outputFileName ? join13(dirname11(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
|
|
248190
248437
|
const destFilePath = join13(destPath, destFile);
|
|
248191
248438
|
if (skipExisting && await pathExists(destFilePath)) {
|
|
248192
248439
|
skipped.push(destFile);
|
|
@@ -248335,7 +248582,9 @@ async function deploySite(siteOutputDir) {
|
|
|
248335
248582
|
if (!await pathExists(siteOutputDir)) {
|
|
248336
248583
|
throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
|
|
248337
248584
|
hints: [
|
|
248338
|
-
{
|
|
248585
|
+
{
|
|
248586
|
+
message: "Run 'base44 build' first (it injects your app id; a bare 'npm run build' does not)"
|
|
248587
|
+
}
|
|
248339
248588
|
]
|
|
248340
248589
|
});
|
|
248341
248590
|
}
|
|
@@ -248343,7 +248592,9 @@ async function deploySite(siteOutputDir) {
|
|
|
248343
248592
|
if (filePaths.length === 0) {
|
|
248344
248593
|
throw new ConfigInvalidError(`No files found in output directory: ${siteOutputDir}. Make sure to build your project first.`, siteOutputDir, {
|
|
248345
248594
|
hints: [
|
|
248346
|
-
{
|
|
248595
|
+
{
|
|
248596
|
+
message: "Run 'base44 build' first (it injects your app id; a bare 'npm run build' does not)"
|
|
248597
|
+
}
|
|
248347
248598
|
]
|
|
248348
248599
|
});
|
|
248349
248600
|
}
|
|
@@ -248365,7 +248616,7 @@ async function createArchive(pathToArchive, targetArchivePath) {
|
|
|
248365
248616
|
// src/core/site/manifest.ts
|
|
248366
248617
|
import { createHash } from "node:crypto";
|
|
248367
248618
|
import { readFile as readFile2, stat } from "node:fs/promises";
|
|
248368
|
-
import { basename as
|
|
248619
|
+
import { basename as basename5, join as join15 } from "node:path";
|
|
248369
248620
|
var MAX_ASSET_SIZE_BYTES = 25 * 1024 * 1024;
|
|
248370
248621
|
var MAX_ASSET_COUNT = 1e5;
|
|
248371
248622
|
var ASSETS_IGNORE_FILE = ".assetsignore";
|
|
@@ -248387,7 +248638,7 @@ async function buildAssetManifest(assetsDir, appId) {
|
|
|
248387
248638
|
followSymbolicLinks: false,
|
|
248388
248639
|
ignoreFiles: [ASSETS_IGNORE_FILE]
|
|
248389
248640
|
});
|
|
248390
|
-
const relativeFilePaths = found.filter((path11) => !ALWAYS_IGNORED.has(
|
|
248641
|
+
const relativeFilePaths = found.filter((path11) => !ALWAYS_IGNORED.has(basename5(path11)));
|
|
248391
248642
|
if (relativeFilePaths.length > MAX_ASSET_COUNT) {
|
|
248392
248643
|
throw new InvalidInputError(`Too many static assets: found ${relativeFilePaths.length}, the limit is ${MAX_ASSET_COUNT} files.`);
|
|
248393
248644
|
}
|
|
@@ -248604,6 +248855,7 @@ function hasResourcesToDeploy(projectData) {
|
|
|
248604
248855
|
project,
|
|
248605
248856
|
entities,
|
|
248606
248857
|
functions,
|
|
248858
|
+
actors,
|
|
248607
248859
|
agents,
|
|
248608
248860
|
agentSkills,
|
|
248609
248861
|
connectors,
|
|
@@ -248612,18 +248864,20 @@ function hasResourcesToDeploy(projectData) {
|
|
|
248612
248864
|
const hasSite = Boolean(project.site?.outputDirectory);
|
|
248613
248865
|
const hasEntities = entities.length > 0;
|
|
248614
248866
|
const hasFunctions = functions.length > 0;
|
|
248867
|
+
const hasActors = actors.length > 0;
|
|
248615
248868
|
const hasAgents = agents.length > 0;
|
|
248616
248869
|
const hasAgentSkills = agentSkills.length > 0;
|
|
248617
248870
|
const hasConnectors = connectors.length > 0;
|
|
248618
248871
|
const hasAuthConfig = authConfig.length > 0;
|
|
248619
248872
|
const hasVisibility = Boolean(project.visibility);
|
|
248620
|
-
return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
|
|
248873
|
+
return hasEntities || hasFunctions || hasActors || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
|
|
248621
248874
|
}
|
|
248622
248875
|
async function deployAll(projectData, options) {
|
|
248623
248876
|
const {
|
|
248624
248877
|
project,
|
|
248625
248878
|
entities,
|
|
248626
248879
|
functions,
|
|
248880
|
+
actors,
|
|
248627
248881
|
agents,
|
|
248628
248882
|
agentSkills,
|
|
248629
248883
|
connectors,
|
|
@@ -248634,10 +248888,16 @@ async function deployAll(projectData, options) {
|
|
|
248634
248888
|
options?.onVisibilitySet?.(project.visibility);
|
|
248635
248889
|
}
|
|
248636
248890
|
await entityResource.push(entities);
|
|
248637
|
-
await deployFunctionsSequentially(functions, {
|
|
248891
|
+
const functionResults = await deployFunctionsSequentially(functions, {
|
|
248638
248892
|
onStart: options?.onFunctionStart,
|
|
248639
248893
|
onResult: options?.onFunctionResult
|
|
248640
248894
|
});
|
|
248895
|
+
throwIfDeployFailed(functionResults, "function");
|
|
248896
|
+
const actorResults = await deployActorsSequentially(actors, {
|
|
248897
|
+
onStart: options?.onActorStart,
|
|
248898
|
+
onResult: options?.onActorResult
|
|
248899
|
+
});
|
|
248900
|
+
throwIfDeployFailed(actorResults, "actor");
|
|
248641
248901
|
await agentSkillResource.push(agentSkills);
|
|
248642
248902
|
await agentResource.push(agents);
|
|
248643
248903
|
await authConfigResource.push(authConfig);
|
|
@@ -255586,6 +255846,34 @@ function writeJsonError(error48) {
|
|
|
255586
255846
|
envelope.hints = error48.hints;
|
|
255587
255847
|
}
|
|
255588
255848
|
}
|
|
255849
|
+
if (error48 instanceof ApiError) {
|
|
255850
|
+
if (error48.statusCode !== undefined) {
|
|
255851
|
+
envelope.statusCode = error48.statusCode;
|
|
255852
|
+
}
|
|
255853
|
+
if (error48.requestId !== undefined) {
|
|
255854
|
+
envelope.requestId = error48.requestId;
|
|
255855
|
+
}
|
|
255856
|
+
}
|
|
255857
|
+
if (error48 instanceof ResourceDeployError) {
|
|
255858
|
+
envelope.failures = error48.failures.map((failure) => {
|
|
255859
|
+
const item = {
|
|
255860
|
+
name: failure.name,
|
|
255861
|
+
error: failure.message
|
|
255862
|
+
};
|
|
255863
|
+
if (isCLIError(failure.cause)) {
|
|
255864
|
+
item.code = failure.cause.code;
|
|
255865
|
+
}
|
|
255866
|
+
if (failure.cause instanceof ApiError) {
|
|
255867
|
+
if (failure.cause.statusCode !== undefined) {
|
|
255868
|
+
item.statusCode = failure.cause.statusCode;
|
|
255869
|
+
}
|
|
255870
|
+
if (failure.cause.requestId !== undefined) {
|
|
255871
|
+
item.requestId = failure.cause.requestId;
|
|
255872
|
+
}
|
|
255873
|
+
}
|
|
255874
|
+
return item;
|
|
255875
|
+
});
|
|
255876
|
+
}
|
|
255589
255877
|
process.stdout.write(`${JSON.stringify(envelope)}
|
|
255590
255878
|
`);
|
|
255591
255879
|
}
|
|
@@ -255682,11 +255970,55 @@ async function confirmPush({
|
|
|
255682
255970
|
});
|
|
255683
255971
|
return !Ct(proceed) && proceed;
|
|
255684
255972
|
}
|
|
255973
|
+
// src/cli/utils/datetime.ts
|
|
255974
|
+
var import_ms2 = __toESM(require_ms(), 1);
|
|
255975
|
+
var HAS_TIMEZONE_SUFFIX = /Z$|[+-]\d{2}:\d{2}$/;
|
|
255976
|
+
function normalizeDatetime(value) {
|
|
255977
|
+
const duration3 = import_ms2.default(value);
|
|
255978
|
+
if (duration3 !== undefined) {
|
|
255979
|
+
return new Date(Date.now() - duration3).toISOString();
|
|
255980
|
+
}
|
|
255981
|
+
if (HAS_TIMEZONE_SUFFIX.test(value))
|
|
255982
|
+
return value;
|
|
255983
|
+
return `${value}Z`;
|
|
255984
|
+
}
|
|
255985
|
+
// src/cli/utils/deploy-reporting.ts
|
|
255986
|
+
function formatDuration(ms2) {
|
|
255987
|
+
return `${(ms2 / 1000).toFixed(1)}s`;
|
|
255988
|
+
}
|
|
255989
|
+
function formatDeployResult(result, log) {
|
|
255990
|
+
const label = result.name.padEnd(25);
|
|
255991
|
+
if (result.status === "deployed") {
|
|
255992
|
+
const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
|
|
255993
|
+
log.success(`${label} deployed${timing}`);
|
|
255994
|
+
} else if (result.status === "unchanged") {
|
|
255995
|
+
log.success(`${label} unchanged`);
|
|
255996
|
+
} else {
|
|
255997
|
+
log.error(`${label} error: ${result.error}`);
|
|
255998
|
+
}
|
|
255999
|
+
}
|
|
256000
|
+
function buildDeploySummary(results, noun) {
|
|
256001
|
+
const deployed = results.filter((r) => r.status === "deployed").length;
|
|
256002
|
+
const unchanged = results.filter((r) => r.status === "unchanged").length;
|
|
256003
|
+
const failed = results.filter((r) => r.status === "error").length;
|
|
256004
|
+
const parts = [];
|
|
256005
|
+
if (deployed > 0)
|
|
256006
|
+
parts.push(`${deployed} deployed`);
|
|
256007
|
+
if (unchanged > 0)
|
|
256008
|
+
parts.push(`${unchanged} unchanged`);
|
|
256009
|
+
if (failed > 0)
|
|
256010
|
+
parts.push(`${failed} error${failed !== 1 ? "s" : ""}`);
|
|
256011
|
+
return parts.join(", ") || `No ${noun} deployed`;
|
|
256012
|
+
}
|
|
255685
256013
|
// src/cli/utils/json.ts
|
|
255686
256014
|
function toJsonStdout(result) {
|
|
255687
256015
|
return `${JSON.stringify(result, null, 2)}
|
|
255688
256016
|
`;
|
|
255689
256017
|
}
|
|
256018
|
+
// src/cli/utils/parse-names.ts
|
|
256019
|
+
function parseNames(args) {
|
|
256020
|
+
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
256021
|
+
}
|
|
255690
256022
|
// src/cli/errors.ts
|
|
255691
256023
|
class CLIExitError extends Error {
|
|
255692
256024
|
code;
|
|
@@ -255806,6 +256138,55 @@ function formatYaml(data, options = {}) {
|
|
|
255806
256138
|
const replacer = stripEmpty ? stripEmptyReplacer : undefined;
|
|
255807
256139
|
return $stringify(data, replacer, { indent: YAML_INDENT }).trimEnd();
|
|
255808
256140
|
}
|
|
256141
|
+
// src/cli/commands/actors/delete.ts
|
|
256142
|
+
async function deleteActorsAction({ runTask: runTask2 }, names) {
|
|
256143
|
+
let deleted = 0;
|
|
256144
|
+
let notFound = 0;
|
|
256145
|
+
let errors4 = 0;
|
|
256146
|
+
for (const name2 of names) {
|
|
256147
|
+
try {
|
|
256148
|
+
await runTask2(`Deleting ${name2}...`, () => deleteSingleActor(name2), {
|
|
256149
|
+
successMessage: `${name2} deleted`,
|
|
256150
|
+
errorMessage: `Failed to delete ${name2}`
|
|
256151
|
+
});
|
|
256152
|
+
deleted++;
|
|
256153
|
+
} catch (error48) {
|
|
256154
|
+
if (error48 instanceof ApiError && error48.statusCode === 404) {
|
|
256155
|
+
notFound++;
|
|
256156
|
+
} else {
|
|
256157
|
+
errors4++;
|
|
256158
|
+
}
|
|
256159
|
+
}
|
|
256160
|
+
}
|
|
256161
|
+
if (names.length === 1) {
|
|
256162
|
+
if (deleted)
|
|
256163
|
+
return { outroMessage: `Actor "${names[0]}" deleted` };
|
|
256164
|
+
if (notFound)
|
|
256165
|
+
return { outroMessage: `Actor "${names[0]}" not found` };
|
|
256166
|
+
return { outroMessage: `Failed to delete "${names[0]}"` };
|
|
256167
|
+
}
|
|
256168
|
+
const total = names.length;
|
|
256169
|
+
const parts = [];
|
|
256170
|
+
if (deleted > 0)
|
|
256171
|
+
parts.push(`${deleted}/${total} deleted`);
|
|
256172
|
+
if (notFound > 0)
|
|
256173
|
+
parts.push(`${notFound} not found`);
|
|
256174
|
+
if (errors4 > 0)
|
|
256175
|
+
parts.push(`${errors4} error${errors4 !== 1 ? "s" : ""}`);
|
|
256176
|
+
return { outroMessage: parts.join(", ") };
|
|
256177
|
+
}
|
|
256178
|
+
function validateNames(command2) {
|
|
256179
|
+
const names = parseNames(command2.args);
|
|
256180
|
+
if (names.length === 0) {
|
|
256181
|
+
command2.error("At least one actor name is required");
|
|
256182
|
+
}
|
|
256183
|
+
}
|
|
256184
|
+
function getDeleteCommand() {
|
|
256185
|
+
return new Base44Command("delete").description("Delete deployed actors").argument("<names...>", "Actor names to delete").hook("preAction", validateNames).action(async (ctx, rawNames) => {
|
|
256186
|
+
const names = parseNames(rawNames);
|
|
256187
|
+
return deleteActorsAction(ctx, names);
|
|
256188
|
+
});
|
|
256189
|
+
}
|
|
255809
256190
|
// src/core/utils/dependencies.ts
|
|
255810
256191
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
255811
256192
|
function verifyDenoInstalled(context) {
|
|
@@ -255893,13 +256274,64 @@ async function moveAppToWorkspace(appId, targetWorkspaceId, options = {}) {
|
|
|
255893
256274
|
}
|
|
255894
256275
|
return result.data;
|
|
255895
256276
|
}
|
|
256277
|
+
// src/cli/commands/actors/deploy.ts
|
|
256278
|
+
function resolveActorsToDeploy(names, allActors) {
|
|
256279
|
+
if (names.length === 0)
|
|
256280
|
+
return allActors;
|
|
256281
|
+
const notFound = names.filter((n2) => !allActors.some((a2) => a2.name === n2));
|
|
256282
|
+
if (notFound.length > 0) {
|
|
256283
|
+
throw new InvalidInputError(`Actor${notFound.length > 1 ? "s" : ""} not found in project: ${notFound.join(", ")}`);
|
|
256284
|
+
}
|
|
256285
|
+
return allActors.filter((a2) => names.includes(a2.name));
|
|
256286
|
+
}
|
|
256287
|
+
async function deployActorsAction({ log }, names) {
|
|
256288
|
+
const { actors, project: project2 } = await readProjectConfig();
|
|
256289
|
+
const toDeploy = resolveActorsToDeploy(names, actors);
|
|
256290
|
+
if (toDeploy.length === 0) {
|
|
256291
|
+
return {
|
|
256292
|
+
outroMessage: `No actors found. Create actors in the '${project2.actorsDir}' directory.`
|
|
256293
|
+
};
|
|
256294
|
+
}
|
|
256295
|
+
log.info(`Found ${toDeploy.length} ${toDeploy.length === 1 ? "actor" : "actors"} to deploy`);
|
|
256296
|
+
let completed = 0;
|
|
256297
|
+
const total = toDeploy.length;
|
|
256298
|
+
const results = await deployActorsSequentially(toDeploy, {
|
|
256299
|
+
onStart: (startNames) => {
|
|
256300
|
+
const label = startNames.length === 1 ? startNames[0] : `${startNames.length} actors`;
|
|
256301
|
+
log.step(theme.styles.dim(`[${completed + 1}/${total}] Deploying ${label}...`));
|
|
256302
|
+
},
|
|
256303
|
+
onResult: (result) => {
|
|
256304
|
+
completed++;
|
|
256305
|
+
formatDeployResult(result, log);
|
|
256306
|
+
}
|
|
256307
|
+
});
|
|
256308
|
+
const hasFailures = results.some((r) => r.status === "error");
|
|
256309
|
+
if (hasFailures) {
|
|
256310
|
+
log.message(buildDeploySummary(results, "actors"));
|
|
256311
|
+
throwIfDeployFailed(results, "actor");
|
|
256312
|
+
}
|
|
256313
|
+
return { outroMessage: buildDeploySummary(results, "actors") };
|
|
256314
|
+
}
|
|
256315
|
+
function getDeployCommand() {
|
|
256316
|
+
return new Base44Command("deploy").description("Deploy actors to Base44").argument("[names...]", "Actor names to deploy (deploys all if omitted)").action(async (ctx, rawNames) => {
|
|
256317
|
+
const names = parseNames(rawNames);
|
|
256318
|
+
return deployActorsAction(ctx, names);
|
|
256319
|
+
});
|
|
256320
|
+
}
|
|
256321
|
+
|
|
256322
|
+
// src/cli/commands/actors/index.ts
|
|
256323
|
+
function getActorsCommand() {
|
|
256324
|
+
return new Command("actors").description("Manage actors").addCommand(getDeployCommand()).addCommand(getDeleteCommand());
|
|
256325
|
+
}
|
|
256326
|
+
|
|
255896
256327
|
// src/cli/commands/agent-skills/pull.ts
|
|
256328
|
+
import { dirname as dirname12, join as join17 } from "node:path";
|
|
255897
256329
|
async function pullAction({
|
|
255898
256330
|
log,
|
|
255899
256331
|
runTask: runTask2
|
|
255900
256332
|
}) {
|
|
255901
256333
|
const { project: project2 } = await readProjectConfig();
|
|
255902
|
-
const dir = join17(
|
|
256334
|
+
const dir = join17(dirname12(project2.configPath), project2.agentSkillsDir);
|
|
255903
256335
|
const remote = await runTask2("Fetching agent skills from Base44", () => fetchAgentSkills(), {
|
|
255904
256336
|
successMessage: "Agent skills fetched successfully",
|
|
255905
256337
|
errorMessage: "Failed to fetch agent skills"
|
|
@@ -255955,13 +256387,13 @@ function getAgentSkillsCommand() {
|
|
|
255955
256387
|
}
|
|
255956
256388
|
|
|
255957
256389
|
// src/cli/commands/agents/pull.ts
|
|
255958
|
-
import { dirname as
|
|
256390
|
+
import { dirname as dirname13, join as join18 } from "node:path";
|
|
255959
256391
|
async function pullAgentsAction({
|
|
255960
256392
|
log,
|
|
255961
256393
|
runTask: runTask2
|
|
255962
256394
|
}) {
|
|
255963
256395
|
const { project: project2 } = await readProjectConfig();
|
|
255964
|
-
const configDir =
|
|
256396
|
+
const configDir = dirname13(project2.configPath);
|
|
255965
256397
|
const agentsDir = join18(configDir, project2.agentsDir);
|
|
255966
256398
|
const remoteAgents = await runTask2("Fetching agents from Base44", async () => {
|
|
255967
256399
|
return await fetchAgents();
|
|
@@ -256032,11 +256464,11 @@ function getAgentsCommand() {
|
|
|
256032
256464
|
}
|
|
256033
256465
|
|
|
256034
256466
|
// src/cli/commands/auth/password-login.ts
|
|
256035
|
-
import { dirname as
|
|
256467
|
+
import { dirname as dirname14, join as join19 } from "node:path";
|
|
256036
256468
|
async function passwordLoginAction({ log, runTask: runTask2 }, action) {
|
|
256037
256469
|
const shouldEnable = action === "enable";
|
|
256038
256470
|
const { project: project2 } = await readProjectConfig();
|
|
256039
|
-
const configDir =
|
|
256471
|
+
const configDir = dirname14(project2.configPath);
|
|
256040
256472
|
const authDir = join19(configDir, project2.authDir);
|
|
256041
256473
|
const updated = await runTask2("Updating local auth config", async () => {
|
|
256042
256474
|
const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
|
|
@@ -256057,13 +256489,13 @@ function getPasswordLoginCommand() {
|
|
|
256057
256489
|
}
|
|
256058
256490
|
|
|
256059
256491
|
// src/cli/commands/auth/pull.ts
|
|
256060
|
-
import { dirname as
|
|
256492
|
+
import { dirname as dirname15, join as join20 } from "node:path";
|
|
256061
256493
|
async function pullAuthAction({
|
|
256062
256494
|
log,
|
|
256063
256495
|
runTask: runTask2
|
|
256064
256496
|
}) {
|
|
256065
256497
|
const { project: project2 } = await readProjectConfig();
|
|
256066
|
-
const configDir =
|
|
256498
|
+
const configDir = dirname15(project2.configPath);
|
|
256067
256499
|
const authDir = join20(configDir, project2.authDir);
|
|
256068
256500
|
const remoteConfig = await runTask2("Fetching auth config from Base44", async () => {
|
|
256069
256501
|
return await pullAuthConfig();
|
|
@@ -256128,7 +256560,7 @@ function getAuthPushCommand() {
|
|
|
256128
256560
|
}
|
|
256129
256561
|
|
|
256130
256562
|
// src/cli/commands/auth/social-login.ts
|
|
256131
|
-
import { dirname as
|
|
256563
|
+
import { dirname as dirname16, join as join21, resolve as resolve4 } from "node:path";
|
|
256132
256564
|
var PROVIDER_LABELS = {
|
|
256133
256565
|
google: "Google",
|
|
256134
256566
|
microsoft: "Microsoft",
|
|
@@ -256198,7 +256630,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
|
|
|
256198
256630
|
}
|
|
256199
256631
|
}
|
|
256200
256632
|
const { project: project2 } = await readProjectConfig();
|
|
256201
|
-
const configDir =
|
|
256633
|
+
const configDir = dirname16(project2.configPath);
|
|
256202
256634
|
const authDir = join21(configDir, project2.authDir);
|
|
256203
256635
|
const { config: updated } = await runTask2("Updating local auth config", async () => updateSocialLoginConfig(authDir, provider, shouldEnable, useCustomOAuth && options.clientId ? { clientId: options.clientId } : undefined));
|
|
256204
256636
|
if (clientSecret) {
|
|
@@ -256224,7 +256656,7 @@ function getSocialLoginCommand() {
|
|
|
256224
256656
|
}
|
|
256225
256657
|
|
|
256226
256658
|
// src/cli/commands/auth/sso.ts
|
|
256227
|
-
import { dirname as
|
|
256659
|
+
import { dirname as dirname17, join as join22, resolve as resolve5 } from "node:path";
|
|
256228
256660
|
var SSOConfigFileSchema = exports_external.object({
|
|
256229
256661
|
provider: exports_external.enum(Object.values(KNOWN_SSO_PROVIDERS)),
|
|
256230
256662
|
clientId: exports_external.string(),
|
|
@@ -256387,7 +256819,7 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
|
|
|
256387
256819
|
throw error48;
|
|
256388
256820
|
}
|
|
256389
256821
|
const { project: project2 } = await readProjectConfig();
|
|
256390
|
-
const configDir =
|
|
256822
|
+
const configDir = dirname17(project2.configPath);
|
|
256391
256823
|
const authDir = join22(configDir, project2.authDir);
|
|
256392
256824
|
await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, provider, true));
|
|
256393
256825
|
await runTask2("Saving SSO credentials", async () => pushSSOSecrets(secrets));
|
|
@@ -256403,7 +256835,7 @@ async function ssoDisableAction({ log, runTask: runTask2 }, options) {
|
|
|
256403
256835
|
throw new InvalidInputError("Configuration options cannot be used with disable. To disable SSO: base44 auth sso disable");
|
|
256404
256836
|
}
|
|
256405
256837
|
const { project: project2 } = await readProjectConfig();
|
|
256406
|
-
const configDir =
|
|
256838
|
+
const configDir = dirname17(project2.configPath);
|
|
256407
256839
|
const authDir = join22(configDir, project2.authDir);
|
|
256408
256840
|
const updated = await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, null, false));
|
|
256409
256841
|
await runTask2("Removing SSO credentials", async () => deleteSSOSecrets());
|
|
@@ -257261,13 +257693,13 @@ function getConnectorsListAvailableCommand() {
|
|
|
257261
257693
|
}
|
|
257262
257694
|
|
|
257263
257695
|
// src/cli/commands/connectors/pull.ts
|
|
257264
|
-
import { dirname as
|
|
257696
|
+
import { dirname as dirname18, join as join23, resolve as resolve6 } from "node:path";
|
|
257265
257697
|
async function resolveConnectorsDir(options) {
|
|
257266
257698
|
if (!getAppContext().projectRoot) {
|
|
257267
257699
|
return resolve6(options.dir ?? "connectors");
|
|
257268
257700
|
}
|
|
257269
257701
|
const { project: project2 } = await readProjectConfig();
|
|
257270
|
-
return join23(
|
|
257702
|
+
return join23(dirname18(project2.configPath), project2.connectorsDir);
|
|
257271
257703
|
}
|
|
257272
257704
|
async function pullConnectorsAction({ log, runTask: runTask2, jsonMode }, options) {
|
|
257273
257705
|
const connectorsDir = await resolveConnectorsDir(options);
|
|
@@ -257522,43 +257954,19 @@ async function deleteFunctionsAction({ runTask: runTask2 }, names) {
|
|
|
257522
257954
|
parts.push(`${errors5} error${errors5 !== 1 ? "s" : ""}`);
|
|
257523
257955
|
return { outroMessage: parts.join(", ") };
|
|
257524
257956
|
}
|
|
257525
|
-
function
|
|
257526
|
-
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
257527
|
-
}
|
|
257528
|
-
function validateNames(command2) {
|
|
257957
|
+
function validateNames2(command2) {
|
|
257529
257958
|
const names = parseNames(command2.args);
|
|
257530
257959
|
if (names.length === 0) {
|
|
257531
257960
|
command2.error("At least one function name is required");
|
|
257532
257961
|
}
|
|
257533
257962
|
}
|
|
257534
|
-
function
|
|
257535
|
-
return new Base44Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").hook("preAction",
|
|
257963
|
+
function getDeleteCommand2() {
|
|
257964
|
+
return new Base44Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").hook("preAction", validateNames2).action(async (ctx, rawNames) => {
|
|
257536
257965
|
const names = parseNames(rawNames);
|
|
257537
257966
|
return deleteFunctionsAction(ctx, names);
|
|
257538
257967
|
});
|
|
257539
257968
|
}
|
|
257540
257969
|
|
|
257541
|
-
// src/cli/commands/functions/formatDeployResult.ts
|
|
257542
|
-
function formatDuration(ms) {
|
|
257543
|
-
return `${(ms / 1000).toFixed(1)}s`;
|
|
257544
|
-
}
|
|
257545
|
-
function formatDeployResult(result, log) {
|
|
257546
|
-
const label = result.name.padEnd(25);
|
|
257547
|
-
if (result.status === "deployed") {
|
|
257548
|
-
const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
|
|
257549
|
-
log.success(`${label} deployed${timing}`);
|
|
257550
|
-
} else if (result.status === "unchanged") {
|
|
257551
|
-
log.success(`${label} unchanged`);
|
|
257552
|
-
} else {
|
|
257553
|
-
log.error(`${label} error: ${result.error}`);
|
|
257554
|
-
}
|
|
257555
|
-
}
|
|
257556
|
-
|
|
257557
|
-
// src/cli/commands/functions/parseNames.ts
|
|
257558
|
-
function parseNames2(args) {
|
|
257559
|
-
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
257560
|
-
}
|
|
257561
|
-
|
|
257562
257970
|
// src/cli/commands/functions/deploy.ts
|
|
257563
257971
|
function resolveFunctionsToDeploy(names, allFunctions) {
|
|
257564
257972
|
if (names.length === 0)
|
|
@@ -257582,19 +257990,6 @@ function formatPruneSummary(pruneResults, log) {
|
|
|
257582
257990
|
log.info(`${pruned} deleted`);
|
|
257583
257991
|
}
|
|
257584
257992
|
}
|
|
257585
|
-
function buildDeploySummary(results) {
|
|
257586
|
-
const deployed = results.filter((r) => r.status === "deployed").length;
|
|
257587
|
-
const unchanged = results.filter((r) => r.status === "unchanged").length;
|
|
257588
|
-
const failed = results.filter((r) => r.status === "error").length;
|
|
257589
|
-
const parts = [];
|
|
257590
|
-
if (deployed > 0)
|
|
257591
|
-
parts.push(`${deployed} deployed`);
|
|
257592
|
-
if (unchanged > 0)
|
|
257593
|
-
parts.push(`${unchanged} unchanged`);
|
|
257594
|
-
if (failed > 0)
|
|
257595
|
-
parts.push(`${failed} error${failed !== 1 ? "s" : ""}`);
|
|
257596
|
-
return parts.join(", ") || "No functions deployed";
|
|
257597
|
-
}
|
|
257598
257993
|
async function deployFunctionsAction({ log }, names, options) {
|
|
257599
257994
|
if (options.force && names.length > 0) {
|
|
257600
257995
|
throw new InvalidInputError("--force cannot be used when specifying function names");
|
|
@@ -257621,8 +258016,8 @@ async function deployFunctionsAction({ log }, names, options) {
|
|
|
257621
258016
|
});
|
|
257622
258017
|
const hasFailures = results.some((r) => r.status === "error");
|
|
257623
258018
|
if (hasFailures) {
|
|
257624
|
-
log.message(buildDeploySummary(results));
|
|
257625
|
-
|
|
258019
|
+
log.message(buildDeploySummary(results, "functions"));
|
|
258020
|
+
throwIfDeployFailed(results, "function");
|
|
257626
258021
|
}
|
|
257627
258022
|
if (options.force) {
|
|
257628
258023
|
const allLocalNames = functions.map((f) => f.name);
|
|
@@ -257643,11 +258038,11 @@ async function deployFunctionsAction({ log }, names, options) {
|
|
|
257643
258038
|
});
|
|
257644
258039
|
formatPruneSummary(pruneResults, log);
|
|
257645
258040
|
}
|
|
257646
|
-
return { outroMessage: buildDeploySummary(results) };
|
|
258041
|
+
return { outroMessage: buildDeploySummary(results, "functions") };
|
|
257647
258042
|
}
|
|
257648
|
-
function
|
|
258043
|
+
function getDeployCommand2() {
|
|
257649
258044
|
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) => {
|
|
257650
|
-
const names =
|
|
258045
|
+
const names = parseNames(rawNames);
|
|
257651
258046
|
return deployFunctionsAction(ctx, names, options);
|
|
257652
258047
|
});
|
|
257653
258048
|
}
|
|
@@ -257675,10 +258070,10 @@ function getListCommand() {
|
|
|
257675
258070
|
}
|
|
257676
258071
|
|
|
257677
258072
|
// src/cli/commands/functions/pull.ts
|
|
257678
|
-
import { dirname as
|
|
258073
|
+
import { dirname as dirname19, join as join24 } from "node:path";
|
|
257679
258074
|
async function pullFunctionsAction({ log, runTask: runTask2 }, name2) {
|
|
257680
258075
|
const { project: project2, functions } = await readProjectConfig();
|
|
257681
|
-
const configDir =
|
|
258076
|
+
const configDir = dirname19(project2.configPath);
|
|
257682
258077
|
const functionsDir = join24(configDir, project2.functionsDir);
|
|
257683
258078
|
const pluginFunctionNames = new Set(functions.filter((fn) => fn.source.type === "plugin").map((fn) => fn.name));
|
|
257684
258079
|
const remoteFunctions = await runTask2("Fetching functions from Base44", async () => {
|
|
@@ -257734,7 +258129,7 @@ function getPullCommand() {
|
|
|
257734
258129
|
|
|
257735
258130
|
// src/cli/commands/functions/index.ts
|
|
257736
258131
|
function getFunctionsCommand() {
|
|
257737
|
-
return new Command("functions").description("Manage backend functions").addCommand(
|
|
258132
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand2()).addCommand(getDeleteCommand2()).addCommand(getListCommand()).addCommand(getPullCommand());
|
|
257738
258133
|
}
|
|
257739
258134
|
|
|
257740
258135
|
// src/cli/commands/project/site-build.ts
|
|
@@ -257812,7 +258207,7 @@ function getBuildCommand() {
|
|
|
257812
258207
|
}
|
|
257813
258208
|
|
|
257814
258209
|
// src/cli/commands/project/create.ts
|
|
257815
|
-
import { basename as
|
|
258210
|
+
import { basename as basename6, resolve as resolve8 } from "node:path";
|
|
257816
258211
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
257817
258212
|
|
|
257818
258213
|
// src/cli/commands/project/scaffold-shared.ts
|
|
@@ -257833,7 +258228,7 @@ async function completeProjectSetup({
|
|
|
257833
258228
|
projectId,
|
|
257834
258229
|
name: name2,
|
|
257835
258230
|
resolvedPath,
|
|
257836
|
-
deploy:
|
|
258231
|
+
deploy: deploy6,
|
|
257837
258232
|
skills,
|
|
257838
258233
|
isInteractive
|
|
257839
258234
|
}, { runTask: runTask2 }) {
|
|
@@ -257847,7 +258242,7 @@ async function completeProjectSetup({
|
|
|
257847
258242
|
});
|
|
257848
258243
|
shouldPushEntities = !Ct(result) && result;
|
|
257849
258244
|
} else {
|
|
257850
|
-
shouldPushEntities = !!
|
|
258245
|
+
shouldPushEntities = !!deploy6;
|
|
257851
258246
|
}
|
|
257852
258247
|
if (shouldPushEntities) {
|
|
257853
258248
|
await runTask2(`Pushing ${entities.length} data models to Base44...`, async () => {
|
|
@@ -257867,13 +258262,17 @@ async function completeProjectSetup({
|
|
|
257867
258262
|
});
|
|
257868
258263
|
shouldDeploy = !Ct(result) && result;
|
|
257869
258264
|
} else {
|
|
257870
|
-
shouldDeploy = !!
|
|
258265
|
+
shouldDeploy = !!deploy6;
|
|
257871
258266
|
}
|
|
257872
258267
|
if (shouldDeploy && installCommand && buildCommand && outputDirectory) {
|
|
257873
258268
|
const { appUrl } = await runTask2("Installing dependencies...", async (updateMessage) => {
|
|
257874
258269
|
await execa({ cwd: resolvedPath, shell: true })`${installCommand}`;
|
|
257875
258270
|
updateMessage("Building project...");
|
|
257876
|
-
await execa({
|
|
258271
|
+
await execa({
|
|
258272
|
+
cwd: resolvedPath,
|
|
258273
|
+
shell: true,
|
|
258274
|
+
env: { VITE_BASE44_APP_ID: projectId }
|
|
258275
|
+
})`${buildCommand}`;
|
|
257877
258276
|
updateMessage("Deploying site...");
|
|
257878
258277
|
return await deploySite(join25(resolvedPath, outputDirectory));
|
|
257879
258278
|
}, {
|
|
@@ -257973,8 +258372,8 @@ async function createInteractive(options, ctx) {
|
|
|
257973
258372
|
name: () => {
|
|
257974
258373
|
return options.name ? Promise.resolve(options.name) : Ze({
|
|
257975
258374
|
message: "What is the name of your project?",
|
|
257976
|
-
placeholder:
|
|
257977
|
-
initialValue:
|
|
258375
|
+
placeholder: basename6(process.cwd()),
|
|
258376
|
+
initialValue: basename6(process.cwd()),
|
|
257978
258377
|
validate: (value) => {
|
|
257979
258378
|
if (!value || value.trim().length === 0) {
|
|
257980
258379
|
return "Every project deserves a name";
|
|
@@ -258021,7 +258420,7 @@ async function executeCreate({
|
|
|
258021
258420
|
name: rawName,
|
|
258022
258421
|
description,
|
|
258023
258422
|
projectPath,
|
|
258024
|
-
deploy:
|
|
258423
|
+
deploy: deploy6,
|
|
258025
258424
|
skills,
|
|
258026
258425
|
workspaceId: flagWorkspaceId,
|
|
258027
258426
|
isInteractive
|
|
@@ -258043,7 +258442,7 @@ async function executeCreate({
|
|
|
258043
258442
|
errorMessage: "Failed to create project"
|
|
258044
258443
|
});
|
|
258045
258444
|
setAppContext({ id: projectId, projectRoot: resolvedPath });
|
|
258046
|
-
const summary = await completeProjectSetup({ projectId, name: name2, resolvedPath, deploy:
|
|
258445
|
+
const summary = await completeProjectSetup({ projectId, name: name2, resolvedPath, deploy: deploy6, skills, isInteractive }, ctx);
|
|
258047
258446
|
printProjectSummary(summary, log);
|
|
258048
258447
|
return { outroMessage: "Your project is set up and ready to use" };
|
|
258049
258448
|
}
|
|
@@ -258090,7 +258489,15 @@ async function deployAction(ctx, options = {}) {
|
|
|
258090
258489
|
outroMessage: "No resources found to deploy"
|
|
258091
258490
|
};
|
|
258092
258491
|
}
|
|
258093
|
-
const {
|
|
258492
|
+
const {
|
|
258493
|
+
project: project2,
|
|
258494
|
+
entities,
|
|
258495
|
+
functions,
|
|
258496
|
+
actors,
|
|
258497
|
+
agents,
|
|
258498
|
+
connectors,
|
|
258499
|
+
authConfig
|
|
258500
|
+
} = projectData;
|
|
258094
258501
|
const summaryLines = [];
|
|
258095
258502
|
if (entities.length > 0) {
|
|
258096
258503
|
summaryLines.push(` - ${entities.length} ${entities.length === 1 ? "entity" : "entities"}`);
|
|
@@ -258098,6 +258505,9 @@ async function deployAction(ctx, options = {}) {
|
|
|
258098
258505
|
if (functions.length > 0) {
|
|
258099
258506
|
summaryLines.push(` - ${functions.length} ${functions.length === 1 ? "function" : "functions"}`);
|
|
258100
258507
|
}
|
|
258508
|
+
if (actors.length > 0) {
|
|
258509
|
+
summaryLines.push(` - ${actors.length} ${actors.length === 1 ? "actor" : "actors"}`);
|
|
258510
|
+
}
|
|
258101
258511
|
if (agents.length > 0) {
|
|
258102
258512
|
summaryLines.push(` - ${agents.length} ${agents.length === 1 ? "agent" : "agents"}`);
|
|
258103
258513
|
}
|
|
@@ -258131,6 +258541,8 @@ ${summaryLines.join(`
|
|
|
258131
258541
|
await maybeBuildBeforeDeploy(ctx, project2, options.build);
|
|
258132
258542
|
let functionCompleted = 0;
|
|
258133
258543
|
const functionTotal = functions.length;
|
|
258544
|
+
let actorCompleted = 0;
|
|
258545
|
+
const actorTotal = actors.length;
|
|
258134
258546
|
const result = await deployAll(projectData, {
|
|
258135
258547
|
onVisibilitySet: (level) => {
|
|
258136
258548
|
log.success(`App visibility set to ${level}`);
|
|
@@ -258142,6 +258554,14 @@ ${summaryLines.join(`
|
|
|
258142
258554
|
onFunctionResult: (r) => {
|
|
258143
258555
|
functionCompleted++;
|
|
258144
258556
|
formatDeployResult(r, log);
|
|
258557
|
+
},
|
|
258558
|
+
onActorStart: (names) => {
|
|
258559
|
+
const label = names.length === 1 ? names[0] : `${names.length} actors`;
|
|
258560
|
+
log.step(theme.styles.dim(`[${actorCompleted + 1}/${actorTotal}] Deploying ${label}...`));
|
|
258561
|
+
},
|
|
258562
|
+
onActorResult: (r) => {
|
|
258563
|
+
actorCompleted++;
|
|
258564
|
+
formatDeployResult(r, log);
|
|
258145
258565
|
}
|
|
258146
258566
|
});
|
|
258147
258567
|
const connectorResults = result.connectorResults ?? [];
|
|
@@ -258156,8 +258576,8 @@ ${summaryLines.join(`
|
|
|
258156
258576
|
}
|
|
258157
258577
|
return { outroMessage: "App deployed successfully" };
|
|
258158
258578
|
}
|
|
258159
|
-
function
|
|
258160
|
-
return new Base44Command("deploy").description("Deploy
|
|
258579
|
+
function getDeployCommand3() {
|
|
258580
|
+
return new Base44Command("deploy").description("Deploy entities, functions, actors, agent skills, agents, auth, connectors, and site").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").action(deployAction);
|
|
258161
258581
|
}
|
|
258162
258582
|
async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
|
|
258163
258583
|
const needsOAuth = filterPendingOAuth(connectorResults);
|
|
@@ -258353,7 +258773,6 @@ function getLinkCommand() {
|
|
|
258353
258773
|
}
|
|
258354
258774
|
|
|
258355
258775
|
// src/cli/commands/project/logs.ts
|
|
258356
|
-
var import_ms2 = __toESM(require_ms(), 1);
|
|
258357
258776
|
function parseFunctionFilters(options) {
|
|
258358
258777
|
const filters = {};
|
|
258359
258778
|
if (options.since) {
|
|
@@ -258381,15 +258800,6 @@ function parseFunctionNames(option) {
|
|
|
258381
258800
|
return [];
|
|
258382
258801
|
return option.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
258383
258802
|
}
|
|
258384
|
-
function normalizeDatetime(value) {
|
|
258385
|
-
const duration3 = import_ms2.default(value);
|
|
258386
|
-
if (duration3 !== undefined) {
|
|
258387
|
-
return new Date(Date.now() - duration3).toISOString();
|
|
258388
|
-
}
|
|
258389
|
-
if (/Z$|[+-]\d{2}:\d{2}$/.test(value))
|
|
258390
|
-
return value;
|
|
258391
|
-
return `${value}Z`;
|
|
258392
|
-
}
|
|
258393
258803
|
function formatEntry(entry) {
|
|
258394
258804
|
const time3 = entry.time.substring(0, 19).replace("T", " ");
|
|
258395
258805
|
const level = entry.level.toUpperCase().padEnd(5);
|
|
@@ -258551,7 +258961,7 @@ function getLogsCommand() {
|
|
|
258551
258961
|
}
|
|
258552
258962
|
|
|
258553
258963
|
// src/cli/commands/project/scaffold.ts
|
|
258554
|
-
import { basename as
|
|
258964
|
+
import { basename as basename7, resolve as resolve9 } from "node:path";
|
|
258555
258965
|
function resolveAppId(options) {
|
|
258556
258966
|
const appId = options.appId;
|
|
258557
258967
|
if (!appId) {
|
|
@@ -258568,7 +258978,7 @@ async function scaffoldAction(ctx, name2, options, command2) {
|
|
|
258568
258978
|
const { log, runTask: runTask2 } = ctx;
|
|
258569
258979
|
const appId = resolveAppId(command2.optsWithGlobals());
|
|
258570
258980
|
const resolvedPath = resolve9("./");
|
|
258571
|
-
const projectName = (name2 ??
|
|
258981
|
+
const projectName = (name2 ?? basename7(resolvedPath)).trim();
|
|
258572
258982
|
const template2 = await getTemplateById("backend-only");
|
|
258573
258983
|
log.info(`Scaffolding project at ${resolvedPath}`);
|
|
258574
258984
|
const { projectId } = await runTask2("Setting up your project...", async () => {
|
|
@@ -258733,7 +259143,7 @@ function withSandboxAuthHint(error48) {
|
|
|
258733
259143
|
cause: error48
|
|
258734
259144
|
});
|
|
258735
259145
|
}
|
|
258736
|
-
async function callTool(appId, tool, payload,
|
|
259146
|
+
async function callTool(appId, tool, payload, schema13, context, timeout2 = 60000) {
|
|
258737
259147
|
const client = getSandboxClient(appId);
|
|
258738
259148
|
let response;
|
|
258739
259149
|
try {
|
|
@@ -258741,7 +259151,7 @@ async function callTool(appId, tool, payload, schema12, context, timeout2 = 6000
|
|
|
258741
259151
|
} catch (error48) {
|
|
258742
259152
|
throw withSandboxAuthHint(await ApiError.fromHttpError(error48, context));
|
|
258743
259153
|
}
|
|
258744
|
-
const result =
|
|
259154
|
+
const result = schema13.safeParse(await response.json());
|
|
258745
259155
|
if (!result.success) {
|
|
258746
259156
|
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
258747
259157
|
}
|
|
@@ -259030,7 +259440,7 @@ async function deployAction2(ctx, options) {
|
|
|
259030
259440
|
if (isNonInteractive && !options.yes) {
|
|
259031
259441
|
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
259032
259442
|
}
|
|
259033
|
-
const
|
|
259443
|
+
const project2 = await readProjectSettings();
|
|
259034
259444
|
const outputDirectory = project2.site?.outputDirectory;
|
|
259035
259445
|
if (!outputDirectory) {
|
|
259036
259446
|
throw new ConfigNotFoundError("No site configuration found.", {
|
|
@@ -259142,8 +259552,8 @@ var EMPTY_TEMPLATE = import_common_tags.stripIndent`
|
|
|
259142
259552
|
// Auto-generated by Base44 CLI - DO NOT EDIT
|
|
259143
259553
|
// Regenerate with: base44 types
|
|
259144
259554
|
//
|
|
259145
|
-
// No entities, functions, agents, or
|
|
259146
|
-
// Add resources to base44/entities/, base44/functions/, base44/agents/, or base44/
|
|
259555
|
+
// No entities, functions, agents, connectors, or actors found in project.
|
|
259556
|
+
// Add resources to base44/entities/, base44/functions/, base44/agents/, base44/connectors/, or base44/actors/
|
|
259147
259557
|
// and run \`base44 types generate\` again.
|
|
259148
259558
|
|
|
259149
259559
|
declare module '@base44/sdk' {
|
|
@@ -259155,8 +259565,8 @@ async function generateTypesFile(input) {
|
|
|
259155
259565
|
await writeFile(getTypesOutputPath(input.projectRoot), content);
|
|
259156
259566
|
}
|
|
259157
259567
|
async function generateContent(input) {
|
|
259158
|
-
const { entities, functions, agents, connectors } = input;
|
|
259159
|
-
if (!entities.length && !functions.length && !agents.length && !connectors.length) {
|
|
259568
|
+
const { entities, functions, agents, connectors, actors } = input;
|
|
259569
|
+
if (!entities.length && !functions.length && !agents.length && !connectors.length && !actors.length) {
|
|
259160
259570
|
return EMPTY_TEMPLATE;
|
|
259161
259571
|
}
|
|
259162
259572
|
const entityInterfaces = await Promise.all(entities.map((e8) => compileEntity(e8)));
|
|
@@ -259167,7 +259577,8 @@ async function generateContent(input) {
|
|
|
259167
259577
|
],
|
|
259168
259578
|
["FunctionNameRegistry", functions.map((f7) => `"${f7.name}": true;`)],
|
|
259169
259579
|
["AgentNameRegistry", agents.map((a5) => `"${a5.name}": true;`)],
|
|
259170
|
-
["ConnectorTypeRegistry", connectors.map((c8) => `"${c8.type}": true;`)]
|
|
259580
|
+
["ConnectorTypeRegistry", connectors.map((c8) => `"${c8.type}": true;`)],
|
|
259581
|
+
["ActorNameRegistry", actors.map((a5) => `"${a5.name}": true;`)]
|
|
259171
259582
|
];
|
|
259172
259583
|
const registries2 = registryEntries.filter(([, entries]) => entries.length > 0).map(([name2, entries]) => registry2(name2, entries));
|
|
259173
259584
|
return [
|
|
@@ -259187,9 +259598,9 @@ async function generateContent(input) {
|
|
|
259187
259598
|
`);
|
|
259188
259599
|
}
|
|
259189
259600
|
async function compileEntity(entity2) {
|
|
259190
|
-
const { name: name2, source: _source, ...
|
|
259601
|
+
const { name: name2, source: _source, ...schema13 } = entity2;
|
|
259191
259602
|
const jsonSchema = {
|
|
259192
|
-
...
|
|
259603
|
+
...schema13,
|
|
259193
259604
|
title: name2,
|
|
259194
259605
|
additionalProperties: false
|
|
259195
259606
|
};
|
|
@@ -259243,14 +259654,15 @@ var TYPES_FILE_PATH = "base44/.types/types.d.ts";
|
|
|
259243
259654
|
async function generateTypesAction({
|
|
259244
259655
|
runTask: runTask2
|
|
259245
259656
|
}) {
|
|
259246
|
-
const { entities, functions, agents, connectors, project: project2 } = await readProjectConfig();
|
|
259657
|
+
const { entities, functions, agents, connectors, actors, project: project2 } = await readProjectConfig();
|
|
259247
259658
|
await runTask2("Generating types", async () => {
|
|
259248
259659
|
await generateTypesFile({
|
|
259249
259660
|
projectRoot: project2.root,
|
|
259250
259661
|
entities,
|
|
259251
259662
|
functions,
|
|
259252
259663
|
agents,
|
|
259253
|
-
connectors
|
|
259664
|
+
connectors,
|
|
259665
|
+
actors
|
|
259254
259666
|
});
|
|
259255
259667
|
});
|
|
259256
259668
|
const tsconfigUpdated = await updateProjectConfig(project2.root);
|
|
@@ -259267,6 +259679,235 @@ function getTypesCommand() {
|
|
|
259267
259679
|
return new Command("types").description("Manage TypeScript type generation").addCommand(getTypesGenerateCommand());
|
|
259268
259680
|
}
|
|
259269
259681
|
|
|
259682
|
+
// src/core/resources/workflow/schema.ts
|
|
259683
|
+
var WorkflowRunStatusSchema = exports_external.enum([
|
|
259684
|
+
"running",
|
|
259685
|
+
"completed",
|
|
259686
|
+
"failed",
|
|
259687
|
+
"cancelled"
|
|
259688
|
+
]);
|
|
259689
|
+
var WorkflowListItemSchema = exports_external.object({
|
|
259690
|
+
id: exports_external.string(),
|
|
259691
|
+
name: exports_external.string(),
|
|
259692
|
+
description: exports_external.string().nullable().optional(),
|
|
259693
|
+
status: exports_external.string(),
|
|
259694
|
+
status_reason: exports_external.string().nullable().optional(),
|
|
259695
|
+
total_runs: exports_external.number().default(0),
|
|
259696
|
+
consecutive_failures: exports_external.number().default(0),
|
|
259697
|
+
last_run_at: exports_external.string().nullable().optional(),
|
|
259698
|
+
last_run_status: exports_external.string().nullable().optional()
|
|
259699
|
+
}).transform((data) => ({
|
|
259700
|
+
id: data.id,
|
|
259701
|
+
name: data.name,
|
|
259702
|
+
description: data.description ?? null,
|
|
259703
|
+
status: data.status,
|
|
259704
|
+
statusReason: data.status_reason ?? null,
|
|
259705
|
+
totalRuns: data.total_runs,
|
|
259706
|
+
consecutiveFailures: data.consecutive_failures,
|
|
259707
|
+
lastRunAt: data.last_run_at ?? null,
|
|
259708
|
+
lastRunStatus: data.last_run_status ?? null
|
|
259709
|
+
}));
|
|
259710
|
+
var ListWorkflowsResponseSchema = exports_external.array(WorkflowListItemSchema);
|
|
259711
|
+
var WorkflowRunSchema = exports_external.object({
|
|
259712
|
+
run_id: exports_external.string(),
|
|
259713
|
+
workflow_id: exports_external.string(),
|
|
259714
|
+
workflow_name: exports_external.string().default(""),
|
|
259715
|
+
trigger_type: exports_external.string().default(""),
|
|
259716
|
+
status: exports_external.string(),
|
|
259717
|
+
started_at: exports_external.string().nullable().optional(),
|
|
259718
|
+
completed_at: exports_external.string().nullable().optional(),
|
|
259719
|
+
duration_ms: exports_external.number().default(0),
|
|
259720
|
+
steps_count: exports_external.number().default(0),
|
|
259721
|
+
error_message: exports_external.string().nullable().optional(),
|
|
259722
|
+
is_test_run: exports_external.boolean().default(false),
|
|
259723
|
+
status_reason: exports_external.string().default("")
|
|
259724
|
+
}).transform((data) => ({
|
|
259725
|
+
runId: data.run_id,
|
|
259726
|
+
workflowId: data.workflow_id,
|
|
259727
|
+
workflowName: data.workflow_name,
|
|
259728
|
+
triggerType: data.trigger_type,
|
|
259729
|
+
status: data.status,
|
|
259730
|
+
startedAt: data.started_at ?? null,
|
|
259731
|
+
completedAt: data.completed_at ?? null,
|
|
259732
|
+
durationMs: data.duration_ms,
|
|
259733
|
+
stepsCount: data.steps_count,
|
|
259734
|
+
errorMessage: data.error_message ?? null,
|
|
259735
|
+
isTestRun: data.is_test_run,
|
|
259736
|
+
statusReason: data.status_reason
|
|
259737
|
+
}));
|
|
259738
|
+
var ListWorkflowRunsResponseSchema = exports_external.array(WorkflowRunSchema);
|
|
259739
|
+
|
|
259740
|
+
// src/core/resources/workflow/api.ts
|
|
259741
|
+
async function listWorkflows(limit) {
|
|
259742
|
+
const appClient = getAppClient();
|
|
259743
|
+
const searchParams = new URLSearchParams;
|
|
259744
|
+
if (limit !== undefined) {
|
|
259745
|
+
searchParams.set("limit", String(limit));
|
|
259746
|
+
}
|
|
259747
|
+
let response;
|
|
259748
|
+
try {
|
|
259749
|
+
response = await appClient.get("workflows", { searchParams });
|
|
259750
|
+
} catch (error48) {
|
|
259751
|
+
throw await ApiError.fromHttpError(error48, "listing workflows");
|
|
259752
|
+
}
|
|
259753
|
+
const result = ListWorkflowsResponseSchema.safeParse(await response.json());
|
|
259754
|
+
if (!result.success) {
|
|
259755
|
+
throw new SchemaValidationError("Invalid workflows response from server", result.error);
|
|
259756
|
+
}
|
|
259757
|
+
return result.data;
|
|
259758
|
+
}
|
|
259759
|
+
function buildRunsQueryString(filters) {
|
|
259760
|
+
const params = new URLSearchParams;
|
|
259761
|
+
if (filters.status) {
|
|
259762
|
+
params.set("status", filters.status);
|
|
259763
|
+
}
|
|
259764
|
+
if (filters.since) {
|
|
259765
|
+
params.set("since", filters.since);
|
|
259766
|
+
}
|
|
259767
|
+
if (filters.limit !== undefined) {
|
|
259768
|
+
params.set("limit", String(filters.limit));
|
|
259769
|
+
}
|
|
259770
|
+
return params;
|
|
259771
|
+
}
|
|
259772
|
+
async function listWorkflowRuns(filters = {}) {
|
|
259773
|
+
const appClient = getAppClient();
|
|
259774
|
+
let response;
|
|
259775
|
+
try {
|
|
259776
|
+
response = await appClient.get("workflows/runs", {
|
|
259777
|
+
searchParams: buildRunsQueryString(filters)
|
|
259778
|
+
});
|
|
259779
|
+
} catch (error48) {
|
|
259780
|
+
throw await ApiError.fromHttpError(error48, "listing workflow runs");
|
|
259781
|
+
}
|
|
259782
|
+
const result = ListWorkflowRunsResponseSchema.safeParse(await response.json());
|
|
259783
|
+
if (!result.success) {
|
|
259784
|
+
throw new SchemaValidationError("Invalid workflow runs response from server", result.error);
|
|
259785
|
+
}
|
|
259786
|
+
return result.data;
|
|
259787
|
+
}
|
|
259788
|
+
// src/cli/commands/workflows/legacy-app.ts
|
|
259789
|
+
var isWorkflowsNotEnabled = (error48) => error48 instanceof ApiError && error48.statusCode === 403;
|
|
259790
|
+
function rethrowLegacyAppAsExplanation(error48) {
|
|
259791
|
+
if (isWorkflowsNotEnabled(error48)) {
|
|
259792
|
+
throw new InvalidInputError("Workflows are not enabled for this app — it predates the Workflows system, so its automation runs are not readable via this command.");
|
|
259793
|
+
}
|
|
259794
|
+
throw error48;
|
|
259795
|
+
}
|
|
259796
|
+
|
|
259797
|
+
// src/cli/commands/workflows/limit.ts
|
|
259798
|
+
var MAX_LIMIT = 200;
|
|
259799
|
+
function parseLimit(limit) {
|
|
259800
|
+
if (limit === undefined)
|
|
259801
|
+
return;
|
|
259802
|
+
const parsed = Number.parseInt(limit, 10);
|
|
259803
|
+
if (Number.isNaN(parsed) || parsed < 1 || parsed > MAX_LIMIT) {
|
|
259804
|
+
throw new InvalidInputError(`Invalid limit: "${limit}". Must be a number between 1 and ${MAX_LIMIT}.`);
|
|
259805
|
+
}
|
|
259806
|
+
return parsed;
|
|
259807
|
+
}
|
|
259808
|
+
|
|
259809
|
+
// src/cli/commands/workflows/list.ts
|
|
259810
|
+
function formatWorkflowLine(workflow) {
|
|
259811
|
+
const lastRun = workflow.lastRunAt ? `last run ${workflow.lastRunStatus ?? "unknown"} at ${workflow.lastRunAt}` : "never ran";
|
|
259812
|
+
const failures = workflow.consecutiveFailures > 0 ? ` (${workflow.consecutiveFailures} consecutive failures)` : "";
|
|
259813
|
+
return `${workflow.name} [${workflow.status}] runs: ${workflow.totalRuns}, ${lastRun}${failures}`;
|
|
259814
|
+
}
|
|
259815
|
+
async function listAction({ log, runTask: runTask2, jsonMode }, options8) {
|
|
259816
|
+
const limit = parseLimit(options8.limit);
|
|
259817
|
+
const workflows = await runTask2("Fetching workflows from Base44", async () => listWorkflows(limit).catch(rethrowLegacyAppAsExplanation), {
|
|
259818
|
+
successMessage: "Workflows fetched successfully",
|
|
259819
|
+
errorMessage: "Failed to fetch workflows"
|
|
259820
|
+
});
|
|
259821
|
+
if (jsonMode) {
|
|
259822
|
+
return {
|
|
259823
|
+
outroMessage: `Found ${workflows.length} workflows.`,
|
|
259824
|
+
stdout: `${JSON.stringify({ workflows }, null, 2)}
|
|
259825
|
+
`
|
|
259826
|
+
};
|
|
259827
|
+
}
|
|
259828
|
+
if (workflows.length === 0) {
|
|
259829
|
+
return { outroMessage: "This app has no workflows." };
|
|
259830
|
+
}
|
|
259831
|
+
for (const workflow of workflows) {
|
|
259832
|
+
log.info(formatWorkflowLine(workflow));
|
|
259833
|
+
}
|
|
259834
|
+
return { outroMessage: `Found ${workflows.length} workflows.` };
|
|
259835
|
+
}
|
|
259836
|
+
function getWorkflowsListCommand() {
|
|
259837
|
+
return new Base44Command("list").description("List this app's workflows").option("-n, --limit <n>", `Number of workflows to return (1-${MAX_LIMIT}, default: 30)`).action(listAction);
|
|
259838
|
+
}
|
|
259839
|
+
|
|
259840
|
+
// src/cli/commands/workflows/runs.ts
|
|
259841
|
+
function formatDuration2(durationMs) {
|
|
259842
|
+
if (durationMs === 0)
|
|
259843
|
+
return "";
|
|
259844
|
+
return ` ${(durationMs / 1000).toFixed(1)}s`;
|
|
259845
|
+
}
|
|
259846
|
+
function formatRunTags(run) {
|
|
259847
|
+
const tags = [run.triggerType, run.isTestRun ? "test" : null].filter(Boolean);
|
|
259848
|
+
return tags.length > 0 ? ` (${tags.join(", ")})` : "";
|
|
259849
|
+
}
|
|
259850
|
+
function formatFailureDetail(run) {
|
|
259851
|
+
const reason = run.statusReason ? ` [${run.statusReason}]` : "";
|
|
259852
|
+
const message = run.errorMessage ? `
|
|
259853
|
+
${run.errorMessage}` : "";
|
|
259854
|
+
return `${reason}${message}`;
|
|
259855
|
+
}
|
|
259856
|
+
function formatRunLine(run) {
|
|
259857
|
+
const time3 = (run.startedAt ?? "").substring(0, 19).replace("T", " ");
|
|
259858
|
+
const status = run.status.toUpperCase().padEnd(9);
|
|
259859
|
+
const base = `${time3} ${status} ${run.workflowName}${formatRunTags(run)}${formatDuration2(run.durationMs)}`;
|
|
259860
|
+
const failureDetail = run.status === "failed" || run.status === "cancelled" ? formatFailureDetail(run) : "";
|
|
259861
|
+
return `${base}${failureDetail}`;
|
|
259862
|
+
}
|
|
259863
|
+
async function describeEmptyResult(hasFilters) {
|
|
259864
|
+
const workflows = await listWorkflows().catch(() => null);
|
|
259865
|
+
if (workflows === null) {
|
|
259866
|
+
return "No runs found.";
|
|
259867
|
+
}
|
|
259868
|
+
if (workflows.length === 0) {
|
|
259869
|
+
return "This app has no workflows, so there are no runs.";
|
|
259870
|
+
}
|
|
259871
|
+
const names = workflows.map((workflow) => workflow.name).join(", ");
|
|
259872
|
+
return hasFilters ? `No runs match your filters. Workflows in this app: ${names}.` : `No runs yet. Workflows in this app: ${names}.`;
|
|
259873
|
+
}
|
|
259874
|
+
async function runsAction(ctx, options8) {
|
|
259875
|
+
const limit = parseLimit(options8.limit);
|
|
259876
|
+
const runs = await ctx.runTask("Fetching workflow runs from Base44", async () => listWorkflowRuns({
|
|
259877
|
+
status: options8.status,
|
|
259878
|
+
since: options8.since,
|
|
259879
|
+
limit
|
|
259880
|
+
}).catch(rethrowLegacyAppAsExplanation), {
|
|
259881
|
+
successMessage: "Workflow runs fetched successfully",
|
|
259882
|
+
errorMessage: "Failed to fetch workflow runs"
|
|
259883
|
+
});
|
|
259884
|
+
if (ctx.jsonMode) {
|
|
259885
|
+
return {
|
|
259886
|
+
outroMessage: `Found ${runs.length} runs.`,
|
|
259887
|
+
stdout: `${JSON.stringify({ runs }, null, 2)}
|
|
259888
|
+
`
|
|
259889
|
+
};
|
|
259890
|
+
}
|
|
259891
|
+
if (runs.length === 0) {
|
|
259892
|
+
const hasFilters = Boolean(options8.status || options8.since);
|
|
259893
|
+
return { outroMessage: await describeEmptyResult(hasFilters) };
|
|
259894
|
+
}
|
|
259895
|
+
for (const run of runs) {
|
|
259896
|
+
ctx.log.info(formatRunLine(run));
|
|
259897
|
+
}
|
|
259898
|
+
return { outroMessage: `Found ${runs.length} runs.` };
|
|
259899
|
+
}
|
|
259900
|
+
function getWorkflowsRunsCommand() {
|
|
259901
|
+
return new Base44Command("runs").description("List workflow runs for this app, newest first (includes scheduled, manual, and test runs)").addOption(new Option("--status <status>", "Filter by run status").choices([
|
|
259902
|
+
...WorkflowRunStatusSchema.options
|
|
259903
|
+
])).option("--since <datetime>", "Show runs started after this time. ISO datetime or relative shorthand (e.g. 1h, 30m, 2d)", normalizeDatetime).option("-n, --limit <n>", `Number of runs to return (1-${MAX_LIMIT}, default: 30)`).action(runsAction);
|
|
259904
|
+
}
|
|
259905
|
+
|
|
259906
|
+
// src/cli/commands/workflows/index.ts
|
|
259907
|
+
function getWorkflowsCommand() {
|
|
259908
|
+
return new Command("workflows").description("Inspect this app's workflows and their runs").addCommand(getWorkflowsListCommand()).addCommand(getWorkflowsRunsCommand());
|
|
259909
|
+
}
|
|
259910
|
+
|
|
259270
259911
|
// src/cli/commands/workspace/shared.ts
|
|
259271
259912
|
function workspaceTag(workspace2) {
|
|
259272
259913
|
const role = workspace2.userRole ?? "member";
|
|
@@ -259454,7 +260095,7 @@ function createDevLogger(label2, labelColor = theme.styles.dim) {
|
|
|
259454
260095
|
// src/cli/dev/dev-server/main.ts
|
|
259455
260096
|
var import_cors = __toESM(require_lib4(), 1);
|
|
259456
260097
|
var import_express6 = __toESM(require_express(), 1);
|
|
259457
|
-
import { dirname as
|
|
260098
|
+
import { dirname as dirname25, join as join35 } from "node:path";
|
|
259458
260099
|
|
|
259459
260100
|
// ../../node_modules/get-port/index.js
|
|
259460
260101
|
import net from "node:net";
|
|
@@ -259475,8 +260116,8 @@ var getLocalHosts = () => {
|
|
|
259475
260116
|
const interfaces = os11.networkInterfaces();
|
|
259476
260117
|
const results = new Set([undefined, "0.0.0.0"]);
|
|
259477
260118
|
for (const _interface of Object.values(interfaces)) {
|
|
259478
|
-
for (const
|
|
259479
|
-
results.add(
|
|
260119
|
+
for (const config14 of _interface) {
|
|
260120
|
+
results.add(config14.address);
|
|
259480
260121
|
}
|
|
259481
260122
|
}
|
|
259482
260123
|
return results;
|
|
@@ -259589,7 +260230,7 @@ var $setGracefulCleanup = tmp.setGracefulCleanup;
|
|
|
259589
260230
|
|
|
259590
260231
|
// src/cli/dev/dev-server/function-manager.ts
|
|
259591
260232
|
import { spawn as spawn2 } from "node:child_process";
|
|
259592
|
-
import { dirname as
|
|
260233
|
+
import { dirname as dirname22, join as join29 } from "node:path";
|
|
259593
260234
|
import { pathToFileURL } from "node:url";
|
|
259594
260235
|
|
|
259595
260236
|
// src/cli/dev/dev-server/base-function-manager.ts
|
|
@@ -259694,7 +260335,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
259694
260335
|
}
|
|
259695
260336
|
spawnFunction(func, port) {
|
|
259696
260337
|
this.logger.log(`Spawning function "${func.name}" on port ${port}`);
|
|
259697
|
-
const importMapPath = join29(
|
|
260338
|
+
const importMapPath = join29(dirname22(this.wrapperPath), "import-map.json");
|
|
259698
260339
|
const process23 = spawn2("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
|
|
259699
260340
|
env: {
|
|
259700
260341
|
...globalThis.process.env,
|
|
@@ -260261,7 +260902,8 @@ var fieldTypes = [
|
|
|
260261
260902
|
"number",
|
|
260262
260903
|
"boolean",
|
|
260263
260904
|
"array",
|
|
260264
|
-
"object"
|
|
260905
|
+
"object",
|
|
260906
|
+
"null"
|
|
260265
260907
|
];
|
|
260266
260908
|
|
|
260267
260909
|
class Validator {
|
|
@@ -260321,6 +260963,14 @@ class Validator {
|
|
|
260321
260963
|
if (!property) {
|
|
260322
260964
|
return { hasError: false };
|
|
260323
260965
|
}
|
|
260966
|
+
if (Array.isArray(property.type)) {
|
|
260967
|
+
const types = property.type;
|
|
260968
|
+
const matched = types.some((type) => !this.validateValue(value, { ...property, type }, fieldPath).hasError);
|
|
260969
|
+
return matched ? { hasError: false } : {
|
|
260970
|
+
hasError: true,
|
|
260971
|
+
error: this.createValidationError(`Error in field ${fieldPath}: Input should be a valid ${types.join(" or ")}`)
|
|
260972
|
+
};
|
|
260973
|
+
}
|
|
260324
260974
|
const propertyType = property.type;
|
|
260325
260975
|
if (!fieldTypes.includes(propertyType)) {
|
|
260326
260976
|
return {
|
|
@@ -260361,6 +261011,14 @@ class Validator {
|
|
|
260361
261011
|
}
|
|
260362
261012
|
}
|
|
260363
261013
|
break;
|
|
261014
|
+
case "null":
|
|
261015
|
+
if (value !== null) {
|
|
261016
|
+
return {
|
|
261017
|
+
hasError: true,
|
|
261018
|
+
error: this.createValidationError(`Error in field ${fieldPath}: Input should be null`)
|
|
261019
|
+
};
|
|
261020
|
+
}
|
|
261021
|
+
break;
|
|
260364
261022
|
case "integer":
|
|
260365
261023
|
if (!Number.isInteger(value)) {
|
|
260366
261024
|
return {
|
|
@@ -260479,22 +261137,22 @@ class Database {
|
|
|
260479
261137
|
this.schemas.clear();
|
|
260480
261138
|
}
|
|
260481
261139
|
validate(entityName, record2, partial2 = false) {
|
|
260482
|
-
const
|
|
260483
|
-
if (!
|
|
261140
|
+
const schema13 = this.schemas.get(this.normalizeName(entityName));
|
|
261141
|
+
if (!schema13) {
|
|
260484
261142
|
throw new Error(`Entity "${entityName}" not found`);
|
|
260485
261143
|
}
|
|
260486
|
-
return this.validator.validate(record2,
|
|
261144
|
+
return this.validator.validate(record2, schema13, partial2);
|
|
260487
261145
|
}
|
|
260488
261146
|
prepareRecord(entityName, record2, partial2 = false) {
|
|
260489
|
-
const
|
|
260490
|
-
if (!
|
|
261147
|
+
const schema13 = this.schemas.get(this.normalizeName(entityName));
|
|
261148
|
+
if (!schema13) {
|
|
260491
261149
|
throw new Error(`Entity "${entityName}" not found`);
|
|
260492
261150
|
}
|
|
260493
|
-
const filteredRecord = this.validator.filterFields(record2,
|
|
261151
|
+
const filteredRecord = this.validator.filterFields(record2, schema13);
|
|
260494
261152
|
if (partial2) {
|
|
260495
261153
|
return filteredRecord;
|
|
260496
261154
|
}
|
|
260497
|
-
return this.validator.applyDefaults(filteredRecord,
|
|
261155
|
+
return this.validator.applyDefaults(filteredRecord, schema13);
|
|
260498
261156
|
}
|
|
260499
261157
|
normalizeName(entityName) {
|
|
260500
261158
|
return entityName.toLowerCase();
|
|
@@ -260780,7 +261438,9 @@ function evaluateCondition(condition, record2, user) {
|
|
|
260780
261438
|
function checkRLS(rule, record2, user) {
|
|
260781
261439
|
if (user?.is_service === true)
|
|
260782
261440
|
return true;
|
|
260783
|
-
if (rule === undefined)
|
|
261441
|
+
if (rule === undefined || rule === null || rule === "")
|
|
261442
|
+
return true;
|
|
261443
|
+
if (typeof rule === "object" && Object.keys(rule).length === 0)
|
|
260784
261444
|
return true;
|
|
260785
261445
|
if (typeof rule === "boolean")
|
|
260786
261446
|
return rule;
|
|
@@ -260788,13 +261448,13 @@ function checkRLS(rule, record2, user) {
|
|
|
260788
261448
|
return false;
|
|
260789
261449
|
return evaluateCondition(rule, record2, user);
|
|
260790
261450
|
}
|
|
260791
|
-
function applyFLS(record2,
|
|
261451
|
+
function applyFLS(record2, schema13, user, operation) {
|
|
260792
261452
|
if (Array.isArray(record2)) {
|
|
260793
|
-
return record2.map((r5) => applyFLS(r5,
|
|
261453
|
+
return record2.map((r5) => applyFLS(r5, schema13, user, operation));
|
|
260794
261454
|
}
|
|
260795
261455
|
const result = {};
|
|
260796
261456
|
for (const [key2, value] of Object.entries(record2)) {
|
|
260797
|
-
const rule =
|
|
261457
|
+
const rule = schema13.properties[key2]?.rls?.[operation];
|
|
260798
261458
|
if (rule === undefined || checkRLS(rule, record2, user)) {
|
|
260799
261459
|
result[key2] = value;
|
|
260800
261460
|
}
|
|
@@ -261022,14 +261682,14 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
261022
261682
|
res.status(404).json({ error: `Entity "${entityName}" not found` });
|
|
261023
261683
|
return;
|
|
261024
261684
|
}
|
|
261025
|
-
const
|
|
261026
|
-
if (!
|
|
261685
|
+
const schema13 = db2.getSchema(entityName);
|
|
261686
|
+
if (!schema13) {
|
|
261027
261687
|
res.status(404).json({ error: `Schema for "${entityName}" not found` });
|
|
261028
261688
|
return;
|
|
261029
261689
|
}
|
|
261030
261690
|
const currentUserResult = await resolveCurrentUser(db2, req);
|
|
261031
261691
|
const currentUser = currentUserResult.ok ? currentUserResult.user : undefined;
|
|
261032
|
-
await handler(req, res, collection,
|
|
261692
|
+
await handler(req, res, collection, schema13, currentUser);
|
|
261033
261693
|
};
|
|
261034
261694
|
}
|
|
261035
261695
|
function emit(appId, entityName, type, data) {
|
|
@@ -261047,19 +261707,19 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
261047
261707
|
}
|
|
261048
261708
|
broadcast(appId, entityName, createData(data));
|
|
261049
261709
|
}
|
|
261050
|
-
function prepareCreateRecord(entityName, body,
|
|
261710
|
+
function prepareCreateRecord(entityName, body, schema13, currentUser, now) {
|
|
261051
261711
|
const { _id, ...recordBody } = body;
|
|
261052
261712
|
const ownerFields = {
|
|
261053
261713
|
created_by: currentUser?.email,
|
|
261054
261714
|
created_by_id: currentUser?.id
|
|
261055
261715
|
};
|
|
261056
|
-
if (!checkRLS(
|
|
261716
|
+
if (!checkRLS(schema13.rls?.create, {
|
|
261057
261717
|
...recordBody,
|
|
261058
261718
|
...ownerFields
|
|
261059
261719
|
}, currentUser)) {
|
|
261060
261720
|
return;
|
|
261061
261721
|
}
|
|
261062
|
-
const filteredBody = applyFLS(db2.prepareRecord(entityName, recordBody),
|
|
261722
|
+
const filteredBody = applyFLS(db2.prepareRecord(entityName, recordBody), schema13, currentUser, "write");
|
|
261063
261723
|
db2.validate(entityName, filteredBody);
|
|
261064
261724
|
return {
|
|
261065
261725
|
...filteredBody,
|
|
@@ -261071,7 +261731,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
261071
261731
|
}
|
|
261072
261732
|
const userRouter = createUserRouter(db2, logger2);
|
|
261073
261733
|
router.use("/User", userRouter);
|
|
261074
|
-
router.get("/:entityName/:id", withCollection(async (req, res, collection,
|
|
261734
|
+
router.get("/:entityName/:id", withCollection(async (req, res, collection, schema13, currentUser) => {
|
|
261075
261735
|
const { entityName, id: id2 } = req.params;
|
|
261076
261736
|
try {
|
|
261077
261737
|
const doc2 = await collection.findOneAsync({ id: id2 });
|
|
@@ -261079,27 +261739,27 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
261079
261739
|
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
261080
261740
|
return;
|
|
261081
261741
|
}
|
|
261082
|
-
if (!checkRLS(
|
|
261742
|
+
if (!checkRLS(schema13.rls?.read, doc2, currentUser)) {
|
|
261083
261743
|
res.status(404).json({
|
|
261084
261744
|
message: `Entity ${entityName} with ID ${id2} not found`
|
|
261085
261745
|
});
|
|
261086
261746
|
return;
|
|
261087
261747
|
}
|
|
261088
|
-
const result = applyFLS(stripInternalFields(doc2),
|
|
261748
|
+
const result = applyFLS(stripInternalFields(doc2), schema13, currentUser, "read");
|
|
261089
261749
|
res.json(result);
|
|
261090
261750
|
} catch (error48) {
|
|
261091
261751
|
logger2.error(`Error in GET /${entityName}/${id2}:`, error48);
|
|
261092
261752
|
res.status(500).json({ error: "Internal server error" });
|
|
261093
261753
|
}
|
|
261094
261754
|
}));
|
|
261095
|
-
router.get("/:entityName", withCollection(async (req, res, collection,
|
|
261755
|
+
router.get("/:entityName", withCollection(async (req, res, collection, schema13, currentUser) => {
|
|
261096
261756
|
const { entityName } = req.params;
|
|
261097
261757
|
try {
|
|
261098
261758
|
let results = stripInternalFields(await queryEntity(collection, req.query));
|
|
261099
|
-
if (
|
|
261100
|
-
results = results.filter((doc2) => checkRLS(
|
|
261759
|
+
if (schema13.rls?.read !== undefined && schema13.rls.read !== true) {
|
|
261760
|
+
results = results.filter((doc2) => checkRLS(schema13.rls.read, doc2, currentUser));
|
|
261101
261761
|
}
|
|
261102
|
-
results = results.map((doc2) => applyFLS(doc2,
|
|
261762
|
+
results = results.map((doc2) => applyFLS(doc2, schema13, currentUser, "read"));
|
|
261103
261763
|
res.json(results);
|
|
261104
261764
|
} catch (error48) {
|
|
261105
261765
|
if (error48 instanceof InvalidInputError) {
|
|
@@ -261110,16 +261770,16 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
261110
261770
|
}
|
|
261111
261771
|
}
|
|
261112
261772
|
}));
|
|
261113
|
-
router.post("/:entityName", parseBody, withCollection(async (req, res, collection,
|
|
261773
|
+
router.post("/:entityName", parseBody, withCollection(async (req, res, collection, schema13, currentUser) => {
|
|
261114
261774
|
const { appId, entityName } = req.params;
|
|
261115
261775
|
try {
|
|
261116
261776
|
const now = new Date().toISOString();
|
|
261117
|
-
const record2 = prepareCreateRecord(entityName, req.body,
|
|
261777
|
+
const record2 = prepareCreateRecord(entityName, req.body, schema13, currentUser, now);
|
|
261118
261778
|
if (!record2) {
|
|
261119
261779
|
res.status(403).json({ error: "Permission denied" });
|
|
261120
261780
|
return;
|
|
261121
261781
|
}
|
|
261122
|
-
const inserted = applyFLS(stripInternalFields(await collection.insertAsync(record2)),
|
|
261782
|
+
const inserted = applyFLS(stripInternalFields(await collection.insertAsync(record2)), schema13, currentUser, "read");
|
|
261123
261783
|
emit(appId, entityName, "create", inserted);
|
|
261124
261784
|
res.status(201).json(inserted);
|
|
261125
261785
|
} catch (error48) {
|
|
@@ -261131,7 +261791,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
261131
261791
|
res.status(500).json({ error: "Internal server error" });
|
|
261132
261792
|
}
|
|
261133
261793
|
}));
|
|
261134
|
-
router.post("/:entityName/bulk", parseBody, withCollection(async (req, res, collection,
|
|
261794
|
+
router.post("/:entityName/bulk", parseBody, withCollection(async (req, res, collection, schema13, currentUser) => {
|
|
261135
261795
|
const { appId, entityName } = req.params;
|
|
261136
261796
|
if (!Array.isArray(req.body)) {
|
|
261137
261797
|
res.status(400).json({ error: "Request body must be an array" });
|
|
@@ -261141,14 +261801,14 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
261141
261801
|
const now = new Date().toISOString();
|
|
261142
261802
|
const records = [];
|
|
261143
261803
|
for (const body of req.body) {
|
|
261144
|
-
const record2 = prepareCreateRecord(entityName, body,
|
|
261804
|
+
const record2 = prepareCreateRecord(entityName, body, schema13, currentUser, now);
|
|
261145
261805
|
if (!record2) {
|
|
261146
261806
|
res.status(403).json({ error: "Permission denied" });
|
|
261147
261807
|
return;
|
|
261148
261808
|
}
|
|
261149
261809
|
records.push(record2);
|
|
261150
261810
|
}
|
|
261151
|
-
const inserted = applyFLS(stripInternalFields(await collection.insertAsync(records)),
|
|
261811
|
+
const inserted = applyFLS(stripInternalFields(await collection.insertAsync(records)), schema13, currentUser, "read");
|
|
261152
261812
|
emit(appId, entityName, "create", inserted);
|
|
261153
261813
|
res.status(201).json(inserted);
|
|
261154
261814
|
} catch (error48) {
|
|
@@ -261160,24 +261820,24 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
261160
261820
|
res.status(500).json({ error: "Internal server error" });
|
|
261161
261821
|
}
|
|
261162
261822
|
}));
|
|
261163
|
-
router.put("/:entityName/:id", parseBody, withCollection(async (req, res, collection,
|
|
261823
|
+
router.put("/:entityName/:id", parseBody, withCollection(async (req, res, collection, schema13, currentUser) => {
|
|
261164
261824
|
const { appId, entityName, id: id2 } = req.params;
|
|
261165
261825
|
const { id: _id, created_date: _created_date, ...body } = req.body;
|
|
261166
261826
|
try {
|
|
261167
|
-
if (
|
|
261827
|
+
if (schema13.rls?.update !== undefined) {
|
|
261168
261828
|
const existing = await collection.findOneAsync({ id: id2 });
|
|
261169
261829
|
if (!existing) {
|
|
261170
261830
|
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
261171
261831
|
return;
|
|
261172
261832
|
}
|
|
261173
|
-
if (!checkRLS(
|
|
261833
|
+
if (!checkRLS(schema13.rls.update, existing, currentUser)) {
|
|
261174
261834
|
res.status(404).json({
|
|
261175
261835
|
message: `Entity ${entityName} with ID ${id2} not found`
|
|
261176
261836
|
});
|
|
261177
261837
|
return;
|
|
261178
261838
|
}
|
|
261179
261839
|
}
|
|
261180
|
-
const filteredBody = applyFLS(db2.prepareRecord(entityName, body, true),
|
|
261840
|
+
const filteredBody = applyFLS(db2.prepareRecord(entityName, body, true), schema13, currentUser, "write");
|
|
261181
261841
|
db2.validate(entityName, filteredBody, true);
|
|
261182
261842
|
const updateData = {
|
|
261183
261843
|
...filteredBody,
|
|
@@ -261188,7 +261848,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
261188
261848
|
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
261189
261849
|
return;
|
|
261190
261850
|
}
|
|
261191
|
-
const updated = applyFLS(stripInternalFields(result.affectedDocuments),
|
|
261851
|
+
const updated = applyFLS(stripInternalFields(result.affectedDocuments), schema13, currentUser, "read");
|
|
261192
261852
|
emit(appId, entityName, "update", updated);
|
|
261193
261853
|
res.json(updated);
|
|
261194
261854
|
} catch (error48) {
|
|
@@ -261200,7 +261860,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
261200
261860
|
res.status(500).json({ error: "Internal server error" });
|
|
261201
261861
|
}
|
|
261202
261862
|
}));
|
|
261203
|
-
router.delete("/:entityName/:id", withCollection(async (req, res, collection,
|
|
261863
|
+
router.delete("/:entityName/:id", withCollection(async (req, res, collection, schema13, currentUser) => {
|
|
261204
261864
|
const { appId, entityName, id: id2 } = req.params;
|
|
261205
261865
|
try {
|
|
261206
261866
|
const doc2 = await collection.findOneAsync({ id: id2 });
|
|
@@ -261208,7 +261868,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
261208
261868
|
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
261209
261869
|
return;
|
|
261210
261870
|
}
|
|
261211
|
-
if (!checkRLS(
|
|
261871
|
+
if (!checkRLS(schema13.rls?.delete, doc2, currentUser)) {
|
|
261212
261872
|
res.status(404).json({
|
|
261213
261873
|
message: `Entity ${entityName} with ID ${id2} not found`
|
|
261214
261874
|
});
|
|
@@ -261222,11 +261882,11 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
261222
261882
|
res.status(500).json({ error: "Internal server error" });
|
|
261223
261883
|
}
|
|
261224
261884
|
}));
|
|
261225
|
-
router.delete("/:entityName", parseBody, withCollection(async (req, res, collection,
|
|
261885
|
+
router.delete("/:entityName", parseBody, withCollection(async (req, res, collection, schema13, currentUser) => {
|
|
261226
261886
|
const { entityName } = req.params;
|
|
261227
261887
|
try {
|
|
261228
261888
|
const query = req.body || {};
|
|
261229
|
-
const rlsDelete =
|
|
261889
|
+
const rlsDelete = schema13?.rls?.delete;
|
|
261230
261890
|
if (rlsDelete !== undefined && rlsDelete !== true) {
|
|
261231
261891
|
if (rlsDelete === false && currentUser?.is_service !== true) {
|
|
261232
261892
|
res.status(403).json({ error: "Permission denied" });
|
|
@@ -261342,7 +262002,7 @@ function createCustomIntegrationRoutes(remoteProxy, logger2) {
|
|
|
261342
262002
|
|
|
261343
262003
|
// src/cli/dev/dev-server/watcher.ts
|
|
261344
262004
|
import { EventEmitter as EventEmitter4 } from "node:events";
|
|
261345
|
-
import { relative as
|
|
262005
|
+
import { relative as relative8 } from "node:path";
|
|
261346
262006
|
|
|
261347
262007
|
// ../../node_modules/chokidar/index.js
|
|
261348
262008
|
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
@@ -261512,10 +262172,10 @@ class ReaddirpStream extends Readable6 {
|
|
|
261512
262172
|
}
|
|
261513
262173
|
async _formatEntry(dirent, path19) {
|
|
261514
262174
|
let entry;
|
|
261515
|
-
const
|
|
262175
|
+
const basename8 = this._isDirent ? dirent.name : dirent;
|
|
261516
262176
|
try {
|
|
261517
|
-
const fullPath = presolve(pjoin(path19,
|
|
261518
|
-
entry = { path: prelative(this._root, fullPath), fullPath, basename:
|
|
262177
|
+
const fullPath = presolve(pjoin(path19, basename8));
|
|
262178
|
+
entry = { path: prelative(this._root, fullPath), fullPath, basename: basename8 };
|
|
261519
262179
|
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
261520
262180
|
} catch (err) {
|
|
261521
262181
|
this._onError(err);
|
|
@@ -262042,9 +262702,9 @@ class NodeFsHandler {
|
|
|
262042
262702
|
_watchWithNodeFs(path19, listener) {
|
|
262043
262703
|
const opts = this.fsw.options;
|
|
262044
262704
|
const directory = sp2.dirname(path19);
|
|
262045
|
-
const
|
|
262705
|
+
const basename9 = sp2.basename(path19);
|
|
262046
262706
|
const parent = this.fsw._getWatchedDir(directory);
|
|
262047
|
-
parent.add(
|
|
262707
|
+
parent.add(basename9);
|
|
262048
262708
|
const absolutePath = sp2.resolve(path19);
|
|
262049
262709
|
const options8 = {
|
|
262050
262710
|
persistent: opts.persistent
|
|
@@ -262054,7 +262714,7 @@ class NodeFsHandler {
|
|
|
262054
262714
|
let closer;
|
|
262055
262715
|
if (opts.usePolling) {
|
|
262056
262716
|
const enableBin = opts.interval !== opts.binaryInterval;
|
|
262057
|
-
options8.interval = enableBin && isBinaryPath(
|
|
262717
|
+
options8.interval = enableBin && isBinaryPath(basename9) ? opts.binaryInterval : opts.interval;
|
|
262058
262718
|
closer = setFsWatchFileListener(path19, absolutePath, options8, {
|
|
262059
262719
|
listener,
|
|
262060
262720
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -262072,11 +262732,11 @@ class NodeFsHandler {
|
|
|
262072
262732
|
if (this.fsw.closed) {
|
|
262073
262733
|
return;
|
|
262074
262734
|
}
|
|
262075
|
-
const
|
|
262076
|
-
const
|
|
262077
|
-
const parent = this.fsw._getWatchedDir(
|
|
262735
|
+
const dirname24 = sp2.dirname(file2);
|
|
262736
|
+
const basename9 = sp2.basename(file2);
|
|
262737
|
+
const parent = this.fsw._getWatchedDir(dirname24);
|
|
262078
262738
|
let prevStats = stats;
|
|
262079
|
-
if (parent.has(
|
|
262739
|
+
if (parent.has(basename9))
|
|
262080
262740
|
return;
|
|
262081
262741
|
const listener = async (path19, newStats) => {
|
|
262082
262742
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
|
|
@@ -262101,9 +262761,9 @@ class NodeFsHandler {
|
|
|
262101
262761
|
prevStats = newStats2;
|
|
262102
262762
|
}
|
|
262103
262763
|
} catch (error48) {
|
|
262104
|
-
this.fsw._remove(
|
|
262764
|
+
this.fsw._remove(dirname24, basename9);
|
|
262105
262765
|
}
|
|
262106
|
-
} else if (parent.has(
|
|
262766
|
+
} else if (parent.has(basename9)) {
|
|
262107
262767
|
const at13 = newStats.atimeMs;
|
|
262108
262768
|
const mt12 = newStats.mtimeMs;
|
|
262109
262769
|
if (!at13 || at13 <= mt12 || mt12 !== prevStats.mtimeMs) {
|
|
@@ -262324,11 +262984,11 @@ function createPattern(matcher) {
|
|
|
262324
262984
|
if (matcher.path === string4)
|
|
262325
262985
|
return true;
|
|
262326
262986
|
if (matcher.recursive) {
|
|
262327
|
-
const
|
|
262328
|
-
if (!
|
|
262987
|
+
const relative8 = sp3.relative(matcher.path, string4);
|
|
262988
|
+
if (!relative8) {
|
|
262329
262989
|
return false;
|
|
262330
262990
|
}
|
|
262331
|
-
return !
|
|
262991
|
+
return !relative8.startsWith("..") && !sp3.isAbsolute(relative8);
|
|
262332
262992
|
}
|
|
262333
262993
|
return false;
|
|
262334
262994
|
};
|
|
@@ -263027,7 +263687,7 @@ class WatchBase44 extends EventEmitter4 {
|
|
|
263027
263687
|
ignoreInitial: true
|
|
263028
263688
|
});
|
|
263029
263689
|
watcher.on("all", import_debounce.default(async (_event, path19) => {
|
|
263030
|
-
this.emit("change", name2,
|
|
263690
|
+
this.emit("change", name2, relative8(targetPath, path19));
|
|
263031
263691
|
}, WATCH_DEBOUNCE_MS));
|
|
263032
263692
|
watcher.on("error", (err) => {
|
|
263033
263693
|
this.logger.error(`Watch handler failed for ${targetPath}`, err);
|
|
@@ -263134,8 +263794,8 @@ async function createDevServer(options8) {
|
|
|
263134
263794
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
263135
263795
|
};
|
|
263136
263796
|
const base44ConfigWatcher = new WatchBase44({
|
|
263137
|
-
functions: join35(
|
|
263138
|
-
entities: join35(
|
|
263797
|
+
functions: join35(dirname25(project2.configPath), project2.functionsDir),
|
|
263798
|
+
entities: join35(dirname25(project2.configPath), project2.entitiesDir)
|
|
263139
263799
|
}, devLogger);
|
|
263140
263800
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
263141
263801
|
try {
|
|
@@ -263331,6 +263991,10 @@ function validateDevOptions(command2) {
|
|
|
263331
263991
|
if (appId !== undefined) {
|
|
263332
263992
|
command2.error(`base44 dev cannot be used with --app-id or ${BASE44_APP_ID_ENV_VAR}.`);
|
|
263333
263993
|
}
|
|
263994
|
+
const { port, remote } = command2.opts();
|
|
263995
|
+
if (remote && port !== undefined) {
|
|
263996
|
+
command2.error("--port applies to the local backend, which --remote does not start.");
|
|
263997
|
+
}
|
|
263334
263998
|
}
|
|
263335
263999
|
function requireLinkedProject({ app }) {
|
|
263336
264000
|
if (!app?.projectRoot) {
|
|
@@ -263338,31 +264002,44 @@ function requireLinkedProject({ app }) {
|
|
|
263338
264002
|
}
|
|
263339
264003
|
return { id: app.id, projectRoot: app.projectRoot };
|
|
263340
264004
|
}
|
|
263341
|
-
async function
|
|
264005
|
+
async function resolveConfiguredSite(app) {
|
|
263342
264006
|
const { project: project2 } = await readProjectConfig(app.projectRoot);
|
|
263343
264007
|
const serveCommand = project2.site?.serveCommand;
|
|
263344
|
-
|
|
263345
|
-
return;
|
|
263346
|
-
}
|
|
263347
|
-
return createServeCommandRunner({
|
|
263348
|
-
serveCommand,
|
|
263349
|
-
projectRoot: project2.root,
|
|
263350
|
-
appId: app.id,
|
|
263351
|
-
appBaseUrl: backendUrl
|
|
263352
|
-
});
|
|
264008
|
+
return serveCommand ? { serveCommand, projectRoot: project2.root } : undefined;
|
|
263353
264009
|
}
|
|
263354
|
-
function
|
|
264010
|
+
function stopRunnerOnProcessSignals(runner) {
|
|
263355
264011
|
const stop2 = () => void runner.stop();
|
|
263356
264012
|
process.on("SIGINT", stop2);
|
|
263357
264013
|
process.on("SIGTERM", stop2);
|
|
264014
|
+
}
|
|
264015
|
+
function startServeCommand(runner, backend) {
|
|
264016
|
+
stopRunnerOnProcessSignals(runner);
|
|
263358
264017
|
runner.onExit(() => {
|
|
263359
264018
|
backend.shutdown().finally(() => process.exit(1));
|
|
263360
264019
|
});
|
|
263361
264020
|
createDevLogger("backend", theme.styles.info).log(`Backend running on ${backend.url}`);
|
|
263362
264021
|
runner.start();
|
|
263363
264022
|
}
|
|
263364
|
-
async function
|
|
263365
|
-
const
|
|
264023
|
+
async function remoteDevAction(app) {
|
|
264024
|
+
const site2 = await resolveConfiguredSite(app);
|
|
264025
|
+
if (!site2) {
|
|
264026
|
+
throw new ConfigInvalidError("base44 dev --remote serves the frontend against the production backend, but this project has no site.serveCommand in base44/config.jsonc.");
|
|
264027
|
+
}
|
|
264028
|
+
const appBaseUrl = await getSiteUrl();
|
|
264029
|
+
const runner = createServeCommandRunner({
|
|
264030
|
+
...site2,
|
|
264031
|
+
appId: app.id,
|
|
264032
|
+
appBaseUrl
|
|
264033
|
+
});
|
|
264034
|
+
stopRunnerOnProcessSignals(runner);
|
|
264035
|
+
runner.onExit((code2) => process.exit(code2 ?? 1));
|
|
264036
|
+
runner.start();
|
|
264037
|
+
return {
|
|
264038
|
+
outroMessage: `Frontend dev server targets ${theme.styles.bold(appBaseUrl)} — every write hits your live app`
|
|
264039
|
+
};
|
|
264040
|
+
}
|
|
264041
|
+
async function localDevAction(ctx, app, options8) {
|
|
264042
|
+
const site2 = await resolveConfiguredSite(app);
|
|
263366
264043
|
const siteUrlPromise = getSiteUrl().catch(() => {
|
|
263367
264044
|
return;
|
|
263368
264045
|
});
|
|
@@ -263377,15 +264054,23 @@ async function devAction(ctx, options8) {
|
|
|
263377
264054
|
}
|
|
263378
264055
|
});
|
|
263379
264056
|
const backendUrl = localServerUrl(backend.port);
|
|
263380
|
-
|
|
263381
|
-
|
|
264057
|
+
if (site2) {
|
|
264058
|
+
const runner = createServeCommandRunner({
|
|
264059
|
+
...site2,
|
|
264060
|
+
appId: app.id,
|
|
264061
|
+
appBaseUrl: backendUrl
|
|
264062
|
+
});
|
|
263382
264063
|
startServeCommand(runner, { url: backendUrl, shutdown: backend.shutdown });
|
|
263383
264064
|
}
|
|
263384
|
-
const outroMessage =
|
|
264065
|
+
const outroMessage = site2 ? "Open your app using the frontend dev server URL" : `Dev server is available at ${theme.colors.links(backendUrl)}`;
|
|
263385
264066
|
return { outroMessage };
|
|
263386
264067
|
}
|
|
264068
|
+
async function devAction(ctx, options8) {
|
|
264069
|
+
const app = requireLinkedProject(ctx);
|
|
264070
|
+
return options8.remote ? remoteDevAction(app) : localDevAction(ctx, app, options8);
|
|
264071
|
+
}
|
|
263387
264072
|
function getDevCommand() {
|
|
263388
|
-
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").hook("preAction", validateDevOptions).action(devAction);
|
|
264073
|
+
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").option("--remote", "Serve the frontend against the production backend instead of a local one").hook("preAction", validateDevOptions).action(devAction);
|
|
263389
264074
|
}
|
|
263390
264075
|
|
|
263391
264076
|
// src/core/exec/run-script.ts
|
|
@@ -263638,7 +264323,7 @@ function createProgram(context) {
|
|
|
263638
264323
|
program2.addCommand(getScaffoldCommand());
|
|
263639
264324
|
program2.addCommand(getDashboardCommand());
|
|
263640
264325
|
program2.addCommand(getBuildCommand());
|
|
263641
|
-
program2.addCommand(
|
|
264326
|
+
program2.addCommand(getDeployCommand3());
|
|
263642
264327
|
program2.addCommand(getVisibilityCommand());
|
|
263643
264328
|
program2.addCommand(getLinkCommand());
|
|
263644
264329
|
program2.addCommand(getEjectCommand());
|
|
@@ -263648,6 +264333,8 @@ function createProgram(context) {
|
|
|
263648
264333
|
program2.addCommand(getAgentSkillsCommand());
|
|
263649
264334
|
program2.addCommand(getConnectorsCommand());
|
|
263650
264335
|
program2.addCommand(getFunctionsCommand());
|
|
264336
|
+
program2.addCommand(getActorsCommand());
|
|
264337
|
+
program2.addCommand(getWorkflowsCommand());
|
|
263651
264338
|
program2.addCommand(getSecretsCommand());
|
|
263652
264339
|
program2.addCommand(getSandboxCommand());
|
|
263653
264340
|
program2.addCommand(getAuthCommand());
|
|
@@ -263664,7 +264351,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
263664
264351
|
import { release, type } from "node:os";
|
|
263665
264352
|
|
|
263666
264353
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
263667
|
-
import { dirname as
|
|
264354
|
+
import { dirname as dirname26, posix, sep } from "path";
|
|
263668
264355
|
function createModulerModifier() {
|
|
263669
264356
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
263670
264357
|
return async (frames) => {
|
|
@@ -263673,7 +264360,7 @@ function createModulerModifier() {
|
|
|
263673
264360
|
return frames;
|
|
263674
264361
|
};
|
|
263675
264362
|
}
|
|
263676
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
264363
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname26(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
|
|
263677
264364
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
263678
264365
|
return (filename) => {
|
|
263679
264366
|
if (!filename)
|
|
@@ -267862,7 +268549,7 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
267862
268549
|
});
|
|
267863
268550
|
}
|
|
267864
268551
|
// src/cli/index.ts
|
|
267865
|
-
var __dirname4 =
|
|
268552
|
+
var __dirname4 = dirname27(fileURLToPath6(import.meta.url));
|
|
267866
268553
|
async function runCLI(options8) {
|
|
267867
268554
|
ensureNpmAssets(join36(__dirname4, "../assets"));
|
|
267868
268555
|
const errorReporter = new ErrorReporter;
|
|
@@ -267903,4 +268590,4 @@ export {
|
|
|
267903
268590
|
CLIExitError
|
|
267904
268591
|
};
|
|
267905
268592
|
|
|
267906
|
-
//# debugId=
|
|
268593
|
+
//# debugId=FD1D5482C30AB9D864756E2164756E21
|