@vibesdotdev/infra-contracts 1.0.0-rc.4 → 1.0.0-rc.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 +4 -1
- package/dist/docs/service.docs.descriptor.d.ts.map +1 -1
- package/dist/docs/service.docs.descriptor.js +5 -2
- package/dist/docs/service.docs.descriptor.js.map +1 -1
- package/dist/service.d.ts +4 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +19 -4
- package/dist/service.js.map +1 -1
- package/package.json +34 -7
package/README.md
CHANGED
|
@@ -25,8 +25,11 @@ validate optional target-kind arguments and promised results. Implementation
|
|
|
25
25
|
errors propagate unchanged. Keep the original receiver when calling resolved
|
|
26
26
|
class methods: a parsed plain port is not a class adapter.
|
|
27
27
|
|
|
28
|
+
`serviceOrigin` from `@vibesdotdev/infra-contracts/service` reads that target
|
|
29
|
+
through the handed runtime. Invalid ids, invalid kinds, and undeclared
|
|
30
|
+
services refuse with `CapabilityError` and do not echo the caller value.
|
|
28
31
|
`@vibesdotdev/infra-core` owns service registration, configuration, environment
|
|
29
|
-
selection,
|
|
32
|
+
selection, and implementations.
|
|
30
33
|
|
|
31
34
|
## Documentation discovery
|
|
32
35
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.docs.descriptor.d.ts","sourceRoot":"","sources":["../../src/docs/service.docs.descriptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,
|
|
1
|
+
{"version":3,"file":"service.docs.descriptor.d.ts","sourceRoot":"","sources":["../../src/docs/service.docs.descriptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,wBA2DgC"}
|
|
@@ -36,9 +36,12 @@ async function origin(service: ServicePort) {
|
|
|
36
36
|
\`\`\`
|
|
37
37
|
|
|
38
38
|
The parsed plain port is not a receiver-preserving class adapter.
|
|
39
|
+
\`serviceOrigin\` from \`@vibesdotdev/infra-contracts/service\` validates the id
|
|
40
|
+
and kind, then reads the handed runtime. An invalid id or kind, or an
|
|
41
|
+
undeclared service, refuses with CapabilityError and does not echo the caller
|
|
42
|
+
value. Implementation failures propagate unchanged.
|
|
39
43
|
@vibesdotdev/infra-core owns infra/service registration, implementations,
|
|
40
|
-
configuration
|
|
41
|
-
This contract package does not resolve services or translate those failures.
|
|
44
|
+
configuration and environment selection.
|
|
42
45
|
|
|
43
46
|
Compose docsPlugin from @vibesdotdev/docs/plugin and infraContractsDocsPlugin
|
|
44
47
|
from @vibesdotdev/infra-contracts/docs. Resolve getVibesDocsClient(runtime) from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.docs.descriptor.js","sourceRoot":"","sources":["../../src/docs/service.docs.descriptor.ts"],"names":[],"mappings":"AAEA,eAAe;IACd,IAAI,EAAE,YAAY;IAClB,EAAE,EAAE,yBAAyB;IAC7B,KAAK,EAAE,2CAA2C;IAClD,OAAO,EAAE,kFAAkF;IAC3F,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,CAAC,iBAAiB,EAAE,OAAO,EAAE,SAAS,CAAC;IAC7C,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC;IACzC,OAAO,EAAE,IAAI;IACb,IAAI,EAAE;QACL,IAAI,EAAE,UAAU;QAChB,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"service.docs.descriptor.js","sourceRoot":"","sources":["../../src/docs/service.docs.descriptor.ts"],"names":[],"mappings":"AAEA,eAAe;IACd,IAAI,EAAE,YAAY;IAClB,EAAE,EAAE,yBAAyB;IAC7B,KAAK,EAAE,2CAA2C;IAClD,OAAO,EAAE,kFAAkF;IAC3F,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,CAAC,iBAAiB,EAAE,OAAO,EAAE,SAAS,CAAC;IAC7C,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC;IACzC,OAAO,EAAE,IAAI;IACb,IAAI,EAAE;QACL,IAAI,EAAE,UAAU;QAChB,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CT;KACC;CAC6B,CAAC"}
|
package/dist/service.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ export * from './schemas/index.ts';
|
|
|
5
5
|
* A declared service's origin, read through the `infra/service` kind. The
|
|
6
6
|
* kind's implementation (infra-core's by default) selects the target, so a
|
|
7
7
|
* consumer needs only this contract and the runtime it was handed.
|
|
8
|
+
*
|
|
9
|
+
* Caller values stay out of the refusal: invalid ids and kinds are rejected
|
|
10
|
+
* before the query, and an undeclared service names no id in the message,
|
|
11
|
+
* details, or cause.
|
|
8
12
|
*/
|
|
9
13
|
export declare function serviceOrigin(runtime: RuntimeRef, id: string, kind?: ServiceTargetKind): Promise<string>;
|
|
10
14
|
//# sourceMappingURL=service.d.ts.map
|
package/dist/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAA0F,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEpJ,cAAc,oBAAoB,CAAC;AAEnC;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,GAAE,iBAA6B,GAAG,OAAO,CAAC,MAAM,CAAC,CAgBzH"}
|
package/dist/service.js
CHANGED
|
@@ -1,19 +1,34 @@
|
|
|
1
1
|
import { CapabilityError } from '@vibesdotdev/kernel';
|
|
2
|
-
import {
|
|
2
|
+
import { SafeIdentifierSchema } from '@vibesdotdev/kernel/schemas/descriptor';
|
|
3
|
+
import { ServiceTargetKindSchema, ServiceTargetSchema } from "./schemas/index.js";
|
|
3
4
|
export * from "./schemas/index.js";
|
|
4
5
|
/**
|
|
5
6
|
* A declared service's origin, read through the `infra/service` kind. The
|
|
6
7
|
* kind's implementation (infra-core's by default) selects the target, so a
|
|
7
8
|
* consumer needs only this contract and the runtime it was handed.
|
|
9
|
+
*
|
|
10
|
+
* Caller values stay out of the refusal: invalid ids and kinds are rejected
|
|
11
|
+
* before the query, and an undeclared service names no id in the message,
|
|
12
|
+
* details, or cause.
|
|
8
13
|
*/
|
|
9
14
|
export async function serviceOrigin(runtime, id, kind = 'primary') {
|
|
15
|
+
const serviceId = SafeIdentifierSchema.safeParse(id);
|
|
16
|
+
if (!serviceId.success)
|
|
17
|
+
throw new CapabilityError('Service id is invalid.', 'INVALID_INPUT', {
|
|
18
|
+
reason: 'service-id-invalid'
|
|
19
|
+
});
|
|
20
|
+
const targetKind = ServiceTargetKindSchema.safeParse(kind);
|
|
21
|
+
if (!targetKind.success)
|
|
22
|
+
throw new CapabilityError('Service target kind is invalid.', 'INVALID_INPUT', {
|
|
23
|
+
reason: 'service-target-kind-invalid'
|
|
24
|
+
});
|
|
10
25
|
const selected = runtime.hasKind('infra/service')
|
|
11
|
-
? await runtime.query('infra/service').withId(
|
|
26
|
+
? await runtime.query('infra/service').withId(serviceId.data).select()
|
|
12
27
|
: undefined;
|
|
13
28
|
if (!selected)
|
|
14
29
|
throw new CapabilityError('Service is not declared in this runtime.', 'NOT_FOUND', {
|
|
15
|
-
reason: 'service-undeclared'
|
|
30
|
+
reason: 'service-undeclared'
|
|
16
31
|
});
|
|
17
|
-
return ServiceTargetSchema.parse(await selected.impl.target(
|
|
32
|
+
return ServiceTargetSchema.parse(await selected.impl.target(targetKind.data)).origin;
|
|
18
33
|
}
|
|
19
34
|
//# sourceMappingURL=service.js.map
|
package/dist/service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAmB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAoE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAmB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAoE,MAAM,oBAAoB,CAAC;AAEpJ,cAAc,oBAAoB,CAAC;AAEnC;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAmB,EAAE,EAAU,EAAE,OAA0B,SAAS;IACvG,MAAM,SAAS,GAAG,oBAAoB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACrD,IAAI,CAAC,SAAS,CAAC,OAAO;QAAE,MAAM,IAAI,eAAe,CAAC,wBAAwB,EAAE,eAAe,EAAE;YAC5F,MAAM,EAAE,oBAAoB;SAC5B,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,uBAAuB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC3D,IAAI,CAAC,UAAU,CAAC,OAAO;QAAE,MAAM,IAAI,eAAe,CAAC,iCAAiC,EAAE,eAAe,EAAE;YACtG,MAAM,EAAE,6BAA6B;SACrC,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC;QAChD,CAAC,CAAC,MAAM,OAAO,CAAC,KAAK,CAAiC,eAAe,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE;QACtG,CAAC,CAAC,SAAS,CAAC;IACb,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,eAAe,CAAC,0CAA0C,EAAE,WAAW,EAAE;YACjG,MAAM,EAAE,oBAAoB;SAC5B,CAAC,CAAC;IACH,OAAO,mBAAmB,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;AACtF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibesdotdev/infra-contracts",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.6",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@vibesdotdev/kernel": "^1.0.0-rc.
|
|
5
|
+
"@vibesdotdev/kernel": "^1.0.0-rc.11",
|
|
6
6
|
"zod": "^4.6.7",
|
|
7
|
-
"@vibesdotdev/docs-contracts": "^1.0.0-rc.
|
|
7
|
+
"@vibesdotdev/docs-contracts": "^1.0.0-rc.5"
|
|
8
8
|
},
|
|
9
9
|
"main": "./dist/index.js",
|
|
10
10
|
"exports": {
|
|
@@ -42,7 +42,34 @@
|
|
|
42
42
|
"!dist/**/*.test.d.ts",
|
|
43
43
|
"!dist/**/*.spec.js",
|
|
44
44
|
"!dist/**/*.spec.d.ts",
|
|
45
|
-
"!dist/**/*.tsbuildinfo"
|
|
45
|
+
"!dist/**/*.tsbuildinfo",
|
|
46
|
+
"!**/.turbo/**",
|
|
47
|
+
"!**/.svelte-kit/**",
|
|
48
|
+
"!**/.vibes/**",
|
|
49
|
+
"!**/__tests__/**",
|
|
50
|
+
"!**/__stubs__/**",
|
|
51
|
+
"!**/*.test.js",
|
|
52
|
+
"!**/*.test.mjs",
|
|
53
|
+
"!**/*.test.cjs",
|
|
54
|
+
"!**/*.test.jsx",
|
|
55
|
+
"!**/*.test.ts",
|
|
56
|
+
"!**/*.test.mts",
|
|
57
|
+
"!**/*.test.cts",
|
|
58
|
+
"!**/*.test.tsx",
|
|
59
|
+
"!**/*.spec.js",
|
|
60
|
+
"!**/*.spec.mjs",
|
|
61
|
+
"!**/*.spec.cjs",
|
|
62
|
+
"!**/*.spec.jsx",
|
|
63
|
+
"!**/*.spec.ts",
|
|
64
|
+
"!**/*.spec.mts",
|
|
65
|
+
"!**/*.spec.cts",
|
|
66
|
+
"!**/*.spec.tsx",
|
|
67
|
+
"!**/SPEC.md",
|
|
68
|
+
"!**/tsconfig.json",
|
|
69
|
+
"!**/tsconfig.*.json",
|
|
70
|
+
"!**/*.tsbuildinfo",
|
|
71
|
+
"!**/.build-ok.json",
|
|
72
|
+
"!**/*.tgz"
|
|
46
73
|
],
|
|
47
74
|
"scripts": {
|
|
48
75
|
"lint": "node ../node_modules/@vibesdotdev/internal-oxlint-toolchain/ratchet.mjs .",
|
|
@@ -72,10 +99,10 @@
|
|
|
72
99
|
"type": "module",
|
|
73
100
|
"types": "./dist/index.d.ts",
|
|
74
101
|
"license": "MIT",
|
|
75
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "d1948c757f179d2c3fb41553347085335cb76710",
|
|
76
103
|
"_vibes_source": {
|
|
77
104
|
"repo": "ssh://git@git.vibes.dev/vibesdotdev/framework.git",
|
|
78
|
-
"sha": "
|
|
79
|
-
"workspaceDigest": "sha256:
|
|
105
|
+
"sha": "d1948c757f179d2c3fb41553347085335cb76710",
|
|
106
|
+
"workspaceDigest": "sha256:44321e8f358fedf741daff2c84e5b4ce3aafe7c04ae53a5537e60613aee4fd2d"
|
|
80
107
|
}
|
|
81
108
|
}
|