payload 1.1.28-beta.0 → 1.2.0
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/CHANGELOG.md +11 -99
- package/dist/admin/components/forms/Form/buildStateFromSchema/addFieldStatePromise.d.ts +3 -3
- package/dist/admin/components/forms/Form/buildStateFromSchema/addFieldStatePromise.js +7 -7
- package/dist/admin/components/forms/Form/buildStateFromSchema/index.d.ts +2 -2
- package/dist/admin/components/forms/Form/buildStateFromSchema/index.js +2 -2
- package/dist/admin/components/forms/Form/buildStateFromSchema/iterateFields.d.ts +3 -3
- package/dist/admin/components/forms/Form/buildStateFromSchema/iterateFields.js +2 -2
- package/dist/admin/components/forms/Form/index.js +4 -4
- package/dist/admin/components/forms/field-types/Array/index.js +2 -2
- package/dist/admin/components/forms/field-types/Blocks/index.js +2 -2
- package/dist/admin/components/forms/field-types/Relationship/AddNew/Modal/index.js +2 -2
- package/dist/admin/components/forms/field-types/RichText/elements/link/Button.js +2 -2
- package/dist/admin/components/forms/field-types/RichText/elements/link/Element.js +3 -3
- package/dist/admin/components/forms/field-types/RichText/elements/upload/Element/EditModal/index.js +2 -2
- package/dist/admin/components/forms/useField/index.js +2 -2
- package/dist/admin/components/utilities/I18n/index.js +4 -1
- package/dist/admin/components/views/Account/index.js +4 -4
- package/dist/admin/components/views/Global/index.js +5 -5
- package/dist/admin/components/views/collections/Edit/Auth/APIKey.js +2 -2
- package/dist/admin/components/views/collections/Edit/Default.js +3 -2
- package/dist/admin/components/views/collections/Edit/index.js +4 -4
- package/dist/auth/executeAccess.js +3 -3
- package/dist/auth/getExecuteStaticAccess.js +2 -2
- package/dist/auth/operations/forgotPassword.js +5 -5
- package/dist/auth/operations/local/forgotPassword.js +3 -1
- package/dist/auth/operations/local/login.js +3 -1
- package/dist/auth/operations/local/resetPassword.js +3 -1
- package/dist/auth/operations/local/unlock.js +3 -1
- package/dist/auth/operations/login.js +4 -4
- package/dist/auth/operations/logout.js +2 -2
- package/dist/auth/operations/refresh.js +2 -2
- package/dist/auth/operations/registerFirstUser.js +2 -2
- package/dist/auth/sendVerificationEmail.js +3 -3
- package/dist/collections/operations/create.js +4 -4
- package/dist/collections/operations/delete.js +6 -6
- package/dist/collections/operations/findByID.js +4 -4
- package/dist/collections/operations/findVersionByID.js +5 -5
- package/dist/collections/operations/local/create.js +3 -1
- package/dist/collections/operations/local/delete.js +3 -1
- package/dist/collections/operations/local/find.js +3 -1
- package/dist/collections/operations/local/findByID.js +3 -1
- package/dist/collections/operations/local/findVersionByID.js +3 -1
- package/dist/collections/operations/local/findVersions.js +5 -2
- package/dist/collections/operations/local/restoreVersion.js +4 -2
- package/dist/collections/operations/local/update.js +5 -2
- package/dist/collections/operations/restoreVersion.js +5 -5
- package/dist/collections/operations/update.js +6 -6
- package/dist/collections/requestHandlers/create.js +2 -2
- package/dist/collections/requestHandlers/delete.js +2 -2
- package/dist/collections/requestHandlers/restoreVersion.js +2 -2
- package/dist/collections/requestHandlers/update.js +4 -4
- package/dist/errors/AuthenticationError.d.ts +2 -2
- package/dist/errors/AuthenticationError.js +3 -3
- package/dist/errors/ErrorDeletingFile.d.ts +2 -2
- package/dist/errors/ErrorDeletingFile.js +3 -3
- package/dist/errors/FileUploadError.d.ts +2 -2
- package/dist/errors/FileUploadError.js +3 -3
- package/dist/errors/Forbidden.d.ts +2 -2
- package/dist/errors/Forbidden.js +3 -3
- package/dist/errors/LockedAuth.d.ts +2 -2
- package/dist/errors/LockedAuth.js +3 -3
- package/dist/errors/MissingFile.d.ts +2 -2
- package/dist/errors/MissingFile.js +3 -3
- package/dist/errors/NotFound.d.ts +2 -2
- package/dist/errors/NotFound.js +3 -3
- package/dist/errors/UnathorizedError.d.ts +2 -2
- package/dist/errors/UnathorizedError.js +3 -3
- package/dist/errors/ValidationError.d.ts +2 -2
- package/dist/errors/ValidationError.js +3 -3
- package/dist/express/middleware/i18n.js +3 -3
- package/dist/express/types.d.ts +2 -1
- package/dist/fields/config/types.d.ts +2 -2
- package/dist/fields/hooks/beforeChange/index.js +2 -2
- package/dist/fields/hooks/beforeChange/promise.js +2 -2
- package/dist/fields/validations.js +51 -51
- package/dist/fields/validations.spec.js +2 -3
- package/dist/globals/operations/findVersionByID.js +5 -5
- package/dist/globals/operations/local/findOne.js +5 -1
- package/dist/globals/operations/local/findVersionByID.js +5 -1
- package/dist/globals/operations/local/findVersions.js +5 -1
- package/dist/globals/operations/local/restoreVersion.js +5 -1
- package/dist/globals/operations/local/update.js +5 -1
- package/dist/globals/operations/restoreVersion.js +3 -3
- package/dist/globals/requestHandlers/restoreVersion.js +2 -2
- package/dist/globals/requestHandlers/update.js +4 -4
- package/dist/preferences/operations/delete.js +2 -2
- package/dist/preferences/operations/findOne.js +2 -2
- package/dist/preferences/operations/update.js +2 -2
- package/dist/preferences/requestHandlers/delete.js +2 -2
- package/dist/preferences/requestHandlers/findOne.js +2 -2
- package/dist/preferences/requestHandlers/update.js +2 -2
- package/dist/translations/init.d.ts +2 -2
- package/dist/translations/init.js +4 -1
- package/dist/uploads/generateFileData.js +3 -3
- package/dist/uploads/uploadFiles.d.ts +2 -2
- package/dist/uploads/uploadFiles.js +3 -3
- package/docs/configuration/i18n.mdx +1 -1
- package/docs/fields/overview.mdx +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.uploadFiles = void 0;
|
|
7
7
|
const errors_1 = require("../errors");
|
|
8
8
|
const saveBufferToFile_1 = __importDefault(require("./saveBufferToFile"));
|
|
9
|
-
const uploadFiles = async (payload, files,
|
|
9
|
+
const uploadFiles = async (payload, files, t) => {
|
|
10
10
|
try {
|
|
11
11
|
await Promise.all(files.map(async ({ buffer, path }) => {
|
|
12
12
|
await (0, saveBufferToFile_1.default)(buffer, path);
|
|
@@ -14,8 +14,8 @@ const uploadFiles = async (payload, files, i18n) => {
|
|
|
14
14
|
}
|
|
15
15
|
catch (err) {
|
|
16
16
|
payload.logger.error(err);
|
|
17
|
-
throw new errors_1.FileUploadError(
|
|
17
|
+
throw new errors_1.FileUploadError(t);
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
exports.uploadFiles = uploadFiles;
|
|
21
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXBsb2FkRmlsZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXBsb2Fkcy91cGxvYWRGaWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFDQSxzQ0FBNEM7QUFDNUMsMEVBQWtEO0FBSTNDLE1BQU0sV0FBVyxHQUFHLEtBQUssRUFBRSxPQUFnQixFQUFFLEtBQW1CLEVBQUUsQ0FBWSxFQUFpQixFQUFFO0lBQ3RHLElBQUk7UUFDRixNQUFNLE9BQU8sQ0FBQyxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsRUFBRSxNQUFNLEVBQUUsSUFBSSxFQUFFLEVBQUUsRUFBRTtZQUNyRCxNQUFNLElBQUEsMEJBQWdCLEVBQUMsTUFBTSxFQUFFLElBQUksQ0FBQyxDQUFDO1FBQ3ZDLENBQUMsQ0FBQyxDQUFDLENBQUM7S0FDTDtJQUFDLE9BQU8sR0FBRyxFQUFFO1FBQ1osT0FBTyxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUM7UUFDMUIsTUFBTSxJQUFJLHdCQUFlLENBQUMsQ0FBQyxDQUFDLENBQUM7S0FDOUI7QUFDSCxDQUFDLENBQUM7QUFUVyxRQUFBLFdBQVcsZUFTdEIifQ==
|
|
@@ -63,7 +63,7 @@ After a user logs in, they can change their language selection in the `/account`
|
|
|
63
63
|
|
|
64
64
|
Payload's backend uses express middleware to set the language on incoming requests before they are handled. This allows backend validation to return error messages in the user's own language or system generated emails to be sent using the correct translation. You can make HTTP requests with the `accept-language` header and Payload will use that language.
|
|
65
65
|
|
|
66
|
-
Anywhere in your Payload app that you have access to the `req` object, you can access i18next's extensive internationalization features
|
|
66
|
+
Anywhere in your Payload app that you have access to the `req` object, you can access i18next's extensive internationalization features assigned to `req.i18n`. To access text translations you can use `req.t('namespace:key')`.
|
|
67
67
|
|
|
68
68
|
Read the i18next [API documentation](https://www.i18next.com/overview/api) to learn more.
|
|
69
69
|
|
package/docs/fields/overview.mdx
CHANGED
|
@@ -78,7 +78,7 @@ There are two arguments available to custom validation functions.
|
|
|
78
78
|
| `siblingData` | An object of the document data limited to fields within the same parent to the field. |
|
|
79
79
|
| `operation` | Will be "create" or "update" depending on the UI action or API call. |
|
|
80
80
|
| `id` | The value of the collection `id`, will be `undefined` on create request. |
|
|
81
|
-
| `
|
|
81
|
+
| `t` | The function for translating text, [more](/docs/configuration/i18n). |
|
|
82
82
|
| `user` | The currently authenticated user object. |
|
|
83
83
|
| `payload` | If the `validate` function is being executed on the server, Payload will be exposed for easily running local operations. |
|
|
84
84
|
|