@directus/api 18.0.0 → 18.1.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.
@@ -6,7 +6,8 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
6
6
  export async function up(knex) {
7
7
  await knex.schema.alterTable('directus_extensions', (table) => {
8
8
  table.uuid('id').nullable();
9
- table.string('source', 255);
9
+ table.string('folder');
10
+ table.string('source');
10
11
  table.uuid('bundle');
11
12
  });
12
13
  const installedExtensions = await knex.select('name').from('directus_extensions');
@@ -30,7 +31,7 @@ export async function up(knex) {
30
31
  catch {
31
32
  source = 'local';
32
33
  }
33
- await knex('directus_extensions').update({ id, source }).where({ name });
34
+ await knex('directus_extensions').update({ id, source, folder: name }).where({ name });
34
35
  idMap.set(name, id);
35
36
  }
36
37
  }
@@ -47,22 +48,41 @@ export async function up(knex) {
47
48
  if (!bundleParentId)
48
49
  continue;
49
50
  await knex('directus_extensions')
50
- .update({ bundle: bundleParentId, name: name.substring(bundleParentName.length + 1) })
51
- .where({ name });
51
+ .update({ bundle: bundleParentId, folder: name.substring(bundleParentName.length + 1) })
52
+ .where({ folder: name });
52
53
  }
53
54
  await knex.schema.alterTable('directus_extensions', (table) => {
54
- table.dropPrimary();
55
+ table.dropColumn('name');
55
56
  table.uuid('id').alter().primary().notNullable();
56
- table.string('source', 255).alter().notNullable().defaultTo('local');
57
- table.renameColumn('name', 'folder');
57
+ table.string('source').alter().notNullable();
58
+ table.string('folder').alter().notNullable();
58
59
  });
59
60
  }
61
+ /*
62
+ * Note: For local extensions having a different package & folder name,
63
+ * we aren't able to revert to the exact same state as before.
64
+ * But we still need to do the name convertion, in order for the migration to succeed.
65
+ */
60
66
  export async function down(knex) {
61
67
  await knex.schema.alterTable('directus_extensions', (table) => {
62
- table.dropColumns('id', 'source', 'bundle');
63
- table.renameColumn('folder', 'name');
68
+ table.string('name');
64
69
  });
70
+ const installedExtensions = await knex.select(['id', 'folder', 'bundle']).from('directus_extensions');
71
+ const idMap = new Map(installedExtensions.map((extension) => [extension.id, extension.folder]));
72
+ for (const { id, folder, bundle, source } of installedExtensions) {
73
+ if (source === 'registry') {
74
+ await knex('directus_extensions').delete().where({ id });
75
+ continue;
76
+ }
77
+ let name = folder;
78
+ if (bundle) {
79
+ const bundleParentName = idMap.get(bundle);
80
+ name = `${bundleParentName}/${name}`;
81
+ }
82
+ await knex('directus_extensions').update({ name }).where({ id });
83
+ }
65
84
  await knex.schema.alterTable('directus_extensions', (table) => {
66
- table.string('name', 255).primary().alter();
85
+ table.dropColumns('id', 'folder', 'source', 'bundle');
86
+ table.string('name').alter().primary().notNullable();
67
87
  });
68
88
  }
@@ -5,7 +5,6 @@ import { Liquid } from 'liquidjs';
5
5
  import path from 'path';
6
6
  import { fileURLToPath } from 'url';
7
7
  import getDatabase from '../../database/index.js';
8
- import { getExtensionsPath } from '../../extensions/lib/get-extensions-path.js';
9
8
  import { useLogger } from '../../logger.js';
10
9
  import getMailer from '../../mailer.js';
11
10
  import { Url } from '../../utils/url.js';
@@ -13,7 +12,7 @@ const env = useEnv();
13
12
  const logger = useLogger();
14
13
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
15
14
  const liquidEngine = new Liquid({
16
- root: [path.resolve(getExtensionsPath(), 'templates'), path.resolve(__dirname, 'templates')],
15
+ root: [path.resolve(env['EMAIL_TEMPLATES_PATH']), path.resolve(__dirname, 'templates')],
17
16
  extname: '.liquid',
18
17
  });
19
18
  export class MailService {
@@ -61,7 +60,7 @@ export class MailService {
61
60
  });
62
61
  }
63
62
  async renderTemplate(template, variables) {
64
- const customTemplatePath = path.resolve(getExtensionsPath(), 'templates', template + '.liquid');
63
+ const customTemplatePath = path.resolve(env['EMAIL_TEMPLATES_PATH'], template + '.liquid');
65
64
  const systemTemplatePath = path.join(__dirname, 'templates', template + '.liquid');
66
65
  const templatePath = (await fse.pathExists(customTemplatePath)) ? customTemplatePath : systemTemplatePath;
67
66
  if ((await fse.pathExists(templatePath)) === false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@directus/api",
3
- "version": "18.0.0",
3
+ "version": "18.1.0",
4
4
  "description": "Directus is a real-time API and App dashboard for managing SQL database content",
5
5
  "keywords": [
6
6
  "directus",
@@ -144,28 +144,28 @@
144
144
  "ws": "8.16.0",
145
145
  "zod": "3.22.4",
146
146
  "zod-validation-error": "3.0.3",
147
- "@directus/app": "11.0.0",
148
- "@directus/constants": "11.0.3",
149
- "@directus/env": "1.0.3",
147
+ "@directus/app": "11.0.1",
150
148
  "@directus/errors": "0.2.4",
151
- "@directus/extensions-registry": "1.0.0",
152
- "@directus/extensions": "1.0.0",
153
- "@directus/extensions-sdk": "11.0.0",
149
+ "@directus/env": "1.0.4",
150
+ "@directus/constants": "11.0.3",
151
+ "@directus/extensions": "1.0.1",
154
152
  "@directus/memory": "1.0.4",
155
- "@directus/pressure": "1.0.17",
153
+ "@directus/extensions-registry": "1.0.1",
154
+ "@directus/extensions-sdk": "11.0.1",
156
155
  "@directus/schema": "11.0.1",
157
- "@directus/specs": "10.2.7",
156
+ "@directus/pressure": "1.0.17",
158
157
  "@directus/storage": "10.0.11",
158
+ "@directus/specs": "10.2.7",
159
159
  "@directus/storage-driver-azure": "10.0.18",
160
160
  "@directus/storage-driver-cloudinary": "10.0.18",
161
161
  "@directus/storage-driver-gcs": "10.0.18",
162
162
  "@directus/storage-driver-s3": "10.0.19",
163
163
  "@directus/storage-driver-local": "10.0.18",
164
- "@directus/storage-driver-supabase": "1.0.10",
165
164
  "@directus/system-data": "1.0.1",
166
165
  "@directus/utils": "11.0.6",
167
- "directus": "10.10.0",
168
- "@directus/validation": "0.0.13"
166
+ "@directus/storage-driver-supabase": "1.0.10",
167
+ "@directus/validation": "0.0.13",
168
+ "directus": "10.10.1"
169
169
  },
170
170
  "devDependencies": {
171
171
  "@ngneat/falso": "7.2.0",
@@ -208,8 +208,8 @@
208
208
  "typescript": "5.3.3",
209
209
  "vitest": "1.3.1",
210
210
  "@directus/random": "0.2.7",
211
- "@directus/tsconfig": "1.0.1",
212
- "@directus/types": "11.0.7"
211
+ "@directus/types": "11.0.7",
212
+ "@directus/tsconfig": "1.0.1"
213
213
  },
214
214
  "optionalDependencies": {
215
215
  "@keyv/redis": "2.8.4",