@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,13 @@
1
+ import type { PayloadSDK } from '../index.js';
2
+ import type { AuthCollectionSlug, PayloadGeneratedTypes, TypedAuth } from '../types.js';
3
+ export type ForgotPasswordOptions<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>> = {
4
+ collection: TSlug;
5
+ data: {
6
+ disableEmail?: boolean;
7
+ expiration?: number;
8
+ } & Omit<TypedAuth<T>[TSlug]['forgotPassword'], 'password'>;
9
+ };
10
+ export declare function forgotPassword<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>>(sdk: PayloadSDK<T>, options: ForgotPasswordOptions<T, TSlug>, init?: RequestInit): Promise<{
11
+ message: string;
12
+ }>;
13
+ //# sourceMappingURL=forgotPassword.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forgotPassword.d.ts","sourceRoot":"","sources":["../../src/auth/forgotPassword.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvF,MAAM,MAAM,qBAAqB,CAC/B,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,kBAAkB,CAAC,CAAC,CAAC,IACjC;IACF,UAAU,EAAE,KAAK,CAAA;IACjB,IAAI,EAAE;QACJ,YAAY,CAAC,EAAE,OAAO,CAAA;QACtB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC,CAAA;CAC5D,CAAA;AAED,wBAAsB,cAAc,CAClC,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,kBAAkB,CAAC,CAAC,CAAC,EAEnC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,qBAAqB,CAAC,CAAC,EAAE,KAAK,CAAC,EACxC,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAS9B"}
@@ -0,0 +1,11 @@
1
+ export async function forgotPassword(sdk, options, init) {
2
+ const response = await sdk.request({
3
+ init,
4
+ json: options.data,
5
+ method: 'POST',
6
+ path: `/${options.collection}/forgot-password`
7
+ });
8
+ return response.json();
9
+ }
10
+
11
+ //# sourceMappingURL=forgotPassword.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/auth/forgotPassword.ts"],"sourcesContent":["import type { PayloadSDK } from '../index.js'\nimport type { AuthCollectionSlug, PayloadGeneratedTypes, TypedAuth } from '../types.js'\n\nexport type ForgotPasswordOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends AuthCollectionSlug<T>,\n> = {\n collection: TSlug\n data: {\n disableEmail?: boolean\n expiration?: number\n } & Omit<TypedAuth<T>[TSlug]['forgotPassword'], 'password'>\n}\n\nexport async function forgotPassword<\n T extends PayloadGeneratedTypes,\n TSlug extends AuthCollectionSlug<T>,\n>(\n sdk: PayloadSDK<T>,\n options: ForgotPasswordOptions<T, TSlug>,\n init?: RequestInit,\n): Promise<{ message: string }> {\n const response = await sdk.request({\n init,\n json: options.data,\n method: 'POST',\n path: `/${options.collection}/forgot-password`,\n })\n\n return response.json()\n}\n"],"names":["forgotPassword","sdk","options","init","response","request","json","data","method","path","collection"],"mappings":"AAcA,OAAO,eAAeA,eAIpBC,GAAkB,EAClBC,OAAwC,EACxCC,IAAkB;IAElB,MAAMC,WAAW,MAAMH,IAAII,OAAO,CAAC;QACjCF;QACAG,MAAMJ,QAAQK,IAAI;QAClBC,QAAQ;QACRC,MAAM,CAAC,CAAC,EAAEP,QAAQQ,UAAU,CAAC,gBAAgB,CAAC;IAChD;IAEA,OAAON,SAASE,IAAI;AACtB"}
@@ -0,0 +1,14 @@
1
+ import type { PayloadSDK } from '../index.js';
2
+ import type { AuthCollectionSlug, DataFromCollectionSlug, PayloadGeneratedTypes, TypedAuth } from '../types.js';
3
+ export type LoginOptions<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>> = {
4
+ collection: TSlug;
5
+ data: TypedAuth<T>[TSlug]['login'];
6
+ };
7
+ export type LoginResult<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>> = {
8
+ exp?: number;
9
+ message: string;
10
+ token?: string;
11
+ user: DataFromCollectionSlug<T, TSlug>;
12
+ };
13
+ export declare function login<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>>(sdk: PayloadSDK<T>, options: LoginOptions<T, TSlug>, init?: RequestInit): Promise<LoginResult<T, TSlug>>;
14
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,SAAS,EACV,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,qBAAqB,EAAE,KAAK,SAAS,kBAAkB,CAAC,CAAC,CAAC,IAAI;IAC/F,UAAU,EAAE,KAAK,CAAA;IACjB,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAA;CACnC,CAAA;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,qBAAqB,EAAE,KAAK,SAAS,kBAAkB,CAAC,CAAC,CAAC,IAAI;IAC9F,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd,IAAI,EAAE,sBAAsB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;CACvC,CAAA;AAED,wBAAsB,KAAK,CAAC,CAAC,SAAS,qBAAqB,EAAE,KAAK,SAAS,kBAAkB,CAAC,CAAC,CAAC,EAC9F,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC,EAC/B,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAShC"}
@@ -0,0 +1,11 @@
1
+ export async function login(sdk, options, init) {
2
+ const response = await sdk.request({
3
+ init,
4
+ json: options.data,
5
+ method: 'POST',
6
+ path: `/${options.collection}/login`
7
+ });
8
+ return response.json();
9
+ }
10
+
11
+ //# sourceMappingURL=login.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/auth/login.ts"],"sourcesContent":["import type { PayloadSDK } from '../index.js'\nimport type {\n AuthCollectionSlug,\n DataFromCollectionSlug,\n PayloadGeneratedTypes,\n TypedAuth,\n} from '../types.js'\n\nexport type LoginOptions<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>> = {\n collection: TSlug\n data: TypedAuth<T>[TSlug]['login']\n}\n\nexport type LoginResult<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>> = {\n exp?: number\n message: string\n token?: string\n // @ts-expect-error auth collection and user collection\n user: DataFromCollectionSlug<T, TSlug>\n}\n\nexport async function login<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>>(\n sdk: PayloadSDK<T>,\n options: LoginOptions<T, TSlug>,\n init?: RequestInit,\n): Promise<LoginResult<T, TSlug>> {\n const response = await sdk.request({\n init,\n json: options.data,\n method: 'POST',\n path: `/${options.collection}/login`,\n })\n\n return response.json()\n}\n"],"names":["login","sdk","options","init","response","request","json","data","method","path","collection"],"mappings":"AAqBA,OAAO,eAAeA,MACpBC,GAAkB,EAClBC,OAA+B,EAC/BC,IAAkB;IAElB,MAAMC,WAAW,MAAMH,IAAII,OAAO,CAAC;QACjCF;QACAG,MAAMJ,QAAQK,IAAI;QAClBC,QAAQ;QACRC,MAAM,CAAC,CAAC,EAAEP,QAAQQ,UAAU,CAAC,MAAM,CAAC;IACtC;IAEA,OAAON,SAASE,IAAI;AACtB"}
@@ -0,0 +1,15 @@
1
+ import type { PayloadSDK } from '../index.js';
2
+ import type { AuthCollectionSlug, DataFromCollectionSlug, PayloadGeneratedTypes } from '../types.js';
3
+ export type MeOptions<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>> = {
4
+ collection: TSlug;
5
+ };
6
+ export type MeResult<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>> = {
7
+ collection?: TSlug;
8
+ exp?: number;
9
+ message: string;
10
+ strategy?: string;
11
+ token?: string;
12
+ user: DataFromCollectionSlug<T, TSlug>;
13
+ };
14
+ export declare function me<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>>(sdk: PayloadSDK<T>, options: MeOptions<T, TSlug>, init?: RequestInit): Promise<MeResult<T, TSlug>>;
15
+ //# sourceMappingURL=me.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../src/auth/me.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAEpG,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,qBAAqB,EAAE,KAAK,SAAS,kBAAkB,CAAC,CAAC,CAAC,IAAI;IAC5F,UAAU,EAAE,KAAK,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,qBAAqB,EAAE,KAAK,SAAS,kBAAkB,CAAC,CAAC,CAAC,IAAI;IAC3F,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd,IAAI,EAAE,sBAAsB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;CACvC,CAAA;AAED,wBAAsB,EAAE,CAAC,CAAC,SAAS,qBAAqB,EAAE,KAAK,SAAS,kBAAkB,CAAC,CAAC,CAAC,EAC3F,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,EAC5B,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAQ7B"}
@@ -0,0 +1,10 @@
1
+ export async function me(sdk, options, init) {
2
+ const response = await sdk.request({
3
+ init,
4
+ method: 'GET',
5
+ path: `/${options.collection}/me`
6
+ });
7
+ return response.json();
8
+ }
9
+
10
+ //# sourceMappingURL=me.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/auth/me.ts"],"sourcesContent":["import type { PayloadSDK } from '../index.js'\nimport type { AuthCollectionSlug, DataFromCollectionSlug, PayloadGeneratedTypes } from '../types.js'\n\nexport type MeOptions<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>> = {\n collection: TSlug\n}\n\nexport type MeResult<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>> = {\n collection?: TSlug\n exp?: number\n message: string\n strategy?: string\n token?: string\n // @ts-expect-error auth collection and user collection\n user: DataFromCollectionSlug<T, TSlug>\n}\n\nexport async function me<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>>(\n sdk: PayloadSDK<T>,\n options: MeOptions<T, TSlug>,\n init?: RequestInit,\n): Promise<MeResult<T, TSlug>> {\n const response = await sdk.request({\n init,\n method: 'GET',\n path: `/${options.collection}/me`,\n })\n\n return response.json()\n}\n"],"names":["me","sdk","options","init","response","request","method","path","collection","json"],"mappings":"AAiBA,OAAO,eAAeA,GACpBC,GAAkB,EAClBC,OAA4B,EAC5BC,IAAkB;IAElB,MAAMC,WAAW,MAAMH,IAAII,OAAO,CAAC;QACjCF;QACAG,QAAQ;QACRC,MAAM,CAAC,CAAC,EAAEL,QAAQM,UAAU,CAAC,GAAG,CAAC;IACnC;IAEA,OAAOJ,SAASK,IAAI;AACtB"}
@@ -0,0 +1,14 @@
1
+ import type { PayloadSDK } from '../index.js';
2
+ import type { AuthCollectionSlug, DataFromCollectionSlug, PayloadGeneratedTypes } from '../types.js';
3
+ export type RefreshOptions<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>> = {
4
+ collection: TSlug;
5
+ };
6
+ export type RefreshResult<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>> = {
7
+ exp: number;
8
+ refreshedToken: string;
9
+ setCookie?: boolean;
10
+ strategy?: string;
11
+ user: DataFromCollectionSlug<T, TSlug>;
12
+ };
13
+ export declare function refreshToken<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>>(sdk: PayloadSDK<T>, options: RefreshOptions<T, TSlug>, init?: RequestInit): Promise<RefreshResult<T, TSlug>>;
14
+ //# sourceMappingURL=refreshToken.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refreshToken.d.ts","sourceRoot":"","sources":["../../src/auth/refreshToken.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAEpG,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,qBAAqB,EAAE,KAAK,SAAS,kBAAkB,CAAC,CAAC,CAAC,IAAI;IACjG,UAAU,EAAE,KAAK,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,qBAAqB,EAAE,KAAK,SAAS,kBAAkB,CAAC,CAAC,CAAC,IAAI;IAChG,GAAG,EAAE,MAAM,CAAA;IACX,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB,IAAI,EAAE,sBAAsB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;CACvC,CAAA;AAED,wBAAsB,YAAY,CAChC,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,kBAAkB,CAAC,CAAC,CAAC,EAEnC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,cAAc,CAAC,CAAC,EAAE,KAAK,CAAC,EACjC,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAQlC"}
@@ -0,0 +1,10 @@
1
+ export async function refreshToken(sdk, options, init) {
2
+ const response = await sdk.request({
3
+ init,
4
+ method: 'POST',
5
+ path: `/${options.collection}/refresh-token`
6
+ });
7
+ return response.json();
8
+ }
9
+
10
+ //# sourceMappingURL=refreshToken.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/auth/refreshToken.ts"],"sourcesContent":["import type { PayloadSDK } from '../index.js'\nimport type { AuthCollectionSlug, DataFromCollectionSlug, PayloadGeneratedTypes } from '../types.js'\n\nexport type RefreshOptions<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>> = {\n collection: TSlug\n}\n\nexport type RefreshResult<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>> = {\n exp: number\n refreshedToken: string\n setCookie?: boolean\n strategy?: string\n // @ts-expect-error auth collection and user collection\n user: DataFromCollectionSlug<T, TSlug>\n}\n\nexport async function refreshToken<\n T extends PayloadGeneratedTypes,\n TSlug extends AuthCollectionSlug<T>,\n>(\n sdk: PayloadSDK<T>,\n options: RefreshOptions<T, TSlug>,\n init?: RequestInit,\n): Promise<RefreshResult<T, TSlug>> {\n const response = await sdk.request({\n init,\n method: 'POST',\n path: `/${options.collection}/refresh-token`,\n })\n\n return response.json()\n}\n"],"names":["refreshToken","sdk","options","init","response","request","method","path","collection","json"],"mappings":"AAgBA,OAAO,eAAeA,aAIpBC,GAAkB,EAClBC,OAAiC,EACjCC,IAAkB;IAElB,MAAMC,WAAW,MAAMH,IAAII,OAAO,CAAC;QACjCF;QACAG,QAAQ;QACRC,MAAM,CAAC,CAAC,EAAEL,QAAQM,UAAU,CAAC,cAAc,CAAC;IAC9C;IAEA,OAAOJ,SAASK,IAAI;AACtB"}
@@ -0,0 +1,15 @@
1
+ import type { PayloadSDK } from '../index.js';
2
+ import type { AuthCollectionSlug, DataFromCollectionSlug, PayloadGeneratedTypes } from '../types.js';
3
+ export type ResetPasswordOptions<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>> = {
4
+ collection: TSlug;
5
+ data: {
6
+ password: string;
7
+ token: string;
8
+ };
9
+ };
10
+ export type ResetPasswordResult<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>> = {
11
+ token?: string;
12
+ user: DataFromCollectionSlug<T, TSlug>;
13
+ };
14
+ export declare function resetPassword<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>>(sdk: PayloadSDK<T>, options: ResetPasswordOptions<T, TSlug>, init?: RequestInit): Promise<ResetPasswordResult<T, TSlug>>;
15
+ //# sourceMappingURL=resetPassword.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resetPassword.d.ts","sourceRoot":"","sources":["../../src/auth/resetPassword.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAEpG,MAAM,MAAM,oBAAoB,CAC9B,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,kBAAkB,CAAC,CAAC,CAAC,IACjC;IACF,UAAU,EAAE,KAAK,CAAA;IACjB,IAAI,EAAE;QACJ,QAAQ,EAAE,MAAM,CAAA;QAChB,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;CACF,CAAA;AAED,MAAM,MAAM,mBAAmB,CAC7B,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,kBAAkB,CAAC,CAAC,CAAC,IACjC;IACF,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd,IAAI,EAAE,sBAAsB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;CACvC,CAAA;AAED,wBAAsB,aAAa,CACjC,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,kBAAkB,CAAC,CAAC,CAAC,EAEnC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,oBAAoB,CAAC,CAAC,EAAE,KAAK,CAAC,EACvC,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,mBAAmB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CASxC"}
@@ -0,0 +1,11 @@
1
+ export async function resetPassword(sdk, options, init) {
2
+ const response = await sdk.request({
3
+ init,
4
+ json: options.data,
5
+ method: 'POST',
6
+ path: `/${options.collection}/reset-password`
7
+ });
8
+ return response.json();
9
+ }
10
+
11
+ //# sourceMappingURL=resetPassword.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/auth/resetPassword.ts"],"sourcesContent":["import type { PayloadSDK } from '../index.js'\nimport type { AuthCollectionSlug, DataFromCollectionSlug, PayloadGeneratedTypes } from '../types.js'\n\nexport type ResetPasswordOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends AuthCollectionSlug<T>,\n> = {\n collection: TSlug\n data: {\n password: string\n token: string\n }\n}\n\nexport type ResetPasswordResult<\n T extends PayloadGeneratedTypes,\n TSlug extends AuthCollectionSlug<T>,\n> = {\n token?: string\n // @ts-expect-error auth collection and user collection\n user: DataFromCollectionSlug<T, TSlug>\n}\n\nexport async function resetPassword<\n T extends PayloadGeneratedTypes,\n TSlug extends AuthCollectionSlug<T>,\n>(\n sdk: PayloadSDK<T>,\n options: ResetPasswordOptions<T, TSlug>,\n init?: RequestInit,\n): Promise<ResetPasswordResult<T, TSlug>> {\n const response = await sdk.request({\n init,\n json: options.data,\n method: 'POST',\n path: `/${options.collection}/reset-password`,\n })\n\n return response.json()\n}\n"],"names":["resetPassword","sdk","options","init","response","request","json","data","method","path","collection"],"mappings":"AAuBA,OAAO,eAAeA,cAIpBC,GAAkB,EAClBC,OAAuC,EACvCC,IAAkB;IAElB,MAAMC,WAAW,MAAMH,IAAII,OAAO,CAAC;QACjCF;QACAG,MAAMJ,QAAQK,IAAI;QAClBC,QAAQ;QACRC,MAAM,CAAC,CAAC,EAAEP,QAAQQ,UAAU,CAAC,eAAe,CAAC;IAC/C;IAEA,OAAON,SAASE,IAAI;AACtB"}
@@ -0,0 +1,10 @@
1
+ import type { PayloadSDK } from '../index.js';
2
+ import type { AuthCollectionSlug, PayloadGeneratedTypes } from '../types.js';
3
+ export type VerifyEmailOptions<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>> = {
4
+ collection: TSlug;
5
+ token: string;
6
+ };
7
+ export declare function verifyEmail<T extends PayloadGeneratedTypes, TSlug extends AuthCollectionSlug<T>>(sdk: PayloadSDK<T>, options: VerifyEmailOptions<T, TSlug>, init?: RequestInit): Promise<{
8
+ message: string;
9
+ }>;
10
+ //# sourceMappingURL=verifyEmail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyEmail.d.ts","sourceRoot":"","sources":["../../src/auth/verifyEmail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAE5E,MAAM,MAAM,kBAAkB,CAC5B,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,kBAAkB,CAAC,CAAC,CAAC,IACjC;IACF,UAAU,EAAE,KAAK,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,wBAAsB,WAAW,CAC/B,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,kBAAkB,CAAC,CAAC,CAAC,EAEnC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,kBAAkB,CAAC,CAAC,EAAE,KAAK,CAAC,EACrC,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAQ9B"}
@@ -0,0 +1,10 @@
1
+ export async function verifyEmail(sdk, options, init) {
2
+ const response = await sdk.request({
3
+ init,
4
+ method: 'POST',
5
+ path: `/${options.collection}/verify/${options.token}`
6
+ });
7
+ return response.json();
8
+ }
9
+
10
+ //# sourceMappingURL=verifyEmail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/auth/verifyEmail.ts"],"sourcesContent":["import type { PayloadSDK } from '../index.js'\nimport type { AuthCollectionSlug, PayloadGeneratedTypes } from '../types.js'\n\nexport type VerifyEmailOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends AuthCollectionSlug<T>,\n> = {\n collection: TSlug\n token: string\n}\n\nexport async function verifyEmail<\n T extends PayloadGeneratedTypes,\n TSlug extends AuthCollectionSlug<T>,\n>(\n sdk: PayloadSDK<T>,\n options: VerifyEmailOptions<T, TSlug>,\n init?: RequestInit,\n): Promise<{ message: string }> {\n const response = await sdk.request({\n init,\n method: 'POST',\n path: `/${options.collection}/verify/${options.token}`,\n })\n\n return response.json()\n}\n"],"names":["verifyEmail","sdk","options","init","response","request","method","path","collection","token","json"],"mappings":"AAWA,OAAO,eAAeA,YAIpBC,GAAkB,EAClBC,OAAqC,EACrCC,IAAkB;IAElB,MAAMC,WAAW,MAAMH,IAAII,OAAO,CAAC;QACjCF;QACAG,QAAQ;QACRC,MAAM,CAAC,CAAC,EAAEL,QAAQM,UAAU,CAAC,QAAQ,EAAEN,QAAQO,KAAK,EAAE;IACxD;IAEA,OAAOL,SAASM,IAAI;AACtB"}
@@ -0,0 +1,21 @@
1
+ import type { Where } from 'payload';
2
+ import type { PayloadSDK } from '../index.js';
3
+ import type { CollectionSlug, PayloadGeneratedTypes, TypedLocale } from '../types.js';
4
+ export type CountOptions<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>> = {
5
+ /**
6
+ * the Collection slug to operate against.
7
+ */
8
+ collection: TSlug;
9
+ /**
10
+ * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.
11
+ */
12
+ locale?: 'all' | TypedLocale<T>;
13
+ /**
14
+ * A filter [query](https://payloadcms.com/docs/queries/overview)
15
+ */
16
+ where?: Where;
17
+ };
18
+ export declare function count<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>>(sdk: PayloadSDK<T>, options: CountOptions<T, TSlug>, init?: RequestInit): Promise<{
19
+ totalDocs: number;
20
+ }>;
21
+ //# sourceMappingURL=count.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../../src/collections/count.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAErF,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,qBAAqB,EAAE,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,IAAI;IAC3F;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,wBAAsB,KAAK,CAAC,CAAC,SAAS,qBAAqB,EAAE,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAC1F,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC,EAC/B,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAShC"}
@@ -0,0 +1,11 @@
1
+ export async function count(sdk, options, init) {
2
+ const response = await sdk.request({
3
+ args: options,
4
+ init,
5
+ method: 'GET',
6
+ path: `/${options.collection}/count`
7
+ });
8
+ return response.json();
9
+ }
10
+
11
+ //# sourceMappingURL=count.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/collections/count.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport type { PayloadSDK } from '../index.js'\nimport type { CollectionSlug, PayloadGeneratedTypes, TypedLocale } from '../types.js'\n\nexport type CountOptions<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.\n */\n locale?: 'all' | TypedLocale<T>\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where?: Where\n}\n\nexport async function count<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>>(\n sdk: PayloadSDK<T>,\n options: CountOptions<T, TSlug>,\n init?: RequestInit,\n): Promise<{ totalDocs: number }> {\n const response = await sdk.request({\n args: options,\n init,\n method: 'GET',\n path: `/${options.collection}/count`,\n })\n\n return response.json()\n}\n"],"names":["count","sdk","options","init","response","request","args","method","path","collection","json"],"mappings":"AAoBA,OAAO,eAAeA,MACpBC,GAAkB,EAClBC,OAA+B,EAC/BC,IAAkB;IAElB,MAAMC,WAAW,MAAMH,IAAII,OAAO,CAAC;QACjCC,MAAMJ;QACNC;QACAI,QAAQ;QACRC,MAAM,CAAC,CAAC,EAAEN,QAAQO,UAAU,CAAC,MAAM,CAAC;IACtC;IAEA,OAAOL,SAASM,IAAI;AACtB"}
@@ -0,0 +1,41 @@
1
+ import type { SelectType } from 'payload';
2
+ import type { PayloadSDK } from '../index.js';
3
+ import type { CollectionSlug, PayloadGeneratedTypes, PopulateType, RequiredDataFromCollectionSlug, TransformCollectionWithSelect, TypedLocale, UploadCollectionSlug } from '../types.js';
4
+ export type CreateOptions<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>, TSelect extends SelectType> = {
5
+ /**
6
+ * the Collection slug to operate against.
7
+ */
8
+ collection: TSlug;
9
+ /**
10
+ * The data for the document to create.
11
+ */
12
+ data: RequiredDataFromCollectionSlug<T, TSlug>;
13
+ /**
14
+ * [Control auto-population](https://payloadcms.com/docs/queries/depth) of nested relationship and upload fields.
15
+ */
16
+ depth?: number;
17
+ /**
18
+ * Create a **draft** document. [More](https://payloadcms.com/docs/versions/drafts#draft-api)
19
+ */
20
+ draft?: boolean;
21
+ /**
22
+ * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.
23
+ */
24
+ fallbackLocale?: false | TypedLocale<T>;
25
+ /** File Blob object or URL to the file. Only for upload collections */
26
+ file?: TSlug extends UploadCollectionSlug<T> ? Blob | string : never;
27
+ /**
28
+ * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.
29
+ */
30
+ locale?: 'all' | TypedLocale<T>;
31
+ /**
32
+ * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.
33
+ */
34
+ populate?: PopulateType<T>;
35
+ /**
36
+ * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.
37
+ */
38
+ select?: TSelect;
39
+ };
40
+ export declare function create<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>, TSelect extends SelectType>(sdk: PayloadSDK<T>, options: CreateOptions<T, TSlug, TSelect>, init?: RequestInit): Promise<TransformCollectionWithSelect<T, TSlug, TSelect>>;
41
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/collections/create.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,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,8BAA8B,EAC9B,6BAA6B,EAC7B,WAAW,EACX,oBAAoB,EACrB,MAAM,aAAa,CAAA;AAIpB,MAAM,MAAM,aAAa,CACvB,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAC/B,OAAO,SAAS,UAAU,IACxB;IACF;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;OAEG;IACH,IAAI,EAAE,8BAA8B,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;IAC9C;;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,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;CACjB,CAAA;AAED,wBAAsB,MAAM,CAC1B,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAC/B,OAAO,SAAS,UAAU,EAE1B,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,EACzC,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,6BAA6B,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAmB3D"}
@@ -0,0 +1,19 @@
1
+ import { resolveFileFromOptions } from '../utilities/resolveFileFromOptions.js';
2
+ export async function create(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: 'POST',
13
+ path: `/${options.collection}`
14
+ });
15
+ const json = await response.json();
16
+ return json.doc;
17
+ }
18
+
19
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/collections/create.ts"],"sourcesContent":["import type { SelectType } from 'payload'\n\nimport type { PayloadSDK } from '../index.js'\nimport type {\n CollectionSlug,\n PayloadGeneratedTypes,\n PopulateType,\n RequiredDataFromCollectionSlug,\n TransformCollectionWithSelect,\n TypedLocale,\n UploadCollectionSlug,\n} from '../types.js'\n\nimport { resolveFileFromOptions } from '../utilities/resolveFileFromOptions.js'\n\nexport type CreateOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n TSelect extends SelectType,\n> = {\n /**\n * the Collection slug to operate against.\n */\n collection: TSlug\n /**\n * The data for the document to create.\n */\n data: 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 * Create a **draft** document. [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 /** 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?: '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 create<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n TSelect extends SelectType,\n>(\n sdk: PayloadSDK<T>,\n options: CreateOptions<T, TSlug, TSelect>,\n init?: RequestInit,\n): Promise<TransformCollectionWithSelect<T, TSlug, TSelect>> {\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: 'POST',\n path: `/${options.collection}`,\n })\n\n const json = await response.json()\n\n return json.doc\n}\n"],"names":["resolveFileFromOptions","create","sdk","options","init","file","undefined","response","request","args","json","data","method","path","collection","doc"],"mappings":"AAaA,SAASA,sBAAsB,QAAQ,yCAAwC;AA2C/E,OAAO,eAAeC,OAKpBC,GAAkB,EAClBC,OAAyC,EACzCC,IAAkB;IAElB,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,EAAE;IAChC;IAEA,MAAMJ,OAAO,MAAMH,SAASG,IAAI;IAEhC,OAAOA,KAAKK,GAAG;AACjB"}
@@ -0,0 +1,47 @@
1
+ import type { SelectType, Where } from 'payload';
2
+ import type { PayloadSDK } from '../index.js';
3
+ import type { BulkOperationResult, CollectionSlug, PayloadGeneratedTypes, PopulateType, SelectFromCollectionSlug, TransformCollectionWithSelect, TypedLocale } from '../types.js';
4
+ export type DeleteBaseOptions<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>, TSelect extends SelectType> = {
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
+ draft?: boolean;
14
+ /**
15
+ * Specify a [fallback locale](https://payloadcms.com/docs/configuration/localization) to use for any returned documents.
16
+ */
17
+ fallbackLocale?: false | TypedLocale<T>;
18
+ /**
19
+ * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.
20
+ */
21
+ locale?: TypedLocale<T>;
22
+ /**
23
+ * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.
24
+ */
25
+ populate?: PopulateType<T>;
26
+ /**
27
+ * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.
28
+ */
29
+ select?: TSelect;
30
+ };
31
+ export type DeleteByIDOptions<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>, TSelect extends SelectFromCollectionSlug<T, TSlug>> = {
32
+ /**
33
+ * The ID of the document to delete.
34
+ */
35
+ id: number | string;
36
+ where?: never;
37
+ } & DeleteBaseOptions<T, TSlug, TSelect>;
38
+ export type DeleteManyOptions<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>, TSelect extends SelectFromCollectionSlug<T, TSlug>> = {
39
+ id?: never;
40
+ /**
41
+ * A filter [query](https://payloadcms.com/docs/queries/overview)
42
+ */
43
+ where: Where;
44
+ } & DeleteBaseOptions<T, TSlug, TSelect>;
45
+ export type DeleteOptions<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>, TSelect extends SelectFromCollectionSlug<T, TSlug>> = DeleteByIDOptions<T, TSlug, TSelect> | DeleteManyOptions<T, TSlug, TSelect>;
46
+ export declare function deleteOperation<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>, TSelect extends SelectFromCollectionSlug<T, TSlug>>(sdk: PayloadSDK<T>, options: DeleteOptions<T, TSlug, TSelect>, init?: RequestInit): Promise<BulkOperationResult<T, TSlug, TSelect> | TransformCollectionWithSelect<T, TSlug, TSelect>>;
47
+ //# sourceMappingURL=delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/collections/delete.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,wBAAwB,EACxB,6BAA6B,EAC7B,WAAW,EACZ,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,iBAAiB,CAC3B,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAC/B,OAAO,SAAS,UAAU,IACxB;IACF;;OAEG;IACH,UAAU,EAAE,KAAK,CAAA;IACjB;;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;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAA;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;IAC1B;;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;;OAEG;IACH,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IAEnB,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;;OAEG;IACH,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,eAAe,CACnC,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,CAeA"}
@@ -0,0 +1,15 @@
1
+ export async function deleteOperation(sdk, options, init) {
2
+ const response = await sdk.request({
3
+ args: options,
4
+ init,
5
+ method: 'DELETE',
6
+ path: `/${options.collection}${options.id ? `/${options.id}` : ''}`
7
+ });
8
+ const json = await response.json();
9
+ if (options.id) {
10
+ return json.doc;
11
+ }
12
+ return json;
13
+ }
14
+
15
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/collections/delete.ts"],"sourcesContent":["import type { SelectType, Where } from 'payload'\n\nimport type { PayloadSDK } from '../index.js'\nimport type {\n BulkOperationResult,\n CollectionSlug,\n PayloadGeneratedTypes,\n PopulateType,\n SelectFromCollectionSlug,\n TransformCollectionWithSelect,\n TypedLocale,\n} from '../types.js'\n\nexport type DeleteBaseOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\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 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?: 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 type DeleteByIDOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n TSelect extends SelectFromCollectionSlug<T, TSlug>,\n> = {\n /**\n * The ID of the document to delete.\n */\n id: number | string\n\n where?: never\n} & DeleteBaseOptions<T, TSlug, TSelect>\n\nexport type DeleteManyOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n TSelect extends SelectFromCollectionSlug<T, TSlug>,\n> = {\n id?: never\n /**\n * A filter [query](https://payloadcms.com/docs/queries/overview)\n */\n where: Where\n} & DeleteBaseOptions<T, TSlug, TSelect>\n\nexport type DeleteOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n TSelect extends SelectFromCollectionSlug<T, TSlug>,\n> = DeleteByIDOptions<T, TSlug, TSelect> | DeleteManyOptions<T, TSlug, TSelect>\n\nexport async function deleteOperation<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n TSelect extends SelectFromCollectionSlug<T, TSlug>,\n>(\n sdk: PayloadSDK<T>,\n options: DeleteOptions<T, TSlug, TSelect>,\n init?: RequestInit,\n): Promise<\n BulkOperationResult<T, TSlug, TSelect> | TransformCollectionWithSelect<T, TSlug, TSelect>\n> {\n const response = await sdk.request({\n args: options,\n init,\n method: 'DELETE',\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":["deleteOperation","sdk","options","init","response","request","args","method","path","collection","id","json","doc"],"mappings":"AA4EA,OAAO,eAAeA,gBAKpBC,GAAkB,EAClBC,OAAyC,EACzCC,IAAkB;IAIlB,MAAMC,WAAW,MAAMH,IAAII,OAAO,CAAC;QACjCC,MAAMJ;QACNC;QACAI,QAAQ;QACRC,MAAM,CAAC,CAAC,EAAEN,QAAQO,UAAU,GAAGP,QAAQQ,EAAE,GAAG,CAAC,CAAC,EAAER,QAAQQ,EAAE,EAAE,GAAG,IAAI;IACrE;IAEA,MAAMC,OAAO,MAAMP,SAASO,IAAI;IAEhC,IAAIT,QAAQQ,EAAE,EAAE;QACd,OAAOC,KAAKC,GAAG;IACjB;IAEA,OAAOD;AACT"}
@@ -0,0 +1,75 @@
1
+ import type { PaginatedDocs, SelectType, Sort, Where } from 'payload';
2
+ import type { PayloadSDK } from '../index.js';
3
+ import type { CollectionSlug, JoinQuery, PayloadGeneratedTypes, PopulateType, TransformCollectionWithSelect, TypedLocale } from '../types.js';
4
+ export type FindOptions<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>, TSelect extends SelectType> = {
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 [Join Field Query](https://payloadcms.com/docs/fields/join#query-options).
23
+ * Pass `false` to disable all join fields from the result.
24
+ */
25
+ joins?: JoinQuery<T, TSlug>;
26
+ /**
27
+ * The maximum related documents to be returned.
28
+ * Defaults unless `defaultLimit` is specified for the collection config
29
+ * @default 10
30
+ */
31
+ limit?: number;
32
+ /**
33
+ * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.
34
+ */
35
+ locale?: 'all' | TypedLocale<T>;
36
+ /**
37
+ * Get a specific page number
38
+ * @default 1
39
+ */
40
+ page?: number;
41
+ /**
42
+ * Set to `false` to return all documents and avoid querying for document counts which introduces some overhead.
43
+ * You can also combine that property with a specified `limit` to limit documents but avoid the count query.
44
+ */
45
+ pagination?: boolean;
46
+ /**
47
+ * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.
48
+ */
49
+ populate?: PopulateType<T>;
50
+ /**
51
+ * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.
52
+ */
53
+ select?: TSelect;
54
+ /**
55
+ * Sort the documents, can be a string or an array of strings
56
+ * @example '-createdAt' // Sort DESC by createdAt
57
+ * @example ['group', '-createdAt'] // sort by 2 fields, ASC group and DESC createdAt
58
+ */
59
+ sort?: Sort;
60
+ /**
61
+ * When set to `true`, the query will include both normal and trashed documents.
62
+ * To query only trashed documents, pass `trash: true` and combine with a `where` clause filtering by `deletedAt`.
63
+ * By default (`false`), the query will only include normal documents and exclude those with a `deletedAt` field.
64
+ *
65
+ * This argument has no effect unless `trash` is enabled on the collection.
66
+ * @default false
67
+ */
68
+ trash?: boolean;
69
+ /**
70
+ * A filter [query](https://payloadcms.com/docs/queries/overview)
71
+ */
72
+ where?: Where;
73
+ };
74
+ export declare function find<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>, TSelect extends SelectType>(sdk: PayloadSDK<T>, options: FindOptions<T, TSlug, TSelect>, init?: RequestInit): Promise<PaginatedDocs<TransformCollectionWithSelect<T, TSlug, TSelect>>>;
75
+ //# sourceMappingURL=find.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../src/collections/find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAErE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,qBAAqB,EACrB,YAAY,EACZ,6BAA6B,EAC7B,WAAW,EACZ,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,WAAW,CACrB,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAC/B,OAAO,SAAS,UAAU,IACxB;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;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;IAC3B;;;;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,OAAO,CAAA;IAChB;;;;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,IAAI,CACxB,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAC/B,OAAO,SAAS,UAAU,EAE1B,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,EACvC,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,aAAa,CAAC,6BAA6B,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAS1E"}
@@ -0,0 +1,11 @@
1
+ export async function find(sdk, options, init) {
2
+ const response = await sdk.request({
3
+ args: options,
4
+ init,
5
+ method: 'GET',
6
+ path: `/${options.collection}`
7
+ });
8
+ return response.json();
9
+ }
10
+
11
+ //# sourceMappingURL=find.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/collections/find.ts"],"sourcesContent":["import type { PaginatedDocs, SelectType, Sort, Where } 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 FindOptions<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\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 * 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 [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 * 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?: TSelect\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 * When set to `true`, the query will include both normal and trashed 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 find<\n T extends PayloadGeneratedTypes,\n TSlug extends CollectionSlug<T>,\n TSelect extends SelectType,\n>(\n sdk: PayloadSDK<T>,\n options: FindOptions<T, TSlug, TSelect>,\n init?: RequestInit,\n): Promise<PaginatedDocs<TransformCollectionWithSelect<T, TSlug, TSelect>>> {\n const response = await sdk.request({\n args: options,\n init,\n method: 'GET',\n path: `/${options.collection}`,\n })\n\n return response.json()\n}\n"],"names":["find","sdk","options","init","response","request","args","method","path","collection","json"],"mappings":"AAuFA,OAAO,eAAeA,KAKpBC,GAAkB,EAClBC,OAAuC,EACvCC,IAAkB;IAElB,MAAMC,WAAW,MAAMH,IAAII,OAAO,CAAC;QACjCC,MAAMJ;QACNC;QACAI,QAAQ;QACRC,MAAM,CAAC,CAAC,EAAEN,QAAQO,UAAU,EAAE;IAChC;IAEA,OAAOL,SAASM,IAAI;AACtB"}
@@ -0,0 +1,49 @@
1
+ import type { ApplyDisableErrors, SelectType } from 'payload';
2
+ import type { PayloadSDK } from '../index.js';
3
+ import type { CollectionSlug, JoinQuery, PayloadGeneratedTypes, PopulateType, TransformCollectionWithSelect, TypedLocale } from '../types.js';
4
+ export type FindByIDOptions<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>, TDisableErrors extends boolean, TSelect extends SelectType> = {
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 document to find.
28
+ */
29
+ id: number | string;
30
+ /**
31
+ * The [Join Field Query](https://payloadcms.com/docs/fields/join#query-options).
32
+ * Pass `false` to disable all join fields from the result.
33
+ */
34
+ joins?: JoinQuery<T, TSlug>;
35
+ /**
36
+ * Specify [locale](https://payloadcms.com/docs/configuration/localization) for any returned documents.
37
+ */
38
+ locale?: 'all' | TypedLocale<T>;
39
+ /**
40
+ * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.
41
+ */
42
+ populate?: PopulateType<T>;
43
+ /**
44
+ * Specify [select](https://payloadcms.com/docs/queries/select) to control which fields to include to the result.
45
+ */
46
+ select?: TSelect;
47
+ };
48
+ export declare function findByID<T extends PayloadGeneratedTypes, TSlug extends CollectionSlug<T>, TDisableErrors extends boolean, TSelect extends SelectType>(sdk: PayloadSDK<T>, options: FindByIDOptions<T, TSlug, TDisableErrors, TSelect>, init?: RequestInit): Promise<ApplyDisableErrors<TransformCollectionWithSelect<T, TSlug, TSelect>, TDisableErrors>>;
49
+ //# sourceMappingURL=findByID.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findByID.d.ts","sourceRoot":"","sources":["../../src/collections/findByID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAE7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,qBAAqB,EACrB,YAAY,EACZ,6BAA6B,EAC7B,WAAW,EACZ,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,eAAe,CACzB,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAC/B,cAAc,SAAS,OAAO,EAC9B,OAAO,SAAS,UAAU,IACxB;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;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;IAC3B;;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;CACjB,CAAA;AAED,wBAAsB,QAAQ,CAC5B,CAAC,SAAS,qBAAqB,EAC/B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAC/B,cAAc,SAAS,OAAO,EAC9B,OAAO,SAAS,UAAU,EAE1B,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,EAC3D,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC,CAsB/F"}