@base44-preview/cli 0.0.32-pr.249.da1c23d → 0.0.32-pr.249.f2df6fa
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 +157 -116
- package/dist/cli/index.js.map +13 -13
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -178102,6 +178102,18 @@ class InvalidInputError extends UserError {
|
|
|
178102
178102
|
code = "INVALID_INPUT";
|
|
178103
178103
|
}
|
|
178104
178104
|
|
|
178105
|
+
class DependencyNotFoundError extends UserError {
|
|
178106
|
+
code = "DEPENDENCY_NOT_FOUND";
|
|
178107
|
+
constructor(message, options) {
|
|
178108
|
+
super(message, {
|
|
178109
|
+
hints: options?.hints ?? [
|
|
178110
|
+
{ message: "Install the required dependency and try again" }
|
|
178111
|
+
],
|
|
178112
|
+
cause: options?.cause
|
|
178113
|
+
});
|
|
178114
|
+
}
|
|
178115
|
+
}
|
|
178116
|
+
|
|
178105
178117
|
class ApiError extends SystemError {
|
|
178106
178118
|
code = "API_ERROR";
|
|
178107
178119
|
statusCode;
|
|
@@ -178217,6 +178229,21 @@ class FileReadError extends SystemError {
|
|
|
178217
178229
|
});
|
|
178218
178230
|
}
|
|
178219
178231
|
}
|
|
178232
|
+
|
|
178233
|
+
class InternalError extends SystemError {
|
|
178234
|
+
code = "INTERNAL_ERROR";
|
|
178235
|
+
constructor(message, options) {
|
|
178236
|
+
super(message, {
|
|
178237
|
+
hints: options?.hints ?? [
|
|
178238
|
+
{
|
|
178239
|
+
message: "This is an unexpected error. Please report it if it persists."
|
|
178240
|
+
}
|
|
178241
|
+
],
|
|
178242
|
+
cause: options?.cause
|
|
178243
|
+
});
|
|
178244
|
+
}
|
|
178245
|
+
}
|
|
178246
|
+
|
|
178220
178247
|
class TypeGenerationError extends SystemError {
|
|
178221
178248
|
code = "TYPE_GENERATION_ERROR";
|
|
178222
178249
|
entityName;
|
|
@@ -185051,6 +185078,10 @@ var TikTokConnectorSchema = exports_external.object({
|
|
|
185051
185078
|
type: exports_external.literal("tiktok"),
|
|
185052
185079
|
scopes: exports_external.array(exports_external.string()).default([])
|
|
185053
185080
|
});
|
|
185081
|
+
var GoogleBigQueryConnectorSchema = exports_external.object({
|
|
185082
|
+
type: exports_external.literal("googlebigquery"),
|
|
185083
|
+
scopes: exports_external.array(exports_external.string()).default([])
|
|
185084
|
+
});
|
|
185054
185085
|
var CustomTypeSchema = exports_external.string().min(1).regex(/^[a-z0-9_-]+$/i);
|
|
185055
185086
|
var GenericConnectorSchema = exports_external.object({
|
|
185056
185087
|
type: CustomTypeSchema,
|
|
@@ -185063,6 +185094,7 @@ var ConnectorResourceSchema = exports_external.union([
|
|
|
185063
185094
|
GoogleSheetsConnectorSchema,
|
|
185064
185095
|
GoogleDocsConnectorSchema,
|
|
185065
185096
|
GoogleSlidesConnectorSchema,
|
|
185097
|
+
GoogleBigQueryConnectorSchema,
|
|
185066
185098
|
SlackConnectorSchema,
|
|
185067
185099
|
NotionConnectorSchema,
|
|
185068
185100
|
SalesforceConnectorSchema,
|
|
@@ -185078,6 +185110,7 @@ var KnownIntegrationTypes = [
|
|
|
185078
185110
|
"googlesheets",
|
|
185079
185111
|
"googledocs",
|
|
185080
185112
|
"googleslides",
|
|
185113
|
+
"googlebigquery",
|
|
185081
185114
|
"slack",
|
|
185082
185115
|
"notion",
|
|
185083
185116
|
"salesforce",
|
|
@@ -185340,7 +185373,10 @@ var connectorResource = {
|
|
|
185340
185373
|
// src/core/resources/entity/schema.ts
|
|
185341
185374
|
var FieldConditionSchema = exports_external.union([
|
|
185342
185375
|
exports_external.string(),
|
|
185343
|
-
exports_external.
|
|
185376
|
+
exports_external.number(),
|
|
185377
|
+
exports_external.boolean(),
|
|
185378
|
+
exports_external.null(),
|
|
185379
|
+
exports_external.looseObject({
|
|
185344
185380
|
$in: exports_external.unknown().optional(),
|
|
185345
185381
|
$nin: exports_external.unknown().optional(),
|
|
185346
185382
|
$ne: exports_external.unknown().optional(),
|
|
@@ -185357,6 +185393,15 @@ var rlsConditionAllowedKeys = new Set([
|
|
|
185357
185393
|
"user_condition",
|
|
185358
185394
|
"created_by",
|
|
185359
185395
|
"created_by_id",
|
|
185396
|
+
"id",
|
|
185397
|
+
"_id",
|
|
185398
|
+
"created_date",
|
|
185399
|
+
"updated_date",
|
|
185400
|
+
"app_id",
|
|
185401
|
+
"entity_name",
|
|
185402
|
+
"is_deleted",
|
|
185403
|
+
"deleted_date",
|
|
185404
|
+
"environment",
|
|
185360
185405
|
"$or",
|
|
185361
185406
|
"$and",
|
|
185362
185407
|
"$nor"
|
|
@@ -185385,60 +185430,33 @@ var isValidFieldCondition = (value) => {
|
|
|
185385
185430
|
}
|
|
185386
185431
|
return false;
|
|
185387
185432
|
};
|
|
185388
|
-
var RefineRLSConditionSchema = RLSConditionSchema.refine((val) => Object.entries(val).every(([key, value]) =>
|
|
185389
|
-
if (rlsConditionAllowedKeys.has(key)) {
|
|
185390
|
-
return true;
|
|
185391
|
-
}
|
|
185392
|
-
if (!key.startsWith("data.")) {
|
|
185393
|
-
return false;
|
|
185394
|
-
}
|
|
185395
|
-
return isValidFieldCondition(value);
|
|
185396
|
-
}), "Keys must be known RLS keys or match data.* pattern with valid value");
|
|
185433
|
+
var RefineRLSConditionSchema = RLSConditionSchema.refine((val) => Object.entries(val).every(([key, value]) => rlsConditionAllowedKeys.has(key) || isValidFieldCondition(value)), "Field condition values must be a primitive or an operator object ($in, $nin, $ne, $all)");
|
|
185397
185434
|
var RLSRuleSchema = exports_external.union([exports_external.boolean(), RefineRLSConditionSchema]);
|
|
185398
|
-
var EntityRLSSchema = exports_external.
|
|
185435
|
+
var EntityRLSSchema = exports_external.looseObject({
|
|
185399
185436
|
create: RLSRuleSchema.optional(),
|
|
185400
185437
|
read: RLSRuleSchema.optional(),
|
|
185401
185438
|
update: RLSRuleSchema.optional(),
|
|
185402
185439
|
delete: RLSRuleSchema.optional(),
|
|
185403
185440
|
write: RLSRuleSchema.optional()
|
|
185404
185441
|
});
|
|
185405
|
-
var FieldRLSSchema = exports_external.
|
|
185442
|
+
var FieldRLSSchema = exports_external.looseObject({
|
|
185406
185443
|
read: RLSRuleSchema.optional(),
|
|
185407
185444
|
write: RLSRuleSchema.optional(),
|
|
185408
185445
|
create: RLSRuleSchema.optional(),
|
|
185409
185446
|
update: RLSRuleSchema.optional(),
|
|
185410
185447
|
delete: RLSRuleSchema.optional()
|
|
185411
185448
|
});
|
|
185412
|
-
var
|
|
185413
|
-
|
|
185414
|
-
"number",
|
|
185415
|
-
"integer",
|
|
185416
|
-
"boolean",
|
|
185417
|
-
"array",
|
|
185418
|
-
"object"
|
|
185419
|
-
]);
|
|
185420
|
-
var StringFormatSchema = exports_external.enum([
|
|
185421
|
-
"date",
|
|
185422
|
-
"date-time",
|
|
185423
|
-
"time",
|
|
185424
|
-
"email",
|
|
185425
|
-
"uri",
|
|
185426
|
-
"hostname",
|
|
185427
|
-
"ipv4",
|
|
185428
|
-
"ipv6",
|
|
185429
|
-
"uuid"
|
|
185430
|
-
]);
|
|
185431
|
-
var PropertyDefinitionSchema = exports_external.object({
|
|
185432
|
-
type: PropertyTypeSchema,
|
|
185449
|
+
var PropertyDefinitionSchema = exports_external.looseObject({
|
|
185450
|
+
type: exports_external.string().optional(),
|
|
185433
185451
|
title: exports_external.string().optional(),
|
|
185434
185452
|
description: exports_external.string().optional(),
|
|
185435
185453
|
minLength: exports_external.number().int().min(0).optional(),
|
|
185436
185454
|
maxLength: exports_external.number().int().min(0).optional(),
|
|
185437
185455
|
pattern: exports_external.string().optional(),
|
|
185438
|
-
format:
|
|
185456
|
+
format: exports_external.string().optional(),
|
|
185439
185457
|
minimum: exports_external.number().optional(),
|
|
185440
185458
|
maximum: exports_external.number().optional(),
|
|
185441
|
-
enum: exports_external.array(exports_external.
|
|
185459
|
+
enum: exports_external.array(exports_external.unknown()).optional(),
|
|
185442
185460
|
enumNames: exports_external.array(exports_external.string()).optional(),
|
|
185443
185461
|
default: exports_external.unknown().optional(),
|
|
185444
185462
|
$ref: exports_external.string().optional(),
|
|
@@ -185451,12 +185469,12 @@ var PropertyDefinitionSchema = exports_external.object({
|
|
|
185451
185469
|
return exports_external.record(exports_external.string(), PropertyDefinitionSchema).optional();
|
|
185452
185470
|
}
|
|
185453
185471
|
});
|
|
185454
|
-
var EntitySchema = exports_external.
|
|
185455
|
-
type: exports_external.literal("object"),
|
|
185456
|
-
name: exports_external.string().regex(/^[a-zA-Z0-9]+$/, "Entity name must be alphanumeric only"),
|
|
185472
|
+
var EntitySchema = exports_external.looseObject({
|
|
185473
|
+
type: exports_external.literal("object").default("object"),
|
|
185474
|
+
name: exports_external.string().min(1).regex(/^[a-zA-Z0-9]+$/, "Entity name must be alphanumeric only"),
|
|
185457
185475
|
title: exports_external.string().optional(),
|
|
185458
185476
|
description: exports_external.string().optional(),
|
|
185459
|
-
properties: exports_external.record(exports_external.string(), PropertyDefinitionSchema),
|
|
185477
|
+
properties: exports_external.record(exports_external.string(), PropertyDefinitionSchema).default({}),
|
|
185460
185478
|
required: exports_external.array(exports_external.string()).optional(),
|
|
185461
185479
|
rls: EntityRLSSchema.optional()
|
|
185462
185480
|
});
|
|
@@ -186024,7 +186042,7 @@ async function handleUnauthorized(request, _options, response) {
|
|
|
186024
186042
|
return;
|
|
186025
186043
|
}
|
|
186026
186044
|
retriedRequests.add(request);
|
|
186027
|
-
return distribution_default(request, {
|
|
186045
|
+
return distribution_default(request.clone(), {
|
|
186028
186046
|
headers: { Authorization: `Bearer ${newAccessToken}` }
|
|
186029
186047
|
});
|
|
186030
186048
|
}
|
|
@@ -186663,7 +186681,9 @@ var theme = {
|
|
|
186663
186681
|
styles: {
|
|
186664
186682
|
header: source_default.dim,
|
|
186665
186683
|
bold: source_default.bold,
|
|
186666
|
-
dim: source_default.dim
|
|
186684
|
+
dim: source_default.dim,
|
|
186685
|
+
error: source_default.red,
|
|
186686
|
+
warn: source_default.yellow
|
|
186667
186687
|
},
|
|
186668
186688
|
format: {
|
|
186669
186689
|
errorContext(ctx) {
|
|
@@ -195206,62 +195226,10 @@ function getTypesCommand(context) {
|
|
|
195206
195226
|
return new Command("types").description("Manage TypeScript type generation").addCommand(getTypesGenerateCommand(context));
|
|
195207
195227
|
}
|
|
195208
195228
|
|
|
195209
|
-
// src/cli/dev/createDevLogger.ts
|
|
195210
|
-
var dateTimeFormat = new Intl.DateTimeFormat([], {
|
|
195211
|
-
hour: "2-digit",
|
|
195212
|
-
minute: "2-digit",
|
|
195213
|
-
second: "2-digit",
|
|
195214
|
-
hour12: false
|
|
195215
|
-
});
|
|
195216
|
-
var colorByType = {
|
|
195217
|
-
error: source_default.red,
|
|
195218
|
-
warn: source_default.yellow,
|
|
195219
|
-
log: (text) => text
|
|
195220
|
-
};
|
|
195221
|
-
function createDevLogger(isPrefixed = true) {
|
|
195222
|
-
const print = (type, msg) => {
|
|
195223
|
-
const colorize = colorByType[type];
|
|
195224
|
-
switch (type) {
|
|
195225
|
-
case "error":
|
|
195226
|
-
console.error(colorize(msg));
|
|
195227
|
-
break;
|
|
195228
|
-
case "warn":
|
|
195229
|
-
console.warn(colorize(msg));
|
|
195230
|
-
break;
|
|
195231
|
-
default:
|
|
195232
|
-
console.log(msg);
|
|
195233
|
-
}
|
|
195234
|
-
};
|
|
195235
|
-
const prefixedLog = (type, msg) => {
|
|
195236
|
-
const timestamp = dateTimeFormat.format(new Date);
|
|
195237
|
-
const colorize = colorByType[type];
|
|
195238
|
-
console.log(`${source_default.gray(timestamp)} ${colorize(msg)}`);
|
|
195239
|
-
};
|
|
195240
|
-
return isPrefixed ? {
|
|
195241
|
-
log: (msg) => prefixedLog("log", msg),
|
|
195242
|
-
error: (msg, err) => {
|
|
195243
|
-
prefixedLog("error", msg);
|
|
195244
|
-
if (err) {
|
|
195245
|
-
prefixedLog("error", String(err));
|
|
195246
|
-
}
|
|
195247
|
-
},
|
|
195248
|
-
warn: (msg) => prefixedLog("warn", msg)
|
|
195249
|
-
} : {
|
|
195250
|
-
log: (msg) => print("log", msg),
|
|
195251
|
-
error: (msg, err) => {
|
|
195252
|
-
print("error", msg);
|
|
195253
|
-
if (err) {
|
|
195254
|
-
print("error", String(err));
|
|
195255
|
-
}
|
|
195256
|
-
},
|
|
195257
|
-
warn: (msg) => print("warn", msg)
|
|
195258
|
-
};
|
|
195259
|
-
}
|
|
195260
|
-
|
|
195261
195229
|
// src/cli/dev/dev-server/main.ts
|
|
195230
|
+
import { dirname as dirname12, join as join16 } from "node:path";
|
|
195262
195231
|
var import_cors = __toESM(require_lib4(), 1);
|
|
195263
195232
|
var import_express2 = __toESM(require_express(), 1);
|
|
195264
|
-
import { dirname as dirname12, join as join16 } from "node:path";
|
|
195265
195233
|
|
|
195266
195234
|
// node_modules/get-port/index.js
|
|
195267
195235
|
import net from "node:net";
|
|
@@ -195380,8 +195348,60 @@ async function getPorts(options8) {
|
|
|
195380
195348
|
// src/cli/dev/dev-server/main.ts
|
|
195381
195349
|
var import_http_proxy_middleware = __toESM(require_dist2(), 1);
|
|
195382
195350
|
|
|
195351
|
+
// src/cli/dev/createDevLogger.ts
|
|
195352
|
+
var dateTimeFormat = new Intl.DateTimeFormat([], {
|
|
195353
|
+
hour: "2-digit",
|
|
195354
|
+
minute: "2-digit",
|
|
195355
|
+
second: "2-digit",
|
|
195356
|
+
hour12: false
|
|
195357
|
+
});
|
|
195358
|
+
var colorByType = {
|
|
195359
|
+
error: theme.styles.error,
|
|
195360
|
+
warn: theme.styles.warn,
|
|
195361
|
+
log: (text) => text
|
|
195362
|
+
};
|
|
195363
|
+
function createDevLogger(isPrefixed = true) {
|
|
195364
|
+
const print = (type, msg) => {
|
|
195365
|
+
const colorize = colorByType[type];
|
|
195366
|
+
switch (type) {
|
|
195367
|
+
case "error":
|
|
195368
|
+
console.error(colorize(msg));
|
|
195369
|
+
break;
|
|
195370
|
+
case "warn":
|
|
195371
|
+
console.warn(colorize(msg));
|
|
195372
|
+
break;
|
|
195373
|
+
default:
|
|
195374
|
+
console.log(msg);
|
|
195375
|
+
}
|
|
195376
|
+
};
|
|
195377
|
+
const prefixedLog = (type, msg) => {
|
|
195378
|
+
const timestamp = dateTimeFormat.format(new Date);
|
|
195379
|
+
const colorize = colorByType[type];
|
|
195380
|
+
console.log(`${theme.styles.dim(timestamp)} ${colorize(msg)}`);
|
|
195381
|
+
};
|
|
195382
|
+
return isPrefixed ? {
|
|
195383
|
+
log: (msg) => prefixedLog("log", msg),
|
|
195384
|
+
error: (msg, err) => {
|
|
195385
|
+
prefixedLog("error", msg);
|
|
195386
|
+
if (err) {
|
|
195387
|
+
prefixedLog("error", String(err));
|
|
195388
|
+
}
|
|
195389
|
+
},
|
|
195390
|
+
warn: (msg) => prefixedLog("warn", msg)
|
|
195391
|
+
} : {
|
|
195392
|
+
log: (msg) => print("log", msg),
|
|
195393
|
+
error: (msg, err) => {
|
|
195394
|
+
print("error", msg);
|
|
195395
|
+
if (err) {
|
|
195396
|
+
print("error", String(err));
|
|
195397
|
+
}
|
|
195398
|
+
},
|
|
195399
|
+
warn: (msg) => print("warn", msg)
|
|
195400
|
+
};
|
|
195401
|
+
}
|
|
195402
|
+
|
|
195383
195403
|
// src/cli/dev/dev-server/function-manager.ts
|
|
195384
|
-
import { spawn as spawn2 } from "node:child_process";
|
|
195404
|
+
import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
|
|
195385
195405
|
import { dirname as dirname11, join as join15 } from "node:path";
|
|
195386
195406
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
195387
195407
|
var __dirname5 = dirname11(fileURLToPath7(import.meta.url));
|
|
@@ -195396,9 +195416,22 @@ class FunctionManager {
|
|
|
195396
195416
|
this.functions = new Map(functions.map((f7) => [f7.name, f7]));
|
|
195397
195417
|
this.logger = logger;
|
|
195398
195418
|
}
|
|
195419
|
+
functionNames() {
|
|
195420
|
+
return Array.from(this.functions.keys());
|
|
195421
|
+
}
|
|
195399
195422
|
getFunction(name2) {
|
|
195400
195423
|
return this.functions.get(name2);
|
|
195401
195424
|
}
|
|
195425
|
+
verifyDenoIsInstalled() {
|
|
195426
|
+
if (this.functions.size > 0) {
|
|
195427
|
+
const result = spawnSync2("deno", ["--version"]);
|
|
195428
|
+
if (result.error) {
|
|
195429
|
+
throw new DependencyNotFoundError("Deno is required to run functions", {
|
|
195430
|
+
hints: [{ message: "Install Deno from https://deno.com/download" }]
|
|
195431
|
+
});
|
|
195432
|
+
}
|
|
195433
|
+
}
|
|
195434
|
+
}
|
|
195402
195435
|
async ensureRunning(name2) {
|
|
195403
195436
|
const existing = this.running.get(name2);
|
|
195404
195437
|
if (existing?.ready) {
|
|
@@ -195406,7 +195439,9 @@ class FunctionManager {
|
|
|
195406
195439
|
}
|
|
195407
195440
|
const backendFunction = this.functions.get(name2);
|
|
195408
195441
|
if (!backendFunction) {
|
|
195409
|
-
throw new
|
|
195442
|
+
throw new InvalidInputError(`Function "${name2}" not found`, {
|
|
195443
|
+
hints: [{ message: "Check available functions in your project" }]
|
|
195444
|
+
});
|
|
195410
195445
|
}
|
|
195411
195446
|
if (existing && !existing.ready) {
|
|
195412
195447
|
return this.waitForReady(name2, existing);
|
|
@@ -195485,7 +195520,11 @@ class FunctionManager {
|
|
|
195485
195520
|
waitForReady(name2, runningFunc) {
|
|
195486
195521
|
return new Promise((resolve5, reject) => {
|
|
195487
195522
|
const timeout3 = setTimeout(() => {
|
|
195488
|
-
reject(new
|
|
195523
|
+
reject(new InternalError(`Function "${name2}" failed to start within ${READY_TIMEOUT / 1000}s timeout`, {
|
|
195524
|
+
hints: [
|
|
195525
|
+
{ message: "Check the function code for startup errors" }
|
|
195526
|
+
]
|
|
195527
|
+
}));
|
|
195489
195528
|
}, READY_TIMEOUT);
|
|
195490
195529
|
const onData = (data) => {
|
|
195491
195530
|
const output = data.toString();
|
|
@@ -195500,7 +195539,9 @@ class FunctionManager {
|
|
|
195500
195539
|
runningFunc.process.on("exit", (code2) => {
|
|
195501
195540
|
if (!runningFunc.ready) {
|
|
195502
195541
|
clearTimeout(timeout3);
|
|
195503
|
-
reject(new
|
|
195542
|
+
reject(new InternalError(`Function "${name2}" exited with code ${code2}`, {
|
|
195543
|
+
hints: [{ message: "Check the function code for errors" }]
|
|
195544
|
+
}));
|
|
195504
195545
|
}
|
|
195505
195546
|
});
|
|
195506
195547
|
});
|
|
@@ -195574,13 +195615,7 @@ function proxyRequest(req, res, port, logger) {
|
|
|
195574
195615
|
}
|
|
195575
195616
|
resolve5();
|
|
195576
195617
|
});
|
|
195577
|
-
|
|
195578
|
-
const bodyString = JSON.stringify(req.body);
|
|
195579
|
-
proxyReq.setHeader("Content-Type", "application/json");
|
|
195580
|
-
proxyReq.setHeader("Content-Length", Buffer.byteLength(bodyString));
|
|
195581
|
-
proxyReq.write(bodyString);
|
|
195582
|
-
}
|
|
195583
|
-
proxyReq.end();
|
|
195618
|
+
req.pipe(proxyReq);
|
|
195584
195619
|
});
|
|
195585
195620
|
}
|
|
195586
195621
|
|
|
@@ -195588,7 +195623,7 @@ function proxyRequest(req, res, port, logger) {
|
|
|
195588
195623
|
var DEFAULT_PORT = 4400;
|
|
195589
195624
|
var BASE44_APP_URL = "https://base44.app";
|
|
195590
195625
|
async function createDevServer(options8) {
|
|
195591
|
-
const {
|
|
195626
|
+
const { port: userPort } = options8;
|
|
195592
195627
|
const port = userPort ?? await getPorts({ port: DEFAULT_PORT });
|
|
195593
195628
|
const { project: project2 } = await readProjectConfig();
|
|
195594
195629
|
const configDir = dirname12(project2.configPath);
|
|
@@ -195609,17 +195644,18 @@ async function createDevServer(options8) {
|
|
|
195609
195644
|
}
|
|
195610
195645
|
next();
|
|
195611
195646
|
});
|
|
195612
|
-
const
|
|
195613
|
-
|
|
195614
|
-
|
|
195615
|
-
|
|
195616
|
-
|
|
195617
|
-
|
|
195647
|
+
const functions = await functionResource.readAll(join16(configDir, project2.functionsDir));
|
|
195648
|
+
const devLogger = createDevLogger(false);
|
|
195649
|
+
const functionManager = new FunctionManager(functions, devLogger);
|
|
195650
|
+
functionManager.verifyDenoIsInstalled();
|
|
195651
|
+
if (functionManager.functionNames().length > 0) {
|
|
195652
|
+
M2.info(`Loaded functions: ${functionManager.functionNames().join(", ")}`);
|
|
195653
|
+
}
|
|
195654
|
+
const functionRoutes = createFunctionRoutes(functionManager, devLogger);
|
|
195618
195655
|
app.use("/api/apps/:appId/functions", functionRoutes);
|
|
195619
195656
|
app.use((req, res, next) => {
|
|
195620
195657
|
return remoteProxy(req, res, next);
|
|
195621
195658
|
});
|
|
195622
|
-
app.use(import_express2.default.json());
|
|
195623
195659
|
return new Promise((resolve5, reject) => {
|
|
195624
195660
|
const server = app.listen(port, "127.0.0.1", (err) => {
|
|
195625
195661
|
if (err) {
|
|
@@ -195629,6 +195665,12 @@ async function createDevServer(options8) {
|
|
|
195629
195665
|
reject(err);
|
|
195630
195666
|
}
|
|
195631
195667
|
} else {
|
|
195668
|
+
const shutdown = () => {
|
|
195669
|
+
functionManager.stopAll();
|
|
195670
|
+
server.close();
|
|
195671
|
+
};
|
|
195672
|
+
process.on("SIGINT", shutdown);
|
|
195673
|
+
process.on("SIGTERM", shutdown);
|
|
195632
195674
|
resolve5({
|
|
195633
195675
|
port,
|
|
195634
195676
|
server
|
|
@@ -195642,8 +195684,7 @@ async function createDevServer(options8) {
|
|
|
195642
195684
|
async function devAction(options8) {
|
|
195643
195685
|
const port = options8.port ? Number(options8.port) : undefined;
|
|
195644
195686
|
const { port: resolvedPort } = await createDevServer({
|
|
195645
|
-
port
|
|
195646
|
-
logger: createDevLogger()
|
|
195687
|
+
port
|
|
195647
195688
|
});
|
|
195648
195689
|
return {
|
|
195649
195690
|
outroMessage: `Dev server is available at ${theme.colors.links(`http://localhost:${resolvedPort}`)}`
|
|
@@ -200034,4 +200075,4 @@ export {
|
|
|
200034
200075
|
CLIExitError
|
|
200035
200076
|
};
|
|
200036
200077
|
|
|
200037
|
-
//# debugId=
|
|
200078
|
+
//# debugId=C673BE16F37436A364756E2164756E21
|