@starlightcms/js-sdk 0.10.0 → 0.12.1

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 (144) hide show
  1. package/README.md +54 -0
  2. package/dist/cjs/client.d.ts +6 -6
  3. package/dist/cjs/client.d.ts.map +1 -1
  4. package/dist/cjs/client.js +8 -5
  5. package/dist/cjs/client.js.map +1 -1
  6. package/dist/cjs/errors.d.ts +23 -0
  7. package/dist/cjs/errors.d.ts.map +1 -1
  8. package/dist/cjs/errors.js.map +1 -1
  9. package/dist/cjs/index.d.ts +6 -5
  10. package/dist/cjs/index.d.ts.map +1 -1
  11. package/dist/cjs/index.js +5 -4
  12. package/dist/cjs/index.js.map +1 -1
  13. package/dist/cjs/instances/Collection/index.d.ts +2 -2
  14. package/dist/cjs/instances/Collection/index.d.ts.map +1 -1
  15. package/dist/cjs/instances/Collection/index.js.map +1 -1
  16. package/dist/cjs/instances/Collection/types.d.ts +25 -13
  17. package/dist/cjs/instances/Collection/types.d.ts.map +1 -1
  18. package/dist/cjs/instances/Collection/types.js.map +1 -1
  19. package/dist/cjs/instances/Model/types.d.ts +83 -0
  20. package/dist/cjs/instances/Model/types.d.ts.map +1 -1
  21. package/dist/cjs/instances/Model/types.js.map +1 -1
  22. package/dist/cjs/instances/ModelCategory/index.d.ts +2 -2
  23. package/dist/cjs/instances/ModelCategory/index.d.ts.map +1 -1
  24. package/dist/cjs/instances/ModelCategory/index.js.map +1 -1
  25. package/dist/cjs/instances/ModelCategory/types.d.ts +62 -10
  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.d.ts +2 -2
  29. package/dist/cjs/selectors/Collection/index.d.ts.map +1 -1
  30. package/dist/cjs/selectors/Collection/index.js +1 -1
  31. package/dist/cjs/selectors/Collection/index.js.map +1 -1
  32. package/dist/cjs/selectors/Collection/types.d.ts +82 -7
  33. package/dist/cjs/selectors/Collection/types.d.ts.map +1 -1
  34. package/dist/cjs/selectors/Collection/types.js.map +1 -1
  35. package/dist/cjs/selectors/Entry/types.d.ts +105 -10
  36. package/dist/cjs/selectors/Entry/types.d.ts.map +1 -1
  37. package/dist/cjs/selectors/Entry/types.js.map +1 -1
  38. package/dist/cjs/selectors/Media/index.js +2 -2
  39. package/dist/cjs/selectors/Media/index.js.map +1 -1
  40. package/dist/cjs/selectors/Media/types.d.ts +35 -1
  41. package/dist/cjs/selectors/Media/types.d.ts.map +1 -1
  42. package/dist/cjs/selectors/Media/types.js.map +1 -1
  43. package/dist/cjs/selectors/Model/types.d.ts +59 -0
  44. package/dist/cjs/selectors/Model/types.d.ts.map +1 -1
  45. package/dist/cjs/selectors/Model/types.js.map +1 -1
  46. package/dist/cjs/selectors/ModelCategory/index.js +1 -1
  47. package/dist/cjs/selectors/ModelCategory/index.js.map +1 -1
  48. package/dist/cjs/selectors/ModelCategory/types.d.ts +49 -6
  49. package/dist/cjs/selectors/ModelCategory/types.d.ts.map +1 -1
  50. package/dist/cjs/selectors/ModelCategory/types.js.map +1 -1
  51. package/dist/cjs/selectors/Search/index.d.ts +2 -2
  52. package/dist/cjs/selectors/Search/index.d.ts.map +1 -1
  53. package/dist/cjs/selectors/Search/index.js +1 -1
  54. package/dist/cjs/selectors/Search/index.js.map +1 -1
  55. package/dist/cjs/selectors/Search/types.d.ts +80 -7
  56. package/dist/cjs/selectors/Search/types.d.ts.map +1 -1
  57. package/dist/cjs/selectors/Search/types.js.map +1 -1
  58. package/dist/cjs/selectors/Singleton/types.d.ts +49 -0
  59. package/dist/cjs/selectors/Singleton/types.d.ts.map +1 -1
  60. package/dist/cjs/selectors/Singleton/types.js.map +1 -1
  61. package/dist/cjs/types/entities.d.ts +89 -8
  62. package/dist/cjs/types/entities.d.ts.map +1 -1
  63. package/dist/cjs/types/entities.js.map +1 -1
  64. package/dist/cjs/types/index.d.ts +99 -8
  65. package/dist/cjs/types/index.d.ts.map +1 -1
  66. package/dist/cjs/types/index.js.map +1 -1
  67. package/dist/cjs/types/instances.d.ts +2 -2
  68. package/dist/cjs/types/instances.d.ts.map +1 -1
  69. package/dist/cjs/types/instances.js.map +1 -1
  70. package/dist/cjs/types/selectors.d.ts +2 -2
  71. package/dist/cjs/types/selectors.d.ts.map +1 -1
  72. package/dist/cjs/types/selectors.js.map +1 -1
  73. package/dist/esm/client.d.ts +6 -6
  74. package/dist/esm/client.d.ts.map +1 -1
  75. package/dist/esm/client.js +8 -5
  76. package/dist/esm/client.js.map +1 -1
  77. package/dist/esm/errors.d.ts +23 -0
  78. package/dist/esm/errors.d.ts.map +1 -1
  79. package/dist/esm/errors.js.map +1 -1
  80. package/dist/esm/index.d.ts +6 -5
  81. package/dist/esm/index.d.ts.map +1 -1
  82. package/dist/esm/index.js +5 -4
  83. package/dist/esm/index.js.map +1 -1
  84. package/dist/esm/instances/Collection/index.d.ts +2 -2
  85. package/dist/esm/instances/Collection/index.d.ts.map +1 -1
  86. package/dist/esm/instances/Collection/index.js.map +1 -1
  87. package/dist/esm/instances/Collection/types.d.ts +25 -13
  88. package/dist/esm/instances/Collection/types.d.ts.map +1 -1
  89. package/dist/esm/instances/Collection/types.js.map +1 -1
  90. package/dist/esm/instances/Model/types.d.ts +83 -0
  91. package/dist/esm/instances/Model/types.d.ts.map +1 -1
  92. package/dist/esm/instances/Model/types.js.map +1 -1
  93. package/dist/esm/instances/ModelCategory/index.d.ts +2 -2
  94. package/dist/esm/instances/ModelCategory/index.d.ts.map +1 -1
  95. package/dist/esm/instances/ModelCategory/index.js.map +1 -1
  96. package/dist/esm/instances/ModelCategory/types.d.ts +62 -10
  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.d.ts +2 -2
  100. package/dist/esm/selectors/Collection/index.d.ts.map +1 -1
  101. package/dist/esm/selectors/Collection/index.js +1 -1
  102. package/dist/esm/selectors/Collection/index.js.map +1 -1
  103. package/dist/esm/selectors/Collection/types.d.ts +82 -7
  104. package/dist/esm/selectors/Collection/types.d.ts.map +1 -1
  105. package/dist/esm/selectors/Collection/types.js.map +1 -1
  106. package/dist/esm/selectors/Entry/types.d.ts +105 -10
  107. package/dist/esm/selectors/Entry/types.d.ts.map +1 -1
  108. package/dist/esm/selectors/Entry/types.js.map +1 -1
  109. package/dist/esm/selectors/Media/index.js +2 -2
  110. package/dist/esm/selectors/Media/index.js.map +1 -1
  111. package/dist/esm/selectors/Media/types.d.ts +35 -1
  112. package/dist/esm/selectors/Media/types.d.ts.map +1 -1
  113. package/dist/esm/selectors/Media/types.js.map +1 -1
  114. package/dist/esm/selectors/Model/types.d.ts +59 -0
  115. package/dist/esm/selectors/Model/types.d.ts.map +1 -1
  116. package/dist/esm/selectors/Model/types.js.map +1 -1
  117. package/dist/esm/selectors/ModelCategory/index.js +1 -1
  118. package/dist/esm/selectors/ModelCategory/index.js.map +1 -1
  119. package/dist/esm/selectors/ModelCategory/types.d.ts +49 -6
  120. package/dist/esm/selectors/ModelCategory/types.d.ts.map +1 -1
  121. package/dist/esm/selectors/ModelCategory/types.js.map +1 -1
  122. package/dist/esm/selectors/Search/index.d.ts +2 -2
  123. package/dist/esm/selectors/Search/index.d.ts.map +1 -1
  124. package/dist/esm/selectors/Search/index.js +1 -1
  125. package/dist/esm/selectors/Search/index.js.map +1 -1
  126. package/dist/esm/selectors/Search/types.d.ts +80 -7
  127. package/dist/esm/selectors/Search/types.d.ts.map +1 -1
  128. package/dist/esm/selectors/Search/types.js.map +1 -1
  129. package/dist/esm/selectors/Singleton/types.d.ts +49 -0
  130. package/dist/esm/selectors/Singleton/types.d.ts.map +1 -1
  131. package/dist/esm/selectors/Singleton/types.js.map +1 -1
  132. package/dist/esm/types/entities.d.ts +89 -8
  133. package/dist/esm/types/entities.d.ts.map +1 -1
  134. package/dist/esm/types/entities.js.map +1 -1
  135. package/dist/esm/types/index.d.ts +99 -8
  136. package/dist/esm/types/index.d.ts.map +1 -1
  137. package/dist/esm/types/index.js.map +1 -1
  138. package/dist/esm/types/instances.d.ts +2 -2
  139. package/dist/esm/types/instances.d.ts.map +1 -1
  140. package/dist/esm/types/instances.js.map +1 -1
  141. package/dist/esm/types/selectors.d.ts +2 -2
  142. package/dist/esm/types/selectors.d.ts.map +1 -1
  143. package/dist/esm/types/selectors.js.map +1 -1
  144. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Search/index.ts"],"names":[],"mappings":";;AAQA,SAAwB,kBAAkB,CACxC,MAAuB;IAEvB,OAAO;QACL,OAAO,CACL,OAA6B;YAE7B,OAAO,MAAM,CAAC,GAAG,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAA;QAC/C,CAAC;KACF,CAAA;AACH,CAAC;AAVD,qCAUC","sourcesContent":["import {\n Entry,\n SerializedData,\n StarlightClient,\n StarlightListResponse,\n} from '../../types'\nimport { SearchEntriesOptions, SearchSelector } from './types'\n\nexport default function makeSearchSelector(\n client: StarlightClient\n): SearchSelector {\n return {\n entries<T extends SerializedData = Record<string, unknown>>(\n options: SearchEntriesOptions\n ): Promise<StarlightListResponse<Entry<T>>> {\n return client.get('/search/entries', options)\n },\n }\n}\n\nexport { SearchSelector }\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/selectors/Search/index.ts"],"names":[],"mappings":";;AAQA,SAAwB,kBAAkB,CACxC,MAAuB;IAEvB,OAAO;QACL,OAAO,CACL,OAA4B;YAE5B,OAAO,MAAM,CAAC,GAAG,CAAC,iBAAiB,oBAAO,OAAO,EAAG,CAAA;QACtD,CAAC;KACF,CAAA;AACH,CAAC;AAVD,qCAUC","sourcesContent":["import {\n Entry,\n SerializedData,\n StarlightClient,\n StarlightListResponse,\n} from '../../types'\nimport { SearchEntriesParams, SearchSelector } from './types'\n\nexport default function makeSearchSelector(\n client: StarlightClient\n): SearchSelector {\n return {\n entries<T extends SerializedData = Record<string, unknown>>(\n options: SearchEntriesParams\n ): Promise<StarlightListResponse<Entry<T>>> {\n return client.get('/search/entries', { ...options })\n },\n }\n}\n\nexport { SearchSelector, SearchEntriesParams }\n"]}
@@ -1,14 +1,87 @@
1
- import { Entry, SerializedData, StarlightListResponse } from '../../types';
2
- export declare type SearchEntriesOptions = {
3
- page?: number;
4
- limit?: number;
5
- query?: string;
1
+ import { BaseRequestParameters, Entry, SerializedData, StarlightListResponse } from '../../types';
2
+ /**
3
+ * Request parameters for searching entries.
4
+ *
5
+ * Used by {@apilink SearchSelector.entries}.
6
+ *
7
+ * @group Request Parameters
8
+ */
9
+ export interface SearchEntriesParams extends BaseRequestParameters {
10
+ /**
11
+ * A comma-separated list of models. Only entries in these models
12
+ * will be returned. If undefined, entries from all
13
+ * workspace models will be listed.
14
+ *
15
+ * For instance, to show only entries in the "posts" and "videos" categories,
16
+ * pass `'posts,videos'`.
17
+ */
6
18
  models?: string;
19
+ /**
20
+ * A comma-separated list of categories. Only entries in these categories
21
+ * will be returned. If undefined, all entries will be listed, independently
22
+ * of their categories.
23
+ *
24
+ * For instance, to show only entries in the "news" and "articles" categories,
25
+ * pass `'news,category'`.
26
+ */
7
27
  categories?: string;
28
+ /**
29
+ * Define how items will be ordered. Check this field type to see the
30
+ * allowed options.
31
+ */
8
32
  order?: 'title:asc' | 'title:desc' | 'published_at:asc' | 'published_at:desc' | 'updated_at:asc' | 'updated_at:desc';
33
+ /**
34
+ * If defined, removes the given item from the list. Useful to create "related
35
+ * posts" lists.
36
+ *
37
+ * Note: this field only accepts IDs, and not slugs. Only one ID is allowed.
38
+ */
9
39
  except?: number;
10
- };
40
+ }
41
+ /**
42
+ * A Selector that provide methods to search for content. Only entry search
43
+ * is supported for the time being.
44
+ *
45
+ * You can use a SearchSelector by accessing
46
+ * {@apilink StarlightClient.search}.
47
+ *
48
+ * @group Selectors
49
+ */
11
50
  export interface SearchSelector {
12
- entries<T extends SerializedData = Record<string, unknown>>(options?: SearchEntriesOptions): Promise<StarlightListResponse<Entry<T>>>;
51
+ /**
52
+ * Returns a {@link StarlightListResponse} with a list of
53
+ * {@apilink Entry | Entries}. By default, entries from all models are
54
+ * returned, but filtering by model can be configured.
55
+ *
56
+ * @example Listing all entries in all workspace models.
57
+ * ```ts
58
+ * import Starlight from '@starlightcms/js-sdk'
59
+ *
60
+ * const response = await Starlight.search.entries()
61
+ * ```
62
+ *
63
+ * @example Searching for "hello world" within all entries in all workspace models.
64
+ * ```ts
65
+ * import Starlight from '@starlightcms/js-sdk'
66
+ *
67
+ * const response = await Starlight.search.entries({
68
+ * query: 'hello world'
69
+ * })
70
+ * ```
71
+ *
72
+ * @example Filtering the last example within specific models.
73
+ * ```ts
74
+ * import Starlight from '@starlightcms/js-sdk'
75
+ *
76
+ * const response = await Starlight.search.entries({
77
+ * query: 'hello world',
78
+ * models: 'posts,videos,magazines'
79
+ * })
80
+ * ```
81
+ *
82
+ * @param options An optional object of request parameters. See
83
+ * {@link SearchEntriesParams} for all available options.
84
+ */
85
+ entries<T extends SerializedData = Record<string, unknown>>(options?: SearchEntriesParams): Promise<StarlightListResponse<Entry<T>>>;
13
86
  }
14
87
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Search/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAE1E,oBAAY,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EACF,WAAW,GACX,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,gBAAgB,GAChB,iBAAiB,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,CAAC,SAAS,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxD,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;CAC5C"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Search/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,EACL,cAAc,EACd,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAEpB;;;;;;GAMG;AACH,MAAM,WAAW,mBAAoB,SAAQ,qBAAqB;IAChE;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,KAAK,CAAC,EACF,WAAW,GACX,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,gBAAgB,GAChB,iBAAiB,CAAA;IACrB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,OAAO,CAAC,CAAC,SAAS,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxD,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;CAC5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/selectors/Search/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Entry, SerializedData, StarlightListResponse } from '../../types'\n\nexport type SearchEntriesOptions = {\n page?: number\n limit?: number\n query?: string\n models?: string\n categories?: string\n order?:\n | 'title:asc'\n | 'title:desc'\n | 'published_at:asc'\n | 'published_at:desc'\n | 'updated_at:asc'\n | 'updated_at:desc'\n except?: number\n}\n\nexport interface SearchSelector {\n entries<T extends SerializedData = Record<string, unknown>>(\n options?: SearchEntriesOptions\n ): Promise<StarlightListResponse<Entry<T>>>\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/selectors/Search/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n BaseRequestParameters,\n Entry,\n SerializedData,\n StarlightListResponse,\n} from '../../types'\n\n/**\n * Request parameters for searching entries.\n *\n * Used by {@apilink SearchSelector.entries}.\n *\n * @group Request Parameters\n */\nexport interface SearchEntriesParams extends BaseRequestParameters {\n /**\n * A comma-separated list of models. Only entries in these models\n * will be returned. If undefined, entries from all\n * workspace models will be listed.\n *\n * For instance, to show only entries in the \"posts\" and \"videos\" categories,\n * pass `'posts,videos'`.\n */\n models?: string\n /**\n * A comma-separated list of categories. Only entries in these categories\n * will be returned. If undefined, all entries will be listed, independently\n * of their categories.\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 | 'updated_at:asc'\n | 'updated_at:desc'\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\n/**\n * A Selector that provide methods to search for content. Only entry search\n * is supported for the time being.\n *\n * You can use a SearchSelector by accessing\n * {@apilink StarlightClient.search}.\n *\n * @group Selectors\n */\nexport interface SearchSelector {\n /**\n * Returns a {@link StarlightListResponse} with a list of\n * {@apilink Entry | Entries}. By default, entries from all models are\n * returned, but filtering by model can be configured.\n *\n * @example Listing all entries in all workspace models.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.search.entries()\n * ```\n *\n * @example Searching for \"hello world\" within all entries in all workspace models.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.search.entries({\n * query: 'hello world'\n * })\n * ```\n *\n * @example Filtering the last example within specific models.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.search.entries({\n * query: 'hello world',\n * models: 'posts,videos,magazines'\n * })\n * ```\n *\n * @param options An optional object of request parameters. See\n * {@link SearchEntriesParams} for all available options.\n */\n entries<T extends SerializedData = Record<string, unknown>>(\n options?: SearchEntriesParams\n ): Promise<StarlightListResponse<Entry<T>>>\n}\n"]}
@@ -1,6 +1,55 @@
1
1
  import { SerializedData, Singleton, StarlightItemResponse, StarlightListResponse } from '../../types';
2
+ /**
3
+ * A Selector that provide methods to list and request information on
4
+ * {@apilink Singleton | Singletons}.
5
+ *
6
+ * You can use an SingletonSelector by accessing
7
+ * {@apilink ModelInstance.singletons}.
8
+ *
9
+ * @group Selectors
10
+ */
2
11
  export interface SingletonSelector {
12
+ /**
13
+ * Returns a {@link StarlightItemResponse} with a single {@link Singleton}.
14
+ * This methods supports typing the returned Singleton by passing its data
15
+ * type as the generic type `<D>`.
16
+ *
17
+ * @example Requesting information from a singleton of slug "home".
18
+ * ```ts
19
+ * import Starlight from '@starlightcms/js-sdk'
20
+ *
21
+ * const response = await Starlight.singletons.get('home')
22
+ * ```
23
+ *
24
+ * @example Typing last example's response.
25
+ * ```ts
26
+ * import Starlight, { StringField, MediaField, VisualField } from '@starlightcms/js-sdk'
27
+ *
28
+ * type HomeFields = {
29
+ * title: StringField
30
+ * subtitle: StringField
31
+ * hero_image: MediaField
32
+ * hero_content: VisualField
33
+ * }
34
+ *
35
+ * // `response.data` will be of type Singleton<HomeFields>
36
+ * const response = await Starlight.singletons.get<HomeFields>('home')
37
+ * ```
38
+ * @typeParam D - The type of the returned Singleton's `data` property.
39
+ * @param slug The singleton slug.
40
+ */
3
41
  get<D extends SerializedData>(slug: string): Promise<StarlightItemResponse<Singleton<D>>>;
42
+ /**
43
+ * Returns a {@link StarlightListResponse} with a list of
44
+ * {@apilink Singleton | Singletons}.
45
+ *
46
+ * @example Requesting all workspace singletons.
47
+ * ```ts
48
+ * import Starlight from '@starlightcms/js-sdk'
49
+ *
50
+ * const response = await Starlight.singletons.list()
51
+ * ```
52
+ */
4
53
  list(): Promise<StarlightListResponse<Singleton<Record<string, unknown>>>>;
5
54
  }
6
55
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Singleton/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,SAAS,EACT,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAEpB,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,CAAC,SAAS,cAAc,EAC1B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAC/C,IAAI,IAAI,OAAO,CAAC,qBAAqB,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;CAC3E"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/selectors/Singleton/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,SAAS,EACT,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAEpB;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,GAAG,CAAC,CAAC,SAAS,cAAc,EAC1B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAE/C;;;;;;;;;;OAUG;IACH,IAAI,IAAI,OAAO,CAAC,qBAAqB,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;CAC3E"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/selectors/Singleton/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n SerializedData,\n Singleton,\n StarlightItemResponse,\n StarlightListResponse,\n} from '../../types'\n\nexport interface SingletonSelector {\n get<D extends SerializedData>(\n slug: string\n ): Promise<StarlightItemResponse<Singleton<D>>>\n list(): Promise<StarlightListResponse<Singleton<Record<string, unknown>>>>\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/selectors/Singleton/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n SerializedData,\n Singleton,\n StarlightItemResponse,\n StarlightListResponse,\n} from '../../types'\n\n/**\n * A Selector that provide methods to list and request information on\n * {@apilink Singleton | Singletons}.\n *\n * You can use an SingletonSelector by accessing\n * {@apilink ModelInstance.singletons}.\n *\n * @group Selectors\n */\nexport interface SingletonSelector {\n /**\n * Returns a {@link StarlightItemResponse} with a single {@link Singleton}.\n * This methods supports typing the returned Singleton by passing its data\n * type as the generic type `<D>`.\n *\n * @example Requesting information from a singleton of slug \"home\".\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.singletons.get('home')\n * ```\n *\n * @example Typing last example's response.\n * ```ts\n * import Starlight, { StringField, MediaField, VisualField } from '@starlightcms/js-sdk'\n *\n * type HomeFields = {\n * title: StringField\n * subtitle: StringField\n * hero_image: MediaField\n * hero_content: VisualField\n * }\n *\n * // `response.data` will be of type Singleton<HomeFields>\n * const response = await Starlight.singletons.get<HomeFields>('home')\n * ```\n * @typeParam D - The type of the returned Singleton's `data` property.\n * @param slug The singleton slug.\n */\n get<D extends SerializedData>(\n slug: string\n ): Promise<StarlightItemResponse<Singleton<D>>>\n\n /**\n * Returns a {@link StarlightListResponse} with a list of\n * {@apilink Singleton | Singletons}.\n *\n * @example Requesting all workspace singletons.\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.singletons.list()\n * ```\n */\n list(): Promise<StarlightListResponse<Singleton<Record<string, unknown>>>>\n}\n"]}
@@ -45,7 +45,8 @@ export interface MediaObject extends StarlightEntity {
45
45
  description?: string;
46
46
  }
47
47
  /**
48
- * Represents an Author entity returned by the API.
48
+ * Represents an Author entity returned by the API. Authors are returned in
49
+ * {@link Entry} requests.
49
50
  *
50
51
  * @group API Entities
51
52
  */
@@ -64,20 +65,97 @@ export interface Model extends StarlightEntity {
64
65
  entry_count?: number;
65
66
  }
66
67
  /**
67
- * Represents content data returned by either an Entry or
68
- * Singleton entity from the API.
68
+ * Represents content data returned by either an {@link Entry} or
69
+ * {@link Singleton} entity from the API.
70
+ *
71
+ * This is a utility type used internally by the SDK and you don't
72
+ * need to use it. Its purpose is to constraint Entry and Singleton
73
+ * data to the shape of a JS object.
74
+ *
75
+ * @category Internal Types
69
76
  */
70
77
  export declare type SerializedData = Record<string, unknown> | undefined;
71
78
  /**
72
79
  * Utility type that creates a string map of all fields of the given
73
- * SerializedData type with the `field` suffix. This is only useful to create
74
- * request methods that support field querying using the "field:foo" syntax.
80
+ * SerializedData type with the `field:` prefix. This syntax allows to filter
81
+ * specific fields when listing {@apilink Entry | Entries}:
75
82
  *
76
- * @internal
83
+ * - Text fields can be filtered by a string query. This works just like
84
+ * passing a `query` parameter, but it only applies to one field.
85
+ * - Boolean fields can be filtered by "true" or "false".
86
+ *
87
+ * If a request uses this type, it means that this syntax can be used in their
88
+ * parameters:
89
+ *
90
+ * ```ts
91
+ * import Starlight from '@starlightcms/js-sdk'
92
+ *
93
+ * const response = await Starlight.posts.entries.list({
94
+ * // EntrySelector.list() supports the "field:foo" syntax:
95
+ * 'field:content': 'hello world',
96
+ * 'field:is_featured': true,
97
+ *
98
+ * // EntrySelector.list() also support other parameters,
99
+ * // which are passed in this object too:
100
+ * page: 42,
101
+ * limit: 20,
102
+ * })
103
+ * ```
104
+ *
105
+ * @remark
106
+ *
107
+ * The information below is only useful for SDK maintainers.
108
+ *
109
+ * This type receives a {@link SerializedData}-like structure, like an object.
110
+ * For instance, for an {@link Entry} with fields "content" and "summary",
111
+ * the generated type would look like this:
112
+ *
113
+ * ```ts
114
+ * type GeneratedType = {
115
+ * 'field:content'?: string
116
+ * 'field:summary'?: string
117
+ * }
118
+ * ```
119
+ *
120
+ * However, note that QueryableFields receive a {@link SerializedData}, not an
121
+ * {@link Entry}:
122
+ *
123
+ * ```ts
124
+ * import { VisualField, StringField } from '@starlightcms/js-sdk'
125
+ *
126
+ * type EntryFields = {
127
+ * content: VisualField
128
+ * summary: StringField
129
+ * }
130
+ *
131
+ * type MyEntry = Entry<EntryFields>
132
+ *
133
+ * // Error TS2344: Type does not satisfy the constraint 'SerializedData'
134
+ * type GeneratedType = QueryableFields<MyEntry>
135
+ *
136
+ * // Works!
137
+ * type GeneratedType = QueryableFields<EntryFields>
138
+ * ```
139
+ *
140
+ * This type is only useful to request methods that support
141
+ * field querying using the "field:foo" syntax.
142
+ *
143
+ * @category Internal Types
77
144
  */
78
- export declare type ModelFieldOptions<D extends SerializedData> = {
79
- [K in keyof D as `field:${string & K}`]?: string;
145
+ export declare type QueryableFields<D extends SerializedData> = {
146
+ [K in keyof D as `field:${string & K}`]?: string | boolean;
80
147
  };
148
+ /**
149
+ * Utility type that return {@link QueryableFields} if the given type T
150
+ * is an {@link Entry} or a {@link Singleton}, but generates an empty object
151
+ * otherwise.
152
+ *
153
+ * Fun fact: internally, Entries and Singletons have parent Models,
154
+ * which is why they are called "modelables" here.
155
+ *
156
+ * @category Internal Types
157
+ */
158
+ export declare type WithQueryableFieldsOnModelables<T> = T extends Entry<never> | Singleton<never> ? QueryableFields<T['data']> : never;
81
159
  /**
82
160
  * Represents an Entry entity returned by the API.
83
161
  *
@@ -196,6 +274,9 @@ export declare type CollectionTypeMapper<T extends CollectionEntityTypes> = T ex
196
274
  /**
197
275
  * Represents a Collection entity returned by the API.
198
276
  *
277
+ * You can request collections using a {@link CollectionInstance} or a
278
+ * {@link CollectionSelector}.
279
+ *
199
280
  * @group API Entities
200
281
  */
201
282
  export interface Collection<T extends CollectionTypes = string> extends StarlightEntity {
@@ -1 +1 @@
1
- {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../src/types/entities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,UAAU,eAAe;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAc,SAAQ,eAAe;IACpD,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAU,SAAQ,eAAe;IAChD,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,SAAS,EAAE,CAAA;IAClB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;GAIG;AACH,MAAM,WAA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,GAAG,CAAC,GAChB,OAAO,GACP,CAAC,SAAS,SAAS,CAAC,GAAG,CAAC,GACxB,WAAW,GACX,CAAC,SAAS,WAAW,GACrB,OAAO,GACP,MAAM,CAAA;AAEZ;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,eAAe,GAAG,MAAM,CAC5D,SAAQ,eAAe;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,CAAC,CAAA;IACP,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;GAEG;AACH,aAAK,aAAa,GACd,KAAK,CAAC,KAAK,CAAC,GACZ,SAAS,CAAC,KAAK,CAAC,GAChB,WAAW,GACX,UAAU,GACV,OAAO,CAAA;AAEX;;;;GAIG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,aAAa;IAC/C;;;;OAIG;IACH,IAAI,EAAE,CAAC,SAAS,KAAK,CAAC,KAAK,CAAC,GACxB,OAAO,GACP,CAAC,SAAS,SAAS,CAAC,KAAK,CAAC,GAC1B,WAAW,GACX,CAAC,SAAS,WAAW,GACrB,OAAO,GACP,CAAC,SAAS,UAAU,GACpB,YAAY,GACZ,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,CAAC,CAAA;CACV"}
@@ -1 +1 @@
1
- {"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../src/types/entities.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Base interface used by all entities returned by the API.\n *\n * @internal\n */\ninterface StarlightEntity {\n id: number\n created_at: string\n updated_at?: string\n}\n\n/**\n * Represents a Model Category entity returned by the API.\n *\n * @group API Entities\n */\nexport interface ModelCategory extends StarlightEntity {\n title: string\n slug: string\n entry_count?: number\n}\n\n/**\n * Represents a Media File entity returned by the API.\n *\n * @group API Entities\n */\nexport interface MediaFile extends StarlightEntity {\n variation: string\n path: string\n mime: string\n background_color?: string\n filesize: number\n meta?: Record<string, unknown>\n}\n\n/**\n * Represents a Media Object entity returned by the API.\n *\n * @group API Entities\n */\nexport interface MediaObject extends StarlightEntity {\n name: string\n extension: string\n mime: string\n files: MediaFile[]\n alt?: string\n description?: string\n}\n\n/**\n * Represents an Author entity returned by the API.\n *\n * @group API Entities\n */\nexport interface Author {\n id: number\n name: string\n}\n\n/**\n * Represents a Model entity returned by the API.\n *\n * @group API Entities\n */\nexport interface Model extends StarlightEntity {\n title: string\n slug: string\n entry_count?: number\n}\n\n/**\n * Represents content data returned by either an Entry or\n * Singleton entity from the API.\n */\nexport type SerializedData = Record<string, unknown> | undefined\n\n/**\n * Utility type that creates a string map of all fields of the given\n * SerializedData type with the `field` suffix. This is only useful to create\n * request methods that support field querying using the \"field:foo\" syntax.\n *\n * @internal\n */\nexport type ModelFieldOptions<D extends SerializedData> = {\n [K in keyof D as `field:${string & K}`]?: string\n}\n\n/**\n * Represents an Entry entity returned by the API.\n *\n * An Entry's `data` field can be further typed by passing an object-like\n * structure as the D generic type. This is useful to provide type-safety to\n * your application, since the `data` field is a generic JS object by default.\n *\n * It's recommended to use the Field types provided by this SDK to type your\n * entities using a type definition file on your project. For instance:\n *\n * ```ts\n * // starlight.d.ts file\n * import { VisualField, MediaField } from '@starlightcms/js-sdk'\n *\n * type PostFields = {\n * featured_image: MediaField\n * content: VisualField\n * }\n *\n * declare module '@starlightcms/js-sdk' {\n * export interface DefaultModelDefinition {\n * posts: PostFields\n * }\n * }\n * ```\n *\n * You can place this type definition file anywhere in your repository, but it's\n * good practice to place it at the same level as your root index.ts file. Then,\n * in your files, all SDK calls will correctly type `posts`:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // response type will be StarlightItemResponse<Entry<PostFields>> on request success\n * const response = await Starlight.posts.entries.get('hello-world')\n *\n * // helloWorld type is Entry<PostFields>\n * const helloWorld = response.data\n * ```\n *\n * See {@apilink DefaultModelDefinition} for more info.\n *\n * @group API Entities\n */\nexport interface Entry<D extends SerializedData>\n extends Omit<StarlightEntity, 'created_at'> {\n title: string\n slug: string\n data: D\n author: Author\n model?: Model\n category: ModelCategory | null\n published_at: string | null\n}\n\n/**\n * Represents a Singleton entity returned by the API.\n *\n * A Singleton's `data` field can be further typed by passing an object-like\n * structure as the D generic type. This is useful to provide type-safety to\n * your application, since the `data` field is a generic JS object by default.\n *\n * It's recommended to use the Field types provided by this SDK to type your\n * Singletons. For instance:\n *\n * ```ts\n * import { StringField, VisualField, MediaField } from '@starlightcms/js-sdk'\n *\n * type HomeFields = {\n * site_title: StringField\n * hero_image: MediaField\n * hero_content: VisualField\n * }\n *\n * // response type will be StarlightItemResponse<Singleton<HomeFields>> on request success\n * const response = Starlight.singletons.get<HomeFields>('home')\n *\n * // home type is Singleton<HomeFields>\n * const home = response.data\n * ```\n *\n * You could also place all your Singleton field types in the same type\n * definition file used to configure Entry fields, which makes it easier to\n * import these types in other files on your project. See\n * {@apilink DefaultModelDefinition} for more info.\n *\n * @group API Entities\n */\nexport interface Singleton<D extends SerializedData>\n extends Omit<StarlightEntity, 'created_at'> {\n title: string\n slug: string\n data: D\n published_at: string | null\n}\n\n/**\n * Currently supported Collection types. This type is mainly used to provide\n * autocompletion on IDEs, since it lets users use any string as well as the\n * known supported types.\n *\n * @internal\n */\nexport type CollectionTypes = 'entry' | 'singleton' | 'media' | string\n\n/**\n * Currently supported Collection entities. This type is mainly used to infer\n * the collection type string (see {@link CollectionTypes}) from the type of\n * entity that that Collection holds.\n *\n * @internal\n */\nexport type CollectionEntityTypes =\n | Entry<never>\n | Singleton<never>\n | MediaObject\n | unknown\n\n/**\n * Infers a Collection type from an entity type. See {@link CollectionTypes} and\n * {@link CollectionEntityTypes} to know more.\n *\n * @internal\n */\nexport type CollectionTypeMapper<T extends CollectionEntityTypes> =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends Entry<any>\n ? 'entry'\n : T extends Singleton<any> // eslint-disable-line @typescript-eslint/no-explicit-any\n ? 'singleton'\n : T extends MediaObject\n ? 'media'\n : string\n\n/**\n * Represents a Collection entity returned by the API.\n *\n * @group API Entities\n */\nexport interface Collection<T extends CollectionTypes = string>\n extends StarlightEntity {\n title: string\n slug: string\n type: T\n item_count?: number\n}\n\n/**\n * Currently supported Relation types.\n */\ntype RelationTypes =\n | Entry<never>\n | Singleton<never>\n | MediaObject\n | Collection\n | unknown\n\n/**\n * Represents a Relation entity returned by the API.\n *\n * @group API Entities\n */\nexport interface Relation<T extends RelationTypes> {\n /**\n * The relation type, which is always a string. If the `object` field of this\n * Relation is an Entry, type will be `entry`, if it's a Singleton, type will\n * be `singleton`, and so on.\n */\n type: T extends Entry<never>\n ? 'entry'\n : T extends Singleton<never>\n ? 'singleton'\n : T extends MediaObject\n ? 'media'\n : T extends Collection\n ? 'collection'\n : string\n id: number\n object: T\n}\n"]}
1
+ {"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../src/types/entities.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Base interface used by all entities returned by the API.\n *\n * @internal\n */\ninterface StarlightEntity {\n id: number\n created_at: string\n updated_at?: string\n}\n\n/**\n * Represents a Model Category entity returned by the API.\n *\n * @group API Entities\n */\nexport interface ModelCategory extends StarlightEntity {\n title: string\n slug: string\n entry_count?: number\n}\n\n/**\n * Represents a Media File entity returned by the API.\n *\n * @group API Entities\n */\nexport interface MediaFile extends StarlightEntity {\n variation: string\n path: string\n mime: string\n background_color?: string\n filesize: number\n meta?: Record<string, unknown>\n}\n\n/**\n * Represents a Media Object entity returned by the API.\n *\n * @group API Entities\n */\nexport interface MediaObject extends StarlightEntity {\n name: string\n extension: string\n mime: string\n files: MediaFile[]\n alt?: string\n description?: string\n}\n\n/**\n * Represents an Author entity returned by the API. Authors are returned in\n * {@link Entry} requests.\n *\n * @group API Entities\n */\nexport interface Author {\n id: number\n name: string\n}\n\n/**\n * Represents a Model entity returned by the API.\n *\n * @group API Entities\n */\nexport interface Model extends StarlightEntity {\n title: string\n slug: string\n entry_count?: number\n}\n\n/**\n * Represents content data returned by either an {@link Entry} or\n * {@link Singleton} entity from the API.\n *\n * This is a utility type used internally by the SDK and you don't\n * need to use it. Its purpose is to constraint Entry and Singleton\n * data to the shape of a JS object.\n *\n * @category Internal Types\n */\nexport type SerializedData = Record<string, unknown> | undefined\n\n/**\n * Utility type that creates a string map of all fields of the given\n * SerializedData type with the `field:` prefix. This syntax allows to filter\n * specific fields when listing {@apilink Entry | Entries}:\n *\n * - Text fields can be filtered by a string query. This works just like\n * passing a `query` parameter, but it only applies to one field.\n * - Boolean fields can be filtered by \"true\" or \"false\".\n *\n * If a request uses this type, it means that this syntax can be used in their\n * parameters:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * const response = await Starlight.posts.entries.list({\n * // EntrySelector.list() supports the \"field:foo\" syntax:\n * 'field:content': 'hello world',\n * 'field:is_featured': true,\n *\n * // EntrySelector.list() also support other parameters,\n * // which are passed in this object too:\n * page: 42,\n * limit: 20,\n * })\n * ```\n *\n * @remark\n *\n * The information below is only useful for SDK maintainers.\n *\n * This type receives a {@link SerializedData}-like structure, like an object.\n * For instance, for an {@link Entry} with fields \"content\" and \"summary\",\n * the generated type would look like this:\n *\n * ```ts\n * type GeneratedType = {\n * 'field:content'?: string\n * 'field:summary'?: string\n * }\n * ```\n *\n * However, note that QueryableFields receive a {@link SerializedData}, not an\n * {@link Entry}:\n *\n * ```ts\n * import { VisualField, StringField } from '@starlightcms/js-sdk'\n *\n * type EntryFields = {\n * content: VisualField\n * summary: StringField\n * }\n *\n * type MyEntry = Entry<EntryFields>\n *\n * // Error TS2344: Type does not satisfy the constraint 'SerializedData'\n * type GeneratedType = QueryableFields<MyEntry>\n *\n * // Works!\n * type GeneratedType = QueryableFields<EntryFields>\n * ```\n *\n * This type is only useful to request methods that support\n * field querying using the \"field:foo\" syntax.\n *\n * @category Internal Types\n */\nexport type QueryableFields<D extends SerializedData> = {\n [K in keyof D as `field:${string & K}`]?: string | boolean\n}\n\n/**\n * Utility type that return {@link QueryableFields} if the given type T\n * is an {@link Entry} or a {@link Singleton}, but generates an empty object\n * otherwise.\n *\n * Fun fact: internally, Entries and Singletons have parent Models,\n * which is why they are called \"modelables\" here.\n *\n * @category Internal Types\n */\nexport type WithQueryableFieldsOnModelables<T> = T extends\n | Entry<never>\n | Singleton<never>\n ? QueryableFields<T['data']>\n : never\n\n/**\n * Represents an Entry entity returned by the API.\n *\n * An Entry's `data` field can be further typed by passing an object-like\n * structure as the D generic type. This is useful to provide type-safety to\n * your application, since the `data` field is a generic JS object by default.\n *\n * It's recommended to use the Field types provided by this SDK to type your\n * entities using a type definition file on your project. For instance:\n *\n * ```ts\n * // starlight.d.ts file\n * import { VisualField, MediaField } from '@starlightcms/js-sdk'\n *\n * type PostFields = {\n * featured_image: MediaField\n * content: VisualField\n * }\n *\n * declare module '@starlightcms/js-sdk' {\n * export interface DefaultModelDefinition {\n * posts: PostFields\n * }\n * }\n * ```\n *\n * You can place this type definition file anywhere in your repository, but it's\n * good practice to place it at the same level as your root index.ts file. Then,\n * in your files, all SDK calls will correctly type `posts`:\n *\n * ```ts\n * import Starlight from '@starlightcms/js-sdk'\n *\n * // response type will be StarlightItemResponse<Entry<PostFields>> on request success\n * const response = await Starlight.posts.entries.get('hello-world')\n *\n * // helloWorld type is Entry<PostFields>\n * const helloWorld = response.data\n * ```\n *\n * See {@apilink DefaultModelDefinition} for more info.\n *\n * @group API Entities\n */\nexport interface Entry<D extends SerializedData>\n extends Omit<StarlightEntity, 'created_at'> {\n title: string\n slug: string\n data: D\n author: Author\n model?: Model\n category: ModelCategory | null\n published_at: string | null\n}\n\n/**\n * Represents a Singleton entity returned by the API.\n *\n * A Singleton's `data` field can be further typed by passing an object-like\n * structure as the D generic type. This is useful to provide type-safety to\n * your application, since the `data` field is a generic JS object by default.\n *\n * It's recommended to use the Field types provided by this SDK to type your\n * Singletons. For instance:\n *\n * ```ts\n * import { StringField, VisualField, MediaField } from '@starlightcms/js-sdk'\n *\n * type HomeFields = {\n * site_title: StringField\n * hero_image: MediaField\n * hero_content: VisualField\n * }\n *\n * // response type will be StarlightItemResponse<Singleton<HomeFields>> on request success\n * const response = Starlight.singletons.get<HomeFields>('home')\n *\n * // home type is Singleton<HomeFields>\n * const home = response.data\n * ```\n *\n * You could also place all your Singleton field types in the same type\n * definition file used to configure Entry fields, which makes it easier to\n * import these types in other files on your project. See\n * {@apilink DefaultModelDefinition} for more info.\n *\n * @group API Entities\n */\nexport interface Singleton<D extends SerializedData>\n extends Omit<StarlightEntity, 'created_at'> {\n title: string\n slug: string\n data: D\n published_at: string | null\n}\n\n/**\n * Currently supported Collection types. This type is mainly used to provide\n * autocompletion on IDEs, since it lets users use any string as well as the\n * known supported types.\n *\n * @internal\n */\nexport type CollectionTypes = 'entry' | 'singleton' | 'media' | string\n\n/**\n * Currently supported Collection entities. This type is mainly used to infer\n * the collection type string (see {@link CollectionTypes}) from the type of\n * entity that that Collection holds.\n *\n * @internal\n */\nexport type CollectionEntityTypes =\n | Entry<never>\n | Singleton<never>\n | MediaObject\n | unknown\n\n/**\n * Infers a Collection type from an entity type. See {@link CollectionTypes} and\n * {@link CollectionEntityTypes} to know more.\n *\n * @internal\n */\nexport type CollectionTypeMapper<T extends CollectionEntityTypes> =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends Entry<any>\n ? 'entry'\n : T extends Singleton<any> // eslint-disable-line @typescript-eslint/no-explicit-any\n ? 'singleton'\n : T extends MediaObject\n ? 'media'\n : string\n\n/**\n * Represents a Collection entity returned by the API.\n *\n * You can request collections using a {@link CollectionInstance} or a\n * {@link CollectionSelector}.\n *\n * @group API Entities\n */\nexport interface Collection<T extends CollectionTypes = string>\n extends StarlightEntity {\n title: string\n slug: string\n type: T\n item_count?: number\n}\n\n/**\n * Currently supported Relation types.\n */\ntype RelationTypes =\n | Entry<never>\n | Singleton<never>\n | MediaObject\n | Collection\n | unknown\n\n/**\n * Represents a Relation entity returned by the API.\n *\n * @group API Entities\n */\nexport interface Relation<T extends RelationTypes> {\n /**\n * The relation type, which is always a string. If the `object` field of this\n * Relation is an Entry, type will be `entry`, if it's a Singleton, type will\n * be `singleton`, and so on.\n */\n type: T extends Entry<never>\n ? 'entry'\n : T extends Singleton<never>\n ? 'singleton'\n : T extends MediaObject\n ? 'media'\n : T extends Collection\n ? 'collection'\n : string\n id: number\n object: T\n}\n"]}
@@ -14,14 +14,36 @@ export * from './selectors';
14
14
  /**
15
15
  * This is a utility type that allows any string to be used as a URL, but
16
16
  * provides a default one which can be used by IDEs to provide auto-completion.
17
+ * The default URL points to version 2 of the Query API.
17
18
  */
18
19
  export declare type BaseUrl = 'https://query.starlight.sh/v2' | string;
19
20
  /**
21
+ * The available options to configure a {@link StarlightClient}.
22
+ *
23
+ * `workspace` is required when creating new clients or configuring the
24
+ * {@apilink default | default client}.
20
25
  * @group Client
21
26
  */
22
27
  export declare type StarlightConfig = {
28
+ /**
29
+ * The ID of the workspace that the client should use to request data.
30
+ *
31
+ * Note: the current APIs only support using workspace IDs as identifiers,
32
+ * and **not** slugs. Slug support will be added in the future. You can find
33
+ * the workspace ID in the left-side menu on the Starlight interface or below
34
+ * the workspace name in the workspace list.
35
+ */
23
36
  workspace?: string;
37
+ /**
38
+ * The Starlight Query API URL, including the version, and without a trailing
39
+ * slash. Defaults to the production Query API URL.
40
+ *
41
+ * You only need to set this if you're not using Starlight's production APIs.
42
+ */
24
43
  baseUrl?: BaseUrl;
44
+ /**
45
+ * When true, logs all API requests in the console. Defaults to false.
46
+ */
25
47
  debug?: boolean;
26
48
  };
27
49
  /**
@@ -66,10 +88,11 @@ export interface StarlightClient<D extends WorkspaceModelDefinition = DefaultMod
66
88
  * const rootElement = document.getElementById("root")
67
89
  * const root = createRoot(rootElement)
68
90
  *
69
- * root.render(<App />)
91
+ * root.render(<MyApp />)
70
92
  * ```
71
93
  *
72
- * @param config A configuration object. Required.
94
+ * @param config A configuration object. See {@link StarlightConfig} to view
95
+ * all available options.
73
96
  * @category Other Methods
74
97
  */
75
98
  configure(config: StarlightConfig): void;
@@ -93,7 +116,7 @@ export interface StarlightClient<D extends WorkspaceModelDefinition = DefaultMod
93
116
  */
94
117
  getBaseUrl(): string;
95
118
  /**
96
- * Returns a Promise that results in a response or throws an StarlightError.
119
+ * Returns a Promise that results in a response or throws a StarlightError.
97
120
  * The response will be the parsed JSON data sent by the API.
98
121
  *
99
122
  * This method is used internally by all Selectors and Instances to request
@@ -120,7 +143,7 @@ export interface StarlightClient<D extends WorkspaceModelDefinition = DefaultMod
120
143
  get<T = Record<string, unknown>>(path: string, params?: Record<string, string | number | boolean | undefined>, options?: RequestInit): Promise<T>;
121
144
  /**
122
145
  * Returns a {@link DynamicModelSelector}, which is a {@link ModelSelector}
123
- * with support for creating {@link ModelInstance}s using the dynamic syntax.
146
+ * with support for creating {@apilink ModelInstance | ModelInstances} using the dynamic syntax.
124
147
  *
125
148
  * This is an accessor, which means that it should be used just like a common
126
149
  * object parameter. For instance:
@@ -139,7 +162,7 @@ export interface StarlightClient<D extends WorkspaceModelDefinition = DefaultMod
139
162
  /**
140
163
  * Returns a {@link DynamicModelInstance}, which is a
141
164
  * {@link ModelInstance} with support for creating
142
- * {@link ModelCategoryInstance}s using the dynamic syntax. For instance:
165
+ * {@apilink ModelCategoryInstance | ModelCategoryInstances} using the dynamic syntax. For instance:
143
166
  *
144
167
  * ```ts
145
168
  * import Starlight from '@starlightcms/js-sdk'
@@ -172,7 +195,7 @@ export interface StarlightClient<D extends WorkspaceModelDefinition = DefaultMod
172
195
  /**
173
196
  * Returns a {@link DynamicCollectionSelector}, which is a
174
197
  * {@link CollectionSelector} with support for creating
175
- * {@link CollectionInstance}s using the dynamic syntax.
198
+ * {@apilink CollectionInstance | CollectionInstances} using the dynamic syntax.
176
199
  *
177
200
  * This is an accessor, which means that it should be used just like a common
178
201
  * object parameter. For instance:
@@ -199,6 +222,16 @@ export interface StarlightClient<D extends WorkspaceModelDefinition = DefaultMod
199
222
  *
200
223
  * See {@link CollectionInstance} for more info.
201
224
  *
225
+ * @example Typing the returned CollectionInstance.
226
+ * ```ts
227
+ * import Starlight, { MediaObject } from '@starlightcms/js-sdk'
228
+ *
229
+ * const response = await Starlight.collection<MediaObject>('carousel-images').items()
230
+ * ```
231
+ *
232
+ * @typeParam T - The type of entity this Collection holds. You can pass this
233
+ * type parameter to correctly type the response of the
234
+ * {@apilink CollectionInstance.items} method.
202
235
  * @category Instance Methods
203
236
  */
204
237
  collection<T extends CollectionEntityTypes>(slug: string | number): CollectionInstance<T>;
@@ -239,8 +272,12 @@ export interface StarlightClient<D extends WorkspaceModelDefinition = DefaultMod
239
272
  }
240
273
  /**
241
274
  * This type adds support for the dynamic syntax to the StarlightClient
242
- * interface, which allows users to create {@link ModelInstance}s dynamically.
243
- * See {@link StarlightClient} to learn which methods it provides.
275
+ * interface, which allows users to create
276
+ * {@apilink DynamicModelInstance| DynamicModelInstances} dynamically.
277
+ * See {@link StarlightClient} to learn which methods it provides. Also see
278
+ * {@doclink requests-and-responses#dynamic-syntax | Dynamic Instances}
279
+ * documentation to learn more about the dynamic syntax.
280
+ *
244
281
  *
245
282
  * This allows TypeScript to correctly type all models defined by the user
246
283
  * in the DefaultModelDefinition type, aside from letting the user using any
@@ -469,4 +506,58 @@ export interface DefaultModelDefinition extends WorkspaceModelDefinition {
469
506
  export interface WorkspaceModelDefinition {
470
507
  [slug: string]: SerializedData;
471
508
  }
509
+ /**
510
+ * Request parameters used by most SDK `list()` methods.
511
+ *
512
+ * @group Request Parameters
513
+ */
514
+ export interface BaseRequestParameters {
515
+ [key: string]: string | number | boolean | undefined;
516
+ /**
517
+ * The page requested.
518
+ */
519
+ page?: number;
520
+ /**
521
+ * The limit of items per page.
522
+ */
523
+ limit?: number;
524
+ /**
525
+ * A search query string.
526
+ *
527
+ * For instance, searching for "out" will match both "check out!" and
528
+ * "about us". Search is not case-sensitive.
529
+ */
530
+ query?: string;
531
+ }
532
+ /**
533
+ * Request parameters used by most SDK methods that support advanced querying.
534
+ *
535
+ * @group Request Parameters
536
+ */
537
+ export interface QueryableRequestParameters {
538
+ /**
539
+ * A search query string that matches a specific word within boundaries.
540
+ * Search is not case-sensitive.
541
+ *
542
+ * For instance, searching for "phone" will match "This is my phone!"
543
+ * but won't match "This is my telephone!".
544
+ */
545
+ 'query:word'?: string;
546
+ /**
547
+ * A comma-separated list of fields to look up on when searching using
548
+ * `query` or `query:word`. If undefined, all text fields will be searched on,
549
+ * including Visual Editor fields. Search is not case-sensitive.
550
+ *
551
+ * For instance, to limit search on the "content" and "summary" fields of a
552
+ * model, pass `'content,summary'`.
553
+ */
554
+ fields?: string;
555
+ /**
556
+ * If defined, removes the given item from the list. Useful to create "related
557
+ * posts" lists.
558
+ *
559
+ * Note: this field only accepts IDs, and not slugs. Only one ID is allowed.
560
+ */
561
+ except?: number;
562
+ }
472
563
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAE3B;;;GAGG;AACH,oBAAY,OAAO,GAAG,+BAA+B,GAAG,MAAM,CAAA;A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