@base44-preview/cli 0.1.1-pr.555.8c33067 → 0.1.1-pr.555.9853704
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 +161 -79
- package/dist/cli/index.js.map +7 -7
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -20114,7 +20114,7 @@ var require_lodash8 = __commonJS((exports, module) => {
|
|
|
20114
20114
|
}
|
|
20115
20115
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
20116
20116
|
});
|
|
20117
|
-
function
|
|
20117
|
+
function join15(array2, separator) {
|
|
20118
20118
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
20119
20119
|
}
|
|
20120
20120
|
function last(array2) {
|
|
@@ -22046,7 +22046,7 @@ __p += '`;
|
|
|
22046
22046
|
lodash.isUndefined = isUndefined;
|
|
22047
22047
|
lodash.isWeakMap = isWeakMap;
|
|
22048
22048
|
lodash.isWeakSet = isWeakSet;
|
|
22049
|
-
lodash.join =
|
|
22049
|
+
lodash.join = join15;
|
|
22050
22050
|
lodash.kebabCase = kebabCase;
|
|
22051
22051
|
lodash.last = last;
|
|
22052
22052
|
lodash.lastIndexOf = lastIndexOf;
|
|
@@ -31158,7 +31158,7 @@ function cleanDoc(doc2) {
|
|
|
31158
31158
|
return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
|
|
31159
31159
|
}
|
|
31160
31160
|
function replaceEndOfLine(doc2, replacement = literalline) {
|
|
31161
|
-
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
31161
|
+
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join24(replacement, currentDoc.split(`
|
|
31162
31162
|
`)) : currentDoc);
|
|
31163
31163
|
}
|
|
31164
31164
|
function canBreakFn(doc2) {
|
|
@@ -31238,7 +31238,7 @@ function indentIfBreak(contents, options) {
|
|
|
31238
31238
|
negate: options.negate
|
|
31239
31239
|
};
|
|
31240
31240
|
}
|
|
31241
|
-
function
|
|
31241
|
+
function join24(separator, docs) {
|
|
31242
31242
|
assertDoc(separator);
|
|
31243
31243
|
assertDocArray(docs);
|
|
31244
31244
|
const parts = [];
|
|
@@ -31949,7 +31949,7 @@ var init_doc = __esm(() => {
|
|
|
31949
31949
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
31950
31950
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
31951
31951
|
builders = {
|
|
31952
|
-
join:
|
|
31952
|
+
join: join24,
|
|
31953
31953
|
line,
|
|
31954
31954
|
softline,
|
|
31955
31955
|
hardline,
|
|
@@ -136863,7 +136863,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
136863
136863
|
return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
|
|
136864
136864
|
}
|
|
136865
136865
|
function replaceEndOfLine2(doc2, replacement = literalline2) {
|
|
136866
|
-
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
136866
|
+
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join26(replacement, currentDoc.split(`
|
|
136867
136867
|
`)) : currentDoc);
|
|
136868
136868
|
}
|
|
136869
136869
|
function canBreakFn2(doc2) {
|
|
@@ -136949,7 +136949,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
136949
136949
|
negate: options8.negate
|
|
136950
136950
|
};
|
|
136951
136951
|
}
|
|
136952
|
-
function
|
|
136952
|
+
function join26(separator, docs) {
|
|
136953
136953
|
assertDoc2(separator);
|
|
136954
136954
|
assertDocArray2(docs);
|
|
136955
136955
|
const parts = [];
|
|
@@ -137614,7 +137614,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
137614
137614
|
}
|
|
137615
137615
|
}
|
|
137616
137616
|
var builders2 = {
|
|
137617
|
-
join:
|
|
137617
|
+
join: join26,
|
|
137618
137618
|
line: line3,
|
|
137619
137619
|
softline: softline2,
|
|
137620
137620
|
hardline: hardline4,
|
|
@@ -163947,7 +163947,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
163947
163947
|
var dirname22 = path18.dirname;
|
|
163948
163948
|
var basename7 = path18.basename;
|
|
163949
163949
|
var extname2 = path18.extname;
|
|
163950
|
-
var
|
|
163950
|
+
var join28 = path18.join;
|
|
163951
163951
|
var resolve12 = path18.resolve;
|
|
163952
163952
|
module.exports = View;
|
|
163953
163953
|
function View(name2, options8) {
|
|
@@ -164009,12 +164009,12 @@ var require_view = __commonJS((exports, module) => {
|
|
|
164009
164009
|
};
|
|
164010
164010
|
View.prototype.resolve = function resolve13(dir, file2) {
|
|
164011
164011
|
var ext = this.ext;
|
|
164012
|
-
var path19 =
|
|
164012
|
+
var path19 = join28(dir, file2);
|
|
164013
164013
|
var stat2 = tryStat(path19);
|
|
164014
164014
|
if (stat2 && stat2.isFile()) {
|
|
164015
164015
|
return path19;
|
|
164016
164016
|
}
|
|
164017
|
-
path19 =
|
|
164017
|
+
path19 = join28(dir, basename7(file2, ext), "index" + ext);
|
|
164018
164018
|
stat2 = tryStat(path19);
|
|
164019
164019
|
if (stat2 && stat2.isFile()) {
|
|
164020
164020
|
return path19;
|
|
@@ -167709,7 +167709,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167709
167709
|
var Stream2 = __require("stream");
|
|
167710
167710
|
var util2 = __require("util");
|
|
167711
167711
|
var extname2 = path18.extname;
|
|
167712
|
-
var
|
|
167712
|
+
var join28 = path18.join;
|
|
167713
167713
|
var normalize2 = path18.normalize;
|
|
167714
167714
|
var resolve12 = path18.resolve;
|
|
167715
167715
|
var sep = path18.sep;
|
|
@@ -167881,7 +167881,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
167881
167881
|
return res;
|
|
167882
167882
|
}
|
|
167883
167883
|
parts = path19.split(sep);
|
|
167884
|
-
path19 = normalize2(
|
|
167884
|
+
path19 = normalize2(join28(root2, path19));
|
|
167885
167885
|
} else {
|
|
167886
167886
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
167887
167887
|
debug('malicious path "%s"', path19);
|
|
@@ -168021,7 +168021,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
168021
168021
|
return self2.onStatError(err);
|
|
168022
168022
|
return self2.error(404);
|
|
168023
168023
|
}
|
|
168024
|
-
var p4 =
|
|
168024
|
+
var p4 = join28(path19, self2._index[i5]);
|
|
168025
168025
|
debug('stat "%s"', p4);
|
|
168026
168026
|
fs28.stat(p4, function(err2, stat2) {
|
|
168027
168027
|
if (err2)
|
|
@@ -214616,7 +214616,7 @@ var require_buffer_list = __commonJS((exports, module) => {
|
|
|
214616
214616
|
}
|
|
214617
214617
|
}, {
|
|
214618
214618
|
key: "join",
|
|
214619
|
-
value: function
|
|
214619
|
+
value: function join28(s5) {
|
|
214620
214620
|
if (this.length === 0)
|
|
214621
214621
|
return "";
|
|
214622
214622
|
var p4 = this.head;
|
|
@@ -234018,7 +234018,7 @@ function normalizeBase44Env() {
|
|
|
234018
234018
|
loadProjectEnvFiles();
|
|
234019
234019
|
|
|
234020
234020
|
// src/cli/index.ts
|
|
234021
|
-
import { dirname as dirname26, join as
|
|
234021
|
+
import { dirname as dirname26, join as join31 } from "node:path";
|
|
234022
234022
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
234023
234023
|
|
|
234024
234024
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -235226,7 +235226,7 @@ var {
|
|
|
235226
235226
|
} = import__.default;
|
|
235227
235227
|
|
|
235228
235228
|
// src/cli/commands/agents/pull.ts
|
|
235229
|
-
import { dirname as dirname12, join as
|
|
235229
|
+
import { dirname as dirname12, join as join15 } from "node:path";
|
|
235230
235230
|
// ../../node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
235231
235231
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
235232
235232
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
@@ -241895,7 +241895,7 @@ async function getSiteUrl() {
|
|
|
241895
241895
|
return result.data.url;
|
|
241896
241896
|
}
|
|
241897
241897
|
// src/core/project/config.ts
|
|
241898
|
-
import { dirname as dirname10, join as
|
|
241898
|
+
import { dirname as dirname10, join as join11 } from "node:path";
|
|
241899
241899
|
|
|
241900
241900
|
// src/core/project/plugins.ts
|
|
241901
241901
|
import { createRequire as createRequire2 } from "node:module";
|
|
@@ -243757,6 +243757,10 @@ var RealtimeHandlerConfigSchema = exports_external.object({
|
|
|
243757
243757
|
name: exports_external.string().min(1),
|
|
243758
243758
|
entry: exports_external.string().min(1)
|
|
243759
243759
|
});
|
|
243760
|
+
var RealtimeHandlerSchemaFileSchema = exports_external.object({
|
|
243761
|
+
inbound: exports_external.unknown().optional(),
|
|
243762
|
+
outbound: exports_external.unknown().optional()
|
|
243763
|
+
});
|
|
243760
243764
|
var DeployRealtimeHandlerResponseSchema = exports_external.object({
|
|
243761
243765
|
status: exports_external.enum(["deployed", "unchanged"]),
|
|
243762
243766
|
handler_name: exports_external.string().optional()
|
|
@@ -243764,7 +243768,8 @@ var DeployRealtimeHandlerResponseSchema = exports_external.object({
|
|
|
243764
243768
|
var RealtimeHandlerSchema = RealtimeHandlerConfigSchema.extend({
|
|
243765
243769
|
entryPath: exports_external.string().min(1),
|
|
243766
243770
|
filePaths: exports_external.array(exports_external.string()).min(1),
|
|
243767
|
-
source: ResourceSourceSchema
|
|
243771
|
+
source: ResourceSourceSchema,
|
|
243772
|
+
messageSchema: exports_external.unknown().optional()
|
|
243768
243773
|
});
|
|
243769
243774
|
|
|
243770
243775
|
// src/core/resources/realtime-handler/api.ts
|
|
@@ -243783,7 +243788,7 @@ async function deploySingleRealtimeHandler(name2, payload) {
|
|
|
243783
243788
|
return result.data;
|
|
243784
243789
|
}
|
|
243785
243790
|
// src/core/resources/realtime-handler/config.ts
|
|
243786
|
-
import { basename as basename4, dirname as dirname8, relative as relative3 } from "node:path";
|
|
243791
|
+
import { basename as basename4, dirname as dirname8, join as join10, relative as relative3 } from "node:path";
|
|
243787
243792
|
async function readRealtimeHandler(entryFile, realtimeDir) {
|
|
243788
243793
|
const handlerDir = dirname8(entryFile);
|
|
243789
243794
|
const filePaths = await globby("**/*.ts", {
|
|
@@ -243801,12 +243806,25 @@ async function readRealtimeHandler(entryFile, realtimeDir) {
|
|
|
243801
243806
|
});
|
|
243802
243807
|
}
|
|
243803
243808
|
const entry = basename4(entryFile);
|
|
243809
|
+
const schemaPath = join10(handlerDir, "schema.jsonc");
|
|
243810
|
+
let messageSchema = undefined;
|
|
243811
|
+
if (await pathExists(schemaPath)) {
|
|
243812
|
+
const parsed = await readJsonFile(schemaPath);
|
|
243813
|
+
const result = RealtimeHandlerSchemaFileSchema.safeParse(parsed);
|
|
243814
|
+
if (result.success) {
|
|
243815
|
+
messageSchema = {
|
|
243816
|
+
inbound: result.data.inbound,
|
|
243817
|
+
outbound: result.data.outbound
|
|
243818
|
+
};
|
|
243819
|
+
}
|
|
243820
|
+
}
|
|
243804
243821
|
return {
|
|
243805
243822
|
name: name2,
|
|
243806
243823
|
entry,
|
|
243807
243824
|
entryPath: entryFile,
|
|
243808
243825
|
filePaths,
|
|
243809
|
-
source: { type: "project" }
|
|
243826
|
+
source: { type: "project" },
|
|
243827
|
+
messageSchema
|
|
243810
243828
|
};
|
|
243811
243829
|
}
|
|
243812
243830
|
async function readAllRealtimeHandlers(realtimeDir) {
|
|
@@ -243933,12 +243951,12 @@ class ProjectConfigReader {
|
|
|
243933
243951
|
connectors,
|
|
243934
243952
|
authConfig
|
|
243935
243953
|
] = await Promise.all([
|
|
243936
|
-
entityResource.readAll(
|
|
243937
|
-
functionResource.readAll(
|
|
243938
|
-
realtimeHandlerResource.readAll(
|
|
243939
|
-
agentResource.readAll(
|
|
243940
|
-
connectorResource.readAll(
|
|
243941
|
-
authConfigResource.readAll(
|
|
243954
|
+
entityResource.readAll(join11(configDir, project.entitiesDir)),
|
|
243955
|
+
functionResource.readAll(join11(configDir, project.functionsDir)),
|
|
243956
|
+
realtimeHandlerResource.readAll(join11(configDir, project.realtimeDir)),
|
|
243957
|
+
agentResource.readAll(join11(configDir, project.agentsDir)),
|
|
243958
|
+
connectorResource.readAll(join11(configDir, project.connectorsDir)),
|
|
243959
|
+
authConfigResource.readAll(join11(configDir, project.authDir))
|
|
243942
243960
|
]);
|
|
243943
243961
|
return {
|
|
243944
243962
|
entities,
|
|
@@ -244048,12 +244066,12 @@ async function readProjectConfig(projectRoot) {
|
|
|
244048
244066
|
// src/core/project/template.ts
|
|
244049
244067
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
244050
244068
|
var import_front_matter = __toESM(require_front_matter(), 1);
|
|
244051
|
-
import { dirname as dirname11, join as
|
|
244069
|
+
import { dirname as dirname11, join as join13 } from "node:path";
|
|
244052
244070
|
|
|
244053
244071
|
// src/core/assets.ts
|
|
244054
244072
|
import { cpSync, existsSync } from "node:fs";
|
|
244055
244073
|
import { homedir as homedir2 } from "node:os";
|
|
244056
|
-
import { join as
|
|
244074
|
+
import { join as join12 } from "node:path";
|
|
244057
244075
|
// package.json
|
|
244058
244076
|
var package_default = {
|
|
244059
244077
|
name: "base44",
|
|
@@ -244154,18 +244172,18 @@ var package_default = {
|
|
|
244154
244172
|
};
|
|
244155
244173
|
|
|
244156
244174
|
// src/core/assets.ts
|
|
244157
|
-
var ASSETS_DIR =
|
|
244175
|
+
var ASSETS_DIR = join12(homedir2(), ".base44", "assets", package_default.version);
|
|
244158
244176
|
function getTemplatesDir() {
|
|
244159
|
-
return
|
|
244177
|
+
return join12(ASSETS_DIR, "templates");
|
|
244160
244178
|
}
|
|
244161
244179
|
function getTemplatesIndexPath() {
|
|
244162
|
-
return
|
|
244180
|
+
return join12(ASSETS_DIR, "templates", "templates.json");
|
|
244163
244181
|
}
|
|
244164
244182
|
function getDenoWrapperPath() {
|
|
244165
|
-
return
|
|
244183
|
+
return join12(ASSETS_DIR, "deno-runtime", "main.ts");
|
|
244166
244184
|
}
|
|
244167
244185
|
function getExecWrapperPath() {
|
|
244168
|
-
return
|
|
244186
|
+
return join12(ASSETS_DIR, "deno-runtime", "exec.ts");
|
|
244169
244187
|
}
|
|
244170
244188
|
function ensureNpmAssets(sourceDir) {
|
|
244171
244189
|
if (existsSync(ASSETS_DIR))
|
|
@@ -244187,7 +244205,7 @@ async function listTemplates() {
|
|
|
244187
244205
|
}
|
|
244188
244206
|
async function renderTemplate(template, destPath, data, options = {}) {
|
|
244189
244207
|
const { skipExisting = false } = options;
|
|
244190
|
-
const templateDir =
|
|
244208
|
+
const templateDir = join13(getTemplatesDir(), template.path);
|
|
244191
244209
|
const files = await globby("**/*", {
|
|
244192
244210
|
cwd: templateDir,
|
|
244193
244211
|
dot: true,
|
|
@@ -244195,20 +244213,20 @@ async function renderTemplate(template, destPath, data, options = {}) {
|
|
|
244195
244213
|
});
|
|
244196
244214
|
const skipped = [];
|
|
244197
244215
|
for (const file2 of files) {
|
|
244198
|
-
const srcPath =
|
|
244216
|
+
const srcPath = join13(templateDir, file2);
|
|
244199
244217
|
try {
|
|
244200
244218
|
if (file2.endsWith(".ejs")) {
|
|
244201
244219
|
const rendered = await import_ejs.default.renderFile(srcPath, data);
|
|
244202
244220
|
const { attributes, body } = import_front_matter.default(rendered);
|
|
244203
|
-
const destFile = attributes.outputFileName ?
|
|
244204
|
-
const destFilePath =
|
|
244221
|
+
const destFile = attributes.outputFileName ? join13(dirname11(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
|
|
244222
|
+
const destFilePath = join13(destPath, destFile);
|
|
244205
244223
|
if (skipExisting && await pathExists(destFilePath)) {
|
|
244206
244224
|
skipped.push(destFile);
|
|
244207
244225
|
continue;
|
|
244208
244226
|
}
|
|
244209
244227
|
await writeFile(destFilePath, body);
|
|
244210
244228
|
} else {
|
|
244211
|
-
const destFilePath =
|
|
244229
|
+
const destFilePath = join13(destPath, file2);
|
|
244212
244230
|
if (skipExisting && await pathExists(destFilePath)) {
|
|
244213
244231
|
skipped.push(file2);
|
|
244214
244232
|
continue;
|
|
@@ -244302,7 +244320,7 @@ async function getSiteFilePaths(outputDir) {
|
|
|
244302
244320
|
// src/core/site/deploy.ts
|
|
244303
244321
|
import { randomUUID } from "node:crypto";
|
|
244304
244322
|
import { tmpdir } from "node:os";
|
|
244305
|
-
import { join as
|
|
244323
|
+
import { join as join14 } from "node:path";
|
|
244306
244324
|
async function deploySite(siteOutputDir) {
|
|
244307
244325
|
if (!await pathExists(siteOutputDir)) {
|
|
244308
244326
|
throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
|
|
@@ -244319,7 +244337,7 @@ async function deploySite(siteOutputDir) {
|
|
|
244319
244337
|
]
|
|
244320
244338
|
});
|
|
244321
244339
|
}
|
|
244322
|
-
const archivePath =
|
|
244340
|
+
const archivePath = join14(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
|
|
244323
244341
|
try {
|
|
244324
244342
|
await createArchive(siteOutputDir, archivePath);
|
|
244325
244343
|
return await uploadSite(archivePath);
|
|
@@ -251567,7 +251585,7 @@ async function pullAgentsAction({
|
|
|
251567
251585
|
}) {
|
|
251568
251586
|
const { project: project2 } = await readProjectConfig();
|
|
251569
251587
|
const configDir = dirname12(project2.configPath);
|
|
251570
|
-
const agentsDir =
|
|
251588
|
+
const agentsDir = join15(configDir, project2.agentsDir);
|
|
251571
251589
|
const remoteAgents = await runTask2("Fetching agents from Base44", async () => {
|
|
251572
251590
|
return await fetchAgents();
|
|
251573
251591
|
}, {
|
|
@@ -251631,12 +251649,12 @@ function getAgentsCommand() {
|
|
|
251631
251649
|
}
|
|
251632
251650
|
|
|
251633
251651
|
// src/cli/commands/auth/password-login.ts
|
|
251634
|
-
import { dirname as dirname13, join as
|
|
251652
|
+
import { dirname as dirname13, join as join16 } from "node:path";
|
|
251635
251653
|
async function passwordLoginAction({ log, runTask: runTask2 }, action) {
|
|
251636
251654
|
const shouldEnable = action === "enable";
|
|
251637
251655
|
const { project: project2 } = await readProjectConfig();
|
|
251638
251656
|
const configDir = dirname13(project2.configPath);
|
|
251639
|
-
const authDir =
|
|
251657
|
+
const authDir = join16(configDir, project2.authDir);
|
|
251640
251658
|
const updated = await runTask2("Updating local auth config", async () => {
|
|
251641
251659
|
const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
|
|
251642
251660
|
const merged = { ...current, enableUsernamePassword: shouldEnable };
|
|
@@ -251656,14 +251674,14 @@ function getPasswordLoginCommand() {
|
|
|
251656
251674
|
}
|
|
251657
251675
|
|
|
251658
251676
|
// src/cli/commands/auth/pull.ts
|
|
251659
|
-
import { dirname as dirname14, join as
|
|
251677
|
+
import { dirname as dirname14, join as join17 } from "node:path";
|
|
251660
251678
|
async function pullAuthAction({
|
|
251661
251679
|
log,
|
|
251662
251680
|
runTask: runTask2
|
|
251663
251681
|
}) {
|
|
251664
251682
|
const { project: project2 } = await readProjectConfig();
|
|
251665
251683
|
const configDir = dirname14(project2.configPath);
|
|
251666
|
-
const authDir =
|
|
251684
|
+
const authDir = join17(configDir, project2.authDir);
|
|
251667
251685
|
const remoteConfig = await runTask2("Fetching auth config from Base44", async () => {
|
|
251668
251686
|
return await pullAuthConfig();
|
|
251669
251687
|
}, {
|
|
@@ -251727,7 +251745,7 @@ function getAuthPushCommand() {
|
|
|
251727
251745
|
}
|
|
251728
251746
|
|
|
251729
251747
|
// src/cli/commands/auth/social-login.ts
|
|
251730
|
-
import { dirname as dirname15, join as
|
|
251748
|
+
import { dirname as dirname15, join as join18, resolve as resolve3 } from "node:path";
|
|
251731
251749
|
var PROVIDER_LABELS = {
|
|
251732
251750
|
google: "Google",
|
|
251733
251751
|
microsoft: "Microsoft",
|
|
@@ -251798,7 +251816,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
|
|
|
251798
251816
|
}
|
|
251799
251817
|
const { project: project2 } = await readProjectConfig();
|
|
251800
251818
|
const configDir = dirname15(project2.configPath);
|
|
251801
|
-
const authDir =
|
|
251819
|
+
const authDir = join18(configDir, project2.authDir);
|
|
251802
251820
|
const { config: updated } = await runTask2("Updating local auth config", async () => updateSocialLoginConfig(authDir, provider, shouldEnable, useCustomOAuth && options.clientId ? { clientId: options.clientId } : undefined));
|
|
251803
251821
|
if (clientSecret) {
|
|
251804
251822
|
await runTask2("Saving client secret", async () => pushCustomOAuthSecret(provider, clientSecret));
|
|
@@ -251823,7 +251841,7 @@ function getSocialLoginCommand() {
|
|
|
251823
251841
|
}
|
|
251824
251842
|
|
|
251825
251843
|
// src/cli/commands/auth/sso.ts
|
|
251826
|
-
import { dirname as dirname16, join as
|
|
251844
|
+
import { dirname as dirname16, join as join19, resolve as resolve4 } from "node:path";
|
|
251827
251845
|
var SSOConfigFileSchema = exports_external.object({
|
|
251828
251846
|
provider: exports_external.enum(Object.values(KNOWN_SSO_PROVIDERS)),
|
|
251829
251847
|
clientId: exports_external.string(),
|
|
@@ -251987,7 +252005,7 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
|
|
|
251987
252005
|
}
|
|
251988
252006
|
const { project: project2 } = await readProjectConfig();
|
|
251989
252007
|
const configDir = dirname16(project2.configPath);
|
|
251990
|
-
const authDir =
|
|
252008
|
+
const authDir = join19(configDir, project2.authDir);
|
|
251991
252009
|
await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, provider, true));
|
|
251992
252010
|
await runTask2("Saving SSO credentials", async () => pushSSOSecrets(secrets));
|
|
251993
252011
|
return {
|
|
@@ -252003,7 +252021,7 @@ async function ssoDisableAction({ log, runTask: runTask2 }, options) {
|
|
|
252003
252021
|
}
|
|
252004
252022
|
const { project: project2 } = await readProjectConfig();
|
|
252005
252023
|
const configDir = dirname16(project2.configPath);
|
|
252006
|
-
const authDir =
|
|
252024
|
+
const authDir = join19(configDir, project2.authDir);
|
|
252007
252025
|
const updated = await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, null, false));
|
|
252008
252026
|
await runTask2("Removing SSO credentials", async () => deleteSSOSecrets());
|
|
252009
252027
|
if (!hasAnyLoginMethod(updated)) {
|
|
@@ -252854,13 +252872,13 @@ function getConnectorsListAvailableCommand() {
|
|
|
252854
252872
|
}
|
|
252855
252873
|
|
|
252856
252874
|
// src/cli/commands/connectors/pull.ts
|
|
252857
|
-
import { dirname as dirname17, join as
|
|
252875
|
+
import { dirname as dirname17, join as join20, resolve as resolve5 } from "node:path";
|
|
252858
252876
|
async function resolveConnectorsDir(options) {
|
|
252859
252877
|
if (!getAppContext().projectRoot) {
|
|
252860
252878
|
return resolve5(options.dir ?? "connectors");
|
|
252861
252879
|
}
|
|
252862
252880
|
const { project: project2 } = await readProjectConfig();
|
|
252863
|
-
return
|
|
252881
|
+
return join20(dirname17(project2.configPath), project2.connectorsDir);
|
|
252864
252882
|
}
|
|
252865
252883
|
async function pullConnectorsAction({ log, runTask: runTask2, jsonMode }, options) {
|
|
252866
252884
|
const connectorsDir = await resolveConnectorsDir(options);
|
|
@@ -253253,11 +253271,11 @@ function getListCommand() {
|
|
|
253253
253271
|
}
|
|
253254
253272
|
|
|
253255
253273
|
// src/cli/commands/functions/pull.ts
|
|
253256
|
-
import { dirname as dirname18, join as
|
|
253274
|
+
import { dirname as dirname18, join as join21 } from "node:path";
|
|
253257
253275
|
async function pullFunctionsAction({ log, runTask: runTask2 }, name2) {
|
|
253258
253276
|
const { project: project2, functions } = await readProjectConfig();
|
|
253259
253277
|
const configDir = dirname18(project2.configPath);
|
|
253260
|
-
const functionsDir =
|
|
253278
|
+
const functionsDir = join21(configDir, project2.functionsDir);
|
|
253261
253279
|
const pluginFunctionNames = new Set(functions.filter((fn) => fn.source.type === "plugin").map((fn) => fn.name));
|
|
253262
253280
|
const remoteFunctions = await runTask2("Fetching functions from Base44", async () => {
|
|
253263
253281
|
const { functions: functions2 } = await listDeployedFunctions();
|
|
@@ -253320,7 +253338,7 @@ import { basename as basename5, resolve as resolve7 } from "node:path";
|
|
|
253320
253338
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
253321
253339
|
|
|
253322
253340
|
// src/cli/commands/project/scaffold-shared.ts
|
|
253323
|
-
import { join as
|
|
253341
|
+
import { join as join22 } from "node:path";
|
|
253324
253342
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
253325
253343
|
async function getTemplateById(templateId) {
|
|
253326
253344
|
const templates = await listTemplates();
|
|
@@ -253379,7 +253397,7 @@ async function completeProjectSetup({
|
|
|
253379
253397
|
updateMessage("Building project...");
|
|
253380
253398
|
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
253381
253399
|
updateMessage("Deploying site...");
|
|
253382
|
-
return await deploySite(
|
|
253400
|
+
return await deploySite(join22(resolvedPath, outputDirectory));
|
|
253383
253401
|
}, {
|
|
253384
253402
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
253385
253403
|
errorMessage: "Failed to deploy site"
|
|
@@ -254138,15 +254156,23 @@ function getDeployCommand3() {
|
|
|
254138
254156
|
}
|
|
254139
254157
|
|
|
254140
254158
|
// src/cli/commands/realtime/new.ts
|
|
254141
|
-
import { dirname as dirname19, join as
|
|
254159
|
+
import { dirname as dirname19, join as join23 } from "node:path";
|
|
254142
254160
|
function buildHandlerScaffold(handlerName) {
|
|
254143
254161
|
return `import { RealtimeHandler, type Conn } from "@base44/sdk";
|
|
254144
254162
|
|
|
254145
|
-
|
|
254163
|
+
interface State {
|
|
254164
|
+
// shared state broadcast to all clients
|
|
254165
|
+
}
|
|
254166
|
+
|
|
254167
|
+
interface Message {
|
|
254168
|
+
// messages sent from clients
|
|
254169
|
+
}
|
|
254170
|
+
|
|
254171
|
+
export class ${handlerName} extends RealtimeHandler<State, Message> {
|
|
254146
254172
|
handleConnect(conn: Conn) {
|
|
254147
254173
|
console.log("Connected:", conn.userId);
|
|
254148
254174
|
}
|
|
254149
|
-
handleMessage(conn: Conn, msg:
|
|
254175
|
+
handleMessage(conn: Conn, msg: Message) {
|
|
254150
254176
|
console.log("Message:", msg);
|
|
254151
254177
|
}
|
|
254152
254178
|
handleTick() {}
|
|
@@ -254156,12 +254182,12 @@ export class ${handlerName} extends RealtimeHandler {
|
|
|
254156
254182
|
}
|
|
254157
254183
|
async function newRealtimeHandlerAction(_ctx, handlerName) {
|
|
254158
254184
|
const { project: project2 } = await readProjectConfig();
|
|
254159
|
-
const realtimeDir =
|
|
254160
|
-
const handlerDir =
|
|
254185
|
+
const realtimeDir = join23(dirname19(project2.configPath), project2.realtimeDir);
|
|
254186
|
+
const handlerDir = join23(realtimeDir, handlerName);
|
|
254161
254187
|
if (await pathExists(handlerDir)) {
|
|
254162
254188
|
throw new InvalidInputError(`Realtime handler "${handlerName}" already exists at ${handlerDir}`);
|
|
254163
254189
|
}
|
|
254164
|
-
const entryPath =
|
|
254190
|
+
const entryPath = join23(handlerDir, "entry.ts");
|
|
254165
254191
|
await writeFile(entryPath, buildHandlerScaffold(handlerName));
|
|
254166
254192
|
return {
|
|
254167
254193
|
outroMessage: `Created realtime handler "${handlerName}" at ${entryPath}`
|
|
@@ -254649,6 +254675,7 @@ function getSiteCommand() {
|
|
|
254649
254675
|
// src/core/types/generator.ts
|
|
254650
254676
|
var import_common_tags = __toESM(require_lib2(), 1);
|
|
254651
254677
|
var import_json_schema_to_typescript = __toESM(require_src3(), 1);
|
|
254678
|
+
import { join as join26 } from "node:path";
|
|
254652
254679
|
var HEADER2 = import_common_tags.stripIndent`
|
|
254653
254680
|
// Auto-generated by Base44 CLI - DO NOT EDIT
|
|
254654
254681
|
// Regenerate with: base44 types generate
|
|
@@ -254657,24 +254684,40 @@ var EMPTY_TEMPLATE = import_common_tags.stripIndent`
|
|
|
254657
254684
|
// Auto-generated by Base44 CLI - DO NOT EDIT
|
|
254658
254685
|
// Regenerate with: base44 types
|
|
254659
254686
|
//
|
|
254660
|
-
// No entities, functions, agents, or
|
|
254661
|
-
// Add resources to base44/entities/, base44/functions/, base44/agents/, or base44/
|
|
254687
|
+
// No entities, functions, agents, connectors, or realtime handlers found in project.
|
|
254688
|
+
// Add resources to base44/entities/, base44/functions/, base44/agents/, base44/connectors/, or base44/realtime/
|
|
254662
254689
|
// and run \`base44 types generate\` again.
|
|
254663
254690
|
|
|
254664
254691
|
declare module '@base44/sdk' {
|
|
254665
254692
|
// No types to augment - add resources and regenerate
|
|
254666
254693
|
}
|
|
254667
254694
|
`;
|
|
254695
|
+
var SDK_PACKAGE_NAMES = ["@base44/sdk", "@base44-preview/sdk"];
|
|
254696
|
+
async function detectSdkPackageName(projectRoot) {
|
|
254697
|
+
try {
|
|
254698
|
+
const pkg = await readJsonFile(join26(projectRoot, "package.json"));
|
|
254699
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
254700
|
+
for (const name2 of SDK_PACKAGE_NAMES) {
|
|
254701
|
+
if (name2 in deps)
|
|
254702
|
+
return name2;
|
|
254703
|
+
}
|
|
254704
|
+
} catch {}
|
|
254705
|
+
return "@base44/sdk";
|
|
254706
|
+
}
|
|
254668
254707
|
async function generateTypesFile(input) {
|
|
254669
254708
|
const content = await generateContent(input);
|
|
254670
254709
|
await writeFile(getTypesOutputPath(input.projectRoot), content);
|
|
254671
254710
|
}
|
|
254672
254711
|
async function generateContent(input) {
|
|
254673
|
-
const { entities, functions, agents, connectors } = input;
|
|
254674
|
-
|
|
254712
|
+
const { entities, functions, agents, connectors, realtimeHandlers } = input;
|
|
254713
|
+
const sdkPackage = await detectSdkPackageName(input.projectRoot);
|
|
254714
|
+
if (!entities.length && !functions.length && !agents.length && !connectors.length && !realtimeHandlers.length) {
|
|
254675
254715
|
return EMPTY_TEMPLATE;
|
|
254676
254716
|
}
|
|
254677
|
-
const entityInterfaces = await Promise.all(
|
|
254717
|
+
const [entityInterfaces, realtimeRegistryEntries] = await Promise.all([
|
|
254718
|
+
Promise.all(entities.map((e8) => compileEntity(e8))),
|
|
254719
|
+
Promise.all(realtimeHandlers.map((h5) => compileRealtimeHandler(h5)))
|
|
254720
|
+
]);
|
|
254678
254721
|
const registryEntries = [
|
|
254679
254722
|
[
|
|
254680
254723
|
"EntityTypeRegistry",
|
|
@@ -254682,16 +254725,28 @@ async function generateContent(input) {
|
|
|
254682
254725
|
],
|
|
254683
254726
|
["FunctionNameRegistry", functions.map((f7) => `"${f7.name}": true;`)],
|
|
254684
254727
|
["AgentNameRegistry", agents.map((a5) => `"${a5.name}": true;`)],
|
|
254685
|
-
["ConnectorTypeRegistry", connectors.map((c8) => `"${c8.type}": true;`)]
|
|
254728
|
+
["ConnectorTypeRegistry", connectors.map((c8) => `"${c8.type}": true;`)],
|
|
254729
|
+
[
|
|
254730
|
+
"RealtimeHandlerNameRegistry",
|
|
254731
|
+
realtimeHandlers.map((h5) => `"${h5.name}": true;`)
|
|
254732
|
+
],
|
|
254733
|
+
[
|
|
254734
|
+
"RealtimeHandlerRegistry",
|
|
254735
|
+
realtimeHandlers.filter((h5) => h5.messageSchema).map((h5, _10, arr) => {
|
|
254736
|
+
const idx = realtimeHandlers.indexOf(h5);
|
|
254737
|
+
return `"${h5.name}": ${realtimeRegistryEntries[idx]};`;
|
|
254738
|
+
})
|
|
254739
|
+
]
|
|
254686
254740
|
];
|
|
254687
254741
|
const registries2 = registryEntries.filter(([, entries]) => entries.length > 0).map(([name2, entries]) => registry2(name2, entries));
|
|
254688
254742
|
return [
|
|
254689
254743
|
HEADER2,
|
|
254744
|
+
"export {};",
|
|
254690
254745
|
entityInterfaces.join(`
|
|
254691
254746
|
|
|
254692
254747
|
`),
|
|
254693
254748
|
import_common_tags.source`
|
|
254694
|
-
declare module '
|
|
254749
|
+
declare module '${sdkPackage}' {
|
|
254695
254750
|
${registries2.join(`
|
|
254696
254751
|
|
|
254697
254752
|
`)}
|
|
@@ -254719,6 +254774,32 @@ async function compileEntity(entity2) {
|
|
|
254719
254774
|
throw new TypeGenerationError(`Failed to generate types for entity "${name2}"`, name2, error48);
|
|
254720
254775
|
}
|
|
254721
254776
|
}
|
|
254777
|
+
async function compileRealtimeHandler(handler) {
|
|
254778
|
+
const { messageSchema } = handler;
|
|
254779
|
+
if (!messageSchema)
|
|
254780
|
+
return "{ inbound: unknown; outbound: unknown }";
|
|
254781
|
+
const compileSchema = async (schema11, typeName) => {
|
|
254782
|
+
if (!schema11)
|
|
254783
|
+
return "unknown";
|
|
254784
|
+
try {
|
|
254785
|
+
const ts8 = await import_json_schema_to_typescript.compile(schema11, typeName, {
|
|
254786
|
+
bannerComment: "",
|
|
254787
|
+
additionalProperties: false,
|
|
254788
|
+
strictIndexSignatures: true
|
|
254789
|
+
});
|
|
254790
|
+
const match = ts8.match(/\{([^]*)\}/);
|
|
254791
|
+
return match ? `{
|
|
254792
|
+
${match[1]}}` : "unknown";
|
|
254793
|
+
} catch {
|
|
254794
|
+
return "unknown";
|
|
254795
|
+
}
|
|
254796
|
+
};
|
|
254797
|
+
const [inbound, outbound] = await Promise.all([
|
|
254798
|
+
compileSchema(messageSchema.inbound, `${handler.name}Inbound`),
|
|
254799
|
+
compileSchema(messageSchema.outbound, `${handler.name}Outbound`)
|
|
254800
|
+
]);
|
|
254801
|
+
return `{ inbound: ${inbound}; outbound: ${outbound} }`;
|
|
254802
|
+
}
|
|
254722
254803
|
function registry2(name2, entries) {
|
|
254723
254804
|
return import_common_tags.source`
|
|
254724
254805
|
interface ${name2} {
|
|
@@ -254731,10 +254812,10 @@ function toPascalCase(name2) {
|
|
|
254731
254812
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
254732
254813
|
}
|
|
254733
254814
|
// src/core/types/update-project.ts
|
|
254734
|
-
import { join as
|
|
254815
|
+
import { join as join27 } from "node:path";
|
|
254735
254816
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
254736
254817
|
async function updateProjectConfig(projectRoot) {
|
|
254737
|
-
const tsconfigPath =
|
|
254818
|
+
const tsconfigPath = join27(projectRoot, "tsconfig.json");
|
|
254738
254819
|
if (!await pathExists(tsconfigPath)) {
|
|
254739
254820
|
return false;
|
|
254740
254821
|
}
|
|
@@ -254758,14 +254839,15 @@ var TYPES_FILE_PATH = "base44/.types/types.d.ts";
|
|
|
254758
254839
|
async function generateTypesAction({
|
|
254759
254840
|
runTask: runTask2
|
|
254760
254841
|
}) {
|
|
254761
|
-
const { entities, functions, agents, connectors, project: project2 } = await readProjectConfig();
|
|
254842
|
+
const { entities, functions, agents, connectors, realtimeHandlers, project: project2 } = await readProjectConfig();
|
|
254762
254843
|
await runTask2("Generating types", async () => {
|
|
254763
254844
|
await generateTypesFile({
|
|
254764
254845
|
projectRoot: project2.root,
|
|
254765
254846
|
entities,
|
|
254766
254847
|
functions,
|
|
254767
254848
|
agents,
|
|
254768
|
-
connectors
|
|
254849
|
+
connectors,
|
|
254850
|
+
realtimeHandlers
|
|
254769
254851
|
});
|
|
254770
254852
|
});
|
|
254771
254853
|
const tsconfigUpdated = await updateProjectConfig(project2.root);
|
|
@@ -254785,7 +254867,7 @@ function getTypesCommand() {
|
|
|
254785
254867
|
// src/cli/dev/dev-server/main.ts
|
|
254786
254868
|
var import_cors = __toESM(require_lib4(), 1);
|
|
254787
254869
|
var import_express6 = __toESM(require_express(), 1);
|
|
254788
|
-
import { dirname as dirname24, join as
|
|
254870
|
+
import { dirname as dirname24, join as join30 } from "node:path";
|
|
254789
254871
|
|
|
254790
254872
|
// ../../node_modules/get-port/index.js
|
|
254791
254873
|
import net from "node:net";
|
|
@@ -258205,8 +258287,8 @@ async function createDevServer(options8) {
|
|
|
258205
258287
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
258206
258288
|
};
|
|
258207
258289
|
const base44ConfigWatcher = new WatchBase44({
|
|
258208
|
-
functions:
|
|
258209
|
-
entities:
|
|
258290
|
+
functions: join30(dirname24(project2.configPath), project2.functionsDir),
|
|
258291
|
+
entities: join30(dirname24(project2.configPath), project2.entitiesDir)
|
|
258210
258292
|
}, devLogger);
|
|
258211
258293
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
258212
258294
|
try {
|
|
@@ -262772,7 +262854,7 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
262772
262854
|
// src/cli/index.ts
|
|
262773
262855
|
var __dirname4 = dirname26(fileURLToPath6(import.meta.url));
|
|
262774
262856
|
async function runCLI(options8) {
|
|
262775
|
-
ensureNpmAssets(
|
|
262857
|
+
ensureNpmAssets(join31(__dirname4, "../assets"));
|
|
262776
262858
|
const errorReporter = new ErrorReporter;
|
|
262777
262859
|
errorReporter.registerProcessErrorHandlers();
|
|
262778
262860
|
const jsonMode = process.argv.includes("--json");
|
|
@@ -262811,4 +262893,4 @@ export {
|
|
|
262811
262893
|
CLIExitError
|
|
262812
262894
|
};
|
|
262813
262895
|
|
|
262814
|
-
//# debugId=
|
|
262896
|
+
//# debugId=33E3FAB72031407264756E2164756E21
|