@zenmo/orchestrator-entrypoint 0.0.0-stage → 0.1.0

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.
Files changed (3) hide show
  1. package/README.md +43 -2
  2. package/index.d.ts +42 -0
  3. package/package.json +23 -4
package/README.md CHANGED
@@ -1,3 +1,44 @@
1
- # Temporary Holding Version
1
+ # `@zenmo/orchestrator-entrypoint`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ TypeScript type definitions for simulation model Single-Page Applications (SPAs) mounted by the LUX Orchestrator.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install --save-dev @zenmo/orchestrator-entrypoint
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Type-checking the `mount` function
14
+
15
+ ```ts
16
+ import type { MountParameters, OrchestratorMountFn } from "@zenmo/orchestrator-entrypoint";
17
+
18
+ const mount: OrchestratorMountFn = (parameters: MountParameters) => {
19
+ const { baseUrl, element, endSession } = parameters;
20
+ // Render simulation UI into `element`
21
+ };
22
+
23
+ export default mount;
24
+ ```
25
+
26
+ ### Type-checking the entire entrypoint module
27
+
28
+ ```ts
29
+ import type { EntrypointModule } from "@zenmo/orchestrator-entrypoint";
30
+ import * as entrypoint from "./mount";
31
+
32
+ entrypoint satisfies EntrypointModule;
33
+ ```
34
+
35
+ ## Publishing a New Version
36
+
37
+ 1. Log in to npm once on your machine:
38
+ ```bash
39
+ npm login
40
+ ```
41
+ 2. Bump `"version"` in `orchestrator-entrypoint/package.json` and publish from the repository root:
42
+ ```bash
43
+ npm publish --workspace=@zenmo/orchestrator-entrypoint
44
+ ```
package/index.d.ts ADDED
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Optional lifecycle handle returned by a simulation model's JavaScript entrypoint.
3
+ */
4
+ export interface MountedModelInstance {
5
+ unmount?: () => void;
6
+ }
7
+
8
+ /**
9
+ * Parameters passed by the Orchestrator browser library when mounting the simulation model frontend
10
+ * into a host page.
11
+ */
12
+ export interface MountParameters {
13
+ /**
14
+ * Base URL of the running model session (for example,
15
+ * `https://orchestrator.lux.energy/session/<sessionId>/proxy`).
16
+ * All engine API requests and static asset fetches should be done relative to this URL.
17
+ */
18
+ baseUrl: string;
19
+ /**
20
+ * Target DOM element in the host page where the simulation user interface is put.
21
+ */
22
+ element: HTMLElement;
23
+ /**
24
+ * Callback to terminate the running session in the Orchestrator and clean up the container.
25
+ * Can be called when the user exits the model.
26
+ */
27
+ endSession?: () => void | Promise<void>;
28
+ }
29
+
30
+ /**
31
+ * Signature of a simulation model bundle's exported mount function.
32
+ */
33
+ export type OrchestratorMountFn = (
34
+ parameters: MountParameters,
35
+ ) => MountedModelInstance | void | Promise<MountedModelInstance | void>;
36
+
37
+ /**
38
+ * Shape of a simulation model's JavaScript entrypoint module.
39
+ */
40
+ export type EntrypointModule = {
41
+ default: OrchestratorMountFn;
42
+ };
package/package.json CHANGED
@@ -1,6 +1,25 @@
1
1
  {
2
2
  "name": "@zenmo/orchestrator-entrypoint",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "TypeScript type definitions for simulation model SPAs mounted by the LUX Orchestrator",
5
+ "type": "module",
6
+ "types": "./index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./index.d.ts"
10
+ }
11
+ },
12
+ "files": [
13
+ "index.d.ts",
14
+ "README.md"
15
+ ],
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/zenmo/lux-orchestrator.git",
19
+ "directory": "orchestrator-entrypoint"
20
+ },
21
+ "publishConfig": {
22
+ "registry": "https://registry.npmjs.org",
23
+ "access": "public"
24
+ }
25
+ }