directus-template-cli 0.5.0-beta.19 → 0.5.0-beta.20

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.
@@ -102,7 +102,7 @@ class ApplyCommand extends core_1.Command {
102
102
  else {
103
103
  const userEmail = await core_1.ux.prompt('What is your email?');
104
104
  validatedFlags.userEmail = userEmail;
105
- const userPassword = await core_1.ux.prompt('What is your password?');
105
+ const userPassword = await core_1.ux.prompt('What is your password?', { type: 'hide' });
106
106
  validatedFlags.userPassword = userPassword;
107
107
  }
108
108
  await (0, auth_1.initializeDirectusApi)(validatedFlags);
@@ -5,6 +5,7 @@ const core_1 = require("@oclif/core");
5
5
  const constants_1 = require("../constants");
6
6
  const sdk_1 = require("../sdk");
7
7
  const catch_error_1 = tslib_1.__importDefault(require("../utils/catch-error"));
8
+ const get_role_ids_1 = tslib_1.__importDefault(require("../utils/get-role-ids"));
8
9
  const read_file_1 = tslib_1.__importDefault(require("../utils/read-file"));
9
10
  async function loadAccess(dir) {
10
11
  const access = (0, read_file_1.default)('access', dir);
@@ -18,6 +19,7 @@ async function loadAccess(dir) {
18
19
  },
19
20
  path: '/access',
20
21
  }));
22
+ const { legacyAdminRoleId, newAdminRoleId } = await (0, get_role_ids_1.default)(dir);
21
23
  const existingAccessById = new Map(existingAccesses.map(acc => [acc.id, acc]));
22
24
  const existingAccessByCompositeKey = new Map(existingAccesses.map(acc => [getCompositeKey(acc), acc]));
23
25
  for await (const acc of access) {
@@ -33,6 +35,10 @@ async function loadAccess(dir) {
33
35
  if (acc.role === null) {
34
36
  delete acc.role;
35
37
  }
38
+ // If the role is the legacy admin role, update it to the new admin role
39
+ if (acc.role === legacyAdminRoleId) {
40
+ acc.role = newAdminRoleId;
41
+ }
36
42
  await sdk_1.api.client.request(() => ({
37
43
  body: JSON.stringify(acc),
38
44
  method: 'POST',
package/dist/lib/sdk.js CHANGED
@@ -66,7 +66,8 @@ class Api {
66
66
  core_1.ux.log(`${core_1.ux.colorize('dim', '--')} Server under pressure. Retrying after ${delay}ms`);
67
67
  return delay;
68
68
  }
69
- if (statusCode === 400) {
69
+ // If the status code is 400 or 401, we don't want to retry
70
+ if (statusCode === 400 || statusCode === 401) {
70
71
  return;
71
72
  }
72
73
  }
@@ -280,5 +280,5 @@
280
280
  ]
281
281
  }
282
282
  },
283
- "version": "0.5.0-beta.19"
283
+ "version": "0.5.0-beta.20"
284
284
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "directus-template-cli",
3
- "version": "0.5.0-beta.19",
3
+ "version": "0.5.0-beta.20",
4
4
  "description": "CLI Utility for applying templates to a Directus instance.",
5
5
  "author": "bryantgillespie @bryantgillespie",
6
6
  "bin": {