@apigames/sdk-core 23.2.2 → 23.2.4

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.
@@ -54,4 +54,5 @@ export default class ResourceContainer implements IResourceContainer {
54
54
  Include(include: ResourceIncludeOption): IResourceContainer;
55
55
  PageOffset(pageOffset: number, pageSize: number): IResourceContainer;
56
56
  PageNumber(pageNumber: number, pageSize: number): IResourceContainer;
57
+ toJSON(): any;
57
58
  }
@@ -318,5 +318,20 @@ class ResourceContainer {
318
318
  this._queryParams.pagination.size = pageSize;
319
319
  return this;
320
320
  }
321
+ toJSON() {
322
+ if ((0, json_1.isDefined)(this.data)) {
323
+ if ((0, __1.isResourceObject)(this.data))
324
+ return this.data.toJSON();
325
+ if ((0, json_1.isArrayOfObjects)(this.data)) {
326
+ const payload = [];
327
+ for (const resource of this.data) {
328
+ if ((0, __1.isResourceObject)(resource))
329
+ payload.push(resource.toJSON);
330
+ }
331
+ return payload;
332
+ }
333
+ }
334
+ return undefined;
335
+ }
321
336
  }
322
337
  exports.default = ResourceContainer;
@@ -26,6 +26,7 @@ export default class ResourceObject implements IResourceObject {
26
26
  private InsertResource;
27
27
  private UpdateResource;
28
28
  Save(): Promise<void>;
29
+ toJSON(): any;
29
30
  get type(): string;
30
31
  get id(): string;
31
32
  set id(value: string);
@@ -251,6 +251,10 @@ class ResourceObject {
251
251
  }
252
252
  });
253
253
  }
254
+ toJSON() {
255
+ const payload = this.GetInsertPayload();
256
+ return payload.data;
257
+ }
254
258
  get type() {
255
259
  throw new Error('Method or Property not implemented.');
256
260
  }
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "description": "API Games SDK Core",
15
15
  "license": "MIT",
16
- "version": "23.2.2",
16
+ "version": "23.2.4",
17
17
  "main": "lib/index.js",
18
18
  "types": "lib/index.d.ts",
19
19
  "scripts": {
@@ -33,18 +33,18 @@
33
33
  "test:watch": "jest --watch"
34
34
  },
35
35
  "dependencies": {
36
- "@apigames/json": "23.2.2",
37
- "@apigames/rest-client": "23.2.2",
36
+ "@apigames/json": "23.2.3",
37
+ "@apigames/rest-client": "23.2.3",
38
38
  "object-hash": "3.0.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/date-and-time": "0.13.0",
42
42
  "@types/jest": "29.5.2",
43
43
  "@types/node": "20.3.1",
44
- "@typescript-eslint/eslint-plugin": "5.59.11",
45
- "@typescript-eslint/parser": "5.59.11",
46
- "date-and-time": "3.0.1",
47
- "eslint": "8.42.0",
44
+ "@typescript-eslint/eslint-plugin": "5.60.0",
45
+ "@typescript-eslint/parser": "5.60.0",
46
+ "date-and-time": "3.0.2",
47
+ "eslint": "8.43.0",
48
48
  "eslint-config-airbnb": "19.0.4",
49
49
  "eslint-plugin-import": "2.27.5",
50
50
  "eslint-plugin-jsx-a11y": "6.7.1",