@base44-preview/cli 0.0.33-pr.338.e51b50f → 0.0.33-pr.384.14f67f4
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 +169 -151
- 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 {
|
|
@@ -186480,7 +186541,7 @@ function hasResourcesToDeploy(projectData) {
|
|
|
186480
186541
|
async function deployAll(projectData, options) {
|
|
186481
186542
|
const { project, entities, functions, agents, connectors } = projectData;
|
|
186482
186543
|
await entityResource.push(entities);
|
|
186483
|
-
await
|
|
186544
|
+
await deployFunctionsSequentially(functions, {
|
|
186484
186545
|
onStart: options?.onFunctionStart,
|
|
186485
186546
|
onResult: options?.onFunctionResult
|
|
186486
186547
|
});
|
|
@@ -194135,7 +194196,7 @@ function getDashboardUrl(projectId) {
|
|
|
194135
194196
|
// src/cli/commands/agents/pull.ts
|
|
194136
194197
|
async function pullAgentsAction() {
|
|
194137
194198
|
const { project: project2 } = await readProjectConfig();
|
|
194138
|
-
const configDir =
|
|
194199
|
+
const configDir = dirname8(project2.configPath);
|
|
194139
194200
|
const agentsDir = join9(configDir, project2.agentsDir);
|
|
194140
194201
|
const remoteAgents = await runTask("Fetching agents from Base44", async () => {
|
|
194141
194202
|
return await fetchAgents();
|
|
@@ -194230,10 +194291,10 @@ function getWhoamiCommand(context) {
|
|
|
194230
194291
|
}
|
|
194231
194292
|
|
|
194232
194293
|
// src/cli/commands/connectors/pull.ts
|
|
194233
|
-
import { dirname as
|
|
194294
|
+
import { dirname as dirname9, join as join10 } from "node:path";
|
|
194234
194295
|
async function pullConnectorsAction() {
|
|
194235
194296
|
const { project: project2 } = await readProjectConfig();
|
|
194236
|
-
const configDir =
|
|
194297
|
+
const configDir = dirname9(project2.configPath);
|
|
194237
194298
|
const connectorsDir = join10(configDir, project2.connectorsDir);
|
|
194238
194299
|
const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
|
|
194239
194300
|
return await listConnectors();
|
|
@@ -195082,91 +195143,66 @@ function getEntitiesPushCommand(context) {
|
|
|
195082
195143
|
}));
|
|
195083
195144
|
}
|
|
195084
195145
|
|
|
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
195146
|
// src/cli/utils/formatDeployResult.ts
|
|
195139
195147
|
function formatDuration(ms) {
|
|
195140
195148
|
return `${(ms / 1000).toFixed(1)}s`;
|
|
195141
195149
|
}
|
|
195142
|
-
function formatDeployResult(
|
|
195143
|
-
const label =
|
|
195144
|
-
if (
|
|
195145
|
-
const timing =
|
|
195150
|
+
function formatDeployResult(result) {
|
|
195151
|
+
const label = result.name.padEnd(25);
|
|
195152
|
+
if (result.status === "deployed") {
|
|
195153
|
+
const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
|
|
195146
195154
|
R2.success(`${label} deployed${timing}`);
|
|
195147
|
-
} else if (
|
|
195155
|
+
} else if (result.status === "unchanged") {
|
|
195148
195156
|
R2.success(`${label} unchanged`);
|
|
195149
195157
|
} else {
|
|
195150
|
-
R2.error(`${label} error: ${
|
|
195158
|
+
R2.error(`${label} error: ${result.error}`);
|
|
195151
195159
|
}
|
|
195152
195160
|
}
|
|
195153
195161
|
|
|
195162
|
+
// src/cli/utils/parseNames.ts
|
|
195163
|
+
function parseNames(args) {
|
|
195164
|
+
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
195165
|
+
}
|
|
195166
|
+
|
|
195154
195167
|
// src/cli/commands/functions/deploy.ts
|
|
195168
|
+
function resolveFunctionsToDeploy(names, allFunctions) {
|
|
195169
|
+
if (names.length === 0)
|
|
195170
|
+
return allFunctions;
|
|
195171
|
+
const notFound = names.filter((n2) => !allFunctions.some((f) => f.name === n2));
|
|
195172
|
+
if (notFound.length > 0) {
|
|
195173
|
+
throw new InvalidInputError(`Function${notFound.length > 1 ? "s" : ""} not found in project: ${notFound.join(", ")}`);
|
|
195174
|
+
}
|
|
195175
|
+
return allFunctions.filter((f) => names.includes(f.name));
|
|
195176
|
+
}
|
|
195177
|
+
function formatPruneResults(pruneResults) {
|
|
195178
|
+
for (const pruneResult of pruneResults) {
|
|
195179
|
+
if (pruneResult.deleted) {
|
|
195180
|
+
R2.success(`${pruneResult.name.padEnd(25)} deleted`);
|
|
195181
|
+
} else {
|
|
195182
|
+
R2.error(`${pruneResult.name.padEnd(25)} error: ${pruneResult.error}`);
|
|
195183
|
+
}
|
|
195184
|
+
}
|
|
195185
|
+
if (pruneResults.length > 0) {
|
|
195186
|
+
const pruned = pruneResults.filter((r) => r.deleted).length;
|
|
195187
|
+
R2.info(`${pruned} function${pruned !== 1 ? "s" : ""} removed`);
|
|
195188
|
+
}
|
|
195189
|
+
}
|
|
195190
|
+
function buildDeploySummary(results) {
|
|
195191
|
+
const deployed = results.filter((r) => r.status !== "error").length;
|
|
195192
|
+
const failed = results.filter((r) => r.status === "error").length;
|
|
195193
|
+
const parts = [];
|
|
195194
|
+
if (deployed > 0)
|
|
195195
|
+
parts.push(`${deployed}/${results.length} deployed`);
|
|
195196
|
+
if (failed > 0)
|
|
195197
|
+
parts.push(`${failed} error${failed !== 1 ? "s" : ""}`);
|
|
195198
|
+
return parts.join(", ") || "No functions deployed";
|
|
195199
|
+
}
|
|
195155
195200
|
async function deployFunctionsAction(names, options) {
|
|
195156
195201
|
if (options.force && names.length > 0) {
|
|
195157
195202
|
throw new InvalidInputError("--force cannot be used when specifying function names");
|
|
195158
195203
|
}
|
|
195159
195204
|
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
|
-
}
|
|
195205
|
+
const toDeploy = resolveFunctionsToDeploy(names, functions);
|
|
195170
195206
|
if (toDeploy.length === 0) {
|
|
195171
195207
|
return {
|
|
195172
195208
|
outroMessage: "No functions found. Create functions in the 'functions' directory."
|
|
@@ -195175,41 +195211,23 @@ async function deployFunctionsAction(names, options) {
|
|
|
195175
195211
|
R2.info(`Found ${toDeploy.length} ${toDeploy.length === 1 ? "function" : "functions"} to deploy`);
|
|
195176
195212
|
let completed = 0;
|
|
195177
195213
|
const total = toDeploy.length;
|
|
195178
|
-
const results = await
|
|
195214
|
+
const results = await deployFunctionsSequentially(toDeploy, {
|
|
195179
195215
|
onStart: (startNames) => {
|
|
195180
195216
|
const label = startNames.length === 1 ? startNames[0] : `${startNames.length} functions`;
|
|
195181
|
-
R2.step(theme.styles.dim(`[${completed}/${total}] Deploying ${label}...`));
|
|
195217
|
+
R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deploying ${label}...`));
|
|
195182
195218
|
},
|
|
195183
|
-
onResult: (
|
|
195219
|
+
onResult: (result) => {
|
|
195184
195220
|
completed++;
|
|
195185
|
-
formatDeployResult(
|
|
195221
|
+
formatDeployResult(result);
|
|
195186
195222
|
}
|
|
195187
195223
|
});
|
|
195188
|
-
const succeeded = results.filter((r) => r.status !== "error").length;
|
|
195189
|
-
const failed = results.filter((r) => r.status === "error").length;
|
|
195190
195224
|
if (options.force) {
|
|
195191
195225
|
R2.info("Removing remote functions not found locally...");
|
|
195192
195226
|
const allLocalNames = functions.map((f) => f.name);
|
|
195193
195227
|
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
|
-
}
|
|
195228
|
+
formatPruneResults(pruneResults);
|
|
195205
195229
|
}
|
|
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 };
|
|
195230
|
+
return { outroMessage: buildDeploySummary(results) };
|
|
195213
195231
|
}
|
|
195214
195232
|
function getDeployCommand(context) {
|
|
195215
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) => {
|
|
@@ -195224,7 +195242,7 @@ function getDeployCommand(context) {
|
|
|
195224
195242
|
async function listFunctionsAction() {
|
|
195225
195243
|
const { functions } = await listDeployedFunctions();
|
|
195226
195244
|
if (functions.length === 0) {
|
|
195227
|
-
return { outroMessage: "No functions
|
|
195245
|
+
return { outroMessage: "No functions on remote" };
|
|
195228
195246
|
}
|
|
195229
195247
|
for (const fn of functions) {
|
|
195230
195248
|
const autoCount = fn.automations.length;
|
|
@@ -195232,7 +195250,7 @@ async function listFunctionsAction() {
|
|
|
195232
195250
|
R2.message(` ${fn.name}${autoLabel}`);
|
|
195233
195251
|
}
|
|
195234
195252
|
return {
|
|
195235
|
-
outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""}
|
|
195253
|
+
outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
|
|
195236
195254
|
};
|
|
195237
195255
|
}
|
|
195238
195256
|
function getListCommand(context) {
|
|
@@ -195243,7 +195261,7 @@ function getListCommand(context) {
|
|
|
195243
195261
|
|
|
195244
195262
|
// src/cli/commands/functions/index.ts
|
|
195245
195263
|
function getFunctionsCommand(context) {
|
|
195246
|
-
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getListCommand(context))
|
|
195264
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getListCommand(context));
|
|
195247
195265
|
}
|
|
195248
195266
|
|
|
195249
195267
|
// src/cli/commands/project/create.ts
|
|
@@ -195468,7 +195486,7 @@ ${summaryLines.join(`
|
|
|
195468
195486
|
const result = await deployAll(projectData, {
|
|
195469
195487
|
onFunctionStart: (names) => {
|
|
195470
195488
|
const label = names.length === 1 ? names[0] : `${names.length} functions`;
|
|
195471
|
-
R2.step(theme.styles.dim(`[${functionCompleted}/${functionTotal}] Deploying ${label}...`));
|
|
195489
|
+
R2.step(theme.styles.dim(`[${functionCompleted + 1}/${functionTotal}] Deploying ${label}...`));
|
|
195472
195490
|
},
|
|
195473
195491
|
onFunctionResult: (r) => {
|
|
195474
195492
|
functionCompleted++;
|
|
@@ -195836,7 +195854,7 @@ function getTypesCommand(context) {
|
|
|
195836
195854
|
}
|
|
195837
195855
|
|
|
195838
195856
|
// src/cli/commands/dev.ts
|
|
195839
|
-
import { dirname as
|
|
195857
|
+
import { dirname as dirname13, join as join16 } from "node:path";
|
|
195840
195858
|
|
|
195841
195859
|
// src/cli/dev/dev-server/main.ts
|
|
195842
195860
|
var import_cors = __toESM(require_lib4(), 1);
|
|
@@ -195984,9 +196002,9 @@ function createDevLogger() {
|
|
|
195984
196002
|
|
|
195985
196003
|
// src/cli/dev/dev-server/function-manager.ts
|
|
195986
196004
|
import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
|
|
195987
|
-
import { dirname as
|
|
196005
|
+
import { dirname as dirname12, join as join15 } from "node:path";
|
|
195988
196006
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
195989
|
-
var __dirname5 =
|
|
196007
|
+
var __dirname5 = dirname12(fileURLToPath7(import.meta.url));
|
|
195990
196008
|
var WRAPPER_PATH = join15(__dirname5, "../deno-runtime/main.js");
|
|
195991
196009
|
var READY_TIMEOUT = 30000;
|
|
195992
196010
|
|
|
@@ -196239,7 +196257,7 @@ async function devAction(options8) {
|
|
|
196239
196257
|
port,
|
|
196240
196258
|
loadResources: async () => {
|
|
196241
196259
|
const { project: project2 } = await readProjectConfig();
|
|
196242
|
-
const configDir =
|
|
196260
|
+
const configDir = dirname13(project2.configPath);
|
|
196243
196261
|
const functions = await functionResource.readAll(join16(configDir, project2.functionsDir));
|
|
196244
196262
|
return { functions };
|
|
196245
196263
|
}
|
|
@@ -196405,7 +196423,7 @@ function nanoid3(size = 21) {
|
|
|
196405
196423
|
}
|
|
196406
196424
|
|
|
196407
196425
|
// node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
196408
|
-
import { dirname as
|
|
196426
|
+
import { dirname as dirname14, posix, sep } from "path";
|
|
196409
196427
|
function createModulerModifier() {
|
|
196410
196428
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
196411
196429
|
return async (frames) => {
|
|
@@ -196414,7 +196432,7 @@ function createModulerModifier() {
|
|
|
196414
196432
|
return frames;
|
|
196415
196433
|
};
|
|
196416
196434
|
}
|
|
196417
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
196435
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname14(process.argv[1]) : process.cwd(), isWindows4 = sep === "\\") {
|
|
196418
196436
|
const normalizedBase = isWindows4 ? normalizeWindowsPath2(basePath) : basePath;
|
|
196419
196437
|
return (filename) => {
|
|
196420
196438
|
if (!filename)
|
|
@@ -200631,4 +200649,4 @@ export {
|
|
|
200631
200649
|
CLIExitError
|
|
200632
200650
|
};
|
|
200633
200651
|
|
|
200634
|
-
//# debugId=
|
|
200652
|
+
//# debugId=3E7C5C117F7AC17164756E2164756E21
|