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