@kubun/plugin-rpc 0.13.1 → 0.13.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/lib/index.d.ts CHANGED
@@ -33,11 +33,35 @@ export type RPCPluginOptions = {
33
33
  */
34
34
  methods?: MethodRegistry;
35
35
  };
36
+ /**
37
+ * Parameters for a single `serve()` call.
38
+ */
39
+ export type RPCServerParams = {
40
+ /** The server-side transport this server reads and writes. */
41
+ transport: ServerTransport;
42
+ /** Aborts the server when signalled. */
43
+ signal?: AbortSignal;
44
+ /**
45
+ * Replaces the plugin-level `accessRules` for THIS server only, letting one
46
+ * host expose different procedure sets on different transports — e.g. a full
47
+ * admin transport plus a restricted agent channel that must not reach
48
+ * `graph/deploy` / `graph/list` / `graph/load`. `false` disables auth for
49
+ * this serve. Omit to keep the plugin default.
50
+ *
51
+ * Enkaku access checks are OR across every matching pattern (a procedure is
52
+ * admitted by the FIRST rule that allows it; a denying rule merely falls
53
+ * through), so a restricted rule set must ENUMERATE the procedures it grants
54
+ * rather than pairing a blanket `'*'` allow with per-procedure denials — a
55
+ * `'*'` allow re-admits everything. Omitting a procedure from the rules is
56
+ * what denies it (no matching allow rule).
57
+ */
58
+ accessRules?: false | AccessRules;
59
+ };
36
60
  /**
37
61
  * API provided by the RPC plugin.
38
62
  */
39
63
  export type RPCPluginAPI = {
40
- serve: (transport: ServerTransport, signal?: AbortSignal) => Server<GraphProtocol>;
64
+ serve: (params: RPCServerParams) => Server<GraphProtocol>;
41
65
  };
42
66
  /**
43
67
  * Creates the RPC plugin.
package/lib/index.js CHANGED
@@ -40,8 +40,12 @@ import { TransactionManager } from './transaction-manager.js';
40
40
  transactionManager
41
41
  });
42
42
  const api = {
43
- serve: (transport, signal)=>{
44
- const accessRules = options?.accessRules;
43
+ serve: (serverParams)=>{
44
+ const { transport, signal } = serverParams;
45
+ // A per-serve override replaces the plugin-level rules for this server
46
+ // only; omitting the key keeps the plugin default, while an explicit
47
+ // `false` disables auth for this serve.
48
+ const accessRules = 'accessRules' in serverParams ? serverParams.accessRules : options?.accessRules;
45
49
  const baseParams = {
46
50
  runtime: params.runtime,
47
51
  handlers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubun/plugin-rpc",
3
- "version": "0.13.1",
3
+ "version": "0.13.2",
4
4
  "license": "see LICENSE.md",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -20,23 +20,23 @@
20
20
  "@sozai/runtime": "^0.1.0",
21
21
  "graphql": "^16.14.2",
22
22
  "@kubun/db": "^0.13.0",
23
- "@kubun/mutation": "^0.13.0",
24
- "@kubun/engine": "^0.13.1",
25
- "@kubun/graphql": "^0.13.1",
26
23
  "@kubun/protocol": "^0.13.1",
27
- "@kubun/hlc": "^0.13.0"
24
+ "@kubun/graphql": "^0.13.1",
25
+ "@kubun/hlc": "^0.13.0",
26
+ "@kubun/engine": "^0.13.1",
27
+ "@kubun/mutation": "^0.13.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@enkaku/transport": "^0.21.0",
31
31
  "@kokuin/capability": "^0.3.0",
32
32
  "@kokuin/controller": "^0.1.0",
33
- "@kubun/id": "^0.13.0",
34
33
  "@kubun/store-controller": "^0.13.0",
35
- "@kubun/client": "^0.13.0",
36
- "@kubun/store-graph": "^0.13.2",
37
34
  "@kubun/store-delegation": "^0.13.0",
38
- "@kubun/store-p2p": "^0.13.0",
39
- "@kubun/test-utils": "^0.13.0"
35
+ "@kubun/test-utils": "^0.13.0",
36
+ "@kubun/id": "^0.13.0",
37
+ "@kubun/store-graph": "^0.13.2",
38
+ "@kubun/client": "^0.13.0",
39
+ "@kubun/store-p2p": "^0.13.0"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public"