@thatopen/services 0.7.0 → 0.9.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.
- package/README.md +62 -62
- package/dist/built-in/index.d.ts +66 -41
- package/dist/cli/lib/revit-addin.d.ts +8 -0
- package/dist/cli.js +154 -13
- package/dist/core/client.d.ts +6 -0
- package/dist/core/platform-client.d.ts +139 -0
- package/dist/core/platform-client.live.test.d.ts +1 -0
- package/dist/core/platform-client.notifications.test.d.ts +1 -0
- package/dist/index.cjs.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +635 -445
- package/dist/types/notifications.d.ts +54 -0
- package/dist/vite-env.d.ts +1 -1
- package/docs/ai-quickstart.md +120 -1
- package/docs/cli/create.md +29 -29
- package/docs/cli/local-server.md +38 -38
- package/docs/cli/login.md +32 -32
- package/docs/cli/publish.md +31 -31
- package/docs/cli/run.md +26 -26
- package/docs/cli/serve.md +43 -43
- package/docs/cli/swap.md +30 -30
- package/docs/flow-plugin-guide.md +26 -0
- package/docs/revit-collab-quickstart.md +26 -17
- package/docs/rhino-interop-quickstart.md +74 -7
- package/package.json +1 -1
- package/resources/AGENTS.md +40 -40
- package/src/built-in/CDEManager/example.ts +214 -214
- package/src/built-in/CDEManager/examples/FileEditing/example.ts +226 -226
- package/src/built-in/CDEManager/examples/FileMoves/example.ts +186 -186
- package/src/built-in/CDEManager/examples/FileOperations/example.ts +295 -295
- package/src/built-in/CDEManager/examples/FileTransfers/example.ts +210 -210
- package/src/built-in/CDEManager/examples/FolderManagement/example.ts +230 -230
- package/src/built-in/CDEManager/examples/MetadataSchema/example.ts +230 -230
- package/src/built-in/CDEManager/examples/MetadataViews/example.ts +166 -166
- package/src/built-in/CDEManager/examples/ProjectConfig/example.ts +177 -177
- package/src/built-in/UIManager/src/app/example.ts +97 -97
- package/src/built-in/UIManager/src/app/examples/AppState/example.ts +140 -140
- package/src/built-in/UIManager/src/app/examples/Banner/example.ts +159 -159
- package/src/built-in/UIManager/src/app/examples/Contexts/example.ts +123 -123
- package/src/built-in/UIManager/src/app/examples/FileDrop/example.ts +124 -124
- package/src/built-in/UIManager/src/app/examples/FloatingLayout/example.ts +90 -90
- package/src/built-in/UIManager/src/app/examples/Modal/example.ts +163 -163
- package/src/built-in/UIManager/src/app/examples/Notifications/example.ts +133 -133
- package/src/built-in/UIManager/src/app/examples/ProjectFileStorage/example.ts +150 -150
- package/src/built-in/UIManager/src/app/examples/Sidebar/example.ts +102 -102
- package/src/built-in/UIManager/src/clashes-panel/example.ts +183 -183
- package/src/built-in/UIManager/src/git-history-panel/example.ts +70 -70
- package/src/built-in/UIManager/src/models-list/example.ts +122 -122
- package/src/built-in/UIManager/src/topics-panel/example.ts +170 -170
- package/src/built-in/index.ts +66 -41
- package/src/cli/templates/app/index.html +35 -35
- package/src/cli/templates/app/package.json +32 -32
- package/src/cli/templates/app/src/bim-components/CloudRunner/index.ts +95 -95
- package/src/cli/templates/app/src/bim-components/CloudRunner/src/index.ts +1 -1
- package/src/cli/templates/app/src/bim-components/CloudRunner/src/types.ts +5 -5
- package/src/cli/templates/app/src/bim-components/index.ts +1 -1
- package/src/cli/templates/app/src/globals.ts +1 -1
- package/src/cli/templates/app/src/main.history.ts +191 -0
- package/src/cli/templates/app/src/ui-components/app-info-section/index.ts +26 -26
- package/src/cli/templates/app/src/ui-components/app-info-section/src/index.ts +1 -1
- package/src/cli/templates/app/src/ui-components/app-info-section/src/types.ts +15 -15
- package/src/cli/templates/app/src/ui-components/cloud-runner-section/index.ts +37 -37
- package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/index.ts +1 -1
- package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/types.ts +14 -14
- package/src/cli/templates/app/src/ui-components/index.ts +2 -2
- package/src/cli/templates/app/tsconfig.json +16 -16
- package/src/cli/templates/app/vite.config.js +57 -57
- package/src/cli/templates/cloud-component/README.md +205 -205
- package/src/cli/templates/cloud-component/_thatopen +5 -5
- package/src/cli/templates/cloud-component/declarations.json +4 -4
- package/src/cli/templates/cloud-component/package.json +21 -21
- package/src/cli/templates/cloud-component/src/main.ts +70 -70
- package/src/cli/templates/cloud-component/tsconfig.json +16 -16
- package/src/cli/templates/cloud-component/vite.config.js +46 -46
- package/src/cli/templates/shared/AGENTS.md +8 -8
- package/src/cli/templates/shared/CLAUDE.md +1 -1
- package/src/cli/templates/shared/_gitignore +5 -5
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type NotificationCategoryDto = 'automation' | 'invitation';
|
|
2
|
+
export type NotificationTypeDto = 'automation.run.started' | 'automation.run.finished' | 'invitation.added' | 'invitation.accepted' | 'project.role_changed';
|
|
3
|
+
/**
|
|
4
|
+
* One notification as the API returns it.
|
|
5
|
+
*
|
|
6
|
+
* Ids are strings and timestamps are ISO-8601 strings, because that is what
|
|
7
|
+
* JSON carries. The producer payload is deliberately absent: `title`, `body`
|
|
8
|
+
* and `link` are built server-side, so the data behind them is an internal
|
|
9
|
+
* detail rather than part of this contract.
|
|
10
|
+
*/
|
|
11
|
+
export interface NotificationDto {
|
|
12
|
+
_id: string;
|
|
13
|
+
accountId: string;
|
|
14
|
+
type: NotificationTypeDto;
|
|
15
|
+
category: NotificationCategoryDto;
|
|
16
|
+
title: string;
|
|
17
|
+
body: string;
|
|
18
|
+
link?: string;
|
|
19
|
+
/** Silenced by the recipient: still listed, but no badge and no channel. */
|
|
20
|
+
muted: boolean;
|
|
21
|
+
readAt: string | null;
|
|
22
|
+
createdAt: string;
|
|
23
|
+
}
|
|
24
|
+
/** `nextCursor` is opaque — pass it back verbatim. Null means the last page. */
|
|
25
|
+
export interface NotificationPageDto {
|
|
26
|
+
items: NotificationDto[];
|
|
27
|
+
nextCursor: string | null;
|
|
28
|
+
}
|
|
29
|
+
/** Excludes muted and already-read notifications: this is the bell badge. */
|
|
30
|
+
export interface UnreadCountDto {
|
|
31
|
+
count: number;
|
|
32
|
+
}
|
|
33
|
+
export interface MarkNotificationsReadResultDto {
|
|
34
|
+
updated: number;
|
|
35
|
+
}
|
|
36
|
+
/** A user's opt-in to one automation's runs, as the API returns it. */
|
|
37
|
+
export interface NotificationSubscriptionView {
|
|
38
|
+
_id: string;
|
|
39
|
+
accountId: string;
|
|
40
|
+
hookId: string;
|
|
41
|
+
/** Absent for personal automations, which belong to an account. */
|
|
42
|
+
projectId?: string;
|
|
43
|
+
filter: NotificationSubscriptionFilter;
|
|
44
|
+
channels?: {
|
|
45
|
+
email?: boolean;
|
|
46
|
+
};
|
|
47
|
+
createdAt: string;
|
|
48
|
+
updatedAt?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* `failures` suppresses started events entirely and only passes a finished
|
|
52
|
+
* run that did not succeed.
|
|
53
|
+
*/
|
|
54
|
+
export type NotificationSubscriptionFilter = 'all' | 'failures';
|
package/dist/vite-env.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
1
|
+
/// <reference types="vite/client" />
|
package/docs/ai-quickstart.md
CHANGED
|
@@ -87,6 +87,16 @@ thatopen create my-app --beta
|
|
|
87
87
|
cd my-app
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
+
**[app, showing a Revit model's commit history]** If what they asked for is a viewer of the
|
|
91
|
+
revit-flow history, scaffold it directly. Do not build it by hand: the wiring is four additions in
|
|
92
|
+
three places and the ORDER of them is load-bearing (see the boot order section below). This ships
|
|
93
|
+
it already correct, opening on the History layout.
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
thatopen create my-app --beta --history
|
|
97
|
+
cd my-app
|
|
98
|
+
```
|
|
99
|
+
|
|
90
100
|
**[component]**
|
|
91
101
|
```bash
|
|
92
102
|
thatopen create my-component -t cloud-component --beta
|
|
@@ -110,6 +120,17 @@ npm run dev
|
|
|
110
120
|
Serves the app and opens it inside the platform. **You now have a complete, working viewer** —
|
|
111
121
|
model loading, spatial tree, properties, measurement, sectioning, and more.
|
|
112
122
|
|
|
123
|
+
If it does not open by itself, or the user closes the tab, the app you are serving from this
|
|
124
|
+
machine lives at:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
https://platform.thatopen.com/dashboard/projects/<PROJECT_ID>/apps/local-app
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Substitute the project id. That is the local app running inside the platform's own UI, against
|
|
131
|
+
the project's real data. Send the user there rather than to a bare localhost port, which is the
|
|
132
|
+
app without the platform around it.
|
|
133
|
+
|
|
113
134
|
> **`npx tsc --noEmit` reports errors in a fresh beta scaffold, and they are not real.** You will see
|
|
114
135
|
> a handful of `Cannot find module '@thatopen/components'` and friends. A beta project aliases those
|
|
115
136
|
> imports to the `@thatopen-platform/*-beta` packages in `vite.config.js`, which bare `tsc` does not
|
|
@@ -126,6 +147,101 @@ npm run run # executes the component locally against the platform (no bro
|
|
|
126
147
|
```
|
|
127
148
|
Runs `main()` in a local emulation of the cloud engine so you can iterate before publishing.
|
|
128
149
|
|
|
150
|
+
## THE BOOT ORDER. Read this before you write a line of an app.
|
|
151
|
+
|
|
152
|
+
**This is where apps break, and the error never names the real cause.** An app boots in four
|
|
153
|
+
stages, and a built-in that touches models or the 3D scene must be initialised in the LAST one.
|
|
154
|
+
Call it where it reads naturally, right after `client.setup`, and you get:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
Error: FragmentsManager not initialized. Call init() first.
|
|
158
|
+
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'onHighlight')
|
|
159
|
+
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'onClear')
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
None of which says "you called this too early". The app renders, the panel mounts, and it sits
|
|
163
|
+
there inert.
|
|
164
|
+
|
|
165
|
+
**Why.** `FragmentsManager` is initialised inside `top-app`'s own `setup` callback, and the 3D
|
|
166
|
+
world does not exist until `<top-app>` has been added to the DOM and `top-viewer` has built it.
|
|
167
|
+
Both of those happen well after `client.setup` returns. Any manager that reads model files or
|
|
168
|
+
colours elements reaches for them the moment it starts.
|
|
169
|
+
|
|
170
|
+
**The order, and it is not negotiable:**
|
|
171
|
+
|
|
172
|
+
1. `client.setup(...)` with every built-in you need, then `components.get(UIManager).init()`
|
|
173
|
+
2. `app.setup = ...`, which is where `FragmentsManager.init` goes, and append `<top-app>`
|
|
174
|
+
3. `await firstWorld(...)`, so the world exists
|
|
175
|
+
4. **only now**, `init(client)` on the model-facing managers
|
|
176
|
+
|
|
177
|
+
Copy this skeleton. It is the boot of an app that works.
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
async function main() {
|
|
181
|
+
const client = PlatformClient.fromPlatformContext();
|
|
182
|
+
|
|
183
|
+
// 1 ── built-ins registered, UI shell up
|
|
184
|
+
const { components } = await client.setup<OBC.Components>(
|
|
185
|
+
{ OBC, OBF, BUI, THREE, FRAGS, MARKERJS },
|
|
186
|
+
{ uuid: UIManager.uuid },
|
|
187
|
+
{ uuid: GitHistoryManager.uuid }, // and any other built-in you use
|
|
188
|
+
);
|
|
189
|
+
components.get(UIManager).init();
|
|
190
|
+
|
|
191
|
+
const viewerEl = document.createElement("top-viewer");
|
|
192
|
+
const app = document.createElement("top-app") as any;
|
|
193
|
+
|
|
194
|
+
// 2 ── this callback is what initialises FragmentsManager. Nothing that needs
|
|
195
|
+
// fragments may run before it has resolved.
|
|
196
|
+
app.setup = (waitUntil: (p: Promise<void>, label?: string) => void) => {
|
|
197
|
+
waitUntil(
|
|
198
|
+
(async () => {
|
|
199
|
+
const fragments = components.get(OBC.FragmentsManager);
|
|
200
|
+
const workerUrl = await FRAGS.FragmentsModels.getWorker();
|
|
201
|
+
fragments.init(await FRAGS.toClassicWorker(workerUrl), { classicWorker: true });
|
|
202
|
+
})(),
|
|
203
|
+
"Fragments Core",
|
|
204
|
+
);
|
|
205
|
+
return { components, client };
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
app.elements = { viewer: () => BUI.html`${viewerEl}` };
|
|
209
|
+
app.layouts = { Main: { template: `"viewer" 1fr / 1fr` } };
|
|
210
|
+
app.layout = "Main";
|
|
211
|
+
(document.getElementById("that-open-app") ?? document.body).appendChild(app);
|
|
212
|
+
|
|
213
|
+
// 3 ── the world is created asynchronously by top-viewer. Wait for it.
|
|
214
|
+
await firstWorld(components.get(OBC.Worlds));
|
|
215
|
+
|
|
216
|
+
// 4 ── ONLY NOW. Everything above had to have happened first.
|
|
217
|
+
await components.get(GitHistoryManager).init(client);
|
|
218
|
+
|
|
219
|
+
// ...and from here, the real layouts, panels and elements.
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** Resolves with the first world once it exists (top-viewer creates it async). */
|
|
223
|
+
function firstWorld(worlds: any): Promise<any> {
|
|
224
|
+
const existing = [...worlds.list.values()][0];
|
|
225
|
+
if (existing) return Promise.resolve(existing);
|
|
226
|
+
return new Promise((resolve) => {
|
|
227
|
+
const handler = ({ value }: any) => {
|
|
228
|
+
worlds.list.onItemSet.remove(handler);
|
|
229
|
+
resolve(value);
|
|
230
|
+
};
|
|
231
|
+
worlds.list.onItemSet.add(handler);
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**Two more traps in the same family:**
|
|
237
|
+
|
|
238
|
+
- **One stable `top-viewer` node, held in a variable and returned by reference** from every
|
|
239
|
+
`elements.viewer()` call. Creating a fresh element on each render disposes the world and
|
|
240
|
+
builds another one, and everything wired to the old one goes quiet.
|
|
241
|
+
- **Registering a built-in is not the same as initialising it.** `client.setup` makes
|
|
242
|
+
`<top-git-history>` resolvable; `init(client)` is what fills it. A panel that mounts and stays
|
|
243
|
+
empty is usually the second one missing, not the first.
|
|
244
|
+
|
|
129
245
|
## 5. Then build — read the in-project agent guide
|
|
130
246
|
|
|
131
247
|
The scaffold is real, working code — a complete viewer **[app]** or a runnable `main()`
|
|
@@ -163,5 +279,8 @@ component, once added to a project, is then triggered by an app or an automation
|
|
|
163
279
|
- **Platform token only.** Never introduce, request, or store an npm token.
|
|
164
280
|
- **Never echo or persist the user's token.** It belongs only in `~/.thatopen/config.json` /
|
|
165
281
|
`.npmrc`, both of which the CLI manages and git-ignores.
|
|
166
|
-
- **
|
|
282
|
+
- **Do the thing they asked for.** If the request already says what to build, build it. Proposing a
|
|
283
|
+
four-point plan and waiting for approval to do what was just requested costs the user a whole turn
|
|
284
|
+
and buys nothing. Stop and ask only when you are about to change files you did not create, when
|
|
285
|
+
the request can be read two ways that mean different work, or when the next step is destructive.
|
|
167
286
|
- The scaffold already works — **extend it, don't replace it.**
|
package/docs/cli/create.md
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Scaffold a new app or cloud component project from a template. Covers --template (app for browser BIM apps, cloud-component for server-side components), --beta for switching to private beta engine libraries at scaffold time, and using '.' as the project name to scaffold into the current directory."
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
## thatopen create
|
|
6
|
-
|
|
7
|
-
Scaffolds a new ThatOpen project and runs `npm install` automatically.
|
|
8
|
-
|
|
9
|
-
**Usage:**
|
|
10
|
-
```bash
|
|
11
|
-
thatopen create <project-name> [flags]
|
|
12
|
-
thatopen create . # scaffold into the current directory
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
**Flags:**
|
|
16
|
-
|
|
17
|
-
- `--template <template>`, `-t` — Template to use. Default: `app`.
|
|
18
|
-
- `app` — Browser BIM app running inside the platform iframe.
|
|
19
|
-
- `cloud-component` — Server-side component executed by the platform's cloud engine and consumed in apps and/or automations.
|
|
20
|
-
- `--beta` — Use private beta engine libraries (`@thatopen-platform/*-beta`) instead of the public ones. Sets `beta: true` in `.thatopen` so `serve`, `local-server`, and `vite build` all resolve to beta packages automatically. Requires beta npm access configured (handled automatically once you `thatopen login`).
|
|
21
|
-
|
|
22
|
-
> **`--beta` is currently required.** The templates depend on engine APIs that only exist in the beta libraries, so scaffolding without `--beta` errors out for now. Public (non-beta) support is coming with the October release.
|
|
23
|
-
|
|
24
|
-
**Examples:**
|
|
25
|
-
```bash
|
|
26
|
-
thatopen create my-app --beta
|
|
27
|
-
thatopen create my-app -t cloud-component --beta
|
|
28
|
-
thatopen create . --beta
|
|
29
|
-
```
|
|
1
|
+
---
|
|
2
|
+
description: "Scaffold a new app or cloud component project from a template. Covers --template (app for browser BIM apps, cloud-component for server-side components), --beta for switching to private beta engine libraries at scaffold time, and using '.' as the project name to scaffold into the current directory."
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## thatopen create
|
|
6
|
+
|
|
7
|
+
Scaffolds a new ThatOpen project and runs `npm install` automatically.
|
|
8
|
+
|
|
9
|
+
**Usage:**
|
|
10
|
+
```bash
|
|
11
|
+
thatopen create <project-name> [flags]
|
|
12
|
+
thatopen create . # scaffold into the current directory
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Flags:**
|
|
16
|
+
|
|
17
|
+
- `--template <template>`, `-t` — Template to use. Default: `app`.
|
|
18
|
+
- `app` — Browser BIM app running inside the platform iframe.
|
|
19
|
+
- `cloud-component` — Server-side component executed by the platform's cloud engine and consumed in apps and/or automations.
|
|
20
|
+
- `--beta` — Use private beta engine libraries (`@thatopen-platform/*-beta`) instead of the public ones. Sets `beta: true` in `.thatopen` so `serve`, `local-server`, and `vite build` all resolve to beta packages automatically. Requires beta npm access configured (handled automatically once you `thatopen login`).
|
|
21
|
+
|
|
22
|
+
> **`--beta` is currently required.** The templates depend on engine APIs that only exist in the beta libraries, so scaffolding without `--beta` errors out for now. Public (non-beta) support is coming with the October release.
|
|
23
|
+
|
|
24
|
+
**Examples:**
|
|
25
|
+
```bash
|
|
26
|
+
thatopen create my-app --beta
|
|
27
|
+
thatopen create my-app -t cloud-component --beta
|
|
28
|
+
thatopen create . --beta
|
|
29
|
+
```
|
package/docs/cli/local-server.md
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Start a local HTTP + Socket.IO server that replicates the platform's cloud execution API on port 4001, with esbuild watch mode. Connect an app to it via EngineServicesClient's localServerUrl option to execute and monitor a local cloud component without publishing."
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
## thatopen local-server
|
|
6
|
-
|
|
7
|
-
Starts a local server that mimics the platform's cloud execution API. Runs esbuild in watch mode and rebuilds the component on every save.
|
|
8
|
-
|
|
9
|
-
Connect an app to it by passing `localServerUrl` to `EngineServicesClient`:
|
|
10
|
-
|
|
11
|
-
```ts
|
|
12
|
-
const client = new EngineServicesClient(token, apiUrl, {
|
|
13
|
-
localServerUrl: 'http://localhost:4001'
|
|
14
|
-
});
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
**Usage:**
|
|
18
|
-
```bash
|
|
19
|
-
thatopen local-server [flags]
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
**Flags:**
|
|
23
|
-
|
|
24
|
-
- `--port <port>` — Port to run the server on. Default: `4001`.
|
|
25
|
-
- `--skip-build` — Skip the initial build and use the existing `dist/bundle.js`.
|
|
26
|
-
|
|
27
|
-
**Endpoints:**
|
|
28
|
-
|
|
29
|
-
- `POST /api/processor/:componentId/execute`
|
|
30
|
-
- `GET /api/processor/progress/:executionId`
|
|
31
|
-
- `POST /api/processor/progress/:executionId/abort`
|
|
32
|
-
- `GET /api/processor/:componentId/progress`
|
|
33
|
-
|
|
34
|
-
**Example:**
|
|
35
|
-
```bash
|
|
36
|
-
thatopen local-server
|
|
37
|
-
thatopen local-server --port 5000
|
|
38
|
-
```
|
|
1
|
+
---
|
|
2
|
+
description: "Start a local HTTP + Socket.IO server that replicates the platform's cloud execution API on port 4001, with esbuild watch mode. Connect an app to it via EngineServicesClient's localServerUrl option to execute and monitor a local cloud component without publishing."
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## thatopen local-server
|
|
6
|
+
|
|
7
|
+
Starts a local server that mimics the platform's cloud execution API. Runs esbuild in watch mode and rebuilds the component on every save.
|
|
8
|
+
|
|
9
|
+
Connect an app to it by passing `localServerUrl` to `EngineServicesClient`:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
const client = new EngineServicesClient(token, apiUrl, {
|
|
13
|
+
localServerUrl: 'http://localhost:4001'
|
|
14
|
+
});
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Usage:**
|
|
18
|
+
```bash
|
|
19
|
+
thatopen local-server [flags]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Flags:**
|
|
23
|
+
|
|
24
|
+
- `--port <port>` — Port to run the server on. Default: `4001`.
|
|
25
|
+
- `--skip-build` — Skip the initial build and use the existing `dist/bundle.js`.
|
|
26
|
+
|
|
27
|
+
**Endpoints:**
|
|
28
|
+
|
|
29
|
+
- `POST /api/processor/:componentId/execute`
|
|
30
|
+
- `GET /api/processor/progress/:executionId`
|
|
31
|
+
- `POST /api/processor/progress/:executionId/abort`
|
|
32
|
+
- `GET /api/processor/:componentId/progress`
|
|
33
|
+
|
|
34
|
+
**Example:**
|
|
35
|
+
```bash
|
|
36
|
+
thatopen local-server
|
|
37
|
+
thatopen local-server --port 5000
|
|
38
|
+
```
|
package/docs/cli/login.md
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Authenticate with the ThatOpen platform by validating an access token against the API. Saves credentials globally (~/.thatopen/config.json) by default, or locally to the project's .thatopen file with --local. Local config takes priority over global."
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
## thatopen login
|
|
6
|
-
|
|
7
|
-
Validates an access token against the platform API and saves the credentials. Run this once globally before using any other command, or per-project with `--local`.
|
|
8
|
-
|
|
9
|
-
To get a token:
|
|
10
|
-
1. Go to [https://platform.thatopen.com](https://platform.thatopen.com)
|
|
11
|
-
2. In the header, click **Data**
|
|
12
|
-
3. Find the **Tokens** card and create a new token
|
|
13
|
-
4. Enable the permissions: **Apps**, **Components**, and **Storage**
|
|
14
|
-
5. Copy the token
|
|
15
|
-
|
|
16
|
-
**Usage:**
|
|
17
|
-
```bash
|
|
18
|
-
thatopen login --token <token> [flags]
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
**Flags:**
|
|
22
|
-
|
|
23
|
-
- `--token <token>` — Access token from the dashboard. Required.
|
|
24
|
-
- `--api-url <url>` — Platform API URL. Default: `https://platform.thatopen.com` (production). Pass `https://dev.platform.thatopen.com` to target the dev environment.
|
|
25
|
-
- `--local` — Save credentials to `.thatopen` in the current directory instead of the global config. Use this inside a project to override the global token for that project only.
|
|
26
|
-
|
|
27
|
-
**Examples:**
|
|
28
|
-
```bash
|
|
29
|
-
thatopen login --token my-token
|
|
30
|
-
thatopen login --token my-token --local
|
|
31
|
-
npm run login -- --token my-token # from inside a scaffolded project
|
|
32
|
-
```
|
|
1
|
+
---
|
|
2
|
+
description: "Authenticate with the ThatOpen platform by validating an access token against the API. Saves credentials globally (~/.thatopen/config.json) by default, or locally to the project's .thatopen file with --local. Local config takes priority over global."
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## thatopen login
|
|
6
|
+
|
|
7
|
+
Validates an access token against the platform API and saves the credentials. Run this once globally before using any other command, or per-project with `--local`.
|
|
8
|
+
|
|
9
|
+
To get a token:
|
|
10
|
+
1. Go to [https://platform.thatopen.com](https://platform.thatopen.com)
|
|
11
|
+
2. In the header, click **Data**
|
|
12
|
+
3. Find the **Tokens** card and create a new token
|
|
13
|
+
4. Enable the permissions: **Apps**, **Components**, and **Storage**
|
|
14
|
+
5. Copy the token
|
|
15
|
+
|
|
16
|
+
**Usage:**
|
|
17
|
+
```bash
|
|
18
|
+
thatopen login --token <token> [flags]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Flags:**
|
|
22
|
+
|
|
23
|
+
- `--token <token>` — Access token from the dashboard. Required.
|
|
24
|
+
- `--api-url <url>` — Platform API URL. Default: `https://platform.thatopen.com` (production). Pass `https://dev.platform.thatopen.com` to target the dev environment.
|
|
25
|
+
- `--local` — Save credentials to `.thatopen` in the current directory instead of the global config. Use this inside a project to override the global token for that project only.
|
|
26
|
+
|
|
27
|
+
**Examples:**
|
|
28
|
+
```bash
|
|
29
|
+
thatopen login --token my-token
|
|
30
|
+
thatopen login --token my-token --local
|
|
31
|
+
npm run login -- --token my-token # from inside a scaffolded project
|
|
32
|
+
```
|
package/docs/cli/publish.md
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Build and upload the project to the platform. Automatically detects app vs cloud component from the local .thatopen config. On first publish, saves the assigned item ID back to .thatopen so subsequent runs update the same item instead of creating a new one."
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
## thatopen publish
|
|
6
|
-
|
|
7
|
-
Builds the project and uploads it to the platform. Works for both apps and cloud components — the project type is read from `.thatopen` (`itemType: APP | COMPONENT`).
|
|
8
|
-
|
|
9
|
-
First publish creates the item and auto-saves its ID to `.thatopen`. Subsequent publishes update that same item.
|
|
10
|
-
|
|
11
|
-
**Usage:**
|
|
12
|
-
```bash
|
|
13
|
-
thatopen publish [flags]
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
**Flags:**
|
|
17
|
-
|
|
18
|
-
- `--name <name>` — Item name on the platform. Defaults to `name` in `package.json`.
|
|
19
|
-
- `--version-tag <tag>` — Version tag. Defaults to `version` in `package.json`.
|
|
20
|
-
- `--app-id <id>` — Target an existing app by ID (overrides `.thatopen`).
|
|
21
|
-
- `--component-id <id>` — Target an existing cloud component by ID (overrides `.thatopen`).
|
|
22
|
-
- `--skip-build` — Skip the build step and upload the existing `dist/bundle.js`.
|
|
23
|
-
- `--icon <path>` — Path to an icon file (PNG, WebP, or ICO, max 512 KB). Saved to `.thatopen` for future publishes.
|
|
24
|
-
|
|
25
|
-
**Examples:**
|
|
26
|
-
```bash
|
|
27
|
-
thatopen publish
|
|
28
|
-
thatopen publish --version-tag 2.0.0
|
|
29
|
-
thatopen publish --skip-build
|
|
30
|
-
thatopen publish --icon assets/icon.png
|
|
31
|
-
```
|
|
1
|
+
---
|
|
2
|
+
description: "Build and upload the project to the platform. Automatically detects app vs cloud component from the local .thatopen config. On first publish, saves the assigned item ID back to .thatopen so subsequent runs update the same item instead of creating a new one."
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## thatopen publish
|
|
6
|
+
|
|
7
|
+
Builds the project and uploads it to the platform. Works for both apps and cloud components — the project type is read from `.thatopen` (`itemType: APP | COMPONENT`).
|
|
8
|
+
|
|
9
|
+
First publish creates the item and auto-saves its ID to `.thatopen`. Subsequent publishes update that same item.
|
|
10
|
+
|
|
11
|
+
**Usage:**
|
|
12
|
+
```bash
|
|
13
|
+
thatopen publish [flags]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Flags:**
|
|
17
|
+
|
|
18
|
+
- `--name <name>` — Item name on the platform. Defaults to `name` in `package.json`.
|
|
19
|
+
- `--version-tag <tag>` — Version tag. Defaults to `version` in `package.json`.
|
|
20
|
+
- `--app-id <id>` — Target an existing app by ID (overrides `.thatopen`).
|
|
21
|
+
- `--component-id <id>` — Target an existing cloud component by ID (overrides `.thatopen`).
|
|
22
|
+
- `--skip-build` — Skip the build step and upload the existing `dist/bundle.js`.
|
|
23
|
+
- `--icon <path>` — Path to an icon file (PNG, WebP, or ICO, max 512 KB). Saved to `.thatopen` for future publishes.
|
|
24
|
+
|
|
25
|
+
**Examples:**
|
|
26
|
+
```bash
|
|
27
|
+
thatopen publish
|
|
28
|
+
thatopen publish --version-tag 2.0.0
|
|
29
|
+
thatopen publish --skip-build
|
|
30
|
+
thatopen publish --icon assets/icon.png
|
|
31
|
+
```
|
package/docs/cli/run.md
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Build and run a cloud component locally as a child process, mirroring the backend execution environment. Accepts execution parameters as JSON via --params, validates them against declarations.json, and streams progress output to the terminal."
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
## thatopen run
|
|
6
|
-
|
|
7
|
-
Builds and executes a cloud component locally, replicating what the platform's cloud engine does. Useful for testing component logic and parameters before publishing.
|
|
8
|
-
|
|
9
|
-
Execution output (`MESSAGE`, `PROGRESS`, `SUCCESS`, `FAIL`) is streamed to the terminal with elapsed time.
|
|
10
|
-
|
|
11
|
-
**Usage:**
|
|
12
|
-
```bash
|
|
13
|
-
thatopen run [flags]
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
**Flags:**
|
|
17
|
-
|
|
18
|
-
- `--params <json>` — Execution parameters as a JSON string. Default: `'{}'`. Validated against `declarations.json` if present (warns, does not fail).
|
|
19
|
-
- `--skip-build` — Skip the build step and run the existing `dist/bundle.js`.
|
|
20
|
-
|
|
21
|
-
**Examples:**
|
|
22
|
-
```bash
|
|
23
|
-
thatopen run
|
|
24
|
-
thatopen run --params '{"fileId": "abc123"}'
|
|
25
|
-
thatopen run --skip-build
|
|
26
|
-
```
|
|
1
|
+
---
|
|
2
|
+
description: "Build and run a cloud component locally as a child process, mirroring the backend execution environment. Accepts execution parameters as JSON via --params, validates them against declarations.json, and streams progress output to the terminal."
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## thatopen run
|
|
6
|
+
|
|
7
|
+
Builds and executes a cloud component locally, replicating what the platform's cloud engine does. Useful for testing component logic and parameters before publishing.
|
|
8
|
+
|
|
9
|
+
Execution output (`MESSAGE`, `PROGRESS`, `SUCCESS`, `FAIL`) is streamed to the terminal with elapsed time.
|
|
10
|
+
|
|
11
|
+
**Usage:**
|
|
12
|
+
```bash
|
|
13
|
+
thatopen run [flags]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Flags:**
|
|
17
|
+
|
|
18
|
+
- `--params <json>` — Execution parameters as a JSON string. Default: `'{}'`. Validated against `declarations.json` if present (warns, does not fail).
|
|
19
|
+
- `--skip-build` — Skip the build step and run the existing `dist/bundle.js`.
|
|
20
|
+
|
|
21
|
+
**Examples:**
|
|
22
|
+
```bash
|
|
23
|
+
thatopen run
|
|
24
|
+
thatopen run --params '{"fileId": "abc123"}'
|
|
25
|
+
thatopen run --skip-build
|
|
26
|
+
```
|
package/docs/cli/serve.md
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Start a local dev server for a browser app. Uses esbuild in watch mode and serves the IIFE bundle on port 4000 with SSE live reload. To connect: open the project on platform.thatopen.com, click the Local App icon, then Get Started."
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
## thatopen serve
|
|
6
|
-
|
|
7
|
-
Builds the app in watch mode and serves the IIFE bundle locally. On every save, esbuild rebuilds and the platform reloads the bundle automatically via SSE.
|
|
8
|
-
|
|
9
|
-
Does **not** open a browser tab — the app runs inside the platform iframe. Open your project on the platform, then click the debug button to connect it to the local server.
|
|
10
|
-
|
|
11
|
-
**Usage:**
|
|
12
|
-
```bash
|
|
13
|
-
thatopen serve [flags]
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
**Flags:**
|
|
17
|
-
|
|
18
|
-
- `--port <port>` — Port to serve the bundle on. Default: `4000`.
|
|
19
|
-
|
|
20
|
-
**Endpoints served:**
|
|
21
|
-
|
|
22
|
-
- `GET /bundle.js` — The compiled IIFE bundle.
|
|
23
|
-
- `GET /bundle.js.map` — Source map.
|
|
24
|
-
- `GET /events` — SSE stream for live reload.
|
|
25
|
-
|
|
26
|
-
**Example:**
|
|
27
|
-
```bash
|
|
28
|
-
thatopen serve
|
|
29
|
-
thatopen serve --port 4321
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
**Connecting the platform to your local server:**
|
|
33
|
-
|
|
34
|
-
1. Go to [https://platform.thatopen.com](https://platform.thatopen.com) and open a project (create one first if needed).
|
|
35
|
-
2. In the top right corner, click the **Local App** icon.
|
|
36
|
-
3. Click **Get Started**.
|
|
37
|
-
|
|
38
|
-
The platform loads the bundle from port 4000 and renders the app inside the project context, with full access to its models, data, and users. The dev server must be running before opening this URL — if nothing is served on port 4000, the platform will fail to load the app.
|
|
39
|
-
|
|
40
|
-
The resulting URL follows this pattern:
|
|
41
|
-
```
|
|
42
|
-
https://platform.thatopen.com/dashboard/projects/{projectId}/apps/local-app
|
|
43
|
-
```
|
|
1
|
+
---
|
|
2
|
+
description: "Start a local dev server for a browser app. Uses esbuild in watch mode and serves the IIFE bundle on port 4000 with SSE live reload. To connect: open the project on platform.thatopen.com, click the Local App icon, then Get Started."
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## thatopen serve
|
|
6
|
+
|
|
7
|
+
Builds the app in watch mode and serves the IIFE bundle locally. On every save, esbuild rebuilds and the platform reloads the bundle automatically via SSE.
|
|
8
|
+
|
|
9
|
+
Does **not** open a browser tab — the app runs inside the platform iframe. Open your project on the platform, then click the debug button to connect it to the local server.
|
|
10
|
+
|
|
11
|
+
**Usage:**
|
|
12
|
+
```bash
|
|
13
|
+
thatopen serve [flags]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Flags:**
|
|
17
|
+
|
|
18
|
+
- `--port <port>` — Port to serve the bundle on. Default: `4000`.
|
|
19
|
+
|
|
20
|
+
**Endpoints served:**
|
|
21
|
+
|
|
22
|
+
- `GET /bundle.js` — The compiled IIFE bundle.
|
|
23
|
+
- `GET /bundle.js.map` — Source map.
|
|
24
|
+
- `GET /events` — SSE stream for live reload.
|
|
25
|
+
|
|
26
|
+
**Example:**
|
|
27
|
+
```bash
|
|
28
|
+
thatopen serve
|
|
29
|
+
thatopen serve --port 4321
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Connecting the platform to your local server:**
|
|
33
|
+
|
|
34
|
+
1. Go to [https://platform.thatopen.com](https://platform.thatopen.com) and open a project (create one first if needed).
|
|
35
|
+
2. In the top right corner, click the **Local App** icon.
|
|
36
|
+
3. Click **Get Started**.
|
|
37
|
+
|
|
38
|
+
The platform loads the bundle from port 4000 and renders the app inside the project context, with full access to its models, data, and users. The dev server must be running before opening this URL — if nothing is served on port 4000, the platform will fail to load the app.
|
|
39
|
+
|
|
40
|
+
The resulting URL follows this pattern:
|
|
41
|
+
```
|
|
42
|
+
https://platform.thatopen.com/dashboard/projects/{projectId}/apps/local-app
|
|
43
|
+
```
|