strata.client.core 1.0.0 → 1.1.0-snapshot.1795478207396

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 (105) hide show
  1. package/Main/AbstractApplication.d.ts +13 -0
  2. package/Main/AbstractApplication.js +24 -0
  3. package/Main/AbstractApplication.js.map +1 -0
  4. package/Main/IApplication.d.ts +4 -0
  5. package/Main/IApplication.js +3 -0
  6. package/Main/IApplication.js.map +1 -0
  7. package/Main/index.d.ts +2 -0
  8. package/Main/index.js +6 -0
  9. package/Main/index.js.map +1 -0
  10. package/Presenter/AbstractPresenter.d.ts +11 -0
  11. package/{src/Presenter → Presenter}/AbstractPresenter.js +21 -20
  12. package/Presenter/AbstractPresenter.js.map +1 -0
  13. package/Presenter/AbstractUpdatable.d.ts +16 -0
  14. package/Presenter/AbstractUpdatable.js +37 -0
  15. package/Presenter/AbstractUpdatable.js.map +1 -0
  16. package/Presenter/Action.d.ts +9 -0
  17. package/Presenter/Action.js +19 -0
  18. package/Presenter/Action.js.map +1 -0
  19. package/Presenter/IAction.d.ts +5 -0
  20. package/{src/Presenter → Presenter}/IAction.js +2 -2
  21. package/Presenter/IAction.js.map +1 -0
  22. package/{src/Presenter/IModelStore.ts → Presenter/IModelStore.d.ts} +12 -21
  23. package/{src/Presenter → Presenter}/IModelStore.js +2 -2
  24. package/Presenter/IModelStore.js.map +1 -0
  25. package/Presenter/IPresentable.d.ts +4 -0
  26. package/Presenter/IPresentable.js +3 -0
  27. package/Presenter/IPresentable.js.map +1 -0
  28. package/Presenter/IPresenter.d.ts +4 -0
  29. package/{src/Presenter → Presenter}/IPresenter.js +2 -2
  30. package/Presenter/IPresenter.js.map +1 -0
  31. package/{src/Presenter/IUpdatable.ts → Presenter/IUpdatable.d.ts} +8 -16
  32. package/{src/Presenter → Presenter}/IUpdatable.js +2 -2
  33. package/Presenter/IUpdatable.js.map +1 -0
  34. package/Presenter/IView.d.ts +4 -0
  35. package/Presenter/IView.js +3 -0
  36. package/Presenter/IView.js.map +1 -0
  37. package/Presenter/IViewVisitor.d.ts +4 -0
  38. package/Presenter/IViewVisitor.js +3 -0
  39. package/Presenter/IViewVisitor.js.map +1 -0
  40. package/Presenter/ModelStore.d.ts +17 -0
  41. package/Presenter/ModelStore.js +64 -0
  42. package/Presenter/ModelStore.js.map +1 -0
  43. package/Presenter/SimpleAction.d.ts +9 -0
  44. package/Presenter/SimpleAction.js +20 -0
  45. package/Presenter/SimpleAction.js.map +1 -0
  46. package/Presenter/index.d.ts +10 -0
  47. package/Presenter/index.js +14 -0
  48. package/Presenter/index.js.map +1 -0
  49. package/Serialization/LocalStorageObjectReader.d.ts +6 -0
  50. package/Serialization/LocalStorageObjectReader.js +20 -0
  51. package/Serialization/LocalStorageObjectReader.js.map +1 -0
  52. package/Serialization/LocalStorageObjectWriter.d.ts +7 -0
  53. package/Serialization/LocalStorageObjectWriter.js +20 -0
  54. package/Serialization/LocalStorageObjectWriter.js.map +1 -0
  55. package/Serialization/SessionStorageObjectReader.d.ts +6 -0
  56. package/Serialization/SessionStorageObjectReader.js +20 -0
  57. package/Serialization/SessionStorageObjectReader.js.map +1 -0
  58. package/Serialization/SessionStorageObjectWriter.d.ts +7 -0
  59. package/Serialization/SessionStorageObjectWriter.js +20 -0
  60. package/Serialization/SessionStorageObjectWriter.js.map +1 -0
  61. package/Serialization/index.d.ts +4 -0
  62. package/Serialization/index.js +12 -0
  63. package/Serialization/index.js.map +1 -0
  64. package/Service/AbstractRestClient.d.ts +31 -0
  65. package/Service/AbstractRestClient.js +144 -0
  66. package/Service/AbstractRestClient.js.map +1 -0
  67. package/Service/IHeadersConsumer.d.ts +3 -0
  68. package/Service/IHeadersConsumer.js +3 -0
  69. package/Service/IHeadersConsumer.js.map +1 -0
  70. package/Service/IResponse.d.ts +8 -0
  71. package/Service/IResponse.js +3 -0
  72. package/Service/IResponse.js.map +1 -0
  73. package/Service/IResponseProcessor.d.ts +4 -0
  74. package/Service/IResponseProcessor.js +3 -0
  75. package/Service/IResponseProcessor.js.map +1 -0
  76. package/Service/ServiceError.d.ts +10 -0
  77. package/Service/ServiceError.js +32 -0
  78. package/Service/ServiceError.js.map +1 -0
  79. package/Service/StandardResponse.d.ts +12 -0
  80. package/Service/StandardResponse.js +35 -0
  81. package/Service/StandardResponse.js.map +1 -0
  82. package/Service/StandardResponseProcessor.d.ts +5 -0
  83. package/Service/StandardResponseProcessor.js +17 -0
  84. package/Service/StandardResponseProcessor.js.map +1 -0
  85. package/Service/index.d.ts +7 -0
  86. package/Service/index.js +12 -0
  87. package/Service/index.js.map +1 -0
  88. package/package.json +9 -10
  89. package/strata.client.core-v1.1.0-snapshot.1795478207396.tgz +0 -0
  90. package/Strata.Client.Core.iml +0 -8
  91. package/src/Presenter/AbstractPresenter.js.map +0 -1
  92. package/src/Presenter/AbstractPresenter.ts +0 -34
  93. package/src/Presenter/AbstractUpdatable.js +0 -27
  94. package/src/Presenter/AbstractUpdatable.js.map +0 -1
  95. package/src/Presenter/AbstractUpdatable.ts +0 -46
  96. package/src/Presenter/IAction.js.map +0 -1
  97. package/src/Presenter/IAction.ts +0 -7
  98. package/src/Presenter/IModelStore.js.map +0 -1
  99. package/src/Presenter/IPresenter.js.map +0 -1
  100. package/src/Presenter/IPresenter.ts +0 -8
  101. package/src/Presenter/IUpdatable.js.map +0 -1
  102. package/src/Presenter/ModelStore.js +0 -32
  103. package/src/Presenter/ModelStore.js.map +0 -1
  104. package/src/Presenter/ModelStore.ts +0 -53
  105. package/tsconfig.json +0 -16
@@ -0,0 +1,13 @@
1
+ import { IApplication } from "./IApplication";
2
+ import { IModelStore } from "../Presenter/IModelStore";
3
+ import { IPresenter } from "../Presenter/IPresenter";
4
+ export declare abstract class AbstractApplication<M, V, P extends IPresenter<M, V>> implements IApplication {
5
+ private modelstore;
6
+ private presenter;
7
+ protected constructor();
8
+ protected initialize(modelstore: IModelStore, presenter: P): void;
9
+ abstract start(): void;
10
+ abstract stop(): void;
11
+ protected getModelStore(): IModelStore;
12
+ protected getPresenter(): P;
13
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AbstractApplication = void 0;
4
+ class AbstractApplication {
5
+ modelstore;
6
+ presenter;
7
+ constructor() {
8
+ this.modelstore = null;
9
+ this.presenter = null;
10
+ }
11
+ initialize(modelstore, presenter) {
12
+ this.modelstore = modelstore;
13
+ this.presenter = presenter;
14
+ this.modelstore.attach(this.presenter);
15
+ }
16
+ getModelStore() {
17
+ return this.modelstore;
18
+ }
19
+ getPresenter() {
20
+ return this.presenter;
21
+ }
22
+ }
23
+ exports.AbstractApplication = AbstractApplication;
24
+ //# sourceMappingURL=AbstractApplication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbstractApplication.js","sourceRoot":"","sources":["../../../src/main/typescript/Main/AbstractApplication.ts"],"names":[],"mappings":";;;AAIA,MACe,mBAAmB;IAGtB,UAAU,CAAc;IACxB,SAAS,CAAI;IAErB;QAEI,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IAC1B,CAAC;IAES,UAAU,CAAC,UAAuB,EAAC,SAAY;QAErD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;IAMS,aAAa;QAEnB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAES,YAAY;QAElB,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;CACJ;AAlCD,kDAkCC"}
@@ -0,0 +1,4 @@
1
+ export interface IApplication {
2
+ start(): void;
3
+ stop(): void;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IApplication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IApplication.js","sourceRoot":"","sources":["../../../src/main/typescript/Main/IApplication.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export { IApplication } from './IApplication';
2
+ export { AbstractApplication } from './AbstractApplication';
package/Main/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AbstractApplication = void 0;
4
+ var AbstractApplication_1 = require("./AbstractApplication");
5
+ Object.defineProperty(exports, "AbstractApplication", { enumerable: true, get: function () { return AbstractApplication_1.AbstractApplication; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/main/typescript/Main/index.ts"],"names":[],"mappings":";;;AACA,6DAA0D;AAAlD,0HAAA,mBAAmB,OAAA"}
@@ -0,0 +1,11 @@
1
+ import { AbstractUpdatable } from "./AbstractUpdatable";
2
+ import { IPresenter } from "./IPresenter";
3
+ import { IModelStore } from "./IModelStore";
4
+ export declare abstract class AbstractPresenter<M, V> extends AbstractUpdatable<M> implements IPresenter<M, V> {
5
+ private view;
6
+ protected constructor(key: string, modelstore?: IModelStore);
7
+ setView(view: V): void;
8
+ getView(): V;
9
+ update(model: M): void;
10
+ protected abstract doUpdate(view: V, model: M): void;
11
+ }
@@ -1,21 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AbstractPresenter = void 0;
4
- const AbstractUpdatable_1 = require("./AbstractUpdatable");
5
- class AbstractPresenter extends AbstractUpdatable_1.AbstractUpdatable {
6
- constructor(modelstore, key) {
7
- super(modelstore, key);
8
- this.view = null;
9
- }
10
- getView() {
11
- return this.view;
12
- }
13
- update(model) {
14
- this.doUpdate(this.view, model);
15
- }
16
- setView(view) {
17
- this.view = view;
18
- }
19
- }
20
- exports.AbstractPresenter = AbstractPresenter;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AbstractPresenter = void 0;
4
+ const AbstractUpdatable_1 = require("./AbstractUpdatable");
5
+ class AbstractPresenter extends AbstractUpdatable_1.AbstractUpdatable {
6
+ view;
7
+ constructor(key, modelstore) {
8
+ super(key, modelstore);
9
+ this.view = null;
10
+ }
11
+ setView(view) {
12
+ this.view = view;
13
+ }
14
+ getView() {
15
+ return this.view;
16
+ }
17
+ update(model) {
18
+ this.doUpdate(this.view, model);
19
+ }
20
+ }
21
+ exports.AbstractPresenter = AbstractPresenter;
21
22
  //# sourceMappingURL=AbstractPresenter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbstractPresenter.js","sourceRoot":"","sources":["../../../src/main/typescript/Presenter/AbstractPresenter.ts"],"names":[],"mappings":";;;AAAA,2DAAsD;AAItD,MACe,iBACX,SAAQ,qCAAoB;IAGpB,IAAI,CAAI;IAEhB,YAAsB,GAAW,EAAC,UAAwB;QAEtD,KAAK,CAAC,GAAG,EAAC,UAAU,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,OAAO,CAAC,IAAO;QAEX,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,OAAO;QAEH,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,KAAQ;QAEX,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAC,KAAK,CAAC,CAAC;IACnC,CAAC;CAIJ;AA9BD,8CA8BC"}
@@ -0,0 +1,16 @@
1
+ import { IUpdatable } from "./IUpdatable";
2
+ import { IModelStore } from "./IModelStore";
3
+ import { IAction } from "./IAction";
4
+ import { ICompletionStage } from "strata.foundation.core/Concurrent";
5
+ export declare abstract class AbstractUpdatable<M> implements IUpdatable<M> {
6
+ private modelstore;
7
+ private readonly key;
8
+ protected constructor(key: string, modelstore?: IModelStore);
9
+ setModelStore(modelStore: IModelStore): void;
10
+ clearModelStore(): void;
11
+ getModelStore(): IModelStore;
12
+ getKey(): string;
13
+ abstract update(model: M): void;
14
+ protected dispatch(action: (m: M) => ICompletionStage<M>): void;
15
+ protected dispatchAction(action: IAction<M>): void;
16
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AbstractUpdatable = void 0;
4
+ const Action_1 = require("./Action");
5
+ class AbstractUpdatable {
6
+ modelstore;
7
+ key;
8
+ constructor(key, modelstore) {
9
+ this.key = key;
10
+ if (modelstore != null) {
11
+ this.modelstore = modelstore;
12
+ this.modelstore.attach(this);
13
+ }
14
+ else
15
+ this.modelstore = null;
16
+ }
17
+ setModelStore(modelStore) {
18
+ this.modelstore = modelStore;
19
+ }
20
+ clearModelStore() {
21
+ this.modelstore = null;
22
+ }
23
+ getModelStore() {
24
+ return this.modelstore;
25
+ }
26
+ getKey() {
27
+ return this.key;
28
+ }
29
+ dispatch(action) {
30
+ this.dispatchAction(new Action_1.Action(this.getKey(), action));
31
+ }
32
+ dispatchAction(action) {
33
+ this.modelstore.apply(action);
34
+ }
35
+ }
36
+ exports.AbstractUpdatable = AbstractUpdatable;
37
+ //# sourceMappingURL=AbstractUpdatable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbstractUpdatable.js","sourceRoot":"","sources":["../../../src/main/typescript/Presenter/AbstractUpdatable.ts"],"names":[],"mappings":";;;AAIA,qCAAgC;AAEhC,MACe,iBAAiB;IAGpB,UAAU,CAAc;IACf,GAAG,CAAS;IAE7B,YAAsB,GAAW,EAAC,UAAwB;QAEtD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QAEf,IAAI,UAAU,IAAI,IAAI,EACtB,CAAC;YACG,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;YAC7B,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;;YAEG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED,aAAa,CAAC,UAAuB;QAEjC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IAED,eAAe;QAEX,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IAC3B,CAAC;IAED,aAAa;QAET,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,MAAM;QAEF,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAIS,QAAQ,CAAC,MAAqC;QAEpD,IAAI,CAAC,cAAc,CACf,IAAI,eAAM,CACN,IAAI,CAAC,MAAM,EAAE,EACb,MAAuC,CAAC,CAAC,CAAC;IACtD,CAAC;IAES,cAAc,CAAC,MAAkB;QAEvC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;CACJ;AAtDD,8CAsDC"}
@@ -0,0 +1,9 @@
1
+ import { IAction } from "./IAction";
2
+ import { ICompletionStage } from "strata.foundation.core/Concurrent";
3
+ export declare class Action<M> implements IAction<M> {
4
+ private readonly key;
5
+ private readonly action;
6
+ constructor(key: string, action: (model: M) => ICompletionStage<M>);
7
+ getKey(): string;
8
+ apply(model: M): ICompletionStage<M>;
9
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Action = void 0;
4
+ class Action {
5
+ key;
6
+ action;
7
+ constructor(key, action) {
8
+ this.key = key;
9
+ this.action = action;
10
+ }
11
+ getKey() {
12
+ return this.key;
13
+ }
14
+ apply(model) {
15
+ return this.action(model);
16
+ }
17
+ }
18
+ exports.Action = Action;
19
+ //# sourceMappingURL=Action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Action.js","sourceRoot":"","sources":["../../../src/main/typescript/Presenter/Action.ts"],"names":[],"mappings":";;;AAGA,MACM,MAAM;IAGS,GAAG,CAAS;IACZ,MAAM,CAAoC;IAE3D,YAAY,GAAW,EAAC,MAAyC;QAE7D,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,MAAM;QAEF,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,KAAQ;QAEV,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;CAEJ;AAvBD,wBAuBC"}
@@ -0,0 +1,5 @@
1
+ import { ICompletionStage } from "strata.foundation.core/Concurrent";
2
+ export interface IAction<M> {
3
+ getKey(): string;
4
+ apply(model: M): ICompletionStage<M>;
5
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=IAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAction.js","sourceRoot":"","sources":["../../../src/main/typescript/Presenter/IAction.ts"],"names":[],"mappings":""}
@@ -1,21 +1,12 @@
1
- import {IUpdatable} from "./IUpdatable";
2
- import {IAction} from "./IAction";
3
-
4
- export
5
- interface IModelStore
6
- {
7
- attach<M>(updatable: IUpdatable<M>): IModelStore;
8
-
9
- detach<M>(updatable: IUpdatable<M>): IModelStore;
10
-
11
- insert<M>(key: string,model:M): IModelStore;
12
-
13
- remove(key: string): IModelStore;
14
-
15
- hasUpdatable(key: string): boolean;
16
-
17
- hasModel(key: string): boolean;
18
-
19
- apply<M>(action: IAction<M>): void;
20
-
21
- }
1
+ import { IUpdatable } from "./IUpdatable";
2
+ import { IAction } from "./IAction";
3
+ export interface IModelStore {
4
+ attach<M>(updatable: IUpdatable<M>): IModelStore;
5
+ detach<M>(updatable: IUpdatable<M>): IModelStore;
6
+ insert<M>(key: string, model: M): IModelStore;
7
+ remove(key: string): IModelStore;
8
+ getModel<M>(key: string): M;
9
+ hasUpdatable(key: string): boolean;
10
+ hasModel(key: string): boolean;
11
+ apply<M>(action: IAction<M>): void;
12
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=IModelStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IModelStore.js","sourceRoot":"","sources":["../../../src/main/typescript/Presenter/IModelStore.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export interface IPresentable<V> {
2
+ setView(view: V): void;
3
+ getView(): V;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IPresentable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPresentable.js","sourceRoot":"","sources":["../../../src/main/typescript/Presenter/IPresentable.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { IUpdatable } from "./IUpdatable";
2
+ import { IPresentable } from "./IPresentable";
3
+ export interface IPresenter<M, V> extends IUpdatable<M>, IPresentable<V> {
4
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=IPresenter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPresenter.js","sourceRoot":"","sources":["../../../src/main/typescript/Presenter/IPresenter.ts"],"names":[],"mappings":""}
@@ -1,16 +1,8 @@
1
- import {IModelStore} from "./IModelStore";
2
-
3
- export
4
- interface IUpdatable<M>
5
- {
6
- setModelStore(modelStore: IModelStore): void;
7
-
8
- clearModelStore(): void;
9
-
10
- getModelStore(): IModelStore;
11
-
12
- getKey(): string;
13
-
14
- update(model: M);
15
-
16
- }
1
+ import { IModelStore } from "./IModelStore";
2
+ export interface IUpdatable<M> {
3
+ setModelStore(modelStore: IModelStore): void;
4
+ clearModelStore(): void;
5
+ getModelStore(): IModelStore;
6
+ getKey(): string;
7
+ update(model: M): any;
8
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=IUpdatable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IUpdatable.js","sourceRoot":"","sources":["../../../src/main/typescript/Presenter/IUpdatable.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { IViewVisitor } from "./IViewVisitor";
2
+ export interface IView {
3
+ accept(visitor: IViewVisitor): void;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IView.js","sourceRoot":"","sources":["../../../src/main/typescript/Presenter/IView.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { IView } from "./IView";
2
+ export interface IViewVisitor {
3
+ visit(view: IView): void;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IViewVisitor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IViewVisitor.js","sourceRoot":"","sources":["../../../src/main/typescript/Presenter/IViewVisitor.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { IModelStore } from "./IModelStore";
2
+ import { IAction } from "./IAction";
3
+ import { IUpdatable } from "./IUpdatable";
4
+ export declare class ModelStore implements IModelStore {
5
+ private updatables;
6
+ private models;
7
+ constructor();
8
+ attach<M>(updatable: IUpdatable<M>): IModelStore;
9
+ detach<M>(updatable: IUpdatable<M>): IModelStore;
10
+ insert<M>(key: string, model: M): IModelStore;
11
+ remove(key: string): IModelStore;
12
+ getModel<M>(key: string): M;
13
+ hasUpdatable(key: string): boolean;
14
+ hasModel(key: string): boolean;
15
+ apply<M>(action: IAction<M>): void;
16
+ private replace;
17
+ }
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ModelStore = void 0;
4
+ const Container_1 = require("strata.foundation.core/Container");
5
+ class ModelStore {
6
+ updatables;
7
+ models;
8
+ constructor() {
9
+ this.updatables = new Container_1.MultiMap();
10
+ this.models = new Map();
11
+ }
12
+ attach(updatable) {
13
+ this.updatables.put(updatable.getKey(), updatable);
14
+ if (updatable.getModelStore() != this)
15
+ updatable.setModelStore(this);
16
+ return this;
17
+ }
18
+ detach(updatable) {
19
+ this.updatables.remove(updatable.getKey(), updatable);
20
+ if (updatable.getModelStore() == this)
21
+ updatable.clearModelStore();
22
+ return this;
23
+ }
24
+ insert(key, model) {
25
+ this.models.set(key, model);
26
+ return this;
27
+ }
28
+ remove(key) {
29
+ this.models.delete(key);
30
+ return this;
31
+ }
32
+ getModel(key) {
33
+ return this.hasModel(key)
34
+ ? this.models.get(key)
35
+ : null;
36
+ }
37
+ hasUpdatable(key) {
38
+ return this.updatables.containsKey(key);
39
+ }
40
+ hasModel(key) {
41
+ return this.models.has(key);
42
+ }
43
+ apply(action) {
44
+ let key = action.getKey();
45
+ let updatables = this.updatables.get(key);
46
+ let model = this.models.get(key);
47
+ let updated = action.apply(model);
48
+ this.replace(key, updated, model, updatables);
49
+ }
50
+ replace(key, updated, previous, updatables) {
51
+ updated
52
+ .thenApply(current => {
53
+ this.models.delete(key);
54
+ this.models.set(key, current);
55
+ return current;
56
+ })
57
+ .thenAccept(current => updatables
58
+ .map(updatable => updatable)
59
+ .forEach(updatable => updatable.update(current)), error => console.error(error))
60
+ .subscribe();
61
+ }
62
+ }
63
+ exports.ModelStore = ModelStore;
64
+ //# sourceMappingURL=ModelStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModelStore.js","sourceRoot":"","sources":["../../../src/main/typescript/Presenter/ModelStore.ts"],"names":[],"mappings":";;;AAKA,gEAA0D;AAE1D,MACM,UAAU;IAGJ,UAAU,CAA2B;IACrC,MAAM,CAAqB;IAEnC;QAEI,IAAI,CAAC,UAAU,GAAG,IAAI,oBAAQ,EAAiB,CAAC;QAChD,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC5C,CAAC;IAED,MAAM,CAAI,SAAwB;QAE9B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,EAAC,SAAS,CAAC,CAAC;QAElD,IAAI,SAAS,CAAC,aAAa,EAAE,IAAI,IAAI;YACjC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAElC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAI,SAAwB;QAE9B,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,EAAC,SAAS,CAAC,CAAC;QAErD,IAAI,SAAS,CAAC,aAAa,EAAE,IAAI,IAAI;YACjC,SAAS,CAAC,eAAe,EAAE,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAI,GAAW,EAAE,KAAQ;QAE3B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,GAAW;QAEd,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,QAAQ,CAAI,GAAW;QAEnB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YACrB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAM;YAC3B,CAAC,CAAC,IAAI,CAAC;IACf,CAAC;IAED,YAAY,CAAC,GAAW;QAEpB,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC5C,CAAC;IAED,QAAQ,CAAC,GAAW;QAEhB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAI,MAAkB;QAEvB,IAAI,GAAG,GAAW,MAAM,CAAC,MAAM,EAAE,CAAC;QAClC,IAAI,UAAU,GAAkB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACzD,IAAI,KAAK,GAAS,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,OAAO,GAAwB,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEvD,IAAI,CAAC,OAAO,CAAC,GAAG,EAAC,OAAO,EAAC,KAAK,EAAC,UAAU,CAAC,CAAC;IAC/C,CAAC;IAEO,OAAO,CACX,GAAkB,EAClB,OAA+B,EAC/B,QAAa,EACb,UAAyB;QAEzB,OAAO;aACF,SAAS,CACN,OAAO,CAAC,EAAE;YAEN,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAC,OAAO,CAAC,CAAC;YAC7B,OAAO,OAAO,CAAC;QACnB,CAAC,CAAC;aACL,UAAU,CACP,OAAO,CAAC,EAAE,CACN,UAAU;aACL,GAAG,CAAC,SAAS,CAAC,EAAE,CAAgB,SAAS,CAAC;aAC1C,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EACxD,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;aACjC,SAAS,EAAE,CAAC;IACrB,CAAC;CAEJ;AA/FD,gCA+FC"}
@@ -0,0 +1,9 @@
1
+ import { IAction } from "./IAction";
2
+ import { ICompletionStage } from "strata.foundation.core/Concurrent";
3
+ export declare class SimpleAction<M> implements IAction<M> {
4
+ private readonly key;
5
+ private readonly action;
6
+ constructor(key: string, action: (model: M) => M);
7
+ getKey(): string;
8
+ apply(model: M): ICompletionStage<M>;
9
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SimpleAction = void 0;
4
+ const Concurrent_1 = require("strata.foundation.core/Concurrent");
5
+ class SimpleAction {
6
+ key;
7
+ action;
8
+ constructor(key, action) {
9
+ this.key = key;
10
+ this.action = action;
11
+ }
12
+ getKey() {
13
+ return this.key;
14
+ }
15
+ apply(model) {
16
+ return Concurrent_1.CompletableObservable.fromResult(this.action(model));
17
+ }
18
+ }
19
+ exports.SimpleAction = SimpleAction;
20
+ //# sourceMappingURL=SimpleAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimpleAction.js","sourceRoot":"","sources":["../../../src/main/typescript/Presenter/SimpleAction.ts"],"names":[],"mappings":";;;AACA,kEAAyF;AAEzF,MACM,YAAY;IAGG,GAAG,CAAS;IACZ,MAAM,CAAkB;IAEzC,YAAY,GAAW,EAAC,MAAuB;QAE3C,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,MAAM;QAEF,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,KAAQ;QAEV,OAAO,kCAAqB,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAChE,CAAC;CAEJ;AAvBD,oCAuBC"}
@@ -0,0 +1,10 @@
1
+ export { IUpdatable } from './IUpdatable';
2
+ export { IPresentable } from './IPresentable';
3
+ export { IAction } from './IAction';
4
+ export { IModelStore } from './IModelStore';
5
+ export { IPresenter } from './IPresenter';
6
+ export { AbstractUpdatable } from './AbstractUpdatable';
7
+ export { AbstractPresenter } from './AbstractPresenter';
8
+ export { ModelStore } from './ModelStore';
9
+ export { Action } from './Action';
10
+ export { SimpleAction } from './SimpleAction';
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SimpleAction = exports.Action = exports.ModelStore = exports.AbstractPresenter = exports.AbstractUpdatable = void 0;
4
+ var AbstractUpdatable_1 = require("./AbstractUpdatable");
5
+ Object.defineProperty(exports, "AbstractUpdatable", { enumerable: true, get: function () { return AbstractUpdatable_1.AbstractUpdatable; } });
6
+ var AbstractPresenter_1 = require("./AbstractPresenter");
7
+ Object.defineProperty(exports, "AbstractPresenter", { enumerable: true, get: function () { return AbstractPresenter_1.AbstractPresenter; } });
8
+ var ModelStore_1 = require("./ModelStore");
9
+ Object.defineProperty(exports, "ModelStore", { enumerable: true, get: function () { return ModelStore_1.ModelStore; } });
10
+ var Action_1 = require("./Action");
11
+ Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return Action_1.Action; } });
12
+ var SimpleAction_1 = require("./SimpleAction");
13
+ Object.defineProperty(exports, "SimpleAction", { enumerable: true, get: function () { return SimpleAction_1.SimpleAction; } });
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/main/typescript/Presenter/index.ts"],"names":[],"mappings":";;;AAKA,yDAAsD;AAA9C,sHAAA,iBAAiB,OAAA;AACzB,yDAAsD;AAA9C,sHAAA,iBAAiB,OAAA;AACzB,2CAAwC;AAAhC,wGAAA,UAAU,OAAA;AAClB,mCAAgC;AAAxB,gGAAA,MAAM,OAAA;AACd,+CAA4C;AAApC,4GAAA,YAAY,OAAA"}
@@ -0,0 +1,6 @@
1
+ import { AbstractObjectReader } from "strata.foundation.core/Serialization";
2
+ export declare class LocalStorageObjectReader extends AbstractObjectReader {
3
+ private source;
4
+ constructor(storageKey: string);
5
+ private static fromLocalStorage;
6
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LocalStorageObjectReader = void 0;
4
+ const Serialization_1 = require("strata.foundation.core/Serialization");
5
+ class LocalStorageObjectReader extends Serialization_1.AbstractObjectReader {
6
+ source;
7
+ constructor(storageKey) {
8
+ super(LocalStorageObjectReader.fromLocalStorage(storageKey));
9
+ }
10
+ static fromLocalStorage(storageKey) {
11
+ const item = localStorage.getItem(storageKey);
12
+ if (item === null) {
13
+ console.log("LocalStorageObjectReader: No item found in local storage for key " + storageKey);
14
+ return null;
15
+ }
16
+ return JSON.parse(item);
17
+ }
18
+ }
19
+ exports.LocalStorageObjectReader = LocalStorageObjectReader;
20
+ //# sourceMappingURL=LocalStorageObjectReader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalStorageObjectReader.js","sourceRoot":"","sources":["../../../src/main/typescript/Serialization/LocalStorageObjectReader.ts"],"names":[],"mappings":";;;AAAA,wEAG8C;AAE9C,MACM,wBACF,SAAQ,oCAAoB;IAEpB,MAAM,CAAS;IAEvB,YAAmB,UAAkB;QAEjC,KAAK,CAAC,wBAAwB,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC;IACjE,CAAC;IAEO,MAAM,CAAC,gBAAgB,CAAC,UAAkB;QAE9C,MAAM,IAAI,GAAW,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAEtD,IAAI,IAAI,KAAK,IAAI,EACjB,CAAC;YACG,OAAO,CAAC,GAAG,CAAC,mEAAmE,GAAG,UAAU,CAAC,CAAC;YAC9F,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;CAEJ;AAxBD,4DAwBC"}
@@ -0,0 +1,7 @@
1
+ import { AbstractObjectWriter, ISerializable } from "strata.foundation.core/Serialization";
2
+ export declare class LocalStorageObjectWriter extends AbstractObjectWriter {
3
+ private readonly storageKey;
4
+ constructor(storageKey: string);
5
+ write<T extends ISerializable>(value: T): LocalStorageObjectWriter;
6
+ toLocalStorage(): LocalStorageObjectWriter;
7
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LocalStorageObjectWriter = void 0;
4
+ const Serialization_1 = require("strata.foundation.core/Serialization");
5
+ class LocalStorageObjectWriter extends Serialization_1.AbstractObjectWriter {
6
+ storageKey;
7
+ constructor(storageKey) {
8
+ super();
9
+ this.storageKey = storageKey;
10
+ }
11
+ write(value) {
12
+ return super.write(value);
13
+ }
14
+ toLocalStorage() {
15
+ localStorage.setItem(this.storageKey, JSON.stringify(this.getRoot()));
16
+ return this;
17
+ }
18
+ }
19
+ exports.LocalStorageObjectWriter = LocalStorageObjectWriter;
20
+ //# sourceMappingURL=LocalStorageObjectWriter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalStorageObjectWriter.js","sourceRoot":"","sources":["../../../src/main/typescript/Serialization/LocalStorageObjectWriter.ts"],"names":[],"mappings":";;;AAAA,wEAAyF;AAEzF,MACM,wBACF,SAAQ,oCAAoB;IAEX,UAAU,CAAS;IAEpC,YAAmB,UAAkB;QAEjC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IAED,KAAK,CAA0B,KAAQ;QAEnC,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,CAA6B,CAAC;IAC1D,CAAC;IAEM,cAAc;QAEjB,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACtE,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAtBD,4DAsBC"}
@@ -0,0 +1,6 @@
1
+ import { AbstractObjectReader } from "strata.foundation.core/Serialization";
2
+ export declare class SessionStorageObjectReader extends AbstractObjectReader {
3
+ private source;
4
+ constructor(storageKey: string);
5
+ private static fromSessionStorage;
6
+ }