@directus/api 13.1.0 → 13.2.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 (221) hide show
  1. package/dist/app.js +4 -4
  2. package/dist/auth/drivers/ldap.js +3 -2
  3. package/dist/auth/drivers/local.js +1 -1
  4. package/dist/auth/drivers/oauth2.js +1 -1
  5. package/dist/auth/drivers/openid.js +1 -1
  6. package/dist/auth/drivers/saml.js +1 -1
  7. package/dist/auth.js +1 -1
  8. package/dist/cli/index.js +1 -1
  9. package/dist/controllers/activity.js +1 -1
  10. package/dist/controllers/assets.js +2 -2
  11. package/dist/controllers/auth.js +1 -1
  12. package/dist/controllers/collections.js +1 -1
  13. package/dist/controllers/dashboards.js +1 -1
  14. package/dist/controllers/extensions.js +11 -7
  15. package/dist/controllers/fields.js +1 -1
  16. package/dist/controllers/files.js +2 -2
  17. package/dist/controllers/flows.js +1 -1
  18. package/dist/controllers/folders.js +1 -1
  19. package/dist/controllers/items.js +1 -1
  20. package/dist/controllers/not-found.js +1 -1
  21. package/dist/controllers/notifications.js +1 -1
  22. package/dist/controllers/operations.js +1 -1
  23. package/dist/controllers/panels.js +1 -1
  24. package/dist/controllers/permissions.js +1 -1
  25. package/dist/controllers/presets.js +1 -1
  26. package/dist/controllers/relations.js +1 -1
  27. package/dist/controllers/roles.js +1 -1
  28. package/dist/controllers/schema.js +1 -1
  29. package/dist/controllers/server.js +1 -1
  30. package/dist/controllers/settings.js +1 -1
  31. package/dist/controllers/shares.js +1 -1
  32. package/dist/controllers/translations.js +1 -1
  33. package/dist/controllers/users.js +1 -1
  34. package/dist/controllers/utils.js +37 -18
  35. package/dist/controllers/webhooks.js +1 -1
  36. package/dist/database/errors/dialects/mssql.js +1 -1
  37. package/dist/database/errors/dialects/mysql.js +1 -1
  38. package/dist/database/errors/dialects/oracle.js +1 -1
  39. package/dist/database/errors/dialects/postgres.js +1 -1
  40. package/dist/database/errors/dialects/sqlite.js +1 -1
  41. package/dist/database/helpers/schema/dialects/mysql.js +1 -1
  42. package/dist/database/helpers/sequence/dialects/postgres.d.ts +5 -2
  43. package/dist/database/helpers/sequence/dialects/postgres.js +6 -3
  44. package/dist/database/migrations/20231009A-update-csv-fields-to-text.d.ts +3 -0
  45. package/dist/database/migrations/20231009A-update-csv-fields-to-text.js +44 -0
  46. package/dist/database/run-ast.js +1 -1
  47. package/dist/database/seeds/run.js +1 -1
  48. package/dist/env.js +2 -2
  49. package/dist/extensions/get-extensions.d.ts +47 -0
  50. package/dist/extensions/get-extensions.js +9 -0
  51. package/dist/extensions/get-shared-deps-mapping.d.ts +1 -0
  52. package/dist/extensions/get-shared-deps-mapping.js +26 -0
  53. package/dist/extensions/index.d.ts +2 -0
  54. package/dist/extensions/index.js +9 -0
  55. package/dist/{extensions.d.ts → extensions/manager.d.ts} +4 -11
  56. package/dist/{extensions.js → extensions/manager.js} +28 -86
  57. package/dist/extensions/normalize-extension-info.d.ts +5 -0
  58. package/dist/extensions/normalize-extension-info.js +30 -0
  59. package/dist/extensions/types.d.ts +23 -0
  60. package/dist/extensions/wrap-embeds.d.ts +4 -0
  61. package/dist/extensions/wrap-embeds.js +8 -0
  62. package/dist/flows.d.ts +1 -1
  63. package/dist/flows.js +1 -1
  64. package/dist/middleware/check-ip.js +1 -1
  65. package/dist/middleware/collection-exists.js +1 -1
  66. package/dist/middleware/error-handler.js +1 -1
  67. package/dist/middleware/graphql.js +1 -1
  68. package/dist/middleware/rate-limiter-global.js +1 -1
  69. package/dist/middleware/rate-limiter-ip.js +1 -1
  70. package/dist/middleware/respond.js +1 -1
  71. package/dist/middleware/validate-batch.js +1 -1
  72. package/dist/operations/condition/index.d.ts +1 -1
  73. package/dist/operations/condition/index.js +2 -1
  74. package/dist/operations/exec/index.d.ts +1 -1
  75. package/dist/operations/exec/index.js +1 -1
  76. package/dist/operations/item-create/index.d.ts +1 -1
  77. package/dist/operations/item-create/index.js +2 -1
  78. package/dist/operations/item-delete/index.d.ts +1 -1
  79. package/dist/operations/item-delete/index.js +2 -1
  80. package/dist/operations/item-read/index.d.ts +1 -1
  81. package/dist/operations/item-read/index.js +2 -1
  82. package/dist/operations/item-update/index.d.ts +1 -1
  83. package/dist/operations/item-update/index.js +2 -1
  84. package/dist/operations/json-web-token/index.d.ts +1 -1
  85. package/dist/operations/json-web-token/index.js +2 -1
  86. package/dist/operations/log/index.d.ts +1 -1
  87. package/dist/operations/log/index.js +2 -1
  88. package/dist/operations/mail/index.d.ts +1 -1
  89. package/dist/operations/mail/index.js +1 -1
  90. package/dist/operations/notification/index.d.ts +1 -1
  91. package/dist/operations/notification/index.js +2 -1
  92. package/dist/operations/request/index.d.ts +1 -1
  93. package/dist/operations/request/index.js +3 -2
  94. package/dist/operations/sleep/index.d.ts +1 -1
  95. package/dist/operations/sleep/index.js +1 -1
  96. package/dist/operations/transform/index.d.ts +1 -1
  97. package/dist/operations/transform/index.js +2 -1
  98. package/dist/operations/trigger/index.d.ts +1 -1
  99. package/dist/operations/trigger/index.js +2 -1
  100. package/dist/services/activity.js +1 -1
  101. package/dist/services/assets.d.ts +1 -1
  102. package/dist/services/assets.js +2 -2
  103. package/dist/services/authentication.js +2 -2
  104. package/dist/services/authorization.js +1 -1
  105. package/dist/services/collections.js +3 -3
  106. package/dist/services/fields.d.ts +2 -2
  107. package/dist/services/fields.js +4 -4
  108. package/dist/services/files.d.ts +4 -1
  109. package/dist/services/files.js +6 -6
  110. package/dist/services/graphql/index.js +2 -2
  111. package/dist/services/graphql/subscription.js +3 -3
  112. package/dist/services/import-export/import-worker.d.ts +9 -0
  113. package/dist/services/import-export/import-worker.js +9 -0
  114. package/dist/services/{import-export.d.ts → import-export/index.d.ts} +2 -2
  115. package/dist/services/{import-export.js → import-export/index.js} +51 -42
  116. package/dist/services/index.d.ts +1 -1
  117. package/dist/services/index.js +1 -1
  118. package/dist/services/items.js +2 -2
  119. package/dist/services/mail/index.js +1 -1
  120. package/dist/services/meta.js +1 -1
  121. package/dist/services/payload.js +1 -1
  122. package/dist/services/permissions.d.ts +2 -2
  123. package/dist/services/permissions.js +1 -1
  124. package/dist/services/relations.js +1 -1
  125. package/dist/services/revisions.js +1 -1
  126. package/dist/services/roles.js +1 -1
  127. package/dist/services/schema.js +1 -1
  128. package/dist/services/shares.js +1 -1
  129. package/dist/services/tfa.js +1 -1
  130. package/dist/services/translations.js +1 -1
  131. package/dist/services/users.d.ts +4 -0
  132. package/dist/services/users.js +21 -2
  133. package/dist/services/utils.d.ts +1 -0
  134. package/dist/services/utils.js +8 -2
  135. package/dist/services/websocket.js +11 -1
  136. package/dist/types/index.d.ts +0 -1
  137. package/dist/types/index.js +0 -1
  138. package/dist/utils/apply-query.js +1 -1
  139. package/dist/utils/get-accountability-for-token.js +1 -1
  140. package/dist/utils/get-ast-from-query.js +1 -1
  141. package/dist/utils/get-column-path.js +1 -1
  142. package/dist/utils/get-column.js +1 -1
  143. package/dist/utils/get-default-value.d.ts +1 -2
  144. package/dist/utils/get-permissions.js +1 -1
  145. package/dist/utils/jwt.js +1 -1
  146. package/dist/utils/redact-object.js +9 -3
  147. package/dist/utils/transformations.d.ts +2 -1
  148. package/dist/utils/validate-diff.js +1 -1
  149. package/dist/utils/validate-keys.js +1 -1
  150. package/dist/utils/validate-query.js +1 -1
  151. package/dist/utils/validate-snapshot.js +1 -1
  152. package/dist/websocket/controllers/base.js +1 -1
  153. package/dist/websocket/controllers/index.d.ts +1 -1
  154. package/dist/websocket/controllers/index.js +0 -7
  155. package/dist/websocket/handlers/heartbeat.js +6 -1
  156. package/dist/websocket/handlers/subscribe.js +11 -16
  157. package/dist/websocket/utils/items.d.ts +4 -14
  158. package/dist/websocket/utils/items.js +59 -64
  159. package/dist/worker-pool.d.ts +2 -0
  160. package/dist/worker-pool.js +11 -0
  161. package/package.json +24 -22
  162. package/dist/errors/codes.d.ts +0 -29
  163. package/dist/errors/codes.js +0 -30
  164. package/dist/errors/contains-null-values.d.ts +0 -7
  165. package/dist/errors/contains-null-values.js +0 -4
  166. package/dist/errors/content-too-large.d.ts +0 -1
  167. package/dist/errors/content-too-large.js +0 -3
  168. package/dist/errors/forbidden.d.ts +0 -1
  169. package/dist/errors/forbidden.js +0 -3
  170. package/dist/errors/hit-rate-limit.d.ts +0 -6
  171. package/dist/errors/hit-rate-limit.js +0 -8
  172. package/dist/errors/illegal-asset-transformation.d.ts +0 -4
  173. package/dist/errors/illegal-asset-transformation.js +0 -3
  174. package/dist/errors/index.d.ts +0 -28
  175. package/dist/errors/index.js +0 -28
  176. package/dist/errors/invalid-credentials.d.ts +0 -1
  177. package/dist/errors/invalid-credentials.js +0 -3
  178. package/dist/errors/invalid-foreign-key.d.ts +0 -6
  179. package/dist/errors/invalid-foreign-key.js +0 -14
  180. package/dist/errors/invalid-ip.d.ts +0 -1
  181. package/dist/errors/invalid-ip.js +0 -3
  182. package/dist/errors/invalid-otp.d.ts +0 -1
  183. package/dist/errors/invalid-otp.js +0 -3
  184. package/dist/errors/invalid-payload.d.ts +0 -5
  185. package/dist/errors/invalid-payload.js +0 -4
  186. package/dist/errors/invalid-provider-config.d.ts +0 -5
  187. package/dist/errors/invalid-provider-config.js +0 -3
  188. package/dist/errors/invalid-provider.d.ts +0 -1
  189. package/dist/errors/invalid-provider.js +0 -3
  190. package/dist/errors/invalid-query.d.ts +0 -5
  191. package/dist/errors/invalid-query.js +0 -4
  192. package/dist/errors/invalid-token.d.ts +0 -1
  193. package/dist/errors/invalid-token.js +0 -3
  194. package/dist/errors/method-not-allowed.d.ts +0 -6
  195. package/dist/errors/method-not-allowed.js +0 -6
  196. package/dist/errors/not-null-violation.d.ts +0 -6
  197. package/dist/errors/not-null-violation.js +0 -14
  198. package/dist/errors/range-not-satisfiable.d.ts +0 -7
  199. package/dist/errors/range-not-satisfiable.js +0 -7
  200. package/dist/errors/record-not-unique.d.ts +0 -6
  201. package/dist/errors/record-not-unique.js +0 -14
  202. package/dist/errors/route-not-found.d.ts +0 -5
  203. package/dist/errors/route-not-found.js +0 -4
  204. package/dist/errors/service-unavailable.d.ts +0 -7
  205. package/dist/errors/service-unavailable.js +0 -4
  206. package/dist/errors/token-expired.d.ts +0 -1
  207. package/dist/errors/token-expired.js +0 -3
  208. package/dist/errors/unexpected-response.d.ts +0 -1
  209. package/dist/errors/unexpected-response.js +0 -3
  210. package/dist/errors/unprocessable-content.d.ts +0 -5
  211. package/dist/errors/unprocessable-content.js +0 -4
  212. package/dist/errors/unsupported-media-type.d.ts +0 -6
  213. package/dist/errors/unsupported-media-type.js +0 -4
  214. package/dist/errors/user-suspended.d.ts +0 -1
  215. package/dist/errors/user-suspended.js +0 -3
  216. package/dist/errors/value-out-of-range.d.ts +0 -6
  217. package/dist/errors/value-out-of-range.js +0 -14
  218. package/dist/errors/value-too-long.d.ts +0 -6
  219. package/dist/errors/value-too-long.js +0 -14
  220. package/dist/types/files.d.ts +0 -29
  221. /package/dist/{types/files.js → extensions/types.js} +0 -0
@@ -1,34 +1,5 @@
1
1
  import { getService } from '../../utils/get-service.js';
2
2
  import { CollectionsService, FieldsService, MetaService } from '../../services/index.js';
3
- /**
4
- * Get a single item from a collection using the appropriate service
5
- *
6
- * @param subscription Subscription object
7
- * @param accountability Accountability object
8
- * @param schema Schema object
9
- * @param event Event data
10
- * @returns the fetched item
11
- */
12
- export async function getSinglePayload(subscription, accountability, schema, event) {
13
- const metaService = new MetaService({ schema, accountability });
14
- const query = subscription.query ?? {};
15
- const id = subscription.item;
16
- const result = {
17
- event: event?.action ?? 'init',
18
- };
19
- if (subscription.collection === 'directus_collections') {
20
- const service = new CollectionsService({ schema, accountability });
21
- result['data'] = await service.readOne(String(id));
22
- }
23
- else {
24
- const service = getService(subscription.collection, { schema, accountability });
25
- result['data'] = await service.readOne(id, query);
26
- }
27
- if ('meta' in query) {
28
- result['meta'] = await metaService.getMetaForQuery(subscription.collection, query);
29
- }
30
- return result;
31
- }
32
3
  /**
33
4
  * Get items from a collection using the appropriate service
34
5
  *
@@ -38,17 +9,17 @@ export async function getSinglePayload(subscription, accountability, schema, eve
38
9
  * @param event Event data
39
10
  * @returns the fetched items
40
11
  */
41
- export async function getMultiPayload(subscription, accountability, schema, event) {
12
+ export async function getPayload(subscription, accountability, schema, event) {
42
13
  const metaService = new MetaService({ schema, accountability });
43
14
  const result = {
44
15
  event: event?.action ?? 'init',
45
16
  };
46
17
  switch (subscription.collection) {
47
18
  case 'directus_collections':
48
- result['data'] = await getCollectionPayload(accountability, schema, event);
19
+ result['data'] = await getCollectionPayload(subscription, accountability, schema, event);
49
20
  break;
50
21
  case 'directus_fields':
51
- result['data'] = await getFieldsPayload(accountability, schema, event);
22
+ result['data'] = await getFieldsPayload(subscription, accountability, schema, event);
52
23
  break;
53
24
  case 'directus_relations':
54
25
  result['data'] = event?.payload;
@@ -71,19 +42,27 @@ export async function getMultiPayload(subscription, accountability, schema, even
71
42
  * @param event Event data
72
43
  * @returns the fetched collection data
73
44
  */
74
- export async function getCollectionPayload(accountability, schema, event) {
45
+ export async function getCollectionPayload(subscription, accountability, schema, event) {
75
46
  const service = new CollectionsService({ schema, accountability });
76
- if (!event?.action) {
77
- return await service.readByQuery();
78
- }
79
- else if (event.action === 'create') {
80
- return await service.readMany([String(event.key)]);
81
- }
82
- else if (event.action === 'delete') {
83
- return event.keys;
84
- }
85
- else {
86
- return await service.readMany(event.keys.map((key) => String(key)));
47
+ if ('item' in subscription) {
48
+ if (event?.action === 'delete') {
49
+ // return only the subscribed id in case a bulk delete was done
50
+ return subscription.item;
51
+ }
52
+ else {
53
+ return await service.readOne(String(subscription.item));
54
+ }
55
+ }
56
+ switch (event?.action) {
57
+ case 'create':
58
+ return await service.readMany([String(event.key)]);
59
+ case 'update':
60
+ return await service.readMany(event.keys.map((key) => String(key)));
61
+ case 'delete':
62
+ return event.keys;
63
+ case undefined:
64
+ default:
65
+ return await service.readByQuery();
87
66
  }
88
67
  }
89
68
  /**
@@ -94,16 +73,24 @@ export async function getCollectionPayload(accountability, schema, event) {
94
73
  * @param event Event data
95
74
  * @returns the fetched field data
96
75
  */
97
- export async function getFieldsPayload(accountability, schema, event) {
76
+ export async function getFieldsPayload(subscription, accountability, schema, event) {
98
77
  const service = new FieldsService({ schema, accountability });
99
- if (!event?.action) {
100
- return await service.readAll();
101
- }
102
- else if (event.action === 'delete') {
103
- return event.keys;
104
- }
105
- else {
106
- return await service.readOne(event.payload?.['collection'], event.payload?.['field']);
78
+ if ('item' in subscription) {
79
+ if (event?.action === 'delete') {
80
+ // return only the subscribed id in case a bluk delete was done
81
+ return subscription.item;
82
+ }
83
+ else {
84
+ return await service.readOne(subscription.collection, String(subscription.item));
85
+ }
86
+ }
87
+ switch (event?.action) {
88
+ case undefined:
89
+ return await service.readAll();
90
+ case 'delete':
91
+ return event.keys;
92
+ default:
93
+ return await service.readOne(event?.payload?.['collection'], event?.payload?.['field']);
107
94
  }
108
95
  }
109
96
  /**
@@ -118,16 +105,24 @@ export async function getFieldsPayload(accountability, schema, event) {
118
105
  export async function getItemsPayload(subscription, accountability, schema, event) {
119
106
  const query = subscription.query ?? {};
120
107
  const service = getService(subscription.collection, { schema, accountability });
121
- if (!event?.action) {
122
- return await service.readByQuery(query);
123
- }
124
- else if (event.action === 'create') {
125
- return await service.readMany([event.key], query);
126
- }
127
- else if (event.action === 'delete') {
128
- return event.keys;
129
- }
130
- else {
131
- return await service.readMany(event.keys, query);
108
+ if ('item' in subscription) {
109
+ if (event?.action === 'delete') {
110
+ // return only the subscribed id in case a bluk delete was done
111
+ return subscription.item;
112
+ }
113
+ else {
114
+ return await service.readOne(subscription.item, query);
115
+ }
116
+ }
117
+ switch (event?.action) {
118
+ case 'create':
119
+ return await service.readMany([event.key], query);
120
+ case 'update':
121
+ return await service.readMany(event.keys, query);
122
+ case 'delete':
123
+ return event.keys;
124
+ case undefined:
125
+ default:
126
+ return await service.readByQuery(query);
132
127
  }
133
128
  }
@@ -0,0 +1,2 @@
1
+ import Tinypool from 'tinypool';
2
+ export declare function getWorkerPool(): Tinypool;
@@ -0,0 +1,11 @@
1
+ import Tinypool from 'tinypool';
2
+ let workerPool;
3
+ export function getWorkerPool() {
4
+ if (!workerPool) {
5
+ workerPool = new Tinypool({
6
+ minThreads: 0,
7
+ maxQueue: 'auto',
8
+ });
9
+ }
10
+ return workerPool;
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@directus/api",
3
- "version": "13.1.0",
3
+ "version": "13.2.0",
4
4
  "description": "Directus is a real-time API and App dashboard for managing SQL database content",
5
5
  "keywords": [
6
6
  "directus",
@@ -78,7 +78,6 @@
78
78
  "cookie-parser": "1.4.6",
79
79
  "cors": "2.8.5",
80
80
  "cron-parser": "4.8.1",
81
- "csv-parser": "3.0.0",
82
81
  "date-fns": "2.30.0",
83
82
  "deep-diff": "1.0.2",
84
83
  "destroy": "1.2.0",
@@ -122,6 +121,7 @@
122
121
  "openid-client": "5.4.2",
123
122
  "ora": "6.3.1",
124
123
  "otplib": "12.0.1",
124
+ "papaparse": "5.4.1",
125
125
  "pino": "8.14.1",
126
126
  "pino-http": "8.3.3",
127
127
  "pino-http-print": "3.1.0",
@@ -135,7 +135,7 @@
135
135
  "snappy": "7.2.2",
136
136
  "stream-json": "1.7.5",
137
137
  "strip-bom-stream": "5.0.0",
138
- "tmp-promise": "3.0.3",
138
+ "tinypool": "0.8.1",
139
139
  "tsx": "3.12.7",
140
140
  "uuid": "9.0.0",
141
141
  "uuid-validate": "0.0.3",
@@ -143,22 +143,23 @@
143
143
  "ws": "8.12.1",
144
144
  "zod": "3.21.4",
145
145
  "zod-validation-error": "1.0.1",
146
- "@directus/app": "10.8.0",
147
- "@directus/constants": "10.2.3",
148
- "@directus/errors": "0.0.2",
149
- "@directus/extensions-sdk": "10.1.10",
150
- "@directus/pressure": "1.0.9",
151
- "@directus/schema": "10.0.2",
146
+ "@directus/app": "10.9.1",
147
+ "@directus/constants": "11.0.0",
148
+ "@directus/errors": "0.1.0",
149
+ "@directus/extensions": "0.0.1",
150
+ "@directus/extensions-sdk": "10.1.12",
151
+ "@directus/pressure": "1.0.11",
152
+ "@directus/schema": "11.0.0",
152
153
  "@directus/specs": "10.2.0",
153
- "@directus/storage": "10.0.5",
154
- "@directus/storage-driver-azure": "10.0.10",
155
- "@directus/storage-driver-cloudinary": "10.0.10",
156
- "@directus/storage-driver-gcs": "10.0.10",
157
- "@directus/storage-driver-local": "10.0.10",
158
- "@directus/storage-driver-s3": "10.0.10",
159
- "@directus/storage-driver-supabase": "1.0.2",
160
- "@directus/utils": "10.0.10",
161
- "@directus/validation": "0.0.5"
154
+ "@directus/storage": "10.0.6",
155
+ "@directus/storage-driver-azure": "10.0.12",
156
+ "@directus/storage-driver-cloudinary": "10.0.12",
157
+ "@directus/storage-driver-gcs": "10.0.12",
158
+ "@directus/storage-driver-local": "10.0.12",
159
+ "@directus/storage-driver-s3": "10.0.12",
160
+ "@directus/storage-driver-supabase": "1.0.4",
161
+ "@directus/utils": "11.0.0",
162
+ "@directus/validation": "0.0.7"
162
163
  },
163
164
  "devDependencies": {
164
165
  "@ngneat/falso": "6.4.0",
@@ -190,6 +191,7 @@
190
191
  "@types/node-schedule": "2.1.0",
191
192
  "@types/nodemailer": "6.4.7",
192
193
  "@types/object-hash": "3.0.2",
194
+ "@types/papaparse": "5.3.9",
193
195
  "@types/qs": "6.9.7",
194
196
  "@types/sanitize-html": "2.9.0",
195
197
  "@types/stream-json": "1.7.3",
@@ -203,11 +205,11 @@
203
205
  "form-data": "4.0.0",
204
206
  "knex-mock-client": "2.0.0",
205
207
  "supertest": "6.3.3",
206
- "typescript": "5.0.4",
208
+ "typescript": "5.2.2",
207
209
  "vitest": "0.31.1",
208
- "@directus/random": "0.2.2",
209
- "@directus/tsconfig": "1.0.0",
210
- "@directus/types": "10.1.6"
210
+ "@directus/random": "0.2.3",
211
+ "@directus/tsconfig": "1.0.1",
212
+ "@directus/types": "11.0.0"
211
213
  },
212
214
  "optionalDependencies": {
213
215
  "@keyv/redis": "2.5.8",
@@ -1,29 +0,0 @@
1
- export declare enum ErrorCode {
2
- ContainsNullValues = "CONTAINS_NULL_VALUES",
3
- ContentTooLarge = "CONTENT_TOO_LARGE",
4
- Forbidden = "FORBIDDEN",
5
- IllegalAssetTransformation = "ILLEGAL_ASSET_TRANSFORMATION",
6
- InvalidCredentials = "INVALID_CREDENTIALS",
7
- InvalidForeignKey = "INVALID_FOREIGN_KEY",
8
- InvalidIp = "INVALID_IP",
9
- InvalidOtp = "INVALID_OTP",
10
- InvalidPayload = "INVALID_PAYLOAD",
11
- InvalidProvider = "INVALID_PROVIDER",
12
- InvalidProviderConfig = "INVALID_PROVIDER_CONFIG",
13
- InvalidQuery = "INVALID_QUERY",
14
- InvalidToken = "INVALID_TOKEN",
15
- MethodNotAllowed = "METHOD_NOT_ALLOWED",
16
- NotNullViolation = "NOT_NULL_VIOLATION",
17
- RangeNotSatisfiable = "RANGE_NOT_SATISFIABLE",
18
- RecordNotUnique = "RECORD_NOT_UNIQUE",
19
- RequestsExceeded = "REQUESTS_EXCEEDED",
20
- RouteNotFound = "ROUTE_NOT_FOUND",
21
- ServiceUnavailable = "SERVICE_UNAVAILABLE",
22
- TokenExpired = "TOKEN_EXPIRED",
23
- UnexpectedResponse = "UNEXPECTED_RESPONSE",
24
- UnprocessableContent = "UNPROCESSABLE_CONTENT",
25
- UnsupportedMediaType = "UNSUPPORTED_MEDIA_TYPE",
26
- UserSuspended = "USER_SUSPENDED",
27
- ValueOutOfRange = "VALUE_OUT_OF_RANGE",
28
- ValueTooLong = "VALUE_TOO_LONG"
29
- }
@@ -1,30 +0,0 @@
1
- export var ErrorCode;
2
- (function (ErrorCode) {
3
- ErrorCode["ContainsNullValues"] = "CONTAINS_NULL_VALUES";
4
- ErrorCode["ContentTooLarge"] = "CONTENT_TOO_LARGE";
5
- ErrorCode["Forbidden"] = "FORBIDDEN";
6
- ErrorCode["IllegalAssetTransformation"] = "ILLEGAL_ASSET_TRANSFORMATION";
7
- ErrorCode["InvalidCredentials"] = "INVALID_CREDENTIALS";
8
- ErrorCode["InvalidForeignKey"] = "INVALID_FOREIGN_KEY";
9
- ErrorCode["InvalidIp"] = "INVALID_IP";
10
- ErrorCode["InvalidOtp"] = "INVALID_OTP";
11
- ErrorCode["InvalidPayload"] = "INVALID_PAYLOAD";
12
- ErrorCode["InvalidProvider"] = "INVALID_PROVIDER";
13
- ErrorCode["InvalidProviderConfig"] = "INVALID_PROVIDER_CONFIG";
14
- ErrorCode["InvalidQuery"] = "INVALID_QUERY";
15
- ErrorCode["InvalidToken"] = "INVALID_TOKEN";
16
- ErrorCode["MethodNotAllowed"] = "METHOD_NOT_ALLOWED";
17
- ErrorCode["NotNullViolation"] = "NOT_NULL_VIOLATION";
18
- ErrorCode["RangeNotSatisfiable"] = "RANGE_NOT_SATISFIABLE";
19
- ErrorCode["RecordNotUnique"] = "RECORD_NOT_UNIQUE";
20
- ErrorCode["RequestsExceeded"] = "REQUESTS_EXCEEDED";
21
- ErrorCode["RouteNotFound"] = "ROUTE_NOT_FOUND";
22
- ErrorCode["ServiceUnavailable"] = "SERVICE_UNAVAILABLE";
23
- ErrorCode["TokenExpired"] = "TOKEN_EXPIRED";
24
- ErrorCode["UnexpectedResponse"] = "UNEXPECTED_RESPONSE";
25
- ErrorCode["UnprocessableContent"] = "UNPROCESSABLE_CONTENT";
26
- ErrorCode["UnsupportedMediaType"] = "UNSUPPORTED_MEDIA_TYPE";
27
- ErrorCode["UserSuspended"] = "USER_SUSPENDED";
28
- ErrorCode["ValueOutOfRange"] = "VALUE_OUT_OF_RANGE";
29
- ErrorCode["ValueTooLong"] = "VALUE_TOO_LONG";
30
- })(ErrorCode || (ErrorCode = {}));
@@ -1,7 +0,0 @@
1
- interface ContainsNullValuesErrorExtensions {
2
- collection: string;
3
- field: string;
4
- }
5
- export declare const messageConstructor: ({ collection, field }: ContainsNullValuesErrorExtensions) => string;
6
- export declare const ContainsNullValuesError: import("@directus/errors").DirectusErrorConstructor<ContainsNullValuesErrorExtensions>;
7
- export {};
@@ -1,4 +0,0 @@
1
- import { createError } from '@directus/errors';
2
- import { ErrorCode } from './codes.js';
3
- export const messageConstructor = ({ collection, field }) => `Field "${field}" in collection "${collection}" contains null values.`;
4
- export const ContainsNullValuesError = createError(ErrorCode.ContainsNullValues, messageConstructor, 400);
@@ -1 +0,0 @@
1
- export declare const ContentTooLargeError: import("@directus/errors").DirectusErrorConstructor<void>;
@@ -1,3 +0,0 @@
1
- import { createError } from '@directus/errors';
2
- import { ErrorCode } from './codes.js';
3
- export const ContentTooLargeError = createError(ErrorCode.ContentTooLarge, 'Uploaded content is too large.', 413);
@@ -1 +0,0 @@
1
- export declare const ForbiddenError: import("@directus/errors").DirectusErrorConstructor<void>;
@@ -1,3 +0,0 @@
1
- import { createError } from '@directus/errors';
2
- import { ErrorCode } from './codes.js';
3
- export const ForbiddenError = createError(ErrorCode.Forbidden, `You don't have permission to access this.`, 403);
@@ -1,6 +0,0 @@
1
- export interface HitRateLimitErrorExtensions {
2
- limit: number;
3
- reset: Date;
4
- }
5
- export declare const messageConstructor: (extensions: HitRateLimitErrorExtensions) => string;
6
- export declare const HitRateLimitError: import("@directus/errors").DirectusErrorConstructor<HitRateLimitErrorExtensions>;
@@ -1,8 +0,0 @@
1
- import { createError } from '@directus/errors';
2
- import ms from 'ms';
3
- import { ErrorCode } from './codes.js';
4
- export const messageConstructor = (extensions) => {
5
- const msBeforeNext = extensions.reset.getTime() - Date.now();
6
- return `Too many requests, retry after ${ms(msBeforeNext)}.`;
7
- };
8
- export const HitRateLimitError = createError(ErrorCode.RequestsExceeded, messageConstructor, 429);
@@ -1,4 +0,0 @@
1
- export interface IllegalAssetTransformationErrorExtensions {
2
- invalidTransformations: string[];
3
- }
4
- export declare const IllegalAssetTransformationError: import("@directus/errors").DirectusErrorConstructor<IllegalAssetTransformationErrorExtensions>;
@@ -1,3 +0,0 @@
1
- import { createError } from '@directus/errors';
2
- import { ErrorCode } from './codes.js';
3
- export const IllegalAssetTransformationError = createError(ErrorCode.IllegalAssetTransformation, 'Illegal asset transformation.', 400);
@@ -1,28 +0,0 @@
1
- export { ErrorCode } from './codes.js';
2
- export { ContainsNullValuesError } from './contains-null-values.js';
3
- export { ContentTooLargeError } from './content-too-large.js';
4
- export { ForbiddenError } from './forbidden.js';
5
- export { HitRateLimitError } from './hit-rate-limit.js';
6
- export { IllegalAssetTransformationError } from './illegal-asset-transformation.js';
7
- export { InvalidCredentialsError } from './invalid-credentials.js';
8
- export { InvalidForeignKeyError } from './invalid-foreign-key.js';
9
- export { InvalidIpError } from './invalid-ip.js';
10
- export { InvalidOtpError } from './invalid-otp.js';
11
- export { InvalidPayloadError } from './invalid-payload.js';
12
- export { InvalidProviderError } from './invalid-provider.js';
13
- export { InvalidProviderConfigError } from './invalid-provider-config.js';
14
- export { InvalidQueryError } from './invalid-query.js';
15
- export { InvalidTokenError } from './invalid-token.js';
16
- export { MethodNotAllowedError } from './method-not-allowed.js';
17
- export { NotNullViolationError } from './not-null-violation.js';
18
- export { RangeNotSatisfiableError } from './range-not-satisfiable.js';
19
- export { RecordNotUniqueError } from './record-not-unique.js';
20
- export { RouteNotFoundError } from './route-not-found.js';
21
- export { ServiceUnavailableError } from './service-unavailable.js';
22
- export { TokenExpiredError } from './token-expired.js';
23
- export { UnexpectedResponseError } from './unexpected-response.js';
24
- export { UnprocessableContentError } from './unprocessable-content.js';
25
- export { UnsupportedMediaTypeError } from './unsupported-media-type.js';
26
- export { UserSuspendedError } from './user-suspended.js';
27
- export { ValueOutOfRangeError } from './value-out-of-range.js';
28
- export { ValueTooLongError } from './value-too-long.js';
@@ -1,28 +0,0 @@
1
- export { ErrorCode } from './codes.js';
2
- export { ContainsNullValuesError } from './contains-null-values.js';
3
- export { ContentTooLargeError } from './content-too-large.js';
4
- export { ForbiddenError } from './forbidden.js';
5
- export { HitRateLimitError } from './hit-rate-limit.js';
6
- export { IllegalAssetTransformationError } from './illegal-asset-transformation.js';
7
- export { InvalidCredentialsError } from './invalid-credentials.js';
8
- export { InvalidForeignKeyError } from './invalid-foreign-key.js';
9
- export { InvalidIpError } from './invalid-ip.js';
10
- export { InvalidOtpError } from './invalid-otp.js';
11
- export { InvalidPayloadError } from './invalid-payload.js';
12
- export { InvalidProviderError } from './invalid-provider.js';
13
- export { InvalidProviderConfigError } from './invalid-provider-config.js';
14
- export { InvalidQueryError } from './invalid-query.js';
15
- export { InvalidTokenError } from './invalid-token.js';
16
- export { MethodNotAllowedError } from './method-not-allowed.js';
17
- export { NotNullViolationError } from './not-null-violation.js';
18
- export { RangeNotSatisfiableError } from './range-not-satisfiable.js';
19
- export { RecordNotUniqueError } from './record-not-unique.js';
20
- export { RouteNotFoundError } from './route-not-found.js';
21
- export { ServiceUnavailableError } from './service-unavailable.js';
22
- export { TokenExpiredError } from './token-expired.js';
23
- export { UnexpectedResponseError } from './unexpected-response.js';
24
- export { UnprocessableContentError } from './unprocessable-content.js';
25
- export { UnsupportedMediaTypeError } from './unsupported-media-type.js';
26
- export { UserSuspendedError } from './user-suspended.js';
27
- export { ValueOutOfRangeError } from './value-out-of-range.js';
28
- export { ValueTooLongError } from './value-too-long.js';
@@ -1 +0,0 @@
1
- export declare const InvalidCredentialsError: import("@directus/errors").DirectusErrorConstructor<void>;
@@ -1,3 +0,0 @@
1
- import { createError } from '@directus/errors';
2
- import { ErrorCode } from './codes.js';
3
- export const InvalidCredentialsError = createError(ErrorCode.InvalidCredentials, 'Invalid user credentials.', 401);
@@ -1,6 +0,0 @@
1
- export interface InvalidForeignKeyErrorExtensions {
2
- collection: string | null;
3
- field: string | null;
4
- }
5
- export declare const messageConstructor: ({ collection, field }: InvalidForeignKeyErrorExtensions) => string;
6
- export declare const InvalidForeignKeyError: import("@directus/errors").DirectusErrorConstructor<InvalidForeignKeyErrorExtensions>;
@@ -1,14 +0,0 @@
1
- import { createError } from '@directus/errors';
2
- import { ErrorCode } from './codes.js';
3
- export const messageConstructor = ({ collection, field }) => {
4
- let message = 'Invalid foreign key';
5
- if (field) {
6
- message += ` for field "${field}"`;
7
- }
8
- if (collection) {
9
- message += ` in collection "${collection}"`;
10
- }
11
- message += `.`;
12
- return message;
13
- };
14
- export const InvalidForeignKeyError = createError(ErrorCode.InvalidForeignKey, messageConstructor, 400);
@@ -1 +0,0 @@
1
- export declare const InvalidIpError: import("@directus/errors").DirectusErrorConstructor<void>;
@@ -1,3 +0,0 @@
1
- import { createError } from '@directus/errors';
2
- import { ErrorCode } from './codes.js';
3
- export const InvalidIpError = createError(ErrorCode.InvalidIp, 'Invalid IP address.', 401);
@@ -1 +0,0 @@
1
- export declare const InvalidOtpError: import("@directus/errors").DirectusErrorConstructor<void>;
@@ -1,3 +0,0 @@
1
- import { createError } from '@directus/errors';
2
- import { ErrorCode } from './codes.js';
3
- export const InvalidOtpError = createError(ErrorCode.InvalidOtp, 'Invalid user OTP.', 401);
@@ -1,5 +0,0 @@
1
- export interface InvalidPayloadErrorExtensions {
2
- reason: string;
3
- }
4
- export declare const messageConstructor: ({ reason }: InvalidPayloadErrorExtensions) => string;
5
- export declare const InvalidPayloadError: import("@directus/errors").DirectusErrorConstructor<InvalidPayloadErrorExtensions>;
@@ -1,4 +0,0 @@
1
- import { createError } from '@directus/errors';
2
- import { ErrorCode } from './codes.js';
3
- export const messageConstructor = ({ reason }) => `Invalid payload. ${reason}.`;
4
- export const InvalidPayloadError = createError(ErrorCode.InvalidPayload, messageConstructor, 400);
@@ -1,5 +0,0 @@
1
- export interface InvalidProviderConfigErrorExtensions {
2
- provider: string;
3
- reason?: string;
4
- }
5
- export declare const InvalidProviderConfigError: import("@directus/errors").DirectusErrorConstructor<InvalidProviderConfigErrorExtensions>;
@@ -1,3 +0,0 @@
1
- import { createError } from '@directus/errors';
2
- import { ErrorCode } from './codes.js';
3
- export const InvalidProviderConfigError = createError(ErrorCode.InvalidProviderConfig, 'Invalid config.', 503);
@@ -1 +0,0 @@
1
- export declare const InvalidProviderError: import("@directus/errors").DirectusErrorConstructor<void>;
@@ -1,3 +0,0 @@
1
- import { createError } from '@directus/errors';
2
- import { ErrorCode } from './codes.js';
3
- export const InvalidProviderError = createError(ErrorCode.InvalidProvider, 'Invalid provider.', 403);
@@ -1,5 +0,0 @@
1
- export interface InvalidQueryErrorExtensions {
2
- reason: string;
3
- }
4
- export declare const messageConstructor: ({ reason }: InvalidQueryErrorExtensions) => string;
5
- export declare const InvalidQueryError: import("@directus/errors").DirectusErrorConstructor<InvalidQueryErrorExtensions>;
@@ -1,4 +0,0 @@
1
- import { createError } from '@directus/errors';
2
- import { ErrorCode } from './codes.js';
3
- export const messageConstructor = ({ reason }) => `Invalid query. ${reason}.`;
4
- export const InvalidQueryError = createError(ErrorCode.InvalidQuery, messageConstructor, 400);
@@ -1 +0,0 @@
1
- export declare const InvalidTokenError: import("@directus/errors").DirectusErrorConstructor<void>;
@@ -1,3 +0,0 @@
1
- import { createError } from '@directus/errors';
2
- import { ErrorCode } from './codes.js';
3
- export const InvalidTokenError = createError(ErrorCode.InvalidToken, 'Invalid token.', 403);
@@ -1,6 +0,0 @@
1
- export interface MethodNotAllowedErrorExtensions {
2
- allowed: string[];
3
- current: string;
4
- }
5
- export declare const messageConstructor: (extensions: MethodNotAllowedErrorExtensions) => string;
6
- export declare const MethodNotAllowedError: import("@directus/errors").DirectusErrorConstructor<MethodNotAllowedErrorExtensions>;
@@ -1,6 +0,0 @@
1
- import { createError } from '@directus/errors';
2
- import { ErrorCode } from './codes.js';
3
- export const messageConstructor = (extensions) => `Invalid method "${extensions.current}" used. Should be one of ${extensions.allowed
4
- .map((method) => `"${method}"`)
5
- .join(', ')}.`;
6
- export const MethodNotAllowedError = createError(ErrorCode.MethodNotAllowed, messageConstructor, 405);
@@ -1,6 +0,0 @@
1
- export interface NotNullViolationErrorExtensions {
2
- collection: string | null;
3
- field: string | null;
4
- }
5
- export declare const messageConstructor: ({ collection, field }: NotNullViolationErrorExtensions) => string;
6
- export declare const NotNullViolationError: import("@directus/errors").DirectusErrorConstructor<NotNullViolationErrorExtensions>;
@@ -1,14 +0,0 @@
1
- import { createError } from '@directus/errors';
2
- import { ErrorCode } from './codes.js';
3
- export const messageConstructor = ({ collection, field }) => {
4
- let message = 'Value ';
5
- if (field) {
6
- message += `for field "${field}" `;
7
- }
8
- if (collection) {
9
- message += `in collection "${collection}" `;
10
- }
11
- message += `can't be null.`;
12
- return message;
13
- };
14
- export const NotNullViolationError = createError(ErrorCode.NotNullViolation, messageConstructor, 400);
@@ -1,7 +0,0 @@
1
- import type { Range } from '@directus/storage';
2
- interface RangeNotSatisfiableErrorExtensions {
3
- range: Range;
4
- }
5
- export declare const messageConstructor: ({ range }: RangeNotSatisfiableErrorExtensions) => string;
6
- export declare const RangeNotSatisfiableError: import("@directus/errors").DirectusErrorConstructor<RangeNotSatisfiableErrorExtensions>;
7
- export {};
@@ -1,7 +0,0 @@
1
- import { createError } from '@directus/errors';
2
- import { ErrorCode } from './codes.js';
3
- export const messageConstructor = ({ range }) => {
4
- const rangeString = `"${range.start ?? ''}-${range.end ?? ''}"`;
5
- return `Range ${rangeString} is invalid or the file's size doesn't match the requested range.`;
6
- };
7
- export const RangeNotSatisfiableError = createError(ErrorCode.RangeNotSatisfiable, messageConstructor, 416);
@@ -1,6 +0,0 @@
1
- export interface RecordNotUniqueErrorExtensions {
2
- collection: string | null;
3
- field: string | null;
4
- }
5
- export declare const messageConstructor: ({ collection, field }: RecordNotUniqueErrorExtensions) => string;
6
- export declare const RecordNotUniqueError: import("@directus/errors").DirectusErrorConstructor<RecordNotUniqueErrorExtensions>;