strata.client.core 0.0.0-snapshot.1
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/Main/AbstractApplication.d.ts +13 -0
- package/Main/AbstractApplication.js +24 -0
- package/Main/AbstractApplication.js.map +1 -0
- package/Main/IApplication.d.ts +4 -0
- package/Main/IApplication.js +3 -0
- package/Main/IApplication.js.map +1 -0
- package/Main/index.d.ts +2 -0
- package/Main/index.js +6 -0
- package/Main/index.js.map +1 -0
- package/Presenter/AbstractPresenter.d.ts +11 -0
- package/Presenter/AbstractPresenter.js +22 -0
- package/Presenter/AbstractPresenter.js.map +1 -0
- package/Presenter/AbstractUpdatable.d.ts +14 -0
- package/Presenter/AbstractUpdatable.js +33 -0
- package/Presenter/AbstractUpdatable.js.map +1 -0
- package/Presenter/Action.d.ts +9 -0
- package/Presenter/Action.js +19 -0
- package/Presenter/Action.js.map +1 -0
- package/Presenter/IAction.d.ts +5 -0
- package/Presenter/IAction.js +3 -0
- package/Presenter/IAction.js.map +1 -0
- package/Presenter/IModelStore.d.ts +11 -0
- package/Presenter/IModelStore.js +3 -0
- package/Presenter/IModelStore.js.map +1 -0
- package/Presenter/IPresentable.d.ts +4 -0
- package/Presenter/IPresentable.js +3 -0
- package/Presenter/IPresentable.js.map +1 -0
- package/Presenter/IPresenter.d.ts +4 -0
- package/Presenter/IPresenter.js +3 -0
- package/Presenter/IPresenter.js.map +1 -0
- package/Presenter/IUpdatable.d.ts +8 -0
- package/Presenter/IUpdatable.js +3 -0
- package/Presenter/IUpdatable.js.map +1 -0
- package/Presenter/IView.d.ts +4 -0
- package/Presenter/IView.js +3 -0
- package/Presenter/IView.js.map +1 -0
- package/Presenter/IViewVisitor.d.ts +4 -0
- package/Presenter/IViewVisitor.js +3 -0
- package/Presenter/IViewVisitor.js.map +1 -0
- package/Presenter/ModelStore.d.ts +16 -0
- package/Presenter/ModelStore.js +59 -0
- package/Presenter/ModelStore.js.map +1 -0
- package/Presenter/SimpleAction.d.ts +9 -0
- package/Presenter/SimpleAction.js +20 -0
- package/Presenter/SimpleAction.js.map +1 -0
- package/Presenter/index.d.ts +10 -0
- package/Presenter/index.js +14 -0
- package/Presenter/index.js.map +1 -0
- package/Service/AbstractRestClient.d.ts +23 -0
- package/Service/AbstractRestClient.js +95 -0
- package/Service/AbstractRestClient.js.map +1 -0
- package/Service/IResponse.d.ts +8 -0
- package/Service/IResponse.js +3 -0
- package/Service/IResponse.js.map +1 -0
- package/Service/IResponseProcessor.d.ts +4 -0
- package/Service/IResponseProcessor.js +3 -0
- package/Service/IResponseProcessor.js.map +1 -0
- package/Service/ServiceError.d.ts +10 -0
- package/Service/ServiceError.js +32 -0
- package/Service/ServiceError.js.map +1 -0
- package/Service/StandardResponse.d.ts +12 -0
- package/Service/StandardResponse.js +32 -0
- package/Service/StandardResponse.js.map +1 -0
- package/Service/StandardResponseProcessor.d.ts +5 -0
- package/Service/StandardResponseProcessor.js +17 -0
- package/Service/StandardResponseProcessor.js.map +1 -0
- package/Service/index.d.ts +6 -0
- package/Service/index.js +12 -0
- package/Service/index.js.map +1 -0
- package/package.json +16 -0
- package/strata.client.core-v0.0.0-snapshot.1.tgz +0 -0
|
@@ -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":["../../../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 @@
|
|
|
1
|
+
{"version":3,"file":"IApplication.js","sourceRoot":"","sources":["../../../main/typescript/Main/IApplication.ts"],"names":[],"mappings":""}
|
package/Main/index.d.ts
ADDED
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":["../../../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
|
+
}
|
|
@@ -0,0 +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
|
+
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;
|
|
22
|
+
//# sourceMappingURL=AbstractPresenter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractPresenter.js","sourceRoot":"","sources":["../../../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,14 @@
|
|
|
1
|
+
import { IUpdatable } from "./IUpdatable";
|
|
2
|
+
import { IModelStore } from "./IModelStore";
|
|
3
|
+
import { IAction } from "./IAction";
|
|
4
|
+
export declare abstract class AbstractUpdatable<M> implements IUpdatable<M> {
|
|
5
|
+
private modelstore;
|
|
6
|
+
private readonly key;
|
|
7
|
+
protected constructor(key: string, modelstore?: IModelStore);
|
|
8
|
+
setModelStore(modelStore: IModelStore): void;
|
|
9
|
+
clearModelStore(): void;
|
|
10
|
+
getModelStore(): IModelStore;
|
|
11
|
+
getKey(): string;
|
|
12
|
+
abstract update(model: M): void;
|
|
13
|
+
protected dispatch<M>(action: IAction<M>): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractUpdatable = void 0;
|
|
4
|
+
class AbstractUpdatable {
|
|
5
|
+
modelstore;
|
|
6
|
+
key;
|
|
7
|
+
constructor(key, modelstore) {
|
|
8
|
+
this.key = key;
|
|
9
|
+
if (modelstore != null) {
|
|
10
|
+
this.modelstore = modelstore;
|
|
11
|
+
this.modelstore.attach(this);
|
|
12
|
+
}
|
|
13
|
+
else
|
|
14
|
+
this.modelstore = null;
|
|
15
|
+
}
|
|
16
|
+
setModelStore(modelStore) {
|
|
17
|
+
this.modelstore = modelStore;
|
|
18
|
+
}
|
|
19
|
+
clearModelStore() {
|
|
20
|
+
this.modelstore = null;
|
|
21
|
+
}
|
|
22
|
+
getModelStore() {
|
|
23
|
+
return this.modelstore;
|
|
24
|
+
}
|
|
25
|
+
getKey() {
|
|
26
|
+
return this.key;
|
|
27
|
+
}
|
|
28
|
+
dispatch(action) {
|
|
29
|
+
this.modelstore.apply(action);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.AbstractUpdatable = AbstractUpdatable;
|
|
33
|
+
//# sourceMappingURL=AbstractUpdatable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractUpdatable.js","sourceRoot":"","sources":["../../../main/typescript/Presenter/AbstractUpdatable.ts"],"names":[],"mappings":";;;AAIA,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;YACI,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;YAC7B,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SAChC;;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,CAAI,MAAkB;QAEpC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;CAEJ;AA/CD,8CA+CC"}
|
|
@@ -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":["../../../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 @@
|
|
|
1
|
+
{"version":3,"file":"IAction.js","sourceRoot":"","sources":["../../../main/typescript/Presenter/IAction.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
hasUpdatable(key: string): boolean;
|
|
9
|
+
hasModel(key: string): boolean;
|
|
10
|
+
apply<M>(action: IAction<M>): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IModelStore.js","sourceRoot":"","sources":["../../../main/typescript/Presenter/IModelStore.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IPresentable.js","sourceRoot":"","sources":["../../../main/typescript/Presenter/IPresentable.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IPresenter.js","sourceRoot":"","sources":["../../../main/typescript/Presenter/IPresenter.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IUpdatable.js","sourceRoot":"","sources":["../../../main/typescript/Presenter/IUpdatable.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IView.js","sourceRoot":"","sources":["../../../main/typescript/Presenter/IView.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IViewVisitor.js","sourceRoot":"","sources":["../../../main/typescript/Presenter/IViewVisitor.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
hasUpdatable(key: string): boolean;
|
|
13
|
+
hasModel(key: string): boolean;
|
|
14
|
+
apply<M>(action: IAction<M>): void;
|
|
15
|
+
private replace;
|
|
16
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
hasUpdatable(key) {
|
|
33
|
+
return this.updatables.containsKey(key);
|
|
34
|
+
}
|
|
35
|
+
hasModel(key) {
|
|
36
|
+
return this.models.has(key);
|
|
37
|
+
}
|
|
38
|
+
apply(action) {
|
|
39
|
+
let key = action.getKey();
|
|
40
|
+
let updatables = this.updatables.get(key);
|
|
41
|
+
let model = this.models.get(key);
|
|
42
|
+
let updated = action.apply(model);
|
|
43
|
+
this.replace(key, updated, model, updatables);
|
|
44
|
+
}
|
|
45
|
+
replace(key, updated, previous, updatables) {
|
|
46
|
+
updated
|
|
47
|
+
.thenApply(current => {
|
|
48
|
+
this.models.delete(key);
|
|
49
|
+
this.models.set(key, current);
|
|
50
|
+
return current;
|
|
51
|
+
})
|
|
52
|
+
.thenAccept(current => updatables
|
|
53
|
+
.map(updatable => updatable)
|
|
54
|
+
.forEach(updatable => updatable.update(current)), error => console.error(error))
|
|
55
|
+
.subscribe();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.ModelStore = ModelStore;
|
|
59
|
+
//# sourceMappingURL=ModelStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelStore.js","sourceRoot":"","sources":["../../../main/typescript/Presenter/ModelStore.ts"],"names":[],"mappings":";;;AAKA,gEAA0D;AAE1D,MACM,UAAU;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kB,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;AAxFD,gCAwFC"}
|
|
@@ -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":["../../../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":["../../../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,23 @@
|
|
|
1
|
+
import { ICompletionStage } from "strata.foundation.core/Concurrent";
|
|
2
|
+
import { IResponseProcessor } from "./IResponseProcessor";
|
|
3
|
+
export declare abstract class AbstractRestClient {
|
|
4
|
+
private readonly baseUrl;
|
|
5
|
+
private headers;
|
|
6
|
+
private readonly responseProcessor;
|
|
7
|
+
protected constructor(baseUrl: string, responseProcessor?: IResponseProcessor);
|
|
8
|
+
protected setHeader(headerKey: string, headerValue: string): AbstractRestClient;
|
|
9
|
+
protected clearHeader(headerKey: string): AbstractRestClient;
|
|
10
|
+
protected clearHeaders(): AbstractRestClient;
|
|
11
|
+
protected getHeader(headerKey: string): string;
|
|
12
|
+
protected hasHeader(headerKey: string): boolean;
|
|
13
|
+
protected doPost<TReply, TRequest>(methodPath: string, request: TRequest): ICompletionStage<TReply>;
|
|
14
|
+
protected doPut<TReply, TRequest>(methodPath: string, request: TRequest): ICompletionStage<TReply>;
|
|
15
|
+
protected doDelete<TReply>(methodPath: string, pathParams: Map<string, Object>, queryParams: Map<string, Object>): ICompletionStage<TReply>;
|
|
16
|
+
protected doGet<TReply>(methodPath: string, pathParams: Map<string, Object>, queryParams: Map<string, Object>): ICompletionStage<TReply>;
|
|
17
|
+
private sendRequestWithBody;
|
|
18
|
+
private sendRequestWithParameters;
|
|
19
|
+
private getUrl;
|
|
20
|
+
private resolveTemplates;
|
|
21
|
+
private appendQueryParams;
|
|
22
|
+
private processResponse;
|
|
23
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractRestClient = void 0;
|
|
4
|
+
const Concurrent_1 = require("strata.foundation.core/Concurrent");
|
|
5
|
+
const StandardResponseProcessor_1 = require("./StandardResponseProcessor");
|
|
6
|
+
const StandardResponse_1 = require("./StandardResponse");
|
|
7
|
+
class AbstractRestClient {
|
|
8
|
+
baseUrl;
|
|
9
|
+
headers;
|
|
10
|
+
responseProcessor;
|
|
11
|
+
constructor(baseUrl, responseProcessor) {
|
|
12
|
+
this.baseUrl = baseUrl;
|
|
13
|
+
this.headers = new Headers();
|
|
14
|
+
this.responseProcessor =
|
|
15
|
+
responseProcessor == null
|
|
16
|
+
? new StandardResponseProcessor_1.StandardResponseProcessor()
|
|
17
|
+
: responseProcessor;
|
|
18
|
+
}
|
|
19
|
+
setHeader(headerKey, headerValue) {
|
|
20
|
+
this.headers.append(headerKey, headerValue);
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
clearHeader(headerKey) {
|
|
24
|
+
this.headers.delete(headerKey);
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
clearHeaders() {
|
|
28
|
+
this.headers = new Headers();
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
getHeader(headerKey) {
|
|
32
|
+
return this.headers.get(headerKey);
|
|
33
|
+
}
|
|
34
|
+
hasHeader(headerKey) {
|
|
35
|
+
return this.headers.has(headerKey);
|
|
36
|
+
}
|
|
37
|
+
doPost(methodPath, request) {
|
|
38
|
+
return this.sendRequestWithBody("POST", methodPath, request);
|
|
39
|
+
}
|
|
40
|
+
doPut(methodPath, request) {
|
|
41
|
+
return this.sendRequestWithBody("PUT", methodPath, request);
|
|
42
|
+
}
|
|
43
|
+
doDelete(methodPath, pathParams, queryParams) {
|
|
44
|
+
return this.sendRequestWithParameters("DELETE", methodPath, pathParams, queryParams);
|
|
45
|
+
}
|
|
46
|
+
doGet(methodPath, pathParams, queryParams) {
|
|
47
|
+
return this.sendRequestWithParameters("GET", methodPath, pathParams, queryParams);
|
|
48
|
+
}
|
|
49
|
+
sendRequestWithBody(method, methodPath, request) {
|
|
50
|
+
return Concurrent_1.CompletableObservable.fromPromise(fetch(this.getUrl(methodPath), {
|
|
51
|
+
method: method,
|
|
52
|
+
body: JSON.stringify(request),
|
|
53
|
+
headers: this.headers
|
|
54
|
+
}).then(response => this.processResponse(response, methodPath)));
|
|
55
|
+
}
|
|
56
|
+
sendRequestWithParameters(method, methodPath, pathParams, queryParams) {
|
|
57
|
+
let requestUrl = this.resolveTemplates(this.getUrl(methodPath), pathParams);
|
|
58
|
+
requestUrl = this.appendQueryParams(requestUrl, queryParams);
|
|
59
|
+
return Concurrent_1.CompletableObservable.fromPromise(fetch(requestUrl, {
|
|
60
|
+
method: method,
|
|
61
|
+
headers: this.headers
|
|
62
|
+
}).then(response => this.processResponse(response, methodPath)));
|
|
63
|
+
}
|
|
64
|
+
getUrl(methodPath) {
|
|
65
|
+
return this.baseUrl + "/" + methodPath;
|
|
66
|
+
}
|
|
67
|
+
resolveTemplates(inputUrl, pathParams) {
|
|
68
|
+
pathParams
|
|
69
|
+
.forEach((value, key, ignore) => {
|
|
70
|
+
let template = '{' + key + '}';
|
|
71
|
+
return inputUrl = inputUrl.replace(template, value.toString);
|
|
72
|
+
});
|
|
73
|
+
return inputUrl;
|
|
74
|
+
}
|
|
75
|
+
appendQueryParams(inputUrl, queryParams) {
|
|
76
|
+
let i = 0;
|
|
77
|
+
queryParams
|
|
78
|
+
.forEach((value, key, ignore) => {
|
|
79
|
+
if (i == 0)
|
|
80
|
+
inputUrl = inputUrl + '?';
|
|
81
|
+
else
|
|
82
|
+
inputUrl = inputUrl + '&';
|
|
83
|
+
++i;
|
|
84
|
+
return inputUrl = inputUrl + key + '=' + value.toString();
|
|
85
|
+
});
|
|
86
|
+
return inputUrl;
|
|
87
|
+
}
|
|
88
|
+
processResponse(response, methodPath) {
|
|
89
|
+
return this
|
|
90
|
+
.responseProcessor
|
|
91
|
+
.process(new StandardResponse_1.StandardResponse(this.baseUrl, methodPath, response));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.AbstractRestClient = AbstractRestClient;
|
|
95
|
+
//# sourceMappingURL=AbstractRestClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractRestClient.js","sourceRoot":"","sources":["../../../main/typescript/Service/AbstractRestClient.ts"],"names":[],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@
|
|
|
1
|
+
{"version":3,"file":"IResponseProcessor.js","sourceRoot":"","sources":["../../../main/typescript/Service/IResponseProcessor.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IResponse } from "./IResponse";
|
|
2
|
+
export declare class ServiceError extends Error {
|
|
3
|
+
private readonly requestPath;
|
|
4
|
+
private readonly status;
|
|
5
|
+
private readonly statusReason;
|
|
6
|
+
constructor(response: IResponse);
|
|
7
|
+
getRequestPath(): string;
|
|
8
|
+
getStatus(): number;
|
|
9
|
+
getStatusReason(): string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServiceError = void 0;
|
|
4
|
+
class ServiceError extends Error {
|
|
5
|
+
requestPath;
|
|
6
|
+
status;
|
|
7
|
+
statusReason;
|
|
8
|
+
constructor(response) {
|
|
9
|
+
super(initializeServiceErrorMessage(response));
|
|
10
|
+
this.requestPath = response.getRequestPath();
|
|
11
|
+
this.status = response.getStatus();
|
|
12
|
+
this.statusReason = response.getStatusReason();
|
|
13
|
+
}
|
|
14
|
+
getRequestPath() {
|
|
15
|
+
return this.requestPath;
|
|
16
|
+
}
|
|
17
|
+
getStatus() {
|
|
18
|
+
return this.status;
|
|
19
|
+
}
|
|
20
|
+
getStatusReason() {
|
|
21
|
+
return this.statusReason;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ServiceError = ServiceError;
|
|
25
|
+
function initializeServiceErrorMessage(response) {
|
|
26
|
+
return "Exception during response processing:\n" +
|
|
27
|
+
"\tFrom request: " + response.getRequestPath() + '\n' +
|
|
28
|
+
"\tResponse status code: " + response.getStatus() + '\n' +
|
|
29
|
+
"\tResponse status message: " + response.getStatusReason() + '\n' +
|
|
30
|
+
"\tResponse media type: " + response.getMediaType() + '\n';
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=ServiceError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceError.js","sourceRoot":"","sources":["../../../main/typescript/Service/ServiceError.ts"],"names":[],"mappings":";;;AAEA,MACM,YACF,SAAQ,KAAK;IAEI,WAAW,CAAS;IACpB,MAAM,CAAS;IACf,YAAY,CAAS;IAEtC,YAAY,QAAmB;QAE3B,KAAK,CAAC,6BAA6B,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC/C,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,eAAe,EAAE,CAAC;IACnD,CAAC;IAED,cAAc;QAEV,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,SAAS;QAEL,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,eAAe;QAEX,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;CAEJ;AA/BD,oCA+BC;AAED,SAAS,6BAA6B,CAAC,QAAmB;IAEtD,OAAO,yCAAyC;QAC5C,kBAAkB,GAAG,QAAQ,CAAC,cAAc,EAAE,GAAG,IAAI;QACrD,0BAA0B,GAAG,QAAQ,CAAC,SAAS,EAAE,GAAG,IAAI;QACxD,6BAA6B,GAAG,QAAQ,CAAC,eAAe,EAAE,GAAG,IAAI;QACjE,yBAAyB,GAAG,QAAQ,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IResponse } from "./IResponse";
|
|
2
|
+
export declare class StandardResponse implements IResponse {
|
|
3
|
+
private readonly requestPath;
|
|
4
|
+
private readonly response;
|
|
5
|
+
constructor(rootPath: string, methodPath: string, response: Response);
|
|
6
|
+
getRequestPath(): string;
|
|
7
|
+
getMediaType(): string;
|
|
8
|
+
getStatus(): number;
|
|
9
|
+
getStatusReason(): string;
|
|
10
|
+
readEntity<E>(): Promise<E>;
|
|
11
|
+
close(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StandardResponse = void 0;
|
|
4
|
+
class StandardResponse {
|
|
5
|
+
requestPath;
|
|
6
|
+
response;
|
|
7
|
+
constructor(rootPath, methodPath, response) {
|
|
8
|
+
this.requestPath = rootPath + '/' + methodPath;
|
|
9
|
+
this.response = response;
|
|
10
|
+
}
|
|
11
|
+
getRequestPath() {
|
|
12
|
+
return this.requestPath;
|
|
13
|
+
}
|
|
14
|
+
getMediaType() {
|
|
15
|
+
if (this.response.headers.has("Content-Type"))
|
|
16
|
+
return this.response.headers.get("Content-Type");
|
|
17
|
+
return "unknown";
|
|
18
|
+
}
|
|
19
|
+
getStatus() {
|
|
20
|
+
return this.response.status;
|
|
21
|
+
}
|
|
22
|
+
getStatusReason() {
|
|
23
|
+
return this.response.statusText;
|
|
24
|
+
}
|
|
25
|
+
readEntity() {
|
|
26
|
+
return this.response.json().then(value => value);
|
|
27
|
+
}
|
|
28
|
+
close() {
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.StandardResponse = StandardResponse;
|
|
32
|
+
//# sourceMappingURL=StandardResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StandardResponse.js","sourceRoot":"","sources":["../../../main/typescript/Service/StandardResponse.ts"],"names":[],"mappings":";;;AAEA,MACM,gBAAgB;IAGD,WAAW,CAAS;IACpB,QAAQ,CAAW;IAEpC,YAAY,QAAgB,EAAC,UAAkB,EAAC,QAAkB;QAE9D,IAAI,CAAC,WAAW,GAAG,QAAQ,GAAG,GAAG,GAAG,UAAU,CAAC;QAC/C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED,cAAc;QAEV,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,YAAY;QAER,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;YACzC,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAErD,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,SAAS;QAEL,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAChC,CAAC;IAED,eAAe;QAEX,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;IACpC,CAAC;IAED,UAAU;QAEN,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAI,KAAK,CAAC,CAAC;IACxD,CAAC;IAED,KAAK;IAEL,CAAC;CAEJ;AA7CD,4CA6CC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StandardResponseProcessor = void 0;
|
|
4
|
+
const ServiceError_1 = require("./ServiceError");
|
|
5
|
+
class StandardResponseProcessor {
|
|
6
|
+
process(response) {
|
|
7
|
+
switch (response.getStatus()) {
|
|
8
|
+
case 200: // OK
|
|
9
|
+
case 500: //INTERNAL_SERVER_ERROR
|
|
10
|
+
return response.readEntity();
|
|
11
|
+
default:
|
|
12
|
+
throw new ServiceError_1.ServiceError(response);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.StandardResponseProcessor = StandardResponseProcessor;
|
|
17
|
+
//# sourceMappingURL=StandardResponseProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StandardResponseProcessor.js","sourceRoot":"","sources":["../../../main/typescript/Service/StandardResponseProcessor.ts"],"names":[],"mappings":";;;AAEA,iDAA4C;AAE5C,MACM,yBAAyB;IAG3B,OAAO,CAAI,QAAmB;QAE1B,QAAQ,QAAQ,CAAC,SAAS,EAAE,EAC5B;YACI,KAAK,GAAG,CAAC,CAAC,KAAK;YACf,KAAK,GAAG,EAAE,uBAAuB;gBAC7B,OAAO,QAAQ,CAAC,UAAU,EAAK,CAAC;YAEpC;gBACI,MAAM,IAAI,2BAAY,CAAC,QAAQ,CAAC,CAAC;SACxC;IACL,CAAC;CACJ;AAhBD,8DAgBC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { IResponse } from "./IResponse";
|
|
2
|
+
export { IResponseProcessor } from "./IResponseProcessor";
|
|
3
|
+
export { StandardResponse } from "./StandardResponse";
|
|
4
|
+
export { StandardResponseProcessor } from "./StandardResponseProcessor";
|
|
5
|
+
export { AbstractRestClient } from "./AbstractRestClient";
|
|
6
|
+
export { ServiceError } from "./ServiceError";
|
package/Service/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServiceError = exports.AbstractRestClient = exports.StandardResponseProcessor = exports.StandardResponse = void 0;
|
|
4
|
+
var StandardResponse_1 = require("./StandardResponse");
|
|
5
|
+
Object.defineProperty(exports, "StandardResponse", { enumerable: true, get: function () { return StandardResponse_1.StandardResponse; } });
|
|
6
|
+
var StandardResponseProcessor_1 = require("./StandardResponseProcessor");
|
|
7
|
+
Object.defineProperty(exports, "StandardResponseProcessor", { enumerable: true, get: function () { return StandardResponseProcessor_1.StandardResponseProcessor; } });
|
|
8
|
+
var AbstractRestClient_1 = require("./AbstractRestClient");
|
|
9
|
+
Object.defineProperty(exports, "AbstractRestClient", { enumerable: true, get: function () { return AbstractRestClient_1.AbstractRestClient; } });
|
|
10
|
+
var ServiceError_1 = require("./ServiceError");
|
|
11
|
+
Object.defineProperty(exports, "ServiceError", { enumerable: true, get: function () { return ServiceError_1.ServiceError; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../main/typescript/Service/index.ts"],"names":[],"mappings":";;;AAEA,uDAAoD;AAA5C,oHAAA,gBAAgB,OAAA;AACxB,yEAAsE;AAA9D,sIAAA,yBAAyB,OAAA;AACjC,2DAAwD;AAAhD,wHAAA,kBAAkB,OAAA;AAC1B,+CAA4C;AAApC,4GAAA,YAAY,OAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "strata.client.core",
|
|
3
|
+
"version": "0.0.0-snapshot.1",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"increment-snapshot": "npm version prerelease",
|
|
7
|
+
"increment-major": "npm version major",
|
|
8
|
+
"increment-minor": "npm version minor",
|
|
9
|
+
"increment-patch": "npm version patch"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"rxjs": "^6.5.5",
|
|
13
|
+
"strata.foundation.core": "^0.0.0-snapshot.17",
|
|
14
|
+
"guid-typescript": "^1.0.9"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
Binary file
|