@rtsdk/topia 0.15.9 → 0.16.1

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/README.md CHANGED
@@ -104,6 +104,25 @@ A Topia provided API Key can be included with every object initialization as a p
104
104
 
105
105
  <br>
106
106
 
107
+ # New for June 2025: Multiplayer Experience Engine
108
+
109
+ Topia has developed a powerful new Experience Engine that enables extremely low-latency, interactive in-canvas multiplayer experiences. This engine is purpose-built for real-time interaction and supports a wide range of dynamic behaviors, making it ideal for collaborative activities, games, and social experiences within Topia worlds.
110
+
111
+ ## Key Features
112
+ - Ultra Low Latency: Real-time feedback for seamless multi-user interaction and state synchronization.
113
+ - Physics & Collision: Includes a robust physics and collision system to support realistic and responsive behaviors.
114
+ - Real-Time Interactivity: Supports dynamic responses to user input and environmental changes inside the canvas.
115
+ - Optimized for the Web: Engineered to perform smoothly across browser-based environments with minimal resource impact.
116
+
117
+ ## SDK Integration: Leverage the SDK inside the Experience Engine to:
118
+ - Trigger visual/audio effects based on real-time interactions
119
+ - Save and persist spatial data, such as object positions or interaction states
120
+
121
+ This engine unlocks a whole new layer of interactivity, paving the way for creative, immersive experiences including educational tools, multiplayer games, or collaborative activities.
122
+
123
+ ## Get In Touch
124
+ To sign up for the experience engine private beta, visit https://topia.io/p/game-engine.
125
+
107
126
  # Developers
108
127
 
109
128
  <hr/>
package/dist/index.cjs CHANGED
@@ -39988,10 +39988,13 @@ class DroppedAsset extends Asset {
39988
39988
  * const dataObject = await droppedAsset.fetchDataObject();
39989
39989
  * ```
39990
39990
  */
39991
- fetchDataObject() {
39991
+ fetchDataObject(appPublicKey, appJWT) {
39992
39992
  return __awaiter(this, void 0, void 0, function* () {
39993
39993
  try {
39994
- const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/assets/${this.id}/data-object`, this.requestOptions);
39994
+ let query = "";
39995
+ if (appPublicKey)
39996
+ query = `?appPublicKey=${appPublicKey}&appJWT=${appJWT}`;
39997
+ const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/assets/${this.id}/data-object${query}`, this.requestOptions);
39995
39998
  this.dataObject = response.data;
39996
39999
  return response.data;
39997
40000
  }
@@ -40474,6 +40477,126 @@ class DroppedAsset extends Asset {
40474
40477
  }
40475
40478
  _DroppedAsset_updateDroppedAsset = new WeakMap();
40476
40479
 
40480
+ /**
40481
+ * @summary
40482
+ * Create an instance of Ecosystem class with optional session credentials
40483
+ *
40484
+ * @usage
40485
+ * ```ts
40486
+ * await new Ecosystem(topia, {
40487
+ * credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
40488
+ * });
40489
+ * ```
40490
+ */
40491
+ class Ecosystem extends SDKController {
40492
+ constructor(topia, options = { credentials: {} }) {
40493
+ super(topia, options.credentials);
40494
+ this.dataObject = {};
40495
+ }
40496
+ /**
40497
+ * @summary
40498
+ * Retrieves the data object for a Topia ecosystem. Requires canUpdateEcosystemDataObjects permission to be set to true for the public key.
40499
+ *
40500
+ * @usage
40501
+ * ```ts
40502
+ * const dataObject = await ecosystem.fetchDataObject("exampleAppPublicKey", "exampleAppPublicKeyJWT");
40503
+ * ```
40504
+ */
40505
+ fetchDataObject(appPublicKey, appJWT) {
40506
+ return __awaiter(this, void 0, void 0, function* () {
40507
+ try {
40508
+ let query = "";
40509
+ if (appPublicKey)
40510
+ query = `?appPublicKey=${appPublicKey}&appJWT=${appJWT}`;
40511
+ const response = yield this.topiaPublicApi().get(`/ecosystem/data-object${query}`, this.requestOptions);
40512
+ this.dataObject = response.data;
40513
+ return response.data;
40514
+ }
40515
+ catch (error) {
40516
+ throw this.errorHandler({ error, sdkMethod: "Ecosystem.fetchDataObject" });
40517
+ }
40518
+ });
40519
+ }
40520
+ /**
40521
+ * @summary
40522
+ * Sets the data object for a Topia ecosystem.
40523
+ *
40524
+ * Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
40525
+ *
40526
+ * @usage
40527
+ * ```ts
40528
+ * await ecosystem.setDataObject({ "exampleKey": "exampleValue" }, {
40529
+ * sharedAppPublicKey: "exampleAppPublicKey",
40530
+ * sharedAppJWT: "exampleAppPublicKeyJWT",}
40531
+ * });
40532
+ * ```
40533
+ */
40534
+ setDataObject(dataObject, options = {}) {
40535
+ return __awaiter(this, void 0, void 0, function* () {
40536
+ try {
40537
+ yield this.topiaPublicApi().post(`/ecosystem/data-object`, Object.assign(Object.assign({}, options), { dataObject: dataObject || this.dataObject }), this.requestOptions);
40538
+ this.dataObject = dataObject || this.dataObject;
40539
+ }
40540
+ catch (error) {
40541
+ throw this.errorHandler({ error, params: { dataObject, options }, sdkMethod: "Ecosystem.setDataObject" });
40542
+ }
40543
+ });
40544
+ }
40545
+ /**
40546
+ * @summary
40547
+ * Updates the data object for a Topia ecosystem.
40548
+ *
40549
+ * Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
40550
+ *
40551
+ * @usage
40552
+ * ```ts
40553
+ * await ecosystem.updateDataObject({ "exampleKey": "exampleValue" }, {
40554
+ * sharedAppPublicKey: "exampleAppPublicKey",
40555
+ * sharedAppJWT: "exampleAppPublicKeyJWT",}
40556
+ * });
40557
+ * ```
40558
+ */
40559
+ updateDataObject(dataObject, options = {}) {
40560
+ return __awaiter(this, void 0, void 0, function* () {
40561
+ try {
40562
+ yield this.topiaPublicApi().put(`/ecosystem/data-object`, Object.assign(Object.assign({}, options), { dataObject: dataObject || this.dataObject }), this.requestOptions);
40563
+ this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
40564
+ }
40565
+ catch (error) {
40566
+ throw this.errorHandler({ error, params: { dataObject, options }, sdkMethod: "Ecosystem.updateDataObject" });
40567
+ }
40568
+ });
40569
+ }
40570
+ /**
40571
+ * @summary
40572
+ * Increments a specific value in the data object for a Topia ecosystem by the amount specified. Must have valid interactive credentials from a visitor in the world.
40573
+ *
40574
+ * Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
40575
+ *
40576
+ * @usage
40577
+ * ```ts
40578
+ * await ecosystem.incrementDataObjectValue("key", 1, {
40579
+ * sharedAppPublicKey: "exampleAppPublicKey",
40580
+ * sharedAppJWT: "exampleAppPublicKeyJWT",}
40581
+ * });
40582
+ * ```
40583
+ */
40584
+ incrementDataObjectValue(path, amount, options = {}) {
40585
+ return __awaiter(this, void 0, void 0, function* () {
40586
+ try {
40587
+ yield this.topiaPublicApi().put(`/ecosystem/increment-data-object-value`, Object.assign({ path, amount }, options), this.requestOptions);
40588
+ }
40589
+ catch (error) {
40590
+ throw this.errorHandler({
40591
+ error,
40592
+ params: { path, amount, options },
40593
+ sdkMethod: "Ecosystem.incrementDataObjectValue",
40594
+ });
40595
+ }
40596
+ });
40597
+ }
40598
+ }
40599
+
40477
40600
  /**
40478
40601
  * @summary
40479
40602
  * Create an instance of Scene class with a given scene id and optional attributes and session credentials.
@@ -40582,9 +40705,12 @@ class World extends SDKController {
40582
40705
  * const { dataObject } = world;
40583
40706
  * ```
40584
40707
  */
40585
- this.fetchDataObject = () => __awaiter(this, void 0, void 0, function* () {
40708
+ this.fetchDataObject = (appPublicKey, appJWT) => __awaiter(this, void 0, void 0, function* () {
40586
40709
  try {
40587
- const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/get-data-object`, this.requestOptions);
40710
+ let query = "";
40711
+ if (appPublicKey)
40712
+ query = `?appPublicKey=${appPublicKey}&appJWT=${appJWT}`;
40713
+ const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/get-data-object${query}`, this.requestOptions);
40588
40714
  this.dataObject = response.data;
40589
40715
  return response.data;
40590
40716
  }
@@ -41719,12 +41845,15 @@ class User extends SDKController {
41719
41845
  * const dataObject = await user.fetchDataObject();
41720
41846
  * ```
41721
41847
  */
41722
- fetchDataObject() {
41848
+ fetchDataObject(appPublicKey, appJWT) {
41723
41849
  return __awaiter(this, void 0, void 0, function* () {
41724
41850
  try {
41725
41851
  if (!this.profileId)
41726
41852
  throw "This method requires the use of a profileId";
41727
- const response = yield this.topiaPublicApi().get(`/user/dataObjects/${this.profileId}/get-data-object`, this.requestOptions);
41853
+ let query = "";
41854
+ if (appPublicKey)
41855
+ query = `?appPublicKey=${appPublicKey}&appJWT=${appJWT}`;
41856
+ const response = yield this.topiaPublicApi().get(`/user/dataObjects/${this.profileId}/get-data-object${query}`, this.requestOptions);
41728
41857
  this.dataObject = response.data;
41729
41858
  return response.data;
41730
41859
  }
@@ -42116,10 +42245,13 @@ class Visitor extends User {
42116
42245
  * const dataObject = await visitor.fetchDataObject();
42117
42246
  * ```
42118
42247
  */
42119
- fetchDataObject() {
42248
+ fetchDataObject(appPublicKey, appJWT) {
42120
42249
  return __awaiter(this, void 0, void 0, function* () {
42121
42250
  try {
42122
- const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors/${this.id}/get-data-object`, this.requestOptions);
42251
+ let query = "";
42252
+ if (appPublicKey)
42253
+ query = `?appPublicKey=${appPublicKey}&appJWT=${appJWT}`;
42254
+ const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors/${this.id}/get-data-object${query}`, this.requestOptions);
42123
42255
  this.dataObject = response.data;
42124
42256
  return response.data;
42125
42257
  }
@@ -42660,6 +42792,30 @@ class DroppedAssetFactory extends SDKController {
42660
42792
  }
42661
42793
  }
42662
42794
 
42795
+ /**
42796
+ * @usage
42797
+ * ```ts
42798
+ * const Ecosystem = new EcosystemFactory(myTopiaInstance);
42799
+ * ```
42800
+ */
42801
+ class EcosystemFactory {
42802
+ constructor(topia) {
42803
+ this.topia = topia;
42804
+ }
42805
+ /**
42806
+ * @summary
42807
+ * Instantiate a new instance of Ecosystem class.
42808
+ *
42809
+ * @usage
42810
+ * ```
42811
+ * const ecosystemInstance = await Ecosystem.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId }});
42812
+ * ```
42813
+ */
42814
+ create(options) {
42815
+ return new Ecosystem(this.topia, options);
42816
+ }
42817
+ }
42818
+
42663
42819
  /**
42664
42820
  * @usage
42665
42821
  * ```ts
@@ -42781,7 +42937,7 @@ class WebRTCConnectorFactory {
42781
42937
  *
42782
42938
  * @usage
42783
42939
  * ```
42784
- * const userInstance = await WebRTCConnector.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId }, twilioConfig: {} });
42940
+ * const webRTCInstance = await WebRTCConnector.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId }, twilioConfig: {} });
42785
42941
  * ```
42786
42942
  */
42787
42943
  create(urlSlug, options) {
@@ -42903,6 +43059,8 @@ exports.Asset = Asset;
42903
43059
  exports.AssetFactory = AssetFactory;
42904
43060
  exports.DroppedAsset = DroppedAsset;
42905
43061
  exports.DroppedAssetFactory = DroppedAssetFactory;
43062
+ exports.Ecosystem = Ecosystem;
43063
+ exports.EcosystemFactory = EcosystemFactory;
42906
43064
  exports.SDKController = SDKController;
42907
43065
  exports.Scene = Scene;
42908
43066
  exports.SceneFactory = SceneFactory;
package/dist/index.d.ts CHANGED
@@ -213,7 +213,7 @@ declare class DroppedAsset extends Asset implements DroppedAssetInterface {
213
213
  * const dataObject = await droppedAsset.fetchDataObject();
214
214
  * ```
215
215
  */
216
- fetchDataObject(): Promise<void | ResponseType$1>;
216
+ fetchDataObject(appPublicKey?: string, appJWT?: string): Promise<void | ResponseType$1>;
217
217
  /**
218
218
  * @summary
219
219
  * Sets the data object for a dropped asset.
@@ -228,6 +228,8 @@ declare class DroppedAsset extends Asset implements DroppedAssetInterface {
228
228
  * ```
229
229
  */
230
230
  setDataObject(dataObject: object, options?: {
231
+ sharedAppPublicKey?: string;
232
+ sharedAppJWT?: string;
231
233
  analytics?: AnalyticType[];
232
234
  lock?: {
233
235
  lockId: string;
@@ -248,6 +250,8 @@ declare class DroppedAsset extends Asset implements DroppedAssetInterface {
248
250
  * ```
249
251
  */
250
252
  updateDataObject(dataObject: object, options?: {
253
+ sharedAppPublicKey?: string;
254
+ sharedAppJWT?: string;
251
255
  analytics?: AnalyticType[];
252
256
  lock?: {
253
257
  lockId: string;
@@ -266,6 +270,8 @@ declare class DroppedAsset extends Asset implements DroppedAssetInterface {
266
270
  * ```
267
271
  */
268
272
  incrementDataObjectValue(path: string, amount: number, options?: {
273
+ sharedAppPublicKey?: string;
274
+ sharedAppJWT?: string;
269
275
  analytics?: AnalyticType[];
270
276
  lock?: {
271
277
  lockId: string;
@@ -821,7 +827,7 @@ declare class World extends SDKController implements WorldInterface {
821
827
  * const { dataObject } = world;
822
828
  * ```
823
829
  */
824
- fetchDataObject: () => Promise<void | ResponseType$1>;
830
+ fetchDataObject: (appPublicKey?: string, appJWT?: string) => Promise<void | ResponseType$1>;
825
831
  /**
826
832
  * @summary
827
833
  * Sets the data object for a user. Must have valid interactive credentials from a visitor in the world.
@@ -837,6 +843,8 @@ declare class World extends SDKController implements WorldInterface {
837
843
  * ```
838
844
  */
839
845
  setDataObject: (dataObject: object | null | undefined, options?: {
846
+ sharedAppPublicKey?: string;
847
+ sharedAppJWT?: string;
840
848
  analytics?: AnalyticType[];
841
849
  lock?: {
842
850
  lockId: string;
@@ -858,6 +866,8 @@ declare class World extends SDKController implements WorldInterface {
858
866
  * ```
859
867
  */
860
868
  updateDataObject: (dataObject: object, options?: {
869
+ sharedAppPublicKey?: string;
870
+ sharedAppJWT?: string;
861
871
  analytics?: AnalyticType[];
862
872
  lock?: {
863
873
  lockId: string;
@@ -876,6 +886,8 @@ declare class World extends SDKController implements WorldInterface {
876
886
  * ```
877
887
  */
878
888
  incrementDataObjectValue(path: string, amount: number, options?: {
889
+ sharedAppPublicKey?: string;
890
+ sharedAppJWT?: string;
879
891
  analytics?: AnalyticType[];
880
892
  lock?: {
881
893
  lockId: string;
@@ -1226,7 +1238,7 @@ declare class User extends SDKController implements UserInterface {
1226
1238
  * const dataObject = await user.fetchDataObject();
1227
1239
  * ```
1228
1240
  */
1229
- fetchDataObject(): Promise<void | ResponseType$1>;
1241
+ fetchDataObject(appPublicKey?: string, appJWT?: string): Promise<void | ResponseType$1>;
1230
1242
  /**
1231
1243
  * @summary
1232
1244
  * Sets the data object for a user.
@@ -1241,6 +1253,8 @@ declare class User extends SDKController implements UserInterface {
1241
1253
  * ```
1242
1254
  */
1243
1255
  setDataObject(dataObject: object | null | undefined, options?: {
1256
+ sharedAppPublicKey?: string;
1257
+ sharedAppJWT?: string;
1244
1258
  analytics?: AnalyticType[];
1245
1259
  lock?: {
1246
1260
  lockId: string;
@@ -1261,6 +1275,8 @@ declare class User extends SDKController implements UserInterface {
1261
1275
  * ```
1262
1276
  */
1263
1277
  updateDataObject(dataObject: object, options?: {
1278
+ sharedAppPublicKey?: string;
1279
+ sharedAppJWT?: string;
1264
1280
  analytics?: AnalyticType[];
1265
1281
  lock?: {
1266
1282
  lockId: string;
@@ -1279,6 +1295,8 @@ declare class User extends SDKController implements UserInterface {
1279
1295
  * ```
1280
1296
  */
1281
1297
  incrementDataObjectValue(path: string, amount: number, options?: {
1298
+ sharedAppPublicKey?: string;
1299
+ sharedAppJWT?: string;
1282
1300
  analytics?: AnalyticType[];
1283
1301
  lock?: {
1284
1302
  lockId: string;
@@ -1450,7 +1468,7 @@ declare class Visitor extends User implements VisitorInterface {
1450
1468
  * const dataObject = await visitor.fetchDataObject();
1451
1469
  * ```
1452
1470
  */
1453
- fetchDataObject(): Promise<void | ResponseType$1>;
1471
+ fetchDataObject(appPublicKey?: string, appJWT?: string): Promise<void | ResponseType$1>;
1454
1472
  /**
1455
1473
  * @summary
1456
1474
  * Sets the data object for a visitor.
@@ -1465,6 +1483,8 @@ declare class Visitor extends User implements VisitorInterface {
1465
1483
  * ```
1466
1484
  */
1467
1485
  setDataObject(dataObject: object | null | undefined, options?: {
1486
+ sharedAppPublicKey?: string;
1487
+ sharedAppJWT?: string;
1468
1488
  analytics?: AnalyticType[];
1469
1489
  lock?: {
1470
1490
  lockId: string;
@@ -1485,6 +1505,8 @@ declare class Visitor extends User implements VisitorInterface {
1485
1505
  * ```
1486
1506
  */
1487
1507
  updateDataObject(dataObject: object, options?: {
1508
+ sharedAppPublicKey?: string;
1509
+ sharedAppJWT?: string;
1488
1510
  analytics?: AnalyticType[];
1489
1511
  lock?: {
1490
1512
  lockId: string;
@@ -1503,6 +1525,8 @@ declare class Visitor extends User implements VisitorInterface {
1503
1525
  * ```
1504
1526
  */
1505
1527
  incrementDataObjectValue(path: string, amount: number, options?: {
1528
+ sharedAppPublicKey?: string;
1529
+ sharedAppJWT?: string;
1506
1530
  analytics?: AnalyticType[];
1507
1531
  lock?: {
1508
1532
  lockId: string;
@@ -1607,7 +1631,7 @@ type AssetOptionalInterface = {
1607
1631
  interface DroppedAssetInterface extends AssetInterface {
1608
1632
  fetchDroppedAssetById(): Promise<void | ResponseType$1>;
1609
1633
  deleteDroppedAsset(): Promise<void | ResponseType$1>;
1610
- fetchDataObject(): Promise<void | ResponseType$1>;
1634
+ fetchDataObject(appPublicKey?: string, appJWT?: string): Promise<void | ResponseType$1>;
1611
1635
  setDataObject(dataObject: object, options: object): Promise<void | ResponseType$1>;
1612
1636
  updateDataObject(dataObject: object, options: object): Promise<void | ResponseType$1>;
1613
1637
  incrementDataObjectValue(path: string, amount: number, options: object): Promise<void | ResponseType$1>;
@@ -1769,6 +1793,16 @@ interface UpdatePrivateZoneInterface {
1769
1793
  privateZoneUserCap: number;
1770
1794
  }
1771
1795
 
1796
+ interface EcosystemInterface {
1797
+ fetchDataObject(appPublicKey?: string, appJWT?: string): Promise<void | ResponseType$1>;
1798
+ setDataObject(dataObject: object | null | undefined, options: object): Promise<void | ResponseType$1>;
1799
+ updateDataObject(dataObject: object, options: object): Promise<void | ResponseType$1>;
1800
+ incrementDataObjectValue(path: string, amount: number, options: object): Promise<void | ResponseType$1>;
1801
+ }
1802
+ interface EcosystemOptionalInterface {
1803
+ credentials?: InteractiveCredentials;
1804
+ }
1805
+
1772
1806
  interface SceneInterface {
1773
1807
  fetchSceneById(): Promise<void | ResponseType$1>;
1774
1808
  id: string;
@@ -1817,7 +1851,7 @@ interface UserInterface {
1817
1851
  fetchPlatformAssets(): Promise<object | ResponseType$1>;
1818
1852
  fetchScenes(): Promise<void | ResponseType$1>;
1819
1853
  fetchWorldsByKey(): Promise<void | ResponseType$1>;
1820
- fetchDataObject(): Promise<void | ResponseType$1>;
1854
+ fetchDataObject(appPublicKey?: string, appJWT?: string): Promise<void | ResponseType$1>;
1821
1855
  setDataObject(dataObject: object | null | undefined, options: object): Promise<void | ResponseType$1>;
1822
1856
  incrementDataObjectValue(path: string, amount: number, options: object): Promise<void | ResponseType$1>;
1823
1857
  dataObject?: object | null;
@@ -1834,7 +1868,7 @@ interface VisitorInterface extends SDKInterface {
1834
1868
  moveVisitor({ shouldTeleportVisitor, x, y }: MoveVisitorInterface): Promise<void | ResponseType$1>;
1835
1869
  fireToast({ groupId, title, text }: FireToastInterface): Promise<void | ResponseType$1>;
1836
1870
  openIframe({ link, shouldOpenInDrawer, title }: OpenIframeInterface): Promise<void | ResponseType$1>;
1837
- fetchDataObject(): Promise<void | ResponseType$1>;
1871
+ fetchDataObject(appPublicKey?: string, appJWT?: string): Promise<void | ResponseType$1>;
1838
1872
  setDataObject(dataObject: object | null | undefined, options: object): Promise<void | ResponseType$1>;
1839
1873
  updateDataObject(dataObject: object, options: object): Promise<void | ResponseType$1>;
1840
1874
  incrementDataObjectValue(path: string, amount: number, options: object): Promise<void | ResponseType$1>;
@@ -1960,8 +1994,8 @@ interface WorldInterface extends SDKInterface, WorldDetailsInterface {
1960
1994
  sceneId: string;
1961
1995
  }): Promise<object | ResponseType$1>;
1962
1996
  replaceScene(sceneId: string): Promise<void | ResponseType$1>;
1963
- fetchDataObject(): Promise<void | ResponseType$1>;
1964
1997
  fireToast({ groupId, title, text }: FireToastInterface): Promise<void | ResponseType$1>;
1998
+ fetchDataObject(appPublicKey?: string, appJWT?: string): Promise<void | ResponseType$1>;
1965
1999
  setDataObject(dataObject: object | null | undefined, options: object): Promise<void | ResponseType$1>;
1966
2000
  updateDataObject(dataObject: object, options: object): Promise<void | ResponseType$1>;
1967
2001
  incrementDataObjectValue(path: string, amount: number, options: object): Promise<void | ResponseType$1>;
@@ -2110,6 +2144,101 @@ declare class Asset extends SDKController implements AssetInterface {
2110
2144
  }): Promise<void | ResponseType$1>;
2111
2145
  }
2112
2146
 
2147
+ /**
2148
+ * @summary
2149
+ * Create an instance of Ecosystem class with optional session credentials
2150
+ *
2151
+ * @usage
2152
+ * ```ts
2153
+ * await new Ecosystem(topia, {
2154
+ * credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
2155
+ * });
2156
+ * ```
2157
+ */
2158
+ declare class Ecosystem extends SDKController {
2159
+ dataObject?: object | null | undefined;
2160
+ constructor(topia: Topia, options?: EcosystemOptionalInterface);
2161
+ /**
2162
+ * @summary
2163
+ * Retrieves the data object for a Topia ecosystem. Requires canUpdateEcosystemDataObjects permission to be set to true for the public key.
2164
+ *
2165
+ * @usage
2166
+ * ```ts
2167
+ * const dataObject = await ecosystem.fetchDataObject("exampleAppPublicKey", "exampleAppPublicKeyJWT");
2168
+ * ```
2169
+ */
2170
+ fetchDataObject(appPublicKey?: string, appJWT?: string): Promise<void | ResponseType$1>;
2171
+ /**
2172
+ * @summary
2173
+ * Sets the data object for a Topia ecosystem.
2174
+ *
2175
+ * Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
2176
+ *
2177
+ * @usage
2178
+ * ```ts
2179
+ * await ecosystem.setDataObject({ "exampleKey": "exampleValue" }, {
2180
+ * sharedAppPublicKey: "exampleAppPublicKey",
2181
+ * sharedAppJWT: "exampleAppPublicKeyJWT",}
2182
+ * });
2183
+ * ```
2184
+ */
2185
+ setDataObject(dataObject: object | null | undefined, options?: {
2186
+ sharedAppPublicKey?: string;
2187
+ sharedAppJWT?: string;
2188
+ analytics?: AnalyticType[];
2189
+ lock?: {
2190
+ lockId: string;
2191
+ releaseLock?: boolean;
2192
+ };
2193
+ }): Promise<void | ResponseType$1>;
2194
+ /**
2195
+ * @summary
2196
+ * Updates the data object for a Topia ecosystem.
2197
+ *
2198
+ * Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
2199
+ *
2200
+ * @usage
2201
+ * ```ts
2202
+ * await ecosystem.updateDataObject({ "exampleKey": "exampleValue" }, {
2203
+ * sharedAppPublicKey: "exampleAppPublicKey",
2204
+ * sharedAppJWT: "exampleAppPublicKeyJWT",}
2205
+ * });
2206
+ * ```
2207
+ */
2208
+ updateDataObject(dataObject: object, options?: {
2209
+ sharedAppPublicKey?: string;
2210
+ sharedAppJWT?: string;
2211
+ analytics?: AnalyticType[];
2212
+ lock?: {
2213
+ lockId: string;
2214
+ releaseLock?: boolean;
2215
+ };
2216
+ }): Promise<void | ResponseType$1>;
2217
+ /**
2218
+ * @summary
2219
+ * Increments a specific value in the data object for a Topia ecosystem by the amount specified. Must have valid interactive credentials from a visitor in the world.
2220
+ *
2221
+ * Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
2222
+ *
2223
+ * @usage
2224
+ * ```ts
2225
+ * await ecosystem.incrementDataObjectValue("key", 1, {
2226
+ * sharedAppPublicKey: "exampleAppPublicKey",
2227
+ * sharedAppJWT: "exampleAppPublicKeyJWT",}
2228
+ * });
2229
+ * ```
2230
+ */
2231
+ incrementDataObjectValue(path: string, amount: number, options?: {
2232
+ sharedAppPublicKey?: string;
2233
+ sharedAppJWT?: string;
2234
+ analytics?: AnalyticType[];
2235
+ lock?: {
2236
+ lockId: string;
2237
+ releaseLock?: boolean;
2238
+ };
2239
+ }): Promise<void | ResponseType$1>;
2240
+ }
2241
+
2113
2242
  /**
2114
2243
  * @summary
2115
2244
  * Create an instance of WebRTCConnector class with optional session credentials.
@@ -2363,6 +2492,27 @@ declare class DroppedAssetFactory extends SDKController {
2363
2492
  }): Promise<DroppedAsset>;
2364
2493
  }
2365
2494
 
2495
+ /**
2496
+ * @usage
2497
+ * ```ts
2498
+ * const Ecosystem = new EcosystemFactory(myTopiaInstance);
2499
+ * ```
2500
+ */
2501
+ declare class EcosystemFactory {
2502
+ topia: Topia;
2503
+ constructor(topia: Topia);
2504
+ /**
2505
+ * @summary
2506
+ * Instantiate a new instance of Ecosystem class.
2507
+ *
2508
+ * @usage
2509
+ * ```
2510
+ * const ecosystemInstance = await Ecosystem.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId }});
2511
+ * ```
2512
+ */
2513
+ create(options?: EcosystemOptionalInterface): Ecosystem;
2514
+ }
2515
+
2366
2516
  /**
2367
2517
  * @usage
2368
2518
  * ```ts
@@ -2461,7 +2611,7 @@ declare class WebRTCConnectorFactory {
2461
2611
  *
2462
2612
  * @usage
2463
2613
  * ```
2464
- * const userInstance = await WebRTCConnector.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId }, twilioConfig: {} });
2614
+ * const webRTCInstance = await WebRTCConnector.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId }, twilioConfig: {} });
2465
2615
  * ```
2466
2616
  */
2467
2617
  create(urlSlug: string, options?: WebRTCConnectorOptionalInterface): WebRTCConnector;
@@ -2525,4 +2675,4 @@ declare class WorldFactory extends SDKController {
2525
2675
  }>;
2526
2676
  }
2527
2677
 
2528
- export { AnalyticType, AnimationMetaType, Asset, AssetFactory, AssetInterface, AssetOptionalInterface, AssetOptions, AssetType, DroppedAsset, DroppedAssetClickType, DroppedAssetFactory, DroppedAssetInterface, DroppedAssetMediaType, DroppedAssetOptionalInterface, DroppedAssetOptions, FireToastInterface, FrameType, InteractiveCredentials, MoveAllVisitorsInterface, MoveVisitorInterface, OpenIframeInterface, ResponseType$1 as ResponseType, SDKController, SDKInterface, Scene, SceneFactory, SceneInterface, SceneOptionalInterface, Topia, TopiaInterface, UpdateBroadcastInterface, UpdateClickTypeInterface, UpdateDroppedAssetInterface, UpdateMediaTypeInterface, UpdatePrivateZoneInterface, User, UserFactory, UserInterface, UserOptionalInterface, UserOptions, Visitor, VisitorFactory, VisitorInterface, VisitorOptionalInterface, VisitorOptions, VisitorType, VisitorsToMoveArrayType, VisitorsToMoveType, WebRTCConnector, WebRTCConnectorFactory, WebRTCConnectorInterface, WebRTCConnectorOptionalInterface, WebhookInterface, World, WorldActivity, WorldActivityFactory, WorldActivityOptionalInterface, WorldActivityType, WorldDetailsInterface, WorldFactory, WorldInterface, WorldOptionalInterface, WorldOptions, WorldWebhooksInterface };
2678
+ export { AnalyticType, AnimationMetaType, Asset, AssetFactory, AssetInterface, AssetOptionalInterface, AssetOptions, AssetType, DroppedAsset, DroppedAssetClickType, DroppedAssetFactory, DroppedAssetInterface, DroppedAssetMediaType, DroppedAssetOptionalInterface, DroppedAssetOptions, Ecosystem, EcosystemFactory, EcosystemInterface, EcosystemOptionalInterface, FireToastInterface, FrameType, InteractiveCredentials, MoveAllVisitorsInterface, MoveVisitorInterface, OpenIframeInterface, ResponseType$1 as ResponseType, SDKController, SDKInterface, Scene, SceneFactory, SceneInterface, SceneOptionalInterface, Topia, TopiaInterface, UpdateBroadcastInterface, UpdateClickTypeInterface, UpdateDroppedAssetInterface, UpdateMediaTypeInterface, UpdatePrivateZoneInterface, User, UserFactory, UserInterface, UserOptionalInterface, UserOptions, Visitor, VisitorFactory, VisitorInterface, VisitorOptionalInterface, VisitorOptions, VisitorType, VisitorsToMoveArrayType, VisitorsToMoveType, WebRTCConnector, WebRTCConnectorFactory, WebRTCConnectorInterface, WebRTCConnectorOptionalInterface, WebhookInterface, World, WorldActivity, WorldActivityFactory, WorldActivityOptionalInterface, WorldActivityType, WorldDetailsInterface, WorldFactory, WorldInterface, WorldOptionalInterface, WorldOptions, WorldWebhooksInterface };
package/dist/index.js CHANGED
@@ -39986,10 +39986,13 @@ class DroppedAsset extends Asset {
39986
39986
  * const dataObject = await droppedAsset.fetchDataObject();
39987
39987
  * ```
39988
39988
  */
39989
- fetchDataObject() {
39989
+ fetchDataObject(appPublicKey, appJWT) {
39990
39990
  return __awaiter(this, void 0, void 0, function* () {
39991
39991
  try {
39992
- const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/assets/${this.id}/data-object`, this.requestOptions);
39992
+ let query = "";
39993
+ if (appPublicKey)
39994
+ query = `?appPublicKey=${appPublicKey}&appJWT=${appJWT}`;
39995
+ const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/assets/${this.id}/data-object${query}`, this.requestOptions);
39993
39996
  this.dataObject = response.data;
39994
39997
  return response.data;
39995
39998
  }
@@ -40472,6 +40475,126 @@ class DroppedAsset extends Asset {
40472
40475
  }
40473
40476
  _DroppedAsset_updateDroppedAsset = new WeakMap();
40474
40477
 
40478
+ /**
40479
+ * @summary
40480
+ * Create an instance of Ecosystem class with optional session credentials
40481
+ *
40482
+ * @usage
40483
+ * ```ts
40484
+ * await new Ecosystem(topia, {
40485
+ * credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
40486
+ * });
40487
+ * ```
40488
+ */
40489
+ class Ecosystem extends SDKController {
40490
+ constructor(topia, options = { credentials: {} }) {
40491
+ super(topia, options.credentials);
40492
+ this.dataObject = {};
40493
+ }
40494
+ /**
40495
+ * @summary
40496
+ * Retrieves the data object for a Topia ecosystem. Requires canUpdateEcosystemDataObjects permission to be set to true for the public key.
40497
+ *
40498
+ * @usage
40499
+ * ```ts
40500
+ * const dataObject = await ecosystem.fetchDataObject("exampleAppPublicKey", "exampleAppPublicKeyJWT");
40501
+ * ```
40502
+ */
40503
+ fetchDataObject(appPublicKey, appJWT) {
40504
+ return __awaiter(this, void 0, void 0, function* () {
40505
+ try {
40506
+ let query = "";
40507
+ if (appPublicKey)
40508
+ query = `?appPublicKey=${appPublicKey}&appJWT=${appJWT}`;
40509
+ const response = yield this.topiaPublicApi().get(`/ecosystem/data-object${query}`, this.requestOptions);
40510
+ this.dataObject = response.data;
40511
+ return response.data;
40512
+ }
40513
+ catch (error) {
40514
+ throw this.errorHandler({ error, sdkMethod: "Ecosystem.fetchDataObject" });
40515
+ }
40516
+ });
40517
+ }
40518
+ /**
40519
+ * @summary
40520
+ * Sets the data object for a Topia ecosystem.
40521
+ *
40522
+ * Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
40523
+ *
40524
+ * @usage
40525
+ * ```ts
40526
+ * await ecosystem.setDataObject({ "exampleKey": "exampleValue" }, {
40527
+ * sharedAppPublicKey: "exampleAppPublicKey",
40528
+ * sharedAppJWT: "exampleAppPublicKeyJWT",}
40529
+ * });
40530
+ * ```
40531
+ */
40532
+ setDataObject(dataObject, options = {}) {
40533
+ return __awaiter(this, void 0, void 0, function* () {
40534
+ try {
40535
+ yield this.topiaPublicApi().post(`/ecosystem/data-object`, Object.assign(Object.assign({}, options), { dataObject: dataObject || this.dataObject }), this.requestOptions);
40536
+ this.dataObject = dataObject || this.dataObject;
40537
+ }
40538
+ catch (error) {
40539
+ throw this.errorHandler({ error, params: { dataObject, options }, sdkMethod: "Ecosystem.setDataObject" });
40540
+ }
40541
+ });
40542
+ }
40543
+ /**
40544
+ * @summary
40545
+ * Updates the data object for a Topia ecosystem.
40546
+ *
40547
+ * Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
40548
+ *
40549
+ * @usage
40550
+ * ```ts
40551
+ * await ecosystem.updateDataObject({ "exampleKey": "exampleValue" }, {
40552
+ * sharedAppPublicKey: "exampleAppPublicKey",
40553
+ * sharedAppJWT: "exampleAppPublicKeyJWT",}
40554
+ * });
40555
+ * ```
40556
+ */
40557
+ updateDataObject(dataObject, options = {}) {
40558
+ return __awaiter(this, void 0, void 0, function* () {
40559
+ try {
40560
+ yield this.topiaPublicApi().put(`/ecosystem/data-object`, Object.assign(Object.assign({}, options), { dataObject: dataObject || this.dataObject }), this.requestOptions);
40561
+ this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
40562
+ }
40563
+ catch (error) {
40564
+ throw this.errorHandler({ error, params: { dataObject, options }, sdkMethod: "Ecosystem.updateDataObject" });
40565
+ }
40566
+ });
40567
+ }
40568
+ /**
40569
+ * @summary
40570
+ * Increments a specific value in the data object for a Topia ecosystem by the amount specified. Must have valid interactive credentials from a visitor in the world.
40571
+ *
40572
+ * Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
40573
+ *
40574
+ * @usage
40575
+ * ```ts
40576
+ * await ecosystem.incrementDataObjectValue("key", 1, {
40577
+ * sharedAppPublicKey: "exampleAppPublicKey",
40578
+ * sharedAppJWT: "exampleAppPublicKeyJWT",}
40579
+ * });
40580
+ * ```
40581
+ */
40582
+ incrementDataObjectValue(path, amount, options = {}) {
40583
+ return __awaiter(this, void 0, void 0, function* () {
40584
+ try {
40585
+ yield this.topiaPublicApi().put(`/ecosystem/increment-data-object-value`, Object.assign({ path, amount }, options), this.requestOptions);
40586
+ }
40587
+ catch (error) {
40588
+ throw this.errorHandler({
40589
+ error,
40590
+ params: { path, amount, options },
40591
+ sdkMethod: "Ecosystem.incrementDataObjectValue",
40592
+ });
40593
+ }
40594
+ });
40595
+ }
40596
+ }
40597
+
40475
40598
  /**
40476
40599
  * @summary
40477
40600
  * Create an instance of Scene class with a given scene id and optional attributes and session credentials.
@@ -40580,9 +40703,12 @@ class World extends SDKController {
40580
40703
  * const { dataObject } = world;
40581
40704
  * ```
40582
40705
  */
40583
- this.fetchDataObject = () => __awaiter(this, void 0, void 0, function* () {
40706
+ this.fetchDataObject = (appPublicKey, appJWT) => __awaiter(this, void 0, void 0, function* () {
40584
40707
  try {
40585
- const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/get-data-object`, this.requestOptions);
40708
+ let query = "";
40709
+ if (appPublicKey)
40710
+ query = `?appPublicKey=${appPublicKey}&appJWT=${appJWT}`;
40711
+ const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/get-data-object${query}`, this.requestOptions);
40586
40712
  this.dataObject = response.data;
40587
40713
  return response.data;
40588
40714
  }
@@ -41717,12 +41843,15 @@ class User extends SDKController {
41717
41843
  * const dataObject = await user.fetchDataObject();
41718
41844
  * ```
41719
41845
  */
41720
- fetchDataObject() {
41846
+ fetchDataObject(appPublicKey, appJWT) {
41721
41847
  return __awaiter(this, void 0, void 0, function* () {
41722
41848
  try {
41723
41849
  if (!this.profileId)
41724
41850
  throw "This method requires the use of a profileId";
41725
- const response = yield this.topiaPublicApi().get(`/user/dataObjects/${this.profileId}/get-data-object`, this.requestOptions);
41851
+ let query = "";
41852
+ if (appPublicKey)
41853
+ query = `?appPublicKey=${appPublicKey}&appJWT=${appJWT}`;
41854
+ const response = yield this.topiaPublicApi().get(`/user/dataObjects/${this.profileId}/get-data-object${query}`, this.requestOptions);
41726
41855
  this.dataObject = response.data;
41727
41856
  return response.data;
41728
41857
  }
@@ -42114,10 +42243,13 @@ class Visitor extends User {
42114
42243
  * const dataObject = await visitor.fetchDataObject();
42115
42244
  * ```
42116
42245
  */
42117
- fetchDataObject() {
42246
+ fetchDataObject(appPublicKey, appJWT) {
42118
42247
  return __awaiter(this, void 0, void 0, function* () {
42119
42248
  try {
42120
- const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors/${this.id}/get-data-object`, this.requestOptions);
42249
+ let query = "";
42250
+ if (appPublicKey)
42251
+ query = `?appPublicKey=${appPublicKey}&appJWT=${appJWT}`;
42252
+ const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors/${this.id}/get-data-object${query}`, this.requestOptions);
42121
42253
  this.dataObject = response.data;
42122
42254
  return response.data;
42123
42255
  }
@@ -42658,6 +42790,30 @@ class DroppedAssetFactory extends SDKController {
42658
42790
  }
42659
42791
  }
42660
42792
 
42793
+ /**
42794
+ * @usage
42795
+ * ```ts
42796
+ * const Ecosystem = new EcosystemFactory(myTopiaInstance);
42797
+ * ```
42798
+ */
42799
+ class EcosystemFactory {
42800
+ constructor(topia) {
42801
+ this.topia = topia;
42802
+ }
42803
+ /**
42804
+ * @summary
42805
+ * Instantiate a new instance of Ecosystem class.
42806
+ *
42807
+ * @usage
42808
+ * ```
42809
+ * const ecosystemInstance = await Ecosystem.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId }});
42810
+ * ```
42811
+ */
42812
+ create(options) {
42813
+ return new Ecosystem(this.topia, options);
42814
+ }
42815
+ }
42816
+
42661
42817
  /**
42662
42818
  * @usage
42663
42819
  * ```ts
@@ -42779,7 +42935,7 @@ class WebRTCConnectorFactory {
42779
42935
  *
42780
42936
  * @usage
42781
42937
  * ```
42782
- * const userInstance = await WebRTCConnector.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId }, twilioConfig: {} });
42938
+ * const webRTCInstance = await WebRTCConnector.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId }, twilioConfig: {} });
42783
42939
  * ```
42784
42940
  */
42785
42941
  create(urlSlug, options) {
@@ -42897,4 +43053,4 @@ process.on("uncaughtException", function (err) {
42897
43053
  process.exit(1);
42898
43054
  });
42899
43055
 
42900
- export { Asset, AssetFactory, DroppedAsset, DroppedAssetClickType, DroppedAssetFactory, DroppedAssetMediaType, SDKController, Scene, SceneFactory, Topia, User, UserFactory, Visitor, VisitorFactory, WebRTCConnector, WebRTCConnectorFactory, World, WorldActivity, WorldActivityFactory, WorldActivityType, WorldFactory };
43056
+ export { Asset, AssetFactory, DroppedAsset, DroppedAssetClickType, DroppedAssetFactory, DroppedAssetMediaType, Ecosystem, EcosystemFactory, SDKController, Scene, SceneFactory, Topia, User, UserFactory, Visitor, VisitorFactory, WebRTCConnector, WebRTCConnectorFactory, World, WorldActivity, WorldActivityFactory, WorldActivityType, WorldFactory };
package/package.json CHANGED
@@ -60,5 +60,5 @@
60
60
  "yalc-push": "yarn build && yalc publish --push --dev --no-scripts"
61
61
  },
62
62
  "type": "module",
63
- "version": "0.15.09"
63
+ "version": "0.16.01"
64
64
  }