@api-client/core 0.5.0 → 0.5.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/build/browser.d.ts +4 -5
- package/build/browser.js +4 -4
- package/build/browser.js.map +1 -1
- package/build/index.d.ts +4 -5
- package/build/index.js +4 -4
- package/build/index.js.map +1 -1
- package/build/src/models/Backend.d.ts +2 -1
- 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/Thing.js +1 -1
- package/build/src/models/Thing.js.map +1 -1
- package/build/src/models/Workspace.d.ts +0 -28
- package/build/src/models/Workspace.js +4 -29
- 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 +81 -8
- package/build/src/models/store/File.js +126 -16
- 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/models/store/Permission.d.ts +17 -10
- package/build/src/models/store/Permission.js +10 -0
- package/build/src/models/store/Permission.js.map +1 -1
- package/build/src/runtime/store/RouteBuilder.d.ts +1 -0
- package/build/src/runtime/store/RouteBuilder.js +3 -0
- package/build/src/runtime/store/RouteBuilder.js.map +1 -1
- package/build/src/runtime/store/Sdk.d.ts +5 -0
- package/build/src/runtime/store/Sdk.js +8 -0
- package/build/src/runtime/store/Sdk.js.map +1 -1
- package/build/src/runtime/store/SharedSdk.d.ts +9 -0
- package/build/src/runtime/store/SharedSdk.js +35 -0
- package/build/src/runtime/store/SharedSdk.js.map +1 -0
- package/build/src/runtime/store/SpacesSdk.d.ts +13 -1
- package/build/src/runtime/store/SpacesSdk.js +11 -2
- package/build/src/runtime/store/SpacesSdk.js.map +1 -1
- package/build/src/runtime/store/StoreSdkNode.d.ts +2 -0
- package/build/src/runtime/store/StoreSdkNode.js.map +1 -1
- package/build/src/runtime/store/StoreSdkWeb.d.ts +2 -0
- package/build/src/runtime/store/StoreSdkWeb.js.map +1 -1
- package/package.json +1 -1
- package/src/models/Backend.ts +2 -1
- package/src/models/Project.ts +110 -0
- package/src/models/RevisionInfo.ts +6 -0
- package/src/models/Thing.ts +1 -1
- package/src/models/Workspace.ts +6 -44
- package/src/models/store/Deletion.ts +24 -0
- package/src/models/store/File.ts +155 -21
- package/src/models/store/Modification.ts +24 -0
- package/src/models/store/Permission.ts +24 -10
- package/src/runtime/store/RouteBuilder.ts +4 -0
- package/src/runtime/store/Sdk.ts +8 -0
- package/src/runtime/store/SharedSdk.ts +35 -0
- package/src/runtime/store/SpacesSdk.ts +21 -2
- package/src/runtime/store/StoreSdkNode.ts +3 -0
- package/src/runtime/store/StoreSdkWeb.ts +3 -0
- 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/src/models/HttpProjectListItem.ts +0 -23
|
@@ -1,5 +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';
|
|
6
|
+
export declare const DefaultOwner = "default";
|
|
2
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;
|
|
3
20
|
/**
|
|
4
21
|
* The list of parents of the object. It is an ordered list of parents
|
|
5
22
|
* from the top (first element) to the lowest parent in the tree (last element).
|
|
@@ -20,13 +37,22 @@ export interface IStoredFile {
|
|
|
20
37
|
*/
|
|
21
38
|
deleted?: boolean;
|
|
22
39
|
/**
|
|
23
|
-
* The
|
|
40
|
+
* The information about the delete information.
|
|
41
|
+
* Always set when the `delete` is true.
|
|
42
|
+
*/
|
|
43
|
+
deletedInfo?: IDeletion;
|
|
44
|
+
/**
|
|
45
|
+
* The owner of this object. The id of the User object.
|
|
24
46
|
*/
|
|
25
|
-
|
|
47
|
+
owner: string;
|
|
26
48
|
/**
|
|
27
|
-
* The
|
|
49
|
+
* The last modification made to this file.
|
|
28
50
|
*/
|
|
29
|
-
|
|
51
|
+
lastModified: IModification;
|
|
52
|
+
/**
|
|
53
|
+
* An arbitrary list of labels applied to the file.
|
|
54
|
+
*/
|
|
55
|
+
labels?: string[];
|
|
30
56
|
}
|
|
31
57
|
/**
|
|
32
58
|
* An interface describing an object in the data store that
|
|
@@ -45,6 +71,18 @@ export interface IFile extends IStoredFile {
|
|
|
45
71
|
permissions: IPermission[];
|
|
46
72
|
}
|
|
47
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;
|
|
48
86
|
/**
|
|
49
87
|
* The list of parents of the object. It is an ordered list of parents
|
|
50
88
|
* from the top (first element) to the lowest parent in the tree (last element).
|
|
@@ -65,15 +103,50 @@ export declare class StoredFile {
|
|
|
65
103
|
*/
|
|
66
104
|
deleted?: boolean;
|
|
67
105
|
/**
|
|
68
|
-
* The
|
|
106
|
+
* The information about the delete information.
|
|
107
|
+
* Always set when the `delete` is true.
|
|
69
108
|
*/
|
|
70
|
-
|
|
109
|
+
deletedInfo?: IDeletion;
|
|
71
110
|
/**
|
|
72
|
-
* The
|
|
111
|
+
* The owner of this space. The id of the User object.
|
|
112
|
+
* Set to `default` when there are no users in the system (no authentication).
|
|
73
113
|
*/
|
|
74
|
-
|
|
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[];
|
|
75
123
|
new(init: IStoredFile): void;
|
|
76
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;
|
|
77
150
|
}
|
|
78
151
|
export declare class File extends StoredFile {
|
|
79
152
|
/**
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
+
import { Kind as UserKind } from './User.js';
|
|
2
|
+
import { Thing } from '../Thing.js';
|
|
3
|
+
import v4 from '../../lib/uuid.js';
|
|
4
|
+
export const DefaultOwner = 'default';
|
|
1
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('');
|
|
2
18
|
/**
|
|
3
19
|
* The list of parents of the object. It is an ordered list of parents
|
|
4
20
|
* from the top (first element) to the lowest parent in the tree (last element).
|
|
@@ -19,44 +35,138 @@ export class StoredFile {
|
|
|
19
35
|
*/
|
|
20
36
|
deleted;
|
|
21
37
|
/**
|
|
22
|
-
* The
|
|
38
|
+
* The information about the delete information.
|
|
39
|
+
* Always set when the `delete` is true.
|
|
23
40
|
*/
|
|
24
|
-
|
|
41
|
+
deletedInfo;
|
|
25
42
|
/**
|
|
26
|
-
* The
|
|
43
|
+
* The owner of this space. The id of the User object.
|
|
44
|
+
* Set to `default` when there are no users in the system (no authentication).
|
|
27
45
|
*/
|
|
28
|
-
|
|
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;
|
|
29
55
|
new(init) {
|
|
30
|
-
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
|
+
}
|
|
31
65
|
this.parents = parents;
|
|
32
66
|
this.permissionIds = permissionIds;
|
|
67
|
+
this.owner = owner;
|
|
68
|
+
this.lastModified = lastModified || { user: '', time: 0, byMe: false };
|
|
33
69
|
if (typeof deleted === 'boolean') {
|
|
34
70
|
this.deleted = deleted;
|
|
35
|
-
this.
|
|
36
|
-
this.deletingUser = deletingUser;
|
|
71
|
+
this.deletedInfo = deletedInfo;
|
|
37
72
|
}
|
|
38
73
|
else {
|
|
39
74
|
this.deleted = undefined;
|
|
40
|
-
this.
|
|
41
|
-
|
|
75
|
+
this.deletedInfo = undefined;
|
|
76
|
+
}
|
|
77
|
+
if (Array.isArray(labels)) {
|
|
78
|
+
this.labels = labels;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.labels = undefined;
|
|
42
82
|
}
|
|
43
83
|
}
|
|
44
84
|
toJSON() {
|
|
85
|
+
const { owner = DefaultOwner } = this;
|
|
45
86
|
const result = {
|
|
87
|
+
key: this.key,
|
|
88
|
+
kind: this.kind,
|
|
89
|
+
info: this.info.toJSON(),
|
|
46
90
|
parents: this.parents,
|
|
47
91
|
permissionIds: this.permissionIds,
|
|
92
|
+
lastModified: this.lastModified,
|
|
93
|
+
owner,
|
|
48
94
|
};
|
|
49
|
-
if (
|
|
95
|
+
if (this.deleted) {
|
|
50
96
|
result.deleted = this.deleted;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
result.deletingUser = this.deletingUser;
|
|
56
|
-
}
|
|
97
|
+
result.deletedInfo = this.deletedInfo;
|
|
98
|
+
}
|
|
99
|
+
if (Array.isArray(this.labels)) {
|
|
100
|
+
result.labels = this.labels;
|
|
57
101
|
}
|
|
58
102
|
return result;
|
|
59
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
|
+
}
|
|
60
170
|
}
|
|
61
171
|
export class File extends StoredFile {
|
|
62
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,IAAI,IAAI,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAU,KAAK,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEnC,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC;AAsEtC,MAAM,OAAO,UAAU;IACrB;;OAEG;IACH,IAAI,GAAG,EAAE,CAAC;IACV;;OAEG;IACH,GAAG,GAAG,EAAE,CAAC;IACT;;OAEG;IACH,IAAI,GAAU,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACjC;;;;;;OAMG;IACH,OAAO,GAAa,EAAE,CAAC;IACvB;;;;;OAKG;IACH,aAAa,GAAa,EAAE,CAAC;IAC7B;;OAEG;IACH,OAAO,CAAW;IAClB;;;OAGG;IACH,WAAW,CAAa;IACxB;;;OAGG;IACH,KAAK,GAAG,YAAY,CAAC;IACrB;;OAEG;IACH,YAAY,GAAkB,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACjE;;OAEG;IACH,MAAM,CAAY;IAElB,GAAG,CAAC,IAAiB;QACnB,MAAM,EAAE,GAAG,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,GAAC,EAAE,EAAE,aAAa,GAAC,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,GAAG,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACxI,IAAI,CAAC,GAAG,GAAG,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K,CAAC,CAAC;IAC1B,CAAC;IAED;;;;;;OAMG;IACH,UAAU,CAAC,IAAW;QACpB,IAAI,CAAC,IAAI,EAAE;YACT,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;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":""}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
export declare const Kind = "Core#Permission";
|
|
2
2
|
export declare type PermissionType = 'user' | 'group' | 'anyone';
|
|
3
3
|
export declare type PermissionRole = 'owner' | 'reader' | 'commenter' | 'writer';
|
|
4
|
-
|
|
5
|
-
* A schema describing a permission to a store object.
|
|
6
|
-
*/
|
|
7
|
-
export interface IPermission {
|
|
8
|
-
kind: typeof Kind;
|
|
9
|
-
/**
|
|
10
|
-
* The data store key of the permission.
|
|
11
|
-
* This property is generated by the store and is not writable.
|
|
12
|
-
*/
|
|
13
|
-
key: string;
|
|
4
|
+
interface IBasePermission {
|
|
14
5
|
/**
|
|
15
6
|
* The type of the permission.
|
|
16
7
|
*
|
|
@@ -65,6 +56,17 @@ export interface IPermission {
|
|
|
65
56
|
*/
|
|
66
57
|
deletingUser?: string;
|
|
67
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* A schema describing a permission to a store object.
|
|
61
|
+
*/
|
|
62
|
+
export interface IPermission extends IBasePermission {
|
|
63
|
+
kind: typeof Kind;
|
|
64
|
+
/**
|
|
65
|
+
* The data store key of the permission.
|
|
66
|
+
* This property is generated by the store and is not writable.
|
|
67
|
+
*/
|
|
68
|
+
key: string;
|
|
69
|
+
}
|
|
68
70
|
export declare class Permission {
|
|
69
71
|
kind: string;
|
|
70
72
|
/**
|
|
@@ -146,6 +148,10 @@ export declare class Permission {
|
|
|
146
148
|
* @param group The group id that has the role.
|
|
147
149
|
*/
|
|
148
150
|
static fromAnyoneRole(role: PermissionRole, addingUser: string): Permission;
|
|
151
|
+
/**
|
|
152
|
+
* Creates a permission object from other than key and kind values.
|
|
153
|
+
*/
|
|
154
|
+
static fromValues(init: IBasePermission): Permission;
|
|
149
155
|
constructor(input?: string | IPermission);
|
|
150
156
|
/**
|
|
151
157
|
* Creates a new environment clearing anything that is so far defined.
|
|
@@ -187,3 +193,4 @@ export interface IAccessRemoveOperation extends IAccessOperation {
|
|
|
187
193
|
op: "remove";
|
|
188
194
|
}
|
|
189
195
|
export declare type AccessOperation = IAccessAddOperation | IAccessRemoveOperation;
|
|
196
|
+
export {};
|
|
@@ -110,6 +110,16 @@ export class Permission {
|
|
|
110
110
|
};
|
|
111
111
|
return new Permission(init);
|
|
112
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Creates a permission object from other than key and kind values.
|
|
115
|
+
*/
|
|
116
|
+
static fromValues(init) {
|
|
117
|
+
return new Permission({
|
|
118
|
+
...init,
|
|
119
|
+
key: v4(),
|
|
120
|
+
kind: Kind,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
113
123
|
constructor(input) {
|
|
114
124
|
let init;
|
|
115
125
|
if (typeof input === 'string') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Permission.js","sourceRoot":"","sources":["../../../../src/models/store/Permission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEnC,MAAM,CAAC,MAAM,IAAI,GAAG,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"Permission.js","sourceRoot":"","sources":["../../../../src/models/store/Permission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEnC,MAAM,CAAC,MAAM,IAAI,GAAG,iBAAiB,CAAC;AA0EtC,MAAM,OAAO,UAAU;IACrB,IAAI,GAAG,IAAI,CAAC;IACZ;;;OAGG;IACH,GAAG,GAAG,EAAE,CAAC;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,GAAG,IAAI,CAAC,cAAc,CAAC;SAC7C;QACD,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE;YACrC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAE9B,IAAI,IAAI,CAAC,WAAW,EAAE;gBACpB,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;aACvC;YACD,IAAI,IAAI,CAAC,YAAY,EAAE;gBACrB,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;aACzC;SACF;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteBuilder.js","sourceRoot":"","sources":["../../../../src/runtime/store/RouteBuilder.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,YAAY;IACvB;;OAEG;IACH,MAAM,CAAC,MAAM;QACX,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,GAAW;QACtB,OAAO,WAAW,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,GAAW;QAC3B,OAAO,WAAW,GAAG,QAAQ,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,GAAW;QAC9B,OAAO,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,KAAa,EAAE,OAAe;QAChD,OAAO,WAAW,KAAK,aAAa,OAAO,EAAE,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAa,EAAE,OAAe;QACpD,OAAO,WAAW,KAAK,aAAa,OAAO,YAAY,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,OAAO;QACZ,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,CAAC,QAAQ;QACb,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,MAAM,CAAC,YAAY;QACjB,OAAO,iBAAiB,CAAA;IAC1B,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,MAAM,CAAC,KAAK;QACV,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,GAAW;QACrB,OAAO,UAAU,GAAG,EAAE,CAAA;IACxB,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,MAAM,CAAC,kBAAkB;QACvB,OAAO,uBAAuB,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,kBAAkB;QACvB,OAAO,uBAAuB,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,GAAW;QAC5B,OAAO,YAAY,GAAG,EAAE,CAAC;IAC3B,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"RouteBuilder.js","sourceRoot":"","sources":["../../../../src/runtime/store/RouteBuilder.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,YAAY;IACvB;;OAEG;IACH,MAAM,CAAC,MAAM;QACX,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,GAAW;QACtB,OAAO,WAAW,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,GAAW;QAC3B,OAAO,WAAW,GAAG,QAAQ,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,GAAW;QAC9B,OAAO,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,KAAa,EAAE,OAAe;QAChD,OAAO,WAAW,KAAK,aAAa,OAAO,EAAE,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAa,EAAE,OAAe;QACpD,OAAO,WAAW,KAAK,aAAa,OAAO,YAAY,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,OAAO;QACZ,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,CAAC,QAAQ;QACb,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,MAAM,CAAC,YAAY;QACjB,OAAO,iBAAiB,CAAA;IAC1B,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,MAAM,CAAC,KAAK;QACV,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,GAAW;QACrB,OAAO,UAAU,GAAG,EAAE,CAAA;IACxB,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,MAAM,CAAC,kBAAkB;QACvB,OAAO,uBAAuB,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,kBAAkB;QACvB,OAAO,uBAAuB,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,GAAW;QAC5B,OAAO,YAAY,GAAG,EAAE,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,YAAY;QACjB,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -7,6 +7,7 @@ import { SpacesSdk } from './SpacesSdk.js';
|
|
|
7
7
|
import { ProjectsSdk } from './ProjectsSdk.js';
|
|
8
8
|
import { UsersSdk } from './UsersSdk.js';
|
|
9
9
|
import { HistorySdk } from './HistorySdk.js';
|
|
10
|
+
import { SharedSdk } from './SharedSdk.js';
|
|
10
11
|
declare const baseUriSymbol: unique symbol;
|
|
11
12
|
/**
|
|
12
13
|
* NodeJS API for API Client's net-store module.
|
|
@@ -49,6 +50,10 @@ export declare abstract class Sdk {
|
|
|
49
50
|
* The history data.
|
|
50
51
|
*/
|
|
51
52
|
history: HistorySdk;
|
|
53
|
+
/**
|
|
54
|
+
* The shared data.
|
|
55
|
+
*/
|
|
56
|
+
shared: SharedSdk;
|
|
52
57
|
[baseUriSymbol]: string;
|
|
53
58
|
/**
|
|
54
59
|
* @returns The base URI to the store.
|
|
@@ -4,6 +4,7 @@ import { SpacesSdk } from './SpacesSdk.js';
|
|
|
4
4
|
import { ProjectsSdk } from './ProjectsSdk.js';
|
|
5
5
|
import { UsersSdk } from './UsersSdk.js';
|
|
6
6
|
import { HistorySdk } from './HistorySdk.js';
|
|
7
|
+
import { SharedSdk } from './SharedSdk.js';
|
|
7
8
|
const baseUriSymbol = Symbol('baseUri');
|
|
8
9
|
/**
|
|
9
10
|
* NodeJS API for API Client's net-store module.
|
|
@@ -38,6 +39,10 @@ export class Sdk {
|
|
|
38
39
|
* The history data.
|
|
39
40
|
*/
|
|
40
41
|
history = new HistorySdk(this);
|
|
42
|
+
/**
|
|
43
|
+
* The shared data.
|
|
44
|
+
*/
|
|
45
|
+
shared = new SharedSdk(this);
|
|
41
46
|
[baseUriSymbol] = '';
|
|
42
47
|
/**
|
|
43
48
|
* @returns The base URI to the store.
|
|
@@ -111,6 +116,9 @@ export class Sdk {
|
|
|
111
116
|
searchParams.append('queryField', field);
|
|
112
117
|
});
|
|
113
118
|
}
|
|
119
|
+
if (options.parent) {
|
|
120
|
+
searchParams.set('parent', options.parent);
|
|
121
|
+
}
|
|
114
122
|
}
|
|
115
123
|
}
|
|
116
124
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sdk.js","sourceRoot":"","sources":["../../../../src/runtime/store/Sdk.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,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B,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;SAC5C;aAAM;YACL,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,EAAE;gBACrC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;aAClD;YACD,IAAI,OAAO,CAAC,KAAK,EAAE;gBACjB,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;aAC1C;YACD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;gBACrC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;oBACnC,YAAY,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;gBAC3C,CAAC,CAAC,CAAC;aACJ;YACD,IAAI,OAAO,CAAC,MAAM,EAAE;gBAClB,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;aAC5C;SACF;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SdkBase } from './SdkBase.js';
|
|
2
|
+
import { IListOptions, IListResponse } from '../../models/Backend.js';
|
|
3
|
+
export declare class SharedSdk extends SdkBase {
|
|
4
|
+
/**
|
|
5
|
+
* Lists shared with the user spaces.
|
|
6
|
+
* @param options Optional query options.
|
|
7
|
+
*/
|
|
8
|
+
list(options?: IListOptions): Promise<IListResponse>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SdkBase, E_RESPONSE_STATUS, E_RESPONSE_NO_VALUE, E_INVALID_JSON, E_RESPONSE_UNKNOWN } from './SdkBase.js';
|
|
2
|
+
import { RouteBuilder } from './RouteBuilder.js';
|
|
3
|
+
export class SharedSdk extends SdkBase {
|
|
4
|
+
/**
|
|
5
|
+
* Lists shared with the user spaces.
|
|
6
|
+
* @param options Optional query options.
|
|
7
|
+
*/
|
|
8
|
+
async list(options) {
|
|
9
|
+
const { token } = this.sdk;
|
|
10
|
+
const url = this.sdk.getUrl(RouteBuilder.sharedSpaces());
|
|
11
|
+
this.sdk.appendListOptions(url, options);
|
|
12
|
+
const result = await this.sdk.http.get(url.toString(), { token });
|
|
13
|
+
this.inspectCommonStatusCodes(result.status);
|
|
14
|
+
const E_PREFIX = 'Unable to list spaces. ';
|
|
15
|
+
if (result.status !== 200) {
|
|
16
|
+
this.logInvalidResponse(result);
|
|
17
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`);
|
|
18
|
+
}
|
|
19
|
+
if (!result.body) {
|
|
20
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`);
|
|
21
|
+
}
|
|
22
|
+
let data;
|
|
23
|
+
try {
|
|
24
|
+
data = JSON.parse(result.body);
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
28
|
+
}
|
|
29
|
+
if (!Array.isArray(data.data)) {
|
|
30
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
31
|
+
}
|
|
32
|
+
return data;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=SharedSdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SharedSdk.js","sourceRoot":"","sources":["../../../../src/runtime/store/SharedSdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACnH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,MAAM,OAAO,SAAU,SAAQ,OAAO;IACpC;;;OAGG;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;IACd,CAAC;CACF"}
|
|
@@ -3,6 +3,14 @@ import { SdkBase } from './SdkBase.js';
|
|
|
3
3
|
import { IListOptions, IListResponse } from '../../models/Backend.js';
|
|
4
4
|
import { IWorkspace, Workspace } from '../../models/Workspace.js';
|
|
5
5
|
import { AccessOperation } from '../../models/store/Permission.js';
|
|
6
|
+
import WebSocketNode from 'ws';
|
|
7
|
+
export interface ISpaceCreateOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Optional parent space id.
|
|
10
|
+
* When set it creates a space under this parent.
|
|
11
|
+
*/
|
|
12
|
+
parent?: string;
|
|
13
|
+
}
|
|
6
14
|
export declare class SpacesSdk extends SdkBase {
|
|
7
15
|
/**
|
|
8
16
|
* Lists spaces in the store.
|
|
@@ -14,7 +22,7 @@ export declare class SpacesSdk extends SdkBase {
|
|
|
14
22
|
* @param space The workspace definition.
|
|
15
23
|
* @returns The key of the creates space.
|
|
16
24
|
*/
|
|
17
|
-
create(space: IWorkspace | Workspace): Promise<string>;
|
|
25
|
+
create(space: IWorkspace | Workspace, opts?: ISpaceCreateOptions): Promise<string>;
|
|
18
26
|
/**
|
|
19
27
|
* Reads a user space definition from the store.
|
|
20
28
|
* @param key The user space key
|
|
@@ -47,4 +55,8 @@ export declare class SpacesSdk extends SdkBase {
|
|
|
47
55
|
* @param key The user space key
|
|
48
56
|
*/
|
|
49
57
|
listUsers(key: string): Promise<IListResponse>;
|
|
58
|
+
/**
|
|
59
|
+
* Creates a WS client that listens to the spaces events.
|
|
60
|
+
*/
|
|
61
|
+
observeSpaces(): Promise<WebSocketNode | WebSocket>;
|
|
50
62
|
}
|
|
@@ -37,9 +37,10 @@ export class SpacesSdk extends SdkBase {
|
|
|
37
37
|
* @param space The workspace definition.
|
|
38
38
|
* @returns The key of the creates space.
|
|
39
39
|
*/
|
|
40
|
-
async create(space) {
|
|
40
|
+
async create(space, opts = {}) {
|
|
41
41
|
const { token } = this.sdk;
|
|
42
|
-
const
|
|
42
|
+
const path = opts.parent ? RouteBuilder.space(opts.parent) : RouteBuilder.spaces();
|
|
43
|
+
const url = this.sdk.getUrl(path);
|
|
43
44
|
const body = JSON.stringify(space);
|
|
44
45
|
const result = await this.sdk.http.post(url.toString(), { token, body });
|
|
45
46
|
this.inspectCommonStatusCodes(result.status);
|
|
@@ -181,5 +182,13 @@ export class SpacesSdk extends SdkBase {
|
|
|
181
182
|
}
|
|
182
183
|
return data;
|
|
183
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Creates a WS client that listens to the spaces events.
|
|
187
|
+
*/
|
|
188
|
+
async observeSpaces() {
|
|
189
|
+
const { token } = this.sdk;
|
|
190
|
+
const url = this.sdk.getUrl(RouteBuilder.spaces());
|
|
191
|
+
return this.sdk.ws.createAndConnect(url.toString(), token);
|
|
192
|
+
}
|
|
184
193
|
}
|
|
185
194
|
//# sourceMappingURL=SpacesSdk.js.map
|