@directus/api 26.0.1 → 27.0.1
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/cli/utils/create-db-connection.js +3 -5
- package/dist/controllers/files.js +1 -1
- package/dist/database/get-ast-from-query/lib/convert-wildcards.js +2 -2
- package/dist/database/get-ast-from-query/lib/parse-fields.js +2 -2
- package/dist/database/get-ast-from-query/utils/get-related-collection.js +2 -2
- package/dist/database/helpers/fn/types.js +2 -1
- package/dist/database/helpers/schema/dialects/mssql.d.ts +2 -0
- package/dist/database/helpers/schema/dialects/mssql.js +6 -0
- package/dist/database/helpers/schema/dialects/mysql.d.ts +0 -1
- package/dist/database/helpers/schema/dialects/mysql.js +0 -11
- package/dist/database/helpers/schema/dialects/oracle.d.ts +2 -0
- package/dist/database/helpers/schema/dialects/oracle.js +6 -0
- package/dist/database/helpers/schema/types.d.ts +2 -1
- package/dist/database/helpers/schema/types.js +6 -4
- package/dist/database/index.d.ts +0 -6
- package/dist/database/index.js +12 -28
- package/dist/database/migrations/20210225A-add-relations-sort-field.js +3 -1
- package/dist/database/migrations/20210510A-restructure-relations.js +8 -8
- package/dist/database/migrations/20210924A-add-collection-organization.js +6 -1
- package/dist/database/migrations/20210927A-replace-fields-group.js +3 -1
- package/dist/database/migrations/20211118A-add-notifications.js +3 -1
- package/dist/database/migrations/20211211A-add-shares.js +7 -1
- package/dist/database/migrations/20230823A-add-content-versioning.js +3 -1
- package/dist/database/migrations/20240909A-separate-comments.js +3 -1
- package/dist/database/run-ast/lib/apply-query/add-join.d.ts +54 -0
- package/dist/database/run-ast/lib/apply-query/add-join.js +86 -0
- package/dist/database/run-ast/lib/apply-query/aggregate.d.ts +3 -0
- package/dist/database/run-ast/lib/apply-query/aggregate.js +24 -0
- package/dist/database/run-ast/lib/apply-query/filter/get-filter-type.d.ts +8 -0
- package/dist/database/run-ast/lib/apply-query/filter/get-filter-type.js +20 -0
- package/dist/database/run-ast/lib/apply-query/filter/index.d.ts +8 -0
- package/dist/database/run-ast/lib/apply-query/filter/index.js +151 -0
- package/dist/database/run-ast/lib/apply-query/filter/operator.d.ts +3 -0
- package/dist/database/run-ast/lib/apply-query/filter/operator.js +175 -0
- package/dist/database/run-ast/lib/apply-query/filter/validate-operator.d.ts +2 -0
- package/dist/database/run-ast/lib/apply-query/filter/validate-operator.js +18 -0
- package/dist/database/run-ast/lib/apply-query/get-filter-path.d.ts +1 -0
- package/dist/database/run-ast/lib/apply-query/get-filter-path.js +13 -0
- package/dist/database/run-ast/lib/apply-query/get-operation.d.ts +7 -0
- package/dist/database/run-ast/lib/apply-query/get-operation.js +19 -0
- package/dist/database/run-ast/lib/apply-query/index.d.ts +20 -0
- package/dist/database/run-ast/lib/apply-query/index.js +92 -0
- package/dist/database/run-ast/lib/apply-query/join-filter-with-cases.d.ts +2 -0
- package/dist/database/run-ast/lib/apply-query/join-filter-with-cases.js +12 -0
- package/dist/database/run-ast/lib/apply-query/mock.d.ts +3 -0
- package/dist/database/run-ast/lib/apply-query/mock.js +4 -0
- package/dist/database/run-ast/lib/apply-query/pagination.d.ts +3 -0
- package/dist/database/run-ast/lib/apply-query/pagination.js +11 -0
- package/dist/database/run-ast/lib/apply-query/search.d.ts +4 -0
- package/dist/database/run-ast/lib/apply-query/search.js +78 -0
- package/dist/database/run-ast/lib/apply-query/sort.d.ts +19 -0
- package/dist/database/run-ast/lib/apply-query/sort.js +87 -0
- package/dist/database/run-ast/lib/get-db-query.js +7 -5
- package/dist/database/run-ast/run-ast.js +1 -1
- package/dist/database/run-ast/utils/apply-case-when.js +1 -1
- package/dist/database/run-ast/utils/get-column-pre-processor.js +2 -2
- package/dist/{utils → database/run-ast/utils}/get-column.js +1 -1
- package/dist/database/run-ast/utils/get-field-alias.js +1 -1
- package/dist/database/run-ast/utils/remove-temporary-fields.js +1 -1
- package/dist/database/seeds/01-collections.yaml +2 -2
- package/dist/database/seeds/04-fields.yaml +2 -2
- package/dist/database/seeds/05-activity.yaml +1 -1
- package/dist/database/seeds/08-permissions.yaml +1 -1
- package/dist/database/seeds/09-presets.yaml +1 -1
- package/dist/database/seeds/10-relations.yaml +8 -8
- package/dist/database/seeds/11-revisions.yaml +1 -1
- package/dist/database/seeds/run.js +8 -1
- package/dist/flows.js +8 -1
- package/dist/metrics/lib/create-metrics.js +13 -7
- package/dist/operations/condition/index.js +7 -4
- package/dist/operations/exec/index.js +2 -1
- package/dist/permissions/utils/default-permission.d.ts +7 -0
- package/dist/permissions/utils/default-permission.js +7 -0
- package/dist/services/collections.js +22 -18
- package/dist/services/fields.js +2 -5
- package/dist/services/payload.d.ts +6 -6
- package/dist/services/payload.js +47 -13
- package/dist/services/server.js +7 -2
- package/dist/services/specifications.js +2 -2
- package/dist/utils/get-relation-info.d.ts +1 -1
- package/dist/utils/get-relation-info.js +2 -4
- package/dist/websocket/handlers/items.js +5 -0
- package/package.json +23 -21
- package/dist/database/get-ast-from-query/utils/get-relation.d.ts +0 -2
- package/dist/database/get-ast-from-query/utils/get-relation.js +0 -7
- package/dist/utils/apply-query.d.ts +0 -46
- package/dist/utils/apply-query.js +0 -771
- /package/dist/{utils → database/run-ast/utils}/apply-function-to-column-name.d.ts +0 -0
- /package/dist/{utils → database/run-ast/utils}/apply-function-to-column-name.js +0 -0
- /package/dist/{utils → database/run-ast/utils}/get-column.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Accountability, Item, PrimaryKey, SchemaOverview } from '@directus/types';
|
|
1
|
+
import type { Accountability, Aggregate, FieldOverview, Item, PrimaryKey, SchemaOverview } from '@directus/types';
|
|
2
2
|
import type { Knex } from 'knex';
|
|
3
3
|
import type { Helpers } from '../database/helpers/index.js';
|
|
4
4
|
import type { AbstractServiceOptions, ActionEventParams, MutationOptions } from '../types/index.js';
|
|
@@ -34,9 +34,9 @@ export declare class PayloadService {
|
|
|
34
34
|
transformers: Transformers;
|
|
35
35
|
processValues(action: Action, payloads: Partial<Item>[]): Promise<Partial<Item>[]>;
|
|
36
36
|
processValues(action: Action, payload: Partial<Item>): Promise<Partial<Item>>;
|
|
37
|
-
processValues(action: Action, payloads: Partial<Item>[], aliasMap: Record<string, string
|
|
38
|
-
processValues(action: Action, payload: Partial<Item>, aliasMap: Record<string, string
|
|
39
|
-
processAggregates(payload: Partial<Item>[]): void;
|
|
37
|
+
processValues(action: Action, payloads: Partial<Item>[], aliasMap: Record<string, string>, aggregate: Aggregate): Promise<Partial<Item>[]>;
|
|
38
|
+
processValues(action: Action, payload: Partial<Item>, aliasMap: Record<string, string>, aggregate: Aggregate): Promise<Partial<Item>>;
|
|
39
|
+
processAggregates(payload: Partial<Item>[], aggregate?: Aggregate): void;
|
|
40
40
|
processField(field: SchemaOverview['collections'][string]['fields'][string], payload: Partial<Item>, action: Action, accountability: Accountability | null): Promise<any>;
|
|
41
41
|
/**
|
|
42
42
|
* Native geometries are stored in custom binary format. We need to insert them with
|
|
@@ -44,12 +44,12 @@ export declare class PayloadService {
|
|
|
44
44
|
* escaped. It's therefore placed as a Knex.Raw object in the payload. Thus the need
|
|
45
45
|
* to check if the value is a raw instance before stringifying it in the next step.
|
|
46
46
|
*/
|
|
47
|
-
processGeometries<T extends Partial<Record<string, any>>[]>(payloads: T, action: Action): T;
|
|
47
|
+
processGeometries<T extends Partial<Record<string, any>>[]>(fieldEntries: [string, FieldOverview][], payloads: T, action: Action): T;
|
|
48
48
|
/**
|
|
49
49
|
* Knex returns `datetime` and `date` columns as Date.. This is wrong for date / datetime, as those
|
|
50
50
|
* shouldn't return with time / timezone info respectively
|
|
51
51
|
*/
|
|
52
|
-
processDates(payloads: Partial<Record<string, any>>[], action: Action): Partial<Record<string, any>>[];
|
|
52
|
+
processDates(fieldEntries: [string, FieldOverview][], payloads: Partial<Record<string, any>>[], action: Action, aliasMap?: Record<string, string>, aggregate?: Aggregate): Partial<Record<string, any>>[];
|
|
53
53
|
/**
|
|
54
54
|
* Recursively save/update all nested related Any-to-One items
|
|
55
55
|
*/
|
package/dist/services/payload.js
CHANGED
|
@@ -123,7 +123,7 @@ export class PayloadService {
|
|
|
123
123
|
return value;
|
|
124
124
|
},
|
|
125
125
|
};
|
|
126
|
-
async processValues(action, payload, aliasMap = {}) {
|
|
126
|
+
async processValues(action, payload, aliasMap = {}, aggregate = {}) {
|
|
127
127
|
const processedPayload = toArray(payload);
|
|
128
128
|
if (processedPayload.length === 0)
|
|
129
129
|
return [];
|
|
@@ -153,8 +153,8 @@ export class PayloadService {
|
|
|
153
153
|
record[name] = newValue;
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
this.processGeometries(processedPayload, action);
|
|
157
|
-
this.processDates(processedPayload, action);
|
|
156
|
+
this.processGeometries(fieldEntries, processedPayload, action);
|
|
157
|
+
this.processDates(fieldEntries, processedPayload, action, aliasMap, aggregate);
|
|
158
158
|
if (['create', 'update'].includes(action)) {
|
|
159
159
|
processedPayload.forEach((record) => {
|
|
160
160
|
for (const [key, value] of Object.entries(record)) {
|
|
@@ -167,15 +167,30 @@ export class PayloadService {
|
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
169
|
if (action === 'read') {
|
|
170
|
-
this.processAggregates(processedPayload);
|
|
170
|
+
this.processAggregates(processedPayload, aggregate);
|
|
171
171
|
}
|
|
172
172
|
if (Array.isArray(payload)) {
|
|
173
173
|
return processedPayload;
|
|
174
174
|
}
|
|
175
175
|
return processedPayload[0];
|
|
176
176
|
}
|
|
177
|
-
processAggregates(payload) {
|
|
178
|
-
|
|
177
|
+
processAggregates(payload, aggregate = {}) {
|
|
178
|
+
/**
|
|
179
|
+
* Build access path with -> delimiter
|
|
180
|
+
*
|
|
181
|
+
* input: { min: [ 'date', 'datetime', 'timestamp' ] }
|
|
182
|
+
* output: [ 'min->date', 'min->datetime', 'min->timestamp' ]
|
|
183
|
+
*/
|
|
184
|
+
const aggregateKeys = Object.entries(aggregate).reduce((acc, [key, values]) => {
|
|
185
|
+
acc.push(...values.map((value) => `${key}->${value}`));
|
|
186
|
+
return acc;
|
|
187
|
+
}, []);
|
|
188
|
+
/**
|
|
189
|
+
* Expand -> delimited keys in the payload to the equivalent expanded object
|
|
190
|
+
*
|
|
191
|
+
* before: { "min->date": "2025-04-09", "min->datetime": "2025-04-08T12:00:00", "min->timestamp": "2025-04-17T23:18:00.000Z" }
|
|
192
|
+
* after: { "min": { "date": "2025-04-09", "datetime": "2025-04-08T12:00:00", "timestamp": "2025-04-17T23:18:00.000Z" } }
|
|
193
|
+
*/
|
|
179
194
|
if (aggregateKeys.length) {
|
|
180
195
|
for (const item of payload) {
|
|
181
196
|
Object.assign(item, unflatten(pick(item, aggregateKeys), { delimiter: '->' }));
|
|
@@ -208,12 +223,11 @@ export class PayloadService {
|
|
|
208
223
|
* escaped. It's therefore placed as a Knex.Raw object in the payload. Thus the need
|
|
209
224
|
* to check if the value is a raw instance before stringifying it in the next step.
|
|
210
225
|
*/
|
|
211
|
-
processGeometries(payloads, action) {
|
|
226
|
+
processGeometries(fieldEntries, payloads, action) {
|
|
212
227
|
const process = action == 'read'
|
|
213
228
|
? (value) => (typeof value === 'string' ? wktToGeoJSON(value) : value)
|
|
214
229
|
: (value) => this.helpers.st.fromGeoJSON(typeof value == 'string' ? parseJSON(value) : value);
|
|
215
|
-
const
|
|
216
|
-
const geometryColumns = fieldsInCollection.filter(([_, field]) => field.type.startsWith('geometry'));
|
|
230
|
+
const geometryColumns = fieldEntries.filter(([_, field]) => field.type.startsWith('geometry'));
|
|
217
231
|
for (const [name] of geometryColumns) {
|
|
218
232
|
for (const payload of payloads) {
|
|
219
233
|
if (payload[name]) {
|
|
@@ -227,10 +241,28 @@ export class PayloadService {
|
|
|
227
241
|
* Knex returns `datetime` and `date` columns as Date.. This is wrong for date / datetime, as those
|
|
228
242
|
* shouldn't return with time / timezone info respectively
|
|
229
243
|
*/
|
|
230
|
-
processDates(payloads, action) {
|
|
231
|
-
|
|
232
|
-
const
|
|
233
|
-
|
|
244
|
+
processDates(fieldEntries, payloads, action, aliasMap = {}, aggregate = {}) {
|
|
245
|
+
// Include aggegation e.g. "count->id" in alias map
|
|
246
|
+
const aggregateMapped = Object.fromEntries(Object.entries(aggregate).reduce((acc, [key, values]) => {
|
|
247
|
+
acc.push(...values.map((value) => [`${key}->${value}`, value]));
|
|
248
|
+
return acc;
|
|
249
|
+
}, []));
|
|
250
|
+
const aliasFields = { ...aliasMap, ...aggregateMapped };
|
|
251
|
+
for (const aliasField in aliasFields) {
|
|
252
|
+
const schemaField = aliasFields[aliasField];
|
|
253
|
+
const field = this.schema.collections[this.collection].fields[schemaField];
|
|
254
|
+
if (field) {
|
|
255
|
+
fieldEntries.push([
|
|
256
|
+
aliasField,
|
|
257
|
+
{
|
|
258
|
+
...field,
|
|
259
|
+
field: aliasField,
|
|
260
|
+
},
|
|
261
|
+
]);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
const dateColumns = fieldEntries.filter(([_name, field]) => ['dateTime', 'date', 'timestamp'].includes(field.type));
|
|
265
|
+
const timeColumns = fieldEntries.filter(([_name, field]) => {
|
|
234
266
|
return field.type === 'time';
|
|
235
267
|
});
|
|
236
268
|
if (dateColumns.length === 0 && timeColumns.length === 0)
|
|
@@ -555,6 +587,7 @@ export class PayloadService {
|
|
|
555
587
|
},
|
|
556
588
|
],
|
|
557
589
|
},
|
|
590
|
+
limit: -1,
|
|
558
591
|
};
|
|
559
592
|
// Nullify all related items that aren't included in the current payload
|
|
560
593
|
if (relation.meta.one_deselect_action === 'delete') {
|
|
@@ -654,6 +687,7 @@ export class PayloadService {
|
|
|
654
687
|
},
|
|
655
688
|
],
|
|
656
689
|
},
|
|
690
|
+
limit: -1,
|
|
657
691
|
};
|
|
658
692
|
if (relation.meta.one_deselect_action === 'delete') {
|
|
659
693
|
await service.deleteByQuery(query, {
|
package/dist/services/server.js
CHANGED
|
@@ -329,8 +329,13 @@ export class ServerService {
|
|
|
329
329
|
await disk.write(`health-${checkID}`, Readable.from(['check']));
|
|
330
330
|
const fileStream = await disk.read(`health-${checkID}`);
|
|
331
331
|
fileStream.on('data', async () => {
|
|
332
|
-
|
|
333
|
-
|
|
332
|
+
try {
|
|
333
|
+
fileStream.destroy();
|
|
334
|
+
await disk.delete(`health-${checkID}`);
|
|
335
|
+
}
|
|
336
|
+
catch (error) {
|
|
337
|
+
logger.error(error);
|
|
338
|
+
}
|
|
334
339
|
});
|
|
335
340
|
}
|
|
336
341
|
catch (err) {
|
|
@@ -2,6 +2,7 @@ import { useEnv } from '@directus/env';
|
|
|
2
2
|
import formatTitle from '@directus/format-title';
|
|
3
3
|
import { spec } from '@directus/specs';
|
|
4
4
|
import { isSystemCollection } from '@directus/system-data';
|
|
5
|
+
import { getRelation } from '@directus/utils';
|
|
5
6
|
import { version } from 'directus/version';
|
|
6
7
|
import { cloneDeep, mergeWith } from 'lodash-es';
|
|
7
8
|
import { OAS_REQUIRED_SCHEMAS } from '../constants.js';
|
|
@@ -345,8 +346,7 @@ class OASSpecsService {
|
|
|
345
346
|
if (field.note) {
|
|
346
347
|
propertyObject.description = field.note;
|
|
347
348
|
}
|
|
348
|
-
const relation = schema.relations
|
|
349
|
-
(relation.related_collection === collection && relation.meta?.one_field === field.field));
|
|
349
|
+
const relation = getRelation(schema.relations, collection, field.field);
|
|
350
350
|
if (!relation) {
|
|
351
351
|
propertyObject = {
|
|
352
352
|
...propertyObject,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Relation } from '@directus/types';
|
|
2
2
|
type RelationInfo = {
|
|
3
3
|
relation: Relation | null;
|
|
4
|
-
relationType:
|
|
4
|
+
relationType: 'o2m' | 'm2o' | 'a2o' | 'o2a' | null;
|
|
5
5
|
};
|
|
6
6
|
export declare function getRelationInfo(relations: Relation[], collection: string, field: string): RelationInfo;
|
|
7
7
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getRelation } from '@directus/utils';
|
|
1
2
|
import { getRelationType } from './get-relation-type.js';
|
|
2
3
|
function checkImplicitRelation(field) {
|
|
3
4
|
if (field.startsWith('$FOLLOW(') && field.endsWith(')')) {
|
|
@@ -36,10 +37,7 @@ export function getRelationInfo(relations, collection, field) {
|
|
|
36
37
|
return { relation, relationType: 'o2a' };
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
|
-
const relation = relations
|
|
40
|
-
return ((relation.collection === collection && relation.field === field) ||
|
|
41
|
-
(relation.related_collection === collection && relation.meta?.one_field === field));
|
|
42
|
-
}) ?? null;
|
|
40
|
+
const relation = getRelation(relations, collection, field) ?? null;
|
|
43
41
|
const relationType = relation ? getRelationType({ relation, collection, field }) : null;
|
|
44
42
|
return { relation, relationType };
|
|
45
43
|
}
|
|
@@ -76,6 +76,11 @@ export class ItemsHandler {
|
|
|
76
76
|
await service.upsertSingleton(message.data);
|
|
77
77
|
result = await service.readSingleton(query);
|
|
78
78
|
}
|
|
79
|
+
else if (Array.isArray(message.data)) {
|
|
80
|
+
const keys = await service.updateBatch(message.data);
|
|
81
|
+
meta = await metaService.getMetaForQuery(message.collection, query);
|
|
82
|
+
result = await service.readMany(keys, query);
|
|
83
|
+
}
|
|
79
84
|
else {
|
|
80
85
|
const keys = await service.updateByQuery(query, message.data);
|
|
81
86
|
meta = await metaService.getMetaForQuery(message.collection, query);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@directus/api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "27.0.1",
|
|
4
4
|
"description": "Directus is a real-time API and App dashboard for managing SQL database content",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"directus",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"argon2": "0.41.1",
|
|
70
70
|
"async": "3.2.6",
|
|
71
71
|
"async-mutex": "0.5.0",
|
|
72
|
-
"axios": "1.8.
|
|
72
|
+
"axios": "1.8.4",
|
|
73
73
|
"busboy": "1.6.0",
|
|
74
74
|
"bytes": "3.1.2",
|
|
75
75
|
"camelcase": "8.0.0",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"qs": "6.14.0",
|
|
140
140
|
"rate-limiter-flexible": "5.0.5",
|
|
141
141
|
"rollup": "4.34.9",
|
|
142
|
-
"samlify": "2.
|
|
142
|
+
"samlify": "2.9.1",
|
|
143
143
|
"sanitize-html": "2.14.0",
|
|
144
144
|
"sharp": "0.33.5",
|
|
145
145
|
"snappy": "7.2.2",
|
|
@@ -150,29 +150,30 @@
|
|
|
150
150
|
"ws": "8.18.1",
|
|
151
151
|
"zod": "3.24.2",
|
|
152
152
|
"zod-validation-error": "3.4.0",
|
|
153
|
-
"@directus/app": "13.
|
|
154
|
-
"@directus/errors": "2.0.1",
|
|
153
|
+
"@directus/app": "13.9.1",
|
|
155
154
|
"@directus/constants": "13.0.1",
|
|
156
|
-
"@directus/env": "5.0.
|
|
157
|
-
"@directus/
|
|
158
|
-
"@directus/extensions-registry": "3.0.
|
|
159
|
-
"@directus/
|
|
160
|
-
"@directus/extensions
|
|
155
|
+
"@directus/env": "5.0.4",
|
|
156
|
+
"@directus/errors": "2.0.1",
|
|
157
|
+
"@directus/extensions-registry": "3.0.5",
|
|
158
|
+
"@directus/extensions-sdk": "13.1.0",
|
|
159
|
+
"@directus/extensions": "3.0.5",
|
|
161
160
|
"@directus/format-title": "12.0.1",
|
|
161
|
+
"@directus/memory": "3.0.4",
|
|
162
162
|
"@directus/schema": "13.0.1",
|
|
163
|
-
"@directus/
|
|
164
|
-
"@directus/pressure": "3.0.
|
|
163
|
+
"@directus/schema-builder": "0.0.0",
|
|
164
|
+
"@directus/pressure": "3.0.4",
|
|
165
165
|
"@directus/storage": "12.0.0",
|
|
166
|
-
"@directus/storage-driver-
|
|
167
|
-
"@directus/storage-driver-
|
|
168
|
-
"@directus/
|
|
166
|
+
"@directus/storage-driver-azure": "12.0.4",
|
|
167
|
+
"@directus/storage-driver-cloudinary": "12.0.4",
|
|
168
|
+
"@directus/specs": "11.1.0",
|
|
169
|
+
"@directus/storage-driver-gcs": "12.0.4",
|
|
169
170
|
"@directus/storage-driver-local": "12.0.0",
|
|
170
|
-
"@directus/storage-driver-s3": "12.0.
|
|
171
|
+
"@directus/storage-driver-s3": "12.0.4",
|
|
172
|
+
"@directus/storage-driver-supabase": "3.0.4",
|
|
173
|
+
"@directus/utils": "13.0.4",
|
|
171
174
|
"@directus/system-data": "3.1.0",
|
|
172
|
-
"
|
|
173
|
-
"@directus/
|
|
174
|
-
"@directus/validation": "2.0.3",
|
|
175
|
-
"directus": "11.6.1"
|
|
175
|
+
"directus": "11.7.1",
|
|
176
|
+
"@directus/validation": "2.0.4"
|
|
176
177
|
},
|
|
177
178
|
"devDependencies": {
|
|
178
179
|
"@directus/tsconfig": "3.0.0",
|
|
@@ -216,7 +217,8 @@
|
|
|
216
217
|
"typescript": "5.8.2",
|
|
217
218
|
"vitest": "2.1.9",
|
|
218
219
|
"@directus/random": "2.0.1",
|
|
219
|
-
"@directus/types": "13.1.
|
|
220
|
+
"@directus/types": "13.1.1",
|
|
221
|
+
"@directus/schema-builder": "0.0.0"
|
|
220
222
|
},
|
|
221
223
|
"optionalDependencies": {
|
|
222
224
|
"@keyv/redis": "3.0.1",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export function getRelation(schema, collection, field) {
|
|
2
|
-
const relation = schema.relations.find((relation) => {
|
|
3
|
-
return ((relation.collection === collection && relation.field === field) ||
|
|
4
|
-
(relation.related_collection === collection && relation.meta?.one_field === field));
|
|
5
|
-
});
|
|
6
|
-
return relation;
|
|
7
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { Aggregate, Filter, Permission, Query, SchemaOverview } from '@directus/types';
|
|
2
|
-
import type { Knex } from 'knex';
|
|
3
|
-
import type { AliasMap } from './get-column-path.js';
|
|
4
|
-
export declare const generateAlias: (size?: number) => string;
|
|
5
|
-
type ApplyQueryOptions = {
|
|
6
|
-
aliasMap?: AliasMap;
|
|
7
|
-
isInnerQuery?: boolean;
|
|
8
|
-
hasMultiRelationalSort?: boolean | undefined;
|
|
9
|
-
groupWhenCases?: number[][] | undefined;
|
|
10
|
-
groupColumnPositions?: number[] | undefined;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Apply the Query to a given Knex query builder instance
|
|
14
|
-
*/
|
|
15
|
-
export default function applyQuery(knex: Knex, collection: string, dbQuery: Knex.QueryBuilder, query: Query, schema: SchemaOverview, cases: Filter[], permissions: Permission[], options?: ApplyQueryOptions): {
|
|
16
|
-
query: Knex.QueryBuilder<any, any>;
|
|
17
|
-
hasJoins: boolean;
|
|
18
|
-
hasMultiRelationalFilter: boolean;
|
|
19
|
-
};
|
|
20
|
-
export type ColumnSortRecord = {
|
|
21
|
-
order: 'asc' | 'desc';
|
|
22
|
-
column: string;
|
|
23
|
-
};
|
|
24
|
-
export declare function applySort(knex: Knex, schema: SchemaOverview, rootQuery: Knex.QueryBuilder, query: Query, collection: string, aliasMap: AliasMap, returnRecords?: boolean): {
|
|
25
|
-
sortRecords: {
|
|
26
|
-
order: "asc" | "desc";
|
|
27
|
-
column: any;
|
|
28
|
-
}[];
|
|
29
|
-
hasJoins: boolean;
|
|
30
|
-
hasMultiRelationalSort: boolean;
|
|
31
|
-
} | {
|
|
32
|
-
hasJoins: boolean;
|
|
33
|
-
hasMultiRelationalSort: boolean;
|
|
34
|
-
sortRecords?: never;
|
|
35
|
-
};
|
|
36
|
-
export declare function applyLimit(knex: Knex, rootQuery: Knex.QueryBuilder, limit: any): void;
|
|
37
|
-
export declare function applyOffset(knex: Knex, rootQuery: Knex.QueryBuilder, offset: any): void;
|
|
38
|
-
export declare function applyFilter(knex: Knex, schema: SchemaOverview, rootQuery: Knex.QueryBuilder, rootFilter: Filter, collection: string, aliasMap: AliasMap, cases: Filter[], permissions: Permission[]): {
|
|
39
|
-
query: Knex.QueryBuilder<any, any>;
|
|
40
|
-
hasJoins: boolean;
|
|
41
|
-
hasMultiRelationalFilter: boolean;
|
|
42
|
-
};
|
|
43
|
-
export declare function applySearch(knex: Knex, schema: SchemaOverview, dbQuery: Knex.QueryBuilder, searchQuery: string, collection: string, aliasMap: AliasMap, permissions: Permission[]): void;
|
|
44
|
-
export declare function applyAggregate(schema: SchemaOverview, dbQuery: Knex.QueryBuilder, aggregate: Aggregate, collection: string, hasJoins: boolean): void;
|
|
45
|
-
export declare function joinFilterWithCases(filter: Filter | null | undefined, cases: Filter[]): Filter | null;
|
|
46
|
-
export {};
|