@starlightcms/js-sdk 0.9.0 → 0.11.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/README.md +54 -0
- package/dist/cjs/client.d.ts +41 -2
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +39 -0
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/errors.d.ts +35 -0
- package/dist/cjs/errors.d.ts.map +1 -1
- package/dist/cjs/errors.js +7 -0
- package/dist/cjs/errors.js.map +1 -1
- package/dist/cjs/index.d.ts +22 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/instances/Collection/index.d.ts +4 -4
- package/dist/cjs/instances/Collection/index.d.ts.map +1 -1
- package/dist/cjs/instances/Collection/index.js.map +1 -1
- package/dist/cjs/instances/Collection/types.d.ts +68 -12
- package/dist/cjs/instances/Collection/types.d.ts.map +1 -1
- package/dist/cjs/instances/Collection/types.js +1 -0
- package/dist/cjs/instances/Collection/types.js.map +1 -1
- package/dist/cjs/instances/Model/index.d.ts +3 -3
- package/dist/cjs/instances/Model/index.d.ts.map +1 -1
- package/dist/cjs/instances/Model/index.js.map +1 -1
- package/dist/cjs/instances/Model/types.d.ts +86 -3
- 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 +2 -2
- package/dist/cjs/instances/ModelCategory/index.d.ts.map +1 -1
- package/dist/cjs/instances/ModelCategory/index.js.map +1 -1
- package/dist/cjs/instances/ModelCategory/types.d.ts +62 -10
- 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.d.ts +3 -3
- package/dist/cjs/selectors/Collection/index.d.ts.map +1 -1
- package/dist/cjs/selectors/Collection/index.js +1 -1
- package/dist/cjs/selectors/Collection/index.js.map +1 -1
- package/dist/cjs/selectors/Collection/types.d.ts +84 -9
- 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/types.d.ts +105 -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 +2 -2
- package/dist/cjs/selectors/Media/index.js.map +1 -1
- package/dist/cjs/selectors/Media/types.d.ts +35 -1
- 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 +3 -3
- package/dist/cjs/selectors/Model/index.js.map +1 -1
- package/dist/cjs/selectors/Model/types.d.ts +62 -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 +3 -3
- package/dist/cjs/selectors/ModelCategory/index.js +1 -1
- package/dist/cjs/selectors/ModelCategory/index.js.map +1 -1
- package/dist/cjs/selectors/ModelCategory/types.d.ts +50 -7
- 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 +2 -2
- package/dist/cjs/selectors/Search/index.d.ts.map +1 -1
- package/dist/cjs/selectors/Search/index.js +1 -1
- package/dist/cjs/selectors/Search/index.js.map +1 -1
- package/dist/cjs/selectors/Search/types.d.ts +80 -7
- 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/types.d.ts +49 -0
- 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/entities.d.ts +241 -2
- package/dist/cjs/types/entities.d.ts.map +1 -1
- package/dist/cjs/types/entities.js.map +1 -1
- package/dist/cjs/types/fields.d.ts +63 -0
- package/dist/cjs/types/fields.d.ts.map +1 -1
- package/dist/cjs/types/fields.js.map +1 -1
- package/dist/cjs/types/index.d.ts +514 -11
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/cjs/types/index.js +2 -0
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/types/instances.d.ts +4 -0
- package/dist/cjs/types/instances.d.ts.map +1 -0
- package/dist/cjs/types/instances.js +3 -0
- package/dist/cjs/types/instances.js.map +1 -0
- package/dist/cjs/types/selectors.d.ts +8 -0
- package/dist/cjs/types/selectors.d.ts.map +1 -0
- package/dist/cjs/types/selectors.js +3 -0
- package/dist/cjs/types/selectors.js.map +1 -0
- package/dist/cjs/types/visual.d.ts +69 -0
- package/dist/cjs/types/visual.d.ts.map +1 -1
- package/dist/cjs/types/visual.js.map +1 -1
- package/dist/esm/client.d.ts +41 -2
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +39 -0
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/errors.d.ts +35 -0
- package/dist/esm/errors.d.ts.map +1 -1
- package/dist/esm/errors.js +7 -0
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/index.d.ts +22 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +21 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/instances/Collection/index.d.ts +4 -4
- package/dist/esm/instances/Collection/index.d.ts.map +1 -1
- package/dist/esm/instances/Collection/index.js.map +1 -1
- package/dist/esm/instances/Collection/types.d.ts +68 -12
- package/dist/esm/instances/Collection/types.d.ts.map +1 -1
- package/dist/esm/instances/Collection/types.js +1 -0
- package/dist/esm/instances/Collection/types.js.map +1 -1
- package/dist/esm/instances/Model/index.d.ts +3 -3
- package/dist/esm/instances/Model/index.d.ts.map +1 -1
- package/dist/esm/instances/Model/index.js.map +1 -1
- package/dist/esm/instances/Model/types.d.ts +86 -3
- 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 +2 -2
- package/dist/esm/instances/ModelCategory/index.d.ts.map +1 -1
- package/dist/esm/instances/ModelCategory/index.js.map +1 -1
- package/dist/esm/instances/ModelCategory/types.d.ts +62 -10
- 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.d.ts +3 -3
- package/dist/esm/selectors/Collection/index.d.ts.map +1 -1
- package/dist/esm/selectors/Collection/index.js +1 -1
- package/dist/esm/selectors/Collection/index.js.map +1 -1
- package/dist/esm/selectors/Collection/types.d.ts +84 -9
- 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/types.d.ts +105 -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 +2 -2
- package/dist/esm/selectors/Media/index.js.map +1 -1
- package/dist/esm/selectors/Media/types.d.ts +35 -1
- 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 +3 -3
- package/dist/esm/selectors/Model/index.js.map +1 -1
- package/dist/esm/selectors/Model/types.d.ts +62 -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 +3 -3
- package/dist/esm/selectors/ModelCategory/index.js +1 -1
- package/dist/esm/selectors/ModelCategory/index.js.map +1 -1
- package/dist/esm/selectors/ModelCategory/types.d.ts +50 -7
- 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 +2 -2
- package/dist/esm/selectors/Search/index.d.ts.map +1 -1
- package/dist/esm/selectors/Search/index.js +1 -1
- package/dist/esm/selectors/Search/index.js.map +1 -1
- package/dist/esm/selectors/Search/types.d.ts +80 -7
- 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/types.d.ts +49 -0
- 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/entities.d.ts +241 -2
- package/dist/esm/types/entities.d.ts.map +1 -1
- package/dist/esm/types/entities.js.map +1 -1
- package/dist/esm/types/fields.d.ts +63 -0
- package/dist/esm/types/fields.d.ts.map +1 -1
- package/dist/esm/types/fields.js.map +1 -1
- package/dist/esm/types/index.d.ts +514 -11
- package/dist/esm/types/index.d.ts.map +1 -1
- package/dist/esm/types/index.js +2 -0
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/types/instances.d.ts +4 -0
- package/dist/esm/types/instances.d.ts.map +1 -0
- package/dist/esm/types/instances.js +2 -0
- package/dist/esm/types/instances.js.map +1 -0
- package/dist/esm/types/selectors.d.ts +8 -0
- package/dist/esm/types/selectors.d.ts.map +1 -0
- package/dist/esm/types/selectors.js +2 -0
- package/dist/esm/types/selectors.js.map +1 -0
- package/dist/esm/types/visual.d.ts +69 -0
- package/dist/esm/types/visual.d.ts.map +1 -1
- package/dist/esm/types/visual.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base interface used by all entities returned by the API.
|
|
3
|
+
*
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
1
6
|
interface StarlightEntity {
|
|
2
7
|
id: number;
|
|
3
8
|
created_at: string;
|
|
4
9
|
updated_at?: string;
|
|
5
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Represents a Model Category entity returned by the API.
|
|
13
|
+
*
|
|
14
|
+
* @group API Entities
|
|
15
|
+
*/
|
|
6
16
|
export interface ModelCategory extends StarlightEntity {
|
|
7
17
|
title: string;
|
|
8
18
|
slug: string;
|
|
9
19
|
entry_count?: number;
|
|
10
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Represents a Media File entity returned by the API.
|
|
23
|
+
*
|
|
24
|
+
* @group API Entities
|
|
25
|
+
*/
|
|
11
26
|
export interface MediaFile extends StarlightEntity {
|
|
12
27
|
variation: string;
|
|
13
28
|
path: string;
|
|
@@ -16,6 +31,11 @@ export interface MediaFile extends StarlightEntity {
|
|
|
16
31
|
filesize: number;
|
|
17
32
|
meta?: Record<string, unknown>;
|
|
18
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Represents a Media Object entity returned by the API.
|
|
36
|
+
*
|
|
37
|
+
* @group API Entities
|
|
38
|
+
*/
|
|
19
39
|
export interface MediaObject extends StarlightEntity {
|
|
20
40
|
name: string;
|
|
21
41
|
extension: string;
|
|
@@ -24,19 +44,162 @@ export interface MediaObject extends StarlightEntity {
|
|
|
24
44
|
alt?: string;
|
|
25
45
|
description?: string;
|
|
26
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Represents an Author entity returned by the API. Authors are returned in
|
|
49
|
+
* {@link Entry} requests.
|
|
50
|
+
*
|
|
51
|
+
* @group API Entities
|
|
52
|
+
*/
|
|
27
53
|
export interface Author {
|
|
28
54
|
id: number;
|
|
29
55
|
name: string;
|
|
30
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Represents a Model entity returned by the API.
|
|
59
|
+
*
|
|
60
|
+
* @group API Entities
|
|
61
|
+
*/
|
|
31
62
|
export interface Model extends StarlightEntity {
|
|
32
63
|
title: string;
|
|
33
64
|
slug: string;
|
|
34
65
|
entry_count?: number;
|
|
35
66
|
}
|
|
67
|
+
/**
|
|
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
|
|
76
|
+
*/
|
|
36
77
|
export declare type SerializedData = Record<string, unknown> | undefined;
|
|
37
|
-
|
|
38
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Utility type that creates a string map of all fields of the given
|
|
80
|
+
* SerializedData type with the `field:` prefix. This syntax allows to filter
|
|
81
|
+
* specific fields when listing {@apilink Entry | Entries}:
|
|
82
|
+
*
|
|
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
|
|
144
|
+
*/
|
|
145
|
+
export declare type QueryableFields<D extends SerializedData> = {
|
|
146
|
+
[K in keyof D as `field:${string & K}`]?: string | boolean;
|
|
39
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<Pick<T, 'data'>> : Record<string, never>;
|
|
159
|
+
/**
|
|
160
|
+
* Represents an Entry entity returned by the API.
|
|
161
|
+
*
|
|
162
|
+
* An Entry's `data` field can be further typed by passing an object-like
|
|
163
|
+
* structure as the D generic type. This is useful to provide type-safety to
|
|
164
|
+
* your application, since the `data` field is a generic JS object by default.
|
|
165
|
+
*
|
|
166
|
+
* It's recommended to use the Field types provided by this SDK to type your
|
|
167
|
+
* entities using a type definition file on your project. For instance:
|
|
168
|
+
*
|
|
169
|
+
* ```ts
|
|
170
|
+
* // starlight.d.ts file
|
|
171
|
+
* import { VisualField, MediaField } from '@starlightcms/js-sdk'
|
|
172
|
+
*
|
|
173
|
+
* type PostFields = {
|
|
174
|
+
* featured_image: MediaField
|
|
175
|
+
* content: VisualField
|
|
176
|
+
* }
|
|
177
|
+
*
|
|
178
|
+
* declare module '@starlightcms/js-sdk' {
|
|
179
|
+
* export interface DefaultModelDefinition {
|
|
180
|
+
* posts: PostFields
|
|
181
|
+
* }
|
|
182
|
+
* }
|
|
183
|
+
* ```
|
|
184
|
+
*
|
|
185
|
+
* You can place this type definition file anywhere in your repository, but it's
|
|
186
|
+
* good practice to place it at the same level as your root index.ts file. Then,
|
|
187
|
+
* in your files, all SDK calls will correctly type `posts`:
|
|
188
|
+
*
|
|
189
|
+
* ```ts
|
|
190
|
+
* import Starlight from '@starlightcms/js-sdk'
|
|
191
|
+
*
|
|
192
|
+
* // response type will be StarlightItemResponse<Entry<PostFields>> on request success
|
|
193
|
+
* const response = await Starlight.posts.entries.get('hello-world')
|
|
194
|
+
*
|
|
195
|
+
* // helloWorld type is Entry<PostFields>
|
|
196
|
+
* const helloWorld = response.data
|
|
197
|
+
* ```
|
|
198
|
+
*
|
|
199
|
+
* See {@apilink DefaultModelDefinition} for more info.
|
|
200
|
+
*
|
|
201
|
+
* @group API Entities
|
|
202
|
+
*/
|
|
40
203
|
export interface Entry<D extends SerializedData> extends Omit<StarlightEntity, 'created_at'> {
|
|
41
204
|
title: string;
|
|
42
205
|
slug: string;
|
|
@@ -46,21 +209,97 @@ export interface Entry<D extends SerializedData> extends Omit<StarlightEntity, '
|
|
|
46
209
|
category: ModelCategory | null;
|
|
47
210
|
published_at: string | null;
|
|
48
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* Represents a Singleton entity returned by the API.
|
|
214
|
+
*
|
|
215
|
+
* A Singleton's `data` field can be further typed by passing an object-like
|
|
216
|
+
* structure as the D generic type. This is useful to provide type-safety to
|
|
217
|
+
* your application, since the `data` field is a generic JS object by default.
|
|
218
|
+
*
|
|
219
|
+
* It's recommended to use the Field types provided by this SDK to type your
|
|
220
|
+
* Singletons. For instance:
|
|
221
|
+
*
|
|
222
|
+
* ```ts
|
|
223
|
+
* import { StringField, VisualField, MediaField } from '@starlightcms/js-sdk'
|
|
224
|
+
*
|
|
225
|
+
* type HomeFields = {
|
|
226
|
+
* site_title: StringField
|
|
227
|
+
* hero_image: MediaField
|
|
228
|
+
* hero_content: VisualField
|
|
229
|
+
* }
|
|
230
|
+
*
|
|
231
|
+
* // response type will be StarlightItemResponse<Singleton<HomeFields>> on request success
|
|
232
|
+
* const response = Starlight.singletons.get<HomeFields>('home')
|
|
233
|
+
*
|
|
234
|
+
* // home type is Singleton<HomeFields>
|
|
235
|
+
* const home = response.data
|
|
236
|
+
* ```
|
|
237
|
+
*
|
|
238
|
+
* You could also place all your Singleton field types in the same type
|
|
239
|
+
* definition file used to configure Entry fields, which makes it easier to
|
|
240
|
+
* import these types in other files on your project. See
|
|
241
|
+
* {@apilink DefaultModelDefinition} for more info.
|
|
242
|
+
*
|
|
243
|
+
* @group API Entities
|
|
244
|
+
*/
|
|
49
245
|
export interface Singleton<D extends SerializedData> extends Omit<StarlightEntity, 'created_at'> {
|
|
50
246
|
title: string;
|
|
51
247
|
slug: string;
|
|
52
248
|
data: D;
|
|
53
249
|
published_at: string | null;
|
|
54
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Currently supported Collection types. This type is mainly used to provide
|
|
253
|
+
* autocompletion on IDEs, since it lets users use any string as well as the
|
|
254
|
+
* known supported types.
|
|
255
|
+
*
|
|
256
|
+
* @internal
|
|
257
|
+
*/
|
|
55
258
|
export declare type CollectionTypes = 'entry' | 'singleton' | 'media' | string;
|
|
259
|
+
/**
|
|
260
|
+
* Currently supported Collection entities. This type is mainly used to infer
|
|
261
|
+
* the collection type string (see {@link CollectionTypes}) from the type of
|
|
262
|
+
* entity that that Collection holds.
|
|
263
|
+
*
|
|
264
|
+
* @internal
|
|
265
|
+
*/
|
|
266
|
+
export declare type CollectionEntityTypes = Entry<never> | Singleton<never> | MediaObject | unknown;
|
|
267
|
+
/**
|
|
268
|
+
* Infers a Collection type from an entity type. See {@link CollectionTypes} and
|
|
269
|
+
* {@link CollectionEntityTypes} to know more.
|
|
270
|
+
*
|
|
271
|
+
* @internal
|
|
272
|
+
*/
|
|
273
|
+
export declare type CollectionTypeMapper<T extends CollectionEntityTypes> = T extends Entry<any> ? 'entry' : T extends Singleton<any> ? 'singleton' : T extends MediaObject ? 'media' : string;
|
|
274
|
+
/**
|
|
275
|
+
* Represents a Collection entity returned by the API.
|
|
276
|
+
*
|
|
277
|
+
* You can request collections using a {@link CollectionInstance} or a
|
|
278
|
+
* {@link CollectionSelector}.
|
|
279
|
+
*
|
|
280
|
+
* @group API Entities
|
|
281
|
+
*/
|
|
56
282
|
export interface Collection<T extends CollectionTypes = string> extends StarlightEntity {
|
|
57
283
|
title: string;
|
|
58
284
|
slug: string;
|
|
59
285
|
type: T;
|
|
60
286
|
item_count?: number;
|
|
61
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* Currently supported Relation types.
|
|
290
|
+
*/
|
|
62
291
|
declare type RelationTypes = Entry<never> | Singleton<never> | MediaObject | Collection | unknown;
|
|
292
|
+
/**
|
|
293
|
+
* Represents a Relation entity returned by the API.
|
|
294
|
+
*
|
|
295
|
+
* @group API Entities
|
|
296
|
+
*/
|
|
63
297
|
export interface Relation<T extends RelationTypes> {
|
|
298
|
+
/**
|
|
299
|
+
* The relation type, which is always a string. If the `object` field of this
|
|
300
|
+
* Relation is an Entry, type will be `entry`, if it's a Singleton, type will
|
|
301
|
+
* be `singleton`, and so on.
|
|
302
|
+
*/
|
|
64
303
|
type: T extends Entry<never> ? 'entry' : T extends Singleton<never> ? 'singleton' : T extends MediaObject ? 'media' : T extends Collection ? 'collection' : string;
|
|
65
304
|
id: number;
|
|
66
305
|
object: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../src/types/entities.ts"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,aAAc,SAAQ,eAAe;IACpD,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,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,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,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,KAAM,SAAQ,eAAe;IAC5C,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CAC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 -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../src/types/entities.ts"],"names":[],"mappings":"","sourcesContent":["interface StarlightEntity {\n id: number\n created_at: string\n updated_at?: string\n}\n\nexport interface ModelCategory extends StarlightEntity {\n title: string\n slug: string\n entry_count?: number\n}\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\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\nexport interface Author {\n id: number\n name: string\n}\n\nexport interface Model extends StarlightEntity {\n title: string\n slug: string\n entry_count?: number\n}\n\nexport type SerializedData = Record<string, unknown> | undefined\n\nexport type
|
|
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<Pick<T, 'data'>>\n : Record<string, 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"]}
|
|
@@ -1,10 +1,73 @@
|
|
|
1
1
|
import { MediaObject, Relation } from './entities';
|
|
2
2
|
import { VisualData } from './visual';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a Boolean Field returned by the API.
|
|
5
|
+
*
|
|
6
|
+
* Field types are used to type Entry and Singleton objects when requesting
|
|
7
|
+
* them using some SDK methods. See {@apilink DefaultModelDefinition}
|
|
8
|
+
* for more info.
|
|
9
|
+
*
|
|
10
|
+
* @group Data Fields
|
|
11
|
+
*/
|
|
3
12
|
export declare type BooleanField = boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Represents a HTML Field returned by the API.
|
|
15
|
+
*
|
|
16
|
+
* Field types are used to type Entry and Singleton objects when requesting
|
|
17
|
+
* them using some SDK methods. See {@apilink DefaultModelDefinition}
|
|
18
|
+
* for more info.
|
|
19
|
+
*
|
|
20
|
+
* @group Data Fields
|
|
21
|
+
*/
|
|
4
22
|
export declare type HtmlField = string;
|
|
23
|
+
/**
|
|
24
|
+
* Represents a Media Field returned by the API.
|
|
25
|
+
*
|
|
26
|
+
* Field types are used to type Entry and Singleton objects when requesting
|
|
27
|
+
* them using some SDK methods. See {@apilink DefaultModelDefinition}
|
|
28
|
+
* for more info.
|
|
29
|
+
*
|
|
30
|
+
* @group Data Fields
|
|
31
|
+
*/
|
|
5
32
|
export declare type MediaField = MediaObject;
|
|
33
|
+
/**
|
|
34
|
+
* Represents a Relation Field returned by the API.
|
|
35
|
+
*
|
|
36
|
+
* Field types are used to type Entry and Singleton objects when requesting
|
|
37
|
+
* them using some SDK methods. See {@apilink DefaultModelDefinition}
|
|
38
|
+
* for more info.
|
|
39
|
+
*
|
|
40
|
+
* @group Data Fields
|
|
41
|
+
*/
|
|
6
42
|
export declare type RelationField<T> = Relation<T>;
|
|
43
|
+
/**
|
|
44
|
+
* Represents a String Field returned by the API.
|
|
45
|
+
*
|
|
46
|
+
* Field types are used to type Entry and Singleton objects when requesting
|
|
47
|
+
* them using some SDK methods. See {@apilink DefaultModelDefinition}
|
|
48
|
+
* for more info.
|
|
49
|
+
*
|
|
50
|
+
* @group Data Fields
|
|
51
|
+
*/
|
|
7
52
|
export declare type StringField = string;
|
|
53
|
+
/**
|
|
54
|
+
* Represents a Text Field returned by the API.
|
|
55
|
+
*
|
|
56
|
+
* Field types are used to type Entry and Singleton objects when requesting
|
|
57
|
+
* them using some SDK methods. See {@apilink DefaultModelDefinition}
|
|
58
|
+
* for more info.
|
|
59
|
+
*
|
|
60
|
+
* @group Data Fields
|
|
61
|
+
*/
|
|
8
62
|
export declare type TextField = string;
|
|
63
|
+
/**
|
|
64
|
+
* Represents a Visual Field returned by the API.
|
|
65
|
+
*
|
|
66
|
+
* Field types are used to type Entry and Singleton objects when requesting
|
|
67
|
+
* them using some SDK methods. See {@apilink DefaultModelDefinition}
|
|
68
|
+
* for more info.
|
|
69
|
+
*
|
|
70
|
+
* @group Data Fields
|
|
71
|
+
*/
|
|
9
72
|
export declare type VisualField = VisualData;
|
|
10
73
|
//# sourceMappingURL=fields.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../src/types/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC,oBAAY,YAAY,GAAG,OAAO,CAAA;AAElC,oBAAY,SAAS,GAAG,MAAM,CAAA;AAE9B,oBAAY,UAAU,GAAG,WAAW,CAAA;AAEpC,oBAAY,aAAa,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAA;AAE1C,oBAAY,WAAW,GAAG,MAAM,CAAA;AAEhC,oBAAY,SAAS,GAAG,MAAM,CAAA;AAE9B,oBAAY,WAAW,GAAG,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../src/types/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC;;;;;;;;GAQG;AACH,oBAAY,YAAY,GAAG,OAAO,CAAA;AAElC;;;;;;;;GAQG;AACH,oBAAY,SAAS,GAAG,MAAM,CAAA;AAE9B;;;;;;;;GAQG;AACH,oBAAY,UAAU,GAAG,WAAW,CAAA;AAEpC;;;;;;;;GAQG;AACH,oBAAY,aAAa,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAA;AAE1C;;;;;;;;GAQG;AACH,oBAAY,WAAW,GAAG,MAAM,CAAA;AAEhC;;;;;;;;GAQG;AACH,oBAAY,SAAS,GAAG,MAAM,CAAA;AAE9B;;;;;;;;GAQG;AACH,oBAAY,WAAW,GAAG,UAAU,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../src/types/fields.ts"],"names":[],"mappings":"","sourcesContent":["import { MediaObject, Relation } from './entities'\nimport { VisualData } from './visual'\n\nexport type BooleanField = boolean\n\nexport type HtmlField = string\n\nexport type MediaField = MediaObject\n\nexport type RelationField<T> = Relation<T>\n\nexport type StringField = string\n\nexport type TextField = string\n\nexport type VisualField = VisualData\n"]}
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../src/types/fields.ts"],"names":[],"mappings":"","sourcesContent":["import { MediaObject, Relation } from './entities'\nimport { VisualData } from './visual'\n\n/**\n * Represents a Boolean Field returned by the API.\n *\n * Field types are used to type Entry and Singleton objects when requesting\n * them using some SDK methods. See {@apilink DefaultModelDefinition}\n * for more info.\n *\n * @group Data Fields\n */\nexport type BooleanField = boolean\n\n/**\n * Represents a HTML Field returned by the API.\n *\n * Field types are used to type Entry and Singleton objects when requesting\n * them using some SDK methods. See {@apilink DefaultModelDefinition}\n * for more info.\n *\n * @group Data Fields\n */\nexport type HtmlField = string\n\n/**\n * Represents a Media Field returned by the API.\n *\n * Field types are used to type Entry and Singleton objects when requesting\n * them using some SDK methods. See {@apilink DefaultModelDefinition}\n * for more info.\n *\n * @group Data Fields\n */\nexport type MediaField = MediaObject\n\n/**\n * Represents a Relation Field returned by the API.\n *\n * Field types are used to type Entry and Singleton objects when requesting\n * them using some SDK methods. See {@apilink DefaultModelDefinition}\n * for more info.\n *\n * @group Data Fields\n */\nexport type RelationField<T> = Relation<T>\n\n/**\n * Represents a String Field returned by the API.\n *\n * Field types are used to type Entry and Singleton objects when requesting\n * them using some SDK methods. See {@apilink DefaultModelDefinition}\n * for more info.\n *\n * @group Data Fields\n */\nexport type StringField = string\n\n/**\n * Represents a Text Field returned by the API.\n *\n * Field types are used to type Entry and Singleton objects when requesting\n * them using some SDK methods. See {@apilink DefaultModelDefinition}\n * for more info.\n *\n * @group Data Fields\n */\nexport type TextField = string\n\n/**\n * Represents a Visual Field returned by the API.\n *\n * Field types are used to type Entry and Singleton objects when requesting\n * them using some SDK methods. See {@apilink DefaultModelDefinition}\n * for more info.\n *\n * @group Data Fields\n */\nexport type VisualField = VisualData\n"]}
|