@payloadcms/sdk 3.73.0-internal.ff401d9 → 3.74.0-canary.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.
@@ -1,4 +1,4 @@
1
- import type { ApplyDisableErrors, CollectionSlug, PayloadTypesShape, TypedLocale } from 'payload';
1
+ import type { ApplyDisableErrors, CollectionSlug, FindOptions, PayloadTypesShape, SelectType, TypedLocale } from 'payload';
2
2
  import type { PayloadSDK } from '../index.js';
3
3
  import type { JoinQuery, PopulateType, SelectFromCollectionSlug, TransformCollectionWithSelect } from '../types.js';
4
4
  export type FindByIDOptions<T extends PayloadTypesShape, TSlug extends CollectionSlug<T>, TDisableErrors extends boolean, TSelect extends SelectFromCollectionSlug<T, TSlug>> = {
@@ -40,10 +40,6 @@ export type FindByIDOptions<T extends PayloadTypesShape, TSlug extends Collectio
40
40
  * Specify [populate](https://payloadcms.com/docs/queries/select#populate) to control which fields to include to the result from populated documents.
41
41
  */
42
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
- };
43
+ } & Pick<FindOptions<TSlug, SelectType & TSelect>, 'select'>;
48
44
  export declare function findByID<T extends PayloadTypesShape, TSlug extends CollectionSlug<T>, TDisableErrors extends boolean, TSelect extends SelectFromCollectionSlug<T, TSlug>>(sdk: PayloadSDK<T>, options: FindByIDOptions<T, TSlug, TDisableErrors, TSelect>, init?: RequestInit): Promise<ApplyDisableErrors<TransformCollectionWithSelect<T, TSlug, TSelect>, TDisableErrors>>;
49
45
  //# sourceMappingURL=findByID.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"findByID.d.ts","sourceRoot":"","sources":["../../src/collections/findByID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEjG,OAAO,KAAK,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,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAA;AAE5D,wBAAsB,QAAQ,CAC5B,CAAC,SAAS,iBAAiB,EAC3B,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAC/B,cAAc,SAAS,OAAO,EAC9B,OAAO,SAAS,wBAAwB,CAAC,CAAC,EAAE,KAAK,CAAC,EAElD,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,CAkB/F"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/collections/findByID.ts"],"sourcesContent":["import type { ApplyDisableErrors, CollectionSlug, PayloadTypesShape, TypedLocale } from 'payload'\n\nimport type { PayloadSDK } from '../index.js'\nimport type {\n JoinQuery,\n PopulateType,\n SelectFromCollectionSlug,\n TransformCollectionWithSelect,\n} from '../types.js'\n\nexport type FindByIDOptions<\n T extends PayloadTypesShape,\n TSlug extends CollectionSlug<T>,\n TDisableErrors extends boolean,\n TSelect extends SelectFromCollectionSlug<T, TSlug>,\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 PayloadTypesShape,\n TSlug extends CollectionSlug<T>,\n TDisableErrors extends boolean,\n TSelect extends SelectFromCollectionSlug<T, TSlug>,\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 return response.json()\n } catch (err) {\n if (options.disableErrors) {\n // @ts-expect-error generic nullable\n return null\n }\n\n throw err\n }\n}\n"],"names":["findByID","sdk","options","init","response","request","args","method","path","collection","id","json","err","disableErrors"],"mappings":"AA4DA,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,OAAON,SAASO,IAAI;IACtB,EAAE,OAAOC,KAAK;QACZ,IAAIV,QAAQW,aAAa,EAAE;YACzB,oCAAoC;YACpC,OAAO;QACT;QAEA,MAAMD;IACR;AACF"}
1
+ {"version":3,"sources":["../../src/collections/findByID.ts"],"sourcesContent":["import type {\n ApplyDisableErrors,\n CollectionSlug,\n FindOptions,\n PayloadTypesShape,\n SelectType,\n TypedLocale,\n} from 'payload'\n\nimport type { PayloadSDK } from '../index.js'\nimport type {\n JoinQuery,\n PopulateType,\n SelectFromCollectionSlug,\n TransformCollectionWithSelect,\n} from '../types.js'\n\nexport type FindByIDOptions<\n T extends PayloadTypesShape,\n TSlug extends CollectionSlug<T>,\n TDisableErrors extends boolean,\n TSelect extends SelectFromCollectionSlug<T, TSlug>,\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} & Pick<FindOptions<TSlug, SelectType & TSelect>, 'select'>\n\nexport async function findByID<\n T extends PayloadTypesShape,\n TSlug extends CollectionSlug<T>,\n TDisableErrors extends boolean,\n TSelect extends SelectFromCollectionSlug<T, TSlug>,\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 return response.json()\n } catch (err) {\n if (options.disableErrors) {\n // @ts-expect-error generic nullable\n return null\n }\n\n throw err\n }\n}\n"],"names":["findByID","sdk","options","init","response","request","args","method","path","collection","id","json","err","disableErrors"],"mappings":"AA+DA,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,OAAON,SAASO,IAAI;IACtB,EAAE,OAAOC,KAAK;QACZ,IAAIV,QAAQW,aAAa,EAAE;YACzB,oCAAoC;YACpC,OAAO;QACT;QAEA,MAAMD;IACR;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/sdk",
3
- "version": "3.73.0-internal.ff401d9",
3
+ "version": "3.74.0-canary.0",
4
4
  "description": "The official Payload REST API SDK",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "qs-esm": "7.0.2",
35
35
  "ts-essentials": "10.0.3",
36
- "payload": "3.73.0-internal.ff401d9"
36
+ "payload": "3.74.0-canary.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@payloadcms/eslint-config": "3.28.0"