@directus/api 23.2.0 → 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:
|
|
58
|
+
user_created: legacyCommentUserId,
|
|
37
59
|
date_created: legacyComment.timestamp,
|
|
38
60
|
});
|
|
39
61
|
await trx('directus_activity')
|
|
@@ -16,7 +16,7 @@ export async function up(knex) {
|
|
|
16
16
|
.from('directus_revisions')
|
|
17
17
|
.where('version', '=', missingDeltaVersion.id)
|
|
18
18
|
.orderBy('id');
|
|
19
|
-
const deltas = revisions.map((revision) => parseJSON(revision.delta));
|
|
19
|
+
const deltas = revisions.map((revision) => typeof revision.delta === 'string' ? parseJSON(revision.delta) : revision.delta ?? {});
|
|
20
20
|
const consolidatedDelta = assign({}, ...deltas);
|
|
21
21
|
await trx('directus_versions')
|
|
22
22
|
.update({
|
|
@@ -299,8 +299,19 @@ class OASSpecsService {
|
|
|
299
299
|
properties: {},
|
|
300
300
|
'x-collection': collection.collection,
|
|
301
301
|
};
|
|
302
|
+
// Track required fields
|
|
303
|
+
const requiredFields = [];
|
|
302
304
|
for (const field of fieldsInCollection) {
|
|
303
|
-
|
|
305
|
+
const fieldSchema = this.generateField(schema, collection.collection, field, tags);
|
|
306
|
+
schemaComponent.properties[field.field] = fieldSchema;
|
|
307
|
+
// Check if field is required
|
|
308
|
+
if (field.nullable === false && field.defaultValue === null && field.generated === false) {
|
|
309
|
+
requiredFields.push(field.field);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
// Only add required if there are actually required fields
|
|
313
|
+
if (requiredFields.length > 0) {
|
|
314
|
+
schemaComponent.required = requiredFields;
|
|
304
315
|
}
|
|
305
316
|
components.schemas[tag.name] = schemaComponent;
|
|
306
317
|
}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
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
|
|
13
|
+
await flushCaches();
|
|
15
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@directus/api",
|
|
3
|
-
"version": "23.2.
|
|
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,9 +149,9 @@
|
|
|
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.
|
|
153
|
-
"@directus/constants": "12.0.1",
|
|
152
|
+
"@directus/app": "13.3.6",
|
|
154
153
|
"@directus/env": "4.1.0",
|
|
154
|
+
"@directus/constants": "12.0.1",
|
|
155
155
|
"@directus/errors": "1.0.1",
|
|
156
156
|
"@directus/extensions": "2.0.6",
|
|
157
157
|
"@directus/extensions-registry": "2.0.6",
|
|
@@ -160,18 +160,18 @@
|
|
|
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
167
|
"@directus/storage-driver-local": "11.0.1",
|
|
168
|
+
"@directus/storage-driver-cloudinary": "11.1.2",
|
|
169
169
|
"@directus/storage-driver-s3": "11.0.5",
|
|
170
|
-
"@directus/storage-driver-supabase": "2.1.2",
|
|
171
170
|
"@directus/system-data": "2.1.2",
|
|
171
|
+
"@directus/storage-driver-supabase": "2.1.2",
|
|
172
172
|
"@directus/utils": "12.0.5",
|
|
173
|
-
"
|
|
174
|
-
"directus": "
|
|
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/types": "12.2.2",
|
|
216
217
|
"@directus/random": "1.0.0",
|
|
217
|
-
"@directus/tsconfig": "2.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",
|