taon 21.0.89 → 21.0.91
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/VERIFIED-BUILD-DATA.jsonc +5 -0
- package/bin/taon +5 -5
- package/bin/taon-debug +5 -5
- package/bin/taon-debug-brk +4 -4
- package/browser/fesm2022/taon-browser.mjs +1097 -1190
- package/browser/fesm2022/taon-browser.mjs.map +1 -1
- package/browser/package.json +1 -1
- package/browser/types/taon-browser.d.ts +261 -256
- package/browser-prod/fesm2022/taon-browser-prod.mjs +1098 -1191
- package/browser-prod/fesm2022/taon-browser-prod.mjs.map +1 -1
- package/browser-prod/package.json +1 -1
- package/browser-prod/types/taon-browser-prod.d.ts +259 -254
- package/icon-menu-taon.svg +15 -15
- package/lib/base-classes/base-context.js +1 -2
- package/lib/base-classes/base-context.js.map +1 -1
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/create-context.js +6 -0
- package/lib/create-context.js.map +1 -1
- package/lib/endpoint-context.d.ts +7 -1
- package/lib/endpoint-context.js +18 -1
- package/lib/endpoint-context.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/realtime/realtime-client.js +20 -9
- package/lib/realtime/realtime-client.js.map +1 -1
- package/lib/realtime/realtime-core.js +9 -4
- package/lib/realtime/realtime-core.js.map +1 -1
- package/lib/realtime/realtime-server.js +8 -2
- package/lib/realtime/realtime-server.js.map +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
- package/lib-prod/base-classes/base-context.js +1 -2
- package/lib-prod/base-classes/base-context.js.map +1 -1
- package/lib-prod/base-classes/base-controller.js.map +1 -1
- package/lib-prod/build-info._auto-generated_.d.ts +1 -1
- package/lib-prod/build-info._auto-generated_.js +1 -1
- package/lib-prod/create-context.js +6 -0
- package/lib-prod/create-context.js.map +1 -1
- package/lib-prod/decorators/http/http-methods-decorators.js.map +1 -1
- package/lib-prod/endpoint-context-storage.js.map +1 -1
- package/lib-prod/endpoint-context.d.ts +7 -1
- package/lib-prod/endpoint-context.js +18 -1
- package/lib-prod/endpoint-context.js.map +1 -1
- package/lib-prod/helpers/class-helpers.js.map +1 -1
- package/lib-prod/index.js.map +1 -1
- package/lib-prod/package.json +1 -1
- package/lib-prod/realtime/realtime-client.js +20 -9
- package/lib-prod/realtime/realtime-client.js.map +1 -1
- package/lib-prod/realtime/realtime-core.js +9 -4
- package/lib-prod/realtime/realtime-core.js.map +1 -1
- package/lib-prod/realtime/realtime-server.js +8 -2
- package/lib-prod/realtime/realtime-server.js.map +1 -1
- package/lib-prod/ui/index.d.ts +1 -1
- package/lib-prod/ui/index.js +1 -1
- package/lib-prod/ui/taon-admin-mode-configuration/index.d.ts +1 -1
- package/lib-prod/ui/taon-admin-mode-configuration/index.js +1 -1
- package/package.json +1 -1
- package/websql/fesm2022/taon-websql.mjs +835 -1024
- package/websql/fesm2022/taon-websql.mjs.map +1 -1
- package/websql/package.json +1 -1
- package/websql/types/taon-websql.d.ts +261 -256
- package/websql-prod/fesm2022/taon-websql-prod.mjs +837 -1025
- package/websql-prod/fesm2022/taon-websql-prod.mjs.map +1 -1
- package/websql-prod/package.json +1 -1
- package/websql-prod/types/taon-websql-prod.d.ts +259 -254
package/browser/package.json
CHANGED
|
@@ -4,12 +4,14 @@ import * as expressType from 'express';
|
|
|
4
4
|
import { Request, Response, Application, RequestHandler } from 'express';
|
|
5
5
|
import { HttpResponse, Ng2RestAxiosRequestConfig, RestResponseWrapper, TaonServerMiddlewareInterceptOptions, TaonClientMiddlewareInterceptOptions, ResponseTypeAxios, HttpResponseError, RestErrorResponseWrapper, ModelValue, EncodeSchema } from 'ng2-rest/browser';
|
|
6
6
|
export { TaonClientMiddlewareInterceptOptions, TaonServerMiddlewareInterceptOptions } from 'ng2-rest/browser';
|
|
7
|
-
import { Server } from 'http';
|
|
7
|
+
import { Server as Server$1 } from 'http';
|
|
8
8
|
import { DataSource, Repository, SaveOptions, DeepPartial, QueryDeepPartialEntity, InsertResult, UpsertOptions, FindOptionsWhere, UpdateResult, FindManyOptions, FindOneOptions, QueryRunner, SelectQueryBuilder, Table, RelationPath, MigrationInterface, EntitySubscriberInterface, InsertEvent, UpdateEvent, RemoveEvent, SoftRemoveEvent, RecoverEvent, TransactionStartEvent, TransactionCommitEvent, TransactionRollbackEvent } from 'taon-typeorm/browser';
|
|
9
9
|
export { AfterInsert, AfterLoad, AfterRecover, AfterRemove, AfterSoftRemove, AfterUpdate, BeforeInsert, BeforeRecover, BeforeRemove, BeforeSoftRemove, BeforeUpdate, Column, Connection, CreateDateColumn, Column as CustomColumn, DeleteDateColumn, Generated, Generated as GeneratedColumn, Index, JoinColumn, JoinTable, ManyToMany, ManyToOne, OneToMany, OneToOne, PrimaryColumn, PrimaryGeneratedColumn, Repository, TreeChildren, TreeParent, UpdateDateColumn, VersionColumn, VirtualColumn } from 'taon-typeorm/browser';
|
|
10
10
|
import { CoreModels } from 'tnp-core/browser';
|
|
11
11
|
import { MySqlQuerySource } from 'taon-type-sql/browser';
|
|
12
12
|
import { Observable, Subscriber } from 'rxjs';
|
|
13
|
+
import { ServerOptions, Server, DefaultEventsMap } from 'socket.io';
|
|
14
|
+
import { io, Socket } from 'socket.io-client';
|
|
13
15
|
import * as i0 from '@angular/core';
|
|
14
16
|
import { InjectionToken, ViewContainerRef, WritableSignal, TemplateRef } from '@angular/core';
|
|
15
17
|
import { AxiosResponse } from 'axios';
|
|
@@ -17,8 +19,6 @@ import * as _ngx_formly_core from '@ngx-formly/core';
|
|
|
17
19
|
import { FieldWrapper, FieldArrayType, FormlyFormBuilder, FormlyFieldConfig } from '@ngx-formly/core';
|
|
18
20
|
import * as Electron from 'electron';
|
|
19
21
|
import { ipcRenderer } from 'electron';
|
|
20
|
-
import { ServerOptions, Server as Server$1, DefaultEventsMap } from 'socket.io';
|
|
21
|
-
import { io, Socket } from 'socket.io-client';
|
|
22
22
|
import { StorSignal } from 'taon-storage/browser';
|
|
23
23
|
import * as multer from 'multer';
|
|
24
24
|
|
|
@@ -634,6 +634,257 @@ declare namespace Models {
|
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
636
|
|
|
637
|
+
declare namespace RealtimeModels {
|
|
638
|
+
type SubsManagerOpt = {
|
|
639
|
+
core: RealtimeCore;
|
|
640
|
+
customEvent: string;
|
|
641
|
+
roomName: string;
|
|
642
|
+
property: string;
|
|
643
|
+
};
|
|
644
|
+
interface ChangeOption {
|
|
645
|
+
/**
|
|
646
|
+
* Specify property name to listen changes on that property only;
|
|
647
|
+
*/
|
|
648
|
+
property?: string;
|
|
649
|
+
/**
|
|
650
|
+
* Override custom event name to listen
|
|
651
|
+
*/
|
|
652
|
+
customEvent?: string;
|
|
653
|
+
/**
|
|
654
|
+
* Value from entity object.
|
|
655
|
+
* Key for this value is usually id or unique key
|
|
656
|
+
* property defined in entity decorator.
|
|
657
|
+
* TODO @LAST IMPLEMENT unique key support
|
|
658
|
+
*/
|
|
659
|
+
idOrUniqValue?: any;
|
|
660
|
+
}
|
|
661
|
+
type EventHandler = (...args: any[]) => void;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* Client for realtime communication
|
|
666
|
+
* you can listen to:
|
|
667
|
+
* - entity changes (any property in table changed)
|
|
668
|
+
* - entity custom property changes (specific property changed)
|
|
669
|
+
* - entity table changes (new instance added, instance removed)
|
|
670
|
+
* - custom events
|
|
671
|
+
*/
|
|
672
|
+
declare class RealtimeClient {
|
|
673
|
+
private core;
|
|
674
|
+
private subsManagers;
|
|
675
|
+
constructor(core: RealtimeCore);
|
|
676
|
+
private init;
|
|
677
|
+
/**
|
|
678
|
+
* Usage:
|
|
679
|
+
* myContext.realtimeClient.listenChangesEntity(myEntityInstance);
|
|
680
|
+
*
|
|
681
|
+
*
|
|
682
|
+
* Changes trigger on backend needs to be done manually.. example code:
|
|
683
|
+
*
|
|
684
|
+
* myContext.realtimeServer.triggerEntityChanges(myEntityInstance);
|
|
685
|
+
* ...
|
|
686
|
+
*/
|
|
687
|
+
listenChangesEntity<RESULT = any>(entityClassFnOrObj: Function | object, options?: RealtimeModels.ChangeOption): Observable<RESULT>;
|
|
688
|
+
/**
|
|
689
|
+
* Listen changes entity table
|
|
690
|
+
* Example: for pagination, lists update ...
|
|
691
|
+
*/
|
|
692
|
+
listenChangesEntityTable<RESULT = any>(entityClassFn: Function): Observable<RESULT>;
|
|
693
|
+
listenChangesCustomEvent<RESULT = any>(customEvent: string): Observable<RESULT>;
|
|
694
|
+
/**
|
|
695
|
+
* Trigger custom event on backend
|
|
696
|
+
* @param customEvent global event name
|
|
697
|
+
* @param dataToPush
|
|
698
|
+
*/
|
|
699
|
+
triggerCustomEvent(customEvent: string, dataToPush?: any): void;
|
|
700
|
+
private getUniqueIdentifierForConnection;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Server for realtime communication
|
|
705
|
+
* you can trigger:
|
|
706
|
+
* - entity changes (any property in table changed)
|
|
707
|
+
* - entity custom property changes (specific property changed)
|
|
708
|
+
* - entity table changes (new instance added, instance removed)
|
|
709
|
+
* - custom events
|
|
710
|
+
*
|
|
711
|
+
* and also listen to:
|
|
712
|
+
* - custom events from yourself
|
|
713
|
+
*/
|
|
714
|
+
declare class RealtimeServer {
|
|
715
|
+
private core;
|
|
716
|
+
constructor(core: RealtimeCore);
|
|
717
|
+
private init;
|
|
718
|
+
private triggerChanges;
|
|
719
|
+
triggerEntityChanges(entityObjOrClass: Function | object,
|
|
720
|
+
/**
|
|
721
|
+
* value of unique key property of entity instance
|
|
722
|
+
* (this value is not needed if entityObjOrClass is instance of entity)
|
|
723
|
+
*/
|
|
724
|
+
idToTrigger?: number | string): void;
|
|
725
|
+
triggerEntityPropertyChanges(entityObjOrClass: Function | object,
|
|
726
|
+
/**
|
|
727
|
+
* property name or array of property names that changed
|
|
728
|
+
* for entity instance
|
|
729
|
+
*/
|
|
730
|
+
property: string | string[],
|
|
731
|
+
/**
|
|
732
|
+
* value of unique key property of entity instance
|
|
733
|
+
* (this value is not needed if entityObjOrClass is instance of entity)
|
|
734
|
+
*/
|
|
735
|
+
idToTrigger?: number | string): void;
|
|
736
|
+
triggerEntityTableChanges(entityClassOrInstance: Function | object): void;
|
|
737
|
+
triggerCustomEvent(customEvent: string, dataToPush: any): void;
|
|
738
|
+
/**
|
|
739
|
+
* Listen to custom events from users
|
|
740
|
+
* @param customEvent global event name
|
|
741
|
+
*/
|
|
742
|
+
listenChangesCustomEvent(customEvent: string): Observable<any>;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
declare abstract class RealtimeStrategy {
|
|
746
|
+
protected ctx: EndpointContext;
|
|
747
|
+
constructor(ctx: EndpointContext);
|
|
748
|
+
get ioClient(): typeof io;
|
|
749
|
+
ioServer(url: string, opt: ServerOptions): Server<DefaultEventsMap, DefaultEventsMap, DefaultEventsMap, any>;
|
|
750
|
+
abstract toString(): string;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
declare class MockServerIpc {
|
|
754
|
+
contextName: string;
|
|
755
|
+
static serverByContextName: Map<string, MockServerIpc>;
|
|
756
|
+
static from(contextName: string): MockServerIpc;
|
|
757
|
+
namespacesByName: Map<string, MockNamespaceIpc>;
|
|
758
|
+
constructor(contextName: string);
|
|
759
|
+
of(namespace: string): MockNamespaceIpc;
|
|
760
|
+
}
|
|
761
|
+
declare class MockNamespaceIpc {
|
|
762
|
+
/**
|
|
763
|
+
* Namespace name
|
|
764
|
+
*/
|
|
765
|
+
name: string;
|
|
766
|
+
server: MockServerIpc;
|
|
767
|
+
electronClients: Set<Electron.WebContents>;
|
|
768
|
+
roomsByRoomName: {
|
|
769
|
+
[roomName: string]: Set<Electron.WebContents>;
|
|
770
|
+
};
|
|
771
|
+
private namespaceEventHandlers;
|
|
772
|
+
constructor(
|
|
773
|
+
/**
|
|
774
|
+
* Namespace name
|
|
775
|
+
*/
|
|
776
|
+
name: string, server: MockServerIpc);
|
|
777
|
+
on(eventName: string, callback: RealtimeModels.EventHandler): any;
|
|
778
|
+
off(event: string, callback?: RealtimeModels.EventHandler): any;
|
|
779
|
+
emit(eventName: string, ...args: any[]): any;
|
|
780
|
+
to(roomName: string): RoomEmitterIpc;
|
|
781
|
+
in(roomName: string): RoomEmitterIpc;
|
|
782
|
+
join(webContents: Electron.WebContents, roomName: string): void;
|
|
783
|
+
leave(webContents: Electron.WebContents, roomName: string): void;
|
|
784
|
+
path(): string;
|
|
785
|
+
get nsp(): {
|
|
786
|
+
readonly name: string;
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
declare class RoomEmitterIpc {
|
|
790
|
+
private electronClients;
|
|
791
|
+
/**
|
|
792
|
+
* namespace name
|
|
793
|
+
*/
|
|
794
|
+
private name;
|
|
795
|
+
private includeSender;
|
|
796
|
+
private sender;
|
|
797
|
+
constructor(electronClients: Set<Electron.WebContents>,
|
|
798
|
+
/**
|
|
799
|
+
* namespace name
|
|
800
|
+
*/
|
|
801
|
+
name: string, includeSender?: boolean, sender?: MockSocketIpc);
|
|
802
|
+
emit(eventName: string, ...args: any[]): void;
|
|
803
|
+
}
|
|
804
|
+
declare class MockSocketIpc {
|
|
805
|
+
namespaceName: string;
|
|
806
|
+
ipcRenderer: typeof ipcRenderer;
|
|
807
|
+
private socketEventHandlers;
|
|
808
|
+
get name(): string;
|
|
809
|
+
/**
|
|
810
|
+
* @param namespaceName instead url for ipc
|
|
811
|
+
*/
|
|
812
|
+
constructor(namespaceName: string);
|
|
813
|
+
on(eventName: string, callback: (event: any, ...args: any[]) => void): void;
|
|
814
|
+
off(event: string, callback?: (event: any, ...args: any[]) => void): void;
|
|
815
|
+
emit(event: string, ...args: any[]): void;
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Purpose:
|
|
819
|
+
* - backend-browser communication between 2 processes in electron mode
|
|
820
|
+
*/
|
|
821
|
+
declare class RealtimeStrategyIpc extends RealtimeStrategy {
|
|
822
|
+
protected ctx: EndpointContext;
|
|
823
|
+
toString(): string;
|
|
824
|
+
constructor(ctx: EndpointContext);
|
|
825
|
+
ioServer(__: string, opt: ServerOptions): any;
|
|
826
|
+
get ioClient(): any;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* Purpose:
|
|
831
|
+
* - browser-browser communication mock (in websql mode)
|
|
832
|
+
*/
|
|
833
|
+
declare class RealtimeStrategyMock extends RealtimeStrategy {
|
|
834
|
+
protected ctx: EndpointContext;
|
|
835
|
+
toString(): string;
|
|
836
|
+
constructor(ctx: EndpointContext);
|
|
837
|
+
ioServer(url: string, opt: ServerOptions): any;
|
|
838
|
+
get ioClient(): any;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Purpose:
|
|
843
|
+
* - backend-browser communication
|
|
844
|
+
* - backend-backend communication
|
|
845
|
+
*/
|
|
846
|
+
declare class RealtimeStrategySocketIO extends RealtimeStrategy {
|
|
847
|
+
protected ctx: EndpointContext;
|
|
848
|
+
toString(): string;
|
|
849
|
+
constructor(ctx: EndpointContext);
|
|
850
|
+
ioServer(...args: any[]): any;
|
|
851
|
+
get ioClient(): typeof io;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* Realtime class
|
|
856
|
+
* - mock (when browser-browser)
|
|
857
|
+
* - sockets (from socket io when backend-browser)
|
|
858
|
+
* - ipc (when electron is used or between processes)
|
|
859
|
+
* - webworker (when webworker is used in browser or nodejs)
|
|
860
|
+
*/
|
|
861
|
+
declare class RealtimeCore {
|
|
862
|
+
ctx: EndpointContext;
|
|
863
|
+
readonly allHttpMethods: string[];
|
|
864
|
+
readonly client: RealtimeClient;
|
|
865
|
+
readonly server: RealtimeServer;
|
|
866
|
+
readonly strategy: RealtimeStrategy;
|
|
867
|
+
/**
|
|
868
|
+
* global FE socket - only for established connection
|
|
869
|
+
*/
|
|
870
|
+
conectSocketFE: Socket<DefaultEventsMap, DefaultEventsMap>;
|
|
871
|
+
/**
|
|
872
|
+
* socket for namespaces and rooms
|
|
873
|
+
*/
|
|
874
|
+
socketFE: Socket<DefaultEventsMap, DefaultEventsMap>;
|
|
875
|
+
/**
|
|
876
|
+
* global BE socket - only for established connection
|
|
877
|
+
*/
|
|
878
|
+
connectSocketBE: Server<DefaultEventsMap, DefaultEventsMap, DefaultEventsMap, any>;
|
|
879
|
+
/**
|
|
880
|
+
* socket for namespaces and rooms
|
|
881
|
+
*/
|
|
882
|
+
socketBE: Server<DefaultEventsMap, DefaultEventsMap, DefaultEventsMap, any>;
|
|
883
|
+
constructor(ctx: EndpointContext);
|
|
884
|
+
private resolveStrategy;
|
|
885
|
+
pathFor(namespace?: string): URL;
|
|
886
|
+
}
|
|
887
|
+
|
|
637
888
|
declare class EndpointContext {
|
|
638
889
|
private originalConfig;
|
|
639
890
|
private configFn;
|
|
@@ -672,7 +923,7 @@ declare class EndpointContext {
|
|
|
672
923
|
private injectableTypesfromContexts;
|
|
673
924
|
private allTypesfromContexts;
|
|
674
925
|
expressApp: Application;
|
|
675
|
-
serverTcpUdp: Server;
|
|
926
|
+
serverTcpUdp: Server$1;
|
|
676
927
|
databaseConfig?: Models.DatabaseConfigTypeOrm;
|
|
677
928
|
mode: Models.FrameworkMode;
|
|
678
929
|
readonly onlyMigrationRun?: boolean;
|
|
@@ -681,7 +932,9 @@ declare class EndpointContext {
|
|
|
681
932
|
session?: Models.ISession;
|
|
682
933
|
connection: DataSource;
|
|
683
934
|
private entitiesTriggers;
|
|
684
|
-
private
|
|
935
|
+
private _realtime;
|
|
936
|
+
get realtime(): RealtimeCore;
|
|
937
|
+
set realtime(v: RealtimeCore);
|
|
685
938
|
get realtimeClient(): taon_browser.RealtimeClient;
|
|
686
939
|
get realtimeServer(): taon_browser.RealtimeServer;
|
|
687
940
|
/**
|
|
@@ -799,6 +1052,9 @@ declare class EndpointContext {
|
|
|
799
1052
|
get isProductionMode(): boolean;
|
|
800
1053
|
get host(): string | undefined;
|
|
801
1054
|
get origin(): string | undefined;
|
|
1055
|
+
/**
|
|
1056
|
+
* init typeorm subscribers
|
|
1057
|
+
*/
|
|
802
1058
|
initSubscribers(): Promise<any>;
|
|
803
1059
|
initEntities(): Promise<void>;
|
|
804
1060
|
destroy(): Promise<void>;
|
|
@@ -1646,257 +1902,6 @@ declare const SimpleJsonColumn: () => PropertyDecorator;
|
|
|
1646
1902
|
declare const BooleanColumn: (defaultValue: boolean | null) => PropertyDecorator;
|
|
1647
1903
|
declare const DateTimeColumn: (defaultValue?: boolean | null) => PropertyDecorator;
|
|
1648
1904
|
|
|
1649
|
-
/**
|
|
1650
|
-
* Server for realtime communication
|
|
1651
|
-
* you can trigger:
|
|
1652
|
-
* - entity changes (any property in table changed)
|
|
1653
|
-
* - entity custom property changes (specific property changed)
|
|
1654
|
-
* - entity table changes (new instance added, instance removed)
|
|
1655
|
-
* - custom events
|
|
1656
|
-
*
|
|
1657
|
-
* and also listen to:
|
|
1658
|
-
* - custom events from yourself
|
|
1659
|
-
*/
|
|
1660
|
-
declare class RealtimeServer {
|
|
1661
|
-
private core;
|
|
1662
|
-
constructor(core: RealtimeCore);
|
|
1663
|
-
private init;
|
|
1664
|
-
private triggerChanges;
|
|
1665
|
-
triggerEntityChanges(entityObjOrClass: Function | object,
|
|
1666
|
-
/**
|
|
1667
|
-
* value of unique key property of entity instance
|
|
1668
|
-
* (this value is not needed if entityObjOrClass is instance of entity)
|
|
1669
|
-
*/
|
|
1670
|
-
idToTrigger?: number | string): void;
|
|
1671
|
-
triggerEntityPropertyChanges(entityObjOrClass: Function | object,
|
|
1672
|
-
/**
|
|
1673
|
-
* property name or array of property names that changed
|
|
1674
|
-
* for entity instance
|
|
1675
|
-
*/
|
|
1676
|
-
property: string | string[],
|
|
1677
|
-
/**
|
|
1678
|
-
* value of unique key property of entity instance
|
|
1679
|
-
* (this value is not needed if entityObjOrClass is instance of entity)
|
|
1680
|
-
*/
|
|
1681
|
-
idToTrigger?: number | string): void;
|
|
1682
|
-
triggerEntityTableChanges(entityClassOrInstance: Function | object): void;
|
|
1683
|
-
triggerCustomEvent(customEvent: string, dataToPush: any): void;
|
|
1684
|
-
/**
|
|
1685
|
-
* Listen to custom events from users
|
|
1686
|
-
* @param customEvent global event name
|
|
1687
|
-
*/
|
|
1688
|
-
listenChangesCustomEvent(customEvent: string): Observable<any>;
|
|
1689
|
-
}
|
|
1690
|
-
|
|
1691
|
-
declare abstract class RealtimeStrategy {
|
|
1692
|
-
protected ctx: EndpointContext;
|
|
1693
|
-
constructor(ctx: EndpointContext);
|
|
1694
|
-
get ioClient(): typeof io;
|
|
1695
|
-
ioServer(url: string, opt: ServerOptions): Server$1<DefaultEventsMap, DefaultEventsMap, DefaultEventsMap, any>;
|
|
1696
|
-
abstract toString(): string;
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
declare namespace RealtimeModels {
|
|
1700
|
-
type SubsManagerOpt = {
|
|
1701
|
-
core: RealtimeCore;
|
|
1702
|
-
customEvent: string;
|
|
1703
|
-
roomName: string;
|
|
1704
|
-
property: string;
|
|
1705
|
-
};
|
|
1706
|
-
interface ChangeOption {
|
|
1707
|
-
/**
|
|
1708
|
-
* Specify property name to listen changes on that property only;
|
|
1709
|
-
*/
|
|
1710
|
-
property?: string;
|
|
1711
|
-
/**
|
|
1712
|
-
* Override custom event name to listen
|
|
1713
|
-
*/
|
|
1714
|
-
customEvent?: string;
|
|
1715
|
-
/**
|
|
1716
|
-
* Value from entity object.
|
|
1717
|
-
* Key for this value is usually id or unique key
|
|
1718
|
-
* property defined in entity decorator.
|
|
1719
|
-
* TODO @LAST IMPLEMENT unique key support
|
|
1720
|
-
*/
|
|
1721
|
-
idOrUniqValue?: any;
|
|
1722
|
-
}
|
|
1723
|
-
type EventHandler = (...args: any[]) => void;
|
|
1724
|
-
}
|
|
1725
|
-
|
|
1726
|
-
declare class MockServerIpc {
|
|
1727
|
-
contextName: string;
|
|
1728
|
-
static serverByContextName: Map<string, MockServerIpc>;
|
|
1729
|
-
static from(contextName: string): MockServerIpc;
|
|
1730
|
-
namespacesByName: Map<string, MockNamespaceIpc>;
|
|
1731
|
-
constructor(contextName: string);
|
|
1732
|
-
of(namespace: string): MockNamespaceIpc;
|
|
1733
|
-
}
|
|
1734
|
-
declare class MockNamespaceIpc {
|
|
1735
|
-
/**
|
|
1736
|
-
* Namespace name
|
|
1737
|
-
*/
|
|
1738
|
-
name: string;
|
|
1739
|
-
server: MockServerIpc;
|
|
1740
|
-
electronClients: Set<Electron.WebContents>;
|
|
1741
|
-
roomsByRoomName: {
|
|
1742
|
-
[roomName: string]: Set<Electron.WebContents>;
|
|
1743
|
-
};
|
|
1744
|
-
private namespaceEventHandlers;
|
|
1745
|
-
constructor(
|
|
1746
|
-
/**
|
|
1747
|
-
* Namespace name
|
|
1748
|
-
*/
|
|
1749
|
-
name: string, server: MockServerIpc);
|
|
1750
|
-
on(eventName: string, callback: RealtimeModels.EventHandler): any;
|
|
1751
|
-
off(event: string, callback?: RealtimeModels.EventHandler): any;
|
|
1752
|
-
emit(eventName: string, ...args: any[]): any;
|
|
1753
|
-
to(roomName: string): RoomEmitterIpc;
|
|
1754
|
-
in(roomName: string): RoomEmitterIpc;
|
|
1755
|
-
join(webContents: Electron.WebContents, roomName: string): void;
|
|
1756
|
-
leave(webContents: Electron.WebContents, roomName: string): void;
|
|
1757
|
-
path(): string;
|
|
1758
|
-
get nsp(): {
|
|
1759
|
-
readonly name: string;
|
|
1760
|
-
};
|
|
1761
|
-
}
|
|
1762
|
-
declare class RoomEmitterIpc {
|
|
1763
|
-
private electronClients;
|
|
1764
|
-
/**
|
|
1765
|
-
* namespace name
|
|
1766
|
-
*/
|
|
1767
|
-
private name;
|
|
1768
|
-
private includeSender;
|
|
1769
|
-
private sender;
|
|
1770
|
-
constructor(electronClients: Set<Electron.WebContents>,
|
|
1771
|
-
/**
|
|
1772
|
-
* namespace name
|
|
1773
|
-
*/
|
|
1774
|
-
name: string, includeSender?: boolean, sender?: MockSocketIpc);
|
|
1775
|
-
emit(eventName: string, ...args: any[]): void;
|
|
1776
|
-
}
|
|
1777
|
-
declare class MockSocketIpc {
|
|
1778
|
-
namespaceName: string;
|
|
1779
|
-
ipcRenderer: typeof ipcRenderer;
|
|
1780
|
-
private socketEventHandlers;
|
|
1781
|
-
get name(): string;
|
|
1782
|
-
/**
|
|
1783
|
-
* @param namespaceName instead url for ipc
|
|
1784
|
-
*/
|
|
1785
|
-
constructor(namespaceName: string);
|
|
1786
|
-
on(eventName: string, callback: (event: any, ...args: any[]) => void): void;
|
|
1787
|
-
off(event: string, callback?: (event: any, ...args: any[]) => void): void;
|
|
1788
|
-
emit(event: string, ...args: any[]): void;
|
|
1789
|
-
}
|
|
1790
|
-
/**
|
|
1791
|
-
* Purpose:
|
|
1792
|
-
* - backend-browser communication between 2 processes in electron mode
|
|
1793
|
-
*/
|
|
1794
|
-
declare class RealtimeStrategyIpc extends RealtimeStrategy {
|
|
1795
|
-
protected ctx: EndpointContext;
|
|
1796
|
-
toString(): string;
|
|
1797
|
-
constructor(ctx: EndpointContext);
|
|
1798
|
-
ioServer(__: string, opt: ServerOptions): any;
|
|
1799
|
-
get ioClient(): any;
|
|
1800
|
-
}
|
|
1801
|
-
|
|
1802
|
-
/**
|
|
1803
|
-
* Purpose:
|
|
1804
|
-
* - browser-browser communication mock (in websql mode)
|
|
1805
|
-
*/
|
|
1806
|
-
declare class RealtimeStrategyMock extends RealtimeStrategy {
|
|
1807
|
-
protected ctx: EndpointContext;
|
|
1808
|
-
toString(): string;
|
|
1809
|
-
constructor(ctx: EndpointContext);
|
|
1810
|
-
ioServer(url: string, opt: ServerOptions): any;
|
|
1811
|
-
get ioClient(): any;
|
|
1812
|
-
}
|
|
1813
|
-
|
|
1814
|
-
/**
|
|
1815
|
-
* Purpose:
|
|
1816
|
-
* - backend-browser communication
|
|
1817
|
-
* - backend-backend communication
|
|
1818
|
-
*/
|
|
1819
|
-
declare class RealtimeStrategySocketIO extends RealtimeStrategy {
|
|
1820
|
-
protected ctx: EndpointContext;
|
|
1821
|
-
toString(): string;
|
|
1822
|
-
constructor(ctx: EndpointContext);
|
|
1823
|
-
ioServer(...args: any[]): any;
|
|
1824
|
-
get ioClient(): typeof io;
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
|
-
/**
|
|
1828
|
-
* Realtime class
|
|
1829
|
-
* - mock (when browser-browser)
|
|
1830
|
-
* - sockets (from socket io when backend-browser)
|
|
1831
|
-
* - ipc (when electron is used or between processes)
|
|
1832
|
-
* - webworker (when webworker is used in browser or nodejs)
|
|
1833
|
-
*/
|
|
1834
|
-
declare class RealtimeCore {
|
|
1835
|
-
ctx: EndpointContext;
|
|
1836
|
-
readonly allHttpMethods: string[];
|
|
1837
|
-
readonly client: RealtimeClient;
|
|
1838
|
-
readonly server: RealtimeServer;
|
|
1839
|
-
readonly strategy: RealtimeStrategy;
|
|
1840
|
-
/**
|
|
1841
|
-
* global FE socket - only for established connection
|
|
1842
|
-
*/
|
|
1843
|
-
conectSocketFE: Socket<DefaultEventsMap, DefaultEventsMap>;
|
|
1844
|
-
/**
|
|
1845
|
-
* socket for namespaces and rooms
|
|
1846
|
-
*/
|
|
1847
|
-
socketFE: Socket<DefaultEventsMap, DefaultEventsMap>;
|
|
1848
|
-
/**
|
|
1849
|
-
* global BE socket - only for established connection
|
|
1850
|
-
*/
|
|
1851
|
-
connectSocketBE: Server$1<DefaultEventsMap, DefaultEventsMap, DefaultEventsMap, any>;
|
|
1852
|
-
/**
|
|
1853
|
-
* socket for namespaces and rooms
|
|
1854
|
-
*/
|
|
1855
|
-
socketBE: Server$1<DefaultEventsMap, DefaultEventsMap, DefaultEventsMap, any>;
|
|
1856
|
-
constructor(ctx: EndpointContext);
|
|
1857
|
-
private resolveStrategy;
|
|
1858
|
-
pathFor(namespace?: string): URL;
|
|
1859
|
-
}
|
|
1860
|
-
|
|
1861
|
-
/**
|
|
1862
|
-
* Client for realtime communication
|
|
1863
|
-
* you can listen to:
|
|
1864
|
-
* - entity changes (any property in table changed)
|
|
1865
|
-
* - entity custom property changes (specific property changed)
|
|
1866
|
-
* - entity table changes (new instance added, instance removed)
|
|
1867
|
-
* - custom events
|
|
1868
|
-
*/
|
|
1869
|
-
declare class RealtimeClient {
|
|
1870
|
-
private core;
|
|
1871
|
-
private subsManagers;
|
|
1872
|
-
constructor(core: RealtimeCore);
|
|
1873
|
-
private init;
|
|
1874
|
-
/**
|
|
1875
|
-
* Usage:
|
|
1876
|
-
* myContext.realtimeClient.listenChangesEntity(myEntityInstance);
|
|
1877
|
-
*
|
|
1878
|
-
*
|
|
1879
|
-
* Changes trigger on backend needs to be done manually.. example code:
|
|
1880
|
-
*
|
|
1881
|
-
* myContext.realtimeServer.triggerEntityChanges(myEntityInstance);
|
|
1882
|
-
* ...
|
|
1883
|
-
*/
|
|
1884
|
-
listenChangesEntity<RESULT = any>(entityClassFnOrObj: Function | object, options?: RealtimeModels.ChangeOption): Observable<RESULT>;
|
|
1885
|
-
/**
|
|
1886
|
-
* Listen changes entity table
|
|
1887
|
-
* Example: for pagination, lists update ...
|
|
1888
|
-
*/
|
|
1889
|
-
listenChangesEntityTable<RESULT = any>(entityClassFn: Function): Observable<RESULT>;
|
|
1890
|
-
listenChangesCustomEvent<RESULT = any>(customEvent: string): Observable<RESULT>;
|
|
1891
|
-
/**
|
|
1892
|
-
* Trigger custom event on backend
|
|
1893
|
-
* @param customEvent global event name
|
|
1894
|
-
* @param dataToPush
|
|
1895
|
-
*/
|
|
1896
|
-
triggerCustomEvent(customEvent: string, dataToPush?: any): void;
|
|
1897
|
-
private getUniqueIdentifierForConnection;
|
|
1898
|
-
}
|
|
1899
|
-
|
|
1900
1905
|
declare class RealtimeSubsManager {
|
|
1901
1906
|
private options;
|
|
1902
1907
|
private isListening;
|