@rtsdk/topia 0.0.17 → 0.0.18

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.
@@ -8,7 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  // controllers
11
- // import { DroppedAsset } from "controllers/DroppedAsset";
12
11
  import { SDKController } from "controllers/SDKController";
13
12
  // utils
14
13
  import { getErrorResponse } from "utils";
@@ -36,23 +35,5 @@ export class Asset extends SDKController {
36
35
  }
37
36
  });
38
37
  }
39
- drop({ position: { x, y }, uniqueName, urlSlug, }) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- // }): Promise<DroppedAsset> {
42
- try {
43
- const response = yield this.topia.axios.post(`/world/${urlSlug}/assets`, {
44
- assetId: this.id,
45
- position: { x, y },
46
- uniqueName,
47
- }, this.requestOptions);
48
- const { id } = response.data;
49
- return id;
50
- // return new DroppedAsset(this.topia, id, urlSlug, { credentials: this.credentials });
51
- }
52
- catch (error) {
53
- throw getErrorResponse({ error });
54
- }
55
- });
56
- }
57
38
  }
58
39
  export default Asset;
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { DroppedAsset } from "controllers";
11
+ import { getErrorResponse } from "utils";
11
12
  export class DroppedAssetFactory {
12
13
  constructor(topia) {
13
14
  this.topia = topia;
@@ -22,5 +23,21 @@ export class DroppedAssetFactory {
22
23
  return droppedAsset;
23
24
  });
24
25
  }
26
+ drop(asset, { position: { x, y }, uniqueName, urlSlug, }) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ try {
29
+ const response = yield this.topia.axios.post(`/world/${urlSlug}/assets`, {
30
+ assetId: asset.id,
31
+ position: { x, y },
32
+ uniqueName,
33
+ }, asset.requestOptions);
34
+ const { id } = response.data;
35
+ return new DroppedAsset(this.topia, id, urlSlug, { credentials: asset.credentials });
36
+ }
37
+ catch (error) {
38
+ throw getErrorResponse({ error });
39
+ }
40
+ });
41
+ }
25
42
  }
26
43
  export default DroppedAssetFactory;
package/package.json CHANGED
@@ -52,9 +52,9 @@
52
52
  "test": "ENV=testing jest --watchAll=false",
53
53
  "lint": "eslint \"src/**\"",
54
54
  "docs": "typedoc",
55
- "pkg": "npm publish",
55
+ "pkg": "yarn build && npm publish",
56
56
  "local-publish": "yarn build && yalc publish --push --no-scripts"
57
57
  },
58
58
  "type": "module",
59
- "version": "0.0.17"
59
+ "version": "0.0.18"
60
60
  }