@directus/api 36.0.0 → 36.0.2

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.
@@ -73,13 +73,12 @@ async function getActiveSeats(opts) {
73
73
  knex
74
74
  });
75
75
  const adminFilters = [{ _or: [{ id: { _in: Array.from(adminUsers) } }, { role: { _in: Array.from(allAdminRoles) } }] }, { status: { _eq: "active" } }];
76
- const appFilters = [{ _or: [{ id: {
77
- _in: Array.from(appUsers),
78
- _nin: Array.from(adminUsers)
79
- } }, { role: {
80
- _in: Array.from(allAppRoles),
81
- _nin: Array.from(allAdminRoles)
82
- } }] }, { status: { _eq: "active" } }];
76
+ const appFilters = [
77
+ { _or: [{ id: { _in: Array.from(appUsers) } }, { role: { _in: Array.from(allAppRoles) } }] },
78
+ { id: { _nin: Array.from(adminUsers) } },
79
+ { _or: [{ role: { _nin: Array.from(allAdminRoles) } }, { role: { _null: true } }] },
80
+ { status: { _eq: "active" } }
81
+ ];
83
82
  if (opts?.adminId) {
84
83
  adminFilters.push({ id: { _neq: opts.adminId } });
85
84
  appFilters.push({ id: { _neq: opts.adminId } });
@@ -507,17 +507,22 @@ var ItemsService = class ItemsService {
507
507
  });
508
508
  const snapshotFields = difference(fields, getRelationsForCollection(this.schema, this.collection));
509
509
  const snapshots = await itemsService.readMany(keys, { fields: snapshotFields.length > 0 ? snapshotFields : ["*"] });
510
+ const snapshotsByKey = new Map(snapshots.map((snapshot) => [String(snapshot[primaryKeyField]), snapshot]));
510
511
  const revisionsService = new RevisionsService({
511
512
  knex: trx,
512
513
  schema: this.schema
513
514
  });
514
- const revisions = (await Promise.all(activity.map(async (activity$1, index) => ({
515
- activity: activity$1,
516
- collection: this.collection,
517
- item: keys[index],
518
- data: Array.isArray(snapshots) && snapshots[index] ? await payloadService.prepareDelta(snapshots[index]) : null,
519
- delta: await payloadService.prepareDelta(payloadWithTypeCasting)
520
- })))).filter((revision) => revision.delta);
515
+ const revisions = (await Promise.all(activity.map(async (activity$1, index) => {
516
+ const key = keys[index];
517
+ const snapshot = snapshotsByKey.get(String(key));
518
+ return {
519
+ activity: activity$1,
520
+ collection: this.collection,
521
+ item: key,
522
+ data: snapshot ? await payloadService.prepareDelta(snapshot) : null,
523
+ delta: await payloadService.prepareDelta(payloadWithTypeCasting)
524
+ };
525
+ }))).filter((revision) => revision.delta);
521
526
  const revisionIDs = await revisionsService.createMany(revisions);
522
527
  for (let i = 0; i < revisionIDs.length; i++) {
523
528
  const revisionID = revisionIDs[i];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@directus/api",
3
- "version": "36.0.0",
3
+ "version": "36.0.2",
4
4
  "description": "Directus is a real-time API and App dashboard for managing SQL database content",
5
5
  "keywords": [
6
6
  "directus",
@@ -166,30 +166,30 @@
166
166
  "ws": "8.18.3",
167
167
  "zod": "4.1.12",
168
168
  "zod-validation-error": "4.0.2",
169
- "@directus/app": "16.0.0",
170
169
  "@directus/ai": "1.3.2",
170
+ "@directus/app": "16.1.1",
171
171
  "@directus/env": "6.0.0",
172
- "@directus/constants": "14.4.0",
173
172
  "@directus/errors": "2.4.0",
174
- "@directus/extensions-registry": "4.0.0",
175
173
  "@directus/extensions": "4.0.0",
174
+ "@directus/extensions-sdk": "18.0.0",
176
175
  "@directus/format-title": "13.0.0",
176
+ "@directus/extensions-registry": "4.0.0",
177
177
  "@directus/memory": "4.0.0",
178
- "@directus/extensions-sdk": "18.0.0",
178
+ "@directus/constants": "14.4.0",
179
179
  "@directus/schema": "14.0.0",
180
- "@directus/pressure": "4.0.0",
180
+ "@directus/specs": "14.0.0",
181
181
  "@directus/storage": "13.0.0",
182
+ "@directus/storage-driver-cloudinary": "13.0.0",
183
+ "@directus/pressure": "4.0.0",
182
184
  "@directus/storage-driver-azure": "13.0.0",
183
- "@directus/storage-driver-local": "13.0.0",
184
185
  "@directus/storage-driver-gcs": "13.0.0",
185
- "@directus/storage-driver-cloudinary": "13.0.0",
186
- "@directus/specs": "14.0.0",
187
186
  "@directus/storage-driver-s3": "13.0.0",
188
- "@directus/system-data": "4.5.0",
189
187
  "@directus/storage-driver-supabase": "4.0.0",
190
188
  "@directus/utils": "13.5.0",
191
189
  "@directus/validation": "3.0.0",
192
- "directus": "12.0.0"
190
+ "@directus/system-data": "4.5.0",
191
+ "@directus/storage-driver-local": "13.0.0",
192
+ "directus": "12.0.2"
193
193
  },
194
194
  "devDependencies": {
195
195
  "@directus/tsconfig": "4.0.0",