Skip to content

Commit

Permalink
- playing with client sample
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyFlasher committed Oct 19, 2023
1 parent d449272 commit 15c25bb
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 12 deletions.
2 changes: 2 additions & 0 deletions example/client/view/SignUpView.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {AbstractLitSignUpView} from "../../../src/com/domwires/devkit/client/auth/view/AbstractLitSignUpView";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import globalStyles from "../styles.css";
import {css} from "lit";
import {customElement} from "lit/decorators.js";
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@types/express": "4.17.13",
"axios": "0.27.2",
"cors": "2.8.5",
"domwires": "0.9.125",
"domwires": "0.9.129",
"dotenv": "16.0.3",
"express": "4.18.1",
"minimist": "1.2.6",
Expand All @@ -36,7 +36,7 @@
"@typescript-eslint/eslint-plugin": "5.41.0",
"@typescript-eslint/parser": "5.41.0",
"bootstrap": "5.2.3",
"chai": "4.3.6",
"chai": "4.3.8",
"copyfiles": "2.4.1",
"esbuild": "0.16.7",
"eslint": "8.26.0",
Expand All @@ -45,7 +45,7 @@
"hjson": "3.2.2",
"http-server": "14.1.1",
"lit": "2.5.0",
"mocha": "10.0.0",
"mocha": "10.2.0",
"nodemailer": "6.8.0",
"rimraf": "3.0.2",
"ts-node": "10.9.1",
Expand All @@ -55,7 +55,7 @@
"postcss-modules": "6.0.0"
},
"engines": {
"node": ">=16.17.0"
"node": ">=18.18.0"
},
"scripts": {
"build": "npm run model_gen && npm run eslint-run && npm run test && npm run index_gen && npm run && npm run clean && tsc",
Expand Down
4 changes: 2 additions & 2 deletions src/com/domwires/devkit/client/ClientRefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {definableFromString} from "domwires";
import {AxiosSioNetClientService} from "./common/service/net/impl/AxiosSioNetClientService";
import {LitSignUpMediator} from "./auth/mediator/LitSignUpMediator";
import {decorate, injectable} from "inversify";
import {SignUpView} from "../../../../../example/client/view/SignUpView";
// import {SignUpView} from "../../../../../example/client/view/SignUpView";

decorate(injectable(), EventTarget);

definableFromString<AxiosSioNetClientService>(AxiosSioNetClientService);
definableFromString<LitSignUpMediator>(LitSignUpMediator);
definableFromString<SignUpView>(SignUpView);
// definableFromString<SignUpView>(SignUpView);
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {Types} from "../../../common/Types";
import {inject} from "inversify";
import {IAccountModelContainer} from "../../../common/main/model/IAccountModelContainer";
import {INetClientService, NetClientServiceMessageType} from "../../common/service/net/INetClientService";
import {Class, ICommand, setDefaultImplementation} from "domwires";
import {Class, ICommand, IFactory, setDefaultImplementation} from "domwires";
import {IInputView} from "../../../common/app/view/IInputView";
import {BrowserConsoleInputView} from "../../main/view/BrowserConsoleInputView";
import {registerCommandAlias} from "../../../common/Global";
Expand All @@ -27,6 +27,10 @@ import {UpdateAccountDataCommand} from "../command/req/UpdateAccountDataCommand"
import {UpdateEmailCommand} from "../command/req/UpdateEmailCommand";
import {UpdatePasswordCommand} from "../command/req/UpdatePasswordCommand";
import {DeleteAccountCommand} from "../command/req/DeleteAccountCommand";
import {ISignUpMediator} from "../mediator/ISignUpMediator";
import {LitSignUpMediator} from "../mediator/LitSignUpMediator";
// import {ISignUpView} from "../view/AbstractLitSignUpView";
// import {SignUpView} from "../../../../../../../example/client/view/SignUpView";

export interface IClientAuthContextImmutable extends IAppContextImmutable
{
Expand Down Expand Up @@ -81,6 +85,16 @@ export class ClientAuthContext extends AppContext implements IAppContext
setTimeout(this.ready.bind(this), 100);
}

protected override createFactories(): { contextFactory: IFactory; modelFactory: IFactory; serviceFactory: IFactory; mediatorFactory: IFactory; viewFactory: IFactory }
{
const factories = super.createFactories();

factories.mediatorFactory.mapToType<ISignUpMediator>(Types.ISignUpMediator, LitSignUpMediator);
// factories.viewFactory.mapToType<ISignUpView>(Types.ISignUpView, SignUpView);

return factories;
}

private mapToResponseCommand(responseAction: SocketAction, command: Class<ICommand>): void
{
this.map<SocketResponseActionData>(NetClientServiceMessageType.TCP_RESPONSE, command,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {IHierarchyObject, MessageType} from "domwires";
import {postConstruct} from "inversify";

export class SignUpMediatorMessageType extends MessageType
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {ISignUpMediator} from "./ISignUpMediator";
import {inject, named, postConstruct} from "inversify";
import {Types} from "../../../common/Types";
import {FactoryNames} from "../../../common/FactoryNames";
import {AbstractLitSignUpView, ISignUpView} from "../view/AbstractLitSignUpView";
// import {ISignUpView} from "../view/AbstractLitSignUpView";

// decorate(injectable(), LitElementView);

Expand All @@ -15,9 +15,9 @@ export class LitSignUpMediator extends AbstractHierarchyObject implements ISignU
@postConstruct()
private init():void
{
const view = this.viewFactory.getInstance<ISignUpView>("ISignUpView");
// const view = this.viewFactory.getInstance<ISignUpView>("ISignUpView");
// const view = new LitSignUpView();

document.body.appendChild(view as HTMLElement);
// document.body.appendChild(view as HTMLElement);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {html, LitElement} from "lit";
import {customElement, property} from 'lit/decorators.js';
import {property} from 'lit/decorators.js';

export interface ISignUpView
{
Expand Down
3 changes: 3 additions & 0 deletions src/com/domwires/devkit/common/Types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// import {ISignUpView} from "../client/auth/view/AbstractLitSignUpView";

export class Types
{
public static readonly FactoriesConfig = "FactoriesConfig";
Expand Down Expand Up @@ -81,4 +83,5 @@ export class Types
public static readonly ErrorReason = "ErrorReason";

public static readonly ISignUpMediator = "ISignUpMediator";
public static readonly ISignUpView = "ISignUpView";
}
2 changes: 2 additions & 0 deletions test/ClientAuthContextTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ import {
import {NetServerServiceMessageType} from "../src/com/domwires/devkit/server/common/service/net/INetServerService";
import {Collection} from "../src/com/domwires/devkit/server/common/Collection";
import {MongoDataBaseService} from "../src/com/domwires/devkit/server/common/service/net/db/impl/MongoDataBaseService";
// import {LitSignUpMediator} from "../src/com/domwires/devkit/client/auth/mediator/LitSignUpMediator";
// import {ISignUpMediator} from "../src/com/domwires/devkit/client/auth/mediator/ISignUpMediator";

describe('ClientAuthContextTest', function (this: Suite)
{
Expand Down

0 comments on commit 15c25bb

Please sign in to comment.