@haverstack/core 0.42.0 → 0.43.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 +5 -7
- package/dist/access.d.ts +30 -32
- package/dist/access.d.ts.map +1 -1
- package/dist/access.js +40 -98
- package/dist/access.js.map +1 -1
- package/dist/adapter/combine.d.ts.map +1 -1
- package/dist/adapter/combine.js +11 -3
- package/dist/adapter/combine.js.map +1 -1
- package/dist/adapter/index.d.ts +6 -4
- package/dist/adapter/index.d.ts.map +1 -1
- package/dist/adapter/index.js +4 -3
- package/dist/adapter/index.js.map +1 -1
- package/dist/adapter/reach.d.ts +14 -0
- package/dist/adapter/reach.d.ts.map +1 -0
- package/dist/adapter/reach.js +31 -0
- package/dist/adapter/reach.js.map +1 -0
- package/dist/associations/identity.d.ts +18 -42
- package/dist/associations/identity.d.ts.map +1 -1
- package/dist/associations/identity.js +60 -84
- package/dist/associations/identity.js.map +1 -1
- package/dist/associations/validation.d.ts +1 -8
- package/dist/associations/validation.d.ts.map +1 -1
- package/dist/associations/validation.js +3 -30
- package/dist/associations/validation.js.map +1 -1
- package/dist/collection.d.ts +7 -11
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +24 -34
- package/dist/collection.js.map +1 -1
- package/dist/content-match.d.ts +2 -2
- package/dist/content-match.js +2 -2
- package/dist/errors.d.ts +23 -8
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +28 -9
- package/dist/errors.js.map +1 -1
- package/dist/grants.d.ts +3 -3
- package/dist/grants.d.ts.map +1 -1
- package/dist/grants.js +4 -21
- package/dist/grants.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/lazy.d.ts +13 -0
- package/dist/lazy.d.ts.map +1 -0
- package/dist/lazy.js +27 -0
- package/dist/lazy.js.map +1 -0
- package/dist/merge.d.ts +1 -1
- package/dist/merge.js +1 -1
- package/dist/query-validation.d.ts +41 -28
- package/dist/query-validation.d.ts.map +1 -1
- package/dist/query-validation.js +85 -71
- package/dist/query-validation.js.map +1 -1
- package/dist/record-changes.d.ts +12 -36
- package/dist/record-changes.d.ts.map +1 -1
- package/dist/record-changes.js +9 -98
- package/dist/record-changes.js.map +1 -1
- package/dist/scoped-stack/authority-snapshot.d.ts +37 -0
- package/dist/scoped-stack/authority-snapshot.d.ts.map +1 -0
- package/dist/scoped-stack/authority-snapshot.js +49 -0
- package/dist/scoped-stack/authority-snapshot.js.map +1 -0
- package/dist/scoped-stack/authority.d.ts +51 -38
- package/dist/scoped-stack/authority.d.ts.map +1 -1
- package/dist/scoped-stack/authority.js +160 -136
- package/dist/scoped-stack/authority.js.map +1 -1
- package/dist/scoped-stack/family-policy.d.ts +59 -0
- package/dist/scoped-stack/family-policy.d.ts.map +1 -0
- package/dist/scoped-stack/family-policy.js +68 -0
- package/dist/scoped-stack/family-policy.js.map +1 -0
- package/dist/scoped-stack/scoped-stack.d.ts +66 -86
- package/dist/scoped-stack/scoped-stack.d.ts.map +1 -1
- package/dist/scoped-stack/scoped-stack.js +243 -324
- package/dist/scoped-stack/scoped-stack.js.map +1 -1
- package/dist/scoped-stack/subscription.d.ts +14 -33
- package/dist/scoped-stack/subscription.d.ts.map +1 -1
- package/dist/scoped-stack/subscription.js +16 -57
- package/dist/scoped-stack/subscription.js.map +1 -1
- package/dist/stack/arguments.d.ts +27 -0
- package/dist/stack/arguments.d.ts.map +1 -0
- package/dist/stack/arguments.js +53 -0
- package/dist/stack/arguments.js.map +1 -0
- package/dist/stack/attachments.d.ts +1 -1
- package/dist/stack/attachments.js +1 -1
- package/dist/stack/changes.d.ts +4 -10
- package/dist/stack/changes.d.ts.map +1 -1
- package/dist/stack/changes.js +8 -8
- package/dist/stack/changes.js.map +1 -1
- package/dist/stack/client.d.ts +34 -58
- package/dist/stack/client.d.ts.map +1 -1
- package/dist/stack/install-app.d.ts.map +1 -1
- package/dist/stack/install-app.js +7 -5
- package/dist/stack/install-app.js.map +1 -1
- package/dist/stack/integrity.js +2 -2
- package/dist/stack/integrity.js.map +1 -1
- package/dist/stack/limits.d.ts +1 -1
- package/dist/stack/limits.js +1 -1
- package/dist/stack/reads.d.ts +9 -5
- package/dist/stack/reads.d.ts.map +1 -1
- package/dist/stack/reads.js +24 -4
- package/dist/stack/reads.js.map +1 -1
- package/dist/stack/stack.d.ts +77 -71
- package/dist/stack/stack.d.ts.map +1 -1
- package/dist/stack/stack.js +229 -256
- package/dist/stack/stack.js.map +1 -1
- package/dist/stack/type-grants.d.ts.map +1 -1
- package/dist/stack/type-grants.js +4 -4
- package/dist/stack/type-grants.js.map +1 -1
- package/dist/stack/write-expectation.d.ts +13 -12
- package/dist/stack/write-expectation.d.ts.map +1 -1
- package/dist/stack/write-expectation.js.map +1 -1
- package/dist/stack/write-gate.d.ts +23 -0
- package/dist/stack/write-gate.d.ts.map +1 -0
- package/dist/stack/write-gate.js +17 -0
- package/dist/stack/write-gate.js.map +1 -0
- package/dist/testing.d.ts +25 -9
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +147 -123
- package/dist/testing.js.map +1 -1
- package/dist/types/adapter.d.ts +90 -31
- package/dist/types/adapter.d.ts.map +1 -1
- package/dist/types/associations.d.ts +1 -17
- package/dist/types/associations.d.ts.map +1 -1
- package/dist/types/associations.js +1 -8
- package/dist/types/associations.js.map +1 -1
- package/dist/types/capabilities.d.ts +8 -8
- package/dist/types/capabilities.d.ts.map +1 -1
- package/dist/types/events.d.ts +3 -8
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/query.d.ts +4 -4
- package/dist/types/system.d.ts +1 -1
- package/dist/validate.d.ts +2 -0
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +2 -1
- package/dist/validate.js.map +1 -1
- package/dist/wire/body.d.ts +32 -9
- package/dist/wire/body.d.ts.map +1 -1
- package/dist/wire/body.js +69 -8
- package/dist/wire/body.js.map +1 -1
- package/dist/wire/index.d.ts +4 -4
- package/dist/wire/index.d.ts.map +1 -1
- package/dist/wire/index.js +3 -3
- package/dist/wire/index.js.map +1 -1
- package/dist/wire/record.d.ts +1 -8
- package/dist/wire/record.d.ts.map +1 -1
- package/dist/wire/record.js +0 -48
- package/dist/wire/record.js.map +1 -1
- package/dist/wire/request.d.ts +18 -18
- package/dist/wire/request.d.ts.map +1 -1
- package/dist/wire/request.js +41 -36
- package/dist/wire/request.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authority snapshot
|
|
3
|
+
* -------------------------------------------------------
|
|
4
|
+
* The authority one request acts with, read once: the `_grant` Records,
|
|
5
|
+
* the roles the subject holds on rosters, and the reach each verb builds
|
|
6
|
+
* from them — each loaded on first use and shared after, so an operation
|
|
7
|
+
* reads each at most once however many Records it decides. An operation
|
|
8
|
+
* takes its own and drops it when done; a subscription holds one for its
|
|
9
|
+
* life, which is only safe because every write that can move it arrives as
|
|
10
|
+
* an event that clears it. See docs/spec/access-control.md § Reach.
|
|
11
|
+
*/
|
|
12
|
+
import type { RosterRoles } from '../access.js';
|
|
13
|
+
import type { Reach, StackRecord } from '../types/index.js';
|
|
14
|
+
/** The verbs a reach is built for: one per thing a request can do to a Record. */
|
|
15
|
+
export type ReachVerb = 'create' | 'read' | 'update' | 'delete';
|
|
16
|
+
export type AuthoritySources = {
|
|
17
|
+
grants: () => Promise<StackRecord[]>;
|
|
18
|
+
roles: RosterRoles;
|
|
19
|
+
reach: (verb: ReachVerb, snapshot: AuthoritySnapshot) => Promise<Reach>;
|
|
20
|
+
};
|
|
21
|
+
export declare class AuthoritySnapshot {
|
|
22
|
+
private readonly sources;
|
|
23
|
+
private readonly grantSet;
|
|
24
|
+
private readonly roleSet;
|
|
25
|
+
private readonly reaches;
|
|
26
|
+
constructor(sources: AuthoritySources);
|
|
27
|
+
readonly grants: () => Promise<StackRecord[]>;
|
|
28
|
+
readonly roles: RosterRoles;
|
|
29
|
+
reach(verb: ReachVerb): Promise<Reach>;
|
|
30
|
+
/**
|
|
31
|
+
* Drop whatever a change to `typeFamily` can move, and every reach built
|
|
32
|
+
* from it. A load already in flight still answers the event that started
|
|
33
|
+
* it, which precedes the write; the next question loads afresh.
|
|
34
|
+
*/
|
|
35
|
+
invalidateFor(typeFamily: string): void;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=authority-snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authority-snapshot.d.ts","sourceRoot":"","sources":["../../src/scoped-stack/authority-snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE5D,kFAAkF;AAClF,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEhE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACrC,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;CACzE,CAAC;AAEF,qBAAa,iBAAiB;IAKhB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsB;IAC/C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyC;IACjE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqC;gBAEhC,OAAO,EAAE,gBAAgB;IAKtD,QAAQ,CAAC,MAAM,QAAO,OAAO,CAAC,WAAW,EAAE,CAAC,CAAwB;IACpE,QAAQ,CAAC,KAAK,EAAE,WAAW,CAA4B;IAEvD,KAAK,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC;IAStC;;;;OAIG;IACH,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;CAMxC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authority snapshot
|
|
3
|
+
* -------------------------------------------------------
|
|
4
|
+
* The authority one request acts with, read once: the `_grant` Records,
|
|
5
|
+
* the roles the subject holds on rosters, and the reach each verb builds
|
|
6
|
+
* from them — each loaded on first use and shared after, so an operation
|
|
7
|
+
* reads each at most once however many Records it decides. An operation
|
|
8
|
+
* takes its own and drops it when done; a subscription holds one for its
|
|
9
|
+
* life, which is only safe because every write that can move it arrives as
|
|
10
|
+
* an event that clears it. See docs/spec/access-control.md § Reach.
|
|
11
|
+
*/
|
|
12
|
+
import { Lazy } from '../lazy.js';
|
|
13
|
+
import { SYSTEM_TYPES } from '../types/index.js';
|
|
14
|
+
export class AuthoritySnapshot {
|
|
15
|
+
sources;
|
|
16
|
+
grantSet;
|
|
17
|
+
roleSet;
|
|
18
|
+
reaches = new Map();
|
|
19
|
+
constructor(sources) {
|
|
20
|
+
this.sources = sources;
|
|
21
|
+
this.grantSet = new Lazy(sources.grants);
|
|
22
|
+
this.roleSet = new Lazy(sources.roles);
|
|
23
|
+
}
|
|
24
|
+
grants = () => this.grantSet.get();
|
|
25
|
+
roles = () => this.roleSet.get();
|
|
26
|
+
reach(verb) {
|
|
27
|
+
let reach = this.reaches.get(verb);
|
|
28
|
+
if (!reach) {
|
|
29
|
+
reach = new Lazy(() => this.sources.reach(verb, this));
|
|
30
|
+
this.reaches.set(verb, reach);
|
|
31
|
+
}
|
|
32
|
+
return reach.get();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Drop whatever a change to `typeFamily` can move, and every reach built
|
|
36
|
+
* from it. A load already in flight still answers the event that started
|
|
37
|
+
* it, which precedes the write; the next question loads afresh.
|
|
38
|
+
*/
|
|
39
|
+
invalidateFor(typeFamily) {
|
|
40
|
+
if (typeFamily === SYSTEM_TYPES.GRANT)
|
|
41
|
+
this.grantSet.clear();
|
|
42
|
+
else if (typeFamily === SYSTEM_TYPES.GROUP)
|
|
43
|
+
this.roleSet.clear();
|
|
44
|
+
else
|
|
45
|
+
return;
|
|
46
|
+
this.reaches.clear();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=authority-snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authority-snapshot.js","sourceRoot":"","sources":["../../src/scoped-stack/authority-snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAajD,MAAM,OAAO,iBAAiB;IAKC;IAJZ,QAAQ,CAAsB;IAC9B,OAAO,CAAyC;IAChD,OAAO,GAAG,IAAI,GAAG,EAA0B,CAAC;IAE7D,YAA6B,OAAyB;QAAzB,YAAO,GAAP,OAAO,CAAkB;QACpD,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,OAAO,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAEQ,MAAM,GAAG,GAA2B,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;IAC3D,KAAK,GAAgB,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;IAEvD,KAAK,CAAC,IAAe;QACnB,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,KAAK,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YACvD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAChC,CAAC;QACD,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC;IACrB,CAAC;IAED;;;;OAIG;IACH,aAAa,CAAC,UAAkB;QAC9B,IAAI,UAAU,KAAK,YAAY,CAAC,KAAK;YAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;aACxD,IAAI,UAAU,KAAK,YAAY,CAAC,KAAK;YAAE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;;YAC5D,OAAO;QACZ,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -8,9 +8,12 @@
|
|
|
8
8
|
* writes. See docs/spec/access-control.md § Delegation: principal and
|
|
9
9
|
* subject.
|
|
10
10
|
*/
|
|
11
|
-
import type {
|
|
11
|
+
import type { ReachedRecord } from '../adapter/reach.js';
|
|
12
12
|
import { StackError } from '../errors.js';
|
|
13
|
-
import type {
|
|
13
|
+
import type { SplitQuery } from '../query-validation.js';
|
|
14
|
+
import { AuthoritySnapshot } from './authority-snapshot.js';
|
|
15
|
+
import type { ReachVerb } from './authority-snapshot.js';
|
|
16
|
+
import type { Actor, EntityId, QueryResult, Reach, StackRecord, TypeId } from '../types/index.js';
|
|
14
17
|
import type { Stack } from '../stack/stack.js';
|
|
15
18
|
export declare class ScopeAuthority {
|
|
16
19
|
private readonly stack;
|
|
@@ -18,14 +21,22 @@ export declare class ScopeAuthority {
|
|
|
18
21
|
readonly principalId: EntityId | null;
|
|
19
22
|
/** Whom this request acts for and attributes writes to — see ScopedStack.subjectId. */
|
|
20
23
|
readonly subjectId: EntityId | null;
|
|
24
|
+
/** Stack.query() within a reach — see ScopedStack.query(). */
|
|
25
|
+
private readonly queryReadable;
|
|
21
26
|
constructor(stack: Stack,
|
|
22
27
|
/** Whose grants bound what this request may do — see ScopedStack.principalId. */
|
|
23
28
|
principalId: EntityId | null,
|
|
24
29
|
/** Whom this request acts for and attributes writes to — see ScopedStack.subjectId. */
|
|
25
|
-
subjectId: EntityId | null
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
subjectId: EntityId | null,
|
|
31
|
+
/** Stack.query() within a reach — see ScopedStack.query(). */
|
|
32
|
+
queryReadable: (split: SplitQuery, reach: Reach) => Promise<QueryResult>);
|
|
33
|
+
/**
|
|
34
|
+
* The authority this request acts with, for one operation: pass it to
|
|
35
|
+
* each check the operation makes, so the grants, the rosters and each
|
|
36
|
+
* verb's reach are read at most once. An anonymous request is named by no
|
|
37
|
+
* grant and held by no roster, so it reads neither.
|
|
38
|
+
*/
|
|
39
|
+
snapshot(): AuthoritySnapshot;
|
|
29
40
|
/** Whether a delegated app is acting for someone other than itself. */
|
|
30
41
|
get delegated(): boolean;
|
|
31
42
|
/**
|
|
@@ -50,48 +61,50 @@ export declare class ScopeAuthority {
|
|
|
50
61
|
* See docs/spec/access-control.md § Delegation: principal and subject.
|
|
51
62
|
*/
|
|
52
63
|
get ownerActingAlone(): boolean;
|
|
53
|
-
/** Whether the record's own permissions let the subject `mode` it. */
|
|
54
|
-
recordPermits(record: StackRecord, mode: AccessMode): Promise<boolean>;
|
|
55
64
|
/**
|
|
56
|
-
* Whether
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
|
|
65
|
+
* Whether no grant bounds the principal: undelegated, it is the subject
|
|
66
|
+
* itself, and the owner as principal is the owner's own software.
|
|
67
|
+
* See docs/spec/access-control.md § Delegation: principal and subject.
|
|
68
|
+
*/
|
|
69
|
+
private get principalUnbounded();
|
|
70
|
+
/**
|
|
71
|
+
* The families `grantee`'s grants convey one of `actions` on, read the way
|
|
72
|
+
* `side` reads a grant. Only the subject's side counts a group, so the
|
|
73
|
+
* rosters read are always the subject's.
|
|
74
|
+
* See docs/spec/access-control.md § Who a grant reaches.
|
|
60
75
|
*/
|
|
61
|
-
private
|
|
76
|
+
private familiesConveying;
|
|
62
77
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
78
|
+
* What this request may do with `verb` — that verb's rules, built whole
|
|
79
|
+
* even where a Record's own permissions would settle it, since every gate
|
|
80
|
+
* asks one value at a flat cost. The principal's grants fence it; within,
|
|
81
|
+
* the subject reaches what grants and permissions give it, an owner
|
|
82
|
+
* subject everything. See docs/spec/access-control.md § Reach.
|
|
67
83
|
*/
|
|
68
|
-
|
|
84
|
+
private buildReach;
|
|
69
85
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* installMayMigrate().
|
|
86
|
+
* The permission elements carrying `bit` to the subject, as the sets a
|
|
87
|
+
* Record must hold whole. A `read` stands alone, as does `anyone`; a
|
|
88
|
+
* `write` stands beside one of its readCompanions().
|
|
74
89
|
*/
|
|
75
|
-
|
|
90
|
+
private elementSets;
|
|
91
|
+
/** Whether this request may `verb` the Record: its reach, asked of one Record. */
|
|
92
|
+
may(verb: ReachVerb, record: ReachedRecord, snapshot: AuthoritySnapshot): Promise<boolean>;
|
|
76
93
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* subject is the entity a grant is written about.
|
|
94
|
+
* may() with the principal's fence set aside — whether the subject alone
|
|
95
|
+
* reaches the Record, for a refusal that says which side lacked the verb.
|
|
80
96
|
*/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}): Promise<boolean>;
|
|
97
|
+
subjectMay(verb: ReachVerb, record: ReachedRecord, snapshot: AuthoritySnapshot): Promise<boolean>;
|
|
98
|
+
canRead(record: StackRecord, snapshot: AuthoritySnapshot): Promise<boolean>;
|
|
99
|
+
/** Whether this request may create a Record of the type, asked of the Record it would make. */
|
|
100
|
+
canCreate(typeId: TypeId, snapshot: AuthoritySnapshot): Promise<boolean>;
|
|
86
101
|
/**
|
|
87
102
|
* How to refuse a record this request addressed by ID: a permission error
|
|
88
103
|
* to a requester who can read it, the not-found answer to anyone else, so
|
|
89
104
|
* `message` only reaches someone holding the record already.
|
|
90
105
|
* See docs/spec/disclosure.md § Which refusal a Record answers with.
|
|
91
106
|
*/
|
|
92
|
-
denialFor(record: StackRecord, message: string): Promise<StackError>;
|
|
93
|
-
canRead(record: StackRecord, prefetchedGrants?: StackRecord[], groupRoles?: Map<string, GroupRole | null>): Promise<boolean>;
|
|
94
|
-
checkCreateGrant(typeId: TypeId): Promise<boolean>;
|
|
107
|
+
denialFor(record: StackRecord, message: string, snapshot: AuthoritySnapshot): Promise<StackError>;
|
|
95
108
|
/**
|
|
96
109
|
* `_group` records are managed, not merely written: only the owner or an
|
|
97
110
|
* `admin` roster holder may mutate them — ordinary write permissions and
|
|
@@ -107,28 +120,28 @@ export declare class ScopeAuthority {
|
|
|
107
120
|
* owner acting alone skips the lookup and leaves absence to `Stack`.
|
|
108
121
|
* See docs/spec/access-control.md § Reference-creation gating.
|
|
109
122
|
*/
|
|
110
|
-
canReadReferent(recordId: string): Promise<boolean>;
|
|
123
|
+
canReadReferent(recordId: string, snapshot: AuthoritySnapshot): Promise<boolean>;
|
|
111
124
|
/**
|
|
112
125
|
* Whether this request can read some record referencing `fileId`, other
|
|
113
126
|
* than an `_attachment@1` record — otherwise one correct guess would
|
|
114
127
|
* unlock unlimited further metadata records for the file.
|
|
115
128
|
* See docs/spec/attachments.md § Creating `_attachment@1` records directly.
|
|
116
129
|
*/
|
|
117
|
-
hasReadableReference(fileId: string): Promise<boolean>;
|
|
130
|
+
hasReadableReference(fileId: string, snapshot: AuthoritySnapshot): Promise<boolean>;
|
|
118
131
|
/**
|
|
119
132
|
* Whether this request may reference or download `fileId` — the dual of
|
|
120
133
|
* getAttachment()'s access rule. Nonexistent and inaccessible are
|
|
121
134
|
* indistinguishable (both false), so no confirmation oracle for guessed
|
|
122
135
|
* hashes. See docs/spec/access-control.md § Reference-creation gating.
|
|
123
136
|
*/
|
|
124
|
-
canAccessFile(fileId: string): Promise<boolean>;
|
|
137
|
+
canAccessFile(fileId: string, snapshot: AuthoritySnapshot): Promise<boolean>;
|
|
125
138
|
/**
|
|
126
139
|
* Whether this request is an installed app, acting as itself, migrating
|
|
127
140
|
* `record` within families its one live install claims, to a version the
|
|
128
141
|
* owner approved, holding `update-any` on each directly.
|
|
129
142
|
* See docs/spec/apps.md § Migrating an installed app's types.
|
|
130
143
|
*/
|
|
131
|
-
installMayMigrate(record: StackRecord, toTypeId: TypeId): Promise<boolean>;
|
|
144
|
+
installMayMigrate(record: StackRecord, toTypeId: TypeId, snapshot: AuthoritySnapshot): Promise<boolean>;
|
|
132
145
|
/** Names of the type's top-level file-ref fields — the content-reference half of referencesFileId matching. */
|
|
133
146
|
fileRefFieldNames(typeId: TypeId): Promise<string[]>;
|
|
134
147
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authority.d.ts","sourceRoot":"","sources":["../../src/scoped-stack/authority.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"authority.d.ts","sourceRoot":"","sources":["../../src/scoped-stack/authority.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,UAAU,EAA4C,MAAM,cAAc,CAAC;AAQpF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAWzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,EACV,KAAK,EAKL,QAAQ,EAKR,WAAW,EACX,KAAK,EACL,WAAW,EACX,MAAM,EACP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AA0B/C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