@vived/host 5.5.0 → 5.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/dist/cjs/BoundaryLog/Adapters/boundaryLogAdapter.js +24 -0
- package/dist/cjs/BoundaryLog/Adapters/boundaryLogAdapter.js.map +1 -0
- package/dist/cjs/BoundaryLog/Adapters/index.js +18 -0
- package/dist/cjs/BoundaryLog/Adapters/index.js.map +1 -0
- package/dist/cjs/BoundaryLog/Controllers/clearBoundaryLog.js +15 -0
- package/dist/cjs/BoundaryLog/Controllers/clearBoundaryLog.js.map +1 -0
- package/dist/cjs/BoundaryLog/Controllers/index.js +18 -0
- package/dist/cjs/BoundaryLog/Controllers/index.js.map +1 -0
- package/dist/cjs/BoundaryLog/Entities/BoundaryLogEntity.js +45 -0
- package/dist/cjs/BoundaryLog/Entities/BoundaryLogEntity.js.map +1 -0
- package/dist/cjs/BoundaryLog/Entities/index.js +19 -0
- package/dist/cjs/BoundaryLog/Entities/index.js.map +1 -0
- package/dist/cjs/BoundaryLog/Entities/snapshotPayload.js +62 -0
- package/dist/cjs/BoundaryLog/Entities/snapshotPayload.js.map +1 -0
- package/dist/cjs/BoundaryLog/Factories/BoundaryLogFactory.js +62 -0
- package/dist/cjs/BoundaryLog/Factories/BoundaryLogFactory.js.map +1 -0
- package/dist/cjs/BoundaryLog/Factories/index.js +18 -0
- package/dist/cjs/BoundaryLog/Factories/index.js.map +1 -0
- package/dist/cjs/BoundaryLog/Mocks/BoundaryLogPMMock.js +16 -0
- package/dist/cjs/BoundaryLog/Mocks/BoundaryLogPMMock.js.map +1 -0
- package/dist/cjs/BoundaryLog/Mocks/index.js +18 -0
- package/dist/cjs/BoundaryLog/Mocks/index.js.map +1 -0
- package/dist/cjs/BoundaryLog/PMs/BoundaryLogPM.js +56 -0
- package/dist/cjs/BoundaryLog/PMs/BoundaryLogPM.js.map +1 -0
- package/dist/cjs/BoundaryLog/PMs/index.js +18 -0
- package/dist/cjs/BoundaryLog/PMs/index.js.map +1 -0
- package/dist/cjs/BoundaryLog/index.js +23 -0
- package/dist/cjs/BoundaryLog/index.js.map +1 -0
- package/dist/cjs/Dialog/Entities/DialogQueue.js +36 -21
- package/dist/cjs/Dialog/Entities/DialogQueue.js.map +1 -1
- package/dist/cjs/Dispatcher/Entities/HostDispatchEntity.js +17 -4
- package/dist/cjs/Dispatcher/Entities/HostDispatchEntity.js.map +1 -1
- package/dist/cjs/Dispatcher/Mocks/MockHostDispatcher.js +1 -0
- package/dist/cjs/Dispatcher/Mocks/MockHostDispatcher.js.map +1 -1
- package/dist/cjs/Handler/Entities/HostHandler.js +17 -0
- package/dist/cjs/Handler/Entities/HostHandler.js.map +1 -1
- package/dist/cjs/ThemeColors/Data/vivedDarkTheme.json +47 -47
- package/dist/cjs/ThemeColors/Data/vivedLightTheme.json +47 -47
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/BoundaryLog/Adapters/boundaryLogAdapter.js +21 -0
- package/dist/esm/BoundaryLog/Adapters/boundaryLogAdapter.js.map +1 -0
- package/dist/esm/BoundaryLog/Adapters/index.js +2 -0
- package/dist/esm/BoundaryLog/Adapters/index.js.map +1 -0
- package/dist/esm/BoundaryLog/Controllers/clearBoundaryLog.js +12 -0
- package/dist/esm/BoundaryLog/Controllers/clearBoundaryLog.js.map +1 -0
- package/dist/esm/BoundaryLog/Controllers/index.js +2 -0
- package/dist/esm/BoundaryLog/Controllers/index.js.map +1 -0
- package/dist/esm/BoundaryLog/Entities/BoundaryLogEntity.js +40 -0
- package/dist/esm/BoundaryLog/Entities/BoundaryLogEntity.js.map +1 -0
- package/dist/esm/BoundaryLog/Entities/index.js +3 -0
- package/dist/esm/BoundaryLog/Entities/index.js.map +1 -0
- package/dist/esm/BoundaryLog/Entities/snapshotPayload.js +59 -0
- package/dist/esm/BoundaryLog/Entities/snapshotPayload.js.map +1 -0
- package/dist/esm/BoundaryLog/Factories/BoundaryLogFactory.js +57 -0
- package/dist/esm/BoundaryLog/Factories/BoundaryLogFactory.js.map +1 -0
- package/dist/esm/BoundaryLog/Factories/index.js +2 -0
- package/dist/esm/BoundaryLog/Factories/index.js.map +1 -0
- package/dist/esm/BoundaryLog/Mocks/BoundaryLogPMMock.js +11 -0
- package/dist/esm/BoundaryLog/Mocks/BoundaryLogPMMock.js.map +1 -0
- package/dist/esm/BoundaryLog/Mocks/index.js +2 -0
- package/dist/esm/BoundaryLog/Mocks/index.js.map +1 -0
- package/dist/esm/BoundaryLog/PMs/BoundaryLogPM.js +51 -0
- package/dist/esm/BoundaryLog/PMs/BoundaryLogPM.js.map +1 -0
- package/dist/esm/BoundaryLog/PMs/index.js +2 -0
- package/dist/esm/BoundaryLog/PMs/index.js.map +1 -0
- package/dist/esm/BoundaryLog/index.js +7 -0
- package/dist/esm/BoundaryLog/index.js.map +1 -0
- package/dist/esm/Dialog/Entities/DialogQueue.js +36 -21
- package/dist/esm/Dialog/Entities/DialogQueue.js.map +1 -1
- package/dist/esm/Dispatcher/Entities/HostDispatchEntity.js +17 -4
- package/dist/esm/Dispatcher/Entities/HostDispatchEntity.js.map +1 -1
- package/dist/esm/Dispatcher/Mocks/MockHostDispatcher.js +1 -0
- package/dist/esm/Dispatcher/Mocks/MockHostDispatcher.js.map +1 -1
- package/dist/esm/Handler/Entities/HostHandler.js +17 -0
- package/dist/esm/Handler/Entities/HostHandler.js.map +1 -1
- package/dist/esm/ThemeColors/Data/vivedDarkTheme.json +47 -47
- package/dist/esm/ThemeColors/Data/vivedLightTheme.json +47 -47
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/types/BoundaryLog/Adapters/boundaryLogAdapter.d.ts +4 -0
- package/dist/types/BoundaryLog/Adapters/boundaryLogAdapter.d.ts.map +1 -0
- package/dist/types/BoundaryLog/Adapters/index.d.ts +2 -0
- package/dist/types/BoundaryLog/Adapters/index.d.ts.map +1 -0
- package/dist/types/BoundaryLog/Controllers/clearBoundaryLog.d.ts +4 -0
- package/dist/types/BoundaryLog/Controllers/clearBoundaryLog.d.ts.map +1 -0
- package/dist/types/BoundaryLog/Controllers/index.d.ts +2 -0
- package/dist/types/BoundaryLog/Controllers/index.d.ts.map +1 -0
- package/dist/types/BoundaryLog/Entities/BoundaryLogEntity.d.ts +37 -0
- package/dist/types/BoundaryLog/Entities/BoundaryLogEntity.d.ts.map +1 -0
- package/dist/types/BoundaryLog/Entities/index.d.ts +3 -0
- package/dist/types/BoundaryLog/Entities/index.d.ts.map +1 -0
- package/dist/types/BoundaryLog/Entities/snapshotPayload.d.ts +16 -0
- package/dist/types/BoundaryLog/Entities/snapshotPayload.d.ts.map +1 -0
- package/dist/types/BoundaryLog/Factories/BoundaryLogFactory.d.ts +17 -0
- package/dist/types/BoundaryLog/Factories/BoundaryLogFactory.d.ts.map +1 -0
- package/dist/types/BoundaryLog/Factories/index.d.ts +2 -0
- package/dist/types/BoundaryLog/Factories/index.d.ts.map +1 -0
- package/dist/types/BoundaryLog/Mocks/BoundaryLogPMMock.d.ts +8 -0
- package/dist/types/BoundaryLog/Mocks/BoundaryLogPMMock.d.ts.map +1 -0
- package/dist/types/BoundaryLog/Mocks/index.d.ts +2 -0
- package/dist/types/BoundaryLog/Mocks/index.d.ts.map +1 -0
- package/dist/types/BoundaryLog/PMs/BoundaryLogPM.d.ts +18 -0
- package/dist/types/BoundaryLog/PMs/BoundaryLogPM.d.ts.map +1 -0
- package/dist/types/BoundaryLog/PMs/index.d.ts +2 -0
- package/dist/types/BoundaryLog/PMs/index.d.ts.map +1 -0
- package/dist/types/BoundaryLog/index.d.ts +7 -0
- package/dist/types/BoundaryLog/index.d.ts.map +1 -0
- package/dist/types/Dispatcher/Entities/HostDispatchEntity.d.ts +17 -0
- package/dist/types/Dispatcher/Entities/HostDispatchEntity.d.ts.map +1 -1
- package/dist/types/Dispatcher/Mocks/MockHostDispatcher.d.ts +1 -0
- package/dist/types/Dispatcher/Mocks/MockHostDispatcher.d.ts.map +1 -1
- package/dist/types/Handler/Entities/HostHandler.d.ts +18 -1
- package/dist/types/Handler/Entities/HostHandler.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { DomainFactory } from "@vived/core";
|
|
2
|
+
import { AppSandboxEntity } from "../../AppSandbox/Entities/AppSandboxEntity";
|
|
3
|
+
import { HostDispatchEntity } from "../../Dispatcher/Entities/HostDispatchEntity";
|
|
4
|
+
import { HostHandlerEntity } from "../../Handler/Entities/HostHandler";
|
|
5
|
+
import { BoundaryLogEntity, makeBoundaryLogEntity } from "../Entities";
|
|
6
|
+
import { makeBoundaryLogPM } from "../PMs";
|
|
7
|
+
/**
|
|
8
|
+
* Sets up the Boundary Log and wires its passive observers into the per-App
|
|
9
|
+
* communication entities (ADR-0002). The observers are attached in finalSetup,
|
|
10
|
+
* after every entity exists but before the App mounts — so the host-internal
|
|
11
|
+
* version-negotiation dispatches fired at registration are captured too.
|
|
12
|
+
*/
|
|
13
|
+
export class BoundaryLogFactory extends DomainFactory {
|
|
14
|
+
constructor(appObject) {
|
|
15
|
+
super(appObject);
|
|
16
|
+
this.factoryName = "BoundaryLogFactory";
|
|
17
|
+
}
|
|
18
|
+
setupEntities() {
|
|
19
|
+
makeBoundaryLogEntity(this.appObject);
|
|
20
|
+
}
|
|
21
|
+
setupUCs() {
|
|
22
|
+
// No use cases.
|
|
23
|
+
}
|
|
24
|
+
setupPMs() {
|
|
25
|
+
makeBoundaryLogPM(this.appObject);
|
|
26
|
+
}
|
|
27
|
+
finalSetup() {
|
|
28
|
+
const boundaryLog = BoundaryLogEntity.get(this.appObjects);
|
|
29
|
+
if (!boundaryLog) {
|
|
30
|
+
this.error("BoundaryLogEntity not found during final setup.");
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const sandbox = AppSandboxEntity.get(this.appObjects);
|
|
34
|
+
if (!sandbox) {
|
|
35
|
+
this.error("AppSandboxEntity not found during final setup.");
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const appObject = this.appObjects.get(sandbox.appID);
|
|
39
|
+
if (!appObject) {
|
|
40
|
+
this.error("App AppObject not found during final setup.");
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const dispatch = HostDispatchEntity.get(appObject);
|
|
44
|
+
if (dispatch) {
|
|
45
|
+
dispatch.requestObserver = (request, outcome) => boundaryLog.recordTraffic("dispatch", request, outcome);
|
|
46
|
+
}
|
|
47
|
+
const handler = HostHandlerEntity.get(appObject);
|
|
48
|
+
if (handler) {
|
|
49
|
+
handler.requestObserver = (request, outcome) => boundaryLog.recordTraffic("handler", request, outcome);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export function makeBoundaryLogFactory(appObjects) {
|
|
54
|
+
const ao = appObjects.getOrCreate("BoundaryLog");
|
|
55
|
+
return new BoundaryLogFactory(ao);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=BoundaryLogFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BoundaryLogFactory.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/Factories/BoundaryLogFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,aAAa,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,OAAO,kBAAmB,SAAQ,aAAa;IAGnD,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,CAAC,CA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,EAAE,CAC7C,WAAW,CAAC,aAAa,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;CACF;AAED,MAAM,UAAU,sBAAsB,CACpC,UAAyB;IAEzB,MAAM,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IACjD,OAAO,IAAI,kBAAkB,CAAC,EAAE,CAAC,CAAC;AACpC,CAAC","sourcesContent":["import { AppObject, AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport { AppSandboxEntity } from \"../../AppSandbox/Entities/AppSandboxEntity\";\r\nimport { HostDispatchEntity } from \"../../Dispatcher/Entities/HostDispatchEntity\";\r\nimport { HostHandlerEntity } from \"../../Handler/Entities/HostHandler\";\r\nimport { BoundaryLogEntity, makeBoundaryLogEntity } from \"../Entities\";\r\nimport { makeBoundaryLogPM } from \"../PMs\";\r\n\r\n/**\r\n * Sets up the Boundary Log and wires its passive observers into the per-App\r\n * communication entities (ADR-0002). The observers are attached in finalSetup,\r\n * after every entity exists but before the App mounts — so the host-internal\r\n * version-negotiation dispatches fired at registration are captured too.\r\n */\r\nexport class BoundaryLogFactory extends DomainFactory {\r\n readonly factoryName = \"BoundaryLogFactory\";\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject);\r\n }\r\n\r\n setupEntities(): void {\r\n makeBoundaryLogEntity(this.appObject);\r\n }\r\n\r\n setupUCs(): void {\r\n // No use cases.\r\n }\r\n\r\n setupPMs(): void {\r\n makeBoundaryLogPM(this.appObject);\r\n }\r\n\r\n finalSetup(): void {\r\n const boundaryLog = BoundaryLogEntity.get(this.appObjects);\r\n if (!boundaryLog) {\r\n this.error(\"BoundaryLogEntity not found during final setup.\");\r\n return;\r\n }\r\n\r\n const sandbox = AppSandboxEntity.get(this.appObjects);\r\n if (!sandbox) {\r\n this.error(\"AppSandboxEntity not found during final setup.\");\r\n return;\r\n }\r\n\r\n const appObject = this.appObjects.get(sandbox.appID);\r\n if (!appObject) {\r\n this.error(\"App AppObject not found during final setup.\");\r\n return;\r\n }\r\n\r\n const dispatch = HostDispatchEntity.get(appObject);\r\n if (dispatch) {\r\n dispatch.requestObserver = (request, outcome) =>\r\n boundaryLog.recordTraffic(\"dispatch\", request, outcome);\r\n }\r\n\r\n const handler = HostHandlerEntity.get(appObject);\r\n if (handler) {\r\n handler.requestObserver = (request, outcome) =>\r\n boundaryLog.recordTraffic(\"handler\", request, outcome);\r\n }\r\n }\r\n}\r\n\r\nexport function makeBoundaryLogFactory(\r\n appObjects: AppObjectRepo\r\n): BoundaryLogFactory {\r\n const ao = appObjects.getOrCreate(\"BoundaryLog\");\r\n return new BoundaryLogFactory(ao);\r\n}\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/Factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC","sourcesContent":["export * from \"./BoundaryLogFactory\";\r\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BoundaryLogPM } from "../PMs";
|
|
2
|
+
export class BoundaryLogPMMock extends BoundaryLogPM {
|
|
3
|
+
constructor(appObject) {
|
|
4
|
+
super(appObject, BoundaryLogPM.type);
|
|
5
|
+
this.vmsAreEqual = jest.fn();
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export function makeBoundaryLogPMMock(appObjects) {
|
|
9
|
+
return new BoundaryLogPMMock(appObjects.getOrCreate("BoundaryLogPMMock"));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=BoundaryLogPMMock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BoundaryLogPMMock.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/Mocks/BoundaryLogPMMock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,OAAO,iBAAkB,SAAQ,aAAa;IAGlD,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;QAHvC,gBAAW,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAIxB,CAAC;CACF;AAED,MAAM,UAAU,qBAAqB,CAAC,UAAyB;IAC7D,OAAO,IAAI,iBAAiB,CAAC,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["import { AppObject, AppObjectRepo } from \"@vived/core\";\r\nimport { BoundaryLogPM } from \"../PMs\";\r\n\r\nexport class BoundaryLogPMMock extends BoundaryLogPM {\r\n vmsAreEqual = jest.fn();\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, BoundaryLogPM.type);\r\n }\r\n}\r\n\r\nexport function makeBoundaryLogPMMock(appObjects: AppObjectRepo) {\r\n return new BoundaryLogPMMock(appObjects.getOrCreate(\"BoundaryLogPMMock\"));\r\n}\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/Mocks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC","sourcesContent":["export * from \"./BoundaryLogPMMock\";\r\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { getSingletonComponent, AppObjectPM } from "@vived/core";
|
|
2
|
+
import { BoundaryLogEntity } from "../Entities";
|
|
3
|
+
export const defaultBoundaryLogVM = {
|
|
4
|
+
records: [],
|
|
5
|
+
count: 0
|
|
6
|
+
};
|
|
7
|
+
export class BoundaryLogPM extends AppObjectPM {
|
|
8
|
+
static get(appObjects) {
|
|
9
|
+
return getSingletonComponent(BoundaryLogPM.type, appObjects);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
BoundaryLogPM.type = "BoundaryLogPM";
|
|
13
|
+
export function makeBoundaryLogPM(appObject) {
|
|
14
|
+
return new BoundaryLogPMImp(appObject);
|
|
15
|
+
}
|
|
16
|
+
class BoundaryLogPMImp extends BoundaryLogPM {
|
|
17
|
+
get boundaryLog() {
|
|
18
|
+
return this.getCachedSingleton(BoundaryLogEntity.type);
|
|
19
|
+
}
|
|
20
|
+
vmsAreEqual(a, b) {
|
|
21
|
+
if (a.count !== b.count)
|
|
22
|
+
return false;
|
|
23
|
+
if (a.records.length !== b.records.length)
|
|
24
|
+
return false;
|
|
25
|
+
for (let i = 0; i < a.records.length; i++) {
|
|
26
|
+
if (a.records[i] !== b.records[i])
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
constructor(appObject) {
|
|
32
|
+
super(appObject, BoundaryLogPM.type);
|
|
33
|
+
this.onEntityChange = () => {
|
|
34
|
+
if (!this.boundaryLog)
|
|
35
|
+
return;
|
|
36
|
+
// Copy the array (new VM identity) but keep record references stable so
|
|
37
|
+
// vmsAreEqual can compare cheaply. Order is insertion order = the order the
|
|
38
|
+
// Requests were observed.
|
|
39
|
+
const records = [...this.boundaryLog.records];
|
|
40
|
+
const vm = {
|
|
41
|
+
records,
|
|
42
|
+
count: records.length
|
|
43
|
+
};
|
|
44
|
+
this.doUpdateView(vm);
|
|
45
|
+
};
|
|
46
|
+
this.onEntityChange();
|
|
47
|
+
this.boundaryLog?.addChangeObserver(this.onEntityChange);
|
|
48
|
+
this.appObjects.registerSingleton(this);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=BoundaryLogPM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BoundaryLogPM.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/PMs/BoundaryLogPM.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAErB,WAAW,EAEZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAiB,MAAM,aAAa,CAAC;AAY/D,MAAM,CAAC,MAAM,oBAAoB,GAAkB;I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AG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAC9C,MAAM,EAAE,GAAkB;gBACxB,OAAO;gBACP,KAAK,EAAE,OAAO,CAAC,MAAM;aACtB,CAAC;YAEF,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QACxB,CAAC,CAAC;QAKA,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,WAAW,EAAE,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACzD,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import {\r\n getSingletonComponent,\r\n AppObject,\r\n AppObjectPM,\r\n AppObjectRepo\r\n} from \"@vived/core\";\r\nimport { BoundaryLogEntity, RequestRecord } from \"../Entities\";\r\n\r\n/**\r\n * The view projection of the Boundary Log: the recorded Requests in observation\r\n * order (each row carries its direction so the view can side Dispatches and\r\n * Handlers independently) plus the total count.\r\n */\r\nexport interface BoundaryLogVM {\r\n records: RequestRecord[];\r\n count: number;\r\n}\r\n\r\nexport const defaultBoundaryLogVM: BoundaryLogVM = {\r\n records: [],\r\n count: 0\r\n};\r\n\r\nexport abstract class BoundaryLogPM extends AppObjectPM<BoundaryLogVM> {\r\n static type = \"BoundaryLogPM\";\r\n\r\n static get(appObjects: AppObjectRepo) {\r\n return getSingletonComponent<BoundaryLogPM>(BoundaryLogPM.type, appObjects);\r\n }\r\n}\r\n\r\nexport function makeBoundaryLogPM(appObject: AppObject): BoundaryLogPM {\r\n return new BoundaryLogPMImp(appObject);\r\n}\r\n\r\nclass BoundaryLogPMImp extends BoundaryLogPM {\r\n private get boundaryLog() {\r\n return this.getCachedSingleton<BoundaryLogEntity>(BoundaryLogEntity.type);\r\n }\r\n\r\n vmsAreEqual(a: BoundaryLogVM, b: BoundaryLogVM): boolean {\r\n if (a.count !== b.count) return false;\r\n if (a.records.length !== b.records.length) return false;\r\n for (let i = 0; i < a.records.length; i++) {\r\n if (a.records[i] !== b.records[i]) return false;\r\n }\r\n return true;\r\n }\r\n\r\n private onEntityChange = () => {\r\n if (!this.boundaryLog) return;\r\n\r\n // Copy the array (new VM identity) but keep record references stable so\r\n // vmsAreEqual can compare cheaply. Order is insertion order = the order the\r\n // Requests were observed.\r\n const records = [...this.boundaryLog.records];\r\n const vm: BoundaryLogVM = {\r\n records,\r\n count: records.length\r\n };\r\n\r\n this.doUpdateView(vm);\r\n };\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, BoundaryLogPM.type);\r\n\r\n this.onEntityChange();\r\n this.boundaryLog?.addChangeObserver(this.onEntityChange);\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/PMs/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC","sourcesContent":["export * from \"./BoundaryLogPM\";\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/BoundaryLog/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC","sourcesContent":["export * from \"./Adapters\";\r\nexport * from \"./Controllers\";\r\nexport * from \"./Entities\";\r\nexport * from \"./Factories\";\r\nexport * from \"./Mocks\";\r\nexport * from \"./PMs\";\r\n"]}
|
|
@@ -19,36 +19,51 @@ class DialogRepoImp extends DialogQueue {
|
|
|
19
19
|
this.dialogQueue = [];
|
|
20
20
|
this.submitDialog = (dialog) => {
|
|
21
21
|
this.dialogQueue.push(dialog);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
dialog.addChangeObserver(this.notifyOnChange);
|
|
22
|
+
dialog.addChangeObserver(this.onDialogChange);
|
|
23
|
+
this.openActiveDialog();
|
|
26
24
|
this.notifyOnChange();
|
|
27
25
|
};
|
|
28
26
|
this.activeDialogHasClosed = () => {
|
|
29
27
|
const currentActiveDialog = this.activeDialog;
|
|
30
|
-
if (currentActiveDialog
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
if (currentActiveDialog === null)
|
|
29
|
+
return;
|
|
30
|
+
// Dismissal comes via two routes: a dialog's own close() (which sets
|
|
31
|
+
// hasBeenClosed) or the host's backdrop/escape path (this method). Mark the
|
|
32
|
+
// active dialog closed here so both routes converge on the same advance.
|
|
33
|
+
currentActiveDialog.hasBeenClosed = true;
|
|
34
|
+
this.advanceQueue();
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Observes every queued dialog. When the active dialog closes itself (e.g.
|
|
38
|
+
* via its own close button), advance the queue so the next dialog surfaces;
|
|
39
|
+
* otherwise just forward the change to the queue's own observers.
|
|
40
|
+
*/
|
|
41
|
+
this.onDialogChange = () => {
|
|
42
|
+
const currentActiveDialog = this.activeDialog;
|
|
43
|
+
if (currentActiveDialog !== null && currentActiveDialog.hasBeenClosed) {
|
|
44
|
+
this.advanceQueue();
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
38
47
|
this.notifyOnChange();
|
|
39
48
|
}
|
|
40
49
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
this.dialogQueue.
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
else {
|
|
48
|
-
dialog.removeChangeObserver(this.notifyOnChange);
|
|
50
|
+
/** Drop every closed dialog, then open whatever is now the active dialog. */
|
|
51
|
+
this.advanceQueue = () => {
|
|
52
|
+
this.dialogQueue = this.dialogQueue.filter((dialog) => {
|
|
53
|
+
if (dialog.hasBeenClosed) {
|
|
54
|
+
dialog.removeChangeObserver(this.onDialogChange);
|
|
55
|
+
return false;
|
|
49
56
|
}
|
|
57
|
+
return true;
|
|
50
58
|
});
|
|
51
|
-
this.
|
|
59
|
+
this.openActiveDialog();
|
|
60
|
+
this.notifyOnChange();
|
|
61
|
+
};
|
|
62
|
+
this.openActiveDialog = () => {
|
|
63
|
+
const active = this.activeDialog;
|
|
64
|
+
if (active !== null && !active.isOpen) {
|
|
65
|
+
active.isOpen = true;
|
|
66
|
+
}
|
|
52
67
|
};
|
|
53
68
|
this.appObjects.registerSingleton(this);
|
|
54
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogQueue.js","sourceRoot":"","sources":["../../../../src/Dialog/Entities/DialogQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAEf,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAErB,MAAM,OAAgB,MAAO,SAAQ,eAAe;CAKnD;AAED,MAAM,OAAgB,WAAY,SAAQ,eAAe;IAOvD,MAAM,CAAC,GAAG,CAAC,UAAyB;QAClC,OAAO,qBAAqB,CAAc,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC1E,CAAC;;AARM,gBAAI,GAAG,aAAa,CAAC;AAW9B,MAAM,UAAU,eAAe,CAAC,SAAoB;IAClD,OAAO,IAAI,aAAa,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,aAAc,SAAQ,WAAW;IAGrC,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAClE,CAAC;
|
|
1
|
+
{"version":3,"file":"DialogQueue.js","sourceRoot":"","sources":["../../../../src/Dialog/Entities/DialogQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAEf,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAErB,MAAM,OAAgB,MAAO,SA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AI,CAAC,YAAY,CAAC;YAC9C,IAAI,mBAAmB,KAAK,IAAI,IAAI,mBAAmB,CAAC,aAAa,EAAE,CAAC;gBACtE,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,CAAC;QACH,CAAC,CAAC;QAEF,6EAA6E;QACrE,iBAAY,GAAG,GAAS,EAAE;YAChC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE;gBACpD,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;oBACzB,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;oBACjD,OAAO,KAAK,CAAC;gBACf,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,CAAC,CAAC;QAEM,qBAAgB,GAAG,GAAS,EAAE;YACpC,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC;YACjC,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;gBACtC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;YACvB,CAAC;QACH,CAAC,CAAC;QAIA,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import {\r\n AppObject,\r\n AppObjectEntity,\r\n AppObjectRepo,\r\n getSingletonComponent\r\n} from \"@vived/core\";\r\n\r\nexport abstract class Dialog extends AppObjectEntity {\r\n abstract dialogType: string;\r\n abstract preventOutsideDismiss: boolean;\r\n abstract isOpen: boolean;\r\n abstract hasBeenClosed: boolean;\r\n}\r\n\r\nexport abstract class DialogQueue extends AppObjectEntity {\r\n static type = \"DialogQueue\";\r\n\r\n abstract get activeDialog(): Dialog | null;\r\n abstract submitDialog(dialog: Dialog): void;\r\n abstract activeDialogHasClosed(): void;\r\n\r\n static get(appObjects: AppObjectRepo) {\r\n return getSingletonComponent<DialogQueue>(DialogQueue.type, appObjects);\r\n }\r\n}\r\n\r\nexport function makeDialogQueue(appObject: AppObject): DialogQueue {\r\n return new DialogRepoImp(appObject);\r\n}\r\n\r\nclass DialogRepoImp extends DialogQueue {\r\n private dialogQueue: Dialog[] = [];\r\n\r\n get activeDialog(): Dialog | null {\r\n return this.dialogQueue.length > 0 ? this.dialogQueue[0] : null;\r\n }\r\n\r\n submitDialog = (dialog: Dialog): void => {\r\n this.dialogQueue.push(dialog);\r\n\r\n dialog.addChangeObserver(this.onDialogChange);\r\n\r\n this.openActiveDialog();\r\n this.notifyOnChange();\r\n };\r\n\r\n activeDialogHasClosed = (): void => {\r\n const currentActiveDialog = this.activeDialog;\r\n if (currentActiveDialog === null) return;\r\n\r\n // Dismissal comes via two routes: a dialog's own close() (which sets\r\n // hasBeenClosed) or the host's backdrop/escape path (this method). Mark the\r\n // active dialog closed here so both routes converge on the same advance.\r\n currentActiveDialog.hasBeenClosed = true;\r\n this.advanceQueue();\r\n };\r\n\r\n /**\r\n * Observes every queued dialog. When the active dialog closes itself (e.g.\r\n * via its own close button), advance the queue so the next dialog surfaces;\r\n * otherwise just forward the change to the queue's own observers.\r\n */\r\n private onDialogChange = (): void => {\r\n const currentActiveDialog = this.activeDialog;\r\n if (currentActiveDialog !== null && currentActiveDialog.hasBeenClosed) {\r\n this.advanceQueue();\r\n } else {\r\n this.notifyOnChange();\r\n }\r\n };\r\n\r\n /** Drop every closed dialog, then open whatever is now the active dialog. */\r\n private advanceQueue = (): void => {\r\n this.dialogQueue = this.dialogQueue.filter((dialog) => {\r\n if (dialog.hasBeenClosed) {\r\n dialog.removeChangeObserver(this.onDialogChange);\r\n return false;\r\n }\r\n return true;\r\n });\r\n\r\n this.openActiveDialog();\r\n this.notifyOnChange();\r\n };\r\n\r\n private openActiveDialog = (): void => {\r\n const active = this.activeDialog;\r\n if (active !== null && !active.isOpen) {\r\n active.isOpen = true;\r\n }\r\n };\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, DialogQueue.type);\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
|
|
@@ -61,23 +61,36 @@ class HostDispatchEntityImp extends HostDispatchEntity {
|
|
|
61
61
|
this.setupPayloadVersions = (payloadVersion) => {
|
|
62
62
|
this.appPayloadVersions = payloadVersion;
|
|
63
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* Notify the passive observer, if any. Wrapped so a throwing or slow observer
|
|
66
|
+
* can never alter, delay, or fail the Request's delivery (ADR-0002).
|
|
67
|
+
*/
|
|
68
|
+
this.notifyObserver = (request, outcome) => {
|
|
69
|
+
if (!this.requestObserver)
|
|
70
|
+
return;
|
|
71
|
+
try {
|
|
72
|
+
this.requestObserver(request, outcome);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// Passive: an observer failure must never affect dispatch.
|
|
76
|
+
}
|
|
77
|
+
};
|
|
64
78
|
this.dispatch = (request) => {
|
|
65
79
|
if (!this.appHandler) {
|
|
66
80
|
this.error("No app handler has been registered");
|
|
81
|
+
this.notifyObserver(request, "no-app-handler");
|
|
67
82
|
return;
|
|
68
83
|
}
|
|
69
84
|
try {
|
|
70
85
|
this.appHandler(request);
|
|
86
|
+
this.notifyObserver(request, "delivered");
|
|
71
87
|
}
|
|
72
88
|
catch (e) {
|
|
73
89
|
this.warn(e.message);
|
|
90
|
+
this.notifyObserver(request, "threw");
|
|
74
91
|
}
|
|
75
92
|
};
|
|
76
93
|
this.formRequestAndDispatch = (type, version, payload) => {
|
|
77
|
-
if (!this.appHandler) {
|
|
78
|
-
this.error("No app handler has been registered");
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
94
|
const request = {
|
|
82
95
|
type,
|
|
83
96
|
version,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HostDispatchEntity.js","sourceRoot":"","sources":["../../../../src/Dispatcher/Entities/HostDispatchEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,eAAe,EAAiB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"HostDispatchEntity.js","sourceRoot":"","sources":["../../../../src/Dispatcher/Entities/HostDispatchEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,eAAe,EAAiB,MAAM,aAAa,CAAC;AAoBxE,MAAM,OAAgB,kBAAmB,SAAQ,eAAe;IAoB9D,MAAM,CAAC,GAAG,CAAC,SAAoB;QAC7B,MAAM,SAAS,GAAG,SAAS,CAAC,YAAY,CACtC,kBAAkB,CAAC,IAAI,CACxB,CAAC;QACF,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,SAAS,CAAC,aAAa,CAAC,aAAa,CACnC,iBAAiB,EACjB,kDAAkD,GAAG,SAAS,CAAC,EAAE,CAClE,CAAC;QACJ,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,OAAO,CACZ,EAAU,EACV,UAAyB;QAEzB,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,UAAU,CAAC,aAAa,CACtB,qBAAqB,EACrB,4BAA4B,GAAG,EAAE,CAClC,CAAC;YACF,OAAO;QACT,CAAC;QACD,OAAO,kBAAkB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;;AA7Ce,uBAAI,GAAG,oBAAoB,CAAC;AAgD9C,MAAM,UAAU,sBAAsB,CACpC,SAAoB;IAEpB,OAAO,IAAI,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,qBAAsB,SAAQ,kBAAkB;IAIpD,IAAW,iBAAiB;QAC1B,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAaO,oBAAoB;QAC1B,MAAM,IA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EAAE,EAAE;YACrE,IAAI,CAAC,kBAAkB,GAAG,cAAc,CAAC;QAC3C,CAAC,CAAC;QAIF;;;WAGG;QACK,mBAAc,GAAG,CAAC,OAAgB,EAAE,OAAwB,EAAE,EAAE;YACtE,IAAI,CAAC,IAAI,CAAC,eAAe;gBAAE,OAAO;YAClC,IAAI,CAAC;gBACH,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACzC,CAAC;YAAC,MAAM,CAAC;gBACP,2DAA2D;YAC7D,CAAC;QACH,CAAC,CAAC;QAEF,aAAQ,GAAG,CAAC,OAAgB,EAAE,EAAE;YAC9B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;gBACrB,IAAI,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;gBACjD,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;gBAC/C,OAAO;YACT,CAAC;YAED,IAAI,CAAC;gBACH,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBACzB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAC5C,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,IAAI,CAAC,IAAI,CAAE,CAAW,CAAC,OAAO,CAAC,CAAC;gBAChC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACxC,CAAC;QACH,CAAC,CAAC;QAEF,2BAAsB,GAAG,CACvB,IAAY,EACZ,OAAe,EACf,OAA4B,EAC5B,EAAE;YACF,MAAM,OAAO,GAAY;gBACvB,IAAI;gBACJ,OAAO;gBACP,OAAO;aACR,CAAC;YAEF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACzB,CAAC,CAAC;IAIF,CAAC;CACF","sourcesContent":["import { AppObject, AppObjectEntity, AppObjectRepo } from \"@vived/core\";\r\nimport { Handler, Request } from \"@vived/core\";\r\n\r\n/**\r\n * The outcome of an outbound Dispatch, as seen at the dispatch chokepoint:\r\n * \"delivered\" (the app handler ran), \"no-app-handler\" (nothing registered to\r\n * receive it), or \"threw\" (the app handler raised).\r\n */\r\nexport type DispatchOutcome = \"delivered\" | \"no-app-handler\" | \"threw\";\r\n\r\n/**\r\n * Passive observer of outbound Dispatches. Notified after each Request is\r\n * dispatched, with the outcome. Purely observational — see the passivity\r\n * contract in ADR-0002: an observer must never alter, delay, or fail delivery.\r\n */\r\nexport type DispatchObserver = (\r\n request: Request,\r\n outcome: DispatchOutcome\r\n) => void;\r\n\r\nexport abstract class HostDispatchEntity extends AppObjectEntity {\r\n static readonly type = \"HostDispatchEntity\";\r\n\r\n abstract appHandlerVersion: number;\r\n abstract getRequestPayloadVersion(requestType: string): number | undefined;\r\n abstract registerAppHandler: (appHandler: Handler) => void;\r\n abstract clearAppHandler: () => void;\r\n abstract dispatch: (request: Request) => void;\r\n abstract formRequestAndDispatch: (\r\n type: string,\r\n version: number,\r\n payload?: object | undefined\r\n ) => void;\r\n\r\n /**\r\n * Optional passive observer of outbound Dispatches (ADR-0002). Unset by\r\n * default, so production hosts pay nothing and behave exactly as before.\r\n */\r\n abstract requestObserver?: DispatchObserver;\r\n\r\n static get(appObject: AppObject): HostDispatchEntity | undefined {\r\n const component = appObject.getComponent<HostDispatchEntity>(\r\n HostDispatchEntity.type\r\n );\r\n if (!component) {\r\n appObject.appObjectRepo.submitWarning(\r\n \"AssetEntity.get\",\r\n \"Unable to find HostDispatchEntity on app object \" + appObject.id\r\n );\r\n }\r\n return component;\r\n }\r\n\r\n static getByID(\r\n id: string,\r\n appObjects: AppObjectRepo\r\n ): HostDispatchEntity | undefined {\r\n const appObject = appObjects.get(id);\r\n if (!appObject) {\r\n appObjects.submitWarning(\r\n \"AssetEntity.getByID\",\r\n \"Unable to find app object \" + id\r\n );\r\n return;\r\n }\r\n return HostDispatchEntity.get(appObject);\r\n }\r\n}\r\n\r\nexport function makeHostDispatchEntity(\r\n appObject: AppObject\r\n): HostDispatchEntity {\r\n return new HostDispatchEntityImp(appObject);\r\n}\r\n\r\nclass HostDispatchEntityImp extends HostDispatchEntity {\r\n private appHandler?: Handler;\r\n\r\n private _appHandlerVersion = 0;\r\n public get appHandlerVersion() {\r\n return this._appHandlerVersion;\r\n }\r\n\r\n private appPayloadVersions = new Map<string, number>();\r\n\r\n registerAppHandler = (appHandler: Handler) => {\r\n this.appHandler = appHandler;\r\n this.getAppHandlerVersion();\r\n };\r\n\r\n clearAppHandler = () => {\r\n this.appHandler = undefined;\r\n };\r\n\r\n private getAppHandlerVersion() {\r\n const type = \"GET_APP_HANDLER_VERSION\";\r\n const payload = { callback: this.setupVersion };\r\n\r\n try {\r\n this.formRequestAndDispatch(type, 1, payload);\r\n } catch {\r\n // All good. this is probably an older app\r\n }\r\n }\r\n\r\n getRequestPayloadVersion = (requestType: string): number | undefined => {\r\n return this.appPayloadVersions.get(requestType);\r\n };\r\n\r\n private setupVersion = (version: number) => {\r\n // Apps before app package version 2.27 will not reach this\r\n this._appHandlerVersion = version;\r\n this.getPayloadVersions();\r\n };\r\n\r\n private getPayloadVersions = () => {\r\n const type = \"GET_APP_PAYLOAD_VERSION\";\r\n const payload = { callback: this.setupPayloadVersions };\r\n this.formRequestAndDispatch(type, 2, payload);\r\n };\r\n\r\n private setupPayloadVersions = (payloadVersion: Map<string, number>) => {\r\n this.appPayloadVersions = payloadVersion;\r\n };\r\n\r\n requestObserver?: DispatchObserver;\r\n\r\n /**\r\n * Notify the passive observer, if any. Wrapped so a throwing or slow observer\r\n * can never alter, delay, or fail the Request's delivery (ADR-0002).\r\n */\r\n private notifyObserver = (request: Request, outcome: DispatchOutcome) => {\r\n if (!this.requestObserver) return;\r\n try {\r\n this.requestObserver(request, outcome);\r\n } catch {\r\n // Passive: an observer failure must never affect dispatch.\r\n }\r\n };\r\n\r\n dispatch = (request: Request) => {\r\n if (!this.appHandler) {\r\n this.error(\"No app handler has been registered\");\r\n this.notifyObserver(request, \"no-app-handler\");\r\n return;\r\n }\r\n\r\n try {\r\n this.appHandler(request);\r\n this.notifyObserver(request, \"delivered\");\r\n } catch (e) {\r\n this.warn((e as Error).message);\r\n this.notifyObserver(request, \"threw\");\r\n }\r\n };\r\n\r\n formRequestAndDispatch = (\r\n type: string,\r\n version: number,\r\n payload?: object | undefined\r\n ) => {\r\n const request: Request = {\r\n type,\r\n version,\r\n payload\r\n };\r\n\r\n this.dispatch(request);\r\n };\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, HostDispatchEntity.type);\r\n }\r\n}\r\n"]}
|
|
@@ -8,6 +8,7 @@ export class MockHostDispatchEntity extends HostDispatchEntity {
|
|
|
8
8
|
this.registerAppHandler = jest.fn();
|
|
9
9
|
this.dispatch = jest.fn();
|
|
10
10
|
this.formRequestAndDispatch = jest.fn();
|
|
11
|
+
this.requestObserver = undefined;
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
//# sourceMappingURL=MockHostDispatcher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MockHostDispatcher.js","sourceRoot":"","sources":["../../../../src/Dispatcher/Mocks/MockHostDispatcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;
|
|
1
|
+
{"version":3,"file":"MockHostDispatcher.js","sourceRoot":"","sources":["../../../../src/Dispatcher/Mocks/MockHostDispatcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;IAS5D,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAT5C,oBAAe,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC5B,sBAAiB,GAAG,CAAC,CAAC;QACtB,6BAAwB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QACrC,uBAAkB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC/B,aAAQ,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QACrB,2BAAsB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QACnC,oBAAe,GAAG,SAAS,CAAC;IAI5B,CAAC;CACF","sourcesContent":["import { AppObject } from \"@vived/core\";\r\nimport { HostDispatchEntity } from \"../Entities\";\r\n\r\nexport class MockHostDispatchEntity extends HostDispatchEntity {\r\n clearAppHandler = jest.fn();\r\n appHandlerVersion = 1;\r\n getRequestPayloadVersion = jest.fn();\r\n registerAppHandler = jest.fn();\r\n dispatch = jest.fn();\r\n formRequestAndDispatch = jest.fn();\r\n requestObserver = undefined;\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, HostDispatchEntity.type);\r\n }\r\n}\r\n"]}
|
|
@@ -12,17 +12,34 @@ class RequestHandlerImp extends HostHandlerEntity {
|
|
|
12
12
|
constructor(appObj) {
|
|
13
13
|
super(appObj, HostHandlerEntity.type);
|
|
14
14
|
this.handlers = new Map();
|
|
15
|
+
/**
|
|
16
|
+
* Notify the passive observer, if any. Wrapped so a throwing or slow observer
|
|
17
|
+
* can never alter, delay, or fail the Request (ADR-0002).
|
|
18
|
+
*/
|
|
19
|
+
this.notifyObserver = (request, outcome) => {
|
|
20
|
+
if (!this.requestObserver)
|
|
21
|
+
return;
|
|
22
|
+
try {
|
|
23
|
+
this.requestObserver(request, outcome);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// Passive: an observer failure must never affect handling.
|
|
27
|
+
}
|
|
28
|
+
};
|
|
15
29
|
this.handler = (request) => {
|
|
16
30
|
const handler = this.handlers.get(request.type);
|
|
17
31
|
if (!handler) {
|
|
18
32
|
this.warn(`Unsupported request type received: ${request.type}`);
|
|
33
|
+
this.notifyObserver(request, "unsupported");
|
|
19
34
|
return;
|
|
20
35
|
}
|
|
21
36
|
try {
|
|
22
37
|
handler.handleRequest(request.version, request.payload);
|
|
38
|
+
this.notifyObserver(request, "handled");
|
|
23
39
|
}
|
|
24
40
|
catch (e) {
|
|
25
41
|
this.warn(`${e}`);
|
|
42
|
+
this.notifyObserver(request, "threw");
|
|
26
43
|
}
|
|
27
44
|
};
|
|
28
45
|
this.registerRequestHandler = (handler) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HostHandler.js","sourceRoot":"","sources":["../../../../src/Handler/Entities/HostHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"HostHandler.js","sourceRoot":"","sources":["../../../../src/Handler/Entities/HostHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,eAAe,EAAE,MAAM,aAAa,CAAC;AAyBzD,MAAM,OAAgB,iBAAkB,SAAQ,eAAe;IAG7D,MAAM,CAAC,GAAG,CAAC,SAAoB;QAC7B,OAAO,SAAS,CAAC,YAAY,CAAoB,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC3E,CAAC;;AAJM,sBAAI,GAAG,mBAAmB,CAAC;AAgBpC,MAAM,UAAU,qBAAqB,CAAC,SAAoB;IACxD,OAAO,IAAI,iBAAiB,CAAC,SAAS,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,iBAAkB,SAAQ,iBAAiB;IA8C/C,YAAY,MAAiB;QAC3B,KAAK,CAAC,MAAM,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;QA9ChC,aAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;QAIrD;;;WAGG;QACK,mBAAc,GAAG,CAAC,OAAgB,EAAE,OAAuB,EAAE,EAAE;YACrE,IAAI,CAAC,IAAI,CAAC,eAAe;gBAAE,OAAO;YAClC,IAAI,CAAC;gBACH,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACzC,CAAC;YAAC,MAAM,CAAC;gBACP,2DAA2D;YAC7D,CAAC;QACH,C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;AAED,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,WAAmB;QAC7B,MAAM,GAAG,GAAG,2BAA2B,WAAW,qBAAqB,CAAC;QACxE,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,WAAmB,EAAE,OAAe,EAAE,OAAe;QAC/D,MAAM,GAAG,GAAG,sCAAsC,OAAO,oBAAoB,WAAW,KAAK,OAAO,EAAE,CAAC;QACvG,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACF","sourcesContent":["import { AppObject, AppObjectEntity } from \"@vived/core\";\r\nimport { Handler, Request } from \"@vived/core\";\r\n\r\nexport interface RequestHandler {\r\n readonly requestType: string;\r\n handleRequest: (version: number, payload?: unknown) => void;\r\n}\r\n\r\n/**\r\n * The outcome of an inbound Request, as seen at the handler chokepoint:\r\n * \"handled\" (a registered handler ran), \"unsupported\" (no handler registered\r\n * for the type), or \"threw\" (the handler raised).\r\n */\r\nexport type HandlerOutcome = \"handled\" | \"unsupported\" | \"threw\";\r\n\r\n/**\r\n * Passive observer of inbound Requests. Notified after each Request is routed,\r\n * with the outcome. Purely observational — see the passivity contract in\r\n * ADR-0002: an observer must never alter, delay, or fail the Request.\r\n */\r\nexport type HandlerObserver = (\r\n request: Request,\r\n outcome: HandlerOutcome\r\n) => void;\r\n\r\nexport abstract class HostHandlerEntity extends AppObjectEntity {\r\n static type = \"HostHandlerEntity\";\r\n\r\n static get(appObject: AppObject) {\r\n return appObject.getComponent<HostHandlerEntity>(HostHandlerEntity.type);\r\n }\r\n\r\n abstract handler: Handler;\r\n abstract registerRequestHandler: (requestHandler: RequestHandler) => void;\r\n\r\n /**\r\n * Optional passive observer of inbound Requests (ADR-0002). Unset by default,\r\n * so production hosts pay nothing and behave exactly as before.\r\n */\r\n abstract requestObserver?: HandlerObserver;\r\n}\r\n\r\nexport function makeHostHandlerEntity(appObject: AppObject): HostHandlerEntity {\r\n return new RequestHandlerImp(appObject);\r\n}\r\n\r\nclass RequestHandlerImp extends HostHandlerEntity {\r\n private handlers = new Map<string, RequestHandler>();\r\n\r\n requestObserver?: HandlerObserver;\r\n\r\n /**\r\n * Notify the passive observer, if any. Wrapped so a throwing or slow observer\r\n * can never alter, delay, or fail the Request (ADR-0002).\r\n */\r\n private notifyObserver = (request: Request, outcome: HandlerOutcome) => {\r\n if (!this.requestObserver) return;\r\n try {\r\n this.requestObserver(request, outcome);\r\n } catch {\r\n // Passive: an observer failure must never affect handling.\r\n }\r\n };\r\n\r\n handler: Handler = (request: Request): void => {\r\n const handler = this.handlers.get(request.type);\r\n\r\n if (!handler) {\r\n this.warn(`Unsupported request type received: ${request.type}`);\r\n this.notifyObserver(request, \"unsupported\");\r\n return;\r\n }\r\n\r\n try {\r\n handler.handleRequest(request.version, request.payload);\r\n this.notifyObserver(request, \"handled\");\r\n } catch (e) {\r\n this.warn(`${e}`);\r\n this.notifyObserver(request, \"threw\");\r\n }\r\n };\r\n\r\n registerRequestHandler = (handler: RequestHandler): void => {\r\n if (this.handlers.has(handler.requestType)) {\r\n this.warn(\r\n `More than one handler is being registered for ${handler.requestType}. Previous handler is being overwritten`\r\n );\r\n }\r\n\r\n this.handlers.set(handler.requestType, handler);\r\n };\r\n\r\n constructor(appObj: AppObject) {\r\n super(appObj, HostHandlerEntity.type);\r\n }\r\n}\r\n\r\nexport class UnsupportedRequestVersion extends Error {\r\n constructor(requestType: string, version: number) {\r\n const msg = `Version ${version} of request type ${requestType} is not supported`;\r\n super(msg);\r\n }\r\n}\r\n\r\nexport class ActionNotImplemented extends Error {\r\n constructor(requestType: string) {\r\n const msg = `Action for request type ${requestType} is not implemented`;\r\n super(msg);\r\n }\r\n}\r\n\r\nexport class UnableToParsePayload extends Error {\r\n constructor(requestType: string, version: number, payload: string) {\r\n const msg = `Unable to parse paylod for version ${version} of request type ${requestType}: ${payload}`;\r\n super(msg);\r\n }\r\n}\r\n"]}
|
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
{
|
|
2
|
-
"primary": "#
|
|
3
|
-
"onPrimary": "#
|
|
4
|
-
"primaryContainer": "#
|
|
5
|
-
"onPrimaryContainer": "#
|
|
6
|
-
"primaryFixed": "#
|
|
7
|
-
"onPrimaryFixed": "#
|
|
8
|
-
"primaryFixedDim": "#
|
|
9
|
-
"onPrimaryFixedVariant": "#
|
|
10
|
-
"secondary": "#
|
|
11
|
-
"onSecondary": "#
|
|
12
|
-
"secondaryContainer": "#
|
|
13
|
-
"onSecondaryContainer": "#
|
|
14
|
-
"secondaryFixed": "#
|
|
15
|
-
"onSecondaryFixed": "#
|
|
16
|
-
"secondaryFixedDim": "#
|
|
17
|
-
"onSecondaryFixedVariant": "#
|
|
18
|
-
"tertiary": "#
|
|
19
|
-
"onTertiary": "#
|
|
20
|
-
"tertiaryContainer": "#
|
|
21
|
-
"onTertiaryContainer": "#
|
|
22
|
-
"tertiaryFixed": "#
|
|
23
|
-
"onTertiaryFixed": "#
|
|
24
|
-
"tertiaryFixedDim": "#
|
|
25
|
-
"onTertiaryFixedVariant": "#
|
|
26
|
-
"error": "#
|
|
27
|
-
"onError": "#
|
|
28
|
-
"errorContainer": "#
|
|
29
|
-
"onErrorContainer": "#
|
|
30
|
-
"outline": "#
|
|
31
|
-
"background": "#
|
|
32
|
-
"onBackground": "#
|
|
33
|
-
"surface": "#
|
|
34
|
-
"onSurface": "#
|
|
35
|
-
"surfaceVariant": "#
|
|
36
|
-
"onSurfaceVariant": "#
|
|
37
|
-
"inverseSurface": "#
|
|
38
|
-
"inverseOnSurface": "#
|
|
39
|
-
"inversePrimary": "#
|
|
2
|
+
"primary": "#4ec9f5",
|
|
3
|
+
"onPrimary": "#062231",
|
|
4
|
+
"primaryContainer": "#00506f",
|
|
5
|
+
"onPrimaryContainer": "#cbeafb",
|
|
6
|
+
"primaryFixed": "#cbeafb",
|
|
7
|
+
"onPrimaryFixed": "#001e2e",
|
|
8
|
+
"primaryFixedDim": "#7ad2f2",
|
|
9
|
+
"onPrimaryFixedVariant": "#00506f",
|
|
10
|
+
"secondary": "#b3c7d3",
|
|
11
|
+
"onSecondary": "#1e2c34",
|
|
12
|
+
"secondaryContainer": "#35525f",
|
|
13
|
+
"onSecondaryContainer": "#d0e6f0",
|
|
14
|
+
"secondaryFixed": "#d0e6f0",
|
|
15
|
+
"onSecondaryFixed": "#081f2a",
|
|
16
|
+
"secondaryFixedDim": "#b4cad6",
|
|
17
|
+
"onSecondaryFixedVariant": "#35525f",
|
|
18
|
+
"tertiary": "#5cd0f6",
|
|
19
|
+
"onTertiary": "#00344a",
|
|
20
|
+
"tertiaryContainer": "#005e7c",
|
|
21
|
+
"onTertiaryContainer": "#bfeaff",
|
|
22
|
+
"tertiaryFixed": "#bfeaff",
|
|
23
|
+
"onTertiaryFixed": "#001f2c",
|
|
24
|
+
"tertiaryFixedDim": "#6bd5f5",
|
|
25
|
+
"onTertiaryFixedVariant": "#005e7c",
|
|
26
|
+
"error": "#ff6b81",
|
|
27
|
+
"onError": "#3a0710",
|
|
28
|
+
"errorContainer": "#7f1225",
|
|
29
|
+
"onErrorContainer": "#ffd9df",
|
|
30
|
+
"outline": "#7c7f83",
|
|
31
|
+
"background": "#17181a",
|
|
32
|
+
"onBackground": "#e7e8ea",
|
|
33
|
+
"surface": "#1f2123",
|
|
34
|
+
"onSurface": "#e7e8ea",
|
|
35
|
+
"surfaceVariant": "#2a2d30",
|
|
36
|
+
"onSurfaceVariant": "#a9abae",
|
|
37
|
+
"inverseSurface": "#e7e8ea",
|
|
38
|
+
"inverseOnSurface": "#17181a",
|
|
39
|
+
"inversePrimary": "#0096d6",
|
|
40
40
|
"shadow": "#000000",
|
|
41
|
-
"surfaceTint": "#
|
|
42
|
-
"outlineVariant": "#
|
|
41
|
+
"surfaceTint": "#4ec9f5",
|
|
42
|
+
"outlineVariant": "#303336",
|
|
43
43
|
"scrim": "#000000",
|
|
44
|
-
"surfaceContainerHighest": "#
|
|
45
|
-
"surfaceContainerHigh": "#
|
|
46
|
-
"surfaceContainer": "#
|
|
47
|
-
"surfaceContainerLow": "#
|
|
48
|
-
"surfaceContainerLowest": "#
|
|
49
|
-
"surfaceBright": "#
|
|
50
|
-
"surfaceDim": "#
|
|
44
|
+
"surfaceContainerHighest": "#35383b",
|
|
45
|
+
"surfaceContainerHigh": "#2a2d30",
|
|
46
|
+
"surfaceContainer": "#1f2123",
|
|
47
|
+
"surfaceContainerLow": "#1b1d1f",
|
|
48
|
+
"surfaceContainerLowest": "#101113",
|
|
49
|
+
"surfaceBright": "#35383b",
|
|
50
|
+
"surfaceDim": "#101113"
|
|
51
51
|
}
|