payload 3.68.2 → 3.68.4
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/exports/shared.d.ts +1 -0
- package/dist/exports/shared.d.ts.map +1 -1
- package/dist/exports/shared.js +1 -0
- package/dist/exports/shared.js.map +1 -1
- package/dist/fields/hooks/afterChange/promise.d.ts.map +1 -1
- package/dist/fields/hooks/afterChange/promise.js +3 -2
- package/dist/fields/hooks/afterChange/promise.js.map +1 -1
- package/dist/utilities/formatApiURL.d.ts +9 -0
- package/dist/utilities/formatApiURL.d.ts.map +1 -0
- package/dist/utilities/formatApiURL.js +11 -0
- package/dist/utilities/formatApiURL.js.map +1 -0
- package/package.json +2 -2
package/dist/exports/shared.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export { extractID } from '../utilities/extractID.js';
|
|
|
25
25
|
export { flattenAllFields } from '../utilities/flattenAllFields.js';
|
|
26
26
|
export { flattenTopLevelFields } from '../utilities/flattenTopLevelFields.js';
|
|
27
27
|
export { formatAdminURL } from '../utilities/formatAdminURL.js';
|
|
28
|
+
export { formatApiURL } from '../utilities/formatApiURL.js';
|
|
28
29
|
export { formatLabels, toWords } from '../utilities/formatLabels.js';
|
|
29
30
|
export { getBestFitFromSizes } from '../utilities/getBestFitFromSizes.js';
|
|
30
31
|
export { getDataByPath } from '../utilities/getDataByPath.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/exports/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,4BAA4B,EAC5B,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,GACb,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wDAA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AAgC,GACjC,MAAM,kCAAkC,CAAA;AAEzC,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,yCAAyC,CAAA;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAA;AAE3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AAEnF,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAEzD,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,GAC/B,MAAM,4CAA4C,CAAA;AAEnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AAEzE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA"}
|
package/dist/exports/shared.js
CHANGED
|
@@ -23,6 +23,7 @@ export { extractID } from '../utilities/extractID.js';
|
|
|
23
23
|
export { flattenAllFields } from '../utilities/flattenAllFields.js';
|
|
24
24
|
export { flattenTopLevelFields } from '../utilities/flattenTopLevelFields.js';
|
|
25
25
|
export { formatAdminURL } from '../utilities/formatAdminURL.js';
|
|
26
|
+
export { formatApiURL } from '../utilities/formatApiURL.js';
|
|
26
27
|
export { formatLabels, toWords } from '../utilities/formatLabels.js';
|
|
27
28
|
export { getBestFitFromSizes } from '../utilities/getBestFitFromSizes.js';
|
|
28
29
|
export { getDataByPath } from '../utilities/getDataByPath.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/shared.ts"],"sourcesContent":["export {\n generateCookie,\n generateExpiredPayloadCookie,\n generatePayloadCookie,\n getCookieExpiration,\n parseCookies,\n} from '../auth/cookies.js'\nexport { getLoginOptions } from '../auth/getLoginOptions.js'\nexport { addSessionToUser, removeExpiredSessions } from '../auth/sessions.js'\nexport { getFromImportMap } from '../bin/generateImportMap/utilities/getFromImportMap.js'\nexport { parsePayloadComponent } from '../bin/generateImportMap/utilities/parsePayloadComponent.js'\nexport { defaults as collectionDefaults } from '../collections/config/defaults.js'\n\nexport { serverProps } from '../config/types.js'\n\nexport { type Slugify } from '../fields/baseFields/slug/index.js'\n\nexport { defaultTimezones } from '../fields/baseFields/timezone/defaultTimezones.js'\n\nexport {\n fieldAffectsData,\n fieldHasMaxDepth,\n fieldHasSubFields,\n fieldIsArrayType,\n fieldIsBlockType,\n fieldIsGroupType,\n fieldIsHiddenOrDisabled,\n fieldIsID,\n fieldIsLocalized,\n fieldIsPresentationalOnly,\n fieldIsSidebar,\n fieldIsVirtual,\n fieldShouldBeLocalized,\n fieldSupportsMany,\n groupHasName,\n optionIsObject,\n optionIsValue,\n optionsAreObjects,\n tabHasName,\n valueIsValueWithRelation,\n} from '../fields/config/types.js'\n\nexport { getFieldPaths } from '../fields/getFieldPaths.js'\nexport * from '../fields/validations.js'\n\nexport type {\n FolderBreadcrumb,\n FolderDocumentItemKey,\n FolderEnabledColection,\n FolderInterface,\n FolderOrDocument,\n GetFolderDataResult,\n Subfolder,\n} from '../folders/types.js'\n\nexport { buildFolderWhereConstraints } from '../folders/utils/buildFolderWhereConstraints.js'\nexport { formatFolderOrDocumentItem } from '../folders/utils/formatFolderOrDocumentItem.js'\nexport { validOperators, validOperatorSet } from '../types/constants.js'\n\nexport { formatFilesize } from '../uploads/formatFilesize.js'\n\nexport { isImage } from '../uploads/isImage.js'\nexport { appendUploadSelectFields } from '../utilities/appendUploadSelectFields.js'\nexport { applyLocaleFiltering } from '../utilities/applyLocaleFiltering.js'\nexport { combineWhereConstraints } from '../utilities/combineWhereConstraints.js'\n\nexport {\n deepCopyObject,\n deepCopyObjectComplex,\n deepCopyObjectSimple,\n deepCopyObjectSimpleWithoutReactComponents,\n} from '../utilities/deepCopyObject.js'\n\nexport {\n deepMerge,\n deepMergeWithCombinedArrays,\n deepMergeWithReactComponents,\n deepMergeWithSourceArrays,\n} from '../utilities/deepMerge.js'\nexport { extractID } from '../utilities/extractID.js'\n\nexport { flattenAllFields } from '../utilities/flattenAllFields.js'\n\nexport { flattenTopLevelFields } from '../utilities/flattenTopLevelFields.js'\nexport { formatAdminURL } from '../utilities/formatAdminURL.js'\nexport { formatLabels, toWords } from '../utilities/formatLabels.js'\nexport { getBestFitFromSizes } from '../utilities/getBestFitFromSizes.js'\n\nexport { getDataByPath } from '../utilities/getDataByPath.js'\nexport { getFieldPermissions } from '../utilities/getFieldPermissions.js'\nexport { getObjectDotNotation } from '../utilities/getObjectDotNotation.js'\nexport { getSafeRedirect } from '../utilities/getSafeRedirect.js'\n\nexport { getSelectMode } from '../utilities/getSelectMode.js'\n\nexport { getSiblingData } from '../utilities/getSiblingData.js'\n\nexport { getUniqueListBy } from '../utilities/getUniqueListBy.js'\n\nexport {\n getAutosaveInterval,\n getVersionsMax,\n hasAutosaveEnabled,\n hasDraftsEnabled,\n hasDraftValidationEnabled,\n hasScheduledPublishEnabled,\n} from '../utilities/getVersionsConfig.js'\n\nexport { isNextBuild } from '../utilities/isNextBuild.js'\n\nexport { isNumber } from '../utilities/isNumber.js'\n\nexport { isPlainObject } from '../utilities/isPlainObject.js'\n\nexport {\n isReactClientComponent,\n isReactComponentOrFunction,\n isReactServerComponentOrFunction,\n} from '../utilities/isReactComponent.js'\n\nexport {\n hoistQueryParamsToAnd,\n mergeListSearchAndWhere,\n} from '../utilities/mergeListSearchAndWhere.js'\n\nexport { reduceFieldsToValues } from '../utilities/reduceFieldsToValues.js'\n\nexport { sanitizeUserDataForEmail } from '../utilities/sanitizeUserDataForEmail.js'\n\nexport { setsAreEqual } from '../utilities/setsAreEqual.js'\n\nexport { slugify } from '../utilities/slugify.js'\n\nexport { toKebabCase } from '../utilities/toKebabCase.js'\n\nexport {\n transformColumnsToPreferences,\n transformColumnsToSearchParams,\n} from '../utilities/transformColumnPreferences.js'\n\nexport { transformWhereQuery } from '../utilities/transformWhereQuery.js'\n\nexport { unflatten } from '../utilities/unflatten.js'\nexport { validateMimeType } from '../utilities/validateMimeType.js'\nexport { validateWhereQuery } from '../utilities/validateWhereQuery.js'\nexport { wait } from '../utilities/wait.js'\nexport { wordBoundariesRegex } from '../utilities/wordBoundariesRegex.js'\nexport { versionDefaults } from '../versions/defaults.js'\n\nexport { deepMergeSimple } from '@payloadcms/translations/utilities'\n"],"names":["generateCookie","generateExpiredPayloadCookie","generatePayloadCookie","getCookieExpiration","parseCookies","getLoginOptions","addSessionToUser","removeExpiredSessions","getFromImportMap","parsePayloadComponent","defaults","collectionDefaults","serverProps","defaultTimezones","fieldAffectsData","fieldHasMaxDepth","fieldHasSubFields","fieldIsArrayType","fieldIsBlockType","fieldIsGroupType","fieldIsHiddenOrDisabled","fieldIsID","fieldIsLocalized","fieldIsPresentationalOnly","fieldIsSidebar","fieldIsVirtual","fieldShouldBeLocalized","fieldSupportsMany","groupHasName","optionIsObject","optionIsValue","optionsAreObjects","tabHasName","valueIsValueWithRelation","getFieldPaths","buildFolderWhereConstraints","formatFolderOrDocumentItem","validOperators","validOperatorSet","formatFilesize","isImage","appendUploadSelectFields","applyLocaleFiltering","combineWhereConstraints","deepCopyObject","deepCopyObjectComplex","deepCopyObjectSimple","deepCopyObjectSimpleWithoutReactComponents","deepMerge","deepMergeWithCombinedArrays","deepMergeWithReactComponents","deepMergeWithSourceArrays","extractID","flattenAllFields","flattenTopLevelFields","formatAdminURL","formatLabels","toWords","getBestFitFromSizes","getDataByPath","getFieldPermissions","getObjectDotNotation","getSafeRedirect","getSelectMode","getSiblingData","getUniqueListBy","getAutosaveInterval","getVersionsMax","hasAutosaveEnabled","hasDraftsEnabled","hasDraftValidationEnabled","hasScheduledPublishEnabled","isNextBuild","isNumber","isPlainObject","isReactClientComponent","isReactComponentOrFunction","isReactServerComponentOrFunction","hoistQueryParamsToAnd","mergeListSearchAndWhere","reduceFieldsToValues","sanitizeUserDataForEmail","setsAreEqual","slugify","toKebabCase","transformColumnsToPreferences","transformColumnsToSearchParams","transformWhereQuery","unflatten","validateMimeType","validateWhereQuery","wait","wordBoundariesRegex","versionDefaults","deepMergeSimple"],"mappings":"AAAA,SACEA,cAAc,EACdC,4BAA4B,EAC5BC,qBAAqB,EACrBC,mBAAmB,EACnBC,YAAY,QACP,qBAAoB;AAC3B,SAASC,eAAe,QAAQ,6BAA4B;AAC5D,SAASC,gBAAgB,EAAEC,qBAAqB,QAAQ,sBAAqB;AAC7E,SAASC,gBAAgB,QAAQ,yDAAwD;AACzF,SAASC,qBAAqB,QAAQ,8DAA6D;AACnG,SAASC,YAAYC,kBAAkB,QAAQ,oCAAmC;AAElF,SAASC,WAAW,QAAQ,qBAAoB;AAIhD,SAASC,gBAAgB,QAAQ,oDAAmD;AAEpF,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,gBAAgB,EAChBC,gBAAgB,EAChBC,gBAAgB,EAChBC,uBAAuB,EACvBC,SAAS,EACTC,gBAAgB,EAChBC,yBAAyB,EACzBC,cAAc,EACdC,cAAc,EACdC,sBAAsB,EACtBC,iBAAiB,EACjBC,YAAY,EACZC,cAAc,EACdC,aAAa,EACbC,iBAAiB,EACjBC,UAAU,EACVC,wBAAwB,QACnB,4BAA2B;AAElC,SAASC,aAAa,QAAQ,6BAA4B;AAC1D,cAAc,2BAA0B;AAYxC,SAASC,2BAA2B,QAAQ,kDAAiD;AAC7F,SAASC,0BAA0B,QAAQ,iDAAgD;AAC3F,SAASC,cAAc,EAAEC,gBAAgB,QAAQ,wBAAuB;AAExE,S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,YAAY,QAAQ,+BAA8B;AAE3D,SAASC,OAAO,QAAQ,0BAAyB;AAEjD,SAASC,WAAW,QAAQ,8BAA6B;AAEzD,SACEC,6BAA6B,EAC7BC,8BAA8B,QACzB,6CAA4C;AAEnD,SAASC,mBAAmB,QAAQ,sCAAqC;AAEzE,SAASC,SAAS,QAAQ,4BAA2B;AACrD,SAASC,gBAAgB,QAAQ,mCAAkC;AACnE,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,IAAI,QAAQ,uBAAsB;AAC3C,SAASC,mBAAmB,QAAQ,sCAAqC;AACzE,SAASC,eAAe,QAAQ,0BAAyB;AAEzD,SAASC,eAAe,QAAQ,qCAAoC"}
|
|
1
|
+
{"version":3,"sources":["../../src/exports/shared.ts"],"sourcesContent":["export {\n generateCookie,\n generateExpiredPayloadCookie,\n generatePayloadCookie,\n getCookieExpiration,\n parseCookies,\n} from '../auth/cookies.js'\nexport { getLoginOptions } from '../auth/getLoginOptions.js'\nexport { addSessionToUser, removeExpiredSessions } from '../auth/sessions.js'\nexport { getFromImportMap } from '../bin/generateImportMap/utilities/getFromImportMap.js'\nexport { parsePayloadComponent } from '../bin/generateImportMap/utilities/parsePayloadComponent.js'\nexport { defaults as collectionDefaults } from '../collections/config/defaults.js'\n\nexport { serverProps } from '../config/types.js'\n\nexport { type Slugify } from '../fields/baseFields/slug/index.js'\n\nexport { defaultTimezones } from '../fields/baseFields/timezone/defaultTimezones.js'\n\nexport {\n fieldAffectsData,\n fieldHasMaxDepth,\n fieldHasSubFields,\n fieldIsArrayType,\n fieldIsBlockType,\n fieldIsGroupType,\n fieldIsHiddenOrDisabled,\n fieldIsID,\n fieldIsLocalized,\n fieldIsPresentationalOnly,\n fieldIsSidebar,\n fieldIsVirtual,\n fieldShouldBeLocalized,\n fieldSupportsMany,\n groupHasName,\n optionIsObject,\n optionIsValue,\n optionsAreObjects,\n tabHasName,\n valueIsValueWithRelation,\n} from '../fields/config/types.js'\n\nexport { getFieldPaths } from '../fields/getFieldPaths.js'\nexport * from '../fields/validations.js'\n\nexport type {\n FolderBreadcrumb,\n FolderDocumentItemKey,\n FolderEnabledColection,\n FolderInterface,\n FolderOrDocument,\n GetFolderDataResult,\n Subfolder,\n} from '../folders/types.js'\n\nexport { buildFolderWhereConstraints } from '../folders/utils/buildFolderWhereConstraints.js'\nexport { formatFolderOrDocumentItem } from '../folders/utils/formatFolderOrDocumentItem.js'\nexport { validOperators, validOperatorSet } from '../types/constants.js'\n\nexport { formatFilesize } from '../uploads/formatFilesize.js'\n\nexport { isImage } from '../uploads/isImage.js'\nexport { appendUploadSelectFields } from '../utilities/appendUploadSelectFields.js'\nexport { applyLocaleFiltering } from '../utilities/applyLocaleFiltering.js'\nexport { combineWhereConstraints } from '../utilities/combineWhereConstraints.js'\n\nexport {\n deepCopyObject,\n deepCopyObjectComplex,\n deepCopyObjectSimple,\n deepCopyObjectSimpleWithoutReactComponents,\n} from '../utilities/deepCopyObject.js'\n\nexport {\n deepMerge,\n deepMergeWithCombinedArrays,\n deepMergeWithReactComponents,\n deepMergeWithSourceArrays,\n} from '../utilities/deepMerge.js'\nexport { extractID } from '../utilities/extractID.js'\n\nexport { flattenAllFields } from '../utilities/flattenAllFields.js'\n\nexport { flattenTopLevelFields } from '../utilities/flattenTopLevelFields.js'\nexport { formatAdminURL } from '../utilities/formatAdminURL.js'\nexport { formatApiURL } from '../utilities/formatApiURL.js'\nexport { formatLabels, toWords } from '../utilities/formatLabels.js'\nexport { getBestFitFromSizes } from '../utilities/getBestFitFromSizes.js'\n\nexport { getDataByPath } from '../utilities/getDataByPath.js'\nexport { getFieldPermissions } from '../utilities/getFieldPermissions.js'\nexport { getObjectDotNotation } from '../utilities/getObjectDotNotation.js'\nexport { getSafeRedirect } from '../utilities/getSafeRedirect.js'\n\nexport { getSelectMode } from '../utilities/getSelectMode.js'\n\nexport { getSiblingData } from '../utilities/getSiblingData.js'\n\nexport { getUniqueListBy } from '../utilities/getUniqueListBy.js'\n\nexport {\n getAutosaveInterval,\n getVersionsMax,\n hasAutosaveEnabled,\n hasDraftsEnabled,\n hasDraftValidationEnabled,\n hasScheduledPublishEnabled,\n} from '../utilities/getVersionsConfig.js'\n\nexport { isNextBuild } from '../utilities/isNextBuild.js'\n\nexport { isNumber } from '../utilities/isNumber.js'\n\nexport { isPlainObject } from '../utilities/isPlainObject.js'\n\nexport {\n isReactClientComponent,\n isReactComponentOrFunction,\n isReactServerComponentOrFunction,\n} from '../utilities/isReactComponent.js'\n\nexport {\n hoistQueryParamsToAnd,\n mergeListSearchAndWhere,\n} from '../utilities/mergeListSearchAndWhere.js'\n\nexport { reduceFieldsToValues } from '../utilities/reduceFieldsToValues.js'\n\nexport { sanitizeUserDataForEmail } from '../utilities/sanitizeUserDataForEmail.js'\n\nexport { setsAreEqual } from '../utilities/setsAreEqual.js'\n\nexport { slugify } from '../utilities/slugify.js'\n\nexport { toKebabCase } from '../utilities/toKebabCase.js'\n\nexport {\n transformColumnsToPreferences,\n transformColumnsToSearchParams,\n} from '../utilities/transformColumnPreferences.js'\n\nexport { transformWhereQuery } from '../utilities/transformWhereQuery.js'\n\nexport { unflatten } from '../utilities/unflatten.js'\nexport { validateMimeType } from '../utilities/validateMimeType.js'\nexport { validateWhereQuery } from '../utilities/validateWhereQuery.js'\nexport { wait } from '../utilities/wait.js'\nexport { wordBoundariesRegex } from '../utilities/wordBoundariesRegex.js'\nexport { versionDefaults } from '../versions/defaults.js'\n\nexport { deepMergeSimple } from '@payloadcms/translations/utilities'\n"],"names":["generateCookie","generateExpiredPayloadCookie","generatePayloadCookie","getCookieExpiration","parseCookies","getLoginOptions","addSessionToUser","removeExpiredSessions","getFromImportMap","parsePayloadComponent","defaults","collectionDefaults","serverProps","defaultTimezones","fieldAffectsData","fieldHasMaxDepth","fieldHasSubFields","fieldIsArrayType","fieldIsBlockType","fieldIsGroupType","fieldIsHiddenOrDisabled","fieldIsID","fieldIsLocalized","fieldIsPresentationalOnly","fieldIsSidebar","fieldIsVirtual","fieldShouldBeLocalized","fieldSupportsMany","groupHasName","optionIsObject","optionIsValue","optionsAreObjects","tabHasName","valueIsValueWithRelation","getFieldPaths","buildFolderWhereConstraints","formatFolderOrDocumentItem","validOperators","validOperatorSet","formatFilesize","isImage","appendUploadSelectFields","applyLocaleFiltering","combineWhereConstraints","deepCopyObject","deepCopyObjectComplex","deepCopyObjectSimple","deepCopyObjectSimpleWithoutReactComponents","deepMerge","deepMergeWithCombinedArrays","deepMergeWithReactComponents","deepMergeWithSourceArrays","extractID","flattenAllFields","flattenTopLevelFields","formatAdminURL","formatApiURL","formatLabels","toWords","getBestFitFromSizes","getDataByPath","getFieldPermissions","getObjectDotNotation","getSafeRedirect","getSelectMode","getSiblingData","getUniqueListBy","getAutosaveInterval","getVersionsMax","hasAutosaveEnabled","hasDraftsEnabled","hasDraftValidationEnabled","hasScheduledPublishEnabled","isNextBuild","isNumber","isPlainObject","isReactClientComponent","isReactComponentOrFunction","isReactServerComponentOrFunction","hoistQueryParamsToAnd","mergeListSearchAndWhere","reduceFieldsToValues","sanitizeUserDataForEmail","setsAreEqual","slugify","toKebabCase","transformColumnsToPreferences","transformColumnsToSearchParams","transformWhereQuery","unflatten","validateMimeType","validateWhereQuery","wait","wordBoundariesRegex","versionDefaults","deepMergeSimple"],"mappings":"AAAA,SACEA,cAAc,EACdC,4BAA4B,EAC5BC,qBAAqB,EACrBC,mBAAmB,EACnBC,YAAY,QACP,qBAAoB;AAC3B,SAASC,eAAe,QAAQ,6BAA4B;AAC5D,SAASC,gBAAgB,EAAEC,qBAAqB,QAAQ,sBAAqB;AAC7E,SAASC,gBAAgB,QAAQ,yDAAwD;AACzF,SAASC,qBAAqB,QAAQ,8DAA6D;AACnG,SAASC,YAAYC,kBAAkB,QAAQ,oCAAmC;AAElF,SAASC,WAAW,QAAQ,qBAAoB;AAIhD,SAASC,gBAAgB,QAAQ,oDAAmD;AAEpF,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,gBAAgB,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K,EAAS,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAOrE,KAAK,IAAI,GAAG;IACV;;OAEG;IACH,SAAS,CAAC,EAAE,UAAU,CAAA;IACtB,UAAU,EAAE,IAAI,GAAG,yBAAyB,CAAA;IAC5C,OAAO,EAAE,cAAc,CAAA;IACvB,IAAI,EAAE,UAAU,CAAA;IAChB,GAAG,EAAE,UAAU,CAAA;IACf,KAAK,EAAE,KAAK,GAAG,UAAU,CAAA;IACzB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,IAAI,GAAG,qBAAqB,CAAA;IACpC,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC9B,eAAe,EAAE,MAAM,CAAA;IACvB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,MAAM,CAAA;IACxB,WAAW,EAAE,UAAU,CAAA;IACvB,kBAAkB,EAAE,UAAU,CAAA;IAC9B,GAAG,EAAE,cAAc,CAAA;IACnB,WAAW,EAAE,UAAU,CAAA;IACvB,UAAU,EAAE,UAAU,CAAA;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,GAAG,UAAU,CAAC,EAAE,CAAA;CACvC,CAAA;AAKD,eAAO,MAAM,OAAO,yOAoBjB,IAAI,KAAG,OAAO,CAAC,IAAI,CAsTrB,CAAA"}
|
|
@@ -16,6 +16,7 @@ export const promise = async ({ blockData, collection, context, data, doc, field
|
|
|
16
16
|
const schemaPathSegments = schemaPath ? schemaPath.split('.') : [];
|
|
17
17
|
const indexPathSegments = indexPath ? indexPath.split('-').filter(Boolean)?.map(Number) : [];
|
|
18
18
|
const getNestedValue = (data, path)=>path.reduce((acc, key)=>acc && acc[key] !== undefined ? acc[key] : undefined, data);
|
|
19
|
+
const previousValData = previousSiblingDoc && Object.keys(previousSiblingDoc).length > 0 ? previousSiblingDoc : previousDoc;
|
|
19
20
|
if (fieldAffectsData(field)) {
|
|
20
21
|
// Execute hooks
|
|
21
22
|
if ('hooks' in field && field.hooks?.afterChange) {
|
|
@@ -33,7 +34,7 @@ export const promise = async ({ blockData, collection, context, data, doc, field
|
|
|
33
34
|
path: pathSegments,
|
|
34
35
|
previousDoc,
|
|
35
36
|
previousSiblingDoc,
|
|
36
|
-
previousValue: getNestedValue(
|
|
37
|
+
previousValue: getNestedValue(previousValData, pathSegments) ?? previousValData?.[field.name],
|
|
37
38
|
req,
|
|
38
39
|
schemaPath: schemaPathSegments,
|
|
39
40
|
siblingData,
|
|
@@ -103,7 +104,7 @@ export const promise = async ({ blockData, collection, context, data, doc, field
|
|
|
103
104
|
parentPath: path + '.' + rowIndex,
|
|
104
105
|
parentSchemaPath: schemaPath + '.' + block.slug,
|
|
105
106
|
previousDoc,
|
|
106
|
-
previousSiblingDoc:
|
|
107
|
+
previousSiblingDoc: previousValData?.[field.name]?.[rowIndex] || {},
|
|
107
108
|
req,
|
|
108
109
|
siblingData: siblingData?.[field.name]?.[rowIndex] || {},
|
|
109
110
|
siblingDoc: row ? {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/fields/hooks/afterChange/promise.ts"],"sourcesContent":["import type { RichTextAdapter } from '../../../admin/RichText.js'\nimport type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { SanitizedGlobalConfig } from '../../../globals/config/types.js'\nimport type { RequestContext } from '../../../index.js'\nimport type { JsonObject, PayloadRequest } from '../../../types/index.js'\nimport type { Block, Field, TabAsField } from '../../config/types.js'\n\nimport { MissingEditorProp } from '../../../errors/index.js'\nimport { fieldAffectsData, tabHasName } from '../../config/types.js'\nimport { getFieldPathsModified as getFieldPaths } from '../../getFieldPaths.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args = {\n /**\n * Data of the nearest parent block. If no parent block exists, this will be the `undefined`\n */\n blockData?: JsonObject\n collection: null | SanitizedCollectionConfig\n context: RequestContext\n data: JsonObject\n doc: JsonObject\n field: Field | TabAsField\n fieldIndex: number\n global: null | SanitizedGlobalConfig\n operation: 'create' | 'update'\n parentIndexPath: string\n parentIsLocalized: boolean\n parentPath: string\n parentSchemaPath: string\n previousDoc: JsonObject\n previousSiblingDoc: JsonObject\n req: PayloadRequest\n siblingData: JsonObject\n siblingDoc: JsonObject\n siblingFields?: (Field | TabAsField)[]\n}\n\n// This function is responsible for the following actions, in order:\n// - Execute field hooks\n\nexport const promise = async ({\n blockData,\n collection,\n context,\n data,\n doc,\n field,\n fieldIndex,\n global,\n operation,\n parentIndexPath,\n parentIsLocalized,\n parentPath,\n parentSchemaPath,\n previousDoc,\n previousSiblingDoc,\n req,\n siblingData,\n siblingDoc,\n siblingFields,\n}: Args): Promise<void> => {\n const { indexPath, path, schemaPath } = getFieldPaths({\n field,\n index: fieldIndex,\n parentIndexPath,\n parentPath,\n parentSchemaPath,\n })\n\n const pathSegments = path ? path.split('.') : []\n const schemaPathSegments = schemaPath ? schemaPath.split('.') : []\n const indexPathSegments = indexPath ? indexPath.split('-').filter(Boolean)?.map(Number) : []\n const getNestedValue = (data: JsonObject, path: string[]) =>\n path.reduce((acc, key) => (acc && acc[key] !== undefined ? acc[key] : undefined), data)\n\n if (fieldAffectsData(field)) {\n // Execute hooks\n if ('hooks' in field && field.hooks?.afterChange) {\n for (const hook of field.hooks.afterChange) {\n const hookedValue = await hook({\n blockData,\n collection,\n context,\n data,\n field,\n global,\n indexPath: indexPathSegments,\n operation,\n originalDoc: doc,\n path: pathSegments,\n previousDoc,\n previousSiblingDoc,\n previousValue: getNestedValue(previousDoc, pathSegments) ?? previousDoc?.[field.name],\n req,\n schemaPath: schemaPathSegments,\n siblingData,\n siblingFields: siblingFields!,\n value: getNestedValue(siblingDoc, pathSegments) ?? siblingDoc?.[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingDoc[field.name] = hookedValue\n }\n }\n }\n }\n\n // Traverse subfields\n switch (field.type) {\n case 'array': {\n const rows = siblingDoc[field.name]\n\n if (Array.isArray(rows)) {\n const promises: Promise<void>[] = []\n rows.forEach((row, rowIndex) => {\n promises.push(\n traverseFields({\n blockData,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n parentIndexPath: '',\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: path + '.' + rowIndex,\n parentSchemaPath: schemaPath,\n previousDoc,\n previousSiblingDoc: previousDoc?.[field.name]?.[rowIndex] || ({} as JsonObject),\n req,\n siblingData: siblingData?.[field.name]?.[rowIndex] || {},\n siblingDoc: row ? { ...row } : {},\n }),\n )\n })\n await Promise.all(promises)\n }\n\n break\n }\n\n case 'blocks': {\n const rows = siblingDoc[field.name]\n\n if (Array.isArray(rows)) {\n const promises: Promise<void>[] = []\n\n rows.forEach((row, rowIndex) => {\n const blockTypeToMatch = (row as JsonObject).blockType\n\n const block: Block | undefined =\n req.payload.blocks[blockTypeToMatch] ??\n ((field.blockReferences ?? field.blocks).find(\n (curBlock) => typeof curBlock !== 'string' && curBlock.slug === blockTypeToMatch,\n ) as Block | undefined)\n\n if (block) {\n promises.push(\n traverseFields({\n blockData: siblingData?.[field.name]?.[rowIndex],\n collection,\n context,\n data,\n doc,\n fields: block.fields,\n global,\n operation,\n parentIndexPath: '',\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: path + '.' + rowIndex,\n parentSchemaPath: schemaPath + '.' + block.slug,\n previousDoc,\n previousSiblingDoc: previousDoc?.[field.name]?.[rowIndex] || ({} as JsonObject),\n req,\n siblingData: siblingData?.[field.name]?.[rowIndex] || {},\n siblingDoc: row ? { ...row } : {},\n }),\n )\n }\n })\n\n await Promise.all(promises)\n }\n\n break\n }\n\n case 'collapsible':\n case 'row': {\n await traverseFields({\n blockData,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n parentIndexPath: indexPath,\n parentIsLocalized,\n parentPath,\n parentSchemaPath: schemaPath,\n previousDoc,\n previousSiblingDoc: { ...previousSiblingDoc },\n req,\n siblingData: siblingData || {},\n siblingDoc: { ...siblingDoc },\n })\n\n break\n }\n\n case 'group': {\n if (fieldAffectsData(field)) {\n await traverseFields({\n blockData,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n parentIndexPath: '',\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: path,\n parentSchemaPath: schemaPath,\n previousDoc,\n previousSiblingDoc: (previousDoc?.[field.name] as JsonObject) || {},\n req,\n siblingData: (siblingData?.[field.name] as JsonObject) || {},\n siblingDoc: (siblingDoc?.[field.name] as JsonObject) || {},\n })\n } else {\n await traverseFields({\n blockData,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n parentIndexPath: indexPath,\n parentIsLocalized,\n parentPath,\n parentSchemaPath: schemaPath,\n previousDoc,\n previousSiblingDoc: { ...previousSiblingDoc },\n req,\n siblingData: siblingData || {},\n siblingDoc: { ...siblingDoc },\n })\n }\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\n if (typeof field.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n const editor: RichTextAdapter = field.editor\n\n if (editor?.hooks?.afterChange?.length) {\n for (const hook of editor.hooks.afterChange) {\n const hookedValue = await hook({\n collection,\n context,\n data,\n field,\n global,\n indexPath: indexPathSegments,\n operation,\n originalDoc: doc,\n parentIsLocalized,\n path: pathSegments,\n previousDoc,\n previousSiblingDoc,\n previousValue: previousDoc?.[field.name],\n req,\n schemaPath: schemaPathSegments,\n siblingData,\n value: siblingDoc?.[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingDoc[field.name] = hookedValue\n }\n }\n }\n break\n }\n\n case 'tab': {\n let tabSiblingData = siblingData\n let tabSiblingDoc = siblingDoc\n let tabPreviousSiblingDoc = siblingDoc\n\n const isNamedTab = tabHasName(field)\n\n if (isNamedTab) {\n tabSiblingData = (siblingData?.[field.name] ?? {}) as JsonObject\n tabSiblingDoc = (siblingDoc?.[field.name] ?? {}) as JsonObject\n tabPreviousSiblingDoc = (previousDoc?.[field.name] ?? {}) as JsonObject\n }\n\n await traverseFields({\n blockData,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n parentIndexPath: isNamedTab ? '' : indexPath,\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: isNamedTab ? path : parentPath,\n parentSchemaPath: schemaPath,\n previousDoc,\n previousSiblingDoc: tabPreviousSiblingDoc,\n req,\n siblingData: tabSiblingData,\n siblingDoc: tabSiblingDoc,\n })\n\n break\n }\n\n case 'tabs': {\n await traverseFields({\n blockData,\n collection,\n context,\n data,\n doc,\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n global,\n operation,\n parentIndexPath: indexPath,\n parentIsLocalized,\n parentPath: path,\n parentSchemaPath: schemaPath,\n previousDoc,\n previousSiblingDoc: { ...previousSiblingDoc },\n req,\n siblingData: siblingData || {},\n siblingDoc: { ...siblingDoc },\n })\n\n break\n }\n\n default: {\n break\n }\n }\n}\n"],"names":["MissingEditorProp","fieldAffectsData","tabHasName","getFieldPathsModified","getFieldPaths","traverseFields","promise","blockData","collection","context","data","doc","field","fieldIndex","global","operation","parentIndexPath","parentIsLocalized","parentPath","parentSchemaPath","previousDoc","previousSiblingDoc","req","siblingData","siblingDoc","siblingFields","indexPath","path","schemaPath","index","pathSegments","split","schemaPathSegments","indexPathSegments","filter","Boolean","map","Number","getNestedValue","reduce","acc","key","undefined","hooks","afterChange","hook","hookedValue","originalDoc","previousValue","name","value","type","rows","Array","isArray","promises","forEach","row","rowIndex","push","fields","localized","Promise","all","blockTypeToMatch","blockType","block","payload","blocks","blockReferences","find","curBlock","slug","editor","Error","length","tabSiblingData","tabSiblingDoc","tabPreviousSiblingDoc","isNamedTab","tabs","tab"],"mappings":"AAOA,SAASA,iBAAiB,QAAQ,2BAA0B;AAC5D,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,wBAAuB;AACpE,SAASC,yBAAyBC,aA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AAE,GAAGA,kBAAkB;oBAAC;oBAC5CC;oBACAC,aAAaA,eAAe,CAAC;oBAC7BC,YAAY;wBAAE,GAAGA,UAAU;oBAAC;gBAC9B;gBAEA;YACF;QAEA;YAAS;gBACP;YACF;IACF;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/fields/hooks/afterChange/promise.ts"],"sourcesContent":["import type { RichTextAdapter } from '../../../admin/RichText.js'\nimport type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { SanitizedGlobalConfig } from '../../../globals/config/types.js'\nimport type { RequestContext } from '../../../index.js'\nimport type { JsonObject, PayloadRequest } from '../../../types/index.js'\nimport type { Block, Field, TabAsField } from '../../config/types.js'\n\nimport { MissingEditorProp } from '../../../errors/index.js'\nimport { fieldAffectsData, tabHasName } from '../../config/types.js'\nimport { getFieldPathsModified as getFieldPaths } from '../../getFieldPaths.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args = {\n /**\n * Data of the nearest parent block. If no parent block exists, this will be the `undefined`\n */\n blockData?: JsonObject\n collection: null | SanitizedCollectionConfig\n context: RequestContext\n data: JsonObject\n doc: JsonObject\n field: Field | TabAsField\n fieldIndex: number\n global: null | SanitizedGlobalConfig\n operation: 'create' | 'update'\n parentIndexPath: string\n parentIsLocalized: boolean\n parentPath: string\n parentSchemaPath: string\n previousDoc: JsonObject\n previousSiblingDoc: JsonObject\n req: PayloadRequest\n siblingData: JsonObject\n siblingDoc: JsonObject\n siblingFields?: (Field | TabAsField)[]\n}\n\n// This function is responsible for the following actions, in order:\n// - Execute field hooks\n\nexport const promise = async ({\n blockData,\n collection,\n context,\n data,\n doc,\n field,\n fieldIndex,\n global,\n operation,\n parentIndexPath,\n parentIsLocalized,\n parentPath,\n parentSchemaPath,\n previousDoc,\n previousSiblingDoc,\n req,\n siblingData,\n siblingDoc,\n siblingFields,\n}: Args): Promise<void> => {\n const { indexPath, path, schemaPath } = getFieldPaths({\n field,\n index: fieldIndex,\n parentIndexPath,\n parentPath,\n parentSchemaPath,\n })\n\n const pathSegments = path ? path.split('.') : []\n const schemaPathSegments = schemaPath ? schemaPath.split('.') : []\n const indexPathSegments = indexPath ? indexPath.split('-').filter(Boolean)?.map(Number) : []\n const getNestedValue = (data: JsonObject, path: string[]) =>\n path.reduce((acc, key) => (acc && acc[key] !== undefined ? acc[key] : undefined), data)\n const previousValData =\n previousSiblingDoc && Object.keys(previousSiblingDoc).length > 0\n ? previousSiblingDoc\n : previousDoc\n\n if (fieldAffectsData(field)) {\n // Execute hooks\n if ('hooks' in field && field.hooks?.afterChange) {\n for (const hook of field.hooks.afterChange) {\n const hookedValue = await hook({\n blockData,\n collection,\n context,\n data,\n field,\n global,\n indexPath: indexPathSegments,\n operation,\n originalDoc: doc,\n path: pathSegments,\n previousDoc,\n previousSiblingDoc,\n previousValue:\n getNestedValue(previousValData, pathSegments) ?? previousValData?.[field.name],\n req,\n schemaPath: schemaPathSegments,\n siblingData,\n siblingFields: siblingFields!,\n value: getNestedValue(siblingDoc, pathSegments) ?? siblingDoc?.[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingDoc[field.name] = hookedValue\n }\n }\n }\n }\n\n // Traverse subfields\n switch (field.type) {\n case 'array': {\n const rows = siblingDoc[field.name]\n\n if (Array.isArray(rows)) {\n const promises: Promise<void>[] = []\n rows.forEach((row, rowIndex) => {\n promises.push(\n traverseFields({\n blockData,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n parentIndexPath: '',\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: path + '.' + rowIndex,\n parentSchemaPath: schemaPath,\n previousDoc,\n previousSiblingDoc: previousDoc?.[field.name]?.[rowIndex] || ({} as JsonObject),\n req,\n siblingData: siblingData?.[field.name]?.[rowIndex] || {},\n siblingDoc: row ? { ...row } : {},\n }),\n )\n })\n await Promise.all(promises)\n }\n\n break\n }\n\n case 'blocks': {\n const rows = siblingDoc[field.name]\n\n if (Array.isArray(rows)) {\n const promises: Promise<void>[] = []\n\n rows.forEach((row, rowIndex) => {\n const blockTypeToMatch = (row as JsonObject).blockType\n\n const block: Block | undefined =\n req.payload.blocks[blockTypeToMatch] ??\n ((field.blockReferences ?? field.blocks).find(\n (curBlock) => typeof curBlock !== 'string' && curBlock.slug === blockTypeToMatch,\n ) as Block | undefined)\n\n if (block) {\n promises.push(\n traverseFields({\n blockData: siblingData?.[field.name]?.[rowIndex],\n collection,\n context,\n data,\n doc,\n fields: block.fields,\n global,\n operation,\n parentIndexPath: '',\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: path + '.' + rowIndex,\n parentSchemaPath: schemaPath + '.' + block.slug,\n previousDoc,\n previousSiblingDoc: previousValData?.[field.name]?.[rowIndex] || ({} as JsonObject),\n req,\n siblingData: siblingData?.[field.name]?.[rowIndex] || {},\n siblingDoc: row ? { ...row } : {},\n }),\n )\n }\n })\n\n await Promise.all(promises)\n }\n\n break\n }\n\n case 'collapsible':\n case 'row': {\n await traverseFields({\n blockData,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n parentIndexPath: indexPath,\n parentIsLocalized,\n parentPath,\n parentSchemaPath: schemaPath,\n previousDoc,\n previousSiblingDoc: { ...previousSiblingDoc },\n req,\n siblingData: siblingData || {},\n siblingDoc: { ...siblingDoc },\n })\n\n break\n }\n\n case 'group': {\n if (fieldAffectsData(field)) {\n await traverseFields({\n blockData,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n parentIndexPath: '',\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: path,\n parentSchemaPath: schemaPath,\n previousDoc,\n previousSiblingDoc: (previousDoc?.[field.name] as JsonObject) || {},\n req,\n siblingData: (siblingData?.[field.name] as JsonObject) || {},\n siblingDoc: (siblingDoc?.[field.name] as JsonObject) || {},\n })\n } else {\n await traverseFields({\n blockData,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n parentIndexPath: indexPath,\n parentIsLocalized,\n parentPath,\n parentSchemaPath: schemaPath,\n previousDoc,\n previousSiblingDoc: { ...previousSiblingDoc },\n req,\n siblingData: siblingData || {},\n siblingDoc: { ...siblingDoc },\n })\n }\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\n if (typeof field.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n const editor: RichTextAdapter = field.editor\n\n if (editor?.hooks?.afterChange?.length) {\n for (const hook of editor.hooks.afterChange) {\n const hookedValue = await hook({\n collection,\n context,\n data,\n field,\n global,\n indexPath: indexPathSegments,\n operation,\n originalDoc: doc,\n parentIsLocalized,\n path: pathSegments,\n previousDoc,\n previousSiblingDoc,\n previousValue: previousDoc?.[field.name],\n req,\n schemaPath: schemaPathSegments,\n siblingData,\n value: siblingDoc?.[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingDoc[field.name] = hookedValue\n }\n }\n }\n break\n }\n\n case 'tab': {\n let tabSiblingData = siblingData\n let tabSiblingDoc = siblingDoc\n let tabPreviousSiblingDoc = siblingDoc\n\n const isNamedTab = tabHasName(field)\n\n if (isNamedTab) {\n tabSiblingData = (siblingData?.[field.name] ?? {}) as JsonObject\n tabSiblingDoc = (siblingDoc?.[field.name] ?? {}) as JsonObject\n tabPreviousSiblingDoc = (previousDoc?.[field.name] ?? {}) as JsonObject\n }\n\n await traverseFields({\n blockData,\n collection,\n context,\n data,\n doc,\n fields: field.fields,\n global,\n operation,\n parentIndexPath: isNamedTab ? '' : indexPath,\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: isNamedTab ? path : parentPath,\n parentSchemaPath: schemaPath,\n previousDoc,\n previousSiblingDoc: tabPreviousSiblingDoc,\n req,\n siblingData: tabSiblingData,\n siblingDoc: tabSiblingDoc,\n })\n\n break\n }\n\n case 'tabs': {\n await traverseFields({\n blockData,\n collection,\n context,\n data,\n doc,\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n global,\n operation,\n parentIndexPath: indexPath,\n parentIsLocalized,\n parentPath: path,\n parentSchemaPath: schemaPath,\n previousDoc,\n previousSiblingDoc: { ...previousSiblingDoc },\n req,\n siblingData: siblingData || {},\n siblingDoc: { ...siblingDoc },\n })\n\n break\n }\n\n default: {\n break\n }\n }\n}\n"],"names":["MissingEditorProp","fieldAffectsData","tabHasName","getFieldPathsModified","getFieldPaths","traverseFields","promise","blockData","collection","context","data","doc","field","fieldIndex","global","operation","parentIndexPath","parentIsLocalized","parentPath","parentSchemaPath","previousDoc","previousSiblingDoc","req","siblingData","siblingDoc","siblingFields","indexPath","path","schemaPath","index","pathSegments","split","schemaPathSegments","indexPathSegments","filter","Boolean","map","Number","getNestedValue","reduce","acc","key","undefined","previousValData","Object","keys","length","hooks","afterChange","hook","hookedValue","originalDoc","previousValue","name","value","type","rows","Array","isArray","promises","forEach","row","rowIndex","push","fields","localized","Promise","all","blockTypeToMatch","blockType","block","payload","blocks","blockReferences","find","curBlock","slug","editor","Error","tabSiblingData","tabSiblingDoc","tabPreviousSiblingDoc","isNamedTab","tabs","tab"],"mappings":"AAOA,SAASA,iBAAiB,QAAQ,2BAA0B;AAC5D,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,wBAAuB;AACpE,SAASC,yBAAyBC,aAAa,QAAQ,yBAAwB;AAC/E,SAASC,cAAc,QAAQ,sBAAqB;AA2BpD,oEAAoE;AACpE,wBAAwB;AAExB,OAAO,MAAMC,UAAU,OAAO,EAC5BC,SAAS,EACTC,UAAU,EACVC,OAAO,EACPC,IAAI,EACJC,GAAG,EACHC,KAAK,EACLC,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,eAAe,EACfC,iBAAiB,EACjBC,UAAU,EACVC,gBAAgB,EAChBC,WAAW,EACXC,kBAAkB,EAClBC,GAAG,EACHC,WAAW,EACXC,UAAU,EACVC,aAAa,EACR;IACL,MAAM,EAAEC,SAAS,EAAEC,IAAI,EAAEC,UAAU,EA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D,gBAAgBxD;gBACpB,IAAIyD,wBAAwBzD;gBAE5B,MAAM0D,aAAahF,WAAWU;gBAE9B,IAAIsE,YAAY;oBACdH,iBAAkBxD,aAAa,CAACX,MAAMyC,IAAI,CAAC,IAAI,CAAC;oBAChD2B,gBAAiBxD,YAAY,CAACZ,MAAMyC,IAAI,CAAC,IAAI,CAAC;oBAC9C4B,wBAAyB7D,aAAa,CAACR,MAAMyC,IAAI,CAAC,IAAI,CAAC;gBACzD;gBAEA,MAAMhD,eAAe;oBACnBE;oBACAC;oBACAC;oBACAC;oBACAC;oBACAqD,QAAQpD,MAAMoD,MAAM;oBACpBlD;oBACAC;oBACAC,iBAAiBkE,aAAa,KAAKxD;oBACnCT,mBAAmBA,qBAAqBL,MAAMqD,SAAS;oBACvD/C,YAAYgE,aAAavD,OAAOT;oBAChCC,kBAAkBS;oBAClBR;oBACAC,oBAAoB4D;oBACpB3D;oBACAC,aAAawD;oBACbvD,YAAYwD;gBACd;gBAEA;YACF;QAEA,KAAK;YAAQ;gBACX,MAAM3E,eAAe;oBACnBE;oBACAC;oBACAC;oBACAC;oBACAC;oBACAqD,QAAQpD,MAAMuE,IAAI,CAAC/C,GAAG,CAAC,CAACgD,MAAS,CAAA;4BAAE,GAAGA,GAAG;4BAAE7B,MAAM;wBAAM,CAAA;oBACvDzC;oBACAC;oBACAC,iBAAiBU;oBACjBT;oBACAC,YAAYS;oBACZR,kBAAkBS;oBAClBR;oBACAC,oBAAoB;wBAAE,GAAGA,kBAAkB;oBAAC;oBAC5CC;oBACAC,aAAaA,eAAe,CAAC;oBAC7BC,YAAY;wBAAE,GAAGA,UAAU;oBAAC;gBAC9B;gBAEA;YACF;QAEA;YAAS;gBACP;YACF;IACF;AACF,EAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Config } from '../config/types.js';
|
|
2
|
+
/** Will read the `routes.api` config and appropriately handle `"/"` api paths */
|
|
3
|
+
export declare const formatApiURL: (args: {
|
|
4
|
+
apiRoute: NonNullable<Config["routes"]>["api"];
|
|
5
|
+
basePath?: string;
|
|
6
|
+
path: "" | `/${string}` | null | undefined;
|
|
7
|
+
serverURL: Config["serverURL"];
|
|
8
|
+
}) => string;
|
|
9
|
+
//# sourceMappingURL=formatApiURL.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatApiURL.d.ts","sourceRoot":"","sources":["../../src/utilities/formatApiURL.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAIhD,iFAAiF;AACjF,eAAO,MAAM,YAAY,SAAU;IACjC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,EAAE,GAAG,IAAI,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,CAAA;IAC1C,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,CAAA;CAC/B,KAAG,MAOH,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { formatAdminURL } from './formatAdminURL.js';
|
|
2
|
+
/** Will read the `routes.api` config and appropriately handle `"/"` api paths */ export const formatApiURL = (args)=>{
|
|
3
|
+
return formatAdminURL({
|
|
4
|
+
adminRoute: args.apiRoute,
|
|
5
|
+
basePath: args.basePath,
|
|
6
|
+
path: args.path,
|
|
7
|
+
serverURL: args.serverURL
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=formatApiURL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/formatApiURL.ts"],"sourcesContent":["import type { Config } from '../config/types.js'\n\nimport { formatAdminURL } from './formatAdminURL.js'\n\n/** Will read the `routes.api` config and appropriately handle `\"/\"` api paths */\nexport const formatApiURL = (args: {\n apiRoute: NonNullable<Config['routes']>['api']\n basePath?: string\n path: '' | `/${string}` | null | undefined\n serverURL: Config['serverURL']\n}): string => {\n return formatAdminURL({\n adminRoute: args.apiRoute,\n basePath: args.basePath,\n path: args.path,\n serverURL: args.serverURL,\n })\n}\n"],"names":["formatAdminURL","formatApiURL","args","adminRoute","apiRoute","basePath","path","serverURL"],"mappings":"AAEA,SAASA,cAAc,QAAQ,sBAAqB;AAEpD,+EAA+E,GAC/E,OAAO,MAAMC,eAAe,CAACC;IAM3B,OAAOF,eAAe;QACpBG,YAAYD,KAAKE,QAAQ;QACzBC,UAAUH,KAAKG,QAAQ;QACvBC,MAAMJ,KAAKI,IAAI;QACfC,WAAWL,KAAKK,SAAS;IAC3B;AACF,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payload",
|
|
3
|
-
"version": "3.68.
|
|
3
|
+
"version": "3.68.4",
|
|
4
4
|
"description": "Node, React, Headless CMS and Application Framework built on Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"admin panel",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"undici": "7.10.0",
|
|
107
107
|
"uuid": "10.0.0",
|
|
108
108
|
"ws": "^8.16.0",
|
|
109
|
-
"@payloadcms/translations": "3.68.
|
|
109
|
+
"@payloadcms/translations": "3.68.4"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
112
|
"@hyrious/esbuild-plugin-commonjs": "0.2.6",
|