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