@haverstack/core 0.42.0 → 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -7
- package/dist/access.d.ts +30 -32
- package/dist/access.d.ts.map +1 -1
- package/dist/access.js +40 -98
- package/dist/access.js.map +1 -1
- package/dist/adapter/combine.d.ts.map +1 -1
- package/dist/adapter/combine.js +11 -3
- package/dist/adapter/combine.js.map +1 -1
- package/dist/adapter/index.d.ts +6 -4
- package/dist/adapter/index.d.ts.map +1 -1
- package/dist/adapter/index.js +4 -3
- package/dist/adapter/index.js.map +1 -1
- package/dist/adapter/reach.d.ts +14 -0
- package/dist/adapter/reach.d.ts.map +1 -0
- package/dist/adapter/reach.js +31 -0
- package/dist/adapter/reach.js.map +1 -0
- package/dist/associations/identity.d.ts +18 -42
- package/dist/associations/identity.d.ts.map +1 -1
- package/dist/associations/identity.js +60 -84
- package/dist/associations/identity.js.map +1 -1
- package/dist/associations/validation.d.ts +1 -8
- package/dist/associations/validation.d.ts.map +1 -1
- package/dist/associations/validation.js +3 -30
- package/dist/associations/validation.js.map +1 -1
- package/dist/collection.d.ts +7 -11
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +24 -34
- package/dist/collection.js.map +1 -1
- package/dist/content-match.d.ts +2 -2
- package/dist/content-match.js +2 -2
- package/dist/errors.d.ts +23 -8
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +28 -9
- package/dist/errors.js.map +1 -1
- package/dist/grants.d.ts +3 -3
- package/dist/grants.d.ts.map +1 -1
- package/dist/grants.js +4 -21
- package/dist/grants.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/lazy.d.ts +13 -0
- package/dist/lazy.d.ts.map +1 -0
- package/dist/lazy.js +27 -0
- package/dist/lazy.js.map +1 -0
- package/dist/merge.d.ts +1 -1
- package/dist/merge.js +1 -1
- package/dist/query-validation.d.ts +41 -28
- package/dist/query-validation.d.ts.map +1 -1
- package/dist/query-validation.js +85 -71
- package/dist/query-validation.js.map +1 -1
- package/dist/record-changes.d.ts +12 -36
- package/dist/record-changes.d.ts.map +1 -1
- package/dist/record-changes.js +9 -98
- package/dist/record-changes.js.map +1 -1
- package/dist/scoped-stack/authority-snapshot.d.ts +37 -0
- package/dist/scoped-stack/authority-snapshot.d.ts.map +1 -0
- package/dist/scoped-stack/authority-snapshot.js +49 -0
- package/dist/scoped-stack/authority-snapshot.js.map +1 -0
- package/dist/scoped-stack/authority.d.ts +51 -38
- package/dist/scoped-stack/authority.d.ts.map +1 -1
- package/dist/scoped-stack/authority.js +160 -136
- package/dist/scoped-stack/authority.js.map +1 -1
- package/dist/scoped-stack/family-policy.d.ts +59 -0
- package/dist/scoped-stack/family-policy.d.ts.map +1 -0
- package/dist/scoped-stack/family-policy.js +68 -0
- package/dist/scoped-stack/family-policy.js.map +1 -0
- package/dist/scoped-stack/scoped-stack.d.ts +66 -86
- package/dist/scoped-stack/scoped-stack.d.ts.map +1 -1
- package/dist/scoped-stack/scoped-stack.js +243 -324
- package/dist/scoped-stack/scoped-stack.js.map +1 -1
- package/dist/scoped-stack/subscription.d.ts +14 -33
- package/dist/scoped-stack/subscription.d.ts.map +1 -1
- package/dist/scoped-stack/subscription.js +16 -57
- package/dist/scoped-stack/subscription.js.map +1 -1
- package/dist/stack/arguments.d.ts +27 -0
- package/dist/stack/arguments.d.ts.map +1 -0
- package/dist/stack/arguments.js +53 -0
- package/dist/stack/arguments.js.map +1 -0
- package/dist/stack/attachments.d.ts +1 -1
- package/dist/stack/attachments.js +1 -1
- package/dist/stack/changes.d.ts +4 -10
- package/dist/stack/changes.d.ts.map +1 -1
- package/dist/stack/changes.js +8 -8
- package/dist/stack/changes.js.map +1 -1
- package/dist/stack/client.d.ts +34 -58
- package/dist/stack/client.d.ts.map +1 -1
- package/dist/stack/install-app.d.ts.map +1 -1
- package/dist/stack/install-app.js +7 -5
- package/dist/stack/install-app.js.map +1 -1
- package/dist/stack/integrity.js +2 -2
- package/dist/stack/integrity.js.map +1 -1
- package/dist/stack/limits.d.ts +1 -1
- package/dist/stack/limits.js +1 -1
- package/dist/stack/reads.d.ts +9 -5
- package/dist/stack/reads.d.ts.map +1 -1
- package/dist/stack/reads.js +24 -4
- package/dist/stack/reads.js.map +1 -1
- package/dist/stack/stack.d.ts +77 -71
- package/dist/stack/stack.d.ts.map +1 -1
- package/dist/stack/stack.js +229 -256
- package/dist/stack/stack.js.map +1 -1
- package/dist/stack/type-grants.d.ts.map +1 -1
- package/dist/stack/type-grants.js +4 -4
- package/dist/stack/type-grants.js.map +1 -1
- package/dist/stack/write-expectation.d.ts +13 -12
- package/dist/stack/write-expectation.d.ts.map +1 -1
- package/dist/stack/write-expectation.js.map +1 -1
- package/dist/stack/write-gate.d.ts +23 -0
- package/dist/stack/write-gate.d.ts.map +1 -0
- package/dist/stack/write-gate.js +17 -0
- package/dist/stack/write-gate.js.map +1 -0
- package/dist/testing.d.ts +25 -9
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +147 -123
- package/dist/testing.js.map +1 -1
- package/dist/types/adapter.d.ts +90 -31
- package/dist/types/adapter.d.ts.map +1 -1
- package/dist/types/associations.d.ts +1 -17
- package/dist/types/associations.d.ts.map +1 -1
- package/dist/types/associations.js +1 -8
- package/dist/types/associations.js.map +1 -1
- package/dist/types/capabilities.d.ts +8 -8
- package/dist/types/capabilities.d.ts.map +1 -1
- package/dist/types/events.d.ts +3 -8
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/query.d.ts +4 -4
- package/dist/types/system.d.ts +1 -1
- package/dist/validate.d.ts +2 -0
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +2 -1
- package/dist/validate.js.map +1 -1
- package/dist/wire/body.d.ts +32 -9
- package/dist/wire/body.d.ts.map +1 -1
- package/dist/wire/body.js +69 -8
- package/dist/wire/body.js.map +1 -1
- package/dist/wire/index.d.ts +4 -4
- package/dist/wire/index.d.ts.map +1 -1
- package/dist/wire/index.js +3 -3
- package/dist/wire/index.js.map +1 -1
- package/dist/wire/record.d.ts +1 -8
- package/dist/wire/record.d.ts.map +1 -1
- package/dist/wire/record.js +0 -48
- package/dist/wire/record.js.map +1 -1
- package/dist/wire/request.d.ts +18 -18
- package/dist/wire/request.d.ts.map +1 -1
- package/dist/wire/request.js +41 -36
- package/dist/wire/request.js.map +1 -1
- package/package.json +1 -1
package/dist/wire/body.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Stack — Wire Request Bodies
|
|
3
3
|
* -------------------------------------------------------
|
|
4
4
|
* The JSON bodies of the endpoints core specifies but runs no server for:
|
|
5
|
-
* the auth handshake,
|
|
5
|
+
* the auth handshake, the per-aspect record writes, `POST /types`,
|
|
6
6
|
* `POST /records/:id/migrate` and `POST /installs`. Each parser names every key its endpoint
|
|
7
7
|
* defines, so a server refuses the rest without keeping its own copy of
|
|
8
8
|
* the list — a copy that drifts the first time core adds a field.
|
|
@@ -79,18 +79,79 @@ export function parseAuthTokenBody(body) {
|
|
|
79
79
|
signature: requiredString(b, 'signature', label),
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
// -------------------------------------------------------
|
|
83
|
+
// PATCH /records/:id/content, PATCH /entity/content
|
|
84
|
+
// -------------------------------------------------------
|
|
85
|
+
/**
|
|
86
|
+
* Parse a content patch body: the bare patch, every key a content key.
|
|
87
|
+
* Which keys the record's type declares is `patchContent()`'s to judge, so
|
|
88
|
+
* an undeclared one is its 422 rather than a 400 here.
|
|
89
|
+
* See docs/spec/wire-format.md § Content.
|
|
90
|
+
*/
|
|
91
|
+
export function parseContentPatchBody(body) {
|
|
92
|
+
return requireBody(body, 'content patch');
|
|
93
|
+
}
|
|
94
|
+
// -------------------------------------------------------
|
|
95
|
+
// PUT /records/:id/parent, PUT /records/:id/unlisted
|
|
96
|
+
// -------------------------------------------------------
|
|
97
|
+
/**
|
|
98
|
+
* Parse a `PUT /records/:id/parent` body. `null` is the root, not a
|
|
99
|
+
* removal spelling. See docs/spec/wire-format.md § Parent.
|
|
100
|
+
*/
|
|
101
|
+
export function parseParentBody(body) {
|
|
102
|
+
const label = 'parent body';
|
|
103
|
+
const b = requireKnownBody(body, ['parentId'], label);
|
|
104
|
+
const { parentId } = b;
|
|
105
|
+
if (parentId === undefined)
|
|
106
|
+
throw new StackBadRequestError(`Invalid ${label}: parentId is required`);
|
|
107
|
+
if (parentId !== null && typeof parentId !== 'string')
|
|
108
|
+
fieldError('parentId', 'parentId must be a string or null');
|
|
109
|
+
return { parentId };
|
|
110
|
+
}
|
|
111
|
+
/** Parse a `PUT /records/:id/unlisted` body. See docs/spec/wire-format.md § Unlisted. */
|
|
112
|
+
export function parseUnlistedBody(body) {
|
|
113
|
+
const label = 'unlisted body';
|
|
114
|
+
const b = requireKnownBody(body, ['unlisted'], label);
|
|
115
|
+
const { unlisted } = b;
|
|
116
|
+
if (unlisted === undefined)
|
|
117
|
+
throw new StackBadRequestError(`Invalid ${label}: unlisted is required`);
|
|
118
|
+
if (typeof unlisted !== 'boolean')
|
|
119
|
+
fieldError('unlisted', 'unlisted must be a boolean');
|
|
120
|
+
return { unlisted };
|
|
121
|
+
}
|
|
122
|
+
// -------------------------------------------------------
|
|
123
|
+
// PUT /records/:id/associations, PUT /records/:id/permissions
|
|
124
|
+
// -------------------------------------------------------
|
|
125
|
+
/**
|
|
126
|
+
* Parse a `PUT /records/:id/associations` body into the set
|
|
127
|
+
* `setAssociations()` takes. Elements are `setAssociations()`'s to judge.
|
|
128
|
+
* See docs/spec/wire-format.md § Associations.
|
|
129
|
+
*/
|
|
130
|
+
export function parseAssociationsBody(body) {
|
|
131
|
+
return requiredList(body, 'associations', 'associations body');
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Parse a `PUT /records/:id/permissions` body into the set `setAccess()`
|
|
135
|
+
* takes; `[]` makes the record private. See docs/spec/wire-format.md § Permissions.
|
|
136
|
+
*/
|
|
137
|
+
export function parsePermissionsBody(body) {
|
|
138
|
+
return requiredList(body, 'permissions', 'permissions body');
|
|
139
|
+
}
|
|
140
|
+
function requiredList(body, key, label) {
|
|
141
|
+
const b = requireKnownBody(body, [key], label);
|
|
142
|
+
const value = b[key];
|
|
143
|
+
if (value === undefined)
|
|
144
|
+
throw new StackBadRequestError(`Invalid ${label}: ${key} is required`);
|
|
145
|
+
if (!Array.isArray(value))
|
|
146
|
+
fieldError(key, `${key} must be an array`);
|
|
147
|
+
return value;
|
|
87
148
|
}
|
|
88
149
|
// -------------------------------------------------------
|
|
89
150
|
// POST /records/:id/associations, POST /records/:id/permissions
|
|
90
151
|
// -------------------------------------------------------
|
|
91
152
|
/**
|
|
92
|
-
* Parse an association or permission
|
|
93
|
-
* `
|
|
153
|
+
* Parse an association or permission edit body into the edits
|
|
154
|
+
* `editAssociations()` and `editAccess()` take. `repoint` is something the journal records,
|
|
94
155
|
* never something a caller sends, so it is refused with the other unknown
|
|
95
156
|
* ops. Which surface an element belongs to is the endpoint's to judge.
|
|
96
157
|
* See docs/spec/wire-format.md § Associations.
|
package/dist/wire/body.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"body.js","sourceRoot":"","sources":["../../src/wire/body.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE7F,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"body.js","sourceRoot":"","sources":["../../src/wire/body.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,cA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AI,oBAAoB,CAAC,WAAW,EAAE,KAAK,GAAG,cAAc,CAAC,CAAC;IAC7F,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,UAAU,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,GAAG,mBAAmB,CAAC,CAAC;IACrF,OAAO,KAAK,CAAC;AACf,CAAC;AAED,6EAA6E;AAC7E,SAAS,WAAW,CAAC,GAA4B,EAAE,EAAU,EAAE,GAAW;IACxE,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,IAAI,KAAK,KAAK,SAAS;QAAE,MAAM,IAAI,oBAAoB,CAAC,WAAW,EAAE,KAAK,GAAG,cAAc,CAAC,CAAC;IAC7F,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,UAAU,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,GAAG,mBAAmB,CAAC,CAAC;IACjF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/wire/index.d.ts
CHANGED
|
@@ -18,13 +18,13 @@ export { isSafeAttachmentContentType, inferContentTypeFromFilename, resolveAttac
|
|
|
18
18
|
export type { AttachmentDownloadContentType } from './attachment-download.js';
|
|
19
19
|
export { firstRecordedAttachment, resolveReferencedAttachment } from '../attachment-records.js';
|
|
20
20
|
export type { StackTokenStore, TokenInfo, TokenSession } from '../types/index.js';
|
|
21
|
-
export { parseQueryParams, parseQueryBody, parseChangeParams, parseJournalParams, parseVersionsParams, parseGetRecordParams, parseDeleteParams, parseDownloadParams, parseAssociationParams, parseIfMatch, parseUploadFilename,
|
|
21
|
+
export { parseQueryParams, parseQueryBody, parseChangeParams, parseJournalParams, parseVersionsParams, parseGetRecordParams, parseDeleteParams, parseDownloadParams, parseAssociationParams, parseIfMatch, parseUploadFilename, parseUnsignedInt, } from './request.js';
|
|
22
22
|
export { assertQueryTravels } from './request.js';
|
|
23
23
|
export type { ParsedChangeParams, ParsedDownloadParams, ParsedAssociationParams, } from './request.js';
|
|
24
24
|
export { parseDate } from './request.js';
|
|
25
|
-
export { createOptionsFromWireRecord
|
|
25
|
+
export { createOptionsFromWireRecord } from './record.js';
|
|
26
26
|
export type { WireCreateRequest } from './record.js';
|
|
27
|
-
export { parseAssociationEditsBody, parseAuthChallengeBody, parseAuthTokenBody,
|
|
28
|
-
export type { WireAuthChallengeRequest, WireAuthTokenRequest,
|
|
27
|
+
export { parseContentPatchBody, parseParentBody, parseUnlistedBody, parseAssociationEditsBody, parseAssociationsBody, parsePermissionsBody, parseAuthChallengeBody, parseAuthTokenBody, parseTypeBody, parseMigrationBody, parseInstallBody, } from './body.js';
|
|
28
|
+
export type { WireAuthChallengeRequest, WireAuthTokenRequest, WireMigrationRequest, } from './body.js';
|
|
29
29
|
export { isOwnerActingAlone } from '../access.js';
|
|
30
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/wire/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wire/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,eAAe,GAChB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAK9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,oCAAoC,EACpC,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAM9E,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAIhG,YAAY,EA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,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAKtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAItB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAKzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC1D,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAKrD,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,WAAW,CAAC;AAKnB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/wire/index.js
CHANGED
|
@@ -28,7 +28,7 @@ export { firstRecordedAttachment, resolveReferencedAttachment } from '../attachm
|
|
|
28
28
|
// builds, so a server decodes every query-bearing route with these rather
|
|
29
29
|
// than transcribing the parameter table. Contract, not internal — the
|
|
30
30
|
// round trip against the builders is pinned by a test.
|
|
31
|
-
export { parseQueryParams, parseQueryBody, parseChangeParams, parseJournalParams, parseVersionsParams, parseGetRecordParams, parseDeleteParams, parseDownloadParams, parseAssociationParams, parseIfMatch, parseUploadFilename,
|
|
31
|
+
export { parseQueryParams, parseQueryBody, parseChangeParams, parseJournalParams, parseVersionsParams, parseGetRecordParams, parseDeleteParams, parseDownloadParams, parseAssociationParams, parseIfMatch, parseUploadFilename, parseUnsignedInt, } from './request.js';
|
|
32
32
|
// The build-side half of the fields that never travel: adapter-api refuses
|
|
33
33
|
// them before encoding, so which encoding a server's content reach selects
|
|
34
34
|
// never decides whether a family query widens or is refused.
|
|
@@ -39,11 +39,11 @@ export { parseDate } from './request.js';
|
|
|
39
39
|
// No in-repo caller: the create half of the same contract, so a server
|
|
40
40
|
// inherits which half of a record body it may trust rather than deciding
|
|
41
41
|
// field by field. See docs/spec/wire-format.md § Records.
|
|
42
|
-
export { createOptionsFromWireRecord
|
|
42
|
+
export { createOptionsFromWireRecord } from './record.js';
|
|
43
43
|
// No in-repo caller: the bodies of the remaining endpoints core specifies,
|
|
44
44
|
// so a server refuses a key they do not define without keeping its own
|
|
45
45
|
// list of the ones they do. See docs/spec/wire-format.md § Unrecognized input.
|
|
46
|
-
export { parseAssociationEditsBody, parseAuthChallengeBody, parseAuthTokenBody,
|
|
46
|
+
export { parseContentPatchBody, parseParentBody, parseUnlistedBody, parseAssociationEditsBody, parseAssociationsBody, parsePermissionsBody, parseAuthChallengeBody, parseAuthTokenBody, parseTypeBody, parseMigrationBody, parseInstallBody, } from './body.js';
|
|
47
47
|
// The tier gating purge, commitMigration() and includeUnlisted, which
|
|
48
48
|
// a server must decide for those routes itself. Computing it as "is the
|
|
49
49
|
// owner" is a privilege bug with no symptom.
|
package/dist/wire/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wire/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,eAAe,GAChB,MAAM,WAAW,CAAC;AAGnB,0EAA0E;AAC1E,sEAAsE;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,6DAA6D;AAC7D,gEAAgE;AAChE,oDAAoD;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,E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M,0BAA0B,CAAC;AAGlC,kEAAkE;AAClE,yEAAyE;AACzE,0EAA0E;AAC1E,yCAAyC;AACzC,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAMhG,wEAAwE;AACxE,0EAA0E;AAC1E,sEAAsE;AACtE,uDAAuD;AACvD,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,2EAA2E;AAC3E,2EAA2E;AAC3E,6DAA6D;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAOlD,wEAAwE;AACxE,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,uEAAuE;AACvE,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAG1D,2EAA2E;AAC3E,uEAAuE;AACvE,+EAA+E;AAC/E,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAOnB,sEAAsE;AACtE,wEAAwE;AACxE,6CAA6C;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/wire/record.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* here: docs/spec/wire-format.md § Records.
|
|
12
12
|
*/
|
|
13
13
|
import type { BackdatableCreateRecordOptions } from '../stack/client.js';
|
|
14
|
-
import type { EntityId,
|
|
14
|
+
import type { EntityId, TokenSession, TypeId } from '../types/index.js';
|
|
15
15
|
/**
|
|
16
16
|
* A `POST /records` body as the three arguments `ScopedStack.create()`
|
|
17
17
|
* takes. Not spread-ready, so a call site reads as three deliberate things.
|
|
@@ -28,11 +28,4 @@ export type WireCreateRequest = {
|
|
|
28
28
|
* rule. Values beyond shape are `Stack`'s to judge, or two answers drift.
|
|
29
29
|
*/
|
|
30
30
|
export declare function createOptionsFromWireRecord(body: unknown, session: TokenSession, ownerEntityId: EntityId): WireCreateRequest;
|
|
31
|
-
/**
|
|
32
|
-
* Read a `PATCH /records/:id` body as a change set. An unrecognized key is
|
|
33
|
-
* refused (400), not ignored — a dropped `permissions` silently fails to
|
|
34
|
-
* share — and a wrong-shaped value is a 422. `contentPatch` is checked for
|
|
35
|
-
* being an object only; content is `Stack`'s. See docs/spec/wire-format.md § Records.
|
|
36
|
-
*/
|
|
37
|
-
export declare function changesFromWireBody(body: unknown): RecordChangeSet;
|
|
38
31
|
//# sourceMappingURL=record.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/wire/record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/wire/record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,KAAK,EACV,QAAQ,EAIR,YAAY,EACZ,MAAM,EACP,MAAM,mBAAmB,CAAC;AAE3B;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,0EAA0E;IAC1E,OAAO,EAAE,IAAI,CAAC,8BAA8B,EAAE,WAAW,CAAC,CAAC;CAC5D,CAAC;AAsDF;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,YAAY,EACrB,aAAa,EAAE,QAAQ,GACtB,iBAAiB,CAyCnB"}
|
package/dist/wire/record.js
CHANGED
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
import { isOwnerActingAlone } from '../access.js';
|
|
14
14
|
import { StackBadRequestError } from '../errors.js';
|
|
15
15
|
import { fieldError, requireBody } from './body.js';
|
|
16
|
-
import { RECORD_CHANGE_SET_KEYS } from '../types/index.js';
|
|
17
16
|
/**
|
|
18
17
|
* Every top-level key a wire record carries — a `StackRecord`'s, so a new
|
|
19
18
|
* field fails to compile here until it is listed. A create body is a whole
|
|
@@ -114,51 +113,4 @@ export function createOptionsFromWireRecord(body, session, ownerEntityId) {
|
|
|
114
113
|
}
|
|
115
114
|
return { typeId, content: content, options };
|
|
116
115
|
}
|
|
117
|
-
/**
|
|
118
|
-
* Read a `PATCH /records/:id` body as a change set. An unrecognized key is
|
|
119
|
-
* refused (400), not ignored — a dropped `permissions` silently fails to
|
|
120
|
-
* share — and a wrong-shaped value is a 422. `contentPatch` is checked for
|
|
121
|
-
* being an object only; content is `Stack`'s. See docs/spec/wire-format.md § Records.
|
|
122
|
-
*/
|
|
123
|
-
export function changesFromWireBody(body) {
|
|
124
|
-
const envelope = requireBody(body, 'record body');
|
|
125
|
-
const unknown = Object.keys(envelope).filter((key) => !RECORD_CHANGE_SET_KEYS.includes(key));
|
|
126
|
-
if (unknown.length > 0) {
|
|
127
|
-
throw new StackBadRequestError(`Unknown change-set key${unknown.length > 1 ? 's' : ''}: ${unknown.join(', ')}. ` +
|
|
128
|
-
`A change set names one or more of: ${RECORD_CHANGE_SET_KEYS.join(', ')}.`);
|
|
129
|
-
}
|
|
130
|
-
const changes = {};
|
|
131
|
-
if (envelope.contentPatch !== undefined) {
|
|
132
|
-
const patch = envelope.contentPatch;
|
|
133
|
-
if (typeof patch !== 'object' || patch === null || Array.isArray(patch))
|
|
134
|
-
fieldError('contentPatch', 'contentPatch must be an object');
|
|
135
|
-
changes.contentPatch = patch;
|
|
136
|
-
}
|
|
137
|
-
// The one key `null` is a value for rather than a removal spelling: it
|
|
138
|
-
// is the root, the same sentinel `?parentId=null` carries.
|
|
139
|
-
if (envelope.parentId !== undefined) {
|
|
140
|
-
const parentId = envelope.parentId;
|
|
141
|
-
if (parentId !== null && typeof parentId !== 'string')
|
|
142
|
-
fieldError('parentId', 'parentId must be a string or null');
|
|
143
|
-
changes.parentId = parentId;
|
|
144
|
-
}
|
|
145
|
-
const permissions = optionalArray(envelope, 'permissions');
|
|
146
|
-
if (permissions !== undefined)
|
|
147
|
-
changes.permissions = permissions;
|
|
148
|
-
const associations = optionalArray(envelope, 'associations');
|
|
149
|
-
if (associations !== undefined)
|
|
150
|
-
changes.associations = associations;
|
|
151
|
-
if (envelope.unlisted !== undefined) {
|
|
152
|
-
if (typeof envelope.unlisted !== 'boolean')
|
|
153
|
-
fieldError('unlisted', 'unlisted must be a boolean');
|
|
154
|
-
changes.unlisted = envelope.unlisted;
|
|
155
|
-
}
|
|
156
|
-
// Every key was absent. Refused here rather than left to mutate(), so a
|
|
157
|
-
// server answers 400 without a storage round trip; mutate() refuses it
|
|
158
|
-
// again for callers that never went through the wire.
|
|
159
|
-
if (Object.keys(changes).length === 0) {
|
|
160
|
-
throw new StackBadRequestError(`An empty change set addresses nothing. Name one or more of: ${RECORD_CHANGE_SET_KEYS.join(', ')}.`);
|
|
161
|
-
}
|
|
162
|
-
return changes;
|
|
163
|
-
}
|
|
164
116
|
//# sourceMappingURL=record.js.map
|
package/dist/wire/record.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/wire/record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,oBAAoB,E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IAAI,kBAAkB,CAAC,OAAO,EAAE,aAAa,CAAC,EAAE,CAAC;QAC/C,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACjD,IAAI,SAAS,KAAK,SAAS;YAAE,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3D,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACjD,IAAI,SAAS,KAAK,SAAS;YAAE,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7D,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAkC,EAAE,OAAO,EAAE,CAAC;AAC1E,CAAC"}
|
package/dist/wire/request.d.ts
CHANGED
|
@@ -24,48 +24,48 @@
|
|
|
24
24
|
* servers already map to 400 — see docs/spec/wire-format.md § Error
|
|
25
25
|
* responses.
|
|
26
26
|
*/
|
|
27
|
-
import type { DataAssociation, ChangeFilter, JournalQuery, VersionsQuery, StackQuery } from '../types/index.js';
|
|
27
|
+
import type { DataAssociation, ChangeFilter, JournalQuery, VersionsQuery, StackQuery, PlainQuery } from '../types/index.js';
|
|
28
28
|
/** Parse an ISO date string from a wire body; undefined if absent or invalid. */
|
|
29
29
|
export declare function parseDate(val: unknown): Date | undefined;
|
|
30
30
|
/**
|
|
31
|
-
* Strict
|
|
32
|
-
*
|
|
33
|
-
* "malformed, don't silently
|
|
31
|
+
* Strict digits-only parse for a URL param — rejects "1abc", "2.7", "-5".
|
|
32
|
+
* Shape only: whether 0 is in range is `Stack`'s to judge. Also serves the
|
|
33
|
+
* `:version` path params, which share this "malformed, don't silently
|
|
34
|
+
* coerce" requirement.
|
|
34
35
|
*/
|
|
35
|
-
export declare function
|
|
36
|
+
export declare function parseUnsignedInt(raw: string, label: string): number;
|
|
36
37
|
/**
|
|
37
38
|
* The client half of the same refusal, before a request is built.
|
|
38
|
-
* `Stack.query()`
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
39
|
+
* `Stack.query()` applies `presentAt` itself, so this catches the direct
|
|
40
|
+
* adapter call, where search params would drop it. Absent and `undefined`
|
|
41
|
+
* are one here; the parsers test presence, since over the wire a written
|
|
42
|
+
* key is one the client meant to send.
|
|
42
43
|
*/
|
|
43
44
|
export declare function assertQueryTravels(query: StackQuery): void;
|
|
44
45
|
/**
|
|
45
|
-
* Build a `
|
|
46
|
+
* Build a `PlainQuery` from `GET /records` search params — the inverse of
|
|
46
47
|
* what `APIAdapter` encodes for a server that reaches no content.
|
|
47
48
|
* `parentId=null` is the literal string, the sentinel for "top level":
|
|
48
49
|
* Crockford base-32 excludes `u` and `l`, so no record ID can collide
|
|
49
50
|
* with it. See docs/spec/wire-format.md § Records.
|
|
50
51
|
*/
|
|
51
|
-
export declare function parseQueryParams(url: URL):
|
|
52
|
+
export declare function parseQueryParams(url: URL): PlainQuery;
|
|
52
53
|
/**
|
|
53
|
-
* Build a `
|
|
54
|
+
* Build a `PlainQuery` from a `POST /records/query` body — the superset
|
|
54
55
|
* form, which also carries `filter.content`, with ISO date strings decoded.
|
|
55
56
|
* `undefined` is the absent body; any other non-object is refused.
|
|
56
57
|
* See docs/spec/wire-format.md § Records.
|
|
57
58
|
*/
|
|
58
|
-
export declare function parseQueryBody(raw: unknown):
|
|
59
|
+
export declare function parseQueryBody(raw: unknown): PlainQuery;
|
|
59
60
|
/**
|
|
60
|
-
* What `GET /changes`' query params carry
|
|
61
|
-
*
|
|
62
|
-
* `
|
|
63
|
-
*
|
|
61
|
+
* What `GET /changes`' query params carry: the filter, and `includeRecords`,
|
|
62
|
+
* which sits on `SubscribeOptions` beside it. A server reads
|
|
63
|
+
* `filter.includeUnlisted` before the stream opens to answer the
|
|
64
|
+
* owner-only 403. See docs/spec/change-feed.md.
|
|
64
65
|
*/
|
|
65
66
|
export type ParsedChangeParams = {
|
|
66
67
|
filter: ChangeFilter;
|
|
67
68
|
includeRecords: boolean;
|
|
68
|
-
includeUnlisted: boolean;
|
|
69
69
|
};
|
|
70
70
|
/**
|
|
71
71
|
* Parse `GET /changes`' query params. The resume cursor is deliberately
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/wire/request.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAKH,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EAEZ,YAAY,EACZ,aAAa,EASb,UAAU,EACX,MAAM,mBAAmB,CAAC;AAM3B,iFAAiF;AACjF,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAIxD;
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/wire/request.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAKH,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EAEZ,YAAY,EACZ,aAAa,EASb,UAAU,EACV,UAAU,EACX,MAAM,mBAAmB,CAAC;AAM3B,iFAAiF;AACjF,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAIxD;AA6ED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAGnE;AAwKD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAE1D;AA2ID;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,CA0ErD;AAmDD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,UAAU,CA4EvD;AAMD;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,YAAY,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF;;;;GAIG;AACH,wBA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|
40
|
-
const
|
|
40
|
+
const UNSIGNED_INTEGER = /^\d+$/;
|
|
41
41
|
const SORT_FIELDS = new Set(NATIVE_SORT_FIELDS);
|
|
42
42
|
const SORT_DIRECTIONS = new Set(['asc', 'desc']);
|
|
43
43
|
const CHANGE_KINDS = new Set(['created', 'changed', 'removed', 'purged']);
|
|
@@ -46,6 +46,7 @@ const TARGET_KINDS = new Set(['record', 'entity', 'external']);
|
|
|
46
46
|
/** Every param `GET /records` defines. See docs/spec/wire-format.md § Records. */
|
|
47
47
|
const RECORD_QUERY_PARAMS = [
|
|
48
48
|
'typeId',
|
|
49
|
+
'baseId',
|
|
49
50
|
'parentId',
|
|
50
51
|
'appId',
|
|
51
52
|
'createdBySubject',
|
|
@@ -75,6 +76,7 @@ const RECORD_QUERY_PARAMS = [
|
|
|
75
76
|
];
|
|
76
77
|
const QUERY_BODY_FILTER_KEYS = [
|
|
77
78
|
'typeId',
|
|
79
|
+
'baseId',
|
|
78
80
|
'parentId',
|
|
79
81
|
'appId',
|
|
80
82
|
'createdBy',
|
|
@@ -107,12 +109,13 @@ const CHANGE_PARAMS = [
|
|
|
107
109
|
'since',
|
|
108
110
|
];
|
|
109
111
|
/**
|
|
110
|
-
* Strict
|
|
111
|
-
*
|
|
112
|
-
* "malformed, don't silently
|
|
112
|
+
* Strict digits-only parse for a URL param — rejects "1abc", "2.7", "-5".
|
|
113
|
+
* Shape only: whether 0 is in range is `Stack`'s to judge. Also serves the
|
|
114
|
+
* `:version` path params, which share this "malformed, don't silently
|
|
115
|
+
* coerce" requirement.
|
|
113
116
|
*/
|
|
114
|
-
export function
|
|
115
|
-
if (!
|
|
117
|
+
export function parseUnsignedInt(raw, label) {
|
|
118
|
+
if (!UNSIGNED_INTEGER.test(raw))
|
|
116
119
|
throw new StackBadRequestError(`Invalid ${label}: "${raw}"`);
|
|
117
120
|
return parseInt(raw, 10);
|
|
118
121
|
}
|
|
@@ -135,9 +138,10 @@ function requireSortField(raw) {
|
|
|
135
138
|
*/
|
|
136
139
|
function buildSort(field, contentField, direction, contentFieldByType) {
|
|
137
140
|
const named = [field, contentField, contentFieldByType].filter((member) => member !== undefined && member !== null);
|
|
138
|
-
if (named.length > 1)
|
|
139
|
-
throw new StackBadRequestError('A sort names one of a native field, a content field or a content field per type.');
|
|
140
141
|
const dir = direction === undefined || direction === null ? undefined : requireSortDirection(direction);
|
|
142
|
+
// A direction alone names no sort: decoding it would drop the direction.
|
|
143
|
+
if (named.length > 1 || (named.length === 0 && dir !== undefined))
|
|
144
|
+
throw new StackBadRequestError('A sort names exactly one of a native field, a content field or a content field per type.');
|
|
141
145
|
if (contentFieldByType !== undefined && contentFieldByType !== null) {
|
|
142
146
|
return {
|
|
143
147
|
contentFieldByType: parseSortByTypeBody(contentFieldByType),
|
|
@@ -234,35 +238,30 @@ function optionalBoolean(raw, label) {
|
|
|
234
238
|
return raw;
|
|
235
239
|
}
|
|
236
240
|
// -------------------------------------------------------
|
|
237
|
-
//
|
|
241
|
+
// The query field that never travels
|
|
238
242
|
// -------------------------------------------------------
|
|
239
|
-
const BASE_ID_REFUSAL = 'baseId is resolved client-side against registered Types and never travels — send the ' +
|
|
240
|
-
'concrete typeId set it resolves to. See docs/spec/data-model.md § Filter.';
|
|
241
243
|
const PRESENT_AT_REFUSAL = 'presentAt applies migrations, which are app code rather than server code, so no ' +
|
|
242
244
|
'server can honor it — read records as stored and migrate them client-side. See ' +
|
|
243
245
|
'docs/spec/data-model.md § Type migrations.';
|
|
244
246
|
/**
|
|
245
|
-
* Refuse
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* the same silent degradation `assertQueryCapabilities()` refuses for a
|
|
247
|
+
* Refuse `presentAt`, which has no wire encoding, rather than dropping it:
|
|
248
|
+
* the caller would believe records as stored had been migrated — the same
|
|
249
|
+
* silent degradation `assertQueryCapabilities()` refuses for a
|
|
249
250
|
* capability-gated filter. See docs/spec/wire-format.md § Records.
|
|
250
251
|
*/
|
|
251
|
-
function
|
|
252
|
-
if (hasBaseId)
|
|
253
|
-
throw new StackBadRequestError(BASE_ID_REFUSAL);
|
|
252
|
+
function assertNoPresentAt(hasPresentAt) {
|
|
254
253
|
if (hasPresentAt)
|
|
255
254
|
throw new StackBadRequestError(PRESENT_AT_REFUSAL);
|
|
256
255
|
}
|
|
257
256
|
/**
|
|
258
257
|
* The client half of the same refusal, before a request is built.
|
|
259
|
-
* `Stack.query()`
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
258
|
+
* `Stack.query()` applies `presentAt` itself, so this catches the direct
|
|
259
|
+
* adapter call, where search params would drop it. Absent and `undefined`
|
|
260
|
+
* are one here; the parsers test presence, since over the wire a written
|
|
261
|
+
* key is one the client meant to send.
|
|
263
262
|
*/
|
|
264
263
|
export function assertQueryTravels(query) {
|
|
265
|
-
|
|
264
|
+
assertNoPresentAt(query.presentAt !== undefined);
|
|
266
265
|
}
|
|
267
266
|
// -------------------------------------------------------
|
|
268
267
|
// Relationship filter
|
|
@@ -393,19 +392,22 @@ function parseCreatedByParams(url) {
|
|
|
393
392
|
};
|
|
394
393
|
}
|
|
395
394
|
/**
|
|
396
|
-
* Build a `
|
|
395
|
+
* Build a `PlainQuery` from `GET /records` search params — the inverse of
|
|
397
396
|
* what `APIAdapter` encodes for a server that reaches no content.
|
|
398
397
|
* `parentId=null` is the literal string, the sentinel for "top level":
|
|
399
398
|
* Crockford base-32 excludes `u` and `l`, so no record ID can collide
|
|
400
399
|
* with it. See docs/spec/wire-format.md § Records.
|
|
401
400
|
*/
|
|
402
401
|
export function parseQueryParams(url) {
|
|
403
|
-
|
|
402
|
+
assertNoPresentAt(url.searchParams.has('presentAt'));
|
|
404
403
|
requireKnownParams(url, RECORD_QUERY_PARAMS);
|
|
405
404
|
const filter = {};
|
|
406
405
|
const typeIds = url.searchParams.getAll('typeId');
|
|
407
406
|
if (typeIds.length)
|
|
408
407
|
filter.typeId = typeIds.length === 1 ? typeIds[0] : typeIds;
|
|
408
|
+
const baseIds = url.searchParams.getAll('baseId');
|
|
409
|
+
if (baseIds.length)
|
|
410
|
+
filter.baseId = baseIds.length === 1 ? baseIds[0] : baseIds;
|
|
409
411
|
const parentId = url.searchParams.get('parentId');
|
|
410
412
|
if (parentId !== null)
|
|
411
413
|
filter.parentId = parentId === 'null' ? null : parentId;
|
|
@@ -458,7 +460,7 @@ export function parseQueryParams(url) {
|
|
|
458
460
|
query.sort = sort;
|
|
459
461
|
const limit = url.searchParams.get('limit');
|
|
460
462
|
if (limit)
|
|
461
|
-
query.limit =
|
|
463
|
+
query.limit = parseUnsignedInt(limit, 'limit');
|
|
462
464
|
const cursor = url.searchParams.get('cursor');
|
|
463
465
|
if (cursor)
|
|
464
466
|
query.cursor = cursor;
|
|
@@ -467,9 +469,9 @@ export function parseQueryParams(url) {
|
|
|
467
469
|
// -------------------------------------------------------
|
|
468
470
|
// POST /records/query
|
|
469
471
|
// -------------------------------------------------------
|
|
470
|
-
/**
|
|
472
|
+
/** A limit's shape in a JSON body: a number. Its range is `Stack`'s to judge. */
|
|
471
473
|
function parseLimitValue(raw) {
|
|
472
|
-
if (typeof raw !== 'number'
|
|
474
|
+
if (typeof raw !== 'number')
|
|
473
475
|
throw new StackBadRequestError(`Invalid limit: ${JSON.stringify(raw)}`);
|
|
474
476
|
return raw;
|
|
475
477
|
}
|
|
@@ -508,7 +510,7 @@ function parseSortByTypeBody(raw) {
|
|
|
508
510
|
return keys;
|
|
509
511
|
}
|
|
510
512
|
/**
|
|
511
|
-
* Build a `
|
|
513
|
+
* Build a `PlainQuery` from a `POST /records/query` body — the superset
|
|
512
514
|
* form, which also carries `filter.content`, with ISO date strings decoded.
|
|
513
515
|
* `undefined` is the absent body; any other non-object is refused.
|
|
514
516
|
* See docs/spec/wire-format.md § Records.
|
|
@@ -518,7 +520,7 @@ export function parseQueryBody(raw) {
|
|
|
518
520
|
return {};
|
|
519
521
|
const body = requirePlainObject(raw, 'query body');
|
|
520
522
|
const f = body.filter !== undefined ? requirePlainObject(body.filter, 'filter') : undefined;
|
|
521
|
-
|
|
523
|
+
assertNoPresentAt('presentAt' in body);
|
|
522
524
|
requireKnownKeys(body, ['filter', 'sort', 'limit', 'cursor'], 'query body');
|
|
523
525
|
if (f)
|
|
524
526
|
requireKnownKeys(f, QUERY_BODY_FILTER_KEYS, 'filter');
|
|
@@ -527,6 +529,8 @@ export function parseQueryBody(raw) {
|
|
|
527
529
|
const filter = {};
|
|
528
530
|
if (f.typeId !== undefined)
|
|
529
531
|
filter.typeId = requireStringOrArray(f.typeId, 'filter.typeId');
|
|
532
|
+
if (f.baseId !== undefined)
|
|
533
|
+
filter.baseId = requireStringOrArray(f.baseId, 'filter.baseId');
|
|
530
534
|
if (f.parentId !== undefined)
|
|
531
535
|
filter.parentId = f.parentId === null ? null : requireString(f.parentId, 'filter.parentId');
|
|
532
536
|
if (f.appId !== undefined)
|
|
@@ -611,6 +615,8 @@ export function parseChangeParams(url) {
|
|
|
611
615
|
const createdBy = parseCreatedByParams(url);
|
|
612
616
|
if (createdBy)
|
|
613
617
|
filter.createdBy = createdBy;
|
|
618
|
+
if (booleanParam(url, 'includeUnlisted'))
|
|
619
|
+
filter.includeUnlisted = true;
|
|
614
620
|
const kinds = url.searchParams.getAll('kind');
|
|
615
621
|
if (kinds.length) {
|
|
616
622
|
for (const kind of kinds) {
|
|
@@ -625,7 +631,6 @@ export function parseChangeParams(url) {
|
|
|
625
631
|
return {
|
|
626
632
|
filter,
|
|
627
633
|
includeRecords: include === 'record',
|
|
628
|
-
includeUnlisted: booleanParam(url, 'includeUnlisted'),
|
|
629
634
|
};
|
|
630
635
|
}
|
|
631
636
|
/**
|
|
@@ -639,10 +644,10 @@ export function parseJournalParams(url) {
|
|
|
639
644
|
const query = {};
|
|
640
645
|
const afterSeq = url.searchParams.get('afterSeq');
|
|
641
646
|
if (afterSeq !== null)
|
|
642
|
-
query.afterSeq =
|
|
647
|
+
query.afterSeq = parseUnsignedInt(afterSeq, 'afterSeq');
|
|
643
648
|
const limit = url.searchParams.get('limit');
|
|
644
649
|
if (limit !== null)
|
|
645
|
-
query.limit =
|
|
650
|
+
query.limit = parseUnsignedInt(limit, 'limit');
|
|
646
651
|
return query;
|
|
647
652
|
}
|
|
648
653
|
/**
|
|
@@ -655,11 +660,11 @@ export function parseVersionsParams(url) {
|
|
|
655
660
|
const query = {};
|
|
656
661
|
const beforeVersion = url.searchParams.get('beforeVersion');
|
|
657
662
|
if (beforeVersion !== null) {
|
|
658
|
-
query.beforeVersion =
|
|
663
|
+
query.beforeVersion = parseUnsignedInt(beforeVersion, 'beforeVersion');
|
|
659
664
|
}
|
|
660
665
|
const limit = url.searchParams.get('limit');
|
|
661
666
|
if (limit !== null)
|
|
662
|
-
query.limit =
|
|
667
|
+
query.limit = parseUnsignedInt(limit, 'limit');
|
|
663
668
|
return query;
|
|
664
669
|
}
|
|
665
670
|
// -------------------------------------------------------
|
|
@@ -730,7 +735,7 @@ export function parseIfMatch(header) {
|
|
|
730
735
|
return undefined;
|
|
731
736
|
const trimmed = header.trim();
|
|
732
737
|
const unquoted = /^"(.*)"$/.exec(trimmed)?.[1] ?? trimmed;
|
|
733
|
-
return
|
|
738
|
+
return parseUnsignedInt(unquoted, 'If-Match');
|
|
734
739
|
}
|
|
735
740
|
/**
|
|
736
741
|
* Read an upload's filename from its `Content-Disposition`. Prefers the
|