@base44-preview/cli 0.0.56-pr.550.b83f0ca → 0.0.56-pr.551.d02ef77
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.
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
{
|
|
6
6
|
"name": "<%= name %>"<% if (description) { %>,
|
|
7
|
-
"description": "<%= description %>"<% }
|
|
8
|
-
|
|
9
|
-
"visibility": "public"
|
|
7
|
+
"description": "<%= description %>"<% } %>
|
|
10
8
|
|
|
11
9
|
// Site/hosting configuration
|
|
12
10
|
// Docs: https://docs.base44.com/configuration/hosting
|
package/dist/cli/index.js
CHANGED
|
@@ -233809,9 +233809,6 @@ class ApiError extends SystemError {
|
|
|
233809
233809
|
}
|
|
233810
233810
|
];
|
|
233811
233811
|
}
|
|
233812
|
-
if (statusCode && statusCode < 500) {
|
|
233813
|
-
return [];
|
|
233814
|
-
}
|
|
233815
233812
|
return [{ message: "Check your network connection and try again" }];
|
|
233816
233813
|
}
|
|
233817
233814
|
static getReasonHints(parsedResponse) {
|
|
@@ -236015,13 +236012,11 @@ var PluginMetadataSchema = exports_external.object({
|
|
|
236015
236012
|
var PluginReferenceSchema = exports_external.object({
|
|
236016
236013
|
source: exports_external.string().min(1, "Plugin source cannot be empty")
|
|
236017
236014
|
});
|
|
236018
|
-
var VISIBILITY_LEVELS = ["public", "private", "workspace"];
|
|
236019
236015
|
var ProjectConfigSchema = exports_external.object({
|
|
236020
236016
|
name: exports_external.string({
|
|
236021
236017
|
error: "App name cannot be empty"
|
|
236022
236018
|
}).min(1, "App name cannot be empty"),
|
|
236023
236019
|
description: exports_external.string().optional(),
|
|
236024
|
-
visibility: exports_external.enum(VISIBILITY_LEVELS).optional(),
|
|
236025
236020
|
site: SiteConfigSchema.optional(),
|
|
236026
236021
|
entitiesDir: exports_external.string().optional().default("entities"),
|
|
236027
236022
|
functionsDir: exports_external.string().optional().default("functions"),
|
|
@@ -241804,11 +241799,6 @@ var PublishedUrlResponseSchema = exports_external.object({
|
|
|
241804
241799
|
});
|
|
241805
241800
|
|
|
241806
241801
|
// src/core/project/api.ts
|
|
241807
|
-
var PUBLIC_SETTINGS = {
|
|
241808
|
-
public: "public_without_login",
|
|
241809
|
-
private: "private_with_login",
|
|
241810
|
-
workspace: "workspace_with_login"
|
|
241811
|
-
};
|
|
241812
241802
|
async function createProject(projectName, description) {
|
|
241813
241803
|
let response;
|
|
241814
241804
|
try {
|
|
@@ -241817,7 +241807,7 @@ async function createProject(projectName, description) {
|
|
|
241817
241807
|
name: projectName,
|
|
241818
241808
|
user_description: description ?? `Backend for '${projectName}'`,
|
|
241819
241809
|
is_managed_source_code: false,
|
|
241820
|
-
public_settings:
|
|
241810
|
+
public_settings: "public_without_login"
|
|
241821
241811
|
}
|
|
241822
241812
|
});
|
|
241823
241813
|
} catch (error48) {
|
|
@@ -241831,18 +241821,6 @@ async function createProject(projectName, description) {
|
|
|
241831
241821
|
projectId: result.data.id
|
|
241832
241822
|
};
|
|
241833
241823
|
}
|
|
241834
|
-
async function setAppVisibility(visibility) {
|
|
241835
|
-
if (!visibility)
|
|
241836
|
-
return;
|
|
241837
|
-
const { id } = getAppContext();
|
|
241838
|
-
try {
|
|
241839
|
-
await base44Client.put(`api/apps/${id}`, {
|
|
241840
|
-
json: { public_settings: PUBLIC_SETTINGS[visibility] }
|
|
241841
|
-
});
|
|
241842
|
-
} catch (error48) {
|
|
241843
|
-
throw await ApiError.fromHttpError(error48, "updating app visibility");
|
|
241844
|
-
}
|
|
241845
|
-
}
|
|
241846
241824
|
async function listProjects() {
|
|
241847
241825
|
let response;
|
|
241848
241826
|
try {
|
|
@@ -243509,6 +243487,9 @@ function buildLogsQueryString(filters) {
|
|
|
243509
243487
|
if (filters.order) {
|
|
243510
243488
|
params.set("order", filters.order);
|
|
243511
243489
|
}
|
|
243490
|
+
if (filters.env) {
|
|
243491
|
+
params.set("env", filters.env);
|
|
243492
|
+
}
|
|
243512
243493
|
return params;
|
|
243513
243494
|
}
|
|
243514
243495
|
async function fetchFunctionLogs(functionName, filters = {}) {
|
|
@@ -244197,12 +244178,10 @@ function hasResourcesToDeploy(projectData) {
|
|
|
244197
244178
|
const hasAgents = agents.length > 0;
|
|
244198
244179
|
const hasConnectors = connectors.length > 0;
|
|
244199
244180
|
const hasAuthConfig = authConfig.length > 0;
|
|
244200
|
-
|
|
244201
|
-
return hasEntities || hasFunctions || hasAgents || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
|
|
244181
|
+
return hasEntities || hasFunctions || hasAgents || hasConnectors || hasAuthConfig || hasSite;
|
|
244202
244182
|
}
|
|
244203
244183
|
async function deployAll(projectData, options) {
|
|
244204
244184
|
const { project, entities, functions, agents, connectors, authConfig } = projectData;
|
|
244205
|
-
await setAppVisibility(project.visibility);
|
|
244206
244185
|
await entityResource.push(entities);
|
|
244207
244186
|
await deployFunctionsSequentially(functions, {
|
|
244208
244187
|
onStart: options?.onFunctionStart,
|
|
@@ -244218,14 +244197,6 @@ async function deployAll(projectData, options) {
|
|
|
244218
244197
|
}
|
|
244219
244198
|
return { connectorResults };
|
|
244220
244199
|
}
|
|
244221
|
-
// src/core/project/visibility.ts
|
|
244222
|
-
async function writeVisibilityToConfig(configPath, visibility) {
|
|
244223
|
-
const text = await readTextFile(configPath);
|
|
244224
|
-
const existing = /("visibility"\s*:\s*")(?:public|private|workspace)(")/;
|
|
244225
|
-
const next = existing.test(text) ? text.replace(existing, `$1${visibility}$2`) : text.replace(/^[ \t]*\{/m, (brace) => `${brace}
|
|
244226
|
-
"visibility": "${visibility}",`);
|
|
244227
|
-
await writeFile(configPath, next);
|
|
244228
|
-
}
|
|
244229
244200
|
// src/core/clients/base44-client.ts
|
|
244230
244201
|
var retriedRequests = new WeakSet;
|
|
244231
244202
|
async function captureRequestBody(request, options) {
|
|
@@ -253272,9 +253243,6 @@ async function deployAction({ isNonInteractive, log }, options = {}) {
|
|
|
253272
253243
|
if (authConfig.length > 0) {
|
|
253273
253244
|
summaryLines.push(" - Auth config");
|
|
253274
253245
|
}
|
|
253275
|
-
if (project2.visibility) {
|
|
253276
|
-
summaryLines.push(` - Visibility: ${project2.visibility}`);
|
|
253277
|
-
}
|
|
253278
253246
|
if (project2.site?.outputDirectory) {
|
|
253279
253247
|
summaryLines.push(` - Site from ${project2.site.outputDirectory}`);
|
|
253280
253248
|
}
|
|
@@ -253531,6 +253499,9 @@ function parseFunctionFilters(options) {
|
|
|
253531
253499
|
if (options.order) {
|
|
253532
253500
|
filters.order = options.order.toLowerCase();
|
|
253533
253501
|
}
|
|
253502
|
+
if (options.env) {
|
|
253503
|
+
filters.env = options.env;
|
|
253504
|
+
}
|
|
253534
253505
|
return filters;
|
|
253535
253506
|
}
|
|
253536
253507
|
function parseFunctionNames(option) {
|
|
@@ -253567,38 +253538,44 @@ function normalizeLogEntry(entry, functionName) {
|
|
|
253567
253538
|
source: functionName
|
|
253568
253539
|
};
|
|
253569
253540
|
}
|
|
253541
|
+
async function fetchLogsForFunction(functionName, filters, availableFunctionNames) {
|
|
253542
|
+
try {
|
|
253543
|
+
return await fetchFunctionLogs(functionName, filters);
|
|
253544
|
+
} catch (error48) {
|
|
253545
|
+
if (error48 instanceof ApiError && error48.statusCode === 404 && availableFunctionNames.length > 0) {
|
|
253546
|
+
const available = availableFunctionNames.join(", ");
|
|
253547
|
+
throw new InvalidInputError(`Function "${functionName}" was not found in this app`, {
|
|
253548
|
+
hints: [
|
|
253549
|
+
{ message: `Available functions in this project: ${available}` },
|
|
253550
|
+
{
|
|
253551
|
+
message: "Make sure the function has been deployed before fetching logs",
|
|
253552
|
+
command: "base44 functions deploy"
|
|
253553
|
+
}
|
|
253554
|
+
]
|
|
253555
|
+
});
|
|
253556
|
+
}
|
|
253557
|
+
throw error48;
|
|
253558
|
+
}
|
|
253559
|
+
}
|
|
253570
253560
|
async function fetchLogsForFunctions(functionNames, options, availableFunctionNames) {
|
|
253571
|
-
const
|
|
253561
|
+
const env3 = options.env ?? "all";
|
|
253562
|
+
const envs = env3 === "all" ? ["preview", "prod"] : [env3];
|
|
253572
253563
|
const allEntries = [];
|
|
253573
253564
|
for (const functionName of functionNames) {
|
|
253574
|
-
|
|
253575
|
-
|
|
253576
|
-
logs = await fetchFunctionLogs(functionName, filters);
|
|
253577
|
-
} catch (error48) {
|
|
253578
|
-
if (error48 instanceof ApiError && error48.statusCode === 404 && availableFunctionNames.length > 0) {
|
|
253579
|
-
const available = availableFunctionNames.join(", ");
|
|
253580
|
-
throw new InvalidInputError(`Function "${functionName}" was not found in this app`, {
|
|
253581
|
-
hints: [
|
|
253582
|
-
{
|
|
253583
|
-
message: `Available functions in this project: ${available}`
|
|
253584
|
-
},
|
|
253585
|
-
{
|
|
253586
|
-
message: "Make sure the function has been deployed before fetching logs",
|
|
253587
|
-
command: "base44 functions deploy"
|
|
253588
|
-
}
|
|
253589
|
-
]
|
|
253590
|
-
});
|
|
253591
|
-
}
|
|
253592
|
-
throw error48;
|
|
253593
|
-
}
|
|
253594
|
-
const entries = logs.map((entry) => normalizeLogEntry(entry, functionName));
|
|
253565
|
+
const logsPerEnv = await Promise.all(envs.map((e2) => fetchLogsForFunction(functionName, { ...parseFunctionFilters(options), env: e2 }, availableFunctionNames)));
|
|
253566
|
+
const entries = logsPerEnv.flat().map((entry) => normalizeLogEntry(entry, functionName));
|
|
253595
253567
|
allEntries.push(...entries);
|
|
253596
253568
|
}
|
|
253597
|
-
|
|
253598
|
-
|
|
253599
|
-
|
|
253600
|
-
|
|
253601
|
-
|
|
253569
|
+
const order = options.order?.toUpperCase() === "ASC" ? 1 : -1;
|
|
253570
|
+
allEntries.sort((a2, b) => order * a2.time.localeCompare(b.time));
|
|
253571
|
+
const seen = new Set;
|
|
253572
|
+
return allEntries.filter((e2) => {
|
|
253573
|
+
const key = `${e2.time}|${e2.source}|${e2.message}`;
|
|
253574
|
+
if (seen.has(key))
|
|
253575
|
+
return false;
|
|
253576
|
+
seen.add(key);
|
|
253577
|
+
return true;
|
|
253578
|
+
});
|
|
253602
253579
|
}
|
|
253603
253580
|
async function getProjectFunctionNames(projectRoot) {
|
|
253604
253581
|
const { functions } = await readProjectConfig(projectRoot);
|
|
@@ -253637,7 +253614,7 @@ async function logsAction(ctx, options) {
|
|
|
253637
253614
|
return { outroMessage: "Fetched logs", stdout: logsOutput };
|
|
253638
253615
|
}
|
|
253639
253616
|
function getLogsCommand() {
|
|
253640
|
-
return new Base44Command("logs").description("Fetch function logs for this app").option("--function <names>", "Filter by function name(s), comma-separated. If omitted, fetches logs for all project functions").option("--since <datetime>", "Show logs from this time (ISO format)", normalizeDatetime).option("--until <datetime>", "Show logs until this time (ISO format)", normalizeDatetime).addOption(new Option("--level <level>", "Filter by log level").choices([...LogLevelSchema.options]).hideHelp()).option("-n, --limit <n>", "Results per page (1-1000, default: 50)").addOption(new Option("--order <order>", "Sort order").choices(["asc", "desc"])).action(logsAction);
|
|
253617
|
+
return new Base44Command("logs").description("Fetch function logs for this app").option("--function <names>", "Filter by function name(s), comma-separated. If omitted, fetches logs for all project functions").option("--since <datetime>", "Show logs from this time (ISO format)", normalizeDatetime).option("--until <datetime>", "Show logs until this time (ISO format)", normalizeDatetime).addOption(new Option("--level <level>", "Filter by log level").choices([...LogLevelSchema.options]).hideHelp()).option("-n, --limit <n>", "Results per page (1-1000, default: 50)").addOption(new Option("--order <order>", "Sort order").choices(["asc", "desc"])).addOption(new Option("--env <env>", "Filter by environment").choices(["preview", "prod", "all"]).default("all")).action(logsAction);
|
|
253641
253618
|
}
|
|
253642
253619
|
|
|
253643
253620
|
// src/cli/commands/project/scaffold.ts
|
|
@@ -253694,20 +253671,6 @@ Examples:
|
|
|
253694
253671
|
$ base44 scaffold my-app --app-id app_123 Scaffolds the current dir, named "my-app"`).action(scaffoldAction);
|
|
253695
253672
|
}
|
|
253696
253673
|
|
|
253697
|
-
// src/cli/commands/project/visibility.ts
|
|
253698
|
-
async function visibilityAction({ runTask: runTask2 }, level) {
|
|
253699
|
-
const { project: project2 } = await readProjectConfig();
|
|
253700
|
-
await runTask2("Updating local config", () => writeVisibilityToConfig(project2.configPath, level));
|
|
253701
|
-
return {
|
|
253702
|
-
outroMessage: `Visibility set to ${level} in local config. Run \`base44 deploy\` to apply.`
|
|
253703
|
-
};
|
|
253704
|
-
}
|
|
253705
|
-
function getVisibilityCommand() {
|
|
253706
|
-
return new Base44Command("visibility").description("Set app visibility (public, private, or workspace)").addArgument(new Argument("<level>", "Visibility level").choices([
|
|
253707
|
-
...VISIBILITY_LEVELS
|
|
253708
|
-
])).action(visibilityAction);
|
|
253709
|
-
}
|
|
253710
|
-
|
|
253711
253674
|
// src/cli/commands/secrets/delete.ts
|
|
253712
253675
|
async function deleteSecretAction({ runTask: runTask2 }, key) {
|
|
253713
253676
|
await runTask2(`Deleting secret "${key}"`, async () => {
|
|
@@ -257769,7 +257732,6 @@ function createProgram(context) {
|
|
|
257769
257732
|
program2.addCommand(getScaffoldCommand());
|
|
257770
257733
|
program2.addCommand(getDashboardCommand());
|
|
257771
257734
|
program2.addCommand(getDeployCommand2());
|
|
257772
|
-
program2.addCommand(getVisibilityCommand());
|
|
257773
257735
|
program2.addCommand(getLinkCommand());
|
|
257774
257736
|
program2.addCommand(getEjectCommand());
|
|
257775
257737
|
program2.addCommand(getEntitiesPushCommand());
|
|
@@ -262028,4 +261990,4 @@ export {
|
|
|
262028
261990
|
CLIExitError
|
|
262029
261991
|
};
|
|
262030
261992
|
|
|
262031
|
-
//# debugId=
|
|
261993
|
+
//# debugId=62D8AD80DEE0720E64756E2164756E21
|