attlaz-client 1.11.10 → 1.11.12
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Utils } from '../../Utils.js';
|
|
2
2
|
export class StorageItem {
|
|
3
|
-
id;
|
|
3
|
+
// public id: string | null = null;
|
|
4
4
|
key;
|
|
5
5
|
bytes;
|
|
6
6
|
created;
|
|
@@ -9,12 +9,12 @@ export class StorageItem {
|
|
|
9
9
|
value;
|
|
10
10
|
static parse(raw) {
|
|
11
11
|
const storageItem = new StorageItem();
|
|
12
|
-
storageItem.id = raw.id;
|
|
12
|
+
// storageItem.id = raw.id === null || raw.id === undefined ? null : raw.id;
|
|
13
13
|
storageItem.key = raw.key;
|
|
14
14
|
storageItem.bytes = raw.bytes;
|
|
15
15
|
storageItem.value = raw.value;
|
|
16
|
-
storageItem.created = raw.
|
|
17
|
-
storageItem.updated = raw.
|
|
16
|
+
storageItem.created = raw.created === null ? null : Utils.parseRawDate(raw.created);
|
|
17
|
+
storageItem.updated = raw.updated === null ? null : Utils.parseRawDate(raw.updated);
|
|
18
18
|
storageItem.expiration = raw.expiration === null ? null : Utils.parseRawDate(raw.expiration);
|
|
19
19
|
return storageItem;
|
|
20
20
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Utils } from '../../Utils.js';
|
|
2
2
|
export class StorageItemInformation {
|
|
3
|
-
id;
|
|
3
|
+
// public id: string | null = null;
|
|
4
4
|
key;
|
|
5
5
|
bytes;
|
|
6
6
|
created;
|
|
@@ -8,11 +8,11 @@ export class StorageItemInformation {
|
|
|
8
8
|
expiration;
|
|
9
9
|
static parse(raw) {
|
|
10
10
|
const storageItemInformation = new StorageItemInformation();
|
|
11
|
-
storageItemInformation.id = raw.id;
|
|
11
|
+
// storageItemInformation.id = raw.id;
|
|
12
12
|
storageItemInformation.key = raw.key;
|
|
13
13
|
storageItemInformation.bytes = raw.bytes;
|
|
14
|
-
storageItemInformation.created = raw.
|
|
15
|
-
storageItemInformation.updated = raw.
|
|
14
|
+
storageItemInformation.created = raw.created === null ? null : Utils.parseRawDate(raw.created);
|
|
15
|
+
storageItemInformation.updated = raw.updated === null ? null : Utils.parseRawDate(raw.updated);
|
|
16
16
|
storageItemInformation.expiration = raw.expiration === null ? null : Utils.parseRawDate(raw.expiration);
|
|
17
17
|
return storageItemInformation;
|
|
18
18
|
}
|
package/dist/Service/Endpoint.js
CHANGED
|
@@ -81,13 +81,13 @@ export class Endpoint {
|
|
|
81
81
|
* Parse data
|
|
82
82
|
*/
|
|
83
83
|
if (requestResponse === null || requestResponse === undefined) {
|
|
84
|
-
throw new Error('Unable to parse collection: response is empty');
|
|
84
|
+
throw new Error('Unable to parse collection: response is empty for action `[' + method + '] ' + action + '`');
|
|
85
85
|
}
|
|
86
86
|
if (!requestResponse.hasOwnProperty('data') || requestResponse.data === undefined) {
|
|
87
|
-
throw new Error('Unable to parse collection: data is not defined');
|
|
87
|
+
throw new Error('Unable to parse collection: data is not defined in response from action `[' + method + '] ' + action + '`');
|
|
88
88
|
}
|
|
89
89
|
if (!requestResponse.hasOwnProperty('has_more') || requestResponse.has_more === undefined) {
|
|
90
|
-
throw new Error('Unable to parse collection: hasMore is not defined');
|
|
90
|
+
throw new Error('Unable to parse collection: hasMore is not defined in response from action `[' + method + '] ' + action + '`');
|
|
91
91
|
}
|
|
92
92
|
const hasMore = Utils.isTrue(requestResponse.has_more);
|
|
93
93
|
result.setData(this.parseCollection(requestResponse.data, parser), hasMore);
|
|
@@ -104,7 +104,7 @@ export class Endpoint {
|
|
|
104
104
|
*/
|
|
105
105
|
// TODO: temporary check until we know the API is fully upgraded
|
|
106
106
|
if (requestResponse === null || requestResponse === undefined) {
|
|
107
|
-
throw new Error('Unable to parse object: response is empty');
|
|
107
|
+
throw new Error('Unable to parse object: response is empty for action `[' + method + '] ' + action + '`');
|
|
108
108
|
}
|
|
109
109
|
if ((requestResponse.hasOwnProperty('data') && !requestResponse.hasOwnProperty('id')) && requestResponse.data !== undefined) {
|
|
110
110
|
console.error('Response for object "' + action + '" seem to still use old "data" property', { requestResponse });
|