@base44-preview/cli 0.0.56-pr.550.b83f0ca → 0.0.56-pr.551.6632e1b
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 {
|
|
@@ -243448,7 +243426,7 @@ var ListFunctionsResponseSchema = exports_external.object({
|
|
|
243448
243426
|
var LogLevelSchema = exports_external.enum(["info", "warning", "error", "debug"]);
|
|
243449
243427
|
var FunctionLogEntrySchema = exports_external.object({
|
|
243450
243428
|
time: exports_external.string(),
|
|
243451
|
-
level: LogLevelSchema,
|
|
243429
|
+
level: exports_external.preprocess((v) => v === "warn" ? "warning" : !v || v === "log" ? "info" : v, LogLevelSchema),
|
|
243452
243430
|
message: exports_external.string()
|
|
243453
243431
|
});
|
|
243454
243432
|
var FunctionLogsResponseSchema = exports_external.array(FunctionLogEntrySchema);
|
|
@@ -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) {
|
|
@@ -251138,9 +251109,12 @@ class Base44Command extends Command {
|
|
|
251138
251109
|
}
|
|
251139
251110
|
return this._context;
|
|
251140
251111
|
}
|
|
251112
|
+
isRawOutputMode() {
|
|
251113
|
+
return this.opts().format === "json";
|
|
251114
|
+
}
|
|
251141
251115
|
action(fn) {
|
|
251142
251116
|
return super.action(async (...args) => {
|
|
251143
|
-
const quiet = this.context.isNonInteractive;
|
|
251117
|
+
const quiet = this.context.isNonInteractive || this.isRawOutputMode();
|
|
251144
251118
|
if (!quiet) {
|
|
251145
251119
|
await showCommandStart(this._commandOptions.fullBanner);
|
|
251146
251120
|
}
|
|
@@ -253272,9 +253246,6 @@ async function deployAction({ isNonInteractive, log }, options = {}) {
|
|
|
253272
253246
|
if (authConfig.length > 0) {
|
|
253273
253247
|
summaryLines.push(" - Auth config");
|
|
253274
253248
|
}
|
|
253275
|
-
if (project2.visibility) {
|
|
253276
|
-
summaryLines.push(` - Visibility: ${project2.visibility}`);
|
|
253277
|
-
}
|
|
253278
253249
|
if (project2.site?.outputDirectory) {
|
|
253279
253250
|
summaryLines.push(` - Site from ${project2.site.outputDirectory}`);
|
|
253280
253251
|
}
|
|
@@ -253531,6 +253502,9 @@ function parseFunctionFilters(options) {
|
|
|
253531
253502
|
if (options.order) {
|
|
253532
253503
|
filters.order = options.order.toLowerCase();
|
|
253533
253504
|
}
|
|
253505
|
+
if (options.env) {
|
|
253506
|
+
filters.env = options.env;
|
|
253507
|
+
}
|
|
253534
253508
|
return filters;
|
|
253535
253509
|
}
|
|
253536
253510
|
function parseFunctionNames(option) {
|
|
@@ -253539,6 +253513,11 @@ function parseFunctionNames(option) {
|
|
|
253539
253513
|
return option.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
253540
253514
|
}
|
|
253541
253515
|
function normalizeDatetime(value) {
|
|
253516
|
+
const rel = value.match(/^(\d+)(m|h|d)$/);
|
|
253517
|
+
if (rel) {
|
|
253518
|
+
const ms = rel[2] === "m" ? Number(rel[1]) * 60000 : rel[2] === "h" ? Number(rel[1]) * 3600000 : Number(rel[1]) * 86400000;
|
|
253519
|
+
return new Date(Date.now() - ms).toISOString();
|
|
253520
|
+
}
|
|
253542
253521
|
if (/Z$|[+-]\d{2}:\d{2}$/.test(value))
|
|
253543
253522
|
return value;
|
|
253544
253523
|
return `${value}Z`;
|
|
@@ -253549,8 +253528,12 @@ function formatEntry(entry) {
|
|
|
253549
253528
|
const message = entry.message.trim();
|
|
253550
253529
|
return `${time3} ${level} ${message}`;
|
|
253551
253530
|
}
|
|
253552
|
-
function formatLogs(entries) {
|
|
253531
|
+
function formatLogs(entries, env3) {
|
|
253553
253532
|
if (entries.length === 0) {
|
|
253533
|
+
if (env3 === "prod") {
|
|
253534
|
+
return `No production logs found. Has this app been published? Try --env preview to see draft logs.
|
|
253535
|
+
`;
|
|
253536
|
+
}
|
|
253554
253537
|
return `No logs found matching the filters.
|
|
253555
253538
|
`;
|
|
253556
253539
|
}
|
|
@@ -253567,32 +253550,31 @@ function normalizeLogEntry(entry, functionName) {
|
|
|
253567
253550
|
source: functionName
|
|
253568
253551
|
};
|
|
253569
253552
|
}
|
|
253553
|
+
async function fetchLogsForFunction(functionName, filters, availableFunctionNames) {
|
|
253554
|
+
try {
|
|
253555
|
+
return await fetchFunctionLogs(functionName, filters);
|
|
253556
|
+
} catch (error48) {
|
|
253557
|
+
if (error48 instanceof ApiError && error48.statusCode === 404 && availableFunctionNames.length > 0) {
|
|
253558
|
+
const available = availableFunctionNames.join(", ");
|
|
253559
|
+
throw new InvalidInputError(`Function "${functionName}" was not found in this app`, {
|
|
253560
|
+
hints: [
|
|
253561
|
+
{ message: `Available functions in this project: ${available}` },
|
|
253562
|
+
{
|
|
253563
|
+
message: "Make sure the function has been deployed before fetching logs",
|
|
253564
|
+
command: "base44 functions deploy"
|
|
253565
|
+
}
|
|
253566
|
+
]
|
|
253567
|
+
});
|
|
253568
|
+
}
|
|
253569
|
+
throw error48;
|
|
253570
|
+
}
|
|
253571
|
+
}
|
|
253570
253572
|
async function fetchLogsForFunctions(functionNames, options, availableFunctionNames) {
|
|
253571
253573
|
const filters = parseFunctionFilters(options);
|
|
253572
253574
|
const allEntries = [];
|
|
253573
253575
|
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);
|
|
253576
|
+
const logs = await fetchLogsForFunction(functionName, filters, availableFunctionNames);
|
|
253577
|
+
allEntries.push(...logs.map((entry) => normalizeLogEntry(entry, functionName)));
|
|
253596
253578
|
}
|
|
253597
253579
|
if (functionNames.length > 1) {
|
|
253598
253580
|
const order = options.order?.toUpperCase() === "ASC" ? 1 : -1;
|
|
@@ -253632,12 +253614,17 @@ async function logsAction(ctx, options) {
|
|
|
253632
253614
|
if (limit !== undefined && entries.length > limit) {
|
|
253633
253615
|
entries = entries.slice(0, limit);
|
|
253634
253616
|
}
|
|
253635
|
-
const
|
|
253636
|
-
|
|
253637
|
-
|
|
253617
|
+
const env3 = options.env ?? "preview";
|
|
253618
|
+
const logsOutput = options.format === "json" ? `${JSON.stringify(entries, null, 2)}
|
|
253619
|
+
` : formatLogs(entries, env3);
|
|
253620
|
+
const shouldOutputOutroMessage = options.format !== "json";
|
|
253621
|
+
return {
|
|
253622
|
+
outroMessage: shouldOutputOutroMessage ? "Fetched logs" : undefined,
|
|
253623
|
+
stdout: logsOutput
|
|
253624
|
+
};
|
|
253638
253625
|
}
|
|
253639
253626
|
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);
|
|
253627
|
+
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"])).addOption(new Option("--format <format>", "Output format").choices(["text", "json"]).default("text")).action(logsAction);
|
|
253641
253628
|
}
|
|
253642
253629
|
|
|
253643
253630
|
// src/cli/commands/project/scaffold.ts
|
|
@@ -253694,20 +253681,6 @@ Examples:
|
|
|
253694
253681
|
$ base44 scaffold my-app --app-id app_123 Scaffolds the current dir, named "my-app"`).action(scaffoldAction);
|
|
253695
253682
|
}
|
|
253696
253683
|
|
|
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
253684
|
// src/cli/commands/secrets/delete.ts
|
|
253712
253685
|
async function deleteSecretAction({ runTask: runTask2 }, key) {
|
|
253713
253686
|
await runTask2(`Deleting secret "${key}"`, async () => {
|
|
@@ -257769,7 +257742,6 @@ function createProgram(context) {
|
|
|
257769
257742
|
program2.addCommand(getScaffoldCommand());
|
|
257770
257743
|
program2.addCommand(getDashboardCommand());
|
|
257771
257744
|
program2.addCommand(getDeployCommand2());
|
|
257772
|
-
program2.addCommand(getVisibilityCommand());
|
|
257773
257745
|
program2.addCommand(getLinkCommand());
|
|
257774
257746
|
program2.addCommand(getEjectCommand());
|
|
257775
257747
|
program2.addCommand(getEntitiesPushCommand());
|
|
@@ -262028,4 +262000,4 @@ export {
|
|
|
262028
262000
|
CLIExitError
|
|
262029
262001
|
};
|
|
262030
262002
|
|
|
262031
|
-
//# debugId=
|
|
262003
|
+
//# debugId=4DDCE257A2EC20FC64756E2164756E21
|