@api-client/core 0.5.2 → 0.5.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/build/browser.d.ts +2 -1
- package/build/browser.js +2 -1
- package/build/browser.js.map +1 -1
- package/build/index.d.ts +2 -1
- package/build/index.js +2 -1
- package/build/index.js.map +1 -1
- package/build/src/models/Backend.d.ts +7 -9
- package/build/src/models/HttpHistory.d.ts +2 -2
- package/build/src/models/Project.d.ts +41 -0
- package/build/src/models/Project.js +94 -0
- package/build/src/models/Project.js.map +1 -0
- package/build/src/models/RevisionInfo.d.ts +5 -0
- package/build/src/models/RevisionInfo.js.map +1 -1
- package/build/src/models/SerializableError.d.ts +1 -0
- package/build/src/models/SerializableError.js.map +1 -1
- package/build/src/models/Thing.js +1 -1
- package/build/src/models/Thing.js.map +1 -1
- package/build/src/models/Workspace.d.ts +0 -17
- package/build/src/models/Workspace.js +3 -19
- package/build/src/models/Workspace.js.map +1 -1
- package/build/src/models/store/Deletion.d.ts +24 -0
- package/build/src/models/store/Deletion.js +2 -0
- package/build/src/models/store/Deletion.js.map +1 -0
- package/build/src/models/store/File.d.ts +75 -12
- package/build/src/models/store/File.js +120 -19
- package/build/src/models/store/File.js.map +1 -1
- package/build/src/models/store/Modification.d.ts +24 -0
- package/build/src/models/store/Modification.js +2 -0
- package/build/src/models/store/Modification.js.map +1 -0
- package/build/src/runtime/store/Errors.d.ts +50 -0
- package/build/src/runtime/store/Errors.js +63 -0
- package/build/src/runtime/store/Errors.js.map +1 -0
- package/build/src/runtime/store/FilesSdk.d.ts +94 -0
- package/build/src/runtime/store/FilesSdk.js +247 -0
- package/build/src/runtime/store/FilesSdk.js.map +1 -0
- package/build/src/runtime/store/HistorySdk.d.ts +14 -7
- package/build/src/runtime/store/HistorySdk.js +34 -12
- package/build/src/runtime/store/HistorySdk.js.map +1 -1
- package/build/src/runtime/store/RouteBuilder.d.ts +9 -17
- package/build/src/runtime/store/RouteBuilder.js +14 -26
- package/build/src/runtime/store/RouteBuilder.js.map +1 -1
- package/build/src/runtime/store/Sdk.d.ts +6 -7
- package/build/src/runtime/store/Sdk.js +6 -7
- package/build/src/runtime/store/Sdk.js.map +1 -1
- package/build/src/runtime/store/SdkBase.d.ts +16 -6
- package/build/src/runtime/store/SdkBase.js +54 -4
- package/build/src/runtime/store/SdkBase.js.map +1 -1
- package/build/src/runtime/store/SharedSdk.d.ts +8 -2
- package/build/src/runtime/store/SharedSdk.js +22 -8
- package/build/src/runtime/store/SharedSdk.js.map +1 -1
- package/build/src/runtime/store/StoreSdkNode.d.ts +1 -1
- package/build/src/runtime/store/StoreSdkWeb.d.ts +1 -1
- package/build/src/runtime/store/UsersSdk.d.ts +10 -4
- package/build/src/runtime/store/UsersSdk.js +12 -6
- package/build/src/runtime/store/UsersSdk.js.map +1 -1
- package/package.json +2 -2
- package/src/models/Backend.ts +7 -9
- package/src/models/HttpHistory.ts +2 -2
- package/src/models/Project.ts +110 -0
- package/src/models/RevisionInfo.ts +6 -0
- package/src/models/SerializableError.ts +1 -0
- package/src/models/Thing.ts +1 -1
- package/src/models/Workspace.ts +4 -29
- package/src/models/store/Deletion.ts +24 -0
- package/src/models/store/File.ts +146 -26
- package/src/models/store/Modification.ts +24 -0
- package/src/runtime/store/Errors.ts +100 -0
- package/src/runtime/store/FilesSdk.ts +302 -0
- package/src/runtime/store/HistorySdk.ts +42 -17
- package/src/runtime/store/RouteBuilder.ts +14 -28
- package/src/runtime/store/Sdk.ts +7 -7
- package/src/runtime/store/SdkBase.ts +63 -9
- package/src/runtime/store/SharedSdk.ts +27 -10
- package/src/runtime/store/StoreSdkNode.ts +1 -1
- package/src/runtime/store/StoreSdkWeb.ts +1 -1
- package/src/runtime/store/UsersSdk.ts +14 -8
- package/build/src/models/HttpProjectListItem.d.ts +0 -23
- package/build/src/models/HttpProjectListItem.js +0 -2
- package/build/src/models/HttpProjectListItem.js.map +0 -1
- package/build/src/runtime/store/ProjectsSdk.d.ts +0 -43
- package/build/src/runtime/store/ProjectsSdk.js +0 -144
- package/build/src/runtime/store/ProjectsSdk.js.map +0 -1
- package/build/src/runtime/store/SpacesSdk.d.ts +0 -62
- package/build/src/runtime/store/SpacesSdk.js +0 -194
- package/build/src/runtime/store/SpacesSdk.js.map +0 -1
- package/src/models/HttpProjectListItem.ts +0 -23
- package/src/runtime/store/ProjectsSdk.ts +0 -147
- package/src/runtime/store/SpacesSdk.ts +0 -209
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { IPermission } from './Permission.js';
|
|
2
|
+
import { IModification } from './Modification.js';
|
|
3
|
+
import { IDeletion } from './Deletion.js';
|
|
4
|
+
import { IUser } from './User.js';
|
|
5
|
+
import { IThing, Thing } from '../Thing.js';
|
|
2
6
|
export declare const DefaultOwner = "default";
|
|
3
7
|
export interface IStoredFile {
|
|
8
|
+
/**
|
|
9
|
+
* The kind of the File
|
|
10
|
+
*/
|
|
11
|
+
kind: string;
|
|
12
|
+
/**
|
|
13
|
+
* The identifier of the entity
|
|
14
|
+
*/
|
|
15
|
+
key: string;
|
|
16
|
+
/**
|
|
17
|
+
* The projects's meta info.
|
|
18
|
+
*/
|
|
19
|
+
info: IThing;
|
|
4
20
|
/**
|
|
5
21
|
* The list of parents of the object. It is an ordered list of parents
|
|
6
22
|
* from the top (first element) to the lowest parent in the tree (last element).
|
|
@@ -21,17 +37,22 @@ export interface IStoredFile {
|
|
|
21
37
|
*/
|
|
22
38
|
deleted?: boolean;
|
|
23
39
|
/**
|
|
24
|
-
* The
|
|
25
|
-
|
|
26
|
-
deletedTime?: number;
|
|
27
|
-
/**
|
|
28
|
-
* The id of the user that has deleted the file.
|
|
40
|
+
* The information about the delete information.
|
|
41
|
+
* Always set when the `delete` is true.
|
|
29
42
|
*/
|
|
30
|
-
|
|
43
|
+
deletedInfo?: IDeletion;
|
|
31
44
|
/**
|
|
32
45
|
* The owner of this object. The id of the User object.
|
|
33
46
|
*/
|
|
34
47
|
owner: string;
|
|
48
|
+
/**
|
|
49
|
+
* The last modification made to this file.
|
|
50
|
+
*/
|
|
51
|
+
lastModified: IModification;
|
|
52
|
+
/**
|
|
53
|
+
* An arbitrary list of labels applied to the file.
|
|
54
|
+
*/
|
|
55
|
+
labels?: string[];
|
|
35
56
|
}
|
|
36
57
|
/**
|
|
37
58
|
* An interface describing an object in the data store that
|
|
@@ -50,6 +71,18 @@ export interface IFile extends IStoredFile {
|
|
|
50
71
|
permissions: IPermission[];
|
|
51
72
|
}
|
|
52
73
|
export declare class StoredFile {
|
|
74
|
+
/**
|
|
75
|
+
* The kind of the File
|
|
76
|
+
*/
|
|
77
|
+
kind: string;
|
|
78
|
+
/**
|
|
79
|
+
* The identifier of the entity
|
|
80
|
+
*/
|
|
81
|
+
key: string;
|
|
82
|
+
/**
|
|
83
|
+
* The name of the environment.
|
|
84
|
+
*/
|
|
85
|
+
info: Thing;
|
|
53
86
|
/**
|
|
54
87
|
* The list of parents of the object. It is an ordered list of parents
|
|
55
88
|
* from the top (first element) to the lowest parent in the tree (last element).
|
|
@@ -70,20 +103,50 @@ export declare class StoredFile {
|
|
|
70
103
|
*/
|
|
71
104
|
deleted?: boolean;
|
|
72
105
|
/**
|
|
73
|
-
* The
|
|
106
|
+
* The information about the delete information.
|
|
107
|
+
* Always set when the `delete` is true.
|
|
74
108
|
*/
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* The id of the user that has deleted the file.
|
|
78
|
-
*/
|
|
79
|
-
deletingUser?: string;
|
|
109
|
+
deletedInfo?: IDeletion;
|
|
80
110
|
/**
|
|
81
111
|
* The owner of this space. The id of the User object.
|
|
82
112
|
* Set to `default` when there are no users in the system (no authentication).
|
|
83
113
|
*/
|
|
84
114
|
owner: string;
|
|
115
|
+
/**
|
|
116
|
+
* The last modification made to this file.
|
|
117
|
+
*/
|
|
118
|
+
lastModified: IModification;
|
|
119
|
+
/**
|
|
120
|
+
* An arbitrary list of labels applied to the file.
|
|
121
|
+
*/
|
|
122
|
+
labels?: string[];
|
|
85
123
|
new(init: IStoredFile): void;
|
|
86
124
|
toJSON(): IStoredFile;
|
|
125
|
+
/**
|
|
126
|
+
* Updates the "lastModified" value.
|
|
127
|
+
* A helper method for a common task.
|
|
128
|
+
*
|
|
129
|
+
* @param user The user that modifies the entity.
|
|
130
|
+
*/
|
|
131
|
+
setLastModified(user: IUser): void;
|
|
132
|
+
/**
|
|
133
|
+
* Adds a label to the list of labels.
|
|
134
|
+
*
|
|
135
|
+
* It makes sure the value is a valid, non-empty string and the `labels` array is set.
|
|
136
|
+
*
|
|
137
|
+
* It does nothing when the label already exists.
|
|
138
|
+
*
|
|
139
|
+
* @param label The label to set.
|
|
140
|
+
*/
|
|
141
|
+
addLabel(label: string): void;
|
|
142
|
+
/**
|
|
143
|
+
* Marks the entity as deleted.
|
|
144
|
+
*
|
|
145
|
+
* A helper method for a common task.
|
|
146
|
+
*
|
|
147
|
+
* @param user The user that deletes the entity.
|
|
148
|
+
*/
|
|
149
|
+
setDeleted(user: IUser): void;
|
|
87
150
|
}
|
|
88
151
|
export declare class File extends StoredFile {
|
|
89
152
|
/**
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
+
import { Kind as UserKind } from './User.js';
|
|
2
|
+
import { Thing } from '../Thing.js';
|
|
3
|
+
import v4 from '../../lib/uuid.js';
|
|
1
4
|
export const DefaultOwner = 'default';
|
|
2
5
|
export class StoredFile {
|
|
6
|
+
/**
|
|
7
|
+
* The kind of the File
|
|
8
|
+
*/
|
|
9
|
+
kind = '';
|
|
10
|
+
/**
|
|
11
|
+
* The identifier of the entity
|
|
12
|
+
*/
|
|
13
|
+
key = '';
|
|
14
|
+
/**
|
|
15
|
+
* The name of the environment.
|
|
16
|
+
*/
|
|
17
|
+
info = Thing.fromName('');
|
|
3
18
|
/**
|
|
4
19
|
* The list of parents of the object. It is an ordered list of parents
|
|
5
20
|
* from the top (first element) to the lowest parent in the tree (last element).
|
|
@@ -20,52 +35,138 @@ export class StoredFile {
|
|
|
20
35
|
*/
|
|
21
36
|
deleted;
|
|
22
37
|
/**
|
|
23
|
-
* The
|
|
38
|
+
* The information about the delete information.
|
|
39
|
+
* Always set when the `delete` is true.
|
|
24
40
|
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The id of the user that has deleted the file.
|
|
28
|
-
*/
|
|
29
|
-
deletingUser;
|
|
41
|
+
deletedInfo;
|
|
30
42
|
/**
|
|
31
43
|
* The owner of this space. The id of the User object.
|
|
32
44
|
* Set to `default` when there are no users in the system (no authentication).
|
|
33
45
|
*/
|
|
34
|
-
owner =
|
|
46
|
+
owner = DefaultOwner;
|
|
47
|
+
/**
|
|
48
|
+
* The last modification made to this file.
|
|
49
|
+
*/
|
|
50
|
+
lastModified = { user: '', time: 0, byMe: false };
|
|
51
|
+
/**
|
|
52
|
+
* An arbitrary list of labels applied to the file.
|
|
53
|
+
*/
|
|
54
|
+
labels;
|
|
35
55
|
new(init) {
|
|
36
|
-
const { parents = [], permissionIds = [], deleted,
|
|
56
|
+
const { key = v4(), info, kind, parents = [], permissionIds = [], deleted, deletedInfo, owner = DefaultOwner, lastModified, labels } = init;
|
|
57
|
+
this.key = key;
|
|
58
|
+
this.kind = kind;
|
|
59
|
+
if (info) {
|
|
60
|
+
this.info = new Thing(info);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
this.info = Thing.fromName('');
|
|
64
|
+
}
|
|
37
65
|
this.parents = parents;
|
|
38
66
|
this.permissionIds = permissionIds;
|
|
39
67
|
this.owner = owner;
|
|
68
|
+
this.lastModified = lastModified ? { ...lastModified } : { user: '', time: 0, byMe: false };
|
|
40
69
|
if (typeof deleted === 'boolean') {
|
|
41
70
|
this.deleted = deleted;
|
|
42
|
-
this.
|
|
43
|
-
this.deletingUser = deletingUser;
|
|
71
|
+
this.deletedInfo = deletedInfo ? { ...deletedInfo } : undefined;
|
|
44
72
|
}
|
|
45
73
|
else {
|
|
46
74
|
this.deleted = undefined;
|
|
47
|
-
this.
|
|
48
|
-
|
|
75
|
+
this.deletedInfo = undefined;
|
|
76
|
+
}
|
|
77
|
+
if (Array.isArray(labels)) {
|
|
78
|
+
this.labels = labels;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.labels = undefined;
|
|
49
82
|
}
|
|
50
83
|
}
|
|
51
84
|
toJSON() {
|
|
52
85
|
const { owner = DefaultOwner } = this;
|
|
53
86
|
const result = {
|
|
87
|
+
key: this.key,
|
|
88
|
+
kind: this.kind,
|
|
89
|
+
info: this.info.toJSON(),
|
|
54
90
|
parents: this.parents,
|
|
55
91
|
permissionIds: this.permissionIds,
|
|
92
|
+
lastModified: this.lastModified,
|
|
56
93
|
owner,
|
|
57
94
|
};
|
|
58
|
-
if (
|
|
95
|
+
if (this.deleted) {
|
|
59
96
|
result.deleted = this.deleted;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
result.deletingUser = this.deletingUser;
|
|
65
|
-
}
|
|
97
|
+
result.deletedInfo = this.deletedInfo;
|
|
98
|
+
}
|
|
99
|
+
if (Array.isArray(this.labels)) {
|
|
100
|
+
result.labels = this.labels;
|
|
66
101
|
}
|
|
67
102
|
return result;
|
|
68
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Updates the "lastModified" value.
|
|
106
|
+
* A helper method for a common task.
|
|
107
|
+
*
|
|
108
|
+
* @param user The user that modifies the entity.
|
|
109
|
+
*/
|
|
110
|
+
setLastModified(user) {
|
|
111
|
+
if (!user) {
|
|
112
|
+
throw new Error(`The user is required.`);
|
|
113
|
+
}
|
|
114
|
+
if (user.kind !== UserKind) {
|
|
115
|
+
throw new Error(`Invalid value for the user when setting "lastModified".`);
|
|
116
|
+
}
|
|
117
|
+
this.lastModified = {
|
|
118
|
+
byMe: false,
|
|
119
|
+
time: Date.now(),
|
|
120
|
+
user: user.key,
|
|
121
|
+
name: user.name,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Adds a label to the list of labels.
|
|
126
|
+
*
|
|
127
|
+
* It makes sure the value is a valid, non-empty string and the `labels` array is set.
|
|
128
|
+
*
|
|
129
|
+
* It does nothing when the label already exists.
|
|
130
|
+
*
|
|
131
|
+
* @param label The label to set.
|
|
132
|
+
*/
|
|
133
|
+
addLabel(label) {
|
|
134
|
+
if (typeof label !== 'string') {
|
|
135
|
+
throw new Error(`The label must be a string.`);
|
|
136
|
+
}
|
|
137
|
+
if (!label.trim()) {
|
|
138
|
+
throw new Error(`The label is required.`);
|
|
139
|
+
}
|
|
140
|
+
if (!Array.isArray(this.labels)) {
|
|
141
|
+
this.labels = [];
|
|
142
|
+
}
|
|
143
|
+
if (this.labels.includes(label)) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
this.labels.push(label);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Marks the entity as deleted.
|
|
150
|
+
*
|
|
151
|
+
* A helper method for a common task.
|
|
152
|
+
*
|
|
153
|
+
* @param user The user that deletes the entity.
|
|
154
|
+
*/
|
|
155
|
+
setDeleted(user) {
|
|
156
|
+
if (!user) {
|
|
157
|
+
throw new Error(`The user is required.`);
|
|
158
|
+
}
|
|
159
|
+
if (user.kind !== UserKind) {
|
|
160
|
+
throw new Error(`Invalid value for the user when setting "lastModified".`);
|
|
161
|
+
}
|
|
162
|
+
this.deleted = true;
|
|
163
|
+
this.deletedInfo = {
|
|
164
|
+
byMe: false,
|
|
165
|
+
time: Date.now(),
|
|
166
|
+
user: user.key,
|
|
167
|
+
name: user.name,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
69
170
|
}
|
|
70
171
|
export class File extends StoredFile {
|
|
71
172
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"File.js","sourceRoot":"","sources":["../../../../src/models/store/File.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"File.js","sourceRoot":"","sources":["../../../../src/models/store/File.ts"],"names":[],"mappings":"AAGA,OAAO,EAAS,IAA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AAC;SAC1C;QACD,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;SAC5E;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG;YACjB,IAAI,EAAE,KAAK;YACX,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE;YAChB,IAAI,EAAE,IAAI,CAAC,GAAG;YACd,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,IAAK,SAAQ,UAAU;IAClC;;;;;OAKG;IACH,WAAW,GAAkB,EAAE,CAAC;IAEhC,GAAG,CAAC,IAAW;QACb,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChB,MAAM,EAAE,WAAW,GAAC,EAAE,EAAE,GAAG,IAAI,CAAC;QAChC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,MAAM;QACJ,MAAM,MAAM,GAAU;YACpB,GAAG,KAAK,CAAC,MAAM,EAAE;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Information about a modification of a File.
|
|
3
|
+
*/
|
|
4
|
+
export interface IModification {
|
|
5
|
+
/**
|
|
6
|
+
* The key of the user modifying the record.
|
|
7
|
+
*/
|
|
8
|
+
user: string;
|
|
9
|
+
/**
|
|
10
|
+
* User name modifying the record. May not be set when there's no actual user.
|
|
11
|
+
*/
|
|
12
|
+
name?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the modification was performed by the requesting the data user.
|
|
15
|
+
*
|
|
16
|
+
* Note for store implementers, this field should not be stored and populated every time the
|
|
17
|
+
* record is requested.
|
|
18
|
+
*/
|
|
19
|
+
byMe: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* A timestamp when the object was modified.
|
|
22
|
+
*/
|
|
23
|
+
time: number;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modification.js","sourceRoot":"","sources":["../../../../src/models/store/Modification.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { SerializableError, ISerializedError } from '../../models/SerializableError.js';
|
|
2
|
+
export interface IApiError {
|
|
3
|
+
/**
|
|
4
|
+
* Indicates the response is an error.
|
|
5
|
+
*/
|
|
6
|
+
error: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* The same as the status code but returned with the body.
|
|
9
|
+
*/
|
|
10
|
+
code: number;
|
|
11
|
+
/**
|
|
12
|
+
* The human-readable error message
|
|
13
|
+
*/
|
|
14
|
+
message: string;
|
|
15
|
+
/**
|
|
16
|
+
* The detailed message about the error, if any.
|
|
17
|
+
*/
|
|
18
|
+
detail?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class ApiError {
|
|
21
|
+
get name(): string;
|
|
22
|
+
code: number;
|
|
23
|
+
message: string;
|
|
24
|
+
detail?: string;
|
|
25
|
+
constructor(message: string, code: number);
|
|
26
|
+
constructor(init: IApiError);
|
|
27
|
+
toJSON(): IApiError;
|
|
28
|
+
toString(): string;
|
|
29
|
+
}
|
|
30
|
+
export interface ISdkError extends ISerializedError {
|
|
31
|
+
/**
|
|
32
|
+
* The raw response from the server.
|
|
33
|
+
*/
|
|
34
|
+
response?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Optional detailed message returned by the server.
|
|
37
|
+
*/
|
|
38
|
+
detail?: string;
|
|
39
|
+
}
|
|
40
|
+
export declare class SdkError extends SerializableError {
|
|
41
|
+
/**
|
|
42
|
+
* The raw response from the server.
|
|
43
|
+
*/
|
|
44
|
+
response?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Optional detailed message returned by the server.
|
|
47
|
+
*/
|
|
48
|
+
detail?: string;
|
|
49
|
+
toJSON(): ISdkError;
|
|
50
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { SerializableError } from '../../models/SerializableError.js';
|
|
2
|
+
export class ApiError {
|
|
3
|
+
get name() {
|
|
4
|
+
return 'ApiError';
|
|
5
|
+
}
|
|
6
|
+
code;
|
|
7
|
+
message;
|
|
8
|
+
detail;
|
|
9
|
+
constructor(messageOrInit, code) {
|
|
10
|
+
if (typeof messageOrInit === 'string') {
|
|
11
|
+
if (typeof code === 'number') {
|
|
12
|
+
this.code = code;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
this.code = 0;
|
|
16
|
+
}
|
|
17
|
+
this.message = messageOrInit;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
this.message = messageOrInit.message;
|
|
21
|
+
this.code = messageOrInit.code;
|
|
22
|
+
if (messageOrInit.detail) {
|
|
23
|
+
this.detail = messageOrInit.detail;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
toJSON() {
|
|
28
|
+
const { message, code, detail } = this;
|
|
29
|
+
const result = {
|
|
30
|
+
error: true,
|
|
31
|
+
message,
|
|
32
|
+
code,
|
|
33
|
+
};
|
|
34
|
+
if (detail) {
|
|
35
|
+
result.detail = detail;
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
toString() {
|
|
40
|
+
return this.message;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export class SdkError extends SerializableError {
|
|
44
|
+
/**
|
|
45
|
+
* The raw response from the server.
|
|
46
|
+
*/
|
|
47
|
+
response;
|
|
48
|
+
/**
|
|
49
|
+
* Optional detailed message returned by the server.
|
|
50
|
+
*/
|
|
51
|
+
detail;
|
|
52
|
+
toJSON() {
|
|
53
|
+
const result = super.toJSON();
|
|
54
|
+
if (this.response) {
|
|
55
|
+
result.response = this.response;
|
|
56
|
+
}
|
|
57
|
+
if (this.detail) {
|
|
58
|
+
result.detail = this.detail;
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=Errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Errors.js","sourceRoot":"","sources":["../../../../src/runtime/store/Errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAoB,MAAM,mCAAmC,CAAC;AAqBxF,MAAM,OAAO,QAAQ;IACnB,IAAI,IAAI;QACN,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,IAAI,CAAS;IACb,OAAO,CAAS;IAChB,MAAM,CAAU;IAKhB,YAAY,aAAiC,EAAE,IAAa;QAC1D,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE;YACrC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;gBAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;aAClB;iBAAM;gBACL,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;aACf;YACD,IAAI,CAAC,OAAO,GAAG,aAAa,CAAC;SAC9B;aAAM;YACL,IAAI,CAAC,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;YACrC,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC;YAC/B,IAAI,aAAa,CAAC,MAAM,EAAE;gBACxB,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;aACpC;SACF;IACH,CAAC;IAED,MAAM;QACJ,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACvC,MAAM,MAAM,GAAc;YACxB,KAAK,EAAE,IAAI;YACX,OAAO;YACP,IAAI;SACL,CAAC;QACF,IAAI,MAAM,EAAE;YACV,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;SACxB;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAaD,MAAM,OAAO,QAAS,SAAQ,iBAAiB;IAC7C;;OAEG;IACH,QAAQ,CAAU;IAClB;;OAEG;IACH,MAAM,CAAU;IAEhB,MAAM;QACJ,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAC9B,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;SACjC;QACD,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;SAC7B;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import WebSocketNode from 'ws';
|
|
2
|
+
import { JsonPatch } from 'json8-patch';
|
|
3
|
+
import { SdkBase, ISdkRequestOptions } from './SdkBase.js';
|
|
4
|
+
import { IListOptions, IListResponse } from '../../models/Backend.js';
|
|
5
|
+
import { AccessOperation } from '../../models/store/Permission.js';
|
|
6
|
+
import { IUser } from '../../models/store/User.js';
|
|
7
|
+
import { IFile } from '../../models/store/File.js';
|
|
8
|
+
import { Kind as ProjectKind } from '../../models/Project.js';
|
|
9
|
+
import { Kind as WorkspaceKind } from '../../models/Workspace.js';
|
|
10
|
+
import { IHttpProject } from '../../models/HttpProject.js';
|
|
11
|
+
export interface IFileCreateOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Optional parent file id.
|
|
14
|
+
* When set it creates a file under this parent.
|
|
15
|
+
*/
|
|
16
|
+
parent?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class FilesSdk extends SdkBase {
|
|
19
|
+
/**
|
|
20
|
+
* Lists files (spaces, projects, etc) in the store.
|
|
21
|
+
*
|
|
22
|
+
* @param kinds the list of kinds to list. Spaces are always included.
|
|
23
|
+
* @param options Optional query options.
|
|
24
|
+
* @param request Optional request options.
|
|
25
|
+
*/
|
|
26
|
+
list(kinds: (typeof ProjectKind | typeof WorkspaceKind)[], options?: IListOptions, request?: ISdkRequestOptions): Promise<IListResponse<IFile>>;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a file in the store.
|
|
29
|
+
*
|
|
30
|
+
* @param file The definition of a file that extends the IFile interface or one of the supported by the server schemas.
|
|
31
|
+
* @param request Optional request options.
|
|
32
|
+
* @returns The key of the creates file.
|
|
33
|
+
*/
|
|
34
|
+
create(file: IFile | IHttpProject, opts?: IFileCreateOptions, request?: ISdkRequestOptions): Promise<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Reads file metadata from the store.
|
|
37
|
+
*
|
|
38
|
+
* @param key The file key
|
|
39
|
+
* @param request Optional request options.
|
|
40
|
+
* @returns THe file metadata
|
|
41
|
+
*/
|
|
42
|
+
read(key: string, media: false, request?: ISdkRequestOptions): Promise<IFile>;
|
|
43
|
+
/**
|
|
44
|
+
* Reads file contents from the store.
|
|
45
|
+
*
|
|
46
|
+
* @param key The file key
|
|
47
|
+
* @param request Optional request options.
|
|
48
|
+
* @returns THe file contents
|
|
49
|
+
*/
|
|
50
|
+
read(key: string, media: true, request?: ISdkRequestOptions): Promise<unknown>;
|
|
51
|
+
/**
|
|
52
|
+
* Patches file's meta in the store.
|
|
53
|
+
*
|
|
54
|
+
* @param key The file key
|
|
55
|
+
* @param value The patch to apply.
|
|
56
|
+
* @param request Optional request options.
|
|
57
|
+
*/
|
|
58
|
+
patch(key: string, value: JsonPatch, media: false, request?: ISdkRequestOptions): Promise<JsonPatch>;
|
|
59
|
+
/**
|
|
60
|
+
* Patches file's content in the store.
|
|
61
|
+
*
|
|
62
|
+
* @param key The file key
|
|
63
|
+
* @param value The patch to apply.
|
|
64
|
+
* @param request Optional request options.
|
|
65
|
+
*/
|
|
66
|
+
patch(key: string, value: JsonPatch, media: true, request?: ISdkRequestOptions): Promise<JsonPatch>;
|
|
67
|
+
/**
|
|
68
|
+
* Deletes the file in the store.
|
|
69
|
+
*
|
|
70
|
+
* @param key The key of the file to delete.
|
|
71
|
+
* @param request Optional request options.
|
|
72
|
+
*/
|
|
73
|
+
delete(key: string, request?: ISdkRequestOptions): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Updates the sharing options of the file.
|
|
76
|
+
*
|
|
77
|
+
* @param key The file key
|
|
78
|
+
* @param value The patch operation on the file's ACL
|
|
79
|
+
* @param request Optional request options.
|
|
80
|
+
*/
|
|
81
|
+
patchUsers(key: string, value: AccessOperation[], request?: ISdkRequestOptions): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Lists uses having access to the file.
|
|
84
|
+
*
|
|
85
|
+
* @param key The file key
|
|
86
|
+
* @param request Optional request options.
|
|
87
|
+
*/
|
|
88
|
+
listUsers(key: string, request?: ISdkRequestOptions): Promise<IListResponse<IUser>>;
|
|
89
|
+
/**
|
|
90
|
+
* Creates a WS client that listens to the files events.
|
|
91
|
+
* @param request Optional request options.
|
|
92
|
+
*/
|
|
93
|
+
observeFiles(request?: ISdkRequestOptions): Promise<WebSocketNode | WebSocket>;
|
|
94
|
+
}
|