@haverstack/core 0.28.0 → 0.30.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 +9 -2
- package/dist/access.d.ts +20 -0
- package/dist/access.d.ts.map +1 -1
- package/dist/access.js +26 -0
- package/dist/access.js.map +1 -1
- package/dist/adapter-entry.d.ts +1 -1
- package/dist/adapter-entry.d.ts.map +1 -1
- package/dist/adapter-entry.js +1 -1
- package/dist/adapter-entry.js.map +1 -1
- package/dist/changes.d.ts +15 -2
- package/dist/changes.d.ts.map +1 -1
- package/dist/changes.js +62 -6
- package/dist/changes.js.map +1 -1
- package/dist/combine.d.ts.map +1 -1
- package/dist/combine.js +1 -4
- package/dist/combine.js.map +1 -1
- package/dist/errors.d.ts +173 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +208 -0
- package/dist/errors.js.map +1 -0
- package/dist/grants.d.ts +84 -0
- package/dist/grants.d.ts.map +1 -0
- package/dist/grants.js +157 -0
- package/dist/grants.js.map +1 -0
- package/dist/id.d.ts +7 -5
- package/dist/id.d.ts.map +1 -1
- package/dist/id.js +17 -15
- package/dist/id.js.map +1 -1
- package/dist/identity-bindings.d.ts +13 -0
- package/dist/identity-bindings.d.ts.map +1 -0
- package/dist/identity-bindings.js +42 -0
- package/dist/identity-bindings.js.map +1 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +23 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/limits.js +35 -0
- package/dist/limits.js.map +1 -0
- package/dist/merge.d.ts +1 -1
- package/dist/merge.js +2 -2
- package/dist/merge.js.map +1 -1
- package/dist/query-validation.d.ts +80 -0
- package/dist/query-validation.d.ts.map +1 -0
- package/dist/query-validation.js +223 -0
- package/dist/query-validation.js.map +1 -0
- package/dist/record-changes.d.ts +89 -0
- package/dist/record-changes.d.ts.map +1 -0
- package/dist/record-changes.js +201 -0
- package/dist/record-changes.js.map +1 -0
- package/dist/record-id.d.ts +70 -0
- package/dist/record-id.d.ts.map +1 -0
- package/dist/record-id.js +127 -0
- package/dist/record-id.js.map +1 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +56 -5
- package/dist/schema.js.map +1 -1
- package/dist/scoped-stack.d.ts +460 -0
- package/dist/scoped-stack.d.ts.map +1 -0
- package/dist/scoped-stack.js +1163 -0
- package/dist/scoped-stack.js.map +1 -0
- package/dist/stack-reads.d.ts +38 -0
- package/dist/stack-reads.d.ts.map +1 -0
- package/dist/stack-reads.js +79 -0
- package/dist/stack-reads.js.map +1 -0
- package/dist/stack.d.ts +108 -700
- package/dist/stack.d.ts.map +1 -1
- package/dist/stack.js +235 -2286
- package/dist/stack.js.map +1 -1
- package/dist/testing.d.ts +3 -14
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +30 -42
- package/dist/testing.js.map +1 -1
- package/dist/types.d.ts +107 -30
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -1
- package/dist/validate.d.ts +31 -0
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +150 -3
- package/dist/validate.js.map +1 -1
- package/dist/wire-entry.d.ts +3 -3
- package/dist/wire-entry.d.ts.map +1 -1
- package/dist/wire-entry.js +3 -3
- package/dist/wire-entry.js.map +1 -1
- package/dist/wire-record.d.ts +16 -1
- package/dist/wire-record.d.ts.map +1 -1
- package/dist/wire-record.js +57 -1
- package/dist/wire-record.js.map +1 -1
- package/dist/wire-request.d.ts.map +1 -1
- package/dist/wire-request.js +3 -2
- package/dist/wire-request.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -57,12 +57,19 @@ const note = await stack.create('com.example.myapp/note@1', {
|
|
|
57
57
|
title: 'My first note',
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
-
// Update
|
|
61
|
-
await stack.
|
|
60
|
+
// Update its content (partial merge — only changed fields needed)
|
|
61
|
+
await stack.patchContent(note.id, { title: 'Updated title' });
|
|
62
62
|
|
|
63
63
|
// Tag it
|
|
64
64
|
await stack.associate(note.id, { kind: 'tag', label: 'favourite' });
|
|
65
65
|
|
|
66
|
+
// Or change several things at once — one version, one atomic write
|
|
67
|
+
await stack.mutate(note.id, {
|
|
68
|
+
contentPatch: { title: 'Final title' },
|
|
69
|
+
permissions: [{ access: 'public' }],
|
|
70
|
+
unlisted: false,
|
|
71
|
+
});
|
|
72
|
+
|
|
66
73
|
// Query
|
|
67
74
|
const notes = await stack.query({
|
|
68
75
|
filter: { typeId: 'com.example.myapp/note@1', tags: ['favourite'] },
|
package/dist/access.d.ts
CHANGED
|
@@ -47,6 +47,26 @@ export declare function validatePermissions(permissions: Permission[] | undefine
|
|
|
47
47
|
* app's own `member` relationships become a roster.
|
|
48
48
|
*/
|
|
49
49
|
export declare function groupRoleFromAssociations(associations: Association[] | undefined, entityId: EntityId): GroupRole | null;
|
|
50
|
+
/**
|
|
51
|
+
* Whether a roster carries at least one `admin` — the invariant every write
|
|
52
|
+
* to a `_group` Record must leave standing. Asked of the roster a write
|
|
53
|
+
* would *produce*, never the one it started from: that is what lets an
|
|
54
|
+
* admin remove themselves while another remains, and refuses the same
|
|
55
|
+
* removal when they are the last, without either case naming who is going.
|
|
56
|
+
*
|
|
57
|
+
* Reads associations alone, on the same terms as
|
|
58
|
+
* groupRoleFromAssociations() above: the caller must have established that
|
|
59
|
+
* the Record is in the `_group` family first. See docs/spec/identity.md
|
|
60
|
+
* § Group.
|
|
61
|
+
*/
|
|
62
|
+
export declare function hasGroupAdmin(associations: Association[] | undefined): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Whether one association is an `admin` roster entry. The `entity` scope is
|
|
65
|
+
* what makes a roster entry a roster entry — a `record` target carrying the
|
|
66
|
+
* same label confers nothing, so it must not count toward the invariant
|
|
67
|
+
* either. See docs/spec/data-model.md § Relationship targets.
|
|
68
|
+
*/
|
|
69
|
+
export declare function isGroupAdminAssociation(association: Association): boolean;
|
|
50
70
|
/**
|
|
51
71
|
* Whether a request is the stack owner acting alone — the tier behind every
|
|
52
72
|
* unconditional owner authority. Being the owner is never sufficient on its
|
package/dist/access.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../src/access.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;AAE1C,yGAAyG;AACzG,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE3C;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,EAAE,EAAE,QAAQ,KAAK,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;AAE3E;;;;;;;;;;;GAWG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,WAAW,EACnB,eAAe,EAAE,QAAQ,GAAG,IAAI,EAChC,aAAa,EAAE,QAAQ,GAAG,IAAI,EAC9B,IAAI,EAAE,UAAU,EAChB,aAAa,EAAE,cAAc,GAC5B,OAAO,CAAC,OAAO,CAAC,CAwBlB;AAeD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,UAAU,EAAE,GAAG,SAAS,EACrC,IAAI,SAAgB,GACnB,eAAe,EAAE,CAanB;AAqBD;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,WAAW,EAAE,GAAG,SAAS,EACvC,QAAQ,EAAE,QAAQ,GACjB,SAAS,GAAG,IAAI,CAalB;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE;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E;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAMzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE;IAAE,WAAW,EAAE,QAAQ,GAAG,IAAI,CAAC;IAAC,SAAS,EAAE,QAAQ,GAAG,IAAI,CAAA;CAAE,EACrE,aAAa,EAAE,QAAQ,GACtB,OAAO,CAET"}
|
package/dist/access.js
CHANGED
|
@@ -115,6 +115,32 @@ export function groupRoleFromAssociations(associations, entityId) {
|
|
|
115
115
|
}
|
|
116
116
|
return role;
|
|
117
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Whether a roster carries at least one `admin` — the invariant every write
|
|
120
|
+
* to a `_group` Record must leave standing. Asked of the roster a write
|
|
121
|
+
* would *produce*, never the one it started from: that is what lets an
|
|
122
|
+
* admin remove themselves while another remains, and refuses the same
|
|
123
|
+
* removal when they are the last, without either case naming who is going.
|
|
124
|
+
*
|
|
125
|
+
* Reads associations alone, on the same terms as
|
|
126
|
+
* groupRoleFromAssociations() above: the caller must have established that
|
|
127
|
+
* the Record is in the `_group` family first. See docs/spec/identity.md
|
|
128
|
+
* § Group.
|
|
129
|
+
*/
|
|
130
|
+
export function hasGroupAdmin(associations) {
|
|
131
|
+
return (associations ?? []).some(isGroupAdminAssociation);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Whether one association is an `admin` roster entry. The `entity` scope is
|
|
135
|
+
* what makes a roster entry a roster entry — a `record` target carrying the
|
|
136
|
+
* same label confers nothing, so it must not count toward the invariant
|
|
137
|
+
* either. See docs/spec/data-model.md § Relationship targets.
|
|
138
|
+
*/
|
|
139
|
+
export function isGroupAdminAssociation(association) {
|
|
140
|
+
return (association.kind === 'relationship' &&
|
|
141
|
+
association.label === 'admin' &&
|
|
142
|
+
association.target.scope === 'entity');
|
|
143
|
+
}
|
|
118
144
|
/**
|
|
119
145
|
* Whether a request is the stack owner acting alone — the tier behind every
|
|
120
146
|
* unconditional owner authority. Being the owner is never sufficient on its
|
package/dist/access.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access.js","sourceRoot":"","sources":["../src/access.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAcvC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAmB,EACnB,eAAgC,EAChC,aAA8B,EAC9B,IAAgB,EAChB,aAA6B;IAE7B,gCAAgC;IAChC,IAAI,eAAe,IAAI,eAAe,KAAK,aAAa;QAAE,OAAO,IAAI,CAAC;IAEtE,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC;IAEjC,4BAA4B;IAC5B,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAE/C,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,IAAI,KAAK,MAAM;YAAE,OAAO,IAAI,CAAC;QAE1D,IAAI,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,CAAC,QAAQ,KAAK,eAAe,EAAE,CAAC;YAC5D,IAAI,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAC;QACzC,CAAC;QAED,IAAI,CAAC,CAAC,MAAM,KAAK,OAAO,IAAI,eAAe,EAAE,CAAC;YAC5C,MAAM,IAAI,GAAG,MAAM,gBAAgB,CAAC,CAAC,CAAC,OAAO,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;YAC/E,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAA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AO,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,WAAwB;IAC9D,OAAO,CACL,WAAW,CAAC,IAAI,KAAK,cAAc;QACnC,WAAW,CAAC,KAAK,KAAK,OAAO;QAC7B,WAAW,CAAC,MAAM,CAAC,KAAK,KAAK,QAAQ,CACtC,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAqE,EACrE,aAAuB;IAEvB,OAAO,OAAO,CAAC,WAAW,KAAK,aAAa,IAAI,OAAO,CAAC,SAAS,KAAK,aAAa,CAAC;AACtF,CAAC"}
|
package/dist/adapter-entry.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export type { StackRecordAdapter, StackBlobAdapter, AdapterCapabilities, ContentFilterReach, BlobFileInfo, ExpectedVersionOptions, SubscribeChangesOptions, } from './types.js';
|
|
10
10
|
export { combineAdapters } from './combine.js';
|
|
11
|
-
export { assertQueryCapabilities, assertSortCapability, assertValidSort, assertValidRelatedTo, parseContentFilterKey, } from './
|
|
11
|
+
export { assertQueryCapabilities, assertSortCapability, assertValidSort, assertValidRelatedTo, parseContentFilterKey, } from './query-validation.js';
|
|
12
12
|
export { contentSortEntry, contentSortKey, compareSortEntries } from './sort.js';
|
|
13
13
|
export type { SortEntry } from './sort.js';
|
|
14
14
|
//# sourceMappingURL=adapter-entry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter-entry.d.ts","sourceRoot":"","sources":["../src/adapter-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,
|
|
1
|
+
{"version":3,"file":"adapter-entry.d.ts","sourceRoot":"","sources":["../src/adapter-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACjF,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/adapter-entry.js
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
* reads `stack.features` instead of these directly.
|
|
8
8
|
*/
|
|
9
9
|
export { combineAdapters } from './combine.js';
|
|
10
|
-
export { assertQueryCapabilities, assertSortCapability, assertValidSort, assertValidRelatedTo, parseContentFilterKey, } from './
|
|
10
|
+
export { assertQueryCapabilities, assertSortCapability, assertValidSort, assertValidRelatedTo, parseContentFilterKey, } from './query-validation.js';
|
|
11
11
|
export { contentSortEntry, contentSortKey, compareSortEntries } from './sort.js';
|
|
12
12
|
//# sourceMappingURL=adapter-entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter-entry.js","sourceRoot":"","sources":["../src/adapter-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,
|
|
1
|
+
{"version":3,"file":"adapter-entry.js","sourceRoot":"","sources":["../src/adapter-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/changes.d.ts
CHANGED
|
@@ -127,7 +127,7 @@ export declare class RelayDelivery {
|
|
|
127
127
|
* that a record of some type was destroyed, and nothing further about
|
|
128
128
|
* whose it was. See docs/spec/events.md § Purged records carry nothing.
|
|
129
129
|
*/
|
|
130
|
-
export declare function buildEmission(
|
|
130
|
+
export declare function buildEmission(ops: ChangeOp | ChangeOp[], record: StackRecord, opts?: {
|
|
131
131
|
actor?: ChangeActor;
|
|
132
132
|
at?: Date;
|
|
133
133
|
previousParentId?: string | null;
|
|
@@ -145,6 +145,19 @@ export declare class ChangeEmitter {
|
|
|
145
145
|
/** Ends every subscription — a closed stack emits nothing further. */
|
|
146
146
|
closeAll(): void;
|
|
147
147
|
}
|
|
148
|
-
/** The kind each op produces. See docs/spec/events.md § The event shape. */
|
|
149
148
|
export declare const CHANGE_KINDS: Record<ChangeOp, ChangeKind>;
|
|
149
|
+
/**
|
|
150
|
+
* `since` only means something where a relay exists: a stack with no
|
|
151
|
+
* third party whose writes could have been missed has no cursor it could
|
|
152
|
+
* ever have minted. Silently starting from the present would let the
|
|
153
|
+
* caller believe it resumed when it did not, so a stack that cannot honor
|
|
154
|
+
* `since` refuses it rather than ignoring it.
|
|
155
|
+
*
|
|
156
|
+
* Its shape is checked here rather than left to the adapter, so that a
|
|
157
|
+
* malformed cursor is the same error whoever is underneath — the posture
|
|
158
|
+
* query() already takes with a filter no adapter declared. The value stays
|
|
159
|
+
* opaque: this asks whether it is framable, never what it means. See
|
|
160
|
+
* docs/spec/events.md § Subscribing.
|
|
161
|
+
*/
|
|
162
|
+
export declare function assertSinceUsable(since: string | undefined, relaysChanges: boolean): void;
|
|
150
163
|
//# sourceMappingURL=changes.d.ts.map
|
package/dist/changes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../src/changes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,WAAW,EACZ,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../src/changes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,WAAW,EACZ,MAAM,YAAY,CAAC;AAGpB;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IACrC;;;;OAIG;IACH,MAAM,EAAE,WAAW,CAAC;IACpB;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC,CAAC;AAKF;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,OAAO,CA0BpF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,aAAa,EAAE,eAAe,CAAC,EAAE,OAAO,GAAG,OAAO,CAIjG;AAED;;;;;;;;;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AAO,GAC9E,aAAa,CAqCf;AAiBD;;;;GAIG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA2B;IAEzD,IAAI,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;IAQnC,GAAG,CAAC,YAAY,EAAE,YAAY,GAAG,WAAW;IAQ5C,SAAS,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,EAAE,IAAI,EAAE,gBAAgB,GAAG,WAAW;IAIvF,sEAAsE;IACtE,QAAQ,IAAI,IAAI;CAIjB;AAmBD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,QAAQ,EAAE,UAAU,CAcrD,CAAC;AAUF;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,aAAa,EAAE,OAAO,GAAG,IAAI,CAgBzF"}
|
package/dist/changes.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* property of one function here, not a convention every emission site has
|
|
14
14
|
* to remember. See docs/spec/events.md.
|
|
15
15
|
*/
|
|
16
|
+
import { StackQueryError } from './errors.js';
|
|
16
17
|
/** The `baseId@version` split, as grants and query filters read it. */
|
|
17
18
|
const baseIdOf = (typeId) => typeId.split('@')[0];
|
|
18
19
|
/**
|
|
@@ -63,7 +64,7 @@ export function matchesFilter(emitted, filter) {
|
|
|
63
64
|
export function passesUnlistedBoundary(emitted, includeUnlisted) {
|
|
64
65
|
if (includeUnlisted)
|
|
65
66
|
return true;
|
|
66
|
-
if (emitted.change.
|
|
67
|
+
if (emitted.change.ops.includes('unlist'))
|
|
67
68
|
return true;
|
|
68
69
|
return !emitted.record.unlistedAt;
|
|
69
70
|
}
|
|
@@ -205,14 +206,18 @@ class UnscopedSubscription extends Subscription {
|
|
|
205
206
|
* that a record of some type was destroyed, and nothing further about
|
|
206
207
|
* whose it was. See docs/spec/events.md § Purged records carry nothing.
|
|
207
208
|
*/
|
|
208
|
-
export function buildEmission(
|
|
209
|
-
const
|
|
209
|
+
export function buildEmission(ops, record, opts = {}) {
|
|
210
|
+
const list = Array.isArray(ops) ? ops : [ops];
|
|
211
|
+
if (list.length === 0) {
|
|
212
|
+
throw new Error('buildEmission: a change reports at least one op');
|
|
213
|
+
}
|
|
214
|
+
const kind = resolveKind(list);
|
|
210
215
|
if (kind === 'purged') {
|
|
211
216
|
return {
|
|
212
217
|
record,
|
|
213
218
|
change: {
|
|
214
219
|
kind,
|
|
215
|
-
|
|
220
|
+
ops: list,
|
|
216
221
|
recordId: record.id,
|
|
217
222
|
typeId: record.typeId,
|
|
218
223
|
version: record.version,
|
|
@@ -227,7 +232,7 @@ export function buildEmission(op, record, opts = {}) {
|
|
|
227
232
|
...(opts.previousParentId !== undefined && { previousParentId: opts.previousParentId }),
|
|
228
233
|
change: {
|
|
229
234
|
kind,
|
|
230
|
-
|
|
235
|
+
ops: list,
|
|
231
236
|
recordId: record.id,
|
|
232
237
|
typeId: record.typeId,
|
|
233
238
|
version: record.version,
|
|
@@ -285,9 +290,26 @@ export class ChangeEmitter {
|
|
|
285
290
|
}
|
|
286
291
|
}
|
|
287
292
|
/** The kind each op produces. See docs/spec/events.md § The event shape. */
|
|
293
|
+
/**
|
|
294
|
+
* The kind a set of ops resolves to: the most conservative entry wins.
|
|
295
|
+
* `unlist` beats everything a change set can carry beside it, because a
|
|
296
|
+
* subscriber holding the record still has to drop it — announcing an
|
|
297
|
+
* edit bundled with an unlist as an upsert would leave a stale copy
|
|
298
|
+
* behind. Nothing else competes: `created` and `purged` name whole-record
|
|
299
|
+
* transitions that are always emitted alone, so a multi-op set is always
|
|
300
|
+
* `changed` unless it unlists.
|
|
301
|
+
* See docs/spec/events.md § The event shape.
|
|
302
|
+
*/
|
|
303
|
+
function resolveKind(ops) {
|
|
304
|
+
if (ops.includes('unlist'))
|
|
305
|
+
return 'deleted';
|
|
306
|
+
if (ops.length === 1)
|
|
307
|
+
return CHANGE_KINDS[ops[0]];
|
|
308
|
+
return 'changed';
|
|
309
|
+
}
|
|
288
310
|
export const CHANGE_KINDS = {
|
|
289
311
|
create: 'created',
|
|
290
|
-
|
|
312
|
+
patch: 'changed',
|
|
291
313
|
associate: 'changed',
|
|
292
314
|
dissociate: 'changed',
|
|
293
315
|
permissions: 'changed',
|
|
@@ -300,4 +322,38 @@ export const CHANGE_KINDS = {
|
|
|
300
322
|
unlist: 'deleted',
|
|
301
323
|
reparent: 'changed',
|
|
302
324
|
};
|
|
325
|
+
/**
|
|
326
|
+
* A resume cursor is opaque, but not arbitrary: it travels in an SSE `id:`
|
|
327
|
+
* field, so a value spanning a line would truncate the frame carrying it.
|
|
328
|
+
* Same charset and same reason as the auth nonce — see
|
|
329
|
+
* docs/spec/change-feed.md § Frames.
|
|
330
|
+
*/
|
|
331
|
+
const SEQ_FORMAT = /^[A-Za-z0-9_-]+$/;
|
|
332
|
+
/**
|
|
333
|
+
* `since` only means something where a relay exists: a stack with no
|
|
334
|
+
* third party whose writes could have been missed has no cursor it could
|
|
335
|
+
* ever have minted. Silently starting from the present would let the
|
|
336
|
+
* caller believe it resumed when it did not, so a stack that cannot honor
|
|
337
|
+
* `since` refuses it rather than ignoring it.
|
|
338
|
+
*
|
|
339
|
+
* Its shape is checked here rather than left to the adapter, so that a
|
|
340
|
+
* malformed cursor is the same error whoever is underneath — the posture
|
|
341
|
+
* query() already takes with a filter no adapter declared. The value stays
|
|
342
|
+
* opaque: this asks whether it is framable, never what it means. See
|
|
343
|
+
* docs/spec/events.md § Subscribing.
|
|
344
|
+
*/
|
|
345
|
+
export function assertSinceUsable(since, relaysChanges) {
|
|
346
|
+
if (since === undefined)
|
|
347
|
+
return;
|
|
348
|
+
if (!relaysChanges) {
|
|
349
|
+
throw new StackQueryError('subscribe() was passed `since`, but this stack relays no changes from elsewhere and so ' +
|
|
350
|
+
'has no cursor it could ever have minted. Omit `since` — or, for a stack that relays ' +
|
|
351
|
+
'from a server, use the seq off a previously delivered RecordChange.');
|
|
352
|
+
}
|
|
353
|
+
if (!SEQ_FORMAT.test(since)) {
|
|
354
|
+
throw new StackQueryError(`subscribe() was passed the resume cursor "${since}", which is not a valid seq: a cursor ` +
|
|
355
|
+
'carries unreserved base64url characters only, because it travels in a frame id. Use ' +
|
|
356
|
+
'the seq off a previously delivered RecordChange, unaltered.');
|
|
357
|
+
}
|
|
358
|
+
}
|
|
303
359
|
//# sourceMappingURL=changes.js.map
|
package/dist/changes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changes.js","sourceRoot":"","sources":["../src/changes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"changes.js","sourceRoot":"","sources":["../src/changes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA2B9C,uEAAuE;AACvE,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAC;AAEnE;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAAsB,EAAE,MAAqB;IACzE,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEnC,IAAI,MAAM,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAEtE,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC9E,MAAM,MAAM,GAA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AAE;IACrC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,IAAI,EAAE,gBAAgB,CAAC;CACxB,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"combine.d.ts","sourceRoot":"","sources":["../src/combine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAErF;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,IAAI,EAAE,gBAAgB,CAAC;CACxB,GAAG,YAAY,CA6Df"}
|
package/dist/combine.js
CHANGED
|
@@ -18,15 +18,12 @@ export function combineAdapters(parts) {
|
|
|
18
18
|
},
|
|
19
19
|
createRecord: (r) => parts.record.createRecord(r),
|
|
20
20
|
getRecord: (id) => parts.record.getRecord(id),
|
|
21
|
-
|
|
21
|
+
mutateRecord: (id, changes, opts) => parts.record.mutateRecord(id, changes, opts),
|
|
22
22
|
deleteRecord: (id, opts) => parts.record.deleteRecord(id, opts),
|
|
23
23
|
undeleteRecord: (id, opts) => parts.record.undeleteRecord(id, opts),
|
|
24
24
|
queryRecords: (q) => parts.record.queryRecords(q),
|
|
25
25
|
associate: (id, assoc, opts) => parts.record.associate(id, assoc, opts),
|
|
26
26
|
dissociate: (id, assoc, opts) => parts.record.dissociate(id, assoc, opts),
|
|
27
|
-
setPermissions: (id, permissions, opts) => parts.record.setPermissions(id, permissions, opts),
|
|
28
|
-
setUnlisted: (id, unlisted, opts) => parts.record.setUnlisted(id, unlisted, opts),
|
|
29
|
-
setParent: (id, parentId, opts) => parts.record.setParent(id, parentId, opts),
|
|
30
27
|
getVersions: (id) => parts.record.getVersions(id),
|
|
31
28
|
getVersion: (id, v) => parts.record.getVersion(id, v),
|
|
32
29
|
saveVersion: (id, v) => parts.record.saveVersion(id, v),
|
package/dist/combine.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combine.js","sourceRoot":"","sources":["../src/combine.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,KAG/B;IACC,OAAO;QACL,IAAI,YAAY;YACd,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC;QACnC,CAAC;QACD,IAAI,aAAa;YACf,OAAO,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC;QACpC,CAAC;QACD,IAAI,QAAQ;YACV,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC/B,CAAC;QAED,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;QACjD,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7C,YAAY,EAAE,CAAC,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"combine.js","sourceRoot":"","sources":["../src/combine.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,KAG/B;IACC,OAAO;QACL,IAAI,YAAY;YACd,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC;QACnC,CAAC;QACD,IAAI,aAAa;YACf,OAAO,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC;QACpC,CAAC;QACD,IAAI,QAAQ;YACV,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC/B,CAAC;QAED,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;QACjD,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7C,YAAY,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CA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EAAE,EAAE,CAAC;QAC7B,CAAC;QACD,KAAK,CAAC,KAAK;YACT,MAAM,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;YAC7B,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;QAC7B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stack errors — the error taxonomy
|
|
3
|
+
* -------------------------------------------------------
|
|
4
|
+
* Every error a Stack operation can raise, in one place. The hierarchy has
|
|
5
|
+
* a single root so a server's error middleware can ask one question —
|
|
6
|
+
* `instanceof StackError` — before serializing a wire body, and each
|
|
7
|
+
* subclass carries its wire discriminator as an instance `code`.
|
|
8
|
+
*
|
|
9
|
+
* Three errors sit deliberately outside that root (StackClosedError,
|
|
10
|
+
* StackRelayScopeError, and — in their own modules — IdGenerationError and
|
|
11
|
+
* InvalidDidError): they report a local programming error or an assembled
|
|
12
|
+
* topology, not a state a request can be in, so no server ever responds
|
|
13
|
+
* with one.
|
|
14
|
+
*/
|
|
15
|
+
import type { SchemaDriftViolation } from './schema.js';
|
|
16
|
+
import type { ValidationError } from './validate.js';
|
|
17
|
+
import type { TypeId } from './types.js';
|
|
18
|
+
/**
|
|
19
|
+
* The wire-protocol discriminator vocabulary, one code per Stack-domain
|
|
20
|
+
* error class. Lives here rather than in @haverstack/wire-types because the
|
|
21
|
+
* classes that carry these codes are defined here; wire-types re-exports it
|
|
22
|
+
* as WireErrorCode. See docs/spec/wire-format.md § Wire error body.
|
|
23
|
+
*/
|
|
24
|
+
export type StackErrorCode = 'bad_request' | 'permission' | 'not_found' | 'conflict' | 'version_conflict' | 'validation' | 'migration' | 'schema_drift' | 'payload_too_large' | 'timeout';
|
|
25
|
+
/**
|
|
26
|
+
* Root of the Stack error taxonomy. A single `instanceof StackError` answers
|
|
27
|
+
* "is this a Stack-domain error or a bug?" — the question a server's error
|
|
28
|
+
* middleware asks before serializing a wire body, and one a nine-arm
|
|
29
|
+
* instanceof ladder answers only by exhaustion. Every subclass carries its
|
|
30
|
+
* discriminator as an instance `code`, so serialization is a lookup rather
|
|
31
|
+
* than a chain of class tests.
|
|
32
|
+
*
|
|
33
|
+
* Membership implies a wire mapping: every code has an entry in
|
|
34
|
+
* WIRE_ERROR_STATUS. Errors with no wire representation (IdGenerationError,
|
|
35
|
+
* InvalidDidError) deliberately stay outside this hierarchy.
|
|
36
|
+
*
|
|
37
|
+
* Subclassing adds no hierarchy beyond this root — notably
|
|
38
|
+
* StackVersionConflictError is a sibling of StackConflictError, not a
|
|
39
|
+
* subtype. See docs/spec/wire-format.md § Error responses.
|
|
40
|
+
*/
|
|
41
|
+
export declare abstract class StackError extends Error {
|
|
42
|
+
abstract readonly code: StackErrorCode;
|
|
43
|
+
}
|
|
44
|
+
export declare class StackValidationError extends StackError {
|
|
45
|
+
readonly errors: ValidationError[];
|
|
46
|
+
static readonly code: "validation";
|
|
47
|
+
readonly code: "validation";
|
|
48
|
+
constructor(errors: ValidationError[]);
|
|
49
|
+
}
|
|
50
|
+
export declare class StackMigrationError extends StackError {
|
|
51
|
+
static readonly code: "migration";
|
|
52
|
+
readonly code: "migration";
|
|
53
|
+
constructor(message: string);
|
|
54
|
+
}
|
|
55
|
+
/** Thrown by ScopedStack when a requester lacks permission for the operation. */
|
|
56
|
+
export declare class StackPermissionError extends StackError {
|
|
57
|
+
static readonly code: "permission";
|
|
58
|
+
readonly code: "permission";
|
|
59
|
+
constructor(message?: string);
|
|
60
|
+
}
|
|
61
|
+
/** Thrown when a record (or specific version) does not exist. */
|
|
62
|
+
export declare class StackNotFoundError extends StackError {
|
|
63
|
+
static readonly code: "not_found";
|
|
64
|
+
readonly code: "not_found";
|
|
65
|
+
constructor(message: string);
|
|
66
|
+
}
|
|
67
|
+
/** Thrown when an operation cannot proceed due to a constraint violation (e.g. deleting an attachment that is still referenced). */
|
|
68
|
+
export declare class StackConflictError extends StackError {
|
|
69
|
+
static readonly code: "conflict";
|
|
70
|
+
readonly code: "conflict";
|
|
71
|
+
constructor(message: string);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Thrown when an `ifVersion` precondition doesn't match a record's current
|
|
75
|
+
* version. Deliberately not a StackConflictError subtype — the two have
|
|
76
|
+
* different recovery stories and HTTP statuses (409 vs. 412). See
|
|
77
|
+
* docs/spec/versioning.md § Optimistic concurrency (`ifVersion`).
|
|
78
|
+
*/
|
|
79
|
+
export declare class StackVersionConflictError extends StackError {
|
|
80
|
+
readonly recordId: string;
|
|
81
|
+
readonly expectedVersion: number;
|
|
82
|
+
readonly actualVersion: number;
|
|
83
|
+
static readonly code: "version_conflict";
|
|
84
|
+
readonly code: "version_conflict";
|
|
85
|
+
constructor(message: string, recordId: string, expectedVersion: number, actualVersion: number);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Thrown when a request is structurally malformed — not a content-validation
|
|
89
|
+
* failure, but input the adapter/server can't even interpret (e.g. an
|
|
90
|
+
* undecodable pagination cursor, a malformed TypeId, search text the engine
|
|
91
|
+
* cannot parse, or a typeId no definition exists for). Distinct from
|
|
92
|
+
* StackValidationError, which means the request was well-formed but content
|
|
93
|
+
* failed schema validation.
|
|
94
|
+
*
|
|
95
|
+
* Naming something absent belongs here rather than under `not_found`: a
|
|
96
|
+
* request whose *type* is undefined never addressed a record, so answering
|
|
97
|
+
* 404 would say a record was missing when none was asked for.
|
|
98
|
+
*/
|
|
99
|
+
export declare class StackQueryError extends StackError {
|
|
100
|
+
static readonly code: "bad_request";
|
|
101
|
+
readonly code: "bad_request";
|
|
102
|
+
constructor(message: string);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Thrown when an attachment upload exceeds the adapter's declared
|
|
106
|
+
* `limits.attachmentBytes` ceiling — checked client-side before any bytes
|
|
107
|
+
* are sent; a server still enforces 413 authoritatively regardless. See
|
|
108
|
+
* docs/spec/wire-format.md § Attachments.
|
|
109
|
+
*/
|
|
110
|
+
export declare class StackPayloadTooLargeError extends StackError {
|
|
111
|
+
static readonly code: "payload_too_large";
|
|
112
|
+
readonly code: "payload_too_large";
|
|
113
|
+
constructor(message: string);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Thrown when a server abandons an operation for taking too long — in
|
|
117
|
+
* practice a full-text search, the one query whose cost the sanitizers
|
|
118
|
+
* bound the *grammar* of but not the execution of (see
|
|
119
|
+
* docs/spec/data-model.md § Capability-gated filters).
|
|
120
|
+
*
|
|
121
|
+
* Never produced in-process: both SQLite engines run synchronously, so
|
|
122
|
+
* there is nothing to interrupt from inside the call. It exists so a
|
|
123
|
+
* server that bounds query time has a class to serialize, and so the app
|
|
124
|
+
* catching it can tell "too expensive, narrow it and retry" from
|
|
125
|
+
* StackQueryError's "malformed, don't bother retrying" — the distinction
|
|
126
|
+
* that would be lost if a timeout reused `bad_request`.
|
|
127
|
+
*/
|
|
128
|
+
export declare class StackTimeoutError extends StackError {
|
|
129
|
+
static readonly code: "timeout";
|
|
130
|
+
readonly code: "timeout";
|
|
131
|
+
constructor(message: string);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Thrown by defineType() when redefining an existing typeId with a schema
|
|
135
|
+
* change beyond additive evolution. The remedy is a new version, never an
|
|
136
|
+
* in-place redefinition. See docs/spec/data-model.md § Schema drift
|
|
137
|
+
* detection.
|
|
138
|
+
*/
|
|
139
|
+
export declare class StackSchemaDriftError extends StackError {
|
|
140
|
+
readonly typeId: TypeId;
|
|
141
|
+
readonly violations: SchemaDriftViolation[];
|
|
142
|
+
static readonly code: "schema_drift";
|
|
143
|
+
readonly code: "schema_drift";
|
|
144
|
+
constructor(typeId: TypeId, violations: SchemaDriftViolation[]);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Thrown when a Stack or ScopedStack is used after close(). Deliberately
|
|
148
|
+
* outside the StackError taxonomy, alongside IdGenerationError and
|
|
149
|
+
* InvalidDidError: a caller holding a closed client is a local programming
|
|
150
|
+
* error with no wire representation — no server ever responds with it.
|
|
151
|
+
* See docs/spec/adapters.md § Lifecycle.
|
|
152
|
+
*/
|
|
153
|
+
export declare class StackClosedError extends Error {
|
|
154
|
+
constructor(message?: string);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Thrown when a scoped view is asked to observe a stack whose adapter
|
|
158
|
+
* relays a remote feed. Outside the StackError taxonomy for the same
|
|
159
|
+
* reason StackClosedError is: it reports a topology the caller assembled,
|
|
160
|
+
* not a state a request can be in.
|
|
161
|
+
*
|
|
162
|
+
* A relayed frame is scoped by the authority that opened the feed, and a
|
|
163
|
+
* narrower scope cannot re-derive that decision — a purge leaves no record
|
|
164
|
+
* to check `canRead` against. Delivering anyway would break the promise
|
|
165
|
+
* that a subscriber never sees what it may not read; delivering only local
|
|
166
|
+
* writes would silently drop every change made elsewhere, which is the
|
|
167
|
+
* failure that looks fine in testing. So it refuses.
|
|
168
|
+
* See docs/spec/events.md § Permission scoping.
|
|
169
|
+
*/
|
|
170
|
+
export declare class StackRelayScopeError extends Error {
|
|
171
|
+
constructor(message: string);
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GACtB,aAAa,GACb,YAAY,GACZ,WAAW,GACX,UAAU,GACV,kBAAkB,GAClB,YAAY,GACZ,WAAW,GACX,cAAc,GACd,mBAAmB,GACnB,SAAS,CAAC;AAEd;;;;;;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