@cero-base/cero 2.2.0 → 2.3.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.
- package/README.md +24 -16
- package/package.json +7 -6
- package/src/build/index.js +38 -34
- package/src/build/internal.js +96 -11
- package/src/build/schemas.js +119 -19
- package/src/extensions/handle-sync.js +8 -12
- package/src/extensions/index.js +17 -63
- package/src/extensions/mirror.js +44 -0
- package/src/extensions/profile-sync.js +10 -12
- package/src/handle/index.js +499 -374
- package/src/handle/join.js +144 -0
- package/src/index.js +89 -118
- package/src/lib/bluetooth.js +83 -19
- package/src/lib/constants.js +1 -0
- package/src/lib/operators.js +298 -128
- package/src/lib/peek.js +1 -1
- package/src/lib/refs.js +7 -7
- package/src/lib/spec.js +32 -0
- package/src/local/index.js +27 -3
- package/src/rpc/client.js +240 -202
- package/src/rpc/server.js +186 -133
- package/types/build/index.d.ts +3 -8
- package/types/build/internal.d.ts +86 -27
- package/types/build/schemas.d.ts +91 -12
- package/types/extensions/handle-sync.d.ts +4 -12
- package/types/extensions/index.d.ts +59 -59
- package/types/extensions/mirror.d.ts +13 -0
- package/types/extensions/profile-sync.d.ts +4 -13
- package/types/handle/index.d.ts +229 -198
- package/types/handle/join.d.ts +63 -0
- package/types/index.d.ts +27 -55
- package/types/lib/bluetooth.d.ts +57 -19
- package/types/lib/constants.d.ts +1 -0
- package/types/lib/operators.d.ts +166 -81
- package/types/lib/peek.d.ts +2 -2
- package/types/lib/refs.d.ts +14 -15
- package/types/lib/spec.d.ts +87 -0
- package/types/local/index.d.ts +19 -9
- package/types/rpc/client.d.ts +55 -112
- package/types/rpc/server.d.ts +91 -50
- package/src/rpc/index.js +0 -8
- package/types/rpc/index.d.ts +0 -7
|
@@ -15,6 +15,9 @@ export declare const defs: {
|
|
|
15
15
|
files: {
|
|
16
16
|
type: string;
|
|
17
17
|
};
|
|
18
|
+
requests: {
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
18
21
|
};
|
|
19
22
|
local: {
|
|
20
23
|
master: {
|
|
@@ -28,51 +31,107 @@ export declare const defs: {
|
|
|
28
31
|
'handle-keypairs': {
|
|
29
32
|
type: string;
|
|
30
33
|
};
|
|
34
|
+
joins: {
|
|
35
|
+
type: string;
|
|
36
|
+
};
|
|
37
|
+
inbox: {
|
|
38
|
+
type: string;
|
|
39
|
+
};
|
|
40
|
+
outbox: {
|
|
41
|
+
type: string;
|
|
42
|
+
};
|
|
31
43
|
environment: {
|
|
32
44
|
type: string;
|
|
33
45
|
kind: string;
|
|
34
46
|
};
|
|
47
|
+
serving: {
|
|
48
|
+
type: string;
|
|
49
|
+
};
|
|
35
50
|
};
|
|
36
51
|
};
|
|
37
|
-
export
|
|
52
|
+
export type RefInfo = import('../lib/spec.js').RefInfo;
|
|
53
|
+
export type FieldType = {
|
|
54
|
+
prim: string;
|
|
55
|
+
required?: boolean;
|
|
56
|
+
array?: boolean;
|
|
57
|
+
};
|
|
58
|
+
export type Column = {
|
|
38
59
|
name: string;
|
|
39
|
-
type:
|
|
60
|
+
type: string;
|
|
40
61
|
required: boolean;
|
|
41
|
-
|
|
42
|
-
|
|
62
|
+
array?: boolean;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* @typedef {import('../lib/spec.js').RefInfo} RefInfo
|
|
66
|
+
* @typedef {{ prim: string, required?: boolean, array?: boolean }} FieldType A `t` field.
|
|
67
|
+
* @typedef {{ name: string, type: string, required: boolean, array?: boolean }} Column
|
|
68
|
+
*/
|
|
69
|
+
/**
|
|
70
|
+
* @param {string} ns
|
|
71
|
+
* @param {boolean} root
|
|
72
|
+
* @returns {Record<string, RefInfo>}
|
|
73
|
+
*/
|
|
74
|
+
export declare function live(ns: string, root: boolean): Record<string, RefInfo>;
|
|
75
|
+
/**
|
|
76
|
+
* @param {Record<string, FieldType>} map
|
|
77
|
+
* @returns {Column[]}
|
|
78
|
+
*/
|
|
79
|
+
export declare function fields(map: Record<string, FieldType>): Column[];
|
|
80
|
+
/**
|
|
81
|
+
* @param {'main' | 'local' | 'rpc'} scope
|
|
82
|
+
* @param {Record<string, Record<string, FieldType>>} [extend]
|
|
83
|
+
* @returns {Array<{ name: string, compact: boolean, fields: Column[] }>}
|
|
84
|
+
*/
|
|
85
|
+
export declare function types(scope: 'main' | 'local' | 'rpc', extend?: Record<string, Record<string, FieldType>>): Array<{
|
|
43
86
|
name: string;
|
|
44
87
|
compact: boolean;
|
|
45
|
-
fields:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
88
|
+
fields: Column[];
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* @param {string} ns
|
|
92
|
+
* @param {'main' | 'local'} scope
|
|
93
|
+
* @returns {Record<string, RefInfo & { path: string[] }>}
|
|
94
|
+
*/
|
|
95
|
+
export declare function refs(ns: string, scope: 'main' | 'local'): Record<string, RefInfo & {
|
|
96
|
+
path: string[];
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* Add `fields` to a ref: file ones resolve on read, required ones the RPC client fills on a set.
|
|
100
|
+
*
|
|
101
|
+
* @param {RefInfo} ref
|
|
102
|
+
* @param {Record<string, FieldType>} fields
|
|
103
|
+
* @returns {RefInfo}
|
|
104
|
+
*/
|
|
105
|
+
export declare function declare(ref: RefInfo, fields: Record<string, FieldType>): RefInfo;
|
|
106
|
+
/**
|
|
107
|
+
* @param {string} ns
|
|
108
|
+
* @param {'main' | 'local'} scope
|
|
109
|
+
* @returns {Array<{ name: string, schema: string, key: string[] }>}
|
|
110
|
+
*/
|
|
111
|
+
export declare function collections(ns: string, scope: 'main' | 'local'): Array<{
|
|
61
112
|
name: string;
|
|
62
113
|
schema: string;
|
|
63
114
|
key: string[];
|
|
64
|
-
}
|
|
65
|
-
|
|
115
|
+
}>;
|
|
116
|
+
/**
|
|
117
|
+
* @param {string} ns
|
|
118
|
+
* @returns {Array<{ name: string, requestType: string }>}
|
|
119
|
+
*/
|
|
120
|
+
export declare function dispatches(ns: string): Array<{
|
|
66
121
|
name: string;
|
|
67
122
|
requestType: string;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
123
|
+
}>;
|
|
124
|
+
/**
|
|
125
|
+
* @param {string} ns
|
|
126
|
+
* @returns {Array<{ name: string, request: { name: string }, response: { name: string, stream?: boolean } }>}
|
|
127
|
+
*/
|
|
128
|
+
export declare function commands(ns: string): Array<{
|
|
129
|
+
name: string;
|
|
71
130
|
request: {
|
|
72
131
|
name: string;
|
|
73
132
|
};
|
|
74
133
|
response: {
|
|
75
134
|
name: string;
|
|
76
|
-
stream
|
|
135
|
+
stream?: boolean;
|
|
77
136
|
};
|
|
78
|
-
}
|
|
137
|
+
}>;
|
package/types/build/schemas.d.ts
CHANGED
|
@@ -22,7 +22,6 @@ export declare const main: {
|
|
|
22
22
|
name: import("@cero-base/core").Prim;
|
|
23
23
|
createdAt: import("@cero-base/core").Prim;
|
|
24
24
|
updatedAt: import("@cero-base/core").Prim;
|
|
25
|
-
sig: import("@cero-base/core").Prim;
|
|
26
25
|
index: import("@cero-base/core").Prim;
|
|
27
26
|
};
|
|
28
27
|
device: {
|
|
@@ -36,16 +35,12 @@ export declare const main: {
|
|
|
36
35
|
};
|
|
37
36
|
invite: {
|
|
38
37
|
id: import("@cero-base/core").Prim;
|
|
39
|
-
invite: import("@cero-base/core").Prim;
|
|
40
|
-
publicKey: import("@cero-base/core").Prim;
|
|
41
|
-
data: import("@cero-base/core").Prim;
|
|
42
|
-
sig: import("@cero-base/core").Prim;
|
|
43
38
|
role: import("@cero-base/core").Prim;
|
|
44
39
|
expires: import("@cero-base/core").Prim;
|
|
40
|
+
reuse: import("@cero-base/core").Prim;
|
|
45
41
|
createdAt: import("@cero-base/core").Prim;
|
|
46
42
|
index: import("@cero-base/core").Prim;
|
|
47
|
-
|
|
48
|
-
reuse: import("@cero-base/core").Prim;
|
|
43
|
+
confirm: import("@cero-base/core").Prim;
|
|
49
44
|
};
|
|
50
45
|
handle: {
|
|
51
46
|
id: import("@cero-base/core").Prim;
|
|
@@ -65,6 +60,7 @@ export declare const main: {
|
|
|
65
60
|
updatedAt: import("@cero-base/core").Prim;
|
|
66
61
|
index: import("@cero-base/core").Prim;
|
|
67
62
|
stamp: import("@cero-base/core").Prim;
|
|
63
|
+
from: import("@cero-base/core").Prim;
|
|
68
64
|
};
|
|
69
65
|
claim: {
|
|
70
66
|
identity: import("@cero-base/core").Prim;
|
|
@@ -79,6 +75,47 @@ export declare const main: {
|
|
|
79
75
|
commit: import("@cero-base/core").Prim;
|
|
80
76
|
stamp: import("@cero-base/core").Prim;
|
|
81
77
|
};
|
|
78
|
+
join: {
|
|
79
|
+
box: import("@cero-base/core").Prim;
|
|
80
|
+
};
|
|
81
|
+
accept: {
|
|
82
|
+
id: import("@cero-base/core").Prim;
|
|
83
|
+
role: import("@cero-base/core").Prim;
|
|
84
|
+
};
|
|
85
|
+
request: {
|
|
86
|
+
id: import("@cero-base/core").Prim;
|
|
87
|
+
identity: import("@cero-base/core").Prim;
|
|
88
|
+
invite: import("@cero-base/core").Prim;
|
|
89
|
+
reply: import("@cero-base/core").Prim;
|
|
90
|
+
createdAt: import("@cero-base/core").Prim;
|
|
91
|
+
index: import("@cero-base/core").Prim;
|
|
92
|
+
admitted: import("@cero-base/core").Prim;
|
|
93
|
+
expires: import("@cero-base/core").Prim;
|
|
94
|
+
role: import("@cero-base/core").Prim;
|
|
95
|
+
};
|
|
96
|
+
removal: {
|
|
97
|
+
id: import("@cero-base/core").Prim;
|
|
98
|
+
index: import("@cero-base/core").Prim;
|
|
99
|
+
};
|
|
100
|
+
status: {
|
|
101
|
+
role: import("@cero-base/core").Prim;
|
|
102
|
+
writable: import("@cero-base/core").Prim;
|
|
103
|
+
epoch: import("@cero-base/core").Prim;
|
|
104
|
+
suspended: import("@cero-base/core").Prim;
|
|
105
|
+
behind: import("@cero-base/core").Prim;
|
|
106
|
+
nearby: import("@cero-base/core").Prim;
|
|
107
|
+
};
|
|
108
|
+
joining: {
|
|
109
|
+
id: import("@cero-base/core").Prim;
|
|
110
|
+
type: import("@cero-base/core").Prim;
|
|
111
|
+
invite: import("@cero-base/core").Prim;
|
|
112
|
+
};
|
|
113
|
+
peer: {
|
|
114
|
+
id: import("@cero-base/core").Prim;
|
|
115
|
+
name: import("@cero-base/core").Prim;
|
|
116
|
+
isMobile: import("@cero-base/core").Prim;
|
|
117
|
+
device: import("@cero-base/core").Prim;
|
|
118
|
+
};
|
|
82
119
|
};
|
|
83
120
|
export declare const local: {
|
|
84
121
|
master: {
|
|
@@ -87,6 +124,7 @@ export declare const local: {
|
|
|
87
124
|
keypair: {
|
|
88
125
|
publicKey: import("@cero-base/core").Prim;
|
|
89
126
|
secretKey: import("@cero-base/core").Prim;
|
|
127
|
+
setup: import("@cero-base/core").Prim;
|
|
90
128
|
};
|
|
91
129
|
'handle-keypair': {
|
|
92
130
|
id: import("@cero-base/core").Prim;
|
|
@@ -94,6 +132,26 @@ export declare const local: {
|
|
|
94
132
|
secretKey: import("@cero-base/core").Prim;
|
|
95
133
|
encryptionKey: import("@cero-base/core").Prim;
|
|
96
134
|
};
|
|
135
|
+
serving: {
|
|
136
|
+
id: import("@cero-base/core").Prim;
|
|
137
|
+
type: import("@cero-base/core").Prim;
|
|
138
|
+
};
|
|
139
|
+
join: {
|
|
140
|
+
id: import("@cero-base/core").Prim;
|
|
141
|
+
type: import("@cero-base/core").Prim;
|
|
142
|
+
invite: import("@cero-base/core").Prim;
|
|
143
|
+
publicKey: import("@cero-base/core").Prim;
|
|
144
|
+
secretKey: import("@cero-base/core").Prim;
|
|
145
|
+
key: import("@cero-base/core").Prim;
|
|
146
|
+
encryptionKey: import("@cero-base/core").Prim;
|
|
147
|
+
epochs: import("@cero-base/core").Prim;
|
|
148
|
+
};
|
|
149
|
+
mail: {
|
|
150
|
+
id: import("@cero-base/core").Prim;
|
|
151
|
+
address: import("@cero-base/core").Prim;
|
|
152
|
+
message: import("@cero-base/core").Prim;
|
|
153
|
+
mirrors: import("@cero-base/core").Prim;
|
|
154
|
+
};
|
|
97
155
|
environment: {
|
|
98
156
|
channel: import("@cero-base/core").Prim;
|
|
99
157
|
};
|
|
@@ -111,6 +169,11 @@ export declare const rpc: {
|
|
|
111
169
|
data: import("@cero-base/core").Prim;
|
|
112
170
|
local: import("@cero-base/core").Prim;
|
|
113
171
|
noUpsert: import("@cero-base/core").Prim;
|
|
172
|
+
fields: {
|
|
173
|
+
prim: string;
|
|
174
|
+
required?: boolean;
|
|
175
|
+
array: boolean;
|
|
176
|
+
};
|
|
114
177
|
};
|
|
115
178
|
'req-id': {
|
|
116
179
|
handle: import("@cero-base/core").Prim;
|
|
@@ -132,8 +195,10 @@ export declare const rpc: {
|
|
|
132
195
|
'req-invite': {
|
|
133
196
|
handle: import("@cero-base/core").Prim;
|
|
134
197
|
role: import("@cero-base/core").Prim;
|
|
135
|
-
|
|
198
|
+
ttl: import("@cero-base/core").Prim;
|
|
136
199
|
reuse: import("@cero-base/core").Prim;
|
|
200
|
+
data: import("@cero-base/core").Prim;
|
|
201
|
+
confirm: import("@cero-base/core").Prim;
|
|
137
202
|
};
|
|
138
203
|
'req-revoke': {
|
|
139
204
|
handle: import("@cero-base/core").Prim;
|
|
@@ -144,6 +209,9 @@ export declare const rpc: {
|
|
|
144
209
|
ref: import("@cero-base/core").Prim;
|
|
145
210
|
invite: import("@cero-base/core").Prim;
|
|
146
211
|
};
|
|
212
|
+
'req-cancel': {
|
|
213
|
+
invite: import("@cero-base/core").Prim;
|
|
214
|
+
};
|
|
147
215
|
'req-open': {
|
|
148
216
|
parent: import("@cero-base/core").Prim;
|
|
149
217
|
row: import("@cero-base/core").Prim;
|
|
@@ -163,10 +231,6 @@ export declare const rpc: {
|
|
|
163
231
|
total: import("@cero-base/core").Prim;
|
|
164
232
|
size: import("@cero-base/core").Prim;
|
|
165
233
|
};
|
|
166
|
-
'res-changes': {
|
|
167
|
-
changes: import("@cero-base/core").Prim;
|
|
168
|
-
reset: import("@cero-base/core").Prim;
|
|
169
|
-
};
|
|
170
234
|
'res-invite': {
|
|
171
235
|
invite: import("@cero-base/core").Prim;
|
|
172
236
|
};
|
|
@@ -174,6 +238,8 @@ export declare const rpc: {
|
|
|
174
238
|
id: import("@cero-base/core").Prim;
|
|
175
239
|
type: import("@cero-base/core").Prim;
|
|
176
240
|
name: import("@cero-base/core").Prim;
|
|
241
|
+
denied: import("@cero-base/core").Prim;
|
|
242
|
+
reason: import("@cero-base/core").Prim;
|
|
177
243
|
};
|
|
178
244
|
'req-add-file': {
|
|
179
245
|
handle: import("@cero-base/core").Prim;
|
|
@@ -186,6 +252,7 @@ export declare const rpc: {
|
|
|
186
252
|
deviceId: import("@cero-base/core").Prim;
|
|
187
253
|
fileBase: import("@cero-base/core").Prim;
|
|
188
254
|
fileToken: import("@cero-base/core").Prim;
|
|
255
|
+
deviceName: import("@cero-base/core").Prim;
|
|
189
256
|
};
|
|
190
257
|
'res-seed': {
|
|
191
258
|
phrase: import("@cero-base/core").Prim;
|
|
@@ -200,5 +267,17 @@ export declare const rpc: {
|
|
|
200
267
|
message: import("@cero-base/core").Prim;
|
|
201
268
|
code: import("@cero-base/core").Prim;
|
|
202
269
|
stack: import("@cero-base/core").Prim;
|
|
270
|
+
reason: import("@cero-base/core").Prim;
|
|
271
|
+
};
|
|
272
|
+
'req-answer': {
|
|
273
|
+
handle: import("@cero-base/core").Prim;
|
|
274
|
+
id: import("@cero-base/core").Prim;
|
|
275
|
+
accept: import("@cero-base/core").Prim;
|
|
276
|
+
role: import("@cero-base/core").Prim;
|
|
277
|
+
reason: import("@cero-base/core").Prim;
|
|
278
|
+
};
|
|
279
|
+
'req-nearby': {
|
|
280
|
+
on: import("@cero-base/core").Prim;
|
|
281
|
+
invite: import("@cero-base/core").Prim;
|
|
203
282
|
};
|
|
204
283
|
};
|
|
@@ -2,17 +2,9 @@
|
|
|
2
2
|
* Mirror a child handle's `profile` (name + avatar) onto its row in the parent's `handles`
|
|
3
3
|
* list — so a handle list shows names + avatars without opening each one.
|
|
4
4
|
*
|
|
5
|
-
* @param {{ fields?: Record<string,
|
|
5
|
+
* @param {{ fields?: Record<string, object> }} [opts] Extra fields, as `t` types.
|
|
6
|
+
* @returns {import('./index.js').Extension}
|
|
6
7
|
*/
|
|
7
8
|
export declare function handleSync({ fields }?: {
|
|
8
|
-
fields?: Record<string,
|
|
9
|
-
}):
|
|
10
|
-
name: string;
|
|
11
|
-
schema: {
|
|
12
|
-
handles: {
|
|
13
|
-
kind: 'extend';
|
|
14
|
-
fields: Record<string, import("@cero-base/core").Prim>;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
setup(me: any): void;
|
|
18
|
-
};
|
|
9
|
+
fields?: Record<string, object>;
|
|
10
|
+
}): import('./index.js').Extension;
|
|
@@ -3,8 +3,54 @@ import * as operators from '../lib/operators.js';
|
|
|
3
3
|
export * from './profile-sync.js';
|
|
4
4
|
export * from './handle-sync.js';
|
|
5
5
|
export { t, schema };
|
|
6
|
-
export
|
|
6
|
+
export * from '../lib/operators.js';
|
|
7
7
|
export declare const cero: {
|
|
8
|
+
put(ref: operators.Ref, row: operators.Row): Promise<operators.SingleResult>;
|
|
9
|
+
set(ref: operators.Ref, row: operators.Row, opts?: {
|
|
10
|
+
upsert?: boolean;
|
|
11
|
+
}): Promise<operators.SingleResult | null>;
|
|
12
|
+
del(ref: operators.Ref, id?: string): Promise<void>;
|
|
13
|
+
call(ref: operators.Ref, d?: operators.Row): Promise<void>;
|
|
14
|
+
before(ref: operators.Ref, fn: (ctx: operators.HookContext) => unknown, opts?: {
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
}): () => void;
|
|
17
|
+
after(ref: operators.Ref, fn: (ctx: operators.HookContext) => unknown, opts?: {
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}): () => void;
|
|
20
|
+
get(ref: operators.Ref, q?: string | Record<string, unknown>): Promise<operators.SingleResult | operators.ListResult>;
|
|
21
|
+
watch(ref: operators.Ref, query?: string | (Record<string, unknown> & {
|
|
22
|
+
changes?: boolean;
|
|
23
|
+
}), opts?: {
|
|
24
|
+
signal?: AbortSignal;
|
|
25
|
+
}): import('streamx').Readable;
|
|
26
|
+
open(ref: operators.Ref, arg?: string | {
|
|
27
|
+
invite?: string;
|
|
28
|
+
id?: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
} | undefined): Promise<operators.Context>;
|
|
31
|
+
invite(ctx: operators.Context, opts?: import("@cero-base/core").InviteOpts): Promise<string>;
|
|
32
|
+
revoke(ctx: operators.Context, code: string): Promise<boolean>;
|
|
33
|
+
rotate(ctx: operators.Context): Promise<{
|
|
34
|
+
epoch: number;
|
|
35
|
+
}>;
|
|
36
|
+
tx<T>(ctx: operators.Context, fn: (tx: operators.Context) => Promise<T>): Promise<T>;
|
|
37
|
+
accept(ctx: operators.Context, request: {
|
|
38
|
+
id: string;
|
|
39
|
+
}, { role }?: {
|
|
40
|
+
role?: string;
|
|
41
|
+
}): Promise<void>;
|
|
42
|
+
deny(ctx: operators.Context, request: {
|
|
43
|
+
id: string;
|
|
44
|
+
}, reason?: string): Promise<void>;
|
|
45
|
+
leave(ctx: operators.Context): Promise<void>;
|
|
46
|
+
close(ctx: operators.Context): Promise<void>;
|
|
47
|
+
cancel(me: operators.Context, code: string): Promise<boolean>;
|
|
48
|
+
suspend(me: operators.Context): Promise<void>;
|
|
49
|
+
resume(me: operators.Context): Promise<void>;
|
|
50
|
+
activate(room: operators.Context): Promise<void>;
|
|
51
|
+
deactivate(room: operators.Context): Promise<void>;
|
|
52
|
+
phrase(me: operators.Context): Promise<string>;
|
|
53
|
+
nearby(ctx: operators.Context, mode: boolean | string): Promise<void>;
|
|
8
54
|
t: {
|
|
9
55
|
string: import("@cero-base/core").Prim;
|
|
10
56
|
uint: import("@cero-base/core").Prim;
|
|
@@ -28,77 +74,31 @@ export declare const cero: {
|
|
|
28
74
|
};
|
|
29
75
|
};
|
|
30
76
|
schema: typeof schema;
|
|
31
|
-
put: typeof operators.put;
|
|
32
|
-
set: typeof operators.set;
|
|
33
|
-
get: typeof operators.get;
|
|
34
|
-
del: typeof operators.del;
|
|
35
|
-
watch: typeof operators.watch;
|
|
36
|
-
changes: typeof operators.changes;
|
|
37
|
-
call: typeof operators.call;
|
|
38
|
-
open: typeof operators.open;
|
|
39
|
-
rotate: typeof operators.rotate;
|
|
40
|
-
before: typeof operators.before;
|
|
41
|
-
after: typeof operators.after;
|
|
42
77
|
};
|
|
43
78
|
export type Extension = {
|
|
79
|
+
name?: string;
|
|
44
80
|
/**
|
|
45
81
|
* Refs to add, or `t.extend` on a builtin, nested by handle type like the app schema.
|
|
46
82
|
*/
|
|
47
|
-
schema?: Record<string,
|
|
83
|
+
schema?: Record<string, object>;
|
|
48
84
|
/**
|
|
49
|
-
* Runs
|
|
85
|
+
* Runs before the root opens; a returned function runs on close.
|
|
50
86
|
*/
|
|
51
|
-
setup?: (me:
|
|
87
|
+
setup?: (me: import('../handle/index.js').Context) => void | (() => void) | Promise<void | (() => void)>;
|
|
52
88
|
};
|
|
53
89
|
/**
|
|
54
90
|
* @typedef {object} Extension
|
|
55
|
-
* @property {
|
|
56
|
-
* @property {
|
|
91
|
+
* @property {string} [name]
|
|
92
|
+
* @property {Record<string, object>} [schema] Refs to add, or `t.extend` on a builtin, nested by handle type like the app schema.
|
|
93
|
+
* @property {(me: import('../handle/index.js').Context) => void | (() => void) | Promise<void | (() => void)>} [setup] Runs before the root opens; a returned function runs on close.
|
|
57
94
|
*/
|
|
58
95
|
/** The two every app gets unless its build names a list. */
|
|
59
|
-
export declare const bundled:
|
|
60
|
-
name: string;
|
|
61
|
-
schema: {
|
|
62
|
-
profile: import("@cero-base/core").TypeDef;
|
|
63
|
-
members: {
|
|
64
|
-
kind: 'extend';
|
|
65
|
-
fields: Record<string, import("@cero-base/core").Prim>;
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
setup(me: any): void;
|
|
69
|
-
} | {
|
|
70
|
-
name: string;
|
|
71
|
-
schema: {
|
|
72
|
-
handles: {
|
|
73
|
-
kind: 'extend';
|
|
74
|
-
fields: Record<string, import("@cero-base/core").Prim>;
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
setup(me: any): void;
|
|
78
|
-
})[];
|
|
96
|
+
export declare const bundled: Extension[];
|
|
79
97
|
/**
|
|
80
|
-
* The
|
|
98
|
+
* The override, else the list the spec carries, else the bundled two. A bare function is `{ setup }`.
|
|
81
99
|
*
|
|
82
|
-
* @param {
|
|
83
|
-
* @param {Array<
|
|
100
|
+
* @param {import('../lib/spec.js').Spec | null} spec
|
|
101
|
+
* @param {Array<Extension | Extension['setup']>} [override]
|
|
84
102
|
* @returns {Extension[]}
|
|
85
103
|
*/
|
|
86
|
-
export declare function extensionsOf(spec:
|
|
87
|
-
/**
|
|
88
|
-
* The operators a spec carries: functions taking the handle first, keyed by namespace, a
|
|
89
|
-
* key naming a handle type holding that type's namespaces.
|
|
90
|
-
*
|
|
91
|
-
* @param {any} spec
|
|
92
|
-
* @param {Record<string, any>} [override]
|
|
93
|
-
* @returns {Record<string, any>}
|
|
94
|
-
*/
|
|
95
|
-
export declare function operatorsOf(spec: any, override?: Record<string, any>): Record<string, any>;
|
|
96
|
-
/**
|
|
97
|
-
* Put the operators for `handle` on it: the root when `type` is null, else a child of `type`.
|
|
98
|
-
*
|
|
99
|
-
* @param {any} handle
|
|
100
|
-
* @param {string | null} type
|
|
101
|
-
* @param {Record<string, any>} operators
|
|
102
|
-
* @returns {any} handle
|
|
103
|
-
*/
|
|
104
|
-
export declare function bind(handle: any, type: string | null, operators: Record<string, any>): any;
|
|
104
|
+
export declare function extensionsOf(spec: import('../lib/spec.js').Spec | null, override?: Array<Extension | Extension['setup']>): Extension[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write `row`'s name and `fields`, read from `from`, onto row `id` of `to`. A file is copied
|
|
3
|
+
* into `to`'s handle, so it resolves there for everyone in it. Nothing is written when there is
|
|
4
|
+
* no row or it already matches: an unconditional set on every open is an op in the log forever.
|
|
5
|
+
*
|
|
6
|
+
* @param {import('../lib/refs.js').Ref} from
|
|
7
|
+
* @param {Record<string, unknown>} row
|
|
8
|
+
* @param {Record<string, object>} fields
|
|
9
|
+
* @param {import('../lib/refs.js').Ref} to
|
|
10
|
+
* @param {string} id
|
|
11
|
+
* @returns {Promise<void>}
|
|
12
|
+
*/
|
|
13
|
+
export declare function mirror(from: import('../lib/refs.js').Ref, row: Record<string, unknown>, fields: Record<string, object>, to: import('../lib/refs.js').Ref, id: string): Promise<void>;
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Mirror your `profile` onto your `member` row in every handle you're in.
|
|
3
3
|
*
|
|
4
|
-
* @param {{ fields?: Record<string,
|
|
4
|
+
* @param {{ fields?: Record<string, object> }} [opts] Extra fields, as `t` types.
|
|
5
|
+
* @returns {import('./index.js').Extension}
|
|
5
6
|
*/
|
|
6
7
|
export declare function profileSync({ fields }?: {
|
|
7
|
-
fields?: Record<string,
|
|
8
|
-
}):
|
|
9
|
-
name: string;
|
|
10
|
-
schema: {
|
|
11
|
-
profile: import("@cero-base/core").TypeDef;
|
|
12
|
-
members: {
|
|
13
|
-
kind: 'extend';
|
|
14
|
-
fields: Record<string, import("@cero-base/core").Prim>;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
setup(me: any): void;
|
|
18
|
-
};
|
|
8
|
+
fields?: Record<string, object>;
|
|
9
|
+
}): import('./index.js').Extension;
|