payload 3.94.0 → 3.94.1
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/index.bundled.d.ts +55 -4
- package/dist/utilities/deepMerge.d.ts +55 -3
- package/dist/utilities/deepMerge.d.ts.map +1 -1
- package/dist/utilities/deepMerge.js +97 -2
- package/dist/utilities/deepMerge.js.map +1 -1
- package/dist/utilities/deepMerge.spec.js +332 -0
- package/dist/utilities/deepMerge.spec.js.map +1 -0
- package/package.json +2 -3
package/dist/index.bundled.d.ts
CHANGED
|
@@ -13,8 +13,6 @@ import { OperationArgs as OperationArgs$1, Request as Request$1 } from 'graphql-
|
|
|
13
13
|
import { SendMailOptions } from 'nodemailer';
|
|
14
14
|
import { ParsedArgs } from 'minimist';
|
|
15
15
|
import { lookup } from 'dns';
|
|
16
|
-
import deepMerge from 'deepmerge';
|
|
17
|
-
export { default as deepMerge } from 'deepmerge';
|
|
18
16
|
import { ReadonlyRequestCookies } from 'next/dist/server/web/spec-extension/adapters/request-cookies.js';
|
|
19
17
|
import { PinoPretty } from 'pino-pretty';
|
|
20
18
|
import { DatePickerProps } from 'react-datepicker';
|
|
@@ -13313,12 +13311,65 @@ declare function deepCopyObjectSimple<T extends JsonValue>(value: T, filterUndef
|
|
|
13313
13311
|
*/
|
|
13314
13312
|
declare function deepCopyObjectComplex<T>(object: T, cache?: WeakMap<any, any>): T;
|
|
13315
13313
|
|
|
13314
|
+
type DeepMergeArrayMergeOptions = {
|
|
13315
|
+
cloneUnlessOtherwiseSpecified(value: object, options?: DeepMergeOptions): any;
|
|
13316
|
+
isMergeableObject(value: object): boolean;
|
|
13317
|
+
};
|
|
13318
|
+
type DeepMergeOptions = {
|
|
13319
|
+
/**
|
|
13320
|
+
* Merges two arrays. Defaults to concatenating `target` and `source`.
|
|
13321
|
+
*/
|
|
13322
|
+
arrayMerge?: (target: any[], source: any[], options: ResolvedDeepMergeOptions) => any[];
|
|
13323
|
+
/**
|
|
13324
|
+
* When `false`, mergeable values are copied by reference instead of being deeply cloned.
|
|
13325
|
+
* @default true
|
|
13326
|
+
*/
|
|
13327
|
+
clone?: boolean;
|
|
13328
|
+
/**
|
|
13329
|
+
* Returns a custom merge function for a given key, or `undefined` to use the default merge.
|
|
13330
|
+
*/
|
|
13331
|
+
customMerge?: (key: string, options?: DeepMergeOptions) => ((x: any, y: any) => any) | undefined;
|
|
13332
|
+
/**
|
|
13333
|
+
* Determines whether a value should be merged recursively or copied as-is.
|
|
13334
|
+
*/
|
|
13335
|
+
isMergeableObject?(value: object): boolean;
|
|
13336
|
+
};
|
|
13337
|
+
type ResolvedDeepMergeOptions = {
|
|
13338
|
+
arrayMerge: NonNullable<DeepMergeOptions['arrayMerge']>;
|
|
13339
|
+
isMergeableObject: (value: unknown) => boolean;
|
|
13340
|
+
} & DeepMergeArrayMergeOptions & DeepMergeOptions;
|
|
13341
|
+
/**
|
|
13342
|
+
* Fully-featured deepMerge. Returns a new object and does not mutate its arguments.
|
|
13343
|
+
*
|
|
13344
|
+
* Array handling: arrays are concatenated unless `arrayMerge` is provided.
|
|
13345
|
+
*
|
|
13346
|
+
* `__proto__` keys are never copied to the result, preventing prototype poisoning of the returned
|
|
13347
|
+
* object when merging untrusted input (e.g. parsed JSON).
|
|
13348
|
+
*/
|
|
13349
|
+
declare function deepMerge<T>(x: Partial<T>, y: Partial<T>, options?: DeepMergeOptions): T;
|
|
13350
|
+
declare function deepMerge<T1, T2>(x: Partial<T1>, y: Partial<T2>, options?: DeepMergeOptions): T1 & T2;
|
|
13351
|
+
declare namespace deepMerge {
|
|
13352
|
+
var all: typeof deepMergeAll;
|
|
13353
|
+
}
|
|
13354
|
+
/**
|
|
13355
|
+
* Keeps the `deepMerge.Options` / `deepMerge.ArrayMergeOptions` type references from the former
|
|
13356
|
+
* `deepmerge` dependency working.
|
|
13357
|
+
*/
|
|
13358
|
+
declare namespace deepMerge {
|
|
13359
|
+
type ArrayMergeOptions = DeepMergeArrayMergeOptions;
|
|
13360
|
+
type Options = DeepMergeOptions;
|
|
13361
|
+
}
|
|
13362
|
+
/**
|
|
13363
|
+
* Deep-merges all objects in the array, from left to right.
|
|
13364
|
+
*/
|
|
13365
|
+
declare function deepMergeAll<T = object>(objects: Partial<T>[], options?: DeepMergeOptions): T;
|
|
13366
|
+
declare function deepMergeAll(objects: object[], options?: DeepMergeOptions): object;
|
|
13316
13367
|
/**
|
|
13317
13368
|
* Fully-featured deepMerge.
|
|
13318
13369
|
*
|
|
13319
13370
|
* Array handling: Arrays in the target object are combined with the source object's arrays.
|
|
13320
13371
|
*/
|
|
13321
|
-
declare function deepMergeWithCombinedArrays<T extends object>(obj1: object, obj2: object, options?:
|
|
13372
|
+
declare function deepMergeWithCombinedArrays<T extends object>(obj1: object, obj2: object, options?: DeepMergeOptions): T;
|
|
13322
13373
|
/**
|
|
13323
13374
|
* Fully-featured deepMerge.
|
|
13324
13375
|
*
|
|
@@ -14371,5 +14422,5 @@ interface GlobalCustom extends Record<string, any> {
|
|
|
14371
14422
|
interface GlobalAdminCustom extends Record<string, any> {
|
|
14372
14423
|
}
|
|
14373
14424
|
|
|
14374
|
-
export { APIError, APIErrorName, Action, AuthenticationError, BasePayload, CLIENT_UPLOAD_CONTEXT_CONTEXT_KEY, CLIENT_UPLOAD_TEMP_FILE_PATH_CONTEXT_KEY, DatabaseKVAdapter, DiffMethod, DuplicateCollection, DuplicateFieldName, DuplicateGlobal, EntityType, ErrorDeletingFile, FileRetrievalError, FileUploadError, Forbidden, InMemoryKVAdapter, InvalidConfiguration, InvalidFieldName, InvalidFieldRelationship, JWTAuthentication, JWT_AUTH_VERSION, JobCancelledError, Locked, LockedAuth, MissingCollectionLabel, MissingEditorProp, MissingFieldInputOptions, MissingFieldType, MissingFile, NotFound, QueryError, UnauthorizedError, UnverifiedEmail, ValidationError, ValidationErrorName, _internal_jobSystemGlobals, _internal_resetJobSystemGlobals, _internal_safeFetchGlobal, accessOperation, addDataAndFileToRequest, addLocalesToRequestFromData, traverseFields$4 as afterChangeTraverseFields, promise as afterReadPromise, traverseFields$3 as afterReadTraverseFields, appendVersionToQueryKey, apiKeyFields as baseAPIKeyFields, accountLockFields as baseAccountLockFields, baseAuthFields, baseBlockFields, emailFieldConfig as baseEmailField, baseIDField, sessionsFieldConfig as baseSessionsField, usernameFieldConfig as baseUsernameField, verificationFields as baseVerificationFields, traverseFields$2 as beforeChangeTraverseFields, traverseFields$1 as beforeValidateTraverseFields, buildConfig, buildVersionCollectionFields, buildVersionCompoundIndexes, buildVersionGlobalFields, canAccessAdmin, checkDependencies, checkLoginPermission, combineQueries, commitTransaction, configToJSONSchema, countOperation, countRunnableOrActiveJobsForQueue, createArrayFromCommaDelineated, createClientBlocks, createClientCollectionConfig, createClientCollectionConfigs, createClientConfig, createClientField, createClientFields, createClientGlobalConfig, createClientGlobalConfigs, createDatabaseAdapter, createDataloaderCacheKey, createLocalReq, createMigration, createOperation, createPayloadRequest, createUnauthenticatedClientConfig, databaseKVAdapter, deepCopyObject, deepCopyObjectComplex, deepCopyObjectSimple, deepMergeSimple, deepMergeWithCombinedArrays, deepMergeWithReactComponents, deepMergeWithSourceArrays, initialized as default, defaultAdminPanelUserAccess, defaultBeginTransaction, defaultLoggerOptions, defaults, definePlugin, deleteByIDOperation, deleteCollectionVersions, deleteOperation, docAccessOperation$1 as docAccessOperation, docAccessOperation as docAccessOperationGlobal, docHasTimestamps, duplicateOperation, dynamicImport, enforceMaxVersions, entityToJSONSchema, escapeRegExp, executeAccess, executeAuthStrategies, extractAccessFromPermission, extractJWT, fieldsToJSONSchema, findByIDOperation, findMigrationDir, findOneOperation, findOperation, findUp, findUpSync, findVersionByIDOperation$1 as findVersionByIDOperation, findVersionByIDOperation as findVersionByIDOperationGlobal, findVersionsOperation$1 as findVersionsOperation, findVersionsOperation as findVersionsOperationGlobal, flattenAllFields, flattenTopLevelFields, flattenWhereToOperators, forgotPasswordOperation, formatErrors, formatLabels, formatNames, genImportMapIterateFields, generateCookie, generateExpiredPayloadCookie, generateImportMap, generatePayloadCookie, getAccessResults, getBlockSelect, getCollectionIDFieldTypes, getCookieExpiration, getCurrentDate, getDataLoader, getDefaultValue, getDependencies, getFieldByPath, getFieldsToSign, getFileByPath, getFolderData, getLatestCollectionVersion, getLatestGlobalVersion, getLocalI18n, getLocalizedPaths, getLoginOptions, getMigrations, getObjectDotNotation, getPayload, getPredefinedMigration, getQueryDraftsSort, getRequestLanguage, handleEndpoints, hasWhereAccessResult, headersWithCors, importHandlerPath, inMemoryKVAdapter, incrementLoginAttempts, initOperation, initTransaction, isEntityHidden, isPlainObject, isValidID, isolateObjectProperty, jobAfterRead, jwtSign, killTransaction, localizeStatus, logError, loginOperation, logoutOperation, mapAsync, meOperation, mergeHeaders, migrate, migrate$1 as migrateCLI, migrateDown, migrateRefresh, migrateReset, migrateStatus, migrationTemplate, migrationsCollection, parseCookies, parseDocumentID, parseParams, pathExistsAndIsAccessible, pathExistsAndIsAccessibleSync, readMigrationFiles, refreshOperation, registerFirstUserOperation, reload, resetLoginAttempts, resetPasswordOperation, restoreVersionOperation$1 as restoreVersionOperation, restoreVersionOperation as restoreVersionOperationGlobal, sanitizeConfig, sanitizeFallbackLocale, sanitizeField, sanitizeFields, sanitizeJoinParams, sanitizeLocales, sanitizePopulateParam, sanitizeSelectParam, sanitizeSortParams, saveVersion, serverOnlyAdminConfigProperties, serverOnlyConfigProperties, serverProps, slugField, sortableFieldTypes, stripUnselectedFields, toWords, traverseFields, unlinkClientUploadTempFile, unlockOperation, updateByIDOperation, updateOperation$1 as updateOperation, updateOperation as updateOperationGlobal, validateBlocksFilterOptions, validateQueryPaths, validateSearchParam, validations, verifyEmailOperation, versionDefaults, withNullableJSONSchemaType, writeMigrationIndex };
|
|
14425
|
+
export { APIError, APIErrorName, Action, AuthenticationError, BasePayload, CLIENT_UPLOAD_CONTEXT_CONTEXT_KEY, CLIENT_UPLOAD_TEMP_FILE_PATH_CONTEXT_KEY, DatabaseKVAdapter, DiffMethod, DuplicateCollection, DuplicateFieldName, DuplicateGlobal, EntityType, ErrorDeletingFile, FileRetrievalError, FileUploadError, Forbidden, InMemoryKVAdapter, InvalidConfiguration, InvalidFieldName, InvalidFieldRelationship, JWTAuthentication, JWT_AUTH_VERSION, JobCancelledError, Locked, LockedAuth, MissingCollectionLabel, MissingEditorProp, MissingFieldInputOptions, MissingFieldType, MissingFile, NotFound, QueryError, UnauthorizedError, UnverifiedEmail, ValidationError, ValidationErrorName, _internal_jobSystemGlobals, _internal_resetJobSystemGlobals, _internal_safeFetchGlobal, accessOperation, addDataAndFileToRequest, addLocalesToRequestFromData, traverseFields$4 as afterChangeTraverseFields, promise as afterReadPromise, traverseFields$3 as afterReadTraverseFields, appendVersionToQueryKey, apiKeyFields as baseAPIKeyFields, accountLockFields as baseAccountLockFields, baseAuthFields, baseBlockFields, emailFieldConfig as baseEmailField, baseIDField, sessionsFieldConfig as baseSessionsField, usernameFieldConfig as baseUsernameField, verificationFields as baseVerificationFields, traverseFields$2 as beforeChangeTraverseFields, traverseFields$1 as beforeValidateTraverseFields, buildConfig, buildVersionCollectionFields, buildVersionCompoundIndexes, buildVersionGlobalFields, canAccessAdmin, checkDependencies, checkLoginPermission, combineQueries, commitTransaction, configToJSONSchema, countOperation, countRunnableOrActiveJobsForQueue, createArrayFromCommaDelineated, createClientBlocks, createClientCollectionConfig, createClientCollectionConfigs, createClientConfig, createClientField, createClientFields, createClientGlobalConfig, createClientGlobalConfigs, createDatabaseAdapter, createDataloaderCacheKey, createLocalReq, createMigration, createOperation, createPayloadRequest, createUnauthenticatedClientConfig, databaseKVAdapter, deepCopyObject, deepCopyObjectComplex, deepCopyObjectSimple, deepMerge, deepMergeSimple, deepMergeWithCombinedArrays, deepMergeWithReactComponents, deepMergeWithSourceArrays, initialized as default, defaultAdminPanelUserAccess, defaultBeginTransaction, defaultLoggerOptions, defaults, definePlugin, deleteByIDOperation, deleteCollectionVersions, deleteOperation, docAccessOperation$1 as docAccessOperation, docAccessOperation as docAccessOperationGlobal, docHasTimestamps, duplicateOperation, dynamicImport, enforceMaxVersions, entityToJSONSchema, escapeRegExp, executeAccess, executeAuthStrategies, extractAccessFromPermission, extractJWT, fieldsToJSONSchema, findByIDOperation, findMigrationDir, findOneOperation, findOperation, findUp, findUpSync, findVersionByIDOperation$1 as findVersionByIDOperation, findVersionByIDOperation as findVersionByIDOperationGlobal, findVersionsOperation$1 as findVersionsOperation, findVersionsOperation as findVersionsOperationGlobal, flattenAllFields, flattenTopLevelFields, flattenWhereToOperators, forgotPasswordOperation, formatErrors, formatLabels, formatNames, genImportMapIterateFields, generateCookie, generateExpiredPayloadCookie, generateImportMap, generatePayloadCookie, getAccessResults, getBlockSelect, getCollectionIDFieldTypes, getCookieExpiration, getCurrentDate, getDataLoader, getDefaultValue, getDependencies, getFieldByPath, getFieldsToSign, getFileByPath, getFolderData, getLatestCollectionVersion, getLatestGlobalVersion, getLocalI18n, getLocalizedPaths, getLoginOptions, getMigrations, getObjectDotNotation, getPayload, getPredefinedMigration, getQueryDraftsSort, getRequestLanguage, handleEndpoints, hasWhereAccessResult, headersWithCors, importHandlerPath, inMemoryKVAdapter, incrementLoginAttempts, initOperation, initTransaction, isEntityHidden, isPlainObject, isValidID, isolateObjectProperty, jobAfterRead, jwtSign, killTransaction, localizeStatus, logError, loginOperation, logoutOperation, mapAsync, meOperation, mergeHeaders, migrate, migrate$1 as migrateCLI, migrateDown, migrateRefresh, migrateReset, migrateStatus, migrationTemplate, migrationsCollection, parseCookies, parseDocumentID, parseParams, pathExistsAndIsAccessible, pathExistsAndIsAccessibleSync, readMigrationFiles, refreshOperation, registerFirstUserOperation, reload, resetLoginAttempts, resetPasswordOperation, restoreVersionOperation$1 as restoreVersionOperation, restoreVersionOperation as restoreVersionOperationGlobal, sanitizeConfig, sanitizeFallbackLocale, sanitizeField, sanitizeFields, sanitizeJoinParams, sanitizeLocales, sanitizePopulateParam, sanitizeSelectParam, sanitizeSortParams, saveVersion, serverOnlyAdminConfigProperties, serverOnlyConfigProperties, serverProps, slugField, sortableFieldTypes, stripUnselectedFields, toWords, traverseFields, unlinkClientUploadTempFile, unlockOperation, updateByIDOperation, updateOperation$1 as updateOperation, updateOperation as updateOperationGlobal, validateBlocksFilterOptions, validateQueryPaths, validateSearchParam, validations, verifyEmailOperation, versionDefaults, withNullableJSONSchemaType, writeMigrationIndex };
|
|
14375
14426
|
export type { Access, AccessArgs, AccessResult, AdminClient, AdminComponent, AdminDependencies, AdminFunction, AdminViewClientProps, AdminViewComponent, AdminViewConfig, AdminViewServerProps as AdminViewProps, AdminViewServerProps, AdminViewServerPropsOnly, AfterErrorHook$1 as AfterErrorHook, AfterErrorHookArgs, AfterErrorResult, AfterFolderListClientProps, AfterFolderListServerProps, AfterFolderListServerPropsOnly, AfterFolderListTableClientProps, AfterFolderListTableServerProps, AfterFolderListTableServerPropsOnly, AfterListClientProps, AfterListServerProps, AfterListServerPropsOnly, AfterListTableClientProps, AfterListTableServerProps, AfterListTableServerPropsOnly, AllOperations, AllowList, ApplyDisableErrors, ArrayField, ArrayFieldClient, ArrayFieldClientComponent, ArrayFieldClientProps, ArrayFieldDescriptionClientComponent, ArrayFieldDescriptionServerComponent, ArrayFieldDiffClientComponent, ArrayFieldDiffServerComponent, ArrayFieldErrorClientComponent, ArrayFieldErrorServerComponent, ArrayFieldLabelClientComponent, ArrayFieldLabelServerComponent, ArrayFieldServerComponent, ArrayFieldServerProps, ArrayFieldValidation, Auth, AuthCollection, AuthCollectionSlug, AuthOperations, AuthOperationsFromCollectionSlug, AuthStrategy, AuthStrategyFunction, AuthStrategyFunctionArgs, AuthStrategyResult, BaseDatabaseAdapter, BaseFilter, BaseJob, BaseListFilter, BaseLocalizationConfig, BaseValidateOptions, BaseVersionField, BeforeDocumentControlsClientProps, BeforeDocumentControlsServerProps, BeforeDocumentControlsServerPropsOnly, BeforeFolderListClientProps, BeforeFolderListServerProps, BeforeFolderListServerPropsOnly, BeforeFolderListTableClientProps, BeforeFolderListTableServerProps, BeforeFolderListTableServerPropsOnly, BeforeListClientProps, BeforeListServerProps, BeforeListServerPropsOnly, BeforeListTableClientProps, BeforeListTableServerProps, BeforeListTableServerPropsOnly, BeginTransaction, BinScript, BinScriptConfig, Block, BlockJSX, BlockPermissions, BlockRowLabelClientComponent, BlockRowLabelServerComponent, BlockSlug, BlocksField, BlocksFieldClient, BlocksFieldClientComponent, BlocksFieldClientProps, BlocksFieldDescriptionClientComponent, BlocksFieldDescriptionServerComponent, BlocksFieldDiffClientComponent, BlocksFieldDiffServerComponent, BlocksFieldErrorClientComponent, BlocksFieldErrorServerComponent, BlocksFieldLabelClientComponent, BlocksFieldLabelServerComponent, BlocksFieldServerComponent, BlocksFieldServerProps, BlocksFieldValidation, BlocksPermissions, BuildCollectionFolderViewResult, BuildFormStateArgs, BuildTableStateArgs, BulkOperationResult, CORSConfig, CheckboxField, CheckboxFieldClient, CheckboxFieldClientComponent, CheckboxFieldClientProps, CheckboxFieldDescriptionClientComponent, CheckboxFieldDescriptionServerComponent, CheckboxFieldDiffClientComponent, CheckboxFieldDiffServerComponent, CheckboxFieldErrorClientComponent, CheckboxFieldErrorServerComponent, CheckboxFieldLabelClientComponent, CheckboxFieldLabelServerComponent, CheckboxFieldServerComponent, CheckboxFieldServerProps, CheckboxFieldValidation, ClientBlock, ClientCollectionConfig, ClientComponentProps, ClientConfig, ClientField, ClientFieldBase, ClientFieldProps, ClientFieldSchemaMap, ClientFieldWithOptionalType, ClientGlobalConfig, DocumentViewClientProps as ClientSideEditViewProps, ClientTab, ClientUser, ClientWidget, CodeField, CodeFieldClient, CodeFieldClientComponent, CodeFieldClientProps, CodeFieldDescriptionClientComponent, CodeFieldDescriptionServerComponent, CodeFieldDiffClientComponent, CodeFieldDiffServerComponent, CodeFieldErrorClientComponent, CodeFieldErrorServerComponent, CodeFieldLabelClientComponent, CodeFieldLabelServerComponent, CodeFieldServerComponent, CodeFieldServerProps, CodeFieldValidation, CollapsedPreferences, CollapsibleField, CollapsibleFieldClient, CollapsibleFieldClientComponent, CollapsibleFieldClientProps, CollapsibleFieldDescriptionClientComponent, CollapsibleFieldDescriptionServerComponent, CollapsibleFieldDiffClientComponent, CollapsibleFieldDiffServerComponent, CollapsibleFieldErrorClientComponent, CollapsibleFieldErrorServerComponent, CollapsibleFieldLabelClientComponent, CollapsibleFieldLabelServerComponent, CollapsibleFieldServerComponent, CollapsibleFieldServerProps, Collection, CollectionAdminCustom, CollectionAdminOptions, AfterChangeHook as CollectionAfterChangeHook, AfterDeleteHook as CollectionAfterDeleteHook, AfterErrorHook as CollectionAfterErrorHook, AfterForgotPasswordHook as CollectionAfterForgotPasswordHook, AfterLoginHook as CollectionAfterLoginHook, AfterLogoutHook as CollectionAfterLogoutHook, AfterMeHook as CollectionAfterMeHook, AfterOperationHook as CollectionAfterOperationHook, AfterReadHook as CollectionAfterReadHook, AfterRefreshHook as CollectionAfterRefreshHook, BeforeChangeHook as CollectionBeforeChangeHook, BeforeDeleteHook as CollectionBeforeDeleteHook, BeforeLoginHook as CollectionBeforeLoginHook, BeforeOperationHook as CollectionBeforeOperationHook, BeforeReadHook as CollectionBeforeReadHook, BeforeValidateHook as CollectionBeforeValidateHook, CollectionConfig, CollectionCustom, MeHook as CollectionMeHook, CollectionPermission, CollectionPreferences, RefreshHook as CollectionRefreshHook, CollectionSlug, Column, ColumnPreference, CommitTransaction, CompoundIndex, ConcurrencyConfig, Condition, ConditionalDateProps, Config, ConfirmPasswordFieldValidation, Connect, Count, CountArgs, CountGlobalVersionArgs, CountGlobalVersions, CountVersions, Create, CreateArgs, CreateClientConfigArgs, CreateGlobal, CreateGlobalArgs, CreateGlobalVersion, CreateGlobalVersionArgs, CreateMigration, CreateVersion, CreateVersionArgs, CustomComponent, CustomDocumentViewConfig, CustomPayloadRequestProperties, CustomComponent as CustomPreviewButton, CustomComponent as CustomPublishButton, CustomComponent as CustomSaveButton, CustomComponent as CustomSaveDraftButton, CustomStatus, CustomUpload, CustomVersionParser, DBIdentifierName, DashboardConfig, Data, DataFromCollectionSlug, DataFromGlobalSlug, DataFromWidgetSlug, DatabaseAdapter, DatabaseAdapterResult as DatabaseAdapterObj, DatabaseKVAdapterOptions, DateField, DateFieldClient, DateFieldClientComponent, DateFieldClientProps, DateFieldDescriptionClientComponent, DateFieldDescriptionServerComponent, DateFieldDiffClientComponent, DateFieldDiffServerComponent, DateFieldErrorClientComponent, DateFieldErrorServerComponent, DateFieldLabelClientComponent, DateFieldLabelServerComponent, DateFieldServerComponent, DateFieldServerProps, DateFieldValidation, DayPickerProps, DefaultCellComponentProps, DefaultDocumentIDType, DefaultDocumentViewConfig, DefaultServerCellComponentProps, DefaultServerFunctionArgs, DefaultValue, DeleteMany, DeleteManyArgs, DeleteOne, DeleteOneArgs, DeleteVersions, DeleteVersionsArgs, Description, DescriptionFunction, Destroy, Document, DocumentEvent, DocumentPermissions, DocumentPreferences, DocumentSlots, DocumentSubViewTypes, DocumentTabClientProps, DocumentTabComponent, DocumentTabCondition, DocumentTabConfig, DocumentTabServerProps as DocumentTabProps, DocumentTabServerProps, DocumentTabServerPropsOnly, DocumentViewClientProps, DocumentViewComponent, DocumentViewConfig, DocumentViewServerProps, DocumentViewServerPropsOnly, DraftTransformCollectionWithSelect, DynamicMigrationTemplate, EditConfig, EditConfigWithRoot, EditConfigWithoutRoot, EditMenuItemsClientProps, EditMenuItemsServerProps, EditMenuItemsServerPropsOnly, EditViewComponent, EditViewConfig, EditViewProps, EmailAdapter, EmailField, EmailFieldClient, EmailFieldClientComponent, EmailFieldClientProps, EmailFieldDescriptionClientComponent, EmailFieldDescriptionServerComponent, EmailFieldDiffClientComponent, EmailFieldDiffServerComponent, EmailFieldErrorClientComponent, EmailFieldErrorServerComponent, EmailFieldLabelClientComponent, EmailFieldLabelServerComponent, EmailFieldServerComponent, EmailFieldServerProps, EmailFieldValidation, Endpoint, EntityDescription, EntityDescriptionComponent, EntityDescriptionFunction, EntityPolicies, ErrorResult, ExternalFileHeaderFilterContext, FetchAPIFileUploadOptions, Field, FieldAccess, FieldAccessArgs, FieldAffectingData, FieldAffectingDataClient, FieldBase, FieldBaseClient, FieldClientComponent, FieldCustom, FieldDescriptionClientComponent, FieldDescriptionClientProps, FieldDescriptionServerComponent, FieldDescriptionServerProps, FieldDiffClientComponent, FieldDiffClientProps, FieldDiffServerComponent, FieldDiffServerProps, FieldErrorClientComponent, FieldErrorClientProps, FieldErrorServerComponent, FieldErrorServerProps, FieldHook, FieldHookArgs, FieldLabelClientComponent, FieldLabelClientProps, FieldLabelServerComponent, FieldLabelServerProps, FieldPaths, FieldPermissions, FieldPosition, FieldPresentationalOnly, FieldPresentationalOnlyClient, FieldRow, FieldSchemaMap, FieldServerComponent, FieldState, FieldTypes, FieldWithMany, FieldWithManyClient, FieldWithMaxDepth, FieldWithMaxDepthClient, FieldWithPath, FieldWithPathClient, FieldWithSubFields, FieldWithSubFieldsClient, FieldsPermissions, FieldsPreferences, File$1 as File, FileAllowList, FileData, FileSize, FileSizeImproved, FileSizes, FileToSave, FilterOptions, FilterOptionsProps, FilterOptionsResult, Find, FindArgs, FindDistinct, FindGlobal, FindGlobalArgs, FindGlobalVersions, FindGlobalVersionsArgs, FindOne, FindOneArgs, FindOptions, FindVersions, FindVersionsArgs, FlattenedArrayField, FlattenedBlock, FlattenedBlocksField, FlattenedField$1 as FlattenedField, FlattenedGroupField, FlattenedJoinField, FlattenedTabAsField, FocalPoint, FolderListViewClientProps, FolderListViewServerProps, FolderListViewServerPropsOnly, FolderListViewSlotSharedClientProps, FolderListViewSlots, FolderSortKeys, FieldState as FormField, FieldStateWithoutComponents as FormFieldWithoutComponents, FormState, FormStateWithoutComponents, GenerateImageName, GeneratePreviewURL, GenerateSchema, GeneratedTypes, GenericDescriptionProps, GenericErrorProps, GenericLabelProps, GetAdminThumbnail, GetFolderResultsComponentAndDataArgs, GlobalAdminCustom, GlobalAdminOptions, AfterChangeHook$1 as GlobalAfterChangeHook, AfterReadHook$1 as GlobalAfterReadHook, BeforeChangeHook$1 as GlobalBeforeChangeHook, BeforeOperationHook$1 as GlobalBeforeOperationHook, BeforeReadHook$1 as GlobalBeforeReadHook, BeforeValidateHook$1 as GlobalBeforeValidateHook, GlobalConfig, GlobalCustom, GlobalPermission, GlobalSlug, GraphQLExtension, GraphQLInfo, GroupField, GroupFieldClient, GroupFieldClientComponent, GroupFieldClientProps, GroupFieldDescriptionClientComponent, GroupFieldDescriptionServerComponent, GroupFieldDiffClientComponent, GroupFieldDiffServerComponent, GroupFieldErrorClientComponent, GroupFieldErrorServerComponent, GroupFieldLabelClientComponent, GroupFieldLabelServerComponent, GroupFieldServerComponent, GroupFieldServerProps, HiddenFieldProps, HookName, HookOperationType, IfAny, ImageSize, ImageUploadFormatOptions, ImageUploadTrimOptions, ImportMap, ImportMapGenerators, IncomingAuthType, Init, InitOptions, InitPageResult, InitReqResult, InsideFieldsPreferences, IsAny, JSONField, JSONFieldClient, JSONFieldClientComponent, JSONFieldClientProps, JSONFieldDescriptionClientComponent, JSONFieldDescriptionServerComponent, JSONFieldDiffClientComponent, JSONFieldDiffServerComponent, JSONFieldErrorClientComponent, JSONFieldErrorServerComponent, JSONFieldLabelClientComponent, JSONFieldLabelServerComponent, JSONFieldServerComponent, JSONFieldServerProps, JSONFieldValidation, JWTAuthVersion, Job, JobLog, JobTaskStatus, JobsConfig, JoinField, JoinFieldClient, JoinFieldClientComponent, JoinFieldClientProps, JoinFieldDescriptionClientComponent, JoinFieldDescriptionServerComponent, JoinFieldDiffClientComponent, JoinFieldDiffServerComponent, JoinFieldErrorClientComponent, JoinFieldErrorServerComponent, JoinFieldLabelClientComponent, JoinFieldLabelServerComponent, JoinFieldServerComponent, JoinFieldServerProps, JoinParams, JoinQuery, JsonArray, JsonObject, JsonValue, KVAdapter, KVAdapterResult, KVStoreValue, LabelFunction, Labels, LabelsClient, LanguageOptions, CollectionPreferences as ListPreferences, ListQuery, ListViewClientProps, ListViewServerProps, ListViewServerPropsOnly, ListViewSlotSharedClientProps, ListViewSlots, LivePreviewConfig, LivePreviewURLType, Locale, LocalizationConfig, LocalizationConfigWithLabels, LocalizationConfigWithNoLabels, LoginResult, LoginWithUsernameOptions, MappedClientComponent, MappedEmptyComponent, MappedServerComponent, MaybePromise, MeOperationResult, MetaConfig, Migration, MigrationData, MigrationTemplateArgs, LocalizeStatusArgs$1 as MongoLocalizeStatusArgs, NamedGroupField, NamedGroupFieldClient, NamedTab, NavGroupPreferences, NavPreferences, NonPresentationalField, NonPresentationalFieldClient, NumberField, NumberFieldClient, NumberFieldClientComponent, NumberFieldClientProps, NumberFieldDescriptionClientComponent, NumberFieldDescriptionServerComponent, NumberFieldDiffClientComponent, NumberFieldDiffServerComponent, NumberFieldErrorClientComponent, NumberFieldErrorServerComponent, NumberFieldLabelClientComponent, NumberFieldLabelServerComponent, NumberFieldManyValidation, NumberFieldServerComponent, NumberFieldServerProps, NumberFieldSingleValidation, NumberFieldValidation, OGImageConfig, Operation, Operator, Option, OptionLabel, OptionObject, OrderableEndpointBody, PaginatedDistinctDocs, PaginatedDocs, Params, ParsedParams, PasswordFieldValidation, PathToQuery, Payload, PayloadClientComponentProps, PayloadClientReactComponent, PayloadComponent, PayloadComponentProps, EmailAdapter as PayloadEmailAdapter, PayloadHandler, PayloadLogger, PayloadReactComponent, PayloadRequest, PayloadServerAction, PayloadServerComponentProps, PayloadServerReactComponent, PayloadTypes, PayloadTypesShape, Permission, Permissions, PickPreserveOptional, Plugin, PluginsMap, PointField, PointFieldClient, PointFieldClientComponent, PointFieldClientProps, PointFieldDescriptionClientComponent, PointFieldDescriptionServerComponent, PointFieldDiffClientComponent, PointFieldDiffServerComponent, PointFieldErrorClientComponent, PointFieldErrorServerComponent, PointFieldLabelClientComponent, PointFieldLabelServerComponent, PointFieldServerComponent, PointFieldServerProps, PointFieldValidation, PolymorphicRelationshipField, PolymorphicRelationshipFieldClient, PopulateType, PreferenceRequest, PreferenceUpdateRequest, PreviewButtonClientProps, PreviewButtonServerProps, PreviewButtonServerPropsOnly, ProbedImageSize, PublishButtonClientProps, PublishButtonServerProps, PublishButtonServerPropsOnly, QueryDrafts, QueryDraftsArgs, QueryPreset, RadioField, RadioFieldClient, RadioFieldClientComponent, RadioFieldClientProps, RadioFieldDescriptionClientComponent, RadioFieldDescriptionServerComponent, RadioFieldDiffClientComponent, RadioFieldDiffServerComponent, RadioFieldErrorClientComponent, RadioFieldErrorServerComponent, RadioFieldLabelClientComponent, RadioFieldLabelServerComponent, RadioFieldServerComponent, RadioFieldServerProps, RadioFieldValidation, RawParams, RawPayloadComponent, RegisteredPlugins, RelationshipField, RelationshipFieldClient, RelationshipFieldClientComponent, RelationshipFieldClientProps, RelationshipFieldDescriptionClientComponent, RelationshipFieldDescriptionServerComponent, RelationshipFieldDiffClientComponent, RelationshipFieldDiffServerComponent, RelationshipFieldErrorClientComponent, RelationshipFieldErrorServerComponent, RelationshipFieldLabelClientComponent, RelationshipFieldLabelServerComponent, RelationshipFieldManyValidation, RelationshipFieldServerComponent, RelationshipFieldServerProps, RelationshipFieldSingleValidation, RelationshipFieldValidation, RelationshipValue, RenderConfigArgs, RenderDocumentVersionsProperties, RenderEntityConfigArgs, RenderFieldConfigArgs, RenderRootConfigArgs, RenderedField, ReplaceAny, RequestContext, RequiredDataFromCollection, RequiredDataFromCollectionSlug, ResolvedComponent, ResolvedFilterOptions, RichTextAdapter, RichTextAdapterProvider, RichTextField, RichTextFieldClient, RichTextFieldClientComponent, RichTextFieldClientProps, RichTextFieldDescriptionClientComponent, RichTextFieldDescriptionServerComponent, RichTextFieldDiffClientComponent, RichTextFieldDiffServerComponent, RichTextFieldErrorClientComponent, RichTextFieldErrorServerComponent, RichTextFieldLabelClientComponent, RichTextFieldLabelServerComponent, RichTextFieldServerComponent, RichTextFieldServerProps, RichTextFieldValidation, RichTextHooks, RollbackTransaction, RootLivePreviewConfig, Row, RowField, RowFieldClient, RowFieldClientComponent, RowFieldClientProps, RowFieldDescriptionClientComponent, RowFieldDescriptionServerComponent, RowFieldDiffClientComponent, RowFieldDiffServerComponent, RowFieldErrorClientComponent, RowFieldErrorServerComponent, RowFieldLabelClientComponent, RowFieldLabelServerComponent, RowFieldServerComponent, RowFieldServerProps, RowLabel, RowLabelComponent, RunInlineTaskFunction, RunJobAccess, RunJobAccessArgs, RunTaskFunction, RunTaskFunctions, RunningJob, SanitizeFieldArgs, SanitizedBlockPermissions, SanitizedBlocksPermissions, SanitizedCollectionConfig, SanitizedCollectionPermission, SanitizedCompoundIndex, SanitizedConfig, SanitizedDashboardConfig, SanitizedDocumentPermissions, SanitizedFieldPermissions, SanitizedFieldsPermissions, SanitizedGlobalConfig, SanitizedGlobalPermission, SanitizedJoins, SanitizedLabelProps, SanitizedLocalizationConfig, SanitizedPermissions, SanitizedUploadConfig, SaveButtonClientProps, SaveButtonServerProps, SaveButtonServerPropsOnly, SaveDraftButtonClientProps, SaveDraftButtonServerProps, SaveDraftButtonServerPropsOnly, SchedulePublish, SchedulePublishTaskInput, SelectExcludeType, SelectField, SelectFieldClient, SelectFieldClientComponent, SelectFieldClientProps, SelectFieldDescriptionClientComponent, SelectFieldDescriptionServerComponent, SelectFieldDiffClientComponent, SelectFieldDiffServerComponent, SelectFieldErrorClientComponent, SelectFieldErrorServerComponent, SelectFieldLabelClientComponent, SelectFieldLabelServerComponent, SelectFieldManyValidation, SelectFieldServerComponent, SelectFieldServerProps, SelectFieldSingleValidation, SelectFieldValidation, SelectIncludeType, SelectMode, SelectType, SendEmailOptions, ServerComponentProps, ServerFieldBase, ServerFunction, ServerFunctionArgs, ServerFunctionClient, ServerFunctionClientArgs, ServerFunctionConfig, ServerFunctionHandler, ServerOnlyCollectionAdminProperties, ServerOnlyCollectionProperties, ServerOnlyFieldAdminProperties, ServerOnlyFieldProperties, ServerOnlyGlobalAdminProperties, ServerOnlyGlobalProperties, ServerOnlyLivePreviewProperties, ServerOnlyUploadProperties, ServerProps, ServerPropsFromView, DocumentViewServerProps as ServerSideEditViewProps, SharedProps, SharpDependency, SingleRelationshipField, SingleRelationshipFieldClient, SingleTaskStatus, SlugField, SlugFieldClientProps, SlugifyServerFunctionArgs, Sort, LocalizeStatusArgs as SqlLocalizeStatusArgs, StaticDescription, StaticLabel, StringKeyOf, Tab, TabAsField, TabAsFieldClient, TabsField, TabsFieldClient, TabsFieldClientComponent, TabsFieldClientProps, TabsFieldDescriptionClientComponent, TabsFieldDescriptionServerComponent, TabsFieldDiffClientComponent, TabsFieldDiffServerComponent, TabsFieldErrorClientComponent, TabsFieldErrorServerComponent, TabsFieldLabelClientComponent, TabsFieldLabelServerComponent, TabsFieldServerComponent, TabsFieldServerProps, TabsPreferences, TaskConfig, TaskHandler, TaskHandlerArgs, TaskHandlerResult, TaskHandlerResults, TaskInput, TaskOutput, TaskType, TextField, TextFieldClient, TextFieldClientComponent, TextFieldClientProps, TextFieldDescriptionClientComponent, TextFieldDescriptionServerComponent, TextFieldDiffClientComponent, TextFieldDiffServerComponent, TextFieldErrorClientComponent, TextFieldErrorServerComponent, TextFieldLabelClientComponent, TextFieldLabelServerComponent, TextFieldManyValidation, TextFieldServerComponent, TextFieldServerProps, TextFieldSingleValidation, TextFieldValidation, TextareaField, TextareaFieldClient, TextareaFieldClientComponent, TextareaFieldClientProps, TextareaFieldDescriptionClientComponent, TextareaFieldDescriptionServerComponent, TextareaFieldDiffClientComponent, TextareaFieldDiffServerComponent, TextareaFieldErrorClientComponent, TextareaFieldErrorServerComponent, TextareaFieldLabelClientComponent, TextareaFieldLabelServerComponent, TextareaFieldServerComponent, TextareaFieldServerProps, TextareaFieldValidation, TimePickerProps, Timezone, TimezonesConfig, Transaction, TransformCollectionWithSelect, TransformDataWithSelect, TransformGlobalWithSelect, TraverseFieldsCallback, TypeWithID, TypeWithTimestamps, TypeWithVersion, TypedAuthOperations, TypedBlock, TypedCollection, TypedCollectionJoins, TypedCollectionSelect, TypedFallbackLocale, TypedGlobal, TypedGlobalSelect, TypedJobs, TypedLocale, TypedUploadCollection, TypedUser, TypedWidget, UIField, UIFieldClient, UIFieldClientComponent, UIFieldClientProps, UIFieldDiffClientComponent, UIFieldDiffServerComponent, UIFieldServerComponent, UIFieldServerProps, UnauthenticatedClientConfig, UnnamedGroupField, UnnamedGroupFieldClient, UnnamedTab, UnpublishButtonClientProps, UnpublishButtonServerProps, UnpublishButtonServerPropsOnly, UntypedPayloadTypes, UntypedUser, UpdateGlobal, UpdateGlobalArgs, UpdateGlobalVersion, UpdateGlobalVersionArgs, UpdateJobs, UpdateJobsArgs, UpdateMany, UpdateManyArgs, UpdateOne, UpdateOneArgs, UpdateVersion, UpdateVersionArgs, UploadCollectionSlug, UploadConfig, UploadEdits, UploadField, UploadFieldClient, UploadFieldClientComponent, UploadFieldClientProps, UploadFieldDescriptionClientComponent, UploadFieldDescriptionServerComponent, UploadFieldDiffClientComponent, UploadFieldDiffServerComponent, UploadFieldErrorClientComponent, UploadFieldErrorServerComponent, UploadFieldLabelClientComponent, UploadFieldLabelServerComponent, UploadFieldManyValidation, UploadFieldServerComponent, UploadFieldServerProps, UploadFieldSingleValidation, UploadFieldValidation, Upsert, UpsertArgs, UntypedUser as User, UserSession, UsernameFieldValidation, Validate, ValidateOptions, ValidationFieldError, ValueWithRelation, VerifyConfig, VersionField, VersionOperations, VersionTab, ViewDescriptionClientProps, ViewDescriptionServerProps, ViewDescriptionServerPropsOnly, ViewTypes, VisibleEntities, Where, WhereField, Widget, WidgetInstance, WidgetServerProps, WidgetSlug, WidgetWidth, WithServerSidePropsComponent, WithServerSidePropsComponentProps, WorkflowConfig, WorkflowHandler, WorkflowTypes, checkFileRestrictionsParams };
|
|
@@ -1,11 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export type DeepMergeArrayMergeOptions = {
|
|
2
|
+
cloneUnlessOtherwiseSpecified(value: object, options?: DeepMergeOptions): any;
|
|
3
|
+
isMergeableObject(value: object): boolean;
|
|
4
|
+
};
|
|
5
|
+
export type DeepMergeOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* Merges two arrays. Defaults to concatenating `target` and `source`.
|
|
8
|
+
*/
|
|
9
|
+
arrayMerge?: (target: any[], source: any[], options: ResolvedDeepMergeOptions) => any[];
|
|
10
|
+
/**
|
|
11
|
+
* When `false`, mergeable values are copied by reference instead of being deeply cloned.
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
clone?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Returns a custom merge function for a given key, or `undefined` to use the default merge.
|
|
17
|
+
*/
|
|
18
|
+
customMerge?: (key: string, options?: DeepMergeOptions) => ((x: any, y: any) => any) | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Determines whether a value should be merged recursively or copied as-is.
|
|
21
|
+
*/
|
|
22
|
+
isMergeableObject?(value: object): boolean;
|
|
23
|
+
};
|
|
24
|
+
type ResolvedDeepMergeOptions = {
|
|
25
|
+
arrayMerge: NonNullable<DeepMergeOptions['arrayMerge']>;
|
|
26
|
+
isMergeableObject: (value: unknown) => boolean;
|
|
27
|
+
} & DeepMergeArrayMergeOptions & DeepMergeOptions;
|
|
28
|
+
/**
|
|
29
|
+
* Fully-featured deepMerge. Returns a new object and does not mutate its arguments.
|
|
30
|
+
*
|
|
31
|
+
* Array handling: arrays are concatenated unless `arrayMerge` is provided.
|
|
32
|
+
*
|
|
33
|
+
* `__proto__` keys are never copied to the result, preventing prototype poisoning of the returned
|
|
34
|
+
* object when merging untrusted input (e.g. parsed JSON).
|
|
35
|
+
*/
|
|
36
|
+
export declare function deepMerge<T>(x: Partial<T>, y: Partial<T>, options?: DeepMergeOptions): T;
|
|
37
|
+
export declare function deepMerge<T1, T2>(x: Partial<T1>, y: Partial<T2>, options?: DeepMergeOptions): T1 & T2;
|
|
38
|
+
export declare namespace deepMerge {
|
|
39
|
+
var all: typeof deepMergeAll;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Keeps the `deepMerge.Options` / `deepMerge.ArrayMergeOptions` type references from the former
|
|
43
|
+
* `deepmerge` dependency working.
|
|
44
|
+
*/
|
|
45
|
+
export declare namespace deepMerge {
|
|
46
|
+
type ArrayMergeOptions = DeepMergeArrayMergeOptions;
|
|
47
|
+
type Options = DeepMergeOptions;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Deep-merges all objects in the array, from left to right.
|
|
51
|
+
*/
|
|
52
|
+
declare function deepMergeAll<T = object>(objects: Partial<T>[], options?: DeepMergeOptions): T;
|
|
53
|
+
declare function deepMergeAll(objects: object[], options?: DeepMergeOptions): object;
|
|
3
54
|
/**
|
|
4
55
|
* Fully-featured deepMerge.
|
|
5
56
|
*
|
|
6
57
|
* Array handling: Arrays in the target object are combined with the source object's arrays.
|
|
7
58
|
*/
|
|
8
|
-
export declare function deepMergeWithCombinedArrays<T extends object>(obj1: object, obj2: object, options?:
|
|
59
|
+
export declare function deepMergeWithCombinedArrays<T extends object>(obj1: object, obj2: object, options?: DeepMergeOptions): T;
|
|
9
60
|
/**
|
|
10
61
|
* Fully-featured deepMerge.
|
|
11
62
|
*
|
|
@@ -16,4 +67,5 @@ export declare function deepMergeWithSourceArrays<T extends object>(obj1: object
|
|
|
16
67
|
* Fully-featured deepMerge. Does not clone React components by default.
|
|
17
68
|
*/
|
|
18
69
|
export declare function deepMergeWithReactComponents<T extends object>(obj1: object, obj2: object): T;
|
|
70
|
+
export {};
|
|
19
71
|
//# sourceMappingURL=deepMerge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deepMerge.d.ts","sourceRoot":"","sources":["../../src/utilities/deepMerge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deepMerge.d.ts","sourceRoot":"","sources":["../../src/utilities/deepMerge.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,0BAA0B,GAAG;IACvC,6BAA6B,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,GAAG,CAAA;IAC7E,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,gBAAg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ACH,iBAAS,YAAY,CAAC,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,CAAC,CAAA;AACvF,iBAAS,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAAA;AAW5E;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,MAAM,EAC1D,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,gBAAqB,GAC7B,CAAC,CAkBH;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAEzF;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAI5F"}
|
|
@@ -1,6 +1,34 @@
|
|
|
1
|
-
import deepMerge from 'deepmerge';
|
|
2
1
|
import { isPlainObject } from './isPlainObject.js';
|
|
3
|
-
|
|
2
|
+
const REACT_ELEMENT_TYPES = new Set([
|
|
3
|
+
Symbol.for('react.element'),
|
|
4
|
+
Symbol.for('react.transitional.element')
|
|
5
|
+
]);
|
|
6
|
+
export function deepMerge(target, source, options) {
|
|
7
|
+
// Copied rather than mutated, so that a reused options object is left untouched.
|
|
8
|
+
const resolvedOptions = {
|
|
9
|
+
...options,
|
|
10
|
+
arrayMerge: options?.arrayMerge || defaultArrayMerge,
|
|
11
|
+
// Exposed on `options` so that custom `arrayMerge` implementations can use it.
|
|
12
|
+
cloneUnlessOtherwiseSpecified: cloneUnlessOtherwiseSpecified,
|
|
13
|
+
isMergeableObject: options?.isMergeableObject || isMergeableObject
|
|
14
|
+
};
|
|
15
|
+
const isSourceArray = Array.isArray(source);
|
|
16
|
+
const isTargetArray = Array.isArray(target);
|
|
17
|
+
if (isSourceArray !== isTargetArray) {
|
|
18
|
+
return cloneUnlessOtherwiseSpecified(source, resolvedOptions);
|
|
19
|
+
}
|
|
20
|
+
if (isSourceArray) {
|
|
21
|
+
return resolvedOptions.arrayMerge(target, source, resolvedOptions);
|
|
22
|
+
}
|
|
23
|
+
return mergeObject(target, source, resolvedOptions);
|
|
24
|
+
}
|
|
25
|
+
function deepMergeAll(objects, options) {
|
|
26
|
+
if (!Array.isArray(objects)) {
|
|
27
|
+
throw new Error('first argument should be an array');
|
|
28
|
+
}
|
|
29
|
+
return objects.reduce((previous, next)=>deepMerge(previous, next, options), {});
|
|
30
|
+
}
|
|
31
|
+
deepMerge.all = deepMergeAll;
|
|
4
32
|
/**
|
|
5
33
|
* Fully-featured deepMerge.
|
|
6
34
|
*
|
|
@@ -39,5 +67,72 @@ export { deepMerge };
|
|
|
39
67
|
isMergeableObject: isPlainObject
|
|
40
68
|
});
|
|
41
69
|
}
|
|
70
|
+
function isMergeableObject(value) {
|
|
71
|
+
if (!value || typeof value !== 'object') {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
const stringTag = Object.prototype.toString.call(value);
|
|
75
|
+
if (stringTag === '[object RegExp]' || stringTag === '[object Date]') {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
return !REACT_ELEMENT_TYPES.has(value.$$typeof);
|
|
79
|
+
}
|
|
80
|
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
81
|
+
return options.clone !== false && options.isMergeableObject(value) ? deepMerge(Array.isArray(value) ? [] : {}, value, options) : value;
|
|
82
|
+
}
|
|
83
|
+
function defaultArrayMerge(target, source, options) {
|
|
84
|
+
return target.concat(source).map((element)=>cloneUnlessOtherwiseSpecified(element, options));
|
|
85
|
+
}
|
|
86
|
+
function getMergeFunction(key, options) {
|
|
87
|
+
if (!options.customMerge) {
|
|
88
|
+
return deepMerge;
|
|
89
|
+
}
|
|
90
|
+
const customMerge = options.customMerge(key, options);
|
|
91
|
+
return typeof customMerge === 'function' ? customMerge : deepMerge;
|
|
92
|
+
}
|
|
93
|
+
function getEnumerableOwnKeys(value) {
|
|
94
|
+
return [
|
|
95
|
+
...Object.keys(value),
|
|
96
|
+
...Object.getOwnPropertySymbols(value).filter((symbol)=>Object.prototype.propertyIsEnumerable.call(value, symbol))
|
|
97
|
+
];
|
|
98
|
+
}
|
|
99
|
+
function isPropertyOnObject(object, property) {
|
|
100
|
+
try {
|
|
101
|
+
return property in object;
|
|
102
|
+
} catch {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A key is unsafe to merge when it exists on the target but is inherited or non-enumerable, or when
|
|
108
|
+
* it is `__proto__`, which would replace the prototype of the returned object on assignment.
|
|
109
|
+
*/ function isUnsafeKey(target, key) {
|
|
110
|
+
if (key === '__proto__') {
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
return isPropertyOnObject(target, key) && !(Object.prototype.hasOwnProperty.call(target, key) && Object.prototype.propertyIsEnumerable.call(target, key));
|
|
114
|
+
}
|
|
115
|
+
function mergeObject(target, source, options) {
|
|
116
|
+
const destination = {};
|
|
117
|
+
if (options.isMergeableObject(target)) {
|
|
118
|
+
for (const key of getEnumerableOwnKeys(target)){
|
|
119
|
+
if (key === '__proto__') {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
for (const key of getEnumerableOwnKeys(source)){
|
|
126
|
+
if (isUnsafeKey(target, key)) {
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (isPropertyOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
130
|
+
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
131
|
+
} else {
|
|
132
|
+
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return destination;
|
|
136
|
+
}
|
|
42
137
|
|
|
43
138
|
//# sourceMappingURL=deepMerge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/deepMerge.ts"],"sourcesContent":["import deepMerge from 'deepmerge'\n\nimport { isPlainObject } from './isPlainObject.js'\n\nexport { deepMerge }\n/**\n * Fully-featured deepMerge.\n *\n * Array handling: Arrays in the target object are combined with the source object's arrays.\n */\nexport function deepMergeWithCombinedArrays<T extends object>(\n obj1: object,\n obj2: object,\n options: deepMerge.Options = {},\n): T {\n return deepMerge<T>(obj1, obj2, {\n arrayMerge: (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] = deepMerge(target[index], item, options)\n } else if (target.indexOf(item) === -1) {\n destination.push(item)\n }\n })\n return destination\n },\n ...options,\n })\n}\n\n/**\n * Fully-featured deepMerge.\n *\n * Array handling: Arrays in the target object are replaced by the source object's arrays.\n */\nexport function deepMergeWithSourceArrays<T extends object>(obj1: object, obj2: object): T {\n return deepMerge<T>(obj1, obj2, { arrayMerge: (_, source) => source })\n}\n\n/**\n * Fully-featured deepMerge. Does not clone React components by default.\n */\nexport function deepMergeWithReactComponents<T extends object>(obj1: object, obj2: object): T {\n return deepMerge<T>(obj1, obj2, {\n isMergeableObject: isPlainObject,\n })\n}\n"],"names":["deepMerge","isPlainObject","deepMergeWithCombinedArrays","obj1","obj2","options","arrayMerge","target","source","destination","slice","forEach","item","index","cloneUnlessOtherwiseSpecified","isMergeableObject","indexOf","push","deepMergeWithSourceArrays","_","deepMergeWithReactComponents"],"mappings":"AAAA,OAAOA,eAAe,YAAW;AAEjC,SAASC,aAAa,QAAQ,qBAAoB;AAElD,SAASD,SAAS,GAAE;AACpB;;;;CAIC,GACD,OAAO,SAASE,4BACdC,IAAY,EACZC,IAAY,EACZC,UAA6B,CAAC,CAAC;IAE/B,OAAOL,UAAaG,MAAMC,MAAM;QAC9BE,YAAY,CAACC,QAAQC,QAAQH;YAC3B,MAAMI,cAAcF,OAAOG,KAAK;YAEhCF,OAAOG,OAAO,CAAC,CAACC,MAAMC;gBACpB,IAAI,OAAOJ,WAAW,CAACI,MAAM,KAAK,aAAa;oBAC7CJ,WAAW,CAACI,MAAM,GAAGR,SAASS,8BAA8BF,MAAMP;gBACpE,OAAO,IAAIA,SAASU,kBAAkBH,OAAO;oBAC3CH,WAAW,CAACI,MAAM,GAAGb,UAAUO,MAAM,CAACM,MAAM,EAAED,MAAMP;gBACtD,OAAO,IAAIE,OAAOS,OAAO,CAACJ,UAAU,CAAC,GAAG;oBACtCH,YAAYQ,IAAI,CAACL;gBACnB;YACF;YACA,OAAOH;QACT;QACA,GAAGJ,OAAO;IACZ;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASa,0BAA4Cf,IAAY,EAAEC,IAAY;IACpF,OAAOJ,UAAaG,MAAMC,MAAM;QAAEE,YAAY,CAACa,GAAGX,SAAWA;IAAO;AACtE;AAEA;;CAEC,GACD,OAAO,SAASY,6BAA+CjB,IAAY,EAAEC,IAAY;IACvF,OAAOJ,UAAaG,MAAMC,MAAM;QAC9BW,mBAAmBd;IACrB;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/deepMerge.ts"],"sourcesContent":["import { isPlainObject } from './isPlainObject.js'\n\nexport type DeepMergeArrayMergeOptions = {\n cloneUnlessOtherwiseSpecified(value: object, options?: DeepMergeOptions): any\n isMergeableObject(value: object): boolean\n}\n\nexport type DeepMergeOptions = {\n /**\n * Merges two arrays. Defaults to concatenating `target` and `source`.\n */\n arrayMerge?: (target: any[], source: any[], options: ResolvedDeepMergeOptions) => any[]\n /**\n * When `false`, mergeable values are copied by reference instead of being deeply cloned.\n * @default true\n */\n clone?: boolean\n /**\n * Returns a custom merge function for a given key, or `undefined` to use the default merge.\n */\n customMerge?: (key: string, options?: DeepMergeOptions) => ((x: any, y: any) => any) | undefined\n /**\n * Determines whether a value should be merged recursively or copied as-is.\n */\n isMergeableObject?(value: object): boolean\n}\n\ntype ResolvedDeepMergeOptions = {\n arrayMerge: NonNullable<DeepMergeOptions['arrayMerge']>\n isMergeableObject: (value: unknown) => boolean\n} & DeepMergeArrayMergeOptions &\n DeepMergeOptions\n\nconst REACT_ELEMENT_TYPES = new Set<unknown>([\n Symbol.for('react.element'),\n Symbol.for('react.transitional.element'),\n])\n\n/**\n * Fully-featured deepMerge. Returns a new object and does not mutate its arguments.\n *\n * Array handling: arrays are concatenated unless `arrayMerge` is provided.\n *\n * `__proto__` keys are never copied to the result, preventing prototype poisoning of the returned\n * object when merging untrusted input (e.g. parsed JSON).\n */\nexport function deepMerge<T>(x: Partial<T>, y: Partial<T>, options?: DeepMergeOptions): T\nexport function deepMerge<T1, T2>(\n x: Partial<T1>,\n y: Partial<T2>,\n options?: DeepMergeOptions,\n): T1 & T2\nexport function deepMerge(target: any, source: any, options?: DeepMergeOptions): any {\n // Copied rather than mutated, so that a reused options object is left untouched.\n const resolvedOptions = {\n ...options,\n arrayMerge: options?.arrayMerge || defaultArrayMerge,\n // Exposed on `options` so that custom `arrayMerge` implementations can use it.\n cloneUnlessOtherwiseSpecified: cloneUnlessOtherwiseSpecified as any,\n isMergeableObject: options?.isMergeableObject || isMergeableObject,\n } as ResolvedDeepMergeOptions\n\n const isSourceArray = Array.isArray(source)\n const isTargetArray = Array.isArray(target)\n\n if (isSourceArray !== isTargetArray) {\n return cloneUnlessOtherwiseSpecified(source, resolvedOptions)\n }\n\n if (isSourceArray) {\n return resolvedOptions.arrayMerge(target, source, resolvedOptions)\n }\n\n return mergeObject(target, source, resolvedOptions)\n}\n\n/**\n * Keeps the `deepMerge.Options` / `deepMerge.ArrayMergeOptions` type references from the former\n * `deepmerge` dependency working.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace deepMerge {\n type ArrayMergeOptions = DeepMergeArrayMergeOptions\n type Options = DeepMergeOptions\n}\n\n/**\n * Deep-merges all objects in the array, from left to right.\n */\nfunction deepMergeAll<T = object>(objects: Partial<T>[], options?: DeepMergeOptions): T\nfunction deepMergeAll(objects: object[], options?: DeepMergeOptions): object\nfunction deepMergeAll(objects: object[], options?: DeepMergeOptions): object {\n if (!Array.isArray(objects)) {\n throw new Error('first argument should be an array')\n }\n\n return objects.reduce<object>((previous, next) => deepMerge(previous, next, options), {})\n}\n\ndeepMerge.all = deepMergeAll\n\n/**\n * Fully-featured deepMerge.\n *\n * Array handling: Arrays in the target object are combined with the source object's arrays.\n */\nexport function deepMergeWithCombinedArrays<T extends object>(\n obj1: object,\n obj2: object,\n options: DeepMergeOptions = {},\n): T {\n return deepMerge<T>(obj1, obj2, {\n arrayMerge: (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] = deepMerge(target[index], item, options)\n } else if (target.indexOf(item) === -1) {\n destination.push(item)\n }\n })\n return destination\n },\n ...options,\n })\n}\n\n/**\n * Fully-featured deepMerge.\n *\n * Array handling: Arrays in the target object are replaced by the source object's arrays.\n */\nexport function deepMergeWithSourceArrays<T extends object>(obj1: object, obj2: object): T {\n return deepMerge<T>(obj1, obj2, { arrayMerge: (_, source) => source })\n}\n\n/**\n * Fully-featured deepMerge. Does not clone React components by default.\n */\nexport function deepMergeWithReactComponents<T extends object>(obj1: object, obj2: object): T {\n return deepMerge<T>(obj1, obj2, {\n isMergeableObject: isPlainObject,\n })\n}\n\nfunction isMergeableObject(value: unknown): boolean {\n if (!value || typeof value !== 'object') {\n return false\n }\n\n const stringTag = Object.prototype.toString.call(value)\n\n if (stringTag === '[object RegExp]' || stringTag === '[object Date]') {\n return false\n }\n\n return !REACT_ELEMENT_TYPES.has((value as { $$typeof?: unknown }).$$typeof)\n}\n\nfunction cloneUnlessOtherwiseSpecified(value: unknown, options: ResolvedDeepMergeOptions): any {\n return options.clone !== false && options.isMergeableObject(value)\n ? deepMerge<object>(Array.isArray(value) ? [] : {}, value as object, options)\n : value\n}\n\nfunction defaultArrayMerge(target: any[], source: any[], options: ResolvedDeepMergeOptions) {\n return target.concat(source).map((element) => cloneUnlessOtherwiseSpecified(element, options))\n}\n\nfunction getMergeFunction(key: PropertyKey, options: ResolvedDeepMergeOptions) {\n if (!options.customMerge) {\n return deepMerge\n }\n\n const customMerge = options.customMerge(key as string, options)\n\n return typeof customMerge === 'function' ? customMerge : deepMerge\n}\n\nfunction getEnumerableOwnKeys(value: object): PropertyKey[] {\n return [\n ...Object.keys(value),\n ...Object.getOwnPropertySymbols(value).filter((symbol) =>\n Object.prototype.propertyIsEnumerable.call(value, symbol),\n ),\n ]\n}\n\nfunction isPropertyOnObject(object: object, property: PropertyKey): boolean {\n try {\n return property in object\n } catch {\n return false\n }\n}\n\n/**\n * A key is unsafe to merge when it exists on the target but is inherited or non-enumerable, or when\n * it is `__proto__`, which would replace the prototype of the returned object on assignment.\n */\nfunction isUnsafeKey(target: object, key: PropertyKey): boolean {\n if (key === '__proto__') {\n return true\n }\n\n return (\n isPropertyOnObject(target, key) &&\n !(\n Object.prototype.hasOwnProperty.call(target, key) &&\n Object.prototype.propertyIsEnumerable.call(target, key)\n )\n )\n}\n\nfunction mergeObject(target: any, source: any, options: ResolvedDeepMergeOptions) {\n const destination: Record<PropertyKey, unknown> = {}\n\n if (options.isMergeableObject(target)) {\n for (const key of getEnumerableOwnKeys(target)) {\n if (key === '__proto__') {\n continue\n }\n\n destination[key] = cloneUnlessOtherwiseSpecified(target[key], options)\n }\n }\n\n for (const key of getEnumerableOwnKeys(source)) {\n if (isUnsafeKey(target, key)) {\n continue\n }\n\n if (isPropertyOnObject(target, key) && options.isMergeableObject(source[key])) {\n destination[key] = getMergeFunction(key, options)(target[key], source[key], options)\n } else {\n destination[key] = cloneUnlessOtherwiseSpecified(source[key], options)\n }\n }\n\n return destination\n}\n"],"names":["isPlainObject","REACT_ELEMENT_TYPES","Set","Symbol","for","deepMerge","target","source","options","resolvedOptions","arrayMerge","defaultArrayMerge","cloneUnlessOtherwiseSpecified","isMergeableObject","isSourceArray","Array","isArray","isTargetArray","mergeObject","deepMergeAll","objects","Error","reduce","previous","next","all","deepMergeWithCombinedArrays","obj1","obj2","destination","slice","forEach","item","index","indexOf","push","deepMergeWithSourceArrays","_","deepMergeWithReactComponents","value","stringTag","Object","prototype","toString","call","has","$$typeof","clone","concat","map","element","getMergeFunction","key","customMerge","getEnumerableOwnKeys","keys","getOwnPropertySymbols","filter","symbol","propertyIsEnumerable","isPropertyOnObject","object","property","isUnsafeKey","hasOwnProperty"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAoB;AAiClD,MAAMC,sBAAsB,IAAIC,IAAa;IAC3CC,OAAOC,GAAG,CAAC;IACXD,OAAOC,GAAG,CAAC;CACZ;AAgBD,OAAO,SAASC,UAAUC,MAAW,EAAEC,MAAW,EAAEC,OAA0B;IAC5E,iFAAiF;IACjF,MAAMC,kBAAkB;QACtB,GAAGD,OAAO;QACVE,YAAYF,SAASE,cAAcC;QACnC,+EAA+E;QAC/EC,+BAA+BA;QAC/BC,mBAAmBL,SAASK,qBAAqBA;IACnD;IAEA,MAAMC,gBAAgBC,MAAMC,OAAO,CAACT;IACpC,MAAMU,gBAAgBF,MAAMC,OAAO,CAACV;IAEpC,IAAIQ,kBAAkBG,eAAe;QACnC,OAAOL,8BAA8BL,QAAQE;IAC/C;IAEA,IAAIK,eAAe;QACjB,OAAOL,gBAAgBC,UAAU,CAACJ,QAAQC,QAAQE;IACpD;IAEA,OAAOS,YAAYZ,QAAQC,QAAQE;AACrC;AAiBA,SAASU,aAAaC,OAAiB,EAAEZ,OAA0B;IACjE,IAAI,CAACO,MAAMC,OAAO,CAACI,UAAU;QAC3B,MAAM,IAAIC,MAAM;IAClB;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G;AAG5D;AAEA,SAASlC,YAAYZ,MAAW,EAAEC,MAAW,EAAEC,OAAiC;IAC9E,MAAMqB,cAA4C,CAAC;IAEnD,IAAIrB,QAAQK,iBAAiB,CAACP,SAAS;QACrC,KAAK,MAAM8C,OAAOE,qBAAqBhD,QAAS;YAC9C,IAAI8C,QAAQ,aAAa;gBACvB;YACF;YAEAvB,WAAW,CAACuB,IAAI,GAAGxC,8BAA8BN,MAAM,CAAC8C,IAAI,EAAE5C;QAChE;IACF;IAEA,KAAK,MAAM4C,OAAOE,qBAAqB/C,QAAS;QAC9C,IAAIwD,YAAYzD,QAAQ8C,MAAM;YAC5B;QACF;QAEA,IAAIQ,mBAAmBtD,QAAQ8C,QAAQ5C,QAAQK,iBAAiB,CAACN,MAAM,CAAC6C,IAAI,GAAG;YAC7EvB,WAAW,CAACuB,IAAI,GAAGD,iBAAiBC,KAAK5C,SAASF,MAAM,CAAC8C,IAAI,EAAE7C,MAAM,CAAC6C,IAAI,EAAE5C;QAC9E,OAAO;YACLqB,WAAW,CAACuB,IAAI,GAAGxC,8BAA8BL,MAAM,CAAC6C,IAAI,EAAE5C;QAChE;IACF;IAEA,OAAOqB;AACT"}
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { deepMerge, deepMergeWithCombinedArrays, deepMergeWithReactComponents, deepMergeWithSourceArrays } from './deepMerge.js';
|
|
3
|
+
describe('deepMerge', ()=>{
|
|
4
|
+
it('should deeply merge nested objects with source taking precedence', ()=>{
|
|
5
|
+
const result = deepMerge({
|
|
6
|
+
a: {
|
|
7
|
+
b: 1,
|
|
8
|
+
c: 2
|
|
9
|
+
},
|
|
10
|
+
d: 1
|
|
11
|
+
}, {
|
|
12
|
+
a: {
|
|
13
|
+
c: 3,
|
|
14
|
+
e: 4
|
|
15
|
+
},
|
|
16
|
+
f: 5
|
|
17
|
+
});
|
|
18
|
+
expect(result).toStrictEqual({
|
|
19
|
+
a: {
|
|
20
|
+
b: 1,
|
|
21
|
+
c: 3,
|
|
22
|
+
e: 4
|
|
23
|
+
},
|
|
24
|
+
d: 1,
|
|
25
|
+
f: 5
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
it('should not mutate its arguments and should clone nested values', ()=>{
|
|
29
|
+
const target = {
|
|
30
|
+
nested: {
|
|
31
|
+
value: 1
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const source = {
|
|
35
|
+
other: {
|
|
36
|
+
value: 2
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const result = deepMerge(target, source);
|
|
40
|
+
expect(target).toStrictEqual({
|
|
41
|
+
nested: {
|
|
42
|
+
value: 1
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
expect(source).toStrictEqual({
|
|
46
|
+
other: {
|
|
47
|
+
value: 2
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
expect(result.nested).not.toBe(target.nested);
|
|
51
|
+
expect(result.other).not.toBe(source.other);
|
|
52
|
+
});
|
|
53
|
+
it('should keep references when clone is false', ()=>{
|
|
54
|
+
const nested = {
|
|
55
|
+
value: 1
|
|
56
|
+
};
|
|
57
|
+
const result = deepMerge({}, {
|
|
58
|
+
nested
|
|
59
|
+
}, {
|
|
60
|
+
clone: false
|
|
61
|
+
});
|
|
62
|
+
expect(result.nested).toBe(nested);
|
|
63
|
+
});
|
|
64
|
+
it('should concatenate arrays by default', ()=>{
|
|
65
|
+
const result = deepMerge({
|
|
66
|
+
list: [
|
|
67
|
+
1,
|
|
68
|
+
2
|
|
69
|
+
]
|
|
70
|
+
}, {
|
|
71
|
+
list: [
|
|
72
|
+
3
|
|
73
|
+
]
|
|
74
|
+
});
|
|
75
|
+
expect(result).toStrictEqual({
|
|
76
|
+
list: [
|
|
77
|
+
1,
|
|
78
|
+
2,
|
|
79
|
+
3
|
|
80
|
+
]
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
it('should not deeply merge dates and regular expressions', ()=>{
|
|
84
|
+
const date = new Date();
|
|
85
|
+
const regex = /test/;
|
|
86
|
+
const result = deepMerge({
|
|
87
|
+
date: {},
|
|
88
|
+
regex: {}
|
|
89
|
+
}, {
|
|
90
|
+
date,
|
|
91
|
+
regex
|
|
92
|
+
});
|
|
93
|
+
expect(result.date).toBe(date);
|
|
94
|
+
expect(result.regex).toBe(regex);
|
|
95
|
+
});
|
|
96
|
+
it('should merge enumerable symbol keys', ()=>{
|
|
97
|
+
const symbol = Symbol('key');
|
|
98
|
+
const result = deepMerge({
|
|
99
|
+
[symbol]: {
|
|
100
|
+
a: 1
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
[symbol]: {
|
|
104
|
+
b: 2
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
expect(result[symbol]).toStrictEqual({
|
|
108
|
+
a: 1,
|
|
109
|
+
b: 2
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
it('should use customMerge for matching keys', ()=>{
|
|
113
|
+
const result = deepMerge({
|
|
114
|
+
a: {
|
|
115
|
+
x: 1
|
|
116
|
+
},
|
|
117
|
+
b: {
|
|
118
|
+
x: 1
|
|
119
|
+
}
|
|
120
|
+
}, {
|
|
121
|
+
a: {
|
|
122
|
+
y: 2
|
|
123
|
+
},
|
|
124
|
+
b: {
|
|
125
|
+
y: 2
|
|
126
|
+
}
|
|
127
|
+
}, {
|
|
128
|
+
customMerge: (key)=>key === 'a' ? (_x, y)=>y : undefined
|
|
129
|
+
});
|
|
130
|
+
expect(result).toStrictEqual({
|
|
131
|
+
a: {
|
|
132
|
+
y: 2
|
|
133
|
+
},
|
|
134
|
+
b: {
|
|
135
|
+
x: 1,
|
|
136
|
+
y: 2
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
it('should merge all objects with deepMerge.all', ()=>{
|
|
141
|
+
const result = deepMerge.all([
|
|
142
|
+
{
|
|
143
|
+
a: {
|
|
144
|
+
x: 1
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
a: {
|
|
149
|
+
y: 2
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
b: 3
|
|
154
|
+
}
|
|
155
|
+
]);
|
|
156
|
+
expect(result).toStrictEqual({
|
|
157
|
+
a: {
|
|
158
|
+
x: 1,
|
|
159
|
+
y: 2
|
|
160
|
+
},
|
|
161
|
+
b: 3
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
it('should not poison the prototype of the result via a __proto__ key in the source', ()=>{
|
|
165
|
+
const target = JSON.parse('{"__proto__": {}}');
|
|
166
|
+
const source = JSON.parse('{"__proto__": {"isAdmin": true}}');
|
|
167
|
+
const result = deepMerge(target, source);
|
|
168
|
+
expect(Object.getPrototypeOf(result)).toBe(Object.prototype);
|
|
169
|
+
expect(result.isAdmin).toBeUndefined();
|
|
170
|
+
});
|
|
171
|
+
it('should not poison the prototype of the result via a __proto__ key in the target', ()=>{
|
|
172
|
+
const target = JSON.parse('{"__proto__": {"isAdmin": true}}');
|
|
173
|
+
const result = deepMerge(target, {});
|
|
174
|
+
expect(Object.getPrototypeOf(result)).toBe(Object.prototype);
|
|
175
|
+
expect(result.isAdmin).toBeUndefined();
|
|
176
|
+
});
|
|
177
|
+
it('should not pollute Object.prototype via constructor.prototype', ()=>{
|
|
178
|
+
const source = JSON.parse('{"constructor": {"prototype": {"polluted": true}}}');
|
|
179
|
+
deepMerge({}, source);
|
|
180
|
+
expect({}.polluted).toBeUndefined();
|
|
181
|
+
});
|
|
182
|
+
it('should not poison the prototype via a nested __proto__ key that only exists in the source', ()=>{
|
|
183
|
+
const source = JSON.parse('{"a": {"__proto__": {"isAdmin": true}}}');
|
|
184
|
+
const result = deepMerge({}, source);
|
|
185
|
+
expect(Object.getPrototypeOf(result.a)).toBe(Object.prototype);
|
|
186
|
+
expect(result.a.isAdmin).toBeUndefined();
|
|
187
|
+
});
|
|
188
|
+
it('should not poison the prototype via a __proto__ key inside array items', ()=>{
|
|
189
|
+
const source = JSON.parse('{"list": [{"__proto__": {"isAdmin": true}}]}');
|
|
190
|
+
const result = deepMerge({
|
|
191
|
+
list: []
|
|
192
|
+
}, source);
|
|
193
|
+
expect(Object.getPrototypeOf(result.list[0])).toBe(Object.prototype);
|
|
194
|
+
expect(result.list[0].isAdmin).toBeUndefined();
|
|
195
|
+
});
|
|
196
|
+
it('should not mutate the passed options object', ()=>{
|
|
197
|
+
const options = {
|
|
198
|
+
clone: true
|
|
199
|
+
};
|
|
200
|
+
deepMerge({
|
|
201
|
+
a: [
|
|
202
|
+
1
|
|
203
|
+
]
|
|
204
|
+
}, {
|
|
205
|
+
a: [
|
|
206
|
+
2
|
|
207
|
+
]
|
|
208
|
+
}, options);
|
|
209
|
+
expect(options).toStrictEqual({
|
|
210
|
+
clone: true
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
it('should not clone React 18 or React 19 elements', ()=>{
|
|
214
|
+
const react18Element = {
|
|
215
|
+
$$typeof: Symbol.for('react.element'),
|
|
216
|
+
props: {}
|
|
217
|
+
};
|
|
218
|
+
const react19Element = {
|
|
219
|
+
$$typeof: Symbol.for('react.transitional.element'),
|
|
220
|
+
props: {}
|
|
221
|
+
};
|
|
222
|
+
const result = deepMerge({}, {
|
|
223
|
+
react18: react18Element,
|
|
224
|
+
react19: react19Element
|
|
225
|
+
});
|
|
226
|
+
expect(result.react18).toBe(react18Element);
|
|
227
|
+
expect(result.react19).toBe(react19Element);
|
|
228
|
+
});
|
|
229
|
+
it('should accept the signatures of the former deepmerge dependency', ()=>{
|
|
230
|
+
const isMergeableObject = (value)=>Object.prototype.toString.call(value) === '[object Object]';
|
|
231
|
+
const options = {
|
|
232
|
+
isMergeableObject
|
|
233
|
+
};
|
|
234
|
+
const arrayMergeOptions = {
|
|
235
|
+
cloneUnlessOtherwiseSpecified: (value)=>value,
|
|
236
|
+
isMergeableObject
|
|
237
|
+
};
|
|
238
|
+
const merged = deepMerge.all([
|
|
239
|
+
{
|
|
240
|
+
a: 1
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
b: 'b'
|
|
244
|
+
}
|
|
245
|
+
], options);
|
|
246
|
+
const typed = deepMerge.all([
|
|
247
|
+
{
|
|
248
|
+
a: 1
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
b: 'b'
|
|
252
|
+
}
|
|
253
|
+
]);
|
|
254
|
+
expect(merged).toStrictEqual({
|
|
255
|
+
a: 1,
|
|
256
|
+
b: 'b'
|
|
257
|
+
});
|
|
258
|
+
expect(typed.b).toBe('b');
|
|
259
|
+
expect(arrayMergeOptions.cloneUnlessOtherwiseSpecified(merged)).toBe(merged);
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
describe('deepMergeWithSourceArrays', ()=>{
|
|
263
|
+
it('should replace target arrays with source arrays', ()=>{
|
|
264
|
+
const result = deepMergeWithSourceArrays({
|
|
265
|
+
list: [
|
|
266
|
+
1,
|
|
267
|
+
2
|
|
268
|
+
],
|
|
269
|
+
keep: true
|
|
270
|
+
}, {
|
|
271
|
+
list: [
|
|
272
|
+
3
|
|
273
|
+
]
|
|
274
|
+
});
|
|
275
|
+
expect(result).toStrictEqual({
|
|
276
|
+
keep: true,
|
|
277
|
+
list: [
|
|
278
|
+
3
|
|
279
|
+
]
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
describe('deepMergeWithCombinedArrays', ()=>{
|
|
284
|
+
it('should merge array items by index and append new primitives', ()=>{
|
|
285
|
+
const result = deepMergeWithCombinedArrays({
|
|
286
|
+
list: [
|
|
287
|
+
{
|
|
288
|
+
a: 1
|
|
289
|
+
},
|
|
290
|
+
'x'
|
|
291
|
+
]
|
|
292
|
+
}, {
|
|
293
|
+
list: [
|
|
294
|
+
{
|
|
295
|
+
b: 2
|
|
296
|
+
},
|
|
297
|
+
'y',
|
|
298
|
+
'z'
|
|
299
|
+
]
|
|
300
|
+
});
|
|
301
|
+
expect(result).toStrictEqual({
|
|
302
|
+
list: [
|
|
303
|
+
{
|
|
304
|
+
a: 1,
|
|
305
|
+
b: 2
|
|
306
|
+
},
|
|
307
|
+
'x',
|
|
308
|
+
'y',
|
|
309
|
+
'z'
|
|
310
|
+
]
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
describe('deepMergeWithReactComponents', ()=>{
|
|
315
|
+
it('should not clone functions', ()=>{
|
|
316
|
+
const Component = ()=>null;
|
|
317
|
+
const result = deepMergeWithReactComponents({
|
|
318
|
+
admin: {
|
|
319
|
+
components: {}
|
|
320
|
+
}
|
|
321
|
+
}, {
|
|
322
|
+
admin: {
|
|
323
|
+
components: {
|
|
324
|
+
Field: Component
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
expect(result.admin.components.Field).toBe(Component);
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
//# sourceMappingURL=deepMerge.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/deepMerge.spec.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest'\n\nimport {\n deepMerge,\n deepMergeWithCombinedArrays,\n deepMergeWithReactComponents,\n deepMergeWithSourceArrays,\n} from './deepMerge.js'\n\ndescribe('deepMerge', () => {\n it('should deeply merge nested objects with source taking precedence', () => {\n const result = deepMerge<Record<string, unknown>>(\n { a: { b: 1, c: 2 }, d: 1 },\n { a: { c: 3, e: 4 }, f: 5 },\n )\n\n expect(result).toStrictEqual({ a: { b: 1, c: 3, e: 4 }, d: 1, f: 5 })\n })\n\n it('should not mutate its arguments and should clone nested values', () => {\n const target = { nested: { value: 1 } }\n const source = { other: { value: 2 } }\n\n const result = deepMerge<Record<string, any>>(target, source)\n\n expect(target).toStrictEqual({ nested: { value: 1 } })\n expect(source).toStrictEqual({ other: { value: 2 } })\n expect(result.nested).not.toBe(target.nested)\n expect(result.other).not.toBe(source.other)\n })\n\n it('should keep references when clone is false', () => {\n const nested = { value: 1 }\n\n const result = deepMerge<Record<string, any>>({}, { nested }, { clone: false })\n\n expect(result.nested).toBe(nested)\n })\n\n it('should concatenate arrays by default', () => {\n const result = deepMerge<Record<string, unknown>>({ list: [1, 2] }, { list: [3] })\n\n expect(result).toStrictEqual({ list: [1, 2, 3] })\n })\n\n it('should not deeply merge dates and regular expressions', () => {\n const date = new Date()\n const regex = /test/\n\n const result = deepMerge<Record<string, unknown>>({ date: {}, regex: {} }, { date, regex })\n\n expect(result.date).toBe(date)\n expect(result.regex).toBe(regex)\n })\n\n it('should merge enumerable symbol keys', () => {\n const symbol = Symbol('key')\n\n const result = deepMerge<Record<symbol, unknown>>(\n { [symbol]: { a: 1 } },\n { [symbol]: { b: 2 } },\n )\n\n expect(result[symbol]).toStrictEqual({ a: 1, b: 2 })\n })\n\n it('should use customMerge for matching keys', () => {\n const result = deepMerge<Record<string, unknown>>(\n { a: { x: 1 }, b: { x: 1 } },\n { a: { y: 2 }, b: { y: 2 } },\n { customMerge: (key) => (key === 'a' ? (_x, y) => y : undefined) },\n )\n\n expect(result).toStrictEqual({ a: { y: 2 }, b: { x: 1, y: 2 } })\n })\n\n it('should merge all objects with deepMerge.all', () => {\n const result = deepMerge.all<Record<string, unknown>>([\n { a: { x: 1 } },\n { a: { y: 2 } },\n { b: 3 },\n ])\n\n expect(result).toStrictEqual({ a: { x: 1, y: 2 }, b: 3 })\n })\n\n it('should not poison the prototype of the result via a __proto__ key in the source', () => {\n const target = JSON.parse('{\"__proto__\": {}}')\n const source = JSON.parse('{\"__proto__\": {\"isAdmin\": true}}')\n\n const result = deepMerge<Record<string, unknown>>(target, source)\n\n expect(Object.getPrototypeOf(result)).toBe(Object.prototype)\n expect(result.isAdmin).toBeUndefined()\n })\n\n it('should not poison the prototype of the result via a __proto__ key in the target', () => {\n const target = JSON.parse('{\"__proto__\": {\"isAdmin\": true}}')\n\n const result = deepMerge<Record<string, unknown>>(target, {})\n\n expect(Object.getPrototypeOf(result)).toBe(Object.prototype)\n expect(result.isAdmin).toBeUndefined()\n })\n\n it('should not pollute Object.prototype via constructor.prototype', () => {\n const source = JSON.parse('{\"constructor\": {\"prototype\": {\"polluted\": true}}}')\n\n deepMerge({}, source)\n\n expect(({} as Record<string, unknown>).polluted).toBeUndefined()\n })\n\n it('should not poison the prototype via a nested __proto__ key that only exists in the source', () => {\n const source = JSON.parse('{\"a\": {\"__proto__\": {\"isAdmin\": true}}}')\n\n const result = deepMerge<Record<string, any>>({}, source)\n\n expect(Object.getPrototypeOf(result.a)).toBe(Object.prototype)\n expect(result.a.isAdmin).toBeUndefined()\n })\n\n it('should not poison the prototype via a __proto__ key inside array items', () => {\n const source = JSON.parse('{\"list\": [{\"__proto__\": {\"isAdmin\": true}}]}')\n\n const result = deepMerge<Record<string, any>>({ list: [] }, source)\n\n expect(Object.getPrototypeOf(result.list[0])).toBe(Object.prototype)\n expect(result.list[0].isAdmin).toBeUndefined()\n })\n\n it('should not mutate the passed options object', () => {\n const options: deepMerge.Options = { clone: true }\n\n deepMerge({ a: [1] }, { a: [2] }, options)\n\n expect(options).toStrictEqual({ clone: true })\n })\n\n it('should not clone React 18 or React 19 elements', () => {\n const react18Element = { $$typeof: Symbol.for('react.element'), props: {} }\n const react19Element = { $$typeof: Symbol.for('react.transitional.element'), props: {} }\n\n const result = deepMerge<Record<string, unknown>>(\n {},\n { react18: react18Element, react19: react19Element },\n )\n\n expect(result.react18).toBe(react18Element)\n expect(result.react19).toBe(react19Element)\n })\n\n it('should accept the signatures of the former deepmerge dependency', () => {\n const isMergeableObject = (value: object) =>\n Object.prototype.toString.call(value) === '[object Object]'\n const options: deepMerge.Options = { isMergeableObject }\n const arrayMergeOptions: deepMerge.ArrayMergeOptions = {\n cloneUnlessOtherwiseSpecified: (value: object): object => value,\n isMergeableObject,\n }\n\n const merged: object = deepMerge.all([{ a: 1 }, { b: 'b' }], options)\n const typed = deepMerge.all<{ a: number; b: string }>([{ a: 1 }, { b: 'b' }])\n\n expect(merged).toStrictEqual({ a: 1, b: 'b' })\n expect(typed.b).toBe('b')\n expect(arrayMergeOptions.cloneUnlessOtherwiseSpecified(merged)).toBe(merged)\n })\n})\n\ndescribe('deepMergeWithSourceArrays', () => {\n it('should replace target arrays with source arrays', () => {\n const result = deepMergeWithSourceArrays<Record<string, unknown>>(\n { list: [1, 2], keep: true },\n { list: [3] },\n )\n\n expect(result).toStrictEqual({ keep: true, list: [3] })\n })\n})\n\ndescribe('deepMergeWithCombinedArrays', () => {\n it('should merge array items by index and append new primitives', () => {\n const result = deepMergeWithCombinedArrays<Record<string, unknown>>(\n { list: [{ a: 1 }, 'x'] },\n { list: [{ b: 2 }, 'y', 'z'] },\n )\n\n expect(result).toStrictEqual({ list: [{ a: 1, b: 2 }, 'x', 'y', 'z'] })\n })\n})\n\ndescribe('deepMergeWithReactComponents', () => {\n it('should not clone functions', () => {\n const Component = () => null\n\n const result = deepMergeWithReactComponents<Record<string, unknown>>(\n { admin: { components: {} } },\n { admin: { components: { Field: Component } } },\n )\n\n expect((result.admin as any).components.Field).toBe(Component)\n })\n})\n"],"names":["describe","expect","it","deepMerge","deepMergeWithCombinedArrays","deepMergeWithReactComponents","deepMergeWithSourceArrays","result","a","b","c","d","e","f","toStrictEqual","target","nested","value","source","other","not","toBe","clone","list","date","Date","regex","symbol","Symbol","x","y","customMerge","key","_x","undefined","all","JSON","parse","Object","getPrototypeOf","prototype","isAdmin","toBeUndefined","polluted","options","react18Element","$$typeof","for","props","react19Element","react18","react19","isMergeableObject","toString","call","arrayMergeOptions","cloneUnlessOtherwiseSpecified","merged","typed","keep","Component","admin","components","Field"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,SAAQ;AAE7C,SACEC,SAAS,EACTC,2BAA2B,EAC3BC,4BAA4B,EAC5BC,yBAAyB,QACpB,iBAAgB;AAEvBN,SAAS,aAAa;IACpBE,GAAG,oEAAoE;QACrE,MAAMK,SAASJ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B;IACpCE,GAAG,mDAAmD;QACpD,MAAMK,SAASD,0BACb;YAAEiB,MAAM;gBAAC;gBAAG;aAAE;YAAEoC,MAAM;QAAK,GAC3B;YAAEpC,MAAM;gBAAC;aAAE;QAAC;QAGdtB,OAAOM,QAAQO,aAAa,CAAC;YAAE6C,MAAM;YAAMpC,MAAM;gBAAC;aAAE;QAAC;IACvD;AACF;AAEAvB,SAAS,+BAA+B;IACtCE,GAAG,+DAA+D;QAChE,MAAMK,SAASH,4BACb;YAAEmB,MAAM;gBAAC;oBAAEf,GAAG;gBAAE;gBAAG;aAAI;QAAC,GACxB;YAAEe,MAAM;gBAAC;oBAAEd,GAAG;gBAAE;gBAAG;gBAAK;aAAI;QAAC;QAG/BR,OAAOM,QAAQO,aAAa,CAAC;YAAES,MAAM;gBAAC;oBAAEf,GAAG;oBAAGC,GAAG;gBAAE;gBAAG;gBAAK;gBAAK;aAAI;QAAC;IACvE;AACF;AAEAT,SAAS,gCAAgC;IACvCE,GAAG,8BAA8B;QAC/B,MAAM0D,YAAY,IAAM;QAExB,MAAMrD,SAASF,6BACb;YAAEwD,OAAO;gBAAEC,YAAY,CAAC;YAAE;QAAE,GAC5B;YAAED,OAAO;gBAAEC,YAAY;oBAAEC,OAAOH;gBAAU;YAAE;QAAE;QAGhD3D,OAAO,AAACM,OAAOsD,KAAK,CAASC,UAAU,CAACC,KAAK,EAAE1C,IAAI,CAACuC;IACtD;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payload",
|
|
3
|
-
"version": "3.94.
|
|
3
|
+
"version": "3.94.1",
|
|
4
4
|
"description": "Node, React, Headless CMS and Application Framework built on Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"admin panel",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
],
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@next/env": "^15.1.5",
|
|
90
|
-
"@payloadcms/translations": "3.94.
|
|
90
|
+
"@payloadcms/translations": "3.94.1",
|
|
91
91
|
"@types/busboy": "1.5.4",
|
|
92
92
|
"ajv": "8.18.0",
|
|
93
93
|
"bson-objectid": "2.0.4",
|
|
@@ -96,7 +96,6 @@
|
|
|
96
96
|
"console-table-printer": "2.12.1",
|
|
97
97
|
"croner": "10.0.1",
|
|
98
98
|
"dataloader": "2.2.3",
|
|
99
|
-
"deepmerge": "4.3.1",
|
|
100
99
|
"file-type": "21.3.4",
|
|
101
100
|
"get-tsconfig": "4.8.1",
|
|
102
101
|
"http-status": "2.1.0",
|