payload 4.0.0-internal.fa345ef → 4.0.0-internal.fec2230
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/bin.js +14 -10
- package/dist/__testing__/predefinedMigration.d.ts +4 -3
- package/dist/__testing__/predefinedMigration.d.ts.map +1 -1
- package/dist/admin/RichText.d.ts +1 -1
- package/dist/admin/RichText.d.ts.map +1 -1
- package/dist/admin/RichText.js.map +1 -1
- package/dist/admin/adapters/devReload.d.ts +13 -0
- package/dist/admin/adapters/devReload.d.ts.map +1 -1
- package/dist/admin/adapters/devReload.js +14 -1
- package/dist/admin/adapters/devReload.js.map +1 -1
- package/dist/admin/adapters/router.d.ts +8 -0
- package/dist/admin/adapters/router.d.ts.map +1 -1
- package/dist/admin/adapters/router.js.map +1 -1
- package/dist/admin/functions/index.d.ts +12 -10
- package/dist/admin/functions/index.d.ts.map +1 -1
- package/dist/admin/functions/index.js.map +1 -1
- package/dist/admin/types.d.ts +3 -3
- package/dist/admin/types.d.ts.map +1 -1
- package/dist/admin/types.js.map +1 -1
- package/dist/admin/views/index.d.ts +2 -2
- package/dist/admin/views/index.d.ts.map +1 -1
- package/dist/admin/views/index.js.map +1 -1
- package/dist/auth/baseFields/apiKey.d.ts.map +1 -1
- package/dist/auth/baseFields/apiKey.js +16 -1
- package/dist/auth/baseFields/apiKey.js.map +1 -1
- package/dist/auth/cookies.d.ts +2 -2
- package/dist/auth/cookies.d.ts.map +1 -1
- package/dist/auth/crypto.d.ts +73 -2
- package/dist/auth/crypto.d.ts.map +1 -1
- package/dist/auth/crypto.js +90 -13
- package/dist/auth/crypto.js.map +1 -1
- package/dist/auth/defaultAccess.d.ts.map +1 -1
- package/dist/auth/endpoints/login.d.ts.map +1 -1
- package/dist/auth/endpoints/login.js +2 -11
- package/dist/auth/endpoints/login.js.map +1 -1
- package/dist/auth/endpoints/refresh.d.ts.map +1 -1
- package/dist/auth/endpoints/refresh.js +4 -6
- package/dist/auth/endpoints/refresh.js.map +1 -1
- package/dist/auth/ensureUsernameOrEmail.d.ts.map +1 -1
- package/dist/auth/executeAccess.d.ts +2 -1
- package/dist/auth/executeAccess.d.ts.map +1 -1
- package/dist/auth/executeAccess.js +2 -1
- package/dist/auth/executeAccess.js.map +1 -1
- package/dist/auth/executeAuthStrategies.d.ts.map +1 -1
- package/dist/auth/extractAccessFromPermission.d.ts.map +1 -1
- package/dist/auth/extractJWT.d.ts +1 -1
- package/dist/auth/extractJWT.d.ts.map +1 -1
- package/dist/auth/getAccessResults.js +1 -0
- package/dist/auth/getAccessResults.js.map +1 -1
- package/dist/auth/getAuthFields.d.ts.map +1 -1
- package/dist/auth/getFieldsToSign.d.ts +1 -1
- package/dist/auth/getFieldsToSign.d.ts.map +1 -1
- package/dist/auth/getLoginOptions.d.ts +1 -1
- package/dist/auth/getLoginOptions.d.ts.map +1 -1
- package/dist/auth/getLoginOptions.js.map +1 -1
- package/dist/auth/isUserLocked.d.ts.map +1 -1
- package/dist/auth/jwt.d.ts.map +1 -1
- package/dist/auth/loginWithCookie.d.ts +33 -0
- package/dist/auth/loginWithCookie.d.ts.map +1 -0
- package/dist/auth/loginWithCookie.js +34 -0
- package/dist/auth/loginWithCookie.js.map +1 -0
- package/dist/auth/operations/access.d.ts.map +1 -1
- package/dist/auth/operations/access.js +3 -9
- package/dist/auth/operations/access.js.map +1 -1
- package/dist/auth/operations/auth.d.ts.map +1 -1
- package/dist/auth/operations/auth.js +15 -21
- package/dist/auth/operations/auth.js.map +1 -1
- package/dist/auth/operations/forgotPassword.d.ts.map +1 -1
- package/dist/auth/operations/init.d.ts.map +1 -1
- package/dist/auth/operations/local/auth.d.ts.map +1 -1
- package/dist/auth/operations/login.d.ts.map +1 -1
- package/dist/auth/operations/logout.d.ts.map +1 -1
- package/dist/auth/operations/me.d.ts +2 -9
- package/dist/auth/operations/me.d.ts.map +1 -1
- package/dist/auth/operations/me.js +0 -6
- package/dist/auth/operations/me.js.map +1 -1
- package/dist/auth/operations/refresh.d.ts +0 -7
- package/dist/auth/operations/refresh.d.ts.map +1 -1
- package/dist/auth/operations/refresh.js +0 -6
- package/dist/auth/operations/refresh.js.map +1 -1
- package/dist/auth/operations/registerFirstUser.d.ts.map +1 -1
- package/dist/auth/operations/resetPassword.d.ts.map +1 -1
- package/dist/auth/operations/unlock.d.ts.map +1 -1
- package/dist/auth/operations/unlock.js +1 -0
- package/dist/auth/operations/unlock.js.map +1 -1
- package/dist/auth/operations/verifyEmail.d.ts.map +1 -1
- package/dist/auth/rotateSecret.d.ts +51 -0
- package/dist/auth/rotateSecret.d.ts.map +1 -0
- package/dist/auth/rotateSecret.js +131 -0
- package/dist/auth/rotateSecret.js.map +1 -0
- package/dist/auth/serverFunctions/cookies.d.ts +47 -0
- package/dist/auth/serverFunctions/cookies.d.ts.map +1 -0
- package/dist/auth/serverFunctions/cookies.js +52 -0
- package/dist/auth/serverFunctions/cookies.js.map +1 -0
- package/dist/auth/serverFunctions/login.d.ts +29 -0
- package/dist/auth/serverFunctions/login.d.ts.map +1 -0
- package/dist/auth/serverFunctions/login.js +63 -0
- package/dist/auth/serverFunctions/login.js.map +1 -0
- package/dist/auth/serverFunctions/logout.d.ts +17 -0
- package/dist/auth/serverFunctions/logout.d.ts.map +1 -0
- package/dist/auth/serverFunctions/logout.js +58 -0
- package/dist/auth/serverFunctions/logout.js.map +1 -0
- package/dist/auth/serverFunctions/refresh.d.ts +17 -0
- package/dist/auth/serverFunctions/refresh.d.ts.map +1 -0
- package/dist/auth/serverFunctions/refresh.js +61 -0
- package/dist/auth/serverFunctions/refresh.js.map +1 -0
- package/dist/auth/sessions.d.ts.map +1 -1
- package/dist/auth/strategies/apiKey.d.ts.map +1 -1
- package/dist/auth/strategies/apiKey.js +5 -3
- package/dist/auth/strategies/apiKey.js.map +1 -1
- package/dist/auth/strategies/jwt.d.ts.map +1 -1
- package/dist/auth/strategies/jwt.js +23 -2
- package/dist/auth/strategies/jwt.js.map +1 -1
- package/dist/auth/strategies/local/authenticate.d.ts.map +1 -1
- package/dist/auth/strategies/local/generatePasswordSaltHash.d.ts.map +1 -1
- package/dist/auth/strategies/local/incrementLoginAttempts.d.ts.map +1 -1
- package/dist/auth/strategies/local/register.d.ts.map +1 -1
- package/dist/auth/strategies/local/resetLoginAttempts.d.ts.map +1 -1
- package/dist/auth/types.d.ts +13 -21
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/types.js.map +1 -1
- package/dist/auth/withBaseAccess.d.ts +22 -0
- package/dist/auth/withBaseAccess.d.ts.map +1 -0
- package/dist/auth/withBaseAccess.js +61 -0
- package/dist/auth/withBaseAccess.js.map +1 -0
- package/dist/cli/commands/build/build.d.ts +44 -0
- package/dist/cli/commands/build/build.d.ts.map +1 -0
- package/dist/cli/commands/build/build.js +225 -0
- package/dist/cli/commands/build/build.js.map +1 -0
- package/dist/cli/commands/build/build.spec.js +582 -0
- package/dist/cli/commands/build/build.spec.js.map +1 -0
- package/dist/cli/commands/build/index.d.ts +2 -0
- package/dist/cli/commands/build/index.d.ts.map +1 -0
- package/dist/cli/commands/build/index.js +26 -0
- package/dist/cli/commands/build/index.js.map +1 -0
- package/dist/cli/commands/collections/countDocuments.d.ts +2 -0
- package/dist/cli/commands/collections/countDocuments.d.ts.map +1 -0
- package/dist/cli/commands/collections/countDocuments.js +37 -0
- package/dist/cli/commands/collections/countDocuments.js.map +1 -0
- package/dist/cli/commands/collections/countVersions.d.ts +2 -0
- package/dist/cli/commands/collections/countVersions.d.ts.map +1 -0
- package/dist/cli/commands/collections/countVersions.js +36 -0
- package/dist/cli/commands/collections/countVersions.js.map +1 -0
- package/dist/cli/commands/collections/createDocuments.d.ts +2 -0
- package/dist/cli/commands/collections/createDocuments.d.ts.map +1 -0
- package/dist/cli/commands/collections/createDocuments.js +130 -0
- package/dist/cli/commands/collections/createDocuments.js.map +1 -0
- package/dist/cli/commands/collections/deleteDocuments.d.ts +2 -0
- package/dist/cli/commands/collections/deleteDocuments.d.ts.map +1 -0
- package/dist/cli/commands/collections/deleteDocuments.js +64 -0
- package/dist/cli/commands/collections/deleteDocuments.js.map +1 -0
- package/dist/cli/commands/collections/duplicateDocument.d.ts +2 -0
- package/dist/cli/commands/collections/duplicateDocument.d.ts.map +1 -0
- package/dist/cli/commands/collections/duplicateDocument.js +107 -0
- package/dist/cli/commands/collections/duplicateDocument.js.map +1 -0
- package/dist/cli/commands/collections/findDistinct.d.ts +2 -0
- package/dist/cli/commands/collections/findDistinct.d.ts.map +1 -0
- package/dist/cli/commands/collections/findDistinct.js +52 -0
- package/dist/cli/commands/collections/findDistinct.js.map +1 -0
- package/dist/cli/commands/collections/findDocuments.d.ts +2 -0
- package/dist/cli/commands/collections/findDocuments.d.ts.map +1 -0
- package/dist/cli/commands/collections/findDocuments.js +79 -0
- package/dist/cli/commands/collections/findDocuments.js.map +1 -0
- package/dist/cli/commands/collections/findVersionByID.d.ts +2 -0
- package/dist/cli/commands/collections/findVersionByID.d.ts.map +1 -0
- package/dist/cli/commands/collections/findVersionByID.js +48 -0
- package/dist/cli/commands/collections/findVersionByID.js.map +1 -0
- package/dist/cli/commands/collections/findVersions.d.ts +2 -0
- package/dist/cli/commands/collections/findVersions.d.ts.map +1 -0
- package/dist/cli/commands/collections/findVersions.js +57 -0
- package/dist/cli/commands/collections/findVersions.js.map +1 -0
- package/dist/cli/commands/collections/getCollectionSchema.d.ts +2 -0
- package/dist/cli/commands/collections/getCollectionSchema.d.ts.map +1 -0
- package/dist/cli/commands/collections/getCollectionSchema.js +49 -0
- package/dist/cli/commands/collections/getCollectionSchema.js.map +1 -0
- package/dist/cli/commands/collections/restoreVersion.d.ts +2 -0
- package/dist/cli/commands/collections/restoreVersion.d.ts.map +1 -0
- package/dist/cli/commands/collections/restoreVersion.js +47 -0
- package/dist/cli/commands/collections/restoreVersion.js.map +1 -0
- package/dist/cli/commands/collections/updateDocument.d.ts +2 -0
- package/dist/cli/commands/collections/updateDocument.d.ts.map +1 -0
- package/dist/cli/commands/collections/updateDocument.js +190 -0
- package/dist/cli/commands/collections/updateDocument.js.map +1 -0
- package/dist/cli/commands/data/input.d.ts +28 -0
- package/dist/cli/commands/data/input.d.ts.map +1 -0
- package/dist/cli/commands/data/input.js +76 -0
- package/dist/cli/commands/data/input.js.map +1 -0
- package/dist/cli/commands/data/utilities.d.ts +65 -0
- package/dist/cli/commands/data/utilities.d.ts.map +1 -0
- package/dist/cli/commands/data/utilities.js +67 -0
- package/dist/cli/commands/data/utilities.js.map +1 -0
- package/dist/cli/commands/generateDBSchema.d.ts +2 -0
- package/dist/cli/commands/generateDBSchema.d.ts.map +1 -0
- package/dist/cli/commands/generateDBSchema.js +29 -0
- package/dist/cli/commands/generateDBSchema.js.map +1 -0
- package/dist/cli/commands/generateImportMap/frameworkConventions.d.ts +8 -0
- package/dist/cli/commands/generateImportMap/frameworkConventions.d.ts.map +1 -0
- package/dist/cli/commands/generateImportMap/frameworkConventions.js +8 -0
- package/dist/cli/commands/generateImportMap/frameworkConventions.js.map +1 -0
- package/dist/{bin/generateImportMap/index.d.ts → cli/commands/generateImportMap/generateImportMap.d.ts} +8 -4
- package/dist/cli/commands/generateImportMap/generateImportMap.d.ts.map +1 -0
- package/dist/{bin/generateImportMap/index.js → cli/commands/generateImportMap/generateImportMap.js} +9 -4
- package/dist/cli/commands/generateImportMap/generateImportMap.js.map +1 -0
- package/dist/cli/commands/generateImportMap/generateImportMap.spec.js.map +1 -0
- package/dist/cli/commands/generateImportMap/index.d.ts +2 -0
- package/dist/cli/commands/generateImportMap/index.d.ts.map +1 -0
- package/dist/cli/commands/generateImportMap/index.js +18 -0
- package/dist/cli/commands/generateImportMap/index.js.map +1 -0
- package/dist/{bin → cli/commands}/generateImportMap/iterateCollections.d.ts +3 -3
- package/dist/cli/commands/generateImportMap/iterateCollections.d.ts.map +1 -0
- package/dist/cli/commands/generateImportMap/iterateCollections.js.map +1 -0
- package/dist/{bin → cli/commands}/generateImportMap/iterateConfig.d.ts +2 -2
- package/dist/cli/commands/generateImportMap/iterateConfig.d.ts.map +1 -0
- package/dist/{bin → cli/commands}/generateImportMap/iterateConfig.js +1 -1
- package/dist/cli/commands/generateImportMap/iterateConfig.js.map +1 -0
- package/dist/{bin → cli/commands}/generateImportMap/iterateFields.d.ts +3 -3
- package/dist/cli/commands/generateImportMap/iterateFields.d.ts.map +1 -0
- package/dist/cli/commands/generateImportMap/iterateFields.js.map +1 -0
- package/dist/{bin → cli/commands}/generateImportMap/iterateGlobals.d.ts +3 -3
- package/dist/cli/commands/generateImportMap/iterateGlobals.d.ts.map +1 -0
- package/dist/cli/commands/generateImportMap/iterateGlobals.js.map +1 -0
- package/dist/{bin → cli/commands}/generateImportMap/utilities/addPayloadComponentToImportMap.d.ts +2 -2
- package/dist/cli/commands/generateImportMap/utilities/addPayloadComponentToImportMap.d.ts.map +1 -0
- package/dist/cli/commands/generateImportMap/utilities/addPayloadComponentToImportMap.js.map +1 -0
- package/dist/{bin → cli/commands}/generateImportMap/utilities/getFromImportMap.d.ts +2 -2
- package/dist/cli/commands/generateImportMap/utilities/getFromImportMap.d.ts.map +1 -0
- package/dist/cli/commands/generateImportMap/utilities/getFromImportMap.js.map +1 -0
- package/dist/cli/commands/generateImportMap/utilities/getImportMapToBaseDirPath.d.ts.map +1 -0
- package/dist/cli/commands/generateImportMap/utilities/getImportMapToBaseDirPath.js.map +1 -0
- package/dist/{bin → cli/commands}/generateImportMap/utilities/parsePayloadComponent.d.ts +1 -1
- package/dist/cli/commands/generateImportMap/utilities/parsePayloadComponent.d.ts.map +1 -0
- package/dist/cli/commands/generateImportMap/utilities/parsePayloadComponent.js.map +1 -0
- package/dist/cli/commands/generateImportMap/utilities/resolveImportMapFilePath.d.ts.map +1 -0
- package/dist/{bin → cli/commands}/generateImportMap/utilities/resolveImportMapFilePath.js +5 -4
- package/dist/cli/commands/generateImportMap/utilities/resolveImportMapFilePath.js.map +1 -0
- package/dist/cli/commands/generateTypes.d.ts +12 -0
- package/dist/cli/commands/generateTypes.d.ts.map +1 -0
- package/dist/{bin → cli/commands}/generateTypes.js +33 -7
- package/dist/cli/commands/generateTypes.js.map +1 -0
- package/dist/cli/commands/getConfigInfo.d.ts +2 -0
- package/dist/cli/commands/getConfigInfo.d.ts.map +1 -0
- package/dist/cli/commands/getConfigInfo.js +23 -0
- package/dist/cli/commands/getConfigInfo.js.map +1 -0
- package/dist/cli/commands/globals/countGlobalVersions.d.ts +2 -0
- package/dist/cli/commands/globals/countGlobalVersions.d.ts.map +1 -0
- package/dist/cli/commands/globals/countGlobalVersions.js +36 -0
- package/dist/cli/commands/globals/countGlobalVersions.js.map +1 -0
- package/dist/cli/commands/globals/findGlobal.d.ts +2 -0
- package/dist/cli/commands/globals/findGlobal.d.ts.map +1 -0
- package/dist/cli/commands/globals/findGlobal.js +42 -0
- package/dist/cli/commands/globals/findGlobal.js.map +1 -0
- package/dist/cli/commands/globals/findGlobalVersionByID.d.ts +2 -0
- package/dist/cli/commands/globals/findGlobalVersionByID.d.ts.map +1 -0
- package/dist/cli/commands/globals/findGlobalVersionByID.js +46 -0
- package/dist/cli/commands/globals/findGlobalVersionByID.js.map +1 -0
- package/dist/cli/commands/globals/findGlobalVersions.d.ts +2 -0
- package/dist/cli/commands/globals/findGlobalVersions.d.ts.map +1 -0
- package/dist/cli/commands/globals/findGlobalVersions.js +55 -0
- package/dist/cli/commands/globals/findGlobalVersions.js.map +1 -0
- package/dist/cli/commands/globals/getGlobalSchema.d.ts +2 -0
- package/dist/cli/commands/globals/getGlobalSchema.d.ts.map +1 -0
- package/dist/cli/commands/globals/getGlobalSchema.js +34 -0
- package/dist/cli/commands/globals/getGlobalSchema.js.map +1 -0
- package/dist/cli/commands/globals/restoreGlobalVersion.d.ts +2 -0
- package/dist/cli/commands/globals/restoreGlobalVersion.d.ts.map +1 -0
- package/dist/cli/commands/globals/restoreGlobalVersion.js +46 -0
- package/dist/cli/commands/globals/restoreGlobalVersion.js.map +1 -0
- package/dist/cli/commands/globals/updateGlobal.d.ts +2 -0
- package/dist/cli/commands/globals/updateGlobal.d.ts.map +1 -0
- package/dist/cli/commands/globals/updateGlobal.js +93 -0
- package/dist/cli/commands/globals/updateGlobal.js.map +1 -0
- package/dist/cli/commands/help.d.ts +2 -0
- package/dist/cli/commands/help.d.ts.map +1 -0
- package/dist/cli/commands/help.js +42 -0
- package/dist/cli/commands/help.js.map +1 -0
- package/dist/cli/commands/info.d.ts +2 -0
- package/dist/cli/commands/info.d.ts.map +1 -0
- package/dist/cli/commands/info.js +78 -0
- package/dist/cli/commands/info.js.map +1 -0
- package/dist/cli/commands/jobs/handleSchedules.d.ts +2 -0
- package/dist/cli/commands/jobs/handleSchedules.d.ts.map +1 -0
- package/dist/cli/commands/jobs/handleSchedules.js +17 -0
- package/dist/cli/commands/jobs/handleSchedules.js.map +1 -0
- package/dist/cli/commands/jobs/run.d.ts +2 -0
- package/dist/cli/commands/jobs/run.d.ts.map +1 -0
- package/dist/cli/commands/jobs/run.js +29 -0
- package/dist/cli/commands/jobs/run.js.map +1 -0
- package/dist/cli/commands/migrate/create.d.ts +2 -0
- package/dist/cli/commands/migrate/create.d.ts.map +1 -0
- package/dist/cli/commands/migrate/create.js +44 -0
- package/dist/cli/commands/migrate/create.js.map +1 -0
- package/dist/cli/commands/migrate/down.d.ts +2 -0
- package/dist/cli/commands/migrate/down.d.ts.map +1 -0
- package/dist/cli/commands/migrate/down.js +22 -0
- package/dist/cli/commands/migrate/down.js.map +1 -0
- package/dist/cli/commands/migrate/fresh.d.ts +2 -0
- package/dist/cli/commands/migrate/fresh.d.ts.map +1 -0
- package/dist/cli/commands/migrate/fresh.js +28 -0
- package/dist/cli/commands/migrate/fresh.js.map +1 -0
- package/dist/cli/commands/migrate/initialize.d.ts +11 -0
- package/dist/cli/commands/migrate/initialize.d.ts.map +1 -0
- package/dist/cli/commands/migrate/initialize.js +17 -0
- package/dist/cli/commands/migrate/initialize.js.map +1 -0
- package/dist/cli/commands/migrate/refresh.d.ts +2 -0
- package/dist/cli/commands/migrate/refresh.d.ts.map +1 -0
- package/dist/cli/commands/migrate/refresh.js +22 -0
- package/dist/cli/commands/migrate/refresh.js.map +1 -0
- package/dist/cli/commands/migrate/reset.d.ts +2 -0
- package/dist/cli/commands/migrate/reset.d.ts.map +1 -0
- package/dist/cli/commands/migrate/reset.js +22 -0
- package/dist/cli/commands/migrate/reset.js.map +1 -0
- package/dist/cli/commands/migrate/run.d.ts +2 -0
- package/dist/cli/commands/migrate/run.d.ts.map +1 -0
- package/dist/cli/commands/migrate/run.js +28 -0
- package/dist/cli/commands/migrate/run.js.map +1 -0
- package/dist/cli/commands/migrate/status.d.ts +2 -0
- package/dist/cli/commands/migrate/status.d.ts.map +1 -0
- package/dist/cli/commands/migrate/status.js +22 -0
- package/dist/cli/commands/migrate/status.js.map +1 -0
- package/dist/cli/commands/run.d.ts +2 -0
- package/dist/cli/commands/run.d.ts.map +1 -0
- package/dist/cli/commands/run.js +45 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/defineCLICommand.d.ts +32 -0
- package/dist/cli/defineCLICommand.d.ts.map +1 -0
- package/dist/cli/defineCLICommand.js +26 -0
- package/dist/cli/defineCLICommand.js.map +1 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +95 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/index.spec.js +402 -0
- package/dist/cli/index.spec.js.map +1 -0
- package/dist/cli/program/createHelp.d.ts +8 -0
- package/dist/cli/program/createHelp.d.ts.map +1 -0
- package/dist/cli/program/createHelp.js +26 -0
- package/dist/cli/program/createHelp.js.map +1 -0
- package/dist/cli/program/loadCommands.d.ts +12 -0
- package/dist/cli/program/loadCommands.d.ts.map +1 -0
- package/dist/cli/program/loadCommands.js +62 -0
- package/dist/cli/program/loadCommands.js.map +1 -0
- package/dist/cli/program/normalizeHelpArguments.d.ts +12 -0
- package/dist/cli/program/normalizeHelpArguments.d.ts.map +1 -0
- package/dist/cli/program/normalizeHelpArguments.js +34 -0
- package/dist/cli/program/normalizeHelpArguments.js.map +1 -0
- package/dist/cli/program/registerCommand.d.ts +10 -0
- package/dist/cli/program/registerCommand.d.ts.map +1 -0
- package/dist/cli/program/registerCommand.js +185 -0
- package/dist/cli/program/registerCommand.js.map +1 -0
- package/dist/cli/runtime/createRuntime.d.ts +9 -0
- package/dist/cli/runtime/createRuntime.d.ts.map +1 -0
- package/dist/cli/runtime/createRuntime.js +81 -0
- package/dist/cli/runtime/createRuntime.js.map +1 -0
- package/dist/cli/runtime/getCommandInput.d.ts +17 -0
- package/dist/cli/runtime/getCommandInput.d.ts.map +1 -0
- package/dist/cli/runtime/getCommandInput.js +86 -0
- package/dist/cli/runtime/getCommandInput.js.map +1 -0
- package/dist/cli/runtime/getCommandInput.spec.js +74 -0
- package/dist/cli/runtime/getCommandInput.spec.js.map +1 -0
- package/dist/cli/runtime/invokeCommand.d.ts +23 -0
- package/dist/cli/runtime/invokeCommand.d.ts.map +1 -0
- package/dist/cli/runtime/invokeCommand.js +107 -0
- package/dist/cli/runtime/invokeCommand.js.map +1 -0
- package/dist/cli/runtime/loadEnv.d.ts.map +1 -0
- package/dist/{bin → cli/runtime}/loadEnv.js +1 -1
- package/dist/cli/runtime/loadEnv.js.map +1 -0
- package/dist/cli/runtime/output.d.ts +50 -0
- package/dist/cli/runtime/output.d.ts.map +1 -0
- package/dist/cli/runtime/output.js +125 -0
- package/dist/cli/runtime/output.js.map +1 -0
- package/dist/cli/runtime/redirectOutputToStderr.d.ts +8 -0
- package/dist/cli/runtime/redirectOutputToStderr.d.ts.map +1 -0
- package/dist/cli/runtime/redirectOutputToStderr.js +31 -0
- package/dist/cli/runtime/redirectOutputToStderr.js.map +1 -0
- package/dist/collections/config/client.d.ts +11 -5
- package/dist/collections/config/client.d.ts.map +1 -1
- package/dist/collections/config/client.js +6 -1
- package/dist/collections/config/client.js.map +1 -1
- package/dist/collections/config/defaults.d.ts +4 -4
- package/dist/collections/config/defaults.d.ts.map +1 -1
- package/dist/collections/config/defaults.js +37 -32
- package/dist/collections/config/defaults.js.map +1 -1
- package/dist/collections/config/sanitize.d.ts +4 -8
- package/dist/collections/config/sanitize.d.ts.map +1 -1
- package/dist/collections/config/sanitize.js +31 -21
- package/dist/collections/config/sanitize.js.map +1 -1
- package/dist/collections/config/sanitize.spec.js +363 -1
- package/dist/collections/config/sanitize.spec.js.map +1 -1
- package/dist/collections/config/sanitizeCompoundIndexes.d.ts.map +1 -1
- package/dist/collections/config/types.d.ts +56 -51
- package/dist/collections/config/types.d.ts.map +1 -1
- package/dist/collections/config/types.js.map +1 -1
- package/dist/collections/config/useAsTitle.d.ts.map +1 -1
- package/dist/collections/config/useAsTitle.spec.js +27 -27
- package/dist/collections/config/useAsTitle.spec.js.map +1 -1
- package/dist/collections/dataloader.d.ts +1 -1
- package/dist/collections/dataloader.d.ts.map +1 -1
- package/dist/collections/operations/count.d.ts.map +1 -1
- package/dist/collections/operations/count.js +65 -70
- package/dist/collections/operations/count.js.map +1 -1
- package/dist/collections/operations/countVersions.d.ts.map +1 -1
- package/dist/collections/operations/countVersions.js +61 -66
- package/dist/collections/operations/countVersions.js.map +1 -1
- package/dist/collections/operations/create.d.ts.map +1 -1
- package/dist/collections/operations/create.js +22 -0
- package/dist/collections/operations/create.js.map +1 -1
- package/dist/collections/operations/delete.d.ts.map +1 -1
- package/dist/collections/operations/delete.js +215 -129
- package/dist/collections/operations/delete.js.map +1 -1
- package/dist/collections/operations/deleteByID.d.ts.map +1 -1
- package/dist/collections/operations/deleteByID.js +1 -0
- package/dist/collections/operations/deleteByID.js.map +1 -1
- package/dist/collections/operations/docAccess.d.ts.map +1 -1
- package/dist/collections/operations/docAccess.js +19 -25
- package/dist/collections/operations/docAccess.js.map +1 -1
- package/dist/collections/operations/duplicate.d.ts.map +1 -1
- package/dist/collections/operations/find.d.ts.map +1 -1
- package/dist/collections/operations/find.js +248 -246
- package/dist/collections/operations/find.js.map +1 -1
- package/dist/collections/operations/findByID.d.ts.map +1 -1
- package/dist/collections/operations/findByID.js +215 -220
- package/dist/collections/operations/findByID.js.map +1 -1
- package/dist/collections/operations/findDistinct.d.ts.map +1 -1
- package/dist/collections/operations/findDistinct.js +161 -159
- package/dist/collections/operations/findDistinct.js.map +1 -1
- package/dist/collections/operations/findVersionByID.d.ts.map +1 -1
- package/dist/collections/operations/findVersionByID.js +131 -136
- package/dist/collections/operations/findVersionByID.js.map +1 -1
- package/dist/collections/operations/findVersions.d.ts.map +1 -1
- package/dist/collections/operations/findVersions.js +152 -149
- package/dist/collections/operations/findVersions.js.map +1 -1
- package/dist/collections/operations/inputSchemas.d.ts +877 -0
- package/dist/collections/operations/inputSchemas.d.ts.map +1 -0
- package/dist/collections/operations/inputSchemas.js +217 -0
- package/dist/collections/operations/inputSchemas.js.map +1 -0
- package/dist/collections/operations/restoreVersion.d.ts.map +1 -1
- package/dist/collections/operations/restoreVersion.js +8 -4
- package/dist/collections/operations/restoreVersion.js.map +1 -1
- package/dist/collections/operations/update.d.ts.map +1 -1
- package/dist/collections/operations/update.js +20 -1
- package/dist/collections/operations/update.js.map +1 -1
- package/dist/collections/operations/updateByID.d.ts.map +1 -1
- package/dist/collections/operations/updateByID.js +13 -0
- package/dist/collections/operations/updateByID.js.map +1 -1
- package/dist/collections/operations/utilities/buildAfterOperation.d.ts +1 -1
- package/dist/collections/operations/utilities/buildAfterOperation.d.ts.map +1 -1
- package/dist/collections/operations/utilities/copyDataWithFreshRowIDs.d.ts.map +1 -1
- package/dist/collections/operations/utilities/sanitizeSortQuery.d.ts.map +1 -1
- package/dist/collections/operations/utilities/types.d.ts +20 -20
- package/dist/collections/operations/utilities/types.d.ts.map +1 -1
- package/dist/collections/operations/utilities/update.d.ts.map +1 -1
- package/dist/config/build.js +1 -1
- package/dist/config/build.js.map +1 -1
- package/dist/config/client.d.ts +2 -2
- package/dist/config/client.d.ts.map +1 -1
- package/dist/config/client.js +2 -1
- package/dist/config/client.js.map +1 -1
- package/dist/config/client.spec.js +20 -0
- package/dist/config/client.spec.js.map +1 -0
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +95 -42
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/orderable/fractional-indexing.d.ts +23 -23
- package/dist/config/orderable/fractional-indexing.d.ts.map +1 -1
- package/dist/config/orderable/index.d.ts +1 -1
- package/dist/config/orderable/index.d.ts.map +1 -1
- package/dist/config/orderable/index.js +3 -2
- package/dist/config/orderable/index.js.map +1 -1
- package/dist/config/sanitize.d.ts +1 -1
- package/dist/config/sanitize.d.ts.map +1 -1
- package/dist/config/sanitize.js +42 -32
- package/dist/config/sanitize.js.map +1 -1
- package/dist/config/sanitize.spec.js +105 -0
- package/dist/config/sanitize.spec.js.map +1 -0
- package/dist/config/types.d.ts +495 -421
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js.map +1 -1
- package/dist/database/combineQueries.d.ts.map +1 -1
- package/dist/database/createDatabaseAdapter.d.ts +1 -1
- package/dist/database/createDatabaseAdapter.d.ts.map +1 -1
- package/dist/database/createDatabaseAdapter.js +0 -2
- package/dist/database/createDatabaseAdapter.js.map +1 -1
- package/dist/database/isNestedRelationshipQuery.d.ts +14 -0
- package/dist/database/isNestedRelationshipQuery.d.ts.map +1 -0
- package/dist/database/isNestedRelationshipQuery.js +19 -0
- package/dist/database/isNestedRelationshipQuery.js.map +1 -0
- package/dist/database/migrations/createMigration.d.ts.map +1 -1
- package/dist/database/migrations/createMigration.js +4 -0
- package/dist/database/migrations/createMigration.js.map +1 -1
- package/dist/database/migrations/findMigrationDir.d.ts.map +1 -1
- package/dist/database/migrations/getPredefinedMigration.d.ts.map +1 -1
- package/dist/database/migrations/getPredefinedMigration.js +2 -2
- package/dist/database/migrations/getPredefinedMigration.js.map +1 -1
- package/dist/database/migrations/migrate.d.ts.map +1 -1
- package/dist/database/migrations/migrate.js +9 -0
- package/dist/database/migrations/migrate.js.map +1 -1
- package/dist/database/migrations/migrateDown.d.ts +2 -2
- package/dist/database/migrations/migrateDown.d.ts.map +1 -1
- package/dist/database/migrations/migrateDown.js +12 -2
- package/dist/database/migrations/migrateDown.js.map +1 -1
- package/dist/database/migrations/migrateRefresh.d.ts +2 -2
- package/dist/database/migrations/migrateRefresh.d.ts.map +1 -1
- package/dist/database/migrations/migrateRefresh.js +10 -2
- package/dist/database/migrations/migrateRefresh.js.map +1 -1
- package/dist/database/migrations/migrateReset.d.ts +2 -2
- package/dist/database/migrations/migrateReset.d.ts.map +1 -1
- package/dist/database/migrations/migrateReset.js +11 -1
- package/dist/database/migrations/migrateReset.js.map +1 -1
- package/dist/database/migrations/migrateStatus.d.ts +2 -2
- package/dist/database/migrations/migrateStatus.d.ts.map +1 -1
- package/dist/database/migrations/migrateStatus.js +11 -6
- package/dist/database/migrations/migrateStatus.js.map +1 -1
- package/dist/database/migrations/readMigrationFiles.d.ts.map +1 -1
- package/dist/database/migrations/writeMigrationIndex.d.ts.map +1 -1
- package/dist/database/queryValidation/validateQueryPaths.d.ts.map +1 -1
- package/dist/database/queryValidation/validateQueryPaths.js +8 -1
- package/dist/database/queryValidation/validateQueryPaths.js.map +1 -1
- package/dist/database/queryValidation/validateSearchParams.d.ts.map +1 -1
- package/dist/database/queryValidation/validateSearchParams.js +21 -4
- package/dist/database/queryValidation/validateSearchParams.js.map +1 -1
- package/dist/database/queryValidation/validateSortQuery.d.ts +23 -0
- package/dist/database/queryValidation/validateSortQuery.d.ts.map +1 -0
- package/dist/database/queryValidation/validateSortQuery.js +54 -0
- package/dist/database/queryValidation/validateSortQuery.js.map +1 -0
- package/dist/database/sanitizeJoinQuery.d.ts.map +1 -1
- package/dist/database/sanitizeJoinQuery.js +7 -0
- package/dist/database/sanitizeJoinQuery.js.map +1 -1
- package/dist/database/sanitizeWhereQuery.d.ts +1 -1
- package/dist/database/sanitizeWhereQuery.d.ts.map +1 -1
- package/dist/database/sanitizeWhereQuery.js +44 -1
- package/dist/database/sanitizeWhereQuery.js.map +1 -1
- package/dist/database/types.d.ts +37 -13
- package/dist/database/types.d.ts.map +1 -1
- package/dist/database/types.js.map +1 -1
- package/dist/duplicateDocument/index.d.ts.map +1 -1
- package/dist/duplicateDocument/index.js +1 -0
- package/dist/duplicateDocument/index.js.map +1 -1
- package/dist/email/getStringifiedToAddress.d.ts.map +1 -1
- package/dist/errors/APIError.d.ts.map +1 -1
- package/dist/errors/AuthenticationError.d.ts.map +1 -1
- package/dist/errors/DuplicateCollection.d.ts.map +1 -1
- package/dist/errors/DuplicateFieldName.d.ts.map +1 -1
- package/dist/errors/DuplicateGlobal.d.ts.map +1 -1
- package/dist/errors/ErrorDeletingFile.d.ts.map +1 -1
- package/dist/errors/FileRetrievalError.d.ts.map +1 -1
- package/dist/errors/FileUploadError.d.ts.map +1 -1
- package/dist/errors/Forbidden.d.ts.map +1 -1
- package/dist/errors/InvalidConfiguration.d.ts.map +1 -1
- package/dist/errors/InvalidFieldJoin.d.ts.map +1 -1
- package/dist/errors/InvalidFieldName.d.ts.map +1 -1
- package/dist/errors/InvalidFieldRelationship.d.ts.map +1 -1
- package/dist/errors/InvalidSchema.d.ts.map +1 -1
- package/dist/errors/Locked.d.ts.map +1 -1
- package/dist/errors/LockedAuth.d.ts.map +1 -1
- package/dist/errors/MissingCollectionLabel.d.ts.map +1 -1
- package/dist/errors/MissingEditorProp.d.ts.map +1 -1
- package/dist/errors/MissingFieldInputOptions.d.ts.map +1 -1
- package/dist/errors/MissingFieldType.d.ts.map +1 -1
- package/dist/errors/MissingFile.d.ts.map +1 -1
- package/dist/errors/NotFound.d.ts.map +1 -1
- package/dist/errors/QueryError.d.ts.map +1 -1
- package/dist/errors/ReservedFieldName.d.ts.map +1 -1
- package/dist/errors/TimestampsRequired.d.ts.map +1 -1
- package/dist/errors/UnauthorizedError.d.ts.map +1 -1
- package/dist/errors/UnverifiedEmail.d.ts.map +1 -1
- package/dist/errors/ValidationError.d.ts.map +1 -1
- package/dist/exports/auth.d.ts +5 -0
- package/dist/exports/auth.d.ts.map +1 -0
- package/dist/exports/auth.js +6 -0
- package/dist/exports/auth.js.map +1 -0
- package/dist/exports/cli.d.ts +4 -0
- package/dist/exports/cli.d.ts.map +1 -0
- package/dist/exports/cli.js +4 -0
- package/dist/exports/cli.js.map +1 -0
- package/dist/exports/cliBuiltin.d.ts +37 -0
- package/dist/exports/cliBuiltin.d.ts.map +1 -0
- package/dist/exports/cliBuiltin.js +38 -0
- package/dist/exports/cliBuiltin.js.map +1 -0
- package/dist/exports/internal.d.ts +9 -1
- package/dist/exports/internal.d.ts.map +1 -1
- package/dist/exports/internal.js +8 -1
- package/dist/exports/internal.js.map +1 -1
- package/dist/exports/node.d.ts +2 -2
- package/dist/exports/node.d.ts.map +1 -1
- package/dist/exports/node.js +2 -2
- package/dist/exports/node.js.map +1 -1
- package/dist/exports/shared.d.ts +6 -4
- package/dist/exports/shared.d.ts.map +1 -1
- package/dist/exports/shared.js +4 -3
- package/dist/exports/shared.js.map +1 -1
- package/dist/fields/baseFields/slug/duplicateContext.d.ts +11 -0
- package/dist/fields/baseFields/slug/duplicateContext.d.ts.map +1 -0
- package/dist/fields/baseFields/slug/duplicateContext.js +21 -0
- package/dist/fields/baseFields/slug/duplicateContext.js.map +1 -0
- package/dist/fields/baseFields/slug/fillEmptyLocalizedSlugs.d.ts +23 -0
- package/dist/fields/baseFields/slug/fillEmptyLocalizedSlugs.d.ts.map +1 -0
- package/dist/fields/baseFields/slug/fillEmptyLocalizedSlugs.js +65 -0
- package/dist/fields/baseFields/slug/fillEmptyLocalizedSlugs.js.map +1 -0
- package/dist/fields/baseFields/slug/generateSlug.d.ts +19 -7
- package/dist/fields/baseFields/slug/generateSlug.d.ts.map +1 -1
- package/dist/fields/baseFields/slug/generateSlug.js +111 -74
- package/dist/fields/baseFields/slug/generateSlug.js.map +1 -1
- package/dist/fields/baseFields/slug/generateSlugBeforeDuplicate.d.ts +18 -0
- package/dist/fields/baseFields/slug/generateSlugBeforeDuplicate.d.ts.map +1 -0
- package/dist/fields/baseFields/slug/generateSlugBeforeDuplicate.js +20 -0
- package/dist/fields/baseFields/slug/generateSlugBeforeDuplicate.js.map +1 -0
- package/dist/fields/baseFields/slug/getSlugFallbackValue.d.ts +23 -0
- package/dist/fields/baseFields/slug/getSlugFallbackValue.d.ts.map +1 -0
- package/dist/fields/baseFields/slug/getSlugFallbackValue.js +24 -0
- package/dist/fields/baseFields/slug/getSlugFallbackValue.js.map +1 -0
- package/dist/fields/baseFields/slug/hasValue.d.ts +3 -0
- package/dist/fields/baseFields/slug/hasValue.d.ts.map +1 -0
- package/dist/fields/baseFields/slug/hasValue.js +3 -0
- package/dist/fields/baseFields/slug/hasValue.js.map +1 -0
- package/dist/fields/baseFields/slug/types.d.ts +14 -0
- package/dist/fields/baseFields/slug/types.d.ts.map +1 -0
- package/dist/fields/baseFields/slug/types.js +6 -0
- package/dist/fields/baseFields/slug/types.js.map +1 -0
- package/dist/fields/config/client.d.ts +5 -5
- package/dist/fields/config/client.d.ts.map +1 -1
- package/dist/fields/config/client.js +3 -2
- package/dist/fields/config/client.js.map +1 -1
- package/dist/fields/config/reservedFieldNames.spec.js +18 -18
- package/dist/fields/config/reservedFieldNames.spec.js.map +1 -1
- package/dist/fields/config/sanitize.d.ts +6 -6
- package/dist/fields/config/sanitize.d.ts.map +1 -1
- package/dist/fields/config/sanitize.js +68 -19
- package/dist/fields/config/sanitize.js.map +1 -1
- package/dist/fields/config/sanitize.spec.js +105 -105
- package/dist/fields/config/sanitize.spec.js.map +1 -1
- package/dist/fields/config/sanitizeJoinField.d.ts.map +1 -1
- package/dist/fields/config/types.d.ts +37 -11
- package/dist/fields/config/types.d.ts.map +1 -1
- package/dist/fields/config/types.js +1 -1
- package/dist/fields/config/types.js.map +1 -1
- package/dist/fields/getDefaultValue.d.ts.map +1 -1
- package/dist/fields/hooks/afterChange/index.d.ts.map +1 -1
- package/dist/fields/hooks/afterChange/promise.d.ts.map +1 -1
- package/dist/fields/hooks/afterChange/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/promise.js +1 -0
- package/dist/fields/hooks/afterRead/promise.js.map +1 -1
- package/dist/fields/hooks/afterRead/relationshipPopulationPromise.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/virtualFieldPopulationPromise.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/cloneDataFromOriginalDoc.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/getExistingRowDoc.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/index.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/promise.js +1 -0
- package/dist/fields/hooks/beforeChange/promise.js.map +1 -1
- package/dist/fields/hooks/beforeChange/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/beforeDuplicate/index.d.ts.map +1 -1
- package/dist/fields/hooks/beforeDuplicate/promise.d.ts.map +1 -1
- package/dist/fields/hooks/beforeDuplicate/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/beforeValidate/index.d.ts.map +1 -1
- package/dist/fields/hooks/beforeValidate/promise.d.ts.map +1 -1
- package/dist/fields/hooks/beforeValidate/promise.js +5 -3
- package/dist/fields/hooks/beforeValidate/promise.js.map +1 -1
- package/dist/fields/hooks/beforeValidate/stripNullRows.d.ts +10 -0
- package/dist/fields/hooks/beforeValidate/stripNullRows.d.ts.map +1 -0
- package/dist/fields/hooks/beforeValidate/stripNullRows.js +18 -0
- package/dist/fields/hooks/beforeValidate/stripNullRows.js.map +1 -0
- package/dist/fields/hooks/beforeValidate/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/beforeValidate/traverseFields.js +2 -0
- package/dist/fields/hooks/beforeValidate/traverseFields.js.map +1 -1
- package/dist/fields/isFieldDisabled.d.ts.map +1 -1
- package/dist/fields/mergeBaseFields.d.ts.map +1 -1
- package/dist/fields/setDefaultBeforeDuplicate.d.ts.map +1 -1
- package/dist/fields/setDefaultBeforeDuplicate.js +1 -0
- package/dist/fields/setDefaultBeforeDuplicate.js.map +1 -1
- package/dist/fields/sortableFieldTypes.d.ts.map +1 -1
- package/dist/fields/sortableFieldTypes.js +1 -0
- package/dist/fields/sortableFieldTypes.js.map +1 -1
- package/dist/fields/validations.d.ts +4 -1
- package/dist/fields/validations.d.ts.map +1 -1
- package/dist/fields/validations.js +8 -2
- package/dist/fields/validations.js.map +1 -1
- package/dist/fields/validations.spec.js +61 -37
- package/dist/fields/validations.spec.js.map +1 -1
- package/dist/globals/config/client.d.ts +5 -5
- package/dist/globals/config/client.d.ts.map +1 -1
- package/dist/globals/config/client.js.map +1 -1
- package/dist/globals/config/sanitize.d.ts +3 -7
- package/dist/globals/config/sanitize.d.ts.map +1 -1
- package/dist/globals/config/sanitize.js +26 -6
- package/dist/globals/config/sanitize.js.map +1 -1
- package/dist/globals/config/sanitize.spec.js +227 -8
- package/dist/globals/config/sanitize.spec.js.map +1 -1
- package/dist/globals/config/types.d.ts +21 -16
- package/dist/globals/config/types.d.ts.map +1 -1
- package/dist/globals/config/types.js.map +1 -1
- package/dist/globals/operations/countGlobalVersions.d.ts.map +1 -1
- package/dist/globals/operations/countGlobalVersions.js +51 -55
- package/dist/globals/operations/countGlobalVersions.js.map +1 -1
- package/dist/globals/operations/docAccess.d.ts.map +1 -1
- package/dist/globals/operations/docAccess.js +19 -25
- package/dist/globals/operations/docAccess.js.map +1 -1
- package/dist/globals/operations/findOne.d.ts.map +1 -1
- package/dist/globals/operations/findOne.js +169 -174
- package/dist/globals/operations/findOne.js.map +1 -1
- package/dist/globals/operations/findVersionByID.d.ts.map +1 -1
- package/dist/globals/operations/findVersionByID.js +104 -109
- package/dist/globals/operations/findVersionByID.js.map +1 -1
- package/dist/globals/operations/findVersions.d.ts.map +1 -1
- package/dist/globals/operations/findVersions.js +112 -109
- package/dist/globals/operations/findVersions.js.map +1 -1
- package/dist/globals/operations/inputSchemas.d.ts +365 -0
- package/dist/globals/operations/inputSchemas.d.ts.map +1 -0
- package/dist/globals/operations/inputSchemas.js +104 -0
- package/dist/globals/operations/inputSchemas.js.map +1 -0
- package/dist/globals/operations/restoreVersion.d.ts.map +1 -1
- package/dist/globals/operations/restoreVersion.js +1 -0
- package/dist/globals/operations/restoreVersion.js.map +1 -1
- package/dist/globals/operations/update.d.ts.map +1 -1
- package/dist/globals/operations/update.js +1 -0
- package/dist/globals/operations/update.js.map +1 -1
- package/dist/hierarchy/addHierarchyToCollection.d.ts.map +1 -1
- package/dist/hierarchy/addHierarchyToCollection.js +2 -0
- package/dist/hierarchy/addHierarchyToCollection.js.map +1 -1
- package/dist/hierarchy/buildParentField.d.ts.map +1 -1
- package/dist/hierarchy/constants.d.ts.map +1 -1
- package/dist/hierarchy/getInitialTreeData.d.ts.map +1 -1
- package/dist/hierarchy/hooks/collectionAfterDelete.d.ts.map +1 -1
- package/dist/hierarchy/hooks/collectionAfterRead.d.ts.map +1 -1
- package/dist/hierarchy/hooks/collectionBeforeChange.d.ts.map +1 -1
- package/dist/hierarchy/hooks/collectionBeforeDelete.d.ts.map +1 -1
- package/dist/hierarchy/hooks/collectionBeforeOperation.d.ts.map +1 -1
- package/dist/hierarchy/hooks/ensureSafeCollectionsChange.d.ts.map +1 -1
- package/dist/hierarchy/injectHierarchyButton.d.ts.map +1 -1
- package/dist/hierarchy/resolveHierarchyCollections.d.ts.map +1 -1
- package/dist/hierarchy/sanitizeHierarchyCollection.d.ts.map +1 -1
- package/dist/index.bundled.d.ts +5889 -4239
- package/dist/index.d.ts +102 -44
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +84 -64
- package/dist/index.js.map +1 -1
- package/dist/kv/adapters/DatabaseKVAdapter.d.ts.map +1 -1
- package/dist/kv/adapters/InMemoryKVAdapter.d.ts.map +1 -1
- package/dist/locked-documents/config.d.ts.map +1 -1
- package/dist/preferences/config.d.ts.map +1 -1
- package/dist/preferences/deleteUserPreferences.d.ts.map +1 -1
- package/dist/preferences/keys.d.ts +5 -5
- package/dist/preferences/keys.d.ts.map +1 -1
- package/dist/query-presets/access.d.ts.map +1 -1
- package/dist/query-presets/config.d.ts.map +1 -1
- package/dist/query-presets/constraints.d.ts.map +1 -1
- package/dist/query-presets/constraints.js +1 -1
- package/dist/query-presets/constraints.js.map +1 -1
- package/dist/query-presets/types.d.ts +1 -1
- package/dist/query-presets/types.d.ts.map +1 -1
- package/dist/queues/config/collection.d.ts.map +1 -1
- package/dist/queues/config/collection.js +43 -43
- package/dist/queues/config/collection.js.map +1 -1
- package/dist/queues/config/global.d.ts +5 -6
- package/dist/queues/config/global.d.ts.map +1 -1
- package/dist/queues/config/global.js +1 -1
- package/dist/queues/config/global.js.map +1 -1
- package/dist/queues/config/types/index.d.ts +31 -24
- package/dist/queues/config/types/index.d.ts.map +1 -1
- package/dist/queues/config/types/index.js.map +1 -1
- package/dist/queues/config/types/taskTypes.d.ts +4 -7
- package/dist/queues/config/types/taskTypes.d.ts.map +1 -1
- package/dist/queues/config/types/taskTypes.js.map +1 -1
- package/dist/queues/config/types/workflowJSONTypes.d.ts +10 -9
- package/dist/queues/config/types/workflowJSONTypes.d.ts.map +1 -1
- package/dist/queues/config/types/workflowJSONTypes.js.map +1 -1
- package/dist/queues/config/types/workflowTypes.d.ts +11 -58
- package/dist/queues/config/types/workflowTypes.d.ts.map +1 -1
- package/dist/queues/config/types/workflowTypes.js.map +1 -1
- package/dist/queues/endpoints/handleSchedules.d.ts.map +1 -1
- package/dist/queues/endpoints/handleSchedules.js +3 -2
- package/dist/queues/endpoints/handleSchedules.js.map +1 -1
- package/dist/queues/endpoints/run.d.ts.map +1 -1
- package/dist/queues/endpoints/run.js +2 -1
- package/dist/queues/endpoints/run.js.map +1 -1
- package/dist/queues/errors/handleTaskError.js +4 -4
- package/dist/queues/errors/handleTaskError.js.map +1 -1
- package/dist/queues/errors/handleWorkflowError.js +1 -1
- package/dist/queues/errors/handleWorkflowError.js.map +1 -1
- package/dist/queues/errors/index.d.ts +6 -0
- package/dist/queues/errors/index.d.ts.map +1 -1
- package/dist/queues/errors/index.js +5 -0
- package/dist/queues/errors/index.js.map +1 -1
- package/dist/queues/localAPI.d.ts +9 -9
- package/dist/queues/localAPI.d.ts.map +1 -1
- package/dist/queues/localAPI.js +63 -66
- package/dist/queues/localAPI.js.map +1 -1
- package/dist/queues/operations/handleSchedules/countRunnableOrActiveJobsForQueue.d.ts +4 -4
- package/dist/queues/operations/handleSchedules/countRunnableOrActiveJobsForQueue.d.ts.map +1 -1
- package/dist/queues/operations/handleSchedules/countRunnableOrActiveJobsForQueue.js.map +1 -1
- package/dist/queues/operations/handleSchedules/getQueuesWithSchedules.d.ts.map +1 -1
- package/dist/queues/operations/handleSchedules/index.d.ts +1 -1
- package/dist/queues/operations/handleSchedules/index.d.ts.map +1 -1
- package/dist/queues/operations/handleSchedules/index.js +1 -1
- package/dist/queues/operations/handleSchedules/index.js.map +1 -1
- package/dist/queues/operations/runJobs/heartbeat.d.ts +13 -0
- package/dist/queues/operations/runJobs/heartbeat.d.ts.map +1 -0
- package/dist/queues/operations/runJobs/heartbeat.js +66 -0
- package/dist/queues/operations/runJobs/heartbeat.js.map +1 -0
- package/dist/queues/operations/runJobs/index.d.ts.map +1 -1
- package/dist/queues/operations/runJobs/index.js +133 -84
- package/dist/queues/operations/runJobs/index.js.map +1 -1
- package/dist/queues/operations/runJobs/runJSONJob/index.d.ts.map +1 -1
- package/dist/queues/operations/runJobs/runJSONJob/index.js +6 -3
- package/dist/queues/operations/runJobs/runJSONJob/index.js.map +1 -1
- package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.d.ts.map +1 -1
- package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js +5 -5
- package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js.map +1 -1
- package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.d.ts +2 -1
- package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.d.ts.map +1 -1
- package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.js +39 -8
- package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.js.map +1 -1
- package/dist/queues/operations/runJobs/runJob/importHandlerPath.d.ts +1 -1
- package/dist/queues/operations/runJobs/runJob/importHandlerPath.d.ts.map +1 -1
- package/dist/queues/operations/runJobs/runJob/importHandlerPath.js.map +1 -1
- package/dist/queues/operations/runJobs/runJob/index.d.ts.map +1 -1
- package/dist/queues/operations/runJobs/runJob/index.js +4 -4
- package/dist/queues/operations/runJobs/runJob/index.js.map +1 -1
- package/dist/queues/utilities/getCurrentDate.d.ts.map +1 -1
- package/dist/queues/utilities/getJobTaskStatus.d.ts.map +1 -1
- package/dist/queues/utilities/updateJob.d.ts.map +1 -1
- package/dist/queues/utilities/updateJob.js +3 -0
- package/dist/queues/utilities/updateJob.js.map +1 -1
- package/dist/translations/getLocalI18n.d.ts.map +1 -1
- package/dist/types/constants.d.ts +23 -2
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/constants.js +23 -0
- package/dist/types/constants.js.map +1 -1
- package/dist/types/index.d.ts +4 -7
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/uploads/checkFileAccess.d.ts.map +1 -1
- package/dist/uploads/checkFileAccess.js +1 -0
- package/dist/uploads/checkFileAccess.js.map +1 -1
- package/dist/uploads/checkFileRestrictions.d.ts +1 -1
- package/dist/uploads/checkFileRestrictions.d.ts.map +1 -1
- package/dist/uploads/checkFileRestrictions.js +15 -1
- package/dist/uploads/checkFileRestrictions.js.map +1 -1
- package/dist/uploads/cropImage.d.ts +1 -1
- package/dist/uploads/cropImage.d.ts.map +1 -1
- package/dist/uploads/cropImage.js +2 -5
- package/dist/uploads/cropImage.js.map +1 -1
- package/dist/uploads/cropImage.spec.js +71 -0
- package/dist/uploads/cropImage.spec.js.map +1 -0
- package/dist/uploads/docWithFilenameExists.d.ts.map +1 -1
- package/dist/uploads/downloadFileToBuffer.d.ts +11 -0
- package/dist/uploads/downloadFileToBuffer.d.ts.map +1 -0
- package/dist/uploads/downloadFileToBuffer.js +41 -0
- package/dist/uploads/downloadFileToBuffer.js.map +1 -0
- package/dist/uploads/endpoints/index.js +2 -2
- package/dist/uploads/endpoints/index.js.map +1 -1
- package/dist/uploads/endpoints/pasteURL.d.ts +3 -0
- package/dist/uploads/endpoints/pasteURL.d.ts.map +1 -0
- package/dist/uploads/endpoints/{getFileFromURL.js → pasteURL.js} +19 -55
- package/dist/uploads/endpoints/pasteURL.js.map +1 -0
- package/dist/uploads/endpoints/uploadInstructions.d.ts +15 -0
- package/dist/uploads/endpoints/uploadInstructions.d.ts.map +1 -0
- package/dist/uploads/endpoints/uploadInstructions.js +84 -0
- package/dist/uploads/endpoints/uploadInstructions.js.map +1 -0
- package/dist/uploads/fetchAPI-multipart/isEligibleRequest.d.ts.map +1 -1
- package/dist/uploads/fetchAPI-multipart/isEligibleRequest.js +1 -2
- package/dist/uploads/fetchAPI-multipart/isEligibleRequest.js.map +1 -1
- package/dist/uploads/fetchAPI-multipart/isEligibleRequest.spec.js +28 -0
- package/dist/uploads/fetchAPI-multipart/isEligibleRequest.spec.js.map +1 -1
- package/dist/uploads/fetchAPI-multipart/processMultipart.d.ts.map +1 -1
- package/dist/uploads/fetchAPI-multipart/processMultipart.js +4 -0
- package/dist/uploads/fetchAPI-multipart/processMultipart.js.map +1 -1
- package/dist/uploads/fetchAPI-multipart/processNested.d.ts.map +1 -1
- package/dist/uploads/fetchAPI-multipart/utilities.d.ts.map +1 -1
- package/dist/uploads/fetchWithRedirects.d.ts +17 -0
- package/dist/uploads/fetchWithRedirects.d.ts.map +1 -0
- package/dist/uploads/fetchWithRedirects.js +39 -0
- package/dist/uploads/fetchWithRedirects.js.map +1 -0
- package/dist/uploads/fileExists.d.ts.map +1 -1
- package/dist/uploads/generateFileData.d.ts +9 -0
- package/dist/uploads/generateFileData.d.ts.map +1 -1
- package/dist/uploads/generateFileData.js +62 -48
- package/dist/uploads/generateFileData.js.map +1 -1
- package/dist/uploads/generateFileData.spec.js +207 -0
- package/dist/uploads/generateFileData.spec.js.map +1 -0
- package/dist/uploads/generateFileData.tempFileBuffering.spec.js +81 -0
- package/dist/uploads/generateFileData.tempFileBuffering.spec.js.map +1 -0
- package/dist/uploads/getBaseFields.d.ts.map +1 -1
- package/dist/uploads/getFileByPath.d.ts +1 -1
- package/dist/uploads/getFileByPath.d.ts.map +1 -1
- package/dist/uploads/getFileContentRequirement.d.ts +32 -0
- package/dist/uploads/getFileContentRequirement.d.ts.map +1 -0
- package/dist/uploads/getFileContentRequirement.js +40 -0
- package/dist/uploads/getFileContentRequirement.js.map +1 -0
- package/dist/uploads/getFileContentRequirement.spec.js +125 -0
- package/dist/uploads/getFileContentRequirement.spec.js.map +1 -0
- package/dist/uploads/getFileFromUploadInstructions.d.ts +8 -0
- package/dist/uploads/getFileFromUploadInstructions.d.ts.map +1 -0
- package/dist/uploads/getFileFromUploadInstructions.js +232 -0
- package/dist/uploads/getFileFromUploadInstructions.js.map +1 -0
- package/dist/uploads/getFileFromUploadInstructions.spec.js +387 -0
- package/dist/uploads/getFileFromUploadInstructions.spec.js.map +1 -0
- package/dist/uploads/getFileTypeFallback.d.ts.map +1 -1
- package/dist/uploads/getImageSize.d.ts +12 -1
- package/dist/uploads/getImageSize.d.ts.map +1 -1
- package/dist/uploads/getImageSize.js +20 -18
- package/dist/uploads/getImageSize.js.map +1 -1
- package/dist/uploads/getImageSize.spec.js +298 -0
- package/dist/uploads/getImageSize.spec.js.map +1 -0
- package/dist/uploads/getSafeFilename.d.ts.map +1 -1
- package/dist/uploads/image-resizing/createImageSize.d.ts.map +1 -1
- package/dist/uploads/image-resizing/createImageSizes.d.ts.map +1 -1
- package/dist/uploads/image-resizing/createImageSizes.js +2 -5
- package/dist/uploads/image-resizing/createImageSizes.js.map +1 -1
- package/dist/uploads/image-resizing/createImageSizes.spec.js +80 -0
- package/dist/uploads/image-resizing/createImageSizes.spec.js.map +1 -0
- package/dist/uploads/image-resizing/generateImageSizeFilename.d.ts.map +1 -1
- package/dist/uploads/image-resizing/getImageResizeAction.d.ts +1 -1
- package/dist/uploads/image-resizing/getImageResizeAction.d.ts.map +1 -1
- package/dist/uploads/image-resizing/parseFilename.d.ts.map +1 -1
- package/dist/uploads/image-resizing/sanitizeResizeConfig.d.ts.map +1 -1
- package/dist/uploads/isAnimatedImage.d.ts +8 -0
- package/dist/uploads/isAnimatedImage.d.ts.map +1 -0
- package/dist/uploads/isAnimatedImage.js +22 -0
- package/dist/uploads/isAnimatedImage.js.map +1 -0
- package/dist/uploads/isAnimatedImage.spec.js +19 -0
- package/dist/uploads/isAnimatedImage.spec.js.map +1 -0
- package/dist/uploads/mimeTypeValidator.d.ts.map +1 -1
- package/dist/uploads/probeImageSize.d.ts +39 -0
- package/dist/uploads/probeImageSize.d.ts.map +1 -0
- package/dist/uploads/probeImageSize.js +374 -0
- package/dist/uploads/probeImageSize.js.map +1 -0
- package/dist/uploads/probeImageSize.spec.js +366 -0
- package/dist/uploads/probeImageSize.spec.js.map +1 -0
- package/dist/uploads/resolveURLUploadInput.d.ts +25 -0
- package/dist/uploads/resolveURLUploadInput.d.ts.map +1 -0
- package/dist/uploads/resolveURLUploadInput.js +53 -0
- package/dist/uploads/resolveURLUploadInput.js.map +1 -0
- package/dist/uploads/safeFetch.d.ts.map +1 -1
- package/dist/uploads/saveBufferToFile.d.ts.map +1 -1
- package/dist/uploads/stagedUpload.d.ts +27 -0
- package/dist/uploads/stagedUpload.d.ts.map +1 -0
- package/dist/uploads/stagedUpload.js +197 -0
- package/dist/uploads/stagedUpload.js.map +1 -0
- package/dist/uploads/types.d.ts +91 -7
- package/dist/uploads/types.d.ts.map +1 -1
- package/dist/uploads/types.js.map +1 -1
- package/dist/uploads/unlinkTempFiles.d.ts.map +1 -1
- package/dist/uploads/unlinkTempFiles.js +6 -2
- package/dist/uploads/unlinkTempFiles.js.map +1 -1
- package/dist/uploads/unlinkTempFiles.spec.js +71 -0
- package/dist/uploads/unlinkTempFiles.spec.js.map +1 -0
- package/dist/uploads/uploadFiles.d.ts.map +1 -1
- package/dist/uploads/uploadFiles.js +7 -2
- package/dist/uploads/uploadFiles.js.map +1 -1
- package/dist/uploads/uploadFiles.spec.js +44 -0
- package/dist/uploads/uploadFiles.spec.js.map +1 -0
- package/dist/uploads/validateUploadURL.d.ts +13 -0
- package/dist/uploads/validateUploadURL.d.ts.map +1 -0
- package/dist/uploads/validateUploadURL.js +37 -0
- package/dist/uploads/validateUploadURL.js.map +1 -0
- package/dist/utilities/addDataAndFileToRequest.d.ts.map +1 -1
- package/dist/utilities/addDataAndFileToRequest.js +12 -45
- package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
- package/dist/utilities/addLocalesToRequest.d.ts.map +1 -1
- package/dist/utilities/addSelectGenericsToGeneretedTypes.d.ts.map +1 -1
- package/dist/utilities/appendDateTimezoneSelectFields.d.ts.map +1 -1
- package/dist/utilities/appendNonTrashedFilter.d.ts +1 -1
- package/dist/utilities/appendNonTrashedFilter.d.ts.map +1 -1
- package/dist/utilities/appendNonTrashedFilter.js.map +1 -1
- package/dist/utilities/appendUploadSelectFields.d.ts.map +1 -1
- package/dist/utilities/canAccessAdmin.d.ts.map +1 -1
- package/dist/utilities/canAccessAdmin.js +1 -0
- package/dist/utilities/canAccessAdmin.js.map +1 -1
- package/dist/utilities/checkDocumentLockStatus.d.ts +19 -0
- package/dist/utilities/checkDocumentLockStatus.d.ts.map +1 -1
- package/dist/utilities/checkDocumentLockStatus.js +74 -0
- package/dist/utilities/checkDocumentLockStatus.js.map +1 -1
- package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
- package/dist/utilities/configToJSONSchema.js +3 -2
- package/dist/utilities/configToJSONSchema.js.map +1 -1
- package/dist/utilities/configToJSONSchema.spec.js +68 -31
- package/dist/utilities/configToJSONSchema.spec.js.map +1 -1
- package/dist/utilities/createPayloadRequest.d.ts.map +1 -1
- package/dist/utilities/deepCopyObject.d.ts.map +1 -1
- package/dist/utilities/dependencies/resolveFrom.d.ts.map +1 -1
- package/dist/utilities/entityInputSchema/filterFieldsByAccess.d.ts +30 -0
- package/dist/utilities/entityInputSchema/filterFieldsByAccess.d.ts.map +1 -0
- package/dist/utilities/entityInputSchema/filterFieldsByAccess.js +71 -0
- package/dist/utilities/entityInputSchema/filterFieldsByAccess.js.map +1 -0
- package/dist/utilities/entityInputSchema/getEntityInputSchema.d.ts +13 -0
- package/dist/utilities/entityInputSchema/getEntityInputSchema.d.ts.map +1 -0
- package/dist/utilities/entityInputSchema/getEntityInputSchema.js +66 -0
- package/dist/utilities/entityInputSchema/getEntityInputSchema.js.map +1 -0
- package/dist/utilities/entityInputSchema/sanitizeEntitySchema.d.ts +10 -0
- package/dist/utilities/entityInputSchema/sanitizeEntitySchema.d.ts.map +1 -0
- package/dist/utilities/entityInputSchema/sanitizeEntitySchema.js +384 -0
- package/dist/utilities/entityInputSchema/sanitizeEntitySchema.js.map +1 -0
- package/dist/utilities/entityInputSchema/sanitizeEntitySchema.spec.js +133 -0
- package/dist/utilities/entityInputSchema/sanitizeEntitySchema.spec.js.map +1 -0
- package/dist/utilities/entityInputSchema/types.d.ts +16 -0
- package/dist/utilities/entityInputSchema/types.d.ts.map +1 -0
- package/dist/utilities/entityInputSchema/types.js +3 -0
- package/dist/utilities/entityInputSchema/types.js.map +1 -0
- package/dist/utilities/entityInputSchema/validateEntityData.d.ts +13 -0
- package/dist/utilities/entityInputSchema/validateEntityData.d.ts.map +1 -0
- package/dist/utilities/entityInputSchema/validateEntityData.js +138 -0
- package/dist/utilities/entityInputSchema/validateEntityData.js.map +1 -0
- package/dist/utilities/escapeRegExp.d.ts.map +1 -1
- package/dist/utilities/extractID.d.ts.map +1 -1
- package/dist/utilities/fieldValueExists.d.ts +29 -0
- package/dist/utilities/fieldValueExists.d.ts.map +1 -0
- package/dist/utilities/fieldValueExists.js +37 -0
- package/dist/utilities/fieldValueExists.js.map +1 -0
- package/dist/utilities/flattenAllFields.d.ts.map +1 -1
- package/dist/utilities/formatAdminURL.d.ts.map +1 -1
- package/dist/utilities/formatErrors.d.ts.map +1 -1
- package/dist/utilities/formatLabels.d.ts.map +1 -1
- package/dist/utilities/getBestFitFromSizes.d.ts.map +1 -1
- package/dist/utilities/getBlockSelect.d.ts.map +1 -1
- package/dist/utilities/getDataByPath.d.ts.map +1 -1
- package/dist/utilities/getEntityPermissions/getEntityPermissions.d.ts.map +1 -1
- package/dist/utilities/getEntityPermissions/getEntityPermissions.js +1 -0
- package/dist/utilities/getEntityPermissions/getEntityPermissions.js.map +1 -1
- package/dist/utilities/getEntityPermissions/populateFieldPermissions.d.ts.map +1 -1
- package/dist/utilities/getFieldByPath.d.ts.map +1 -1
- package/dist/utilities/getFieldPermissions.d.ts.map +1 -1
- package/dist/utilities/getNextVersion.d.ts +7 -0
- package/dist/utilities/getNextVersion.d.ts.map +1 -0
- package/dist/utilities/getNextVersion.js +20 -0
- package/dist/utilities/getNextVersion.js.map +1 -0
- package/dist/utilities/getNextVersion.spec.js +16 -0
- package/dist/utilities/getNextVersion.spec.js.map +1 -0
- package/dist/utilities/getObjectDotNotation.d.ts.map +1 -1
- package/dist/utilities/getRequestEntity.d.ts.map +1 -1
- package/dist/utilities/getRequestLanguage.d.ts.map +1 -1
- package/dist/utilities/getRequestOrigin.d.ts +2 -2
- package/dist/utilities/getRequestOrigin.d.ts.map +1 -1
- package/dist/utilities/getRequestOrigin.js.map +1 -1
- package/dist/utilities/getSafeRedirect.d.ts.map +1 -1
- package/dist/utilities/getSafeRedirect.js +16 -9
- package/dist/utilities/getSafeRedirect.js.map +1 -1
- package/dist/utilities/getSafeRedirect.spec.js +96 -2
- package/dist/utilities/getSafeRedirect.spec.js.map +1 -1
- package/dist/utilities/getSelectMode.d.ts.map +1 -1
- package/dist/utilities/getSiblingData.d.ts.map +1 -1
- package/dist/utilities/getTranslatedLabel.d.ts.map +1 -1
- package/dist/utilities/getUniqueFieldValue.d.ts +28 -0
- package/dist/utilities/getUniqueFieldValue.d.ts.map +1 -0
- package/dist/utilities/getUniqueFieldValue.js +27 -0
- package/dist/utilities/getUniqueFieldValue.js.map +1 -0
- package/dist/utilities/getVersionsConfig.d.ts +1 -1
- package/dist/utilities/getVersionsConfig.d.ts.map +1 -1
- package/dist/utilities/getVirtualFieldNames.d.ts +14 -0
- package/dist/utilities/getVirtualFieldNames.d.ts.map +1 -0
- package/dist/utilities/getVirtualFieldNames.js +35 -0
- package/dist/utilities/getVirtualFieldNames.js.map +1 -0
- package/dist/utilities/handleEndpoints.d.ts.map +1 -1
- package/dist/utilities/headersWithCors.d.ts.map +1 -1
- package/dist/utilities/headersWithCors.js +1 -1
- package/dist/utilities/headersWithCors.js.map +1 -1
- package/dist/utilities/isEntityHidden.d.ts +2 -2
- package/dist/utilities/isEntityHidden.d.ts.map +1 -1
- package/dist/utilities/isURLAllowed.d.ts.map +1 -1
- package/dist/utilities/isURLAllowed.js +9 -3
- package/dist/utilities/isURLAllowed.js.map +1 -1
- package/dist/utilities/isURLAllowed.spec.js +78 -0
- package/dist/utilities/isURLAllowed.spec.js.map +1 -0
- package/dist/utilities/isValidID.d.ts +1 -1
- package/dist/utilities/isValidID.d.ts.map +1 -1
- package/dist/utilities/killTransaction.d.ts +7 -0
- package/dist/utilities/killTransaction.d.ts.map +1 -1
- package/dist/utilities/killTransaction.js +7 -0
- package/dist/utilities/killTransaction.js.map +1 -1
- package/dist/utilities/logError.d.ts.map +1 -1
- package/dist/utilities/logError.js +5 -2
- package/dist/utilities/logError.js.map +1 -1
- package/dist/utilities/logger.d.ts +1 -1
- package/dist/utilities/logger.d.ts.map +1 -1
- package/dist/utilities/mergeHeaders.d.ts.map +1 -1
- package/dist/utilities/mergeListSearchAndWhere.d.ts.map +1 -1
- package/dist/utilities/miniChalk.d.ts.map +1 -1
- package/dist/utilities/nextJsDevReloadStrategy.d.ts +7 -0
- package/dist/utilities/nextJsDevReloadStrategy.d.ts.map +1 -0
- package/dist/utilities/nextJsDevReloadStrategy.js +59 -0
- package/dist/utilities/nextJsDevReloadStrategy.js.map +1 -0
- package/dist/utilities/nextJsDevReloadStrategy.spec.js +123 -0
- package/dist/utilities/nextJsDevReloadStrategy.spec.js.map +1 -0
- package/dist/utilities/optionsAreEqual.d.ts.map +1 -1
- package/dist/utilities/parseBooleanString.d.ts.map +1 -1
- package/dist/utilities/parseCookies.d.ts +1 -1
- package/dist/utilities/parseCookies.d.ts.map +1 -1
- package/dist/utilities/parseDocumentID.d.ts +4 -1
- package/dist/utilities/parseDocumentID.d.ts.map +1 -1
- package/dist/utilities/parseDocumentID.js +7 -1
- package/dist/utilities/parseDocumentID.js.map +1 -1
- package/dist/utilities/parseParams/index.d.ts.map +1 -1
- package/dist/utilities/profiling.d.ts.map +1 -1
- package/dist/utilities/reduceFieldsToValues.d.ts.map +1 -1
- package/dist/utilities/resolveSelect.d.ts.map +1 -1
- package/dist/utilities/routeError.d.ts.map +1 -1
- package/dist/utilities/sanitizeFallbackLocale.d.ts.map +1 -1
- package/dist/utilities/sanitizeInternalFields.d.ts.map +1 -1
- package/dist/utilities/sanitizeJoinParams.d.ts.map +1 -1
- package/dist/utilities/sanitizePopulateParam.d.ts.map +1 -1
- package/dist/utilities/sanitizeSelect.d.ts.map +1 -1
- package/dist/utilities/sanitizeSelectParam.d.ts.map +1 -1
- package/dist/utilities/sanitizeSortParams.d.ts.map +1 -1
- package/dist/utilities/setsAreEqual.d.ts.map +1 -1
- package/dist/utilities/sharedInputSchemas.d.ts +52 -0
- package/dist/utilities/sharedInputSchemas.d.ts.map +1 -0
- package/dist/utilities/sharedInputSchemas.js +101 -0
- package/dist/utilities/sharedInputSchemas.js.map +1 -0
- package/dist/utilities/slugify.d.ts.map +1 -1
- package/dist/utilities/stripUnselectedFields.d.ts.map +1 -1
- package/dist/utilities/telemetry/conf/index.d.ts.map +1 -1
- package/dist/utilities/telemetry/events/adminInit.d.ts.map +1 -1
- package/dist/utilities/telemetry/events/adminInit.js +2 -3
- package/dist/utilities/telemetry/events/adminInit.js.map +1 -1
- package/dist/utilities/telemetry/events/serverInit.d.ts.map +1 -1
- package/dist/utilities/telemetry/events/serverInit.js +2 -3
- package/dist/utilities/telemetry/events/serverInit.js.map +1 -1
- package/dist/utilities/telemetry/featureInfo/getFeatureInfo.d.ts +4 -0
- package/dist/utilities/telemetry/featureInfo/getFeatureInfo.d.ts.map +1 -0
- package/dist/utilities/telemetry/featureInfo/getFeatureInfo.js +261 -0
- package/dist/utilities/telemetry/featureInfo/getFeatureInfo.js.map +1 -0
- package/dist/utilities/telemetry/featureInfo/getFeatureInfo.spec.js +117 -0
- package/dist/utilities/telemetry/featureInfo/getFeatureInfo.spec.js.map +1 -0
- package/dist/utilities/telemetry/featureInfo/types.d.ts +63 -0
- package/dist/utilities/telemetry/featureInfo/types.d.ts.map +1 -0
- package/dist/utilities/telemetry/featureInfo/types.js +3 -0
- package/dist/utilities/telemetry/featureInfo/types.js.map +1 -0
- package/dist/utilities/telemetry/getProjectContext.d.ts +16 -0
- package/dist/utilities/telemetry/getProjectContext.d.ts.map +1 -0
- package/dist/utilities/telemetry/getProjectContext.js +43 -0
- package/dist/utilities/telemetry/getProjectContext.js.map +1 -0
- package/dist/utilities/telemetry/index.d.ts +21 -5
- package/dist/utilities/telemetry/index.d.ts.map +1 -1
- package/dist/utilities/telemetry/index.js +26 -1
- package/dist/utilities/telemetry/index.js.map +1 -1
- package/dist/utilities/telemetry/index.spec.js +43 -0
- package/dist/utilities/telemetry/index.spec.js.map +1 -0
- package/dist/utilities/telemetry/oneWayHash.d.ts.map +1 -1
- package/dist/utilities/timestamp.d.ts.map +1 -1
- package/dist/utilities/toKebabCase.d.ts.map +1 -1
- package/dist/utilities/transformColumnPreferences.d.ts.map +1 -1
- package/dist/utilities/transformPointDataToPayload.d.ts +7 -0
- package/dist/utilities/transformPointDataToPayload.d.ts.map +1 -0
- package/dist/utilities/transformPointDataToPayload.js +28 -0
- package/dist/utilities/transformPointDataToPayload.js.map +1 -0
- package/dist/utilities/transformWhereQuery.d.ts.map +1 -1
- package/dist/utilities/traverseFields.d.ts.map +1 -1
- package/dist/utilities/traverseFields.js +20 -22
- package/dist/utilities/traverseFields.js.map +1 -1
- package/dist/utilities/traverseFields.spec.js +112 -0
- package/dist/utilities/traverseFields.spec.js.map +1 -1
- package/dist/utilities/traverseForLocalizedFields.d.ts.map +1 -1
- package/dist/utilities/unflatten.d.ts.map +1 -1
- package/dist/utilities/unflattenData.d.ts +3 -0
- package/dist/utilities/unflattenData.d.ts.map +1 -0
- package/dist/utilities/unflattenData.js +14 -0
- package/dist/utilities/unflattenData.js.map +1 -0
- package/dist/utilities/validateMimeType.d.ts.map +1 -1
- package/dist/utilities/validateTimezones.d.ts.map +1 -1
- package/dist/utilities/validateWhereQuery.d.ts.map +1 -1
- package/dist/utilities/wordBoundariesRegex.d.ts.map +1 -1
- package/dist/utilities/wrapInternalEndpoints.d.ts.map +1 -1
- package/dist/utilities/zod.d.ts +5 -0
- package/dist/utilities/zod.d.ts.map +1 -0
- package/dist/utilities/zod.js +21 -0
- package/dist/utilities/zod.js.map +1 -0
- package/dist/versions/baseFields.d.ts.map +1 -1
- package/dist/versions/buildCollectionFields.d.ts.map +1 -1
- package/dist/versions/buildGlobalFields.d.ts.map +1 -1
- package/dist/versions/buildVersionCompoundIndexes.d.ts.map +1 -1
- package/dist/versions/defaults.d.ts.map +1 -1
- package/dist/versions/deleteCollectionVersions.d.ts +11 -1
- package/dist/versions/deleteCollectionVersions.d.ts.map +1 -1
- package/dist/versions/deleteCollectionVersions.js +10 -3
- package/dist/versions/deleteCollectionVersions.js.map +1 -1
- package/dist/versions/deleteScheduledPublishJobs.d.ts +5 -1
- package/dist/versions/deleteScheduledPublishJobs.d.ts.map +1 -1
- package/dist/versions/deleteScheduledPublishJobs.js +11 -5
- package/dist/versions/deleteScheduledPublishJobs.js.map +1 -1
- package/dist/versions/drafts/appendVersionToQueryKey.d.ts.map +1 -1
- package/dist/versions/drafts/appendVersionToQueryKey.js +1 -3
- package/dist/versions/drafts/appendVersionToQueryKey.js.map +1 -1
- package/dist/versions/drafts/appendVersionToQueryKey.spec.js +28 -0
- package/dist/versions/drafts/appendVersionToQueryKey.spec.js.map +1 -0
- package/dist/versions/drafts/getQueryDraftsSelect.d.ts.map +1 -1
- package/dist/versions/drafts/getQueryDraftsSort.d.ts.map +1 -1
- package/dist/versions/drafts/replaceWithDraftIfAvailable.d.ts.map +1 -1
- package/dist/versions/enforceMaxVersions.d.ts.map +1 -1
- package/dist/versions/getLatestCollectionVersion.d.ts.map +1 -1
- package/dist/versions/getLatestGlobalVersion.d.ts.map +1 -1
- package/dist/versions/migrations/localizeStatus/shared.d.ts.map +1 -1
- package/dist/versions/payloadPackageList.d.ts.map +1 -1
- package/dist/versions/payloadPackageList.js +0 -1
- package/dist/versions/payloadPackageList.js.map +1 -1
- package/dist/versions/schedule/job.d.ts.map +1 -1
- package/dist/versions/schedule/job.js +4 -1
- package/dist/versions/schedule/job.js.map +1 -1
- package/package.json +24 -7
- package/skills/payload/SKILL.md +526 -0
- package/skills/payload/reference/ACCESS-CONTROL-ADVANCED.md +704 -0
- package/skills/payload/reference/ACCESS-CONTROL.md +696 -0
- package/skills/payload/reference/ADAPTERS.md +305 -0
- package/skills/payload/reference/ADVANCED.md +386 -0
- package/skills/payload/reference/COLLECTIONS.md +333 -0
- package/skills/payload/reference/ENDPOINTS.md +634 -0
- package/skills/payload/reference/FIELD-TYPE-GUARDS.md +553 -0
- package/skills/payload/reference/FIELDS.md +745 -0
- package/skills/payload/reference/HOOKS.md +186 -0
- package/skills/payload/reference/PLUGIN-DEVELOPMENT.md +1436 -0
- package/skills/payload/reference/QUERIES.md +274 -0
- package/dist/bin/build.d.ts +0 -25
- package/dist/bin/build.d.ts.map +0 -1
- package/dist/bin/build.js +0 -80
- package/dist/bin/build.js.map +0 -1
- package/dist/bin/build.spec.js +0 -170
- package/dist/bin/build.spec.js.map +0 -1
- package/dist/bin/generateImportMap/generateImportMap.spec.js.map +0 -1
- package/dist/bin/generateImportMap/index.d.ts.map +0 -1
- package/dist/bin/generateImportMap/index.js.map +0 -1
- package/dist/bin/generateImportMap/iterateCollections.d.ts.map +0 -1
- package/dist/bin/generateImportMap/iterateCollections.js.map +0 -1
- package/dist/bin/generateImportMap/iterateConfig.d.ts.map +0 -1
- package/dist/bin/generateImportMap/iterateConfig.js.map +0 -1
- package/dist/bin/generateImportMap/iterateFields.d.ts.map +0 -1
- package/dist/bin/generateImportMap/iterateFields.js.map +0 -1
- package/dist/bin/generateImportMap/iterateGlobals.d.ts.map +0 -1
- package/dist/bin/generateImportMap/iterateGlobals.js.map +0 -1
- package/dist/bin/generateImportMap/utilities/addPayloadComponentToImportMap.d.ts.map +0 -1
- package/dist/bin/generateImportMap/utilities/addPayloadComponentToImportMap.js.map +0 -1
- package/dist/bin/generateImportMap/utilities/getFromImportMap.d.ts.map +0 -1
- package/dist/bin/generateImportMap/utilities/getFromImportMap.js.map +0 -1
- package/dist/bin/generateImportMap/utilities/getImportMapToBaseDirPath.d.ts.map +0 -1
- package/dist/bin/generateImportMap/utilities/getImportMapToBaseDirPath.js.map +0 -1
- package/dist/bin/generateImportMap/utilities/parsePayloadComponent.d.ts.map +0 -1
- package/dist/bin/generateImportMap/utilities/parsePayloadComponent.js.map +0 -1
- package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.d.ts.map +0 -1
- package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.js.map +0 -1
- package/dist/bin/generateTypes.d.ts +0 -6
- package/dist/bin/generateTypes.d.ts.map +0 -1
- package/dist/bin/generateTypes.js.map +0 -1
- package/dist/bin/index.d.ts +0 -2
- package/dist/bin/index.d.ts.map +0 -1
- package/dist/bin/index.js +0 -200
- package/dist/bin/index.js.map +0 -1
- package/dist/bin/info.d.ts +0 -2
- package/dist/bin/info.d.ts.map +0 -1
- package/dist/bin/info.js +0 -56
- package/dist/bin/info.js.map +0 -1
- package/dist/bin/loadEnv.d.ts.map +0 -1
- package/dist/bin/loadEnv.js.map +0 -1
- package/dist/bin/migrate.d.ts +0 -15
- package/dist/bin/migrate.d.ts.map +0 -1
- package/dist/bin/migrate.js +0 -102
- package/dist/bin/migrate.js.map +0 -1
- package/dist/database/defaultUpdateJobs.d.ts +0 -3
- package/dist/database/defaultUpdateJobs.d.ts.map +0 -1
- package/dist/database/defaultUpdateJobs.js +0 -41
- package/dist/database/defaultUpdateJobs.js.map +0 -1
- package/dist/fields/baseFields/slug/countVersions.d.ts +0 -13
- package/dist/fields/baseFields/slug/countVersions.d.ts.map +0 -1
- package/dist/fields/baseFields/slug/countVersions.js +0 -29
- package/dist/fields/baseFields/slug/countVersions.js.map +0 -1
- package/dist/fields/baseFields/slug/index.d.ts +0 -89
- package/dist/fields/baseFields/slug/index.d.ts.map +0 -1
- package/dist/fields/baseFields/slug/index.js +0 -81
- package/dist/fields/baseFields/slug/index.js.map +0 -1
- package/dist/uploads/endpoints/getFileFromURL.d.ts +0 -3
- package/dist/uploads/endpoints/getFileFromURL.d.ts.map +0 -1
- package/dist/uploads/endpoints/getFileFromURL.js.map +0 -1
- package/dist/uploads/getExternalFile.d.ts +0 -10
- package/dist/uploads/getExternalFile.d.ts.map +0 -1
- package/dist/uploads/getExternalFile.js +0 -73
- package/dist/uploads/getExternalFile.js.map +0 -1
- package/dist/uploads/tempFile.d.ts +0 -7
- package/dist/uploads/tempFile.d.ts.map +0 -1
- package/dist/uploads/tempFile.js +0 -39
- package/dist/uploads/tempFile.js.map +0 -1
- /package/dist/{bin → cli/commands}/generateImportMap/generateImportMap.spec.js +0 -0
- /package/dist/{bin → cli/commands}/generateImportMap/iterateCollections.js +0 -0
- /package/dist/{bin → cli/commands}/generateImportMap/iterateFields.js +0 -0
- /package/dist/{bin → cli/commands}/generateImportMap/iterateGlobals.js +0 -0
- /package/dist/{bin → cli/commands}/generateImportMap/utilities/addPayloadComponentToImportMap.js +0 -0
- /package/dist/{bin → cli/commands}/generateImportMap/utilities/getFromImportMap.js +0 -0
- /package/dist/{bin → cli/commands}/generateImportMap/utilities/getImportMapToBaseDirPath.d.ts +0 -0
- /package/dist/{bin → cli/commands}/generateImportMap/utilities/getImportMapToBaseDirPath.js +0 -0
- /package/dist/{bin → cli/commands}/generateImportMap/utilities/parsePayloadComponent.js +0 -0
- /package/dist/{bin → cli/commands}/generateImportMap/utilities/resolveImportMapFilePath.d.ts +0 -0
- /package/dist/{bin → cli/runtime}/loadEnv.d.ts +0 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { getFileContentRequirement } from './getFileContentRequirement.js';
|
|
3
|
+
const createUploadConfig = (overrides = {})=>({
|
|
4
|
+
disableLocalStorage: true,
|
|
5
|
+
staticDir: '/tmp/media',
|
|
6
|
+
...overrides
|
|
7
|
+
});
|
|
8
|
+
describe('getFileContentRequirement', ()=>{
|
|
9
|
+
it('requires the full file when local storage is enabled', ()=>{
|
|
10
|
+
expect(getFileContentRequirement({
|
|
11
|
+
mimeType: 'video/mp4',
|
|
12
|
+
uploadConfig: createUploadConfig({
|
|
13
|
+
disableLocalStorage: false
|
|
14
|
+
})
|
|
15
|
+
})).toBe('full');
|
|
16
|
+
});
|
|
17
|
+
it('requires nothing for a non-image file with no mime type allow list', ()=>{
|
|
18
|
+
expect(getFileContentRequirement({
|
|
19
|
+
mimeType: 'video/mp4',
|
|
20
|
+
uploadConfig: createUploadConfig()
|
|
21
|
+
})).toBe('none');
|
|
22
|
+
});
|
|
23
|
+
it('requires the full file when a mime type allow list is configured', ()=>{
|
|
24
|
+
expect(getFileContentRequirement({
|
|
25
|
+
mimeType: 'video/mp4',
|
|
26
|
+
uploadConfig: createUploadConfig({
|
|
27
|
+
mimeTypes: [
|
|
28
|
+
'video/*'
|
|
29
|
+
]
|
|
30
|
+
})
|
|
31
|
+
})).toBe('full');
|
|
32
|
+
});
|
|
33
|
+
it('does not require content when allowRestrictedFileTypes bypasses the mime type check', ()=>{
|
|
34
|
+
expect(getFileContentRequirement({
|
|
35
|
+
mimeType: 'video/mp4',
|
|
36
|
+
uploadConfig: createUploadConfig({
|
|
37
|
+
allowRestrictedFileTypes: true,
|
|
38
|
+
mimeTypes: [
|
|
39
|
+
'video/*'
|
|
40
|
+
]
|
|
41
|
+
})
|
|
42
|
+
})).toBe('none');
|
|
43
|
+
});
|
|
44
|
+
it('requires only the header for an image with no configured adjustments', ()=>{
|
|
45
|
+
expect(getFileContentRequirement({
|
|
46
|
+
mimeType: 'image/png',
|
|
47
|
+
uploadConfig: createUploadConfig()
|
|
48
|
+
})).toBe('header');
|
|
49
|
+
});
|
|
50
|
+
it('requires the full file for an image with resize options configured', ()=>{
|
|
51
|
+
expect(getFileContentRequirement({
|
|
52
|
+
mimeType: 'image/png',
|
|
53
|
+
uploadConfig: createUploadConfig({
|
|
54
|
+
resizeOptions: {
|
|
55
|
+
width: 100
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
})).toBe('full');
|
|
59
|
+
});
|
|
60
|
+
it('requires the full file for an image with imageSizes configured, even with no other adjustments', ()=>{
|
|
61
|
+
expect(getFileContentRequirement({
|
|
62
|
+
mimeType: 'image/png',
|
|
63
|
+
uploadConfig: createUploadConfig({
|
|
64
|
+
imageSizes: [
|
|
65
|
+
{
|
|
66
|
+
name: 'thumbnail',
|
|
67
|
+
width: 100
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
})
|
|
71
|
+
})).toBe('full');
|
|
72
|
+
});
|
|
73
|
+
it('requires only the header for an image with an empty imageSizes array', ()=>{
|
|
74
|
+
expect(getFileContentRequirement({
|
|
75
|
+
mimeType: 'image/png',
|
|
76
|
+
uploadConfig: createUploadConfig({
|
|
77
|
+
imageSizes: []
|
|
78
|
+
})
|
|
79
|
+
})).toBe('header');
|
|
80
|
+
});
|
|
81
|
+
it('requires the full file for an animated image even with no configured adjustments', ()=>{
|
|
82
|
+
expect(getFileContentRequirement({
|
|
83
|
+
mimeType: 'image/gif',
|
|
84
|
+
uploadConfig: createUploadConfig()
|
|
85
|
+
})).toBe('full');
|
|
86
|
+
});
|
|
87
|
+
it('requires the full file when the request includes a crop edit, even with no configured adjustments', ()=>{
|
|
88
|
+
expect(getFileContentRequirement({
|
|
89
|
+
hasSizeEdits: true,
|
|
90
|
+
mimeType: 'image/png',
|
|
91
|
+
uploadConfig: createUploadConfig()
|
|
92
|
+
})).toBe('full');
|
|
93
|
+
});
|
|
94
|
+
it('requires only the header when the request has no size edits and no configured adjustments', ()=>{
|
|
95
|
+
expect(getFileContentRequirement({
|
|
96
|
+
hasSizeEdits: false,
|
|
97
|
+
mimeType: 'image/png',
|
|
98
|
+
uploadConfig: createUploadConfig()
|
|
99
|
+
})).toBe('header');
|
|
100
|
+
});
|
|
101
|
+
it('requires only the header for a non-resizable but recognized image type', ()=>{
|
|
102
|
+
expect(getFileContentRequirement({
|
|
103
|
+
mimeType: 'image/svg+xml',
|
|
104
|
+
uploadConfig: createUploadConfig()
|
|
105
|
+
})).toBe('header');
|
|
106
|
+
});
|
|
107
|
+
it('requires the full file for an image when disableLocalStorage is not set', ()=>{
|
|
108
|
+
expect(getFileContentRequirement({
|
|
109
|
+
mimeType: 'image/png',
|
|
110
|
+
uploadConfig: {
|
|
111
|
+
staticDir: '/tmp/media'
|
|
112
|
+
}
|
|
113
|
+
})).toBe('full');
|
|
114
|
+
});
|
|
115
|
+
it('requires the full file for a non-image type when disableLocalStorage is not set', ()=>{
|
|
116
|
+
expect(getFileContentRequirement({
|
|
117
|
+
mimeType: 'video/mp4',
|
|
118
|
+
uploadConfig: {
|
|
119
|
+
staticDir: '/tmp/media'
|
|
120
|
+
}
|
|
121
|
+
})).toBe('full');
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
//# sourceMappingURL=getFileContentRequirement.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/uploads/getFileContentRequirement.spec.ts"],"sourcesContent":["import type { SanitizedUploadConfig } from './types.js'\n\nimport { describe, expect, it } from 'vitest'\n\nimport { getFileContentRequirement } from './getFileContentRequirement.js'\n\nconst createUploadConfig = (\n overrides: Partial<SanitizedUploadConfig> = {},\n): SanitizedUploadConfig =>\n ({\n disableLocalStorage: true,\n staticDir: '/tmp/media',\n ...overrides,\n }) as SanitizedUploadConfig\n\ndescribe('getFileContentRequirement', () => {\n it('requires the full file when local storage is enabled', () => {\n expect(\n getFileContentRequirement({\n mimeType: 'video/mp4',\n uploadConfig: createUploadConfig({ disableLocalStorage: false }),\n }),\n ).toBe('full')\n })\n\n it('requires nothing for a non-image file with no mime type allow list', () => {\n expect(\n getFileContentRequirement({\n mimeType: 'video/mp4',\n uploadConfig: createUploadConfig(),\n }),\n ).toBe('none')\n })\n\n it('requires the full file when a mime type allow list is configured', () => {\n expect(\n getFileContentRequirement({\n mimeType: 'video/mp4',\n uploadConfig: createUploadConfig({ mimeTypes: ['video/*'] }),\n }),\n ).toBe('full')\n })\n\n it('does not require content when allowRestrictedFileTypes bypasses the mime type check', () => {\n expect(\n getFileContentRequirement({\n mimeType: 'video/mp4',\n uploadConfig: createUploadConfig({\n allowRestrictedFileTypes: true,\n mimeTypes: ['video/*'],\n }),\n }),\n ).toBe('none')\n })\n\n it('requires only the header for an image with no configured adjustments', () => {\n expect(\n getFileContentRequirement({\n mimeType: 'image/png',\n uploadConfig: createUploadConfig(),\n }),\n ).toBe('header')\n })\n\n it('requires the full file for an image with resize options configured', () => {\n expect(\n getFileContentRequirement({\n mimeType: 'image/png',\n uploadConfig: createUploadConfig({ resizeOptions: { width: 100 } }),\n }),\n ).toBe('full')\n })\n\n it('requires the full file for an image with imageSizes configured, even with no other adjustments', () => {\n expect(\n getFileContentRequirement({\n mimeType: 'image/png',\n uploadConfig: createUploadConfig({ imageSizes: [{ name: 'thumbnail', width: 100 }] }),\n }),\n ).toBe('full')\n })\n\n it('requires only the header for an image with an empty imageSizes array', () => {\n expect(\n getFileContentRequirement({\n mimeType: 'image/png',\n uploadConfig: createUploadConfig({ imageSizes: [] }),\n }),\n ).toBe('header')\n })\n\n it('requires the full file for an animated image even with no configured adjustments', () => {\n expect(\n getFileContentRequirement({\n mimeType: 'image/gif',\n uploadConfig: createUploadConfig(),\n }),\n ).toBe('full')\n })\n\n it('requires the full file when the request includes a crop edit, even with no configured adjustments', () => {\n expect(\n getFileContentRequirement({\n hasSizeEdits: true,\n mimeType: 'image/png',\n uploadConfig: createUploadConfig(),\n }),\n ).toBe('full')\n })\n\n it('requires only the header when the request has no size edits and no configured adjustments', () => {\n expect(\n getFileContentRequirement({\n hasSizeEdits: false,\n mimeType: 'image/png',\n uploadConfig: createUploadConfig(),\n }),\n ).toBe('header')\n })\n\n it('requires only the header for a non-resizable but recognized image type', () => {\n expect(\n getFileContentRequirement({\n mimeType: 'image/svg+xml',\n uploadConfig: createUploadConfig(),\n }),\n ).toBe('header')\n })\n\n it('requires the full file for an image when disableLocalStorage is not set', () => {\n expect(\n getFileContentRequirement({\n mimeType: 'image/png',\n uploadConfig: { staticDir: '/tmp/media' } as SanitizedUploadConfig,\n }),\n ).toBe('full')\n })\n\n it('requires the full file for a non-image type when disableLocalStorage is not set', () => {\n expect(\n getFileContentRequirement({\n mimeType: 'video/mp4',\n uploadConfig: { staticDir: '/tmp/media' } as SanitizedUploadConfig,\n }),\n ).toBe('full')\n })\n})\n"],"names":["describe","expect","it","getFileContentRequirement","createUploadConfig","overrides","disableLocalStorage","staticDir","mimeType","uploadConfig","toBe","mimeTypes","allowRestrictedFileTypes","resizeOptions","width","imageSizes","name","hasSizeEdits"],"mappings":"AAEA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,SAAQ;AAE7C,SAASC,yBAAyB,QAAQ,iCAAgC;AAE1E,MAAMC,qBAAqB,CACzBC,YAA4C,CAAC,CAAC,GAE7C,CAAA;QACCC,qBAAqB;QACrBC,WAAW;QACX,GAAGF,SAAS;IACd,CAAA;AAEFL,SAAS,6BAA6B;IACpCE,GAAG,wDAAwD;QACzDD,OACEE,0BAA0B;YACxBK,UAAU;YACVC,cAAcL,mBAAmB;gBAAEE,qBAAqB;YAAM;QAChE,IACAI,IAAI,CAAC;IACT;IAEAR,GAAG,sEAAsE;QACvED,OACEE,0BAA0B;YACxBK,UAAU;YACVC,cAAcL;QAChB,IACAM,IAAI,CAAC;IACT;IAEAR,GAAG,oEAAoE;QACrED,OACEE,0BAA0B;YACxBK,UAAU;YACVC,cAAcL,mBAAmB;gBAAEO,WAAW;oBAAC;iBAAU;YAAC;QAC5D,IACAD,IAAI,CAAC;IACT;IAEAR,GAAG,uFAAuF;QACxFD,OACEE,0BAA0B;YACxBK,UAAU;YACVC,cAAcL,mBAAmB;gBAC/BQ,0BAA0B;gBAC1BD,WAAW;oBAAC;iBAAU;YACxB;QACF,IACAD,IAAI,CAAC;IACT;IAEAR,GAAG,wEAAwE;QACzED,OACEE,0BAA0B;YACxBK,UAAU;YACVC,cAAcL;QAChB,IACAM,IAAI,CAAC;IACT;IAEAR,GAAG,sEAAsE;QACvED,OACEE,0BAA0B;YACxBK,UAAU;YACVC,cAAcL,mBAAmB;gBAAES,eAAe;oBAAEC,OAAO;gBAAI;YAAE;QACnE,IACAJ,IAAI,CAAC;IACT;IAEAR,GAAG,kGAAkG;QACnGD,OACEE,0BAA0B;YACxBK,UAAU;YACVC,cAAcL,mBAAmB;gBAAEW,YAAY;oBAAC;wBAAEC,MAAM;wBAAaF,OAAO;oBAAI;iBAAE;YAAC;QACrF,IACAJ,IAAI,CAAC;IACT;IAEAR,GAAG,wEAAwE;QACzED,OACEE,0BAA0B;YACxBK,UAAU;YACVC,cAAcL,mBAAmB;gBAAEW,YAAY,EAAE;YAAC;QACpD,IACAL,IAAI,CAAC;IACT;IAEAR,GAAG,oFAAoF;QACrFD,OACEE,0BAA0B;YACxBK,UAAU;YACVC,cAAcL;QAChB,IACAM,IAAI,CAAC;IACT;IAEAR,GAAG,qGAAqG;QACtGD,OACEE,0BAA0B;YACxBc,cAAc;YACdT,UAAU;YACVC,cAAcL;QAChB,IACAM,IAAI,CAAC;IACT;IAEAR,GAAG,6FAA6F;QAC9FD,OACEE,0BAA0B;YACxBc,cAAc;YACdT,UAAU;YACVC,cAAcL;QAChB,IACAM,IAAI,CAAC;IACT;IAEAR,GAAG,0EAA0E;QAC3ED,OACEE,0BAA0B;YACxBK,UAAU;YACVC,cAAcL;QAChB,IACAM,IAAI,CAAC;IACT;IAEAR,GAAG,2EAA2E;QAC5ED,OACEE,0BAA0B;YACxBK,UAAU;YACVC,cAAc;gBAAEF,WAAW;YAAa;QAC1C,IACAG,IAAI,CAAC;IACT;IAEAR,GAAG,mFAAmF;QACpFD,OACEE,0BAA0B;YACxBK,UAAU;YACVC,cAAc;gBAAEF,WAAW;YAAa;QAC1C,IACAG,IAAI,CAAC;IACT;AACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PayloadRequest } from '../types/index.js';
|
|
2
|
+
import type { UploadInstructions } from './types.js';
|
|
3
|
+
export declare const getFileFromUploadInstructions: ({ collectionSlug, file, req, }: {
|
|
4
|
+
collectionSlug: string;
|
|
5
|
+
file: UploadInstructions['file'];
|
|
6
|
+
req: PayloadRequest;
|
|
7
|
+
}) => Promise<NonNullable<PayloadRequest['file']>>;
|
|
8
|
+
//# sourceMappingURL=getFileFromUploadInstructions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFileFromUploadInstructions.d.ts","sourceRoot":"","sources":["../../src/uploads/getFileFromUploadInstructions.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAsC,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAOxF,eAAO,MAAM,6BAA6B,mCAIvC;IACD,cAAc,EAAE,MAAM,CAAA;IACtB,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAA;IAChC,GAAG,EAAE,cAAc,CAAA;CACpB,KAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CA+D9C,CAAA"}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import { mkdir, rm } from 'node:fs/promises';
|
|
4
|
+
import os from 'node:os';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { Readable } from 'node:stream';
|
|
7
|
+
import { pipeline } from 'node:stream/promises';
|
|
8
|
+
import { APIError } from '../errors/APIError.js';
|
|
9
|
+
import { getFileContentRequirement, HEADER_PROBE_BYTE_LENGTH } from './getFileContentRequirement.js';
|
|
10
|
+
import { getImageSize } from './getImageSize.js';
|
|
11
|
+
import { getStagedFile } from './stagedUpload.js';
|
|
12
|
+
export const getFileFromUploadInstructions = async ({ collectionSlug, file, req })=>{
|
|
13
|
+
if (!file || typeof file !== 'object' || !file.uploadReference || typeof file.uploadReference !== 'object') {
|
|
14
|
+
throw new APIError('Invalid upload reference.', 400);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Handlers fetch files uploaded to a storage provider. An uploadId points to a temporary file
|
|
18
|
+
* already stored by Payload, so no handler is needed.
|
|
19
|
+
*/ if ('uploadId' in file.uploadReference) {
|
|
20
|
+
return getStagedFile({
|
|
21
|
+
collectionSlug,
|
|
22
|
+
req,
|
|
23
|
+
uploadReference: file.uploadReference
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const uploadConfig = req.payload.collections[collectionSlug].config.upload;
|
|
27
|
+
if (!uploadConfig || !uploadConfig.handlers) {
|
|
28
|
+
throw new APIError('uploadConfig.handlers is not present for ' + collectionSlug);
|
|
29
|
+
}
|
|
30
|
+
const contentRequirement = getFileContentRequirement({
|
|
31
|
+
hasSizeEdits: requestHasSizeEdits(req),
|
|
32
|
+
mimeType: file.mimeType,
|
|
33
|
+
uploadConfig
|
|
34
|
+
});
|
|
35
|
+
// Nothing downstream reads this file's content - use the client-reported metadata directly
|
|
36
|
+
// instead of re-downloading a file that, for a chunked upload, can be far larger than
|
|
37
|
+
// the server's available memory or disk.
|
|
38
|
+
if (contentRequirement === 'none') {
|
|
39
|
+
return {
|
|
40
|
+
name: file.filename,
|
|
41
|
+
data: Buffer.alloc(0),
|
|
42
|
+
mimetype: file.mimeType,
|
|
43
|
+
size: file.size,
|
|
44
|
+
uploadReference: file.uploadReference
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (contentRequirement === 'header') {
|
|
48
|
+
const headerFile = await fetchHeaderOnly({
|
|
49
|
+
collectionSlug,
|
|
50
|
+
file,
|
|
51
|
+
req,
|
|
52
|
+
uploadConfig
|
|
53
|
+
});
|
|
54
|
+
if (headerFile) {
|
|
55
|
+
return headerFile;
|
|
56
|
+
}
|
|
57
|
+
// The header wasn't enough to determine the image's dimensions - fall through to a full fetch.
|
|
58
|
+
}
|
|
59
|
+
const response = await fetchUploadResponse({
|
|
60
|
+
collectionSlug,
|
|
61
|
+
file,
|
|
62
|
+
req,
|
|
63
|
+
uploadConfig
|
|
64
|
+
});
|
|
65
|
+
const tempFilePath = await streamResponseToTempFile({
|
|
66
|
+
req,
|
|
67
|
+
response
|
|
68
|
+
});
|
|
69
|
+
return {
|
|
70
|
+
name: file.filename,
|
|
71
|
+
data: Buffer.alloc(0),
|
|
72
|
+
mimetype: response.headers.get('Content-Type') || file.mimeType,
|
|
73
|
+
size: file.size,
|
|
74
|
+
tempFilePath,
|
|
75
|
+
uploadReference: file.uploadReference
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Whether the request's `uploadEdits` query param carries a crop or resize edit - mirrors the
|
|
80
|
+
* raw `req.query.uploadEdits` read in generateFileData.ts's `shouldReupload`/`cropData` checks,
|
|
81
|
+
* since a full parse (with its `data`/`originalDoc` focal-point fallback) isn't available yet
|
|
82
|
+
* at this point in the request lifecycle.
|
|
83
|
+
*/ const requestHasSizeEdits = (req)=>{
|
|
84
|
+
const uploadEdits = req.query?.uploadEdits;
|
|
85
|
+
if (typeof uploadEdits !== 'object' || uploadEdits === null) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
const { crop, heightInPixels, widthInPixels } = uploadEdits;
|
|
89
|
+
return Boolean(crop || heightInPixels || widthInPixels);
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Fetches only the first `HEADER_PROBE_BYTE_LENGTH` bytes of the upload (via a best-effort byte
|
|
93
|
+
* range request) and uses them to probe an image's dimensions, without downloading the rest of
|
|
94
|
+
* the file. Returns null if that isn't enough to determine the dimensions, so the caller can
|
|
95
|
+
* fall back to a full fetch.
|
|
96
|
+
*/ const fetchHeaderOnly = async ({ collectionSlug, file, req, uploadConfig })=>{
|
|
97
|
+
const response = await fetchUploadResponse({
|
|
98
|
+
collectionSlug,
|
|
99
|
+
file,
|
|
100
|
+
rangeHeader: `bytes=0-${HEADER_PROBE_BYTE_LENGTH - 1}`,
|
|
101
|
+
req,
|
|
102
|
+
uploadConfig
|
|
103
|
+
});
|
|
104
|
+
const headerBuffer = await readBoundedPrefix(response, HEADER_PROBE_BYTE_LENGTH);
|
|
105
|
+
try {
|
|
106
|
+
await getImageSize({
|
|
107
|
+
file: {
|
|
108
|
+
name: file.filename,
|
|
109
|
+
data: headerBuffer,
|
|
110
|
+
mimetype: file.mimeType,
|
|
111
|
+
size: file.size
|
|
112
|
+
},
|
|
113
|
+
sharp: req.payload.config.sharp
|
|
114
|
+
});
|
|
115
|
+
} catch {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
name: file.filename,
|
|
120
|
+
data: headerBuffer,
|
|
121
|
+
mimetype: response.headers.get('Content-Type') || file.mimeType,
|
|
122
|
+
size: file.size,
|
|
123
|
+
uploadReference: file.uploadReference
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Runs the collection's upload handlers, following a single redirect if one is returned.
|
|
128
|
+
* `rangeHeader`, when passed, is a best-effort hint - handlers that ignore it simply return the
|
|
129
|
+
* full file, which callers must still bound their own reads against.
|
|
130
|
+
*/ const fetchUploadResponse = async ({ collectionSlug, file, rangeHeader, req, uploadConfig })=>{
|
|
131
|
+
const scopedReq = rangeHeader ? withRangeHeader(req, rangeHeader) : req;
|
|
132
|
+
let response = null;
|
|
133
|
+
let error;
|
|
134
|
+
for (const handler of uploadConfig.handlers){
|
|
135
|
+
try {
|
|
136
|
+
const result = await handler(scopedReq, {
|
|
137
|
+
doc: null,
|
|
138
|
+
params: {
|
|
139
|
+
collection: collectionSlug,
|
|
140
|
+
filename: file.filename,
|
|
141
|
+
uploadReference: file.uploadReference
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
if (result) {
|
|
145
|
+
response = result;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
} catch (err) {
|
|
149
|
+
error = err;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (!response) {
|
|
153
|
+
if (error) {
|
|
154
|
+
req.payload.logger.error(error);
|
|
155
|
+
}
|
|
156
|
+
throw new APIError('Expected response from the upload handler.');
|
|
157
|
+
}
|
|
158
|
+
if (response.status >= 300 && response.status < 400) {
|
|
159
|
+
const redirectUrl = response.headers.get('Location');
|
|
160
|
+
if (redirectUrl) {
|
|
161
|
+
response = await fetch(redirectUrl);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return response;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Overrides `req.headers` with a `Range` header while leaving the real incoming request
|
|
168
|
+
* untouched. Uses a Proxy, rather than cloning `req`, because `req` is a native `Request`
|
|
169
|
+
* instance at runtime - accessors like `.signal` are brand-checked against `req`'s internal
|
|
170
|
+
* slots, so a plain clone (e.g. `Object.create(req)`) throws once a handler reads one of them.
|
|
171
|
+
* Forwarding reads through `Reflect.get(req, prop, req)` keeps `this` bound to the real `req`
|
|
172
|
+
* so those accessors keep working.
|
|
173
|
+
*/ const withRangeHeader = (req, rangeHeader)=>{
|
|
174
|
+
const headers = new Headers(req.headers);
|
|
175
|
+
headers.set('range', rangeHeader);
|
|
176
|
+
return new Proxy(req, {
|
|
177
|
+
get (target, prop) {
|
|
178
|
+
return prop === 'headers' ? headers : Reflect.get(target, prop, target);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Reads at most `maxBytes` from the response body, then cancels the reader - so a handler that
|
|
184
|
+
* ignores the range hint and starts streaming the whole file is still cut short on our end.
|
|
185
|
+
*/ const readBoundedPrefix = async (response, maxBytes)=>{
|
|
186
|
+
if (!response.body) {
|
|
187
|
+
return Buffer.alloc(0);
|
|
188
|
+
}
|
|
189
|
+
const reader = response.body.getReader();
|
|
190
|
+
const chunks = [];
|
|
191
|
+
let total = 0;
|
|
192
|
+
try {
|
|
193
|
+
while(total < maxBytes){
|
|
194
|
+
const { done, value } = await reader.read();
|
|
195
|
+
if (done || !value) {
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
const remaining = maxBytes - total;
|
|
199
|
+
const chunk = value.byteLength > remaining ? value.subarray(0, remaining) : value;
|
|
200
|
+
chunks.push(Buffer.from(chunk));
|
|
201
|
+
total += chunk.byteLength;
|
|
202
|
+
}
|
|
203
|
+
} finally{
|
|
204
|
+
await reader.cancel().catch(()=>{});
|
|
205
|
+
}
|
|
206
|
+
return Buffer.concat(chunks, total);
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* Streams the fetched upload straight to disk instead of buffering it in memory. A client upload
|
|
210
|
+
* (e.g. Azure's chunkLargeFiles) can be far larger than the server's available memory, so this
|
|
211
|
+
* avoids re-downloading the whole file into a single in-memory buffer just to read it back out.
|
|
212
|
+
*/ const streamResponseToTempFile = async ({ req, response })=>{
|
|
213
|
+
if (!response.body) {
|
|
214
|
+
throw new APIError('Expected a response body from the upload handler.');
|
|
215
|
+
}
|
|
216
|
+
const tempFileDir = req.payload.config.upload?.tempFileDir || os.tmpdir();
|
|
217
|
+
await mkdir(tempFileDir, {
|
|
218
|
+
recursive: true
|
|
219
|
+
});
|
|
220
|
+
const tempFilePath = path.join(tempFileDir, `payload-client-upload-${randomUUID()}`);
|
|
221
|
+
try {
|
|
222
|
+
await pipeline(Readable.fromWeb(response.body), fs.createWriteStream(tempFilePath));
|
|
223
|
+
} catch (error) {
|
|
224
|
+
await rm(tempFilePath, {
|
|
225
|
+
force: true
|
|
226
|
+
});
|
|
227
|
+
throw error;
|
|
228
|
+
}
|
|
229
|
+
return tempFilePath;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
//# sourceMappingURL=getFileFromUploadInstructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/uploads/getFileFromUploadInstructions.ts"],"sourcesContent":["import type { ReadableStream } from 'node:stream/web'\n\nimport { randomUUID } from 'node:crypto'\nimport fs from 'node:fs'\nimport { mkdir, rm } from 'node:fs/promises'\nimport os from 'node:os'\nimport path from 'node:path'\nimport { Readable } from 'node:stream'\nimport { pipeline } from 'node:stream/promises'\n\nimport type { PayloadRequest } from '../types/index.js'\nimport type { SanitizedUploadConfig, UploadEdits, UploadInstructions } from './types.js'\n\nimport { APIError } from '../errors/APIError.js'\nimport { getFileContentRequirement, HEADER_PROBE_BYTE_LENGTH } from './getFileContentRequirement.js'\nimport { getImageSize } from './getImageSize.js'\nimport { getStagedFile } from './stagedUpload.js'\n\nexport const getFileFromUploadInstructions = async ({\n collectionSlug,\n file,\n req,\n}: {\n collectionSlug: string\n file: UploadInstructions['file']\n req: PayloadRequest\n}): Promise<NonNullable<PayloadRequest['file']>> => {\n if (\n !file ||\n typeof file !== 'object' ||\n !file.uploadReference ||\n typeof file.uploadReference !== 'object'\n ) {\n throw new APIError('Invalid upload reference.', 400)\n }\n\n /**\n * Handlers fetch files uploaded to a storage provider. An uploadId points to a temporary file\n * already stored by Payload, so no handler is needed.\n */\n if ('uploadId' in file.uploadReference) {\n return getStagedFile({ collectionSlug, req, uploadReference: file.uploadReference })\n }\n\n const uploadConfig = req.payload.collections[collectionSlug]!.config.upload\n\n if (!uploadConfig || !uploadConfig.handlers) {\n throw new APIError('uploadConfig.handlers is not present for ' + collectionSlug)\n }\n\n const contentRequirement = getFileContentRequirement({\n hasSizeEdits: requestHasSizeEdits(req),\n mimeType: file.mimeType,\n uploadConfig,\n })\n\n // Nothing downstream reads this file's content - use the client-reported metadata directly\n // instead of re-downloading a file that, for a chunked upload, can be far larger than\n // the server's available memory or disk.\n if (contentRequirement === 'none') {\n return {\n name: file.filename,\n data: Buffer.alloc(0),\n mimetype: file.mimeType,\n size: file.size,\n uploadReference: file.uploadReference,\n }\n }\n\n if (contentRequirement === 'header') {\n const headerFile = await fetchHeaderOnly({ collectionSlug, file, req, uploadConfig })\n if (headerFile) {\n return headerFile\n }\n // The header wasn't enough to determine the image's dimensions - fall through to a full fetch.\n }\n\n const response = await fetchUploadResponse({ collectionSlug, file, req, uploadConfig })\n\n const tempFilePath = await streamResponseToTempFile({ req, response })\n\n return {\n name: file.filename,\n data: Buffer.alloc(0),\n mimetype: response.headers.get('Content-Type') || file.mimeType,\n size: file.size,\n tempFilePath,\n uploadReference: file.uploadReference,\n }\n}\n\n/**\n * Whether the request's `uploadEdits` query param carries a crop or resize edit - mirrors the\n * raw `req.query.uploadEdits` read in generateFileData.ts's `shouldReupload`/`cropData` checks,\n * since a full parse (with its `data`/`originalDoc` focal-point fallback) isn't available yet\n * at this point in the request lifecycle.\n */\nconst requestHasSizeEdits = (req: PayloadRequest): boolean => {\n const uploadEdits = req.query?.uploadEdits\n if (typeof uploadEdits !== 'object' || uploadEdits === null) {\n return false\n }\n\n const { crop, heightInPixels, widthInPixels } = uploadEdits as UploadEdits\n return Boolean(crop || heightInPixels || widthInPixels)\n}\n\n/**\n * Fetches only the first `HEADER_PROBE_BYTE_LENGTH` bytes of the upload (via a best-effort byte\n * range request) and uses them to probe an image's dimensions, without downloading the rest of\n * the file. Returns null if that isn't enough to determine the dimensions, so the caller can\n * fall back to a full fetch.\n */\nconst fetchHeaderOnly = async ({\n collectionSlug,\n file,\n req,\n uploadConfig,\n}: {\n collectionSlug: string\n file: UploadInstructions['file']\n req: PayloadRequest\n uploadConfig: SanitizedUploadConfig\n}): Promise<NonNullable<PayloadRequest['file']> | null> => {\n const response = await fetchUploadResponse({\n collectionSlug,\n file,\n rangeHeader: `bytes=0-${HEADER_PROBE_BYTE_LENGTH - 1}`,\n req,\n uploadConfig,\n })\n\n const headerBuffer = await readBoundedPrefix(response, HEADER_PROBE_BYTE_LENGTH)\n\n try {\n await getImageSize({\n file: {\n name: file.filename,\n data: headerBuffer,\n mimetype: file.mimeType,\n size: file.size,\n },\n sharp: req.payload.config.sharp,\n })\n } catch {\n return null\n }\n\n return {\n name: file.filename,\n data: headerBuffer,\n mimetype: response.headers.get('Content-Type') || file.mimeType,\n size: file.size,\n uploadReference: file.uploadReference,\n }\n}\n\n/**\n * Runs the collection's upload handlers, following a single redirect if one is returned.\n * `rangeHeader`, when passed, is a best-effort hint - handlers that ignore it simply return the\n * full file, which callers must still bound their own reads against.\n */\nconst fetchUploadResponse = async ({\n collectionSlug,\n file,\n rangeHeader,\n req,\n uploadConfig,\n}: {\n collectionSlug: string\n file: UploadInstructions['file']\n rangeHeader?: string\n req: PayloadRequest\n uploadConfig: SanitizedUploadConfig\n}): Promise<Response> => {\n const scopedReq = rangeHeader ? withRangeHeader(req, rangeHeader) : req\n\n let response: null | Response = null\n let error: unknown\n\n for (const handler of uploadConfig.handlers!) {\n try {\n const result = await handler(scopedReq, {\n doc: null!,\n params: {\n collection: collectionSlug,\n filename: file.filename,\n uploadReference: file.uploadReference,\n },\n })\n if (result) {\n response = result\n /**\n * - If a handler returns a Response, the response will be sent to the client and no further handlers will be run.\n * - If a handler returns null, the next handler will be run.\n *\n * @see packages/payload/src/uploads/types.ts\n */\n break\n }\n } catch (err) {\n error = err\n }\n }\n\n if (!response) {\n if (error) {\n req.payload.logger.error(error)\n }\n\n throw new APIError('Expected response from the upload handler.')\n }\n\n if (response.status >= 300 && response.status < 400) {\n const redirectUrl = response.headers.get('Location')\n if (redirectUrl) {\n response = await fetch(redirectUrl)\n }\n }\n\n return response\n}\n\n/**\n * Overrides `req.headers` with a `Range` header while leaving the real incoming request\n * untouched. Uses a Proxy, rather than cloning `req`, because `req` is a native `Request`\n * instance at runtime - accessors like `.signal` are brand-checked against `req`'s internal\n * slots, so a plain clone (e.g. `Object.create(req)`) throws once a handler reads one of them.\n * Forwarding reads through `Reflect.get(req, prop, req)` keeps `this` bound to the real `req`\n * so those accessors keep working.\n */\nconst withRangeHeader = (req: PayloadRequest, rangeHeader: string): PayloadRequest => {\n const headers = new Headers(req.headers)\n headers.set('range', rangeHeader)\n\n return new Proxy(req, {\n get(target, prop) {\n return prop === 'headers' ? headers : Reflect.get(target, prop, target)\n },\n })\n}\n\n/**\n * Reads at most `maxBytes` from the response body, then cancels the reader - so a handler that\n * ignores the range hint and starts streaming the whole file is still cut short on our end.\n */\nconst readBoundedPrefix = async (response: Response, maxBytes: number): Promise<Buffer> => {\n if (!response.body) {\n return Buffer.alloc(0)\n }\n\n const reader = response.body.getReader()\n const chunks: Buffer[] = []\n let total = 0\n\n try {\n while (total < maxBytes) {\n const { done, value } = await reader.read()\n if (done || !value) {\n break\n }\n\n const remaining = maxBytes - total\n const chunk = value.byteLength > remaining ? value.subarray(0, remaining) : value\n chunks.push(Buffer.from(chunk))\n total += chunk.byteLength\n }\n } finally {\n await reader.cancel().catch(() => {})\n }\n\n return Buffer.concat(chunks, total)\n}\n\n/**\n * Streams the fetched upload straight to disk instead of buffering it in memory. A client upload\n * (e.g. Azure's chunkLargeFiles) can be far larger than the server's available memory, so this\n * avoids re-downloading the whole file into a single in-memory buffer just to read it back out.\n */\nconst streamResponseToTempFile = async ({\n req,\n response,\n}: {\n req: PayloadRequest\n response: Response\n}): Promise<string> => {\n if (!response.body) {\n throw new APIError('Expected a response body from the upload handler.')\n }\n\n const tempFileDir = req.payload.config.upload?.tempFileDir || os.tmpdir()\n await mkdir(tempFileDir, { recursive: true })\n const tempFilePath = path.join(tempFileDir, `payload-client-upload-${randomUUID()}`)\n\n try {\n await pipeline(\n Readable.fromWeb(response.body as ReadableStream<Uint8Array>),\n fs.createWriteStream(tempFilePath),\n )\n } catch (error) {\n await rm(tempFilePath, { force: true })\n throw error\n }\n\n return tempFilePath\n}\n"],"names":["randomUUID","fs","mkdir","rm","os","path","Readable","pipeline","APIError","getFileContentRequirement","HEADER_PROBE_BYTE_LENGTH","getImageSize","getStagedFile","getFileFromUploadInstructions","collectionSlug","file","req","uploadReference","uploadConfig","payload","collections","config","upload","handlers","contentRequirement","hasSizeEdits","requestHasSizeEdits","mimeType","name","filename","data","Buffer","alloc","mimetype","size","headerFile","fetchHeaderOnly","response","fetchUploadResponse","tempFilePath","streamResponseToTempFile","headers","get","uploadEdits","query","crop","heightInPixels","widthInPixels","Boolean","rangeHeader","headerBuffer","readBoundedPrefix","sharp","scopedReq","withRangeHeader","error","handler","result","doc","params","collection","err","logger","status","redirectUrl","fetch","Headers","set","Proxy","target","prop","Reflect","maxBytes","body","reader","getReader","chunks","total","done","value","read","remaining","chunk","byteLength","subarray","push","from","cancel","catch","concat","tempFileDir","tmpdir","recursive","join","fromWeb","createWriteStream","force"],"mappings":"AAEA,SAASA,UAAU,QAAQ,cAAa;AACxC,OAAOC,QAAQ,UAAS;AACxB,SAASC,KAAK,EAAEC,EAAE,QAAQ,mBAAkB;AAC5C,OAAOC,QAAQ,UAAS;AACxB,OAAOC,UAAU,YAAW;AAC5B,SAASC,QAAQ,QAAQ,cAAa;AACtC,SAASC,QAAQ,QAAQ,uBAAsB;AAK/C,SAASC,QAAQ,QAAQ,wBAAuB;AAChD,SAASC,yBAAyB,EAAEC,wBAAwB,QAAQ,iCAAgC;AACpG,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,aAAa,QAAQ,oBAAmB;AAEjD,OAAO,MAAMC,gCAAgC,OAAO,EAClDC,cAAc,EACdC,IAAI,EACJC,GAAG,EAKJ;IACC,IACE,CAACD,QACD,OAAOA,SAAS,YAChB,CAACA,KAAKE,eAAe,IACrB,OAAOF,KAAKE,eAAe,KAAK,UAChC;QACA,MAAM,IAAIT,SAAS,6BAA6B;IAClD;IAEA;;;GAGC,GACD,IAAI,cAAcO,KAAKE,eAAe,EAAE;QACtC,OAAOL,cAAc;YAAEE;YAAgBE;YAAKC,iBAAiBF,KAAKE,eAAe;QAAC;IACpF;IAEA,MAAMC,eAAeF,IAAIG,OAAO,CAACC,WAAW,CAACN,eAAe,CAAEO,MAAM,CAACC,MAAM;IAE3E,IAAI,CAACJ,gBAAgB,CAACA,aAAaK,QAAQ,EAAE;QAC3C,MAAM,IAAIf,SAAS,8CAA8CM;IACnE;IAEA,MAAMU,qBAAqBf,0BAA0B;QACnDgB,cAAcC,oBAAoBV;QAClCW,UAAUZ,KAAKY,QAAQ;QACvBT;IACF;IAEA,2FAA2F;IAC3F,sFAAsF;IACtF,yCAAyC;IACzC,IAAIM,uBAAuB,QAAQ;QACjC,OAAO;YACLI,MAAMb,KAAKc,QAAQ;YACnBC,MAAMC,OAAOC,KAAK,CAAC;YACnBC,UAAUlB,KAAKY,QAAQ;YACvBO,MAAMnB,KAAKmB,IAAI;YACfjB,iBAAiBF,KAAKE,eAAe;QACvC;IACF;IAEA,IAAIO,uBAAuB,UAAU;QACnC,MAAMW,aAAa,MAAMC,gBAAgB;YAAEtB;YAAgBC;YAAMC;YAAKE;QAAa;QACnF,IAAIiB,YAAY;YACd,OAAOA;QACT;IACA,+FAA+F;IACjG;IAEA,MAAME,WAAW,MAAMC,oBAAoB;QAAExB;QAAgBC;QAAMC;QAAKE;IAAa;IAErF,MAAMqB,eAAe,MAAMC,yBAAyB;QAAExB;QAAKqB;IAAS;IAEpE,OAAO;QACLT,MAAMb,KAAKc,QAAQ;QACnBC,MAAMC,OAAOC,KAAK,CAAC;QACnBC,UAAUI,SAASI,OAAO,CAACC,GAAG,CAAC,mBAAmB3B,KAAKY,QAAQ;QAC/DO,MAAMnB,KAAKmB,IAAI;QACfK;QACAtB,iBAAiBF,KAAKE,eAAe;IACvC;AACF,EAAC;AAED;;;;;CAKC,GACD,MAAMS,sBAAsB,CAACV;IAC3B,MAAM2B,cAAc3B,IAAI4B,KAAK,EAAED;IAC/B,IAAI,OAAOA,gBAAgB,YAAYA,gBAAgB,MAAM;QAC3D,OAAO;IACT;IAEA,MAAM,EAAEE,IAAI,EAAEC,cAAc,EAAEC,aAAa,EAAE,GAAGJ;IAChD,OAAOK,QAAQH,QAAQC,kBAAkBC;AAC3C;AAEA;;;;;CAKC,GACD,MAAMX,kBAAkB,OAAO,EAC7BtB,cAAc,EACdC,IAAI,EACJC,GAAG,EACHE,YAAY,EAMb;IACC,MAAMmB,WAAW,MAAMC,oBAAoB;QACzCxB;QACAC;QACAkC,aAAa,CAAC,QAAQ,EAAEvC,2BAA2B,GAAG;QACtDM;QACAE;IACF;IAEA,MAAMgC,eAAe,MAAMC,kBAAkBd,UAAU3B;IAEvD,IAAI;QACF,MAAMC,aAAa;YACjBI,MAAM;gBACJa,MAAMb,KAAKc,QAAQ;gBACnBC,MAAMoB;gBACNjB,UAAUlB,KAAKY,QAAQ;gBACvBO,MAAMnB,KAAKmB,IAAI;YACjB;YACAkB,OAAOpC,IAAIG,OAAO,CAACE,MAAM,CAAC+B,KAAK;QACjC;IACF,EAAE,OAAM;QACN,OAAO;IACT;IAEA,OAAO;QACLxB,MAAMb,KAAKc,QAAQ;QACnBC,MAAMoB;QACNjB,UAAUI,SAASI,OAAO,CAACC,GAAG,CAAC,mBAAmB3B,KAAKY,QAAQ;QAC/DO,MAAMnB,KAAKmB,IAAI;QACfjB,iBAAiBF,KAAKE,eAAe;IACvC;AACF;AAEA;;;;CAIC,GACD,MAAMqB,sBAAsB,OAAO,EACjCxB,cAAc,EACdC,IAAI,EACJkC,WAAW,EACXjC,GAAG,EACHE,YAAY,EAOb;IACC,MAAMmC,YAAYJ,cAAcK,gBAAgBtC,KAAKiC,eAAejC;IAEpE,IAAIqB,WAA4B;IAChC,IAAIkB;IAEJ,KAAK,MAAMC,WAAWtC,aAAaK,QAAQ,CAAG;QAC5C,IAAI;YACF,MAAMkC,SAAS,MAAMD,QAAQH,WAAW;gBACtCK,KAAK;gBACLC,QAAQ;oBACNC,YAAY9C;oBACZe,UAAUd,KAAKc,QAAQ;oBACvBZ,iBAAiBF,KAAKE,eAAe;gBACvC;YACF;YACA,IAAIwC,QAAQ;gBACVpB,WAAWoB;gBAOX;YACF;QACF,EAAE,OAAOI,KAAK;YACZN,QAAQM;QACV;IACF;IAEA,IAAI,CAACxB,UAAU;QACb,IAAIkB,OAAO;YACTvC,IAAIG,OAAO,CAAC2C,MAAM,CAACP,KAAK,CAACA;QAC3B;QAEA,MAAM,IAAI/C,SAAS;IACrB;IAEA,IAAI6B,SAAS0B,MAAM,IAAI,OAAO1B,SAAS0B,MAAM,GAAG,KAAK;QACnD,MAAMC,cAAc3B,SAASI,OAAO,CAACC,GAAG,CAAC;QACzC,IAAIsB,aAAa;YACf3B,WAAW,MAAM4B,MAAMD;QACzB;IACF;IAEA,OAAO3B;AACT;AAEA;;;;;;;CAOC,GACD,MAAMiB,kBAAkB,CAACtC,KAAqBiC;IAC5C,MAAMR,UAAU,IAAIyB,QAAQlD,IAAIyB,OAAO;IACvCA,QAAQ0B,GAAG,CAAC,SAASlB;IAErB,OAAO,IAAImB,MAAMpD,KAAK;QACpB0B,KAAI2B,MAAM,EAAEC,IAAI;YACd,OAAOA,SAAS,YAAY7B,UAAU8B,QAAQ7B,GAAG,CAAC2B,QAAQC,MAAMD;QAClE;IACF;AACF;AAEA;;;CAGC,GACD,MAAMlB,oBAAoB,OAAOd,UAAoBmC;IACnD,IAAI,CAACnC,SAASoC,IAAI,EAAE;QAClB,OAAO1C,OAAOC,KAAK,CAAC;IACtB;IAEA,MAAM0C,SAASrC,SAASoC,IAAI,CAACE,SAAS;IACtC,MAAMC,SAAmB,EAAE;IAC3B,IAAIC,QAAQ;IAEZ,IAAI;QACF,MAAOA,QAAQL,SAAU;YACvB,MAAM,EAAEM,IAAI,EAAEC,KAAK,EAAE,GAAG,MAAML,OAAOM,IAAI;YACzC,IAAIF,QAAQ,CAACC,OAAO;gBAClB;YACF;YAEA,MAAME,YAAYT,WAAWK;YAC7B,MAAMK,QAAQH,MAAMI,UAAU,GAAGF,YAAYF,MAAMK,QAAQ,CAAC,GAAGH,aAAaF;YAC5EH,OAAOS,IAAI,CAACtD,OAAOuD,IAAI,CAACJ;YACxBL,SAASK,MAAMC,UAAU;QAC3B;IACF,SAAU;QACR,MAAMT,OAAOa,MAAM,GAAGC,KAAK,CAAC,KAAO;IACrC;IAEA,OAAOzD,OAAO0D,MAAM,CAACb,QAAQC;AAC/B;AAEA;;;;CAIC,GACD,MAAMrC,2BAA2B,OAAO,EACtCxB,GAAG,EACHqB,QAAQ,EAIT;IACC,IAAI,CAACA,SAASoC,IAAI,EAAE;QAClB,MAAM,IAAIjE,SAAS;IACrB;IAEA,MAAMkF,cAAc1E,IAAIG,OAAO,CAACE,MAAM,CAACC,MAAM,EAAEoE,eAAetF,GAAGuF,MAAM;IACvE,MAAMzF,MAAMwF,aAAa;QAAEE,WAAW;IAAK;IAC3C,MAAMrD,eAAelC,KAAKwF,IAAI,CAACH,aAAa,CAAC,sBAAsB,EAAE1F,cAAc;IAEnF,IAAI;QACF,MAAMO,SACJD,SAASwF,OAAO,CAACzD,SAASoC,IAAI,GAC9BxE,GAAG8F,iBAAiB,CAACxD;IAEzB,EAAE,OAAOgB,OAAO;QACd,MAAMpD,GAAGoC,cAAc;YAAEyD,OAAO;QAAK;QACrC,MAAMzC;IACR;IAEA,OAAOhB;AACT"}
|