@base44-preview/cli 0.0.32-pr.265.0f5b7f8 → 0.0.32-pr.265.70e37a9
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 +54 -59
- package/dist/cli/index.js.map +7 -7
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -185663,60 +185663,10 @@ async function pushFunctions(functions) {
|
|
|
185663
185663
|
const functionsWithCode = await Promise.all(functions.map(loadFunctionCode));
|
|
185664
185664
|
return deployFunctions(functionsWithCode);
|
|
185665
185665
|
}
|
|
185666
|
-
// src/core/site/schema.ts
|
|
185667
|
-
var DeployResponseSchema = exports_external.object({
|
|
185668
|
-
app_url: exports_external.url()
|
|
185669
|
-
}).transform((data) => ({
|
|
185670
|
-
appUrl: data.app_url
|
|
185671
|
-
}));
|
|
185672
|
-
var PublishedUrlResponseSchema = exports_external.object({
|
|
185673
|
-
url: exports_external.string()
|
|
185674
|
-
});
|
|
185675
|
-
|
|
185676
|
-
// src/core/site/api.ts
|
|
185677
|
-
async function uploadSite(archivePath) {
|
|
185678
|
-
const archiveBuffer = await readFile(archivePath);
|
|
185679
|
-
const blob = new Blob([archiveBuffer], { type: "application/gzip" });
|
|
185680
|
-
const formData = new FormData;
|
|
185681
|
-
formData.append("file", blob, "dist.tar.gz");
|
|
185682
|
-
const appClient = getAppClient();
|
|
185683
|
-
let response;
|
|
185684
|
-
try {
|
|
185685
|
-
response = await appClient.post("deploy-dist", {
|
|
185686
|
-
body: formData,
|
|
185687
|
-
timeout: 180000
|
|
185688
|
-
});
|
|
185689
|
-
} catch (error48) {
|
|
185690
|
-
throw await ApiError.fromHttpError(error48, "deploying site");
|
|
185691
|
-
}
|
|
185692
|
-
const result = DeployResponseSchema.safeParse(await response.json());
|
|
185693
|
-
if (!result.success) {
|
|
185694
|
-
throw new SchemaValidationError("There was an issue deploying your site", result.error);
|
|
185695
|
-
}
|
|
185696
|
-
return result.data;
|
|
185697
|
-
}
|
|
185698
|
-
async function getSiteUrl(projectId) {
|
|
185699
|
-
const id = projectId ?? getAppConfig().id;
|
|
185700
|
-
let response;
|
|
185701
|
-
try {
|
|
185702
|
-
response = await base44Client.get(`api/apps/platform/${id}/published-url`);
|
|
185703
|
-
} catch (error48) {
|
|
185704
|
-
throw await ApiError.fromHttpError(error48, "fetching site URL");
|
|
185705
|
-
}
|
|
185706
|
-
const result = PublishedUrlResponseSchema.safeParse(await response.json());
|
|
185707
|
-
if (!result.success) {
|
|
185708
|
-
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
185709
|
-
}
|
|
185710
|
-
return result.data.url;
|
|
185711
|
-
}
|
|
185712
|
-
|
|
185713
185666
|
// src/core/resources/function/invoke.ts
|
|
185714
|
-
var
|
|
185667
|
+
var APP_DOMAIN_BASE_URL = process.env.BASE44_APP_URL || "https://base44.app";
|
|
185715
185668
|
async function invokeFunction(functionName, data, options) {
|
|
185716
185669
|
const { id } = getAppConfig();
|
|
185717
|
-
const method = options?.method?.toUpperCase() ?? "POST";
|
|
185718
|
-
const siteUrl = await getSiteUrl();
|
|
185719
|
-
const url2 = `${siteUrl.replace(/\/+$/, "")}/api/functions/${functionName}`;
|
|
185720
185670
|
const auth = await readAuth();
|
|
185721
185671
|
let token = auth.accessToken;
|
|
185722
185672
|
if (isTokenExpired(auth)) {
|
|
@@ -185725,9 +185675,8 @@ async function invokeFunction(functionName, data, options) {
|
|
|
185725
185675
|
token = refreshed;
|
|
185726
185676
|
}
|
|
185727
185677
|
}
|
|
185728
|
-
const response = await distribution_default(
|
|
185729
|
-
|
|
185730
|
-
...METHODS_WITH_BODY.has(method) ? { json: data } : {},
|
|
185678
|
+
const response = await distribution_default.post(`${APP_DOMAIN_BASE_URL}/api/apps/${id}/functions/${functionName}`, {
|
|
185679
|
+
json: data,
|
|
185731
185680
|
headers: {
|
|
185732
185681
|
Authorization: `Bearer ${token}`,
|
|
185733
185682
|
"X-App-Id": id,
|
|
@@ -185952,6 +185901,53 @@ async function createProjectFilesForExistingProject(options) {
|
|
|
185952
185901
|
}
|
|
185953
185902
|
// src/core/project/deploy.ts
|
|
185954
185903
|
import { resolve } from "node:path";
|
|
185904
|
+
|
|
185905
|
+
// src/core/site/schema.ts
|
|
185906
|
+
var DeployResponseSchema = exports_external.object({
|
|
185907
|
+
app_url: exports_external.url()
|
|
185908
|
+
}).transform((data) => ({
|
|
185909
|
+
appUrl: data.app_url
|
|
185910
|
+
}));
|
|
185911
|
+
var PublishedUrlResponseSchema = exports_external.object({
|
|
185912
|
+
url: exports_external.string()
|
|
185913
|
+
});
|
|
185914
|
+
|
|
185915
|
+
// src/core/site/api.ts
|
|
185916
|
+
async function uploadSite(archivePath) {
|
|
185917
|
+
const archiveBuffer = await readFile(archivePath);
|
|
185918
|
+
const blob = new Blob([archiveBuffer], { type: "application/gzip" });
|
|
185919
|
+
const formData = new FormData;
|
|
185920
|
+
formData.append("file", blob, "dist.tar.gz");
|
|
185921
|
+
const appClient = getAppClient();
|
|
185922
|
+
let response;
|
|
185923
|
+
try {
|
|
185924
|
+
response = await appClient.post("deploy-dist", {
|
|
185925
|
+
body: formData,
|
|
185926
|
+
timeout: 180000
|
|
185927
|
+
});
|
|
185928
|
+
} catch (error48) {
|
|
185929
|
+
throw await ApiError.fromHttpError(error48, "deploying site");
|
|
185930
|
+
}
|
|
185931
|
+
const result = DeployResponseSchema.safeParse(await response.json());
|
|
185932
|
+
if (!result.success) {
|
|
185933
|
+
throw new SchemaValidationError("There was an issue deploying your site", result.error);
|
|
185934
|
+
}
|
|
185935
|
+
return result.data;
|
|
185936
|
+
}
|
|
185937
|
+
async function getSiteUrl(projectId) {
|
|
185938
|
+
const id = projectId ?? getAppConfig().id;
|
|
185939
|
+
let response;
|
|
185940
|
+
try {
|
|
185941
|
+
response = await base44Client.get(`api/apps/platform/${id}/published-url`);
|
|
185942
|
+
} catch (error48) {
|
|
185943
|
+
throw await ApiError.fromHttpError(error48, "fetching site URL");
|
|
185944
|
+
}
|
|
185945
|
+
const result = PublishedUrlResponseSchema.safeParse(await response.json());
|
|
185946
|
+
if (!result.success) {
|
|
185947
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
185948
|
+
}
|
|
185949
|
+
return result.data.url;
|
|
185950
|
+
}
|
|
185955
185951
|
// src/core/site/config.ts
|
|
185956
185952
|
async function getSiteFilePaths(outputDir) {
|
|
185957
185953
|
return await globby("**/*", {
|
|
@@ -194620,11 +194616,10 @@ function parseJsonArg(value) {
|
|
|
194620
194616
|
}
|
|
194621
194617
|
async function invokeFunctionAction(functionName, options) {
|
|
194622
194618
|
const data = options.data ? parseJsonArg(options.data) : {};
|
|
194623
|
-
const method = options.method?.toUpperCase() ?? "POST";
|
|
194624
194619
|
const timeout2 = options.timeout ? parseInt(options.timeout, 10) * 1000 : undefined;
|
|
194625
|
-
M2.info(`Invoking function ${theme.styles.bold(functionName)}
|
|
194620
|
+
M2.info(`Invoking function ${theme.styles.bold(functionName)}`);
|
|
194626
194621
|
const result = await runTask("Running function", async () => {
|
|
194627
|
-
return await invokeFunction(functionName, data, { timeout: timeout2
|
|
194622
|
+
return await invokeFunction(functionName, data, { timeout: timeout2 });
|
|
194628
194623
|
}, {
|
|
194629
194624
|
successMessage: "Function executed successfully",
|
|
194630
194625
|
errorMessage: "Function execution failed"
|
|
@@ -194637,7 +194632,7 @@ ${output}`);
|
|
|
194637
194632
|
};
|
|
194638
194633
|
}
|
|
194639
194634
|
function getFunctionsInvokeCommand(context) {
|
|
194640
|
-
return new Command("invoke").description("Invoke a deployed backend function").argument("<function-name>", "Name of the function to invoke").option("-
|
|
194635
|
+
return new Command("invoke").description("Invoke a deployed backend function").argument("<function-name>", "Name of the function to invoke").option("-d, --data <json>", "JSON data to send to the function").option("-t, --timeout <seconds>", "Timeout in seconds (default: 300)").action(async (functionName, options) => {
|
|
194641
194636
|
await runCommand(() => invokeFunctionAction(functionName, options), { requireAuth: true }, context);
|
|
194642
194637
|
});
|
|
194643
194638
|
}
|
|
@@ -199821,4 +199816,4 @@ export {
|
|
|
199821
199816
|
CLIExitError
|
|
199822
199817
|
};
|
|
199823
199818
|
|
|
199824
|
-
//# debugId=
|
|
199819
|
+
//# debugId=FD5C9C3598A84A2264756E2164756E21
|