@deepseek-ai/dsh-typert-registry 0.2.1-rc.3 → 0.2.2-alpha.2
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.i18n.yaml +4 -4
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/lib/client.browser.js +10 -3
- package/lib/client.node.js +10 -3
- package/lib/index.js +10 -3
- package/lib/types/service.js +17 -3
- package/locale/de.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/pt.json +6 -0
- package/locale/ru.json +6 -0
- package/package.json +4 -4
package/README.i18n.yaml
CHANGED
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
en: 9ca425515904d5c9
|
|
28
28
|
zh: b251226ecfa32002
|
|
29
29
|
/deepseek-ai-dsh-typert-registry/use-this-package/lookup-and-context-providers:
|
|
30
|
-
en:
|
|
31
|
-
zh:
|
|
30
|
+
en: a5392d1b04cde813
|
|
31
|
+
zh: 20e09e9a70701821
|
|
32
32
|
/deepseek-ai-dsh-typert-registry/understand-the-implementation:
|
|
33
33
|
en: 1a78dfbae50a8b0d
|
|
34
34
|
zh: dc10b4b3f3d832ed
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
en: 4d50f3efeb45eaa4
|
|
37
37
|
zh: ec3575d29d5a040b
|
|
38
38
|
/deepseek-ai-dsh-typert-registry/understand-the-implementation/sub-registries:
|
|
39
|
-
en:
|
|
40
|
-
zh:
|
|
39
|
+
en: 6e38f43ea3a1d5f6
|
|
40
|
+
zh: 5ff82d78d6afbab5
|
|
41
41
|
/deepseek-ai-dsh-typert-registry/understand-the-implementation/identity-and-validation:
|
|
42
42
|
en: 4764fc33a7e16e60
|
|
43
43
|
zh: 1ddf03cbe16197da
|
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ Harness offline integrations register an ordinary `TYPERT_REMOTE` contribution w
|
|
|
51
51
|
|
|
52
52
|
Remote calls resolve Host objects and scoped Contexts through `ctx.typert.lookups` and `ctx.typert.contexts`. `registerHost()` installs the Host wire declaration and its wire-to-Context resolver, while `configureHost()` replaces only that resolver. `registerClient()` installs the bidirectional Client adapter for the same merge-declared kind. Host-to-Client event sources carry their domain identity explicitly instead of projecting it back from a Context.
|
|
53
53
|
|
|
54
|
-
`ctx.typert.resources` holds the default
|
|
54
|
+
`ctx.typert.resources` holds the default identity extraction of each resource kind declared in `TypertResourceMap`. The domain that owns a kind registers either `{ field }` or `{ resolve }`, never both, as a Cordis effect of the calling fiber; a second registration of one kind throws, and so does `global`, the built-in identity-less resource kind. A resolver is called once, as a plain function without a receiver, so it reads only its `{ args, parameters }` input; a declaration with neither member throws at registration. `get(kind)` reads one declaration, and `entries()` lists each `kind` with its field or resolver declaration in registration order. A lookup provider and a Host Context adapter may name the resource kind of their wire identity through `resource`, and a configured resolver keeps it. The Gateway reads all three when it resolves the resources of a non-owner call.
|
|
55
55
|
|
|
56
56
|
-----
|
|
57
57
|
|
|
@@ -73,7 +73,7 @@ The registry is built on one principle: a contribution is one atomic, fiber-owne
|
|
|
73
73
|
- `ctx.typert.remotes` — consumer-selected contributions mounted in the calling fiber.
|
|
74
74
|
- `ctx.typert.lookups` — lookup providers plus composition-owned resolver overrides per key.
|
|
75
75
|
- `ctx.typert.contexts` — Host Context providers and Client Context binders per scoped key.
|
|
76
|
-
- `ctx.typert.resources` — the default
|
|
76
|
+
- `ctx.typert.resources` — the default field or resolver per resource kind.
|
|
77
77
|
|
|
78
78
|
Each sub-registry publishes `TypertRegistryChange` events to subscribed listeners; a throwing listener is logged and does not stop later listeners.
|
|
79
79
|
|
package/README.zh.md
CHANGED
|
@@ -51,7 +51,7 @@ Harness 离线集成在各自的 profile Context 中通过 `ctx.typert.remotes.r
|
|
|
51
51
|
|
|
52
52
|
Remote 调用通过 `ctx.typert.lookups` 与 `ctx.typert.contexts` 解析 Host 对象与作用域 Context。`registerHost()` 安装 Host wire 声明及其 wire 到 Context 的 resolver,`configureHost()` 只替换该 resolver。`registerClient()` 为同一个 merge-declared kind 安装双向 Client adapter。Host 到 Client 的事件源显式携带领域 identity,而不从 Context 反向投影。
|
|
53
53
|
|
|
54
|
-
`ctx.typert.resources` 保存 `TypertResourceMap`
|
|
54
|
+
`ctx.typert.resources` 保存 `TypertResourceMap` 中每个资源种类的默认身份提取规则。拥有该种类的领域登记 `{ field }` 或 `{ resolve }`,不能同时提供两者,登记是调用方 fiber 的 Cordis effect;同一种类重复登记即抛错,登记内置的无身份资源种类 `global` 同样抛错。resolver 只以纯函数形式调用一次、不接收 receiver,因此只读取其 `{ args, parameters }` 输入;两个成员都不提供的声明在登记时抛错。`get(kind)` 读取一个种类的声明,`entries()` 按登记顺序列出每个 `kind` 及其字段或 resolver 声明。lookup provider 与 Host Context adapter 可经 `resource` 声明其 wire 身份所属的资源种类,配置的 resolver 保留该声明。Gateway 解析非 owner 调用的资源时读取这三者。
|
|
55
55
|
|
|
56
56
|
-----
|
|
57
57
|
|
|
@@ -73,7 +73,7 @@ Remote 调用通过 `ctx.typert.lookups` 与 `ctx.typert.contexts` 解析 Host
|
|
|
73
73
|
- `ctx.typert.remotes`——在调用方 fiber 中挂载的、由消费方选中的贡献。
|
|
74
74
|
- `ctx.typert.lookups`——lookup 提供方,以及按键配置的组合方解析器覆盖。
|
|
75
75
|
- `ctx.typert.contexts`——按作用域键配置的 Host Context 提供方与 Client Context 绑定器。
|
|
76
|
-
- `ctx.typert.resources
|
|
76
|
+
- `ctx.typert.resources`——每个资源种类的默认字段或 resolver。
|
|
77
77
|
|
|
78
78
|
每个子注册表都会向已订阅的监听器发布 `TypertRegistryChange` 事件;抛异常的监听器会被记录日志,且不会阻止后续监听器。
|
|
79
79
|
|
package/lib/client.browser.js
CHANGED
|
@@ -365,7 +365,7 @@ window.__ModuleLoader__.load({
|
|
|
365
365
|
get: (kind) => this.declarations.get(kind)?.provider,
|
|
366
366
|
entries: () => [...this.declarations].map(([kind, entry]) => Object.freeze({
|
|
367
367
|
kind,
|
|
368
|
-
|
|
368
|
+
...entry.provider
|
|
369
369
|
})),
|
|
370
370
|
subscribe: (listener) => this.changes.subscribe(ctx, listener)
|
|
371
371
|
};
|
|
@@ -373,10 +373,17 @@ window.__ModuleLoader__.load({
|
|
|
373
373
|
register(ctx, kind, declaration) {
|
|
374
374
|
validateSegment("resource kind", kind);
|
|
375
375
|
if (kind === GLOBAL_RESOURCE_KIND) throw new Error(`typert: resource kind "${GLOBAL_RESOURCE_KIND}" is reserved for the built-in global resource`);
|
|
376
|
-
validateWireName("resource field", declaration.field);
|
|
377
376
|
if (this.declarations.has(kind)) throw new Error(`typert: resource kind "${kind}" is already registered`);
|
|
377
|
+
const resolve = declaration.resolve;
|
|
378
|
+
const field = declaration.field;
|
|
379
|
+
let provider;
|
|
380
|
+
if (resolve !== void 0) provider = { resolve };
|
|
381
|
+
else if (field !== void 0) {
|
|
382
|
+
validateWireName("resource field", field);
|
|
383
|
+
provider = { field };
|
|
384
|
+
} else throw new Error(`typert: resource kind "${kind}" declares neither a field nor a resolve function`);
|
|
378
385
|
const entry = {
|
|
379
|
-
provider
|
|
386
|
+
provider,
|
|
380
387
|
owner: {}
|
|
381
388
|
};
|
|
382
389
|
const { declarations, changes } = this;
|
package/lib/client.node.js
CHANGED
|
@@ -359,7 +359,7 @@ var ResourceStore = class {
|
|
|
359
359
|
get: (kind) => this.declarations.get(kind)?.provider,
|
|
360
360
|
entries: () => [...this.declarations].map(([kind, entry]) => Object.freeze({
|
|
361
361
|
kind,
|
|
362
|
-
|
|
362
|
+
...entry.provider
|
|
363
363
|
})),
|
|
364
364
|
subscribe: (listener) => this.changes.subscribe(ctx, listener)
|
|
365
365
|
};
|
|
@@ -367,10 +367,17 @@ var ResourceStore = class {
|
|
|
367
367
|
register(ctx, kind, declaration) {
|
|
368
368
|
validateSegment("resource kind", kind);
|
|
369
369
|
if (kind === GLOBAL_RESOURCE_KIND) throw new Error(`typert: resource kind "${GLOBAL_RESOURCE_KIND}" is reserved for the built-in global resource`);
|
|
370
|
-
validateWireName("resource field", declaration.field);
|
|
371
370
|
if (this.declarations.has(kind)) throw new Error(`typert: resource kind "${kind}" is already registered`);
|
|
371
|
+
const resolve = declaration.resolve;
|
|
372
|
+
const field = declaration.field;
|
|
373
|
+
let provider;
|
|
374
|
+
if (resolve !== void 0) provider = { resolve };
|
|
375
|
+
else if (field !== void 0) {
|
|
376
|
+
validateWireName("resource field", field);
|
|
377
|
+
provider = { field };
|
|
378
|
+
} else throw new Error(`typert: resource kind "${kind}" declares neither a field nor a resolve function`);
|
|
372
379
|
const entry = {
|
|
373
|
-
provider
|
|
380
|
+
provider,
|
|
374
381
|
owner: {}
|
|
375
382
|
};
|
|
376
383
|
const { declarations, changes } = this;
|
package/lib/index.js
CHANGED
|
@@ -359,7 +359,7 @@ var ResourceStore = class {
|
|
|
359
359
|
get: (kind) => this.declarations.get(kind)?.provider,
|
|
360
360
|
entries: () => [...this.declarations].map(([kind, entry]) => Object.freeze({
|
|
361
361
|
kind,
|
|
362
|
-
|
|
362
|
+
...entry.provider
|
|
363
363
|
})),
|
|
364
364
|
subscribe: (listener) => this.changes.subscribe(ctx, listener)
|
|
365
365
|
};
|
|
@@ -367,10 +367,17 @@ var ResourceStore = class {
|
|
|
367
367
|
register(ctx, kind, declaration) {
|
|
368
368
|
validateSegment("resource kind", kind);
|
|
369
369
|
if (kind === GLOBAL_RESOURCE_KIND) throw new Error(`typert: resource kind "${GLOBAL_RESOURCE_KIND}" is reserved for the built-in global resource`);
|
|
370
|
-
validateWireName("resource field", declaration.field);
|
|
371
370
|
if (this.declarations.has(kind)) throw new Error(`typert: resource kind "${kind}" is already registered`);
|
|
371
|
+
const resolve = declaration.resolve;
|
|
372
|
+
const field = declaration.field;
|
|
373
|
+
let provider;
|
|
374
|
+
if (resolve !== void 0) provider = { resolve };
|
|
375
|
+
else if (field !== void 0) {
|
|
376
|
+
validateWireName("resource field", field);
|
|
377
|
+
provider = { field };
|
|
378
|
+
} else throw new Error(`typert: resource kind "${kind}" declares neither a field nor a resolve function`);
|
|
372
379
|
const entry = {
|
|
373
|
-
provider
|
|
380
|
+
provider,
|
|
374
381
|
owner: {}
|
|
375
382
|
};
|
|
376
383
|
const { declarations, changes } = this;
|
package/lib/types/service.js
CHANGED
|
@@ -353,7 +353,7 @@ class ResourceStore {
|
|
|
353
353
|
return {
|
|
354
354
|
register: (kind, declaration) => this.register(ctx, kind, declaration),
|
|
355
355
|
get: kind => this.declarations.get(kind)?.provider,
|
|
356
|
-
entries: () => [...this.declarations].map(([kind, entry]) => Object.freeze({ kind,
|
|
356
|
+
entries: () => [...this.declarations].map(([kind, entry]) => Object.freeze({ kind, ...entry.provider })),
|
|
357
357
|
subscribe: listener => this.changes.subscribe(ctx, listener),
|
|
358
358
|
};
|
|
359
359
|
}
|
|
@@ -362,10 +362,24 @@ class ResourceStore {
|
|
|
362
362
|
if (kind === GLOBAL_RESOURCE_KIND) {
|
|
363
363
|
throw new Error(`typert: resource kind "${GLOBAL_RESOURCE_KIND}" is reserved for the built-in global resource`);
|
|
364
364
|
}
|
|
365
|
-
validateWireName('resource field', declaration.field);
|
|
366
365
|
if (this.declarations.has(kind))
|
|
367
366
|
throw new Error(`typert: resource kind "${kind}" is already registered`);
|
|
368
|
-
|
|
367
|
+
// Copy by branch so a prototype method cannot vanish in a spread; an opaque declaration fails here
|
|
368
|
+
// rather than resolving every call of this kind to the global resource.
|
|
369
|
+
const resolve = declaration.resolve;
|
|
370
|
+
const field = declaration.field;
|
|
371
|
+
let provider;
|
|
372
|
+
if (resolve !== undefined) {
|
|
373
|
+
provider = { resolve };
|
|
374
|
+
}
|
|
375
|
+
else if (field !== undefined) {
|
|
376
|
+
validateWireName('resource field', field);
|
|
377
|
+
provider = { field };
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
throw new Error(`typert: resource kind "${kind}" declares neither a field nor a resolve function`);
|
|
381
|
+
}
|
|
382
|
+
const entry = { provider, owner: {} };
|
|
369
383
|
const { declarations, changes } = this;
|
|
370
384
|
return ctx.effect(function* () {
|
|
371
385
|
declarations.set(kind, entry);
|
package/locale/de.json
ADDED
package/locale/es.json
ADDED
package/locale/fr.json
ADDED
package/locale/ja.json
ADDED
package/locale/pt.json
ADDED
package/locale/ru.json
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-typert-registry",
|
|
3
3
|
"description": "Runtime registry for generated package reflection and Zod schemas",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2-alpha.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"zod": "4.4.3"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@deepseek-ai/cordis": "~4.0.
|
|
55
|
+
"@deepseek-ai/cordis": "~4.0.6-alpha.1"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@deepseek-ai/cordis": "~4.0.
|
|
59
|
-
"@deepseek-ai/dsh-typert-protocol": "0.2.
|
|
58
|
+
"@deepseek-ai/cordis": "~4.0.6-alpha.1",
|
|
59
|
+
"@deepseek-ai/dsh-typert-protocol": "0.2.2-alpha.2"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"bundle": "tsdown",
|