@payloadcms/sdk 0.0.1-beta.0

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 (98) hide show
  1. package/dist/auth/forgotPassword.d.ts +13 -0
  2. package/dist/auth/forgotPassword.d.ts.map +1 -0
  3. package/dist/auth/forgotPassword.js +11 -0
  4. package/dist/auth/forgotPassword.js.map +1 -0
  5. package/dist/auth/login.d.ts +14 -0
  6. package/dist/auth/login.d.ts.map +1 -0
  7. package/dist/auth/login.js +11 -0
  8. package/dist/auth/login.js.map +1 -0
  9. package/dist/auth/me.d.ts +15 -0
  10. package/dist/auth/me.d.ts.map +1 -0
  11. package/dist/auth/me.js +10 -0
  12. package/dist/auth/me.js.map +1 -0
  13. package/dist/auth/refreshToken.d.ts +14 -0
  14. package/dist/auth/refreshToken.d.ts.map +1 -0
  15. package/dist/auth/refreshToken.js +10 -0
  16. package/dist/auth/refreshToken.js.map +1 -0
  17. package/dist/auth/resetPassword.d.ts +15 -0
  18. package/dist/auth/resetPassword.d.ts.map +1 -0
  19. package/dist/auth/resetPassword.js +11 -0
  20. package/dist/auth/resetPassword.js.map +1 -0
  21. package/dist/auth/verifyEmail.d.ts +10 -0
  22. package/dist/auth/verifyEmail.d.ts.map +1 -0
  23. package/dist/auth/verifyEmail.js +10 -0
  24. package/dist/auth/verifyEmail.js.map +1 -0
  25. package/dist/collections/count.d.ts +21 -0
  26. package/dist/collections/count.d.ts.map +1 -0
  27. package/dist/collections/count.js +11 -0
  28. package/dist/collections/count.js.map +1 -0
  29. package/dist/collections/create.d.ts +41 -0
  30. package/dist/collections/create.d.ts.map +1 -0
  31. package/dist/collections/create.js +19 -0
  32. package/dist/collections/create.js.map +1 -0
  33. package/dist/collections/delete.d.ts +47 -0
  34. package/dist/collections/delete.d.ts.map +1 -0
  35. package/dist/collections/delete.js +15 -0
  36. package/dist/collections/delete.js.map +1 -0
  37. package/dist/collections/find.d.ts +75 -0
  38. package/dist/collections/find.d.ts.map +1 -0
  39. package/dist/collections/find.js +11 -0
  40. package/dist/collections/find.js.map +1 -0
  41. package/dist/collections/findByID.d.ts +49 -0
  42. package/dist/collections/findByID.d.ts.map +1 -0
  43. package/dist/collections/findByID.js +23 -0
  44. package/dist/collections/findByID.js.map +1 -0
  45. package/dist/collections/findVersionByID.d.ts +53 -0
  46. package/dist/collections/findVersionByID.d.ts.map +1 -0
  47. package/dist/collections/findVersionByID.js +23 -0
  48. package/dist/collections/findVersionByID.js.map +1 -0
  49. package/dist/collections/findVersions.d.ts +70 -0
  50. package/dist/collections/findVersions.d.ts.map +1 -0
  51. package/dist/collections/findVersions.js +11 -0
  52. package/dist/collections/findVersions.js.map +1 -0
  53. package/dist/collections/restoreVersion.d.ts +34 -0
  54. package/dist/collections/restoreVersion.d.ts.map +1 -0
  55. package/dist/collections/restoreVersion.js +11 -0
  56. package/dist/collections/restoreVersion.js.map +1 -0
  57. package/dist/collections/update.d.ts +62 -0
  58. package/dist/collections/update.d.ts.map +1 -0
  59. package/dist/collections/update.js +22 -0
  60. package/dist/collections/update.js.map +1 -0
  61. package/dist/globals/findOne.d.ts +35 -0
  62. package/dist/globals/findOne.d.ts.map +1 -0
  63. package/dist/globals/findOne.js +11 -0
  64. package/dist/globals/findOne.js.map +1 -0
  65. package/dist/globals/findVersionByID.d.ts +41 -0
  66. package/dist/globals/findVersionByID.d.ts.map +1 -0
  67. package/dist/globals/findVersionByID.js +23 -0
  68. package/dist/globals/findVersionByID.js.map +1 -0
  69. package/dist/globals/findVersions.d.ts +58 -0
  70. package/dist/globals/findVersions.d.ts.map +1 -0
  71. package/dist/globals/findVersions.js +11 -0
  72. package/dist/globals/findVersions.js.map +1 -0
  73. package/dist/globals/restoreVersion.d.ts +32 -0
  74. package/dist/globals/restoreVersion.d.ts.map +1 -0
  75. package/dist/globals/restoreVersion.js +12 -0
  76. package/dist/globals/restoreVersion.js.map +1 -0
  77. package/dist/globals/update.d.ts +44 -0
  78. package/dist/globals/update.d.ts.map +1 -0
  79. package/dist/globals/update.js +13 -0
  80. package/dist/globals/update.js.map +1 -0
  81. package/dist/index.d.ts +148 -0
  82. package/dist/index.d.ts.map +1 -0
  83. package/dist/index.js +144 -0
  84. package/dist/index.js.map +1 -0
  85. package/dist/types.d.ts +84 -0
  86. package/dist/types.d.ts.map +1 -0
  87. package/dist/types.js +3 -0
  88. package/dist/types.js.map +1 -0
  89. package/dist/utilities/buildSearchParams.d.ts +16 -0
  90. package/dist/utilities/buildSearchParams.d.ts.map +1 -0
  91. package/dist/utilities/buildSearchParams.js +46 -0
  92. package/dist/utilities/buildSearchParams.js.map +1 -0
  93. package/dist/utilities/resolveFileFromOptions.d.ts +2 -0
  94. package/dist/utilities/resolveFileFromOptions.d.ts.map +1 -0
  95. package/dist/utilities/resolveFileFromOptions.js +16 -0
  96. package/dist/utilities/resolveFileFromOptions.js.map +1 -0
  97. package/license.md +22 -0
  98. package/package.json +53 -0
@@ -0,0 +1,23 @@
1
+ export async function findByID(sdk, options, init) {
2
+ try {
3
+ const response = await sdk.request({
4
+ args: options,
5
+ init,
6
+ method: 'GET',
7
+ path: `/${options.collection}/${options.id}`
8
+ });
9
+ if (response.ok) {
10
+ return response.json();
11
+ } else {
12
+ throw new Error();
13
+ }
14
+ } catch {
15
+ if (options.disableErrors) {
16
+ // @ts-expect-error generic nullable
17
+ return null;
18
+ }
19
+ throw new Error(`Error retrieving the document ${options.collection}/${options.id}`);
20
+ }
21
+ }
22
+
23
+ //# sourceMappingURL=findByID.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/collections/findByID.ts"],"sourcesContent":["import type { ApplyDisableErrors, SelectType } from 'payload'\n\nimport type { PayloadSDK } from '../index.js'\nimport type {\n CollectionSlug,\n JoinQuery,\n PayloadGeneratedTypes,\n PopulateType,\n TransformCollectionWithSelect,\n TypedLocale,\n} from '../types.js'\n\nexport type FindByIDOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n TDisableErrors extends boolean,\n TSelect extends SelectType,\n> = {\n /**\n * the Collection slug to operate against.\n */\n collection: 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`, errors will not be thrown.\n * `null` will be returned instead, if the document on this ID was not found.\n */\n disableErrors?: TDisableErrors\n /**\n * Whether the document should be queried from the versions table/collection or not. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\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<T>\n /**\n * The ID of the document to find.\n */\n id: number | string\n /**\n * The [Join Field Query](https://payloadcms.com/docs/fields/join#query-options).\n * Pass `false` to disable all join fields from the result.\n */\n joins?: JoinQuery<T, TSlug>\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale<T>\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<T>\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\nexport async function findByID<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n TDisableErrors extends boolean,\n TSelect extends SelectType,\n>(\n sdk: PayloadSDK<T>,\n options: FindByIDOptions<T, TSlug, TDisableErrors, TSelect>,\n init?: RequestInit,\n): Promise<ApplyDisableErrors<TransformCollectionWithSelect<T, TSlug, TSelect>, TDisableErrors>> {\n try {\n const response = await sdk.request({\n args: options,\n init,\n method: 'GET',\n path: `/${options.collection}/${options.id}`,\n })\n\n if (response.ok) {\n return response.json()\n } else {\n throw new Error()\n }\n } catch {\n if (options.disableErrors) {\n // @ts-expect-error generic nullable\n return null\n }\n\n throw new Error(`Error retrieving the document ${options.collection}/${options.id}`)\n }\n}\n"],"names":["findByID","sdk","options","init","response","request","args","method","path","collection","id","ok","json","Error","disableErrors"],"mappings":"AA8DA,OAAO,eAAeA,SAMpBC,GAAkB,EAClBC,OAA2D,EAC3DC,IAAkB;IAElB,IAAI;QACF,MAAMC,WAAW,MAAMH,IAAII,OAAO,CAAC;YACjCC,MAAMJ;YACNC;YACAI,QAAQ;YACRC,MAAM,CAAC,CAAC,EAAEN,QAAQO,UAAU,CAAC,CAAC,EAAEP,QAAQQ,EAAE,EAAE;QAC9C;QAEA,IAAIN,SAASO,EAAE,EAAE;YACf,OAAOP,SAASQ,IAAI;QACtB,OAAO;YACL,MAAM,IAAIC;QACZ;IACF,EAAE,OAAM;QACN,IAAIX,QAAQY,aAAa,EAAE;YACzB,oCAAoC;YACpC,OAAO;QACT;QAEA,MAAM,IAAID,MAAM,CAAC,8BAA8B,EAAEX,QAAQO,UAAU,CAAC,CAAC,EAAEP,QAAQQ,EAAE,EAAE;IACrF;AACF"}
@@ -0,0 +1,53 @@
1
+ import type { ApplyDisableErrors, SelectType, TypeWithVersion } from 'payload';
2
+ import type { PayloadSDK } from '../index.js';
3
+ import type { CollectionSlug, DataFromCollectionSlug, PayloadGeneratedTypes, PopulateType, TypedLocale } from '../types.js';
4
+ export type FindVersionByIDOptions<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>, TDisableErrors extends boolean> = {
5
+ /**
6
+ * the Collection slug to operate against.
7
+ */
8
+ collection: TSlug;
9
+ /**
10
+ * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.
11
+ */
12
+ depth?: number;
13
+ /**
14
+ * When set to `true`, errors will not be thrown.
15
+ * `null` will be returned instead, if the document on this ID was not found.
16
+ */
17
+ disableErrors?: TDisableErrors;
18
+ /**
19
+ * Whether the document should be queried from the versions table/collection or not. [More](https://payloadcms.com/docs/versions/drafts#draft-api)
20
+ */
21
+ draft?: boolean;
22
+ /**
23
+ * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.
24
+ */
25
+ fallbackLocale?: false | TypedLocale<T>;
26
+ /**
27
+ * The ID of the version to find.
28
+ */
29
+ id: number | string;
30
+ /**
31
+ * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.
32
+ */
33
+ locale?: 'all' | TypedLocale<T>;
34
+ /**
35
+ * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.
36
+ */
37
+ populate?: PopulateType<T>;
38
+ /**
39
+ * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.
40
+ */
41
+ select?: SelectType;
42
+ /**
43
+ * When set to `true`, the operation will return a document by ID, even if it is trashed (soft-deleted).
44
+ * By default (`false`), the operation will exclude trashed documents.
45
+ * To fetch a trashed document, set `trash: true`.
46
+ *
47
+ * This argument has no effect unless `trash` is enabled on the collection.
48
+ * @default false
49
+ */
50
+ trash?: boolean;
51
+ };
52
+ export declare function findVersionByID<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>, TDisableErrors extends boolean>(sdk: PayloadSDK<T>, options: FindVersionByIDOptions<T, TSlug, TDisableErrors>, init?: RequestInit): Promise<ApplyDisableErrors<TypeWithVersion<DataFromCollectionSlug<T, TSlug>>, TDisableErrors>>;
53
+ //# sourceMappingURL=findVersionByID.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../src/collections/findVersionByID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,YAAY,EACZ,WAAW,EACZ,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,sBAAsB,CAChC,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAC/B,cAAc,SAAS,OAAO,IAC5B;IACF;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,cAAc,CAAA;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;IACvC;;OAEG;IACH,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;IAC/B;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;IAC1B;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,wBAAsB,eAAe,CACnC,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAC/B,cAAc,SAAS,OAAO,EAE9B,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,sBAAsB,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,EACzD,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,kBAAkB,CAAC,eAAe,CAAC,sBAAsB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAsBhG"}
@@ -0,0 +1,23 @@
1
+ export async function findVersionByID(sdk, options, init) {
2
+ try {
3
+ const response = await sdk.request({
4
+ args: options,
5
+ init,
6
+ method: 'GET',
7
+ path: `/${options.collection}/versions/${options.id}`
8
+ });
9
+ if (response.ok) {
10
+ return response.json();
11
+ } else {
12
+ throw new Error();
13
+ }
14
+ } catch {
15
+ if (options.disableErrors) {
16
+ // @ts-expect-error generic nullable
17
+ return null;
18
+ }
19
+ throw new Error(`Error retrieving the version document ${options.collection}/${options.id}`);
20
+ }
21
+ }
22
+
23
+ //# sourceMappingURL=findVersionByID.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/collections/findVersionByID.ts"],"sourcesContent":["import type { ApplyDisableErrors, SelectType, TypeWithVersion } from 'payload'\n\nimport type { PayloadSDK } from '../index.js'\nimport type {\n CollectionSlug,\n DataFromCollectionSlug,\n PayloadGeneratedTypes,\n PopulateType,\n TypedLocale,\n} from '../types.js'\n\nexport type FindVersionByIDOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n TDisableErrors extends boolean,\n> = {\n /**\n * the Collection slug to operate against.\n */\n collection: 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`, errors will not be thrown.\n * `null` will be returned instead, if the document on this ID was not found.\n */\n disableErrors?: TDisableErrors\n /**\n * Whether the document should be queried from the versions table/collection or not. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\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<T>\n /**\n * The ID of the version to find.\n */\n id: number | string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale<T>\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<T>\n /**\n * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.\n */\n select?: SelectType\n /**\n * When set to `true`, the operation will return a document by ID, even if it is trashed (soft-deleted).\n * By default (`false`), the operation will exclude trashed documents.\n * To fetch a trashed document, set `trash: true`.\n *\n * This argument has no effect unless `trash` is enabled on the collection.\n * @default false\n */\n trash?: boolean\n}\n\nexport async function findVersionByID<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n TDisableErrors extends boolean,\n>(\n sdk: PayloadSDK<T>,\n options: FindVersionByIDOptions<T, TSlug, TDisableErrors>,\n init?: RequestInit,\n): Promise<ApplyDisableErrors<TypeWithVersion<DataFromCollectionSlug<T, TSlug>>, TDisableErrors>> {\n try {\n const response = await sdk.request({\n args: options,\n init,\n method: 'GET',\n path: `/${options.collection}/versions/${options.id}`,\n })\n\n if (response.ok) {\n return response.json()\n } else {\n throw new Error()\n }\n } catch {\n if (options.disableErrors) {\n // @ts-expect-error generic nullable\n return null\n }\n\n throw new Error(`Error retrieving the version document ${options.collection}/${options.id}`)\n }\n}\n"],"names":["findVersionByID","sdk","options","init","response","request","args","method","path","collection","id","ok","json","Error","disableErrors"],"mappings":"AAgEA,OAAO,eAAeA,gBAKpBC,GAAkB,EAClBC,OAAyD,EACzDC,IAAkB;IAElB,IAAI;QACF,MAAMC,WAAW,MAAMH,IAAII,OAAO,CAAC;YACjCC,MAAMJ;YACNC;YACAI,QAAQ;YACRC,MAAM,CAAC,CAAC,EAAEN,QAAQO,UAAU,CAAC,UAAU,EAAEP,QAAQQ,EAAE,EAAE;QACvD;QAEA,IAAIN,SAASO,EAAE,EAAE;YACf,OAAOP,SAASQ,IAAI;QACtB,OAAO;YACL,MAAM,IAAIC;QACZ;IACF,EAAE,OAAM;QACN,IAAIX,QAAQY,aAAa,EAAE;YACzB,oCAAoC;YACpC,OAAO;QACT;QAEA,MAAM,IAAID,MAAM,CAAC,sCAAsC,EAAEX,QAAQO,UAAU,CAAC,CAAC,EAAEP,QAAQQ,EAAE,EAAE;IAC7F;AACF"}
@@ -0,0 +1,70 @@
1
+ import type { PaginatedDocs, SelectType, Sort, TypeWithVersion, Where } from 'payload';
2
+ import type { PayloadSDK } from '../index.js';
3
+ import type { CollectionSlug, DataFromCollectionSlug, PayloadGeneratedTypes, PopulateType, TypedLocale } from '../types.js';
4
+ export type FindVersionsOptions<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>> = {
5
+ /**
6
+ * the Collection slug to operate against.
7
+ */
8
+ collection: TSlug;
9
+ /**
10
+ * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.
11
+ */
12
+ depth?: number;
13
+ /**
14
+ * Whether the documents should be queried from the versions table/collection or not. [More](https://payloadcms.com/docs/versions/drafts#draft-api)
15
+ */
16
+ draft?: boolean;
17
+ /**
18
+ * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.
19
+ */
20
+ fallbackLocale?: false | TypedLocale<T>;
21
+ /**
22
+ * The maximum related documents to be returned.
23
+ * Defaults unless `defaultLimit` is specified for the collection config
24
+ * @default 10
25
+ */
26
+ limit?: number;
27
+ /**
28
+ * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.
29
+ */
30
+ locale?: 'all' | TypedLocale<T>;
31
+ /**
32
+ * Get a specific page number
33
+ * @default 1
34
+ */
35
+ page?: number;
36
+ /**
37
+ * Set to `false` to return all documents and avoid querying for document counts which introduces some overhead.
38
+ * You can also combine that property with a specified `limit` to limit documents but avoid the count query.
39
+ */
40
+ pagination?: boolean;
41
+ /**
42
+ * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.
43
+ */
44
+ populate?: PopulateType<T>;
45
+ /**
46
+ * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.
47
+ */
48
+ select?: SelectType;
49
+ /**
50
+ * Sort the documents, can be a string or an array of strings
51
+ * @example '-version.createdAt' // Sort DESC by createdAt
52
+ * @example ['version.group', '-version.createdAt'] // sort by 2 fields, ASC group and DESC createdAt
53
+ */
54
+ sort?: Sort;
55
+ /**
56
+ * When set to `true`, the query will include both normal and trashed (soft-deleted) documents.
57
+ * To query only trashed documents, pass `trash: true` and combine with a `where` clause filtering by `deletedAt`.
58
+ * By default (`false`), the query will only include normal documents and exclude those with a `deletedAt` field.
59
+ *
60
+ * This argument has no effect unless `trash` is enabled on the collection.
61
+ * @default false
62
+ */
63
+ trash?: boolean;
64
+ /**
65
+ * A filter [query](https://payloadcms.com/docs/queries/overview)
66
+ */
67
+ where?: Where;
68
+ };
69
+ export declare function findVersions<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>>(sdk: PayloadSDK<T>, options: FindVersionsOptions<T, TSlug>, init?: RequestInit): Promise<PaginatedDocs<TypeWithVersion<DataFromCollectionSlug<T, TSlug>>>>;
70
+ //# sourceMappingURL=findVersions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../src/collections/findVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEtF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,YAAY,EACZ,WAAW,EACZ,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,mBAAmB,CAC7B,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,IAC7B;IACF;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;IACvC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;IAC/B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;IAC1B;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,CAAA;IACX;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,wBAAsB,YAAY,CAChC,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAE/B,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,mBAAmB,CAAC,CAAC,EAAE,KAAK,CAAC,EACtC,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,sBAAsB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAS3E"}
@@ -0,0 +1,11 @@
1
+ export async function findVersions(sdk, options, init) {
2
+ const response = await sdk.request({
3
+ args: options,
4
+ init,
5
+ method: 'GET',
6
+ path: `/${options.collection}/versions`
7
+ });
8
+ return response.json();
9
+ }
10
+
11
+ //# sourceMappingURL=findVersions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/collections/findVersions.ts"],"sourcesContent":["import type { PaginatedDocs, SelectType, Sort, TypeWithVersion, Where } from 'payload'\n\nimport type { PayloadSDK } from '../index.js'\nimport type {\n CollectionSlug,\n DataFromCollectionSlug,\n PayloadGeneratedTypes,\n PopulateType,\n TypedLocale,\n} from '../types.js'\n\nexport type FindVersionsOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * Whether the documents should be queried from the versions table/collection or not. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\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<T>\n /**\n * The maximum related documents to be returned.\n * Defaults unless `defaultLimit` is specified for the collection config\n * @default 10\n */\n limit?: number\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale<T>\n /**\n * Get a specific page number\n * @default 1\n */\n page?: number\n /**\n * Set to `false` to return all documents and avoid querying for document counts which introduces some overhead.\n * You can also combine that property with a specified `limit` to limit documents but avoid the count query.\n */\n pagination?: 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<T>\n /**\n * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.\n */\n select?: SelectType\n /**\n * Sort the documents, can be a string or an array of strings\n * @example '-version.createdAt' // Sort DESC by createdAt\n * @example ['version.group', '-version.createdAt'] // sort by 2 fields, ASC group and DESC createdAt\n */\n sort?: Sort\n /**\n * When set to `true`, the query will include both normal and trashed (soft-deleted) documents.\n * To query only trashed documents, pass `trash: true` and combine with a `where` clause filtering by `deletedAt`.\n * By default (`false`), the query will only include normal documents and exclude those with a `deletedAt` field.\n *\n * This argument has no effect unless `trash` is enabled on the collection.\n * @default false\n */\n trash?: boolean\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: Where\n}\n\nexport async function findVersions<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n>(\n sdk: PayloadSDK<T>,\n options: FindVersionsOptions<T, TSlug>,\n init?: RequestInit,\n): Promise<PaginatedDocs<TypeWithVersion<DataFromCollectionSlug<T, TSlug>>>> {\n const response = await sdk.request({\n args: options,\n init,\n method: 'GET',\n path: `/${options.collection}/versions`,\n })\n\n return response.json()\n}\n"],"names":["findVersions","sdk","options","init","response","request","args","method","path","collection","json"],"mappings":"AAgFA,OAAO,eAAeA,aAIpBC,GAAkB,EAClBC,OAAsC,EACtCC,IAAkB;IAElB,MAAMC,WAAW,MAAMH,IAAII,OAAO,CAAC;QACjCC,MAAMJ;QACNC;QACAI,QAAQ;QACRC,MAAM,CAAC,CAAC,EAAEN,QAAQO,UAAU,CAAC,SAAS,CAAC;IACzC;IAEA,OAAOL,SAASM,IAAI;AACtB"}
@@ -0,0 +1,34 @@
1
+ import type { PayloadSDK } from '../index.js';
2
+ import type { CollectionSlug, DataFromCollectionSlug, PayloadGeneratedTypes, PopulateType, TypedLocale } from '../types.js';
3
+ export type RestoreVersionByIDOptions<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>> = {
4
+ /**
5
+ * the Collection slug to operate against.
6
+ */
7
+ collection: TSlug;
8
+ /**
9
+ * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.
10
+ */
11
+ depth?: number;
12
+ /**
13
+ * Whether the document should be queried from the versions table/collection or not. [More](https://payloadcms.com/docs/versions/drafts#draft-api)
14
+ */
15
+ draft?: boolean;
16
+ /**
17
+ * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.
18
+ */
19
+ fallbackLocale?: false | TypedLocale<T>;
20
+ /**
21
+ * The ID of the version to restore.
22
+ */
23
+ id: number | string;
24
+ /**
25
+ * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.
26
+ */
27
+ locale?: 'all' | TypedLocale<T>;
28
+ /**
29
+ * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.
30
+ */
31
+ populate?: PopulateType<T>;
32
+ };
33
+ export declare function restoreVersion<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>>(sdk: PayloadSDK<T>, options: RestoreVersionByIDOptions<T, TSlug>, init?: RequestInit): Promise<DataFromCollectionSlug<T, TSlug>>;
34
+ //# sourceMappingURL=restoreVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../src/collections/restoreVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,YAAY,EACZ,WAAW,EACZ,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,yBAAyB,CACnC,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,IAC7B;IACF;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;IACvC;;OAEG;IACH,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;IAC/B;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;CAC3B,CAAA;AAED,wBAAsB,cAAc,CAClC,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAE/B,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,yBAAyB,CAAC,CAAC,EAAE,KAAK,CAAC,EAC5C,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,sBAAsB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAS3C"}
@@ -0,0 +1,11 @@
1
+ export async function restoreVersion(sdk, options, init) {
2
+ const response = await sdk.request({
3
+ args: options,
4
+ init,
5
+ method: 'POST',
6
+ path: `/${options.collection}/versions/${options.id}`
7
+ });
8
+ return response.json();
9
+ }
10
+
11
+ //# sourceMappingURL=restoreVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/collections/restoreVersion.ts"],"sourcesContent":["import type { PayloadSDK } from '../index.js'\nimport type {\n CollectionSlug,\n DataFromCollectionSlug,\n PayloadGeneratedTypes,\n PopulateType,\n TypedLocale,\n} from '../types.js'\n\nexport type RestoreVersionByIDOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * Whether the document should be queried from the versions table/collection or not. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\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<T>\n /**\n * The ID of the version to restore.\n */\n id: number | string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale<T>\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<T>\n}\n\nexport async function restoreVersion<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n>(\n sdk: PayloadSDK<T>,\n options: RestoreVersionByIDOptions<T, TSlug>,\n init?: RequestInit,\n): Promise<DataFromCollectionSlug<T, TSlug>> {\n const response = await sdk.request({\n args: options,\n init,\n method: 'POST',\n path: `/${options.collection}/versions/${options.id}`,\n })\n\n return response.json()\n}\n"],"names":["restoreVersion","sdk","options","init","response","request","args","method","path","collection","id","json"],"mappings":"AA2CA,OAAO,eAAeA,eAIpBC,GAAkB,EAClBC,OAA4C,EAC5CC,IAAkB;IAElB,MAAMC,WAAW,MAAMH,IAAII,OAAO,CAAC;QACjCC,MAAMJ;QACNC;QACAI,QAAQ;QACRC,MAAM,CAAC,CAAC,EAAEN,QAAQO,UAAU,CAAC,UAAU,EAAEP,QAAQQ,EAAE,EAAE;IACvD;IAEA,OAAON,SAASO,IAAI;AACtB"}
@@ -0,0 +1,62 @@
1
+ import type { SelectType, Where } from 'payload';
2
+ import type { DeepPartial } from 'ts-essentials';
3
+ import type { PayloadSDK } from '../index.js';
4
+ import type { BulkOperationResult, CollectionSlug, PayloadGeneratedTypes, PopulateType, RequiredDataFromCollectionSlug, SelectFromCollectionSlug, TransformCollectionWithSelect, TypedLocale, UploadCollectionSlug } from '../types.js';
5
+ export type UpdateBaseOptions<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>, TSelect extends SelectType> = {
6
+ /**
7
+ * Whether the current update should be marked as from autosave.
8
+ * `versions.drafts.autosave` should be specified.
9
+ */
10
+ autosave?: boolean;
11
+ /**
12
+ * the Collection slug to operate against.
13
+ */
14
+ collection: TSlug;
15
+ /**
16
+ * The document / documents data to update.
17
+ */
18
+ data: DeepPartial<RequiredDataFromCollectionSlug<T, TSlug>>;
19
+ /**
20
+ * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.
21
+ */
22
+ depth?: number;
23
+ /**
24
+ * Update documents to a draft.
25
+ */
26
+ draft?: boolean;
27
+ /**
28
+ * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.
29
+ */
30
+ fallbackLocale?: false | TypedLocale<T>;
31
+ /** File Blob object or URL to the file. Only for upload collections */
32
+ file?: TSlug extends UploadCollectionSlug<T> ? Blob | string : never;
33
+ /**
34
+ * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.
35
+ */
36
+ locale?: TypedLocale<T>;
37
+ /**
38
+ * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.
39
+ */
40
+ populate?: PopulateType<T>;
41
+ /**
42
+ * Publish the document / documents with a specific locale.
43
+ */
44
+ publishSpecificLocale?: string;
45
+ /**
46
+ * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.
47
+ */
48
+ select?: TSelect;
49
+ };
50
+ export type UpdateByIDOptions<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>, TSelect extends SelectFromCollectionSlug<T, TSlug>> = {
51
+ id: number | string;
52
+ limit?: never;
53
+ where?: never;
54
+ } & UpdateBaseOptions<T, TSlug, TSelect>;
55
+ export type UpdateManyOptions<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>, TSelect extends SelectFromCollectionSlug<T, TSlug>> = {
56
+ id?: never;
57
+ limit?: number;
58
+ where: Where;
59
+ } & UpdateBaseOptions<T, TSlug, TSelect>;
60
+ export type UpdateOptions<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>, TSelect extends SelectFromCollectionSlug<T, TSlug>> = UpdateByIDOptions<T, TSlug, TSelect> | UpdateManyOptions<T, TSlug, TSelect>;
61
+ export declare function update<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>, TSelect extends SelectFromCollectionSlug<T, TSlug>>(sdk: PayloadSDK<T>, options: UpdateOptions<T, TSlug, TSelect>, init?: RequestInit): Promise<BulkOperationResult<T, TSlug, TSelect> | TransformCollectionWithSelect<T, TSlug, TSelect>>;
62
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/collections/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,8BAA8B,EAC9B,wBAAwB,EACxB,6BAA6B,EAC7B,WAAW,EACX,oBAAoB,EACrB,MAAM,aAAa,CAAA;AAIpB,MAAM,MAAM,iBAAiB,CAC3B,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAC/B,OAAO,SAAS,UAAU,IACxB;IACF;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC,8BAA8B,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA;IAC3D;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;IACvC,uEAAuE;IACvE,IAAI,CAAC,EAAE,KAAK,SAAS,oBAAoB,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,CAAA;IACpE;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAA;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;IAC1B;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,iBAAiB,CAC3B,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAC/B,OAAO,SAAS,wBAAwB,CAAC,CAAC,EAAE,KAAK,CAAC,IAChD;IACF,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,GAAG,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;AAExC,MAAM,MAAM,iBAAiB,CAC3B,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAC/B,OAAO,SAAS,wBAAwB,CAAC,CAAC,EAAE,KAAK,CAAC,IAChD;IACF,EAAE,CAAC,EAAE,KAAK,CAAA;IACV,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,KAAK,CAAA;CACb,GAAG,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;AAExC,MAAM,MAAM,aAAa,CACvB,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAC/B,OAAO,SAAS,wBAAwB,CAAC,CAAC,EAAE,KAAK,CAAC,IAChD,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;AAE/E,wBAAsB,MAAM,CAC1B,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAC/B,OAAO,SAAS,wBAAwB,CAAC,CAAC,EAAE,KAAK,CAAC,EAElD,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,EACzC,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CACR,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,6BAA6B,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAC1F,CAuBA"}
@@ -0,0 +1,22 @@
1
+ import { resolveFileFromOptions } from '../utilities/resolveFileFromOptions.js';
2
+ export async function update(sdk, options, init) {
3
+ let file = undefined;
4
+ if (options.file) {
5
+ file = await resolveFileFromOptions(options.file);
6
+ }
7
+ const response = await sdk.request({
8
+ args: options,
9
+ file,
10
+ init,
11
+ json: options.data,
12
+ method: 'PATCH',
13
+ path: `/${options.collection}${options.id ? `/${options.id}` : ''}`
14
+ });
15
+ const json = await response.json();
16
+ if (options.id) {
17
+ return json.doc;
18
+ }
19
+ return json;
20
+ }
21
+
22
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/collections/update.ts"],"sourcesContent":["import type { SelectType, Where } from 'payload'\nimport type { DeepPartial } from 'ts-essentials'\n\nimport type { PayloadSDK } from '../index.js'\nimport type {\n BulkOperationResult,\n CollectionSlug,\n PayloadGeneratedTypes,\n PopulateType,\n RequiredDataFromCollectionSlug,\n SelectFromCollectionSlug,\n TransformCollectionWithSelect,\n TypedLocale,\n UploadCollectionSlug,\n} from '../types.js'\n\nimport { resolveFileFromOptions } from '../utilities/resolveFileFromOptions.js'\n\nexport type UpdateBaseOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n TSelect extends SelectType,\n> = {\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 * The document / documents data to update.\n */\n data: DeepPartial<RequiredDataFromCollectionSlug<T, TSlug>>\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\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<T>\n /** File Blob object or URL to the file. Only for upload collections */\n file?: TSlug extends UploadCollectionSlug<T> ? Blob | string : never\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: TypedLocale<T>\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<T>\n /**\n * Publish the document / documents with a specific locale.\n */\n publishSpecificLocale?: string\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\nexport type UpdateByIDOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n TSelect extends SelectFromCollectionSlug<T, TSlug>,\n> = {\n id: number | string\n limit?: never\n where?: never\n} & UpdateBaseOptions<T, TSlug, TSelect>\n\nexport type UpdateManyOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n TSelect extends SelectFromCollectionSlug<T, TSlug>,\n> = {\n id?: never\n limit?: number\n where: Where\n} & UpdateBaseOptions<T, TSlug, TSelect>\n\nexport type UpdateOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n TSelect extends SelectFromCollectionSlug<T, TSlug>,\n> = UpdateByIDOptions<T, TSlug, TSelect> | UpdateManyOptions<T, TSlug, TSelect>\n\nexport async function update<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n TSelect extends SelectFromCollectionSlug<T, TSlug>,\n>(\n sdk: PayloadSDK<T>,\n options: UpdateOptions<T, TSlug, TSelect>,\n init?: RequestInit,\n): Promise<\n BulkOperationResult<T, TSlug, TSelect> | TransformCollectionWithSelect<T, TSlug, TSelect>\n> {\n let file: Blob | undefined = undefined\n\n if (options.file) {\n file = await resolveFileFromOptions(options.file)\n }\n\n const response = await sdk.request({\n args: options,\n file,\n init,\n json: options.data,\n method: 'PATCH',\n path: `/${options.collection}${options.id ? `/${options.id}` : ''}`,\n })\n\n const json = await response.json()\n\n if (options.id) {\n return json.doc\n }\n\n return json\n}\n"],"names":["resolveFileFromOptions","update","sdk","options","init","file","undefined","response","request","args","json","data","method","path","collection","id","doc"],"mappings":"AAgBA,SAASA,sBAAsB,QAAQ,yCAAwC;AA8E/E,OAAO,eAAeC,OAKpBC,GAAkB,EAClBC,OAAyC,EACzCC,IAAkB;IAIlB,IAAIC,OAAyBC;IAE7B,IAAIH,QAAQE,IAAI,EAAE;QAChBA,OAAO,MAAML,uBAAuBG,QAAQE,IAAI;IAClD;IAEA,MAAME,WAAW,MAAML,IAAIM,OAAO,CAAC;QACjCC,MAAMN;QACNE;QACAD;QACAM,MAAMP,QAAQQ,IAAI;QAClBC,QAAQ;QACRC,MAAM,CAAC,CAAC,EAAEV,QAAQW,UAAU,GAAGX,QAAQY,EAAE,GAAG,CAAC,CAAC,EAAEZ,QAAQY,EAAE,EAAE,GAAG,IAAI;IACrE;IAEA,MAAML,OAAO,MAAMH,SAASG,IAAI;IAEhC,IAAIP,QAAQY,EAAE,EAAE;QACd,OAAOL,KAAKM,GAAG;IACjB;IAEA,OAAON;AACT"}
@@ -0,0 +1,35 @@
1
+ import type { SelectType } from 'payload';
2
+ import type { PayloadSDK } from '../index.js';
3
+ import type { GlobalSlug, PayloadGeneratedTypes, PopulateType, SelectFromGlobalSlug, TransformGlobalWithSelect, TypedLocale } from '../types.js';
4
+ export type FindGlobalOptions<T extends PayloadGeneratedTypes, TSlug extends GlobalSlug<T>, TSelect extends SelectType> = {
5
+ /**
6
+ * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.
7
+ */
8
+ depth?: number;
9
+ /**
10
+ * Whether the document should be queried from the versions table/collection or not. [More](https://payloadcms.com/docs/versions/drafts#draft-api)
11
+ */
12
+ draft?: boolean;
13
+ /**
14
+ * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.
15
+ */
16
+ fallbackLocale?: false | TypedLocale<T>;
17
+ /**
18
+ * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.
19
+ */
20
+ locale?: 'all' | TypedLocale<T>;
21
+ /**
22
+ * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.
23
+ */
24
+ populate?: PopulateType<T>;
25
+ /**
26
+ * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.
27
+ */
28
+ select?: TSelect;
29
+ /**
30
+ * the Global slug to operate against.
31
+ */
32
+ slug: TSlug;
33
+ };
34
+ export declare function findGlobal<T extends PayloadGeneratedTypes, TSlug extends GlobalSlug<T>, TSelect extends SelectFromGlobalSlug<T, TSlug>>(sdk: PayloadSDK<T>, options: FindGlobalOptions<T, TSlug, TSelect>, init?: RequestInit): Promise<TransformGlobalWithSelect<T, TSlug, TSelect>>;
35
+ //# sourceMappingURL=findOne.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findOne.d.ts","sourceRoot":"","sources":["../../src/globals/findOne.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EACV,UAAU,EACV,qBAAqB,EACrB,YAAY,EACZ,oBAAoB,EACpB,yBAAyB,EACzB,WAAW,EACZ,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,iBAAiB,CAC3B,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,UAAU,CAAC,CAAC,CAAC,EAC3B,OAAO,SAAS,UAAU,IACxB;IACF;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;IACvC;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;IAC/B;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;IAC1B;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;OAEG;IACH,IAAI,EAAE,KAAK,CAAA;CACZ,CAAA;AAED,wBAAsB,UAAU,CAC9B,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,UAAU,CAAC,CAAC,CAAC,EAC3B,OAAO,SAAS,oBAAoB,CAAC,CAAC,EAAE,KAAK,CAAC,EAE9C,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,EAC7C,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,yBAAyB,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CASvD"}
@@ -0,0 +1,11 @@
1
+ export async function findGlobal(sdk, options, init) {
2
+ const response = await sdk.request({
3
+ args: options,
4
+ init,
5
+ method: 'GET',
6
+ path: `/globals/${options.slug}`
7
+ });
8
+ return response.json();
9
+ }
10
+
11
+ //# sourceMappingURL=findOne.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/globals/findOne.ts"],"sourcesContent":["import type { SelectType } from 'payload'\n\nimport type { PayloadSDK } from '../index.js'\nimport type {\n GlobalSlug,\n PayloadGeneratedTypes,\n PopulateType,\n SelectFromGlobalSlug,\n TransformGlobalWithSelect,\n TypedLocale,\n} from '../types.js'\n\nexport type FindGlobalOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends GlobalSlug<T>,\n TSelect extends SelectType,\n> = {\n /**\n * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.\n */\n depth?: number\n /**\n * Whether the document should be queried from the versions table/collection or not. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\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<T>\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale<T>\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<T>\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 * the Global slug to operate against.\n */\n slug: TSlug\n}\n\nexport async function findGlobal<\n T extends PayloadGeneratedTypes,\n TSlug extends GlobalSlug<T>,\n TSelect extends SelectFromGlobalSlug<T, TSlug>,\n>(\n sdk: PayloadSDK<T>,\n options: FindGlobalOptions<T, TSlug, TSelect>,\n init?: RequestInit,\n): Promise<TransformGlobalWithSelect<T, TSlug, TSelect>> {\n const response = await sdk.request({\n args: options,\n init,\n method: 'GET',\n path: `/globals/${options.slug}`,\n })\n\n return response.json()\n}\n"],"names":["findGlobal","sdk","options","init","response","request","args","method","path","slug","json"],"mappings":"AA+CA,OAAO,eAAeA,WAKpBC,GAAkB,EAClBC,OAA6C,EAC7CC,IAAkB;IAElB,MAAMC,WAAW,MAAMH,IAAII,OAAO,CAAC;QACjCC,MAAMJ;QACNC;QACAI,QAAQ;QACRC,MAAM,CAAC,SAAS,EAAEN,QAAQO,IAAI,EAAE;IAClC;IAEA,OAAOL,SAASM,IAAI;AACtB"}
@@ -0,0 +1,41 @@
1
+ import type { ApplyDisableErrors, SelectType, TypeWithVersion } from 'payload';
2
+ import type { PayloadSDK } from '../index.js';
3
+ import type { DataFromGlobalSlug, GlobalSlug, PayloadGeneratedTypes, PopulateType, TypedLocale } from '../types.js';
4
+ export type FindGlobalVersionByIDOptions<T extends PayloadGeneratedTypes, TSlug extends GlobalSlug<T>, TDisableErrors extends boolean> = {
5
+ /**
6
+ * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.
7
+ */
8
+ depth?: number;
9
+ /**
10
+ * When set to `true`, errors will not be thrown.
11
+ * `null` will be returned instead, if the document on this ID was not found.
12
+ */
13
+ disableErrors?: TDisableErrors;
14
+ draft?: boolean;
15
+ /**
16
+ * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.
17
+ */
18
+ fallbackLocale?: false | TypedLocale<T>;
19
+ /**
20
+ * The ID of the version to find.
21
+ */
22
+ id: number | string;
23
+ /**
24
+ * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.
25
+ */
26
+ locale?: 'all' | TypedLocale<T>;
27
+ /**
28
+ * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.
29
+ */
30
+ populate?: PopulateType<T>;
31
+ /**
32
+ * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.
33
+ */
34
+ select?: SelectType;
35
+ /**
36
+ * the Global slug to operate against.
37
+ */
38
+ slug: TSlug;
39
+ };
40
+ export declare function findGlobalVersionByID<T extends PayloadGeneratedTypes, TSlug extends GlobalSlug<T>, TDisableErrors extends boolean>(sdk: PayloadSDK<T>, options: FindGlobalVersionByIDOptions<T, TSlug, TDisableErrors>, init?: RequestInit): Promise<ApplyDisableErrors<TypeWithVersion<DataFromGlobalSlug<T, TSlug>>, TDisableErrors>>;
41
+ //# sourceMappingURL=findVersionByID.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../src/globals/findVersionByID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,EACV,qBAAqB,EACrB,YAAY,EACZ,WAAW,EACZ,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,4BAA4B,CACtC,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,UAAU,CAAC,CAAC,CAAC,EAC3B,cAAc,SAAS,OAAO,IAC5B;IACF;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,cAAc,CAAA;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;IACvC;;OAEG;IACH,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;IAC/B;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;IAC1B;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB;;OAEG;IACH,IAAI,EAAE,KAAK,CAAA;CACZ,CAAA;AAED,wBAAsB,qBAAqB,CACzC,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,UAAU,CAAC,CAAC,CAAC,EAC3B,cAAc,SAAS,OAAO,EAE9B,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,4BAA4B,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,EAC/D,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,kBAAkB,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAsB5F"}
@@ -0,0 +1,23 @@
1
+ export async function findGlobalVersionByID(sdk, options, init) {
2
+ try {
3
+ const response = await sdk.request({
4
+ args: options,
5
+ init,
6
+ method: 'GET',
7
+ path: `/globals/${options.slug}/versions/${options.id}`
8
+ });
9
+ if (response.ok) {
10
+ return response.json();
11
+ } else {
12
+ throw new Error();
13
+ }
14
+ } catch {
15
+ if (options.disableErrors) {
16
+ // @ts-expect-error generic nullable
17
+ return null;
18
+ }
19
+ throw new Error(`Error retrieving the version document ${options.slug}/${options.id}`);
20
+ }
21
+ }
22
+
23
+ //# sourceMappingURL=findVersionByID.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/globals/findVersionByID.ts"],"sourcesContent":["import type { ApplyDisableErrors, SelectType, TypeWithVersion } from 'payload'\n\nimport type { PayloadSDK } from '../index.js'\nimport type {\n DataFromGlobalSlug,\n GlobalSlug,\n PayloadGeneratedTypes,\n PopulateType,\n TypedLocale,\n} from '../types.js'\n\nexport type FindGlobalVersionByIDOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends GlobalSlug<T>,\n TDisableErrors extends boolean,\n> = {\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`, errors will not be thrown.\n * `null` will be returned instead, if the document on this ID was not found.\n */\n disableErrors?: TDisableErrors\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<T>\n /**\n * The ID of the version to find.\n */\n id: number | string\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale<T>\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<T>\n /**\n * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.\n */\n select?: SelectType\n /**\n * the Global slug to operate against.\n */\n slug: TSlug\n}\n\nexport async function findGlobalVersionByID<\n T extends PayloadGeneratedTypes,\n TSlug extends GlobalSlug<T>,\n TDisableErrors extends boolean,\n>(\n sdk: PayloadSDK<T>,\n options: FindGlobalVersionByIDOptions<T, TSlug, TDisableErrors>,\n init?: RequestInit,\n): Promise<ApplyDisableErrors<TypeWithVersion<DataFromGlobalSlug<T, TSlug>>, TDisableErrors>> {\n try {\n const response = await sdk.request({\n args: options,\n init,\n method: 'GET',\n path: `/globals/${options.slug}/versions/${options.id}`,\n })\n\n if (response.ok) {\n return response.json()\n } else {\n throw new Error()\n }\n } catch {\n if (options.disableErrors) {\n // @ts-expect-error generic nullable\n return null\n }\n\n throw new Error(`Error retrieving the version document ${options.slug}/${options.id}`)\n }\n}\n"],"names":["findGlobalVersionByID","sdk","options","init","response","request","args","method","path","slug","id","ok","json","Error","disableErrors"],"mappings":"AAoDA,OAAO,eAAeA,sBAKpBC,GAAkB,EAClBC,OAA+D,EAC/DC,IAAkB;IAElB,IAAI;QACF,MAAMC,WAAW,MAAMH,IAAII,OAAO,CAAC;YACjCC,MAAMJ;YACNC;YACAI,QAAQ;YACRC,MAAM,CAAC,SAAS,EAAEN,QAAQO,IAAI,CAAC,UAAU,EAAEP,QAAQQ,EAAE,EAAE;QACzD;QAEA,IAAIN,SAASO,EAAE,EAAE;YACf,OAAOP,SAASQ,IAAI;QACtB,OAAO;YACL,MAAM,IAAIC;QACZ;IACF,EAAE,OAAM;QACN,IAAIX,QAAQY,aAAa,EAAE;YACzB,oCAAoC;YACpC,OAAO;QACT;QAEA,MAAM,IAAID,MAAM,CAAC,sCAAsC,EAAEX,QAAQO,IAAI,CAAC,CAAC,EAAEP,QAAQQ,EAAE,EAAE;IACvF;AACF"}
@@ -0,0 +1,58 @@
1
+ import type { PaginatedDocs, SelectType, Sort, TypeWithVersion, Where } from 'payload';
2
+ import type { PayloadSDK } from '../index.js';
3
+ import type { DataFromGlobalSlug, GlobalSlug, PayloadGeneratedTypes, PopulateType, TypedLocale } from '../types.js';
4
+ export type FindGlobalVersionsOptions<T extends PayloadGeneratedTypes, TSlug extends GlobalSlug<T>> = {
5
+ /**
6
+ * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.
7
+ */
8
+ depth?: number;
9
+ draft?: boolean;
10
+ /**
11
+ * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.
12
+ */
13
+ fallbackLocale?: false | TypedLocale<T>;
14
+ /**
15
+ * The maximum related documents to be returned.
16
+ * Defaults unless `defaultLimit` is specified for the collection config
17
+ * @default 10
18
+ */
19
+ limit?: number;
20
+ /**
21
+ * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.
22
+ */
23
+ locale?: 'all' | TypedLocale<T>;
24
+ /**
25
+ * Get a specific page number
26
+ * @default 1
27
+ */
28
+ page?: number;
29
+ /**
30
+ * Set to `false` to return all documents and avoid querying for document counts which introduces some overhead.
31
+ * You can also combine that property with a specified `limit` to limit documents but avoid the count query.
32
+ */
33
+ pagination?: boolean;
34
+ /**
35
+ * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.
36
+ */
37
+ populate?: PopulateType<T>;
38
+ /**
39
+ * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.
40
+ */
41
+ select?: SelectType;
42
+ /**
43
+ * the Global slug to operate against.
44
+ */
45
+ slug: TSlug;
46
+ /**
47
+ * Sort the documents, can be a string or an array of strings
48
+ * @example '-version.createdAt' // Sort DESC by createdAt
49
+ * @example ['version.group', '-version.createdAt'] // sort by 2 fields, ASC group and DESC createdAt
50
+ */
51
+ sort?: Sort;
52
+ /**
53
+ * A filter [query](https://payloadcms.com/docs/queries/overview)
54
+ */
55
+ where?: Where;
56
+ };
57
+ export declare function findGlobalVersions<T extends PayloadGeneratedTypes, TSlug extends GlobalSlug<T>>(sdk: PayloadSDK<T>, options: FindGlobalVersionsOptions<T, TSlug>, init?: RequestInit): Promise<PaginatedDocs<TypeWithVersion<DataFromGlobalSlug<T, TSlug>>>>;
58
+ //# sourceMappingURL=findVersions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../src/globals/findVersions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEtF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,EACV,qBAAqB,EACrB,YAAY,EACZ,WAAW,EACZ,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,yBAAyB,CACnC,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,UAAU,CAAC,CAAC,CAAC,IACzB;IACF;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;IACvC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;IAC/B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;IAC1B;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB;;OAEG;IACH,IAAI,EAAE,KAAK,CAAA;IACX;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,CAAA;IACX;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,wBAAsB,kBAAkB,CACtC,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,UAAU,CAAC,CAAC,CAAC,EAE3B,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,yBAAyB,CAAC,CAAC,EAAE,KAAK,CAAC,EAC5C,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CASvE"}
@@ -0,0 +1,11 @@
1
+ export async function findGlobalVersions(sdk, options, init) {
2
+ const response = await sdk.request({
3
+ args: options,
4
+ init,
5
+ method: 'GET',
6
+ path: `/globals/${options.slug}/versions`
7
+ });
8
+ return response.json();
9
+ }
10
+
11
+ //# sourceMappingURL=findVersions.js.map