@payloadcms/db-mongodb 3.2.2-canary.a11698b → 3.2.2-canary.d2399ed

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.
Files changed (127) hide show
  1. package/dist/count.d.ts.map +1 -1
  2. package/dist/count.js +19 -21
  3. package/dist/count.js.map +1 -1
  4. package/dist/countGlobalVersions.d.ts.map +1 -1
  5. package/dist/countGlobalVersions.js +19 -21
  6. package/dist/countGlobalVersions.js.map +1 -1
  7. package/dist/countVersions.d.ts.map +1 -1
  8. package/dist/countVersions.js +19 -21
  9. package/dist/countVersions.js.map +1 -1
  10. package/dist/create.d.ts.map +1 -1
  11. package/dist/create.js +22 -22
  12. package/dist/create.js.map +1 -1
  13. package/dist/createGlobal.d.ts.map +1 -1
  14. package/dist/createGlobal.js +21 -19
  15. package/dist/createGlobal.js.map +1 -1
  16. package/dist/createGlobalVersion.d.ts.map +1 -1
  17. package/dist/createGlobalVersion.js +35 -30
  18. package/dist/createGlobalVersion.js.map +1 -1
  19. package/dist/createVersion.d.ts.map +1 -1
  20. package/dist/createVersion.js +35 -30
  21. package/dist/createVersion.js.map +1 -1
  22. package/dist/deleteMany.d.ts.map +1 -1
  23. package/dist/deleteMany.js +6 -6
  24. package/dist/deleteMany.js.map +1 -1
  25. package/dist/deleteOne.d.ts.map +1 -1
  26. package/dist/deleteOne.js +17 -13
  27. package/dist/deleteOne.js.map +1 -1
  28. package/dist/deleteVersions.d.ts.map +1 -1
  29. package/dist/deleteVersions.js +6 -6
  30. package/dist/deleteVersions.js.map +1 -1
  31. package/dist/find.d.ts.map +1 -1
  32. package/dist/find.js +41 -74
  33. package/dist/find.js.map +1 -1
  34. package/dist/findGlobal.d.ts.map +1 -1
  35. package/dist/findGlobal.js +19 -18
  36. package/dist/findGlobal.js.map +1 -1
  37. package/dist/findGlobalVersions.d.ts.map +1 -1
  38. package/dist/findGlobalVersions.js +33 -62
  39. package/dist/findGlobalVersions.js.map +1 -1
  40. package/dist/findOne.d.ts.map +1 -1
  41. package/dist/findOne.js +32 -19
  42. package/dist/findOne.js.map +1 -1
  43. package/dist/findVersions.d.ts.map +1 -1
  44. package/dist/findVersions.js +34 -62
  45. package/dist/findVersions.js.map +1 -1
  46. package/dist/{withSession.d.ts → getSession.d.ts} +2 -4
  47. package/dist/getSession.d.ts.map +1 -0
  48. package/dist/{withSession.js → getSession.js} +3 -5
  49. package/dist/getSession.js.map +1 -0
  50. package/dist/predefinedMigrations/migrateRelationshipsV2_V3.d.ts.map +1 -1
  51. package/dist/predefinedMigrations/migrateRelationshipsV2_V3.js +20 -16
  52. package/dist/predefinedMigrations/migrateRelationshipsV2_V3.js.map +1 -1
  53. package/dist/predefinedMigrations/migrateVersionsV1_V2.js +2 -2
  54. package/dist/predefinedMigrations/migrateVersionsV1_V2.js.map +1 -1
  55. package/dist/queries/buildAndOrConditions.d.ts +3 -1
  56. package/dist/queries/buildAndOrConditions.d.ts.map +1 -1
  57. package/dist/queries/buildAndOrConditions.js +2 -1
  58. package/dist/queries/buildAndOrConditions.js.map +1 -1
  59. package/dist/queries/buildQuery.d.ts +2 -0
  60. package/dist/queries/buildQuery.d.ts.map +1 -1
  61. package/dist/queries/buildQuery.js +2 -6
  62. package/dist/queries/buildQuery.js.map +1 -1
  63. package/dist/queries/buildSearchParams.d.ts +3 -1
  64. package/dist/queries/buildSearchParams.d.ts.map +1 -1
  65. package/dist/queries/buildSearchParams.js +14 -10
  66. package/dist/queries/buildSearchParams.js.map +1 -1
  67. package/dist/queries/buildSortParam.d.ts +1 -7
  68. package/dist/queries/buildSortParam.d.ts.map +1 -1
  69. package/dist/queries/buildSortParam.js +2 -2
  70. package/dist/queries/buildSortParam.js.map +1 -1
  71. package/dist/queries/getLocalizedSortProperty.js +2 -2
  72. package/dist/queries/getLocalizedSortProperty.js.map +1 -1
  73. package/dist/queries/parseParams.d.ts +3 -1
  74. package/dist/queries/parseParams.d.ts.map +1 -1
  75. package/dist/queries/parseParams.js +2 -1
  76. package/dist/queries/parseParams.js.map +1 -1
  77. package/dist/queries/sanitizeQueryValue.d.ts.map +1 -1
  78. package/dist/queries/sanitizeQueryValue.js +16 -0
  79. package/dist/queries/sanitizeQueryValue.js.map +1 -1
  80. package/dist/queryDrafts.d.ts.map +1 -1
  81. package/dist/queryDrafts.js +41 -65
  82. package/dist/queryDrafts.js.map +1 -1
  83. package/dist/updateGlobal.d.ts.map +1 -1
  84. package/dist/updateGlobal.js +25 -23
  85. package/dist/updateGlobal.js.map +1 -1
  86. package/dist/updateGlobalVersion.d.ts.map +1 -1
  87. package/dist/updateGlobalVersion.js +28 -27
  88. package/dist/updateGlobalVersion.js.map +1 -1
  89. package/dist/updateOne.d.ts.map +1 -1
  90. package/dist/updateOne.js +28 -24
  91. package/dist/updateOne.js.map +1 -1
  92. package/dist/updateVersion.d.ts.map +1 -1
  93. package/dist/updateVersion.js +28 -26
  94. package/dist/updateVersion.js.map +1 -1
  95. package/dist/utilities/buildJoinAggregation.d.ts +4 -4
  96. package/dist/utilities/buildJoinAggregation.d.ts.map +1 -1
  97. package/dist/utilities/buildJoinAggregation.js +7 -28
  98. package/dist/utilities/buildJoinAggregation.js.map +1 -1
  99. package/dist/utilities/buildProjectionFromSelect.d.ts.map +1 -1
  100. package/dist/utilities/buildProjectionFromSelect.js +18 -1
  101. package/dist/utilities/buildProjectionFromSelect.js.map +1 -1
  102. package/dist/utilities/findMany.d.ts +20 -0
  103. package/dist/utilities/findMany.d.ts.map +1 -0
  104. package/dist/utilities/findMany.js +84 -0
  105. package/dist/utilities/findMany.js.map +1 -0
  106. package/dist/utilities/getHasNearConstraint.d.ts +3 -0
  107. package/dist/utilities/getHasNearConstraint.d.ts.map +1 -0
  108. package/dist/utilities/getHasNearConstraint.js +26 -0
  109. package/dist/utilities/getHasNearConstraint.js.map +1 -0
  110. package/dist/utilities/transform.d.ts +17 -0
  111. package/dist/utilities/transform.d.ts.map +1 -0
  112. package/dist/utilities/transform.js +250 -0
  113. package/dist/utilities/transform.js.map +1 -0
  114. package/dist/utilities/{sanitizeRelationshipIDs.spec.js → transform.spec.js} +23 -7
  115. package/dist/utilities/transform.spec.js.map +1 -0
  116. package/package.json +3 -3
  117. package/dist/utilities/sanitizeInternalFields.d.ts +0 -2
  118. package/dist/utilities/sanitizeInternalFields.d.ts.map +0 -1
  119. package/dist/utilities/sanitizeInternalFields.js +0 -20
  120. package/dist/utilities/sanitizeInternalFields.js.map +0 -1
  121. package/dist/utilities/sanitizeRelationshipIDs.d.ts +0 -9
  122. package/dist/utilities/sanitizeRelationshipIDs.d.ts.map +0 -1
  123. package/dist/utilities/sanitizeRelationshipIDs.js +0 -125
  124. package/dist/utilities/sanitizeRelationshipIDs.js.map +0 -1
  125. package/dist/utilities/sanitizeRelationshipIDs.spec.js.map +0 -1
  126. package/dist/withSession.d.ts.map +0 -1
  127. package/dist/withSession.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../src/count.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAkB,MAAM,SAAS,CAAA;AAQpD,eAAO,MAAM,KAAK,EAAE,KA2CnB,CAAA"}
1
+ {"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../src/count.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAkB,MAAM,SAAS,CAAA;AAOpD,eAAO,MAAM,KAAK,EAAE,KAyCnB,CAAA"}
package/dist/count.js CHANGED
@@ -1,36 +1,34 @@
1
- import { flattenWhereToOperators } from 'payload';
2
- import { withSession } from './withSession.js';
1
+ import { getSession } from './getSession.js';
2
+ import { getHasNearConstraint } from './utilities/getHasNearConstraint.js';
3
3
  export const count = async function count({ collection, locale, req = {}, where }) {
4
4
  const Model = this.collections[collection];
5
- const options = await withSession(this, req);
6
- let hasNearConstraint = false;
7
- if (where) {
8
- const constraints = flattenWhereToOperators(where);
9
- hasNearConstraint = constraints.some((prop)=>Object.keys(prop).some((key)=>key === 'near'));
10
- }
5
+ const session = await getSession(this, req);
6
+ const hasNearConstraint = getHasNearConstraint(where);
11
7
  const query = await Model.buildQuery({
12
8
  locale,
13
9
  payload: this.payload,
10
+ session,
14
11
  where
15
12
  });
16
13
  // useEstimatedCount is faster, but not accurate, as it ignores any filters. It is thus set to true if there are no filters.
17
14
  const useEstimatedCount = hasNearConstraint || !query || Object.keys(query).length === 0;
18
- if (!useEstimatedCount && Object.keys(query).length === 0 && this.disableIndexHints !== true) {
19
- // Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding
20
- // a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,
21
- // which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses
22
- // the correct indexed field
23
- options.hint = {
24
- _id: 1
25
- };
26
- }
27
15
  let result;
28
16
  if (useEstimatedCount) {
29
- result = await Model.estimatedDocumentCount({
30
- session: options.session
31
- });
17
+ result = await Model.collection.estimatedDocumentCount();
32
18
  } else {
33
- result = await Model.countDocuments(query, options);
19
+ const options = {
20
+ session
21
+ };
22
+ if (this.disableIndexHints !== true) {
23
+ // Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding
24
+ // a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,
25
+ // which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses
26
+ // the correct indexed field
27
+ options.hint = {
28
+ _id: 1
29
+ };
30
+ }
31
+ result = await Model.collection.countDocuments(query, options);
34
32
  }
35
33
  return {
36
34
  totalDocs: result
package/dist/count.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/count.ts"],"sourcesContent":["import type { CountOptions } from 'mongodb'\nimport type { Count, PayloadRequest } from 'payload'\n\nimport { flattenWhereToOperators } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { withSession } from './withSession.js'\n\nexport const count: Count = async function count(\n this: MongooseAdapter,\n { collection, locale, req = {} as PayloadRequest, where },\n) {\n const Model = this.collections[collection]\n const options: CountOptions = await withSession(this, req)\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 query = await Model.buildQuery({\n locale,\n payload: this.payload,\n where,\n })\n\n // useEstimatedCount is faster, but not accurate, as it ignores any filters. It is thus set to true if there are no filters.\n const useEstimatedCount = hasNearConstraint || !query || Object.keys(query).length === 0\n\n if (!useEstimatedCount && Object.keys(query).length === 0 && this.disableIndexHints !== true) {\n // Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding\n // a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,\n // which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses\n // the correct indexed field\n options.hint = {\n _id: 1,\n }\n }\n\n let result: number\n if (useEstimatedCount) {\n result = await Model.estimatedDocumentCount({ session: options.session })\n } else {\n result = await Model.countDocuments(query, options)\n }\n\n return {\n totalDocs: result,\n }\n}\n"],"names":["flattenWhereToOperators","withSession","count","collection","locale","req","where","Model","collections","options","hasNearConstraint","constraints","some","prop","Object","keys","key","query","buildQuery","payload","useEstimatedCount","length","disableIndexHints","hint","_id","result","estimatedDocumentCount","session","countDocuments","totalDocs"],"mappings":"AAGA,SAASA,uBAAuB,QAAQ,UAAS;AAIjD,SAASC,WAAW,QAAQ,mBAAkB;AAE9C,OAAO,MAAMC,QAAe,eAAeA,MAEzC,EAAEC,UAAU,EAAEC,MAAM,EAAEC,MAAM,CAAC,CAAmB,EAAEC,KAAK,EAAE;IAEzD,MAAMC,QAAQ,IAAI,CAACC,WAAW,CAACL,WAAW;IAC1C,MAAMM,UAAwB,MAAMR,YAAY,IAAI,EAAEI;IAEtD,IAAIK,oBAAoB;IAExB,IAAIJ,OAAO;QACT,MAAMK,cAAcX,wBAAwBM;QAC5CI,oBAAoBC,YAAYC,IAAI,CAAC,CAACC,OAASC,OAAOC,IAAI,CAACF,MAAMD,IAAI,CAAC,CAACI,MAAQA,QAAQ;IACzF;IAEA,MAAMC,QAAQ,MAAMV,MAAMW,UAAU,CAAC;QACnCd;QACAe,SAAS,IAAI,CAACA,OAAO;QACrBb;IACF;IAEA,4HAA4H;IAC5H,MAAMc,oBAAoBV,qBAAqB,CAACO,SAASH,OAAOC,IAAI,CAACE,OAAOI,MAAM,KAAK;IAEvF,IAAI,CAACD,qBAAqBN,OAAOC,IAAI,CAACE,OAAOI,MAAM,KAAK,KAAK,IAAI,CAACC,iBAAiB,KAAK,MAAM;QAC5F,mHAAmH;QACnH,qHAAqH;QACrH,mHAAmH;QACnH,4BAA4B;QAC5Bb,QAAQc,IAAI,GAAG;YACbC,KAAK;QACP;IACF;IAEA,IAAIC;IACJ,IAAIL,mBAAmB;QACrBK,SAAS,MAAMlB,MAAMmB,sBAAsB,CAAC;YAAEC,SAASlB,QAAQkB,OAAO;QAAC;IACzE,OAAO;QACLF,SAAS,MAAMlB,MAAMqB,cAAc,CAACX,OAAOR;IAC7C;IAEA,OAAO;QACLoB,WAAWJ;IACb;AACF,EAAC"}
1
+ {"version":3,"sources":["../src/count.ts"],"sourcesContent":["import type { CountOptions } from 'mongodb'\nimport type { Count, PayloadRequest } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { getSession } from './getSession.js'\nimport { getHasNearConstraint } from './utilities/getHasNearConstraint.js'\n\nexport const count: Count = async function count(\n this: MongooseAdapter,\n { collection, locale, req = {} as PayloadRequest, where },\n) {\n const Model = this.collections[collection]\n const session = await getSession(this, req)\n\n const hasNearConstraint = getHasNearConstraint(where)\n\n const query = await Model.buildQuery({\n locale,\n payload: this.payload,\n session,\n where,\n })\n\n // useEstimatedCount is faster, but not accurate, as it ignores any filters. It is thus set to true if there are no filters.\n const useEstimatedCount = hasNearConstraint || !query || Object.keys(query).length === 0\n\n let result: number\n if (useEstimatedCount) {\n result = await Model.collection.estimatedDocumentCount()\n } else {\n const options: CountOptions = { session }\n\n if (this.disableIndexHints !== true) {\n // Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding\n // a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,\n // which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses\n // the correct indexed field\n options.hint = {\n _id: 1,\n }\n }\n\n result = await Model.collection.countDocuments(query, options)\n }\n\n return {\n totalDocs: result,\n }\n}\n"],"names":["getSession","getHasNearConstraint","count","collection","locale","req","where","Model","collections","session","hasNearConstraint","query","buildQuery","payload","useEstimatedCount","Object","keys","length","result","estimatedDocumentCount","options","disableIndexHints","hint","_id","countDocuments","totalDocs"],"mappings":"AAKA,SAASA,UAAU,QAAQ,kBAAiB;AAC5C,SAASC,oBAAoB,QAAQ,sCAAqC;AAE1E,OAAO,MAAMC,QAAe,eAAeA,MAEzC,EAAEC,UAAU,EAAEC,MAAM,EAAEC,MAAM,CAAC,CAAmB,EAAEC,KAAK,EAAE;IAEzD,MAAMC,QAAQ,IAAI,CAACC,WAAW,CAACL,WAAW;IAC1C,MAAMM,UAAU,MAAMT,WAAW,IAAI,EAAEK;IAEvC,MAAMK,oBAAoBT,qBAAqBK;IAE/C,MAAMK,QAAQ,MAAMJ,MAAMK,UAAU,CAAC;QACnCR;QACAS,SAAS,IAAI,CAACA,OAAO;QACrBJ;QACAH;IACF;IAEA,4HAA4H;IAC5H,MAAMQ,oBAAoBJ,qBAAqB,CAACC,SAASI,OAAOC,IAAI,CAACL,OAAOM,MAAM,KAAK;IAEvF,IAAIC;IACJ,IAAIJ,mBAAmB;QACrBI,SAAS,MAAMX,MAAMJ,UAAU,CAACgB,sBAAsB;IACxD,OAAO;QACL,MAAMC,UAAwB;YAAEX;QAAQ;QAExC,IAAI,IAAI,CAACY,iBAAiB,KAAK,MAAM;YACnC,mHAAmH;YACnH,qHAAqH;YACrH,mHAAmH;YACnH,4BAA4B;YAC5BD,QAAQE,IAAI,GAAG;gBACbC,KAAK;YACP;QACF;QAEAL,SAAS,MAAMX,MAAMJ,UAAU,CAACqB,cAAc,CAACb,OAAOS;IACxD;IAEA,OAAO;QACLK,WAAWP;IACb;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"countGlobalVersions.d.ts","sourceRoot":"","sources":["../src/countGlobalVersions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,SAAS,CAAA;AAQlE,eAAO,MAAM,mBAAmB,EAAE,mBA2CjC,CAAA"}
1
+ {"version":3,"file":"countGlobalVersions.d.ts","sourceRoot":"","sources":["../src/countGlobalVersions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,SAAS,CAAA;AAOlE,eAAO,MAAM,mBAAmB,EAAE,mBAyCjC,CAAA"}
@@ -1,36 +1,34 @@
1
- import { flattenWhereToOperators } from 'payload';
2
- import { withSession } from './withSession.js';
1
+ import { getSession } from './getSession.js';
2
+ import { getHasNearConstraint } from './utilities/getHasNearConstraint.js';
3
3
  export const countGlobalVersions = async function countGlobalVersions({ global, locale, req = {}, where }) {
4
4
  const Model = this.versions[global];
5
- const options = await withSession(this, req);
6
- let hasNearConstraint = false;
7
- if (where) {
8
- const constraints = flattenWhereToOperators(where);
9
- hasNearConstraint = constraints.some((prop)=>Object.keys(prop).some((key)=>key === 'near'));
10
- }
5
+ const session = await getSession(this, req);
6
+ const hasNearConstraint = getHasNearConstraint(where);
11
7
  const query = await Model.buildQuery({
12
8
  locale,
13
9
  payload: this.payload,
10
+ session,
14
11
  where
15
12
  });
16
13
  // useEstimatedCount is faster, but not accurate, as it ignores any filters. It is thus set to true if there are no filters.
17
14
  const useEstimatedCount = hasNearConstraint || !query || Object.keys(query).length === 0;
18
- if (!useEstimatedCount && Object.keys(query).length === 0 && this.disableIndexHints !== true) {
19
- // Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding
20
- // a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,
21
- // which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses
22
- // the correct indexed field
23
- options.hint = {
24
- _id: 1
25
- };
26
- }
27
15
  let result;
28
16
  if (useEstimatedCount) {
29
- result = await Model.estimatedDocumentCount({
30
- session: options.session
31
- });
17
+ result = await Model.collection.estimatedDocumentCount();
32
18
  } else {
33
- result = await Model.countDocuments(query, options);
19
+ const options = {
20
+ session
21
+ };
22
+ if (Object.keys(query).length === 0 && this.disableIndexHints !== true) {
23
+ // Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding
24
+ // a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,
25
+ // which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses
26
+ // the correct indexed field
27
+ options.hint = {
28
+ _id: 1
29
+ };
30
+ }
31
+ result = await Model.collection.countDocuments(query, options);
34
32
  }
35
33
  return {
36
34
  totalDocs: result
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/countGlobalVersions.ts"],"sourcesContent":["import type { CountOptions } from 'mongodb'\nimport type { CountGlobalVersions, PayloadRequest } from 'payload'\n\nimport { flattenWhereToOperators } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { withSession } from './withSession.js'\n\nexport const countGlobalVersions: CountGlobalVersions = async function countGlobalVersions(\n this: MongooseAdapter,\n { global, locale, req = {} as PayloadRequest, where },\n) {\n const Model = this.versions[global]\n const options: CountOptions = await withSession(this, req)\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 query = await Model.buildQuery({\n locale,\n payload: this.payload,\n where,\n })\n\n // useEstimatedCount is faster, but not accurate, as it ignores any filters. It is thus set to true if there are no filters.\n const useEstimatedCount = hasNearConstraint || !query || Object.keys(query).length === 0\n\n if (!useEstimatedCount && Object.keys(query).length === 0 && this.disableIndexHints !== true) {\n // Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding\n // a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,\n // which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses\n // the correct indexed field\n options.hint = {\n _id: 1,\n }\n }\n\n let result: number\n if (useEstimatedCount) {\n result = await Model.estimatedDocumentCount({ session: options.session })\n } else {\n result = await Model.countDocuments(query, options)\n }\n\n return {\n totalDocs: result,\n }\n}\n"],"names":["flattenWhereToOperators","withSession","countGlobalVersions","global","locale","req","where","Model","versions","options","hasNearConstraint","constraints","some","prop","Object","keys","key","query","buildQuery","payload","useEstimatedCount","length","disableIndexHints","hint","_id","result","estimatedDocumentCount","session","countDocuments","totalDocs"],"mappings":"AAGA,SAASA,uBAAuB,QAAQ,UAAS;AAIjD,SAASC,WAAW,QAAQ,mBAAkB;AAE9C,OAAO,MAAMC,sBAA2C,eAAeA,oBAErE,EAAEC,MAAM,EAAEC,MAAM,EAAEC,MAAM,CAAC,CAAmB,EAAEC,KAAK,EAAE;IAErD,MAAMC,QAAQ,IAAI,CAACC,QAAQ,CAACL,OAAO;IACnC,MAAMM,UAAwB,MAAMR,YAAY,IAAI,EAAEI;IAEtD,IAAIK,oBAAoB;IAExB,IAAIJ,OAAO;QACT,MAAMK,cAAcX,wBAAwBM;QAC5CI,oBAAoBC,YAAYC,IAAI,CAAC,CAACC,OAASC,OAAOC,IAAI,CAACF,MAAMD,IAAI,CAAC,CAACI,MAAQA,QAAQ;IACzF;IAEA,MAAMC,QAAQ,MAAMV,MAAMW,UAAU,CAAC;QACnCd;QACAe,SAAS,IAAI,CAACA,OAAO;QACrBb;IACF;IAEA,4HAA4H;IAC5H,MAAMc,oBAAoBV,qBAAqB,CAACO,SAASH,OAAOC,IAAI,CAACE,OAAOI,MAAM,KAAK;IAEvF,IAAI,CAACD,qBAAqBN,OAAOC,IAAI,CAACE,OAAOI,MAAM,KAAK,KAAK,IAAI,CAACC,iBAAiB,KAAK,MAAM;QAC5F,mHAAmH;QACnH,qHAAqH;QACrH,mHAAmH;QACnH,4BAA4B;QAC5Bb,QAAQc,IAAI,GAAG;YACbC,KAAK;QACP;IACF;IAEA,IAAIC;IACJ,IAAIL,mBAAmB;QACrBK,SAAS,MAAMlB,MAAMmB,sBAAsB,CAAC;YAAEC,SAASlB,QAAQkB,OAAO;QAAC;IACzE,OAAO;QACLF,SAAS,MAAMlB,MAAMqB,cAAc,CAACX,OAAOR;IAC7C;IAEA,OAAO;QACLoB,WAAWJ;IACb;AACF,EAAC"}
1
+ {"version":3,"sources":["../src/countGlobalVersions.ts"],"sourcesContent":["import type { CountOptions } from 'mongodb'\nimport type { CountGlobalVersions, PayloadRequest } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { getSession } from './getSession.js'\nimport { getHasNearConstraint } from './utilities/getHasNearConstraint.js'\n\nexport const countGlobalVersions: CountGlobalVersions = async function countGlobalVersions(\n this: MongooseAdapter,\n { global, locale, req = {} as PayloadRequest, where },\n) {\n const Model = this.versions[global]\n const session = await getSession(this, req)\n\n const hasNearConstraint = getHasNearConstraint(where)\n\n const query = await Model.buildQuery({\n locale,\n payload: this.payload,\n session,\n where,\n })\n\n // useEstimatedCount is faster, but not accurate, as it ignores any filters. It is thus set to true if there are no filters.\n const useEstimatedCount = hasNearConstraint || !query || Object.keys(query).length === 0\n\n let result: number\n if (useEstimatedCount) {\n result = await Model.collection.estimatedDocumentCount()\n } else {\n const options: CountOptions = { session }\n\n if (Object.keys(query).length === 0 && this.disableIndexHints !== true) {\n // Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding\n // a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,\n // which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses\n // the correct indexed field\n options.hint = {\n _id: 1,\n }\n }\n\n result = await Model.collection.countDocuments(query, options)\n }\n\n return {\n totalDocs: result,\n }\n}\n"],"names":["getSession","getHasNearConstraint","countGlobalVersions","global","locale","req","where","Model","versions","session","hasNearConstraint","query","buildQuery","payload","useEstimatedCount","Object","keys","length","result","collection","estimatedDocumentCount","options","disableIndexHints","hint","_id","countDocuments","totalDocs"],"mappings":"AAKA,SAASA,UAAU,QAAQ,kBAAiB;AAC5C,SAASC,oBAAoB,QAAQ,sCAAqC;AAE1E,OAAO,MAAMC,sBAA2C,eAAeA,oBAErE,EAAEC,MAAM,EAAEC,MAAM,EAAEC,MAAM,CAAC,CAAmB,EAAEC,KAAK,EAAE;IAErD,MAAMC,QAAQ,IAAI,CAACC,QAAQ,CAACL,OAAO;IACnC,MAAMM,UAAU,MAAMT,WAAW,IAAI,EAAEK;IAEvC,MAAMK,oBAAoBT,qBAAqBK;IAE/C,MAAMK,QAAQ,MAAMJ,MAAMK,UAAU,CAAC;QACnCR;QACAS,SAAS,IAAI,CAACA,OAAO;QACrBJ;QACAH;IACF;IAEA,4HAA4H;IAC5H,MAAMQ,oBAAoBJ,qBAAqB,CAACC,SAASI,OAAOC,IAAI,CAACL,OAAOM,MAAM,KAAK;IAEvF,IAAIC;IACJ,IAAIJ,mBAAmB;QACrBI,SAAS,MAAMX,MAAMY,UAAU,CAACC,sBAAsB;IACxD,OAAO;QACL,MAAMC,UAAwB;YAAEZ;QAAQ;QAExC,IAAIM,OAAOC,IAAI,CAACL,OAAOM,MAAM,KAAK,KAAK,IAAI,CAACK,iBAAiB,KAAK,MAAM;YACtE,mHAAmH;YACnH,qHAAqH;YACrH,mHAAmH;YACnH,4BAA4B;YAC5BD,QAAQE,IAAI,GAAG;gBACbC,KAAK;YACP;QACF;QAEAN,SAAS,MAAMX,MAAMY,UAAU,CAACM,cAAc,CAACd,OAAOU;IACxD;IAEA,OAAO;QACLK,WAAWR;IACb;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"countVersions.d.ts","sourceRoot":"","sources":["../src/countVersions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,SAAS,CAAA;AAQ5D,eAAO,MAAM,aAAa,EAAE,aA2C3B,CAAA"}
1
+ {"version":3,"file":"countVersions.d.ts","sourceRoot":"","sources":["../src/countVersions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,SAAS,CAAA;AAO5D,eAAO,MAAM,aAAa,EAAE,aAyC3B,CAAA"}
@@ -1,36 +1,34 @@
1
- import { flattenWhereToOperators } from 'payload';
2
- import { withSession } from './withSession.js';
1
+ import { getSession } from './getSession.js';
2
+ import { getHasNearConstraint } from './utilities/getHasNearConstraint.js';
3
3
  export const countVersions = async function countVersions({ collection, locale, req = {}, where }) {
4
4
  const Model = this.versions[collection];
5
- const options = await withSession(this, req);
6
- let hasNearConstraint = false;
7
- if (where) {
8
- const constraints = flattenWhereToOperators(where);
9
- hasNearConstraint = constraints.some((prop)=>Object.keys(prop).some((key)=>key === 'near'));
10
- }
5
+ const session = await getSession(this, req);
6
+ const hasNearConstraint = getHasNearConstraint(where);
11
7
  const query = await Model.buildQuery({
12
8
  locale,
13
9
  payload: this.payload,
10
+ session,
14
11
  where
15
12
  });
16
13
  // useEstimatedCount is faster, but not accurate, as it ignores any filters. It is thus set to true if there are no filters.
17
14
  const useEstimatedCount = hasNearConstraint || !query || Object.keys(query).length === 0;
18
- if (!useEstimatedCount && Object.keys(query).length === 0 && this.disableIndexHints !== true) {
19
- // Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding
20
- // a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,
21
- // which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses
22
- // the correct indexed field
23
- options.hint = {
24
- _id: 1
25
- };
26
- }
27
15
  let result;
28
16
  if (useEstimatedCount) {
29
- result = await Model.estimatedDocumentCount({
30
- session: options.session
31
- });
17
+ result = await Model.collection.estimatedDocumentCount();
32
18
  } else {
33
- result = await Model.countDocuments(query, options);
19
+ const options = {
20
+ session
21
+ };
22
+ if (this.disableIndexHints !== true) {
23
+ // Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding
24
+ // a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,
25
+ // which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses
26
+ // the correct indexed field
27
+ options.hint = {
28
+ _id: 1
29
+ };
30
+ }
31
+ result = await Model.collection.countDocuments(query, options);
34
32
  }
35
33
  return {
36
34
  totalDocs: result
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/countVersions.ts"],"sourcesContent":["import type { CountOptions } from 'mongodb'\nimport type { CountVersions, PayloadRequest } from 'payload'\n\nimport { flattenWhereToOperators } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { withSession } from './withSession.js'\n\nexport const countVersions: CountVersions = async function countVersions(\n this: MongooseAdapter,\n { collection, locale, req = {} as PayloadRequest, where },\n) {\n const Model = this.versions[collection]\n const options: CountOptions = await withSession(this, req)\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 query = await Model.buildQuery({\n locale,\n payload: this.payload,\n where,\n })\n\n // useEstimatedCount is faster, but not accurate, as it ignores any filters. It is thus set to true if there are no filters.\n const useEstimatedCount = hasNearConstraint || !query || Object.keys(query).length === 0\n\n if (!useEstimatedCount && Object.keys(query).length === 0 && this.disableIndexHints !== true) {\n // Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding\n // a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,\n // which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses\n // the correct indexed field\n options.hint = {\n _id: 1,\n }\n }\n\n let result: number\n if (useEstimatedCount) {\n result = await Model.estimatedDocumentCount({ session: options.session })\n } else {\n result = await Model.countDocuments(query, options)\n }\n\n return {\n totalDocs: result,\n }\n}\n"],"names":["flattenWhereToOperators","withSession","countVersions","collection","locale","req","where","Model","versions","options","hasNearConstraint","constraints","some","prop","Object","keys","key","query","buildQuery","payload","useEstimatedCount","length","disableIndexHints","hint","_id","result","estimatedDocumentCount","session","countDocuments","totalDocs"],"mappings":"AAGA,SAASA,uBAAuB,QAAQ,UAAS;AAIjD,SAASC,WAAW,QAAQ,mBAAkB;AAE9C,OAAO,MAAMC,gBAA+B,eAAeA,cAEzD,EAAEC,UAAU,EAAEC,MAAM,EAAEC,MAAM,CAAC,CAAmB,EAAEC,KAAK,EAAE;IAEzD,MAAMC,QAAQ,IAAI,CAACC,QAAQ,CAACL,WAAW;IACvC,MAAMM,UAAwB,MAAMR,YAAY,IAAI,EAAEI;IAEtD,IAAIK,oBAAoB;IAExB,IAAIJ,OAAO;QACT,MAAMK,cAAcX,wBAAwBM;QAC5CI,oBAAoBC,YAAYC,IAAI,CAAC,CAACC,OAASC,OAAOC,IAAI,CAACF,MAAMD,IAAI,CAAC,CAACI,MAAQA,QAAQ;IACzF;IAEA,MAAMC,QAAQ,MAAMV,MAAMW,UAAU,CAAC;QACnCd;QACAe,SAAS,IAAI,CAACA,OAAO;QACrBb;IACF;IAEA,4HAA4H;IAC5H,MAAMc,oBAAoBV,qBAAqB,CAACO,SAASH,OAAOC,IAAI,CAACE,OAAOI,MAAM,KAAK;IAEvF,IAAI,CAACD,qBAAqBN,OAAOC,IAAI,CAACE,OAAOI,MAAM,KAAK,KAAK,IAAI,CAACC,iBAAiB,KAAK,MAAM;QAC5F,mHAAmH;QACnH,qHAAqH;QACrH,mHAAmH;QACnH,4BAA4B;QAC5Bb,QAAQc,IAAI,GAAG;YACbC,KAAK;QACP;IACF;IAEA,IAAIC;IACJ,IAAIL,mBAAmB;QACrBK,SAAS,MAAMlB,MAAMmB,sBAAsB,CAAC;YAAEC,SAASlB,QAAQkB,OAAO;QAAC;IACzE,OAAO;QACLF,SAAS,MAAMlB,MAAMqB,cAAc,CAACX,OAAOR;IAC7C;IAEA,OAAO;QACLoB,WAAWJ;IACb;AACF,EAAC"}
1
+ {"version":3,"sources":["../src/countVersions.ts"],"sourcesContent":["import type { CountOptions } from 'mongodb'\nimport type { CountVersions, PayloadRequest } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { getSession } from './getSession.js'\nimport { getHasNearConstraint } from './utilities/getHasNearConstraint.js'\n\nexport const countVersions: CountVersions = async function countVersions(\n this: MongooseAdapter,\n { collection, locale, req = {} as PayloadRequest, where },\n) {\n const Model = this.versions[collection]\n const session = await getSession(this, req)\n\n const hasNearConstraint = getHasNearConstraint(where)\n\n const query = await Model.buildQuery({\n locale,\n payload: this.payload,\n session,\n where,\n })\n\n // useEstimatedCount is faster, but not accurate, as it ignores any filters. It is thus set to true if there are no filters.\n const useEstimatedCount = hasNearConstraint || !query || Object.keys(query).length === 0\n\n let result: number\n if (useEstimatedCount) {\n result = await Model.collection.estimatedDocumentCount()\n } else {\n const options: CountOptions = { session }\n\n if (this.disableIndexHints !== true) {\n // Improve the performance of the countDocuments query which is used if useEstimatedCount is set to false by adding\n // a hint. By default, if no hint is provided, MongoDB does not use an indexed field to count the returned documents,\n // which makes queries very slow. This only happens when no query (filter) is provided. If one is provided, it uses\n // the correct indexed field\n options.hint = {\n _id: 1,\n }\n }\n\n result = await Model.collection.countDocuments(query, options)\n }\n\n return {\n totalDocs: result,\n }\n}\n"],"names":["getSession","getHasNearConstraint","countVersions","collection","locale","req","where","Model","versions","session","hasNearConstraint","query","buildQuery","payload","useEstimatedCount","Object","keys","length","result","estimatedDocumentCount","options","disableIndexHints","hint","_id","countDocuments","totalDocs"],"mappings":"AAKA,SAASA,UAAU,QAAQ,kBAAiB;AAC5C,SAASC,oBAAoB,QAAQ,sCAAqC;AAE1E,OAAO,MAAMC,gBAA+B,eAAeA,cAEzD,EAAEC,UAAU,EAAEC,MAAM,EAAEC,MAAM,CAAC,CAAmB,EAAEC,KAAK,EAAE;IAEzD,MAAMC,QAAQ,IAAI,CAACC,QAAQ,CAACL,WAAW;IACvC,MAAMM,UAAU,MAAMT,WAAW,IAAI,EAAEK;IAEvC,MAAMK,oBAAoBT,qBAAqBK;IAE/C,MAAMK,QAAQ,MAAMJ,MAAMK,UAAU,CAAC;QACnCR;QACAS,SAAS,IAAI,CAACA,OAAO;QACrBJ;QACAH;IACF;IAEA,4HAA4H;IAC5H,MAAMQ,oBAAoBJ,qBAAqB,CAACC,SAASI,OAAOC,IAAI,CAACL,OAAOM,MAAM,KAAK;IAEvF,IAAIC;IACJ,IAAIJ,mBAAmB;QACrBI,SAAS,MAAMX,MAAMJ,UAAU,CAACgB,sBAAsB;IACxD,OAAO;QACL,MAAMC,UAAwB;YAAEX;QAAQ;QAExC,IAAI,IAAI,CAACY,iBAAiB,KAAK,MAAM;YACnC,mHAAmH;YACnH,qHAAqH;YACrH,mHAAmH;YACnH,4BAA4B;YAC5BD,QAAQE,IAAI,GAAG;gBACbC,KAAK;YACP;QACF;QAEAL,SAAS,MAAMX,MAAMJ,UAAU,CAACqB,cAAc,CAACb,OAAOS;IACxD;IAEA,OAAO;QACLK,WAAWP;IACb;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAA4B,MAAM,SAAS,CAAA;AAQ/D,eAAO,MAAM,MAAM,EAAE,MAmCpB,CAAA"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,SAAS,CAAA;AAQrD,eAAO,MAAM,MAAM,EAAE,MAmCpB,CAAA"}
package/dist/create.js CHANGED
@@ -1,22 +1,31 @@
1
+ import { getSession } from './getSession.js';
1
2
  import { handleError } from './utilities/handleError.js';
2
- import { sanitizeRelationshipIDs } from './utilities/sanitizeRelationshipIDs.js';
3
- import { withSession } from './withSession.js';
3
+ import { transform } from './utilities/transform.js';
4
4
  export const create = async function create({ collection, data, req = {} }) {
5
5
  const Model = this.collections[collection];
6
- const options = await withSession(this, req);
7
- let doc;
8
- const sanitizedData = sanitizeRelationshipIDs({
9
- config: this.payload.config,
10
- data,
11
- fields: this.payload.collections[collection].config.fields
12
- });
6
+ const session = await getSession(this, req);
7
+ const fields = this.payload.collections[collection].config.flattenedFields;
13
8
  if (this.payload.collections[collection].customIDType) {
14
- sanitizedData._id = sanitizedData.id;
9
+ data._id = data.id;
15
10
  }
11
+ transform({
12
+ adapter: this,
13
+ data,
14
+ fields,
15
+ operation: 'create'
16
+ });
16
17
  try {
17
- [doc] = await Model.create([
18
- sanitizedData
19
- ], options);
18
+ const { insertedId } = await Model.collection.insertOne(data, {
19
+ session
20
+ });
21
+ data._id = insertedId;
22
+ transform({
23
+ adapter: this,
24
+ data,
25
+ fields,
26
+ operation: 'read'
27
+ });
28
+ return data;
20
29
  } catch (error) {
21
30
  handleError({
22
31
  collection,
@@ -24,15 +33,6 @@ export const create = async function create({ collection, data, req = {} }) {
24
33
  req
25
34
  });
26
35
  }
27
- // doc.toJSON does not do stuff like converting ObjectIds to string, or date strings to date objects. That's why we use JSON.parse/stringify here
28
- const result = JSON.parse(JSON.stringify(doc));
29
- const verificationToken = doc._verificationToken;
30
- // custom id type reset
31
- result.id = result._id;
32
- if (verificationToken) {
33
- result._verificationToken = verificationToken;
34
- }
35
- return result;
36
36
  };
37
37
 
38
38
  //# sourceMappingURL=create.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/create.ts"],"sourcesContent":["import type { Create, Document, PayloadRequest } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { handleError } from './utilities/handleError.js'\nimport { sanitizeRelationshipIDs } from './utilities/sanitizeRelationshipIDs.js'\nimport { withSession } from './withSession.js'\n\nexport const create: Create = async function create(\n this: MongooseAdapter,\n { collection, data, req = {} as PayloadRequest },\n) {\n const Model = this.collections[collection]\n const options = await withSession(this, req)\n let doc\n\n const sanitizedData = sanitizeRelationshipIDs({\n config: this.payload.config,\n data,\n fields: this.payload.collections[collection].config.fields,\n })\n\n if (this.payload.collections[collection].customIDType) {\n sanitizedData._id = sanitizedData.id\n }\n\n try {\n ;[doc] = await Model.create([sanitizedData], options)\n } catch (error) {\n handleError({ collection, error, req })\n }\n\n // doc.toJSON does not do stuff like converting ObjectIds to string, or date strings to date objects. That's why we use JSON.parse/stringify here\n const result: Document = JSON.parse(JSON.stringify(doc))\n const verificationToken = doc._verificationToken\n\n // custom id type reset\n result.id = result._id\n if (verificationToken) {\n result._verificationToken = verificationToken\n }\n\n return result\n}\n"],"names":["handleError","sanitizeRelationshipIDs","withSession","create","collection","data","req","Model","collections","options","doc","sanitizedData","config","payload","fields","customIDType","_id","id","error","result","JSON","parse","stringify","verificationToken","_verificationToken"],"mappings":"AAIA,SAASA,WAAW,QAAQ,6BAA4B;AACxD,SAASC,uBAAuB,QAAQ,yCAAwC;AAChF,SAASC,WAAW,QAAQ,mBAAkB;AAE9C,OAAO,MAAMC,SAAiB,eAAeA,OAE3C,EAAEC,UAAU,EAAEC,IAAI,EAAEC,MAAM,CAAC,CAAmB,EAAE;IAEhD,MAAMC,QAAQ,IAAI,CAACC,WAAW,CAACJ,WAAW;IAC1C,MAAMK,UAAU,MAAMP,YAAY,IAAI,EAAEI;IACxC,IAAII;IAEJ,MAAMC,gBAAgBV,wBAAwB;QAC5CW,QAAQ,IAAI,CAACC,OAAO,CAACD,MAAM;QAC3BP;QACAS,QAAQ,IAAI,CAACD,OAAO,CAACL,WAAW,CAACJ,WAAW,CAACQ,MAAM,CAACE,MAAM;IAC5D;IAEA,IAAI,IAAI,CAACD,OAAO,CAACL,WAAW,CAACJ,WAAW,CAACW,YAAY,EAAE;QACrDJ,cAAcK,GAAG,GAAGL,cAAcM,EAAE;IACtC;IAEA,IAAI;QACD,CAACP,IAAI,GAAG,MAAMH,MAAMJ,MAAM,CAAC;YAACQ;SAAc,EAAEF;IAC/C,EAAE,OAAOS,OAAO;QACdlB,YAAY;YAAEI;YAAYc;YAAOZ;QAAI;IACvC;IAEA,iJAAiJ;IACjJ,MAAMa,SAAmBC,KAAKC,KAAK,CAACD,KAAKE,SAAS,CAACZ;IACnD,MAAMa,oBAAoBb,IAAIc,kBAAkB;IAEhD,uBAAuB;IACvBL,OAAOF,EAAE,GAAGE,OAAOH,GAAG;IACtB,IAAIO,mBAAmB;QACrBJ,OAAOK,kBAAkB,GAAGD;IAC9B;IAEA,OAAOJ;AACT,EAAC"}
1
+ {"version":3,"sources":["../src/create.ts"],"sourcesContent":["import type { Create, PayloadRequest } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { getSession } from './getSession.js'\nimport { handleError } from './utilities/handleError.js'\nimport { transform } from './utilities/transform.js'\n\nexport const create: Create = async function create(\n this: MongooseAdapter,\n { collection, data, req = {} as PayloadRequest },\n) {\n const Model = this.collections[collection]\n const session = await getSession(this, req)\n\n const fields = this.payload.collections[collection].config.flattenedFields\n\n if (this.payload.collections[collection].customIDType) {\n data._id = data.id\n }\n\n transform({\n adapter: this,\n data,\n fields,\n operation: 'create',\n })\n\n try {\n const { insertedId } = await Model.collection.insertOne(data, { session })\n data._id = insertedId\n\n transform({\n adapter: this,\n data,\n fields,\n operation: 'read',\n })\n\n return data\n } catch (error) {\n handleError({ collection, error, req })\n }\n}\n"],"names":["getSession","handleError","transform","create","collection","data","req","Model","collections","session","fields","payload","config","flattenedFields","customIDType","_id","id","adapter","operation","insertedId","insertOne","error"],"mappings":"AAIA,SAASA,UAAU,QAAQ,kBAAiB;AAC5C,SAASC,WAAW,QAAQ,6BAA4B;AACxD,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,SAAiB,eAAeA,OAE3C,EAAEC,UAAU,EAAEC,IAAI,EAAEC,MAAM,CAAC,CAAmB,EAAE;IAEhD,MAAMC,QAAQ,IAAI,CAACC,WAAW,CAACJ,WAAW;IAC1C,MAAMK,UAAU,MAAMT,WAAW,IAAI,EAAEM;IAEvC,MAAMI,SAAS,IAAI,CAACC,OAAO,CAACH,WAAW,CAACJ,WAAW,CAACQ,MAAM,CAACC,eAAe;IAE1E,IAAI,IAAI,CAACF,OAAO,CAACH,WAAW,CAACJ,WAAW,CAACU,YAAY,EAAE;QACrDT,KAAKU,GAAG,GAAGV,KAAKW,EAAE;IACpB;IAEAd,UAAU;QACRe,SAAS,IAAI;QACbZ;QACAK;QACAQ,WAAW;IACb;IAEA,IAAI;QACF,MAAM,EAAEC,UAAU,EAAE,GAAG,MAAMZ,MAAMH,UAAU,CAACgB,SAAS,CAACf,MAAM;YAAEI;QAAQ;QACxEJ,KAAKU,GAAG,GAAGI;QAEXjB,UAAU;YACRe,SAAS,IAAI;YACbZ;YACAK;YACAQ,WAAW;QACb;QAEA,OAAOb;IACT,EAAE,OAAOgB,OAAO;QACdpB,YAAY;YAAEG;YAAYiB;YAAOf;QAAI;IACvC;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"createGlobal.d.ts","sourceRoot":"","sources":["../src/createGlobal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,SAAS,CAAA;AAQ3D,eAAO,MAAM,YAAY,EAAE,YA0B1B,CAAA"}
1
+ {"version":3,"file":"createGlobal.d.ts","sourceRoot":"","sources":["../src/createGlobal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,SAAS,CAAA;AAO3D,eAAO,MAAM,YAAY,EAAE,YA+B1B,CAAA"}
@@ -1,25 +1,27 @@
1
- import { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js';
2
- import { sanitizeRelationshipIDs } from './utilities/sanitizeRelationshipIDs.js';
3
- import { withSession } from './withSession.js';
1
+ import { getSession } from './getSession.js';
2
+ import { transform } from './utilities/transform.js';
4
3
  export const createGlobal = async function createGlobal({ slug, data, req = {} }) {
5
4
  const Model = this.globals;
6
- const global = sanitizeRelationshipIDs({
7
- config: this.payload.config,
8
- data: {
9
- globalType: slug,
10
- ...data
11
- },
12
- fields: this.payload.config.globals.find((globalConfig)=>globalConfig.slug === slug).fields
5
+ const fields = this.payload.config.globals.find((globalConfig)=>globalConfig.slug === slug).flattenedFields;
6
+ transform({
7
+ adapter: this,
8
+ data,
9
+ fields,
10
+ globalSlug: slug,
11
+ operation: 'create'
13
12
  });
14
- const options = await withSession(this, req);
15
- let [result] = await Model.create([
16
- global
17
- ], options);
18
- result = JSON.parse(JSON.stringify(result));
19
- // custom id type reset
20
- result.id = result._id;
21
- result = sanitizeInternalFields(result);
22
- return result;
13
+ const session = await getSession(this, req);
14
+ const { insertedId } = await Model.collection.insertOne(data, {
15
+ session
16
+ });
17
+ data._id = insertedId;
18
+ transform({
19
+ adapter: this,
20
+ data,
21
+ fields,
22
+ operation: 'read'
23
+ });
24
+ return data;
23
25
  };
24
26
 
25
27
  //# sourceMappingURL=createGlobal.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/createGlobal.ts"],"sourcesContent":["import type { CreateGlobal, PayloadRequest } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { sanitizeInternalFields } from './utilities/sanitizeInternalFields.js'\nimport { sanitizeRelationshipIDs } from './utilities/sanitizeRelationshipIDs.js'\nimport { withSession } from './withSession.js'\n\nexport const createGlobal: CreateGlobal = async function createGlobal(\n this: MongooseAdapter,\n { slug, data, req = {} as PayloadRequest },\n) {\n const Model = this.globals\n\n const global = sanitizeRelationshipIDs({\n config: this.payload.config,\n data: {\n globalType: slug,\n ...data,\n },\n fields: this.payload.config.globals.find((globalConfig) => globalConfig.slug === slug).fields,\n })\n\n const options = await withSession(this, req)\n\n let [result] = (await Model.create([global], options)) as any\n\n result = JSON.parse(JSON.stringify(result))\n\n // custom id type reset\n result.id = result._id\n result = sanitizeInternalFields(result)\n\n return result\n}\n"],"names":["sanitizeInternalFields","sanitizeRelationshipIDs","withSession","createGlobal","slug","data","req","Model","globals","global","config","payload","globalType","fields","find","globalConfig","options","result","create","JSON","parse","stringify","id","_id"],"mappings":"AAIA,SAASA,sBAAsB,QAAQ,wCAAuC;AAC9E,SAASC,uBAAuB,QAAQ,yCAAwC;AAChF,SAASC,WAAW,QAAQ,mBAAkB;AAE9C,OAAO,MAAMC,eAA6B,eAAeA,aAEvD,EAAEC,IAAI,EAAEC,IAAI,EAAEC,MAAM,CAAC,CAAmB,EAAE;IAE1C,MAAMC,QAAQ,IAAI,CAACC,OAAO;IAE1B,MAAMC,SAASR,wBAAwB;QACrCS,QAAQ,IAAI,CAACC,OAAO,CAACD,MAAM;QAC3BL,MAAM;YACJO,YAAYR;YACZ,GAAGC,IAAI;QACT;QACAQ,QAAQ,IAAI,CAACF,OAAO,CAACD,MAAM,CAACF,OAAO,CAACM,IAAI,CAAC,CAACC,eAAiBA,aAAaX,IAAI,KAAKA,MAAMS,MAAM;IAC/F;IAEA,MAAMG,UAAU,MAAMd,YAAY,IAAI,EAAEI;IAExC,IAAI,CAACW,OAAO,GAAI,MAAMV,MAAMW,MAAM,CAAC;QAACT;KAAO,EAAEO;IAE7CC,SAASE,KAAKC,KAAK,CAACD,KAAKE,SAAS,CAACJ;IAEnC,uBAAuB;IACvBA,OAAOK,EAAE,GAAGL,OAAOM,GAAG;IACtBN,SAASjB,uBAAuBiB;IAEhC,OAAOA;AACT,EAAC"}
1
+ {"version":3,"sources":["../src/createGlobal.ts"],"sourcesContent":["import type { CreateGlobal, PayloadRequest } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { getSession } from './getSession.js'\nimport { transform } from './utilities/transform.js'\n\nexport const createGlobal: CreateGlobal = async function createGlobal(\n this: MongooseAdapter,\n { slug, data, req = {} as PayloadRequest },\n) {\n const Model = this.globals\n\n const fields = this.payload.config.globals.find(\n (globalConfig) => globalConfig.slug === slug,\n ).flattenedFields\n\n transform({\n adapter: this,\n data,\n fields,\n globalSlug: slug,\n operation: 'create',\n })\n\n const session = await getSession(this, req)\n\n const { insertedId } = await Model.collection.insertOne(data, { session })\n ;(data as any)._id = insertedId\n\n transform({\n adapter: this,\n data,\n fields,\n operation: 'read',\n })\n\n return data\n}\n"],"names":["getSession","transform","createGlobal","slug","data","req","Model","globals","fields","payload","config","find","globalConfig","flattenedFields","adapter","globalSlug","operation","session","insertedId","collection","insertOne","_id"],"mappings":"AAIA,SAASA,UAAU,QAAQ,kBAAiB;AAC5C,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,eAA6B,eAAeA,aAEvD,EAAEC,IAAI,EAAEC,IAAI,EAAEC,MAAM,CAAC,CAAmB,EAAE;IAE1C,MAAMC,QAAQ,IAAI,CAACC,OAAO;IAE1B,MAAMC,SAAS,IAAI,CAACC,OAAO,CAACC,MAAM,CAACH,OAAO,CAACI,IAAI,CAC7C,CAACC,eAAiBA,aAAaT,IAAI,KAAKA,MACxCU,eAAe;IAEjBZ,UAAU;QACRa,SAAS,IAAI;QACbV;QACAI;QACAO,YAAYZ;QACZa,WAAW;IACb;IAEA,MAAMC,UAAU,MAAMjB,WAAW,IAAI,EAAEK;IAEvC,MAAM,EAAEa,UAAU,EAAE,GAAG,MAAMZ,MAAMa,UAAU,CAACC,SAAS,CAAChB,MAAM;QAAEa;IAAQ;IACtEb,KAAaiB,GAAG,GAAGH;IAErBjB,UAAU;QACRa,SAAS,IAAI;QACbV;QACAI;QACAQ,WAAW;IACb;IAEA,OAAOZ;AACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"createGlobalVersion.d.ts","sourceRoot":"","sources":["../src/createGlobalVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EAGzB,MAAM,SAAS,CAAA;AAOhB,eAAO,MAAM,mBAAmB,EAAE,mBAsEjC,CAAA"}
1
+ {"version":3,"file":"createGlobalVersion.d.ts","sourceRoot":"","sources":["../src/createGlobalVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,mBAAmB,EAAuB,MAAM,SAAS,CAAA;AAOjG,eAAO,MAAM,mBAAmB,EAAE,mBA4EjC,CAAA"}
@@ -1,31 +1,35 @@
1
1
  import { buildVersionGlobalFields } from 'payload';
2
- import { sanitizeRelationshipIDs } from './utilities/sanitizeRelationshipIDs.js';
3
- import { withSession } from './withSession.js';
2
+ import { getSession } from './getSession.js';
3
+ import { transform } from './utilities/transform.js';
4
4
  export const createGlobalVersion = async function createGlobalVersion({ autosave, createdAt, globalSlug, parent, publishedLocale, req = {}, snapshot, updatedAt, versionData }) {
5
5
  const VersionModel = this.versions[globalSlug];
6
- const options = await withSession(this, req);
7
- const data = sanitizeRelationshipIDs({
8
- config: this.payload.config,
9
- data: {
10
- autosave,
11
- createdAt,
12
- latest: true,
13
- parent,
14
- publishedLocale,
15
- snapshot,
16
- updatedAt,
17
- version: versionData
18
- },
19
- fields: buildVersionGlobalFields(this.payload.config, this.payload.config.globals.find((global)=>global.slug === globalSlug))
6
+ const session = await getSession(this, req);
7
+ const data = {
8
+ autosave,
9
+ createdAt,
10
+ latest: true,
11
+ parent,
12
+ publishedLocale,
13
+ snapshot,
14
+ updatedAt,
15
+ version: versionData
16
+ };
17
+ const fields = buildVersionGlobalFields(this.payload.config, this.payload.config.globals.find((global)=>global.slug === globalSlug), true);
18
+ transform({
19
+ adapter: this,
20
+ data,
21
+ fields,
22
+ operation: 'create'
20
23
  });
21
- const [doc] = await VersionModel.create([
22
- data
23
- ], options, req);
24
- await VersionModel.updateMany({
24
+ const { insertedId } = await VersionModel.collection.insertOne(data, {
25
+ session
26
+ });
27
+ data._id = insertedId;
28
+ await VersionModel.collection.updateMany({
25
29
  $and: [
26
30
  {
27
31
  _id: {
28
- $ne: doc._id
32
+ $ne: insertedId
29
33
  }
30
34
  },
31
35
  {
@@ -43,15 +47,16 @@ export const createGlobalVersion = async function createGlobalVersion({ autosave
43
47
  $unset: {
44
48
  latest: 1
45
49
  }
46
- }, options);
47
- const result = JSON.parse(JSON.stringify(doc));
48
- const verificationToken = doc._verificationToken;
49
- // custom id type reset
50
- result.id = result._id;
51
- if (verificationToken) {
52
- result._verificationToken = verificationToken;
53
- }
54
- return result;
50
+ }, {
51
+ session
52
+ });
53
+ transform({
54
+ adapter: this,
55
+ data,
56
+ fields,
57
+ operation: 'read'
58
+ });
59
+ return data;
55
60
  };
56
61
 
57
62
  //# sourceMappingURL=createGlobalVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/createGlobalVersion.ts"],"sourcesContent":["import {\n buildVersionGlobalFields,\n type CreateGlobalVersion,\n type Document,\n type PayloadRequest,\n} from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { sanitizeRelationshipIDs } from './utilities/sanitizeRelationshipIDs.js'\nimport { withSession } from './withSession.js'\n\nexport const createGlobalVersion: CreateGlobalVersion = async function createGlobalVersion(\n this: MongooseAdapter,\n {\n autosave,\n createdAt,\n globalSlug,\n parent,\n publishedLocale,\n req = {} as PayloadRequest,\n snapshot,\n updatedAt,\n versionData,\n },\n) {\n const VersionModel = this.versions[globalSlug]\n const options = await withSession(this, req)\n\n const data = sanitizeRelationshipIDs({\n config: this.payload.config,\n data: {\n autosave,\n createdAt,\n latest: true,\n parent,\n publishedLocale,\n snapshot,\n updatedAt,\n version: versionData,\n },\n fields: buildVersionGlobalFields(\n this.payload.config,\n this.payload.config.globals.find((global) => global.slug === globalSlug),\n ),\n })\n\n const [doc] = await VersionModel.create([data], options, req)\n\n await VersionModel.updateMany(\n {\n $and: [\n {\n _id: {\n $ne: doc._id,\n },\n },\n {\n parent: {\n $eq: parent,\n },\n },\n {\n latest: {\n $eq: true,\n },\n },\n ],\n },\n { $unset: { latest: 1 } },\n options,\n )\n\n const result: Document = JSON.parse(JSON.stringify(doc))\n const verificationToken = doc._verificationToken\n\n // custom id type reset\n result.id = result._id\n if (verificationToken) {\n result._verificationToken = verificationToken\n }\n return result\n}\n"],"names":["buildVersionGlobalFields","sanitizeRelationshipIDs","withSession","createGlobalVersion","autosave","createdAt","globalSlug","parent","publishedLocale","req","snapshot","updatedAt","versionData","VersionModel","versions","options","data","config","payload","latest","version","fields","globals","find","global","slug","doc","create","updateMany","$and","_id","$ne","$eq","$unset","result","JSON","parse","stringify","verificationToken","_verificationToken","id"],"mappings":"AAAA,SACEA,wBAAwB,QAInB,UAAS;AAIhB,SAASC,uBAAuB,QAAQ,yCAAwC;AAChF,SAASC,WAAW,QAAQ,mBAAkB;AAE9C,OAAO,MAAMC,sBAA2C,eAAeA,oBAErE,EACEC,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,MAAM,EACNC,eAAe,EACfC,MAAM,CAAC,CAAmB,EAC1BC,QAAQ,EACRC,SAAS,EACTC,WAAW,EACZ;IAED,MAAMC,eAAe,IAAI,CAACC,QAAQ,CAACR,WAAW;IAC9C,MAAMS,UAAU,MAAMb,YAAY,IAAI,EAAEO;IAExC,MAAMO,OAAOf,wBAAwB;QACnCgB,QAAQ,IAAI,CAACC,OAAO,CAACD,MAAM;QAC3BD,MAAM;YACJZ;YACAC;YACAc,QAAQ;YACRZ;YACAC;YACAE;YACAC;YACAS,SAASR;QACX;QACAS,QAAQrB,yBACN,IAAI,CAACkB,OAAO,CAACD,MAAM,EACnB,IAAI,CAACC,OAAO,CAACD,MAAM,CAACK,OAAO,CAACC,IAAI,CAAC,CAACC,SAAWA,OAAOC,IAAI,KAAKnB;IAEjE;IAEA,MAAM,CAACoB,IAAI,GAAG,MAAMb,aAAac,MAAM,CAAC;QAACX;KAAK,EAAED,SAASN;IAEzD,MAAMI,aAAae,UAAU,CAC3B;QACEC,MAAM;YACJ;gBACEC,KAAK;oBACHC,KAAKL,IAAII,GAAG;gBACd;YACF;YACA;gBACEvB,QAAQ;oBACNyB,KAAKzB;gBACP;YACF;YACA;gBACEY,QAAQ;oBACNa,KAAK;gBACP;YACF;SACD;IACH,GACA;QAAEC,QAAQ;YAAEd,QAAQ;QAAE;IAAE,GACxBJ;IAGF,MAAMmB,SAAmBC,KAAKC,KAAK,CAACD,KAAKE,SAAS,CAACX;IACnD,MAAMY,oBAAoBZ,IAAIa,kBAAkB;IAEhD,uBAAuB;IACvBL,OAAOM,EAAE,GAAGN,OAAOJ,GAAG;IACtB,IAAIQ,mBAAmB;QACrBJ,OAAOK,kBAAkB,GAAGD;IAC9B;IACA,OAAOJ;AACT,EAAC"}
1
+ {"version":3,"sources":["../src/createGlobalVersion.ts"],"sourcesContent":["import { buildVersionGlobalFields, type CreateGlobalVersion, type PayloadRequest } from 'payload'\n\nimport type { MongooseAdapter } from './index.js'\n\nimport { getSession } from './getSession.js'\nimport { transform } from './utilities/transform.js'\n\nexport const createGlobalVersion: CreateGlobalVersion = async function createGlobalVersion(\n this: MongooseAdapter,\n {\n autosave,\n createdAt,\n globalSlug,\n parent,\n publishedLocale,\n req = {} as PayloadRequest,\n snapshot,\n updatedAt,\n versionData,\n },\n) {\n const VersionModel = this.versions[globalSlug]\n const session = await getSession(this, req)\n\n const data = {\n autosave,\n createdAt,\n latest: true,\n parent,\n publishedLocale,\n snapshot,\n updatedAt,\n version: versionData,\n }\n\n const fields = buildVersionGlobalFields(\n this.payload.config,\n this.payload.config.globals.find((global) => global.slug === globalSlug),\n true,\n )\n\n transform({\n adapter: this,\n data,\n fields,\n operation: 'create',\n })\n\n const { insertedId } = await VersionModel.collection.insertOne(data, { session })\n ;(data as any)._id = insertedId\n\n await VersionModel.collection.updateMany(\n {\n $and: [\n {\n _id: {\n $ne: insertedId,\n },\n },\n {\n parent: {\n $eq: parent,\n },\n },\n {\n latest: {\n $eq: true,\n },\n },\n ],\n },\n { $unset: { latest: 1 } },\n { session },\n )\n\n transform({\n adapter: this,\n data,\n fields,\n operation: 'read',\n })\n\n return data as any\n}\n"],"names":["buildVersionGlobalFields","getSession","transform","createGlobalVersion","autosave","createdAt","globalSlug","parent","publishedLocale","req","snapshot","updatedAt","versionData","VersionModel","versions","session","data","latest","version","fields","payload","config","globals","find","global","slug","adapter","operation","insertedId","collection","insertOne","_id","updateMany","$and","$ne","$eq","$unset"],"mappings":"AAAA,SAASA,wBAAwB,QAAuD,UAAS;AAIjG,SAASC,UAAU,QAAQ,kBAAiB;AAC5C,SAASC,SAAS,QAAQ,2BAA0B;AAEpD,OAAO,MAAMC,sBAA2C,eAAeA,oBAErE,EACEC,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,MAAM,EACNC,eAAe,EACfC,MAAM,CAAC,CAAmB,EAC1BC,QAAQ,EACRC,SAAS,EACTC,WAAW,EACZ;IAED,MAAMC,eAAe,IAAI,CAACC,QAAQ,CAACR,WAAW;IAC9C,MAAMS,UAAU,MAAMd,WAAW,IAAI,EAAEQ;IAEvC,MAAMO,OAAO;QACXZ;QACAC;QACAY,QAAQ;QACRV;QACAC;QACAE;QACAC;QACAO,SAASN;IACX;IAEA,MAAMO,SAASnB,yBACb,IAAI,CAACoB,OAAO,CAACC,MAAM,EACnB,IAAI,CAACD,OAAO,CAACC,MAAM,CAACC,OAAO,CAACC,IAAI,CAAC,CAACC,SAAWA,OAAOC,IAAI,KAAKnB,aAC7D;IAGFJ,UAAU;QACRwB,SAAS,IAAI;QACbV;QACAG;QACAQ,WAAW;IACb;IAEA,MAAM,EAAEC,UAAU,EAAE,GAAG,MAAMf,aAAagB,UAAU,CAACC,SAAS,CAACd,MAAM;QAAED;IAAQ;IAC7EC,KAAae,GAAG,GAAGH;IAErB,MAAMf,aAAagB,UAAU,CAACG,UAAU,CACtC;QACEC,MAAM;YACJ;gBACEF,KAAK;oBACHG,KAAKN;gBACP;YACF;YACA;gBACErB,QAAQ;oBACN4B,KAAK5B;gBACP;YACF;YACA;gBACEU,QAAQ;oBACNkB,KAAK;gBACP;YACF;SACD;IACH,GACA;QAAEC,QAAQ;YAAEnB,QAAQ;QAAE;IAAE,GACxB;QAAEF;IAAQ;IAGZb,UAAU;QACRwB,SAAS,IAAI;QACbV;QACAG;QACAQ,WAAW;IACb;IAEA,OAAOX;AACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"createVersion.d.ts","sourceRoot":"","sources":["../src/createVersion.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,aAAa,EAGnB,MAAM,SAAS,CAAA;AAOhB,eAAO,MAAM,aAAa,EAAE,aAmF3B,CAAA"}
1
+ {"version":3,"file":"createVersion.d.ts","sourceRoot":"","sources":["../src/createVersion.ts"],"names":[],"mappings":"AACA,OAAO,EAAgC,KAAK,aAAa,EAAuB,MAAM,SAAS,CAAA;AAO/F,eAAO,MAAM,aAAa,EAAE,aAyF3B,CAAA"}