@phreshos/node 0.1.19 → 0.1.20
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/project.js +4 -0
- package/dist/system.js +18 -5
- package/package.json +3 -3
package/dist/project.js
CHANGED
|
@@ -68,6 +68,7 @@ export class Project {
|
|
|
68
68
|
description: config.description,
|
|
69
69
|
options: config.options,
|
|
70
70
|
startup: config.startup,
|
|
71
|
+
launch: config.launch,
|
|
71
72
|
categories: config.categories,
|
|
72
73
|
keywords: config.keywords,
|
|
73
74
|
website: config.website,
|
|
@@ -224,6 +225,8 @@ function validateConfig(config) {
|
|
|
224
225
|
parseLaunch({ options: config.options });
|
|
225
226
|
if (config.startup !== undefined && typeof config.startup !== "boolean")
|
|
226
227
|
parseLaunch(config.startup);
|
|
228
|
+
if (config.launch !== undefined && config.launch !== true)
|
|
229
|
+
parseLaunch(config.launch);
|
|
227
230
|
if (typeof config.identity !== "string" || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(config.identity)) {
|
|
228
231
|
throw new Error("A Program's identity must be kebab-case");
|
|
229
232
|
}
|
|
@@ -322,6 +325,7 @@ function packageDefinition(config, version) {
|
|
|
322
325
|
description: config.description,
|
|
323
326
|
options: config.options,
|
|
324
327
|
startup: config.startup,
|
|
328
|
+
launch: config.launch,
|
|
325
329
|
icon: config.icon ? "icon.png" : undefined,
|
|
326
330
|
agent: config.agent ? "agent.md" : undefined,
|
|
327
331
|
categories: config.categories,
|
package/dist/system.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClientEndpoint as CoreClientEndpoint, ClientService as CoreClientService, Process as CoreProcess, Program as CoreProgram, ServerEndpoint as CoreServerEndpoint, ServerService as CoreServerService, isServiceKey, parseEndpointReference } from "@phreshos/core";
|
|
1
|
+
import { ClientEndpoint as CoreClientEndpoint, ClientService as CoreClientService, Process as CoreProcess, Program as CoreProgram, ServerEndpoint as CoreServerEndpoint, ServerService as CoreServerService, isServiceKey, parseEndpointReference, parseLaunch } from "@phreshos/core";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { gatewayAddress } from "./address.js";
|
|
4
4
|
import Events from "./events.js";
|
|
@@ -161,6 +161,7 @@ class ProgramHandle extends CoreProgram {
|
|
|
161
161
|
database;
|
|
162
162
|
process;
|
|
163
163
|
startup;
|
|
164
|
+
launch;
|
|
164
165
|
permissions;
|
|
165
166
|
snapshot;
|
|
166
167
|
constructor(system, snapshot) {
|
|
@@ -187,6 +188,7 @@ class ProgramHandle extends CoreProgram {
|
|
|
187
188
|
this.database = programSql(call, address, "database");
|
|
188
189
|
this.process = new ProgramProcesses(system, this);
|
|
189
190
|
this.startup = new ProgramStartup(system, this);
|
|
191
|
+
this.launch = new ProgramLaunch(system, this);
|
|
190
192
|
this.permissions = programPermissions(call, address);
|
|
191
193
|
}
|
|
192
194
|
get name() { return this.snapshot.name; }
|
|
@@ -223,15 +225,26 @@ class ProgramHandle extends CoreProgram {
|
|
|
223
225
|
}
|
|
224
226
|
install() { return command(this.system, "install", this.address()); }
|
|
225
227
|
uninstall(everything = false) { return command(this.system, "uninstall", this.address(), everything); }
|
|
226
|
-
async fork(identity) {
|
|
227
|
-
const created = await representation(this.system).call("/program/fork-program", this.address(), identity);
|
|
228
|
-
return programHandle(this.system, required(representation(this.system).programs.get(created), created));
|
|
229
|
-
}
|
|
230
228
|
async forget() {
|
|
231
229
|
await representation(this.system).call("/program/forget-program", this.address(), "");
|
|
232
230
|
}
|
|
233
231
|
address() { return Object.freeze({ identity: this.identity, reference: this.reference }); }
|
|
234
232
|
}
|
|
233
|
+
class ProgramLaunch {
|
|
234
|
+
system;
|
|
235
|
+
program;
|
|
236
|
+
constructor(system, program) {
|
|
237
|
+
this.system = system;
|
|
238
|
+
this.program = program;
|
|
239
|
+
}
|
|
240
|
+
async get() {
|
|
241
|
+
const value = await representation(this.system).call("/program/launch", this.program.address(), "get");
|
|
242
|
+
return value === null ? null : parseLaunch(value);
|
|
243
|
+
}
|
|
244
|
+
async set(launch) {
|
|
245
|
+
await representation(this.system).call("/program/launch", this.program.address(), "set", parseLaunch(launch));
|
|
246
|
+
}
|
|
247
|
+
}
|
|
235
248
|
class ProgramStartup {
|
|
236
249
|
system;
|
|
237
250
|
program;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phreshos/node",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "Node.js access to PhreshOS and Program projects.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"jiti": "^2.7.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@phreshos/core": "^0.1.
|
|
45
|
+
"@phreshos/core": "^0.1.45"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@phreshos/core": "^0.1.
|
|
48
|
+
"@phreshos/core": "^0.1.45",
|
|
49
49
|
"@types/adm-zip": "^0.5.8",
|
|
50
50
|
"@types/node": "^26.2.0",
|
|
51
51
|
"typescript": "^6.0.3",
|