@thatopen/services 0.0.1
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/CONTEXT.md +258 -0
- package/README.md +285 -0
- package/dist/built-in/index.d.ts +723 -0
- package/dist/cli/commands/create-tests.d.ts +3 -0
- package/dist/cli/commands/create.d.ts +3 -0
- package/dist/cli/commands/local-server.d.ts +3 -0
- package/dist/cli/commands/login.d.ts +3 -0
- package/dist/cli/commands/publish.d.ts +3 -0
- package/dist/cli/commands/run.d.ts +3 -0
- package/dist/cli/commands/serve-tests.d.ts +3 -0
- package/dist/cli/commands/serve.d.ts +3 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/lib/config.d.ts +25 -0
- package/dist/cli/lib/declarations.d.ts +19 -0
- package/dist/cli/lib/engine-script.d.ts +10 -0
- package/dist/cli/lib/execution-manager.d.ts +52 -0
- package/dist/cli/lib/zip.d.ts +6 -0
- package/dist/cli.js +11566 -0
- package/dist/core/client.d.ts +682 -0
- package/dist/core/client.test.d.ts +1 -0
- package/dist/core/platform-client.d.ts +106 -0
- package/dist/core/platform-client.test.d.ts +1 -0
- package/dist/core/request-error.d.ts +25 -0
- package/dist/core/request-error.test.d.ts +1 -0
- package/dist/index.cjs.js +2 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.es.js +3310 -0
- package/dist/types/base.d.ts +9 -0
- package/dist/types/context.d.ts +20 -0
- package/dist/types/execution.d.ts +19 -0
- package/dist/types/files.d.ts +19 -0
- package/dist/types/item.dto.d.ts +24 -0
- package/dist/types/items.d.ts +57 -0
- package/dist/types/projects.d.ts +59 -0
- package/dist/types/response.d.ts +10 -0
- package/dist/types/storage.d.ts +11 -0
- package/dist/vite-env.d.ts +1 -0
- package/package.json +100 -0
- package/src/built-in/index.ts +755 -0
- package/src/cli/templates/bim/CONTEXT.md +244 -0
- package/src/cli/templates/bim/package.json +26 -0
- package/src/cli/templates/bim/src/app.ts +16 -0
- package/src/cli/templates/bim/src/bim-components/CloudRunner/index.ts +91 -0
- package/src/cli/templates/bim/src/bim-components/CloudRunner/src/index.ts +1 -0
- package/src/cli/templates/bim/src/bim-components/CloudRunner/src/types.ts +5 -0
- package/src/cli/templates/bim/src/bim-components/index.ts +1 -0
- package/src/cli/templates/bim/src/globals.ts +1 -0
- package/src/cli/templates/bim/src/main.ts +90 -0
- package/src/cli/templates/bim/src/setups/cloud-runner.ts +13 -0
- package/src/cli/templates/bim/src/setups/index.ts +3 -0
- package/src/cli/templates/bim/src/setups/ui-manager.ts +27 -0
- package/src/cli/templates/bim/src/setups/viewports-manager.ts +22 -0
- package/src/cli/templates/bim/src/ui-components/app-info-section/index.ts +26 -0
- package/src/cli/templates/bim/src/ui-components/app-info-section/src/index.ts +1 -0
- package/src/cli/templates/bim/src/ui-components/app-info-section/src/types.ts +15 -0
- package/src/cli/templates/bim/src/ui-components/cloud-runner-section/index.ts +37 -0
- package/src/cli/templates/bim/src/ui-components/cloud-runner-section/src/index.ts +1 -0
- package/src/cli/templates/bim/src/ui-components/cloud-runner-section/src/types.ts +14 -0
- package/src/cli/templates/bim/src/ui-components/index.ts +2 -0
- package/src/cli/templates/cloud/CONTEXT.md +205 -0
- package/src/cli/templates/cloud/_thatopen +5 -0
- package/src/cli/templates/cloud/declarations.json +4 -0
- package/src/cli/templates/cloud/package.json +22 -0
- package/src/cli/templates/cloud/src/main.ts +70 -0
- package/src/cli/templates/cloud-test/CONTEXT.md +56 -0
- package/src/cli/templates/cloud-test/_thatopen +5 -0
- package/src/cli/templates/cloud-test/package.json +22 -0
- package/src/cli/templates/cloud-test/src/main.ts +565 -0
- package/src/cli/templates/default/CONTEXT.md +92 -0
- package/src/cli/templates/default/package.json +15 -0
- package/src/cli/templates/default/src/main.ts +62 -0
- package/src/cli/templates/shared/_gitignore +4 -0
- package/src/cli/templates/shared/app/index.html +27 -0
- package/src/cli/templates/shared/app/tsconfig.json +16 -0
- package/src/cli/templates/shared/app/vite.config.js +23 -0
- package/src/cli/templates/shared/cloud/tsconfig.json +16 -0
- package/src/cli/templates/shared/cloud/vite.config.js +27 -0
- package/src/cli/templates/test/CONTEXT.md +53 -0
- package/src/cli/templates/test/package.json +25 -0
- package/src/cli/templates/test/src/main.ts +955 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface ThatOpenConfig {
|
|
2
|
+
accessToken: string;
|
|
3
|
+
apiUrl: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function readConfig(): ThatOpenConfig | null;
|
|
6
|
+
export declare function writeConfig(config: ThatOpenConfig): void;
|
|
7
|
+
export declare function requireConfig(): ThatOpenConfig;
|
|
8
|
+
export type ProjectType = 'APP' | 'COMPONENT';
|
|
9
|
+
export interface ThatOpenLocalConfig {
|
|
10
|
+
accessToken: string;
|
|
11
|
+
apiUrl: string;
|
|
12
|
+
appId?: string;
|
|
13
|
+
componentId?: string;
|
|
14
|
+
/** Project type marker set by `thatopen create`. */
|
|
15
|
+
itemType?: ProjectType;
|
|
16
|
+
/** Path to an icon file (PNG, WebP, or ICO) uploaded on publish. */
|
|
17
|
+
iconPath?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function readLocalConfig(cwd?: string): ThatOpenLocalConfig | null;
|
|
20
|
+
export declare function writeLocalConfig(config: ThatOpenLocalConfig, cwd?: string): void;
|
|
21
|
+
export declare function updateLocalConfig(updates: Partial<ThatOpenLocalConfig>, cwd?: string): void;
|
|
22
|
+
/** Resolve config: local .thatopen first, then global ~/.thatopen/config.json */
|
|
23
|
+
export declare function resolveConfig(cwd?: string): ThatOpenConfig | null;
|
|
24
|
+
/** Like requireConfig but checks local config first. */
|
|
25
|
+
export declare function requireResolvedConfig(cwd?: string): ThatOpenConfig;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const DECLARATIONS_FILENAME = "declarations.json";
|
|
2
|
+
export type DeclarationType = 'string' | 'number';
|
|
3
|
+
export interface Declaration {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
type: DeclarationType;
|
|
7
|
+
}
|
|
8
|
+
export declare function declarationsPath(cwd: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Reads and validates `declarations.json` from the project root.
|
|
11
|
+
* Throws a user-facing Error when the file is missing or malformed.
|
|
12
|
+
*/
|
|
13
|
+
export declare function readDeclarations(cwd: string): Declaration[];
|
|
14
|
+
/**
|
|
15
|
+
* Compares a `--params` payload against the declared schema and returns
|
|
16
|
+
* human-readable warnings. Does not throw — callers decide whether the
|
|
17
|
+
* mismatch is fatal (publish) or just noisy (run).
|
|
18
|
+
*/
|
|
19
|
+
export declare function validateParams(declarations: Declaration[], params: Record<string, unknown>): string[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates the local execution engine script.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the server-side `v1/thatOpenEngine.js` template:
|
|
5
|
+
* - Provides the same globals (OBC, THREE, WEBIFC, fs, executionReporter,
|
|
6
|
+
* thatOpenServices, executionParams).
|
|
7
|
+
* - Inlines the IIFE bundle code (which ends with `var main = ...`).
|
|
8
|
+
* - Calls `main()` and sends the result back via IPC.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildEngineScript(bundleCode: string, accessToken: string, apiUrl: string, executionParams: object): string;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ChildProcess } from 'node:child_process';
|
|
2
|
+
|
|
3
|
+
export type ExecutionResultType = 'SUCCESS' | 'ERROR' | 'WARNING';
|
|
4
|
+
export interface ExecutionMessage {
|
|
5
|
+
_id: string;
|
|
6
|
+
executionId: string;
|
|
7
|
+
content: string;
|
|
8
|
+
createdAt: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ExecutionState {
|
|
11
|
+
_id: string;
|
|
12
|
+
toolId: string;
|
|
13
|
+
toolVersion: string;
|
|
14
|
+
progress: number;
|
|
15
|
+
result?: ExecutionResultType;
|
|
16
|
+
resultMessage?: string;
|
|
17
|
+
messages: ExecutionMessage[];
|
|
18
|
+
createdAt: string;
|
|
19
|
+
updatedAt?: string;
|
|
20
|
+
creatingUser: string;
|
|
21
|
+
childProcess: ChildProcess | null;
|
|
22
|
+
tmpFile: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ExecutionEntity {
|
|
25
|
+
_id: string;
|
|
26
|
+
toolId: string;
|
|
27
|
+
toolVersion: string;
|
|
28
|
+
progress: number;
|
|
29
|
+
result?: ExecutionResultType;
|
|
30
|
+
resultMessage?: string;
|
|
31
|
+
messages: ExecutionMessage[];
|
|
32
|
+
createdAt: string;
|
|
33
|
+
updatedAt?: string;
|
|
34
|
+
creatingUser: string;
|
|
35
|
+
}
|
|
36
|
+
export type ExecutionEventListener = (executionId: string, data: unknown) => void;
|
|
37
|
+
export declare class ExecutionManager {
|
|
38
|
+
private executions;
|
|
39
|
+
private listeners;
|
|
40
|
+
onExecutionEvent(listener: ExecutionEventListener): () => void;
|
|
41
|
+
private emit;
|
|
42
|
+
getExecution(executionId: string): ExecutionState | undefined;
|
|
43
|
+
listExecutions(componentId: string): ExecutionEntity[];
|
|
44
|
+
abortExecution(executionId: string): ExecutionEntity | undefined;
|
|
45
|
+
startExecution(componentId: string, executionParams: object, config: {
|
|
46
|
+
bundlePath: string;
|
|
47
|
+
accessToken: string;
|
|
48
|
+
apiUrl: string;
|
|
49
|
+
cwd: string;
|
|
50
|
+
}): ExecutionState;
|
|
51
|
+
}
|
|
52
|
+
export declare function toExecutionEntity(state: ExecutionState): ExecutionEntity;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a ZIP file with a root-level `bundle` entry and, for cloud
|
|
3
|
+
* components, a `declarations.json` entry next to it describing the
|
|
4
|
+
* runtime parameters the component accepts.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createBundleZip(bundleJsPath: string, outputZipPath: string, declarationsJsonPath?: string): Promise<void>;
|