@strapi/strapi 4.10.1 → 4.10.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.
Files changed (131) hide show
  1. package/lib/commands/actions/{build → build-command}/command.js +1 -1
  2. package/lib/commands/actions/develop/action.js +22 -3
  3. package/lib/commands/actions/telemetry/enable/action.js +3 -3
  4. package/lib/commands/index.js +1 -1
  5. package/lib/core/loaders/apis.js +5 -0
  6. package/lib/utils/machine-id.js +2 -2
  7. package/package.json +16 -17
  8. package/coverage/clover.xml +0 -1613
  9. package/coverage/coverage-final.json +0 -48
  10. package/coverage/lcov-report/base.css +0 -224
  11. package/coverage/lcov-report/block-navigation.js +0 -87
  12. package/coverage/lcov-report/commands/__tests__/data-transfer/shared/index.html +0 -116
  13. package/coverage/lcov-report/commands/__tests__/data-transfer/shared/transfer.test.utils.js.html +0 -133
  14. package/coverage/lcov-report/commands/admin-create.js.html +0 -424
  15. package/coverage/lcov-report/commands/admin-reset.js.html +0 -241
  16. package/coverage/lcov-report/commands/generate-template.js.html +0 -373
  17. package/coverage/lcov-report/commands/index.html +0 -146
  18. package/coverage/lcov-report/commands/transfer/export.js.html +0 -619
  19. package/coverage/lcov-report/commands/transfer/import.js.html +0 -562
  20. package/coverage/lcov-report/commands/transfer/index.html +0 -146
  21. package/coverage/lcov-report/commands/transfer/transfer.js.html +0 -532
  22. package/coverage/lcov-report/commands/utils/helpers.js.html +0 -430
  23. package/coverage/lcov-report/commands/utils/index.html +0 -116
  24. package/coverage/lcov-report/core/registries/custom-fields.js.html +0 -301
  25. package/coverage/lcov-report/core/registries/index.html +0 -116
  26. package/coverage/lcov-report/core-api/controller/collection-type.js.html +0 -418
  27. package/coverage/lcov-report/core-api/controller/index.html +0 -161
  28. package/coverage/lcov-report/core-api/controller/index.js.html +0 -220
  29. package/coverage/lcov-report/core-api/controller/single-type.js.html +0 -274
  30. package/coverage/lcov-report/core-api/controller/transform.js.html +0 -376
  31. package/coverage/lcov-report/core-api/service/collection-type.js.html +0 -325
  32. package/coverage/lcov-report/core-api/service/index.html +0 -161
  33. package/coverage/lcov-report/core-api/service/index.js.html +0 -220
  34. package/coverage/lcov-report/core-api/service/pagination.js.html +0 -460
  35. package/coverage/lcov-report/core-api/service/single-type.js.html +0 -301
  36. package/coverage/lcov-report/favicon.png +0 -0
  37. package/coverage/lcov-report/index.html +0 -386
  38. package/coverage/lcov-report/load/filepath-to-prop-path.js.html +0 -151
  39. package/coverage/lcov-report/load/index.html +0 -116
  40. package/coverage/lcov-report/prettify.css +0 -1
  41. package/coverage/lcov-report/prettify.js +0 -2
  42. package/coverage/lcov-report/services/content-api/index.html +0 -116
  43. package/coverage/lcov-report/services/content-api/index.js.html +0 -307
  44. package/coverage/lcov-report/services/content-api/permissions/engine.js.html +0 -100
  45. package/coverage/lcov-report/services/content-api/permissions/index.html +0 -131
  46. package/coverage/lcov-report/services/content-api/permissions/index.js.html +0 -529
  47. package/coverage/lcov-report/services/content-api/permissions/providers/action.js.html +0 -142
  48. package/coverage/lcov-report/services/content-api/permissions/providers/condition.js.html +0 -142
  49. package/coverage/lcov-report/services/content-api/permissions/providers/index.html +0 -146
  50. package/coverage/lcov-report/services/content-api/permissions/providers/index.js.html +0 -112
  51. package/coverage/lcov-report/services/core-store.js.html +0 -520
  52. package/coverage/lcov-report/services/entity-service/attributes/index.html +0 -131
  53. package/coverage/lcov-report/services/entity-service/attributes/index.js.html +0 -178
  54. package/coverage/lcov-report/services/entity-service/attributes/transforms.js.html +0 -145
  55. package/coverage/lcov-report/services/entity-service/components.js.html +0 -1246
  56. package/coverage/lcov-report/services/entity-service/index.html +0 -146
  57. package/coverage/lcov-report/services/entity-service/index.js.html +0 -1120
  58. package/coverage/lcov-report/services/entity-service/params.js.html +0 -112
  59. package/coverage/lcov-report/services/entity-validator/__tests__/relations/utils/index.html +0 -116
  60. package/coverage/lcov-report/services/entity-validator/__tests__/relations/utils/relations.testdata.js.html +0 -544
  61. package/coverage/lcov-report/services/entity-validator/index.html +0 -131
  62. package/coverage/lcov-report/services/entity-validator/index.js.html +0 -1231
  63. package/coverage/lcov-report/services/entity-validator/validators.js.html +0 -733
  64. package/coverage/lcov-report/services/event-hub.js.html +0 -319
  65. package/coverage/lcov-report/services/fs.js.html +0 -259
  66. package/coverage/lcov-report/services/index.html +0 -161
  67. package/coverage/lcov-report/services/metrics/admin-user-hash.js.html +0 -148
  68. package/coverage/lcov-report/services/metrics/index.html +0 -206
  69. package/coverage/lcov-report/services/metrics/index.js.html +0 -265
  70. package/coverage/lcov-report/services/metrics/is-truthy.js.html +0 -112
  71. package/coverage/lcov-report/services/metrics/middleware.js.html +0 -184
  72. package/coverage/lcov-report/services/metrics/rate-limiter.js.html +0 -166
  73. package/coverage/lcov-report/services/metrics/sender.js.html +0 -394
  74. package/coverage/lcov-report/services/metrics/stringify-deep.js.html +0 -151
  75. package/coverage/lcov-report/services/utils/index.html +0 -116
  76. package/coverage/lcov-report/services/utils/upload-files.js.html +0 -322
  77. package/coverage/lcov-report/services/worker-queue.js.html +0 -262
  78. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  79. package/coverage/lcov-report/sorter.js +0 -196
  80. package/coverage/lcov-report/utils/convert-custom-field-type.js.html +0 -151
  81. package/coverage/lcov-report/utils/index.html +0 -146
  82. package/coverage/lcov-report/utils/machine-id.js.html +0 -127
  83. package/coverage/lcov-report/utils/url-from-segments.js.html +0 -121
  84. package/lib/commands/__tests__/commands.test.js +0 -20
  85. package/lib/commands/__tests__/commands.test.utils.js +0 -16
  86. package/lib/commands/actions/admin/create-user/__tests__/admin.create-user.test.js +0 -450
  87. package/lib/commands/actions/admin/reset-user-password/__tests__/admin.reset-user-password.test.js +0 -145
  88. package/lib/commands/actions/export/__tests__/export.test.js +0 -175
  89. package/lib/commands/actions/import/__tests__/import.test.js +0 -143
  90. package/lib/commands/actions/templates/generate/__tests__/templates.generate.js +0 -118
  91. package/lib/commands/actions/transfer/__tests__/transfer.test.js +0 -178
  92. package/lib/core/registries/__tests__/custom-fields.test.js +0 -152
  93. package/lib/core-api/__tests__/controller.test.js +0 -39
  94. package/lib/core-api/controller/__tests__/transform.test.js +0 -226
  95. package/lib/core-api/service/__tests__/index.test.js +0 -127
  96. package/lib/core-api/service/__tests__/pagination.test.js +0 -275
  97. package/lib/load/__tests__/filepath-to-prop-path.test.js +0 -30
  98. package/lib/middlewares/__tests__/errors.test.js +0 -21
  99. package/lib/services/__tests__/content-api-permissions.test.js +0 -291
  100. package/lib/services/__tests__/core-store.test.js +0 -148
  101. package/lib/services/__tests__/event-hub.test.js +0 -126
  102. package/lib/services/__tests__/fs.test.js +0 -78
  103. package/lib/services/__tests__/worker-queue.test.js +0 -47
  104. package/lib/services/entity-service/__tests__/entity-service-events.test.js +0 -117
  105. package/lib/services/entity-service/__tests__/entity-service.test.js +0 -587
  106. package/lib/services/entity-validator/__tests__/biginteger-validators.test.js +0 -220
  107. package/lib/services/entity-validator/__tests__/date-validators.test.js +0 -183
  108. package/lib/services/entity-validator/__tests__/datetime-validators.test.js +0 -183
  109. package/lib/services/entity-validator/__tests__/email-validators.test.js +0 -56
  110. package/lib/services/entity-validator/__tests__/enumeration-validators.test.js +0 -43
  111. package/lib/services/entity-validator/__tests__/float-validators.test.js +0 -278
  112. package/lib/services/entity-validator/__tests__/index.test.js +0 -609
  113. package/lib/services/entity-validator/__tests__/integer-validators.test.js +0 -278
  114. package/lib/services/entity-validator/__tests__/relations/attribute-level.test.js +0 -123
  115. package/lib/services/entity-validator/__tests__/relations/component-level.test.js +0 -275
  116. package/lib/services/entity-validator/__tests__/relations/dynamic-zone-level.test.js +0 -159
  117. package/lib/services/entity-validator/__tests__/relations/media-level.test.js +0 -74
  118. package/lib/services/entity-validator/__tests__/relations/utils/relations.testdata.js +0 -153
  119. package/lib/services/entity-validator/__tests__/string-validators.test.js +0 -374
  120. package/lib/services/entity-validator/__tests__/time-validators.test.js +0 -183
  121. package/lib/services/entity-validator/__tests__/timestamp-validators.test.js +0 -204
  122. package/lib/services/entity-validator/__tests__/uid-validators.test.js +0 -229
  123. package/lib/services/metrics/__tests__/admin-user-hash.test.js +0 -41
  124. package/lib/services/metrics/__tests__/index.test.js +0 -157
  125. package/lib/services/metrics/__tests__/is-truthy.js +0 -33
  126. package/lib/services/metrics/__tests__/middleware.test.js +0 -60
  127. package/lib/services/metrics/__tests__/rate-limiter.test.js +0 -50
  128. package/lib/services/metrics/__tests__/stringify-deep.test.js +0 -27
  129. package/lib/utils/__tests__/convert-custom-field-type.test.js +0 -69
  130. package/lib/utils/__tests__/url-from-segments.test.js +0 -40
  131. /package/lib/commands/actions/{build → build-command}/action.js +0 -0
@@ -11,5 +11,5 @@ module.exports = ({ command }) => {
11
11
  .command('build')
12
12
  .option('--no-optimization', 'Build the admin app without optimizing assets')
13
13
  .description('Build the strapi admin app')
14
- .action(getLocalScript('build'));
14
+ .action(getLocalScript('build-command')); // build-command dir to avoid problems with 'build' being commonly ignored
15
15
  };
@@ -106,12 +106,30 @@ const primaryProcess = async ({ distDir, appDir, build, isTSProject, watchAdmin,
106
106
  cluster.fork();
107
107
  };
108
108
 
109
- const workerProcess = ({ appDir, distDir, watchAdmin, polling, isTSProject }) => {
110
- const strapiInstance = strapi({
109
+ const workerProcess = async ({ appDir, distDir, watchAdmin, polling, isTSProject }) => {
110
+ const strapiInstance = await strapi({
111
111
  distDir,
112
112
  autoReload: true,
113
113
  serveAdminPanel: !watchAdmin,
114
- });
114
+ }).load();
115
+
116
+ /**
117
+ * TypeScript automatic type generation upon dev server restart
118
+ * Its implementation, configuration and behavior can change in future releases
119
+ * @experimental
120
+ */
121
+ const shouldGenerateTypeScriptTypes = strapiInstance.config.get('typescript.autogenerate', false);
122
+
123
+ if (shouldGenerateTypeScriptTypes) {
124
+ // This is run in an uncaught promise on purpose so that it doesn't block Strapi startup
125
+ // NOTE: We should probably add some configuration options to manage the file structure output or the verbosity level
126
+ tsUtils.generators.generateSchemasDefinitions({
127
+ strapi: strapiInstance,
128
+ outDir: appDir,
129
+ verbose: false,
130
+ silent: true,
131
+ });
132
+ }
115
133
 
116
134
  const adminWatchIgnoreFiles = strapiInstance.config.get('admin.watchIgnoreFiles', []);
117
135
  watchFileChanges({
@@ -179,6 +197,7 @@ function watchFileChanges({ appDir, strapiInstance, watchIgnoreFiles, polling })
179
197
  '**/*.db*',
180
198
  '**/exports/**',
181
199
  '**/dist/**',
200
+ '**/*.d.ts',
182
201
  ...watchIgnoreFiles,
183
202
  ],
184
203
  });
@@ -4,7 +4,7 @@ const { resolve } = require('path');
4
4
  const fse = require('fs-extra');
5
5
  const chalk = require('chalk');
6
6
  const fetch = require('node-fetch');
7
- const { v4: uuidv4 } = require('uuid');
7
+ const { randomUUID } = require('crypto');
8
8
  const machineID = require('../../../../utils/machine-id');
9
9
 
10
10
  const readPackageJSON = async (path) => {
@@ -36,7 +36,7 @@ const generateNewPackageJSON = (packageObj) => {
36
36
  return {
37
37
  ...packageObj,
38
38
  strapi: {
39
- uuid: uuidv4(),
39
+ uuid: randomUUID(),
40
40
  telemetryDisabled: false,
41
41
  },
42
42
  };
@@ -45,7 +45,7 @@ const generateNewPackageJSON = (packageObj) => {
45
45
  ...packageObj,
46
46
  strapi: {
47
47
  ...packageObj.strapi,
48
- uuid: packageObj.strapi.uuid ? packageObj.strapi.uuid : uuidv4(),
48
+ uuid: packageObj.strapi.uuid ? packageObj.strapi.uuid : randomUUID(),
49
49
  telemetryDisabled: false,
50
50
  },
51
51
  };
@@ -5,7 +5,7 @@ const { Command } = require('commander');
5
5
  const strapiCommands = {
6
6
  'admin/create-user': require('./actions/admin/create-user/command'),
7
7
  'admin/reset-user-password': require('./actions/admin/reset-user-password/command'),
8
- build: require('./actions/build/command'),
8
+ build: require('./actions/build-command/command'), // in 'build-command' to avoid problems with 'build' being commonly ignored
9
9
  'configuration/dump': require('./actions/configuration/dump/command'),
10
10
  'configuration/restore': require('./actions/configuration/restore/command'),
11
11
  console: require('./actions/console/command'),
@@ -5,6 +5,7 @@ const { existsSync } = require('fs-extra');
5
5
  const _ = require('lodash');
6
6
  const fse = require('fs-extra');
7
7
  const { isKebabCase, importDefault } = require('@strapi/utils');
8
+ const { isEmpty } = require('lodash/fp');
8
9
 
9
10
  const DEFAULT_CONTENT_TYPE = {
10
11
  schema: {},
@@ -115,6 +116,10 @@ const loadContentTypes = async (dir) => {
115
116
  const contentTypeName = normalizeName(fd.name);
116
117
  const contentType = await loadDir(join(dir, fd.name));
117
118
 
119
+ if (isEmpty(contentType) || isEmpty(contentType.schema)) {
120
+ throw new Error(`Could not load content type found at ${dir}`);
121
+ }
122
+
118
123
  contentTypes[normalizeName(contentTypeName)] = _.defaults(contentType, DEFAULT_CONTENT_TYPE);
119
124
  }
120
125
 
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
3
  const { machineIdSync } = require('node-machine-id');
4
- const { v4: uuidv4 } = require('uuid');
4
+ const { randomUUID } = require('crypto');
5
5
 
6
6
  module.exports = () => {
7
7
  try {
8
8
  const deviceId = machineIdSync();
9
9
  return deviceId;
10
10
  } catch (error) {
11
- const deviceId = uuidv4();
11
+ const deviceId = randomUUID();
12
12
  return deviceId;
13
13
  }
14
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/strapi",
3
- "version": "4.10.1",
3
+ "version": "4.10.2",
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",
@@ -81,19 +81,19 @@
81
81
  "dependencies": {
82
82
  "@koa/cors": "3.4.3",
83
83
  "@koa/router": "10.1.1",
84
- "@strapi/admin": "4.10.1",
85
- "@strapi/data-transfer": "4.10.1",
86
- "@strapi/database": "4.10.1",
87
- "@strapi/generate-new": "4.10.1",
88
- "@strapi/generators": "4.10.1",
89
- "@strapi/logger": "4.10.1",
90
- "@strapi/permissions": "4.10.1",
91
- "@strapi/plugin-content-manager": "4.10.1",
92
- "@strapi/plugin-content-type-builder": "4.10.1",
93
- "@strapi/plugin-email": "4.10.1",
94
- "@strapi/plugin-upload": "4.10.1",
95
- "@strapi/typescript-utils": "4.10.1",
96
- "@strapi/utils": "4.10.1",
84
+ "@strapi/admin": "4.10.2",
85
+ "@strapi/data-transfer": "4.10.2",
86
+ "@strapi/database": "4.10.2",
87
+ "@strapi/generate-new": "4.10.2",
88
+ "@strapi/generators": "4.10.2",
89
+ "@strapi/logger": "4.10.2",
90
+ "@strapi/permissions": "4.10.2",
91
+ "@strapi/plugin-content-manager": "4.10.2",
92
+ "@strapi/plugin-content-type-builder": "4.10.2",
93
+ "@strapi/plugin-email": "4.10.2",
94
+ "@strapi/plugin-upload": "4.10.2",
95
+ "@strapi/typescript-utils": "4.10.2",
96
+ "@strapi/utils": "4.10.2",
97
97
  "bcryptjs": "2.4.3",
98
98
  "boxen": "5.1.2",
99
99
  "chalk": "4.1.2",
@@ -132,8 +132,7 @@
132
132
  "qs": "6.11.1",
133
133
  "resolve-cwd": "3.0.0",
134
134
  "semver": "7.3.8",
135
- "statuses": "2.0.1",
136
- "uuid": "^8.3.2"
135
+ "statuses": "2.0.1"
137
136
  },
138
137
  "devDependencies": {
139
138
  "supertest": "6.3.3",
@@ -143,5 +142,5 @@
143
142
  "node": ">=14.19.1 <=18.x.x",
144
143
  "npm": ">=6.0.0"
145
144
  },
146
- "gitHead": "23b531cef55c1583ea7d526b2baf2340a3129dad"
145
+ "gitHead": "a02b19866a3bcc1f30c2395698afae6e9c3e0515"
147
146
  }