@vived/host 3.6.0 → 3.7.0
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/lib/Components/Apps/Mocks/MockAppMounterUC.d.ts +1 -0
- package/lib/Components/Apps/Mocks/MockAppMounterUC.js +1 -0
- package/lib/Components/Apps/UCs/MounterUC.d.ts +1 -0
- package/lib/Components/Dispatcher/Entities/HostDispatchEntity.d.ts +1 -0
- package/lib/Components/Dispatcher/Entities/HostDispatchEntity.js +3 -0
- package/lib/Components/Dispatcher/Mocks/MockHostDispatcher.d.ts +1 -0
- package/lib/Components/Dispatcher/Mocks/MockHostDispatcher.js +1 -0
- package/lib/Components/VivedAPI/Adapters/apiStageAdapter.d.ts +3 -0
- package/lib/Components/VivedAPI/Adapters/apiStageAdapter.js +24 -0
- package/lib/Components/VivedAPI/Adapters/index.d.ts +2 -0
- package/lib/Components/VivedAPI/Adapters/index.js +14 -0
- package/lib/Components/VivedAPI/Adapters/userTokenAdapter.d.ts +2 -0
- package/lib/Components/VivedAPI/Adapters/userTokenAdapter.js +23 -0
- package/lib/Components/VivedAPI/Controllers/index.d.ts +4 -3
- package/lib/Components/VivedAPI/Controllers/index.js +1 -0
- package/lib/Components/VivedAPI/Controllers/setApiStage.d.ts +3 -0
- package/lib/Components/VivedAPI/Controllers/setApiStage.js +14 -0
- package/lib/Components/VivedAPI/Entities/VivedAPIEntity.d.ts +14 -1
- package/lib/Components/VivedAPI/Entities/VivedAPIEntity.js +31 -2
- package/lib/Components/VivedAPI/Mocks/ApiStagePMMock.d.ts +8 -0
- package/lib/Components/VivedAPI/Mocks/ApiStagePMMock.js +15 -0
- package/lib/Components/VivedAPI/Mocks/UserTokenPMMock.d.ts +8 -0
- package/lib/Components/VivedAPI/Mocks/UserTokenPMMock.js +15 -0
- package/lib/Components/VivedAPI/Mocks/index.d.ts +18 -16
- package/lib/Components/VivedAPI/Mocks/index.js +2 -0
- package/lib/Components/VivedAPI/PMs/ApiStagePM.d.ts +7 -0
- package/lib/Components/VivedAPI/PMs/ApiStagePM.js +36 -0
- package/lib/Components/VivedAPI/PMs/UserTokenPM.d.ts +3 -6
- package/lib/Components/VivedAPI/PMs/UserTokenPM.js +19 -14
- package/lib/Components/VivedAPI/PMs/index.d.ts +1 -0
- package/lib/Components/VivedAPI/PMs/index.js +1 -0
- package/lib/Components/VivedAPI/index.d.ts +6 -5
- package/lib/Components/VivedAPI/index.js +1 -0
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { HostAppObject } from "../../../HostAppObject";
|
|
3
3
|
import { MounterUC } from "../UCs/MounterUC";
|
|
4
4
|
export declare class MockAppMounterUC extends MounterUC {
|
|
5
|
+
mountLatestVersion: jest.Mock<any, any>;
|
|
5
6
|
unmount: jest.Mock<any, any>;
|
|
6
7
|
loadScriptIntoDocument: jest.Mock<any, any>;
|
|
7
8
|
getAppInterface: jest.Mock<any, any>;
|
|
@@ -5,6 +5,7 @@ const MounterUC_1 = require("../UCs/MounterUC");
|
|
|
5
5
|
class MockAppMounterUC extends MounterUC_1.MounterUC {
|
|
6
6
|
constructor(appObject) {
|
|
7
7
|
super(appObject, MounterUC_1.MounterUC.type);
|
|
8
|
+
this.mountLatestVersion = jest.fn();
|
|
8
9
|
this.unmount = jest.fn();
|
|
9
10
|
this.loadScriptIntoDocument = jest.fn();
|
|
10
11
|
this.getAppInterface = jest.fn();
|
|
@@ -4,6 +4,7 @@ import { Version } from "../../../ValueObjects";
|
|
|
4
4
|
export declare abstract class MounterUC extends HostAppObjectUC {
|
|
5
5
|
static type: string;
|
|
6
6
|
abstract mount(majorVersion: number, minorVersion: number): Promise<void>;
|
|
7
|
+
abstract mountLatestVersion(): Promise<void>;
|
|
7
8
|
abstract unmount(): void;
|
|
8
9
|
abstract loadScriptIntoDocument(scriptURL: string, appIDWithVersion: string): Promise<void>;
|
|
9
10
|
abstract getAppInterface(version: Version): VIVEDApp_3 | undefined;
|
|
@@ -5,6 +5,7 @@ export declare abstract class HostDispatchEntity extends HostAppObjectEntity {
|
|
|
5
5
|
abstract appHandlerVersion: number;
|
|
6
6
|
abstract getRequestPayloadVersion(requestType: string): number | undefined;
|
|
7
7
|
abstract registerAppHandler: (appHandler: Handler) => void;
|
|
8
|
+
abstract clearAppHandler: () => void;
|
|
8
9
|
abstract dispatch: (request: Request) => void;
|
|
9
10
|
abstract formRequestAndDispatch: (type: string, version: number, payload?: object | undefined) => void;
|
|
10
11
|
static get(appObject: HostAppObject): HostDispatchEntity | undefined;
|
|
@@ -34,6 +34,9 @@ class HostDispatchEntityImp extends HostDispatchEntity {
|
|
|
34
34
|
this.appHandler = appHandler;
|
|
35
35
|
this.getAppHandlerVersion();
|
|
36
36
|
};
|
|
37
|
+
this.clearAppHandler = () => {
|
|
38
|
+
this.appHandler = undefined;
|
|
39
|
+
};
|
|
37
40
|
this.getRequestPayloadVersion = (requestType) => {
|
|
38
41
|
return this.appPayloadVersions.get(requestType);
|
|
39
42
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { HostAppObject } from "../../../HostAppObject";
|
|
3
3
|
import { HostDispatchEntity } from "../Entities";
|
|
4
4
|
export declare class MockHostDispatchEntity extends HostDispatchEntity {
|
|
5
|
+
clearAppHandler: jest.Mock<any, any>;
|
|
5
6
|
appHandlerVersion: number;
|
|
6
7
|
getRequestPayloadVersion: jest.Mock<any, any>;
|
|
7
8
|
registerAppHandler: jest.Mock<any, any>;
|
|
@@ -5,6 +5,7 @@ const Entities_1 = require("../Entities");
|
|
|
5
5
|
class MockHostDispatchEntity extends Entities_1.HostDispatchEntity {
|
|
6
6
|
constructor(appObject) {
|
|
7
7
|
super(appObject, Entities_1.HostDispatchEntity.type);
|
|
8
|
+
this.clearAppHandler = jest.fn();
|
|
8
9
|
this.appHandlerVersion = 1;
|
|
9
10
|
this.getRequestPayloadVersion = jest.fn();
|
|
10
11
|
this.registerAppHandler = jest.fn();
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.apiStageAdapter = void 0;
|
|
4
|
+
const Entities_1 = require("../Entities");
|
|
5
|
+
const ApiStagePM_1 = require("../PMs/ApiStagePM");
|
|
6
|
+
exports.apiStageAdapter = {
|
|
7
|
+
defaultVM: Entities_1.APIStage.PRODUCTION,
|
|
8
|
+
subscribe: (appObjects, setVM) => {
|
|
9
|
+
const pm = ApiStagePM_1.ApiStagePM.get(appObjects);
|
|
10
|
+
if (!pm) {
|
|
11
|
+
appObjects.submitError("apiStageAdapter", "Unable to find ApiStagePM");
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
pm.addView(setVM);
|
|
15
|
+
},
|
|
16
|
+
unsubscribe: (appObjects, setVM) => {
|
|
17
|
+
const pm = ApiStagePM_1.ApiStagePM.get(appObjects);
|
|
18
|
+
if (!pm) {
|
|
19
|
+
appObjects.submitError("apiStageAdapter", "Unable to find ApiStagePM");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
pm.removeView(setVM);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./apiStageAdapter"), exports);
|
|
14
|
+
__exportStar(require("./userTokenAdapter"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.userTokenAdapter = void 0;
|
|
4
|
+
const UserTokenPM_1 = require("../PMs/UserTokenPM");
|
|
5
|
+
exports.userTokenAdapter = {
|
|
6
|
+
defaultVM: "",
|
|
7
|
+
subscribe: (appObjects, setVM) => {
|
|
8
|
+
const pm = UserTokenPM_1.UserTokenPM.get(appObjects);
|
|
9
|
+
if (!pm) {
|
|
10
|
+
appObjects.submitError("userTokenAdapter", "Unable to find UserTokenPM");
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
pm.addView(setVM);
|
|
14
|
+
},
|
|
15
|
+
unsubscribe: (appObjects, setVM) => {
|
|
16
|
+
const pm = UserTokenPM_1.UserTokenPM.get(appObjects);
|
|
17
|
+
if (!pm) {
|
|
18
|
+
appObjects.submitError("userTokenAdapter", "Unable to find UserTokenPM");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
pm.removeView(setVM);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from "./loginUser";
|
|
2
|
+
export * from "./logoutUser";
|
|
3
|
+
export * from "./refreshAuthenticatedUser";
|
|
4
|
+
export * from "./setApiStage";
|
|
@@ -13,3 +13,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
__exportStar(require("./loginUser"), exports);
|
|
14
14
|
__exportStar(require("./logoutUser"), exports);
|
|
15
15
|
__exportStar(require("./refreshAuthenticatedUser"), exports);
|
|
16
|
+
__exportStar(require("./setApiStage"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setApiStage = void 0;
|
|
4
|
+
const Entities_1 = require("../Entities");
|
|
5
|
+
function setApiStage(stage, appObjects) {
|
|
6
|
+
const sandbox = Entities_1.VivedAPIEntity.get(appObjects);
|
|
7
|
+
if (sandbox) {
|
|
8
|
+
sandbox.apiStage = stage;
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
appObjects.submitWarning("setApiStage", "Unable to find VivedAPIEntity");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.setApiStage = setApiStage;
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { HostAppObject, HostAppObjectEntity, HostAppObjectRepo } from '../../../HostAppObject';
|
|
2
|
+
export declare enum APIStage {
|
|
3
|
+
PRODUCTION = "Production",
|
|
4
|
+
STAGING = "Staging",
|
|
5
|
+
DEVELOPMENT = "Development",
|
|
6
|
+
LOCAL = "LOCAL"
|
|
7
|
+
}
|
|
2
8
|
export declare class VivedAPIEntity extends HostAppObjectEntity {
|
|
3
9
|
static type: string;
|
|
4
10
|
static get(appObjects: HostAppObjectRepo): VivedAPIEntity | undefined;
|
|
5
|
-
|
|
11
|
+
productionURL: string;
|
|
12
|
+
stagingURL: string;
|
|
13
|
+
developmentURL: string;
|
|
14
|
+
localURL: string;
|
|
15
|
+
private memoizedApiState;
|
|
16
|
+
get apiStage(): APIStage;
|
|
17
|
+
set apiStage(apiState: APIStage);
|
|
18
|
+
get baseUrl(): string;
|
|
6
19
|
getEndpointURL: (endpoint: string) => URL;
|
|
7
20
|
private memoizedUserToken;
|
|
8
21
|
get userToken(): string;
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VivedAPIEntity = void 0;
|
|
3
|
+
exports.VivedAPIEntity = exports.APIStage = void 0;
|
|
4
4
|
const Entities_1 = require("../../../Entities");
|
|
5
5
|
const HostAppObject_1 = require("../../../HostAppObject");
|
|
6
|
+
var APIStage;
|
|
7
|
+
(function (APIStage) {
|
|
8
|
+
APIStage["PRODUCTION"] = "Production";
|
|
9
|
+
APIStage["STAGING"] = "Staging";
|
|
10
|
+
APIStage["DEVELOPMENT"] = "Development";
|
|
11
|
+
APIStage["LOCAL"] = "LOCAL";
|
|
12
|
+
})(APIStage = exports.APIStage || (exports.APIStage = {}));
|
|
6
13
|
class VivedAPIEntity extends HostAppObject_1.HostAppObjectEntity {
|
|
7
14
|
constructor(appObject) {
|
|
8
15
|
super(appObject, VivedAPIEntity.type);
|
|
9
|
-
this.
|
|
16
|
+
this.productionURL = "https://api.vivedlearning.com";
|
|
17
|
+
this.stagingURL = "https://api-staging.vivedlearning.com";
|
|
18
|
+
this.developmentURL = "https://api-test.vivedlearning.com";
|
|
19
|
+
this.localURL = "http://localhost:3001";
|
|
20
|
+
this.memoizedApiState = new Entities_1.MemoizedString(APIStage.PRODUCTION, this.notifyOnChange);
|
|
10
21
|
this.getEndpointURL = (endpoint) => {
|
|
11
22
|
return new URL(endpoint, this.baseUrl);
|
|
12
23
|
};
|
|
@@ -16,6 +27,24 @@ class VivedAPIEntity extends HostAppObject_1.HostAppObjectEntity {
|
|
|
16
27
|
static get(appObjects) {
|
|
17
28
|
return HostAppObject_1.getSingletonComponent(VivedAPIEntity.type, appObjects);
|
|
18
29
|
}
|
|
30
|
+
get apiStage() {
|
|
31
|
+
return this.memoizedApiState.val;
|
|
32
|
+
}
|
|
33
|
+
set apiStage(apiState) {
|
|
34
|
+
this.memoizedApiState.val = apiState;
|
|
35
|
+
}
|
|
36
|
+
get baseUrl() {
|
|
37
|
+
if (this.memoizedApiState.val === APIStage.PRODUCTION) {
|
|
38
|
+
return "https://api.vivedlearning.com";
|
|
39
|
+
}
|
|
40
|
+
if (this.memoizedApiState.val === APIStage.STAGING) {
|
|
41
|
+
return "https://api-staging.vivedlearning.com";
|
|
42
|
+
}
|
|
43
|
+
if (this.memoizedApiState.val === APIStage.DEVELOPMENT) {
|
|
44
|
+
return "https://api-test.vivedlearning.com";
|
|
45
|
+
}
|
|
46
|
+
return "http://localhost:3001";
|
|
47
|
+
}
|
|
19
48
|
get userToken() {
|
|
20
49
|
return this.memoizedUserToken.val;
|
|
21
50
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import { HostAppObject, HostAppObjectRepo } from "../../../HostAppObject";
|
|
3
|
+
import { ApiStagePM } from "../PMs/ApiStagePM";
|
|
4
|
+
export declare class ApiStagePMMock extends ApiStagePM {
|
|
5
|
+
vmsAreEqual: jest.Mock<any, any>;
|
|
6
|
+
constructor(appObject: HostAppObject);
|
|
7
|
+
}
|
|
8
|
+
export declare function makeApiStagePMMock(appObjects: HostAppObjectRepo): ApiStagePMMock;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeApiStagePMMock = exports.ApiStagePMMock = void 0;
|
|
4
|
+
const ApiStagePM_1 = require("../PMs/ApiStagePM");
|
|
5
|
+
class ApiStagePMMock extends ApiStagePM_1.ApiStagePM {
|
|
6
|
+
constructor(appObject) {
|
|
7
|
+
super(appObject, ApiStagePM_1.ApiStagePM.type);
|
|
8
|
+
this.vmsAreEqual = jest.fn();
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.ApiStagePMMock = ApiStagePMMock;
|
|
12
|
+
function makeApiStagePMMock(appObjects) {
|
|
13
|
+
return new ApiStagePMMock(appObjects.getOrCreate("ApiStagePMMock"));
|
|
14
|
+
}
|
|
15
|
+
exports.makeApiStagePMMock = makeApiStagePMMock;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import { HostAppObject, HostAppObjectRepo } from "../../../HostAppObject";
|
|
3
|
+
import { UserTokenPM } from "../PMs/UserTokenPM";
|
|
4
|
+
export declare class UserTokenPMMock extends UserTokenPM {
|
|
5
|
+
vmsAreEqual: jest.Mock<any, any>;
|
|
6
|
+
constructor(appObject: HostAppObject);
|
|
7
|
+
}
|
|
8
|
+
export declare function makeUserTokenPMMock(appObjects: HostAppObjectRepo): UserTokenPMMock;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeUserTokenPMMock = exports.UserTokenPMMock = void 0;
|
|
4
|
+
const UserTokenPM_1 = require("../PMs/UserTokenPM");
|
|
5
|
+
class UserTokenPMMock extends UserTokenPM_1.UserTokenPM {
|
|
6
|
+
constructor(appObject) {
|
|
7
|
+
super(appObject, UserTokenPM_1.UserTokenPM.type);
|
|
8
|
+
this.vmsAreEqual = jest.fn();
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.UserTokenPMMock = UserTokenPMMock;
|
|
12
|
+
function makeUserTokenPMMock(appObjects) {
|
|
13
|
+
return new UserTokenPMMock(appObjects.getOrCreate("UserTokenPMMock"));
|
|
14
|
+
}
|
|
15
|
+
exports.makeUserTokenPMMock = makeUserTokenPMMock;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
1
|
+
export * from "./ApiStagePMMock";
|
|
2
|
+
export * from "./MockBasicFetchUC";
|
|
3
|
+
export * from "./MockBlobRequestUC";
|
|
4
|
+
export * from "./MockDeleteAssetOnAPIUC";
|
|
5
|
+
export * from "./MockFetchAssetFileFromAPIUC";
|
|
6
|
+
export * from "./MockFetchAssetMetaFromAPIUC";
|
|
7
|
+
export * from "./MockFileUpload";
|
|
8
|
+
export * from "./MockGetAppFromAPIUC";
|
|
9
|
+
export * from "./MockGetAssetsForOwnerUC";
|
|
10
|
+
export * from "./MockJsonRequestUC";
|
|
11
|
+
export * from "./MockPatchAssetFileUC";
|
|
12
|
+
export * from "./MockPatchAssetIsArchivedUC";
|
|
13
|
+
export * from "./MockPatchAssetMetaUC";
|
|
14
|
+
export * from "./MockPatchAssetUC";
|
|
15
|
+
export * from "./MockPostNewAssetUC";
|
|
16
|
+
export * from "./MockSignedAuthToken";
|
|
17
|
+
export * from "./MockUserLoginUC";
|
|
18
|
+
export * from "./UserTokenPMMock";
|
|
@@ -10,6 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./ApiStagePMMock"), exports);
|
|
13
14
|
__exportStar(require("./MockBasicFetchUC"), exports);
|
|
14
15
|
__exportStar(require("./MockBlobRequestUC"), exports);
|
|
15
16
|
__exportStar(require("./MockDeleteAssetOnAPIUC"), exports);
|
|
@@ -26,3 +27,4 @@ __exportStar(require("./MockPatchAssetUC"), exports);
|
|
|
26
27
|
__exportStar(require("./MockPostNewAssetUC"), exports);
|
|
27
28
|
__exportStar(require("./MockSignedAuthToken"), exports);
|
|
28
29
|
__exportStar(require("./MockUserLoginUC"), exports);
|
|
30
|
+
__exportStar(require("./UserTokenPMMock"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HostAppObject, HostAppObjectPM, HostAppObjectRepo } from "../../../HostAppObject";
|
|
2
|
+
import { APIStage } from "../Entities";
|
|
3
|
+
export declare abstract class ApiStagePM extends HostAppObjectPM<APIStage> {
|
|
4
|
+
static type: string;
|
|
5
|
+
static get(appObjects: HostAppObjectRepo): ApiStagePM | undefined;
|
|
6
|
+
}
|
|
7
|
+
export declare function makeApiStagePM(appObject: HostAppObject): ApiStagePM;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeApiStagePM = exports.ApiStagePM = void 0;
|
|
4
|
+
const HostAppObject_1 = require("../../../HostAppObject");
|
|
5
|
+
const Entities_1 = require("../Entities");
|
|
6
|
+
class ApiStagePM extends HostAppObject_1.HostAppObjectPM {
|
|
7
|
+
static get(appObjects) {
|
|
8
|
+
return HostAppObject_1.getSingletonComponent(ApiStagePM.type, appObjects);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.ApiStagePM = ApiStagePM;
|
|
12
|
+
ApiStagePM.type = "ApiStagePM";
|
|
13
|
+
function makeApiStagePM(appObject) {
|
|
14
|
+
return new ApiStagePMImp(appObject);
|
|
15
|
+
}
|
|
16
|
+
exports.makeApiStagePM = makeApiStagePM;
|
|
17
|
+
class ApiStagePMImp extends ApiStagePM {
|
|
18
|
+
constructor(appObject) {
|
|
19
|
+
var _a;
|
|
20
|
+
super(appObject, ApiStagePM.type);
|
|
21
|
+
this.onEntityChange = () => {
|
|
22
|
+
if (!this.api)
|
|
23
|
+
return;
|
|
24
|
+
this.doUpdateView(this.api.apiStage);
|
|
25
|
+
};
|
|
26
|
+
this.appObjects.registerSingleton(this);
|
|
27
|
+
(_a = this.api) === null || _a === void 0 ? void 0 : _a.addChangeObserver(this.onEntityChange);
|
|
28
|
+
this.onEntityChange();
|
|
29
|
+
}
|
|
30
|
+
get api() {
|
|
31
|
+
return this.getCachedSingleton(Entities_1.VivedAPIEntity.type);
|
|
32
|
+
}
|
|
33
|
+
vmsAreEqual(a, b) {
|
|
34
|
+
return a === b;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { HostAppObject, HostAppObjectPM, HostAppObjectRepo } from
|
|
2
|
-
export declare class UserTokenPM extends HostAppObjectPM<string> {
|
|
1
|
+
import { HostAppObject, HostAppObjectPM, HostAppObjectRepo } from "../../../HostAppObject";
|
|
2
|
+
export declare abstract class UserTokenPM extends HostAppObjectPM<string> {
|
|
3
3
|
static type: string;
|
|
4
4
|
static get(appObjects: HostAppObjectRepo): UserTokenPM | undefined;
|
|
5
|
-
private vivedAPI?;
|
|
6
|
-
vmsAreEqual(a: string, b: string): boolean;
|
|
7
|
-
private onEntityChange;
|
|
8
|
-
constructor(appObject: HostAppObject);
|
|
9
5
|
}
|
|
6
|
+
export declare function makeUserTokenPM(appObject: HostAppObject): UserTokenPM;
|
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UserTokenPM = void 0;
|
|
3
|
+
exports.makeUserTokenPM = exports.UserTokenPM = void 0;
|
|
4
4
|
const HostAppObject_1 = require("../../../HostAppObject");
|
|
5
5
|
const Entities_1 = require("../Entities");
|
|
6
6
|
class UserTokenPM extends HostAppObject_1.HostAppObjectPM {
|
|
7
|
+
static get(appObjects) {
|
|
8
|
+
return HostAppObject_1.getSingletonComponent(UserTokenPM.type, appObjects);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.UserTokenPM = UserTokenPM;
|
|
12
|
+
UserTokenPM.type = "UserTokenPM";
|
|
13
|
+
function makeUserTokenPM(appObject) {
|
|
14
|
+
return new UserTokenPMImp(appObject);
|
|
15
|
+
}
|
|
16
|
+
exports.makeUserTokenPM = makeUserTokenPM;
|
|
17
|
+
class UserTokenPMImp extends UserTokenPM {
|
|
7
18
|
constructor(appObject) {
|
|
19
|
+
var _a;
|
|
8
20
|
super(appObject, UserTokenPM.type);
|
|
9
21
|
this.onEntityChange = () => {
|
|
10
|
-
if (!this.
|
|
22
|
+
if (!this.sandbox)
|
|
11
23
|
return;
|
|
12
|
-
this.doUpdateView(this.
|
|
24
|
+
this.doUpdateView(this.sandbox.userToken);
|
|
13
25
|
};
|
|
14
|
-
this.vivedAPI = appObject.getComponent(Entities_1.VivedAPIEntity.type);
|
|
15
|
-
if (!this.vivedAPI) {
|
|
16
|
-
this.error('PM has been added to an App Object that does not have a VivedAPIEntity');
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
this.vivedAPI.addChangeObserver(this.onEntityChange);
|
|
20
|
-
this.onEntityChange();
|
|
21
26
|
this.appObjects.registerSingleton(this);
|
|
27
|
+
(_a = this.sandbox) === null || _a === void 0 ? void 0 : _a.addChangeObserver(this.onEntityChange);
|
|
28
|
+
this.onEntityChange();
|
|
22
29
|
}
|
|
23
|
-
|
|
24
|
-
return
|
|
30
|
+
get sandbox() {
|
|
31
|
+
return this.getCachedSingleton(Entities_1.VivedAPIEntity.type);
|
|
25
32
|
}
|
|
26
33
|
vmsAreEqual(a, b) {
|
|
27
34
|
return a === b;
|
|
28
35
|
}
|
|
29
36
|
}
|
|
30
|
-
exports.UserTokenPM = UserTokenPM;
|
|
31
|
-
UserTokenPM.type = 'UserTokenPM';
|
|
@@ -10,4 +10,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./ApiStagePM"), exports);
|
|
13
14
|
__exportStar(require("./UserTokenPM"), exports);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from "./Adapters";
|
|
2
|
+
export * from "./Controllers";
|
|
3
|
+
export * from "./Entities";
|
|
4
|
+
export * from "./Mocks";
|
|
5
|
+
export * from "./PMs";
|
|
6
|
+
export * from "./UCs";
|
|
@@ -10,6 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./Adapters"), exports);
|
|
13
14
|
__exportStar(require("./Controllers"), exports);
|
|
14
15
|
__exportStar(require("./Entities"), exports);
|
|
15
16
|
__exportStar(require("./Mocks"), exports);
|