taon 18.0.15 → 18.0.18
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/README.md +6 -3
- package/assets/shared/shared_folder_info.txt +1 -1
- package/browser/esm2022/lib/base-classes/base-subscriber-for-entity.mjs +39 -20
- package/browser/esm2022/lib/base-classes/base.mjs +1 -3
- package/browser/esm2022/lib/create-context.mjs +20 -1
- package/browser/esm2022/lib/decorators/classes/subscriber-decorator.mjs +3 -29
- package/browser/esm2022/lib/endpoint-context.mjs +10 -136
- package/browser/esm2022/lib/entity-process.mjs +3 -3
- package/browser/esm2022/lib/helpers/class-helpers.mjs +2 -2
- package/browser/esm2022/lib/index.mjs +1 -14
- package/browser/esm2022/lib/inject.mjs +4 -38
- package/browser/esm2022/lib/models.mjs +1 -1
- package/browser/esm2022/lib/realtime/realtime-client.mjs +32 -20
- package/browser/esm2022/lib/realtime/realtime-core.mjs +15 -7
- package/browser/esm2022/lib/realtime/realtime-server.mjs +34 -16
- package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc.mjs +198 -29
- package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock.mjs +206 -10
- package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-socket-io.mjs +3 -7
- package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy.mjs +6 -2
- package/browser/esm2022/lib/realtime/realtime-subs-manager.mjs +10 -8
- package/browser/esm2022/lib/realtime/realtime.models.mjs +1 -1
- package/browser/esm2022/lib/symbols.mjs +45 -38
- package/browser/fesm2022/taon.mjs +557 -559
- package/browser/fesm2022/taon.mjs.map +1 -1
- package/browser/lib/base-classes/base-context.d.ts +4 -0
- package/browser/lib/base-classes/base.d.ts +4 -2
- package/browser/lib/create-context.d.ts +13 -0
- package/browser/lib/decorators/classes/subscriber-decorator.d.ts +2 -2
- package/browser/lib/helpers/class-helpers.d.ts +1 -1
- package/browser/lib/index.d.ts +12 -13
- package/browser/lib/inject.d.ts +1 -8
- package/browser/lib/models.d.ts +17 -9
- package/browser/lib/realtime/realtime-client.d.ts +8 -2
- package/browser/lib/realtime/realtime-core.d.ts +6 -6
- package/browser/lib/realtime/realtime-server.d.ts +9 -4
- package/browser/lib/realtime/realtime-strategy/realtime-strategy-ipc.d.ts +71 -12
- package/browser/lib/realtime/realtime-strategy/realtime-strategy-mock.d.ts +4 -4
- package/browser/lib/realtime/realtime-strategy/realtime-strategy-socket-io.d.ts +2 -3
- package/browser/lib/realtime/realtime-strategy/realtime-strategy.d.ts +4 -5
- package/browser/lib/realtime/realtime.models.d.ts +1 -0
- package/browser/lib/symbols.d.ts +30 -36
- package/client/esm2022/lib/base-classes/base-subscriber-for-entity.mjs +39 -20
- package/client/esm2022/lib/base-classes/base.mjs +1 -3
- package/client/esm2022/lib/create-context.mjs +20 -1
- package/client/esm2022/lib/decorators/classes/subscriber-decorator.mjs +3 -29
- package/client/esm2022/lib/endpoint-context.mjs +10 -136
- package/client/esm2022/lib/entity-process.mjs +3 -3
- package/client/esm2022/lib/helpers/class-helpers.mjs +2 -2
- package/client/esm2022/lib/index.mjs +1 -14
- package/client/esm2022/lib/inject.mjs +4 -38
- package/client/esm2022/lib/models.mjs +1 -1
- package/client/esm2022/lib/realtime/realtime-client.mjs +32 -20
- package/client/esm2022/lib/realtime/realtime-core.mjs +15 -7
- package/client/esm2022/lib/realtime/realtime-server.mjs +34 -16
- package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc.mjs +198 -29
- package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock.mjs +206 -10
- package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-socket-io.mjs +3 -7
- package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy.mjs +6 -2
- package/client/esm2022/lib/realtime/realtime-subs-manager.mjs +10 -8
- package/client/esm2022/lib/realtime/realtime.models.mjs +1 -1
- package/client/esm2022/lib/symbols.mjs +45 -38
- package/client/fesm2022/taon.mjs +557 -559
- package/client/fesm2022/taon.mjs.map +1 -1
- package/client/lib/base-classes/base-context.d.ts +4 -0
- package/client/lib/base-classes/base.d.ts +4 -2
- package/client/lib/create-context.d.ts +13 -0
- package/client/lib/decorators/classes/subscriber-decorator.d.ts +2 -2
- package/client/lib/helpers/class-helpers.d.ts +1 -1
- package/client/lib/index.d.ts +12 -13
- package/client/lib/inject.d.ts +1 -8
- package/client/lib/models.d.ts +17 -9
- package/client/lib/realtime/realtime-client.d.ts +8 -2
- package/client/lib/realtime/realtime-core.d.ts +6 -6
- package/client/lib/realtime/realtime-server.d.ts +9 -4
- package/client/lib/realtime/realtime-strategy/realtime-strategy-ipc.d.ts +71 -12
- package/client/lib/realtime/realtime-strategy/realtime-strategy-mock.d.ts +4 -4
- package/client/lib/realtime/realtime-strategy/realtime-strategy-socket-io.d.ts +2 -3
- package/client/lib/realtime/realtime-strategy/realtime-strategy.d.ts +4 -5
- package/client/lib/realtime/realtime.models.d.ts +1 -0
- package/client/lib/symbols.d.ts +30 -36
- package/lib/base-classes/base-context.d.ts +4 -0
- package/lib/base-classes/base-subscriber-for-entity.js +38 -19
- package/lib/base-classes/base-subscriber-for-entity.js.map +1 -1
- package/lib/base-classes/base.d.ts +4 -2
- package/lib/base-classes/base.js +0 -2
- package/lib/base-classes/base.js.map +1 -1
- package/lib/create-context.d.ts +13 -0
- package/lib/create-context.js +19 -8
- package/lib/create-context.js.map +1 -1
- package/lib/decorators/classes/subscriber-decorator.d.ts +1 -1
- package/lib/decorators/classes/subscriber-decorator.js +7 -58
- package/lib/decorators/classes/subscriber-decorator.js.map +1 -1
- package/lib/endpoint-context.js +33 -9
- package/lib/endpoint-context.js.map +1 -1
- package/lib/entity-process.js +2 -2
- package/lib/entity-process.js.map +1 -1
- package/lib/formly/formly-repeat-component.js +1 -1
- package/lib/formly/formly-repeat-component.js.map +1 -1
- package/lib/helpers/class-helpers.d.ts +1 -1
- package/lib/helpers/class-helpers.js +2 -2
- package/lib/helpers/class-helpers.js.map +1 -1
- package/lib/index._auto-generated_.js +6 -0
- package/lib/index._auto-generated_.js.map +1 -0
- package/lib/index.d.ts +12 -13
- package/lib/index.js +1 -17
- package/lib/index.js.map +1 -1
- package/lib/inject.d.ts +3 -7
- package/lib/inject.js +57 -42
- package/lib/inject.js.map +1 -1
- package/lib/models.d.ts +17 -9
- package/lib/models.js.map +1 -1
- package/lib/realtime/realtime-client.d.ts +8 -2
- package/lib/realtime/realtime-client.js +36 -21
- package/lib/realtime/realtime-client.js.map +1 -1
- package/lib/realtime/realtime-core.d.ts +6 -6
- package/lib/realtime/realtime-core.js +17 -6
- package/lib/realtime/realtime-core.js.map +1 -1
- package/lib/realtime/realtime-server.d.ts +9 -4
- package/lib/realtime/realtime-server.js +98 -76
- package/lib/realtime/realtime-server.js.map +1 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc.d.ts +71 -11
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc.js +301 -40
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc.js.map +1 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock.d.ts +4 -4
- package/lib/realtime/realtime-strategy/realtime-strategy-mock.js +358 -14
- package/lib/realtime/realtime-strategy/realtime-strategy-mock.js.map +1 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-socket-io.d.ts +3 -3
- package/lib/realtime/realtime-strategy/realtime-strategy-socket-io.js +10 -14
- package/lib/realtime/realtime-strategy/realtime-strategy-socket-io.js.map +1 -1
- package/lib/realtime/realtime-strategy/realtime-strategy.d.ts +4 -5
- package/lib/realtime/realtime-strategy/realtime-strategy.js +9 -2
- package/lib/realtime/realtime-strategy/realtime-strategy.js.map +1 -1
- package/lib/realtime/realtime-subs-manager.js +10 -8
- package/lib/realtime/realtime-subs-manager.js.map +1 -1
- package/lib/realtime/realtime.models.d.ts +1 -0
- package/lib/symbols.d.ts +30 -36
- package/lib/symbols.js +63 -39
- package/lib/symbols.js.map +1 -1
- package/lib/ui/directives/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/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/package.json +10 -8
- package/tmp-environment.json +36 -31
- package/websql/esm2022/lib/base-classes/base-subscriber-for-entity.mjs +39 -20
- package/websql/esm2022/lib/base-classes/base.mjs +1 -3
- package/websql/esm2022/lib/create-context.mjs +20 -1
- package/websql/esm2022/lib/decorators/classes/subscriber-decorator.mjs +3 -29
- package/websql/esm2022/lib/endpoint-context.mjs +16 -18
- package/websql/esm2022/lib/entity-process.mjs +3 -3
- package/websql/esm2022/lib/helpers/class-helpers.mjs +2 -2
- package/websql/esm2022/lib/index.mjs +1 -14
- package/websql/esm2022/lib/inject.mjs +4 -38
- package/websql/esm2022/lib/models.mjs +1 -1
- package/websql/esm2022/lib/realtime/realtime-client.mjs +32 -20
- package/websql/esm2022/lib/realtime/realtime-core.mjs +15 -7
- package/websql/esm2022/lib/realtime/realtime-server.mjs +90 -72
- package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc.mjs +200 -30
- package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock.mjs +206 -10
- package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-socket-io.mjs +3 -7
- package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy.mjs +6 -2
- package/websql/esm2022/lib/realtime/realtime-subs-manager.mjs +10 -8
- package/websql/esm2022/lib/realtime/realtime.models.mjs +1 -1
- package/websql/esm2022/lib/symbols.mjs +45 -38
- package/websql/fesm2022/taon.mjs +669 -687
- package/websql/fesm2022/taon.mjs.map +1 -1
- package/websql/lib/base-classes/base-context.d.ts +4 -0
- package/websql/lib/base-classes/base.d.ts +4 -2
- package/websql/lib/create-context.d.ts +13 -0
- package/websql/lib/decorators/classes/subscriber-decorator.d.ts +2 -2
- package/websql/lib/helpers/class-helpers.d.ts +1 -1
- package/websql/lib/index.d.ts +12 -13
- package/websql/lib/inject.d.ts +1 -8
- package/websql/lib/models.d.ts +17 -9
- package/websql/lib/realtime/realtime-client.d.ts +8 -2
- package/websql/lib/realtime/realtime-core.d.ts +6 -6
- package/websql/lib/realtime/realtime-server.d.ts +9 -4
- package/websql/lib/realtime/realtime-strategy/realtime-strategy-ipc.d.ts +71 -12
- package/websql/lib/realtime/realtime-strategy/realtime-strategy-mock.d.ts +4 -4
- package/websql/lib/realtime/realtime-strategy/realtime-strategy-socket-io.d.ts +2 -3
- package/websql/lib/realtime/realtime-strategy/realtime-strategy.d.ts +4 -5
- package/websql/lib/realtime/realtime.models.d.ts +1 -0
- package/websql/lib/symbols.d.ts +30 -36
- package/browser/esm2022/lib/base-classes/base-subscriber.mjs +0 -27
- package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.mjs +0 -98
- package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.mjs +0 -45
- package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.mjs +0 -40
- package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.mjs +0 -25
- package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.mjs +0 -4
- package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.mjs +0 -5
- package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.mjs +0 -50
- package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.mjs +0 -48
- package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.mjs +0 -35
- package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.mjs +0 -43
- package/browser/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.mjs +0 -4
- package/browser/lib/base-classes/base-subscriber.d.ts +0 -5
- package/browser/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.d.ts +0 -22
- package/browser/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.d.ts +0 -17
- package/browser/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.d.ts +0 -11
- package/browser/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.d.ts +0 -11
- package/browser/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.d.ts +0 -14
- package/browser/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.d.ts +0 -3
- package/browser/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.d.ts +0 -17
- package/browser/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.d.ts +0 -18
- package/browser/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.d.ts +0 -12
- package/browser/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.d.ts +0 -14
- package/browser/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.d.ts +0 -12
- package/client/esm2022/lib/base-classes/base-subscriber.mjs +0 -27
- package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.mjs +0 -98
- package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.mjs +0 -45
- package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.mjs +0 -40
- package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.mjs +0 -25
- package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.mjs +0 -4
- package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.mjs +0 -5
- package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.mjs +0 -50
- package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.mjs +0 -48
- package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.mjs +0 -35
- package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.mjs +0 -43
- package/client/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.mjs +0 -4
- package/client/lib/base-classes/base-subscriber.d.ts +0 -5
- package/client/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.d.ts +0 -22
- package/client/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.d.ts +0 -17
- package/client/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.d.ts +0 -11
- package/client/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.d.ts +0 -11
- package/client/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.d.ts +0 -14
- package/client/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.d.ts +0 -3
- package/client/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.d.ts +0 -17
- package/client/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.d.ts +0 -18
- package/client/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.d.ts +0 -12
- package/client/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.d.ts +0 -14
- package/client/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.d.ts +0 -12
- 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-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/websql/esm2022/lib/base-classes/base-subscriber.mjs +0 -27
- package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.mjs +0 -98
- package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.mjs +0 -45
- package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.mjs +0 -40
- package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.mjs +0 -25
- package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.mjs +0 -4
- package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.mjs +0 -5
- package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.mjs +0 -50
- package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.mjs +0 -48
- package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.mjs +0 -35
- package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.mjs +0 -43
- package/websql/esm2022/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.mjs +0 -4
- package/websql/lib/base-classes/base-subscriber.d.ts +0 -5
- package/websql/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.d.ts +0 -22
- package/websql/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.d.ts +0 -17
- package/websql/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.d.ts +0 -11
- package/websql/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.d.ts +0 -11
- package/websql/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.d.ts +0 -14
- package/websql/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.d.ts +0 -3
- package/websql/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.d.ts +0 -17
- package/websql/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.d.ts +0 -18
- package/websql/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.d.ts +0 -12
- package/websql/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.d.ts +0 -14
- package/websql/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.d.ts +0 -12
- /package/lib/{realtime/realtime-strategy/realtime-strategy-ipc-models/index.d.ts → index._auto-generated_.d.ts} +0 -0
package/websql/fesm2022/taon.mjs
CHANGED
|
@@ -25,45 +25,52 @@ var Symbols;
|
|
|
25
25
|
Symbols.orignalClass = OrignalClassKey;
|
|
26
26
|
Symbols.orignalClassClonesObj = `$$originalClassClonesObj$$`;
|
|
27
27
|
Symbols.classMethodsNames = `$$classMethodsNames$$`;
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
/**
|
|
29
|
+
* for backendSocket.in(ROOM_NAME).emit(EVENT)
|
|
30
|
+
*
|
|
31
|
+
* Room names are uniqe..
|
|
32
|
+
* here I am limiting number of event for clients.
|
|
33
|
+
*/
|
|
34
|
+
class Realtime {
|
|
35
|
+
constructor() {
|
|
36
|
+
this.KEYroomSubscribe = `roomSubscribe`;
|
|
37
|
+
this.KEYroomUnsubscribe = `roomUnsubscribe`;
|
|
38
|
+
}
|
|
39
|
+
NAMESPACE(contextName) {
|
|
40
|
+
return `${contextName}-taonRealtimeNsp`;
|
|
41
|
+
}
|
|
30
42
|
TABLE_CHANGE(contextName, tableName) {
|
|
31
43
|
return `${contextName}:listentablename${tableName}`;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
ENTITY_UPDATE_EVENTS: (contextName) => `${contextName}:roomUnsubscribeEntityEvents`,
|
|
63
|
-
ENTITY_PROPERTY_UPDATE_EVENTS: (contextName) => `${contextName}:roomUnsubscribeEntityPropertyEvents`,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
};
|
|
44
|
+
}
|
|
45
|
+
ROOM_NAME_CUSTOM(contextName, customEvent) {
|
|
46
|
+
return `${contextName}:CustomRoomEvent${customEvent}`;
|
|
47
|
+
}
|
|
48
|
+
ROOM_SUBSCRIBE_CUSTOM(contextName) {
|
|
49
|
+
return `${contextName}:${this.KEYroomSubscribe}CustomRoomEvent`;
|
|
50
|
+
}
|
|
51
|
+
ROOM_UNSUBSCRIBE_CUSTOM(contextName) {
|
|
52
|
+
return `${contextName}:${this.KEYroomUnsubscribe}CustomRoomEvent`;
|
|
53
|
+
}
|
|
54
|
+
ROOM_NAME_UPDATE_ENTITY(contextName, className, entityId) {
|
|
55
|
+
return `${contextName}:room${_.camelCase(className)}${entityId}`.toLowerCase();
|
|
56
|
+
}
|
|
57
|
+
ROOM_SUBSCRIBE_ENTITY_UPDATE_EVENTS(contextName) {
|
|
58
|
+
return `${contextName}:${this.KEYroomSubscribe}EntityEvents`;
|
|
59
|
+
}
|
|
60
|
+
ROOM_UNSUBSCRIBE_ENTITY_UPDATE_EVENTS(contextName) {
|
|
61
|
+
return `${contextName}:${this.KEYroomUnsubscribe}EntityEvents`;
|
|
62
|
+
}
|
|
63
|
+
ROOM_NAME_UPDATE_ENTITY_PROPERTY(contextName, className, property, entityId) {
|
|
64
|
+
return `${contextName}:room${_.camelCase(className)}${_.camelCase(property)}${entityId}`.toLowerCase();
|
|
65
|
+
}
|
|
66
|
+
ROOM_SUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(contextName) {
|
|
67
|
+
return `${contextName}:${this.KEYroomSubscribe}EntityPropertyEvents`;
|
|
68
|
+
}
|
|
69
|
+
ROOM_UNSUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(contextName) {
|
|
70
|
+
return `${contextName}:${this.KEYroomUnsubscribe}EntityPropertyEvents`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
Symbols.REALTIME = new Realtime();
|
|
67
74
|
Symbols.metadata = {
|
|
68
75
|
className: `class:realname`,
|
|
69
76
|
options: {
|
|
@@ -343,7 +350,7 @@ var ClassHelpers;
|
|
|
343
350
|
: classFnOrObject?.constructor[Symbols.fullClassNameStaticProperty]) ||
|
|
344
351
|
void 0);
|
|
345
352
|
};
|
|
346
|
-
ClassHelpers.
|
|
353
|
+
ClassHelpers.getUniqueKey = (classFnOrObject) => {
|
|
347
354
|
const classFn = _.isFunction(classFnOrObject)
|
|
348
355
|
? classFnOrObject
|
|
349
356
|
: classFnOrObject.constructor;
|
|
@@ -1786,17 +1793,19 @@ class RealtimeSubsManager {
|
|
|
1786
1793
|
return;
|
|
1787
1794
|
}
|
|
1788
1795
|
if (!this.isListening) {
|
|
1789
|
-
const subscribeEvent = Symbols.REALTIME.ROOM_NAME.SUBSCRIBE.CUSTOM(this.options.core.ctx.contextName);
|
|
1790
1796
|
this.isListening = true;
|
|
1791
1797
|
if (this.options.customEvent) {
|
|
1798
|
+
const subscribeEvent = Symbols.REALTIME.ROOM_SUBSCRIBE_CUSTOM(this.options.core.ctx.contextName);
|
|
1792
1799
|
realtime.emit(subscribeEvent, this.options.roomName);
|
|
1793
1800
|
}
|
|
1794
1801
|
else {
|
|
1795
1802
|
if (_.isString(this.options.property)) {
|
|
1796
|
-
|
|
1803
|
+
const subscribeEvent = Symbols.REALTIME.ROOM_SUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(this.options.core.ctx.contextName);
|
|
1804
|
+
realtime.emit(subscribeEvent, this.options.roomName);
|
|
1797
1805
|
}
|
|
1798
1806
|
else {
|
|
1799
|
-
|
|
1807
|
+
const subscribeEvent = Symbols.REALTIME.ROOM_SUBSCRIBE_ENTITY_UPDATE_EVENTS(this.options.core.ctx.contextName);
|
|
1808
|
+
realtime.emit(subscribeEvent, this.options.roomName);
|
|
1800
1809
|
}
|
|
1801
1810
|
}
|
|
1802
1811
|
realtime.on(this.options.roomName, data => {
|
|
@@ -1812,16 +1821,16 @@ class RealtimeSubsManager {
|
|
|
1812
1821
|
if (this.observers.length === 0) {
|
|
1813
1822
|
this.isListening = false;
|
|
1814
1823
|
const { core, customEvent, roomName, property } = this.options;
|
|
1815
|
-
const realtime = core.
|
|
1824
|
+
const realtime = core.socketFE;
|
|
1816
1825
|
if (customEvent) {
|
|
1817
|
-
realtime.emit(Symbols.REALTIME.
|
|
1826
|
+
realtime.emit(Symbols.REALTIME.ROOM_UNSUBSCRIBE_CUSTOM(this.options.core.ctx.contextName), roomName);
|
|
1818
1827
|
}
|
|
1819
1828
|
else {
|
|
1820
1829
|
if (_.isString(property)) {
|
|
1821
|
-
realtime.emit(Symbols.REALTIME.
|
|
1830
|
+
realtime.emit(Symbols.REALTIME.ROOM_UNSUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(this.options.core.ctx.contextName), roomName);
|
|
1822
1831
|
}
|
|
1823
1832
|
else {
|
|
1824
|
-
realtime.emit(Symbols.REALTIME.
|
|
1833
|
+
realtime.emit(Symbols.REALTIME.ROOM_UNSUBSCRIBE_ENTITY_UPDATE_EVENTS(this.options.core.ctx.contextName), roomName);
|
|
1825
1834
|
}
|
|
1826
1835
|
}
|
|
1827
1836
|
}
|
|
@@ -1848,7 +1857,7 @@ class RealtimeSubsManager {
|
|
|
1848
1857
|
class RealtimeClient {
|
|
1849
1858
|
constructor(core) {
|
|
1850
1859
|
this.core = core;
|
|
1851
|
-
this.
|
|
1860
|
+
this.subsManagers = {};
|
|
1852
1861
|
this.core = core;
|
|
1853
1862
|
if (!core.ctx.disabledRealtime) {
|
|
1854
1863
|
this.init();
|
|
@@ -1863,20 +1872,24 @@ class RealtimeClient {
|
|
|
1863
1872
|
console.info('[CLIENT] NAMESPACE GLOBAL ', nspPath.global.href + ` host: ${this.core.ctx.host}`);
|
|
1864
1873
|
this.core.ctx.logRealtime &&
|
|
1865
1874
|
console.info('[CLIENT] NAMESPACE REALTIME', nspPath.realtime.href + ` host: ${this.core.ctx.host}`);
|
|
1866
|
-
this.core.
|
|
1875
|
+
this.core.conectSocketFE = this.core.strategy.ioClient(nspPath.global.origin, {
|
|
1867
1876
|
path: nspPath.global.pathname,
|
|
1868
1877
|
});
|
|
1869
|
-
if (this.core.
|
|
1870
|
-
this.core.
|
|
1871
|
-
|
|
1878
|
+
if (this.core.conectSocketFE.on) {
|
|
1879
|
+
this.core.conectSocketFE.on('connect', () => {
|
|
1880
|
+
this.core.ctx.logRealtime &&
|
|
1881
|
+
console.info(`[CLIENT] connected to GLOBAL namespace ${nspPath.global.pathname}` +
|
|
1882
|
+
` of host: ${this.core.ctx.host}`);
|
|
1872
1883
|
});
|
|
1873
1884
|
}
|
|
1874
|
-
this.core.
|
|
1885
|
+
this.core.socketFE = this.core.strategy.ioClient(nspPath.realtime.origin, {
|
|
1875
1886
|
path: nspPath.realtime.pathname,
|
|
1876
1887
|
});
|
|
1877
|
-
if (this.core.
|
|
1878
|
-
this.core.
|
|
1879
|
-
|
|
1888
|
+
if (this.core.socketFE.on) {
|
|
1889
|
+
this.core.socketFE.on('connect', () => {
|
|
1890
|
+
this.core.ctx.logRealtime &&
|
|
1891
|
+
console.info(`[CLIENT] connected to REALTIME namespace ${nspPath.realtime.pathname}` +
|
|
1892
|
+
` host: ${this.core.ctx.host}`);
|
|
1880
1893
|
});
|
|
1881
1894
|
}
|
|
1882
1895
|
}
|
|
@@ -1911,12 +1924,12 @@ to use socket realtime connection;
|
|
|
1911
1924
|
}
|
|
1912
1925
|
let roomName;
|
|
1913
1926
|
if (customEvent) {
|
|
1914
|
-
roomName = Symbols.REALTIME.
|
|
1927
|
+
roomName = Symbols.REALTIME.ROOM_NAME_CUSTOM(this.core.ctx.contextName, customEvent);
|
|
1915
1928
|
}
|
|
1916
1929
|
else {
|
|
1917
1930
|
roomName = _.isString(property)
|
|
1918
|
-
? Symbols.REALTIME.
|
|
1919
|
-
: Symbols.REALTIME.
|
|
1931
|
+
? Symbols.REALTIME.ROOM_NAME_UPDATE_ENTITY_PROPERTY(this.core.ctx.contextName, className, property, idOrUniqValue)
|
|
1932
|
+
: Symbols.REALTIME.ROOM_NAME_UPDATE_ENTITY(this.core.ctx.contextName, className, idOrUniqValue);
|
|
1920
1933
|
}
|
|
1921
1934
|
const roomSubOptions = {
|
|
1922
1935
|
core: this.core,
|
|
@@ -1924,13 +1937,13 @@ to use socket realtime connection;
|
|
|
1924
1937
|
roomName,
|
|
1925
1938
|
customEvent,
|
|
1926
1939
|
};
|
|
1927
|
-
const subManagerId = this.
|
|
1928
|
-
if (!this.
|
|
1929
|
-
this.
|
|
1940
|
+
const subManagerId = this.getUniqueIdentifierForConnection(roomSubOptions);
|
|
1941
|
+
if (!this.subsManagers[subManagerId]) {
|
|
1942
|
+
this.subsManagers[subManagerId] = new RealtimeSubsManager(roomSubOptions);
|
|
1930
1943
|
}
|
|
1931
|
-
const inst = this.
|
|
1944
|
+
const inst = this.subsManagers[subManagerId];
|
|
1932
1945
|
inst.add(observer);
|
|
1933
|
-
inst.startListenIfNotStarted(this.core.
|
|
1946
|
+
inst.startListenIfNotStarted(this.core.socketFE);
|
|
1934
1947
|
return () => {
|
|
1935
1948
|
inst.remove(observer);
|
|
1936
1949
|
};
|
|
@@ -1953,7 +1966,7 @@ to use socket realtime connection;
|
|
|
1953
1966
|
*/
|
|
1954
1967
|
listenChangesEntityObj(entity, options) {
|
|
1955
1968
|
const classFn = ClassHelpers.getClassFnFromObject(entity);
|
|
1956
|
-
const uniqueKey = ClassHelpers.
|
|
1969
|
+
const uniqueKey = ClassHelpers.getUniqueKey(classFn);
|
|
1957
1970
|
return this.listenChangesEntity(classFn, entity[uniqueKey], options);
|
|
1958
1971
|
}
|
|
1959
1972
|
listenChangesCustomEvent(customEvent) {
|
|
@@ -1961,7 +1974,15 @@ to use socket realtime connection;
|
|
|
1961
1974
|
customEvent,
|
|
1962
1975
|
});
|
|
1963
1976
|
}
|
|
1964
|
-
|
|
1977
|
+
/**
|
|
1978
|
+
* Trigger custom event on backend
|
|
1979
|
+
* @param customEvent global event name
|
|
1980
|
+
* @param dataToPush
|
|
1981
|
+
*/
|
|
1982
|
+
triggerCustomEvent(customEvent, dataToPush) {
|
|
1983
|
+
this.core.socketFE.emit(customEvent, dataToPush);
|
|
1984
|
+
}
|
|
1985
|
+
getUniqueIdentifierForConnection(options) {
|
|
1965
1986
|
const url = new URL(options.core.ctx.host);
|
|
1966
1987
|
return `${this.core.ctx.contextName}:${url.origin}|${options.roomName}|${options.property}|${options.customEvent}`;
|
|
1967
1988
|
}
|
|
@@ -1969,135 +1990,139 @@ to use socket realtime connection;
|
|
|
1969
1990
|
;
|
|
1970
1991
|
({}); // @--end-of-file-for-module=taon lib/realtime/realtime-client.ts
|
|
1971
1992
|
|
|
1972
|
-
const SOCKET_EVENT_DEBOUNCE = 500;
|
|
1973
1993
|
class RealtimeServer {
|
|
1974
1994
|
constructor(core) {
|
|
1975
1995
|
this.core = core;
|
|
1976
|
-
this.jobs = {};
|
|
1977
1996
|
this.core = core;
|
|
1978
1997
|
if (!core.ctx.disabledRealtime) {
|
|
1979
1998
|
this.init();
|
|
1980
1999
|
}
|
|
1981
2000
|
}
|
|
1982
2001
|
init() {
|
|
2002
|
+
if (!this.core.ctx.config.frontendHost) {
|
|
2003
|
+
console.warn(`[Taon][Realtime]
|
|
2004
|
+
|
|
2005
|
+
Frontend host is not defined
|
|
2006
|
+
REALTIME COMMUNICATION WILL NOT WORK
|
|
2007
|
+
|
|
2008
|
+
provide "frontendHost" property in your taon config
|
|
2009
|
+
|
|
2010
|
+
`);
|
|
2011
|
+
}
|
|
1983
2012
|
const nspPath = {
|
|
1984
2013
|
global: this.core.pathFor(),
|
|
1985
2014
|
realtime: this.core.pathFor(Symbols.REALTIME.NAMESPACE(this.core.ctx.contextName)),
|
|
1986
2015
|
};
|
|
1987
|
-
this.core.
|
|
2016
|
+
this.core.connectSocketBE = this.core.strategy.ioServer(Helpers.isWebSQL ? this.core.ctx.uri.origin : this.core.ctx.serverTcpUdp, {
|
|
1988
2017
|
path: nspPath.global.pathname,
|
|
1989
2018
|
cors: {
|
|
1990
2019
|
origin: this.core.ctx.config.frontendHost,
|
|
1991
2020
|
methods: this.core.allHttpMethods,
|
|
1992
2021
|
},
|
|
1993
|
-
}
|
|
2022
|
+
}, // @ts-ignore
|
|
2023
|
+
this.core.ctx);
|
|
1994
2024
|
this.core.ctx.logRealtime &&
|
|
1995
|
-
console.info(`CREATE GLOBAL NAMESPACE: '${this.core.
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
this.core.
|
|
2000
|
-
}
|
|
2001
|
-
console.info(`client conected to namespace "${clientSocket.nsp?.name}", host: ${this.core.ctx.host}`);
|
|
2025
|
+
console.info(`[backend] CREATE GLOBAL NAMESPACE: '${this.core.connectSocketBE.path()}'` +
|
|
2026
|
+
` , path: '${nspPath.global.pathname}'`);
|
|
2027
|
+
this.core.connectSocketBE.on('connection', clientSocket => {
|
|
2028
|
+
console.info(`[backend] client connected to namespace "${nspPath.global.pathname}", ` +
|
|
2029
|
+
` host: ${this.core.ctx.host}`);
|
|
2002
2030
|
});
|
|
2003
|
-
this.core.
|
|
2031
|
+
this.core.socketBE = this.core.strategy.ioServer(Helpers.isWebSQL || Helpers.isElectron
|
|
2032
|
+
? this.core.ctx.uri.origin
|
|
2033
|
+
: this.core.ctx.serverTcpUdp, {
|
|
2004
2034
|
path: nspPath.realtime.pathname,
|
|
2005
2035
|
cors: {
|
|
2006
2036
|
origin: this.core.ctx.config.frontendHost,
|
|
2007
2037
|
methods: this.core.allHttpMethods,
|
|
2008
2038
|
},
|
|
2009
|
-
}
|
|
2039
|
+
}, // @ts-ignore
|
|
2040
|
+
this.core.ctx);
|
|
2010
2041
|
this.core.ctx.logRealtime &&
|
|
2011
|
-
console.info(`CREATE REALTIME NAMESPACE: '${this.core.
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
this.core.
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
console.info(`Joining room ${roomName} in namespace REALTIME` +
|
|
2021
|
-
` host: ${this.core.ctx.contextName}/${this.core.ctx.host}`);
|
|
2042
|
+
console.info(`[backend] CREATE REALTIME NAMESPACE: '${this.core.socketBE.path()}'` +
|
|
2043
|
+
` , path: '${nspPath.realtime.pathname}' `);
|
|
2044
|
+
this.core.socketBE.on('connection', backendSocketForClient => {
|
|
2045
|
+
console.info(`[backend] client connected to namespace "${nspPath.realtime.pathname}", ` +
|
|
2046
|
+
` host: ${this.core.ctx.host}`);
|
|
2047
|
+
backendSocketForClient.on(Symbols.REALTIME.ROOM_SUBSCRIBE_CUSTOM(this.core.ctx.contextName), roomName => {
|
|
2048
|
+
this.core.ctx.logRealtime &&
|
|
2049
|
+
console.info(`Joining room ${roomName} in namespace REALTIME` +
|
|
2050
|
+
` host: ${this.core.ctx.contextName}/${this.core.ctx.host}`);
|
|
2022
2051
|
backendSocketForClient.join(roomName);
|
|
2023
2052
|
});
|
|
2024
|
-
backendSocketForClient.on(Symbols.REALTIME.
|
|
2025
|
-
|
|
2026
|
-
`
|
|
2053
|
+
backendSocketForClient.on(Symbols.REALTIME.ROOM_SUBSCRIBE_ENTITY_UPDATE_EVENTS(this.core.ctx.contextName), roomName => {
|
|
2054
|
+
this.core.ctx.logRealtime &&
|
|
2055
|
+
console.info(`[backend] Joining room ${roomName} in namespace REALTIME` +
|
|
2056
|
+
` host: ${this.core.ctx.contextName}/${this.core.ctx.host}`);
|
|
2027
2057
|
backendSocketForClient.join(roomName);
|
|
2028
2058
|
});
|
|
2029
|
-
backendSocketForClient.on(Symbols.REALTIME.
|
|
2030
|
-
|
|
2031
|
-
`
|
|
2059
|
+
backendSocketForClient.on(Symbols.REALTIME.ROOM_SUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(this.core.ctx.contextName), roomName => {
|
|
2060
|
+
this.core.ctx.logRealtime &&
|
|
2061
|
+
console.info(`[backend] Joining room ${roomName} in namespace REALTIME ` +
|
|
2062
|
+
` host: ${this.core.ctx.contextName}/${this.core.ctx.host}`);
|
|
2032
2063
|
backendSocketForClient.join(roomName);
|
|
2033
2064
|
});
|
|
2034
|
-
backendSocketForClient.on(Symbols.REALTIME.
|
|
2035
|
-
|
|
2036
|
-
`
|
|
2065
|
+
backendSocketForClient.on(Symbols.REALTIME.ROOM_UNSUBSCRIBE_CUSTOM(this.core.ctx.contextName), roomName => {
|
|
2066
|
+
this.core.ctx.logRealtime &&
|
|
2067
|
+
console.info(`[backend] Leaving room ${roomName} in namespace REALTIME` +
|
|
2068
|
+
` host: ${this.core.ctx.contextName}/${this.core.ctx.host}`);
|
|
2037
2069
|
backendSocketForClient.leave(roomName);
|
|
2038
2070
|
});
|
|
2039
|
-
backendSocketForClient.on(Symbols.REALTIME.
|
|
2040
|
-
|
|
2041
|
-
`
|
|
2071
|
+
backendSocketForClient.on(Symbols.REALTIME.ROOM_UNSUBSCRIBE_ENTITY_UPDATE_EVENTS(this.core.ctx.contextName), roomName => {
|
|
2072
|
+
this.core.ctx.logRealtime &&
|
|
2073
|
+
console.info(`[backend] Leaving room ${roomName} in namespace REALTIME ` +
|
|
2074
|
+
` host: ${this.core.ctx.contextName}/${this.core.ctx.host}`);
|
|
2042
2075
|
backendSocketForClient.leave(roomName);
|
|
2043
2076
|
});
|
|
2044
|
-
backendSocketForClient.on(Symbols.REALTIME.
|
|
2045
|
-
|
|
2046
|
-
`
|
|
2077
|
+
backendSocketForClient.on(Symbols.REALTIME.ROOM_UNSUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(this.core.ctx.contextName), roomName => {
|
|
2078
|
+
this.core.ctx.logRealtime &&
|
|
2079
|
+
console.info(`[backend] Leaving room ${roomName} in namespace REALTIME ` +
|
|
2080
|
+
` host: ${this.core.ctx.contextName}/${this.core.ctx.host}`);
|
|
2047
2081
|
backendSocketForClient.leave(roomName);
|
|
2048
2082
|
});
|
|
2049
2083
|
});
|
|
2050
2084
|
}
|
|
2051
|
-
triggerChanges(entityObjOrClass, property,
|
|
2085
|
+
triggerChanges(entityObjOrClass, property, valueOfUniqueProperty, customEvent, customEventData) {
|
|
2052
2086
|
let roomName;
|
|
2053
2087
|
if (this.core.ctx.disabledRealtime) {
|
|
2054
2088
|
return;
|
|
2055
2089
|
}
|
|
2056
2090
|
if (customEvent) {
|
|
2057
|
-
roomName = Symbols.REALTIME.
|
|
2091
|
+
roomName = Symbols.REALTIME.ROOM_NAME_CUSTOM(this.core.ctx.contextName, customEvent);
|
|
2058
2092
|
}
|
|
2059
2093
|
else {
|
|
2060
2094
|
let entityFn = entityObjOrClass;
|
|
2061
|
-
const
|
|
2062
|
-
if (
|
|
2095
|
+
const entityIsObject = !_.isFunction(entityObjOrClass) && _.isObject(entityObjOrClass);
|
|
2096
|
+
if (entityIsObject) {
|
|
2063
2097
|
entityFn = ClassHelpers.getClassFnFromObject(entityObjOrClass);
|
|
2064
2098
|
}
|
|
2065
|
-
const uniqueKey = ClassHelpers.
|
|
2066
|
-
if (
|
|
2067
|
-
|
|
2099
|
+
const uniqueKey = ClassHelpers.getUniqueKey(entityFn);
|
|
2100
|
+
if (entityIsObject) {
|
|
2101
|
+
valueOfUniqueProperty = entityObjOrClass[uniqueKey];
|
|
2068
2102
|
}
|
|
2069
|
-
if (!
|
|
2103
|
+
if (!valueOfUniqueProperty) {
|
|
2070
2104
|
Helpers.error(`[Taon][Realtime] Entity without iD ! ${ClassHelpers.getName(entityFn)} `, true, true);
|
|
2071
2105
|
return;
|
|
2072
2106
|
}
|
|
2073
2107
|
roomName = _.isString(property)
|
|
2074
|
-
? Symbols.REALTIME.
|
|
2075
|
-
: Symbols.REALTIME.
|
|
2076
|
-
}
|
|
2077
|
-
const job = () => {
|
|
2078
|
-
console.log(`Trigger realtime: ${this.core.ctx.contextName}/${roomName}`);
|
|
2079
|
-
this.core.BE_REALTIME.in(roomName).emit(roomName, // roomName == eventName in room na
|
|
2080
|
-
customEventData ? customEventData : '');
|
|
2081
|
-
};
|
|
2082
|
-
if (!_.isFunction(this.jobs[roomName])) {
|
|
2083
|
-
this.jobs[roomName] = _.debounce(() => {
|
|
2084
|
-
job();
|
|
2085
|
-
}, SOCKET_EVENT_DEBOUNCE);
|
|
2108
|
+
? Symbols.REALTIME.ROOM_NAME_UPDATE_ENTITY_PROPERTY(this.core.ctx.contextName, ClassHelpers.getName(entityFn), property, valueOfUniqueProperty)
|
|
2109
|
+
: Symbols.REALTIME.ROOM_NAME_UPDATE_ENTITY(this.core.ctx.contextName, ClassHelpers.getName(entityFn), valueOfUniqueProperty);
|
|
2086
2110
|
}
|
|
2087
|
-
this.
|
|
2111
|
+
this.core.socketBE.in(roomName).emit(roomName, // roomName == eventName in room na
|
|
2112
|
+
customEvent ? customEventData : '');
|
|
2088
2113
|
}
|
|
2089
|
-
|
|
2114
|
+
triggerEntityChanges(entityObjOrClass, idToTrigger) {
|
|
2090
2115
|
if (this.core.ctx.disabledRealtime) {
|
|
2091
2116
|
const className = ClassHelpers.getName(entityObjOrClass);
|
|
2092
|
-
console.warn(`[Taon][
|
|
2117
|
+
console.warn(`[Taon][TriggerEntityChanges] Entity "${className}' is not realtime`);
|
|
2093
2118
|
return;
|
|
2094
2119
|
}
|
|
2095
2120
|
this.triggerChanges(entityObjOrClass, void 0, idToTrigger);
|
|
2096
2121
|
}
|
|
2097
|
-
|
|
2122
|
+
triggerEntityPropertyChanges(entityObjOrClass, property, idToTrigger) {
|
|
2098
2123
|
if (this.core.ctx.disabledRealtime) {
|
|
2099
2124
|
const className = ClassHelpers.getName(entityObjOrClass);
|
|
2100
|
-
console.warn(`[Taon][
|
|
2125
|
+
console.warn(`[Taon][TriggerEntityPropertyChanges][property=${property}] Entity "${className}' is not realtime`);
|
|
2101
2126
|
return;
|
|
2102
2127
|
}
|
|
2103
2128
|
if (_.isArray(property)) {
|
|
@@ -2109,16 +2134,29 @@ class RealtimeServer {
|
|
|
2109
2134
|
this.triggerChanges(entityObjOrClass, property, idToTrigger);
|
|
2110
2135
|
}
|
|
2111
2136
|
}
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
}
|
|
2115
|
-
trigggerEntityTableChanges(entityClass) {
|
|
2116
|
-
const className = ClassHelpers.getName(entityClass);
|
|
2137
|
+
triggerEntityTableChanges(entityClassOrInstance) {
|
|
2138
|
+
const className = ClassHelpers.getName(entityClassOrInstance);
|
|
2117
2139
|
if (this.core.ctx.disabledRealtime) {
|
|
2118
|
-
console.warn(`[Taon][
|
|
2140
|
+
console.warn(`[Taon][TriggerEntityTableChanges] Entity "${className}' is not realtime`);
|
|
2119
2141
|
return;
|
|
2120
2142
|
}
|
|
2121
|
-
this.triggerChanges(
|
|
2143
|
+
this.triggerChanges(entityClassOrInstance, void 0, void 0, Symbols.REALTIME.TABLE_CHANGE(this.core.ctx.contextName, className));
|
|
2144
|
+
}
|
|
2145
|
+
triggerCustomEvent(customEvent, dataToPush) {
|
|
2146
|
+
this.triggerChanges(void 0, void 0, void 0, customEvent, dataToPush);
|
|
2147
|
+
}
|
|
2148
|
+
/**
|
|
2149
|
+
* Listen to custom events from users
|
|
2150
|
+
* @param customEvent global event name
|
|
2151
|
+
*/
|
|
2152
|
+
listenChangesCustomEvent(customEvent) {
|
|
2153
|
+
const sub = new Subject();
|
|
2154
|
+
this.core.socketBE.on('connection', backendSocketForClient => {
|
|
2155
|
+
backendSocketForClient.on(customEvent, (data, ...args) => {
|
|
2156
|
+
sub.next(data);
|
|
2157
|
+
});
|
|
2158
|
+
});
|
|
2159
|
+
return sub.asObservable();
|
|
2122
2160
|
}
|
|
2123
2161
|
}
|
|
2124
2162
|
;
|
|
@@ -2128,22 +2166,69 @@ class RealtimeStrategy {
|
|
|
2128
2166
|
constructor(ctx) {
|
|
2129
2167
|
this.ctx = ctx;
|
|
2130
2168
|
}
|
|
2131
|
-
|
|
2169
|
+
get ioClient() {
|
|
2170
|
+
throw new Error('Not implemented');
|
|
2171
|
+
}
|
|
2172
|
+
ioServer(url, opt) {
|
|
2173
|
+
throw new Error('Not implemented');
|
|
2132
2174
|
}
|
|
2133
2175
|
}
|
|
2134
2176
|
;
|
|
2135
2177
|
({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy.ts
|
|
2136
2178
|
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2179
|
+
class MockServerIpc {
|
|
2180
|
+
static { this.serverByContextName = new Map(); }
|
|
2181
|
+
static from(contextName) {
|
|
2182
|
+
if (!MockServerIpc.serverByContextName.has(contextName)) {
|
|
2183
|
+
MockServerIpc.serverByContextName.set(contextName, new MockServerIpc(contextName));
|
|
2184
|
+
}
|
|
2185
|
+
return MockServerIpc.serverByContextName.get(contextName);
|
|
2186
|
+
}
|
|
2187
|
+
constructor(contextName) {
|
|
2188
|
+
this.contextName = contextName;
|
|
2189
|
+
this.namespacesByName = new Map();
|
|
2190
|
+
MockServerIpc.serverByContextName.set(contextName, this);
|
|
2191
|
+
}
|
|
2192
|
+
of(namespace) {
|
|
2193
|
+
if (!this.namespacesByName.has(namespace)) {
|
|
2194
|
+
this.namespacesByName.set(namespace, new MockNamespaceIpc(namespace, this));
|
|
2195
|
+
}
|
|
2196
|
+
return this.namespacesByName.get(namespace);
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
class MockNamespaceIpc {
|
|
2200
|
+
constructor(
|
|
2201
|
+
/**
|
|
2202
|
+
* Namespace name
|
|
2203
|
+
*/
|
|
2204
|
+
name, server) {
|
|
2142
2205
|
this.name = name;
|
|
2143
|
-
this.
|
|
2144
|
-
this.
|
|
2206
|
+
this.server = server;
|
|
2207
|
+
this.electronClients = new Set();
|
|
2208
|
+
this.roomsByRoomName = {};
|
|
2209
|
+
this.namespaceEventHandlers = {};
|
|
2145
2210
|
}
|
|
2146
|
-
on(
|
|
2211
|
+
on(eventName, callback) {
|
|
2212
|
+
/* */
|
|
2213
|
+
/* */
|
|
2214
|
+
/* */
|
|
2215
|
+
/* */
|
|
2216
|
+
/* */
|
|
2217
|
+
/* */
|
|
2218
|
+
/* */
|
|
2219
|
+
/* */
|
|
2220
|
+
/* */
|
|
2221
|
+
/* */
|
|
2222
|
+
/* */
|
|
2223
|
+
/* */
|
|
2224
|
+
/* */
|
|
2225
|
+
/* */
|
|
2226
|
+
/* */
|
|
2227
|
+
/* */
|
|
2228
|
+
/* */
|
|
2229
|
+
/* */
|
|
2230
|
+
/* */
|
|
2231
|
+
/* */
|
|
2147
2232
|
/* */
|
|
2148
2233
|
/* */
|
|
2149
2234
|
/* */
|
|
@@ -2168,10 +2253,11 @@ class IpcMainNamespace {
|
|
|
2168
2253
|
/* */
|
|
2169
2254
|
/* */
|
|
2170
2255
|
/* */
|
|
2171
|
-
/* */
|
|
2172
2256
|
return (void 0);
|
|
2173
2257
|
}
|
|
2174
|
-
emit(
|
|
2258
|
+
emit(eventName, ...args) {
|
|
2259
|
+
/* */
|
|
2260
|
+
/* */
|
|
2175
2261
|
/* */
|
|
2176
2262
|
/* */
|
|
2177
2263
|
/* */
|
|
@@ -2181,39 +2267,25 @@ class IpcMainNamespace {
|
|
|
2181
2267
|
/* */
|
|
2182
2268
|
return (void 0);
|
|
2183
2269
|
}
|
|
2184
|
-
to(
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
const emitEvent = `(${this.name}) "${event}"`;
|
|
2188
|
-
const allWindows = Electron.BrowserWindow.getAllWindows();
|
|
2189
|
-
allWindows.forEach((win, index) => {
|
|
2190
|
-
win.webContents.send(emitEvent, ...args);
|
|
2191
|
-
});
|
|
2192
|
-
},
|
|
2193
|
-
};
|
|
2270
|
+
to(roomName) {
|
|
2271
|
+
const electronClientsInroom = this.roomsByRoomName[roomName];
|
|
2272
|
+
return new RoomEmitterIpc(electronClientsInroom, this.name, true);
|
|
2194
2273
|
}
|
|
2195
|
-
in(
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
const sendEventKey = `(${this.name}) "${event}"`;
|
|
2199
|
-
const allWindows = Electron.BrowserWindow.getAllWindows();
|
|
2200
|
-
allWindows.forEach((win, index) => {
|
|
2201
|
-
win.webContents.send(sendEventKey, ...args);
|
|
2202
|
-
});
|
|
2203
|
-
},
|
|
2204
|
-
};
|
|
2274
|
+
in(roomName) {
|
|
2275
|
+
const electronClientsInroom = this.roomsByRoomName[roomName];
|
|
2276
|
+
return new RoomEmitterIpc(electronClientsInroom, this.name, false);
|
|
2205
2277
|
}
|
|
2206
|
-
join(webContents,
|
|
2207
|
-
if (!this.
|
|
2208
|
-
this.
|
|
2278
|
+
join(webContents, roomName) {
|
|
2279
|
+
if (!this.roomsByRoomName[roomName]) {
|
|
2280
|
+
this.roomsByRoomName[roomName] = new Set();
|
|
2209
2281
|
}
|
|
2210
|
-
this.
|
|
2282
|
+
this.roomsByRoomName[roomName].add(webContents);
|
|
2211
2283
|
}
|
|
2212
|
-
leave(webContents,
|
|
2213
|
-
if (this.
|
|
2214
|
-
this.
|
|
2215
|
-
if (this.
|
|
2216
|
-
delete this.
|
|
2284
|
+
leave(webContents, roomName) {
|
|
2285
|
+
if (this.roomsByRoomName[roomName]) {
|
|
2286
|
+
this.roomsByRoomName[roomName].delete(webContents);
|
|
2287
|
+
if (this.roomsByRoomName[roomName].size === 0) {
|
|
2288
|
+
delete this.roomsByRoomName[roomName];
|
|
2217
2289
|
}
|
|
2218
2290
|
}
|
|
2219
2291
|
}
|
|
@@ -2229,117 +2301,70 @@ class IpcMainNamespace {
|
|
|
2229
2301
|
};
|
|
2230
2302
|
}
|
|
2231
2303
|
}
|
|
2232
|
-
|
|
2233
|
-
(
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
this.
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
of(namespace) {
|
|
2243
|
-
if (!this.namespaces[namespace]) {
|
|
2244
|
-
this.namespaces[namespace] = new IpcMainNamespace(namespace);
|
|
2245
|
-
}
|
|
2246
|
-
return this.namespaces[namespace];
|
|
2247
|
-
}
|
|
2248
|
-
on(event, callback) {
|
|
2249
|
-
const eventKey = `(${this.contextName}) "${event}"`;
|
|
2250
|
-
this.namespaces['/'].on(eventKey, callback);
|
|
2251
|
-
}
|
|
2252
|
-
emit(event, ...args) {
|
|
2253
|
-
const eventKey = `(${this.contextName}) "${event}"`;
|
|
2254
|
-
this.namespaces['/'].emit(eventKey, ...args);
|
|
2255
|
-
}
|
|
2256
|
-
path() {
|
|
2257
|
-
return '/';
|
|
2258
|
-
}
|
|
2259
|
-
get nsp() {
|
|
2260
|
-
return {
|
|
2261
|
-
get name() {
|
|
2262
|
-
return '/';
|
|
2263
|
-
},
|
|
2264
|
-
};
|
|
2304
|
+
class RoomEmitterIpc {
|
|
2305
|
+
constructor(electronClients,
|
|
2306
|
+
/**
|
|
2307
|
+
* namespace name
|
|
2308
|
+
*/
|
|
2309
|
+
name, includeSender = false, sender = null) {
|
|
2310
|
+
this.electronClients = electronClients;
|
|
2311
|
+
this.name = name;
|
|
2312
|
+
this.includeSender = includeSender;
|
|
2313
|
+
this.sender = sender;
|
|
2265
2314
|
}
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
});
|
|
2272
|
-
},
|
|
2273
|
-
};
|
|
2315
|
+
emit(eventName, ...args) {
|
|
2316
|
+
const emitEvent = `(${this.name}) "${eventName}"`;
|
|
2317
|
+
this.electronClients?.forEach(webContents => {
|
|
2318
|
+
webContents.send(emitEvent, ...args);
|
|
2319
|
+
});
|
|
2274
2320
|
}
|
|
2275
2321
|
}
|
|
2276
|
-
|
|
2277
|
-
(
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2322
|
+
class MockSocketIpc {
|
|
2323
|
+
get name() {
|
|
2324
|
+
return this.namespaceName;
|
|
2325
|
+
}
|
|
2326
|
+
/**
|
|
2327
|
+
* @param namespaceName instead url for ipc
|
|
2328
|
+
*/
|
|
2329
|
+
constructor(namespaceName) {
|
|
2330
|
+
this.namespaceName = namespaceName;
|
|
2331
|
+
this.socketEventHandlers = {};
|
|
2283
2332
|
this.ipcRenderer = window.require('electron').ipcRenderer;
|
|
2284
2333
|
}
|
|
2285
2334
|
on(eventName, callback) {
|
|
2286
|
-
if (!this.
|
|
2287
|
-
this.
|
|
2335
|
+
if (!this.socketEventHandlers[eventName]) {
|
|
2336
|
+
this.socketEventHandlers[eventName] = new Set();
|
|
2288
2337
|
}
|
|
2289
|
-
this.
|
|
2338
|
+
this.socketEventHandlers[eventName].add(callback);
|
|
2290
2339
|
const listenToEvent = `(${this.name}) "${eventName}"`;
|
|
2291
|
-
this.ipcRenderer.on(listenToEvent,
|
|
2340
|
+
this.ipcRenderer.on(listenToEvent, (rendereEvent, data) => {
|
|
2341
|
+
callback(data);
|
|
2342
|
+
});
|
|
2292
2343
|
if (eventName === 'connect') {
|
|
2293
|
-
this.
|
|
2294
|
-
|
|
2295
|
-
else {
|
|
2296
|
-
this.emit(eventName);
|
|
2344
|
+
const connectionEventKey = `(${this.name}) "connection"`;
|
|
2345
|
+
this.ipcRenderer.send(connectionEventKey, this.name);
|
|
2297
2346
|
}
|
|
2298
2347
|
}
|
|
2299
2348
|
off(event, callback) {
|
|
2300
|
-
if (!this.
|
|
2349
|
+
if (!this.socketEventHandlers[event]) {
|
|
2301
2350
|
return;
|
|
2351
|
+
}
|
|
2302
2352
|
if (callback) {
|
|
2303
|
-
this.
|
|
2353
|
+
this.socketEventHandlers[event].delete(callback);
|
|
2304
2354
|
}
|
|
2305
2355
|
else {
|
|
2306
|
-
delete this.
|
|
2356
|
+
delete this.socketEventHandlers[event];
|
|
2307
2357
|
}
|
|
2308
2358
|
const removeListener = `(${this.name}) "${event}"`;
|
|
2309
|
-
this.ipcRenderer.removeListener(removeListener,
|
|
2359
|
+
this.ipcRenderer.removeListener(removeListener, data => {
|
|
2360
|
+
callback(data);
|
|
2361
|
+
});
|
|
2310
2362
|
}
|
|
2311
2363
|
emit(event, ...args) {
|
|
2312
2364
|
const emitEvent = `(${this.name}) "${event}"`;
|
|
2313
2365
|
this.ipcRenderer.send(emitEvent, ...args);
|
|
2314
2366
|
}
|
|
2315
2367
|
}
|
|
2316
|
-
;
|
|
2317
|
-
({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.ts
|
|
2318
|
-
|
|
2319
|
-
class IpcRendererWrapper {
|
|
2320
|
-
constructor(contextName) {
|
|
2321
|
-
this.contextName = contextName;
|
|
2322
|
-
this.namespaces = {
|
|
2323
|
-
'/': new IpcRendererNamespace('/'),
|
|
2324
|
-
};
|
|
2325
|
-
this.connected = false;
|
|
2326
|
-
}
|
|
2327
|
-
of(namespace) {
|
|
2328
|
-
if (!this.namespaces[namespace]) {
|
|
2329
|
-
this.namespaces[namespace] = new IpcRendererNamespace(namespace);
|
|
2330
|
-
}
|
|
2331
|
-
return this.namespaces[namespace];
|
|
2332
|
-
}
|
|
2333
|
-
on(event, callback) {
|
|
2334
|
-
this.namespaces['/'].on(event, callback);
|
|
2335
|
-
}
|
|
2336
|
-
emit(event, ...args) {
|
|
2337
|
-
this.namespaces['/'].emit(event, ...args);
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
;
|
|
2341
|
-
({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.ts
|
|
2342
|
-
|
|
2343
2368
|
/**
|
|
2344
2369
|
* Purpose:
|
|
2345
2370
|
* - backend-browser communication between 2 processes in electron mode
|
|
@@ -2348,220 +2373,222 @@ class RealtimeStrategyIpc extends RealtimeStrategy {
|
|
|
2348
2373
|
toString() {
|
|
2349
2374
|
return 'ipc';
|
|
2350
2375
|
}
|
|
2351
|
-
establishConnection() {
|
|
2352
|
-
throw new Error('Method not implemented.');
|
|
2353
|
-
}
|
|
2354
2376
|
constructor(ctx) {
|
|
2355
2377
|
super(ctx);
|
|
2356
2378
|
this.ctx = ctx;
|
|
2357
|
-
this.contextsServers = {};
|
|
2358
|
-
this.contextsIO = {};
|
|
2359
2379
|
}
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
}
|
|
2365
|
-
const wrap = new IpcRendererWrapper(this.ctx.contextName);
|
|
2366
|
-
const nsp = wrap.of(namespacePath);
|
|
2367
|
-
this.contextsIO[namespacePath] = nsp;
|
|
2368
|
-
return nsp;
|
|
2369
|
-
});
|
|
2370
|
-
return void 0;
|
|
2380
|
+
ioServer(__, opt) {
|
|
2381
|
+
const namespace = opt?.path || '/';
|
|
2382
|
+
const server = MockServerIpc.from(this.ctx.contextName);
|
|
2383
|
+
return server.of(namespace);
|
|
2371
2384
|
}
|
|
2372
|
-
get
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
const nsp = wrap.of(namespacePath);
|
|
2379
|
-
this.contextsServers[namespacePath] = nsp;
|
|
2380
|
-
return nsp;
|
|
2381
|
-
});
|
|
2382
|
-
return void 0;
|
|
2385
|
+
get ioClient() {
|
|
2386
|
+
const clientIo = (__, opt) => {
|
|
2387
|
+
const namespace = opt?.path || '/';
|
|
2388
|
+
return new MockSocketIpc(namespace);
|
|
2389
|
+
};
|
|
2390
|
+
return clientIo;
|
|
2383
2391
|
}
|
|
2384
2392
|
}
|
|
2385
2393
|
;
|
|
2386
2394
|
({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-ipc.ts
|
|
2387
2395
|
|
|
2388
|
-
class
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
this.sockets = new Set();
|
|
2394
|
-
}
|
|
2395
|
-
on(event, callback) {
|
|
2396
|
-
if (event === 'connection') {
|
|
2397
|
-
this.sockets.forEach(socket => callback(socket));
|
|
2396
|
+
class MockServer {
|
|
2397
|
+
static { this.serverByUrl = new Map(); }
|
|
2398
|
+
static from(url) {
|
|
2399
|
+
if (!MockServer.serverByUrl.has(url)) {
|
|
2400
|
+
MockServer.serverByUrl.set(url, new MockServer(url));
|
|
2398
2401
|
}
|
|
2402
|
+
return MockServer.serverByUrl.get(url);
|
|
2399
2403
|
}
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
}
|
|
2403
|
-
to(room) {
|
|
2404
|
-
return {
|
|
2405
|
-
emit: (event, data) => {
|
|
2406
|
-
if (this.rooms[room]) {
|
|
2407
|
-
this.rooms[room].forEach(socket => socket.emit(event, data));
|
|
2408
|
-
}
|
|
2409
|
-
}
|
|
2410
|
-
};
|
|
2404
|
+
get allServers() {
|
|
2405
|
+
return Array.from(MockServer.serverByUrl.values());
|
|
2411
2406
|
}
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
this.rooms[room].add(socket);
|
|
2407
|
+
constructor(url) {
|
|
2408
|
+
this.url = url;
|
|
2409
|
+
this.namespacesByName = new Map();
|
|
2410
|
+
MockServer.serverByUrl.set(url, this);
|
|
2417
2411
|
}
|
|
2418
|
-
|
|
2419
|
-
if (this.
|
|
2420
|
-
this.
|
|
2421
|
-
if (this.rooms[room].size === 0) {
|
|
2422
|
-
delete this.rooms[room];
|
|
2423
|
-
}
|
|
2412
|
+
of(namespace) {
|
|
2413
|
+
if (!this.namespacesByName.has(namespace)) {
|
|
2414
|
+
this.namespacesByName.set(namespace, new MockNamespace(namespace, this));
|
|
2424
2415
|
}
|
|
2416
|
+
return this.namespacesByName.get(namespace);
|
|
2425
2417
|
}
|
|
2426
|
-
|
|
2427
|
-
this.
|
|
2428
|
-
}
|
|
2429
|
-
removeSocket(socket) {
|
|
2430
|
-
this.sockets.delete(socket);
|
|
2418
|
+
path() {
|
|
2419
|
+
return this.url;
|
|
2431
2420
|
}
|
|
2432
2421
|
}
|
|
2433
|
-
|
|
2434
|
-
(
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
this.
|
|
2440
|
-
this.
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2422
|
+
class MockNamespace {
|
|
2423
|
+
constructor(
|
|
2424
|
+
/**
|
|
2425
|
+
* unique namespace name
|
|
2426
|
+
*/
|
|
2427
|
+
name, server) {
|
|
2428
|
+
this.name = name;
|
|
2429
|
+
this.server = server;
|
|
2430
|
+
/**
|
|
2431
|
+
* All sockets connected to this namespace
|
|
2432
|
+
*/
|
|
2433
|
+
this.allSocketsForNamespace = new Set();
|
|
2434
|
+
/**
|
|
2435
|
+
* Rooms and their sockets
|
|
2436
|
+
*/
|
|
2437
|
+
this.socketByRoomName = {};
|
|
2438
|
+
/**
|
|
2439
|
+
* Event handlers for this namespace
|
|
2440
|
+
*/
|
|
2441
|
+
this.namespaceEventHandlers = {};
|
|
2448
2442
|
}
|
|
2449
|
-
|
|
2450
|
-
if (!this.
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
this.listeners[event] = this.listeners[event].filter(listener => listener !== callback);
|
|
2443
|
+
on(eventName, handler) {
|
|
2444
|
+
if (!this.namespaceEventHandlers[eventName]) {
|
|
2445
|
+
this.namespaceEventHandlers[eventName] =
|
|
2446
|
+
new Set();
|
|
2454
2447
|
}
|
|
2455
|
-
|
|
2456
|
-
|
|
2448
|
+
if (!this.namespaceEventHandlers[eventName].has(handler)) {
|
|
2449
|
+
this.namespaceEventHandlers[eventName].add(handler);
|
|
2457
2450
|
}
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2451
|
+
if (eventName === 'connection') {
|
|
2452
|
+
setTimeout(() => {
|
|
2453
|
+
this.emit('connection', this);
|
|
2454
|
+
});
|
|
2462
2455
|
}
|
|
2463
2456
|
}
|
|
2464
|
-
|
|
2465
|
-
this.
|
|
2457
|
+
emit(event, ...args) {
|
|
2458
|
+
this.allSocketsForNamespace?.forEach(socket => {
|
|
2459
|
+
socket.emit(event, ...args);
|
|
2460
|
+
});
|
|
2466
2461
|
}
|
|
2467
|
-
|
|
2468
|
-
this.
|
|
2462
|
+
connect(socket) {
|
|
2463
|
+
this.allSocketsForNamespace.add(socket);
|
|
2464
|
+
socket.namespaceInstance = this;
|
|
2469
2465
|
}
|
|
2470
|
-
|
|
2471
|
-
this.
|
|
2472
|
-
|
|
2473
|
-
this.listeners = {};
|
|
2466
|
+
to(roomName) {
|
|
2467
|
+
const socketsInRoom = this.socketByRoomName[roomName];
|
|
2468
|
+
return new RoomEmitter(socketsInRoom, true);
|
|
2474
2469
|
}
|
|
2475
|
-
|
|
2476
|
-
;
|
|
2477
|
-
(
|
|
2478
|
-
|
|
2479
|
-
class MockServer {
|
|
2480
|
-
constructor(contextName) {
|
|
2481
|
-
this.contextName = contextName;
|
|
2482
|
-
this.namespaces = {
|
|
2483
|
-
'/': new MockNamespace('/', this.contextName)
|
|
2484
|
-
};
|
|
2470
|
+
in(roomName) {
|
|
2471
|
+
const socketsInRoom = this.socketByRoomName[roomName];
|
|
2472
|
+
return new RoomEmitter(socketsInRoom, false);
|
|
2485
2473
|
}
|
|
2486
|
-
|
|
2487
|
-
if (!this.
|
|
2488
|
-
this.
|
|
2474
|
+
joinRoom(roomName, socket) {
|
|
2475
|
+
if (!this.socketByRoomName[roomName]) {
|
|
2476
|
+
this.socketByRoomName[roomName] = new Set();
|
|
2489
2477
|
}
|
|
2490
|
-
|
|
2478
|
+
this.socketByRoomName[roomName].add(socket);
|
|
2491
2479
|
}
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2480
|
+
leaveRoom(roomName, socket) {
|
|
2481
|
+
const roomSockets = this.socketByRoomName[roomName];
|
|
2482
|
+
if (roomSockets) {
|
|
2483
|
+
this.socketByRoomName[roomName].delete(socket);
|
|
2495
2484
|
}
|
|
2496
2485
|
}
|
|
2497
|
-
|
|
2498
|
-
this
|
|
2486
|
+
get nsp() {
|
|
2487
|
+
const self = this;
|
|
2488
|
+
return {
|
|
2489
|
+
get name() {
|
|
2490
|
+
return self.name;
|
|
2491
|
+
},
|
|
2492
|
+
};
|
|
2493
|
+
}
|
|
2494
|
+
path() {
|
|
2495
|
+
return this.name;
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
class RoomEmitter {
|
|
2499
|
+
constructor(sockets, includeSender = false, sender = null) {
|
|
2500
|
+
this.sockets = sockets;
|
|
2501
|
+
this.includeSender = includeSender;
|
|
2502
|
+
this.sender = sender;
|
|
2499
2503
|
}
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2504
|
+
emit(event, ...args) {
|
|
2505
|
+
this.sockets?.forEach(socket => {
|
|
2506
|
+
if (this.includeSender || socket !== this.sender) {
|
|
2507
|
+
socket.emit(event, ...args);
|
|
2508
|
+
}
|
|
2505
2509
|
});
|
|
2506
|
-
return socket;
|
|
2507
2510
|
}
|
|
2508
2511
|
}
|
|
2509
|
-
|
|
2510
|
-
(
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
constructor(
|
|
2514
|
-
this.
|
|
2515
|
-
this.
|
|
2516
|
-
|
|
2517
|
-
|
|
2512
|
+
class MockSocket {
|
|
2513
|
+
get id() {
|
|
2514
|
+
return this.nsp.name;
|
|
2515
|
+
}
|
|
2516
|
+
constructor(url, opts) {
|
|
2517
|
+
this.url = url;
|
|
2518
|
+
this.socketEventHandlers = {};
|
|
2519
|
+
// @ts-ignore
|
|
2520
|
+
const [baseUrl, namespace] = [url, opts.path || '/'];
|
|
2521
|
+
const namespaceName = namespace || '/';
|
|
2522
|
+
const server = MockServer.from(url);
|
|
2523
|
+
const ns = server.of(namespaceName);
|
|
2524
|
+
ns.connect(this);
|
|
2525
|
+
}
|
|
2526
|
+
get nsp() {
|
|
2527
|
+
const self = this;
|
|
2528
|
+
return {
|
|
2529
|
+
get name() {
|
|
2530
|
+
return self.namespaceInstance?.name;
|
|
2531
|
+
},
|
|
2532
|
+
};
|
|
2533
|
+
}
|
|
2534
|
+
path() {
|
|
2535
|
+
return this.namespaceInstance?.name;
|
|
2518
2536
|
}
|
|
2519
|
-
on(
|
|
2520
|
-
if (!this.
|
|
2521
|
-
this.
|
|
2537
|
+
on(eventName, handler) {
|
|
2538
|
+
if (!this.socketEventHandlers[eventName]) {
|
|
2539
|
+
this.socketEventHandlers[eventName] =
|
|
2540
|
+
new Set();
|
|
2541
|
+
}
|
|
2542
|
+
this.socketEventHandlers[eventName].add(handler);
|
|
2543
|
+
if (eventName === 'connect') {
|
|
2544
|
+
setTimeout(() => {
|
|
2545
|
+
this.emit('connect');
|
|
2546
|
+
});
|
|
2522
2547
|
}
|
|
2523
|
-
this.listeners[event].push(callback);
|
|
2524
2548
|
}
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
this.
|
|
2549
|
+
emit(eventName, ...args) {
|
|
2550
|
+
eventName = eventName || '';
|
|
2551
|
+
if (eventName.includes(`:${Symbols.REALTIME.KEYroomSubscribe}`)) {
|
|
2552
|
+
const room = args[0];
|
|
2553
|
+
this.join(room);
|
|
2554
|
+
}
|
|
2555
|
+
else if (eventName.includes(`:${Symbols.REALTIME.KEYroomUnsubscribe}`)) {
|
|
2556
|
+
const room = args[0];
|
|
2557
|
+
this.leave(room);
|
|
2530
2558
|
}
|
|
2531
2559
|
else {
|
|
2532
|
-
|
|
2560
|
+
if (this.namespaceInstance) {
|
|
2561
|
+
const namespaceEventHandlers = this.namespaceInstance.namespaceEventHandlers[eventName] || [];
|
|
2562
|
+
for (const namespaceEventHandler of namespaceEventHandlers) {
|
|
2563
|
+
if (namespaceEventHandler) {
|
|
2564
|
+
namespaceEventHandler(...args);
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
const allSocketsForNamespaceExceptCurrent = Array.from(this.namespaceInstance.allSocketsForNamespace.values()).filter(socket => socket !== this);
|
|
2568
|
+
for (const socket of allSocketsForNamespaceExceptCurrent) {
|
|
2569
|
+
const socketEventHandlers = socket.socketEventHandlers[eventName];
|
|
2570
|
+
for (const socketEventHandler of socketEventHandlers) {
|
|
2571
|
+
if (socketEventHandler) {
|
|
2572
|
+
socketEventHandler(...args);
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
const socketEventHandlers = this.socketEventHandlers[eventName] || [];
|
|
2577
|
+
for (const clientHandler of socketEventHandlers) {
|
|
2578
|
+
if (clientHandler) {
|
|
2579
|
+
clientHandler(...args);
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2533
2583
|
}
|
|
2534
2584
|
}
|
|
2535
|
-
|
|
2536
|
-
this.
|
|
2537
|
-
if (this.listeners[event]) {
|
|
2538
|
-
this.listeners[event].forEach(listener => listener(data));
|
|
2539
|
-
}
|
|
2540
|
-
}
|
|
2541
|
-
disconnect() {
|
|
2542
|
-
this.serverSocket.disconnect();
|
|
2543
|
-
this.listeners = {};
|
|
2544
|
-
}
|
|
2545
|
-
join(room) {
|
|
2546
|
-
this.serverSocket.join(room);
|
|
2585
|
+
join(roomName) {
|
|
2586
|
+
this.namespaceInstance.joinRoom(roomName, this);
|
|
2547
2587
|
}
|
|
2548
|
-
leave(
|
|
2549
|
-
this.
|
|
2588
|
+
leave(roomName) {
|
|
2589
|
+
this.namespaceInstance.leaveRoom(roomName, this);
|
|
2550
2590
|
}
|
|
2551
2591
|
}
|
|
2552
|
-
function mockIo(server) {
|
|
2553
|
-
return (namespace = '/') => {
|
|
2554
|
-
const socketId = Math.random().toString(36).substring(2);
|
|
2555
|
-
const serverSocket = server.connect(socketId, namespace);
|
|
2556
|
-
return new MockClientSocket(serverSocket, server.contextName);
|
|
2557
|
-
};
|
|
2558
|
-
}
|
|
2559
|
-
;
|
|
2560
|
-
({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.ts
|
|
2561
|
-
|
|
2562
|
-
;
|
|
2563
|
-
({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.ts
|
|
2564
|
-
|
|
2565
2592
|
/**
|
|
2566
2593
|
* Purpose:
|
|
2567
2594
|
* - browser-browser communication mock (in websql mode)
|
|
@@ -2574,15 +2601,15 @@ class RealtimeStrategyMock extends RealtimeStrategy {
|
|
|
2574
2601
|
super(ctx);
|
|
2575
2602
|
this.ctx = ctx;
|
|
2576
2603
|
}
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
;
|
|
2581
|
-
get io() {
|
|
2582
|
-
return mockIo;
|
|
2604
|
+
ioServer(url, opt) {
|
|
2605
|
+
const server = MockServer.from(url || this.ctx.uri.origin);
|
|
2606
|
+
return server.of(opt?.path || '/');
|
|
2583
2607
|
}
|
|
2584
|
-
|
|
2585
|
-
|
|
2608
|
+
get ioClient() {
|
|
2609
|
+
const clientIo = (uri, opts) => {
|
|
2610
|
+
return new MockSocket(uri || this.ctx.uri.origin, opts);
|
|
2611
|
+
};
|
|
2612
|
+
return clientIo;
|
|
2586
2613
|
}
|
|
2587
2614
|
}
|
|
2588
2615
|
;
|
|
@@ -2601,18 +2628,14 @@ class RealtimeStrategySocketIO extends RealtimeStrategy {
|
|
|
2601
2628
|
super(ctx);
|
|
2602
2629
|
this.ctx = ctx;
|
|
2603
2630
|
}
|
|
2604
|
-
|
|
2631
|
+
ioServer(...args) {
|
|
2605
2632
|
/* */
|
|
2606
2633
|
/* */
|
|
2607
2634
|
return (void 0);
|
|
2608
2635
|
}
|
|
2609
|
-
|
|
2610
|
-
get io() {
|
|
2636
|
+
get ioClient() {
|
|
2611
2637
|
return io;
|
|
2612
2638
|
}
|
|
2613
|
-
establishConnection() {
|
|
2614
|
-
throw new Error('Method not implemented.');
|
|
2615
|
-
}
|
|
2616
2639
|
}
|
|
2617
2640
|
;
|
|
2618
2641
|
({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-socket-io.ts
|
|
@@ -2639,14 +2662,22 @@ class RealtimeCore {
|
|
|
2639
2662
|
'OPTIONS',
|
|
2640
2663
|
'HEAD',
|
|
2641
2664
|
];
|
|
2665
|
+
this.ctx = ctx;
|
|
2642
2666
|
this.strategy = this.resolveStrategy();
|
|
2643
|
-
ctx.
|
|
2667
|
+
this.ctx.logRealtime &&
|
|
2644
2668
|
console.log(`[taon] realtime strategy: ${this.strategy}`);
|
|
2645
|
-
|
|
2646
|
-
|
|
2669
|
+
if (Helpers.isWebSQL) {
|
|
2670
|
+
this.server = new RealtimeServer(this);
|
|
2671
|
+
this.client = new RealtimeClient(this);
|
|
2672
|
+
}
|
|
2673
|
+
else {
|
|
2674
|
+
this.client = new RealtimeClient(this);
|
|
2675
|
+
this.server = new RealtimeServer(this);
|
|
2676
|
+
}
|
|
2647
2677
|
}
|
|
2648
2678
|
resolveStrategy() {
|
|
2649
|
-
if (this.ctx.mode === 'backend-frontend(websql)'
|
|
2679
|
+
if (this.ctx.mode === 'backend-frontend(websql)' ||
|
|
2680
|
+
this.ctx.mode === 'backend-frontend(websql-electron)') {
|
|
2650
2681
|
return new RealtimeStrategyMock(this.ctx);
|
|
2651
2682
|
}
|
|
2652
2683
|
if (this.ctx.mode === 'backend-frontend(ipc-electron)') {
|
|
@@ -2659,179 +2690,17 @@ class RealtimeCore {
|
|
|
2659
2690
|
let nsp = namespace ? namespace : '';
|
|
2660
2691
|
nsp = nsp === '/' ? '' : nsp;
|
|
2661
2692
|
const pathname = uri.pathname !== '/' ? uri.pathname : '';
|
|
2662
|
-
let prefix = `taonContext
|
|
2693
|
+
let prefix = `taonContext`;
|
|
2663
2694
|
if (Helpers.isElectron) {
|
|
2664
2695
|
prefix = ``;
|
|
2665
2696
|
}
|
|
2666
|
-
const href = `${uri.origin}${pathname}/${prefix}${nsp}`;
|
|
2697
|
+
const href = `${uri.origin}${pathname}/${prefix}${prefix && nsp ? '-' + nsp : nsp}`;
|
|
2667
2698
|
return new URL(href);
|
|
2668
2699
|
}
|
|
2669
2700
|
}
|
|
2670
2701
|
;
|
|
2671
2702
|
({}); // @--end-of-file-for-module=taon lib/realtime/realtime-core.ts
|
|
2672
2703
|
|
|
2673
|
-
class TaonSubscriberOptions extends Models.DecoratorAbstractOpt {
|
|
2674
|
-
}
|
|
2675
|
-
function TaonSubscriber(options) {
|
|
2676
|
-
return function (constructor) {
|
|
2677
|
-
Reflect.defineMetadata(Symbols.metadata.options.repository, options, constructor);
|
|
2678
|
-
Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
|
|
2679
|
-
ClassHelpers.setName(constructor, options?.className);
|
|
2680
|
-
return class extends constructor {
|
|
2681
|
-
constructor(...args) {
|
|
2682
|
-
super(...args);
|
|
2683
|
-
const methodNamesAll = ClassHelpers.getMethodsNames(constructor.prototype);
|
|
2684
|
-
const methodNames = methodNamesAll.filter(m => {
|
|
2685
|
-
return (!['__trigger_event__', 'clone'].includes(m) &&
|
|
2686
|
-
!m.startsWith('_') &&
|
|
2687
|
-
!m.startsWith('inject'));
|
|
2688
|
-
});
|
|
2689
|
-
methodNames.forEach(methodName => {
|
|
2690
|
-
const originalMethod = this[methodName];
|
|
2691
|
-
this[methodName] = async (...methodArgs) => {
|
|
2692
|
-
const result = originalMethod.apply(this, methodArgs);
|
|
2693
|
-
if (result instanceof Promise) {
|
|
2694
|
-
await result;
|
|
2695
|
-
}
|
|
2696
|
-
if (options.allowedEvents === undefined ||
|
|
2697
|
-
options.allowedEvents.includes(methodName)) {
|
|
2698
|
-
// @ts-ignore
|
|
2699
|
-
this.__trigger_event__(methodName);
|
|
2700
|
-
}
|
|
2701
|
-
return result;
|
|
2702
|
-
};
|
|
2703
|
-
});
|
|
2704
|
-
}
|
|
2705
|
-
};
|
|
2706
|
-
};
|
|
2707
|
-
}
|
|
2708
|
-
;
|
|
2709
|
-
({}); // @--end-of-file-for-module=taon lib/decorators/classes/subscriber-decorator.ts
|
|
2710
|
-
|
|
2711
|
-
let BaseSubscriberForEntity = class BaseSubscriberForEntity extends BaseInjector {
|
|
2712
|
-
/**
|
|
2713
|
-
* Called after entity is loaded.
|
|
2714
|
-
*/
|
|
2715
|
-
afterLoad(entity) {
|
|
2716
|
-
console.log(`AFTER ENTITY LOADED: `, entity);
|
|
2717
|
-
}
|
|
2718
|
-
/**
|
|
2719
|
-
* Called before query execution.
|
|
2720
|
-
*/
|
|
2721
|
-
beforeQuery(event) {
|
|
2722
|
-
console.log(`BEFORE QUERY: `, event.query);
|
|
2723
|
-
}
|
|
2724
|
-
/**
|
|
2725
|
-
* Called after query execution.
|
|
2726
|
-
*/
|
|
2727
|
-
afterQuery(event) {
|
|
2728
|
-
console.log(`AFTER QUERY: `, event.query);
|
|
2729
|
-
}
|
|
2730
|
-
/**
|
|
2731
|
-
* Called before entity insertion.
|
|
2732
|
-
*/
|
|
2733
|
-
beforeInsert(event) {
|
|
2734
|
-
console.log(`BEFORE ENTITY INSERTED: `, event.entity);
|
|
2735
|
-
}
|
|
2736
|
-
/**
|
|
2737
|
-
* Called after entity insertion.
|
|
2738
|
-
*/
|
|
2739
|
-
afterInsert(event) {
|
|
2740
|
-
console.log(`AFTER ENTITY INSERTED: `, event.entity);
|
|
2741
|
-
}
|
|
2742
|
-
/**
|
|
2743
|
-
* Called before entity update.
|
|
2744
|
-
*/
|
|
2745
|
-
beforeUpdate(event) {
|
|
2746
|
-
console.log(`BEFORE ENTITY UPDATED: `, event.entity);
|
|
2747
|
-
}
|
|
2748
|
-
/**
|
|
2749
|
-
* Called after entity update.
|
|
2750
|
-
*/
|
|
2751
|
-
afterUpdate(event) {
|
|
2752
|
-
console.log(`AFTER ENTITY UPDATED: `, event.entity);
|
|
2753
|
-
}
|
|
2754
|
-
/**
|
|
2755
|
-
* Called before entity removal.
|
|
2756
|
-
*/
|
|
2757
|
-
beforeRemove(event) {
|
|
2758
|
-
console.log(`BEFORE ENTITY WITH ID ${event.entityId} REMOVED: `, event.entity);
|
|
2759
|
-
}
|
|
2760
|
-
/**
|
|
2761
|
-
* Called after entity removal.
|
|
2762
|
-
*/
|
|
2763
|
-
afterRemove(event) {
|
|
2764
|
-
console.log(`AFTER ENTITY WITH ID ${event.entityId} REMOVED: `, event.entity);
|
|
2765
|
-
}
|
|
2766
|
-
/**
|
|
2767
|
-
* Called before entity removal.
|
|
2768
|
-
*/
|
|
2769
|
-
beforeSoftRemove(event) {
|
|
2770
|
-
console.log(`BEFORE ENTITY WITH ID ${event.entityId} SOFT REMOVED: `, event.entity);
|
|
2771
|
-
}
|
|
2772
|
-
/**
|
|
2773
|
-
* Called after entity removal.
|
|
2774
|
-
*/
|
|
2775
|
-
afterSoftRemove(event) {
|
|
2776
|
-
console.log(`AFTER ENTITY WITH ID ${event.entityId} SOFT REMOVED: `, event.entity);
|
|
2777
|
-
}
|
|
2778
|
-
/**
|
|
2779
|
-
* Called before entity recovery.
|
|
2780
|
-
*/
|
|
2781
|
-
beforeRecover(event) {
|
|
2782
|
-
console.log(`BEFORE ENTITY WITH ID ${event.entityId} RECOVERED: `, event.entity);
|
|
2783
|
-
}
|
|
2784
|
-
/**
|
|
2785
|
-
* Called after entity recovery.
|
|
2786
|
-
*/
|
|
2787
|
-
afterRecover(event) {
|
|
2788
|
-
console.log(`AFTER ENTITY WITH ID ${event.entityId} RECOVERED: `, event.entity);
|
|
2789
|
-
}
|
|
2790
|
-
/**
|
|
2791
|
-
* Called before transaction start.
|
|
2792
|
-
*/
|
|
2793
|
-
beforeTransactionStart(event) {
|
|
2794
|
-
console.log(`BEFORE TRANSACTION STARTED: `, event);
|
|
2795
|
-
}
|
|
2796
|
-
/**
|
|
2797
|
-
* Called after transaction start.
|
|
2798
|
-
*/
|
|
2799
|
-
afterTransactionStart(event) {
|
|
2800
|
-
console.log(`AFTER TRANSACTION STARTED: `, event);
|
|
2801
|
-
}
|
|
2802
|
-
/**
|
|
2803
|
-
* Called before transaction commit.
|
|
2804
|
-
*/
|
|
2805
|
-
beforeTransactionCommit(event) {
|
|
2806
|
-
console.log(`BEFORE TRANSACTION COMMITTED: `, event);
|
|
2807
|
-
}
|
|
2808
|
-
/**
|
|
2809
|
-
* Called after transaction commit.
|
|
2810
|
-
*/
|
|
2811
|
-
afterTransactionCommit(event) {
|
|
2812
|
-
console.log(`AFTER TRANSACTION COMMITTED: `, event);
|
|
2813
|
-
}
|
|
2814
|
-
/**
|
|
2815
|
-
* Called before transaction rollback.
|
|
2816
|
-
*/
|
|
2817
|
-
beforeTransactionRollback(event) {
|
|
2818
|
-
console.log(`BEFORE TRANSACTION ROLLBACK: `, event);
|
|
2819
|
-
}
|
|
2820
|
-
/**
|
|
2821
|
-
* Called after transaction rollback.
|
|
2822
|
-
*/
|
|
2823
|
-
afterTransactionRollback(event) {
|
|
2824
|
-
console.log(`AFTER TRANSACTION ROLLBACK: `, event);
|
|
2825
|
-
}
|
|
2826
|
-
};
|
|
2827
|
-
BaseSubscriberForEntity = __decorate([
|
|
2828
|
-
TaonSubscriber({
|
|
2829
|
-
className: 'BaseSubscriberForEntity',
|
|
2830
|
-
})
|
|
2831
|
-
], BaseSubscriberForEntity);
|
|
2832
|
-
;
|
|
2833
|
-
({}); // @--end-of-file-for-module=taon lib/base-classes/base-subscriber-for-entity.ts
|
|
2834
|
-
|
|
2835
2704
|
/* eslint-disable @typescript-eslint/typedef */
|
|
2836
2705
|
class EndpointContext {
|
|
2837
2706
|
static initNgZone(ngZone) {
|
|
@@ -2982,7 +2851,12 @@ class EndpointContext {
|
|
|
2982
2851
|
this.mode = 'remote-backend(tcp+udp)';
|
|
2983
2852
|
}
|
|
2984
2853
|
if (this.config.useIpcWhenElectron && Helpers.isElectron) {
|
|
2985
|
-
|
|
2854
|
+
if (Helpers.isWebSQL) {
|
|
2855
|
+
this.mode = 'backend-frontend(websql-electron)';
|
|
2856
|
+
}
|
|
2857
|
+
else {
|
|
2858
|
+
this.mode = 'backend-frontend(ipc-electron)';
|
|
2859
|
+
}
|
|
2986
2860
|
}
|
|
2987
2861
|
if (!this.mode && !this.config.abstract) {
|
|
2988
2862
|
Helpers.error(`[taon] Context "${this.contextName}": You need to provide host or remoteHost or useIpcWhenElectron`, false, true);
|
|
@@ -3139,6 +3013,7 @@ class EndpointContext {
|
|
|
3139
3013
|
logging: this.logDb,
|
|
3140
3014
|
};
|
|
3141
3015
|
break;
|
|
3016
|
+
case 'backend-frontend(websql-electron)':
|
|
3142
3017
|
case 'backend-frontend(websql)':
|
|
3143
3018
|
databaseConfig = {
|
|
3144
3019
|
location: `tmp-db-${_.kebabCase(this.contextName)}.sqljs`,
|
|
@@ -3447,19 +3322,10 @@ class EndpointContext {
|
|
|
3447
3322
|
return this.uri?.origin;
|
|
3448
3323
|
}
|
|
3449
3324
|
async initSubscribers() {
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
const subscribers = this.getClassFunByArr(Models.ClassType.SUBSCRIBER);
|
|
3455
|
-
for (const subscriber of subscribers) {
|
|
3456
|
-
const options = Reflect.getMetadata(Symbols.metadata.options.subscriber, subscriber);
|
|
3457
|
-
EventSubscriber()(subscriber);
|
|
3458
|
-
}
|
|
3459
|
-
console.log(this.config.subscribers);
|
|
3460
|
-
return;
|
|
3461
|
-
const entities = this.getClassFunByArr(Models.ClassType.ENTITY);
|
|
3462
|
-
for (let index = 0; index < entities.length; index++) {
|
|
3325
|
+
const subscriberClasses = this.getClassFunByArr(Models.ClassType.SUBSCRIBER);
|
|
3326
|
+
for (const subscriberClassFn of subscriberClasses) {
|
|
3327
|
+
const options = Reflect.getMetadata(Symbols.metadata.options.subscriber, subscriberClassFn);
|
|
3328
|
+
EventSubscriber()(subscriberClassFn);
|
|
3463
3329
|
}
|
|
3464
3330
|
}
|
|
3465
3331
|
async initEntities() {
|
|
@@ -3487,9 +3353,9 @@ class EndpointContext {
|
|
|
3487
3353
|
: this.getClassFunByArr(Models.ClassType.ENTITY)).map(entityFn => {
|
|
3488
3354
|
return ClassHelpers.getOrginalClass(entityFn);
|
|
3489
3355
|
});
|
|
3490
|
-
const subscribers =
|
|
3356
|
+
const subscribers = this.config.override?.subscribers
|
|
3491
3357
|
? this.config.override.subscribers
|
|
3492
|
-
: this.getClassFunByArr(Models.ClassType.SUBSCRIBER)
|
|
3358
|
+
: this.getClassFunByArr(Models.ClassType.SUBSCRIBER);
|
|
3493
3359
|
const dataSourceDbConfig = _.isObject(this.databaseConfig)
|
|
3494
3360
|
? {
|
|
3495
3361
|
type: this.databaseConfig.type,
|
|
@@ -3508,6 +3374,8 @@ class EndpointContext {
|
|
|
3508
3374
|
location: this.databaseConfig.location,
|
|
3509
3375
|
}
|
|
3510
3376
|
: {};
|
|
3377
|
+
this.logFramework &&
|
|
3378
|
+
console.log(`[Context: "${this.contextName}"] dataSourceDbConfig`, dataSourceDbConfig);
|
|
3511
3379
|
if (this.modeAllowsDatabaseCreation && this.databaseConfig) {
|
|
3512
3380
|
this.logDb &&
|
|
3513
3381
|
this.logFramework &&
|
|
@@ -4329,6 +4197,7 @@ const createContext = (configFn) => {
|
|
|
4329
4197
|
return config.contextName;
|
|
4330
4198
|
},
|
|
4331
4199
|
/**
|
|
4200
|
+
* @deprecated
|
|
4332
4201
|
* - get reference to internal context
|
|
4333
4202
|
*/
|
|
4334
4203
|
async __ref() {
|
|
@@ -4339,6 +4208,10 @@ const createContext = (configFn) => {
|
|
|
4339
4208
|
}
|
|
4340
4209
|
return endpointContextRef;
|
|
4341
4210
|
},
|
|
4211
|
+
/**
|
|
4212
|
+
* only for internal use
|
|
4213
|
+
* @deprecated
|
|
4214
|
+
*/
|
|
4342
4215
|
get __refSync() {
|
|
4343
4216
|
return endpointContextRef;
|
|
4344
4217
|
},
|
|
@@ -4380,6 +4253,20 @@ const createContext = (configFn) => {
|
|
|
4380
4253
|
});
|
|
4381
4254
|
});
|
|
4382
4255
|
},
|
|
4256
|
+
/**
|
|
4257
|
+
* realtime communication with server
|
|
4258
|
+
* Udp socket.io (or ipc) based.
|
|
4259
|
+
*/
|
|
4260
|
+
get realtime() {
|
|
4261
|
+
return {
|
|
4262
|
+
get client() {
|
|
4263
|
+
return endpointContextRef.realtimeClient;
|
|
4264
|
+
},
|
|
4265
|
+
get server() {
|
|
4266
|
+
return endpointContextRef.realtimeServer;
|
|
4267
|
+
}
|
|
4268
|
+
};
|
|
4269
|
+
},
|
|
4383
4270
|
};
|
|
4384
4271
|
return res;
|
|
4385
4272
|
};
|
|
@@ -4402,19 +4289,160 @@ var baseContext = /*#__PURE__*/Object.freeze({
|
|
|
4402
4289
|
BaseContext: BaseContext
|
|
4403
4290
|
});
|
|
4404
4291
|
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4292
|
+
function TaonSubscriber(options) {
|
|
4293
|
+
return function (constructor) {
|
|
4294
|
+
Reflect.defineMetadata(Symbols.metadata.options.repository, options, constructor);
|
|
4295
|
+
Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
|
|
4296
|
+
ClassHelpers.setName(constructor, options?.className);
|
|
4297
|
+
};
|
|
4298
|
+
}
|
|
4299
|
+
class TaonSubscriberOptions extends Models.DecoratorAbstractOpt {
|
|
4300
|
+
}
|
|
4301
|
+
;
|
|
4302
|
+
({}); // @--end-of-file-for-module=taon lib/decorators/classes/subscriber-decorator.ts
|
|
4303
|
+
|
|
4304
|
+
let BaseSubscriberForEntity = class BaseSubscriberForEntity extends BaseInjector {
|
|
4305
|
+
/**
|
|
4306
|
+
* Called after entity is loaded.
|
|
4307
|
+
*/
|
|
4308
|
+
afterLoad(entity) {
|
|
4309
|
+
this.__endpoint_context__.logDb &&
|
|
4310
|
+
console.log(`AFTER ENTITY LOADED: `, entity);
|
|
4311
|
+
}
|
|
4312
|
+
/**
|
|
4313
|
+
* Called before query execution.
|
|
4314
|
+
*/
|
|
4315
|
+
beforeQuery(event) {
|
|
4316
|
+
this.__endpoint_context__.logDb &&
|
|
4317
|
+
console.log(`BEFORE QUERY: `, event.query);
|
|
4318
|
+
}
|
|
4319
|
+
/**
|
|
4320
|
+
* Called after query execution.
|
|
4321
|
+
*/
|
|
4322
|
+
afterQuery(event) {
|
|
4323
|
+
this.__endpoint_context__.logDb &&
|
|
4324
|
+
console.log(`AFTER QUERY: `, event.query);
|
|
4325
|
+
}
|
|
4326
|
+
/**
|
|
4327
|
+
* Called before entity insertion.
|
|
4328
|
+
*/
|
|
4329
|
+
beforeInsert(event) {
|
|
4330
|
+
this.__endpoint_context__.logDb &&
|
|
4331
|
+
console.log(`BEFORE ENTITY INSERTED: `, event.entity);
|
|
4332
|
+
}
|
|
4333
|
+
/**
|
|
4334
|
+
* Called after entity insertion.
|
|
4335
|
+
*/
|
|
4336
|
+
afterInsert(event) {
|
|
4337
|
+
this.__endpoint_context__.logDb &&
|
|
4338
|
+
console.log(`AFTER ENTITY INSERTED: `, event.entity);
|
|
4339
|
+
}
|
|
4340
|
+
/**
|
|
4341
|
+
* Called before entity update.
|
|
4342
|
+
*/
|
|
4343
|
+
beforeUpdate(event) {
|
|
4344
|
+
this.__endpoint_context__.logDb &&
|
|
4345
|
+
console.log(`BEFORE ENTITY UPDATED: `, event.entity);
|
|
4346
|
+
}
|
|
4347
|
+
/**
|
|
4348
|
+
* Called after entity update.
|
|
4349
|
+
*/
|
|
4350
|
+
afterUpdate(event) {
|
|
4351
|
+
this.__endpoint_context__.logDb &&
|
|
4352
|
+
console.log(`AFTER ENTITY UPDATED: `, event.entity);
|
|
4353
|
+
}
|
|
4354
|
+
/**
|
|
4355
|
+
* Called before entity removal.
|
|
4356
|
+
*/
|
|
4357
|
+
beforeRemove(event) {
|
|
4358
|
+
this.__endpoint_context__.logDb &&
|
|
4359
|
+
console.log(`BEFORE ENTITY WITH ID ${event.entityId} REMOVED: `, event.entity);
|
|
4360
|
+
}
|
|
4361
|
+
/**
|
|
4362
|
+
* Called after entity removal.
|
|
4363
|
+
*/
|
|
4364
|
+
afterRemove(event) {
|
|
4365
|
+
this.__endpoint_context__.logDb &&
|
|
4366
|
+
console.log(`AFTER ENTITY WITH ID ${event.entityId} REMOVED: `, event.entity);
|
|
4367
|
+
}
|
|
4368
|
+
/**
|
|
4369
|
+
* Called before entity removal.
|
|
4370
|
+
*/
|
|
4371
|
+
beforeSoftRemove(event) {
|
|
4372
|
+
this.__endpoint_context__.logDb &&
|
|
4373
|
+
console.log(`BEFORE ENTITY WITH ID ${event.entityId} SOFT REMOVED: `, event.entity);
|
|
4374
|
+
}
|
|
4375
|
+
/**
|
|
4376
|
+
* Called after entity removal.
|
|
4377
|
+
*/
|
|
4378
|
+
afterSoftRemove(event) {
|
|
4379
|
+
this.__endpoint_context__.logDb &&
|
|
4380
|
+
console.log(`AFTER ENTITY WITH ID ${event.entityId} SOFT REMOVED: `, event.entity);
|
|
4381
|
+
}
|
|
4382
|
+
/**
|
|
4383
|
+
* Called before entity recovery.
|
|
4384
|
+
*/
|
|
4385
|
+
beforeRecover(event) {
|
|
4386
|
+
this.__endpoint_context__.logDb &&
|
|
4387
|
+
console.log(`BEFORE ENTITY WITH ID ${event.entityId} RECOVERED: `, event.entity);
|
|
4388
|
+
}
|
|
4389
|
+
/**
|
|
4390
|
+
* Called after entity recovery.
|
|
4391
|
+
*/
|
|
4392
|
+
afterRecover(event) {
|
|
4393
|
+
this.__endpoint_context__.logDb &&
|
|
4394
|
+
console.log(`AFTER ENTITY WITH ID ${event.entityId} RECOVERED: `, event.entity);
|
|
4395
|
+
}
|
|
4396
|
+
/**
|
|
4397
|
+
* Called before transaction start.
|
|
4398
|
+
*/
|
|
4399
|
+
beforeTransactionStart(event) {
|
|
4400
|
+
this.__endpoint_context__.logDb &&
|
|
4401
|
+
console.log(`BEFORE TRANSACTION STARTED: `, event);
|
|
4402
|
+
}
|
|
4403
|
+
/**
|
|
4404
|
+
* Called after transaction start.
|
|
4405
|
+
*/
|
|
4406
|
+
afterTransactionStart(event) {
|
|
4407
|
+
this.__endpoint_context__.logDb &&
|
|
4408
|
+
console.log(`AFTER TRANSACTION STARTED: `, event);
|
|
4409
|
+
}
|
|
4410
|
+
/**
|
|
4411
|
+
* Called before transaction commit.
|
|
4412
|
+
*/
|
|
4413
|
+
beforeTransactionCommit(event) {
|
|
4414
|
+
this.__endpoint_context__.logDb &&
|
|
4415
|
+
console.log(`BEFORE TRANSACTION COMMITTED: `, event);
|
|
4416
|
+
}
|
|
4417
|
+
/**
|
|
4418
|
+
* Called after transaction commit.
|
|
4419
|
+
*/
|
|
4420
|
+
afterTransactionCommit(event) {
|
|
4421
|
+
this.__endpoint_context__.logDb &&
|
|
4422
|
+
console.log(`AFTER TRANSACTION COMMITTED: `, event);
|
|
4423
|
+
}
|
|
4424
|
+
/**
|
|
4425
|
+
* Called before transaction rollback.
|
|
4426
|
+
*/
|
|
4427
|
+
beforeTransactionRollback(event) {
|
|
4428
|
+
this.__endpoint_context__.logDb &&
|
|
4429
|
+
console.log(`BEFORE TRANSACTION ROLLBACK: `, event);
|
|
4430
|
+
}
|
|
4431
|
+
/**
|
|
4432
|
+
* Called after transaction rollback.
|
|
4433
|
+
*/
|
|
4434
|
+
afterTransactionRollback(event) {
|
|
4435
|
+
this.__endpoint_context__.logDb &&
|
|
4436
|
+
console.log(`AFTER TRANSACTION ROLLBACK: `, event);
|
|
4409
4437
|
}
|
|
4410
4438
|
};
|
|
4411
|
-
|
|
4439
|
+
BaseSubscriberForEntity = __decorate([
|
|
4412
4440
|
TaonSubscriber({
|
|
4413
|
-
className: '
|
|
4441
|
+
className: 'BaseSubscriberForEntity',
|
|
4414
4442
|
})
|
|
4415
|
-
],
|
|
4443
|
+
], BaseSubscriberForEntity);
|
|
4416
4444
|
;
|
|
4417
|
-
({}); // @--end-of-file-for-module=taon lib/base-classes/base-subscriber.ts
|
|
4445
|
+
({}); // @--end-of-file-for-module=taon lib/base-classes/base-subscriber-for-entity.ts
|
|
4418
4446
|
|
|
4419
4447
|
var Base;
|
|
4420
4448
|
(function (Base) {
|
|
@@ -4425,7 +4453,6 @@ var Base;
|
|
|
4425
4453
|
Base.Provider = BaseProvider;
|
|
4426
4454
|
Base.Class = BaseClass;
|
|
4427
4455
|
Base.Repository = BaseRepository;
|
|
4428
|
-
Base.Subscriber = BaseSubscriber;
|
|
4429
4456
|
Base.SubscriberForEntity = BaseSubscriberForEntity;
|
|
4430
4457
|
Base.Context = BaseContext;
|
|
4431
4458
|
})(Base || (Base = {}));
|
|
@@ -4490,42 +4517,9 @@ const inject = (entity) => {
|
|
|
4490
4517
|
},
|
|
4491
4518
|
});
|
|
4492
4519
|
};
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
const obs = eventsSrc.asObservable();
|
|
4497
|
-
let isFirstSubscription = true;
|
|
4498
|
-
const proxiedObservable = new Proxy(obs, {
|
|
4499
|
-
get(target, prop, receiver) {
|
|
4500
|
-
if (prop === 'subscribe') {
|
|
4501
|
-
return (...args) => {
|
|
4502
|
-
if (isFirstSubscription) {
|
|
4503
|
-
isFirstSubscription = false;
|
|
4504
|
-
const subscriberClassFN = subscriberClassResolveFn();
|
|
4505
|
-
const ctx = subscriberClassFN[Symbols.ctxInClassOrClassObj];
|
|
4506
|
-
if (!ctx) {
|
|
4507
|
-
throw new Error(`You are trying to inject class without context. Use context like this;
|
|
4508
|
-
|
|
4509
|
-
Taon.injectSubscriberEvents( ()=> ` +
|
|
4510
|
-
`MyContext.getInstance(${subscriberClassFN?.name}), '${eventName}' )
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
`);
|
|
4514
|
-
}
|
|
4515
|
-
const subscriberInstance = ctx.getInstanceBy(subscriberClassFN);
|
|
4516
|
-
console.log('First subscription, you can access arguments here:', {
|
|
4517
|
-
subscriberClassFN,
|
|
4518
|
-
eventName,
|
|
4519
|
-
});
|
|
4520
|
-
}
|
|
4521
|
-
return target.subscribe(...args);
|
|
4522
|
-
};
|
|
4523
|
-
}
|
|
4524
|
-
return Reflect.get(target, prop, receiver);
|
|
4525
|
-
},
|
|
4526
|
-
});
|
|
4527
|
-
return proxiedObservable;
|
|
4528
|
-
};
|
|
4520
|
+
/**
|
|
4521
|
+
* TODO
|
|
4522
|
+
*/
|
|
4529
4523
|
;
|
|
4530
4524
|
({}); // @--end-of-file-for-module=taon lib/inject.ts
|
|
4531
4525
|
|
|
@@ -4543,21 +4537,9 @@ var Taon;
|
|
|
4543
4537
|
Taon.Provider = TaonProvider;
|
|
4544
4538
|
Taon.Repository = TaonRepository;
|
|
4545
4539
|
Taon.Subscriber = TaonSubscriber;
|
|
4546
|
-
/**
|
|
4547
|
-
* @deprecated
|
|
4548
|
-
*/
|
|
4549
4540
|
Taon.isBrowser = coreHelpers.Helpers.isBrowser;
|
|
4550
|
-
/**
|
|
4551
|
-
* @deprecated
|
|
4552
|
-
*/
|
|
4553
4541
|
Taon.isNode = coreHelpers.Helpers.isNode;
|
|
4554
|
-
/**
|
|
4555
|
-
* @deprecated
|
|
4556
|
-
*/
|
|
4557
4542
|
Taon.isWebSQL = coreHelpers.Helpers.isWebSQL;
|
|
4558
|
-
/**
|
|
4559
|
-
* @deprecated
|
|
4560
|
-
*/
|
|
4561
4543
|
Taon.isElectron = coreHelpers.Helpers.isElectron;
|
|
4562
4544
|
Taon.createContext = createContext;
|
|
4563
4545
|
Taon.inject = inject;
|
|
@@ -4591,5 +4573,5 @@ var Taon;
|
|
|
4591
4573
|
* Generated bundle index. Do not edit.
|
|
4592
4574
|
*/
|
|
4593
4575
|
|
|
4594
|
-
export { BaseContext, BaseController, BaseEntity, BaseProvider, BaseRepository,
|
|
4576
|
+
export { BaseContext, BaseController, BaseEntity, BaseProvider, BaseRepository, ClassHelpers, Models, Taon, createContext, inject };
|
|
4595
4577
|
//# sourceMappingURL=taon.mjs.map
|