@base44-preview/cli 0.0.41-pr.251.9240cc6 → 0.0.41-pr.251.ff9ed73
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 +97 -78
- package/dist/cli/index.js.map +11 -10
- package/package.json +3 -2
package/dist/cli/index.js
CHANGED
|
@@ -161575,7 +161575,7 @@ var require_is_promise = __commonJS((exports, module) => {
|
|
|
161575
161575
|
}
|
|
161576
161576
|
});
|
|
161577
161577
|
|
|
161578
|
-
// ../../node_modules/
|
|
161578
|
+
// ../../node_modules/path-to-regexp/dist/index.js
|
|
161579
161579
|
var require_dist = __commonJS((exports) => {
|
|
161580
161580
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
161581
161581
|
exports.PathError = exports.TokenData = undefined;
|
|
@@ -237611,11 +237611,17 @@ var STRIPE_CONNECTOR_TYPE = "stripe";
|
|
|
237611
237611
|
var InstallStripeResponseSchema = exports_external.object({
|
|
237612
237612
|
already_installed: exports_external.boolean(),
|
|
237613
237613
|
claim_url: exports_external.string().nullable()
|
|
237614
|
-
})
|
|
237614
|
+
}).transform((data) => ({
|
|
237615
|
+
alreadyInstalled: data.already_installed,
|
|
237616
|
+
claimUrl: data.claim_url
|
|
237617
|
+
}));
|
|
237615
237618
|
var StripeStatusResponseSchema = exports_external.object({
|
|
237616
237619
|
stripe_mode: exports_external.enum(["sandbox", "live"]).nullable(),
|
|
237617
237620
|
sandbox_claim_url: exports_external.string().nullable().optional()
|
|
237618
|
-
})
|
|
237621
|
+
}).transform((data) => ({
|
|
237622
|
+
stripeMode: data.stripe_mode,
|
|
237623
|
+
sandboxClaimUrl: data.sandbox_claim_url
|
|
237624
|
+
}));
|
|
237619
237625
|
var RemoveStripeResponseSchema = exports_external.object({
|
|
237620
237626
|
success: exports_external.boolean()
|
|
237621
237627
|
});
|
|
@@ -237849,17 +237855,78 @@ async function writeConnectors(connectorsDir, remoteConnectors) {
|
|
|
237849
237855
|
}
|
|
237850
237856
|
return { written, deleted };
|
|
237851
237857
|
}
|
|
237858
|
+
// src/core/resources/connector/stripe.ts
|
|
237859
|
+
async function syncStripeConnector(localStripe) {
|
|
237860
|
+
const remoteStatus = await fetchStripeRemoteStatus();
|
|
237861
|
+
if (remoteStatus === "error") {
|
|
237862
|
+
return localStripe ? stripeError("Failed to check Stripe integration status") : null;
|
|
237863
|
+
}
|
|
237864
|
+
const isRemoteInstalled = remoteStatus.stripeMode !== null;
|
|
237865
|
+
const needsInstall = localStripe && !isRemoteInstalled;
|
|
237866
|
+
const alreadySynced = localStripe && isRemoteInstalled;
|
|
237867
|
+
const needsRemoval = !localStripe && isRemoteInstalled;
|
|
237868
|
+
if (needsInstall) {
|
|
237869
|
+
return handleStripeInstall();
|
|
237870
|
+
}
|
|
237871
|
+
if (alreadySynced) {
|
|
237872
|
+
return stripeSynced();
|
|
237873
|
+
}
|
|
237874
|
+
if (needsRemoval) {
|
|
237875
|
+
return handleStripeRemoval();
|
|
237876
|
+
}
|
|
237877
|
+
return null;
|
|
237878
|
+
}
|
|
237879
|
+
async function isStripeInstalled() {
|
|
237880
|
+
const status = await getStripeStatus();
|
|
237881
|
+
return status.stripeMode !== null;
|
|
237882
|
+
}
|
|
237883
|
+
async function fetchStripeRemoteStatus() {
|
|
237884
|
+
try {
|
|
237885
|
+
return await getStripeStatus();
|
|
237886
|
+
} catch {
|
|
237887
|
+
return "error";
|
|
237888
|
+
}
|
|
237889
|
+
}
|
|
237890
|
+
async function handleStripeInstall() {
|
|
237891
|
+
try {
|
|
237892
|
+
const result = await installStripe();
|
|
237893
|
+
return stripeProvisioned(result.claimUrl ?? undefined);
|
|
237894
|
+
} catch (err) {
|
|
237895
|
+
return stripeError(err instanceof Error ? err.message : String(err));
|
|
237896
|
+
}
|
|
237897
|
+
}
|
|
237898
|
+
async function handleStripeRemoval() {
|
|
237899
|
+
try {
|
|
237900
|
+
await removeStripe();
|
|
237901
|
+
return stripeRemoved();
|
|
237902
|
+
} catch (err) {
|
|
237903
|
+
return stripeError(err instanceof Error ? err.message : String(err));
|
|
237904
|
+
}
|
|
237905
|
+
}
|
|
237906
|
+
function stripeSynced() {
|
|
237907
|
+
return { type: STRIPE_CONNECTOR_TYPE, action: "synced" };
|
|
237908
|
+
}
|
|
237909
|
+
function stripeProvisioned(claimUrl) {
|
|
237910
|
+
return { type: STRIPE_CONNECTOR_TYPE, action: "provisioned", claimUrl };
|
|
237911
|
+
}
|
|
237912
|
+
function stripeRemoved() {
|
|
237913
|
+
return { type: STRIPE_CONNECTOR_TYPE, action: "removed" };
|
|
237914
|
+
}
|
|
237915
|
+
function stripeError(error48) {
|
|
237916
|
+
return { type: STRIPE_CONNECTOR_TYPE, action: "error", error: error48 };
|
|
237917
|
+
}
|
|
237918
|
+
|
|
237852
237919
|
// src/core/resources/connector/pull.ts
|
|
237853
237920
|
async function pullAllConnectors() {
|
|
237854
|
-
const [oauthResponse,
|
|
237921
|
+
const [oauthResponse, stripeInstalled] = await Promise.all([
|
|
237855
237922
|
listConnectors(),
|
|
237856
|
-
|
|
237923
|
+
isStripeInstalled()
|
|
237857
237924
|
]);
|
|
237858
237925
|
const connectors = oauthResponse.integrations.map((i) => ({
|
|
237859
237926
|
type: i.integrationType,
|
|
237860
237927
|
scopes: i.scopes
|
|
237861
237928
|
}));
|
|
237862
|
-
if (
|
|
237929
|
+
if (stripeInstalled) {
|
|
237863
237930
|
connectors.push({ type: STRIPE_CONNECTOR_TYPE, scopes: [] });
|
|
237864
237931
|
}
|
|
237865
237932
|
return connectors;
|
|
@@ -237911,61 +237978,6 @@ async function syncOAuthConnectors(connectors) {
|
|
|
237911
237978
|
}
|
|
237912
237979
|
return results;
|
|
237913
237980
|
}
|
|
237914
|
-
async function syncStripeConnector(localStripe) {
|
|
237915
|
-
const remoteStatus = await fetchStripeRemoteStatus();
|
|
237916
|
-
if (remoteStatus === "error") {
|
|
237917
|
-
return localStripe ? stripeError("Failed to check Stripe integration status") : null;
|
|
237918
|
-
}
|
|
237919
|
-
const isRemoteInstalled = remoteStatus.stripe_mode !== null;
|
|
237920
|
-
const needsInstall = localStripe && !isRemoteInstalled;
|
|
237921
|
-
const alreadySynced = localStripe && isRemoteInstalled;
|
|
237922
|
-
const needsRemoval = !localStripe && isRemoteInstalled;
|
|
237923
|
-
if (needsInstall) {
|
|
237924
|
-
return handleStripeInstall();
|
|
237925
|
-
}
|
|
237926
|
-
if (alreadySynced) {
|
|
237927
|
-
return stripeSynced();
|
|
237928
|
-
}
|
|
237929
|
-
if (needsRemoval) {
|
|
237930
|
-
return handleStripeRemoval();
|
|
237931
|
-
}
|
|
237932
|
-
return null;
|
|
237933
|
-
}
|
|
237934
|
-
async function fetchStripeRemoteStatus() {
|
|
237935
|
-
try {
|
|
237936
|
-
return await getStripeStatus();
|
|
237937
|
-
} catch {
|
|
237938
|
-
return "error";
|
|
237939
|
-
}
|
|
237940
|
-
}
|
|
237941
|
-
async function handleStripeInstall() {
|
|
237942
|
-
try {
|
|
237943
|
-
const result = await installStripe();
|
|
237944
|
-
return stripeProvisioned(result.claim_url ?? undefined);
|
|
237945
|
-
} catch (err) {
|
|
237946
|
-
return stripeError(err instanceof Error ? err.message : String(err));
|
|
237947
|
-
}
|
|
237948
|
-
}
|
|
237949
|
-
async function handleStripeRemoval() {
|
|
237950
|
-
try {
|
|
237951
|
-
await removeStripe();
|
|
237952
|
-
return stripeRemoved();
|
|
237953
|
-
} catch (err) {
|
|
237954
|
-
return stripeError(err instanceof Error ? err.message : String(err));
|
|
237955
|
-
}
|
|
237956
|
-
}
|
|
237957
|
-
function stripeSynced() {
|
|
237958
|
-
return { type: STRIPE_CONNECTOR_TYPE, action: "synced" };
|
|
237959
|
-
}
|
|
237960
|
-
function stripeProvisioned(claimUrl) {
|
|
237961
|
-
return { type: STRIPE_CONNECTOR_TYPE, action: "provisioned", claimUrl };
|
|
237962
|
-
}
|
|
237963
|
-
function stripeRemoved() {
|
|
237964
|
-
return { type: STRIPE_CONNECTOR_TYPE, action: "removed" };
|
|
237965
|
-
}
|
|
237966
|
-
function stripeError(error48) {
|
|
237967
|
-
return { type: STRIPE_CONNECTOR_TYPE, action: "error", error: error48 };
|
|
237968
|
-
}
|
|
237969
237981
|
function getConnectorSyncResult(type, response) {
|
|
237970
237982
|
if (response.error === "different_user") {
|
|
237971
237983
|
return {
|
|
@@ -237982,7 +237994,7 @@ function getConnectorSyncResult(type, response) {
|
|
|
237982
237994
|
type,
|
|
237983
237995
|
action: "needs_oauth",
|
|
237984
237996
|
redirectUrl: response.redirectUrl,
|
|
237985
|
-
connectionId: response.connectionId ??
|
|
237997
|
+
connectionId: response.connectionId ?? undefined
|
|
237986
237998
|
};
|
|
237987
237999
|
}
|
|
237988
238000
|
return { type, action: "synced" };
|
|
@@ -238564,6 +238576,8 @@ var package_default = {
|
|
|
238564
238576
|
start: "./bin/run.js",
|
|
238565
238577
|
clean: "rm -rf dist && mkdir -p dist",
|
|
238566
238578
|
test: "vitest run",
|
|
238579
|
+
"test:npm": "CLI_TEST_RUNNER=npm vitest run",
|
|
238580
|
+
"test:binary": "CLI_TEST_RUNNER=binary vitest run",
|
|
238567
238581
|
"test:watch": "vitest",
|
|
238568
238582
|
lint: "cd ../.. && bun run lint",
|
|
238569
238583
|
"lint:fix": "cd ../.. && bun run lint:fix",
|
|
@@ -238612,7 +238626,6 @@ var package_default = {
|
|
|
238612
238626
|
json5: "^2.2.3",
|
|
238613
238627
|
ky: "^1.14.2",
|
|
238614
238628
|
lodash: "^4.17.23",
|
|
238615
|
-
msw: "^2.12.10",
|
|
238616
238629
|
multer: "^2.0.0",
|
|
238617
238630
|
nanoid: "^5.1.6",
|
|
238618
238631
|
open: "^11.0.0",
|
|
@@ -247336,6 +247349,10 @@ async function runOAuthFlowWithSkip(connector2) {
|
|
|
247336
247349
|
finalStatus = "SKIPPED";
|
|
247337
247350
|
return true;
|
|
247338
247351
|
}
|
|
247352
|
+
if (!connector2.connectionId) {
|
|
247353
|
+
finalStatus = "FAILED";
|
|
247354
|
+
return true;
|
|
247355
|
+
}
|
|
247339
247356
|
const response = await getOAuthStatus(connector2.type, connector2.connectionId);
|
|
247340
247357
|
finalStatus = response.status;
|
|
247341
247358
|
return response.status !== "PENDING";
|
|
@@ -247804,8 +247821,8 @@ ${summaryLines.join(`
|
|
|
247804
247821
|
});
|
|
247805
247822
|
const connectorResults = result.connectorResults ?? [];
|
|
247806
247823
|
await handleOAuthConnectors(connectorResults, options);
|
|
247807
|
-
const stripeResult = connectorResults.find((r) => r.
|
|
247808
|
-
if (stripeResult) {
|
|
247824
|
+
const stripeResult = connectorResults.find((r) => r.type === "stripe");
|
|
247825
|
+
if (stripeResult?.action === "provisioned") {
|
|
247809
247826
|
printStripeResult(stripeResult);
|
|
247810
247827
|
}
|
|
247811
247828
|
R2.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
|
|
@@ -248079,7 +248096,16 @@ async function getAllFunctionNames() {
|
|
|
248079
248096
|
const { functions } = await readProjectConfig();
|
|
248080
248097
|
return functions.map((fn) => fn.name);
|
|
248081
248098
|
}
|
|
248099
|
+
function validateLimit(limit) {
|
|
248100
|
+
if (limit === undefined)
|
|
248101
|
+
return;
|
|
248102
|
+
const n2 = Number.parseInt(limit, 10);
|
|
248103
|
+
if (Number.isNaN(n2) || n2 < 1 || n2 > 1000) {
|
|
248104
|
+
throw new InvalidInputError(`Invalid limit: "${limit}". Must be a number between 1 and 1000.`);
|
|
248105
|
+
}
|
|
248106
|
+
}
|
|
248082
248107
|
async function logsAction(options) {
|
|
248108
|
+
validateLimit(options.limit);
|
|
248083
248109
|
const specifiedFunctions = parseFunctionNames(options.function);
|
|
248084
248110
|
const allProjectFunctions = await getAllFunctionNames();
|
|
248085
248111
|
const functionNames = specifiedFunctions.length > 0 ? specifiedFunctions : allProjectFunctions;
|
|
@@ -248096,13 +248122,7 @@ async function logsAction(options) {
|
|
|
248096
248122
|
return { outroMessage: "Fetched logs", stdout: logsOutput };
|
|
248097
248123
|
}
|
|
248098
248124
|
function getLogsCommand(context) {
|
|
248099
|
-
return new Command("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)", (
|
|
248100
|
-
const n2 = Number.parseInt(v, 10);
|
|
248101
|
-
if (Number.isNaN(n2) || n2 < 1 || n2 > 1000) {
|
|
248102
|
-
throw new InvalidInputError(`Invalid limit: "${v}". Must be a number between 1 and 1000.`);
|
|
248103
|
-
}
|
|
248104
|
-
return v;
|
|
248105
|
-
}).addOption(new Option("--order <order>", "Sort order").choices(["asc", "desc"])).action(async (options) => {
|
|
248125
|
+
return new Command("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(async (options) => {
|
|
248106
248126
|
await runCommand(() => logsAction(options), { requireAuth: true }, context);
|
|
248107
248127
|
});
|
|
248108
248128
|
}
|
|
@@ -248168,11 +248188,9 @@ function parseEntries(entries) {
|
|
|
248168
248188
|
}
|
|
248169
248189
|
return secrets;
|
|
248170
248190
|
}
|
|
248171
|
-
function validateInput(
|
|
248172
|
-
const entries = command.args;
|
|
248173
|
-
const { envFile } = command.opts();
|
|
248191
|
+
function validateInput(entries, options) {
|
|
248174
248192
|
const hasEntries = entries.length > 0;
|
|
248175
|
-
const hasEnvFile = Boolean(envFile);
|
|
248193
|
+
const hasEnvFile = Boolean(options.envFile);
|
|
248176
248194
|
if (!hasEntries && !hasEnvFile) {
|
|
248177
248195
|
throw new InvalidInputError("Provide KEY=VALUE pairs or use --env-file. Example: base44 secrets set KEY1=VALUE1 KEY2=VALUE2");
|
|
248178
248196
|
}
|
|
@@ -248181,6 +248199,7 @@ function validateInput(command) {
|
|
|
248181
248199
|
}
|
|
248182
248200
|
}
|
|
248183
248201
|
async function setSecretsAction(entries, options) {
|
|
248202
|
+
validateInput(entries, options);
|
|
248184
248203
|
let secrets;
|
|
248185
248204
|
if (options.envFile) {
|
|
248186
248205
|
secrets = await parseEnvFile(resolve3(options.envFile));
|
|
@@ -248203,7 +248222,7 @@ async function setSecretsAction(entries, options) {
|
|
|
248203
248222
|
};
|
|
248204
248223
|
}
|
|
248205
248224
|
function getSecretsSetCommand(context) {
|
|
248206
|
-
return new Command("set").description("Set one or more secrets (KEY=VALUE format)").argument("[entries...]", "KEY=VALUE pairs (e.g. KEY1=VALUE1 KEY2=VALUE2)").option("--env-file <path>", "Path to .env file").
|
|
248225
|
+
return new Command("set").description("Set one or more secrets (KEY=VALUE format)").argument("[entries...]", "KEY=VALUE pairs (e.g. KEY1=VALUE1 KEY2=VALUE2)").option("--env-file <path>", "Path to .env file").action(async (entries, options) => {
|
|
248207
248226
|
await runCommand(() => setSecretsAction(entries, options), { requireAuth: true }, context);
|
|
248208
248227
|
});
|
|
248209
248228
|
}
|
|
@@ -255356,4 +255375,4 @@ export {
|
|
|
255356
255375
|
CLIExitError
|
|
255357
255376
|
};
|
|
255358
255377
|
|
|
255359
|
-
//# debugId=
|
|
255378
|
+
//# debugId=867E9849CE3F5C2364756E2164756E21
|