payload 3.0.0-beta.53 → 3.0.0-beta.55
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/dist/admin/LanguageOptions.js.map +1 -1
- package/dist/admin/RichText.js.map +1 -1
- package/dist/admin/elements/Cell.d.ts +0 -1
- package/dist/admin/elements/Cell.d.ts.map +1 -1
- package/dist/admin/elements/Cell.js.map +1 -1
- package/dist/admin/elements/DatePicker.js.map +1 -1
- package/dist/admin/elements/PreviewButton.js.map +1 -1
- package/dist/admin/elements/PublishButton.js.map +1 -1
- package/dist/admin/elements/SaveButton.js.map +1 -1
- package/dist/admin/elements/SaveDraftButton.js.map +1 -1
- package/dist/admin/elements/Tab.d.ts +0 -1
- package/dist/admin/elements/Tab.d.ts.map +1 -1
- package/dist/admin/elements/Tab.js.map +1 -1
- package/dist/admin/elements/Upload.d.ts +3 -0
- package/dist/admin/elements/Upload.d.ts.map +1 -0
- package/dist/admin/elements/Upload.js +3 -0
- package/dist/admin/elements/Upload.js.map +1 -0
- package/dist/admin/elements/WithServerSideProps.js.map +1 -1
- package/dist/admin/forms/Error.d.ts +0 -1
- package/dist/admin/forms/Error.d.ts.map +1 -1
- package/dist/admin/forms/Error.js.map +1 -1
- package/dist/admin/forms/FieldDescription.js.map +1 -1
- package/dist/admin/forms/FieldTypes.d.ts +0 -1
- package/dist/admin/forms/FieldTypes.d.ts.map +1 -1
- package/dist/admin/forms/FieldTypes.js.map +1 -1
- package/dist/admin/forms/Form.js.map +1 -1
- package/dist/admin/forms/Label.d.ts +0 -1
- package/dist/admin/forms/Label.d.ts.map +1 -1
- package/dist/admin/forms/Label.js.map +1 -1
- package/dist/admin/forms/RowLabel.js.map +1 -1
- package/dist/admin/types.d.ts +1 -0
- package/dist/admin/types.d.ts.map +1 -1
- package/dist/admin/types.js.map +1 -1
- package/dist/admin/views/types.d.ts +0 -1
- package/dist/admin/views/types.d.ts.map +1 -1
- package/dist/admin/views/types.js.map +1 -1
- package/dist/assets/assets.d.js.map +1 -1
- package/dist/auth/baseFields/accountLock.d.ts.map +1 -1
- package/dist/auth/baseFields/accountLock.js.map +1 -1
- package/dist/auth/baseFields/apiKey.d.ts.map +1 -1
- package/dist/auth/baseFields/apiKey.js.map +1 -1
- package/dist/auth/baseFields/auth.js.map +1 -1
- package/dist/auth/baseFields/verification.d.ts.map +1 -1
- package/dist/auth/baseFields/verification.js.map +1 -1
- package/dist/auth/cookies.d.ts +3 -3
- package/dist/auth/cookies.d.ts.map +1 -1
- package/dist/auth/cookies.js.map +1 -1
- package/dist/auth/crypto.js.map +1 -1
- package/dist/auth/defaultAccess.js.map +1 -1
- package/dist/auth/defaultUser.js.map +1 -1
- package/dist/auth/executeAccess.d.ts.map +1 -1
- package/dist/auth/executeAccess.js.map +1 -1
- package/dist/auth/executeAuthStrategies.d.ts +2 -2
- package/dist/auth/executeAuthStrategies.d.ts.map +1 -1
- package/dist/auth/executeAuthStrategies.js.map +1 -1
- package/dist/auth/extractJWT.d.ts +1 -1
- package/dist/auth/extractJWT.d.ts.map +1 -1
- package/dist/auth/extractJWT.js.map +1 -1
- package/dist/auth/getAccessResults.js.map +1 -1
- package/dist/auth/getFieldsToSign.d.ts +1 -1
- package/dist/auth/getFieldsToSign.d.ts.map +1 -1
- package/dist/auth/getFieldsToSign.js.map +1 -1
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/isLocked.js.map +1 -1
- package/dist/auth/operations/access.d.ts.map +1 -1
- package/dist/auth/operations/access.js.map +1 -1
- package/dist/auth/operations/auth.d.ts +2 -3
- package/dist/auth/operations/auth.d.ts.map +1 -1
- package/dist/auth/operations/auth.js +0 -4
- package/dist/auth/operations/auth.js.map +1 -1
- package/dist/auth/operations/forgotPassword.d.ts.map +1 -1
- package/dist/auth/operations/forgotPassword.js.map +1 -1
- package/dist/auth/operations/init.d.ts.map +1 -1
- package/dist/auth/operations/init.js.map +1 -1
- package/dist/auth/operations/local/auth.d.ts.map +1 -1
- package/dist/auth/operations/local/auth.js.map +1 -1
- package/dist/auth/operations/local/forgotPassword.d.ts +3 -3
- package/dist/auth/operations/local/forgotPassword.d.ts.map +1 -1
- package/dist/auth/operations/local/forgotPassword.js.map +1 -1
- package/dist/auth/operations/local/index.js.map +1 -1
- package/dist/auth/operations/local/login.d.ts +4 -4
- package/dist/auth/operations/local/login.d.ts.map +1 -1
- package/dist/auth/operations/local/login.js.map +1 -1
- package/dist/auth/operations/local/resetPassword.d.ts +3 -3
- package/dist/auth/operations/local/resetPassword.d.ts.map +1 -1
- package/dist/auth/operations/local/resetPassword.js.map +1 -1
- package/dist/auth/operations/local/unlock.d.ts +3 -3
- package/dist/auth/operations/local/unlock.d.ts.map +1 -1
- package/dist/auth/operations/local/unlock.js.map +1 -1
- package/dist/auth/operations/local/verifyEmail.d.ts +3 -3
- package/dist/auth/operations/local/verifyEmail.d.ts.map +1 -1
- package/dist/auth/operations/local/verifyEmail.js.map +1 -1
- package/dist/auth/operations/login.d.ts +4 -4
- 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/logout.js.map +1 -1
- package/dist/auth/operations/me.d.ts +1 -0
- package/dist/auth/operations/me.d.ts.map +1 -1
- package/dist/auth/operations/me.js +1 -0
- package/dist/auth/operations/me.js.map +1 -1
- package/dist/auth/operations/refresh.d.ts +1 -0
- package/dist/auth/operations/refresh.d.ts.map +1 -1
- package/dist/auth/operations/refresh.js +1 -0
- package/dist/auth/operations/refresh.js.map +1 -1
- package/dist/auth/operations/registerFirstUser.d.ts +7 -10
- package/dist/auth/operations/registerFirstUser.d.ts.map +1 -1
- package/dist/auth/operations/registerFirstUser.js.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.map +1 -1
- package/dist/auth/operations/verifyEmail.d.ts.map +1 -1
- package/dist/auth/operations/verifyEmail.js.map +1 -1
- package/dist/auth/sendVerificationEmail.js.map +1 -1
- package/dist/auth/strategies/apiKey.js.map +1 -1
- 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/authenticate.js.map +1 -1
- package/dist/auth/strategies/local/generatePasswordSaltHash.d.ts.map +1 -1
- package/dist/auth/strategies/local/generatePasswordSaltHash.js.map +1 -1
- package/dist/auth/strategies/local/incrementLoginAttempts.d.ts.map +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/register.js.map +1 -1
- package/dist/auth/strategies/local/resetLoginAttempts.d.ts.map +1 -1
- package/dist/auth/strategies/local/resetLoginAttempts.js.map +1 -1
- package/dist/auth/types.d.ts +1 -2
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/types.js.map +1 -1
- package/dist/bin/generateTypes.js.map +1 -1
- package/dist/bin/index.js.map +1 -1
- package/dist/bin/loadEnv.js.map +1 -1
- package/dist/bin/loader/clientExtensions.js.map +1 -1
- package/dist/bin/loader/compile.js.map +1 -1
- package/dist/bin/loader/ignores.js.map +1 -1
- package/dist/bin/loader/index.js.map +1 -1
- package/dist/bin/loader/read-default-tsconfig.js.map +1 -1
- package/dist/bin/loader/resolveOriginalPath.js.map +1 -1
- package/dist/bin/migrate.d.ts.map +1 -1
- package/dist/bin/migrate.js.map +1 -1
- package/dist/collections/config/build.js.map +1 -1
- package/dist/collections/config/client.d.ts +79 -109
- package/dist/collections/config/client.d.ts.map +1 -1
- package/dist/collections/config/client.js.map +1 -1
- package/dist/collections/config/defaults.js.map +1 -1
- package/dist/collections/config/sanitize.d.ts.map +1 -1
- package/dist/collections/config/sanitize.js.map +1 -1
- package/dist/collections/config/schema.d.ts.map +1 -1
- package/dist/collections/config/schema.js +3 -5
- package/dist/collections/config/schema.js.map +1 -1
- package/dist/collections/config/types.d.ts +17 -10
- package/dist/collections/config/types.d.ts.map +1 -1
- package/dist/collections/config/types.js.map +1 -1
- package/dist/collections/dataloader.js.map +1 -1
- package/dist/collections/operations/count.d.ts +3 -2
- package/dist/collections/operations/count.d.ts.map +1 -1
- package/dist/collections/operations/count.js.map +1 -1
- package/dist/collections/operations/create.d.ts +5 -9
- package/dist/collections/operations/create.d.ts.map +1 -1
- package/dist/collections/operations/create.js.map +1 -1
- package/dist/collections/operations/delete.d.ts +5 -5
- package/dist/collections/operations/delete.d.ts.map +1 -1
- package/dist/collections/operations/delete.js.map +1 -1
- package/dist/collections/operations/deleteByID.d.ts +4 -3
- package/dist/collections/operations/deleteByID.d.ts.map +1 -1
- package/dist/collections/operations/deleteByID.js.map +1 -1
- package/dist/collections/operations/docAccess.js.map +1 -1
- package/dist/collections/operations/duplicate.d.ts +3 -3
- package/dist/collections/operations/duplicate.d.ts.map +1 -1
- package/dist/collections/operations/duplicate.js.map +1 -1
- package/dist/collections/operations/find.d.ts +3 -2
- package/dist/collections/operations/find.d.ts.map +1 -1
- package/dist/collections/operations/find.js.map +1 -1
- package/dist/collections/operations/findByID.d.ts +3 -2
- package/dist/collections/operations/findByID.d.ts.map +1 -1
- package/dist/collections/operations/findByID.js +2 -3
- package/dist/collections/operations/findByID.js.map +1 -1
- package/dist/collections/operations/findVersionByID.d.ts +1 -1
- package/dist/collections/operations/findVersionByID.d.ts.map +1 -1
- package/dist/collections/operations/findVersionByID.js.map +1 -1
- package/dist/collections/operations/findVersions.d.ts +1 -1
- package/dist/collections/operations/findVersions.d.ts.map +1 -1
- package/dist/collections/operations/findVersions.js.map +1 -1
- package/dist/collections/operations/local/count.d.ts +5 -5
- 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/create.d.ts +7 -7
- 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 +12 -12
- 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 +6 -5
- 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 +7 -6
- package/dist/collections/operations/local/find.d.ts.map +1 -1
- package/dist/collections/operations/local/find.js +1 -1
- package/dist/collections/operations/local/find.js.map +1 -1
- package/dist/collections/operations/local/findByID.d.ts +7 -6
- 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/findVersionByID.d.ts +7 -6
- 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 +7 -6
- 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/index.d.ts +2 -2
- package/dist/collections/operations/local/index.d.ts.map +1 -1
- package/dist/collections/operations/local/index.js +2 -2
- package/dist/collections/operations/local/index.js.map +1 -1
- package/dist/collections/operations/local/restoreVersion.d.ts +7 -6
- 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 +12 -12
- 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 +1 -1
- package/dist/collections/operations/restoreVersion.d.ts.map +1 -1
- package/dist/collections/operations/restoreVersion.js.map +1 -1
- package/dist/collections/operations/update.d.ts +5 -6
- package/dist/collections/operations/update.d.ts.map +1 -1
- package/dist/collections/operations/update.js.map +1 -1
- package/dist/collections/operations/updateByID.d.ts +5 -7
- package/dist/collections/operations/updateByID.d.ts.map +1 -1
- package/dist/collections/operations/updateByID.js.map +1 -1
- package/dist/collections/operations/utils.d.ts +39 -36
- package/dist/collections/operations/utils.d.ts.map +1 -1
- package/dist/collections/operations/utils.js +0 -1
- package/dist/collections/operations/utils.js.map +1 -1
- package/dist/config/build.js.map +1 -1
- package/dist/config/client.d.ts.map +1 -1
- package/dist/config/client.js.map +1 -1
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/find.js.map +1 -1
- package/dist/config/sanitize.d.ts.map +1 -1
- package/dist/config/sanitize.js.map +1 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/config/shared/adminViewSchema.js.map +1 -1
- package/dist/config/shared/componentSchema.js.map +1 -1
- package/dist/config/shared/openGraphSchema.js.map +1 -1
- package/dist/config/types.d.ts +2 -3
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js.map +1 -1
- package/dist/config/validate.js.map +1 -1
- package/dist/database/combineQueries.js.map +1 -1
- package/dist/database/createDatabaseAdapter.js.map +1 -1
- package/dist/database/flattenWhereToOperators.js.map +1 -1
- package/dist/database/getLocalizedPaths.js.map +1 -1
- package/dist/database/migrations/createMigration.js.map +1 -1
- package/dist/database/migrations/getMigrations.js.map +1 -1
- package/dist/database/migrations/getPredefinedMigration.d.ts.map +1 -1
- package/dist/database/migrations/getPredefinedMigration.js.map +1 -1
- package/dist/database/migrations/migrate.js.map +1 -1
- package/dist/database/migrations/migrateDown.js.map +1 -1
- package/dist/database/migrations/migrateRefresh.js.map +1 -1
- package/dist/database/migrations/migrateReset.js.map +1 -1
- package/dist/database/migrations/migrateStatus.js.map +1 -1
- package/dist/database/migrations/migrationTemplate.js.map +1 -1
- package/dist/database/migrations/migrationsCollection.js.map +1 -1
- package/dist/database/migrations/readMigrationFiles.d.ts.map +1 -1
- package/dist/database/migrations/readMigrationFiles.js.map +1 -1
- package/dist/database/queryValidation/types.js.map +1 -1
- package/dist/database/queryValidation/validateQueryPaths.js.map +1 -1
- package/dist/database/queryValidation/validateSearchParams.js.map +1 -1
- package/dist/database/types.d.ts +5 -6
- package/dist/database/types.d.ts.map +1 -1
- package/dist/database/types.js.map +1 -1
- package/dist/email/consoleEmailAdapter.js.map +1 -1
- package/dist/email/defaults.js.map +1 -1
- package/dist/email/getStringifiedToAddress.js.map +1 -1
- package/dist/email/sendEmail.js.map +1 -1
- package/dist/email/types.js.map +1 -1
- package/dist/errors/APIError.js.map +1 -1
- package/dist/errors/AuthenticationError.js.map +1 -1
- package/dist/errors/DuplicateCollection.js.map +1 -1
- package/dist/errors/DuplicateFieldName.js.map +1 -1
- package/dist/errors/DuplicateGlobal.js.map +1 -1
- package/dist/errors/ErrorDeletingFile.js.map +1 -1
- package/dist/errors/FileRetrievalError.js.map +1 -1
- package/dist/errors/FileUploadError.js.map +1 -1
- package/dist/errors/Forbidden.js.map +1 -1
- package/dist/errors/InvalidConfiguration.js.map +1 -1
- package/dist/errors/InvalidFieldName.js.map +1 -1
- package/dist/errors/InvalidFieldRelationship.js.map +1 -1
- package/dist/errors/InvalidSchema.js.map +1 -1
- package/dist/errors/LockedAuth.js.map +1 -1
- package/dist/errors/MissingCollectionLabel.js.map +1 -1
- package/dist/errors/MissingEditorProp.js.map +1 -1
- package/dist/errors/MissingFieldInputOptions.js.map +1 -1
- package/dist/errors/MissingFieldType.js.map +1 -1
- package/dist/errors/MissingFile.js.map +1 -1
- package/dist/errors/NotFound.js.map +1 -1
- package/dist/errors/QueryError.js.map +1 -1
- package/dist/errors/TimestampsRequired.js.map +1 -1
- package/dist/errors/UnathorizedError.js.map +1 -1
- package/dist/errors/ValidationError.js.map +1 -1
- package/dist/errors/index.js.map +1 -1
- package/dist/errors/types.js.map +1 -1
- package/dist/exports/i18n/ar.js.map +1 -1
- package/dist/exports/i18n/az.js.map +1 -1
- package/dist/exports/i18n/bg.js.map +1 -1
- package/dist/exports/i18n/cs.js.map +1 -1
- package/dist/exports/i18n/de.js.map +1 -1
- package/dist/exports/i18n/en.js.map +1 -1
- package/dist/exports/i18n/es.js.map +1 -1
- package/dist/exports/i18n/fa.js.map +1 -1
- package/dist/exports/i18n/fr.js.map +1 -1
- package/dist/exports/i18n/he.js.map +1 -1
- package/dist/exports/i18n/hr.js.map +1 -1
- package/dist/exports/i18n/hu.js.map +1 -1
- package/dist/exports/i18n/it.js.map +1 -1
- package/dist/exports/i18n/ja.js.map +1 -1
- package/dist/exports/i18n/ko.js.map +1 -1
- package/dist/exports/i18n/my.js.map +1 -1
- package/dist/exports/i18n/nb.js.map +1 -1
- package/dist/exports/i18n/nl.js.map +1 -1
- package/dist/exports/i18n/pl.js.map +1 -1
- package/dist/exports/i18n/pt.js.map +1 -1
- package/dist/exports/i18n/ro.js.map +1 -1
- package/dist/exports/i18n/rs.js.map +1 -1
- package/dist/exports/i18n/rsLatin.js.map +1 -1
- package/dist/exports/i18n/ru.js.map +1 -1
- package/dist/exports/i18n/sv.js.map +1 -1
- package/dist/exports/i18n/th.js.map +1 -1
- package/dist/exports/i18n/tr.js.map +1 -1
- package/dist/exports/i18n/uk.js.map +1 -1
- package/dist/exports/i18n/vi.js.map +1 -1
- package/dist/exports/i18n/zh.js.map +1 -1
- package/dist/exports/i18n/zhTw.js.map +1 -1
- package/dist/exports/node.js.map +1 -1
- package/dist/exports/shared.js.map +1 -1
- package/dist/fields/baseFields/baseBlockFields.js.map +1 -1
- package/dist/fields/baseFields/baseIDField.js.map +1 -1
- package/dist/fields/config/client.d.ts +333 -334
- package/dist/fields/config/client.d.ts.map +1 -1
- package/dist/fields/config/client.js.map +1 -1
- package/dist/fields/config/sanitize.d.ts.map +1 -1
- package/dist/fields/config/sanitize.js.map +1 -1
- package/dist/fields/config/sanitize.spec.js.map +1 -1
- package/dist/fields/config/schema.js +1 -1
- package/dist/fields/config/schema.js.map +1 -1
- package/dist/fields/config/types.d.ts +7 -6
- package/dist/fields/config/types.d.ts.map +1 -1
- package/dist/fields/config/types.js.map +1 -1
- package/dist/fields/getDefaultValue.js.map +1 -1
- package/dist/fields/getFieldPaths.js.map +1 -1
- package/dist/fields/hooks/afterChange/index.d.ts.map +1 -1
- package/dist/fields/hooks/afterChange/index.js.map +1 -1
- package/dist/fields/hooks/afterChange/promise.d.ts.map +1 -1
- package/dist/fields/hooks/afterChange/promise.js.map +1 -1
- package/dist/fields/hooks/afterChange/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/afterChange/traverseFields.js.map +1 -1
- package/dist/fields/hooks/afterRead/index.js.map +1 -1
- package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -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/relationshipPopulationPromise.js.map +1 -1
- package/dist/fields/hooks/afterRead/traverseFields.js.map +1 -1
- package/dist/fields/hooks/beforeChange/beforeDuplicate.js.map +1 -1
- package/dist/fields/hooks/beforeChange/cloneDataFromOriginalDoc.js.map +1 -1
- package/dist/fields/hooks/beforeChange/getExistingRowDoc.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/getExistingRowDoc.js.map +1 -1
- package/dist/fields/hooks/beforeChange/index.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/index.js.map +1 -1
- package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
- 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/beforeChange/traverseFields.js.map +1 -1
- package/dist/fields/hooks/beforeValidate/index.d.ts.map +1 -1
- package/dist/fields/hooks/beforeValidate/index.js.map +1 -1
- package/dist/fields/hooks/beforeValidate/promise.d.ts.map +1 -1
- package/dist/fields/hooks/beforeValidate/promise.js.map +1 -1
- package/dist/fields/hooks/beforeValidate/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/beforeValidate/traverseFields.js.map +1 -1
- package/dist/fields/mergeBaseFields.js.map +1 -1
- package/dist/fields/setDefaultBeforeDuplicate.js.map +1 -1
- package/dist/fields/sortableFieldTypes.js.map +1 -1
- package/dist/fields/validations.d.ts +6 -7
- package/dist/fields/validations.d.ts.map +1 -1
- package/dist/fields/validations.js +1 -1
- package/dist/fields/validations.js.map +1 -1
- package/dist/fields/validations.spec.js.map +1 -1
- package/dist/globals/config/client.d.ts +2 -2
- package/dist/globals/config/client.js.map +1 -1
- package/dist/globals/config/sanitize.d.ts.map +1 -1
- package/dist/globals/config/sanitize.js.map +1 -1
- package/dist/globals/config/schema.js.map +1 -1
- package/dist/globals/config/types.d.ts +2 -3
- package/dist/globals/config/types.d.ts.map +1 -1
- package/dist/globals/config/types.js.map +1 -1
- package/dist/globals/operations/docAccess.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/globals/operations/findVersionByID.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/globals/operations/local/findOne.d.ts +7 -6
- 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 +7 -6
- 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 +7 -6
- 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/index.js.map +1 -1
- package/dist/globals/operations/local/restoreVersion.d.ts +7 -6
- 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 +7 -6
- 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.map +1 -1
- package/dist/globals/operations/update.d.ts +5 -7
- package/dist/globals/operations/update.d.ts.map +1 -1
- package/dist/globals/operations/update.js.map +1 -1
- package/dist/index.d.ts +55 -44
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/preferences/deleteUserPreferences.js.map +1 -1
- package/dist/preferences/operations/delete.js.map +1 -1
- package/dist/preferences/operations/findOne.d.ts +2 -2
- package/dist/preferences/operations/findOne.d.ts.map +1 -1
- package/dist/preferences/operations/findOne.js.map +1 -1
- package/dist/preferences/operations/update.js.map +1 -1
- package/dist/preferences/preferencesCollection.js.map +1 -1
- package/dist/preferences/requestHandlers/delete.js.map +1 -1
- package/dist/preferences/requestHandlers/findOne.js.map +1 -1
- package/dist/preferences/requestHandlers/update.js.map +1 -1
- package/dist/preferences/types.js.map +1 -1
- package/dist/translations/getLocalI18n.js.map +1 -1
- package/dist/types/constants.js.map +1 -1
- package/dist/types/index.d.ts +3 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/uploads/canResizeImage.js.map +1 -1
- package/dist/uploads/cropImage.js +3 -3
- package/dist/uploads/cropImage.js.map +1 -1
- package/dist/uploads/deleteAssociatedFiles.js.map +1 -1
- package/dist/uploads/docWithFilenameExists.d.ts.map +1 -1
- package/dist/uploads/docWithFilenameExists.js.map +1 -1
- package/dist/uploads/fileExists.d.ts.map +1 -1
- package/dist/uploads/fileExists.js.map +1 -1
- package/dist/uploads/formatFilesize.js.map +1 -1
- package/dist/uploads/generateFileData.d.ts.map +1 -1
- package/dist/uploads/generateFileData.js.map +1 -1
- package/dist/uploads/getBaseFields.js.map +1 -1
- package/dist/uploads/getExternalFile.d.ts.map +1 -1
- package/dist/uploads/getExternalFile.js.map +1 -1
- package/dist/uploads/getFileByPath.d.ts +1 -1
- package/dist/uploads/getFileByPath.d.ts.map +1 -1
- package/dist/uploads/getFileByPath.js.map +1 -1
- package/dist/uploads/getImageSize.js.map +1 -1
- package/dist/uploads/getSafeFilename.js.map +1 -1
- package/dist/uploads/imageResizer.js.map +1 -1
- package/dist/uploads/isImage.js.map +1 -1
- package/dist/uploads/mimeTypeValidator.js.map +1 -1
- package/dist/uploads/mimeTypeValidator.spec.js.map +1 -1
- package/dist/uploads/saveBufferToFile.d.ts +0 -1
- package/dist/uploads/saveBufferToFile.d.ts.map +1 -1
- package/dist/uploads/saveBufferToFile.js.map +1 -1
- package/dist/uploads/tempFile.js.map +1 -1
- package/dist/uploads/types.d.ts +74 -7
- package/dist/uploads/types.d.ts.map +1 -1
- package/dist/uploads/types.js.map +1 -1
- package/dist/uploads/unlinkTempFiles.js.map +1 -1
- package/dist/uploads/uploadFiles.d.ts.map +1 -1
- package/dist/uploads/uploadFiles.js.map +1 -1
- package/dist/utilities/checkDuplicateCollections.js.map +1 -1
- package/dist/utilities/combineMerge.js.map +1 -1
- package/dist/utilities/commitTransaction.js.map +1 -1
- package/dist/utilities/configToJSONSchema.js.map +1 -1
- package/dist/utilities/configToJSONSchema.spec.js.map +1 -1
- package/dist/utilities/convertData.js.map +1 -1
- package/dist/utilities/createArrayFromCommaDelineated.js.map +1 -1
- package/dist/utilities/createLocalReq.js.map +1 -1
- package/dist/utilities/deepCopyObject.js.map +1 -1
- package/dist/utilities/deepMerge.js.map +1 -1
- package/dist/utilities/dependencies/getDependencies.d.ts.map +1 -1
- package/dist/utilities/dependencies/getDependencies.js +21 -4
- package/dist/utilities/dependencies/getDependencies.js.map +1 -1
- package/dist/utilities/dependencies/isError.js.map +1 -1
- package/dist/utilities/dependencies/realPath.d.ts +0 -1
- package/dist/utilities/dependencies/realPath.d.ts.map +1 -1
- package/dist/utilities/dependencies/realPath.js.map +1 -1
- package/dist/utilities/dependencies/resolveFrom.js.map +1 -1
- package/dist/utilities/fieldSchemaToJSON.d.ts.map +1 -1
- package/dist/utilities/fieldSchemaToJSON.js.map +1 -1
- package/dist/utilities/flattenTopLevelFields.js.map +1 -1
- package/dist/utilities/formatLabels.js.map +1 -1
- package/dist/utilities/formatLabels.spec.js.map +1 -1
- package/dist/utilities/getCSSVariable.js.map +1 -1
- package/dist/utilities/getCollectionIDFieldTypes.js.map +1 -1
- package/dist/utilities/getEntityPolicies.js.map +1 -1
- package/dist/utilities/getObjectDotNotation.d.ts.map +1 -1
- package/dist/utilities/getObjectDotNotation.js.map +1 -1
- package/dist/utilities/getUniqueListBy.js.map +1 -1
- package/dist/utilities/importWithoutClientFiles.d.ts.map +1 -1
- package/dist/utilities/importWithoutClientFiles.js.map +1 -1
- package/dist/utilities/initTransaction.js.map +1 -1
- package/dist/utilities/isEntityHidden.d.ts +2 -2
- package/dist/utilities/isEntityHidden.js.map +1 -1
- package/dist/utilities/isNumber.js.map +1 -1
- package/dist/utilities/isPlainObject.js.map +1 -1
- package/dist/utilities/isReactComponent.js.map +1 -1
- package/dist/utilities/isValidID.d.ts +1 -1
- package/dist/utilities/isValidID.js.map +1 -1
- package/dist/utilities/isolateObjectProperty.js.map +1 -1
- package/dist/utilities/killTransaction.js.map +1 -1
- package/dist/utilities/logger.d.ts.map +1 -1
- package/dist/utilities/logger.js.map +1 -1
- package/dist/utilities/mapAsync.js.map +1 -1
- package/dist/utilities/mergeListSearchAndWhere.js.map +1 -1
- package/dist/utilities/overwriteMerge.js.map +1 -1
- package/dist/utilities/parseCookies.d.ts +1 -1
- package/dist/utilities/parseCookies.d.ts.map +1 -1
- package/dist/utilities/parseCookies.js.map +1 -1
- package/dist/utilities/sanitizeInternalFields.d.ts.map +1 -1
- package/dist/utilities/sanitizeInternalFields.js.map +1 -1
- package/dist/utilities/setsAreEqual.d.ts.map +1 -1
- package/dist/utilities/setsAreEqual.js.map +1 -1
- 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.map +1 -1
- package/dist/utilities/telemetry/index.d.ts +1 -1
- package/dist/utilities/telemetry/index.d.ts.map +1 -1
- package/dist/utilities/telemetry/index.js.map +1 -1
- package/dist/utilities/telemetry/oneWayHash.d.ts +0 -1
- package/dist/utilities/telemetry/oneWayHash.d.ts.map +1 -1
- package/dist/utilities/telemetry/oneWayHash.js.map +1 -1
- package/dist/utilities/timestamp.js.map +1 -1
- package/dist/utilities/toKebabCase.js.map +1 -1
- package/dist/utilities/wait.js.map +1 -1
- package/dist/utilities/wordBoundariesRegex.js.map +1 -1
- package/dist/versions/baseFields.js.map +1 -1
- package/dist/versions/buildCollectionFields.js.map +1 -1
- package/dist/versions/buildGlobalFields.js.map +1 -1
- package/dist/versions/defaults.js.map +1 -1
- package/dist/versions/deleteCollectionVersions.d.ts.map +1 -1
- package/dist/versions/deleteCollectionVersions.js.map +1 -1
- package/dist/versions/drafts/appendVersionToQueryKey.js.map +1 -1
- package/dist/versions/drafts/getQueryDraftsSort.js.map +1 -1
- package/dist/versions/drafts/replaceWithDraftIfAvailable.d.ts.map +1 -1
- package/dist/versions/drafts/replaceWithDraftIfAvailable.js.map +1 -1
- package/dist/versions/enforceMaxVersions.d.ts.map +1 -1
- package/dist/versions/enforceMaxVersions.js.map +1 -1
- package/dist/versions/getLatestCollectionVersion.d.ts.map +1 -1
- package/dist/versions/getLatestCollectionVersion.js.map +1 -1
- package/dist/versions/getLatestGlobalVersion.d.ts.map +1 -1
- package/dist/versions/getLatestGlobalVersion.js.map +1 -1
- package/dist/versions/saveVersion.d.ts.map +1 -1
- package/dist/versions/saveVersion.js.map +1 -1
- package/dist/versions/types.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/uploads/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/uploads/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,E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C,EAAE,MAAM,CAAA;QACV,CAAC,CAAC,EAAE,MAAM,CAAA;KACX,CAAA;CACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/uploads/types.ts"],"sourcesContent":["import type { ResizeOptions, Sharp } from 'sharp'\n\nimport type { TypeWithID } from '../collections/config/types.js'\nimport type { PayloadRequestWithData } from '../types/index.js'\n\nexport type FileSize = {\n filename: null | string\n filesize: null | number\n height: null | number\n mimeType: null | string\n width: null | number\n}\n\nexport type FileSizes = {\n [size: string]: FileSize\n}\n\nexport type FileData = {\n filename: string\n filesize: number\n focalX?: number\n focalY?: number\n height: number\n mimeType: string\n sizes: FileSizes\n tempFilePath?: string\n url?: string\n width: number\n}\n\nexport type ProbedImageSize = {\n height: number\n width: number\n}\n\n/**\n * Params sent to the sharp toFormat() function\n * @link https://sharp.pixelplumbing.com/api-output#toformat\n */\nexport type ImageUploadFormatOptions = {\n format: Parameters<Sharp['toFormat']>[0]\n options?: Parameters<Sharp['toFormat']>[1]\n}\n\n/**\n * Params sent to the sharp trim() function\n * @link https://sharp.pixelplumbing.com/api-resize#trim\n */\nexport type ImageUploadTrimOptions = Parameters<Sharp['trim']>[0]\n\nexport type ImageSize = Omit<ResizeOptions, 'withoutEnlargement'> & {\n /**\n * @deprecated prefer position\n */\n crop?: string // comes from sharp package\n formatOptions?: ImageUploadFormatOptions\n name: string\n trimOptions?: ImageUploadTrimOptions\n /**\n * When an uploaded image is smaller than the defined image size, we have 3 options:\n *\n * `undefined | false | true`\n *\n * 1. `undefined` [default]: uploading images with smaller width AND height than the image size will return null\n * 2. `false`: always enlarge images to the image size\n * 3. `true`: if the image is smaller than the image size, return the original image\n */\n withoutEnlargement?: ResizeOptions['withoutEnlargement']\n}\n\nexport type GetAdminThumbnail = (args: { doc: Record<string, unknown> }) => false | null | string\n\nexport type UploadConfig = {\n /**\n * The adapter to use for uploads.\n */\n adapter?: string\n /**\n * Represents an admin thumbnail, which can be either a React component or a string.\n * - If a string, it should be one of the image size names.\n * -
|
|
1
|
+
{"version":3,"sources":["../../src/uploads/types.ts"],"sourcesContent":["import type { ResizeOptions, Sharp } from 'sharp'\n\nimport type { TypeWithID } from '../collections/config/types.js'\nimport type { PayloadRequestWithData } from '../types/index.js'\n\nexport type FileSize = {\n filename: null | string\n filesize: null | number\n height: null | number\n mimeType: null | string\n width: null | number\n}\n\nexport type FileSizes = {\n [size: string]: FileSize\n}\n\nexport type FileData = {\n filename: string\n filesize: number\n focalX?: number\n focalY?: number\n height: number\n mimeType: string\n sizes: FileSizes\n tempFilePath?: string\n url?: string\n width: number\n}\n\nexport type ProbedImageSize = {\n height: number\n width: number\n}\n\n/**\n * Params sent to the sharp `toFormat()` function\n * @link https://sharp.pixelplumbing.com/api-output#toformat\n */\nexport type ImageUploadFormatOptions = {\n format: Parameters<Sharp['toFormat']>[0]\n options?: Parameters<Sharp['toFormat']>[1]\n}\n\n/**\n * Params sent to the sharp trim() function\n * @link https://sharp.pixelplumbing.com/api-resize#trim\n */\nexport type ImageUploadTrimOptions = Parameters<Sharp['trim']>[0]\n\nexport type ImageSize = Omit<ResizeOptions, 'withoutEnlargement'> & {\n /**\n * @deprecated prefer position\n */\n crop?: string // comes from sharp package\n formatOptions?: ImageUploadFormatOptions\n name: string\n trimOptions?: ImageUploadTrimOptions\n /**\n * When an uploaded image is smaller than the defined image size, we have 3 options:\n *\n * `undefined | false | true`\n *\n * 1. `undefined` [default]: uploading images with smaller width AND height than the image size will return null\n * 2. `false`: always enlarge images to the image size\n * 3. `true`: if the image is smaller than the image size, return the original image\n */\n withoutEnlargement?: ResizeOptions['withoutEnlargement']\n}\n\nexport type GetAdminThumbnail = (args: { doc: Record<string, unknown> }) => false | null | string\n\nexport type UploadConfig = {\n /**\n * The adapter name to use for uploads. Used for storage adapter telemetry.\n * @default undefined\n */\n adapter?: string\n /**\n * Represents an admin thumbnail, which can be either a React component or a string.\n * - If a string, it should be one of the image size names.\n * - A function that generates a fully qualified URL for the thumbnail, receives the doc as the only argument.\n **/\n adminThumbnail?: GetAdminThumbnail | string\n /**\n * Enables cropping of images.\n * @default true\n */\n crop?: boolean\n /**\n * Disable the ability to save files to disk.\n * @default false\n */\n disableLocalStorage?: boolean\n /**\n * Ability to filter/modify Request Headers when fetching a file.\n *\n * Useful for adding custom headers to fetch from external providers.\n * @default undefined\n */\n externalFileHeaderFilter?: (headers: Record<string, string>) => Record<string, string>\n /**\n * Require files to be uploaded when creating a document.\n * @default true\n */\n filesRequiredOnCreate?: boolean\n /**\n * Enables focal point positioning for image manipulation.\n * @default false\n */\n focalPoint?: boolean\n /**\n * Format options for the uploaded file. Formatting image sizes needs to be done within each formatOptions individually.\n */\n formatOptions?: ImageUploadFormatOptions\n /**\n * Custom handlers to run when a file is fetched.\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 * - If no handlers return a response the file will be returned by default.\n *\n * @default undefined\n */\n handlers?: ((\n req: PayloadRequestWithData,\n args: {\n doc: TypeWithID\n params: { collection: string; filename: string }\n },\n ) => Promise<Response> | Promise<void> | Response | void)[]\n imageSizes?: ImageSize[]\n /**\n * Restrict mimeTypes in the file picker. Array of valid mime types or mimetype wildcards\n * @example ['image/*', 'application/pdf']\n * @default undefined\n */\n mimeTypes?: string[]\n /**\n * Ability to modify the response headers fetching a file.\n * @default undefined\n */\n modifyResponseHeaders?: ({ headers }: { headers: Headers }) => Headers\n /**\n * Sharp resize options for the original image.\n * @link https://sharp.pixelplumbing.com/api-resize#resize\n * @default undefined\n */\n resizeOptions?: ResizeOptions\n /**\n * The directory to serve static files from. Defaults to collection slug.\n * @default undefined\n */\n staticDir?: string\n trimOptions?: ImageUploadTrimOptions\n}\n\nexport type SanitizedUploadConfig = UploadConfig & {\n staticDir: UploadConfig['staticDir']\n}\n\nexport type File = {\n /**\n * The buffer of the file.\n */\n data: Buffer\n /**\n * The mimetype of the file.\n */\n mimetype: string\n /**\n * The name of the file.\n */\n name: string\n /**\n * The size of the file in bytes.\n */\n size: number\n}\n\nexport type FileToSave = {\n /**\n * The buffer of the file.\n */\n buffer: Buffer\n /**\n * The path to save the file.\n */\n path: string\n}\n\nexport type UploadEdits = {\n crop?: {\n height?: number\n width?: number\n x?: number\n y?: number\n }\n focalPoint?: {\n x?: number\n y?: number\n }\n}\n"],"names":[],"mappings":"AA+LA,WAWC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/uploads/unlinkTempFiles.ts"],"sourcesContent":["import fs from 'fs'\nimport { promisify } from 'util'\n\nimport type { SanitizedCollectionConfig } from '../collections/config/types.js'\nimport type { SanitizedConfig } from '../config/types.js'\nimport type { PayloadRequestWithData } from '../types/index.js'\n\nimport { mapAsync } from '../utilities/mapAsync.js'\n\nconst unlinkFile = promisify(fs.unlink)\n\ntype Args = {\n collectionConfig: SanitizedCollectionConfig\n config: SanitizedConfig\n req: PayloadRequestWithData\n}\n/**\n * Cleanup temp files after operation lifecycle\n */\nexport const unlinkTempFiles: (args: Args) => Promise<void> = async ({\n collectionConfig,\n config,\n req,\n}) => {\n if (config.upload?.useTempFiles && collectionConfig.upload) {\n const { file } = req\n const fileArray = [{ file }]\n await mapAsync(fileArray, async ({ file }) => {\n // Still need this check because this will not be populated if using local API\n if (file?.tempFilePath) {\n await unlinkFile(file.tempFilePath)\n }\n })\n }\n}\n"],"names":["fs","promisify","mapAsync","unlinkFile","unlink","unlinkTempFiles","collectionConfig","config","req","upload","useTempFiles","file","fileArray","tempFilePath"],"
|
|
1
|
+
{"version":3,"sources":["../../src/uploads/unlinkTempFiles.ts"],"sourcesContent":["import fs from 'fs'\nimport { promisify } from 'util'\n\nimport type { SanitizedCollectionConfig } from '../collections/config/types.js'\nimport type { SanitizedConfig } from '../config/types.js'\nimport type { PayloadRequestWithData } from '../types/index.js'\n\nimport { mapAsync } from '../utilities/mapAsync.js'\n\nconst unlinkFile = promisify(fs.unlink)\n\ntype Args = {\n collectionConfig: SanitizedCollectionConfig\n config: SanitizedConfig\n req: PayloadRequestWithData\n}\n/**\n * Cleanup temp files after operation lifecycle\n */\nexport const unlinkTempFiles: (args: Args) => Promise<void> = async ({\n collectionConfig,\n config,\n req,\n}) => {\n if (config.upload?.useTempFiles && collectionConfig.upload) {\n const { file } = req\n const fileArray = [{ file }]\n await mapAsync(fileArray, async ({ file }) => {\n // Still need this check because this will not be populated if using local API\n if (file?.tempFilePath) {\n await unlinkFile(file.tempFilePath)\n }\n })\n }\n}\n"],"names":["fs","promisify","mapAsync","unlinkFile","unlink","unlinkTempFiles","collectionConfig","config","req","upload","useTempFiles","file","fileArray","tempFilePath"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,SAASC,SAAS,QAAQ,OAAM;AAMhC,SAASC,QAAQ,QAAQ,2BAA0B;AAEnD,MAAMC,aAAaF,UAAUD,GAAGI,MAAM;AAOtC;;CAEC,GACD,OAAO,MAAMC,kBAAiD,OAAO,EACnEC,gBAAgB,EAChBC,MAAM,EACNC,GAAG,EACJ;IACC,IAAID,OAAOE,MAAM,EAAEC,gBAAgBJ,iBAAiBG,MAAM,EAAE;QAC1D,MAAM,EAAEE,IAAI,EAAE,GAAGH;QACjB,MAAMI,YAAY;YAAC;gBAAED;YAAK;SAAE;QAC5B,MAAMT,SAASU,WAAW,OAAO,EAAED,IAAI,EAAE;YACvC,8EAA8E;YAC9E,IAAIA,MAAME,cAAc;gBACtB,MAAMV,WAAWQ,KAAKE,YAAY;YACpC;QACF;IACF;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadFiles.d.ts","sourceRoot":"","sources":["../../src/uploads/uploadFiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAK5C,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"uploadFiles.d.ts","sourceRoot":"","sources":["../../src/uploads/uploadFiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAK5C,eAAO,MAAM,WAAW,YACb,OAAO,SACT,UAAU,EAAE,OACd,sBAAsB,KAC1B,OAAO,CAAC,IAAI,CAWd,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/uploads/uploadFiles.ts"],"sourcesContent":["import type { Payload } from '../index.js'\nimport type { PayloadRequestWithData } from '../types/index.js'\nimport type { FileToSave } from './types.js'\n\nimport { FileUploadError } from '../errors/index.js'\nimport saveBufferToFile from './saveBufferToFile.js'\n\nexport const uploadFiles = async (\n payload: Payload,\n files: FileToSave[],\n req: PayloadRequestWithData,\n): Promise<void> => {\n try {\n await Promise.all(\n files.map(async ({ buffer, path }) => {\n await saveBufferToFile(buffer, path)\n }),\n )\n } catch (err) {\n payload.logger.error(err)\n throw new FileUploadError(req.t)\n }\n}\n"],"names":["FileUploadError","saveBufferToFile","uploadFiles","payload","files","req","Promise","all","map","buffer","path","err","logger","error","t"],"
|
|
1
|
+
{"version":3,"sources":["../../src/uploads/uploadFiles.ts"],"sourcesContent":["import type { Payload } from '../index.js'\nimport type { PayloadRequestWithData } from '../types/index.js'\nimport type { FileToSave } from './types.js'\n\nimport { FileUploadError } from '../errors/index.js'\nimport saveBufferToFile from './saveBufferToFile.js'\n\nexport const uploadFiles = async (\n payload: Payload,\n files: FileToSave[],\n req: PayloadRequestWithData,\n): Promise<void> => {\n try {\n await Promise.all(\n files.map(async ({ buffer, path }) => {\n await saveBufferToFile(buffer, path)\n }),\n )\n } catch (err) {\n payload.logger.error(err)\n throw new FileUploadError(req.t)\n }\n}\n"],"names":["FileUploadError","saveBufferToFile","uploadFiles","payload","files","req","Promise","all","map","buffer","path","err","logger","error","t"],"mappings":"AAIA,SAASA,eAAe,QAAQ,qBAAoB;AACpD,OAAOC,sBAAsB,wBAAuB;AAEpD,OAAO,MAAMC,cAAc,OACzBC,SACAC,OACAC;IAEA,IAAI;QACF,MAAMC,QAAQC,GAAG,CACfH,MAAMI,GAAG,CAAC,OAAO,EAAEC,MAAM,EAAEC,IAAI,EAAE;YAC/B,MAAMT,iBAAiBQ,QAAQC;QACjC;IAEJ,EAAE,OAAOC,KAAK;QACZR,QAAQS,MAAM,CAACC,KAAK,CAACF;QACrB,MAAM,IAAIX,gBAAgBK,IAAIS,CAAC;IACjC;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/checkDuplicateCollections.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from '../collections/config/types.js'\n\nimport { DuplicateCollection } from '../errors/DuplicateCollection.js'\n\nconst getDuplicates = (arr: string[]) => arr.filter((item, index) => arr.indexOf(item) !== index)\n\nconst checkDuplicateCollections = (collections: SanitizedCollectionConfig[]): void => {\n const duplicateSlugs = getDuplicates(collections.map((c) => c.slug))\n if (duplicateSlugs.length > 0) {\n throw new DuplicateCollection('slug', duplicateSlugs)\n }\n}\n\nexport default checkDuplicateCollections\n"],"names":["DuplicateCollection","getDuplicates","arr","filter","item","index","indexOf","checkDuplicateCollections","collections","duplicateSlugs","map","c","slug","length"],"
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/checkDuplicateCollections.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from '../collections/config/types.js'\n\nimport { DuplicateCollection } from '../errors/DuplicateCollection.js'\n\nconst getDuplicates = (arr: string[]) => arr.filter((item, index) => arr.indexOf(item) !== index)\n\nconst checkDuplicateCollections = (collections: SanitizedCollectionConfig[]): void => {\n const duplicateSlugs = getDuplicates(collections.map((c) => c.slug))\n if (duplicateSlugs.length > 0) {\n throw new DuplicateCollection('slug', duplicateSlugs)\n }\n}\n\nexport default checkDuplicateCollections\n"],"names":["DuplicateCollection","getDuplicates","arr","filter","item","index","indexOf","checkDuplicateCollections","collections","duplicateSlugs","map","c","slug","length"],"mappings":"AAEA,SAASA,mBAAmB,QAAQ,mCAAkC;AAEtE,MAAMC,gBAAgB,CAACC,MAAkBA,IAAIC,MAAM,CAAC,CAACC,MAAMC,QAAUH,IAAII,OAAO,CAACF,UAAUC;AAE3F,MAAME,4BAA4B,CAACC;IACjC,MAAMC,iBAAiBR,cAAcO,YAAYE,GAAG,CAAC,CAACC,IAAMA,EAAEC,IAAI;IAClE,IAAIH,eAAeI,MAAM,GAAG,GAAG;QAC7B,MAAM,IAAIb,oBAAoB,QAAQS;IACxC;AACF;AAEA,eAAeF,0BAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/combineMerge.ts"],"sourcesContent":["import merge from 'deepmerge'\n\nexport const combineMerge = (target, source, options) => {\n const destination = target.slice()\n\n source.forEach((item, index) => {\n if (typeof destination[index] === 'undefined') {\n destination[index] = options.cloneUnlessOtherwiseSpecified(item, options)\n } else if (options.isMergeableObject(item)) {\n destination[index] = merge(target[index], item, options)\n } else if (target.indexOf(item) === -1) {\n destination.push(item)\n }\n })\n return destination\n}\n"],"names":["merge","combineMerge","target","source","options","destination","slice","forEach","item","index","cloneUnlessOtherwiseSpecified","isMergeableObject","indexOf","push"],"
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/combineMerge.ts"],"sourcesContent":["import merge from 'deepmerge'\n\nexport const combineMerge = (target, source, options) => {\n const destination = target.slice()\n\n source.forEach((item, index) => {\n if (typeof destination[index] === 'undefined') {\n destination[index] = options.cloneUnlessOtherwiseSpecified(item, options)\n } else if (options.isMergeableObject(item)) {\n destination[index] = merge(target[index], item, options)\n } else if (target.indexOf(item) === -1) {\n destination.push(item)\n }\n })\n return destination\n}\n"],"names":["merge","combineMerge","target","source","options","destination","slice","forEach","item","index","cloneUnlessOtherwiseSpecified","isMergeableObject","indexOf","push"],"mappings":"AAAA,OAAOA,WAAW,YAAW;AAE7B,OAAO,MAAMC,eAAe,CAACC,QAAQC,QAAQC;IAC3C,MAAMC,cAAcH,OAAOI,KAAK;IAEhCH,OAAOI,OAAO,CAAC,CAACC,MAAMC;QACpB,IAAI,OAAOJ,WAAW,CAACI,MAAM,KAAK,aAAa;YAC7CJ,WAAW,CAACI,MAAM,GAAGL,QAAQM,6BAA6B,CAACF,MAAMJ;QACnE,OAAO,IAAIA,QAAQO,iBAAiB,CAACH,OAAO;YAC1CH,WAAW,CAACI,MAAM,GAAGT,MAAME,MAAM,CAACO,MAAM,EAAED,MAAMJ;QAClD,OAAO,IAAIF,OAAOU,OAAO,CAACJ,UAAU,CAAC,GAAG;YACtCH,YAAYQ,IAAI,CAACL;QACnB;IACF;IACA,OAAOH;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/commitTransaction.ts"],"sourcesContent":["import type { PayloadRequestWithData } from '../types/index.js'\n\n/**\n * complete a transaction calling adapter db.commitTransaction and delete the transactionID from req\n */\nexport async function commitTransaction(req: PayloadRequestWithData): Promise<void> {\n const { payload, transactionID } = req\n\n await payload.db.commitTransaction(transactionID)\n delete req.transactionID\n}\n"],"names":["commitTransaction","req","payload","transactionID","db"],"
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/commitTransaction.ts"],"sourcesContent":["import type { PayloadRequestWithData } from '../types/index.js'\n\n/**\n * complete a transaction calling adapter db.commitTransaction and delete the transactionID from req\n */\nexport async function commitTransaction(req: PayloadRequestWithData): Promise<void> {\n const { payload, transactionID } = req\n\n await payload.db.commitTransaction(transactionID)\n delete req.transactionID\n}\n"],"names":["commitTransaction","req","payload","transactionID","db"],"mappings":"AAEA;;CAEC,GACD,OAAO,eAAeA,kBAAkBC,GAA2B;IACjE,MAAM,EAAEC,OAAO,EAAEC,aAAa,EAAE,GAAGF;IAEnC,MAAMC,QAAQE,EAAE,CAACJ,iBAAiB,CAACG;IACnC,OAAOF,IAAIE,aAAa;AAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/configToJSONSchema.ts"],"sourcesContent":["import type { JSONSchema4, JSONSchema4TypeName } from 'json-schema'\n\nimport pluralize from 'pluralize'\nconst { singular } = pluralize\n\nimport type { SanitizedCollectionConfig } from '../collections/config/types.js'\nimport type { SanitizedConfig } from '../config/types.js'\nimport type { Field, FieldAffectingData, Option } from '../fields/config/types.js'\nimport type { SanitizedGlobalConfig } from '../globals/config/types.js'\n\nimport { MissingEditorProp } from '../errors/MissingEditorProp.js'\nimport { fieldAffectsData, tabHasName } from '../fields/config/types.js'\nimport { deepCopyObject } from './deepCopyObject.js'\nimport { toWords } from './formatLabels.js'\nimport { getCollectionIDFieldTypes } from './getCollectionIDFieldTypes.js'\n\nconst fieldIsRequired = (field: Field) => {\n const isConditional = Boolean(field?.admin && field?.admin?.condition)\n if (isConditional) return false\n\n const isMarkedRequired = 'required' in field && field.required === true\n if (fieldAffectsData(field) && isMarkedRequired) return true\n\n // if any subfields are required, this field is required\n if ('fields' in field && field.type !== 'array') {\n return field.fields.some((subField) => fieldIsRequired(subField))\n }\n\n // if any tab subfields have required fields, this field is required\n if (field.type === 'tabs') {\n return field.tabs.some((tab) => {\n if ('name' in tab) {\n return tab.fields.some((subField) => fieldIsRequired(subField))\n }\n return false\n })\n }\n\n return false\n}\n\nfunction buildOptionEnums(options: Option[]): string[] {\n return options.map((option) => {\n if (typeof option === 'object' && 'value' in option) {\n return option.value\n }\n\n return option\n })\n}\n\nfunction generateEntitySchemas(\n entities: (SanitizedCollectionConfig | SanitizedGlobalConfig)[],\n): JSONSchema4 {\n const properties = [...entities].reduce((acc, { slug }) => {\n acc[slug] = {\n $ref: `#/definitions/${slug}`,\n }\n\n return acc\n }, {})\n\n return {\n type: 'object',\n additionalProperties: false,\n properties,\n required: Object.keys(properties),\n }\n}\n\nfunction generateLocaleEntitySchemas(localization: SanitizedConfig['localization']): JSONSchema4 {\n if (localization && 'locales' in localization && localization?.locales) {\n const localesFromConfig = localization?.locales\n\n const locales = [...localesFromConfig].map((locale) => {\n return locale.code\n }, [])\n\n return {\n type: 'string',\n enum: locales,\n }\n }\n\n return {\n type: 'null',\n }\n}\n\nfunction generateAuthEntitySchemas(entities: SanitizedCollectionConfig[]): JSONSchema4 {\n const properties: JSONSchema4[] = [...entities]\n .filter(({ auth }) => Boolean(auth))\n .map(({ slug }) => {\n return {\n allOf: [\n { $ref: `#/definitions/${slug}` },\n {\n type: 'object',\n additionalProperties: false,\n properties: {\n collection: { type: 'string', enum: [slug] },\n },\n required: ['collection'],\n },\n ],\n }\n }, {})\n\n return {\n oneOf: properties,\n }\n}\n\n/**\n * Returns a JSON Schema Type with 'null' added if the field is not required.\n */\nexport function withNullableJSONSchemaType(\n fieldType: JSONSchema4TypeName,\n isRequired: boolean,\n): JSONSchema4TypeName | JSONSchema4TypeName[] {\n const fieldTypes = [fieldType]\n if (isRequired) return fieldType\n fieldTypes.push('null')\n return fieldTypes\n}\n\nexport function fieldsToJSONSchema(\n /**\n * Used for relationship fields, to determine whether to use a string or number type for the ID.\n * While there is a default ID field type set by the db adapter, they can differ on a collection-level\n * if they have custom ID fields.\n */\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' },\n fields: Field[],\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>,\n config?: SanitizedConfig,\n): {\n properties: {\n [k: string]: JSONSchema4\n }\n required: string[]\n} {\n const requiredFieldNames = new Set<string>()\n\n return {\n properties: Object.fromEntries(\n fields.reduce((fieldSchemas, field) => {\n const isRequired = fieldAffectsData(field) && fieldIsRequired(field)\n if (isRequired) requiredFieldNames.add(field.name)\n\n let fieldSchema: JSONSchema4\n switch (field.type) {\n case 'text':\n if (field.hasMany === true) {\n fieldSchema = {\n type: withNullableJSONSchemaType('array', isRequired),\n items: { type: 'string' },\n }\n } else {\n fieldSchema = { type: withNullableJSONSchemaType('string', isRequired) }\n }\n break\n case 'textarea':\n case 'code':\n case 'email':\n case 'date': {\n fieldSchema = { type: withNullableJSONSchemaType('string', isRequired) }\n break\n }\n\n case 'number': {\n if (field.hasMany === true) {\n fieldSchema = {\n type: withNullableJSONSchemaType('array', isRequired),\n items: { type: 'number' },\n }\n } else {\n fieldSchema = { type: withNullableJSONSchemaType('number', isRequired) }\n }\n break\n }\n\n case 'checkbox': {\n fieldSchema = { type: withNullableJSONSchemaType('boolean', isRequired) }\n break\n }\n\n case 'json': {\n fieldSchema = {\n type: ['object', 'array', 'string', 'number', 'boolean', 'null'],\n }\n break\n }\n\n case 'richText': {\n if (!field?.editor) {\n throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n if (typeof field.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n if (field.editor.outputSchema) {\n fieldSchema = field.editor.outputSchema({\n collectionIDFieldTypes,\n config,\n field,\n interfaceNameDefinitions,\n isRequired,\n })\n } else {\n // Maintain backwards compatibility with existing rich text editors\n fieldSchema = {\n type: withNullableJSONSchemaType('array', isRequired),\n items: {\n type: 'object',\n },\n }\n }\n\n break\n }\n\n case 'radio': {\n fieldSchema = {\n type: withNullableJSONSchemaType('string', isRequired),\n enum: buildOptionEnums(field.options),\n }\n\n break\n }\n\n case 'select': {\n const optionEnums = buildOptionEnums(field.options)\n\n if (field.hasMany) {\n fieldSchema = {\n type: withNullableJSONSchemaType('array', isRequired),\n items: {\n type: 'string',\n enum: optionEnums,\n },\n }\n } else {\n fieldSchema = {\n type: withNullableJSONSchemaType('string', isRequired),\n enum: optionEnums,\n }\n }\n\n break\n }\n\n case 'point': {\n fieldSchema = {\n type: withNullableJSONSchemaType('array', isRequired),\n items: [\n {\n type: 'number',\n },\n {\n type: 'number',\n },\n ],\n maxItems: 2,\n minItems: 2,\n }\n break\n }\n\n case 'relationship': {\n if (Array.isArray(field.relationTo)) {\n if (field.hasMany) {\n fieldSchema = {\n type: withNullableJSONSchemaType('array', isRequired),\n items: {\n oneOf: field.relationTo.map((relation) => {\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n relationTo: {\n const: relation,\n },\n value: {\n oneOf: [\n {\n type: collectionIDFieldTypes[relation],\n },\n {\n $ref: `#/definitions/${relation}`,\n },\n ],\n },\n },\n required: ['value', 'relationTo'],\n }\n }),\n },\n }\n } else {\n fieldSchema = {\n oneOf: field.relationTo.map((relation) => {\n return {\n type: withNullableJSONSchemaType('object', isRequired),\n additionalProperties: false,\n properties: {\n relationTo: {\n const: relation,\n },\n value: {\n oneOf: [\n {\n type: collectionIDFieldTypes[relation],\n },\n {\n $ref: `#/definitions/${relation}`,\n },\n ],\n },\n },\n required: ['value', 'relationTo'],\n }\n }),\n }\n }\n } else if (field.hasMany) {\n fieldSchema = {\n type: withNullableJSONSchemaType('array', isRequired),\n items: {\n oneOf: [\n {\n type: collectionIDFieldTypes[field.relationTo],\n },\n {\n $ref: `#/definitions/${field.relationTo}`,\n },\n ],\n },\n }\n } else {\n fieldSchema = {\n oneOf: [\n {\n type: withNullableJSONSchemaType(\n collectionIDFieldTypes[field.relationTo],\n isRequired,\n ),\n },\n {\n $ref: `#/definitions/${field.relationTo}`,\n },\n ],\n }\n }\n\n break\n }\n\n case 'upload': {\n fieldSchema = {\n oneOf: [\n {\n type: collectionIDFieldTypes[field.relationTo],\n },\n {\n $ref: `#/definitions/${field.relationTo}`,\n },\n ],\n }\n if (!isRequired) fieldSchema.oneOf.push({ type: 'null' })\n break\n }\n\n case 'blocks': {\n fieldSchema = {\n type: withNullableJSONSchemaType('array', isRequired),\n items: {\n oneOf: field.blocks.map((block) => {\n const blockFieldSchemas = fieldsToJSONSchema(\n collectionIDFieldTypes,\n block.fields,\n interfaceNameDefinitions,\n config,\n )\n\n const blockSchema: JSONSchema4 = {\n type: 'object',\n additionalProperties: false,\n properties: {\n ...blockFieldSchemas.properties,\n blockType: {\n const: block.slug,\n },\n },\n required: ['blockType', ...blockFieldSchemas.required],\n }\n\n if (block.interfaceName) {\n interfaceNameDefinitions.set(block.interfaceName, blockSchema)\n\n return {\n $ref: `#/definitions/${block.interfaceName}`,\n }\n }\n\n return blockSchema\n }),\n },\n }\n break\n }\n\n case 'array': {\n fieldSchema = {\n type: withNullableJSONSchemaType('array', isRequired),\n items: {\n type: 'object',\n additionalProperties: false,\n ...fieldsToJSONSchema(\n collectionIDFieldTypes,\n field.fields,\n interfaceNameDefinitions,\n config,\n ),\n },\n }\n\n if (field.interfaceName) {\n interfaceNameDefinitions.set(field.interfaceName, fieldSchema)\n\n fieldSchema = {\n $ref: `#/definitions/${field.interfaceName}`,\n }\n }\n break\n }\n\n case 'row':\n case 'collapsible': {\n const childSchema = fieldsToJSONSchema(\n collectionIDFieldTypes,\n field.fields,\n interfaceNameDefinitions,\n config,\n )\n Object.entries(childSchema.properties).forEach(([propName, propSchema]) => {\n fieldSchemas.set(propName, propSchema)\n })\n childSchema.required.forEach((propName) => {\n requiredFieldNames.add(propName)\n })\n break\n }\n\n case 'tabs': {\n field.tabs.forEach((tab) => {\n const childSchema = fieldsToJSONSchema(\n collectionIDFieldTypes,\n tab.fields,\n interfaceNameDefinitions,\n config,\n )\n if (tabHasName(tab)) {\n // could have interface\n fieldSchemas.set(tab.name, {\n type: 'object',\n additionalProperties: false,\n ...childSchema,\n })\n\n // If the named tab has any required fields then we mark this as required otherwise it should be optional\n const hasRequiredFields = tab.fields.some((subField) => fieldIsRequired(subField))\n\n if (hasRequiredFields) {\n requiredFieldNames.add(tab.name)\n }\n } else {\n Object.entries(childSchema.properties).forEach(([propName, propSchema]) => {\n fieldSchemas.set(propName, propSchema)\n })\n childSchema.required.forEach((propName) => {\n requiredFieldNames.add(propName)\n })\n }\n })\n break\n }\n\n case 'group': {\n fieldSchema = {\n type: 'object',\n additionalProperties: false,\n ...fieldsToJSONSchema(\n collectionIDFieldTypes,\n field.fields,\n interfaceNameDefinitions,\n config,\n ),\n }\n\n if (field.interfaceName) {\n interfaceNameDefinitions.set(field.interfaceName, fieldSchema)\n\n fieldSchema = {\n $ref: `#/definitions/${field.interfaceName}`,\n }\n }\n break\n }\n\n default: {\n break\n }\n }\n\n if (fieldSchema && fieldAffectsData(field)) {\n fieldSchemas.set(field.name, fieldSchema)\n }\n\n return fieldSchemas\n }, new Map<string, JSONSchema4>()),\n ),\n required: Array.from(requiredFieldNames),\n }\n}\n\n// This function is part of the public API and is exported through payload/utilities\nexport function entityToJSONSchema(\n config: SanitizedConfig,\n incomingEntity: SanitizedCollectionConfig | SanitizedGlobalConfig,\n interfaceNameDefinitions: Map<string, JSONSchema4>,\n defaultIDType: 'number' | 'text',\n): JSONSchema4 {\n const entity: SanitizedCollectionConfig | SanitizedGlobalConfig = deepCopyObject(incomingEntity)\n const title = entity.typescript?.interface\n ? entity.typescript.interface\n : singular(toWords(entity.slug, true))\n\n const idField: FieldAffectingData = { name: 'id', type: defaultIDType as 'text', required: true }\n const customIdField = entity.fields.find(\n (field) => fieldAffectsData(field) && field.name === 'id',\n ) as FieldAffectingData\n\n if (customIdField && customIdField.type !== 'group' && customIdField.type !== 'tab') {\n customIdField.required = true\n } else {\n entity.fields.unshift(idField)\n }\n\n // mark timestamp fields required\n if ('timestamps' in entity && entity.timestamps !== false) {\n entity.fields = entity.fields.map((field) => {\n if (fieldAffectsData(field) && (field.name === 'createdAt' || field.name === 'updatedAt')) {\n return {\n ...field,\n required: true,\n }\n }\n return field\n })\n }\n\n if ('auth' in entity && entity.auth && !entity.auth?.disableLocalStrategy) {\n entity.fields.push({\n name: 'password',\n type: 'text',\n })\n }\n\n // Used for relationship fields, to determine whether to use a string or number type for the ID.\n const collectionIDFieldTypes = getCollectionIDFieldTypes({ config, defaultIDType })\n\n return {\n type: 'object',\n additionalProperties: false,\n title,\n ...fieldsToJSONSchema(collectionIDFieldTypes, entity.fields, interfaceNameDefinitions, config),\n }\n}\n\n/**\n * This is used for generating the TypeScript types (payload-types.ts) with the payload generate:types command.\n */\nexport function configToJSONSchema(\n config: SanitizedConfig,\n defaultIDType?: 'number' | 'text',\n): JSONSchema4 {\n // a mutable Map to store custom top-level `interfaceName` types. Fields with an `interfaceName` property will be moved to the top-level definitions here\n const interfaceNameDefinitions: Map<string, JSONSchema4> = new Map()\n\n // Collections and Globals have to be moved to the top-level definitions as well. Reason: The top-level type will be the `Config` type - we don't want all collection and global\n // types to be inlined inside the `Config` type\n const entityDefinitions: { [k: string]: JSONSchema4 } = [\n ...config.globals,\n ...config.collections,\n ].reduce((acc, entity) => {\n acc[entity.slug] = entityToJSONSchema(config, entity, interfaceNameDefinitions, defaultIDType)\n return acc\n }, {})\n\n return {\n additionalProperties: false,\n definitions: { ...entityDefinitions, ...Object.fromEntries(interfaceNameDefinitions) },\n // These properties here will be very simple, as all the complexity is in the definitions. These are just the properties for the top-level `Config` type\n type: 'object',\n properties: {\n collections: generateEntitySchemas(config.collections || []),\n globals: generateEntitySchemas(config.globals || []),\n locale: generateLocaleEntitySchemas(config.localization),\n user: generateAuthEntitySchemas(config.collections),\n },\n required: ['user', 'locale', 'collections', 'globals'],\n title: 'Config',\n }\n}\n"],"names":["pluralize","singular","MissingEditorProp","fieldAffectsData","tabHasName","deepCopyObject","toWords","getCollectionIDFieldTypes","fieldIsRequired","field","isConditional","Boolean","admin","condition","isMarkedRequired","required","type","fields","some","subField","tabs","tab","buildOptionEnums","options","map","option","value","generateEntitySchemas","entities","properties","reduce","acc","slug","$ref","additionalProperties","Object","keys","generateLocaleEntitySchemas","localization","locales","localesFromConfig","locale","code","enum","generateAuthEntitySchemas","filter","auth","allOf","collection","oneOf","withNullableJSONSchemaType","fieldType","isRequired","fieldTypes","push","fieldsToJSONSchema","collectionIDFieldTypes","interfaceNameDefinitions","config","requiredFieldNames","Set","fromEntries","fieldSchemas","add","name","fieldSchema","hasMany","items","editor","Error","outputSchema","optionEnums","maxItems","minItems","Array","isArray","relationTo","relation","const","blocks","block","blockFieldSchemas","blockSchema","blockType","interfaceName","set","childSchema","entries","forEach","propName","propSchema","hasRequiredFields","Map","from","entityToJSONSchema","incomingEntity","defaultIDType","entity","title","typescript","interface","idField","customIdField","find","unshift","timestamps","disableLocalStrategy","configToJSONSchema","entityDefinitions","globals","collections","definitions","user"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAOA,eAAe,YAAW;AACjC,MAAM,EAAEC,QAAQ,EAAE,GAAGD;AAOrB,SAASE,iBAAiB,QAAQ,iCAAgC;AAClE,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,4BAA2B;AACxE,SAASC,cAAc,QAAQ,sBAAqB;AACpD,SAASC,OAAO,QAAQ,oBAAmB;AAC3C,SAASC,yBAAyB,QAAQ,iCAAgC;AAE1E,MAAMC,kBAAkB,CAACC;IACvB,MAAMC,gBAAgBC,QAAQF,OAAOG,SAASH,OAAOG,OA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AG3C,mBAAmBC,wBAAwByC,OAAOhF,MAAM,EAAEwC,0BAA0BC,OAAO;IAChG;AACF;AAEA;;CAEC,GACD,OAAO,SAASiD,mBACdjD,MAAuB,EACvBsC,aAAiC;IAEjC,yJAAyJ;IACzJ,MAAMvC,2BAAqD,IAAImC;IAE/D,gLAAgL;IAChL,+CAA+C;IAC/C,MAAMgB,oBAAkD;WACnDlD,OAAOmD,OAAO;WACdnD,OAAOoD,WAAW;KACtB,CAAChF,MAAM,CAAC,CAACC,KAAKkE;QACblE,GAAG,CAACkE,OAAOjE,IAAI,CAAC,GAAG8D,mBAAmBpC,QAAQuC,QAAQxC,0BAA0BuC;QAChF,OAAOjE;IACT,GAAG,CAAC;IAEJ,OAAO;QACLG,sBAAsB;QACtB6E,aAAa;YAAE,GAAGH,iBAAiB;YAAE,GAAGzE,OAAO0B,WAAW,CAACJ,yBAAyB;QAAC;QACrF,wJAAwJ;QACxJzC,MAAM;QACNa,YAAY;YACViF,aAAanF,sBAAsB+B,OAAOoD,WAAW,IAAI,EAAE;YAC3DD,SAASlF,sBAAsB+B,OAAOmD,OAAO,IAAI,EAAE;YACnDpE,QAAQJ,4BAA4BqB,OAAOpB,YAAY;YACvD0E,MAAMpE,0BAA0Bc,OAAOoD,WAAW;QACpD;QACA/F,UAAU;YAAC;YAAQ;YAAU;YAAe;SAAU;QACtDmF,OAAO;IACT;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/configToJSONSchema.ts"],"sourcesContent":["import type { JSONSchema4, JSONSchema4TypeName } from 'json-schema'\n\nimport pluralize from 'pluralize'\nconst { singular } = pluralize\n\nimport type { SanitizedCollectionConfig } from '../collections/config/types.js'\nimport type { SanitizedConfig } from '../config/types.js'\nimport type { Field, FieldAffectingData, Option } from '../fields/config/types.js'\nimport type { SanitizedGlobalConfig } from '../globals/config/types.js'\n\nimport { MissingEditorProp } from '../errors/MissingEditorProp.js'\nimport { fieldAffectsData, tabHasName } from '../fields/config/types.js'\nimport { deepCopyObject } from './deepCopyObject.js'\nimport { toWords } from './formatLabels.js'\nimport { getCollectionIDFieldTypes } from './getCollectionIDFieldTypes.js'\n\nconst fieldIsRequired = (field: Field) => {\n const isConditional = Boolean(field?.admin && field?.admin?.condition)\n if (isConditional) return false\n\n const isMarkedRequired = 'required' in field && field.required === true\n if (fieldAffectsData(field) && isMarkedRequired) return true\n\n // if any subfields are required, this field is required\n if ('fields' in field && field.type !== 'array') {\n return field.fields.some((subField) => fieldIsRequired(subField))\n }\n\n // if any tab subfields have required fields, this field is required\n if (field.type === 'tabs') {\n return field.tabs.some((tab) => {\n if ('name' in tab) {\n return tab.fields.some((subField) => fieldIsRequired(subField))\n }\n return false\n })\n }\n\n return false\n}\n\nfunction buildOptionEnums(options: Option[]): string[] {\n return options.map((option) => {\n if (typeof option === 'object' && 'value' in option) {\n return option.value\n }\n\n return option\n })\n}\n\nfunction generateEntitySchemas(\n entities: (SanitizedCollectionConfig | SanitizedGlobalConfig)[],\n): JSONSchema4 {\n const properties = [...entities].reduce((acc, { slug }) => {\n acc[slug] = {\n $ref: `#/definitions/${slug}`,\n }\n\n return acc\n }, {})\n\n return {\n type: 'object',\n additionalProperties: false,\n properties,\n required: Object.keys(properties),\n }\n}\n\nfunction generateLocaleEntitySchemas(localization: SanitizedConfig['localization']): JSONSchema4 {\n if (localization && 'locales' in localization && localization?.locales) {\n const localesFromConfig = localization?.locales\n\n const locales = [...localesFromConfig].map((locale) => {\n return locale.code\n }, [])\n\n return {\n type: 'string',\n enum: locales,\n }\n }\n\n return {\n type: 'null',\n }\n}\n\nfunction generateAuthEntitySchemas(entities: SanitizedCollectionConfig[]): JSONSchema4 {\n const properties: JSONSchema4[] = [...entities]\n .filter(({ auth }) => Boolean(auth))\n .map(({ slug }) => {\n return {\n allOf: [\n { $ref: `#/definitions/${slug}` },\n {\n type: 'object',\n additionalProperties: false,\n properties: {\n collection: { type: 'string', enum: [slug] },\n },\n required: ['collection'],\n },\n ],\n }\n }, {})\n\n return {\n oneOf: properties,\n }\n}\n\n/**\n * Returns a JSON Schema Type with 'null' added if the field is not required.\n */\nexport function withNullableJSONSchemaType(\n fieldType: JSONSchema4TypeName,\n isRequired: boolean,\n): JSONSchema4TypeName | JSONSchema4TypeName[] {\n const fieldTypes = [fieldType]\n if (isRequired) return fieldType\n fieldTypes.push('null')\n return fieldTypes\n}\n\nexport function fieldsToJSONSchema(\n /**\n * Used for relationship fields, to determine whether to use a string or number type for the ID.\n * While there is a default ID field type set by the db adapter, they can differ on a collection-level\n * if they have custom ID fields.\n */\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' },\n fields: Field[],\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>,\n config?: SanitizedConfig,\n): {\n properties: {\n [k: string]: JSONSchema4\n }\n required: string[]\n} {\n const requiredFieldNames = new Set<string>()\n\n return {\n properties: Object.fromEntries(\n fields.reduce((fieldSchemas, field) => {\n const isRequired = fieldAffectsData(field) && fieldIsRequired(field)\n if (isRequired) requiredFieldNames.add(field.name)\n\n let fieldSchema: JSONSchema4\n switch (field.type) {\n case 'text':\n if (field.hasMany === true) {\n fieldSchema = {\n type: withNullableJSONSchemaType('array', isRequired),\n items: { type: 'string' },\n }\n } else {\n fieldSchema = { type: withNullableJSONSchemaType('string', isRequired) }\n }\n break\n case 'textarea':\n case 'code':\n case 'email':\n case 'date': {\n fieldSchema = { type: withNullableJSONSchemaType('string', isRequired) }\n break\n }\n\n case 'number': {\n if (field.hasMany === true) {\n fieldSchema = {\n type: withNullableJSONSchemaType('array', isRequired),\n items: { type: 'number' },\n }\n } else {\n fieldSchema = { type: withNullableJSONSchemaType('number', isRequired) }\n }\n break\n }\n\n case 'checkbox': {\n fieldSchema = { type: withNullableJSONSchemaType('boolean', isRequired) }\n break\n }\n\n case 'json': {\n fieldSchema = {\n type: ['object', 'array', 'string', 'number', 'boolean', 'null'],\n }\n break\n }\n\n case 'richText': {\n if (!field?.editor) {\n throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n if (typeof field.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n if (field.editor.outputSchema) {\n fieldSchema = field.editor.outputSchema({\n collectionIDFieldTypes,\n config,\n field,\n interfaceNameDefinitions,\n isRequired,\n })\n } else {\n // Maintain backwards compatibility with existing rich text editors\n fieldSchema = {\n type: withNullableJSONSchemaType('array', isRequired),\n items: {\n type: 'object',\n },\n }\n }\n\n break\n }\n\n case 'radio': {\n fieldSchema = {\n type: withNullableJSONSchemaType('string', isRequired),\n enum: buildOptionEnums(field.options),\n }\n\n break\n }\n\n case 'select': {\n const optionEnums = buildOptionEnums(field.options)\n\n if (field.hasMany) {\n fieldSchema = {\n type: withNullableJSONSchemaType('array', isRequired),\n items: {\n type: 'string',\n enum: optionEnums,\n },\n }\n } else {\n fieldSchema = {\n type: withNullableJSONSchemaType('string', isRequired),\n enum: optionEnums,\n }\n }\n\n break\n }\n\n case 'point': {\n fieldSchema = {\n type: withNullableJSONSchemaType('array', isRequired),\n items: [\n {\n type: 'number',\n },\n {\n type: 'number',\n },\n ],\n maxItems: 2,\n minItems: 2,\n }\n break\n }\n\n case 'relationship': {\n if (Array.isArray(field.relationTo)) {\n if (field.hasMany) {\n fieldSchema = {\n type: withNullableJSONSchemaType('array', isRequired),\n items: {\n oneOf: field.relationTo.map((relation) => {\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n relationTo: {\n const: relation,\n },\n value: {\n oneOf: [\n {\n type: collectionIDFieldTypes[relation],\n },\n {\n $ref: `#/definitions/${relation}`,\n },\n ],\n },\n },\n required: ['value', 'relationTo'],\n }\n }),\n },\n }\n } else {\n fieldSchema = {\n oneOf: field.relationTo.map((relation) => {\n return {\n type: withNullableJSONSchemaType('object', isRequired),\n additionalProperties: false,\n properties: {\n relationTo: {\n const: relation,\n },\n value: {\n oneOf: [\n {\n type: collectionIDFieldTypes[relation],\n },\n {\n $ref: `#/definitions/${relation}`,\n },\n ],\n },\n },\n required: ['value', 'relationTo'],\n }\n }),\n }\n }\n } else if (field.hasMany) {\n fieldSchema = {\n type: withNullableJSONSchemaType('array', isRequired),\n items: {\n oneOf: [\n {\n type: collectionIDFieldTypes[field.relationTo],\n },\n {\n $ref: `#/definitions/${field.relationTo}`,\n },\n ],\n },\n }\n } else {\n fieldSchema = {\n oneOf: [\n {\n type: withNullableJSONSchemaType(\n collectionIDFieldTypes[field.relationTo],\n isRequired,\n ),\n },\n {\n $ref: `#/definitions/${field.relationTo}`,\n },\n ],\n }\n }\n\n break\n }\n\n case 'upload': {\n fieldSchema = {\n oneOf: [\n {\n type: collectionIDFieldTypes[field.relationTo],\n },\n {\n $ref: `#/definitions/${field.relationTo}`,\n },\n ],\n }\n if (!isRequired) fieldSchema.oneOf.push({ type: 'null' })\n break\n }\n\n case 'blocks': {\n fieldSchema = {\n type: withNullableJSONSchemaType('array', isRequired),\n items: {\n oneOf: field.blocks.map((block) => {\n const blockFieldSchemas = fieldsToJSONSchema(\n collectionIDFieldTypes,\n block.fields,\n interfaceNameDefinitions,\n config,\n )\n\n const blockSchema: JSONSchema4 = {\n type: 'object',\n additionalProperties: false,\n properties: {\n ...blockFieldSchemas.properties,\n blockType: {\n const: block.slug,\n },\n },\n required: ['blockType', ...blockFieldSchemas.required],\n }\n\n if (block.interfaceName) {\n interfaceNameDefinitions.set(block.interfaceName, blockSchema)\n\n return {\n $ref: `#/definitions/${block.interfaceName}`,\n }\n }\n\n return blockSchema\n }),\n },\n }\n break\n }\n\n case 'array': {\n fieldSchema = {\n type: withNullableJSONSchemaType('array', isRequired),\n items: {\n type: 'object',\n additionalProperties: false,\n ...fieldsToJSONSchema(\n collectionIDFieldTypes,\n field.fields,\n interfaceNameDefinitions,\n config,\n ),\n },\n }\n\n if (field.interfaceName) {\n interfaceNameDefinitions.set(field.interfaceName, fieldSchema)\n\n fieldSchema = {\n $ref: `#/definitions/${field.interfaceName}`,\n }\n }\n break\n }\n\n case 'row':\n case 'collapsible': {\n const childSchema = fieldsToJSONSchema(\n collectionIDFieldTypes,\n field.fields,\n interfaceNameDefinitions,\n config,\n )\n Object.entries(childSchema.properties).forEach(([propName, propSchema]) => {\n fieldSchemas.set(propName, propSchema)\n })\n childSchema.required.forEach((propName) => {\n requiredFieldNames.add(propName)\n })\n break\n }\n\n case 'tabs': {\n field.tabs.forEach((tab) => {\n const childSchema = fieldsToJSONSchema(\n collectionIDFieldTypes,\n tab.fields,\n interfaceNameDefinitions,\n config,\n )\n if (tabHasName(tab)) {\n // could have interface\n fieldSchemas.set(tab.name, {\n type: 'object',\n additionalProperties: false,\n ...childSchema,\n })\n\n // If the named tab has any required fields then we mark this as required otherwise it should be optional\n const hasRequiredFields = tab.fields.some((subField) => fieldIsRequired(subField))\n\n if (hasRequiredFields) {\n requiredFieldNames.add(tab.name)\n }\n } else {\n Object.entries(childSchema.properties).forEach(([propName, propSchema]) => {\n fieldSchemas.set(propName, propSchema)\n })\n childSchema.required.forEach((propName) => {\n requiredFieldNames.add(propName)\n })\n }\n })\n break\n }\n\n case 'group': {\n fieldSchema = {\n type: 'object',\n additionalProperties: false,\n ...fieldsToJSONSchema(\n collectionIDFieldTypes,\n field.fields,\n interfaceNameDefinitions,\n config,\n ),\n }\n\n if (field.interfaceName) {\n interfaceNameDefinitions.set(field.interfaceName, fieldSchema)\n\n fieldSchema = {\n $ref: `#/definitions/${field.interfaceName}`,\n }\n }\n break\n }\n\n default: {\n break\n }\n }\n\n if (fieldSchema && fieldAffectsData(field)) {\n fieldSchemas.set(field.name, fieldSchema)\n }\n\n return fieldSchemas\n }, new Map<string, JSONSchema4>()),\n ),\n required: Array.from(requiredFieldNames),\n }\n}\n\n// This function is part of the public API and is exported through payload/utilities\nexport function entityToJSONSchema(\n config: SanitizedConfig,\n incomingEntity: SanitizedCollectionConfig | SanitizedGlobalConfig,\n interfaceNameDefinitions: Map<string, JSONSchema4>,\n defaultIDType: 'number' | 'text',\n): JSONSchema4 {\n const entity: SanitizedCollectionConfig | SanitizedGlobalConfig = deepCopyObject(incomingEntity)\n const title = entity.typescript?.interface\n ? entity.typescript.interface\n : singular(toWords(entity.slug, true))\n\n const idField: FieldAffectingData = { name: 'id', type: defaultIDType as 'text', required: true }\n const customIdField = entity.fields.find(\n (field) => fieldAffectsData(field) && field.name === 'id',\n ) as FieldAffectingData\n\n if (customIdField && customIdField.type !== 'group' && customIdField.type !== 'tab') {\n customIdField.required = true\n } else {\n entity.fields.unshift(idField)\n }\n\n // mark timestamp fields required\n if ('timestamps' in entity && entity.timestamps !== false) {\n entity.fields = entity.fields.map((field) => {\n if (fieldAffectsData(field) && (field.name === 'createdAt' || field.name === 'updatedAt')) {\n return {\n ...field,\n required: true,\n }\n }\n return field\n })\n }\n\n if ('auth' in entity && entity.auth && !entity.auth?.disableLocalStrategy) {\n entity.fields.push({\n name: 'password',\n type: 'text',\n })\n }\n\n // Used for relationship fields, to determine whether to use a string or number type for the ID.\n const collectionIDFieldTypes = getCollectionIDFieldTypes({ config, defaultIDType })\n\n return {\n type: 'object',\n additionalProperties: false,\n title,\n ...fieldsToJSONSchema(collectionIDFieldTypes, entity.fields, interfaceNameDefinitions, config),\n }\n}\n\n/**\n * This is used for generating the TypeScript types (payload-types.ts) with the payload generate:types command.\n */\nexport function configToJSONSchema(\n config: SanitizedConfig,\n defaultIDType?: 'number' | 'text',\n): JSONSchema4 {\n // a mutable Map to store custom top-level `interfaceName` types. Fields with an `interfaceName` property will be moved to the top-level definitions here\n const interfaceNameDefinitions: Map<string, JSONSchema4> = new Map()\n\n // Collections and Globals have to be moved to the top-level definitions as well. Reason: The top-level type will be the `Config` type - we don't want all collection and global\n // types to be inlined inside the `Config` type\n const entityDefinitions: { [k: string]: JSONSchema4 } = [\n ...config.globals,\n ...config.collections,\n ].reduce((acc, entity) => {\n acc[entity.slug] = entityToJSONSchema(config, entity, interfaceNameDefinitions, defaultIDType)\n return acc\n }, {})\n\n return {\n additionalProperties: false,\n definitions: { ...entityDefinitions, ...Object.fromEntries(interfaceNameDefinitions) },\n // These properties here will be very simple, as all the complexity is in the definitions. These are just the properties for the top-level `Config` type\n type: 'object',\n properties: {\n collections: generateEntitySchemas(config.collections || []),\n globals: generateEntitySchemas(config.globals || []),\n locale: generateLocaleEntitySchemas(config.localization),\n user: generateAuthEntitySchemas(config.collections),\n },\n required: ['user', 'locale', 'collections', 'globals'],\n title: 'Config',\n }\n}\n"],"names":["pluralize","singular","MissingEditorProp","fieldAffectsData","tabHasName","deepCopyObject","toWords","getCollectionIDFieldTypes","fieldIsRequired","field","isConditional","Boolean","admin","condition","isMarkedRequired","required","type","fields","some","subField","tabs","tab","buildOptionEnums","options","map","option","value","generateEntitySchemas","entities","properties","reduce","acc","slug","$ref","additionalProperties","Object","keys","generateLocaleEntitySchemas","localization","locales","localesFromConfig","locale","code","enum","generateAuthEntitySchemas","filter","auth","allOf","collection","oneOf","withNullableJSONSchemaType","fieldType","isRequired","fieldTypes","push","fieldsToJSONSchema","collectionIDFieldTypes","interfaceNameDefinitions","config","requiredFieldNames","Set","fromEntries","fieldSchemas","add","name","fieldSchema","hasMany","items","editor","Error","outputSchema","optionEnums","maxItems","minItems","Array","isArray","relationTo","relation","const","blocks","block","blockFieldSchemas","blockSchema","blockType","interfaceName","set","childSchema","entries","forEach","propName","propSchema","hasRequiredFields","Map","from","entityToJSONSchema","incomingEntity","defaultIDType","entity","title","typescript","interface","idField","customIdField","find","unshift","timestamps","disableLocalStrategy","configToJSONSchema","entityDefinitions","globals","collections","definitions","user"],"mappings":"AAEA,OAAOA,eAAe,YAAW;AACjC,MAAM,EAAEC,QAAQ,EAAE,GAAGD;AAOrB,SAASE,iBAAiB,QAAQ,iCAAgC;AAClE,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,4BAA2B;AACxE,SAASC,cAAc,QAAQ,sBAAqB;AACpD,SAASC,OAAO,QAAQ,oBAAmB;AAC3C,SAASC,yBAAyB,QAAQ,iCAAgC;AAE1E,MAAMC,kBAA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AAc;IAEjF,OAAO;QACLhF,MAAM;QACNkB,sBAAsB;QACtBgE;QACA,GAAG3C,mBAAmBC,wBAAwByC,OAAOhF,MAAM,EAAEwC,0BAA0BC,OAAO;IAChG;AACF;AAEA;;CAEC,GACD,OAAO,SAASiD,mBACdjD,MAAuB,EACvBsC,aAAiC;IAEjC,yJAAyJ;IACzJ,MAAMvC,2BAAqD,IAAImC;IAE/D,gLAAgL;IAChL,+CAA+C;IAC/C,MAAMgB,oBAAkD;WACnDlD,OAAOmD,OAAO;WACdnD,OAAOoD,WAAW;KACtB,CAAChF,MAAM,CAAC,CAACC,KAAKkE;QACblE,GAAG,CAACkE,OAAOjE,IAAI,CAAC,GAAG8D,mBAAmBpC,QAAQuC,QAAQxC,0BAA0BuC;QAChF,OAAOjE;IACT,GAAG,CAAC;IAEJ,OAAO;QACLG,sBAAsB;QACtB6E,aAAa;YAAE,GAAGH,iBAAiB;YAAE,GAAGzE,OAAO0B,WAAW,CAACJ,yBAAyB;QAAC;QACrF,wJAAwJ;QACxJzC,MAAM;QACNa,YAAY;YACViF,aAAanF,sBAAsB+B,OAAOoD,WAAW,IAAI,EAAE;YAC3DD,SAASlF,sBAAsB+B,OAAOmD,OAAO,IAAI,EAAE;YACnDpE,QAAQJ,4BAA4BqB,OAAOpB,YAAY;YACvD0E,MAAMpE,0BAA0Bc,OAAOoD,WAAW;QACpD;QACA/F,UAAU;YAAC;YAAQ;YAAU;YAAe;SAAU;QACtDmF,OAAO;IACT;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/configToJSONSchema.spec.ts"],"sourcesContent":["import type { Config } from '../config/types.js'\n\nimport { sanitizeConfig } from '../config/sanitize.js'\nimport { configToJSONSchema } from './configToJSONSchema.js'\n\ndescribe('configToJSONSchema', () => {\n it('should handle optional arrays with required fields', async () => {\n // @ts-expect-error\n const config: Config = {\n collections: [\n {\n fields: [\n {\n name: 'someRequiredField',\n type: 'array',\n fields: [\n {\n name: 'someRequiredField',\n required: true,\n type: 'text',\n },\n ],\n },\n ],\n slug: 'test',\n timestamps: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const schema = configToJSONSchema(sanitizedConfig, 'text')\n\n expect(schema?.definitions?.test).toStrictEqual({\n additionalProperties: false,\n properties: {\n id: {\n type: 'string',\n },\n someRequiredField: {\n items: {\n additionalProperties: false,\n properties: {\n id: {\n type: ['string', 'null'],\n },\n someRequiredField: {\n type: 'string',\n },\n },\n required: ['someRequiredField'],\n type: 'object',\n },\n type: ['array', 'null'],\n },\n },\n required: ['id'],\n title: 'Test',\n type: 'object',\n })\n })\n\n it('should handle tabs and named tabs with required fields', async () => {\n // @ts-expect-error\n const config: Config = {\n collections: [\n {\n fields: [\n {\n type: 'tabs',\n tabs: [\n {\n label: 'unnamedTab',\n fields: [\n {\n type: 'text',\n name: 'fieldInUnnamedTab',\n },\n ],\n },\n {\n label: 'namedTab',\n name: 'namedTab',\n fields: [\n {\n type: 'text',\n name: 'fieldInNamedTab',\n },\n ],\n },\n {\n label: 'namedTabWithRequired',\n name: 'namedTabWithRequired',\n fields: [\n {\n type: 'text',\n name: 'fieldInNamedTab',\n required: true,\n },\n ],\n },\n ],\n },\n ],\n slug: 'test',\n timestamps: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const schema = configToJSONSchema(sanitizedConfig, 'text')\n\n expect(schema?.definitions?.test).toStrictEqual({\n additionalProperties: false,\n properties: {\n id: {\n type: 'string',\n },\n fieldInUnnamedTab: {\n type: ['string', 'null'],\n },\n namedTab: {\n additionalProperties: false,\n type: 'object',\n properties: {\n fieldInNamedTab: {\n type: ['string', 'null'],\n },\n },\n required: [],\n },\n namedTabWithRequired: {\n additionalProperties: false,\n type: 'object',\n properties: {\n fieldInNamedTab: {\n type: 'string',\n },\n },\n required: ['fieldInNamedTab'],\n },\n },\n required: ['id', 'namedTabWithRequired'],\n title: 'Test',\n type: 'object',\n })\n })\n})\n"],"names":["sanitizeConfig","configToJSONSchema","describe","it","config","collections","fields","name","type","required","slug","timestamps","sanitizedConfig","schema","expect","definitions","test","toStrictEqual","additionalProperties","properties","id","someRequiredField","items","title","tabs","label","fieldInUnnamedTab","namedTab","fieldInNamedTab","namedTabWithRequired"],"
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/configToJSONSchema.spec.ts"],"sourcesContent":["import type { Config } from '../config/types.js'\n\nimport { sanitizeConfig } from '../config/sanitize.js'\nimport { configToJSONSchema } from './configToJSONSchema.js'\n\ndescribe('configToJSONSchema', () => {\n it('should handle optional arrays with required fields', async () => {\n // @ts-expect-error\n const config: Config = {\n collections: [\n {\n fields: [\n {\n name: 'someRequiredField',\n type: 'array',\n fields: [\n {\n name: 'someRequiredField',\n required: true,\n type: 'text',\n },\n ],\n },\n ],\n slug: 'test',\n timestamps: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const schema = configToJSONSchema(sanitizedConfig, 'text')\n\n expect(schema?.definitions?.test).toStrictEqual({\n additionalProperties: false,\n properties: {\n id: {\n type: 'string',\n },\n someRequiredField: {\n items: {\n additionalProperties: false,\n properties: {\n id: {\n type: ['string', 'null'],\n },\n someRequiredField: {\n type: 'string',\n },\n },\n required: ['someRequiredField'],\n type: 'object',\n },\n type: ['array', 'null'],\n },\n },\n required: ['id'],\n title: 'Test',\n type: 'object',\n })\n })\n\n it('should handle tabs and named tabs with required fields', async () => {\n // @ts-expect-error\n const config: Config = {\n collections: [\n {\n fields: [\n {\n type: 'tabs',\n tabs: [\n {\n label: 'unnamedTab',\n fields: [\n {\n type: 'text',\n name: 'fieldInUnnamedTab',\n },\n ],\n },\n {\n label: 'namedTab',\n name: 'namedTab',\n fields: [\n {\n type: 'text',\n name: 'fieldInNamedTab',\n },\n ],\n },\n {\n label: 'namedTabWithRequired',\n name: 'namedTabWithRequired',\n fields: [\n {\n type: 'text',\n name: 'fieldInNamedTab',\n required: true,\n },\n ],\n },\n ],\n },\n ],\n slug: 'test',\n timestamps: false,\n },\n ],\n }\n\n const sanitizedConfig = await sanitizeConfig(config)\n const schema = configToJSONSchema(sanitizedConfig, 'text')\n\n expect(schema?.definitions?.test).toStrictEqual({\n additionalProperties: false,\n properties: {\n id: {\n type: 'string',\n },\n fieldInUnnamedTab: {\n type: ['string', 'null'],\n },\n namedTab: {\n additionalProperties: false,\n type: 'object',\n properties: {\n fieldInNamedTab: {\n type: ['string', 'null'],\n },\n },\n required: [],\n },\n namedTabWithRequired: {\n additionalProperties: false,\n type: 'object',\n properties: {\n fieldInNamedTab: {\n type: 'string',\n },\n },\n required: ['fieldInNamedTab'],\n },\n },\n required: ['id', 'namedTabWithRequired'],\n title: 'Test',\n type: 'object',\n })\n })\n})\n"],"names":["sanitizeConfig","configToJSONSchema","describe","it","config","collections","fields","name","type","required","slug","timestamps","sanitizedConfig","schema","expect","definitions","test","toStrictEqual","additionalProperties","properties","id","someRequiredField","items","title","tabs","label","fieldInUnnamedTab","namedTab","fieldInNamedTab","namedTabWithRequired"],"mappings":"AAEA,SAASA,cAAc,QAAQ,wBAAuB;AACtD,SAASC,kBAAkB,QAAQ,0BAAyB;AAE5DC,SAAS,sBAAsB;IAC7BC,GAAG,sDAAsD;QACvD,mBAAmB;QACnB,MAAMC,SAAiB;YACrBC,aAAa;gBACX;oBACEC,QAAQ;wBACN;4BACEC,MAAM;4BACNC,MAAM;4BACNF,QAAQ;gCACN;oCACEC,MAAM;oCACNE,UAAU;oCACVD,MAAM;gCACR;6BACD;wBACH;qBACD;oBACDE,MAAM;oBACNC,YAAY;gBACd;aACD;QACH;QAEA,MAAMC,kBAAkB,MAAMZ,eAAeI;QAC7C,MAAMS,SAASZ,mBAAmBW,iBAAiB;QAEnDE,OAAOD,QAAQE,aAAaC,MAAMC,aAAa,CAAC;YAC9CC,sBAAsB;YACtBC,YAAY;gBACVC,IAAI;oBACFZ,MAAM;gBACR;gBACAa,mBAAmB;oBACjBC,OAAO;wBACLJ,sBAAsB;wBACtBC,YAAY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wBACR;oBACF;oBACAC,UAAU;wBAAC;qBAAkB;gBAC/B;YACF;YACAA,UAAU;gBAAC;gBAAM;aAAuB;YACxCc,OAAO;YACPf,MAAM;QACR;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/convertData.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nconst convertArrayToObject = (arr, key) =>\n arr.reduce((obj, item) => {\n if (key) {\n obj[item[key]] = item\n return obj\n }\n\n obj[item] = {}\n return obj\n }, {})\n\nconst convertObjectToArray = (arr) => Object.values(arr)\n\nconst convertArrayToHash = (arr, key) =>\n arr.reduce((obj, item, i) => {\n obj[item[key]] = i\n return obj\n }, {})\n\nexport { convertArrayToHash, convertArrayToObject, convertObjectToArray }\n"],"names":["convertArrayToObject","arr","key","reduce","obj","item","convertObjectToArray","Object","values","convertArrayToHash","i"],"
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/convertData.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nconst convertArrayToObject = (arr, key) =>\n arr.reduce((obj, item) => {\n if (key) {\n obj[item[key]] = item\n return obj\n }\n\n obj[item] = {}\n return obj\n }, {})\n\nconst convertObjectToArray = (arr) => Object.values(arr)\n\nconst convertArrayToHash = (arr, key) =>\n arr.reduce((obj, item, i) => {\n obj[item[key]] = i\n return obj\n }, {})\n\nexport { convertArrayToHash, convertArrayToObject, convertObjectToArray }\n"],"names":["convertArrayToObject","arr","key","reduce","obj","item","convertObjectToArray","Object","values","convertArrayToHash","i"],"mappings":"AAAA,oCAAoC,GACpC,MAAMA,uBAAuB,CAACC,KAAKC,MACjCD,IAAIE,MAAM,CAAC,CAACC,KAAKC;QACf,IAAIH,KAAK;YACPE,GAAG,CAACC,IAAI,CAACH,IAAI,CAAC,GAAGG;YACjB,OAAOD;QACT;QAEAA,GAAG,CAACC,KAAK,GAAG,CAAC;QACb,OAAOD;IACT,GAAG,CAAC;AAEN,MAAME,uBAAuB,CAACL,MAAQM,OAAOC,MAAM,CAACP;AAEpD,MAAMQ,qBAAqB,CAACR,KAAKC,MAC/BD,IAAIE,MAAM,CAAC,CAACC,KAAKC,MAAMK;QACrBN,GAAG,CAACC,IAAI,CAACH,IAAI,CAAC,GAAGQ;QACjB,OAAON;IACT,GAAG,CAAC;AAEN,SAASK,kBAAkB,EAAET,oBAAoB,EAAEM,oBAAoB,GAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/createArrayFromCommaDelineated.ts"],"sourcesContent":["export function createArrayFromCommaDelineated(input: string): string[] {\n if (Array.isArray(input)) return input\n if (input.indexOf(',') > -1) {\n return input.split(',')\n }\n return [input]\n}\n"],"names":["createArrayFromCommaDelineated","input","Array","isArray","indexOf","split"],"
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/createArrayFromCommaDelineated.ts"],"sourcesContent":["export function createArrayFromCommaDelineated(input: string): string[] {\n if (Array.isArray(input)) return input\n if (input.indexOf(',') > -1) {\n return input.split(',')\n }\n return [input]\n}\n"],"names":["createArrayFromCommaDelineated","input","Array","isArray","indexOf","split"],"mappings":"AAAA,OAAO,SAASA,+BAA+BC,KAAa;IAC1D,IAAIC,MAAMC,OAAO,CAACF,QAAQ,OAAOA;IACjC,IAAIA,MAAMG,OAAO,CAAC,OAAO,CAAC,GAAG;QAC3B,OAAOH,MAAMI,KAAK,CAAC;IACrB;IACA,OAAO;QAACJ;KAAM;AAChB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/createLocalReq.ts"],"sourcesContent":["import type { User } from '../auth/types.js'\nimport type { Payload, RequestContext } from '../index.js'\nimport type { PayloadRequestWithData } from '../types/index.js'\n\nimport { getDataLoader } from '../collections/dataloader.js'\nimport { getLocalI18n } from '../translations/getLocalI18n.js'\n\nfunction getRequestContext(\n req: PayloadRequestWithData = { context: null } as PayloadRequestWithData,\n context: RequestContext = {},\n): RequestContext {\n if (req.context) {\n if (Object.keys(req.context).length === 0 && req.context.constructor === Object) {\n // if req.context is `{}` avoid unnecessary spread\n return context\n } else {\n return { ...req.context, ...context }\n }\n } else {\n return context\n }\n}\n\nconst attachFakeURLProperties = (req: PayloadRequestWithData) => {\n /**\n * *NOTE*\n * If no URL is provided, the local API was called directly outside\n * the context of a request. Therefore we create a fake URL object.\n * `ts-expect-error` is used below for properties that are 'read-only'\n * since they do not exist yet we can safely ignore the error.\n */\n let urlObject\n\n function getURLObject() {\n if (urlObject) return urlObject\n const urlToUse = req?.url || req.payload.config?.serverURL || 'http://localhost'\n try {\n urlObject = new URL(urlToUse)\n } catch (error) {\n urlObject = new URL('http://localhost')\n }\n\n return urlObject\n }\n\n if (!req.host) req.host = getURLObject().host\n if (!req.protocol) req.protocol = getURLObject().protocol\n if (!req.pathname) req.pathname = getURLObject().pathname\n // @ts-expect-error\n if (!req.searchParams) req.searchParams = getURLObject().searchParams\n // @ts-expect-error\n if (!req.origin) req.origin = getURLObject().origin\n // @ts-expect-error\n if (!req?.url) req.url = getURLObject().href\n}\n\ntype CreateLocalReq = (\n options: {\n context?: RequestContext\n fallbackLocale?: string\n locale?: string\n req?: PayloadRequestWithData\n user?: User\n },\n payload: Payload,\n) => Promise<PayloadRequestWithData>\nexport const createLocalReq: CreateLocalReq = async (\n { context, fallbackLocale, locale: localeArg, req = {} as PayloadRequestWithData, user },\n payload,\n) => {\n if (payload.config?.localization) {\n const locale = localeArg === '*' ? 'all' : localeArg\n const defaultLocale = payload.config.localization.defaultLocale\n req.locale = locale || req?.locale || defaultLocale\n const fallbackLocaleFromConfig = payload.config.localization.locales.find(\n ({ code }) => req.locale === code,\n )?.fallbackLocale\n if (typeof fallbackLocale !== 'undefined') {\n req.fallbackLocale = fallbackLocale\n } else if (typeof req?.fallbackLocale === 'undefined') {\n req.fallbackLocale = fallbackLocaleFromConfig || defaultLocale\n }\n }\n\n const i18n =\n req?.i18n ||\n (await getLocalI18n({ config: payload.config, language: payload.config.i18n.fallbackLanguage }))\n\n // @ts-expect-error\n if (!req.headers) req.headers = new Headers()\n req.context = getRequestContext(req, context)\n req.payloadAPI = req?.payloadAPI || 'local'\n req.payload = payload\n req.i18n = i18n\n req.t = i18n.t\n req.user = user || req?.user || null\n req.payloadDataLoader = req?.payloadDataLoader || getDataLoader(req)\n req.routeParams = req?.routeParams || {}\n req.query = req?.query || {}\n\n attachFakeURLProperties(req)\n\n return req\n}\n"],"names":["getDataLoader","getLocalI18n","getRequestContext","req","context","Object","keys","length","constructor","attachFakeURLProperties","urlObject","getURLObject","urlToUse","url","payload","config","serverURL","URL","error","host","protocol","pathname","searchParams","origin","href","createLocalReq","fallbackLocale","locale","localeArg","user","localization","defaultLocale","fallbackLocaleFromConfig","locales","find","code","i18n","language","fallbackLanguage","headers","Headers","payloadAPI","t","payloadDataLoader","routeParams","query"],"
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/createLocalReq.ts"],"sourcesContent":["import type { User } from '../auth/types.js'\nimport type { Payload, RequestContext } from '../index.js'\nimport type { PayloadRequestWithData } from '../types/index.js'\n\nimport { getDataLoader } from '../collections/dataloader.js'\nimport { getLocalI18n } from '../translations/getLocalI18n.js'\n\nfunction getRequestContext(\n req: PayloadRequestWithData = { context: null } as PayloadRequestWithData,\n context: RequestContext = {},\n): RequestContext {\n if (req.context) {\n if (Object.keys(req.context).length === 0 && req.context.constructor === Object) {\n // if req.context is `{}` avoid unnecessary spread\n return context\n } else {\n return { ...req.context, ...context }\n }\n } else {\n return context\n }\n}\n\nconst attachFakeURLProperties = (req: PayloadRequestWithData) => {\n /**\n * *NOTE*\n * If no URL is provided, the local API was called directly outside\n * the context of a request. Therefore we create a fake URL object.\n * `ts-expect-error` is used below for properties that are 'read-only'\n * since they do not exist yet we can safely ignore the error.\n */\n let urlObject\n\n function getURLObject() {\n if (urlObject) return urlObject\n const urlToUse = req?.url || req.payload.config?.serverURL || 'http://localhost'\n try {\n urlObject = new URL(urlToUse)\n } catch (error) {\n urlObject = new URL('http://localhost')\n }\n\n return urlObject\n }\n\n if (!req.host) req.host = getURLObject().host\n if (!req.protocol) req.protocol = getURLObject().protocol\n if (!req.pathname) req.pathname = getURLObject().pathname\n // @ts-expect-error\n if (!req.searchParams) req.searchParams = getURLObject().searchParams\n // @ts-expect-error\n if (!req.origin) req.origin = getURLObject().origin\n // @ts-expect-error\n if (!req?.url) req.url = getURLObject().href\n}\n\ntype CreateLocalReq = (\n options: {\n context?: RequestContext\n fallbackLocale?: string\n locale?: string\n req?: PayloadRequestWithData\n user?: User\n },\n payload: Payload,\n) => Promise<PayloadRequestWithData>\nexport const createLocalReq: CreateLocalReq = async (\n { context, fallbackLocale, locale: localeArg, req = {} as PayloadRequestWithData, user },\n payload,\n) => {\n if (payload.config?.localization) {\n const locale = localeArg === '*' ? 'all' : localeArg\n const defaultLocale = payload.config.localization.defaultLocale\n req.locale = locale || req?.locale || defaultLocale\n const fallbackLocaleFromConfig = payload.config.localization.locales.find(\n ({ code }) => req.locale === code,\n )?.fallbackLocale\n if (typeof fallbackLocale !== 'undefined') {\n req.fallbackLocale = fallbackLocale\n } else if (typeof req?.fallbackLocale === 'undefined') {\n req.fallbackLocale = fallbackLocaleFromConfig || defaultLocale\n }\n }\n\n const i18n =\n req?.i18n ||\n (await getLocalI18n({ config: payload.config, language: payload.config.i18n.fallbackLanguage }))\n\n // @ts-expect-error\n if (!req.headers) req.headers = new Headers()\n req.context = getRequestContext(req, context)\n req.payloadAPI = req?.payloadAPI || 'local'\n req.payload = payload\n req.i18n = i18n\n req.t = i18n.t\n req.user = user || req?.user || null\n req.payloadDataLoader = req?.payloadDataLoader || getDataLoader(req)\n req.routeParams = req?.routeParams || {}\n req.query = req?.query || {}\n\n attachFakeURLProperties(req)\n\n return req\n}\n"],"names":["getDataLoader","getLocalI18n","getRequestContext","req","context","Object","keys","length","constructor","attachFakeURLProperties","urlObject","getURLObject","urlToUse","url","payload","config","serverURL","URL","error","host","protocol","pathname","searchParams","origin","href","createLocalReq","fallbackLocale","locale","localeArg","user","localization","defaultLocale","fallbackLocaleFromConfig","locales","find","code","i18n","language","fallbackLanguage","headers","Headers","payloadAPI","t","payloadDataLoader","routeParams","query"],"mappings":"AAIA,SAASA,aAAa,QAAQ,+BAA8B;AAC5D,SAASC,YAAY,QAAQ,kCAAiC;AAE9D,SAASC,kBACPC,MAA8B;IAAEC,SAAS;AAAK,CAA2B,EACzEA,UAA0B,CAAC,CAAC;IAE5B,IAAID,IAAIC,OAAO,EAAE;QACf,IAAIC,OAAOC,IAAI,CAACH,IAAIC,OAAO,EAAEG,MAAM,KAAK,KAAKJ,IAAIC,OAAO,CAACI,WAAW,KAAKH,QAAQ;YAC/E,kDAAkD;YAClD,OAAOD;QACT,OAAO;YACL,OAAO;gBAAE,GAAGD,IAAIC,OAAO;gBAAE,GAAGA,OAAO;YAAC;QACtC;IACF,OAAO;QACL,OAAOA;IACT;AACF;AAEA,MAAMK,0BAA0B,CAACN;IAC/B;;;;;;GAMC,GACD,IAAIO;IAEJ,SAASC;QACP,IAAID,WAAW,OAAOA;QACtB,MAAME,WAAWT,KAAKU,OAAOV,IAAIW,OAAO,CAACC,MAAM,EAAEC,aAAa;QAC9D,IAAI;YACFN,YAAY,IAAIO,IAAIL;QACtB,EAAE,OAAOM,OAAO;YACdR,YAAY,IAAIO,IAAI;QACtB;QAEA,OAAOP;IACT;IAEA,IAAI,CAACP,IAAIgB,IAAI,EAAEhB,IAAIgB,IAAI,GAAGR,eAAeQ,IAAI;IAC7C,IAAI,CAAChB,IAAIiB,QAAQ,EAAEjB,IAAIiB,QAAQ,GAAGT,eAAeS,QAAQ;IACzD,IAAI,CAACjB,IAAIkB,QAAQ,EAAElB,IAAIkB,QAAQ,GAAGV,eAAeU,QAAQ;IACzD,mBAAmB;IACnB,IAAI,CAAClB,IAAImB,YAAY,EAAEnB,IAAImB,YAAY,GAAGX,eAAeW,YAAY;IACrE,mBAAmB;IACnB,IAAI,CAACnB,IAAIoB,MAAM,EAAEpB,IAAIoB,MAAM,GAAGZ,eAAeY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AAGxC,KAAKwC,qBAAqB3C,cAAcG;IAChEA,IAAIyC,WAAW,GAAGzC,KAAKyC,eAAe,CAAC;IACvCzC,IAAI0C,KAAK,GAAG1C,KAAK0C,SAAS,CAAC;IAE3BpC,wBAAwBN;IAExB,OAAOA;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/deepCopyObject.ts"],"sourcesContent":["export const deepCopyObject = (inObject) => {\n if (inObject instanceof Date) return inObject\n\n if (inObject instanceof Set) return new Set(inObject)\n\n if (inObject instanceof Map) return new Map(inObject)\n\n if (typeof inObject !== 'object' || inObject === null) {\n return inObject // Return the value if inObject is not an object\n }\n\n // Create an array or object to hold the values\n const outObject = Array.isArray(inObject) ? [] : {}\n\n Object.keys(inObject).forEach((key) => {\n const value = inObject[key]\n\n // Recursively (deep) copy for nested objects, including arrays\n outObject[key] = typeof value === 'object' && value !== null ? deepCopyObject(value) : value\n })\n\n return outObject\n}\n"],"names":["deepCopyObject","inObject","Date","Set","Map","outObject","Array","isArray","Object","keys","forEach","key","value"],"
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/deepCopyObject.ts"],"sourcesContent":["export const deepCopyObject = (inObject) => {\n if (inObject instanceof Date) return inObject\n\n if (inObject instanceof Set) return new Set(inObject)\n\n if (inObject instanceof Map) return new Map(inObject)\n\n if (typeof inObject !== 'object' || inObject === null) {\n return inObject // Return the value if inObject is not an object\n }\n\n // Create an array or object to hold the values\n const outObject = Array.isArray(inObject) ? [] : {}\n\n Object.keys(inObject).forEach((key) => {\n const value = inObject[key]\n\n // Recursively (deep) copy for nested objects, including arrays\n outObject[key] = typeof value === 'object' && value !== null ? deepCopyObject(value) : value\n })\n\n return outObject\n}\n"],"names":["deepCopyObject","inObject","Date","Set","Map","outObject","Array","isArray","Object","keys","forEach","key","value"],"mappings":"AAAA,OAAO,MAAMA,iBAAiB,CAACC;IAC7B,IAAIA,oBAAoBC,MAAM,OAAOD;IAErC,IAAIA,oBAAoBE,KAAK,OAAO,IAAIA,IAAIF;IAE5C,IAAIA,oBAAoBG,KAAK,OAAO,IAAIA,IAAIH;IAE5C,IAAI,OAAOA,aAAa,YAAYA,aAAa,MAAM;QACrD,OAAOA,SAAS,gDAAgD;;IAClE;IAEA,+CAA+C;IAC/C,MAAMI,YAAYC,MAAMC,OAAO,CAACN,YAAY,EAAE,GAAG,CAAC;IAElDO,OAAOC,IAAI,CAACR,UAAUS,OAAO,CAAC,CAACC;QAC7B,MAAMC,QAAQX,QAAQ,CAACU,IAAI;QAE3B,+DAA+D;QAC/DN,SAAS,CAACM,IAAI,GAAG,OAAOC,UAAU,YAAYA,UAAU,OAAOZ,eAAeY,SAASA;IACzF;IAEA,OAAOP;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/deepMerge.ts"],"sourcesContent":["export function deepMerge(obj1, obj2) {\n const output = { ...obj1 }\n\n for (const key in obj2) {\n if (Object.prototype.hasOwnProperty.call(obj2, key)) {\n if (typeof obj2[key] === 'object' && !Array.isArray(obj2[key]) && obj1[key]) {\n output[key] = deepMerge(obj1[key], obj2[key])\n } else {\n output[key] = obj2[key]\n }\n }\n }\n\n return output\n}\n"],"names":["deepMerge","obj1","obj2","output","key","Object","prototype","hasOwnProperty","call","Array","isArray"],"
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/deepMerge.ts"],"sourcesContent":["export function deepMerge(obj1, obj2) {\n const output = { ...obj1 }\n\n for (const key in obj2) {\n if (Object.prototype.hasOwnProperty.call(obj2, key)) {\n if (typeof obj2[key] === 'object' && !Array.isArray(obj2[key]) && obj1[key]) {\n output[key] = deepMerge(obj1[key], obj2[key])\n } else {\n output[key] = obj2[key]\n }\n }\n }\n\n return output\n}\n"],"names":["deepMerge","obj1","obj2","output","key","Object","prototype","hasOwnProperty","call","Array","isArray"],"mappings":"AAAA,OAAO,SAASA,UAAUC,IAAI,EAAEC,IAAI;IAClC,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IAEzB,IAAK,MAAMG,OAAOF,KAAM;QACtB,IAAIG,OAAOC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACN,MAAME,MAAM;YACnD,IAAI,OAAOF,IAAI,CAACE,IAAI,KAAK,YAAY,CAACK,MAAMC,OAAO,CAACR,IAAI,CAACE,IAAI,KAAKH,IAAI,CAACG,IAAI,EAAE;gBAC3ED,MAAM,CAACC,IAAI,GAAGJ,UAAUC,IAAI,CAACG,IAAI,EAAEF,IAAI,CAACE,IAAI;YAC9C,OAAO;gBACLD,MAAM,CAACC,IAAI,GAAGF,IAAI,CAACE,IAAI;YACzB;QACF;IACF;IAEA,OAAOD;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDependencies.d.ts","sourceRoot":"","sources":["../../../src/utilities/dependencies/getDependencies.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getDependencies.d.ts","sourceRoot":"","sources":["../../../src/utilities/dependencies/getDependencies.ts"],"names":[],"mappings":"AA0BA,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,QAAQ,EAAE,GAAG,CACX,MAAM,EACN;QACE,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;KAChB,CACF,CAAA;CACF,CAAA;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,EAAE,GACzB,OAAO,CAAC,qBAAqB,CAAC,CAgEhC"}
|
|
@@ -14,21 +14,38 @@
|
|
|
14
14
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
15
15
|
*/ import { findUp } from 'find-up';
|
|
16
16
|
import { existsSync, promises as fs } from 'fs';
|
|
17
|
-
import
|
|
17
|
+
import path from 'path';
|
|
18
|
+
import { fileURLToPath } from 'url';
|
|
18
19
|
import { resolveFrom } from './resolveFrom.js';
|
|
20
|
+
const filename = fileURLToPath(import.meta.url);
|
|
21
|
+
const dirname = path.dirname(filename);
|
|
19
22
|
export async function getDependencies(baseDir, requiredPackages) {
|
|
20
23
|
const resolutions = new Map();
|
|
21
24
|
const missingPackages = [];
|
|
22
25
|
await Promise.all(requiredPackages.map(async (pkg)=>{
|
|
23
26
|
try {
|
|
24
27
|
const pkgPath = await fs.realpath(resolveFrom(baseDir, pkg));
|
|
25
|
-
const pkgDir = dirname(pkgPath);
|
|
28
|
+
const pkgDir = path.dirname(pkgPath);
|
|
26
29
|
let packageJsonFilePath = null;
|
|
30
|
+
const processCwd = process.cwd();
|
|
31
|
+
const payloadPkgDirname = path.resolve(dirname, '../../../') // pkg dir (outside src)
|
|
32
|
+
;
|
|
33
|
+
// if node_modules is in payloadPkgDirname, go to parent dir which contains node_modules
|
|
34
|
+
if (payloadPkgDirname.includes('node_modules')) {
|
|
35
|
+
payloadPkgDirname.split('node_modules').slice(0, -1);
|
|
36
|
+
}
|
|
27
37
|
await findUp('package.json', {
|
|
28
38
|
type: 'file',
|
|
29
39
|
cwd: pkgDir
|
|
30
|
-
}).then((
|
|
31
|
-
|
|
40
|
+
}).then((foundPath)=>{
|
|
41
|
+
if (foundPath) {
|
|
42
|
+
const resolvedFoundPath = path.resolve(foundPath);
|
|
43
|
+
const resolvedCwd = path.resolve(processCwd);
|
|
44
|
+
if (resolvedFoundPath.startsWith(resolvedCwd) || resolvedFoundPath.startsWith(payloadPkgDirname)) {
|
|
45
|
+
// We don't want to match node modules outside the user's project. Checking for both process.cwd and dirname is a reliable way to do this.
|
|
46
|
+
packageJsonFilePath = foundPath;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
32
49
|
});
|
|
33
50
|
if (packageJsonFilePath && existsSync(packageJsonFilePath)) {
|
|
34
51
|
// parse version
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utilities/dependencies/getDependencies.ts"],"sourcesContent":["/*\n This source code has been taken and modified from https://github.com/vercel/next.js/blob/41a80533f900467e1b788bd2673abe2dca20be6a/packages/next/src/lib/has-necessary-dependencies.ts\n\n License:\n\n The MIT License (MIT)\n\n Copyright (c) 2024 Vercel, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nimport { findUp } from 'find-up'\nimport { existsSync, promises as fs } from 'fs'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/utilities/dependencies/getDependencies.ts"],"sourcesContent":["/*\n This source code has been taken and modified from https://github.com/vercel/next.js/blob/41a80533f900467e1b788bd2673abe2dca20be6a/packages/next/src/lib/has-necessary-dependencies.ts\n\n License:\n\n The MIT License (MIT)\n\n Copyright (c) 2024 Vercel, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nimport { findUp } from 'find-up'\nimport { existsSync, promises as fs } from 'fs'\nimport path from 'path'\nimport { fileURLToPath } from 'url'\n\nimport { resolveFrom } from './resolveFrom.js'\n\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\n\nexport type NecessaryDependencies = {\n missing: string[]\n resolved: Map<\n string,\n {\n path: string\n version: string\n }\n >\n}\n\nexport async function getDependencies(\n baseDir: string,\n requiredPackages: string[],\n): Promise<NecessaryDependencies> {\n const resolutions = new Map<\n string,\n {\n path: string\n version: string\n }\n >()\n const missingPackages: string[] = []\n\n await Promise.all(\n requiredPackages.map(async (pkg) => {\n try {\n const pkgPath = await fs.realpath(resolveFrom(baseDir, pkg))\n\n const pkgDir = path.dirname(pkgPath)\n\n let packageJsonFilePath = null\n\n const processCwd = process.cwd()\n const payloadPkgDirname = path.resolve(dirname, '../../../') // pkg dir (outside src)\n\n // if node_modules is in payloadPkgDirname, go to parent dir which contains node_modules\n if (payloadPkgDirname.includes('node_modules')) {\n payloadPkgDirname.split('node_modules').slice(0, -1)\n }\n\n await findUp('package.json', { type: 'file', cwd: pkgDir }).then((foundPath) => {\n if (foundPath) {\n const resolvedFoundPath = path.resolve(foundPath)\n const resolvedCwd = path.resolve(processCwd)\n\n if (\n resolvedFoundPath.startsWith(resolvedCwd) ||\n resolvedFoundPath.startsWith(payloadPkgDirname)\n ) {\n // We don't want to match node modules outside the user's project. Checking for both process.cwd and dirname is a reliable way to do this.\n packageJsonFilePath = foundPath\n }\n }\n })\n\n if (packageJsonFilePath && existsSync(packageJsonFilePath)) {\n // parse version\n const packageJson = JSON.parse(await fs.readFile(packageJsonFilePath, 'utf8'))\n const version = packageJson.version\n\n resolutions.set(pkg, {\n path: packageJsonFilePath,\n version,\n })\n } else {\n return missingPackages.push(pkg)\n }\n } catch (_) {\n return missingPackages.push(pkg)\n }\n }),\n )\n\n return {\n missing: missingPackages,\n resolved: resolutions,\n }\n}\n"],"names":["findUp","existsSync","promises","fs","path","fileURLToPath","resolveFrom","filename","url","dirname","getDependencies","baseDir","requiredPackages","resolutions","Map","missingPackages","Promise","all","map","pkg","pkgPath","realpath","pkgDir","packageJsonFilePath","processCwd","process","cwd","payloadPkgDirname","resolve","includes","split","slice","type","then","foundPath","resolvedFoundPath","resolvedCwd","startsWith","packageJson","JSON","parse","readFile","version","set","push","_","missing","resolved"],"mappings":"AAAA;;;;;;;;;;;;;;AAcA,GAEA,SAASA,MAAM,QAAQ,UAAS;AAChC,SAASC,UAAU,EAAEC,YAAYC,EAAE,QAAQ,KAAI;AAC/C,OAAOC,UAAU,OAAM;AACvB,SAASC,aAAa,QAAQ,MAAK;AAEnC,SAASC,WAAW,QAAQ,mBAAkB;AAE9C,MAAMC,WAAWF,cAAc,YAAYG,GAAG;AAC9C,MAAMC,UAAUL,KAAKK,OAAO,CAACF;AAa7B,OAAO,eAAeG,gBACpBC,OAAe,EACfC,gBAA0B;IAE1B,MA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IACZ;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utilities/dependencies/isError.ts"],"sourcesContent":["/*\n This source code has been taken and modified from https://github.com/vercel/next.js/blob/be87132327ea28acd4bf7af09a401bac2374cb64/packages/next/src/lib/is-error.ts\n\n License:\n\n The MIT License (MIT)\n\n Copyright (c) 2024 Vercel, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nexport interface ErrorWithCode extends Error {\n code?: number | string\n}\n\nexport function isError(err: unknown): err is ErrorWithCode {\n return typeof err === 'object' && err !== null && 'name' in err && 'message' in err\n}\n"],"names":["isError","err"],"
|
|
1
|
+
{"version":3,"sources":["../../../src/utilities/dependencies/isError.ts"],"sourcesContent":["/*\n This source code has been taken and modified from https://github.com/vercel/next.js/blob/be87132327ea28acd4bf7af09a401bac2374cb64/packages/next/src/lib/is-error.ts\n\n License:\n\n The MIT License (MIT)\n\n Copyright (c) 2024 Vercel, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nexport interface ErrorWithCode extends Error {\n code?: number | string\n}\n\nexport function isError(err: unknown): err is ErrorWithCode {\n return typeof err === 'object' && err !== null && 'name' in err && 'message' in err\n}\n"],"names":["isError","err"],"mappings":"AAAA;;;;;;;;;;;;;;AAcA,GAMA,OAAO,SAASA,QAAQC,GAAY;IAClC,OAAO,OAAOA,QAAQ,YAAYA,QAAQ,QAAQ,UAAUA,OAAO,aAAaA;AAClF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realPath.d.ts","sourceRoot":"","sources":["../../../src/utilities/dependencies/realPath.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"realPath.d.ts","sourceRoot":"","sources":["../../../src/utilities/dependencies/realPath.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,IAAI,CAAA;AAQnB,eAAO,MAAM,YAAY,+BAAuD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utilities/dependencies/realPath.ts"],"sourcesContent":["/*\n This source code has been taken from https://github.com/vercel/next.js/blob/39498d604c3b25d92a483153fe648a7ee456fbda/packages/next/src/lib/realpath.ts\n\n License:\n\n The MIT License (MIT)\n\n Copyright (c) 2024 Vercel, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\nimport fs from 'fs'\n\nconst isWindows = process.platform === 'win32'\n\n// Interesting learning from this, that fs.realpathSync is 70x slower than fs.realpathSync.native:\n// https://sun0day.github.io/blog/vite/why-vite4_3-is-faster.html#fs-realpathsync-issue\n// https://github.com/nodejs/node/issues/2680\n// However, we can't use fs.realpathSync.native on Windows due to behavior differences.\nexport const realpathSync = isWindows ? fs.realpathSync : fs.realpathSync.native\n"],"names":["fs","isWindows","process","platform","realpathSync","native"],"
|
|
1
|
+
{"version":3,"sources":["../../../src/utilities/dependencies/realPath.ts"],"sourcesContent":["/*\n This source code has been taken from https://github.com/vercel/next.js/blob/39498d604c3b25d92a483153fe648a7ee456fbda/packages/next/src/lib/realpath.ts\n\n License:\n\n The MIT License (MIT)\n\n Copyright (c) 2024 Vercel, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\nimport fs from 'fs'\n\nconst isWindows = process.platform === 'win32'\n\n// Interesting learning from this, that fs.realpathSync is 70x slower than fs.realpathSync.native:\n// https://sun0day.github.io/blog/vite/why-vite4_3-is-faster.html#fs-realpathsync-issue\n// https://github.com/nodejs/node/issues/2680\n// However, we can't use fs.realpathSync.native on Windows due to behavior differences.\nexport const realpathSync = isWindows ? fs.realpathSync : fs.realpathSync.native\n"],"names":["fs","isWindows","process","platform","realpathSync","native"],"mappings":"AAAA;;;;;;;;;;;;;;AAcA,GACA,OAAOA,QAAQ,KAAI;AAEnB,MAAMC,YAAYC,QAAQC,QAAQ,KAAK;AAEvC,kGAAkG;AAClG,uFAAuF;AACvF,6CAA6C;AAC7C,uFAAuF;AACvF,OAAO,MAAMC,eAAeH,YAAYD,GAAGI,YAAY,GAAGJ,GAAGI,YAAY,CAACC,MAAM,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utilities/dependencies/resolveFrom.ts"],"sourcesContent":["/*\n This source code has been taken and modified from https://github.com/vercel/next.js/blob/39498d604c3b25d92a483153fe648a7ee456fbda/packages/next/src/lib/resolve-from.ts\n\n License:\n\n The MIT License (MIT)\n\n Copyright (c) 2024 Vercel, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n// source: https://github.com/sindresorhus/resolve-from\nimport { createRequire } from 'module'\nimport path from 'path'\n\nimport { isError } from './isError.js'\nimport { realpathSync } from './realPath.js'\n\nexport const resolveFrom = (fromDirectory: string, moduleId: string, silent?: boolean) => {\n if (typeof fromDirectory !== 'string') {\n throw new TypeError(\n `Expected \\`fromDir\\` to be of type \\`string\\`, got \\`${typeof fromDirectory}\\``,\n )\n }\n\n if (typeof moduleId !== 'string') {\n throw new TypeError(\n `Expected \\`moduleId\\` to be of type \\`string\\`, got \\`${typeof moduleId}\\``,\n )\n }\n\n try {\n fromDirectory = realpathSync(fromDirectory)\n } catch (error: unknown) {\n if (isError(error) && error.code === 'ENOENT') {\n fromDirectory = path.resolve(fromDirectory)\n } else if (silent) {\n return\n } else {\n throw error\n }\n }\n\n const fromFile = path.join(fromDirectory, 'noop.js')\n\n const require = createRequire(import.meta.url)\n\n const Module = require('module')\n\n const resolveFileName = () => {\n return Module._resolveFilename(moduleId, {\n id: fromFile,\n filename: fromFile,\n paths: Module._nodeModulePaths(fromDirectory),\n })\n }\n\n if (silent) {\n try {\n return resolveFileName()\n } catch (error) {\n return\n }\n }\n\n return resolveFileName()\n}\n"],"names":["createRequire","path","isError","realpathSync","resolveFrom","fromDirectory","moduleId","silent","TypeError","error","code","resolve","fromFile","join","require","url","Module","resolveFileName","_resolveFilename","id","filename","paths","_nodeModulePaths"],"
|
|
1
|
+
{"version":3,"sources":["../../../src/utilities/dependencies/resolveFrom.ts"],"sourcesContent":["/*\n This source code has been taken and modified from https://github.com/vercel/next.js/blob/39498d604c3b25d92a483153fe648a7ee456fbda/packages/next/src/lib/resolve-from.ts\n\n License:\n\n The MIT License (MIT)\n\n Copyright (c) 2024 Vercel, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n// source: https://github.com/sindresorhus/resolve-from\nimport { createRequire } from 'module'\nimport path from 'path'\n\nimport { isError } from './isError.js'\nimport { realpathSync } from './realPath.js'\n\nexport const resolveFrom = (fromDirectory: string, moduleId: string, silent?: boolean) => {\n if (typeof fromDirectory !== 'string') {\n throw new TypeError(\n `Expected \\`fromDir\\` to be of type \\`string\\`, got \\`${typeof fromDirectory}\\``,\n )\n }\n\n if (typeof moduleId !== 'string') {\n throw new TypeError(\n `Expected \\`moduleId\\` to be of type \\`string\\`, got \\`${typeof moduleId}\\``,\n )\n }\n\n try {\n fromDirectory = realpathSync(fromDirectory)\n } catch (error: unknown) {\n if (isError(error) && error.code === 'ENOENT') {\n fromDirectory = path.resolve(fromDirectory)\n } else if (silent) {\n return\n } else {\n throw error\n }\n }\n\n const fromFile = path.join(fromDirectory, 'noop.js')\n\n const require = createRequire(import.meta.url)\n\n const Module = require('module')\n\n const resolveFileName = () => {\n return Module._resolveFilename(moduleId, {\n id: fromFile,\n filename: fromFile,\n paths: Module._nodeModulePaths(fromDirectory),\n })\n }\n\n if (silent) {\n try {\n return resolveFileName()\n } catch (error) {\n return\n }\n }\n\n return resolveFileName()\n}\n"],"names":["createRequire","path","isError","realpathSync","resolveFrom","fromDirectory","moduleId","silent","TypeError","error","code","resolve","fromFile","join","require","url","Module","resolveFileName","_resolveFilename","id","filename","paths","_nodeModulePaths"],"mappings":"AAAA;;;;;;;;;;;;;;AAcA,GAEA,uDAAuD;AACvD,SAASA,aAAa,QAAQ,SAAQ;AACtC,OAAOC,UAAU,OAAM;AAEvB,SAASC,OAAO,QAAQ,eAAc;AACtC,SAASC,YAAY,QAAQ,gBAAe;AAE5C,OAAO,MAAMC,cAAc,CAACC,eAAuBC,UAAkBC;IACnE,IAAI,OAAOF,kBAAkB,UAAU;QACrC,MAAM,IAAIG,UACR,CAAC,qDAAqD,EAAE,OAAOH,cAAc,EAAE,CAAC;IAEpF;IAEA,IAAI,OAAOC,aAAa,UAAU;QAChC,MAAM,IAAIE,UACR,CAAC,sDAAsD,EAAE,OAAOF,SAAS,EAAE,CAAC;IAEhF;IAEA,IAAI;QACFD,gBAAgBF,aAAaE;IAC/B,EAAE,OAAOI,OAAgB;QACvB,IAAIP,QAAQO,UAAUA,MAAMC,IAAI,KAAK,UAAU;YAC7CL,gBAAgBJ,KAAKU,OAAO,CAACN;QAC/B,OAAO,IAAIE,QAAQ;YACjB;QACF,OAAO;YACL,MAAME;QACR;IACF;IAEA,MAAMG,WAAWX,KAAKY,IAAI,CAACR,eAAe;IAE1C,MAAMS,UAAUd,cAAc,YAAYe,GAAG;IAE7C,MAAMC,SAASF,QAAQ;IAEvB,MAAMG,kBAAkB;QACtB,OAAOD,OAAOE,gBAAgB,CAACZ,UAAU;YACvCa,IAAIP;YACJQ,UAAUR;YACVS,OAAOL,OAAOM,gBAAgB,CAACjB;QACjC;IACF;IAEA,IAAIE,QAAQ;QACV,IAAI;YACF,OAAOU;QACT,EAAE,OAAOR,OAAO;YACd;QACF;IACF;IAEA,OAAOQ;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldSchemaToJSON.d.ts","sourceRoot":"","sources":["../../src/utilities/fieldSchemaToJSON.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAEnE,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,CAAC,EAAE,eAAe,CAAA;IACxB,MAAM,CAAC,EAAE,eAAe,CAAA;IACxB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,UAAU,CAAA;CACvB,EAAE,CAAA;AAEH,eAAO,MAAM,iBAAiB,WAAY,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"fieldSchemaToJSON.d.ts","sourceRoot":"","sources":["../../src/utilities/fieldSchemaToJSON.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAEnE,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,CAAC,EAAE,eAAe,CAAA;IACxB,MAAM,CAAC,EAAE,eAAe,CAAA;IACxB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,UAAU,CAAA;CACvB,EAAE,CAAA;AAEH,eAAO,MAAM,iBAAiB,WAAY,iBAAiB,EAAE,KAAG,eA4G/D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/fieldSchemaToJSON.ts"],"sourcesContent":["import type { FieldTypes } from '../admin/forms/FieldTypes.js'\nimport type { ClientFieldConfig } from '../fields/config/client.js'\n\nexport type FieldSchemaJSON = {\n blocks?: FieldSchemaJSON // TODO: conditionally add based on `type`\n fields?: FieldSchemaJSON // TODO: conditionally add based on `type`\n hasMany?: boolean // TODO: conditionally add based on `type`\n name: string\n relationTo?: string // TODO: conditionally add based on `type`\n slug?: string // TODO: conditionally add based on `type`\n type: keyof FieldTypes\n}[]\n\nexport const fieldSchemaToJSON = (fields: ClientFieldConfig[]): FieldSchemaJSON => {\n return fields.reduce((acc, field) => {\n let result = acc\n\n switch (field.type) {\n case 'group':\n acc.push({\n // @ts-expect-error\n name: field.name,\n type: field.type,\n // @ts-expect-error\n fields: fieldSchemaToJSON(field.fields),\n })\n\n break\n\n case 'array':\n acc.push({\n // @ts-expect-error\n name: field.name,\n type: field.type,\n fields: fieldSchemaToJSON([\n // @ts-expect-error\n ...field.fields,\n {\n name: 'id',\n type: 'text',\n },\n ]),\n })\n\n break\n\n case 'blocks':\n acc.push({\n // @ts-expect-error\n name: field.name,\n type: field.type,\n // @ts-expect-error\n blocks: field.blocks.reduce((acc, block) => {\n acc[block.slug] = {\n fields: fieldSchemaToJSON([\n ...block.fields,\n {\n name: 'id',\n type: 'text',\n },\n ]),\n }\n\n return acc\n }, {}),\n })\n\n break\n\n case 'row':\n case 'collapsible':\n // @ts-expect-error\n result = result.concat(fieldSchemaToJSON(field.fields))\n break\n\n case 'tabs': {\n let tabFields = []\n\n // @ts-expect-error\n field.tabs.forEach((tab) => {\n if ('name' in tab) {\n tabFields.push({\n name: tab.name,\n type: field.type,\n fields: fieldSchemaToJSON(tab.fields),\n })\n return\n }\n\n tabFields = tabFields.concat(fieldSchemaToJSON(tab.fields))\n })\n\n result = result.concat(tabFields)\n\n break\n }\n\n case 'relationship':\n case 'upload':\n acc.push({\n // @ts-expect-error\n name: field.name,\n type: field.type,\n hasMany: 'hasMany' in field ? Boolean(field.hasMany) : false, // TODO: type this\n // @ts-expect-error\n relationTo: field.relationTo,\n })\n\n break\n\n default:\n if ('name' in field) {\n acc.push({\n name: field.name,\n type: field.type,\n })\n }\n }\n\n return result\n }, [])\n}\n"],"names":["fieldSchemaToJSON","fields","reduce","acc","field","result","type","push","name","blocks","block","slug","concat","tabFields","tabs","forEach","tab","hasMany","Boolean","relationTo"],"
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/fieldSchemaToJSON.ts"],"sourcesContent":["import type { FieldTypes } from '../admin/forms/FieldTypes.js'\nimport type { ClientFieldConfig } from '../fields/config/client.js'\n\nexport type FieldSchemaJSON = {\n blocks?: FieldSchemaJSON // TODO: conditionally add based on `type`\n fields?: FieldSchemaJSON // TODO: conditionally add based on `type`\n hasMany?: boolean // TODO: conditionally add based on `type`\n name: string\n relationTo?: string // TODO: conditionally add based on `type`\n slug?: string // TODO: conditionally add based on `type`\n type: keyof FieldTypes\n}[]\n\nexport const fieldSchemaToJSON = (fields: ClientFieldConfig[]): FieldSchemaJSON => {\n return fields.reduce((acc, field) => {\n let result = acc\n\n switch (field.type) {\n case 'group':\n acc.push({\n // @ts-expect-error\n name: field.name,\n type: field.type,\n // @ts-expect-error\n fields: fieldSchemaToJSON(field.fields),\n })\n\n break\n\n case 'array':\n acc.push({\n // @ts-expect-error\n name: field.name,\n type: field.type,\n fields: fieldSchemaToJSON([\n // @ts-expect-error\n ...field.fields,\n {\n name: 'id',\n type: 'text',\n },\n ]),\n })\n\n break\n\n case 'blocks':\n acc.push({\n // @ts-expect-error\n name: field.name,\n type: field.type,\n // @ts-expect-error\n blocks: field.blocks.reduce((acc, block) => {\n acc[block.slug] = {\n fields: fieldSchemaToJSON([\n ...block.fields,\n {\n name: 'id',\n type: 'text',\n },\n ]),\n }\n\n return acc\n }, {}),\n })\n\n break\n\n case 'row':\n case 'collapsible':\n // @ts-expect-error\n result = result.concat(fieldSchemaToJSON(field.fields))\n break\n\n case 'tabs': {\n let tabFields = []\n\n // @ts-expect-error\n field.tabs.forEach((tab) => {\n if ('name' in tab) {\n tabFields.push({\n name: tab.name,\n type: field.type,\n fields: fieldSchemaToJSON(tab.fields),\n })\n return\n }\n\n tabFields = tabFields.concat(fieldSchemaToJSON(tab.fields))\n })\n\n result = result.concat(tabFields)\n\n break\n }\n\n case 'relationship':\n case 'upload':\n acc.push({\n // @ts-expect-error\n name: field.name,\n type: field.type,\n hasMany: 'hasMany' in field ? Boolean(field.hasMany) : false, // TODO: type this\n // @ts-expect-error\n relationTo: field.relationTo,\n })\n\n break\n\n default:\n if ('name' in field) {\n acc.push({\n name: field.name,\n type: field.type,\n })\n }\n }\n\n return result\n }, [])\n}\n"],"names":["fieldSchemaToJSON","fields","reduce","acc","field","result","type","push","name","blocks","block","slug","concat","tabFields","tabs","forEach","tab","hasMany","Boolean","relationTo"],"mappings":"AAaA,OAAO,MAAMA,oBAAoB,CAACC;IAChC,OAAOA,OAAOC,MAAM,CAAC,CAACC,KAAKC;QACzB,IAAIC,SAASF;QAEb,OAAQC,MAAME,IAAI;YAChB,KAAK;gBACHH,IAAII,IAAI,CAAC;oBACP,mBAAmB;oBACnBC,MAAMJ,MAAMI,IAAI;oBAChBF,MAAMF,MAAME,IAAI;oBAChB,mBAAmB;oBACnBL,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;oBAChBF,MAAMF,MAAME,IAAI;oBAChBW,SAAS,aAAab,QAAQc,QAAQd,MAAMa,OAAO,IAAI;oBACvD,mBAAmB;oBACnBE,YAAYf,MAAMe,UAAU;gBAC9B;gBAEA;YAEF;gBACE,IAAI,UAAUf,OAAO;oBACnBD,IAAII,IAAI,CAAC;wBACPC,MAAMJ,MAAMI,IAAI;wBAChBF,MAAMF,MAAME,IAAI;oBAClB;gBACF;QACJ;QAEA,OAAOD;IACT,GAAG,EAAE;AACP,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/flattenTopLevelFields.ts"],"sourcesContent":["import type { ClientFieldConfig } from '../fields/config/client.js'\nimport type { Field, FieldAffectingData, FieldPresentationalOnly } from '../fields/config/types.js'\n\nimport {\n fieldAffectsData,\n fieldHasSubFields,\n fieldIsPresentationalOnly,\n tabHasName,\n} from '../fields/config/types.js'\n\n/**\n * Flattens a collection's fields into a single array of fields, as long\n * as the fields do not affect data.\n *\n * @param fields\n * @param keepPresentationalFields if true, will skip flattening fields that are presentational only\n */\nconst flattenFields = (\n fields: (ClientFieldConfig | Field)[],\n keepPresentationalFields?: boolean,\n): (FieldAffectingData | FieldPresentationalOnly)[] => {\n return fields.reduce((fieldsToUse, field) => {\n if (fieldAffectsData(field) || (keepPresentationalFields && fieldIsPresentationalOnly(field))) {\n return [...fieldsToUse, field]\n }\n\n if (fieldHasSubFields(field)) {\n return [...fieldsToUse, ...flattenFields(field.fields, keepPresentationalFields)]\n }\n\n if (field.type === 'tabs' && 'tabs' in field) {\n return [\n ...fieldsToUse,\n ...field.tabs.reduce((tabFields, tab) => {\n return [\n ...tabFields,\n ...(tabHasName(tab)\n ? [{ ...tab, type: 'tab' }]\n : flattenFields(tab.fields, keepPresentationalFields)),\n ]\n }, []),\n ]\n }\n\n return fieldsToUse\n }, [])\n}\n\nexport default flattenFields\n"],"names":["fieldAffectsData","fieldHasSubFields","fieldIsPresentationalOnly","tabHasName","flattenFields","fields","keepPresentationalFields","reduce","fieldsToUse","field","type","tabs","tabFields","tab"],"
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/flattenTopLevelFields.ts"],"sourcesContent":["import type { ClientFieldConfig } from '../fields/config/client.js'\nimport type { Field, FieldAffectingData, FieldPresentationalOnly } from '../fields/config/types.js'\n\nimport {\n fieldAffectsData,\n fieldHasSubFields,\n fieldIsPresentationalOnly,\n tabHasName,\n} from '../fields/config/types.js'\n\n/**\n * Flattens a collection's fields into a single array of fields, as long\n * as the fields do not affect data.\n *\n * @param fields\n * @param keepPresentationalFields if true, will skip flattening fields that are presentational only\n */\nconst flattenFields = (\n fields: (ClientFieldConfig | Field)[],\n keepPresentationalFields?: boolean,\n): (FieldAffectingData | FieldPresentationalOnly)[] => {\n return fields.reduce((fieldsToUse, field) => {\n if (fieldAffectsData(field) || (keepPresentationalFields && fieldIsPresentationalOnly(field))) {\n return [...fieldsToUse, field]\n }\n\n if (fieldHasSubFields(field)) {\n return [...fieldsToUse, ...flattenFields(field.fields, keepPresentationalFields)]\n }\n\n if (field.type === 'tabs' && 'tabs' in field) {\n return [\n ...fieldsToUse,\n ...field.tabs.reduce((tabFields, tab) => {\n return [\n ...tabFields,\n ...(tabHasName(tab)\n ? [{ ...tab, type: 'tab' }]\n : flattenFields(tab.fields, keepPresentationalFields)),\n ]\n }, []),\n ]\n }\n\n return fieldsToUse\n }, [])\n}\n\nexport default flattenFields\n"],"names":["fieldAffectsData","fieldHasSubFields","fieldIsPresentationalOnly","tabHasName","flattenFields","fields","keepPresentationalFields","reduce","fieldsToUse","field","type","tabs","tabFields","tab"],"mappings":"AAGA,SACEA,gBAAgB,EAChBC,iBAAiB,EACjBC,yBAAyB,EACzBC,UAAU,QACL,4BAA2B;AAElC;;;;;;CAMC,GACD,MAAMC,gBAAgB,CACpBC,QACAC;IAEA,OAAOD,OAAOE,MAAM,CAAC,CAACC,aAAaC;QACjC,IAAIT,iBAAiBS,UAAWH,4BAA4BJ,0BAA0BO,QAAS;YAC7F,OAAO;mBAAID;gBAAaC;aAAM;QAChC;QAEA,IAAIR,kBAAkBQ,QAAQ;YAC5B,OAAO;mBAAID;mBAAgBJ,cAAcK,MAAMJ,MAAM,EAAEC;aAA0B;QACnF;QAEA,IAAIG,MAAMC,IAAI,KAAK,UAAU,UAAUD,OAAO;YAC5C,OAAO;mBACFD;mBACAC,MAAME,IAAI,CAACJ,MAAM,CAAC,CAACK,WAAWC;oBAC/B,OAAO;2BACFD;2BACCT,WAAWU,OACX;4BAAC;gCAAE,GAAGA,GAAG;gCAAEH,MAAM;4BAAM;yBAAE,GACzBN,cAAcS,IAAIR,MAAM,EAAEC;qBAC/B;gBACH,GAAG,EAAE;aACN;QACH;QAEA,OAAOE;IACT,GAAG,EAAE;AACP;AAEA,eAAeJ,cAAa"}
|