@kubun/plugin-service-api 0.17.1 → 0.18.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.
Files changed (2) hide show
  1. package/lib/index.d.ts +28 -0
  2. package/package.json +4 -4
package/lib/index.d.ts CHANGED
@@ -75,6 +75,17 @@ export type ServiceProviderImpl = {
75
75
  name: string;
76
76
  handlers: Handlers;
77
77
  accessRules?: AccessRules;
78
+ /**
79
+ * Procedures whose calls stay open for as long as the caller wants them, such as
80
+ * subscriptions. The host does not expire them, and bounds how many each caller
81
+ * holds open instead (see {@link ServiceServerLimits}).
82
+ */
83
+ longLivedProcedures?: ReadonlyArray<string>;
84
+ /**
85
+ * The wire definition of this service's procedures. When every served service
86
+ * declares one, the host validates incoming messages against their union.
87
+ */
88
+ protocol?: ServiceProtocol;
78
89
  };
79
90
  /**
80
91
  * Per-service configuration, keyed by service NAME. Discriminated by explicit
@@ -90,9 +101,26 @@ export type ServiceProviderImpl = {
90
101
  export type ServiceConfig = boolean | {
91
102
  rules?: AccessRules;
92
103
  handlers?: Handlers;
104
+ longLivedProcedures?: ReadonlyArray<string>;
105
+ /** Wire definition of a custom service's procedures; see {@link ServiceProviderImpl.protocol}. */
106
+ protocol?: ServiceProtocol;
107
+ };
108
+ /** Per-serve limits on the calls a host `serve()` runs. Every field is optional. */
109
+ export type ServiceServerLimits = {
110
+ /**
111
+ * How long a call that is not long-lived may stay open before the server fails it
112
+ * with `EK05`. Enkaku's default (300 s) when omitted.
113
+ */
114
+ callTimeoutMs?: number;
115
+ /** Long-lived calls one caller may hold open on this serve. Defaults to 64. */
116
+ maxLongLivedCallsPerCaller?: number;
117
+ /** Long-lived calls all callers together may hold open on this serve. Defaults to 1000. */
118
+ maxLongLivedCalls?: number;
93
119
  };
94
120
  /** Parameters for a single host `serve()` call. */
95
121
  export type ServiceServerServeParams = {
122
+ /** Limits on this serve's calls. See {@link ServiceServerLimits}. */
123
+ limits?: ServiceServerLimits;
96
124
  /** Server-side transport this server reads and writes. */
97
125
  transport: ServiceServerTransport;
98
126
  /** Which services to serve, keyed by service name. See {@link ServiceConfig}. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubun/plugin-service-api",
3
- "version": "0.17.1",
3
+ "version": "0.18.0",
4
4
  "keywords": [],
5
5
  "license": "see LICENSE.md",
6
6
  "sideEffects": false,
@@ -15,9 +15,9 @@
15
15
  "LICENSE.md"
16
16
  ],
17
17
  "dependencies": {
18
- "@enkaku/protocol": "^0.21.1",
19
- "@enkaku/server": "^0.21.2",
20
- "@kokuin/token": "^0.5.0"
18
+ "@enkaku/protocol": "^0.21.5",
19
+ "@enkaku/server": "^0.21.5",
20
+ "@kokuin/token": "^0.5.1"
21
21
  },
22
22
  "publishConfig": {
23
23
  "access": "public"