directus 9.20.4 → 9.21.0

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.
Files changed (135) hide show
  1. package/dist/cli/utils/create-db-connection.d.ts +1 -1
  2. package/dist/controllers/extensions.js +4 -13
  3. package/dist/database/helpers/date/dialects/sqlite.d.ts +1 -1
  4. package/dist/database/helpers/date/dialects/sqlite.js +4 -0
  5. package/dist/database/helpers/date/types.d.ts +1 -1
  6. package/dist/database/helpers/date/types.js +4 -0
  7. package/dist/database/helpers/fn/dialects/mssql.d.ts +8 -8
  8. package/dist/database/helpers/fn/dialects/mssql.js +22 -16
  9. package/dist/database/helpers/fn/dialects/mysql.d.ts +8 -8
  10. package/dist/database/helpers/fn/dialects/mysql.js +22 -16
  11. package/dist/database/helpers/fn/dialects/postgres.d.ts +8 -8
  12. package/dist/database/helpers/fn/dialects/postgres.js +22 -16
  13. package/dist/database/helpers/fn/types.d.ts +1 -1
  14. package/dist/database/helpers/index.d.ts +1 -1
  15. package/dist/database/helpers/schema/dialects/cockroachdb.d.ts +1 -0
  16. package/dist/database/helpers/schema/dialects/cockroachdb.js +11 -0
  17. package/dist/database/helpers/schema/types.d.ts +3 -2
  18. package/dist/database/helpers/schema/types.js +5 -0
  19. package/dist/database/migrations/run.js +29 -3
  20. package/dist/database/run-ast.d.ts +1 -1
  21. package/dist/database/run-ast.js +1 -1
  22. package/dist/env.d.ts +4 -0
  23. package/dist/env.js +9 -4
  24. package/dist/env.test.d.ts +1 -8
  25. package/dist/exceptions/database/contains-null-values.d.ts +1 -1
  26. package/dist/exceptions/database/dialects/types.d.ts +6 -6
  27. package/dist/exceptions/database/invalid-foreign-key.d.ts +1 -1
  28. package/dist/exceptions/database/not-null-violation.d.ts +1 -1
  29. package/dist/exceptions/database/record-not-unique.d.ts +1 -1
  30. package/dist/exceptions/database/value-out-of-range.d.ts +1 -1
  31. package/dist/exceptions/database/value-too-long.d.ts +1 -1
  32. package/dist/exceptions/hit-rate-limit.d.ts +1 -1
  33. package/dist/exceptions/method-not-allowed.d.ts +1 -1
  34. package/dist/exceptions/service-unavailable.d.ts +1 -1
  35. package/dist/extensions.d.ts +7 -7
  36. package/dist/extensions.js +92 -89
  37. package/dist/logger.d.ts +1 -0
  38. package/dist/messenger.d.ts +1 -1
  39. package/dist/middleware/authenticate.d.ts +1 -0
  40. package/dist/middleware/validate-batch.d.ts +2 -0
  41. package/dist/operations/condition/index.d.ts +1 -1
  42. package/dist/operations/condition/index.js +1 -1
  43. package/dist/operations/condition/index.test.d.ts +1 -0
  44. package/dist/operations/exec/index.d.ts +1 -1
  45. package/dist/operations/item-create/index.d.ts +1 -1
  46. package/dist/operations/item-delete/index.d.ts +1 -1
  47. package/dist/operations/item-read/index.d.ts +1 -1
  48. package/dist/operations/item-update/index.d.ts +1 -1
  49. package/dist/operations/log/index.d.ts +1 -1
  50. package/dist/operations/mail/index.d.ts +1 -1
  51. package/dist/operations/notification/index.d.ts +1 -1
  52. package/dist/operations/request/index.d.ts +1 -1
  53. package/dist/operations/sleep/index.d.ts +1 -1
  54. package/dist/operations/transform/index.d.ts +1 -1
  55. package/dist/operations/trigger/index.d.ts +1 -1
  56. package/dist/operations/trigger/index.js +5 -2
  57. package/dist/rate-limiter.d.ts +1 -1
  58. package/dist/services/authorization.js +7 -3
  59. package/dist/services/collections.d.ts +1 -1
  60. package/dist/services/collections.js +112 -13
  61. package/dist/services/fields.d.ts +2 -2
  62. package/dist/services/fields.js +89 -41
  63. package/dist/services/fields.test.d.ts +1 -0
  64. package/dist/services/graphql/index.js +4 -1
  65. package/dist/services/graphql/utils/process-error.d.ts +4 -0
  66. package/dist/services/graphql/utils/process-error.js +26 -0
  67. package/dist/services/graphql/utils/process-error.test.d.ts +1 -0
  68. package/dist/services/items.d.ts +1 -1
  69. package/dist/services/items.js +39 -13
  70. package/dist/services/mail/index.d.ts +2 -2
  71. package/dist/services/mail/index.js +2 -1
  72. package/dist/services/mail/templates/base.liquid +4 -4
  73. package/dist/services/notifications.js +9 -4
  74. package/dist/services/notifications.test.d.ts +1 -0
  75. package/dist/services/payload.d.ts +2 -2
  76. package/dist/services/payload.js +14 -12
  77. package/dist/services/relations.d.ts +2 -2
  78. package/dist/services/relations.js +54 -4
  79. package/dist/services/users.js +2 -2
  80. package/dist/services/users.test.d.ts +1 -0
  81. package/dist/types/assets.d.ts +7 -7
  82. package/dist/types/ast.d.ts +7 -7
  83. package/dist/types/auth.d.ts +4 -4
  84. package/dist/types/collection.d.ts +2 -2
  85. package/dist/types/events.d.ts +1 -1
  86. package/dist/types/files.d.ts +2 -2
  87. package/dist/types/items.d.ts +5 -5
  88. package/dist/types/migration.d.ts +1 -1
  89. package/dist/types/revision.d.ts +1 -1
  90. package/dist/types/services.d.ts +1 -1
  91. package/dist/types/snapshot.d.ts +4 -4
  92. package/dist/types/webhooks.d.ts +2 -2
  93. package/dist/utils/get-ast-from-query.d.ts +1 -1
  94. package/dist/utils/get-column-path.d.ts +2 -2
  95. package/dist/utils/get-module-default.d.ts +1 -1
  96. package/dist/utils/get-relation-info.d.ts +1 -1
  97. package/dist/utils/job-queue.d.ts +1 -1
  98. package/dist/utils/merge-permissions.d.ts +1 -0
  99. package/dist/utils/reduce-schema.js +3 -1
  100. package/package.json +70 -71
  101. package/dist/__mocks__/cache.d.ts +0 -5
  102. package/dist/__mocks__/cache.js +0 -7
  103. package/dist/__utils__/items-utils.d.ts +0 -2
  104. package/dist/__utils__/items-utils.js +0 -36
  105. package/dist/__utils__/schemas.d.ts +0 -13
  106. package/dist/__utils__/schemas.js +0 -304
  107. package/dist/__utils__/snapshots.d.ts +0 -5
  108. package/dist/__utils__/snapshots.js +0 -897
  109. package/dist/cli/index.test.js +0 -63
  110. package/dist/controllers/files.test.js +0 -49
  111. package/dist/database/migrations/run.test.js +0 -92
  112. package/dist/env.test.js +0 -40
  113. package/dist/middleware/authenticate.test.js +0 -214
  114. package/dist/middleware/extract-token.test.js +0 -60
  115. package/dist/middleware/validate-batch.test.js +0 -82
  116. package/dist/operations/exec/index.test.js +0 -95
  117. package/dist/services/files.test.js +0 -89
  118. package/dist/services/items.test.js +0 -765
  119. package/dist/services/payload.test.js +0 -196
  120. package/dist/services/specifications.test.js +0 -96
  121. package/dist/utils/apply-snapshot.test.js +0 -305
  122. package/dist/utils/async-handler.test.js +0 -18
  123. package/dist/utils/calculate-field-depth.test.js +0 -76
  124. package/dist/utils/filter-items.test.js +0 -60
  125. package/dist/utils/get-auth-providers.test.js +0 -72
  126. package/dist/utils/get-cache-key.test.js +0 -74
  127. package/dist/utils/get-column-path.test.js +0 -136
  128. package/dist/utils/get-config-from-env.test.js +0 -19
  129. package/dist/utils/get-relation-info.test.js +0 -88
  130. package/dist/utils/get-relation-type.test.js +0 -69
  131. package/dist/utils/get-string-byte-size.test.js +0 -8
  132. package/dist/utils/is-directus-jwt.test.js +0 -26
  133. package/dist/utils/jwt.test.js +0 -36
  134. package/dist/utils/merge-permissions.test.js +0 -80
  135. package/dist/utils/validate-keys.test.js +0 -97
@@ -1,304 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.snapshotApplyTestSchema = exports.userSchema = exports.systemSchema = void 0;
4
- exports.systemSchema = {
5
- collections: {
6
- directus_users: {
7
- collection: 'directus_users',
8
- primary: 'id',
9
- singleton: false,
10
- note: '$t:directus_collection.directus_users',
11
- sortField: null,
12
- accountability: null,
13
- fields: {
14
- id: {
15
- field: 'id',
16
- defaultValue: null,
17
- nullable: false,
18
- generated: false,
19
- type: 'uuid',
20
- dbType: 'uuid',
21
- precision: null,
22
- scale: null,
23
- special: [],
24
- note: null,
25
- alias: false,
26
- validation: null,
27
- },
28
- name: {
29
- field: 'name',
30
- defaultValue: "A User's Name",
31
- nullable: false,
32
- generated: false,
33
- type: 'uuid',
34
- dbType: 'uuid',
35
- precision: null,
36
- scale: null,
37
- special: [],
38
- note: null,
39
- alias: false,
40
- validation: null,
41
- },
42
- items: {
43
- field: 'items',
44
- defaultValue: null,
45
- nullable: true,
46
- generated: false,
47
- type: 'alias',
48
- dbType: null,
49
- precision: null,
50
- scale: null,
51
- special: ['o2m'],
52
- note: null,
53
- alias: true,
54
- validation: null,
55
- },
56
- },
57
- },
58
- directus_files: {
59
- collection: 'directus_files',
60
- primary: 'id',
61
- singleton: false,
62
- note: '$t:directus_collection.directus_files',
63
- sortField: null,
64
- accountability: null,
65
- fields: {
66
- id: {
67
- field: 'id',
68
- defaultValue: null,
69
- nullable: false,
70
- generated: false,
71
- type: 'uuid',
72
- dbType: 'uuid',
73
- precision: null,
74
- scale: null,
75
- special: [],
76
- note: null,
77
- alias: false,
78
- validation: null,
79
- },
80
- title: {
81
- field: 'title',
82
- defaultValue: "A File's Title",
83
- nullable: false,
84
- generated: false,
85
- type: 'string',
86
- dbType: 'text',
87
- precision: null,
88
- scale: null,
89
- special: [],
90
- note: null,
91
- alias: false,
92
- validation: null,
93
- },
94
- uploaded_by: {
95
- field: 'uploaded_by',
96
- defaultValue: null,
97
- nullable: true,
98
- generated: false,
99
- type: 'uuid',
100
- dbType: 'uuid',
101
- precision: null,
102
- scale: null,
103
- special: [],
104
- note: null,
105
- alias: false,
106
- validation: null,
107
- },
108
- },
109
- },
110
- },
111
- relations: [
112
- {
113
- collection: 'directus_files',
114
- field: 'uploaded_by',
115
- related_collection: 'directus_users',
116
- schema: {
117
- table: 'directus_files',
118
- column: 'uploaded_by',
119
- foreign_key_table: 'directus_users',
120
- foreign_key_column: 'id',
121
- on_update: 'NO ACTION',
122
- on_delete: 'NO ACTION',
123
- constraint_name: null,
124
- },
125
- meta: {
126
- system: true,
127
- many_collection: 'directus_files',
128
- many_field: 'uploaded_by',
129
- one_collection: 'directus_users',
130
- one_field: 'items',
131
- one_allowed_collections: null,
132
- one_collection_field: null,
133
- one_deselect_action: 'nullify',
134
- junction_field: null,
135
- sort_field: null,
136
- },
137
- },
138
- ],
139
- };
140
- exports.userSchema = {
141
- collections: {
142
- authors: {
143
- collection: 'authors',
144
- primary: 'id',
145
- singleton: false,
146
- note: 'authors',
147
- sortField: null,
148
- accountability: null,
149
- fields: {
150
- id: {
151
- field: 'id',
152
- defaultValue: null,
153
- nullable: false,
154
- generated: false,
155
- type: 'uuid',
156
- dbType: 'uuid',
157
- precision: null,
158
- scale: null,
159
- special: [],
160
- note: null,
161
- alias: false,
162
- validation: null,
163
- },
164
- name: {
165
- field: 'name',
166
- defaultValue: "An Author's Name",
167
- nullable: false,
168
- generated: false,
169
- type: 'uuid',
170
- dbType: 'uuid',
171
- precision: null,
172
- scale: null,
173
- special: [],
174
- note: null,
175
- alias: false,
176
- validation: null,
177
- },
178
- items: {
179
- field: 'items',
180
- defaultValue: null,
181
- nullable: true,
182
- generated: false,
183
- type: 'alias',
184
- dbType: null,
185
- precision: null,
186
- scale: null,
187
- special: ['o2m'],
188
- note: null,
189
- alias: true,
190
- validation: null,
191
- },
192
- },
193
- },
194
- posts: {
195
- collection: 'posts',
196
- primary: 'id',
197
- singleton: false,
198
- note: 'posts',
199
- sortField: null,
200
- accountability: null,
201
- fields: {
202
- id: {
203
- field: 'id',
204
- defaultValue: null,
205
- nullable: false,
206
- generated: false,
207
- type: 'uuid',
208
- dbType: 'uuid',
209
- precision: null,
210
- scale: null,
211
- special: [],
212
- note: null,
213
- alias: false,
214
- validation: null,
215
- },
216
- title: {
217
- field: 'title',
218
- defaultValue: "A Post's Title",
219
- nullable: false,
220
- generated: false,
221
- type: 'string',
222
- dbType: 'text',
223
- precision: null,
224
- scale: null,
225
- special: [],
226
- note: null,
227
- alias: false,
228
- validation: null,
229
- },
230
- uploaded_by: {
231
- field: 'uploaded_by',
232
- defaultValue: null,
233
- nullable: true,
234
- generated: false,
235
- type: 'uuid',
236
- dbType: 'uuid',
237
- precision: null,
238
- scale: null,
239
- special: [],
240
- note: null,
241
- alias: false,
242
- validation: null,
243
- },
244
- },
245
- },
246
- },
247
- relations: [
248
- {
249
- collection: 'posts',
250
- field: 'uploaded_by',
251
- related_collection: 'authors',
252
- schema: {
253
- table: 'posts',
254
- column: 'uploaded_by',
255
- foreign_key_table: 'authors',
256
- foreign_key_column: 'id',
257
- on_update: 'NO ACTION',
258
- on_delete: 'SET NULL',
259
- constraint_name: null,
260
- },
261
- meta: {
262
- id: 11,
263
- many_collection: 'posts',
264
- many_field: 'uploaded_by',
265
- one_collection: 'authors',
266
- one_field: 'items',
267
- one_collection_field: null,
268
- one_allowed_collections: null,
269
- junction_field: null,
270
- sort_field: null,
271
- one_deselect_action: 'nullify',
272
- },
273
- },
274
- ],
275
- };
276
- exports.snapshotApplyTestSchema = {
277
- collections: {
278
- test_table: {
279
- collection: 'test_table',
280
- primary: 'id',
281
- singleton: false,
282
- note: 'test_table',
283
- sortField: null,
284
- accountability: 'all',
285
- fields: {
286
- id: {
287
- field: 'id',
288
- defaultValue: null,
289
- nullable: false,
290
- generated: false,
291
- type: 'uuid',
292
- dbType: 'uuid',
293
- precision: null,
294
- scale: null,
295
- special: [],
296
- note: null,
297
- alias: false,
298
- validation: null,
299
- },
300
- },
301
- },
302
- },
303
- relations: [],
304
- };
@@ -1,5 +0,0 @@
1
- import { Snapshot } from '../types';
2
- export declare const snapshotBeforeCreateCollection: Snapshot;
3
- export declare const snapshotCreateCollection: Snapshot;
4
- export declare const snapshotCreateCollectionNotNested: Snapshot;
5
- export declare const snapshotBeforeDeleteCollection: Snapshot;