nervur 0.9.0 → 0.10.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/admin.mjs +2 -2
- package/being.mjs +6 -3
- package/ground.mjs +19 -9
- package/index.mjs +1 -1
- package/package.json +2 -2
package/admin.mjs
CHANGED
|
@@ -13,8 +13,8 @@ const ADMIN = `({
|
|
|
13
13
|
opened: Boolean @rights(is: [SELF, MEMBER, STRANGER])
|
|
14
14
|
}
|
|
15
15
|
type Mutation {
|
|
16
|
-
invite(address: String!, nextPkHash: String, rights: String): Boolean @rights(is: [SELF])
|
|
17
|
-
drop(address: String!): Boolean @rights(is: [SELF])
|
|
16
|
+
invite(address: String!, nextPkHash: String, rights: String): Boolean @rights(is: [SELF, MEMBER])
|
|
17
|
+
drop(address: String!): Boolean @rights(is: [SELF, MEMBER])
|
|
18
18
|
extend(program: String): Boolean @rights(is: [SELF])
|
|
19
19
|
create(program: String!, refs: [RefInput!], data: String, config: String): String
|
|
20
20
|
@rights(is: [SELF, MEMBER])
|
package/being.mjs
CHANGED
|
@@ -336,10 +336,13 @@ const Registry = ({
|
|
|
336
336
|
if (voice === undefined) {
|
|
337
337
|
return undefined;
|
|
338
338
|
}
|
|
339
|
+
const declared = (Program(memory.read(at, 'program')?.value)?.modules ?? []).map(
|
|
340
|
+
(one) => one.module,
|
|
341
|
+
);
|
|
339
342
|
const door = Being({
|
|
340
343
|
address: at,
|
|
341
344
|
deliver,
|
|
342
|
-
modules: modulesFor(voice),
|
|
345
|
+
modules: modulesFor(voice, declared),
|
|
343
346
|
vouched,
|
|
344
347
|
voice,
|
|
345
348
|
watch,
|
|
@@ -355,7 +358,7 @@ const Registry = ({
|
|
|
355
358
|
if (program !== undefined && written === undefined) {
|
|
356
359
|
return undefined;
|
|
357
360
|
}
|
|
358
|
-
const missing = (written?.modules ?? []).filter((one) => modules
|
|
361
|
+
const missing = (written?.modules ?? []).filter((one) => !modules.has(one.module));
|
|
359
362
|
if (missing.length > 0) {
|
|
360
363
|
return undefined;
|
|
361
364
|
}
|
|
@@ -403,7 +406,7 @@ const Registry = ({
|
|
|
403
406
|
if (written === undefined) {
|
|
404
407
|
return undefined;
|
|
405
408
|
}
|
|
406
|
-
if (written.modules.some((one) => modules
|
|
409
|
+
if (written.modules.some((one) => !modules.has(one.module))) {
|
|
407
410
|
return undefined;
|
|
408
411
|
}
|
|
409
412
|
if (orphans(address, written).length > 0) {
|
package/ground.mjs
CHANGED
|
@@ -93,7 +93,8 @@ const Ground = (modules = {}) => {
|
|
|
93
93
|
|
|
94
94
|
const extension = modules.blueprints?.ground();
|
|
95
95
|
const program = extension === undefined ? ADMIN : composed(ADMIN, extension);
|
|
96
|
-
|
|
96
|
+
const blueprint = program === undefined ? undefined : Blueprint(program);
|
|
97
|
+
if (blueprint?.digest === undefined) {
|
|
97
98
|
return undefined;
|
|
98
99
|
}
|
|
99
100
|
const installed = cells.peek('ground/admin');
|
|
@@ -141,18 +142,24 @@ const Ground = (modules = {}) => {
|
|
|
141
142
|
typeof one?.scope === 'function' ? one.scope(address) : one,
|
|
142
143
|
]),
|
|
143
144
|
);
|
|
144
|
-
const
|
|
145
|
+
const declaredOnly = (obj, declared) =>
|
|
146
|
+
Object.fromEntries(Object.entries(obj).filter(([name]) => declared.includes(name)));
|
|
147
|
+
const modulesFor = (voice, declared = []) =>
|
|
145
148
|
Object.freeze(
|
|
146
149
|
introduced(
|
|
147
150
|
{
|
|
148
|
-
...extra,
|
|
149
|
-
...boundFor(voice),
|
|
151
|
+
...declaredOnly(extra, declared),
|
|
152
|
+
...declaredOnly(boundFor(voice), declared),
|
|
150
153
|
memory,
|
|
151
154
|
},
|
|
152
155
|
Tools.address(voice.pk),
|
|
153
156
|
),
|
|
154
157
|
);
|
|
155
|
-
const
|
|
158
|
+
const offeredNames = new Set([...Object.keys(extra), ...bound.map(([name]) => name), 'memory']);
|
|
159
|
+
const adminDeclared = () =>
|
|
160
|
+
(Program(memory.read(address, 'program')?.value)?.modules ?? blueprint.modules).map(
|
|
161
|
+
(one) => one.module,
|
|
162
|
+
);
|
|
156
163
|
|
|
157
164
|
const adminMine = Compartment({
|
|
158
165
|
memory,
|
|
@@ -185,8 +192,11 @@ const Ground = (modules = {}) => {
|
|
|
185
192
|
|
|
186
193
|
const attest = async (name) => {
|
|
187
194
|
const one = extra[name];
|
|
188
|
-
if (one
|
|
189
|
-
return
|
|
195
|
+
if (one === undefined) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
if (one.at === undefined) {
|
|
199
|
+
return null;
|
|
190
200
|
}
|
|
191
201
|
const seen = await deliver(Tools.envelope(adminVoice, one.at, { describe: {} }, stamp()));
|
|
192
202
|
return seen?.body?.sdl === undefined
|
|
@@ -199,7 +209,7 @@ const Ground = (modules = {}) => {
|
|
|
199
209
|
adminMine,
|
|
200
210
|
address,
|
|
201
211
|
deliver: (envelope) => deliver(envelope),
|
|
202
|
-
modules:
|
|
212
|
+
modules: offeredNames,
|
|
203
213
|
modulesFor,
|
|
204
214
|
announce,
|
|
205
215
|
forget,
|
|
@@ -211,7 +221,7 @@ const Ground = (modules = {}) => {
|
|
|
211
221
|
Being({
|
|
212
222
|
address,
|
|
213
223
|
deliver: (envelope) => deliver(envelope),
|
|
214
|
-
modules:
|
|
224
|
+
modules: modulesFor(adminVoice, adminDeclared()),
|
|
215
225
|
registry,
|
|
216
226
|
vouched,
|
|
217
227
|
voice: adminVoice,
|
package/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ export { ADMIN } from './admin.mjs';
|
|
|
2
2
|
export { Blueprint, CLASSES, CORE_ONLY, OPEN, STRUCTURAL, coreClass, reads } from './blueprint.mjs';
|
|
3
3
|
export { Client } from './client.mjs';
|
|
4
4
|
export { Contract, Contracts } from './contract.mjs';
|
|
5
|
-
export { GROUND, Ground } from './ground.mjs';
|
|
5
|
+
export { FLOOR, GROUND, Ground } from './ground.mjs';
|
|
6
6
|
export { Cells, Clock, Dns, Entropy, Keychain, Memory, Paths, Wire } from './modules.mjs';
|
|
7
7
|
export { Mcp, Pointer } from './pointer.mjs';
|
|
8
8
|
export { Program } from './program.mjs';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nervur",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A distributed system of sovereign beings
|
|
3
|
+
"version": "0.10.0",
|
|
4
|
+
"description": "A distributed system of sovereign beings — one door, one question: by whose authority.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Razvan Gherghina",
|
|
7
7
|
"homepage": "https://nervur.org",
|