@rtsdk/topia 0.8.0 → 0.8.2

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.
package/dist/index.cjs CHANGED
@@ -41368,9 +41368,10 @@ class Visitor extends User {
41368
41368
  try {
41369
41369
  let expressionId = id;
41370
41370
  if (name) {
41371
- expressionId = yield this.topiaPublicApi().get(`/expressions?name=${name}`, this.requestOptions);
41371
+ const response = yield this.topiaPublicApi().get(`/expressions?name=${name}`, this.requestOptions);
41372
+ expressionId = response.data[0].id;
41372
41373
  }
41373
- const result = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/grant-expression/${expressionId}`, {}, this.requestOptions);
41374
+ const result = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/grant-expression/${id}`, {}, this.requestOptions);
41374
41375
  return result;
41375
41376
  }
41376
41377
  catch (error) {
@@ -41689,8 +41690,8 @@ class DroppedAssetFactory extends SDKController {
41689
41690
  getWithUniqueName(uniqueName, urlSlug, interactivePublicKey, interactiveSecret) {
41690
41691
  return __awaiter(this, void 0, void 0, function* () {
41691
41692
  const params = { uniqueName, urlSlug, interactivePublicKey, interactiveSecret };
41692
- const interactiveJWT = jwt.sign(interactivePublicKey, interactiveSecret);
41693
41693
  try {
41694
+ const interactiveJWT = jwt.sign(interactivePublicKey, interactiveSecret);
41694
41695
  const response = yield this.topiaPublicApi().get(`/world/${urlSlug}/asset-by-unique-name/${uniqueName}`, { headers: { interactiveJWT, publickey: interactivePublicKey } });
41695
41696
  const { id } = response.data;
41696
41697
  return new DroppedAsset(this.topia, id, urlSlug, { attributes: response.data });
@@ -41700,7 +41701,7 @@ class DroppedAssetFactory extends SDKController {
41700
41701
  }
41701
41702
  });
41702
41703
  }
41703
- drop(asset, { assetScale, flipped, interactivePublicKey, isInteractive, layer0, layer1, position: { x, y }, sceneDropId, text, textColor, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }) {
41704
+ drop(asset, { assetScale = 1, flipped, interactivePublicKey, isInteractive, layer0, layer1, position: { x, y }, sceneDropId, text, textColor, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }) {
41704
41705
  return __awaiter(this, void 0, void 0, function* () {
41705
41706
  let specialType;
41706
41707
  if (layer0 || layer1)
@@ -41795,13 +41796,33 @@ class WorldActivityFactory {
41795
41796
  }
41796
41797
  }
41797
41798
 
41798
- class WorldFactory {
41799
+ class WorldFactory extends SDKController {
41799
41800
  constructor(topia) {
41800
- this.topia = topia;
41801
+ super(topia);
41801
41802
  }
41802
41803
  create(urlSlug, options) {
41803
41804
  return new World(this.topia, urlSlug, options);
41804
41805
  }
41806
+ deleteDroppedAssets(urlSlug, droppedAssetIds, interactivePublicKey, interactiveSecret) {
41807
+ return __awaiter(this, void 0, void 0, function* () {
41808
+ const params = { droppedAssetIds, urlSlug, interactivePublicKey, interactiveSecret };
41809
+ try {
41810
+ const interactiveJWT = jwt.sign(interactivePublicKey, interactiveSecret);
41811
+ const promiseArray = [];
41812
+ for (const id of droppedAssetIds) {
41813
+ promiseArray.push(this.topiaPublicApi().delete(`/world/${urlSlug}/assets/${id}`, {
41814
+ headers: { interactiveJWT, publickey: interactivePublicKey },
41815
+ }));
41816
+ }
41817
+ const result = yield Promise.all(promiseArray);
41818
+ console.log(result);
41819
+ return { success: true };
41820
+ }
41821
+ catch (error) {
41822
+ throw this.errorHandler({ error, params, sdkMethod: "DroppedAssetFactory.getWithUniqueName" });
41823
+ }
41824
+ });
41825
+ }
41805
41826
  }
41806
41827
 
41807
41828
  Error.stackTraceLimit = 20;
package/dist/index.d.ts CHANGED
@@ -1676,10 +1676,12 @@ declare class WorldActivityFactory {
1676
1676
  create(urlSlug: string, options?: WorldOptionalInterface): WorldActivity;
1677
1677
  }
1678
1678
 
1679
- declare class WorldFactory {
1680
- topia: Topia;
1679
+ declare class WorldFactory extends SDKController {
1681
1680
  constructor(topia: Topia);
1682
1681
  create(urlSlug: string, options?: WorldOptionalInterface): World;
1682
+ deleteDroppedAssets(urlSlug: string, droppedAssetIds: string[], interactivePublicKey: string, interactiveSecret: string): Promise<{
1683
+ success: boolean;
1684
+ }>;
1683
1685
  }
1684
1686
 
1685
1687
  export { Asset, AssetFactory, AssetInterface, AssetOptionalInterface, AssetOptions, DroppedAsset, DroppedAssetClickType, DroppedAssetFactory, DroppedAssetInterface, DroppedAssetMediaType, DroppedAssetOptionalInterface, DroppedAssetOptions, FireToastInterface, InteractiveCredentials, MoveAllVisitorsInterface, MoveVisitorInterface, OpenIframeInterface, ResponseType, SDKController, SDKInterface, Scene, SceneFactory, SceneInterface, SceneOptionalInterface, Topia, TopiaInterface, UpdateBroadcastInterface, UpdateClickTypeInterface, UpdateMediaTypeInterface, UpdatePrivateZoneInterface, User, UserFactory, UserInterface, UserOptionalInterface, UserOptions, Visitor, VisitorFactory, VisitorInterface, VisitorOptionalInterface, VisitorOptions, VisitorType, VisitorsToMoveArrayType, VisitorsToMoveType, WebhookInterface, World, WorldActivity, WorldActivityFactory, WorldActivityOptionalInterface, WorldDetailsInterface, WorldFactory, WorldInterface, WorldOptionalInterface, WorldOptions, WorldWebhooksInterface };
package/dist/index.js CHANGED
@@ -41366,9 +41366,10 @@ class Visitor extends User {
41366
41366
  try {
41367
41367
  let expressionId = id;
41368
41368
  if (name) {
41369
- expressionId = yield this.topiaPublicApi().get(`/expressions?name=${name}`, this.requestOptions);
41369
+ const response = yield this.topiaPublicApi().get(`/expressions?name=${name}`, this.requestOptions);
41370
+ expressionId = response.data[0].id;
41370
41371
  }
41371
- const result = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/grant-expression/${expressionId}`, {}, this.requestOptions);
41372
+ const result = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/grant-expression/${id}`, {}, this.requestOptions);
41372
41373
  return result;
41373
41374
  }
41374
41375
  catch (error) {
@@ -41687,8 +41688,8 @@ class DroppedAssetFactory extends SDKController {
41687
41688
  getWithUniqueName(uniqueName, urlSlug, interactivePublicKey, interactiveSecret) {
41688
41689
  return __awaiter(this, void 0, void 0, function* () {
41689
41690
  const params = { uniqueName, urlSlug, interactivePublicKey, interactiveSecret };
41690
- const interactiveJWT = jwt.sign(interactivePublicKey, interactiveSecret);
41691
41691
  try {
41692
+ const interactiveJWT = jwt.sign(interactivePublicKey, interactiveSecret);
41692
41693
  const response = yield this.topiaPublicApi().get(`/world/${urlSlug}/asset-by-unique-name/${uniqueName}`, { headers: { interactiveJWT, publickey: interactivePublicKey } });
41693
41694
  const { id } = response.data;
41694
41695
  return new DroppedAsset(this.topia, id, urlSlug, { attributes: response.data });
@@ -41698,7 +41699,7 @@ class DroppedAssetFactory extends SDKController {
41698
41699
  }
41699
41700
  });
41700
41701
  }
41701
- drop(asset, { assetScale, flipped, interactivePublicKey, isInteractive, layer0, layer1, position: { x, y }, sceneDropId, text, textColor, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }) {
41702
+ drop(asset, { assetScale = 1, flipped, interactivePublicKey, isInteractive, layer0, layer1, position: { x, y }, sceneDropId, text, textColor, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }) {
41702
41703
  return __awaiter(this, void 0, void 0, function* () {
41703
41704
  let specialType;
41704
41705
  if (layer0 || layer1)
@@ -41793,13 +41794,33 @@ class WorldActivityFactory {
41793
41794
  }
41794
41795
  }
41795
41796
 
41796
- class WorldFactory {
41797
+ class WorldFactory extends SDKController {
41797
41798
  constructor(topia) {
41798
- this.topia = topia;
41799
+ super(topia);
41799
41800
  }
41800
41801
  create(urlSlug, options) {
41801
41802
  return new World(this.topia, urlSlug, options);
41802
41803
  }
41804
+ deleteDroppedAssets(urlSlug, droppedAssetIds, interactivePublicKey, interactiveSecret) {
41805
+ return __awaiter(this, void 0, void 0, function* () {
41806
+ const params = { droppedAssetIds, urlSlug, interactivePublicKey, interactiveSecret };
41807
+ try {
41808
+ const interactiveJWT = jwt.sign(interactivePublicKey, interactiveSecret);
41809
+ const promiseArray = [];
41810
+ for (const id of droppedAssetIds) {
41811
+ promiseArray.push(this.topiaPublicApi().delete(`/world/${urlSlug}/assets/${id}`, {
41812
+ headers: { interactiveJWT, publickey: interactivePublicKey },
41813
+ }));
41814
+ }
41815
+ const result = yield Promise.all(promiseArray);
41816
+ console.log(result);
41817
+ return { success: true };
41818
+ }
41819
+ catch (error) {
41820
+ throw this.errorHandler({ error, params, sdkMethod: "DroppedAssetFactory.getWithUniqueName" });
41821
+ }
41822
+ });
41823
+ }
41803
41824
  }
41804
41825
 
41805
41826
  Error.stackTraceLimit = 20;
package/package.json CHANGED
@@ -59,5 +59,5 @@
59
59
  "local-publish": "yarn build && yalc publish --push --no-scripts"
60
60
  },
61
61
  "type": "module",
62
- "version": "0.8.0"
62
+ "version": "0.8.2"
63
63
  }