@zhin.js/middleware 1.1.4 → 1.1.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.
@@ -51,7 +51,8 @@ type AuthoringForAdapter<TInput, TConfig, TAdapter extends string | undefined> =
51
51
  readonly target: 'outbound';
52
52
  handle(context: MiddlewareContext<TInput, TConfig, TAdapter>, next: OutboundMiddlewareNext): void | Promise<void>;
53
53
  });
54
- type MiddlewareAuthoringDefinition<TInput, TConfig> = AuthoringForAdapter<TInput, TConfig, undefined> | {
54
+ /** @internal Shape shared with the typed IM facade; not a separate authoring API. */
55
+ export type MiddlewareAuthoringDefinition<TInput, TConfig> = AuthoringForAdapter<TInput, TConfig, undefined> | {
55
56
  [TAdapter in RegisteredAdapterName]: AuthoringForAdapter<TInput, TConfig, TAdapter> & {
56
57
  readonly adapter: TAdapter;
57
58
  };
@@ -1,14 +1,16 @@
1
1
  import type { CapabilitySlot, PluginId, RuntimeSnapshot } from '@zhin.js/plugin-runtime';
2
2
  import type { MiddlewareDefinition, MiddlewarePhase, MiddlewareTarget, OutboundMiddlewareNext } from './definition.js';
3
- /** Transmission-neutral result policy supplied by the composition layer. */
3
+ /** @internal Transmission-neutral result policy supplied by the composition layer. */
4
4
  export interface MiddlewareResultPolicy<TResult> {
5
5
  stop(owner: PluginId): TResult;
6
6
  replace(owner: PluginId, value: unknown, downstream: TResult | undefined): TResult;
7
7
  }
8
+ /** @internal Runtime continuation result. */
8
9
  export interface MiddlewareRunResult {
9
10
  readonly owner?: PluginId;
10
11
  readonly value?: unknown;
11
12
  }
13
+ /** @internal Runtime inventory projection. */
12
14
  export interface MiddlewareDescriptor {
13
15
  readonly owner: PluginId;
14
16
  readonly name: string;
@@ -18,6 +20,7 @@ export interface MiddlewareDescriptor {
18
20
  readonly order: number;
19
21
  readonly adapter?: string;
20
22
  }
23
+ /** @internal Runtime middleware executor. */
21
24
  export declare class MiddlewareIndex {
22
25
  #private;
23
26
  private readonly snapshot;
@@ -30,4 +33,5 @@ export declare class MiddlewareIndex {
30
33
  /** Unwinds one inbound operation before its caller performs any automatic reply. */
31
34
  runInbound<TInput, TResult>(input: TInput, terminal: () => Promise<TResult>, results: MiddlewareResultPolicy<TResult>, operationSnapshot?: RuntimeSnapshot): Promise<TResult>;
32
35
  }
36
+ /** @internal Runtime projection guard. */
33
37
  export declare function isMiddlewareIndex(value: unknown): value is MiddlewareIndex;
@@ -1,5 +1,6 @@
1
1
  import { createCapabilityContext, bindOperationInput, operationClientAdapter, readOperationClient, } from '@zhin.js/feature-kit';
2
2
  import { continuationBrand } from './continuation.js';
3
+ /** @internal Runtime middleware executor. */
3
4
  export class MiddlewareIndex {
4
5
  snapshot;
5
6
  $projection = 'zhin.middleware-index/1';
@@ -124,6 +125,7 @@ export class MiddlewareIndex {
124
125
  return dispatch(0);
125
126
  }
126
127
  }
128
+ /** @internal Runtime projection guard. */
127
129
  export function isMiddlewareIndex(value) {
128
130
  return !!value && typeof value === 'object'
129
131
  && value.$projection === 'zhin.middleware-index/1';
package/lib/provider.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { MiddlewareIndex } from './middleware-index.js';
2
+ /** @internal Runtime Feature identity. */
2
3
  export declare const middlewareFeatureId: import("@zhin.js/plugin-runtime").FeatureId;
4
+ /** @internal Runtime Feature provider. */
3
5
  declare const middlewareFeature: Readonly<import("@zhin.js/feature-kit").FeatureProvider<import("./definition.js").MiddlewareDefinition<unknown, unknown, string | undefined>, MiddlewareIndex>>;
4
6
  export { middlewareFeature };
5
7
  export default middlewareFeature;
package/lib/provider.js CHANGED
@@ -2,7 +2,9 @@ import { featureId } from '@zhin.js/plugin-runtime';
2
2
  import { capture, captured, defineFeatureProvider, directoryModules } from '@zhin.js/feature-kit';
3
3
  import { parseMiddlewareDefinition } from './definition.js';
4
4
  import { MiddlewareIndex } from './middleware-index.js';
5
+ /** @internal Runtime Feature identity. */
5
6
  export const middlewareFeatureId = featureId('zhin.middleware');
7
+ /** @internal Runtime Feature provider. */
6
8
  const middlewareFeature = defineFeatureProvider({
7
9
  protocol: 1,
8
10
  id: middlewareFeatureId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/middleware",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Convention-based Middleware Feature for Zhin Plugin Runtime",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -8,7 +8,6 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./lib/index.d.ts",
11
- "development": "./src/index.ts",
12
11
  "import": "./lib/index.js"
13
12
  }
14
13
  },
@@ -17,8 +16,8 @@
17
16
  "src"
18
17
  ],
19
18
  "dependencies": {
20
- "@zhin.js/feature-kit": "1.1.3",
21
- "@zhin.js/plugin-runtime": "1.1.12"
19
+ "@zhin.js/feature-kit": "1.1.5",
20
+ "@zhin.js/plugin-runtime": "1.1.14"
22
21
  },
23
22
  "devDependencies": {
24
23
  "@types/node": "^26.1.2",
@@ -32,7 +31,7 @@
32
31
  "featureApi": "1.0.0"
33
32
  },
34
33
  "engines": {
35
- "node": "^20.19.0 || >=22.12.0"
34
+ "node": ">=22.19.0"
36
35
  },
37
36
  "repository": {
38
37
  "type": "git",
package/src/definition.ts CHANGED
@@ -72,7 +72,8 @@ type AuthoringForAdapter<TInput, TConfig, TAdapter extends string | undefined> =
72
72
  | { readonly target: 'outbound'; handle(context: MiddlewareContext<TInput, TConfig, TAdapter>, next: OutboundMiddlewareNext): void | Promise<void> }
73
73
  );
74
74
 
75
- type MiddlewareAuthoringDefinition<TInput, TConfig> =
75
+ /** @internal Shape shared with the typed IM facade; not a separate authoring API. */
76
+ export type MiddlewareAuthoringDefinition<TInput, TConfig> =
76
77
  | AuthoringForAdapter<TInput, TConfig, undefined>
77
78
  | {
78
79
  [TAdapter in RegisteredAdapterName]: AuthoringForAdapter<TInput, TConfig, TAdapter> & {
@@ -14,17 +14,19 @@ import type {
14
14
  } from './definition.js';
15
15
  import { continuationBrand, type MiddlewareContinuation } from './continuation.js';
16
16
 
17
- /** Transmission-neutral result policy supplied by the composition layer. */
17
+ /** @internal Transmission-neutral result policy supplied by the composition layer. */
18
18
  export interface MiddlewareResultPolicy<TResult> {
19
19
  stop(owner: PluginId): TResult;
20
20
  replace(owner: PluginId, value: unknown, downstream: TResult | undefined): TResult;
21
21
  }
22
22
 
23
+ /** @internal Runtime continuation result. */
23
24
  export interface MiddlewareRunResult {
24
25
  readonly owner?: PluginId;
25
26
  readonly value?: unknown;
26
27
  }
27
28
 
29
+ /** @internal Runtime inventory projection. */
28
30
  export interface MiddlewareDescriptor {
29
31
  readonly owner: PluginId;
30
32
  readonly name: string;
@@ -39,6 +41,7 @@ interface MiddlewareRecord extends MiddlewareDescriptor {
39
41
  readonly slot: Readonly<CapabilitySlot<MiddlewareDefinition>>;
40
42
  }
41
43
 
44
+ /** @internal Runtime middleware executor. */
42
45
  export class MiddlewareIndex {
43
46
  readonly $projection = 'zhin.middleware-index/1' as const;
44
47
  readonly #records: readonly MiddlewareRecord[];
@@ -170,6 +173,7 @@ export class MiddlewareIndex {
170
173
  }
171
174
  }
172
175
 
176
+ /** @internal Runtime projection guard. */
173
177
  export function isMiddlewareIndex(value: unknown): value is MiddlewareIndex {
174
178
  return !!value && typeof value === 'object'
175
179
  && (value as { readonly $projection?: unknown }).$projection === 'zhin.middleware-index/1';
package/src/provider.ts CHANGED
@@ -3,8 +3,10 @@ import { capture, captured, defineFeatureProvider, directoryModules } from '@zhi
3
3
  import { parseMiddlewareDefinition } from './definition.js';
4
4
  import { MiddlewareIndex } from './middleware-index.js';
5
5
 
6
+ /** @internal Runtime Feature identity. */
6
7
  export const middlewareFeatureId = featureId('zhin.middleware');
7
8
 
9
+ /** @internal Runtime Feature provider. */
8
10
  const middlewareFeature = defineFeatureProvider({
9
11
  protocol: 1,
10
12
  id: middlewareFeatureId,