@strapi/strapi 4.5.5 → 4.5.6

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.
package/README.md CHANGED
@@ -80,14 +80,18 @@ Complete installation requirements can be found in the documentation under <a hr
80
80
  - CentOS/RHEL 8
81
81
  - macOS Mojave
82
82
  - Windows 10
83
- - Docker - [Docker-Repo](https://github.com/strapi/strapi-docker)
83
+ - Docker
84
84
 
85
85
  (Please note that Strapi may work on other operating systems, but these are not tested nor officially supported at this time.)
86
86
 
87
87
  **Node:**
88
88
 
89
- - NodeJS >= 14 <= 18
90
- - NPM >= 6.x
89
+ Strapi only supports maintenance and LTS versions of Node.js. Please refer to the <a href="https://nodejs.org/en/about/releases/">Node.js release schedule</a> for more information. NPM versions installed by default with Node.js are supported. Generally it's recommended to use yarn over npm where possible.
90
+
91
+ | Strapi Version | Recommended | Minimum |
92
+ | -------------- | ----------- | ------- |
93
+ | 4.3.9 and up | 18.x | 14.x |
94
+ | 4.0.x to 4.3.8 | 16.x | 14.x |
91
95
 
92
96
  **Database:**
93
97
 
@@ -98,7 +102,7 @@ Complete installation requirements can be found in the documentation under <a hr
98
102
  | PostgreSQL | 11.0 | 14.0 |
99
103
  | SQLite | 3 | 3 |
100
104
 
101
- **We recommend always using the latest version of Strapi to start your new projects**.
105
+ **We recommend always using the latest version of Strapi stable to start your new projects**.
102
106
 
103
107
  ## Features
104
108
 
@@ -21,5 +21,5 @@ export interface CollectionTypeService extends BaseService {
21
21
  export type Service = SingleTypeService | CollectionTypeService;
22
22
 
23
23
  export type GenericService = Partial<Service> & {
24
- [method: string | number | symbol]: <T = any>(...args: any) => T;
24
+ [method: string | number | symbol]: (...args: any) => any;
25
25
  };
@@ -1,6 +1,16 @@
1
1
  'use strict';
2
2
 
3
+ const { propOr } = require('lodash/fp');
4
+
3
5
  const { ValidationError } = require('@strapi/utils').errors;
6
+ const {
7
+ hasDraftAndPublish,
8
+ constants: { PUBLISHED_AT_ATTRIBUTE },
9
+ } = require('@strapi/utils').contentTypes;
10
+
11
+ const setPublishedAt = (data) => {
12
+ data[PUBLISHED_AT_ATTRIBUTE] = propOr(new Date(), PUBLISHED_AT_ATTRIBUTE, data);
13
+ };
4
14
 
5
15
  /**
6
16
  * Returns a single type service to handle default core-api actions
@@ -27,7 +37,7 @@ const createSingleTypeService = ({ contentType }) => {
27
37
  * @return {Promise}
28
38
  */
29
39
  async createOrUpdate({ data, ...params } = {}) {
30
- const entity = await this.find(params);
40
+ const entity = await this.find({ ...params, publicationState: 'preview' });
31
41
 
32
42
  if (!entity) {
33
43
  const count = await strapi.query(uid).count();
@@ -35,6 +45,9 @@ const createSingleTypeService = ({ contentType }) => {
35
45
  throw new ValidationError('singleType.alreadyExists');
36
46
  }
37
47
 
48
+ if (hasDraftAndPublish(contentType)) {
49
+ setPublishedAt(data);
50
+ }
38
51
  return strapi.entityService.create(uid, { ...params, data });
39
52
  }
40
53
 
@@ -30,7 +30,7 @@ type CollectionTypeRouterConfig = {
30
30
 
31
31
  type RouterConfig = {
32
32
  prefix?: string;
33
- only: string[];
33
+ only?: string[];
34
34
  except?: string[];
35
35
  config: SingleTypeRouterConfig | CollectionTypeRouterConfig;
36
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/strapi",
3
- "version": "4.5.5",
3
+ "version": "4.5.6",
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,18 +80,18 @@
80
80
  "dependencies": {
81
81
  "@koa/cors": "3.4.3",
82
82
  "@koa/router": "10.1.1",
83
- "@strapi/admin": "4.5.5",
84
- "@strapi/database": "4.5.5",
85
- "@strapi/generate-new": "4.5.5",
86
- "@strapi/generators": "4.5.5",
87
- "@strapi/logger": "4.5.5",
88
- "@strapi/permissions": "4.5.5",
89
- "@strapi/plugin-content-manager": "4.5.5",
90
- "@strapi/plugin-content-type-builder": "4.5.5",
91
- "@strapi/plugin-email": "4.5.5",
92
- "@strapi/plugin-upload": "4.5.5",
93
- "@strapi/typescript-utils": "4.5.5",
94
- "@strapi/utils": "4.5.5",
83
+ "@strapi/admin": "4.5.6",
84
+ "@strapi/database": "4.5.6",
85
+ "@strapi/generate-new": "4.5.6",
86
+ "@strapi/generators": "4.5.6",
87
+ "@strapi/logger": "4.5.6",
88
+ "@strapi/permissions": "4.5.6",
89
+ "@strapi/plugin-content-manager": "4.5.6",
90
+ "@strapi/plugin-content-type-builder": "4.5.6",
91
+ "@strapi/plugin-email": "4.5.6",
92
+ "@strapi/plugin-upload": "4.5.6",
93
+ "@strapi/typescript-utils": "4.5.6",
94
+ "@strapi/utils": "4.5.6",
95
95
  "bcryptjs": "2.4.3",
96
96
  "boxen": "5.1.2",
97
97
  "chalk": "4.1.2",
@@ -140,5 +140,5 @@
140
140
  "node": ">=14.19.1 <=18.x.x",
141
141
  "npm": ">=6.0.0"
142
142
  },
143
- "gitHead": "8f1988367c1ccbbb1c44866d9dc9fa512e4f3b31"
143
+ "gitHead": "d36609ff26fb4e00a41a7e2b657f16c7466203fe"
144
144
  }