@rtsdk/topia 0.19.7 → 0.19.9
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.cjs +20 -16
- package/dist/index.d.ts +27 -34
- package/dist/index.js +21 -17
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -39910,7 +39910,12 @@ exports.DroppedAssetMediaVolumeRadius = void 0;
|
|
|
39910
39910
|
DroppedAssetMediaVolumeRadius[DroppedAssetMediaVolumeRadius["MEDIUM"] = 1] = "MEDIUM";
|
|
39911
39911
|
DroppedAssetMediaVolumeRadius[DroppedAssetMediaVolumeRadius["FAR"] = 2] = "FAR";
|
|
39912
39912
|
DroppedAssetMediaVolumeRadius[DroppedAssetMediaVolumeRadius["EVERYWHERE"] = 3] = "EVERYWHERE";
|
|
39913
|
-
})(exports.DroppedAssetMediaVolumeRadius || (exports.DroppedAssetMediaVolumeRadius = {}));
|
|
39913
|
+
})(exports.DroppedAssetMediaVolumeRadius || (exports.DroppedAssetMediaVolumeRadius = {}));
|
|
39914
|
+
exports.DroppedAssetClickableLayerType = void 0;
|
|
39915
|
+
(function (DroppedAssetClickableLayerType) {
|
|
39916
|
+
DroppedAssetClickableLayerType["TOP"] = "top";
|
|
39917
|
+
DroppedAssetClickableLayerType["BOTTOM"] = "bottom";
|
|
39918
|
+
})(exports.DroppedAssetClickableLayerType || (exports.DroppedAssetClickableLayerType = {}));
|
|
39914
39919
|
|
|
39915
39920
|
exports.WorldActivityType = void 0;
|
|
39916
39921
|
(function (WorldActivityType) {
|
|
@@ -42263,7 +42268,6 @@ AI RULES for code assistants
|
|
|
42263
42268
|
*/
|
|
42264
42269
|
class User extends SDKController {
|
|
42265
42270
|
constructor(topia, options = { profileId: null, credentials: {} }) {
|
|
42266
|
-
var _a;
|
|
42267
42271
|
super(topia, Object.assign({ profileId: options === null || options === void 0 ? void 0 : options.profileId }, options.credentials));
|
|
42268
42272
|
_User_userInventoryItems.set(this, void 0);
|
|
42269
42273
|
_User_adminWorldsMap.set(this, void 0);
|
|
@@ -42271,13 +42275,6 @@ class User extends SDKController {
|
|
|
42271
42275
|
_User_scenesMap.set(this, void 0);
|
|
42272
42276
|
_User_worldsMap.set(this, void 0);
|
|
42273
42277
|
this.profileId = options === null || options === void 0 ? void 0 : options.profileId;
|
|
42274
|
-
// Warn devs about common mistake: passing profileId only inside credentials
|
|
42275
|
-
if (!this.profileId && ((_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.profileId)) {
|
|
42276
|
-
console.warn(`[@rtsdk/topia] User created without top-level profileId. ` +
|
|
42277
|
-
`You passed profileId inside credentials but not in options. ` +
|
|
42278
|
-
`Methods like grantInventoryItem will fail. ` +
|
|
42279
|
-
`Fix: User.create({ profileId: "${options.credentials.profileId}", credentials: { ... } })`);
|
|
42280
|
-
}
|
|
42281
42278
|
this.dataObject = {};
|
|
42282
42279
|
this.profile = {};
|
|
42283
42280
|
__classPrivateFieldSet(this, _User_adminWorldsMap, {}, "f");
|
|
@@ -42790,8 +42787,9 @@ class User extends SDKController {
|
|
|
42790
42787
|
fetchDataObject(appPublicKey, appJWT) {
|
|
42791
42788
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42792
42789
|
try {
|
|
42793
|
-
if (!this.profileId)
|
|
42790
|
+
if (!this.profileId) {
|
|
42794
42791
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42792
|
+
}
|
|
42795
42793
|
let query = "";
|
|
42796
42794
|
if (appPublicKey)
|
|
42797
42795
|
query = `?appPublicKey=${appPublicKey}&appJWT=${appJWT}`;
|
|
@@ -42830,8 +42828,9 @@ class User extends SDKController {
|
|
|
42830
42828
|
setDataObject(dataObject, options = {}) {
|
|
42831
42829
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42832
42830
|
try {
|
|
42833
|
-
if (!this.profileId)
|
|
42831
|
+
if (!this.profileId) {
|
|
42834
42832
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42833
|
+
}
|
|
42835
42834
|
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/set-data-object`, Object.assign(Object.assign({}, options), { dataObject: dataObject || this.dataObject }), this.requestOptions);
|
|
42836
42835
|
this.dataObject = dataObject || this.dataObject;
|
|
42837
42836
|
}
|
|
@@ -42864,8 +42863,9 @@ class User extends SDKController {
|
|
|
42864
42863
|
updateDataObject(dataObject, options = {}) {
|
|
42865
42864
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42866
42865
|
try {
|
|
42867
|
-
if (!this.profileId)
|
|
42866
|
+
if (!this.profileId) {
|
|
42868
42867
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42868
|
+
}
|
|
42869
42869
|
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/update-data-object`, Object.assign(Object.assign({}, options), { dataObject: dataObject || this.dataObject }), this.requestOptions);
|
|
42870
42870
|
this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
|
|
42871
42871
|
}
|
|
@@ -42914,8 +42914,9 @@ class User extends SDKController {
|
|
|
42914
42914
|
fetchInventoryItems() {
|
|
42915
42915
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42916
42916
|
try {
|
|
42917
|
-
if (!this.profileId)
|
|
42917
|
+
if (!this.profileId) {
|
|
42918
42918
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42919
|
+
}
|
|
42919
42920
|
const response = yield this.topiaPublicApi().get(`/user/inventory/${this.profileId}/get-user-inventory-items`, this.requestOptions);
|
|
42920
42921
|
// TODO: Replace 'object' with InventoryItem and instantiate InventoryItem objects if needed
|
|
42921
42922
|
const tempItems = [];
|
|
@@ -42951,8 +42952,9 @@ class User extends SDKController {
|
|
|
42951
42952
|
grantInventoryItem(item, quantity = 1) {
|
|
42952
42953
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42953
42954
|
try {
|
|
42954
|
-
if (!this.profileId)
|
|
42955
|
+
if (!this.profileId) {
|
|
42955
42956
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42957
|
+
}
|
|
42956
42958
|
const response = yield this.topiaPublicApi().put(`/user/inventory/${this.profileId}/grant-user-inventory-item`, { itemId: item.id, quantity }, this.requestOptions);
|
|
42957
42959
|
const userInventoryItemFactory = new UserInventoryItemFactory(this.topia);
|
|
42958
42960
|
const { inventoryItem, user_id, quantity: newQuantity } = response.data;
|
|
@@ -42982,8 +42984,9 @@ class User extends SDKController {
|
|
|
42982
42984
|
modifyInventoryItemQuantity(item, quantity) {
|
|
42983
42985
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42984
42986
|
try {
|
|
42985
|
-
if (!this.profileId)
|
|
42987
|
+
if (!this.profileId) {
|
|
42986
42988
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42989
|
+
}
|
|
42987
42990
|
const response = yield this.topiaPublicApi().put(`/user/inventory/${this.profileId}/update-user-inventory-item-quantity`, { userItemId: item.id, itemId: item.item_id, quantity }, this.requestOptions);
|
|
42988
42991
|
const userInventoryItemFactory = new UserInventoryItemFactory(this.topia);
|
|
42989
42992
|
const { inventoryItem, user_id, quantity: newQuantity } = response.data;
|
|
@@ -44624,7 +44627,7 @@ class DroppedAssetFactory extends SDKController {
|
|
|
44624
44627
|
*
|
|
44625
44628
|
* @returns {Promise<DroppedAsset>} Returns a new DroppedAsset object representing the placed asset in the world.
|
|
44626
44629
|
*/
|
|
44627
|
-
drop(asset, { assetScale = 1, clickType, clickableDisplayTextDescription, clickableDisplayTextHeadline, clickableLink, clickableLinkTitle, flipped, interactivePublicKey, isInteractive, isForceLinkInIframe, isOpenLinkInDrawer, isTextTopLayer = false, layer0, layer1, position: { x, y }, sceneDropId, text, textColor, textFontFamily, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }) {
|
|
44630
|
+
drop(asset, { assetScale = 1, clickType, clickableDisplayTextDescription, clickableDisplayTextHeadline, clickableLayer, clickableLink, clickableLinkTitle, flipped, interactivePublicKey, isInteractive, isForceLinkInIframe, isOpenLinkInDrawer, isTextTopLayer = false, layer0, layer1, position: { x, y }, sceneDropId, text, textColor, textFontFamily, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }) {
|
|
44628
44631
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44629
44632
|
let specialType = null;
|
|
44630
44633
|
if (layer0 || layer1)
|
|
@@ -44636,6 +44639,7 @@ class DroppedAssetFactory extends SDKController {
|
|
|
44636
44639
|
clickType,
|
|
44637
44640
|
clickableDisplayTextDescription,
|
|
44638
44641
|
clickableDisplayTextHeadline,
|
|
44642
|
+
clickableLayer,
|
|
44639
44643
|
clickableLink,
|
|
44640
44644
|
clickableLinkTitle,
|
|
44641
44645
|
flipped,
|
package/dist/index.d.ts
CHANGED
|
@@ -65,6 +65,10 @@ declare enum DroppedAssetMediaVolumeRadius {
|
|
|
65
65
|
FAR = 2,
|
|
66
66
|
EVERYWHERE = 3
|
|
67
67
|
}
|
|
68
|
+
declare enum DroppedAssetClickableLayerType {
|
|
69
|
+
TOP = "top",
|
|
70
|
+
BOTTOM = "bottom"
|
|
71
|
+
}
|
|
68
72
|
type DroppedAssetLinkType = {
|
|
69
73
|
clickableLink: string;
|
|
70
74
|
clickableLinkTitle?: string;
|
|
@@ -74,7 +78,7 @@ type DroppedAssetLinkType = {
|
|
|
74
78
|
linkSamlQueryParams?: string;
|
|
75
79
|
};
|
|
76
80
|
|
|
77
|
-
type InteractiveCredentials
|
|
81
|
+
type InteractiveCredentials = {
|
|
78
82
|
apiKey?: string;
|
|
79
83
|
assetId?: string;
|
|
80
84
|
interactiveNonce?: string;
|
|
@@ -88,22 +92,22 @@ type InteractiveCredentials$1 = {
|
|
|
88
92
|
|
|
89
93
|
type AssetOptions = {
|
|
90
94
|
attributes?: AssetInterface | undefined;
|
|
91
|
-
credentials?: InteractiveCredentials
|
|
95
|
+
credentials?: InteractiveCredentials | undefined;
|
|
92
96
|
};
|
|
93
97
|
type DroppedAssetOptions = {
|
|
94
98
|
attributes?: DroppedAssetInterface | undefined;
|
|
95
|
-
credentials?: InteractiveCredentials
|
|
99
|
+
credentials?: InteractiveCredentials | undefined;
|
|
96
100
|
};
|
|
97
101
|
type UserOptions = {
|
|
98
|
-
credentials?: InteractiveCredentials
|
|
102
|
+
credentials?: InteractiveCredentials | undefined;
|
|
99
103
|
};
|
|
100
104
|
type VisitorOptions = {
|
|
101
105
|
attributes?: VisitorInterface | undefined;
|
|
102
|
-
credentials?: InteractiveCredentials
|
|
106
|
+
credentials?: InteractiveCredentials | undefined;
|
|
103
107
|
};
|
|
104
108
|
type WorldOptions = {
|
|
105
109
|
attributes?: WorldDetailsInterface | undefined;
|
|
106
|
-
credentials?: InteractiveCredentials
|
|
110
|
+
credentials?: InteractiveCredentials | undefined;
|
|
107
111
|
};
|
|
108
112
|
|
|
109
113
|
type ResponseType = {
|
|
@@ -2343,7 +2347,7 @@ declare enum WorldActivityType {
|
|
|
2343
2347
|
}
|
|
2344
2348
|
|
|
2345
2349
|
interface SDKInterface {
|
|
2346
|
-
credentials?: InteractiveCredentials
|
|
2350
|
+
credentials?: InteractiveCredentials;
|
|
2347
2351
|
jwt?: string;
|
|
2348
2352
|
requestOptions: object;
|
|
2349
2353
|
topia: Topia;
|
|
@@ -2380,7 +2384,7 @@ interface AssetInterface extends SDKInterface {
|
|
|
2380
2384
|
}
|
|
2381
2385
|
type AssetOptionalInterface = {
|
|
2382
2386
|
attributes?: AssetInterface | object;
|
|
2383
|
-
credentials?: InteractiveCredentials
|
|
2387
|
+
credentials?: InteractiveCredentials;
|
|
2384
2388
|
};
|
|
2385
2389
|
|
|
2386
2390
|
interface DroppedAssetInterface extends AssetInterface {
|
|
@@ -2502,7 +2506,7 @@ interface DroppedAssetOptionalInterface {
|
|
|
2502
2506
|
text?: string;
|
|
2503
2507
|
urlSlug?: string;
|
|
2504
2508
|
};
|
|
2505
|
-
credentials?: InteractiveCredentials
|
|
2509
|
+
credentials?: InteractiveCredentials | object;
|
|
2506
2510
|
}
|
|
2507
2511
|
interface UpdateBroadcastInterface {
|
|
2508
2512
|
assetBroadcast?: boolean;
|
|
@@ -2594,7 +2598,7 @@ interface EcosystemInterface extends SDKInterface {
|
|
|
2594
2598
|
incrementDataObjectValue(path: string, amount: number, options: object): Promise<void | ResponseType>;
|
|
2595
2599
|
}
|
|
2596
2600
|
interface EcosystemOptionalInterface {
|
|
2597
|
-
credentials?: InteractiveCredentials
|
|
2601
|
+
credentials?: InteractiveCredentials;
|
|
2598
2602
|
}
|
|
2599
2603
|
|
|
2600
2604
|
interface SceneInterface {
|
|
@@ -2622,7 +2626,7 @@ interface SceneInterface {
|
|
|
2622
2626
|
}
|
|
2623
2627
|
type SceneOptionalInterface = {
|
|
2624
2628
|
attributes?: SceneInterface | object;
|
|
2625
|
-
credentials?: InteractiveCredentials
|
|
2629
|
+
credentials?: InteractiveCredentials;
|
|
2626
2630
|
};
|
|
2627
2631
|
|
|
2628
2632
|
interface FireToastInterface {
|
|
@@ -2670,7 +2674,7 @@ interface UserInterface {
|
|
|
2670
2674
|
dataObject?: object | null;
|
|
2671
2675
|
}
|
|
2672
2676
|
interface UserOptionalInterface {
|
|
2673
|
-
credentials?: InteractiveCredentials
|
|
2677
|
+
credentials?: InteractiveCredentials;
|
|
2674
2678
|
profileId?: string | null;
|
|
2675
2679
|
visitorId?: number | null;
|
|
2676
2680
|
urlSlug?: string;
|
|
@@ -2746,7 +2750,7 @@ interface VisitorInterface extends SDKInterface {
|
|
|
2746
2750
|
}
|
|
2747
2751
|
interface VisitorOptionalInterface {
|
|
2748
2752
|
attributes?: VisitorInterface | object;
|
|
2749
|
-
credentials?: InteractiveCredentials
|
|
2753
|
+
credentials?: InteractiveCredentials;
|
|
2750
2754
|
}
|
|
2751
2755
|
interface MoveVisitorInterface {
|
|
2752
2756
|
shouldTeleportVisitor: boolean;
|
|
@@ -2812,12 +2816,12 @@ interface WebRTCConnectorInterface {
|
|
|
2812
2816
|
getTwilioConfig(): Promise<void | ResponseType>;
|
|
2813
2817
|
}
|
|
2814
2818
|
interface WebRTCConnectorOptionalInterface {
|
|
2815
|
-
credentials?: InteractiveCredentials
|
|
2819
|
+
credentials?: InteractiveCredentials;
|
|
2816
2820
|
twilioConfig?: object;
|
|
2817
2821
|
}
|
|
2818
2822
|
|
|
2819
2823
|
interface WorldActivityOptionalInterface {
|
|
2820
|
-
credentials?: InteractiveCredentials
|
|
2824
|
+
credentials?: InteractiveCredentials;
|
|
2821
2825
|
}
|
|
2822
2826
|
interface MoveAllVisitorsInterface {
|
|
2823
2827
|
shouldFetchVisitors?: boolean;
|
|
@@ -2907,24 +2911,12 @@ interface WorldInterface extends SDKInterface, WorldDetailsInterface {
|
|
|
2907
2911
|
}
|
|
2908
2912
|
interface WorldOptionalInterface {
|
|
2909
2913
|
attributes?: WorldDetailsInterface | object;
|
|
2910
|
-
credentials?: InteractiveCredentials
|
|
2914
|
+
credentials?: InteractiveCredentials;
|
|
2911
2915
|
}
|
|
2912
2916
|
interface WorldWebhooksInterface {
|
|
2913
2917
|
webhooks: Array<WebhookInterface>;
|
|
2914
2918
|
}
|
|
2915
2919
|
|
|
2916
|
-
type InteractiveCredentials = {
|
|
2917
|
-
apiKey?: string;
|
|
2918
|
-
assetId?: string;
|
|
2919
|
-
interactiveNonce?: string;
|
|
2920
|
-
interactivePublicKey?: string;
|
|
2921
|
-
profileId?: string | null;
|
|
2922
|
-
urlSlug?: string;
|
|
2923
|
-
visitorId?: number;
|
|
2924
|
-
iframeId?: string;
|
|
2925
|
-
gameEngineId?: string;
|
|
2926
|
-
};
|
|
2927
|
-
|
|
2928
2920
|
/**
|
|
2929
2921
|
* Interface for an inventory item.
|
|
2930
2922
|
*/
|
|
@@ -3041,11 +3033,11 @@ declare class Topia implements TopiaInterface {
|
|
|
3041
3033
|
* ```
|
|
3042
3034
|
*/
|
|
3043
3035
|
declare abstract class SDKController implements SDKInterface {
|
|
3044
|
-
credentials: InteractiveCredentials
|
|
3036
|
+
credentials: InteractiveCredentials | undefined;
|
|
3045
3037
|
jwt?: string;
|
|
3046
3038
|
requestOptions: object;
|
|
3047
3039
|
topia: Topia;
|
|
3048
|
-
constructor(topia: Topia, credentials?: InteractiveCredentials
|
|
3040
|
+
constructor(topia: Topia, credentials?: InteractiveCredentials);
|
|
3049
3041
|
/**
|
|
3050
3042
|
* Returns the configured Axios instance for making API calls to Topia's Public API.
|
|
3051
3043
|
*
|
|
@@ -3685,7 +3677,7 @@ declare class DroppedAssetFactory extends SDKController {
|
|
|
3685
3677
|
*
|
|
3686
3678
|
* @returns {Promise<DroppedAsset>} Returns a new DroppedAsset object with all properties already fetched.
|
|
3687
3679
|
*/
|
|
3688
|
-
getWithUniqueName(uniqueName: string, urlSlug: string, interactiveSecret: string, credentials: InteractiveCredentials
|
|
3680
|
+
getWithUniqueName(uniqueName: string, urlSlug: string, interactiveSecret: string, credentials: InteractiveCredentials): Promise<DroppedAsset>;
|
|
3689
3681
|
/**
|
|
3690
3682
|
* Drops an asset in a world and returns a new instance of DroppedAsset class with all properties.
|
|
3691
3683
|
*
|
|
@@ -3743,12 +3735,13 @@ declare class DroppedAssetFactory extends SDKController {
|
|
|
3743
3735
|
*
|
|
3744
3736
|
* @returns {Promise<DroppedAsset>} Returns a new DroppedAsset object representing the placed asset in the world.
|
|
3745
3737
|
*/
|
|
3746
|
-
drop(asset: Asset, { assetScale, clickType, clickableDisplayTextDescription, clickableDisplayTextHeadline, clickableLink, clickableLinkTitle, flipped, interactivePublicKey, isInteractive, isForceLinkInIframe, isOpenLinkInDrawer, isTextTopLayer, layer0, layer1, position: { x, y }, sceneDropId, text, textColor, textFontFamily, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }: {
|
|
3738
|
+
drop(asset: Asset, { assetScale, clickType, clickableDisplayTextDescription, clickableDisplayTextHeadline, clickableLayer, clickableLink, clickableLinkTitle, flipped, interactivePublicKey, isInteractive, isForceLinkInIframe, isOpenLinkInDrawer, isTextTopLayer, layer0, layer1, position: { x, y }, sceneDropId, text, textColor, textFontFamily, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }: {
|
|
3747
3739
|
assetScale?: number;
|
|
3748
3740
|
flipped?: boolean;
|
|
3749
|
-
clickType?:
|
|
3741
|
+
clickType?: DroppedAssetClickType;
|
|
3750
3742
|
clickableDisplayTextDescription?: string;
|
|
3751
3743
|
clickableDisplayTextHeadline?: string;
|
|
3744
|
+
clickableLayer?: DroppedAssetClickableLayerType;
|
|
3752
3745
|
clickableLink?: string;
|
|
3753
3746
|
clickableLinkTitle?: string;
|
|
3754
3747
|
interactivePublicKey?: string;
|
|
@@ -4267,4 +4260,4 @@ declare class WorldFactory extends SDKController {
|
|
|
4267
4260
|
}>;
|
|
4268
4261
|
}
|
|
4269
4262
|
|
|
4270
|
-
export { AnalyticType, AnimationMetaType, Asset, AssetFactory, AssetInterface, AssetOptionalInterface, AssetOptions, AssetType, CreateNpcOptions, DroppedAsset, DroppedAssetClickType, DroppedAssetFactory, DroppedAssetInterface, DroppedAssetLinkType, DroppedAssetMediaType, DroppedAssetMediaVolumeRadius, DroppedAssetOptionalInterface, DroppedAssetOptions, Ecosystem, EcosystemFactory, EcosystemInterface, EcosystemOptionalInterface, FireToastInterface, FrameType, InteractiveCredentials
|
|
4263
|
+
export { AnalyticType, AnimationMetaType, Asset, AssetFactory, AssetInterface, AssetOptionalInterface, AssetOptions, AssetType, CreateNpcOptions, DroppedAsset, DroppedAssetClickType, DroppedAssetClickableLayerType, DroppedAssetFactory, DroppedAssetInterface, DroppedAssetLinkType, DroppedAssetMediaType, DroppedAssetMediaVolumeRadius, DroppedAssetOptionalInterface, DroppedAssetOptions, Ecosystem, EcosystemFactory, EcosystemInterface, EcosystemOptionalInterface, FireToastInterface, FrameType, InteractiveCredentials, InventoryItemInterface, InventoryItemOptionalInterface, MoveAllVisitorsInterface, MoveVisitorInterface, NpcVoiceConfigInterface, OpenIframeInterface, RemoveClickableLinkInterface, ResponseType, SDKController, SDKInterface, Scene, SceneFactory, SceneInterface, SceneOptionalInterface, SetClickableLinkMultiInterface, SpawnEffectConfig, Topia, TopiaInterface, UpdateBroadcastInterface, UpdateClickTypeInterface, UpdateClickableLinkMultiInterface, UpdateDroppedAssetInterface, UpdateMediaTypeInterface, UpdatePrivateZoneInterface, User, UserFactory, UserInterface, UserInventoryItemInterface, UserInventoryItemMetadataType, UserInventoryItemOptionalInterface, UserOptionalInterface, UserOptions, Visitor, VisitorFactory, VisitorInterface, VisitorOptionalInterface, VisitorOptions, VisitorType, VisitorsToMoveArrayType, VisitorsToMoveType, WebRTCConnector, WebRTCConnectorFactory, WebRTCConnectorInterface, WebRTCConnectorOptionalInterface, WebhookInterface, World, WorldActivity, WorldActivityFactory, WorldActivityOptionalInterface, WorldActivityType, WorldDetailsInterface, WorldFactory, WorldInterface, WorldOptionalInterface, WorldOptions, WorldWebhooksInterface };
|
package/dist/index.js
CHANGED
|
@@ -39908,7 +39908,12 @@ var DroppedAssetMediaVolumeRadius;
|
|
|
39908
39908
|
DroppedAssetMediaVolumeRadius[DroppedAssetMediaVolumeRadius["MEDIUM"] = 1] = "MEDIUM";
|
|
39909
39909
|
DroppedAssetMediaVolumeRadius[DroppedAssetMediaVolumeRadius["FAR"] = 2] = "FAR";
|
|
39910
39910
|
DroppedAssetMediaVolumeRadius[DroppedAssetMediaVolumeRadius["EVERYWHERE"] = 3] = "EVERYWHERE";
|
|
39911
|
-
})(DroppedAssetMediaVolumeRadius || (DroppedAssetMediaVolumeRadius = {}));
|
|
39911
|
+
})(DroppedAssetMediaVolumeRadius || (DroppedAssetMediaVolumeRadius = {}));
|
|
39912
|
+
var DroppedAssetClickableLayerType;
|
|
39913
|
+
(function (DroppedAssetClickableLayerType) {
|
|
39914
|
+
DroppedAssetClickableLayerType["TOP"] = "top";
|
|
39915
|
+
DroppedAssetClickableLayerType["BOTTOM"] = "bottom";
|
|
39916
|
+
})(DroppedAssetClickableLayerType || (DroppedAssetClickableLayerType = {}));
|
|
39912
39917
|
|
|
39913
39918
|
var WorldActivityType;
|
|
39914
39919
|
(function (WorldActivityType) {
|
|
@@ -42261,7 +42266,6 @@ AI RULES for code assistants
|
|
|
42261
42266
|
*/
|
|
42262
42267
|
class User extends SDKController {
|
|
42263
42268
|
constructor(topia, options = { profileId: null, credentials: {} }) {
|
|
42264
|
-
var _a;
|
|
42265
42269
|
super(topia, Object.assign({ profileId: options === null || options === void 0 ? void 0 : options.profileId }, options.credentials));
|
|
42266
42270
|
_User_userInventoryItems.set(this, void 0);
|
|
42267
42271
|
_User_adminWorldsMap.set(this, void 0);
|
|
@@ -42269,13 +42273,6 @@ class User extends SDKController {
|
|
|
42269
42273
|
_User_scenesMap.set(this, void 0);
|
|
42270
42274
|
_User_worldsMap.set(this, void 0);
|
|
42271
42275
|
this.profileId = options === null || options === void 0 ? void 0 : options.profileId;
|
|
42272
|
-
// Warn devs about common mistake: passing profileId only inside credentials
|
|
42273
|
-
if (!this.profileId && ((_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.profileId)) {
|
|
42274
|
-
console.warn(`[@rtsdk/topia] User created without top-level profileId. ` +
|
|
42275
|
-
`You passed profileId inside credentials but not in options. ` +
|
|
42276
|
-
`Methods like grantInventoryItem will fail. ` +
|
|
42277
|
-
`Fix: User.create({ profileId: "${options.credentials.profileId}", credentials: { ... } })`);
|
|
42278
|
-
}
|
|
42279
42276
|
this.dataObject = {};
|
|
42280
42277
|
this.profile = {};
|
|
42281
42278
|
__classPrivateFieldSet(this, _User_adminWorldsMap, {}, "f");
|
|
@@ -42788,8 +42785,9 @@ class User extends SDKController {
|
|
|
42788
42785
|
fetchDataObject(appPublicKey, appJWT) {
|
|
42789
42786
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42790
42787
|
try {
|
|
42791
|
-
if (!this.profileId)
|
|
42788
|
+
if (!this.profileId) {
|
|
42792
42789
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42790
|
+
}
|
|
42793
42791
|
let query = "";
|
|
42794
42792
|
if (appPublicKey)
|
|
42795
42793
|
query = `?appPublicKey=${appPublicKey}&appJWT=${appJWT}`;
|
|
@@ -42828,8 +42826,9 @@ class User extends SDKController {
|
|
|
42828
42826
|
setDataObject(dataObject, options = {}) {
|
|
42829
42827
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42830
42828
|
try {
|
|
42831
|
-
if (!this.profileId)
|
|
42829
|
+
if (!this.profileId) {
|
|
42832
42830
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42831
|
+
}
|
|
42833
42832
|
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/set-data-object`, Object.assign(Object.assign({}, options), { dataObject: dataObject || this.dataObject }), this.requestOptions);
|
|
42834
42833
|
this.dataObject = dataObject || this.dataObject;
|
|
42835
42834
|
}
|
|
@@ -42862,8 +42861,9 @@ class User extends SDKController {
|
|
|
42862
42861
|
updateDataObject(dataObject, options = {}) {
|
|
42863
42862
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42864
42863
|
try {
|
|
42865
|
-
if (!this.profileId)
|
|
42864
|
+
if (!this.profileId) {
|
|
42866
42865
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42866
|
+
}
|
|
42867
42867
|
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/update-data-object`, Object.assign(Object.assign({}, options), { dataObject: dataObject || this.dataObject }), this.requestOptions);
|
|
42868
42868
|
this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
|
|
42869
42869
|
}
|
|
@@ -42912,8 +42912,9 @@ class User extends SDKController {
|
|
|
42912
42912
|
fetchInventoryItems() {
|
|
42913
42913
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42914
42914
|
try {
|
|
42915
|
-
if (!this.profileId)
|
|
42915
|
+
if (!this.profileId) {
|
|
42916
42916
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42917
|
+
}
|
|
42917
42918
|
const response = yield this.topiaPublicApi().get(`/user/inventory/${this.profileId}/get-user-inventory-items`, this.requestOptions);
|
|
42918
42919
|
// TODO: Replace 'object' with InventoryItem and instantiate InventoryItem objects if needed
|
|
42919
42920
|
const tempItems = [];
|
|
@@ -42949,8 +42950,9 @@ class User extends SDKController {
|
|
|
42949
42950
|
grantInventoryItem(item, quantity = 1) {
|
|
42950
42951
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42951
42952
|
try {
|
|
42952
|
-
if (!this.profileId)
|
|
42953
|
+
if (!this.profileId) {
|
|
42953
42954
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42955
|
+
}
|
|
42954
42956
|
const response = yield this.topiaPublicApi().put(`/user/inventory/${this.profileId}/grant-user-inventory-item`, { itemId: item.id, quantity }, this.requestOptions);
|
|
42955
42957
|
const userInventoryItemFactory = new UserInventoryItemFactory(this.topia);
|
|
42956
42958
|
const { inventoryItem, user_id, quantity: newQuantity } = response.data;
|
|
@@ -42980,8 +42982,9 @@ class User extends SDKController {
|
|
|
42980
42982
|
modifyInventoryItemQuantity(item, quantity) {
|
|
42981
42983
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42982
42984
|
try {
|
|
42983
|
-
if (!this.profileId)
|
|
42985
|
+
if (!this.profileId) {
|
|
42984
42986
|
throw new Error("This method requires the use of a profileId. Pass profileId as a top-level option: User.create({ profileId, credentials: { ... } })");
|
|
42987
|
+
}
|
|
42985
42988
|
const response = yield this.topiaPublicApi().put(`/user/inventory/${this.profileId}/update-user-inventory-item-quantity`, { userItemId: item.id, itemId: item.item_id, quantity }, this.requestOptions);
|
|
42986
42989
|
const userInventoryItemFactory = new UserInventoryItemFactory(this.topia);
|
|
42987
42990
|
const { inventoryItem, user_id, quantity: newQuantity } = response.data;
|
|
@@ -44622,7 +44625,7 @@ class DroppedAssetFactory extends SDKController {
|
|
|
44622
44625
|
*
|
|
44623
44626
|
* @returns {Promise<DroppedAsset>} Returns a new DroppedAsset object representing the placed asset in the world.
|
|
44624
44627
|
*/
|
|
44625
|
-
drop(asset, { assetScale = 1, clickType, clickableDisplayTextDescription, clickableDisplayTextHeadline, clickableLink, clickableLinkTitle, flipped, interactivePublicKey, isInteractive, isForceLinkInIframe, isOpenLinkInDrawer, isTextTopLayer = false, layer0, layer1, position: { x, y }, sceneDropId, text, textColor, textFontFamily, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }) {
|
|
44628
|
+
drop(asset, { assetScale = 1, clickType, clickableDisplayTextDescription, clickableDisplayTextHeadline, clickableLayer, clickableLink, clickableLinkTitle, flipped, interactivePublicKey, isInteractive, isForceLinkInIframe, isOpenLinkInDrawer, isTextTopLayer = false, layer0, layer1, position: { x, y }, sceneDropId, text, textColor, textFontFamily, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }) {
|
|
44626
44629
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44627
44630
|
let specialType = null;
|
|
44628
44631
|
if (layer0 || layer1)
|
|
@@ -44634,6 +44637,7 @@ class DroppedAssetFactory extends SDKController {
|
|
|
44634
44637
|
clickType,
|
|
44635
44638
|
clickableDisplayTextDescription,
|
|
44636
44639
|
clickableDisplayTextHeadline,
|
|
44640
|
+
clickableLayer,
|
|
44637
44641
|
clickableLink,
|
|
44638
44642
|
clickableLinkTitle,
|
|
44639
44643
|
flipped,
|
|
@@ -45476,4 +45480,4 @@ process.on("uncaughtException", function (err) {
|
|
|
45476
45480
|
process.exit(1);
|
|
45477
45481
|
});
|
|
45478
45482
|
|
|
45479
|
-
export { Asset, AssetFactory, DroppedAsset, DroppedAssetClickType, DroppedAssetFactory, DroppedAssetMediaType, DroppedAssetMediaVolumeRadius, Ecosystem, EcosystemFactory, SDKController, Scene, SceneFactory, Topia, User, UserFactory, Visitor, VisitorFactory, WebRTCConnector, WebRTCConnectorFactory, World, WorldActivity, WorldActivityFactory, WorldActivityType, WorldFactory };
|
|
45483
|
+
export { Asset, AssetFactory, DroppedAsset, DroppedAssetClickType, DroppedAssetClickableLayerType, DroppedAssetFactory, DroppedAssetMediaType, DroppedAssetMediaVolumeRadius, Ecosystem, EcosystemFactory, SDKController, Scene, SceneFactory, Topia, User, UserFactory, Visitor, VisitorFactory, WebRTCConnector, WebRTCConnectorFactory, World, WorldActivity, WorldActivityFactory, WorldActivityType, WorldFactory };
|
package/package.json
CHANGED