@content-island/vscode-api-client 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +53 -15
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as vscode from 'vscode';
|
|
2
2
|
|
|
3
|
-
declare type
|
|
4
|
-
[K in keyof M as M[K] extends
|
|
3
|
+
declare type AllowedFields<M extends Model, Type extends 'sort' | 'filter'> = Partial<Omit<{
|
|
4
|
+
[K in keyof M as IsPrimitive<NonNullable<M[K]>> extends true ? `fields.${string & K}` : never]?: Type extends 'sort' ? SortOrder : ClientFilter<NonNullable<M[K]>>;
|
|
5
5
|
}, 'fields.id' | 'fields.language'>>;
|
|
6
6
|
|
|
7
7
|
declare interface ApiClient {
|
|
@@ -14,7 +14,13 @@ declare interface ApiClient {
|
|
|
14
14
|
updateContentFieldValue: (contentId: string, fieldId: string, value: any) => Promise<boolean>;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
declare interface BaseModel {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
type: ModelType;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export declare type ClientFilter<Type = string | boolean | number> = Type | {
|
|
18
24
|
in?: Type[];
|
|
19
25
|
ne?: Type;
|
|
20
26
|
};
|
|
@@ -33,10 +39,6 @@ export declare type ContentListSizeQueryParams<M extends Model = Model & Record<
|
|
|
33
39
|
|
|
34
40
|
export declare type ContentQueryParams<M extends Model = Model & Record<string, any>> = Omit<QueryParams<M>, 'sort' | 'pagination'>;
|
|
35
41
|
|
|
36
|
-
declare interface ContentType extends Lookup {
|
|
37
|
-
fields: ContentTypeField[];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
42
|
declare interface ContentTypeField extends Lookup {
|
|
41
43
|
type: FieldType;
|
|
42
44
|
tsType: string;
|
|
@@ -46,6 +48,27 @@ declare interface ContentTypeField extends Lookup {
|
|
|
46
48
|
|
|
47
49
|
export declare const createClient: (options?: VSCodeClientOptions) => VSCodeApiClient;
|
|
48
50
|
|
|
51
|
+
declare interface Entity extends BaseModel {
|
|
52
|
+
type: 'entity';
|
|
53
|
+
fieldList?: Field_2[];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare type EntityContentType = Omit<Entity, 'fieldList'> & {
|
|
57
|
+
fields: ContentTypeField[];
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
declare interface Enum extends BaseModel {
|
|
61
|
+
type: 'enum';
|
|
62
|
+
values: EnumValue[];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
declare type EnumContentType = Enum;
|
|
66
|
+
|
|
67
|
+
declare interface EnumValue {
|
|
68
|
+
id: string;
|
|
69
|
+
value: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
49
72
|
export declare interface Field {
|
|
50
73
|
id: string;
|
|
51
74
|
name: string;
|
|
@@ -55,7 +78,14 @@ export declare interface Field {
|
|
|
55
78
|
language: string;
|
|
56
79
|
}
|
|
57
80
|
|
|
58
|
-
declare
|
|
81
|
+
declare interface Field_2 {
|
|
82
|
+
id: string;
|
|
83
|
+
name: string;
|
|
84
|
+
type: FieldType;
|
|
85
|
+
isArray: boolean;
|
|
86
|
+
order: number;
|
|
87
|
+
validations?: Validation[];
|
|
88
|
+
}
|
|
59
89
|
|
|
60
90
|
export declare type FieldType =
|
|
61
91
|
| 'short-text'
|
|
@@ -66,15 +96,17 @@ export declare type FieldType =
|
|
|
66
96
|
| 'media'
|
|
67
97
|
| 'boolean'
|
|
68
98
|
| 'color'
|
|
69
|
-
|
|
|
99
|
+
| RelatedModelType;
|
|
70
100
|
|
|
71
101
|
declare type FilterableFields<M extends Model = Model> = {
|
|
72
|
-
id?: ClientFilter
|
|
73
|
-
lastUpdate?: ClientFilter
|
|
102
|
+
id?: ClientFilter<string>;
|
|
103
|
+
lastUpdate?: ClientFilter<string>;
|
|
74
104
|
language?: M['language'];
|
|
75
|
-
contentType?: ClientFilter
|
|
105
|
+
contentType?: ClientFilter<string>;
|
|
76
106
|
includeRelatedContent?: boolean;
|
|
77
|
-
} &
|
|
107
|
+
} & AllowedFields<M, 'filter'>;
|
|
108
|
+
|
|
109
|
+
declare type IsPrimitive<T> = [T] extends [string | number | boolean] ? true : false;
|
|
78
110
|
|
|
79
111
|
export declare type LanguageCode =
|
|
80
112
|
| 'aa'
|
|
@@ -280,6 +312,8 @@ export declare type Model<Language = string> = {
|
|
|
280
312
|
lastUpdate?: string;
|
|
281
313
|
};
|
|
282
314
|
|
|
315
|
+
declare type ModelType = 'entity' | 'enum';
|
|
316
|
+
|
|
283
317
|
declare interface Options {
|
|
284
318
|
accessToken: string;
|
|
285
319
|
domain?: string;
|
|
@@ -297,7 +331,7 @@ export declare interface Project {
|
|
|
297
331
|
id: string;
|
|
298
332
|
name: string;
|
|
299
333
|
languages: LanguageCode[];
|
|
300
|
-
contentTypes?:
|
|
334
|
+
contentTypes?: (EntityContentType | EnumContentType)[];
|
|
301
335
|
}
|
|
302
336
|
|
|
303
337
|
declare type QueryParams<M extends Model = Model & Record<string, any>> = FilterableFields<M> & {
|
|
@@ -305,13 +339,17 @@ declare type QueryParams<M extends Model = Model & Record<string, any>> = Filter
|
|
|
305
339
|
pagination?: Pagination;
|
|
306
340
|
};
|
|
307
341
|
|
|
342
|
+
declare type RelatedModelType = `${string}|${string}`;
|
|
343
|
+
|
|
308
344
|
declare type SortableFields<M extends Model> = {
|
|
309
345
|
contentType?: SortOrder;
|
|
310
346
|
lastUpdate?: SortOrder;
|
|
311
|
-
} &
|
|
347
|
+
} & AllowedFields<M, 'sort'>;
|
|
312
348
|
|
|
313
349
|
declare type SortOrder = 'asc' | 'desc';
|
|
314
350
|
|
|
351
|
+
declare type Validation = { name: string; customArgs?: any };
|
|
352
|
+
|
|
315
353
|
export declare interface VSCodeApiClient extends ApiClient {
|
|
316
354
|
setVSCodeExtensionContext: (context: vscode.ExtensionContext) => void;
|
|
317
355
|
authorize: (authorizationCode: string, metadata: string) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@content-island/vscode-api-client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Content Island - VSCode Extension API Client",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"test:watch": "vitest -c ./config/test/config.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@content-island/api-client": "0.
|
|
35
|
+
"@content-island/api-client": "0.17.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@content-island/common-backend": "*",
|