@base44-preview/cli 0.0.56-pr.550.ab88218 → 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,
|
|
@@ -251130,9 +251109,12 @@ class Base44Command extends Command {
|
|
|
251130
251109
|
}
|
|
251131
251110
|
return this._context;
|
|
251132
251111
|
}
|
|
251112
|
+
isRawOutputMode() {
|
|
251113
|
+
return this.opts().format === "json";
|
|
251114
|
+
}
|
|
251133
251115
|
action(fn) {
|
|
251134
251116
|
return super.action(async (...args) => {
|
|
251135
|
-
const quiet = this.context.isNonInteractive;
|
|
251117
|
+
const quiet = this.context.isNonInteractive || this.isRawOutputMode();
|
|
251136
251118
|
if (!quiet) {
|
|
251137
251119
|
await showCommandStart(this._commandOptions.fullBanner);
|
|
251138
251120
|
}
|
|
@@ -253264,9 +253246,6 @@ async function deployAction({ isNonInteractive, log }, options = {}) {
|
|
|
253264
253246
|
if (authConfig.length > 0) {
|
|
253265
253247
|
summaryLines.push(" - Auth config");
|
|
253266
253248
|
}
|
|
253267
|
-
if (project2.visibility) {
|
|
253268
|
-
summaryLines.push(` - Visibility: ${project2.visibility}`);
|
|
253269
|
-
}
|
|
253270
253249
|
if (project2.site?.outputDirectory) {
|
|
253271
253250
|
summaryLines.push(` - Site from ${project2.site.outputDirectory}`);
|
|
253272
253251
|
}
|
|
@@ -253523,6 +253502,9 @@ function parseFunctionFilters(options) {
|
|
|
253523
253502
|
if (options.order) {
|
|
253524
253503
|
filters.order = options.order.toLowerCase();
|
|
253525
253504
|
}
|
|
253505
|
+
if (options.env) {
|
|
253506
|
+
filters.env = options.env;
|
|
253507
|
+
}
|
|
253526
253508
|
return filters;
|
|
253527
253509
|
}
|
|
253528
253510
|
function parseFunctionNames(option) {
|
|
@@ -253531,6 +253513,11 @@ function parseFunctionNames(option) {
|
|
|
253531
253513
|
return option.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
253532
253514
|
}
|
|
253533
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
|
+
}
|
|
253534
253521
|
if (/Z$|[+-]\d{2}:\d{2}$/.test(value))
|
|
253535
253522
|
return value;
|
|
253536
253523
|
return `${value}Z`;
|
|
@@ -253541,8 +253528,12 @@ function formatEntry(entry) {
|
|
|
253541
253528
|
const message = entry.message.trim();
|
|
253542
253529
|
return `${time3} ${level} ${message}`;
|
|
253543
253530
|
}
|
|
253544
|
-
function formatLogs(entries) {
|
|
253531
|
+
function formatLogs(entries, env3) {
|
|
253545
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
|
+
}
|
|
253546
253537
|
return `No logs found matching the filters.
|
|
253547
253538
|
`;
|
|
253548
253539
|
}
|
|
@@ -253559,32 +253550,31 @@ function normalizeLogEntry(entry, functionName) {
|
|
|
253559
253550
|
source: functionName
|
|
253560
253551
|
};
|
|
253561
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
|
+
}
|
|
253562
253572
|
async function fetchLogsForFunctions(functionNames, options, availableFunctionNames) {
|
|
253563
253573
|
const filters = parseFunctionFilters(options);
|
|
253564
253574
|
const allEntries = [];
|
|
253565
253575
|
for (const functionName of functionNames) {
|
|
253566
|
-
|
|
253567
|
-
|
|
253568
|
-
logs = await fetchFunctionLogs(functionName, filters);
|
|
253569
|
-
} catch (error48) {
|
|
253570
|
-
if (error48 instanceof ApiError && error48.statusCode === 404 && availableFunctionNames.length > 0) {
|
|
253571
|
-
const available = availableFunctionNames.join(", ");
|
|
253572
|
-
throw new InvalidInputError(`Function "${functionName}" was not found in this app`, {
|
|
253573
|
-
hints: [
|
|
253574
|
-
{
|
|
253575
|
-
message: `Available functions in this project: ${available}`
|
|
253576
|
-
},
|
|
253577
|
-
{
|
|
253578
|
-
message: "Make sure the function has been deployed before fetching logs",
|
|
253579
|
-
command: "base44 functions deploy"
|
|
253580
|
-
}
|
|
253581
|
-
]
|
|
253582
|
-
});
|
|
253583
|
-
}
|
|
253584
|
-
throw error48;
|
|
253585
|
-
}
|
|
253586
|
-
const entries = logs.map((entry) => normalizeLogEntry(entry, functionName));
|
|
253587
|
-
allEntries.push(...entries);
|
|
253576
|
+
const logs = await fetchLogsForFunction(functionName, filters, availableFunctionNames);
|
|
253577
|
+
allEntries.push(...logs.map((entry) => normalizeLogEntry(entry, functionName)));
|
|
253588
253578
|
}
|
|
253589
253579
|
if (functionNames.length > 1) {
|
|
253590
253580
|
const order = options.order?.toUpperCase() === "ASC" ? 1 : -1;
|
|
@@ -253624,12 +253614,17 @@ async function logsAction(ctx, options) {
|
|
|
253624
253614
|
if (limit !== undefined && entries.length > limit) {
|
|
253625
253615
|
entries = entries.slice(0, limit);
|
|
253626
253616
|
}
|
|
253627
|
-
const
|
|
253628
|
-
|
|
253629
|
-
|
|
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
|
+
};
|
|
253630
253625
|
}
|
|
253631
253626
|
function getLogsCommand() {
|
|
253632
|
-
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);
|
|
253633
253628
|
}
|
|
253634
253629
|
|
|
253635
253630
|
// src/cli/commands/project/scaffold.ts
|
|
@@ -262005,4 +262000,4 @@ export {
|
|
|
262005
262000
|
CLIExitError
|
|
262006
262001
|
};
|
|
262007
262002
|
|
|
262008
|
-
//# debugId=
|
|
262003
|
+
//# debugId=4DDCE257A2EC20FC64756E2164756E21
|