@payloadcms/db-mongodb 4.0.0-internal.e16cf59 → 4.0.0-internal.e55ccef
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +1 -2
- package/dist/connect.js.map +1 -1
- package/dist/deleteOne.js.map +1 -1
- package/dist/exports/migration-utils.d.ts +1 -0
- package/dist/exports/migration-utils.d.ts.map +1 -1
- package/dist/exports/migration-utils.js +1 -0
- package/dist/exports/migration-utils.js.map +1 -1
- package/dist/index.d.ts +1 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/models/buildSchema.d.ts.map +1 -1
- package/dist/models/buildSchema.js +15 -1
- package/dist/models/buildSchema.js.map +1 -1
- package/dist/predefinedMigrations/localize-status.d.ts +4 -0
- package/dist/predefinedMigrations/localize-status.d.ts.map +1 -0
- package/dist/predefinedMigrations/localize-status.js +9 -0
- package/dist/predefinedMigrations/localize-status.js.map +1 -0
- package/dist/predefinedMigrations/migrateLocalizeStatus.d.ts +27 -0
- package/dist/predefinedMigrations/migrateLocalizeStatus.d.ts.map +1 -0
- package/dist/predefinedMigrations/migrateLocalizeStatus.js +324 -0
- package/dist/predefinedMigrations/migrateLocalizeStatus.js.map +1 -0
- package/dist/queries/getLocalizedSortProperty.d.ts.map +1 -1
- package/dist/queries/getLocalizedSortProperty.js +1 -1
- package/dist/queries/getLocalizedSortProperty.js.map +1 -1
- package/dist/queries/operatorMap.d.ts.map +1 -1
- package/dist/queries/sanitizeQueryValue.d.ts.map +1 -1
- package/dist/queries/sanitizeQueryValue.js +2 -3
- package/dist/queries/sanitizeQueryValue.js.map +1 -1
- package/dist/testCredentials.d.ts.map +1 -1
- package/dist/transactions/beginTransaction.d.ts.map +1 -1
- package/dist/transactions/beginTransaction.js +0 -1
- package/dist/transactions/beginTransaction.js.map +1 -1
- package/dist/updateGlobal.d.ts.map +1 -1
- package/dist/updateGlobal.js +10 -7
- package/dist/updateGlobal.js.map +1 -1
- package/dist/updateGlobalVersion.d.ts.map +1 -1
- package/dist/updateGlobalVersion.js +10 -7
- package/dist/updateGlobalVersion.js.map +1 -1
- package/dist/updateJobs.d.ts.map +1 -1
- package/dist/updateJobs.js +11 -8
- package/dist/updateJobs.js.map +1 -1
- package/dist/updateMany.d.ts.map +1 -1
- package/dist/updateMany.js +11 -8
- package/dist/updateMany.js.map +1 -1
- package/dist/updateOne.d.ts.map +1 -1
- package/dist/updateOne.js +10 -7
- package/dist/updateOne.js.map +1 -1
- package/dist/updateVersion.d.ts.map +1 -1
- package/dist/updateVersion.js +10 -7
- package/dist/updateVersion.js.map +1 -1
- package/dist/utilities/buildProjectionFromSelect.js +1 -1
- package/dist/utilities/buildProjectionFromSelect.js.map +1 -1
- package/dist/utilities/getEntity.d.ts +1 -1
- package/dist/utilities/transform.d.ts.map +1 -1
- package/dist/utilities/transform.js +10 -34
- package/dist/utilities/transform.js.map +1 -1
- package/dist/utilities/transform.spec.js +3 -3
- package/dist/utilities/transform.spec.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transactions/beginTransaction.ts"],"sourcesContent":["import type { TransactionOptions } from 'mongodb'\nimport type { BeginTransaction } from 'payload'\n\nimport { APIError } from 'payload'\nimport { v4 as uuid } from 'uuid'\n\nimport type { MongooseAdapter } from '../index.js'\n\n// Needs await to fulfill the interface\n// @ts-expect-error TransactionOptions isn't compatible with BeginTransaction of the DatabaseAdapter interface.\n// eslint-disable-next-line @typescript-eslint/require-await\nexport const beginTransaction: BeginTransaction = async function beginTransaction(\n this: MongooseAdapter,\n options: TransactionOptions,\n) {\n if (!this.connection) {\n throw new APIError('beginTransaction called while no connection to the database exists')\n }\n\n const client = this.connection.getClient()\n const id = uuid()\n\n if (!this.sessions[id]) {\n
|
|
1
|
+
{"version":3,"sources":["../../src/transactions/beginTransaction.ts"],"sourcesContent":["import type { TransactionOptions } from 'mongodb'\nimport type { BeginTransaction } from 'payload'\n\nimport { APIError } from 'payload'\nimport { v4 as uuid } from 'uuid'\n\nimport type { MongooseAdapter } from '../index.js'\n\n// Needs await to fulfill the interface\n// @ts-expect-error TransactionOptions isn't compatible with BeginTransaction of the DatabaseAdapter interface.\n// eslint-disable-next-line @typescript-eslint/require-await\nexport const beginTransaction: BeginTransaction = async function beginTransaction(\n this: MongooseAdapter,\n options: TransactionOptions,\n) {\n if (!this.connection) {\n throw new APIError('beginTransaction called while no connection to the database exists')\n }\n\n const client = this.connection.getClient()\n const id = uuid()\n\n if (!this.sessions[id]) {\n this.sessions[id] = client.startSession()\n }\n if (this.sessions[id]?.inTransaction()) {\n this.payload.logger.warn('beginTransaction called while transaction already exists')\n } else {\n this.sessions[id]?.startTransaction(options || (this.transactionOptions as TransactionOptions))\n }\n\n return id\n}\n"],"names":["APIError","v4","uuid","beginTransaction","options","connection","client","getClient","id","sessions","startSession","inTransaction","payload","logger","warn","startTransaction","transactionOptions"],"mappings":"AAGA,SAASA,QAAQ,QAAQ,UAAS;AAClC,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAIjC,uCAAuC;AACvC,+GAA+G;AAC/G,4DAA4D;AAC5D,OAAO,MAAMC,mBAAqC,eAAeA,iBAE/DC,OAA2B;IAE3B,IAAI,CAAC,IAAI,CAACC,UAAU,EAAE;QACpB,MAAM,IAAIL,SAAS;IACrB;IAEA,MAAMM,SAAS,IAAI,CAACD,UAAU,CAACE,SAAS;IACxC,MAAMC,KAAKN;IAEX,IAAI,CAAC,IAAI,CAACO,QAAQ,CAACD,GAAG,EAAE;QACtB,IAAI,CAACC,QAAQ,CAACD,GAAG,GAAGF,OAAOI,YAAY;IACzC;IACA,IAAI,IAAI,CAACD,QAAQ,CAACD,GAAG,EAAEG,iBAAiB;QACtC,IAAI,CAACC,OAAO,CAACC,MAAM,CAACC,IAAI,CAAC;IAC3B,OAAO;QACL,IAAI,CAACL,QAAQ,CAACD,GAAG,EAAEO,iBAAiBX,WAAY,IAAI,CAACY,kBAAkB;IACzE;IAEA,OAAOR;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateGlobal.d.ts","sourceRoot":"","sources":["../src/updateGlobal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAS3C,eAAO,MAAM,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"updateGlobal.d.ts","sourceRoot":"","sources":["../src/updateGlobal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAS3C,eAAO,MAAM,YAAY,EAAE,YAsC1B,CAAA"}
|
package/dist/updateGlobal.js
CHANGED
|
@@ -15,28 +15,31 @@ export const updateGlobal = async function updateGlobal({ slug: globalSlug, data
|
|
|
15
15
|
globalSlug,
|
|
16
16
|
operation: 'write'
|
|
17
17
|
});
|
|
18
|
-
const
|
|
18
|
+
const baseOptions = {
|
|
19
19
|
...optionsArgs,
|
|
20
|
+
session: await getSession(this, req),
|
|
21
|
+
// Timestamps are manually added by the write transform
|
|
22
|
+
timestamps: false
|
|
23
|
+
};
|
|
24
|
+
const findOptions = {
|
|
25
|
+
...baseOptions,
|
|
20
26
|
lean: true,
|
|
21
27
|
new: true,
|
|
22
28
|
projection: buildProjectionFromSelect({
|
|
23
29
|
adapter: this,
|
|
24
30
|
fields: globalConfig.flattenedFields,
|
|
25
31
|
select
|
|
26
|
-
})
|
|
27
|
-
session: await getSession(this, req),
|
|
28
|
-
// Timestamps are manually added by the write transform
|
|
29
|
-
timestamps: false
|
|
32
|
+
})
|
|
30
33
|
};
|
|
31
34
|
if (returning === false) {
|
|
32
35
|
await Model.updateOne({
|
|
33
36
|
globalType: globalSlug
|
|
34
|
-
}, data,
|
|
37
|
+
}, data, baseOptions);
|
|
35
38
|
return null;
|
|
36
39
|
}
|
|
37
40
|
const result = await Model.findOneAndUpdate({
|
|
38
41
|
globalType: globalSlug
|
|
39
|
-
}, data,
|
|
42
|
+
}, data, findOptions);
|
|
40
43
|
transform({
|
|
41
44
|
adapter: this,
|
|
42
45
|
data: result,
|
package/dist/updateGlobal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/updateGlobal.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../src/updateGlobal.ts"],"sourcesContent":["import type { QueryOptions } from 'mongoose'\nimport type { UpdateGlobal } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getGlobal } from './utilities/getEntity.js'\nimport { getSession } from './utilities/getSession.js'\nimport { transform } from './utilities/transform.js'\n\nexport const updateGlobal: UpdateGlobal = async function updateGlobal(\n this: MongooseAdapter,\n { slug: globalSlug, data, options: optionsArgs = {}, req, returning, select },\n) {\n const { globalConfig, Model } = getGlobal({ adapter: this, globalSlug })\n\n const fields = globalConfig.fields\n\n transform({ adapter: this, data, fields, globalSlug, operation: 'write' })\n\n const baseOptions = {\n ...optionsArgs,\n session: await getSession(this, req),\n // Timestamps are manually added by the write transform\n timestamps: false,\n } satisfies QueryOptions\n\n const findOptions: QueryOptions = {\n ...baseOptions,\n lean: true,\n new: true,\n projection: buildProjectionFromSelect({\n adapter: this,\n fields: globalConfig.flattenedFields,\n select,\n }),\n }\n\n if (returning === false) {\n await Model.updateOne({ globalType: globalSlug }, data, baseOptions)\n return null\n }\n\n const result: any = await Model.findOneAndUpdate({ globalType: globalSlug }, data, findOptions)\n\n transform({ adapter: this, data: result, fields, globalSlug, operation: 'read' })\n\n return result\n}\n"],"names":["buildProjectionFromSelect","getGlobal","getSession","transform","updateGlobal","slug","globalSlug","data","options","optionsArgs","req","returning","select","globalConfig","Model","adapter","fields","operation","baseOptions","session","timestamps","findOptions","lean","new","projection","flattenedFields","updateOne","globalType","result","findOneAndUpdate"],"mappings":"AA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AAIlE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAQjD,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EACzE,IAAI,EAAE,eAAe,EACrB,EACE,EAAE,EACF,MAAM,EAAE,UAAU,EAClB,MAAM,EACN,OAAO,EAAE,WAAgB,EACzB,GAAG,EACH,SAAS,EACT,MAAM,EACN,WAAW,EACX,KAAK,GACN,EAAE,uBAAuB,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"updateGlobalVersion.d.ts","sourceRoot":"","sources":["../src/updateGlobalVersion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAIlE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAQjD,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EACzE,IAAI,EAAE,eAAe,EACrB,EACE,EAAE,EACF,MAAM,EAAE,UAAU,EAClB,MAAM,EACN,OAAO,EAAE,WAAgB,EACzB,GAAG,EACH,SAAS,EACT,MAAM,EACN,WAAW,EACX,KAAK,GACN,EAAE,uBAAuB,CAAC,CAAC,CAAC,gBAiD9B"}
|
|
@@ -29,24 +29,27 @@ export async function updateGlobalVersion({ id, global: globalSlug, locale, opti
|
|
|
29
29
|
fields,
|
|
30
30
|
operation: 'write'
|
|
31
31
|
});
|
|
32
|
-
const
|
|
32
|
+
const baseOptions = {
|
|
33
33
|
...optionsArgs,
|
|
34
|
+
session: await getSession(this, req),
|
|
35
|
+
// Timestamps are manually added by the write transform
|
|
36
|
+
timestamps: false
|
|
37
|
+
};
|
|
38
|
+
const findOptions = {
|
|
39
|
+
...baseOptions,
|
|
34
40
|
lean: true,
|
|
35
41
|
new: true,
|
|
36
42
|
projection: buildProjectionFromSelect({
|
|
37
43
|
adapter: this,
|
|
38
44
|
fields: flattenedFields,
|
|
39
45
|
select
|
|
40
|
-
})
|
|
41
|
-
session: await getSession(this, req),
|
|
42
|
-
// Timestamps are manually added by the write transform
|
|
43
|
-
timestamps: false
|
|
46
|
+
})
|
|
44
47
|
};
|
|
45
48
|
if (returning === false) {
|
|
46
|
-
await Model.updateOne(query, versionData,
|
|
49
|
+
await Model.updateOne(query, versionData, baseOptions);
|
|
47
50
|
return null;
|
|
48
51
|
}
|
|
49
|
-
const doc = await Model.findOneAndUpdate(query, versionData,
|
|
52
|
+
const doc = await Model.findOneAndUpdate(query, versionData, findOptions);
|
|
50
53
|
if (!doc) {
|
|
51
54
|
return null;
|
|
52
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/updateGlobalVersion.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../src/updateGlobalVersion.ts"],"sourcesContent":["import type { QueryOptions } from 'mongoose'\nimport type { JsonObject, UpdateGlobalVersionArgs } from 'payload'\n\nimport { buildVersionGlobalFields } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getGlobal } from './utilities/getEntity.js'\nimport { getSession } from './utilities/getSession.js'\nimport { transform } from './utilities/transform.js'\n\nexport async function updateGlobalVersion<T extends JsonObject = JsonObject>(\n this: MongooseAdapter,\n {\n id,\n global: globalSlug,\n locale,\n options: optionsArgs = {},\n req,\n returning,\n select,\n versionData,\n where,\n }: UpdateGlobalVersionArgs<T>,\n) {\n const { globalConfig, Model } = getGlobal({ adapter: this, globalSlug, versions: true })\n const whereToUse = where || { id: { equals: id } }\n\n const fields = buildVersionGlobalFields(this.payload.config, globalConfig)\n const flattenedFields = buildVersionGlobalFields(this.payload.config, globalConfig, true)\n\n const query = await buildQuery({\n adapter: this,\n fields: flattenedFields,\n locale,\n where: whereToUse,\n })\n\n transform({ adapter: this, data: versionData, fields, operation: 'write' })\n\n const baseOptions = {\n ...optionsArgs,\n session: await getSession(this, req),\n // Timestamps are manually added by the write transform\n timestamps: false,\n } satisfies QueryOptions\n\n const findOptions: QueryOptions = {\n ...baseOptions,\n lean: true,\n new: true,\n projection: buildProjectionFromSelect({\n adapter: this,\n fields: flattenedFields,\n select,\n }),\n }\n\n if (returning === false) {\n await Model.updateOne(query, versionData, baseOptions)\n return null\n }\n\n const doc = await Model.findOneAndUpdate(query, versionData, findOptions)\n\n if (!doc) {\n return null\n }\n\n transform({ adapter: this, data: doc, fields, operation: 'read' })\n\n return doc\n}\n"],"names":["buildVersionGlobalFields","buildQuery","buildProjectionFromSelect","getGlobal","getSession","transform","updateGlobalVersion","id","global","globalSlug","locale","options","optionsArgs","req","returning","select","versionData","where","globalConfig","Model","adapter","versions","whereToUse","equals","fields","payload","config","flattenedFields","query","data","operation","baseOptions","session","timestamps","findOptions","lean","new","projection","updateOne","doc","findOneAndUpdate"],"mappings":"AAGA,SAASA,wBAAwB,QAAQ,UAAS;AAIlD,SAASC,UAAU,QAAQ,0BAAyB;AACpD,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,SAAS,QAAQ,2BAA0B;AACpD,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,eAAeC,oBAEpB,EACEC,EAAE,EACFC,QAAQC,UAAU,EAClBC,MAAM,EACNC,SAASC,cAAc,CAAC,CAAC,EACzBC,GAAG,EACHC,SAAS,EACTC,MAAM,EACNC,WAAW,EACXC,KAAK,EACsB;IAE7B,MAAM,EAAEC,YAAY,EAAEC,KAAK,EAAE,GAAGhB,UAAU;QAAEiB,SAAS,IAAI;QAAEX;QAAYY,UAAU;IAAK;IACtF,MAAMC,aAAaL,SAAS;QAAEV,IAAI;YAAEgB,QAAQhB;QAAG;IAAE;IAEjD,MAAMiB,SAASxB,yBAAyB,IAAI,CAACyB,OAAO,CAACC,MAAM,EAAER;IAC7D,MAAMS,kBAAkB3B,yBAAyB,IAAI,CAACyB,OAAO,CAACC,MAAM,EAAER,cAAc;IAEpF,MAAMU,QAAQ,MAAM3B,WAAW;QAC7BmB,SAAS,IAAI;QACbI,QAAQG;QACRjB;QACAO,OAAOK;IACT;IAEAjB,UAAU;QAAEe,SAAS,IAAI;QAAES,MAAMb;QAAaQ;QAAQM,WAAW;IAAQ;IAEzE,MAAMC,cAAc;QAClB,GAAGnB,WAAW;QACdoB,SAAS,MAAM5B,WAAW,IAAI,EAAES;QAChC,uDAAuD;QACvDoB,YAAY;IACd;IAEA,MAAMC,cAA4B;QAChC,GAAGH,WAAW;QACdI,MAAM;QACNC,KAAK;QACLC,YAAYnC,0BAA0B;YACpCkB,SAAS,IAAI;YACbI,QAAQG;YACRZ;QACF;IACF;IAEA,IAAID,cAAc,OAAO;QACvB,MAAMK,MAAMmB,SAAS,CAACV,OAAOZ,aAAae;QAC1C,OAAO;IACT;IAEA,MAAMQ,MAAM,MAAMpB,MAAMqB,gBAAgB,CAACZ,OAAOZ,aAAakB;IAE7D,IAAI,CAACK,KAAK;QACR,OAAO;IACT;IAEAlC,UAAU;QAAEe,SAAS,IAAI;QAAES,MAAMU;QAAKf;QAAQM,WAAW;IAAO;IAEhE,OAAOS;AACT"}
|
package/dist/updateJobs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateJobs.d.ts","sourceRoot":"","sources":["../src/updateJobs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAO,UAAU,EAAS,MAAM,SAAS,CAAA;AAWrD,eAAO,MAAM,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"updateJobs.d.ts","sourceRoot":"","sources":["../src/updateJobs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAO,UAAU,EAAS,MAAM,SAAS,CAAA;AAWrD,eAAO,MAAM,UAAU,EAAE,UAiIxB,CAAA"}
|
package/dist/updateJobs.js
CHANGED
|
@@ -62,18 +62,21 @@ export const updateJobs = async function updateMany({ id, data, limit, req, retu
|
|
|
62
62
|
updateOps.$set = updateData;
|
|
63
63
|
updateData = updateOps;
|
|
64
64
|
}
|
|
65
|
-
const
|
|
66
|
-
lean: true,
|
|
67
|
-
new: true,
|
|
65
|
+
const baseOptions = {
|
|
68
66
|
session: await getSession(this, req),
|
|
69
67
|
// Timestamps are manually added by the write transform
|
|
70
68
|
timestamps: false
|
|
71
69
|
};
|
|
70
|
+
const findOptions = {
|
|
71
|
+
...baseOptions,
|
|
72
|
+
lean: true,
|
|
73
|
+
new: true
|
|
74
|
+
};
|
|
72
75
|
let result = [];
|
|
73
76
|
try {
|
|
74
77
|
if (id) {
|
|
75
78
|
if (returning === false) {
|
|
76
|
-
await Model.updateOne(query, updateData,
|
|
79
|
+
await Model.updateOne(query, updateData, baseOptions);
|
|
77
80
|
transform({
|
|
78
81
|
adapter: this,
|
|
79
82
|
data,
|
|
@@ -82,7 +85,7 @@ export const updateJobs = async function updateMany({ id, data, limit, req, retu
|
|
|
82
85
|
});
|
|
83
86
|
return null;
|
|
84
87
|
} else {
|
|
85
|
-
const doc = await Model.findOneAndUpdate(query, updateData,
|
|
88
|
+
const doc = await Model.findOneAndUpdate(query, updateData, findOptions);
|
|
86
89
|
result = doc ? [
|
|
87
90
|
doc
|
|
88
91
|
] : [];
|
|
@@ -90,7 +93,7 @@ export const updateJobs = async function updateMany({ id, data, limit, req, retu
|
|
|
90
93
|
} else {
|
|
91
94
|
if (typeof limit === 'number' && limit > 0) {
|
|
92
95
|
const documentsToUpdate = await Model.find(query, {}, {
|
|
93
|
-
...
|
|
96
|
+
...findOptions,
|
|
94
97
|
limit,
|
|
95
98
|
projection: {
|
|
96
99
|
_id: 1
|
|
@@ -106,12 +109,12 @@ export const updateJobs = async function updateMany({ id, data, limit, req, retu
|
|
|
106
109
|
}
|
|
107
110
|
};
|
|
108
111
|
}
|
|
109
|
-
await Model.updateMany(query, updateData,
|
|
112
|
+
await Model.updateMany(query, updateData, baseOptions);
|
|
110
113
|
if (returning === false) {
|
|
111
114
|
return null;
|
|
112
115
|
}
|
|
113
116
|
result = await Model.find(query, {}, {
|
|
114
|
-
...
|
|
117
|
+
...findOptions,
|
|
115
118
|
sort
|
|
116
119
|
});
|
|
117
120
|
}
|
package/dist/updateJobs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/updateJobs.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../src/updateJobs.ts"],"sourcesContent":["import type { QueryOptions, UpdateQuery } from 'mongoose'\nimport type { Job, UpdateJobs, Where } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { buildSortParam } from './queries/buildSortParam.js'\nimport { getCollection } from './utilities/getEntity.js'\nimport { getSession } from './utilities/getSession.js'\nimport { handleError } from './utilities/handleError.js'\nimport { transform } from './utilities/transform.js'\n\nexport const updateJobs: UpdateJobs = async function updateMany(\n this: MongooseAdapter,\n { id, data, limit, req, returning, sort: sortArg, where: whereArg },\n) {\n if (\n !(data?.log as object[])?.length &&\n !(data.log && typeof data.log === 'object' && '$push' in data.log)\n ) {\n delete data.log\n }\n\n const where = id ? { id: { equals: id } } : (whereArg as Where)\n\n const { collectionConfig, Model } = getCollection({\n adapter: this,\n collectionSlug: 'payload-jobs',\n })\n\n const sort: Record<string, unknown> | undefined = buildSortParam({\n adapter: this,\n config: this.payload.config,\n fields: collectionConfig.flattenedFields,\n sort: sortArg || collectionConfig.defaultSort,\n timestamps: true,\n })\n\n let query = await buildQuery({\n adapter: this,\n collectionSlug: collectionConfig.slug,\n fields: collectionConfig.flattenedFields,\n where,\n })\n\n let updateData: UpdateQuery<any> = data\n\n const $inc: Record<string, number> = {}\n const $push: Record<string, { $each: any[] } | any> = {}\n const $addToSet: Record<string, { $each: any[] } | any> = {}\n const $pull: Record<string, { $in: any[] } | any> = {}\n\n transform({\n $addToSet,\n $inc,\n $pull,\n $push,\n adapter: this,\n data,\n fields: collectionConfig.fields,\n operation: 'write',\n })\n\n const updateOps: UpdateQuery<any> = {}\n\n if (Object.keys($inc).length) {\n updateOps.$inc = $inc\n }\n if (Object.keys($push).length) {\n updateOps.$push = $push\n }\n if (Object.keys($addToSet).length) {\n updateOps.$addToSet = $addToSet\n }\n if (Object.keys($pull).length) {\n updateOps.$pull = $pull\n }\n if (Object.keys(updateOps).length) {\n updateOps.$set = updateData\n updateData = updateOps\n }\n\n const baseOptions = {\n session: await getSession(this, req),\n // Timestamps are manually added by the write transform\n timestamps: false,\n } satisfies QueryOptions\n\n const findOptions: QueryOptions = {\n ...baseOptions,\n lean: true,\n new: true,\n }\n\n let result: Job[] = []\n\n try {\n if (id) {\n if (returning === false) {\n await Model.updateOne(query, updateData, baseOptions)\n transform({ adapter: this, data, fields: collectionConfig.fields, operation: 'read' })\n\n return null\n } else {\n const doc = await Model.findOneAndUpdate(query, updateData, findOptions)\n result = doc ? [doc] : []\n }\n } else {\n if (typeof limit === 'number' && limit > 0) {\n const documentsToUpdate = await Model.find(\n query,\n {},\n { ...findOptions, limit, projection: { _id: 1 }, sort },\n )\n if (documentsToUpdate.length === 0) {\n return null\n }\n\n query = { _id: { $in: documentsToUpdate.map((doc) => doc._id) } }\n }\n\n await Model.updateMany(query, updateData, baseOptions)\n\n if (returning === false) {\n return null\n }\n\n result = await Model.find(query, {}, { ...findOptions, sort })\n }\n } catch (error) {\n handleError({ collection: collectionConfig.slug, error, req })\n }\n\n transform({\n adapter: this,\n data: result,\n fields: collectionConfig.fields,\n operation: 'read',\n })\n\n return result\n}\n"],"names":["buildQuery","buildSortParam","getCollection","getSession","handleError","transform","updateJobs","updateMany","id","data","limit","req","returning","sort","sortArg","where","whereArg","log","length","equals","collectionConfig","Model","adapter","collectionSlug","config","payload","fields","flattenedFields","defaultSort","timestamps","query","slug","updateData","$inc","$push","$addToSet","$pull","operation","updateOps","Object","keys","$set","baseOptions","session","findOptions","lean","new","result","updateOne","doc","findOneAndUpdate","documentsToUpdate","find","projection","_id","$in","map","error","collection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oBAAO2C,YAAY;wBAAEC,KAAK;oBAAE;oBAAGzC;gBAAK;gBAExD,IAAIsC,kBAAkBjC,MAAM,KAAK,GAAG;oBAClC,OAAO;gBACT;gBAEAY,QAAQ;oBAAEwB,KAAK;wBAAEC,KAAKJ,kBAAkBK,GAAG,CAAC,CAACP,MAAQA,IAAIK,GAAG;oBAAE;gBAAE;YAClE;YAEA,MAAMjC,MAAMd,UAAU,CAACuB,OAAOE,YAAYU;YAE1C,IAAI9B,cAAc,OAAO;gBACvB,OAAO;YACT;YAEAmC,SAAS,MAAM1B,MAAM+B,IAAI,CAACtB,OAAO,CAAC,GAAG;gBAAE,GAAGc,WAAW;gBAAE/B;YAAK;QAC9D;IACF,EAAE,OAAO4C,OAAO;QACdrD,YAAY;YAAEsD,YAAYtC,iBAAiBW,IAAI;YAAE0B;YAAO9C;QAAI;IAC9D;IAEAN,UAAU;QACRiB,SAAS,IAAI;QACbb,MAAMsC;QACNrB,QAAQN,iBAAiBM,MAAM;QAC/BW,WAAW;IACb;IAEA,OAAOU;AACT,EAAC"}
|
package/dist/updateMany.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateMany.d.ts","sourceRoot":"","sources":["../src/updateMany.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,UAAU,EAAE,MAAM,SAAS,CAAA;AAYlE,eAAO,MAAM,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"updateMany.d.ts","sourceRoot":"","sources":["../src/updateMany.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,UAAU,EAAE,MAAM,SAAS,CAAA;AAYlE,eAAO,MAAM,UAAU,EAAE,UAyIxB,CAAA"}
|
package/dist/updateMany.js
CHANGED
|
@@ -65,23 +65,26 @@ export const updateMany = async function updateMany({ collection: collectionSlug
|
|
|
65
65
|
updateOps.$set = data;
|
|
66
66
|
data = updateOps;
|
|
67
67
|
}
|
|
68
|
-
const
|
|
68
|
+
const baseOptions = {
|
|
69
69
|
...optionsArgs,
|
|
70
|
+
session: await getSession(this, req),
|
|
71
|
+
// Timestamps are manually added by the write transform
|
|
72
|
+
timestamps: false
|
|
73
|
+
};
|
|
74
|
+
const findOptions = {
|
|
75
|
+
...baseOptions,
|
|
70
76
|
lean: true,
|
|
71
77
|
new: true,
|
|
72
78
|
projection: buildProjectionFromSelect({
|
|
73
79
|
adapter: this,
|
|
74
80
|
fields: collectionConfig.flattenedFields,
|
|
75
81
|
select
|
|
76
|
-
})
|
|
77
|
-
session: await getSession(this, req),
|
|
78
|
-
// Timestamps are manually added by the write transform
|
|
79
|
-
timestamps: false
|
|
82
|
+
})
|
|
80
83
|
};
|
|
81
84
|
try {
|
|
82
85
|
if (typeof limit === 'number' && limit > 0) {
|
|
83
86
|
const documentsToUpdate = await Model.find(query, {}, {
|
|
84
|
-
...
|
|
87
|
+
...findOptions,
|
|
85
88
|
limit,
|
|
86
89
|
projection: {
|
|
87
90
|
_id: 1
|
|
@@ -97,7 +100,7 @@ export const updateMany = async function updateMany({ collection: collectionSlug
|
|
|
97
100
|
}
|
|
98
101
|
};
|
|
99
102
|
}
|
|
100
|
-
await Model.updateMany(query, data,
|
|
103
|
+
await Model.updateMany(query, data, baseOptions);
|
|
101
104
|
} catch (error) {
|
|
102
105
|
handleError({
|
|
103
106
|
collection: collectionSlug,
|
|
@@ -109,7 +112,7 @@ export const updateMany = async function updateMany({ collection: collectionSlug
|
|
|
109
112
|
return null;
|
|
110
113
|
}
|
|
111
114
|
const result = await Model.find(query, {}, {
|
|
112
|
-
...
|
|
115
|
+
...findOptions,
|
|
113
116
|
sort
|
|
114
117
|
});
|
|
115
118
|
transform({
|
package/dist/updateMany.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/updateMany.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../src/updateMany.ts"],"sourcesContent":["import type { QueryOptions, UpdateQuery } from 'mongoose'\n\nimport { flattenWhereToOperators, type UpdateMany } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { buildSortParam } from './queries/buildSortParam.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getCollection } from './utilities/getEntity.js'\nimport { getSession } from './utilities/getSession.js'\nimport { handleError } from './utilities/handleError.js'\nimport { transform } from './utilities/transform.js'\n\nexport const updateMany: UpdateMany = async function updateMany(\n this: MongooseAdapter,\n {\n collection: collectionSlug,\n data,\n limit,\n locale,\n options: optionsArgs = {},\n req,\n returning,\n select,\n sort: sortArg,\n where,\n },\n) {\n let hasNearConstraint = false\n\n if (where) {\n const constraints = flattenWhereToOperators(where)\n hasNearConstraint = constraints.some((prop) => Object.keys(prop).some((key) => key === 'near'))\n }\n\n const { collectionConfig, Model } = getCollection({ adapter: this, collectionSlug })\n\n let sort: Record<string, unknown> | undefined\n if (!hasNearConstraint) {\n sort = buildSortParam({\n adapter: this,\n config: this.payload.config,\n fields: collectionConfig.flattenedFields,\n locale,\n sort: sortArg || collectionConfig.defaultSort,\n timestamps: true,\n })\n }\n\n let query = await buildQuery({\n adapter: this,\n collectionSlug,\n fields: collectionConfig.flattenedFields,\n locale,\n where,\n })\n\n const $inc: Record<string, number> = {}\n const $push: Record<string, { $each: any[] } | any> = {}\n const $addToSet: Record<string, { $each: any[] } | any> = {}\n const $pull: Record<string, { $in: any[] } | any> = {}\n\n transform({\n $addToSet,\n $inc,\n $pull,\n $push,\n adapter: this,\n data,\n fields: collectionConfig.fields,\n operation: 'write',\n })\n\n const updateOps: UpdateQuery<any> = {}\n\n if (Object.keys($inc).length) {\n updateOps.$inc = $inc\n }\n if (Object.keys($push).length) {\n updateOps.$push = $push\n }\n if (Object.keys($addToSet).length) {\n updateOps.$addToSet = $addToSet\n }\n if (Object.keys($pull).length) {\n updateOps.$pull = $pull\n }\n if (Object.keys(updateOps).length) {\n updateOps.$set = data\n data = updateOps\n }\n\n const baseOptions = {\n ...optionsArgs,\n session: await getSession(this, req),\n // Timestamps are manually added by the write transform\n timestamps: false,\n } satisfies QueryOptions\n\n const findOptions: QueryOptions = {\n ...baseOptions,\n lean: true,\n new: true,\n projection: buildProjectionFromSelect({\n adapter: this,\n fields: collectionConfig.flattenedFields,\n select,\n }),\n }\n\n try {\n if (typeof limit === 'number' && limit > 0) {\n const documentsToUpdate = await Model.find(\n query,\n {},\n { ...findOptions, limit, projection: { _id: 1 }, sort },\n )\n if (documentsToUpdate.length === 0) {\n return null\n }\n\n query = { _id: { $in: documentsToUpdate.map((doc) => doc._id) } }\n }\n\n await Model.updateMany(query, data, baseOptions)\n } catch (error) {\n handleError({ collection: collectionSlug, error, req })\n }\n\n if (returning === false) {\n return null\n }\n\n const result = await Model.find(\n query,\n {},\n {\n ...findOptions,\n sort,\n },\n )\n\n transform({\n adapter: this,\n data: result,\n fields: collectionConfig.fields,\n operation: 'read',\n })\n\n return result\n}\n"],"names":["flattenWhereToOperators","buildQuery","buildSortParam","buildProjectionFromSelect","getCollection","getSession","handleError","transform","updateMany","collection","collectionSlug","data","limit","locale","options","optionsArgs","req","returning","select","sort","sortArg","where","hasNearConstraint","constraints","some","prop","Object","keys","key","collectionConfig","Model","adapter","config","payload","fields","flattenedFields","defaultSort","timestamps","query","$inc","$push","$addToSet","$pull","operation","updateOps","length","$set","baseOptions","session","findOptions","lean","new","projection","documentsToUpdate","find","_id","$in","map","doc","error","result"],"mappings":"AAEA,SAASA,uBAAuB,QAAyB,UAAS;AAIlE,SAASC,UAAU,QAAQ,0BAAyB;AACpD,SAASC,cAAc,QAAQ,8BAA6B;AAC5D,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,aAAa,QAAQ,2BAA0B;AACxD,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,WAAW,QAAQ,6BAA4B;AACxD,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,aAAyB,eAAeA,WAEnD,EACEC,YAAYC,cAA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C/BS,WAAW;IACb;IAEA,OAAOiB;AACT,EAAC"}
|
package/dist/updateOne.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateOne.d.ts","sourceRoot":"","sources":["../src/updateOne.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAWxC,eAAO,MAAM,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"updateOne.d.ts","sourceRoot":"","sources":["../src/updateOne.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAWxC,eAAO,MAAM,SAAS,EAAE,SAsGvB,CAAA"}
|
package/dist/updateOne.js
CHANGED
|
@@ -55,22 +55,25 @@ export const updateOne = async function updateOne({ id, collection: collectionSl
|
|
|
55
55
|
updateOps.$set = updateData;
|
|
56
56
|
updateData = updateOps;
|
|
57
57
|
}
|
|
58
|
-
const
|
|
58
|
+
const baseOptions = {
|
|
59
59
|
...optionsArgs,
|
|
60
|
+
session: await getSession(this, req),
|
|
61
|
+
// Timestamps are manually added by the write transform
|
|
62
|
+
timestamps: false
|
|
63
|
+
};
|
|
64
|
+
const findOptions = {
|
|
65
|
+
...baseOptions,
|
|
60
66
|
lean: true,
|
|
61
67
|
new: true,
|
|
62
68
|
projection: buildProjectionFromSelect({
|
|
63
69
|
adapter: this,
|
|
64
70
|
fields: collectionConfig.flattenedFields,
|
|
65
71
|
select
|
|
66
|
-
})
|
|
67
|
-
session: await getSession(this, req),
|
|
68
|
-
// Timestamps are manually added by the write transform
|
|
69
|
-
timestamps: false
|
|
72
|
+
})
|
|
70
73
|
};
|
|
71
74
|
try {
|
|
72
75
|
if (returning === false) {
|
|
73
|
-
await Model.updateOne(query, updateData,
|
|
76
|
+
await Model.updateOne(query, updateData, baseOptions);
|
|
74
77
|
transform({
|
|
75
78
|
adapter: this,
|
|
76
79
|
data,
|
|
@@ -79,7 +82,7 @@ export const updateOne = async function updateOne({ id, collection: collectionSl
|
|
|
79
82
|
});
|
|
80
83
|
return null;
|
|
81
84
|
} else {
|
|
82
|
-
result = await Model.findOneAndUpdate(query, updateData,
|
|
85
|
+
result = await Model.findOneAndUpdate(query, updateData, findOptions);
|
|
83
86
|
}
|
|
84
87
|
} catch (error) {
|
|
85
88
|
handleError({
|
package/dist/updateOne.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/updateOne.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../src/updateOne.ts"],"sourcesContent":["import type { QueryOptions, UpdateQuery } from 'mongoose'\nimport type { UpdateOne } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getCollection } from './utilities/getEntity.js'\nimport { getSession } from './utilities/getSession.js'\nimport { handleError } from './utilities/handleError.js'\nimport { transform } from './utilities/transform.js'\n\nexport const updateOne: UpdateOne = async function updateOne(\n this: MongooseAdapter,\n {\n id,\n collection: collectionSlug,\n data,\n locale,\n options: optionsArgs = {},\n req,\n returning,\n select,\n where: whereArg = {},\n },\n) {\n const { collectionConfig, Model } = getCollection({ adapter: this, collectionSlug })\n const where = id ? { id: { equals: id } } : whereArg\n const fields = collectionConfig.fields\n\n const query = await buildQuery({\n adapter: this,\n collectionSlug,\n fields: collectionConfig.flattenedFields,\n locale,\n where,\n })\n\n let result\n\n let updateData: UpdateQuery<any> = data\n\n const $inc: Record<string, number> = {}\n const $push: Record<string, { $each: any[] } | any> = {}\n const $addToSet: Record<string, { $each: any[] } | any> = {}\n const $pull: Record<string, { $in: any[] } | any> = {}\n\n transform({\n $addToSet,\n $inc,\n $pull,\n $push,\n adapter: this,\n data,\n fields,\n operation: 'write',\n })\n\n const updateOps: UpdateQuery<any> = {}\n\n if (Object.keys($inc).length) {\n updateOps.$inc = $inc\n }\n if (Object.keys($push).length) {\n updateOps.$push = $push\n }\n if (Object.keys($addToSet).length) {\n updateOps.$addToSet = $addToSet\n }\n if (Object.keys($pull).length) {\n updateOps.$pull = $pull\n }\n if (Object.keys(updateOps).length) {\n updateOps.$set = updateData\n updateData = updateOps\n }\n\n const baseOptions = {\n ...optionsArgs,\n session: await getSession(this, req),\n // Timestamps are manually added by the write transform\n timestamps: false,\n } satisfies QueryOptions\n\n const findOptions: QueryOptions = {\n ...baseOptions,\n lean: true,\n new: true,\n projection: buildProjectionFromSelect({\n adapter: this,\n fields: collectionConfig.flattenedFields,\n select,\n }),\n }\n\n try {\n if (returning === false) {\n await Model.updateOne(query, updateData, baseOptions)\n transform({ adapter: this, data, fields, operation: 'read' })\n return null\n } else {\n result = await Model.findOneAndUpdate(query, updateData, findOptions)\n }\n } catch (error) {\n handleError({ collection: collectionSlug, error, req })\n }\n\n if (!result) {\n return null\n }\n\n transform({ adapter: this, data: result, fields, operation: 'read' })\n\n return result\n}\n"],"names":["buildQuery","buildProjectionFromSelect","getCollection","getSession","handleError","transform","updateOne","id","collection","collectionSlug","data","locale","options","optionsArgs","req","returning","select","where","whereArg","collectionConfig","Model","adapter","equals","fields","query","flattenedFields","result","updateData","$inc","$push","$addToSet","$pull","operation","updateOps","Object","keys","length","$set","baseOptions","session","timestamps","findOptions","lean","new","projection","findOneAndUpdate","error"],"mappings":"AAKA,SAASA,UAAU,QAAQ,0BAAyB;AACpD,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,aAAa,QAAQ,2BAA0B;AACxD,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,WAAW,QAAQ,6BAA4B;AACxD,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,YAAuB,eAAeA,UAEjD,EACEC,EAAE,EACFC,YAAYC,cAAc,EAC1BC,IAAI,EACJC,MAAM,EACNC,SAASC,cAAc,CAAC,CAAC,EACzBC,GAAG,EACHC,SAAS,EACTC,MAAM,EACNC,OAAOC,WAAW,CA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AA0B;YACpCoB,SAAS,IAAI;YACbE,QAAQJ,iBAAiBM,eAAe;YACxCT;QACF;IACF;IAEA,IAAI;QACF,IAAID,cAAc,OAAO;YACvB,MAAMK,MAAMd,SAAS,CAACkB,OAAOG,YAAYW;YACzCjC,UAAU;gBAAEgB,SAAS,IAAI;gBAAEX;gBAAMa;gBAAQS,WAAW;YAAO;YAC3D,OAAO;QACT,OAAO;YACLN,SAAS,MAAMN,MAAMyB,gBAAgB,CAACrB,OAAOG,YAAYc;QAC3D;IACF,EAAE,OAAOK,OAAO;QACd1C,YAAY;YAAEI,YAAYC;YAAgBqC;YAAOhC;QAAI;IACvD;IAEA,IAAI,CAACY,QAAQ;QACX,OAAO;IACT;IAEArB,UAAU;QAAEgB,SAAS,IAAI;QAAEX,MAAMgB;QAAQH;QAAQS,WAAW;IAAO;IAEnE,OAAON;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateVersion.d.ts","sourceRoot":"","sources":["../src/updateVersion.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgC,KAAK,aAAa,EAAE,MAAM,SAAS,CAAA;AAU1E,eAAO,MAAM,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"updateVersion.d.ts","sourceRoot":"","sources":["../src/updateVersion.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgC,KAAK,aAAa,EAAE,MAAM,SAAS,CAAA;AAU1E,eAAO,MAAM,aAAa,EAAE,aAkE3B,CAAA"}
|
package/dist/updateVersion.js
CHANGED
|
@@ -29,24 +29,27 @@ export const updateVersion = async function updateVersion({ id, collection: coll
|
|
|
29
29
|
fields,
|
|
30
30
|
operation: 'write'
|
|
31
31
|
});
|
|
32
|
-
const
|
|
32
|
+
const baseOptions = {
|
|
33
33
|
...optionsArgs,
|
|
34
|
+
session: await getSession(this, req),
|
|
35
|
+
// Timestamps are manually added by the write transform
|
|
36
|
+
timestamps: false
|
|
37
|
+
};
|
|
38
|
+
const findOptions = {
|
|
39
|
+
...baseOptions,
|
|
34
40
|
lean: true,
|
|
35
41
|
new: true,
|
|
36
42
|
projection: buildProjectionFromSelect({
|
|
37
43
|
adapter: this,
|
|
38
44
|
fields: flattenedFields,
|
|
39
45
|
select
|
|
40
|
-
})
|
|
41
|
-
session: await getSession(this, req),
|
|
42
|
-
// Timestamps are manually added by the write transform
|
|
43
|
-
timestamps: false
|
|
46
|
+
})
|
|
44
47
|
};
|
|
45
48
|
if (returning === false) {
|
|
46
|
-
await Model.updateOne(query, versionData,
|
|
49
|
+
await Model.updateOne(query, versionData, baseOptions);
|
|
47
50
|
return null;
|
|
48
51
|
}
|
|
49
|
-
const doc = await Model.findOneAndUpdate(query, versionData,
|
|
52
|
+
const doc = await Model.findOneAndUpdate(query, versionData, findOptions);
|
|
50
53
|
if (!doc) {
|
|
51
54
|
return null;
|
|
52
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/updateVersion.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../src/updateVersion.ts"],"sourcesContent":["import type { QueryOptions } from 'mongoose'\n\nimport { buildVersionCollectionFields, type UpdateVersion } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { buildQuery } from './queries/buildQuery.js'\nimport { buildProjectionFromSelect } from './utilities/buildProjectionFromSelect.js'\nimport { getCollection } from './utilities/getEntity.js'\nimport { getSession } from './utilities/getSession.js'\nimport { transform } from './utilities/transform.js'\n\nexport const updateVersion: UpdateVersion = async function updateVersion(\n this: MongooseAdapter,\n {\n id,\n collection: collectionSlug,\n locale,\n options: optionsArgs = {},\n req,\n returning,\n select,\n versionData,\n where,\n },\n) {\n const { collectionConfig, Model } = getCollection({\n adapter: this,\n collectionSlug,\n versions: true,\n })\n\n const whereToUse = where || { id: { equals: id } }\n const fields = buildVersionCollectionFields(this.payload.config, collectionConfig)\n\n const flattenedFields = buildVersionCollectionFields(this.payload.config, collectionConfig, true)\n\n const query = await buildQuery({\n adapter: this,\n fields: flattenedFields,\n locale,\n where: whereToUse,\n })\n\n transform({ adapter: this, data: versionData, fields, operation: 'write' })\n\n const baseOptions = {\n ...optionsArgs,\n session: await getSession(this, req),\n // Timestamps are manually added by the write transform\n timestamps: false,\n } satisfies QueryOptions\n\n const findOptions: QueryOptions = {\n ...baseOptions,\n lean: true,\n new: true,\n projection: buildProjectionFromSelect({\n adapter: this,\n fields: flattenedFields,\n select,\n }),\n }\n\n if (returning === false) {\n await Model.updateOne(query, versionData, baseOptions)\n return null\n }\n\n const doc = await Model.findOneAndUpdate(query, versionData, findOptions)\n\n if (!doc) {\n return null\n }\n\n transform({ adapter: this, data: doc, fields, operation: 'read' })\n\n return doc\n}\n"],"names":["buildVersionCollectionFields","buildQuery","buildProjectionFromSelect","getCollection","getSession","transform","updateVersion","id","collection","collectionSlug","locale","options","optionsArgs","req","returning","select","versionData","where","collectionConfig","Model","adapter","versions","whereToUse","equals","fields","payload","config","flattenedFields","query","data","operation","baseOptions","session","timestamps","findOptions","lean","new","projection","updateOne","doc","findOneAndUpdate"],"mappings":"AAEA,SAASA,4BAA4B,QAA4B,UAAS;AAI1E,SAASC,UAAU,QAAQ,0BAAyB;AACpD,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,aAAa,QAAQ,2BAA0B;AACxD,SAASC,UAAU,QAAQ,4BAA2B;AACtD,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,gBAA+B,eAAeA,cAEzD,EACEC,EAAE,EACFC,YAAYC,cAAc,EAC1BC,MAAM,EACNC,SAASC,cAAc,CAAC,CAAC,EACzBC,GAAG,EACHC,SAAS,EACTC,MAAM,EACNC,WAAW,EACXC,KAAK,EACN;IAED,MAAM,EAAEC,gBAAgB,EAAEC,KAAK,EAAE,GAAGhB,cAAc;QAChDiB,SAAS,IAAI;QACbX;QACAY,UAAU;IACZ;IAEA,MAAMC,aAAaL,SAAS;QAAEV,IAAI;YAAEgB,QAAQhB;QAAG;IAAE;IACjD,MAAMiB,SAASxB,6BAA6B,IAAI,CAACyB,OAAO,CAACC,MAAM,EAAER;IAEjE,MAAMS,kBAAkB3B,6BAA6B,IAAI,CAACyB,OAAO,CAACC,MAAM,EAAER,kBAAkB;IAE5F,MAAMU,QAAQ,MAAM3B,WAAW;QAC7BmB,SAAS,IAAI;QACbI,QAAQG;QACRjB;QACAO,OAAOK;IACT;IAEAjB,UAAU;QAAEe,SAAS,IAAI;QAAES,MAAMb;QAAaQ;QAAQM,WAAW;IAAQ;IAEzE,MAAMC,cAAc;QAClB,GAAGnB,WAAW;QACdoB,SAAS,MAAM5B,WAAW,IAAI,EAAES;QAChC,uDAAuD;QACvDoB,YAAY;IACd;IAEA,MAAMC,cAA4B;QAChC,GAAGH,WAAW;QACdI,MAAM;QACNC,KAAK;QACLC,YAAYnC,0BAA0B;YACpCkB,SAAS,IAAI;YACbI,QAAQG;YACRZ;QACF;IACF;IAEA,IAAID,cAAc,OAAO;QACvB,MAAMK,MAAMmB,SAAS,CAACV,OAAOZ,aAAae;QAC1C,OAAO;IACT;IAEA,MAAMQ,MAAM,MAAMpB,MAAMqB,gBAAgB,CAACZ,OAAOZ,aAAakB;IAE7D,IAAI,CAACK,KAAK;QACR,OAAO;IACT;IAEAlC,UAAU;QAAEe,SAAS,IAAI;QAAES,MAAMU;QAAKf;QAAQM,WAAW;IAAO;IAEhE,OAAOS;AACT,EAAC"}
|
|
@@ -77,7 +77,7 @@ const traverseFields = ({ adapter, databaseSchemaPath = '', fields, parentIsLoca
|
|
|
77
77
|
case 'blocks':
|
|
78
78
|
{
|
|
79
79
|
const blocksSelect = select[field.name];
|
|
80
|
-
for (const _block of field.
|
|
80
|
+
for (const _block of field.blocks){
|
|
81
81
|
const block = typeof _block === 'string' ? adapter.payload.blocks[_block] : _block;
|
|
82
82
|
if (!block) {
|
|
83
83
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/buildProjectionFromSelect.ts"],"sourcesContent":["import type {\n FieldAffectingData,\n FlattenedField,\n SelectIncludeType,\n SelectMode,\n SelectType,\n} from 'payload'\n\nimport {\n deepCopyObjectSimple,\n fieldAffectsData,\n fieldShouldBeLocalized,\n getSelectMode,\n} from 'payload/shared'\n\nimport type { MongooseAdapter } from '../index.js'\n\nconst addFieldToProjection = ({\n adapter,\n databaseSchemaPath,\n field,\n parentIsLocalized,\n projection,\n}: {\n adapter: MongooseAdapter\n databaseSchemaPath: string\n field: FieldAffectingData\n parentIsLocalized: boolean\n projection: Record<string, true>\n}) => {\n const { config } = adapter.payload\n\n if (parentIsLocalized && config.localization) {\n for (const locale of config.localization.localeCodes) {\n const localeDatabaseSchemaPath = databaseSchemaPath.replace('<locale>', locale)\n projection[`${localeDatabaseSchemaPath}${field.name}`] = true\n }\n } else {\n projection[`${databaseSchemaPath}${field.name}`] = true\n }\n}\n\nconst traverseFields = ({\n adapter,\n databaseSchemaPath = '',\n fields,\n parentIsLocalized = false,\n projection,\n select,\n selectAllOnCurrentLevel = false,\n selectMode,\n}: {\n adapter: MongooseAdapter\n databaseSchemaPath?: string\n fields: FlattenedField[]\n parentIsLocalized?: boolean\n projection: Record<string, true>\n select: SelectType\n selectAllOnCurrentLevel?: boolean\n selectMode: SelectMode\n}) => {\n for (const field of fields) {\n if (fieldAffectsData(field)) {\n if (selectMode === 'include') {\n if (select[field.name] === true || selectAllOnCurrentLevel) {\n addFieldToProjection({\n adapter,\n databaseSchemaPath,\n field,\n parentIsLocalized,\n projection,\n })\n continue\n }\n\n if (!select[field.name]) {\n continue\n }\n }\n\n if (selectMode === 'exclude') {\n if (typeof select[field.name] === 'undefined') {\n addFieldToProjection({\n adapter,\n databaseSchemaPath,\n field,\n parentIsLocalized,\n projection,\n })\n continue\n }\n\n if (select[field.name] === false) {\n continue\n }\n }\n }\n\n let fieldDatabaseSchemaPath = databaseSchemaPath\n\n if (fieldAffectsData(field)) {\n fieldDatabaseSchemaPath = `${databaseSchemaPath}${field.name}.`\n\n if (fieldShouldBeLocalized({ field, parentIsLocalized })) {\n fieldDatabaseSchemaPath = `${fieldDatabaseSchemaPath}<locale>.`\n }\n }\n\n switch (field.type) {\n case 'array':\n case 'group':\n case 'tab': {\n const fieldSelect = select[field.name] as SelectType\n\n if (field.type === 'array' && selectMode === 'include') {\n fieldSelect.id = true\n }\n\n traverseFields({\n adapter,\n databaseSchemaPath: fieldDatabaseSchemaPath,\n fields: field.flattenedFields,\n parentIsLocalized: parentIsLocalized || field.localized,\n projection,\n select: fieldSelect,\n selectMode,\n })\n\n break\n }\n case 'blocks': {\n const blocksSelect = select[field.name] as SelectType\n\n for (const _block of field.blockReferences ?? field.blocks) {\n const block = typeof _block === 'string' ? adapter.payload.blocks[_block] : _block\n\n if (!block) {\n continue\n }\n\n if (\n (selectMode === 'include' && blocksSelect[block.slug] === true) ||\n (selectMode === 'exclude' && typeof blocksSelect[block.slug] === 'undefined')\n ) {\n traverseFields({\n adapter,\n databaseSchemaPath: fieldDatabaseSchemaPath,\n fields: block.flattenedFields,\n parentIsLocalized: parentIsLocalized || field.localized,\n projection,\n select: {},\n selectAllOnCurrentLevel: true,\n selectMode: 'include',\n })\n continue\n }\n\n let blockSelectMode = selectMode\n\n if (selectMode === 'exclude' && blocksSelect[block.slug] === false) {\n blockSelectMode = 'include'\n }\n\n if (typeof blocksSelect[block.slug] !== 'object') {\n blocksSelect[block.slug] = {}\n }\n\n if (blockSelectMode === 'include' && typeof blocksSelect[block.slug] === 'object') {\n const blockSelect = blocksSelect[block.slug] as SelectIncludeType\n blockSelect.id = true\n blockSelect.blockType = true\n }\n\n traverseFields({\n adapter,\n databaseSchemaPath: fieldDatabaseSchemaPath,\n fields: block.flattenedFields,\n parentIsLocalized: parentIsLocalized || field.localized,\n projection,\n select: blocksSelect[block.slug] as SelectType,\n selectMode: blockSelectMode,\n })\n }\n\n break\n }\n\n case 'relationship':\n case 'upload': {\n // When a relationship/upload field is selected with nested fields (for population), we still need to include the raw\n // field value in the projection so that population can work. The nested select is handled by the population logic.\n addFieldToProjection({\n adapter,\n databaseSchemaPath,\n field,\n parentIsLocalized,\n projection,\n })\n break\n }\n\n default:\n break\n }\n }\n}\n\nexport const buildProjectionFromSelect = ({\n adapter,\n fields,\n select,\n}: {\n adapter: MongooseAdapter\n fields: FlattenedField[]\n select?: SelectType\n}): Record<string, true> | undefined => {\n if (!select) {\n return\n }\n\n const projection: Record<string, true> = {\n _id: true,\n }\n\n traverseFields({\n adapter,\n fields,\n projection,\n // Clone to safely mutate it later\n select: deepCopyObjectSimple(select),\n selectMode: getSelectMode(select),\n })\n\n return projection\n}\n"],"names":["deepCopyObjectSimple","fieldAffectsData","fieldShouldBeLocalized","getSelectMode","addFieldToProjection","adapter","databaseSchemaPath","field","parentIsLocalized","projection","config","payload","localization","locale","localeCodes","localeDatabaseSchemaPath","replace","name","traverseFields","fields","select","selectAllOnCurrentLevel","selectMode","fieldDatabaseSchemaPath","type","fieldSelect","id","flattenedFields","localized","blocksSelect","_block","blockReferences","blocks","block","slug","blockSelectMode","blockSelect","blockType","buildProjectionFromSelect","_id"],"mappings":"AAQA,SACEA,oBAAoB,EACpBC,gBAAgB,EAChBC,sBAAsB,EACtBC,aAAa,QACR,iBAAgB;AAIvB,MAAMC,uBAAuB,CAAC,EAC5BC,OAAO,EACPC,kBAAkB,EAClBC,KAAK,EACLC,iBAAiB,EACjBC,UAAU,EAOX;IACC,MAAM,EAAEC,MAAM,EAAE,GAAGL,QAAQM,OAAO;IAElC,IAAIH,qBAAqBE,OAAOE,YAAY,EAAE;QAC5C,KAAK,MAAMC,UAAUH,OAAOE,YAAY,CAACE,WAAW,CAAE;YACpD,MAAMC,2BAA2BT,mBAAmBU,OAAO,CAAC,YAAYH;YACxEJ,UAAU,CAAC,GAAGM,2BAA2BR,MAAMU,IAAI,EAAE,CAAC,GAAG;QAC3D;IACF,OAAO;QACLR,UAAU,CAAC,GAAGH,qBAAqBC,MAAMU,IAAI,EAAE,CAAC,GAAG;IACrD;AACF;AAEA,MAAMC,i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AS;4BACvDnB;4BACAW,QAAQS,YAAY,CAACI,MAAMC,IAAI,CAAC;4BAChCZ,YAAYa;wBACd;oBACF;oBAEA;gBACF;YAEA,KAAK;YACL,KAAK;gBAAU;oBACb,qHAAqH;oBACrH,mHAAmH;oBACnH/B,qBAAqB;wBACnBC;wBACAC;wBACAC;wBACAC;wBACAC;oBACF;oBACA;gBACF;YAEA;gBACE;QACJ;IACF;AACF;AAEA,OAAO,MAAM6B,4BAA4B,CAAC,EACxCjC,OAAO,EACPc,MAAM,EACNC,MAAM,EAKP;IACC,IAAI,CAACA,QAAQ;QACX;IACF;IAEA,MAAMX,aAAmC;QACvC8B,KAAK;IACP;IAEArB,eAAe;QACbb;QACAc;QACAV;QACA,kCAAkC;QAClCW,QAAQpB,qBAAqBoB;QAC7BE,YAAYnB,cAAciB;IAC5B;IAEA,OAAOX;AACT,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/buildProjectionFromSelect.ts"],"sourcesContent":["import type {\n FieldAffectingData,\n FlattenedField,\n SelectIncludeType,\n SelectMode,\n SelectType,\n} from 'payload'\n\nimport {\n deepCopyObjectSimple,\n fieldAffectsData,\n fieldShouldBeLocalized,\n getSelectMode,\n} from 'payload/shared'\n\nimport type { MongooseAdapter } from '../index.js'\n\nconst addFieldToProjection = ({\n adapter,\n databaseSchemaPath,\n field,\n parentIsLocalized,\n projection,\n}: {\n adapter: MongooseAdapter\n databaseSchemaPath: string\n field: FieldAffectingData\n parentIsLocalized: boolean\n projection: Record<string, true>\n}) => {\n const { config } = adapter.payload\n\n if (parentIsLocalized && config.localization) {\n for (const locale of config.localization.localeCodes) {\n const localeDatabaseSchemaPath = databaseSchemaPath.replace('<locale>', locale)\n projection[`${localeDatabaseSchemaPath}${field.name}`] = true\n }\n } else {\n projection[`${databaseSchemaPath}${field.name}`] = true\n }\n}\n\nconst traverseFields = ({\n adapter,\n databaseSchemaPath = '',\n fields,\n parentIsLocalized = false,\n projection,\n select,\n selectAllOnCurrentLevel = false,\n selectMode,\n}: {\n adapter: MongooseAdapter\n databaseSchemaPath?: string\n fields: FlattenedField[]\n parentIsLocalized?: boolean\n projection: Record<string, true>\n select: SelectType\n selectAllOnCurrentLevel?: boolean\n selectMode: SelectMode\n}) => {\n for (const field of fields) {\n if (fieldAffectsData(field)) {\n if (selectMode === 'include') {\n if (select[field.name] === true || selectAllOnCurrentLevel) {\n addFieldToProjection({\n adapter,\n databaseSchemaPath,\n field,\n parentIsLocalized,\n projection,\n })\n continue\n }\n\n if (!select[field.name]) {\n continue\n }\n }\n\n if (selectMode === 'exclude') {\n if (typeof select[field.name] === 'undefined') {\n addFieldToProjection({\n adapter,\n databaseSchemaPath,\n field,\n parentIsLocalized,\n projection,\n })\n continue\n }\n\n if (select[field.name] === false) {\n continue\n }\n }\n }\n\n let fieldDatabaseSchemaPath = databaseSchemaPath\n\n if (fieldAffectsData(field)) {\n fieldDatabaseSchemaPath = `${databaseSchemaPath}${field.name}.`\n\n if (fieldShouldBeLocalized({ field, parentIsLocalized })) {\n fieldDatabaseSchemaPath = `${fieldDatabaseSchemaPath}<locale>.`\n }\n }\n\n switch (field.type) {\n case 'array':\n case 'group':\n case 'tab': {\n const fieldSelect = select[field.name] as SelectType\n\n if (field.type === 'array' && selectMode === 'include') {\n fieldSelect.id = true\n }\n\n traverseFields({\n adapter,\n databaseSchemaPath: fieldDatabaseSchemaPath,\n fields: field.flattenedFields,\n parentIsLocalized: parentIsLocalized || field.localized,\n projection,\n select: fieldSelect,\n selectMode,\n })\n\n break\n }\n case 'blocks': {\n const blocksSelect = select[field.name] as SelectType\n\n for (const _block of field.blocks) {\n const block = typeof _block === 'string' ? adapter.payload.blocks[_block] : _block\n\n if (!block) {\n continue\n }\n\n if (\n (selectMode === 'include' && blocksSelect[block.slug] === true) ||\n (selectMode === 'exclude' && typeof blocksSelect[block.slug] === 'undefined')\n ) {\n traverseFields({\n adapter,\n databaseSchemaPath: fieldDatabaseSchemaPath,\n fields: block.flattenedFields,\n parentIsLocalized: parentIsLocalized || field.localized,\n projection,\n select: {},\n selectAllOnCurrentLevel: true,\n selectMode: 'include',\n })\n continue\n }\n\n let blockSelectMode = selectMode\n\n if (selectMode === 'exclude' && blocksSelect[block.slug] === false) {\n blockSelectMode = 'include'\n }\n\n if (typeof blocksSelect[block.slug] !== 'object') {\n blocksSelect[block.slug] = {}\n }\n\n if (blockSelectMode === 'include' && typeof blocksSelect[block.slug] === 'object') {\n const blockSelect = blocksSelect[block.slug] as SelectIncludeType\n blockSelect.id = true\n blockSelect.blockType = true\n }\n\n traverseFields({\n adapter,\n databaseSchemaPath: fieldDatabaseSchemaPath,\n fields: block.flattenedFields,\n parentIsLocalized: parentIsLocalized || field.localized,\n projection,\n select: blocksSelect[block.slug] as SelectType,\n selectMode: blockSelectMode,\n })\n }\n\n break\n }\n\n case 'relationship':\n case 'upload': {\n // When a relationship/upload field is selected with nested fields (for population), we still need to include the raw\n // field value in the projection so that population can work. The nested select is handled by the population logic.\n addFieldToProjection({\n adapter,\n databaseSchemaPath,\n field,\n parentIsLocalized,\n projection,\n })\n break\n }\n\n default:\n break\n }\n }\n}\n\nexport const buildProjectionFromSelect = ({\n adapter,\n fields,\n select,\n}: {\n adapter: MongooseAdapter\n fields: FlattenedField[]\n select?: SelectType\n}): Record<string, true> | undefined => {\n if (!select) {\n return\n }\n\n const projection: Record<string, true> = {\n _id: true,\n }\n\n traverseFields({\n adapter,\n fields,\n projection,\n // Clone to safely mutate it later\n select: deepCopyObjectSimple(select),\n selectMode: getSelectMode(select),\n })\n\n return projection\n}\n"],"names":["deepCopyObjectSimple","fieldAffectsData","fieldShouldBeLocalized","getSelectMode","addFieldToProjection","adapter","databaseSchemaPath","field","parentIsLocalized","projection","config","payload","localization","locale","localeCodes","localeDatabaseSchemaPath","replace","name","traverseFields","fields","select","selectAllOnCurrentLevel","selectMode","fieldDatabaseSchemaPath","type","fieldSelect","id","flattenedFields","localized","blocksSelect","_block","blocks","block","slug","blockSelectMode","blockSelect","blockType","bu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4BACA;wBACF;wBAEA,IAAIY,kBAAkBZ;wBAEtB,IAAIA,eAAe,aAAaO,YAAY,CAACG,MAAMC,IAAI,CAAC,KAAK,OAAO;4BAClEC,kBAAkB;wBACpB;wBAEA,IAAI,OAAOL,YAAY,CAACG,MAAMC,IAAI,CAAC,KAAK,UAAU;4BAChDJ,YAAY,CAACG,MAAMC,IAAI,CAAC,GAAG,CAAC;wBAC9B;wBAEA,IAAIC,oBAAoB,aAAa,OAAOL,YAAY,CAACG,MAAMC,IAAI,CAAC,KAAK,UAAU;4BACjF,MAAME,cAAcN,YAAY,CAACG,MAAMC,IAAI,CAAC;4BAC5CE,YAAYT,EAAE,GAAG;4BACjBS,YAAYC,SAAS,GAAG;wBAC1B;wBAEAlB,eAAe;4BACbb;4BACAC,oBAAoBiB;4BACpBJ,QAAQa,MAAML,eAAe;4BAC7BnB,mBAAmBA,qBAAqBD,MAAMqB,SAAS;4BACvDnB;4BACAW,QAAQS,YAAY,CAACG,MAAMC,IAAI,CAAC;4BAChCX,YAAYY;wBACd;oBACF;oBAEA;gBACF;YAEA,KAAK;YACL,KAAK;gBAAU;oBACb,qHAAqH;oBACrH,mHAAmH;oBACnH9B,qBAAqB;wBACnBC;wBACAC;wBACAC;wBACAC;wBACAC;oBACF;oBACA;gBACF;YAEA;gBACE;QACJ;IACF;AACF;AAEA,OAAO,MAAM4B,4BAA4B,CAAC,EACxChC,OAAO,EACPc,MAAM,EACNC,MAAM,EAKP;IACC,IAAI,CAACA,QAAQ;QACX;IACF;IAEA,MAAMX,aAAmC;QACvC6B,KAAK;IACP;IAEApB,eAAe;QACbb;QACAc;QACAV;QACA,kCAAkC;QAClCW,QAAQpB,qBAAqBoB;QAC7BE,YAAYnB,cAAciB;IAC5B;IAEA,OAAOX;AACT,EAAC"}
|
|
@@ -7,7 +7,7 @@ export declare const getCollection: ({ adapter, collectionSlug, versions, }: {
|
|
|
7
7
|
versions?: boolean;
|
|
8
8
|
}) => {
|
|
9
9
|
collectionConfig: SanitizedCollectionConfig;
|
|
10
|
-
customIDType: Collection[
|
|
10
|
+
customIDType: Collection['customIDType'];
|
|
11
11
|
Model: CollectionModel;
|
|
12
12
|
};
|
|
13
13
|
type BaseGetGlobalArgs = {
|
|
@@ -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,EAAE;QAAE,GAAG,EAAE,GAAG,EAAE,CAAA;KAAE,GAAG,GAAG,CAAC,CAAA;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,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;
|
|
1
|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