attlaz-client 1.8.14 → 1.8.15

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.
@@ -2,4 +2,5 @@ export declare class StorageItem {
2
2
  key: string;
3
3
  value: string | number | boolean | null | any;
4
4
  expiration: Date | null;
5
+ static parse(raw: any): StorageItem;
5
6
  }
@@ -2,5 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StorageItem = void 0;
4
4
  class StorageItem {
5
+ static parse(raw) {
6
+ let storageItem = new StorageItem();
7
+ storageItem.key = raw.key;
8
+ storageItem.value = raw.value;
9
+ storageItem.expiration = new Date(raw.expiration);
10
+ return storageItem;
11
+ }
5
12
  }
6
13
  exports.StorageItem = StorageItem;
@@ -2,4 +2,5 @@ export declare class StorageItemInformation {
2
2
  key: string;
3
3
  bytes: number;
4
4
  expiration: Date | null;
5
+ static parse(raw: any): StorageItemInformation;
5
6
  }
@@ -2,5 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StorageItemInformation = void 0;
4
4
  class StorageItemInformation {
5
+ static parse(raw) {
6
+ let storageItemInformation = new StorageItemInformation();
7
+ storageItemInformation.key = raw.id;
8
+ storageItemInformation.bytes = raw.bytes;
9
+ storageItemInformation.expiration = new Date(raw.expiration);
10
+ return storageItemInformation;
11
+ }
5
12
  }
6
13
  exports.StorageItemInformation = StorageItemInformation;
@@ -6,6 +6,9 @@ export declare class WorkerConfig {
6
6
  static KEY_CPU_LIMIT: string;
7
7
  static KEY_PLATFORM: string;
8
8
  static KEY_WORKER_VERSION: string;
9
+ static KEY_API_ENDPOINT: string;
10
+ static KEY_API_CLIENT_ID: string;
11
+ static KEY_CLIENT_SECRET: string;
9
12
  projectEnvironment: string;
10
13
  key: string;
11
14
  value: DataValueValue | null;
@@ -18,3 +18,6 @@ WorkerConfig.KEY_MEMORY_LIMIT = 'memory_limit';
18
18
  WorkerConfig.KEY_CPU_LIMIT = 'cpu_limit';
19
19
  WorkerConfig.KEY_PLATFORM = 'platform';
20
20
  WorkerConfig.KEY_WORKER_VERSION = 'worker_version';
21
+ WorkerConfig.KEY_API_ENDPOINT = 'api_endpoint';
22
+ WorkerConfig.KEY_API_CLIENT_ID = 'api_client_id';
23
+ WorkerConfig.KEY_CLIENT_SECRET = 'api_client_secret';
@@ -8,7 +8,7 @@ export declare class StorageEndpoint extends Endpoint {
8
8
  getInformation(projectEnvironmentId: string, storageType: StorageType): Promise<DataResult<StorageInformation>>;
9
9
  clearPool(projectEnvironmentId: string, storageType: StorageType, poolKey: string): Promise<DataResult<any>>;
10
10
  getPoolItemsInformation(projectEnvironmentId: string, storageType: StorageType, poolKey: string): Promise<DataResult<StorageItemInformation[]>>;
11
- getItem(projectEnvironmentId: string, storageType: StorageType, poolKey: string, storageItemKey: string): Promise<DataResult<StorageItem>>;
12
- setItem(projectEnvironmentId: string, storageType: StorageType, poolKey: string, storageItem: StorageItem): Promise<DataResult<StorageItem>>;
11
+ getItem(projectEnvironmentId: string, storageType: StorageType, poolKey: string, storageItemKey: string): Promise<StorageItem | null>;
12
+ setItem(projectEnvironmentId: string, storageType: StorageType, poolKey: string, storageItem: StorageItem): Promise<void>;
13
13
  deleteItem(projectEnvironmentId: string, storageType: StorageType, poolKey: string, storageItemKey: string): Promise<DataResult<StorageItem>>;
14
14
  }
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StorageEndpoint = void 0;
4
4
  const Endpoint_1 = require("./Endpoint");
5
+ const StorageItem_1 = require("../Model/Storage/StorageItem");
6
+ const StorageItemInformation_1 = require("../Model/Storage/StorageItemInformation");
5
7
  class StorageEndpoint extends Endpoint_1.Endpoint {
6
8
  async getInformation(projectEnvironmentId, storageType) {
7
9
  let cmd = '/projectenvironments/' + projectEnvironmentId + '/storage/' + storageType;
@@ -33,6 +35,7 @@ class StorageEndpoint extends Endpoint_1.Endpoint {
33
35
  let cmd = '/projectenvironments/' + projectEnvironmentId + '/storage/' + storageType + '/' + poolKey + '/items';
34
36
  try {
35
37
  const result = await this.request(cmd, null, 'GET');
38
+ result.setData(this.parseCollection(result, StorageItemInformation_1.StorageItemInformation.parse));
36
39
  return result;
37
40
  }
38
41
  catch (ex) {
@@ -46,11 +49,16 @@ class StorageEndpoint extends Endpoint_1.Endpoint {
46
49
  let cmd = '/projectenvironments/' + projectEnvironmentId + '/storage/' + storageType + '/' + poolKey + '/items/' + storageItemKey;
47
50
  try {
48
51
  const result = await this.request(cmd, null, 'GET');
49
- return result;
52
+ if (result.getData() === null) {
53
+ return null;
54
+ }
55
+ else {
56
+ return StorageItem_1.StorageItem.parse(result.getData());
57
+ }
50
58
  }
51
59
  catch (ex) {
52
60
  if (this.httpClient.isDebugEnabled()) {
53
- console.error('Failed to get storage information', ex);
61
+ console.error('Failed to get storage item', ex);
54
62
  }
55
63
  throw ex;
56
64
  }
@@ -59,7 +67,7 @@ class StorageEndpoint extends Endpoint_1.Endpoint {
59
67
  let cmd = '/projectenvironments/' + projectEnvironmentId + '/storage/' + storageType + '/' + poolKey + '/items/' + storageItem.key;
60
68
  try {
61
69
  const result = await this.request(cmd, { 'storage_item': storageItem }, 'POST');
62
- return result;
70
+ return;
63
71
  }
64
72
  catch (ex) {
65
73
  if (this.httpClient.isDebugEnabled()) {
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.8.14";
1
+ export declare const VERSION = "1.8.15";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "1.8.14";
4
+ exports.VERSION = "1.8.15";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.8.14",
3
+ "version": "1.8.15",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",