attlaz-client 1.10.18 → 1.10.20

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.
@@ -0,0 +1,10 @@
1
+ import { DataValueValue } from '../DataValue';
2
+ import { CollectionResult } from '../Result/CollectionResult';
3
+ import { DataValueCollection } from '../DataValueCollection';
4
+ export declare class AdapterConnectionConfigurationValue {
5
+ id: string;
6
+ config_id: string;
7
+ config_key: string;
8
+ value: DataValueValue | null;
9
+ static toDataValueCollection(adapterCollectionResult: CollectionResult<AdapterConnectionConfigurationValue>): DataValueCollection;
10
+ }
@@ -0,0 +1,16 @@
1
+ import { DataValueCollection } from '../DataValueCollection';
2
+ export class AdapterConnectionConfigurationValue {
3
+ id;
4
+ config_id;
5
+ config_key;
6
+ value;
7
+ static toDataValueCollection(adapterCollectionResult) {
8
+ const result = new DataValueCollection();
9
+ for (const y of adapterCollectionResult.getData()) {
10
+ if (y.value !== null) {
11
+ result.set(y.config_key, y.value);
12
+ }
13
+ }
14
+ return result;
15
+ }
16
+ }
@@ -4,6 +4,7 @@ import { AdapterConnection } from '../Model/Adapter/AdapterConnection.js';
4
4
  import { AdapterConfiguration } from '../Model/Adapter/AdapterConfiguration.js';
5
5
  import { CollectionResult } from '../Model/Result/CollectionResult.js';
6
6
  import { DataValueCollection } from '../Model/DataValueCollection.js';
7
+ import { AdapterConnectionConfigurationValue } from '../Model/Adapter/AdapterConnectionConfigurationValue';
7
8
  export declare class AdapterEndpoint extends Endpoint {
8
9
  getAdapters(): Promise<CollectionResult<Adapter>>;
9
10
  getAdapter(adapterId: string): Promise<Adapter | null>;
@@ -11,7 +12,7 @@ export declare class AdapterEndpoint extends Endpoint {
11
12
  getConnections(projectId: string): Promise<CollectionResult<AdapterConnection>>;
12
13
  getConnectionById(connectionId: string): Promise<AdapterConnection | null>;
13
14
  getConnectionByKey(projectId: string, connectionKey: string): Promise<AdapterConnection | null>;
14
- getConnectionConfiguration(connectionId: string): Promise<DataValueCollection | null>;
15
+ getConnectionConfiguration(connectionId: string): Promise<CollectionResult<AdapterConnectionConfigurationValue>>;
15
16
  saveConnection(projectId: string, connection: AdapterConnection): Promise<AdapterConnection>;
16
17
  saveConnectionConfiguration(connectionId: string, configuration: DataValueCollection): Promise<boolean>;
17
18
  }
@@ -2,7 +2,6 @@ import { Endpoint } from './Endpoint.js';
2
2
  import { Adapter } from '../Model/Adapter/Adapter.js';
3
3
  import { AdapterConnection } from '../Model/Adapter/AdapterConnection.js';
4
4
  import { AdapterConfiguration } from '../Model/Adapter/AdapterConfiguration.js';
5
- import { DataValueCollection } from '../Model/DataValueCollection.js';
6
5
  export class AdapterEndpoint extends Endpoint {
7
6
  async getAdapters() {
8
7
  try {
@@ -68,7 +67,7 @@ export class AdapterEndpoint extends Endpoint {
68
67
  }
69
68
  async getConnectionByKey(projectId, connectionKey) {
70
69
  try {
71
- const url = '/project/' + projectId + '/connections/' + connectionKey;
70
+ const url = '/projects/' + projectId + '/connections/' + connectionKey;
72
71
  const result = await this.requestObject(url, null, AdapterConnection.parse);
73
72
  return result.getData();
74
73
  }
@@ -82,13 +81,10 @@ export class AdapterEndpoint extends Endpoint {
82
81
  async getConnectionConfiguration(connectionId) {
83
82
  try {
84
83
  const url = '/connections/' + connectionId + '/configuration';
85
- const parser = (raw) => (DataValueCollection.fromObject(raw.configuration));
86
- const result = await this.requestObject(url, null, parser);
87
- const configuration = result.getData();
88
- if (configuration === null) {
89
- throw new Error('Adapter configuration loaded');
90
- }
91
- return configuration;
84
+ const parser = (raw) => ({
85
+ id: raw.id, config_id: raw.config, config_key: raw.config_key, value: raw.value,
86
+ });
87
+ return this.requestCollection(url, parser);
92
88
  }
93
89
  catch (error) {
94
90
  if (this.httpClient.isDebugEnabled()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.10.18",
3
+ "version": "1.10.20",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",