@directus/api 23.2.1 → 23.2.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.
@@ -12,6 +12,8 @@ export async function up(knex) {
12
12
  }
13
13
  const rowsLimit = 50;
14
14
  let hasMore = true;
15
+ const existingUsers = new Set();
16
+ const missingUsers = new Set();
15
17
  while (hasMore) {
16
18
  const legacyComments = await knex
17
19
  .select('*')
@@ -28,12 +30,32 @@ export async function up(knex) {
28
30
  // Migrate legacy comment
29
31
  if (legacyComment['action'] === Action.COMMENT) {
30
32
  primaryKey = randomUUID();
33
+ let legacyCommentUserId = legacyComment.user;
34
+ if (legacyCommentUserId) {
35
+ if (missingUsers.has(legacyCommentUserId)) {
36
+ legacyCommentUserId = null;
37
+ }
38
+ else if (!existingUsers.has(legacyCommentUserId)) {
39
+ const userExists = await trx
40
+ .select('id')
41
+ .from('directus_users')
42
+ .where('id', '=', legacyCommentUserId)
43
+ .first();
44
+ if (userExists) {
45
+ existingUsers.add(legacyCommentUserId);
46
+ }
47
+ else {
48
+ missingUsers.add(legacyCommentUserId);
49
+ legacyCommentUserId = null;
50
+ }
51
+ }
52
+ }
31
53
  await trx('directus_comments').insert({
32
54
  id: primaryKey,
33
55
  collection: legacyComment.collection,
34
56
  item: legacyComment.item,
35
57
  comment: legacyComment.comment,
36
- user_created: legacyComment.user,
58
+ user_created: legacyCommentUserId,
37
59
  date_created: legacyComment.timestamp,
38
60
  });
39
61
  await trx('directus_activity')
@@ -1,15 +1,14 @@
1
- import { getCache } from '../cache.js';
1
+ import { flushCaches } from '../cache.js';
2
2
  import getDatabase from '../database/index.js';
3
3
  import { applyDiff } from './apply-diff.js';
4
4
  import { getSchema } from './get-schema.js';
5
- import { getSnapshot } from './get-snapshot.js';
6
5
  import { getSnapshotDiff } from './get-snapshot-diff.js';
6
+ import { getSnapshot } from './get-snapshot.js';
7
7
  export async function applySnapshot(snapshot, options) {
8
8
  const database = options?.database ?? getDatabase();
9
9
  const schema = options?.schema ?? (await getSchema({ database, bypassCache: true }));
10
- const { systemCache } = getCache();
11
10
  const current = options?.current ?? (await getSnapshot({ database, schema }));
12
11
  const snapshotDiff = options?.diff ?? getSnapshotDiff(current, snapshot);
13
12
  await applyDiff(current, snapshotDiff, { database, schema });
14
- await systemCache?.clear();
13
+ await flushCaches();
15
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@directus/api",
3
- "version": "23.2.1",
3
+ "version": "23.2.2",
4
4
  "description": "Directus is a real-time API and App dashboard for managing SQL database content",
5
5
  "keywords": [
6
6
  "directus",
@@ -149,29 +149,29 @@
149
149
  "ws": "8.18.0",
150
150
  "zod": "3.23.8",
151
151
  "zod-validation-error": "3.4.0",
152
- "@directus/app": "13.3.5",
152
+ "@directus/app": "13.3.6",
153
+ "@directus/env": "4.1.0",
153
154
  "@directus/constants": "12.0.1",
154
155
  "@directus/errors": "1.0.1",
155
- "@directus/env": "4.1.0",
156
156
  "@directus/extensions": "2.0.6",
157
- "@directus/format-title": "11.0.0",
158
157
  "@directus/extensions-registry": "2.0.6",
159
158
  "@directus/extensions-sdk": "12.1.4",
159
+ "@directus/format-title": "11.0.0",
160
160
  "@directus/memory": "2.0.6",
161
161
  "@directus/pressure": "2.0.5",
162
162
  "@directus/schema": "12.1.1",
163
- "@directus/specs": "11.1.0",
164
163
  "@directus/storage": "11.0.1",
164
+ "@directus/specs": "11.1.0",
165
165
  "@directus/storage-driver-azure": "11.1.2",
166
- "@directus/storage-driver-cloudinary": "11.1.2",
167
166
  "@directus/storage-driver-gcs": "11.1.2",
168
- "@directus/storage-driver-supabase": "2.1.2",
169
167
  "@directus/storage-driver-local": "11.0.1",
170
- "@directus/system-data": "2.1.2",
168
+ "@directus/storage-driver-cloudinary": "11.1.2",
171
169
  "@directus/storage-driver-s3": "11.0.5",
170
+ "@directus/system-data": "2.1.2",
171
+ "@directus/storage-driver-supabase": "2.1.2",
172
172
  "@directus/utils": "12.0.5",
173
- "@directus/validation": "1.0.5",
174
- "directus": "11.3.1"
173
+ "directus": "11.3.2",
174
+ "@directus/validation": "1.0.5"
175
175
  },
176
176
  "devDependencies": {
177
177
  "@ngneat/falso": "7.2.0",
@@ -213,9 +213,9 @@
213
213
  "knex-mock-client": "3.0.2",
214
214
  "typescript": "5.6.3",
215
215
  "vitest": "2.1.2",
216
- "@directus/tsconfig": "2.0.0",
216
+ "@directus/types": "12.2.2",
217
217
  "@directus/random": "1.0.0",
218
- "@directus/types": "12.2.2"
218
+ "@directus/tsconfig": "2.0.0"
219
219
  },
220
220
  "optionalDependencies": {
221
221
  "@keyv/redis": "3.0.1",