@rtsdk/topia 0.17.8 → 0.18.0

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.js CHANGED
@@ -39759,6 +39759,8 @@ class Asset extends SDKController {
39759
39759
  /**
39760
39760
  * Retrieves platform asset details and assigns response data to the instance.
39761
39761
  *
39762
+ * @keywords get, fetch, retrieve, load, details, info, information
39763
+ *
39762
39764
  * @example
39763
39765
  * ```ts
39764
39766
  * await asset.fetchAssetById();
@@ -39782,6 +39784,8 @@ class Asset extends SDKController {
39782
39784
  /**
39783
39785
  * Updates platform asset details.
39784
39786
  *
39787
+ * @keywords update, modify, change, edit, alter, transform
39788
+ *
39785
39789
  * @example
39786
39790
  * ```ts
39787
39791
  * await asset.updateAsset({
@@ -39939,6 +39943,8 @@ class DroppedAsset extends Asset {
39939
39943
  /**
39940
39944
  * Retrieves dropped asset details and assigns response data to the instance.
39941
39945
  *
39946
+ * @keywords get, fetch, retrieve, load, details, info, information
39947
+ *
39942
39948
  * @example
39943
39949
  * ```ts
39944
39950
  * await droppedAsset.fetchDroppedAssetById();
@@ -39961,6 +39967,8 @@ class DroppedAsset extends Asset {
39961
39967
  /**
39962
39968
  * Updates dropped asset details and assigns the response data to the instance. Requires Public Key to have the `canUpdateDroppedAssets` permission.
39963
39969
  *
39970
+ * @keywords update, modify, change, edit, alter, transform
39971
+ *
39964
39972
  * @example
39965
39973
  * ```ts
39966
39974
  * const payload = {
@@ -40035,6 +40043,8 @@ class DroppedAsset extends Asset {
40035
40043
  /**
40036
40044
  * Deletes the dropped asset (removes it from the world).
40037
40045
  *
40046
+ * @keywords remove, delete, erase, destroy, eliminate
40047
+ *
40038
40048
  * @example
40039
40049
  * ```ts
40040
40050
  * await droppedAsset.deleteDroppedAsset();
@@ -40053,6 +40063,8 @@ class DroppedAsset extends Asset {
40053
40063
  /**
40054
40064
  * Retrieves the data object for a dropped asset.
40055
40065
  *
40066
+ * @keywords get, fetch, retrieve, load, data, object, state
40067
+ *
40056
40068
  * @category Data Objects
40057
40069
  *
40058
40070
  * @example
@@ -40085,6 +40097,8 @@ class DroppedAsset extends Asset {
40085
40097
  * @remarks
40086
40098
  * 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
40087
40099
  *
40100
+ * @keywords set, assign, store, save, data, object, state
40101
+ *
40088
40102
  * @category Data Objects
40089
40103
  *
40090
40104
  * @example
@@ -40117,6 +40131,8 @@ class DroppedAsset extends Asset {
40117
40131
  * @remarks
40118
40132
  * 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
40119
40133
  *
40134
+ * @keywords update, modify, change, edit, alter, data, object, state
40135
+ *
40120
40136
  * @category Data Objects
40121
40137
  *
40122
40138
  * @example
@@ -40146,6 +40162,8 @@ class DroppedAsset extends Asset {
40146
40162
  * @remarks
40147
40163
  * 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
40148
40164
  *
40165
+ * @keywords increment, increase, add, count, data, object, state
40166
+ *
40149
40167
  * @category Data Objects
40150
40168
  *
40151
40169
  * @example
@@ -40170,6 +40188,8 @@ class DroppedAsset extends Asset {
40170
40188
  /**
40171
40189
  * Updates broadcast options for a dropped asset.
40172
40190
  *
40191
+ * @keywords broadcast, dropped asset settings
40192
+ *
40173
40193
  * @example
40174
40194
  * ```ts
40175
40195
  * await droppedAsset.updateBroadcast({
@@ -40193,6 +40213,8 @@ class DroppedAsset extends Asset {
40193
40213
  /**
40194
40214
  * Updates click options for a dropped asset.
40195
40215
  *
40216
+ * @keywords click, link, interaction, url, dropped asset settings
40217
+ *
40196
40218
  * @example
40197
40219
  * ```ts
40198
40220
  * await droppedAsset.updateClickType({
@@ -40233,6 +40255,8 @@ class DroppedAsset extends Asset {
40233
40255
  /**
40234
40256
  * Adds an array of links to an asset. Maximum is 20 links.
40235
40257
  *
40258
+ * @keywords links, multiple, clickable, urls, hyperlinks, dropped asset settings
40259
+ *
40236
40260
  * @example
40237
40261
  * ```ts
40238
40262
  * await droppedAsset.setClickableLinkMulti({
@@ -40273,6 +40297,8 @@ class DroppedAsset extends Asset {
40273
40297
  * @remarks
40274
40298
  * Pass in an 'existingLinkId' to edit an existing link.
40275
40299
  *
40300
+ * @keywords links, multiple, clickable, urls, dropped asset settings
40301
+ *
40276
40302
  * @example
40277
40303
  * ```ts
40278
40304
  * await droppedAsset.updateClickableLinkMulti({
@@ -40306,6 +40332,8 @@ class DroppedAsset extends Asset {
40306
40332
  /**
40307
40333
  * Removes a clickable link from a dropped asset.
40308
40334
  *
40335
+ * @keywords remove, delete, link, clickable, url, erase, dropped asset settings
40336
+ *
40309
40337
  * @example
40310
40338
  * ```ts
40311
40339
  * await droppedAsset.removeClickableLink({ linkId: "link-id" });
@@ -40327,6 +40355,8 @@ class DroppedAsset extends Asset {
40327
40355
  /**
40328
40356
  * Updates text and style of a dropped asset.
40329
40357
  *
40358
+ * @keywords text, style, dropped asset settings
40359
+ *
40330
40360
  * @example
40331
40361
  * ```ts
40332
40362
  * const style = {
@@ -40353,6 +40383,8 @@ class DroppedAsset extends Asset {
40353
40383
  /**
40354
40384
  * Updates media options for a dropped asset.
40355
40385
  *
40386
+ * @keywords media, video, audio, dropped asset settings
40387
+ *
40356
40388
  * @example
40357
40389
  * ```ts
40358
40390
  * await droppedAsset.updateMediaType({
@@ -40390,6 +40422,8 @@ class DroppedAsset extends Asset {
40390
40422
  /**
40391
40423
  * Updates mute zone options for a dropped asset.
40392
40424
  *
40425
+ * @keywords mute, zone, dropped asset settings
40426
+ *
40393
40427
  * @example
40394
40428
  * ```ts
40395
40429
  * await droppedAsset.updateMuteZone(true);
@@ -40408,6 +40442,8 @@ class DroppedAsset extends Asset {
40408
40442
  /**
40409
40443
  * Updates landmark zone options for a dropped asset.
40410
40444
  *
40445
+ * @keywords landmark, zone, dropped asset settings
40446
+ *
40411
40447
  * @example
40412
40448
  * ```ts
40413
40449
  * await droppedAsset.updateLandmarkZone({
@@ -40431,6 +40467,8 @@ class DroppedAsset extends Asset {
40431
40467
  /**
40432
40468
  * Updates webhook zone options for a dropped asset.
40433
40469
  *
40470
+ * @keywords webhook, zone, dropped asset settings
40471
+ *
40434
40472
  * @example
40435
40473
  * ```ts
40436
40474
  * await droppedAsset.updateWebhookZone(true);
@@ -40449,6 +40487,8 @@ class DroppedAsset extends Asset {
40449
40487
  /**
40450
40488
  * Moves a dropped asset to specified coordinates.
40451
40489
  *
40490
+ * @keywords position, dropped asset settings
40491
+ *
40452
40492
  * @example
40453
40493
  * ```ts
40454
40494
  * await droppedAsset.updatePosition(100, 200, 100);
@@ -40468,6 +40508,8 @@ class DroppedAsset extends Asset {
40468
40508
  /**
40469
40509
  * Updates private zone options for a dropped asset.
40470
40510
  *
40511
+ * @keywords private, zone, dropped asset settings
40512
+ *
40471
40513
  * @example
40472
40514
  * ```ts
40473
40515
  * await droppedAsset.updatePrivateZone({
@@ -40491,6 +40533,8 @@ class DroppedAsset extends Asset {
40491
40533
  /**
40492
40534
  * Updates the size of a dropped asset.
40493
40535
  *
40536
+ * @keywords size, scale, dropped asset settings
40537
+ *
40494
40538
  * @example
40495
40539
  * ```ts
40496
40540
  * await droppedAsset.assetScale(.5);
@@ -40509,6 +40553,8 @@ class DroppedAsset extends Asset {
40509
40553
  /**
40510
40554
  * Flip an dropped asset.
40511
40555
  *
40556
+ * @keywords flip, layout, dropped asset settings
40557
+ *
40512
40558
  * @example
40513
40559
  * ```ts
40514
40560
  * await droppedAsset.flip(.5);
@@ -40527,6 +40573,8 @@ class DroppedAsset extends Asset {
40527
40573
  /**
40528
40574
  * Change or remove media embedded in a dropped asset.
40529
40575
  *
40576
+ * @keywords media, update, dropped asset settings
40577
+ *
40530
40578
  * @example
40531
40579
  * ```ts
40532
40580
  * await droppedAsset.updateUploadedMediaSelected("LVWyxwNxI96eLjnXWwYO");
@@ -40545,6 +40593,8 @@ class DroppedAsset extends Asset {
40545
40593
  /**
40546
40594
  * Change or remove top and bottom layers of a dropped asset.
40547
40595
  *
40596
+ * @keywords layers, images, urls, dropped asset settings
40597
+ *
40548
40598
  * @example
40549
40599
  * ```ts
40550
40600
  * await droppedAsset.updateWebImageLayers("","https://www.shutterstock.com/image-vector/colorful-illustration-test-word-260nw-1438324490.jpg");
@@ -40564,6 +40614,8 @@ class DroppedAsset extends Asset {
40564
40614
  /**
40565
40615
  * Add a webhook to a dropped asset
40566
40616
  *
40617
+ * @keywords webhook, dropped asset settings
40618
+ *
40567
40619
  * @example
40568
40620
  * ```ts
40569
40621
  * await droppedAsset.addWebhook({
@@ -40603,6 +40655,8 @@ class DroppedAsset extends Asset {
40603
40655
  /**
40604
40656
  * Set the interactive settings on a dropped asset
40605
40657
  *
40658
+ * @keywords interactive, dropped asset settings
40659
+ *
40606
40660
  * @example
40607
40661
  * ```ts
40608
40662
  * await droppedAsset.setInteractiveSettings({
@@ -40630,6 +40684,8 @@ class DroppedAsset extends Asset {
40630
40684
  /**
40631
40685
  * Retrieve analytics for a dropped asset by day, week, month, quarter, or year
40632
40686
  *
40687
+ * @keywords get, fetch, retrieve, load, analytics
40688
+ *
40633
40689
  * @example
40634
40690
  * ```ts
40635
40691
  * const analytics = await droppedAsset.fetchDroppedAssetAnalytics({
@@ -40673,6 +40729,52 @@ class DroppedAsset extends Asset {
40673
40729
  }
40674
40730
  _DroppedAsset_updateDroppedAsset = new WeakMap();
40675
40731
 
40732
+ // TODO: Define InventoryItemInterface and InventoryItemOptionalInterface
40733
+ /**
40734
+ * InventoryItem represents an item in a user's inventory.
40735
+ *
40736
+ * @remarks
40737
+ * This class should be instantiated via InventoryFactory only.
40738
+ *
40739
+ * @keywords inventory, item, asset, object
40740
+ */
40741
+ class InventoryItem extends SDKController {
40742
+ // Add more properties as needed (e.g., name, quantity, metadata)
40743
+ constructor(topia, id, options = { attributes: {}, credentials: {} }) {
40744
+ super(topia, Object.assign({}, options.credentials));
40745
+ this.id = id;
40746
+ Object.assign(this, options.attributes);
40747
+ const { name = "", description = "", type = "", created_at = new Date(), updated_at = new Date(), metadata = null, image_path = "", interactive_key_id = "", status = "", } = options.attributes;
40748
+ this.name = name;
40749
+ this.description = description;
40750
+ this.type = type;
40751
+ this.created_at = created_at;
40752
+ this.updated_at = updated_at;
40753
+ this.metadata = metadata;
40754
+ this.image_path = image_path;
40755
+ this.interactive_key_id = interactive_key_id;
40756
+ this.status = status;
40757
+ }
40758
+ /**
40759
+ * Fetches the inventory item details from the platform and assigns them to this instance.
40760
+ *
40761
+ * @example
40762
+ * ```ts
40763
+ * await item.fetchInventoryItemById();
40764
+ * ```
40765
+ *
40766
+ * @returns {Promise<InventoryItem>} Returns when the item has been fetched and assigned.
40767
+ */
40768
+ fetchInventoryItemById() {
40769
+ return __awaiter(this, void 0, void 0, function* () {
40770
+ const response = yield this.topiaPublicApi().get(`/inventory/${this.id}`, this.requestOptions);
40771
+ Object.assign(this, response.data);
40772
+ return this;
40773
+ });
40774
+ }
40775
+ }
40776
+
40777
+ var _Ecosystem_inventoryItems;
40676
40778
  /* ============================================================================
40677
40779
  AI RULES for code assistants
40678
40780
 
@@ -40716,11 +40818,15 @@ AI RULES for code assistants
40716
40818
  class Ecosystem extends SDKController {
40717
40819
  constructor(topia, options = { credentials: {} }) {
40718
40820
  super(topia, options.credentials);
40821
+ _Ecosystem_inventoryItems.set(this, void 0);
40719
40822
  this.dataObject = {};
40823
+ __classPrivateFieldSet(this, _Ecosystem_inventoryItems, [], "f");
40720
40824
  }
40721
40825
  /**
40722
40826
  * Retrieves the data object for a Topia ecosystem. Requires canUpdateEcosystemDataObjects permission to be set to true for the public key.
40723
40827
  *
40828
+ * @keywords get, fetch, retrieve, load, data, object, state
40829
+ *
40724
40830
  * @category Data Objects
40725
40831
  *
40726
40832
  * @example
@@ -40755,6 +40861,8 @@ class Ecosystem extends SDKController {
40755
40861
  *
40756
40862
  * 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
40757
40863
  *
40864
+ * @keywords set, assign, store, save, data, object, state
40865
+ *
40758
40866
  * @category Data Objects
40759
40867
  *
40760
40868
  * @example
@@ -40785,6 +40893,8 @@ class Ecosystem extends SDKController {
40785
40893
  *
40786
40894
  * 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
40787
40895
  *
40896
+ * @keywords update, modify, change, edit, alter, data, object, state
40897
+ *
40788
40898
  * @category Data Objects
40789
40899
  *
40790
40900
  * @example
@@ -40821,6 +40931,8 @@ class Ecosystem extends SDKController {
40821
40931
  *
40822
40932
  * 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
40823
40933
  *
40934
+ * @keywords increment, increase, add, count, data, object, state
40935
+ *
40824
40936
  * @category Data Objects
40825
40937
  *
40826
40938
  * @example
@@ -40845,6 +40957,88 @@ class Ecosystem extends SDKController {
40845
40957
  }
40846
40958
  });
40847
40959
  }
40960
+ /**
40961
+ * Retrieves all inventory items for a given keyholder (app public key).
40962
+ *
40963
+ * @keywords get, fetch, retrieve, list, inventory, items, keyholder
40964
+ *
40965
+ * @example
40966
+ * ```ts
40967
+ * const items = await ecosystem.fetchInventoryItems("appPublicKey", "appJWT");
40968
+ * ```
40969
+ *
40970
+ * @returns {Promise<object[]>} Returns an array of InventoryItem objects.
40971
+ */
40972
+ fetchInventoryItems() {
40973
+ return __awaiter(this, void 0, void 0, function* () {
40974
+ try {
40975
+ // const query = appJWT ? `?appPublicKey=${appPublicKey}&appJWT=${appJWT}` : `?appPublicKey=${appPublicKey}`;
40976
+ const response = yield this.topiaPublicApi().get(`/inventory/`, this.requestOptions);
40977
+ // TODO: Replace 'object' with InventoryItem and instantiate InventoryItem objects if needed
40978
+ // create temp map and then update private property only once
40979
+ const tempItems = [];
40980
+ for (const index in response.data) {
40981
+ tempItems.push(new InventoryItem(this.topia, response.data[index].id, {
40982
+ attributes: response.data[index],
40983
+ credentials: this.credentials,
40984
+ }));
40985
+ }
40986
+ __classPrivateFieldSet(this, _Ecosystem_inventoryItems, tempItems, "f");
40987
+ }
40988
+ catch (error) {
40989
+ throw this.errorHandler({ error, sdkMethod: "Ecosystem.fetchInventoryItems" });
40990
+ }
40991
+ });
40992
+ }
40993
+ get inventoryItems() {
40994
+ return __classPrivateFieldGet(this, _Ecosystem_inventoryItems, "f");
40995
+ }
40996
+ }
40997
+ _Ecosystem_inventoryItems = new WeakMap();
40998
+
40999
+ /**
41000
+ * Controller for a user's owned inventory item.
41001
+ *
41002
+ * @remarks
41003
+ * This class should be instantiated via UserInventoryItemFactory only.
41004
+ *
41005
+ * @property inventoryItemId - The root inventory item's id
41006
+ */
41007
+ class UserInventoryItem extends InventoryItem {
41008
+ constructor(topia, id, options = { attributes: {}, credentials: {} }) {
41009
+ const { attributes = {} } = options;
41010
+ const { item_id = "" } = attributes;
41011
+ super(topia, item_id, { attributes: options.attributes, credentials: options.credentials });
41012
+ Object.assign(this, options.attributes);
41013
+ this.userItemId = id;
41014
+ const { user_id = "", quantity = 0, grant_source = "unknown", type = "unknown", metadata = {}, created_at = new Date(), updated_at = new Date(), } = options.attributes;
41015
+ this.item_id = item_id;
41016
+ this.quantity = quantity;
41017
+ this.grant_source = grant_source;
41018
+ this.user_id = user_id;
41019
+ this.type = type;
41020
+ this.metadata = metadata;
41021
+ this.created_at = created_at;
41022
+ this.updated_at = updated_at;
41023
+ }
41024
+ /**
41025
+ * Fetches the user inventory item details from the platform and assigns them to this instance.
41026
+ *
41027
+ * @example
41028
+ * ```ts
41029
+ * await userInventoryItem.fetchUserInventoryItemById();
41030
+ * ```
41031
+ *
41032
+ * @returns {Promise<void>} Returns when the item has been fetched and assigned.
41033
+ */
41034
+ fetchUserInventoryItemById() {
41035
+ return __awaiter(this, void 0, void 0, function* () {
41036
+ // TODO: Implement API call to fetch user inventory item details
41037
+ // Example:
41038
+ // const response = await this.topia.api.get(`/inventory/user-items/${this.userId}/${this.inventoryItemId}`, this.options?.credentials);
41039
+ // Object.assign(this, response.data);
41040
+ });
41041
+ }
40848
41042
  }
40849
41043
 
40850
41044
  /* ============================================================================
@@ -40896,6 +41090,8 @@ class Scene extends SDKController {
40896
41090
  /**
40897
41091
  * Retrieves scene details and assigns response data to the instance.
40898
41092
  *
41093
+ * @keywords get, fetch, retrieve, load, details, info, information, scene
41094
+ *
40899
41095
  * @example
40900
41096
  * ```ts
40901
41097
  * await scene.fetchSceneById();
@@ -41003,6 +41199,8 @@ class World extends SDKController {
41003
41199
  /**
41004
41200
  * Retrieves the data object for a world. Must have valid interactive credentials from a visitor in the world.
41005
41201
  *
41202
+ * @keywords get, fetch, retrieve, load, data, object, state
41203
+ *
41006
41204
  * @category Data Objects
41007
41205
  *
41008
41206
  * @example
@@ -41032,6 +41230,8 @@ class World extends SDKController {
41032
41230
  * @remarks
41033
41231
  * 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
41034
41232
  *
41233
+ * @keywords set, assign, store, save, data, object, state
41234
+ *
41035
41235
  * @category Data Objects
41036
41236
  *
41037
41237
  * @example
@@ -41061,6 +41261,8 @@ class World extends SDKController {
41061
41261
  * @remarks
41062
41262
  * 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
41063
41263
  *
41264
+ * @keywords update, modify, change, edit, alter, data, object, state
41265
+ *
41064
41266
  * @category Data Objects
41065
41267
  *
41066
41268
  * @example
@@ -41092,6 +41294,8 @@ class World extends SDKController {
41092
41294
  /**
41093
41295
  * Retrieves details of a world.
41094
41296
  *
41297
+ * @keywords get, fetch, retrieve, details, info, information, world
41298
+ *
41095
41299
  * @example
41096
41300
  * ```ts
41097
41301
  * await world.fetchDetails();
@@ -41112,6 +41316,8 @@ class World extends SDKController {
41112
41316
  /**
41113
41317
  * Update details of a world.
41114
41318
  *
41319
+ * @keywords update, modify, change, edit, world, settings, details
41320
+ *
41115
41321
  * @example
41116
41322
  * ```ts
41117
41323
  * await world.updateDetails({
@@ -41156,6 +41362,8 @@ class World extends SDKController {
41156
41362
  /**
41157
41363
  * Set close world settings
41158
41364
  *
41365
+ * @keywords update, modify, change, edit, world, settings, details, close, closed
41366
+ *
41159
41367
  * @example
41160
41368
  * ```ts
41161
41369
  * await world.updateCloseWorldSettings({
@@ -41195,6 +41403,8 @@ class World extends SDKController {
41195
41403
  /**
41196
41404
  * Retrieve all assets dropped in a world.
41197
41405
  *
41406
+ * @keywords get, fetch, retrieve, list, current, dropped assets
41407
+ *
41198
41408
  * @category Dropped Assets
41199
41409
  *
41200
41410
  * @example
@@ -41225,6 +41435,8 @@ class World extends SDKController {
41225
41435
  /**
41226
41436
  * Retrieve all assets dropped in a world matching uniqueName.
41227
41437
  *
41438
+ * @keywords get, fetch, retrieve, list, current, dropped assets, uniqueName
41439
+ *
41228
41440
  * @category Dropped Assets
41229
41441
  *
41230
41442
  * @example
@@ -41259,6 +41471,8 @@ class World extends SDKController {
41259
41471
  /**
41260
41472
  * Retrieve all assets dropped in a world matching sceneDropId.
41261
41473
  *
41474
+ * @keywords get, fetch, retrieve, list, current, dropped assets, sceneDropId
41475
+ *
41262
41476
  * @category Dropped Assets
41263
41477
  *
41264
41478
  * @example
@@ -41299,6 +41513,8 @@ class World extends SDKController {
41299
41513
  /**
41300
41514
  * Update multiple custom text dropped assets with a single style while preserving text for specified dropped assets only.
41301
41515
  *
41516
+ * @keywords update, modify, change, edit, dropped assets, custom text, style, text
41517
+ *
41302
41518
  * @category Dropped Assets
41303
41519
  *
41304
41520
  * @example
@@ -41330,6 +41546,8 @@ class World extends SDKController {
41330
41546
  /**
41331
41547
  * Retrieve all landmark zone assets dropped in a world.
41332
41548
  *
41549
+ * @keywords get, fetch, retrieve, list, landmark, zones, dropped assets
41550
+ *
41333
41551
  * @category Dropped Assets
41334
41552
  *
41335
41553
  * @example
@@ -41401,6 +41619,8 @@ class World extends SDKController {
41401
41619
  /**
41402
41620
  * Fetch a list of all scene drop ids and dropped assets in a world
41403
41621
  *
41622
+ * @keywords get, fetch, retrieve, list, scenes
41623
+ *
41404
41624
  * @category Scenes
41405
41625
  *
41406
41626
  * @example
@@ -41442,6 +41662,8 @@ class World extends SDKController {
41442
41662
  /**
41443
41663
  * Drops a scene in a world and returns sceneDropId.
41444
41664
  *
41665
+ * @keywords drop, add, place, scene
41666
+ *
41445
41667
  * @category Scenes
41446
41668
  *
41447
41669
  * @example
@@ -41476,6 +41698,8 @@ class World extends SDKController {
41476
41698
  /**
41477
41699
  * Replace the current scene of a world.
41478
41700
  *
41701
+ * @keywords replace, change, scene
41702
+ *
41479
41703
  * @category Scenes
41480
41704
  *
41481
41705
  * @example
@@ -41506,6 +41730,8 @@ class World extends SDKController {
41506
41730
  /**
41507
41731
  * Get all particles available
41508
41732
  *
41733
+ * @keywords get, fetch, retrieve, list, particles
41734
+ *
41509
41735
  * @category Particles
41510
41736
  *
41511
41737
  * @example
@@ -41529,6 +41755,8 @@ class World extends SDKController {
41529
41755
  /**
41530
41756
  * Trigger a particle effect at a position in the world
41531
41757
  *
41758
+ * @keywords trigger, start, play, particle, effect
41759
+ *
41532
41760
  * @category Particles
41533
41761
  *
41534
41762
  * @example
@@ -41565,6 +41793,8 @@ class World extends SDKController {
41565
41793
  * Add an activity to a world
41566
41794
  * excludeFromNotification is an array of visitorIds to exclude from the notification
41567
41795
  *
41796
+ * @keywords start, trigger, activity
41797
+ *
41568
41798
  * @example
41569
41799
  * ```ts
41570
41800
  * await world.triggerActivity({ type: "GAME_ON", assetId: "abc123" });
@@ -41587,6 +41817,8 @@ class World extends SDKController {
41587
41817
  /**
41588
41818
  * Display a message via a toast to all visitors currently in a world.
41589
41819
  *
41820
+ * @keywords send, display, show, toast, message, notification
41821
+ *
41590
41822
  * @example
41591
41823
  * ```ts
41592
41824
  * await world.fireToast({
@@ -41620,6 +41852,8 @@ class World extends SDKController {
41620
41852
  * @remarks
41621
41853
  * 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
41622
41854
  *
41855
+ * @keywords increment, increase, add, count, data, object, state
41856
+ *
41623
41857
  * @category Data Objects
41624
41858
  *
41625
41859
  * @example
@@ -41645,6 +41879,8 @@ class World extends SDKController {
41645
41879
  /**
41646
41880
  * Retrieve all webhooks in a world.
41647
41881
  *
41882
+ * @keywords get, fetch, retrieve, list, current, webhooks
41883
+ *
41648
41884
  * @category Webhooks
41649
41885
  *
41650
41886
  * @example
@@ -41668,6 +41904,8 @@ class World extends SDKController {
41668
41904
  /**
41669
41905
  * Retrieve world analytics by day, week, month, quarter, or year
41670
41906
  *
41907
+ * @keywords get, fetch, retrieve, analytics, stats, statistics, data, metrics
41908
+ *
41671
41909
  * @category Analytics
41672
41910
  *
41673
41911
  * @example
@@ -41711,7 +41949,7 @@ class World extends SDKController {
41711
41949
  }
41712
41950
  _World_droppedAssetsMap = new WeakMap();
41713
41951
 
41714
- var _User_adminWorldsMap, _User_assetsMap, _User_scenesMap, _User_worldsMap;
41952
+ var _User_userInventoryItems, _User_adminWorldsMap, _User_assetsMap, _User_scenesMap, _User_worldsMap;
41715
41953
  /* ============================================================================
41716
41954
  AI RULES for code assistants
41717
41955
 
@@ -41756,6 +41994,7 @@ AI RULES for code assistants
41756
41994
  class User extends SDKController {
41757
41995
  constructor(topia, options = { profileId: null, credentials: {} }) {
41758
41996
  super(topia, Object.assign({ profileId: options === null || options === void 0 ? void 0 : options.profileId }, options.credentials));
41997
+ _User_userInventoryItems.set(this, void 0);
41759
41998
  _User_adminWorldsMap.set(this, void 0);
41760
41999
  _User_assetsMap.set(this, void 0);
41761
42000
  _User_scenesMap.set(this, void 0);
@@ -41767,6 +42006,7 @@ class User extends SDKController {
41767
42006
  __classPrivateFieldSet(this, _User_assetsMap, {}, "f");
41768
42007
  __classPrivateFieldSet(this, _User_scenesMap, {}, "f");
41769
42008
  __classPrivateFieldSet(this, _User_worldsMap, {}, "f");
42009
+ __classPrivateFieldSet(this, _User_userInventoryItems, [], "f");
41770
42010
  }
41771
42011
  get adminWorlds() {
41772
42012
  return __classPrivateFieldGet(this, _User_adminWorldsMap, "f");
@@ -41783,6 +42023,8 @@ class User extends SDKController {
41783
42023
  /*
41784
42024
  * Verify user has valid interactive credentials
41785
42025
  *
42026
+ * @keywords check, verify, validate, credentials, authentication, authorization, interactive
42027
+ *
41786
42028
  * @example
41787
42029
  * ```ts
41788
42030
  * await user.checkInteractiveCredentials();
@@ -41804,6 +42046,8 @@ class User extends SDKController {
41804
42046
  /**
41805
42047
  * Returns all avatars owned by User
41806
42048
  *
42049
+ * @keywords get, fetch, retrieve, list, avatars, characters
42050
+ *
41807
42051
  * @category Avatars
41808
42052
  *
41809
42053
  * @example
@@ -41827,6 +42071,8 @@ class User extends SDKController {
41827
42071
  /**
41828
42072
  * Add a new avatar
41829
42073
  *
42074
+ * @keywords add, create, upload, avatar, character
42075
+ *
41830
42076
  * @category Avatars
41831
42077
  *
41832
42078
  * @example
@@ -41909,6 +42155,8 @@ class User extends SDKController {
41909
42155
  /**
41910
42156
  * Update avatar and sprite sheet records and upload files to existing sprite sheet and avatar storage buckets
41911
42157
  *
42158
+ * @keywords update, modify, change, edit, avatar, character
42159
+ *
41912
42160
  * @category Avatars
41913
42161
  *
41914
42162
  * @example
@@ -41991,6 +42239,8 @@ class User extends SDKController {
41991
42239
  /**
41992
42240
  * Update avatar and sprite sheet records and upload files to existing sprite sheet and avatar storage buckets
41993
42241
  *
42242
+ * @keywords delete, remove, erase, destroy, eliminate, avatar
42243
+ *
41994
42244
  * @category Avatars
41995
42245
  *
41996
42246
  * @example
@@ -42012,6 +42262,8 @@ class User extends SDKController {
42012
42262
  /**
42013
42263
  * Returns all assets owned by User when an email address is provided.
42014
42264
  *
42265
+ * @keywords get, fetch, retrieve, list, user assets, objects
42266
+ *
42015
42267
  * @category Assets
42016
42268
  *
42017
42269
  * @example
@@ -42042,6 +42294,8 @@ class User extends SDKController {
42042
42294
  /**
42043
42295
  * Returns all platform assets.
42044
42296
  *
42297
+ * @keywords get, fetch, retrieve, list, platform assets, objects
42298
+ *
42045
42299
  * @category Assets
42046
42300
  *
42047
42301
  * @example
@@ -42065,6 +42319,8 @@ class User extends SDKController {
42065
42319
  /**
42066
42320
  * Returns all scenes owned by User.
42067
42321
  *
42322
+ * @keywords get, fetch, retrieve, list, user scenes
42323
+ *
42068
42324
  * @category Scenes
42069
42325
  *
42070
42326
  * @example
@@ -42095,6 +42351,8 @@ class User extends SDKController {
42095
42351
  /**
42096
42352
  * Retrieves all worlds owned by user with matching API Key, creates a new World object for each, and creates new map of Worlds accessible via user.worlds.
42097
42353
  *
42354
+ * @keywords get, fetch, retrieve, list, user worlds
42355
+ *
42098
42356
  * @category Worlds
42099
42357
  *
42100
42358
  * @example
@@ -42130,6 +42388,8 @@ class User extends SDKController {
42130
42388
  /**
42131
42389
  * Retrieves all worlds a user with matching API Key is an admin in, creates a new World object for each, and creates new map of Worlds accessible via user.adminWorlds.
42132
42390
  *
42391
+ * @keywords get, fetch, retrieve, list, admin worlds, user worlds
42392
+ *
42133
42393
  * @category Worlds
42134
42394
  *
42135
42395
  * @example
@@ -42159,6 +42419,8 @@ class User extends SDKController {
42159
42419
  /**
42160
42420
  * Retrieves ids of all dropped assets in all worlds with a matching interactivePublicKey.
42161
42421
  *
42422
+ * @keywords get, fetch, retrieve, list, interactive worlds, public key
42423
+ *
42162
42424
  * @category Dropped Assets
42163
42425
  *
42164
42426
  * @example
@@ -42183,6 +42445,8 @@ class User extends SDKController {
42183
42445
  /**
42184
42446
  * Send an email
42185
42447
  *
42448
+ * @keywords send, email, message, notify
42449
+ *
42186
42450
  * @example
42187
42451
  * ```ts
42188
42452
  * const html = `<p><b>Hello World!</b></p><p>This email is being sent from via SDK.</p>`
@@ -42206,6 +42470,8 @@ class User extends SDKController {
42206
42470
  /**
42207
42471
  * Get expressions
42208
42472
  *
42473
+ * @keywords get, fetch, retrieve, list, expressions, emotes
42474
+ *
42209
42475
  * @category Expressions
42210
42476
  *
42211
42477
  * @example
@@ -42232,6 +42498,8 @@ class User extends SDKController {
42232
42498
  /**
42233
42499
  * Retrieves the data object for a user.
42234
42500
  *
42501
+ * @keywords get, fetch, retrieve, load, data, object, state
42502
+ *
42235
42503
  * @category Data Objects
42236
42504
  *
42237
42505
  * @example
@@ -42261,6 +42529,8 @@ class User extends SDKController {
42261
42529
  /**
42262
42530
  * Sets the data object for a user.
42263
42531
  *
42532
+ * @keywords set, assign, store, save, data, object, state
42533
+ *
42264
42534
  * @remarks
42265
42535
  * 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
42266
42536
  *
@@ -42295,6 +42565,8 @@ class User extends SDKController {
42295
42565
  /**
42296
42566
  * Updates the data object for a user.
42297
42567
  *
42568
+ * @keywords update, modify, change, edit, alter, data, object, state
42569
+ *
42298
42570
  * @remarks
42299
42571
  * 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
42300
42572
  *
@@ -42327,6 +42599,8 @@ class User extends SDKController {
42327
42599
  /**
42328
42600
  * Increments a specific value in the data object for a user by the amount specified. Must have valid interactive credentials from a visitor in the world.
42329
42601
  *
42602
+ * @keywords increment, increase, add, count, data, object, state
42603
+ *
42330
42604
  * @remarks
42331
42605
  * 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
42332
42606
  *
@@ -42347,9 +42621,46 @@ class User extends SDKController {
42347
42621
  }
42348
42622
  });
42349
42623
  }
42624
+ /**
42625
+ * Retrieves all inventory items owned by this visitor and app's key.
42626
+ *
42627
+ * @keywords get, fetch, retrieve, list, inventory, items, visitor
42628
+ *
42629
+ * @example
42630
+ * ```ts
42631
+ * const items = await visitor.fetchInventoryItems();
42632
+ * ```
42633
+ *
42634
+ * @returns {Promise<void>} Returns an array of InventoryItem objects.
42635
+ */
42636
+ fetchInventoryItems() {
42637
+ return __awaiter(this, void 0, void 0, function* () {
42638
+ try {
42639
+ if (!this.profileId)
42640
+ throw "This method requires the use of a profileId";
42641
+ const response = yield this.topiaPublicApi().get(`/user/${this.profileId}/get-user-inventory-items`, this.requestOptions);
42642
+ // TODO: Replace 'object' with InventoryItem and instantiate InventoryItem objects if needed
42643
+ const tempItems = [];
42644
+ for (const index in response.data) {
42645
+ tempItems.push(new UserInventoryItem(this.topia, response.data[index].id, {
42646
+ attributes: response.data[index],
42647
+ credentials: this.credentials,
42648
+ }));
42649
+ }
42650
+ __classPrivateFieldSet(this, _User_userInventoryItems, tempItems, "f");
42651
+ }
42652
+ catch (error) {
42653
+ throw this.errorHandler({ error, sdkMethod: "Visitor.fetchInventoryItems" });
42654
+ }
42655
+ });
42656
+ }
42657
+ get inventoryItems() {
42658
+ return __classPrivateFieldGet(this, _User_userInventoryItems, "f");
42659
+ }
42350
42660
  }
42351
- _User_adminWorldsMap = new WeakMap(), _User_assetsMap = new WeakMap(), _User_scenesMap = new WeakMap(), _User_worldsMap = new WeakMap();
42661
+ _User_userInventoryItems = new WeakMap(), _User_adminWorldsMap = new WeakMap(), _User_assetsMap = new WeakMap(), _User_scenesMap = new WeakMap(), _User_worldsMap = new WeakMap();
42352
42662
 
42663
+ var _Visitor_visitorInventoryItems;
42353
42664
  /* ============================================================================
42354
42665
  AI RULES for code assistants
42355
42666
 
@@ -42391,13 +42702,17 @@ AI RULES for code assistants
42391
42702
  class Visitor extends User {
42392
42703
  constructor(topia, id, urlSlug, options = { attributes: {}, credentials: {} }) {
42393
42704
  super(topia, { credentials: Object.assign({ urlSlug }, options.credentials) });
42705
+ _Visitor_visitorInventoryItems.set(this, void 0);
42394
42706
  Object.assign(this, options.attributes);
42395
42707
  this.id = id;
42396
42708
  this.urlSlug = urlSlug;
42709
+ __classPrivateFieldSet(this, _Visitor_visitorInventoryItems, [], "f");
42397
42710
  }
42398
42711
  /**
42399
42712
  * Get a single visitor from a world
42400
42713
  *
42714
+ * @keywords get, fetch, retrieve, load, visitor, details
42715
+ *
42401
42716
  * @example
42402
42717
  * ```ts
42403
42718
  * await visitor.fetchVisitor();
@@ -42431,6 +42746,8 @@ class Visitor extends User {
42431
42746
  /**
42432
42747
  * Teleport or walk a visitor currently in a world to a single set of coordinates.
42433
42748
  *
42749
+ * @keywords move, teleport, walk, position, coordinate, location, place
42750
+ *
42434
42751
  * @example
42435
42752
  * ```ts
42436
42753
  * await visitor.moveVisitor({
@@ -42463,6 +42780,8 @@ class Visitor extends User {
42463
42780
  /**
42464
42781
  * Display a message via a toast to a visitor currently in a world.
42465
42782
  *
42783
+ * @keywords toast, message, notification, alert, display, show, popup
42784
+ *
42466
42785
  * @example
42467
42786
  * ```ts
42468
42787
  * await visitor.fireToast({
@@ -42493,6 +42812,8 @@ class Visitor extends User {
42493
42812
  /**
42494
42813
  * Open an iframe in a drawer or modal for a visitor currently in a world.
42495
42814
  *
42815
+ * @keywords open, iframe, drawer, modal, link, url, website, web page
42816
+ *
42496
42817
  * @category iframes
42497
42818
  *
42498
42819
  * @example
@@ -42527,6 +42848,8 @@ class Visitor extends User {
42527
42848
  /**
42528
42849
  * Reload an iframe for a visitor currently in a world.
42529
42850
  *
42851
+ * @keywords reload, iframe, drawer, modal, link, url, website, web page
42852
+ *
42530
42853
  * @category iframes
42531
42854
  *
42532
42855
  * @example
@@ -42550,6 +42873,8 @@ class Visitor extends User {
42550
42873
  /**
42551
42874
  * Close an iframe for a visitor currently in a world.
42552
42875
  *
42876
+ * @keywords close, iframe, drawer, modal
42877
+ *
42553
42878
  * @category iframes
42554
42879
  *
42555
42880
  * @example
@@ -42573,6 +42898,8 @@ class Visitor extends User {
42573
42898
  /**
42574
42899
  * Mute and turn video off for a visitor currently in a world.
42575
42900
  *
42901
+ * @keywords mute, video, av, turn off, disable
42902
+ *
42576
42903
  * @example
42577
42904
  * ```ts
42578
42905
  * await visitor.turnAVOff();
@@ -42594,6 +42921,8 @@ class Visitor extends User {
42594
42921
  /**
42595
42922
  * Get expressions
42596
42923
  *
42924
+ * @keywords get, fetch, retrieve, list, expressions, emotes
42925
+ *
42597
42926
  * @category Expressions
42598
42927
  *
42599
42928
  * @example
@@ -42619,6 +42948,8 @@ class Visitor extends User {
42619
42948
  /**
42620
42949
  * Grant expression to a visitor by id or name.
42621
42950
  *
42951
+ * @keywords grant, give, add, expression, emote
42952
+ *
42622
42953
  * @category Expressions
42623
42954
  *
42624
42955
  * @example
@@ -42650,6 +42981,8 @@ class Visitor extends User {
42650
42981
  /**
42651
42982
  * Get all particles available
42652
42983
  *
42984
+ * @keywords get, fetch, retrieve, list, particles, effects
42985
+ *
42653
42986
  * @category Particle Effects
42654
42987
  *
42655
42988
  * @example
@@ -42673,6 +43006,8 @@ class Visitor extends User {
42673
43006
  /**
42674
43007
  * Trigger a particle effect on a visitor
42675
43008
  *
43009
+ * @keywords trigger, particle, effect, spawn, start, play
43010
+ *
42676
43011
  * @category Particle Effects
42677
43012
  *
42678
43013
  * @example
@@ -42706,6 +43041,8 @@ class Visitor extends User {
42706
43041
  /**
42707
43042
  * Retrieves the data object for a visitor.
42708
43043
  *
43044
+ * @keywords get, fetch, retrieve, load, data, object, state
43045
+ *
42709
43046
  * @category Data Objects
42710
43047
  *
42711
43048
  * @example
@@ -42735,6 +43072,8 @@ class Visitor extends User {
42735
43072
  /**
42736
43073
  * Sets the data object for a visitor.
42737
43074
  *
43075
+ * @keywords set, assign, store, save, data, object, state
43076
+ *
42738
43077
  * @remarks
42739
43078
  * 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
42740
43079
  *
@@ -42770,6 +43109,8 @@ class Visitor extends User {
42770
43109
  * @remarks
42771
43110
  * 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
42772
43111
  *
43112
+ * @keywords update, modify, change, edit, alter, data, object, state
43113
+ *
42773
43114
  * @category Data Objects
42774
43115
  *
42775
43116
  * @example
@@ -42800,6 +43141,8 @@ class Visitor extends User {
42800
43141
  * @remarks
42801
43142
  * 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
42802
43143
  *
43144
+ * @keywords increment, increase, add, count, data, object, state
43145
+ *
42803
43146
  * @category Data Objects
42804
43147
  *
42805
43148
  * @example
@@ -42824,6 +43167,8 @@ class Visitor extends User {
42824
43167
  /**
42825
43168
  * Update analytics for a given public key. Must have valid interactive credentials from a visitor in the world.
42826
43169
  *
43170
+ * @keywords update, modify, change, edit, analytics, analytic, stats, statistics, data
43171
+ *
42827
43172
  * @example
42828
43173
  * ```ts
42829
43174
  * await visitor.updatePublicKeyAnalytics([{ analyticName: "joins", profileId, uniqueKey: profileId, urlSlug }]);
@@ -42846,6 +43191,8 @@ class Visitor extends User {
42846
43191
  /**
42847
43192
  * Setup signal to visitor
42848
43193
  *
43194
+ * @keywords signal, webrtc, answer, connect, p2p
43195
+ *
42849
43196
  * @example
42850
43197
  * ```ts
42851
43198
  * await visitor.sendSignalToVisitor(iceServers);
@@ -42866,7 +43213,138 @@ class Visitor extends User {
42866
43213
  }
42867
43214
  });
42868
43215
  }
42869
- }
43216
+ /**
43217
+ * Retrieves all inventory items owned by this visitor and app's key.
43218
+ *
43219
+ * @keywords get, fetch, retrieve, list, inventory, items, visitor
43220
+ *
43221
+ * @example
43222
+ * ```ts
43223
+ * const items = await visitor.fetchInventoryItems();
43224
+ * ```
43225
+ *
43226
+ * @returns {Promise<void>} Returns an array of InventoryItem objects.
43227
+ */
43228
+ fetchInventoryItem(item) {
43229
+ return __awaiter(this, void 0, void 0, function* () {
43230
+ try {
43231
+ const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors/${this.id}/get-visitor-inventory-items/${item.id}`, this.requestOptions);
43232
+ return new UserInventoryItem(this.topia, response.data.id, {
43233
+ attributes: response.data,
43234
+ credentials: this.credentials,
43235
+ });
43236
+ }
43237
+ catch (error) {
43238
+ throw this.errorHandler({ error, sdkMethod: "Visitor.fetchInventoryItems" });
43239
+ }
43240
+ });
43241
+ }
43242
+ /**
43243
+ * Retrieves all inventory items owned by this visitor and app's key.
43244
+ *
43245
+ * @keywords get, fetch, retrieve, list, inventory, items, visitor
43246
+ *
43247
+ * @example
43248
+ * ```ts
43249
+ * const items = await visitor.fetchInventoryItems();
43250
+ * ```
43251
+ *
43252
+ * @returns {Promise<void>} Returns an array of InventoryItem objects.
43253
+ */
43254
+ fetchInventoryItems() {
43255
+ return __awaiter(this, void 0, void 0, function* () {
43256
+ try {
43257
+ const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors/${this.id}/get-visitor-inventory-items`, this.requestOptions);
43258
+ // TODO: Replace 'object' with InventoryItem and instantiate InventoryItem objects if needed
43259
+ const tempItems = [];
43260
+ for (const index in response.data) {
43261
+ tempItems.push(new UserInventoryItem(this.topia, response.data[index].id, {
43262
+ attributes: response.data[index],
43263
+ credentials: this.credentials,
43264
+ }));
43265
+ }
43266
+ __classPrivateFieldSet(this, _Visitor_visitorInventoryItems, tempItems, "f");
43267
+ }
43268
+ catch (error) {
43269
+ throw this.errorHandler({ error, sdkMethod: "Visitor.fetchInventoryItems" });
43270
+ }
43271
+ });
43272
+ }
43273
+ get inventoryItems() {
43274
+ return __classPrivateFieldGet(this, _Visitor_visitorInventoryItems, "f");
43275
+ }
43276
+ /**
43277
+ * Grants an inventory item to this visitor.
43278
+ *
43279
+ * @param itemId The ID of the inventory item to grant.
43280
+ * @param quantity The quantity to grant (default 1).
43281
+ *
43282
+ * @example
43283
+ * ```ts
43284
+ * await visitor.grantInventoryItem("item-id-123", 2);
43285
+ * ```
43286
+ *
43287
+ * @returns {Promise<UserInventoryItem>} Returns the updated inventory or a response object.
43288
+ */
43289
+ grantInventoryItem(item, quantity = 1) {
43290
+ var _a;
43291
+ return __awaiter(this, void 0, void 0, function* () {
43292
+ // Error if item already exists in #visitorInventoryItems
43293
+ const exists = (_a = __classPrivateFieldGet(this, _Visitor_visitorInventoryItems, "f")) === null || _a === void 0 ? void 0 : _a.some((visitorItem) => visitorItem.id === item.id);
43294
+ if (exists) {
43295
+ throw new Error(`Inventory item with id '${item.id}' already exists in visitorInventoryItems.`);
43296
+ }
43297
+ try {
43298
+ const response = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/grant-visitor-inventory-item`, { itemId: item.id, quantity }, this.requestOptions);
43299
+ const userInventoryItemFactory = new UserInventoryItemFactory(this.topia);
43300
+ const { inventoryItem, user_id, quantity: newQuantity } = response.data;
43301
+ return userInventoryItemFactory.create(inventoryItem, user_id, newQuantity, {
43302
+ attributes: response.data,
43303
+ credentials: this.credentials,
43304
+ });
43305
+ }
43306
+ catch (error) {
43307
+ throw this.errorHandler({ error, sdkMethod: "Visitor.grantInventoryItem" });
43308
+ }
43309
+ });
43310
+ }
43311
+ /**
43312
+ * Modifies the quantity of an inventory item in this visitor's inventory.
43313
+ *
43314
+ * @param itemId The ID of the inventory item to modify.
43315
+ * @param quantity The new quantity to set.
43316
+ *
43317
+ * @example
43318
+ * ```ts
43319
+ * await visitor.modifyInventoryItemQuantity("item-id-123", 5);
43320
+ * ```
43321
+ *
43322
+ * @returns {Promise<UserInventoryItem>} Returns the updated inventory or a response object.
43323
+ */
43324
+ modifyInventoryItemQuantity(item, quantity) {
43325
+ var _a;
43326
+ return __awaiter(this, void 0, void 0, function* () {
43327
+ // Check for existence in #visitorInventoryItems
43328
+ const found = (_a = __classPrivateFieldGet(this, _Visitor_visitorInventoryItems, "f")) === null || _a === void 0 ? void 0 : _a.some((visitorItem) => visitorItem.id === item.userItemId);
43329
+ if (!found) {
43330
+ throw new Error(`Inventory item with id '${item.userItemId}' does not exist in visitorInventoryItems.`);
43331
+ }
43332
+ try {
43333
+ const response = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/update-visitor-inventory-item-quantity`, { userItemId: item.id, itemId: item.item_id, quantity }, this.requestOptions);
43334
+ const userInventoryItemFactory = new UserInventoryItemFactory(this.topia);
43335
+ const { inventoryItem, user_id, quantity: newQuantity } = response.data;
43336
+ return userInventoryItemFactory.create(inventoryItem, user_id, newQuantity, {
43337
+ attributes: response.data,
43338
+ credentials: this.credentials,
43339
+ });
43340
+ }
43341
+ catch (error) {
43342
+ throw this.errorHandler({ error, sdkMethod: "Visitor.modifyInventoryItemQuantity" });
43343
+ }
43344
+ });
43345
+ }
43346
+ }
43347
+ _Visitor_visitorInventoryItems = new WeakMap();
42870
43348
 
42871
43349
  /**
42872
43350
  * Create an instance of WebRTCConnector class with optional session credentials.
@@ -42995,6 +43473,8 @@ class WorldActivity extends SDKController {
42995
43473
  /**
42996
43474
  * Retrieve all visitors currently in a world.
42997
43475
  *
43476
+ * @keywords get, fetch, retrieve, list, current, visitors, users, players
43477
+ *
42998
43478
  * @category Visitors
42999
43479
  *
43000
43480
  * @example
@@ -43018,6 +43498,8 @@ class WorldActivity extends SDKController {
43018
43498
  /**
43019
43499
  * Retrieve all visitors currently in a Landmark Zone.
43020
43500
  *
43501
+ * @keywords get, fetch, retrieve, list, zone, area, landmark, visitors, users
43502
+ *
43021
43503
  * @category Visitors
43022
43504
  *
43023
43505
  * @example
@@ -43047,6 +43529,8 @@ class WorldActivity extends SDKController {
43047
43529
  * Optionally refetch visitors, teleport or walk visitors to new location,
43048
43530
  * and scatter visitors by any number so that they don't all move to the exact same location.
43049
43531
  *
43532
+ * @keywords move, teleport, position, coordinate, visitors, users, relocate
43533
+ *
43050
43534
  * @category Visitors
43051
43535
  *
43052
43536
  * @example
@@ -43083,6 +43567,8 @@ class WorldActivity extends SDKController {
43083
43567
  /**
43084
43568
  * Teleport or walk a list of visitors currently in a world to various coordinates.
43085
43569
  *
43570
+ * @keywords move, teleport, position, coordinate, visitor, user, relocate
43571
+ *
43086
43572
  * @category Visitors
43087
43573
  *
43088
43574
  * @example
@@ -43150,9 +43636,19 @@ _WorldActivity_visitorsMap = new WeakMap();
43150
43636
  Do NOT instantiate factories in controllers. Do NOT invent methods.
43151
43637
  ============================================================================ */
43152
43638
  /**
43639
+ * Factory for creating Asset instances. Use this factory to create or upload assets in the Topia platform.
43640
+ *
43641
+ * @remarks
43642
+ * This factory should be instantiated once per application and reused across your codebase.
43643
+ *
43644
+ * @keywords asset, factory, create, upload, instantiate, topia
43645
+ *
43153
43646
  * @example
43154
43647
  * ```ts
43155
- * const Asset = new AssetFactory(myTopiaInstance);
43648
+ * // In your initialization file (e.g., utils/topiaInit.ts)
43649
+ * import { Topia, AssetFactory } from "@rtsdk/topia";
43650
+ * const topia = new Topia({ config });
43651
+ * export const Asset = new AssetFactory(topia);
43156
43652
  * ```
43157
43653
  */
43158
43654
  class AssetFactory extends SDKController {
@@ -43160,11 +43656,32 @@ class AssetFactory extends SDKController {
43160
43656
  super(topia);
43161
43657
  }
43162
43658
  /**
43163
- * Instantiate a new instance of Asset class.
43659
+ * Instantiate a new instance of Asset class with the specified asset id.
43660
+ *
43661
+ * @remarks
43662
+ * This method creates a new Asset controller instance that can be used to interact with an existing asset.
43663
+ * It does not create a new asset in the database.
43664
+ *
43665
+ * @keywords create, instantiate, asset, initialize, get, instance
43164
43666
  *
43165
43667
  * @example
43166
- * ```
43167
- * const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
43668
+ * ```ts
43669
+ * // Import the pre-initialized factory from your app's initialization file
43670
+ * import { Asset } from "utils/topiaInit.ts";
43671
+ *
43672
+ * // Create an Asset instance with credentials
43673
+ * const assetInstance = await Asset.create(assetId, {
43674
+ * credentials: {
43675
+ * interactiveNonce,
43676
+ * interactivePublicKey,
43677
+ * assetId,
43678
+ * urlSlug,
43679
+ * visitorId
43680
+ * }
43681
+ * });
43682
+ *
43683
+ * // Use the instance to interact with the asset
43684
+ * await assetInstance.fetchAssetById();
43168
43685
  * ```
43169
43686
  *
43170
43687
  * @returns {Asset} Returns a new Asset object with the asset id.
@@ -43173,22 +43690,37 @@ class AssetFactory extends SDKController {
43173
43690
  return new Asset(this.topia, id, options);
43174
43691
  }
43175
43692
  /**
43176
- * Upload a new Asset and return a new instance of Asset class.
43693
+ * Upload a new Asset to the Topia platform and return a new instance of Asset class.
43694
+ *
43695
+ * @remarks
43696
+ * This method both creates a new asset in the database and returns an Asset controller instance.
43697
+ * A valid API key with appropriate permissions is required.
43698
+ *
43699
+ * @keywords upload, create, new, asset, add, store
43177
43700
  *
43178
43701
  * @example
43179
- * ```
43702
+ * ```ts
43703
+ * // Import the pre-initialized factory from your app's initialization file
43704
+ * import { Asset } from "utils/topiaInit.ts";
43705
+ *
43706
+ * // Prepare the asset payload
43180
43707
  * const assetPayload = {
43181
- * assetName: "exampleAssetName"
43182
- * bottomLayerURL: "https://example.bottomLayerURL"
43708
+ * assetName: "My Decorative Asset",
43709
+ * bottomLayerURL: "https://example.com/bottom-layer.png",
43183
43710
  * creatorTags: { "decorations": true },
43184
43711
  * tagJson: "[{"label":"decorations","value":"decorations"}]",
43185
43712
  * isPublic: true,
43186
- * topLayerURL: "https://example.topLayerURL"
43187
- * }
43713
+ * topLayerURL: "https://example.com/top-layer.png"
43714
+ * };
43715
+ *
43716
+ * // Upload the asset using your API key
43188
43717
  * const asset = await Asset.upload(assetPayload, apiKey);
43718
+ *
43719
+ * // Access the new asset's properties
43720
+ * console.log(asset.id);
43189
43721
  * ```
43190
43722
  *
43191
- * @returns {AssetType} Returns a new Asset object with the asset details.
43723
+ * @returns {Asset} Returns a new Asset object with the asset details.
43192
43724
  */
43193
43725
  upload(assetPayload, apiKey) {
43194
43726
  return __awaiter(this, void 0, void 0, function* () {
@@ -43238,9 +43770,19 @@ class AssetFactory extends SDKController {
43238
43770
  Do NOT instantiate factories in controllers. Do NOT invent methods.
43239
43771
  ============================================================================ */
43240
43772
  /**
43773
+ * Factory for creating and retrieving DroppedAsset instances. Use this factory to work with assets that have been placed in a Topia world.
43774
+ *
43775
+ * @remarks
43776
+ * This factory should be instantiated once per application and reused across your codebase.
43777
+ *
43778
+ * @keywords dropped asset, factory, create, get, retrieve, instantiate, topia
43779
+ *
43241
43780
  * @example
43242
43781
  * ```ts
43243
- * const DroppedAsset = new DroppedAssetFactory(myTopiaInstance);
43782
+ * // In your initialization file (e.g., utils/topiaInit.ts)
43783
+ * import { Topia, DroppedAssetFactory } from "@rtsdk/topia";
43784
+ * const topia = new Topia({ config });
43785
+ * export const DroppedAsset = new DroppedAssetFactory(topia);
43244
43786
  * ```
43245
43787
  */
43246
43788
  class DroppedAssetFactory extends SDKController {
@@ -43248,27 +43790,77 @@ class DroppedAssetFactory extends SDKController {
43248
43790
  super(topia);
43249
43791
  }
43250
43792
  /**
43251
- * Instantiate a new instance of DroppedAsset class.
43793
+ * Instantiate a new instance of DroppedAsset class for an existing dropped asset in a world.
43794
+ *
43795
+ * @remarks
43796
+ * This method creates a controller instance for an existing dropped asset but does not fetch its properties.
43797
+ * Use this when you need a lightweight instance and will fetch properties separately if needed or when you already have the properties.
43798
+ *
43799
+ * @keywords create, instantiate, dropped asset, initialize, instance
43252
43800
  *
43253
43801
  * @example
43254
- * ```
43255
- * const droppedAssetInstance = await DroppedAsset.create(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
43802
+ * ```ts
43803
+ * // Import the pre-initialized factory from your app's initialization file
43804
+ * import { DroppedAsset } from "utils/topiaInit.ts";
43805
+ *
43806
+ * // Create a DroppedAsset instance with credentials
43807
+ * const droppedAssetInstance = DroppedAsset.create(
43808
+ * assetId,
43809
+ * urlSlug,
43810
+ * {
43811
+ * credentials: {
43812
+ * interactiveNonce,
43813
+ * interactivePublicKey,
43814
+ * assetId,
43815
+ * urlSlug,
43816
+ * visitorId
43817
+ * }
43818
+ * }
43819
+ * );
43820
+ *
43821
+ * // Later fetch its properties if needed
43822
+ * await droppedAssetInstance.fetchDroppedAssetById();
43256
43823
  * ```
43257
43824
  *
43258
- * @returns {DroppedAsset} Returns a new DroppedAsset object.
43825
+ * @returns {DroppedAsset} Returns a new DroppedAsset object without fetching its properties.
43259
43826
  */
43260
43827
  create(id, urlSlug, options) {
43261
43828
  return new DroppedAsset(this.topia, id, urlSlug, options);
43262
43829
  }
43263
43830
  /**
43264
- * Instantiate a new instance of DroppedAsset class and retrieve all properties.
43831
+ * Instantiate a new instance of DroppedAsset class and automatically fetch all its properties.
43832
+ *
43833
+ * @remarks
43834
+ * This method creates a controller instance and immediately fetches all properties of the dropped asset.
43835
+ * It's a convenience method that combines creating an instance and calling fetchDroppedAssetById().
43836
+ *
43837
+ * @keywords get, fetch, retrieve, dropped asset, load, instance
43265
43838
  *
43266
43839
  * @example
43267
- * ```
43268
- * const droppedAssetInstance = await DroppedAsset.get(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
43840
+ * ```ts
43841
+ * // Import the pre-initialized factory from your app's initialization file
43842
+ * import { DroppedAsset } from "utils/topiaInit.ts";
43843
+ *
43844
+ * // Get a fully populated DroppedAsset instance
43845
+ * const droppedAssetInstance = await DroppedAsset.get(
43846
+ * assetId,
43847
+ * urlSlug,
43848
+ * {
43849
+ * credentials: {
43850
+ * interactiveNonce,
43851
+ * interactivePublicKey,
43852
+ * assetId,
43853
+ * urlSlug,
43854
+ * visitorId
43855
+ * }
43856
+ * }
43857
+ * );
43858
+ *
43859
+ * // The properties are already loaded, so you can use them immediately
43860
+ * console.log(droppedAssetInstance.position);
43269
43861
  * ```
43270
43862
  *
43271
- * @returns {Promise<DroppedAsset>} Returns a new DroppedAsset object with all properties.
43863
+ * @returns {Promise<DroppedAsset>} Returns a new DroppedAsset object with all properties already fetched.
43272
43864
  */
43273
43865
  get(id, urlSlug, options) {
43274
43866
  return __awaiter(this, void 0, void 0, function* () {
@@ -43278,17 +43870,36 @@ class DroppedAssetFactory extends SDKController {
43278
43870
  });
43279
43871
  }
43280
43872
  /**
43281
- * Searches dropped assets within a world by a provide `uniqueName`. If a single match is found, a new instance of DroppedAsset class is returned all properties.
43873
+ * Searches for and retrieves a dropped asset by its unique name within a world.
43282
43874
  *
43283
43875
  * @remarks
43284
- * This method leverages the handleGetDroppedAssetByUniqueName endpoint in the Public API and assumes there is exactly one dropped asset with matching uniqueName for the given urlSlug.
43876
+ * This method leverages the handleGetDroppedAssetByUniqueName endpoint in the Public API and assumes there is exactly one dropped asset with the matching uniqueName for the given urlSlug.
43877
+ * Use this when you need to find a dropped asset by its uniqueName rather than its id.
43878
+ *
43879
+ * @keywords find, search, unique name, retrieve, locate, lookup, dropped asset
43285
43880
  *
43286
43881
  * @example
43287
- * ```
43288
- * const droppedAssetInstance = await DroppedAsset.getWithUniqueName("exampleUniqueName", urlSlug, interactiveSecret, credentials);
43882
+ * ```ts
43883
+ * // Import the pre-initialized factory from your app's initialization file
43884
+ * import { DroppedAsset } from "utils/topiaInit.ts";
43885
+ *
43886
+ * // Find and retrieve a dropped asset by its unique name
43887
+ * const droppedAssetInstance = await DroppedAsset.getWithUniqueName(
43888
+ * "banner-sign-northeast",
43889
+ * "my-world-slug",
43890
+ * "your-interactive-secret",
43891
+ * {
43892
+ * apiKey: "your-api-key",
43893
+ * interactivePublicKey: "your-public-key",
43894
+ * // other credentials...
43895
+ * }
43896
+ * );
43897
+ *
43898
+ * // The properties are already loaded, so you can use them immediately
43899
+ * console.log(droppedAssetInstance.position);
43289
43900
  * ```
43290
43901
  *
43291
- * @returns {Promise<DroppedAsset>} Returns a new DroppedAsset object with all properties.
43902
+ * @returns {Promise<DroppedAsset>} Returns a new DroppedAsset object with all properties already fetched.
43292
43903
  */
43293
43904
  getWithUniqueName(uniqueName, urlSlug, interactiveSecret, credentials) {
43294
43905
  return __awaiter(this, void 0, void 0, function* () {
@@ -43315,23 +43926,59 @@ class DroppedAssetFactory extends SDKController {
43315
43926
  /**
43316
43927
  * Drops an asset in a world and returns a new instance of DroppedAsset class with all properties.
43317
43928
  *
43929
+ * @remarks
43930
+ * This method places an existing Asset into a world at specified coordinates, effectively "dropping" it into the environment.
43931
+ * You can customize various properties of the dropped asset during placement, such as scale, position, interactive settings, and visual layers.
43932
+ *
43933
+ * @keywords drop, place, add, create, position, asset, deploy
43934
+ *
43318
43935
  * @example
43319
- * ```
43320
- * const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
43321
- * const droppedAssetInstance = await DroppedAsset.get(assetInstance, {
43322
- assetScale: 1.5,
43323
- flipped: true,
43324
- layer0: "",
43325
- layer1: "https://pathtoimage.png",
43326
- interactivePublicKey,
43327
- isInteractive: true,
43328
- position: { x: 0, y: 0 },
43329
- uniqueName: "exampleUniqueName",
43330
- urlSlug,
43331
- });
43936
+ * ```ts
43937
+ * // Import the pre-initialized factories from your app's initialization file
43938
+ * import { Asset, DroppedAsset } from "utils/topiaInit.ts";
43939
+ *
43940
+ * // First get an asset instance
43941
+ * const assetInstance = Asset.create("asset-id-123", {
43942
+ * credentials: {
43943
+ * interactiveNonce,
43944
+ * interactivePublicKey,
43945
+ * assetId,
43946
+ * urlSlug,
43947
+ * visitorId
43948
+ * }
43949
+ * });
43950
+ *
43951
+ * // Then drop (place) the asset in a world
43952
+ * const droppedAssetInstance = await DroppedAsset.drop(
43953
+ * assetInstance,
43954
+ * {
43955
+ * // Basic positioning and appearance
43956
+ * position: { x: 250, y: 350 },
43957
+ * assetScale: 1.5,
43958
+ * flipped: true,
43959
+ * uniqueName: "welcome-sign",
43960
+ * urlSlug: "my-world-slug",
43961
+ *
43962
+ * // For web images (optional)
43963
+ * layer0: "https://example.com/background.png",
43964
+ * layer1: "https://example.com/foreground.png",
43965
+ *
43966
+ * // For interactive assets (optional)
43967
+ * interactivePublicKey: "your-public-key",
43968
+ * isInteractive: true,
43969
+ *
43970
+ * // For clickable assets (optional)
43971
+ * clickType: "link",
43972
+ * clickableLink: "https://example.com",
43973
+ * clickableLinkTitle: "Visit Example"
43974
+ * }
43975
+ * );
43976
+ *
43977
+ * // The dropped asset is ready to use
43978
+ * console.log(droppedAssetInstance.id);
43332
43979
  * ```
43333
43980
  *
43334
- * @returns {Promise<DroppedAsset>} Returns a new DroppedAsset object with all properties.
43981
+ * @returns {Promise<DroppedAsset>} Returns a new DroppedAsset object representing the placed asset in the world.
43335
43982
  */
43336
43983
  drop(asset, { assetScale = 1, clickType, clickableDisplayTextDescription, clickableDisplayTextHeadline, clickableLink, clickableLinkTitle, flipped, interactivePublicKey, isInteractive, isForceLinkInIframe, isOpenLinkInDrawer, isTextTopLayer = false, layer0, layer1, position: { x, y }, sceneDropId, text, textColor, textFontFamily, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }) {
43337
43984
  return __awaiter(this, void 0, void 0, function* () {
@@ -43416,9 +44063,20 @@ class DroppedAssetFactory extends SDKController {
43416
44063
  Do NOT instantiate factories in controllers. Do NOT invent methods.
43417
44064
  ============================================================================ */
43418
44065
  /**
44066
+ * Factory for creating Ecosystem instances. Use this factory to work with ecosystem-wide data and operations.
44067
+ *
44068
+ * @remarks
44069
+ * This factory should be instantiated once per application and reused across your codebase.
44070
+ * The Ecosystem controller provides methods to interact with data shared across multiple worlds.
44071
+ *
44072
+ * @keywords ecosystem, factory, create, multi-world, global, shared data, platform
44073
+ *
43419
44074
  * @example
43420
44075
  * ```ts
43421
- * const Ecosystem = new EcosystemFactory(myTopiaInstance);
44076
+ * // In your initialization file (e.g., utils/topiaInit.ts)
44077
+ * import { Topia, EcosystemFactory } from "@rtsdk/topia";
44078
+ * const topia = new Topia({ config });
44079
+ * export const Ecosystem = new EcosystemFactory(topia);
43422
44080
  * ```
43423
44081
  */
43424
44082
  class EcosystemFactory {
@@ -43426,14 +44084,36 @@ class EcosystemFactory {
43426
44084
  this.topia = topia;
43427
44085
  }
43428
44086
  /**
43429
- * Instantiate a new instance of Ecosystem class.
44087
+ * Instantiate a new instance of Ecosystem class for interacting with ecosystem-wide data.
44088
+ *
44089
+ * @remarks
44090
+ * This method creates a controller instance for accessing and managing data that spans multiple worlds.
44091
+ * Use this for cross-world data sharing, global data objects, and ecosystem-wide operations.
44092
+ *
44093
+ * @keywords create, instantiate, ecosystem, initialize, global, shared data, platform
43430
44094
  *
43431
44095
  * @example
43432
- * ```
43433
- * const ecosystemInstance = await Ecosystem.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId }});
44096
+ * ```ts
44097
+ * // Import the pre-initialized factory from your app's initialization file
44098
+ * import { Ecosystem } from "utils/topiaInit.ts";
44099
+ *
44100
+ * // Create an Ecosystem instance with credentials
44101
+ * const ecosystemInstance = Ecosystem.create({
44102
+ * credentials: {
44103
+ * interactiveNonce,
44104
+ * interactivePublicKey,
44105
+ * assetId,
44106
+ * urlSlug,
44107
+ * visitorId
44108
+ * }
44109
+ * });
44110
+ *
44111
+ * // Work with ecosystem-wide data objects
44112
+ * await ecosystemInstance.fetchDataObject("global-leaderboard");
44113
+ * await ecosystemInstance.setDataObject("global-leaderboard", { scores: [...] });
43434
44114
  * ```
43435
44115
  *
43436
- * @returns {Ecosystem} Returns a new Ecosystem object.
44116
+ * @returns {Ecosystem} Returns a new Ecosystem object for interacting with ecosystem-wide data.
43437
44117
  */
43438
44118
  create(options) {
43439
44119
  return new Ecosystem(this.topia, options);
@@ -43470,9 +44150,20 @@ class EcosystemFactory {
43470
44150
  Do NOT instantiate factories in controllers. Do NOT invent methods.
43471
44151
  ============================================================================ */
43472
44152
  /**
44153
+ * Factory for creating Scene instances. Use this factory to work with scenes in the Topia platform.
44154
+ *
44155
+ * @remarks
44156
+ * This factory should be instantiated once per application and reused across your codebase.
44157
+ * Scenes represent the template or blueprint for a world's design and layout.
44158
+ *
44159
+ * @keywords scene, factory, create, template, blueprint, layout, design
44160
+ *
43473
44161
  * @example
43474
44162
  * ```ts
43475
- * const Scene = new SceneFactory(myTopiaInstance);
44163
+ * // In your initialization file (e.g., utils/topiaInit.ts)
44164
+ * import { Topia, SceneFactory } from "@rtsdk/topia";
44165
+ * const topia = new Topia({ config });
44166
+ * export const Scene = new SceneFactory(topia);
43476
44167
  * ```
43477
44168
  */
43478
44169
  class SceneFactory {
@@ -43481,14 +44172,38 @@ class SceneFactory {
43481
44172
  this.create;
43482
44173
  }
43483
44174
  /**
43484
- * Instantiate a new instance of Scene class.
44175
+ * Instantiate a new instance of Scene class for an existing scene in the platform.
44176
+ *
44177
+ * @remarks
44178
+ * This method creates a controller instance for working with a scene but does not fetch its properties.
44179
+ * Use this when you need to interact with a specific scene by its id.
44180
+ *
44181
+ * @keywords create, instantiate, scene, initialize, instance, template
43485
44182
  *
43486
44183
  * @example
43487
- * ```
43488
- * const sceneInstance = await Scene.create(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
44184
+ * ```ts
44185
+ * // Import the pre-initialized factory from your app's initialization file
44186
+ * import { Scene } from "utils/topiaInit.ts";
44187
+ *
44188
+ * // Create a Scene instance with credentials
44189
+ * const sceneInstance = Scene.create(
44190
+ * "scene-id-123",
44191
+ * {
44192
+ * credentials: {
44193
+ * interactiveNonce,
44194
+ * interactivePublicKey,
44195
+ * assetId,
44196
+ * urlSlug,
44197
+ * visitorId
44198
+ * }
44199
+ * }
44200
+ * );
44201
+ *
44202
+ * // Fetch scene details if needed
44203
+ * await sceneInstance.fetchSceneById();
43489
44204
  * ```
43490
44205
  *
43491
- * @returns {Scene} Returns a new Scene object.
44206
+ * @returns {Scene} Returns a new Scene object for interacting with the specified scene.
43492
44207
  */
43493
44208
  create(id, options) {
43494
44209
  return new Scene(this.topia, id, options);
@@ -43543,9 +44258,20 @@ class SceneFactory {
43543
44258
  Do NOT instantiate factories in controllers. Do NOT invent methods.
43544
44259
  ============================================================================ */
43545
44260
  /**
44261
+ * Factory for creating User instances. Use this factory to work with user data in the Topia platform.
44262
+ *
44263
+ * @remarks
44264
+ * This factory should be instantiated once per application and reused across your codebase.
44265
+ * The User controller allows you to interact with user-specific information and operations.
44266
+ *
44267
+ * @keywords user, factory, create, account, profile, member, visitor
44268
+ *
43546
44269
  * @example
43547
44270
  * ```ts
43548
- * const User = new UserFactory(myTopiaInstance);
44271
+ * // In your initialization file (e.g., utils/topiaInit.ts)
44272
+ * import { Topia, UserFactory } from "@rtsdk/topia";
44273
+ * const topia = new Topia({ config });
44274
+ * export const User = new UserFactory(topia);
43549
44275
  * ```
43550
44276
  */
43551
44277
  class UserFactory {
@@ -43553,14 +44279,36 @@ class UserFactory {
43553
44279
  this.topia = topia;
43554
44280
  }
43555
44281
  /**
43556
- * Instantiate a new instance of User class.
44282
+ * Instantiate a new instance of User class for working with user data.
44283
+ *
44284
+ * @remarks
44285
+ * This method creates a controller instance for interacting with user-specific operations.
44286
+ * The User controller doesn't require an id since it represents the currently authenticated user.
44287
+ *
44288
+ * @keywords create, instantiate, user, initialize, account, profile, member
43557
44289
  *
43558
44290
  * @example
43559
- * ```
43560
- * const userInstance = await User.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
44291
+ * ```ts
44292
+ * // Import the pre-initialized factory from your app's initialization file
44293
+ * import { User } from "utils/topiaInit.ts";
44294
+ *
44295
+ * // Create a User instance with credentials
44296
+ * const userInstance = User.create({
44297
+ * credentials: {
44298
+ * interactiveNonce,
44299
+ * interactivePublicKey,
44300
+ * assetId,
44301
+ * urlSlug,
44302
+ * visitorId
44303
+ * }
44304
+ * });
44305
+ *
44306
+ * // Use methods on the user instance
44307
+ * await userInstance.checkInteractiveCredentials();
44308
+ * const avatars = await userInstance.fetchAvatars();
43561
44309
  * ```
43562
44310
  *
43563
- * @returns {User} Returns a new User object.
44311
+ * @returns {User} Returns a new User object for interacting with user data.
43564
44312
  */
43565
44313
  create(options) {
43566
44314
  return new User(this.topia, options);
@@ -43598,9 +44346,20 @@ class UserFactory {
43598
44346
  Do NOT instantiate factories in controllers. Do NOT invent methods.
43599
44347
  ============================================================================ */
43600
44348
  /**
44349
+ * Factory for creating Visitor instances. Use this factory to work with visitors in Topia worlds.
44350
+ *
44351
+ * @remarks
44352
+ * This factory should be instantiated once per application and reused across your codebase.
44353
+ * The Visitor controller represents a specific visitor/avatar instance in a world.
44354
+ *
44355
+ * @keywords visitor, factory, create, get, avatar, user, participant
44356
+ *
43601
44357
  * @example
43602
44358
  * ```ts
43603
- * const Visitor = new VisitorFactory(myTopiaInstance);
44359
+ * // In your initialization file (e.g., utils/topiaInit.ts)
44360
+ * import { Topia, VisitorFactory } from "@rtsdk/topia";
44361
+ * const topia = new Topia({ config });
44362
+ * export const Visitor = new VisitorFactory(topia);
43604
44363
  * ```
43605
44364
  */
43606
44365
  class VisitorFactory {
@@ -43608,27 +44367,78 @@ class VisitorFactory {
43608
44367
  this.topia = topia;
43609
44368
  }
43610
44369
  /**
43611
- * Instantiate a new instance of Visitor class.
44370
+ * Instantiate a new instance of Visitor class for an existing visitor in a world.
44371
+ *
44372
+ * @remarks
44373
+ * This method creates a controller instance for a visitor but does not fetch its properties.
44374
+ * Use this when you need a lightweight instance and will fetch properties separately or when you already have the properties.
44375
+ *
44376
+ * @keywords create, instantiate, visitor, initialize, avatar, instance
43612
44377
  *
43613
44378
  * @example
43614
- * ```
43615
- * const visitorInstance = await Visitor.create(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
44379
+ * ```ts
44380
+ * // Import the pre-initialized factory from your app's initialization file
44381
+ * import { Visitor } from "utils/topiaInit.ts";
44382
+ *
44383
+ * // Create a Visitor instance with credentials
44384
+ * const visitorInstance = Visitor.create(
44385
+ * 12345, // visitor id
44386
+ * "my-world-slug",
44387
+ * {
44388
+ * credentials: {
44389
+ * interactiveNonce,
44390
+ * interactivePublicKey,
44391
+ * assetId,
44392
+ * urlSlug,
44393
+ * visitorId
44394
+ * }
44395
+ * }
44396
+ * );
44397
+ *
44398
+ * // Later fetch visitor properties if needed
44399
+ * await visitorInstance.fetchVisitor();
43616
44400
  * ```
43617
44401
  *
43618
- * @returns {Visitor} Returns a new Visitor object.
44402
+ * @returns {Visitor} Returns a new Visitor object without fetching its properties.
43619
44403
  */
43620
44404
  create(id, urlSlug, options) {
43621
44405
  return new Visitor(this.topia, id, urlSlug, options);
43622
44406
  }
43623
44407
  /**
43624
- * Instantiate a new instance of Visitor class and retrieve all properties.
44408
+ * Instantiate a new instance of Visitor class and automatically fetch all its properties.
44409
+ *
44410
+ * @remarks
44411
+ * This method creates a controller instance and immediately fetches all properties of the visitor.
44412
+ * It's a convenience method that combines creating an instance and calling fetchVisitor().
44413
+ *
44414
+ * @keywords get, fetch, retrieve, visitor, load, avatar, instance
43625
44415
  *
43626
44416
  * @example
43627
- * ```
43628
- * const visitorInstance = await Visitor.get(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
44417
+ * ```ts
44418
+ * // Import the pre-initialized factory from your app's initialization file
44419
+ * import { Visitor } from "utils/topiaInit.ts";
44420
+ *
44421
+ * // Get a fully populated Visitor instance
44422
+ * const visitorInstance = await Visitor.get(
44423
+ * 12345, // visitor id
44424
+ * "my-world-slug",
44425
+ * {
44426
+ * credentials: {
44427
+ * interactiveNonce,
44428
+ * interactivePublicKey,
44429
+ * assetId,
44430
+ * urlSlug,
44431
+ * visitorId
44432
+ * }
44433
+ * }
44434
+ * );
44435
+ *
44436
+ * // The properties are already loaded, so you can use them immediately
44437
+ * console.log(visitorInstance.username);
44438
+ * console.log(visitorInstance.position);
43629
44439
  * ```
43630
44440
  *
43631
- * @returns {Promise<Visitor>} Returns a new Visitor object with all properties.
44441
+ * @returns {Promise<Visitor>} Returns a new Visitor object with all properties already fetched.
43632
44442
  */
43633
44443
  get(id, urlSlug, options) {
43634
44444
  return __awaiter(this, void 0, void 0, function* () {
@@ -43640,9 +44450,20 @@ class VisitorFactory {
43640
44450
  }
43641
44451
 
43642
44452
  /**
44453
+ * Factory for creating WebRTCConnector instances. Use this factory to establish WebRTC connections for audio/video in Topia worlds.
44454
+ *
44455
+ * @remarks
44456
+ * This factory should be instantiated once per application and reused across your codebase.
44457
+ * The WebRTCConnector provides methods to set up and manage real-time audio/video communication.
44458
+ *
44459
+ * @keywords webrtc, factory, create, audio, video, communication, real-time, conference
44460
+ *
43643
44461
  * @example
43644
44462
  * ```ts
43645
- * const WebRTCConnector = new WebRTCConnectorFactory(myTopiaInstance);
44463
+ * // In your initialization file (e.g., utils/topiaInit.ts)
44464
+ * import { Topia, WebRTCConnectorFactory } from "@rtsdk/topia";
44465
+ * const topia = new Topia({ config });
44466
+ * export const WebRTCConnector = new WebRTCConnectorFactory(topia);
43646
44467
  * ```
43647
44468
  */
43648
44469
  class WebRTCConnectorFactory {
@@ -43650,14 +44471,41 @@ class WebRTCConnectorFactory {
43650
44471
  this.topia = topia;
43651
44472
  }
43652
44473
  /**
43653
- * Instantiate a new instance of WebRTCConnector class.
44474
+ * Instantiate a new instance of WebRTCConnector class for managing audio/video communication.
44475
+ *
44476
+ * @remarks
44477
+ * This method creates a controller instance for establishing and managing WebRTC connections.
44478
+ * Use this for implementing real-time audio/video communication features in Topia worlds.
44479
+ *
44480
+ * @keywords create, instantiate, webrtc, initialize, audio, video, communication, stream
43654
44481
  *
43655
44482
  * @example
43656
- * ```
43657
- * const webRTCInstance = await WebRTCConnector.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId }, twilioConfig: {} });
44483
+ * ```ts
44484
+ * // Import the pre-initialized factory from your app's initialization file
44485
+ * import { WebRTCConnector } from "utils/topiaInit.ts";
44486
+ *
44487
+ * // Create a WebRTCConnector instance with credentials and configuration
44488
+ * const webRTCInstance = WebRTCConnector.create(
44489
+ * "my-world-slug",
44490
+ * {
44491
+ * credentials: {
44492
+ * interactiveNonce,
44493
+ * interactivePublicKey,
44494
+ * assetId,
44495
+ * urlSlug,
44496
+ * visitorId
44497
+ * },
44498
+ * twilioConfig: {
44499
+ * // Twilio configuration options
44500
+ * }
44501
+ * }
44502
+ * );
44503
+ *
44504
+ * // Use the instance to establish connections
44505
+ * await webRTCInstance.connect();
43658
44506
  * ```
43659
44507
  *
43660
- * @returns {WebRTCConnector} Returns a new WebRTCConnector object.
44508
+ * @returns {WebRTCConnector} Returns a new WebRTCConnector object for managing audio/video communication.
43661
44509
  */
43662
44510
  create(urlSlug, options) {
43663
44511
  return new WebRTCConnector(this.topia, urlSlug, options);
@@ -43695,9 +44543,20 @@ class WebRTCConnectorFactory {
43695
44543
  Do NOT instantiate factories in controllers. Do NOT invent methods.
43696
44544
  ============================================================================ */
43697
44545
  /**
44546
+ * Factory for creating WorldActivity instances. Use this factory to monitor and manage visitor activity in Topia worlds.
44547
+ *
44548
+ * @remarks
44549
+ * This factory should be instantiated once per application and reused across your codebase.
44550
+ * The WorldActivity controller provides methods to interact with real-time visitor activities and movements.
44551
+ *
44552
+ * @keywords world activity, factory, create, visitors, movement, tracking, presence, real-time
44553
+ *
43698
44554
  * @example
43699
44555
  * ```ts
43700
- * const WorldActivity = new WorldActivityFactory(myTopiaInstance);
44556
+ * // In your initialization file (e.g., utils/topiaInit.ts)
44557
+ * import { Topia, WorldActivityFactory } from "@rtsdk/topia";
44558
+ * const topia = new Topia({ config });
44559
+ * export const WorldActivity = new WorldActivityFactory(topia);
43701
44560
  * ```
43702
44561
  */
43703
44562
  class WorldActivityFactory {
@@ -43705,14 +44564,42 @@ class WorldActivityFactory {
43705
44564
  this.topia = topia;
43706
44565
  }
43707
44566
  /**
43708
- * Instantiate a new instance of WorldActivity class.
44567
+ * Instantiate a new instance of WorldActivity class for monitoring visitor activity in a specific world.
44568
+ *
44569
+ * @remarks
44570
+ * This method creates a controller instance for tracking and managing visitor activity in a world.
44571
+ * Use this to fetch current visitors, move visitors, or monitor specific zones within a world.
44572
+ *
44573
+ * @keywords create, instantiate, world activity, initialize, visitors, tracking, presence
43709
44574
  *
43710
44575
  * @example
43711
- * ```
43712
- * const worldActivityInstance = await WorldActivity.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
44576
+ * ```ts
44577
+ * // Import the pre-initialized factory from your app's initialization file
44578
+ * import { WorldActivity } from "utils/topiaInit.ts";
44579
+ *
44580
+ * // Create a WorldActivity instance with credentials
44581
+ * const worldActivityInstance = WorldActivity.create(
44582
+ * "my-world-slug",
44583
+ * {
44584
+ * credentials: {
44585
+ * interactiveNonce,
44586
+ * interactivePublicKey,
44587
+ * assetId,
44588
+ * urlSlug,
44589
+ * visitorId
44590
+ * }
44591
+ * }
44592
+ * );
44593
+ *
44594
+ * // Get current visitors in the world
44595
+ * const visitors = await worldActivityInstance.currentVisitors();
44596
+ * console.log(`There are ${visitors.length} visitors in the world`);
44597
+ *
44598
+ * // Check visitors in a specific zone
44599
+ * const zoneVisitors = await worldActivityInstance.fetchVisitorsInZone("stage-area");
43713
44600
  * ```
43714
44601
  *
43715
- * @returns {WorldActivity} Returns a new WorldActivity object.
44602
+ * @returns {WorldActivity} Returns a new WorldActivity object for tracking and managing visitor activity.
43716
44603
  */
43717
44604
  create(urlSlug, options) {
43718
44605
  return new WorldActivity(this.topia, urlSlug, options);
@@ -43750,9 +44637,20 @@ class WorldActivityFactory {
43750
44637
  Do NOT instantiate factories in controllers. Do NOT invent methods.
43751
44638
  ============================================================================ */
43752
44639
  /**
44640
+ * Factory for creating World instances. Use this factory to interact with Topia worlds.
44641
+ *
44642
+ * @remarks
44643
+ * This factory should be instantiated once per application and reused across your codebase.
44644
+ * The World controller provides methods to manage world settings, retrieve world details, and perform world-level operations.
44645
+ *
44646
+ * @keywords world, factory, create, virtual space, environment, room, topia
44647
+ *
43753
44648
  * @example
43754
44649
  * ```ts
43755
- * const World = new WorldFactory(myTopiaInstance);
44650
+ * // In your initialization file (e.g., utils/topiaInit.ts)
44651
+ * import { Topia, WorldFactory } from "@rtsdk/topia";
44652
+ * const topia = new Topia({ config });
44653
+ * export const World = new WorldFactory(topia);
43756
44654
  * ```
43757
44655
  */
43758
44656
  class WorldFactory extends SDKController {
@@ -43760,27 +44658,75 @@ class WorldFactory extends SDKController {
43760
44658
  super(topia);
43761
44659
  }
43762
44660
  /**
43763
- * Instantiate a new instance of World class.
44661
+ * Instantiate a new instance of World class for interacting with a specific Topia world.
44662
+ *
44663
+ * @remarks
44664
+ * This method creates a controller instance for a world identified by its URL slug.
44665
+ * The world controller can be used to fetch details, update world settings, and perform other world-level operations.
44666
+ *
44667
+ * @keywords create, instantiate, world, initialize, virtual space, environment, room
43764
44668
  *
43765
44669
  * @example
43766
- * ```
43767
- * const worldInstance = await World.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
44670
+ * ```ts
44671
+ * // Import the pre-initialized factory from your app's initialization file
44672
+ * import { World } from "utils/topiaInit.ts";
44673
+ *
44674
+ * // Create a World instance with credentials
44675
+ * const worldInstance = World.create(
44676
+ * "my-world-slug",
44677
+ * {
44678
+ * credentials: {
44679
+ * interactiveNonce,
44680
+ * interactivePublicKey,
44681
+ * assetId,
44682
+ * urlSlug,
44683
+ * visitorId
44684
+ * }
44685
+ * }
44686
+ * );
44687
+ *
44688
+ * // Fetch world details
44689
+ * await worldInstance.fetchDetails();
44690
+ * console.log(worldInstance.name);
43768
44691
  * ```
43769
44692
  *
43770
- * @returns {World} Returns a new World object.
44693
+ * @returns {World} Returns a new World object for interacting with the specified world.
43771
44694
  */
43772
44695
  create(urlSlug, options) {
43773
44696
  return new World(this.topia, urlSlug, options);
43774
44697
  }
43775
44698
  /**
43776
- * Deletes an array of Dropped Assets from within a world and returns success: true
44699
+ * Deletes multiple dropped assets from a world in a single operation.
44700
+ *
44701
+ * @remarks
44702
+ * This method provides a convenient way to delete multiple dropped assets at once rather than
44703
+ * deleting them one by one. Requires appropriate permissions via interactive credentials.
44704
+ *
44705
+ * @keywords delete, remove, dropped assets, multiple, batch, cleanup, world
43777
44706
  *
43778
44707
  * @example
43779
- * ```
43780
- * await World.deleteDroppedAssets(urlSlug, ["exampleDroppedAssetId1", "exampleDroppedAssetId2"], interactiveSecret, credentials);
44708
+ * ```ts
44709
+ * // Import the pre-initialized factory from your app's initialization file
44710
+ * import { World } from "utils/topiaInit.ts";
44711
+ *
44712
+ * // Delete multiple dropped assets from a world
44713
+ * const result = await World.deleteDroppedAssets(
44714
+ * "my-world-slug",
44715
+ * ["asset-id-123", "asset-id-456", "asset-id-789"],
44716
+ * "your-interactive-secret",
44717
+ * {
44718
+ * apiKey: "your-api-key",
44719
+ * interactivePublicKey: "your-public-key",
44720
+ * visitorId: 12345
44721
+ * }
44722
+ * );
44723
+ *
44724
+ * if (result.success) {
44725
+ * console.log("Assets successfully deleted");
44726
+ * }
43781
44727
  * ```
43782
44728
  *
43783
- * @returns {Promise<{ success: boolean }>} Returns `{ success: true }` or an error.
44729
+ * @returns {Promise<{ success: boolean }>} Returns `{ success: true }` if all assets were deleted successfully.
43784
44730
  */
43785
44731
  deleteDroppedAssets(urlSlug, droppedAssetIds, interactiveSecret, credentials) {
43786
44732
  return __awaiter(this, void 0, void 0, function* () {
@@ -43811,6 +44757,57 @@ class WorldFactory extends SDKController {
43811
44757
  }
43812
44758
  }
43813
44759
 
44760
+ // import { UserInventoryItem } from "controllers";
44761
+ /**
44762
+ * Factory for creating UserInventoryItem instances. Use this factory to work with user-owned inventory items.
44763
+ *
44764
+ * @remarks
44765
+ * This factory should be instantiated once per application and reused across your codebase.
44766
+ *
44767
+ * @example
44768
+ * ```ts
44769
+ * // In your initialization file (e.g., utils/topiaInit.ts)
44770
+ * import { Topia, UserInventoryItemFactory } from "@rtsdk/topia";
44771
+ * const topia = new Topia({ config });
44772
+ * export const UserInventoryItem = new UserInventoryItemFactory(topia);
44773
+ * ```
44774
+ */
44775
+ class UserInventoryItemFactory {
44776
+ constructor(topia) {
44777
+ this.topia = topia;
44778
+ }
44779
+ /**
44780
+ * Instantiate a new instance of UserInventoryItem class for a user's owned item.
44781
+ *
44782
+ * @example
44783
+ * ```ts
44784
+ * const userItem = UserInventoryItem.create("item-id-123", 42, 5, { credentials });
44785
+ * ```
44786
+ *
44787
+ * @returns {UserInventoryItem} Returns a new UserInventoryItem object for interacting with the specified item.
44788
+ */
44789
+ create(inventoryItemId, userId, quantity, options) {
44790
+ return new UserInventoryItem(this.topia, inventoryItemId, options);
44791
+ }
44792
+ /**
44793
+ * Retrieve a user inventory item and all its properties.
44794
+ *
44795
+ * @example
44796
+ * ```ts
44797
+ * const userItem = await UserInventoryItem.get("item-id-123", 42, { credentials });
44798
+ * ```
44799
+ *
44800
+ * @returns {Promise<UserInventoryItem>} Returns a new UserInventoryItem object with all properties.
44801
+ */
44802
+ get(inventoryItemId, options) {
44803
+ return __awaiter(this, void 0, void 0, function* () {
44804
+ const userItem = new UserInventoryItem(this.topia, inventoryItemId, options);
44805
+ yield userItem.fetchUserInventoryItemById();
44806
+ return userItem;
44807
+ });
44808
+ }
44809
+ }
44810
+
43814
44811
  Error.stackTraceLimit = 20;
43815
44812
  process.on("unhandledRejection", (reason) => {
43816
44813
  if (reason && reason.data) {