@base44-preview/cli 0.0.56-pr.550.b83f0ca → 0.0.56-pr.551.d451628
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) {
|
|
@@ -253549,8 +253520,12 @@ function formatEntry(entry) {
|
|
|
253549
253520
|
const message = entry.message.trim();
|
|
253550
253521
|
return `${time3} ${level} ${message}`;
|
|
253551
253522
|
}
|
|
253552
|
-
function formatLogs(entries) {
|
|
253523
|
+
function formatLogs(entries, env3) {
|
|
253553
253524
|
if (entries.length === 0) {
|
|
253525
|
+
if (env3 === "prod") {
|
|
253526
|
+
return `No production logs found. Has this app been published? Try --env preview to see draft logs.
|
|
253527
|
+
`;
|
|
253528
|
+
}
|
|
253554
253529
|
return `No logs found matching the filters.
|
|
253555
253530
|
`;
|
|
253556
253531
|
}
|
|
@@ -253567,32 +253542,31 @@ function normalizeLogEntry(entry, functionName) {
|
|
|
253567
253542
|
source: functionName
|
|
253568
253543
|
};
|
|
253569
253544
|
}
|
|
253545
|
+
async function fetchLogsForFunction(functionName, filters, availableFunctionNames) {
|
|
253546
|
+
try {
|
|
253547
|
+
return await fetchFunctionLogs(functionName, filters);
|
|
253548
|
+
} catch (error48) {
|
|
253549
|
+
if (error48 instanceof ApiError && error48.statusCode === 404 && availableFunctionNames.length > 0) {
|
|
253550
|
+
const available = availableFunctionNames.join(", ");
|
|
253551
|
+
throw new InvalidInputError(`Function "${functionName}" was not found in this app`, {
|
|
253552
|
+
hints: [
|
|
253553
|
+
{ message: `Available functions in this project: ${available}` },
|
|
253554
|
+
{
|
|
253555
|
+
message: "Make sure the function has been deployed before fetching logs",
|
|
253556
|
+
command: "base44 functions deploy"
|
|
253557
|
+
}
|
|
253558
|
+
]
|
|
253559
|
+
});
|
|
253560
|
+
}
|
|
253561
|
+
throw error48;
|
|
253562
|
+
}
|
|
253563
|
+
}
|
|
253570
253564
|
async function fetchLogsForFunctions(functionNames, options, availableFunctionNames) {
|
|
253571
253565
|
const filters = parseFunctionFilters(options);
|
|
253572
253566
|
const allEntries = [];
|
|
253573
253567
|
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));
|
|
253595
|
-
allEntries.push(...entries);
|
|
253568
|
+
const logs = await fetchLogsForFunction(functionName, filters, availableFunctionNames);
|
|
253569
|
+
allEntries.push(...logs.map((entry) => normalizeLogEntry(entry, functionName)));
|
|
253596
253570
|
}
|
|
253597
253571
|
if (functionNames.length > 1) {
|
|
253598
253572
|
const order = options.order?.toUpperCase() === "ASC" ? 1 : -1;
|
|
@@ -253632,12 +253606,13 @@ async function logsAction(ctx, options) {
|
|
|
253632
253606
|
if (limit !== undefined && entries.length > limit) {
|
|
253633
253607
|
entries = entries.slice(0, limit);
|
|
253634
253608
|
}
|
|
253609
|
+
const env3 = options.env ?? "preview";
|
|
253635
253610
|
const logsOutput = options.json ? `${JSON.stringify(entries, null, 2)}
|
|
253636
|
-
` : formatLogs(entries);
|
|
253611
|
+
` : formatLogs(entries, env3);
|
|
253637
253612
|
return { outroMessage: "Fetched logs", stdout: logsOutput };
|
|
253638
253613
|
}
|
|
253639
253614
|
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);
|
|
253615
|
+
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>", "Environment to fetch logs from (default: preview)").choices(["preview", "prod"])).action(logsAction);
|
|
253641
253616
|
}
|
|
253642
253617
|
|
|
253643
253618
|
// src/cli/commands/project/scaffold.ts
|
|
@@ -253694,20 +253669,6 @@ Examples:
|
|
|
253694
253669
|
$ base44 scaffold my-app --app-id app_123 Scaffolds the current dir, named "my-app"`).action(scaffoldAction);
|
|
253695
253670
|
}
|
|
253696
253671
|
|
|
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
253672
|
// src/cli/commands/secrets/delete.ts
|
|
253712
253673
|
async function deleteSecretAction({ runTask: runTask2 }, key) {
|
|
253713
253674
|
await runTask2(`Deleting secret "${key}"`, async () => {
|
|
@@ -257769,7 +257730,6 @@ function createProgram(context) {
|
|
|
257769
257730
|
program2.addCommand(getScaffoldCommand());
|
|
257770
257731
|
program2.addCommand(getDashboardCommand());
|
|
257771
257732
|
program2.addCommand(getDeployCommand2());
|
|
257772
|
-
program2.addCommand(getVisibilityCommand());
|
|
257773
257733
|
program2.addCommand(getLinkCommand());
|
|
257774
257734
|
program2.addCommand(getEjectCommand());
|
|
257775
257735
|
program2.addCommand(getEntitiesPushCommand());
|
|
@@ -262028,4 +261988,4 @@ export {
|
|
|
262028
261988
|
CLIExitError
|
|
262029
261989
|
};
|
|
262030
261990
|
|
|
262031
|
-
//# debugId=
|
|
261991
|
+
//# debugId=2288207DAC9F5A5264756E2164756E21
|