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
@@ -3,9 +3,9 @@
3
3
  * expecting an item vs any other generic object.
4
4
  */
5
5
  import { EventContext } from '@directus/shared/types';
6
- export declare type Item = Record<string, any>;
7
- export declare type PrimaryKey = string | number;
8
- export declare type Alterations = {
6
+ export type Item = Record<string, any>;
7
+ export type PrimaryKey = string | number;
8
+ export type Alterations = {
9
9
  create: {
10
10
  [key: string]: any;
11
11
  }[];
@@ -14,7 +14,7 @@ export declare type Alterations = {
14
14
  }[];
15
15
  delete: (number | string)[];
16
16
  };
17
- export declare type MutationOptions = {
17
+ export type MutationOptions = {
18
18
  /**
19
19
  * Callback function that's fired whenever a revision is made in the mutation
20
20
  */
@@ -37,7 +37,7 @@ export declare type MutationOptions = {
37
37
  */
38
38
  bypassEmitAction?: (params: ActionEventParams) => void;
39
39
  };
40
- export declare type ActionEventParams = {
40
+ export type ActionEventParams = {
41
41
  event: string | string[];
42
42
  meta: Record<string, any>;
43
43
  context: EventContext;
@@ -1,4 +1,4 @@
1
- export declare type Migration = {
1
+ export type Migration = {
2
2
  version: string;
3
3
  name: string;
4
4
  timestamp: Date;
@@ -1,4 +1,4 @@
1
- export declare type Revision = {
1
+ export type Revision = {
2
2
  activity: number;
3
3
  collection: string;
4
4
  item: string | number;
@@ -1,7 +1,7 @@
1
1
  import { Knex } from 'knex';
2
2
  import { Accountability, Query, SchemaOverview } from '@directus/shared/types';
3
3
  import { Item, PrimaryKey } from './items';
4
- export declare type AbstractServiceOptions = {
4
+ export type AbstractServiceOptions = {
5
5
  knex?: Knex;
6
6
  accountability?: Accountability | null;
7
7
  schema: SchemaOverview;
@@ -1,20 +1,20 @@
1
1
  import { Collection } from './collection';
2
2
  import { Relation, RelationMeta, Field, FieldMeta } from '@directus/shared/types';
3
3
  import { Diff } from 'deep-diff';
4
- export declare type Snapshot = {
4
+ export type Snapshot = {
5
5
  version: number;
6
6
  directus: string;
7
7
  collections: Collection[];
8
8
  fields: SnapshotField[];
9
9
  relations: SnapshotRelation[];
10
10
  };
11
- export declare type SnapshotField = Field & {
11
+ export type SnapshotField = Field & {
12
12
  meta: Omit<FieldMeta, 'id'>;
13
13
  };
14
- export declare type SnapshotRelation = Relation & {
14
+ export type SnapshotRelation = Relation & {
15
15
  meta: Omit<RelationMeta, 'id'>;
16
16
  };
17
- export declare type SnapshotDiff = {
17
+ export type SnapshotDiff = {
18
18
  collections: {
19
19
  collection: string;
20
20
  diff: Diff<Collection | undefined>[];
@@ -1,4 +1,4 @@
1
- export declare type Webhook = {
1
+ export type Webhook = {
2
2
  id: number;
3
3
  name: string;
4
4
  method: 'GET' | 'POST';
@@ -9,7 +9,7 @@ export declare type Webhook = {
9
9
  collections: string[];
10
10
  headers: WebhookHeader[];
11
11
  };
12
- export declare type WebhookHeader = {
12
+ export type WebhookHeader = {
13
13
  header: string;
14
14
  value: string;
15
15
  };
@@ -4,7 +4,7 @@
4
4
  import { Knex } from 'knex';
5
5
  import { AST } from '../types';
6
6
  import { Query, PermissionsAction, Accountability, SchemaOverview } from '@directus/shared/types';
7
- declare type GetASTOptions = {
7
+ type GetASTOptions = {
8
8
  accountability?: Accountability | null;
9
9
  action?: PermissionsAction;
10
10
  knex?: Knex;
@@ -1,8 +1,8 @@
1
1
  import { Relation } from '@directus/shared/types';
2
- declare type AliasMap = string | {
2
+ type AliasMap = string | {
3
3
  [key: string]: AliasMap;
4
4
  };
5
- export declare type ColPathProps = {
5
+ export type ColPathProps = {
6
6
  path: string[];
7
7
  collection: string;
8
8
  aliasMap: AliasMap;
@@ -1,3 +1,3 @@
1
- export default function getModuleDefault<T>(mod: T | {
1
+ export default function getModuleDefault<T extends object>(mod: T | {
2
2
  default: T;
3
3
  }): T;
@@ -1,5 +1,5 @@
1
1
  import { Relation } from '@directus/shared/types';
2
- declare type RelationInfo = {
2
+ type RelationInfo = {
3
3
  relation: Relation | null;
4
4
  relationType: string | null;
5
5
  };
@@ -1,4 +1,4 @@
1
- declare type Job = () => Promise<void> | void;
1
+ type Job = () => Promise<void> | void;
2
2
  export declare class JobQueue {
3
3
  private running;
4
4
  private jobs;
@@ -1,3 +1,4 @@
1
+ /// <reference types="lodash" />
1
2
  import { Permission } from '@directus/shared/types';
2
3
  export declare function mergePermissions(strategy: 'and' | 'or', ...permissions: Permission[][]): Permission[];
3
4
  export declare function mergePermission(strategy: 'and' | 'or', currentPerm: Permission, newPerm: Permission): import("lodash").Omit<{
@@ -54,7 +54,9 @@ function reduceSchema(schema, permissions, actions = ['create', 'read', 'update'
54
54
  collectionsAllowed = false;
55
55
  }
56
56
  if (relation.related_collection &&
57
- Object.keys(allowedFieldsInCollection).includes(relation.related_collection) === false) {
57
+ (Object.keys(allowedFieldsInCollection).includes(relation.related_collection) === false ||
58
+ // Ignore legacy permissions with an empty fields array
59
+ allowedFieldsInCollection[relation.related_collection].length === 0)) {
58
60
  collectionsAllowed = false;
59
61
  }
60
62
  if (((_a = relation.meta) === null || _a === void 0 ? void 0 : _a.one_allowed_collections) &&
package/package.json CHANGED
@@ -1,9 +1,7 @@
1
1
  {
2
2
  "name": "directus",
3
- "version": "9.20.4",
4
- "license": "GPL-3.0-only",
5
- "homepage": "https://github.com/directus/directus#readme",
6
- "description": "Directus is a real-time API and App dashboard for managing SQL database content.",
3
+ "version": "9.21.0",
4
+ "description": "Directus is a real-time API and App dashboard for managing SQL database content",
7
5
  "keywords": [
8
6
  "directus",
9
7
  "realtime",
@@ -23,13 +21,17 @@
23
21
  "framework",
24
22
  "vue"
25
23
  ],
26
- "repository": {
27
- "type": "git",
28
- "url": "git+https://github.com/directus/directus.git"
29
- },
24
+ "homepage": "https://directus.io",
30
25
  "bugs": {
31
26
  "url": "https://github.com/directus/directus/issues"
32
27
  },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/directus/directus.git",
31
+ "directory": "api"
32
+ },
33
+ "funding": "https://github.com/directus/directus?sponsor=1",
34
+ "license": "GPL-3.0-only",
33
35
  "author": {
34
36
  "name": "Monospace Inc",
35
37
  "email": "info@monospace.io",
@@ -47,40 +49,37 @@
47
49
  "url": "https://github.com/benhaynes"
48
50
  }
49
51
  ],
50
- "main": "dist/index.js",
51
52
  "exports": {
52
53
  ".": "./dist/index.js",
53
54
  "./*": "./dist/*.js",
54
55
  "./package.json": "./package.json"
55
56
  },
57
+ "main": "dist/index.js",
56
58
  "bin": {
57
59
  "directus": "cli.js"
58
60
  },
59
- "engines": {
60
- "node": ">=12.20.0"
61
- },
62
61
  "files": [
63
62
  "dist",
64
- "LICENSE",
65
- "README.md"
63
+ "!**/*.test.js",
64
+ "!**/__*__/"
66
65
  ],
67
66
  "dependencies": {
68
67
  "@authenio/samlify-node-xmllint": "2.0.0",
69
- "@aws-sdk/client-ses": "3.190.0",
70
- "@directus/app": "9.20.4",
71
- "@directus/drive": "9.20.4",
72
- "@directus/drive-azure": "9.20.4",
73
- "@directus/drive-gcs": "9.20.4",
74
- "@directus/drive-s3": "9.20.4",
75
- "@directus/extensions-sdk": "9.20.4",
68
+ "@aws-sdk/client-ses": "3.211.0",
69
+ "@directus/app": "9.21.0",
70
+ "@directus/drive": "9.21.0",
71
+ "@directus/drive-azure": "9.21.0",
72
+ "@directus/drive-gcs": "9.21.0",
73
+ "@directus/drive-s3": "9.21.0",
74
+ "@directus/extensions-sdk": "9.21.0",
76
75
  "@directus/format-title": "9.15.0",
77
- "@directus/schema": "9.20.4",
78
- "@directus/shared": "9.20.4",
79
- "@directus/specs": "9.20.4",
76
+ "@directus/schema": "9.21.0",
77
+ "@directus/shared": "9.21.0",
78
+ "@directus/specs": "9.21.0",
80
79
  "@godaddy/terminus": "4.11.2",
81
- "@rollup/plugin-alias": "4.0.0",
82
- "@rollup/plugin-virtual": "3.0.0",
83
- "argon2": "0.30.1",
80
+ "@rollup/plugin-alias": "4.0.2",
81
+ "@rollup/plugin-virtual": "3.0.1",
82
+ "argon2": "0.30.2",
84
83
  "async": "3.2.4",
85
84
  "async-mutex": "0.4.0",
86
85
  "axios": "1.1.3",
@@ -108,22 +107,22 @@
108
107
  "fs-extra": "10.1.0",
109
108
  "globby": "11.0.4",
110
109
  "graphql": "16.6.0",
111
- "graphql-compose": "9.0.9",
110
+ "graphql-compose": "9.0.10",
112
111
  "helmet": "6.0.0",
113
112
  "inquirer": "8.2.4",
114
- "ioredis": "5.2.3",
115
- "joi": "17.6.3",
113
+ "ioredis": "5.2.4",
114
+ "joi": "17.7.0",
116
115
  "js-yaml": "4.1.0",
117
116
  "js2xmlparser": "5.0.0",
118
117
  "json2csv": "5.0.7",
119
118
  "jsonwebtoken": "8.5.1",
120
- "keyv": "4.5.0",
119
+ "keyv": "4.5.2",
121
120
  "knex": "2.3.0",
122
121
  "knex-schema-inspector": "3.0.0",
123
122
  "ldapjs": "2.3.3",
124
- "liquidjs": "9.42.0",
123
+ "liquidjs": "9.42.1",
125
124
  "lodash": "4.17.21",
126
- "marked": "4.1.1",
125
+ "marked": "4.2.2",
127
126
  "micromustache": "8.0.3",
128
127
  "mime-types": "2.1.35",
129
128
  "ms": "2.1.3",
@@ -133,20 +132,20 @@
133
132
  "nodemailer": "6.8.0",
134
133
  "object-hash": "3.0.0",
135
134
  "openapi3-ts": "3.1.1",
136
- "openid-client": "5.2.0",
135
+ "openid-client": "5.3.0",
137
136
  "ora": "5.4.0",
138
137
  "otplib": "12.0.1",
139
- "pino": "8.6.1",
138
+ "pino": "8.7.0",
140
139
  "pino-http": "8.2.1",
141
140
  "pino-http-print": "3.1.0",
142
141
  "qs": "6.11.0",
143
- "rate-limiter-flexible": "2.3.12",
142
+ "rate-limiter-flexible": "2.4.1",
144
143
  "resolve-cwd": "3.0.0",
145
- "rollup": "3.2.3",
146
- "samlify": "2.8.6",
147
- "sanitize-html": "2.7.2",
148
- "sharp": "0.31.1",
149
- "snappy": "7.2.0",
144
+ "rollup": "3.3.0",
145
+ "samlify": "2.8.7",
146
+ "sanitize-html": "2.7.3",
147
+ "sharp": "0.31.2",
148
+ "snappy": "7.2.2",
150
149
  "stream-json": "1.7.4",
151
150
  "strip-bom-stream": "4.0.0",
152
151
  "tmp-promise": "3.0.3",
@@ -156,18 +155,6 @@
156
155
  "vm2": "3.9.11",
157
156
  "wellknown": "0.5.0"
158
157
  },
159
- "optionalDependencies": {
160
- "@keyv/redis": "2.5.2",
161
- "keyv-memcache": "1.2.5",
162
- "memcached": "2.2.2",
163
- "mysql": "2.18.1",
164
- "nodemailer-mailgun-transport": "2.1.5",
165
- "nodemailer-sendgrid": "1.0.3",
166
- "pg": "8.8.0",
167
- "sqlite3": "5.1.2",
168
- "tedious": "15.1.0"
169
- },
170
- "gitHead": "24621f3934dc77eb23441331040ed13c676ceffd",
171
158
  "devDependencies": {
172
159
  "@otplib/preset-default": "12.0.1",
173
160
  "@types/async": "3.2.15",
@@ -186,18 +173,17 @@
186
173
  "@types/flat": "5.0.2",
187
174
  "@types/fs-extra": "9.0.13",
188
175
  "@types/inquirer": "8.2.1",
189
- "@types/jest": "29.2.0",
190
176
  "@types/js-yaml": "4.0.5",
191
177
  "@types/json2csv": "5.0.3",
192
178
  "@types/jsonwebtoken": "8.5.9",
193
179
  "@types/keyv": "3.1.4",
194
- "@types/ldapjs": "2.2.4",
195
- "@types/lodash": "4.14.186",
180
+ "@types/ldapjs": "2.2.5",
181
+ "@types/lodash": "4.14.189",
196
182
  "@types/marked": "4.0.7",
197
183
  "@types/mime-types": "2.1.1",
198
184
  "@types/ms": "0.7.31",
199
- "@types/node": "18.11.2",
200
- "@types/node-cron": "3.0.4",
185
+ "@types/node": "18.11.9",
186
+ "@types/node-cron": "3.0.6",
201
187
  "@types/nodemailer": "6.4.6",
202
188
  "@types/object-hash": "2.2.1",
203
189
  "@types/pino": "7.0.4",
@@ -209,28 +195,41 @@
209
195
  "@types/supertest": "2.0.12",
210
196
  "@types/uuid": "8.3.4",
211
197
  "@types/uuid-validate": "0.0.1",
212
- "@types/wellknown": "0.5.3",
198
+ "@types/wellknown": "0.5.4",
199
+ "@vitest/coverage-c8": "0.25.2",
213
200
  "copyfiles": "2.4.1",
214
- "cross-env": "7.0.3",
215
201
  "form-data": "4.0.0",
216
- "jest": "29.2.1",
217
202
  "knex-mock-client": "1.8.4",
218
203
  "rimraf": "3.0.2",
219
- "supertest": "6.3.0",
220
- "ts-jest": "29.0.3",
204
+ "supertest": "6.3.1",
221
205
  "ts-node": "10.9.1",
222
206
  "ts-node-dev": "2.0.0",
223
- "typescript": "4.8.4"
207
+ "typescript": "4.9.3",
208
+ "vitest": "0.25.2"
209
+ },
210
+ "optionalDependencies": {
211
+ "@keyv/redis": "2.5.3",
212
+ "keyv-memcache": "1.2.5",
213
+ "memcached": "2.2.2",
214
+ "mysql": "2.18.1",
215
+ "nodemailer-mailgun-transport": "2.1.5",
216
+ "nodemailer-sendgrid": "1.0.3",
217
+ "pg": "8.8.0",
218
+ "sqlite3": "5.1.2",
219
+ "tedious": "15.1.1"
220
+ },
221
+ "engines": {
222
+ "node": ">=12.20.0"
224
223
  },
225
224
  "scripts": {
226
- "start": "npx directus start",
227
225
  "prebuild": "pnpm cleanup",
228
- "build": "tsc --build && copyfiles \"src/**/*.*\" -e \"src/**/*.ts\" -u 1 dist",
226
+ "build": "tsc --build && copyfiles \"src/**/*.{yaml,liquid}\" -u 1 dist",
229
227
  "cleanup": "rimraf dist",
230
- "dev": "cross-env NODE_ENV=development SERVE_APP=false ts-node-dev --files --transpile-only --respawn --watch \".env\" --inspect=0 --exit-child -- src/start.ts",
231
- "cli": "cross-env NODE_ENV=development SERVE_APP=false ts-node --script-mode --transpile-only src/cli/run.ts",
232
- "test": "jest",
233
- "test:coverage": "jest --coverage",
234
- "test:watch": "jest --watch"
228
+ "cli": "NODE_ENV=development SERVE_APP=false ts-node --script-mode --transpile-only src/cli/run.ts",
229
+ "dev": "NODE_ENV=development SERVE_APP=false ts-node-dev --files --transpile-only --respawn --watch \".env\" --inspect=0 --exit-child -- src/start.ts",
230
+ "start": "npx directus start",
231
+ "test": "vitest run",
232
+ "test:coverage": "vitest run --coverage",
233
+ "test:watch": "vitest"
235
234
  }
236
235
  }
@@ -1,5 +0,0 @@
1
- /// <reference types="jest" />
2
- export declare const getCache: jest.Mock<any, any>;
3
- export declare const flushCaches: jest.Mock<any, any>;
4
- export declare const clearSystemCache: jest.Mock<any, any>;
5
- export declare const setSystemCache: jest.Mock<any, any>;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setSystemCache = exports.clearSystemCache = exports.flushCaches = exports.getCache = void 0;
4
- exports.getCache = jest.fn().mockReturnValue({ cache: undefined, systemCache: undefined, lockCache: undefined });
5
- exports.flushCaches = jest.fn();
6
- exports.clearSystemCache = jest.fn();
7
- exports.setSystemCache = jest.fn();
@@ -1,2 +0,0 @@
1
- export declare const sqlFieldFormatter: (schema: Record<string, any>, table: string) => string;
2
- export declare const sqlFieldList: (schema: Record<string, any>, table: string) => string;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sqlFieldList = exports.sqlFieldFormatter = void 0;
4
- // dynamically adds fields to the sql strings as the schema grows
5
- const sqlFieldFormatter = (schema, table) => {
6
- const fields = [];
7
- // Exclude alias fields, unable to selected in DB
8
- for (const field of Object.keys(schema.collections[table].fields)) {
9
- if (schema.collections[table].fields[field].type !== 'alias') {
10
- fields.push(field);
11
- }
12
- }
13
- let sql = '';
14
- for (const field of fields.slice(0, fields.length - 1)) {
15
- sql += `"${table}"."${field}", `;
16
- }
17
- sql += `"${table}"."${fields[fields.length - 1]}"`;
18
- return sql;
19
- };
20
- exports.sqlFieldFormatter = sqlFieldFormatter;
21
- const sqlFieldList = (schema, table) => {
22
- const fields = [];
23
- // Exclude alias fields, unable to selected in DB
24
- for (const field of Object.keys(schema.collections[table].fields)) {
25
- if (schema.collections[table].fields[field].type !== 'alias') {
26
- fields.push(field);
27
- }
28
- }
29
- let sql = '';
30
- for (const field of fields.slice(0, fields.length - 1)) {
31
- sql += `"${field}", `;
32
- }
33
- sql += `"${fields[fields.length - 1]}"`;
34
- return sql;
35
- };
36
- exports.sqlFieldList = sqlFieldList;
@@ -1,13 +0,0 @@
1
- import { CollectionsOverview, Relation } from '@directus/shared/types';
2
- export declare const systemSchema: {
3
- collections: CollectionsOverview;
4
- relations: Relation[];
5
- };
6
- export declare const userSchema: {
7
- collections: CollectionsOverview;
8
- relations: Relation[];
9
- };
10
- export declare const snapshotApplyTestSchema: {
11
- collections: CollectionsOverview;
12
- relations: Relation[];
13
- };