@base44-preview/cli 0.0.24-pr.145.9ad2228 → 0.0.24-pr.146.e5ee77a
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/index.js
CHANGED
|
@@ -16730,7 +16730,10 @@ const FunctionConfigSchema = object({
|
|
|
16730
16730
|
entry: string().min(1, "Entry point cannot be empty"),
|
|
16731
16731
|
triggers: tuple([]).optional()
|
|
16732
16732
|
});
|
|
16733
|
-
const FunctionSchema = FunctionConfigSchema.extend({
|
|
16733
|
+
const FunctionSchema = FunctionConfigSchema.extend({
|
|
16734
|
+
entryPath: string().min(1, "Entry path cannot be empty"),
|
|
16735
|
+
files: array(string()).min(1, "Files array cannot be empty")
|
|
16736
|
+
});
|
|
16734
16737
|
const DeployFunctionsResponseSchema = object({
|
|
16735
16738
|
deployed: array(string()),
|
|
16736
16739
|
deleted: array(string()),
|
|
@@ -16750,11 +16753,17 @@ async function readFunctionConfig(configPath) {
|
|
|
16750
16753
|
}
|
|
16751
16754
|
async function readFunction(configPath) {
|
|
16752
16755
|
const config$1 = await readFunctionConfig(configPath);
|
|
16753
|
-
const
|
|
16754
|
-
|
|
16756
|
+
const functionDir = dirname(configPath);
|
|
16757
|
+
const entryPath = join(functionDir, config$1.entry);
|
|
16758
|
+
if (!await pathExists(entryPath)) throw new Error(`Function entry file not found: ${entryPath} (referenced in ${configPath})`);
|
|
16759
|
+
const files = await globby("*.{js,ts,json}", {
|
|
16760
|
+
cwd: functionDir,
|
|
16761
|
+
absolute: true
|
|
16762
|
+
});
|
|
16755
16763
|
const functionData = {
|
|
16756
16764
|
...config$1,
|
|
16757
|
-
|
|
16765
|
+
entryPath,
|
|
16766
|
+
files
|
|
16758
16767
|
};
|
|
16759
16768
|
const result = FunctionSchema.safeParse(functionData);
|
|
16760
16769
|
if (!result.success) throw new Error(`Invalid function in ${configPath}: ${result.error.message}`);
|
|
@@ -16781,10 +16790,7 @@ function toDeployPayloadItem(fn) {
|
|
|
16781
16790
|
return {
|
|
16782
16791
|
name: fn.name,
|
|
16783
16792
|
entry: fn.entry,
|
|
16784
|
-
files:
|
|
16785
|
-
path: fn.entry,
|
|
16786
|
-
content: fn.code
|
|
16787
|
-
}]
|
|
16793
|
+
files: fn.files
|
|
16788
16794
|
};
|
|
16789
16795
|
}
|
|
16790
16796
|
async function deployFunctions(functions) {
|
|
@@ -16800,10 +16806,16 @@ async function deployFunctions(functions) {
|
|
|
16800
16806
|
//#endregion
|
|
16801
16807
|
//#region src/core/resources/function/deploy.ts
|
|
16802
16808
|
async function loadFunctionCode(fn) {
|
|
16803
|
-
const
|
|
16809
|
+
const loadedFiles = await Promise.all(fn.files.map(async (filePath) => {
|
|
16810
|
+
const content = await readTextFile(filePath);
|
|
16811
|
+
return {
|
|
16812
|
+
path: basename(filePath),
|
|
16813
|
+
content
|
|
16814
|
+
};
|
|
16815
|
+
}));
|
|
16804
16816
|
return {
|
|
16805
16817
|
...fn,
|
|
16806
|
-
|
|
16818
|
+
files: loadedFiles
|
|
16807
16819
|
};
|
|
16808
16820
|
}
|
|
16809
16821
|
async function pushFunctions(functions) {
|
package/package.json
CHANGED
|
File without changes
|