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