@starlightcms/js-sdk 3.0.0 → 3.1.0-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 (143) hide show
  1. package/dist/cjs/client.d.ts.map +1 -1
  2. package/dist/cjs/client.js +1 -1
  3. package/dist/cjs/client.js.map +1 -1
  4. package/dist/cjs/instances/Collection/index.js +4 -4
  5. package/dist/cjs/instances/Collection/index.js.map +1 -1
  6. package/dist/cjs/instances/Collection/types.d.ts +14 -6
  7. package/dist/cjs/instances/Collection/types.d.ts.map +1 -1
  8. package/dist/cjs/instances/Collection/types.js.map +1 -1
  9. package/dist/cjs/instances/Form/index.d.ts.map +1 -1
  10. package/dist/cjs/instances/Form/index.js +4 -4
  11. package/dist/cjs/instances/Form/index.js.map +1 -1
  12. package/dist/cjs/instances/Form/types.d.ts +12 -4
  13. package/dist/cjs/instances/Form/types.d.ts.map +1 -1
  14. package/dist/cjs/instances/Form/types.js.map +1 -1
  15. package/dist/cjs/instances/Model/index.d.ts.map +1 -1
  16. package/dist/cjs/instances/Model/index.js +2 -2
  17. package/dist/cjs/instances/Model/index.js.map +1 -1
  18. package/dist/cjs/instances/Model/types.d.ts +7 -2
  19. package/dist/cjs/instances/Model/types.d.ts.map +1 -1
  20. package/dist/cjs/instances/Model/types.js.map +1 -1
  21. package/dist/cjs/instances/ModelCategory/index.d.ts +1 -1
  22. package/dist/cjs/instances/ModelCategory/index.d.ts.map +1 -1
  23. package/dist/cjs/instances/ModelCategory/index.js +4 -4
  24. package/dist/cjs/instances/ModelCategory/index.js.map +1 -1
  25. package/dist/cjs/instances/ModelCategory/types.d.ts +16 -7
  26. package/dist/cjs/instances/ModelCategory/types.d.ts.map +1 -1
  27. package/dist/cjs/instances/ModelCategory/types.js.map +1 -1
  28. package/dist/cjs/selectors/Collection/index.js +4 -4
  29. package/dist/cjs/selectors/Collection/index.js.map +1 -1
  30. package/dist/cjs/selectors/Collection/types.d.ts +13 -6
  31. package/dist/cjs/selectors/Collection/types.d.ts.map +1 -1
  32. package/dist/cjs/selectors/Collection/types.js.map +1 -1
  33. package/dist/cjs/selectors/Entry/index.d.ts.map +1 -1
  34. package/dist/cjs/selectors/Entry/index.js +6 -2
  35. package/dist/cjs/selectors/Entry/index.js.map +1 -1
  36. package/dist/cjs/selectors/Entry/types.d.ts +13 -10
  37. package/dist/cjs/selectors/Entry/types.d.ts.map +1 -1
  38. package/dist/cjs/selectors/Entry/types.js.map +1 -1
  39. package/dist/cjs/selectors/Media/index.js +4 -4
  40. package/dist/cjs/selectors/Media/index.js.map +1 -1
  41. package/dist/cjs/selectors/Media/types.d.ts +12 -3
  42. package/dist/cjs/selectors/Media/types.d.ts.map +1 -1
  43. package/dist/cjs/selectors/Media/types.js.map +1 -1
  44. package/dist/cjs/selectors/Model/index.d.ts +1 -1
  45. package/dist/cjs/selectors/Model/index.d.ts.map +1 -1
  46. package/dist/cjs/selectors/Model/index.js +4 -4
  47. package/dist/cjs/selectors/Model/index.js.map +1 -1
  48. package/dist/cjs/selectors/Model/types.d.ts +12 -3
  49. package/dist/cjs/selectors/Model/types.d.ts.map +1 -1
  50. package/dist/cjs/selectors/Model/types.js.map +1 -1
  51. package/dist/cjs/selectors/ModelCategory/index.d.ts +1 -1
  52. package/dist/cjs/selectors/ModelCategory/index.d.ts.map +1 -1
  53. package/dist/cjs/selectors/ModelCategory/index.js +4 -4
  54. package/dist/cjs/selectors/ModelCategory/index.js.map +1 -1
  55. package/dist/cjs/selectors/ModelCategory/types.d.ts +13 -6
  56. package/dist/cjs/selectors/ModelCategory/types.d.ts.map +1 -1
  57. package/dist/cjs/selectors/ModelCategory/types.js.map +1 -1
  58. package/dist/cjs/selectors/Search/index.d.ts.map +1 -1
  59. package/dist/cjs/selectors/Search/index.js +2 -2
  60. package/dist/cjs/selectors/Search/index.js.map +1 -1
  61. package/dist/cjs/selectors/Search/types.d.ts +8 -5
  62. package/dist/cjs/selectors/Search/types.d.ts.map +1 -1
  63. package/dist/cjs/selectors/Search/types.js.map +1 -1
  64. package/dist/cjs/selectors/Singleton/index.js +4 -4
  65. package/dist/cjs/selectors/Singleton/index.js.map +1 -1
  66. package/dist/cjs/selectors/Singleton/types.d.ts +12 -3
  67. package/dist/cjs/selectors/Singleton/types.d.ts.map +1 -1
  68. package/dist/cjs/selectors/Singleton/types.js.map +1 -1
  69. package/dist/cjs/types/index.d.ts +10 -2
  70. package/dist/cjs/types/index.d.ts.map +1 -1
  71. package/dist/cjs/types/index.js.map +1 -1
  72. package/dist/esm/client.d.ts.map +1 -1
  73. package/dist/esm/client.js +1 -1
  74. package/dist/esm/client.js.map +1 -1
  75. package/dist/esm/instances/Collection/index.js +4 -4
  76. package/dist/esm/instances/Collection/index.js.map +1 -1
  77. package/dist/esm/instances/Collection/types.d.ts +14 -6
  78. package/dist/esm/instances/Collection/types.d.ts.map +1 -1
  79. package/dist/esm/instances/Collection/types.js.map +1 -1
  80. package/dist/esm/instances/Form/index.d.ts.map +1 -1
  81. package/dist/esm/instances/Form/index.js +4 -4
  82. package/dist/esm/instances/Form/index.js.map +1 -1
  83. package/dist/esm/instances/Form/types.d.ts +12 -4
  84. package/dist/esm/instances/Form/types.d.ts.map +1 -1
  85. package/dist/esm/instances/Form/types.js.map +1 -1
  86. package/dist/esm/instances/Model/index.d.ts.map +1 -1
  87. package/dist/esm/instances/Model/index.js +2 -2
  88. package/dist/esm/instances/Model/index.js.map +1 -1
  89. package/dist/esm/instances/Model/types.d.ts +7 -2
  90. package/dist/esm/instances/Model/types.d.ts.map +1 -1
  91. package/dist/esm/instances/Model/types.js.map +1 -1
  92. package/dist/esm/instances/ModelCategory/index.d.ts +1 -1
  93. package/dist/esm/instances/ModelCategory/index.d.ts.map +1 -1
  94. package/dist/esm/instances/ModelCategory/index.js +4 -4
  95. package/dist/esm/instances/ModelCategory/index.js.map +1 -1
  96. package/dist/esm/instances/ModelCategory/types.d.ts +16 -7
  97. package/dist/esm/instances/ModelCategory/types.d.ts.map +1 -1
  98. package/dist/esm/instances/ModelCategory/types.js.map +1 -1
  99. package/dist/esm/selectors/Collection/index.js +4 -4
  100. package/dist/esm/selectors/Collection/index.js.map +1 -1
  101. package/dist/esm/selectors/Collection/types.d.ts +13 -6
  102. package/dist/esm/selectors/Collection/types.d.ts.map +1 -1
  103. package/dist/esm/selectors/Collection/types.js.map +1 -1
  104. package/dist/esm/selectors/Entry/index.d.ts.map +1 -1
  105. package/dist/esm/selectors/Entry/index.js +6 -2
  106. package/dist/esm/selectors/Entry/index.js.map +1 -1
  107. package/dist/esm/selectors/Entry/types.d.ts +13 -10
  108. package/dist/esm/selectors/Entry/types.d.ts.map +1 -1
  109. package/dist/esm/selectors/Entry/types.js.map +1 -1
  110. package/dist/esm/selectors/Media/index.js +4 -4
  111. package/dist/esm/selectors/Media/index.js.map +1 -1
  112. package/dist/esm/selectors/Media/types.d.ts +12 -3
  113. package/dist/esm/selectors/Media/types.d.ts.map +1 -1
  114. package/dist/esm/selectors/Media/types.js.map +1 -1
  115. package/dist/esm/selectors/Model/index.d.ts +1 -1
  116. package/dist/esm/selectors/Model/index.d.ts.map +1 -1
  117. package/dist/esm/selectors/Model/index.js +4 -4
  118. package/dist/esm/selectors/Model/index.js.map +1 -1
  119. package/dist/esm/selectors/Model/types.d.ts +12 -3
  120. package/dist/esm/selectors/Model/types.d.ts.map +1 -1
  121. package/dist/esm/selectors/Model/types.js.map +1 -1
  122. package/dist/esm/selectors/ModelCategory/index.d.ts +1 -1
  123. package/dist/esm/selectors/ModelCategory/index.d.ts.map +1 -1
  124. package/dist/esm/selectors/ModelCategory/index.js +4 -4
  125. package/dist/esm/selectors/ModelCategory/index.js.map +1 -1
  126. package/dist/esm/selectors/ModelCategory/types.d.ts +13 -6
  127. package/dist/esm/selectors/ModelCategory/types.d.ts.map +1 -1
  128. package/dist/esm/selectors/ModelCategory/types.js.map +1 -1
  129. package/dist/esm/selectors/Search/index.d.ts.map +1 -1
  130. package/dist/esm/selectors/Search/index.js +2 -2
  131. package/dist/esm/selectors/Search/index.js.map +1 -1
  132. package/dist/esm/selectors/Search/types.d.ts +8 -5
  133. package/dist/esm/selectors/Search/types.d.ts.map +1 -1
  134. package/dist/esm/selectors/Search/types.js.map +1 -1
  135. package/dist/esm/selectors/Singleton/index.js +4 -4
  136. package/dist/esm/selectors/Singleton/index.js.map +1 -1
  137. package/dist/esm/selectors/Singleton/types.d.ts +12 -3
  138. package/dist/esm/selectors/Singleton/types.d.ts.map +1 -1
  139. package/dist/esm/selectors/Singleton/types.js.map +1 -1
  140. package/dist/esm/types/index.d.ts +10 -2
  141. package/dist/esm/types/index.d.ts.map +1 -1
  142. package/dist/esm/types/index.js.map +1 -1
  143. package/package.json +1 -1
@@ -142,7 +142,7 @@ export interface StarlightClient<D extends WorkspaceModelDefinition = DefaultMod
142
142
  * @throws {@link StarlightError} on any errors.
143
143
  * @category Other Methods
144
144
  */
145
- get<T = Record<string, unknown>>(path: string, params?: Record<string, string | number | boolean | undefined>, options?: RequestInit): Promise<T>;
145
+ get<T = Record<string, unknown>>(path: string, params?: BaseRequestParameters, options?: RequestInit): Promise<T>;
146
146
  /**
147
147
  * Returns a {@link DynamicModelSelector}, which is a {@link ModelSelector}
148
148
  * with support for creating {@apilink ModelInstance | ModelInstances} using the dynamic syntax.
@@ -542,12 +542,20 @@ export interface WorkspaceModelDefinition {
542
542
  [slug: string]: SerializedData;
543
543
  }
544
544
  /**
545
- * Request parameters used by most SDK `list()` methods.
545
+ * An object that accepts any string, number and boolean values.
546
+ * Used as the base for most request parameter interfaces in the SDK.
546
547
  *
547
548
  * @group Request Parameters
548
549
  */
549
550
  export interface BaseRequestParameters {
550
551
  [key: string]: string | number | boolean | undefined;
552
+ }
553
+ /**
554
+ * Request parameters used by most SDK `list()` methods.
555
+ *
556
+ * @group Request Parameters
557
+ */
558
+ export interface ListRequestParameters extends BaseRequestParameters {
551
559
  /**
552
560
  * The page requested.
553
561
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceR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AAA;QACjB;;WAEG;QACH,IAAI,EAAE,MAAM,CAAA;QACZ;;WAEG;QACH,EAAE,EAAE,MAAM,CAAA;QACV;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAA;QAChB;;WAEG;QACH,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0GG;AAEH,MAAM,WAAW,sBAAuB,SAAQ,wBAAwB;CAAG;AAE3E;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAA;CAC/B;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;CACrD;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB;IAClE;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAWA,2CAAwB;AACxB,6CAA0B;AAC1B,2CAAwB;AACxB,8CAA2B;AAC3B,8CAA2B","sourcesContent":["import { CollectionEntityTypes, SerializedData } from './entities'\nimport { DynamicModelSelector } from '../selectors/Model'\nimport { DynamicModelInstance } from '../instances/Model'\nimport { SingletonSelector } from '../selectors/Singleton'\nimport { DynamicCollectionSelector } from '../selectors/Collection'\nimport { MediaSelector } from '../selectors/Media'\nimport { SearchSelector } from '../selectors/Search'\nimport { CollectionInstance } from '../instances/Collection'\nimport { FormInstance } from '../instances/Form'\nimport { DynamicFormSelector } from '../selectors/Form/types'\n\nexport * from './fields'\nexport * from './entities'\nexport * from './visual'\nexport * from './instances'\nexport * from './selectors'\n\n/**\n * This is a utility type that allows any string to be used as a URL, but\n * provides a default one which can be used by IDEs to provide auto-completion.\n * The default URL points to version 2 of the Query API.\n */\nexport type BaseUrl = 'https://query.starlightcms.io/v2' | string\n\n/**\n * The available options to configure a {@link StarlightClient}.\n *\n * `workspace` is required when creating new clients or configuring the\n * {@apilink default | default client}.\n * @group Client\n */\nexport type StarlightConfig = {\n /**\n * The ID of the workspace that the client should use to request data.\n *\n * Note: the current APIs only support using workspace IDs as identifiers,\n * and **not** slugs. Slug support will be added in the future. You can find\n * the workspace ID in the left-side menu on the Starlight interface or below\n * the workspace name in the workspace list.\n */\n workspace?: string\n /**\n * The Starlight Query API URL, including the version, and without a trailing\n * slash. Defaults to the production Query API URL.\n *\n * You only need to set this if you're not using Starlight's production APIs.\n */\n baseUrl?: BaseUrl\n /**\n * When true, logs all API requests in the console. Defaults to false.\n */\n debug?: boolean\n}\n\n/**\n * The Starlight client is the main entry point for any requests you might want\n * to make to Starlight's APIs.\n *\n * There's two ways of interacting with a client: using the\n * {@apilink default | default client} exported by the SDK or creating a new\n * client instance using the\n * {@apilink makeStarlightClient | makeStarlightClient function}. Follow the\n * provided links to learn how to use each method.\n *\n * Either way you choose to interact, all clients expose the same methods and\n * accessors that provide ways to request data. These methods and accessors\n * return Selector or Instance objects, which are documented in the sections\n * of the same name found in this API's sidebar.\n *\n * @group Client\n */\nexport interface StarlightClient<\n D extends WorkspaceModelDefinition = DefaultModelDefinition,\n> {\n /**\n * Updates the client configuration. See {@link StarlightConfig} to see all\n * the available options.\n *\n * If you want to use the {@apilink default | default SDK client}, you need to\n * set its workspace using this method in your application. You should run\n * this method only once, and as soon as possible in your application\n * lifecycle. For instance, when using React:\n *\n * ```js\n * // src/index.js\n * import { createRoot } from \"react-dom/client\"\n * import Starlight from '@starlightcms/js-sdk'\n * import MyApp from './MyApp.js'\n *\n * // We only need to run this once. In this case, we're\n * // running it before initializing our React app.\n * Starlight.configure({\n * workspace: '1234567890'\n * })\n *\n * const rootElement = document.getElementById(\"root\")\n * const root = createRoot(rootElement)\n *\n * root.render(<MyApp />)\n * ```\n *\n * @param config A configuration object. See {@link StarlightConfig} to view\n * all available options.\n * @category Other Methods\n */\n configure(config: StarlightConfig): void\n\n /**\n * Logs a message (or any kind of data, really) into the console if the debug\n * configuration is true. Uses `console.log` internally.\n *\n * This function's type definition is the same as the `console.log` function.\n *\n * @param message The data that will be logged.\n * @param optionalParams Additional data to be logged or string substitutions.\n * @see [MDN documentation on console.log](https://developer.mozilla.org/en-US/docs/web/api/console/log)\n * @internal\n */\n log(message?: unknown, ...optionalParams: unknown[]): void\n\n /**\n * Returns the base API URL for requests, including the configured workspace.\n * Doesn't include a trailing slash.\n *\n * @internal\n */\n getBaseUrl(): string\n\n /**\n * Returns a Promise that results in a response or throws a StarlightError.\n * The response will be the parsed JSON data sent by the API.\n *\n * This method is used internally by all Selectors and Instances to request\n * data to Starlight's Query API, but it can also be used standalone if\n * desired.\n *\n * This method automatically prefixes the given path with the API URL, but it\n * doesn't include a trailing slash, so be sure to include one at the start\n * of your path.\n *\n * @param path The path to GET. Will be prefixed with the API URL. Must start\n * with a forward slash (/).\n * @param params An optional object of values that will be converted to a\n * string and passed as GET params.\n * @param options An optional configuration object passed to the fetch method.\n * Check [MDN documentation on fetch](https://developer.mozilla.org/en-US/docs/Web/API/fetch)\n * to see the available options.\n * @typeParam T - The shape of the expected response on success. Client\n * methods generally pass {@link StarlightItemResponse} or\n * {@link StarlightListResponse} types here.\n * @throws {@link StarlightError} on any errors.\n * @category Other Methods\n */\n get<T = Record<string, unknown>>(\n path: string,\n params?: Record<string, string | number | boolean | undefined>,\n options?: RequestInit,\n ): Promise<T>\n\n /**\n * Returns a {@link DynamicModelSelector}, which is a {@link ModelSelector}\n * with support for creating {@apilink ModelInstance | ModelInstances} using the dynamic syntax.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.models.list()\n * ```\n *\n * See {@link DynamicModelSelector} for more info.\n *\n * @category Selector Accessors\n */\n get models(): DynamicModelSelector<D>\n\n /**\n * Returns a {@link DynamicModelInstance}, which is a\n * {@link ModelInstance} with support for creating\n * {@apilink ModelCategoryInstance | ModelCategoryInstances} using the dynamic syntax. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.model('posts').entries.list()\n * ```\n *\n * See {@link DynamicModelInstance} for more info.\n *\n * @category Instance Methods\n */\n model<S extends keyof D>(slug: S): DynamicModelInstance<D[S]>\n\n /**\n * Returns a {@link DynamicFormSelector}, which provides support for creating\n * {@apilink FormInstance | FormInstances} using the dynamic syntax.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.forms.signup.get()\n * ```\n *\n * See {@link DynamicFormSelector} for more info.\n *\n * @category Selector Accessors\n */\n get forms(): DynamicFormSelector\n\n /**\n * Returns a {@link FormInstance}, which provides methods to retrieve basic information\n * about a Starlight form and its schema. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.form('signup').schema()\n * ```\n *\n * See {@link FormInstance} for more info.\n *\n * @category Instance Methods\n */\n form(slug: string | number): FormInstance\n\n /**\n * Returns a {@link SingletonSelector}.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.singletons.list()\n * ```\n *\n * See {@link SingletonSelector} for more info.\n *\n * @category Selector Accessors\n */\n get singletons(): SingletonSelector\n\n /**\n * Returns a {@link DynamicCollectionSelector}, which is a\n * {@link CollectionSelector} with support for creating\n * {@apilink CollectionInstance | CollectionInstances} using the dynamic syntax.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collections.list()\n * ```\n *\n * See {@link DynamicCollectionSelector} for more info.\n *\n * @category Selector Accessors\n */\n get collections(): DynamicCollectionSelector\n\n /**\n * Returns a {@link CollectionInstance}. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collection('featured-posts').items()\n * ```\n *\n * See {@link CollectionInstance} for more info.\n *\n * @example Typing the returned CollectionInstance.\n * ```ts\n * import Starlight, { MediaObject } from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collection<MediaObject>('carousel-images').items()\n * ```\n *\n * @typeParam T - The type of entity this Collection holds. You can pass this\n * type parameter to correctly type the response of the\n * {@apilink CollectionInstance.items} method.\n * @category Instance Methods\n */\n collection<T extends CollectionEntityTypes>(\n slug: string | number,\n ): CollectionInstance<T>\n\n /**\n * Returns a {@link MediaSelector}.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.media.list()\n * ```\n *\n * See {@link MediaSelector} for more info.\n *\n * @category Selector Accessors\n */\n get media(): MediaSelector\n\n /**\n * Returns a {@link SearchSelector}.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.search.entries()\n * ```\n *\n * See {@link SearchSelector} for more info.\n *\n * @category Selector Accessors\n */\n get search(): SearchSelector\n}\n\n/**\n * This type adds support for the dynamic syntax to the StarlightClient\n * interface, which allows users to create\n * {@apilink DynamicModelInstance| DynamicModelInstances} dynamically.\n * See {@link StarlightClient} to learn which methods it provides. Also see\n * {@doclink requests-and-responses#dynamic-syntax | Dynamic Instances}\n * documentation to learn more about the dynamic syntax.\n *\n *\n * This allows TypeScript to correctly type all models defined by the user\n * in the DefaultModelDefinition type, aside from letting the user using any\n * \"unknown\" model slug, which is provided by the WorkspaceModelDefinition type.\n *\n * This type is only aware of the DefaultModelDefinition type because the\n * StarlightClient uses it by default when no model definition type is passed.\n *\n * @group Client\n */\nexport type DynamicStarlightClient<T extends WorkspaceModelDefinition> =\n StarlightClient<T> & {\n [K in keyof T]: DynamicModelInstance<T[K]>\n }\n\n/**\n * This interface represents an API response that returns a single entity, like\n * a single {@link Entry} or a single {@link MediaObject}, for instance.\n *\n * It contains only one field: `data`. This field type is generic and\n * depends on the kind of request that was made to the API.\n *\n * All SDK request methods that returna single entity\n * will return this interface.\n *\n * @group Client\n */\nexport interface StarlightItemResponse<T> {\n /**\n * The entity returned by the API request. Its type depends on which request\n * was made. SDK methods will generally type this parameter automatically.\n */\n data: T\n}\n\n/**\n * This interface represents an API response that returns a list of entities,\n * like a list of {@apilink Entry | Entries} or a list of items from a\n * {@link Collection}.\n *\n * It contains a `data` parameter, which is an array of items with a generic\n * type that depends on the kind of request that was made, and two metadata\n * objects: `links` and `meta`. Metadata is useful for pagination.\n *\n * All SDK request methods that return a list of entities will return this\n * interface.\n *\n * @group Client\n */\nexport interface StarlightListResponse<T> {\n /**\n * The list of entities returned by the API request. Its type depends on which\n * request was made. SDK methods will generally type\n * this parameter automatically.\n */\n data: T[]\n /**\n * An object containing useful links for easier pagination. All links points\n * to the same list requested, but with a varying `page` parameter.\n */\n links: {\n /**\n * A link for the first page of the list.\n */\n first: string\n /**\n * A link for the last page of the list.\n */\n last: string\n /**\n * A link to the previous page of the list, if there's any.\n */\n prev?: string\n /**\n * A link to the next page of the list, if there's any.\n */\n next?: string\n }\n /**\n * An object with useful metadata related to the current list. It can be used\n * in applications to create pagination logic and interfaces.\n *\n * `from` and `to` are indexes indicating which items start and finish the\n * current page of the list. For instance, in a list with 100 items with 15\n * items per page, on the first page, `from` and `to` will be `1` and `15`\n * respectively.\n */\n meta: {\n /**\n * The number of the current page.\n */\n current_page: number\n /**\n * The number of the last page for the current list.\n */\n last_page: number\n /**\n * The index of the first item on this page out of all list items.\n */\n from: number\n /**\n * The index of the last item on this page out of all list items.\n */\n to: number\n /**\n * The number of items per page.\n */\n per_page: number\n /**\n * The total number of items in the current list.\n */\n total: number\n }\n}\n\n/**\n * The DefaultModelDefinition type is used to correctly type Entry data when\n * requesting it using a StarlightClient.\n *\n * Without using a DefaultModelDefinition, Entry data will be typed as a\n * \"generic\" JS object which can hold any kind of data:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // response type will be StarlightItemResponse<Entry> on request success.\n * const response = await Starlight.posts.entries.get('hello-world')\n *\n * // helloWorld type is Entry<Record<string, unknown>>. This means that\n * // `data` can hold anything, which is not type-safe.\n * const helloWorld = response.data\n * ```\n *\n * One way of safely adding type information to Entry objects is by passing a\n * data definition type to the EntrySelector when requesting something:\n *\n * ```ts\n * import Starlight, { VisualField, MediaField } from '@starlightcms/js-sdk'\n *\n * type PostFields = {\n * featured_image: MediaField\n * content: VisualField\n * }\n *\n * // response type will now be StarlightItemResponse<Entry<PostsFields>>.\n * const response = await Starlight.posts.entries<PostFields>.get('hello-world')\n *\n * // Now, helloWorld type is Entry<PostsFields>.\n * const helloWorld = response.data\n *\n * // Which means we can safely access its data, and IDEs will\n * // auto-complete the data field name below:\n * console.log(helloWorld.data.featured_image)\n * ```\n *\n * Note that we used \"Fields\" to define our data shape. We recommend using these\n * types, which are exported by this SDK, because they map to the field types\n * available in the Starlight admin when creating models, and should simplify\n * the type definition process. All available Field types are documented in the\n * {@apilink BooleanField | Data Fields section of this API}.\n *\n * However, passing model definition types around your application is not ideal,\n * and actually unnecessary. Using the DefaultModelDefinition type, all model\n * definitions can be automatically inferred.\n *\n * To get started, you need to create a\n * [type declaration file](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html)\n * in which you'll define all your types. You can name it anything and place it\n * anywhere inside your project, but we recommend naming it `starlight.d.ts` and\n * placing it in the root folder of your source code, so it can be easily\n * imported later in your application if you ever need to reference these types.\n *\n * In this file, you can place all your model type definitions (including type\n * definitions for Singleton data, if you want!). Finally, you just need to\n * add a \"module definition block\" that will tell the SDK which types you expect\n * to receive when requesting models.\n *\n * Here's a complete exemple defining two models, Posts and Magazines:\n *\n * ```ts\n * import { StringField, VisualField, MediaField } from '@starlightcms/js-sdk'\n *\n * type PostFields = {\n * featured_image: MediaField\n * content: VisualField\n * }\n *\n * type MagazineFields = {\n * cover_image: MediaField\n * content: VisualField\n * issue_number: StringField\n * issue_year: StringField\n * }\n *\n * declare module '@starlightcms/js-sdk' {\n * export interface DefaultModelDefinition {\n * // Notice that each key in this interface is a Model slug!\n * posts: PostFields\n * magazines: MagazineFields\n * }\n * }\n * ```\n *\n * After creating this file, types should be automatically inferred without the\n * need to pass these types around:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // response type will be StarlightItemResponse<Entry<PostsFields>>,\n * // which was implicitly inferred by the SDK!\n * const response = await Starlight.posts.entries.get('hello-world')\n *\n * // helloWorld type is Entry<PostsFields>\n * const helloWorld = response.data\n *\n * // Auto-complete will work just as before when we explicitly type the Entry!\n * console.log(helloWorld.data.featured_image)\n * ```\n *\n * @group Client\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface DefaultModelDefinition extends WorkspaceModelDefinition {}\n\n/**\n * This type is only used as a base for the DefaultModelDefinition type.\n *\n * @internal\n */\nexport interface WorkspaceModelDefinition {\n [slug: string]: SerializedData\n}\n\n/**\n * Request parameters used by most SDK `list()` methods.\n *\n * @group Request Parameters\n */\nexport interface BaseRequestParameters {\n [key: string]: string | number | boolean | undefined\n /**\n * The page requested.\n */\n page?: number\n /**\n * The limit of items per page.\n */\n limit?: number\n /**\n * A search query string.\n *\n * For instance, searching for \"out\" will match both \"check out!\" and\n * \"about us\". Search is not case-sensitive.\n */\n query?: string\n}\n\n/**\n * Request parameters used by most SDK methods that support advanced querying.\n *\n * @group Request Parameters\n */\nexport interface QueryableRequestParameters {\n /**\n * A search query string that matches a specific word within boundaries.\n * Search is not case-sensitive.\n *\n * For instance, searching for \"phone\" will match \"This is my phone!\"\n * but won't match \"This is my telephone!\".\n */\n 'query:word'?: string\n /**\n * A comma-separated list of fields to look up on when searching using\n * `query` or `query:word`. If undefined, all text fields will be searched on,\n * including Visual Editor fields. Search is not case-sensitive.\n *\n * For instance, to limit search on the \"content\" and \"summary\" fields of a\n * model, pass `'content,summary'`.\n */\n fields?: string\n /**\n * If defined, removes the given item from the list. Useful to create \"related\n * posts\" lists.\n *\n * Note: this field only accepts IDs, and not slugs. Only one ID is allowed.\n */\n except?: number\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAWA,2CAAwB;AACxB,6CAA0B;AAC1B,2CAAwB;AACxB,8CAA2B;AAC3B,8CAA2B","sourcesContent":["import { CollectionEntityTypes, SerializedData } from './entities'\nimport { DynamicModelSelector } from '../selectors/Model'\nimport { DynamicModelInstance } from '../instances/Model'\nimport { SingletonSelector } from '../selectors/Singleton'\nimport { DynamicCollectionSelector } from '../selectors/Collection'\nimport { MediaSelector } from '../selectors/Media'\nimport { SearchSelector } from '../selectors/Search'\nimport { CollectionInstance } from '../instances/Collection'\nimport { FormInstance } from '../instances/Form'\nimport { DynamicFormSelector } from '../selectors/Form/types'\n\nexport * from './fields'\nexport * from './entities'\nexport * from './visual'\nexport * from './instances'\nexport * from './selectors'\n\n/**\n * This is a utility type that allows any string to be used as a URL, but\n * provides a default one which can be used by IDEs to provide auto-completion.\n * The default URL points to version 2 of the Query API.\n */\nexport type BaseUrl = 'https://query.starlightcms.io/v2' | string\n\n/**\n * The available options to configure a {@link StarlightClient}.\n *\n * `workspace` is required when creating new clients or configuring the\n * {@apilink default | default client}.\n * @group Client\n */\nexport type StarlightConfig = {\n /**\n * The ID of the workspace that the client should use to request data.\n *\n * Note: the current APIs only support using workspace IDs as identifiers,\n * and **not** slugs. Slug support will be added in the future. You can find\n * the workspace ID in the left-side menu on the Starlight interface or below\n * the workspace name in the workspace list.\n */\n workspace?: string\n /**\n * The Starlight Query API URL, including the version, and without a trailing\n * slash. Defaults to the production Query API URL.\n *\n * You only need to set this if you're not using Starlight's production APIs.\n */\n baseUrl?: BaseUrl\n /**\n * When true, logs all API requests in the console. Defaults to false.\n */\n debug?: boolean\n}\n\n/**\n * The Starlight client is the main entry point for any requests you might want\n * to make to Starlight's APIs.\n *\n * There's two ways of interacting with a client: using the\n * {@apilink default | default client} exported by the SDK or creating a new\n * client instance using the\n * {@apilink makeStarlightClient | makeStarlightClient function}. Follow the\n * provided links to learn how to use each method.\n *\n * Either way you choose to interact, all clients expose the same methods and\n * accessors that provide ways to request data. These methods and accessors\n * return Selector or Instance objects, which are documented in the sections\n * of the same name found in this API's sidebar.\n *\n * @group Client\n */\nexport interface StarlightClient<\n D extends WorkspaceModelDefinition = DefaultModelDefinition,\n> {\n /**\n * Updates the client configuration. See {@link StarlightConfig} to see all\n * the available options.\n *\n * If you want to use the {@apilink default | default SDK client}, you need to\n * set its workspace using this method in your application. You should run\n * this method only once, and as soon as possible in your application\n * lifecycle. For instance, when using React:\n *\n * ```js\n * // src/index.js\n * import { createRoot } from \"react-dom/client\"\n * import Starlight from '@starlightcms/js-sdk'\n * import MyApp from './MyApp.js'\n *\n * // We only need to run this once. In this case, we're\n * // running it before initializing our React app.\n * Starlight.configure({\n * workspace: '1234567890'\n * })\n *\n * const rootElement = document.getElementById(\"root\")\n * const root = createRoot(rootElement)\n *\n * root.render(<MyApp />)\n * ```\n *\n * @param config A configuration object. See {@link StarlightConfig} to view\n * all available options.\n * @category Other Methods\n */\n configure(config: StarlightConfig): void\n\n /**\n * Logs a message (or any kind of data, really) into the console if the debug\n * configuration is true. Uses `console.log` internally.\n *\n * This function's type definition is the same as the `console.log` function.\n *\n * @param message The data that will be logged.\n * @param optionalParams Additional data to be logged or string substitutions.\n * @see [MDN documentation on console.log](https://developer.mozilla.org/en-US/docs/web/api/console/log)\n * @internal\n */\n log(message?: unknown, ...optionalParams: unknown[]): void\n\n /**\n * Returns the base API URL for requests, including the configured workspace.\n * Doesn't include a trailing slash.\n *\n * @internal\n */\n getBaseUrl(): string\n\n /**\n * Returns a Promise that results in a response or throws a StarlightError.\n * The response will be the parsed JSON data sent by the API.\n *\n * This method is used internally by all Selectors and Instances to request\n * data to Starlight's Query API, but it can also be used standalone if\n * desired.\n *\n * This method automatically prefixes the given path with the API URL, but it\n * doesn't include a trailing slash, so be sure to include one at the start\n * of your path.\n *\n * @param path The path to GET. Will be prefixed with the API URL. Must start\n * with a forward slash (/).\n * @param params An optional object of values that will be converted to a\n * string and passed as GET params.\n * @param options An optional configuration object passed to the fetch method.\n * Check [MDN documentation on fetch](https://developer.mozilla.org/en-US/docs/Web/API/fetch)\n * to see the available options.\n * @typeParam T - The shape of the expected response on success. Client\n * methods generally pass {@link StarlightItemResponse} or\n * {@link StarlightListResponse} types here.\n * @throws {@link StarlightError} on any errors.\n * @category Other Methods\n */\n get<T = Record<string, unknown>>(\n path: string,\n params?: BaseRequestParameters,\n options?: RequestInit,\n ): Promise<T>\n\n /**\n * Returns a {@link DynamicModelSelector}, which is a {@link ModelSelector}\n * with support for creating {@apilink ModelInstance | ModelInstances} using the dynamic syntax.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.models.list()\n * ```\n *\n * See {@link DynamicModelSelector} for more info.\n *\n * @category Selector Accessors\n */\n get models(): DynamicModelSelector<D>\n\n /**\n * Returns a {@link DynamicModelInstance}, which is a\n * {@link ModelInstance} with support for creating\n * {@apilink ModelCategoryInstance | ModelCategoryInstances} using the dynamic syntax. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.model('posts').entries.list()\n * ```\n *\n * See {@link DynamicModelInstance} for more info.\n *\n * @category Instance Methods\n */\n model<S extends keyof D>(slug: S): DynamicModelInstance<D[S]>\n\n /**\n * Returns a {@link DynamicFormSelector}, which provides support for creating\n * {@apilink FormInstance | FormInstances} using the dynamic syntax.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.forms.signup.get()\n * ```\n *\n * See {@link DynamicFormSelector} for more info.\n *\n * @category Selector Accessors\n */\n get forms(): DynamicFormSelector\n\n /**\n * Returns a {@link FormInstance}, which provides methods to retrieve basic information\n * about a Starlight form and its schema. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.form('signup').schema()\n * ```\n *\n * See {@link FormInstance} for more info.\n *\n * @category Instance Methods\n */\n form(slug: string | number): FormInstance\n\n /**\n * Returns a {@link SingletonSelector}.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.singletons.list()\n * ```\n *\n * See {@link SingletonSelector} for more info.\n *\n * @category Selector Accessors\n */\n get singletons(): SingletonSelector\n\n /**\n * Returns a {@link DynamicCollectionSelector}, which is a\n * {@link CollectionSelector} with support for creating\n * {@apilink CollectionInstance | CollectionInstances} using the dynamic syntax.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collections.list()\n * ```\n *\n * See {@link DynamicCollectionSelector} for more info.\n *\n * @category Selector Accessors\n */\n get collections(): DynamicCollectionSelector\n\n /**\n * Returns a {@link CollectionInstance}. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collection('featured-posts').items()\n * ```\n *\n * See {@link CollectionInstance} for more info.\n *\n * @example Typing the returned CollectionInstance.\n * ```ts\n * import Starlight, { MediaObject } from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collection<MediaObject>('carousel-images').items()\n * ```\n *\n * @typeParam T - The type of entity this Collection holds. You can pass this\n * type parameter to correctly type the response of the\n * {@apilink CollectionInstance.items} method.\n * @category Instance Methods\n */\n collection<T extends CollectionEntityTypes>(\n slug: string | number,\n ): CollectionInstance<T>\n\n /**\n * Returns a {@link MediaSelector}.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.media.list()\n * ```\n *\n * See {@link MediaSelector} for more info.\n *\n * @category Selector Accessors\n */\n get media(): MediaSelector\n\n /**\n * Returns a {@link SearchSelector}.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.search.entries()\n * ```\n *\n * See {@link SearchSelector} for more info.\n *\n * @category Selector Accessors\n */\n get search(): SearchSelector\n}\n\n/**\n * This type adds support for the dynamic syntax to the StarlightClient\n * interface, which allows users to create\n * {@apilink DynamicModelInstance| DynamicModelInstances} dynamically.\n * See {@link StarlightClient} to learn which methods it provides. Also see\n * {@doclink requests-and-responses#dynamic-syntax | Dynamic Instances}\n * documentation to learn more about the dynamic syntax.\n *\n *\n * This allows TypeScript to correctly type all models defined by the user\n * in the DefaultModelDefinition type, aside from letting the user using any\n * \"unknown\" model slug, which is provided by the WorkspaceModelDefinition type.\n *\n * This type is only aware of the DefaultModelDefinition type because the\n * StarlightClient uses it by default when no model definition type is passed.\n *\n * @group Client\n */\nexport type DynamicStarlightClient<T extends WorkspaceModelDefinition> =\n StarlightClient<T> & {\n [K in keyof T]: DynamicModelInstance<T[K]>\n }\n\n/**\n * This interface represents an API response that returns a single entity, like\n * a single {@link Entry} or a single {@link MediaObject}, for instance.\n *\n * It contains only one field: `data`. This field type is generic and\n * depends on the kind of request that was made to the API.\n *\n * All SDK request methods that returna single entity\n * will return this interface.\n *\n * @group Client\n */\nexport interface StarlightItemResponse<T> {\n /**\n * The entity returned by the API request. Its type depends on which request\n * was made. SDK methods will generally type this parameter automatically.\n */\n data: T\n}\n\n/**\n * This interface represents an API response that returns a list of entities,\n * like a list of {@apilink Entry | Entries} or a list of items from a\n * {@link Collection}.\n *\n * It contains a `data` parameter, which is an array of items with a generic\n * type that depends on the kind of request that was made, and two metadata\n * objects: `links` and `meta`. Metadata is useful for pagination.\n *\n * All SDK request methods that return a list of entities will return this\n * interface.\n *\n * @group Client\n */\nexport interface StarlightListResponse<T> {\n /**\n * The list of entities returned by the API request. Its type depends on which\n * request was made. SDK methods will generally type\n * this parameter automatically.\n */\n data: T[]\n /**\n * An object containing useful links for easier pagination. All links points\n * to the same list requested, but with a varying `page` parameter.\n */\n links: {\n /**\n * A link for the first page of the list.\n */\n first: string\n /**\n * A link for the last page of the list.\n */\n last: string\n /**\n * A link to the previous page of the list, if there's any.\n */\n prev?: string\n /**\n * A link to the next page of the list, if there's any.\n */\n next?: string\n }\n /**\n * An object with useful metadata related to the current list. It can be used\n * in applications to create pagination logic and interfaces.\n *\n * `from` and `to` are indexes indicating which items start and finish the\n * current page of the list. For instance, in a list with 100 items with 15\n * items per page, on the first page, `from` and `to` will be `1` and `15`\n * respectively.\n */\n meta: {\n /**\n * The number of the current page.\n */\n current_page: number\n /**\n * The number of the last page for the current list.\n */\n last_page: number\n /**\n * The index of the first item on this page out of all list items.\n */\n from: number\n /**\n * The index of the last item on this page out of all list items.\n */\n to: number\n /**\n * The number of items per page.\n */\n per_page: number\n /**\n * The total number of items in the current list.\n */\n total: number\n }\n}\n\n/**\n * The DefaultModelDefinition type is used to correctly type Entry data when\n * requesting it using a StarlightClient.\n *\n * Without using a DefaultModelDefinition, Entry data will be typed as a\n * \"generic\" JS object which can hold any kind of data:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // response type will be StarlightItemResponse<Entry> on request success.\n * const response = await Starlight.posts.entries.get('hello-world')\n *\n * // helloWorld type is Entry<Record<string, unknown>>. This means that\n * // `data` can hold anything, which is not type-safe.\n * const helloWorld = response.data\n * ```\n *\n * One way of safely adding type information to Entry objects is by passing a\n * data definition type to the EntrySelector when requesting something:\n *\n * ```ts\n * import Starlight, { VisualField, MediaField } from '@starlightcms/js-sdk'\n *\n * type PostFields = {\n * featured_image: MediaField\n * content: VisualField\n * }\n *\n * // response type will now be StarlightItemResponse<Entry<PostsFields>>.\n * const response = await Starlight.posts.entries<PostFields>.get('hello-world')\n *\n * // Now, helloWorld type is Entry<PostsFields>.\n * const helloWorld = response.data\n *\n * // Which means we can safely access its data, and IDEs will\n * // auto-complete the data field name below:\n * console.log(helloWorld.data.featured_image)\n * ```\n *\n * Note that we used \"Fields\" to define our data shape. We recommend using these\n * types, which are exported by this SDK, because they map to the field types\n * available in the Starlight admin when creating models, and should simplify\n * the type definition process. All available Field types are documented in the\n * {@apilink BooleanField | Data Fields section of this API}.\n *\n * However, passing model definition types around your application is not ideal,\n * and actually unnecessary. Using the DefaultModelDefinition type, all model\n * definitions can be automatically inferred.\n *\n * To get started, you need to create a\n * [type declaration file](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html)\n * in which you'll define all your types. You can name it anything and place it\n * anywhere inside your project, but we recommend naming it `starlight.d.ts` and\n * placing it in the root folder of your source code, so it can be easily\n * imported later in your application if you ever need to reference these types.\n *\n * In this file, you can place all your model type definitions (including type\n * definitions for Singleton data, if you want!). Finally, you just need to\n * add a \"module definition block\" that will tell the SDK which types you expect\n * to receive when requesting models.\n *\n * Here's a complete exemple defining two models, Posts and Magazines:\n *\n * ```ts\n * import { StringField, VisualField, MediaField } from '@starlightcms/js-sdk'\n *\n * type PostFields = {\n * featured_image: MediaField\n * content: VisualField\n * }\n *\n * type MagazineFields = {\n * cover_image: MediaField\n * content: VisualField\n * issue_number: StringField\n * issue_year: StringField\n * }\n *\n * declare module '@starlightcms/js-sdk' {\n * export interface DefaultModelDefinition {\n * // Notice that each key in this interface is a Model slug!\n * posts: PostFields\n * magazines: MagazineFields\n * }\n * }\n * ```\n *\n * After creating this file, types should be automatically inferred without the\n * need to pass these types around:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // response type will be StarlightItemResponse<Entry<PostsFields>>,\n * // which was implicitly inferred by the SDK!\n * const response = await Starlight.posts.entries.get('hello-world')\n *\n * // helloWorld type is Entry<PostsFields>\n * const helloWorld = response.data\n *\n * // Auto-complete will work just as before when we explicitly type the Entry!\n * console.log(helloWorld.data.featured_image)\n * ```\n *\n * @group Client\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface DefaultModelDefinition extends WorkspaceModelDefinition {}\n\n/**\n * This type is only used as a base for the DefaultModelDefinition type.\n *\n * @internal\n */\nexport interface WorkspaceModelDefinition {\n [slug: string]: SerializedData\n}\n\n/**\n * An object that accepts any string, number and boolean values.\n * Used as the base for most request parameter interfaces in the SDK.\n *\n * @group Request Parameters\n */\nexport interface BaseRequestParameters {\n [key: string]: string | number | boolean | undefined\n}\n\n/**\n * Request parameters used by most SDK `list()` methods.\n *\n * @group Request Parameters\n */\nexport interface ListRequestParameters extends BaseRequestParameters {\n /**\n * The page requested.\n */\n page?: number\n /**\n * The limit of items per page.\n */\n limit?: number\n /**\n * A search query string.\n *\n * For instance, searching for \"out\" will match both \"check out!\" and\n * \"about us\". Search is not case-sensitive.\n */\n query?: string\n}\n\n/**\n * Request parameters used by most SDK methods that support advanced querying.\n *\n * @group Request Parameters\n */\nexport interface QueryableRequestParameters {\n /**\n * A search query string that matches a specific word within boundaries.\n * Search is not case-sensitive.\n *\n * For instance, searching for \"phone\" will match \"This is my phone!\"\n * but won't match \"This is my telephone!\".\n */\n 'query:word'?: string\n /**\n * A comma-separated list of fields to look up on when searching using\n * `query` or `query:word`. If undefined, all text fields will be searched on,\n * including Visual Editor fields. Search is not case-sensitive.\n *\n * For instance, to limit search on the \"content\" and \"summary\" fields of a\n * model, pass `'content,summary'`.\n */\n fields?: string\n /**\n * If defined, removes the given item from the list. Useful to create \"related\n * posts\" lists.\n *\n * Note: this field only accepts IDs, and not slugs. Only one ID is allowed.\n */\n except?: number\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EAEtB,eAAe,EACf,wBAAwB,EACzB,MAAM,SAAS,CAAA;AAYhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,UAAU,CACxB,CAAC,SAAS,wBAAwB,GAAG,sBAAsB,EAE3D,MAAM,GAAE,eAAoB,GAC3B,sBAAsB,CAAC,CAAC,GAAG,wBAAwB,CAAC,CAgGtD"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EAEtB,eAAe,EACf,wBAAwB,EACzB,MAAM,SAAS,CAAA;AAYhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,UAAU,CACxB,CAAC,SAAS,wBAAwB,GAAG,sBAAsB,EAE3D,MAAM,GAAE,eAAoB,GAC3B,sBAAsB,CAAC,CAAC,GAAG,wBAAwB,CAAC,CAoGtD"}
@@ -82,7 +82,7 @@ export function makeClient(config = {}) {
82
82
  return __awaiter(this, arguments, void 0, function* (path, params = {}, options) {
83
83
  const filteredParams = Object.keys(params).reduce((accumulator, key) => {
84
84
  const param = params[key];
85
- if (param || param === false)
85
+ if (param || param === false || param === 0)
86
86
  accumulator[key] = String(param);
87
87
  return accumulator;
88
88
  }, {});
@@ -1 +1 @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kspaceModelDefinition,\n} from './types'\nimport { StarlightError } from './errors'\nimport makeModelSelector from './selectors/Model'\nimport makeModelInstance from './instances/Model'\nimport makeSingletonSelector from './selectors/Singleton'\nimport makeCollectionSelector from './selectors/Collection'\nimport makeMediaSelector from './selectors/Media'\nimport makeSearchSelector from './selectors/Search'\nimport makeCollectionInstance from './instances/Collection'\nimport makeFormSelector from './selectors/Form'\nimport makeFormInstance from './instances/Form'\n\n/**\n * Returns a new {@link DynamicStarlightClient}, which is a\n * {@link StarlightClient} with support to create\n * {@apilink ModelInstance | ModelInstances} using the dynamic syntax. To learn\n * which methods a client supports, see {@link StarlightClient}.\n *\n * This function accepts a {@link StarlightConfig} object and can be used to\n * create new clients that connect to a single Starlight workspace. Each client\n * returned by this function is separate and independent of the others.\n *\n * If you only need to make requests to a single workspace, it's probably easier\n * to use the SDK's default client. To use it, you only need to\n * import the default object exported by the SDK:\n *\n * ```ts\n * // `Starlight` below is the default StarlightClient.\n * import Starlight from '@starlightcms/js-sdk'\n * ```\n *\n * See {@link default} for more info on how to use the default client.\n *\n * @example Creating a new client and exporting it.\n * ```ts\n * import { makeStarlightClient } from '@starlightcms/js-sdk'\n *\n * const BlogClient = makeStarlightClient({\n * workspace: '123123123',\n * debug: true\n * })\n *\n * // Feel free to export the new client so your application can use it.\n * export default BlogClient\n * ```\n *\n * @param config The client configuration object. You need to provide at least\n * the `workspace` property. See {@link StarlightConfig} to view all the\n * available options.\n * @group Client\n */\nexport function makeClient<\n D extends WorkspaceModelDefinition = DefaultModelDefinition\n>(\n config: StarlightConfig = {}\n): DynamicStarlightClient<D & WorkspaceModelDefinition> {\n let baseUrl = config.baseUrl ?? 'https://query.starlightcms.io/v2'\n let workspace = config.workspace ?? ''\n let debug = config.debug ?? false\n\n const client: StarlightClient = {\n configure(config) {\n baseUrl = config.baseUrl ?? baseUrl\n workspace = config.workspace ?? workspace\n debug = config.debug ?? debug\n },\n\n log(message, ...optionalParams) {\n if (debug) console.log(message, ...optionalParams)\n },\n\n getBaseUrl() {\n if (!workspace.length) {\n throw new Error(\n 'No workspace defined. Use the `configure()` method on the Starlight client to define one.'\n )\n }\n\n return `${baseUrl}/workspaces/${workspace}`\n },\n\n async get(path, params = {}, options) {\n const filteredParams = Object.keys(params).reduce((accumulator, key) => {\n const param = params[key]\n\n if (param || param === false) accumulator[key] = String(param)\n\n return accumulator\n }, {} as Record<string, string>)\n\n const searchParams = new URLSearchParams(filteredParams).toString()\n const finalPath = searchParams ? `${path}?${searchParams}` : path\n\n this.log(`Starlight - GET ${finalPath}`)\n\n const response = await fetch(`${this.getBaseUrl()}${finalPath}`, options)\n\n if (response.status >= 200 && response.status < 300) {\n return await response.json()\n } else {\n const message = `Starlight - GET ${path} returned ${response.status}: ${response.statusText}`\n throw new StarlightError(message, response)\n }\n },\n\n get models() {\n return makeModelSelector(this)\n },\n\n model(slug) {\n return makeModelInstance(this, slug as string)\n },\n\n get forms() {\n return makeFormSelector(this)\n },\n\n form(slug) {\n return makeFormInstance(this, String(slug))\n },\n\n get singletons() {\n return makeSingletonSelector(this)\n },\n\n get collections() {\n return makeCollectionSelector(this)\n },\n\n collection(slug) {\n return makeCollectionInstance(this, slug)\n },\n\n get media() {\n return makeMediaSelector(this)\n },\n\n get search() {\n return makeSearchSelector(this)\n },\n }\n\n return new Proxy(client, {\n get(target, prop) {\n if (typeof prop === 'string' && !Reflect.has(target, prop)) {\n return makeModelInstance(target, prop)\n }\n\n return Reflect.get(target, prop)\n },\n }) as DynamicStarlightClient<D & WorkspaceModelDefinition>\n}\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;;;;;;;AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,iBAAiB,MAAM,mBAAmB,CAAA;AACjD,OAAO,iBAAiB,MAAM,mBAAmB,CAAA;AACjD,OAAO,qBAAqB,MAAM,uBAAuB,CAAA;AACzD,OAAO,sBAAsB,MAAM,wBAA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gB,CAAC,IAAI,CAAC,CAAA;QAC/B,CAAC;QAED,IAAI,CAAC,IAAI;YACP,OAAO,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;QAC7C,CAAC;QAED,IAAI,UAAU;YACZ,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAA;QACpC,CAAC;QAED,IAAI,WAAW;YACb,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAA;QACrC,CAAC;QAED,UAAU,CAAC,IAAI;YACb,OAAO,sBAAsB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QAC3C,CAAC;QAED,IAAI,KAAK;YACP,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAA;QAChC,CAAC;QAED,IAAI,MAAM;YACR,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAA;QACjC,CAAC;KACF,CAAA;IAED,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE;QACvB,GAAG,CAAC,MAAM,EAAE,IAAI;YACd,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;gBAC3D,OAAO,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;YACxC,CAAC;YAED,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;KACF,CAAyD,CAAA;AAC5D,CAAC","sourcesContent":["import {\n DefaultModelDefinition,\n DynamicStarlightClient,\n StarlightClient,\n StarlightConfig,\n WorkspaceModelDefinition,\n} from './types'\nimport { StarlightError } from './errors'\nimport makeModelSelector from './selectors/Model'\nimport makeModelInstance from './instances/Model'\nimport makeSingletonSelector from './selectors/Singleton'\nimport makeCollectionSelector from './selectors/Collection'\nimport makeMediaSelector from './selectors/Media'\nimport makeSearchSelector from './selectors/Search'\nimport makeCollectionInstance from './instances/Collection'\nimport makeFormSelector from './selectors/Form'\nimport makeFormInstance from './instances/Form'\n\n/**\n * Returns a new {@link DynamicStarlightClient}, which is a\n * {@link StarlightClient} with support to create\n * {@apilink ModelInstance | ModelInstances} using the dynamic syntax. To learn\n * which methods a client supports, see {@link StarlightClient}.\n *\n * This function accepts a {@link StarlightConfig} object and can be used to\n * create new clients that connect to a single Starlight workspace. Each client\n * returned by this function is separate and independent of the others.\n *\n * If you only need to make requests to a single workspace, it's probably easier\n * to use the SDK's default client. To use it, you only need to\n * import the default object exported by the SDK:\n *\n * ```ts\n * // `Starlight` below is the default StarlightClient.\n * import Starlight from '@starlightcms/js-sdk'\n * ```\n *\n * See {@link default} for more info on how to use the default client.\n *\n * @example Creating a new client and exporting it.\n * ```ts\n * import { makeStarlightClient } from '@starlightcms/js-sdk'\n *\n * const BlogClient = makeStarlightClient({\n * workspace: '123123123',\n * debug: true\n * })\n *\n * // Feel free to export the new client so your application can use it.\n * export default BlogClient\n * ```\n *\n * @param config The client configuration object. You need to provide at least\n * the `workspace` property. See {@link StarlightConfig} to view all the\n * available options.\n * @group Client\n */\nexport function makeClient<\n D extends WorkspaceModelDefinition = DefaultModelDefinition,\n>(\n config: StarlightConfig = {},\n): DynamicStarlightClient<D & WorkspaceModelDefinition> {\n let baseUrl = config.baseUrl ?? 'https://query.starlightcms.io/v2'\n let workspace = config.workspace ?? ''\n let debug = config.debug ?? false\n\n const client: StarlightClient = {\n configure(config) {\n baseUrl = config.baseUrl ?? baseUrl\n workspace = config.workspace ?? workspace\n debug = config.debug ?? debug\n },\n\n log(message, ...optionalParams) {\n if (debug) console.log(message, ...optionalParams)\n },\n\n getBaseUrl() {\n if (!workspace.length) {\n throw new Error(\n 'No workspace defined. Use the `configure()` method on the Starlight client to define one.',\n )\n }\n\n return `${baseUrl}/workspaces/${workspace}`\n },\n\n async get(path, params = {}, options) {\n const filteredParams = Object.keys(params).reduce(\n (accumulator, key) => {\n const param = params[key]\n\n if (param || param === false || param === 0)\n accumulator[key] = String(param)\n\n return accumulator\n },\n {} as Record<string, string>,\n )\n\n const searchParams = new URLSearchParams(filteredParams).toString()\n const finalPath = searchParams ? `${path}?${searchParams}` : path\n\n this.log(`Starlight - GET ${finalPath}`)\n\n const response = await fetch(`${this.getBaseUrl()}${finalPath}`, options)\n\n if (response.status >= 200 && response.status < 300) {\n return await response.json()\n } else {\n const message = `Starlight - GET ${path} returned ${response.status}: ${response.statusText}`\n throw new StarlightError(message, response)\n }\n },\n\n get models() {\n return makeModelSelector(this)\n },\n\n model(slug) {\n return makeModelInstance(this, slug as string)\n },\n\n get forms() {\n return makeFormSelector(this)\n },\n\n form(slug) {\n return makeFormInstance(this, String(slug))\n },\n\n get singletons() {\n return makeSingletonSelector(this)\n },\n\n get collections() {\n return makeCollectionSelector(this)\n },\n\n collection(slug) {\n return makeCollectionInstance(this, slug)\n },\n\n get media() {\n return makeMediaSelector(this)\n },\n\n get search() {\n return makeSearchSelector(this)\n },\n }\n\n return new Proxy(client, {\n get(target, prop) {\n if (typeof prop === 'string' && !Reflect.has(target, prop)) {\n return makeModelInstance(target, prop)\n }\n\n return Reflect.get(target, prop)\n },\n }) as DynamicStarlightClient<D & WorkspaceModelDefinition>\n}\n"]}
@@ -1,10 +1,10 @@
1
1
  export default function makeCollectionInstance(client, collection) {
2
2
  return {
3
- get() {
4
- return client.get(`/collections/${collection}`);
3
+ get(params, options) {
4
+ return client.get(`/collections/${collection}`, params, options);
5
5
  },
6
- items(options) {
7
- return client.get(`/collections/${collection}/items`, options);
6
+ items(params, options) {
7
+ return client.get(`/collections/${collection}/items`, params, options);
8
8
  },
9
9
  };
10
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/instances/Collection/index.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAE5C,MAAuB,EAAE,UAA2B;IACpD,OAAO;QACL,GAAG;YACD,OAAO,MAAM,CAAC,GAAG,CAAC,gBAAgB,UAAU,EAAE,CAAC,CAAA;QACjD,CAAC;QAED,KAAK,CAAC,OAAO;YACX,OAAO,MAAM,CAAC,GAAG,CAAC,gBAAgB,UAAU,QAAQ,EAAE,OAAO,CAAC,CAAA;QAChE,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import { CollectionEntityTypes, StarlightClient } from '../../types'\nimport { CollectionInstance, ListCollectionItemsParams } from './types'\n\nexport default function makeCollectionInstance<\n T extends CollectionEntityTypes = unknown\n>(client: StarlightClient, collection: string | number): CollectionInstance<T> {\n return {\n get() {\n return client.get(`/collections/${collection}`)\n },\n\n items(options) {\n return client.get(`/collections/${collection}/items`, options)\n },\n }\n}\n\nexport { CollectionInstance, ListCollectionItemsParams }\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/instances/Collection/index.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAE5C,MAAuB,EAAE,UAA2B;IACpD,OAAO;QACL,GAAG,CAAC,MAAM,EAAE,OAAO;YACjB,OAAO,MAAM,CAAC,GAAG,CAAC,gBAAgB,UAAU,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QAClE,CAAC;QAED,KAAK,CAAC,MAAM,EAAE,OAAO;YACnB,OAAO,MAAM,CAAC,GAAG,CAAC,gBAAgB,UAAU,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QACxE,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import { CollectionEntityTypes, StarlightClient } from '../../types'\nimport { CollectionInstance, ListCollectionItemsParams } from './types'\n\nexport default function makeCollectionInstance<\n T extends CollectionEntityTypes = unknown,\n>(client: StarlightClient, collection: string | number): CollectionInstance<T> {\n return {\n get(params, options) {\n return client.get(`/collections/${collection}`, params, options)\n },\n\n items(params, options) {\n return client.get(`/collections/${collection}/items`, params, options)\n },\n }\n}\n\nexport { CollectionInstance, ListCollectionItemsParams }\n"]}
@@ -1,4 +1,4 @@
1
- import { BaseRequestParameters, Collection, CollectionEntityTypes, CollectionTypeMapper, QueryableRequestParameters, StarlightItemResponse, StarlightListResponse, WithQueryableFieldsOnModelables } from '../../types';
1
+ import { ListRequestParameters, Collection, CollectionEntityTypes, CollectionTypeMapper, QueryableRequestParameters, StarlightItemResponse, StarlightListResponse, WithQueryableFieldsOnModelables, BaseRequestParameters } from '../../types';
2
2
  /**
3
3
  * Request parameters for listing collection items.
4
4
  *
@@ -6,7 +6,7 @@ import { BaseRequestParameters, Collection, CollectionEntityTypes, CollectionTyp
6
6
  *
7
7
  * @group Request Parameters
8
8
  */
9
- export interface ListCollectionItemsParams extends BaseRequestParameters, QueryableRequestParameters {
9
+ export interface ListCollectionItemsParams extends ListRequestParameters, QueryableRequestParameters {
10
10
  /**
11
11
  * Define how entries will be ordered. Check this field type to see the
12
12
  * allowed options.
@@ -34,8 +34,13 @@ export interface CollectionInstance<C extends CollectionEntityTypes> {
34
34
  *
35
35
  * const response = await Starlight.collection('featured-news').get()
36
36
  * ```
37
+ *
38
+ * @param params An optional object of request parameters.
39
+ * @param options An optional object of fetch options. See
40
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for
41
+ * more info.
37
42
  */
38
- get(): Promise<StarlightItemResponse<Collection<CollectionTypeMapper<C>>>>;
43
+ get(params?: BaseRequestParameters, options?: RequestInit): Promise<StarlightItemResponse<Collection<CollectionTypeMapper<C>>>>;
39
44
  /**
40
45
  * Returns a {@link StarlightListResponse} with the list of items of this
41
46
  * {@link Collection}. The returned list type depends on the collection type:
@@ -62,10 +67,13 @@ export interface CollectionInstance<C extends CollectionEntityTypes> {
62
67
  * const response = await Starlight.collection<Entry<NewsPostType>>('featured-news').items()
63
68
  * ```
64
69
  *
65
- * @param options An optional object of request parameters. See
66
- * {@link ListCollectionItemsParams} for all available options. `field:foo`
70
+ * @param params An optional object of request parameters. See
71
+ * {@link ListCollectionItemsParams} for all available parameters. `field:foo`
67
72
  * syntax is also supported, see {@link QueryableFields} for more info.
73
+ * @param options An optional object of fetch options. See
74
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for
75
+ * more info.
68
76
  */
69
- items(options?: ListCollectionItemsParams | WithQueryableFieldsOnModelables<C>): Promise<StarlightListResponse<C>>;
77
+ items(params?: ListCollectionItemsParams | WithQueryableFieldsOnModelables<C>, options?: RequestInit): Promise<StarlightListResponse<C>>;
70
78
  }
71
79
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/instances/Collection/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,EACrB,+BAA+B,EAChC,MAAM,aAAa,CAAA;AAEpB;;;;;;GAMG;AACH,MAAM,WAAW,yBACf,SAAQ,qBAAqB,EAC3B,0BAA0B;IAC5B;;;OAGG;IACH,KAAK,CAAC,EACF,WAAW,GACX,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,WAAW,GACX,YAAY,CAAA;CACjB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,qBAAqB;IACjE;;;;;;;;;OASG;IACH,GAAG,IAAI,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAE1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,KAAK,CACH,OAAO,CAAC,EAAE,yBAAyB,GAAG,+BAA+B,CAAC,CAAC,CAAC,GACvE,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAA;CACrC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/instances/Collection/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,EACrB,+BAA+B,EAC/B,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAEpB;;;;;;GAMG;AACH,MAAM,WAAW,yBACf,SAAQ,qBAAqB,EAAE,0BAA0B;IACzD;;;OAGG;IACH,KAAK,CAAC,EACF,WAAW,GACX,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,WAAW,GACX,YAAY,CAAA;CACjB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,qBAAqB;IACjE;;;;;;;;;;;;;;OAcG;IACH,GAAG,CACD,MAAM,CAAC,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,KAAK,CACH,MAAM,CAAC,EAAE,yBAAyB,GAAG,+BAA+B,CAAC,CAAC,CAAC,EACvE,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAA;CACrC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/instances/Collection/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n BaseRequestParameters,\n Collection,\n CollectionEntityTypes,\n CollectionTypeMapper,\n QueryableRequestParameters,\n StarlightItemResponse,\n StarlightListResponse,\n WithQueryableFieldsOnModelables,\n} from '../../types'\n\n/**\n * Request parameters for listing collection items.\n *\n * Used by {@apilink CollectionInstance.items}.\n *\n * @group Request Parameters\n */\nexport interface ListCollectionItemsParams\n extends BaseRequestParameters,\n QueryableRequestParameters {\n /**\n * Define how entries will be ordered. Check this field type to see the\n * allowed options.\n */\n order?:\n | 'title:asc'\n | 'title:desc'\n | 'published_at:asc'\n | 'published_at:desc'\n | 'views:asc'\n | 'views:desc'\n}\n\n/**\n * An Instance that provide methods to request information and items from\n * a specific {@link Collection}.\n *\n * You can access a CollectionInstance using\n * {@apilink StarlightClient.collection}.\n *\n * To list all workspace collections, use a {@link CollectionSelector}.\n *\n * @group Instances\n */\nexport interface CollectionInstance<C extends CollectionEntityTypes> {\n /**\n * Returns a {@link StarlightItemResponse} with a single {@link Collection}.\n *\n * @example Requesting information from a collection of slug `featured-news`.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collection('featured-news').get()\n * ```\n */\n get(): Promise<StarlightItemResponse<Collection<CollectionTypeMapper<C>>>>\n\n /**\n * Returns a {@link StarlightListResponse} with the list of items of this\n * {@link Collection}. The returned list type depends on the collection type:\n * a list of {@apilink Entry | Entries} for a collection of type `entry`, a\n * list of {@apilink MediaObject | MediaObjects} for a collection o type\n * `media`, and so on.\n *\n * If the given Collection is not typed, this method will return a response of\n * `StarlightListResponse<unknown>`.\n *\n * @example Requesting all items from an Entry collection of slug `featured-news`.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collection('featured-news').items()\n * ```\n *\n * @example Explicitly typing the returned items. Only possible in TypeScript.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n * import { NewsPostType } from '../types'\n *\n * // response will be StarlightListResponse<Entry<NewsPostType>>\n * const response = await Starlight.collection<Entry<NewsPostType>>('featured-news').items()\n * ```\n *\n * @param options An optional object of request parameters. See\n * {@link ListCollectionItemsParams} for all available options. `field:foo`\n * syntax is also supported, see {@link QueryableFields} for more info.\n */\n items(\n options?: ListCollectionItemsParams | WithQueryableFieldsOnModelables<C>\n ): Promise<StarlightListResponse<C>>\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/instances/Collection/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n ListRequestParameters,\n Collection,\n CollectionEntityTypes,\n CollectionTypeMapper,\n QueryableRequestParameters,\n StarlightItemResponse,\n StarlightListResponse,\n WithQueryableFieldsOnModelables,\n BaseRequestParameters,\n} from '../../types'\n\n/**\n * Request parameters for listing collection items.\n *\n * Used by {@apilink CollectionInstance.items}.\n *\n * @group Request Parameters\n */\nexport interface ListCollectionItemsParams\n extends ListRequestParameters, QueryableRequestParameters {\n /**\n * Define how entries will be ordered. Check this field type to see the\n * allowed options.\n */\n order?:\n | 'title:asc'\n | 'title:desc'\n | 'published_at:asc'\n | 'published_at:desc'\n | 'views:asc'\n | 'views:desc'\n}\n\n/**\n * An Instance that provide methods to request information and items from\n * a specific {@link Collection}.\n *\n * You can access a CollectionInstance using\n * {@apilink StarlightClient.collection}.\n *\n * To list all workspace collections, use a {@link CollectionSelector}.\n *\n * @group Instances\n */\nexport interface CollectionInstance<C extends CollectionEntityTypes> {\n /**\n * Returns a {@link StarlightItemResponse} with a single {@link Collection}.\n *\n * @example Requesting information from a collection of slug `featured-news`.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collection('featured-news').get()\n * ```\n *\n * @param params An optional object of request parameters.\n * @param options An optional object of fetch options. See\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for\n * more info.\n */\n get(\n params?: BaseRequestParameters,\n options?: RequestInit,\n ): Promise<StarlightItemResponse<Collection<CollectionTypeMapper<C>>>>\n\n /**\n * Returns a {@link StarlightListResponse} with the list of items of this\n * {@link Collection}. The returned list type depends on the collection type:\n * a list of {@apilink Entry | Entries} for a collection of type `entry`, a\n * list of {@apilink MediaObject | MediaObjects} for a collection o type\n * `media`, and so on.\n *\n * If the given Collection is not typed, this method will return a response of\n * `StarlightListResponse<unknown>`.\n *\n * @example Requesting all items from an Entry collection of slug `featured-news`.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collection('featured-news').items()\n * ```\n *\n * @example Explicitly typing the returned items. Only possible in TypeScript.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n * import { NewsPostType } from '../types'\n *\n * // response will be StarlightListResponse<Entry<NewsPostType>>\n * const response = await Starlight.collection<Entry<NewsPostType>>('featured-news').items()\n * ```\n *\n * @param params An optional object of request parameters. See\n * {@link ListCollectionItemsParams} for all available parameters. `field:foo`\n * syntax is also supported, see {@link QueryableFields} for more info.\n * @param options An optional object of fetch options. See\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for\n * more info.\n */\n items(\n params?: ListCollectionItemsParams | WithQueryableFieldsOnModelables<C>,\n options?: RequestInit,\n ): Promise<StarlightListResponse<C>>\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/instances/Form/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EAEhB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,MAAM,GACX,YAAY,CASd;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/instances/Form/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,MAAM,GACX,YAAY,CASd;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -1,10 +1,10 @@
1
1
  export default function makeFormInstance(client, form) {
2
2
  return {
3
- get() {
4
- return client.get(`/forms/${form}`);
3
+ get(params, options) {
4
+ return client.get(`/forms/${form}`, params, options);
5
5
  },
6
- schema() {
7
- return client.get(`/forms/${form}/schema`);
6
+ schema(params, options) {
7
+ return client.get(`/forms/${form}/schema`, params, options);
8
8
  },
9
9
  };
10
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/instances/Form/index.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,MAAuB,EACvB,IAAY;IAEZ,OAAO;QACL,GAAG;YACD,OAAO,MAAM,CAAC,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAA;QACrC,CAAC;QACD,MAAM;YACJ,OAAO,MAAM,CAAC,GAAG,CAAC,UAAU,IAAI,SAAS,CAAC,CAAA;QAC5C,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import {\n Form,\n FormSchema,\n StarlightClient,\n StarlightItemResponse,\n} from '../../types'\nimport { FormInstance } from './types'\n\nexport default function makeFormInstance(\n client: StarlightClient,\n form: string\n): FormInstance {\n return {\n get(): Promise<StarlightItemResponse<Form>> {\n return client.get(`/forms/${form}`)\n },\n schema(): Promise<StarlightItemResponse<FormSchema>> {\n return client.get(`/forms/${form}/schema`)\n },\n }\n}\n\nexport { FormInstance }\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/instances/Form/index.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,MAAuB,EACvB,IAAY;IAEZ,OAAO;QACL,GAAG,CAAC,MAAM,EAAE,OAAO;YACjB,OAAO,MAAM,CAAC,GAAG,CAAC,UAAU,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QACtD,CAAC;QACD,MAAM,CAAC,MAAM,EAAE,OAAO;YACpB,OAAO,MAAM,CAAC,GAAG,CAAC,UAAU,IAAI,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QAC7D,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import { StarlightClient } from '../../types'\nimport { FormInstance } from './types'\n\nexport default function makeFormInstance(\n client: StarlightClient,\n form: string,\n): FormInstance {\n return {\n get(params, options) {\n return client.get(`/forms/${form}`, params, options)\n },\n schema(params, options) {\n return client.get(`/forms/${form}/schema`, params, options)\n },\n }\n}\n\nexport { FormInstance }\n"]}
@@ -1,4 +1,4 @@
1
- import { Form, FormSchema, StarlightItemResponse } from '../../types';
1
+ import { BaseRequestParameters, Form, FormSchema, StarlightItemResponse } from '../../types';
2
2
  /**
3
3
  * An Instance that provide methods to request information from a {@link Form}
4
4
  * and its {@apilink Field | Fields}.
@@ -19,8 +19,13 @@ export interface FormInstance {
19
19
  *
20
20
  * const response = await Starlight.forms.signup.get()
21
21
  * ```
22
+ *
23
+ * @param params An optional object of request parameters.
24
+ * @param options An optional object of fetch options. See
25
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for
26
+ * more info.
22
27
  */
23
- get(): Promise<StarlightItemResponse<Form>>;
28
+ get(params?: BaseRequestParameters, options?: RequestInit): Promise<StarlightItemResponse<Form>>;
24
29
  /**
25
30
  * Returns a {@link StarlightItemResponse} with a {@link FormSchema}.
26
31
  *
@@ -31,8 +36,11 @@ export interface FormInstance {
31
36
  * const response = await Starlight.forms.signup.schema()
32
37
  * ```
33
38
  *
34
- * @param slug The category slug.
39
+ * @param params An optional object of request parameters.
40
+ * @param options An optional object of fetch options. See
41
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for
42
+ * more info.
35
43
  */
36
- schema(): Promise<StarlightItemResponse<FormSchema>>;
44
+ schema(params?: BaseRequestParameters, options?: RequestInit): Promise<StarlightItemResponse<FormSchema>>;
37
45
  }
38
46
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/instances/Form/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAErE;;;;;;;;;GASG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;;;;OASG;IACH,GAAG,IAAI,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAA;IAE3C;;;;;;;;;;;OAWG;IACH,MAAM,IAAI,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAA;CACrD"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/instances/Form/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,IAAI,EACJ,UAAU,EACV,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAEpB;;;;;;;;;GASG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;;;;;;;;;OAcG;IACH,GAAG,CACD,MAAM,CAAC,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAA;IAEvC;;;;;;;;;;;;;;OAcG;IACH,MAAM,CACJ,MAAM,CAAC,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAA;CAC9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/instances/Form/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Form, FormSchema, StarlightItemResponse } from '../../types'\n\n/**\n * An Instance that provide methods to request information from a {@link Form}\n * and its {@apilink Field | Fields}.\n *\n * You can access a FormInstance using {@apilink StarlightClient.form} or\n * using the dynamic syntax on a {@link DynamicFormSelector}. Usage\n * examples will use the dynamic syntax.\n *\n * @group Instances\n */\nexport interface FormInstance {\n /**\n * Returns a {@link StarlightItemResponse} with a single {@link Form}.\n *\n * @example Requesting information from a form of slug `signup`.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.forms.signup.get()\n * ```\n */\n get(): Promise<StarlightItemResponse<Form>>\n\n /**\n * Returns a {@link StarlightItemResponse} with a {@link FormSchema}.\n *\n * @example Listing the schema from a form of slug `signup`.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.forms.signup.schema()\n * ```\n *\n * @param slug The category slug.\n */\n schema(): Promise<StarlightItemResponse<FormSchema>>\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/instances/Form/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n BaseRequestParameters,\n Form,\n FormSchema,\n StarlightItemResponse,\n} from '../../types'\n\n/**\n * An Instance that provide methods to request information from a {@link Form}\n * and its {@apilink Field | Fields}.\n *\n * You can access a FormInstance using {@apilink StarlightClient.form} or\n * using the dynamic syntax on a {@link DynamicFormSelector}. Usage\n * examples will use the dynamic syntax.\n *\n * @group Instances\n */\nexport interface FormInstance {\n /**\n * Returns a {@link StarlightItemResponse} with a single {@link Form}.\n *\n * @example Requesting information from a form of slug `signup`.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.forms.signup.get()\n * ```\n *\n * @param params An optional object of request parameters.\n * @param options An optional object of fetch options. See\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for\n * more info.\n */\n get(\n params?: BaseRequestParameters,\n options?: RequestInit,\n ): Promise<StarlightItemResponse<Form>>\n\n /**\n * Returns a {@link StarlightItemResponse} with a {@link FormSchema}.\n *\n * @example Listing the schema from a form of slug `signup`.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.forms.signup.schema()\n * ```\n *\n * @param params An optional object of request parameters.\n * @param options An optional object of fetch options. See\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for\n * more info.\n */\n schema(\n params?: BaseRequestParameters,\n options?: RequestInit,\n ): Promise<StarlightItemResponse<FormSchema>>\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/instances/Model/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,eAAe,EAEhB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAS7D,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,SAAS,cAAc,EAChE,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,GACZ,oBAAoB,CAAC,CAAC,CAAC,CA4BzB;AAED,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/instances/Model/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAK7D,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,SAAS,cAAc,EAChE,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,GACZ,oBAAoB,CAAC,CAAC,CAAC,CA4BzB;AAED,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,CAAA"}
@@ -3,8 +3,8 @@ import makeModelCategorySelector from '../../selectors/ModelCategory';
3
3
  import makeModelCategoryInstance from '../ModelCategory';
4
4
  export default function makeModelInstance(client, model) {
5
5
  const instance = {
6
- get() {
7
- return client.get(`/models/${model}`);
6
+ get(params, options) {
7
+ return client.get(`/models/${model}`, params, options);
8
8
  },
9
9
  category(slug) {
10
10
  return makeModelCategoryInstance(client, model, slug);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/instances/Model/index.ts"],"names":[],"mappings":"AAOA,OAAO,iBAAoC,MAAM,uBAAuB,CAAA;AACxE,OAAO,yBAEN,MAAM,+BAA+B,CAAA;AACtC,OAAO,yBAEN,MAAM,kBAAkB,CAAA;AAEzB,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,MAAuB,EACvB,KAAa;IAEb,MAAM,QAAQ,GAAG;QACf,GAAG;YACD,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,KAAK,EAAE,CAAC,CAAA;QACvC,CAAC;QAED,QAAQ,CAAC,IAAY;YACnB,OAAO,yBAAyB,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;QACvD,CAAC;QAED,IAAI,OAAO;YACT,OAAO,iBAAiB,CAAI,MAAM,EAAE,KAAK,CAAC,CAAA;QAC5C,CAAC;QAED,IAAI,UAAU;YACZ,OAAO,yBAAyB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACjD,CAAC;KACF,CAAA;IAED,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE;QACzB,GAAG,CAAC,MAAM,EAAE,IAAI;YACd,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;gBAC3D,OAAO,yBAAyB,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;YACvD,CAAC;YAED,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;KACF,CAA4B,CAAA;AAC/B,CAAC","sourcesContent":["import {\n Model,\n SerializedData,\n StarlightClient,\n StarlightItemResponse,\n} from '../../types'\nimport { DynamicModelInstance, ModelInstance } from './types'\nimport makeEntrySelector, { EntrySelector } from '../../selectors/Entry'\nimport makeModelCategorySelector, {\n DynamicModelCategorySelector,\n} from '../../selectors/ModelCategory'\nimport makeModelCategoryInstance, {\n ModelCategoryInstance,\n} from '../ModelCategory'\n\nexport default function makeModelInstance<D extends SerializedData>(\n client: StarlightClient,\n model: string\n): DynamicModelInstance<D> {\n const instance = {\n get(): Promise<StarlightItemResponse<Model>> {\n return client.get(`/models/${model}`)\n },\n\n category(slug: string): ModelCategoryInstance<D> {\n return makeModelCategoryInstance(client, model, slug)\n },\n\n get entries(): EntrySelector<D> {\n return makeEntrySelector<D>(client, model)\n },\n\n get categories(): DynamicModelCategorySelector<D> {\n return makeModelCategorySelector(client, model)\n },\n }\n\n return new Proxy(instance, {\n get(target, prop) {\n if (typeof prop === 'string' && !Reflect.has(target, prop)) {\n return makeModelCategoryInstance(client, model, prop)\n }\n\n return Reflect.get(target, prop)\n },\n }) as DynamicModelInstance<D>\n}\n\nexport { DynamicModelInstance, ModelInstance }\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/instances/Model/index.ts"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,MAAM,uBAAuB,CAAA;AACrD,OAAO,yBAAyB,MAAM,+BAA+B,CAAA;AACrE,OAAO,yBAAyB,MAAM,kBAAkB,CAAA;AAExD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,MAAuB,EACvB,KAAa;IAEb,MAAM,QAAQ,GAAqB;QACjC,GAAG,CAAC,MAAM,EAAE,OAAO;YACjB,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QACxD,CAAC;QAED,QAAQ,CAAC,IAAY;YACnB,OAAO,yBAAyB,CAAI,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;QAC1D,CAAC;QAED,IAAI,OAAO;YACT,OAAO,iBAAiB,CAAI,MAAM,EAAE,KAAK,CAAC,CAAA;QAC5C,CAAC;QAED,IAAI,UAAU;YACZ,OAAO,yBAAyB,CAAI,MAAM,EAAE,KAAK,CAAC,CAAA;QACpD,CAAC;KACF,CAAA;IAED,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE;QACzB,GAAG,CAAC,MAAM,EAAE,IAAI;YACd,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;gBAC3D,OAAO,yBAAyB,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;YACvD,CAAC;YAED,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;KACF,CAA4B,CAAA;AAC/B,CAAC","sourcesContent":["import { SerializedData, StarlightClient } from '../../types'\nimport { DynamicModelInstance, ModelInstance } from './types'\nimport makeEntrySelector from '../../selectors/Entry'\nimport makeModelCategorySelector from '../../selectors/ModelCategory'\nimport makeModelCategoryInstance from '../ModelCategory'\n\nexport default function makeModelInstance<D extends SerializedData>(\n client: StarlightClient,\n model: string,\n): DynamicModelInstance<D> {\n const instance: ModelInstance<D> = {\n get(params, options) {\n return client.get(`/models/${model}`, params, options)\n },\n\n category(slug: string) {\n return makeModelCategoryInstance<D>(client, model, slug)\n },\n\n get entries() {\n return makeEntrySelector<D>(client, model)\n },\n\n get categories() {\n return makeModelCategorySelector<D>(client, model)\n },\n }\n\n return new Proxy(instance, {\n get(target, prop) {\n if (typeof prop === 'string' && !Reflect.has(target, prop)) {\n return makeModelCategoryInstance(client, model, prop)\n }\n\n return Reflect.get(target, prop)\n },\n }) as DynamicModelInstance<D>\n}\n\nexport { DynamicModelInstance, ModelInstance }\n"]}
@@ -1,4 +1,4 @@
1
- import { Model, SerializedData, StarlightItemResponse } from '../../types';
1
+ import { BaseRequestParameters, Model, SerializedData, StarlightItemResponse } from '../../types';
2
2
  import { EntrySelector } from '../../selectors/Entry';
3
3
  import { DynamicModelCategorySelector } from '../../selectors/ModelCategory';
4
4
  import { ModelCategoryInstance } from '../ModelCategory';
@@ -24,8 +24,13 @@ export interface ModelInstance<D extends SerializedData> {
24
24
  *
25
25
  * const response = await Starlight.posts.get()
26
26
  * ```
27
+ *
28
+ * @param params An optional object of request parameters.
29
+ * @param options An optional object of fetch options. See
30
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for
31
+ * more info.
27
32
  */
28
- get(): Promise<StarlightItemResponse<Model>>;
33
+ get(params?: BaseRequestParameters, options?: RequestInit): Promise<StarlightItemResponse<Model>>;
29
34
  /**
30
35
  * Returns a {@link ModelCategoryInstance}.
31
36
  *
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/instances/Model/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAA;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAExD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,cAAc;IACrD;;;;;;;;;OASG;IACH,GAAG,IAAI,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAA;IAE5C;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;IAEhD;;;;;;;;;;;;OAYG;IACH,IAAI,OAAO,IAAI,aAAa,CAAC,CAAC,CAAC,CAAA;IAE/B;;;;;;;;;;;;OAYG;IACH,IAAI,UAAU,IAAI,4BAA4B,CAAC,CAAC,CAAC,CAAA;CAClD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,cAAc,IACvD,aAAa,CAAC,CAAC,CAAC,GAAG;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;CACxC,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/instances/Model/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,EACL,cAAc,EACd,qBAAqB,EACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAA;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAExD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,cAAc;IACrD;;;;;;;;;;;;;;OAcG;IACH,GAAG,CACD,MAAM,CAAC,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAA;IAExC;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;IAEhD;;;;;;;;;;;;OAYG;IACH,IAAI,OAAO,IAAI,aAAa,CAAC,CAAC,CAAC,CAAA;IAE/B;;;;;;;;;;;;OAYG;IACH,IAAI,UAAU,IAAI,4BAA4B,CAAC,CAAC,CAAC,CAAA;CAClD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,cAAc,IACvD,aAAa,CAAC,CAAC,CAAC,GAAG;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;CACxC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/instances/Model/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Model, SerializedData, StarlightItemResponse } from '../../types'\nimport { EntrySelector } from '../../selectors/Entry'\nimport { DynamicModelCategorySelector } from '../../selectors/ModelCategory'\nimport { ModelCategoryInstance } from '../ModelCategory'\n\n/**\n * An Instance that provide methods to request information from a {@link Model},\n * its {@apilink Entry | Entries}, and its {@apilink ModelCategory | Categories}.\n *\n * You can access a ModelInstance using {@apilink StarlightClient.model} or\n * using the dynamic syntax on a {@link DynamicStarlightClient}. Usage\n * examples will use the dynamic syntax.\n *\n * To list all workspace models, use a {@link ModelSelector}.\n *\n * @group Instances\n */\nexport interface ModelInstance<D extends SerializedData> {\n /**\n * Returns a {@link StarlightItemResponse} with a single {@link Model}.\n *\n * @example Requesting information from a model of slug `posts`.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.posts.get()\n * ```\n */\n get(): Promise<StarlightItemResponse<Model>>\n\n /**\n * Returns a {@link ModelCategoryInstance}.\n *\n * If you're using a {@link DynamicModelInstance}, you can use the\n * dynamic syntax instead of this method.\n *\n * @example Listing all entries from the \"news\" category of a model of slug \"posts\".\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.posts.category('news').entries()\n * ```\n *\n * @param slug The category slug.\n */\n category(slug: string): ModelCategoryInstance<D>\n\n /**\n * Returns an {@link EntrySelector}.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // \"entries\" below is an EntrySelector.\n * const response = await Starlight.posts.entries.list()\n * ```\n */\n get entries(): EntrySelector<D>\n\n /**\n * Returns a {@link DynamicModelCategorySelector}.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // \"categories\" below is a DynamicModelCategorySelector.\n * const response = await Starlight.posts.categories.get('interviews')\n * ```\n */\n get categories(): DynamicModelCategorySelector<D>\n}\n\n/**\n * An Instance that provide all {@link ModelInstance} methods and adds support\n * for creating {@apilink ModelCategoryInstance | ModelCategoryInstances} using\n * the dynamic syntax.\n *\n * See {@link ModelInstance} to view all available methods.\n *\n * See {@doclink requests-and-responses#dynamic-syntax | Dynamic Instances}\n * documentation to learn more about the dynamic syntax.\n *\n * @example Accessing a ModelCategoryInstance using the dynamic syntax.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // \"articles\" below will be a ModelCategoryInstance.\n * const response = await Starlight.posts.articles.list()\n * ```\n *\n * @category Instances\n */\nexport type DynamicModelInstance<D extends SerializedData> =\n ModelInstance<D> & {\n [key: string]: ModelCategoryInstance<D>\n }\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/instances/Model/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n BaseRequestParameters,\n Model,\n SerializedData,\n StarlightItemResponse,\n} from '../../types'\nimport { EntrySelector } from '../../selectors/Entry'\nimport { DynamicModelCategorySelector } from '../../selectors/ModelCategory'\nimport { ModelCategoryInstance } from '../ModelCategory'\n\n/**\n * An Instance that provide methods to request information from a {@link Model},\n * its {@apilink Entry | Entries}, and its {@apilink ModelCategory | Categories}.\n *\n * You can access a ModelInstance using {@apilink StarlightClient.model} or\n * using the dynamic syntax on a {@link DynamicStarlightClient}. Usage\n * examples will use the dynamic syntax.\n *\n * To list all workspace models, use a {@link ModelSelector}.\n *\n * @group Instances\n */\nexport interface ModelInstance<D extends SerializedData> {\n /**\n * Returns a {@link StarlightItemResponse} with a single {@link Model}.\n *\n * @example Requesting information from a model of slug `posts`.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.posts.get()\n * ```\n *\n * @param params An optional object of request parameters.\n * @param options An optional object of fetch options. See\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for\n * more info.\n */\n get(\n params?: BaseRequestParameters,\n options?: RequestInit,\n ): Promise<StarlightItemResponse<Model>>\n\n /**\n * Returns a {@link ModelCategoryInstance}.\n *\n * If you're using a {@link DynamicModelInstance}, you can use the\n * dynamic syntax instead of this method.\n *\n * @example Listing all entries from the \"news\" category of a model of slug \"posts\".\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.posts.category('news').entries()\n * ```\n *\n * @param slug The category slug.\n */\n category(slug: string): ModelCategoryInstance<D>\n\n /**\n * Returns an {@link EntrySelector}.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // \"entries\" below is an EntrySelector.\n * const response = await Starlight.posts.entries.list()\n * ```\n */\n get entries(): EntrySelector<D>\n\n /**\n * Returns a {@link DynamicModelCategorySelector}.\n *\n * This is an accessor, which means that it should be used just like a common\n * object parameter. For instance:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // \"categories\" below is a DynamicModelCategorySelector.\n * const response = await Starlight.posts.categories.get('interviews')\n * ```\n */\n get categories(): DynamicModelCategorySelector<D>\n}\n\n/**\n * An Instance that provide all {@link ModelInstance} methods and adds support\n * for creating {@apilink ModelCategoryInstance | ModelCategoryInstances} using\n * the dynamic syntax.\n *\n * See {@link ModelInstance} to view all available methods.\n *\n * See {@doclink requests-and-responses#dynamic-syntax | Dynamic Instances}\n * documentation to learn more about the dynamic syntax.\n *\n * @example Accessing a ModelCategoryInstance using the dynamic syntax.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // \"articles\" below will be a ModelCategoryInstance.\n * const response = await Starlight.posts.articles.list()\n * ```\n *\n * @category Instances\n */\nexport type DynamicModelInstance<D extends SerializedData> =\n ModelInstance<D> & {\n [key: string]: ModelCategoryInstance<D>\n }\n"]}
@@ -1,5 +1,5 @@
1
1
  import { SerializedData, StarlightClient } from '../../types';
2
- import { ModelCategoryInstance, ModelCategoryEntryListParams } from './types';
2
+ import { ModelCategoryEntryListParams, ModelCategoryInstance } from './types';
3
3
  export default function makeModelCategoryInstance<D extends SerializedData>(client: StarlightClient, model: string, category: string): ModelCategoryInstance<D>;
4
4
  export { ModelCategoryInstance, ModelCategoryEntryListParams };
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/instances/ModelCategory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,cAAc,EACd,eAAe,EAGhB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAA;AAE7E,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,CAAC,SAAS,cAAc,EACxE,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,qBAAqB,CAAC,CAAC,CAAC,CAc1B;AAED,OAAO,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/instances/ModelCategory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAE7E,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,CAAC,SAAS,cAAc,EACxE,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,qBAAqB,CAAC,CAAC,CAAC,CAiB1B;AAED,OAAO,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,CAAA"}
@@ -1,10 +1,10 @@
1
1
  export default function makeModelCategoryInstance(client, model, category) {
2
2
  return {
3
- get() {
4
- return client.get(`/models/${model}/categories/${category}`);
3
+ get(params, options) {
4
+ return client.get(`/models/${model}/categories/${category}`, params, options);
5
5
  },
6
- entries(options) {
7
- return client.get(`/models/${model}/categories/${category}/entries`, options);
6
+ entries(params, options) {
7
+ return client.get(`/models/${model}/categories/${category}/entries`, params, options);
8
8
  },
9
9
  };
10
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/instances/ModelCategory/index.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,MAAuB,EACvB,KAAa,EACb,QAAgB;IAEhB,OAAO;QACL,GAAG;YACD,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,KAAK,eAAe,QAAQ,EAAE,CAAC,CAAA;QAC9D,CAAC;QACD,OAAO,CACL,OAA0D;YAE1D,OAAO,MAAM,CAAC,GAAG,CACf,WAAW,KAAK,eAAe,QAAQ,UAAU,EACjD,OAAO,CACR,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import {\n Entry,\n ModelCategory,\n QueryableFields,\n SerializedData,\n StarlightClient,\n StarlightItemResponse,\n StarlightListResponse,\n} from '../../types'\nimport { ModelCategoryInstance, ModelCategoryEntryListParams } from './types'\n\nexport default function makeModelCategoryInstance<D extends SerializedData>(\n client: StarlightClient,\n model: string,\n category: string\n): ModelCategoryInstance<D> {\n return {\n get(): Promise<StarlightItemResponse<ModelCategory>> {\n return client.get(`/models/${model}/categories/${category}`)\n },\n entries(\n options: ModelCategoryEntryListParams & QueryableFields<D>\n ): Promise<StarlightListResponse<Entry<D>>> {\n return client.get(\n `/models/${model}/categories/${category}/entries`,\n options\n )\n },\n }\n}\n\nexport { ModelCategoryInstance, ModelCategoryEntryListParams }\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/instances/ModelCategory/index.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,MAAuB,EACvB,KAAa,EACb,QAAgB;IAEhB,OAAO;QACL,GAAG,CAAC,MAAM,EAAE,OAAO;YACjB,OAAO,MAAM,CAAC,GAAG,CACf,WAAW,KAAK,eAAe,QAAQ,EAAE,EACzC,MAAM,EACN,OAAO,CACR,CAAA;QACH,CAAC;QACD,OAAO,CAAC,MAAM,EAAE,OAAO;YACrB,OAAO,MAAM,CAAC,GAAG,CACf,WAAW,KAAK,eAAe,QAAQ,UAAU,EACjD,MAAM,EACN,OAAO,CACR,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import { SerializedData, StarlightClient } from '../../types'\nimport { ModelCategoryEntryListParams, ModelCategoryInstance } from './types'\n\nexport default function makeModelCategoryInstance<D extends SerializedData>(\n client: StarlightClient,\n model: string,\n category: string,\n): ModelCategoryInstance<D> {\n return {\n get(params, options) {\n return client.get(\n `/models/${model}/categories/${category}`,\n params,\n options,\n )\n },\n entries(params, options) {\n return client.get(\n `/models/${model}/categories/${category}/entries`,\n params,\n options,\n )\n },\n }\n}\n\nexport { ModelCategoryInstance, ModelCategoryEntryListParams }\n"]}
@@ -1,4 +1,4 @@
1
- import { BaseRequestParameters, Entry, ModelCategory, QueryableFields, QueryableRequestParameters, SerializedData, StarlightItemResponse, StarlightListResponse } from '../../types';
1
+ import { ListRequestParameters, Entry, ModelCategory, QueryableFields, QueryableRequestParameters, SerializedData, StarlightItemResponse, StarlightListResponse, BaseRequestParameters } from '../../types';
2
2
  /**
3
3
  * Request parameters for listing category entries.
4
4
  *
@@ -6,7 +6,7 @@ import { BaseRequestParameters, Entry, ModelCategory, QueryableFields, Queryable
6
6
  *
7
7
  * @group Request Parameters
8
8
  */
9
- export interface ModelCategoryEntryListParams extends BaseRequestParameters, QueryableRequestParameters {
9
+ export interface ModelCategoryEntryListParams extends ListRequestParameters, QueryableRequestParameters {
10
10
  /**
11
11
  * Define how entries will be ordered. Check this field type to see the
12
12
  * allowed options.
@@ -35,8 +35,13 @@ export interface ModelCategoryInstance<D extends SerializedData> {
35
35
  *
36
36
  * const response = await Starlight.posts.articles.get()
37
37
  * ```
38
+ *
39
+ * @param params An optional object of request parameters.
40
+ * @param options An optional object of fetch options. See
41
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for
42
+ * more info.
38
43
  */
39
- get(): Promise<StarlightItemResponse<ModelCategory>>;
44
+ get(params?: BaseRequestParameters, options?: RequestInit): Promise<StarlightItemResponse<ModelCategory>>;
40
45
  /**
41
46
  * Returns a {@link StarlightListResponse} with the list of entries of this
42
47
  * {@link ModelCategory}.
@@ -58,10 +63,14 @@ export interface ModelCategoryInstance<D extends SerializedData> {
58
63
  * })
59
64
  * ```
60
65
  *
61
- * @param options An optional object of request parameters. See
62
- * {@link ModelCategoryEntryListParams} for all available options. `field:foo`
63
- * syntax is also supported, see {@link QueryableFields} for more info.
66
+ * @param params An optional object of request parameters. See
67
+ * {@link ModelCategoryEntryListParams} for all available parameters.
68
+ * `field:foo` syntax is also supported, see {@link QueryableFields}
69
+ * for more info.
70
+ * @param options An optional object of fetch options. See
71
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for
72
+ * more info.
64
73
  */
65
- entries(options?: ModelCategoryEntryListParams & QueryableFields<D>): Promise<StarlightListResponse<Entry<D>>>;
74
+ entries(params?: ModelCategoryEntryListParams & QueryableFields<D>, options?: RequestInit): Promise<StarlightListResponse<Entry<D>>>;
66
75
  }
67
76
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/instances/ModelCategory/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,EACL,aAAa,EACb,eAAe,EACf,0BAA0B,EAC1B,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAEpB;;;;;;GAMG;AACH,MAAM,WAAW,4BACf,SAAQ,qBAAqB,EAC3B,0BAA0B;IAC5B;;;OAGG;IACH,KAAK,CAAC,EACF,WAAW,GACX,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,WAAW,GACX,YAAY,CAAA;CACjB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,cAAc;IAC7D;;;;;;;;;OASG;IACH,GAAG,IAAI,OAAO,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,CAAA;IAEpD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,OAAO,CACL,OAAO,CAAC,EAAE,4BAA4B,GAAG,eAAe,CAAC,CAAC,CAAC,GAC1D,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;CAC5C"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/instances/ModelCategory/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,EACL,aAAa,EACb,eAAe,EACf,0BAA0B,EAC1B,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAEpB;;;;;;GAMG;AACH,MAAM,WAAW,4BACf,SAAQ,qBAAqB,EAAE,0BAA0B;IACzD;;;OAGG;IACH,KAAK,CAAC,EACF,WAAW,GACX,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,WAAW,GACX,YAAY,CAAA;CACjB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,cAAc;IAC7D;;;;;;;;;;;;;;OAcG;IACH,GAAG,CACD,MAAM,CAAC,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,CAAA;IAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,OAAO,CACL,MAAM,CAAC,EAAE,4BAA4B,GAAG,eAAe,CAAC,CAAC,CAAC,EAC1D,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;CAC5C"}