andesine 0.0.1-alpha.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.
@@ -0,0 +1,458 @@
1
+ import { d as PaginationParams, e as PaginationMeta, P as Profile, J as JSONContent, C as ContentPiece, f as ContentPiecesEndpoints, g as TagsEndpoints, h as ProfileEndpoints, A as APIFetcherConfig } from './andesine.5e4b2db8.cjs';
2
+
3
+ interface ContentGroup {
4
+ /**
5
+ * Content group name
6
+ */
7
+ name: string;
8
+ /**
9
+ * Content group ID
10
+ */
11
+ id: string;
12
+ /**
13
+ * IDs of ancestor content groups, ordered from furthest to closest
14
+ */
15
+ ancestors: string[];
16
+ /**
17
+ * IDs of directly-descendant content groups
18
+ */
19
+ descendants: string[];
20
+ }
21
+ interface ContentGroupWithSubtree {
22
+ /**
23
+ * Content group name
24
+ */
25
+ name: string;
26
+ /**
27
+ * Content group ID
28
+ */
29
+ id: string;
30
+ /**
31
+ * IDs of ancestor content groups, ordered from furthest to closest
32
+ */
33
+ ancestors: string[];
34
+ /**
35
+ * Descendant content groups
36
+ */
37
+ descendants: ContentGroupWithSubtree[];
38
+ }
39
+ interface ContentGroupsEndpoints {
40
+ list<Subtree extends true | false = false>(input?: {
41
+ ancestor?: string;
42
+ subtree?: Subtree;
43
+ }): Promise<Subtree extends true ? ContentGroupWithSubtree[] : ContentGroup[]>;
44
+ get<Subtree extends true | false = false>(input: Pick<ContentGroup, "id"> & {
45
+ subtree?: Subtree;
46
+ }): Promise<Subtree extends true ? ContentGroupWithSubtree : ContentGroup>;
47
+ create(input: Omit<ContentGroup, "id" | "ancestors" | "descendants"> & {
48
+ ancestor?: string;
49
+ }): Promise<Pick<ContentGroup, "id">>;
50
+ update(input: Partial<Omit<ContentGroup, "ancestors" | "descendants">> & Pick<ContentGroup, "id">): Promise<void>;
51
+ update(input: Partial<Omit<ContentGroup, "ancestors" | "descendants" | "name">> & Pick<ContentGroup, "id"> & {
52
+ ancestor?: string;
53
+ }): Promise<void>;
54
+ delete(input: Pick<ContentGroup, "id">): Promise<void>;
55
+ }
56
+
57
+ type UIAccentColor = "energy" | "neon" | "sublime" | "sunrise" | "flow";
58
+ interface UserSettings {
59
+ /**
60
+ * UI Theme
61
+ */
62
+ uiTheme: "light" | "dark" | "auto";
63
+ /**
64
+ * Code editor theme
65
+ */
66
+ codeEditorTheme: "light" | "dark" | "auto";
67
+ /**
68
+ * UI accent color
69
+ */
70
+ accentColor: UIAccentColor;
71
+ }
72
+ interface UserSettingsEndpoints {
73
+ get(): Promise<UserSettings>;
74
+ update(input: Partial<UserSettings>): Promise<void>;
75
+ }
76
+
77
+ type WebhookEvent = "contentPieceUpdated" | "contentPieceAdded" | "contentPieceRemoved" | "contentGroupAdded" | "contentGroupRemoved" | "memberInvited" | "memberAdded" | "memberRemoved";
78
+ interface Webhook {
79
+ /**
80
+ * Webhook ID
81
+ */
82
+ id: string;
83
+ /**
84
+ * Webhook target URL
85
+ */
86
+ url: string;
87
+ /**
88
+ * Webhook name
89
+ */
90
+ name: string;
91
+ /**
92
+ * Webhook description
93
+ */
94
+ description?: string;
95
+ /**
96
+ * Webhook signing secret
97
+ */
98
+ secret?: string;
99
+ /**
100
+ * Webhook metadata containing details about the Webhook configuration
101
+ */
102
+ metadata?: {
103
+ contentGroupId: string;
104
+ };
105
+ /**
106
+ * Webhook trigger event
107
+ */
108
+ event: WebhookEvent;
109
+ }
110
+ interface WebhooksEndpoints {
111
+ get(input: Pick<Webhook, "id">): Promise<Omit<Webhook, "secret"> & {
112
+ extension?: boolean;
113
+ }>;
114
+ create(input: Omit<Webhook, "id">): Promise<Pick<Webhook, "id">>;
115
+ update(input: Partial<Omit<Webhook, "secret">> & Pick<Webhook, "id">): Promise<void>;
116
+ delete(query: Pick<Webhook, "id">): Promise<void>;
117
+ list(input: PaginationParams & {
118
+ extensionOnly?: boolean;
119
+ }): Promise<Array<Omit<Webhook, "secret"> & {
120
+ extension?: boolean;
121
+ }> & {
122
+ meta: {
123
+ pagination: PaginationMeta;
124
+ };
125
+ }>;
126
+ }
127
+
128
+ interface WorkspaceDetails {
129
+ /**
130
+ * Workspace ID
131
+ */
132
+ id: string;
133
+ /**
134
+ * Workspace name
135
+ */
136
+ name: string;
137
+ /**
138
+ * Workspace description
139
+ */
140
+ description?: string;
141
+ /**
142
+ * Workspace logo URL
143
+ */
144
+ logo?: string;
145
+ }
146
+ interface WorkspaceEndpoints {
147
+ get(): Promise<WorkspaceDetails>;
148
+ }
149
+
150
+ type RolePermission = "editContent" | "editSnippets" | "editMetadata" | "manageDashboard" | "manageTokens" | "manageWebhooks" | "manageWorkspace";
151
+ type RoleBaseType = "admin" | "viewer";
152
+ interface Role {
153
+ /**
154
+ * Role ID
155
+ */
156
+ id: string;
157
+ /**
158
+ * Role name
159
+ */
160
+ name: string;
161
+ /**
162
+ * Role description
163
+ */
164
+ description?: boolean;
165
+ /**
166
+ * Role permissions
167
+ */
168
+ permissions: RolePermission[];
169
+ /**
170
+ * Base role type (if applicable)
171
+ */
172
+ baseType?: RoleBaseType;
173
+ }
174
+ interface RolesEndpoints {
175
+ get(input: Pick<Role, "id">): Promise<Role>;
176
+ create(input: Omit<Role, "id" | "baseType">): Promise<Pick<Role, "id">>;
177
+ update(input: Partial<Omit<Role, "id" | "baseType">> & Pick<Role, "id">): Promise<void>;
178
+ delete(input: Pick<Role, "id">): Promise<void>;
179
+ list(input: PaginationParams): Promise<Role[] & {
180
+ meta: {
181
+ pagination: PaginationMeta;
182
+ };
183
+ }>;
184
+ }
185
+
186
+ type Mark = "bold" | "italic" | "strike" | "code" | "link" | "underline" | "highlight" | "subscript" | "superscript";
187
+ type Block = "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "bulletList" | "orderedList" | "taskList" | "blockquote" | "codeBlock" | "horizontalRule" | "image" | "table" | "element";
188
+ type Embed = "codepen" | "codesandbox" | "youtube";
189
+ interface WorkspaceSettings {
190
+ /**
191
+ * Workspace settings ID
192
+ */
193
+ id: string;
194
+ /**
195
+ * JSON-stringified Prettier config
196
+ */
197
+ prettierConfig: string;
198
+ /**
199
+ * List of inline formatting marks enabled in the workspace
200
+ */
201
+ marks: Mark[];
202
+ /**
203
+ * List of content blocks enabled in the workspace
204
+ */
205
+ blocks: Block[];
206
+ /**
207
+ * List of embeds enabled in the workspace
208
+ */
209
+ embeds: Embed[];
210
+ /**
211
+ * Metadata settings
212
+ */
213
+ metadata?: Partial<{
214
+ canonicalLinkPattern: string;
215
+ enabledFields: Array<"date" | "tags" | "slug" | "filename" | "members" | "canonical-link">;
216
+ }>;
217
+ /**
218
+ * Dashboard views
219
+ */
220
+ dashboardViews?: {
221
+ table?: Array<{
222
+ id: string;
223
+ width: number;
224
+ }>;
225
+ };
226
+ }
227
+ interface WorkspaceSettingsEndpoints {
228
+ get(): Promise<WorkspaceSettings>;
229
+ update(input: Partial<Omit<WorkspaceSettings, "id">>): Promise<void>;
230
+ }
231
+
232
+ interface ListedMember {
233
+ /**
234
+ * Workspace membership ID
235
+ */
236
+ id: string;
237
+ /**
238
+ * ID of the user associated with the membership
239
+ */
240
+ userId?: string;
241
+ /**
242
+ * ID of the role assigned to the membership
243
+ */
244
+ roleId: string;
245
+ /**
246
+ * Email of the pending-invite user
247
+ */
248
+ email?: string;
249
+ /**
250
+ * Name of the pending-invite user
251
+ */
252
+ name?: string;
253
+ /**
254
+ * Whether the membership is a pending invite
255
+ */
256
+ pendingInvite: boolean;
257
+ /**
258
+ * Additional details about the profile of related user
259
+ */
260
+ profile?: Pick<Profile, "fullName" | "username" | "avatar">;
261
+ }
262
+ interface ListedWorkspace {
263
+ /**
264
+ * Workspace membership ID
265
+ */
266
+ id: string;
267
+ /**
268
+ * Additional details about the related workspace
269
+ */
270
+ workspace: WorkspaceDetails;
271
+ /**
272
+ * Additional details about the role assigned in the workspace
273
+ */
274
+ role?: Pick<Role, "id" | "name">;
275
+ }
276
+ interface WorkspaceMembershipsEndpoints {
277
+ listMembers(input: PaginationParams): Promise<ListedMember[] & {
278
+ meta: {
279
+ pagination: PaginationMeta;
280
+ };
281
+ }>;
282
+ listWorkspaces(input: PaginationParams): Promise<ListedWorkspace[] & {
283
+ meta: {
284
+ pagination: PaginationMeta;
285
+ };
286
+ }>;
287
+ create(input: {
288
+ email: string;
289
+ name: string;
290
+ roleId: string;
291
+ }): Promise<void>;
292
+ update(input: {
293
+ id: string;
294
+ roleId: string;
295
+ }): Promise<void>;
296
+ delete(input: {
297
+ id: string;
298
+ }): Promise<void>;
299
+ }
300
+
301
+ type ContextValue = string | number | boolean | ContextObject | ContextArray;
302
+ interface ContextObject {
303
+ [x: string]: ContextValue;
304
+ }
305
+ interface ContextArray extends Array<ContextValue> {
306
+ }
307
+ interface Extension {
308
+ id: string;
309
+ name: string;
310
+ url: string;
311
+ config: ContextObject;
312
+ token: string;
313
+ }
314
+ interface ExtensionEndpoints {
315
+ get(): Promise<Partial<Extension>>;
316
+ getData(): Promise<ContextObject>;
317
+ updateData(input: {
318
+ data: ContextObject;
319
+ }): Promise<void>;
320
+ updateContentPieceData(input: {
321
+ contentPieceId: string;
322
+ data: ContextObject;
323
+ }): Promise<void>;
324
+ }
325
+
326
+ interface Variant {
327
+ /**
328
+ * Variant ID
329
+ */
330
+ id: string;
331
+ /**
332
+ * Variant key
333
+ */
334
+ key: string;
335
+ /**
336
+ * Variant label
337
+ */
338
+ label: string;
339
+ /**
340
+ * Variant description
341
+ */
342
+ description?: string;
343
+ }
344
+ interface VariantsEndpoints {
345
+ create(input: Omit<Variant, "id">): Promise<Pick<Variant, "id">>;
346
+ update(input: Partial<Variant> & Pick<Variant, "id">): Promise<void>;
347
+ delete(query: Pick<Variant, "id">): Promise<void>;
348
+ list(): Promise<Variant[]>;
349
+ }
350
+
351
+ interface RemoteTransformer {
352
+ /**
353
+ * Transformer ID
354
+ */
355
+ id: string;
356
+ /**
357
+ * Transformer label
358
+ */
359
+ label: string;
360
+ /**
361
+ * Transformer input URL
362
+ */
363
+ input: string;
364
+ /**
365
+ * Transformer output URL
366
+ */
367
+ output: string;
368
+ /**
369
+ * Transformer max batch size (1-1000)
370
+ */
371
+ maxBatchSize: number;
372
+ }
373
+ interface TransformersEndpoints {
374
+ create(input: Omit<RemoteTransformer, "id">): Promise<Pick<RemoteTransformer, "id">>;
375
+ delete(query: Pick<RemoteTransformer, "id">): Promise<void>;
376
+ list(): Promise<Array<RemoteTransformer & {
377
+ inUse?: boolean;
378
+ }>>;
379
+ }
380
+
381
+ type Snippet<IncludeContent extends true | false = false> = {
382
+ /**
383
+ * Snippet ID
384
+ */
385
+ id: string;
386
+ /**
387
+ * Name
388
+ */
389
+ name: string;
390
+ } & (IncludeContent extends true ? {
391
+ /**
392
+ * JSON content
393
+ */
394
+ content: JSONContent;
395
+ } : {});
396
+ interface SnippetsEndpoints {
397
+ get<IncludeContent extends true | false = false>(input: Pick<Snippet, "id"> & {
398
+ content?: IncludeContent;
399
+ }): Promise<Snippet<IncludeContent>>;
400
+ create(input: Pick<Snippet, "name"> & {
401
+ content?: string;
402
+ }): Promise<Pick<Snippet, "id">>;
403
+ update(input: Partial<Pick<Snippet, "name"> & {
404
+ content?: string;
405
+ }> & Pick<Snippet, "id">): Promise<void>;
406
+ delete(input: Pick<Snippet, "id">): Promise<void>;
407
+ list<IncludeContent extends true | false = false>(input: {
408
+ content?: IncludeContent;
409
+ }): Promise<Array<Snippet<IncludeContent>>>;
410
+ }
411
+
412
+ interface SearchResult {
413
+ contentPieceId: string;
414
+ contentPiece: Omit<ContentPiece, "content" | "coverWidth">;
415
+ breadcrumb: string[];
416
+ content: string;
417
+ }
418
+ interface ClientConfig extends APIFetcherConfig {
419
+ }
420
+ interface Client {
421
+ contentGroups: ContentGroupsEndpoints;
422
+ contentPieces: ContentPiecesEndpoints;
423
+ snippets: SnippetsEndpoints;
424
+ tags: TagsEndpoints;
425
+ profile: ProfileEndpoints;
426
+ userSettings: UserSettingsEndpoints;
427
+ webhooks: WebhooksEndpoints;
428
+ workspace: WorkspaceEndpoints;
429
+ roles: RolesEndpoints;
430
+ workspaceSettings: WorkspaceSettingsEndpoints;
431
+ workspaceMemberships: WorkspaceMembershipsEndpoints;
432
+ extension: ExtensionEndpoints;
433
+ variants: VariantsEndpoints;
434
+ transformers: TransformersEndpoints;
435
+ search(input: {
436
+ query: string;
437
+ limit?: number;
438
+ variantId?: string;
439
+ contentGroupId?: string;
440
+ contentPieceId?: string;
441
+ byTitle?: boolean;
442
+ }): Promise<SearchResult[]>;
443
+ ask(input: {
444
+ query: string;
445
+ variantId?: string;
446
+ contentGroupId?: string;
447
+ contentPieceId?: string;
448
+ onChunk?(chunk: string, content: string): void;
449
+ onEnd?(content: string): void;
450
+ onError?(error: string): void;
451
+ }): void;
452
+ useSignal(signal: AbortSignal | null): Client;
453
+ reconfigure(config: ClientConfig): Client;
454
+ getConfig(): ClientConfig;
455
+ }
456
+ declare const createClient: (config: ClientConfig) => Client;
457
+
458
+ export { type Block as B, type Client as C, type Embed as E, type ListedMember as L, type Mark as M, type Role as R, type SearchResult as S, type UIAccentColor as U, type Variant as V, type Webhook as W, type ContentGroup as a, type ContentGroupWithSubtree as b, createClient as c, type Snippet as d, type RoleBaseType as e, type RolePermission as f, type UserSettings as g, type WebhookEvent as h, type WorkspaceDetails as i, type WorkspaceSettings as j, type ListedWorkspace as k, type Extension as l };
@@ -0,0 +1,201 @@
1
+ interface APIFetcherConfig {
2
+ token: string;
3
+ baseURL?: string;
4
+ extensionId?: string;
5
+ headers?: Record<string, string>;
6
+ }
7
+ type PaginationParams = {
8
+ perPage?: number;
9
+ page?: number;
10
+ };
11
+ type PaginationMeta = {
12
+ total: number;
13
+ pages: number;
14
+ perPage: number;
15
+ page: number;
16
+ };
17
+
18
+ interface Profile {
19
+ /**
20
+ * User ID
21
+ */
22
+ id: string;
23
+ /**
24
+ * User avatar URL
25
+ */
26
+ avatar?: string;
27
+ /**
28
+ * Username
29
+ */
30
+ username: string;
31
+ /**
32
+ * User's personal bio
33
+ */
34
+ bio?: string;
35
+ /**
36
+ * User's full name
37
+ */
38
+ fullName?: string;
39
+ /**
40
+ * User's email
41
+ */
42
+ email: string;
43
+ /**
44
+ * Whether the user's new email is verified in the email change process
45
+ */
46
+ newEmailChangeInVerification?: boolean;
47
+ /**
48
+ * Whether the user's old email is verified in the email change process
49
+ */
50
+ oldEmailChangeInVerification?: boolean;
51
+ /**
52
+ * Whether the user's password is verified in the password change process
53
+ */
54
+ passwordChangeInVerification?: boolean;
55
+ /**
56
+ * Whether the user's email is verified
57
+ */
58
+ emailInVerification?: boolean;
59
+ }
60
+ interface ProfileEndpoints {
61
+ get(): Promise<Profile>;
62
+ }
63
+
64
+ type TagColor = "gray" | "red" | "pink" | "orange" | "amber" | "purple" | "indigo" | "blue" | "cyan" | "green" | "teal" | "lime" | "fuchsia" | "emerald";
65
+ type Tag = {
66
+ /**
67
+ * Label describing the tag
68
+ */
69
+ label?: string;
70
+ /**
71
+ * Tag color
72
+ */
73
+ color: TagColor;
74
+ /**
75
+ * Tag ID
76
+ */
77
+ id: string;
78
+ };
79
+ interface TagsEndpoints {
80
+ get(input: Pick<Tag, "id">): Promise<Tag>;
81
+ update(input: Partial<Tag> & Pick<Tag, "id">): Promise<void>;
82
+ create(input: Omit<Tag, "id">): Promise<Pick<Tag, "id">>;
83
+ delete(input: Pick<Tag, "id">): Promise<void>;
84
+ list(input: PaginationParams): Promise<Tag[] & {
85
+ meta: {
86
+ pagination: PaginationMeta;
87
+ };
88
+ }>;
89
+ }
90
+
91
+ type JSONContentAttrs = Record<string, string | number | boolean>;
92
+ type JSONContent = {
93
+ type: string;
94
+ content?: JSONContent[];
95
+ text?: string;
96
+ attrs?: JSONContentAttrs;
97
+ marks?: Array<{
98
+ type: string;
99
+ attrs: JSONContentAttrs;
100
+ }>;
101
+ };
102
+ type ContentPiece<CustomData extends Record<string, any> = Record<string, any>, IncludeContent extends true | false = false> = {
103
+ /**
104
+ * Content piece ID
105
+ */
106
+ id: string;
107
+ /**
108
+ * ISO date
109
+ */
110
+ date?: string | null;
111
+ /**
112
+ * Title
113
+ */
114
+ title: string;
115
+ /**
116
+ * Content piece description - can be HTML or plain text
117
+ */
118
+ description?: string | null;
119
+ /**
120
+ * URL of the cover image
121
+ */
122
+ coverUrl?: string | null;
123
+ /**
124
+ * Alt description of the cover image
125
+ */
126
+ coverAlt?: string | null;
127
+ /**
128
+ * ID of the content group to assign the piece to
129
+ */
130
+ contentGroupId: string;
131
+ /**
132
+ * JSON object containing custom metadata
133
+ */
134
+ customData?: CustomData | null;
135
+ /**
136
+ * Canonical link
137
+ */
138
+ canonicalLink?: string | null;
139
+ /**
140
+ * IDs of assigned tags
141
+ */
142
+ tags: string[];
143
+ /**
144
+ * IDs of assigned members
145
+ */
146
+ members: string[];
147
+ /**
148
+ * Content piece slug
149
+ */
150
+ slug: string;
151
+ /**
152
+ * Content piece filename
153
+ */
154
+ filename?: string | null;
155
+ /**
156
+ * Cover image width - percentage value string (only meant for resizing image inside Vrite editor)
157
+ */
158
+ coverWidth?: string;
159
+ } & (IncludeContent extends true ? {
160
+ /**
161
+ * JSON content
162
+ */
163
+ content: JSONContent;
164
+ } : {});
165
+ type ContentPieceWithAdditionalData<CustomData extends Record<string, any> = Record<string, any>, IncludeContent extends true | false = false> = Omit<ContentPiece<CustomData, IncludeContent>, "tags" | "members"> & {
166
+ tags: Tag[];
167
+ members: Array<{
168
+ id: string;
169
+ profile: Omit<Profile, "bio">;
170
+ }>;
171
+ };
172
+ interface ContentPiecesEndpoints {
173
+ get<CustomData extends Record<string, any> = Record<string, any>, IncludeContent extends true | false = false>(input: Pick<ContentPiece, "id"> & {
174
+ content?: IncludeContent;
175
+ description?: "html" | "text";
176
+ variant?: string;
177
+ }): Promise<ContentPieceWithAdditionalData<CustomData, IncludeContent>>;
178
+ create<CustomData extends Record<string, any> = Record<string, any>>(input: Pick<ContentPiece<CustomData>, "date" | "title" | "description" | "tags" | "members" | "coverUrl" | "coverAlt" | "contentGroupId" | "customData" | "canonicalLink"> & {
179
+ referenceId?: string;
180
+ slug?: string;
181
+ content?: string;
182
+ }): Promise<Pick<ContentPiece<CustomData>, "id">>;
183
+ update<CustomData extends Record<string, any> = Record<string, any>>(input: Partial<Pick<ContentPiece<CustomData>, "date" | "title" | "description" | "tags" | "members" | "slug" | "coverUrl" | "coverAlt" | "contentGroupId" | "customData" | "canonicalLink" | "coverWidth"> & {
184
+ content?: string;
185
+ variant?: string;
186
+ }> & Pick<ContentPiece<CustomData>, "id">): Promise<void>;
187
+ delete(input: Pick<ContentPiece, "id">): Promise<void>;
188
+ list<CustomData extends Record<string, any> = Record<string, any>, IncludeContent extends true | false = false>(input: PaginationParams & {
189
+ content?: IncludeContent;
190
+ contentGroupId?: string | string[];
191
+ tagId?: string;
192
+ slug?: string;
193
+ variant?: string;
194
+ }): Promise<Array<ContentPieceWithAdditionalData<CustomData, IncludeContent>> & {
195
+ meta: {
196
+ pagination: PaginationMeta;
197
+ };
198
+ }>;
199
+ }
200
+
201
+ export type { APIFetcherConfig as A, ContentPiece as C, JSONContent as J, Profile as P, Tag as T, ContentPieceWithAdditionalData as a, JSONContentAttrs as b, TagColor as c, PaginationParams as d, PaginationMeta as e, ContentPiecesEndpoints as f, TagsEndpoints as g, ProfileEndpoints as h };