@hahnpro/hpc-api 5.3.4 → 6.0.0
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/asset.service.d.ts +10 -10
- package/dist/asset.service.js +18 -24
- package/dist/assettypes.service.d.ts +4 -4
- package/dist/assettypes.service.js +6 -6
- package/dist/content.service.d.ts +9 -9
- package/dist/content.service.js +10 -10
- package/dist/data.interface.d.ts +14 -7
- package/dist/data.service.d.ts +13 -7
- package/dist/data.service.js +12 -12
- package/dist/endpoint.service.d.ts +3 -3
- package/dist/endpoint.service.js +4 -4
- package/dist/events.service.d.ts +2 -2
- package/dist/events.service.js +2 -2
- package/dist/flow-deployment.service.d.ts +15 -13
- package/dist/flow-deployment.service.js +25 -25
- package/dist/flow-function.service.d.ts +5 -5
- package/dist/flow-function.service.js +8 -8
- package/dist/flow-module.service.d.ts +5 -5
- package/dist/flow-module.service.js +6 -10
- package/dist/flow.service.d.ts +12 -10
- package/dist/flow.service.js +17 -17
- package/dist/http.service.d.ts +12 -6
- package/dist/http.service.js +26 -5
- package/dist/label.service.d.ts +4 -4
- package/dist/label.service.js +6 -6
- package/dist/proxy.service.d.ts +5 -5
- package/dist/task.service.d.ts +2 -2
- package/dist/task.service.js +2 -2
- package/dist/timeseries.service.d.ts +10 -8
- package/dist/timeseries.service.js +14 -14
- package/dist/token-set.d.ts +3 -1
- package/dist/token-set.js +6 -2
- package/dist/user.service.d.ts +4 -4
- package/dist/user.service.js +6 -6
- package/dist/vault.service.d.ts +2 -2
- package/dist/vault.service.js +2 -2
- package/package.json +1 -1
package/dist/asset.service.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { APIBase } from './api-base';
|
|
|
3
3
|
import { Asset, AssetRevision, Attachment, EventCause, EventLevelOverride } from './asset.interface';
|
|
4
4
|
import { Paginated, RequestParameter } from './data.interface';
|
|
5
5
|
import { DataService } from './data.service';
|
|
6
|
-
import { HttpClient } from './http.service';
|
|
6
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
7
7
|
import { TrashService } from './trash.service';
|
|
8
8
|
interface BaseService extends DataService<Asset>, TrashService<Asset> {
|
|
9
9
|
}
|
|
@@ -11,14 +11,14 @@ declare class BaseService extends APIBase {
|
|
|
11
11
|
}
|
|
12
12
|
export declare class AssetService extends BaseService {
|
|
13
13
|
constructor(httpClient: HttpClient);
|
|
14
|
-
deleteOne(id: string, force?: boolean): Promise<any>;
|
|
15
|
-
addAttachment: (id: string, form: FormData) => Promise<Asset>;
|
|
16
|
-
getChildren(assetId: string, params?: RequestParameter): Promise<Paginated<Asset[]>>;
|
|
17
|
-
getAttachments(assetId: string): Promise<Paginated<Attachment[]>>;
|
|
18
|
-
getEventLevelOverride(ids: string[], causes: string[]): Promise<EventLevelOverride>;
|
|
19
|
-
updateEventCausesAsset(id: string, dto: EventCause): Promise<Asset>;
|
|
20
|
-
getRevisions(assetId: string): Promise<Paginated<AssetRevision[]>>;
|
|
21
|
-
rollback(assetId: string, revisionId: string): Promise<Asset>;
|
|
22
|
-
deleteRevision(assetId: string, revisionId: string): Promise<any>;
|
|
14
|
+
deleteOne(id: string, force?: boolean, options?: TokenOption): Promise<any>;
|
|
15
|
+
addAttachment: (id: string, form: FormData, options?: TokenOption) => Promise<Asset>;
|
|
16
|
+
getChildren(assetId: string, params?: RequestParameter, options?: TokenOption): Promise<Paginated<Asset[]>>;
|
|
17
|
+
getAttachments(assetId: string, options?: TokenOption): Promise<Paginated<Attachment[]>>;
|
|
18
|
+
getEventLevelOverride(ids: string[], causes: string[], options?: TokenOption): Promise<EventLevelOverride>;
|
|
19
|
+
updateEventCausesAsset(id: string, dto: EventCause, options?: TokenOption): Promise<Asset>;
|
|
20
|
+
getRevisions(assetId: string, options?: TokenOption): Promise<Paginated<AssetRevision[]>>;
|
|
21
|
+
rollback(assetId: string, revisionId: string, options?: TokenOption): Promise<Asset>;
|
|
22
|
+
deleteRevision(assetId: string, revisionId: string, options?: TokenOption): Promise<any>;
|
|
23
23
|
}
|
|
24
24
|
export {};
|
package/dist/asset.service.js
CHANGED
|
@@ -14,40 +14,34 @@ BaseService = tslib_1.__decorate([
|
|
|
14
14
|
class AssetService extends BaseService {
|
|
15
15
|
constructor(httpClient) {
|
|
16
16
|
super(httpClient, '/assets');
|
|
17
|
-
this.addAttachment = (id, form) => {
|
|
17
|
+
this.addAttachment = (id, form, options = {}) => {
|
|
18
18
|
const headers = Object.assign({}, form.getHeaders());
|
|
19
|
-
return this.httpClient.post(`${this.basePath}/${id}/attachment`, form, {
|
|
20
|
-
headers,
|
|
21
|
-
maxBodyLength: Infinity,
|
|
22
|
-
maxContentLength: Infinity,
|
|
23
|
-
});
|
|
19
|
+
return this.httpClient.post(`${this.basePath}/${id}/attachment`, form, Object.assign({ headers, maxBodyLength: Infinity, maxContentLength: Infinity }, options));
|
|
24
20
|
};
|
|
25
21
|
}
|
|
26
|
-
deleteOne(id, force = false) {
|
|
27
|
-
return this.httpClient.delete(`${this.basePath}/${id}`, { params: { force } });
|
|
22
|
+
deleteOne(id, force = false, options = {}) {
|
|
23
|
+
return this.httpClient.delete(`${this.basePath}/${id}`, Object.assign({ params: { force } }, options));
|
|
28
24
|
}
|
|
29
|
-
getChildren(assetId, params = {}) {
|
|
30
|
-
return this.getManyFiltered({ parent: assetId }, params);
|
|
25
|
+
getChildren(assetId, params = {}, options = {}) {
|
|
26
|
+
return this.getManyFiltered({ parent: assetId }, params, options);
|
|
31
27
|
}
|
|
32
|
-
getAttachments(assetId) {
|
|
33
|
-
return this.httpClient.get(`${this.basePath}/${assetId}/attachments
|
|
28
|
+
getAttachments(assetId, options = {}) {
|
|
29
|
+
return this.httpClient.get(`${this.basePath}/${assetId}/attachments`, options);
|
|
34
30
|
}
|
|
35
|
-
getEventLevelOverride(ids, causes) {
|
|
36
|
-
return this.httpClient.get(`${this.basePath}/eventcauses`, {
|
|
37
|
-
params: { ids: ids.join(','), causes: causes.join(',') },
|
|
38
|
-
});
|
|
31
|
+
getEventLevelOverride(ids, causes, options = {}) {
|
|
32
|
+
return this.httpClient.get(`${this.basePath}/eventcauses`, Object.assign({ params: { ids: ids.join(','), causes: causes.join(',') } }, options));
|
|
39
33
|
}
|
|
40
|
-
updateEventCausesAsset(id, dto) {
|
|
41
|
-
return this.httpClient.put(`${this.basePath}/${id}/eventcauses`, dto);
|
|
34
|
+
updateEventCausesAsset(id, dto, options = {}) {
|
|
35
|
+
return this.httpClient.put(`${this.basePath}/${id}/eventcauses`, dto, options);
|
|
42
36
|
}
|
|
43
|
-
getRevisions(assetId) {
|
|
44
|
-
return this.httpClient.get(`${this.basePath}/${assetId}/revisions
|
|
37
|
+
getRevisions(assetId, options = {}) {
|
|
38
|
+
return this.httpClient.get(`${this.basePath}/${assetId}/revisions`, options);
|
|
45
39
|
}
|
|
46
|
-
rollback(assetId, revisionId) {
|
|
47
|
-
return this.httpClient.put(`${this.basePath}/${assetId}/rollback`, { revisionId });
|
|
40
|
+
rollback(assetId, revisionId, options = {}) {
|
|
41
|
+
return this.httpClient.put(`${this.basePath}/${assetId}/rollback`, { revisionId }, options);
|
|
48
42
|
}
|
|
49
|
-
deleteRevision(assetId, revisionId) {
|
|
50
|
-
return this.httpClient.delete(`${this.basePath}/${assetId}/revisions/${revisionId}
|
|
43
|
+
deleteRevision(assetId, revisionId, options = {}) {
|
|
44
|
+
return this.httpClient.delete(`${this.basePath}/${assetId}/revisions/${revisionId}`, options);
|
|
51
45
|
}
|
|
52
46
|
}
|
|
53
47
|
exports.AssetService = AssetService;
|
|
@@ -2,7 +2,7 @@ import { APIBase } from './api-base';
|
|
|
2
2
|
import { AssetType } from './asset.interface';
|
|
3
3
|
import { Paginated } from './data.interface';
|
|
4
4
|
import { DataService } from './data.service';
|
|
5
|
-
import { HttpClient } from './http.service';
|
|
5
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
6
6
|
import { TrashService } from './trash.service';
|
|
7
7
|
interface BaseService extends DataService<AssetType>, TrashService<AssetType> {
|
|
8
8
|
}
|
|
@@ -10,8 +10,8 @@ declare class BaseService extends APIBase {
|
|
|
10
10
|
}
|
|
11
11
|
export declare class AssetTypesService extends BaseService {
|
|
12
12
|
constructor(httpClient: HttpClient);
|
|
13
|
-
getRevisions(id: string): Promise<Paginated<AssetType[]>>;
|
|
14
|
-
rollback(id: string, revisionId: string): Promise<AssetType>;
|
|
15
|
-
deleteRevision(id: string, revisionId: string): Promise<any>;
|
|
13
|
+
getRevisions(id: string, options?: TokenOption): Promise<Paginated<AssetType[]>>;
|
|
14
|
+
rollback(id: string, revisionId: string, options?: TokenOption): Promise<AssetType>;
|
|
15
|
+
deleteRevision(id: string, revisionId: string, options?: TokenOption): Promise<any>;
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -15,14 +15,14 @@ class AssetTypesService extends BaseService {
|
|
|
15
15
|
constructor(httpClient) {
|
|
16
16
|
super(httpClient, '/assettypes');
|
|
17
17
|
}
|
|
18
|
-
getRevisions(id) {
|
|
19
|
-
return this.httpClient.get(`${this.basePath}/${id}/revisions
|
|
18
|
+
getRevisions(id, options = {}) {
|
|
19
|
+
return this.httpClient.get(`${this.basePath}/${id}/revisions`, options);
|
|
20
20
|
}
|
|
21
|
-
rollback(id, revisionId) {
|
|
22
|
-
return this.httpClient.put(`${this.basePath}/${id}/rollback`, { revisionId });
|
|
21
|
+
rollback(id, revisionId, options = {}) {
|
|
22
|
+
return this.httpClient.put(`${this.basePath}/${id}/rollback`, { revisionId }, options);
|
|
23
23
|
}
|
|
24
|
-
deleteRevision(id, revisionId) {
|
|
25
|
-
return this.httpClient.delete(`${this.basePath}/${id}/revisions/${revisionId}
|
|
24
|
+
deleteRevision(id, revisionId, options = {}) {
|
|
25
|
+
return this.httpClient.delete(`${this.basePath}/${id}/revisions/${revisionId}`, options);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
exports.AssetTypesService = AssetTypesService;
|
|
@@ -3,7 +3,7 @@ import { Readable } from 'stream';
|
|
|
3
3
|
import { APIBase } from './api-base';
|
|
4
4
|
import { Content, ReturnType } from './content.interface';
|
|
5
5
|
import { DataService } from './data.service';
|
|
6
|
-
import { HttpClient } from './http.service';
|
|
6
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
7
7
|
import { TrashService } from './trash.service';
|
|
8
8
|
interface BaseService extends DataService<Content>, TrashService<Content> {
|
|
9
9
|
}
|
|
@@ -11,13 +11,13 @@ declare class BaseService extends APIBase {
|
|
|
11
11
|
}
|
|
12
12
|
export declare class ContentService extends BaseService {
|
|
13
13
|
constructor(httpClient: HttpClient);
|
|
14
|
-
upload: (form: FormData) => Promise<Content>;
|
|
15
|
-
download(id: string, raw?: boolean): Promise<Blob | ArrayBuffer>;
|
|
16
|
-
download(id: string, returnType: ReturnType.TEXT): Promise<string>;
|
|
17
|
-
download(id: string, returnType: ReturnType.JSON): Promise<Record<string, unknown>>;
|
|
18
|
-
download(id: string, returnType: ReturnType.NODEBUFFER): Promise<Buffer>;
|
|
19
|
-
download(id: string, returnType: ReturnType.BLOB): Promise<Blob>;
|
|
20
|
-
download(id: string, returnType: ReturnType.ARRAYBUFFER): Promise<ArrayBuffer>;
|
|
21
|
-
download(id: string, returnType: ReturnType.NODESTREAM): Promise<Readable>;
|
|
14
|
+
upload: (form: FormData, options?: TokenOption) => Promise<Content>;
|
|
15
|
+
download(id: string, raw?: boolean, options?: TokenOption): Promise<Blob | ArrayBuffer>;
|
|
16
|
+
download(id: string, returnType: ReturnType.TEXT, options?: TokenOption): Promise<string>;
|
|
17
|
+
download(id: string, returnType: ReturnType.JSON, options?: TokenOption): Promise<Record<string, unknown>>;
|
|
18
|
+
download(id: string, returnType: ReturnType.NODEBUFFER, options?: TokenOption): Promise<Buffer>;
|
|
19
|
+
download(id: string, returnType: ReturnType.BLOB, options?: TokenOption): Promise<Blob>;
|
|
20
|
+
download(id: string, returnType: ReturnType.ARRAYBUFFER, options?: TokenOption): Promise<ArrayBuffer>;
|
|
21
|
+
download(id: string, returnType: ReturnType.NODESTREAM, options?: TokenOption): Promise<Readable>;
|
|
22
22
|
}
|
|
23
23
|
export {};
|
package/dist/content.service.js
CHANGED
|
@@ -15,13 +15,13 @@ BaseService = tslib_1.__decorate([
|
|
|
15
15
|
class ContentService extends BaseService {
|
|
16
16
|
constructor(httpClient) {
|
|
17
17
|
super(httpClient, '/contents');
|
|
18
|
-
this.upload = (form) => {
|
|
18
|
+
this.upload = (form, options = {}) => {
|
|
19
19
|
const headers = Object.assign({}, form.getHeaders());
|
|
20
|
-
return this.httpClient.post(`${this.basePath}`, form, { headers, maxBodyLength: Infinity, maxContentLength: Infinity });
|
|
20
|
+
return this.httpClient.post(`${this.basePath}`, form, Object.assign({ headers, maxBodyLength: Infinity, maxContentLength: Infinity }, options));
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
download(
|
|
24
|
-
return tslib_1.__awaiter(this,
|
|
23
|
+
download(id_1, second_1) {
|
|
24
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* (id, second, options = {}) {
|
|
25
25
|
let returnType;
|
|
26
26
|
if (typeof second === 'boolean' || second == null) {
|
|
27
27
|
returnType = second ? content_interface_1.ReturnType.ARRAYBUFFER : content_interface_1.ReturnType.BLOB;
|
|
@@ -32,17 +32,17 @@ class ContentService extends BaseService {
|
|
|
32
32
|
const url = `${this.basePath}/${id}/download`;
|
|
33
33
|
switch (returnType) {
|
|
34
34
|
case content_interface_1.ReturnType.TEXT:
|
|
35
|
-
return this.httpClient.get(url, { responseType: 'text' });
|
|
35
|
+
return this.httpClient.get(url, Object.assign({ responseType: 'text' }, options));
|
|
36
36
|
case content_interface_1.ReturnType.JSON:
|
|
37
|
-
return this.httpClient.get(url, { responseType: 'json' });
|
|
37
|
+
return this.httpClient.get(url, Object.assign({ responseType: 'json' }, options));
|
|
38
38
|
case content_interface_1.ReturnType.NODEBUFFER:
|
|
39
|
-
return Buffer.from(new Uint8Array(yield this.httpClient.get(url, { responseType: 'arraybuffer' })));
|
|
39
|
+
return Buffer.from(new Uint8Array(yield this.httpClient.get(url, Object.assign({ responseType: 'arraybuffer' }, options))));
|
|
40
40
|
case content_interface_1.ReturnType.BLOB:
|
|
41
|
-
return this.httpClient.get(url, { responseType: 'blob' });
|
|
41
|
+
return this.httpClient.get(url, Object.assign({ responseType: 'blob' }, options));
|
|
42
42
|
case content_interface_1.ReturnType.ARRAYBUFFER:
|
|
43
|
-
return this.httpClient.get(url, { responseType: 'arraybuffer' });
|
|
43
|
+
return this.httpClient.get(url, Object.assign({ responseType: 'arraybuffer' }, options));
|
|
44
44
|
case content_interface_1.ReturnType.NODESTREAM:
|
|
45
|
-
return this.httpClient.get(url, { responseType: 'stream' });
|
|
45
|
+
return this.httpClient.get(url, Object.assign({ responseType: 'stream' }, options));
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
}
|
package/dist/data.interface.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TokenOption } from './http.service';
|
|
1
2
|
export interface Paginated<T> {
|
|
2
3
|
docs: T;
|
|
3
4
|
total: number;
|
|
@@ -20,12 +21,18 @@ interface TimePeriod {
|
|
|
20
21
|
export declare function instanceOfTimePeriod(object: any): object is TimePeriod;
|
|
21
22
|
export type Filter = Record<string, string | string[] | TimePeriod>;
|
|
22
23
|
export interface DataInterface<T> {
|
|
23
|
-
addOne(dto: any): Promise<T>;
|
|
24
|
-
addMany(dto: any[]
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
addOne(dto: any, options?: TokenOption): Promise<T>;
|
|
25
|
+
addMany(dto: any[], options?: TokenOption & {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}): Promise<T[]>;
|
|
28
|
+
getOne(id: string, options?: TokenOption & {
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}): Promise<T>;
|
|
31
|
+
getMany(params?: RequestParameter, options?: TokenOption): Promise<Paginated<T[]>>;
|
|
32
|
+
getManyFiltered(filter: Filter, params?: RequestParameter, options?: TokenOption): Promise<Paginated<T[]>>;
|
|
33
|
+
updateOne(id: string, dto: any, options?: TokenOption & {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
}): Promise<T>;
|
|
36
|
+
deleteOne(id: string, force: boolean, options?: TokenOption): Promise<any>;
|
|
30
37
|
}
|
|
31
38
|
export {};
|
package/dist/data.service.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { APIBase } from './api-base';
|
|
2
2
|
import { DataInterface, Filter, Paginated, RequestParameter } from './data.interface';
|
|
3
|
+
import { TokenOption } from './http.service';
|
|
3
4
|
export declare class DataService<T> extends APIBase implements DataInterface<T> {
|
|
4
|
-
addOne(dto: any): Promise<T>;
|
|
5
|
-
addMany(dto: any[]): Promise<T[]>;
|
|
6
|
-
getOne(id: string, options?:
|
|
7
|
-
|
|
5
|
+
addOne(dto: any, options?: TokenOption): Promise<T>;
|
|
6
|
+
addMany(dto: any[], options?: TokenOption): Promise<T[]>;
|
|
7
|
+
getOne(id: string, options?: TokenOption & {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}): Promise<T>;
|
|
10
|
+
getMany(params?: RequestParameter, options?: TokenOption): Promise<Paginated<T[]>>;
|
|
8
11
|
/**
|
|
9
12
|
* Filters the elements by the passed properties. The object with these properties has to be of the form:
|
|
10
13
|
* {
|
|
@@ -13,9 +16,12 @@ export declare class DataService<T> extends APIBase implements DataInterface<T>
|
|
|
13
16
|
* }.
|
|
14
17
|
* @param filter The Object with the properties to filter by.
|
|
15
18
|
* @param params Other request parameters.
|
|
19
|
+
* @param options Parameters for authentication
|
|
16
20
|
*/
|
|
17
|
-
getManyFiltered(filter: Filter, params?: RequestParameter): Promise<Paginated<T[]>>;
|
|
18
|
-
updateOne(id: string, dto: any
|
|
19
|
-
|
|
21
|
+
getManyFiltered(filter: Filter, params?: RequestParameter, options?: TokenOption): Promise<Paginated<T[]>>;
|
|
22
|
+
updateOne(id: string, dto: any, options?: TokenOption & {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}): Promise<T>;
|
|
25
|
+
deleteOne(id: string, force?: boolean, options?: TokenOption): Promise<any>;
|
|
20
26
|
private getFilterString;
|
|
21
27
|
}
|
package/dist/data.service.js
CHANGED
|
@@ -4,30 +4,30 @@ exports.DataService = void 0;
|
|
|
4
4
|
const api_base_1 = require("./api-base");
|
|
5
5
|
const data_interface_1 = require("./data.interface");
|
|
6
6
|
class DataService extends api_base_1.APIBase {
|
|
7
|
-
addOne(dto) {
|
|
8
|
-
return this.httpClient.post(this.basePath, dto);
|
|
7
|
+
addOne(dto, options = {}) {
|
|
8
|
+
return this.httpClient.post(this.basePath, dto, options);
|
|
9
9
|
}
|
|
10
|
-
addMany(dto) {
|
|
11
|
-
return this.httpClient.post(`${this.basePath}/many`, dto);
|
|
10
|
+
addMany(dto, options = {}) {
|
|
11
|
+
return this.httpClient.post(`${this.basePath}/many`, dto, options);
|
|
12
12
|
}
|
|
13
13
|
getOne(id, options = {}) {
|
|
14
14
|
const params = options.populate ? { populate: options.populate } : {};
|
|
15
15
|
return this.httpClient.get(`${this.basePath}/${id}`, { params });
|
|
16
16
|
}
|
|
17
|
-
getMany(params = {}) {
|
|
17
|
+
getMany(params = {}, options = {}) {
|
|
18
18
|
params.limit = params.limit || 0;
|
|
19
19
|
params.page = params.page || 1;
|
|
20
|
-
return this.httpClient.get(`${this.basePath}`, { params });
|
|
20
|
+
return this.httpClient.get(`${this.basePath}`, Object.assign({ params }, options));
|
|
21
21
|
}
|
|
22
|
-
getManyFiltered(filter, params = {}) {
|
|
22
|
+
getManyFiltered(filter, params = {}, options = {}) {
|
|
23
23
|
params.filter = this.getFilterString(filter);
|
|
24
|
-
return this.getMany(params);
|
|
24
|
+
return this.getMany(params, options);
|
|
25
25
|
}
|
|
26
|
-
updateOne(id, dto) {
|
|
27
|
-
return this.httpClient.put(`${this.basePath}/${id}`, dto);
|
|
26
|
+
updateOne(id, dto, options = {}) {
|
|
27
|
+
return this.httpClient.put(`${this.basePath}/${id}`, dto, options);
|
|
28
28
|
}
|
|
29
|
-
deleteOne(id, force = false) {
|
|
30
|
-
return this.httpClient.delete(`${this.basePath}/${id}`, { params: { force } });
|
|
29
|
+
deleteOne(id, force = false, options = {}) {
|
|
30
|
+
return this.httpClient.delete(`${this.basePath}/${id}`, Object.assign({ params: { force } }, options));
|
|
31
31
|
}
|
|
32
32
|
getFilterString(filter) {
|
|
33
33
|
const filters = [];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { HttpClient } from './http.service';
|
|
1
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
2
2
|
import { DataService } from './data.service';
|
|
3
3
|
import { Endpoint, NotificationPayload, EndpointLog } from './endpoint.interface';
|
|
4
4
|
export declare class EndpointService extends DataService<Endpoint> {
|
|
5
5
|
constructor(httpClient: HttpClient);
|
|
6
|
-
sendNotification(endpointId: string, payload: NotificationPayload): Promise<void>;
|
|
7
|
-
readLastLogByGroup(endpointId: string, group: string): Promise<EndpointLog>;
|
|
6
|
+
sendNotification(endpointId: string, payload: NotificationPayload, options?: TokenOption): Promise<void>;
|
|
7
|
+
readLastLogByGroup(endpointId: string, group: string, options?: TokenOption): Promise<EndpointLog>;
|
|
8
8
|
}
|
package/dist/endpoint.service.js
CHANGED
|
@@ -6,11 +6,11 @@ class EndpointService extends data_service_1.DataService {
|
|
|
6
6
|
constructor(httpClient) {
|
|
7
7
|
super(httpClient, '/notification/endpoints');
|
|
8
8
|
}
|
|
9
|
-
sendNotification(endpointId, payload) {
|
|
10
|
-
return this.httpClient.post(`${this.basePath}/${endpointId}`, payload);
|
|
9
|
+
sendNotification(endpointId, payload, options = {}) {
|
|
10
|
+
return this.httpClient.post(`${this.basePath}/${endpointId}`, payload, options);
|
|
11
11
|
}
|
|
12
|
-
readLastLogByGroup(endpointId, group) {
|
|
13
|
-
return this.httpClient.get(`${this.basePath}/${endpointId}/logs/${group}/last
|
|
12
|
+
readLastLogByGroup(endpointId, group, options = {}) {
|
|
13
|
+
return this.httpClient.get(`${this.basePath}/${endpointId}/logs/${group}/last`, options);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
exports.EndpointService = EndpointService;
|
package/dist/events.service.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DataService } from './data.service';
|
|
2
2
|
import { Event } from './events.interface';
|
|
3
|
-
import { HttpClient } from './http.service';
|
|
3
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
4
4
|
export declare class EventsService extends DataService<Event> {
|
|
5
5
|
constructor(httpClient: HttpClient);
|
|
6
|
-
getLastEventByAssetAndGroup(assetId: string, group: string): Promise<Event>;
|
|
6
|
+
getLastEventByAssetAndGroup(assetId: string, group: string, options?: TokenOption): Promise<Event>;
|
|
7
7
|
}
|
package/dist/events.service.js
CHANGED
|
@@ -6,8 +6,8 @@ class EventsService extends data_service_1.DataService {
|
|
|
6
6
|
constructor(httpClient) {
|
|
7
7
|
super(httpClient, '/events');
|
|
8
8
|
}
|
|
9
|
-
getLastEventByAssetAndGroup(assetId, group) {
|
|
10
|
-
return this.httpClient.get(`${this.basePath}/last/${assetId}/${group}
|
|
9
|
+
getLastEventByAssetAndGroup(assetId, group, options = {}) {
|
|
10
|
+
return this.httpClient.get(`${this.basePath}/last/${assetId}/${group}`, options);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
exports.EventsService = EventsService;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { APIBase } from './api-base';
|
|
2
2
|
import { DataService } from './data.service';
|
|
3
3
|
import { FlowDeployment, FlowDeploymentMetrics, FlowDeploymentStatistic, FlowLog } from './flow-deployment.interface';
|
|
4
|
-
import { HttpClient } from './http.service';
|
|
4
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
5
5
|
import { ResourceReference } from './resource.interface';
|
|
6
6
|
import { TrashService } from './trash.service';
|
|
7
7
|
interface BaseService extends DataService<FlowDeployment>, TrashService<FlowDeployment> {
|
|
@@ -10,15 +10,17 @@ declare class BaseService extends APIBase {
|
|
|
10
10
|
}
|
|
11
11
|
export declare class FlowDeploymentService extends BaseService {
|
|
12
12
|
constructor(httpClient: HttpClient);
|
|
13
|
-
addMany(dto: any[]): Promise<FlowDeployment[]>;
|
|
14
|
-
updateOne(id: string, dto: any,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
addMany(dto: any[], options?: TokenOption): Promise<FlowDeployment[]>;
|
|
14
|
+
updateOne(id: string, dto: any, options?: TokenOption & {
|
|
15
|
+
force: boolean;
|
|
16
|
+
}): Promise<FlowDeployment>;
|
|
17
|
+
getDeploymentStatistics(id: string, options?: TokenOption): Promise<FlowDeploymentStatistic>;
|
|
18
|
+
getDeploymentMetrics(id: string, range?: string, interval?: string, options?: TokenOption): Promise<FlowDeploymentMetrics>;
|
|
19
|
+
getDeploymentLogs(id: string, options?: TokenOption): Promise<FlowLog[]>;
|
|
20
|
+
resolveReferences(id: string, recursive?: boolean, types?: string[], options?: TokenOption): Promise<ResourceReference[]>;
|
|
21
|
+
updateStatus(id: string, desiredStatus: 'running' | 'stopped' | 'deleted' | 'paused', options?: TokenOption): Promise<FlowDeployment>;
|
|
22
|
+
deleteOne(id: string, _force?: boolean, options?: TokenOption): Promise<FlowDeployment>;
|
|
23
|
+
waitForRunningStatus(id: string, options?: TokenOption): Promise<void>;
|
|
22
24
|
addOne(dto: {
|
|
23
25
|
diagramId: string;
|
|
24
26
|
name: string;
|
|
@@ -26,8 +28,8 @@ export declare class FlowDeploymentService extends BaseService {
|
|
|
26
28
|
readPermissions?: string[];
|
|
27
29
|
readWritePermissions?: string[];
|
|
28
30
|
tags?: string[];
|
|
29
|
-
}): Promise<FlowDeployment>;
|
|
30
|
-
subscribeToStatus(id: string, listener: (event: MessageEvent<any>) => void, errorListener?: (event: MessageEvent) => void): Promise<string>;
|
|
31
|
-
subscribeToLogs(id: string, listener: (event: MessageEvent<any>) => void, errorListener?: (event: MessageEvent) => void): Promise<string>;
|
|
31
|
+
}, options?: TokenOption): Promise<FlowDeployment>;
|
|
32
|
+
subscribeToStatus(id: string, listener: (event: MessageEvent<any>) => void, errorListener?: (event: MessageEvent) => void, options?: TokenOption): Promise<string>;
|
|
33
|
+
subscribeToLogs(id: string, listener: (event: MessageEvent<any>) => void, errorListener?: (event: MessageEvent) => void, options?: TokenOption): Promise<string>;
|
|
32
34
|
}
|
|
33
35
|
export {};
|
|
@@ -15,36 +15,36 @@ class FlowDeploymentService extends BaseService {
|
|
|
15
15
|
constructor(httpClient) {
|
|
16
16
|
super(httpClient, '/flow/deployments');
|
|
17
17
|
}
|
|
18
|
-
addMany(dto) {
|
|
19
|
-
const reqs = dto.map((v) => this.addOne(v));
|
|
18
|
+
addMany(dto, options = {}) {
|
|
19
|
+
const reqs = dto.map((v) => this.addOne(v, options));
|
|
20
20
|
return Promise.all(reqs);
|
|
21
21
|
}
|
|
22
|
-
updateOne(id, dto,
|
|
23
|
-
return
|
|
22
|
+
updateOne(id, dto, options = { force: false }) {
|
|
23
|
+
return super.updateOne(id, dto, options);
|
|
24
24
|
}
|
|
25
|
-
getDeploymentStatistics(id) {
|
|
26
|
-
return this.httpClient.get(`${this.basePath}/${id}/statistics
|
|
25
|
+
getDeploymentStatistics(id, options = {}) {
|
|
26
|
+
return this.httpClient.get(`${this.basePath}/${id}/statistics`, options);
|
|
27
27
|
}
|
|
28
|
-
getDeploymentMetrics(id, range = '12h', interval = '5m') {
|
|
28
|
+
getDeploymentMetrics(id, range = '12h', interval = '5m', options = {}) {
|
|
29
29
|
const params = { range, interval };
|
|
30
|
-
return this.httpClient.get(`${this.basePath}/${id}/metrics`, { params });
|
|
30
|
+
return this.httpClient.get(`${this.basePath}/${id}/metrics`, Object.assign({ params }, options));
|
|
31
31
|
}
|
|
32
|
-
getDeploymentLogs(id) {
|
|
33
|
-
return this.httpClient.get(`${this.basePath}/${id}/logs
|
|
32
|
+
getDeploymentLogs(id, options = {}) {
|
|
33
|
+
return this.httpClient.get(`${this.basePath}/${id}/logs`, options);
|
|
34
34
|
}
|
|
35
|
-
resolveReferences(id, recursive = true, types) {
|
|
35
|
+
resolveReferences(id, recursive = true, types, options = {}) {
|
|
36
36
|
var _a;
|
|
37
37
|
const params = { recursive, types: (_a = types === null || types === void 0 ? void 0 : types.join(',')) !== null && _a !== void 0 ? _a : undefined };
|
|
38
|
-
return this.httpClient.get(`${this.basePath}/${id}/references`, { params });
|
|
38
|
+
return this.httpClient.get(`${this.basePath}/${id}/references`, Object.assign({ params }, options));
|
|
39
39
|
}
|
|
40
|
-
updateStatus(id, desiredStatus) {
|
|
41
|
-
return this.httpClient.put(`${this.basePath}/${id}/status`, { desiredStatus });
|
|
40
|
+
updateStatus(id, desiredStatus, options = {}) {
|
|
41
|
+
return this.httpClient.put(`${this.basePath}/${id}/status`, { desiredStatus }, options);
|
|
42
42
|
}
|
|
43
|
-
deleteOne(id) {
|
|
44
|
-
return this.updateStatus(id, 'deleted');
|
|
43
|
+
deleteOne(id, _force, options = {}) {
|
|
44
|
+
return this.updateStatus(id, 'deleted', options);
|
|
45
45
|
}
|
|
46
|
-
waitForRunningStatus(
|
|
47
|
-
return tslib_1.__awaiter(this,
|
|
46
|
+
waitForRunningStatus(id_1) {
|
|
47
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* (id, options = {}) {
|
|
48
48
|
return new Promise((resolve, reject) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
49
49
|
const esId = yield this.subscribeToStatus(id, (event) => {
|
|
50
50
|
if (event.type === 'message' &&
|
|
@@ -57,18 +57,18 @@ class FlowDeploymentService extends BaseService {
|
|
|
57
57
|
reject(`Deployment in failed status: ${event.data}`);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
});
|
|
60
|
+
}, (event) => reject(event), options);
|
|
61
61
|
}));
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
addOne(dto) {
|
|
65
|
-
return super.addOne(dto);
|
|
64
|
+
addOne(dto, options = {}) {
|
|
65
|
+
return super.addOne(dto, options);
|
|
66
66
|
}
|
|
67
|
-
subscribeToStatus(id, listener, errorListener) {
|
|
68
|
-
return this.httpClient.addEventSource(`${this.basePath}/${id}/status`, listener, errorListener);
|
|
67
|
+
subscribeToStatus(id, listener, errorListener, options = {}) {
|
|
68
|
+
return this.httpClient.addEventSource(`${this.basePath}/${id}/status`, listener, errorListener, options);
|
|
69
69
|
}
|
|
70
|
-
subscribeToLogs(id, listener, errorListener) {
|
|
71
|
-
return this.httpClient.addEventSource(`${this.basePath}/${id}/logs/subscribe`, listener, errorListener);
|
|
70
|
+
subscribeToLogs(id, listener, errorListener, options = {}) {
|
|
71
|
+
return this.httpClient.addEventSource(`${this.basePath}/${id}/logs/subscribe`, listener, errorListener, options);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
exports.FlowDeploymentService = FlowDeploymentService;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DataService } from './data.service';
|
|
2
2
|
import { FlowFunctionDto } from './flow-function.interface';
|
|
3
|
-
import { HttpClient } from './http.service';
|
|
3
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
4
4
|
import { Paginated } from './data.interface';
|
|
5
5
|
export declare class FlowFunctionService extends DataService<FlowFunctionDto> {
|
|
6
6
|
constructor(httpClient: HttpClient);
|
|
7
|
-
addMany(dto: any[]): Promise<FlowFunctionDto[]>;
|
|
8
|
-
getRevisions(fqn: string): Promise<Paginated<FlowFunctionDto[]>>;
|
|
9
|
-
rollback(fqn: string, revisionId: string): Promise<FlowFunctionDto>;
|
|
10
|
-
deleteRevision(fqn: string, revisionId: string): Promise<any>;
|
|
7
|
+
addMany(dto: any[], options?: TokenOption): Promise<FlowFunctionDto[]>;
|
|
8
|
+
getRevisions(fqn: string, options?: TokenOption): Promise<Paginated<FlowFunctionDto[]>>;
|
|
9
|
+
rollback(fqn: string, revisionId: string, options?: TokenOption): Promise<FlowFunctionDto>;
|
|
10
|
+
deleteRevision(fqn: string, revisionId: string, options?: TokenOption): Promise<any>;
|
|
11
11
|
}
|
|
@@ -6,18 +6,18 @@ class FlowFunctionService extends data_service_1.DataService {
|
|
|
6
6
|
constructor(httpClient) {
|
|
7
7
|
super(httpClient, '/flow/functions');
|
|
8
8
|
}
|
|
9
|
-
addMany(dto) {
|
|
10
|
-
const reqs = dto.map((v) => this.addOne(v));
|
|
9
|
+
addMany(dto, options = {}) {
|
|
10
|
+
const reqs = dto.map((v) => this.addOne(v, options));
|
|
11
11
|
return Promise.all(reqs);
|
|
12
12
|
}
|
|
13
|
-
getRevisions(fqn) {
|
|
14
|
-
return this.httpClient.get(`${this.basePath}/${fqn}/revisions
|
|
13
|
+
getRevisions(fqn, options = {}) {
|
|
14
|
+
return this.httpClient.get(`${this.basePath}/${fqn}/revisions`, options);
|
|
15
15
|
}
|
|
16
|
-
rollback(fqn, revisionId) {
|
|
17
|
-
return this.httpClient.put(`${this.basePath}/${fqn}/rollback`, { revisionId });
|
|
16
|
+
rollback(fqn, revisionId, options = {}) {
|
|
17
|
+
return this.httpClient.put(`${this.basePath}/${fqn}/rollback`, { revisionId }, options);
|
|
18
18
|
}
|
|
19
|
-
deleteRevision(fqn, revisionId) {
|
|
20
|
-
return this.httpClient.delete(`${this.basePath}/${fqn}/revisions/${revisionId}
|
|
19
|
+
deleteRevision(fqn, revisionId, options = {}) {
|
|
20
|
+
return this.httpClient.delete(`${this.basePath}/${fqn}/revisions/${revisionId}`, options);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
exports.FlowFunctionService = FlowFunctionService;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DataService } from './data.service';
|
|
2
2
|
import { FlowModule } from './flow-module.interface';
|
|
3
|
-
import { HttpClient } from './http.service';
|
|
3
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
4
4
|
import FormData from 'form-data';
|
|
5
5
|
export declare class FlowModuleService extends DataService<FlowModule> {
|
|
6
6
|
constructor(httpClient: HttpClient);
|
|
7
|
-
deleteArtifact(name: string, version: string): Promise<FlowModule>;
|
|
8
|
-
publish(form: FormData): Promise<unknown>;
|
|
9
|
-
addOne(
|
|
10
|
-
addMany(
|
|
7
|
+
deleteArtifact(name: string, version: string, options?: TokenOption): Promise<FlowModule>;
|
|
8
|
+
publish(form: FormData, options?: TokenOption): Promise<unknown>;
|
|
9
|
+
addOne(_dto: any): Promise<FlowModule>;
|
|
10
|
+
addMany(_dto: any[]): Promise<FlowModule[]>;
|
|
11
11
|
}
|
|
@@ -6,21 +6,17 @@ class FlowModuleService extends data_service_1.DataService {
|
|
|
6
6
|
constructor(httpClient) {
|
|
7
7
|
super(httpClient, '/flow/modules');
|
|
8
8
|
}
|
|
9
|
-
deleteArtifact(name, version) {
|
|
10
|
-
return this.httpClient.delete(`${this.basePath}/${name}/${version}
|
|
9
|
+
deleteArtifact(name, version, options = {}) {
|
|
10
|
+
return this.httpClient.delete(`${this.basePath}/${name}/${version}`, options);
|
|
11
11
|
}
|
|
12
|
-
publish(form) {
|
|
13
|
-
const config = {
|
|
14
|
-
headers: Object.assign({}, form.getHeaders()),
|
|
15
|
-
maxBodyLength: Infinity,
|
|
16
|
-
maxContentLength: Infinity,
|
|
17
|
-
};
|
|
12
|
+
publish(form, options = {}) {
|
|
13
|
+
const config = Object.assign({ headers: Object.assign({}, form.getHeaders()), maxBodyLength: Infinity, maxContentLength: Infinity }, options);
|
|
18
14
|
return this.httpClient.post(`${this.basePath}`, form, config);
|
|
19
15
|
}
|
|
20
|
-
addOne(
|
|
16
|
+
addOne(_dto) {
|
|
21
17
|
throw new Error('not allowed: use publish instead');
|
|
22
18
|
}
|
|
23
|
-
addMany(
|
|
19
|
+
addMany(_dto) {
|
|
24
20
|
throw new Error('not allowed: use publish instead');
|
|
25
21
|
}
|
|
26
22
|
}
|
package/dist/flow.service.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Paginated, RequestParameter } from './data.interface';
|
|
|
3
3
|
import { DataService } from './data.service';
|
|
4
4
|
import { FlowDiagram, FlowDto } from './flow.interface';
|
|
5
5
|
import { FlowDeployment } from './flow-deployment.interface';
|
|
6
|
-
import { HttpClient } from './http.service';
|
|
6
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
7
7
|
import { TrashService } from './trash.service';
|
|
8
8
|
interface BaseService extends DataService<FlowDto>, TrashService<FlowDto> {
|
|
9
9
|
}
|
|
@@ -11,14 +11,16 @@ declare class BaseService extends APIBase {
|
|
|
11
11
|
}
|
|
12
12
|
export declare class FlowService extends BaseService {
|
|
13
13
|
constructor(httpClient: HttpClient);
|
|
14
|
-
addMany(dto: any[]): Promise<FlowDto[]>;
|
|
15
|
-
getMany(params?: RequestParameter): Promise<Paginated<FlowDto[]>>;
|
|
16
|
-
getOne(id: string, options?:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
addMany(dto: any[], options?: TokenOption): Promise<FlowDto[]>;
|
|
15
|
+
getMany(params?: RequestParameter, options?: TokenOption): Promise<Paginated<FlowDto[]>>;
|
|
16
|
+
getOne(id: string, options?: TokenOption & {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}): Promise<FlowDto>;
|
|
19
|
+
getFlowWithDiagram(diagramId: string, options?: TokenOption): Promise<FlowDto>;
|
|
20
|
+
getDiagramRevisions(id: string, options?: TokenOption): Promise<FlowDiagram[]>;
|
|
21
|
+
isDeploymentOnLatestDiagramVersion(depl: FlowDeployment, options?: TokenOption): Promise<boolean>;
|
|
22
|
+
getRevisions(id: string, options?: TokenOption): Promise<Paginated<FlowDto[]>>;
|
|
23
|
+
rollback(id: string, revisionId: string, options?: TokenOption): Promise<FlowDto>;
|
|
24
|
+
deleteRevision(id: string, revisionId: string, options?: TokenOption): Promise<any>;
|
|
23
25
|
}
|
|
24
26
|
export {};
|
package/dist/flow.service.js
CHANGED
|
@@ -15,40 +15,40 @@ class FlowService extends BaseService {
|
|
|
15
15
|
constructor(httpClient) {
|
|
16
16
|
super(httpClient, '/flows');
|
|
17
17
|
}
|
|
18
|
-
addMany(dto) {
|
|
19
|
-
const reqs = dto.map((v) => this.addOne(v));
|
|
18
|
+
addMany(dto, options = {}) {
|
|
19
|
+
const reqs = dto.map((v) => this.addOne(v, options));
|
|
20
20
|
return Promise.all(reqs);
|
|
21
21
|
}
|
|
22
|
-
getMany(params = {}) {
|
|
22
|
+
getMany(params = {}, options = {}) {
|
|
23
23
|
params.populate = params.populate ? params.populate : 'none';
|
|
24
|
-
return super.getMany(params);
|
|
24
|
+
return super.getMany(params, options);
|
|
25
25
|
}
|
|
26
26
|
getOne(id, options = {}) {
|
|
27
27
|
options.populate = options.populate ? options.populate : 'none';
|
|
28
28
|
return super.getOne(id, options);
|
|
29
29
|
}
|
|
30
|
-
getFlowWithDiagram(diagramId) {
|
|
31
|
-
return this.httpClient.get(`${this.basePath}/diagram/${diagramId}
|
|
30
|
+
getFlowWithDiagram(diagramId, options = {}) {
|
|
31
|
+
return this.httpClient.get(`${this.basePath}/diagram/${diagramId}`, options);
|
|
32
32
|
}
|
|
33
|
-
getDiagramRevisions(id) {
|
|
34
|
-
return this.httpClient.get(`${this.basePath}/${id}/diagram/revisions
|
|
33
|
+
getDiagramRevisions(id, options = {}) {
|
|
34
|
+
return this.httpClient.get(`${this.basePath}/${id}/diagram/revisions`, options);
|
|
35
35
|
}
|
|
36
|
-
isDeploymentOnLatestDiagramVersion(
|
|
37
|
-
return tslib_1.__awaiter(this,
|
|
36
|
+
isDeploymentOnLatestDiagramVersion(depl_1) {
|
|
37
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* (depl, options = {}) {
|
|
38
38
|
const flowId = typeof depl.flow === 'string' ? depl.flow : depl.flow.id;
|
|
39
39
|
const diagramId = typeof depl.diagram === 'string' ? depl.diagram : depl.diagram.id;
|
|
40
|
-
const revisions = yield this.getDiagramRevisions(flowId);
|
|
40
|
+
const revisions = yield this.getDiagramRevisions(flowId, options);
|
|
41
41
|
return revisions[revisions.length - 1].id === diagramId;
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
getRevisions(id) {
|
|
45
|
-
return this.httpClient.get(`${this.basePath}/${id}/revisions
|
|
44
|
+
getRevisions(id, options = {}) {
|
|
45
|
+
return this.httpClient.get(`${this.basePath}/${id}/revisions`, options);
|
|
46
46
|
}
|
|
47
|
-
rollback(id, revisionId) {
|
|
48
|
-
return this.httpClient.put(`${this.basePath}/${id}/rollback`, { revisionId });
|
|
47
|
+
rollback(id, revisionId, options = {}) {
|
|
48
|
+
return this.httpClient.put(`${this.basePath}/${id}/rollback`, { revisionId }, options);
|
|
49
49
|
}
|
|
50
|
-
deleteRevision(id, revisionId) {
|
|
51
|
-
return this.httpClient.delete(`${this.basePath}/${id}/revisions/${revisionId}
|
|
50
|
+
deleteRevision(id, revisionId, options = {}) {
|
|
51
|
+
return this.httpClient.delete(`${this.basePath}/${id}/revisions/${revisionId}`, options);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
exports.FlowService = FlowService;
|
package/dist/http.service.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ import { AxiosInstance, AxiosRequestConfig, Method } from 'axios';
|
|
|
2
2
|
import EventSource from 'eventsource';
|
|
3
3
|
import { Queue } from './Queue';
|
|
4
4
|
import { TokenSet } from './token-set';
|
|
5
|
+
export type TokenOption = {
|
|
6
|
+
token?: string;
|
|
7
|
+
};
|
|
8
|
+
export type Config = TokenOption & AxiosRequestConfig;
|
|
5
9
|
export declare class HttpClient {
|
|
6
10
|
protected readonly baseURL: string;
|
|
7
11
|
protected readonly authBaseURL: string;
|
|
@@ -14,6 +18,7 @@ export declare class HttpClient {
|
|
|
14
18
|
protected readonly requestQueue: Queue;
|
|
15
19
|
private tokenSet;
|
|
16
20
|
private exchangedTokenSet;
|
|
21
|
+
private discoveredIssuers;
|
|
17
22
|
eventSourcesMap: Map<string, {
|
|
18
23
|
eventSource: EventSource;
|
|
19
24
|
listener: (event: MessageEvent) => void;
|
|
@@ -26,12 +31,12 @@ export declare class HttpClient {
|
|
|
26
31
|
size: number;
|
|
27
32
|
total: number;
|
|
28
33
|
};
|
|
29
|
-
delete: <T>(url: string, config?:
|
|
30
|
-
get: <T>(url: string, config?:
|
|
31
|
-
post: <T>(url: string, data: any, config?:
|
|
32
|
-
put: <T>(url: string, data: any, config?:
|
|
33
|
-
protected request: <T>(method: Method, url: string, config?:
|
|
34
|
-
addEventSource(url: string, listener: (event: MessageEvent) => void, errorListener?: (event: MessageEvent) => void): Promise<string>;
|
|
34
|
+
delete: <T>(url: string, config?: Config) => Promise<T>;
|
|
35
|
+
get: <T>(url: string, config?: Config) => Promise<T>;
|
|
36
|
+
post: <T>(url: string, data: any, config?: Config) => Promise<T>;
|
|
37
|
+
put: <T>(url: string, data: any, config?: Config) => Promise<T>;
|
|
38
|
+
protected request: <T>(method: Method, url: string, config?: Config, data?: any) => Promise<T>;
|
|
39
|
+
addEventSource(url: string, listener: (event: MessageEvent) => void, errorListener?: (event: MessageEvent) => void, options?: TokenOption): Promise<string>;
|
|
35
40
|
destroyEventSource(id: string): void;
|
|
36
41
|
destroyAllEventSources(): void;
|
|
37
42
|
getAccessToken: (forceRefresh?: boolean) => Promise<string>;
|
|
@@ -39,6 +44,7 @@ export declare class HttpClient {
|
|
|
39
44
|
protected discoverIssuer(uri: string): Promise<Issuer>;
|
|
40
45
|
protected requestAccessToken(additionalOpts?: {}): Promise<TokenSet>;
|
|
41
46
|
protected exchangeAccessToken(accessToken: string): Promise<TokenSet>;
|
|
47
|
+
provideExternalToken(token: string): Promise<void>;
|
|
42
48
|
}
|
|
43
49
|
interface Issuer {
|
|
44
50
|
issuer: string;
|
package/dist/http.service.js
CHANGED
|
@@ -17,6 +17,7 @@ class HttpClient {
|
|
|
17
17
|
this.clientId = clientId;
|
|
18
18
|
this.clientSecret = clientSecret;
|
|
19
19
|
this.tokenSubject = tokenSubject;
|
|
20
|
+
this.discoveredIssuers = new Map();
|
|
20
21
|
this.eventSourcesMap = new Map();
|
|
21
22
|
this.getQueueStats = () => { var _a; return (_a = this.requestQueue) === null || _a === void 0 ? void 0 : _a.getStats(); };
|
|
22
23
|
this.delete = (url, config) => this.request('DELETE', url, config);
|
|
@@ -25,7 +26,8 @@ class HttpClient {
|
|
|
25
26
|
this.put = (url, data, config) => this.request('PUT', url, config, data);
|
|
26
27
|
this.request = (method, url, config = {}, data) => {
|
|
27
28
|
return this.requestQueue.add(() => new Promise((resolve, reject) => {
|
|
28
|
-
this.getAccessToken()
|
|
29
|
+
const tokenP = config.token ? Promise.resolve(config.token) : this.getAccessToken();
|
|
30
|
+
tokenP
|
|
29
31
|
.then((token) => {
|
|
30
32
|
const headers = Object.assign({ Authorization: `Bearer ${token}` }, config.headers);
|
|
31
33
|
return this.axiosInstance.request(Object.assign(Object.assign({}, config), { headers, method, url, data }));
|
|
@@ -35,8 +37,12 @@ class HttpClient {
|
|
|
35
37
|
}));
|
|
36
38
|
};
|
|
37
39
|
this.getAccessToken = (...args_1) => tslib_1.__awaiter(this, [...args_1], void 0, function* (forceRefresh = false) {
|
|
40
|
+
var _a;
|
|
38
41
|
let accessToken;
|
|
39
42
|
if (forceRefresh || !this.tokenSet || this.tokenSet.isExpired()) {
|
|
43
|
+
if ((_a = this.tokenSet) === null || _a === void 0 ? void 0 : _a.provided) {
|
|
44
|
+
throw new Error('provided token is expired and cannot be refreshed, provide a new token.');
|
|
45
|
+
}
|
|
40
46
|
this.tokenSet = yield this.requestAccessToken();
|
|
41
47
|
accessToken = this.tokenSet.accessToken;
|
|
42
48
|
}
|
|
@@ -57,8 +63,8 @@ class HttpClient {
|
|
|
57
63
|
this.authAxiosInstance = axios_1.default.create({ baseURL: authBaseURL || baseURL, timeout: 10000 });
|
|
58
64
|
this.requestQueue = new Queue_1.Queue({ concurrency: 1, timeout: 70000, throwOnTimeout: true });
|
|
59
65
|
}
|
|
60
|
-
addEventSource(
|
|
61
|
-
return tslib_1.__awaiter(this,
|
|
66
|
+
addEventSource(url_1, listener_1, errorListener_1) {
|
|
67
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* (url, listener, errorListener, options = {}) {
|
|
62
68
|
const id = (0, uuid_1.v4)();
|
|
63
69
|
const errListener = errorListener
|
|
64
70
|
? errorListener
|
|
@@ -66,7 +72,7 @@ class HttpClient {
|
|
|
66
72
|
throw new Error(JSON.stringify(event, null, 2));
|
|
67
73
|
};
|
|
68
74
|
const es = new eventsource_1.default(`${this.baseURL}${url}`, {
|
|
69
|
-
headers: { authorization: 'Bearer ' +
|
|
75
|
+
headers: { authorization: 'Bearer ' + options.token ? options.token : yield this.getAccessToken() },
|
|
70
76
|
});
|
|
71
77
|
es.addEventListener('message', listener);
|
|
72
78
|
es.addEventListener('error', errListener);
|
|
@@ -100,12 +106,17 @@ class HttpClient {
|
|
|
100
106
|
}
|
|
101
107
|
discoverIssuer(uri) {
|
|
102
108
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
if (this.discoveredIssuers.has(uri)) {
|
|
110
|
+
return this.discoveredIssuers.get(uri);
|
|
111
|
+
}
|
|
103
112
|
const wellKnownUri = `${uri}/.well-known/openid-configuration`;
|
|
104
113
|
const issuerResponse = yield this.authAxiosInstance.get(wellKnownUri, {
|
|
105
114
|
responseType: 'json',
|
|
106
115
|
headers: { Accept: 'application/json' },
|
|
107
116
|
});
|
|
108
|
-
|
|
117
|
+
const validIssuer = this.validateIssuer(issuerResponse.data);
|
|
118
|
+
this.discoveredIssuers.set(uri, validIssuer);
|
|
119
|
+
return validIssuer;
|
|
109
120
|
});
|
|
110
121
|
}
|
|
111
122
|
requestAccessToken() {
|
|
@@ -157,5 +168,15 @@ class HttpClient {
|
|
|
157
168
|
return this.requestAccessToken(opts);
|
|
158
169
|
});
|
|
159
170
|
}
|
|
171
|
+
provideExternalToken(token) {
|
|
172
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
173
|
+
const issuer = yield this.discoverIssuer(`${this.authBaseURL}/realms/${this.realm}`);
|
|
174
|
+
const { iss: providedIssuer, exp } = (0, jose_1.decodeJwt)(token);
|
|
175
|
+
if (issuer.issuer !== providedIssuer) {
|
|
176
|
+
throw new Error(`Provided token is not issued by currently configured issuer. Provided token issued by ${providedIssuer}, but ${issuer.issuer} is configured.`);
|
|
177
|
+
}
|
|
178
|
+
this.tokenSet = new token_set_1.TokenSet(token, exp - Date.now() / 1000, true);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
160
181
|
}
|
|
161
182
|
exports.HttpClient = HttpClient;
|
package/dist/label.service.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DataService } from './data.service';
|
|
2
|
-
import { HttpClient } from './http.service';
|
|
2
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
3
3
|
import { Label } from './label.interface';
|
|
4
4
|
export declare class LabelService extends DataService<Label> {
|
|
5
5
|
constructor(httpClient: HttpClient);
|
|
6
|
-
addMany(dtos: Label[]): Promise<Label[]>;
|
|
7
|
-
getOneByName(name: string): Promise<Label>;
|
|
8
|
-
count(): Promise<number>;
|
|
6
|
+
addMany(dtos: Label[], options?: TokenOption): Promise<Label[]>;
|
|
7
|
+
getOneByName(name: string, options?: TokenOption): Promise<Label>;
|
|
8
|
+
count(options?: TokenOption): Promise<number>;
|
|
9
9
|
}
|
package/dist/label.service.js
CHANGED
|
@@ -6,14 +6,14 @@ class LabelService extends data_service_1.DataService {
|
|
|
6
6
|
constructor(httpClient) {
|
|
7
7
|
super(httpClient, '/labels');
|
|
8
8
|
}
|
|
9
|
-
addMany(dtos) {
|
|
10
|
-
return Promise.all(dtos.map((dto) => this.addOne(dto)));
|
|
9
|
+
addMany(dtos, options = {}) {
|
|
10
|
+
return Promise.all(dtos.map((dto) => this.addOne(dto, options)));
|
|
11
11
|
}
|
|
12
|
-
getOneByName(name) {
|
|
13
|
-
return this.httpClient.get(`${this.basePath}/name/${name}
|
|
12
|
+
getOneByName(name, options = {}) {
|
|
13
|
+
return this.httpClient.get(`${this.basePath}/name/${name}`, options);
|
|
14
14
|
}
|
|
15
|
-
count() {
|
|
16
|
-
return this.httpClient.get(`${this.basePath}/count
|
|
15
|
+
count(options = {}) {
|
|
16
|
+
return this.httpClient.get(`${this.basePath}/count`, options);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
exports.LabelService = LabelService;
|
package/dist/proxy.service.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { HttpClient } from './http.service';
|
|
2
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
3
3
|
export declare class ProxyService {
|
|
4
4
|
private readonly httpClient;
|
|
5
5
|
constructor(httpClient: HttpClient);
|
|
6
|
-
delete: <T>(proxyId: string, path: string, config?: AxiosRequestConfig) => Promise<T>;
|
|
7
|
-
get: <T>(proxyId: string, path: string, config?: AxiosRequestConfig) => Promise<T>;
|
|
8
|
-
post: <T>(proxyId: string, path: string, data: any, config?: AxiosRequestConfig) => Promise<T>;
|
|
9
|
-
put: <T>(proxyId: string, path: string, data: any, config?: AxiosRequestConfig) => Promise<T>;
|
|
6
|
+
delete: <T>(proxyId: string, path: string, config?: TokenOption & AxiosRequestConfig) => Promise<T>;
|
|
7
|
+
get: <T>(proxyId: string, path: string, config?: TokenOption & AxiosRequestConfig) => Promise<T>;
|
|
8
|
+
post: <T>(proxyId: string, path: string, data: any, config?: TokenOption & AxiosRequestConfig) => Promise<T>;
|
|
9
|
+
put: <T>(proxyId: string, path: string, data: any, config?: TokenOption & AxiosRequestConfig) => Promise<T>;
|
|
10
10
|
private url;
|
|
11
11
|
}
|
package/dist/task.service.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { APIBase } from './api-base';
|
|
2
2
|
import { DataService } from './data.service';
|
|
3
|
-
import { HttpClient } from './http.service';
|
|
3
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
4
4
|
import { Task } from './task.interface';
|
|
5
5
|
import { TrashService } from './trash.service';
|
|
6
6
|
interface BaseService extends DataService<Task>, TrashService<Task> {
|
|
@@ -9,6 +9,6 @@ declare class BaseService extends APIBase {
|
|
|
9
9
|
}
|
|
10
10
|
export declare class TaskService extends BaseService {
|
|
11
11
|
constructor(httpClient: HttpClient);
|
|
12
|
-
createTaskAttachedToAsset(dto: any): Promise<Task>;
|
|
12
|
+
createTaskAttachedToAsset(dto: any, options?: TokenOption): Promise<Task>;
|
|
13
13
|
}
|
|
14
14
|
export {};
|
package/dist/task.service.js
CHANGED
|
@@ -15,8 +15,8 @@ class TaskService extends BaseService {
|
|
|
15
15
|
constructor(httpClient) {
|
|
16
16
|
super(httpClient, '/tasks');
|
|
17
17
|
}
|
|
18
|
-
createTaskAttachedToAsset(dto) {
|
|
19
|
-
return this.httpClient.post(this.basePath, dto);
|
|
18
|
+
createTaskAttachedToAsset(dto, options = {}) {
|
|
19
|
+
return this.httpClient.post(this.basePath, dto, options);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.TaskService = TaskService;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { APIBase } from './api-base';
|
|
2
2
|
import { Paginated } from './data.interface';
|
|
3
3
|
import { DataService } from './data.service';
|
|
4
|
-
import { HttpClient } from './http.service';
|
|
4
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
5
5
|
import { TimeSeries, TimeSeriesValue, TS_GROUPS } from './timeseries.interface';
|
|
6
6
|
import { TrashService } from './trash.service';
|
|
7
7
|
interface BaseService extends DataService<TimeSeries>, TrashService<TimeSeries> {
|
|
@@ -12,7 +12,7 @@ export declare class TimeSeriesService extends BaseService {
|
|
|
12
12
|
constructor(httpClient: HttpClient);
|
|
13
13
|
addValue(id: string, value: {
|
|
14
14
|
[timestamp: string]: any;
|
|
15
|
-
}): Promise<void>;
|
|
15
|
+
}, options?: TokenOption): Promise<void>;
|
|
16
16
|
/**
|
|
17
17
|
* Adds time series values to an asset by the name of the time series.
|
|
18
18
|
* If the time series does not exist, it is created.
|
|
@@ -25,11 +25,12 @@ export declare class TimeSeriesService extends BaseService {
|
|
|
25
25
|
* [timestamp: string]: any, // The timestamp and value pairs
|
|
26
26
|
* ...
|
|
27
27
|
* }
|
|
28
|
+
* @param options
|
|
28
29
|
* @returns a promise that resolves to the time series that was added.
|
|
29
30
|
*/
|
|
30
31
|
addAssetTimeSeriesValues(assetId: string, name: string, readPermissions: string[], readWritePermissions: string[], values: {
|
|
31
32
|
[timestamp: string]: any;
|
|
32
|
-
}): Promise<TimeSeries>;
|
|
33
|
+
}, options?: TokenOption): Promise<TimeSeries>;
|
|
33
34
|
/**
|
|
34
35
|
* Adds multiple time series values to an asset by the name of the time series.
|
|
35
36
|
* If the time series does not exist, it is created.
|
|
@@ -46,6 +47,7 @@ export declare class TimeSeriesService extends BaseService {
|
|
|
46
47
|
* },
|
|
47
48
|
* ...
|
|
48
49
|
* }
|
|
50
|
+
* @param options
|
|
49
51
|
* @returns a promise that resolves to an array of objects containing the results of the operation.
|
|
50
52
|
* Each object has the following structure:
|
|
51
53
|
* {
|
|
@@ -58,10 +60,10 @@ export declare class TimeSeriesService extends BaseService {
|
|
|
58
60
|
[timeSeriesName: string]: {
|
|
59
61
|
[timestamp: string]: any;
|
|
60
62
|
};
|
|
61
|
-
}): Promise<PromiseSettledResult<TimeSeries>[]>;
|
|
62
|
-
getMostRecentValue(id: string, before?: Date): Promise<TimeSeriesValue>;
|
|
63
|
-
getValues(id: string, from: number, limit?: number, group?: TS_GROUPS): Promise<TimeSeriesValue[]>;
|
|
64
|
-
getValuesOfPeriod(id: string, from: number, to: number, group?: TS_GROUPS): Promise<TimeSeriesValue[]>;
|
|
65
|
-
getManyByAsset(assetId: string, names?: string[]): Promise<Paginated<TimeSeries[]>>;
|
|
63
|
+
}, options?: TokenOption): Promise<PromiseSettledResult<TimeSeries>[]>;
|
|
64
|
+
getMostRecentValue(id: string, before?: Date, options?: TokenOption): Promise<TimeSeriesValue>;
|
|
65
|
+
getValues(id: string, from: number, limit?: number, group?: TS_GROUPS, options?: TokenOption): Promise<TimeSeriesValue[]>;
|
|
66
|
+
getValuesOfPeriod(id: string, from: number, to: number, group?: TS_GROUPS, options?: TokenOption): Promise<TimeSeriesValue[]>;
|
|
67
|
+
getManyByAsset(assetId: string, names?: string[], options?: TokenOption): Promise<Paginated<TimeSeries[]>>;
|
|
66
68
|
}
|
|
67
69
|
export {};
|
|
@@ -15,42 +15,42 @@ class TimeSeriesService extends BaseService {
|
|
|
15
15
|
constructor(httpClient) {
|
|
16
16
|
super(httpClient, '/tsm');
|
|
17
17
|
}
|
|
18
|
-
addValue(id, value) {
|
|
19
|
-
return this.httpClient.post(`${this.basePath}/${id}`, value);
|
|
18
|
+
addValue(id, value, options = {}) {
|
|
19
|
+
return this.httpClient.post(`${this.basePath}/${id}`, value, options);
|
|
20
20
|
}
|
|
21
|
-
addAssetTimeSeriesValues(assetId, name, readPermissions, readWritePermissions, values) {
|
|
21
|
+
addAssetTimeSeriesValues(assetId, name, readPermissions, readWritePermissions, values, options = {}) {
|
|
22
22
|
const dto = {
|
|
23
23
|
name,
|
|
24
24
|
readPermissions,
|
|
25
25
|
readWritePermissions,
|
|
26
26
|
values,
|
|
27
27
|
};
|
|
28
|
-
return this.httpClient.post(`${this.basePath}/assets/${assetId}`, dto);
|
|
28
|
+
return this.httpClient.post(`${this.basePath}/assets/${assetId}`, dto, options);
|
|
29
29
|
}
|
|
30
|
-
addManyAssetTimeSeriesValues(assetId, readPermissions, readWritePermissions, timeSeries) {
|
|
30
|
+
addManyAssetTimeSeriesValues(assetId, readPermissions, readWritePermissions, timeSeries, options = {}) {
|
|
31
31
|
const dtos = Object.entries(timeSeries).map(([name, values]) => ({
|
|
32
32
|
name,
|
|
33
33
|
readPermissions,
|
|
34
34
|
readWritePermissions,
|
|
35
35
|
values,
|
|
36
36
|
}));
|
|
37
|
-
return this.httpClient.post(`${this.basePath}/assets/${assetId}/bulk`, dtos);
|
|
37
|
+
return this.httpClient.post(`${this.basePath}/assets/${assetId}/bulk`, dtos, options);
|
|
38
38
|
}
|
|
39
|
-
getMostRecentValue(id, before) {
|
|
39
|
+
getMostRecentValue(id, before, options = {}) {
|
|
40
40
|
const params = before ? { before: before.toISOString() } : {};
|
|
41
|
-
return this.httpClient.get(`${this.basePath}/${id}/recent`, { params });
|
|
41
|
+
return this.httpClient.get(`${this.basePath}/${id}/recent`, Object.assign({ params }, options));
|
|
42
42
|
}
|
|
43
|
-
getValues(id, from, limit, group) {
|
|
43
|
+
getValues(id, from, limit, group, options = {}) {
|
|
44
44
|
const params = { limit, group };
|
|
45
|
-
return this.httpClient.get(`${this.basePath}/${id}/${from}`, { params });
|
|
45
|
+
return this.httpClient.get(`${this.basePath}/${id}/${from}`, Object.assign({ params }, options));
|
|
46
46
|
}
|
|
47
|
-
getValuesOfPeriod(id, from, to, group) {
|
|
47
|
+
getValuesOfPeriod(id, from, to, group, options = {}) {
|
|
48
48
|
const params = { group };
|
|
49
|
-
return this.httpClient.get(`${this.basePath}/${id}/${from}/${to}`, { params });
|
|
49
|
+
return this.httpClient.get(`${this.basePath}/${id}/${from}/${to}`, Object.assign({ params }, options));
|
|
50
50
|
}
|
|
51
|
-
getManyByAsset(assetId, names) {
|
|
51
|
+
getManyByAsset(assetId, names, options = {}) {
|
|
52
52
|
const params = Array.isArray(names) ? { names: names.join() } : {};
|
|
53
|
-
return this.httpClient.get(`${this.basePath}/asset/${assetId}`, { params });
|
|
53
|
+
return this.httpClient.get(`${this.basePath}/asset/${assetId}`, Object.assign({ params }, options));
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
exports.TimeSeriesService = TimeSeriesService;
|
package/dist/token-set.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export declare class TokenSet {
|
|
2
2
|
private readonly _accessToken;
|
|
3
3
|
private readonly _expiresAt;
|
|
4
|
-
|
|
4
|
+
private readonly _provided;
|
|
5
|
+
constructor(access_token: string, expires_in: number, provided?: boolean);
|
|
5
6
|
get accessToken(): string;
|
|
6
7
|
get expiresAt(): number;
|
|
7
8
|
get expiresIn(): number;
|
|
9
|
+
get provided(): boolean;
|
|
8
10
|
isExpired(): boolean;
|
|
9
11
|
}
|
package/dist/token-set.js
CHANGED
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TokenSet = void 0;
|
|
4
4
|
const TOKEN_EXPIRATION_BUFFER = 20;
|
|
5
5
|
class TokenSet {
|
|
6
|
-
constructor(access_token, expires_in) {
|
|
6
|
+
constructor(access_token, expires_in, provided = false) {
|
|
7
7
|
this._accessToken = access_token;
|
|
8
8
|
this._expiresAt = Math.floor(Date.now() / 1000) + Number(expires_in);
|
|
9
|
+
this._provided = provided;
|
|
9
10
|
}
|
|
10
11
|
get accessToken() {
|
|
11
12
|
return this._accessToken;
|
|
@@ -16,8 +17,11 @@ class TokenSet {
|
|
|
16
17
|
get expiresIn() {
|
|
17
18
|
return Math.max(this.expiresAt - Math.ceil(Date.now() / 1000), 0);
|
|
18
19
|
}
|
|
20
|
+
get provided() {
|
|
21
|
+
return this._provided;
|
|
22
|
+
}
|
|
19
23
|
isExpired() {
|
|
20
|
-
return this.expiresIn <= TOKEN_EXPIRATION_BUFFER;
|
|
24
|
+
return this.expiresIn <= (this.provided ? 0 : TOKEN_EXPIRATION_BUFFER);
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
27
|
exports.TokenSet = TokenSet;
|
package/dist/user.service.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { HttpClient } from './http.service';
|
|
1
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
2
2
|
import { UserSettings } from './user-settings.interface';
|
|
3
3
|
export declare class UserService {
|
|
4
4
|
private httpClient;
|
|
5
5
|
private readonly basePath;
|
|
6
6
|
constructor(httpClient: HttpClient);
|
|
7
7
|
getCurrentUserRoles(): Promise<string[]>;
|
|
8
|
-
getUserSettings(): Promise<UserSettings>;
|
|
9
|
-
updateUserSettings(settings: UserSettings): Promise<UserSettings>;
|
|
10
|
-
deleteUserSettings(): Promise<UserSettings>;
|
|
8
|
+
getUserSettings(options?: TokenOption): Promise<UserSettings>;
|
|
9
|
+
updateUserSettings(settings: UserSettings, options?: TokenOption): Promise<UserSettings>;
|
|
10
|
+
deleteUserSettings(options?: TokenOption): Promise<UserSettings>;
|
|
11
11
|
}
|
package/dist/user.service.js
CHANGED
|
@@ -20,14 +20,14 @@ class UserService {
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
getUserSettings() {
|
|
24
|
-
return this.httpClient.get(this.basePath);
|
|
23
|
+
getUserSettings(options = {}) {
|
|
24
|
+
return this.httpClient.get(this.basePath, options);
|
|
25
25
|
}
|
|
26
|
-
updateUserSettings(settings) {
|
|
27
|
-
return this.httpClient.put(this.basePath, settings);
|
|
26
|
+
updateUserSettings(settings, options = {}) {
|
|
27
|
+
return this.httpClient.put(this.basePath, settings, options);
|
|
28
28
|
}
|
|
29
|
-
deleteUserSettings() {
|
|
30
|
-
return this.httpClient.delete(this.basePath);
|
|
29
|
+
deleteUserSettings(options = {}) {
|
|
30
|
+
return this.httpClient.delete(this.basePath, options);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
exports.UserService = UserService;
|
package/dist/vault.service.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DataService } from './data.service';
|
|
2
2
|
import { VaultSecret } from './vault.interface';
|
|
3
|
-
import { HttpClient } from './http.service';
|
|
3
|
+
import { HttpClient, TokenOption } from './http.service';
|
|
4
4
|
export declare class VaultService extends DataService<VaultSecret> {
|
|
5
5
|
constructor(httpClient: HttpClient);
|
|
6
|
-
getSecret(name: string, version?: number): Promise<string>;
|
|
6
|
+
getSecret(name: string, version?: number, options?: TokenOption): Promise<string>;
|
|
7
7
|
}
|
package/dist/vault.service.js
CHANGED
|
@@ -6,9 +6,9 @@ class VaultService extends data_service_1.DataService {
|
|
|
6
6
|
constructor(httpClient) {
|
|
7
7
|
super(httpClient, '/vault/secrets');
|
|
8
8
|
}
|
|
9
|
-
getSecret(name, version) {
|
|
9
|
+
getSecret(name, version, options = {}) {
|
|
10
10
|
const params = version ? { version } : {};
|
|
11
|
-
return this.httpClient.get(`${this.basePath}/${name}/secret`, { params });
|
|
11
|
+
return this.httpClient.get(`${this.basePath}/${name}/secret`, Object.assign({ params }, options));
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
exports.VaultService = VaultService;
|