@base44-preview/cli 0.0.33-pr.331.c0ae606 → 0.0.33-pr.338.9ac2209
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +97 -201
- package/dist/cli/index.js.map +15 -15
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -4,25 +4,43 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
function __accessProp(key) {
|
|
8
|
+
return this[key];
|
|
9
|
+
}
|
|
10
|
+
var __toESMCache_node;
|
|
11
|
+
var __toESMCache_esm;
|
|
7
12
|
var __toESM = (mod, isNodeMode, target) => {
|
|
13
|
+
var canCache = mod != null && typeof mod === "object";
|
|
14
|
+
if (canCache) {
|
|
15
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
16
|
+
var cached = cache.get(mod);
|
|
17
|
+
if (cached)
|
|
18
|
+
return cached;
|
|
19
|
+
}
|
|
8
20
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
21
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
22
|
for (let key of __getOwnPropNames(mod))
|
|
11
23
|
if (!__hasOwnProp.call(to, key))
|
|
12
24
|
__defProp(to, key, {
|
|
13
|
-
get: (
|
|
25
|
+
get: __accessProp.bind(mod, key),
|
|
14
26
|
enumerable: true
|
|
15
27
|
});
|
|
28
|
+
if (canCache)
|
|
29
|
+
cache.set(mod, to);
|
|
16
30
|
return to;
|
|
17
31
|
};
|
|
18
32
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
33
|
+
var __returnValue = (v) => v;
|
|
34
|
+
function __exportSetter(name, newValue) {
|
|
35
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
36
|
+
}
|
|
19
37
|
var __export = (target, all) => {
|
|
20
38
|
for (var name in all)
|
|
21
39
|
__defProp(target, name, {
|
|
22
40
|
get: all[name],
|
|
23
41
|
enumerable: true,
|
|
24
42
|
configurable: true,
|
|
25
|
-
set: (
|
|
43
|
+
set: __exportSetter.bind(all, name)
|
|
26
44
|
});
|
|
27
45
|
};
|
|
28
46
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -17446,7 +17464,7 @@ var require_lodash2 = __commonJS((exports, module) => {
|
|
|
17446
17464
|
}
|
|
17447
17465
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
17448
17466
|
});
|
|
17449
|
-
function
|
|
17467
|
+
function join12(array2, separator) {
|
|
17450
17468
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
17451
17469
|
}
|
|
17452
17470
|
function last(array2) {
|
|
@@ -17468,7 +17486,7 @@ var require_lodash2 = __commonJS((exports, module) => {
|
|
|
17468
17486
|
function nth(array2, n2) {
|
|
17469
17487
|
return array2 && array2.length ? baseNth(array2, toInteger(n2)) : undefined2;
|
|
17470
17488
|
}
|
|
17471
|
-
var
|
|
17489
|
+
var pull = baseRest(pullAll);
|
|
17472
17490
|
function pullAll(array2, values2) {
|
|
17473
17491
|
return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
|
|
17474
17492
|
}
|
|
@@ -19233,7 +19251,7 @@ __p += '`;
|
|
|
19233
19251
|
lodash.pickBy = pickBy;
|
|
19234
19252
|
lodash.property = property;
|
|
19235
19253
|
lodash.propertyOf = propertyOf;
|
|
19236
|
-
lodash.pull =
|
|
19254
|
+
lodash.pull = pull;
|
|
19237
19255
|
lodash.pullAll = pullAll;
|
|
19238
19256
|
lodash.pullAllBy = pullAllBy;
|
|
19239
19257
|
lodash.pullAllWith = pullAllWith;
|
|
@@ -19378,7 +19396,7 @@ __p += '`;
|
|
|
19378
19396
|
lodash.isUndefined = isUndefined;
|
|
19379
19397
|
lodash.isWeakMap = isWeakMap;
|
|
19380
19398
|
lodash.isWeakSet = isWeakSet;
|
|
19381
|
-
lodash.join =
|
|
19399
|
+
lodash.join = join12;
|
|
19382
19400
|
lodash.kebabCase = kebabCase2;
|
|
19383
19401
|
lodash.last = last;
|
|
19384
19402
|
lodash.lastIndexOf = lastIndexOf;
|
|
@@ -20007,7 +20025,7 @@ function cleanDoc(doc2) {
|
|
|
20007
20025
|
return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
|
|
20008
20026
|
}
|
|
20009
20027
|
function replaceEndOfLine(doc2, replacement = literalline) {
|
|
20010
|
-
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
20028
|
+
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join12(replacement, currentDoc.split(`
|
|
20011
20029
|
`)) : currentDoc);
|
|
20012
20030
|
}
|
|
20013
20031
|
function canBreakFn(doc2) {
|
|
@@ -20087,7 +20105,7 @@ function indentIfBreak(contents, options) {
|
|
|
20087
20105
|
negate: options.negate
|
|
20088
20106
|
};
|
|
20089
20107
|
}
|
|
20090
|
-
function
|
|
20108
|
+
function join12(separator, docs) {
|
|
20091
20109
|
assertDoc(separator);
|
|
20092
20110
|
assertDocArray(docs);
|
|
20093
20111
|
const parts = [];
|
|
@@ -20798,7 +20816,7 @@ var init_doc = __esm(() => {
|
|
|
20798
20816
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
20799
20817
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
20800
20818
|
builders = {
|
|
20801
|
-
join:
|
|
20819
|
+
join: join12,
|
|
20802
20820
|
line,
|
|
20803
20821
|
softline,
|
|
20804
20822
|
hardline,
|
|
@@ -125712,7 +125730,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
125712
125730
|
return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
|
|
125713
125731
|
}
|
|
125714
125732
|
function replaceEndOfLine2(doc2, replacement = literalline2) {
|
|
125715
|
-
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
125733
|
+
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join14(replacement, currentDoc.split(`
|
|
125716
125734
|
`)) : currentDoc);
|
|
125717
125735
|
}
|
|
125718
125736
|
function canBreakFn2(doc2) {
|
|
@@ -125798,7 +125816,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
125798
125816
|
negate: options8.negate
|
|
125799
125817
|
};
|
|
125800
125818
|
}
|
|
125801
|
-
function
|
|
125819
|
+
function join14(separator, docs) {
|
|
125802
125820
|
assertDoc2(separator);
|
|
125803
125821
|
assertDocArray2(docs);
|
|
125804
125822
|
const parts = [];
|
|
@@ -126463,7 +126481,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
126463
126481
|
}
|
|
126464
126482
|
}
|
|
126465
126483
|
var builders2 = {
|
|
126466
|
-
join:
|
|
126484
|
+
join: join14,
|
|
126467
126485
|
line: line3,
|
|
126468
126486
|
softline: softline2,
|
|
126469
126487
|
hardline: hardline4,
|
|
@@ -155678,10 +155696,10 @@ var require_view = __commonJS((exports, module) => {
|
|
|
155678
155696
|
var debug = require_src4()("express:view");
|
|
155679
155697
|
var path18 = __require("node:path");
|
|
155680
155698
|
var fs28 = __require("node:fs");
|
|
155681
|
-
var
|
|
155699
|
+
var dirname11 = path18.dirname;
|
|
155682
155700
|
var basename4 = path18.basename;
|
|
155683
155701
|
var extname2 = path18.extname;
|
|
155684
|
-
var
|
|
155702
|
+
var join15 = path18.join;
|
|
155685
155703
|
var resolve5 = path18.resolve;
|
|
155686
155704
|
module.exports = View;
|
|
155687
155705
|
function View(name2, options8) {
|
|
@@ -155717,7 +155735,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
155717
155735
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
155718
155736
|
var root2 = roots[i5];
|
|
155719
155737
|
var loc = resolve5(root2, name2);
|
|
155720
|
-
var dir =
|
|
155738
|
+
var dir = dirname11(loc);
|
|
155721
155739
|
var file2 = basename4(loc);
|
|
155722
155740
|
path19 = this.resolve(dir, file2);
|
|
155723
155741
|
}
|
|
@@ -155743,12 +155761,12 @@ var require_view = __commonJS((exports, module) => {
|
|
|
155743
155761
|
};
|
|
155744
155762
|
View.prototype.resolve = function resolve6(dir, file2) {
|
|
155745
155763
|
var ext = this.ext;
|
|
155746
|
-
var path19 =
|
|
155764
|
+
var path19 = join15(dir, file2);
|
|
155747
155765
|
var stat2 = tryStat(path19);
|
|
155748
155766
|
if (stat2 && stat2.isFile()) {
|
|
155749
155767
|
return path19;
|
|
155750
155768
|
}
|
|
155751
|
-
path19 =
|
|
155769
|
+
path19 = join15(dir, basename4(file2, ext), "index" + ext);
|
|
155752
155770
|
stat2 = tryStat(path19);
|
|
155753
155771
|
if (stat2 && stat2.isFile()) {
|
|
155754
155772
|
return path19;
|
|
@@ -159443,7 +159461,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
159443
159461
|
var Stream2 = __require("stream");
|
|
159444
159462
|
var util2 = __require("util");
|
|
159445
159463
|
var extname2 = path18.extname;
|
|
159446
|
-
var
|
|
159464
|
+
var join15 = path18.join;
|
|
159447
159465
|
var normalize = path18.normalize;
|
|
159448
159466
|
var resolve5 = path18.resolve;
|
|
159449
159467
|
var sep = path18.sep;
|
|
@@ -159615,7 +159633,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
159615
159633
|
return res;
|
|
159616
159634
|
}
|
|
159617
159635
|
parts = path19.split(sep);
|
|
159618
|
-
path19 = normalize(
|
|
159636
|
+
path19 = normalize(join15(root2, path19));
|
|
159619
159637
|
} else {
|
|
159620
159638
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
159621
159639
|
debug('malicious path "%s"', path19);
|
|
@@ -159755,7 +159773,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
159755
159773
|
return self2.onStatError(err);
|
|
159756
159774
|
return self2.error(404);
|
|
159757
159775
|
}
|
|
159758
|
-
var p4 =
|
|
159776
|
+
var p4 = join15(path19, self2._index[i5]);
|
|
159759
159777
|
debug('stat "%s"', p4);
|
|
159760
159778
|
fs28.stat(p4, function(err2, stat2) {
|
|
159761
159779
|
if (err2)
|
|
@@ -162834,7 +162852,7 @@ var {
|
|
|
162834
162852
|
} = import__.default;
|
|
162835
162853
|
|
|
162836
162854
|
// src/cli/commands/agents/pull.ts
|
|
162837
|
-
import { dirname as dirname7, join as
|
|
162855
|
+
import { dirname as dirname7, join as join9 } from "node:path";
|
|
162838
162856
|
|
|
162839
162857
|
// node_modules/@clack/core/dist/index.mjs
|
|
162840
162858
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -185309,7 +185327,7 @@ var generateGlobTasks = normalizeArguments(generateTasks);
|
|
|
185309
185327
|
var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
|
|
185310
185328
|
|
|
185311
185329
|
// src/core/project/config.ts
|
|
185312
|
-
import { dirname as dirname5, join as
|
|
185330
|
+
import { dirname as dirname5, join as join6 } from "node:path";
|
|
185313
185331
|
|
|
185314
185332
|
// src/core/resources/agent/schema.ts
|
|
185315
185333
|
var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
|
|
@@ -186006,12 +186024,6 @@ var BackendFunctionSchema = FunctionConfigSchema.extend({
|
|
|
186006
186024
|
entryPath: exports_external.string().min(1, "Entry path cannot be empty"),
|
|
186007
186025
|
filePaths: exports_external.array(exports_external.string()).min(1, "Function must have at least one file")
|
|
186008
186026
|
});
|
|
186009
|
-
var DeployFunctionsResponseSchema = exports_external.object({
|
|
186010
|
-
deployed: exports_external.array(exports_external.string()),
|
|
186011
|
-
deleted: exports_external.array(exports_external.string()),
|
|
186012
|
-
skipped: exports_external.array(exports_external.string()).optional().nullable(),
|
|
186013
|
-
errors: exports_external.array(exports_external.object({ name: exports_external.string(), message: exports_external.string() })).nullable()
|
|
186014
|
-
});
|
|
186015
186027
|
var DeploySingleFunctionResponseSchema = exports_external.object({
|
|
186016
186028
|
status: exports_external.enum(["deployed", "unchanged"]),
|
|
186017
186029
|
duration_ms: exports_external.number().optional().nullable()
|
|
@@ -186033,34 +186045,6 @@ var ListFunctionsResponseSchema = exports_external.object({
|
|
|
186033
186045
|
});
|
|
186034
186046
|
|
|
186035
186047
|
// src/core/resources/function/api.ts
|
|
186036
|
-
function toDeployPayloadItem(fn) {
|
|
186037
|
-
return {
|
|
186038
|
-
name: fn.name,
|
|
186039
|
-
entry: fn.entry,
|
|
186040
|
-
files: fn.files,
|
|
186041
|
-
automations: fn.automations
|
|
186042
|
-
};
|
|
186043
|
-
}
|
|
186044
|
-
async function deployFunctions(functions) {
|
|
186045
|
-
const appClient = getAppClient();
|
|
186046
|
-
const payload = {
|
|
186047
|
-
functions: functions.map(toDeployPayloadItem)
|
|
186048
|
-
};
|
|
186049
|
-
let response;
|
|
186050
|
-
try {
|
|
186051
|
-
response = await appClient.put("backend-functions", {
|
|
186052
|
-
json: payload,
|
|
186053
|
-
timeout: false
|
|
186054
|
-
});
|
|
186055
|
-
} catch (error48) {
|
|
186056
|
-
throw await ApiError.fromHttpError(error48, "deploying functions");
|
|
186057
|
-
}
|
|
186058
|
-
const result = DeployFunctionsResponseSchema.safeParse(await response.json());
|
|
186059
|
-
if (!result.success) {
|
|
186060
|
-
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
186061
|
-
}
|
|
186062
|
-
return result.data;
|
|
186063
|
-
}
|
|
186064
186048
|
async function deploySingleFunction(name2, payload) {
|
|
186065
186049
|
const appClient = getAppClient();
|
|
186066
186050
|
let response;
|
|
@@ -186148,13 +186132,6 @@ async function loadFunctionCode(fn) {
|
|
|
186148
186132
|
}));
|
|
186149
186133
|
return { ...fn, files: loadedFiles };
|
|
186150
186134
|
}
|
|
186151
|
-
async function pushFunctions(functions) {
|
|
186152
|
-
if (functions.length === 0) {
|
|
186153
|
-
return { deployed: [], deleted: [], skipped: [], errors: null };
|
|
186154
|
-
}
|
|
186155
|
-
const functionsWithCode = await Promise.all(functions.map(loadFunctionCode));
|
|
186156
|
-
return deployFunctions(functionsWithCode);
|
|
186157
|
-
}
|
|
186158
186135
|
async function deployOne(fn) {
|
|
186159
186136
|
try {
|
|
186160
186137
|
const loaded = await loadFunctionCode(fn);
|
|
@@ -186203,57 +186180,10 @@ async function pruneRemovedFunctions(localFunctionNames) {
|
|
|
186203
186180
|
}
|
|
186204
186181
|
return results;
|
|
186205
186182
|
}
|
|
186206
|
-
// src/core/resources/function/pull.ts
|
|
186207
|
-
import { join as join6 } from "node:path";
|
|
186208
|
-
async function writeFunctions(functionsDir, functions) {
|
|
186209
|
-
const written = [];
|
|
186210
|
-
const skipped = [];
|
|
186211
|
-
for (const fn of functions) {
|
|
186212
|
-
const functionDir = join6(functionsDir, fn.name);
|
|
186213
|
-
const configPath = join6(functionDir, "function.jsonc");
|
|
186214
|
-
if (await isFunctionUnchanged(functionDir, fn)) {
|
|
186215
|
-
skipped.push(fn.name);
|
|
186216
|
-
continue;
|
|
186217
|
-
}
|
|
186218
|
-
const config5 = {
|
|
186219
|
-
name: fn.name,
|
|
186220
|
-
entry: fn.entry
|
|
186221
|
-
};
|
|
186222
|
-
if (fn.automations.length > 0) {
|
|
186223
|
-
config5.automations = fn.automations;
|
|
186224
|
-
}
|
|
186225
|
-
await writeJsonFile(configPath, config5);
|
|
186226
|
-
for (const file2 of fn.files) {
|
|
186227
|
-
await writeFile(join6(functionDir, file2.path), file2.content);
|
|
186228
|
-
}
|
|
186229
|
-
written.push(fn.name);
|
|
186230
|
-
}
|
|
186231
|
-
return { written, skipped };
|
|
186232
|
-
}
|
|
186233
|
-
async function isFunctionUnchanged(functionDir, fn) {
|
|
186234
|
-
if (!await pathExists(functionDir)) {
|
|
186235
|
-
return false;
|
|
186236
|
-
}
|
|
186237
|
-
for (const file2 of fn.files) {
|
|
186238
|
-
const filePath = join6(functionDir, file2.path);
|
|
186239
|
-
if (!await pathExists(filePath)) {
|
|
186240
|
-
return false;
|
|
186241
|
-
}
|
|
186242
|
-
try {
|
|
186243
|
-
const localContent = await readTextFile(filePath);
|
|
186244
|
-
if (localContent !== file2.content) {
|
|
186245
|
-
return false;
|
|
186246
|
-
}
|
|
186247
|
-
} catch {
|
|
186248
|
-
return false;
|
|
186249
|
-
}
|
|
186250
|
-
}
|
|
186251
|
-
return true;
|
|
186252
|
-
}
|
|
186253
186183
|
// src/core/resources/function/resource.ts
|
|
186254
186184
|
var functionResource = {
|
|
186255
186185
|
readAll: readAllFunctions,
|
|
186256
|
-
push:
|
|
186186
|
+
push: (functions) => pushFunctionsSingle(functions)
|
|
186257
186187
|
};
|
|
186258
186188
|
// src/core/project/config.ts
|
|
186259
186189
|
async function findConfigInDir(dir) {
|
|
@@ -186294,10 +186224,10 @@ async function readProjectConfig(projectRoot) {
|
|
|
186294
186224
|
const project = result.data;
|
|
186295
186225
|
const configDir = dirname5(configPath);
|
|
186296
186226
|
const [entities, functions, agents, connectors] = await Promise.all([
|
|
186297
|
-
entityResource.readAll(
|
|
186298
|
-
functionResource.readAll(
|
|
186299
|
-
agentResource.readAll(
|
|
186300
|
-
connectorResource.readAll(
|
|
186227
|
+
entityResource.readAll(join6(configDir, project.entitiesDir)),
|
|
186228
|
+
functionResource.readAll(join6(configDir, project.functionsDir)),
|
|
186229
|
+
agentResource.readAll(join6(configDir, project.agentsDir)),
|
|
186230
|
+
connectorResource.readAll(join6(configDir, project.connectorsDir))
|
|
186301
186231
|
]);
|
|
186302
186232
|
return {
|
|
186303
186233
|
project: { ...project, root, configPath },
|
|
@@ -186394,7 +186324,7 @@ async function readAppConfig(projectRoot) {
|
|
|
186394
186324
|
// src/core/project/template.ts
|
|
186395
186325
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
186396
186326
|
var import_front_matter = __toESM(require_front_matter(), 1);
|
|
186397
|
-
import { dirname as dirname6, join as
|
|
186327
|
+
import { dirname as dirname6, join as join7 } from "node:path";
|
|
186398
186328
|
async function listTemplates() {
|
|
186399
186329
|
const parsed = await readJsonFile(getTemplatesIndexPath());
|
|
186400
186330
|
const result = TemplatesConfigSchema.safeParse(parsed);
|
|
@@ -186404,23 +186334,23 @@ async function listTemplates() {
|
|
|
186404
186334
|
return result.data.templates;
|
|
186405
186335
|
}
|
|
186406
186336
|
async function renderTemplate(template, destPath, data) {
|
|
186407
|
-
const templateDir =
|
|
186337
|
+
const templateDir = join7(getTemplatesDir(), template.path);
|
|
186408
186338
|
const files = await globby("**/*", {
|
|
186409
186339
|
cwd: templateDir,
|
|
186410
186340
|
dot: true,
|
|
186411
186341
|
onlyFiles: true
|
|
186412
186342
|
});
|
|
186413
186343
|
for (const file2 of files) {
|
|
186414
|
-
const srcPath =
|
|
186344
|
+
const srcPath = join7(templateDir, file2);
|
|
186415
186345
|
try {
|
|
186416
186346
|
if (file2.endsWith(".ejs")) {
|
|
186417
186347
|
const rendered = await import_ejs.default.renderFile(srcPath, data);
|
|
186418
186348
|
const { attributes, body } = import_front_matter.default(rendered);
|
|
186419
|
-
const destFile = attributes.outputFileName ?
|
|
186420
|
-
const destFilePath =
|
|
186349
|
+
const destFile = attributes.outputFileName ? join7(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
|
|
186350
|
+
const destFilePath = join7(destPath, destFile);
|
|
186421
186351
|
await writeFile(destFilePath, body);
|
|
186422
186352
|
} else {
|
|
186423
|
-
const destFilePath =
|
|
186353
|
+
const destFilePath = join7(destPath, file2);
|
|
186424
186354
|
await copyFile(srcPath, destFilePath);
|
|
186425
186355
|
}
|
|
186426
186356
|
} catch (error48) {
|
|
@@ -186523,7 +186453,7 @@ async function getSiteFilePaths(outputDir) {
|
|
|
186523
186453
|
// src/core/site/deploy.ts
|
|
186524
186454
|
import { randomUUID } from "node:crypto";
|
|
186525
186455
|
import { tmpdir } from "node:os";
|
|
186526
|
-
import { join as
|
|
186456
|
+
import { join as join8 } from "node:path";
|
|
186527
186457
|
async function deploySite(siteOutputDir) {
|
|
186528
186458
|
if (!await pathExists(siteOutputDir)) {
|
|
186529
186459
|
throw new FileNotFoundError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
|
|
@@ -186540,7 +186470,7 @@ async function deploySite(siteOutputDir) {
|
|
|
186540
186470
|
]
|
|
186541
186471
|
});
|
|
186542
186472
|
}
|
|
186543
|
-
const archivePath =
|
|
186473
|
+
const archivePath = join8(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
|
|
186544
186474
|
try {
|
|
186545
186475
|
await createArchive(siteOutputDir, archivePath);
|
|
186546
186476
|
return await uploadSite(archivePath);
|
|
@@ -186565,10 +186495,13 @@ function hasResourcesToDeploy(projectData) {
|
|
|
186565
186495
|
const hasConnectors = connectors.length > 0;
|
|
186566
186496
|
return hasEntities || hasFunctions || hasAgents || hasConnectors || hasSite;
|
|
186567
186497
|
}
|
|
186568
|
-
async function deployAll(projectData) {
|
|
186498
|
+
async function deployAll(projectData, options) {
|
|
186569
186499
|
const { project, entities, functions, agents, connectors } = projectData;
|
|
186570
186500
|
await entityResource.push(entities);
|
|
186571
|
-
await
|
|
186501
|
+
await pushFunctionsSingle(functions, {
|
|
186502
|
+
onStart: options?.onFunctionStart,
|
|
186503
|
+
onResult: options?.onFunctionResult
|
|
186504
|
+
});
|
|
186572
186505
|
await agentResource.push(agents);
|
|
186573
186506
|
const { results: connectorResults } = await pushConnectors(connectors);
|
|
186574
186507
|
if (project.site?.outputDirectory) {
|
|
@@ -194221,7 +194154,7 @@ function getDashboardUrl(projectId) {
|
|
|
194221
194154
|
async function pullAgentsAction() {
|
|
194222
194155
|
const { project: project2 } = await readProjectConfig();
|
|
194223
194156
|
const configDir = dirname7(project2.configPath);
|
|
194224
|
-
const agentsDir =
|
|
194157
|
+
const agentsDir = join9(configDir, project2.agentsDir);
|
|
194225
194158
|
const remoteAgents = await runTask("Fetching agents from Base44", async () => {
|
|
194226
194159
|
return await fetchAgents();
|
|
194227
194160
|
}, {
|
|
@@ -194315,11 +194248,11 @@ function getWhoamiCommand(context) {
|
|
|
194315
194248
|
}
|
|
194316
194249
|
|
|
194317
194250
|
// src/cli/commands/connectors/pull.ts
|
|
194318
|
-
import { dirname as dirname8, join as
|
|
194251
|
+
import { dirname as dirname8, join as join10 } from "node:path";
|
|
194319
194252
|
async function pullConnectorsAction() {
|
|
194320
194253
|
const { project: project2 } = await readProjectConfig();
|
|
194321
194254
|
const configDir = dirname8(project2.configPath);
|
|
194322
|
-
const connectorsDir =
|
|
194255
|
+
const connectorsDir = join10(configDir, project2.connectorsDir);
|
|
194323
194256
|
const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
|
|
194324
194257
|
return await listConnectors();
|
|
194325
194258
|
}, {
|
|
@@ -195167,10 +195100,12 @@ function getEntitiesPushCommand(context) {
|
|
|
195167
195100
|
}));
|
|
195168
195101
|
}
|
|
195169
195102
|
|
|
195170
|
-
// src/cli/
|
|
195103
|
+
// src/cli/utils/parseNames.ts
|
|
195171
195104
|
function parseNames(args) {
|
|
195172
195105
|
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
195173
195106
|
}
|
|
195107
|
+
|
|
195108
|
+
// src/cli/commands/functions/delete.ts
|
|
195174
195109
|
async function deleteFunctionsAction(names) {
|
|
195175
195110
|
let deleted = 0;
|
|
195176
195111
|
let notFound = 0;
|
|
@@ -195218,11 +195153,11 @@ function getDeleteCommand(context) {
|
|
|
195218
195153
|
});
|
|
195219
195154
|
}
|
|
195220
195155
|
|
|
195221
|
-
// src/cli/
|
|
195156
|
+
// src/cli/utils/formatDeployResult.ts
|
|
195222
195157
|
function formatDuration(ms) {
|
|
195223
195158
|
return `${(ms / 1000).toFixed(1)}s`;
|
|
195224
195159
|
}
|
|
195225
|
-
function
|
|
195160
|
+
function formatDeployResult(r) {
|
|
195226
195161
|
const label = r.name.padEnd(25);
|
|
195227
195162
|
if (r.status === "deployed") {
|
|
195228
195163
|
const timing = r.duration_ms ? theme.styles.dim(` (${formatDuration(r.duration_ms)})`) : "";
|
|
@@ -195233,9 +195168,8 @@ function formatResult(r) {
|
|
|
195233
195168
|
R2.error(`${label} error: ${r.error}`);
|
|
195234
195169
|
}
|
|
195235
195170
|
}
|
|
195236
|
-
|
|
195237
|
-
|
|
195238
|
-
}
|
|
195171
|
+
|
|
195172
|
+
// src/cli/commands/functions/deploy.ts
|
|
195239
195173
|
async function deployFunctionsAction(names, options) {
|
|
195240
195174
|
if (options.force && names.length > 0) {
|
|
195241
195175
|
throw new InvalidInputError("--force cannot be used when specifying function names");
|
|
@@ -195266,7 +195200,7 @@ async function deployFunctionsAction(names, options) {
|
|
|
195266
195200
|
},
|
|
195267
195201
|
onResult: (r) => {
|
|
195268
195202
|
completed++;
|
|
195269
|
-
|
|
195203
|
+
formatDeployResult(r);
|
|
195270
195204
|
}
|
|
195271
195205
|
});
|
|
195272
195206
|
const succeeded = results.filter((r) => r.status !== "error").length;
|
|
@@ -195298,7 +195232,7 @@ async function deployFunctionsAction(names, options) {
|
|
|
195298
195232
|
function getDeployCommand(context) {
|
|
195299
195233
|
return new Command("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 (rawNames, options) => {
|
|
195300
195234
|
await runCommand(() => {
|
|
195301
|
-
const names =
|
|
195235
|
+
const names = parseNames(rawNames);
|
|
195302
195236
|
return deployFunctionsAction(names, options);
|
|
195303
195237
|
}, { requireAuth: true }, context);
|
|
195304
195238
|
});
|
|
@@ -195308,7 +195242,7 @@ function getDeployCommand(context) {
|
|
|
195308
195242
|
async function listFunctionsAction() {
|
|
195309
195243
|
const { functions } = await listDeployedFunctions();
|
|
195310
195244
|
if (functions.length === 0) {
|
|
195311
|
-
return { outroMessage: "No functions
|
|
195245
|
+
return { outroMessage: "No functions on remote" };
|
|
195312
195246
|
}
|
|
195313
195247
|
for (const fn of functions) {
|
|
195314
195248
|
const autoCount = fn.automations.length;
|
|
@@ -195316,7 +195250,7 @@ async function listFunctionsAction() {
|
|
|
195316
195250
|
R2.message(` ${fn.name}${autoLabel}`);
|
|
195317
195251
|
}
|
|
195318
195252
|
return {
|
|
195319
|
-
outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""}
|
|
195253
|
+
outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
|
|
195320
195254
|
};
|
|
195321
195255
|
}
|
|
195322
195256
|
function getListCommand(context) {
|
|
@@ -195325,57 +195259,13 @@ function getListCommand(context) {
|
|
|
195325
195259
|
});
|
|
195326
195260
|
}
|
|
195327
195261
|
|
|
195328
|
-
// src/cli/commands/functions/pull.ts
|
|
195329
|
-
import { dirname as dirname9, join as join12 } from "node:path";
|
|
195330
|
-
async function pullFunctionsAction(name2) {
|
|
195331
|
-
const { project: project2 } = await readProjectConfig();
|
|
195332
|
-
const configDir = dirname9(project2.configPath);
|
|
195333
|
-
const functionsDir = join12(configDir, project2.functionsDir);
|
|
195334
|
-
const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
|
|
195335
|
-
const { functions } = await listDeployedFunctions();
|
|
195336
|
-
return functions;
|
|
195337
|
-
}, {
|
|
195338
|
-
successMessage: "Functions fetched successfully",
|
|
195339
|
-
errorMessage: "Failed to fetch functions"
|
|
195340
|
-
});
|
|
195341
|
-
const toPull = name2 ? remoteFunctions.filter((f) => f.name === name2) : remoteFunctions;
|
|
195342
|
-
if (name2 && toPull.length === 0) {
|
|
195343
|
-
return {
|
|
195344
|
-
outroMessage: `Function "${name2}" not found on remote`
|
|
195345
|
-
};
|
|
195346
|
-
}
|
|
195347
|
-
if (toPull.length === 0) {
|
|
195348
|
-
return { outroMessage: "No functions found on remote" };
|
|
195349
|
-
}
|
|
195350
|
-
const { written, skipped } = await runTask("Writing function files", async () => {
|
|
195351
|
-
return await writeFunctions(functionsDir, toPull);
|
|
195352
|
-
}, {
|
|
195353
|
-
successMessage: "Function files written successfully",
|
|
195354
|
-
errorMessage: "Failed to write function files"
|
|
195355
|
-
});
|
|
195356
|
-
if (written.length > 0) {
|
|
195357
|
-
R2.success(`Written: ${written.join(", ")}`);
|
|
195358
|
-
}
|
|
195359
|
-
if (skipped.length > 0) {
|
|
195360
|
-
R2.info(`Skipped (unchanged): ${skipped.join(", ")}`);
|
|
195361
|
-
}
|
|
195362
|
-
return {
|
|
195363
|
-
outroMessage: `Pulled ${toPull.length} function${toPull.length !== 1 ? "s" : ""} to ${functionsDir}`
|
|
195364
|
-
};
|
|
195365
|
-
}
|
|
195366
|
-
function getPullCommand(context) {
|
|
195367
|
-
return new Command("pull").description("Pull deployed functions from Base44").argument("[name]", "Pull a single function by name").action(async (name2) => {
|
|
195368
|
-
await runCommand(() => pullFunctionsAction(name2), { requireAuth: true }, context);
|
|
195369
|
-
});
|
|
195370
|
-
}
|
|
195371
|
-
|
|
195372
195262
|
// src/cli/commands/functions/index.ts
|
|
195373
195263
|
function getFunctionsCommand(context) {
|
|
195374
|
-
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(
|
|
195264
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getListCommand(context)).addCommand(getDeleteCommand(context));
|
|
195375
195265
|
}
|
|
195376
195266
|
|
|
195377
195267
|
// src/cli/commands/project/create.ts
|
|
195378
|
-
import { basename as basename3, join as
|
|
195268
|
+
import { basename as basename3, join as join11, resolve as resolve2 } from "node:path";
|
|
195379
195269
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
195380
195270
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
195381
195271
|
async function getTemplateById(templateId) {
|
|
@@ -195511,7 +195401,7 @@ async function executeCreate({
|
|
|
195511
195401
|
updateMessage("Building project...");
|
|
195512
195402
|
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
195513
195403
|
updateMessage("Deploying site...");
|
|
195514
|
-
return await deploySite(
|
|
195404
|
+
return await deploySite(join11(resolvedPath, outputDirectory));
|
|
195515
195405
|
}, {
|
|
195516
195406
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
195517
195407
|
errorMessage: "Failed to deploy site"
|
|
@@ -195591,11 +195481,17 @@ ${summaryLines.join(`
|
|
|
195591
195481
|
${summaryLines.join(`
|
|
195592
195482
|
`)}`);
|
|
195593
195483
|
}
|
|
195594
|
-
|
|
195595
|
-
|
|
195596
|
-
|
|
195597
|
-
|
|
195598
|
-
|
|
195484
|
+
let functionCompleted = 0;
|
|
195485
|
+
const functionTotal = functions.length;
|
|
195486
|
+
const result = await deployAll(projectData, {
|
|
195487
|
+
onFunctionStart: (names) => {
|
|
195488
|
+
const label = names.length === 1 ? names[0] : `${names.length} functions`;
|
|
195489
|
+
R2.step(theme.styles.dim(`[${functionCompleted}/${functionTotal}] Deploying ${label}...`));
|
|
195490
|
+
},
|
|
195491
|
+
onFunctionResult: (r) => {
|
|
195492
|
+
functionCompleted++;
|
|
195493
|
+
formatDeployResult(r);
|
|
195494
|
+
}
|
|
195599
195495
|
});
|
|
195600
195496
|
const needsOAuth = filterPendingOAuth(result.connectorResults ?? []);
|
|
195601
195497
|
if (needsOAuth.length > 0) {
|
|
@@ -195912,10 +195808,10 @@ function toPascalCase(name2) {
|
|
|
195912
195808
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
195913
195809
|
}
|
|
195914
195810
|
// src/core/types/update-project.ts
|
|
195915
|
-
import { join as
|
|
195811
|
+
import { join as join14 } from "node:path";
|
|
195916
195812
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
195917
195813
|
async function updateProjectConfig(projectRoot) {
|
|
195918
|
-
const tsconfigPath =
|
|
195814
|
+
const tsconfigPath = join14(projectRoot, "tsconfig.json");
|
|
195919
195815
|
if (!await pathExists(tsconfigPath)) {
|
|
195920
195816
|
return false;
|
|
195921
195817
|
}
|
|
@@ -195958,7 +195854,7 @@ function getTypesCommand(context) {
|
|
|
195958
195854
|
}
|
|
195959
195855
|
|
|
195960
195856
|
// src/cli/commands/dev.ts
|
|
195961
|
-
import { dirname as
|
|
195857
|
+
import { dirname as dirname12, join as join16 } from "node:path";
|
|
195962
195858
|
|
|
195963
195859
|
// src/cli/dev/dev-server/main.ts
|
|
195964
195860
|
var import_cors = __toESM(require_lib4(), 1);
|
|
@@ -196106,10 +196002,10 @@ function createDevLogger() {
|
|
|
196106
196002
|
|
|
196107
196003
|
// src/cli/dev/dev-server/function-manager.ts
|
|
196108
196004
|
import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
|
|
196109
|
-
import { dirname as
|
|
196005
|
+
import { dirname as dirname11, join as join15 } from "node:path";
|
|
196110
196006
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
196111
|
-
var __dirname5 =
|
|
196112
|
-
var WRAPPER_PATH =
|
|
196007
|
+
var __dirname5 = dirname11(fileURLToPath7(import.meta.url));
|
|
196008
|
+
var WRAPPER_PATH = join15(__dirname5, "../deno-runtime/main.js");
|
|
196113
196009
|
var READY_TIMEOUT = 30000;
|
|
196114
196010
|
|
|
196115
196011
|
class FunctionManager {
|
|
@@ -196361,8 +196257,8 @@ async function devAction(options8) {
|
|
|
196361
196257
|
port,
|
|
196362
196258
|
loadResources: async () => {
|
|
196363
196259
|
const { project: project2 } = await readProjectConfig();
|
|
196364
|
-
const configDir =
|
|
196365
|
-
const functions = await functionResource.readAll(
|
|
196260
|
+
const configDir = dirname12(project2.configPath);
|
|
196261
|
+
const functions = await functionResource.readAll(join16(configDir, project2.functionsDir));
|
|
196366
196262
|
return { functions };
|
|
196367
196263
|
}
|
|
196368
196264
|
});
|
|
@@ -196527,7 +196423,7 @@ function nanoid3(size = 21) {
|
|
|
196527
196423
|
}
|
|
196528
196424
|
|
|
196529
196425
|
// node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
196530
|
-
import { dirname as
|
|
196426
|
+
import { dirname as dirname13, posix, sep } from "path";
|
|
196531
196427
|
function createModulerModifier() {
|
|
196532
196428
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
196533
196429
|
return async (frames) => {
|
|
@@ -196536,7 +196432,7 @@ function createModulerModifier() {
|
|
|
196536
196432
|
return frames;
|
|
196537
196433
|
};
|
|
196538
196434
|
}
|
|
196539
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
196435
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname13(process.argv[1]) : process.cwd(), isWindows4 = sep === "\\") {
|
|
196540
196436
|
const normalizedBase = isWindows4 ? normalizeWindowsPath2(basePath) : basePath;
|
|
196541
196437
|
return (filename) => {
|
|
196542
196438
|
if (!filename)
|
|
@@ -200753,4 +200649,4 @@ export {
|
|
|
200753
200649
|
CLIExitError
|
|
200754
200650
|
};
|
|
200755
200651
|
|
|
200756
|
-
//# debugId=
|
|
200652
|
+
//# debugId=DFA19B91985259E764756E2164756E21
|