@cero-base/cero 0.4.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.
@@ -0,0 +1,102 @@
1
+ /**
2
+ * @typedef {object} CeroOpts
3
+ * @property {Identity} [identity] Pre-resolved identity. If absent, derived from `seed`/`phrase` or generated.
4
+ * @property {Uint8Array} [seed] 16- or 32-byte seed entropy.
5
+ * @property {string} [phrase] BIP-39 mnemonic — alternative to `seed`.
6
+ * @property {12 | 24} [words] Mnemonic length when generating a fresh identity.
7
+ * @property {string | null} [name] Friendly device name persisted on the identity claim.
8
+ * @property {boolean} [isMobile] Marks this device as mobile.
9
+ * @property {Array<{ host: string, port: number }>} [bootstrap] Custom DHT bootstrap nodes.
10
+ * @property {Uint8Array} [key] Pre-existing database key (skip bootstrap).
11
+ * @property {Uint8Array} [encryptionKey] Pre-existing encryption key.
12
+ * @property {Record<string, Function>} [routes] Custom RPC routes for the database dispatcher.
13
+ * @property {(err: any) => void} [onerror] Background-task error handler.
14
+ * @property {boolean} [recovery] Recovery flow — wipe local state and re-claim a writer slot.
15
+ * @property {number} [recoveryTimeout] Max wait for writer capability during recovery.
16
+ */
17
+ /**
18
+ * Open (or create) a cero handle at `dir`. Sets up storage, network and
19
+ * identity, then returns a ready root `Handle` with all schema refs
20
+ * attached as properties.
21
+ *
22
+ * @param {string} dir Data directory.
23
+ * @param {any} spec Built spec — output of `cero/build`.
24
+ * @param {CeroOpts} [opts]
25
+ * @returns {Promise<Handle>}
26
+ */
27
+ export function cero(dir: string, spec: any, opts?: CeroOpts): Promise<Handle>;
28
+ /**
29
+ * Restore a cero instance from a mnemonic phrase. Closes the running
30
+ * instance, wipes the on-disk `main/` tree and re-opens with `recovery: true`
31
+ * so the writer slot is re-claimed.
32
+ *
33
+ * @param {Handle} me Existing root handle to restore.
34
+ * @param {string} phrase BIP-39 mnemonic phrase.
35
+ * @returns {Promise<Handle>} Freshly restored root handle.
36
+ */
37
+ export function restore(me: Handle, phrase: string): Promise<Handle>;
38
+ export { peek } from "./lib/peek.js";
39
+ export type CeroOpts = {
40
+ /**
41
+ * Pre-resolved identity. If absent, derived from `seed`/`phrase` or generated.
42
+ */
43
+ identity?: Identity;
44
+ /**
45
+ * 16- or 32-byte seed entropy.
46
+ */
47
+ seed?: Uint8Array;
48
+ /**
49
+ * BIP-39 mnemonic — alternative to `seed`.
50
+ */
51
+ phrase?: string;
52
+ /**
53
+ * Mnemonic length when generating a fresh identity.
54
+ */
55
+ words?: 12 | 24;
56
+ /**
57
+ * Friendly device name persisted on the identity claim.
58
+ */
59
+ name?: string | null;
60
+ /**
61
+ * Marks this device as mobile.
62
+ */
63
+ isMobile?: boolean;
64
+ /**
65
+ * Custom DHT bootstrap nodes.
66
+ */
67
+ bootstrap?: Array<{
68
+ host: string;
69
+ port: number;
70
+ }>;
71
+ /**
72
+ * Pre-existing database key (skip bootstrap).
73
+ */
74
+ key?: Uint8Array;
75
+ /**
76
+ * Pre-existing encryption key.
77
+ */
78
+ encryptionKey?: Uint8Array;
79
+ /**
80
+ * Custom RPC routes for the database dispatcher.
81
+ */
82
+ routes?: Record<string, Function>;
83
+ /**
84
+ * Background-task error handler.
85
+ */
86
+ onerror?: (err: any) => void;
87
+ /**
88
+ * Recovery flow — wipe local state and re-claim a writer slot.
89
+ */
90
+ recovery?: boolean;
91
+ /**
92
+ * Max wait for writer capability during recovery.
93
+ */
94
+ recoveryTimeout?: number;
95
+ };
96
+ import { Handle } from './handle/index.js';
97
+ import { Ref } from './handle/index.js';
98
+ import { Local } from './local/index.js';
99
+ import { Identity } from '@cero-base/core/identity';
100
+ export { Handle, Ref, Local };
101
+ export { put, set, get, del, count, watch, call, open } from "./lib/operators.js";
102
+ export { t, schema } from "./lib/spec.js";
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Map a schema-DSL primitive name to its HyperDB type name.
3
+ *
4
+ * @param {string} prim
5
+ * @returns {string}
6
+ */
7
+ export function hyperdbType(prim: string): string;
8
+ /**
9
+ * Type descriptors registered into every main schema.
10
+ *
11
+ * @returns {TypeDesc[]}
12
+ */
13
+ export function builtinTypes(): TypeDesc[];
14
+ /**
15
+ * Collection descriptors for every main schema, namespaced under `ns`.
16
+ *
17
+ * @param {string} ns
18
+ * @returns {CollectionDesc[]}
19
+ */
20
+ export function builtinCollections(ns: string): CollectionDesc[];
21
+ /**
22
+ * Dispatch (mutation) descriptors for every main schema, namespaced under `ns`.
23
+ *
24
+ * @param {string} ns
25
+ * @returns {DispatchDesc[]}
26
+ */
27
+ export function builtinDispatches(ns: string): DispatchDesc[];
28
+ /**
29
+ * Type descriptors registered into every local schema.
30
+ *
31
+ * @returns {TypeDesc[]}
32
+ */
33
+ export function localBuiltinTypes(): TypeDesc[];
34
+ /**
35
+ * Collection descriptors for every local schema, namespaced under `ns`.
36
+ *
37
+ * @param {string} ns
38
+ * @returns {CollectionDesc[]}
39
+ */
40
+ export function localBuiltinCollections(ns: string): CollectionDesc[];
41
+ /**
42
+ * Request/response type descriptors for the RPC facade.
43
+ *
44
+ * @returns {TypeDesc[]}
45
+ */
46
+ export function rpcTypes(): TypeDesc[];
47
+ /**
48
+ * RPC command (verb) descriptors for the cero server, namespaced under `ns`.
49
+ *
50
+ * @param {string} ns
51
+ * @returns {CommandDesc[]}
52
+ */
53
+ export function rpcCommands(ns: string): CommandDesc[];
54
+ /**
55
+ * Builtin type/collection/dispatch/rpc definitions used by the builder.
56
+ * Every cero schema includes these; user-defined refs are added on top.
57
+ *
58
+ * @typedef {{ name: string, type: string, verb?: string, kind?: string }} BuiltinRef
59
+ * @typedef {{ name: string, type: string, required: boolean }} FieldDesc
60
+ * @typedef {{ name: string, compact: boolean, fields: FieldDesc[] }} TypeDesc
61
+ * @typedef {{ name: string, schema: string, key: string[] }} CollectionDesc
62
+ * @typedef {{ name: string, requestType: string }} DispatchDesc
63
+ * @typedef {{
64
+ * name: string,
65
+ * request: { name: string },
66
+ * response: { name: string, stream?: boolean }
67
+ * }} CommandDesc
68
+ */
69
+ /**
70
+ * Refs that exist on every main (Handle) schema.
71
+ *
72
+ * @type {BuiltinRef[]}
73
+ */
74
+ export const BUILTINS: BuiltinRef[];
75
+ /**
76
+ * Refs that exist on every local schema.
77
+ *
78
+ * @type {BuiltinRef[]}
79
+ */
80
+ export const LOCAL_BUILTINS: BuiltinRef[];
81
+ /** Collection name for the internal counters table. */
82
+ export const COUNTERS: "counters";
83
+ /**
84
+ * Builtin type/collection/dispatch/rpc definitions used by the builder.
85
+ * Every cero schema includes these; user-defined refs are added on top.
86
+ */
87
+ export type BuiltinRef = {
88
+ name: string;
89
+ type: string;
90
+ verb?: string;
91
+ kind?: string;
92
+ };
93
+ /**
94
+ * Builtin type/collection/dispatch/rpc definitions used by the builder.
95
+ * Every cero schema includes these; user-defined refs are added on top.
96
+ */
97
+ export type FieldDesc = {
98
+ name: string;
99
+ type: string;
100
+ required: boolean;
101
+ };
102
+ /**
103
+ * Builtin type/collection/dispatch/rpc definitions used by the builder.
104
+ * Every cero schema includes these; user-defined refs are added on top.
105
+ */
106
+ export type TypeDesc = {
107
+ name: string;
108
+ compact: boolean;
109
+ fields: FieldDesc[];
110
+ };
111
+ /**
112
+ * Builtin type/collection/dispatch/rpc definitions used by the builder.
113
+ * Every cero schema includes these; user-defined refs are added on top.
114
+ */
115
+ export type CollectionDesc = {
116
+ name: string;
117
+ schema: string;
118
+ key: string[];
119
+ };
120
+ /**
121
+ * Builtin type/collection/dispatch/rpc definitions used by the builder.
122
+ * Every cero schema includes these; user-defined refs are added on top.
123
+ */
124
+ export type DispatchDesc = {
125
+ name: string;
126
+ requestType: string;
127
+ };
128
+ /**
129
+ * Builtin type/collection/dispatch/rpc definitions used by the builder.
130
+ * Every cero schema includes these; user-defined refs are added on top.
131
+ */
132
+ export type CommandDesc = {
133
+ name: string;
134
+ request: {
135
+ name: string;
136
+ };
137
+ response: {
138
+ name: string;
139
+ stream?: boolean;
140
+ };
141
+ };
@@ -0,0 +1,29 @@
1
+ export function put(ref: Ref, row: Record<string, any>): Promise<SingleResult>;
2
+ export function set(ref: Ref, row: Record<string, any>): Promise<SingleResult>;
3
+ export function del(ref: Ref, id?: string): Promise<void>;
4
+ export function count(ref: Ref, q?: Record<string, any>): Promise<{
5
+ data: number;
6
+ }>;
7
+ export function call(ref: Ref, d?: Record<string, any>): Promise<any>;
8
+ export function get(ref: Ref, q?: string | Record<string, any>): Promise<SingleResult | ListResult | GetByIdResult>;
9
+ export function watch(ref: Ref, q?: Record<string, any>): any;
10
+ export function open(ref: Ref, arg?: string | {
11
+ invite?: string;
12
+ id?: string;
13
+ name?: string;
14
+ routes?: any;
15
+ role?: string;
16
+ accept?: boolean;
17
+ } | undefined): Promise<any>;
18
+ export type Ref = import("./utils.js").Ref;
19
+ export type SingleResult = {
20
+ data: any;
21
+ };
22
+ export type ListResult = {
23
+ data: any[];
24
+ total: number;
25
+ size: number;
26
+ };
27
+ export type GetByIdResult = {
28
+ data: any | null;
29
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Quickly check whether the on-disk directory at `dir` already holds an
3
+ * initialised cero identity (i.e. a stored master seed). Opens the local
4
+ * store read-only and closes everything before returning.
5
+ *
6
+ * @param {string} dir Cero data directory.
7
+ * @param {any} spec Built spec — same value passed to `cero(dir, spec)`.
8
+ * @returns {Promise<boolean>} `true` if a master seed exists on disk.
9
+ */
10
+ export function peek(dir: string, spec: any): Promise<boolean>;
@@ -0,0 +1 @@
1
+ export { t, schema } from "@cero-base/core/schema";
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Attach a `Ref` property to `target` for every entry in `refs`. Used by
3
+ * `Handle` and `Local` during `_open()` so callers can write
4
+ * `handle.someRef` instead of looking refs up by name.
5
+ *
6
+ * @param {any} target
7
+ * @param {Record<string, RefInfo>} refs
8
+ */
9
+ export function attachRefs(target: any, refs: Record<string, RefInfo>): void;
10
+ /**
11
+ * @typedef {'collection' | 'single' | 'action' | 'handle'} RefKind
12
+ * @typedef {{ kind?: string, schema?: string }} RefInfo
13
+ * Shape of the entries in `meta.refs` — describes a single ref name.
14
+ * `kind` is one of {@link RefKind}, kept as `string` since it originates
15
+ * from a generated spec.
16
+ */
17
+ /**
18
+ * Typed pointer to a single ref (table or handle slot) on a `Handle` or
19
+ * `Local`. Operators (`put`/`get`/`open`/...) take a `Ref` as their first
20
+ * argument and dispatch through the owning handle's store.
21
+ */
22
+ export class Ref {
23
+ /**
24
+ * @param {any} handle Owner — a `Handle` (or `Local`) the ref lives on.
25
+ * @param {string} name Ref name as declared in the schema.
26
+ * @param {string} kind Ref kind: `'collection'`, `'single'`, `'action'`, or `'handle'`.
27
+ * @param {string | null} [schema] Fully-qualified schema id, if any.
28
+ */
29
+ constructor(handle: any, name: string, kind: string, schema?: string | null);
30
+ handle: any;
31
+ name: string;
32
+ kind: string;
33
+ schema: string;
34
+ }
35
+ export type RefKind = "collection" | "single" | "action" | "handle";
36
+ /**
37
+ * Shape of the entries in `meta.refs` — describes a single ref name.
38
+ * `kind` is one of {@link RefKind}, kept as `string` since it originates
39
+ * from a generated spec.
40
+ */
41
+ export type RefInfo = {
42
+ kind?: string;
43
+ schema?: string;
44
+ };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @typedef {object} LocalOpts
3
+ * @property {any} [root] Pre-existing HypercoreStorage to reuse.
4
+ * @property {any} [store] Pre-existing Corestore to reuse.
5
+ */
6
+ /**
7
+ * Per-device, single-writer storage for cero — holds the master seed,
8
+ * device keypair and any per-handle keypairs. Wraps a hyperbee-backed
9
+ * `Storage` and exposes each local ref as a property of the instance.
10
+ */
11
+ export class Local extends ReadyResource {
12
+ /**
13
+ * @param {string | null} dir Directory for the local store, or `null` when reusing an external `store`.
14
+ * @param {any} spec Built cero spec — must include `spec.local.database` and `spec.meta.local`.
15
+ * @param {LocalOpts} [opts]
16
+ */
17
+ constructor(dir: string | null, spec: any, { root, store }?: LocalOpts);
18
+ dir: string;
19
+ spec: any;
20
+ store: Storage;
21
+ }
22
+ export type LocalOpts = {
23
+ /**
24
+ * Pre-existing HypercoreStorage to reuse.
25
+ */
26
+ root?: any;
27
+ /**
28
+ * Pre-existing Corestore to reuse.
29
+ */
30
+ store?: any;
31
+ };
32
+ import ReadyResource from 'ready-resource';
33
+ import { Storage } from '@cero-base/core/storage';
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Re-initialize a `Client` from a recovery phrase. Closes the existing
3
+ * local state and reseeds identity from the phrase.
4
+ *
5
+ * @param {Client} me
6
+ * @param {string} phrase
7
+ * @returns {Promise<Client>}
8
+ */
9
+ export function restore(me: Client, phrase: string): Promise<Client>;
10
+ /**
11
+ * Construct a `Client`, wait for `init` to complete, and return it.
12
+ *
13
+ * @param {any} ipc
14
+ * @param {object} spec
15
+ * @returns {Promise<Client>}
16
+ */
17
+ export function connect(ipc: any, spec: object): Promise<Client>;
18
+ /**
19
+ * IPC-side RPC client for cero. Wraps an `hrpc` channel and exposes the
20
+ * same handle/ref/row API as a local cero instance, transparently
21
+ * routing every operation across the wire.
22
+ */
23
+ export class Client extends RPCClient {
24
+ /**
25
+ * @param {any} ipc Framed IPC stream (must be writable).
26
+ * @param {Spec} spec Compiled cero spec (schema + rpc + handles).
27
+ */
28
+ constructor(ipc: any, spec: Spec);
29
+ id: any;
30
+ deviceId: any;
31
+ store: this;
32
+ identity: {
33
+ id: any;
34
+ toPhrase: () => any;
35
+ };
36
+ /**
37
+ * Create a new child handle of the given type.
38
+ *
39
+ * @param {string} type
40
+ * @param {Record<string, any>} [opts]
41
+ * @returns {Promise<Handle>}
42
+ */
43
+ _create(type: string, opts?: Record<string, any>): Promise<Handle>;
44
+ /**
45
+ * Load an existing child handle by id.
46
+ *
47
+ * @param {string} type
48
+ * @param {string} id
49
+ * @returns {Promise<Handle>}
50
+ */
51
+ _load(type: string, id: string): Promise<Handle>;
52
+ /**
53
+ * Join a child handle via invite.
54
+ *
55
+ * @param {string} invite
56
+ * @param {string} type
57
+ * @returns {Promise<Handle>}
58
+ */
59
+ _join(invite: string, type: string): Promise<Handle>;
60
+ }
61
+ export type BaseRPCClient = import("@cero-base/core/rpc").RPCClient;
62
+ export type RefInfo = {
63
+ kind?: "single" | "collection" | "action" | "handle";
64
+ schema?: string;
65
+ type?: string;
66
+ };
67
+ /**
68
+ * Built cero spec (schema + rpc + per-handle child specs).
69
+ */
70
+ export type Spec = import("@cero-base/core/rpc").Spec & {
71
+ meta: {
72
+ ns?: string;
73
+ refs: Record<string, RefInfo>;
74
+ handles?: Record<string, Spec>;
75
+ };
76
+ handles: Record<string, Spec>;
77
+ };
78
+ export type SingleResult = {
79
+ data: any;
80
+ };
81
+ export type ListResult = {
82
+ data: any[];
83
+ total: number;
84
+ size: number;
85
+ };
86
+ export type GetByIdResult = {
87
+ data: any | null;
88
+ };
89
+ export type ClientIdentity = {
90
+ id: string;
91
+ toPhrase: () => string | null;
92
+ };
93
+ export type HandleStub = {
94
+ id: string;
95
+ type: string;
96
+ name: string | null;
97
+ };
98
+ import { RPCClient } from '@cero-base/core/rpc';
99
+ /**
100
+ * Client-side proxy for a remote handle. Exposes the same row-ops surface
101
+ * as `Client` but scoped to a single child handle id, and routes every
102
+ * call through the parent's RPC channel.
103
+ */
104
+ declare class Handle {
105
+ /**
106
+ * @param {Client} parent
107
+ * @param {string} id
108
+ * @param {string} type
109
+ * @param {string|null} name
110
+ */
111
+ constructor(parent: Client, id: string, type: string, name: string | null);
112
+ parent: Client;
113
+ id: string;
114
+ type: string;
115
+ name: string;
116
+ spec: Spec;
117
+ store: this;
118
+ /** Underlying RPC channel borrowed from the parent. */
119
+ get rpc(): any;
120
+ /** Tear down the remote handle without leaving the room. */
121
+ close(): any;
122
+ /** Tear down the remote handle and drop membership. */
123
+ leave(): any;
124
+ }
125
+ export { put, set, get, del, count, watch, call, open } from "../lib/operators.js";
@@ -0,0 +1,2 @@
1
+ export { Server, serve } from "./server.js";
2
+ export { Client, connect } from "./client.js";
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Construct a `Server`, wait for it to be ready, and return it.
3
+ *
4
+ * @param {any} ipc
5
+ * @param {ServerOpts} opts
6
+ * @returns {Promise<Server>}
7
+ */
8
+ export function serve(ipc: any, opts: ServerOpts): Promise<Server>;
9
+ /**
10
+ * @typedef {import('@cero-base/core/rpc').RPCServer} BaseRPCServer
11
+ *
12
+ * @typedef {object} ServerOpts
13
+ * @property {string} storage Directory passed to `cero()` for the local store.
14
+ * @property {object} spec Compiled cero spec (schema + rpc + handles).
15
+ * @property {string} [name] Optional display name forwarded to `cero()`.
16
+ * @property {Array<{ host: string, port: number }>} [bootstrap] Custom DHT bootstrap.
17
+ * @property {boolean} [isMobile]
18
+ * @property {(err: Error) => void} [onerror]
19
+ *
20
+ * @typedef {object} Identity
21
+ * @property {string} id Long-lived cero identity id.
22
+ * @property {string} deviceId Per-device id (empty when no `local` spec).
23
+ * @property {string|null} phrase BIP39 recovery phrase for the identity.
24
+ *
25
+ * @typedef {{ ref: any, codec: any }} RefAndCodec
26
+ *
27
+ * @typedef {{ data: any, total?: number, size?: number }} GetResult Single-ref get omits `total`/`size`; list/handle refs include them.
28
+ */
29
+ /**
30
+ * IPC-side RPC server for cero. Bridges an `hrpc` channel to a live
31
+ * `Handle` tree: lazy-initializes the root via `cero()` on the first
32
+ * `init` call, then exposes data ops, pairing, and handle lifecycle
33
+ * over the wire using the spec-bound codec.
34
+ */
35
+ export class Server extends RPCServer {
36
+ /**
37
+ * @param {any} ipc Framed IPC stream (must be writable).
38
+ * @param {Partial<ServerOpts>} [opts]
39
+ */
40
+ constructor(ipc: any, { storage, spec, ...opts }?: Partial<ServerOpts>);
41
+ storage: string;
42
+ opts: {
43
+ /**
44
+ * Optional display name forwarded to `cero()`.
45
+ */
46
+ name?: string;
47
+ /**
48
+ * Custom DHT bootstrap.
49
+ */
50
+ bootstrap?: Array<{
51
+ host: string;
52
+ port: number;
53
+ }>;
54
+ isMobile?: boolean;
55
+ onerror?: (err: Error) => void;
56
+ };
57
+ me: any;
58
+ handles: Map<any, any>;
59
+ /**
60
+ * Root cero id (null until `init` has run).
61
+ *
62
+ * @returns {string|undefined}
63
+ */
64
+ get id(): string | undefined;
65
+ /**
66
+ * Root identity object (null until `init` has run).
67
+ *
68
+ * @returns {any}
69
+ */
70
+ get identity(): any;
71
+ /** Wire the `init` handler that lazily constructs the root cero handle. */
72
+ _wireInit(): void;
73
+ /** Wire the `restore` handler that rebuilds the local store from a phrase. */
74
+ _wireRestore(): void;
75
+ /** Register the row-level RPC handlers (put/set/get/del/count/watch/call). */
76
+ _wireData(): void;
77
+ /** Register invite/revoke/join RPC handlers. */
78
+ _wirePairing(): void;
79
+ /** Register add/open/close/leave RPC handlers for child handles. */
80
+ _wireHandles(): void;
81
+ /**
82
+ * Look up a live handle by id, throwing if unknown. Binds the handle's
83
+ * codec on first use.
84
+ *
85
+ * @param {string} id
86
+ * @returns {any}
87
+ */
88
+ _resolve(id: string): any;
89
+ /**
90
+ * Resolve a `{ handle, ref }` pair to its `Ref` and the handle's codec.
91
+ *
92
+ * @param {string} id
93
+ * @param {string} name
94
+ * @returns {RefAndCodec}
95
+ */
96
+ _refOf(id: string, name: string): RefAndCodec;
97
+ /**
98
+ * Snapshot the current identity for return to the client.
99
+ *
100
+ * @returns {Identity}
101
+ */
102
+ _identity(): Identity;
103
+ }
104
+ export type BaseRPCServer = import("@cero-base/core/rpc").RPCServer;
105
+ export type ServerOpts = {
106
+ /**
107
+ * Directory passed to `cero()` for the local store.
108
+ */
109
+ storage: string;
110
+ /**
111
+ * Compiled cero spec (schema + rpc + handles).
112
+ */
113
+ spec: object;
114
+ /**
115
+ * Optional display name forwarded to `cero()`.
116
+ */
117
+ name?: string;
118
+ /**
119
+ * Custom DHT bootstrap.
120
+ */
121
+ bootstrap?: Array<{
122
+ host: string;
123
+ port: number;
124
+ }>;
125
+ isMobile?: boolean;
126
+ onerror?: (err: Error) => void;
127
+ };
128
+ export type Identity = {
129
+ /**
130
+ * Long-lived cero identity id.
131
+ */
132
+ id: string;
133
+ /**
134
+ * Per-device id (empty when no `local` spec).
135
+ */
136
+ deviceId: string;
137
+ /**
138
+ * BIP39 recovery phrase for the identity.
139
+ */
140
+ phrase: string | null;
141
+ };
142
+ export type RefAndCodec = {
143
+ ref: any;
144
+ codec: any;
145
+ };
146
+ /**
147
+ * Single-ref get omits `total`/`size`; list/handle refs include them.
148
+ */
149
+ export type GetResult = {
150
+ data: any;
151
+ total?: number;
152
+ size?: number;
153
+ };
154
+ import { RPCServer } from '@cero-base/core/rpc';