attlaz-client 1.18.10 → 1.19.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/Model/Adapter/AdapterConnection.d.ts +1 -0
- package/dist/Model/Adapter/AdapterConnection.js +3 -0
- package/dist/Model/Adapter/AdapterConnectionEvent.d.ts +9 -0
- package/dist/Model/Adapter/AdapterConnectionEvent.js +18 -0
- package/dist/Service/AdapterConnectionEndpoint.d.ts +15 -0
- package/dist/Service/AdapterConnectionEndpoint.js +103 -0
- package/dist/Service/AdapterEndpoint.d.ts +0 -8
- package/dist/Service/AdapterEndpoint.js +0 -93
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Utils } from '../../Utils.js';
|
|
1
2
|
import { AdapterConnectionStatus } from './AdapterConnectionStatus.js';
|
|
2
3
|
export class AdapterConnection {
|
|
3
4
|
id;
|
|
@@ -6,6 +7,7 @@ export class AdapterConnection {
|
|
|
6
7
|
name;
|
|
7
8
|
projectId;
|
|
8
9
|
status;
|
|
10
|
+
lastUsed = null;
|
|
9
11
|
static parse(rawAdapterConnection) {
|
|
10
12
|
const adapterConnection = new AdapterConnection();
|
|
11
13
|
adapterConnection.id = rawAdapterConnection.id;
|
|
@@ -14,6 +16,7 @@ export class AdapterConnection {
|
|
|
14
16
|
adapterConnection.name = rawAdapterConnection.name;
|
|
15
17
|
adapterConnection.projectId = rawAdapterConnection.project;
|
|
16
18
|
adapterConnection.status = AdapterConnectionStatus.fromString(rawAdapterConnection.status);
|
|
19
|
+
adapterConnection.lastUsed = rawAdapterConnection.last_used === null ? null : Utils.parseRawDate(rawAdapterConnection.last_used);
|
|
17
20
|
return adapterConnection;
|
|
18
21
|
}
|
|
19
22
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DataValueCollection } from '../DataValueCollection.js';
|
|
2
|
+
export declare class AdapterConnectionEvent {
|
|
3
|
+
id: string;
|
|
4
|
+
adapterConnection: string;
|
|
5
|
+
type: string;
|
|
6
|
+
time: Date;
|
|
7
|
+
data: DataValueCollection;
|
|
8
|
+
static parse(rawAdapterConnection: any): AdapterConnectionEvent;
|
|
9
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DataValueCollection } from '../DataValueCollection.js';
|
|
2
|
+
import { Utils } from '../../Utils.js';
|
|
3
|
+
export class AdapterConnectionEvent {
|
|
4
|
+
id;
|
|
5
|
+
adapterConnection;
|
|
6
|
+
type;
|
|
7
|
+
time;
|
|
8
|
+
data;
|
|
9
|
+
static parse(rawAdapterConnection) {
|
|
10
|
+
const adapterConnectionEvent = new AdapterConnectionEvent();
|
|
11
|
+
adapterConnectionEvent.id = rawAdapterConnection.id;
|
|
12
|
+
adapterConnectionEvent.adapterConnection = rawAdapterConnection.adapter_connection;
|
|
13
|
+
adapterConnectionEvent.type = rawAdapterConnection.type;
|
|
14
|
+
adapterConnectionEvent.time = Utils.parseRawDate(rawAdapterConnection.time);
|
|
15
|
+
adapterConnectionEvent.data = DataValueCollection.fromObject(rawAdapterConnection.data);
|
|
16
|
+
return adapterConnectionEvent;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AdapterConnection } from '../Model/Adapter/AdapterConnection.js';
|
|
2
|
+
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
3
|
+
import { AdapterConnectionConfigurationValue } from '../Model/Adapter/AdapterConnectionConfigurationValue.js';
|
|
4
|
+
import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
|
|
5
|
+
import { Endpoint } from './Endpoint.js';
|
|
6
|
+
import { AdapterConnectionEvent } from '../Model/Adapter/AdapterConnectionEvent.js';
|
|
7
|
+
export declare class AdapterConnectionEndpoint extends Endpoint {
|
|
8
|
+
getConnections(projectId: string, pagination: CursorPagination): Promise<CollectionResult<AdapterConnection>>;
|
|
9
|
+
getConnectionById(connectionId: string): Promise<AdapterConnection | null>;
|
|
10
|
+
getConnectionByKey(projectId: string, connectionKey: string): Promise<AdapterConnection | null>;
|
|
11
|
+
getConnectionConfiguration(connectionId: string): Promise<CollectionResult<AdapterConnectionConfigurationValue>>;
|
|
12
|
+
saveConnection(projectId: string, connection: AdapterConnection): Promise<AdapterConnection>;
|
|
13
|
+
saveConnectionConfiguration(connectionId: string, configuration: AdapterConnectionConfigurationValue[]): Promise<boolean>;
|
|
14
|
+
getConnectionEvents(connectionId: string, pagination: CursorPagination): Promise<CollectionResult<AdapterConnectionEvent>>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { AdapterConnection } from '../Model/Adapter/AdapterConnection.js';
|
|
2
|
+
import { QueryString } from '../Http/Data/QueryString.js';
|
|
3
|
+
import { Endpoint } from './Endpoint.js';
|
|
4
|
+
import { AdapterConnectionEvent } from '../Model/Adapter/AdapterConnectionEvent.js';
|
|
5
|
+
export class AdapterConnectionEndpoint extends Endpoint {
|
|
6
|
+
async getConnections(projectId, pagination) {
|
|
7
|
+
try {
|
|
8
|
+
const queryString = new QueryString('/projects/' + projectId + '/connections');
|
|
9
|
+
queryString.addPagination(pagination);
|
|
10
|
+
return await this.requestCollection(queryString, AdapterConnection.parse);
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
14
|
+
console.error('Failed to load adapters: ', error);
|
|
15
|
+
}
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async getConnectionById(connectionId) {
|
|
20
|
+
try {
|
|
21
|
+
const url = '/connections/' + connectionId;
|
|
22
|
+
const result = await this.requestObject(url, null, AdapterConnection.parse);
|
|
23
|
+
return result.getData();
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
27
|
+
console.error('Failed to load connection: ', error);
|
|
28
|
+
}
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async getConnectionByKey(projectId, connectionKey) {
|
|
33
|
+
try {
|
|
34
|
+
const url = '/projects/' + projectId + '/connections/' + connectionKey;
|
|
35
|
+
const result = await this.requestObject(url, null, AdapterConnection.parse);
|
|
36
|
+
return result.getData();
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
40
|
+
console.error('Failed to load connection: ', error);
|
|
41
|
+
}
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async getConnectionConfiguration(connectionId) {
|
|
46
|
+
try {
|
|
47
|
+
const url = '/connections/' + connectionId + '/configuration';
|
|
48
|
+
const parser = (raw) => ({
|
|
49
|
+
id: raw.id,
|
|
50
|
+
adapterConnectionId: raw.adapter_connection,
|
|
51
|
+
configurationId: raw.configuration,
|
|
52
|
+
value: raw.value,
|
|
53
|
+
});
|
|
54
|
+
return await this.requestCollection(url, parser);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
58
|
+
console.error('Failed to load connection: ', error);
|
|
59
|
+
}
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async saveConnection(projectId, connection) {
|
|
64
|
+
try {
|
|
65
|
+
const url = '/projects/' + projectId + '/connections';
|
|
66
|
+
const result = await this.requestObject(url, connection, AdapterConnection.parse, 'POST');
|
|
67
|
+
const updatedAdapterConnection = result.getData();
|
|
68
|
+
if (updatedAdapterConnection === null) {
|
|
69
|
+
throw new Error('AdapterConnection not updated');
|
|
70
|
+
}
|
|
71
|
+
return updatedAdapterConnection;
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
75
|
+
console.error('Failed to save connection: ', error);
|
|
76
|
+
}
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async saveConnectionConfiguration(connectionId, configuration) {
|
|
81
|
+
try {
|
|
82
|
+
const url = '/connections/' + connectionId + '/configuration';
|
|
83
|
+
const parser = (raw) => ({ saved: raw.saved });
|
|
84
|
+
const result = await this.requestObject(url, { configuration: configuration }, parser, 'POST');
|
|
85
|
+
const res = result.getData();
|
|
86
|
+
if (res === null) {
|
|
87
|
+
throw new Error('Unable to save connection configuration: wrong response from API');
|
|
88
|
+
}
|
|
89
|
+
return res.saved;
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
93
|
+
console.error('Failed to save connection: ', error);
|
|
94
|
+
}
|
|
95
|
+
throw error;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async getConnectionEvents(connectionId, pagination) {
|
|
99
|
+
const queryString = new QueryString('/adapters/connections/' + connectionId + '/events');
|
|
100
|
+
queryString.addPagination(pagination);
|
|
101
|
+
return await this.requestCollection(queryString, AdapterConnectionEvent.parse);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Adapter } from '../Model/Adapter/Adapter.js';
|
|
2
|
-
import { AdapterConnection } from '../Model/Adapter/AdapterConnection.js';
|
|
3
2
|
import { AdapterConfiguration } from '../Model/Adapter/AdapterConfiguration.js';
|
|
4
3
|
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
5
|
-
import { AdapterConnectionConfigurationValue } from '../Model/Adapter/AdapterConnectionConfigurationValue.js';
|
|
6
4
|
import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
|
|
7
5
|
import { AdapterCategory } from '../Model/Adapter/AdapterCategory.js';
|
|
8
6
|
import { Endpoint } from './Endpoint.js';
|
|
@@ -10,11 +8,5 @@ export declare class AdapterEndpoint extends Endpoint {
|
|
|
10
8
|
getAdapters(pagination?: CursorPagination | null, withMedia?: boolean): Promise<CollectionResult<Adapter>>;
|
|
11
9
|
getAdapter(adapterId: string, withMedia?: boolean): Promise<Adapter | null>;
|
|
12
10
|
getAdapterConfiguration(adapterId: string): Promise<CollectionResult<AdapterConfiguration>>;
|
|
13
|
-
getConnections(projectId: string, pagination: CursorPagination): Promise<CollectionResult<AdapterConnection>>;
|
|
14
|
-
getConnectionById(connectionId: string): Promise<AdapterConnection | null>;
|
|
15
|
-
getConnectionByKey(projectId: string, connectionKey: string): Promise<AdapterConnection | null>;
|
|
16
|
-
getConnectionConfiguration(connectionId: string): Promise<CollectionResult<AdapterConnectionConfigurationValue>>;
|
|
17
|
-
saveConnection(projectId: string, connection: AdapterConnection): Promise<AdapterConnection>;
|
|
18
|
-
saveConnectionConfiguration(connectionId: string, configuration: AdapterConnectionConfigurationValue[]): Promise<boolean>;
|
|
19
11
|
getAdapterCategories(pagination: CursorPagination): Promise<CollectionResult<AdapterCategory>>;
|
|
20
12
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Adapter } from '../Model/Adapter/Adapter.js';
|
|
2
|
-
import { AdapterConnection } from '../Model/Adapter/AdapterConnection.js';
|
|
3
2
|
import { AdapterConfiguration } from '../Model/Adapter/AdapterConfiguration.js';
|
|
4
3
|
import { QueryString } from '../Http/Data/QueryString.js';
|
|
5
4
|
import { AdapterCategory } from '../Model/Adapter/AdapterCategory.js';
|
|
@@ -49,98 +48,6 @@ export class AdapterEndpoint extends Endpoint {
|
|
|
49
48
|
throw error;
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
|
-
async getConnections(projectId, pagination) {
|
|
53
|
-
try {
|
|
54
|
-
const queryString = new QueryString('/projects/' + projectId + '/connections');
|
|
55
|
-
queryString.addPagination(pagination);
|
|
56
|
-
return await this.requestCollection(queryString, AdapterConnection.parse);
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
if (this.httpClient.isDebugEnabled()) {
|
|
60
|
-
console.error('Failed to load adapters: ', error);
|
|
61
|
-
}
|
|
62
|
-
throw error;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
async getConnectionById(connectionId) {
|
|
66
|
-
try {
|
|
67
|
-
const url = '/connections/' + connectionId;
|
|
68
|
-
const result = await this.requestObject(url, null, AdapterConnection.parse);
|
|
69
|
-
return result.getData();
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
if (this.httpClient.isDebugEnabled()) {
|
|
73
|
-
console.error('Failed to load connection: ', error);
|
|
74
|
-
}
|
|
75
|
-
throw error;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
async getConnectionByKey(projectId, connectionKey) {
|
|
79
|
-
try {
|
|
80
|
-
const url = '/projects/' + projectId + '/connections/' + connectionKey;
|
|
81
|
-
const result = await this.requestObject(url, null, AdapterConnection.parse);
|
|
82
|
-
return result.getData();
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
if (this.httpClient.isDebugEnabled()) {
|
|
86
|
-
console.error('Failed to load connection: ', error);
|
|
87
|
-
}
|
|
88
|
-
throw error;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
async getConnectionConfiguration(connectionId) {
|
|
92
|
-
try {
|
|
93
|
-
const url = '/connections/' + connectionId + '/configuration';
|
|
94
|
-
const parser = (raw) => ({
|
|
95
|
-
id: raw.id,
|
|
96
|
-
adapterConnectionId: raw.adapter_connection,
|
|
97
|
-
configurationId: raw.configuration,
|
|
98
|
-
value: raw.value,
|
|
99
|
-
});
|
|
100
|
-
return await this.requestCollection(url, parser);
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
if (this.httpClient.isDebugEnabled()) {
|
|
104
|
-
console.error('Failed to load connection: ', error);
|
|
105
|
-
}
|
|
106
|
-
throw error;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
async saveConnection(projectId, connection) {
|
|
110
|
-
try {
|
|
111
|
-
const url = '/projects/' + projectId + '/connections';
|
|
112
|
-
const result = await this.requestObject(url, connection, AdapterConnection.parse, 'POST');
|
|
113
|
-
const updatedAdapterConnection = result.getData();
|
|
114
|
-
if (updatedAdapterConnection === null) {
|
|
115
|
-
throw new Error('AdapterConnection not updated');
|
|
116
|
-
}
|
|
117
|
-
return updatedAdapterConnection;
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
if (this.httpClient.isDebugEnabled()) {
|
|
121
|
-
console.error('Failed to save connection: ', error);
|
|
122
|
-
}
|
|
123
|
-
throw error;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
async saveConnectionConfiguration(connectionId, configuration) {
|
|
127
|
-
try {
|
|
128
|
-
const url = '/connections/' + connectionId + '/configuration';
|
|
129
|
-
const parser = (raw) => ({ saved: raw.saved });
|
|
130
|
-
const result = await this.requestObject(url, { configuration: configuration }, parser, 'POST');
|
|
131
|
-
const res = result.getData();
|
|
132
|
-
if (res === null) {
|
|
133
|
-
throw new Error('Unable to save connection configuration: wrong response from API');
|
|
134
|
-
}
|
|
135
|
-
return res.saved;
|
|
136
|
-
}
|
|
137
|
-
catch (error) {
|
|
138
|
-
if (this.httpClient.isDebugEnabled()) {
|
|
139
|
-
console.error('Failed to save connection: ', error);
|
|
140
|
-
}
|
|
141
|
-
throw error;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
51
|
async getAdapterCategories(pagination) {
|
|
145
52
|
try {
|
|
146
53
|
const queryString = new QueryString('/adapter-categories');
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export { AdapterConnection } from './Model/Adapter/AdapterConnection.js';
|
|
|
23
23
|
export { AdapterCategory } from './Model/Adapter/AdapterCategory.js';
|
|
24
24
|
export { AdapterConnectionStatus } from './Model/Adapter/AdapterConnectionStatus.js';
|
|
25
25
|
export { AdapterConnectionConfigurationValue } from './Model/Adapter/AdapterConnectionConfigurationValue.js';
|
|
26
|
+
export { AdapterConnectionEvent } from './Model/Adapter/AdapterConnectionEvent.js';
|
|
26
27
|
export { EventType } from './Model/Event/EventType.js';
|
|
27
28
|
export { HealthAlert } from './Model/HealthAlert/HealthAlert.js';
|
|
28
29
|
export { HealthAlertStatus } from './Model/HealthAlert/HealthAlertStatus.js';
|
|
@@ -117,6 +118,7 @@ export { UserAction } from './Model/User/UserAction.js';
|
|
|
117
118
|
export { RunnerImage } from './Model/Runner/RunnerImage.js';
|
|
118
119
|
export { Endpoint } from './Service/Endpoint.js';
|
|
119
120
|
export { AdapterEndpoint } from './Service/AdapterEndpoint.js';
|
|
121
|
+
export { AdapterConnectionEndpoint } from './Service/AdapterConnectionEndpoint.js';
|
|
120
122
|
export { ChannelEndpoint } from './Service/ChannelEndpoint.js';
|
|
121
123
|
export { ProjectEndpoint } from './Service/ProjectEndpoint.js';
|
|
122
124
|
export { ConfigEndpoint } from './Service/ConfigEndpoint.js';
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ export { AdapterConnection } from './Model/Adapter/AdapterConnection.js';
|
|
|
18
18
|
export { AdapterCategory } from './Model/Adapter/AdapterCategory.js';
|
|
19
19
|
export { AdapterConnectionStatus } from './Model/Adapter/AdapterConnectionStatus.js';
|
|
20
20
|
export { AdapterConnectionConfigurationValue } from './Model/Adapter/AdapterConnectionConfigurationValue.js';
|
|
21
|
+
export { AdapterConnectionEvent } from './Model/Adapter/AdapterConnectionEvent.js';
|
|
21
22
|
export { EventType } from './Model/Event/EventType.js';
|
|
22
23
|
export { HealthAlert } from './Model/HealthAlert/HealthAlert.js';
|
|
23
24
|
export { HealthAlertStatus } from './Model/HealthAlert/HealthAlertStatus.js';
|
|
@@ -112,6 +113,7 @@ export { RunnerImage } from './Model/Runner/RunnerImage.js';
|
|
|
112
113
|
export { Endpoint } from './Service/Endpoint.js';
|
|
113
114
|
/* Endpoints */
|
|
114
115
|
export { AdapterEndpoint } from './Service/AdapterEndpoint.js';
|
|
116
|
+
export { AdapterConnectionEndpoint } from './Service/AdapterConnectionEndpoint.js';
|
|
115
117
|
export { ChannelEndpoint } from './Service/ChannelEndpoint.js';
|
|
116
118
|
export { ProjectEndpoint } from './Service/ProjectEndpoint.js';
|
|
117
119
|
export { ConfigEndpoint } from './Service/ConfigEndpoint.js';
|