@strapi/strapi 4.0.4 → 4.0.5

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.
@@ -22,7 +22,7 @@ module.exports = async function({ build, watchAdmin, polling, browser }) {
22
22
  const logger = createLogger(config.logger, {});
23
23
 
24
24
  try {
25
- if (cluster.isMaster) {
25
+ if (cluster.isMaster || cluster.isPrimary) {
26
26
  const serveAdminPanel = getOr(true, 'admin.serveAdminPanel')(config);
27
27
 
28
28
  const buildExists = fs.existsSync(path.join(dir, 'build'));
@@ -55,17 +55,6 @@ const applyUserExtension = async plugins => {
55
55
  }
56
56
  };
57
57
 
58
- const formatContentTypes = plugins => {
59
- for (const pluginName in plugins) {
60
- const plugin = plugins[pluginName];
61
- for (const contentTypeName in plugin.contentTypes) {
62
- const ctSchema = plugin.contentTypes[contentTypeName].schema;
63
- ctSchema.plugin = pluginName;
64
- ctSchema.uid = `plugin::${pluginName}.${ctSchema.singularName}`;
65
- }
66
- }
67
- };
68
-
69
58
  const applyUserConfig = async plugins => {
70
59
  const userPluginsConfig = await getUserPluginsConfig();
71
60
 
@@ -111,7 +100,6 @@ const loadPlugins = async strapi => {
111
100
  // TODO: validate plugin format
112
101
  await applyUserConfig(plugins);
113
102
  await applyUserExtension(plugins);
114
- formatContentTypes(plugins);
115
103
 
116
104
  for (const pluginName in plugins) {
117
105
  strapi.container.get('plugins').add(pluginName, plugins[pluginName]);
@@ -3,10 +3,10 @@
3
3
  const os = require('os');
4
4
  const _ = require('lodash');
5
5
  const isDocker = require('is-docker');
6
- const { machineIdSync } = require('node-machine-id');
7
6
  const fetch = require('node-fetch');
8
7
  const ciEnv = require('ci-info');
9
8
  const ee = require('../../utils/ee');
9
+ const machineID = require('../../utils/machine-id');
10
10
  const stringifyDeep = require('./stringify-deep');
11
11
 
12
12
  const defaultQueryOpts = {
@@ -33,7 +33,7 @@ const addPackageJsonStrapiMetadata = (metadata, strapi) => {
33
33
  */
34
34
  module.exports = strapi => {
35
35
  const { uuid } = strapi.config;
36
- const deviceId = machineIdSync();
36
+ const deviceId = machineID();
37
37
  const isEE = strapi.EE === true && ee.isEE === true;
38
38
 
39
39
  const anonymous_metadata = {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const { propOr } = require('lodash/fp');
4
- const { ForbiddenError } = require('@strapi/utils').errors;
4
+ const { PolicyError } = require('@strapi/utils').errors;
5
5
  const { policy: policyUtils } = require('@strapi/utils');
6
6
 
7
7
  const getPoliciesConfig = propOr([], 'config.policies');
@@ -17,7 +17,7 @@ const resolvePolicies = route => {
17
17
  const result = await handler(context, config, { strapi });
18
18
 
19
19
  if (![true, undefined].includes(result)) {
20
- throw new ForbiddenError('Policies failed.');
20
+ throw new PolicyError();
21
21
  }
22
22
  }
23
23
 
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ const { machineIdSync } = require('node-machine-id');
4
+ const uuid = require('uuid');
5
+
6
+ module.exports = () => {
7
+ try {
8
+ const deviceId = machineIdSync();
9
+ return deviceId;
10
+ } catch (error) {
11
+ const deviceId = uuid();
12
+ return deviceId;
13
+ }
14
+ };
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  const fetch = require('node-fetch');
8
- const { machineIdSync } = require('node-machine-id');
8
+ const machineID = require('./machine-id');
9
9
 
10
10
  /*
11
11
  * No need to worry about this file, we only retrieve anonymous data here.
@@ -21,7 +21,7 @@ try {
21
21
  method: 'POST',
22
22
  body: JSON.stringify({
23
23
  event: 'didInstallStrapi',
24
- deviceId: machineIdSync(),
24
+ deviceId: machineID(),
25
25
  }),
26
26
  headers: { 'Content-Type': 'application/json' },
27
27
  }).catch(() => {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/strapi",
3
- "version": "4.0.4",
3
+ "version": "4.0.5",
4
4
  "description": "An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite",
5
5
  "keywords": [
6
6
  "strapi",
@@ -80,16 +80,16 @@
80
80
  "dependencies": {
81
81
  "@koa/cors": "3.1.0",
82
82
  "@koa/router": "10.1.1",
83
- "@strapi/admin": "4.0.4",
84
- "@strapi/database": "4.0.4",
85
- "@strapi/generate-new": "4.0.4",
86
- "@strapi/generators": "4.0.4",
87
- "@strapi/logger": "4.0.4",
88
- "@strapi/plugin-content-manager": "4.0.4",
89
- "@strapi/plugin-content-type-builder": "4.0.4",
90
- "@strapi/plugin-email": "4.0.4",
91
- "@strapi/plugin-upload": "4.0.4",
92
- "@strapi/utils": "4.0.4",
83
+ "@strapi/admin": "4.0.5",
84
+ "@strapi/database": "4.0.5",
85
+ "@strapi/generate-new": "4.0.5",
86
+ "@strapi/generators": "4.0.5",
87
+ "@strapi/logger": "4.0.5",
88
+ "@strapi/plugin-content-manager": "4.0.5",
89
+ "@strapi/plugin-content-type-builder": "4.0.5",
90
+ "@strapi/plugin-email": "4.0.5",
91
+ "@strapi/plugin-upload": "4.0.5",
92
+ "@strapi/utils": "4.0.5",
93
93
  "bcryptjs": "2.4.3",
94
94
  "boxen": "5.1.2",
95
95
  "chalk": "4.1.2",
@@ -126,7 +126,8 @@
126
126
  "qs": "6.10.1",
127
127
  "resolve-cwd": "3.0.0",
128
128
  "semver": "7.3.5",
129
- "statuses": "2.0.1"
129
+ "statuses": "2.0.1",
130
+ "uuid": "^3.3.2"
130
131
  },
131
132
  "devDependencies": {
132
133
  "supertest": "^6.1.6"
@@ -135,5 +136,5 @@
135
136
  "node": ">=12.22.0 <=16.x.x",
136
137
  "npm": ">=6.0.0"
137
138
  },
138
- "gitHead": "d81919ac2272948b3f5d3b25a4cf8cc7b6994460"
139
+ "gitHead": "45020eee065af8917011cc43398f95c4c624d6ad"
139
140
  }