@rtsdk/topia 0.17.7 → 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
  */
@@ -39845,14 +39875,43 @@ const scatterVisitors = (original, scatterBy) => {
39845
39875
  };
39846
39876
 
39847
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
+ ============================================================================ */
39848
39906
  /**
39849
39907
  * Create an instance of Dropped Asset class with a given dropped asset id, url slug, and optional attributes and session credentials.
39850
39908
  *
39851
39909
  * @example
39852
39910
  * ```ts
39853
- * const droppedAsset = await new DroppedAsset(topia, "1giFZb0sQ3X27L7uGyQX", "example", {
39854
- * attributes: { text: "My Dropped Asset" },
39855
- * 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" }
39856
39915
  * });
39857
39916
  * ```
39858
39917
  */
@@ -40614,13 +40673,43 @@ class DroppedAsset extends Asset {
40614
40673
  }
40615
40674
  _DroppedAsset_updateDroppedAsset = new WeakMap();
40616
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
+ ============================================================================ */
40617
40704
  /**
40618
40705
  * Create an instance of Ecosystem class with optional session credentials
40619
40706
  *
40620
40707
  * @example
40621
40708
  * ```ts
40622
- * const ecosystem =await new Ecosystem(topia, {
40623
- * 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" }
40624
40713
  * });
40625
40714
  * ```
40626
40715
  */
@@ -40758,14 +40847,43 @@ class Ecosystem extends SDKController {
40758
40847
  }
40759
40848
  }
40760
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
+ ============================================================================ */
40761
40877
  /**
40762
40878
  * Create an instance of Scene class with a given scene id and optional attributes and session credentials.
40763
40879
  *
40764
40880
  * @example
40765
40881
  * ```ts
40766
- * const scene = await new Scene(topia, "sceneId", {
40882
+ * import { Scene } from "utils/topiaInit.ts";
40883
+ *
40884
+ * const scene = await Scene.get(exampleSceneId, {
40767
40885
  * attributes: { name: "My Scene" },
40768
- * credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
40886
+ * credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", visitorId: 1, urlSlug: "exampleUrlSlug" }
40769
40887
  * });
40770
40888
  * ```
40771
40889
  */
@@ -40835,14 +40953,44 @@ class Topia {
40835
40953
  }
40836
40954
 
40837
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
+ ============================================================================ */
40838
40984
  /**
40839
40985
  * Create an instance of World class with a given url slug and optional attributes and session credentials.
40840
40986
  *
40841
40987
  * @example
40842
40988
  * ```ts
40843
- * const world = await new World(topia, "exampleWorld", {
40989
+ * import { World } from "utils/topiaInit.ts";
40990
+ *
40991
+ * const world = await World.create(exampleUrlSlug, {
40844
40992
  * attributes: { name: "Example World" },
40845
- * credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
40993
+ * credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", visitorId: 1, urlSlug: "exampleUrlSlug" }
40846
40994
  * });
40847
40995
  * ```
40848
40996
  */
@@ -41564,14 +41712,44 @@ class World extends SDKController {
41564
41712
  _World_droppedAssetsMap = new WeakMap();
41565
41713
 
41566
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
+ ============================================================================ */
41567
41743
  /**
41568
41744
  * Create an instance of User class with optional session credentials.
41569
41745
  *
41570
41746
  * @example
41571
41747
  * ```ts
41572
- * const user = await new User(topia, {
41573
- * profileId: 1,
41574
- * 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" }
41575
41753
  * });
41576
41754
  * ```
41577
41755
  */
@@ -42172,12 +42350,42 @@ class User extends SDKController {
42172
42350
  }
42173
42351
  _User_adminWorldsMap = new WeakMap(), _User_assetsMap = new WeakMap(), _User_scenesMap = new WeakMap(), _User_worldsMap = new WeakMap();
42174
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
+ ============================================================================ */
42175
42381
  /**
42176
42382
  * Create an instance of Visitor class with a given id and optional attributes and session credentials.
42177
42383
  *
42178
42384
  * @example
42179
42385
  * ```ts
42180
- * 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" } });
42181
42389
  * ```
42182
42390
  */
42183
42391
  class Visitor extends User {
@@ -42666,7 +42874,7 @@ class Visitor extends User {
42666
42874
  * @example
42667
42875
  * ```ts
42668
42876
  * const webRTC = await new WebRTCConnector(topia, {
42669
- * credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
42877
+ * credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", profileId: "exampleProfileId", visitorId: 1, urlSlug: "exampleUrlSlug" }
42670
42878
  * });
42671
42879
  * ```
42672
42880
  */
@@ -42700,6 +42908,34 @@ class WebRTCConnector extends SDKController {
42700
42908
  }
42701
42909
 
42702
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
+ ============================================================================ */
42703
42939
  /**
42704
42940
  * Create an instance of WorldActivity class with a given url slug and optional attributes and session credentials.
42705
42941
  *
@@ -42708,9 +42944,11 @@ var _WorldActivity_visitorsMap;
42708
42944
  *
42709
42945
  * @example
42710
42946
  * ```ts
42711
- * const activity = await new WorldActivity(topia, "exampleWorld", {
42947
+ * import { WorldActivity } from "utils/topiaInit.ts";
42948
+ *
42949
+ * const activity = await WorldActivity.create(urlSlug, {
42712
42950
  * attributes: { name: "Example World" },
42713
- * credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
42951
+ * credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", visitorId: 1, urlSlug: "exampleUrlSlug" }
42714
42952
  * });
42715
42953
  * ```
42716
42954
  */
@@ -42881,6 +43119,36 @@ class WorldActivity extends SDKController {
42881
43119
  }
42882
43120
  _WorldActivity_visitorsMap = new WeakMap();
42883
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
+ ============================================================================ */
42884
43152
  /**
42885
43153
  * @example
42886
43154
  * ```ts
@@ -42939,6 +43207,36 @@ class AssetFactory extends SDKController {
42939
43207
  }
42940
43208
  }
42941
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
+ ============================================================================ */
42942
43240
  /**
42943
43241
  * @example
42944
43242
  * ```ts
@@ -43087,6 +43385,36 @@ class DroppedAssetFactory extends SDKController {
43087
43385
  }
43088
43386
  }
43089
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
+ ============================================================================ */
43090
43418
  /**
43091
43419
  * @example
43092
43420
  * ```ts
@@ -43112,6 +43440,35 @@ class EcosystemFactory {
43112
43440
  }
43113
43441
  }
43114
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
+ ============================================================================ */
43115
43472
  /**
43116
43473
  * @example
43117
43474
  * ```ts
@@ -43155,6 +43512,36 @@ class SceneFactory {
43155
43512
  }
43156
43513
  }
43157
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
+ ============================================================================ */
43158
43545
  /**
43159
43546
  * @example
43160
43547
  * ```ts
@@ -43180,6 +43567,36 @@ class UserFactory {
43180
43567
  }
43181
43568
  }
43182
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
+ ============================================================================ */
43183
43600
  /**
43184
43601
  * @example
43185
43602
  * ```ts
@@ -43247,6 +43664,36 @@ class WebRTCConnectorFactory {
43247
43664
  }
43248
43665
  }
43249
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
+ ============================================================================ */
43250
43697
  /**
43251
43698
  * @example
43252
43699
  * ```ts
@@ -43272,6 +43719,36 @@ class WorldActivityFactory {
43272
43719
  }
43273
43720
  }
43274
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
+ ============================================================================ */
43275
43752
  /**
43276
43753
  * @example
43277
43754
  * ```ts
package/package.json CHANGED
@@ -60,5 +60,5 @@
60
60
  "yalc-push": "yarn build && yalc publish --push --dev --no-scripts"
61
61
  },
62
62
  "type": "module",
63
- "version": "0.17.07"
63
+ "version": "0.17.08"
64
64
  }