@polytric/openws-sdkgen 0.0.5 → 0.0.6
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 +2 -2
- package/dist/main.cjs +13 -1
- package/dist/main.js +13 -1
- package/dist/plans/dotnet.cjs +1 -1
- package/dist/plans/dotnet.d.cts +2 -109
- package/dist/plans/dotnet.d.ts +2 -109
- package/dist/plans/typescript.cjs +569 -0
- package/dist/plans/typescript.d.cts +6 -0
- package/dist/plans/typescript.d.ts +6 -0
- package/dist/plans/typescript.js +532 -0
- package/dist/templates/typescript/package.json.ejs +41 -0
- package/dist/templates/typescript/src/core/index.ts.ejs +6 -0
- package/dist/templates/typescript/src/core/models/index.ts.ejs +3 -0
- package/dist/templates/typescript/src/core/models/model.ts.ejs +41 -0
- package/dist/templates/typescript/src/core/network.ts.ejs +517 -0
- package/dist/templates/typescript/src/core/roles/index.ts.ejs +3 -0
- package/dist/templates/typescript/src/core/roles/role.ts.ejs +104 -0
- package/dist/templates/typescript/src/index.ts.ejs +4 -0
- package/dist/templates/typescript/src/sdk/index.ts.ejs +3 -0
- package/dist/templates/typescript/src/sdk/role.ts.ejs +372 -0
- package/dist/templates/typescript/tsconfig.json.ejs +14 -0
- package/dist/templates/typescript/tsup.config.ts.ejs +10 -0
- package/dist/types-BdZPs123.d.cts +115 -0
- package/dist/types-BdZPs123.d.ts +115 -0
- package/package.json +10 -3
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ The CLI exposes the following options:
|
|
|
42
42
|
- `--project` (string): Project/namespace prefix for generated code.
|
|
43
43
|
- `--service` (string): Service name (default: `MyService`).
|
|
44
44
|
- `--hostRole` (string): Participant role name that represents the host side.
|
|
45
|
-
- `--language` (string): Target language (`csharp` or `
|
|
45
|
+
- `--language` (string): Target language (`csharp`, `javascript`, or `typescript`).
|
|
46
46
|
- `--environment` (string|array): Target environment (`unity`, `node`, `browser`).
|
|
47
47
|
|
|
48
48
|
---
|
|
@@ -53,7 +53,7 @@ The generator is wired for:
|
|
|
53
53
|
|
|
54
54
|
- C# (Unity) with `newtonsoft` serialization templates.
|
|
55
55
|
|
|
56
|
-
Additional targets are configured through build plans in `tooling/sdkgen/
|
|
56
|
+
Additional targets are configured through build plans in `tooling/sdkgen/src/plans` and can be expanded as needed.
|
|
57
57
|
|
|
58
58
|
---
|
|
59
59
|
|
package/dist/main.cjs
CHANGED
|
@@ -244,6 +244,14 @@ function buildIr(ctx) {
|
|
|
244
244
|
var planIndex = {
|
|
245
245
|
csharp: {
|
|
246
246
|
unity: "./plans/dotnet.js"
|
|
247
|
+
},
|
|
248
|
+
javascript: {
|
|
249
|
+
node: "./plans/typescript.js",
|
|
250
|
+
browser: "./plans/typescript.js"
|
|
251
|
+
},
|
|
252
|
+
typescript: {
|
|
253
|
+
node: "./plans/typescript.js",
|
|
254
|
+
browser: "./plans/typescript.js"
|
|
247
255
|
}
|
|
248
256
|
};
|
|
249
257
|
async function dispatchBuildPlan(ctx) {
|
|
@@ -286,6 +294,10 @@ var validateBuildRequest = import_schema2.default.obj({
|
|
|
286
294
|
javascript: import_schema2.default.obj({
|
|
287
295
|
environment: import_schema2.default.str.enum("node", "browser"),
|
|
288
296
|
frameworks: import_schema2.default.arr(import_schema2.default.str.enum("fastify")).optional()
|
|
297
|
+
}).optional(),
|
|
298
|
+
typescript: import_schema2.default.obj({
|
|
299
|
+
environment: import_schema2.default.str.enum("node", "browser"),
|
|
300
|
+
frameworks: import_schema2.default.arr(import_schema2.default.str.enum("fastify")).optional()
|
|
289
301
|
}).optional()
|
|
290
302
|
}).min(1).max(1).desc("The target platform to generate code for")
|
|
291
303
|
}).compile("BuildRequestValidator");
|
|
@@ -407,7 +419,7 @@ function parseInput(ctx) {
|
|
|
407
419
|
}).option("language", {
|
|
408
420
|
type: "string",
|
|
409
421
|
description: "The language to generate code for",
|
|
410
|
-
choices: ["csharp", "javascript"],
|
|
422
|
+
choices: ["csharp", "javascript", "typescript"],
|
|
411
423
|
default: "csharp"
|
|
412
424
|
}).option("environment", {
|
|
413
425
|
type: "string",
|
package/dist/main.js
CHANGED
|
@@ -221,6 +221,14 @@ function buildIr(ctx) {
|
|
|
221
221
|
var planIndex = {
|
|
222
222
|
csharp: {
|
|
223
223
|
unity: "./plans/dotnet.js"
|
|
224
|
+
},
|
|
225
|
+
javascript: {
|
|
226
|
+
node: "./plans/typescript.js",
|
|
227
|
+
browser: "./plans/typescript.js"
|
|
228
|
+
},
|
|
229
|
+
typescript: {
|
|
230
|
+
node: "./plans/typescript.js",
|
|
231
|
+
browser: "./plans/typescript.js"
|
|
224
232
|
}
|
|
225
233
|
};
|
|
226
234
|
async function dispatchBuildPlan(ctx) {
|
|
@@ -263,6 +271,10 @@ var validateBuildRequest = S2.obj({
|
|
|
263
271
|
javascript: S2.obj({
|
|
264
272
|
environment: S2.str.enum("node", "browser"),
|
|
265
273
|
frameworks: S2.arr(S2.str.enum("fastify")).optional()
|
|
274
|
+
}).optional(),
|
|
275
|
+
typescript: S2.obj({
|
|
276
|
+
environment: S2.str.enum("node", "browser"),
|
|
277
|
+
frameworks: S2.arr(S2.str.enum("fastify")).optional()
|
|
266
278
|
}).optional()
|
|
267
279
|
}).min(1).max(1).desc("The target platform to generate code for")
|
|
268
280
|
}).compile("BuildRequestValidator");
|
|
@@ -384,7 +396,7 @@ function parseInput(ctx) {
|
|
|
384
396
|
}).option("language", {
|
|
385
397
|
type: "string",
|
|
386
398
|
description: "The language to generate code for",
|
|
387
|
-
choices: ["csharp", "javascript"],
|
|
399
|
+
choices: ["csharp", "javascript", "typescript"],
|
|
388
400
|
default: "csharp"
|
|
389
401
|
}).option("environment", {
|
|
390
402
|
type: "string",
|
package/dist/plans/dotnet.cjs
CHANGED
|
@@ -34,7 +34,7 @@ __export(dotnet_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(dotnet_exports);
|
|
36
36
|
|
|
37
|
-
// ../../node_modules/.pnpm/tsup@8.5.1_tsx@4.21.0_typescript@5.9.
|
|
37
|
+
// ../../node_modules/.pnpm/tsup@8.5.1_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js
|
|
38
38
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
|
|
39
39
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
40
40
|
|
package/dist/plans/dotnet.d.cts
CHANGED
|
@@ -1,112 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
interface PipelineContext {
|
|
4
|
-
argv: string[];
|
|
5
|
-
rawInput?: RawInput;
|
|
6
|
-
request?: BuildRequest;
|
|
7
|
-
spec?: Spec;
|
|
8
|
-
ir?: IR;
|
|
9
|
-
plan?: PlanStep[];
|
|
10
|
-
}
|
|
11
|
-
interface RawInput {
|
|
12
|
-
spec: string;
|
|
13
|
-
out: string;
|
|
14
|
-
project: string;
|
|
15
|
-
hostRole: string[];
|
|
16
|
-
language: 'csharp' | 'javascript';
|
|
17
|
-
environment: 'unity' | 'node' | 'browser';
|
|
18
|
-
frameworks?: string[];
|
|
19
|
-
}
|
|
20
|
-
interface BuildRequest {
|
|
21
|
-
specPath: string;
|
|
22
|
-
outputPath: string;
|
|
23
|
-
project: string;
|
|
24
|
-
hostRoles: string[];
|
|
25
|
-
target: {
|
|
26
|
-
csharp?: {
|
|
27
|
-
environment: 'unity';
|
|
28
|
-
frameworks?: string[];
|
|
29
|
-
};
|
|
30
|
-
javascript?: {
|
|
31
|
-
environment: 'node' | 'browser';
|
|
32
|
-
frameworks?: string[];
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
interface IR {
|
|
37
|
-
package: IRPackage;
|
|
38
|
-
networks: IRNetwork[];
|
|
39
|
-
assemblyName?: string;
|
|
40
|
-
}
|
|
41
|
-
interface IRPackage {
|
|
42
|
-
project: string;
|
|
43
|
-
service: string;
|
|
44
|
-
description?: string;
|
|
45
|
-
version?: string;
|
|
46
|
-
}
|
|
47
|
-
interface IRNetwork {
|
|
48
|
-
name: string;
|
|
49
|
-
description?: string;
|
|
50
|
-
version?: string;
|
|
51
|
-
roles: IRRole[];
|
|
52
|
-
handlers: IRHandler[];
|
|
53
|
-
messages: IRMessage[];
|
|
54
|
-
models: IRModel[];
|
|
55
|
-
}
|
|
56
|
-
interface IRRole {
|
|
57
|
-
name: string;
|
|
58
|
-
description?: string;
|
|
59
|
-
isHost: boolean;
|
|
60
|
-
endpoints: Endpoint[];
|
|
61
|
-
}
|
|
62
|
-
interface IRHandler {
|
|
63
|
-
roleName: string;
|
|
64
|
-
handlerName: string;
|
|
65
|
-
description?: string;
|
|
66
|
-
modelClassName?: string;
|
|
67
|
-
messageName?: string;
|
|
68
|
-
methodName?: string;
|
|
69
|
-
}
|
|
70
|
-
interface IRMessage {
|
|
71
|
-
roleName: string;
|
|
72
|
-
handlerName: string;
|
|
73
|
-
description?: string;
|
|
74
|
-
modelClassName?: string;
|
|
75
|
-
messageName?: string;
|
|
76
|
-
methodName?: string;
|
|
77
|
-
}
|
|
78
|
-
interface IRModel {
|
|
79
|
-
scopeName: string;
|
|
80
|
-
modelName: string;
|
|
81
|
-
type: string;
|
|
82
|
-
description?: string;
|
|
83
|
-
properties?: IRProperty[];
|
|
84
|
-
namespace?: string;
|
|
85
|
-
className?: string;
|
|
86
|
-
}
|
|
87
|
-
interface IRProperty {
|
|
88
|
-
type: string;
|
|
89
|
-
scopeName: string;
|
|
90
|
-
modelName: string;
|
|
91
|
-
description?: string;
|
|
92
|
-
required?: boolean;
|
|
93
|
-
items?: {
|
|
94
|
-
type: string;
|
|
95
|
-
scopeName: string;
|
|
96
|
-
modelName: string;
|
|
97
|
-
description?: string;
|
|
98
|
-
};
|
|
99
|
-
propertyName?: string;
|
|
100
|
-
typeName?: string;
|
|
101
|
-
}
|
|
102
|
-
interface PlanStep {
|
|
103
|
-
name: string;
|
|
104
|
-
command: 'copy' | 'render';
|
|
105
|
-
input?: string;
|
|
106
|
-
output: string;
|
|
107
|
-
template?: string;
|
|
108
|
-
getData?: () => unknown;
|
|
109
|
-
}
|
|
1
|
+
import { P as PipelineContext } from '../types-BdZPs123.cjs';
|
|
2
|
+
import '@polytric/openws-spec/types';
|
|
110
3
|
|
|
111
4
|
declare function createPlan(ctx: PipelineContext): PipelineContext;
|
|
112
5
|
|
package/dist/plans/dotnet.d.ts
CHANGED
|
@@ -1,112 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
interface PipelineContext {
|
|
4
|
-
argv: string[];
|
|
5
|
-
rawInput?: RawInput;
|
|
6
|
-
request?: BuildRequest;
|
|
7
|
-
spec?: Spec;
|
|
8
|
-
ir?: IR;
|
|
9
|
-
plan?: PlanStep[];
|
|
10
|
-
}
|
|
11
|
-
interface RawInput {
|
|
12
|
-
spec: string;
|
|
13
|
-
out: string;
|
|
14
|
-
project: string;
|
|
15
|
-
hostRole: string[];
|
|
16
|
-
language: 'csharp' | 'javascript';
|
|
17
|
-
environment: 'unity' | 'node' | 'browser';
|
|
18
|
-
frameworks?: string[];
|
|
19
|
-
}
|
|
20
|
-
interface BuildRequest {
|
|
21
|
-
specPath: string;
|
|
22
|
-
outputPath: string;
|
|
23
|
-
project: string;
|
|
24
|
-
hostRoles: string[];
|
|
25
|
-
target: {
|
|
26
|
-
csharp?: {
|
|
27
|
-
environment: 'unity';
|
|
28
|
-
frameworks?: string[];
|
|
29
|
-
};
|
|
30
|
-
javascript?: {
|
|
31
|
-
environment: 'node' | 'browser';
|
|
32
|
-
frameworks?: string[];
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
interface IR {
|
|
37
|
-
package: IRPackage;
|
|
38
|
-
networks: IRNetwork[];
|
|
39
|
-
assemblyName?: string;
|
|
40
|
-
}
|
|
41
|
-
interface IRPackage {
|
|
42
|
-
project: string;
|
|
43
|
-
service: string;
|
|
44
|
-
description?: string;
|
|
45
|
-
version?: string;
|
|
46
|
-
}
|
|
47
|
-
interface IRNetwork {
|
|
48
|
-
name: string;
|
|
49
|
-
description?: string;
|
|
50
|
-
version?: string;
|
|
51
|
-
roles: IRRole[];
|
|
52
|
-
handlers: IRHandler[];
|
|
53
|
-
messages: IRMessage[];
|
|
54
|
-
models: IRModel[];
|
|
55
|
-
}
|
|
56
|
-
interface IRRole {
|
|
57
|
-
name: string;
|
|
58
|
-
description?: string;
|
|
59
|
-
isHost: boolean;
|
|
60
|
-
endpoints: Endpoint[];
|
|
61
|
-
}
|
|
62
|
-
interface IRHandler {
|
|
63
|
-
roleName: string;
|
|
64
|
-
handlerName: string;
|
|
65
|
-
description?: string;
|
|
66
|
-
modelClassName?: string;
|
|
67
|
-
messageName?: string;
|
|
68
|
-
methodName?: string;
|
|
69
|
-
}
|
|
70
|
-
interface IRMessage {
|
|
71
|
-
roleName: string;
|
|
72
|
-
handlerName: string;
|
|
73
|
-
description?: string;
|
|
74
|
-
modelClassName?: string;
|
|
75
|
-
messageName?: string;
|
|
76
|
-
methodName?: string;
|
|
77
|
-
}
|
|
78
|
-
interface IRModel {
|
|
79
|
-
scopeName: string;
|
|
80
|
-
modelName: string;
|
|
81
|
-
type: string;
|
|
82
|
-
description?: string;
|
|
83
|
-
properties?: IRProperty[];
|
|
84
|
-
namespace?: string;
|
|
85
|
-
className?: string;
|
|
86
|
-
}
|
|
87
|
-
interface IRProperty {
|
|
88
|
-
type: string;
|
|
89
|
-
scopeName: string;
|
|
90
|
-
modelName: string;
|
|
91
|
-
description?: string;
|
|
92
|
-
required?: boolean;
|
|
93
|
-
items?: {
|
|
94
|
-
type: string;
|
|
95
|
-
scopeName: string;
|
|
96
|
-
modelName: string;
|
|
97
|
-
description?: string;
|
|
98
|
-
};
|
|
99
|
-
propertyName?: string;
|
|
100
|
-
typeName?: string;
|
|
101
|
-
}
|
|
102
|
-
interface PlanStep {
|
|
103
|
-
name: string;
|
|
104
|
-
command: 'copy' | 'render';
|
|
105
|
-
input?: string;
|
|
106
|
-
output: string;
|
|
107
|
-
template?: string;
|
|
108
|
-
getData?: () => unknown;
|
|
109
|
-
}
|
|
1
|
+
import { P as PipelineContext } from '../types-BdZPs123.js';
|
|
2
|
+
import '@polytric/openws-spec/types';
|
|
110
3
|
|
|
111
4
|
declare function createPlan(ctx: PipelineContext): PipelineContext;
|
|
112
5
|
|