taon 19.0.1 → 19.0.3
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/assets/shared/shared_folder_info.txt +3 -3
- package/browser/fesm2022/taon.mjs +32 -2
- package/browser/fesm2022/taon.mjs.map +1 -1
- package/browser/lib/base-classes/base-context.d.ts +3 -3
- package/browser/lib/base-classes/base.d.ts +3 -3
- package/browser/lib/create-context.d.ts +41 -0
- package/browser/lib/endpoint-context.d.ts +7 -1
- package/browser/lib/index.d.ts +26 -0
- package/client/fesm2022/taon.mjs +32 -2
- package/client/fesm2022/taon.mjs.map +1 -1
- package/client/lib/base-classes/base-context.d.ts +3 -3
- package/client/lib/base-classes/base.d.ts +3 -3
- package/client/lib/create-context.d.ts +41 -0
- package/client/lib/endpoint-context.d.ts +7 -1
- package/client/lib/index.d.ts +26 -0
- package/lib/base-classes/base-context.d.ts +3 -3
- package/lib/base-classes/base.d.ts +3 -3
- package/lib/build-info._auto-generated_.d.ts +1 -0
- package/lib/build-info._auto-generated_.js +4 -1
- package/lib/build-info._auto-generated_.js.map +1 -1
- package/lib/create-context.d.ts +41 -0
- package/lib/create-context.js +10 -3
- package/lib/create-context.js.map +1 -1
- package/lib/endpoint-context.d.ts +6 -0
- package/lib/endpoint-context.js +26 -0
- package/lib/endpoint-context.js.map +1 -1
- package/lib/index._auto-generated_.js +2 -2
- package/lib/index._auto-generated_.js.map +1 -1
- package/lib/index.d.ts +26 -0
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib/ui/directives/index.js +2 -2
- package/lib/ui/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
- package/lib/ui/taon-github-fork-me-corner/index.js +2 -2
- package/lib/ui/taon-github-fork-me-ribbon/index.js +2 -2
- package/lib/ui/taon-notifications/taon-notifications.models.js +2 -2
- package/lib/ui/taon-progress-bar/index.js +2 -2
- package/lib/ui/taon-session-passcode/index.js +2 -2
- package/lib/ui/taon-table/index.js +2 -2
- package/package.json +1 -1
- package/src.d.ts +3 -3
- package/tmp-environment.json +4 -3
- package/websql/fesm2022/taon.mjs +29 -2
- package/websql/fesm2022/taon.mjs.map +1 -1
- package/websql/lib/base-classes/base-context.d.ts +3 -3
- package/websql/lib/base-classes/base.d.ts +3 -3
- package/websql/lib/create-context.d.ts +41 -0
- package/websql/lib/endpoint-context.d.ts +6 -0
- package/websql/lib/index.d.ts +26 -0
- package/lib/base-classes/base-subscriber.d.ts +0 -4
- package/lib/base-classes/base-subscriber.js +0 -25
- package/lib/base-classes/base-subscriber.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-abstract-mock.d.ts +0 -10
- package/lib/realtime/realtime-strategy/realtime-abstract-mock.js +0 -214
- package/lib/realtime/realtime-strategy/realtime-abstract-mock.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/index.d.ts +0 -0
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/index.js +0 -5
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/index.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.d.ts +0 -22
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.js +0 -139
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.d.ts +0 -16
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.js +0 -68
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.d.ts +0 -10
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.js +0 -56
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.d.ts +0 -10
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.js +0 -50
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.d.ts +0 -13
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.js +0 -3
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.d.ts +0 -2
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.js +0 -6
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.d.ts +0 -16
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.js +0 -54
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.d.ts +0 -17
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.js +0 -52
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.d.ts +0 -11
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.js +0 -39
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.d.ts +0 -13
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.js +0 -46
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.d.ts +0 -11
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.js +0 -3
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.js.map +0 -1
- package/lib/ui/directives/firedev-inject-html.directive.d.ts +0 -6
- package/lib/ui/directives/firedev-long-press.directive.d.ts +0 -22
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.d.ts +0 -2
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.js +0 -5
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.js.map +0 -1
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.component.d.ts +0 -29
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.module.d.ts +0 -2
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.d.ts +0 -1
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.js +0 -5
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.js.map +0 -1
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/taon-db-admin.component.d.ts +0 -8
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.d.ts +0 -2
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.js +0 -5
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.js.map +0 -1
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.component.d.ts +0 -13
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.module.d.ts +0 -2
- package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.d.ts +0 -5
- package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.js +0 -3
- package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.js.map +0 -1
- package/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.d.ts +0 -14
- package/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.module.d.ts +0 -2
- package/lib/ui/toan-full-material.module.d.ts +0 -2
- package/taon.jsonc +0 -40
|
@@ -9,8 +9,8 @@ declare const BaseContext: {
|
|
|
9
9
|
};
|
|
10
10
|
readonly contexts: CTX;
|
|
11
11
|
readonly contextName: string;
|
|
12
|
-
__ref(): Promise<import("
|
|
13
|
-
readonly __refSync: import("
|
|
12
|
+
__ref(): Promise<import("taon/websql").EndpointContext>;
|
|
13
|
+
readonly __refSync: import("taon/websql").EndpointContext;
|
|
14
14
|
getClassInstance<T>(ctor: new (...args: any[]) => T): T;
|
|
15
15
|
getClass<T>(ctor: new (...args: any[]) => T): new (...args: any[]) => T;
|
|
16
16
|
initialize: (overrideOptions?: {
|
|
@@ -18,7 +18,7 @@ declare const BaseContext: {
|
|
|
18
18
|
overrideRemoteHost?: string;
|
|
19
19
|
onlyMigrationRun?: boolean;
|
|
20
20
|
onlyMigrationRevertToTimestamp?: number;
|
|
21
|
-
}) => Promise<import("
|
|
21
|
+
}) => Promise<import("taon/websql").EndpointContext>;
|
|
22
22
|
readonly realtime: {
|
|
23
23
|
readonly client: import("../realtime/realtime-client").RealtimeClient;
|
|
24
24
|
readonly server: import("../realtime/realtime-server").RealtimeServer;
|
|
@@ -29,8 +29,8 @@ export declare namespace Base {
|
|
|
29
29
|
};
|
|
30
30
|
readonly contexts: CTX;
|
|
31
31
|
readonly contextName: string;
|
|
32
|
-
__ref(): Promise<import("
|
|
33
|
-
readonly __refSync: import("
|
|
32
|
+
__ref(): Promise<import("taon/websql").EndpointContext>;
|
|
33
|
+
readonly __refSync: import("taon/websql").EndpointContext;
|
|
34
34
|
getClassInstance<T>(ctor: new (...args: any[]) => T): T;
|
|
35
35
|
getClass<T>(ctor: new (...args: any[]) => T): new (...args: any[]) => T;
|
|
36
36
|
initialize: (overrideOptions?: {
|
|
@@ -38,7 +38,7 @@ export declare namespace Base {
|
|
|
38
38
|
overrideRemoteHost?: string;
|
|
39
39
|
onlyMigrationRun?: boolean;
|
|
40
40
|
onlyMigrationRevertToTimestamp?: number;
|
|
41
|
-
}) => Promise<import("
|
|
41
|
+
}) => Promise<import("taon/websql").EndpointContext>;
|
|
42
42
|
readonly realtime: {
|
|
43
43
|
readonly client: import("../realtime/realtime-client").RealtimeClient;
|
|
44
44
|
readonly server: import("../realtime/realtime-server").RealtimeServer;
|
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import { EndpointContext } from './endpoint-context';
|
|
3
3
|
import { Models } from './models';
|
|
4
|
+
export declare const createContextTemplate: <CTX extends Record<string, object>, CTRL extends Record<string, new (...args: any[]) => any>, ENTITY extends Record<string, new (...args: any[]) => any>, REPO extends Record<string, new (...args: any[]) => any>, PROVIDER extends Record<string, new (...args: any[]) => any>, SUBSCRIBER extends Record<string, new (...args: any[]) => any>, MIGRATION extends Record<string, new (...args: any[]) => any>>(configFn: (env: any) => Models.ContextOptions<CTX, CTRL, ENTITY, REPO, PROVIDER, SUBSCRIBER, MIGRATION>) => () => {
|
|
5
|
+
types: {
|
|
6
|
+
readonly controllers: CTRL_1;
|
|
7
|
+
readonly repositories: REPO_1;
|
|
8
|
+
readonly providers: PROVIDER_1;
|
|
9
|
+
readonly subscribers: SUBSCRIBER_1;
|
|
10
|
+
readonly migrations: MIGRATION_1;
|
|
11
|
+
};
|
|
12
|
+
readonly contexts: CTX_1;
|
|
13
|
+
readonly contextName: string;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated
|
|
16
|
+
* - get reference to internal context
|
|
17
|
+
*/
|
|
18
|
+
__ref(): Promise<EndpointContext>;
|
|
19
|
+
/**
|
|
20
|
+
* only for internal use
|
|
21
|
+
* @deprecated
|
|
22
|
+
*/
|
|
23
|
+
readonly __refSync: EndpointContext;
|
|
24
|
+
getClassInstance<T>(ctor: new (...args: any[]) => T): T;
|
|
25
|
+
getClass<T>(ctor: new (...args: any[]) => T): new (...args: any[]) => T;
|
|
26
|
+
/**
|
|
27
|
+
* - create controller instances for context
|
|
28
|
+
* - init database (if enable) + migation scripts
|
|
29
|
+
*/
|
|
30
|
+
initialize: (overrideOptions?: {
|
|
31
|
+
overrideHost?: string;
|
|
32
|
+
overrideRemoteHost?: string;
|
|
33
|
+
onlyMigrationRun?: boolean;
|
|
34
|
+
onlyMigrationRevertToTimestamp?: number;
|
|
35
|
+
}) => Promise<EndpointContext>;
|
|
36
|
+
/**
|
|
37
|
+
* realtime communication with server
|
|
38
|
+
* Udp socket.io (or ipc) based.
|
|
39
|
+
*/
|
|
40
|
+
readonly realtime: {
|
|
41
|
+
readonly client: import("./realtime/realtime-client").RealtimeClient;
|
|
42
|
+
readonly server: import("./realtime/realtime-server").RealtimeServer;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
4
45
|
export declare const createContext: <CTX extends Record<string, object>, CTRL extends Record<string, new (...args: any[]) => any>, ENTITY extends Record<string, new (...args: any[]) => any>, REPO extends Record<string, new (...args: any[]) => any>, PROVIDER extends Record<string, new (...args: any[]) => any>, SUBSCRIBER extends Record<string, new (...args: any[]) => any>, MIGRATION extends Record<string, new (...args: any[]) => any>>(configFn: (env: any) => Models.ContextOptions<CTX, CTRL, ENTITY, REPO, PROVIDER, SUBSCRIBER, MIGRATION>) => {
|
|
5
46
|
types: {
|
|
6
47
|
readonly controllers: CTRL;
|
|
@@ -98,6 +98,11 @@ export declare class EndpointContext {
|
|
|
98
98
|
initClasses(): Promise<void>;
|
|
99
99
|
isActiveOn(classInstance: object): boolean;
|
|
100
100
|
get uri(): URL;
|
|
101
|
+
/**
|
|
102
|
+
* Port from uri as number
|
|
103
|
+
* @returns {Number | undefined}
|
|
104
|
+
*/
|
|
105
|
+
get port(): Number | undefined;
|
|
101
106
|
get isHttpServer(): boolean;
|
|
102
107
|
/**
|
|
103
108
|
* ipc/udp needs this
|
|
@@ -113,6 +118,7 @@ export declare class EndpointContext {
|
|
|
113
118
|
get orgin(): string;
|
|
114
119
|
initSubscribers(): Promise<void>;
|
|
115
120
|
initEntities(): Promise<void>;
|
|
121
|
+
destroy(): Promise<void>;
|
|
116
122
|
initDatabaseConnection(): Promise<void>;
|
|
117
123
|
initControllers(): void;
|
|
118
124
|
writeActiveRoutes(): void;
|
package/websql/lib/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import * as endpointContext from './endpoint-context';
|
|
|
14
14
|
import * as allSymbols from './symbols';
|
|
15
15
|
import { NgZone } from '@angular/core';
|
|
16
16
|
export * from './ui';
|
|
17
|
+
export { EndpointContext } from './endpoint-context';
|
|
17
18
|
export { BaseRepository } from './base-classes/base-repository';
|
|
18
19
|
export { BaseController } from './base-classes/base-controller';
|
|
19
20
|
export { BaseProvider } from './base-classes/base-provider';
|
|
@@ -70,6 +71,31 @@ export declare namespace Taon {
|
|
|
70
71
|
readonly server: import("./realtime/realtime-server").RealtimeServer;
|
|
71
72
|
};
|
|
72
73
|
};
|
|
74
|
+
const createContextTemplate: <CTX extends Record<string, object>, CTRL extends Record<string, new (...args: any[]) => any>, ENTITY extends Record<string, new (...args: any[]) => any>, REPO extends Record<string, new (...args: any[]) => any>, PROVIDER extends Record<string, new (...args: any[]) => any>, SUBSCRIBER extends Record<string, new (...args: any[]) => any>, MIGRATION extends Record<string, new (...args: any[]) => any>>(configFn: (env: any) => models.Models.ContextOptions<CTX, CTRL, ENTITY, REPO, PROVIDER, SUBSCRIBER, MIGRATION>) => () => {
|
|
75
|
+
types: {
|
|
76
|
+
readonly controllers: CTRL_1;
|
|
77
|
+
readonly repositories: REPO_1;
|
|
78
|
+
readonly providers: PROVIDER_1;
|
|
79
|
+
readonly subscribers: SUBSCRIBER_1;
|
|
80
|
+
readonly migrations: MIGRATION_1;
|
|
81
|
+
};
|
|
82
|
+
readonly contexts: CTX_1;
|
|
83
|
+
readonly contextName: string;
|
|
84
|
+
__ref(): Promise<endpointContext.EndpointContext>;
|
|
85
|
+
readonly __refSync: endpointContext.EndpointContext;
|
|
86
|
+
getClassInstance<T>(ctor: new (...args: any[]) => T): T;
|
|
87
|
+
getClass<T>(ctor: new (...args: any[]) => T): new (...args: any[]) => T;
|
|
88
|
+
initialize: (overrideOptions?: {
|
|
89
|
+
overrideHost?: string;
|
|
90
|
+
overrideRemoteHost?: string;
|
|
91
|
+
onlyMigrationRun?: boolean;
|
|
92
|
+
onlyMigrationRevertToTimestamp?: number;
|
|
93
|
+
}) => Promise<endpointContext.EndpointContext>;
|
|
94
|
+
readonly realtime: {
|
|
95
|
+
readonly client: import("./realtime/realtime-client").RealtimeClient;
|
|
96
|
+
readonly server: import("./realtime/realtime-server").RealtimeServer;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
73
99
|
const inject: <T>(entity: () => new (...args: any[]) => T) => T;
|
|
74
100
|
const initNgZone: (ngZone: NgZone) => void;
|
|
75
101
|
const symbols: typeof allSymbols.Symbols;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseSubscriber = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var base_injector_1 = require("./base-injector");
|
|
6
|
-
var subscriber_decorator_1 = require("../decorators/classes/subscriber-decorator");
|
|
7
|
-
var BaseSubscriber = /** @class */ (function (_super) {
|
|
8
|
-
tslib_1.__extends(BaseSubscriber, _super);
|
|
9
|
-
function BaseSubscriber() {
|
|
10
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
11
|
-
}
|
|
12
|
-
BaseSubscriber.prototype.__trigger_event__ = function (eventName) {
|
|
13
|
-
var ctx = this.__endpoint_context__;
|
|
14
|
-
console.log('Trigger event', eventName, ctx);
|
|
15
|
-
// ctx.realtimeServer.triggerCustomEvent/
|
|
16
|
-
};
|
|
17
|
-
BaseSubscriber = tslib_1.__decorate([
|
|
18
|
-
(0, subscriber_decorator_1.TaonSubscriber)({
|
|
19
|
-
className: 'BaseSubscriber',
|
|
20
|
-
})
|
|
21
|
-
], BaseSubscriber);
|
|
22
|
-
return BaseSubscriber;
|
|
23
|
-
}(base_injector_1.BaseInjector));
|
|
24
|
-
exports.BaseSubscriber = BaseSubscriber;
|
|
25
|
-
//# sourceMappingURL=base-subscriber.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-subscriber.js","sourceRoot":"","sources":["c:/Users/darek/projects/npm/taon-dev/taon/src/lib/base-classes/base-subscriber.ts"],"names":[],"mappings":";;;;AAWA,iDAA+C;AAC/C,mFAA4E;AAK5E;IAA2D,0CAAY;IAAvE;;IAMA,CAAC;IALW,0CAAiB,GAA3B,UAA4B,SAAuB;QACjD,IAAM,GAAG,GAAG,IAAI,CAAC,oBAAoB,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;QAC7C,yCAAyC;IAC3C,CAAC;IALmB,cAAc;QAHnC,IAAA,qCAAc,EAAC;YACd,SAAS,EAAE,gBAAgB;SAC5B,CAAC;OACoB,cAAc,CAMnC;IAAD,qBAAC;CAAA,AAND,CAA2D,4BAAY,GAMtE;AANqB,wCAAc"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { RealtimeStrategy } from './realtime-strategy';
|
|
2
|
-
/**
|
|
3
|
-
* Purpose:
|
|
4
|
-
* - browser-browser communication mock (in websql mode)
|
|
5
|
-
*/
|
|
6
|
-
export declare class RealtimeAbstractMock extends RealtimeStrategy {
|
|
7
|
-
toString(): string;
|
|
8
|
-
get Server(): any;
|
|
9
|
-
get io(): any;
|
|
10
|
-
}
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// BIG TODO: Implement the following classes and interfaces
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.RealtimeAbstractMock = void 0;
|
|
5
|
-
var tslib_1 = require("tslib");
|
|
6
|
-
var realtime_strategy_1 = require("./realtime-strategy");
|
|
7
|
-
var rxjs_1 = require("rxjs");
|
|
8
|
-
var messagesFromClientToServer = new rxjs_1.Subject();
|
|
9
|
-
var messagesServerToClient = new rxjs_1.Subject();
|
|
10
|
-
//#endregion
|
|
11
|
-
var AbstractServer = /** @class */ (function () {
|
|
12
|
-
function AbstractServer(url) {
|
|
13
|
-
this.url = url;
|
|
14
|
-
this.namespaceByName = new Map();
|
|
15
|
-
AbstractServer.serverByUrl.set(url, this);
|
|
16
|
-
}
|
|
17
|
-
Object.defineProperty(AbstractServer.prototype, "AbstractNamespace", {
|
|
18
|
-
get: function () {
|
|
19
|
-
return AbstractNamespace;
|
|
20
|
-
},
|
|
21
|
-
enumerable: false,
|
|
22
|
-
configurable: true
|
|
23
|
-
});
|
|
24
|
-
AbstractServer.prototype.of = function (namespaceName) {
|
|
25
|
-
if (!this.namespaceByName.has(namespaceName)) {
|
|
26
|
-
this.namespaceByName.set(namespaceName, new this.AbstractNamespace(namespaceName, this.url));
|
|
27
|
-
}
|
|
28
|
-
return this.namespaceByName.get(namespaceName);
|
|
29
|
-
};
|
|
30
|
-
AbstractServer.serverByUrl = new Map();
|
|
31
|
-
return AbstractServer;
|
|
32
|
-
}());
|
|
33
|
-
/**
|
|
34
|
-
* A namespace is a collection of sockets that share a common name.
|
|
35
|
-
* Namespace are on the "server" side, and sockets are on the "client" side.
|
|
36
|
-
*/
|
|
37
|
-
var AbstractNamespace = /** @class */ (function () {
|
|
38
|
-
function AbstractNamespace(
|
|
39
|
-
/**
|
|
40
|
-
* unique namespace name
|
|
41
|
-
*/
|
|
42
|
-
name, url) {
|
|
43
|
-
this.name = name;
|
|
44
|
-
this.url = url;
|
|
45
|
-
this.allNamespaceSockets = [];
|
|
46
|
-
this.socketByRoomName = new Map();
|
|
47
|
-
this.namespaceEventHandlers = new Map();
|
|
48
|
-
this.startListeningServer();
|
|
49
|
-
}
|
|
50
|
-
AbstractNamespace.prototype.handleRawClientMessage = function (msg) {
|
|
51
|
-
var _a;
|
|
52
|
-
var data = msg.data, eventName = msg.eventName, namespace = msg.namespace, url = msg.url, roomName = msg.roomName, client = msg.client;
|
|
53
|
-
if (this.url !== url) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if (this.name !== namespace) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (this.shouldAutomaticHandleEvent(eventName)) {
|
|
60
|
-
this.emit.apply(this, tslib_1.__spreadArray([eventName], tslib_1.__read(data), false));
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
var roomNameFromEvent = this.getRoomNameFromMessage(eventName);
|
|
64
|
-
if (this.isRoomJoinMessage(eventName)) {
|
|
65
|
-
this.socketByRoomName.set(roomNameFromEvent, client);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if (this.isRoomLeaveMessage(eventName)) {
|
|
69
|
-
this.socketByRoomName.delete(roomNameFromEvent);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
var namespaceInstance = this;
|
|
73
|
-
if (namespaceInstance) {
|
|
74
|
-
if (roomName) {
|
|
75
|
-
(_a = namespaceInstance.socketByRoomName
|
|
76
|
-
.get(roomName)) === null || _a === void 0 ? void 0 : _a.emit.apply(_a, tslib_1.__spreadArray([eventName], tslib_1.__read(data), false));
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
namespaceInstance.emit.apply(namespaceInstance, tslib_1.__spreadArray([eventName], tslib_1.__read(data), false));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
AbstractNamespace.prototype.startListeningServer = function () {
|
|
84
|
-
var _this = this;
|
|
85
|
-
messagesFromClientToServer.subscribe(function (data) { return _this.handleRawClientMessage(data); });
|
|
86
|
-
};
|
|
87
|
-
//#region on
|
|
88
|
-
AbstractNamespace.prototype.on = function (eventName, handler) {
|
|
89
|
-
this.namespaceEventHandlers.set(eventName, handler);
|
|
90
|
-
};
|
|
91
|
-
//#endregion
|
|
92
|
-
//#region emit
|
|
93
|
-
AbstractNamespace.prototype.emit = function (eventName) {
|
|
94
|
-
var e_1, _a;
|
|
95
|
-
var _b;
|
|
96
|
-
var args = [];
|
|
97
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
98
|
-
args[_i - 1] = arguments[_i];
|
|
99
|
-
}
|
|
100
|
-
(_b = this.namespaceEventHandlers.get(eventName)) === null || _b === void 0 ? void 0 : _b.apply(void 0, tslib_1.__spreadArray([], tslib_1.__read(args), false));
|
|
101
|
-
try {
|
|
102
|
-
for (var _c = tslib_1.__values(this.allNamespaceSockets), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
103
|
-
var socket = _d.value;
|
|
104
|
-
socket.emit.apply(socket, tslib_1.__spreadArray([eventName], tslib_1.__read(args), false));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
108
|
-
finally {
|
|
109
|
-
try {
|
|
110
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
111
|
-
}
|
|
112
|
-
finally { if (e_1) throw e_1.error; }
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
//#endregion
|
|
116
|
-
AbstractNamespace.prototype.connect = function (socket) {
|
|
117
|
-
this.allNamespaceSockets.push(socket);
|
|
118
|
-
socket.namespaceInstance = this;
|
|
119
|
-
};
|
|
120
|
-
AbstractNamespace.prototype.isRoomJoinMessage = function (eventName) {
|
|
121
|
-
throw new Error('Method not implemented.');
|
|
122
|
-
};
|
|
123
|
-
AbstractNamespace.prototype.isRoomLeaveMessage = function (eventName) {
|
|
124
|
-
throw new Error('Method not implemented.');
|
|
125
|
-
};
|
|
126
|
-
AbstractNamespace.prototype.getRoomNameFromMessage = function (eventName) {
|
|
127
|
-
throw new Error('Method not implemented.');
|
|
128
|
-
};
|
|
129
|
-
AbstractNamespace.prototype.shouldAutomaticHandleEvent = function (event) {
|
|
130
|
-
throw new Error('Method not implemented.');
|
|
131
|
-
};
|
|
132
|
-
return AbstractNamespace;
|
|
133
|
-
}());
|
|
134
|
-
/**
|
|
135
|
-
* Client starts a connection to the server with socket
|
|
136
|
-
*/
|
|
137
|
-
var AbstractSocket = /** @class */ (function () {
|
|
138
|
-
function AbstractSocket(url, opts) {
|
|
139
|
-
this.eventHandlers = new Map();
|
|
140
|
-
// @ts-ignore
|
|
141
|
-
var _a = tslib_1.__read([url, opts.path || '/'], 2), __ = _a[0], namespace = _a[1];
|
|
142
|
-
// console.log({ url, baseUrl, namespace });
|
|
143
|
-
var namespaceName = namespace || '/';
|
|
144
|
-
// Look up the server instance from the registry
|
|
145
|
-
var server = AbstractServer.serverByUrl.get(url);
|
|
146
|
-
if (!server) {
|
|
147
|
-
AbstractServer.serverByUrl.set(url, new AbstractServer(url));
|
|
148
|
-
server = AbstractServer.serverByUrl.get(url);
|
|
149
|
-
}
|
|
150
|
-
var namespaceFromServer = server.of(namespaceName);
|
|
151
|
-
namespaceFromServer.connect(this);
|
|
152
|
-
// TODO: @LAST listen to server messages
|
|
153
|
-
}
|
|
154
|
-
AbstractSocket.prototype.emit = function (eventName) {
|
|
155
|
-
var _a;
|
|
156
|
-
var args = [];
|
|
157
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
158
|
-
args[_i - 1] = arguments[_i];
|
|
159
|
-
}
|
|
160
|
-
(_a = this.eventHandlers.get(eventName)) === null || _a === void 0 ? void 0 : _a.apply(void 0, tslib_1.__spreadArray([], tslib_1.__read(args), false));
|
|
161
|
-
var msg = {
|
|
162
|
-
eventName: Array.isArray(eventName) ? eventName[0] : eventName,
|
|
163
|
-
url: this.namespaceInstance.url,
|
|
164
|
-
namespace: this.namespaceInstance.name,
|
|
165
|
-
roomName: Array.isArray(eventName) ? eventName[1] : void 0,
|
|
166
|
-
data: args,
|
|
167
|
-
client: this,
|
|
168
|
-
};
|
|
169
|
-
messagesFromClientToServer.next(msg);
|
|
170
|
-
};
|
|
171
|
-
AbstractSocket.prototype.on = function (eventName, handler) {
|
|
172
|
-
this.eventHandlers[eventName] = handler;
|
|
173
|
-
};
|
|
174
|
-
AbstractSocket.prototype.off = function (event) {
|
|
175
|
-
this.eventHandlers.delete(event);
|
|
176
|
-
};
|
|
177
|
-
return AbstractSocket;
|
|
178
|
-
}());
|
|
179
|
-
/**
|
|
180
|
-
* Purpose:
|
|
181
|
-
* - browser-browser communication mock (in websql mode)
|
|
182
|
-
*/
|
|
183
|
-
var RealtimeAbstractMock = /** @class */ (function (_super) {
|
|
184
|
-
tslib_1.__extends(RealtimeAbstractMock, _super);
|
|
185
|
-
function RealtimeAbstractMock() {
|
|
186
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
187
|
-
}
|
|
188
|
-
//#region toString
|
|
189
|
-
RealtimeAbstractMock.prototype.toString = function () {
|
|
190
|
-
return 'mock';
|
|
191
|
-
};
|
|
192
|
-
Object.defineProperty(RealtimeAbstractMock.prototype, "Server", {
|
|
193
|
-
//#endregion
|
|
194
|
-
//#region server & io
|
|
195
|
-
get: function () {
|
|
196
|
-
return AbstractServer;
|
|
197
|
-
},
|
|
198
|
-
enumerable: false,
|
|
199
|
-
configurable: true
|
|
200
|
-
});
|
|
201
|
-
Object.defineProperty(RealtimeAbstractMock.prototype, "io", {
|
|
202
|
-
get: function () {
|
|
203
|
-
var clientIo = function (uri, opts) {
|
|
204
|
-
return new AbstractSocket(uri, opts);
|
|
205
|
-
};
|
|
206
|
-
return clientIo;
|
|
207
|
-
},
|
|
208
|
-
enumerable: false,
|
|
209
|
-
configurable: true
|
|
210
|
-
});
|
|
211
|
-
return RealtimeAbstractMock;
|
|
212
|
-
}(realtime_strategy_1.RealtimeStrategy));
|
|
213
|
-
exports.RealtimeAbstractMock = RealtimeAbstractMock;
|
|
214
|
-
//# sourceMappingURL=realtime-abstract-mock.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-abstract-mock.js","sourceRoot":"","sources":["c:/Users/darek/projects/npm/taon-dev/taon/src/lib/realtime/realtime-strategy/realtime-abstract-mock.ts"],"names":[],"mappings":";AAAA,2DAA2D;;;;AAG3D,yDAAuD;AACvD,6BAA+B;AAE/B,IAAM,0BAA0B,GAAG,IAAI,cAAO,EAAoB,CAAC;AACnE,IAAM,sBAAsB,GAAG,IAAI,cAAO,EAAoB,CAAC;AAc/D,YAAY;AAEZ;IAOE,wBAA4B,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;QALvC,oBAAe,GAAG,IAAI,GAAG,EAA6B,CAAC;QAMrD,cAAc,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC5C,CAAC;IAND,sBAAI,6CAAiB;aAArB;YACE,OAAO,iBAAiB,CAAC;QAC3B,CAAC;;;OAAA;IAOD,2BAAE,GAAF,UAAG,aAAqB;QACtB,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;YAC7C,IAAI,CAAC,eAAe,CAAC,GAAG,CACtB,aAAa,EACb,IAAI,IAAI,CAAC,iBAAiB,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG,CAAC,CACpD,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACjD,CAAC;IAnBM,0BAAW,GAAG,IAAI,GAAG,EAA0B,AAApC,CAAqC;IAoBzD,qBAAC;CAAA,AArBD,IAqBC;AAED;;;GAGG;AACH;IAIE;IACE;;OAEG;IACI,IAAY,EACZ,GAAW;QADX,SAAI,GAAJ,IAAI,CAAQ;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,CAAC;;;OAAA;IAEH,2BAAC;AAAD,CAAC,AAtBD,CAA0C,oCAAgB,GAsBzD;AAtBY,oDAAoB"}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["c:/Users/darek/projects/npm/taon-dev/taon/src/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/index.ts"],"names":[],"mappings":";;AAAA,gDAAwC;AAAxC,SAAgB,kBAAkB,KAAK,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as Electron from 'electron';
|
|
2
|
-
export declare class IpcMainNamespace {
|
|
3
|
-
name: string;
|
|
4
|
-
private rooms;
|
|
5
|
-
private listeners;
|
|
6
|
-
constructor(name: string);
|
|
7
|
-
on(event: string, callback: (event: Electron.IpcMainEvent, ...args: any[]) => void): void;
|
|
8
|
-
off(event: string, callback?: (event: Electron.IpcMainEvent, ...args: any[]) => void): void;
|
|
9
|
-
emit(event: string, ...args: any[]): void;
|
|
10
|
-
to(room: string): {
|
|
11
|
-
emit: (event: string, ...args: any[]) => void;
|
|
12
|
-
};
|
|
13
|
-
in(room: string): {
|
|
14
|
-
emit: (event: string, ...args: any[]) => void;
|
|
15
|
-
};
|
|
16
|
-
join(webContents: Electron.WebContents, room: string): void;
|
|
17
|
-
leave(webContents: Electron.WebContents, room: string): void;
|
|
18
|
-
path(): string;
|
|
19
|
-
get nsp(): {
|
|
20
|
-
readonly name: string;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IpcMainNamespace = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
//#region @backend
|
|
6
|
-
var Electron = require("electron");
|
|
7
|
-
var electron_1 = require("electron");
|
|
8
|
-
//#endregion
|
|
9
|
-
var IpcMainNamespace = /** @class */ (function () {
|
|
10
|
-
function IpcMainNamespace(name) {
|
|
11
|
-
this.name = name;
|
|
12
|
-
this.rooms = {};
|
|
13
|
-
this.listeners = {};
|
|
14
|
-
}
|
|
15
|
-
IpcMainNamespace.prototype.on = function (event, callback) {
|
|
16
|
-
//#region @backendFunc
|
|
17
|
-
var listenKey = "(".concat(this.name, ") \"").concat(event, "\"");
|
|
18
|
-
// console.log(`[BACKEND]][IPC][MAIN NAMSEPACE] listenToEvent "${listenKey}"`);
|
|
19
|
-
if (!this.listeners[event]) {
|
|
20
|
-
this.listeners[event] = [];
|
|
21
|
-
}
|
|
22
|
-
this.listeners[event].push(callback);
|
|
23
|
-
electron_1.ipcMain.on(listenKey, callback);
|
|
24
|
-
this.emit(listenKey); // QUICK_FIX
|
|
25
|
-
//#endregion
|
|
26
|
-
};
|
|
27
|
-
IpcMainNamespace.prototype.off = function (event, callback) {
|
|
28
|
-
//#region @backendFunc
|
|
29
|
-
if (!this.listeners[event])
|
|
30
|
-
return;
|
|
31
|
-
if (callback) {
|
|
32
|
-
this.listeners[event] = this.listeners[event].filter(function (listener) { return listener !== callback; });
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
delete this.listeners[event];
|
|
36
|
-
}
|
|
37
|
-
var removeKey = "(".concat(this.name, ") \"").concat(event, "\"");
|
|
38
|
-
// console.log(`[BACKEND]][IPC][MAIN NAMSEPACE] removeKey ${removeKey}`);
|
|
39
|
-
electron_1.ipcMain.removeListener(removeKey, callback);
|
|
40
|
-
//#endregion
|
|
41
|
-
};
|
|
42
|
-
IpcMainNamespace.prototype.emit = function (event) {
|
|
43
|
-
var args = [];
|
|
44
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
45
|
-
args[_i - 1] = arguments[_i];
|
|
46
|
-
}
|
|
47
|
-
//#region @backendFunc
|
|
48
|
-
var sendEventKey = "(".concat(this.name, ") \"").concat(event, "\"");
|
|
49
|
-
// console.log(`[BACKEND]][IPC][MAIN NAMSEPACE] emitEvent "${sendEventKey}"`);
|
|
50
|
-
var allWindows = Electron.BrowserWindow.getAllWindows();
|
|
51
|
-
allWindows.forEach(function (win, index) {
|
|
52
|
-
var _a;
|
|
53
|
-
(_a = win.webContents).send.apply(_a, tslib_1.__spreadArray([sendEventKey], tslib_1.__read(args), false));
|
|
54
|
-
});
|
|
55
|
-
//#endregion
|
|
56
|
-
};
|
|
57
|
-
IpcMainNamespace.prototype.to = function (room) {
|
|
58
|
-
var _this = this;
|
|
59
|
-
return {
|
|
60
|
-
emit: function (event) {
|
|
61
|
-
var args = [];
|
|
62
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
63
|
-
args[_i - 1] = arguments[_i];
|
|
64
|
-
}
|
|
65
|
-
var emitEvent = "(".concat(_this.name, ") \"").concat(event, "\"");
|
|
66
|
-
// console.log(
|
|
67
|
-
// `[BACKEND]][IPC][MAIN NAMSEPACE] emitEvent in room "${room}"` +
|
|
68
|
-
// ` (exited=${!!this.rooms[room]}) "${emitEvent}"`,
|
|
69
|
-
// );
|
|
70
|
-
var allWindows = Electron.BrowserWindow.getAllWindows();
|
|
71
|
-
allWindows.forEach(function (win, index) {
|
|
72
|
-
var _a;
|
|
73
|
-
(_a = win.webContents).send.apply(_a, tslib_1.__spreadArray([emitEvent], tslib_1.__read(args), false));
|
|
74
|
-
});
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
IpcMainNamespace.prototype.in = function (room) {
|
|
79
|
-
var _this = this;
|
|
80
|
-
return {
|
|
81
|
-
emit: function (event) {
|
|
82
|
-
var args = [];
|
|
83
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
84
|
-
args[_i - 1] = arguments[_i];
|
|
85
|
-
}
|
|
86
|
-
// console.log(
|
|
87
|
-
// `[BACKEND]][IPC][MAIN NAMSEPACE] ` +
|
|
88
|
-
// ` emit in room "${room}" "${event}"`,
|
|
89
|
-
// );
|
|
90
|
-
var sendEventKey = "(".concat(_this.name, ") \"").concat(event, "\"");
|
|
91
|
-
var allWindows = Electron.BrowserWindow.getAllWindows();
|
|
92
|
-
allWindows.forEach(function (win, index) {
|
|
93
|
-
var _a;
|
|
94
|
-
(_a = win.webContents).send.apply(_a, tslib_1.__spreadArray([sendEventKey], tslib_1.__read(args), false));
|
|
95
|
-
});
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
IpcMainNamespace.prototype.join = function (webContents, room) {
|
|
100
|
-
if (!this.rooms[room]) {
|
|
101
|
-
this.rooms[room] = new Set();
|
|
102
|
-
}
|
|
103
|
-
this.rooms[room].add(webContents);
|
|
104
|
-
// console.log(
|
|
105
|
-
// `[BACKEND]][IPC][MAIN NAMSEPACE] joinRoom "${room}"`,
|
|
106
|
-
// this.rooms[room].size,
|
|
107
|
-
// );
|
|
108
|
-
};
|
|
109
|
-
IpcMainNamespace.prototype.leave = function (webContents, room) {
|
|
110
|
-
if (this.rooms[room]) {
|
|
111
|
-
this.rooms[room].delete(webContents);
|
|
112
|
-
if (this.rooms[room].size === 0) {
|
|
113
|
-
delete this.rooms[room];
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
// console.log(
|
|
117
|
-
// `[BACKEND]][IPC][MAIN NAMSEPACE] leaveRoom "${room}"`,
|
|
118
|
-
// this.rooms[room] ? this.rooms[room].size : 'no room',
|
|
119
|
-
// );
|
|
120
|
-
};
|
|
121
|
-
IpcMainNamespace.prototype.path = function () {
|
|
122
|
-
return this.name;
|
|
123
|
-
};
|
|
124
|
-
Object.defineProperty(IpcMainNamespace.prototype, "nsp", {
|
|
125
|
-
get: function () {
|
|
126
|
-
var self = this;
|
|
127
|
-
return {
|
|
128
|
-
get name() {
|
|
129
|
-
return self.name;
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
},
|
|
133
|
-
enumerable: false,
|
|
134
|
-
configurable: true
|
|
135
|
-
});
|
|
136
|
-
return IpcMainNamespace;
|
|
137
|
-
}());
|
|
138
|
-
exports.IpcMainNamespace = IpcMainNamespace;
|
|
139
|
-
//# sourceMappingURL=realtime-strategy-ipc-main-namespace.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-strategy-ipc-main-namespace.js","sourceRoot":"","sources":["c:/Users/darek/projects/npm/taon-dev/taon/src/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.ts"],"names":[],"mappings":";;;;AACA,kBAAkB;AAClB,mCAAqC;AACrC,qCAAmC;AACnC,YAAY;AAEZ;IAIE,0BAAmB,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;QAHvB,UAAK,GAAU,EAAE,CAAC;QAClB,cAAS,GAAmB,EAAE,CAAC;IAEL,CAAC;IAEnC,6BAAE,GAAF,UACE,KAAa,EACb,QAAgE;QAEhE,sBAAsB;QACtB,IAAM,SAAS,GAAG,WAAI,IAAI,CAAC,IAAI,iBAAM,KAAK,OAAG,CAAC;QAC9C,+EAA+E;QAC/E,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QAC7B,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrC,kBAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY;QAClC,YAAY;IACd,CAAC;IAED,8BAAG,GAAH,UACE,KAAa,EACb,QAAiE;QAEjE,sBAAsB;QACtB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;YAAE,OAAO;QAEnC,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,CAClD,UAAA,QAAQ,IAAI,O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IAAI,KAAK,CAAC,EAAE,CAAC;gBAChC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QACD,eAAe;QACf,2DAA2D;QAC3D,0DAA0D;QAC1D,KAAK;IACP,CAAC;IAED,+BAAI,GAAJ;QACE,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,sBAAI,iCAAG;aAAP;YACE,IAAM,IAAI,GAAG,IAAI,CAAC;YAClB,OAAO;gBACL,IAAI,IAAI;oBACN,OAAO,IAAI,CAAC,IAAI,CAAC;gBACnB,CAAC;aACF,CAAC;QACJ,CAAC;;;OAAA;IACH,uBAAC;AAAD,CAAC,AAzHD,IAyHC;AAzHY,4CAAgB"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { IpcMainNamespace } from './realtime-strategy-ipc-main-namespace';
|
|
2
|
-
export declare class ioIpcStrategy {
|
|
3
|
-
contextName: string;
|
|
4
|
-
private namespaces;
|
|
5
|
-
constructor(contextName: string);
|
|
6
|
-
of(namespace: string): IpcMainNamespace;
|
|
7
|
-
on(event: string, callback: (event: Electron.IpcMainEvent, ...args: any[]) => void): void;
|
|
8
|
-
emit(event: string, ...args: any[]): void;
|
|
9
|
-
path(): string;
|
|
10
|
-
get nsp(): {
|
|
11
|
-
readonly name: string;
|
|
12
|
-
};
|
|
13
|
-
in(room: string): {
|
|
14
|
-
emit: (event: string, ...args: any[]) => void;
|
|
15
|
-
};
|
|
16
|
-
}
|