@base44-preview/cli 0.1.22-pr.644.9e3658d → 0.1.23-pr.645.f7a2f42
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
CHANGED
|
@@ -228810,7 +228810,7 @@ function normalizeBase44Env() {
|
|
|
228810
228810
|
loadProjectEnvFiles();
|
|
228811
228811
|
|
|
228812
228812
|
// src/cli/index.ts
|
|
228813
|
-
import { dirname as dirname29, join as
|
|
228813
|
+
import { dirname as dirname29, join as join40 } from "node:path";
|
|
228814
228814
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
228815
228815
|
|
|
228816
228816
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -239265,7 +239265,7 @@ import { join as join13 } from "node:path";
|
|
|
239265
239265
|
// package.json
|
|
239266
239266
|
var package_default = {
|
|
239267
239267
|
name: "base44",
|
|
239268
|
-
version: "0.1.
|
|
239268
|
+
version: "0.1.23",
|
|
239269
239269
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
239270
239270
|
type: "module",
|
|
239271
239271
|
bin: {
|
|
@@ -247411,8 +247411,7 @@ class Base44Command extends Command2 {
|
|
|
247411
247411
|
if (branch !== undefined && !branch.trim()) {
|
|
247412
247412
|
throw new InvalidInputError("--branch must not be empty.");
|
|
247413
247413
|
}
|
|
247414
|
-
|
|
247415
|
-
if (typeof requireAuth === "function" ? requireAuth() : requireAuth) {
|
|
247414
|
+
if (this._commandOptions.requireAuth) {
|
|
247416
247415
|
await ensureAuth(this.context);
|
|
247417
247416
|
}
|
|
247418
247417
|
if (this._commandOptions.requireAppContext) {
|
|
@@ -256173,11 +256172,20 @@ var EXEC_ENV_VARS = [
|
|
|
256173
256172
|
SERVER_URL_VAR,
|
|
256174
256173
|
SERVICE_TOKEN_VAR
|
|
256175
256174
|
];
|
|
256176
|
-
var PRIVILEGED_ENV_VAR = "
|
|
256177
|
-
var DATA_ENV_ENV_VAR = "
|
|
256175
|
+
var PRIVILEGED_ENV_VAR = "BASE44_PRIVILEGED";
|
|
256176
|
+
var DATA_ENV_ENV_VAR = "BASE44_DATA_ENV";
|
|
256178
256177
|
function read3(env, name) {
|
|
256179
256178
|
return env[name]?.trim() || undefined;
|
|
256180
256179
|
}
|
|
256180
|
+
var SDK_VERSION_VAR = "BASE44_EXEC_SDK_VERSION";
|
|
256181
|
+
var SDK_VERSION_RE = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
256182
|
+
function readExecSdkVersion(env = process.env) {
|
|
256183
|
+
const version = read3(env, SDK_VERSION_VAR);
|
|
256184
|
+
if (version && !SDK_VERSION_RE.test(version)) {
|
|
256185
|
+
throw new InvalidInputError(`${SDK_VERSION_VAR} must be an exact version such as 0.8.52.`);
|
|
256186
|
+
}
|
|
256187
|
+
return version;
|
|
256188
|
+
}
|
|
256181
256189
|
function hasExecEnvTarget(env = process.env) {
|
|
256182
256190
|
return EXEC_ENV_VARS.some((name) => read3(env, name) !== undefined);
|
|
256183
256191
|
}
|
|
@@ -256205,7 +256213,16 @@ function readExecEnvTarget(env = process.env) {
|
|
|
256205
256213
|
}
|
|
256206
256214
|
// src/core/exec/run-script.ts
|
|
256207
256215
|
import { spawn as spawn4 } from "node:child_process";
|
|
256208
|
-
import {
|
|
256216
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "node:fs";
|
|
256217
|
+
import { join as join39 } from "node:path";
|
|
256218
|
+
var SDK_SPECIFIER = '"npm:@base44/sdk"';
|
|
256219
|
+
function wrapperSource(sdkVersion) {
|
|
256220
|
+
const source = readFileSync3(getExecWrapperPath(), "utf-8");
|
|
256221
|
+
return sdkVersion ? source.replace(SDK_SPECIFIER, `"npm:@base44/sdk@${sdkVersion}"`) : source;
|
|
256222
|
+
}
|
|
256223
|
+
var DENO_CONFIG = {
|
|
256224
|
+
minimumDependencyAge: { exclude: ["npm:@base44/sdk"] }
|
|
256225
|
+
};
|
|
256209
256226
|
var SERVICE_TOKEN_ENV = "BASE44_SERVICE_TOKEN";
|
|
256210
256227
|
function inheritedEnv() {
|
|
256211
256228
|
const env = { ...process.env };
|
|
@@ -256220,7 +256237,7 @@ function inheritedEnv() {
|
|
|
256220
256237
|
return env;
|
|
256221
256238
|
}
|
|
256222
256239
|
async function runScript(options) {
|
|
256223
|
-
const { appId, code, local, privileged, dataEnv, serviceToken } = options;
|
|
256240
|
+
const { appId, code, local, privileged, dataEnv, serviceToken, sdkVersion } = options;
|
|
256224
256241
|
verifyDenoInstalled("to run scripts with exec");
|
|
256225
256242
|
const cleanupFns = [];
|
|
256226
256243
|
const tempScript = await $file({ postfix: ".ts" });
|
|
@@ -256230,10 +256247,21 @@ async function runScript(options) {
|
|
|
256230
256247
|
const [appUserToken, appBaseUrl] = local ? [local.token, local.serverUrl] : await Promise.all([getAppUserToken(), getSiteUrl()]);
|
|
256231
256248
|
const tempWrapper = await $file({ postfix: ".ts" });
|
|
256232
256249
|
cleanupFns.push(tempWrapper.cleanup);
|
|
256233
|
-
|
|
256250
|
+
writeFileSync3(tempWrapper.path, wrapperSource(sdkVersion), "utf-8");
|
|
256251
|
+
const configDir = await $dir({ unsafeCleanup: true });
|
|
256252
|
+
cleanupFns.push(configDir.cleanup);
|
|
256253
|
+
const configPath = join39(configDir.path, "deno.json");
|
|
256254
|
+
writeFileSync3(configPath, JSON.stringify(DENO_CONFIG), "utf-8");
|
|
256234
256255
|
try {
|
|
256235
256256
|
const exitCode = await new Promise((resolvePromise) => {
|
|
256236
|
-
const child = spawn4("deno", [
|
|
256257
|
+
const child = spawn4("deno", [
|
|
256258
|
+
"run",
|
|
256259
|
+
"--allow-all",
|
|
256260
|
+
"--node-modules-dir=none",
|
|
256261
|
+
"--config",
|
|
256262
|
+
configPath,
|
|
256263
|
+
tempWrapper.path
|
|
256264
|
+
], {
|
|
256237
256265
|
env: {
|
|
256238
256266
|
...inheritedEnv(),
|
|
256239
256267
|
...serviceToken ? { [SERVICE_TOKEN_ENV]: serviceToken } : {},
|
|
@@ -256292,6 +256320,7 @@ async function execAction({ app, isNonInteractive }, options) {
|
|
|
256292
256320
|
});
|
|
256293
256321
|
}
|
|
256294
256322
|
const envTarget = readExecEnvTarget();
|
|
256323
|
+
const sdkVersion = readExecSdkVersion();
|
|
256295
256324
|
if (envTarget && options.local) {
|
|
256296
256325
|
throw new InvalidInputError("--local cannot be used when BASE44_EXEC_ACCESS_TOKEN and BASE44_EXEC_SERVER_URL are set.");
|
|
256297
256326
|
}
|
|
@@ -256317,7 +256346,8 @@ async function execAction({ app, isNonInteractive }, options) {
|
|
|
256317
256346
|
local,
|
|
256318
256347
|
privileged: options.privileged,
|
|
256319
256348
|
dataEnv: options.dataEnv,
|
|
256320
|
-
serviceToken: envTarget?.serviceToken
|
|
256349
|
+
serviceToken: envTarget?.serviceToken,
|
|
256350
|
+
sdkVersion
|
|
256321
256351
|
});
|
|
256322
256352
|
if (exitCode !== 0) {
|
|
256323
256353
|
process.exitCode = exitCode;
|
|
@@ -256325,7 +256355,7 @@ async function execAction({ app, isNonInteractive }, options) {
|
|
|
256325
256355
|
return {};
|
|
256326
256356
|
}
|
|
256327
256357
|
function getExecCommand() {
|
|
256328
|
-
return new Base44Command("exec", { requireAuth:
|
|
256358
|
+
return new Base44Command("exec", { requireAuth: !hasExecEnvTarget() }).description("Run a script with the Base44 SDK pre-authenticated as the current user").option("--local", "Run against the local `base44 dev` server instead of the deployed app").option("--port <number>", `Port the local dev server is on (with --local; defaults to ${DEFAULT_DEV_SERVER_PORT})`).addOption(new Option2("--privileged", "Run with admin privileges (bypass RLS). Requires app owner/editor role.").env(PRIVILEGED_ENV_VAR)).addOption(new Option2("--data-env <environment>", "Data environment to run against (e.g. dev, prod)").env(DATA_ENV_ENV_VAR)).addHelpText("after", `
|
|
256329
256359
|
Examples:
|
|
256330
256360
|
Run a script file:
|
|
256331
256361
|
$ cat ./script.ts | base44 exec
|
|
@@ -256337,15 +256367,7 @@ Examples:
|
|
|
256337
256367
|
$ echo "await base44.entities.Task.create({ title: 'seed' })" | base44 exec --local
|
|
256338
256368
|
|
|
256339
256369
|
With privileged access (bypass RLS):
|
|
256340
|
-
$ echo "const all = await base44.entities.Task.list()" | base44 exec --privileged
|
|
256341
|
-
|
|
256342
|
-
Environment (for sandboxes and agents; no login or linked project needed):
|
|
256343
|
-
BASE44_EXEC_ACCESS_TOKEN App-user token for the SDK (requires BASE44_EXEC_SERVER_URL)
|
|
256344
|
-
BASE44_EXEC_SERVER_URL SDK server URL (requires BASE44_EXEC_ACCESS_TOKEN)
|
|
256345
|
-
BASE44_EXEC_SERVICE_TOKEN Optional service token, enables base44.asServiceRole
|
|
256346
|
-
BASE44_EXEC_PRIVILEGED Same as --privileged (set to any value to enable)
|
|
256347
|
-
BASE44_EXEC_DATA_ENV Same as --data-env
|
|
256348
|
-
The app id comes from --app-id or BASE44_APP_ID.`).action(execAction);
|
|
256370
|
+
$ echo "const all = await base44.entities.Task.list()" | base44 exec --privileged`).action(execAction);
|
|
256349
256371
|
}
|
|
256350
256372
|
|
|
256351
256373
|
// src/cli/commands/project/eject.ts
|
|
@@ -260518,7 +260540,7 @@ function addCommandInfoToErrorReporter(program, errorReporter) {
|
|
|
260518
260540
|
// src/cli/index.ts
|
|
260519
260541
|
var __dirname4 = dirname29(fileURLToPath6(import.meta.url));
|
|
260520
260542
|
async function runCLI(options) {
|
|
260521
|
-
ensureNpmAssets(
|
|
260543
|
+
ensureNpmAssets(join40(__dirname4, "../assets"));
|
|
260522
260544
|
const errorReporter = new ErrorReporter;
|
|
260523
260545
|
errorReporter.registerProcessErrorHandlers();
|
|
260524
260546
|
const jsonMode = process.argv.includes("--json");
|
|
@@ -260557,4 +260579,4 @@ export {
|
|
|
260557
260579
|
runCLI
|
|
260558
260580
|
};
|
|
260559
260581
|
|
|
260560
|
-
//# debugId=
|
|
260582
|
+
//# debugId=8A5040C39B05EA0064756E2164756E21
|