space-data-module-sdk 0.2.6 → 0.2.8
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 +73 -0
- package/package.json +5 -1
- package/schemas/PluginManifest.fbs +10 -0
- package/src/bundle/constants.js +4 -1
- package/src/bundle/wasm.js +30 -2
- package/src/compliance/index.js +2 -1
- package/src/compliance/pluginCompliance.js +391 -2
- package/src/deployment/index.d.ts +224 -0
- package/src/deployment/index.js +1552 -0
- package/src/generated/orbpro/manifest/plugin-manifest.d.ts +10 -3
- package/src/generated/orbpro/manifest/plugin-manifest.js +32 -6
- package/src/generated/orbpro/manifest/plugin-manifest.ts +42 -5
- package/src/generated/orbpro/manifest/protocol-spec.d.ts +35 -3
- package/src/generated/orbpro/manifest/protocol-spec.js +120 -6
- package/src/generated/orbpro/manifest/protocol-spec.ts +191 -1
- package/src/index.d.ts +138 -3
- package/src/index.js +4 -0
- package/src/manifest/index.js +7 -0
- package/src/manifest/normalize.js +82 -11
- package/src/manifest/typeRefs.js +143 -0
- package/src/runtime/constants.js +14 -0
- package/src/runtime/index.d.ts +2 -0
- package/src/testing/index.d.ts +86 -0
- package/src/testing/index.js +473 -0
|
@@ -90,8 +90,77 @@ export class ProtocolSpec implements flatbuffers.IUnpackableObject<ProtocolSpecT
|
|
|
90
90
|
: null;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
wireId(): string | null;
|
|
94
|
+
wireId(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
|
95
|
+
wireId(optionalEncoding?: any): string | Uint8Array | null {
|
|
96
|
+
const offset = this.bb!.__offset(this.bb_pos, 14);
|
|
97
|
+
return offset
|
|
98
|
+
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
|
99
|
+
: null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
transportKind(): string | null;
|
|
103
|
+
transportKind(
|
|
104
|
+
optionalEncoding: flatbuffers.Encoding,
|
|
105
|
+
): string | Uint8Array | null;
|
|
106
|
+
transportKind(optionalEncoding?: any): string | Uint8Array | null {
|
|
107
|
+
const offset = this.bb!.__offset(this.bb_pos, 16);
|
|
108
|
+
return offset
|
|
109
|
+
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
|
110
|
+
: null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
role(): string | null;
|
|
114
|
+
role(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
|
115
|
+
role(optionalEncoding?: any): string | Uint8Array | null {
|
|
116
|
+
const offset = this.bb!.__offset(this.bb_pos, 18);
|
|
117
|
+
return offset
|
|
118
|
+
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
|
119
|
+
: null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
specUri(): string | null;
|
|
123
|
+
specUri(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
|
124
|
+
specUri(optionalEncoding?: any): string | Uint8Array | null {
|
|
125
|
+
const offset = this.bb!.__offset(this.bb_pos, 20);
|
|
126
|
+
return offset
|
|
127
|
+
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
|
128
|
+
: null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
autoInstall(): boolean {
|
|
132
|
+
const offset = this.bb!.__offset(this.bb_pos, 22);
|
|
133
|
+
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : true;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
advertise(): boolean {
|
|
137
|
+
const offset = this.bb!.__offset(this.bb_pos, 24);
|
|
138
|
+
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
discoveryKey(): string | null;
|
|
142
|
+
discoveryKey(
|
|
143
|
+
optionalEncoding: flatbuffers.Encoding,
|
|
144
|
+
): string | Uint8Array | null;
|
|
145
|
+
discoveryKey(optionalEncoding?: any): string | Uint8Array | null {
|
|
146
|
+
const offset = this.bb!.__offset(this.bb_pos, 26);
|
|
147
|
+
return offset
|
|
148
|
+
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
|
|
149
|
+
: null;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
defaultPort(): number {
|
|
153
|
+
const offset = this.bb!.__offset(this.bb_pos, 28);
|
|
154
|
+
return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
requireSecureTransport(): boolean {
|
|
158
|
+
const offset = this.bb!.__offset(this.bb_pos, 30);
|
|
159
|
+
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
|
|
160
|
+
}
|
|
161
|
+
|
|
93
162
|
static startProtocolSpec(builder: flatbuffers.Builder) {
|
|
94
|
-
builder.startObject(
|
|
163
|
+
builder.startObject(14);
|
|
95
164
|
}
|
|
96
165
|
|
|
97
166
|
static addProtocolId(
|
|
@@ -129,6 +198,60 @@ export class ProtocolSpec implements flatbuffers.IUnpackableObject<ProtocolSpecT
|
|
|
129
198
|
builder.addFieldOffset(4, descriptionOffset, 0);
|
|
130
199
|
}
|
|
131
200
|
|
|
201
|
+
static addWireId(
|
|
202
|
+
builder: flatbuffers.Builder,
|
|
203
|
+
wireIdOffset: flatbuffers.Offset,
|
|
204
|
+
) {
|
|
205
|
+
builder.addFieldOffset(5, wireIdOffset, 0);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
static addTransportKind(
|
|
209
|
+
builder: flatbuffers.Builder,
|
|
210
|
+
transportKindOffset: flatbuffers.Offset,
|
|
211
|
+
) {
|
|
212
|
+
builder.addFieldOffset(6, transportKindOffset, 0);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
static addRole(builder: flatbuffers.Builder, roleOffset: flatbuffers.Offset) {
|
|
216
|
+
builder.addFieldOffset(7, roleOffset, 0);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
static addSpecUri(
|
|
220
|
+
builder: flatbuffers.Builder,
|
|
221
|
+
specUriOffset: flatbuffers.Offset,
|
|
222
|
+
) {
|
|
223
|
+
builder.addFieldOffset(8, specUriOffset, 0);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
static addAutoInstall(
|
|
227
|
+
builder: flatbuffers.Builder,
|
|
228
|
+
autoInstall: boolean,
|
|
229
|
+
) {
|
|
230
|
+
builder.addFieldInt8(9, +autoInstall, +true);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
static addAdvertise(builder: flatbuffers.Builder, advertise: boolean) {
|
|
234
|
+
builder.addFieldInt8(10, +advertise, +false);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
static addDiscoveryKey(
|
|
238
|
+
builder: flatbuffers.Builder,
|
|
239
|
+
discoveryKeyOffset: flatbuffers.Offset,
|
|
240
|
+
) {
|
|
241
|
+
builder.addFieldOffset(11, discoveryKeyOffset, 0);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
static addDefaultPort(builder: flatbuffers.Builder, defaultPort: number) {
|
|
245
|
+
builder.addFieldInt16(12, defaultPort, 0);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
static addRequireSecureTransport(
|
|
249
|
+
builder: flatbuffers.Builder,
|
|
250
|
+
requireSecureTransport: boolean,
|
|
251
|
+
) {
|
|
252
|
+
builder.addFieldInt8(13, +requireSecureTransport, +false);
|
|
253
|
+
}
|
|
254
|
+
|
|
132
255
|
static endProtocolSpec(builder: flatbuffers.Builder): flatbuffers.Offset {
|
|
133
256
|
const offset = builder.endObject();
|
|
134
257
|
builder.requiredField(offset, 4); // protocol_id
|
|
@@ -143,6 +266,15 @@ export class ProtocolSpec implements flatbuffers.IUnpackableObject<ProtocolSpecT
|
|
|
143
266
|
inputPortIdOffset: flatbuffers.Offset,
|
|
144
267
|
outputPortIdOffset: flatbuffers.Offset,
|
|
145
268
|
descriptionOffset: flatbuffers.Offset,
|
|
269
|
+
wireIdOffset: flatbuffers.Offset,
|
|
270
|
+
transportKindOffset: flatbuffers.Offset,
|
|
271
|
+
roleOffset: flatbuffers.Offset,
|
|
272
|
+
specUriOffset: flatbuffers.Offset,
|
|
273
|
+
autoInstall: boolean,
|
|
274
|
+
advertise: boolean,
|
|
275
|
+
discoveryKeyOffset: flatbuffers.Offset,
|
|
276
|
+
defaultPort: number,
|
|
277
|
+
requireSecureTransport: boolean,
|
|
146
278
|
): flatbuffers.Offset {
|
|
147
279
|
ProtocolSpec.startProtocolSpec(builder);
|
|
148
280
|
ProtocolSpec.addProtocolId(builder, protocolIdOffset);
|
|
@@ -150,6 +282,15 @@ export class ProtocolSpec implements flatbuffers.IUnpackableObject<ProtocolSpecT
|
|
|
150
282
|
ProtocolSpec.addInputPortId(builder, inputPortIdOffset);
|
|
151
283
|
ProtocolSpec.addOutputPortId(builder, outputPortIdOffset);
|
|
152
284
|
ProtocolSpec.addDescription(builder, descriptionOffset);
|
|
285
|
+
ProtocolSpec.addWireId(builder, wireIdOffset);
|
|
286
|
+
ProtocolSpec.addTransportKind(builder, transportKindOffset);
|
|
287
|
+
ProtocolSpec.addRole(builder, roleOffset);
|
|
288
|
+
ProtocolSpec.addSpecUri(builder, specUriOffset);
|
|
289
|
+
ProtocolSpec.addAutoInstall(builder, autoInstall);
|
|
290
|
+
ProtocolSpec.addAdvertise(builder, advertise);
|
|
291
|
+
ProtocolSpec.addDiscoveryKey(builder, discoveryKeyOffset);
|
|
292
|
+
ProtocolSpec.addDefaultPort(builder, defaultPort);
|
|
293
|
+
ProtocolSpec.addRequireSecureTransport(builder, requireSecureTransport);
|
|
153
294
|
return ProtocolSpec.endProtocolSpec(builder);
|
|
154
295
|
}
|
|
155
296
|
|
|
@@ -160,6 +301,15 @@ export class ProtocolSpec implements flatbuffers.IUnpackableObject<ProtocolSpecT
|
|
|
160
301
|
this.inputPortId(),
|
|
161
302
|
this.outputPortId(),
|
|
162
303
|
this.description(),
|
|
304
|
+
this.wireId(),
|
|
305
|
+
this.transportKind(),
|
|
306
|
+
this.role(),
|
|
307
|
+
this.specUri(),
|
|
308
|
+
this.autoInstall(),
|
|
309
|
+
this.advertise(),
|
|
310
|
+
this.discoveryKey(),
|
|
311
|
+
this.defaultPort(),
|
|
312
|
+
this.requireSecureTransport(),
|
|
163
313
|
);
|
|
164
314
|
}
|
|
165
315
|
|
|
@@ -169,6 +319,15 @@ export class ProtocolSpec implements flatbuffers.IUnpackableObject<ProtocolSpecT
|
|
|
169
319
|
_o.inputPortId = this.inputPortId();
|
|
170
320
|
_o.outputPortId = this.outputPortId();
|
|
171
321
|
_o.description = this.description();
|
|
322
|
+
_o.wireId = this.wireId();
|
|
323
|
+
_o.transportKind = this.transportKind();
|
|
324
|
+
_o.role = this.role();
|
|
325
|
+
_o.specUri = this.specUri();
|
|
326
|
+
_o.autoInstall = this.autoInstall();
|
|
327
|
+
_o.advertise = this.advertise();
|
|
328
|
+
_o.discoveryKey = this.discoveryKey();
|
|
329
|
+
_o.defaultPort = this.defaultPort();
|
|
330
|
+
_o.requireSecureTransport = this.requireSecureTransport();
|
|
172
331
|
}
|
|
173
332
|
}
|
|
174
333
|
|
|
@@ -179,6 +338,15 @@ export class ProtocolSpecT implements flatbuffers.IGeneratedObject {
|
|
|
179
338
|
public inputPortId: string | Uint8Array | null = null,
|
|
180
339
|
public outputPortId: string | Uint8Array | null = null,
|
|
181
340
|
public description: string | Uint8Array | null = null,
|
|
341
|
+
public wireId: string | Uint8Array | null = null,
|
|
342
|
+
public transportKind: string | Uint8Array | null = null,
|
|
343
|
+
public role: string | Uint8Array | null = null,
|
|
344
|
+
public specUri: string | Uint8Array | null = null,
|
|
345
|
+
public autoInstall: boolean = true,
|
|
346
|
+
public advertise: boolean = false,
|
|
347
|
+
public discoveryKey: string | Uint8Array | null = null,
|
|
348
|
+
public defaultPort: number = 0,
|
|
349
|
+
public requireSecureTransport: boolean = false,
|
|
182
350
|
) {}
|
|
183
351
|
|
|
184
352
|
pack(builder: flatbuffers.Builder): flatbuffers.Offset {
|
|
@@ -192,6 +360,19 @@ export class ProtocolSpecT implements flatbuffers.IGeneratedObject {
|
|
|
192
360
|
this.outputPortId !== null ? builder.createString(this.outputPortId!) : 0;
|
|
193
361
|
const description =
|
|
194
362
|
this.description !== null ? builder.createString(this.description!) : 0;
|
|
363
|
+
const wireId =
|
|
364
|
+
this.wireId !== null ? builder.createString(this.wireId!) : 0;
|
|
365
|
+
const transportKind =
|
|
366
|
+
this.transportKind !== null
|
|
367
|
+
? builder.createString(this.transportKind!)
|
|
368
|
+
: 0;
|
|
369
|
+
const role = this.role !== null ? builder.createString(this.role!) : 0;
|
|
370
|
+
const specUri =
|
|
371
|
+
this.specUri !== null ? builder.createString(this.specUri!) : 0;
|
|
372
|
+
const discoveryKey =
|
|
373
|
+
this.discoveryKey !== null
|
|
374
|
+
? builder.createString(this.discoveryKey!)
|
|
375
|
+
: 0;
|
|
195
376
|
|
|
196
377
|
return ProtocolSpec.createProtocolSpec(
|
|
197
378
|
builder,
|
|
@@ -200,6 +381,15 @@ export class ProtocolSpecT implements flatbuffers.IGeneratedObject {
|
|
|
200
381
|
inputPortId,
|
|
201
382
|
outputPortId,
|
|
202
383
|
description,
|
|
384
|
+
wireId,
|
|
385
|
+
transportKind,
|
|
386
|
+
role,
|
|
387
|
+
specUri,
|
|
388
|
+
this.autoInstall,
|
|
389
|
+
this.advertise,
|
|
390
|
+
discoveryKey,
|
|
391
|
+
this.defaultPort,
|
|
392
|
+
this.requireSecureTransport,
|
|
203
393
|
);
|
|
204
394
|
}
|
|
205
395
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
export type PayloadWireFormat = "flatbuffer" | "aligned-binary";
|
|
4
4
|
export type InvokeSurface = "direct" | "command";
|
|
5
|
+
export type ProtocolTransportKindName =
|
|
6
|
+
| "libp2p"
|
|
7
|
+
| "http"
|
|
8
|
+
| "ws"
|
|
9
|
+
| "wasi-pipe";
|
|
10
|
+
export type ProtocolRoleName = "handle" | "dial" | "both";
|
|
5
11
|
|
|
6
12
|
export interface PayloadTypeRef {
|
|
7
13
|
schemaName?: string;
|
|
@@ -15,6 +21,28 @@ export interface PayloadTypeRef {
|
|
|
15
21
|
requiredAlignment?: number;
|
|
16
22
|
}
|
|
17
23
|
|
|
24
|
+
export function clonePayloadTypeRef(
|
|
25
|
+
value?: PayloadTypeRef | null | Record<string, unknown>,
|
|
26
|
+
): PayloadTypeRef;
|
|
27
|
+
|
|
28
|
+
export function normalizePayloadWireFormatName(
|
|
29
|
+
value?: PayloadWireFormat | string | null,
|
|
30
|
+
): PayloadWireFormat | null;
|
|
31
|
+
|
|
32
|
+
export function getPayloadTypeWireFormat(
|
|
33
|
+
typeRef?: PayloadTypeRef | null,
|
|
34
|
+
): PayloadWireFormat;
|
|
35
|
+
|
|
36
|
+
export function payloadTypeRefsMatch(
|
|
37
|
+
expectedTypeRef?: PayloadTypeRef | null,
|
|
38
|
+
actualTypeRef?: PayloadTypeRef | null,
|
|
39
|
+
): boolean;
|
|
40
|
+
|
|
41
|
+
export function selectPreferredPayloadTypeRef(
|
|
42
|
+
port?: { acceptedTypeSets?: Array<{ allowedTypes?: PayloadTypeRef[] }> } | null,
|
|
43
|
+
options?: { preferredWireFormat?: PayloadWireFormat | string | null },
|
|
44
|
+
): PayloadTypeRef;
|
|
45
|
+
|
|
18
46
|
export type AllowedType = PayloadTypeRef;
|
|
19
47
|
|
|
20
48
|
export interface AcceptedTypeSet {
|
|
@@ -46,17 +74,61 @@ export interface ExternalInterface {
|
|
|
46
74
|
capability?: string;
|
|
47
75
|
}
|
|
48
76
|
|
|
77
|
+
export interface HostCapabilityManifest {
|
|
78
|
+
capability: string;
|
|
79
|
+
scope?: string;
|
|
80
|
+
required?: boolean;
|
|
81
|
+
description?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface TimerSpec {
|
|
85
|
+
timerId: string;
|
|
86
|
+
methodId: string;
|
|
87
|
+
inputPortId?: string | null;
|
|
88
|
+
defaultIntervalMs?: number | bigint;
|
|
89
|
+
description?: string | null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface ProtocolSpec {
|
|
93
|
+
protocolId: string;
|
|
94
|
+
methodId: string;
|
|
95
|
+
inputPortId?: string | null;
|
|
96
|
+
outputPortId?: string | null;
|
|
97
|
+
description?: string | null;
|
|
98
|
+
wireId?: string | null;
|
|
99
|
+
transportKind?: ProtocolTransportKindName | string | null;
|
|
100
|
+
role?: ProtocolRoleName | string | null;
|
|
101
|
+
specUri?: string | null;
|
|
102
|
+
autoInstall?: boolean;
|
|
103
|
+
advertise?: boolean;
|
|
104
|
+
discoveryKey?: string | null;
|
|
105
|
+
defaultPort?: number;
|
|
106
|
+
requireSecureTransport?: boolean;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface BuildArtifact {
|
|
110
|
+
artifactId: string;
|
|
111
|
+
kind?: string | null;
|
|
112
|
+
path: string;
|
|
113
|
+
target?: string | null;
|
|
114
|
+
entrySymbol?: string | null;
|
|
115
|
+
}
|
|
116
|
+
|
|
49
117
|
export interface PluginManifest {
|
|
50
118
|
pluginId: string;
|
|
51
119
|
name: string;
|
|
52
120
|
version: string;
|
|
53
121
|
pluginFamily: string;
|
|
54
|
-
capabilities?: string
|
|
122
|
+
capabilities?: Array<string | HostCapabilityManifest>;
|
|
55
123
|
invokeSurfaces?: InvokeSurface[];
|
|
56
124
|
runtimeTargets?: string[];
|
|
57
125
|
externalInterfaces?: ExternalInterface[];
|
|
58
126
|
methods: MethodManifest[];
|
|
127
|
+
timers?: TimerSpec[];
|
|
128
|
+
protocols?: ProtocolSpec[];
|
|
59
129
|
schemasUsed?: PayloadTypeRef[];
|
|
130
|
+
buildArtifacts?: BuildArtifact[];
|
|
131
|
+
abiVersion?: number;
|
|
60
132
|
}
|
|
61
133
|
|
|
62
134
|
export function encodePluginManifest(manifest: PluginManifest): Uint8Array;
|
|
@@ -151,6 +223,7 @@ export interface ComplianceReport {
|
|
|
151
223
|
}
|
|
152
224
|
|
|
153
225
|
export const RecommendedCapabilityIds: readonly string[];
|
|
226
|
+
export const StandaloneWasiCapabilityIds: readonly string[];
|
|
154
227
|
|
|
155
228
|
export function validatePluginManifest(
|
|
156
229
|
manifest: unknown,
|
|
@@ -421,6 +494,53 @@ export {
|
|
|
421
494
|
withSharedEmception,
|
|
422
495
|
} from "./compiler/emception.js";
|
|
423
496
|
|
|
497
|
+
export type {
|
|
498
|
+
CapabilityRuntimeSurface,
|
|
499
|
+
HarnessInputFrame,
|
|
500
|
+
HarnessInvokeScenario,
|
|
501
|
+
HarnessRawScenario,
|
|
502
|
+
ManifestHarnessPlan,
|
|
503
|
+
} from "./testing/index.js";
|
|
504
|
+
|
|
505
|
+
export {
|
|
506
|
+
describeCapabilityRuntimeSurface,
|
|
507
|
+
generateManifestHarnessPlan,
|
|
508
|
+
materializeHarnessScenario,
|
|
509
|
+
serializeHarnessPlan,
|
|
510
|
+
} from "./testing/index.js";
|
|
511
|
+
|
|
512
|
+
export type {
|
|
513
|
+
AuthPolicy,
|
|
514
|
+
DeploymentPlanIssue,
|
|
515
|
+
DeploymentPlanValidationReport,
|
|
516
|
+
DeploymentBindingModeName,
|
|
517
|
+
InputBinding,
|
|
518
|
+
InputBindingSourceKindName,
|
|
519
|
+
ModuleDeploymentPlan,
|
|
520
|
+
PublicationBinding,
|
|
521
|
+
ResolvedProtocolInstallation,
|
|
522
|
+
ScheduleBinding,
|
|
523
|
+
ScheduleBindingKindName,
|
|
524
|
+
ServiceBinding,
|
|
525
|
+
} from "./deployment/index.js";
|
|
526
|
+
|
|
527
|
+
export {
|
|
528
|
+
DEPLOYMENT_PLAN_FORMAT_VERSION,
|
|
529
|
+
DeploymentBindingMode,
|
|
530
|
+
InputBindingSourceKind,
|
|
531
|
+
ScheduleBindingKind,
|
|
532
|
+
createDeploymentPlanBundleEntry,
|
|
533
|
+
findDeploymentPlanEntry,
|
|
534
|
+
normalizeDeploymentBindingModeName,
|
|
535
|
+
normalizeDeploymentPlan,
|
|
536
|
+
normalizeInputBindingSourceKindName,
|
|
537
|
+
normalizeProtocolRoleName,
|
|
538
|
+
normalizeProtocolTransportKindName,
|
|
539
|
+
normalizeScheduleBindingKindName,
|
|
540
|
+
readDeploymentPlanFromBundle,
|
|
541
|
+
validateDeploymentPlan,
|
|
542
|
+
} from "./deployment/index.js";
|
|
543
|
+
|
|
424
544
|
// --- Standards ---
|
|
425
545
|
|
|
426
546
|
export interface StandardsEntry {
|
|
@@ -451,9 +571,10 @@ export const DEFAULT_HASH_ALGORITHM: string;
|
|
|
451
571
|
export function createSingleFileBundle(options: {
|
|
452
572
|
wasmBytes: Uint8Array;
|
|
453
573
|
manifest: PluginManifest;
|
|
454
|
-
authorization
|
|
574
|
+
authorization?: SignedEnvelope | unknown;
|
|
455
575
|
transportEnvelope?: EncryptedEnvelope | null;
|
|
456
|
-
|
|
576
|
+
deploymentPlan?: ModuleDeploymentPlan;
|
|
577
|
+
entries?: Array<Record<string, unknown>>;
|
|
457
578
|
}): Promise<{ wasmBytes: Uint8Array }>;
|
|
458
579
|
|
|
459
580
|
export function parseSingleFileBundle(
|
|
@@ -961,10 +1082,24 @@ export const InvokeSurface: {
|
|
|
961
1082
|
COMMAND: string;
|
|
962
1083
|
};
|
|
963
1084
|
|
|
1085
|
+
export const ProtocolTransportKind: {
|
|
1086
|
+
LIBP2P: ProtocolTransportKindName;
|
|
1087
|
+
HTTP: ProtocolTransportKindName;
|
|
1088
|
+
WS: ProtocolTransportKindName;
|
|
1089
|
+
WASI_PIPE: ProtocolTransportKindName;
|
|
1090
|
+
};
|
|
1091
|
+
|
|
1092
|
+
export const ProtocolRole: {
|
|
1093
|
+
HANDLE: ProtocolRoleName;
|
|
1094
|
+
DIAL: ProtocolRoleName;
|
|
1095
|
+
BOTH: ProtocolRoleName;
|
|
1096
|
+
};
|
|
1097
|
+
|
|
964
1098
|
export const RuntimeTarget: {
|
|
965
1099
|
NODE: string;
|
|
966
1100
|
BROWSER: string;
|
|
967
1101
|
WASI: string;
|
|
1102
|
+
WASMEDGE: string;
|
|
968
1103
|
SERVER: string;
|
|
969
1104
|
DESKTOP: string;
|
|
970
1105
|
EDGE: string;
|
package/src/index.js
CHANGED
|
@@ -7,6 +7,8 @@ export * from "./bundle/index.js";
|
|
|
7
7
|
export * from "./standards/index.js";
|
|
8
8
|
export * from "./host/index.js";
|
|
9
9
|
export * from "./invoke/index.js";
|
|
10
|
+
export * from "./testing/index.js";
|
|
11
|
+
export * from "./deployment/index.js";
|
|
10
12
|
export {
|
|
11
13
|
DefaultInvokeExports,
|
|
12
14
|
DefaultManifestExports,
|
|
@@ -14,5 +16,7 @@ export {
|
|
|
14
16
|
ExternalInterfaceDirection,
|
|
15
17
|
ExternalInterfaceKind,
|
|
16
18
|
InvokeSurface,
|
|
19
|
+
ProtocolRole,
|
|
20
|
+
ProtocolTransportKind,
|
|
17
21
|
RuntimeTarget,
|
|
18
22
|
} from "./runtime/constants.js";
|
package/src/manifest/index.js
CHANGED
|
@@ -6,6 +6,13 @@ export {
|
|
|
6
6
|
} from "../generated/orbpro/stream/flat-buffer-type-ref.js";
|
|
7
7
|
export { decodePluginManifest, encodePluginManifest } from "./codec.js";
|
|
8
8
|
export { toEmbeddedPluginManifest } from "./normalize.js";
|
|
9
|
+
export {
|
|
10
|
+
clonePayloadTypeRef,
|
|
11
|
+
getPayloadTypeWireFormat,
|
|
12
|
+
normalizePayloadWireFormatName,
|
|
13
|
+
payloadTypeRefsMatch,
|
|
14
|
+
selectPreferredPayloadTypeRef,
|
|
15
|
+
} from "./typeRefs.js";
|
|
9
16
|
export {
|
|
10
17
|
generateEmbeddedManifestSource,
|
|
11
18
|
writeEmbeddedManifestArtifacts,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
TimerSpecT,
|
|
14
14
|
} from "../generated/orbpro/manifest.js";
|
|
15
15
|
import { FlatBufferTypeRefT } from "../generated/orbpro/stream/flat-buffer-type-ref.js";
|
|
16
|
+
import { ProtocolRole, ProtocolTransportKind } from "../runtime/constants.js";
|
|
16
17
|
|
|
17
18
|
const pluginFamilyByName = Object.freeze({
|
|
18
19
|
sensor: PluginFamily.SENSOR,
|
|
@@ -81,6 +82,31 @@ const invokeSurfaceByName = Object.freeze({
|
|
|
81
82
|
command: InvokeSurface.COMMAND,
|
|
82
83
|
});
|
|
83
84
|
|
|
85
|
+
const protocolTransportKindByName = Object.freeze({
|
|
86
|
+
libp2p: ProtocolTransportKind.LIBP2P,
|
|
87
|
+
http: ProtocolTransportKind.HTTP,
|
|
88
|
+
ws: ProtocolTransportKind.WS,
|
|
89
|
+
websocket: ProtocolTransportKind.WS,
|
|
90
|
+
"wasi-pipe": ProtocolTransportKind.WASI_PIPE,
|
|
91
|
+
wasi_pipe: ProtocolTransportKind.WASI_PIPE,
|
|
92
|
+
pipe: ProtocolTransportKind.WASI_PIPE,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const protocolRoleByName = Object.freeze({
|
|
96
|
+
handle: ProtocolRole.HANDLE,
|
|
97
|
+
handler: ProtocolRole.HANDLE,
|
|
98
|
+
dial: ProtocolRole.DIAL,
|
|
99
|
+
both: ProtocolRole.BOTH,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
function normalizeOptionalString(value) {
|
|
103
|
+
if (value === undefined || value === null) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const normalized = String(value).trim();
|
|
107
|
+
return normalized.length > 0 ? normalized : null;
|
|
108
|
+
}
|
|
109
|
+
|
|
84
110
|
function normalizeSchemaHash(value) {
|
|
85
111
|
if (!value) {
|
|
86
112
|
return [];
|
|
@@ -177,6 +203,41 @@ function normalizeInvokeSurfaces(value) {
|
|
|
177
203
|
return normalized;
|
|
178
204
|
}
|
|
179
205
|
|
|
206
|
+
function normalizeBoolean(value, fallback = false) {
|
|
207
|
+
if (value === undefined || value === null) {
|
|
208
|
+
return fallback;
|
|
209
|
+
}
|
|
210
|
+
return value === true;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function normalizeProtocolTransportKind(value) {
|
|
214
|
+
if (value === undefined || value === null) {
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
const normalized = String(value)
|
|
218
|
+
.trim()
|
|
219
|
+
.toLowerCase()
|
|
220
|
+
.replace(/_/g, "-");
|
|
221
|
+
if (normalized.length === 0) {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
return protocolTransportKindByName[normalized] ?? normalized;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function normalizeProtocolRole(value) {
|
|
228
|
+
if (value === undefined || value === null) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
const normalized = String(value)
|
|
232
|
+
.trim()
|
|
233
|
+
.toLowerCase()
|
|
234
|
+
.replace(/_/g, "-");
|
|
235
|
+
if (normalized.length === 0) {
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
return protocolRoleByName[normalized] ?? normalized;
|
|
239
|
+
}
|
|
240
|
+
|
|
180
241
|
function toFlatBufferTypeRefT(value = {}) {
|
|
181
242
|
if (value instanceof FlatBufferTypeRefT) {
|
|
182
243
|
return value;
|
|
@@ -274,11 +335,20 @@ function toProtocolSpecT(value = {}) {
|
|
|
274
335
|
return value;
|
|
275
336
|
}
|
|
276
337
|
return new ProtocolSpecT(
|
|
277
|
-
value.protocolId
|
|
278
|
-
value.methodId
|
|
279
|
-
value.inputPortId
|
|
280
|
-
value.outputPortId
|
|
281
|
-
value.description
|
|
338
|
+
normalizeOptionalString(value.protocolId),
|
|
339
|
+
normalizeOptionalString(value.methodId),
|
|
340
|
+
normalizeOptionalString(value.inputPortId),
|
|
341
|
+
normalizeOptionalString(value.outputPortId),
|
|
342
|
+
normalizeOptionalString(value.description),
|
|
343
|
+
normalizeOptionalString(value.wireId),
|
|
344
|
+
normalizeProtocolTransportKind(value.transportKind),
|
|
345
|
+
normalizeProtocolRole(value.role),
|
|
346
|
+
normalizeOptionalString(value.specUri),
|
|
347
|
+
normalizeBoolean(value.autoInstall, true),
|
|
348
|
+
normalizeBoolean(value.advertise, false),
|
|
349
|
+
normalizeOptionalString(value.discoveryKey),
|
|
350
|
+
normalizeUnsignedInteger(value.defaultPort),
|
|
351
|
+
normalizeBoolean(value.requireSecureTransport, false),
|
|
282
352
|
);
|
|
283
353
|
}
|
|
284
354
|
|
|
@@ -322,12 +392,6 @@ export function toEmbeddedPluginManifest(input = {}) {
|
|
|
322
392
|
"externalInterfaces are not yet representable in the embedded FlatBuffer manifest schema and were omitted from the compiled artifact.",
|
|
323
393
|
);
|
|
324
394
|
}
|
|
325
|
-
if (Array.isArray(input.runtimeTargets) && input.runtimeTargets.length > 0) {
|
|
326
|
-
warnings.push(
|
|
327
|
-
"runtimeTargets are not yet representable in the embedded FlatBuffer manifest schema and were omitted from the compiled artifact.",
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
395
|
const capabilities = Array.isArray(input.capabilities)
|
|
332
396
|
? input.capabilities
|
|
333
397
|
.map((entry) => toHostCapabilityT(entry, warnings))
|
|
@@ -358,6 +422,13 @@ export function toEmbeddedPluginManifest(input = {}) {
|
|
|
358
422
|
: [],
|
|
359
423
|
Number(input.abiVersion ?? 1),
|
|
360
424
|
normalizeInvokeSurfaces(input.invokeSurfaces),
|
|
425
|
+
Array.isArray(input.runtimeTargets)
|
|
426
|
+
? input.runtimeTargets
|
|
427
|
+
.map((value) =>
|
|
428
|
+
typeof value === "string" ? value.trim() : String(value ?? "").trim(),
|
|
429
|
+
)
|
|
430
|
+
.filter(Boolean)
|
|
431
|
+
: [],
|
|
361
432
|
),
|
|
362
433
|
warnings,
|
|
363
434
|
};
|