@rtsdk/topia 0.15.2 → 0.15.4
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 +64 -69
- package/dist/index.d.ts +45 -23
- package/dist/index.js +64 -69
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -39649,6 +39649,8 @@ class SDKController {
|
|
|
39649
39649
|
interactiveNonce,
|
|
39650
39650
|
visitorId,
|
|
39651
39651
|
assetId,
|
|
39652
|
+
urlSlug,
|
|
39653
|
+
profileId,
|
|
39652
39654
|
date: new Date(),
|
|
39653
39655
|
};
|
|
39654
39656
|
this.jwt = jwt.sign(payload, topia.interactiveSecret);
|
|
@@ -39715,23 +39717,16 @@ class SDKController {
|
|
|
39715
39717
|
*
|
|
39716
39718
|
* @usage
|
|
39717
39719
|
* ```ts
|
|
39718
|
-
* await new Asset(topia, "
|
|
39720
|
+
* await new Asset(topia, "id", {
|
|
39719
39721
|
* attributes: { assetName: "My Asset", isPublic: false },
|
|
39720
|
-
* credentials: {
|
|
39722
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
39721
39723
|
* });
|
|
39722
39724
|
* ```
|
|
39723
39725
|
*/
|
|
39724
39726
|
class Asset extends SDKController {
|
|
39725
39727
|
constructor(topia, id, options = { attributes: {}, credentials: {} }) {
|
|
39726
|
-
|
|
39727
|
-
|
|
39728
|
-
super(topia, {
|
|
39729
|
-
apiKey: (_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.apiKey,
|
|
39730
|
-
assetId: (_b = options === null || options === void 0 ? void 0 : options.credentials) === null || _b === void 0 ? void 0 : _b.assetId,
|
|
39731
|
-
interactiveNonce: (_c = options === null || options === void 0 ? void 0 : options.credentials) === null || _c === void 0 ? void 0 : _c.interactiveNonce,
|
|
39732
|
-
urlSlug: (_d = options === null || options === void 0 ? void 0 : options.credentials) === null || _d === void 0 ? void 0 : _d.urlSlug,
|
|
39733
|
-
visitorId: (_e = options === null || options === void 0 ? void 0 : options.credentials) === null || _e === void 0 ? void 0 : _e.visitorId,
|
|
39734
|
-
});
|
|
39728
|
+
// options.credentials.assetId is the dropped asset id and is used to validate the interactive credentials. It should NOT match the id that's passed to the constructor.
|
|
39729
|
+
super(topia, Object.assign({}, options.credentials));
|
|
39735
39730
|
this.id = id;
|
|
39736
39731
|
Object.assign(this, options.attributes);
|
|
39737
39732
|
}
|
|
@@ -39811,6 +39806,13 @@ var DroppedAssetMediaType;
|
|
|
39811
39806
|
DroppedAssetMediaType["LINK"] = "link";
|
|
39812
39807
|
})(DroppedAssetMediaType || (DroppedAssetMediaType = {}));
|
|
39813
39808
|
|
|
39809
|
+
var WorldActivityTypes;
|
|
39810
|
+
(function (WorldActivityTypes) {
|
|
39811
|
+
WorldActivityTypes["GAME_ON"] = "GAME_ON";
|
|
39812
|
+
WorldActivityTypes["GAME_WAITING"] = "GAME_WAITING";
|
|
39813
|
+
WorldActivityTypes["GAME_HIGH_SCORE"] = "GAME_HIGH_SCORE";
|
|
39814
|
+
})(WorldActivityTypes || (WorldActivityTypes = {}));
|
|
39815
|
+
|
|
39814
39816
|
const getBrowserWarning = () => {
|
|
39815
39817
|
if (typeof window !== "undefined") {
|
|
39816
39818
|
console.warn("Please use extreme caution when passing sensitive information such as API keys from a client side application.");
|
|
@@ -39846,8 +39848,8 @@ var _DroppedAsset_updateDroppedAsset;
|
|
|
39846
39848
|
* @usage
|
|
39847
39849
|
* ```ts
|
|
39848
39850
|
* await new DroppedAsset(topia, "1giFZb0sQ3X27L7uGyQX", "example", {
|
|
39849
|
-
* attributes: { text: "My Asset" },
|
|
39850
|
-
* credentials: {
|
|
39851
|
+
* attributes: { text: "My Dropped Asset" },
|
|
39852
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
39851
39853
|
* });
|
|
39852
39854
|
* ```
|
|
39853
39855
|
*/
|
|
@@ -40480,19 +40482,13 @@ _DroppedAsset_updateDroppedAsset = new WeakMap();
|
|
|
40480
40482
|
* ```ts
|
|
40481
40483
|
* await new Scene(topia, "sceneId", {
|
|
40482
40484
|
* attributes: { name: "My Scene" },
|
|
40483
|
-
* credentials: {
|
|
40485
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
40484
40486
|
* });
|
|
40485
40487
|
* ```
|
|
40486
40488
|
*/
|
|
40487
40489
|
class Scene extends SDKController {
|
|
40488
40490
|
constructor(topia, id, options = { attributes: {}, credentials: {} }) {
|
|
40489
|
-
|
|
40490
|
-
super(topia, {
|
|
40491
|
-
apiKey: (_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.apiKey,
|
|
40492
|
-
interactiveNonce: (_b = options === null || options === void 0 ? void 0 : options.credentials) === null || _b === void 0 ? void 0 : _b.interactiveNonce,
|
|
40493
|
-
urlSlug: (_c = options === null || options === void 0 ? void 0 : options.credentials) === null || _c === void 0 ? void 0 : _c.urlSlug,
|
|
40494
|
-
visitorId: (_d = options === null || options === void 0 ? void 0 : options.credentials) === null || _d === void 0 ? void 0 : _d.visitorId,
|
|
40495
|
-
});
|
|
40491
|
+
super(topia, Object.assign({}, options.credentials));
|
|
40496
40492
|
this.id = id;
|
|
40497
40493
|
Object.assign(this, options.attributes);
|
|
40498
40494
|
}
|
|
@@ -40566,19 +40562,14 @@ var _World_droppedAssetsMap;
|
|
|
40566
40562
|
* ```ts
|
|
40567
40563
|
* await new World(topia, "exampleWorld", {
|
|
40568
40564
|
* attributes: { name: "Example World" },
|
|
40569
|
-
* credentials: {
|
|
40565
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
40570
40566
|
* });
|
|
40571
40567
|
* ```
|
|
40572
40568
|
*/
|
|
40573
40569
|
class World extends SDKController {
|
|
40574
40570
|
constructor(topia, urlSlug, options = { attributes: {}, credentials: {} }) {
|
|
40575
|
-
var _a
|
|
40576
|
-
super(topia, {
|
|
40577
|
-
apiKey: (_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.apiKey,
|
|
40578
|
-
interactiveNonce: (_b = options === null || options === void 0 ? void 0 : options.credentials) === null || _b === void 0 ? void 0 : _b.interactiveNonce,
|
|
40579
|
-
urlSlug: ((_c = options === null || options === void 0 ? void 0 : options.credentials) === null || _c === void 0 ? void 0 : _c.urlSlug) || urlSlug,
|
|
40580
|
-
visitorId: (_d = options === null || options === void 0 ? void 0 : options.credentials) === null || _d === void 0 ? void 0 : _d.visitorId,
|
|
40581
|
-
});
|
|
40571
|
+
var _a;
|
|
40572
|
+
super(topia, Object.assign({ urlSlug: ((_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.urlSlug) || urlSlug }, options.credentials));
|
|
40582
40573
|
_World_droppedAssetsMap.set(this, void 0);
|
|
40583
40574
|
////////// data objects
|
|
40584
40575
|
/**
|
|
@@ -41104,6 +41095,27 @@ class World extends SDKController {
|
|
|
41104
41095
|
}
|
|
41105
41096
|
});
|
|
41106
41097
|
}
|
|
41098
|
+
/**
|
|
41099
|
+
* @summary
|
|
41100
|
+
* Add an activity to a world
|
|
41101
|
+
* excludeFromNotification is an array of visitorIds to exclude from the notification
|
|
41102
|
+
*
|
|
41103
|
+
* @usage
|
|
41104
|
+
* ```ts
|
|
41105
|
+
* await world.triggerActivity({ type: "GAME_ON", assetId: "abc123" });
|
|
41106
|
+
* ```
|
|
41107
|
+
*/
|
|
41108
|
+
triggerActivity({ type, assetId, excludeFromNotification, }) {
|
|
41109
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41110
|
+
try {
|
|
41111
|
+
const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/set-activity`, { type, assetId, excludeFromNotification }, this.requestOptions);
|
|
41112
|
+
return result.data;
|
|
41113
|
+
}
|
|
41114
|
+
catch (error) {
|
|
41115
|
+
throw this.errorHandler({ error, params: { type }, sdkMethod: "World.triggerActivity" });
|
|
41116
|
+
}
|
|
41117
|
+
});
|
|
41118
|
+
}
|
|
41107
41119
|
/**
|
|
41108
41120
|
* @summary
|
|
41109
41121
|
* Display a message via a toast to all visitors currently in a world.
|
|
@@ -41234,22 +41246,13 @@ var _User_adminWorldsMap, _User_assetsMap, _User_scenesMap, _User_worldsMap;
|
|
|
41234
41246
|
* ```ts
|
|
41235
41247
|
* await new User(topia, {
|
|
41236
41248
|
* profileId: 1,
|
|
41237
|
-
* credentials: {
|
|
41249
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
41238
41250
|
* });
|
|
41239
41251
|
* ```
|
|
41240
41252
|
*/
|
|
41241
41253
|
class User extends SDKController {
|
|
41242
41254
|
constructor(topia, options = { profileId: null, credentials: {} }) {
|
|
41243
|
-
|
|
41244
|
-
super(topia, {
|
|
41245
|
-
apiKey: (_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.apiKey,
|
|
41246
|
-
interactiveNonce: (_b = options === null || options === void 0 ? void 0 : options.credentials) === null || _b === void 0 ? void 0 : _b.interactiveNonce,
|
|
41247
|
-
profileId: options === null || options === void 0 ? void 0 : options.profileId,
|
|
41248
|
-
urlSlug: (_c = options === null || options === void 0 ? void 0 : options.credentials) === null || _c === void 0 ? void 0 : _c.urlSlug,
|
|
41249
|
-
visitorId: (_d = options === null || options === void 0 ? void 0 : options.credentials) === null || _d === void 0 ? void 0 : _d.visitorId,
|
|
41250
|
-
iframeId: (_e = options === null || options === void 0 ? void 0 : options.credentials) === null || _e === void 0 ? void 0 : _e.iframeId,
|
|
41251
|
-
gameEngineId: (_f = options === null || options === void 0 ? void 0 : options.credentials) === null || _f === void 0 ? void 0 : _f.gameEngineId,
|
|
41252
|
-
});
|
|
41255
|
+
super(topia, Object.assign({ profileId: options === null || options === void 0 ? void 0 : options.profileId }, options.credentials));
|
|
41253
41256
|
_User_adminWorldsMap.set(this, void 0);
|
|
41254
41257
|
_User_assetsMap.set(this, void 0);
|
|
41255
41258
|
_User_scenesMap.set(this, void 0);
|
|
@@ -41811,7 +41814,7 @@ _User_adminWorldsMap = new WeakMap(), _User_assetsMap = new WeakMap(), _User_sce
|
|
|
41811
41814
|
*
|
|
41812
41815
|
* @usage
|
|
41813
41816
|
* ```ts
|
|
41814
|
-
* await new Visitor(topia, id, urlSlug, { attributes: { moveTo: { x: 0, y: 0 } } });
|
|
41817
|
+
* await new Visitor(topia, id, urlSlug, { attributes: { moveTo: { x: 0, y: 0 } }, credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" } });
|
|
41815
41818
|
* ```
|
|
41816
41819
|
*/
|
|
41817
41820
|
class Visitor extends User {
|
|
@@ -42031,7 +42034,8 @@ class Visitor extends User {
|
|
|
42031
42034
|
*
|
|
42032
42035
|
* @usage
|
|
42033
42036
|
* ```ts
|
|
42034
|
-
* await visitor.grantExpression({
|
|
42037
|
+
* await visitor.grantExpression({ id: "exampleExpressionId" });
|
|
42038
|
+
* await visitor.grantExpression({ name: "exampleExpressionName" });
|
|
42035
42039
|
* ```
|
|
42036
42040
|
*/
|
|
42037
42041
|
grantExpression({ id, name }) {
|
|
@@ -42252,18 +42256,14 @@ class Visitor extends User {
|
|
|
42252
42256
|
* @usage
|
|
42253
42257
|
* ```ts
|
|
42254
42258
|
* await new WebRTCConnector(topia, {
|
|
42255
|
-
* credentials: { interactiveNonce: "exampleNonce",
|
|
42259
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
42256
42260
|
* });
|
|
42257
42261
|
* ```
|
|
42258
42262
|
*/
|
|
42259
42263
|
class WebRTCConnector extends SDKController {
|
|
42260
42264
|
constructor(topia, urlSlug, options = { twilioConfig: {}, credentials: {} }) {
|
|
42261
|
-
var _a
|
|
42262
|
-
super(topia, {
|
|
42263
|
-
interactiveNonce: (_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.interactiveNonce,
|
|
42264
|
-
urlSlug: (_b = options === null || options === void 0 ? void 0 : options.credentials) === null || _b === void 0 ? void 0 : _b.urlSlug,
|
|
42265
|
-
visitorId: (_c = options === null || options === void 0 ? void 0 : options.credentials) === null || _c === void 0 ? void 0 : _c.visitorId,
|
|
42266
|
-
});
|
|
42265
|
+
var _a;
|
|
42266
|
+
super(topia, Object.assign({ urlSlug: ((_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.urlSlug) || urlSlug }, options.credentials));
|
|
42267
42267
|
this.twilioConfig = options === null || options === void 0 ? void 0 : options.twilioConfig;
|
|
42268
42268
|
this.urlSlug = urlSlug;
|
|
42269
42269
|
}
|
|
@@ -42301,19 +42301,14 @@ var _WorldActivity_visitorsMap;
|
|
|
42301
42301
|
* ```ts
|
|
42302
42302
|
* await new WorldActivity(topia, "exampleWorld", {
|
|
42303
42303
|
* attributes: { name: "Example World" },
|
|
42304
|
-
* credentials: {
|
|
42304
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
42305
42305
|
* });
|
|
42306
42306
|
* ```
|
|
42307
42307
|
*/
|
|
42308
42308
|
class WorldActivity extends SDKController {
|
|
42309
42309
|
constructor(topia, urlSlug, options = { credentials: {} }) {
|
|
42310
|
-
var _a
|
|
42311
|
-
super(topia, {
|
|
42312
|
-
apiKey: (_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.apiKey,
|
|
42313
|
-
interactiveNonce: (_b = options === null || options === void 0 ? void 0 : options.credentials) === null || _b === void 0 ? void 0 : _b.interactiveNonce,
|
|
42314
|
-
urlSlug: ((_c = options === null || options === void 0 ? void 0 : options.credentials) === null || _c === void 0 ? void 0 : _c.urlSlug) || urlSlug,
|
|
42315
|
-
visitorId: (_d = options === null || options === void 0 ? void 0 : options.credentials) === null || _d === void 0 ? void 0 : _d.visitorId,
|
|
42316
|
-
});
|
|
42310
|
+
var _a;
|
|
42311
|
+
super(topia, Object.assign({ urlSlug: ((_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.urlSlug) || urlSlug }, options.credentials));
|
|
42317
42312
|
_WorldActivity_visitorsMap.set(this, void 0);
|
|
42318
42313
|
this.urlSlug = urlSlug;
|
|
42319
42314
|
__classPrivateFieldSet(this, _WorldActivity_visitorsMap, {}, "f");
|
|
@@ -42483,7 +42478,7 @@ class AssetFactory extends SDKController {
|
|
|
42483
42478
|
*
|
|
42484
42479
|
* @usage
|
|
42485
42480
|
* ```
|
|
42486
|
-
* const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42481
|
+
* const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42487
42482
|
* ```
|
|
42488
42483
|
*/
|
|
42489
42484
|
create(id, options) {
|
|
@@ -42539,7 +42534,7 @@ class DroppedAssetFactory extends SDKController {
|
|
|
42539
42534
|
*
|
|
42540
42535
|
* @usage
|
|
42541
42536
|
* ```
|
|
42542
|
-
* const droppedAssetInstance = await DroppedAsset.create(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42537
|
+
* const droppedAssetInstance = await DroppedAsset.create(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42543
42538
|
* ```
|
|
42544
42539
|
*/
|
|
42545
42540
|
create(id, urlSlug, options) {
|
|
@@ -42551,7 +42546,7 @@ class DroppedAssetFactory extends SDKController {
|
|
|
42551
42546
|
*
|
|
42552
42547
|
* @usage
|
|
42553
42548
|
* ```
|
|
42554
|
-
* const droppedAssetInstance = await DroppedAsset.get(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42549
|
+
* const droppedAssetInstance = await DroppedAsset.get(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42555
42550
|
* ```
|
|
42556
42551
|
*/
|
|
42557
42552
|
get(id, urlSlug, options) {
|
|
@@ -42598,7 +42593,7 @@ class DroppedAssetFactory extends SDKController {
|
|
|
42598
42593
|
*
|
|
42599
42594
|
* @usage
|
|
42600
42595
|
* ```
|
|
42601
|
-
* const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42596
|
+
* const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42602
42597
|
* const droppedAssetInstance = await DroppedAsset.get(assetInstance, {
|
|
42603
42598
|
assetScale: 1.5,
|
|
42604
42599
|
flipped: true,
|
|
@@ -42681,7 +42676,7 @@ class SceneFactory {
|
|
|
42681
42676
|
*
|
|
42682
42677
|
* @usage
|
|
42683
42678
|
* ```
|
|
42684
|
-
* const sceneInstance = await Scene.create(id, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42679
|
+
* const sceneInstance = await Scene.create(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42685
42680
|
* ```
|
|
42686
42681
|
*/
|
|
42687
42682
|
create(id, options) {
|
|
@@ -42693,7 +42688,7 @@ class SceneFactory {
|
|
|
42693
42688
|
*
|
|
42694
42689
|
* @usage
|
|
42695
42690
|
* ```
|
|
42696
|
-
* const sceneInstance = await Scene.get(id, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42691
|
+
* const sceneInstance = await Scene.get(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42697
42692
|
* ```
|
|
42698
42693
|
*/
|
|
42699
42694
|
get(id, options) {
|
|
@@ -42721,7 +42716,7 @@ class UserFactory {
|
|
|
42721
42716
|
*
|
|
42722
42717
|
* @usage
|
|
42723
42718
|
* ```
|
|
42724
|
-
* const userInstance = await User.create({ credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42719
|
+
* const userInstance = await User.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42725
42720
|
* ```
|
|
42726
42721
|
*/
|
|
42727
42722
|
create(options) {
|
|
@@ -42745,7 +42740,7 @@ class VisitorFactory {
|
|
|
42745
42740
|
*
|
|
42746
42741
|
* @usage
|
|
42747
42742
|
* ```
|
|
42748
|
-
* const visitorInstance = await Visitor.create(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42743
|
+
* const visitorInstance = await Visitor.create(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42749
42744
|
* ```
|
|
42750
42745
|
*/
|
|
42751
42746
|
create(id, urlSlug, options) {
|
|
@@ -42757,7 +42752,7 @@ class VisitorFactory {
|
|
|
42757
42752
|
*
|
|
42758
42753
|
* @usage
|
|
42759
42754
|
* ```
|
|
42760
|
-
* const visitorInstance = await Visitor.get(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42755
|
+
* const visitorInstance = await Visitor.get(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42761
42756
|
* ```
|
|
42762
42757
|
*/
|
|
42763
42758
|
get(id, urlSlug, options) {
|
|
@@ -42785,7 +42780,7 @@ class WebRTCConnectorFactory {
|
|
|
42785
42780
|
*
|
|
42786
42781
|
* @usage
|
|
42787
42782
|
* ```
|
|
42788
|
-
* const userInstance = await WebRTCConnector.create({ credentials: { interactiveNonce, interactivePublicKey, urlSlug, visitorId }, twilioConfig: {} });
|
|
42783
|
+
* const userInstance = await WebRTCConnector.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId }, twilioConfig: {} });
|
|
42789
42784
|
* ```
|
|
42790
42785
|
*/
|
|
42791
42786
|
create(urlSlug, options) {
|
|
@@ -42809,7 +42804,7 @@ class WorldActivityFactory {
|
|
|
42809
42804
|
*
|
|
42810
42805
|
* @usage
|
|
42811
42806
|
* ```
|
|
42812
|
-
* const worldActivityInstance = await WorldActivity.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42807
|
+
* const worldActivityInstance = await WorldActivity.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42813
42808
|
* ```
|
|
42814
42809
|
*/
|
|
42815
42810
|
create(urlSlug, options) {
|
|
@@ -42833,7 +42828,7 @@ class WorldFactory extends SDKController {
|
|
|
42833
42828
|
*
|
|
42834
42829
|
* @usage
|
|
42835
42830
|
* ```
|
|
42836
|
-
* const worldInstance = await World.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42831
|
+
* const worldInstance = await World.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42837
42832
|
* ```
|
|
42838
42833
|
*/
|
|
42839
42834
|
create(urlSlug, options) {
|
package/dist/index.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ type ResponseType$1 = {
|
|
|
79
79
|
* ```ts
|
|
80
80
|
* await new Scene(topia, "sceneId", {
|
|
81
81
|
* attributes: { name: "My Scene" },
|
|
82
|
-
* credentials: {
|
|
82
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
83
83
|
* });
|
|
84
84
|
* ```
|
|
85
85
|
*/
|
|
@@ -106,8 +106,8 @@ declare class Scene extends SDKController implements SceneInterface {
|
|
|
106
106
|
* @usage
|
|
107
107
|
* ```ts
|
|
108
108
|
* await new DroppedAsset(topia, "1giFZb0sQ3X27L7uGyQX", "example", {
|
|
109
|
-
* attributes: { text: "My Asset" },
|
|
110
|
-
* credentials: {
|
|
109
|
+
* attributes: { text: "My Dropped Asset" },
|
|
110
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
111
111
|
* });
|
|
112
112
|
* ```
|
|
113
113
|
*/
|
|
@@ -489,7 +489,7 @@ declare class DroppedAsset extends Asset implements DroppedAssetInterface {
|
|
|
489
489
|
* ```ts
|
|
490
490
|
* await new World(topia, "exampleWorld", {
|
|
491
491
|
* attributes: { name: "Example World" },
|
|
492
|
-
* credentials: {
|
|
492
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
493
493
|
* });
|
|
494
494
|
* ```
|
|
495
495
|
*/
|
|
@@ -755,6 +755,21 @@ declare class World extends SDKController implements WorldInterface {
|
|
|
755
755
|
duration?: number;
|
|
756
756
|
position?: object;
|
|
757
757
|
}): Promise<ResponseType$1 | string>;
|
|
758
|
+
/**
|
|
759
|
+
* @summary
|
|
760
|
+
* Add an activity to a world
|
|
761
|
+
* excludeFromNotification is an array of visitorIds to exclude from the notification
|
|
762
|
+
*
|
|
763
|
+
* @usage
|
|
764
|
+
* ```ts
|
|
765
|
+
* await world.triggerActivity({ type: "GAME_ON", assetId: "abc123" });
|
|
766
|
+
* ```
|
|
767
|
+
*/
|
|
768
|
+
triggerActivity({ type, assetId, excludeFromNotification, }: {
|
|
769
|
+
type: WorldActivityTypes;
|
|
770
|
+
assetId: string;
|
|
771
|
+
excludeFromNotification?: (string | number)[];
|
|
772
|
+
}): Promise<ResponseType$1 | string>;
|
|
758
773
|
/**
|
|
759
774
|
* @summary
|
|
760
775
|
* Display a message via a toast to all visitors currently in a world.
|
|
@@ -879,7 +894,7 @@ declare class World extends SDKController implements WorldInterface {
|
|
|
879
894
|
* ```ts
|
|
880
895
|
* await new User(topia, {
|
|
881
896
|
* profileId: 1,
|
|
882
|
-
* credentials: {
|
|
897
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
883
898
|
* });
|
|
884
899
|
* ```
|
|
885
900
|
*/
|
|
@@ -1251,7 +1266,7 @@ declare class User extends SDKController implements UserInterface {
|
|
|
1251
1266
|
*
|
|
1252
1267
|
* @usage
|
|
1253
1268
|
* ```ts
|
|
1254
|
-
* await new Visitor(topia, id, urlSlug, { attributes: { moveTo: { x: 0, y: 0 } } });
|
|
1269
|
+
* await new Visitor(topia, id, urlSlug, { attributes: { moveTo: { x: 0, y: 0 } }, credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" } });
|
|
1255
1270
|
* ```
|
|
1256
1271
|
*/
|
|
1257
1272
|
declare class Visitor extends User implements VisitorInterface {
|
|
@@ -1367,7 +1382,8 @@ declare class Visitor extends User implements VisitorInterface {
|
|
|
1367
1382
|
*
|
|
1368
1383
|
* @usage
|
|
1369
1384
|
* ```ts
|
|
1370
|
-
* await visitor.grantExpression({
|
|
1385
|
+
* await visitor.grantExpression({ id: "exampleExpressionId" });
|
|
1386
|
+
* await visitor.grantExpression({ name: "exampleExpressionName" });
|
|
1371
1387
|
* ```
|
|
1372
1388
|
*/
|
|
1373
1389
|
grantExpression({ id, name }: {
|
|
@@ -1523,6 +1539,12 @@ type VisitorsToMoveType = {
|
|
|
1523
1539
|
};
|
|
1524
1540
|
type VisitorsToMoveArrayType = Array<VisitorsToMoveType>;
|
|
1525
1541
|
|
|
1542
|
+
declare enum WorldActivityTypes {
|
|
1543
|
+
GAME_ON = "GAME_ON",
|
|
1544
|
+
GAME_WAITING = "GAME_WAITING",
|
|
1545
|
+
GAME_HIGH_SCORE = "GAME_HIGH_SCORE"
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1526
1548
|
interface SDKInterface {
|
|
1527
1549
|
credentials?: InteractiveCredentials;
|
|
1528
1550
|
jwt?: string;
|
|
@@ -2010,9 +2032,9 @@ declare abstract class SDKController implements SDKInterface {
|
|
|
2010
2032
|
*
|
|
2011
2033
|
* @usage
|
|
2012
2034
|
* ```ts
|
|
2013
|
-
* await new Asset(topia, "
|
|
2035
|
+
* await new Asset(topia, "id", {
|
|
2014
2036
|
* attributes: { assetName: "My Asset", isPublic: false },
|
|
2015
|
-
* credentials: {
|
|
2037
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
2016
2038
|
* });
|
|
2017
2039
|
* ```
|
|
2018
2040
|
*/
|
|
@@ -2066,7 +2088,7 @@ declare class Asset extends SDKController implements AssetInterface {
|
|
|
2066
2088
|
* @usage
|
|
2067
2089
|
* ```ts
|
|
2068
2090
|
* await new WebRTCConnector(topia, {
|
|
2069
|
-
* credentials: { interactiveNonce: "exampleNonce",
|
|
2091
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
2070
2092
|
* });
|
|
2071
2093
|
* ```
|
|
2072
2094
|
*/
|
|
@@ -2096,7 +2118,7 @@ declare class WebRTCConnector extends SDKController implements WebRTCConnectorIn
|
|
|
2096
2118
|
* ```ts
|
|
2097
2119
|
* await new WorldActivity(topia, "exampleWorld", {
|
|
2098
2120
|
* attributes: { name: "Example World" },
|
|
2099
|
-
* credentials: {
|
|
2121
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
2100
2122
|
* });
|
|
2101
2123
|
* ```
|
|
2102
2124
|
*/
|
|
@@ -2198,7 +2220,7 @@ declare class AssetFactory extends SDKController {
|
|
|
2198
2220
|
*
|
|
2199
2221
|
* @usage
|
|
2200
2222
|
* ```
|
|
2201
|
-
* const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
2223
|
+
* const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
2202
2224
|
* ```
|
|
2203
2225
|
*/
|
|
2204
2226
|
create(id: string, options?: AssetOptionalInterface): Asset;
|
|
@@ -2236,7 +2258,7 @@ declare class DroppedAssetFactory extends SDKController {
|
|
|
2236
2258
|
*
|
|
2237
2259
|
* @usage
|
|
2238
2260
|
* ```
|
|
2239
|
-
* const droppedAssetInstance = await DroppedAsset.create(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
2261
|
+
* const droppedAssetInstance = await DroppedAsset.create(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
2240
2262
|
* ```
|
|
2241
2263
|
*/
|
|
2242
2264
|
create(id: string, urlSlug: string, options?: DroppedAssetOptionalInterface): DroppedAsset;
|
|
@@ -2246,7 +2268,7 @@ declare class DroppedAssetFactory extends SDKController {
|
|
|
2246
2268
|
*
|
|
2247
2269
|
* @usage
|
|
2248
2270
|
* ```
|
|
2249
|
-
* const droppedAssetInstance = await DroppedAsset.get(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
2271
|
+
* const droppedAssetInstance = await DroppedAsset.get(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
2250
2272
|
* ```
|
|
2251
2273
|
*/
|
|
2252
2274
|
get(id: string, urlSlug: string, options?: DroppedAssetOptionalInterface): Promise<DroppedAsset>;
|
|
@@ -2271,7 +2293,7 @@ declare class DroppedAssetFactory extends SDKController {
|
|
|
2271
2293
|
*
|
|
2272
2294
|
* @usage
|
|
2273
2295
|
* ```
|
|
2274
|
-
* const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
2296
|
+
* const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
2275
2297
|
* const droppedAssetInstance = await DroppedAsset.get(assetInstance, {
|
|
2276
2298
|
assetScale: 1.5,
|
|
2277
2299
|
flipped: true,
|
|
@@ -2332,7 +2354,7 @@ declare class SceneFactory {
|
|
|
2332
2354
|
*
|
|
2333
2355
|
* @usage
|
|
2334
2356
|
* ```
|
|
2335
|
-
* const sceneInstance = await Scene.create(id, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
2357
|
+
* const sceneInstance = await Scene.create(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
2336
2358
|
* ```
|
|
2337
2359
|
*/
|
|
2338
2360
|
create(id: string, options?: SceneOptionalInterface): Scene;
|
|
@@ -2342,7 +2364,7 @@ declare class SceneFactory {
|
|
|
2342
2364
|
*
|
|
2343
2365
|
* @usage
|
|
2344
2366
|
* ```
|
|
2345
|
-
* const sceneInstance = await Scene.get(id, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
2367
|
+
* const sceneInstance = await Scene.get(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
2346
2368
|
* ```
|
|
2347
2369
|
*/
|
|
2348
2370
|
get(id: string, options?: SceneOptionalInterface): Promise<Scene>;
|
|
@@ -2363,7 +2385,7 @@ declare class UserFactory {
|
|
|
2363
2385
|
*
|
|
2364
2386
|
* @usage
|
|
2365
2387
|
* ```
|
|
2366
|
-
* const userInstance = await User.create({ credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
2388
|
+
* const userInstance = await User.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
2367
2389
|
* ```
|
|
2368
2390
|
*/
|
|
2369
2391
|
create(options?: UserOptionalInterface): User;
|
|
@@ -2384,7 +2406,7 @@ declare class VisitorFactory {
|
|
|
2384
2406
|
*
|
|
2385
2407
|
* @usage
|
|
2386
2408
|
* ```
|
|
2387
|
-
* const visitorInstance = await Visitor.create(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
2409
|
+
* const visitorInstance = await Visitor.create(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
2388
2410
|
* ```
|
|
2389
2411
|
*/
|
|
2390
2412
|
create(id: number, urlSlug: string, options?: VisitorOptionalInterface): Visitor;
|
|
@@ -2394,7 +2416,7 @@ declare class VisitorFactory {
|
|
|
2394
2416
|
*
|
|
2395
2417
|
* @usage
|
|
2396
2418
|
* ```
|
|
2397
|
-
* const visitorInstance = await Visitor.get(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
2419
|
+
* const visitorInstance = await Visitor.get(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
2398
2420
|
* ```
|
|
2399
2421
|
*/
|
|
2400
2422
|
get(id: number, urlSlug: string, options?: VisitorOptionalInterface): Promise<Visitor>;
|
|
@@ -2415,7 +2437,7 @@ declare class WebRTCConnectorFactory {
|
|
|
2415
2437
|
*
|
|
2416
2438
|
* @usage
|
|
2417
2439
|
* ```
|
|
2418
|
-
* const userInstance = await WebRTCConnector.create({ credentials: { interactiveNonce, interactivePublicKey, urlSlug, visitorId }, twilioConfig: {} });
|
|
2440
|
+
* const userInstance = await WebRTCConnector.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId }, twilioConfig: {} });
|
|
2419
2441
|
* ```
|
|
2420
2442
|
*/
|
|
2421
2443
|
create(urlSlug: string, options?: WebRTCConnectorOptionalInterface): WebRTCConnector;
|
|
@@ -2436,7 +2458,7 @@ declare class WorldActivityFactory {
|
|
|
2436
2458
|
*
|
|
2437
2459
|
* @usage
|
|
2438
2460
|
* ```
|
|
2439
|
-
* const worldActivityInstance = await WorldActivity.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
2461
|
+
* const worldActivityInstance = await WorldActivity.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
2440
2462
|
* ```
|
|
2441
2463
|
*/
|
|
2442
2464
|
create(urlSlug: string, options?: WorldOptionalInterface): WorldActivity;
|
|
@@ -2456,7 +2478,7 @@ declare class WorldFactory extends SDKController {
|
|
|
2456
2478
|
*
|
|
2457
2479
|
* @usage
|
|
2458
2480
|
* ```
|
|
2459
|
-
* const worldInstance = await World.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
2481
|
+
* const worldInstance = await World.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
2460
2482
|
* ```
|
|
2461
2483
|
*/
|
|
2462
2484
|
create(urlSlug: string, options?: WorldOptionalInterface): World;
|
package/dist/index.js
CHANGED
|
@@ -39647,6 +39647,8 @@ class SDKController {
|
|
|
39647
39647
|
interactiveNonce,
|
|
39648
39648
|
visitorId,
|
|
39649
39649
|
assetId,
|
|
39650
|
+
urlSlug,
|
|
39651
|
+
profileId,
|
|
39650
39652
|
date: new Date(),
|
|
39651
39653
|
};
|
|
39652
39654
|
this.jwt = jwt.sign(payload, topia.interactiveSecret);
|
|
@@ -39713,23 +39715,16 @@ class SDKController {
|
|
|
39713
39715
|
*
|
|
39714
39716
|
* @usage
|
|
39715
39717
|
* ```ts
|
|
39716
|
-
* await new Asset(topia, "
|
|
39718
|
+
* await new Asset(topia, "id", {
|
|
39717
39719
|
* attributes: { assetName: "My Asset", isPublic: false },
|
|
39718
|
-
* credentials: {
|
|
39720
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
39719
39721
|
* });
|
|
39720
39722
|
* ```
|
|
39721
39723
|
*/
|
|
39722
39724
|
class Asset extends SDKController {
|
|
39723
39725
|
constructor(topia, id, options = { attributes: {}, credentials: {} }) {
|
|
39724
|
-
|
|
39725
|
-
|
|
39726
|
-
super(topia, {
|
|
39727
|
-
apiKey: (_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.apiKey,
|
|
39728
|
-
assetId: (_b = options === null || options === void 0 ? void 0 : options.credentials) === null || _b === void 0 ? void 0 : _b.assetId,
|
|
39729
|
-
interactiveNonce: (_c = options === null || options === void 0 ? void 0 : options.credentials) === null || _c === void 0 ? void 0 : _c.interactiveNonce,
|
|
39730
|
-
urlSlug: (_d = options === null || options === void 0 ? void 0 : options.credentials) === null || _d === void 0 ? void 0 : _d.urlSlug,
|
|
39731
|
-
visitorId: (_e = options === null || options === void 0 ? void 0 : options.credentials) === null || _e === void 0 ? void 0 : _e.visitorId,
|
|
39732
|
-
});
|
|
39726
|
+
// options.credentials.assetId is the dropped asset id and is used to validate the interactive credentials. It should NOT match the id that's passed to the constructor.
|
|
39727
|
+
super(topia, Object.assign({}, options.credentials));
|
|
39733
39728
|
this.id = id;
|
|
39734
39729
|
Object.assign(this, options.attributes);
|
|
39735
39730
|
}
|
|
@@ -39809,6 +39804,13 @@ var DroppedAssetMediaType;
|
|
|
39809
39804
|
DroppedAssetMediaType["LINK"] = "link";
|
|
39810
39805
|
})(DroppedAssetMediaType || (DroppedAssetMediaType = {}));
|
|
39811
39806
|
|
|
39807
|
+
var WorldActivityTypes;
|
|
39808
|
+
(function (WorldActivityTypes) {
|
|
39809
|
+
WorldActivityTypes["GAME_ON"] = "GAME_ON";
|
|
39810
|
+
WorldActivityTypes["GAME_WAITING"] = "GAME_WAITING";
|
|
39811
|
+
WorldActivityTypes["GAME_HIGH_SCORE"] = "GAME_HIGH_SCORE";
|
|
39812
|
+
})(WorldActivityTypes || (WorldActivityTypes = {}));
|
|
39813
|
+
|
|
39812
39814
|
const getBrowserWarning = () => {
|
|
39813
39815
|
if (typeof window !== "undefined") {
|
|
39814
39816
|
console.warn("Please use extreme caution when passing sensitive information such as API keys from a client side application.");
|
|
@@ -39844,8 +39846,8 @@ var _DroppedAsset_updateDroppedAsset;
|
|
|
39844
39846
|
* @usage
|
|
39845
39847
|
* ```ts
|
|
39846
39848
|
* await new DroppedAsset(topia, "1giFZb0sQ3X27L7uGyQX", "example", {
|
|
39847
|
-
* attributes: { text: "My Asset" },
|
|
39848
|
-
* credentials: {
|
|
39849
|
+
* attributes: { text: "My Dropped Asset" },
|
|
39850
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
39849
39851
|
* });
|
|
39850
39852
|
* ```
|
|
39851
39853
|
*/
|
|
@@ -40478,19 +40480,13 @@ _DroppedAsset_updateDroppedAsset = new WeakMap();
|
|
|
40478
40480
|
* ```ts
|
|
40479
40481
|
* await new Scene(topia, "sceneId", {
|
|
40480
40482
|
* attributes: { name: "My Scene" },
|
|
40481
|
-
* credentials: {
|
|
40483
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
40482
40484
|
* });
|
|
40483
40485
|
* ```
|
|
40484
40486
|
*/
|
|
40485
40487
|
class Scene extends SDKController {
|
|
40486
40488
|
constructor(topia, id, options = { attributes: {}, credentials: {} }) {
|
|
40487
|
-
|
|
40488
|
-
super(topia, {
|
|
40489
|
-
apiKey: (_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.apiKey,
|
|
40490
|
-
interactiveNonce: (_b = options === null || options === void 0 ? void 0 : options.credentials) === null || _b === void 0 ? void 0 : _b.interactiveNonce,
|
|
40491
|
-
urlSlug: (_c = options === null || options === void 0 ? void 0 : options.credentials) === null || _c === void 0 ? void 0 : _c.urlSlug,
|
|
40492
|
-
visitorId: (_d = options === null || options === void 0 ? void 0 : options.credentials) === null || _d === void 0 ? void 0 : _d.visitorId,
|
|
40493
|
-
});
|
|
40489
|
+
super(topia, Object.assign({}, options.credentials));
|
|
40494
40490
|
this.id = id;
|
|
40495
40491
|
Object.assign(this, options.attributes);
|
|
40496
40492
|
}
|
|
@@ -40564,19 +40560,14 @@ var _World_droppedAssetsMap;
|
|
|
40564
40560
|
* ```ts
|
|
40565
40561
|
* await new World(topia, "exampleWorld", {
|
|
40566
40562
|
* attributes: { name: "Example World" },
|
|
40567
|
-
* credentials: {
|
|
40563
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
40568
40564
|
* });
|
|
40569
40565
|
* ```
|
|
40570
40566
|
*/
|
|
40571
40567
|
class World extends SDKController {
|
|
40572
40568
|
constructor(topia, urlSlug, options = { attributes: {}, credentials: {} }) {
|
|
40573
|
-
var _a
|
|
40574
|
-
super(topia, {
|
|
40575
|
-
apiKey: (_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.apiKey,
|
|
40576
|
-
interactiveNonce: (_b = options === null || options === void 0 ? void 0 : options.credentials) === null || _b === void 0 ? void 0 : _b.interactiveNonce,
|
|
40577
|
-
urlSlug: ((_c = options === null || options === void 0 ? void 0 : options.credentials) === null || _c === void 0 ? void 0 : _c.urlSlug) || urlSlug,
|
|
40578
|
-
visitorId: (_d = options === null || options === void 0 ? void 0 : options.credentials) === null || _d === void 0 ? void 0 : _d.visitorId,
|
|
40579
|
-
});
|
|
40569
|
+
var _a;
|
|
40570
|
+
super(topia, Object.assign({ urlSlug: ((_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.urlSlug) || urlSlug }, options.credentials));
|
|
40580
40571
|
_World_droppedAssetsMap.set(this, void 0);
|
|
40581
40572
|
////////// data objects
|
|
40582
40573
|
/**
|
|
@@ -41102,6 +41093,27 @@ class World extends SDKController {
|
|
|
41102
41093
|
}
|
|
41103
41094
|
});
|
|
41104
41095
|
}
|
|
41096
|
+
/**
|
|
41097
|
+
* @summary
|
|
41098
|
+
* Add an activity to a world
|
|
41099
|
+
* excludeFromNotification is an array of visitorIds to exclude from the notification
|
|
41100
|
+
*
|
|
41101
|
+
* @usage
|
|
41102
|
+
* ```ts
|
|
41103
|
+
* await world.triggerActivity({ type: "GAME_ON", assetId: "abc123" });
|
|
41104
|
+
* ```
|
|
41105
|
+
*/
|
|
41106
|
+
triggerActivity({ type, assetId, excludeFromNotification, }) {
|
|
41107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41108
|
+
try {
|
|
41109
|
+
const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/set-activity`, { type, assetId, excludeFromNotification }, this.requestOptions);
|
|
41110
|
+
return result.data;
|
|
41111
|
+
}
|
|
41112
|
+
catch (error) {
|
|
41113
|
+
throw this.errorHandler({ error, params: { type }, sdkMethod: "World.triggerActivity" });
|
|
41114
|
+
}
|
|
41115
|
+
});
|
|
41116
|
+
}
|
|
41105
41117
|
/**
|
|
41106
41118
|
* @summary
|
|
41107
41119
|
* Display a message via a toast to all visitors currently in a world.
|
|
@@ -41232,22 +41244,13 @@ var _User_adminWorldsMap, _User_assetsMap, _User_scenesMap, _User_worldsMap;
|
|
|
41232
41244
|
* ```ts
|
|
41233
41245
|
* await new User(topia, {
|
|
41234
41246
|
* profileId: 1,
|
|
41235
|
-
* credentials: {
|
|
41247
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
41236
41248
|
* });
|
|
41237
41249
|
* ```
|
|
41238
41250
|
*/
|
|
41239
41251
|
class User extends SDKController {
|
|
41240
41252
|
constructor(topia, options = { profileId: null, credentials: {} }) {
|
|
41241
|
-
|
|
41242
|
-
super(topia, {
|
|
41243
|
-
apiKey: (_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.apiKey,
|
|
41244
|
-
interactiveNonce: (_b = options === null || options === void 0 ? void 0 : options.credentials) === null || _b === void 0 ? void 0 : _b.interactiveNonce,
|
|
41245
|
-
profileId: options === null || options === void 0 ? void 0 : options.profileId,
|
|
41246
|
-
urlSlug: (_c = options === null || options === void 0 ? void 0 : options.credentials) === null || _c === void 0 ? void 0 : _c.urlSlug,
|
|
41247
|
-
visitorId: (_d = options === null || options === void 0 ? void 0 : options.credentials) === null || _d === void 0 ? void 0 : _d.visitorId,
|
|
41248
|
-
iframeId: (_e = options === null || options === void 0 ? void 0 : options.credentials) === null || _e === void 0 ? void 0 : _e.iframeId,
|
|
41249
|
-
gameEngineId: (_f = options === null || options === void 0 ? void 0 : options.credentials) === null || _f === void 0 ? void 0 : _f.gameEngineId,
|
|
41250
|
-
});
|
|
41253
|
+
super(topia, Object.assign({ profileId: options === null || options === void 0 ? void 0 : options.profileId }, options.credentials));
|
|
41251
41254
|
_User_adminWorldsMap.set(this, void 0);
|
|
41252
41255
|
_User_assetsMap.set(this, void 0);
|
|
41253
41256
|
_User_scenesMap.set(this, void 0);
|
|
@@ -41809,7 +41812,7 @@ _User_adminWorldsMap = new WeakMap(), _User_assetsMap = new WeakMap(), _User_sce
|
|
|
41809
41812
|
*
|
|
41810
41813
|
* @usage
|
|
41811
41814
|
* ```ts
|
|
41812
|
-
* await new Visitor(topia, id, urlSlug, { attributes: { moveTo: { x: 0, y: 0 } } });
|
|
41815
|
+
* await new Visitor(topia, id, urlSlug, { attributes: { moveTo: { x: 0, y: 0 } }, credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" } });
|
|
41813
41816
|
* ```
|
|
41814
41817
|
*/
|
|
41815
41818
|
class Visitor extends User {
|
|
@@ -42029,7 +42032,8 @@ class Visitor extends User {
|
|
|
42029
42032
|
*
|
|
42030
42033
|
* @usage
|
|
42031
42034
|
* ```ts
|
|
42032
|
-
* await visitor.grantExpression({
|
|
42035
|
+
* await visitor.grantExpression({ id: "exampleExpressionId" });
|
|
42036
|
+
* await visitor.grantExpression({ name: "exampleExpressionName" });
|
|
42033
42037
|
* ```
|
|
42034
42038
|
*/
|
|
42035
42039
|
grantExpression({ id, name }) {
|
|
@@ -42250,18 +42254,14 @@ class Visitor extends User {
|
|
|
42250
42254
|
* @usage
|
|
42251
42255
|
* ```ts
|
|
42252
42256
|
* await new WebRTCConnector(topia, {
|
|
42253
|
-
* credentials: { interactiveNonce: "exampleNonce",
|
|
42257
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
42254
42258
|
* });
|
|
42255
42259
|
* ```
|
|
42256
42260
|
*/
|
|
42257
42261
|
class WebRTCConnector extends SDKController {
|
|
42258
42262
|
constructor(topia, urlSlug, options = { twilioConfig: {}, credentials: {} }) {
|
|
42259
|
-
var _a
|
|
42260
|
-
super(topia, {
|
|
42261
|
-
interactiveNonce: (_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.interactiveNonce,
|
|
42262
|
-
urlSlug: (_b = options === null || options === void 0 ? void 0 : options.credentials) === null || _b === void 0 ? void 0 : _b.urlSlug,
|
|
42263
|
-
visitorId: (_c = options === null || options === void 0 ? void 0 : options.credentials) === null || _c === void 0 ? void 0 : _c.visitorId,
|
|
42264
|
-
});
|
|
42263
|
+
var _a;
|
|
42264
|
+
super(topia, Object.assign({ urlSlug: ((_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.urlSlug) || urlSlug }, options.credentials));
|
|
42265
42265
|
this.twilioConfig = options === null || options === void 0 ? void 0 : options.twilioConfig;
|
|
42266
42266
|
this.urlSlug = urlSlug;
|
|
42267
42267
|
}
|
|
@@ -42299,19 +42299,14 @@ var _WorldActivity_visitorsMap;
|
|
|
42299
42299
|
* ```ts
|
|
42300
42300
|
* await new WorldActivity(topia, "exampleWorld", {
|
|
42301
42301
|
* attributes: { name: "Example World" },
|
|
42302
|
-
* credentials: {
|
|
42302
|
+
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
42303
42303
|
* });
|
|
42304
42304
|
* ```
|
|
42305
42305
|
*/
|
|
42306
42306
|
class WorldActivity extends SDKController {
|
|
42307
42307
|
constructor(topia, urlSlug, options = { credentials: {} }) {
|
|
42308
|
-
var _a
|
|
42309
|
-
super(topia, {
|
|
42310
|
-
apiKey: (_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.apiKey,
|
|
42311
|
-
interactiveNonce: (_b = options === null || options === void 0 ? void 0 : options.credentials) === null || _b === void 0 ? void 0 : _b.interactiveNonce,
|
|
42312
|
-
urlSlug: ((_c = options === null || options === void 0 ? void 0 : options.credentials) === null || _c === void 0 ? void 0 : _c.urlSlug) || urlSlug,
|
|
42313
|
-
visitorId: (_d = options === null || options === void 0 ? void 0 : options.credentials) === null || _d === void 0 ? void 0 : _d.visitorId,
|
|
42314
|
-
});
|
|
42308
|
+
var _a;
|
|
42309
|
+
super(topia, Object.assign({ urlSlug: ((_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.urlSlug) || urlSlug }, options.credentials));
|
|
42315
42310
|
_WorldActivity_visitorsMap.set(this, void 0);
|
|
42316
42311
|
this.urlSlug = urlSlug;
|
|
42317
42312
|
__classPrivateFieldSet(this, _WorldActivity_visitorsMap, {}, "f");
|
|
@@ -42481,7 +42476,7 @@ class AssetFactory extends SDKController {
|
|
|
42481
42476
|
*
|
|
42482
42477
|
* @usage
|
|
42483
42478
|
* ```
|
|
42484
|
-
* const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42479
|
+
* const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42485
42480
|
* ```
|
|
42486
42481
|
*/
|
|
42487
42482
|
create(id, options) {
|
|
@@ -42537,7 +42532,7 @@ class DroppedAssetFactory extends SDKController {
|
|
|
42537
42532
|
*
|
|
42538
42533
|
* @usage
|
|
42539
42534
|
* ```
|
|
42540
|
-
* const droppedAssetInstance = await DroppedAsset.create(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42535
|
+
* const droppedAssetInstance = await DroppedAsset.create(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42541
42536
|
* ```
|
|
42542
42537
|
*/
|
|
42543
42538
|
create(id, urlSlug, options) {
|
|
@@ -42549,7 +42544,7 @@ class DroppedAssetFactory extends SDKController {
|
|
|
42549
42544
|
*
|
|
42550
42545
|
* @usage
|
|
42551
42546
|
* ```
|
|
42552
|
-
* const droppedAssetInstance = await DroppedAsset.get(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42547
|
+
* const droppedAssetInstance = await DroppedAsset.get(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42553
42548
|
* ```
|
|
42554
42549
|
*/
|
|
42555
42550
|
get(id, urlSlug, options) {
|
|
@@ -42596,7 +42591,7 @@ class DroppedAssetFactory extends SDKController {
|
|
|
42596
42591
|
*
|
|
42597
42592
|
* @usage
|
|
42598
42593
|
* ```
|
|
42599
|
-
* const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42594
|
+
* const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42600
42595
|
* const droppedAssetInstance = await DroppedAsset.get(assetInstance, {
|
|
42601
42596
|
assetScale: 1.5,
|
|
42602
42597
|
flipped: true,
|
|
@@ -42679,7 +42674,7 @@ class SceneFactory {
|
|
|
42679
42674
|
*
|
|
42680
42675
|
* @usage
|
|
42681
42676
|
* ```
|
|
42682
|
-
* const sceneInstance = await Scene.create(id, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42677
|
+
* const sceneInstance = await Scene.create(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42683
42678
|
* ```
|
|
42684
42679
|
*/
|
|
42685
42680
|
create(id, options) {
|
|
@@ -42691,7 +42686,7 @@ class SceneFactory {
|
|
|
42691
42686
|
*
|
|
42692
42687
|
* @usage
|
|
42693
42688
|
* ```
|
|
42694
|
-
* const sceneInstance = await Scene.get(id, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42689
|
+
* const sceneInstance = await Scene.get(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42695
42690
|
* ```
|
|
42696
42691
|
*/
|
|
42697
42692
|
get(id, options) {
|
|
@@ -42719,7 +42714,7 @@ class UserFactory {
|
|
|
42719
42714
|
*
|
|
42720
42715
|
* @usage
|
|
42721
42716
|
* ```
|
|
42722
|
-
* const userInstance = await User.create({ credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42717
|
+
* const userInstance = await User.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42723
42718
|
* ```
|
|
42724
42719
|
*/
|
|
42725
42720
|
create(options) {
|
|
@@ -42743,7 +42738,7 @@ class VisitorFactory {
|
|
|
42743
42738
|
*
|
|
42744
42739
|
* @usage
|
|
42745
42740
|
* ```
|
|
42746
|
-
* const visitorInstance = await Visitor.create(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42741
|
+
* const visitorInstance = await Visitor.create(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42747
42742
|
* ```
|
|
42748
42743
|
*/
|
|
42749
42744
|
create(id, urlSlug, options) {
|
|
@@ -42755,7 +42750,7 @@ class VisitorFactory {
|
|
|
42755
42750
|
*
|
|
42756
42751
|
* @usage
|
|
42757
42752
|
* ```
|
|
42758
|
-
* const visitorInstance = await Visitor.get(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42753
|
+
* const visitorInstance = await Visitor.get(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42759
42754
|
* ```
|
|
42760
42755
|
*/
|
|
42761
42756
|
get(id, urlSlug, options) {
|
|
@@ -42783,7 +42778,7 @@ class WebRTCConnectorFactory {
|
|
|
42783
42778
|
*
|
|
42784
42779
|
* @usage
|
|
42785
42780
|
* ```
|
|
42786
|
-
* const userInstance = await WebRTCConnector.create({ credentials: { interactiveNonce, interactivePublicKey, urlSlug, visitorId }, twilioConfig: {} });
|
|
42781
|
+
* const userInstance = await WebRTCConnector.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId }, twilioConfig: {} });
|
|
42787
42782
|
* ```
|
|
42788
42783
|
*/
|
|
42789
42784
|
create(urlSlug, options) {
|
|
@@ -42807,7 +42802,7 @@ class WorldActivityFactory {
|
|
|
42807
42802
|
*
|
|
42808
42803
|
* @usage
|
|
42809
42804
|
* ```
|
|
42810
|
-
* const worldActivityInstance = await WorldActivity.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42805
|
+
* const worldActivityInstance = await WorldActivity.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42811
42806
|
* ```
|
|
42812
42807
|
*/
|
|
42813
42808
|
create(urlSlug, options) {
|
|
@@ -42831,7 +42826,7 @@ class WorldFactory extends SDKController {
|
|
|
42831
42826
|
*
|
|
42832
42827
|
* @usage
|
|
42833
42828
|
* ```
|
|
42834
|
-
* const worldInstance = await World.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
|
|
42829
|
+
* const worldInstance = await World.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42835
42830
|
* ```
|
|
42836
42831
|
*/
|
|
42837
42832
|
create(urlSlug, options) {
|
package/package.json
CHANGED