@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/README.md +58 -32
- package/dist/index.cjs +496 -18
- package/dist/index.d.ts +109 -29
- package/dist/index.js +496 -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
|
*/
|
|
@@ -39782,6 +39812,7 @@ class Asset extends SDKController {
|
|
|
39782
39812
|
try {
|
|
39783
39813
|
const response = yield this.topiaPublicApi().put(`/assets/${this.id}`, params, this.requestOptions);
|
|
39784
39814
|
Object.assign(this, response.data);
|
|
39815
|
+
return response.data;
|
|
39785
39816
|
}
|
|
39786
39817
|
catch (error) {
|
|
39787
39818
|
throw this.errorHandler({ error, params, sdkMethod: "Asset.updateAsset" });
|
|
@@ -39846,14 +39877,43 @@ const scatterVisitors = (original, scatterBy) => {
|
|
|
39846
39877
|
};
|
|
39847
39878
|
|
|
39848
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
|
+
============================================================================ */
|
|
39849
39908
|
/**
|
|
39850
39909
|
* Create an instance of Dropped Asset class with a given dropped asset id, url slug, and optional attributes and session credentials.
|
|
39851
39910
|
*
|
|
39852
39911
|
* @example
|
|
39853
39912
|
* ```ts
|
|
39854
|
-
*
|
|
39855
|
-
*
|
|
39856
|
-
*
|
|
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" }
|
|
39857
39917
|
* });
|
|
39858
39918
|
* ```
|
|
39859
39919
|
*/
|
|
@@ -40615,13 +40675,43 @@ class DroppedAsset extends Asset {
|
|
|
40615
40675
|
}
|
|
40616
40676
|
_DroppedAsset_updateDroppedAsset = new WeakMap();
|
|
40617
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
|
+
============================================================================ */
|
|
40618
40706
|
/**
|
|
40619
40707
|
* Create an instance of Ecosystem class with optional session credentials
|
|
40620
40708
|
*
|
|
40621
40709
|
* @example
|
|
40622
40710
|
* ```ts
|
|
40623
|
-
*
|
|
40624
|
-
*
|
|
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" }
|
|
40625
40715
|
* });
|
|
40626
40716
|
* ```
|
|
40627
40717
|
*/
|
|
@@ -40759,14 +40849,43 @@ class Ecosystem extends SDKController {
|
|
|
40759
40849
|
}
|
|
40760
40850
|
}
|
|
40761
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
|
+
============================================================================ */
|
|
40762
40879
|
/**
|
|
40763
40880
|
* Create an instance of Scene class with a given scene id and optional attributes and session credentials.
|
|
40764
40881
|
*
|
|
40765
40882
|
* @example
|
|
40766
40883
|
* ```ts
|
|
40767
|
-
*
|
|
40884
|
+
* import { Scene } from "utils/topiaInit.ts";
|
|
40885
|
+
*
|
|
40886
|
+
* const scene = await Scene.get(exampleSceneId, {
|
|
40768
40887
|
* attributes: { name: "My Scene" },
|
|
40769
|
-
* credentials: { interactiveNonce: "exampleNonce", assetId: "
|
|
40888
|
+
* credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", visitorId: 1, urlSlug: "exampleUrlSlug" }
|
|
40770
40889
|
* });
|
|
40771
40890
|
* ```
|
|
40772
40891
|
*/
|
|
@@ -40836,14 +40955,44 @@ class Topia {
|
|
|
40836
40955
|
}
|
|
40837
40956
|
|
|
40838
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
|
+
============================================================================ */
|
|
40839
40986
|
/**
|
|
40840
40987
|
* Create an instance of World class with a given url slug and optional attributes and session credentials.
|
|
40841
40988
|
*
|
|
40842
40989
|
* @example
|
|
40843
40990
|
* ```ts
|
|
40844
|
-
*
|
|
40991
|
+
* import { World } from "utils/topiaInit.ts";
|
|
40992
|
+
*
|
|
40993
|
+
* const world = await World.create(exampleUrlSlug, {
|
|
40845
40994
|
* attributes: { name: "Example World" },
|
|
40846
|
-
* credentials: { interactiveNonce: "exampleNonce", assetId: "
|
|
40995
|
+
* credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", visitorId: 1, urlSlug: "exampleUrlSlug" }
|
|
40847
40996
|
* });
|
|
40848
40997
|
* ```
|
|
40849
40998
|
*/
|
|
@@ -41565,14 +41714,44 @@ class World extends SDKController {
|
|
|
41565
41714
|
_World_droppedAssetsMap = new WeakMap();
|
|
41566
41715
|
|
|
41567
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
|
+
============================================================================ */
|
|
41568
41745
|
/**
|
|
41569
41746
|
* Create an instance of User class with optional session credentials.
|
|
41570
41747
|
*
|
|
41571
41748
|
* @example
|
|
41572
41749
|
* ```ts
|
|
41573
|
-
*
|
|
41574
|
-
*
|
|
41575
|
-
*
|
|
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" }
|
|
41576
41755
|
* });
|
|
41577
41756
|
* ```
|
|
41578
41757
|
*/
|
|
@@ -42173,12 +42352,42 @@ class User extends SDKController {
|
|
|
42173
42352
|
}
|
|
42174
42353
|
_User_adminWorldsMap = new WeakMap(), _User_assetsMap = new WeakMap(), _User_scenesMap = new WeakMap(), _User_worldsMap = new WeakMap();
|
|
42175
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
|
+
============================================================================ */
|
|
42176
42383
|
/**
|
|
42177
42384
|
* Create an instance of Visitor class with a given id and optional attributes and session credentials.
|
|
42178
42385
|
*
|
|
42179
42386
|
* @example
|
|
42180
42387
|
* ```ts
|
|
42181
|
-
*
|
|
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" } });
|
|
42182
42391
|
* ```
|
|
42183
42392
|
*/
|
|
42184
42393
|
class Visitor extends User {
|
|
@@ -42667,7 +42876,7 @@ class Visitor extends User {
|
|
|
42667
42876
|
* @example
|
|
42668
42877
|
* ```ts
|
|
42669
42878
|
* const webRTC = await new WebRTCConnector(topia, {
|
|
42670
|
-
* credentials: { interactiveNonce: "exampleNonce", assetId: "
|
|
42879
|
+
* credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", profileId: "exampleProfileId", visitorId: 1, urlSlug: "exampleUrlSlug" }
|
|
42671
42880
|
* });
|
|
42672
42881
|
* ```
|
|
42673
42882
|
*/
|
|
@@ -42701,6 +42910,34 @@ class WebRTCConnector extends SDKController {
|
|
|
42701
42910
|
}
|
|
42702
42911
|
|
|
42703
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
|
+
============================================================================ */
|
|
42704
42941
|
/**
|
|
42705
42942
|
* Create an instance of WorldActivity class with a given url slug and optional attributes and session credentials.
|
|
42706
42943
|
*
|
|
@@ -42709,9 +42946,11 @@ var _WorldActivity_visitorsMap;
|
|
|
42709
42946
|
*
|
|
42710
42947
|
* @example
|
|
42711
42948
|
* ```ts
|
|
42712
|
-
*
|
|
42949
|
+
* import { WorldActivity } from "utils/topiaInit.ts";
|
|
42950
|
+
*
|
|
42951
|
+
* const activity = await WorldActivity.create(urlSlug, {
|
|
42713
42952
|
* attributes: { name: "Example World" },
|
|
42714
|
-
* credentials: { interactiveNonce: "exampleNonce", assetId: "
|
|
42953
|
+
* credentials: { interactivePublicKey: "examplePublicKey", interactiveNonce: "exampleNonce", assetId: "exampleDroppedAssetId", visitorId: 1, urlSlug: "exampleUrlSlug" }
|
|
42715
42954
|
* });
|
|
42716
42955
|
* ```
|
|
42717
42956
|
*/
|
|
@@ -42882,6 +43121,36 @@ class WorldActivity extends SDKController {
|
|
|
42882
43121
|
}
|
|
42883
43122
|
_WorldActivity_visitorsMap = new WeakMap();
|
|
42884
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
|
+
============================================================================ */
|
|
42885
43154
|
/**
|
|
42886
43155
|
* @example
|
|
42887
43156
|
* ```ts
|
|
@@ -42940,6 +43209,36 @@ class AssetFactory extends SDKController {
|
|
|
42940
43209
|
}
|
|
42941
43210
|
}
|
|
42942
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
|
+
============================================================================ */
|
|
42943
43242
|
/**
|
|
42944
43243
|
* @example
|
|
42945
43244
|
* ```ts
|
|
@@ -43088,6 +43387,36 @@ class DroppedAssetFactory extends SDKController {
|
|
|
43088
43387
|
}
|
|
43089
43388
|
}
|
|
43090
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
|
+
============================================================================ */
|
|
43091
43420
|
/**
|
|
43092
43421
|
* @example
|
|
43093
43422
|
* ```ts
|
|
@@ -43113,6 +43442,35 @@ class EcosystemFactory {
|
|
|
43113
43442
|
}
|
|
43114
43443
|
}
|
|
43115
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
|
+
============================================================================ */
|
|
43116
43474
|
/**
|
|
43117
43475
|
* @example
|
|
43118
43476
|
* ```ts
|
|
@@ -43156,6 +43514,36 @@ class SceneFactory {
|
|
|
43156
43514
|
}
|
|
43157
43515
|
}
|
|
43158
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
|
+
============================================================================ */
|
|
43159
43547
|
/**
|
|
43160
43548
|
* @example
|
|
43161
43549
|
* ```ts
|
|
@@ -43181,6 +43569,36 @@ class UserFactory {
|
|
|
43181
43569
|
}
|
|
43182
43570
|
}
|
|
43183
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
|
+
============================================================================ */
|
|
43184
43602
|
/**
|
|
43185
43603
|
* @example
|
|
43186
43604
|
* ```ts
|
|
@@ -43248,6 +43666,36 @@ class WebRTCConnectorFactory {
|
|
|
43248
43666
|
}
|
|
43249
43667
|
}
|
|
43250
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
|
+
============================================================================ */
|
|
43251
43699
|
/**
|
|
43252
43700
|
* @example
|
|
43253
43701
|
* ```ts
|
|
@@ -43273,6 +43721,36 @@ class WorldActivityFactory {
|
|
|
43273
43721
|
}
|
|
43274
43722
|
}
|
|
43275
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
|
+
============================================================================ */
|
|
43276
43754
|
/**
|
|
43277
43755
|
* @example
|
|
43278
43756
|
* ```ts
|