@base44-preview/cli 0.0.33-pr.338.e51b50f → 0.0.33-pr.383.4cb51a6
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 +174 -165
- package/dist/cli/index.js.map +14 -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);
|
|
@@ -8915,10 +8933,10 @@ var require_ejs = __commonJS((exports) => {
|
|
|
8915
8933
|
exports.localsName = _DEFAULT_LOCALS_NAME;
|
|
8916
8934
|
exports.promiseImpl = new Function("return this;")().Promise;
|
|
8917
8935
|
exports.resolveInclude = function(name2, filename, isDir) {
|
|
8918
|
-
var
|
|
8936
|
+
var dirname7 = path11.dirname;
|
|
8919
8937
|
var extname = path11.extname;
|
|
8920
8938
|
var resolve = path11.resolve;
|
|
8921
|
-
var includePath = resolve(isDir ? filename :
|
|
8939
|
+
var includePath = resolve(isDir ? filename : dirname7(filename), name2);
|
|
8922
8940
|
var ext = extname(name2);
|
|
8923
8941
|
if (!ext) {
|
|
8924
8942
|
includePath += ".ejs";
|
|
@@ -116840,15 +116858,15 @@ var init_prettier = __esm(() => {
|
|
|
116840
116858
|
exports.removeDuplicateSlashes = removeDuplicateSlashes;
|
|
116841
116859
|
function partitionAbsoluteAndRelative(patterns) {
|
|
116842
116860
|
const absolute = [];
|
|
116843
|
-
const
|
|
116861
|
+
const relative22 = [];
|
|
116844
116862
|
for (const pattern of patterns) {
|
|
116845
116863
|
if (isAbsolute2(pattern)) {
|
|
116846
116864
|
absolute.push(pattern);
|
|
116847
116865
|
} else {
|
|
116848
|
-
|
|
116866
|
+
relative22.push(pattern);
|
|
116849
116867
|
}
|
|
116850
116868
|
}
|
|
116851
|
-
return [absolute,
|
|
116869
|
+
return [absolute, relative22];
|
|
116852
116870
|
}
|
|
116853
116871
|
exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
|
|
116854
116872
|
function isAbsolute2(pattern) {
|
|
@@ -131803,7 +131821,7 @@ var require_url = __commonJS((exports) => {
|
|
|
131803
131821
|
exports.fromFileSystemPath = fromFileSystemPath;
|
|
131804
131822
|
exports.toFileSystemPath = toFileSystemPath;
|
|
131805
131823
|
exports.safePointerToPath = safePointerToPath;
|
|
131806
|
-
exports.relative =
|
|
131824
|
+
exports.relative = relative4;
|
|
131807
131825
|
var convert_path_to_posix_1 = __importDefault(require_convert_path_to_posix());
|
|
131808
131826
|
var path_1 = __importStar(__require("path"));
|
|
131809
131827
|
var forwardSlashPattern = /\//g;
|
|
@@ -131953,7 +131971,7 @@ var require_url = __commonJS((exports) => {
|
|
|
131953
131971
|
return decodeURIComponent(value).replace(jsonPointerSlash, "/").replace(jsonPointerTilde, "~");
|
|
131954
131972
|
});
|
|
131955
131973
|
}
|
|
131956
|
-
function
|
|
131974
|
+
function relative4(from, to5) {
|
|
131957
131975
|
if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
|
|
131958
131976
|
return resolve5(from, to5);
|
|
131959
131977
|
}
|
|
@@ -138020,7 +138038,7 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
138020
138038
|
* Copyright(c) 2014-2018 Douglas Christopher Wilson
|
|
138021
138039
|
* MIT Licensed
|
|
138022
138040
|
*/
|
|
138023
|
-
var
|
|
138041
|
+
var relative4 = __require("path").relative;
|
|
138024
138042
|
module.exports = depd;
|
|
138025
138043
|
var basePath = process.cwd();
|
|
138026
138044
|
function containsNamespace(str, namespace) {
|
|
@@ -138216,7 +138234,7 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
138216
138234
|
return formatted;
|
|
138217
138235
|
}
|
|
138218
138236
|
function formatLocation(callSite) {
|
|
138219
|
-
return
|
|
138237
|
+
return relative4(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
|
|
138220
138238
|
}
|
|
138221
138239
|
function getStack() {
|
|
138222
138240
|
var limit = Error.stackTraceLimit;
|
|
@@ -155678,7 +155696,7 @@ 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 dirname12 = path18.dirname;
|
|
155682
155700
|
var basename4 = path18.basename;
|
|
155683
155701
|
var extname2 = path18.extname;
|
|
155684
155702
|
var join15 = path18.join;
|
|
@@ -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 = dirname12(loc);
|
|
155721
155739
|
var file2 = basename4(loc);
|
|
155722
155740
|
path19 = this.resolve(dir, file2);
|
|
155723
155741
|
}
|
|
@@ -161364,8 +161382,8 @@ var require_follow_redirects = __commonJS((exports, module) => {
|
|
|
161364
161382
|
}
|
|
161365
161383
|
return parsed;
|
|
161366
161384
|
}
|
|
161367
|
-
function resolveUrl(
|
|
161368
|
-
return useNativeURL ? new URL2(
|
|
161385
|
+
function resolveUrl(relative4, base) {
|
|
161386
|
+
return useNativeURL ? new URL2(relative4, base) : parseUrl(url3.resolve(base, relative4));
|
|
161369
161387
|
}
|
|
161370
161388
|
function validateUrl(input) {
|
|
161371
161389
|
if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
|
|
@@ -162834,7 +162852,7 @@ var {
|
|
|
162834
162852
|
} = import__.default;
|
|
162835
162853
|
|
|
162836
162854
|
// src/cli/commands/agents/pull.ts
|
|
162837
|
-
import { dirname as
|
|
162855
|
+
import { dirname as dirname8, 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);
|
|
@@ -178304,7 +178322,9 @@ import { fileURLToPath } from "node:url";
|
|
|
178304
178322
|
var PROJECT_SUBDIR = "base44";
|
|
178305
178323
|
var CONFIG_FILE_EXTENSION = "jsonc";
|
|
178306
178324
|
var CONFIG_FILE_EXTENSION_GLOB = "{json,jsonc}";
|
|
178307
|
-
var
|
|
178325
|
+
var FUNCTION_CONFIG_GLOB = `**/function.${CONFIG_FILE_EXTENSION_GLOB}`;
|
|
178326
|
+
var ENTRY_FILE_GLOB = "**/entry.{js,ts}";
|
|
178327
|
+
var ENTRY_IGNORE_DOT_PATHS = ["**/*.*/**"];
|
|
178308
178328
|
var APP_CONFIG_PATTERN = `**/.app.${CONFIG_FILE_EXTENSION_GLOB}`;
|
|
178309
178329
|
var PROJECT_CONFIG_PATTERNS = [
|
|
178310
178330
|
`${PROJECT_SUBDIR}/config.${CONFIG_FILE_EXTENSION_GLOB}`,
|
|
@@ -185309,7 +185329,7 @@ var generateGlobTasks = normalizeArguments(generateTasks);
|
|
|
185309
185329
|
var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
|
|
185310
185330
|
|
|
185311
185331
|
// src/core/project/config.ts
|
|
185312
|
-
import { dirname as
|
|
185332
|
+
import { dirname as dirname6, join as join6 } from "node:path";
|
|
185313
185333
|
|
|
185314
185334
|
// src/core/resources/agent/schema.ts
|
|
185315
185335
|
var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
|
|
@@ -186007,8 +186027,7 @@ var BackendFunctionSchema = FunctionConfigSchema.extend({
|
|
|
186007
186027
|
filePaths: exports_external.array(exports_external.string()).min(1, "Function must have at least one file")
|
|
186008
186028
|
});
|
|
186009
186029
|
var DeploySingleFunctionResponseSchema = exports_external.object({
|
|
186010
|
-
status: exports_external.enum(["deployed", "unchanged"])
|
|
186011
|
-
duration_ms: exports_external.number().optional().nullable()
|
|
186030
|
+
status: exports_external.enum(["deployed", "unchanged"])
|
|
186012
186031
|
});
|
|
186013
186032
|
var FunctionAutomationInfoSchema = exports_external.object({
|
|
186014
186033
|
name: exports_external.string(),
|
|
@@ -186064,7 +186083,7 @@ async function listDeployedFunctions() {
|
|
|
186064
186083
|
return result.data;
|
|
186065
186084
|
}
|
|
186066
186085
|
// src/core/resources/function/config.ts
|
|
186067
|
-
import { dirname as dirname4, join as join5 } from "node:path";
|
|
186086
|
+
import { basename as basename2, dirname as dirname4, join as join5, relative } from "node:path";
|
|
186068
186087
|
async function readFunctionConfig(configPath) {
|
|
186069
186088
|
const parsed = await readJsonFile(configPath);
|
|
186070
186089
|
const result = FunctionConfigSchema.safeParse(parsed);
|
|
@@ -186078,9 +186097,11 @@ async function readFunction(configPath) {
|
|
|
186078
186097
|
const functionDir = dirname4(configPath);
|
|
186079
186098
|
const entryPath = join5(functionDir, config5.entry);
|
|
186080
186099
|
if (!await pathExists(entryPath)) {
|
|
186081
|
-
throw new
|
|
186100
|
+
throw new InvalidInputError(`Function entry file not found: ${entryPath} (referenced in ${configPath})`, {
|
|
186101
|
+
hints: [{ message: "Check the 'entry' field in your function config" }]
|
|
186102
|
+
});
|
|
186082
186103
|
}
|
|
186083
|
-
const filePaths = await globby("
|
|
186104
|
+
const filePaths = await globby("**/*.{js,ts,json}", {
|
|
186084
186105
|
cwd: functionDir,
|
|
186085
186106
|
absolute: true
|
|
186086
186107
|
});
|
|
@@ -186091,38 +186112,78 @@ async function readAllFunctions(functionsDir) {
|
|
|
186091
186112
|
if (!await pathExists(functionsDir)) {
|
|
186092
186113
|
return [];
|
|
186093
186114
|
}
|
|
186094
|
-
const configFiles = await globby(
|
|
186115
|
+
const configFiles = await globby(FUNCTION_CONFIG_GLOB, {
|
|
186095
186116
|
cwd: functionsDir,
|
|
186096
186117
|
absolute: true
|
|
186097
186118
|
});
|
|
186098
|
-
const
|
|
186119
|
+
const entryFiles = await globby(ENTRY_FILE_GLOB, {
|
|
186120
|
+
cwd: functionsDir,
|
|
186121
|
+
absolute: true,
|
|
186122
|
+
ignore: ENTRY_IGNORE_DOT_PATHS
|
|
186123
|
+
});
|
|
186124
|
+
const configFilesDirs = new Set(configFiles.map((f) => dirname4(f)));
|
|
186125
|
+
const entryFilesWithoutConfig = entryFiles.filter((entryFile) => !configFilesDirs.has(dirname4(entryFile)));
|
|
186126
|
+
const functionsFromConfig = await Promise.all(configFiles.map((configPath) => readFunction(configPath)));
|
|
186127
|
+
const functionsWithoutConfig = await Promise.all(entryFilesWithoutConfig.map(async (entryFile) => {
|
|
186128
|
+
const functionDir = dirname4(entryFile);
|
|
186129
|
+
const filePaths = await globby("**/*.{js,ts,json}", {
|
|
186130
|
+
cwd: functionDir,
|
|
186131
|
+
absolute: true
|
|
186132
|
+
});
|
|
186133
|
+
const name2 = relative(functionsDir, functionDir).split(/[/\\]/).join("/");
|
|
186134
|
+
if (!name2) {
|
|
186135
|
+
throw new InvalidInputError("entry.ts found directly in the functions directory — it must be inside a named subfolder", {
|
|
186136
|
+
hints: [
|
|
186137
|
+
{
|
|
186138
|
+
message: `Move ${entryFile} into a subfolder (e.g. functions/myFunc/entry.ts)`
|
|
186139
|
+
}
|
|
186140
|
+
]
|
|
186141
|
+
});
|
|
186142
|
+
}
|
|
186143
|
+
const entry = basename2(entryFile);
|
|
186144
|
+
return { name: name2, entry, entryPath: entryFile, filePaths };
|
|
186145
|
+
}));
|
|
186146
|
+
const functions = [...functionsFromConfig, ...functionsWithoutConfig];
|
|
186099
186147
|
const names = new Set;
|
|
186100
186148
|
for (const fn of functions) {
|
|
186101
186149
|
if (names.has(fn.name)) {
|
|
186102
|
-
throw new
|
|
186150
|
+
throw new InvalidInputError(`Duplicate function name "${fn.name}"`, {
|
|
186151
|
+
hints: [
|
|
186152
|
+
{
|
|
186153
|
+
message: "Ensure each function has a unique name (or path for zero-config functions)."
|
|
186154
|
+
}
|
|
186155
|
+
]
|
|
186156
|
+
});
|
|
186103
186157
|
}
|
|
186104
186158
|
names.add(fn.name);
|
|
186105
186159
|
}
|
|
186106
186160
|
return functions;
|
|
186107
186161
|
}
|
|
186108
186162
|
// src/core/resources/function/deploy.ts
|
|
186109
|
-
import {
|
|
186163
|
+
import { dirname as dirname5, relative as relative2 } from "node:path";
|
|
186110
186164
|
async function loadFunctionCode(fn) {
|
|
186111
|
-
const
|
|
186165
|
+
const functionDir = dirname5(fn.entryPath);
|
|
186166
|
+
const resolvedFiles = await Promise.all(fn.filePaths.map(async (filePath) => {
|
|
186112
186167
|
const content = await readTextFile(filePath);
|
|
186113
|
-
|
|
186168
|
+
const path11 = relative2(functionDir, filePath).split(/[/\\]/).join("/");
|
|
186169
|
+
return { path: path11, content };
|
|
186114
186170
|
}));
|
|
186115
|
-
return { ...fn, files:
|
|
186171
|
+
return { ...fn, files: resolvedFiles };
|
|
186116
186172
|
}
|
|
186117
186173
|
async function deployOne(fn) {
|
|
186174
|
+
const start = Date.now();
|
|
186118
186175
|
try {
|
|
186119
|
-
const
|
|
186120
|
-
const
|
|
186121
|
-
entry:
|
|
186122
|
-
files:
|
|
186123
|
-
automations:
|
|
186176
|
+
const functionWithCode = await loadFunctionCode(fn);
|
|
186177
|
+
const response = await deploySingleFunction(functionWithCode.name, {
|
|
186178
|
+
entry: functionWithCode.entry,
|
|
186179
|
+
files: functionWithCode.files,
|
|
186180
|
+
automations: functionWithCode.automations
|
|
186124
186181
|
});
|
|
186125
|
-
return {
|
|
186182
|
+
return {
|
|
186183
|
+
name: functionWithCode.name,
|
|
186184
|
+
status: response.status,
|
|
186185
|
+
durationMs: Date.now() - start
|
|
186186
|
+
};
|
|
186126
186187
|
} catch (error48) {
|
|
186127
186188
|
return {
|
|
186128
186189
|
name: fn.name,
|
|
@@ -186131,7 +186192,7 @@ async function deployOne(fn) {
|
|
|
186131
186192
|
};
|
|
186132
186193
|
}
|
|
186133
186194
|
}
|
|
186134
|
-
async function
|
|
186195
|
+
async function deployFunctionsSequentially(functions, options) {
|
|
186135
186196
|
if (functions.length === 0)
|
|
186136
186197
|
return [];
|
|
186137
186198
|
const results = [];
|
|
@@ -186165,7 +186226,7 @@ async function pruneRemovedFunctions(localFunctionNames) {
|
|
|
186165
186226
|
// src/core/resources/function/resource.ts
|
|
186166
186227
|
var functionResource = {
|
|
186167
186228
|
readAll: readAllFunctions,
|
|
186168
|
-
push: (functions) =>
|
|
186229
|
+
push: (functions) => deployFunctionsSequentially(functions)
|
|
186169
186230
|
};
|
|
186170
186231
|
// src/core/project/config.ts
|
|
186171
186232
|
async function findConfigInDir(dir) {
|
|
@@ -186177,12 +186238,12 @@ async function findConfigInDir(dir) {
|
|
|
186177
186238
|
}
|
|
186178
186239
|
async function findProjectRoot(startPath) {
|
|
186179
186240
|
let current = startPath || process.cwd();
|
|
186180
|
-
while (current !==
|
|
186241
|
+
while (current !== dirname6(current)) {
|
|
186181
186242
|
const configPath = await findConfigInDir(current);
|
|
186182
186243
|
if (configPath) {
|
|
186183
186244
|
return { root: current, configPath };
|
|
186184
186245
|
}
|
|
186185
|
-
current =
|
|
186246
|
+
current = dirname6(current);
|
|
186186
186247
|
}
|
|
186187
186248
|
return null;
|
|
186188
186249
|
}
|
|
@@ -186204,7 +186265,7 @@ async function readProjectConfig(projectRoot) {
|
|
|
186204
186265
|
throw new SchemaValidationError("Invalid project configuration", result.error, configPath);
|
|
186205
186266
|
}
|
|
186206
186267
|
const project = result.data;
|
|
186207
|
-
const configDir =
|
|
186268
|
+
const configDir = dirname6(configPath);
|
|
186208
186269
|
const [entities, functions, agents, connectors] = await Promise.all([
|
|
186209
186270
|
entityResource.readAll(join6(configDir, project.entitiesDir)),
|
|
186210
186271
|
functionResource.readAll(join6(configDir, project.functionsDir)),
|
|
@@ -186306,7 +186367,7 @@ async function readAppConfig(projectRoot) {
|
|
|
186306
186367
|
// src/core/project/template.ts
|
|
186307
186368
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
186308
186369
|
var import_front_matter = __toESM(require_front_matter(), 1);
|
|
186309
|
-
import { dirname as
|
|
186370
|
+
import { dirname as dirname7, join as join7 } from "node:path";
|
|
186310
186371
|
async function listTemplates() {
|
|
186311
186372
|
const parsed = await readJsonFile(getTemplatesIndexPath());
|
|
186312
186373
|
const result = TemplatesConfigSchema.safeParse(parsed);
|
|
@@ -186328,7 +186389,7 @@ async function renderTemplate(template, destPath, data) {
|
|
|
186328
186389
|
if (file2.endsWith(".ejs")) {
|
|
186329
186390
|
const rendered = await import_ejs.default.renderFile(srcPath, data);
|
|
186330
186391
|
const { attributes, body } = import_front_matter.default(rendered);
|
|
186331
|
-
const destFile = attributes.outputFileName ? join7(
|
|
186392
|
+
const destFile = attributes.outputFileName ? join7(dirname7(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
|
|
186332
186393
|
const destFilePath = join7(destPath, destFile);
|
|
186333
186394
|
await writeFile(destFilePath, body);
|
|
186334
186395
|
} else {
|
|
@@ -186477,13 +186538,10 @@ function hasResourcesToDeploy(projectData) {
|
|
|
186477
186538
|
const hasConnectors = connectors.length > 0;
|
|
186478
186539
|
return hasEntities || hasFunctions || hasAgents || hasConnectors || hasSite;
|
|
186479
186540
|
}
|
|
186480
|
-
async function deployAll(projectData
|
|
186541
|
+
async function deployAll(projectData) {
|
|
186481
186542
|
const { project, entities, functions, agents, connectors } = projectData;
|
|
186482
186543
|
await entityResource.push(entities);
|
|
186483
|
-
await
|
|
186484
|
-
onStart: options?.onFunctionStart,
|
|
186485
|
-
onResult: options?.onFunctionResult
|
|
186486
|
-
});
|
|
186544
|
+
await functionResource.push(functions);
|
|
186487
186545
|
await agentResource.push(agents);
|
|
186488
186546
|
const { results: connectorResults } = await pushConnectors(connectors);
|
|
186489
186547
|
if (project.site?.outputDirectory) {
|
|
@@ -194135,7 +194193,7 @@ function getDashboardUrl(projectId) {
|
|
|
194135
194193
|
// src/cli/commands/agents/pull.ts
|
|
194136
194194
|
async function pullAgentsAction() {
|
|
194137
194195
|
const { project: project2 } = await readProjectConfig();
|
|
194138
|
-
const configDir =
|
|
194196
|
+
const configDir = dirname8(project2.configPath);
|
|
194139
194197
|
const agentsDir = join9(configDir, project2.agentsDir);
|
|
194140
194198
|
const remoteAgents = await runTask("Fetching agents from Base44", async () => {
|
|
194141
194199
|
return await fetchAgents();
|
|
@@ -194230,10 +194288,10 @@ function getWhoamiCommand(context) {
|
|
|
194230
194288
|
}
|
|
194231
194289
|
|
|
194232
194290
|
// src/cli/commands/connectors/pull.ts
|
|
194233
|
-
import { dirname as
|
|
194291
|
+
import { dirname as dirname9, join as join10 } from "node:path";
|
|
194234
194292
|
async function pullConnectorsAction() {
|
|
194235
194293
|
const { project: project2 } = await readProjectConfig();
|
|
194236
|
-
const configDir =
|
|
194294
|
+
const configDir = dirname9(project2.configPath);
|
|
194237
194295
|
const connectorsDir = join10(configDir, project2.connectorsDir);
|
|
194238
194296
|
const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
|
|
194239
194297
|
return await listConnectors();
|
|
@@ -195082,91 +195140,66 @@ function getEntitiesPushCommand(context) {
|
|
|
195082
195140
|
}));
|
|
195083
195141
|
}
|
|
195084
195142
|
|
|
195085
|
-
// src/cli/utils/parseNames.ts
|
|
195086
|
-
function parseNames(args) {
|
|
195087
|
-
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
195088
|
-
}
|
|
195089
|
-
|
|
195090
|
-
// src/cli/commands/functions/delete.ts
|
|
195091
|
-
async function deleteFunctionsAction(names) {
|
|
195092
|
-
let deleted = 0;
|
|
195093
|
-
let notFound = 0;
|
|
195094
|
-
let errors4 = 0;
|
|
195095
|
-
for (const name2 of names) {
|
|
195096
|
-
try {
|
|
195097
|
-
await deleteSingleFunction(name2);
|
|
195098
|
-
R2.success(`${name2} deleted`);
|
|
195099
|
-
deleted++;
|
|
195100
|
-
} catch (error48) {
|
|
195101
|
-
if (error48 instanceof ApiError && error48.statusCode === 404) {
|
|
195102
|
-
R2.warn(`Function "${name2}" not found on remote`);
|
|
195103
|
-
notFound++;
|
|
195104
|
-
} else {
|
|
195105
|
-
R2.error(`${name2} error: ${error48 instanceof Error ? error48.message : String(error48)}`);
|
|
195106
|
-
errors4++;
|
|
195107
|
-
}
|
|
195108
|
-
}
|
|
195109
|
-
}
|
|
195110
|
-
if (names.length === 1) {
|
|
195111
|
-
if (deleted)
|
|
195112
|
-
return { outroMessage: `Function "${names[0]}" deleted` };
|
|
195113
|
-
if (notFound)
|
|
195114
|
-
return { outroMessage: `Function "${names[0]}" not found` };
|
|
195115
|
-
return { outroMessage: `Failed to delete "${names[0]}"` };
|
|
195116
|
-
}
|
|
195117
|
-
const parts = [];
|
|
195118
|
-
if (deleted > 0)
|
|
195119
|
-
parts.push(`${deleted} deleted`);
|
|
195120
|
-
if (notFound > 0)
|
|
195121
|
-
parts.push(`${notFound} not found`);
|
|
195122
|
-
if (errors4 > 0)
|
|
195123
|
-
parts.push(`${errors4} error${errors4 !== 1 ? "s" : ""}`);
|
|
195124
|
-
return { outroMessage: parts.join(", ") };
|
|
195125
|
-
}
|
|
195126
|
-
function getDeleteCommand(context) {
|
|
195127
|
-
return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").action(async (rawNames) => {
|
|
195128
|
-
await runCommand(() => {
|
|
195129
|
-
const names = parseNames(rawNames);
|
|
195130
|
-
if (names.length === 0) {
|
|
195131
|
-
throw new InvalidInputError("At least one function name is required");
|
|
195132
|
-
}
|
|
195133
|
-
return deleteFunctionsAction(names);
|
|
195134
|
-
}, { requireAuth: true }, context);
|
|
195135
|
-
});
|
|
195136
|
-
}
|
|
195137
|
-
|
|
195138
195143
|
// src/cli/utils/formatDeployResult.ts
|
|
195139
195144
|
function formatDuration(ms) {
|
|
195140
195145
|
return `${(ms / 1000).toFixed(1)}s`;
|
|
195141
195146
|
}
|
|
195142
|
-
function formatDeployResult(
|
|
195143
|
-
const label =
|
|
195144
|
-
if (
|
|
195145
|
-
const timing =
|
|
195147
|
+
function formatDeployResult(result) {
|
|
195148
|
+
const label = result.name.padEnd(25);
|
|
195149
|
+
if (result.status === "deployed") {
|
|
195150
|
+
const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
|
|
195146
195151
|
R2.success(`${label} deployed${timing}`);
|
|
195147
|
-
} else if (
|
|
195152
|
+
} else if (result.status === "unchanged") {
|
|
195148
195153
|
R2.success(`${label} unchanged`);
|
|
195149
195154
|
} else {
|
|
195150
|
-
R2.error(`${label} error: ${
|
|
195155
|
+
R2.error(`${label} error: ${result.error}`);
|
|
195151
195156
|
}
|
|
195152
195157
|
}
|
|
195153
195158
|
|
|
195159
|
+
// src/cli/utils/parseNames.ts
|
|
195160
|
+
function parseNames(args) {
|
|
195161
|
+
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
195162
|
+
}
|
|
195163
|
+
|
|
195154
195164
|
// src/cli/commands/functions/deploy.ts
|
|
195165
|
+
function resolveFunctionsToDeploy(names, allFunctions) {
|
|
195166
|
+
if (names.length === 0)
|
|
195167
|
+
return allFunctions;
|
|
195168
|
+
const notFound = names.filter((n2) => !allFunctions.some((f) => f.name === n2));
|
|
195169
|
+
if (notFound.length > 0) {
|
|
195170
|
+
throw new InvalidInputError(`Function${notFound.length > 1 ? "s" : ""} not found in project: ${notFound.join(", ")}`);
|
|
195171
|
+
}
|
|
195172
|
+
return allFunctions.filter((f) => names.includes(f.name));
|
|
195173
|
+
}
|
|
195174
|
+
function formatPruneResults(pruneResults) {
|
|
195175
|
+
for (const pruneResult of pruneResults) {
|
|
195176
|
+
if (pruneResult.deleted) {
|
|
195177
|
+
R2.success(`${pruneResult.name.padEnd(25)} deleted`);
|
|
195178
|
+
} else {
|
|
195179
|
+
R2.error(`${pruneResult.name.padEnd(25)} error: ${pruneResult.error}`);
|
|
195180
|
+
}
|
|
195181
|
+
}
|
|
195182
|
+
if (pruneResults.length > 0) {
|
|
195183
|
+
const pruned = pruneResults.filter((r) => r.deleted).length;
|
|
195184
|
+
R2.info(`${pruned} function${pruned !== 1 ? "s" : ""} removed`);
|
|
195185
|
+
}
|
|
195186
|
+
}
|
|
195187
|
+
function buildDeploySummary(results) {
|
|
195188
|
+
const deployed = results.filter((r) => r.status !== "error").length;
|
|
195189
|
+
const failed = results.filter((r) => r.status === "error").length;
|
|
195190
|
+
const parts = [];
|
|
195191
|
+
if (deployed > 0)
|
|
195192
|
+
parts.push(`${deployed}/${results.length} deployed`);
|
|
195193
|
+
if (failed > 0)
|
|
195194
|
+
parts.push(`${failed} error${failed !== 1 ? "s" : ""}`);
|
|
195195
|
+
return parts.join(", ") || "No functions deployed";
|
|
195196
|
+
}
|
|
195155
195197
|
async function deployFunctionsAction(names, options) {
|
|
195156
195198
|
if (options.force && names.length > 0) {
|
|
195157
195199
|
throw new InvalidInputError("--force cannot be used when specifying function names");
|
|
195158
195200
|
}
|
|
195159
195201
|
const { functions } = await readProjectConfig();
|
|
195160
|
-
|
|
195161
|
-
if (names.length > 0) {
|
|
195162
|
-
const notFound = names.filter((n2) => !functions.some((f) => f.name === n2));
|
|
195163
|
-
if (notFound.length > 0) {
|
|
195164
|
-
throw new InvalidInputError(`Function${notFound.length > 1 ? "s" : ""} not found in project: ${notFound.join(", ")}`);
|
|
195165
|
-
}
|
|
195166
|
-
toDeploy = functions.filter((f) => names.includes(f.name));
|
|
195167
|
-
} else {
|
|
195168
|
-
toDeploy = functions;
|
|
195169
|
-
}
|
|
195202
|
+
const toDeploy = resolveFunctionsToDeploy(names, functions);
|
|
195170
195203
|
if (toDeploy.length === 0) {
|
|
195171
195204
|
return {
|
|
195172
195205
|
outroMessage: "No functions found. Create functions in the 'functions' directory."
|
|
@@ -195175,41 +195208,23 @@ async function deployFunctionsAction(names, options) {
|
|
|
195175
195208
|
R2.info(`Found ${toDeploy.length} ${toDeploy.length === 1 ? "function" : "functions"} to deploy`);
|
|
195176
195209
|
let completed = 0;
|
|
195177
195210
|
const total = toDeploy.length;
|
|
195178
|
-
const results = await
|
|
195211
|
+
const results = await deployFunctionsSequentially(toDeploy, {
|
|
195179
195212
|
onStart: (startNames) => {
|
|
195180
195213
|
const label = startNames.length === 1 ? startNames[0] : `${startNames.length} functions`;
|
|
195181
|
-
R2.step(theme.styles.dim(`[${completed}/${total}] Deploying ${label}...`));
|
|
195214
|
+
R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deploying ${label}...`));
|
|
195182
195215
|
},
|
|
195183
|
-
onResult: (
|
|
195216
|
+
onResult: (result) => {
|
|
195184
195217
|
completed++;
|
|
195185
|
-
formatDeployResult(
|
|
195218
|
+
formatDeployResult(result);
|
|
195186
195219
|
}
|
|
195187
195220
|
});
|
|
195188
|
-
const succeeded = results.filter((r) => r.status !== "error").length;
|
|
195189
|
-
const failed = results.filter((r) => r.status === "error").length;
|
|
195190
195221
|
if (options.force) {
|
|
195191
195222
|
R2.info("Removing remote functions not found locally...");
|
|
195192
195223
|
const allLocalNames = functions.map((f) => f.name);
|
|
195193
195224
|
const pruneResults = await pruneRemovedFunctions(allLocalNames);
|
|
195194
|
-
|
|
195195
|
-
if (pr.deleted) {
|
|
195196
|
-
R2.success(`${pr.name.padEnd(25)} deleted`);
|
|
195197
|
-
} else {
|
|
195198
|
-
R2.error(`${pr.name.padEnd(25)} error: ${pr.error}`);
|
|
195199
|
-
}
|
|
195200
|
-
}
|
|
195201
|
-
if (pruneResults.length > 0) {
|
|
195202
|
-
const pruned = pruneResults.filter((r) => r.deleted).length;
|
|
195203
|
-
R2.info(`${pruned} function${pruned !== 1 ? "s" : ""} removed`);
|
|
195204
|
-
}
|
|
195225
|
+
formatPruneResults(pruneResults);
|
|
195205
195226
|
}
|
|
195206
|
-
|
|
195207
|
-
if (succeeded > 0)
|
|
195208
|
-
parts.push(`${succeeded}/${results.length} succeeded`);
|
|
195209
|
-
if (failed > 0)
|
|
195210
|
-
parts.push(`${failed} error${failed !== 1 ? "s" : ""}`);
|
|
195211
|
-
const summary = parts.join(", ") || "No functions deployed";
|
|
195212
|
-
return { outroMessage: summary };
|
|
195227
|
+
return { outroMessage: buildDeploySummary(results) };
|
|
195213
195228
|
}
|
|
195214
195229
|
function getDeployCommand(context) {
|
|
195215
195230
|
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) => {
|
|
@@ -195224,7 +195239,7 @@ function getDeployCommand(context) {
|
|
|
195224
195239
|
async function listFunctionsAction() {
|
|
195225
195240
|
const { functions } = await listDeployedFunctions();
|
|
195226
195241
|
if (functions.length === 0) {
|
|
195227
|
-
return { outroMessage: "No functions
|
|
195242
|
+
return { outroMessage: "No functions on remote" };
|
|
195228
195243
|
}
|
|
195229
195244
|
for (const fn of functions) {
|
|
195230
195245
|
const autoCount = fn.automations.length;
|
|
@@ -195232,7 +195247,7 @@ async function listFunctionsAction() {
|
|
|
195232
195247
|
R2.message(` ${fn.name}${autoLabel}`);
|
|
195233
195248
|
}
|
|
195234
195249
|
return {
|
|
195235
|
-
outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""}
|
|
195250
|
+
outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
|
|
195236
195251
|
};
|
|
195237
195252
|
}
|
|
195238
195253
|
function getListCommand(context) {
|
|
@@ -195243,7 +195258,7 @@ function getListCommand(context) {
|
|
|
195243
195258
|
|
|
195244
195259
|
// src/cli/commands/functions/index.ts
|
|
195245
195260
|
function getFunctionsCommand(context) {
|
|
195246
|
-
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getListCommand(context))
|
|
195261
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getListCommand(context));
|
|
195247
195262
|
}
|
|
195248
195263
|
|
|
195249
195264
|
// src/cli/commands/project/create.ts
|
|
@@ -195463,17 +195478,11 @@ ${summaryLines.join(`
|
|
|
195463
195478
|
${summaryLines.join(`
|
|
195464
195479
|
`)}`);
|
|
195465
195480
|
}
|
|
195466
|
-
|
|
195467
|
-
|
|
195468
|
-
|
|
195469
|
-
|
|
195470
|
-
|
|
195471
|
-
R2.step(theme.styles.dim(`[${functionCompleted}/${functionTotal}] Deploying ${label}...`));
|
|
195472
|
-
},
|
|
195473
|
-
onFunctionResult: (r) => {
|
|
195474
|
-
functionCompleted++;
|
|
195475
|
-
formatDeployResult(r);
|
|
195476
|
-
}
|
|
195481
|
+
const result = await runTask("Deploying your app...", async () => {
|
|
195482
|
+
return await deployAll(projectData);
|
|
195483
|
+
}, {
|
|
195484
|
+
successMessage: theme.colors.base44Orange("Deployment completed"),
|
|
195485
|
+
errorMessage: "Deployment failed"
|
|
195477
195486
|
});
|
|
195478
195487
|
const needsOAuth = filterPendingOAuth(result.connectorResults ?? []);
|
|
195479
195488
|
if (needsOAuth.length > 0) {
|
|
@@ -195836,7 +195845,7 @@ function getTypesCommand(context) {
|
|
|
195836
195845
|
}
|
|
195837
195846
|
|
|
195838
195847
|
// src/cli/commands/dev.ts
|
|
195839
|
-
import { dirname as
|
|
195848
|
+
import { dirname as dirname13, join as join16 } from "node:path";
|
|
195840
195849
|
|
|
195841
195850
|
// src/cli/dev/dev-server/main.ts
|
|
195842
195851
|
var import_cors = __toESM(require_lib4(), 1);
|
|
@@ -195984,9 +195993,9 @@ function createDevLogger() {
|
|
|
195984
195993
|
|
|
195985
195994
|
// src/cli/dev/dev-server/function-manager.ts
|
|
195986
195995
|
import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
|
|
195987
|
-
import { dirname as
|
|
195996
|
+
import { dirname as dirname12, join as join15 } from "node:path";
|
|
195988
195997
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
195989
|
-
var __dirname5 =
|
|
195998
|
+
var __dirname5 = dirname12(fileURLToPath7(import.meta.url));
|
|
195990
195999
|
var WRAPPER_PATH = join15(__dirname5, "../deno-runtime/main.js");
|
|
195991
196000
|
var READY_TIMEOUT = 30000;
|
|
195992
196001
|
|
|
@@ -196239,7 +196248,7 @@ async function devAction(options8) {
|
|
|
196239
196248
|
port,
|
|
196240
196249
|
loadResources: async () => {
|
|
196241
196250
|
const { project: project2 } = await readProjectConfig();
|
|
196242
|
-
const configDir =
|
|
196251
|
+
const configDir = dirname13(project2.configPath);
|
|
196243
196252
|
const functions = await functionResource.readAll(join16(configDir, project2.functionsDir));
|
|
196244
196253
|
return { functions };
|
|
196245
196254
|
}
|
|
@@ -196405,7 +196414,7 @@ function nanoid3(size = 21) {
|
|
|
196405
196414
|
}
|
|
196406
196415
|
|
|
196407
196416
|
// node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
196408
|
-
import { dirname as
|
|
196417
|
+
import { dirname as dirname14, posix, sep } from "path";
|
|
196409
196418
|
function createModulerModifier() {
|
|
196410
196419
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
196411
196420
|
return async (frames) => {
|
|
@@ -196414,7 +196423,7 @@ function createModulerModifier() {
|
|
|
196414
196423
|
return frames;
|
|
196415
196424
|
};
|
|
196416
196425
|
}
|
|
196417
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
196426
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname14(process.argv[1]) : process.cwd(), isWindows4 = sep === "\\") {
|
|
196418
196427
|
const normalizedBase = isWindows4 ? normalizeWindowsPath2(basePath) : basePath;
|
|
196419
196428
|
return (filename) => {
|
|
196420
196429
|
if (!filename)
|
|
@@ -200631,4 +200640,4 @@ export {
|
|
|
200631
200640
|
CLIExitError
|
|
200632
200641
|
};
|
|
200633
200642
|
|
|
200634
|
-
//# debugId=
|
|
200643
|
+
//# debugId=B3EC239F04F3A3D564756E2164756E21
|