@payloadcms/db-mongodb 3.0.0-canary.ce278e4 → 3.0.0-canary.cf66341
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +6 -1
- package/dist/connect.js.map +1 -1
- package/dist/count.d.ts.map +1 -1
- package/dist/count.js +1 -1
- package/dist/count.js.map +1 -1
- package/dist/create.d.ts.map +1 -1
- package/dist/create.js +7 -3
- package/dist/create.js.map +1 -1
- package/dist/createGlobal.d.ts.map +1 -1
- package/dist/createGlobal.js +1 -1
- package/dist/createGlobal.js.map +1 -1
- package/dist/createGlobalVersion.d.ts.map +1 -1
- package/dist/createGlobalVersion.js +1 -1
- package/dist/createGlobalVersion.js.map +1 -1
- package/dist/createMigration.d.ts.map +1 -1
- package/dist/createMigration.js +1 -1
- package/dist/createMigration.js.map +1 -1
- package/dist/createVersion.d.ts.map +1 -1
- package/dist/createVersion.js +1 -1
- package/dist/createVersion.js.map +1 -1
- package/dist/deleteMany.d.ts.map +1 -1
- package/dist/deleteMany.js +1 -1
- package/dist/deleteMany.js.map +1 -1
- package/dist/deleteOne.d.ts.map +1 -1
- package/dist/deleteOne.js +1 -1
- package/dist/deleteOne.js.map +1 -1
- package/dist/deleteVersions.d.ts.map +1 -1
- package/dist/deleteVersions.js +1 -1
- package/dist/deleteVersions.js.map +1 -1
- package/dist/destroy.js.map +1 -1
- package/dist/find.d.ts.map +1 -1
- package/dist/find.js +8 -2
- package/dist/find.js.map +1 -1
- package/dist/findGlobal.d.ts.map +1 -1
- package/dist/findGlobal.js +1 -1
- package/dist/findGlobal.js.map +1 -1
- package/dist/findGlobalVersions.d.ts.map +1 -1
- package/dist/findGlobalVersions.js +9 -3
- package/dist/findGlobalVersions.js.map +1 -1
- package/dist/findOne.d.ts.map +1 -1
- package/dist/findOne.js +1 -1
- package/dist/findOne.js.map +1 -1
- package/dist/findVersions.d.ts.map +1 -1
- package/dist/findVersions.js +8 -2
- package/dist/findVersions.js.map +1 -1
- package/dist/index.d.ts +46 -32
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +1 -1
- package/dist/init.js.map +1 -1
- package/dist/migrateFresh.js.map +1 -1
- package/dist/models/buildCollectionSchema.d.ts +0 -25
- package/dist/models/buildCollectionSchema.d.ts.map +1 -1
- package/dist/models/buildCollectionSchema.js +9 -0
- package/dist/models/buildCollectionSchema.js.map +1 -1
- package/dist/models/buildGlobalModel.js.map +1 -1
- package/dist/models/buildSchema.d.ts +0 -25
- package/dist/models/buildSchema.d.ts.map +1 -1
- package/dist/models/buildSchema.js +12 -11
- package/dist/models/buildSchema.js.map +1 -1
- package/dist/predefinedMigrations/versions-v1-v2.js.map +1 -1
- package/dist/queries/buildAndOrConditions.d.ts.map +1 -1
- package/dist/queries/buildAndOrConditions.js +0 -2
- package/dist/queries/buildAndOrConditions.js.map +1 -1
- package/dist/queries/buildQuery.js.map +1 -1
- package/dist/queries/buildSearchParams.js.map +1 -1
- package/dist/queries/buildSortParam.d.ts +1 -26
- package/dist/queries/buildSortParam.d.ts.map +1 -1
- package/dist/queries/buildSortParam.js.map +1 -1
- package/dist/queries/getLocalizedSortProperty.js.map +1 -1
- package/dist/queries/getLocalizedSortProperty.spec.js +42 -42
- package/dist/queries/getLocalizedSortProperty.spec.js.map +1 -1
- package/dist/queries/mock.js.map +1 -1
- package/dist/queries/operatorMap.js.map +1 -1
- package/dist/queries/parseParams.d.ts.map +1 -1
- package/dist/queries/parseParams.js +2 -5
- package/dist/queries/parseParams.js.map +1 -1
- package/dist/queries/sanitizeQueryValue.js.map +1 -1
- package/dist/queryDrafts.d.ts.map +1 -1
- package/dist/queryDrafts.js +8 -2
- package/dist/queryDrafts.js.map +1 -1
- package/dist/testCredentials.js.map +1 -1
- package/dist/transactions/beginTransaction.js.map +1 -1
- package/dist/transactions/commitTransaction.d.ts.map +1 -1
- package/dist/transactions/commitTransaction.js +1 -0
- package/dist/transactions/commitTransaction.js.map +1 -1
- package/dist/transactions/rollbackTransaction.d.ts.map +1 -1
- package/dist/transactions/rollbackTransaction.js +13 -7
- package/dist/transactions/rollbackTransaction.js.map +1 -1
- package/dist/types.d.ts +0 -25
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/updateGlobal.d.ts.map +1 -1
- package/dist/updateGlobal.js +1 -1
- package/dist/updateGlobal.js.map +1 -1
- package/dist/updateGlobalVersion.d.ts.map +1 -1
- package/dist/updateGlobalVersion.js +1 -1
- package/dist/updateGlobalVersion.js.map +1 -1
- package/dist/updateOne.d.ts.map +1 -1
- package/dist/updateOne.js +7 -3
- package/dist/updateOne.js.map +1 -1
- package/dist/updateVersion.d.ts.map +1 -1
- package/dist/updateVersion.js +1 -1
- package/dist/updateVersion.js.map +1 -1
- package/dist/utilities/getDBName.js.map +1 -1
- package/dist/utilities/handleError.d.ts +6 -2
- package/dist/utilities/handleError.d.ts.map +1 -1
- package/dist/utilities/handleError.js +11 -8
- package/dist/utilities/handleError.js.map +1 -1
- package/dist/utilities/sanitizeInternalFields.d.ts.map +1 -1
- package/dist/utilities/sanitizeInternalFields.js.map +1 -1
- package/dist/withSession.d.ts +3 -27
- package/dist/withSession.d.ts.map +1 -1
- package/dist/withSession.js +6 -2
- package/dist/withSession.js.map +1 -1
- package/package.json +6 -7
package/dist/withSession.d.ts
CHANGED
@@ -1,35 +1,11 @@
|
|
1
|
-
/// <reference types="mongoose/types/aggregate.js" />
|
2
|
-
/// <reference types="mongoose/types/callback.js" />
|
3
|
-
/// <reference types="mongoose/types/collection.js" />
|
4
|
-
/// <reference types="mongoose/types/connection.js" />
|
5
|
-
/// <reference types="mongoose/types/cursor.js" />
|
6
|
-
/// <reference types="mongoose/types/document.js" />
|
7
|
-
/// <reference types="mongoose/types/error.js" />
|
8
|
-
/// <reference types="mongoose/types/expressions.js" />
|
9
|
-
/// <reference types="mongoose/types/helpers.js" />
|
10
|
-
/// <reference types="mongoose/types/middlewares.js" />
|
11
|
-
/// <reference types="mongoose/types/indexes.js" />
|
12
|
-
/// <reference types="mongoose/types/models.js" />
|
13
|
-
/// <reference types="mongoose/types/mongooseoptions.js" />
|
14
|
-
/// <reference types="mongoose/types/pipelinestage.js" />
|
15
|
-
/// <reference types="mongoose/types/populate.js" />
|
16
|
-
/// <reference types="mongoose/types/query.js" />
|
17
|
-
/// <reference types="mongoose/types/schemaoptions.js" />
|
18
|
-
/// <reference types="mongoose/types/schematypes.js" />
|
19
|
-
/// <reference types="mongoose/types/session.js" />
|
20
|
-
/// <reference types="mongoose/types/types.js" />
|
21
|
-
/// <reference types="mongoose/types/utility.js" />
|
22
|
-
/// <reference types="mongoose/types/validation.js" />
|
23
|
-
/// <reference types="mongoose/types/virtuals.js" />
|
24
|
-
/// <reference types="mongoose/types/inferschematype.js" />
|
25
|
-
/// <reference types="mongoose-paginate-v2" />
|
26
1
|
import type { ClientSession } from 'mongoose';
|
2
|
+
import type { PayloadRequest } from 'payload';
|
27
3
|
import type { MongooseAdapter } from './index.js';
|
28
4
|
/**
|
29
5
|
* returns the session belonging to the transaction of the req.session if exists
|
30
6
|
* @returns ClientSession
|
31
7
|
*/
|
32
|
-
export declare function withSession(db: MongooseAdapter,
|
8
|
+
export declare function withSession(db: MongooseAdapter, req: PayloadRequest): Promise<{
|
33
9
|
session: ClientSession;
|
34
|
-
} | object
|
10
|
+
} | object>;
|
35
11
|
//# sourceMappingURL=withSession.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"withSession.d.ts","sourceRoot":"","sources":["../src/withSession.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"withSession.d.ts","sourceRoot":"","sources":["../src/withSession.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,EAAE,EAAE,eAAe,EACnB,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC;IAAE,OAAO,EAAE,aAAa,CAAA;CAAE,GAAG,MAAM,CAAC,CAQ9C"}
|
package/dist/withSession.js
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
/**
|
2
2
|
* returns the session belonging to the transaction of the req.session if exists
|
3
3
|
* @returns ClientSession
|
4
|
-
*/ export function withSession(db,
|
5
|
-
|
4
|
+
*/ export async function withSession(db, req) {
|
5
|
+
let transactionID = req.transactionID;
|
6
|
+
if (transactionID instanceof Promise) {
|
7
|
+
transactionID = await req.transactionID;
|
8
|
+
}
|
9
|
+
if (req) return db.sessions[transactionID] ? {
|
6
10
|
session: db.sessions[transactionID]
|
7
11
|
} : {};
|
8
12
|
}
|
package/dist/withSession.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/withSession.ts"],"sourcesContent":["import type { ClientSession } from 'mongoose'\n\nimport type { MongooseAdapter } from './index.js'\n\n/**\n * returns the session belonging to the transaction of the req.session if exists\n * @returns ClientSession\n */\nexport function withSession(\n db: MongooseAdapter,\n
|
1
|
+
{"version":3,"sources":["../src/withSession.ts"],"sourcesContent":["import type { ClientSession } from 'mongoose'\nimport type { PayloadRequest } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\n/**\n * returns the session belonging to the transaction of the req.session if exists\n * @returns ClientSession\n */\nexport async function withSession(\n db: MongooseAdapter,\n req: PayloadRequest,\n): Promise<{ session: ClientSession } | object> {\n let transactionID = req.transactionID\n\n if (transactionID instanceof Promise) {\n transactionID = await req.transactionID\n }\n\n if (req) return db.sessions[transactionID] ? { session: db.sessions[transactionID] } : {}\n}\n"],"names":["withSession","db","req","transactionID","Promise","sessions","session"],"mappings":"AAKA;;;CAGC,GACD,OAAO,eAAeA,YACpBC,EAAmB,EACnBC,GAAmB;IAEnB,IAAIC,gBAAgBD,IAAIC,aAAa;IAErC,IAAIA,yBAAyBC,SAAS;QACpCD,gBAAgB,MAAMD,IAAIC,aAAa;IACzC;IAEA,IAAID,KAAK,OAAOD,GAAGI,QAAQ,CAACF,cAAc,GAAG;QAAEG,SAASL,GAAGI,QAAQ,CAACF,cAAc;IAAC,IAAI,CAAC;AAC1F"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@payloadcms/db-mongodb",
|
3
|
-
"version": "3.0.0-canary.
|
3
|
+
"version": "3.0.0-canary.cf66341",
|
4
4
|
"description": "The officially supported MongoDB database adapter for Payload",
|
5
5
|
"homepage": "https://payloadcms.com",
|
6
6
|
"repository": {
|
@@ -14,8 +14,8 @@
|
|
14
14
|
"exports": {
|
15
15
|
".": {
|
16
16
|
"import": "./dist/index.js",
|
17
|
-
"
|
18
|
-
"
|
17
|
+
"types": "./dist/index.d.ts",
|
18
|
+
"default": "./dist/index.js"
|
19
19
|
}
|
20
20
|
},
|
21
21
|
"main": "./dist/index.js",
|
@@ -27,7 +27,6 @@
|
|
27
27
|
],
|
28
28
|
"dependencies": {
|
29
29
|
"bson-objectid": "2.0.4",
|
30
|
-
"deepmerge": "4.3.1",
|
31
30
|
"http-status": "1.6.2",
|
32
31
|
"mongoose": "6.12.3",
|
33
32
|
"mongoose-paginate-v2": "1.7.22",
|
@@ -38,11 +37,11 @@
|
|
38
37
|
"@types/mongoose-aggregate-paginate-v2": "1.0.9",
|
39
38
|
"mongodb": "4.17.1",
|
40
39
|
"mongodb-memory-server": "^9",
|
41
|
-
"@payloadcms/eslint-config": "
|
42
|
-
"payload": "3.0.0-canary.
|
40
|
+
"@payloadcms/eslint-config": "3.0.0-beta.59",
|
41
|
+
"payload": "3.0.0-canary.cf66341"
|
43
42
|
},
|
44
43
|
"peerDependencies": {
|
45
|
-
"payload": "3.0.0-canary.
|
44
|
+
"payload": "3.0.0-canary.cf66341"
|
46
45
|
},
|
47
46
|
"scripts": {
|
48
47
|
"build": "pnpm build:types && pnpm build:swc",
|