@haverstack/core 0.40.0 → 0.42.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 +121 -59
- package/dist/access.d.ts +34 -36
- package/dist/access.d.ts.map +1 -1
- package/dist/access.js +65 -42
- package/dist/access.js.map +1 -1
- package/dist/{combine.d.ts → adapter/combine.d.ts} +8 -1
- package/dist/adapter/combine.d.ts.map +1 -0
- package/dist/{combine.js → adapter/combine.js} +7 -0
- package/dist/adapter/combine.js.map +1 -0
- package/dist/{adapter-entry.d.ts → adapter/index.d.ts} +6 -5
- package/dist/adapter/index.d.ts.map +1 -0
- package/dist/{adapter-entry.js → adapter/index.js} +5 -4
- package/dist/adapter/index.js.map +1 -0
- package/dist/{sort.d.ts → adapter/sort.d.ts} +20 -20
- package/dist/adapter/sort.d.ts.map +1 -0
- package/dist/{sort.js → adapter/sort.js} +37 -27
- package/dist/adapter/sort.js.map +1 -0
- package/dist/associations/identity.d.ts +93 -0
- package/dist/associations/identity.d.ts.map +1 -0
- package/dist/associations/identity.js +198 -0
- package/dist/associations/identity.js.map +1 -0
- package/dist/associations/validation.d.ts +90 -0
- package/dist/associations/validation.d.ts.map +1 -0
- package/dist/associations/validation.js +339 -0
- package/dist/associations/validation.js.map +1 -0
- package/dist/attachment-records.d.ts +48 -0
- package/dist/attachment-records.d.ts.map +1 -0
- package/dist/attachment-records.js +52 -0
- package/dist/attachment-records.js.map +1 -0
- package/dist/collection.d.ts +182 -0
- package/dist/collection.d.ts.map +1 -0
- package/dist/collection.js +407 -0
- package/dist/collection.js.map +1 -0
- package/dist/content-match.d.ts +25 -0
- package/dist/content-match.d.ts.map +1 -0
- package/dist/content-match.js +51 -0
- package/dist/content-match.js.map +1 -0
- package/dist/content-translation.d.ts +42 -0
- package/dist/content-translation.d.ts.map +1 -0
- package/dist/content-translation.js +108 -0
- package/dist/content-translation.js.map +1 -0
- package/dist/did/did.d.ts.map +1 -0
- package/dist/{did.js → did/did.js} +3 -4
- package/dist/did/did.js.map +1 -0
- package/dist/{did-entry.d.ts → did/index.d.ts} +1 -1
- package/dist/did/index.d.ts.map +1 -0
- package/dist/{did-entry.js → did/index.js} +3 -3
- package/dist/did/index.js.map +1 -0
- package/dist/errors.d.ts +36 -63
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +35 -58
- package/dist/errors.js.map +1 -1
- package/dist/grants.d.ts +20 -43
- package/dist/grants.d.ts.map +1 -1
- package/dist/grants.js +71 -134
- package/dist/grants.js.map +1 -1
- package/dist/id.d.ts +13 -31
- package/dist/id.d.ts.map +1 -1
- package/dist/id.js +13 -31
- package/dist/id.js.map +1 -1
- package/dist/index.d.ts +14 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +141 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +219 -0
- package/dist/install.js.map +1 -0
- package/dist/merge.d.ts.map +1 -1
- package/dist/merge.js +5 -11
- package/dist/merge.js.map +1 -1
- package/dist/migration-steps.d.ts +102 -0
- package/dist/migration-steps.d.ts.map +1 -0
- package/dist/migration-steps.js +293 -0
- package/dist/migration-steps.js.map +1 -0
- package/dist/query-validation.d.ts +28 -94
- package/dist/query-validation.d.ts.map +1 -1
- package/dist/query-validation.js +156 -336
- package/dist/query-validation.js.map +1 -1
- package/dist/record-changes.d.ts +2 -117
- package/dist/record-changes.d.ts.map +1 -1
- package/dist/record-changes.js +10 -212
- package/dist/record-changes.js.map +1 -1
- package/dist/schema.d.ts +18 -7
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +59 -30
- package/dist/schema.js.map +1 -1
- package/dist/scoped-stack/authority.d.ts +156 -0
- package/dist/scoped-stack/authority.d.ts.map +1 -0
- package/dist/scoped-stack/authority.js +384 -0
- package/dist/scoped-stack/authority.js.map +1 -0
- package/dist/scoped-stack/scoped-stack.d.ts +338 -0
- package/dist/scoped-stack/scoped-stack.d.ts.map +1 -0
- package/dist/scoped-stack/scoped-stack.js +776 -0
- package/dist/scoped-stack/scoped-stack.js.map +1 -0
- package/dist/scoped-stack/subscription.d.ts +55 -0
- package/dist/scoped-stack/subscription.d.ts.map +1 -0
- package/dist/scoped-stack/subscription.js +110 -0
- package/dist/scoped-stack/subscription.js.map +1 -0
- package/dist/stack/attachments.d.ts +24 -0
- package/dist/stack/attachments.d.ts.map +1 -0
- package/dist/stack/attachments.js +113 -0
- package/dist/stack/attachments.js.map +1 -0
- package/dist/{changes.d.ts → stack/changes.d.ts} +29 -65
- package/dist/stack/changes.d.ts.map +1 -0
- package/dist/{changes.js → stack/changes.js} +32 -66
- package/dist/stack/changes.js.map +1 -0
- package/dist/stack/client.d.ts +271 -0
- package/dist/stack/client.d.ts.map +1 -0
- package/dist/stack/client.js +9 -0
- package/dist/stack/client.js.map +1 -0
- package/dist/stack/identity-bindings.d.ts.map +1 -0
- package/dist/{identity-bindings.js → stack/identity-bindings.js} +8 -14
- package/dist/stack/identity-bindings.js.map +1 -0
- package/dist/stack/install-app.d.ts +22 -0
- package/dist/stack/install-app.d.ts.map +1 -0
- package/dist/stack/install-app.js +260 -0
- package/dist/stack/install-app.js.map +1 -0
- package/dist/stack/integrity.d.ts +94 -0
- package/dist/stack/integrity.d.ts.map +1 -0
- package/dist/stack/integrity.js +268 -0
- package/dist/stack/integrity.js.map +1 -0
- package/dist/{limits.d.ts → stack/limits.d.ts} +2 -5
- package/dist/stack/limits.d.ts.map +1 -0
- package/dist/{limits.js → stack/limits.js} +3 -6
- package/dist/stack/limits.js.map +1 -0
- package/dist/stack/migrations.d.ts +59 -0
- package/dist/stack/migrations.d.ts.map +1 -0
- package/dist/stack/migrations.js +141 -0
- package/dist/stack/migrations.js.map +1 -0
- package/dist/{stack-reads.d.ts → stack/reads.d.ts} +33 -6
- package/dist/stack/reads.d.ts.map +1 -0
- package/dist/{stack-reads.js → stack/reads.js} +49 -7
- package/dist/stack/reads.js.map +1 -0
- package/dist/stack/record-id.d.ts +35 -0
- package/dist/stack/record-id.d.ts.map +1 -0
- package/dist/stack/record-id.js +82 -0
- package/dist/stack/record-id.js.map +1 -0
- package/dist/stack/stack.d.ts +438 -0
- package/dist/stack/stack.d.ts.map +1 -0
- package/dist/stack/stack.js +1366 -0
- package/dist/stack/stack.js.map +1 -0
- package/dist/stack/system-types.d.ts +16 -0
- package/dist/stack/system-types.d.ts.map +1 -0
- package/dist/stack/system-types.js +111 -0
- package/dist/stack/system-types.js.map +1 -0
- package/dist/stack/type-grants.d.ts +20 -0
- package/dist/stack/type-grants.d.ts.map +1 -0
- package/dist/stack/type-grants.js +69 -0
- package/dist/stack/type-grants.js.map +1 -0
- package/dist/stack/write-expectation.d.ts +78 -0
- package/dist/stack/write-expectation.d.ts.map +1 -0
- package/dist/stack/write-expectation.js +71 -0
- package/dist/stack/write-expectation.js.map +1 -0
- package/dist/testing.d.ts +21 -26
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +50 -70
- package/dist/testing.js.map +1 -1
- package/dist/type-handle.d.ts +67 -78
- package/dist/type-handle.d.ts.map +1 -1
- package/dist/type-handle.js +44 -111
- package/dist/type-handle.js.map +1 -1
- package/dist/types/adapter.d.ts +223 -0
- package/dist/types/adapter.d.ts.map +1 -0
- package/dist/types/adapter.js +5 -0
- package/dist/types/adapter.js.map +1 -0
- package/dist/types/associations.d.ts +156 -0
- package/dist/types/associations.d.ts.map +1 -0
- package/dist/types/associations.js +13 -0
- package/dist/types/associations.js.map +1 -0
- package/dist/types/capabilities.d.ts +89 -0
- package/dist/types/capabilities.d.ts.map +1 -0
- package/dist/types/capabilities.js +5 -0
- package/dist/types/capabilities.js.map +1 -0
- package/dist/types/events.d.ts +155 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +5 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/ids.d.ts +43 -0
- package/dist/types/ids.d.ts.map +1 -0
- package/dist/types/ids.js +5 -0
- package/dist/types/ids.js.map +1 -0
- package/dist/types/index.d.ts +19 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +19 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/journal.d.ts +47 -0
- package/dist/types/journal.d.ts.map +1 -0
- package/dist/types/journal.js +5 -0
- package/dist/types/journal.js.map +1 -0
- package/dist/types/query.d.ts +185 -0
- package/dist/types/query.d.ts.map +1 -0
- package/dist/types/query.js +10 -0
- package/dist/types/query.js.map +1 -0
- package/dist/types/records.d.ts +76 -0
- package/dist/types/records.d.ts.map +1 -0
- package/dist/types/records.js +5 -0
- package/dist/types/records.js.map +1 -0
- package/dist/types/schema.d.ts +74 -0
- package/dist/types/schema.d.ts.map +1 -0
- package/dist/types/schema.js +5 -0
- package/dist/types/schema.js.map +1 -0
- package/dist/types/system.d.ts +161 -0
- package/dist/types/system.d.ts.map +1 -0
- package/dist/types/system.js +32 -0
- package/dist/types/system.js.map +1 -0
- package/dist/types/tokens.d.ts +39 -0
- package/dist/types/tokens.d.ts.map +1 -0
- package/dist/types/tokens.js +5 -0
- package/dist/types/tokens.js.map +1 -0
- package/dist/validate.d.ts +29 -70
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +65 -97
- package/dist/validate.js.map +1 -1
- package/dist/{attachment-download.d.ts → wire/attachment-download.d.ts} +0 -57
- package/dist/wire/attachment-download.d.ts.map +1 -0
- package/dist/{attachment-download.js → wire/attachment-download.js} +0 -61
- package/dist/wire/attachment-download.js.map +1 -0
- package/dist/{auth.d.ts → wire/auth.d.ts} +5 -8
- package/dist/wire/auth.d.ts.map +1 -0
- package/dist/{auth.js → wire/auth.js} +5 -8
- package/dist/wire/auth.js.map +1 -0
- package/dist/{wire-body.d.ts → wire/body.d.ts} +13 -5
- package/dist/wire/body.d.ts.map +1 -0
- package/dist/{wire-body.js → wire/body.js} +65 -7
- package/dist/wire/body.js.map +1 -0
- package/dist/{wire-entry.d.ts → wire/index.d.ts} +12 -12
- package/dist/wire/index.d.ts.map +1 -0
- package/dist/{wire-entry.js → wire/index.js} +13 -17
- package/dist/wire/index.js.map +1 -0
- package/dist/{wire-record.d.ts → wire/record.d.ts} +10 -22
- package/dist/wire/record.d.ts.map +1 -0
- package/dist/{wire-record.js → wire/record.js} +12 -24
- package/dist/wire/record.js.map +1 -0
- package/dist/{wire-request.d.ts → wire/request.d.ts} +20 -37
- package/dist/wire/request.d.ts.map +1 -0
- package/dist/{wire-request.js → wire/request.js} +79 -54
- package/dist/wire/request.js.map +1 -0
- package/package.json +7 -7
- package/dist/adapter-entry.d.ts.map +0 -1
- package/dist/adapter-entry.js.map +0 -1
- package/dist/attachment-download.d.ts.map +0 -1
- package/dist/attachment-download.js.map +0 -1
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js.map +0 -1
- package/dist/changes.d.ts.map +0 -1
- package/dist/changes.js.map +0 -1
- package/dist/combine.d.ts.map +0 -1
- package/dist/combine.js.map +0 -1
- package/dist/did-entry.d.ts.map +0 -1
- package/dist/did-entry.js.map +0 -1
- package/dist/did.d.ts.map +0 -1
- package/dist/did.js.map +0 -1
- package/dist/identity-bindings.d.ts.map +0 -1
- package/dist/identity-bindings.js.map +0 -1
- package/dist/limits.d.ts.map +0 -1
- package/dist/limits.js.map +0 -1
- package/dist/record-id.d.ts +0 -70
- package/dist/record-id.d.ts.map +0 -1
- package/dist/record-id.js +0 -127
- package/dist/record-id.js.map +0 -1
- package/dist/scoped-stack.d.ts +0 -532
- package/dist/scoped-stack.d.ts.map +0 -1
- package/dist/scoped-stack.js +0 -1219
- package/dist/scoped-stack.js.map +0 -1
- package/dist/sort.d.ts.map +0 -1
- package/dist/sort.js.map +0 -1
- package/dist/stack-reads.d.ts.map +0 -1
- package/dist/stack-reads.js.map +0 -1
- package/dist/stack.d.ts +0 -971
- package/dist/stack.d.ts.map +0 -1
- package/dist/stack.js +0 -2012
- package/dist/stack.js.map +0 -1
- package/dist/types.d.ts +0 -1250
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -49
- package/dist/types.js.map +0 -1
- package/dist/wire-body.d.ts.map +0 -1
- package/dist/wire-body.js.map +0 -1
- package/dist/wire-entry.d.ts.map +0 -1
- package/dist/wire-entry.js.map +0 -1
- package/dist/wire-record.d.ts.map +0 -1
- package/dist/wire-record.js.map +0 -1
- package/dist/wire-request.d.ts.map +0 -1
- package/dist/wire-request.js.map +0 -1
- /package/dist/{did.d.ts → did/did.d.ts} +0 -0
- /package/dist/{identity-bindings.d.ts → stack/identity-bindings.d.ts} +0 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content queries across versions
|
|
3
|
+
* -------------------------------------------------------
|
|
4
|
+
* A collection's content filter and sort are written in its handle's
|
|
5
|
+
* shape, and an adapter matches content as stored. These functions rewrite
|
|
6
|
+
* one predicate or sort field into an older version's shape, through the
|
|
7
|
+
* field origins a migration chain declares, or say why they cannot: an arm
|
|
8
|
+
* no record at that version can match is dropped, and one that does not
|
|
9
|
+
* translate is narrowed. See docs/spec/data-model.md § Content queries
|
|
10
|
+
* across versions.
|
|
11
|
+
*/
|
|
12
|
+
import { matchesContent } from './content-match.js';
|
|
13
|
+
import { sortConstant } from './adapter/sort.js';
|
|
14
|
+
import { parseContentFilterKey } from './query-validation.js';
|
|
15
|
+
/** No record at the version can match, so its arm is dropped without a skip. */
|
|
16
|
+
export const UNMATCHABLE = 'unmatchable';
|
|
17
|
+
/** The version is narrowed: left out of the query, and reported if it matches the rest. */
|
|
18
|
+
export const UNTRANSLATABLE = 'untranslatable';
|
|
19
|
+
/**
|
|
20
|
+
* The older values a `map` sends to `value`, mapped ones first. A value no
|
|
21
|
+
* entry names maps to itself, and `map` reaches strings only.
|
|
22
|
+
*/
|
|
23
|
+
const sourcesOf = (values, value) => {
|
|
24
|
+
if (typeof value !== 'string')
|
|
25
|
+
return [value];
|
|
26
|
+
const sources = Object.keys(values).filter((from) => values[from] === value);
|
|
27
|
+
if (!Object.hasOwn(values, value))
|
|
28
|
+
sources.push(value);
|
|
29
|
+
return sources;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Whether a constant satisfies one key, decided as an adapter would decide
|
|
33
|
+
* it against a record holding the constant at `field`.
|
|
34
|
+
*/
|
|
35
|
+
const constantMatches = (field, origin, predicate) => matchesContent(origin.value === undefined ? {} : { [field]: origin.value }, predicate);
|
|
36
|
+
/**
|
|
37
|
+
* `predicate`, written in the handle's shape, as the arm for the version
|
|
38
|
+
* `origins` describes. A key is translated by its top-level field: the
|
|
39
|
+
* rest of its path is kept, since steps reach top-level fields only.
|
|
40
|
+
*/
|
|
41
|
+
export const translateArm = (origins, predicate) => {
|
|
42
|
+
const content = {};
|
|
43
|
+
const present = [];
|
|
44
|
+
let split;
|
|
45
|
+
const keys = [
|
|
46
|
+
...Object.entries(predicate.content ?? {}).map(([key, value]) => [key, value, false]),
|
|
47
|
+
...(predicate.contentPresent ?? []).map((key) => [key, undefined, true]),
|
|
48
|
+
];
|
|
49
|
+
for (const [key, value, presence] of keys) {
|
|
50
|
+
const [field, ...rest] = parseContentFilterKey(key);
|
|
51
|
+
const origin = origins.get(field);
|
|
52
|
+
if (!origin || origin.kind === 'derived')
|
|
53
|
+
return UNTRANSLATABLE;
|
|
54
|
+
if (origin.kind === 'constant') {
|
|
55
|
+
const asked = presence ? { contentPresent: [key] } : { content: { [key]: value } };
|
|
56
|
+
if (!constantMatches(field, origin, asked))
|
|
57
|
+
return UNMATCHABLE;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
const path = [origin.field, ...rest].join('.');
|
|
61
|
+
if (presence) {
|
|
62
|
+
present.push(path);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
// A path below a mapped field reaches no string, so only the field's
|
|
66
|
+
// own values are remapped; `null` is never one of them.
|
|
67
|
+
if (!origin.values || rest.length > 0 || value === null || value === undefined) {
|
|
68
|
+
content[path] = value;
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const [first, ...others] = sourcesOf(origin.values, value);
|
|
72
|
+
if (first === undefined)
|
|
73
|
+
return UNMATCHABLE;
|
|
74
|
+
// One split per arm keeps the probes to one per source; two would
|
|
75
|
+
// multiply them.
|
|
76
|
+
if (others.length > 0) {
|
|
77
|
+
if (split)
|
|
78
|
+
return UNTRANSLATABLE;
|
|
79
|
+
split = { path, others };
|
|
80
|
+
}
|
|
81
|
+
content[path] = first;
|
|
82
|
+
}
|
|
83
|
+
const arm = {
|
|
84
|
+
...(Object.keys(content).length > 0 && { content }),
|
|
85
|
+
...(present.length > 0 && { contentPresent: present }),
|
|
86
|
+
};
|
|
87
|
+
const residuals = (split?.others ?? []).map((other) => ({
|
|
88
|
+
...arm,
|
|
89
|
+
content: { ...content, [split.path]: other },
|
|
90
|
+
}));
|
|
91
|
+
return { arm, residuals };
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* What a record at the version `origins` describes orders by, for a sort
|
|
95
|
+
* on the handle's `field` of `kind`. A remapped field is narrowed, since
|
|
96
|
+
* remapped values don't keep their order.
|
|
97
|
+
*/
|
|
98
|
+
export const translateSortKey = (origins, field, kind) => {
|
|
99
|
+
const origin = origins.get(field);
|
|
100
|
+
if (!origin || !kind || origin.kind === 'derived')
|
|
101
|
+
return UNTRANSLATABLE;
|
|
102
|
+
if (origin.kind === 'constant')
|
|
103
|
+
return { value: sortConstant(kind, origin.value) };
|
|
104
|
+
if (origin.values && Object.keys(origin.values).length > 0)
|
|
105
|
+
return UNTRANSLATABLE;
|
|
106
|
+
return { field: origin.field };
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=content-translation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-translation.js","sourceRoot":"","sources":["../src/content-translation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,qB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AASF;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,OAAyC,CAAC;AAMrF,eAAO,MAAM,WAAW,GAAU,YAAY,SAAS,EAAE,MAAM,UAAU,KAAG,OAAO,CAAC,UAAU,CACP,CAAC;AAExF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,KAAK,MAAM,EACX,WAAW,UAAU,EACrB,MAAM,UAAU,KACf,OAAO,CAAC,OAAO,CAQjB,CAAC;AAUF,eAAO,MAAM,sBAAsB,GAAU,YAAY,SAAS,KAAG,OAAO,CAAC,UAAU,CAC3C,CAAC;AAE7C,eAAO,MAAM,sBAAsB,GAAU,KAAK,UAAU,KAAG,OAAO,CAAC,SAAS,CAChB,CAAC"}
|
|
@@ -153,10 +153,9 @@ export const verifyDidSignature = async (did, signature, data) => {
|
|
|
153
153
|
// Private-key export/import
|
|
154
154
|
// -------------------------------------------------------
|
|
155
155
|
//
|
|
156
|
-
// Core never stores a private key
|
|
157
|
-
//
|
|
158
|
-
//
|
|
159
|
-
// key lives is an app/UX concern, not this library's.
|
|
156
|
+
// Core never stores a private key: these let a caller persist what
|
|
157
|
+
// generateDidKeypair() returned and reconstruct it on a later run. Where
|
|
158
|
+
// the key lives is the app's concern.
|
|
160
159
|
export const exportDidPrivateKeyJwk = async (privateKey) => crypto.subtle.exportKey('jwk', privateKey);
|
|
161
160
|
export const importDidPrivateKeyJwk = async (jwk) => crypto.subtle.importKey('jwk', jwk, 'Ed25519', true, ['sign']);
|
|
162
161
|
//# sourceMappingURL=did.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did.js","sourceRoot":"","sources":["../../src/did/did.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,0DAA0D;AAC1D,SAAS;AACT,0DAA0D;AAE1D,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAO,GAAG,EAAE;QACtB,KAAK,CAAC,OAAO,IAAI,cAA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GAAG,MAAM,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACjD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CACzB,SAAS,EACT,SAAS,EACT,IAAI,UAAU,CAAC,SAAS,CAAC,EACzB,IAAI,UAAU,CAAC,IAAI,CAAC,CACrB,CAAC;AACJ,CAAC,CAAC;AAEF,0DAA0D;AAC1D,4BAA4B;AAC5B,0DAA0D;AAC1D,EAAE;AACF,mEAAmE;AACnE,yEAAyE;AACzE,sCAAsC;AAEtC,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EAAE,UAAqB,EAAuB,EAAE,CACzF,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAE7C,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EAAE,GAAe,EAAsB,EAAE,CAClF,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -10,4 +10,4 @@ export type { DidKeypair } from './did.js';
|
|
|
10
10
|
export { isValidDid } from './did.js';
|
|
11
11
|
export { isValidDidKey } from './did.js';
|
|
12
12
|
export { signWithDid, exportDidPrivateKeyJwk, importDidPrivateKeyJwk } from './did.js';
|
|
13
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/did/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnF,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAKtC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKzC,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* keygen and key custody, and protocol implementers verifying signatures.
|
|
7
7
|
*/
|
|
8
8
|
export { InvalidDidError, generateDidKeypair, verifyDidSignature } from './did.js';
|
|
9
|
-
// No in-repo caller:
|
|
10
|
-
//
|
|
9
|
+
// No in-repo caller: a server validates its configured owner DID with this
|
|
10
|
+
// at startup.
|
|
11
11
|
export { isValidDid } from './did.js';
|
|
12
12
|
// No in-repo caller: it exists for callers needing the did:key narrowing
|
|
13
13
|
// isValidDid()'s docstring points to — rejecting a method
|
|
@@ -17,4 +17,4 @@ export { isValidDidKey } from './did.js';
|
|
|
17
17
|
// exportDidPrivateKeyJwk() -> store -> importDidPrivateKeyJwk() ->
|
|
18
18
|
// signWithDid() as the key-custody journey an app follows.
|
|
19
19
|
export { signWithDid, exportDidPrivateKeyJwk, importDidPrivateKeyJwk } from './did.js';
|
|
20
|
-
//# sourceMappingURL=
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/did/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnF,2EAA2E;AAC3E,cAAc;AACd,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,yEAAyE;AACzE,0DAA0D;AAC1D,8DAA8D;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,4DAA4D;AAC5D,mEAAmE;AACnE,2DAA2D;AAC3D,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -8,16 +8,17 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Several errors sit deliberately outside that root (UseAfterCloseError,
|
|
10
10
|
* InvalidAdapterError, OwnerMismatchError, RelayScopeError, and — in their own
|
|
11
|
-
* modules — IdGenerationError
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* modules — IdGenerationError, InvalidDidError, InvalidAuthChallengeError,
|
|
12
|
+
* StoredVersionError and MisfitError): they report a local programming error, malformed
|
|
13
|
+
* local input or an assembled topology, not a state a request can be in, so
|
|
14
|
+
* no server ever responds with one.
|
|
14
15
|
*
|
|
15
16
|
* The `Stack` prefix is reserved for the taxonomy: a class named
|
|
16
17
|
* `Stack…Error` extends StackError, and nothing else carries the prefix.
|
|
17
18
|
*/
|
|
18
19
|
import type { SchemaDriftViolation } from './schema.js';
|
|
19
20
|
import type { ValidationError } from './validate.js';
|
|
20
|
-
import type { EntityId, MissingCapability, TypeId } from './types.js';
|
|
21
|
+
import type { EntityId, MissingCapability, TypeId } from './types/index.js';
|
|
21
22
|
/**
|
|
22
23
|
* The wire-protocol discriminator vocabulary, one code per Stack-domain
|
|
23
24
|
* error class. Lives here rather than in @haverstack/wire-types because the
|
|
@@ -26,29 +27,27 @@ import type { EntityId, MissingCapability, TypeId } from './types.js';
|
|
|
26
27
|
*/
|
|
27
28
|
export type StackErrorCode = 'bad_request' | 'permission' | 'not_found' | 'conflict' | 'version_conflict' | 'validation' | 'migration' | 'schema_drift' | 'payload_too_large' | 'timeout';
|
|
28
29
|
/**
|
|
29
|
-
* Root of the
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* than a chain of class tests.
|
|
35
|
-
*
|
|
36
|
-
* Membership implies a wire mapping: every code has an entry in
|
|
37
|
-
* WIRE_ERROR_STATUS. Errors with no wire representation (IdGenerationError,
|
|
38
|
-
* InvalidDidError) deliberately stay outside this hierarchy.
|
|
39
|
-
*
|
|
40
|
-
* Subclassing adds no hierarchy beyond this root — notably
|
|
41
|
-
* StackVersionConflictError is a sibling of StackConflictError, not a
|
|
42
|
-
* subtype. See docs/spec/wire-format.md § Error responses.
|
|
30
|
+
* Root of the taxonomy: `instanceof StackError` is the one question a
|
|
31
|
+
* server's error middleware asks, and each subclass's `code` makes
|
|
32
|
+
* serialization a lookup. Every code has a WIRE_ERROR_STATUS entry.
|
|
33
|
+
* Subclasses add no hierarchy — StackVersionConflictError is a sibling of
|
|
34
|
+
* StackConflictError. See docs/spec/wire-format.md § Error responses.
|
|
43
35
|
*/
|
|
44
36
|
export declare abstract class StackError extends Error {
|
|
45
37
|
abstract readonly code: StackErrorCode;
|
|
46
38
|
}
|
|
39
|
+
export declare const ARGUMENTS_INVALID = "Invalid arguments";
|
|
40
|
+
export declare const SCHEMA_INVALID = "Schema validation failed";
|
|
41
|
+
/**
|
|
42
|
+
* `header` names what was validated — record content, or the arguments a
|
|
43
|
+
* call was given — so a refusal of `associate([])` doesn't read as a
|
|
44
|
+
* content failure. Only the message varies: `code` is the contract.
|
|
45
|
+
*/
|
|
47
46
|
export declare class StackValidationError extends StackError {
|
|
48
47
|
readonly errors: ValidationError[];
|
|
49
48
|
static readonly code: "validation";
|
|
50
49
|
readonly code: "validation";
|
|
51
|
-
constructor(errors: ValidationError[]);
|
|
50
|
+
constructor(errors: ValidationError[], header?: string);
|
|
52
51
|
}
|
|
53
52
|
export declare class StackMigrationError extends StackError {
|
|
54
53
|
static readonly code: "migration";
|
|
@@ -88,37 +87,25 @@ export declare class StackVersionConflictError extends StackError {
|
|
|
88
87
|
constructor(message: string, recordId: string, expectedVersion: number, actualVersion: number);
|
|
89
88
|
}
|
|
90
89
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* StackValidationError, which means the request was well-formed but content
|
|
96
|
-
* failed schema validation.
|
|
97
|
-
*
|
|
98
|
-
* Naming something absent belongs here rather than under `not_found`: a
|
|
99
|
-
* request whose *type* is undefined never addressed a record, so answering
|
|
100
|
-
* 404 would say a record was missing when none was asked for.
|
|
90
|
+
* A request structurally malformed — an undecodable cursor, a malformed
|
|
91
|
+
* TypeId, unparseable search text — as opposed to StackValidationError's
|
|
92
|
+
* well-formed request with invalid content. Naming an undefined type is
|
|
93
|
+
* here, not `not_found`: no record was asked for, so none is missing.
|
|
101
94
|
*/
|
|
102
95
|
export declare class StackBadRequestError extends StackError {
|
|
103
96
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* A client mapping this onto an error of its own reads the name from
|
|
108
|
-
* here rather than re-deriving it from the query, which is how one
|
|
109
|
-
* rule becomes two answers that can disagree.
|
|
97
|
+
* The declared capability the query needed and the adapter lacks, or
|
|
98
|
+
* undefined when the query's own shape was wrong. A client reads it from
|
|
99
|
+
* here rather than re-deriving it, so one rule has one answer.
|
|
110
100
|
*/
|
|
111
101
|
readonly capability?: MissingCapability | undefined;
|
|
112
102
|
static readonly code: "bad_request";
|
|
113
103
|
readonly code: "bad_request";
|
|
114
104
|
constructor(message: string,
|
|
115
105
|
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* A client mapping this onto an error of its own reads the name from
|
|
120
|
-
* here rather than re-deriving it from the query, which is how one
|
|
121
|
-
* rule becomes two answers that can disagree.
|
|
106
|
+
* The declared capability the query needed and the adapter lacks, or
|
|
107
|
+
* undefined when the query's own shape was wrong. A client reads it from
|
|
108
|
+
* here rather than re-deriving it, so one rule has one answer.
|
|
122
109
|
*/
|
|
123
110
|
capability?: MissingCapability | undefined);
|
|
124
111
|
}
|
|
@@ -134,17 +121,10 @@ export declare class StackPayloadTooLargeError extends StackError {
|
|
|
134
121
|
constructor(message: string);
|
|
135
122
|
}
|
|
136
123
|
/**
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* docs/spec/data-model.md § Capability-gated filters
|
|
141
|
-
*
|
|
142
|
-
* Never produced in-process: both SQLite engines run synchronously, so
|
|
143
|
-
* there is nothing to interrupt from inside the call. It exists so a
|
|
144
|
-
* server that bounds query time has a class to serialize, and so the app
|
|
145
|
-
* catching it can tell "too expensive, narrow it and retry" from
|
|
146
|
-
* StackBadRequestError's "malformed, don't bother retrying" — the distinction
|
|
147
|
-
* that would be lost if a timeout reused `bad_request`.
|
|
124
|
+
* A server abandoned an operation for taking too long — in practice a
|
|
125
|
+
* full-text search. Never produced in-process; it lets an app tell "too
|
|
126
|
+
* expensive, narrow and retry" from `bad_request`'s "malformed".
|
|
127
|
+
* See docs/spec/data-model.md § Capability-gated filters.
|
|
148
128
|
*/
|
|
149
129
|
export declare class StackTimeoutError extends StackError {
|
|
150
130
|
static readonly code: "timeout";
|
|
@@ -197,17 +177,10 @@ export declare class OwnerMismatchError extends Error {
|
|
|
197
177
|
constructor(expected: EntityId, actual: EntityId | undefined, where: string);
|
|
198
178
|
}
|
|
199
179
|
/**
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
* A relayed frame is scoped by the authority that opened the feed, and a
|
|
206
|
-
* narrower scope cannot re-derive that decision — a purge leaves no record
|
|
207
|
-
* to check `canRead` against. Delivering anyway would break the promise
|
|
208
|
-
* that a subscriber never sees what it may not read; delivering only local
|
|
209
|
-
* writes would silently drop every change made elsewhere, which is the
|
|
210
|
-
* failure that looks fine in testing. So it refuses.
|
|
180
|
+
* A scoped view asked to observe a stack that relays a remote feed. A
|
|
181
|
+
* relayed frame was scoped by the authority that opened the feed, and a
|
|
182
|
+
* narrower scope cannot re-derive that — a purge leaves nothing to check —
|
|
183
|
+
* so it refuses rather than leak frames or silently drop remote changes.
|
|
211
184
|
* See docs/spec/events.md § Permission scoping.
|
|
212
185
|
*/
|
|
213
186
|
export declare class RelayScopeError extends Error {
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],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AAI,YAA0B;gBACpC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;GAKG;AACH,qBAAa,qBAAsB,SAAQ,UAAU;aAIjC,MAAM,EAAE,MAAM;aACd,UAAU,EAAE,oBAAoB,EAAE;IAJpD,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,cAAc,CAAU;IAC/C,SAAkB,IAAI,iBAA8B;gBAElC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,oBAAoB,EAAE;CAUrD;AAED;;;;;;GAMG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,SAAgC;CAIpD;AAED;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;GAMG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;aAEzB,QAAQ,EAAE,QAAQ;aAClB,MAAM,EAAE,QAAQ,GAAG,SAAS;aAC5B,KAAK,EAAE,MAAM;gBAFb,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,QAAQ,GAAG,SAAS,EAC5B,KAAK,EAAE,MAAM;CAShC;AAED;;;;;;GAMG;AACH,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B"}
|
package/dist/errors.js
CHANGED
|
@@ -8,38 +8,38 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Several errors sit deliberately outside that root (UseAfterCloseError,
|
|
10
10
|
* InvalidAdapterError, OwnerMismatchError, RelayScopeError, and — in their own
|
|
11
|
-
* modules — IdGenerationError
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* modules — IdGenerationError, InvalidDidError, InvalidAuthChallengeError,
|
|
12
|
+
* StoredVersionError and MisfitError): they report a local programming error, malformed
|
|
13
|
+
* local input or an assembled topology, not a state a request can be in, so
|
|
14
|
+
* no server ever responds with one.
|
|
14
15
|
*
|
|
15
16
|
* The `Stack` prefix is reserved for the taxonomy: a class named
|
|
16
17
|
* `Stack…Error` extends StackError, and nothing else carries the prefix.
|
|
17
18
|
*/
|
|
18
19
|
import { baseIdOf, parseTypeId } from './schema.js';
|
|
19
20
|
/**
|
|
20
|
-
* Root of the
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* than a chain of class tests.
|
|
26
|
-
*
|
|
27
|
-
* Membership implies a wire mapping: every code has an entry in
|
|
28
|
-
* WIRE_ERROR_STATUS. Errors with no wire representation (IdGenerationError,
|
|
29
|
-
* InvalidDidError) deliberately stay outside this hierarchy.
|
|
30
|
-
*
|
|
31
|
-
* Subclassing adds no hierarchy beyond this root — notably
|
|
32
|
-
* StackVersionConflictError is a sibling of StackConflictError, not a
|
|
33
|
-
* subtype. See docs/spec/wire-format.md § Error responses.
|
|
21
|
+
* Root of the taxonomy: `instanceof StackError` is the one question a
|
|
22
|
+
* server's error middleware asks, and each subclass's `code` makes
|
|
23
|
+
* serialization a lookup. Every code has a WIRE_ERROR_STATUS entry.
|
|
24
|
+
* Subclasses add no hierarchy — StackVersionConflictError is a sibling of
|
|
25
|
+
* StackConflictError. See docs/spec/wire-format.md § Error responses.
|
|
34
26
|
*/
|
|
35
27
|
export class StackError extends Error {
|
|
36
28
|
}
|
|
29
|
+
const CONTENT_INVALID = 'Content validation failed';
|
|
30
|
+
export const ARGUMENTS_INVALID = 'Invalid arguments';
|
|
31
|
+
export const SCHEMA_INVALID = 'Schema validation failed';
|
|
32
|
+
/**
|
|
33
|
+
* `header` names what was validated — record content, or the arguments a
|
|
34
|
+
* call was given — so a refusal of `associate([])` doesn't read as a
|
|
35
|
+
* content failure. Only the message varies: `code` is the contract.
|
|
36
|
+
*/
|
|
37
37
|
export class StackValidationError extends StackError {
|
|
38
38
|
errors;
|
|
39
39
|
static code = 'validation';
|
|
40
40
|
code = StackValidationError.code;
|
|
41
|
-
constructor(errors) {
|
|
42
|
-
super(
|
|
41
|
+
constructor(errors, header = CONTENT_INVALID) {
|
|
42
|
+
super(`${header}:\n` + errors.map((e) => ` ${e.path}: ${e.message}`).join('\n'));
|
|
43
43
|
this.errors = errors;
|
|
44
44
|
this.name = 'StackValidationError';
|
|
45
45
|
}
|
|
@@ -100,16 +100,10 @@ export class StackVersionConflictError extends StackError {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* StackValidationError, which means the request was well-formed but content
|
|
108
|
-
* failed schema validation.
|
|
109
|
-
*
|
|
110
|
-
* Naming something absent belongs here rather than under `not_found`: a
|
|
111
|
-
* request whose *type* is undefined never addressed a record, so answering
|
|
112
|
-
* 404 would say a record was missing when none was asked for.
|
|
103
|
+
* A request structurally malformed — an undecodable cursor, a malformed
|
|
104
|
+
* TypeId, unparseable search text — as opposed to StackValidationError's
|
|
105
|
+
* well-formed request with invalid content. Naming an undefined type is
|
|
106
|
+
* here, not `not_found`: no record was asked for, so none is missing.
|
|
113
107
|
*/
|
|
114
108
|
export class StackBadRequestError extends StackError {
|
|
115
109
|
capability;
|
|
@@ -117,12 +111,9 @@ export class StackBadRequestError extends StackError {
|
|
|
117
111
|
code = StackBadRequestError.code;
|
|
118
112
|
constructor(message,
|
|
119
113
|
/**
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* A client mapping this onto an error of its own reads the name from
|
|
124
|
-
* here rather than re-deriving it from the query, which is how one
|
|
125
|
-
* rule becomes two answers that can disagree.
|
|
114
|
+
* The declared capability the query needed and the adapter lacks, or
|
|
115
|
+
* undefined when the query's own shape was wrong. A client reads it from
|
|
116
|
+
* here rather than re-deriving it, so one rule has one answer.
|
|
126
117
|
*/
|
|
127
118
|
capability) {
|
|
128
119
|
super(message);
|
|
@@ -145,17 +136,10 @@ export class StackPayloadTooLargeError extends StackError {
|
|
|
145
136
|
}
|
|
146
137
|
}
|
|
147
138
|
/**
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* docs/spec/data-model.md § Capability-gated filters
|
|
152
|
-
*
|
|
153
|
-
* Never produced in-process: both SQLite engines run synchronously, so
|
|
154
|
-
* there is nothing to interrupt from inside the call. It exists so a
|
|
155
|
-
* server that bounds query time has a class to serialize, and so the app
|
|
156
|
-
* catching it can tell "too expensive, narrow it and retry" from
|
|
157
|
-
* StackBadRequestError's "malformed, don't bother retrying" — the distinction
|
|
158
|
-
* that would be lost if a timeout reused `bad_request`.
|
|
139
|
+
* A server abandoned an operation for taking too long — in practice a
|
|
140
|
+
* full-text search. Never produced in-process; it lets an app tell "too
|
|
141
|
+
* expensive, narrow and retry" from `bad_request`'s "malformed".
|
|
142
|
+
* See docs/spec/data-model.md § Capability-gated filters.
|
|
159
143
|
*/
|
|
160
144
|
export class StackTimeoutError extends StackError {
|
|
161
145
|
static code = 'timeout';
|
|
@@ -179,7 +163,7 @@ export class StackSchemaDriftError extends StackError {
|
|
|
179
163
|
constructor(typeId, violations) {
|
|
180
164
|
super(`Schema drift detected for type "${typeId}": the stored schema and the new definition ` +
|
|
181
165
|
`differ beyond additive evolution (new optional fields only). Bump the version instead ` +
|
|
182
|
-
`of redefining "${typeId}" in place — e.g. defineType({ id: \`${baseIdOf(typeId)}@${(parseTypeId(typeId)?.version ?? 0) + 1}\`, ... }) plus
|
|
166
|
+
`of redefining "${typeId}" in place — e.g. defineType({ id: \`${baseIdOf(typeId)}@${(parseTypeId(typeId)?.version ?? 0) + 1}\`, ... }) plus a migration() passed to Stack.open().\n` +
|
|
183
167
|
violations.map((v) => ` ${v.path || '(root)'}: ${v.message}`).join('\n'));
|
|
184
168
|
this.typeId = typeId;
|
|
185
169
|
this.violations = violations;
|
|
@@ -233,17 +217,10 @@ export class OwnerMismatchError extends Error {
|
|
|
233
217
|
}
|
|
234
218
|
}
|
|
235
219
|
/**
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
* A relayed frame is scoped by the authority that opened the feed, and a
|
|
242
|
-
* narrower scope cannot re-derive that decision — a purge leaves no record
|
|
243
|
-
* to check `canRead` against. Delivering anyway would break the promise
|
|
244
|
-
* that a subscriber never sees what it may not read; delivering only local
|
|
245
|
-
* writes would silently drop every change made elsewhere, which is the
|
|
246
|
-
* failure that looks fine in testing. So it refuses.
|
|
220
|
+
* A scoped view asked to observe a stack that relays a remote feed. A
|
|
221
|
+
* relayed frame was scoped by the authority that opened the feed, and a
|
|
222
|
+
* narrower scope cannot re-derive that — a purge leaves nothing to check —
|
|
223
|
+
* so it refuses rather than leak frames or silently drop remote changes.
|
|
247
224
|
* See docs/spec/events.md § Permission scoping.
|
|
248
225
|
*/
|
|
249
226
|
export class RelayScopeError extends Error {
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAuBpD;;;;;;GAMG;AACH,MAAM,OAAgB,UAAW,SAAQ,KAAK;CAE7C;AAED,MAAM,eAAe,GAAG,2BAA2B,CAAC;AACpD,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AACrD,MAAM,CAAC,MAAM,cAAc,GAAG,0BAA0B,CAAC;AAEzD;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,UAAU;IAIhC;IAHlB,MAAM,CAAU,IAAI,GAAG,YAAqB,CAAC;IAC3B,IAAI,GAAG,oBAAoB,CAAC,IAAI,CAAC;IACnD,YACkB,MAAyB,EACzC,SAAiB,eAAe;QAEhC,KAAK,CAAC,GAAG,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CA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