payload 3.71.1 → 3.72.0-internal.3e70d4c

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 (151) hide show
  1. package/dist/collections/config/sanitize.d.ts.map +1 -1
  2. package/dist/collections/config/sanitize.js +19 -4
  3. package/dist/collections/config/sanitize.js.map +1 -1
  4. package/dist/collections/endpoints/create.d.ts.map +1 -1
  5. package/dist/collections/endpoints/create.js +2 -1
  6. package/dist/collections/endpoints/create.js.map +1 -1
  7. package/dist/collections/endpoints/update.d.ts.map +1 -1
  8. package/dist/collections/endpoints/update.js +3 -1
  9. package/dist/collections/endpoints/update.js.map +1 -1
  10. package/dist/collections/endpoints/updateByID.d.ts.map +1 -1
  11. package/dist/collections/endpoints/updateByID.js +4 -2
  12. package/dist/collections/endpoints/updateByID.js.map +1 -1
  13. package/dist/collections/operations/create.d.ts +1 -0
  14. package/dist/collections/operations/create.d.ts.map +1 -1
  15. package/dist/collections/operations/create.js +23 -3
  16. package/dist/collections/operations/create.js.map +1 -1
  17. package/dist/collections/operations/local/create.d.ts +4 -0
  18. package/dist/collections/operations/local/create.d.ts.map +1 -1
  19. package/dist/collections/operations/local/create.js +2 -1
  20. package/dist/collections/operations/local/create.js.map +1 -1
  21. package/dist/collections/operations/local/update.d.ts +12 -0
  22. package/dist/collections/operations/local/update.d.ts.map +1 -1
  23. package/dist/collections/operations/local/update.js +3 -1
  24. package/dist/collections/operations/local/update.js.map +1 -1
  25. package/dist/collections/operations/update.d.ts +2 -0
  26. package/dist/collections/operations/update.d.ts.map +1 -1
  27. package/dist/collections/operations/update.js +4 -3
  28. package/dist/collections/operations/update.js.map +1 -1
  29. package/dist/collections/operations/updateByID.d.ts +2 -0
  30. package/dist/collections/operations/updateByID.d.ts.map +1 -1
  31. package/dist/collections/operations/updateByID.js +4 -3
  32. package/dist/collections/operations/updateByID.js.map +1 -1
  33. package/dist/collections/operations/utilities/update.d.ts +4 -3
  34. package/dist/collections/operations/utilities/update.d.ts.map +1 -1
  35. package/dist/collections/operations/utilities/update.js +81 -31
  36. package/dist/collections/operations/utilities/update.js.map +1 -1
  37. package/dist/config/types.d.ts +16 -0
  38. package/dist/config/types.d.ts.map +1 -1
  39. package/dist/config/types.js.map +1 -1
  40. package/dist/database/migrations/templates/localizeStatus.d.ts +10 -0
  41. package/dist/database/migrations/templates/localizeStatus.d.ts.map +1 -0
  42. package/dist/database/migrations/templates/localizeStatus.js +54 -0
  43. package/dist/database/migrations/templates/localizeStatus.js.map +1 -0
  44. package/dist/exports/migrations.d.ts +19 -0
  45. package/dist/exports/migrations.d.ts.map +1 -0
  46. package/dist/exports/migrations.js +19 -0
  47. package/dist/exports/migrations.js.map +1 -0
  48. package/dist/exports/shared.d.ts +1 -1
  49. package/dist/exports/shared.d.ts.map +1 -1
  50. package/dist/exports/shared.js +1 -1
  51. package/dist/exports/shared.js.map +1 -1
  52. package/dist/globals/config/sanitize.d.ts.map +1 -1
  53. package/dist/globals/config/sanitize.js +11 -1
  54. package/dist/globals/config/sanitize.js.map +1 -1
  55. package/dist/globals/endpoints/update.d.ts.map +1 -1
  56. package/dist/globals/endpoints/update.js +5 -1
  57. package/dist/globals/endpoints/update.js.map +1 -1
  58. package/dist/globals/operations/local/update.d.ts +10 -0
  59. package/dist/globals/operations/local/update.d.ts.map +1 -1
  60. package/dist/globals/operations/local/update.js +4 -2
  61. package/dist/globals/operations/local/update.js.map +1 -1
  62. package/dist/globals/operations/update.d.ts +2 -0
  63. package/dist/globals/operations/update.d.ts.map +1 -1
  64. package/dist/globals/operations/update.js +63 -15
  65. package/dist/globals/operations/update.js.map +1 -1
  66. package/dist/index.bundled.d.ts +102 -3
  67. package/dist/index.d.ts +2 -0
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +1 -0
  70. package/dist/index.js.map +1 -1
  71. package/dist/utilities/getVersionsConfig.d.ts +4 -0
  72. package/dist/utilities/getVersionsConfig.d.ts.map +1 -1
  73. package/dist/utilities/getVersionsConfig.js +7 -2
  74. package/dist/utilities/getVersionsConfig.js.map +1 -1
  75. package/dist/utilities/mergeLocalizedData.d.ts +20 -0
  76. package/dist/utilities/mergeLocalizedData.d.ts.map +1 -0
  77. package/dist/utilities/mergeLocalizedData.js +277 -0
  78. package/dist/utilities/mergeLocalizedData.js.map +1 -0
  79. package/dist/utilities/mergeLocalizedData.spec.js +784 -0
  80. package/dist/utilities/mergeLocalizedData.spec.js.map +1 -0
  81. package/dist/utilities/miniChalk.d.ts +15 -0
  82. package/dist/utilities/miniChalk.d.ts.map +1 -0
  83. package/dist/utilities/miniChalk.js +34 -0
  84. package/dist/utilities/miniChalk.js.map +1 -0
  85. package/dist/utilities/parseParams/index.d.ts +24 -20
  86. package/dist/utilities/parseParams/index.d.ts.map +1 -1
  87. package/dist/utilities/parseParams/index.js.map +1 -1
  88. package/dist/utilities/traverseForLocalizedFields.d.ts +3 -0
  89. package/dist/utilities/traverseForLocalizedFields.d.ts.map +1 -0
  90. package/dist/utilities/traverseForLocalizedFields.js +41 -0
  91. package/dist/utilities/traverseForLocalizedFields.js.map +1 -0
  92. package/dist/versions/baseFields.d.ts +3 -1
  93. package/dist/versions/baseFields.d.ts.map +1 -1
  94. package/dist/versions/baseFields.js +16 -15
  95. package/dist/versions/baseFields.js.map +1 -1
  96. package/dist/versions/drafts/replaceWithDraftIfAvailable.d.ts.map +1 -1
  97. package/dist/versions/drafts/replaceWithDraftIfAvailable.js +28 -2
  98. package/dist/versions/drafts/replaceWithDraftIfAvailable.js.map +1 -1
  99. package/dist/versions/migrations/localizeStatus/index.d.ts +12 -0
  100. package/dist/versions/migrations/localizeStatus/index.d.ts.map +1 -0
  101. package/dist/versions/migrations/localizeStatus/index.js +33 -0
  102. package/dist/versions/migrations/localizeStatus/index.js.map +1 -0
  103. package/dist/versions/migrations/localizeStatus/mongo/down.d.ts +9 -0
  104. package/dist/versions/migrations/localizeStatus/mongo/down.d.ts.map +1 -0
  105. package/dist/versions/migrations/localizeStatus/mongo/down.js +112 -0
  106. package/dist/versions/migrations/localizeStatus/mongo/down.js.map +1 -0
  107. package/dist/versions/migrations/localizeStatus/mongo/index.d.ts +8 -0
  108. package/dist/versions/migrations/localizeStatus/mongo/index.d.ts.map +1 -0
  109. package/dist/versions/migrations/localizeStatus/mongo/index.js +8 -0
  110. package/dist/versions/migrations/localizeStatus/mongo/index.js.map +1 -0
  111. package/dist/versions/migrations/localizeStatus/mongo/up.d.ts +9 -0
  112. package/dist/versions/migrations/localizeStatus/mongo/up.d.ts.map +1 -0
  113. package/dist/versions/migrations/localizeStatus/mongo/up.js +220 -0
  114. package/dist/versions/migrations/localizeStatus/mongo/up.js.map +1 -0
  115. package/dist/versions/migrations/localizeStatus/shared.d.ts +59 -0
  116. package/dist/versions/migrations/localizeStatus/shared.d.ts.map +1 -0
  117. package/dist/versions/migrations/localizeStatus/shared.js +122 -0
  118. package/dist/versions/migrations/localizeStatus/shared.js.map +1 -0
  119. package/dist/versions/migrations/localizeStatus/sql/down.d.ts +11 -0
  120. package/dist/versions/migrations/localizeStatus/sql/down.d.ts.map +1 -0
  121. package/dist/versions/migrations/localizeStatus/sql/down.js +213 -0
  122. package/dist/versions/migrations/localizeStatus/sql/down.js.map +1 -0
  123. package/dist/versions/migrations/localizeStatus/sql/index.d.ts +8 -0
  124. package/dist/versions/migrations/localizeStatus/sql/index.d.ts.map +1 -0
  125. package/dist/versions/migrations/localizeStatus/sql/index.js +8 -0
  126. package/dist/versions/migrations/localizeStatus/sql/index.js.map +1 -0
  127. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.d.ts +13 -0
  128. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.d.ts.map +1 -0
  129. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.js +51 -0
  130. package/dist/versions/migrations/localizeStatus/sql/migrateMainCollection.js.map +1 -0
  131. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.d.ts +13 -0
  132. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.d.ts.map +1 -0
  133. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.js +54 -0
  134. package/dist/versions/migrations/localizeStatus/sql/migrateMainGlobal.js.map +1 -0
  135. package/dist/versions/migrations/localizeStatus/sql/up.d.ts +11 -0
  136. package/dist/versions/migrations/localizeStatus/sql/up.d.ts.map +1 -0
  137. package/dist/versions/migrations/localizeStatus/sql/up.js +277 -0
  138. package/dist/versions/migrations/localizeStatus/sql/up.js.map +1 -0
  139. package/dist/versions/saveSnapshot.d.ts.map +1 -1
  140. package/dist/versions/saveSnapshot.js +0 -1
  141. package/dist/versions/saveSnapshot.js.map +1 -1
  142. package/dist/versions/saveVersion.js +0 -3
  143. package/dist/versions/saveVersion.js.map +1 -1
  144. package/dist/versions/types.d.ts +18 -0
  145. package/dist/versions/types.d.ts.map +1 -1
  146. package/dist/versions/types.js.map +1 -1
  147. package/package.json +7 -2
  148. package/dist/uploads/imageResizer.d.ts +0 -40
  149. package/dist/uploads/imageResizer.d.ts.map +0 -1
  150. package/dist/uploads/imageResizer.js +0 -356
  151. package/dist/uploads/imageResizer.js.map +0 -1
@@ -74,8 +74,16 @@ export type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType
74
74
  * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.
75
75
  */
76
76
  populate?: PopulateType;
77
+ /**
78
+ * Publish the document / documents in all locales. Requires `versions.drafts.localizeStatus` to be enabled.
79
+ *
80
+ * @default undefined
81
+ */
82
+ publishAllLocales?: boolean;
77
83
  /**
78
84
  * Publish the document / documents with a specific locale.
85
+ *
86
+ * @default undefined
79
87
  */
80
88
  publishSpecificLocale?: string;
81
89
  /**
@@ -99,6 +107,10 @@ export type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType
99
107
  * @default false
100
108
  */
101
109
  trash?: boolean;
110
+ /**
111
+ * Unpublish the document / documents in all locales. Requires `versions.drafts.localizeStatus` to be enabled.
112
+ */
113
+ unpublishAllLocales?: boolean;
102
114
  /**
103
115
  * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.
104
116
  */
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/local/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,6BAA6B,EAC7B,KAAK,EACN,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,KAAK,EACV,mBAAmB,EACnB,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,uBAAuB,CAAA;AAQ9B,MAAM,MAAM,WAAW,CAAC,KAAK,SAAS,cAAc,EAAE,OAAO,SAAS,UAAU,IAAI;IAClF;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC,8BAA8B,CAAC,KAAK,CAAC,CAAC,CAAA;IACxD;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAA;IACpC;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,CAAA;IACX;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,MAAM,CAAC,E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ACxB,KAAK,SAAS,cAAc,EAC5B,OAAO,SAAS,wBAAwB,CAAC,KAAK,CAAC,EAE/C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AACzD,iBAAe,WAAW,CACxB,KAAK,SAAS,cAAc,EAC5B,OAAO,SAAS,wBAAwB,CAAC,KAAK,CAAC,EAE/C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AAC/C,iBAAe,WAAW,CACxB,KAAK,SAAS,cAAc,EAC5B,OAAO,SAAS,wBAAwB,CAAC,KAAK,CAAC,EAE/C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AA6E/F,OAAO,EAAE,WAAW,EAAE,CAAA"}
@@ -4,7 +4,7 @@ import { createLocalReq } from '../../../utilities/createLocalReq.js';
4
4
  import { updateOperation } from '../update.js';
5
5
  import { updateByIDOperation } from '../updateByID.js';
6
6
  async function updateLocal(payload, options) {
7
- const { id, autosave, collection: collectionSlug, data, depth, disableTransaction, draft, file, filePath, limit, overrideAccess = true, overrideLock, overwriteExistingFiles = false, populate, publishSpecificLocale, select, showHiddenFields, sort, trash = false, where } = options;
7
+ const { id, autosave, collection: collectionSlug, data, depth, disableTransaction, draft, file, filePath, limit, overrideAccess = true, overrideLock, overwriteExistingFiles = false, populate, publishAllLocales, publishSpecificLocale, select, showHiddenFields, sort, trash = false, unpublishAllLocales, where } = options;
8
8
  const collection = payload.collections[collectionSlug];
9
9
  if (!collection) {
10
10
  throw new APIError(`The collection with slug ${String(collectionSlug)} can't be found. Update Operation.`);
@@ -25,12 +25,14 @@ async function updateLocal(payload, options) {
25
25
  overwriteExistingFiles,
26
26
  payload,
27
27
  populate,
28
+ publishAllLocales,
28
29
  publishSpecificLocale,
29
30
  req,
30
31
  select,
31
32
  showHiddenFields,
32
33
  sort,
33
34
  trash,
35
+ unpublishAllLocales,
34
36
  where
35
37
  };
36
38
  if (options.id) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/collections/operations/local/update.ts"],"sourcesContent":["import type { DeepPartial } from 'ts-essentials'\n\nimport type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../../../index.js'\nimport type {\n Document,\n PayloadRequest,\n PopulateType,\n SelectType,\n Sort,\n TransformCollectionWithSelect,\n Where,\n} from '../../../types/index.js'\nimport type { File } from '../../../uploads/types.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type {\n BulkOperationResult,\n RequiredDataFromCollectionSlug,\n SelectFromCollectionSlug,\n} from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { getFileByPath } from '../../../uploads/getFileByPath.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { updateOperation } from '../update.js'\nimport { updateByIDOperation } from '../updateByID.js'\n\nexport type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {\n /**\n * Whether the current update should be marked as from autosave.\n * `versions.drafts.autosave` should be specified.\n */\n autosave?: boolean\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * The document / documents data to update.\n */\n data: DeepPartial<RequiredDataFromCollectionSlug<TSlug>>\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, a [database transactions](https://payloadcms.com/docs/database/transactions) will not be initialized.\n * @default false\n */\n disableTransaction?: boolean\n /**\n * Update documents to a draft.\n */\n draft?: boolean\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * A `File` object when updating a collection with `upload: true`.\n */\n file?: File\n /**\n * A file path when creating a collection with `upload: true`.\n */\n filePath?: string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * By default, document locks are ignored (`true`). Set to `false` to enforce locks and prevent operations when a document is locked by another user. [More details](https://payloadcms.com/docs/admin/locked-documents).\n * @default true\n */\n overrideLock?: boolean\n /**\n * If you are uploading a file and would like to replace\n * the existing file instead of generating a new filename,\n * you can set the following property to `true`\n */\n overwriteExistingFiles?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * Publish the document / documents with a specific locale.\n */\n publishSpecificLocale?: string\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.\n */\n select?: TSelect\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * When set to `true`, the operation will update both normal and trashed (soft-deleted) documents.\n * To update only trashed documents, pass `trash: true` and combine with a `where` clause filtering by `deletedAt`.\n * By default (`false`), the update will only include normal documents and exclude those with a `deletedAt` field.\n * @default false\n */\n trash?: boolean\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n}\n\nexport type ByIDOptions<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = {\n /**\n * The ID of the document to update.\n */\n id: number | string\n /**\n * Limit documents to update\n */\n limit?: never\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-createdAt' // Sort DESC by createdAt\n * @example ['group', '-createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: never\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: never\n} & BaseOptions<TSlug, TSelect>\n\nexport type ManyOptions<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = {\n /**\n * The ID of the document to update.\n */\n id?: never\n /**\n * Limit documents to update\n */\n limit?: number\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-createdAt' // Sort DESC by createdAt\n * @example ['group', '-createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: Sort\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where: Where\n} & BaseOptions<TSlug, TSelect>\n\nexport type Options<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = ByIDOptions<TSlug, TSelect> | ManyOptions<TSlug, TSelect>\n\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: ByIDOptions<TSlug, TSelect>,\n): Promise<TransformCollectionWithSelect<TSlug, TSelect>>\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: ManyOptions<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect>>\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>>\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>> {\n const {\n id,\n autosave,\n collection: collectionSlug,\n data,\n depth,\n disableTransaction,\n draft,\n file,\n filePath,\n limit,\n overrideAccess = true,\n overrideLock,\n overwriteExistingFiles = false,\n populate,\n publishSpecificLocale,\n select,\n showHiddenFields,\n sort,\n trash = false,\n where,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Update Operation.`,\n )\n }\n\n const req = await createLocalReq(options as CreateLocalReqOptions, payload)\n req.file = file ?? (await getFileByPath(filePath!))\n\n const args = {\n id,\n autosave,\n collection,\n data,\n depth,\n disableTransaction,\n draft,\n limit,\n overrideAccess,\n overrideLock,\n overwriteExistingFiles,\n payload,\n populate,\n publishSpecificLocale,\n req,\n select,\n showHiddenFields,\n sort,\n trash,\n where,\n }\n\n if (options.id) {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return updateByIDOperation<TSlug, TSelect>(args)\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return updateOperation<TSlug, TSelect>(args)\n}\n\nexport { updateLocal }\n"],"names":["APIError","getFileByPath","createLocalReq","updateOperation","updateByIDOperation","updateLocal","payload","options","id","autosave","collection","collectionSlug","data","depth","disableTransaction","draft","file","filePath","limit","overrideAccess","overrideLock","overwriteExistingFiles","populate","publishSpecificLocale","select","showHiddenFields","sort","trash","where","collections","String","req","args"],"mappings":"AAoBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,aAAa,QAAQ,oCAAmC;AACjE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,eAAc;AAC9C,SAASC,mBAAmB,QAAQ,mBAAkB;AAkLtD,eAAeC,YAIbC,OAAgB,EAChBC,OAAgC;IAEhC,MAAM,EACJC,EAAE,EACFC,QAAQ,EACRC,YAAYC,cAAc,EAC1BC,IAAI,EACJC,KAAK,EACLC,kBAAkB,EAClBC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,YAAY,EACZC,yBAAyB,KAAK,EAC9BC,QAAQ,EACRC,qBAAqB,EACrBC,MAAM,EACNC,gBAAgB,EAChBC,IAAI,EACJC,QAAQ,KAAK,EACbC,KAAK,EACN,GAAGrB;IAEJ,MAAMG,aAAaJ,QAAQuB,WAAW,CAAClB,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIV,SACR,CAAC,yBAAyB,EAAE8B,OAAOnB,gBAAgB,kCAAkC,CAAC;IAE1F;IAEA,MAAMoB,MAAM,MAAM7B,eAAeK,SAAkCD;IACnEyB,IAAIf,IAAI,GAAGA,QAAS,MAAMf,cAAcgB;IAExC,MAAMe,OAAO;QACXxB;QACAC;QACAC;QACAE;QACAC;QACAC;QACAC;QACAG;QACAC;QACAC;QACAC;QACAf;QACAgB;QACAC;QACAQ;QACAP;QACAC;QACAC;QACAC;QACAC;IACF;IAEA,IAAIrB,QAAQC,EAAE,EAAE;QACd,oFAAoF;QACpF,OAAOJ,oBAAoC4B;IAC7C;IACA,oFAAoF;IACpF,OAAO7B,gBAAgC6B;AACzC;AAEA,SAAS3B,WAAW,GAAE"}
1
+ {"version":3,"sources":["../../../../src/collections/operations/local/update.ts"],"sourcesContent":["import type { DeepPartial } from 'ts-essentials'\n\nimport type { CollectionSlug, Payload, RequestContext, TypedLocale } from '../../../index.js'\nimport type {\n Document,\n PayloadRequest,\n PopulateType,\n SelectType,\n Sort,\n TransformCollectionWithSelect,\n Where,\n} from '../../../types/index.js'\nimport type { File } from '../../../uploads/types.js'\nimport type { CreateLocalReqOptions } from '../../../utilities/createLocalReq.js'\nimport type {\n BulkOperationResult,\n RequiredDataFromCollectionSlug,\n SelectFromCollectionSlug,\n} from '../../config/types.js'\n\nimport { APIError } from '../../../errors/index.js'\nimport { getFileByPath } from '../../../uploads/getFileByPath.js'\nimport { createLocalReq } from '../../../utilities/createLocalReq.js'\nimport { updateOperation } from '../update.js'\nimport { updateByIDOperation } from '../updateByID.js'\n\nexport type BaseOptions<TSlug extends CollectionSlug, TSelect extends SelectType> = {\n /**\n * Whether the current update should be marked as from autosave.\n * `versions.drafts.autosave` should be specified.\n */\n autosave?: boolean\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Context](https://payloadcms.com/docs/hooks/context), which will then be passed to `context` and `req.context`,\n * which can be read by hooks. Useful if you want to pass additional information to the hooks which\n * shouldn't be necessarily part of the document, for example a `triggerBeforeChange` option which can be read by the BeforeChange hook\n * to determine if it should run or not.\n */\n context?: RequestContext\n /**\n * The document / documents data to update.\n */\n data: DeepPartial<RequiredDataFromCollectionSlug<TSlug>>\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * When set to `true`, a [database transactions](https://payloadcms.com/docs/database/transactions) will not be initialized.\n * @default false\n */\n disableTransaction?: boolean\n /**\n * Update documents to a draft.\n */\n draft?: boolean\n /**\n * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.\n */\n fallbackLocale?: false | TypedLocale\n /**\n * A `File` object when updating a collection with `upload: true`.\n */\n file?: File\n /**\n * A file path when creating a collection with `upload: true`.\n */\n filePath?: string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale\n /**\n * Skip access control.\n * Set to `false` if you want to respect Access Control for the operation, for example when fetching data for the front-end.\n * @default true\n */\n overrideAccess?: boolean\n /**\n * By default, document locks are ignored (`true`). Set to `false` to enforce locks and prevent operations when a document is locked by another user. [More details](https://payloadcms.com/docs/admin/locked-documents).\n * @default true\n */\n overrideLock?: boolean\n /**\n * If you are uploading a file and would like to replace\n * the existing file instead of generating a new filename,\n * you can set the following property to `true`\n */\n overwriteExistingFiles?: boolean\n /**\n * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.\n */\n populate?: PopulateType\n /**\n * Publish the document / documents in all locales. Requires `versions.drafts.localizeStatus` to be enabled.\n *\n * @default undefined\n */\n publishAllLocales?: boolean\n /**\n * Publish the document / documents with a specific locale.\n *\n * @default undefined\n */\n publishSpecificLocale?: string\n /**\n * The `PayloadRequest` object. You can pass it to thread the current [transaction](https://payloadcms.com/docs/database/transactions), user and locale to the operation.\n * Recommended to pass when using the Local API from hooks, as usually you want to execute the operation within the current transaction.\n */\n req?: Partial<PayloadRequest>\n /**\n * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.\n */\n select?: TSelect\n /**\n * Opt-in to receiving hidden fields. By default, they are hidden from returned documents in accordance to your config.\n * @default false\n */\n showHiddenFields?: boolean\n /**\n * When set to `true`, the operation will update both normal and trashed (soft-deleted) documents.\n * To update only trashed documents, pass `trash: true` and combine with a `where` clause filtering by `deletedAt`.\n * By default (`false`), the update will only include normal documents and exclude those with a `deletedAt` field.\n * @default false\n */\n trash?: boolean\n /**\n * Unpublish the document / documents in all locales. Requires `versions.drafts.localizeStatus` to be enabled.\n */\n unpublishAllLocales?: boolean\n /**\n * If you set `overrideAccess` to `false`, you can pass a user to use against the access control checks.\n */\n user?: Document\n}\n\nexport type ByIDOptions<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = {\n /**\n * The ID of the document to update.\n */\n id: number | string\n /**\n * Limit documents to update\n */\n limit?: never\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-createdAt' // Sort DESC by createdAt\n * @example ['group', '-createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: never\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: never\n} & BaseOptions<TSlug, TSelect>\n\nexport type ManyOptions<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = {\n /**\n * The ID of the document to update.\n */\n id?: never\n /**\n * Limit documents to update\n */\n limit?: number\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-createdAt' // Sort DESC by createdAt\n * @example ['group', '-createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: Sort\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where: Where\n} & BaseOptions<TSlug, TSelect>\n\nexport type Options<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n> = ByIDOptions<TSlug, TSelect> | ManyOptions<TSlug, TSelect>\n\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: ByIDOptions<TSlug, TSelect>,\n): Promise<TransformCollectionWithSelect<TSlug, TSelect>>\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: ManyOptions<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect>>\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>>\nasync function updateLocal<\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n payload: Payload,\n options: Options<TSlug, TSelect>,\n): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>> {\n const {\n id,\n autosave,\n collection: collectionSlug,\n data,\n depth,\n disableTransaction,\n draft,\n file,\n filePath,\n limit,\n overrideAccess = true,\n overrideLock,\n overwriteExistingFiles = false,\n populate,\n publishAllLocales,\n publishSpecificLocale,\n select,\n showHiddenFields,\n sort,\n trash = false,\n unpublishAllLocales,\n where,\n } = options\n\n const collection = payload.collections[collectionSlug]\n\n if (!collection) {\n throw new APIError(\n `The collection with slug ${String(collectionSlug)} can't be found. Update Operation.`,\n )\n }\n\n const req = await createLocalReq(options as CreateLocalReqOptions, payload)\n req.file = file ?? (await getFileByPath(filePath!))\n\n const args = {\n id,\n autosave,\n collection,\n data,\n depth,\n disableTransaction,\n draft,\n limit,\n overrideAccess,\n overrideLock,\n overwriteExistingFiles,\n payload,\n populate,\n publishAllLocales,\n publishSpecificLocale,\n req,\n select,\n showHiddenFields,\n sort,\n trash,\n unpublishAllLocales,\n where,\n }\n\n if (options.id) {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return updateByIDOperation<TSlug, TSelect>(args)\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return updateOperation<TSlug, TSelect>(args)\n}\n\nexport { updateLocal }\n"],"names":["APIError","getFileByPath","createLocalReq","updateOperation","updateByIDOperation","updateLocal","payload","options","id","autosave","collection","collectionSlug","data","depth","disableTransaction","draft","file","filePath","limit","overrideAccess","overrideLock","overwriteExistingFiles","populate","publishAllLocales","publishSpecificLocale","select","showHiddenFields","sort","trash","unpublishAllLocales","where","collections","String","req","args"],"mappings":"AAoBA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,aAAa,QAAQ,oCAAmC;AACjE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,eAAc;AAC9C,SAASC,mBAAmB,QAAQ,mBAAkB;AA8LtD,eAAeC,YAIbC,OAAgB,EAChBC,OAAgC;IAEhC,MAAM,EACJC,EAAE,EACFC,QAAQ,EACRC,YAAYC,cAAc,EAC1BC,IAAI,EACJC,KAAK,EACLC,kBAAkB,EAClBC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,KAAK,EACLC,iBAAiB,IAAI,EACrBC,YAAY,EACZC,yBAAyB,KAAK,EAC9BC,QAAQ,EACRC,iBAAiB,EACjBC,qBAAqB,EACrBC,MAAM,EACNC,gBAAgB,EAChBC,IAAI,EACJC,QAAQ,KAAK,EACbC,mBAAmB,EACnBC,KAAK,EACN,GAAGvB;IAEJ,MAAMG,aAAaJ,QAAQyB,WAAW,CAACpB,eAAe;IAEtD,IAAI,CAACD,YAAY;QACf,MAAM,IAAIV,SACR,CAAC,yBAAyB,EAAEgC,OAAOrB,gBAAgB,kCAAkC,CAAC;IAE1F;IAEA,MAAMsB,MAAM,MAAM/B,eAAeK,SAAkCD;IACnE2B,IAAIjB,IAAI,GAAGA,QAAS,MAAMf,cAAcgB;IAExC,MAAMiB,OAAO;QACX1B;QACAC;QACAC;QACAE;QACAC;QACAC;QACAC;QACAG;QACAC;QACAC;QACAC;QACAf;QACAgB;QACAC;QACAC;QACAS;QACAR;QACAC;QACAC;QACAC;QACAC;QACAC;IACF;IAEA,IAAIvB,QAAQC,EAAE,EAAE;QACd,oFAAoF;QACpF,OAAOJ,oBAAoC8B;IAC7C;IACA,oFAAoF;IACpF,OAAO/B,gBAAgC+B;AACzC;AAEA,SAAS7B,WAAW,GAAE"}
@@ -15,6 +15,7 @@ export type Arguments<TSlug extends CollectionSlug> = {
15
15
  overrideLock?: boolean;
16
16
  overwriteExistingFiles?: boolean;
17
17
  populate?: PopulateType;
18
+ publishAllLocales?: boolean;
18
19
  publishSpecificLocale?: string;
19
20
  req: PayloadRequest;
20
21
  select?: SelectType;
@@ -26,6 +27,7 @@ export type Arguments<TSlug extends CollectionSlug> = {
26
27
  */
27
28
  sort?: Sort;
28
29
  trash?: boolean;
30
+ unpublishAllLocales?: boolean;
29
31
  where: Where;
30
32
  };
31
33
  export declare const updateOperation: <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(incomingArgs: Arguments<TSlug>) => Promise<BulkOperationResult<TSlug, TSelect>>;
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"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;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,KAAK,EAAE,KAAK,CAAA;CACb,CAAA;AAED,eAAO,MAAM,eAAe,GAC1B,KAAK,SAAS,cAAc,EAC5B,OAAO,SAAS,wBAAwB,CAAC,KAAK,CAAC,gBAEjC,SAAS,CAAC,KAAK,CAAC,KAC7B,OAAO,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CA0Q7C,CAAA"}
@@ -36,7 +36,7 @@ export const updateOperation = async (incomingArgs)=>{
36
36
  collection: args.collection.config,
37
37
  operation: 'update'
38
38
  });
39
- const { autosave = false, collection: { config: collectionConfig }, collection, depth, draft: draftArg = false, limit = 0, overrideAccess, overrideLock, overwriteExistingFiles = false, populate, publishSpecificLocale, req: { fallbackLocale, locale, payload: { config }, payload }, req, select: incomingSelect, showHiddenFields, sort: incomingSort, trash = false, where } = args;
39
+ const { autosave = false, collection: { config: collectionConfig }, collection, depth, draft: draftArg = false, limit = 0, overrideAccess, overrideLock, overwriteExistingFiles = false, populate, publishAllLocales, publishSpecificLocale, req: { fallbackLocale, locale, payload: { config }, payload }, req, select: incomingSelect, showHiddenFields, sort: incomingSort, trash = false, unpublishAllLocales, where } = args;
40
40
  if (!where) {
41
41
  throw new APIError("Missing 'where' query of documents to update.", httpStatus.BAD_REQUEST);
42
42
  }
@@ -150,7 +150,6 @@ export const updateOperation = async (incomingArgs)=>{
150
150
  // ///////////////////////////////////////////////
151
151
  const updatedDoc = await updateDocument({
152
152
  id,
153
- accessResults: accessResult,
154
153
  autosave,
155
154
  collectionConfig,
156
155
  config,
@@ -165,10 +164,12 @@ export const updateOperation = async (incomingArgs)=>{
165
164
  overrideLock: overrideLock,
166
165
  payload,
167
166
  populate,
167
+ publishAllLocales,
168
168
  publishSpecificLocale,
169
169
  req,
170
170
  select: select,
171
- showHiddenFields: showHiddenFields
171
+ showHiddenFields: showHiddenFields,
172
+ unpublishAllLocales
172
173
  });
173
174
  if (docShouldCommit) {
174
175
  await commitTransaction(req);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/collections/operations/update.ts"],"sourcesContent":["import type { DeepPartial } from 'ts-essentials'\n\nimport { status as httpStatus } from 'http-status'\n\nimport type { AccessResult } from '../../config/types.js'\nimport type { PayloadRequest, PopulateType, SelectType, Sort, Where } from '../../types/index.js'\nimport type {\n BulkOperationResult,\n Collection,\n DataFromCollectionSlug,\n RequiredDataFromCollectionSlug,\n SelectFromCollectionSlug,\n} from '../config/types.js'\n\nimport { executeAccess } from '../../auth/executeAccess.js'\nimport { combineQueries } from '../../database/combineQueries.js'\nimport { validateQueryPaths } from '../../database/queryValidation/validateQueryPaths.js'\nimport { sanitizeWhereQuery } from '../../database/sanitizeWhereQuery.js'\nimport { APIError } from '../../errors/index.js'\nimport { type CollectionSlug, deepCopyObjectSimple } from '../../index.js'\nimport { generateFileData } from '../../uploads/generateFileData.js'\nimport { unlinkTempFiles } from '../../uploads/unlinkTempFiles.js'\nimport { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { hasDraftsEnabled } from '../../utilities/getVersionsConfig.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { isErrorPublic } from '../../utilities/isErrorPublic.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { sanitizeSelect } from '../../utilities/sanitizeSelect.js'\nimport { buildVersionCollectionFields } from '../../versions/buildCollectionFields.js'\nimport { appendVersionToQueryKey } from '../../versions/drafts/appendVersionToQueryKey.js'\nimport { getQueryDraftsSort } from '../../versions/drafts/getQueryDraftsSort.js'\nimport { buildAfterOperation } from './utilities/buildAfterOperation.js'\nimport { buildBeforeOperation } from './utilities/buildBeforeOperation.js'\nimport { sanitizeSortQuery } from './utilities/sanitizeSortQuery.js'\nimport { updateDocument } from './utilities/update.js'\n\nexport type Arguments<TSlug extends CollectionSlug> = {\n autosave?: boolean\n collection: Collection\n data: DeepPartial<RequiredDataFromCollectionSlug<TSlug>>\n depth?: number\n disableTransaction?: boolean\n disableVerificationEmail?: boolean\n draft?: boolean\n limit?: number\n overrideAccess?: boolean\n overrideLock?: boolean\n overwriteExistingFiles?: boolean\n populate?: PopulateType\n publishSpecificLocale?: string\n req: PayloadRequest\n select?: SelectType\n showHiddenFields?: boolean\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-createdAt' // Sort DESC by createdAt\n * @example ['group', '-createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: Sort\n trash?: boolean\n where: Where\n}\n\nexport const updateOperation = async <\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n incomingArgs: Arguments<TSlug>,\n): Promise<BulkOperationResult<TSlug, TSelect>> => {\n let args = incomingArgs\n\n if (args.collection.config.disableBulkEdit && !args.overrideAccess) {\n throw new APIError(`Collection ${args.collection.config.slug} has disabled bulk edit`, 403)\n }\n\n try {\n const shouldCommit = !args.disableTransaction && (await initTransaction(args.req))\n\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n args = await buildBeforeOperation({\n args,\n collection: args.collection.config,\n operation: 'update',\n })\n\n const {\n autosave = false,\n collection: { config: collectionConfig },\n collection,\n depth,\n draft: draftArg = false,\n limit = 0,\n overrideAccess,\n overrideLock,\n overwriteExistingFiles = false,\n populate,\n publishSpecificLocale,\n req: {\n fallbackLocale,\n locale,\n payload: { config },\n payload,\n },\n req,\n select: incomingSelect,\n showHiddenFields,\n sort: incomingSort,\n trash = false,\n where,\n } = args\n\n if (!where) {\n throw new APIError(\"Missing 'where' query of documents to update.\", httpStatus.BAD_REQUEST)\n }\n\n const { data: bulkUpdateData } = args\n const shouldSaveDraft = Boolean(draftArg && hasDraftsEnabled(collectionConfig))\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n let accessResult: AccessResult\n if (!overrideAccess) {\n accessResult = await executeAccess({ req }, collectionConfig.access.update)\n }\n\n await validateQueryPaths({\n collectionConfig,\n overrideAccess: overrideAccess!,\n req,\n where,\n })\n\n // /////////////////////////////////////\n // Retrieve documents\n // /////////////////////////////////////\n\n let fullWhere = combineQueries(where, accessResult!)\n\n const isTrashAttempt =\n collectionConfig.trash &&\n typeof bulkUpdateData === 'object' &&\n bulkUpdateData !== null &&\n 'deletedAt' in bulkUpdateData &&\n bulkUpdateData.deletedAt != null\n\n // Enforce delete access if performing a soft-delete (trash)\n if (isTrashAttempt && !overrideAccess) {\n const deleteAccessResult = await executeAccess({ req }, collectionConfig.access.delete)\n fullWhere = combineQueries(fullWhere, deleteAccessResult)\n }\n\n // Exclude trashed documents when trash: false\n fullWhere = appendNonTrashedFilter({\n enableTrash: collectionConfig.trash,\n trash,\n where: fullWhere,\n })\n\n sanitizeWhereQuery({ fields: collectionConfig.flattenedFields, payload, where: fullWhere })\n\n const sort = sanitizeSortQuery({\n fields: collection.config.flattenedFields,\n sort: incomingSort,\n })\n\n let docs\n\n if (hasDraftsEnabled(collectionConfig) && shouldSaveDraft) {\n const versionsWhere = appendVersionToQueryKey(fullWhere)\n\n await validateQueryPaths({\n collectionConfig: collection.config,\n overrideAccess: overrideAccess!,\n req,\n versionFields: buildVersionCollectionFields(payload.config, collection.config, true),\n where: appendVersionToQueryKey(where),\n })\n\n const query = await payload.db.queryDrafts<DataFromCollectionSlug<TSlug>>({\n collection: collectionConfig.slug,\n limit,\n locale: locale!,\n pagination: false,\n req,\n sort: getQueryDraftsSort({ collectionConfig, sort }),\n where: versionsWhere,\n })\n\n docs = query.docs\n } else {\n const query = await payload.db.find({\n collection: collectionConfig.slug,\n limit,\n locale: locale!,\n pagination: false,\n req,\n sort,\n where: fullWhere,\n })\n\n docs = query.docs\n }\n\n // /////////////////////////////////////\n // Generate data for all files and sizes\n // /////////////////////////////////////\n\n const { data, files: filesToUpload } = await generateFileData({\n collection,\n config,\n data: bulkUpdateData,\n operation: 'update',\n overwriteExistingFiles,\n req,\n throwOnMissingFile: false,\n })\n\n const errors: BulkOperationResult<TSlug, TSelect>['errors'] = []\n\n const promises = docs.map(async (docWithLocales) => {\n const { id } = docWithLocales\n\n try {\n // Each document gets its own transaction when singleTransaction is enabled\n let docShouldCommit = false\n if (req.payload.db.bulkOperationsSingleTransaction) {\n docShouldCommit = await initTransaction(req)\n }\n\n const select = sanitizeSelect({\n fields: collectionConfig.flattenedFields,\n forceSelect: collectionConfig.forceSelect,\n select: incomingSelect,\n })\n\n // ///////////////////////////////////////////////\n // Update document, runs all document level hooks\n // ///////////////////////////////////////////////\n const updatedDoc = await updateDocument({\n id,\n accessResults: accessResult,\n autosave,\n collectionConfig,\n config,\n data: deepCopyObjectSimple(data),\n depth: depth!,\n docWithLocales,\n draftArg,\n fallbackLocale: fallbackLocale!,\n filesToUpload,\n locale: locale!,\n overrideAccess: overrideAccess!,\n overrideLock: overrideLock!,\n payload,\n populate,\n publishSpecificLocale,\n req,\n select: select!,\n showHiddenFields: showHiddenFields!,\n })\n\n if (docShouldCommit) {\n await commitTransaction(req)\n }\n\n return updatedDoc\n } catch (error) {\n const isPublic = error instanceof Error ? isErrorPublic(error, config) : false\n\n if (req.payload.db.bulkOperationsSingleTransaction) {\n await killTransaction(req)\n }\n errors.push({\n id,\n isPublic,\n message: error instanceof Error ? error.message : 'Unknown error',\n })\n }\n return null\n })\n\n await unlinkTempFiles({\n collectionConfig,\n config,\n req,\n })\n\n // Process sequentially when using single transaction mode to avoid shared state issues\n // Process in parallel when using one transaction for better performance\n let awaitedDocs: (DataFromCollectionSlug<TSlug> | null)[]\n if (req.payload.db.bulkOperationsSingleTransaction) {\n awaitedDocs = []\n for (const promise of promises) {\n awaitedDocs.push(await promise)\n }\n } else {\n awaitedDocs = await Promise.all(promises)\n }\n\n let result = {\n docs: awaitedDocs.filter(Boolean),\n errors,\n }\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = await buildAfterOperation({\n args,\n collection: collectionConfig,\n operation: 'update',\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n result,\n })\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return result\n } catch (error: unknown) {\n await killTransaction(args.req)\n throw error\n }\n}\n"],"names":["status","httpStatus","executeAccess","combineQueries","validateQueryPaths","sanitizeWhereQuery","APIError","deepCopyObjectSimple","generateFileData","unlinkTempFiles","appendNonTrashedFilter","commitTransaction","hasDraftsEnabled","initTransaction","isErrorPublic","killTransaction","sanitizeSelect","buildVersionCollectionFields","appendVersionToQueryKey","getQueryDraftsSort","buildAfterOperation","buildBeforeOperation","sanitizeSortQuery","updateDocument","updateOperation","incomingArgs","args","collection","config","disableBulkEdit","overrideAccess","slug","shouldCommit","disableTransaction","req","operation","autosave","collectionConfig","depth","draft","draftArg","limit","overrideLock","overwriteExistingFiles","populate","publishSpecificLocale","fallbackLocale","locale","payload","select","incomingSelect","showHiddenFields","sort","incomingSort","trash","where","BAD_REQUEST","data","bulkUpdateData","shouldSaveDraft","Boolean","accessResult","access","update","fullWhere","isTrashAttempt","deletedAt","deleteAccessResult","delete","enableTrash","fields","flattenedFields","docs","versionsWhere","versionFields","query","db","queryDrafts","pagination","find","files","filesToUpload","throwOnMissingFile","errors","promises","map","docWithLocales","id","docShouldCommit","bulkOperationsSingleTransaction","forceSelect","updatedDoc","accessResults","error","isPublic","Error","push","message","awaitedDocs","promise","Promise","all","result","filter"],"mappings":"AAEA,SAASA,UAAUC,UAAU,QAAQ,cAAa;AAYlD,SAASC,aAAa,QAAQ,8BAA6B;AAC3D,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,kBAAkB,QAAQ,uDAAsD;AACzF,SAASC,kBAAkB,QAAQ,uCAAsC;AACzE,SAASC,QAAQ,QAAQ,wBAAuB;AAChD,SAA8BC,oBAAoB,QAAQ,iBAAgB;AAC1E,SAASC,gBA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AAC3C;YACzBuB;QACF;QAEA,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExCmB,SAAS,MAAMlF,oBAAoB;YACjCM;YACAC,YAAYU;YACZF,WAAW;YACX,oFAAoF;YACpFmE;QACF;QAEA,IAAItE,cAAc;YAChB,MAAMrB,kBAAkBuB;QAC1B;QAEA,oFAAoF;QACpF,OAAOoE;IACT,EAAE,OAAOT,OAAgB;QACvB,MAAM9E,gBAAgBW,KAAKQ,GAAG;QAC9B,MAAM2D;IACR;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/collections/operations/update.ts"],"sourcesContent":["import type { DeepPartial } from 'ts-essentials'\n\nimport { status as httpStatus } from 'http-status'\n\nimport type { AccessResult } from '../../config/types.js'\nimport type { PayloadRequest, PopulateType, SelectType, Sort, Where } from '../../types/index.js'\nimport type {\n BulkOperationResult,\n Collection,\n DataFromCollectionSlug,\n RequiredDataFromCollectionSlug,\n SelectFromCollectionSlug,\n} from '../config/types.js'\n\nimport { executeAccess } from '../../auth/executeAccess.js'\nimport { combineQueries } from '../../database/combineQueries.js'\nimport { validateQueryPaths } from '../../database/queryValidation/validateQueryPaths.js'\nimport { sanitizeWhereQuery } from '../../database/sanitizeWhereQuery.js'\nimport { APIError } from '../../errors/index.js'\nimport { type CollectionSlug, deepCopyObjectSimple } from '../../index.js'\nimport { generateFileData } from '../../uploads/generateFileData.js'\nimport { unlinkTempFiles } from '../../uploads/unlinkTempFiles.js'\nimport { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { hasDraftsEnabled } from '../../utilities/getVersionsConfig.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { isErrorPublic } from '../../utilities/isErrorPublic.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { sanitizeSelect } from '../../utilities/sanitizeSelect.js'\nimport { buildVersionCollectionFields } from '../../versions/buildCollectionFields.js'\nimport { appendVersionToQueryKey } from '../../versions/drafts/appendVersionToQueryKey.js'\nimport { getQueryDraftsSort } from '../../versions/drafts/getQueryDraftsSort.js'\nimport { buildAfterOperation } from './utilities/buildAfterOperation.js'\nimport { buildBeforeOperation } from './utilities/buildBeforeOperation.js'\nimport { sanitizeSortQuery } from './utilities/sanitizeSortQuery.js'\nimport { updateDocument } from './utilities/update.js'\n\nexport type Arguments<TSlug extends CollectionSlug> = {\n autosave?: boolean\n collection: Collection\n data: DeepPartial<RequiredDataFromCollectionSlug<TSlug>>\n depth?: number\n disableTransaction?: boolean\n disableVerificationEmail?: boolean\n draft?: boolean\n limit?: number\n overrideAccess?: boolean\n overrideLock?: boolean\n overwriteExistingFiles?: boolean\n populate?: PopulateType\n publishAllLocales?: boolean\n publishSpecificLocale?: string\n req: PayloadRequest\n select?: SelectType\n showHiddenFields?: boolean\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-createdAt' // Sort DESC by createdAt\n * @example ['group', '-createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: Sort\n trash?: boolean\n unpublishAllLocales?: boolean\n where: Where\n}\n\nexport const updateOperation = async <\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n>(\n incomingArgs: Arguments<TSlug>,\n): Promise<BulkOperationResult<TSlug, TSelect>> => {\n let args = incomingArgs\n\n if (args.collection.config.disableBulkEdit && !args.overrideAccess) {\n throw new APIError(`Collection ${args.collection.config.slug} has disabled bulk edit`, 403)\n }\n\n try {\n const shouldCommit = !args.disableTransaction && (await initTransaction(args.req))\n\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n args = await buildBeforeOperation({\n args,\n collection: args.collection.config,\n operation: 'update',\n })\n\n const {\n autosave = false,\n collection: { config: collectionConfig },\n collection,\n depth,\n draft: draftArg = false,\n limit = 0,\n overrideAccess,\n overrideLock,\n overwriteExistingFiles = false,\n populate,\n publishAllLocales,\n publishSpecificLocale,\n req: {\n fallbackLocale,\n locale,\n payload: { config },\n payload,\n },\n req,\n select: incomingSelect,\n showHiddenFields,\n sort: incomingSort,\n trash = false,\n unpublishAllLocales,\n where,\n } = args\n\n if (!where) {\n throw new APIError(\"Missing 'where' query of documents to update.\", httpStatus.BAD_REQUEST)\n }\n\n const { data: bulkUpdateData } = args\n const shouldSaveDraft = Boolean(draftArg && hasDraftsEnabled(collectionConfig))\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n let accessResult: AccessResult\n if (!overrideAccess) {\n accessResult = await executeAccess({ req }, collectionConfig.access.update)\n }\n\n await validateQueryPaths({\n collectionConfig,\n overrideAccess: overrideAccess!,\n req,\n where,\n })\n\n // /////////////////////////////////////\n // Retrieve documents\n // /////////////////////////////////////\n\n let fullWhere = combineQueries(where, accessResult!)\n\n const isTrashAttempt =\n collectionConfig.trash &&\n typeof bulkUpdateData === 'object' &&\n bulkUpdateData !== null &&\n 'deletedAt' in bulkUpdateData &&\n bulkUpdateData.deletedAt != null\n\n // Enforce delete access if performing a soft-delete (trash)\n if (isTrashAttempt && !overrideAccess) {\n const deleteAccessResult = await executeAccess({ req }, collectionConfig.access.delete)\n fullWhere = combineQueries(fullWhere, deleteAccessResult)\n }\n\n // Exclude trashed documents when trash: false\n fullWhere = appendNonTrashedFilter({\n enableTrash: collectionConfig.trash,\n trash,\n where: fullWhere,\n })\n\n sanitizeWhereQuery({ fields: collectionConfig.flattenedFields, payload, where: fullWhere })\n\n const sort = sanitizeSortQuery({\n fields: collection.config.flattenedFields,\n sort: incomingSort,\n })\n\n let docs\n\n if (hasDraftsEnabled(collectionConfig) && shouldSaveDraft) {\n const versionsWhere = appendVersionToQueryKey(fullWhere)\n\n await validateQueryPaths({\n collectionConfig: collection.config,\n overrideAccess: overrideAccess!,\n req,\n versionFields: buildVersionCollectionFields(payload.config, collection.config, true),\n where: appendVersionToQueryKey(where),\n })\n\n const query = await payload.db.queryDrafts<DataFromCollectionSlug<TSlug>>({\n collection: collectionConfig.slug,\n limit,\n locale: locale!,\n pagination: false,\n req,\n sort: getQueryDraftsSort({ collectionConfig, sort }),\n where: versionsWhere,\n })\n\n docs = query.docs\n } else {\n const query = await payload.db.find({\n collection: collectionConfig.slug,\n limit,\n locale: locale!,\n pagination: false,\n req,\n sort,\n where: fullWhere,\n })\n\n docs = query.docs\n }\n\n // /////////////////////////////////////\n // Generate data for all files and sizes\n // /////////////////////////////////////\n\n const { data, files: filesToUpload } = await generateFileData({\n collection,\n config,\n data: bulkUpdateData,\n operation: 'update',\n overwriteExistingFiles,\n req,\n throwOnMissingFile: false,\n })\n\n const errors: BulkOperationResult<TSlug, TSelect>['errors'] = []\n\n const promises = docs.map(async (docWithLocales) => {\n const { id } = docWithLocales\n\n try {\n // Each document gets its own transaction when singleTransaction is enabled\n let docShouldCommit = false\n if (req.payload.db.bulkOperationsSingleTransaction) {\n docShouldCommit = await initTransaction(req)\n }\n\n const select = sanitizeSelect({\n fields: collectionConfig.flattenedFields,\n forceSelect: collectionConfig.forceSelect,\n select: incomingSelect,\n })\n\n // ///////////////////////////////////////////////\n // Update document, runs all document level hooks\n // ///////////////////////////////////////////////\n const updatedDoc = await updateDocument({\n id,\n autosave,\n collectionConfig,\n config,\n data: deepCopyObjectSimple(data),\n depth: depth!,\n docWithLocales,\n draftArg,\n fallbackLocale: fallbackLocale!,\n filesToUpload,\n locale: locale!,\n overrideAccess: overrideAccess!,\n overrideLock: overrideLock!,\n payload,\n populate,\n publishAllLocales,\n publishSpecificLocale,\n req,\n select: select!,\n showHiddenFields: showHiddenFields!,\n unpublishAllLocales,\n })\n\n if (docShouldCommit) {\n await commitTransaction(req)\n }\n\n return updatedDoc\n } catch (error) {\n const isPublic = error instanceof Error ? isErrorPublic(error, config) : false\n\n if (req.payload.db.bulkOperationsSingleTransaction) {\n await killTransaction(req)\n }\n errors.push({\n id,\n isPublic,\n message: error instanceof Error ? error.message : 'Unknown error',\n })\n }\n return null\n })\n\n await unlinkTempFiles({\n collectionConfig,\n config,\n req,\n })\n\n // Process sequentially when using single transaction mode to avoid shared state issues\n // Process in parallel when using one transaction for better performance\n let awaitedDocs: (DataFromCollectionSlug<TSlug> | null)[]\n if (req.payload.db.bulkOperationsSingleTransaction) {\n awaitedDocs = []\n for (const promise of promises) {\n awaitedDocs.push(await promise)\n }\n } else {\n awaitedDocs = await Promise.all(promises)\n }\n\n let result = {\n docs: awaitedDocs.filter(Boolean),\n errors,\n }\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = await buildAfterOperation({\n args,\n collection: collectionConfig,\n operation: 'update',\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n result,\n })\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return result\n } catch (error: unknown) {\n await killTransaction(args.req)\n throw error\n }\n}\n"],"names":["status","httpStatus","executeAccess","combineQueries","validateQueryPaths","sanitizeWhereQuery","APIError","deepCopyObjectSimple","generateFileData","unlinkTempFiles","appendNonTrashedFilter","commitTransaction","hasDraftsEnabled","initTransaction","isErrorPublic","killTransaction","sanitizeSelect","buildVersionCollectionFields","appendVersionToQueryKey","getQueryDraftsSort","buildAfterOperation","buildBeforeOperation","sanitizeSortQuery","updateDocument","updateOperation","incomingArgs","args","collection","config","disableBulkEdit","overrideAccess","slug","shouldCommit","disableTransaction","req","operation","autosave","collectionConfig","depth","draft","draftArg","limit","overrideLock","overwriteExistingFiles","populate","publishAllLocales","publishSpecificLocale","fallbackLocale","locale","payload","select","incomingSelect","showHiddenFields","sort","incomingSort","trash","unpublishAllLocales","where","BAD_REQUEST","data","bulkUpdateData","shouldSaveDraft","Boolean","accessResult","access","update","fullWhere","isTrashAttempt","deletedAt","deleteAccessResult","delete","enableTrash","fields","flattenedFields","docs","versionsWhere","versionFields","query","db","queryDrafts","pagination","find","files","filesToUpload","throwOnMissingFile","errors","promises","map","docWithLocales","id","docShouldCommit","bulkOperationsSingleTransaction","forceSelect","updatedDoc","error","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;QAEA,MAAMzF,gBAAgB;YACpB4B;YACAT;YACAM;QACF;QAEA,uFAAuF;QACvF,wEAAwE;QACxE,IAAIiE;QACJ,IAAIjE,IAAIe,OAAO,CAAC6B,EAAE,CAACa,+BAA+B,EAAE;YAClDQ,cAAc,EAAE;YAChB,KAAK,MAAMC,WAAWd,SAAU;gBAC9Ba,YAAYF,IAAI,CAAC,MAAMG;YACzB;QACF,OAAO;YACLD,cAAc,MAAME,QAAQC,GAAG,CAAChB;QAClC;QAEA,IAAIiB,SAAS;YACX7B,MAAMyB,YAAYK,MAAM,CAAC1C;YACzBuB;QACF;QAEA,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExCkB,SAAS,MAAMnF,oBAAoB;YACjCM;YACAC,YAAYU;YACZF,WAAW;YACX,oFAAoF;YACpFoE;QACF;QAEA,IAAIvE,cAAc;YAChB,MAAMrB,kBAAkBuB;QAC1B;QAEA,oFAAoF;QACpF,OAAOqE;IACT,EAAE,OAAOT,OAAgB;QACvB,MAAM/E,gBAAgBW,KAAKQ,GAAG;QAC9B,MAAM4D;IACR;AACF,EAAC"}
@@ -15,11 +15,13 @@ export type Arguments<TSlug extends CollectionSlug> = {
15
15
  overrideLock?: boolean;
16
16
  overwriteExistingFiles?: boolean;
17
17
  populate?: PopulateType;
18
+ publishAllLocales?: boolean;
18
19
  publishSpecificLocale?: string;
19
20
  req: PayloadRequest;
20
21
  select?: SelectType;
21
22
  showHiddenFields?: boolean;
22
23
  trash?: boolean;
24
+ unpublishAllLocales?: boolean;
23
25
  };
24
26
  export declare const updateByIDOperation: <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug> = SelectType>(incomingArgs: Arguments<TSlug>) => Promise<TransformCollectionWithSelect<TSlug, TSelect>>;
25
27
  //# sourceMappingURL=updateByID.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"updateByID.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/updateByID.ts"],"names":[],"mappings":"AAAA,OA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B,CAAC,KAAK,CAAC,6BAEjC,SAAS,CAAC,KAAK,CAAC,KAC7B,OAAO,CAAC,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CAiMvD,CAAA"}
@@ -30,7 +30,7 @@ export const updateByIDOperation = async (incomingArgs)=>{
30
30
  if (args.publishSpecificLocale) {
31
31
  args.req.locale = args.publishSpecificLocale;
32
32
  }
33
- const { id, autosave = false, collection: { config: collectionConfig }, collection, depth, draft: draftArg = false, overrideAccess, overrideLock, overwriteExistingFiles = false, populate, publishSpecificLocale, req: { fallbackLocale, locale, payload: { config }, payload }, req, select: incomingSelect, showHiddenFields, trash = false } = args;
33
+ const { id, autosave = false, collection: { config: collectionConfig }, collection, depth, draft: draftArg = false, overrideAccess, overrideLock, overwriteExistingFiles = false, populate, publishAllLocales, publishSpecificLocale, req: { fallbackLocale, locale, payload: { config }, payload }, req, select: incomingSelect, showHiddenFields, trash = false, unpublishAllLocales } = args;
34
34
  if (!id) {
35
35
  throw new APIError('Missing ID of document to update.', httpStatus.BAD_REQUEST);
36
36
  }
@@ -110,7 +110,6 @@ export const updateByIDOperation = async (incomingArgs)=>{
110
110
  // ///////////////////////////////////////////////
111
111
  let result = await updateDocument({
112
112
  id,
113
- accessResults,
114
113
  autosave,
115
114
  collectionConfig,
116
115
  config,
@@ -125,10 +124,12 @@ export const updateByIDOperation = async (incomingArgs)=>{
125
124
  overrideLock: overrideLock,
126
125
  payload,
127
126
  populate,
127
+ publishAllLocales,
128
128
  publishSpecificLocale,
129
129
  req,
130
130
  select: select,
131
- showHiddenFields: showHiddenFields
131
+ showHiddenFields: showHiddenFields,
132
+ unpublishAllLocales
132
133
  });
133
134
  await unlinkTempFiles({
134
135
  collectionConfig,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/collections/operations/updateByID.ts"],"sourcesContent":["import type { DeepPartial } from 'ts-essentials'\n\nimport { status as httpStatus } from 'http-status'\n\nimport type { FindOneArgs } from '../../database/types.js'\nimport type {\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformCollectionWithSelect,\n} from '../../types/index.js'\nimport type {\n Collection,\n RequiredDataFromCollectionSlug,\n SelectFromCollectionSlug,\n TypeWithID,\n} from '../config/types.js'\n\nimport { executeAccess } from '../../auth/executeAccess.js'\nimport { hasWhereAccessResult } from '../../auth/types.js'\nimport { combineQueries } from '../../database/combineQueries.js'\nimport { APIError, Forbidden, NotFound } from '../../errors/index.js'\nimport { type CollectionSlug, deepCopyObjectSimple } from '../../index.js'\nimport { generateFileData } from '../../uploads/generateFileData.js'\nimport { unlinkTempFiles } from '../../uploads/unlinkTempFiles.js'\nimport { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { sanitizeSelect } from '../../utilities/sanitizeSelect.js'\nimport { getLatestCollectionVersion } from '../../versions/getLatestCollectionVersion.js'\nimport { buildAfterOperation } from './utilities/buildAfterOperation.js'\nimport { buildBeforeOperation } from './utilities/buildBeforeOperation.js'\nimport { updateDocument } from './utilities/update.js'\n\nexport type Arguments<TSlug extends CollectionSlug> = {\n autosave?: boolean\n collection: Collection\n data: DeepPartial<RequiredDataFromCollectionSlug<TSlug>>\n depth?: number\n disableTransaction?: boolean\n disableVerificationEmail?: boolean\n draft?: boolean\n id: number | string\n overrideAccess?: boolean\n overrideLock?: boolean\n overwriteExistingFiles?: boolean\n populate?: PopulateType\n publishSpecificLocale?: string\n req: PayloadRequest\n select?: SelectType\n showHiddenFields?: boolean\n trash?: boolean\n}\n\nexport const updateByIDOperation = async <\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug> = SelectType,\n>(\n incomingArgs: Arguments<TSlug>,\n): Promise<TransformCollectionWithSelect<TSlug, TSelect>> => {\n let args = incomingArgs\n\n try {\n const shouldCommit = !args.disableTransaction && (await initTransaction(args.req))\n\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n args = await buildBeforeOperation({\n args,\n collection: args.collection.config,\n operation: 'update',\n })\n\n if (args.publishSpecificLocale) {\n args.req.locale = args.publishSpecificLocale\n }\n\n const {\n id,\n autosave = false,\n collection: { config: collectionConfig },\n collection,\n depth,\n draft: draftArg = false,\n overrideAccess,\n overrideLock,\n overwriteExistingFiles = false,\n populate,\n publishSpecificLocale,\n req: {\n fallbackLocale,\n locale,\n payload: { config },\n payload,\n },\n req,\n select: incomingSelect,\n showHiddenFields,\n trash = false,\n } = args\n\n if (!id) {\n throw new APIError('Missing ID of document to update.', httpStatus.BAD_REQUEST)\n }\n\n const { data } = args\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n const accessResults = !overrideAccess\n ? await executeAccess({ id, data, req }, collectionConfig.access.update)\n : true\n const hasWherePolicy = hasWhereAccessResult(accessResults)\n\n // /////////////////////////////////////\n // Retrieve document\n // /////////////////////////////////////\n\n const where = { id: { equals: id } }\n\n let fullWhere = combineQueries(where, accessResults)\n\n const isTrashAttempt =\n collectionConfig.trash &&\n typeof data === 'object' &&\n data !== null &&\n 'deletedAt' in data &&\n data.deletedAt != null\n\n if (isTrashAttempt && !overrideAccess) {\n const deleteAccessResult = await executeAccess({ req }, collectionConfig.access.delete)\n fullWhere = combineQueries(fullWhere, deleteAccessResult)\n }\n\n // Exclude trashed documents when trash: false\n fullWhere = appendNonTrashedFilter({\n enableTrash: collectionConfig.trash,\n trash,\n where: fullWhere,\n })\n\n const findOneArgs: FindOneArgs = {\n collection: collectionConfig.slug,\n locale: locale!,\n req,\n where: fullWhere,\n }\n\n const docWithLocales = await getLatestCollectionVersion<\n RequiredDataFromCollectionSlug<TSlug> & TypeWithID\n >({\n id,\n config: collectionConfig,\n payload,\n query: findOneArgs,\n req,\n })\n\n if (!docWithLocales && !hasWherePolicy) {\n throw new NotFound(req.t)\n }\n if (!docWithLocales && hasWherePolicy) {\n throw new Forbidden(req.t)\n }\n if (!docWithLocales) {\n throw new NotFound(req.t)\n }\n\n // /////////////////////////////////////\n // Generate data for all files and sizes\n // /////////////////////////////////////\n\n const { data: newFileData, files: filesToUpload } = await generateFileData({\n collection,\n config,\n data,\n operation: 'update',\n overwriteExistingFiles,\n req,\n throwOnMissingFile: false,\n })\n\n const select = sanitizeSelect({\n fields: collectionConfig.flattenedFields,\n forceSelect: collectionConfig.forceSelect,\n select: incomingSelect,\n })\n\n // ///////////////////////////////////////////////\n // Update document, runs all document level hooks\n // ///////////////////////////////////////////////\n\n let result = await updateDocument<TSlug, TSelect>({\n id,\n accessResults,\n autosave,\n collectionConfig,\n config,\n data: deepCopyObjectSimple(newFileData),\n depth: depth!,\n docWithLocales,\n draftArg,\n fallbackLocale: fallbackLocale!,\n filesToUpload,\n locale: locale!,\n overrideAccess: overrideAccess!,\n overrideLock: overrideLock!,\n payload,\n populate,\n publishSpecificLocale,\n req,\n select: select!,\n showHiddenFields: showHiddenFields!,\n })\n\n await unlinkTempFiles({\n collectionConfig,\n config,\n req,\n })\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = (await buildAfterOperation({\n args,\n collection: collectionConfig,\n operation: 'updateByID',\n result,\n })) as TransformCollectionWithSelect<TSlug, TSelect>\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n return result\n } catch (error: unknown) {\n await killTransaction(args.req)\n throw error\n }\n}\n"],"names":["status","httpStatus","executeAccess","hasWhereAccessResult","combineQueries","APIError","Forbidden","NotFound","deepCopyObjectSimple","generateFileData","unlinkTempFiles","appendNonTrashedFilter","commitTransaction","initTransaction","killTransaction","sanitizeSelect","getLatestCollectionVersion","buildAfterOperation","buildBeforeOperation","updateDocument","updateByIDOperation","incomingArgs","args","shouldCommit","disableTransaction","req","collection","config","operation","publishSpecificLocale","locale","id","autosave","collectionConfig","depth","draft","draftArg","overrideAccess","overrideLock","overwriteExistingFiles","populate","fallbackLocale","payload","select","incomingSelect","showHiddenFields","trash","BAD_REQUEST","data","accessResults","access","update","hasWherePolicy","where","equals","fullWhere","isTrashAttempt","deletedAt","deleteAccessResult","delete","enableTrash","findOneArgs","slug","docWithLocales","query","t","newFileData","files","filesToUpload","throwOnMissingFile","fields","flattenedFields","forceSelect","result","error"],"mappings":"AAEA,SAASA,UAAUC,UAAU,QAAQ,cAAa;AAgBlD,SAASC,aAAa,QAAQ,8BAA6B;AAC3D,SAASC,oBAAoB,QAAQ,sBAAqB;AAC1D,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,wBAAuB;AACrE,SAA8BC,oBAAoB,QAAQ,iBAAgB;AAC1E,SAASC,gBAAgB,QAAQ,oCAAmC;AACpE,SAASC,eAAe,QAAQ,mCAAkC;AAClE,SAASC,sBAAsB,QAAQ,4CAA2C;AAClF,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,cAAc,QAAQ,oCAAmC;AAClE,SAASC,0BAA0B,QAAQ,+CAA8C;AACzF,SAASC,mBAAmB,QAAQ,qCAAoC;AACxE,SAASC,oBAAoB,QAAQ,sCAAqC;AAC1E,SAASC,cAAc,QAAQ,wBAAuB;AAsBtD,OAAO,MAAMC,sBAAsB,OAIjCC;IAEA,IAAIC,OAAOD;IAEX,IAAI;QACF,MAAME,eAAe,CAACD,KAAKE,kBAAkB,IAAK,MAAMX,gBAAgBS,KAAKG,GAAG;QAEhF,wCAAwC;QACxC,+BAA+B;QAC/B,wCAAwC;QAExCH,OAAO,MAAMJ,qBAAqB;YAChCI;YACAI,YAAYJ,KAAKI,UAAU,CAACC,MAAM;YAClCC,WAAW;QACb;QAEA,IAAIN,KAAKO,qBAAqB,EAAE;YAC9BP,KAAKG,GAAG,CAACK,MAAM,GAAGR,KAAKO,qBAAqB;QAC9C;QA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iBAAiB;QACjB,wCAAwC;QAExC,IAAIlD,cAAc;YAChB,MAAMX,kBAAkBa;QAC1B;QAEA,OAAOgD;IACT,EAAE,OAAOC,OAAgB;QACvB,MAAM5D,gBAAgBQ,KAAKG,GAAG;QAC9B,MAAMiD;IACR;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/collections/operations/updateByID.ts"],"sourcesContent":["import type { DeepPartial } from 'ts-essentials'\n\nimport { status as httpStatus } from 'http-status'\n\nimport type { FindOneArgs } from '../../database/types.js'\nimport type {\n PayloadRequest,\n PopulateType,\n SelectType,\n TransformCollectionWithSelect,\n} from '../../types/index.js'\nimport type {\n Collection,\n RequiredDataFromCollectionSlug,\n SelectFromCollectionSlug,\n TypeWithID,\n} from '../config/types.js'\n\nimport { executeAccess } from '../../auth/executeAccess.js'\nimport { hasWhereAccessResult } from '../../auth/types.js'\nimport { combineQueries } from '../../database/combineQueries.js'\nimport { APIError, Forbidden, NotFound } from '../../errors/index.js'\nimport { type CollectionSlug, deepCopyObjectSimple } from '../../index.js'\nimport { generateFileData } from '../../uploads/generateFileData.js'\nimport { unlinkTempFiles } from '../../uploads/unlinkTempFiles.js'\nimport { appendNonTrashedFilter } from '../../utilities/appendNonTrashedFilter.js'\nimport { commitTransaction } from '../../utilities/commitTransaction.js'\nimport { initTransaction } from '../../utilities/initTransaction.js'\nimport { killTransaction } from '../../utilities/killTransaction.js'\nimport { sanitizeSelect } from '../../utilities/sanitizeSelect.js'\nimport { getLatestCollectionVersion } from '../../versions/getLatestCollectionVersion.js'\nimport { buildAfterOperation } from './utilities/buildAfterOperation.js'\nimport { buildBeforeOperation } from './utilities/buildBeforeOperation.js'\nimport { updateDocument } from './utilities/update.js'\n\nexport type Arguments<TSlug extends CollectionSlug> = {\n autosave?: boolean\n collection: Collection\n data: DeepPartial<RequiredDataFromCollectionSlug<TSlug>>\n depth?: number\n disableTransaction?: boolean\n disableVerificationEmail?: boolean\n draft?: boolean\n id: number | string\n overrideAccess?: boolean\n overrideLock?: boolean\n overwriteExistingFiles?: boolean\n populate?: PopulateType\n publishAllLocales?: boolean\n publishSpecificLocale?: string\n req: PayloadRequest\n select?: SelectType\n showHiddenFields?: boolean\n trash?: boolean\n unpublishAllLocales?: boolean\n}\n\nexport const updateByIDOperation = async <\n TSlug extends CollectionSlug,\n TSelect extends SelectFromCollectionSlug<TSlug> = SelectType,\n>(\n incomingArgs: Arguments<TSlug>,\n): Promise<TransformCollectionWithSelect<TSlug, TSelect>> => {\n let args = incomingArgs\n\n try {\n const shouldCommit = !args.disableTransaction && (await initTransaction(args.req))\n\n // /////////////////////////////////////\n // beforeOperation - Collection\n // /////////////////////////////////////\n\n args = await buildBeforeOperation({\n args,\n collection: args.collection.config,\n operation: 'update',\n })\n\n if (args.publishSpecificLocale) {\n args.req.locale = args.publishSpecificLocale\n }\n\n const {\n id,\n autosave = false,\n collection: { config: collectionConfig },\n collection,\n depth,\n draft: draftArg = false,\n overrideAccess,\n overrideLock,\n overwriteExistingFiles = false,\n populate,\n publishAllLocales,\n publishSpecificLocale,\n req: {\n fallbackLocale,\n locale,\n payload: { config },\n payload,\n },\n req,\n select: incomingSelect,\n showHiddenFields,\n trash = false,\n unpublishAllLocales,\n } = args\n\n if (!id) {\n throw new APIError('Missing ID of document to update.', httpStatus.BAD_REQUEST)\n }\n\n const { data } = args\n\n // /////////////////////////////////////\n // Access\n // /////////////////////////////////////\n\n const accessResults = !overrideAccess\n ? await executeAccess({ id, data, req }, collectionConfig.access.update)\n : true\n const hasWherePolicy = hasWhereAccessResult(accessResults)\n\n // /////////////////////////////////////\n // Retrieve document\n // /////////////////////////////////////\n\n const where = { id: { equals: id } }\n\n let fullWhere = combineQueries(where, accessResults)\n\n const isTrashAttempt =\n collectionConfig.trash &&\n typeof data === 'object' &&\n data !== null &&\n 'deletedAt' in data &&\n data.deletedAt != null\n\n if (isTrashAttempt && !overrideAccess) {\n const deleteAccessResult = await executeAccess({ req }, collectionConfig.access.delete)\n fullWhere = combineQueries(fullWhere, deleteAccessResult)\n }\n\n // Exclude trashed documents when trash: false\n fullWhere = appendNonTrashedFilter({\n enableTrash: collectionConfig.trash,\n trash,\n where: fullWhere,\n })\n\n const findOneArgs: FindOneArgs = {\n collection: collectionConfig.slug,\n locale: locale!,\n req,\n where: fullWhere,\n }\n\n const docWithLocales = await getLatestCollectionVersion<\n RequiredDataFromCollectionSlug<TSlug> & TypeWithID\n >({\n id,\n config: collectionConfig,\n payload,\n query: findOneArgs,\n req,\n })\n\n if (!docWithLocales && !hasWherePolicy) {\n throw new NotFound(req.t)\n }\n if (!docWithLocales && hasWherePolicy) {\n throw new Forbidden(req.t)\n }\n if (!docWithLocales) {\n throw new NotFound(req.t)\n }\n\n // /////////////////////////////////////\n // Generate data for all files and sizes\n // /////////////////////////////////////\n\n const { data: newFileData, files: filesToUpload } = await generateFileData({\n collection,\n config,\n data,\n operation: 'update',\n overwriteExistingFiles,\n req,\n throwOnMissingFile: false,\n })\n\n const select = sanitizeSelect({\n fields: collectionConfig.flattenedFields,\n forceSelect: collectionConfig.forceSelect,\n select: incomingSelect,\n })\n\n // ///////////////////////////////////////////////\n // Update document, runs all document level hooks\n // ///////////////////////////////////////////////\n\n let result = await updateDocument<TSlug, TSelect>({\n id,\n autosave,\n collectionConfig,\n config,\n data: deepCopyObjectSimple(newFileData),\n depth: depth!,\n docWithLocales,\n draftArg,\n fallbackLocale: fallbackLocale!,\n filesToUpload,\n locale: locale!,\n overrideAccess: overrideAccess!,\n overrideLock: overrideLock!,\n payload,\n populate,\n publishAllLocales,\n publishSpecificLocale,\n req,\n select: select!,\n showHiddenFields: showHiddenFields!,\n unpublishAllLocales,\n })\n\n await unlinkTempFiles({\n collectionConfig,\n config,\n req,\n })\n\n // /////////////////////////////////////\n // afterOperation - Collection\n // /////////////////////////////////////\n\n result = (await buildAfterOperation({\n args,\n collection: collectionConfig,\n operation: 'updateByID',\n result,\n })) as TransformCollectionWithSelect<TSlug, TSelect>\n\n // /////////////////////////////////////\n // Return results\n // /////////////////////////////////////\n\n if (shouldCommit) {\n await commitTransaction(req)\n }\n\n return result\n } catch (error: unknown) {\n await killTransaction(args.req)\n throw error\n }\n}\n"],"names":["status","httpStatus","executeAccess","hasWhereAccessResult","combineQueries","APIError","Forbidden","NotFound","deepCopyObjectSimple","generateFileData","unlinkTempFiles","appendNonTrashedFilter","commitTransaction","initTransaction","killTransaction","sanitizeSelect","getLatestCollectionVersion","buildAfterOperation","buildBeforeOperation","updateDocument","updateByIDOperation","incomingArgs","args","shouldCommit","disableTransaction","req","collection","config","operation","publishSpecificLocale","locale","id","autosave","collectionConfig","depth","draft","draftArg","overrideAccess","overrideLock","overwriteExistingFiles","populate","publishAllLocales","fallbackLocale","payload","select","incomingSelect","showHiddenFields","trash","unpublishAllLocales","BAD_REQUEST","data","accessResults","access","update","hasWherePolicy","where","equals","fullWhere","isTrashAttempt","deletedAt","deleteAccessResult","delete","enableTrash","findOneArgs","slug","docWithLocales","query","t","newFileData","files","filesToUpload","throwOnMissingFile","fields","flattenedFields","forceSelect","result","error"],"mappings":"AAEA,SAASA,UAAUC,UAAU,QAAQ,cAAa;AAgBlD,SAASC,aAAa,QAAQ,8BAA6B;AAC3D,SAASC,oBAAoB,QAAQ,sBAAqB;AAC1D,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,wBAAuB;AACrE,SAA8BC,oBAAoB,QAAQ,iBAAgB;AAC1E,SAASC,gBAAgB,QAAQ,oCAAmC;AACpE,SAASC,eAAe,QAAQ,mCAAkC;AAClE,SAASC,sBAAsB,QAAQ,4CAA2C;AAClF,SAASC,iBAAiB,QAAQ,uCAAsC;AACxE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,cAAc,QAAQ,oCAAmC;AAClE,SAASC,0BAA0B,QAAQ,+CAA8C;AACzF,SAASC,mBAAmB,QAAQ,qCAAoC;AACxE,SAASC,oBAA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QAClD,iDAAiD;QACjD,kDAAkD;QAElD,IAAI8B,SAAS,MAAMxD,eAA+B;YAChDY;YACAC;YACAC;YACAN;YACAuB,MAAM1C,qBAAqB4D;YAC3BlC,OAAOA;YACP+B;YACA7B;YACAM,gBAAgBA;YAChB4B;YACAxC,QAAQA;YACRO,gBAAgBA;YAChBC,cAAcA;YACdK;YACAH;YACAC;YACAZ;YACAJ;YACAmB,QAAQA;YACRE,kBAAkBA;YAClBE;QACF;QAEA,MAAMtC,gBAAgB;YACpBuB;YACAN;YACAF;QACF;QAEA,wCAAwC;QACxC,8BAA8B;QAC9B,wCAAwC;QAExCkD,SAAU,MAAM1D,oBAAoB;YAClCK;YACAI,YAAYO;YACZL,WAAW;YACX+C;QACF;QAEA,wCAAwC;QACxC,iBAAiB;QACjB,wCAAwC;QAExC,IAAIpD,cAAc;YAChB,MAAMX,kBAAkBa;QAC1B;QAEA,OAAOkD;IACT,EAAE,OAAOC,OAAgB;QACvB,MAAM9D,gBAAgBQ,KAAKG,GAAG;QAC9B,MAAMmD;IACR;AACF,EAAC"}
@@ -1,9 +1,8 @@
1
1
  import type { DeepPartial } from 'ts-essentials';
2
- import type { AccessResult, CollectionSlug, FileToSave, SanitizedConfig, TypedFallbackLocale } from '../../../index.js';
2
+ import type { CollectionSlug, FileToSave, SanitizedConfig, TypedFallbackLocale } from '../../../index.js';
3
3
  import type { JsonObject, Payload, PayloadRequest, PopulateType, SelectType, TransformCollectionWithSelect } from '../../../types/index.js';
4
4
  import type { DataFromCollectionSlug, SanitizedCollectionConfig, SelectFromCollectionSlug, TypeWithID } from '../../config/types.js';
5
5
  export type SharedUpdateDocumentArgs<TSlug extends CollectionSlug> = {
6
- accessResults: AccessResult;
7
6
  autosave: boolean;
8
7
  collectionConfig: SanitizedCollectionConfig;
9
8
  config: SanitizedConfig;
@@ -19,10 +18,12 @@ export type SharedUpdateDocumentArgs<TSlug extends CollectionSlug> = {
19
18
  overrideLock: boolean;
20
19
  payload: Payload;
21
20
  populate?: PopulateType;
21
+ publishAllLocales?: boolean;
22
22
  publishSpecificLocale?: string;
23
23
  req: PayloadRequest;
24
24
  select: SelectType;
25
25
  showHiddenFields: boolean;
26
+ unpublishAllLocales?: boolean;
26
27
  };
27
28
  /**
28
29
  * This function is used to update a document in the DB and return the result.
@@ -37,5 +38,5 @@ export type SharedUpdateDocumentArgs<TSlug extends CollectionSlug> = {
37
38
  * - afterChange - Fields
38
39
  * - afterChange - Collection
39
40
  */
40
- export declare const updateDocument: <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug> = SelectType>({ id, accessResults, autosave, collectionConfig, config, data, depth, docWithLocales, draftArg, fallbackLocale, filesToUpload, locale, overrideAccess, overrideLock, payload, populate, publishSpecificLocale, req, select, showHiddenFields, }: SharedUpdateDocumentArgs<TSlug>) => Promise<TransformCollectionWithSelect<TSlug, TSelect>>;
41
+ export declare const updateDocument: <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug> = SelectType>({ id, autosave, collectionConfig, config, data, depth, docWithLocales, draftArg, fallbackLocale, filesToUpload, locale, overrideAccess, overrideLock, payload, populate, publishAllLocales: publishAllLocalesArg, publishSpecificLocale, req, select, showHiddenFields, unpublishAllLocales: unpublishAllLocalesArg, }: SharedUpdateDocumentArgs<TSlug>) => Promise<TransformCollectionWithSelect<TSlug, TSelect>>;
41
42
  //# sourceMappingURL=update.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/utilities/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAGhD,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,UAAU,EACV,eAAe,EACf,mBAAmB,EACpB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,UAAU,EACV,OAAO,EACP,cAAc,EACd,YAAY,EACZ,UAAU,EACV,6BAA6B,EAC9B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EACV,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,EACxB,UAAU,EACX,MAAM,uBAAuB,CAAA;AAmB9B,MAAM,MAAM,wBAAwB,CAAC,KAAK,SAAS,cAAc,IAAI;IACnE,aAAa,EAAE,YAAY,CAAA;IAC3B,QAAQ,EAAE,OAAO,CAAA;IACjB,gBAAgB,EAAE,yBAAyB,CAAA;IAC3C,MAAM,EAAE,eAAe,CAAA;IACvB,IAAI,EAAE,WAAW,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAA;IAChD,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,EAAE,UAAU,GAAG,UAAU,CAAA;IACvC,QAAQ,EAAE,OAAO,CAAA;IACjB,cAAc,EAAE,mBAAmB,CAAA;IACnC,aAAa,EAAE,UAAU,EAAE,CAAA;IAC3B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,OAAO,CAAA;IACvB,YAAY,EAAE,OAAO,CAAA;IACrB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,GAAG,EAAE,cAAc,CAAA;IACnB,MAAM,EAAE,UAAU,CAAA;IAClB,gBAAgB,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,GACzB,KAAK,SAAS,cAAc,EAC5B,OAAO,SAAS,wBAAwB,CAAC,KAAK,CAAC,gQAsB9C,wBAAwB,CAAC,KAAK,CAAC,KAAG,OAAO,CAAC,6BAA6B,CAAC,KAAK,EAAE,OAAO,CAAC,CA2SzF,CAAA"}
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/collections/operations/utilities/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,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