payload 1.0.8 → 1.0.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/README.md +5 -2
- package/dist/admin/components/forms/Form/index.js +1 -1
- package/dist/admin/components/forms/field-types/Array/Array.js +14 -10
- package/dist/admin/components/forms/field-types/Blocks/Blocks.js +14 -9
- package/dist/admin/components/forms/field-types/Collapsible/index.js +14 -4
- package/dist/admin/components/forms/field-types/Number/index.js +5 -1
- package/dist/admin/components/forms/field-types/RadioGroup/RadioInput/index.scss +4 -4
- package/dist/admin/components/forms/useField/index.js +2 -1
- package/dist/admin/components/utilities/DocumentInfo/index.js +1 -4
- package/dist/admin/components/utilities/DocumentInfo/types.d.ts +0 -2
- package/dist/admin/components/utilities/Preferences/index.d.ts +2 -2
- package/dist/admin/components/views/Account/index.js +8 -5
- package/dist/admin/components/views/Global/index.js +8 -5
- package/dist/admin/components/views/collections/Edit/index.js +7 -4
- package/dist/admin/components/views/collections/List/index.js +1 -1
- package/dist/admin/scss/app.scss +1 -1
- package/dist/auth/graphql/resolvers/refresh.js +2 -2
- package/dist/auth/operations/local/forgotPassword.js +10 -6
- package/dist/auth/operations/local/login.js +13 -9
- package/dist/auth/operations/local/resetPassword.js +11 -7
- package/dist/auth/operations/local/unlock.js +11 -7
- package/dist/auth/operations/login.js +2 -2
- package/dist/auth/strategies/jwt.js +5 -26
- package/dist/auth/types.d.ts +4 -3
- package/dist/auth/types.js +1 -1
- package/dist/bin/generateGraphQLSchema.js +2 -2
- package/dist/collections/config/schema.js +13 -5
- package/dist/collections/dataloader.d.ts +4 -0
- package/dist/collections/dataloader.js +90 -0
- package/dist/collections/graphql/init.js +2 -2
- package/dist/collections/init.js +4 -3
- package/dist/collections/operations/find.d.ts +2 -0
- package/dist/collections/operations/find.js +25 -9
- package/dist/collections/operations/local/create.js +17 -13
- package/dist/collections/operations/local/delete.js +12 -8
- package/dist/collections/operations/local/find.d.ts +4 -0
- package/dist/collections/operations/local/find.js +19 -10
- package/dist/collections/operations/local/findByID.js +11 -8
- package/dist/collections/operations/local/findVersionByID.js +13 -9
- package/dist/collections/operations/local/findVersions.js +12 -8
- package/dist/collections/operations/local/restoreVersion.js +12 -8
- package/dist/collections/operations/local/update.js +15 -11
- package/dist/express/middleware/authenticate.js +3 -3
- package/dist/express/types.d.ts +3 -0
- package/dist/fields/hooks/afterRead/relationshipPopulationPromise.js +13 -13
- package/dist/globals/operations/local/findOne.js +12 -8
- package/dist/globals/operations/local/findVersionByID.js +12 -8
- package/dist/globals/operations/local/findVersions.js +12 -8
- package/dist/globals/operations/local/restoreVersion.js +12 -8
- package/dist/globals/operations/local/update.js +12 -8
- package/dist/graphql/schema/buildObjectType.js +39 -84
- package/dist/init.js +6 -1
- package/dist/mongoose/buildSchema.js +4 -1
- package/dist/mongoose/sanitizeFormattedValue.js +2 -2
- package/docs/access-control/collections.mdx +3 -5
- package/docs/authentication/config.mdx +14 -0
- package/docs/graphql/graphql-schema.mdx +1 -1
- package/package.json +8 -3
package/README.md
CHANGED
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
|
|
49
49
|
Payload is a CMS that has been designed for developers from the ground up to deliver them what they need to build great digital products. If you know JavaScript, you know Payload. It's a _code-first_ CMS, which allows us to do a lot of things right:
|
|
50
50
|
|
|
51
|
-
- Payload gives you everything you need, but then steps back and lets you build what you want in JavaScript or TypeScript - with no unnecessary complexity brought by GUIs. You'll understand how your CMS works
|
|
51
|
+
- Payload gives you everything you need, but then steps back and lets you build what you want in JavaScript or TypeScript - with no unnecessary complexity brought by GUIs. You'll understand how your CMS works because you will have written it exactly how you want it.
|
|
52
52
|
- Bring your own Express server and do whatever you need on top of Payload. Payload doesn't impose anything on you or your app.
|
|
53
53
|
- Completely control the Admin panel by using your own React components. Swap out fields or even entire views with ease.
|
|
54
|
-
- Use your data however and wherever you need thanks to auto-generated, yet fully extensible REST, GraphQL and Local Node APIs.
|
|
54
|
+
- Use your data however and wherever you need thanks to auto-generated, yet fully extensible REST, GraphQL, and Local Node APIs.
|
|
55
55
|
|
|
56
56
|
### Quick Start
|
|
57
57
|
|
|
@@ -68,6 +68,9 @@ Alternatively, it only takes about five minutes to [create an app from scratch](
|
|
|
68
68
|
### Documentation
|
|
69
69
|
|
|
70
70
|
Check out the [Payload website](https://payloadcms.com/docs/getting-started/what-is-payload) to find in-depth documentation for everything that Payload offers.
|
|
71
|
+
### Contributing
|
|
72
|
+
|
|
73
|
+
If you want to add contributions to this repository, please follow the instructions in [contributing.md](./contributing.md).
|
|
71
74
|
|
|
72
75
|
### Other Resources
|
|
73
76
|
|
|
@@ -24,7 +24,7 @@ const baseClass = 'form';
|
|
|
24
24
|
const Form = (props) => {
|
|
25
25
|
const { disabled, onSubmit, method, action, handleResponse, onSuccess, children, className, redirect, disableSuccessStatus, initialState, // fully formed initial field state
|
|
26
26
|
initialData, // values only, paths are required as key - form should build initial state as convenience
|
|
27
|
-
waitForAutocomplete,
|
|
27
|
+
waitForAutocomplete, } = props;
|
|
28
28
|
const history = useHistory();
|
|
29
29
|
const locale = useLocale();
|
|
30
30
|
const { refreshCookie, user } = useAuth();
|
|
@@ -38,7 +38,8 @@ const ArrayFieldType = (props) => {
|
|
|
38
38
|
const labels = getLabels(props);
|
|
39
39
|
// eslint-disable-next-line react/destructuring-assignment
|
|
40
40
|
const label = (_a = props === null || props === void 0 ? void 0 : props.label) !== null && _a !== void 0 ? _a : (_b = props === null || props === void 0 ? void 0 : props.labels) === null || _b === void 0 ? void 0 : _b.singular;
|
|
41
|
-
const { preferencesKey
|
|
41
|
+
const { preferencesKey } = useDocumentInfo();
|
|
42
|
+
const { getPreference } = usePreferences();
|
|
42
43
|
const { setPreference } = usePreferences();
|
|
43
44
|
const [rows, dispatchRows] = useReducer(reducer, undefined);
|
|
44
45
|
const formContext = useForm();
|
|
@@ -59,7 +60,6 @@ const ArrayFieldType = (props) => {
|
|
|
59
60
|
});
|
|
60
61
|
const addRow = useCallback(async (rowIndex) => {
|
|
61
62
|
const subFieldState = await buildStateFromSchema({ fieldSchema: fields, operation, id, user, locale });
|
|
62
|
-
console.log(subFieldState);
|
|
63
63
|
dispatchFields({ type: 'ADD_ROW', rowIndex, subFieldState, path });
|
|
64
64
|
dispatchRows({ type: 'ADD', rowIndex });
|
|
65
65
|
setValue(value + 1);
|
|
@@ -95,7 +95,7 @@ const ArrayFieldType = (props) => {
|
|
|
95
95
|
var _a, _b, _c;
|
|
96
96
|
dispatchRows({ type: 'SET_COLLAPSE', id: rowID, collapsed });
|
|
97
97
|
if (preferencesKey) {
|
|
98
|
-
const preferencesToSet =
|
|
98
|
+
const preferencesToSet = await getPreference(preferencesKey) || { fields: {} };
|
|
99
99
|
let newCollapsedState = ((_b = (_a = preferencesToSet === null || preferencesToSet === void 0 ? void 0 : preferencesToSet.fields) === null || _a === void 0 ? void 0 : _a[path]) === null || _b === void 0 ? void 0 : _b.collapsed.filter((filterID) => (rows.find((row) => row.id === filterID))))
|
|
100
100
|
|| [];
|
|
101
101
|
if (!collapsed) {
|
|
@@ -115,12 +115,12 @@ const ArrayFieldType = (props) => {
|
|
|
115
115
|
},
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
}, [preferencesKey,
|
|
118
|
+
}, [preferencesKey, path, setPreference, rows, getPreference]);
|
|
119
119
|
const toggleCollapseAll = useCallback(async (collapse) => {
|
|
120
120
|
var _a;
|
|
121
121
|
dispatchRows({ type: 'SET_ALL_COLLAPSED', collapse });
|
|
122
122
|
if (preferencesKey) {
|
|
123
|
-
const preferencesToSet =
|
|
123
|
+
const preferencesToSet = await getPreference(preferencesKey) || { fields: {} };
|
|
124
124
|
setPreference(preferencesKey, {
|
|
125
125
|
...preferencesToSet,
|
|
126
126
|
fields: {
|
|
@@ -132,12 +132,16 @@ const ArrayFieldType = (props) => {
|
|
|
132
132
|
},
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
|
-
}, [path,
|
|
135
|
+
}, [path, getPreference, preferencesKey, rows, setPreference]);
|
|
136
136
|
useEffect(() => {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
const initializeRowState = async () => {
|
|
138
|
+
var _a, _b;
|
|
139
|
+
const data = formContext.getDataByPath(path);
|
|
140
|
+
const preferences = await getPreference(preferencesKey) || { fields: {} };
|
|
141
|
+
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 });
|
|
142
|
+
};
|
|
143
|
+
initializeRowState();
|
|
144
|
+
}, [formContext, path, getPreference, preferencesKey]);
|
|
141
145
|
useEffect(() => {
|
|
142
146
|
setValue((rows === null || rows === void 0 ? void 0 : rows.length) || 0, true);
|
|
143
147
|
if ((rows === null || rows === void 0 ? void 0 : rows.length) === 0) {
|
|
@@ -34,7 +34,8 @@ const labelDefaults = {
|
|
|
34
34
|
const Blocks = (props) => {
|
|
35
35
|
const { label, name, path: pathFromProps, blocks, labels = labelDefaults, fieldTypes, maxRows, minRows, required, validate = blocksValidator, permissions, admin: { readOnly, description, condition, className, }, } = props;
|
|
36
36
|
const path = pathFromProps || name;
|
|
37
|
-
const { preferencesKey
|
|
37
|
+
const { preferencesKey } = useDocumentInfo();
|
|
38
|
+
const { getPreference } = usePreferences();
|
|
38
39
|
const { setPreference } = usePreferences();
|
|
39
40
|
const [rows, dispatchRows] = useReducer(reducer, undefined);
|
|
40
41
|
const formContext = useForm();
|
|
@@ -97,7 +98,7 @@ const Blocks = (props) => {
|
|
|
97
98
|
var _a, _b, _c;
|
|
98
99
|
dispatchRows({ type: 'SET_COLLAPSE', id: rowID, collapsed });
|
|
99
100
|
if (preferencesKey) {
|
|
100
|
-
const preferencesToSet =
|
|
101
|
+
const preferencesToSet = await getPreference(preferencesKey) || { fields: {} };
|
|
101
102
|
let newCollapsedState = ((_b = (_a = preferencesToSet === null || preferencesToSet === void 0 ? void 0 : preferencesToSet.fields) === null || _a === void 0 ? void 0 : _a[path]) === null || _b === void 0 ? void 0 : _b.collapsed.filter((filterID) => (rows.find((row) => row.id === filterID))))
|
|
102
103
|
|| [];
|
|
103
104
|
if (!collapsed) {
|
|
@@ -117,12 +118,12 @@ const Blocks = (props) => {
|
|
|
117
118
|
},
|
|
118
119
|
});
|
|
119
120
|
}
|
|
120
|
-
}, [preferencesKey,
|
|
121
|
+
}, [preferencesKey, getPreference, path, setPreference, rows]);
|
|
121
122
|
const toggleCollapseAll = useCallback(async (collapse) => {
|
|
122
123
|
var _a;
|
|
123
124
|
dispatchRows({ type: 'SET_ALL_COLLAPSED', collapse });
|
|
124
125
|
if (preferencesKey) {
|
|
125
|
-
const preferencesToSet =
|
|
126
|
+
const preferencesToSet = await getPreference(preferencesKey) || { fields: {} };
|
|
126
127
|
setPreference(preferencesKey, {
|
|
127
128
|
...preferencesToSet,
|
|
128
129
|
fields: {
|
|
@@ -134,13 +135,17 @@ const Blocks = (props) => {
|
|
|
134
135
|
},
|
|
135
136
|
});
|
|
136
137
|
}
|
|
137
|
-
}, [
|
|
138
|
+
}, [getPreference, path, preferencesKey, rows, setPreference]);
|
|
138
139
|
// Set row count on mount and when form context is reset
|
|
139
140
|
useEffect(() => {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
const initializeRowState = async () => {
|
|
142
|
+
var _a, _b;
|
|
143
|
+
const data = formContext.getDataByPath(path);
|
|
144
|
+
const preferences = await getPreference(preferencesKey) || { fields: {} };
|
|
145
|
+
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 });
|
|
146
|
+
};
|
|
147
|
+
initializeRowState();
|
|
148
|
+
}, [formContext, path, getPreference, preferencesKey]);
|
|
144
149
|
useEffect(() => {
|
|
145
150
|
setValue((rows === null || rows === void 0 ? void 0 : rows.length) || 0, true);
|
|
146
151
|
if ((rows === null || rows === void 0 ? void 0 : rows.length) === 0) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useState } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import RenderFields from '../../RenderFields';
|
|
3
3
|
import withCondition from '../../withCondition';
|
|
4
4
|
import { fieldAffectsData } from '../../../../../fields/config/types';
|
|
@@ -10,10 +10,10 @@ import FieldDescription from '../../FieldDescription';
|
|
|
10
10
|
import './index.scss';
|
|
11
11
|
const baseClass = 'collapsible-field';
|
|
12
12
|
const CollapsibleField = (props) => {
|
|
13
|
-
var _a;
|
|
14
13
|
const { label, fields, fieldTypes, path, permissions, admin: { readOnly, className, description, }, } = props;
|
|
15
14
|
const { getPreference, setPreference } = usePreferences();
|
|
16
|
-
const { preferencesKey
|
|
15
|
+
const { preferencesKey } = useDocumentInfo();
|
|
16
|
+
const [initCollapsed, setInitCollapsed] = useState();
|
|
17
17
|
const [fieldPreferencesKey] = useState(() => `collapsible-${toKebabCase(label)}`);
|
|
18
18
|
const onToggle = useCallback(async (newCollapsedState) => {
|
|
19
19
|
var _a;
|
|
@@ -29,8 +29,18 @@ const CollapsibleField = (props) => {
|
|
|
29
29
|
},
|
|
30
30
|
});
|
|
31
31
|
}, [preferencesKey, fieldPreferencesKey, getPreference, setPreference]);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const fetchInitialState = async () => {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
const preferences = await getPreference(preferencesKey);
|
|
36
|
+
setInitCollapsed(Boolean((_b = (_a = preferences === null || preferences === void 0 ? void 0 : preferences.fields) === null || _a === void 0 ? void 0 : _a[fieldPreferencesKey]) === null || _b === void 0 ? void 0 : _b.collapsed));
|
|
37
|
+
};
|
|
38
|
+
fetchInitialState();
|
|
39
|
+
}, [getPreference, preferencesKey, fieldPreferencesKey]);
|
|
40
|
+
if (typeof initCollapsed !== 'boolean')
|
|
41
|
+
return null;
|
|
32
42
|
return (React.createElement(React.Fragment, null,
|
|
33
|
-
React.createElement(Collapsible, { initCollapsed:
|
|
43
|
+
React.createElement(Collapsible, { initCollapsed: initCollapsed, className: [
|
|
34
44
|
'field-type',
|
|
35
45
|
baseClass,
|
|
36
46
|
className,
|
|
@@ -40,7 +40,11 @@ const NumberField = (props) => {
|
|
|
40
40
|
} },
|
|
41
41
|
React.createElement(Error, { showError: showError, message: errorMessage }),
|
|
42
42
|
React.createElement(Label, { htmlFor: `field-${path.replace(/\./gi, '__')}`, label: label, required: required }),
|
|
43
|
-
React.createElement("input", { id: `field-${path.replace(/\./gi, '__')}`, value: typeof value === 'number' ? value : '', onChange: handleChange, disabled: readOnly, placeholder: placeholder, type: "number", name: path, step: step
|
|
43
|
+
React.createElement("input", { id: `field-${path.replace(/\./gi, '__')}`, value: typeof value === 'number' ? value : '', onChange: handleChange, disabled: readOnly, placeholder: placeholder, type: "number", name: path, step: step, onWheel: (e) => {
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
e.target.blur();
|
|
47
|
+
} }),
|
|
44
48
|
React.createElement(FieldDescription, { value: value, description: description })));
|
|
45
49
|
};
|
|
46
50
|
export default withCondition(NumberField);
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
border-radius: 50%;
|
|
21
21
|
|
|
22
22
|
&:before {
|
|
23
|
-
content:
|
|
23
|
+
content: " ";
|
|
24
24
|
display: block;
|
|
25
25
|
border-radius: 100%;
|
|
26
26
|
background-color: var(--theme-elevation-800);
|
|
27
|
-
width: 100
|
|
28
|
-
height: 100
|
|
29
|
-
|
|
27
|
+
width: calc(100% - 10px);
|
|
28
|
+
height: calc(100% - 10px);
|
|
29
|
+
border: 5px solid var(--theme-elevation-0);
|
|
30
30
|
opacity: 0;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -17,7 +17,7 @@ const useField = (options) => {
|
|
|
17
17
|
// Get field by path
|
|
18
18
|
const field = getField(path);
|
|
19
19
|
const initialValue = field === null || field === void 0 ? void 0 : field.initialValue;
|
|
20
|
-
const [internalValue, setInternalValue] = useState(field === null || field === void 0 ? void 0 : field.value);
|
|
20
|
+
const [internalValue, setInternalValue] = useState(() => field === null || field === void 0 ? void 0 : field.value);
|
|
21
21
|
const [internallyValid, setInternallyValid] = useState(undefined);
|
|
22
22
|
// Debounce internal values to update form state only every 60ms
|
|
23
23
|
const debouncedValue = useDebounce(internalValue, 120);
|
|
@@ -95,6 +95,7 @@ const useField = (options) => {
|
|
|
95
95
|
modified,
|
|
96
96
|
]);
|
|
97
97
|
useEffect(() => {
|
|
98
|
+
setInternalValue(initialValue);
|
|
98
99
|
setInternallyValid(undefined);
|
|
99
100
|
}, [initialValue]);
|
|
100
101
|
// The only time that the FORM value should be updated
|
|
@@ -6,7 +6,6 @@ const Context = createContext({});
|
|
|
6
6
|
export const DocumentInfoProvider = ({ children, global, collection, id, }) => {
|
|
7
7
|
const { serverURL, routes: { api } } = useConfig();
|
|
8
8
|
const { getPreference } = usePreferences();
|
|
9
|
-
const [preferences, setPreferences] = useState();
|
|
10
9
|
const [publishedDoc, setPublishedDoc] = useState(null);
|
|
11
10
|
const [versions, setVersions] = useState(null);
|
|
12
11
|
const [unpublishedVersions, setUnpublishedVersions] = useState(null);
|
|
@@ -123,8 +122,7 @@ export const DocumentInfoProvider = ({ children, global, collection, id, }) => {
|
|
|
123
122
|
}, [getVersions]);
|
|
124
123
|
useEffect(() => {
|
|
125
124
|
const getDocPreferences = async () => {
|
|
126
|
-
|
|
127
|
-
setPreferences(existingPreferences || { fields: {} });
|
|
125
|
+
await getPreference(preferencesKey);
|
|
128
126
|
};
|
|
129
127
|
getDocPreferences();
|
|
130
128
|
}, [getPreference, preferencesKey]);
|
|
@@ -139,7 +137,6 @@ export const DocumentInfoProvider = ({ children, global, collection, id, }) => {
|
|
|
139
137
|
getVersions,
|
|
140
138
|
publishedDoc,
|
|
141
139
|
id,
|
|
142
|
-
preferences,
|
|
143
140
|
};
|
|
144
141
|
return (React.createElement(Context.Provider, { value: value }, children));
|
|
145
142
|
};
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { SanitizedCollectionConfig, TypeWithID, TypeWithTimestamps } from '../../../../collections/config/types';
|
|
3
3
|
import { SanitizedGlobalConfig } from '../../../../globals/config/types';
|
|
4
4
|
import { PaginatedDocs } from '../../../../mongoose/types';
|
|
5
|
-
import { DocumentPreferences } from '../../../../preferences/types';
|
|
6
5
|
import { TypeWithVersion } from '../../../../versions/types';
|
|
7
6
|
export declare type Version = TypeWithVersion<any>;
|
|
8
7
|
export declare type ContextType = {
|
|
@@ -17,7 +16,6 @@ export declare type ContextType = {
|
|
|
17
16
|
_status?: string;
|
|
18
17
|
};
|
|
19
18
|
getVersions: () => Promise<void>;
|
|
20
|
-
preferences?: DocumentPreferences;
|
|
21
19
|
};
|
|
22
20
|
export declare type Props = {
|
|
23
21
|
collection?: SanitizedCollectionConfig;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
declare type PreferencesContext = {
|
|
3
|
-
getPreference: <T>(key: string) => T | Promise<T>;
|
|
4
|
-
setPreference: <T>(key: string, value: T) => void;
|
|
3
|
+
getPreference: <T = any>(key: string) => T | Promise<T>;
|
|
4
|
+
setPreference: <T = any>(key: string, value: T) => void;
|
|
5
5
|
};
|
|
6
6
|
export declare const PreferencesProvider: React.FC<{
|
|
7
7
|
children?: React.ReactNode;
|
|
@@ -9,14 +9,16 @@ import DefaultAccount from './Default';
|
|
|
9
9
|
import buildStateFromSchema from '../../forms/Form/buildStateFromSchema';
|
|
10
10
|
import RenderCustomComponent from '../../utilities/RenderCustomComponent';
|
|
11
11
|
import { useDocumentInfo } from '../../utilities/DocumentInfo';
|
|
12
|
+
import { usePreferences } from '../../utilities/Preferences';
|
|
12
13
|
const AccountView = () => {
|
|
13
14
|
var _a, _b;
|
|
14
15
|
const { state: locationState } = useLocation();
|
|
15
16
|
const locale = useLocale();
|
|
16
17
|
const { setStepNav } = useStepNav();
|
|
17
18
|
const { user, permissions } = useAuth();
|
|
18
|
-
const [initialState, setInitialState] = useState(
|
|
19
|
-
const { id,
|
|
19
|
+
const [initialState, setInitialState] = useState();
|
|
20
|
+
const { id, preferencesKey } = useDocumentInfo();
|
|
21
|
+
const { getPreference } = usePreferences();
|
|
20
22
|
const { serverURL, routes: { api }, collections, admin: { user: adminUser, components: { views: { Account: CustomAccount, } = {
|
|
21
23
|
Account: undefined,
|
|
22
24
|
}, } = {}, } = {
|
|
@@ -25,7 +27,7 @@ const AccountView = () => {
|
|
|
25
27
|
const collection = collections.find((coll) => coll.slug === user.collection);
|
|
26
28
|
const { fields } = collection;
|
|
27
29
|
const collectionPermissions = (_a = permissions === null || permissions === void 0 ? void 0 : permissions.collections) === null || _a === void 0 ? void 0 : _a[adminUser];
|
|
28
|
-
const [{ data
|
|
30
|
+
const [{ data }] = usePayloadAPI(`${serverURL}${api}/${collection === null || collection === void 0 ? void 0 : collection.slug}/${user === null || user === void 0 ? void 0 : user.id}?depth=0`, { initialParams: { 'fallback-locale': 'null' } });
|
|
29
31
|
const hasSavePermission = (_b = collectionPermissions === null || collectionPermissions === void 0 ? void 0 : collectionPermissions.update) === null || _b === void 0 ? void 0 : _b.permission;
|
|
30
32
|
const dataToRender = (locationState === null || locationState === void 0 ? void 0 : locationState.data) || data;
|
|
31
33
|
const apiURL = `${serverURL}${api}/${user.collection}/${data === null || data === void 0 ? void 0 : data.id}`;
|
|
@@ -39,10 +41,11 @@ const AccountView = () => {
|
|
|
39
41
|
useEffect(() => {
|
|
40
42
|
const awaitInitialState = async () => {
|
|
41
43
|
const state = await buildStateFromSchema({ fieldSchema: fields, data: dataToRender, operation: 'update', id, user, locale });
|
|
44
|
+
await getPreference(preferencesKey);
|
|
42
45
|
setInitialState(state);
|
|
43
46
|
};
|
|
44
47
|
awaitInitialState();
|
|
45
|
-
}, [dataToRender, fields, id, user, locale]);
|
|
48
|
+
}, [dataToRender, fields, id, user, locale, preferencesKey, getPreference]);
|
|
46
49
|
return (React.createElement(RenderCustomComponent, { DefaultComponent: DefaultAccount, CustomComponent: CustomAccount, componentProps: {
|
|
47
50
|
action,
|
|
48
51
|
data,
|
|
@@ -51,7 +54,7 @@ const AccountView = () => {
|
|
|
51
54
|
hasSavePermission,
|
|
52
55
|
initialState,
|
|
53
56
|
apiURL,
|
|
54
|
-
isLoading:
|
|
57
|
+
isLoading: !initialState,
|
|
55
58
|
} }));
|
|
56
59
|
};
|
|
57
60
|
export default AccountView;
|
|
@@ -9,14 +9,16 @@ import RenderCustomComponent from '../../utilities/RenderCustomComponent';
|
|
|
9
9
|
import DefaultGlobal from './Default';
|
|
10
10
|
import buildStateFromSchema from '../../forms/Form/buildStateFromSchema';
|
|
11
11
|
import { useDocumentInfo } from '../../utilities/DocumentInfo';
|
|
12
|
+
import { usePreferences } from '../../utilities/Preferences';
|
|
12
13
|
const GlobalView = (props) => {
|
|
13
14
|
var _a, _b;
|
|
14
15
|
const { state: locationState } = useLocation();
|
|
15
16
|
const locale = useLocale();
|
|
16
17
|
const { setStepNav } = useStepNav();
|
|
17
18
|
const { permissions, user } = useAuth();
|
|
18
|
-
const [initialState, setInitialState] = useState(
|
|
19
|
-
const { getVersions,
|
|
19
|
+
const [initialState, setInitialState] = useState();
|
|
20
|
+
const { getVersions, preferencesKey } = useDocumentInfo();
|
|
21
|
+
const { getPreference } = usePreferences();
|
|
20
22
|
const { serverURL, routes: { api, }, } = useConfig();
|
|
21
23
|
const { global } = props;
|
|
22
24
|
const { slug, label, fields, admin: { components: { views: { Edit: CustomEdit, } = {}, } = {}, } = {}, } = global;
|
|
@@ -25,7 +27,7 @@ const GlobalView = (props) => {
|
|
|
25
27
|
const state = await buildStateFromSchema({ fieldSchema: fields, data: json.result, operation: 'update', user, locale });
|
|
26
28
|
setInitialState(state);
|
|
27
29
|
}, [getVersions, fields, user, locale]);
|
|
28
|
-
const [{ data
|
|
30
|
+
const [{ data }] = usePayloadAPI(`${serverURL}${api}/globals/${slug}`, { initialParams: { 'fallback-locale': 'null', depth: 0, draft: 'true' } });
|
|
29
31
|
const dataToRender = (locationState === null || locationState === void 0 ? void 0 : locationState.data) || data;
|
|
30
32
|
useEffect(() => {
|
|
31
33
|
const nav = [{
|
|
@@ -36,13 +38,14 @@ const GlobalView = (props) => {
|
|
|
36
38
|
useEffect(() => {
|
|
37
39
|
const awaitInitialState = async () => {
|
|
38
40
|
const state = await buildStateFromSchema({ fieldSchema: fields, data: dataToRender, user, operation: 'update', locale });
|
|
41
|
+
await getPreference(preferencesKey);
|
|
39
42
|
setInitialState(state);
|
|
40
43
|
};
|
|
41
44
|
awaitInitialState();
|
|
42
|
-
}, [dataToRender, fields, user, locale]);
|
|
45
|
+
}, [dataToRender, fields, user, locale, getPreference, preferencesKey]);
|
|
43
46
|
const globalPermissions = (_a = permissions === null || permissions === void 0 ? void 0 : permissions.globals) === null || _a === void 0 ? void 0 : _a[slug];
|
|
44
47
|
return (React.createElement(RenderCustomComponent, { DefaultComponent: DefaultGlobal, CustomComponent: CustomEdit, componentProps: {
|
|
45
|
-
isLoading:
|
|
48
|
+
isLoading: !initialState,
|
|
46
49
|
data: dataToRender,
|
|
47
50
|
permissions: globalPermissions,
|
|
48
51
|
initialState,
|
|
@@ -10,6 +10,7 @@ import formatFields from './formatFields';
|
|
|
10
10
|
import buildStateFromSchema from '../../../forms/Form/buildStateFromSchema';
|
|
11
11
|
import { useLocale } from '../../../utilities/Locale';
|
|
12
12
|
import { useDocumentInfo } from '../../../utilities/DocumentInfo';
|
|
13
|
+
import { usePreferences } from '../../../utilities/Preferences';
|
|
13
14
|
const EditView = (props) => {
|
|
14
15
|
var _a, _b, _c;
|
|
15
16
|
const { collection: incomingCollection, isEditing } = props;
|
|
@@ -22,9 +23,10 @@ const EditView = (props) => {
|
|
|
22
23
|
const { state: locationState } = useLocation();
|
|
23
24
|
const history = useHistory();
|
|
24
25
|
const { setStepNav } = useStepNav();
|
|
25
|
-
const [initialState, setInitialState] = useState(
|
|
26
|
+
const [initialState, setInitialState] = useState();
|
|
26
27
|
const { permissions, user } = useAuth();
|
|
27
|
-
const { getVersions,
|
|
28
|
+
const { getVersions, preferencesKey } = useDocumentInfo();
|
|
29
|
+
const { getPreference } = usePreferences();
|
|
28
30
|
const onSave = useCallback(async (json) => {
|
|
29
31
|
var _a;
|
|
30
32
|
getVersions();
|
|
@@ -75,10 +77,11 @@ const EditView = (props) => {
|
|
|
75
77
|
}
|
|
76
78
|
const awaitInitialState = async () => {
|
|
77
79
|
const state = await buildStateFromSchema({ fieldSchema: fields, data: dataToRender, user, operation: isEditing ? 'update' : 'create', id, locale });
|
|
80
|
+
await getPreference(preferencesKey);
|
|
78
81
|
setInitialState(state);
|
|
79
82
|
};
|
|
80
83
|
awaitInitialState();
|
|
81
|
-
}, [dataToRender, fields, isEditing, id, user, locale, isLoadingDocument]);
|
|
84
|
+
}, [dataToRender, fields, isEditing, id, user, locale, isLoadingDocument, preferencesKey, getPreference]);
|
|
82
85
|
if (isError) {
|
|
83
86
|
return (React.createElement(Redirect, { to: `${admin}/not-found` }));
|
|
84
87
|
}
|
|
@@ -87,7 +90,7 @@ const EditView = (props) => {
|
|
|
87
90
|
const action = `${serverURL}${api}/${slug}${isEditing ? `/${id}` : ''}?locale=${locale}&depth=0&fallback-locale=null`;
|
|
88
91
|
const hasSavePermission = (isEditing && ((_b = collectionPermissions === null || collectionPermissions === void 0 ? void 0 : collectionPermissions.update) === null || _b === void 0 ? void 0 : _b.permission)) || (!isEditing && ((_c = collectionPermissions === null || collectionPermissions === void 0 ? void 0 : collectionPermissions.create) === null || _c === void 0 ? void 0 : _c.permission));
|
|
89
92
|
return (React.createElement(RenderCustomComponent, { DefaultComponent: DefaultEdit, CustomComponent: CustomEdit, componentProps: {
|
|
90
|
-
isLoading:
|
|
93
|
+
isLoading: !initialState,
|
|
91
94
|
data: dataToRender,
|
|
92
95
|
collection,
|
|
93
96
|
permissions: collectionPermissions,
|
|
@@ -31,7 +31,7 @@ const ListView = (props) => {
|
|
|
31
31
|
const collectionPermissions = (_a = permissions === null || permissions === void 0 ? void 0 : permissions.collections) === null || _a === void 0 ? void 0 : _a[slug];
|
|
32
32
|
const hasCreatePermission = (_b = collectionPermissions === null || collectionPermissions === void 0 ? void 0 : collectionPermissions.create) === null || _b === void 0 ? void 0 : _b.permission;
|
|
33
33
|
const newDocumentURL = `${admin}/collections/${slug}/create`;
|
|
34
|
-
const [{ data }, { setParams: setFetchParams }] = usePayloadAPI(fetchURL);
|
|
34
|
+
const [{ data }, { setParams: setFetchParams }] = usePayloadAPI(fetchURL, { initialParams: { page: 1 } });
|
|
35
35
|
const activeColumnNames = tableColumns.map(({ accessor }) => accessor);
|
|
36
36
|
const stringifiedActiveColumns = JSON.stringify(activeColumnNames);
|
|
37
37
|
useEffect(() => {
|
package/dist/admin/scss/app.scss
CHANGED
|
@@ -8,7 +8,7 @@ const getExtractJWT_1 = __importDefault(require("../../getExtractJWT"));
|
|
|
8
8
|
function refreshResolver(collection) {
|
|
9
9
|
async function resolver(_, args, context) {
|
|
10
10
|
let token;
|
|
11
|
-
const extractJWT = (0, getExtractJWT_1.default)(context.req.config);
|
|
11
|
+
const extractJWT = (0, getExtractJWT_1.default)(context.req.payload.config);
|
|
12
12
|
token = extractJWT(context.req);
|
|
13
13
|
if (args.token) {
|
|
14
14
|
token = args.token;
|
|
@@ -25,4 +25,4 @@ function refreshResolver(collection) {
|
|
|
25
25
|
return resolver;
|
|
26
26
|
}
|
|
27
27
|
exports.default = refreshResolver;
|
|
28
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVmcmVzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9hdXRoL2dyYXBocWwvcmVzb2x2ZXJzL3JlZnJlc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFDQSx1RUFBK0M7QUFDL0Msd0VBQWdEO0FBRWhELFNBQVMsZUFBZSxDQUFDLFVBQXNCO0lBQzdDLEtBQUssVUFBVSxRQUFRLENBQUMsQ0FBQyxFQUFFLElBQUksRUFBRSxPQUFPO1FBQ3RDLElBQUksS0FBSyxDQUFDO1FBRVYsTUFBTSxVQUFVLEdBQUcsSUFBQSx1QkFBYSxFQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFDO1FBQzdELEtBQUssR0FBRyxVQUFVLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxDQUFDO1FBRWhDLElBQUksSUFBSSxDQUFDLEtBQUssRUFBRTtZQUNkLEtBQUssR0FBRyxJQUFJLENBQUMsS0FBSyxDQUFDO1NBQ3BCO1FBRUQsTUFBTSxPQUFPLEdBQUc7WUFDZCxVQUFVO1lBQ1YsS0FBSztZQUNMLEdBQUcsRUFBRSxPQUFPLENBQUMsR0FBRztZQUNoQixHQUFHLEVBQUUsT0FBTyxDQUFDLEdBQUc7U0FDakIsQ0FBQztRQUVGLE1BQU0sTUFBTSxHQUFHLE1BQU0sSUFBQSxpQkFBTyxFQUFDLE9BQU8sQ0FBQyxDQUFDO1FBRXRDLE9BQU8sTUFBTSxDQUFDO0lBQ2hCLENBQUM7SUFFRCxPQUFPLFFBQVEsQ0FBQztBQUNsQixDQUFDO0FBRUQsa0JBQWUsZUFBZSxDQUFDIn0=
|
|
@@ -4,19 +4,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const forgotPassword_1 = __importDefault(require("../forgotPassword"));
|
|
7
|
+
const dataloader_1 = require("../../../collections/dataloader");
|
|
7
8
|
async function localForgotPassword(payload, options) {
|
|
8
|
-
const { collection: collectionSlug, data, expiration, disableEmail, req = {}, } = options;
|
|
9
|
+
const { collection: collectionSlug, data, expiration, disableEmail, req: incomingReq = {}, } = options;
|
|
9
10
|
const collection = payload.collections[collectionSlug];
|
|
11
|
+
const req = {
|
|
12
|
+
...incomingReq,
|
|
13
|
+
payloadAPI: 'local',
|
|
14
|
+
};
|
|
15
|
+
if (!req.payloadDataLoader)
|
|
16
|
+
req.payloadDataLoader = (0, dataloader_1.getDataLoader)(req);
|
|
10
17
|
return (0, forgotPassword_1.default)({
|
|
11
18
|
data,
|
|
12
19
|
collection,
|
|
13
20
|
disableEmail,
|
|
14
21
|
expiration,
|
|
15
|
-
req
|
|
16
|
-
...req,
|
|
17
|
-
payloadAPI: 'local',
|
|
18
|
-
},
|
|
22
|
+
req,
|
|
19
23
|
});
|
|
20
24
|
}
|
|
21
25
|
exports.default = localForgotPassword;
|
|
22
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9yZ290UGFzc3dvcmQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYXV0aC9vcGVyYXRpb25zL2xvY2FsL2ZvcmdvdFBhc3N3b3JkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQ0EsdUVBQTJEO0FBRTNELGdFQUFnRTtBQVloRSxLQUFLLFVBQVUsbUJBQW1CLENBQUMsT0FBZ0IsRUFBRSxPQUFnQjtJQUNuRSxNQUFNLEVBQ0osVUFBVSxFQUFFLGNBQWMsRUFDMUIsSUFBSSxFQUNKLFVBQVUsRUFDVixZQUFZLEVBQ1osR0FBRyxFQUFFLFdBQVcsR0FBRyxFQUFFLEdBQ3RCLEdBQUcsT0FBTyxDQUFDO0lBRVosTUFBTSxVQUFVLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxjQUFjLENBQUMsQ0FBQztJQUV2RCxNQUFNLEdBQUcsR0FBRztRQUNWLEdBQUcsV0FBVztRQUNkLFVBQVUsRUFBRSxPQUFPO0tBQ0YsQ0FBQztJQUVwQixJQUFJLENBQUMsR0FBRyxDQUFDLGlCQUFpQjtRQUFFLEdBQUcsQ0FBQyxpQkFBaUIsR0FBRyxJQUFBLDBCQUFhLEVBQUMsR0FBRyxDQUFDLENBQUM7SUFFdkUsT0FBTyxJQUFBLHdCQUFjLEVBQUM7UUFDcEIsSUFBSTtRQUNKLFVBQVU7UUFDVixZQUFZO1FBQ1osVUFBVTtRQUNWLEdBQUc7S0FDSixDQUFDLENBQUM7QUFDTCxDQUFDO0FBRUQsa0JBQWUsbUJBQW1CLENBQUMifQ==
|
|
@@ -4,22 +4,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const login_1 = __importDefault(require("../login"));
|
|
7
|
+
const dataloader_1 = require("../../../collections/dataloader");
|
|
7
8
|
async function localLogin(payload, options) {
|
|
8
|
-
const { collection: collectionSlug, req = {}, res, depth, locale, fallbackLocale, data, overrideAccess = true, showHiddenFields, } = options;
|
|
9
|
+
const { collection: collectionSlug, req: incomingReq = {}, res, depth, locale, fallbackLocale, data, overrideAccess = true, showHiddenFields, } = options;
|
|
9
10
|
const collection = payload.collections[collectionSlug];
|
|
11
|
+
const req = {
|
|
12
|
+
...incomingReq,
|
|
13
|
+
payloadAPI: 'local',
|
|
14
|
+
payload,
|
|
15
|
+
locale: undefined,
|
|
16
|
+
fallbackLocale: undefined,
|
|
17
|
+
};
|
|
18
|
+
if (!req.payloadDataLoader)
|
|
19
|
+
req.payloadDataLoader = (0, dataloader_1.getDataLoader)(req);
|
|
10
20
|
const args = {
|
|
11
21
|
depth,
|
|
12
22
|
collection,
|
|
13
23
|
overrideAccess,
|
|
14
24
|
showHiddenFields,
|
|
15
25
|
data,
|
|
16
|
-
req
|
|
17
|
-
...req,
|
|
18
|
-
payloadAPI: 'local',
|
|
19
|
-
payload,
|
|
20
|
-
locale: undefined,
|
|
21
|
-
fallbackLocale: undefined,
|
|
22
|
-
},
|
|
26
|
+
req,
|
|
23
27
|
res,
|
|
24
28
|
};
|
|
25
29
|
if (locale)
|
|
@@ -29,4 +33,4 @@ async function localLogin(payload, options) {
|
|
|
29
33
|
return (0, login_1.default)(args);
|
|
30
34
|
}
|
|
31
35
|
exports.default = localLogin;
|
|
32
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
36
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9naW4uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYXV0aC9vcGVyYXRpb25zL2xvY2FsL2xvZ2luLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQ0EscURBQXlDO0FBSXpDLGdFQUFnRTtBQWlCaEUsS0FBSyxVQUFVLFVBQVUsQ0FBNkIsT0FBZ0IsRUFBRSxPQUFnQjtJQUN0RixNQUFNLEVBQ0osVUFBVSxFQUFFLGNBQWMsRUFDMUIsR0FBRyxFQUFFLFdBQVcsR0FBRyxFQUFFLEVBQ3JCLEdBQUcsRUFDSCxLQUFLLEVBQ0wsTUFBTSxFQUNOLGNBQWMsRUFDZCxJQUFJLEVBQ0osY0FBYyxHQUFHLElBQUksRUFDckIsZ0JBQWdCLEdBQ2pCLEdBQUcsT0FBTyxDQUFDO0lBRVosTUFBTSxVQUFVLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxjQUFjLENBQUMsQ0FBQztJQUV2RCxNQUFNLEdBQUcsR0FBRztRQUNWLEdBQUcsV0FBVztRQUNkLFVBQVUsRUFBRSxPQUFPO1FBQ25CLE9BQU87UUFDUCxNQUFNLEVBQUUsU0FBUztRQUNqQixjQUFjLEVBQUUsU0FBUztLQUNSLENBQUM7SUFFcEIsSUFBSSxDQUFDLEdBQUcsQ0FBQyxpQkFBaUI7UUFBRSxHQUFHLENBQUMsaUJBQWlCLEdBQUcsSUFBQSwwQkFBYSxFQUFDLEdBQUcsQ0FBQyxDQUFDO0lBRXZFLE1BQU0sSUFBSSxHQUFHO1FBQ1gsS0FBSztRQUNMLFVBQVU7UUFDVixjQUFjO1FBQ2QsZ0JBQWdCO1FBQ2hCLElBQUk7UUFDSixHQUFHO1FBQ0gsR0FBRztLQUNKLENBQUM7SUFFRixJQUFJLE1BQU07UUFBRSxJQUFJLENBQUMsR0FBRyxDQUFDLE1BQU0sR0FBRyxNQUFNLENBQUM7SUFDckMsSUFBSSxjQUFjO1FBQUUsSUFBSSxDQUFDLEdBQUcsQ0FBQyxjQUFjLEdBQUcsY0FBYyxDQUFDO0lBRTdELE9BQU8sSUFBQSxlQUFLLEVBQUMsSUFBSSxDQUFDLENBQUM7QUFDckIsQ0FBQztBQUVELGtCQUFlLFVBQVUsQ0FBQyJ9
|
|
@@ -4,19 +4,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const resetPassword_1 = __importDefault(require("../resetPassword"));
|
|
7
|
+
const dataloader_1 = require("../../../collections/dataloader");
|
|
7
8
|
async function localResetPassword(payload, options) {
|
|
8
|
-
const { collection: collectionSlug, data, overrideAccess, req, } = options;
|
|
9
|
+
const { collection: collectionSlug, data, overrideAccess, req: incomingReq = {}, } = options;
|
|
9
10
|
const collection = payload.collections[collectionSlug];
|
|
11
|
+
const req = {
|
|
12
|
+
...incomingReq,
|
|
13
|
+
payload,
|
|
14
|
+
payloadAPI: 'local',
|
|
15
|
+
};
|
|
16
|
+
if (!req.payloadDataLoader)
|
|
17
|
+
req.payloadDataLoader = (0, dataloader_1.getDataLoader)(req);
|
|
10
18
|
return (0, resetPassword_1.default)({
|
|
11
19
|
collection,
|
|
12
20
|
data,
|
|
13
21
|
overrideAccess,
|
|
14
|
-
req
|
|
15
|
-
...req,
|
|
16
|
-
payload,
|
|
17
|
-
payloadAPI: 'local',
|
|
18
|
-
},
|
|
22
|
+
req,
|
|
19
23
|
});
|
|
20
24
|
}
|
|
21
25
|
exports.default = localResetPassword;
|
|
22
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzZXRQYXNzd29yZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9hdXRoL29wZXJhdGlvbnMvbG9jYWwvcmVzZXRQYXNzd29yZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUNBLHFFQUF5RDtBQUV6RCxnRUFBZ0U7QUFZaEUsS0FBSyxVQUFVLGtCQUFrQixDQUFDLE9BQWdCLEVBQUUsT0FBZ0I7SUFDbEUsTUFBTSxFQUNKLFVBQVUsRUFBRSxjQUFjLEVBQzFCLElBQUksRUFDSixjQUFjLEVBQ2QsR0FBRyxFQUFFLFdBQVcsR0FBRyxFQUFFLEdBQ3RCLEdBQUcsT0FBTyxDQUFDO0lBRVosTUFBTSxVQUFVLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxjQUFjLENBQUMsQ0FBQztJQUV2RCxNQUFNLEdBQUcsR0FBRztRQUNWLEdBQUcsV0FBVztRQUNkLE9BQU87UUFDUCxVQUFVLEVBQUUsT0FBTztLQUNGLENBQUM7SUFFcEIsSUFBSSxDQUFDLEdBQUcsQ0FBQyxpQkFBaUI7UUFBRSxHQUFHLENBQUMsaUJBQWlCLEdBQUcsSUFBQSwwQkFBYSxFQUFDLEdBQUcsQ0FBQyxDQUFDO0lBRXZFLE9BQU8sSUFBQSx1QkFBYSxFQUFDO1FBQ25CLFVBQVU7UUFDVixJQUFJO1FBQ0osY0FBYztRQUNkLEdBQUc7S0FDSixDQUFDLENBQUM7QUFDTCxDQUFDO0FBRUQsa0JBQWUsa0JBQWtCLENBQUMifQ==
|
|
@@ -4,19 +4,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const unlock_1 = __importDefault(require("../unlock"));
|
|
7
|
+
const dataloader_1 = require("../../../collections/dataloader");
|
|
7
8
|
async function localUnlock(payload, options) {
|
|
8
|
-
const { collection: collectionSlug, data, overrideAccess = true, req, } = options;
|
|
9
|
+
const { collection: collectionSlug, data, overrideAccess = true, req: incomingReq = {}, } = options;
|
|
9
10
|
const collection = payload.collections[collectionSlug];
|
|
11
|
+
const req = {
|
|
12
|
+
...incomingReq,
|
|
13
|
+
payload,
|
|
14
|
+
payloadAPI: 'local',
|
|
15
|
+
};
|
|
16
|
+
if (!req.payloadDataLoader)
|
|
17
|
+
req.payloadDataLoader = (0, dataloader_1.getDataLoader)(req);
|
|
10
18
|
return (0, unlock_1.default)({
|
|
11
19
|
data,
|
|
12
20
|
collection,
|
|
13
21
|
overrideAccess,
|
|
14
|
-
req
|
|
15
|
-
...req,
|
|
16
|
-
payload,
|
|
17
|
-
payloadAPI: 'local',
|
|
18
|
-
},
|
|
22
|
+
req,
|
|
19
23
|
});
|
|
20
24
|
}
|
|
21
25
|
exports.default = localUnlock;
|
|
22
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW5sb2NrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2F1dGgvb3BlcmF0aW9ucy9sb2NhbC91bmxvY2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFFQSx1REFBK0I7QUFDL0IsZ0VBQWdFO0FBV2hFLEtBQUssVUFBVSxXQUFXLENBQUMsT0FBZ0IsRUFBRSxPQUFnQjtJQUMzRCxNQUFNLEVBQ0osVUFBVSxFQUFFLGNBQWMsRUFDMUIsSUFBSSxFQUNKLGNBQWMsR0FBRyxJQUFJLEVBQ3JCLEdBQUcsRUFBRSxXQUFXLEdBQUcsRUFBRSxHQUN0QixHQUFHLE9BQU8sQ0FBQztJQUVaLE1BQU0sVUFBVSxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsY0FBYyxDQUFDLENBQUM7SUFFdkQsTUFBTSxHQUFHLEdBQUc7UUFDVixHQUFHLFdBQVc7UUFDZCxPQUFPO1FBQ1AsVUFBVSxFQUFFLE9BQU87S0FDRixDQUFDO0lBRXBCLElBQUksQ0FBQyxHQUFHLENBQUMsaUJBQWlCO1FBQUUsR0FBRyxDQUFDLGlCQUFpQixHQUFHLElBQUEsMEJBQWEsRUFBQyxHQUFHLENBQUMsQ0FBQztJQUV2RSxPQUFPLElBQUEsZ0JBQU0sRUFBQztRQUNaLElBQUk7UUFDSixVQUFVO1FBQ1YsY0FBYztRQUNkLEdBQUc7S0FDSixDQUFDLENBQUM7QUFDTCxDQUFDO0FBRUQsa0JBQWUsV0FBVyxDQUFDIn0=
|