@kubun/plugin-service-api 0.16.0 → 0.17.1
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/lib/index.d.ts +13 -0
- package/package.json +3 -3
package/lib/index.d.ts
CHANGED
|
@@ -49,6 +49,13 @@ export type ServiceHandlerContext = {
|
|
|
49
49
|
* comes from the handler. With no `subject`, the caller acts only for itself.
|
|
50
50
|
*/
|
|
51
51
|
authorize: (subject?: string) => Promise<boolean>;
|
|
52
|
+
/**
|
|
53
|
+
* Server-derived group ID for this serve, when the transport is bound to a
|
|
54
|
+
* group tunnel. Injected per-serve as a constant (never read from the wire
|
|
55
|
+
* message/param), so a handler cannot spoof it. `undefined` outside a group
|
|
56
|
+
* context.
|
|
57
|
+
*/
|
|
58
|
+
groupID?: string;
|
|
52
59
|
};
|
|
53
60
|
/** A single namespaced procedure handler, e.g. the impl behind `echo/ping`. */
|
|
54
61
|
export type ServiceHandler = (context: ServiceHandlerContext) => unknown | Promise<unknown>;
|
|
@@ -106,4 +113,10 @@ export type ServiceServerServeParams = {
|
|
|
106
113
|
cache?: DIDCache;
|
|
107
114
|
/** Aborts the server when signalled. */
|
|
108
115
|
signal?: AbortSignal;
|
|
116
|
+
/**
|
|
117
|
+
* Server-derived group ID for this serve, plumbed into each served handler's
|
|
118
|
+
* context as {@link ServiceHandlerContext.groupID}. Set when the transport is
|
|
119
|
+
* bound to a group tunnel; omitted outside a group context.
|
|
120
|
+
*/
|
|
121
|
+
groupID?: string;
|
|
109
122
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubun/plugin-service-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"license": "see LICENSE.md",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "pnpm run build:clean && pnpm run build:js && pnpm run build:types",
|
|
27
27
|
"build:clean": "del lib",
|
|
28
|
-
"build:js": "swc src -d ./lib --config-file ../../node_modules/@kigu/dev/swc.json --strip-leading-paths",
|
|
29
|
-
"build:types": "tsc --emitDeclarationOnly --skipLibCheck",
|
|
28
|
+
"build:js": "del 'lib/**/*.js' && swc src -d ./lib --config-file ../../node_modules/@kigu/dev/swc.json --strip-leading-paths",
|
|
29
|
+
"build:types": "del 'lib/**/*.d.ts' 'lib/**/*.d.ts.map' && tsc --emitDeclarationOnly --skipLibCheck",
|
|
30
30
|
"build:types:ci": "tsc --emitDeclarationOnly --declarationMap false",
|
|
31
31
|
"test": "pnpm run test:types",
|
|
32
32
|
"test:types": "tsc --noEmit --skipLibCheck"
|