@haverstack/core 0.41.0 → 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +124 -64
- package/dist/access.d.ts +43 -47
- package/dist/access.d.ts.map +1 -1
- package/dist/access.js +66 -101
- 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} +18 -3
- package/dist/adapter/combine.js.map +1 -0
- package/dist/adapter/index.d.ts +19 -0
- package/dist/adapter/index.d.ts.map +1 -0
- package/dist/adapter/index.js +16 -0
- package/dist/adapter/index.js.map +1 -0
- package/dist/adapter/reach.d.ts +14 -0
- package/dist/adapter/reach.d.ts.map +1 -0
- package/dist/adapter/reach.js +31 -0
- package/dist/adapter/reach.js.map +1 -0
- package/dist/{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 +69 -0
- package/dist/associations/identity.d.ts.map +1 -0
- package/dist/associations/identity.js +174 -0
- package/dist/associations/identity.js.map +1 -0
- package/dist/associations/validation.d.ts +83 -0
- package/dist/associations/validation.d.ts.map +1 -0
- package/dist/associations/validation.js +312 -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 +178 -0
- package/dist/collection.d.ts.map +1 -0
- package/dist/collection.js +397 -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 +54 -66
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +58 -62
- package/dist/errors.js.map +1 -1
- package/dist/grants.d.ts +20 -44
- package/dist/grants.d.ts.map +1 -1
- package/dist/grants.js +69 -151
- 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 +13 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +3 -6
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +6 -10
- package/dist/install.js.map +1 -1
- package/dist/lazy.d.ts +13 -0
- package/dist/lazy.d.ts.map +1 -0
- package/dist/lazy.js +27 -0
- package/dist/lazy.js.map +1 -0
- package/dist/merge.d.ts +1 -1
- package/dist/merge.d.ts.map +1 -1
- package/dist/merge.js +6 -12
- 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 +68 -121
- package/dist/query-validation.d.ts.map +1 -1
- package/dist/query-validation.js +214 -380
- package/dist/query-validation.js.map +1 -1
- package/dist/record-changes.d.ts +11 -150
- package/dist/record-changes.d.ts.map +1 -1
- package/dist/record-changes.js +14 -305
- 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-snapshot.d.ts +37 -0
- package/dist/scoped-stack/authority-snapshot.d.ts.map +1 -0
- package/dist/scoped-stack/authority-snapshot.js +49 -0
- package/dist/scoped-stack/authority-snapshot.js.map +1 -0
- package/dist/scoped-stack/authority.d.ts +169 -0
- package/dist/scoped-stack/authority.d.ts.map +1 -0
- package/dist/scoped-stack/authority.js +408 -0
- package/dist/scoped-stack/authority.js.map +1 -0
- package/dist/scoped-stack/family-policy.d.ts +59 -0
- package/dist/scoped-stack/family-policy.d.ts.map +1 -0
- package/dist/scoped-stack/family-policy.js +68 -0
- package/dist/scoped-stack/family-policy.js.map +1 -0
- package/dist/scoped-stack/scoped-stack.d.ts +318 -0
- package/dist/scoped-stack/scoped-stack.d.ts.map +1 -0
- package/dist/scoped-stack/scoped-stack.js +695 -0
- package/dist/scoped-stack/scoped-stack.js.map +1 -0
- package/dist/scoped-stack/subscription.d.ts +36 -0
- package/dist/scoped-stack/subscription.d.ts.map +1 -0
- package/dist/scoped-stack/subscription.js +69 -0
- package/dist/scoped-stack/subscription.js.map +1 -0
- package/dist/stack/arguments.d.ts +27 -0
- package/dist/stack/arguments.d.ts.map +1 -0
- package/dist/stack/arguments.js +53 -0
- package/dist/stack/arguments.js.map +1 -0
- package/dist/stack/attachments.d.ts +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} +30 -72
- package/dist/stack/changes.d.ts.map +1 -0
- package/dist/{changes.js → stack/changes.js} +40 -74
- package/dist/stack/changes.js.map +1 -0
- package/dist/stack/client.d.ts +247 -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} +5 -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 +262 -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 +69 -0
- package/dist/stack/reads.d.ts.map +1 -0
- package/dist/stack/reads.js +141 -0
- 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 +444 -0
- package/dist/stack/stack.d.ts.map +1 -0
- package/dist/stack/stack.js +1339 -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 +79 -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/stack/write-gate.d.ts +23 -0
- package/dist/stack/write-gate.d.ts.map +1 -0
- package/dist/stack/write-gate.js +17 -0
- package/dist/stack/write-gate.js.map +1 -0
- package/dist/testing.d.ts +44 -33
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +180 -176
- 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 +282 -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 +140 -0
- package/dist/types/associations.d.ts.map +1 -0
- package/dist/types/associations.js +6 -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 +150 -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 +31 -70
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +52 -92
- 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} +35 -12
- package/dist/wire/body.d.ts.map +1 -0
- package/dist/{wire-body.js → wire/body.js} +74 -13
- 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 +31 -0
- package/dist/wire/record.d.ts.map +1 -0
- package/dist/{wire-record.js → wire/record.js} +7 -67
- package/dist/wire/record.js.map +1 -0
- package/dist/{wire-request.d.ts → wire/request.d.ts} +32 -49
- package/dist/wire/request.d.ts.map +1 -0
- package/dist/{wire-request.js → wire/request.js} +113 -83
- package/dist/wire/request.js.map +1 -0
- package/package.json +7 -7
- package/dist/adapter-entry.d.ts +0 -16
- package/dist/adapter-entry.d.ts.map +0 -1
- package/dist/adapter-entry.js +0 -14
- 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 -549
- package/dist/scoped-stack.d.ts.map +0 -1
- package/dist/scoped-stack.js +0 -1301
- 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 +0 -38
- package/dist/stack-reads.d.ts.map +0 -1
- package/dist/stack-reads.js +0 -79
- package/dist/stack-reads.js.map +0 -1
- package/dist/stack.d.ts +0 -1032
- package/dist/stack.d.ts.map +0 -1
- package/dist/stack.js +0 -2337
- package/dist/stack.js.map +0 -1
- package/dist/types.d.ts +0 -1278
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -51
- 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 +0 -50
- 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
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Query
|
|
2
|
+
* Query validation
|
|
3
3
|
* -------------------------------------------------------
|
|
4
|
-
* The sanitizers a query passes through before any adapter sees it
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* raw JSON that no compiler has seen.
|
|
4
|
+
* The sanitizers a query passes through before any adapter sees it. A
|
|
5
|
+
* `QuerySort` field or a filter's discriminated union is a compile-time
|
|
6
|
+
* promise, and a server mapping a request onto either supplies raw JSON
|
|
7
|
+
* that no compiler has seen.
|
|
9
8
|
*
|
|
10
9
|
* These live in the invariant layer for the reason validation and
|
|
11
10
|
* `_config` protection do — so no adapter can forget one. `assertQueryCapabilities`
|
|
@@ -16,16 +15,24 @@
|
|
|
16
15
|
* the query — one rule, one answer.
|
|
17
16
|
* See docs/spec/data-model.md § Capability-gated filters.
|
|
18
17
|
*/
|
|
19
|
-
import type {
|
|
20
|
-
import type { Association, AssociationEdit, AuthorityAssociation, DataAssociation, GrantGrantee, JournalQuery, VersionsQuery, QuerySort, RecordFilter, RelationshipTarget, StackCapabilities } from './types.js';
|
|
18
|
+
import type { AdapterQuery, PlainQuery, StackQuery, JournalQuery, QuerySort, RecordFilter, StackCapabilities, VersionsQuery } from './types/index.js';
|
|
21
19
|
/**
|
|
22
|
-
* Fail loud rather than silently widen: a filter
|
|
23
|
-
* would otherwise be dropped,
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
20
|
+
* Fail loud rather than silently widen or reorder: a filter or sort the
|
|
21
|
+
* adapter can't honor would otherwise be dropped, answering with some
|
|
22
|
+
* other result, which a caller reading one bounded page cannot detect.
|
|
23
|
+
* Every refusal names the capability. The companion to resolveQuery(),
|
|
24
|
+
* which refuses the query's own shape; every entry point runs both. See
|
|
25
|
+
* docs/spec/data-model.md § Capability-gated filters.
|
|
27
26
|
*/
|
|
28
|
-
export declare function assertQueryCapabilities(
|
|
27
|
+
export declare function assertQueryCapabilities(query: AdapterQuery, capabilities: Pick<StackCapabilities, 'filter' | 'sort'>): void;
|
|
28
|
+
/**
|
|
29
|
+
* Hold `filter.contentByType` to a split along Types: at least one arm,
|
|
30
|
+
* each pinned to a TypeId and flat, and never beside a top-level content
|
|
31
|
+
* predicate, whose relation to the arms would be ambiguous. A map that
|
|
32
|
+
* could arrive empty would match everything once it crossed the wire. See
|
|
33
|
+
* docs/spec/data-model.md § Content by type.
|
|
34
|
+
*/
|
|
35
|
+
export declare function assertValidContentByType(filter: RecordFilter | undefined): void;
|
|
29
36
|
/**
|
|
30
37
|
* Whether a single-segment content filter can be pushed down to the
|
|
31
38
|
* adapter. Callers that read a content field pair this with an in-memory
|
|
@@ -42,101 +49,44 @@ export declare function filtersContent(features: Pick<StackCapabilities, 'filter
|
|
|
42
49
|
*/
|
|
43
50
|
export declare function parseContentFilterKey(key: string): string[];
|
|
44
51
|
/**
|
|
45
|
-
* Reject a sort
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* adapter interpolates the direction straight into `ORDER BY`, so an
|
|
50
|
-
* unvalidated value there is a SQL-injection sink reachable from every
|
|
51
|
-
* untrusted caller. Validating in the invariant layer — the same reason
|
|
52
|
-
* emission and _config protection live here — means no adapter can forget
|
|
53
|
-
* it. See docs/spec/data-model.md § Sorting and pagination.
|
|
52
|
+
* Reject a sort outside the closed set the types promise. A type is not a
|
|
53
|
+
* runtime guard, and a SQLite adapter interpolates the direction straight
|
|
54
|
+
* into `ORDER BY`, so an unvalidated one is an injection sink reachable by
|
|
55
|
+
* any untrusted caller. See docs/spec/data-model.md § Sorting and pagination.
|
|
54
56
|
*/
|
|
55
57
|
export declare function assertValidSort(sort: QuerySort | undefined): void;
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
*
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
*
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
* Reject a relationship target outside the closed set the types promise.
|
|
89
|
-
* A discriminated union is not a runtime guard — a server mapping a
|
|
90
|
-
* request body onto an association supplies raw JSON — and an
|
|
91
|
-
* unrecognized kind would otherwise be stored under the one arm that
|
|
92
|
-
* names a Record in this stack. See docs/spec/data-model.md
|
|
93
|
-
* § Relationship targets.
|
|
94
|
-
*
|
|
95
|
-
* A key the element's kind does not define is thrown as a 400 rather than
|
|
96
|
-
* collected, at every depth: it addresses nothing, the way an unknown key
|
|
97
|
-
* on a request body does. See docs/spec/data-model.md § Associations.
|
|
98
|
-
*/
|
|
99
|
-
export declare function validateAssociation(association: Association, path?: string): ValidationError[];
|
|
100
|
-
/**
|
|
101
|
-
* Refuse an authority element reaching the data half of the partition.
|
|
102
|
-
* The two share a table, a delta shape and a durability tier; they never
|
|
103
|
-
* share a call, because an app editing tags would otherwise be able to
|
|
104
|
-
* replace an ACL it was never shown. Thrown rather than collected: the
|
|
105
|
-
* caller named the wrong surface, not a malformed value, and the verb it
|
|
106
|
-
* wanted is `grantAccess()`/`revokeAccess()`.
|
|
107
|
-
*
|
|
108
|
-
* Lives here, in the invariant layer, so an unscoped `Stack`, an import
|
|
109
|
-
* and a server mapping a request body are all held to it.
|
|
110
|
-
* See docs/spec/access-control.md § Record-level permissions.
|
|
111
|
-
*/
|
|
112
|
-
export declare function assertDataAssociations(associations: readonly Association[], surface: string): asserts associations is DataAssociation[];
|
|
113
|
-
/**
|
|
114
|
-
* The mirror of assertDataAssociations(): the `permissions` surface takes
|
|
115
|
-
* authority kinds alone, so a tag routed through it is refused rather than
|
|
116
|
-
* quietly becoming an ACL entry the `associations` projection never shows.
|
|
117
|
-
*/
|
|
118
|
-
export declare function assertAuthorityAssociations(permissions: readonly Association[], surface: string): asserts permissions is AuthorityAssociation[];
|
|
119
|
-
/** validateAssociation() over a create's `associations` array. */
|
|
120
|
-
/**
|
|
121
|
-
* Every association in a list, plus the one rule a list has that a single
|
|
122
|
-
* association does not: **identities are distinct**. A list naming one
|
|
123
|
-
* identity twice describes a state no store can hold — an adapter keys
|
|
124
|
-
* associations by identity, so the second entry displaces the first — and
|
|
125
|
-
* which of the two the record ends up with is a question the caller did
|
|
126
|
-
* not mean to ask. Refused rather than collapsed, for the reason an empty
|
|
127
|
-
* change set is refused: every way of producing one is a caller bug.
|
|
128
|
-
* See docs/spec/data-model.md § Associations.
|
|
129
|
-
*/
|
|
130
|
-
export declare function validateAssociations(associations: Association[] | undefined, path?: string): ValidationError[];
|
|
131
|
-
/**
|
|
132
|
-
* Hold an association edit list to the rules every verb shares: non-empty,
|
|
133
|
-
* every element a known `op` over a well-formed association, one surface,
|
|
134
|
-
* and each identity named once — a list that both removes and adds one
|
|
135
|
-
* identity is the same ambiguity as naming it twice. `repoint` is the
|
|
136
|
-
* journal's word, never a request. Asked of the whole list before anything
|
|
137
|
-
* is read or written. See docs/spec/data-model.md § Mutations.
|
|
138
|
-
*/
|
|
139
|
-
export declare function assertAssociationEdits(changes: unknown, surface: string, half: 'data' | 'authority'): asserts changes is AssociationEdit[];
|
|
58
|
+
/** The page a query reads when it names no `limit`. */
|
|
59
|
+
export declare const DEFAULT_QUERY_LIMIT = 50;
|
|
60
|
+
/** The largest page a query reads, whatever it asks for. */
|
|
61
|
+
export declare const MAX_QUERY_LIMIT = 1000;
|
|
62
|
+
/**
|
|
63
|
+
* The query an adapter receives: its shape checked, and every default
|
|
64
|
+
* resolved so no adapter carries one — a named sort runs ascending, no
|
|
65
|
+
* sort is `createdAt` newest first, and the page is DEFAULT_QUERY_LIMIT
|
|
66
|
+
* up to MAX_QUERY_LIMIT. Shape refusals name no capability; see
|
|
67
|
+
* assertQueryCapabilities() for those that do. See docs/spec/data-model.md
|
|
68
|
+
* § Sorting and pagination.
|
|
69
|
+
*/
|
|
70
|
+
export declare function resolveQuery(query: PlainQuery): AdapterQuery;
|
|
71
|
+
/** A query split where it enters `Stack`; see splitQuery(). */
|
|
72
|
+
export type SplitQuery = {
|
|
73
|
+
query: AdapterQuery;
|
|
74
|
+
presentAt?: StackQuery['presentAt'];
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Split a query at the door into what an adapter sees, resolved, and
|
|
78
|
+
* `presentAt`, which `Stack` applies to the results. Every check runs
|
|
79
|
+
* here, before the adapter is asked. See docs/spec/data-model.md
|
|
80
|
+
* § Sorting and pagination.
|
|
81
|
+
*/
|
|
82
|
+
export declare function splitQuery(query: StackQuery): SplitQuery;
|
|
83
|
+
/**
|
|
84
|
+
* Hold a window bound — a page size, a cursor position — to an integer
|
|
85
|
+
* at or above `min`, the one shape every adapter reads alike: a negative
|
|
86
|
+
* `limit` drops entries from a JS slice but empties or lifts a SQL
|
|
87
|
+
* `LIMIT`. See docs/spec/data-model.md § Sorting and pagination.
|
|
88
|
+
*/
|
|
89
|
+
export declare function assertWindowInteger(value: number | undefined, label: string, min: 0 | 1): void;
|
|
140
90
|
/**
|
|
141
91
|
* Reject an association filter that names neither of its halves, or whose
|
|
142
92
|
* relationship target is malformed. `RelatedToFilter` and `AttachmentFilter`
|
|
@@ -145,6 +95,12 @@ export declare function assertAssociationEdits(changes: unknown, surface: string
|
|
|
145
95
|
* any association of that kind. See docs/spec/data-model.md § Filter.
|
|
146
96
|
*/
|
|
147
97
|
export declare function assertValidAssociationFilters(filter: RecordFilter | undefined): void;
|
|
98
|
+
/**
|
|
99
|
+
* Refuse a `baseId` argument that cannot name a type family, as an
|
|
100
|
+
* argument error prefixed with the `surface` it was passed to. See
|
|
101
|
+
* familyIdProblem().
|
|
102
|
+
*/
|
|
103
|
+
export declare function assertFamilyId(baseId: unknown, surface: string): void;
|
|
148
104
|
/**
|
|
149
105
|
* Refuse a `baseId` carrying an `@version` suffix. A family filter resolves
|
|
150
106
|
* against registered families, so a TypeId there would match nothing and
|
|
@@ -154,23 +110,14 @@ export declare function assertValidBaseIdFilter(filter: {
|
|
|
154
110
|
baseId?: string | string[];
|
|
155
111
|
} | undefined): void;
|
|
156
112
|
/**
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* `slice(0, -1)` drops the newest entry, while SQLite reads a negative
|
|
161
|
-
* LIMIT as "no ceiling" and returns the whole log. Neither is what the
|
|
162
|
-
* caller asked for, and the disagreement is invisible until a stack
|
|
163
|
-
* changes adapters. Refuse at the surface so no adapter has to guess.
|
|
164
|
-
*
|
|
165
|
-
* No ceiling is imposed: unlike a query, omitting `limit` reads the whole
|
|
166
|
-
* log by contract, so a clamp would silently truncate exactly the caller
|
|
167
|
-
* reconstructing an association's full history.
|
|
113
|
+
* A journal window: `afterSeq` 0 is the start of the log. No ceiling is
|
|
114
|
+
* imposed — omitting `limit` reads the whole log by contract, which a
|
|
115
|
+
* clamp would silently truncate.
|
|
168
116
|
*/
|
|
169
117
|
export declare function assertValidJournalQuery(query: JournalQuery | undefined): void;
|
|
170
118
|
/**
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
* omitting `limit` reads every version by contract.
|
|
119
|
+
* A `getVersions()` window. No ceiling is imposed: omitting `limit` reads
|
|
120
|
+
* every version by contract.
|
|
174
121
|
*/
|
|
175
122
|
export declare function assertValidVersionsQuery(query: VersionsQuery | undefined): void;
|
|
176
123
|
//# sourceMappingURL=query-validation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-validation.d.ts","sourceRoot":"","sources":["../src/query-validation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"query-validation.d.ts","sourceRoot":"","sources":["../src/query-validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAYH,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EAEV,UAAU,EACV,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACd,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,YAAY,EACnB,YAAY,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,MAAM,CAAC,GACvD,IAAI,CAGN;AA0DD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI,CAgD/E;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,GAAG,OAAO,CAEnF;AAUD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAqB3D;AAaD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,IAAI,CAsBjE;AAsDD,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,4DAA4D;AAC5D,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,YAAY,CAc5D;AAED,+DAA+D;AAC/D,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;CACrC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAMxD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAO9F;AAmCD;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI,CAmBpF;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAKrE;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE,GAAG,SAAS,GAAG,IAAI,CAOhG;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI,CAG7E;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI,CAG/E"}
|