@pellux/goodvibes-operator-sdk 0.30.2 → 0.33.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/README.md +5 -5
- package/dist/client-core.d.ts +9 -6
- package/dist/client-core.d.ts.map +1 -1
- package/dist/client-core.js +17 -1
- package/dist/client.d.ts +11 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +4 -36
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/schema-registry.d.ts +4 -0
- package/dist/schema-registry.d.ts.map +1 -0
- package/dist/schema-registry.js +32 -0
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# @pellux/goodvibes-operator-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Public GoodVibes operator package for the contract-driven operator and control-plane HTTP client.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Most applications should install `@pellux/goodvibes-sdk` and import `@pellux/goodvibes-sdk/operator`. Install this package directly when you only need the operator client subset.
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
8
|
import { createOperatorSdk } from '@pellux/goodvibes-sdk/operator';
|
|
9
9
|
|
|
10
10
|
const operator = createOperatorSdk({
|
|
11
|
-
baseUrl: 'http://127.0.0.1:
|
|
11
|
+
baseUrl: 'http://127.0.0.1:3421',
|
|
12
12
|
authToken: process.env.GOODVIBES_TOKEN,
|
|
13
13
|
});
|
|
14
14
|
|
|
@@ -19,7 +19,7 @@ const login = await operator.invoke('control.auth.login', {
|
|
|
19
19
|
});
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
Use this surface when you want only the operator/control-plane surface and do not need the
|
|
22
|
+
Use this surface when you want only the operator/control-plane surface and do not need the main SDK composition layer.
|
|
23
23
|
|
|
24
24
|
Advanced consumers can also build directly from a preconfigured transport and contract:
|
|
25
25
|
|
|
@@ -29,7 +29,7 @@ import { createOperatorRemoteClient } from '@pellux/goodvibes-sdk/operator';
|
|
|
29
29
|
import { createHttpTransport } from '@pellux/goodvibes-sdk/transport-http';
|
|
30
30
|
|
|
31
31
|
const transport = createHttpTransport({
|
|
32
|
-
baseUrl: 'http://127.0.0.1:
|
|
32
|
+
baseUrl: 'http://127.0.0.1:3421',
|
|
33
33
|
authToken: process.env.GOODVIBES_TOKEN,
|
|
34
34
|
});
|
|
35
35
|
|
package/dist/client-core.d.ts
CHANGED
|
@@ -7,12 +7,16 @@ export interface OperatorRemoteClientInvokeOptions extends ContractInvokeOptions
|
|
|
7
7
|
export interface OperatorRemoteClientStreamOptions extends ContractStreamOptions {
|
|
8
8
|
}
|
|
9
9
|
export interface OperatorRemoteClientOptions {
|
|
10
|
-
readonly getResponseSchema?: (methodId: string) => ContractInvokeOptions['responseSchema'];
|
|
11
|
-
|
|
10
|
+
readonly getResponseSchema?: ((methodId: string) => ContractInvokeOptions['responseSchema']) | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Applies to JSON request/response methods. Server-sent event stream payloads
|
|
13
|
+
* are validated by their realtime event schemas at the transport boundary.
|
|
14
|
+
*/
|
|
15
|
+
readonly validateResponses?: boolean | undefined;
|
|
12
16
|
}
|
|
13
|
-
type KnownMethodArgs<TMethodId extends OperatorTypedMethodId> = MethodArgs<OperatorMethodInput<TMethodId>, OperatorRemoteClientInvokeOptions>;
|
|
14
|
-
type KnownPathMethodArgs<TMethodId extends OperatorTypedMethodId, TKeys extends PropertyKey> = MethodArgs<WithoutKeys<OperatorMethodInput<TMethodId>, TKeys>, OperatorRemoteClientInvokeOptions>;
|
|
15
|
-
type KnownStreamArgs<TMethodId extends OperatorStreamMethodId> = MethodArgs<OperatorMethodInput<TMethodId>, OperatorRemoteClientStreamOptions>;
|
|
17
|
+
export type KnownMethodArgs<TMethodId extends OperatorTypedMethodId> = MethodArgs<OperatorMethodInput<TMethodId>, OperatorRemoteClientInvokeOptions>;
|
|
18
|
+
export type KnownPathMethodArgs<TMethodId extends OperatorTypedMethodId, TKeys extends PropertyKey> = MethodArgs<WithoutKeys<OperatorMethodInput<TMethodId>, TKeys>, OperatorRemoteClientInvokeOptions>;
|
|
19
|
+
export type KnownStreamArgs<TMethodId extends OperatorStreamMethodId> = MethodArgs<OperatorMethodInput<TMethodId>, OperatorRemoteClientStreamOptions>;
|
|
16
20
|
export interface OperatorRemoteClient {
|
|
17
21
|
readonly transport: HttpTransport;
|
|
18
22
|
readonly contract: OperatorContractManifest;
|
|
@@ -95,5 +99,4 @@ export interface OperatorRemoteClient {
|
|
|
95
99
|
};
|
|
96
100
|
}
|
|
97
101
|
export declare function createOperatorRemoteClient(transport: HttpTransport, contract: OperatorContractManifest, clientOptions?: OperatorRemoteClientOptions): OperatorRemoteClient;
|
|
98
|
-
export {};
|
|
99
102
|
//# sourceMappingURL=client-core.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-core.d.ts","sourceRoot":"","sources":["../src/client-core.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACpG,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAQL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAG1B,KAAK,UAAU,EACf,KAAK,WAAW,EACjB,MAAM,kCAAkC,CAAC;AAE1C,MAAM,WAAW,iCAAkC,SAAQ,qBAAqB;CAAG;AAEnF,MAAM,WAAW,iCAAkC,SAAQ,qBAAqB;CAAG;AAEnF,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"client-core.d.ts","sourceRoot":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,CAAC,uBAAuB,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC,CAAC;QAClH,MAAM,CAAC,GAAG,IAAI,EAAE,eAAe,CAAC,uBAAuB,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC,CAAC;QAClH,MAAM,CAAC,GAAG,IAAI,EAAE,eAAe,CAAC,uBAAuB,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC,CAAC;QAClH,OAAO,CAAC,GAAG,IAAI,EAAE,eAAe,CAAC,uBAAuB,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC,CAAC;QACnH,IAAI,EAAE;YACJ,MAAM,CAAC,GAAG,IAAI,EAAE,eAAe,CAAC,uBAAuB,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC,CAAC;YAClH,IAAI,CAAC,GAAG,IAAI,EAAE,eAAe,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC,qBAAqB,CAAC,CAAC,CAAC;YAC5G,OAAO,CAAC,GAAG,IAAI,EAAE,eAAe,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC,wBAAwB,CAAC,CAAC,CAAC;SACtH,CAAC;QACF,MAAM,CAAC,GAAG,IAAI,EAAE,eAAe,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;KAC3E,CAAC;CACH;AA4BD,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,aAAa,EACxB,QAAQ,EAAE,wBAAwB,EAClC,aAAa,GAAE,2BAAgC,GAC9C,oBAAoB,CAmMtB"}
|
package/dist/client-core.js
CHANGED
|
@@ -23,6 +23,12 @@ export function createOperatorRemoteClient(transport, contract, clientOptions =
|
|
|
23
23
|
const method = requireMethod(contract, methodId);
|
|
24
24
|
const route = methodHttpRoute(method);
|
|
25
25
|
return invokeContractRoute(transport, route, input, schema ? { ...options, responseSchema: schema } : options).then((body) => {
|
|
26
|
+
// truth table for validation decision:
|
|
27
|
+
// | schema (Zod) | validateResponses | getResponseSchema | action |
|
|
28
|
+
// | present | any | any | Zod only (no overlap) |
|
|
29
|
+
// | absent | false | any | skip |
|
|
30
|
+
// | absent | true (def) | absent | JSON-schema |
|
|
31
|
+
// | absent | true (def) | present | JSON-schema (from fn) |
|
|
26
32
|
if (!schema && clientOptions.validateResponses !== false)
|
|
27
33
|
validateJsonSchemaResponse(method, body);
|
|
28
34
|
return body;
|
|
@@ -30,7 +36,17 @@ export function createOperatorRemoteClient(transport, contract, clientOptions =
|
|
|
30
36
|
}
|
|
31
37
|
function streamTyped(methodId, ...args) {
|
|
32
38
|
const [input, options] = splitClientArgs(args);
|
|
33
|
-
|
|
39
|
+
// Streams may be opened without handlers when the caller wants the raw
|
|
40
|
+
// cancel function only; provide the empty handler map explicitly so
|
|
41
|
+
// openContractRouteStream never has to infer a missing options object.
|
|
42
|
+
// Response validation is not applied here because stream payloads are
|
|
43
|
+
// delivered through per-event handlers rather than a single response body.
|
|
44
|
+
// If the underlying transport does not validate realtime envelopes, stream
|
|
45
|
+
// payloads are emitted to handlers without schema verification. The
|
|
46
|
+
// validateResponses option is intentionally not forwarded because streams
|
|
47
|
+
// do not have a single response body to validate.
|
|
48
|
+
const streamOptions = options ?? { handlers: {} };
|
|
49
|
+
return openContractRouteStream(transport, requireMethodRoute(contract, methodId), clientInputRecord(input), streamOptions);
|
|
34
50
|
}
|
|
35
51
|
const client = {
|
|
36
52
|
transport,
|
package/dist/client.d.ts
CHANGED
|
@@ -8,10 +8,20 @@ export interface OperatorSdkOptions extends HttpTransportOptions {
|
|
|
8
8
|
* This is useful when a caller wants raw response bodies for contract
|
|
9
9
|
* debugging or benchmarking.
|
|
10
10
|
*/
|
|
11
|
-
readonly validateResponses?: boolean;
|
|
11
|
+
readonly validateResponses?: boolean | undefined;
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Public invocation options intentionally wrap the remote-client options so
|
|
15
|
+
* operator-sdk can add operator-specific fields without changing the generic
|
|
16
|
+
* remote client contract.
|
|
17
|
+
*/
|
|
13
18
|
export interface OperatorInvokeOptions extends OperatorRemoteClientInvokeOptions {
|
|
14
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Public stream options intentionally wrap the remote-client stream options so
|
|
22
|
+
* operator-sdk can add stream-specific surface fields while keeping the
|
|
23
|
+
* generic client contract stable.
|
|
24
|
+
*/
|
|
15
25
|
export interface OperatorStreamOptions extends OperatorRemoteClientStreamOptions {
|
|
16
26
|
}
|
|
17
27
|
export type OperatorSdk = Omit<OperatorRemoteClient, 'getOperation'> & {
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC1B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,iCAAiC,EACtC,KAAK,iCAAiC,EACvC,MAAM,kBAAkB,CAAC;AAG1B,MAAM,WAAW,kBAAmB,SAAQ,oBAAoB;IAC9D;;;;;OAKG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC1B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,iCAAiC,EACtC,KAAK,iCAAiC,EACvC,MAAM,kBAAkB,CAAC;AAG1B,MAAM,WAAW,kBAAmB,SAAQ,oBAAoB;IAC9D;;;;;OAKG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAClD;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,iCAAiC;CAAG;AAEnF;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,iCAAiC;CAAG;AAEnF,MAAM,MAAM,WAAW,GACnB,IAAI,CAAC,oBAAoB,EAAE,cAAc,CAAC,GAC1C;IACA,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;IAClC,YAAY,CAAC,QAAQ,EAAE,gBAAgB,GAAG,sBAAsB,CAAC;IACjE,OAAO,IAAI,IAAI,CAAC;IAChB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;IACzB,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC,CAAC;AAEJ,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,CAgC1E"}
|
package/dist/client.js
CHANGED
|
@@ -1,46 +1,14 @@
|
|
|
1
|
-
import { getOperatorContract } from '@pellux/goodvibes-contracts';
|
|
1
|
+
import { getOperatorContract, OPERATOR_METHOD_IDS } from '@pellux/goodvibes-contracts';
|
|
2
2
|
import * as ContractZodSchemas from '@pellux/goodvibes-contracts';
|
|
3
3
|
import { createHttpTransport, } from '@pellux/goodvibes-transport-http';
|
|
4
4
|
import { createOperatorRemoteClient, } from './client-core.js';
|
|
5
|
-
|
|
6
|
-
return Boolean(value && typeof value === 'object' && 'safeParse' in value && typeof value.safeParse === 'function');
|
|
7
|
-
}
|
|
8
|
-
function pascalCaseContractPart(part) {
|
|
9
|
-
return part
|
|
10
|
-
.split(/[_-]+/)
|
|
11
|
-
.filter(Boolean)
|
|
12
|
-
.map((token) => token.charAt(0).toUpperCase() + token.slice(1))
|
|
13
|
-
.join('');
|
|
14
|
-
}
|
|
15
|
-
function responseSchemaExportCandidates(methodId) {
|
|
16
|
-
const parts = methodId.split('.').filter(Boolean).map(pascalCaseContractPart);
|
|
17
|
-
if (parts.length === 0)
|
|
18
|
-
return [];
|
|
19
|
-
const fullName = `${parts.join('')}ResponseSchema`;
|
|
20
|
-
const verbFirst = parts.length > 1
|
|
21
|
-
? `${parts[parts.length - 1]}${parts.slice(0, -1).join('')}ResponseSchema`
|
|
22
|
-
: fullName;
|
|
23
|
-
return fullName === verbFirst ? [fullName] : [fullName, verbFirst];
|
|
24
|
-
}
|
|
25
|
-
function buildSchemaRegistry(methodIds, schemas) {
|
|
26
|
-
const registry = {};
|
|
27
|
-
for (const methodId of methodIds) {
|
|
28
|
-
for (const exportName of responseSchemaExportCandidates(methodId)) {
|
|
29
|
-
const schema = schemas[exportName];
|
|
30
|
-
if (!isZodSchema(schema))
|
|
31
|
-
continue;
|
|
32
|
-
registry[methodId] = schema;
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return registry;
|
|
37
|
-
}
|
|
5
|
+
import { buildSchemaRegistry } from './schema-registry.js';
|
|
38
6
|
export function createOperatorSdk(options) {
|
|
39
7
|
const validateResponses = options.validateResponses !== false;
|
|
40
8
|
const transport = createHttpTransport(options);
|
|
41
9
|
const contract = getOperatorContract();
|
|
42
10
|
const schemaRegistry = validateResponses
|
|
43
|
-
? buildSchemaRegistry(
|
|
11
|
+
? buildSchemaRegistry(OPERATOR_METHOD_IDS, ContractZodSchemas)
|
|
44
12
|
: {};
|
|
45
13
|
const remote = createOperatorRemoteClient(transport, contract, {
|
|
46
14
|
validateResponses,
|
|
@@ -64,7 +32,7 @@ export function createOperatorSdk(options) {
|
|
|
64
32
|
this.dispose();
|
|
65
33
|
},
|
|
66
34
|
async [Symbol.asyncDispose]() {
|
|
67
|
-
this.
|
|
35
|
+
return this.asyncDispose();
|
|
68
36
|
},
|
|
69
37
|
};
|
|
70
38
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { OperatorInvokeOptions, OperatorSdk, OperatorSdkOptions, OperatorStreamOptions, } from './client.js';
|
|
2
2
|
export { createOperatorSdk } from './client.js';
|
|
3
3
|
export { createOperatorRemoteClient, } from './client-core.js';
|
|
4
|
-
export type { OperatorRemoteClient, OperatorRemoteClientInvokeOptions, OperatorRemoteClientStreamOptions, } from './client-core.js';
|
|
4
|
+
export type { OperatorRemoteClient, OperatorRemoteClientInvokeOptions, OperatorRemoteClientOptions, OperatorRemoteClientStreamOptions, KnownMethodArgs, KnownPathMethodArgs, KnownStreamArgs, } from './client-core.js';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,qBAAqB,EACrB,WAAW,EACX,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,oBAAoB,EACpB,iCAAiC,EACjC,iCAAiC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,qBAAqB,EACrB,WAAW,EACX,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,oBAAoB,EACpB,iCAAiC,EACjC,2BAA2B,EAC3B,iCAAiC,EACjC,eAAe,EACf,mBAAmB,EACnB,eAAe,GAChB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ZodType } from 'zod/v4';
|
|
2
|
+
export declare function methodIdToSchemaName(methodId: string): string;
|
|
3
|
+
export declare function buildSchemaRegistry(methodIds: readonly string[], schemas: Record<string, unknown>): Partial<Record<string, ZodType>>;
|
|
4
|
+
//# sourceMappingURL=schema-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-registry.d.ts","sourceRoot":"","sources":["../src/schema-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAMtC,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAc7D;AAED,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAalC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
function isZodSchema(value) {
|
|
2
|
+
return Boolean(value && typeof value === 'object' && 'safeParse' in value && typeof value.safeParse === 'function');
|
|
3
|
+
}
|
|
4
|
+
export function methodIdToSchemaName(methodId) {
|
|
5
|
+
const pascal = methodId
|
|
6
|
+
.split('.')
|
|
7
|
+
.flatMap((segment) => segment.split('_'))
|
|
8
|
+
.map((word) => {
|
|
9
|
+
if (word.length === 0) {
|
|
10
|
+
throw new Error(`Invalid contract method id "${methodId}": segments must not be empty (avoid consecutive or trailing underscores/dots).`);
|
|
11
|
+
}
|
|
12
|
+
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
13
|
+
})
|
|
14
|
+
.join('');
|
|
15
|
+
return `${pascal}ResponseSchema`;
|
|
16
|
+
}
|
|
17
|
+
export function buildSchemaRegistry(methodIds, schemas) {
|
|
18
|
+
const candidateMap = new Map();
|
|
19
|
+
for (const methodId of methodIds) {
|
|
20
|
+
candidateMap.set(methodIdToSchemaName(methodId), methodId);
|
|
21
|
+
}
|
|
22
|
+
const registry = {};
|
|
23
|
+
for (const [key, value] of Object.entries(schemas)) {
|
|
24
|
+
const methodId = candidateMap.get(key);
|
|
25
|
+
if (methodId === undefined)
|
|
26
|
+
continue;
|
|
27
|
+
if (!isZodSchema(value))
|
|
28
|
+
continue;
|
|
29
|
+
registry[methodId] = value;
|
|
30
|
+
}
|
|
31
|
+
return registry;
|
|
32
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pellux/goodvibes-operator-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"engines": {
|
|
5
|
-
"
|
|
5
|
+
"bun": "1.3.10",
|
|
6
|
+
"node": ">=22.0.0"
|
|
6
7
|
},
|
|
7
8
|
"description": "Contract-driven HTTP client for the GoodVibes operator and control-plane APIs.",
|
|
8
9
|
"type": "module",
|
|
@@ -44,9 +45,9 @@
|
|
|
44
45
|
"client"
|
|
45
46
|
],
|
|
46
47
|
"dependencies": {
|
|
47
|
-
"@pellux/goodvibes-contracts": "0.
|
|
48
|
-
"@pellux/goodvibes-errors": "0.
|
|
49
|
-
"@pellux/goodvibes-transport-http": "0.
|
|
48
|
+
"@pellux/goodvibes-contracts": "0.33.0",
|
|
49
|
+
"@pellux/goodvibes-errors": "0.33.0",
|
|
50
|
+
"@pellux/goodvibes-transport-http": "0.33.0",
|
|
50
51
|
"zod": "^4.3.6"
|
|
51
52
|
},
|
|
52
53
|
"publishConfig": {
|