@base44-preview/cli 0.0.32-pr.249.10b4d54 → 0.0.32-pr.249.38b7e86
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 +107 -109
- package/dist/cli/index.js.map +11 -11
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -185051,6 +185051,10 @@ var TikTokConnectorSchema = exports_external.object({
|
|
|
185051
185051
|
type: exports_external.literal("tiktok"),
|
|
185052
185052
|
scopes: exports_external.array(exports_external.string()).default([])
|
|
185053
185053
|
});
|
|
185054
|
+
var GoogleBigQueryConnectorSchema = exports_external.object({
|
|
185055
|
+
type: exports_external.literal("googlebigquery"),
|
|
185056
|
+
scopes: exports_external.array(exports_external.string()).default([])
|
|
185057
|
+
});
|
|
185054
185058
|
var CustomTypeSchema = exports_external.string().min(1).regex(/^[a-z0-9_-]+$/i);
|
|
185055
185059
|
var GenericConnectorSchema = exports_external.object({
|
|
185056
185060
|
type: CustomTypeSchema,
|
|
@@ -185063,6 +185067,7 @@ var ConnectorResourceSchema = exports_external.union([
|
|
|
185063
185067
|
GoogleSheetsConnectorSchema,
|
|
185064
185068
|
GoogleDocsConnectorSchema,
|
|
185065
185069
|
GoogleSlidesConnectorSchema,
|
|
185070
|
+
GoogleBigQueryConnectorSchema,
|
|
185066
185071
|
SlackConnectorSchema,
|
|
185067
185072
|
NotionConnectorSchema,
|
|
185068
185073
|
SalesforceConnectorSchema,
|
|
@@ -185078,6 +185083,7 @@ var KnownIntegrationTypes = [
|
|
|
185078
185083
|
"googlesheets",
|
|
185079
185084
|
"googledocs",
|
|
185080
185085
|
"googleslides",
|
|
185086
|
+
"googlebigquery",
|
|
185081
185087
|
"slack",
|
|
185082
185088
|
"notion",
|
|
185083
185089
|
"salesforce",
|
|
@@ -185340,7 +185346,10 @@ var connectorResource = {
|
|
|
185340
185346
|
// src/core/resources/entity/schema.ts
|
|
185341
185347
|
var FieldConditionSchema = exports_external.union([
|
|
185342
185348
|
exports_external.string(),
|
|
185343
|
-
exports_external.
|
|
185349
|
+
exports_external.number(),
|
|
185350
|
+
exports_external.boolean(),
|
|
185351
|
+
exports_external.null(),
|
|
185352
|
+
exports_external.looseObject({
|
|
185344
185353
|
$in: exports_external.unknown().optional(),
|
|
185345
185354
|
$nin: exports_external.unknown().optional(),
|
|
185346
185355
|
$ne: exports_external.unknown().optional(),
|
|
@@ -185357,6 +185366,15 @@ var rlsConditionAllowedKeys = new Set([
|
|
|
185357
185366
|
"user_condition",
|
|
185358
185367
|
"created_by",
|
|
185359
185368
|
"created_by_id",
|
|
185369
|
+
"id",
|
|
185370
|
+
"_id",
|
|
185371
|
+
"created_date",
|
|
185372
|
+
"updated_date",
|
|
185373
|
+
"app_id",
|
|
185374
|
+
"entity_name",
|
|
185375
|
+
"is_deleted",
|
|
185376
|
+
"deleted_date",
|
|
185377
|
+
"environment",
|
|
185360
185378
|
"$or",
|
|
185361
185379
|
"$and",
|
|
185362
185380
|
"$nor"
|
|
@@ -185385,60 +185403,33 @@ var isValidFieldCondition = (value) => {
|
|
|
185385
185403
|
}
|
|
185386
185404
|
return false;
|
|
185387
185405
|
};
|
|
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");
|
|
185406
|
+
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
185407
|
var RLSRuleSchema = exports_external.union([exports_external.boolean(), RefineRLSConditionSchema]);
|
|
185398
|
-
var EntityRLSSchema = exports_external.
|
|
185408
|
+
var EntityRLSSchema = exports_external.looseObject({
|
|
185399
185409
|
create: RLSRuleSchema.optional(),
|
|
185400
185410
|
read: RLSRuleSchema.optional(),
|
|
185401
185411
|
update: RLSRuleSchema.optional(),
|
|
185402
185412
|
delete: RLSRuleSchema.optional(),
|
|
185403
185413
|
write: RLSRuleSchema.optional()
|
|
185404
185414
|
});
|
|
185405
|
-
var FieldRLSSchema = exports_external.
|
|
185415
|
+
var FieldRLSSchema = exports_external.looseObject({
|
|
185406
185416
|
read: RLSRuleSchema.optional(),
|
|
185407
185417
|
write: RLSRuleSchema.optional(),
|
|
185408
185418
|
create: RLSRuleSchema.optional(),
|
|
185409
185419
|
update: RLSRuleSchema.optional(),
|
|
185410
185420
|
delete: RLSRuleSchema.optional()
|
|
185411
185421
|
});
|
|
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,
|
|
185422
|
+
var PropertyDefinitionSchema = exports_external.looseObject({
|
|
185423
|
+
type: exports_external.string().optional(),
|
|
185433
185424
|
title: exports_external.string().optional(),
|
|
185434
185425
|
description: exports_external.string().optional(),
|
|
185435
185426
|
minLength: exports_external.number().int().min(0).optional(),
|
|
185436
185427
|
maxLength: exports_external.number().int().min(0).optional(),
|
|
185437
185428
|
pattern: exports_external.string().optional(),
|
|
185438
|
-
format:
|
|
185429
|
+
format: exports_external.string().optional(),
|
|
185439
185430
|
minimum: exports_external.number().optional(),
|
|
185440
185431
|
maximum: exports_external.number().optional(),
|
|
185441
|
-
enum: exports_external.array(exports_external.
|
|
185432
|
+
enum: exports_external.array(exports_external.unknown()).optional(),
|
|
185442
185433
|
enumNames: exports_external.array(exports_external.string()).optional(),
|
|
185443
185434
|
default: exports_external.unknown().optional(),
|
|
185444
185435
|
$ref: exports_external.string().optional(),
|
|
@@ -185451,12 +185442,12 @@ var PropertyDefinitionSchema = exports_external.object({
|
|
|
185451
185442
|
return exports_external.record(exports_external.string(), PropertyDefinitionSchema).optional();
|
|
185452
185443
|
}
|
|
185453
185444
|
});
|
|
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"),
|
|
185445
|
+
var EntitySchema = exports_external.looseObject({
|
|
185446
|
+
type: exports_external.literal("object").default("object"),
|
|
185447
|
+
name: exports_external.string().min(1).regex(/^[a-zA-Z0-9]+$/, "Entity name must be alphanumeric only"),
|
|
185457
185448
|
title: exports_external.string().optional(),
|
|
185458
185449
|
description: exports_external.string().optional(),
|
|
185459
|
-
properties: exports_external.record(exports_external.string(), PropertyDefinitionSchema),
|
|
185450
|
+
properties: exports_external.record(exports_external.string(), PropertyDefinitionSchema).default({}),
|
|
185460
185451
|
required: exports_external.array(exports_external.string()).optional(),
|
|
185461
185452
|
rls: EntityRLSSchema.optional()
|
|
185462
185453
|
});
|
|
@@ -186024,7 +186015,7 @@ async function handleUnauthorized(request, _options, response) {
|
|
|
186024
186015
|
return;
|
|
186025
186016
|
}
|
|
186026
186017
|
retriedRequests.add(request);
|
|
186027
|
-
return distribution_default(request, {
|
|
186018
|
+
return distribution_default(request.clone(), {
|
|
186028
186019
|
headers: { Authorization: `Bearer ${newAccessToken}` }
|
|
186029
186020
|
});
|
|
186030
186021
|
}
|
|
@@ -195206,58 +195197,6 @@ function getTypesCommand(context) {
|
|
|
195206
195197
|
return new Command("types").description("Manage TypeScript type generation").addCommand(getTypesGenerateCommand(context));
|
|
195207
195198
|
}
|
|
195208
195199
|
|
|
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
195200
|
// src/cli/dev/dev-server/main.ts
|
|
195262
195201
|
var import_cors = __toESM(require_lib4(), 1);
|
|
195263
195202
|
var import_express2 = __toESM(require_express(), 1);
|
|
@@ -195380,6 +195319,58 @@ async function getPorts(options8) {
|
|
|
195380
195319
|
// src/cli/dev/dev-server/main.ts
|
|
195381
195320
|
var import_http_proxy_middleware = __toESM(require_dist2(), 1);
|
|
195382
195321
|
|
|
195322
|
+
// src/cli/dev/createDevLogger.ts
|
|
195323
|
+
var dateTimeFormat = new Intl.DateTimeFormat([], {
|
|
195324
|
+
hour: "2-digit",
|
|
195325
|
+
minute: "2-digit",
|
|
195326
|
+
second: "2-digit",
|
|
195327
|
+
hour12: false
|
|
195328
|
+
});
|
|
195329
|
+
var colorByType = {
|
|
195330
|
+
error: source_default.red,
|
|
195331
|
+
warn: source_default.yellow,
|
|
195332
|
+
log: (text) => text
|
|
195333
|
+
};
|
|
195334
|
+
function createDevLogger(isPrefixed = true) {
|
|
195335
|
+
const print = (type, msg) => {
|
|
195336
|
+
const colorize = colorByType[type];
|
|
195337
|
+
switch (type) {
|
|
195338
|
+
case "error":
|
|
195339
|
+
console.error(colorize(msg));
|
|
195340
|
+
break;
|
|
195341
|
+
case "warn":
|
|
195342
|
+
console.warn(colorize(msg));
|
|
195343
|
+
break;
|
|
195344
|
+
default:
|
|
195345
|
+
console.log(msg);
|
|
195346
|
+
}
|
|
195347
|
+
};
|
|
195348
|
+
const prefixedLog = (type, msg) => {
|
|
195349
|
+
const timestamp = dateTimeFormat.format(new Date);
|
|
195350
|
+
const colorize = colorByType[type];
|
|
195351
|
+
console.log(`${source_default.gray(timestamp)} ${colorize(msg)}`);
|
|
195352
|
+
};
|
|
195353
|
+
return isPrefixed ? {
|
|
195354
|
+
log: (msg) => prefixedLog("log", msg),
|
|
195355
|
+
error: (msg, err) => {
|
|
195356
|
+
prefixedLog("error", msg);
|
|
195357
|
+
if (err) {
|
|
195358
|
+
prefixedLog("error", String(err));
|
|
195359
|
+
}
|
|
195360
|
+
},
|
|
195361
|
+
warn: (msg) => prefixedLog("warn", msg)
|
|
195362
|
+
} : {
|
|
195363
|
+
log: (msg) => print("log", msg),
|
|
195364
|
+
error: (msg, err) => {
|
|
195365
|
+
print("error", msg);
|
|
195366
|
+
if (err) {
|
|
195367
|
+
print("error", String(err));
|
|
195368
|
+
}
|
|
195369
|
+
},
|
|
195370
|
+
warn: (msg) => print("warn", msg)
|
|
195371
|
+
};
|
|
195372
|
+
}
|
|
195373
|
+
|
|
195383
195374
|
// src/cli/dev/dev-server/function-manager.ts
|
|
195384
195375
|
import { spawn as spawn2 } from "node:child_process";
|
|
195385
195376
|
import { dirname as dirname11, join as join15 } from "node:path";
|
|
@@ -195396,8 +195387,17 @@ class FunctionManager {
|
|
|
195396
195387
|
this.functions = new Map(functions.map((f7) => [f7.name, f7]));
|
|
195397
195388
|
this.logger = logger;
|
|
195398
195389
|
}
|
|
195399
|
-
|
|
195400
|
-
return this.functions.
|
|
195390
|
+
functionNames() {
|
|
195391
|
+
return Array.from(this.functions.keys());
|
|
195392
|
+
}
|
|
195393
|
+
verifyDenoIsInstalled() {
|
|
195394
|
+
if (this.functions.size > 0) {
|
|
195395
|
+
try {
|
|
195396
|
+
spawn2("deno", ["--version"]);
|
|
195397
|
+
} catch {
|
|
195398
|
+
throw new Error("Deno is required to run functions. Please install it from https://deno.com/download");
|
|
195399
|
+
}
|
|
195400
|
+
}
|
|
195401
195401
|
}
|
|
195402
195402
|
async ensureRunning(name2) {
|
|
195403
195403
|
const existing = this.running.get(name2);
|
|
@@ -195574,13 +195574,7 @@ function proxyRequest(req, res, port, logger) {
|
|
|
195574
195574
|
}
|
|
195575
195575
|
resolve5();
|
|
195576
195576
|
});
|
|
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();
|
|
195577
|
+
req.pipe(proxyReq);
|
|
195584
195578
|
});
|
|
195585
195579
|
}
|
|
195586
195580
|
|
|
@@ -195588,7 +195582,7 @@ function proxyRequest(req, res, port, logger) {
|
|
|
195588
195582
|
var DEFAULT_PORT = 4400;
|
|
195589
195583
|
var BASE44_APP_URL = "https://base44.app";
|
|
195590
195584
|
async function createDevServer(options8) {
|
|
195591
|
-
const {
|
|
195585
|
+
const { port: userPort } = options8;
|
|
195592
195586
|
const port = userPort ?? await getPorts({ port: DEFAULT_PORT });
|
|
195593
195587
|
const { project: project2 } = await readProjectConfig();
|
|
195594
195588
|
const configDir = dirname12(project2.configPath);
|
|
@@ -195612,14 +195606,14 @@ async function createDevServer(options8) {
|
|
|
195612
195606
|
const [functions] = await Promise.all([
|
|
195613
195607
|
functionResource.readAll(join16(configDir, project2.functionsDir))
|
|
195614
195608
|
]);
|
|
195615
|
-
const
|
|
195616
|
-
|
|
195617
|
-
|
|
195609
|
+
const devLogger = createDevLogger(false);
|
|
195610
|
+
const functionManager = new FunctionManager(functions, devLogger);
|
|
195611
|
+
functionManager.verifyDenoIsInstalled();
|
|
195612
|
+
const functionRoutes = createFunctionRoutes(functionManager, devLogger);
|
|
195618
195613
|
app.use("/api/apps/:appId/functions", functionRoutes);
|
|
195619
195614
|
app.use((req, res, next) => {
|
|
195620
195615
|
return remoteProxy(req, res, next);
|
|
195621
195616
|
});
|
|
195622
|
-
app.use(import_express2.default.json());
|
|
195623
195617
|
return new Promise((resolve5, reject) => {
|
|
195624
195618
|
const server = app.listen(port, "127.0.0.1", (err) => {
|
|
195625
195619
|
if (err) {
|
|
@@ -195628,6 +195622,11 @@ async function createDevServer(options8) {
|
|
|
195628
195622
|
} else {
|
|
195629
195623
|
reject(err);
|
|
195630
195624
|
}
|
|
195625
|
+
const shutdown = () => {
|
|
195626
|
+
functionManager.stopAll();
|
|
195627
|
+
};
|
|
195628
|
+
process.on("SIGINT", shutdown);
|
|
195629
|
+
process.on("SIGTERM", shutdown);
|
|
195631
195630
|
} else {
|
|
195632
195631
|
resolve5({
|
|
195633
195632
|
port,
|
|
@@ -195642,8 +195641,7 @@ async function createDevServer(options8) {
|
|
|
195642
195641
|
async function devAction(options8) {
|
|
195643
195642
|
const port = options8.port ? Number(options8.port) : undefined;
|
|
195644
195643
|
const { port: resolvedPort } = await createDevServer({
|
|
195645
|
-
port
|
|
195646
|
-
logger: createDevLogger()
|
|
195644
|
+
port
|
|
195647
195645
|
});
|
|
195648
195646
|
return {
|
|
195649
195647
|
outroMessage: `Dev server is available at ${theme.colors.links(`http://localhost:${resolvedPort}`)}`
|
|
@@ -200034,4 +200032,4 @@ export {
|
|
|
200034
200032
|
CLIExitError
|
|
200035
200033
|
};
|
|
200036
200034
|
|
|
200037
|
-
//# debugId=
|
|
200035
|
+
//# debugId=F7187C428A4270E164756E2164756E21
|