@enbox/dwn-sdk-js 0.4.17 → 0.4.18
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/dist/browser.mjs +1 -1
- package/dist/browser.mjs.map +4 -4
- package/dist/esm/generated/precompiled-validators.js +349 -198
- package/dist/esm/generated/precompiled-validators.js.map +1 -1
- package/dist/esm/src/handlers/records-collection.js +200 -0
- package/dist/esm/src/handlers/records-collection.js.map +1 -0
- package/dist/esm/src/handlers/records-count.js +19 -196
- package/dist/esm/src/handlers/records-count.js.map +1 -1
- package/dist/esm/src/handlers/records-query.js +19 -376
- package/dist/esm/src/handlers/records-query.js.map +1 -1
- package/dist/esm/src/handlers/records-subscribe.js +21 -341
- package/dist/esm/src/handlers/records-subscribe.js.map +1 -1
- package/dist/esm/src/interfaces/records-count.js +1 -1
- package/dist/esm/src/interfaces/records-count.js.map +1 -1
- package/dist/esm/src/interfaces/records-query.js +1 -1
- package/dist/esm/src/interfaces/records-query.js.map +1 -1
- package/dist/esm/src/interfaces/records-subscribe.js +3 -1
- package/dist/esm/src/interfaces/records-subscribe.js.map +1 -1
- package/dist/esm/src/store/index-level.js +84 -32
- package/dist/esm/src/store/index-level.js.map +1 -1
- package/dist/esm/src/store/message-store-level.js +45 -11
- package/dist/esm/src/store/message-store-level.js.map +1 -1
- package/dist/esm/src/utils/record-limit-occupancy.js +5 -2
- package/dist/esm/src/utils/record-limit-occupancy.js.map +1 -1
- package/dist/esm/src/utils/records.js +14 -47
- package/dist/esm/src/utils/records.js.map +1 -1
- package/dist/esm/tests/features/records-nested-query-scope.spec.js +15 -1
- package/dist/esm/tests/features/records-nested-query-scope.spec.js.map +1 -1
- package/dist/esm/tests/features/records-record-limit.spec.js +116 -0
- package/dist/esm/tests/features/records-record-limit.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-count.spec.js +52 -1
- package/dist/esm/tests/handlers/records-count.spec.js.map +1 -1
- package/dist/esm/tests/handlers/records-subscribe.spec.js +76 -1
- package/dist/esm/tests/handlers/records-subscribe.spec.js.map +1 -1
- package/dist/esm/tests/store/index-level.spec.js +95 -1
- package/dist/esm/tests/store/index-level.spec.js.map +1 -1
- package/dist/esm/tests/store/message-store-level.spec.js +70 -1
- package/dist/esm/tests/store/message-store-level.spec.js.map +1 -1
- package/dist/types/generated/precompiled-validators.d.ts.map +1 -1
- package/dist/types/src/handlers/records-collection.d.ts +32 -0
- package/dist/types/src/handlers/records-collection.d.ts.map +1 -0
- package/dist/types/src/handlers/records-count.d.ts +0 -35
- package/dist/types/src/handlers/records-count.d.ts.map +1 -1
- package/dist/types/src/handlers/records-query.d.ts +0 -61
- package/dist/types/src/handlers/records-query.d.ts.map +1 -1
- package/dist/types/src/handlers/records-subscribe.d.ts +1 -37
- package/dist/types/src/handlers/records-subscribe.d.ts.map +1 -1
- package/dist/types/src/interfaces/records-subscribe.d.ts.map +1 -1
- package/dist/types/src/store/index-level.d.ts +27 -3
- package/dist/types/src/store/index-level.d.ts.map +1 -1
- package/dist/types/src/store/message-store-level.d.ts +1 -0
- package/dist/types/src/store/message-store-level.d.ts.map +1 -1
- package/dist/types/src/types/message-store.d.ts +6 -1
- package/dist/types/src/types/message-store.d.ts.map +1 -1
- package/dist/types/src/types/records-types.d.ts +1 -1
- package/dist/types/src/types/records-types.d.ts.map +1 -1
- package/dist/types/src/utils/record-limit-occupancy.d.ts.map +1 -1
- package/dist/types/src/utils/records.d.ts +6 -25
- package/dist/types/src/utils/records.d.ts.map +1 -1
- package/dist/types/tests/features/records-nested-query-scope.spec.d.ts.map +1 -1
- package/dist/types/tests/features/records-record-limit.spec.d.ts.map +1 -1
- package/dist/types/tests/handlers/records-count.spec.d.ts.map +1 -1
- package/dist/types/tests/handlers/records-subscribe.spec.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/handlers/records-collection.ts +269 -0
- package/src/handlers/records-count.ts +21 -236
- package/src/handlers/records-query.ts +22 -447
- package/src/handlers/records-subscribe.ts +26 -404
- package/src/interfaces/records-count.ts +1 -1
- package/src/interfaces/records-query.ts +1 -1
- package/src/interfaces/records-subscribe.ts +5 -2
- package/src/store/index-level.ts +145 -37
- package/src/store/message-store-level.ts +46 -11
- package/src/types/message-store.ts +6 -1
- package/src/types/records-types.ts +1 -1
- package/src/utils/record-limit-occupancy.ts +5 -2
- package/src/utils/records.ts +17 -52
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import { attachInitialWrites } from '../utils/initial-write-attachment.js';
|
|
2
|
-
import { authenticate } from '../core/auth.js';
|
|
3
|
-
import { DateSort } from '../types/records-types.js';
|
|
4
|
-
import { EncryptionControl } from '../core/encryption-control.js';
|
|
5
|
-
import { Message } from '../core/message.js';
|
|
6
2
|
import { messageReplyFromError } from '../core/message-reply.js';
|
|
7
|
-
import { ProtocolAuthorization } from '../core/protocol-authorization.js';
|
|
8
|
-
import { Records } from '../utils/records.js';
|
|
9
|
-
import { RecordsGrantAuthorization } from '../core/records-grant-authorization.js';
|
|
10
3
|
import { RecordsQuery } from '../interfaces/records-query.js';
|
|
11
|
-
import {
|
|
12
|
-
import { DwnInterfaceName, DwnMethodName } from '../enums/dwn-interface-method.js';
|
|
13
|
-
import { queryRecordsWithRecordLimitOccupancy, resolveRecordLimitOccupancy } from '../utils/record-limit-occupancy.js';
|
|
4
|
+
import { queryVisibleRecordsPage, resolveRecordsCollectionVisibility } from './records-collection.js';
|
|
14
5
|
export class RecordsQueryHandler {
|
|
15
6
|
deps;
|
|
16
7
|
constructor(deps) {
|
|
@@ -21,382 +12,34 @@ export class RecordsQueryHandler {
|
|
|
21
12
|
try {
|
|
22
13
|
recordsQuery = await RecordsQuery.parse(message);
|
|
23
14
|
}
|
|
24
|
-
catch (
|
|
25
|
-
return messageReplyFromError(
|
|
15
|
+
catch (error) {
|
|
16
|
+
return messageReplyFromError(error, 400);
|
|
26
17
|
}
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// if this is an anonymous query and the filter supports published records, query only published records
|
|
31
|
-
if (Records.filterIncludesPublishedRecords(recordsQuery.message.descriptor.filter) && recordsQuery.author === undefined) {
|
|
32
|
-
const results = await this.fetchPublishedRecords(tenant, recordsQuery, requester);
|
|
33
|
-
recordsWrites = results.messages;
|
|
34
|
-
cursor = results.cursor;
|
|
18
|
+
let visibility;
|
|
19
|
+
try {
|
|
20
|
+
visibility = await resolveRecordsCollectionVisibility(tenant, recordsQuery, this.deps);
|
|
35
21
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
await authenticate(message.authorization, this.deps.didResolver);
|
|
40
|
-
await RecordsQueryHandler.authorizeRecordsQuery(tenant, recordsQuery, this.deps);
|
|
41
|
-
}
|
|
42
|
-
catch (e) {
|
|
43
|
-
return messageReplyFromError(e, 401);
|
|
44
|
-
}
|
|
45
|
-
if (recordsQuery.author === tenant) {
|
|
46
|
-
const results = requester === tenant
|
|
47
|
-
? await this.fetchRecordsAsOwner(tenant, recordsQuery)
|
|
48
|
-
: await this.fetchRecordsAsOwnerDelegate(tenant, recordsQuery, requester);
|
|
49
|
-
recordsWrites = results.messages;
|
|
50
|
-
cursor = results.cursor;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
const results = await this.fetchRecordsAsNonOwner(tenant, recordsQuery, requester);
|
|
54
|
-
recordsWrites = results.messages;
|
|
55
|
-
cursor = results.cursor;
|
|
56
|
-
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
return messageReplyFromError(error, 401);
|
|
57
24
|
}
|
|
58
|
-
|
|
59
|
-
|
|
25
|
+
const result = await queryVisibleRecordsPage({
|
|
26
|
+
deps: this.deps,
|
|
27
|
+
tenant,
|
|
28
|
+
request: recordsQuery,
|
|
29
|
+
visibility,
|
|
30
|
+
});
|
|
31
|
+
// Attach the retained initial write to every entry that is not itself an initial write.
|
|
32
|
+
const entries = await attachInitialWrites({
|
|
60
33
|
messageStore: this.deps.messageStore,
|
|
61
34
|
tenant,
|
|
62
|
-
recordsWrites,
|
|
35
|
+
recordsWrites: result.messages,
|
|
63
36
|
operationName: 'RecordsQuery',
|
|
64
37
|
});
|
|
65
38
|
return {
|
|
66
39
|
status: { code: 200, detail: 'OK' },
|
|
67
|
-
entries
|
|
68
|
-
cursor
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Convert an incoming DateSort to a sort type accepted by MessageStore
|
|
73
|
-
* Defaults to 'dateCreated' in Descending order if no sort is supplied.
|
|
74
|
-
*
|
|
75
|
-
* @param dateSort the optional DateSort from the RecordsQuery message descriptor.
|
|
76
|
-
* @returns {MessageSort} for MessageStore sorting.
|
|
77
|
-
*/
|
|
78
|
-
convertDateSort(dateSort) {
|
|
79
|
-
switch (dateSort) {
|
|
80
|
-
case DateSort.CreatedAscending:
|
|
81
|
-
return { dateCreated: SortDirection.Ascending };
|
|
82
|
-
case DateSort.CreatedDescending:
|
|
83
|
-
return { dateCreated: SortDirection.Descending };
|
|
84
|
-
case DateSort.PublishedAscending:
|
|
85
|
-
return { datePublished: SortDirection.Ascending };
|
|
86
|
-
case DateSort.PublishedDescending:
|
|
87
|
-
return { datePublished: SortDirection.Descending };
|
|
88
|
-
case DateSort.UpdatedAscending:
|
|
89
|
-
return { messageTimestamp: SortDirection.Ascending };
|
|
90
|
-
case DateSort.UpdatedDescending:
|
|
91
|
-
return { messageTimestamp: SortDirection.Descending };
|
|
92
|
-
default:
|
|
93
|
-
return { dateCreated: SortDirection.Ascending };
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Fetches the records as the owner of the DWN with no additional filtering.
|
|
98
|
-
*/
|
|
99
|
-
async fetchRecordsAsOwner(tenant, recordsQuery) {
|
|
100
|
-
const { dateSort, filter, pagination } = recordsQuery.message.descriptor;
|
|
101
|
-
// fetch all published records matching the query
|
|
102
|
-
const queryFilter = {
|
|
103
|
-
...Records.convertFilter(filter, dateSort),
|
|
104
|
-
interface: DwnInterfaceName.Records,
|
|
105
|
-
method: DwnMethodName.Write,
|
|
106
|
-
isLatestBaseState: true
|
|
40
|
+
entries,
|
|
41
|
+
cursor: result.cursor,
|
|
107
42
|
};
|
|
108
|
-
const messageSort = this.convertDateSort(dateSort);
|
|
109
|
-
return this.queryRecordsWithVisibleControlFiltering({
|
|
110
|
-
tenant,
|
|
111
|
-
recordsQuery,
|
|
112
|
-
requester: tenant,
|
|
113
|
-
filters: [queryFilter],
|
|
114
|
-
messageSort,
|
|
115
|
-
pagination,
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
async fetchRecordsAsOwnerDelegate(tenant, recordsQuery, requester) {
|
|
119
|
-
const { dateSort, filter, pagination } = recordsQuery.message.descriptor;
|
|
120
|
-
const queryFilter = {
|
|
121
|
-
...Records.convertFilter(filter, dateSort),
|
|
122
|
-
interface: DwnInterfaceName.Records,
|
|
123
|
-
method: DwnMethodName.Write,
|
|
124
|
-
isLatestBaseState: true
|
|
125
|
-
};
|
|
126
|
-
const messageSort = this.convertDateSort(dateSort);
|
|
127
|
-
return this.queryRecordsWithVisibleControlFiltering({
|
|
128
|
-
tenant,
|
|
129
|
-
recordsQuery,
|
|
130
|
-
requester,
|
|
131
|
-
filters: [queryFilter],
|
|
132
|
-
messageSort,
|
|
133
|
-
pagination,
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Fetches the records as a non-owner.
|
|
138
|
-
*
|
|
139
|
-
* Filters can support returning both published and unpublished records,
|
|
140
|
-
* as well as explicitly only published or only unpublished records.
|
|
141
|
-
*
|
|
142
|
-
* A) BOTH published and unpublished:
|
|
143
|
-
* 1. published records; and
|
|
144
|
-
* 2. unpublished records intended for the query author (where `recipient` is the query author); and
|
|
145
|
-
* 3. unpublished records authorized by a protocol rule.
|
|
146
|
-
*
|
|
147
|
-
* B) PUBLISHED:
|
|
148
|
-
* 1. only published records;
|
|
149
|
-
*
|
|
150
|
-
* C) UNPUBLISHED:
|
|
151
|
-
* 1. unpublished records intended for the query author (where `recipient` is the query author); and
|
|
152
|
-
* 2. unpublished records authorized by a protocol rule.
|
|
153
|
-
*
|
|
154
|
-
*/
|
|
155
|
-
async fetchRecordsAsNonOwner(tenant, recordsQuery, requester) {
|
|
156
|
-
const { dateSort, pagination, filter } = recordsQuery.message.descriptor;
|
|
157
|
-
const filters = [];
|
|
158
|
-
if (Records.filterIncludesPublishedRecords(filter)) {
|
|
159
|
-
filters.push(RecordsQueryHandler.buildPublishedRecordsFilter(recordsQuery));
|
|
160
|
-
}
|
|
161
|
-
if (Records.filterIncludesUnpublishedRecords(filter)) {
|
|
162
|
-
if (EncryptionControl.isExactAudienceFilter(filter)) {
|
|
163
|
-
filters.push(Records.buildUnpublishedControlRecordsFilter(filter, dateSort));
|
|
164
|
-
}
|
|
165
|
-
if (Records.shouldBuildUnpublishedAuthorFilter(filter, recordsQuery.author)) {
|
|
166
|
-
filters.push(RecordsQueryHandler.buildUnpublishedRecordsByQueryAuthorFilter(recordsQuery));
|
|
167
|
-
}
|
|
168
|
-
if (Records.shouldProtocolAuthorize(recordsQuery.signaturePayload)) {
|
|
169
|
-
filters.push(RecordsQueryHandler.buildUnpublishedProtocolAuthorizedRecordsFilter(recordsQuery));
|
|
170
|
-
}
|
|
171
|
-
if (Message.getPermissionGrantId(recordsQuery.signaturePayload) !== undefined) {
|
|
172
|
-
filters.push(RecordsQueryHandler.buildUnpublishedPermissionGrantAuthorizedRecordsFilter(recordsQuery));
|
|
173
|
-
}
|
|
174
|
-
if (Records.shouldBuildUnpublishedRecipientFilter(filter, recordsQuery.author)) {
|
|
175
|
-
filters.push(RecordsQueryHandler.buildUnpublishedRecordsForQueryAuthorFilter(recordsQuery));
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
const messageSort = this.convertDateSort(dateSort);
|
|
179
|
-
return this.queryRecordsWithVisibleControlFiltering({
|
|
180
|
-
tenant,
|
|
181
|
-
recordsQuery,
|
|
182
|
-
requester,
|
|
183
|
-
filters,
|
|
184
|
-
messageSort,
|
|
185
|
-
pagination,
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Fetches only published records.
|
|
190
|
-
*/
|
|
191
|
-
async fetchPublishedRecords(tenant, recordsQuery, requester) {
|
|
192
|
-
const { dateSort, pagination } = recordsQuery.message.descriptor;
|
|
193
|
-
const filter = RecordsQueryHandler.buildPublishedRecordsFilter(recordsQuery);
|
|
194
|
-
const messageSort = this.convertDateSort(dateSort);
|
|
195
|
-
return this.queryRecordsWithVisibleControlFiltering({
|
|
196
|
-
tenant,
|
|
197
|
-
recordsQuery,
|
|
198
|
-
requester,
|
|
199
|
-
filters: [filter],
|
|
200
|
-
messageSort,
|
|
201
|
-
pagination,
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
async queryRecordsWithVisibleControlFiltering(input) {
|
|
205
|
-
const { tenant, recordsQuery, requester, filters, messageSort, pagination } = input;
|
|
206
|
-
const recordLimit = await resolveRecordLimitOccupancy({
|
|
207
|
-
validationStateReader: this.deps.validationStateReader,
|
|
208
|
-
tenant,
|
|
209
|
-
recordsFilter: recordsQuery.message.descriptor.filter,
|
|
210
|
-
messageTimestamp: recordsQuery.message.descriptor.messageTimestamp,
|
|
211
|
-
});
|
|
212
|
-
const controlFilters = Records.buildControlRecordsFilters(filters);
|
|
213
|
-
const currentAudienceRecordIdCache = new Map();
|
|
214
|
-
if (controlFilters.length === 0) {
|
|
215
|
-
const result = await queryRecordsWithRecordLimitOccupancy({
|
|
216
|
-
messageStore: this.deps.messageStore,
|
|
217
|
-
tenant,
|
|
218
|
-
filters,
|
|
219
|
-
recordLimit,
|
|
220
|
-
messageSort,
|
|
221
|
-
pagination,
|
|
222
|
-
});
|
|
223
|
-
return EncryptionControl.projectCurrentAudienceRecordPage({
|
|
224
|
-
messageStore: this.deps.messageStore,
|
|
225
|
-
tenant,
|
|
226
|
-
filters,
|
|
227
|
-
currentAudienceRecordIdCache,
|
|
228
|
-
result: {
|
|
229
|
-
messages: result.messages,
|
|
230
|
-
cursor: result.cursor,
|
|
231
|
-
},
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
if (pagination?.limit === undefined || pagination.limit <= 0) {
|
|
235
|
-
const result = await queryRecordsWithRecordLimitOccupancy({
|
|
236
|
-
messageStore: this.deps.messageStore,
|
|
237
|
-
tenant,
|
|
238
|
-
filters,
|
|
239
|
-
recordLimit,
|
|
240
|
-
messageSort,
|
|
241
|
-
pagination,
|
|
242
|
-
});
|
|
243
|
-
const projectedResult = await EncryptionControl.projectCurrentAudienceRecordPage({
|
|
244
|
-
messageStore: this.deps.messageStore,
|
|
245
|
-
tenant,
|
|
246
|
-
filters,
|
|
247
|
-
currentAudienceRecordIdCache,
|
|
248
|
-
result: {
|
|
249
|
-
messages: result.messages,
|
|
250
|
-
cursor: result.cursor,
|
|
251
|
-
},
|
|
252
|
-
});
|
|
253
|
-
return {
|
|
254
|
-
messages: await this.filterControlRecordsForRequester(tenant, recordsQuery, requester, projectedResult.messages),
|
|
255
|
-
cursor: projectedResult.cursor,
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
const visibleMessages = [];
|
|
259
|
-
let cursor = pagination.cursor;
|
|
260
|
-
let nextCursor;
|
|
261
|
-
// Keeps visible-page pagination stable until #1100 moves control visibility into indexed store filters.
|
|
262
|
-
do {
|
|
263
|
-
const remainingLimit = pagination.limit - visibleMessages.length;
|
|
264
|
-
const result = await queryRecordsWithRecordLimitOccupancy({
|
|
265
|
-
messageStore: this.deps.messageStore,
|
|
266
|
-
tenant,
|
|
267
|
-
filters,
|
|
268
|
-
recordLimit,
|
|
269
|
-
messageSort,
|
|
270
|
-
pagination: { ...pagination, cursor, limit: remainingLimit },
|
|
271
|
-
});
|
|
272
|
-
const projectedResult = await EncryptionControl.projectCurrentAudienceRecordPage({
|
|
273
|
-
messageStore: this.deps.messageStore,
|
|
274
|
-
tenant,
|
|
275
|
-
filters,
|
|
276
|
-
currentAudienceRecordIdCache,
|
|
277
|
-
result: {
|
|
278
|
-
messages: result.messages,
|
|
279
|
-
cursor: result.cursor,
|
|
280
|
-
},
|
|
281
|
-
});
|
|
282
|
-
const filteredMessages = await this.filterControlRecordsForRequester(tenant, recordsQuery, requester, projectedResult.messages);
|
|
283
|
-
visibleMessages.push(...filteredMessages);
|
|
284
|
-
nextCursor = projectedResult.cursor;
|
|
285
|
-
cursor = projectedResult.cursor;
|
|
286
|
-
} while (visibleMessages.length < pagination.limit && cursor !== undefined);
|
|
287
|
-
return { messages: visibleMessages, cursor: nextCursor };
|
|
288
|
-
}
|
|
289
|
-
static buildPublishedRecordsFilter(recordsQuery) {
|
|
290
|
-
const { dateSort, filter } = recordsQuery.message.descriptor;
|
|
291
|
-
// fetch all published records matching the query
|
|
292
|
-
return {
|
|
293
|
-
...Records.convertFilter(filter, dateSort),
|
|
294
|
-
interface: DwnInterfaceName.Records,
|
|
295
|
-
method: DwnMethodName.Write,
|
|
296
|
-
published: true,
|
|
297
|
-
isLatestBaseState: true
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* Creates a filter for unpublished records that are intended for the query author (where `recipient` is the author).
|
|
302
|
-
*/
|
|
303
|
-
static buildUnpublishedRecordsForQueryAuthorFilter(recordsQuery) {
|
|
304
|
-
const { dateSort, filter } = recordsQuery.message.descriptor;
|
|
305
|
-
// include records where recipient is query author
|
|
306
|
-
return {
|
|
307
|
-
...Records.convertFilter(filter, dateSort),
|
|
308
|
-
interface: DwnInterfaceName.Records,
|
|
309
|
-
method: DwnMethodName.Write,
|
|
310
|
-
recipient: recordsQuery.author,
|
|
311
|
-
isLatestBaseState: true,
|
|
312
|
-
published: false
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* Creates a filter for unpublished records that are within the specified protocol.
|
|
317
|
-
* Validation that `protocol` and other required protocol-related fields occurs before this method.
|
|
318
|
-
*/
|
|
319
|
-
static buildUnpublishedProtocolAuthorizedRecordsFilter(recordsQuery) {
|
|
320
|
-
const { dateSort, filter } = recordsQuery.message.descriptor;
|
|
321
|
-
return {
|
|
322
|
-
...Records.convertFilter(filter, dateSort),
|
|
323
|
-
interface: DwnInterfaceName.Records,
|
|
324
|
-
method: DwnMethodName.Write,
|
|
325
|
-
isLatestBaseState: true,
|
|
326
|
-
published: false
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Creates a filter for unpublished records authorized by a permission grant.
|
|
331
|
-
*/
|
|
332
|
-
static buildUnpublishedPermissionGrantAuthorizedRecordsFilter(recordsQuery) {
|
|
333
|
-
const { dateSort, filter } = recordsQuery.message.descriptor;
|
|
334
|
-
return {
|
|
335
|
-
...Records.convertFilter(filter, dateSort),
|
|
336
|
-
interface: DwnInterfaceName.Records,
|
|
337
|
-
method: DwnMethodName.Write,
|
|
338
|
-
isLatestBaseState: true,
|
|
339
|
-
published: false
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Creates a filter for only unpublished records where the author is the same as the query author.
|
|
344
|
-
*/
|
|
345
|
-
static buildUnpublishedRecordsByQueryAuthorFilter(recordsQuery) {
|
|
346
|
-
const { dateSort, filter } = recordsQuery.message.descriptor;
|
|
347
|
-
// include records where author is the same as the query author
|
|
348
|
-
return {
|
|
349
|
-
...Records.convertFilter(filter, dateSort),
|
|
350
|
-
author: recordsQuery.author,
|
|
351
|
-
interface: DwnInterfaceName.Records,
|
|
352
|
-
method: DwnMethodName.Write,
|
|
353
|
-
isLatestBaseState: true,
|
|
354
|
-
published: false
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* @param messageStore Used to check if the grant has been revoked.
|
|
359
|
-
*/
|
|
360
|
-
static async authorizeRecordsQuery(tenant, recordsQuery, deps) {
|
|
361
|
-
if (Message.isSignedByAuthorDelegate(recordsQuery.message) &&
|
|
362
|
-
!EncryptionControl.filterTargetsOnlyControlRecords(recordsQuery.message.descriptor.filter)) {
|
|
363
|
-
await recordsQuery.authorizeDelegate(deps.validationStateReader);
|
|
364
|
-
}
|
|
365
|
-
else if (EncryptionControl.filterTargetsOnlyControlRecords(recordsQuery.message.descriptor.filter)) {
|
|
366
|
-
await EncryptionControl.authorizeControlReadRequest({
|
|
367
|
-
tenant,
|
|
368
|
-
incomingMessage: recordsQuery.message,
|
|
369
|
-
requester: Message.getRequester(recordsQuery.message),
|
|
370
|
-
validationStateReader: deps.validationStateReader,
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
const permissionGrantId = Message.getPermissionGrantId(recordsQuery.signaturePayload);
|
|
374
|
-
if (permissionGrantId !== undefined) {
|
|
375
|
-
const permissionGrant = await deps.validationStateReader.fetchGrant(tenant, permissionGrantId);
|
|
376
|
-
await RecordsGrantAuthorization.authorizeQueryOrSubscribe({
|
|
377
|
-
incomingMessage: recordsQuery.message,
|
|
378
|
-
expectedGrantor: tenant,
|
|
379
|
-
expectedGrantee: recordsQuery.author,
|
|
380
|
-
permissionGrant,
|
|
381
|
-
validationStateReader: deps.validationStateReader,
|
|
382
|
-
});
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
// NOTE: not all RecordsQuery messages require protocol authorization even if the filter includes protocol-related fields,
|
|
386
|
-
// this is because we dynamically filter out records that the caller is not authorized to see.
|
|
387
|
-
// Currently only run protocol authorization if message deliberately invokes a protocol role.
|
|
388
|
-
if (Records.shouldProtocolAuthorize(recordsQuery.signaturePayload)) {
|
|
389
|
-
await ProtocolAuthorization.authorizeQueryOrSubscribe(tenant, recordsQuery, deps.validationStateReader);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
async filterControlRecordsForRequester(tenant, recordsQuery, requester, recordsWrites) {
|
|
393
|
-
return EncryptionControl.filterVisibleControlRecords({
|
|
394
|
-
tenant,
|
|
395
|
-
incomingMessage: recordsQuery.message,
|
|
396
|
-
requester,
|
|
397
|
-
recordsWriteMessages: recordsWrites,
|
|
398
|
-
validationStateReader: this.deps.validationStateReader,
|
|
399
|
-
});
|
|
400
43
|
}
|
|
401
44
|
}
|
|
402
45
|
//# sourceMappingURL=records-query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records-query.js","sourceRoot":"","sources":["../../../../src/handlers/records-query.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,oCAAoC,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAWvH,MAAM,OAAO,mBAAmB;IAED;IAA7B,YAA6B,IAAyB;QAAzB,SAAI,GAAJ,IAAI,CAAqB;IAAI,CAAC;IAEpD,KAAK,CAAC,MAAM,CAAC,EAClB,MAAM,EACN,OAAO,GACwC;QAC/C,IAAI,YAA0B,CAAC;QAC/B,IAAI,CAAC;YACH,YAAY,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACnD,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,qBAA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