@apigames/sdk-core 1.0.5 → 1.0.9

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.
@@ -262,11 +262,13 @@ class ResourceContainer {
262
262
  return this;
263
263
  }
264
264
  PageOffset(pageOffset, pageSize) {
265
+ (0, json_1.extractAndRedact)(this._queryParams.pagination, 'page');
265
266
  this._queryParams.pagination.offset = pageOffset;
266
267
  this._queryParams.pagination.size = pageSize;
267
268
  return this;
268
269
  }
269
270
  PageNumber(pageNumber, pageSize) {
271
+ (0, json_1.extractAndRedact)(this._queryParams.pagination, 'offset');
270
272
  this._queryParams.pagination.page = pageNumber;
271
273
  this._queryParams.pagination.size = pageSize;
272
274
  return this;
@@ -11,6 +11,8 @@ export default class ResourceObject implements IResourceObject {
11
11
  constructor(container: IResourceContainer);
12
12
  protected LoadAttributes(value: any): void;
13
13
  protected LoadRelationships(value: any): void;
14
+ protected UpdateAttributes(value: any): void;
15
+ protected UpdateRelationships(value: any): void;
14
16
  LoadData(value: any): IResourceObject;
15
17
  protected GetInsertPayload(): any;
16
18
  protected GetUpdatePayload(): any;
@@ -28,6 +28,12 @@ class ResourceObject {
28
28
  LoadRelationships(value) {
29
29
  throw new Error('Method or Property not implemented.');
30
30
  }
31
+ UpdateAttributes(value) {
32
+ throw new Error('Method or Property not implemented.');
33
+ }
34
+ UpdateRelationships(value) {
35
+ throw new Error('Method or Property not implemented.');
36
+ }
31
37
  LoadData(value) {
32
38
  if (!(0, json_1.hasProperty)(value, 'type') || (value.type !== this.type)) {
33
39
  throw new __1.SDKException('INVALID-RESOURCE-MAPPING', 'The resource data being loaded cannot be '
@@ -102,16 +108,18 @@ class ResourceObject {
102
108
  const queryOptions = {};
103
109
  const payload = this.GetInsertPayload();
104
110
  const response = yield this._container.restClient.Post(queryUri, payload, queryHeaders, queryOptions);
105
- if (!this.HasHeader(response.headers, 'location')) {
106
- throw new __1.SDKException('INVALID-LOCATION', 'The save operation was unable to retrieve the location '
107
- + 'of the resource created by the API.');
111
+ if ((0, json_1.hasProperty)(response, 'data') && (0, json_1.hasProperty)(response.data, 'data')
112
+ && (0, json_1.isObject)(response.data.data) && (0, json_1.hasProperty)(response.data.data, 'id')
113
+ && (0, json_1.isString)(response.data.data.id) && (0, json_1.hasProperty)(response.data.data, 'links')
114
+ && (0, json_1.isObject)(response.data.data.links) && (0, json_1.hasProperty)(response.data.data.links, 'self')
115
+ && (0, json_1.isString)(response.data.data.links.self)) {
116
+ this.id = response.data.data.id;
117
+ this._uri = response.data.data.links.self;
108
118
  }
109
- if (!this.HasHeader(response.headers, 'resourceId')) {
110
- throw new __1.SDKException('INVALID-RESOURCE-ID', 'The save operation was unable to retrieve the '
111
- + 'identifier of the resource created by the API.');
119
+ else {
120
+ throw new __1.SDKException('SAVE-FAILED', 'The save operation was unable to retrieve the identifier '
121
+ + 'of the resource created by the API.');
112
122
  }
113
- this.id = this.GetHeaderValue(response.headers, 'resourceid');
114
- this._uri = this.GetHeaderValue(response.headers, 'location');
115
123
  this._mode = ResourceObjectMode.ExistingDocument;
116
124
  });
117
125
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "API Games Limited",
4
4
  "description": "API Games SDK Core",
5
5
  "license": "UNLICENSED",
6
- "version": "1.0.5",
6
+ "version": "1.0.9",
7
7
  "main": "lib/index.js",
8
8
  "types": "lib/index.d.ts",
9
9
  "scripts": {