directus 9.5.1 → 9.5.2

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.
@@ -91,12 +91,12 @@ class OpenIDAuthDriver extends local_1.LocalAuthDriver {
91
91
  try {
92
92
  const client = await this.client;
93
93
  tokenSet = await client.callback(this.redirectUrl, { code: payload.code, state: payload.state }, { code_verifier: payload.codeVerifier, state: openid_client_1.generators.codeChallenge(payload.codeVerifier) });
94
- const issuer = client.issuer;
95
- if (issuer.metadata.userinfo_endpoint) {
96
- userInfo = await client.userinfo(tokenSet.access_token);
97
- }
98
- else {
99
- userInfo = tokenSet.claims();
94
+ userInfo = tokenSet.claims();
95
+ if (client.issuer.metadata.userinfo_endpoint) {
96
+ userInfo = {
97
+ ...userInfo,
98
+ ...(await client.userinfo(tokenSet.access_token)),
99
+ };
100
100
  }
101
101
  }
102
102
  catch (e) {
@@ -8,6 +8,7 @@ const execa_1 = __importDefault(require("execa"));
8
8
  const inquirer_1 = __importDefault(require("inquirer"));
9
9
  const ora_1 = __importDefault(require("ora"));
10
10
  const uuid_1 = require("uuid");
11
+ const joi_1 = __importDefault(require("joi"));
11
12
  const run_1 = __importDefault(require("../../../database/migrations/run"));
12
13
  const run_2 = __importDefault(require("../../../database/seeds/run"));
13
14
  const create_db_connection_1 = __importDefault(require("../../utils/create-db-connection"));
@@ -62,6 +63,13 @@ async function init() {
62
63
  name: 'email',
63
64
  message: 'Email',
64
65
  default: 'admin@example.com',
66
+ validate: (input) => {
67
+ const emailSchema = joi_1.default.string().email().required();
68
+ const { error } = emailSchema.validate(input);
69
+ if (error)
70
+ throw new Error('The email entered is not a valid email address!');
71
+ return true;
72
+ },
65
73
  },
66
74
  {
67
75
  type: 'password',
@@ -62,14 +62,20 @@
62
62
  permissions:
63
63
  recipient:
64
64
  _eq: $CURRENT_USER
65
- fields: '*'
66
65
 
67
66
  - collection: directus_notifications
68
67
  action: update
69
68
  permissions:
70
69
  recipient:
71
70
  _eq: $CURRENT_USER
72
- fields: 'status'
71
+ fields:
72
+ - status
73
+
74
+ - collection: directus_shares
75
+ action: read
76
+ permissions:
77
+ user_created:
78
+ _eq: $CURRENT_USER
73
79
 
74
80
  - collection: directus_users
75
81
  action: read
@@ -156,6 +156,8 @@ fields:
156
156
  - decimal
157
157
  - integer
158
158
  allowNone: true
159
+ allowPrimaryKey: false
160
+ allowForeignKeys: false
159
161
  width: half
160
162
 
161
163
  - field: accountability_divider
@@ -316,7 +316,9 @@ class CollectionsService {
316
316
  }
317
317
  await this.knex.transaction(async (trx) => {
318
318
  var _a;
319
- await trx.schema.dropTable(collectionKey);
319
+ if (collectionToBeDeleted.schema) {
320
+ await trx.schema.dropTable(collectionKey);
321
+ }
320
322
  // Make sure this collection isn't used as a group in any other collections
321
323
  await trx('directus_collections').update({ group: null }).where({ group: collectionKey });
322
324
  if (collectionToBeDeleted.meta) {
@@ -406,7 +406,7 @@ class FieldsService {
406
406
  });
407
407
  }
408
408
  addColumnToTable(table, field, alter = null) {
409
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
409
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
410
410
  let column;
411
411
  // Don't attempt to add a DB column for alias / corrupt fields
412
412
  if (field.type === 'alias' || field.type === 'unknown')
@@ -457,20 +457,20 @@ class FieldsService {
457
457
  column.notNullable();
458
458
  }
459
459
  }
460
- else if (((_h = field.schema) === null || _h === void 0 ? void 0 : _h.is_nullable) === true) {
460
+ else {
461
461
  if (!alter || alter.is_nullable === false) {
462
462
  column.nullable();
463
463
  }
464
464
  }
465
- if ((_j = field.schema) === null || _j === void 0 ? void 0 : _j.is_primary_key) {
465
+ if ((_h = field.schema) === null || _h === void 0 ? void 0 : _h.is_primary_key) {
466
466
  column.primary().notNullable();
467
467
  }
468
- else if (((_k = field.schema) === null || _k === void 0 ? void 0 : _k.is_unique) === true) {
468
+ else if (((_j = field.schema) === null || _j === void 0 ? void 0 : _j.is_unique) === true) {
469
469
  if (!alter || alter.is_unique === false) {
470
470
  column.unique();
471
471
  }
472
472
  }
473
- else if (((_l = field.schema) === null || _l === void 0 ? void 0 : _l.is_unique) === false) {
473
+ else if (((_k = field.schema) === null || _k === void 0 ? void 0 : _k.is_unique) === false) {
474
474
  if (alter && alter.is_unique === true) {
475
475
  table.dropUnique([field.field]);
476
476
  }
@@ -135,6 +135,10 @@ class RelationsService {
135
135
  if (relation.field in this.schema.collections[relation.collection].fields === false) {
136
136
  throw new exceptions_1.InvalidPayloadException(`Field "${relation.field}" doesn't exist in collection "${relation.collection}"`);
137
137
  }
138
+ // A primary key should not be a foreign key
139
+ if (this.schema.collections[relation.collection].primary === relation.field) {
140
+ throw new exceptions_1.InvalidPayloadException(`Field "${relation.field}" in collection "${relation.collection}" is a primary key`);
141
+ }
138
142
  if (relation.related_collection && relation.related_collection in this.schema.collections === false) {
139
143
  throw new exceptions_1.InvalidPayloadException(`Collection "${relation.related_collection}" doesn't exist`);
140
144
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "directus",
3
- "version": "9.5.1",
3
+ "version": "9.5.2",
4
4
  "license": "GPL-3.0-only",
5
5
  "homepage": "https://github.com/directus/directus#readme",
6
6
  "description": "Directus is a real-time API and App dashboard for managing SQL database content.",
@@ -78,18 +78,18 @@
78
78
  ],
79
79
  "dependencies": {
80
80
  "@aws-sdk/client-ses": "^3.40.0",
81
- "@directus/app": "9.5.1",
82
- "@directus/drive": "9.5.1",
83
- "@directus/drive-azure": "9.5.1",
84
- "@directus/drive-gcs": "9.5.1",
85
- "@directus/drive-s3": "9.5.1",
86
- "@directus/extensions-sdk": "9.5.1",
87
- "@directus/format-title": "9.5.1",
88
- "@directus/schema": "9.5.1",
89
- "@directus/shared": "9.5.1",
90
- "@directus/specs": "9.5.1",
81
+ "@directus/app": "9.5.2",
82
+ "@directus/drive": "9.5.2",
83
+ "@directus/drive-azure": "9.5.2",
84
+ "@directus/drive-gcs": "9.5.2",
85
+ "@directus/drive-s3": "9.5.2",
86
+ "@directus/extensions-sdk": "9.5.2",
87
+ "@directus/format-title": "9.5.2",
88
+ "@directus/schema": "9.5.2",
89
+ "@directus/shared": "9.5.2",
90
+ "@directus/specs": "9.5.2",
91
91
  "@godaddy/terminus": "^4.9.0",
92
- "@rollup/plugin-alias": "^3.1.2",
92
+ "@rollup/plugin-alias": "^3.1.9",
93
93
  "@rollup/plugin-virtual": "^2.0.3",
94
94
  "argon2": "^0.28.2",
95
95
  "async": "^3.2.0",
@@ -149,7 +149,7 @@
149
149
  "qs": "^6.9.4",
150
150
  "rate-limiter-flexible": "^2.2.2",
151
151
  "resolve-cwd": "^3.0.0",
152
- "rollup": "^2.52.1",
152
+ "rollup": "^2.67.3",
153
153
  "sanitize-html": "^2.6.0",
154
154
  "sharp": "^0.29.0",
155
155
  "stream-json": "^1.7.1",
@@ -173,7 +173,7 @@
173
173
  "sqlite3": "^5.0.2",
174
174
  "tedious": "^13.0.0"
175
175
  },
176
- "gitHead": "c0c412d30b116bd38a2690b62463f775d37db79c",
176
+ "gitHead": "47a5da78fb5e31d1657c25103adcb63542396b61",
177
177
  "devDependencies": {
178
178
  "@types/async": "3.2.10",
179
179
  "@types/atob": "2.1.2",