@unibridge/sdk 0.5.0 → 0.8.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/LICENSE +21 -0
- package/README.md +67 -0
- package/dist/client.d.ts +6 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +59 -0
- package/dist/client.js.map +1 -0
- package/dist/commands/contracts.d.ts +8 -0
- package/dist/commands/contracts.d.ts.map +1 -0
- package/dist/commands/contracts.js +2 -0
- package/dist/commands/contracts.js.map +1 -0
- package/dist/commands/define.d.ts +19 -0
- package/dist/commands/define.d.ts.map +1 -0
- package/dist/commands/define.js +20 -0
- package/dist/commands/define.js.map +1 -0
- package/dist/commands/domain/contract.d.ts +10 -0
- package/dist/commands/domain/contract.d.ts.map +1 -0
- package/dist/commands/domain/contract.js +12 -0
- package/dist/commands/domain/contract.js.map +1 -0
- package/dist/commands/execute/client.d.ts +4 -0
- package/dist/commands/execute/client.d.ts.map +1 -0
- package/dist/commands/execute/client.js +5 -0
- package/dist/commands/execute/client.js.map +1 -0
- package/dist/commands/execute/contract.d.ts +4 -0
- package/dist/commands/execute/contract.d.ts.map +1 -0
- package/dist/commands/execute/contract.js +10 -0
- package/dist/commands/execute/contract.js.map +1 -0
- package/dist/commands/gameobject/contract.d.ts +224 -0
- package/dist/commands/gameobject/contract.d.ts.map +1 -0
- package/dist/commands/gameobject/contract.js +101 -0
- package/dist/commands/gameobject/contract.js.map +1 -0
- package/dist/commands/log/contract.d.ts +46 -0
- package/dist/commands/log/contract.d.ts.map +1 -0
- package/dist/commands/log/contract.js +31 -0
- package/dist/commands/log/contract.js.map +1 -0
- package/dist/commands/logs/contract.d.ts +46 -0
- package/dist/commands/logs/contract.d.ts.map +1 -0
- package/dist/commands/logs/contract.js +31 -0
- package/dist/commands/logs/contract.js.map +1 -0
- package/dist/commands/registry.d.ts +188 -0
- package/dist/commands/registry.d.ts.map +1 -0
- package/dist/commands/registry.js +9 -0
- package/dist/commands/registry.js.map +1 -0
- package/dist/commands/runtime.d.ts +7 -0
- package/dist/commands/runtime.d.ts.map +1 -0
- package/dist/commands/runtime.js +2 -0
- package/dist/commands/runtime.js.map +1 -0
- package/dist/commands/scene/client.d.ts +4 -0
- package/dist/commands/scene/client.d.ts.map +1 -0
- package/dist/commands/scene/client.js +7 -0
- package/dist/commands/scene/client.js.map +1 -0
- package/dist/commands/scene/contract.d.ts +127 -0
- package/dist/commands/scene/contract.d.ts.map +1 -0
- package/dist/commands/scene/contract.js +79 -0
- package/dist/commands/scene/contract.js.map +1 -0
- package/dist/commands/status/client.d.ts +4 -0
- package/dist/commands/status/client.d.ts.map +1 -0
- package/dist/commands/status/client.js +7 -0
- package/dist/commands/status/client.js.map +1 -0
- package/dist/commands/status/contract.d.ts +18 -0
- package/dist/commands/status/contract.d.ts.map +1 -0
- package/dist/commands/status/contract.js +16 -0
- package/dist/commands/status/contract.js.map +1 -0
- package/dist/commands/test/contract.d.ts +111 -0
- package/dist/commands/test/contract.d.ts.map +1 -0
- package/dist/commands/test/contract.js +71 -0
- package/dist/commands/test/contract.js.map +1 -0
- package/dist/connection.d.ts +37 -0
- package/dist/connection.d.ts.map +1 -0
- package/dist/connection.js +311 -0
- package/dist/connection.js.map +1 -0
- package/dist/hash.d.ts +4 -0
- package/dist/hash.d.ts.map +1 -0
- package/dist/hash.js +41 -0
- package/dist/hash.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/project.d.ts +6 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.js +71 -0
- package/dist/project.js.map +1 -0
- package/dist/types.d.ts +55 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +31 -5
- package/src/client.ts +0 -76
- package/src/commands/contracts.ts +0 -4
- package/src/commands/define.ts +0 -56
- package/src/commands/domain/contract.ts +0 -15
- package/src/commands/execute/contract.ts +0 -12
- package/src/commands/registry.ts +0 -6
- package/src/commands/runtime.ts +0 -7
- package/src/commands/scene/contract.ts +0 -46
- package/src/commands/status/contract.ts +0 -19
- package/src/connection.test.ts +0 -330
- package/src/connection.ts +0 -382
- package/src/hash.test.ts +0 -48
- package/src/hash.ts +0 -50
- package/src/index.ts +0 -10
- package/src/project.test.ts +0 -93
- package/src/project.ts +0 -99
- package/src/types.ts +0 -64
- package/tsconfig.json +0 -16
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Marcus Sanatan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @unibridge/sdk
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for interacting with Unity Editor.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @unibridge/sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
- Node.js `>=22.18.0`
|
|
14
|
+
- A Unity project
|
|
15
|
+
- UniBridge Unity plugin installed in that project
|
|
16
|
+
|
|
17
|
+
You can install the plugin with the CLI, or by adding this to your Unity `Packages/manifest.json`:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"com.msanatan.unibridge": "https://github.com/msanatan/unibridge.git?path=unity"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { createClient } from '@unibridge/sdk'
|
|
31
|
+
|
|
32
|
+
const client = createClient({ projectPath: '/path/to/UnityProject' })
|
|
33
|
+
|
|
34
|
+
const status = await client.status()
|
|
35
|
+
console.log(status)
|
|
36
|
+
|
|
37
|
+
const logs = await client.logs({ severity: 'warn', limit: 50, offset: 0 })
|
|
38
|
+
console.log(logs)
|
|
39
|
+
|
|
40
|
+
const created = await client.gameObjectCreate({
|
|
41
|
+
name: 'Player',
|
|
42
|
+
dimension: '2d',
|
|
43
|
+
transform: { space: 'local', position: { x: 0, y: 1, z: 0 } },
|
|
44
|
+
})
|
|
45
|
+
console.log(created)
|
|
46
|
+
|
|
47
|
+
const tests = await client.testList({ mode: 'edit', limit: 50, offset: 0 })
|
|
48
|
+
console.log(tests)
|
|
49
|
+
|
|
50
|
+
const hierarchy = await client.sceneHierarchy({ limit: 200, offset: 0 })
|
|
51
|
+
console.log(hierarchy)
|
|
52
|
+
|
|
53
|
+
const run = await client.testRun({ mode: 'edit', filter: 'DomainReloadCommandHandlerTests' })
|
|
54
|
+
console.log(run)
|
|
55
|
+
|
|
56
|
+
client.close()
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Install Plugin Programmatically
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { init } from '@unibridge/sdk'
|
|
63
|
+
|
|
64
|
+
await init({
|
|
65
|
+
projectPath: '/path/to/UnityProject',
|
|
66
|
+
})
|
|
67
|
+
```
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ClientOptions, UniBridgeClient } from './types.ts';
|
|
2
|
+
export declare class UniBridgeError extends Error {
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
export declare function createClient(options?: ClientOptions): UniBridgeClient;
|
|
6
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAmB,eAAe,EAAE,MAAM,YAAY,CAAA;AAKjF,qBAAa,cAAe,SAAQ,KAAK;gBAC3B,OAAO,EAAE,MAAM;CAI5B;AAqBD,wBAAgB,YAAY,CAAC,OAAO,GAAE,aAAkB,GAAG,eAAe,CAuCzE"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { PipeConnection } from "./connection.js";
|
|
3
|
+
import { pipePath } from "./hash.js";
|
|
4
|
+
import { findUnityProject } from "./project.js";
|
|
5
|
+
import { buildClientMethods } from "./commands/define.js";
|
|
6
|
+
import { allCommands } from "./commands/registry.js";
|
|
7
|
+
export class UniBridgeError extends Error {
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = 'UniBridgeError';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function unwrap(response) {
|
|
14
|
+
if (!response.success) {
|
|
15
|
+
throw new UniBridgeError(response.error ?? 'Command failed');
|
|
16
|
+
}
|
|
17
|
+
return response.result;
|
|
18
|
+
}
|
|
19
|
+
function createRuntime(sendCommand, ensureExecuteEnabled) {
|
|
20
|
+
return {
|
|
21
|
+
async send(command, params) {
|
|
22
|
+
return unwrap(await sendCommand(command, params));
|
|
23
|
+
},
|
|
24
|
+
ensureExecuteEnabled,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function createClient(options = {}) {
|
|
28
|
+
const projectPath = options.projectPath ?? findUnityProject();
|
|
29
|
+
const connection = new PipeConnection({
|
|
30
|
+
projectPath,
|
|
31
|
+
connectTimeout: options.connectTimeout,
|
|
32
|
+
commandTimeout: options.commandTimeout,
|
|
33
|
+
reconnectTimeout: options.reconnectTimeout,
|
|
34
|
+
});
|
|
35
|
+
const callerExecuteEnabled = options.enableExecute ?? true;
|
|
36
|
+
async function sendCommand(command, params) {
|
|
37
|
+
await connection.connect(pipePath(projectPath));
|
|
38
|
+
return connection.send({ id: randomUUID(), command, params });
|
|
39
|
+
}
|
|
40
|
+
function ensureExecuteEnabled() {
|
|
41
|
+
if (!callerExecuteEnabled) {
|
|
42
|
+
throw new UniBridgeError('Execute is disabled by client or plugin configuration.');
|
|
43
|
+
}
|
|
44
|
+
const metadata = connection.serverMetadata();
|
|
45
|
+
const serverExecuteEnabled = metadata?.capabilities?.executeEnabled ?? true;
|
|
46
|
+
if (!serverExecuteEnabled) {
|
|
47
|
+
throw new UniBridgeError('Execute is disabled by client or plugin configuration.');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const runtime = createRuntime(sendCommand, ensureExecuteEnabled);
|
|
51
|
+
return {
|
|
52
|
+
projectPath,
|
|
53
|
+
...buildClientMethods(runtime, allCommands),
|
|
54
|
+
close() {
|
|
55
|
+
connection.disconnect();
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=client.js.map
|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AAc;QACtC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;KAC3C,CAAC,CAAA;IACF,MAAM,oBAAoB,GAAG,OAAO,CAAC,aAAa,IAAI,IAAI,CAAA;IAE1D,KAAK,UAAU,WAAW,CACxB,OAAe,EACf,MAA+B;QAE/B,MAAM,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAA;QAC/C,OAAO,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;IAC/D,CAAC;IAED,SAAS,oBAAoB;QAC3B,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC1B,MAAM,IAAI,cAAc,CAAC,wDAAwD,CAAC,CAAA;QACpF,CAAC;QAED,MAAM,QAAQ,GAAG,UAAU,CAAC,cAAc,EAAE,CAAA;QAC5C,MAAM,oBAAoB,GAAG,QAAQ,EAAE,YAAY,EAAE,cAAc,IAAI,IAAI,CAAA;QAC3E,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC1B,MAAM,IAAI,cAAc,CAAC,wDAAwD,CAAC,CAAA;QACpF,CAAC;IACH,CAAC;IAED,MAAM,OAAO,GAAG,aAAa,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAA;IAEhE,OAAO;QACL,WAAW;QACX,GAAG,kBAAkB,CAAC,OAAO,EAAE,WAAW,CAAC;QAC3C,KAAK;YACH,UAAU,CAAC,UAAU,EAAE,CAAA;QACzB,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { DomainReloadResult } from './domain/contract.ts';
|
|
2
|
+
export type { ExecuteResult } from './execute/contract.ts';
|
|
3
|
+
export type { CreateTransform, GameObjectCreateInput, GameObjectCreateResult, GameObjectDestroyInput, GameObjectDestroyResult, GameObjectUpdateInput, GameObjectUpdateResult, GameObjectDimension, PrimitiveTypeName, TransformSpace, Vector3Value, } from './gameobject/contract.ts';
|
|
4
|
+
export type { LogEntry, LogsQuery, LogsResult, LogsSeverity } from './log/contract.ts';
|
|
5
|
+
export type { SceneActiveResult, SceneCreateResult, SceneHierarchyNode, SceneHierarchyQuery, SceneHierarchyResult, SceneInfo, SceneListItem, SceneListQuery, SceneListResult, SceneOpenResult, } from './scene/contract.ts';
|
|
6
|
+
export type { StatusResult } from './status/contract.ts';
|
|
7
|
+
export type { TestListItem, TestListQuery, TestListResult, TestMode, TestRunItem, TestRunQuery, TestRunResult, TestStatus, } from './test/contract.ts';
|
|
8
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/commands/contracts.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,YAAY,EACV,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,YAAY,GACb,MAAM,0BAA0B,CAAA;AACjC,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACtF,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,cAAc,EACd,eAAe,EACf,eAAe,GAChB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,YAAY,EACV,YAAY,EACZ,aAAa,EACb,cAAc,EACd,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,aAAa,EACb,UAAU,GACX,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/commands/contracts.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import type { CommandRuntime, ExecuteGuard } from './runtime.ts';
|
|
3
|
+
export interface CommandDef<TMethod extends string, TArgs extends unknown[], TResult> {
|
|
4
|
+
readonly method: TMethod;
|
|
5
|
+
readonly wire: string;
|
|
6
|
+
readonly params: (...args: TArgs) => Record<string, unknown>;
|
|
7
|
+
readonly result: v.GenericSchema<unknown, TResult>;
|
|
8
|
+
readonly guard?: 'execute';
|
|
9
|
+
}
|
|
10
|
+
export declare function defineCommand<TMethod extends string, TArgs extends unknown[], TResult>(def: CommandDef<TMethod, TArgs, TResult>): CommandDef<TMethod, TArgs, TResult>;
|
|
11
|
+
export type InferResult<T> = T extends CommandDef<string, any[], infer R> ? R : never;
|
|
12
|
+
type CommandMethod<T> = T extends CommandDef<string, infer TArgs, infer TResult> ? (...args: TArgs) => Promise<TResult> : never;
|
|
13
|
+
export type CommandMethods<T extends readonly CommandDef<string, any[], any>[]> = {
|
|
14
|
+
[K in T[number] as K['method']]: CommandMethod<K>;
|
|
15
|
+
};
|
|
16
|
+
export declare function invokeCommand<TArgs extends unknown[], TResult>(def: CommandDef<string, TArgs, TResult>, runtime: CommandRuntime & ExecuteGuard, ...args: TArgs): Promise<TResult>;
|
|
17
|
+
export declare function buildClientMethods<const T extends readonly CommandDef<string, any[], any>[]>(runtime: CommandRuntime & ExecuteGuard, defs: T): CommandMethods<T>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=define.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../src/commands/define.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,c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sB,aAAa,CAAC,KAAK,SAAS,OAAO,EAAE,EAAE,OAAO,EAClE,GAAG,EAAE,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,EACvC,OAAO,EAAE,cAAc,GAAG,YAAY,EACtC,GAAG,IAAI,EAAE,KAAK,GACb,OAAO,CAAC,OAAO,CAAC,CAOlB;AAED,wBAAgB,kBAAkB,CAChC,KAAK,CAAC,CAAC,SAAS,SAAS,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,GAAG,CAAC,EAAE,EACzD,OAAO,EAAE,cAAc,GAAG,YAAY,EAAE,IAAI,EAAE,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAMpE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
export function defineCommand(def) {
|
|
3
|
+
return def;
|
|
4
|
+
}
|
|
5
|
+
export async function invokeCommand(def, runtime, ...args) {
|
|
6
|
+
if (def.guard === 'execute') {
|
|
7
|
+
runtime.ensureExecuteEnabled();
|
|
8
|
+
}
|
|
9
|
+
const params = def.params(...args);
|
|
10
|
+
const raw = await runtime.send(def.wire, params);
|
|
11
|
+
return v.parse(def.result, raw);
|
|
12
|
+
}
|
|
13
|
+
export function buildClientMethods(runtime, defs) {
|
|
14
|
+
const methods = {};
|
|
15
|
+
for (const def of defs) {
|
|
16
|
+
methods[def.method] = (...args) => invokeCommand(def, runtime, ...args);
|
|
17
|
+
}
|
|
18
|
+
return methods;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=define.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../src/commands/define.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAe5B,MAAM,UAAU,aAAa,CAI3B,GAAwC;IACxC,OAAO,GAAG,CAAA;AACZ,CAAC;AAaD,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,GAAuC,EACvC,OAAsC,EACtC,GAAG,IAAW;IAEd,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,CAAC,oBAAoB,EAAE,CAAA;IAChC,CAAC;IACD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAA;IAClC,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAChD,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AACjC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAEhC,OAAsC,EAAE,IAAO;IAC/C,MAAM,OAAO,GAA6D,EAAE,CAAA;IAC5E,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAA;IACpF,CAAC;IACD,OAAO,OAA4B,CAAA;AACrC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { type InferResult } from '../define.ts';
|
|
3
|
+
export declare const DomainReloadResultSchema: v.ObjectSchema<{
|
|
4
|
+
readonly triggered: v.BooleanSchema<undefined>;
|
|
5
|
+
}, undefined>;
|
|
6
|
+
export declare const domainReloadCommand: import("../define.ts").CommandDef<"domainReload", [], {
|
|
7
|
+
triggered: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
export type DomainReloadResult = InferResult<typeof domainReloadCommand>;
|
|
10
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/commands/domain/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAE9D,eAAO,MAAM,wBAAwB;;aAEnC,CAAA;AAEF,eAAO,MAAM,mBAAmB;;EAK9B,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { defineCommand } from "../define.js";
|
|
3
|
+
export const DomainReloadResultSchema = v.object({
|
|
4
|
+
triggered: v.boolean(),
|
|
5
|
+
});
|
|
6
|
+
export const domainReloadCommand = defineCommand({
|
|
7
|
+
method: 'domainReload',
|
|
8
|
+
wire: 'domain.reload',
|
|
9
|
+
params: () => ({}),
|
|
10
|
+
result: DomainReloadResultSchema,
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../src/commands/domain/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAoB,MAAM,cAAc,CAAA;AAE9D,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;CACvB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC;IAC/C,MAAM,EAAE,cAAc;IACtB,IAAI,EAAE,eAAe;IACrB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;IAClB,MAAM,EAAE,wBAAwB;CACjC,CAAC,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ExecuteResult } from './contract.ts';
|
|
2
|
+
import type { CommandRuntime, ExecuteGuard } from '../runtime.ts';
|
|
3
|
+
export declare function runExecute(runtime: CommandRuntime & ExecuteGuard, code: string): Promise<ExecuteResult>;
|
|
4
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/commands/execute/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjE,wBAAsB,UAAU,CAC9B,OAAO,EAAE,cAAc,GAAG,YAAY,EACtC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,aAAa,CAAC,CAGxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/commands/execute/client.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAsC,EACtC,IAAY;IAEZ,OAAO,CAAC,oBAAoB,EAAE,CAAA;IAC9B,OAAO,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;AAC1C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/commands/execute/contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAE9D,eAAO,MAAM,cAAc,uEAMzB,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,cAAc,CAAC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { defineCommand } from "../define.js";
|
|
3
|
+
export const executeCommand = defineCommand({
|
|
4
|
+
method: 'execute',
|
|
5
|
+
wire: 'execute',
|
|
6
|
+
params: (code) => ({ code }),
|
|
7
|
+
result: v.unknown(),
|
|
8
|
+
guard: 'execute',
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../src/commands/execute/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAoB,MAAM,cAAc,CAAA;AAE9D,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC;IAC1C,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;IACpC,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,KAAK,EAAE,SAAS;CACjB,CAAC,CAAA"}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { type InferResult } from '../define.ts';
|
|
3
|
+
declare const GameObjectDimensionSchema: v.PicklistSchema<["2d", "3d"], undefined>;
|
|
4
|
+
declare const PrimitiveSchema: v.PicklistSchema<["cube", "sphere", "capsule", "cylinder", "plane", "quad"], undefined>;
|
|
5
|
+
declare const TransformSpaceSchema: v.PicklistSchema<["local", "world"], undefined>;
|
|
6
|
+
declare const Vector3Schema: v.ObjectSchema<{
|
|
7
|
+
readonly x: v.NumberSchema<undefined>;
|
|
8
|
+
readonly y: v.NumberSchema<undefined>;
|
|
9
|
+
readonly z: v.NumberSchema<undefined>;
|
|
10
|
+
}, undefined>;
|
|
11
|
+
declare const CreateTransformSchema: v.ObjectSchema<{
|
|
12
|
+
readonly space: v.OptionalSchema<v.PicklistSchema<["local", "world"], undefined>, undefined>;
|
|
13
|
+
readonly position: v.OptionalSchema<v.ObjectSchema<{
|
|
14
|
+
readonly x: v.NumberSchema<undefined>;
|
|
15
|
+
readonly y: v.NumberSchema<undefined>;
|
|
16
|
+
readonly z: v.NumberSchema<undefined>;
|
|
17
|
+
}, undefined>, undefined>;
|
|
18
|
+
readonly rotation: v.OptionalSchema<v.ObjectSchema<{
|
|
19
|
+
readonly x: v.NumberSchema<undefined>;
|
|
20
|
+
readonly y: v.NumberSchema<undefined>;
|
|
21
|
+
readonly z: v.NumberSchema<undefined>;
|
|
22
|
+
}, undefined>, undefined>;
|
|
23
|
+
readonly scale: v.OptionalSchema<v.ObjectSchema<{
|
|
24
|
+
readonly x: v.NumberSchema<undefined>;
|
|
25
|
+
readonly y: v.NumberSchema<undefined>;
|
|
26
|
+
readonly z: v.NumberSchema<undefined>;
|
|
27
|
+
}, undefined>, undefined>;
|
|
28
|
+
}, undefined>;
|
|
29
|
+
export declare const GameObjectCreateInputSchema: v.ObjectSchema<{
|
|
30
|
+
readonly name: v.StringSchema<undefined>;
|
|
31
|
+
readonly parent: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
32
|
+
readonly parentInstanceId: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
33
|
+
readonly dimension: v.OptionalSchema<v.PicklistSchema<["2d", "3d"], undefined>, undefined>;
|
|
34
|
+
readonly primitive: v.OptionalSchema<v.PicklistSchema<["cube", "sphere", "capsule", "cylinder", "plane", "quad"], undefined>, undefined>;
|
|
35
|
+
readonly transform: v.OptionalSchema<v.ObjectSchema<{
|
|
36
|
+
readonly space: v.OptionalSchema<v.PicklistSchema<["local", "world"], undefined>, undefined>;
|
|
37
|
+
readonly position: v.OptionalSchema<v.ObjectSchema<{
|
|
38
|
+
readonly x: v.NumberSchema<undefined>;
|
|
39
|
+
readonly y: v.NumberSchema<undefined>;
|
|
40
|
+
readonly z: v.NumberSchema<undefined>;
|
|
41
|
+
}, undefined>, undefined>;
|
|
42
|
+
readonly rotation: v.OptionalSchema<v.ObjectSchema<{
|
|
43
|
+
readonly x: v.NumberSchema<undefined>;
|
|
44
|
+
readonly y: v.NumberSchema<undefined>;
|
|
45
|
+
readonly z: v.NumberSchema<undefined>;
|
|
46
|
+
}, undefined>, undefined>;
|
|
47
|
+
readonly scale: v.OptionalSchema<v.ObjectSchema<{
|
|
48
|
+
readonly x: v.NumberSchema<undefined>;
|
|
49
|
+
readonly y: v.NumberSchema<undefined>;
|
|
50
|
+
readonly z: v.NumberSchema<undefined>;
|
|
51
|
+
}, undefined>, undefined>;
|
|
52
|
+
}, undefined>, undefined>;
|
|
53
|
+
}, undefined>;
|
|
54
|
+
export declare const GameObjectCreateResultSchema: v.ObjectSchema<{
|
|
55
|
+
readonly name: v.StringSchema<undefined>;
|
|
56
|
+
readonly path: v.StringSchema<undefined>;
|
|
57
|
+
readonly isActive: v.BooleanSchema<undefined>;
|
|
58
|
+
readonly siblingIndex: v.NumberSchema<undefined>;
|
|
59
|
+
readonly instanceId: v.NumberSchema<undefined>;
|
|
60
|
+
}, undefined>;
|
|
61
|
+
export declare const gameObjectCreateCommand: import("../define.ts").CommandDef<"gameObjectCreate", [input: {
|
|
62
|
+
name: string;
|
|
63
|
+
parent?: string | undefined;
|
|
64
|
+
parentInstanceId?: number | undefined;
|
|
65
|
+
dimension?: "2d" | "3d" | undefined;
|
|
66
|
+
primitive?: "cube" | "sphere" | "capsule" | "cylinder" | "plane" | "quad" | undefined;
|
|
67
|
+
transform?: {
|
|
68
|
+
space?: "local" | "world" | undefined;
|
|
69
|
+
position?: {
|
|
70
|
+
x: number;
|
|
71
|
+
y: number;
|
|
72
|
+
z: number;
|
|
73
|
+
} | undefined;
|
|
74
|
+
rotation?: {
|
|
75
|
+
x: number;
|
|
76
|
+
y: number;
|
|
77
|
+
z: number;
|
|
78
|
+
} | undefined;
|
|
79
|
+
scale?: {
|
|
80
|
+
x: number;
|
|
81
|
+
y: number;
|
|
82
|
+
z: number;
|
|
83
|
+
} | undefined;
|
|
84
|
+
} | undefined;
|
|
85
|
+
}], {
|
|
86
|
+
name: string;
|
|
87
|
+
path: string;
|
|
88
|
+
isActive: boolean;
|
|
89
|
+
siblingIndex: number;
|
|
90
|
+
instanceId: number;
|
|
91
|
+
}>;
|
|
92
|
+
export declare const GameObjectDestroyInputSchema: v.ObjectSchema<{
|
|
93
|
+
readonly path: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
94
|
+
readonly instanceId: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
95
|
+
}, undefined>;
|
|
96
|
+
export declare const GameObjectDestroyResultSchema: v.ObjectSchema<{
|
|
97
|
+
readonly destroyed: v.BooleanSchema<undefined>;
|
|
98
|
+
readonly name: v.StringSchema<undefined>;
|
|
99
|
+
readonly path: v.StringSchema<undefined>;
|
|
100
|
+
readonly instanceId: v.NumberSchema<undefined>;
|
|
101
|
+
}, undefined>;
|
|
102
|
+
export declare const gameObjectDestroyCommand: import("../define.ts").CommandDef<"gameObjectDestroy", [input: {
|
|
103
|
+
path?: string | undefined;
|
|
104
|
+
instanceId?: number | undefined;
|
|
105
|
+
}], {
|
|
106
|
+
destroyed: boolean;
|
|
107
|
+
name: string;
|
|
108
|
+
path: string;
|
|
109
|
+
instanceId: number;
|
|
110
|
+
}>;
|
|
111
|
+
export declare const GameObjectUpdateInputSchema: v.ObjectSchema<{
|
|
112
|
+
readonly path: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
113
|
+
readonly instanceId: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
114
|
+
readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
115
|
+
readonly tag: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
116
|
+
readonly layer: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
117
|
+
readonly isStatic: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
118
|
+
readonly transform: v.OptionalSchema<v.ObjectSchema<{
|
|
119
|
+
readonly space: v.OptionalSchema<v.PicklistSchema<["local", "world"], undefined>, undefined>;
|
|
120
|
+
readonly position: v.OptionalSchema<v.ObjectSchema<{
|
|
121
|
+
readonly x: v.NumberSchema<undefined>;
|
|
122
|
+
readonly y: v.NumberSchema<undefined>;
|
|
123
|
+
readonly z: v.NumberSchema<undefined>;
|
|
124
|
+
}, undefined>, undefined>;
|
|
125
|
+
readonly rotation: v.OptionalSchema<v.ObjectSchema<{
|
|
126
|
+
readonly x: v.NumberSchema<undefined>;
|
|
127
|
+
readonly y: v.NumberSchema<undefined>;
|
|
128
|
+
readonly z: v.NumberSchema<undefined>;
|
|
129
|
+
}, undefined>, undefined>;
|
|
130
|
+
readonly scale: v.OptionalSchema<v.ObjectSchema<{
|
|
131
|
+
readonly x: v.NumberSchema<undefined>;
|
|
132
|
+
readonly y: v.NumberSchema<undefined>;
|
|
133
|
+
readonly z: v.NumberSchema<undefined>;
|
|
134
|
+
}, undefined>, undefined>;
|
|
135
|
+
}, undefined>, undefined>;
|
|
136
|
+
}, undefined>;
|
|
137
|
+
export declare const GameObjectUpdateResultSchema: v.ObjectSchema<{
|
|
138
|
+
readonly name: v.StringSchema<undefined>;
|
|
139
|
+
readonly path: v.StringSchema<undefined>;
|
|
140
|
+
readonly instanceId: v.NumberSchema<undefined>;
|
|
141
|
+
readonly tag: v.StringSchema<undefined>;
|
|
142
|
+
readonly layer: v.StringSchema<undefined>;
|
|
143
|
+
readonly isStatic: v.BooleanSchema<undefined>;
|
|
144
|
+
readonly transform: v.ObjectSchema<{
|
|
145
|
+
readonly position: v.ObjectSchema<{
|
|
146
|
+
readonly x: v.NumberSchema<undefined>;
|
|
147
|
+
readonly y: v.NumberSchema<undefined>;
|
|
148
|
+
readonly z: v.NumberSchema<undefined>;
|
|
149
|
+
}, undefined>;
|
|
150
|
+
readonly rotation: v.ObjectSchema<{
|
|
151
|
+
readonly x: v.NumberSchema<undefined>;
|
|
152
|
+
readonly y: v.NumberSchema<undefined>;
|
|
153
|
+
readonly z: v.NumberSchema<undefined>;
|
|
154
|
+
}, undefined>;
|
|
155
|
+
readonly scale: v.ObjectSchema<{
|
|
156
|
+
readonly x: v.NumberSchema<undefined>;
|
|
157
|
+
readonly y: v.NumberSchema<undefined>;
|
|
158
|
+
readonly z: v.NumberSchema<undefined>;
|
|
159
|
+
}, undefined>;
|
|
160
|
+
}, undefined>;
|
|
161
|
+
}, undefined>;
|
|
162
|
+
export declare const gameObjectUpdateCommand: import("../define.ts").CommandDef<"gameObjectUpdate", [input: {
|
|
163
|
+
path?: string | undefined;
|
|
164
|
+
instanceId?: number | undefined;
|
|
165
|
+
name?: string | undefined;
|
|
166
|
+
tag?: string | undefined;
|
|
167
|
+
layer?: string | undefined;
|
|
168
|
+
isStatic?: boolean | undefined;
|
|
169
|
+
transform?: {
|
|
170
|
+
space?: "local" | "world" | undefined;
|
|
171
|
+
position?: {
|
|
172
|
+
x: number;
|
|
173
|
+
y: number;
|
|
174
|
+
z: number;
|
|
175
|
+
} | undefined;
|
|
176
|
+
rotation?: {
|
|
177
|
+
x: number;
|
|
178
|
+
y: number;
|
|
179
|
+
z: number;
|
|
180
|
+
} | undefined;
|
|
181
|
+
scale?: {
|
|
182
|
+
x: number;
|
|
183
|
+
y: number;
|
|
184
|
+
z: number;
|
|
185
|
+
} | undefined;
|
|
186
|
+
} | undefined;
|
|
187
|
+
}], {
|
|
188
|
+
name: string;
|
|
189
|
+
path: string;
|
|
190
|
+
instanceId: number;
|
|
191
|
+
tag: string;
|
|
192
|
+
layer: string;
|
|
193
|
+
isStatic: boolean;
|
|
194
|
+
transform: {
|
|
195
|
+
position: {
|
|
196
|
+
x: number;
|
|
197
|
+
y: number;
|
|
198
|
+
z: number;
|
|
199
|
+
};
|
|
200
|
+
rotation: {
|
|
201
|
+
x: number;
|
|
202
|
+
y: number;
|
|
203
|
+
z: number;
|
|
204
|
+
};
|
|
205
|
+
scale: {
|
|
206
|
+
x: number;
|
|
207
|
+
y: number;
|
|
208
|
+
z: number;
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
}>;
|
|
212
|
+
export type GameObjectDimension = v.InferOutput<typeof GameObjectDimensionSchema>;
|
|
213
|
+
export type PrimitiveTypeName = v.InferOutput<typeof PrimitiveSchema>;
|
|
214
|
+
export type TransformSpace = v.InferOutput<typeof TransformSpaceSchema>;
|
|
215
|
+
export type Vector3Value = v.InferOutput<typeof Vector3Schema>;
|
|
216
|
+
export type CreateTransform = v.InferOutput<typeof CreateTransformSchema>;
|
|
217
|
+
export type GameObjectCreateInput = v.InferOutput<typeof GameObjectCreateInputSchema>;
|
|
218
|
+
export type GameObjectCreateResult = InferResult<typeof gameObjectCreateCommand>;
|
|
219
|
+
export type GameObjectDestroyInput = v.InferOutput<typeof GameObjectDestroyInputSchema>;
|
|
220
|
+
export type GameObjectDestroyResult = InferResult<typeof gameObjectDestroyCommand>;
|
|
221
|
+
export type GameObjectUpdateInput = v.InferOutput<typeof GameObjectUpdateInputSchema>;
|
|
222
|
+
export type GameObjectUpdateResult = InferResult<typeof gameObjectUpdateCommand>;
|
|
223
|
+
export {};
|
|
224
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/commands/gameobject/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAE9D,QAAA,MAAM,yBAAyB,2CAA2B,CAAA;AAC1D,QAAA,MAAM,eAAe,yFAAyE,CAAA;AAC9F,QAAA,MAAM,oBAAoB,iDAAiC,CAAA;AAE3D,QAAA,MAAM,aAAa;;;;aAIjB,CAAA;AAEF,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;aAKzB,CAAA;AAQF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;aAOtC,CAAA;AAEF,eAAO,MAAM,4BAA4B;;;;;;aAMvC,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYlC,CAAA;AAEF,eAAO,MAAM,4BAA4B;;;aAGvC,CA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
+
import * as v from 'valibot';
|
|
2
|
+
import { defineCommand } from "../define.js";
|
|
3
|
+
const GameObjectDimensionSchema = v.picklist(['2d', '3d']);
|
|
4
|
+
const PrimitiveSchema = v.picklist(['cube', 'sphere', 'capsule', 'cylinder', 'plane', 'quad']);
|
|
5
|
+
const TransformSpaceSchema = v.picklist(['local', 'world']);
|
|
6
|
+
const Vector3Schema = v.object({
|
|
7
|
+
x: v.number(),
|
|
8
|
+
y: v.number(),
|
|
9
|
+
z: v.number(),
|
|
10
|
+
});
|
|
11
|
+
const CreateTransformSchema = v.object({
|
|
12
|
+
space: v.optional(TransformSpaceSchema),
|
|
13
|
+
position: v.optional(Vector3Schema),
|
|
14
|
+
rotation: v.optional(Vector3Schema),
|
|
15
|
+
scale: v.optional(Vector3Schema),
|
|
16
|
+
});
|
|
17
|
+
const TransformSnapshotSchema = v.object({
|
|
18
|
+
position: Vector3Schema,
|
|
19
|
+
rotation: Vector3Schema,
|
|
20
|
+
scale: Vector3Schema,
|
|
21
|
+
});
|
|
22
|
+
export const GameObjectCreateInputSchema = v.object({
|
|
23
|
+
name: v.string(),
|
|
24
|
+
parent: v.optional(v.string()),
|
|
25
|
+
parentInstanceId: v.optional(v.number()),
|
|
26
|
+
dimension: v.optional(GameObjectDimensionSchema),
|
|
27
|
+
primitive: v.optional(PrimitiveSchema),
|
|
28
|
+
transform: v.optional(CreateTransformSchema),
|
|
29
|
+
});
|
|
30
|
+
export const GameObjectCreateResultSchema = v.object({
|
|
31
|
+
name: v.string(),
|
|
32
|
+
path: v.string(),
|
|
33
|
+
isActive: v.boolean(),
|
|
34
|
+
siblingIndex: v.number(),
|
|
35
|
+
instanceId: v.number(),
|
|
36
|
+
});
|
|
37
|
+
export const gameObjectCreateCommand = defineCommand({
|
|
38
|
+
method: 'gameObjectCreate',
|
|
39
|
+
wire: 'gameobject.create',
|
|
40
|
+
params: (input) => ({
|
|
41
|
+
name: input.name,
|
|
42
|
+
parent: input.parent,
|
|
43
|
+
parentInstanceId: input.parentInstanceId,
|
|
44
|
+
dimension: input.dimension,
|
|
45
|
+
primitive: input.primitive,
|
|
46
|
+
transform: input.transform,
|
|
47
|
+
}),
|
|
48
|
+
result: GameObjectCreateResultSchema,
|
|
49
|
+
});
|
|
50
|
+
export const GameObjectDestroyInputSchema = v.object({
|
|
51
|
+
path: v.optional(v.string()),
|
|
52
|
+
instanceId: v.optional(v.number()),
|
|
53
|
+
});
|
|
54
|
+
export const GameObjectDestroyResultSchema = v.object({
|
|
55
|
+
destroyed: v.boolean(),
|
|
56
|
+
name: v.string(),
|
|
57
|
+
path: v.string(),
|
|
58
|
+
instanceId: v.number(),
|
|
59
|
+
});
|
|
60
|
+
export const gameObjectDestroyCommand = defineCommand({
|
|
61
|
+
method: 'gameObjectDestroy',
|
|
62
|
+
wire: 'gameobject.destroy',
|
|
63
|
+
params: (input) => ({
|
|
64
|
+
path: input.path,
|
|
65
|
+
instanceId: input.instanceId,
|
|
66
|
+
}),
|
|
67
|
+
result: GameObjectDestroyResultSchema,
|
|
68
|
+
});
|
|
69
|
+
export const GameObjectUpdateInputSchema = v.object({
|
|
70
|
+
path: v.optional(v.string()),
|
|
71
|
+
instanceId: v.optional(v.number()),
|
|
72
|
+
name: v.optional(v.string()),
|
|
73
|
+
tag: v.optional(v.string()),
|
|
74
|
+
layer: v.optional(v.string()),
|
|
75
|
+
isStatic: v.optional(v.boolean()),
|
|
76
|
+
transform: v.optional(CreateTransformSchema),
|
|
77
|
+
});
|
|
78
|
+
export const GameObjectUpdateResultSchema = v.object({
|
|
79
|
+
name: v.string(),
|
|
80
|
+
path: v.string(),
|
|
81
|
+
instanceId: v.number(),
|
|
82
|
+
tag: v.string(),
|
|
83
|
+
layer: v.string(),
|
|
84
|
+
isStatic: v.boolean(),
|
|
85
|
+
transform: TransformSnapshotSchema,
|
|
86
|
+
});
|
|
87
|
+
export const gameObjectUpdateCommand = defineCommand({
|
|
88
|
+
method: 'gameObjectUpdate',
|
|
89
|
+
wire: 'gameobject.update',
|
|
90
|
+
params: (input) => ({
|
|
91
|
+
path: input.path,
|
|
92
|
+
instanceId: input.instanceId,
|
|
93
|
+
name: input.name,
|
|
94
|
+
tag: input.tag,
|
|
95
|
+
layer: input.layer,
|
|
96
|
+
isStatic: input.isStatic,
|
|
97
|
+
transform: input.transform,
|
|
98
|
+
}),
|
|
99
|
+
result: GameObjectUpdateResultSchema,
|
|
100
|
+
});
|
|
101
|
+
//# sourceMappingURL=contract.js.map
|