@content-island/vscode-api-client 0.1.2 → 0.1.4
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 +48 -9
- 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
3
|
declare type AllowedModelFields<M extends Model, ValueType> = Partial<Omit<{
|
|
4
|
-
[K in keyof M as M[K] extends
|
|
4
|
+
[K in keyof M as IsPrimitive<NonNullable<M[K]>> extends true ? `fields.${string & K}` : never]?: ValueType;
|
|
5
5
|
}, 'fields.id' | 'fields.language'>>;
|
|
6
6
|
|
|
7
7
|
declare interface ApiClient {
|
|
@@ -14,8 +14,15 @@ declare interface ApiClient {
|
|
|
14
14
|
updateContentFieldValue: (contentId: string, fieldId: string, value: any) => Promise<boolean>;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
declare interface BaseModel {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
type: ModelType;
|
|
21
|
+
}
|
|
22
|
+
|
|
17
23
|
export declare type ClientFilter<Type = string | boolean> = Type | {
|
|
18
24
|
in?: Type[];
|
|
25
|
+
ne?: Type;
|
|
19
26
|
};
|
|
20
27
|
|
|
21
28
|
export declare interface Content {
|
|
@@ -32,10 +39,6 @@ export declare type ContentListSizeQueryParams<M extends Model = Model & Record<
|
|
|
32
39
|
|
|
33
40
|
export declare type ContentQueryParams<M extends Model = Model & Record<string, any>> = Omit<QueryParams<M>, 'sort' | 'pagination'>;
|
|
34
41
|
|
|
35
|
-
declare interface ContentType extends Lookup {
|
|
36
|
-
fields: ContentTypeField[];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
42
|
declare interface ContentTypeField extends Lookup {
|
|
40
43
|
type: FieldType;
|
|
41
44
|
tsType: string;
|
|
@@ -45,6 +48,27 @@ declare interface ContentTypeField extends Lookup {
|
|
|
45
48
|
|
|
46
49
|
export declare const createClient: (options?: VSCodeClientOptions) => VSCodeApiClient;
|
|
47
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
|
+
|
|
48
72
|
export declare interface Field {
|
|
49
73
|
id: string;
|
|
50
74
|
name: string;
|
|
@@ -54,7 +78,14 @@ export declare interface Field {
|
|
|
54
78
|
language: string;
|
|
55
79
|
}
|
|
56
80
|
|
|
57
|
-
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
|
+
}
|
|
58
89
|
|
|
59
90
|
export declare type FieldType =
|
|
60
91
|
| 'short-text'
|
|
@@ -65,16 +96,18 @@ export declare type FieldType =
|
|
|
65
96
|
| 'media'
|
|
66
97
|
| 'boolean'
|
|
67
98
|
| 'color'
|
|
68
|
-
|
|
|
99
|
+
| RelatedModelType;
|
|
69
100
|
|
|
70
101
|
declare type FilterableFields<M extends Model = Model> = {
|
|
71
102
|
id?: ClientFilter;
|
|
72
103
|
lastUpdate?: ClientFilter;
|
|
73
|
-
language?:
|
|
104
|
+
language?: M['language'];
|
|
74
105
|
contentType?: ClientFilter;
|
|
75
106
|
includeRelatedContent?: boolean;
|
|
76
107
|
} & AllowedModelFields<M, ClientFilter>;
|
|
77
108
|
|
|
109
|
+
declare type IsPrimitive<T> = [T] extends [string | number | boolean] ? true : false;
|
|
110
|
+
|
|
78
111
|
export declare type LanguageCode =
|
|
79
112
|
| 'aa'
|
|
80
113
|
| 'ab'
|
|
@@ -279,6 +312,8 @@ export declare type Model<Language = string> = {
|
|
|
279
312
|
lastUpdate?: string;
|
|
280
313
|
};
|
|
281
314
|
|
|
315
|
+
declare type ModelType = 'entity' | 'enum';
|
|
316
|
+
|
|
282
317
|
declare interface Options {
|
|
283
318
|
accessToken: string;
|
|
284
319
|
domain?: string;
|
|
@@ -296,7 +331,7 @@ export declare interface Project {
|
|
|
296
331
|
id: string;
|
|
297
332
|
name: string;
|
|
298
333
|
languages: LanguageCode[];
|
|
299
|
-
contentTypes?:
|
|
334
|
+
contentTypes?: (EntityContentType | EnumContentType)[];
|
|
300
335
|
}
|
|
301
336
|
|
|
302
337
|
declare type QueryParams<M extends Model = Model & Record<string, any>> = FilterableFields<M> & {
|
|
@@ -304,6 +339,8 @@ declare type QueryParams<M extends Model = Model & Record<string, any>> = Filter
|
|
|
304
339
|
pagination?: Pagination;
|
|
305
340
|
};
|
|
306
341
|
|
|
342
|
+
declare type RelatedModelType = `${string}|${string}`;
|
|
343
|
+
|
|
307
344
|
declare type SortableFields<M extends Model> = {
|
|
308
345
|
contentType?: SortOrder;
|
|
309
346
|
lastUpdate?: SortOrder;
|
|
@@ -311,6 +348,8 @@ declare type SortableFields<M extends Model> = {
|
|
|
311
348
|
|
|
312
349
|
declare type SortOrder = 'asc' | 'desc';
|
|
313
350
|
|
|
351
|
+
declare type Validation = { name: string; customArgs?: any };
|
|
352
|
+
|
|
314
353
|
export declare interface VSCodeApiClient extends ApiClient {
|
|
315
354
|
setVSCodeExtensionContext: (context: vscode.ExtensionContext) => void;
|
|
316
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.4",
|
|
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.16.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@content-island/common-backend": "*",
|