@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.
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +1 -1
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/instances/Collection/index.js +4 -4
- package/dist/cjs/instances/Collection/index.js.map +1 -1
- package/dist/cjs/instances/Collection/types.d.ts +14 -6
- package/dist/cjs/instances/Collection/types.d.ts.map +1 -1
- package/dist/cjs/instances/Collection/types.js.map +1 -1
- package/dist/cjs/instances/Form/index.d.ts.map +1 -1
- package/dist/cjs/instances/Form/index.js +4 -4
- package/dist/cjs/instances/Form/index.js.map +1 -1
- package/dist/cjs/instances/Form/types.d.ts +12 -4
- package/dist/cjs/instances/Form/types.d.ts.map +1 -1
- package/dist/cjs/instances/Form/types.js.map +1 -1
- package/dist/cjs/instances/Model/index.d.ts.map +1 -1
- package/dist/cjs/instances/Model/index.js +2 -2
- package/dist/cjs/instances/Model/index.js.map +1 -1
- package/dist/cjs/instances/Model/types.d.ts +7 -2
- package/dist/cjs/instances/Model/types.d.ts.map +1 -1
- package/dist/cjs/instances/Model/types.js.map +1 -1
- package/dist/cjs/instances/ModelCategory/index.d.ts +1 -1
- package/dist/cjs/instances/ModelCategory/index.d.ts.map +1 -1
- package/dist/cjs/instances/ModelCategory/index.js +4 -4
- package/dist/cjs/instances/ModelCategory/index.js.map +1 -1
- package/dist/cjs/instances/ModelCategory/types.d.ts +16 -7
- package/dist/cjs/instances/ModelCategory/types.d.ts.map +1 -1
- package/dist/cjs/instances/ModelCategory/types.js.map +1 -1
- package/dist/cjs/selectors/Collection/index.js +4 -4
- package/dist/cjs/selectors/Collection/index.js.map +1 -1
- package/dist/cjs/selectors/Collection/types.d.ts +13 -6
- package/dist/cjs/selectors/Collection/types.d.ts.map +1 -1
- package/dist/cjs/selectors/Collection/types.js.map +1 -1
- package/dist/cjs/selectors/Entry/index.d.ts.map +1 -1
- package/dist/cjs/selectors/Entry/index.js +6 -2
- package/dist/cjs/selectors/Entry/index.js.map +1 -1
- package/dist/cjs/selectors/Entry/types.d.ts +13 -10
- package/dist/cjs/selectors/Entry/types.d.ts.map +1 -1
- package/dist/cjs/selectors/Entry/types.js.map +1 -1
- package/dist/cjs/selectors/Media/index.js +4 -4
- package/dist/cjs/selectors/Media/index.js.map +1 -1
- package/dist/cjs/selectors/Media/types.d.ts +12 -3
- package/dist/cjs/selectors/Media/types.d.ts.map +1 -1
- package/dist/cjs/selectors/Media/types.js.map +1 -1
- package/dist/cjs/selectors/Model/index.d.ts +1 -1
- package/dist/cjs/selectors/Model/index.d.ts.map +1 -1
- package/dist/cjs/selectors/Model/index.js +4 -4
- package/dist/cjs/selectors/Model/index.js.map +1 -1
- package/dist/cjs/selectors/Model/types.d.ts +12 -3
- package/dist/cjs/selectors/Model/types.d.ts.map +1 -1
- package/dist/cjs/selectors/Model/types.js.map +1 -1
- package/dist/cjs/selectors/ModelCategory/index.d.ts +1 -1
- package/dist/cjs/selectors/ModelCategory/index.d.ts.map +1 -1
- package/dist/cjs/selectors/ModelCategory/index.js +4 -4
- package/dist/cjs/selectors/ModelCategory/index.js.map +1 -1
- package/dist/cjs/selectors/ModelCategory/types.d.ts +13 -6
- package/dist/cjs/selectors/ModelCategory/types.d.ts.map +1 -1
- package/dist/cjs/selectors/ModelCategory/types.js.map +1 -1
- package/dist/cjs/selectors/Search/index.d.ts.map +1 -1
- package/dist/cjs/selectors/Search/index.js +2 -2
- package/dist/cjs/selectors/Search/index.js.map +1 -1
- package/dist/cjs/selectors/Search/types.d.ts +8 -5
- package/dist/cjs/selectors/Search/types.d.ts.map +1 -1
- package/dist/cjs/selectors/Search/types.js.map +1 -1
- package/dist/cjs/selectors/Singleton/index.js +4 -4
- package/dist/cjs/selectors/Singleton/index.js.map +1 -1
- package/dist/cjs/selectors/Singleton/types.d.ts +12 -3
- package/dist/cjs/selectors/Singleton/types.d.ts.map +1 -1
- package/dist/cjs/selectors/Singleton/types.js.map +1 -1
- package/dist/cjs/types/index.d.ts +10 -2
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +1 -1
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/instances/Collection/index.js +4 -4
- package/dist/esm/instances/Collection/index.js.map +1 -1
- package/dist/esm/instances/Collection/types.d.ts +14 -6
- package/dist/esm/instances/Collection/types.d.ts.map +1 -1
- package/dist/esm/instances/Collection/types.js.map +1 -1
- package/dist/esm/instances/Form/index.d.ts.map +1 -1
- package/dist/esm/instances/Form/index.js +4 -4
- package/dist/esm/instances/Form/index.js.map +1 -1
- package/dist/esm/instances/Form/types.d.ts +12 -4
- package/dist/esm/instances/Form/types.d.ts.map +1 -1
- package/dist/esm/instances/Form/types.js.map +1 -1
- package/dist/esm/instances/Model/index.d.ts.map +1 -1
- package/dist/esm/instances/Model/index.js +2 -2
- package/dist/esm/instances/Model/index.js.map +1 -1
- package/dist/esm/instances/Model/types.d.ts +7 -2
- package/dist/esm/instances/Model/types.d.ts.map +1 -1
- package/dist/esm/instances/Model/types.js.map +1 -1
- package/dist/esm/instances/ModelCategory/index.d.ts +1 -1
- package/dist/esm/instances/ModelCategory/index.d.ts.map +1 -1
- package/dist/esm/instances/ModelCategory/index.js +4 -4
- package/dist/esm/instances/ModelCategory/index.js.map +1 -1
- package/dist/esm/instances/ModelCategory/types.d.ts +16 -7
- package/dist/esm/instances/ModelCategory/types.d.ts.map +1 -1
- package/dist/esm/instances/ModelCategory/types.js.map +1 -1
- package/dist/esm/selectors/Collection/index.js +4 -4
- package/dist/esm/selectors/Collection/index.js.map +1 -1
- package/dist/esm/selectors/Collection/types.d.ts +13 -6
- package/dist/esm/selectors/Collection/types.d.ts.map +1 -1
- package/dist/esm/selectors/Collection/types.js.map +1 -1
- package/dist/esm/selectors/Entry/index.d.ts.map +1 -1
- package/dist/esm/selectors/Entry/index.js +6 -2
- package/dist/esm/selectors/Entry/index.js.map +1 -1
- package/dist/esm/selectors/Entry/types.d.ts +13 -10
- package/dist/esm/selectors/Entry/types.d.ts.map +1 -1
- package/dist/esm/selectors/Entry/types.js.map +1 -1
- package/dist/esm/selectors/Media/index.js +4 -4
- package/dist/esm/selectors/Media/index.js.map +1 -1
- package/dist/esm/selectors/Media/types.d.ts +12 -3
- package/dist/esm/selectors/Media/types.d.ts.map +1 -1
- package/dist/esm/selectors/Media/types.js.map +1 -1
- package/dist/esm/selectors/Model/index.d.ts +1 -1
- package/dist/esm/selectors/Model/index.d.ts.map +1 -1
- package/dist/esm/selectors/Model/index.js +4 -4
- package/dist/esm/selectors/Model/index.js.map +1 -1
- package/dist/esm/selectors/Model/types.d.ts +12 -3
- package/dist/esm/selectors/Model/types.d.ts.map +1 -1
- package/dist/esm/selectors/Model/types.js.map +1 -1
- package/dist/esm/selectors/ModelCategory/index.d.ts +1 -1
- package/dist/esm/selectors/ModelCategory/index.d.ts.map +1 -1
- package/dist/esm/selectors/ModelCategory/index.js +4 -4
- package/dist/esm/selectors/ModelCategory/index.js.map +1 -1
- package/dist/esm/selectors/ModelCategory/types.d.ts +13 -6
- package/dist/esm/selectors/ModelCategory/types.d.ts.map +1 -1
- package/dist/esm/selectors/ModelCategory/types.js.map +1 -1
- package/dist/esm/selectors/Search/index.d.ts.map +1 -1
- package/dist/esm/selectors/Search/index.js +2 -2
- package/dist/esm/selectors/Search/index.js.map +1 -1
- package/dist/esm/selectors/Search/types.d.ts +8 -5
- package/dist/esm/selectors/Search/types.d.ts.map +1 -1
- package/dist/esm/selectors/Search/types.js.map +1 -1
- package/dist/esm/selectors/Singleton/index.js +4 -4
- package/dist/esm/selectors/Singleton/index.js.map +1 -1
- package/dist/esm/selectors/Singleton/types.d.ts +12 -3
- package/dist/esm/selectors/Singleton/types.d.ts.map +1 -1
- package/dist/esm/selectors/Singleton/types.js.map +1 -1
- package/dist/esm/types/index.d.ts +10 -2
- package/dist/esm/types/index.d.ts.map +1 -1
- package/dist/esm/types/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/instances/ModelCategory/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/instances/ModelCategory/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n ListRequestParameters,\n Entry,\n ModelCategory,\n QueryableFields,\n QueryableRequestParameters,\n SerializedData,\n StarlightItemResponse,\n StarlightListResponse,\n BaseRequestParameters,\n} from '../../types'\n\n/**\n * Request parameters for listing category entries.\n *\n * Used by {@apilink ModelCategoryInstance.entries}.\n *\n * @group Request Parameters\n */\nexport interface ModelCategoryEntryListParams\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 from a\n * {@link ModelCategory} and its {@apilink Entry | Entries}.\n *\n * You can access a ModelCategoryInstance using\n * {@apilink ModelInstance.category} or using the dynamic syntax on a\n * {@link DynamicModelInstance}. Usage examples will use the dynamic syntax.\n *\n * To list all categories from a model, use a {@link ModelCategorySelector}.\n *\n * @group Instances\n */\nexport interface ModelCategoryInstance<D extends SerializedData> {\n /**\n * Returns a {@link StarlightItemResponse} with a single {@link ModelCategory}.\n *\n * @example Requesting information from a category called \"articles\" in a model of slug \"posts\".\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.posts.articles.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<ModelCategory>>\n\n /**\n * Returns a {@link StarlightListResponse} with the list of entries of this\n * {@link ModelCategory}.\n *\n * @example Requesting all items from a category called \"gaming\" in a model of slug \"posts\".\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.posts.gaming.items()\n * ```\n *\n * @example Paginating and searching on the last example.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.posts.gaming.items({\n * page: 5,\n * query: 'kirby'\n * })\n * ```\n *\n * @param params An optional object of request parameters. See\n * {@link ModelCategoryEntryListParams} for all available parameters.\n * `field:foo` syntax is also supported, see {@link QueryableFields}\n * 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 entries(\n params?: ModelCategoryEntryListParams & QueryableFields<D>,\n options?: RequestInit,\n ): Promise<StarlightListResponse<Entry<D>>>\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import makeCollectionInstance from '../../instances/Collection';
|
|
2
2
|
export default function makeCollectionSelector(client) {
|
|
3
3
|
const selector = {
|
|
4
|
-
list(options) {
|
|
5
|
-
return client.get('/collections',
|
|
4
|
+
list(params, options) {
|
|
5
|
+
return client.get('/collections', params, options);
|
|
6
6
|
},
|
|
7
|
-
get(slug) {
|
|
8
|
-
return client.get(`/collections/${slug}
|
|
7
|
+
get(slug, params, options) {
|
|
8
|
+
return client.get(`/collections/${slug}`, params, options);
|
|
9
9
|
},
|
|
10
10
|
};
|
|
11
11
|
return new Proxy(selector, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Collection/index.ts"],"names":[],"mappings":"AAMA,OAAO,sBAAsB,MAAM,4BAA4B,CAAA;AAE/D,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,MAAuB;IAEvB,MAAM,QAAQ,GAAuB;QACnC,IAAI,CAAC,OAAO;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Collection/index.ts"],"names":[],"mappings":"AAMA,OAAO,sBAAsB,MAAM,4BAA4B,CAAA;AAE/D,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,MAAuB;IAEvB,MAAM,QAAQ,GAAuB;QACnC,IAAI,CAAC,MAAM,EAAE,OAAO;YAClB,OAAO,MAAM,CAAC,GAAG,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QACpD,CAAC;QAED,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO;YACvB,OAAO,MAAM,CAAC,GAAG,CAAC,gBAAgB,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QAC5D,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,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;YAC7C,CAAC;YAED,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;KACF,CAA8B,CAAA;AACjC,CAAC","sourcesContent":["import { StarlightClient } from '../../types'\nimport {\n CollectionSelector,\n DynamicCollectionSelector,\n ListCollectionsParams,\n} from './types'\nimport makeCollectionInstance from '../../instances/Collection'\n\nexport default function makeCollectionSelector(\n client: StarlightClient,\n): DynamicCollectionSelector {\n const selector: CollectionSelector = {\n list(params, options) {\n return client.get('/collections', params, options)\n },\n\n get(slug, params, options) {\n return client.get(`/collections/${slug}`, params, options)\n },\n }\n\n return new Proxy(selector, {\n get(target, prop) {\n if (typeof prop === 'string' && !Reflect.has(target, prop)) {\n return makeCollectionInstance(client, prop)\n }\n\n return Reflect.get(target, prop)\n },\n }) as DynamicCollectionSelector\n}\n\nexport { CollectionSelector, DynamicCollectionSelector, ListCollectionsParams }\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ListRequestParameters, Collection, StarlightItemResponse, StarlightListResponse, BaseRequestParameters } from '../../types';
|
|
2
2
|
import { CollectionInstance } from '../../instances/Collection';
|
|
3
3
|
/**
|
|
4
4
|
* Request parameters for listing collections.
|
|
@@ -7,7 +7,7 @@ import { CollectionInstance } from '../../instances/Collection';
|
|
|
7
7
|
*
|
|
8
8
|
* @group Request Parameters
|
|
9
9
|
*/
|
|
10
|
-
export interface ListCollectionsParams extends
|
|
10
|
+
export interface ListCollectionsParams extends ListRequestParameters {
|
|
11
11
|
/**
|
|
12
12
|
* Define how items will be ordered. Check this field type to see the
|
|
13
13
|
* allowed options.
|
|
@@ -47,10 +47,13 @@ export interface CollectionSelector {
|
|
|
47
47
|
* })
|
|
48
48
|
* ```
|
|
49
49
|
*
|
|
50
|
-
* @param
|
|
51
|
-
* {@link ListCollectionsParams} for all available
|
|
50
|
+
* @param params An optional object of request parameters. See
|
|
51
|
+
* {@link ListCollectionsParams} for all available parameters.
|
|
52
|
+
* @param options An optional object of fetch options. See
|
|
53
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for
|
|
54
|
+
* more info.
|
|
52
55
|
*/
|
|
53
|
-
list(options?:
|
|
56
|
+
list(params?: ListCollectionsParams, options?: RequestInit): Promise<StarlightListResponse<Collection>>;
|
|
54
57
|
/**
|
|
55
58
|
* Returns a {@link StarlightItemResponse} with a single {@link Collection}.
|
|
56
59
|
*
|
|
@@ -62,8 +65,12 @@ export interface CollectionSelector {
|
|
|
62
65
|
* ```
|
|
63
66
|
*
|
|
64
67
|
* @param slug The collection slug.
|
|
68
|
+
* @param params An optional object of request parameters.
|
|
69
|
+
* @param options An optional object of fetch options. See
|
|
70
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for
|
|
71
|
+
* more info.
|
|
65
72
|
*/
|
|
66
|
-
get(slug: string | number): Promise<StarlightItemResponse<Collection>>;
|
|
73
|
+
get(slug: string | number, params?: BaseRequestParameters, options?: RequestInit): Promise<StarlightItemResponse<Collection>>;
|
|
67
74
|
}
|
|
68
75
|
/**
|
|
69
76
|
* A Selector that provide all {@link CollectionSelector} methods and adds
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Collection/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAE/D;;;;;;GAMG;AACH,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB;IAClE;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,GAAG,YAAY,GAAG,gBAAgB,GAAG,iBAAiB,CAAA;CAC1E;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IACjC
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Collection/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAE/D;;;;;;GAMG;AACH,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB;IAClE;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,GAAG,YAAY,GAAG,gBAAgB,GAAG,iBAAiB,CAAA;CAC1E;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,IAAI,CACF,MAAM,CAAC,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAA;IAE7C;;;;;;;;;;;;;;;OAeG;IACH,GAAG,CACD,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,MAAM,CAAC,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAA;CAC9C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,yBAAyB,GAAG,kBAAkB,GAAG;IAC3D,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAA;CAC3C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/selectors/Collection/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/selectors/Collection/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n ListRequestParameters,\n Collection,\n StarlightItemResponse,\n StarlightListResponse,\n BaseRequestParameters,\n} from '../../types'\nimport { CollectionInstance } from '../../instances/Collection'\n\n/**\n * Request parameters for listing collections.\n *\n * Used by {@apilink CollectionSelector.list}.\n *\n * @group Request Parameters\n */\nexport interface ListCollectionsParams extends ListRequestParameters {\n /**\n * Define how items will be ordered. Check this field type to see the\n * allowed options.\n */\n order?: 'title:asc' | 'title:desc' | 'item_count:asc' | 'item_count:desc'\n}\n\n/**\n * A Selector that provide methods to list and request information on\n * {@apilink Collection | Collections}.\n *\n * You can use a CollectionSelector by accessing\n * {@apilink StarlightClient.collections}.\n *\n * To get items from a specific collection, use a {@link CollectionInstance}.\n *\n * @group Selectors\n */\nexport interface CollectionSelector {\n /**\n * Returns a {@link StarlightListResponse} with the list of\n * {@apilink Collection | Collections} in this workspace.\n *\n * @example Requesting all collections from the workspace.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collections.list()\n * ```\n *\n * @example Paginating and searching on the last example.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collections.list({\n * page: 2,\n * query: 'photos',\n * })\n * ```\n *\n * @param params An optional object of request parameters. See\n * {@link ListCollectionsParams} for all available 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 list(\n params?: ListCollectionsParams,\n options?: RequestInit,\n ): Promise<StarlightListResponse<Collection>>\n\n /**\n * Returns a {@link StarlightItemResponse} with a single {@link Collection}.\n *\n * @example Requesting information from a collection of slug \"event-photos\".\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.collections.get('event-photos')\n * ```\n *\n * @param slug The collection slug.\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 slug: string | number,\n params?: BaseRequestParameters,\n options?: RequestInit,\n ): Promise<StarlightItemResponse<Collection>>\n}\n\n/**\n * A Selector that provide all {@link CollectionSelector} methods and adds\n * support for creating {@apilink CollectionInstance | CollectionInstances}\n * using the dynamic syntax.\n *\n * See {@link CollectionSelector} 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 CollectionInstance using the dynamic syntax.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // \"sliders\" below will be a CollectionInstance.\n * const response = await Starlight.collections.sliders.list()\n * ```\n *\n * @category Instances\n */\nexport type DynamicCollectionSelector = CollectionSelector & {\n [key: string]: CollectionInstance<unknown>\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Entry/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Entry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAO1D,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,SAAS,cAAc,EAChE,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,GACZ,aAAa,CAAC,CAAC,CAAC,CAUlB;AAED,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
// TODO continuar adicionando params e options em todas as requisições, ver janela Find abaixo
|
|
2
|
+
// TODO talvez tenha que adicionar as opções de cache adicionais do Next nos tipos do next-sdk? verificar
|
|
3
|
+
// TODO lançar versão 3.1.0 de todos os sdks
|
|
4
|
+
// TODO continuar os-template passando cache pras opções do fetch
|
|
1
5
|
export default function makeEntrySelector(client, model) {
|
|
2
6
|
return {
|
|
3
|
-
list(options) {
|
|
4
|
-
return client.get(`/models/${model}/entries`, options);
|
|
7
|
+
list(params, options) {
|
|
8
|
+
return client.get(`/models/${model}/entries`, params, options);
|
|
5
9
|
},
|
|
6
10
|
get(slug, params, options) {
|
|
7
11
|
return client.get(`/models/${model}/entries/${slug}`, params, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Entry/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Entry/index.ts"],"names":[],"mappings":"AAGA,8FAA8F;AAC9F,yGAAyG;AACzG,4CAA4C;AAC5C,iEAAiE;AAEjE,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,MAAuB,EACvB,KAAa;IAEb,OAAO;QACL,IAAI,CAAC,MAAM,EAAE,OAAO;YAClB,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,KAAK,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QAChE,CAAC;QAED,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO;YACvB,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,KAAK,YAAY,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QACxE,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import { SerializedData, StarlightClient } from '../../types'\nimport { EntrySelector, ListEntriesParams } from './types'\n\n// TODO continuar adicionando params e options em todas as requisições, ver janela Find abaixo\n// TODO talvez tenha que adicionar as opções de cache adicionais do Next nos tipos do next-sdk? verificar\n// TODO lançar versão 3.1.0 de todos os sdks\n// TODO continuar os-template passando cache pras opções do fetch\n\nexport default function makeEntrySelector<D extends SerializedData>(\n client: StarlightClient,\n model: string,\n): EntrySelector<D> {\n return {\n list(params, options) {\n return client.get(`/models/${model}/entries`, params, options)\n },\n\n get(slug, params, options) {\n return client.get(`/models/${model}/entries/${slug}`, params, options)\n },\n }\n}\n\nexport { EntrySelector, ListEntriesParams }\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ListRequestParameters, Entry, QueryableFields, QueryableRequestParameters, SerializedData, StarlightItemResponse, StarlightListResponse, BaseRequestParameters } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Request parameters for listing entries.
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@ import { BaseRequestParameters, Entry, QueryableFields, QueryableRequestParamete
|
|
|
6
6
|
*
|
|
7
7
|
* @group Request Parameters
|
|
8
8
|
*/
|
|
9
|
-
export interface ListEntriesParams extends
|
|
9
|
+
export interface ListEntriesParams extends ListRequestParameters, QueryableRequestParameters {
|
|
10
10
|
/**
|
|
11
11
|
* A comma-separated list of categories. Only entries in these categories
|
|
12
12
|
* will be returned. If undefined, all entries in the model will be listed.
|
|
@@ -49,14 +49,14 @@ export interface ListEntriesParams extends BaseRequestParameters, QueryableReque
|
|
|
49
49
|
*
|
|
50
50
|
* @group Request Parameters
|
|
51
51
|
*/
|
|
52
|
-
export
|
|
52
|
+
export interface GetEntryParams extends BaseRequestParameters {
|
|
53
53
|
/**
|
|
54
54
|
* Preview token generated by the Starlight admin interface. If defined and
|
|
55
55
|
* valid, the API will return a preview of the entry revision associated
|
|
56
56
|
* with the token.
|
|
57
57
|
*/
|
|
58
58
|
preview?: string;
|
|
59
|
-
}
|
|
59
|
+
}
|
|
60
60
|
/**
|
|
61
61
|
* A Selector that provide methods to list and request information on
|
|
62
62
|
* {@apilink Entry | Entries}.
|
|
@@ -90,9 +90,9 @@ export interface EntrySelector<D extends SerializedData> {
|
|
|
90
90
|
* @param slug The entry slug.
|
|
91
91
|
* @param params An optional object of request parameters. See
|
|
92
92
|
* {@link GetEntryParams} for all available options.
|
|
93
|
-
* @param options An optional object of
|
|
94
|
-
*
|
|
95
|
-
*
|
|
93
|
+
* @param options An optional object of fetch options. See
|
|
94
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for
|
|
95
|
+
* more info.
|
|
96
96
|
*/
|
|
97
97
|
get(slug: string, params?: GetEntryParams, options?: RequestInit): Promise<StarlightItemResponse<Entry<D>>>;
|
|
98
98
|
/**
|
|
@@ -126,10 +126,13 @@ export interface EntrySelector<D extends SerializedData> {
|
|
|
126
126
|
* })
|
|
127
127
|
* ```
|
|
128
128
|
*
|
|
129
|
-
* @param
|
|
130
|
-
* {@link ListEntriesParams} for all available
|
|
129
|
+
* @param params An optional object of request parameters. See
|
|
130
|
+
* {@link ListEntriesParams} for all available parameters. `field:foo`
|
|
131
131
|
* syntax is also supported, see {@link QueryableFields} for more info.
|
|
132
|
+
* @param options An optional object of fetch options. See
|
|
133
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for
|
|
134
|
+
* more info.
|
|
132
135
|
*/
|
|
133
|
-
list(
|
|
136
|
+
list(params?: ListEntriesParams & QueryableFields<D>, options?: RequestInit): Promise<StarlightListResponse<Entry<D>>>;
|
|
134
137
|
}
|
|
135
138
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Entry/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,EACL,eAAe,EACf,0BAA0B,EAC1B,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAEpB;;;;;;GAMG;AACH,MAAM,WAAW,iBACf,SAAQ,qBAAqB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Entry/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,EACL,eAAe,EACf,0BAA0B,EAC1B,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAEpB;;;;;;GAMG;AACH,MAAM,WAAW,iBACf,SAAQ,qBAAqB,EAAE,0BAA0B;IACzD;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,KAAK,CAAC,EACF,WAAW,GACX,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,WAAW,GACX,YAAY,CAAA;IAChB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IACd;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAe,SAAQ,qBAAqB;IAC3D;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,cAAc;IACrD;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,GAAG,CACD,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,IAAI,CACF,MAAM,CAAC,EAAE,iBAAiB,GAAG,eAAe,CAAC,CAAC,CAAC,EAC/C,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;CAC5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/selectors/Entry/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/selectors/Entry/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n ListRequestParameters,\n Entry,\n QueryableFields,\n QueryableRequestParameters,\n SerializedData,\n StarlightItemResponse,\n StarlightListResponse,\n BaseRequestParameters,\n} from '../../types'\n\n/**\n * Request parameters for listing entries.\n *\n * Used by {@apilink EntrySelector.list}.\n *\n * @group Request Parameters\n */\nexport interface ListEntriesParams\n extends ListRequestParameters, QueryableRequestParameters {\n /**\n * A comma-separated list of categories. Only entries in these categories\n * will be returned. If undefined, all entries in the model will be listed.\n *\n * For instance, to show only entries in the \"news\" and \"articles\" categories,\n * pass `'news,category'`.\n */\n categories?: string\n /**\n * Define how items 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 * When false, the returned entries won't have any data attached to them,\n * even if their Model have listable fields. Defaults to true.\n */\n data?: boolean\n /**\n * When given, return entries published before the given date. Should be an\n * ISO 8601 date string.\n *\n * Tip: in JavaScript, you can get an ISO 8601 date string by using\n * [Date.toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString).\n */\n published_before?: string\n /**\n * When given, return entries published after the given date. Should be an\n * ISO 8601 date string.\n *\n * Tip: in JavaScript, you can get an ISO 8601 date string by using\n * [Date.toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString).\n */\n published_after?: string\n}\n\n/**\n * Request parameters for getting an entry.\n *\n * Used by {@apilink EntrySelector.get}.\n *\n * @group Request Parameters\n */\nexport interface GetEntryParams extends BaseRequestParameters {\n /**\n * Preview token generated by the Starlight admin interface. If defined and\n * valid, the API will return a preview of the entry revision associated\n * with the token.\n */\n preview?: string\n}\n\n/**\n * A Selector that provide methods to list and request information on\n * {@apilink Entry | Entries}.\n *\n * You can use an EntrySelector by accessing\n * {@apilink ModelInstance.entries}.\n *\n * @group Selectors\n */\nexport interface EntrySelector<D extends SerializedData> {\n /**\n * Returns a {@link StarlightItemResponse} with a single {@link Entry}.\n * Supports revision previewing by passing a `preview` parameter.\n *\n * @example Requesting information from an entry \"hello-world\" from a model of slug \"posts\".\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.posts.entries.get('hello-world')\n * ```\n *\n * @example Passing a preview token on the last example.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.posts.entries.get('hello-world', {\n * preview: 'CDfkvt1zTF5XhxWzi2Lejgo1'\n * })\n * ```\n *\n * @param slug The entry slug.\n * @param params An optional object of request parameters. See\n * {@link GetEntryParams} for all available options.\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 slug: string,\n params?: GetEntryParams,\n options?: RequestInit,\n ): Promise<StarlightItemResponse<Entry<D>>>\n\n /**\n * Returns a {@link StarlightListResponse} with a list of\n * {@apilink Entry | Entries}.\n *\n * @example Requesting all entries from a model of slug \"recipes\".\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.recipes.entries.list()\n * ```\n *\n * @example Paginating and searching on the last example.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.recipes.entries.list({\n * page: 2,\n * query: 'gravy',\n * 'field:is_vegan': true,\n * })\n * ```\n *\n * @example Ordering entries by number of views.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.recipes.entries.list({\n * order: 'views:desc'\n * })\n * ```\n *\n * @param params An optional object of request parameters. See\n * {@link ListEntriesParams} 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 list(\n params?: ListEntriesParams & QueryableFields<D>,\n options?: RequestInit,\n ): Promise<StarlightListResponse<Entry<D>>>\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export default function makeMediaSelector(client) {
|
|
2
2
|
return {
|
|
3
|
-
list() {
|
|
4
|
-
return client.get('/media');
|
|
3
|
+
list(params, options) {
|
|
4
|
+
return client.get('/media', params, options);
|
|
5
5
|
},
|
|
6
|
-
get(id) {
|
|
7
|
-
return client.get(`/media/${id}
|
|
6
|
+
get(id, params, options) {
|
|
7
|
+
return client.get(`/media/${id}`, params, options);
|
|
8
8
|
},
|
|
9
9
|
};
|
|
10
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Media/index.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,MAAuB;IAEvB,OAAO;QACL,IAAI;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Media/index.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,MAAuB;IAEvB,OAAO;QACL,IAAI,CAAC,MAAM,EAAE,OAAO;YAClB,OAAO,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QAC9C,CAAC;QAED,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO;YACrB,OAAO,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QACpD,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import { StarlightClient } from '../../types'\nimport { MediaSelector } from './types'\n\nexport default function makeMediaSelector(\n client: StarlightClient,\n): MediaSelector {\n return {\n list(params, options) {\n return client.get('/media', params, options)\n },\n\n get(id, params, options) {\n return client.get(`/media/${id}`, params, options)\n },\n }\n}\n\nexport { MediaSelector }\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MediaObject, StarlightItemResponse, StarlightListResponse } from '../../types';
|
|
1
|
+
import { BaseRequestParameters, MediaObject, StarlightItemResponse, StarlightListResponse } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* A Selector that provide methods to list and request information on
|
|
4
4
|
* {@apilink MediaObject | MediaObjects}.
|
|
@@ -22,8 +22,12 @@ export interface MediaSelector {
|
|
|
22
22
|
* ```
|
|
23
23
|
*
|
|
24
24
|
* @param id The media object ID.
|
|
25
|
+
* @param params An optional object of request parameters.
|
|
26
|
+
* @param options An optional object of fetch options. See
|
|
27
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for
|
|
28
|
+
* more info.
|
|
25
29
|
*/
|
|
26
|
-
get(id: number | string): Promise<StarlightItemResponse<MediaObject>>;
|
|
30
|
+
get(id: number | string, params?: BaseRequestParameters, options?: RequestInit): Promise<StarlightItemResponse<MediaObject>>;
|
|
27
31
|
/**
|
|
28
32
|
* Returns a {@link StarlightListResponse} with the list of
|
|
29
33
|
* {@apilink MediaObject | MediaObjects} in this workspace.
|
|
@@ -34,7 +38,12 @@ export interface MediaSelector {
|
|
|
34
38
|
*
|
|
35
39
|
* const response = await Starlight.media.list()
|
|
36
40
|
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param params An optional object of request parameters.
|
|
43
|
+
* @param options An optional object of fetch options. See
|
|
44
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for
|
|
45
|
+
* more info.
|
|
37
46
|
*/
|
|
38
|
-
list(): Promise<StarlightListResponse<MediaObject>>;
|
|
47
|
+
list(params?: BaseRequestParameters, options?: RequestInit): Promise<StarlightListResponse<MediaObject>>;
|
|
39
48
|
}
|
|
40
49
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Media/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAEpB;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Media/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAEpB;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;;;;;;;OAiBG;IACH,GAAG,CACD,EAAE,EAAE,MAAM,GAAG,MAAM,EACnB,MAAM,CAAC,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAA;IAE9C;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CACF,MAAM,CAAC,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAA;CAC/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/selectors/Media/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n MediaObject,\n StarlightItemResponse,\n StarlightListResponse,\n} from '../../types'\n\n/**\n * A Selector that provide methods to list and request information on\n * {@apilink MediaObject | MediaObjects}.\n *\n * You can use a MediaSelector by accessing\n * {@apilink StarlightClient.media}.\n *\n * @group Selectors\n */\nexport interface MediaSelector {\n /**\n * Returns a {@link StarlightItemResponse} with a single {@link MediaObject}.\n *\n * Note: MediaObjects are identified by their IDs, since they don't have slugs.\n *\n * @example Requesting information from a media object of id \"123456789\".\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.media.get('123456789')\n * ```\n *\n * @param id The media object ID.\n */\n get(id: number | string): Promise<StarlightItemResponse<MediaObject>>\n\n /**\n * Returns a {@link StarlightListResponse} with the list of\n * {@apilink MediaObject | MediaObjects} in this workspace.\n *\n * @example Requesting all media objects from the workspace.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.media.list()\n * ```\n */\n list(): Promise<StarlightListResponse<MediaObject>>\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/selectors/Media/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n BaseRequestParameters,\n MediaObject,\n StarlightItemResponse,\n StarlightListResponse,\n} from '../../types'\n\n/**\n * A Selector that provide methods to list and request information on\n * {@apilink MediaObject | MediaObjects}.\n *\n * You can use a MediaSelector by accessing\n * {@apilink StarlightClient.media}.\n *\n * @group Selectors\n */\nexport interface MediaSelector {\n /**\n * Returns a {@link StarlightItemResponse} with a single {@link MediaObject}.\n *\n * Note: MediaObjects are identified by their IDs, since they don't have slugs.\n *\n * @example Requesting information from a media object of id \"123456789\".\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.media.get('123456789')\n * ```\n *\n * @param id The media object ID.\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 id: number | string,\n params?: BaseRequestParameters,\n options?: RequestInit,\n ): Promise<StarlightItemResponse<MediaObject>>\n\n /**\n * Returns a {@link StarlightListResponse} with the list of\n * {@apilink MediaObject | MediaObjects} in this workspace.\n *\n * @example Requesting all media objects from the workspace.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.media.list()\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 list(\n params?: BaseRequestParameters,\n options?: RequestInit,\n ): Promise<StarlightListResponse<MediaObject>>\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StarlightClient, WorkspaceModelDefinition } from '../../types';
|
|
2
|
-
import {
|
|
2
|
+
import { DynamicModelSelector, ModelSelector } from './types';
|
|
3
3
|
export default function makeModelSelector<D extends WorkspaceModelDefinition>(client: StarlightClient): DynamicModelSelector<D>;
|
|
4
4
|
export { ModelSelector, DynamicModelSelector };
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Model/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Model/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAG7D,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,SAAS,wBAAwB,EAC1E,MAAM,EAAE,eAAe,GACtB,oBAAoB,CAAC,CAAC,CAAC,CAoBzB;AAED,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,CAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import makeModelInstance from '../../instances/Model';
|
|
2
2
|
export default function makeModelSelector(client) {
|
|
3
3
|
const modelClient = {
|
|
4
|
-
list() {
|
|
5
|
-
return client.get('/models');
|
|
4
|
+
list(params, options) {
|
|
5
|
+
return client.get('/models', params, options);
|
|
6
6
|
},
|
|
7
|
-
get(slug) {
|
|
8
|
-
return client.get(`/models/${slug}
|
|
7
|
+
get(slug, params, options) {
|
|
8
|
+
return client.get(`/models/${slug}`, params, options);
|
|
9
9
|
},
|
|
10
10
|
};
|
|
11
11
|
return new Proxy(modelClient, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Model/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Model/index.ts"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,MAAM,uBAAuB,CAAA;AAErD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,MAAuB;IAEvB,MAAM,WAAW,GAAkB;QACjC,IAAI,CAAC,MAAM,EAAE,OAAO;YAClB,OAAO,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QAC/C,CAAC;QAED,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO;YACvB,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QACvD,CAAC;KACF,CAAA;IAED,OAAO,IAAI,KAAK,CAAC,WAAW,EAAE;QAC5B,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,CAA4B,CAAA;AAC/B,CAAC","sourcesContent":["import { StarlightClient, WorkspaceModelDefinition } from '../../types'\nimport { DynamicModelSelector, ModelSelector } from './types'\nimport makeModelInstance from '../../instances/Model'\n\nexport default function makeModelSelector<D extends WorkspaceModelDefinition>(\n client: StarlightClient,\n): DynamicModelSelector<D> {\n const modelClient: ModelSelector = {\n list(params, options) {\n return client.get('/models', params, options)\n },\n\n get(slug, params, options) {\n return client.get(`/models/${slug}`, params, options)\n },\n }\n\n return new Proxy(modelClient, {\n get(target, prop) {\n if (typeof prop === 'string' && !Reflect.has(target, prop)) {\n return makeModelInstance(client, prop)\n }\n\n return Reflect.get(target, prop)\n },\n }) as DynamicModelSelector<D>\n}\n\nexport { ModelSelector, DynamicModelSelector }\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Model, StarlightItemResponse, StarlightListResponse, WorkspaceModelDefinition } from '../../types';
|
|
1
|
+
import { BaseRequestParameters, Model, StarlightItemResponse, StarlightListResponse, WorkspaceModelDefinition } from '../../types';
|
|
2
2
|
import { DynamicModelInstance } from '../../instances/Model';
|
|
3
3
|
/**
|
|
4
4
|
* A Selector that provide methods to list and request information on
|
|
@@ -23,8 +23,13 @@ export interface ModelSelector {
|
|
|
23
23
|
*
|
|
24
24
|
* const response = await Starlight.models.list()
|
|
25
25
|
* ```
|
|
26
|
+
*
|
|
27
|
+
* @param params An optional object of request parameters.
|
|
28
|
+
* @param options An optional object of fetch options. See
|
|
29
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for
|
|
30
|
+
* more info.
|
|
26
31
|
*/
|
|
27
|
-
list(): Promise<StarlightListResponse<Model>>;
|
|
32
|
+
list(params?: BaseRequestParameters, options?: RequestInit): Promise<StarlightListResponse<Model>>;
|
|
28
33
|
/**
|
|
29
34
|
* Returns a {@link StarlightItemResponse} with a single {@link Model}.
|
|
30
35
|
*
|
|
@@ -40,8 +45,12 @@ export interface ModelSelector {
|
|
|
40
45
|
* ```
|
|
41
46
|
*
|
|
42
47
|
* @param slug The model slug.
|
|
48
|
+
* @param params An optional object of request parameters.
|
|
49
|
+
* @param options An optional object of fetch options. See
|
|
50
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for
|
|
51
|
+
* more info.
|
|
43
52
|
*/
|
|
44
|
-
get(slug: string): Promise<StarlightItemResponse<Model>>;
|
|
53
|
+
get(slug: string, params?: BaseRequestParameters, options?: RequestInit): Promise<StarlightItemResponse<Model>>;
|
|
45
54
|
}
|
|
46
55
|
/**
|
|
47
56
|
* A Selector that provide all {@link ModelSelector} methods and adds support
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Model/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACzB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAE5D;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa;IAC5B
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Model/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,EACL,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACzB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAE5D;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CACF,MAAM,CAAC,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAA;IAExC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG,CACD,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAA;CACzC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,wBAAwB,IACjE,aAAa,GAAG;KACb,CAAC,IAAI,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/selectors/Model/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n Model,\n StarlightItemResponse,\n StarlightListResponse,\n WorkspaceModelDefinition,\n} from '../../types'\nimport { DynamicModelInstance } from '../../instances/Model'\n\n/**\n * A Selector that provide methods to list and request information on\n * {@apilink Model | Models}.\n *\n * You can use a ModelSelector by accessing\n * {@apilink StarlightClient.models}.\n *\n * To list entries or categories of a specific model, use a\n * {@link ModelInstance}.\n *\n * @group Selectors\n */\nexport interface ModelSelector {\n /**\n * Returns a {@link StarlightListResponse} with a list of\n * {@apilink Model | Models}.\n *\n * @example Requesting all models from a workspace.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.models.list()\n * ```\n */\n list(): Promise<StarlightListResponse<Model>>\n\n /**\n * Returns a {@link StarlightItemResponse} with a single {@link Model}.\n *\n * Note that this method only returns information on a model, like its title,\n * slug, creation date, and entry count. If you want list its entries or\n * categories, you need to use a {@link ModelInstance}.\n *\n * @example Requesting information from a model of slug \"clients\".\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.posts.entries.get('clients')\n * ```\n *\n * @param slug The model slug.\n */\n get(slug: string): Promise<StarlightItemResponse<Model>>\n}\n\n/**\n * A Selector that provide all {@link ModelSelector} methods and adds support\n * for creating {@apilink DynamicModelInstance | DynamicModelInstances} using\n * the dynamic syntax.\n *\n * See {@link ModelSelector} 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 DynamicModelInstance using the dynamic syntax.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // \"posts\" below will be a DynamicModelInstance.\n * const response = await Starlight.models.posts.entries.list()\n * ```\n *\n * @category Selectors\n */\nexport type DynamicModelSelector<T extends WorkspaceModelDefinition> =\n ModelSelector & {\n [K in keyof T]: DynamicModelInstance<T[K]>\n }\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/selectors/Model/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n BaseRequestParameters,\n Model,\n StarlightItemResponse,\n StarlightListResponse,\n WorkspaceModelDefinition,\n} from '../../types'\nimport { DynamicModelInstance } from '../../instances/Model'\n\n/**\n * A Selector that provide methods to list and request information on\n * {@apilink Model | Models}.\n *\n * You can use a ModelSelector by accessing\n * {@apilink StarlightClient.models}.\n *\n * To list entries or categories of a specific model, use a\n * {@link ModelInstance}.\n *\n * @group Selectors\n */\nexport interface ModelSelector {\n /**\n * Returns a {@link StarlightListResponse} with a list of\n * {@apilink Model | Models}.\n *\n * @example Requesting all models from a workspace.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.models.list()\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 list(\n params?: BaseRequestParameters,\n options?: RequestInit,\n ): Promise<StarlightListResponse<Model>>\n\n /**\n * Returns a {@link StarlightItemResponse} with a single {@link Model}.\n *\n * Note that this method only returns information on a model, like its title,\n * slug, creation date, and entry count. If you want list its entries or\n * categories, you need to use a {@link ModelInstance}.\n *\n * @example Requesting information from a model of slug \"clients\".\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.posts.entries.get('clients')\n * ```\n *\n * @param slug The model slug.\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 slug: string,\n params?: BaseRequestParameters,\n options?: RequestInit,\n ): Promise<StarlightItemResponse<Model>>\n}\n\n/**\n * A Selector that provide all {@link ModelSelector} methods and adds support\n * for creating {@apilink DynamicModelInstance | DynamicModelInstances} using\n * the dynamic syntax.\n *\n * See {@link ModelSelector} 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 DynamicModelInstance using the dynamic syntax.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // \"posts\" below will be a DynamicModelInstance.\n * const response = await Starlight.models.posts.entries.list()\n * ```\n *\n * @category Selectors\n */\nexport type DynamicModelSelector<T extends WorkspaceModelDefinition> =\n ModelSelector & {\n [K in keyof T]: DynamicModelInstance<T[K]>\n }\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SerializedData, StarlightClient } from '../../types';
|
|
2
|
-
import {
|
|
2
|
+
import { DynamicModelCategorySelector, ListModelCategoriesOptions, ModelCategorySelector } from './types';
|
|
3
3
|
export default function makeModelCategorySelector<D extends SerializedData>(client: StarlightClient, model: string): DynamicModelCategorySelector<D>;
|
|
4
4
|
export { ModelCategorySelector, DynamicModelCategorySelector, ListModelCategoriesOptions, };
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/selectors/ModelCategory/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/selectors/ModelCategory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAGhB,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,CAAC,SAAS,cAAc,EACxE,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,GACZ,4BAA4B,CAAC,CAAC,CAAC,CAoBjC;AAED,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,0BAA0B,GAC3B,CAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import makeModelCategoryInstance from '../../instances/ModelCategory';
|
|
2
2
|
export default function makeModelCategorySelector(client, model) {
|
|
3
3
|
const selector = {
|
|
4
|
-
list(options) {
|
|
5
|
-
return client.get(`/models/${model}/categories`,
|
|
4
|
+
list(params, options) {
|
|
5
|
+
return client.get(`/models/${model}/categories`, params, options);
|
|
6
6
|
},
|
|
7
|
-
get(slug) {
|
|
8
|
-
return client.get(`/models/${model}/categories/${slug}
|
|
7
|
+
get(slug, params, options) {
|
|
8
|
+
return client.get(`/models/${model}/categories/${slug}`, params, options);
|
|
9
9
|
},
|
|
10
10
|
};
|
|
11
11
|
return new Proxy(selector, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/ModelCategory/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/ModelCategory/index.ts"],"names":[],"mappings":"AAMA,OAAO,yBAAyB,MAAM,+BAA+B,CAAA;AAErE,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,MAAuB,EACvB,KAAa;IAEb,MAAM,QAAQ,GAA0B;QACtC,IAAI,CAAC,MAAM,EAAE,OAAO;YAClB,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,KAAK,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QACnE,CAAC;QAED,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO;YACvB,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,KAAK,eAAe,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QAC3E,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,CAAoC,CAAA;AACvC,CAAC","sourcesContent":["import { SerializedData, StarlightClient } from '../../types'\nimport {\n DynamicModelCategorySelector,\n ListModelCategoriesOptions,\n ModelCategorySelector,\n} from './types'\nimport makeModelCategoryInstance from '../../instances/ModelCategory'\n\nexport default function makeModelCategorySelector<D extends SerializedData>(\n client: StarlightClient,\n model: string,\n): DynamicModelCategorySelector<D> {\n const selector: ModelCategorySelector = {\n list(params, options) {\n return client.get(`/models/${model}/categories`, params, options)\n },\n\n get(slug, params, options) {\n return client.get(`/models/${model}/categories/${slug}`, params, options)\n },\n }\n\n return new Proxy(selector, {\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 DynamicModelCategorySelector<D>\n}\n\nexport {\n ModelCategorySelector,\n DynamicModelCategorySelector,\n ListModelCategoriesOptions,\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseRequestParameters, ModelCategory, SerializedData, StarlightItemResponse, StarlightListResponse } from '../../types';
|
|
1
|
+
import { BaseRequestParameters, ListRequestParameters, ModelCategory, SerializedData, StarlightItemResponse, StarlightListResponse } from '../../types';
|
|
2
2
|
import { ModelCategoryInstance } from '../../instances/ModelCategory';
|
|
3
3
|
/**
|
|
4
4
|
* Request parameters for listing model categories.
|
|
@@ -7,7 +7,7 @@ import { ModelCategoryInstance } from '../../instances/ModelCategory';
|
|
|
7
7
|
*
|
|
8
8
|
* @group Request Parameters
|
|
9
9
|
*/
|
|
10
|
-
export interface ListModelCategoriesOptions extends
|
|
10
|
+
export interface ListModelCategoriesOptions extends ListRequestParameters {
|
|
11
11
|
/**
|
|
12
12
|
* Define how items will be ordered. Check this field type to see the
|
|
13
13
|
* allowed options.
|
|
@@ -35,10 +35,13 @@ export interface ModelCategorySelector {
|
|
|
35
35
|
* const response = await Starlight.posts.categories.list()
|
|
36
36
|
* ```
|
|
37
37
|
*
|
|
38
|
-
* @param
|
|
39
|
-
* {@link ListModelCategoriesOptions} for all available
|
|
38
|
+
* @param params An optional object of request parameters. See
|
|
39
|
+
* {@link ListModelCategoriesOptions} for all available 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.
|
|
40
43
|
*/
|
|
41
|
-
list(options?:
|
|
44
|
+
list(params?: ListModelCategoriesOptions, options?: RequestInit): Promise<StarlightListResponse<ModelCategory>>;
|
|
42
45
|
/**
|
|
43
46
|
* Returns a {@link StarlightItemResponse} with a single {@link ModelCategory}.
|
|
44
47
|
*
|
|
@@ -50,8 +53,12 @@ export interface ModelCategorySelector {
|
|
|
50
53
|
* ```
|
|
51
54
|
*
|
|
52
55
|
* @param slug The category slug.
|
|
56
|
+
* @param params An optional object of request parameters.
|
|
57
|
+
* @param options An optional object of fetch options. See
|
|
58
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/RequestInit} for
|
|
59
|
+
* more info.
|
|
53
60
|
*/
|
|
54
|
-
get(slug: string): Promise<StarlightItemResponse<ModelCategory>>;
|
|
61
|
+
get(slug: string, params?: BaseRequestParameters, options?: RequestInit): Promise<StarlightItemResponse<ModelCategory>>;
|
|
55
62
|
}
|
|
56
63
|
/**
|
|
57
64
|
* A Selector that provide all {@link ModelCategorySelector} methods and adds
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/ModelCategory/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAErE;;;;;;GAMG;AACH,MAAM,WAAW,0BAA2B,SAAQ,qBAAqB;IACvE;;;OAGG;IACH,KAAK,CAAC,EACF,WAAW,GACX,YAAY,GACZ,iBAAiB,GACjB,kBAAkB,GAClB,UAAU,GACV,WAAW,GACX,gBAAgB,GAChB,iBAAiB,GACjB,gBAAgB,GAChB,iBAAiB,CAAA;CACtB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB;IACpC
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/ModelCategory/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAErE;;;;;;GAMG;AACH,MAAM,WAAW,0BAA2B,SAAQ,qBAAqB;IACvE;;;OAGG;IACH,KAAK,CAAC,EACF,WAAW,GACX,YAAY,GACZ,iBAAiB,GACjB,kBAAkB,GAClB,UAAU,GACV,WAAW,GACX,gBAAgB,GAChB,iBAAiB,GACjB,gBAAgB,GAChB,iBAAiB,CAAA;CACtB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,CACF,MAAM,CAAC,EAAE,0BAA0B,EACnC,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,CAAA;IAEhD;;;;;;;;;;;;;;;OAeG;IACH,GAAG,CACD,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,CAAA;CACjD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,4BAA4B,CAAC,CAAC,SAAS,cAAc,IAC/D,qBAAqB,GAAG;IACtB,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;CACzC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/selectors/ModelCategory/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n BaseRequestParameters,\n ModelCategory,\n SerializedData,\n StarlightItemResponse,\n StarlightListResponse,\n} from '../../types'\nimport { ModelCategoryInstance } from '../../instances/ModelCategory'\n\n/**\n * Request parameters for listing model categories.\n *\n * Used by {@apilink ModelCategorySelector.list}.\n *\n * @group Request Parameters\n */\nexport interface ListModelCategoriesOptions extends
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/selectors/ModelCategory/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n BaseRequestParameters,\n ListRequestParameters,\n ModelCategory,\n SerializedData,\n StarlightItemResponse,\n StarlightListResponse,\n} from '../../types'\nimport { ModelCategoryInstance } from '../../instances/ModelCategory'\n\n/**\n * Request parameters for listing model categories.\n *\n * Used by {@apilink ModelCategorySelector.list}.\n *\n * @group Request Parameters\n */\nexport interface ListModelCategoriesOptions extends ListRequestParameters {\n /**\n * Define how items will be ordered. Check this field type to see the\n * allowed options.\n */\n order?:\n | 'title:asc'\n | 'title:desc'\n | 'entry_count:asc'\n | 'entry_count:desc'\n | 'slug:asc'\n | 'slug:desc'\n | 'created_at:asc'\n | 'created_at:desc'\n | 'updated_at:asc'\n | 'updated_at:desc'\n}\n\n/**\n * A Selector that provide methods to list and request information on\n * {@apilink ModelCategory | ModelCategories}.\n *\n * You can use a ModelCategorySelector by accessing\n * {@apilink ModelInstance.categories}.\n *\n * @group Selectors\n */\nexport interface ModelCategorySelector {\n /**\n * Returns a {@link StarlightListResponse} with a list of\n * {@apilink ModelCategory | ModelCategories}.\n *\n * @example Requesting all categories from a model.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.posts.categories.list()\n * ```\n *\n * @param params An optional object of request parameters. See\n * {@link ListModelCategoriesOptions} for all available 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 list(\n params?: ListModelCategoriesOptions,\n options?: RequestInit,\n ): Promise<StarlightListResponse<ModelCategory>>\n\n /**\n * Returns a {@link StarlightItemResponse} with a single {@link ModelCategory}.\n *\n * @example Requesting information from a category \"premium\" from a model of slug \"plans\".\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.plans.premium.get()\n * ```\n *\n * @param slug The category slug.\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 slug: string,\n params?: BaseRequestParameters,\n options?: RequestInit,\n ): Promise<StarlightItemResponse<ModelCategory>>\n}\n\n/**\n * A Selector that provide all {@link ModelCategorySelector} methods and adds\n * support for creating {@apilink ModelCategoryInstance | ModelCategoryInstances}\n * using the dynamic syntax.\n *\n * See {@link ModelCategorySelector} to view all available methods. You can use\n * a DynamicModelCategorySelector by accessing {@apilink ModelInstance.categories}.\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 ModelCategorySelector using the dynamic syntax on a model of slug \"posts\"\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // \"articles\" below will be a ModelCategorySelector.\n * const response = await Starlight.posts.categories.articles.list()\n * ```\n *\n * @category Instances\n */\nexport type DynamicModelCategorySelector<D extends SerializedData> =\n ModelCategorySelector & {\n [slug: string]: ModelCategoryInstance<D>\n }\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Search/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Search/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7D,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,MAAM,EAAE,eAAe,GACtB,cAAc,CAMhB;AAED,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Search/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Search/index.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,MAAuB;IAEvB,OAAO;QACL,OAAO,CAAC,MAAM,EAAE,OAAO;YACrB,OAAO,MAAM,CAAC,GAAG,CAAC,iBAAiB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QACvD,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import { StarlightClient } from '../../types'\nimport { SearchEntriesParams, SearchSelector } from './types'\n\nexport default function makeSearchSelector(\n client: StarlightClient,\n): SearchSelector {\n return {\n entries(params, options) {\n return client.get('/search/entries', params, options)\n },\n }\n}\n\nexport { SearchSelector, SearchEntriesParams }\n"]}
|