@rtsdk/topia 0.17.6 → 0.17.8

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
@@ -39708,14 +39708,44 @@ class SDKController {
39708
39708
  }
39709
39709
  }
39710
39710
 
39711
+ /* ============================================================================
39712
+ AI RULES for code assistants
39713
+
39714
+ CONTEXT
39715
+ - "Controllers" expose operations on domain objects (e.g., Asset).
39716
+ - Consumers obtain controller instances via factory methods (e.g., AssetFactory.get).
39717
+
39718
+ DO
39719
+ - Expect consumers to import a pre-instantiated factory from their app (e.g., utils/topiaInit.ts).
39720
+ - Use ONLY the methods defined & documented in this file's types/TSDoc.
39721
+
39722
+ DO NOT
39723
+ - Do NOT suggest creating Topia clients or factories inside controllers.
39724
+ - Do NOT suggest non-existent methods: getById, fetch, find
39725
+ - Do NOT mutate controller shape or return ad-hoc fields.
39726
+
39727
+ CANONICAL USAGE (consumer app):
39728
+ // utils/topiaInit.ts
39729
+ import { Topia, AssetFactory } from "@rtsdk/topia";
39730
+ const topia = new Topia({ config });
39731
+ export const Asset = new AssetFactory(topia);
39732
+
39733
+ // controllers/myController.ts (consumer app)
39734
+ import { Asset } from "utils/topiaInit.ts";
39735
+ const asset = await Asset.create(assetId, { credentials });
39736
+ await asset.fetchAssetById();
39737
+
39738
+ ============================================================================ */
39711
39739
  /**
39712
39740
  * Create an instance of Asset class with a given asset id and optional attributes and session credentials.
39713
39741
  *
39714
39742
  * @example
39715
39743
  * ```ts
39716
- * const asset = await new Asset(topia, "id", {
39744
+ * import { Asset } from "utils/topiaInit.ts";
39745
+ *
39746
+ * const asset = await Asset.create(assetId, {
39717
39747
  * attributes: { assetName: "My Asset", isPublic: false },
39718
- * credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
39748
+ * credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", visitorId: 1, urlSlug: "exampleUrlSlug" }
39719
39749
  * });
39720
39750
  * ```
39721
39751
  */
@@ -39780,6 +39810,7 @@ class Asset extends SDKController {
39780
39810
  try {
39781
39811
  const response = yield this.topiaPublicApi().put(`/assets/${this.id}`, params, this.requestOptions);
39782
39812
  Object.assign(this, response.data);
39813
+ return response.data;
39783
39814
  }
39784
39815
  catch (error) {
39785
39816
  throw this.errorHandler({ error, params, sdkMethod: "Asset.updateAsset" });
@@ -39844,14 +39875,43 @@ const scatterVisitors = (original, scatterBy) => {
39844
39875
  };
39845
39876
 
39846
39877
  var _DroppedAsset_updateDroppedAsset;
39878
+ /* ============================================================================
39879
+ AI RULES for code assistants
39880
+
39881
+ CONTEXT
39882
+ - "Controllers" expose operations on domain objects (e.g., DroppedAsset).
39883
+ - Consumers obtain controller instances via factory methods (e.g., DroppedAssetFactory.get).
39884
+
39885
+ DO
39886
+ - Expect consumers to import a pre-instantiated factory from their app (e.g., utils/topiaInit.ts).
39887
+ - Use ONLY the methods defined & documented in this file's types/TSDoc.
39888
+
39889
+ DO NOT
39890
+ - Do NOT suggest creating Topia clients or factories inside controllers.
39891
+ - Do NOT suggest non-existent methods: getById, fetch, find
39892
+ - Do NOT mutate controller shape or return ad-hoc fields.
39893
+
39894
+ CANONICAL USAGE (consumer app):
39895
+ // utils/topiaInit.ts
39896
+ import { Topia, DroppedAssetFactory } from "@rtsdk/topia";
39897
+ const topia = new Topia({ config });
39898
+ export const DroppedAsset = new DroppedAssetFactory(topia);
39899
+
39900
+ // controllers/myController.ts (consumer app)
39901
+ import { DroppedAsset } from "utils/topiaInit.ts";
39902
+ const da = await DroppedAsset.get(droppedAssetId, urlSlug, { credentials });
39903
+ await da.fetchDataObject();
39904
+
39905
+ ============================================================================ */
39847
39906
  /**
39848
39907
  * Create an instance of Dropped Asset class with a given dropped asset id, url slug, and optional attributes and session credentials.
39849
39908
  *
39850
39909
  * @example
39851
39910
  * ```ts
39852
- * const droppedAsset = await new DroppedAsset(topia, "1giFZb0sQ3X27L7uGyQX", "example", {
39853
- * attributes: { text: "My Dropped Asset" },
39854
- * credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
39911
+ * import { DroppedAsset } from "utils/topiaInit.ts";
39912
+ *
39913
+ * const droppedAsset = await DroppedAsset.get(exampleDroppedAssetId, exampleUrlSlug, {
39914
+ * credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", visitorId: 1, urlSlug: "exampleUrlSlug" }
39855
39915
  * });
39856
39916
  * ```
39857
39917
  */
@@ -40613,13 +40673,43 @@ class DroppedAsset extends Asset {
40613
40673
  }
40614
40674
  _DroppedAsset_updateDroppedAsset = new WeakMap();
40615
40675
 
40676
+ /* ============================================================================
40677
+ AI RULES for code assistants
40678
+
40679
+ CONTEXT
40680
+ - "Controllers" expose operations on domain objects (e.g., Ecosystem).
40681
+ - Consumers obtain controller instances via factory methods (e.g., EcosystemFactory.get).
40682
+
40683
+ DO
40684
+ - Expect consumers to import a pre-instantiated factory from their app (e.g., utils/topiaInit.ts).
40685
+ - Use ONLY the methods defined & documented in this file's types/TSDoc.
40686
+
40687
+ DO NOT
40688
+ - Do NOT suggest creating Topia clients or factories inside controllers.
40689
+ - Do NOT suggest non-existent methods: getById, fetch, find
40690
+ - Do NOT mutate controller shape or return ad-hoc fields.
40691
+
40692
+ CANONICAL USAGE (consumer app):
40693
+ // utils/topiaInit.ts
40694
+ import { Topia, Ecosystem } from "@rtsdk/topia";
40695
+ const topia = new Topia({ config });
40696
+ export const Ecosystem = new EcosystemFactory(topia);
40697
+
40698
+ // controllers/myController.ts (consumer app)
40699
+ import { Ecosystem } from "utils/topiaInit.ts";
40700
+ const ecosystem = await Ecosystem.create({ credentials });
40701
+ await ecosystem.fetchDataObject();
40702
+
40703
+ ============================================================================ */
40616
40704
  /**
40617
40705
  * Create an instance of Ecosystem class with optional session credentials
40618
40706
  *
40619
40707
  * @example
40620
40708
  * ```ts
40621
- * const ecosystem =await new Ecosystem(topia, {
40622
- * credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
40709
+ * import { Ecosystem } from "utils/topiaInit.ts";
40710
+ *
40711
+ * const ecosystem = await Ecosystem.create({
40712
+ * credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", visitorId: 1, urlSlug: "exampleUrlSlug" }
40623
40713
  * });
40624
40714
  * ```
40625
40715
  */
@@ -40757,14 +40847,43 @@ class Ecosystem extends SDKController {
40757
40847
  }
40758
40848
  }
40759
40849
 
40850
+ /* ============================================================================
40851
+ AI RULES for code assistants
40852
+
40853
+ CONTEXT
40854
+ - "Controllers" expose operations on domain objects (e.g., Scene).
40855
+ - Consumers obtain controller instances via factory methods (e.g., SceneFactory.get).
40856
+
40857
+ DO
40858
+ - Expect consumers to import a pre-instantiated factory from their app (e.g., utils/topiaInit.ts).
40859
+ - Use ONLY the methods defined & documented in this file's types/TSDoc.
40860
+
40861
+ DO NOT
40862
+ - Do NOT suggest creating Topia clients or factories inside controllers.
40863
+ - Do NOT suggest non-existent methods: getById, fetch, find
40864
+ - Do NOT mutate controller shape or return ad-hoc fields.
40865
+
40866
+ CANONICAL USAGE (consumer app):
40867
+ // utils/topiaInit.ts
40868
+ import { Topia, SceneFactory } from "@rtsdk/topia";
40869
+ const topia = new Topia({ config });
40870
+ export const Scene = new SceneFactory(topia);
40871
+
40872
+ // controllers/myController.ts (consumer app)
40873
+ import { Scene } from "utils/topiaInit.ts";
40874
+ const scene = await Scene.get(sceneId, { credentials });
40875
+
40876
+ ============================================================================ */
40760
40877
  /**
40761
40878
  * Create an instance of Scene class with a given scene id and optional attributes and session credentials.
40762
40879
  *
40763
40880
  * @example
40764
40881
  * ```ts
40765
- * const scene = await new Scene(topia, "sceneId", {
40882
+ * import { Scene } from "utils/topiaInit.ts";
40883
+ *
40884
+ * const scene = await Scene.get(exampleSceneId, {
40766
40885
  * attributes: { name: "My Scene" },
40767
- * credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
40886
+ * credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", visitorId: 1, urlSlug: "exampleUrlSlug" }
40768
40887
  * });
40769
40888
  * ```
40770
40889
  */
@@ -40834,14 +40953,44 @@ class Topia {
40834
40953
  }
40835
40954
 
40836
40955
  var _World_droppedAssetsMap;
40956
+ /* ============================================================================
40957
+ AI RULES for code assistants
40958
+
40959
+ CONTEXT
40960
+ - "Controllers" expose operations on domain objects (e.g., World).
40961
+ - Consumers obtain controller instances via factory methods (e.g., WorldFactory.get).
40962
+
40963
+ DO
40964
+ - Expect consumers to import a pre-instantiated factory from their app (e.g., utils/topiaInit.ts).
40965
+ - Use ONLY the methods defined & documented in this file's types/TSDoc.
40966
+
40967
+ DO NOT
40968
+ - Do NOT suggest creating Topia clients or factories inside controllers.
40969
+ - Do NOT suggest non-existent methods: getById, fetch, find
40970
+ - Do NOT mutate controller shape or return ad-hoc fields.
40971
+
40972
+ CANONICAL USAGE (consumer app):
40973
+ // utils/topiaInit.ts
40974
+ import { Topia, WorldFactory } from "@rtsdk/topia";
40975
+ const topia = new Topia({ config });
40976
+ export const World = new WorldFactory(topia);
40977
+
40978
+ // controllers/myController.ts (consumer app)
40979
+ import { World } from "utils/topiaInit.ts";
40980
+ const world = await World.create(urlSlug, { credentials });
40981
+ await world.fetchDetails();
40982
+
40983
+ ============================================================================ */
40837
40984
  /**
40838
40985
  * Create an instance of World class with a given url slug and optional attributes and session credentials.
40839
40986
  *
40840
40987
  * @example
40841
40988
  * ```ts
40842
- * const world = await new World(topia, "exampleWorld", {
40989
+ * import { World } from "utils/topiaInit.ts";
40990
+ *
40991
+ * const world = await World.create(exampleUrlSlug, {
40843
40992
  * attributes: { name: "Example World" },
40844
- * credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
40993
+ * credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", visitorId: 1, urlSlug: "exampleUrlSlug" }
40845
40994
  * });
40846
40995
  * ```
40847
40996
  */
@@ -41563,14 +41712,44 @@ class World extends SDKController {
41563
41712
  _World_droppedAssetsMap = new WeakMap();
41564
41713
 
41565
41714
  var _User_adminWorldsMap, _User_assetsMap, _User_scenesMap, _User_worldsMap;
41715
+ /* ============================================================================
41716
+ AI RULES for code assistants
41717
+
41718
+ CONTEXT
41719
+ - "Controllers" expose operations on domain objects (e.g., User).
41720
+ - Consumers obtain controller instances via factory methods (e.g., UserFactory.get).
41721
+
41722
+ DO
41723
+ - Expect consumers to import a pre-instantiated factory from their app (e.g., utils/topiaInit.ts).
41724
+ - Use ONLY the methods defined & documented in this file's types/TSDoc.
41725
+
41726
+ DO NOT
41727
+ - Do NOT suggest creating Topia clients or factories inside controllers.
41728
+ - Do NOT suggest non-existent methods: getById, fetch, find
41729
+ - Do NOT mutate controller shape or return ad-hoc fields.
41730
+
41731
+ CANONICAL USAGE (consumer app):
41732
+ // utils/topiaInit.ts
41733
+ import { Topia, UserFactory } from "@rtsdk/topia";
41734
+ const topia = new Topia({ config });
41735
+ export const User = new UserFactory(topia);
41736
+
41737
+ // controllers/myController.ts (consumer app)
41738
+ import { User } from "utils/topiaInit.ts";
41739
+ const user = await User.create({ credentials });
41740
+ await user.fetchDataObject();
41741
+
41742
+ ============================================================================ */
41566
41743
  /**
41567
41744
  * Create an instance of User class with optional session credentials.
41568
41745
  *
41569
41746
  * @example
41570
41747
  * ```ts
41571
- * const user = await new User(topia, {
41572
- * profileId: 1,
41573
- * credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
41748
+ * import { User } from "utils/topiaInit.ts";
41749
+ *
41750
+ * const user = await User.create({
41751
+ * profileId: "exampleProfileId",
41752
+ * credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", profileId: "exampleProfileId", visitorId: 1, urlSlug: "exampleUrlSlug" }
41574
41753
  * });
41575
41754
  * ```
41576
41755
  */
@@ -42171,12 +42350,42 @@ class User extends SDKController {
42171
42350
  }
42172
42351
  _User_adminWorldsMap = new WeakMap(), _User_assetsMap = new WeakMap(), _User_scenesMap = new WeakMap(), _User_worldsMap = new WeakMap();
42173
42352
 
42353
+ /* ============================================================================
42354
+ AI RULES for code assistants
42355
+
42356
+ CONTEXT
42357
+ - "Controllers" expose operations on domain objects (e.g., Visitor).
42358
+ - Consumers obtain controller instances via factory methods (e.g., VisitorFactory.get).
42359
+
42360
+ DO
42361
+ - Expect consumers to import a pre-instantiated factory from their app (e.g., utils/topiaInit.ts).
42362
+ - Use ONLY the methods defined & documented in this file's types/TSDoc.
42363
+
42364
+ DO NOT
42365
+ - Do NOT suggest creating Topia clients or factories inside controllers.
42366
+ - Do NOT suggest non-existent methods: getById, fetch, find
42367
+ - Do NOT mutate controller shape or return ad-hoc fields.
42368
+
42369
+ CANONICAL USAGE (consumer app):
42370
+ // utils/topiaInit.ts
42371
+ import { Topia, VisitorFactory } from "@rtsdk/topia";
42372
+ const topia = new Topia({ config });
42373
+ export const Visitor = new VisitorFactory(topia);
42374
+
42375
+ // controllers/myController.ts (consumer app)
42376
+ import { Visitor } from "utils/topiaInit.ts";
42377
+ const visitor = await Visitor.get(visitorId, urlSlug, { credentials });
42378
+ await visitor.fetchDataObject();
42379
+
42380
+ ============================================================================ */
42174
42381
  /**
42175
42382
  * Create an instance of Visitor class with a given id and optional attributes and session credentials.
42176
42383
  *
42177
42384
  * @example
42178
42385
  * ```ts
42179
- * const visitor = await new Visitor(topia, id, urlSlug, { attributes: { moveTo: { x: 0, y: 0 } }, credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" } });
42386
+ * import { Visitor } from "utils/topiaInit.ts";
42387
+ *
42388
+ * const visitor = await Visitor.get(visitorId, urlSlug, { attributes: { moveTo: { x: 0, y: 0 } }, credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", profileId: "exampleProfileId", visitorId: 1, urlSlug: "exampleUrlSlug" } });
42180
42389
  * ```
42181
42390
  */
42182
42391
  class Visitor extends User {
@@ -42665,7 +42874,7 @@ class Visitor extends User {
42665
42874
  * @example
42666
42875
  * ```ts
42667
42876
  * const webRTC = await new WebRTCConnector(topia, {
42668
- * credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
42877
+ * credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", profileId: "exampleProfileId", visitorId: 1, urlSlug: "exampleUrlSlug" }
42669
42878
  * });
42670
42879
  * ```
42671
42880
  */
@@ -42699,6 +42908,34 @@ class WebRTCConnector extends SDKController {
42699
42908
  }
42700
42909
 
42701
42910
  var _WorldActivity_visitorsMap;
42911
+ /* ============================================================================
42912
+ AI RULES for code assistants
42913
+
42914
+ CONTEXT
42915
+ - "Controllers" expose operations on domain objects (e.g., WorldActivity).
42916
+ - Consumers obtain controller instances via factory methods (e.g., WorldActivityFactory.get).
42917
+
42918
+ DO
42919
+ - Expect consumers to import a pre-instantiated factory from their app (e.g., utils/topiaInit.ts).
42920
+ - Use ONLY the methods defined & documented in this file's types/TSDoc.
42921
+
42922
+ DO NOT
42923
+ - Do NOT suggest creating Topia clients or factories inside controllers.
42924
+ - Do NOT suggest non-existent methods: getById, fetch, find
42925
+ - Do NOT mutate controller shape or return ad-hoc fields.
42926
+
42927
+ CANONICAL USAGE (consumer app):
42928
+ // utils/topiaInit.ts
42929
+ import { Topia, WorldActivityFactory } from "@rtsdk/topia";
42930
+ const topia = new Topia({ config });
42931
+ export const WorldActivity = new WorldActivityFactory(topia);
42932
+
42933
+ // controllers/myController.ts (consumer app)
42934
+ import { WorldActivity } from "utils/topiaInit.ts";
42935
+ const activity = await WorldActivity.create(urlSlug, { credentials });
42936
+ await activity.currentVisitors();
42937
+
42938
+ ============================================================================ */
42702
42939
  /**
42703
42940
  * Create an instance of WorldActivity class with a given url slug and optional attributes and session credentials.
42704
42941
  *
@@ -42707,9 +42944,11 @@ var _WorldActivity_visitorsMap;
42707
42944
  *
42708
42945
  * @example
42709
42946
  * ```ts
42710
- * const activity = await new WorldActivity(topia, "exampleWorld", {
42947
+ * import { WorldActivity } from "utils/topiaInit.ts";
42948
+ *
42949
+ * const activity = await WorldActivity.create(urlSlug, {
42711
42950
  * attributes: { name: "Example World" },
42712
- * credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
42951
+ * credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", visitorId: 1, urlSlug: "exampleUrlSlug" }
42713
42952
  * });
42714
42953
  * ```
42715
42954
  */
@@ -42880,6 +43119,36 @@ class WorldActivity extends SDKController {
42880
43119
  }
42881
43120
  _WorldActivity_visitorsMap = new WeakMap();
42882
43121
 
43122
+ /* ============================================================================
43123
+ AI RULES for code assistants
43124
+
43125
+ - Consumers MUST create a single Topia client in their app (e.g. utils/topiaInit.ts).
43126
+ - Consumers MUST instantiate this factory ONCE using that client and RE-USE it.
43127
+ - Controllers/services MUST import the app’s exported factory instance.
43128
+ - Use ONLY methods defined in this file’s types and TSDoc.
43129
+ - Methods that DO NOT exist and MUST NOT be suggested.
43130
+
43131
+ RIGHT ✅ Correct usage pattern (consumer app):
43132
+ // utils/topiaInit.ts
43133
+ import { Topia, AssetFactory } from "@rtsdk/topia";
43134
+ const topia = new Topia({ config });
43135
+ export const Asset = new AssetFactory(topia);
43136
+
43137
+ RIGHT ✅ Correct usage pattern (controller):
43138
+ // controllers/myController.ts
43139
+ import { Asset } from "utils/topiaInit.ts";
43140
+ const asset = await Asset.create(assetId, { credentials });
43141
+ await asset.fetchAssetById();
43142
+
43143
+ WRONG ❌ Incorrect usage pattern (controller):
43144
+ // controllers/myController.ts
43145
+ import { AssetFactory, Topia } from "@rtsdk/topia";
43146
+ const topia = new Topia(config); // ❌ new client per request
43147
+ const Asset = new AssetFactory(topia); // ❌ ad-hoc factory
43148
+ const asset = await Asset.getById(assetId); // ❌ method does not exist
43149
+
43150
+ Do NOT instantiate factories in controllers. Do NOT invent methods.
43151
+ ============================================================================ */
42883
43152
  /**
42884
43153
  * @example
42885
43154
  * ```ts
@@ -42938,6 +43207,36 @@ class AssetFactory extends SDKController {
42938
43207
  }
42939
43208
  }
42940
43209
 
43210
+ /* ============================================================================
43211
+ AI RULES for code assistants
43212
+
43213
+ - Consumers MUST create a single Topia client in their app (e.g. utils/topiaInit.ts).
43214
+ - Consumers MUST instantiate this factory ONCE using that client and RE-USE it.
43215
+ - Controllers/services MUST import the app’s exported factory instance.
43216
+ - Use ONLY methods defined in this file’s types and TSDoc.
43217
+ - Methods that DO NOT exist and MUST NOT be suggested.
43218
+
43219
+ RIGHT ✅ Correct usage pattern (consumer app):
43220
+ // utils/topiaInit.ts
43221
+ import { Topia, DroppedAssetFactory } from "@rtsdk/topia";
43222
+ const topia = new Topia({ config });
43223
+ export const DroppedAsset = new DroppedAssetFactory(topia);
43224
+
43225
+ RIGHT ✅ Correct usage pattern (controller):
43226
+ // controllers/myController.ts
43227
+ import { DroppedAsset } from "utils/topiaInit.ts";
43228
+ const da = await DroppedAsset.get(droppedAssetId, urlSlug, { credentials });
43229
+ await da.fetchDataObject();
43230
+
43231
+ WRONG ❌ Incorrect usage pattern (controller):
43232
+ // controllers/myController.ts
43233
+ import { DroppedAssetFactory, Topia } from "@rtsdk/topia";
43234
+ const topia = new Topia(config); // ❌ new client per request
43235
+ const DroppedAsset = new DroppedAssetFactory(topia); // ❌ ad-hoc factory
43236
+ const da = await DroppedAsset.getById(droppedAssetId); // ❌ method does not exist
43237
+
43238
+ Do NOT instantiate factories in controllers. Do NOT invent methods.
43239
+ ============================================================================ */
42941
43240
  /**
42942
43241
  * @example
42943
43242
  * ```ts
@@ -43086,6 +43385,36 @@ class DroppedAssetFactory extends SDKController {
43086
43385
  }
43087
43386
  }
43088
43387
 
43388
+ /* ============================================================================
43389
+ AI RULES for code assistants
43390
+
43391
+ - Consumers MUST create a single Topia client in their app (e.g. utils/topiaInit.ts).
43392
+ - Consumers MUST instantiate this factory ONCE using that client and RE-USE it.
43393
+ - Controllers/services MUST import the app’s exported factory instance.
43394
+ - Use ONLY methods defined in this file’s types and TSDoc.
43395
+ - Methods that DO NOT exist and MUST NOT be suggested.
43396
+
43397
+ RIGHT ✅ Correct usage pattern (consumer app):
43398
+ // utils/topiaInit.ts
43399
+ import { Topia, Ecosystem } from "@rtsdk/topia";
43400
+ const topia = new Topia({ config });
43401
+ export const Ecosystem = new EcosystemFactory(topia);
43402
+
43403
+ RIGHT ✅ Correct usage pattern (controller):
43404
+ // controllers/myController.ts
43405
+ import { Ecosystem } from "utils/topiaInit.ts";
43406
+ const ecosystem = await Ecosystem.create({ credentials });
43407
+ await ecosystem.fetchDataObject();
43408
+
43409
+ WRONG ❌ Incorrect usage pattern (controller):
43410
+ // controllers/myController.ts
43411
+ import { Ecosystem, Topia } from "@rtsdk/topia";
43412
+ const topia = new Topia(config); // ❌ new client per request
43413
+ const Ecosystem = new EcosystemFactory(topia); // ❌ ad-hoc factory
43414
+ const ecosystem = await Ecosystem.getById(id); // ❌ method does not exist
43415
+
43416
+ Do NOT instantiate factories in controllers. Do NOT invent methods.
43417
+ ============================================================================ */
43089
43418
  /**
43090
43419
  * @example
43091
43420
  * ```ts
@@ -43111,6 +43440,35 @@ class EcosystemFactory {
43111
43440
  }
43112
43441
  }
43113
43442
 
43443
+ /* ============================================================================
43444
+ AI RULES for code assistants
43445
+
43446
+ - Consumers MUST create a single Topia client in their app (e.g. utils/topiaInit.ts).
43447
+ - Consumers MUST instantiate this factory ONCE using that client and RE-USE it.
43448
+ - Controllers/services MUST import the app’s exported factory instance.
43449
+ - Use ONLY methods defined in this file’s types and TSDoc.
43450
+ - Methods that DO NOT exist and MUST NOT be suggested.
43451
+
43452
+ RIGHT ✅ Correct usage pattern (consumer app):
43453
+ // utils/topiaInit.ts
43454
+ import { Topia, SceneFactory } from "@rtsdk/topia";
43455
+ const topia = new Topia({ config });
43456
+ export const Scene = new SceneFactory(topia);
43457
+
43458
+ RIGHT ✅ Correct usage pattern (controller):
43459
+ // controllers/myController.ts
43460
+ import { Scene } from "utils/topiaInit.ts";
43461
+ const scene = await Scene.get(sceneId, { credentials });
43462
+
43463
+ WRONG ❌ Incorrect usage pattern (controller):
43464
+ // controllers/myController.ts
43465
+ import { SceneFactory, Topia } from "@rtsdk/topia";
43466
+ const topia = new Topia(config); // ❌ new client per request
43467
+ const Scene = new SceneFactory(topia); // ❌ ad-hoc factory
43468
+ const scene = await Scene.getById(sceneId); // ❌ method does not exist
43469
+
43470
+ Do NOT instantiate factories in controllers. Do NOT invent methods.
43471
+ ============================================================================ */
43114
43472
  /**
43115
43473
  * @example
43116
43474
  * ```ts
@@ -43154,6 +43512,36 @@ class SceneFactory {
43154
43512
  }
43155
43513
  }
43156
43514
 
43515
+ /* ============================================================================
43516
+ AI RULES for code assistants
43517
+
43518
+ - Consumers MUST create a single Topia client in their app (e.g. utils/topiaInit.ts).
43519
+ - Consumers MUST instantiate this factory ONCE using that client and RE-USE it.
43520
+ - Controllers/services MUST import the app’s exported factory instance.
43521
+ - Use ONLY methods defined in this file’s types and TSDoc.
43522
+ - Methods that DO NOT exist and MUST NOT be suggested.
43523
+
43524
+ RIGHT ✅ Correct usage pattern (consumer app):
43525
+ // utils/topiaInit.ts
43526
+ import { Topia, UserFactory } from "@rtsdk/topia";
43527
+ const topia = new Topia({ config });
43528
+ export const User = new UserFactory(topia);
43529
+
43530
+ RIGHT ✅ Correct usage pattern (controller):
43531
+ // controllers/myController.ts
43532
+ import { User } from "utils/topiaInit.ts";
43533
+ const user = await User.create({ credentials });
43534
+ await user.fetchDataObject();
43535
+
43536
+ WRONG ❌ Incorrect usage pattern (controller):
43537
+ // controllers/myController.ts
43538
+ import { UserFactory, Topia } from "@rtsdk/topia";
43539
+ const topia = new Topia(config); // ❌ new client per request
43540
+ const User = new UserFactory(topia); // ❌ ad-hoc factory
43541
+ const user = await User.getById(userId); // ❌ method does not exist
43542
+
43543
+ Do NOT instantiate factories in controllers. Do NOT invent methods.
43544
+ ============================================================================ */
43157
43545
  /**
43158
43546
  * @example
43159
43547
  * ```ts
@@ -43179,6 +43567,36 @@ class UserFactory {
43179
43567
  }
43180
43568
  }
43181
43569
 
43570
+ /* ============================================================================
43571
+ AI RULES for code assistants
43572
+
43573
+ - Consumers MUST create a single Topia client in their app (e.g. utils/topiaInit.ts).
43574
+ - Consumers MUST instantiate this factory ONCE using that client and RE-USE it.
43575
+ - Controllers/services MUST import the app’s exported factory instance.
43576
+ - Use ONLY methods defined in this file’s types and TSDoc.
43577
+ - Methods that DO NOT exist and MUST NOT be suggested.
43578
+
43579
+ RIGHT ✅ Correct usage pattern (consumer app):
43580
+ // utils/topiaInit.ts
43581
+ import { Topia, VisitorFactory } from "@rtsdk/topia";
43582
+ const topia = new Topia({ config });
43583
+ export const Visitor = new VisitorFactory(topia);
43584
+
43585
+ RIGHT ✅ Correct usage pattern (controller):
43586
+ // controllers/myController.ts
43587
+ import { Visitor } from "utils/topiaInit.ts";
43588
+ const visitor = await Visitor.get(visitorId, urlSlug, { credentials });
43589
+ await visitor.fetchDataObject();
43590
+
43591
+ WRONG ❌ Incorrect usage pattern (controller):
43592
+ // controllers/myController.ts
43593
+ import { VisitorFactory, Topia } from "@rtsdk/topia";
43594
+ const topia = new Topia(config); // ❌ new client per request
43595
+ const Visitor = new VisitorFactory(topia); // ❌ ad-hoc factory
43596
+ const visitor = await Visitor.getById(visitorId); // ❌ method does not exist
43597
+
43598
+ Do NOT instantiate factories in controllers. Do NOT invent methods.
43599
+ ============================================================================ */
43182
43600
  /**
43183
43601
  * @example
43184
43602
  * ```ts
@@ -43246,6 +43664,36 @@ class WebRTCConnectorFactory {
43246
43664
  }
43247
43665
  }
43248
43666
 
43667
+ /* ============================================================================
43668
+ AI RULES for code assistants
43669
+
43670
+ - Consumers MUST create a single Topia client in their app (e.g. utils/topiaInit.ts).
43671
+ - Consumers MUST instantiate this factory ONCE using that client and RE-USE it.
43672
+ - Controllers/services MUST import the app’s exported factory instance.
43673
+ - Use ONLY methods defined in this file’s types and TSDoc.
43674
+ - Methods that DO NOT exist and MUST NOT be suggested.
43675
+
43676
+ RIGHT ✅ Correct usage pattern (consumer app):
43677
+ // utils/topiaInit.ts
43678
+ import { Topia, WorldActivityFactory } from "@rtsdk/topia";
43679
+ const topia = new Topia({ config });
43680
+ export const WorldActivity = new WorldActivityFactory(topia);
43681
+
43682
+ RIGHT ✅ Correct usage pattern (controller):
43683
+ // controllers/myController.ts
43684
+ import { WorldActivity } from "utils/topiaInit.ts";
43685
+ const activity = await WorldActivity.create(urlSlug, { credentials });
43686
+ await activity.currentVisitors();
43687
+
43688
+ WRONG ❌ Incorrect usage pattern (controller):
43689
+ // controllers/myController.ts
43690
+ import { WorldActivity, Topia } from "@rtsdk/topia";
43691
+ const topia = new Topia(config); // ❌ new client per request
43692
+ const WorldActivity = new WorldActivityFactory(topia); // ❌ ad-hoc factory
43693
+ const activity = await WorldActivity.getAllVisitors(); // ❌ method does not exist
43694
+
43695
+ Do NOT instantiate factories in controllers. Do NOT invent methods.
43696
+ ============================================================================ */
43249
43697
  /**
43250
43698
  * @example
43251
43699
  * ```ts
@@ -43271,6 +43719,36 @@ class WorldActivityFactory {
43271
43719
  }
43272
43720
  }
43273
43721
 
43722
+ /* ============================================================================
43723
+ AI RULES for code assistants
43724
+
43725
+ - Consumers MUST create a single Topia client in their app (e.g. utils/topiaInit.ts).
43726
+ - Consumers MUST instantiate this factory ONCE using that client and RE-USE it.
43727
+ - Controllers/services MUST import the app’s exported factory instance.
43728
+ - Use ONLY methods defined in this file’s types and TSDoc.
43729
+ - Methods that DO NOT exist and MUST NOT be suggested.
43730
+
43731
+ RIGHT ✅ Correct usage pattern (consumer app):
43732
+ // utils/topiaInit.ts
43733
+ import { Topia, WorldFactory } from "@rtsdk/topia";
43734
+ const topia = new Topia({ config });
43735
+ export const World = new WorldFactory(topia);
43736
+
43737
+ RIGHT ✅ Correct usage pattern (controller):
43738
+ // controllers/myController.ts
43739
+ import { World } from "utils/topiaInit.ts";
43740
+ const world = await World.create(urlSlug, { credentials });
43741
+ await world.fetchDetails();
43742
+
43743
+ WRONG ❌ Incorrect usage pattern (controller):
43744
+ // controllers/myController.ts
43745
+ import { World, Topia } from "@rtsdk/topia";
43746
+ const topia = new Topia(config); // ❌ new client per request
43747
+ const World = new WorldFactory(topia); // ❌ ad-hoc factory
43748
+ const world = await World.update({}); // ❌ method does not exist
43749
+
43750
+ Do NOT instantiate factories in controllers. Do NOT invent methods.
43751
+ ============================================================================ */
43274
43752
  /**
43275
43753
  * @example
43276
43754
  * ```ts