@payloadcms/db-mongodb 3.64.0-internal.1abde12 → 3.64.0-internal.26d730f

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.d.ts CHANGED
@@ -165,4 +165,5 @@ declare module 'payload' {
165
165
  }
166
166
  export declare function mongooseAdapter({ allowAdditionalKeys, allowIDOnCreate, autoPluralization, collectionsSchemaOptions, connectOptions, disableFallbackSort, disableIndexHints, ensureIndexes, migrationDir: migrationDirArg, mongoMemoryServer, prodMigrations, transactionOptions, url, useAlternativeDropDatabase, useBigIntForNumberIDs, useJoinAggregations, usePipelineInSortLookup, }: Args): DatabaseAdapterObj;
167
167
  export { compatibilityOptions } from './utilities/compatibilityOptions.js';
168
+ export { transform } from './utilities/transform.js';
168
169
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACd,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,UAAU,EAEV,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EAClB,MAAM,SAAS,CAAA;AAKhB,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,eAAe,EACf,aAAa,EACb,iBAAiB,EAClB,MAAM,YAAY,CAAA;AAmCnB,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEhE,MAAM,WAAW,IAAI;IACnB;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;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AAC,CAAC,CAAC,CAAC,CAAA;QAEhC,SAAS,EAAE,CAAC,IAAI,EAAE;YAAE,OAAO,CAAC,EAAE,YAAY,CAAA;SAAE,GAAG,aAAa,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;QAClF,aAAa,EAAE,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EAC/C,IAAI,EAAE;YAAE,OAAO,CAAC,EAAE,YAAY,CAAA;SAAE,GAAG,iBAAiB,CAAC,CAAC,CAAC,KACpD,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAA;QAChC,0BAA0B,EAAE,OAAO,CAAA;QACnC,qBAAqB,EAAE,OAAO,CAAA;QAC9B,mBAAmB,EAAE,OAAO,CAAA;QAC5B,uBAAuB,EAAE,OAAO,CAAA;QAChC,QAAQ,EAAE;YACR,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAA;SAChC,CAAA;KACF;CACF;AAED,wBAAgB,eAAe,CAAC,EAC9B,mBAA2B,EAC3B,eAAuB,EACvB,iBAAwB,EACxB,wBAA6B,EAC7B,cAAc,EACd,mBAA2B,EAC3B,iBAAyB,EACzB,aAAqB,EACrB,YAAY,EAAE,eAAe,EAC7B,iBAAiB,EACjB,cAAc,EACd,kBAAuB,EACvB,GAAG,EACH,0BAAkC,EAClC,qBAA6B,EAC7B,mBAA0B,EAC1B,uBAA8B,GAC/B,EAAE,IAAI,GAAG,kBAAkB,CA+E3B;AAED,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAE1E,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA"}
package/dist/index.js CHANGED
@@ -110,5 +110,6 @@ export function mongooseAdapter({ allowAdditionalKeys = false, allowIDOnCreate =
110
110
  };
111
111
  }
112
112
  export { compatibilityOptions } from './utilities/compatibilityOptions.js';
113
+ export { transform } from './utilities/transform.js';
113
114
 
114
115
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollationOptions, TransactionOptions } from 'mongodb'\nimport type { MongoMemoryReplSet } from 'mongodb-memory-server'\nimport type {\n ClientSession,\n Connection,\n ConnectOptions,\n QueryOptions,\n SchemaOptions,\n} from 'mongoose'\nimport type {\n BaseDatabaseAdapter,\n CollectionSlug,\n DatabaseAdapterObj,\n JsonObject,\n Payload,\n TypeWithVersion,\n UpdateGlobalArgs,\n UpdateGlobalVersionArgs,\n UpdateOneArgs,\n UpdateVersionArgs,\n} from 'payload'\n\nimport mongoose from 'mongoose'\nimport { createDatabaseAdapter, defaultBeginTransaction, findMigrationDir } from 'payload'\n\nimport type {\n CollectionModel,\n GlobalModel,\n MigrateDownArgs,\n MigrateUpArgs,\n MongooseMigration,\n} from './types.js'\n\nimport { connect } from './connect.js'\nimport { count } from './count.js'\nimport { countGlobalVersions } from './countGlobalVersions.js'\nimport { countVersions } from './countVersions.js'\nimport { create } from './create.js'\nimport { createGlobal } from './createGlobal.js'\nimport { createGlobalVersion } from './createGlobalVersion.js'\nimport { createMigration } from './createMigration.js'\nimport { createVersion } from './createVersion.js'\nimport { deleteMany } from './deleteMany.js'\nimport { deleteOne } from './deleteOne.js'\nimport { deleteVersions } from './deleteVersions.js'\nimport { destroy } from './destroy.js'\nimport { find } from './find.js'\nimport { findDistinct } from './findDistinct.js'\nimport { findGlobal } from './findGlobal.js'\nimport { findGlobalVersions } from './findGlobalVersions.js'\nimport { findOne } from './findOne.js'\nimport { findVersions } from './findVersions.js'\nimport { init } from './init.js'\nimport { migrateFresh } from './migrateFresh.js'\nimport { queryDrafts } from './queryDrafts.js'\nimport { beginTransaction } from './transactions/beginTransaction.js'\nimport { commitTransaction } from './transactions/commitTransaction.js'\nimport { rollbackTransaction } from './transactions/rollbackTransaction.js'\nimport { updateGlobal } from './updateGlobal.js'\nimport { updateGlobalVersion } from './updateGlobalVersion.js'\nimport { updateJobs } from './updateJobs.js'\nimport { updateMany } from './updateMany.js'\nimport { updateOne } from './updateOne.js'\nimport { updateVersion } from './updateVersion.js'\nimport { upsert } from './upsert.js'\n\nexport type { MigrateDownArgs, MigrateUpArgs } from './types.js'\n\nexport interface Args {\n /**\n * By default, Payload strips all additional keys from MongoDB data that don't exist\n * in the Payload schema. If you have some data that you want to include to the result\n * but it doesn't exist in Payload, you can enable this flag\n * @default false\n */\n allowAdditionalKeys?: boolean\n /**\n * Enable this flag if you want to thread your own ID to create operation data, for example:\n * ```ts\n * import { Types } from 'mongoose'\n *\n * const id = new Types.ObjectId().toHexString()\n * const doc = await payload.create({ collection: 'posts', data: {id, title: \"my title\"}})\n * assertEq(doc.id, id)\n * ```\n */\n allowIDOnCreate?: boolean\n /** Set to false to disable auto-pluralization of collection names, Defaults to true */\n autoPluralization?: boolean\n\n /**\n * If enabled, collation allows for language-specific rules for string comparison.\n * This configuration can include the following options:\n *\n * - `strength` (number): Comparison level (1: Primary, 2: Secondary, 3: Tertiary (default), 4: Quaternary, 5: Identical)\n * - `caseLevel` (boolean): Include case comparison at strength level 1 or 2.\n * - `caseFirst` (string): Sort order of case differences during tertiary level comparisons (\"upper\", \"lower\", \"off\").\n * - `numericOrdering` (boolean): Compare numeric strings as numbers.\n * - `alternate` (string): Consider whitespace and punctuation as base characters (\"non-ignorable\", \"shifted\").\n * - `maxVariable` (string): Characters considered ignorable when `alternate` is \"shifted\" (\"punct\", \"space\").\n * - `backwards` (boolean): Sort strings with diacritics from back of the string.\n * - `normalization` (boolean): Check if text requires normalization and perform normalization.\n *\n * Available on MongoDB version 3.4 and up.\n * The locale that gets passed is your current project's locale but defaults to \"en\".\n *\n * Example:\n * {\n * strength: 3\n * }\n *\n * Defaults to disabled.\n */\n collation?: Omit<CollationOptions, 'locale'>\n\n collectionsSchemaOptions?: Partial<Record<CollectionSlug, SchemaOptions>>\n /** Extra configuration options */\n connectOptions?: {\n /**\n * Set false to disable $facet aggregation in non-supporting databases, Defaults to true\n * @deprecated Payload doesn't use `$facet` anymore anywhere.\n */\n useFacet?: boolean\n } & ConnectOptions\n /**\n * We add a secondary sort based on `createdAt` to ensure that results are always returned in the same order when sorting by a non-unique field.\n * This is because MongoDB does not guarantee the order of results, however in very large datasets this could affect performance.\n *\n * Set to `true` to disable this behaviour.\n */\n disableFallbackSort?: boolean\n /** Set to true to disable hinting to MongoDB to use 'id' as index. This is currently done when counting documents for pagination. Disabling this optimization might fix some problems with AWS DocumentDB. Defaults to false */\n disableIndexHints?: boolean\n /**\n * Set to `true` to ensure that indexes are ready before completing connection.\n * NOTE: not recommended for production. This can slow down the initialization of Payload.\n */\n ensureIndexes?: boolean\n migrationDir?: string\n /**\n * typed as any to avoid dependency\n */\n mongoMemoryServer?: MongoMemoryReplSet\n prodMigrations?: MongooseMigration[]\n\n transactionOptions?: false | TransactionOptions\n\n /** The URL to connect to MongoDB or false to start payload and prevent connecting */\n url: false | string\n\n /**\n * Set to `true` to use an alternative `dropDatabase` implementation that calls `collection.deleteMany({})` on every collection instead of sending a raw `dropDatabase` command.\n * Payload only uses `dropDatabase` for testing purposes.\n * @default false\n */\n useAlternativeDropDatabase?: boolean\n /**\n * Set to `true` to use `BigInt` for custom ID fields of type `'number'`.\n * Useful for databases that don't support `double` or `int32` IDs.\n * @default false\n */\n useBigIntForNumberIDs?: boolean\n /**\n * Set to `false` to disable join aggregations (which use correlated subqueries) and instead populate join fields via multiple `find` queries.\n * @default true\n */\n useJoinAggregations?: boolean\n /**\n * Set to `false` to disable the use of `pipeline` in the `$lookup` aggregation in sorting.\n * @default true\n */\n usePipelineInSortLookup?: boolean\n}\n\nexport type MongooseAdapter = {\n collections: {\n [slug: string]: CollectionModel\n }\n connection: Connection\n ensureIndexes: boolean\n globals: GlobalModel\n mongoMemoryServer: MongoMemoryReplSet\n prodMigrations?: {\n down: (args: MigrateDownArgs) => Promise<void>\n name: string\n up: (args: MigrateUpArgs) => Promise<void>\n }[]\n sessions: Record<number | string, ClientSession>\n useAlternativeDropDatabase: boolean\n useBigIntForNumberIDs: boolean\n useJoinAggregations: boolean\n usePipelineInSortLookup: boolean\n versions: {\n [slug: string]: CollectionModel\n }\n} & Args &\n BaseDatabaseAdapter\n\ndeclare module 'payload' {\n export interface DatabaseAdapter\n extends Omit<BaseDatabaseAdapter, 'sessions'>,\n Omit<Args, 'migrationDir'> {\n collections: {\n [slug: string]: CollectionModel\n }\n connection: Connection\n ensureIndexes: boolean\n globals: GlobalModel\n mongoMemoryServer: MongoMemoryReplSet\n prodMigrations?: {\n down: (args: MigrateDownArgs) => Promise<void>\n name: string\n up: (args: MigrateUpArgs) => Promise<void>\n }[]\n sessions: Record<number | string, ClientSession>\n transactionOptions: TransactionOptions\n updateGlobal: <T extends Record<string, unknown>>(\n args: { options?: QueryOptions } & UpdateGlobalArgs<T>,\n ) => Promise<T>\n updateGlobalVersion: <T extends JsonObject = JsonObject>(\n args: { options?: QueryOptions } & UpdateGlobalVersionArgs<T>,\n ) => Promise<TypeWithVersion<T>>\n\n updateOne: (args: { options?: QueryOptions } & UpdateOneArgs) => Promise<Document>\n updateVersion: <T extends JsonObject = JsonObject>(\n args: { options?: QueryOptions } & UpdateVersionArgs<T>,\n ) => Promise<TypeWithVersion<T>>\n useAlternativeDropDatabase: boolean\n useBigIntForNumberIDs: boolean\n useJoinAggregations: boolean\n usePipelineInSortLookup: boolean\n versions: {\n [slug: string]: CollectionModel\n }\n }\n}\n\nexport function mongooseAdapter({\n allowAdditionalKeys = false,\n allowIDOnCreate = false,\n autoPluralization = true,\n collectionsSchemaOptions = {},\n connectOptions,\n disableFallbackSort = false,\n disableIndexHints = false,\n ensureIndexes = false,\n migrationDir: migrationDirArg,\n mongoMemoryServer,\n prodMigrations,\n transactionOptions = {},\n url,\n useAlternativeDropDatabase = false,\n useBigIntForNumberIDs = false,\n useJoinAggregations = true,\n usePipelineInSortLookup = true,\n}: Args): DatabaseAdapterObj {\n function adapter({ payload }: { payload: Payload }) {\n const migrationDir = findMigrationDir(migrationDirArg)\n mongoose.set('strictQuery', false)\n\n return createDatabaseAdapter<MongooseAdapter>({\n name: 'mongoose',\n\n // Mongoose-specific\n autoPluralization,\n collections: {},\n // @ts-expect-error initialize without a connection\n connection: undefined,\n connectOptions: connectOptions || {},\n disableIndexHints,\n ensureIndexes,\n // @ts-expect-error don't have globals model yet\n globals: undefined,\n // @ts-expect-error Should not be required\n mongoMemoryServer,\n sessions: {},\n transactionOptions: transactionOptions === false ? undefined : transactionOptions,\n updateJobs,\n updateMany,\n url,\n versions: {},\n // DatabaseAdapter\n allowAdditionalKeys,\n allowIDOnCreate,\n beginTransaction: transactionOptions === false ? defaultBeginTransaction() : beginTransaction,\n collectionsSchemaOptions,\n commitTransaction,\n connect,\n count,\n countGlobalVersions,\n countVersions,\n create,\n createGlobal,\n createGlobalVersion,\n createMigration,\n createVersion,\n defaultIDType: 'text',\n deleteMany,\n deleteOne,\n deleteVersions,\n destroy,\n disableFallbackSort,\n find,\n findDistinct,\n findGlobal,\n findGlobalVersions,\n findOne,\n findVersions,\n init,\n migrateFresh,\n migrationDir,\n packageName: '@payloadcms/db-mongodb',\n payload,\n prodMigrations,\n queryDrafts,\n rollbackTransaction,\n updateGlobal,\n updateGlobalVersion,\n updateOne,\n updateVersion,\n upsert,\n useAlternativeDropDatabase,\n useBigIntForNumberIDs,\n useJoinAggregations,\n usePipelineInSortLookup,\n })\n }\n\n return {\n name: 'mongoose',\n allowIDOnCreate,\n defaultIDType: 'text',\n init: adapter,\n }\n}\n\nexport { compatibilityOptions } from './utilities/compatibilityOptions.js'\n"],"names":["mongoose","createDatabaseAdapter","defaultBeginTransaction","findMigrationDir","connect","count","countGlobalVersions","countVersions","create","createGlobal","createGlobalVersion","createMigration","createVersion","deleteMany","deleteOne","deleteVersions","destroy","find","findDistinct","findGlobal","findGlobalVersions","findOne","findVersions","init","migrateFresh","queryDrafts","beginTransaction","commitTransaction","rollbackTransaction","updateGlobal","updateGlobalVersion","updateJobs","updateMany","updateOne","updateVersion","upsert","mongooseAdapter","allowAdditionalKeys","allowIDOnCreate","autoPluralization","collectionsSchemaOptions","connectOptions","disableFallbackSort","disableIndexHints","ensureIndexes","migrationDir","migrationDirArg","mongoMemoryServer","prodMigrations","transactionOptions","url","useAlternativeDropDatabase","useBigIntForNumberIDs","useJoinAggregations","usePipelineInSortLookup","adapter","payload","set","name","collections","connection","undefined","globals","sessions","versions","defaultIDType","packageName","compatibilityOptions"],"mappings":"AAsBA,OAAOA,cAAc,WAAU;AAC/B,SAASC,qBAAqB,EAAEC,uBAAuB,EAAEC,gBAAgB,QAAQ,UAAS;AAU1F,SAASC,OAAO,QAAQ,eAAc;AACtC,SAASC,KAAK,QAAQ,aAAY;AAClC,SAASC,mBAAmB,QAAQ,2BAA0B;AAC9D,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,MAAM,QAAQ,cAAa;AACpC,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,mBAAmB,QAAQ,2BAA0B;AAC9D,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,UAAU,QAAQ,kBAAiB;AAC5C,SAASC,SAAS,QAAQ,iBAAgB;AAC1C,SAASC,cAAc,QAAQ,sBAAqB;AACpD,SAASC,OAAO,QAAQ,eAAc;AACtC,SAASC,IAAI,QAAQ,YAAW;AAChC,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,UAAU,QAAQ,kBAAiB;AAC5C,SAASC,kBAAkB,QAAQ,0BAAyB;AAC5D,SAASC,OAAO,QAAQ,eAAc;AACtC,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,IAAI,QAAQ,YAAW;AAChC,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,WAAW,QAAQ,mBAAkB;AAC9C,SAASC,gBAAgB,QAAQ,qCAAoC;AACrE,SAASC,iBAAiB,QAAQ,sCAAqC;AACvE,SAASC,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,mBAAmB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YACAqB,aAAa;YACbV;YACAR;YACAvB;YACAG;YACAC;YACAC;YACAG;YACAC;YACAC;YACAgB;YACAC;YACAC;YACAC;QACF;IACF;IAEA,OAAO;QACLI,MAAM;QACNpB;QACA2B,eAAe;QACf1C,MAAMgC;IACR;AACF;AAEA,SAASY,oBAAoB,QAAQ,sCAAqC"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollationOptions, TransactionOptions } from 'mongodb'\nimport type { MongoMemoryReplSet } from 'mongodb-memory-server'\nimport type {\n ClientSession,\n Connection,\n ConnectOptions,\n QueryOptions,\n SchemaOptions,\n} from 'mongoose'\nimport type {\n BaseDatabaseAdapter,\n CollectionSlug,\n DatabaseAdapterObj,\n JsonObject,\n Payload,\n TypeWithVersion,\n UpdateGlobalArgs,\n UpdateGlobalVersionArgs,\n UpdateOneArgs,\n UpdateVersionArgs,\n} from 'payload'\n\nimport mongoose from 'mongoose'\nimport { createDatabaseAdapter, defaultBeginTransaction, findMigrationDir } from 'payload'\n\nimport type {\n CollectionModel,\n GlobalModel,\n MigrateDownArgs,\n MigrateUpArgs,\n MongooseMigration,\n} from './types.js'\n\nimport { connect } from './connect.js'\nimport { count } from './count.js'\nimport { countGlobalVersions } from './countGlobalVersions.js'\nimport { countVersions } from './countVersions.js'\nimport { create } from './create.js'\nimport { createGlobal } from './createGlobal.js'\nimport { createGlobalVersion } from './createGlobalVersion.js'\nimport { createMigration } from './createMigration.js'\nimport { createVersion } from './createVersion.js'\nimport { deleteMany } from './deleteMany.js'\nimport { deleteOne } from './deleteOne.js'\nimport { deleteVersions } from './deleteVersions.js'\nimport { destroy } from './destroy.js'\nimport { find } from './find.js'\nimport { findDistinct } from './findDistinct.js'\nimport { findGlobal } from './findGlobal.js'\nimport { findGlobalVersions } from './findGlobalVersions.js'\nimport { findOne } from './findOne.js'\nimport { findVersions } from './findVersions.js'\nimport { init } from './init.js'\nimport { migrateFresh } from './migrateFresh.js'\nimport { queryDrafts } from './queryDrafts.js'\nimport { beginTransaction } from './transactions/beginTransaction.js'\nimport { commitTransaction } from './transactions/commitTransaction.js'\nimport { rollbackTransaction } from './transactions/rollbackTransaction.js'\nimport { updateGlobal } from './updateGlobal.js'\nimport { updateGlobalVersion } from './updateGlobalVersion.js'\nimport { updateJobs } from './updateJobs.js'\nimport { updateMany } from './updateMany.js'\nimport { updateOne } from './updateOne.js'\nimport { updateVersion } from './updateVersion.js'\nimport { upsert } from './upsert.js'\n\nexport type { MigrateDownArgs, MigrateUpArgs } from './types.js'\n\nexport interface Args {\n /**\n * By default, Payload strips all additional keys from MongoDB data that don't exist\n * in the Payload schema. If you have some data that you want to include to the result\n * but it doesn't exist in Payload, you can enable this flag\n * @default false\n */\n allowAdditionalKeys?: boolean\n /**\n * Enable this flag if you want to thread your own ID to create operation data, for example:\n * ```ts\n * import { Types } from 'mongoose'\n *\n * const id = new Types.ObjectId().toHexString()\n * const doc = await payload.create({ collection: 'posts', data: {id, title: \"my title\"}})\n * assertEq(doc.id, id)\n * ```\n */\n allowIDOnCreate?: boolean\n /** Set to false to disable auto-pluralization of collection names, Defaults to true */\n autoPluralization?: boolean\n\n /**\n * If enabled, collation allows for language-specific rules for string comparison.\n * This configuration can include the following options:\n *\n * - `strength` (number): Comparison level (1: Primary, 2: Secondary, 3: Tertiary (default), 4: Quaternary, 5: Identical)\n * - `caseLevel` (boolean): Include case comparison at strength level 1 or 2.\n * - `caseFirst` (string): Sort order of case differences during tertiary level comparisons (\"upper\", \"lower\", \"off\").\n * - `numericOrdering` (boolean): Compare numeric strings as numbers.\n * - `alternate` (string): Consider whitespace and punctuation as base characters (\"non-ignorable\", \"shifted\").\n * - `maxVariable` (string): Characters considered ignorable when `alternate` is \"shifted\" (\"punct\", \"space\").\n * - `backwards` (boolean): Sort strings with diacritics from back of the string.\n * - `normalization` (boolean): Check if text requires normalization and perform normalization.\n *\n * Available on MongoDB version 3.4 and up.\n * The locale that gets passed is your current project's locale but defaults to \"en\".\n *\n * Example:\n * {\n * strength: 3\n * }\n *\n * Defaults to disabled.\n */\n collation?: Omit<CollationOptions, 'locale'>\n\n collectionsSchemaOptions?: Partial<Record<CollectionSlug, SchemaOptions>>\n /** Extra configuration options */\n connectOptions?: {\n /**\n * Set false to disable $facet aggregation in non-supporting databases, Defaults to true\n * @deprecated Payload doesn't use `$facet` anymore anywhere.\n */\n useFacet?: boolean\n } & ConnectOptions\n /**\n * We add a secondary sort based on `createdAt` to ensure that results are always returned in the same order when sorting by a non-unique field.\n * This is because MongoDB does not guarantee the order of results, however in very large datasets this could affect performance.\n *\n * Set to `true` to disable this behaviour.\n */\n disableFallbackSort?: boolean\n /** Set to true to disable hinting to MongoDB to use 'id' as index. This is currently done when counting documents for pagination. Disabling this optimization might fix some problems with AWS DocumentDB. Defaults to false */\n disableIndexHints?: boolean\n /**\n * Set to `true` to ensure that indexes are ready before completing connection.\n * NOTE: not recommended for production. This can slow down the initialization of Payload.\n */\n ensureIndexes?: boolean\n migrationDir?: string\n /**\n * typed as any to avoid dependency\n */\n mongoMemoryServer?: MongoMemoryReplSet\n prodMigrations?: MongooseMigration[]\n\n transactionOptions?: false | TransactionOptions\n\n /** The URL to connect to MongoDB or false to start payload and prevent connecting */\n url: false | string\n\n /**\n * Set to `true` to use an alternative `dropDatabase` implementation that calls `collection.deleteMany({})` on every collection instead of sending a raw `dropDatabase` command.\n * Payload only uses `dropDatabase` for testing purposes.\n * @default false\n */\n useAlternativeDropDatabase?: boolean\n /**\n * Set to `true` to use `BigInt` for custom ID fields of type `'number'`.\n * Useful for databases that don't support `double` or `int32` IDs.\n * @default false\n */\n useBigIntForNumberIDs?: boolean\n /**\n * Set to `false` to disable join aggregations (which use correlated subqueries) and instead populate join fields via multiple `find` queries.\n * @default true\n */\n useJoinAggregations?: boolean\n /**\n * Set to `false` to disable the use of `pipeline` in the `$lookup` aggregation in sorting.\n * @default true\n */\n usePipelineInSortLookup?: boolean\n}\n\nexport type MongooseAdapter = {\n collections: {\n [slug: string]: CollectionModel\n }\n connection: Connection\n ensureIndexes: boolean\n globals: GlobalModel\n mongoMemoryServer: MongoMemoryReplSet\n prodMigrations?: {\n down: (args: MigrateDownArgs) => Promise<void>\n name: string\n up: (args: MigrateUpArgs) => Promise<void>\n }[]\n sessions: Record<number | string, ClientSession>\n useAlternativeDropDatabase: boolean\n useBigIntForNumberIDs: boolean\n useJoinAggregations: boolean\n usePipelineInSortLookup: boolean\n versions: {\n [slug: string]: CollectionModel\n }\n} & Args &\n BaseDatabaseAdapter\n\ndeclare module 'payload' {\n export interface DatabaseAdapter\n extends Omit<BaseDatabaseAdapter, 'sessions'>,\n Omit<Args, 'migrationDir'> {\n collections: {\n [slug: string]: CollectionModel\n }\n connection: Connection\n ensureIndexes: boolean\n globals: GlobalModel\n mongoMemoryServer: MongoMemoryReplSet\n prodMigrations?: {\n down: (args: MigrateDownArgs) => Promise<void>\n name: string\n up: (args: MigrateUpArgs) => Promise<void>\n }[]\n sessions: Record<number | string, ClientSession>\n transactionOptions: TransactionOptions\n updateGlobal: <T extends Record<string, unknown>>(\n args: { options?: QueryOptions } & UpdateGlobalArgs<T>,\n ) => Promise<T>\n updateGlobalVersion: <T extends JsonObject = JsonObject>(\n args: { options?: QueryOptions } & UpdateGlobalVersionArgs<T>,\n ) => Promise<TypeWithVersion<T>>\n\n updateOne: (args: { options?: QueryOptions } & UpdateOneArgs) => Promise<Document>\n updateVersion: <T extends JsonObject = JsonObject>(\n args: { options?: QueryOptions } & UpdateVersionArgs<T>,\n ) => Promise<TypeWithVersion<T>>\n useAlternativeDropDatabase: boolean\n useBigIntForNumberIDs: boolean\n useJoinAggregations: boolean\n usePipelineInSortLookup: boolean\n versions: {\n [slug: string]: CollectionModel\n }\n }\n}\n\nexport function mongooseAdapter({\n allowAdditionalKeys = false,\n allowIDOnCreate = false,\n autoPluralization = true,\n collectionsSchemaOptions = {},\n connectOptions,\n disableFallbackSort = false,\n disableIndexHints = false,\n ensureIndexes = false,\n migrationDir: migrationDirArg,\n mongoMemoryServer,\n prodMigrations,\n transactionOptions = {},\n url,\n useAlternativeDropDatabase = false,\n useBigIntForNumberIDs = false,\n useJoinAggregations = true,\n usePipelineInSortLookup = true,\n}: Args): DatabaseAdapterObj {\n function adapter({ payload }: { payload: Payload }) {\n const migrationDir = findMigrationDir(migrationDirArg)\n mongoose.set('strictQuery', false)\n\n return createDatabaseAdapter<MongooseAdapter>({\n name: 'mongoose',\n\n // Mongoose-specific\n autoPluralization,\n collections: {},\n // @ts-expect-error initialize without a connection\n connection: undefined,\n connectOptions: connectOptions || {},\n disableIndexHints,\n ensureIndexes,\n // @ts-expect-error don't have globals model yet\n globals: undefined,\n // @ts-expect-error Should not be required\n mongoMemoryServer,\n sessions: {},\n transactionOptions: transactionOptions === false ? undefined : transactionOptions,\n updateJobs,\n updateMany,\n url,\n versions: {},\n // DatabaseAdapter\n allowAdditionalKeys,\n allowIDOnCreate,\n beginTransaction: transactionOptions === false ? defaultBeginTransaction() : beginTransaction,\n collectionsSchemaOptions,\n commitTransaction,\n connect,\n count,\n countGlobalVersions,\n countVersions,\n create,\n createGlobal,\n createGlobalVersion,\n createMigration,\n createVersion,\n defaultIDType: 'text',\n deleteMany,\n deleteOne,\n deleteVersions,\n destroy,\n disableFallbackSort,\n find,\n findDistinct,\n findGlobal,\n findGlobalVersions,\n findOne,\n findVersions,\n init,\n migrateFresh,\n migrationDir,\n packageName: '@payloadcms/db-mongodb',\n payload,\n prodMigrations,\n queryDrafts,\n rollbackTransaction,\n updateGlobal,\n updateGlobalVersion,\n updateOne,\n updateVersion,\n upsert,\n useAlternativeDropDatabase,\n useBigIntForNumberIDs,\n useJoinAggregations,\n usePipelineInSortLookup,\n })\n }\n\n return {\n name: 'mongoose',\n allowIDOnCreate,\n defaultIDType: 'text',\n init: adapter,\n }\n}\n\nexport { compatibilityOptions } from './utilities/compatibilityOptions.js'\n\nexport { transform } from './utilities/transform.js'\n"],"names":["mongoose","createDatabaseAdapter","defaultBeginTransaction","findMigrationDir","connect","count","countGlobalVersions","countVersions","create","createGlobal","createGlobalVersion","createMigration","createVersion","deleteMany","deleteOne","deleteVersions","destroy","find","findDistinct","findGlobal","findGlobalVersions","findOne","findVersions","init","migrateFresh","queryDrafts","beginTransaction","commitTransaction","rollbackTransaction","updateGlobal","updateGlobalVersion","updateJobs","updateMany","updateOne","updateVersion","upsert","mongooseAdapter","allowAdditionalKeys","allowIDOnCreate","autoPluralization","collectionsSchemaOptions","connectOptions","disableFallbackSort","disableIndexHints","ensureIndexes","migrationDir","migrationDirArg","mongoMemoryServer","prodMigrations","transactionOptions","url","useAlternativeDropDatabase","useBigIntForNumberIDs","useJoinAggregations","usePipelineInSortLookup","adapter","payload","set","name","collections","connection","undefined","globals","sessions","versions","defaultIDType","packageName","compatibilityOptions","transform"],"mappings":"AAsBA,OAAOA,cAAc,WAAU;AAC/B,SAASC,qBAAqB,EAAEC,uBAAuB,EAAEC,gBAAgB,QAAQ,UAAS;AAU1F,SAASC,OAAO,QAAQ,eAAc;AACtC,SAASC,KAAK,QAAQ,aAAY;AAClC,SAASC,mBAAmB,QAAQ,2BAA0B;AAC9D,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,MAAM,QAAQ,cAAa;AACpC,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,mBAAmB,QAAQ,2BAA0B;AAC9D,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,UAAU,QAAQ,kBAAiB;AAC5C,SAASC,SAAS,QAAQ,iBAAgB;AAC1C,SAASC,cAAc,QAAQ,sBAAqB;AACpD,SAASC,OAAO,QAAQ,eAAc;AACtC,SAASC,IAAI,QAAQ,YAAW;AAChC,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,UAAU,QAAQ,kBAAiB;AAC5C,SAASC,kBAAkB,QAAQ,0BAAyB;AAC5D,SAASC,OAAO,QAAQ,eAAc;AACtC,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,IAAI,QAA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AAkB;YAClB3B;YACAC;YACAZ,kBAAkBuB,uBAAuB,QAAQ/C,4BAA4BwB;YAC7Ec;YACAb;YACAvB;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAqD,eAAe;YACfpD;YACAC;YACAC;YACAC;YACA0B;YACAzB;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAqB;YACAqB,aAAa;YACbV;YACAR;YACAvB;YACAG;YACAC;YACAC;YACAG;YACAC;YACAC;YACAgB;YACAC;YACAC;YACAC;QACF;IACF;IAEA,OAAO;QACLI,MAAM;QACNpB;QACA2B,eAAe;QACf1C,MAAMgC;IACR;AACF;AAEA,SAASY,oBAAoB,QAAQ,sCAAqC;AAE1E,SAASC,SAAS,QAAQ,2BAA0B"}
@@ -32,6 +32,11 @@ type Args = {
32
32
  */
33
33
  validateRelationships?: boolean;
34
34
  };
35
+ /**
36
+ * A function that transforms Payload <-> MongoDB data.
37
+ * @internal - this function may be removed or receive breaking changes in minor releases.
38
+ * @experimental
39
+ */
35
40
  export declare const transform: ({ $addToSet, $inc, $pull, $push, adapter, data, fields, globalSlug, operation, parentIsLocalized, validateRelationships, }: Args) => null | undefined;
36
41
  export {};
37
42
  //# sourceMappingURL=transform.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/utilities/transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,KAAK,EAQN,MAAM,SAAS,CAAA;AAMhB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAmQlD,KAAK,IAAI,GAAG;IACV,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,GAAG,EAAE,CAAA;KAAE,GAAG,GAAG,CAAC,CAAA;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAA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KAAK,EAAE,GAAG,EAAE,CAAA;KAAE,GAAG,GAAG,CAAC,CAAA;IAC9C,8BAA8B;IAC9B,OAAO,EAAE,eAAe,CAAA;IACxB,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IACzD,uCAAuC;IACvC,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,SAAS,EAAE,MAAM,GAAG,OAAO,CAAA;IAC3B,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAA;AA0KD;;;;GAIG;AAEH,eAAO,MAAM,SAAS,+HAYnB,IAAI,qBA4XN,CAAA"}
@@ -310,7 +310,11 @@ const stripFields = ({ config, data, fields, reservedKeys = [] })=>{
310
310
  }
311
311
  }
312
312
  };
313
- export const transform = ({ $addToSet, $inc, $pull, $push, adapter, data, fields, globalSlug, operation, parentIsLocalized = false, validateRelationships = true })=>{
313
+ /**
314
+ * A function that transforms Payload <-> MongoDB data.
315
+ * @internal - this function may be removed or receive breaking changes in minor releases.
316
+ * @experimental
317
+ */ export const transform = ({ $addToSet, $inc, $pull, $push, adapter, data, fields, globalSlug, operation, parentIsLocalized = false, validateRelationships = true })=>{
314
318
  if (!data) {
315
319
  return null;
316
320
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/transform.ts"],"sourcesContent":["import type {\n CollectionConfig,\n DateField,\n Field,\n FlattenedBlock,\n FlattenedField,\n JoinField,\n RelationshipField,\n SanitizedConfig,\n TraverseFieldsCallback,\n UploadField,\n} from 'payload'\n\nimport { Types } from 'mongoose'\nimport { flattenAllFields, traverseFields } from 'payload'\nimport { fieldAffectsData, fieldShouldBeLocalized } from 'payload/shared'\n\nimport type { MongooseAdapter } from '../index.js'\n\nimport { isObjectID } from './isObjectID.js'\n\ninterface RelationObject {\n relationTo: string\n value: number | string\n}\n\nfunction isValidRelationObject(value: unknown): value is RelationObject {\n return typeof value === 'object' && value !== null && 'relationTo' in value && 'value' in value\n}\n\n/**\n * Process relationship values for polymorphic and simple relationships\n * Used by both $push and $remove operations\n */\nconst processRelationshipValues = (\n items: unknown[],\n field: RelationshipField | UploadField,\n config: SanitizedConfig,\n operation: 'read' | 'write',\n validateRelationships: boolean,\n adapter: MongooseAdapter,\n) => {\n return items.map((item) => {\n // Handle polymorphic relationships\n if (Array.isArray(field.relationTo) && isValidRelationObject(item)) {\n const relatedCollection = config.collections?.find(({ slug }) => slug === item.relationTo)\n if (relatedCollection) {\n return {\n relationTo: item.relationTo,\n value: convertRelationshipValue({\n adapter,\n operation,\n relatedCollection,\n validateRelationships,\n value: item.value,\n }),\n }\n }\n return item\n }\n\n // Handle simple relationships\n if (typeof field.relationTo === 'string') {\n const relatedCollection = config.collections?.find(({ slug }) => slug === field.relationTo)\n if (relatedCollection) {\n return convertRelationshipValue({\n adapter,\n operation,\n relatedCollection,\n validateRelationships,\n value: item,\n })\n }\n }\n\n return item\n })\n}\n\nconst convertRelationshipValue = ({\n adapter,\n operation,\n relatedCollection,\n validateRelationships,\n value,\n}: {\n adapter: MongooseAdapter\n operation: Args['operation']\n relatedCollection: CollectionConfig\n validateRelationships?: boolean\n value: unknown\n}) => {\n const customIDField = relatedCollection.fields.find(\n (field) => fieldAffectsData(field) && field.name === 'id',\n )\n\n if (operation === 'read') {\n if (isObjectID(value)) {\n return value.toHexString()\n }\n\n if (\n customIDField?.type === 'number' &&\n typeof value === 'bigint' &&\n adapter.useBigIntForNumberIDs\n ) {\n return Number(value)\n }\n\n return value\n }\n\n if (customIDField) {\n return value\n }\n\n if (typeof value === 'string') {\n try {\n return new Types.ObjectId(value)\n } catch (e) {\n if (validateRelationships) {\n throw e\n }\n return value\n }\n }\n\n return value\n}\n\nconst sanitizeRelationship = ({\n adapter,\n config,\n field,\n locale,\n operation,\n ref,\n validateRelationships,\n value,\n}: {\n adapter: MongooseAdapter\n config: SanitizedConfig\n field: JoinField | RelationshipField | UploadField\n locale?: string\n operation: Args['operation']\n ref: Record<string, unknown>\n validateRelationships?: boolean\n value?: unknown\n}) => {\n if (field.type === 'join') {\n if (\n operation === 'read' &&\n value &&\n typeof value === 'object' &&\n 'docs' in value &&\n Array.isArray(value.docs)\n ) {\n for (let i = 0; i < value.docs.length; i++) {\n const item = value.docs[i]\n\n if (isObjectID(item)) {\n value.docs[i] = item.toHexString()\n } else if (Array.isArray(field.collection) && item) {\n // Fields here for polymorphic joins cannot be determinted, JSON.parse needed\n value.docs[i] = JSON.parse(JSON.stringify(value.docs[i]))\n }\n }\n }\n\n return value\n }\n let relatedCollection: CollectionConfig | undefined\n let result = value\n\n const hasManyRelations = typeof field.relationTo !== 'string'\n\n if (!hasManyRelations) {\n relatedCollection = config.collections?.find(({ slug }) => slug === field.relationTo)\n }\n\n if (Array.isArray(value)) {\n result = value.map((val) => {\n // Handle has many - polymorphic\n if (isValidRelationObject(val)) {\n const relatedCollectionForSingleValue = config.collections?.find(\n ({ slug }) => slug === val.relationTo,\n )\n\n if (relatedCollectionForSingleValue) {\n return {\n relationTo: val.relationTo,\n value: convertRelationshipValue({\n adapter,\n operation,\n relatedCollection: relatedCollectionForSingleValue,\n validateRelationships,\n value: val.value,\n }),\n }\n }\n }\n\n if (relatedCollection) {\n return convertRelationshipValue({\n adapter,\n operation,\n relatedCollection,\n validateRelationships,\n value: val,\n })\n }\n\n return val\n })\n }\n // Handle has one - polymorphic\n else if (isValidRelationObject(value)) {\n relatedCollection = config.collections?.find(({ slug }) => slug === value.relationTo)\n\n if (relatedCollection) {\n result = {\n relationTo: value.relationTo,\n value: convertRelationshipValue({\n adapter,\n operation,\n relatedCollection,\n validateRelationships,\n value: value.value,\n }),\n }\n }\n }\n // Handle has one\n else if (relatedCollection) {\n result = convertRelationshipValue({\n adapter,\n operation,\n relatedCollection,\n validateRelationships,\n value,\n })\n }\n\n if (locale) {\n ref[locale] = result\n } else {\n ref[field.name] = result\n }\n}\n\nconst sanitizeDate = ({\n field,\n locale,\n ref,\n value,\n}: {\n field: DateField\n locale?: string\n ref: Record<string, unknown>\n value: unknown\n}) => {\n if (!value) {\n return\n }\n\n if (value instanceof Date) {\n value = value.toISOString()\n }\n\n if (locale) {\n ref[locale] = value\n } else {\n ref[field.name] = value\n }\n}\n\ntype Args = {\n $addToSet?: Record<string, { $each: any[] } | any>\n $inc?: Record<string, number>\n $pull?: Record<string, { $in: any[] } | any>\n $push?: Record<string, { $each: any[] } | any>\n /** instance of the adapter */\n adapter: MongooseAdapter\n /** data to transform, can be an array of documents or a single document */\n data: Record<string, unknown> | Record<string, unknown>[]\n /** fields accossiated with the data */\n fields: Field[]\n /** slug of the global, pass only when the operation is `write` */\n globalSlug?: string\n /**\n * Type of the operation\n * read - sanitizes ObjectIDs, Date to strings.\n * write - sanitizes string relationships to ObjectIDs.\n */\n operation: 'read' | 'write'\n parentIsLocalized?: boolean\n /**\n * Throw errors on invalid relationships\n * @default true\n */\n validateRelationships?: boolean\n}\n\nconst stripFields = ({\n config,\n data,\n fields,\n reservedKeys = [],\n}: {\n config: SanitizedConfig\n data: any\n fields: FlattenedField[]\n reservedKeys?: string[]\n}) => {\n for (const k in data) {\n if (!fields.some((field) => field.name === k) && !reservedKeys.includes(k)) {\n delete data[k]\n }\n }\n\n for (const field of fields) {\n reservedKeys = []\n const fieldData = data[field.name]\n if (!fieldData || typeof fieldData !== 'object') {\n continue\n }\n\n if (field.type === 'blocks') {\n reservedKeys.push('blockType')\n }\n\n if ('flattenedFields' in field || 'blocks' in field) {\n if (field.localized && config.localization) {\n for (const localeKey in fieldData) {\n if (!config.localization.localeCodes.some((code) => code === localeKey)) {\n delete fieldData[localeKey]\n continue\n }\n\n const localeData = fieldData[localeKey]\n\n if (!localeData || typeof localeData !== 'object') {\n if (field.type === 'blocks') {\n fieldData[localeKey] = []\n }\n continue\n }\n\n if (field.type === 'array' || field.type === 'blocks') {\n if (!Array.isArray(localeData)) {\n continue\n }\n\n let hasNull = false\n for (let i = 0; i < localeData.length; i++) {\n const data = localeData[i]\n let fields: FlattenedField[] | null = null\n\n if (field.type === 'array') {\n fields = field.flattenedFields\n } else {\n let maybeBlock: FlattenedBlock | undefined = undefined\n\n if (field.blockReferences) {\n const maybeBlockReference = field.blockReferences.find((each) => {\n const slug = typeof each === 'string' ? each : each.slug\n return slug === data.blockType\n })\n\n if (maybeBlockReference) {\n if (typeof maybeBlockReference === 'object') {\n maybeBlock = maybeBlockReference\n } else {\n maybeBlock = config.blocks?.find((each) => each.slug === maybeBlockReference)\n }\n }\n }\n\n if (!maybeBlock) {\n maybeBlock = field.blocks.find((each) => each.slug === data.blockType)\n }\n\n if (maybeBlock) {\n fields = maybeBlock.flattenedFields\n } else {\n localeData[i] = null\n hasNull = true\n }\n }\n\n if (!fields) {\n continue\n }\n\n stripFields({ config, data, fields, reservedKeys })\n }\n\n if (hasNull) {\n fieldData[localeKey] = localeData.filter(Boolean)\n }\n\n continue\n } else {\n stripFields({ config, data: localeData, fields: field.flattenedFields, reservedKeys })\n }\n }\n continue\n }\n\n if (field.type === 'array' || field.type === 'blocks') {\n if (!Array.isArray(fieldData)) {\n continue\n }\n\n let hasNull = false\n\n for (let i = 0; i < fieldData.length; i++) {\n const data = fieldData[i]\n let fields: FlattenedField[] | null = null\n\n if (field.type === 'array') {\n fields = field.flattenedFields\n } else {\n let maybeBlock: FlattenedBlock | undefined = undefined\n\n if (field.blockReferences) {\n const maybeBlockReference = field.blockReferences.find((each) => {\n const slug = typeof each === 'string' ? each : each.slug\n return slug === data.blockType\n })\n\n if (maybeBlockReference) {\n if (typeof maybeBlockReference === 'object') {\n maybeBlock = maybeBlockReference\n } else {\n maybeBlock = config.blocks?.find((each) => each.slug === maybeBlockReference)\n }\n }\n }\n\n if (!maybeBlock) {\n maybeBlock = field.blocks.find((each) => each.slug === data.blockType)\n }\n\n if (maybeBlock) {\n fields = maybeBlock.flattenedFields\n } else {\n fieldData[i] = null\n hasNull = true\n }\n }\n\n if (!fields) {\n continue\n }\n\n stripFields({ config, data, fields, reservedKeys })\n }\n\n if (hasNull) {\n data[field.name] = fieldData.filter(Boolean)\n }\n\n continue\n } else {\n stripFields({ config, data: fieldData, fields: field.flattenedFields, reservedKeys })\n }\n }\n }\n}\n\nexport const transform = ({\n $addToSet,\n $inc,\n $pull,\n $push,\n adapter,\n data,\n fields,\n globalSlug,\n operation,\n parentIsLocalized = false,\n validateRelationships = true,\n}: Args) => {\n if (!data) {\n return null\n }\n\n if (Array.isArray(data)) {\n for (const item of data) {\n transform({\n $addToSet,\n $inc,\n $pull,\n $push,\n adapter,\n data: item,\n fields,\n globalSlug,\n operation,\n validateRelationships,\n })\n }\n return\n }\n\n const {\n payload: { config },\n } = adapter\n\n if (operation === 'read') {\n delete data['__v']\n data.id = data._id || data.id\n delete data['_id']\n\n if (isObjectID(data.id)) {\n data.id = data.id.toHexString()\n }\n\n // Handle BigInt conversion for custom ID fields of type 'number'\n if (adapter.useBigIntForNumberIDs && typeof data.id === 'bigint') {\n data.id = Number(data.id)\n }\n\n if (!adapter.allowAdditionalKeys) {\n stripFields({\n config,\n data,\n fields: flattenAllFields({ cache: true, fields }),\n reservedKeys: ['id', 'globalType'],\n })\n }\n }\n\n if (operation === 'write' && globalSlug) {\n data.globalType = globalSlug\n }\n\n const sanitize: TraverseFieldsCallback = ({\n field,\n parentIsLocalized,\n parentPath,\n parentRef: incomingParentRef,\n ref: incomingRef,\n }) => {\n if (!incomingRef || typeof incomingRef !== 'object') {\n return\n }\n\n const ref = incomingRef as Record<string, unknown>\n const parentRef = (incomingParentRef || {}) as Record<string, unknown>\n\n // Clear empty parent containers by setting them to undefined.\n const clearEmptyContainer = () => {\n if (!parentRef || typeof parentRef !== 'object') {\n return\n }\n if (!ref || typeof ref !== 'object') {\n return\n }\n if (Object.keys(ref).length > 0) {\n return\n }\n const containerKey = Object.keys(parentRef).find((k) => parentRef[k] === ref)\n if (containerKey) {\n parentRef[containerKey] = undefined\n }\n }\n\n if (\n $inc &&\n field.type === 'number' &&\n operation === 'write' &&\n field.name in ref &&\n ref[field.name]\n ) {\n const value = ref[field.name]\n if (value && typeof value === 'object' && '$inc' in value && typeof value.$inc === 'number') {\n $inc[`${parentPath}${field.name}`] = value.$inc\n delete ref[field.name]\n clearEmptyContainer()\n }\n }\n\n if (\n $push &&\n field.type === 'array' &&\n operation === 'write' &&\n field.name in ref &&\n ref[field.name]\n ) {\n const value = ref[field.name]\n\n if (\n value &&\n typeof value === 'object' &&\n ('$push' in value ||\n (config.localization &&\n fieldShouldBeLocalized({ field, parentIsLocalized }) &&\n Object.values(value).some(\n (localeValue) =>\n localeValue && typeof localeValue === 'object' && '$push' in localeValue,\n )))\n ) {\n if (config.localization && fieldShouldBeLocalized({ field, parentIsLocalized })) {\n // Handle localized fields: { field: { locale: { $push: data } } }\n let hasLocaleOperations = false\n Object.entries(value).forEach(([localeKey, localeValue]) => {\n if (localeValue && typeof localeValue === 'object' && '$push' in localeValue) {\n hasLocaleOperations = true\n const push = localeValue.$push\n if (Array.isArray(push)) {\n $push[`${parentPath}${field.name}.${localeKey}`] = { $each: push }\n } else if (typeof push === 'object') {\n $push[`${parentPath}${field.name}.${localeKey}`] = push\n }\n }\n })\n\n if (hasLocaleOperations) {\n delete ref[field.name]\n clearEmptyContainer()\n }\n } else if (value && typeof value === 'object' && '$push' in value) {\n // Handle non-localized fields: { field: { $push: data } }\n const push = value.$push\n if (Array.isArray(push)) {\n $push[`${parentPath}${field.name}`] = { $each: push }\n } else if (typeof push === 'object') {\n $push[`${parentPath}${field.name}`] = push\n }\n delete ref[field.name]\n clearEmptyContainer()\n }\n }\n }\n\n // Handle $push operation for relationship fields (converts to $addToSet)\n\n // Handle $push operation for relationship fields (converts to $addToSet) - unified approach\n if (\n $addToSet &&\n (field.type === 'relationship' || field.type === 'upload') &&\n 'hasMany' in field &&\n field.hasMany &&\n operation === 'write' &&\n field.name in ref &&\n ref[field.name]\n ) {\n const value = ref[field.name]\n\n if (\n value &&\n typeof value === 'object' &&\n ('$push' in value ||\n (config.localization &&\n fieldShouldBeLocalized({ field, parentIsLocalized }) &&\n Object.values(value).some(\n (localeValue) =>\n localeValue &&\n typeof localeValue === 'object' &&\n '$push' in (localeValue as Record<string, unknown>),\n )))\n ) {\n if (config.localization && fieldShouldBeLocalized({ field, parentIsLocalized })) {\n // Handle localized fields: { field: { locale: { $push: data } } }\n let hasLocaleOperations = false\n Object.entries(value).forEach(([localeKey, localeValue]) => {\n if (localeValue && typeof localeValue === 'object' && '$push' in localeValue) {\n hasLocaleOperations = true\n const push = localeValue.$push\n const localeItems = Array.isArray(push) ? push : [push]\n const processedLocaleItems = processRelationshipValues(\n localeItems,\n field,\n config,\n operation,\n validateRelationships,\n adapter,\n )\n $addToSet[`${parentPath}${field.name}.${localeKey}`] = { $each: processedLocaleItems }\n }\n })\n\n if (hasLocaleOperations) {\n delete ref[field.name]\n clearEmptyContainer()\n }\n } else if (value && typeof value === 'object' && '$push' in value) {\n // Handle non-localized fields: { field: { $push: data } }\n const itemsToAppend = Array.isArray(value.$push) ? value.$push : [value.$push]\n const processedItems = processRelationshipValues(\n itemsToAppend,\n field,\n config,\n operation,\n validateRelationships,\n adapter,\n )\n $addToSet[`${parentPath}${field.name}`] = { $each: processedItems }\n delete ref[field.name]\n clearEmptyContainer()\n }\n }\n }\n\n // Handle $remove operation for relationship fields (converts to $pull)\n if (\n $pull &&\n (field.type === 'relationship' || field.type === 'upload') &&\n 'hasMany' in field &&\n field.hasMany &&\n operation === 'write' &&\n field.name in ref &&\n ref[field.name]\n ) {\n const value = ref[field.name]\n if (\n value &&\n typeof value === 'object' &&\n ('$remove' in value ||\n (config.localization &&\n fieldShouldBeLocalized({ field, parentIsLocalized }) &&\n Object.values(value).some(\n (localeValue) =>\n localeValue &&\n typeof localeValue === 'object' &&\n '$remove' in (localeValue as Record<string, unknown>),\n )))\n ) {\n if (config.localization && fieldShouldBeLocalized({ field, parentIsLocalized })) {\n // Handle localized fields: { field: { locale: { $remove: data } } }\n let hasLocaleOperations = false\n Object.entries(value).forEach(([localeKey, localeValue]) => {\n if (localeValue && typeof localeValue === 'object' && '$remove' in localeValue) {\n hasLocaleOperations = true\n const remove = localeValue.$remove\n const localeItems = Array.isArray(remove) ? remove : [remove]\n const processedLocaleItems = processRelationshipValues(\n localeItems,\n field,\n config,\n operation,\n validateRelationships,\n adapter,\n )\n $pull[`${parentPath}${field.name}.${localeKey}`] = { $in: processedLocaleItems }\n }\n })\n\n if (hasLocaleOperations) {\n delete ref[field.name]\n clearEmptyContainer()\n }\n } else if (value && typeof value === 'object' && '$remove' in value) {\n // Handle non-localized fields: { field: { $remove: data } }\n const itemsToRemove = Array.isArray(value.$remove) ? value.$remove : [value.$remove]\n const processedItems = processRelationshipValues(\n itemsToRemove,\n field,\n config,\n operation,\n validateRelationships,\n adapter,\n )\n $pull[`${parentPath}${field.name}`] = { $in: processedItems }\n delete ref[field.name]\n clearEmptyContainer()\n }\n }\n }\n\n if (field.type === 'date' && operation === 'read' && field.name in ref && ref[field.name]) {\n if (config.localization && fieldShouldBeLocalized({ field, parentIsLocalized })) {\n const fieldRef = ref[field.name] as Record<string, unknown>\n if (!fieldRef || typeof fieldRef !== 'object') {\n return\n }\n\n for (const locale of config.localization.localeCodes) {\n sanitizeDate({\n field,\n locale,\n ref: fieldRef,\n value: fieldRef[locale],\n })\n }\n } else {\n sanitizeDate({\n field,\n ref,\n value: ref[field.name],\n })\n }\n }\n\n if (\n field.type === 'relationship' ||\n field.type === 'upload' ||\n (operation === 'read' && field.type === 'join')\n ) {\n if (!ref[field.name]) {\n return\n }\n\n // handle localized relationships\n if (config.localization && fieldShouldBeLocalized({ field, parentIsLocalized })) {\n const locales = config.localization.locales\n const fieldRef = ref[field.name] as Record<string, unknown>\n if (typeof fieldRef !== 'object') {\n return\n }\n\n for (const { code } of locales) {\n const value = fieldRef[code]\n if (value) {\n sanitizeRelationship({\n adapter,\n config,\n field,\n locale: code,\n operation,\n ref: fieldRef,\n validateRelationships,\n value,\n })\n }\n }\n } else {\n // handle non-localized relationships\n sanitizeRelationship({\n adapter,\n config,\n field,\n locale: undefined,\n operation,\n ref,\n validateRelationships,\n value: ref[field.name],\n })\n }\n }\n }\n\n traverseFields({\n callback: sanitize,\n config,\n fields,\n fillEmpty: false,\n parentIsLocalized,\n ref: data,\n })\n\n if (operation === 'write') {\n if (typeof data.updatedAt === 'undefined') {\n // If data.updatedAt is explicitly set to `null` we should not set it - this means we don't want to change the value of updatedAt.\n data.updatedAt = new Date().toISOString()\n } else if (data.updatedAt === null) {\n // `updatedAt` may be explicitly set to null to disable updating it - if that is the case, we need to delete the property. Keeping it as null will\n // cause the database to think we want to set it to null, which we don't.\n delete data.updatedAt\n }\n }\n}\n"],"names":["Types","flattenAllFields","traverseFields","fieldAffectsData","fieldShouldBeLocalized","isObjectID","isValidRelationObject","value","processRelationshipValues","items","field","config","operation","validateRelationships","adapter","map","item","Array","isArray","relationTo","relatedCollection","collections","find","slug","convertRelationshipValue","customIDField","fields","name","toHexString","type","useBigIntForNumberIDs","Number","ObjectId","e","sanitizeRelationship","locale","ref","docs","i","length","collection","JSON","parse","stringify","result","hasManyRelations","val","relatedCollectionForSingleValue","sanitizeDate","Date","toISOString","stripFields","data","reservedKeys","k","some","includes","fieldData","push","localized","localization","localeKey","localeCodes","code","localeData","hasNull","flattenedFields","maybeBlock","undefined","blockReferences","maybeBlockReference","each","blockType","blocks","filter","Boolean","transform","$addToSet","$inc","$pull","$push","globalSlug","parentIsLocalized","payload","id","_id","allowAdditionalKeys","cache","globalType","sanitize","parentPath","parentRef","incomingParentRef","incomingRef","clearEmptyContainer","Object","keys","containerKey","values","localeValue","hasLocaleOperations","entries","forEach","$each","hasMany","localeItems","processedLocaleItems","itemsToAppend","processedItems","remove","$remove","$in","itemsToRemove","fieldRef","locales","callback","fillEmpty","updatedAt"],"mappings":"AAaA,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pG;4BACAN;wBACF;oBACF;gBACF;YACF,OAAO;gBACL,qCAAqC;gBACrC2B,qBAAqB;oBACnBpB;oBACAH;oBACAD;oBACAyB,QAAQiC;oBACRxD;oBACAwB;oBACAvB;oBACAN,OAAO6B,GAAG,CAAC1B,MAAMiB,IAAI,CAAC;gBACxB;YACF;QACF;IACF;IAEAzB,eAAe;QACbiH,UAAU1B;QACV9E;QACAe;QACA0F,WAAW;QACXlC;QACA9C,KAAKgB;IACP;IAEA,IAAIxC,cAAc,SAAS;QACzB,IAAI,OAAOwC,KAAKiE,SAAS,KAAK,aAAa;YACzC,kIAAkI;YAClIjE,KAAKiE,SAAS,GAAG,IAAIpE,OAAOC,WAAW;QACzC,OAAO,IAAIE,KAAKiE,SAAS,KAAK,MAAM;YAClC,kJAAkJ;YAClJ,yEAAyE;YACzE,OAAOjE,KAAKiE,SAAS;QACvB;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../src/utilities/transform.ts"],"sourcesContent":["import type {\n CollectionConfig,\n DateField,\n Field,\n FlattenedBlock,\n FlattenedField,\n JoinField,\n RelationshipField,\n SanitizedConfig,\n TraverseFieldsCallback,\n UploadField,\n} from 'payload'\n\nimport { Types } from 'mongoose'\nimport { flattenAllFields, traverseFields } from 'payload'\nimport { fieldAffectsData, fieldShouldBeLocalized } from 'payload/shared'\n\nimport type { MongooseAdapter } from '../index.js'\n\nimport { isObjectID } from './isObjectID.js'\n\ninterface RelationObject {\n relationTo: string\n value: number | string\n}\n\nfunction isValidRelationObject(value: unknown): value is RelationObject {\n return typeof value === 'object' && value !== null && 'relationTo' in value && 'value' in value\n}\n\n/**\n * Process relationship values for polymorphic and simple relationships\n * Used by both $push and $remove operations\n */\nconst processRelationshipValues = (\n items: unknown[],\n field: RelationshipField | UploadField,\n config: SanitizedConfig,\n operation: 'read' | 'write',\n validateRelationships: boolean,\n adapter: MongooseAdapter,\n) => {\n return items.map((item) => {\n // Handle polymorphic relationships\n if (Array.isArray(field.relationTo) && isValidRelationObject(item)) {\n const relatedCollection = config.collections?.find(({ slug }) => slug === item.relationTo)\n if (relatedCollection) {\n return {\n relationTo: item.relationTo,\n value: convertRelationshipValue({\n adapter,\n operation,\n relatedCollection,\n validateRelationships,\n value: item.value,\n }),\n }\n }\n return item\n }\n\n // Handle simple relationships\n if (typeof field.relationTo === 'string') {\n const relatedCollection = config.collections?.find(({ slug }) => slug === field.relationTo)\n if (relatedCollection) {\n return convertRelationshipValue({\n adapter,\n operation,\n relatedCollection,\n validateRelationships,\n value: item,\n })\n }\n }\n\n return item\n })\n}\n\nconst convertRelationshipValue = ({\n adapter,\n operation,\n relatedCollection,\n validateRelationships,\n value,\n}: {\n adapter: MongooseAdapter\n operation: Args['operation']\n relatedCollection: CollectionConfig\n validateRelationships?: boolean\n value: unknown\n}) => {\n const customIDField = relatedCollection.fields.find(\n (field) => fieldAffectsData(field) && field.name === 'id',\n )\n\n if (operation === 'read') {\n if (isObjectID(value)) {\n return value.toHexString()\n }\n\n if (\n customIDField?.type === 'number' &&\n typeof value === 'bigint' &&\n adapter.useBigIntForNumberIDs\n ) {\n return Number(value)\n }\n\n return value\n }\n\n if (customIDField) {\n return value\n }\n\n if (typeof value === 'string') {\n try {\n return new Types.ObjectId(value)\n } catch (e) {\n if (validateRelationships) {\n throw e\n }\n return value\n }\n }\n\n return value\n}\n\nconst sanitizeRelationship = ({\n adapter,\n config,\n field,\n locale,\n operation,\n ref,\n validateRelationships,\n value,\n}: {\n adapter: MongooseAdapter\n config: SanitizedConfig\n field: JoinField | RelationshipField | UploadField\n locale?: string\n operation: Args['operation']\n ref: Record<string, unknown>\n validateRelationships?: boolean\n value?: unknown\n}) => {\n if (field.type === 'join') {\n if (\n operation === 'read' &&\n value &&\n typeof value === 'object' &&\n 'docs' in value &&\n Array.isArray(value.docs)\n ) {\n for (let i = 0; i < value.docs.length; i++) {\n const item = value.docs[i]\n\n if (isObjectID(item)) {\n value.docs[i] = item.toHexString()\n } else if (Array.isArray(field.collection) && item) {\n // Fields here for polymorphic joins cannot be determinted, JSON.parse needed\n value.docs[i] = JSON.parse(JSON.stringify(value.docs[i]))\n }\n }\n }\n\n return value\n }\n let relatedCollection: CollectionConfig | undefined\n let result = value\n\n const hasManyRelations = typeof field.relationTo !== 'string'\n\n if (!hasManyRelations) {\n relatedCollection = config.collections?.find(({ slug }) => slug === field.relationTo)\n }\n\n if (Array.isArray(value)) {\n result = value.map((val) => {\n // Handle has many - polymorphic\n if (isValidRelationObject(val)) {\n const relatedCollectionForSingleValue = config.collections?.find(\n ({ slug }) => slug === val.relationTo,\n )\n\n if (relatedCollectionForSingleValue) {\n return {\n relationTo: val.relationTo,\n value: convertRelationshipValue({\n adapter,\n operation,\n relatedCollection: relatedCollectionForSingleValue,\n validateRelationships,\n value: val.value,\n }),\n }\n }\n }\n\n if (relatedCollection) {\n return convertRelationshipValue({\n adapter,\n operation,\n relatedCollection,\n validateRelationships,\n value: val,\n })\n }\n\n return val\n })\n }\n // Handle has one - polymorphic\n else if (isValidRelationObject(value)) {\n relatedCollection = config.collections?.find(({ slug }) => slug === value.relationTo)\n\n if (relatedCollection) {\n result = {\n relationTo: value.relationTo,\n value: convertRelationshipValue({\n adapter,\n operation,\n relatedCollection,\n validateRelationships,\n value: value.value,\n }),\n }\n }\n }\n // Handle has one\n else if (relatedCollection) {\n result = convertRelationshipValue({\n adapter,\n operation,\n relatedCollection,\n validateRelationships,\n value,\n })\n }\n\n if (locale) {\n ref[locale] = result\n } else {\n ref[field.name] = result\n }\n}\n\nconst sanitizeDate = ({\n field,\n locale,\n ref,\n value,\n}: {\n field: DateField\n locale?: string\n ref: Record<string, unknown>\n value: unknown\n}) => {\n if (!value) {\n return\n }\n\n if (value instanceof Date) {\n value = value.toISOString()\n }\n\n if (locale) {\n ref[locale] = value\n } else {\n ref[field.name] = value\n }\n}\n\ntype Args = {\n $addToSet?: Record<string, { $each: any[] } | any>\n $inc?: Record<string, number>\n $pull?: Record<string, { $in: any[] } | any>\n $push?: Record<string, { $each: any[] } | any>\n /** instance of the adapter */\n adapter: MongooseAdapter\n /** data to transform, can be an array of documents or a single document */\n data: Record<string, unknown> | Record<string, unknown>[]\n /** fields accossiated with the data */\n fields: Field[]\n /** slug of the global, pass only when the operation is `write` */\n globalSlug?: string\n /**\n * Type of the operation\n * read - sanitizes ObjectIDs, Date to strings.\n * write - sanitizes string relationships to ObjectIDs.\n */\n operation: 'read' | 'write'\n parentIsLocalized?: boolean\n /**\n * Throw errors on invalid relationships\n * @default true\n */\n validateRelationships?: boolean\n}\n\nconst stripFields = ({\n config,\n data,\n fields,\n reservedKeys = [],\n}: {\n config: SanitizedConfig\n data: any\n fields: FlattenedField[]\n reservedKeys?: string[]\n}) => {\n for (const k in data) {\n if (!fields.some((field) => field.name === k) && !reservedKeys.includes(k)) {\n delete data[k]\n }\n }\n\n for (const field of fields) {\n reservedKeys = []\n const fieldData = data[field.name]\n if (!fieldData || typeof fieldData !== 'object') {\n continue\n }\n\n if (field.type === 'blocks') {\n reservedKeys.push('blockType')\n }\n\n if ('flattenedFields' in field || 'blocks' in field) {\n if (field.localized && config.localization) {\n for (const localeKey in fieldData) {\n if (!config.localization.localeCodes.some((code) => code === localeKey)) {\n delete fieldData[localeKey]\n continue\n }\n\n const localeData = fieldData[localeKey]\n\n if (!localeData || typeof localeData !== 'object') {\n if (field.type === 'blocks') {\n fieldData[localeKey] = []\n }\n continue\n }\n\n if (field.type === 'array' || field.type === 'blocks') {\n if (!Array.isArray(localeData)) {\n continue\n }\n\n let hasNull = false\n for (let i = 0; i < localeData.length; i++) {\n const data = localeData[i]\n let fields: FlattenedField[] | null = null\n\n if (field.type === 'array') {\n fields = field.flattenedFields\n } else {\n let maybeBlock: FlattenedBlock | undefined = undefined\n\n if (field.blockReferences) {\n const maybeBlockReference = field.blockReferences.find((each) => {\n const slug = typeof each === 'string' ? each : each.slug\n return slug === data.blockType\n })\n\n if (maybeBlockReference) {\n if (typeof maybeBlockReference === 'object') {\n maybeBlock = maybeBlockReference\n } else {\n maybeBlock = config.blocks?.find((each) => each.slug === maybeBlockReference)\n }\n }\n }\n\n if (!maybeBlock) {\n maybeBlock = field.blocks.find((each) => each.slug === data.blockType)\n }\n\n if (maybeBlock) {\n fields = maybeBlock.flattenedFields\n } else {\n localeData[i] = null\n hasNull = true\n }\n }\n\n if (!fields) {\n continue\n }\n\n stripFields({ config, data, fields, reservedKeys })\n }\n\n if (hasNull) {\n fieldData[localeKey] = localeData.filter(Boolean)\n }\n\n continue\n } else {\n stripFields({ config, data: localeData, fields: field.flattenedFields, reservedKeys })\n }\n }\n continue\n }\n\n if (field.type === 'array' || field.type === 'blocks') {\n if (!Array.isArray(fieldData)) {\n continue\n }\n\n let hasNull = false\n\n for (let i = 0; i < fieldData.length; i++) {\n const data = fieldData[i]\n let fields: FlattenedField[] | null = null\n\n if (field.type === 'array') {\n fields = field.flattenedFields\n } else {\n let maybeBlock: FlattenedBlock | undefined = undefined\n\n if (field.blockReferences) {\n const maybeBlockReference = field.blockReferences.find((each) => {\n const slug = typeof each === 'string' ? each : each.slug\n return slug === data.blockType\n })\n\n if (maybeBlockReference) {\n if (typeof maybeBlockReference === 'object') {\n maybeBlock = maybeBlockReference\n } else {\n maybeBlock = config.blocks?.find((each) => each.slug === maybeBlockReference)\n }\n }\n }\n\n if (!maybeBlock) {\n maybeBlock = field.blocks.find((each) => each.slug === data.blockType)\n }\n\n if (maybeBlock) {\n fields = maybeBlock.flattenedFields\n } else {\n fieldData[i] = null\n hasNull = true\n }\n }\n\n if (!fields) {\n continue\n }\n\n stripFields({ config, data, fields, reservedKeys })\n }\n\n if (hasNull) {\n data[field.name] = fieldData.filter(Boolean)\n }\n\n continue\n } else {\n stripFields({ config, data: fieldData, fields: field.flattenedFields, reservedKeys })\n }\n }\n }\n}\n\n/**\n * A function that transforms Payload <-> MongoDB data.\n * @internal - this function may be removed or receive breaking changes in minor releases.\n * @experimental\n */\n\nexport const transform = ({\n $addToSet,\n $inc,\n $pull,\n $push,\n adapter,\n data,\n fields,\n globalSlug,\n operation,\n parentIsLocalized = false,\n validateRelationships = true,\n}: Args) => {\n if (!data) {\n return null\n }\n\n if (Array.isArray(data)) {\n for (const item of data) {\n transform({\n $addToSet,\n $inc,\n $pull,\n $push,\n adapter,\n data: item,\n fields,\n globalSlug,\n operation,\n validateRelationships,\n })\n }\n return\n }\n\n const {\n payload: { config },\n } = adapter\n\n if (operation === 'read') {\n delete data['__v']\n data.id = data._id || data.id\n delete data['_id']\n\n if (isObjectID(data.id)) {\n data.id = data.id.toHexString()\n }\n\n // Handle BigInt conversion for custom ID fields of type 'number'\n if (adapter.useBigIntForNumberIDs && typeof data.id === 'bigint') {\n data.id = Number(data.id)\n }\n\n if (!adapter.allowAdditionalKeys) {\n stripFields({\n config,\n data,\n fields: flattenAllFields({ cache: true, fields }),\n reservedKeys: ['id', 'globalType'],\n })\n }\n }\n\n if (operation === 'write' && globalSlug) {\n data.globalType = globalSlug\n }\n\n const sanitize: TraverseFieldsCallback = ({\n field,\n parentIsLocalized,\n parentPath,\n parentRef: incomingParentRef,\n ref: incomingRef,\n }) => {\n if (!incomingRef || typeof incomingRef !== 'object') {\n return\n }\n\n const ref = incomingRef as Record<string, unknown>\n const parentRef = (incomingParentRef || {}) as Record<string, unknown>\n\n // Clear empty parent containers by setting them to undefined.\n const clearEmptyContainer = () => {\n if (!parentRef || typeof parentRef !== 'object') {\n return\n }\n if (!ref || typeof ref !== 'object') {\n return\n }\n if (Object.keys(ref).length > 0) {\n return\n }\n const containerKey = Object.keys(parentRef).find((k) => parentRef[k] === ref)\n if (containerKey) {\n parentRef[containerKey] = undefined\n }\n }\n\n if (\n $inc &&\n field.type === 'number' &&\n operation === 'write' &&\n field.name in ref &&\n ref[field.name]\n ) {\n const value = ref[field.name]\n if (value && typeof value === 'object' && '$inc' in value && typeof value.$inc === 'number') {\n $inc[`${parentPath}${field.name}`] = value.$inc\n delete ref[field.name]\n clearEmptyContainer()\n }\n }\n\n if (\n $push &&\n field.type === 'array' &&\n operation === 'write' &&\n field.name in ref &&\n ref[field.name]\n ) {\n const value = ref[field.name]\n\n if (\n value &&\n typeof value === 'object' &&\n ('$push' in value ||\n (config.localization &&\n fieldShouldBeLocalized({ field, parentIsLocalized }) &&\n Object.values(value).some(\n (localeValue) =>\n localeValue && typeof localeValue === 'object' && '$push' in localeValue,\n )))\n ) {\n if (config.localization && fieldShouldBeLocalized({ field, parentIsLocalized })) {\n // Handle localized fields: { field: { locale: { $push: data } } }\n let hasLocaleOperations = false\n Object.entries(value).forEach(([localeKey, localeValue]) => {\n if (localeValue && typeof localeValue === 'object' && '$push' in localeValue) {\n hasLocaleOperations = true\n const push = localeValue.$push\n if (Array.isArray(push)) {\n $push[`${parentPath}${field.name}.${localeKey}`] = { $each: push }\n } else if (typeof push === 'object') {\n $push[`${parentPath}${field.name}.${localeKey}`] = push\n }\n }\n })\n\n if (hasLocaleOperations) {\n delete ref[field.name]\n clearEmptyContainer()\n }\n } else if (value && typeof value === 'object' && '$push' in value) {\n // Handle non-localized fields: { field: { $push: data } }\n const push = value.$push\n if (Array.isArray(push)) {\n $push[`${parentPath}${field.name}`] = { $each: push }\n } else if (typeof push === 'object') {\n $push[`${parentPath}${field.name}`] = push\n }\n delete ref[field.name]\n clearEmptyContainer()\n }\n }\n }\n\n // Handle $push operation for relationship fields (converts to $addToSet)\n\n // Handle $push operation for relationship fields (converts to $addToSet) - unified approach\n if (\n $addToSet &&\n (field.type === 'relationship' || field.type === 'upload') &&\n 'hasMany' in field &&\n field.hasMany &&\n operation === 'write' &&\n field.name in ref &&\n ref[field.name]\n ) {\n const value = ref[field.name]\n\n if (\n value &&\n typeof value === 'object' &&\n ('$push' in value ||\n (config.localization &&\n fieldShouldBeLocalized({ field, parentIsLocalized }) &&\n Object.values(value).some(\n (localeValue) =>\n localeValue &&\n typeof localeValue === 'object' &&\n '$push' in (localeValue as Record<string, unknown>),\n )))\n ) {\n if (config.localization && fieldShouldBeLocalized({ field, parentIsLocalized })) {\n // Handle localized fields: { field: { locale: { $push: data } } }\n let hasLocaleOperations = false\n Object.entries(value).forEach(([localeKey, localeValue]) => {\n if (localeValue && typeof localeValue === 'object' && '$push' in localeValue) {\n hasLocaleOperations = true\n const push = localeValue.$push\n const localeItems = Array.isArray(push) ? push : [push]\n const processedLocaleItems = processRelationshipValues(\n localeItems,\n field,\n config,\n operation,\n validateRelationships,\n adapter,\n )\n $addToSet[`${parentPath}${field.name}.${localeKey}`] = { $each: processedLocaleItems }\n }\n })\n\n if (hasLocaleOperations) {\n delete ref[field.name]\n clearEmptyContainer()\n }\n } else if (value && typeof value === 'object' && '$push' in value) {\n // Handle non-localized fields: { field: { $push: data } }\n const itemsToAppend = Array.isArray(value.$push) ? value.$push : [value.$push]\n const processedItems = processRelationshipValues(\n itemsToAppend,\n field,\n config,\n operation,\n validateRelationships,\n adapter,\n )\n $addToSet[`${parentPath}${field.name}`] = { $each: processedItems }\n delete ref[field.name]\n clearEmptyContainer()\n }\n }\n }\n\n // Handle $remove operation for relationship fields (converts to $pull)\n if (\n $pull &&\n (field.type === 'relationship' || field.type === 'upload') &&\n 'hasMany' in field &&\n field.hasMany &&\n operation === 'write' &&\n field.name in ref &&\n ref[field.name]\n ) {\n const value = ref[field.name]\n if (\n value &&\n typeof value === 'object' &&\n ('$remove' in value ||\n (config.localization &&\n fieldShouldBeLocalized({ field, parentIsLocalized }) &&\n Object.values(value).some(\n (localeValue) =>\n localeValue &&\n typeof localeValue === 'object' &&\n '$remove' in (localeValue as Record<string, unknown>),\n )))\n ) {\n if (config.localization && fieldShouldBeLocalized({ field, parentIsLocalized })) {\n // Handle localized fields: { field: { locale: { $remove: data } } }\n let hasLocaleOperations = false\n Object.entries(value).forEach(([localeKey, localeValue]) => {\n if (localeValue && typeof localeValue === 'object' && '$remove' in localeValue) {\n hasLocaleOperations = true\n const remove = localeValue.$remove\n const localeItems = Array.isArray(remove) ? remove : [remove]\n const processedLocaleItems = processRelationshipValues(\n localeItems,\n field,\n config,\n operation,\n validateRelationships,\n adapter,\n )\n $pull[`${parentPath}${field.name}.${localeKey}`] = { $in: processedLocaleItems }\n }\n })\n\n if (hasLocaleOperations) {\n delete ref[field.name]\n clearEmptyContainer()\n }\n } else if (value && typeof value === 'object' && '$remove' in value) {\n // Handle non-localized fields: { field: { $remove: data } }\n const itemsToRemove = Array.isArray(value.$remove) ? value.$remove : [value.$remove]\n const processedItems = processRelationshipValues(\n itemsToRemove,\n field,\n config,\n operation,\n validateRelationships,\n adapter,\n )\n $pull[`${parentPath}${field.name}`] = { $in: processedItems }\n delete ref[field.name]\n clearEmptyContainer()\n }\n }\n }\n\n if (field.type === 'date' && operation === 'read' && field.name in ref && ref[field.name]) {\n if (config.localization && fieldShouldBeLocalized({ field, parentIsLocalized })) {\n const fieldRef = ref[field.name] as Record<string, unknown>\n if (!fieldRef || typeof fieldRef !== 'object') {\n return\n }\n\n for (const locale of config.localization.localeCodes) {\n sanitizeDate({\n field,\n locale,\n ref: fieldRef,\n value: fieldRef[locale],\n })\n }\n } else {\n sanitizeDate({\n field,\n ref,\n value: ref[field.name],\n })\n }\n }\n\n if (\n field.type === 'relationship' ||\n field.type === 'upload' ||\n (operation === 'read' && field.type === 'join')\n ) {\n if (!ref[field.name]) {\n return\n }\n\n // handle localized relationships\n if (config.localization && fieldShouldBeLocalized({ field, parentIsLocalized })) {\n const locales = config.localization.locales\n const fieldRef = ref[field.name] as Record<string, unknown>\n if (typeof fieldRef !== 'object') {\n return\n }\n\n for (const { code } of locales) {\n const value = fieldRef[code]\n if (value) {\n sanitizeRelationship({\n adapter,\n config,\n field,\n locale: code,\n operation,\n ref: fieldRef,\n validateRelationships,\n value,\n })\n }\n }\n } else {\n // handle non-localized relationships\n sanitizeRelationship({\n adapter,\n config,\n field,\n locale: undefined,\n operation,\n ref,\n validateRelationships,\n value: ref[field.name],\n })\n }\n }\n }\n\n traverseFields({\n callback: sanitize,\n config,\n fields,\n fillEmpty: false,\n parentIsLocalized,\n ref: data,\n })\n\n if (operation === 'write') {\n if (typeof data.updatedAt === 'undefined') {\n // If data.updatedAt is explicitly set to `null` we should not set it - this means we don't want to change the value of updatedAt.\n data.updatedAt = new Date().toISOString()\n } else if (data.updatedAt === null) {\n // `updatedAt` may be explicitly set to null to disable updating it - if that is the case, we need to delete the property. Keeping it as null will\n // cause the database to think we want to set it to null, which we don't.\n delete data.updatedAt\n }\n }\n}\n"],"names":["Types","flattenAllFields","traverseFields","fieldAffectsData","fieldShouldBeLocalized","isObjectID","isValidRelationObject","value","processRelationshipValues","items","field","config","operation","validateRelationships","adapter","map","item","Array","isArray","relationTo","relatedCollection","collections","find","slug","convertRelationshipValue","customIDField","fields","name","toHexString","type","useBigIntForNumberIDs","Number","ObjectId","e","sanitizeRelationship","locale","ref","docs","i","length","collection","JSON","parse","stringify","result","hasManyRelations","val","relatedCollectionForSingleValue","sanitizeDate","Date","toISOString","stripFields","data","reservedKeys","k","some","includes","fieldData","push","localized","localization","localeKey","localeCodes","code","localeData","hasNull","flattenedFields","maybeBlock","undefined","blockReferences","maybeBlockReference","each","blockType","blocks","filter","Boolean","transform","$addToSet","$inc","$pull","$push","globalSlug","parentIsLocalized","payload","id","_id","allowAdditionalKeys","cache","globalType","sanitize","parentPath","parentRef","incomingParentRef","incomingRef","clearEmptyContainer","Object","keys","containerKey","values","localeValue","hasLocaleOperations","entries","forEach","$each","hasMany","localeItems","processedLocaleItems","itemsToAppend","processedItems","remove","$remove","$in","itemsToRemove","fieldRef","locales","callback","fillEmpty","updatedAt"],"mappings":"AAaA,SAASA,KAAK,QAAQ,WAAU;AAChC,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,UAAS;AAC1D,SAASC,gBAAgB,EAAEC,sBAAsB,QAAQ,iBAAgB;AAIzE,SAASC,UAAU,QAAQ,kBAAiB;AAO5C,SAASC,sBAAsBC,KAAc;IAC3C,OAAO,OAAOA,UAAU,YAAYA,UAAU,QAAQ,gBAAgBA,SAAS,WAAWA;AAC5F;AAEA;;;CAGC,GACD,MAAMC,4BAA4B,CAChCC,O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IAEA,IAAIxC,cAAc,SAAS;QACzB,IAAI,OAAOwC,KAAKiE,SAAS,KAAK,aAAa;YACzC,kIAAkI;YAClIjE,KAAKiE,SAAS,GAAG,IAAIpE,OAAOC,WAAW;QACzC,OAAO,IAAIE,KAAKiE,SAAS,KAAK,MAAM;YAClC,kJAAkJ;YAClJ,yEAAyE;YACzE,OAAOjE,KAAKiE,SAAS;QACvB;IACF;AACF,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/db-mongodb",
3
- "version": "3.64.0-internal.1abde12",
3
+ "version": "3.64.0-internal.26d730f",
4
4
  "description": "The officially supported MongoDB database adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -49,11 +49,11 @@
49
49
  "@types/uuid": "10.0.0",
50
50
  "mongodb": "6.16.0",
51
51
  "mongodb-memory-server": "10.1.4",
52
- "payload": "3.64.0-internal.1abde12",
53
- "@payloadcms/eslint-config": "3.28.0"
52
+ "@payloadcms/eslint-config": "3.28.0",
53
+ "payload": "3.64.0-internal.26d730f"
54
54
  },
55
55
  "peerDependencies": {
56
- "payload": "3.64.0-internal.1abde12"
56
+ "payload": "3.64.0-internal.26d730f"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "pnpm build:types && pnpm build:swc",