@base44-preview/cli 0.0.32-pr.249.4251a52 → 0.0.32-pr.249.535f2a7
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 +171 -118
- 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));
|
|
@@ -195391,26 +195411,52 @@ var READY_TIMEOUT = 30000;
|
|
|
195391
195411
|
class FunctionManager {
|
|
195392
195412
|
functions;
|
|
195393
195413
|
running = new Map;
|
|
195414
|
+
starting = new Map;
|
|
195394
195415
|
logger;
|
|
195395
195416
|
constructor(functions, logger) {
|
|
195396
195417
|
this.functions = new Map(functions.map((f7) => [f7.name, f7]));
|
|
195397
195418
|
this.logger = logger;
|
|
195398
195419
|
}
|
|
195420
|
+
functionNames() {
|
|
195421
|
+
return Array.from(this.functions.keys());
|
|
195422
|
+
}
|
|
195399
195423
|
getFunction(name2) {
|
|
195400
195424
|
return this.functions.get(name2);
|
|
195401
195425
|
}
|
|
195426
|
+
verifyDenoIsInstalled() {
|
|
195427
|
+
if (this.functions.size > 0) {
|
|
195428
|
+
const result = spawnSync2("deno", ["--version"]);
|
|
195429
|
+
if (result.error) {
|
|
195430
|
+
throw new DependencyNotFoundError("Deno is required to run functions", {
|
|
195431
|
+
hints: [{ message: "Install Deno from https://deno.com/download" }]
|
|
195432
|
+
});
|
|
195433
|
+
}
|
|
195434
|
+
}
|
|
195435
|
+
}
|
|
195402
195436
|
async ensureRunning(name2) {
|
|
195403
195437
|
const existing = this.running.get(name2);
|
|
195404
195438
|
if (existing?.ready) {
|
|
195405
195439
|
return existing.port;
|
|
195406
195440
|
}
|
|
195441
|
+
const pending = this.starting.get(name2);
|
|
195442
|
+
if (pending) {
|
|
195443
|
+
return pending;
|
|
195444
|
+
}
|
|
195407
195445
|
const backendFunction = this.functions.get(name2);
|
|
195408
195446
|
if (!backendFunction) {
|
|
195409
|
-
throw new
|
|
195447
|
+
throw new InvalidInputError(`Function "${name2}" not found`, {
|
|
195448
|
+
hints: [{ message: "Check available functions in your project" }]
|
|
195449
|
+
});
|
|
195410
195450
|
}
|
|
195411
|
-
|
|
195412
|
-
|
|
195451
|
+
const promise2 = this.startFunction(name2, backendFunction);
|
|
195452
|
+
this.starting.set(name2, promise2);
|
|
195453
|
+
try {
|
|
195454
|
+
return await promise2;
|
|
195455
|
+
} finally {
|
|
195456
|
+
this.starting.delete(name2);
|
|
195413
195457
|
}
|
|
195458
|
+
}
|
|
195459
|
+
async startFunction(name2, backendFunction) {
|
|
195414
195460
|
const port = await this.allocatePort();
|
|
195415
195461
|
const process21 = this.spawnFunction(backendFunction, port);
|
|
195416
195462
|
const runningFunc = {
|
|
@@ -195432,6 +195478,7 @@ class FunctionManager {
|
|
|
195432
195478
|
process21.kill();
|
|
195433
195479
|
}
|
|
195434
195480
|
this.running.clear();
|
|
195481
|
+
this.starting.clear();
|
|
195435
195482
|
}
|
|
195436
195483
|
stop(name2) {
|
|
195437
195484
|
const running = this.running.get(name2);
|
|
@@ -195485,7 +195532,11 @@ class FunctionManager {
|
|
|
195485
195532
|
waitForReady(name2, runningFunc) {
|
|
195486
195533
|
return new Promise((resolve5, reject) => {
|
|
195487
195534
|
const timeout3 = setTimeout(() => {
|
|
195488
|
-
reject(new
|
|
195535
|
+
reject(new InternalError(`Function "${name2}" failed to start within ${READY_TIMEOUT / 1000}s timeout`, {
|
|
195536
|
+
hints: [
|
|
195537
|
+
{ message: "Check the function code for startup errors" }
|
|
195538
|
+
]
|
|
195539
|
+
}));
|
|
195489
195540
|
}, READY_TIMEOUT);
|
|
195490
195541
|
const onData = (data) => {
|
|
195491
195542
|
const output = data.toString();
|
|
@@ -195500,7 +195551,9 @@ class FunctionManager {
|
|
|
195500
195551
|
runningFunc.process.on("exit", (code2) => {
|
|
195501
195552
|
if (!runningFunc.ready) {
|
|
195502
195553
|
clearTimeout(timeout3);
|
|
195503
|
-
reject(new
|
|
195554
|
+
reject(new InternalError(`Function "${name2}" exited with code ${code2}`, {
|
|
195555
|
+
hints: [{ message: "Check the function code for errors" }]
|
|
195556
|
+
}));
|
|
195504
195557
|
}
|
|
195505
195558
|
});
|
|
195506
195559
|
});
|
|
@@ -195574,13 +195627,7 @@ function proxyRequest(req, res, port, logger) {
|
|
|
195574
195627
|
}
|
|
195575
195628
|
resolve5();
|
|
195576
195629
|
});
|
|
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();
|
|
195630
|
+
req.pipe(proxyReq);
|
|
195584
195631
|
});
|
|
195585
195632
|
}
|
|
195586
195633
|
|
|
@@ -195588,7 +195635,7 @@ function proxyRequest(req, res, port, logger) {
|
|
|
195588
195635
|
var DEFAULT_PORT = 4400;
|
|
195589
195636
|
var BASE44_APP_URL = "https://base44.app";
|
|
195590
195637
|
async function createDevServer(options8) {
|
|
195591
|
-
const {
|
|
195638
|
+
const { port: userPort } = options8;
|
|
195592
195639
|
const port = userPort ?? await getPorts({ port: DEFAULT_PORT });
|
|
195593
195640
|
const { project: project2 } = await readProjectConfig();
|
|
195594
195641
|
const configDir = dirname12(project2.configPath);
|
|
@@ -195609,17 +195656,18 @@ async function createDevServer(options8) {
|
|
|
195609
195656
|
}
|
|
195610
195657
|
next();
|
|
195611
195658
|
});
|
|
195612
|
-
const
|
|
195613
|
-
|
|
195614
|
-
|
|
195615
|
-
|
|
195616
|
-
|
|
195617
|
-
|
|
195659
|
+
const functions = await functionResource.readAll(join16(configDir, project2.functionsDir));
|
|
195660
|
+
const devLogger = createDevLogger(false);
|
|
195661
|
+
const functionManager = new FunctionManager(functions, devLogger);
|
|
195662
|
+
functionManager.verifyDenoIsInstalled();
|
|
195663
|
+
if (functionManager.functionNames().length > 0) {
|
|
195664
|
+
M2.info(`Loaded functions: ${functionManager.functionNames().join(", ")}`);
|
|
195665
|
+
}
|
|
195666
|
+
const functionRoutes = createFunctionRoutes(functionManager, devLogger);
|
|
195618
195667
|
app.use("/api/apps/:appId/functions", functionRoutes);
|
|
195619
195668
|
app.use((req, res, next) => {
|
|
195620
195669
|
return remoteProxy(req, res, next);
|
|
195621
195670
|
});
|
|
195622
|
-
app.use(import_express2.default.json());
|
|
195623
195671
|
return new Promise((resolve5, reject) => {
|
|
195624
195672
|
const server = app.listen(port, "127.0.0.1", (err) => {
|
|
195625
195673
|
if (err) {
|
|
@@ -195629,6 +195677,12 @@ async function createDevServer(options8) {
|
|
|
195629
195677
|
reject(err);
|
|
195630
195678
|
}
|
|
195631
195679
|
} else {
|
|
195680
|
+
const shutdown = () => {
|
|
195681
|
+
functionManager.stopAll();
|
|
195682
|
+
server.close();
|
|
195683
|
+
};
|
|
195684
|
+
process.on("SIGINT", shutdown);
|
|
195685
|
+
process.on("SIGTERM", shutdown);
|
|
195632
195686
|
resolve5({
|
|
195633
195687
|
port,
|
|
195634
195688
|
server
|
|
@@ -195642,8 +195696,7 @@ async function createDevServer(options8) {
|
|
|
195642
195696
|
async function devAction(options8) {
|
|
195643
195697
|
const port = options8.port ? Number(options8.port) : undefined;
|
|
195644
195698
|
const { port: resolvedPort } = await createDevServer({
|
|
195645
|
-
port
|
|
195646
|
-
logger: createDevLogger()
|
|
195699
|
+
port
|
|
195647
195700
|
});
|
|
195648
195701
|
return {
|
|
195649
195702
|
outroMessage: `Dev server is available at ${theme.colors.links(`http://localhost:${resolvedPort}`)}`
|
|
@@ -200034,4 +200087,4 @@ export {
|
|
|
200034
200087
|
CLIExitError
|
|
200035
200088
|
};
|
|
200036
200089
|
|
|
200037
|
-
//# debugId=
|
|
200090
|
+
//# debugId=10D47D308F001A4164756E2164756E21
|