@kubun/plugin-rpc 0.13.0 → 0.13.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/handlers.js CHANGED
@@ -55,7 +55,8 @@ export function createGraphHandlers(params) {
55
55
  clusters: ctx.param.clusters,
56
56
  id: ctx.param.id,
57
57
  name: ctx.param.name,
58
- plugins: ctx.param.plugins
58
+ plugins: ctx.param.plugins,
59
+ search: ctx.param.search
59
60
  });
60
61
  },
61
62
  'graph/list': async ()=>{
package/lib/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { ServerTransportOf } from '@enkaku/protocol';
2
2
  import { type AccessRules, type Server } from '@enkaku/server';
3
+ import { type DIDResolver, type MethodRegistry } from '@kokuin/token';
3
4
  import type { KubunPlugin, PluginFactoryParams } from '@kubun/engine';
4
5
  import type { GraphProtocol } from '@kubun/protocol';
5
6
  import { type TransactionManagerOptions } from './transaction-manager.js';
@@ -18,6 +19,19 @@ export type RPCPluginOptions = {
18
19
  allowDelegatedMutations?: boolean;
19
20
  /** Configuration for the transaction manager. */
20
21
  transactionConfig?: TransactionManagerOptions;
22
+ /**
23
+ * DID resolver forwarded to Enkaku's transport-level message-signature
24
+ * verification. Rarely needed — supply one only to resolve a DID method the
25
+ * default `methods` registry does not cover.
26
+ */
27
+ resolver?: DIDResolver;
28
+ /**
29
+ * Method registry forwarded to Enkaku's transport-level message-signature
30
+ * verification. Defaults to the engine's own `did:kokuin:` controller
31
+ * resolver so a `did:kokuin:`-signed message over an authenticated socket
32
+ * verifies out of the box; pass a registry here to override that default.
33
+ */
34
+ methods?: MethodRegistry;
21
35
  };
22
36
  /**
23
37
  * API provided by the RPC plugin.
package/lib/index.js CHANGED
@@ -16,6 +16,15 @@ import { TransactionManager } from './transaction-manager.js';
16
16
  return (params)=>{
17
17
  const servers = [];
18
18
  const signer = isSigningIdentity(params.identity) ? params.identity : null;
19
+ // Transport-level message-signature verification (Enkaku's `verifyToken`)
20
+ // runs per message, before any handler opens a write transaction — the same
21
+ // pre-transaction position as the engine's own `#controllerResolver`. So a
22
+ // `did:kokuin:` resolver over the base db is correct and deadlock-free here:
23
+ // it reads the controller store on the main connection while no write tx is
24
+ // held. A host may override the default via `options.methods`.
25
+ const methods = options?.methods ?? [
26
+ params.controllerResolverFor(params.db)
27
+ ];
19
28
  const transactionManager = new TransactionManager({
20
29
  runtime: params.runtime,
21
30
  ...options?.transactionConfig
@@ -38,7 +47,9 @@ import { TransactionManager } from './transaction-manager.js';
38
47
  handlers,
39
48
  logger: params.getLogger('rpc-server'),
40
49
  signal,
41
- transport
50
+ transport,
51
+ resolver: options?.resolver,
52
+ methods
42
53
  };
43
54
  const serveParams = accessRules === false ? {
44
55
  ...baseParams,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubun/plugin-rpc",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "license": "see LICENSE.md",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -20,20 +20,22 @@
20
20
  "@sozai/runtime": "^0.1.0",
21
21
  "graphql": "^16.14.2",
22
22
  "@kubun/db": "^0.13.0",
23
- "@kubun/engine": "^0.13.0",
24
23
  "@kubun/mutation": "^0.13.0",
25
- "@kubun/protocol": "^0.13.0",
26
- "@kubun/hlc": "^0.13.0",
27
- "@kubun/graphql": "^0.13.0"
24
+ "@kubun/engine": "^0.13.1",
25
+ "@kubun/graphql": "^0.13.1",
26
+ "@kubun/protocol": "^0.13.1",
27
+ "@kubun/hlc": "^0.13.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@enkaku/transport": "^0.21.0",
31
31
  "@kokuin/capability": "^0.3.0",
32
+ "@kokuin/controller": "^0.1.0",
33
+ "@kubun/id": "^0.13.0",
34
+ "@kubun/store-controller": "^0.13.0",
32
35
  "@kubun/client": "^0.13.0",
36
+ "@kubun/store-graph": "^0.13.2",
33
37
  "@kubun/store-delegation": "^0.13.0",
34
- "@kubun/id": "^0.13.0",
35
38
  "@kubun/store-p2p": "^0.13.0",
36
- "@kubun/store-graph": "^0.13.0",
37
39
  "@kubun/test-utils": "^0.13.0"
38
40
  },
39
41
  "publishConfig": {