@payloadcms/db-mongodb 3.0.0-canary.98cbdb9 → 3.0.0-canary.98e0119

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. package/dist/connect.d.ts.map +1 -1
  2. package/dist/connect.js +12 -3
  3. package/dist/connect.js.map +1 -1
  4. package/dist/count.d.ts.map +1 -1
  5. package/dist/count.js +8 -1
  6. package/dist/count.js.map +1 -1
  7. package/dist/countGlobalVersions.d.ts +3 -0
  8. package/dist/countGlobalVersions.d.ts.map +1 -0
  9. package/dist/countGlobalVersions.js +40 -0
  10. package/dist/countGlobalVersions.js.map +1 -0
  11. package/dist/countVersions.d.ts +3 -0
  12. package/dist/countVersions.d.ts.map +1 -0
  13. package/dist/countVersions.js +40 -0
  14. package/dist/countVersions.js.map +1 -0
  15. package/dist/create.d.ts.map +1 -1
  16. package/dist/create.js +10 -1
  17. package/dist/create.js.map +1 -1
  18. package/dist/createGlobal.d.ts.map +1 -1
  19. package/dist/createGlobal.js +10 -5
  20. package/dist/createGlobal.js.map +1 -1
  21. package/dist/createGlobalVersion.d.ts +1 -1
  22. package/dist/createGlobalVersion.d.ts.map +1 -1
  23. package/dist/createGlobalVersion.js +13 -4
  24. package/dist/createGlobalVersion.js.map +1 -1
  25. package/dist/createMigration.d.ts.map +1 -1
  26. package/dist/createMigration.js +8 -6
  27. package/dist/createMigration.js.map +1 -1
  28. package/dist/createVersion.d.ts +1 -1
  29. package/dist/createVersion.d.ts.map +1 -1
  30. package/dist/createVersion.js +31 -9
  31. package/dist/createVersion.js.map +1 -1
  32. package/dist/deleteOne.d.ts.map +1 -1
  33. package/dist/deleteOne.js +11 -3
  34. package/dist/deleteOne.js.map +1 -1
  35. package/dist/exports/migration-utils.d.ts +3 -0
  36. package/dist/exports/migration-utils.d.ts.map +1 -0
  37. package/dist/exports/migration-utils.js +4 -0
  38. package/dist/exports/migration-utils.js.map +1 -0
  39. package/dist/find.d.ts.map +1 -1
  40. package/dist/find.js +27 -4
  41. package/dist/find.js.map +1 -1
  42. package/dist/findGlobal.d.ts.map +1 -1
  43. package/dist/findGlobal.js +9 -3
  44. package/dist/findGlobal.js.map +1 -1
  45. package/dist/findGlobalVersions.d.ts.map +1 -1
  46. package/dist/findGlobalVersions.js +9 -4
  47. package/dist/findGlobalVersions.js.map +1 -1
  48. package/dist/findOne.d.ts.map +1 -1
  49. package/dist/findOne.js +27 -3
  50. package/dist/findOne.js.map +1 -1
  51. package/dist/findVersions.d.ts.map +1 -1
  52. package/dist/findVersions.js +9 -4
  53. package/dist/findVersions.js.map +1 -1
  54. package/dist/index.d.ts +14 -4
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.js +17 -7
  57. package/dist/index.js.map +1 -1
  58. package/dist/init.d.ts.map +1 -1
  59. package/dist/init.js +17 -15
  60. package/dist/init.js.map +1 -1
  61. package/dist/models/buildCollectionSchema.d.ts +1 -2
  62. package/dist/models/buildCollectionSchema.d.ts.map +1 -1
  63. package/dist/models/buildCollectionSchema.js +7 -4
  64. package/dist/models/buildCollectionSchema.js.map +1 -1
  65. package/dist/models/buildGlobalModel.js +2 -2
  66. package/dist/models/buildGlobalModel.js.map +1 -1
  67. package/dist/models/buildSchema.d.ts +1 -2
  68. package/dist/models/buildSchema.d.ts.map +1 -1
  69. package/dist/models/buildSchema.js +104 -12
  70. package/dist/models/buildSchema.js.map +1 -1
  71. package/dist/predefinedMigrations/migrateRelationshipsV2_V3.d.ts +6 -0
  72. package/dist/predefinedMigrations/migrateRelationshipsV2_V3.d.ts.map +1 -0
  73. package/dist/predefinedMigrations/migrateRelationshipsV2_V3.js +136 -0
  74. package/dist/predefinedMigrations/migrateRelationshipsV2_V3.js.map +1 -0
  75. package/dist/predefinedMigrations/migrateVersionsV1_V2.d.ts +5 -0
  76. package/dist/predefinedMigrations/migrateVersionsV1_V2.d.ts.map +1 -0
  77. package/dist/predefinedMigrations/migrateVersionsV1_V2.js +107 -0
  78. package/dist/predefinedMigrations/migrateVersionsV1_V2.js.map +1 -0
  79. package/dist/predefinedMigrations/relationships-v2-v3.d.ts +4 -0
  80. package/dist/predefinedMigrations/relationships-v2-v3.d.ts.map +1 -0
  81. package/dist/predefinedMigrations/relationships-v2-v3.js +9 -0
  82. package/dist/predefinedMigrations/relationships-v2-v3.js.map +1 -0
  83. package/dist/predefinedMigrations/versions-v1-v2.d.ts +4 -0
  84. package/dist/predefinedMigrations/versions-v1-v2.d.ts.map +1 -0
  85. package/dist/predefinedMigrations/versions-v1-v2.js +5 -95
  86. package/dist/predefinedMigrations/versions-v1-v2.js.map +1 -1
  87. package/dist/queries/buildQuery.d.ts +2 -2
  88. package/dist/queries/buildQuery.d.ts.map +1 -1
  89. package/dist/queries/buildQuery.js +1 -2
  90. package/dist/queries/buildQuery.js.map +1 -1
  91. package/dist/queries/buildSearchParams.d.ts.map +1 -1
  92. package/dist/queries/buildSearchParams.js +28 -18
  93. package/dist/queries/buildSearchParams.js.map +1 -1
  94. package/dist/queries/buildSortParam.d.ts +2 -2
  95. package/dist/queries/buildSortParam.d.ts.map +1 -1
  96. package/dist/queries/buildSortParam.js +26 -17
  97. package/dist/queries/buildSortParam.js.map +1 -1
  98. package/dist/queries/getLocalizedSortProperty.spec.js +1 -1
  99. package/dist/queries/getLocalizedSortProperty.spec.js.map +1 -1
  100. package/dist/queries/parseParams.d.ts.map +1 -1
  101. package/dist/queries/parseParams.js +7 -2
  102. package/dist/queries/parseParams.js.map +1 -1
  103. package/dist/queries/sanitizeQueryValue.d.ts.map +1 -1
  104. package/dist/queries/sanitizeQueryValue.js +144 -27
  105. package/dist/queries/sanitizeQueryValue.js.map +1 -1
  106. package/dist/queryDrafts.d.ts.map +1 -1
  107. package/dist/queryDrafts.js +29 -8
  108. package/dist/queryDrafts.js.map +1 -1
  109. package/dist/transactions/beginTransaction.d.ts.map +1 -1
  110. package/dist/transactions/beginTransaction.js +2 -0
  111. package/dist/transactions/beginTransaction.js.map +1 -1
  112. package/dist/transactions/commitTransaction.d.ts.map +1 -1
  113. package/dist/transactions/commitTransaction.js +3 -1
  114. package/dist/transactions/commitTransaction.js.map +1 -1
  115. package/dist/types.d.ts +7 -4
  116. package/dist/types.d.ts.map +1 -1
  117. package/dist/types.js.map +1 -1
  118. package/dist/updateGlobal.d.ts.map +1 -1
  119. package/dist/updateGlobal.js +17 -4
  120. package/dist/updateGlobal.js.map +1 -1
  121. package/dist/updateGlobalVersion.d.ts +2 -2
  122. package/dist/updateGlobalVersion.d.ts.map +1 -1
  123. package/dist/updateGlobalVersion.js +18 -4
  124. package/dist/updateGlobalVersion.js.map +1 -1
  125. package/dist/updateOne.d.ts.map +1 -1
  126. package/dist/updateOne.js +18 -4
  127. package/dist/updateOne.js.map +1 -1
  128. package/dist/updateVersion.d.ts +1 -1
  129. package/dist/updateVersion.d.ts.map +1 -1
  130. package/dist/updateVersion.js +17 -3
  131. package/dist/updateVersion.js.map +1 -1
  132. package/dist/upsert.d.ts +3 -0
  133. package/dist/upsert.d.ts.map +1 -0
  134. package/dist/upsert.js +15 -0
  135. package/dist/upsert.js.map +1 -0
  136. package/dist/utilities/buildJoinAggregation.d.ts +18 -0
  137. package/dist/utilities/buildJoinAggregation.d.ts.map +1 -0
  138. package/dist/utilities/buildJoinAggregation.js +159 -0
  139. package/dist/utilities/buildJoinAggregation.js.map +1 -0
  140. package/dist/utilities/buildProjectionFromSelect.d.ts +8 -0
  141. package/dist/utilities/buildProjectionFromSelect.d.ts.map +1 -0
  142. package/dist/utilities/buildProjectionFromSelect.js +171 -0
  143. package/dist/utilities/buildProjectionFromSelect.js.map +1 -0
  144. package/dist/utilities/getDBName.d.ts.map +1 -1
  145. package/dist/utilities/getDBName.js +3 -1
  146. package/dist/utilities/getDBName.js.map +1 -1
  147. package/dist/utilities/handleError.js +2 -2
  148. package/dist/utilities/handleError.js.map +1 -1
  149. package/dist/utilities/sanitizeInternalFields.d.ts +1 -2
  150. package/dist/utilities/sanitizeInternalFields.d.ts.map +1 -1
  151. package/dist/utilities/sanitizeInternalFields.js +1 -2
  152. package/dist/utilities/sanitizeInternalFields.js.map +1 -1
  153. package/dist/utilities/sanitizeRelationshipIDs.d.ts +9 -0
  154. package/dist/utilities/sanitizeRelationshipIDs.d.ts.map +1 -0
  155. package/dist/utilities/sanitizeRelationshipIDs.js +115 -0
  156. package/dist/utilities/sanitizeRelationshipIDs.js.map +1 -0
  157. package/dist/withSession.d.ts +1 -1
  158. package/dist/withSession.d.ts.map +1 -1
  159. package/dist/withSession.js +5 -3
  160. package/dist/withSession.js.map +1 -1
  161. package/license.md +22 -0
  162. package/package.json +24 -10
@@ -6,9 +6,11 @@
6
6
  if (transactionID instanceof Promise) {
7
7
  transactionID = await req.transactionID;
8
8
  }
9
- if (req) return db.sessions[transactionID] ? {
10
- session: db.sessions[transactionID]
11
- } : {};
9
+ if (req) {
10
+ return db.sessions[transactionID] ? {
11
+ session: db.sessions[transactionID]
12
+ } : {};
13
+ }
12
14
  }
13
15
 
14
16
  //# sourceMappingURL=withSession.js.map
@@ -1 +1 @@
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"}
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 } | Record<string, never>> {\n let transactionID = req.transactionID\n\n if (transactionID instanceof Promise) {\n transactionID = await req.transactionID\n }\n\n if (req) {\n return db.sessions[transactionID] ? { session: db.sessions[transactionID] } : {}\n }\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;QACP,OAAOD,GAAGI,QAAQ,CAACF,cAAc,GAAG;YAAEG,SAASL,GAAGI,QAAQ,CAACF,cAAc;QAAC,IAAI,CAAC;IACjF;AACF"}
package/license.md ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018-2024 Payload CMS, Inc. <info@payloadcms.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/db-mongodb",
3
- "version": "3.0.0-canary.98cbdb9",
3
+ "version": "3.0.0-canary.98e0119",
4
4
  "description": "The officially supported MongoDB database adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -10,12 +10,24 @@
10
10
  },
11
11
  "license": "MIT",
12
12
  "author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
13
+ "maintainers": [
14
+ {
15
+ "name": "Payload",
16
+ "email": "info@payloadcms.com",
17
+ "url": "https://payloadcms.com"
18
+ }
19
+ ],
13
20
  "type": "module",
14
21
  "exports": {
15
22
  ".": {
16
23
  "import": "./dist/index.js",
17
24
  "types": "./dist/index.d.ts",
18
25
  "default": "./dist/index.js"
26
+ },
27
+ "./migration-utils": {
28
+ "import": "./dist/exports/migration-utils.js",
29
+ "types": "./dist/exports/migration-utils.d.ts",
30
+ "default": "./dist/exports/migration-utils.js"
19
31
  }
20
32
  },
21
33
  "main": "./dist/index.js",
@@ -26,27 +38,29 @@
26
38
  "predefinedMigrations"
27
39
  ],
28
40
  "dependencies": {
29
- "bson-objectid": "2.0.4",
30
41
  "http-status": "1.6.2",
31
- "mongoose": "6.12.3",
32
- "mongoose-paginate-v2": "1.7.22",
42
+ "mongoose": "8.8.1",
43
+ "mongoose-aggregate-paginate-v2": "1.1.2",
44
+ "mongoose-paginate-v2": "1.8.5",
33
45
  "prompts": "2.4.2",
34
46
  "uuid": "10.0.0"
35
47
  },
36
48
  "devDependencies": {
37
- "@types/mongoose-aggregate-paginate-v2": "1.0.9",
38
- "mongodb": "4.17.1",
49
+ "@types/mongoose-aggregate-paginate-v2": "1.0.12",
50
+ "mongodb": "6.10.0",
39
51
  "mongodb-memory-server": "^9",
40
- "@payloadcms/eslint-config": "3.0.0-beta.59",
41
- "payload": "3.0.0-canary.98cbdb9"
52
+ "@payloadcms/eslint-config": "3.0.0-beta.112",
53
+ "payload": "3.0.0-canary.98e0119"
42
54
  },
43
55
  "peerDependencies": {
44
- "payload": "3.0.0-canary.98cbdb9"
56
+ "payload": "3.0.0-canary.98e0119"
45
57
  },
46
58
  "scripts": {
47
59
  "build": "pnpm build:types && pnpm build:swc",
48
60
  "build:swc": "swc ./src -d ./dist --config-file .swcrc-build --strip-leading-paths",
49
61
  "build:types": "tsc --emitDeclarationOnly --outDir dist",
50
- "clean": "rimraf {dist,*.tsbuildinfo}"
62
+ "clean": "rimraf {dist,*.tsbuildinfo}",
63
+ "lint": "eslint .",
64
+ "lint:fix": "eslint . --fix"
51
65
  }
52
66
  }