@haverstack/core 0.29.0 → 0.31.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.
Files changed (74) hide show
  1. package/dist/adapter-entry.d.ts +2 -2
  2. package/dist/adapter-entry.d.ts.map +1 -1
  3. package/dist/adapter-entry.js +1 -1
  4. package/dist/adapter-entry.js.map +1 -1
  5. package/dist/changes.d.ts +14 -0
  6. package/dist/changes.d.ts.map +1 -1
  7. package/dist/changes.js +35 -0
  8. package/dist/changes.js.map +1 -1
  9. package/dist/errors.d.ts +191 -0
  10. package/dist/errors.d.ts.map +1 -0
  11. package/dist/errors.js +219 -0
  12. package/dist/errors.js.map +1 -0
  13. package/dist/grants.d.ts +84 -0
  14. package/dist/grants.d.ts.map +1 -0
  15. package/dist/grants.js +157 -0
  16. package/dist/grants.js.map +1 -0
  17. package/dist/id.d.ts +7 -5
  18. package/dist/id.d.ts.map +1 -1
  19. package/dist/id.js +17 -15
  20. package/dist/id.js.map +1 -1
  21. package/dist/identity-bindings.d.ts +13 -0
  22. package/dist/identity-bindings.d.ts.map +1 -0
  23. package/dist/identity-bindings.js +42 -0
  24. package/dist/identity-bindings.js.map +1 -0
  25. package/dist/index.d.ts +7 -4
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +5 -2
  28. package/dist/index.js.map +1 -1
  29. package/dist/limits.d.ts +23 -0
  30. package/dist/limits.d.ts.map +1 -0
  31. package/dist/limits.js +35 -0
  32. package/dist/limits.js.map +1 -0
  33. package/dist/query-validation.d.ts +83 -0
  34. package/dist/query-validation.d.ts.map +1 -0
  35. package/dist/query-validation.js +228 -0
  36. package/dist/query-validation.js.map +1 -0
  37. package/dist/record-changes.d.ts +89 -0
  38. package/dist/record-changes.d.ts.map +1 -0
  39. package/dist/record-changes.js +201 -0
  40. package/dist/record-changes.js.map +1 -0
  41. package/dist/record-id.d.ts +70 -0
  42. package/dist/record-id.d.ts.map +1 -0
  43. package/dist/record-id.js +127 -0
  44. package/dist/record-id.js.map +1 -0
  45. package/dist/scoped-stack.d.ts +468 -0
  46. package/dist/scoped-stack.d.ts.map +1 -0
  47. package/dist/scoped-stack.js +1173 -0
  48. package/dist/scoped-stack.js.map +1 -0
  49. package/dist/stack-reads.d.ts +38 -0
  50. package/dist/stack-reads.d.ts.map +1 -0
  51. package/dist/stack-reads.js +79 -0
  52. package/dist/stack-reads.js.map +1 -0
  53. package/dist/stack.d.ts +37 -643
  54. package/dist/stack.d.ts.map +1 -1
  55. package/dist/stack.js +102 -2254
  56. package/dist/stack.js.map +1 -1
  57. package/dist/testing.d.ts.map +1 -1
  58. package/dist/testing.js +3 -1
  59. package/dist/testing.js.map +1 -1
  60. package/dist/types.d.ts +16 -2
  61. package/dist/types.d.ts.map +1 -1
  62. package/dist/types.js +8 -0
  63. package/dist/types.js.map +1 -1
  64. package/dist/wire-entry.d.ts +3 -2
  65. package/dist/wire-entry.d.ts.map +1 -1
  66. package/dist/wire-entry.js +6 -2
  67. package/dist/wire-entry.js.map +1 -1
  68. package/dist/wire-record.js +1 -1
  69. package/dist/wire-record.js.map +1 -1
  70. package/dist/wire-request.d.ts +14 -0
  71. package/dist/wire-request.d.ts.map +1 -1
  72. package/dist/wire-request.js +19 -2
  73. package/dist/wire-request.js.map +1 -1
  74. package/package.json +1 -1
@@ -6,9 +6,9 @@
6
6
  * implementers (see the in-repo adapters), not app or plugin code, which
7
7
  * reads `stack.features` instead of these directly.
8
8
  */
9
- export type { StackRecordAdapter, StackBlobAdapter, AdapterCapabilities, ContentFilterReach, BlobFileInfo, ExpectedVersionOptions, SubscribeChangesOptions, } from './types.js';
9
+ export type { StackRecordAdapter, StackBlobAdapter, AdapterCapabilities, ContentFilterReach, MissingCapability, BlobFileInfo, ExpectedVersionOptions, SubscribeChangesOptions, } from './types.js';
10
10
  export { combineAdapters } from './combine.js';
11
- export { assertQueryCapabilities, assertSortCapability, assertValidSort, assertValidRelatedTo, parseContentFilterKey, } from './stack.js';
11
+ export { assertQueryCapabilities, assertSortCapability, assertValidSort, assertValidRelatedTo, filtersContent, 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,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACjF,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC"}
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,iBAAiB,EACjB,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,cAAc,EACd,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"}
@@ -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 './stack.js';
10
+ export { assertQueryCapabilities, assertSortCapability, assertValidSort, assertValidRelatedTo, filtersContent, 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,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"adapter-entry.js","sourceRoot":"","sources":["../src/adapter-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC"}
package/dist/changes.d.ts CHANGED
@@ -146,4 +146,18 @@ export declare class ChangeEmitter {
146
146
  closeAll(): void;
147
147
  }
148
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;
149
163
  //# sourceMappingURL=changes.d.ts.map
@@ -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;AAEpB;;;;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;;;;;;;;;;;;GAYG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,OAAO,GAAG,YAAY,CAItF;AAED;;;;;GAKG;AACH,8BAAsB,YAAY;IAI9B,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,YAAY,KA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AE,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
  /**
@@ -321,4 +322,38 @@ export const CHANGE_KINDS = {
321
322
  unlist: 'deleted',
322
323
  reparent: 'changed',
323
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
+ }
324
359
  //# sourceMappingURL=changes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"changes.js","sourceRoot":"","sources":["../src/changes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAsCH,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,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC;YAAE,OAA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,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAiC;IACxD,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE,SAAS;IACrB,WAAW,EAAE,SAAS;IACtB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,SAAS;IACnB,MAAM,EAAE,SAAS;IACjB,aAAa,EAAE,QAAQ;IACvB,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE,SAAS;CACpB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAEtC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAyB,EAAE,aAAsB;IACjF,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO;IAChC,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,eAAe,CACvB,yFAAyF;YACvF,sFAAsF;YACtF,qEAAqE,CACxE,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,eAAe,CACvB,6CAA6C,KAAK,wCAAwC;YACxF,sFAAsF;YACtF,6DAA6D,CAChE,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,191 @@
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 { MissingCapability, 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
+ /**
101
+ * Which declared capability the query asked for and the adapter lacks,
102
+ * or undefined when the query's own shape is what was wrong — a
103
+ * malformed content path is a caller error at every capability level.
104
+ * A client mapping this onto an error of its own reads the name from
105
+ * here rather than re-deriving it from the query, which is how one
106
+ * rule becomes two answers that can disagree.
107
+ */
108
+ readonly capability?: MissingCapability | undefined;
109
+ static readonly code: "bad_request";
110
+ readonly code: "bad_request";
111
+ constructor(message: string,
112
+ /**
113
+ * Which declared capability the query asked for and the adapter lacks,
114
+ * or undefined when the query's own shape is what was wrong — a
115
+ * malformed content path is a caller error at every capability level.
116
+ * A client mapping this onto an error of its own reads the name from
117
+ * here rather than re-deriving it from the query, which is how one
118
+ * rule becomes two answers that can disagree.
119
+ */
120
+ capability?: MissingCapability | undefined);
121
+ }
122
+ /**
123
+ * Thrown when an attachment upload exceeds the adapter's declared
124
+ * `limits.attachmentBytes` ceiling — checked client-side before any bytes
125
+ * are sent; a server still enforces 413 authoritatively regardless. See
126
+ * docs/spec/wire-format.md § Attachments.
127
+ */
128
+ export declare class StackPayloadTooLargeError extends StackError {
129
+ static readonly code: "payload_too_large";
130
+ readonly code: "payload_too_large";
131
+ constructor(message: string);
132
+ }
133
+ /**
134
+ * Thrown when a server abandons an operation for taking too long — in
135
+ * practice a full-text search, the one query whose cost the sanitizers
136
+ * bound the *grammar* of but not the execution of (see
137
+ * docs/spec/data-model.md § Capability-gated filters).
138
+ *
139
+ * Never produced in-process: both SQLite engines run synchronously, so
140
+ * there is nothing to interrupt from inside the call. It exists so a
141
+ * server that bounds query time has a class to serialize, and so the app
142
+ * catching it can tell "too expensive, narrow it and retry" from
143
+ * StackQueryError's "malformed, don't bother retrying" — the distinction
144
+ * that would be lost if a timeout reused `bad_request`.
145
+ */
146
+ export declare class StackTimeoutError extends StackError {
147
+ static readonly code: "timeout";
148
+ readonly code: "timeout";
149
+ constructor(message: string);
150
+ }
151
+ /**
152
+ * Thrown by defineType() when redefining an existing typeId with a schema
153
+ * change beyond additive evolution. The remedy is a new version, never an
154
+ * in-place redefinition. See docs/spec/data-model.md § Schema drift
155
+ * detection.
156
+ */
157
+ export declare class StackSchemaDriftError extends StackError {
158
+ readonly typeId: TypeId;
159
+ readonly violations: SchemaDriftViolation[];
160
+ static readonly code: "schema_drift";
161
+ readonly code: "schema_drift";
162
+ constructor(typeId: TypeId, violations: SchemaDriftViolation[]);
163
+ }
164
+ /**
165
+ * Thrown when a Stack or ScopedStack is used after close(). Deliberately
166
+ * outside the StackError taxonomy, alongside IdGenerationError and
167
+ * InvalidDidError: a caller holding a closed client is a local programming
168
+ * error with no wire representation — no server ever responds with it.
169
+ * See docs/spec/adapters.md § Lifecycle.
170
+ */
171
+ export declare class StackClosedError extends Error {
172
+ constructor(message?: string);
173
+ }
174
+ /**
175
+ * Thrown when a scoped view is asked to observe a stack whose adapter
176
+ * relays a remote feed. Outside the StackError taxonomy for the same
177
+ * reason StackClosedError is: it reports a topology the caller assembled,
178
+ * not a state a request can be in.
179
+ *
180
+ * A relayed frame is scoped by the authority that opened the feed, and a
181
+ * narrower scope cannot re-derive that decision — a purge leaves no record
182
+ * to check `canRead` against. Delivering anyway would break the promise
183
+ * that a subscriber never sees what it may not read; delivering only local
184
+ * writes would silently drop every change made elsewhere, which is the
185
+ * failure that looks fine in testing. So it refuses.
186
+ * See docs/spec/events.md § Permission scoping.
187
+ */
188
+ export declare class StackRelayScopeError extends Error {
189
+ constructor(message: string);
190
+ }
191
+ //# 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,iBAAiB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAE5D;;;;;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;;;;;;;;;;;;;;;GAeG;AACH,8BAAsB,UAAW,SAAQ,KAAK;IAC5C,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;CACxC;AAED,qBAAa,oBAAqB,SAAQ,UAAU;aAGtB,MAAM,EAAE,eAAe,EAAE;IAFrD,MAAM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,CAAC,IAAI,EAAG,aAAa,CAAU;IAC9C,SAAkB,IAAI,gBAAwB;gBAE5C,OAAO,EAAE,MAAM;IACf;;;;;;;OAOG;IACa,UAAU,CAAC,EAAE,iBAAiB,YAAA;CAKjD;AAED;;;;;GAKG;AACH,qBAAa,yBAA0B,SAAQ,UAAU;IACvD,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,mBAAmB,CAAU;IACpD,SAAkB,IAAI,sBAAkC;gBAC5C,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,iBAAkB,SAAQ,UAAU;IAC/C,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,SAAS,CAAU;IAC1C,SAAkB,IAAI,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,gBAAiB,SAAQ,KAAK;gBAC7B,OAAO,SAAgC;CAIpD;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAI5B"}
package/dist/errors.js ADDED
@@ -0,0 +1,219 @@
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 { baseIdOf, parseTypeId } from './schema.js';
16
+ /**
17
+ * Root of the Stack error taxonomy. A single `instanceof StackError` answers
18
+ * "is this a Stack-domain error or a bug?" — the question a server's error
19
+ * middleware asks before serializing a wire body, and one a nine-arm
20
+ * instanceof ladder answers only by exhaustion. Every subclass carries its
21
+ * discriminator as an instance `code`, so serialization is a lookup rather
22
+ * than a chain of class tests.
23
+ *
24
+ * Membership implies a wire mapping: every code has an entry in
25
+ * WIRE_ERROR_STATUS. Errors with no wire representation (IdGenerationError,
26
+ * InvalidDidError) deliberately stay outside this hierarchy.
27
+ *
28
+ * Subclassing adds no hierarchy beyond this root — notably
29
+ * StackVersionConflictError is a sibling of StackConflictError, not a
30
+ * subtype. See docs/spec/wire-format.md § Error responses.
31
+ */
32
+ export class StackError extends Error {
33
+ }
34
+ export class StackValidationError extends StackError {
35
+ errors;
36
+ static code = 'validation';
37
+ code = StackValidationError.code;
38
+ constructor(errors) {
39
+ super(`Content validation failed:\n` + errors.map((e) => ` ${e.path}: ${e.message}`).join('\n'));
40
+ this.errors = errors;
41
+ this.name = 'StackValidationError';
42
+ }
43
+ }
44
+ export class StackMigrationError extends StackError {
45
+ static code = 'migration';
46
+ code = StackMigrationError.code;
47
+ constructor(message) {
48
+ super(message);
49
+ this.name = 'StackMigrationError';
50
+ }
51
+ }
52
+ /** Thrown by ScopedStack when a requester lacks permission for the operation. */
53
+ export class StackPermissionError extends StackError {
54
+ static code = 'permission';
55
+ code = StackPermissionError.code;
56
+ constructor(message = 'Permission denied') {
57
+ super(message);
58
+ this.name = 'StackPermissionError';
59
+ }
60
+ }
61
+ /** Thrown when a record (or specific version) does not exist. */
62
+ export class StackNotFoundError extends StackError {
63
+ static code = 'not_found';
64
+ code = StackNotFoundError.code;
65
+ constructor(message) {
66
+ super(message);
67
+ this.name = 'StackNotFoundError';
68
+ }
69
+ }
70
+ /** Thrown when an operation cannot proceed due to a constraint violation (e.g. deleting an attachment that is still referenced). */
71
+ export class StackConflictError extends StackError {
72
+ static code = 'conflict';
73
+ code = StackConflictError.code;
74
+ constructor(message) {
75
+ super(message);
76
+ this.name = 'StackConflictError';
77
+ }
78
+ }
79
+ /**
80
+ * Thrown when an `ifVersion` precondition doesn't match a record's current
81
+ * version. Deliberately not a StackConflictError subtype — the two have
82
+ * different recovery stories and HTTP statuses (409 vs. 412). See
83
+ * docs/spec/versioning.md § Optimistic concurrency (`ifVersion`).
84
+ */
85
+ export class StackVersionConflictError extends StackError {
86
+ recordId;
87
+ expectedVersion;
88
+ actualVersion;
89
+ static code = 'version_conflict';
90
+ code = StackVersionConflictError.code;
91
+ constructor(message, recordId, expectedVersion, actualVersion) {
92
+ super(message);
93
+ this.recordId = recordId;
94
+ this.expectedVersion = expectedVersion;
95
+ this.actualVersion = actualVersion;
96
+ this.name = 'StackVersionConflictError';
97
+ }
98
+ }
99
+ /**
100
+ * Thrown when a request is structurally malformed — not a content-validation
101
+ * failure, but input the adapter/server can't even interpret (e.g. an
102
+ * undecodable pagination cursor, a malformed TypeId, search text the engine
103
+ * cannot parse, or a typeId no definition exists for). Distinct from
104
+ * StackValidationError, which means the request was well-formed but content
105
+ * failed schema validation.
106
+ *
107
+ * Naming something absent belongs here rather than under `not_found`: a
108
+ * request whose *type* is undefined never addressed a record, so answering
109
+ * 404 would say a record was missing when none was asked for.
110
+ */
111
+ export class StackQueryError extends StackError {
112
+ capability;
113
+ static code = 'bad_request';
114
+ code = StackQueryError.code;
115
+ constructor(message,
116
+ /**
117
+ * Which declared capability the query asked for and the adapter lacks,
118
+ * or undefined when the query's own shape is what was wrong — a
119
+ * malformed content path is a caller error at every capability level.
120
+ * A client mapping this onto an error of its own reads the name from
121
+ * here rather than re-deriving it from the query, which is how one
122
+ * rule becomes two answers that can disagree.
123
+ */
124
+ capability) {
125
+ super(message);
126
+ this.capability = capability;
127
+ this.name = 'StackQueryError';
128
+ }
129
+ }
130
+ /**
131
+ * Thrown when an attachment upload exceeds the adapter's declared
132
+ * `limits.attachmentBytes` ceiling — checked client-side before any bytes
133
+ * are sent; a server still enforces 413 authoritatively regardless. See
134
+ * docs/spec/wire-format.md § Attachments.
135
+ */
136
+ export class StackPayloadTooLargeError extends StackError {
137
+ static code = 'payload_too_large';
138
+ code = StackPayloadTooLargeError.code;
139
+ constructor(message) {
140
+ super(message);
141
+ this.name = 'StackPayloadTooLargeError';
142
+ }
143
+ }
144
+ /**
145
+ * Thrown when a server abandons an operation for taking too long — in
146
+ * practice a full-text search, the one query whose cost the sanitizers
147
+ * bound the *grammar* of but not the execution of (see
148
+ * docs/spec/data-model.md § Capability-gated filters).
149
+ *
150
+ * Never produced in-process: both SQLite engines run synchronously, so
151
+ * there is nothing to interrupt from inside the call. It exists so a
152
+ * server that bounds query time has a class to serialize, and so the app
153
+ * catching it can tell "too expensive, narrow it and retry" from
154
+ * StackQueryError's "malformed, don't bother retrying" — the distinction
155
+ * that would be lost if a timeout reused `bad_request`.
156
+ */
157
+ export class StackTimeoutError extends StackError {
158
+ static code = 'timeout';
159
+ code = StackTimeoutError.code;
160
+ constructor(message) {
161
+ super(message);
162
+ this.name = 'StackTimeoutError';
163
+ }
164
+ }
165
+ /**
166
+ * Thrown by defineType() when redefining an existing typeId with a schema
167
+ * change beyond additive evolution. The remedy is a new version, never an
168
+ * in-place redefinition. See docs/spec/data-model.md § Schema drift
169
+ * detection.
170
+ */
171
+ export class StackSchemaDriftError extends StackError {
172
+ typeId;
173
+ violations;
174
+ static code = 'schema_drift';
175
+ code = StackSchemaDriftError.code;
176
+ constructor(typeId, violations) {
177
+ super(`Schema drift detected for type "${typeId}": the stored schema and the new definition ` +
178
+ `differ beyond additive evolution (new optional fields only). Bump the version instead ` +
179
+ `of redefining "${typeId}" in place — e.g. defineType(\`${baseIdOf(typeId)}@${(parseTypeId(typeId)?.version ?? 0) + 1}\`, ...) plus registerMigration().\n` +
180
+ violations.map((v) => ` ${v.path || '(root)'}: ${v.message}`).join('\n'));
181
+ this.typeId = typeId;
182
+ this.violations = violations;
183
+ this.name = 'StackSchemaDriftError';
184
+ }
185
+ }
186
+ /**
187
+ * Thrown when a Stack or ScopedStack is used after close(). Deliberately
188
+ * outside the StackError taxonomy, alongside IdGenerationError and
189
+ * InvalidDidError: a caller holding a closed client is a local programming
190
+ * error with no wire representation — no server ever responds with it.
191
+ * See docs/spec/adapters.md § Lifecycle.
192
+ */
193
+ export class StackClosedError extends Error {
194
+ constructor(message = 'This Stack has been closed.') {
195
+ super(message);
196
+ this.name = 'StackClosedError';
197
+ }
198
+ }
199
+ /**
200
+ * Thrown when a scoped view is asked to observe a stack whose adapter
201
+ * relays a remote feed. Outside the StackError taxonomy for the same
202
+ * reason StackClosedError is: it reports a topology the caller assembled,
203
+ * not a state a request can be in.
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.
211
+ * See docs/spec/events.md § Permission scoping.
212
+ */
213
+ export class StackRelayScopeError extends Error {
214
+ constructor(message) {
215
+ super(message);
216
+ this.name = 'StackRelayScopeError';
217
+ }
218
+ }
219
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAuBpD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAgB,UAAW,SAAQ,KAAK;CAE7C;AAED,MAAM,OAAO,oBAAqB,SAAQ,UAAU;IAGtB;IAF5B,MAAM,CAAU,IAAI,GAAG,YAAqB,CAAC;IAC3B,IAAI,GAAG,oBAAoB,CAAC,IAAI,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------
4
+ * What a `_grant` Record says, and who it says it about. The coverage
5
+ * question — does this grant reach this grantee — is answered here rather
6
+ * than at each call site so that the access checks and listGrants() cannot
7
+ * drift apart about it.
8
+ *
9
+ * See docs/spec/access-control.md § Type-level grants.
10
+ */
11
+ import type { GroupRole } from './access.js';
12
+ import type { EntityId, GrantAction, GrantContent, QueryResult, RecordId, StackQuery, StackRecord } from './types.js';
13
+ /**
14
+ * Valid GrantAction values, for runtime validation in Stack.grant().
15
+ * Built from GRANT_ACTIONS (types.ts), the source of truth GrantAction is
16
+ * itself derived from — so this can't drift from the type.
17
+ */
18
+ export declare const GRANT_ACTION_SET: ReadonlySet<GrantAction>;
19
+ /**
20
+ * The read actions that make a mutate action coherent, scope for scope: a
21
+ * `-any` verb needs read over the same reach it can mutate, a `-own` verb
22
+ * needs read over its author's own. A grant carrying neither conveys the
23
+ * verb to nobody. `create` has no companion — writing a Record you then
24
+ * cannot read is the drop-box, and it discloses nothing.
25
+ * See docs/spec/access-control.md § Write implies read.
26
+ */
27
+ export declare const READ_COMPANIONS: ReadonlyMap<GrantAction, readonly GrantAction[]>;
28
+ /**
29
+ * Whether one grant's action list conveys `action`. The companion has to
30
+ * sit in the same `_grant` Record, not merely somewhere in the grantee's
31
+ * set: a grant is revoked whole, so a rule satisfied across two records
32
+ * would let revoking the read one leave a mutate-without-read grant
33
+ * standing — the configuration this rule exists to refuse, arrived at
34
+ * without anyone writing it.
35
+ */
36
+ export declare function grantConveys(actions: readonly string[], action: GrantAction): boolean;
37
+ /**
38
+ * Who a grant() / revoke() / listGrants() call targets: a specific entity
39
+ * (DID), a `_group` Record's roster (by ID), or `null` for the default
40
+ * grant / default-only listing. See docs/spec/access-control.md § Type-level
41
+ * grants.
42
+ */
43
+ export type GrantTarget = EntityId | {
44
+ groupId: RecordId;
45
+ } | null;
46
+ /** Direct (non-roster) match between a stored _grant's content and a GrantTarget. */
47
+ export declare function matchesGrantTarget(content: GrantContent, target: GrantTarget): boolean;
48
+ /**
49
+ * Reject a grant target that names nobody. An empty groupId or entityId is
50
+ * falsy, so a stored record carrying one reads as a *default* grant — every
51
+ * authenticated entity — instead of the target the caller meant. `null` is
52
+ * the only way to say "default".
53
+ */
54
+ export declare function validateGrantTarget(target: GrantTarget): void;
55
+ /**
56
+ * Whether a stored _grant covers `grantee`: a direct DID match, roster
57
+ * membership when `allowGroup`, or a default when `allowDefault`. Presence
58
+ * decides the tier, never truthiness — an empty grantee field names nobody.
59
+ * Module-level so the access checks and listGrants() cannot drift apart.
60
+ * See docs/spec/access-control.md § Type-level grants.
61
+ */
62
+ export declare function grantCoversGrantee(c: GrantContent, grantee: EntityId, opts: {
63
+ allowDefault: boolean;
64
+ allowGroup: boolean;
65
+ groupRoles: Map<string, GroupRole | null>;
66
+ resolveRecord: (id: RecordId) => Promise<StackRecord | null>;
67
+ }): Promise<boolean>;
68
+ /**
69
+ * System type families grant() refuses to target: a grant on any of them
70
+ * would let the grantee mint their own grants, touch stack config, or
71
+ * register an app card claiming a DID that isn't theirs — the last of
72
+ * which is what verified app attribution rests on. See
73
+ * docs/spec/access-control.md § Type-level grants.
74
+ */
75
+ export declare const UNGRANTABLE_SYSTEM_TYPES: ReadonlySet<string>;
76
+ /**
77
+ * Every `_grant` Record, cursor-walked. Read through an unscoped query at
78
+ * every call site: a grant is what decides who may read, so it can never
79
+ * itself sit behind a read check. No content prefilter — a stored grant's
80
+ * typeId may be a bare baseId or versioned, so exact matching would wrongly
81
+ * exclude family versions.
82
+ */
83
+ export declare function loadGrantRecords(query: (q: StackQuery) => Promise<QueryResult>): Promise<StackRecord[]>;
84
+ //# sourceMappingURL=grants.d.ts.map