REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 1.89 KB
Close
/home/byroehnu/easepaybiz.easetack.com/node_modules/adminjs/src/backend/utils/request-parser/request-parser.ts
Text
Base64
import { ActionRequest } from '../../actions/index.js' import { BaseResource } from '../../adapters/index.js' import { FORM_VALUE_NULL, FORM_VALUE_EMPTY_OBJECT, FORM_VALUE_EMPTY_ARRAY, } from '../../../frontend/hooks/use-record/params-to-form-data.js' /** * Takes the original ActionRequest and convert string values to a corresponding * types. It * * @param {ActionRequest} originalRequest * @param {BaseResource} resource * @returns {ActionRequest} * * @private */ export const requestParser = ( originalRequest: ActionRequest, resource: BaseResource, ): ActionRequest => { const { payload: originalPayload } = originalRequest const payload = Object.entries(originalPayload || {}).reduce((memo, [path, formValue]) => { const property = resource._decorated?.getPropertyByKey(path) let value = formValue if (formValue === FORM_VALUE_NULL) { value = null } if (formValue === FORM_VALUE_EMPTY_OBJECT) { value = {} } if (formValue === FORM_VALUE_EMPTY_ARRAY) { value = [] } if (property) { if (property.type() === 'boolean') { if (value === 'true') { memo[path] = true return memo } if (value === 'false') { memo[path] = false return memo } if (value === '') { memo[path] = false return memo } } if (['date', 'datetime'].includes(property.type())) { if (value === '' || value === null) { memo[path] = null return memo } } if (property.type() === 'string') { const availableValues = property.availableValues() if (availableValues && !availableValues.includes(value) && value === '') { memo[path] = null return memo } } } memo[path] = value return memo }, {}) return { ...originalRequest, payload, } } export default requestParser
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 4
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
.htaccess
127 B
lr--r--r--
2026-03-14 01:49:11
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.ts
36 B
lrw-r--r--
2026-03-05 00:20:27
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
request-parser.spec.ts
1.41 KB
lrw-r--r--
2026-03-05 00:20:28
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
request-parser.ts
1.89 KB
lrw-r--r--
2026-03-05 00:20:28
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).