@x1a0f3n9/dsh-typert-protocol 0.1.2-alpha.6 → 0.1.5-rc.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 CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write packages/typert/protocol/README.md
5
- README.md: 7f7c817073c7c5ca3bb3746fe681f8fd426a3167
6
- README.zh.md: 462e20b80967a8e7546a9cab71e6d1eebe4cc807
5
+ README.md: 43147c2c2f1746ff0c806c0842b5dba65457775a
6
+ README.zh.md: c88432ff3587cba1a3222a3a4d75cd8fe0e2d514
package/README.md CHANGED
@@ -46,7 +46,7 @@ Generation turns the method into a wire endpoint under the service's namespace;
46
46
 
47
47
  ### Associating Host objects and Contexts with wire identities
48
48
 
49
- Complex Host objects cannot cross the wire directly. A business package declares the association through the merge-extensible `TypertLookupMap` and `TypertContextMap`. Host and Client Context adapters both map `Context` to a wire identity and that identity back to `Context`; the Host adapter also owns the stable wire declaration. Host composition may override its synchronous or asynchronous resolver. A resolver that refuses on policy grounds throws `RemoteError` with its own code, which reaches the caller unchanged.
49
+ Complex Host objects cannot cross the wire directly. A business package declares the association through the merge-extensible `TypertLookupMap` and `TypertContextMap`. A Host Context adapter owns the stable wire declaration and resolves wire identities to live Contexts. A Client Context adapter maps in both directions because scoped calls originate from a Client Context and forwarded Host events resolve their explicit wire identity there. Host composition may override its synchronous or asynchronous resolver. A resolver that refuses on policy grounds throws `RemoteError` with its own code, which reaches the caller unchanged.
50
50
 
51
51
  ### Reporting and reading a Remote failure
52
52
 
package/README.zh.md CHANGED
@@ -46,7 +46,7 @@ export class GoalService extends TypertRemoteService {
46
46
 
47
47
  ### 把 Host 对象与 Context 关联到 wire identity
48
48
 
49
- 复杂的 Host 对象不能直接跨 wire 传输。业务包通过可合并扩展的 `TypertLookupMap` 与 `TypertContextMap` 声明关联。Host 与 Client Context adapter 都把 `Context` 映射为 wire identity,也把该 identity 映射回 `Context`;Host adapter 还拥有稳定 wire 声明。Host 组合可以覆盖其同步或异步 resolver。因策略而拒绝的 resolver 抛出带自有码的 `RemoteError`,该码原样到达调用方。
49
+ 复杂的 Host 对象不能直接跨 wire 传输。业务包通过可合并扩展的 `TypertLookupMap` 与 `TypertContextMap` 声明关联。Host Context 适配器拥有稳定 wire 声明,并把 wire identity 解析为活跃 Context。Client Context 适配器需要双向映射,因为作用域调用从 Client Context 发起,而转发的 Host 事件要在 Client 侧解析其显式 wire identity。Host 组合可以覆盖其同步或异步解析器。因策略原因拒绝解析的解析器会抛出带有自身错误码的 `RemoteError`,该码原样到达调用方。
50
50
 
51
51
  ### 报告与读取 Remote 失败
52
52
 
@@ -65,7 +65,7 @@ throw new RemoteError('goal/not-found', `goal "${id}" does not exist`, { goalId:
65
65
 
66
66
  ### 在 Client 侧接收转发的 Host 事件
67
67
 
68
- Host 装配以转发给消费端的 Cordis 事件扩展 `TypertRemoteEventSelection`,从而收窄 `ctx.remote.$on` 的键集。`TypertForwardableEvent` 接受无作用域且返回 `void` 的通知,以及最后一个 `next()` 回调返回事件结果类型的异步作用域 waterfall。`TypertClientEventListener` 从同一条 `Events` 成员派生 Client listener,并保留 signal、可选和只读字段、数组、回调与结果类型。`TypertClientRemote` 只公开 `$mount()` 与 `$on()`;事件传输仍由 Gateway 私有持有。
68
+ Host 装配以转发给消费方的 Cordis 事件扩展 `TypertRemoteEventSelection`,从而收窄 `ctx.remote.$on` 的键集。`TypertForwardableEvent` 接受无作用域且返回 `void` 的通知,以及最后一个 `next()` 回调返回事件结果类型的异步作用域 waterfall(瀑布式事件)。`TypertClientEventListener` 从同一条 `Events` 成员派生 Client listener,并保留 signal、可选和只读字段、数组、回调与结果类型。`TypertClientRemote` 只公开 `$mount()` 与 `$on()`;事件传输仍由 Gateway 私有持有。
69
69
 
70
70
  -----
71
71
 
@@ -83,7 +83,7 @@ Host 装配以转发给消费端的 Cordis 事件扩展 `TypertRemoteEventSelect
83
83
 
84
84
  ### Remote 标记
85
85
 
86
- `@Remote` 与 `@RemoteScope` 调度一个初始化器,把方法名、可选导出名与调用模式追加到原型描述符;`remoteMethods(service)` 校验其版本,并返回与已存描述符分离、按声明顺序排列的快照,供 Gateway 的源码模式回退读取。标记要求公开、非静态、具名字符串的实例方法,同一方法上的冲突标记会被拒绝。
86
+ `@Remote` 与 `@RemoteScope` 调度一个初始化器,把方法名、可选导出名与调用模式追加到原型描述符;`remoteMethods(service)` 校验其版本,并返回与已存描述符分离、按声明顺序排列的快照,供 Gateway 的源码模式回退读取。标记要求名称为字符串的公开、非静态实例方法,同一方法上的冲突标记会被拒绝。
87
87
 
88
88
  ### 协议映射与描述符
89
89
 
@@ -13,7 +13,7 @@ export { RemoteError, remoteErrorOf } from './remote-error.ts';
13
13
  * @returns whether the value can cross the shared RPC carrier unchanged.
14
14
  */
15
15
  export declare function isTypertRemoteSegment(value: string): boolean;
16
- export type { InvocationDescriptor, InvocationParameterDescriptor, InvocationSourceLocation, RemoteErrorCode, RemoteErrorDetailsMap, RemoteFailure, RemoteResult, TypertClientEventListener, TypertClientRemote, TypertClientContextAdapter, TypertCodec, TypertContext, TypertContextAdapter, TypertContextMap, TypertContextRegistry, TypertContextWire, TypertDisposer, TypertForwardableEvent, TypertForwardableEventEntry, TypertHostContextAdapter, TypertHostContextIdentity, TypertHostContextResolver, TypertLocalRegistry, TypertLookup, TypertLookupDefinition, TypertLookupHost, TypertLookupMap, TypertLookupProvider, TypertLookupResolver, TypertLookupRegistry, TypertLookupWire, TypertRemoteScopeApi, TypertRemoteScopeMap, TypertRemoteScopeNamespace, TypertRemoteContribution, TypertRemoteEvent, TypertRemoteEventSelection, TypertRemoteMap, TypertRemoteNamespace, TypertRemoteNamespaceMap, TypertRemoteRegistry, TypertRegistryChange, TypertRegistryListener, TypertSchema, TypertRegistryContract, } from './types.ts';
16
+ export type { InvocationDescriptor, InvocationParameterDescriptor, InvocationSourceLocation, RemoteErrorCode, RemoteErrorDetailsMap, RemoteFailure, RemoteResult, TypertClientEventListener, TypertClientRemote, TypertClientContextAdapter, TypertCodec, TypertContext, TypertContextMap, TypertContextRegistry, TypertContextWire, TypertDisposer, TypertForwardableEvent, TypertForwardableEventEntry, TypertHostContextAdapter, TypertHostContextResolver, TypertLocalRegistry, TypertLookup, TypertLookupDefinition, TypertLookupHost, TypertLookupMap, TypertLookupProvider, TypertLookupResolver, TypertLookupRegistry, TypertLookupWire, TypertRemoteScopeApi, TypertRemoteScopeMap, TypertRemoteScopeNamespace, TypertRemoteContribution, TypertRemoteEvent, TypertRemoteEventSelection, TypertRemoteMap, TypertRemoteNamespace, TypertRemoteNamespaceMap, TypertRemoteRegistry, TypertRegistryChange, TypertRegistryListener, TypertSchema, TypertRegistryContract, } from './types.ts';
17
17
  /** Options for an explicit Service-to-Gateway binding. */
18
18
  export interface TypertGatewayBindingOptions {
19
19
  /** Wire namespace; defaults to the Cordis service key. */
@@ -281,29 +281,19 @@ export interface TypertLookupDefinition {
281
281
  /** Canonical wire type symbol used by strict generation. */
282
282
  readonly wireTypeSymbol: string;
283
283
  }
284
- /** Bidirectional projection between one environment's Context and its wire identity. */
285
- export interface TypertContextAdapter<Wire = unknown> {
286
- /**
287
- * Read the identity represented by a live Context.
288
- * @param ctx - Context in this adapter's environment.
289
- * @returns the wire identity, or `undefined` when the Context has another kind.
290
- */
291
- identity(ctx: Context): Wire | undefined;
284
+ /** Host wire-to-Context resolver plus the declaration used by strict Remote methods. */
285
+ export interface TypertHostContextAdapter<Wire = unknown> {
286
+ /** Wire field carrying the Context identity. */
287
+ readonly wire: string;
288
+ /** Canonical wire type symbol used by strict generation. */
289
+ readonly wireTypeSymbol: string;
292
290
  /**
293
- * Resolve a wire identity to a live Context in this adapter's environment.
294
- * An asynchronous Client resolver may wait for its owner to create the Context.
291
+ * Resolve a validated wire identity to a live Host Context.
295
292
  * @param id - validated wire identity.
296
293
  * @returns the Context, or `undefined` when it is unavailable.
297
294
  */
298
295
  resolve(id: Wire): Context | undefined | Promise<Context | undefined>;
299
296
  }
300
- /** Host Context adapter plus the wire declaration used by strict Remote methods. */
301
- export interface TypertHostContextAdapter<Wire = unknown> extends TypertContextAdapter<Wire> {
302
- /** Wire field carrying the Context identity. */
303
- readonly wire: string;
304
- /** Canonical wire type symbol used by strict generation. */
305
- readonly wireTypeSymbol: string;
306
- }
307
297
  /** Composition-owned resolver replacing one Host Context adapter's default lookup policy. */
308
298
  export type TypertHostContextResolver<Wire = unknown> = (id: Wire) => Context | undefined | Promise<Context | undefined>;
309
299
  /** Client-side bidirectional Context adapter. */
@@ -321,13 +311,6 @@ export interface TypertClientContextAdapter<Wire = unknown> {
321
311
  */
322
312
  resolve(id: Wire): Context | undefined;
323
313
  }
324
- /** Host Context identity selected from the registered adapter set. */
325
- export interface TypertHostContextIdentity {
326
- /** Merge-declared Context kind whose adapter recognized the Context. */
327
- readonly kind: string;
328
- /** Wire identity returned by that adapter. */
329
- readonly identity: unknown;
330
- }
331
314
  /** Notification emitted after a Typert runtime registry changes. */
332
315
  export interface TypertRegistryChange {
333
316
  readonly kind: 'local' | 'remote' | 'lookup' | 'host-context' | 'client-context';
@@ -420,7 +403,7 @@ export interface TypertContextRegistry {
420
403
  /**
421
404
  * Register a Host Context adapter.
422
405
  * @param key - merge-declared Context key.
423
- * @param adapter - owning package's bidirectional Host projection.
406
+ * @param adapter - owning package's Host resolver and wire declaration.
424
407
  * @returns disposer withdrawing the exact adapter.
425
408
  */
426
409
  registerHost<K extends StringKeyOf<TypertContextMap>>(key: K, adapter: TypertHostContextAdapter<TypertContextWire<TypertContextMap[K]>>): TypertDisposer;
@@ -439,13 +422,6 @@ export interface TypertContextRegistry {
439
422
  * @returns disposer withdrawing the exact adapter.
440
423
  */
441
424
  registerClient<K extends StringKeyOf<TypertContextMap>>(key: K, adapter: TypertClientContextAdapter<TypertContextWire<TypertContextMap[K]>>): TypertDisposer;
442
- /**
443
- * Identify a live Host Context through the sole registered adapter set.
444
- * @param ctx - Context projected by a Host-to-Client scoped event.
445
- * @returns its kind and wire identity, or `undefined` when no adapter recognizes it.
446
- * @throws when more than one Context kind recognizes the same Context.
447
- */
448
- identifyHost(ctx: Context): TypertHostContextIdentity | undefined;
449
425
  /**
450
426
  * Look up a Host Context adapter.
451
427
  * @param key - descriptor Context key.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@x1a0f3n9/dsh-typert-protocol",
3
3
  "description": "Compiler-independent Remote metadata and Typert provider protocols",
4
- "version": "0.1.2-alpha.6",
4
+ "version": "0.1.5-rc.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },