@thatopen/services 0.0.3 → 0.0.5

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 (140) hide show
  1. package/README.md +24 -263
  2. package/dist/cli/commands/swap.d.ts +3 -0
  3. package/dist/cli/lib/beta.d.ts +2 -0
  4. package/dist/cli/lib/config.d.ts +2 -0
  5. package/dist/cli.js +85 -126
  6. package/dist/core/examples/apps.d.ts +1 -0
  7. package/dist/core/examples/components.d.ts +1 -0
  8. package/dist/core/examples/execution.d.ts +1 -0
  9. package/dist/core/examples/file-metadata.d.ts +1 -0
  10. package/dist/core/examples/files.d.ts +1 -0
  11. package/dist/core/examples/folders.d.ts +1 -0
  12. package/dist/core/examples/hidden-files.d.ts +1 -0
  13. package/dist/core/examples/icons.d.ts +1 -0
  14. package/dist/core/examples/permissions.d.ts +1 -0
  15. package/dist/types/items.d.ts +2 -0
  16. package/docs/builtin/paths.json +54 -0
  17. package/docs/cli/create.md +28 -0
  18. package/docs/cli/local-server.md +38 -0
  19. package/docs/cli/login.md +32 -0
  20. package/docs/cli/paths.json +30 -0
  21. package/docs/cli/publish.md +31 -0
  22. package/docs/cli/run.md +26 -0
  23. package/docs/cli/serve.md +43 -0
  24. package/docs/cli/swap.md +30 -0
  25. package/docs/client/paths.json +38 -0
  26. package/package.json +8 -10
  27. package/resources/AGENTS.md +39 -0
  28. package/src/built-in/AppManager/example.ts +86 -0
  29. package/src/built-in/CDEManager/example.ts +214 -0
  30. package/src/built-in/CDEManager/examples/FileEditing/example.ts +226 -0
  31. package/src/built-in/CDEManager/examples/FileMoves/example.ts +186 -0
  32. package/src/built-in/CDEManager/examples/FileOperations/example.ts +295 -0
  33. package/src/built-in/CDEManager/examples/FileTransfers/example.ts +210 -0
  34. package/src/built-in/CDEManager/examples/FolderManagement/example.ts +230 -0
  35. package/src/built-in/CDEManager/examples/MetadataSchema/example.ts +230 -0
  36. package/src/built-in/CDEManager/examples/MetadataViews/example.ts +166 -0
  37. package/src/built-in/CDEManager/examples/ProjectConfig/example.ts +177 -0
  38. package/src/built-in/FileList/example.ts +107 -0
  39. package/src/built-in/TabbedNavigation/example.ts +115 -0
  40. package/src/built-in/ViewportsManager/example.ts +106 -0
  41. package/src/cli/templates/{shared/app → app}/vite.config.js +42 -23
  42. package/src/cli/templates/{shared/cloud → cloud-component}/vite.config.js +46 -27
  43. package/src/cli/templates/shared/AGENTS.md +8 -30
  44. package/src/cli/templates/shared/CLAUDE.md +1 -1
  45. package/AGENTS.md +0 -86
  46. package/CONTEXT.md +0 -258
  47. package/dist/built-in/index.d.ts +0 -723
  48. package/dist/cli/commands/create-tests.d.ts +0 -3
  49. package/dist/cli/commands/serve-tests.d.ts +0 -3
  50. package/docs/access-backend-data.md +0 -19
  51. package/docs/app-architecture.md +0 -94
  52. package/docs/app-layout.md +0 -139
  53. package/docs/app-wiring.md +0 -123
  54. package/docs/bim-components/coding-conventions.md +0 -128
  55. package/docs/bim-components/element-collections.md +0 -69
  56. package/docs/bim-components/expose-events.md +0 -84
  57. package/docs/bim-components/library-examples.md +0 -28
  58. package/docs/bim-components/observable-collections.md +0 -83
  59. package/docs/bim-components/overview.md +0 -160
  60. package/docs/bim-components/per-frame-updates.md +0 -20
  61. package/docs/bim-components/save-and-restore-state.md +0 -21
  62. package/docs/bim-components/setup-and-cleanup.md +0 -64
  63. package/docs/bim-components/type-conventions.md +0 -49
  64. package/docs/bim-components/user-driven-object-creation.md +0 -56
  65. package/docs/cli-setup.md +0 -54
  66. package/docs/cloud-components.md +0 -74
  67. package/docs/connect-logic-to-ui.md +0 -113
  68. package/docs/previewing.md +0 -45
  69. package/docs/publishing.md +0 -35
  70. package/docs/scaffolding.md +0 -71
  71. package/docs/ui-components/async-actions.md +0 -18
  72. package/docs/ui-components/confirmation-dialog.md +0 -39
  73. package/docs/ui-components/data-table.md +0 -185
  74. package/docs/ui-components/display-text.md +0 -39
  75. package/docs/ui-components/inline-form.md +0 -44
  76. package/docs/ui-components/library-examples.md +0 -24
  77. package/docs/ui-components/overview.md +0 -194
  78. package/docs/ui-components/rendering-patterns.md +0 -129
  79. package/docs/ui-components/sections-layout.md +0 -123
  80. package/docs/update-grid-elements.md +0 -46
  81. package/docs/using-colors.md +0 -32
  82. package/docs/using-icons.md +0 -37
  83. package/src/cli/templates/bim/src/bim-components/CloudRunner/src/index.ts +0 -1
  84. package/src/cli/templates/bim/src/bim-components/CloudRunner/src/types.ts +0 -5
  85. package/src/cli/templates/bim/src/bim-components/index.ts +0 -1
  86. package/src/cli/templates/bim/src/globals.ts +0 -1
  87. package/src/cli/templates/bim/src/setups/index.ts +0 -3
  88. package/src/cli/templates/bim/src/ui-components/app-info-section/index.ts +0 -26
  89. package/src/cli/templates/bim/src/ui-components/app-info-section/src/index.ts +0 -1
  90. package/src/cli/templates/bim/src/ui-components/cloud-runner-section/index.ts +0 -37
  91. package/src/cli/templates/bim/src/ui-components/cloud-runner-section/src/index.ts +0 -1
  92. package/src/cli/templates/bim/src/ui-components/index.ts +0 -2
  93. package/src/cli/templates/bim-beta/CONTEXT.md +0 -241
  94. package/src/cli/templates/bim-beta/package.json +0 -25
  95. package/src/cli/templates/bim-beta/src/app.ts +0 -16
  96. package/src/cli/templates/bim-beta/src/bim-components/CloudRunner/index.ts +0 -91
  97. package/src/cli/templates/bim-beta/src/main.ts +0 -89
  98. package/src/cli/templates/bim-beta/src/setups/cloud-runner.ts +0 -13
  99. package/src/cli/templates/bim-beta/src/setups/ui-manager.ts +0 -27
  100. package/src/cli/templates/bim-beta/src/setups/viewports-manager.ts +0 -22
  101. package/src/cli/templates/bim-beta/src/ui-components/app-info-section/src/types.ts +0 -15
  102. package/src/cli/templates/bim-beta/src/ui-components/cloud-runner-section/src/types.ts +0 -14
  103. package/src/cli/templates/cloud/_thatopen +0 -5
  104. package/src/cli/templates/cloud/package.json +0 -22
  105. package/src/cli/templates/cloud-test/CONTEXT.md +0 -56
  106. package/src/cli/templates/cloud-test/src/main.ts +0 -565
  107. package/src/cli/templates/default/CONTEXT.md +0 -92
  108. package/src/cli/templates/default/package.json +0 -18
  109. package/src/cli/templates/default/src/main.ts +0 -62
  110. package/src/cli/templates/test/CONTEXT.md +0 -53
  111. package/src/cli/templates/test/package.json +0 -25
  112. package/src/cli/templates/test/src/main.ts +0 -955
  113. /package/src/cli/templates/{bim/CONTEXT.md → app/README.md} +0 -0
  114. /package/src/cli/templates/{shared/app → app}/index.html +0 -0
  115. /package/src/cli/templates/{bim → app}/package.json +0 -0
  116. /package/src/cli/templates/{bim → app}/src/app.ts +0 -0
  117. /package/src/cli/templates/{bim → app}/src/bim-components/CloudRunner/index.ts +0 -0
  118. /package/src/cli/templates/{bim-beta → app}/src/bim-components/CloudRunner/src/index.ts +0 -0
  119. /package/src/cli/templates/{bim-beta → app}/src/bim-components/CloudRunner/src/types.ts +0 -0
  120. /package/src/cli/templates/{bim-beta → app}/src/bim-components/index.ts +0 -0
  121. /package/src/cli/templates/{bim-beta → app}/src/globals.ts +0 -0
  122. /package/src/cli/templates/{bim → app}/src/main.ts +0 -0
  123. /package/src/cli/templates/{bim → app}/src/setups/cloud-runner.ts +0 -0
  124. /package/src/cli/templates/{bim-beta → app}/src/setups/index.ts +0 -0
  125. /package/src/cli/templates/{bim → app}/src/setups/ui-manager.ts +0 -0
  126. /package/src/cli/templates/{bim → app}/src/setups/viewports-manager.ts +0 -0
  127. /package/src/cli/templates/{bim-beta → app}/src/ui-components/app-info-section/index.ts +0 -0
  128. /package/src/cli/templates/{bim-beta → app}/src/ui-components/app-info-section/src/index.ts +0 -0
  129. /package/src/cli/templates/{bim → app}/src/ui-components/app-info-section/src/types.ts +0 -0
  130. /package/src/cli/templates/{bim-beta → app}/src/ui-components/cloud-runner-section/index.ts +0 -0
  131. /package/src/cli/templates/{bim-beta → app}/src/ui-components/cloud-runner-section/src/index.ts +0 -0
  132. /package/src/cli/templates/{bim → app}/src/ui-components/cloud-runner-section/src/types.ts +0 -0
  133. /package/src/cli/templates/{bim-beta → app}/src/ui-components/index.ts +0 -0
  134. /package/src/cli/templates/{shared/app → app}/tsconfig.json +0 -0
  135. /package/src/cli/templates/{cloud/CONTEXT.md → cloud-component/README.md} +0 -0
  136. /package/src/cli/templates/{cloud-test → cloud-component}/_thatopen +0 -0
  137. /package/src/cli/templates/{cloud → cloud-component}/declarations.json +0 -0
  138. /package/src/cli/templates/{cloud-test → cloud-component}/package.json +0 -0
  139. /package/src/cli/templates/{cloud → cloud-component}/src/main.ts +0 -0
  140. /package/src/cli/templates/{shared/cloud → cloud-component}/tsconfig.json +0 -0
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -6,6 +6,8 @@ export interface Item extends Base {
6
6
  itemType: ItemType;
7
7
  folderId?: ObjectId;
8
8
  internalId: string;
9
+ iconFileId?: string;
10
+ iconMimeType?: string;
9
11
  }
10
12
  export type ItemType = 'APP' | 'TOOL' | 'HIDDEN' | 'FILE';
11
13
  export interface ItemVersion extends Base {
@@ -0,0 +1,54 @@
1
+ [
2
+ {
3
+ "path": "src/built-in/AppManager/example.ts",
4
+ "description": ""
5
+ },
6
+ {
7
+ "path": "src/built-in/CDEManager/example.ts",
8
+ "description": "CDEManager — CDEManager is the central state machine for a Common Data Environment. It holds files, folders, metadata schemas, viewer groups, and user permissions, and exposes a typed state machine that all file operations — selecting, editing, uploading, viewing — route through. It has no DOM or Three.js dependencies and can run in Node, a browser, or a server-side worker wherever `@thatopen/components` is available."
9
+ },
10
+ {
11
+ "path": "src/built-in/CDEManager/examples/FileEditing/example.ts",
12
+ "description": "Bulk file editing — stage, preview, revert, and commit — A project manager preparing a deliverable handoff needs to update discipline tags across fifteen IFC files after a scope change, rename each to match the new naming convention, and archive three superseded models — all before anything is sent to the backend. Doing the changes one file at a time risks leaving the file list in a half-updated state if the session is interrupted, and there is no way to review exactly what will change before committing."
13
+ },
14
+ {
15
+ "path": "src/built-in/CDEManager/examples/FileMoves/example.ts",
16
+ "description": "Drag-and-drop file and folder moves — A coordinator restructures the project after a scope change: structural files move from the root into a dedicated discipline folder, a MEP sub-folder needs to be promoted to the top level, and a few documents need to come back to root to appear in the general view. Drag-and-drop is the natural gesture for all of this, but each drag session has intermediate stages — the file is \"in the air\", hovering over a candidate target — and every panel watching the file table should see the right state without coordinating directly with the drag component."
17
+ },
18
+ {
19
+ "path": "src/built-in/CDEManager/examples/FileOperations/example.ts",
20
+ "description": "File operations — inline edit, rename, view, download, archive — BIM coordinators reviewing a model drop repeat the same small actions throughout their session: correcting a discipline tag that changed after a scope revision, renaming a file to match the agreed convention, opening it alongside the structural model to check for clashes, handing it off to a sub-consultant, or removing a superseded version from the live set. If every panel in the platform handles these separately, two panels looking at the same file at the same time can show contradictory states — one says \"uploading\", another still shows the old name."
21
+ },
22
+ {
23
+ "path": "src/built-in/CDEManager/examples/FileTransfers/example.ts",
24
+ "description": "File uploads, versioning, and the download cache — A site coordinator drops a batch of files onto the CDE every Monday after the weekend review: some are entirely new models, some are revised versions of files already in the project, and sometimes the metadata group they upload into should be stamped automatically onto the new files. If the platform makes the coordinator sort this out manually, it slows the handoff and introduces naming errors. And if an upload fails halfway through a batch, the file table should land in a safe state rather than freeze at a loading spinner."
25
+ },
26
+ {
27
+ "path": "src/built-in/CDEManager/examples/FolderManagement/example.ts",
28
+ "description": "Folder management — create, rename, archive, and commit — A project reaches the construction phase and the coordination team needs to restructure the folder hierarchy: add a \"Facades\" discipline folder, rename \"Structural\" to its official abbreviation, and archive two superseded folders that have been merged. Doing these one at a time through separate API calls means the folder tree flickers between invalid states as each change lands — a freshly created folder appears before its sibling is renamed, and the archived folders briefly disappear before the new one is visible."
29
+ },
30
+ {
31
+ "path": "src/built-in/CDEManager/examples/MetadataSchema/example.ts",
32
+ "description": "Metadata schema — define, stage, and publish field definitions — Every project has its own vocabulary for describing files: discipline codes, revision phases, area zones, review statuses. A metadata schema defines which fields exist, what values they accept, and whether they are mandatory. Without a structured schema, each user invents their own labels and the file list becomes impossible to filter or report on consistently."
33
+ },
34
+ {
35
+ "path": "src/built-in/CDEManager/examples/MetadataViews/example.ts",
36
+ "description": "Metadata views — organize fields into named table layouts — A structural engineer and an MEP coordinator look at the same file list but care about completely different metadata. Showing every field to everyone produces a wide table that is hard to navigate. Metadata views let each role define which fields appear in which order — saving the layout so the table opens correctly next time without requiring a manual setup every session."
37
+ },
38
+ {
39
+ "path": "src/built-in/CDEManager/examples/ProjectConfig/example.ts",
40
+ "description": "Project configuration — read, write, and reload persistent data — A CDE application needs to store two kinds of configuration: project-wide settings that all team members share (the metadata schema, custom naming rules) and personal settings that belong to one user (which columns are visible, which metadata views are pinned). Both live inside the project's file storage under a reserved system folder, so they travel with the project and don't rely on a separate configuration service."
41
+ },
42
+ {
43
+ "path": "src/built-in/FileList/example.ts",
44
+ "description": ""
45
+ },
46
+ {
47
+ "path": "src/built-in/TabbedNavigation/example.ts",
48
+ "description": ""
49
+ },
50
+ {
51
+ "path": "src/built-in/ViewportsManager/example.ts",
52
+ "description": ""
53
+ }
54
+ ]
@@ -0,0 +1,28 @@
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.
21
+
22
+ **Examples:**
23
+ ```bash
24
+ thatopen create my-app
25
+ thatopen create my-app -t cloud-component
26
+ thatopen create my-app --beta
27
+ thatopen create . --beta
28
+ ```
@@ -0,0 +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
+ ```
@@ -0,0 +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://dev.platform.thatopen.com](https://dev.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://dev.platform.thatopen.com`.
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
+ ```
@@ -0,0 +1,30 @@
1
+ [
2
+ {
3
+ "path": "docs/cli/create.md",
4
+ "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."
5
+ },
6
+ {
7
+ "path": "docs/cli/local-server.md",
8
+ "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."
9
+ },
10
+ {
11
+ "path": "docs/cli/login.md",
12
+ "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."
13
+ },
14
+ {
15
+ "path": "docs/cli/publish.md",
16
+ "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."
17
+ },
18
+ {
19
+ "path": "docs/cli/run.md",
20
+ "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."
21
+ },
22
+ {
23
+ "path": "docs/cli/serve.md",
24
+ "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 dev.platform.thatopen.com, click the Local App icon, then Get Started."
25
+ },
26
+ {
27
+ "path": "docs/cli/swap.md",
28
+ "description": "Toggle or explicitly set the engine library mode between stable public packages (@thatopen/*) and private beta packages (@thatopen-platform/*-beta). Updates package.json and .thatopen, then runs npm install. Source code never changes — aliases handle resolution."
29
+ }
30
+ ]
@@ -0,0 +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
+ ```
@@ -0,0 +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
+ ```
@@ -0,0 +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 dev.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://dev.platform.thatopen.com](https://dev.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://dev.platform.thatopen.com/dashboard/projects/{projectId}/apps/local-app
43
+ ```
@@ -0,0 +1,30 @@
1
+ ---
2
+ description: "Toggle or explicitly set the engine library mode between stable public packages (@thatopen/*) and private beta packages (@thatopen-platform/*-beta). Updates package.json and .thatopen, then runs npm install. Source code never changes — aliases handle resolution."
3
+ ---
4
+
5
+ ## thatopen swap
6
+
7
+ Switches the project between stable and beta engine libraries. Without flags, it toggles from the current state. Updates `package.json` dependencies and sets `beta` in `.thatopen` so `thatopen serve`, `thatopen local-server`, and `vite build` all pick up the change automatically.
8
+
9
+ Source code stays unchanged — `@thatopen/components` imports resolve to the correct package via esbuild/vite aliases based on the `beta` flag in `.thatopen`.
10
+
11
+ **Usage:**
12
+ ```bash
13
+ thatopen swap # toggle: stable → beta or beta → stable
14
+ thatopen swap --beta # force beta
15
+ thatopen swap --stable # force stable
16
+ ```
17
+
18
+ **Flags:**
19
+
20
+ - `--beta` — Switch to beta libraries (`@thatopen-platform/*-beta`).
21
+ - `--stable` — Switch back to stable public libraries (`@thatopen/*`).
22
+
23
+ **Examples:**
24
+ ```bash
25
+ thatopen swap
26
+ thatopen swap --beta
27
+ thatopen swap --stable
28
+ ```
29
+
30
+ > Beta packages are private and the access must be explicitly granted by That Open Company.
@@ -0,0 +1,38 @@
1
+ [
2
+ {
3
+ "path": "src/core/examples/apps.ts",
4
+ "description": "App lifecycle — list, get with versions, create, download bundle, and archive."
5
+ },
6
+ {
7
+ "path": "src/core/examples/components.ts",
8
+ "description": "Cloud component lifecycle — list, get with versions, create, update, download bundle, archive, and recover."
9
+ },
10
+ {
11
+ "path": "src/core/examples/execution.ts",
12
+ "description": "Cloud component execution — trigger, track progress via WebSocket, list, get, and abort executions."
13
+ },
14
+ {
15
+ "path": "src/core/examples/file-metadata.ts",
16
+ "description": "File metadata and versioning — get, update, and delete per-version metadata; list, archive, recover, and permanently delete versions."
17
+ },
18
+ {
19
+ "path": "src/core/examples/files.ts",
20
+ "description": "File lifecycle — list, get with versions, create, rename, upload new version, download by version, archive, and recover."
21
+ },
22
+ {
23
+ "path": "src/core/examples/folders.ts",
24
+ "description": "Folder lifecycle — list, get, create nested folders, list files inside a folder, rename, download as ZIP, archive, and recover."
25
+ },
26
+ {
27
+ "path": "src/core/examples/hidden-files.ts",
28
+ "description": "Hidden file lifecycle — create, get, list by parent, download, and delete."
29
+ },
30
+ {
31
+ "path": "src/core/examples/icons.ts",
32
+ "description": "Item icon management — upload, download, and remove icons on any item (file, app, or component)."
33
+ },
34
+ {
35
+ "path": "src/core/examples/permissions.ts",
36
+ "description": "Permission checks — single and batch permission verification using PlatformClient (requires user JWT, not API token)."
37
+ }
38
+ ]
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "access": "public"
16
16
  },
17
17
  "private": false,
18
- "version": "0.0.3",
18
+ "version": "0.0.5",
19
19
  "main": "dist/index.cjs.js",
20
20
  "module": "dist/index.es.js",
21
21
  "types": "dist/index.d.ts",
@@ -27,13 +27,12 @@
27
27
  "src/cli/templates",
28
28
  "src/built-in",
29
29
  "docs",
30
- "AGENTS.md",
31
- "CONTEXT.md"
30
+ "resources"
32
31
  ],
33
32
  "scripts": {
34
33
  "dev": "vite",
35
34
  "lint": "eslint src/",
36
- "build": "eslint src/ && tsc && vite build && vite build --config vite.config.cli.mts",
35
+ "build": "eslint src/ && tsc && vite build && vite build --config vite.config.cli.mts && node scripts/generate-cli-docs-paths.mjs && node scripts/generate-client-examples-paths.mjs",
37
36
  "build:lib": "tsc && vite build",
38
37
  "test": "vitest run",
39
38
  "test:watch": "vitest",
@@ -45,12 +44,11 @@
45
44
  "test:cli-build-component": "npm run build:cli && node test/setup-test-component.mjs",
46
45
  "test:cli-run-component": "cd temp/test-component && thatopen run --skip-build",
47
46
  "test:cli-serve-component": "cd temp/test-component && thatopen local-server",
48
- "test:cli-build-tests": "npm run build:cli && thatopen create-tests temp",
49
- "test:cli-serve-tests": "thatopen serve-tests temp",
50
- "template:bim": "cd src/cli/templates/bim && npm install && cd ../../../.. && node scripts/generate-template-tsconfig.mjs",
51
- "template:bim:dev": "cd src/cli/templates/bim && npm run dev",
47
+ "template:app": "cd src/cli/templates/app && npm install && cd ../../../.. && node scripts/generate-template-tsconfig.mjs",
48
+ "template:app:dev": "cd src/cli/templates/app && npm run dev",
52
49
  "changeset": "changeset",
53
- "version": "changeset version"
50
+ "version": "changeset version",
51
+ "prepublishOnly": "npm run build"
54
52
  },
55
53
  "devDependencies": {
56
54
  "@changesets/cli": "^2.27.7",
@@ -99,4 +97,4 @@
99
97
  "optional": true
100
98
  }
101
99
  }
102
- }
100
+ }
@@ -0,0 +1,39 @@
1
+ # Building on the That Open Platform — Agent Guide
2
+
3
+ You are an AI assistant helping a user build a **BIM app** or **cloud component** on the
4
+ That Open Platform using **`@thatopen/services`** (the `thatopen` CLI + client library).
5
+
6
+ **Read this file first.** It states the rules you must follow, then routes you to the right docs.
7
+ Open only the doc you need — don't load everything.
8
+
9
+ > This guide is tool-agnostic: it works with any AI (Claude, Codex, your own). All docs it
10
+ > references ship inside the `@thatopen/services` package under `docs/`.
11
+
12
+ ---
13
+
14
+ ## How to work
15
+
16
+ - **The scaffold is already a complete, working viewer** (model loading, spatial tree, properties).
17
+ **Run it first** (`npm run dev`) to see it work, *then* extend it — don't rebuild a viewer from scratch.
18
+ - **Propose a short plan and get the user's OK** before changing files. If scope is unclear, ask.
19
+ - Prefer existing That Open functionality over custom code (see rules 1 and 2).
20
+
21
+ ## Hard rules (always apply)
22
+
23
+ 1. **Check the That Open ecosystem before building anything custom.** Fetch these indexes and read the descriptions — if something already exists, use it:
24
+ - Engine components (`OBC`, `OBF`): `https://raw.githubusercontent.com/ThatOpen/engine_components/refs/heads/main/examples/paths.json`
25
+ - Fragments (`FRAGS`): `https://raw.githubusercontent.com/ThatOpen/engine_fragment/refs/heads/main/examples/paths.json`
26
+ - UI components (`BUI`): `https://raw.githubusercontent.com/ThatOpen/engine_ui-components/refs/heads/main/examples/paths.json`
27
+ — **Filter this list**: skip every entry whose path contains `packages/obc` (forbidden — those are `@thatopen/ui-obc`, not used on this platform) and skip `bim-grid` (managed exclusively by the platform). Only use entries from `packages/core`.
28
+ 2. **All UI must be built with Lit**, using the web components from `@thatopen/ui` (`BUI`) — `bim-button`, `bim-panel`, `bim-panel-section`, `bim-toolbar`, `bim-dropdown`, `bim-input`, and the rest of `packages/core`. Always consult the design system before writing any UI: `https://raw.githubusercontent.com/ThatOpen/engine_ui-components/refs/heads/main/DESIGN.md`.
29
+ 3. **Platform built-ins** come from `@thatopen/services` and are available after `client.setup()`. Check `docs/builtin/paths.json` before reinventing something the platform already provides.
30
+
31
+ ---
32
+
33
+ ## What are you doing? → open the right doc
34
+
35
+ ### CLI commands
36
+ For all CLI commands read `docs/cli/paths.json`.
37
+
38
+ ### Platform client API
39
+ For all platform related operations read `docs/client/paths.json`.
@@ -0,0 +1,86 @@
1
+ import * as OBC from "@thatopen/components";
2
+ import * as BUI from "@thatopen/ui";
3
+ import appManagerDef from "./index";
4
+
5
+ // ── State types ───────────────────────────────────────────────────────
6
+
7
+ type Panel1State = { label: string; components: OBC.Components };
8
+ type Panel2State = { label: string; components: OBC.Components };
9
+
10
+ // ── App type ──────────────────────────────────────────────────────────
11
+
12
+ interface MyApp {
13
+ icons: ["LOAD", "TREE", "VIEW"];
14
+ grid: BUI.Grid<
15
+ ["Split", "Viewer"],
16
+ [{ name: "panel1"; state: Panel1State }, { name: "panel2"; state: Panel2State }]
17
+ >;
18
+ }
19
+
20
+ // ── Initialise OBC & BUI ──────────────────────────────────────────────
21
+
22
+ BUI.Manager.init();
23
+ const components = new OBC.Components();
24
+
25
+ const AppManager = appManagerDef.componentDefinition;
26
+ const app = components.get(AppManager<MyApp>);
27
+
28
+ // ── Define element templates ──────────────────────────────────────────
29
+
30
+ const panel1Template: BUI.StatefullComponent<Panel1State> = ({ label, components }) => {
31
+ const app = components.get(AppManager<MyApp>);
32
+ return BUI.html`
33
+ <bim-panel active label=${label} style="min-width: 14rem;">
34
+ <bim-panel-section label="Actions">
35
+ <bim-button icon=${app.icons.LOAD} label="Load School Model"></bim-button>
36
+ </bim-panel-section>
37
+ <bim-panel-section label="Info">
38
+ <bim-label>Use the sidebar to switch layouts.</bim-label>
39
+ </bim-panel-section>
40
+ </bim-panel>
41
+ `;
42
+ };
43
+
44
+ const panel2Template: BUI.StatefullComponent<Panel2State> = ({ label, components }) => {
45
+ const app = components.get(AppManager<MyApp>);
46
+ return BUI.html`
47
+ <bim-panel active label=${label} style="min-width: 14rem;">
48
+ <bim-panel-section label="Settings">
49
+ <bim-button icon=${app.icons.VIEW} label="View"></bim-button>
50
+ </bim-panel-section>
51
+ </bim-panel>
52
+ `;
53
+ };
54
+
55
+ // ── Init ──────────────────────────────────────────────────────────────
56
+
57
+ app.init({
58
+ icons: {
59
+ LOAD: "solar:upload-bold",
60
+ TREE: "mdi:file-tree",
61
+ VIEW: "mdi:monitor",
62
+ },
63
+ grid: (grid) => {
64
+ grid.elements = {
65
+ panel1: { template: panel1Template, initialState: { label: "Models", components } },
66
+ panel2: { template: panel2Template, initialState: { label: "Settings", components } },
67
+ };
68
+ grid.layouts = {
69
+ Split: {
70
+ template: `
71
+ "panel1" 1fr
72
+ "panel2" 1fr
73
+ / 25rem 1fr`,
74
+ icon: app.icons.TREE,
75
+ },
76
+ Viewer: {
77
+ template: `"panel1" 1fr / 1fr`,
78
+ icon: app.icons.VIEW,
79
+ },
80
+ };
81
+ grid.layout = "Split";
82
+ },
83
+ container: document.getElementById("container")!,
84
+ });
85
+
86
+ app.showSidebar = true;