@rtsdk/topia 0.0.9 → 0.0.10
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/__mocks__/worlds.js +1 -0
- package/dist/controllers/Asset.js +2 -44
- package/dist/controllers/DroppedAsset.js +36 -35
- package/dist/controllers/User.js +63 -0
- package/dist/controllers/Visitor.js +4 -43
- package/dist/controllers/World.js +112 -63
- package/dist/controllers/__tests__/asset.test.js +13 -4
- package/dist/controllers/__tests__/droppedAsset.test.js +55 -71
- package/dist/controllers/__tests__/user.test.js +23 -0
- package/dist/controllers/__tests__/visitor.test.js +17 -5
- package/dist/controllers/__tests__/world.test.js +49 -24
- package/dist/controllers/index.js +1 -1
- package/dist/index.js +229 -214
- package/dist/{types/DroppedAssetType.js → interfaces/AssetInterfaces.js} +0 -0
- package/dist/{types/VisitorType.js → interfaces/VisitorInterfaces.js} +0 -0
- package/dist/interfaces/index.js +2 -0
- package/dist/utils/__tests__/removeUndefined.test.js +10 -0
- package/dist/utils/__tests__/scatterVisitors.test.js +4 -4
- package/dist/utils/getErrorMessage.js +2 -2
- package/dist/utils/index.js +1 -1
- package/dist/utils/publicAPI.js +0 -1
- package/dist/utils/removeUndefined.js +8 -0
- package/package.json +1 -1
- package/dist/controllers/Scene.js +0 -22
- package/dist/controllers/__tests__/scene.test.js +0 -14
- package/dist/types/Visitors.js +0 -1
- package/dist/utils/createVisitor.js +0 -3
package/dist/utils/publicAPI.js
CHANGED
package/package.json
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { getErrorMessage, publicAPI } from "utils";
|
|
2
|
-
export class Scene {
|
|
3
|
-
apiKey;
|
|
4
|
-
email;
|
|
5
|
-
constructor(apiKey, email) {
|
|
6
|
-
this.apiKey = apiKey;
|
|
7
|
-
this.email = email;
|
|
8
|
-
}
|
|
9
|
-
fetchScenesByEmail() {
|
|
10
|
-
return new Promise((resolve, reject) => {
|
|
11
|
-
publicAPI(this.apiKey)
|
|
12
|
-
.get(`/scenes/my-scenes?email=${this.email}`)
|
|
13
|
-
.then((response) => {
|
|
14
|
-
resolve(response.data);
|
|
15
|
-
})
|
|
16
|
-
.catch((error) => {
|
|
17
|
-
reject(new Error(getErrorMessage(error)));
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export default Scene;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { scenes } from "../../__mocks__";
|
|
2
|
-
import { Scene } from "..";
|
|
3
|
-
afterEach(() => {
|
|
4
|
-
jest.resetAllMocks();
|
|
5
|
-
});
|
|
6
|
-
describe("Scene Class", () => {
|
|
7
|
-
it("should return an array of scenes owned by specific email address", async () => {
|
|
8
|
-
const testScene = await new Scene("key", "lina@topia.io");
|
|
9
|
-
testScene.fetchScenesByEmail = jest.fn().mockReturnValue(scenes);
|
|
10
|
-
const mockScenes = await testScene.fetchScenesByEmail();
|
|
11
|
-
expect(testScene.fetchScenesByEmail).toHaveBeenCalled();
|
|
12
|
-
expect(mockScenes).toBeDefined();
|
|
13
|
-
});
|
|
14
|
-
});
|
package/dist/types/Visitors.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export const createVisitor = (Visitor, apiKey, data, urlSlug) => {
|
|
2
|
-
return new Visitor(apiKey, data.color, data.displayName, data.gestureType, data.hidden, data.isAdmin, data.isBackground, data.isMobile, data.isRecording, data.isRecordingBot, data.lastUpdate, data.moveFrom, data.movedOn, data.moveTo, data.muted, data.performer, data.performerNear, data.playerId, data.shareScreen, data.sitting, urlSlug, data.username);
|
|
3
|
-
};
|