@api-client/core 0.4.0 → 0.4.1
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 +5 -2
- package/build/browser.js +7 -2
- package/build/browser.js.map +1 -1
- package/build/index.d.ts +6 -4
- package/build/index.js +4 -3
- package/build/index.js.map +1 -1
- package/build/src/models/HttpHistory.d.ts +29 -0
- package/build/src/models/HttpHistory.js.map +1 -1
- package/build/src/models/RequestLog.d.ts +8 -0
- package/build/src/models/RequestLog.js +14 -1
- package/build/src/models/RequestLog.js.map +1 -1
- package/build/src/runtime/node/InteropInterfaces.d.ts +115 -0
- package/build/src/runtime/node/InteropInterfaces.js +2 -0
- package/build/src/runtime/node/InteropInterfaces.js.map +1 -0
- package/build/src/runtime/node/ProjectParallelRunner.d.ts +2 -7
- package/build/src/runtime/node/ProjectParallelRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRequestRunner.d.ts +17 -49
- package/build/src/runtime/node/ProjectRequestRunner.js +39 -10
- package/build/src/runtime/node/ProjectRequestRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRunner.d.ts +1 -59
- package/build/src/runtime/node/ProjectRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRunnerWorker.js.map +1 -1
- package/build/src/runtime/store/AuthSdk.d.ts +28 -0
- package/build/src/runtime/store/AuthSdk.js +123 -0
- package/build/src/runtime/store/AuthSdk.js.map +1 -0
- package/build/src/runtime/store/BackendSdk.d.ts +8 -0
- package/build/src/runtime/store/BackendSdk.js +25 -0
- package/build/src/runtime/store/BackendSdk.js.map +1 -0
- package/build/src/runtime/store/HistorySdk.d.ts +48 -0
- package/build/src/runtime/store/HistorySdk.js +142 -0
- package/build/src/runtime/store/HistorySdk.js.map +1 -0
- package/build/src/runtime/store/Http.d.ts +14 -0
- package/build/src/runtime/store/Http.js +4 -0
- package/build/src/runtime/store/Http.js.map +1 -0
- package/build/src/runtime/store/HttpNode.d.ts +16 -0
- package/build/src/runtime/store/HttpNode.js +95 -0
- package/build/src/runtime/store/HttpNode.js.map +1 -0
- package/build/src/runtime/store/HttpWeb.d.ts +15 -0
- package/build/src/runtime/store/HttpWeb.js +83 -0
- package/build/src/runtime/store/HttpWeb.js.map +1 -0
- package/build/src/runtime/store/ProjectsSdk.d.ts +43 -0
- package/build/src/runtime/store/ProjectsSdk.js +144 -0
- package/build/src/runtime/store/ProjectsSdk.js.map +1 -0
- package/build/src/runtime/store/RouteBuilder.d.ts +42 -0
- package/build/src/runtime/store/RouteBuilder.js +75 -0
- package/build/src/runtime/store/RouteBuilder.js.map +1 -0
- package/build/src/runtime/store/Sdk.d.ts +79 -0
- package/build/src/runtime/store/Sdk.js +117 -0
- package/build/src/runtime/store/Sdk.js.map +1 -0
- package/build/src/runtime/store/SdkBase.d.ts +45 -0
- package/build/src/runtime/store/SdkBase.js +40 -0
- package/build/src/runtime/store/SdkBase.js.map +1 -0
- package/build/src/runtime/store/SpacesSdk.d.ts +50 -0
- package/build/src/runtime/store/SpacesSdk.js +185 -0
- package/build/src/runtime/store/SpacesSdk.js.map +1 -0
- package/build/src/runtime/store/StoreSdkNode.d.ts +10 -0
- package/build/src/runtime/store/StoreSdkNode.js +11 -0
- package/build/src/runtime/store/StoreSdkNode.js.map +1 -0
- package/build/src/runtime/store/StoreSdkWeb.d.ts +10 -0
- package/build/src/runtime/store/StoreSdkWeb.js +11 -0
- package/build/src/runtime/store/StoreSdkWeb.js.map +1 -0
- package/build/src/runtime/store/UsersSdk.d.ts +18 -0
- package/build/src/runtime/store/UsersSdk.js +88 -0
- package/build/src/runtime/store/UsersSdk.js.map +1 -0
- package/build/src/runtime/store/WsClient.d.ts +24 -0
- package/build/src/runtime/store/WsClient.js +4 -0
- package/build/src/runtime/store/WsClient.js.map +1 -0
- package/build/src/runtime/store/WsClientNode.d.ts +24 -0
- package/build/src/runtime/store/WsClientNode.js +66 -0
- package/build/src/runtime/store/WsClientNode.js.map +1 -0
- package/build/src/runtime/store/WsClientWeb.d.ts +23 -0
- package/build/src/runtime/store/WsClientWeb.js +73 -0
- package/build/src/runtime/store/WsClientWeb.js.map +1 -0
- package/package.json +4 -6
- package/src/models/HttpHistory.ts +30 -0
- package/src/models/RequestLog.ts +17 -1
- package/src/runtime/node/InteropInterfaces.ts +121 -0
- package/src/runtime/node/ProjectParallelRunner.ts +2 -9
- package/src/runtime/node/ProjectRequestRunner.ts +42 -61
- package/src/runtime/node/ProjectRunner.ts +1 -60
- package/src/runtime/node/ProjectRunnerWorker.ts +2 -1
- package/src/runtime/store/AuthSdk.ts +126 -0
- package/src/runtime/store/BackendSdk.ts +25 -0
- package/src/runtime/store/HistorySdk.ts +157 -0
- package/src/runtime/store/Http.ts +18 -0
- package/src/runtime/store/HttpNode.ts +100 -0
- package/src/runtime/store/HttpWeb.ts +89 -0
- package/src/runtime/store/ProjectsSdk.ts +147 -0
- package/src/runtime/store/RouteBuilder.ts +89 -0
- package/src/runtime/store/Sdk.ts +131 -0
- package/src/runtime/store/SdkBase.ts +72 -0
- package/src/runtime/store/SpacesSdk.ts +190 -0
- package/src/runtime/store/StoreSdkNode.ts +13 -0
- package/src/runtime/store/StoreSdkWeb.ts +13 -0
- package/src/runtime/store/UsersSdk.ts +89 -0
- package/src/runtime/store/WsClient.ts +28 -0
- package/src/runtime/store/WsClientNode.ts +68 -0
- package/src/runtime/store/WsClientWeb.ts +75 -0
- package/build/src/models/HistoryIndex.d.ts +0 -45
- package/build/src/models/HistoryIndex.js +0 -56
- package/build/src/models/HistoryIndex.js.map +0 -1
- package/build/src/runtime/store/StoreSdk.d.ts +0 -279
- package/build/src/runtime/store/StoreSdk.js +0 -842
- package/build/src/runtime/store/StoreSdk.js.map +0 -1
- package/src/models/HistoryIndex.ts +0 -81
- package/src/runtime/store/StoreSdk.ts +0 -895
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import http from 'http';
|
|
2
|
+
import https from 'https';
|
|
3
|
+
import { Headers } from '../../lib/headers/Headers.js';
|
|
4
|
+
import { Http } from './Http.js';
|
|
5
|
+
export class HttpNode extends Http {
|
|
6
|
+
/**
|
|
7
|
+
* Performs the GET request.
|
|
8
|
+
*
|
|
9
|
+
* @param url The request URL
|
|
10
|
+
* @param opts The request options
|
|
11
|
+
* @returns The response info.
|
|
12
|
+
*/
|
|
13
|
+
async get(url, opts = {}) {
|
|
14
|
+
const result = await this._get(url, opts);
|
|
15
|
+
if ([301, 302, 308, 307].includes(result.status)) {
|
|
16
|
+
const loc = result.headers.get('location');
|
|
17
|
+
if (!loc) {
|
|
18
|
+
throw new Error('Expected redirection but no "location" header.');
|
|
19
|
+
}
|
|
20
|
+
const newUrl = new URL(loc, url);
|
|
21
|
+
return this.get(newUrl.toString(), opts);
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
_get(url, opts = {}) {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
const { method = 'GET', headers = {}, token = this.sdk.token } = opts;
|
|
28
|
+
if (token) {
|
|
29
|
+
headers.authorization = `Bearer ${token}`;
|
|
30
|
+
}
|
|
31
|
+
const isSsl = url.startsWith('https:');
|
|
32
|
+
const lib = isSsl ? https : http;
|
|
33
|
+
// console.log(`${method} ${url}`);
|
|
34
|
+
const request = lib.request(url, {
|
|
35
|
+
method,
|
|
36
|
+
headers,
|
|
37
|
+
rejectUnauthorized: false,
|
|
38
|
+
});
|
|
39
|
+
request.on('response', (response) => {
|
|
40
|
+
const ro = {
|
|
41
|
+
status: response.statusCode,
|
|
42
|
+
headers: new Headers(response.headers),
|
|
43
|
+
body: '',
|
|
44
|
+
};
|
|
45
|
+
response.on('data', (chunk) => {
|
|
46
|
+
ro.body += chunk;
|
|
47
|
+
});
|
|
48
|
+
response.on('end', () => resolve(ro));
|
|
49
|
+
});
|
|
50
|
+
request.on('error', (error) => reject(error));
|
|
51
|
+
request.end();
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
post(url, opts = {}) {
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
const { method = 'POST', headers = {}, token = this.sdk.token } = opts;
|
|
57
|
+
if (token) {
|
|
58
|
+
headers.authorization = `Bearer ${token}`;
|
|
59
|
+
}
|
|
60
|
+
const isSsl = url.startsWith('https:');
|
|
61
|
+
const lib = isSsl ? https : http;
|
|
62
|
+
const request = lib.request(url, {
|
|
63
|
+
method,
|
|
64
|
+
headers,
|
|
65
|
+
});
|
|
66
|
+
request.on('response', (response) => {
|
|
67
|
+
const ro = {
|
|
68
|
+
status: response.statusCode,
|
|
69
|
+
headers: new Headers(response.headers),
|
|
70
|
+
body: '',
|
|
71
|
+
};
|
|
72
|
+
response.on('data', (chunk) => {
|
|
73
|
+
ro.body += chunk;
|
|
74
|
+
});
|
|
75
|
+
response.on('end', () => resolve(ro));
|
|
76
|
+
});
|
|
77
|
+
request.on('error', (error) => reject(error));
|
|
78
|
+
if (opts.body) {
|
|
79
|
+
request.write(opts.body);
|
|
80
|
+
}
|
|
81
|
+
request.end();
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
patch(url, opts = {}) {
|
|
85
|
+
const options = { ...opts };
|
|
86
|
+
options.method = 'PATCH';
|
|
87
|
+
return this.post(url, options);
|
|
88
|
+
}
|
|
89
|
+
delete(url, opts = {}) {
|
|
90
|
+
const options = { ...opts };
|
|
91
|
+
options.method = 'DELETE';
|
|
92
|
+
return this.post(url, options);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=HttpNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpNode.js","sourceRoot":"","sources":["../../../../src/runtime/store/HttpNode.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,M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AC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Http } from './Http.js';
|
|
2
|
+
import { IStoreRequestOptions, IStoreResponse } from './SdkBase.js';
|
|
3
|
+
export declare class HttpWeb extends Http {
|
|
4
|
+
/**
|
|
5
|
+
* Performs the GET request.
|
|
6
|
+
*
|
|
7
|
+
* @param url The request URL
|
|
8
|
+
* @param opts The request options
|
|
9
|
+
* @returns The response info.
|
|
10
|
+
*/
|
|
11
|
+
get(url: string, opts?: IStoreRequestOptions): Promise<IStoreResponse>;
|
|
12
|
+
post(url: string, opts?: IStoreRequestOptions): Promise<IStoreResponse>;
|
|
13
|
+
patch(url: string, opts?: IStoreRequestOptions): Promise<IStoreResponse>;
|
|
14
|
+
delete(url: string, opts?: IStoreRequestOptions): Promise<IStoreResponse>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Http } from './Http.js';
|
|
2
|
+
import { Headers } from '../../lib/headers/Headers.js';
|
|
3
|
+
export class HttpWeb extends Http {
|
|
4
|
+
/**
|
|
5
|
+
* Performs the GET request.
|
|
6
|
+
*
|
|
7
|
+
* @param url The request URL
|
|
8
|
+
* @param opts The request options
|
|
9
|
+
* @returns The response info.
|
|
10
|
+
*/
|
|
11
|
+
async get(url, opts = {}) {
|
|
12
|
+
const { method = 'GET', headers = {}, token = this.sdk.token } = opts;
|
|
13
|
+
if (token) {
|
|
14
|
+
headers.authorization = `Bearer ${token}`;
|
|
15
|
+
}
|
|
16
|
+
// eslint-disable-next-line no-undef
|
|
17
|
+
const init = {
|
|
18
|
+
method,
|
|
19
|
+
headers,
|
|
20
|
+
redirect: 'follow',
|
|
21
|
+
};
|
|
22
|
+
const response = await fetch(url, init);
|
|
23
|
+
let body;
|
|
24
|
+
try {
|
|
25
|
+
body = await response.text();
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
// ...
|
|
29
|
+
}
|
|
30
|
+
const responseHeaders = new Headers();
|
|
31
|
+
response.headers.forEach((value, key) => {
|
|
32
|
+
responseHeaders.append(key, value);
|
|
33
|
+
});
|
|
34
|
+
const result = {
|
|
35
|
+
status: response.status,
|
|
36
|
+
headers: responseHeaders,
|
|
37
|
+
body,
|
|
38
|
+
};
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
async post(url, opts = {}) {
|
|
42
|
+
const { method = 'POST', headers = {}, token = this.sdk.token } = opts;
|
|
43
|
+
if (token) {
|
|
44
|
+
headers.authorization = `Bearer ${token}`;
|
|
45
|
+
}
|
|
46
|
+
// eslint-disable-next-line no-undef
|
|
47
|
+
const init = {
|
|
48
|
+
method,
|
|
49
|
+
headers,
|
|
50
|
+
redirect: 'follow',
|
|
51
|
+
};
|
|
52
|
+
if (opts.body) {
|
|
53
|
+
init.body = opts.body.toString();
|
|
54
|
+
}
|
|
55
|
+
const response = await fetch(url, init);
|
|
56
|
+
let body;
|
|
57
|
+
try {
|
|
58
|
+
body = await response.text();
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
// ...
|
|
62
|
+
}
|
|
63
|
+
const responseHeaders = new Headers();
|
|
64
|
+
response.headers.forEach((value, key) => {
|
|
65
|
+
responseHeaders.append(key, value);
|
|
66
|
+
});
|
|
67
|
+
const result = {
|
|
68
|
+
status: response.status,
|
|
69
|
+
headers: responseHeaders,
|
|
70
|
+
body,
|
|
71
|
+
};
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
patch(url, opts = {}) {
|
|
75
|
+
const options = { ...opts, method: 'PATCH' };
|
|
76
|
+
return this.post(url, options);
|
|
77
|
+
}
|
|
78
|
+
delete(url, opts = {}) {
|
|
79
|
+
const options = { ...opts, method: 'DELETE' };
|
|
80
|
+
return this.post(url, options);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=HttpWeb.js.map
|
|
@@ -0,0 +1 @@
|
|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,OAA6B,EAAE;QACjD,MAAM,OAAO,GAAyB,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;QACpE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { JsonPatch } from 'json8-patch';
|
|
2
|
+
import { SdkBase } from './SdkBase.js';
|
|
3
|
+
import { IListOptions, IListResponse } from '../../models/Backend.js';
|
|
4
|
+
import { HttpProject, IHttpProject } from '../../models/HttpProject.js';
|
|
5
|
+
export declare class ProjectsSdk extends SdkBase {
|
|
6
|
+
/**
|
|
7
|
+
* Creates a project in a user space.
|
|
8
|
+
*
|
|
9
|
+
* @param space The user space key
|
|
10
|
+
* @param project THe project to create
|
|
11
|
+
* @returns The key of the created project.
|
|
12
|
+
*/
|
|
13
|
+
create(space: string, project: IHttpProject | HttpProject): Promise<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Reads a project definition from the store.
|
|
16
|
+
* @param space The user space key
|
|
17
|
+
* @param project The project key
|
|
18
|
+
* @returns The definition of the project.
|
|
19
|
+
*/
|
|
20
|
+
read(space: string, project: string): Promise<IHttpProject>;
|
|
21
|
+
/**
|
|
22
|
+
* Lists projects in the space
|
|
23
|
+
*
|
|
24
|
+
* @param space The user space key
|
|
25
|
+
* @param options Optional query options.
|
|
26
|
+
*/
|
|
27
|
+
list(space: string, options?: IListOptions): Promise<IListResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* Deletes a project form the store.
|
|
30
|
+
*
|
|
31
|
+
* @param space The key of the parent space.
|
|
32
|
+
* @param project The key of the project to delete.
|
|
33
|
+
*/
|
|
34
|
+
delete(space: string, project: string): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Patches a project in the store.
|
|
37
|
+
* @param space The key of the parent user space
|
|
38
|
+
* @param project The key of project to patch.
|
|
39
|
+
* @param value The JSON patch to be processed.
|
|
40
|
+
* @returns The JSON patch to revert the change using the `json8-patch` library
|
|
41
|
+
*/
|
|
42
|
+
patch(space: string, project: string, value: JsonPatch): Promise<JsonPatch>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { SdkBase, E_RESPONSE_STATUS, E_RESPONSE_NO_VALUE, E_INVALID_JSON, E_RESPONSE_UNKNOWN, E_RESPONSE_LOCATION } from './SdkBase.js';
|
|
2
|
+
import { RouteBuilder } from './RouteBuilder.js';
|
|
3
|
+
import { Kind as HttpProjectKind } from '../../models/HttpProject.js';
|
|
4
|
+
export class ProjectsSdk extends SdkBase {
|
|
5
|
+
/**
|
|
6
|
+
* Creates a project in a user space.
|
|
7
|
+
*
|
|
8
|
+
* @param space The user space key
|
|
9
|
+
* @param project THe project to create
|
|
10
|
+
* @returns The key of the created project.
|
|
11
|
+
*/
|
|
12
|
+
async create(space, project) {
|
|
13
|
+
const { token } = this.sdk;
|
|
14
|
+
const url = this.sdk.getUrl(RouteBuilder.spaceProjects(space));
|
|
15
|
+
const body = JSON.stringify(project);
|
|
16
|
+
const result = await this.sdk.http.post(url.toString(), { token, body });
|
|
17
|
+
this.inspectCommonStatusCodes(result.status);
|
|
18
|
+
const E_PREFIX = 'Unable to create a project. ';
|
|
19
|
+
if (result.status !== 204) {
|
|
20
|
+
this.logInvalidResponse(result);
|
|
21
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`);
|
|
22
|
+
}
|
|
23
|
+
const location = result.headers.get('location');
|
|
24
|
+
if (!location) {
|
|
25
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_LOCATION}`);
|
|
26
|
+
}
|
|
27
|
+
const id = location.split('/').pop();
|
|
28
|
+
return id;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Reads a project definition from the store.
|
|
32
|
+
* @param space The user space key
|
|
33
|
+
* @param project The project key
|
|
34
|
+
* @returns The definition of the project.
|
|
35
|
+
*/
|
|
36
|
+
async read(space, project) {
|
|
37
|
+
const { token } = this.sdk;
|
|
38
|
+
const url = this.sdk.getUrl(RouteBuilder.spaceProject(space, project));
|
|
39
|
+
const result = await this.sdk.http.get(url.toString(), { token });
|
|
40
|
+
this.inspectCommonStatusCodes(result.status);
|
|
41
|
+
const E_PREFIX = 'Unable to read a project. ';
|
|
42
|
+
if (result.status !== 200) {
|
|
43
|
+
this.logInvalidResponse(result);
|
|
44
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`);
|
|
45
|
+
}
|
|
46
|
+
if (!result.body) {
|
|
47
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`);
|
|
48
|
+
}
|
|
49
|
+
let data;
|
|
50
|
+
try {
|
|
51
|
+
data = JSON.parse(result.body);
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
55
|
+
}
|
|
56
|
+
if (data.kind !== HttpProjectKind) {
|
|
57
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
58
|
+
}
|
|
59
|
+
return data;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Lists projects in the space
|
|
63
|
+
*
|
|
64
|
+
* @param space The user space key
|
|
65
|
+
* @param options Optional query options.
|
|
66
|
+
*/
|
|
67
|
+
async list(space, options) {
|
|
68
|
+
const { token } = this.sdk;
|
|
69
|
+
const url = this.sdk.getUrl(RouteBuilder.spaceProjects(space));
|
|
70
|
+
this.sdk.appendListOptions(url, options);
|
|
71
|
+
const result = await this.sdk.http.get(url.toString(), { token });
|
|
72
|
+
this.inspectCommonStatusCodes(result.status);
|
|
73
|
+
const E_PREFIX = 'Unable to list projects. ';
|
|
74
|
+
if (result.status !== 200) {
|
|
75
|
+
this.logInvalidResponse(result);
|
|
76
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`);
|
|
77
|
+
}
|
|
78
|
+
if (!result.body) {
|
|
79
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`);
|
|
80
|
+
}
|
|
81
|
+
let data;
|
|
82
|
+
try {
|
|
83
|
+
data = JSON.parse(result.body);
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
87
|
+
}
|
|
88
|
+
if (!Array.isArray(data.data)) {
|
|
89
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
90
|
+
}
|
|
91
|
+
return data;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Deletes a project form the store.
|
|
95
|
+
*
|
|
96
|
+
* @param space The key of the parent space.
|
|
97
|
+
* @param project The key of the project to delete.
|
|
98
|
+
*/
|
|
99
|
+
async delete(space, project) {
|
|
100
|
+
const { token } = this.sdk;
|
|
101
|
+
const url = this.sdk.getUrl(RouteBuilder.spaceProject(space, project));
|
|
102
|
+
const result = await this.sdk.http.delete(url.toString(), { token });
|
|
103
|
+
this.inspectCommonStatusCodes(result.status);
|
|
104
|
+
const E_PREFIX = 'Unable to delete a project. ';
|
|
105
|
+
if (result.status !== 204) {
|
|
106
|
+
this.logInvalidResponse(result);
|
|
107
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Patches a project in the store.
|
|
112
|
+
* @param space The key of the parent user space
|
|
113
|
+
* @param project The key of project to patch.
|
|
114
|
+
* @param value The JSON patch to be processed.
|
|
115
|
+
* @returns The JSON patch to revert the change using the `json8-patch` library
|
|
116
|
+
*/
|
|
117
|
+
async patch(space, project, value) {
|
|
118
|
+
const { token } = this.sdk;
|
|
119
|
+
const url = this.sdk.getUrl(RouteBuilder.spaceProject(space, project));
|
|
120
|
+
const body = JSON.stringify(value);
|
|
121
|
+
const result = await this.sdk.http.patch(url.toString(), { token, body });
|
|
122
|
+
this.inspectCommonStatusCodes(result.status);
|
|
123
|
+
const E_PREFIX = 'Unable to patch a project. ';
|
|
124
|
+
if (result.status !== 200) {
|
|
125
|
+
this.logInvalidResponse(result);
|
|
126
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_STATUS}${result.status}`);
|
|
127
|
+
}
|
|
128
|
+
if (!result.body) {
|
|
129
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`);
|
|
130
|
+
}
|
|
131
|
+
let data;
|
|
132
|
+
try {
|
|
133
|
+
data = JSON.parse(result.body);
|
|
134
|
+
}
|
|
135
|
+
catch (e) {
|
|
136
|
+
throw new Error(`${E_PREFIX}${E_INVALID_JSON}.`);
|
|
137
|
+
}
|
|
138
|
+
if (!data.revert) {
|
|
139
|
+
throw new Error(`${E_PREFIX}${E_RESPONSE_UNKNOWN}.`);
|
|
140
|
+
}
|
|
141
|
+
return data.revert;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=ProjectsSdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectsSdk.js","sourceRoot":"","sources":["../../../../src/runtime/store/ProjectsSdk.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,cAAc,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxI,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAA6B,IAAI,IAAI,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEjG,MAAM,OAAO,WAAY,SAAQ,OAAO;IACtC;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CAAC,KAAa,EAAE,OAAmC;QAC7D,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY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AAQ,GAAG,mBAAmB,EAAE,CAAC,CAAC;SACtD;QACD,IAAI,IAAS,CAAC;QACd,IAAI;YACF,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SAChC;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,GAAG,cAAc,GAAG,CAAC,CAAC;SAClD;QACD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,GAAG,kBAAkB,GAAG,CAAC,CAAC;SACtD;QACD,OAAO,IAAI,CAAC,MAAmB,CAAC;IAClC,CAAC;CACF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A helper class to make sure routes user and reported by this service are consistent.
|
|
3
|
+
*/
|
|
4
|
+
export declare class RouteBuilder {
|
|
5
|
+
/**
|
|
6
|
+
* @returns The path to the /spaces route.
|
|
7
|
+
*/
|
|
8
|
+
static spaces(): string;
|
|
9
|
+
/**
|
|
10
|
+
* @returns The path to the /spaces/[id] route.
|
|
11
|
+
*/
|
|
12
|
+
static space(key: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* @returns The path to the /spaces/[id]/users route.
|
|
15
|
+
*/
|
|
16
|
+
static spaceUsers(key: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* @returns The path to the /spaces/[id]/projects route.
|
|
19
|
+
*/
|
|
20
|
+
static spaceProjects(key: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* @returns The path to the /spaces/[id]/projects/[id] route.
|
|
23
|
+
*/
|
|
24
|
+
static spaceProject(space: string, project: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* @returns The path to the /spaces/[id]/projects/[id]/revisions route.
|
|
27
|
+
*/
|
|
28
|
+
static projectRevisions(space: string, project: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* @returns The path to the /backend route.
|
|
31
|
+
*/
|
|
32
|
+
static backend(): string;
|
|
33
|
+
static sessions(): string;
|
|
34
|
+
static sessionRenew(): string;
|
|
35
|
+
static usersMe(): string;
|
|
36
|
+
static users(): string;
|
|
37
|
+
static user(key: string): string;
|
|
38
|
+
static history(): string;
|
|
39
|
+
static historyBatchCreate(): string;
|
|
40
|
+
static historyBatchDelete(): string;
|
|
41
|
+
static historyItem(key: string): string;
|
|
42
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A helper class to make sure routes user and reported by this service are consistent.
|
|
3
|
+
*/
|
|
4
|
+
export class RouteBuilder {
|
|
5
|
+
/**
|
|
6
|
+
* @returns The path to the /spaces route.
|
|
7
|
+
*/
|
|
8
|
+
static spaces() {
|
|
9
|
+
return '/spaces';
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @returns The path to the /spaces/[id] route.
|
|
13
|
+
*/
|
|
14
|
+
static space(key) {
|
|
15
|
+
return `/spaces/${key}`;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @returns The path to the /spaces/[id]/users route.
|
|
19
|
+
*/
|
|
20
|
+
static spaceUsers(key) {
|
|
21
|
+
return `/spaces/${key}/users`;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @returns The path to the /spaces/[id]/projects route.
|
|
25
|
+
*/
|
|
26
|
+
static spaceProjects(key) {
|
|
27
|
+
return `/spaces/${key}/projects`;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @returns The path to the /spaces/[id]/projects/[id] route.
|
|
31
|
+
*/
|
|
32
|
+
static spaceProject(space, project) {
|
|
33
|
+
return `/spaces/${space}/projects/${project}`;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @returns The path to the /spaces/[id]/projects/[id]/revisions route.
|
|
37
|
+
*/
|
|
38
|
+
static projectRevisions(space, project) {
|
|
39
|
+
return `/spaces/${space}/projects/${project}/revisions`;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @returns The path to the /backend route.
|
|
43
|
+
*/
|
|
44
|
+
static backend() {
|
|
45
|
+
return '/store';
|
|
46
|
+
}
|
|
47
|
+
static sessions() {
|
|
48
|
+
return '/sessions';
|
|
49
|
+
}
|
|
50
|
+
static sessionRenew() {
|
|
51
|
+
return '/sessions/renew';
|
|
52
|
+
}
|
|
53
|
+
static usersMe() {
|
|
54
|
+
return '/users/me';
|
|
55
|
+
}
|
|
56
|
+
static users() {
|
|
57
|
+
return '/users';
|
|
58
|
+
}
|
|
59
|
+
static user(key) {
|
|
60
|
+
return `/users/${key}`;
|
|
61
|
+
}
|
|
62
|
+
static history() {
|
|
63
|
+
return `/history`;
|
|
64
|
+
}
|
|
65
|
+
static historyBatchCreate() {
|
|
66
|
+
return `/history/batch/create`;
|
|
67
|
+
}
|
|
68
|
+
static historyBatchDelete() {
|
|
69
|
+
return `/history/batch/delete`;
|
|
70
|
+
}
|
|
71
|
+
static historyItem(key) {
|
|
72
|
+
return `/history/${key}`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=RouteBuilder.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { IListOptions } from '../../models/Backend.js';
|
|
2
|
+
import { Http } from './Http.js';
|
|
3
|
+
import { WsClient } from './WsClient.js';
|
|
4
|
+
import { AuthSdk } from './AuthSdk.js';
|
|
5
|
+
import { BackendSdk } from './BackendSdk.js';
|
|
6
|
+
import { SpacesSdk } from './SpacesSdk.js';
|
|
7
|
+
import { ProjectsSdk } from './ProjectsSdk.js';
|
|
8
|
+
import { UsersSdk } from './UsersSdk.js';
|
|
9
|
+
import { HistorySdk } from './HistorySdk.js';
|
|
10
|
+
declare const baseUriSymbol: unique symbol;
|
|
11
|
+
/**
|
|
12
|
+
* NodeJS API for API Client's net-store module.
|
|
13
|
+
*/
|
|
14
|
+
export declare abstract class Sdk {
|
|
15
|
+
basePath?: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* The token to use with requests. Can be overwritten with each API call.
|
|
18
|
+
*/
|
|
19
|
+
token?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The user authentication features.
|
|
22
|
+
*/
|
|
23
|
+
auth: AuthSdk;
|
|
24
|
+
/**
|
|
25
|
+
* The store information features
|
|
26
|
+
*/
|
|
27
|
+
store: BackendSdk;
|
|
28
|
+
/**
|
|
29
|
+
* The user spaces features.
|
|
30
|
+
*/
|
|
31
|
+
space: SpacesSdk;
|
|
32
|
+
/**
|
|
33
|
+
* The user projects features.
|
|
34
|
+
*/
|
|
35
|
+
project: ProjectsSdk;
|
|
36
|
+
/**
|
|
37
|
+
* Reads user information.
|
|
38
|
+
*/
|
|
39
|
+
user: UsersSdk;
|
|
40
|
+
/**
|
|
41
|
+
* The HTTP(S) requests.
|
|
42
|
+
*/
|
|
43
|
+
abstract http: Http;
|
|
44
|
+
/**
|
|
45
|
+
* The web socket requests.
|
|
46
|
+
*/
|
|
47
|
+
abstract ws: WsClient;
|
|
48
|
+
/**
|
|
49
|
+
* The history data.
|
|
50
|
+
*/
|
|
51
|
+
history: HistorySdk;
|
|
52
|
+
[baseUriSymbol]: string;
|
|
53
|
+
/**
|
|
54
|
+
* @returns The base URI to the store.
|
|
55
|
+
*/
|
|
56
|
+
get baseUri(): string;
|
|
57
|
+
/**
|
|
58
|
+
* @param value The base URI to the store.
|
|
59
|
+
*/
|
|
60
|
+
set baseUri(value: string);
|
|
61
|
+
/**
|
|
62
|
+
* @param baseUri The base URI to the store.
|
|
63
|
+
* @param basePath The base path (the router prefix) for the server.
|
|
64
|
+
*/
|
|
65
|
+
constructor(baseUri: string, basePath?: string | undefined);
|
|
66
|
+
/**
|
|
67
|
+
* Creates a full URL for a path.
|
|
68
|
+
* This adds the server's base path and the passed path to the configured base URL.
|
|
69
|
+
* @param path The path to the endpoint, without the base path.
|
|
70
|
+
*/
|
|
71
|
+
getUrl(path?: string): URL;
|
|
72
|
+
/**
|
|
73
|
+
* Appends list options to the query parameters.
|
|
74
|
+
* @param url The URL object to the API endpoint
|
|
75
|
+
* @param options The list options, if any
|
|
76
|
+
*/
|
|
77
|
+
appendListOptions(url: URL, options?: IListOptions): void;
|
|
78
|
+
}
|
|
79
|
+
export {};
|