payload 0.15.8 → 0.15.11

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/.eslintrc.js CHANGED
@@ -46,6 +46,13 @@ module.exports = {
46
46
  '@typescript-eslint/no-use-before-define': 'off',
47
47
  },
48
48
  },
49
+ {
50
+ files: ['*.e2e.ts'],
51
+ rules: {
52
+ '@typescript-eslint/no-use-before-define': 'off',
53
+ 'jest/expect-expect': 'off',
54
+ },
55
+ },
49
56
  ],
50
57
  rules: {
51
58
  'no-sparse-arrays': 'off',
package/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## [0.15.11](https://github.com/payloadcms/payload/compare/v0.15.10...v0.15.11) (2022-04-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * improperly typed access control ([b99ec06](https://github.com/payloadcms/payload/commit/b99ec060cacf7a05c20ba0a05dd6ef6ab60df304))
7
+
8
+ ## [0.15.10](https://github.com/payloadcms/payload/compare/v0.15.9...v0.15.10) (2022-04-24)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * block form-data bug ([3b70560](https://github.com/payloadcms/payload/commit/3b70560e2566de5294eb15945120ffd6f1f5f1c4))
14
+
15
+ ## [0.15.9](https://github.com/payloadcms/payload/compare/v0.15.8...v0.15.9) (2022-04-20)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * intermittent blocks UI issue ([3c1dfb8](https://github.com/payloadcms/payload/commit/3c1dfb88df8651b26cb1dbc102a34cd0aad722bc))
21
+
1
22
  ## [0.15.8](https://github.com/payloadcms/payload/compare/v0.15.7...v0.15.8) (2022-04-20)
2
23
 
3
24
 
package/README.md CHANGED
@@ -2,14 +2,18 @@
2
2
  <p align="center">A self-hosted, TypeScript / JavaScript headless CMS & application framework built with Express, MongoDB and React.</p>
3
3
  <p align="center">
4
4
  <a href="https://github.com/payloadcms/payload/actions">
5
- <img src="https://github.com/payloadcms/payload/workflows/build/badge.svg">
5
+ <img src="https://github.com/payloadcms/payload/workflows/build/badge.svg" />
6
6
  </a>
7
7
  <a href="https://www.npmjs.com/package/payload">
8
- <img alt="npm" src="https://img.shields.io/npm/v/payload">
8
+ <img alt="npm" src="https://img.shields.io/npm/v/payload" />
9
9
  </a>
10
10
 
11
11
  <a href="https://twitter.com/intent/tweet?text=Payload%20-%20A%20self-hosted%2C%20headless%20JavaScript%20CMS%20%26%20application%20framework&url=https%3A%2F%2Fgithub.com%2Fpayloadcms%2Fpayload">
12
- <img alt="Tweet Payload" src="https://img.shields.io/twitter/url/http/shields.io.svg?style=social">
12
+ <img alt="Tweet Payload" src="https://img.shields.io/twitter/url/http/shields.io.svg?style=social" />
13
+ </a>
14
+
15
+ <a href="https://discord.com/invite/r6sCXqVk3v">
16
+ <img alt="Discord" src="https://img.shields.io/discord/967097582721572934?label=Discord" />
13
17
  </a>
14
18
  </p>
15
19
 
@@ -63,7 +63,7 @@ const Blocks = (props) => {
63
63
  }, [dispatchRows, dispatchFields, path]);
64
64
  const setCollapse = useCallback(async (rowID, collapsed) => {
65
65
  var _a, _b, _c;
66
- dispatchRows({ type: 'SET_COLLAPSE', rowID, collapsed });
66
+ dispatchRows({ type: 'SET_COLLAPSE', id: rowID, collapsed });
67
67
  if (preferencesKey) {
68
68
  const preferences = await getPreference(preferencesKey);
69
69
  const preferencesToSet = preferences || { fields: {} };
@@ -97,13 +97,15 @@ const Blocks = (props) => {
97
97
  // Get preferences, and once retrieved,
98
98
  // Reset rows with preferences included
99
99
  useEffect(() => {
100
- const fetchPreferences = async () => {
101
- var _a, _b;
102
- const preferences = preferencesKey ? await getPreference(preferencesKey) : undefined;
103
- const data = formContext.getDataByPath(path);
104
- dispatchRows({ type: 'SET_ALL', data: data || [], collapsedState: (_b = (_a = preferences === null || preferences === void 0 ? void 0 : preferences.fields) === null || _a === void 0 ? void 0 : _a[path]) === null || _b === void 0 ? void 0 : _b.collapsed });
105
- };
106
- fetchPreferences();
100
+ const data = formContext.getDataByPath(path);
101
+ if (Array.isArray(data)) {
102
+ const fetchPreferences = async () => {
103
+ var _a, _b;
104
+ const preferences = preferencesKey ? await getPreference(preferencesKey) : undefined;
105
+ dispatchRows({ type: 'SET_ALL', data: data || [], collapsedState: (_b = (_a = preferences === null || preferences === void 0 ? void 0 : preferences.fields) === null || _a === void 0 ? void 0 : _a[path]) === null || _b === void 0 ? void 0 : _b.collapsed });
106
+ };
107
+ fetchPreferences();
108
+ }
107
109
  }, [formContext, path, preferencesKey, getPreference]);
108
110
  // Set row count on mount and when form context is reset
109
111
  useEffect(() => {
@@ -106,7 +106,7 @@ const useField = (options) => {
106
106
  // send it up to the form
107
107
  const valueToSend = enableDebouncedValue ? debouncedValue : internalValue;
108
108
  useEffect(() => {
109
- if ((field === null || field === void 0 ? void 0 : field.value) !== valueToSend && valueToSend !== undefined) {
109
+ if (((field === null || field === void 0 ? void 0 : field.value) !== valueToSend && valueToSend !== undefined) || disableFormData !== (field === null || field === void 0 ? void 0 : field.disableFormData)) {
110
110
  sendField(valueToSend);
111
111
  }
112
112
  }, [
@@ -114,6 +114,7 @@ const useField = (options) => {
114
114
  valueToSend,
115
115
  sendField,
116
116
  field,
117
+ disableFormData,
117
118
  ]);
118
119
  return {
119
120
  ...options,
@@ -60,7 +60,7 @@ export declare type AccessResult = boolean | Where;
60
60
  /**
61
61
  * Access function
62
62
  */
63
- export declare type Access = (args?: any) => AccessResult;
63
+ export declare type Access = (args?: any) => AccessResult | Promise<AccessResult>;
64
64
  export declare type AdminView = React.ComponentType<{
65
65
  user: User;
66
66
  canAccessAdmin: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payload",
3
- "version": "0.15.8",
3
+ "version": "0.15.11",
4
4
  "description": "Node, React and MongoDB Headless CMS and Application Framework",
5
5
  "license": "SEE LICENSE IN license.md",
6
6
  "author": {
@@ -41,6 +41,9 @@
41
41
  "pretest": "yarn build",
42
42
  "test:int": "cross-env PAYLOAD_CONFIG_PATH=demo/payload.config.ts NODE_ENV=test DISABLE_LOGGING=true jest --forceExit --runInBand",
43
43
  "test:client": "cross-env PAYLOAD_CONFIG_PATH=demo/payload.config.ts NODE_ENV=test jest --config=jest.react.config.js",
44
+ "cy:open": "cypress open",
45
+ "cy:run": "cypress run",
46
+ "test:e2e": "DISABLE_LOGGING=true MONGO_URL=mongodb://localhost/payload-integration start-server-and-test dev http-get://localhost:3000/admin cy:run",
44
47
  "clean": "rimraf dist",
45
48
  "release": "release-it",
46
49
  "release:beta": "release-it prepatch --config .release-it.beta.json",
@@ -182,6 +185,7 @@
182
185
  "webpack-hot-middleware": "^2.25.0"
183
186
  },
184
187
  "devDependencies": {
188
+ "@bahmutov/cy-api": "^2.1.3",
185
189
  "@release-it/conventional-changelog": "^2.0.0",
186
190
  "@testing-library/jest-dom": "^5.11.4",
187
191
  "@testing-library/react": "^13.0.1",
@@ -251,6 +255,7 @@
251
255
  "babel-plugin-ignore-html-and-css-imports": "^0.1.0",
252
256
  "copyfiles": "^2.4.0",
253
257
  "cross-env": "^7.0.2",
258
+ "cypress": "9.2.0",
254
259
  "eslint": "^6.8.0",
255
260
  "eslint-plugin-import": "^2.20.0",
256
261
  "eslint-plugin-jest": "^23.16.0",
@@ -267,6 +272,7 @@
267
272
  "release-it": "^14.2.2",
268
273
  "rimraf": "^3.0.2",
269
274
  "serve-static": "^1.14.2",
275
+ "start-server-and-test": "^1.14.0",
270
276
  "typescript": "^4.1.2"
271
277
  },
272
278
  "files": [