@vived/host 5.4.2 → 5.6.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.
Files changed (129) hide show
  1. package/dist/cjs/BoundaryLog/Adapters/boundaryLogAdapter.js +24 -0
  2. package/dist/cjs/BoundaryLog/Adapters/boundaryLogAdapter.js.map +1 -0
  3. package/dist/cjs/BoundaryLog/Adapters/index.js +18 -0
  4. package/dist/cjs/BoundaryLog/Adapters/index.js.map +1 -0
  5. package/dist/cjs/BoundaryLog/Controllers/clearBoundaryLog.js +15 -0
  6. package/dist/cjs/BoundaryLog/Controllers/clearBoundaryLog.js.map +1 -0
  7. package/dist/cjs/BoundaryLog/Controllers/index.js +18 -0
  8. package/dist/cjs/BoundaryLog/Controllers/index.js.map +1 -0
  9. package/dist/cjs/BoundaryLog/Entities/BoundaryLogEntity.js +45 -0
  10. package/dist/cjs/BoundaryLog/Entities/BoundaryLogEntity.js.map +1 -0
  11. package/dist/cjs/BoundaryLog/Entities/index.js +19 -0
  12. package/dist/cjs/BoundaryLog/Entities/index.js.map +1 -0
  13. package/dist/cjs/BoundaryLog/Entities/snapshotPayload.js +62 -0
  14. package/dist/cjs/BoundaryLog/Entities/snapshotPayload.js.map +1 -0
  15. package/dist/cjs/BoundaryLog/Factories/BoundaryLogFactory.js +62 -0
  16. package/dist/cjs/BoundaryLog/Factories/BoundaryLogFactory.js.map +1 -0
  17. package/dist/cjs/BoundaryLog/Factories/index.js +18 -0
  18. package/dist/cjs/BoundaryLog/Factories/index.js.map +1 -0
  19. package/dist/cjs/BoundaryLog/Mocks/BoundaryLogPMMock.js +16 -0
  20. package/dist/cjs/BoundaryLog/Mocks/BoundaryLogPMMock.js.map +1 -0
  21. package/dist/cjs/BoundaryLog/Mocks/index.js +18 -0
  22. package/dist/cjs/BoundaryLog/Mocks/index.js.map +1 -0
  23. package/dist/cjs/BoundaryLog/PMs/BoundaryLogPM.js +56 -0
  24. package/dist/cjs/BoundaryLog/PMs/BoundaryLogPM.js.map +1 -0
  25. package/dist/cjs/BoundaryLog/PMs/index.js +18 -0
  26. package/dist/cjs/BoundaryLog/PMs/index.js.map +1 -0
  27. package/dist/cjs/BoundaryLog/index.js +23 -0
  28. package/dist/cjs/BoundaryLog/index.js.map +1 -0
  29. package/dist/cjs/Dialog/Entities/DialogQueue.js +36 -21
  30. package/dist/cjs/Dialog/Entities/DialogQueue.js.map +1 -1
  31. package/dist/cjs/Dispatcher/Entities/HostDispatchEntity.js +17 -4
  32. package/dist/cjs/Dispatcher/Entities/HostDispatchEntity.js.map +1 -1
  33. package/dist/cjs/Dispatcher/Mocks/MockHostDispatcher.js +1 -0
  34. package/dist/cjs/Dispatcher/Mocks/MockHostDispatcher.js.map +1 -1
  35. package/dist/cjs/Handler/Entities/HostHandler.js +17 -0
  36. package/dist/cjs/Handler/Entities/HostHandler.js.map +1 -1
  37. package/dist/cjs/StateMachine/Controllers/savePersistentStates.js +1 -1
  38. package/dist/cjs/StateMachine/Controllers/savePersistentStates.js.map +1 -1
  39. package/dist/cjs/StateMachine/Mocks/SavePersistentStatesMock.js +1 -1
  40. package/dist/cjs/StateMachine/Mocks/SavePersistentStatesMock.js.map +1 -1
  41. package/dist/cjs/StateMachine/UCs/SavePersistentStates.js +4 -6
  42. package/dist/cjs/StateMachine/UCs/SavePersistentStates.js.map +1 -1
  43. package/dist/cjs/index.js +1 -0
  44. package/dist/cjs/index.js.map +1 -1
  45. package/dist/esm/BoundaryLog/Adapters/boundaryLogAdapter.js +21 -0
  46. package/dist/esm/BoundaryLog/Adapters/boundaryLogAdapter.js.map +1 -0
  47. package/dist/esm/BoundaryLog/Adapters/index.js +2 -0
  48. package/dist/esm/BoundaryLog/Adapters/index.js.map +1 -0
  49. package/dist/esm/BoundaryLog/Controllers/clearBoundaryLog.js +12 -0
  50. package/dist/esm/BoundaryLog/Controllers/clearBoundaryLog.js.map +1 -0
  51. package/dist/esm/BoundaryLog/Controllers/index.js +2 -0
  52. package/dist/esm/BoundaryLog/Controllers/index.js.map +1 -0
  53. package/dist/esm/BoundaryLog/Entities/BoundaryLogEntity.js +40 -0
  54. package/dist/esm/BoundaryLog/Entities/BoundaryLogEntity.js.map +1 -0
  55. package/dist/esm/BoundaryLog/Entities/index.js +3 -0
  56. package/dist/esm/BoundaryLog/Entities/index.js.map +1 -0
  57. package/dist/esm/BoundaryLog/Entities/snapshotPayload.js +59 -0
  58. package/dist/esm/BoundaryLog/Entities/snapshotPayload.js.map +1 -0
  59. package/dist/esm/BoundaryLog/Factories/BoundaryLogFactory.js +57 -0
  60. package/dist/esm/BoundaryLog/Factories/BoundaryLogFactory.js.map +1 -0
  61. package/dist/esm/BoundaryLog/Factories/index.js +2 -0
  62. package/dist/esm/BoundaryLog/Factories/index.js.map +1 -0
  63. package/dist/esm/BoundaryLog/Mocks/BoundaryLogPMMock.js +11 -0
  64. package/dist/esm/BoundaryLog/Mocks/BoundaryLogPMMock.js.map +1 -0
  65. package/dist/esm/BoundaryLog/Mocks/index.js +2 -0
  66. package/dist/esm/BoundaryLog/Mocks/index.js.map +1 -0
  67. package/dist/esm/BoundaryLog/PMs/BoundaryLogPM.js +51 -0
  68. package/dist/esm/BoundaryLog/PMs/BoundaryLogPM.js.map +1 -0
  69. package/dist/esm/BoundaryLog/PMs/index.js +2 -0
  70. package/dist/esm/BoundaryLog/PMs/index.js.map +1 -0
  71. package/dist/esm/BoundaryLog/index.js +7 -0
  72. package/dist/esm/BoundaryLog/index.js.map +1 -0
  73. package/dist/esm/Dialog/Entities/DialogQueue.js +36 -21
  74. package/dist/esm/Dialog/Entities/DialogQueue.js.map +1 -1
  75. package/dist/esm/Dispatcher/Entities/HostDispatchEntity.js +17 -4
  76. package/dist/esm/Dispatcher/Entities/HostDispatchEntity.js.map +1 -1
  77. package/dist/esm/Dispatcher/Mocks/MockHostDispatcher.js +1 -0
  78. package/dist/esm/Dispatcher/Mocks/MockHostDispatcher.js.map +1 -1
  79. package/dist/esm/Handler/Entities/HostHandler.js +17 -0
  80. package/dist/esm/Handler/Entities/HostHandler.js.map +1 -1
  81. package/dist/esm/StateMachine/Controllers/savePersistentStates.js +1 -1
  82. package/dist/esm/StateMachine/Controllers/savePersistentStates.js.map +1 -1
  83. package/dist/esm/StateMachine/Mocks/SavePersistentStatesMock.js +1 -1
  84. package/dist/esm/StateMachine/Mocks/SavePersistentStatesMock.js.map +1 -1
  85. package/dist/esm/StateMachine/UCs/SavePersistentStates.js +4 -6
  86. package/dist/esm/StateMachine/UCs/SavePersistentStates.js.map +1 -1
  87. package/dist/esm/index.js +1 -0
  88. package/dist/esm/index.js.map +1 -1
  89. package/dist/types/BoundaryLog/Adapters/boundaryLogAdapter.d.ts +4 -0
  90. package/dist/types/BoundaryLog/Adapters/boundaryLogAdapter.d.ts.map +1 -0
  91. package/dist/types/BoundaryLog/Adapters/index.d.ts +2 -0
  92. package/dist/types/BoundaryLog/Adapters/index.d.ts.map +1 -0
  93. package/dist/types/BoundaryLog/Controllers/clearBoundaryLog.d.ts +4 -0
  94. package/dist/types/BoundaryLog/Controllers/clearBoundaryLog.d.ts.map +1 -0
  95. package/dist/types/BoundaryLog/Controllers/index.d.ts +2 -0
  96. package/dist/types/BoundaryLog/Controllers/index.d.ts.map +1 -0
  97. package/dist/types/BoundaryLog/Entities/BoundaryLogEntity.d.ts +37 -0
  98. package/dist/types/BoundaryLog/Entities/BoundaryLogEntity.d.ts.map +1 -0
  99. package/dist/types/BoundaryLog/Entities/index.d.ts +3 -0
  100. package/dist/types/BoundaryLog/Entities/index.d.ts.map +1 -0
  101. package/dist/types/BoundaryLog/Entities/snapshotPayload.d.ts +16 -0
  102. package/dist/types/BoundaryLog/Entities/snapshotPayload.d.ts.map +1 -0
  103. package/dist/types/BoundaryLog/Factories/BoundaryLogFactory.d.ts +17 -0
  104. package/dist/types/BoundaryLog/Factories/BoundaryLogFactory.d.ts.map +1 -0
  105. package/dist/types/BoundaryLog/Factories/index.d.ts +2 -0
  106. package/dist/types/BoundaryLog/Factories/index.d.ts.map +1 -0
  107. package/dist/types/BoundaryLog/Mocks/BoundaryLogPMMock.d.ts +8 -0
  108. package/dist/types/BoundaryLog/Mocks/BoundaryLogPMMock.d.ts.map +1 -0
  109. package/dist/types/BoundaryLog/Mocks/index.d.ts +2 -0
  110. package/dist/types/BoundaryLog/Mocks/index.d.ts.map +1 -0
  111. package/dist/types/BoundaryLog/PMs/BoundaryLogPM.d.ts +18 -0
  112. package/dist/types/BoundaryLog/PMs/BoundaryLogPM.d.ts.map +1 -0
  113. package/dist/types/BoundaryLog/PMs/index.d.ts +2 -0
  114. package/dist/types/BoundaryLog/PMs/index.d.ts.map +1 -0
  115. package/dist/types/BoundaryLog/index.d.ts +7 -0
  116. package/dist/types/BoundaryLog/index.d.ts.map +1 -0
  117. package/dist/types/Dispatcher/Entities/HostDispatchEntity.d.ts +17 -0
  118. package/dist/types/Dispatcher/Entities/HostDispatchEntity.d.ts.map +1 -1
  119. package/dist/types/Dispatcher/Mocks/MockHostDispatcher.d.ts +1 -0
  120. package/dist/types/Dispatcher/Mocks/MockHostDispatcher.d.ts.map +1 -1
  121. package/dist/types/Handler/Entities/HostHandler.d.ts +18 -1
  122. package/dist/types/Handler/Entities/HostHandler.d.ts.map +1 -1
  123. package/dist/types/StateMachine/Mocks/SavePersistentStatesMock.d.ts +1 -1
  124. package/dist/types/StateMachine/Mocks/SavePersistentStatesMock.d.ts.map +1 -1
  125. package/dist/types/StateMachine/UCs/SavePersistentStates.d.ts +1 -1
  126. package/dist/types/StateMachine/UCs/SavePersistentStates.d.ts.map +1 -1
  127. package/dist/types/index.d.ts +1 -0
  128. package/dist/types/index.d.ts.map +1 -1
  129. package/package.json +1 -1
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.boundaryLogAdapter = void 0;
4
+ const BoundaryLogPM_1 = require("../PMs/BoundaryLogPM");
5
+ exports.boundaryLogAdapter = {
6
+ defaultVM: BoundaryLogPM_1.defaultBoundaryLogVM,
7
+ subscribe: (appObjects, setVM) => {
8
+ const pm = BoundaryLogPM_1.BoundaryLogPM.get(appObjects);
9
+ if (!pm) {
10
+ appObjects.submitError("boundaryLogAdapter", "Unable to find BoundaryLogPM");
11
+ return;
12
+ }
13
+ pm.addView(setVM);
14
+ },
15
+ unsubscribe: (appObjects, setVM) => {
16
+ const pm = BoundaryLogPM_1.BoundaryLogPM.get(appObjects);
17
+ if (!pm) {
18
+ appObjects.submitError("boundaryLogAdapter", "Unable to find BoundaryLogPM");
19
+ return;
20
+ }
21
+ pm.removeView(setVM);
22
+ }
23
+ };
24
+ //# sourceMappingURL=boundaryLogAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boundaryLogAdapter.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/Adapters/boundaryLogAdapter.ts"],"names":[],"mappings":";;;AACA,wDAI8B;AAEjB,QAAA,kBAAkB,GAAsC;IACnE,SAAS,EAAE,oCAAoB;IAC/B,SAAS,EAAE,CACT,UAAyB,EACzB,KAAkC,EAClC,EAAE;QACF,MAAM,EAAE,GAAG,6BAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,UAAU,CAAC,WAAW,CACpB,oBAAoB,EACpB,8BAA8B,CAC/B,CAAC;YACF,OAAO;QACT,CAAC;QACD,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IACD,WAAW,EAAE,CACX,UAAyB,EACzB,KAAkC,EAClC,EAAE;QACF,MAAM,EAAE,GAAG,6BAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,UAAU,CAAC,WAAW,CACpB,oBAAoB,EACpB,8BAA8B,CAC/B,CAAC;YACF,OAAO;QACT,CAAC;QACD,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;CACF,CAAC","sourcesContent":["import { AppObjectRepo, SingletonPmAdapter } from \"@vived/core\";\r\nimport {\r\n BoundaryLogPM,\r\n BoundaryLogVM,\r\n defaultBoundaryLogVM\r\n} from \"../PMs/BoundaryLogPM\";\r\n\r\nexport const boundaryLogAdapter: SingletonPmAdapter<BoundaryLogVM> = {\r\n defaultVM: defaultBoundaryLogVM,\r\n subscribe: (\r\n appObjects: AppObjectRepo,\r\n setVM: (vm: BoundaryLogVM) => void\r\n ) => {\r\n const pm = BoundaryLogPM.get(appObjects);\r\n if (!pm) {\r\n appObjects.submitError(\r\n \"boundaryLogAdapter\",\r\n \"Unable to find BoundaryLogPM\"\r\n );\r\n return;\r\n }\r\n pm.addView(setVM);\r\n },\r\n unsubscribe: (\r\n appObjects: AppObjectRepo,\r\n setVM: (vm: BoundaryLogVM) => void\r\n ) => {\r\n const pm = BoundaryLogPM.get(appObjects);\r\n if (!pm) {\r\n appObjects.submitError(\r\n \"boundaryLogAdapter\",\r\n \"Unable to find BoundaryLogPM\"\r\n );\r\n return;\r\n }\r\n pm.removeView(setVM);\r\n }\r\n};\r\n"]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./boundaryLogAdapter"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/Adapters/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC","sourcesContent":["export * from \"./boundaryLogAdapter\";\r\n"]}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clearBoundaryLog = clearBoundaryLog;
4
+ const Entities_1 = require("../Entities");
5
+ /** Clears the Boundary Log on demand (the tab's Clear action). */
6
+ function clearBoundaryLog(appObjects) {
7
+ const entity = Entities_1.BoundaryLogEntity.get(appObjects);
8
+ if (entity) {
9
+ entity.clear();
10
+ }
11
+ else {
12
+ appObjects.submitError("clearBoundaryLog", "Unable to find BoundaryLogEntity");
13
+ }
14
+ }
15
+ //# sourceMappingURL=clearBoundaryLog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clearBoundaryLog.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/Controllers/clearBoundaryLog.ts"],"names":[],"mappings":";;AAIA,4CAUC;AAbD,0CAAgD;AAEhD,kEAAkE;AAClE,SAAgB,gBAAgB,CAAC,UAAyB;IACxD,MAAM,MAAM,GAAG,4BAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACjD,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;SAAM,CAAC;QACN,UAAU,CAAC,WAAW,CACpB,kBAAkB,EAClB,kCAAkC,CACnC,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import { AppObjectRepo } from \"@vived/core\";\r\nimport { BoundaryLogEntity } from \"../Entities\";\r\n\r\n/** Clears the Boundary Log on demand (the tab's Clear action). */\r\nexport function clearBoundaryLog(appObjects: AppObjectRepo) {\r\n const entity = BoundaryLogEntity.get(appObjects);\r\n if (entity) {\r\n entity.clear();\r\n } else {\r\n appObjects.submitError(\r\n \"clearBoundaryLog\",\r\n \"Unable to find BoundaryLogEntity\"\r\n );\r\n }\r\n}\r\n"]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./clearBoundaryLog"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/Controllers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC","sourcesContent":["export * from \"./clearBoundaryLog\";\r\n"]}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BoundaryLogEntity = void 0;
4
+ exports.makeBoundaryLogEntity = makeBoundaryLogEntity;
5
+ const core_1 = require("@vived/core");
6
+ const snapshotPayload_1 = require("./snapshotPayload");
7
+ /**
8
+ * The Boundary Log: a passive, chronological recording of every Request
9
+ * observed crossing the host↔App boundary. Accumulates unbounded within a
10
+ * session and is only reset by an explicit clear() — never by traffic itself.
11
+ */
12
+ class BoundaryLogEntity extends core_1.AppObjectEntity {
13
+ static get(appObjects) {
14
+ return (0, core_1.getSingletonComponent)(BoundaryLogEntity.type, appObjects);
15
+ }
16
+ }
17
+ exports.BoundaryLogEntity = BoundaryLogEntity;
18
+ BoundaryLogEntity.type = "BoundaryLogEntity";
19
+ function makeBoundaryLogEntity(appObject) {
20
+ return new BoundaryLogEntityImp(appObject);
21
+ }
22
+ class BoundaryLogEntityImp extends BoundaryLogEntity {
23
+ constructor(appObject) {
24
+ super(appObject, BoundaryLogEntity.type);
25
+ this.records = [];
26
+ this.recordTraffic = (direction, request, outcome) => {
27
+ const record = {
28
+ direction,
29
+ type: request.type,
30
+ version: request.version,
31
+ payload: (0, snapshotPayload_1.snapshotPayload)(request.payload),
32
+ timestamp: Date.now(),
33
+ outcome
34
+ };
35
+ this.records.push(record);
36
+ this.notifyOnChange();
37
+ };
38
+ this.clear = () => {
39
+ this.records = [];
40
+ this.notifyOnChange();
41
+ };
42
+ this.appObjects.registerSingleton(this);
43
+ }
44
+ }
45
+ //# sourceMappingURL=BoundaryLogEntity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoundaryLogEntity.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/Entities/BoundaryLogEntity.ts"],"names":[],"mappings":";;;AAgEA,sDAEC;AAlED,sCAMqB;AACrB,uDAAqE;AA+BrE;;;;GAIG;AACH,MAAsB,iBAAkB,SAAQ,sBAAe;IAG7D,MAAM,CAAC,GAAG,CAAC,UAAyB;QAClC,OAAO,IAAA,4BAAqB,EAC1B,iBAAiB,CAAC,IAAI,EACtB,UAAU,CACX,CAAC;IACJ,CAAC;;AARH,8CAmBC;AAlBQ,sBAAI,GAAG,mBAAmB,CAAC;AAoBpC,SAAgB,qBAAqB,CAAC,SAAoB;IACxD,OAAO,IAAI,oBAAoB,CAAC,SAAS,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,oBAAqB,SAAQ,iBAAiB;IA0BlD,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;QA1B3C,YAAO,GAAoB,EAAE,CAAC;QAE9B,kBAAa,GAAG,CACd,SAA2B,EAC3B,OAAgB,EAChB,OAAuB,EACjB,EAAE;YACR,MAAM,MAAM,GAAkB;gBAC5B,SAAS;gBACT,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,OAAO,EAAE,IAAA,iCAAe,EAAC,OAAO,CAAC,OAAO,CAAC;gBACzC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,OAAO;aACR,CAAC;YAEF,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC1B,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,CAAC,CAAC;QAEF,UAAK,GAAG,GAAS,EAAE;YACjB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;YAClB,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,CAAC,CAAC;QAIA,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import {\r\n getSingletonComponent,\r\n AppObject,\r\n AppObjectEntity,\r\n AppObjectRepo,\r\n Request\r\n} from \"@vived/core\";\r\nimport { PayloadSnapshot, snapshotPayload } from \"./snapshotPayload\";\r\n\r\n/** Which way a recorded Request crossed the host↔App boundary. */\r\nexport type RequestDirection = \"dispatch\" | \"handler\";\r\n\r\n/**\r\n * What happened to a recorded Request. Outbound (Dispatch) records use\r\n * \"delivered\" | \"no-app-handler\" | \"threw\"; inbound (Handler) records use\r\n * \"handled\" | \"unsupported\" | \"threw\".\r\n */\r\nexport type RequestOutcome =\r\n | \"delivered\"\r\n | \"no-app-handler\"\r\n | \"handled\"\r\n | \"unsupported\"\r\n | \"threw\";\r\n\r\n/**\r\n * One captured entry in the Boundary Log: the observed Request plus its\r\n * direction, a frozen payload snapshot, the time it was observed, and its\r\n * outcome. Distinct from the live wire Request it was captured from.\r\n */\r\nexport interface RequestRecord {\r\n direction: RequestDirection;\r\n type: string;\r\n version: number;\r\n payload: PayloadSnapshot;\r\n timestamp: number;\r\n outcome: RequestOutcome;\r\n}\r\n\r\n/**\r\n * The Boundary Log: a passive, chronological recording of every Request\r\n * observed crossing the host↔App boundary. Accumulates unbounded within a\r\n * session and is only reset by an explicit clear() — never by traffic itself.\r\n */\r\nexport abstract class BoundaryLogEntity extends AppObjectEntity {\r\n static type = \"BoundaryLogEntity\";\r\n\r\n static get(appObjects: AppObjectRepo) {\r\n return getSingletonComponent<BoundaryLogEntity>(\r\n BoundaryLogEntity.type,\r\n appObjects\r\n );\r\n }\r\n\r\n abstract records: RequestRecord[];\r\n\r\n abstract recordTraffic: (\r\n direction: RequestDirection,\r\n request: Request,\r\n outcome: RequestOutcome\r\n ) => void;\r\n\r\n abstract clear: () => void;\r\n}\r\n\r\nexport function makeBoundaryLogEntity(appObject: AppObject): BoundaryLogEntity {\r\n return new BoundaryLogEntityImp(appObject);\r\n}\r\n\r\nclass BoundaryLogEntityImp extends BoundaryLogEntity {\r\n records: RequestRecord[] = [];\r\n\r\n recordTraffic = (\r\n direction: RequestDirection,\r\n request: Request,\r\n outcome: RequestOutcome\r\n ): void => {\r\n const record: RequestRecord = {\r\n direction,\r\n type: request.type,\r\n version: request.version,\r\n payload: snapshotPayload(request.payload),\r\n timestamp: Date.now(),\r\n outcome\r\n };\r\n\r\n this.records.push(record);\r\n this.notifyOnChange();\r\n };\r\n\r\n clear = (): void => {\r\n this.records = [];\r\n this.notifyOnChange();\r\n };\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, BoundaryLogEntity.type);\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./BoundaryLogEntity"), exports);
18
+ __exportStar(require("./snapshotPayload"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/Entities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,oDAAkC","sourcesContent":["export * from \"./BoundaryLogEntity\";\r\nexport * from \"./snapshotPayload\";\r\n"]}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.snapshotPayload = snapshotPayload;
4
+ const UNREADABLE = "⟨unreadable⟩";
5
+ /**
6
+ * Preview a single value one level deep. Objects and arrays are marked rather
7
+ * than expanded, so circular structures are inherently safe. Any access that
8
+ * throws (e.g. a getter) is caught and rendered as unreadable.
9
+ */
10
+ function previewValue(value) {
11
+ try {
12
+ if (value === null)
13
+ return "null";
14
+ if (value === undefined)
15
+ return "undefined";
16
+ const type = typeof value;
17
+ if (type === "function") {
18
+ const name = value.name;
19
+ return `ƒ ${name && name.length > 0 ? name : "anonymous"}`;
20
+ }
21
+ if (type === "string")
22
+ return JSON.stringify(value);
23
+ if (type === "number" || type === "boolean" || type === "bigint") {
24
+ return String(value);
25
+ }
26
+ if (type === "symbol")
27
+ return value.toString();
28
+ if (Array.isArray(value))
29
+ return `Array(${value.length})`;
30
+ if (type === "object")
31
+ return "{…}";
32
+ return String(value);
33
+ }
34
+ catch {
35
+ return UNREADABLE;
36
+ }
37
+ }
38
+ function snapshotPayload(payload) {
39
+ const fields = {};
40
+ if (payload !== null && payload !== undefined && typeof payload === "object") {
41
+ let keys = [];
42
+ try {
43
+ keys = Object.keys(payload);
44
+ }
45
+ catch {
46
+ keys = [];
47
+ }
48
+ for (const key of keys) {
49
+ try {
50
+ fields[key] = previewValue(payload[key]);
51
+ }
52
+ catch {
53
+ fields[key] = UNREADABLE;
54
+ }
55
+ }
56
+ }
57
+ return {
58
+ isEmpty: Object.keys(fields).length === 0,
59
+ fields
60
+ };
61
+ }
62
+ //# sourceMappingURL=snapshotPayload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshotPayload.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/Entities/snapshotPayload.ts"],"names":[],"mappings":";;AA+CA,0CAwBC;AAxDD,MAAM,UAAU,GAAG,cAAc,CAAC;AAElC;;;;GAIG;AACH,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,CAAC;QACH,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,MAAM,CAAC;QAClC,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,WAAW,CAAC;QAE5C,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC;QAE1B,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;YACxB,MAAM,IAAI,GAAI,KAA2B,CAAC,IAAI,CAAC;YAC/C,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QAC7D,CAAC;QACD,IAAI,IAAI,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACpD,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YACjE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;QACD,IAAI,IAAI,KAAK,QAAQ;YAAE,OAAQ,KAAgB,CAAC,QAAQ,EAAE,CAAC;QAC3D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,OAAO,SAAS,KAAK,CAAC,MAAM,GAAG,CAAC;QAC1D,IAAI,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QAEpC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,UAAU,CAAC;IACpB,CAAC;AACH,CAAC;AAED,SAAgB,eAAe,CAAC,OAAgB;IAC9C,MAAM,MAAM,GAA2B,EAAE,CAAC;IAE1C,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC7E,IAAI,IAAI,GAAa,EAAE,CAAC;QACxB,IAAI,CAAC;YACH,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAkC,CAAC,CAAC;QACzD,CAAC;QAAC,MAAM,CAAC;YACP,IAAI,GAAG,EAAE,CAAC;QACZ,CAAC;QAED,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC;gBACH,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAE,OAAmC,CAAC,GAAG,CAAC,CAAC,CAAC;YACxE,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC;QACzC,MAAM;KACP,CAAC;AACJ,CAAC","sourcesContent":["/**\r\n * A best-effort, one-level-deep structural snapshot of a Request payload, taken\r\n * at the moment the Request crosses the host↔App boundary. It never throws:\r\n * callbacks, circular references, and throwing getters are all rendered as\r\n * previews rather than expanded or serialized. Nested objects/arrays are marked\r\n * (not recursed), so what a developer inspects is exactly what was sent —\r\n * frozen, safe to render, and cheap to build.\r\n */\r\nexport interface PayloadSnapshot {\r\n /** True when the payload was undefined/null or carried no own-enumerable keys. */\r\n isEmpty: boolean;\r\n /** Own-enumerable key → one-level preview string. */\r\n fields: Record<string, string>;\r\n}\r\n\r\nconst UNREADABLE = \"⟨unreadable⟩\";\r\n\r\n/**\r\n * Preview a single value one level deep. Objects and arrays are marked rather\r\n * than expanded, so circular structures are inherently safe. Any access that\r\n * throws (e.g. a getter) is caught and rendered as unreadable.\r\n */\r\nfunction previewValue(value: unknown): string {\r\n try {\r\n if (value === null) return \"null\";\r\n if (value === undefined) return \"undefined\";\r\n\r\n const type = typeof value;\r\n\r\n if (type === \"function\") {\r\n const name = (value as { name?: string }).name;\r\n return `ƒ ${name && name.length > 0 ? name : \"anonymous\"}`;\r\n }\r\n if (type === \"string\") return JSON.stringify(value);\r\n if (type === \"number\" || type === \"boolean\" || type === \"bigint\") {\r\n return String(value);\r\n }\r\n if (type === \"symbol\") return (value as symbol).toString();\r\n if (Array.isArray(value)) return `Array(${value.length})`;\r\n if (type === \"object\") return \"{…}\";\r\n\r\n return String(value);\r\n } catch {\r\n return UNREADABLE;\r\n }\r\n}\r\n\r\nexport function snapshotPayload(payload: unknown): PayloadSnapshot {\r\n const fields: Record<string, string> = {};\r\n\r\n if (payload !== null && payload !== undefined && typeof payload === \"object\") {\r\n let keys: string[] = [];\r\n try {\r\n keys = Object.keys(payload as Record<string, unknown>);\r\n } catch {\r\n keys = [];\r\n }\r\n\r\n for (const key of keys) {\r\n try {\r\n fields[key] = previewValue((payload as Record<string, unknown>)[key]);\r\n } catch {\r\n fields[key] = UNREADABLE;\r\n }\r\n }\r\n }\r\n\r\n return {\r\n isEmpty: Object.keys(fields).length === 0,\r\n fields\r\n };\r\n}\r\n"]}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BoundaryLogFactory = void 0;
4
+ exports.makeBoundaryLogFactory = makeBoundaryLogFactory;
5
+ const core_1 = require("@vived/core");
6
+ const AppSandboxEntity_1 = require("../../AppSandbox/Entities/AppSandboxEntity");
7
+ const HostDispatchEntity_1 = require("../../Dispatcher/Entities/HostDispatchEntity");
8
+ const HostHandler_1 = require("../../Handler/Entities/HostHandler");
9
+ const Entities_1 = require("../Entities");
10
+ const PMs_1 = require("../PMs");
11
+ /**
12
+ * Sets up the Boundary Log and wires its passive observers into the per-App
13
+ * communication entities (ADR-0002). The observers are attached in finalSetup,
14
+ * after every entity exists but before the App mounts — so the host-internal
15
+ * version-negotiation dispatches fired at registration are captured too.
16
+ */
17
+ class BoundaryLogFactory extends core_1.DomainFactory {
18
+ constructor(appObject) {
19
+ super(appObject);
20
+ this.factoryName = "BoundaryLogFactory";
21
+ }
22
+ setupEntities() {
23
+ (0, Entities_1.makeBoundaryLogEntity)(this.appObject);
24
+ }
25
+ setupUCs() {
26
+ // No use cases.
27
+ }
28
+ setupPMs() {
29
+ (0, PMs_1.makeBoundaryLogPM)(this.appObject);
30
+ }
31
+ finalSetup() {
32
+ const boundaryLog = Entities_1.BoundaryLogEntity.get(this.appObjects);
33
+ if (!boundaryLog) {
34
+ this.error("BoundaryLogEntity not found during final setup.");
35
+ return;
36
+ }
37
+ const sandbox = AppSandboxEntity_1.AppSandboxEntity.get(this.appObjects);
38
+ if (!sandbox) {
39
+ this.error("AppSandboxEntity not found during final setup.");
40
+ return;
41
+ }
42
+ const appObject = this.appObjects.get(sandbox.appID);
43
+ if (!appObject) {
44
+ this.error("App AppObject not found during final setup.");
45
+ return;
46
+ }
47
+ const dispatch = HostDispatchEntity_1.HostDispatchEntity.get(appObject);
48
+ if (dispatch) {
49
+ dispatch.requestObserver = (request, outcome) => boundaryLog.recordTraffic("dispatch", request, outcome);
50
+ }
51
+ const handler = HostHandler_1.HostHandlerEntity.get(appObject);
52
+ if (handler) {
53
+ handler.requestObserver = (request, outcome) => boundaryLog.recordTraffic("handler", request, outcome);
54
+ }
55
+ }
56
+ }
57
+ exports.BoundaryLogFactory = BoundaryLogFactory;
58
+ function makeBoundaryLogFactory(appObjects) {
59
+ const ao = appObjects.getOrCreate("BoundaryLog");
60
+ return new BoundaryLogFactory(ao);
61
+ }
62
+ //# sourceMappingURL=BoundaryLogFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoundaryLogFactory.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/Factories/BoundaryLogFactory.ts"],"names":[],"mappings":";;;AAiEA,wDAKC;AAtED,sCAAsE;AACtE,iFAA8E;AAC9E,qFAAkF;AAClF,oEAAuE;AACvE,0CAAuE;AACvE,gCAA2C;AAE3C;;;;;GAKG;AACH,MAAa,kBAAmB,SAAQ,oBAAa;IAGnD,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,CAAC,CAAC;QAHV,gBAAW,GAAG,oBAAoB,CAAC;IAI5C,CAAC;IAED,aAAa;QACX,IAAA,gCAAqB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAED,QAAQ;QACN,gBAAgB;IAClB,CAAC;IAED,QAAQ;QACN,IAAA,uBAAiB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAED,UAAU;QACR,MAAM,WAAW,GAAG,4BAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3D,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,IAAI,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;YAC9D,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,mCAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACtD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,IAAI,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;YAC7D,OAAO;QACT,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACrD,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;YAC1D,OAAO;QACT,CAAC;QAED,MAAM,QAAQ,GAAG,uCAAkB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACnD,IAAI,QAAQ,EAAE,CAAC;YACb,QAAQ,CAAC,eAAe,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAC9C,WAAW,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5D,CAAC;QAED,MAAM,OAAO,GAAG,+BAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACjD,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,eAAe,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAC7C,WAAW,CAAC,aAAa,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;CACF;AAlDD,gDAkDC;AAED,SAAgB,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,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./BoundaryLogFactory"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC","sourcesContent":["export * from \"./BoundaryLogFactory\";\r\n"]}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BoundaryLogPMMock = void 0;
4
+ exports.makeBoundaryLogPMMock = makeBoundaryLogPMMock;
5
+ const PMs_1 = require("../PMs");
6
+ class BoundaryLogPMMock extends PMs_1.BoundaryLogPM {
7
+ constructor(appObject) {
8
+ super(appObject, PMs_1.BoundaryLogPM.type);
9
+ this.vmsAreEqual = jest.fn();
10
+ }
11
+ }
12
+ exports.BoundaryLogPMMock = BoundaryLogPMMock;
13
+ function makeBoundaryLogPMMock(appObjects) {
14
+ return new BoundaryLogPMMock(appObjects.getOrCreate("BoundaryLogPMMock"));
15
+ }
16
+ //# sourceMappingURL=BoundaryLogPMMock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoundaryLogPMMock.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/Mocks/BoundaryLogPMMock.ts"],"names":[],"mappings":";;;AAWA,sDAEC;AAZD,gCAAuC;AAEvC,MAAa,iBAAkB,SAAQ,mBAAa;IAGlD,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,mBAAa,CAAC,IAAI,CAAC,CAAC;QAHvC,gBAAW,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAIxB,CAAC;CACF;AAND,8CAMC;AAED,SAAgB,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,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./BoundaryLogPMMock"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/Mocks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC","sourcesContent":["export * from \"./BoundaryLogPMMock\";\r\n"]}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BoundaryLogPM = exports.defaultBoundaryLogVM = void 0;
4
+ exports.makeBoundaryLogPM = makeBoundaryLogPM;
5
+ const core_1 = require("@vived/core");
6
+ const Entities_1 = require("../Entities");
7
+ exports.defaultBoundaryLogVM = {
8
+ records: [],
9
+ count: 0
10
+ };
11
+ class BoundaryLogPM extends core_1.AppObjectPM {
12
+ static get(appObjects) {
13
+ return (0, core_1.getSingletonComponent)(BoundaryLogPM.type, appObjects);
14
+ }
15
+ }
16
+ exports.BoundaryLogPM = BoundaryLogPM;
17
+ BoundaryLogPM.type = "BoundaryLogPM";
18
+ function makeBoundaryLogPM(appObject) {
19
+ return new BoundaryLogPMImp(appObject);
20
+ }
21
+ class BoundaryLogPMImp extends BoundaryLogPM {
22
+ get boundaryLog() {
23
+ return this.getCachedSingleton(Entities_1.BoundaryLogEntity.type);
24
+ }
25
+ vmsAreEqual(a, b) {
26
+ if (a.count !== b.count)
27
+ return false;
28
+ if (a.records.length !== b.records.length)
29
+ return false;
30
+ for (let i = 0; i < a.records.length; i++) {
31
+ if (a.records[i] !== b.records[i])
32
+ return false;
33
+ }
34
+ return true;
35
+ }
36
+ constructor(appObject) {
37
+ super(appObject, BoundaryLogPM.type);
38
+ this.onEntityChange = () => {
39
+ if (!this.boundaryLog)
40
+ return;
41
+ // Copy the array (new VM identity) but keep record references stable so
42
+ // vmsAreEqual can compare cheaply. Order is insertion order = the order the
43
+ // Requests were observed.
44
+ const records = [...this.boundaryLog.records];
45
+ const vm = {
46
+ records,
47
+ count: records.length
48
+ };
49
+ this.doUpdateView(vm);
50
+ };
51
+ this.onEntityChange();
52
+ this.boundaryLog?.addChangeObserver(this.onEntityChange);
53
+ this.appObjects.registerSingleton(this);
54
+ }
55
+ }
56
+ //# sourceMappingURL=BoundaryLogPM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoundaryLogPM.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/PMs/BoundaryLogPM.ts"],"names":[],"mappings":";;;AA+BA,8CAEC;AAjCD,sCAKqB;AACrB,0CAA+D;AAYlD,QAAA,oBAAoB,GAAkB;IACjD,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,CAAC;CACT,CAAC;AAEF,MAAsB,aAAc,SAAQ,kBAA0B;IAGpE,MAAM,CAAC,GAAG,CAAC,UAAyB;QAClC,OAAO,IAAA,4BAAqB,EAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC9E,CAAC;;AALH,sCAMC;AALQ,kBAAI,GAAG,eAAe,CAAC;AAOhC,SAAgB,iBAAiB,CAAC,SAAoB;IACpD,OAAO,IAAI,gBAAgB,CAAC,SAAS,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,gBAAiB,SAAQ,aAAa;IAC1C,IAAY,WAAW;QACrB,OAAO,IAAI,CAAC,kBAAkB,CAAoB,4BAAiB,CAAC,IAAI,CAAC,CAAC;IAC5E,CAAC;IAED,WAAW,CAAC,CAAgB,EAAE,CAAgB;QAC5C,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK;YAAE,OAAO,KAAK,CAAC;QACtC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QACxD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC1C,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;gBAAE,OAAO,KAAK,CAAC;QAClD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAiBD,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;QAhB/B,mBAAc,GAAG,GAAG,EAAE;YAC5B,IAAI,CAAC,IAAI,CAAC,WAAW;gBAAE,OAAO;YAE9B,wEAAwE;YACxE,4EAA4E;YAC5E,0BAA0B;YAC1B,MAAM,OAAO,GAAG,CAAC,GAAG,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,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./BoundaryLogPM"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/BoundaryLog/PMs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC","sourcesContent":["export * from \"./BoundaryLogPM\";\r\n"]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Adapters"), exports);
18
+ __exportStar(require("./Controllers"), exports);
19
+ __exportStar(require("./Entities"), exports);
20
+ __exportStar(require("./Factories"), exports);
21
+ __exportStar(require("./Mocks"), exports);
22
+ __exportStar(require("./PMs"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/BoundaryLog/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,gDAA8B;AAC9B,6CAA2B;AAC3B,8CAA4B;AAC5B,0CAAwB;AACxB,wCAAsB","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"]}
@@ -25,36 +25,51 @@ class DialogRepoImp extends DialogQueue {
25
25
  this.dialogQueue = [];
26
26
  this.submitDialog = (dialog) => {
27
27
  this.dialogQueue.push(dialog);
28
- if (this.activeDialog === dialog) {
29
- dialog.isOpen = true;
30
- }
31
- dialog.addChangeObserver(this.notifyOnChange);
28
+ dialog.addChangeObserver(this.onDialogChange);
29
+ this.openActiveDialog();
32
30
  this.notifyOnChange();
33
31
  };
34
32
  this.activeDialogHasClosed = () => {
35
33
  const currentActiveDialog = this.activeDialog;
36
- if (currentActiveDialog !== null) {
37
- currentActiveDialog.removeChangeObserver(this.notifyOnChange);
38
- this.filterOutClosedDialogs();
39
- this.dialogQueue.splice(0, 1);
40
- const newActiveDialog = this.activeDialog;
41
- if (newActiveDialog !== null) {
42
- newActiveDialog.isOpen = true;
43
- }
34
+ if (currentActiveDialog === null)
35
+ return;
36
+ // Dismissal comes via two routes: a dialog's own close() (which sets
37
+ // hasBeenClosed) or the host's backdrop/escape path (this method). Mark the
38
+ // active dialog closed here so both routes converge on the same advance.
39
+ currentActiveDialog.hasBeenClosed = true;
40
+ this.advanceQueue();
41
+ };
42
+ /**
43
+ * Observes every queued dialog. When the active dialog closes itself (e.g.
44
+ * via its own close button), advance the queue so the next dialog surfaces;
45
+ * otherwise just forward the change to the queue's own observers.
46
+ */
47
+ this.onDialogChange = () => {
48
+ const currentActiveDialog = this.activeDialog;
49
+ if (currentActiveDialog !== null && currentActiveDialog.hasBeenClosed) {
50
+ this.advanceQueue();
51
+ }
52
+ else {
44
53
  this.notifyOnChange();
45
54
  }
46
55
  };
47
- this.filterOutClosedDialogs = () => {
48
- const dialogsToKeep = [];
49
- this.dialogQueue.forEach((dialog) => {
50
- if (!dialog.hasBeenClosed) {
51
- dialogsToKeep.push(dialog);
52
- }
53
- else {
54
- dialog.removeChangeObserver(this.notifyOnChange);
56
+ /** Drop every closed dialog, then open whatever is now the active dialog. */
57
+ this.advanceQueue = () => {
58
+ this.dialogQueue = this.dialogQueue.filter((dialog) => {
59
+ if (dialog.hasBeenClosed) {
60
+ dialog.removeChangeObserver(this.onDialogChange);
61
+ return false;
55
62
  }
63
+ return true;
56
64
  });
57
- this.dialogQueue = dialogsToKeep;
65
+ this.openActiveDialog();
66
+ this.notifyOnChange();
67
+ };
68
+ this.openActiveDialog = () => {
69
+ const active = this.activeDialog;
70
+ if (active !== null && !active.isOpen) {
71
+ active.isOpen = true;
72
+ }
58
73
  };
59
74
  this.appObjects.registerSingleton(this);
60
75
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DialogQueue.js","sourceRoot":"","sources":["../../../../src/Dialog/Entities/DialogQueue.ts"],"names":[],"mappings":";;;AA0BA,0CAEC;AA5BD,sCAKqB;AAErB,MAAsB,MAAO,SAAQ,sBAAe;CAKnD;AALD,wBAKC;AAED,MAAsB,WAAY,SAAQ,sBAAe;IAOvD,MAAM,CAAC,GAAG,CAAC,UAAyB;QAClC,OAAO,IAAA,4BAAqB,EAAc,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC1E,CAAC;;AATH,kCAUC;AATQ,gBAAI,GAAG,aAAa,CAAC;AAW9B,SAAgB,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;IA6CD,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QAlD7B,gBAAW,GAAa,EAAE,CAAC;QAMnC,iBAAY,GAAG,CAAC,MAAc,EAAQ,EAAE;YACtC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAE9B,IAAI,IAAI,CAAC,YAAY,KAAK,MAAM,EAAE,CAAC;gBACjC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;YACvB,CAAC;YAED,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAE9C,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,CAAC,CAAC;QAEF,0BAAqB,GAAG,GAAS,EAAE;YACjC,MAAM,mBAAmB,GAAG,IAAI,CAAC,YAAY,CAAC;YAC9C,IAAI,mBAAmB,KAAK,IAAI,EAAE,CAAC;gBACjC,mBAAmB,CAAC,oBAAoB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;gBAE9D,IAAI,CAAC,sBAAsB,EAAE,CAAC;gBAE9B,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC9B,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC;gBAC1C,IAAI,eAAe,KAAK,IAAI,EAAE,CAAC;oBAC7B,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC;gBAChC,CAAC;gBAED,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,CAAC;QACH,CAAC,CAAC;QAEM,2BAAsB,GAAG,GAAG,EAAE;YACpC,MAAM,aAAa,GAAa,EAAE,CAAC;YAEnC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBAClC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;oBAC1B,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAC7B,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;gBACnD,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,WAAW,GAAG,aAAa,CAAC;QACnC,CAAC,CAAC;QAIA,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import {\n AppObject,\n AppObjectEntity,\n AppObjectRepo,\n getSingletonComponent\n} from \"@vived/core\";\n\nexport abstract class Dialog extends AppObjectEntity {\n abstract dialogType: string;\n abstract preventOutsideDismiss: boolean;\n abstract isOpen: boolean;\n abstract hasBeenClosed: boolean;\n}\n\nexport abstract class DialogQueue extends AppObjectEntity {\n static type = \"DialogQueue\";\n\n abstract get activeDialog(): Dialog | null;\n abstract submitDialog(dialog: Dialog): void;\n abstract activeDialogHasClosed(): void;\n\n static get(appObjects: AppObjectRepo) {\n return getSingletonComponent<DialogQueue>(DialogQueue.type, appObjects);\n }\n}\n\nexport function makeDialogQueue(appObject: AppObject): DialogQueue {\n return new DialogRepoImp(appObject);\n}\n\nclass DialogRepoImp extends DialogQueue {\n private dialogQueue: Dialog[] = [];\n\n get activeDialog(): Dialog | null {\n return this.dialogQueue.length > 0 ? this.dialogQueue[0] : null;\n }\n\n submitDialog = (dialog: Dialog): void => {\n this.dialogQueue.push(dialog);\n\n if (this.activeDialog === dialog) {\n dialog.isOpen = true;\n }\n\n dialog.addChangeObserver(this.notifyOnChange);\n\n this.notifyOnChange();\n };\n\n activeDialogHasClosed = (): void => {\n const currentActiveDialog = this.activeDialog;\n if (currentActiveDialog !== null) {\n currentActiveDialog.removeChangeObserver(this.notifyOnChange);\n\n this.filterOutClosedDialogs();\n\n this.dialogQueue.splice(0, 1);\n const newActiveDialog = this.activeDialog;\n if (newActiveDialog !== null) {\n newActiveDialog.isOpen = true;\n }\n\n this.notifyOnChange();\n }\n };\n\n private filterOutClosedDialogs = () => {\n const dialogsToKeep: Dialog[] = [];\n\n this.dialogQueue.forEach((dialog) => {\n if (!dialog.hasBeenClosed) {\n dialogsToKeep.push(dialog);\n } else {\n dialog.removeChangeObserver(this.notifyOnChange);\n }\n });\n\n this.dialogQueue = dialogsToKeep;\n };\n\n constructor(appObject: AppObject) {\n super(appObject, DialogQueue.type);\n this.appObjects.registerSingleton(this);\n }\n}\n"]}
1
+ {"version":3,"file":"DialogQueue.js","sourceRoot":"","sources":["../../../../src/Dialog/Entities/DialogQueue.ts"],"names":[],"mappings":";;;AA0BA,0CAEC;AA5BD,sCAKqB;AAErB,MAAsB,MAAO,SAAQ,sBAAe;CAKnD;AALD,wBAKC;AAED,MAAsB,WAAY,SAAQ,sBAAe;IAOvD,MAAM,CAAC,GAAG,CAAC,UAAyB;QAClC,OAAO,IAAA,4BAAqB,EAAc,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC1E,CAAC;;AATH,kCAUC;AATQ,gBAAI,GAAG,aAAa,CAAC;AAW9B,SAAgB,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;IAyDD,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QA9D7B,gBAAW,GAAa,EAAE,CAAC;QAMnC,iBAAY,GAAG,CAAC,MAAc,EAAQ,EAAE;YACtC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAE9B,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAE9C,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,CAAC,CAAC;QAEF,0BAAqB,GAAG,GAAS,EAAE;YACjC,MAAM,mBAAmB,GAAG,IAAI,CAAC,YAAY,CAAC;YAC9C,IAAI,mBAAmB,KAAK,IAAI;gBAAE,OAAO;YAEzC,qEAAqE;YACrE,4EAA4E;YAC5E,yEAAyE;YACzE,mBAAmB,CAAC,aAAa,GAAG,IAAI,CAAC;YACzC,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,CAAC,CAAC;QAEF;;;;WAIG;QACK,mBAAc,GAAG,GAAS,EAAE;YAClC,MAAM,mBAAmB,GAAG,IAAI,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"]}