@base44-preview/cli 0.1.6-pr.555.a30aaa5 → 0.1.6-pr.555.b635ff5
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 +11 -31
- package/dist/cli/index.js.map +3 -3
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -255133,16 +255133,17 @@ async function updateProjectConfig(projectRoot) {
|
|
|
255133
255133
|
// src/cli/commands/actor/new.ts
|
|
255134
255134
|
function buildActorScaffold(actorName) {
|
|
255135
255135
|
return `import { Actor } from "base44:runtime/actors";
|
|
255136
|
-
import type {
|
|
255136
|
+
import type { Conn } from "@base44/sdk";
|
|
255137
255137
|
|
|
255138
|
-
|
|
255139
|
-
//
|
|
255140
|
-
|
|
255141
|
-
|
|
255142
|
-
|
|
255138
|
+
interface Incoming {
|
|
255139
|
+
// messages clients send to this actor (schema toServer)
|
|
255140
|
+
}
|
|
255141
|
+
|
|
255142
|
+
interface Outgoing {
|
|
255143
|
+
// messages this actor sends to clients (schema toClient)
|
|
255144
|
+
}
|
|
255143
255145
|
|
|
255144
|
-
|
|
255145
|
-
export default class ${actorName} extends Actor<Incoming, Outgoing> {
|
|
255146
|
+
export class ${actorName} extends Actor<Incoming, Outgoing> {
|
|
255146
255147
|
handleConnect(conn: Conn<Outgoing>) {
|
|
255147
255148
|
console.log("Connected:", conn.id);
|
|
255148
255149
|
}
|
|
@@ -255154,26 +255155,6 @@ export default class ${actorName} extends Actor<Incoming, Outgoing> {
|
|
|
255154
255155
|
}
|
|
255155
255156
|
`;
|
|
255156
255157
|
}
|
|
255157
|
-
function buildActorSchema() {
|
|
255158
|
-
return `{
|
|
255159
|
-
"types": {},
|
|
255160
|
-
// Messages this actor sends to clients (server → client).
|
|
255161
|
-
"toClient": {
|
|
255162
|
-
"welcome": {
|
|
255163
|
-
"properties": { "message": { "type": "string" } },
|
|
255164
|
-
"required": ["message"]
|
|
255165
|
-
}
|
|
255166
|
-
},
|
|
255167
|
-
// Messages clients send to this actor (client → server).
|
|
255168
|
-
"toServer": {
|
|
255169
|
-
"hello": {
|
|
255170
|
-
"properties": { "name": { "type": "string" } },
|
|
255171
|
-
"required": ["name"]
|
|
255172
|
-
}
|
|
255173
|
-
}
|
|
255174
|
-
}
|
|
255175
|
-
`;
|
|
255176
|
-
}
|
|
255177
255158
|
async function newActorAction(_ctx, actorName) {
|
|
255178
255159
|
const { project: project2 } = await readProjectConfig();
|
|
255179
255160
|
const actorsDir = join19(dirname14(project2.configPath), project2.actorsDir);
|
|
@@ -255183,7 +255164,6 @@ async function newActorAction(_ctx, actorName) {
|
|
|
255183
255164
|
}
|
|
255184
255165
|
const entryPath = join19(actorDir, "entry.ts");
|
|
255185
255166
|
await writeFile(entryPath, buildActorScaffold(actorName));
|
|
255186
|
-
await writeFile(join19(actorDir, "schema.jsonc"), buildActorSchema());
|
|
255187
255167
|
const { entities, functions, agents, connectors, actors } = await readProjectConfig();
|
|
255188
255168
|
await generateTypesFile({
|
|
255189
255169
|
projectRoot: project2.root,
|
|
@@ -255195,7 +255175,7 @@ async function newActorAction(_ctx, actorName) {
|
|
|
255195
255175
|
});
|
|
255196
255176
|
await updateProjectConfig(project2.root);
|
|
255197
255177
|
return {
|
|
255198
|
-
outroMessage: `Created actor "${actorName}" at ${entryPath}
|
|
255178
|
+
outroMessage: `Created actor "${actorName}" at ${entryPath}`
|
|
255199
255179
|
};
|
|
255200
255180
|
}
|
|
255201
255181
|
function getNewCommand() {
|
|
@@ -266903,4 +266883,4 @@ export {
|
|
|
266903
266883
|
CLIExitError
|
|
266904
266884
|
};
|
|
266905
266885
|
|
|
266906
|
-
//# debugId=
|
|
266886
|
+
//# debugId=DF61DEFE12BF608864756E2164756E21
|