@content-island/vscode-api-client 0.2.2 → 0.2.3
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 +63 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,18 @@ declare interface ApiClient {
|
|
|
32
32
|
* the live snapshot from the current draft.
|
|
33
33
|
*/
|
|
34
34
|
publishContent: (contentId: string) => Promise<boolean>;
|
|
35
|
+
/** Creates an Entity model. Rejects with `ApiClientError` on non-2xx. */
|
|
36
|
+
createModel: (params: CreateEntityParams) => Promise<SaveModelResponse>;
|
|
37
|
+
/** Full-upsert of an Entity model: the supplied `fieldList` replaces the stored one. */
|
|
38
|
+
updateModel: (modelId: string, params: UpdateEntityParams) => Promise<SaveModelResponse>;
|
|
39
|
+
/** Deletes a model. Rejects with `ApiClientError` (e.g. 409 when referenced). */
|
|
40
|
+
deleteModel: (modelId: string) => Promise<boolean>;
|
|
41
|
+
/** Creates an Enum model. Rejects with `ApiClientError` on non-2xx. */
|
|
42
|
+
createEnum: (params: CreateEnumParams) => Promise<SaveModelResponse>;
|
|
43
|
+
/** Full-upsert of an Enum model: the supplied `values` replace the stored ones. */
|
|
44
|
+
updateEnum: (enumId: string, params: UpdateEnumParams) => Promise<SaveModelResponse>;
|
|
45
|
+
/** Deletes an enum. Rejects with `ApiClientError` (e.g. 409 when referenced). */
|
|
46
|
+
deleteEnum: (enumId: string) => Promise<boolean>;
|
|
35
47
|
}
|
|
36
48
|
|
|
37
49
|
declare interface BaseModel {
|
|
@@ -87,6 +99,19 @@ declare interface CreateContentResponse {
|
|
|
87
99
|
id: string;
|
|
88
100
|
}
|
|
89
101
|
|
|
102
|
+
declare interface CreateEntityParams {
|
|
103
|
+
name: string;
|
|
104
|
+
fieldList: FieldSpec[];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
declare interface CreateEnumParams {
|
|
108
|
+
name: string;
|
|
109
|
+
values: Array<{
|
|
110
|
+
id?: string;
|
|
111
|
+
value: string;
|
|
112
|
+
}>;
|
|
113
|
+
}
|
|
114
|
+
|
|
90
115
|
declare interface Entity extends BaseModel {
|
|
91
116
|
type: 'entity';
|
|
92
117
|
fieldList?: Field_2[];
|
|
@@ -131,6 +156,21 @@ declare type FieldSelector = {
|
|
|
131
156
|
language: string;
|
|
132
157
|
};
|
|
133
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Structured field spec. `id` is optional: present = existing field to preserve
|
|
161
|
+
* on update, absent = the server creates it. `relatedModelId` is a 24-char model
|
|
162
|
+
* id used only for `relation`/`enum` types. `order` never appears (server derives
|
|
163
|
+
* it by list position).
|
|
164
|
+
*/
|
|
165
|
+
declare interface FieldSpec {
|
|
166
|
+
id?: string;
|
|
167
|
+
name: string;
|
|
168
|
+
type: FieldTypeSpec;
|
|
169
|
+
relatedModelId?: string;
|
|
170
|
+
isArray?: boolean;
|
|
171
|
+
validations?: Validation[];
|
|
172
|
+
}
|
|
173
|
+
|
|
134
174
|
export declare type FieldType =
|
|
135
175
|
| 'short-text'
|
|
136
176
|
| 'long-text'
|
|
@@ -142,6 +182,19 @@ export declare type FieldType =
|
|
|
142
182
|
| 'color'
|
|
143
183
|
| RelatedModelType;
|
|
144
184
|
|
|
185
|
+
/**
|
|
186
|
+
* Agent-facing field type discriminator (the value an agent supplies for a field's
|
|
187
|
+
* `type` when creating/editing a model). The B2B server translates `relation`/`enum`
|
|
188
|
+
* + `relatedModelId` into the stored `` `${modelId}|${Name}` `` type string; the
|
|
189
|
+
* agent never supplies a composite type string.
|
|
190
|
+
*
|
|
191
|
+
* Derived from common's stored `FieldType` (single source of truth): the 8 primitive
|
|
192
|
+
* tokens (the stored type minus the composite `${id}|${Name}` form) plus the two
|
|
193
|
+
* agent-facing discriminators. Distinct from the read-side `FieldType` (common), which
|
|
194
|
+
* is the composite the server returns on content/project responses.
|
|
195
|
+
*/
|
|
196
|
+
declare type FieldTypeSpec = Exclude<FieldType, `${string}|${string}`> | 'relation' | 'enum';
|
|
197
|
+
|
|
145
198
|
declare type FilterableFields<M extends Model = Model> = {
|
|
146
199
|
id?: ClientFilter<string>;
|
|
147
200
|
lastUpdate?: ClientFilter<string>;
|
|
@@ -388,6 +441,11 @@ declare type QueryParams<M extends Model = Model & Record<string, any>> = Filter
|
|
|
388
441
|
|
|
389
442
|
declare type RelatedModelType = `${string}|${string}`;
|
|
390
443
|
|
|
444
|
+
/** Committed-operation success response for create/update model/enum. */
|
|
445
|
+
declare interface SaveModelResponse {
|
|
446
|
+
id: string;
|
|
447
|
+
}
|
|
448
|
+
|
|
391
449
|
declare type SortableFields<M extends Model> = {
|
|
392
450
|
contentType?: SortOrder;
|
|
393
451
|
lastUpdate?: SortOrder;
|
|
@@ -397,6 +455,10 @@ declare type SortOrder = 'asc' | 'desc';
|
|
|
397
455
|
|
|
398
456
|
declare type Status = 'draft' | 'published' | 'changed';
|
|
399
457
|
|
|
458
|
+
declare type UpdateEntityParams = CreateEntityParams;
|
|
459
|
+
|
|
460
|
+
declare type UpdateEnumParams = CreateEnumParams;
|
|
461
|
+
|
|
400
462
|
declare interface UploadMediaParams {
|
|
401
463
|
file: Blob | File;
|
|
402
464
|
fileName?: string;
|
|
@@ -404,7 +466,7 @@ declare interface UploadMediaParams {
|
|
|
404
466
|
|
|
405
467
|
declare type Validation = { name: string; customArgs?: any };
|
|
406
468
|
|
|
407
|
-
export declare interface VSCodeApiClient extends ApiClient {
|
|
469
|
+
export declare interface VSCodeApiClient extends Omit<ApiClient, 'createModel' | 'updateModel' | 'deleteModel' | 'createEnum' | 'updateEnum' | 'deleteEnum'> {
|
|
408
470
|
setVSCodeExtensionContext: (context: vscode.ExtensionContext) => void;
|
|
409
471
|
authorize: (authorizationCode: string, metadata: string) => Promise<void>;
|
|
410
472
|
authorizeByProjectId: (projectId: string) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@content-island/vscode-api-client",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
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.22.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@content-island/common-backend": "*",
|