payload 4.0.0-internal.2fddfc0 → 4.0.0-internal.314c594
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/LICENSE.md +1 -1
- package/bin.js +11 -0
- package/dist/__testing__/predefinedMigration.d.ts +4 -3
- package/dist/__testing__/predefinedMigration.d.ts.map +1 -1
- package/dist/admin/RichText.d.ts +2 -22
- 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/forms/Field.d.ts +2 -2
- package/dist/admin/forms/Field.d.ts.map +1 -1
- package/dist/admin/forms/Field.js.map +1 -1
- package/dist/admin/forms/Form.d.ts +0 -29
- package/dist/admin/forms/Form.d.ts.map +1 -1
- package/dist/admin/forms/Form.js.map +1 -1
- package/dist/admin/functions/index.d.ts +11 -9
- 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 -2
- package/dist/admin/types.d.ts.map +1 -1
- package/dist/admin/types.js.map +1 -1
- package/dist/admin/views/index.d.ts +1 -1
- 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 +2 -2
- 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 +2 -1
- package/dist/auth/operations/login.d.ts.map +1 -1
- package/dist/auth/operations/login.js.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 +9 -9
- 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/resetPassword.js.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/sendVerificationEmail.d.ts +2 -2
- package/dist/auth/sendVerificationEmail.d.ts.map +1 -1
- package/dist/auth/sendVerificationEmail.js +1 -1
- package/dist/auth/sendVerificationEmail.js.map +1 -1
- 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 +4 -5
- package/dist/auth/sessions.d.ts.map +1 -1
- package/dist/auth/sessions.js +5 -3
- package/dist/auth/sessions.js.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 +2 -2
- package/dist/auth/strategies/local/incrementLoginAttempts.d.ts.map +1 -1
- package/dist/auth/strategies/local/incrementLoginAttempts.js +1 -1
- package/dist/auth/strategies/local/incrementLoginAttempts.js.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 +34 -35
- 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/bin/build.d.ts +34 -10
- package/dist/bin/build.d.ts.map +1 -1
- package/dist/bin/build.js +184 -31
- package/dist/bin/build.js.map +1 -1
- package/dist/bin/build.spec.js +474 -19
- package/dist/bin/build.spec.js.map +1 -1
- package/dist/bin/frameworkConventions.d.ts +8 -0
- package/dist/bin/frameworkConventions.d.ts.map +1 -0
- package/dist/bin/frameworkConventions.js +8 -0
- package/dist/bin/frameworkConventions.js.map +1 -0
- package/dist/bin/generateImportMap/iterateCollections.d.ts.map +1 -1
- package/dist/bin/generateImportMap/iterateCollections.js +10 -0
- package/dist/bin/generateImportMap/iterateCollections.js.map +1 -1
- package/dist/bin/generateImportMap/utilities/getFromImportMap.d.ts.map +1 -1
- package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.d.ts.map +1 -1
- package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.js +13 -4
- package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.js.map +1 -1
- package/dist/bin/migrate.d.ts.map +1 -1
- package/dist/collections/config/client.d.ts +10 -4
- package/dist/collections/config/client.d.ts.map +1 -1
- package/dist/collections/config/client.js +7 -1
- package/dist/collections/config/client.js.map +1 -1
- package/dist/collections/config/defaults.d.ts +4 -8
- package/dist/collections/config/defaults.d.ts.map +1 -1
- package/dist/collections/config/defaults.js +37 -47
- 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 +62 -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 +11 -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 +1 -0
- 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 -158
- 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/local/count.d.ts +3 -3
- package/dist/collections/operations/local/count.d.ts.map +1 -1
- package/dist/collections/operations/local/count.js.map +1 -1
- package/dist/collections/operations/local/countVersions.d.ts +3 -3
- package/dist/collections/operations/local/countVersions.d.ts.map +1 -1
- package/dist/collections/operations/local/countVersions.js.map +1 -1
- package/dist/collections/operations/local/create.d.ts +3 -3
- package/dist/collections/operations/local/create.d.ts.map +1 -1
- package/dist/collections/operations/local/create.js.map +1 -1
- package/dist/collections/operations/local/delete.d.ts +3 -3
- package/dist/collections/operations/local/delete.d.ts.map +1 -1
- package/dist/collections/operations/local/delete.js.map +1 -1
- package/dist/collections/operations/local/duplicate.d.ts +3 -3
- package/dist/collections/operations/local/duplicate.d.ts.map +1 -1
- package/dist/collections/operations/local/duplicate.js.map +1 -1
- package/dist/collections/operations/local/find.d.ts +3 -3
- package/dist/collections/operations/local/find.d.ts.map +1 -1
- package/dist/collections/operations/local/find.js.map +1 -1
- package/dist/collections/operations/local/findByID.d.ts +3 -3
- package/dist/collections/operations/local/findByID.d.ts.map +1 -1
- package/dist/collections/operations/local/findByID.js.map +1 -1
- package/dist/collections/operations/local/findDistinct.d.ts +2 -2
- package/dist/collections/operations/local/findDistinct.d.ts.map +1 -1
- package/dist/collections/operations/local/findDistinct.js.map +1 -1
- package/dist/collections/operations/local/findVersionByID.d.ts +3 -3
- package/dist/collections/operations/local/findVersionByID.d.ts.map +1 -1
- package/dist/collections/operations/local/findVersionByID.js.map +1 -1
- package/dist/collections/operations/local/findVersions.d.ts +3 -3
- package/dist/collections/operations/local/findVersions.d.ts.map +1 -1
- package/dist/collections/operations/local/findVersions.js.map +1 -1
- package/dist/collections/operations/local/restoreVersion.d.ts +3 -3
- package/dist/collections/operations/local/restoreVersion.d.ts.map +1 -1
- package/dist/collections/operations/local/restoreVersion.js.map +1 -1
- package/dist/collections/operations/local/update.d.ts +3 -3
- package/dist/collections/operations/local/update.d.ts.map +1 -1
- package/dist/collections/operations/local/update.js.map +1 -1
- 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 +10 -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 +3 -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 -29
- package/dist/collections/operations/utilities/types.d.ts.map +1 -1
- package/dist/collections/operations/utilities/types.js.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 +3 -3
- package/dist/config/client.d.ts.map +1 -1
- package/dist/config/client.js +1 -0
- 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 +0 -4
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +48 -119
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/definePlugin.d.ts +10 -10
- package/dist/config/definePlugin.d.ts.map +1 -1
- package/dist/config/definePlugin.js +7 -11
- package/dist/config/definePlugin.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 +172 -38
- 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 +426 -390
- 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/findMigrationDir.d.ts.map +1 -1
- package/dist/database/migrations/getPredefinedMigration.d.ts.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 +7 -5
- 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/internal.d.ts +4 -0
- package/dist/exports/internal.d.ts.map +1 -1
- package/dist/exports/internal.js +5 -1
- package/dist/exports/internal.js.map +1 -1
- package/dist/exports/shared.d.ts +6 -3
- package/dist/exports/shared.d.ts.map +1 -1
- package/dist/exports/shared.js +4 -2
- 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 +22 -0
- package/dist/fields/baseFields/slug/fillEmptyLocalizedSlugs.d.ts.map +1 -0
- package/dist/fields/baseFields/slug/fillEmptyLocalizedSlugs.js +63 -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 +107 -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 +22 -0
- package/dist/fields/baseFields/slug/getSlugFallbackValue.d.ts.map +1 -0
- package/dist/fields/baseFields/slug/getSlugFallbackValue.js +23 -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 +4 -4
- package/dist/fields/config/client.d.ts.map +1 -1
- package/dist/fields/config/client.js +2 -1
- 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 +50 -12
- 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 +11 -1
- 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/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 +15 -4
- 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 +4 -4
- package/dist/globals/config/client.d.ts.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/local/countVersions.d.ts +3 -3
- package/dist/globals/operations/local/countVersions.d.ts.map +1 -1
- package/dist/globals/operations/local/countVersions.js.map +1 -1
- package/dist/globals/operations/local/findOne.d.ts +3 -3
- package/dist/globals/operations/local/findOne.d.ts.map +1 -1
- package/dist/globals/operations/local/findOne.js.map +1 -1
- package/dist/globals/operations/local/findVersionByID.d.ts +3 -3
- package/dist/globals/operations/local/findVersionByID.d.ts.map +1 -1
- package/dist/globals/operations/local/findVersionByID.js.map +1 -1
- package/dist/globals/operations/local/findVersions.d.ts +3 -3
- package/dist/globals/operations/local/findVersions.d.ts.map +1 -1
- package/dist/globals/operations/local/findVersions.js.map +1 -1
- package/dist/globals/operations/local/restoreVersion.d.ts +3 -3
- package/dist/globals/operations/local/restoreVersion.d.ts.map +1 -1
- package/dist/globals/operations/local/restoreVersion.js.map +1 -1
- package/dist/globals/operations/local/update.d.ts +3 -3
- package/dist/globals/operations/local/update.d.ts.map +1 -1
- package/dist/globals/operations/local/update.js.map +1 -1
- 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 +4668 -4324
- package/dist/index.d.ts +142 -48
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +73 -61
- 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 +8 -4
- package/dist/preferences/keys.d.ts.map +1 -1
- package/dist/preferences/keys.js +4 -1
- package/dist/preferences/keys.js.map +1 -1
- package/dist/preferences/types.d.ts +15 -0
- package/dist/preferences/types.d.ts.map +1 -1
- package/dist/preferences/types.js +3 -1
- package/dist/preferences/types.js.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 +37 -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 +29 -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.js +1 -1
- package/dist/queues/endpoints/handleSchedules.js.map +1 -1
- package/dist/queues/endpoints/run.d.ts.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 +12 -10
- 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.map +1 -1
- package/dist/uploads/docWithFilenameExists.d.ts.map +1 -1
- package/dist/uploads/endpoints/getFileFromURL.js +2 -0
- package/dist/uploads/endpoints/getFileFromURL.js.map +1 -1
- 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 +3 -12
- 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/fileExists.d.ts.map +1 -1
- package/dist/uploads/generateFileData.d.ts.map +1 -1
- package/dist/uploads/generateFileData.js +4 -1
- package/dist/uploads/generateFileData.js.map +1 -1
- package/dist/uploads/getBaseFields.d.ts.map +1 -1
- package/dist/uploads/getExternalFile.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/getFileFromUploadInstructions.d.ts +8 -0
- package/dist/uploads/getFileFromUploadInstructions.d.ts.map +1 -0
- package/dist/uploads/getFileFromUploadInstructions.js +62 -0
- package/dist/uploads/getFileFromUploadInstructions.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/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/matchMimeType.d.ts +8 -0
- package/dist/uploads/matchMimeType.d.ts.map +1 -0
- package/dist/uploads/matchMimeType.js +19 -0
- package/dist/uploads/matchMimeType.js.map +1 -0
- package/dist/uploads/matchMimeType.spec.js +66 -0
- package/dist/uploads/matchMimeType.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/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 +102 -7
- package/dist/uploads/types.d.ts.map +1 -1
- package/dist/uploads/types.js.map +1 -1
- package/dist/uploads/uploadFiles.d.ts.map +1 -1
- package/dist/utilities/addDataAndFileToRequest.d.ts.map +1 -1
- package/dist/utilities/addDataAndFileToRequest.js +12 -39
- 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.map +1 -1
- package/dist/utilities/configToJSONSchema.d.ts +13 -4
- package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
- package/dist/utilities/configToJSONSchema.js +139 -61
- package/dist/utilities/configToJSONSchema.js.map +1 -1
- package/dist/utilities/configToJSONSchema.spec.js +378 -22
- package/dist/utilities/configToJSONSchema.spec.js.map +1 -1
- package/dist/utilities/createLocalReq.d.ts +2 -2
- package/dist/utilities/createLocalReq.d.ts.map +1 -1
- package/dist/utilities/createLocalReq.js.map +1 -1
- package/dist/utilities/createPayloadRequest.d.ts.map +1 -1
- package/dist/utilities/createPayloadRequest.js +1 -0
- package/dist/utilities/createPayloadRequest.js.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/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 +27 -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 +3 -0
- package/dist/utilities/getEntityPermissions/getEntityPermissions.js.map +1 -1
- package/dist/utilities/getEntityPermissions/populateFieldPermissions.d.ts +7 -1
- package/dist/utilities/getEntityPermissions/populateFieldPermissions.d.ts.map +1 -1
- package/dist/utilities/getEntityPermissions/populateFieldPermissions.js +19 -2
- package/dist/utilities/getEntityPermissions/populateFieldPermissions.js.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 +27 -0
- package/dist/utilities/getUniqueFieldValue.d.ts.map +1 -0
- package/dist/utilities/getUniqueFieldValue.js +26 -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/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/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/slugify.d.ts.map +1 -1
- package/dist/utilities/stripUnselectedFields.d.ts.map +1 -1
- package/dist/utilities/telemetry/conf/envPaths.d.ts.map +1 -1
- package/dist/utilities/telemetry/conf/envPaths.js +40 -31
- package/dist/utilities/telemetry/conf/envPaths.js.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/index.d.ts +15 -4
- package/dist/utilities/telemetry/index.d.ts.map +1 -1
- package/dist/utilities/telemetry/index.js +6 -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/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/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.map +1 -1
- package/dist/versions/deleteScheduledPublishJobs.d.ts.map +1 -1
- package/dist/versions/deleteScheduledPublishJobs.js +2 -2
- 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 +12 -6
- 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/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/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/utilities/isRSCEnabled.d.ts +0 -12
- package/dist/utilities/isRSCEnabled.d.ts.map +0 -1
- package/dist/utilities/isRSCEnabled.js +0 -14
- package/dist/utilities/isRSCEnabled.js.map +0 -1
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# Payload Querying Reference
|
|
2
|
+
|
|
3
|
+
Complete reference for querying data across Local API, REST, and GraphQL.
|
|
4
|
+
|
|
5
|
+
## Query Operators
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import type { Where } from 'payload'
|
|
9
|
+
|
|
10
|
+
// Equals
|
|
11
|
+
const equalsQuery: Where = { color: { equals: 'blue' } }
|
|
12
|
+
|
|
13
|
+
// Not equals
|
|
14
|
+
const notEqualsQuery: Where = { status: { not_equals: 'draft' } }
|
|
15
|
+
|
|
16
|
+
// Greater/less than
|
|
17
|
+
const greaterThanQuery: Where = { price: { greater_than: 100 } }
|
|
18
|
+
const lessThanEqualQuery: Where = { age: { less_than_equal: 65 } }
|
|
19
|
+
|
|
20
|
+
// Contains (case-insensitive)
|
|
21
|
+
const containsQuery: Where = { title: { contains: 'payload' } }
|
|
22
|
+
|
|
23
|
+
// Like (all words present)
|
|
24
|
+
const likeQuery: Where = { description: { like: 'cms headless' } }
|
|
25
|
+
|
|
26
|
+
// In/not in
|
|
27
|
+
const inQuery: Where = { category: { in: ['tech', 'news'] } }
|
|
28
|
+
|
|
29
|
+
// Exists
|
|
30
|
+
const existsQuery: Where = { image: { exists: true } }
|
|
31
|
+
|
|
32
|
+
// Near (point fields)
|
|
33
|
+
const nearQuery: Where = { location: { near: '-122.4194,37.7749,10000' } }
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## AND/OR Logic
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import type { Where } from 'payload'
|
|
40
|
+
|
|
41
|
+
const complexQuery: Where = {
|
|
42
|
+
or: [
|
|
43
|
+
{ color: { equals: 'mint' } },
|
|
44
|
+
{
|
|
45
|
+
and: [{ color: { equals: 'white' } }, { featured: { equals: false } }],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Nested Properties
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import type { Where } from 'payload'
|
|
55
|
+
|
|
56
|
+
const nestedQuery: Where = {
|
|
57
|
+
'author.role': { equals: 'editor' },
|
|
58
|
+
'meta.featured': { exists: true },
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Local API
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
// Find documents
|
|
66
|
+
const posts = await payload.find({
|
|
67
|
+
collection: 'posts',
|
|
68
|
+
where: {
|
|
69
|
+
status: { equals: 'published' },
|
|
70
|
+
'author.name': { contains: 'john' },
|
|
71
|
+
},
|
|
72
|
+
depth: 2,
|
|
73
|
+
limit: 10,
|
|
74
|
+
page: 1,
|
|
75
|
+
sort: '-createdAt',
|
|
76
|
+
locale: 'en',
|
|
77
|
+
select: {
|
|
78
|
+
title: true,
|
|
79
|
+
author: true,
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
// Find by ID
|
|
84
|
+
const post = await payload.findByID({
|
|
85
|
+
collection: 'posts',
|
|
86
|
+
id: '123',
|
|
87
|
+
depth: 2,
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
// Create
|
|
91
|
+
const post = await payload.create({
|
|
92
|
+
collection: 'posts',
|
|
93
|
+
data: {
|
|
94
|
+
title: 'New Post',
|
|
95
|
+
status: 'draft',
|
|
96
|
+
},
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
// Update
|
|
100
|
+
await payload.update({
|
|
101
|
+
collection: 'posts',
|
|
102
|
+
id: '123',
|
|
103
|
+
data: {
|
|
104
|
+
status: 'published',
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
// Delete
|
|
109
|
+
await payload.delete({
|
|
110
|
+
collection: 'posts',
|
|
111
|
+
id: '123',
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
// Count
|
|
115
|
+
const count = await payload.count({
|
|
116
|
+
collection: 'posts',
|
|
117
|
+
where: {
|
|
118
|
+
status: { equals: 'published' },
|
|
119
|
+
},
|
|
120
|
+
})
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Threading req Parameter
|
|
124
|
+
|
|
125
|
+
When performing operations in hooks or nested operations, pass the `req` parameter to maintain transaction context:
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
// ✅ CORRECT: Pass req for transaction safety
|
|
129
|
+
const afterChange: CollectionAfterChangeHook = async ({ doc, req }) => {
|
|
130
|
+
await req.payload.create({
|
|
131
|
+
collection: 'audit-log',
|
|
132
|
+
data: { action: 'created', docId: doc.id },
|
|
133
|
+
req, // Maintains transaction atomicity
|
|
134
|
+
})
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// ❌ WRONG: Missing req breaks transaction
|
|
138
|
+
const afterChange: CollectionAfterChangeHook = async ({ doc, req }) => {
|
|
139
|
+
await req.payload.create({
|
|
140
|
+
collection: 'audit-log',
|
|
141
|
+
data: { action: 'created', docId: doc.id },
|
|
142
|
+
// Missing req - runs in separate transaction
|
|
143
|
+
})
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
This is critical for MongoDB replica sets and Postgres. See [ADAPTERS.md#threading-req-through-operations](ADAPTERS.md#threading-req-through-operations) for details.
|
|
148
|
+
|
|
149
|
+
### Access Control in Local API
|
|
150
|
+
|
|
151
|
+
**Important**: Local API bypasses access control by default (`overrideAccess: true`). When passing a `user` parameter, you must explicitly set `overrideAccess: false` to respect that user's permissions.
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
// ❌ WRONG: User is passed but access control is bypassed
|
|
155
|
+
const posts = await payload.find({
|
|
156
|
+
collection: 'posts',
|
|
157
|
+
user: currentUser,
|
|
158
|
+
// Missing: overrideAccess: false
|
|
159
|
+
// Result: Operation runs with ADMIN privileges, ignoring user's permissions
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
// ✅ CORRECT: Respects user's access control permissions
|
|
163
|
+
const posts = await payload.find({
|
|
164
|
+
collection: 'posts',
|
|
165
|
+
user: currentUser,
|
|
166
|
+
overrideAccess: false, // Required to enforce access control
|
|
167
|
+
// Result: User only sees posts they have permission to read
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
// Administrative operation (intentionally bypass access control)
|
|
171
|
+
const allPosts = await payload.find({
|
|
172
|
+
collection: 'posts',
|
|
173
|
+
// No user parameter
|
|
174
|
+
// overrideAccess defaults to true
|
|
175
|
+
// Result: Returns all posts regardless of access control
|
|
176
|
+
})
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**When to use `overrideAccess: false`:**
|
|
180
|
+
|
|
181
|
+
- Performing operations on behalf of a user
|
|
182
|
+
- Testing access control logic
|
|
183
|
+
- API routes that should respect user permissions
|
|
184
|
+
- Any operation where `user` parameter is provided
|
|
185
|
+
|
|
186
|
+
**When `overrideAccess: true` is appropriate:**
|
|
187
|
+
|
|
188
|
+
- Administrative operations (migrations, seeds, cron jobs)
|
|
189
|
+
- Internal system operations
|
|
190
|
+
- Operations explicitly intended to bypass access control
|
|
191
|
+
|
|
192
|
+
See [ACCESS-CONTROL.md#important-notes](ACCESS-CONTROL.md#important-notes) for more details.
|
|
193
|
+
|
|
194
|
+
## REST API
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
import { stringify } from 'qs-esm'
|
|
198
|
+
|
|
199
|
+
const query = {
|
|
200
|
+
status: { equals: 'published' },
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const queryString = stringify(
|
|
204
|
+
{
|
|
205
|
+
where: query,
|
|
206
|
+
depth: 2,
|
|
207
|
+
limit: 10,
|
|
208
|
+
},
|
|
209
|
+
{ addQueryPrefix: true },
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
const response = await fetch(`https://api.example.com/api/posts${queryString}`)
|
|
213
|
+
const data = await response.json()
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### REST Endpoints
|
|
217
|
+
|
|
218
|
+
```txt
|
|
219
|
+
GET /api/{collection} - Find documents
|
|
220
|
+
GET /api/{collection}/{id} - Find by ID
|
|
221
|
+
POST /api/{collection} - Create
|
|
222
|
+
PATCH /api/{collection}/{id} - Update
|
|
223
|
+
DELETE /api/{collection}/{id} - Delete
|
|
224
|
+
GET /api/{collection}/count - Count documents
|
|
225
|
+
|
|
226
|
+
GET /api/globals/{slug} - Get global
|
|
227
|
+
POST /api/globals/{slug} - Update global
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## GraphQL
|
|
231
|
+
|
|
232
|
+
```graphql
|
|
233
|
+
query {
|
|
234
|
+
Posts(where: { status: { equals: published } }, limit: 10, sort: "-createdAt") {
|
|
235
|
+
docs {
|
|
236
|
+
id
|
|
237
|
+
title
|
|
238
|
+
author {
|
|
239
|
+
name
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
totalDocs
|
|
243
|
+
hasNextPage
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
mutation {
|
|
248
|
+
createPost(data: { title: "New Post", status: draft }) {
|
|
249
|
+
id
|
|
250
|
+
title
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
mutation {
|
|
255
|
+
updatePost(id: "123", data: { status: published }) {
|
|
256
|
+
id
|
|
257
|
+
status
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
mutation {
|
|
262
|
+
deletePost(id: "123") {
|
|
263
|
+
id
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Performance Best Practices
|
|
269
|
+
|
|
270
|
+
- Set `maxDepth` on relationships to prevent over-fetching
|
|
271
|
+
- Use `select` to limit returned fields
|
|
272
|
+
- Index frequently queried fields
|
|
273
|
+
- Use `virtual` fields for computed data
|
|
274
|
+
- Cache expensive operations in hook `context`
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defaultUpdateJobs.d.ts","sourceRoot":"","sources":["../../src/database/defaultUpdateJobs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAI5C,eAAO,MAAM,iBAAiB,EAAE,UA8C/B,CAAA"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { jobsCollectionSlug } from '../queues/config/collection.js';
|
|
2
|
-
export const defaultUpdateJobs = async function updateMany({ id, data, limit, req, returning, where }) {
|
|
3
|
-
const updatedJobs = [];
|
|
4
|
-
const jobsToUpdate = (id ? [
|
|
5
|
-
await this.findOne({
|
|
6
|
-
collection: jobsCollectionSlug,
|
|
7
|
-
req,
|
|
8
|
-
where: {
|
|
9
|
-
id: {
|
|
10
|
-
equals: id
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
})
|
|
14
|
-
] : (await this.find({
|
|
15
|
-
collection: jobsCollectionSlug,
|
|
16
|
-
limit,
|
|
17
|
-
pagination: false,
|
|
18
|
-
req,
|
|
19
|
-
where
|
|
20
|
-
})).docs).filter(Boolean);
|
|
21
|
-
if (!jobsToUpdate) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
for (const job of jobsToUpdate){
|
|
25
|
-
const updateData = {
|
|
26
|
-
...job,
|
|
27
|
-
...data
|
|
28
|
-
};
|
|
29
|
-
const updatedJob = await this.updateOne({
|
|
30
|
-
id: job.id,
|
|
31
|
-
collection: jobsCollectionSlug,
|
|
32
|
-
data: updateData,
|
|
33
|
-
req,
|
|
34
|
-
returning
|
|
35
|
-
});
|
|
36
|
-
updatedJobs.push(updatedJob);
|
|
37
|
-
}
|
|
38
|
-
return updatedJobs;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
//# sourceMappingURL=defaultUpdateJobs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/database/defaultUpdateJobs.ts"],"sourcesContent":["import type { DatabaseAdapter, Job } from '../index.js'\nimport type { UpdateJobs } from './types.js'\n\nimport { jobsCollectionSlug } from '../queues/config/collection.js'\n\nexport const defaultUpdateJobs: UpdateJobs = async function updateMany(\n this: DatabaseAdapter,\n { id, data, limit, req, returning, where },\n) {\n const updatedJobs: Job[] | null = []\n\n const jobsToUpdate: Job[] = (\n id\n ? [\n await this.findOne({\n collection: jobsCollectionSlug,\n req,\n where: { id: { equals: id } },\n }),\n ]\n : (\n await this.find({\n collection: jobsCollectionSlug,\n limit,\n pagination: false,\n req,\n where,\n })\n ).docs\n ).filter(Boolean) as Job[]\n\n if (!jobsToUpdate) {\n return null\n }\n\n for (const job of jobsToUpdate) {\n const updateData = {\n ...job,\n ...data,\n }\n const updatedJob = await this.updateOne({\n id: job.id,\n collection: jobsCollectionSlug,\n data: updateData,\n req,\n returning,\n })\n updatedJobs.push(updatedJob)\n }\n\n return updatedJobs\n}\n"],"names":["jobsCollectionSlug","defaultUpdateJobs","updateMany","id","data","limit","req","returning","where","updatedJobs","jobsToUpdate","findOne","collection","equals","find","pagination","docs","filter","Boolean","job","updateData","updatedJob","updateOne","push"],"mappings":"AAGA,SAASA,kBAAkB,QAAQ,iCAAgC;AAEnE,OAAO,MAAMC,oBAAgC,eAAeC,WAE1D,EAAEC,EAAE,EAAEC,IAAI,EAAEC,KAAK,EAAEC,GAAG,EAAEC,SAAS,EAAEC,KAAK,EAAE;IAE1C,MAAMC,cAA4B,EAAE;IAEpC,MAAMC,eAAsB,AAC1BP,CAAAA,KACI;QACE,MAAM,IAAI,CAACQ,OAAO,CAAC;YACjBC,YAAYZ;YACZM;YACAE,OAAO;gBAAEL,IAAI;oBAAEU,QAAQV;gBAAG;YAAE;QAC9B;KACD,GACD,AACE,CAAA,MAAM,IAAI,CAACW,IAAI,CAAC;QACdF,YAAYZ;QACZK;QACAU,YAAY;QACZT;QACAE;IACF,EAAC,EACDQ,IAAI,AAAD,EACTC,MAAM,CAACC;IAET,IAAI,CAACR,cAAc;QACjB,OAAO;IACT;IAEA,KAAK,MAAMS,OAAOT,aAAc;QAC9B,MAAMU,aAAa;YACjB,GAAGD,GAAG;YACN,GAAGf,IAAI;QACT;QACA,MAAMiB,aAAa,MAAM,IAAI,CAACC,SAAS,CAAC;YACtCnB,IAAIgB,IAAIhB,EAAE;YACVS,YAAYZ;YACZI,MAAMgB;YACNd;YACAC;QACF;QACAE,YAAYc,IAAI,CAACF;IACnB;IAEA,OAAOZ;AACT,EAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { CollectionSlug, DefaultDocumentIDType, GlobalSlug, PayloadRequest } from '../../../index.js';
|
|
2
|
-
/**
|
|
3
|
-
* This is a cross-entity way to count the number of versions for any given document.
|
|
4
|
-
* It will work for both collections and globals.
|
|
5
|
-
* @returns number of versions
|
|
6
|
-
*/
|
|
7
|
-
export declare const countVersions: (args: {
|
|
8
|
-
collectionSlug?: CollectionSlug;
|
|
9
|
-
globalSlug?: GlobalSlug;
|
|
10
|
-
parentID?: DefaultDocumentIDType;
|
|
11
|
-
req: PayloadRequest;
|
|
12
|
-
}) => Promise<number>;
|
|
13
|
-
//# sourceMappingURL=countVersions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"countVersions.d.ts","sourceRoot":"","sources":["../../../../src/fields/baseFields/slug/countVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,cAAc,EAEf,MAAM,mBAAmB,CAAA;AAE1B;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAU,MAAM;IACxC,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,QAAQ,CAAC,EAAE,qBAAqB,CAAA;IAChC,GAAG,EAAE,cAAc,CAAA;CACpB,KAAG,OAAO,CAAC,MAAM,CA8BjB,CAAA"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is a cross-entity way to count the number of versions for any given document.
|
|
3
|
-
* It will work for both collections and globals.
|
|
4
|
-
* @returns number of versions
|
|
5
|
-
*/ export const countVersions = async (args)=>{
|
|
6
|
-
const { collectionSlug, globalSlug, parentID, req } = args;
|
|
7
|
-
let countFn;
|
|
8
|
-
const where = {
|
|
9
|
-
parent: {
|
|
10
|
-
equals: parentID
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
if (collectionSlug) {
|
|
14
|
-
countFn = ()=>req.payload.countVersions({
|
|
15
|
-
collection: collectionSlug,
|
|
16
|
-
where
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
if (globalSlug) {
|
|
20
|
-
countFn = ()=>req.payload.countGlobalVersions({
|
|
21
|
-
global: globalSlug,
|
|
22
|
-
where
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
const res = countFn ? await countFn()?.then((res)=>res.totalDocs || 0) || 0 : 0;
|
|
26
|
-
return res;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
//# sourceMappingURL=countVersions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/fields/baseFields/slug/countVersions.ts"],"sourcesContent":["import type {\n CollectionSlug,\n DefaultDocumentIDType,\n GlobalSlug,\n PayloadRequest,\n Where,\n} from '../../../index.js'\n\n/**\n * This is a cross-entity way to count the number of versions for any given document.\n * It will work for both collections and globals.\n * @returns number of versions\n */\nexport const countVersions = async (args: {\n collectionSlug?: CollectionSlug\n globalSlug?: GlobalSlug\n parentID?: DefaultDocumentIDType\n req: PayloadRequest\n}): Promise<number> => {\n const { collectionSlug, globalSlug, parentID, req } = args\n\n let countFn\n\n const where: Where = {\n parent: {\n equals: parentID,\n },\n }\n\n if (collectionSlug) {\n countFn = () =>\n req.payload.countVersions({\n collection: collectionSlug,\n where,\n })\n }\n\n if (globalSlug) {\n countFn = () =>\n req.payload.countGlobalVersions({\n global: globalSlug,\n where,\n })\n }\n\n const res = countFn ? (await countFn()?.then((res) => res.totalDocs || 0)) || 0 : 0\n\n return res\n}\n"],"names":["countVersions","args","collectionSlug","globalSlug","parentID","req","countFn","where","parent","equals","payload","collection","countGlobalVersions","global","res","then","totalDocs"],"mappings":"AAQA;;;;CAIC,GACD,OAAO,MAAMA,gBAAgB,OAAOC;IAMlC,MAAM,EAAEC,cAAc,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,GAAG,EAAE,GAAGJ;IAEtD,IAAIK;IAEJ,MAAMC,QAAe;QACnBC,QAAQ;YACNC,QAAQL;QACV;IACF;IAEA,IAAIF,gBAAgB;QAClBI,UAAU,IACRD,IAAIK,OAAO,CAACV,aAAa,CAAC;gBACxBW,YAAYT;gBACZK;YACF;IACJ;IAEA,IAAIJ,YAAY;QACdG,UAAU,IACRD,IAAIK,OAAO,CAACE,mBAAmB,CAAC;gBAC9BC,QAAQV;gBACRI;YACF;IACJ;IAEA,MAAMO,MAAMR,UAAU,AAAC,MAAMA,WAAWS,KAAK,CAACD,MAAQA,IAAIE,SAAS,IAAI,MAAO,IAAI;IAElF,OAAOF;AACT,EAAC"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import type { TextFieldClientProps } from '../../../admin/types.js';
|
|
2
|
-
import type { TypeWithID } from '../../../collections/config/types.js';
|
|
3
|
-
import type { FieldAdmin, RowField, TextField } from '../../../fields/config/types.js';
|
|
4
|
-
import type { PayloadRequest } from '../../../types/index.js';
|
|
5
|
-
export type Slugify<T extends TypeWithID = any> = (args: {
|
|
6
|
-
data: T;
|
|
7
|
-
req: PayloadRequest;
|
|
8
|
-
valueToSlugify?: any;
|
|
9
|
-
}) => Promise<string | undefined> | string | undefined;
|
|
10
|
-
export type SlugFieldArgs = {
|
|
11
|
-
/**
|
|
12
|
-
* Override for the `generateSlug` checkbox field name.
|
|
13
|
-
* @default 'generateSlug'
|
|
14
|
-
*/
|
|
15
|
-
checkboxName?: string;
|
|
16
|
-
/**
|
|
17
|
-
* Disables the unique index on the field.
|
|
18
|
-
* This is useful if instead, you want to add a compound unique index to the collection `indexes` config,
|
|
19
|
-
* for example with the multi tenant plugin, where the slug is only unique per tenant, not globally.
|
|
20
|
-
* @default false
|
|
21
|
-
*/
|
|
22
|
-
disableUnique?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated use `useAsSlug` instead.
|
|
25
|
-
*/
|
|
26
|
-
fieldToUse?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Enable localization for the slug field.
|
|
29
|
-
*/
|
|
30
|
-
localized?: TextField['localized'];
|
|
31
|
-
/**
|
|
32
|
-
* Override for the `slug` field name.
|
|
33
|
-
* @default 'slug'
|
|
34
|
-
*/
|
|
35
|
-
name?: string;
|
|
36
|
-
/**
|
|
37
|
-
* A function used to override the slug field(s) at a granular level.
|
|
38
|
-
* Passes the row field to you to manipulate beyond the exposed options.
|
|
39
|
-
* @example
|
|
40
|
-
* ```ts
|
|
41
|
-
* slugField({
|
|
42
|
-
* overrides: (field) => {
|
|
43
|
-
* field.fields[1].label = 'Custom Slug Label'
|
|
44
|
-
* return field
|
|
45
|
-
* }
|
|
46
|
-
* })
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
overrides?: (field: RowField) => RowField;
|
|
50
|
-
position?: FieldAdmin['position'];
|
|
51
|
-
/**
|
|
52
|
-
* Whether or not the `slug` field is required.
|
|
53
|
-
* @default true
|
|
54
|
-
*/
|
|
55
|
-
required?: TextField['required'];
|
|
56
|
-
/**
|
|
57
|
-
* Provide your own slugify function to override the default.
|
|
58
|
-
*/
|
|
59
|
-
slugify?: Slugify;
|
|
60
|
-
/**
|
|
61
|
-
* The name of the top-level field to generate the slug from, when applicable.
|
|
62
|
-
* @default 'title'
|
|
63
|
-
*/
|
|
64
|
-
useAsSlug?: string;
|
|
65
|
-
};
|
|
66
|
-
export type SlugField = (args?: SlugFieldArgs) => RowField;
|
|
67
|
-
export type SlugFieldClientPropsOnly = Pick<SlugFieldArgs, 'useAsSlug'>;
|
|
68
|
-
/**
|
|
69
|
-
* These are the props that the `SlugField` client component accepts.
|
|
70
|
-
* The `SlugField` server component is responsible for passing down the `slugify` function.
|
|
71
|
-
*/
|
|
72
|
-
export type SlugFieldClientProps = SlugFieldClientPropsOnly & TextFieldClientProps;
|
|
73
|
-
/**
|
|
74
|
-
* A slug is a unique, indexed, URL-friendly string that identifies a particular document, often used to construct the URL of a webpage.
|
|
75
|
-
* The `slug` field auto-generates its value based on another field, e.g. "My Title" → "my-title".
|
|
76
|
-
*
|
|
77
|
-
* The slug should continue to be generated through:
|
|
78
|
-
* 1. The `create` operation, unless the user has modified the slug manually
|
|
79
|
-
* 2. The `update` operation, if:
|
|
80
|
-
* a. Autosave is _not_ enabled and there is no slug
|
|
81
|
-
* b. Autosave _is_ enabled, the doc is unpublished, and the user has not modified the slug manually
|
|
82
|
-
*
|
|
83
|
-
* The slug should stabilize after all above criteria have been met, because the URL is typically derived from the slug.
|
|
84
|
-
* This is to protect modifying potentially live URLs, breaking links, etc. without explicit intent.
|
|
85
|
-
*
|
|
86
|
-
* @experimental This field is experimental and may change or be removed in the future. Use at your own risk.
|
|
87
|
-
*/
|
|
88
|
-
export declare const slugField: SlugField;
|
|
89
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fields/baseFields/slug/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAA;AACtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAI7D,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,UAAU,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE;IACvD,IAAI,EAAE,CAAC,CAAA;IACP,GAAG,EAAE,cAAc,CAAA;IACnB,cAAc,CAAC,EAAE,GAAG,CAAA;CACrB,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,SAAS,CAAA;AAEtD,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAA;IAClC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,QAAQ,CAAA;IACzC,QAAQ,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAA;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAA;IAChC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,CAAC,IAAI,CAAC,EAAE,aAAa,KAAK,QAAQ,CAAA;AAE1D,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAA;AACvE;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GAAG,oBAAoB,CAAA;AAElF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS,EAAE,SAoEvB,CAAA"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { generateSlug } from './generateSlug.js';
|
|
2
|
-
/**
|
|
3
|
-
* A slug is a unique, indexed, URL-friendly string that identifies a particular document, often used to construct the URL of a webpage.
|
|
4
|
-
* The `slug` field auto-generates its value based on another field, e.g. "My Title" → "my-title".
|
|
5
|
-
*
|
|
6
|
-
* The slug should continue to be generated through:
|
|
7
|
-
* 1. The `create` operation, unless the user has modified the slug manually
|
|
8
|
-
* 2. The `update` operation, if:
|
|
9
|
-
* a. Autosave is _not_ enabled and there is no slug
|
|
10
|
-
* b. Autosave _is_ enabled, the doc is unpublished, and the user has not modified the slug manually
|
|
11
|
-
*
|
|
12
|
-
* The slug should stabilize after all above criteria have been met, because the URL is typically derived from the slug.
|
|
13
|
-
* This is to protect modifying potentially live URLs, breaking links, etc. without explicit intent.
|
|
14
|
-
*
|
|
15
|
-
* @experimental This field is experimental and may change or be removed in the future. Use at your own risk.
|
|
16
|
-
*/ export const slugField = ({ name: slugFieldName = 'slug', checkboxName = 'generateSlug', disableUnique = false, fieldToUse, localized, overrides, position = 'sidebar', required = true, slugify, useAsSlug: useAsSlugFromArgs = 'title' } = {})=>{
|
|
17
|
-
const useAsSlug = fieldToUse || useAsSlugFromArgs;
|
|
18
|
-
const baseField = {
|
|
19
|
-
type: 'row',
|
|
20
|
-
admin: {
|
|
21
|
-
position
|
|
22
|
-
},
|
|
23
|
-
fields: [
|
|
24
|
-
{
|
|
25
|
-
name: checkboxName,
|
|
26
|
-
type: 'checkbox',
|
|
27
|
-
admin: {
|
|
28
|
-
description: 'When enabled, the slug will auto-generate from the title field on save and autosave.',
|
|
29
|
-
disabled: {
|
|
30
|
-
bulkEdit: true,
|
|
31
|
-
column: true,
|
|
32
|
-
filter: true,
|
|
33
|
-
groupBy: true
|
|
34
|
-
},
|
|
35
|
-
hidden: true
|
|
36
|
-
},
|
|
37
|
-
defaultValue: true,
|
|
38
|
-
hooks: {
|
|
39
|
-
beforeChange: [
|
|
40
|
-
generateSlug({
|
|
41
|
-
slugFieldName,
|
|
42
|
-
slugify,
|
|
43
|
-
useAsSlug
|
|
44
|
-
})
|
|
45
|
-
]
|
|
46
|
-
},
|
|
47
|
-
localized
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: slugFieldName,
|
|
51
|
-
type: 'text',
|
|
52
|
-
admin: {
|
|
53
|
-
components: {
|
|
54
|
-
Field: {
|
|
55
|
-
clientProps: {
|
|
56
|
-
useAsSlug
|
|
57
|
-
},
|
|
58
|
-
path: '@payloadcms/ui#SlugField'
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
width: '100%'
|
|
62
|
-
},
|
|
63
|
-
custom: {
|
|
64
|
-
/**
|
|
65
|
-
* This is needed so we can access it from the `slugifyHandler` server function.
|
|
66
|
-
*/ slugify
|
|
67
|
-
},
|
|
68
|
-
index: true,
|
|
69
|
-
localized,
|
|
70
|
-
required,
|
|
71
|
-
unique: !disableUnique
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
};
|
|
75
|
-
if (typeof overrides === 'function') {
|
|
76
|
-
return overrides(baseField);
|
|
77
|
-
}
|
|
78
|
-
return baseField;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/fields/baseFields/slug/index.ts"],"sourcesContent":["import type { TextFieldClientProps } from '../../../admin/types.js'\nimport type { TypeWithID } from '../../../collections/config/types.js'\nimport type { FieldAdmin, RowField, TextField } from '../../../fields/config/types.js'\nimport type { PayloadRequest } from '../../../types/index.js'\n\nimport { generateSlug } from './generateSlug.js'\n\nexport type Slugify<T extends TypeWithID = any> = (args: {\n data: T\n req: PayloadRequest\n valueToSlugify?: any\n}) => Promise<string | undefined> | string | undefined\n\nexport type SlugFieldArgs = {\n /**\n * Override for the `generateSlug` checkbox field name.\n * @default 'generateSlug'\n */\n checkboxName?: string\n /**\n * Disables the unique index on the field.\n * This is useful if instead, you want to add a compound unique index to the collection `indexes` config,\n * for example with the multi tenant plugin, where the slug is only unique per tenant, not globally.\n * @default false\n */\n disableUnique?: boolean\n /**\n * @deprecated use `useAsSlug` instead.\n */\n fieldToUse?: string\n /**\n * Enable localization for the slug field.\n */\n localized?: TextField['localized']\n /**\n * Override for the `slug` field name.\n * @default 'slug'\n */\n name?: string\n /**\n * A function used to override the slug field(s) at a granular level.\n * Passes the row field to you to manipulate beyond the exposed options.\n * @example\n * ```ts\n * slugField({\n * overrides: (field) => {\n * field.fields[1].label = 'Custom Slug Label'\n * return field\n * }\n * })\n * ```\n */\n overrides?: (field: RowField) => RowField\n position?: FieldAdmin['position']\n /**\n * Whether or not the `slug` field is required.\n * @default true\n */\n required?: TextField['required']\n /**\n * Provide your own slugify function to override the default.\n */\n slugify?: Slugify\n /**\n * The name of the top-level field to generate the slug from, when applicable.\n * @default 'title'\n */\n useAsSlug?: string\n}\n\nexport type SlugField = (args?: SlugFieldArgs) => RowField\n\nexport type SlugFieldClientPropsOnly = Pick<SlugFieldArgs, 'useAsSlug'>\n/**\n * These are the props that the `SlugField` client component accepts.\n * The `SlugField` server component is responsible for passing down the `slugify` function.\n */\nexport type SlugFieldClientProps = SlugFieldClientPropsOnly & TextFieldClientProps\n\n/**\n * A slug is a unique, indexed, URL-friendly string that identifies a particular document, often used to construct the URL of a webpage.\n * The `slug` field auto-generates its value based on another field, e.g. \"My Title\" → \"my-title\".\n *\n * The slug should continue to be generated through:\n * 1. The `create` operation, unless the user has modified the slug manually\n * 2. The `update` operation, if:\n * a. Autosave is _not_ enabled and there is no slug\n * b. Autosave _is_ enabled, the doc is unpublished, and the user has not modified the slug manually\n *\n * The slug should stabilize after all above criteria have been met, because the URL is typically derived from the slug.\n * This is to protect modifying potentially live URLs, breaking links, etc. without explicit intent.\n *\n * @experimental This field is experimental and may change or be removed in the future. Use at your own risk.\n */\nexport const slugField: SlugField = ({\n name: slugFieldName = 'slug',\n checkboxName = 'generateSlug',\n disableUnique = false,\n fieldToUse,\n localized,\n overrides,\n position = 'sidebar',\n required = true,\n slugify,\n useAsSlug: useAsSlugFromArgs = 'title',\n} = {}) => {\n const useAsSlug = fieldToUse || useAsSlugFromArgs\n\n const baseField: RowField = {\n type: 'row',\n admin: {\n position,\n },\n fields: [\n {\n name: checkboxName,\n type: 'checkbox',\n admin: {\n description:\n 'When enabled, the slug will auto-generate from the title field on save and autosave.',\n disabled: { bulkEdit: true, column: true, filter: true, groupBy: true },\n hidden: true,\n },\n defaultValue: true,\n hooks: {\n beforeChange: [generateSlug({ slugFieldName, slugify, useAsSlug })],\n },\n localized,\n },\n {\n name: slugFieldName,\n type: 'text',\n admin: {\n components: {\n Field: {\n clientProps: {\n useAsSlug,\n } satisfies SlugFieldClientPropsOnly,\n path: '@payloadcms/ui#SlugField',\n },\n },\n width: '100%',\n },\n custom: {\n /**\n * This is needed so we can access it from the `slugifyHandler` server function.\n */\n slugify,\n },\n index: true,\n localized,\n required,\n unique: !disableUnique,\n },\n ],\n }\n\n if (typeof overrides === 'function') {\n return overrides(baseField)\n }\n\n return baseField\n}\n"],"names":["generateSlug","slugField","name","slugFieldName","checkboxName","disableUnique","fieldToUse","localized","overrides","position","required","slugify","useAsSlug","useAsSlugFromArgs","baseField","type","admin","fields","description","disabled","bulkEdit","column","filter","groupBy","hidden","defaultValue","hooks","beforeChange","components","Field","clientProps","path","width","custom","index","unique"],"mappings":"AAKA,SAASA,YAAY,QAAQ,oBAAmB;AA0EhD;;;;;;;;;;;;;;CAcC,GACD,OAAO,MAAMC,YAAuB,CAAC,EACnCC,MAAMC,gBAAgB,MAAM,EAC5BC,eAAe,cAAc,EAC7BC,gBAAgB,KAAK,EACrBC,UAAU,EACVC,SAAS,EACTC,SAAS,EACTC,WAAW,SAAS,EACpBC,WAAW,IAAI,EACfC,OAAO,EACPC,WAAWC,oBAAoB,OAAO,EACvC,GAAG,CAAC,CAAC;IACJ,MAAMD,YAAYN,cAAcO;IAEhC,MAAMC,YAAsB;QAC1BC,MAAM;QACNC,OAAO;YACLP;QACF;QACAQ,QAAQ;YACN;gBACEf,MAAME;gBACNW,MAAM;gBACNC,OAAO;oBACLE,aACE;oBACFC,UAAU;wBAAEC,UAAU;wBAAMC,QAAQ;wBAAMC,QAAQ;wBAAMC,SAAS;oBAAK;oBACtEC,QAAQ;gBACV;gBACAC,cAAc;gBACdC,OAAO;oBACLC,cAAc;wBAAC3B,aAAa;4BAAEG;4BAAeQ;4BAASC;wBAAU;qBAAG;gBACrE;gBACAL;YACF;YACA;gBACEL,MAAMC;gBACNY,MAAM;gBACNC,OAAO;oBACLY,YAAY;wBACVC,OAAO;4BACLC,aAAa;gCACXlB;4BACF;4BACAmB,MAAM;wBACR;oBACF;oBACAC,OAAO;gBACT;gBACAC,QAAQ;oBACN;;WAEC,GACDtB;gBACF;gBACAuB,OAAO;gBACP3B;gBACAG;gBACAyB,QAAQ,CAAC9B;YACX;SACD;IACH;IAEA,IAAI,OAAOG,cAAc,YAAY;QACnC,OAAOA,UAAUM;IACnB;IAEA,OAAOA;AACT,EAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tempFile.d.ts","sourceRoot":"","sources":["../../src/uploads/tempFile.ts"],"names":[],"mappings":"AAaA,KAAK,OAAO,GAAG;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,iBAAiB,GAC5B,UAAU,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,EACjD,UAAS,OAAY,iBAItB,CAAA"}
|
package/dist/uploads/tempFile.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import fs from 'fs/promises';
|
|
2
|
-
import os from 'node:os';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { v4 as uuid } from 'uuid';
|
|
5
|
-
async function runTask(temporaryPath, callback) {
|
|
6
|
-
try {
|
|
7
|
-
return await callback(temporaryPath);
|
|
8
|
-
} finally{
|
|
9
|
-
await fs.rm(temporaryPath, {
|
|
10
|
-
force: true,
|
|
11
|
-
maxRetries: 2,
|
|
12
|
-
recursive: true
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export const temporaryFileTask = async (callback, options = {})=>{
|
|
17
|
-
const filePath = await temporaryFile(options);
|
|
18
|
-
return runTask(filePath, callback);
|
|
19
|
-
};
|
|
20
|
-
async function temporaryFile(options) {
|
|
21
|
-
if (options.name) {
|
|
22
|
-
if (options.extension !== undefined && options.extension !== null) {
|
|
23
|
-
throw new Error('The `name` and `extension` options are mutually exclusive');
|
|
24
|
-
}
|
|
25
|
-
return path.join(await temporaryDirectory(), options.name);
|
|
26
|
-
}
|
|
27
|
-
return await getPath() + (options.extension === undefined || options.extension === null ? '' : '.' + options.extension.replace(/^\./, ''));
|
|
28
|
-
}
|
|
29
|
-
async function temporaryDirectory({ prefix = '' } = {}) {
|
|
30
|
-
const directory = await getPath(prefix);
|
|
31
|
-
await fs.mkdir(directory);
|
|
32
|
-
return directory;
|
|
33
|
-
}
|
|
34
|
-
async function getPath(prefix = '') {
|
|
35
|
-
const temporaryDirectory = await fs.realpath(os.tmpdir());
|
|
36
|
-
return path.join(temporaryDirectory, prefix + uuid());
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
//# sourceMappingURL=tempFile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/uploads/tempFile.ts"],"sourcesContent":["import fs from 'fs/promises'\nimport os from 'node:os'\nimport path from 'node:path'\nimport { v4 as uuid } from 'uuid'\n\nasync function runTask(temporaryPath: string, callback: (temporaryPath: string) => Promise<any>) {\n try {\n return await callback(temporaryPath)\n } finally {\n await fs.rm(temporaryPath, { force: true, maxRetries: 2, recursive: true })\n }\n}\n\ntype Options = {\n extension?: string\n name?: string\n}\n\nexport const temporaryFileTask = async (\n callback: (temporaryPath: string) => Promise<any>,\n options: Options = {},\n) => {\n const filePath = await temporaryFile(options)\n return runTask(filePath, callback)\n}\n\nasync function temporaryFile(options: Options) {\n if (options.name) {\n if (options.extension !== undefined && options.extension !== null) {\n throw new Error('The `name` and `extension` options are mutually exclusive')\n }\n\n return path.join(await temporaryDirectory(), options.name)\n }\n\n return (\n (await getPath()) +\n (options.extension === undefined || options.extension === null\n ? ''\n : '.' + options.extension.replace(/^\\./, ''))\n )\n}\n\nasync function temporaryDirectory({ prefix = '' } = {}) {\n const directory = await getPath(prefix)\n await fs.mkdir(directory)\n return directory\n}\n\nasync function getPath(prefix = ''): Promise<string> {\n const temporaryDirectory = await fs.realpath(os.tmpdir())\n return path.join(temporaryDirectory, prefix + uuid())\n}\n"],"names":["fs","os","path","v4","uuid","runTask","temporaryPath","callback","rm","force","maxRetries","recursive","temporaryFileTask","options","filePath","temporaryFile","name","extension","undefined","Error","join","temporaryDirectory","getPath","replace","prefix","directory","mkdir","realpath","tmpdir"],"mappings":"AAAA,OAAOA,QAAQ,cAAa;AAC5B,OAAOC,QAAQ,UAAS;AACxB,OAAOC,UAAU,YAAW;AAC5B,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAEjC,eAAeC,QAAQC,aAAqB,EAAEC,QAAiD;IAC7F,IAAI;QACF,OAAO,MAAMA,SAASD;IACxB,SAAU;QACR,MAAMN,GAAGQ,EAAE,CAACF,eAAe;YAAEG,OAAO;YAAMC,YAAY;YAAGC,WAAW;QAAK;IAC3E;AACF;AAOA,OAAO,MAAMC,oBAAoB,OAC/BL,UACAM,UAAmB,CAAC,CAAC;IAErB,MAAMC,WAAW,MAAMC,cAAcF;IACrC,OAAOR,QAAQS,UAAUP;AAC3B,EAAC;AAED,eAAeQ,cAAcF,OAAgB;IAC3C,IAAIA,QAAQG,IAAI,EAAE;QAChB,IAAIH,QAAQI,SAAS,KAAKC,aAAaL,QAAQI,SAAS,KAAK,MAAM;YACjE,MAAM,IAAIE,MAAM;QAClB;QAEA,OAAOjB,KAAKkB,IAAI,CAAC,MAAMC,sBAAsBR,QAAQG,IAAI;IAC3D;IAEA,OACE,AAAC,MAAMM,YACNT,CAAAA,QAAQI,SAAS,KAAKC,aAAaL,QAAQI,SAAS,KAAK,OACtD,KACA,MAAMJ,QAAQI,SAAS,CAACM,OAAO,CAAC,OAAO,GAAE;AAEjD;AAEA,eAAeF,mBAAmB,EAAEG,SAAS,EAAE,EAAE,GAAG,CAAC,CAAC;IACpD,MAAMC,YAAY,MAAMH,QAAQE;IAChC,MAAMxB,GAAG0B,KAAK,CAACD;IACf,OAAOA;AACT;AAEA,eAAeH,QAAQE,SAAS,EAAE;IAChC,MAAMH,qBAAqB,MAAMrB,GAAG2B,QAAQ,CAAC1B,GAAG2B,MAAM;IACtD,OAAO1B,KAAKkB,IAAI,CAACC,oBAAoBG,SAASpB;AAChD"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Whether React Server Components are supported in the current environment.
|
|
3
|
-
* Controlled by the `PAYLOAD_FRAMEWORK_RSC_ENABLED` environment variable.
|
|
4
|
-
*
|
|
5
|
-
* - `PAYLOAD_FRAMEWORK_RSC_ENABLED=true` → RSC is available (set by Next.js `withPayload` and
|
|
6
|
-
* TanStack Start's `payloadPlugin` via `@vitejs/plugin-rsc`)
|
|
7
|
-
* - `PAYLOAD_FRAMEWORK_RSC_ENABLED=false` → RSC is NOT available
|
|
8
|
-
*
|
|
9
|
-
* Defaults to `true` when the variable is not set.
|
|
10
|
-
*/
|
|
11
|
-
export declare function isRSCEnabled(): boolean;
|
|
12
|
-
//# sourceMappingURL=isRSCEnabled.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isRSCEnabled.d.ts","sourceRoot":"","sources":["../../src/utilities/isRSCEnabled.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAEtC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Whether React Server Components are supported in the current environment.
|
|
3
|
-
* Controlled by the `PAYLOAD_FRAMEWORK_RSC_ENABLED` environment variable.
|
|
4
|
-
*
|
|
5
|
-
* - `PAYLOAD_FRAMEWORK_RSC_ENABLED=true` → RSC is available (set by Next.js `withPayload` and
|
|
6
|
-
* TanStack Start's `payloadPlugin` via `@vitejs/plugin-rsc`)
|
|
7
|
-
* - `PAYLOAD_FRAMEWORK_RSC_ENABLED=false` → RSC is NOT available
|
|
8
|
-
*
|
|
9
|
-
* Defaults to `true` when the variable is not set.
|
|
10
|
-
*/ export function isRSCEnabled() {
|
|
11
|
-
return process.env.PAYLOAD_FRAMEWORK_RSC_ENABLED !== 'false';
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
//# sourceMappingURL=isRSCEnabled.js.map
|