@base44-preview/cli 0.1.6-pr.555.5550cb0 → 0.1.6-pr.555.61021b6
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 +22 -61
- package/dist/cli/index.js.map +6 -6
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -239133,9 +239133,6 @@ function getAppConfigPath(projectRoot) {
|
|
|
239133
239133
|
function getTypesOutputPath(projectRoot) {
|
|
239134
239134
|
return join2(projectRoot, PROJECT_SUBDIR, TYPES_OUTPUT_SUBDIR, TYPES_FILENAME);
|
|
239135
239135
|
}
|
|
239136
|
-
function getActorRuntimeTypesPath(projectRoot) {
|
|
239137
|
-
return join2(projectRoot, PROJECT_SUBDIR, TYPES_OUTPUT_SUBDIR, "runtime.d.ts");
|
|
239138
|
-
}
|
|
239139
239136
|
function getBase44ApiUrl() {
|
|
239140
239137
|
return process.env.BASE44_API_URL || "https://app.base44.com";
|
|
239141
239138
|
}
|
|
@@ -254930,23 +254927,6 @@ async function detectSdkPackageName(projectRoot) {
|
|
|
254930
254927
|
async function generateTypesFile(input) {
|
|
254931
254928
|
const content = await generateContent(input);
|
|
254932
254929
|
await writeFile(getTypesOutputPath(input.projectRoot), content);
|
|
254933
|
-
const runtimePath = getActorRuntimeTypesPath(input.projectRoot);
|
|
254934
|
-
if (input.actors.length) {
|
|
254935
|
-
const sdkPackage = await detectSdkPackageName(input.projectRoot);
|
|
254936
|
-
await writeFile(runtimePath, actorRuntimeDeclaration(sdkPackage));
|
|
254937
|
-
} else if (await pathExists(runtimePath)) {
|
|
254938
|
-
await deleteFile(runtimePath);
|
|
254939
|
-
}
|
|
254940
|
-
}
|
|
254941
|
-
function actorRuntimeDeclaration(sdkPackage) {
|
|
254942
|
-
return `${HEADER2}
|
|
254943
|
-
|
|
254944
|
-
${import_common_tags.source`
|
|
254945
|
-
declare module 'base44:runtime/actors' {
|
|
254946
|
-
export { Actor } from '${sdkPackage}';
|
|
254947
|
-
}
|
|
254948
|
-
`}
|
|
254949
|
-
`;
|
|
254950
254930
|
}
|
|
254951
254931
|
async function generateContent(input) {
|
|
254952
254932
|
const { entities, functions, agents, connectors, actors } = input;
|
|
@@ -254977,6 +254957,11 @@ async function generateContent(input) {
|
|
|
254977
254957
|
];
|
|
254978
254958
|
const registries2 = registryEntries.filter(([, entries]) => entries.length > 0).map(([name2, entries]) => registry2(name2, entries));
|
|
254979
254959
|
const actorInterfaces = actorResults.map((r5) => r5.decls).filter(Boolean);
|
|
254960
|
+
const actorRuntimeModule = actors.length ? import_common_tags.source`
|
|
254961
|
+
declare module 'base44:runtime/actors' {
|
|
254962
|
+
export { Actor } from '${sdkPackage}';
|
|
254963
|
+
}
|
|
254964
|
+
` : "";
|
|
254980
254965
|
return [
|
|
254981
254966
|
HEADER2,
|
|
254982
254967
|
"export {};",
|
|
@@ -254992,7 +254977,8 @@ async function generateContent(input) {
|
|
|
254992
254977
|
|
|
254993
254978
|
`)}
|
|
254994
254979
|
}
|
|
254995
|
-
|
|
254980
|
+
`,
|
|
254981
|
+
actorRuntimeModule
|
|
254996
254982
|
].filter(Boolean).join(`
|
|
254997
254983
|
|
|
254998
254984
|
`);
|
|
@@ -255104,7 +255090,6 @@ function toPascalCase(name2) {
|
|
|
255104
255090
|
// src/core/types/update-project.ts
|
|
255105
255091
|
import { join as join18 } from "node:path";
|
|
255106
255092
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
255107
|
-
var ACTORS_INCLUDE_PATH = `${PROJECT_SUBDIR}/actors/**/*.ts`;
|
|
255108
255093
|
async function updateProjectConfig(projectRoot) {
|
|
255109
255094
|
const tsconfigPath = join18(projectRoot, "tsconfig.json");
|
|
255110
255095
|
if (!await pathExists(tsconfigPath)) {
|
|
@@ -255115,17 +255100,12 @@ async function updateProjectConfig(projectRoot) {
|
|
|
255115
255100
|
if (!tsconfig.include) {
|
|
255116
255101
|
tsconfig.include = [];
|
|
255117
255102
|
}
|
|
255118
|
-
|
|
255119
|
-
|
|
255120
|
-
if (!tsconfig.include.includes(path17)) {
|
|
255121
|
-
tsconfig.include.push(path17);
|
|
255122
|
-
changed = true;
|
|
255123
|
-
}
|
|
255124
|
-
}
|
|
255125
|
-
if (changed) {
|
|
255126
|
-
await writeJsonFile(tsconfigPath, tsconfig);
|
|
255103
|
+
if (tsconfig.include.includes(TYPES_INCLUDE_PATH)) {
|
|
255104
|
+
return false;
|
|
255127
255105
|
}
|
|
255128
|
-
|
|
255106
|
+
tsconfig.include.push(TYPES_INCLUDE_PATH);
|
|
255107
|
+
await writeJsonFile(tsconfigPath, tsconfig);
|
|
255108
|
+
return true;
|
|
255129
255109
|
} catch {
|
|
255130
255110
|
return false;
|
|
255131
255111
|
}
|
|
@@ -255133,13 +255113,15 @@ async function updateProjectConfig(projectRoot) {
|
|
|
255133
255113
|
// src/cli/commands/actor/new.ts
|
|
255134
255114
|
function buildActorScaffold(actorName) {
|
|
255135
255115
|
return `import { Actor } from "base44:runtime/actors";
|
|
255136
|
-
import type {
|
|
255116
|
+
import type { Conn } from "@base44/sdk";
|
|
255137
255117
|
|
|
255138
|
-
|
|
255139
|
-
//
|
|
255140
|
-
|
|
255141
|
-
|
|
255142
|
-
|
|
255118
|
+
interface Incoming {
|
|
255119
|
+
// messages clients send to this actor (schema toServer)
|
|
255120
|
+
}
|
|
255121
|
+
|
|
255122
|
+
interface Outgoing {
|
|
255123
|
+
// messages this actor sends to clients (schema toClient)
|
|
255124
|
+
}
|
|
255143
255125
|
|
|
255144
255126
|
export class ${actorName} extends Actor<Incoming, Outgoing> {
|
|
255145
255127
|
handleConnect(conn: Conn<Outgoing>) {
|
|
@@ -255153,26 +255135,6 @@ export class ${actorName} extends Actor<Incoming, Outgoing> {
|
|
|
255153
255135
|
}
|
|
255154
255136
|
`;
|
|
255155
255137
|
}
|
|
255156
|
-
function buildActorSchema() {
|
|
255157
|
-
return `{
|
|
255158
|
-
"types": {},
|
|
255159
|
-
// Messages this actor sends to clients (server → client).
|
|
255160
|
-
"toClient": {
|
|
255161
|
-
"welcome": {
|
|
255162
|
-
"properties": { "message": { "type": "string" } },
|
|
255163
|
-
"required": ["message"]
|
|
255164
|
-
}
|
|
255165
|
-
},
|
|
255166
|
-
// Messages clients send to this actor (client → server).
|
|
255167
|
-
"toServer": {
|
|
255168
|
-
"hello": {
|
|
255169
|
-
"properties": { "name": { "type": "string" } },
|
|
255170
|
-
"required": ["name"]
|
|
255171
|
-
}
|
|
255172
|
-
}
|
|
255173
|
-
}
|
|
255174
|
-
`;
|
|
255175
|
-
}
|
|
255176
255138
|
async function newActorAction(_ctx, actorName) {
|
|
255177
255139
|
const { project: project2 } = await readProjectConfig();
|
|
255178
255140
|
const actorsDir = join19(dirname14(project2.configPath), project2.actorsDir);
|
|
@@ -255182,7 +255144,6 @@ async function newActorAction(_ctx, actorName) {
|
|
|
255182
255144
|
}
|
|
255183
255145
|
const entryPath = join19(actorDir, "entry.ts");
|
|
255184
255146
|
await writeFile(entryPath, buildActorScaffold(actorName));
|
|
255185
|
-
await writeFile(join19(actorDir, "schema.jsonc"), buildActorSchema());
|
|
255186
255147
|
const { entities, functions, agents, connectors, actors } = await readProjectConfig();
|
|
255187
255148
|
await generateTypesFile({
|
|
255188
255149
|
projectRoot: project2.root,
|
|
@@ -255194,7 +255155,7 @@ async function newActorAction(_ctx, actorName) {
|
|
|
255194
255155
|
});
|
|
255195
255156
|
await updateProjectConfig(project2.root);
|
|
255196
255157
|
return {
|
|
255197
|
-
outroMessage: `Created actor "${actorName}" at ${entryPath}
|
|
255158
|
+
outroMessage: `Created actor "${actorName}" at ${entryPath}`
|
|
255198
255159
|
};
|
|
255199
255160
|
}
|
|
255200
255161
|
function getNewCommand() {
|
|
@@ -266902,4 +266863,4 @@ export {
|
|
|
266902
266863
|
CLIExitError
|
|
266903
266864
|
};
|
|
266904
266865
|
|
|
266905
|
-
//# debugId=
|
|
266866
|
+
//# debugId=4CCC3CA8963106DE64756E2164756E21
|