taon 18.0.17 → 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.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 +33 -30
- 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.d.ts +0 -0
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/index.js +0 -5
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/index.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.d.ts +0 -22
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.js +0 -139
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-namespace.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.d.ts +0 -16
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.js +0 -68
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-main-wrapper.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.d.ts +0 -10
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.js +0 -56
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.d.ts +0 -10
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.js +0 -50
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.d.ts +0 -13
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.js +0 -3
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc.models.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.d.ts +0 -2
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.js +0 -6
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.d.ts +0 -16
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.js +0 -54
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.d.ts +0 -17
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.js +0 -52
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-namespaces.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.d.ts +0 -11
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.js +0 -39
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-server.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.d.ts +0 -13
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.js +0 -46
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-socket.js.map +0 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.d.ts +0 -11
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.js +0 -3
- package/lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock.models.js.map +0 -1
- package/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/client/fesm2022/taon.mjs
CHANGED
|
@@ -23,45 +23,52 @@ var Symbols;
|
|
|
23
23
|
Symbols.orignalClass = OrignalClassKey;
|
|
24
24
|
Symbols.orignalClassClonesObj = `$$originalClassClonesObj$$`;
|
|
25
25
|
Symbols.classMethodsNames = `$$classMethodsNames$$`;
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
/**
|
|
27
|
+
* for backendSocket.in(ROOM_NAME).emit(EVENT)
|
|
28
|
+
*
|
|
29
|
+
* Room names are uniqe..
|
|
30
|
+
* here I am limiting number of event for clients.
|
|
31
|
+
*/
|
|
32
|
+
class Realtime {
|
|
33
|
+
constructor() {
|
|
34
|
+
this.KEYroomSubscribe = `roomSubscribe`;
|
|
35
|
+
this.KEYroomUnsubscribe = `roomUnsubscribe`;
|
|
36
|
+
}
|
|
37
|
+
NAMESPACE(contextName) {
|
|
38
|
+
return `${contextName}-taonRealtimeNsp`;
|
|
39
|
+
}
|
|
28
40
|
TABLE_CHANGE(contextName, tableName) {
|
|
29
41
|
return `${contextName}:listentablename${tableName}`;
|
|
30
|
-
}
|
|
31
|
-
|
|
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
|
-
ENTITY_UPDATE_EVENTS: (contextName) => `${contextName}:roomUnsubscribeEntityEvents`,
|
|
61
|
-
ENTITY_PROPERTY_UPDATE_EVENTS: (contextName) => `${contextName}:roomUnsubscribeEntityPropertyEvents`,
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
};
|
|
42
|
+
}
|
|
43
|
+
ROOM_NAME_CUSTOM(contextName, customEvent) {
|
|
44
|
+
return `${contextName}:CustomRoomEvent${customEvent}`;
|
|
45
|
+
}
|
|
46
|
+
ROOM_SUBSCRIBE_CUSTOM(contextName) {
|
|
47
|
+
return `${contextName}:${this.KEYroomSubscribe}CustomRoomEvent`;
|
|
48
|
+
}
|
|
49
|
+
ROOM_UNSUBSCRIBE_CUSTOM(contextName) {
|
|
50
|
+
return `${contextName}:${this.KEYroomUnsubscribe}CustomRoomEvent`;
|
|
51
|
+
}
|
|
52
|
+
ROOM_NAME_UPDATE_ENTITY(contextName, className, entityId) {
|
|
53
|
+
return `${contextName}:room${_.camelCase(className)}${entityId}`.toLowerCase();
|
|
54
|
+
}
|
|
55
|
+
ROOM_SUBSCRIBE_ENTITY_UPDATE_EVENTS(contextName) {
|
|
56
|
+
return `${contextName}:${this.KEYroomSubscribe}EntityEvents`;
|
|
57
|
+
}
|
|
58
|
+
ROOM_UNSUBSCRIBE_ENTITY_UPDATE_EVENTS(contextName) {
|
|
59
|
+
return `${contextName}:${this.KEYroomUnsubscribe}EntityEvents`;
|
|
60
|
+
}
|
|
61
|
+
ROOM_NAME_UPDATE_ENTITY_PROPERTY(contextName, className, property, entityId) {
|
|
62
|
+
return `${contextName}:room${_.camelCase(className)}${_.camelCase(property)}${entityId}`.toLowerCase();
|
|
63
|
+
}
|
|
64
|
+
ROOM_SUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(contextName) {
|
|
65
|
+
return `${contextName}:${this.KEYroomSubscribe}EntityPropertyEvents`;
|
|
66
|
+
}
|
|
67
|
+
ROOM_UNSUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(contextName) {
|
|
68
|
+
return `${contextName}:${this.KEYroomUnsubscribe}EntityPropertyEvents`;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
Symbols.REALTIME = new Realtime();
|
|
65
72
|
Symbols.metadata = {
|
|
66
73
|
className: `class:realname`,
|
|
67
74
|
options: {
|
|
@@ -341,7 +348,7 @@ var ClassHelpers;
|
|
|
341
348
|
: classFnOrObject?.constructor[Symbols.fullClassNameStaticProperty]) ||
|
|
342
349
|
void 0);
|
|
343
350
|
};
|
|
344
|
-
ClassHelpers.
|
|
351
|
+
ClassHelpers.getUniqueKey = (classFnOrObject) => {
|
|
345
352
|
const classFn = _.isFunction(classFnOrObject)
|
|
346
353
|
? classFnOrObject
|
|
347
354
|
: classFnOrObject.constructor;
|
|
@@ -1796,17 +1803,19 @@ class RealtimeSubsManager {
|
|
|
1796
1803
|
return;
|
|
1797
1804
|
}
|
|
1798
1805
|
if (!this.isListening) {
|
|
1799
|
-
const subscribeEvent = Symbols.REALTIME.ROOM_NAME.SUBSCRIBE.CUSTOM(this.options.core.ctx.contextName);
|
|
1800
1806
|
this.isListening = true;
|
|
1801
1807
|
if (this.options.customEvent) {
|
|
1808
|
+
const subscribeEvent = Symbols.REALTIME.ROOM_SUBSCRIBE_CUSTOM(this.options.core.ctx.contextName);
|
|
1802
1809
|
realtime.emit(subscribeEvent, this.options.roomName);
|
|
1803
1810
|
}
|
|
1804
1811
|
else {
|
|
1805
1812
|
if (_.isString(this.options.property)) {
|
|
1806
|
-
|
|
1813
|
+
const subscribeEvent = Symbols.REALTIME.ROOM_SUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(this.options.core.ctx.contextName);
|
|
1814
|
+
realtime.emit(subscribeEvent, this.options.roomName);
|
|
1807
1815
|
}
|
|
1808
1816
|
else {
|
|
1809
|
-
|
|
1817
|
+
const subscribeEvent = Symbols.REALTIME.ROOM_SUBSCRIBE_ENTITY_UPDATE_EVENTS(this.options.core.ctx.contextName);
|
|
1818
|
+
realtime.emit(subscribeEvent, this.options.roomName);
|
|
1810
1819
|
}
|
|
1811
1820
|
}
|
|
1812
1821
|
realtime.on(this.options.roomName, data => {
|
|
@@ -1822,16 +1831,16 @@ class RealtimeSubsManager {
|
|
|
1822
1831
|
if (this.observers.length === 0) {
|
|
1823
1832
|
this.isListening = false;
|
|
1824
1833
|
const { core, customEvent, roomName, property } = this.options;
|
|
1825
|
-
const realtime = core.
|
|
1834
|
+
const realtime = core.socketFE;
|
|
1826
1835
|
if (customEvent) {
|
|
1827
|
-
realtime.emit(Symbols.REALTIME.
|
|
1836
|
+
realtime.emit(Symbols.REALTIME.ROOM_UNSUBSCRIBE_CUSTOM(this.options.core.ctx.contextName), roomName);
|
|
1828
1837
|
}
|
|
1829
1838
|
else {
|
|
1830
1839
|
if (_.isString(property)) {
|
|
1831
|
-
realtime.emit(Symbols.REALTIME.
|
|
1840
|
+
realtime.emit(Symbols.REALTIME.ROOM_UNSUBSCRIBE_ENTITY_PROPERTY_UPDATE_EVENTS(this.options.core.ctx.contextName), roomName);
|
|
1832
1841
|
}
|
|
1833
1842
|
else {
|
|
1834
|
-
realtime.emit(Symbols.REALTIME.
|
|
1843
|
+
realtime.emit(Symbols.REALTIME.ROOM_UNSUBSCRIBE_ENTITY_UPDATE_EVENTS(this.options.core.ctx.contextName), roomName);
|
|
1835
1844
|
}
|
|
1836
1845
|
}
|
|
1837
1846
|
}
|
|
@@ -1858,7 +1867,7 @@ class RealtimeSubsManager {
|
|
|
1858
1867
|
class RealtimeClient {
|
|
1859
1868
|
constructor(core) {
|
|
1860
1869
|
this.core = core;
|
|
1861
|
-
this.
|
|
1870
|
+
this.subsManagers = {};
|
|
1862
1871
|
this.core = core;
|
|
1863
1872
|
if (!core.ctx.disabledRealtime) {
|
|
1864
1873
|
this.init();
|
|
@@ -1873,20 +1882,24 @@ class RealtimeClient {
|
|
|
1873
1882
|
console.info('[CLIENT] NAMESPACE GLOBAL ', nspPath.global.href + ` host: ${this.core.ctx.host}`);
|
|
1874
1883
|
this.core.ctx.logRealtime &&
|
|
1875
1884
|
console.info('[CLIENT] NAMESPACE REALTIME', nspPath.realtime.href + ` host: ${this.core.ctx.host}`);
|
|
1876
|
-
this.core.
|
|
1885
|
+
this.core.conectSocketFE = this.core.strategy.ioClient(nspPath.global.origin, {
|
|
1877
1886
|
path: nspPath.global.pathname,
|
|
1878
1887
|
});
|
|
1879
|
-
if (this.core.
|
|
1880
|
-
this.core.
|
|
1881
|
-
|
|
1888
|
+
if (this.core.conectSocketFE.on) {
|
|
1889
|
+
this.core.conectSocketFE.on('connect', () => {
|
|
1890
|
+
this.core.ctx.logRealtime &&
|
|
1891
|
+
console.info(`[CLIENT] connected to GLOBAL namespace ${nspPath.global.pathname}` +
|
|
1892
|
+
` of host: ${this.core.ctx.host}`);
|
|
1882
1893
|
});
|
|
1883
1894
|
}
|
|
1884
|
-
this.core.
|
|
1895
|
+
this.core.socketFE = this.core.strategy.ioClient(nspPath.realtime.origin, {
|
|
1885
1896
|
path: nspPath.realtime.pathname,
|
|
1886
1897
|
});
|
|
1887
|
-
if (this.core.
|
|
1888
|
-
this.core.
|
|
1889
|
-
|
|
1898
|
+
if (this.core.socketFE.on) {
|
|
1899
|
+
this.core.socketFE.on('connect', () => {
|
|
1900
|
+
this.core.ctx.logRealtime &&
|
|
1901
|
+
console.info(`[CLIENT] connected to REALTIME namespace ${nspPath.realtime.pathname}` +
|
|
1902
|
+
` host: ${this.core.ctx.host}`);
|
|
1890
1903
|
});
|
|
1891
1904
|
}
|
|
1892
1905
|
}
|
|
@@ -1921,12 +1934,12 @@ to use socket realtime connection;
|
|
|
1921
1934
|
}
|
|
1922
1935
|
let roomName;
|
|
1923
1936
|
if (customEvent) {
|
|
1924
|
-
roomName = Symbols.REALTIME.
|
|
1937
|
+
roomName = Symbols.REALTIME.ROOM_NAME_CUSTOM(this.core.ctx.contextName, customEvent);
|
|
1925
1938
|
}
|
|
1926
1939
|
else {
|
|
1927
1940
|
roomName = _.isString(property)
|
|
1928
|
-
? Symbols.REALTIME.
|
|
1929
|
-
: Symbols.REALTIME.
|
|
1941
|
+
? Symbols.REALTIME.ROOM_NAME_UPDATE_ENTITY_PROPERTY(this.core.ctx.contextName, className, property, idOrUniqValue)
|
|
1942
|
+
: Symbols.REALTIME.ROOM_NAME_UPDATE_ENTITY(this.core.ctx.contextName, className, idOrUniqValue);
|
|
1930
1943
|
}
|
|
1931
1944
|
const roomSubOptions = {
|
|
1932
1945
|
core: this.core,
|
|
@@ -1934,13 +1947,13 @@ to use socket realtime connection;
|
|
|
1934
1947
|
roomName,
|
|
1935
1948
|
customEvent,
|
|
1936
1949
|
};
|
|
1937
|
-
const subManagerId = this.
|
|
1938
|
-
if (!this.
|
|
1939
|
-
this.
|
|
1950
|
+
const subManagerId = this.getUniqueIdentifierForConnection(roomSubOptions);
|
|
1951
|
+
if (!this.subsManagers[subManagerId]) {
|
|
1952
|
+
this.subsManagers[subManagerId] = new RealtimeSubsManager(roomSubOptions);
|
|
1940
1953
|
}
|
|
1941
|
-
const inst = this.
|
|
1954
|
+
const inst = this.subsManagers[subManagerId];
|
|
1942
1955
|
inst.add(observer);
|
|
1943
|
-
inst.startListenIfNotStarted(this.core.
|
|
1956
|
+
inst.startListenIfNotStarted(this.core.socketFE);
|
|
1944
1957
|
return () => {
|
|
1945
1958
|
inst.remove(observer);
|
|
1946
1959
|
};
|
|
@@ -1963,7 +1976,7 @@ to use socket realtime connection;
|
|
|
1963
1976
|
*/
|
|
1964
1977
|
listenChangesEntityObj(entity, options) {
|
|
1965
1978
|
const classFn = ClassHelpers.getClassFnFromObject(entity);
|
|
1966
|
-
const uniqueKey = ClassHelpers.
|
|
1979
|
+
const uniqueKey = ClassHelpers.getUniqueKey(classFn);
|
|
1967
1980
|
return this.listenChangesEntity(classFn, entity[uniqueKey], options);
|
|
1968
1981
|
}
|
|
1969
1982
|
listenChangesCustomEvent(customEvent) {
|
|
@@ -1971,7 +1984,15 @@ to use socket realtime connection;
|
|
|
1971
1984
|
customEvent,
|
|
1972
1985
|
});
|
|
1973
1986
|
}
|
|
1974
|
-
|
|
1987
|
+
/**
|
|
1988
|
+
* Trigger custom event on backend
|
|
1989
|
+
* @param customEvent global event name
|
|
1990
|
+
* @param dataToPush
|
|
1991
|
+
*/
|
|
1992
|
+
triggerCustomEvent(customEvent, dataToPush) {
|
|
1993
|
+
this.core.socketFE.emit(customEvent, dataToPush);
|
|
1994
|
+
}
|
|
1995
|
+
getUniqueIdentifierForConnection(options) {
|
|
1975
1996
|
const url = new URL(options.core.ctx.host);
|
|
1976
1997
|
return `${this.core.ctx.contextName}:${url.origin}|${options.roomName}|${options.property}|${options.customEvent}`;
|
|
1977
1998
|
}
|
|
@@ -1979,11 +2000,9 @@ to use socket realtime connection;
|
|
|
1979
2000
|
;
|
|
1980
2001
|
({}); // @--end-of-file-for-module=taon lib/realtime/realtime-client.ts
|
|
1981
2002
|
|
|
1982
|
-
const SOCKET_EVENT_DEBOUNCE = 500;
|
|
1983
2003
|
class RealtimeServer {
|
|
1984
2004
|
constructor(core) {
|
|
1985
2005
|
this.core = core;
|
|
1986
|
-
this.jobs = {};
|
|
1987
2006
|
this.core = core;
|
|
1988
2007
|
if (!core.ctx.disabledRealtime) {
|
|
1989
2008
|
/* */
|
|
@@ -2141,8 +2160,6 @@ class RealtimeServer {
|
|
|
2141
2160
|
/* */
|
|
2142
2161
|
/* */
|
|
2143
2162
|
/* */
|
|
2144
|
-
}
|
|
2145
|
-
triggerChanges(entityObjOrClass, property, valueOfUniquPropery, customEvent, customEventData) {
|
|
2146
2163
|
/* */
|
|
2147
2164
|
/* */
|
|
2148
2165
|
/* */
|
|
@@ -2157,6 +2174,11 @@ class RealtimeServer {
|
|
|
2157
2174
|
/* */
|
|
2158
2175
|
/* */
|
|
2159
2176
|
/* */
|
|
2177
|
+
}
|
|
2178
|
+
triggerChanges(entityObjOrClass, property, valueOfUniqueProperty, customEvent, customEventData) {
|
|
2179
|
+
/* */
|
|
2180
|
+
/* */
|
|
2181
|
+
/* */
|
|
2160
2182
|
/* */
|
|
2161
2183
|
/* */
|
|
2162
2184
|
/* */
|
|
@@ -2212,18 +2234,18 @@ class RealtimeServer {
|
|
|
2212
2234
|
/* */
|
|
2213
2235
|
/* */
|
|
2214
2236
|
}
|
|
2215
|
-
|
|
2237
|
+
triggerEntityChanges(entityObjOrClass, idToTrigger) {
|
|
2216
2238
|
if (this.core.ctx.disabledRealtime) {
|
|
2217
2239
|
const className = ClassHelpers.getName(entityObjOrClass);
|
|
2218
|
-
console.warn(`[Taon][
|
|
2240
|
+
console.warn(`[Taon][TriggerEntityChanges] Entity "${className}' is not realtime`);
|
|
2219
2241
|
return;
|
|
2220
2242
|
}
|
|
2221
2243
|
this.triggerChanges(entityObjOrClass, void 0, idToTrigger);
|
|
2222
2244
|
}
|
|
2223
|
-
|
|
2245
|
+
triggerEntityPropertyChanges(entityObjOrClass, property, idToTrigger) {
|
|
2224
2246
|
if (this.core.ctx.disabledRealtime) {
|
|
2225
2247
|
const className = ClassHelpers.getName(entityObjOrClass);
|
|
2226
|
-
console.warn(`[Taon][
|
|
2248
|
+
console.warn(`[Taon][TriggerEntityPropertyChanges][property=${property}] Entity "${className}' is not realtime`);
|
|
2227
2249
|
return;
|
|
2228
2250
|
}
|
|
2229
2251
|
if (_.isArray(property)) {
|
|
@@ -2235,16 +2257,33 @@ class RealtimeServer {
|
|
|
2235
2257
|
this.triggerChanges(entityObjOrClass, property, idToTrigger);
|
|
2236
2258
|
}
|
|
2237
2259
|
}
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
}
|
|
2241
|
-
trigggerEntityTableChanges(entityClass) {
|
|
2242
|
-
const className = ClassHelpers.getName(entityClass);
|
|
2260
|
+
triggerEntityTableChanges(entityClassOrInstance) {
|
|
2261
|
+
const className = ClassHelpers.getName(entityClassOrInstance);
|
|
2243
2262
|
if (this.core.ctx.disabledRealtime) {
|
|
2244
|
-
console.warn(`[Taon][
|
|
2263
|
+
console.warn(`[Taon][TriggerEntityTableChanges] Entity "${className}' is not realtime`);
|
|
2245
2264
|
return;
|
|
2246
2265
|
}
|
|
2247
|
-
this.triggerChanges(
|
|
2266
|
+
this.triggerChanges(entityClassOrInstance, void 0, void 0, Symbols.REALTIME.TABLE_CHANGE(this.core.ctx.contextName, className));
|
|
2267
|
+
}
|
|
2268
|
+
triggerCustomEvent(customEvent, dataToPush) {
|
|
2269
|
+
this.triggerChanges(void 0, void 0, void 0, customEvent, dataToPush);
|
|
2270
|
+
}
|
|
2271
|
+
/**
|
|
2272
|
+
* Listen to custom events from users
|
|
2273
|
+
* @param customEvent global event name
|
|
2274
|
+
*/
|
|
2275
|
+
listenChangesCustomEvent(customEvent) {
|
|
2276
|
+
/* */
|
|
2277
|
+
/* */
|
|
2278
|
+
/* */
|
|
2279
|
+
/* */
|
|
2280
|
+
/* */
|
|
2281
|
+
/* */
|
|
2282
|
+
/* */
|
|
2283
|
+
/* */
|
|
2284
|
+
/* */
|
|
2285
|
+
/* */
|
|
2286
|
+
return (void 0);
|
|
2248
2287
|
}
|
|
2249
2288
|
}
|
|
2250
2289
|
;
|
|
@@ -2254,76 +2293,205 @@ class RealtimeStrategy {
|
|
|
2254
2293
|
constructor(ctx) {
|
|
2255
2294
|
this.ctx = ctx;
|
|
2256
2295
|
}
|
|
2257
|
-
|
|
2296
|
+
get ioClient() {
|
|
2297
|
+
throw new Error('Not implemented');
|
|
2298
|
+
}
|
|
2299
|
+
ioServer(url, opt) {
|
|
2300
|
+
throw new Error('Not implemented');
|
|
2258
2301
|
}
|
|
2259
2302
|
}
|
|
2260
2303
|
;
|
|
2261
2304
|
({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy.ts
|
|
2262
2305
|
|
|
2263
|
-
class
|
|
2264
|
-
|
|
2306
|
+
class MockServerIpc {
|
|
2307
|
+
static { this.serverByContextName = new Map(); }
|
|
2308
|
+
static from(contextName) {
|
|
2309
|
+
if (!MockServerIpc.serverByContextName.has(contextName)) {
|
|
2310
|
+
MockServerIpc.serverByContextName.set(contextName, new MockServerIpc(contextName));
|
|
2311
|
+
}
|
|
2312
|
+
return MockServerIpc.serverByContextName.get(contextName);
|
|
2313
|
+
}
|
|
2314
|
+
constructor(contextName) {
|
|
2315
|
+
this.contextName = contextName;
|
|
2316
|
+
this.namespacesByName = new Map();
|
|
2317
|
+
MockServerIpc.serverByContextName.set(contextName, this);
|
|
2318
|
+
}
|
|
2319
|
+
of(namespace) {
|
|
2320
|
+
if (!this.namespacesByName.has(namespace)) {
|
|
2321
|
+
this.namespacesByName.set(namespace, new MockNamespaceIpc(namespace, this));
|
|
2322
|
+
}
|
|
2323
|
+
return this.namespacesByName.get(namespace);
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2326
|
+
class MockNamespaceIpc {
|
|
2327
|
+
constructor(
|
|
2328
|
+
/**
|
|
2329
|
+
* Namespace name
|
|
2330
|
+
*/
|
|
2331
|
+
name, server) {
|
|
2332
|
+
this.name = name;
|
|
2333
|
+
this.server = server;
|
|
2334
|
+
this.electronClients = new Set();
|
|
2335
|
+
this.roomsByRoomName = {};
|
|
2336
|
+
this.namespaceEventHandlers = {};
|
|
2337
|
+
}
|
|
2338
|
+
on(eventName, callback) {
|
|
2339
|
+
/* */
|
|
2340
|
+
/* */
|
|
2341
|
+
/* */
|
|
2342
|
+
/* */
|
|
2343
|
+
/* */
|
|
2344
|
+
/* */
|
|
2345
|
+
/* */
|
|
2346
|
+
/* */
|
|
2347
|
+
/* */
|
|
2348
|
+
/* */
|
|
2349
|
+
/* */
|
|
2350
|
+
/* */
|
|
2351
|
+
/* */
|
|
2352
|
+
/* */
|
|
2353
|
+
/* */
|
|
2354
|
+
/* */
|
|
2355
|
+
/* */
|
|
2356
|
+
/* */
|
|
2357
|
+
/* */
|
|
2358
|
+
/* */
|
|
2359
|
+
/* */
|
|
2360
|
+
/* */
|
|
2361
|
+
/* */
|
|
2362
|
+
/* */
|
|
2363
|
+
/* */
|
|
2364
|
+
/* */
|
|
2365
|
+
/* */
|
|
2366
|
+
/* */
|
|
2367
|
+
/* */
|
|
2368
|
+
return (void 0);
|
|
2369
|
+
}
|
|
2370
|
+
off(event, callback) {
|
|
2371
|
+
/* */
|
|
2372
|
+
/* */
|
|
2373
|
+
/* */
|
|
2374
|
+
/* */
|
|
2375
|
+
/* */
|
|
2376
|
+
/* */
|
|
2377
|
+
/* */
|
|
2378
|
+
/* */
|
|
2379
|
+
/* */
|
|
2380
|
+
/* */
|
|
2381
|
+
/* */
|
|
2382
|
+
/* */
|
|
2383
|
+
return (void 0);
|
|
2384
|
+
}
|
|
2385
|
+
emit(eventName, ...args) {
|
|
2386
|
+
/* */
|
|
2387
|
+
/* */
|
|
2388
|
+
/* */
|
|
2389
|
+
/* */
|
|
2390
|
+
/* */
|
|
2391
|
+
/* */
|
|
2392
|
+
/* */
|
|
2393
|
+
/* */
|
|
2394
|
+
/* */
|
|
2395
|
+
return (void 0);
|
|
2396
|
+
}
|
|
2397
|
+
to(roomName) {
|
|
2398
|
+
const electronClientsInroom = this.roomsByRoomName[roomName];
|
|
2399
|
+
return new RoomEmitterIpc(electronClientsInroom, this.name, true);
|
|
2400
|
+
}
|
|
2401
|
+
in(roomName) {
|
|
2402
|
+
const electronClientsInroom = this.roomsByRoomName[roomName];
|
|
2403
|
+
return new RoomEmitterIpc(electronClientsInroom, this.name, false);
|
|
2404
|
+
}
|
|
2405
|
+
join(webContents, roomName) {
|
|
2406
|
+
if (!this.roomsByRoomName[roomName]) {
|
|
2407
|
+
this.roomsByRoomName[roomName] = new Set();
|
|
2408
|
+
}
|
|
2409
|
+
this.roomsByRoomName[roomName].add(webContents);
|
|
2410
|
+
}
|
|
2411
|
+
leave(webContents, roomName) {
|
|
2412
|
+
if (this.roomsByRoomName[roomName]) {
|
|
2413
|
+
this.roomsByRoomName[roomName].delete(webContents);
|
|
2414
|
+
if (this.roomsByRoomName[roomName].size === 0) {
|
|
2415
|
+
delete this.roomsByRoomName[roomName];
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
path() {
|
|
2420
|
+
return this.name;
|
|
2421
|
+
}
|
|
2422
|
+
get nsp() {
|
|
2423
|
+
const self = this;
|
|
2424
|
+
return {
|
|
2425
|
+
get name() {
|
|
2426
|
+
return self.name;
|
|
2427
|
+
},
|
|
2428
|
+
};
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
class RoomEmitterIpc {
|
|
2432
|
+
constructor(electronClients,
|
|
2433
|
+
/**
|
|
2434
|
+
* namespace name
|
|
2435
|
+
*/
|
|
2436
|
+
name, includeSender = false, sender = null) {
|
|
2437
|
+
this.electronClients = electronClients;
|
|
2265
2438
|
this.name = name;
|
|
2266
|
-
this.
|
|
2439
|
+
this.includeSender = includeSender;
|
|
2440
|
+
this.sender = sender;
|
|
2441
|
+
}
|
|
2442
|
+
emit(eventName, ...args) {
|
|
2443
|
+
const emitEvent = `(${this.name}) "${eventName}"`;
|
|
2444
|
+
this.electronClients?.forEach(webContents => {
|
|
2445
|
+
webContents.send(emitEvent, ...args);
|
|
2446
|
+
});
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
class MockSocketIpc {
|
|
2450
|
+
get name() {
|
|
2451
|
+
return this.namespaceName;
|
|
2452
|
+
}
|
|
2453
|
+
/**
|
|
2454
|
+
* @param namespaceName instead url for ipc
|
|
2455
|
+
*/
|
|
2456
|
+
constructor(namespaceName) {
|
|
2457
|
+
this.namespaceName = namespaceName;
|
|
2458
|
+
this.socketEventHandlers = {};
|
|
2267
2459
|
this.ipcRenderer = window.require('electron').ipcRenderer;
|
|
2268
2460
|
}
|
|
2269
2461
|
on(eventName, callback) {
|
|
2270
|
-
if (!this.
|
|
2271
|
-
this.
|
|
2462
|
+
if (!this.socketEventHandlers[eventName]) {
|
|
2463
|
+
this.socketEventHandlers[eventName] = new Set();
|
|
2272
2464
|
}
|
|
2273
|
-
this.
|
|
2465
|
+
this.socketEventHandlers[eventName].add(callback);
|
|
2274
2466
|
const listenToEvent = `(${this.name}) "${eventName}"`;
|
|
2275
|
-
this.ipcRenderer.on(listenToEvent,
|
|
2467
|
+
this.ipcRenderer.on(listenToEvent, (rendereEvent, data) => {
|
|
2468
|
+
callback(data);
|
|
2469
|
+
});
|
|
2276
2470
|
if (eventName === 'connect') {
|
|
2277
|
-
this.
|
|
2278
|
-
|
|
2279
|
-
else {
|
|
2280
|
-
this.emit(eventName);
|
|
2471
|
+
const connectionEventKey = `(${this.name}) "connection"`;
|
|
2472
|
+
this.ipcRenderer.send(connectionEventKey, this.name);
|
|
2281
2473
|
}
|
|
2282
2474
|
}
|
|
2283
2475
|
off(event, callback) {
|
|
2284
|
-
if (!this.
|
|
2476
|
+
if (!this.socketEventHandlers[event]) {
|
|
2285
2477
|
return;
|
|
2478
|
+
}
|
|
2286
2479
|
if (callback) {
|
|
2287
|
-
this.
|
|
2480
|
+
this.socketEventHandlers[event].delete(callback);
|
|
2288
2481
|
}
|
|
2289
2482
|
else {
|
|
2290
|
-
delete this.
|
|
2483
|
+
delete this.socketEventHandlers[event];
|
|
2291
2484
|
}
|
|
2292
2485
|
const removeListener = `(${this.name}) "${event}"`;
|
|
2293
|
-
this.ipcRenderer.removeListener(removeListener,
|
|
2486
|
+
this.ipcRenderer.removeListener(removeListener, data => {
|
|
2487
|
+
callback(data);
|
|
2488
|
+
});
|
|
2294
2489
|
}
|
|
2295
2490
|
emit(event, ...args) {
|
|
2296
2491
|
const emitEvent = `(${this.name}) "${event}"`;
|
|
2297
2492
|
this.ipcRenderer.send(emitEvent, ...args);
|
|
2298
2493
|
}
|
|
2299
2494
|
}
|
|
2300
|
-
;
|
|
2301
|
-
({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-namespace.ts
|
|
2302
|
-
|
|
2303
|
-
class IpcRendererWrapper {
|
|
2304
|
-
constructor(contextName) {
|
|
2305
|
-
this.contextName = contextName;
|
|
2306
|
-
this.namespaces = {
|
|
2307
|
-
'/': new IpcRendererNamespace('/'),
|
|
2308
|
-
};
|
|
2309
|
-
this.connected = false;
|
|
2310
|
-
}
|
|
2311
|
-
of(namespace) {
|
|
2312
|
-
if (!this.namespaces[namespace]) {
|
|
2313
|
-
this.namespaces[namespace] = new IpcRendererNamespace(namespace);
|
|
2314
|
-
}
|
|
2315
|
-
return this.namespaces[namespace];
|
|
2316
|
-
}
|
|
2317
|
-
on(event, callback) {
|
|
2318
|
-
this.namespaces['/'].on(event, callback);
|
|
2319
|
-
}
|
|
2320
|
-
emit(event, ...args) {
|
|
2321
|
-
this.namespaces['/'].emit(event, ...args);
|
|
2322
|
-
}
|
|
2323
|
-
}
|
|
2324
|
-
;
|
|
2325
|
-
({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-ipc-models/realtime-strategy-ipc-renderer-wrapper.ts
|
|
2326
|
-
|
|
2327
2495
|
/**
|
|
2328
2496
|
* Purpose:
|
|
2329
2497
|
* - backend-browser communication between 2 processes in electron mode
|
|
@@ -2332,222 +2500,222 @@ class RealtimeStrategyIpc extends RealtimeStrategy {
|
|
|
2332
2500
|
toString() {
|
|
2333
2501
|
return 'ipc';
|
|
2334
2502
|
}
|
|
2335
|
-
establishConnection() {
|
|
2336
|
-
throw new Error('Method not implemented.');
|
|
2337
|
-
}
|
|
2338
2503
|
constructor(ctx) {
|
|
2339
2504
|
super(ctx);
|
|
2340
2505
|
this.ctx = ctx;
|
|
2341
|
-
this.contextsServers = {};
|
|
2342
|
-
this.contextsIO = {};
|
|
2343
2506
|
}
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
}
|
|
2349
|
-
const wrap = new IpcRendererWrapper(this.ctx.contextName);
|
|
2350
|
-
const nsp = wrap.of(namespacePath);
|
|
2351
|
-
this.contextsIO[namespacePath] = nsp;
|
|
2352
|
-
return nsp;
|
|
2353
|
-
});
|
|
2354
|
-
return void 0;
|
|
2507
|
+
ioServer(__, opt) {
|
|
2508
|
+
const namespace = opt?.path || '/';
|
|
2509
|
+
const server = MockServerIpc.from(this.ctx.contextName);
|
|
2510
|
+
return server.of(namespace);
|
|
2355
2511
|
}
|
|
2356
|
-
get
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
/* */
|
|
2363
|
-
/* */
|
|
2364
|
-
/* */
|
|
2365
|
-
/* */
|
|
2366
|
-
/* */
|
|
2367
|
-
/* */
|
|
2368
|
-
return void 0;
|
|
2512
|
+
get ioClient() {
|
|
2513
|
+
const clientIo = (__, opt) => {
|
|
2514
|
+
const namespace = opt?.path || '/';
|
|
2515
|
+
return new MockSocketIpc(namespace);
|
|
2516
|
+
};
|
|
2517
|
+
return clientIo;
|
|
2369
2518
|
}
|
|
2370
2519
|
}
|
|
2371
2520
|
;
|
|
2372
2521
|
({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-ipc.ts
|
|
2373
2522
|
|
|
2374
|
-
class
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
this.sockets = new Set();
|
|
2380
|
-
}
|
|
2381
|
-
on(event, callback) {
|
|
2382
|
-
if (event === 'connection') {
|
|
2383
|
-
this.sockets.forEach(socket => callback(socket));
|
|
2523
|
+
class MockServer {
|
|
2524
|
+
static { this.serverByUrl = new Map(); }
|
|
2525
|
+
static from(url) {
|
|
2526
|
+
if (!MockServer.serverByUrl.has(url)) {
|
|
2527
|
+
MockServer.serverByUrl.set(url, new MockServer(url));
|
|
2384
2528
|
}
|
|
2529
|
+
return MockServer.serverByUrl.get(url);
|
|
2385
2530
|
}
|
|
2386
|
-
|
|
2387
|
-
|
|
2531
|
+
get allServers() {
|
|
2532
|
+
return Array.from(MockServer.serverByUrl.values());
|
|
2388
2533
|
}
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
this.rooms[room].forEach(socket => socket.emit(event, data));
|
|
2394
|
-
}
|
|
2395
|
-
}
|
|
2396
|
-
};
|
|
2534
|
+
constructor(url) {
|
|
2535
|
+
this.url = url;
|
|
2536
|
+
this.namespacesByName = new Map();
|
|
2537
|
+
MockServer.serverByUrl.set(url, this);
|
|
2397
2538
|
}
|
|
2398
|
-
|
|
2399
|
-
if (!this.
|
|
2400
|
-
this.
|
|
2401
|
-
}
|
|
2402
|
-
this.rooms[room].add(socket);
|
|
2403
|
-
}
|
|
2404
|
-
leaveRoom(socket, room) {
|
|
2405
|
-
if (this.rooms[room]) {
|
|
2406
|
-
this.rooms[room].delete(socket);
|
|
2407
|
-
if (this.rooms[room].size === 0) {
|
|
2408
|
-
delete this.rooms[room];
|
|
2409
|
-
}
|
|
2539
|
+
of(namespace) {
|
|
2540
|
+
if (!this.namespacesByName.has(namespace)) {
|
|
2541
|
+
this.namespacesByName.set(namespace, new MockNamespace(namespace, this));
|
|
2410
2542
|
}
|
|
2543
|
+
return this.namespacesByName.get(namespace);
|
|
2411
2544
|
}
|
|
2412
|
-
|
|
2413
|
-
this.
|
|
2414
|
-
}
|
|
2415
|
-
removeSocket(socket) {
|
|
2416
|
-
this.sockets.delete(socket);
|
|
2545
|
+
path() {
|
|
2546
|
+
return this.url;
|
|
2417
2547
|
}
|
|
2418
2548
|
}
|
|
2419
|
-
|
|
2420
|
-
(
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
this.
|
|
2426
|
-
this.
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2549
|
+
class MockNamespace {
|
|
2550
|
+
constructor(
|
|
2551
|
+
/**
|
|
2552
|
+
* unique namespace name
|
|
2553
|
+
*/
|
|
2554
|
+
name, server) {
|
|
2555
|
+
this.name = name;
|
|
2556
|
+
this.server = server;
|
|
2557
|
+
/**
|
|
2558
|
+
* All sockets connected to this namespace
|
|
2559
|
+
*/
|
|
2560
|
+
this.allSocketsForNamespace = new Set();
|
|
2561
|
+
/**
|
|
2562
|
+
* Rooms and their sockets
|
|
2563
|
+
*/
|
|
2564
|
+
this.socketByRoomName = {};
|
|
2565
|
+
/**
|
|
2566
|
+
* Event handlers for this namespace
|
|
2567
|
+
*/
|
|
2568
|
+
this.namespaceEventHandlers = {};
|
|
2434
2569
|
}
|
|
2435
|
-
|
|
2436
|
-
if (!this.
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
this.listeners[event] = this.listeners[event].filter(listener => listener !== callback);
|
|
2570
|
+
on(eventName, handler) {
|
|
2571
|
+
if (!this.namespaceEventHandlers[eventName]) {
|
|
2572
|
+
this.namespaceEventHandlers[eventName] =
|
|
2573
|
+
new Set();
|
|
2440
2574
|
}
|
|
2441
|
-
|
|
2442
|
-
|
|
2575
|
+
if (!this.namespaceEventHandlers[eventName].has(handler)) {
|
|
2576
|
+
this.namespaceEventHandlers[eventName].add(handler);
|
|
2443
2577
|
}
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2578
|
+
if (eventName === 'connection') {
|
|
2579
|
+
setTimeout(() => {
|
|
2580
|
+
this.emit('connection', this);
|
|
2581
|
+
});
|
|
2448
2582
|
}
|
|
2449
2583
|
}
|
|
2450
|
-
|
|
2451
|
-
this.
|
|
2584
|
+
emit(event, ...args) {
|
|
2585
|
+
this.allSocketsForNamespace?.forEach(socket => {
|
|
2586
|
+
socket.emit(event, ...args);
|
|
2587
|
+
});
|
|
2452
2588
|
}
|
|
2453
|
-
|
|
2454
|
-
this.
|
|
2589
|
+
connect(socket) {
|
|
2590
|
+
this.allSocketsForNamespace.add(socket);
|
|
2591
|
+
socket.namespaceInstance = this;
|
|
2455
2592
|
}
|
|
2456
|
-
|
|
2457
|
-
this.
|
|
2458
|
-
|
|
2459
|
-
this.listeners = {};
|
|
2593
|
+
to(roomName) {
|
|
2594
|
+
const socketsInRoom = this.socketByRoomName[roomName];
|
|
2595
|
+
return new RoomEmitter(socketsInRoom, true);
|
|
2460
2596
|
}
|
|
2461
|
-
|
|
2462
|
-
;
|
|
2463
|
-
(
|
|
2464
|
-
|
|
2465
|
-
class MockServer {
|
|
2466
|
-
constructor(contextName) {
|
|
2467
|
-
this.contextName = contextName;
|
|
2468
|
-
this.namespaces = {
|
|
2469
|
-
'/': new MockNamespace('/', this.contextName)
|
|
2470
|
-
};
|
|
2597
|
+
in(roomName) {
|
|
2598
|
+
const socketsInRoom = this.socketByRoomName[roomName];
|
|
2599
|
+
return new RoomEmitter(socketsInRoom, false);
|
|
2471
2600
|
}
|
|
2472
|
-
|
|
2473
|
-
if (!this.
|
|
2474
|
-
this.
|
|
2601
|
+
joinRoom(roomName, socket) {
|
|
2602
|
+
if (!this.socketByRoomName[roomName]) {
|
|
2603
|
+
this.socketByRoomName[roomName] = new Set();
|
|
2475
2604
|
}
|
|
2476
|
-
|
|
2605
|
+
this.socketByRoomName[roomName].add(socket);
|
|
2477
2606
|
}
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2607
|
+
leaveRoom(roomName, socket) {
|
|
2608
|
+
const roomSockets = this.socketByRoomName[roomName];
|
|
2609
|
+
if (roomSockets) {
|
|
2610
|
+
this.socketByRoomName[roomName].delete(socket);
|
|
2481
2611
|
}
|
|
2482
2612
|
}
|
|
2483
|
-
|
|
2484
|
-
this
|
|
2613
|
+
get nsp() {
|
|
2614
|
+
const self = this;
|
|
2615
|
+
return {
|
|
2616
|
+
get name() {
|
|
2617
|
+
return self.name;
|
|
2618
|
+
},
|
|
2619
|
+
};
|
|
2620
|
+
}
|
|
2621
|
+
path() {
|
|
2622
|
+
return this.name;
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
class RoomEmitter {
|
|
2626
|
+
constructor(sockets, includeSender = false, sender = null) {
|
|
2627
|
+
this.sockets = sockets;
|
|
2628
|
+
this.includeSender = includeSender;
|
|
2629
|
+
this.sender = sender;
|
|
2485
2630
|
}
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2631
|
+
emit(event, ...args) {
|
|
2632
|
+
this.sockets?.forEach(socket => {
|
|
2633
|
+
if (this.includeSender || socket !== this.sender) {
|
|
2634
|
+
socket.emit(event, ...args);
|
|
2635
|
+
}
|
|
2491
2636
|
});
|
|
2492
|
-
return socket;
|
|
2493
2637
|
}
|
|
2494
2638
|
}
|
|
2495
|
-
|
|
2496
|
-
(
|
|
2497
|
-
|
|
2498
|
-
class MockClientSocket {
|
|
2499
|
-
constructor(serverSocket, contextName) {
|
|
2500
|
-
this.serverSocket = serverSocket;
|
|
2501
|
-
this.contextName = contextName;
|
|
2502
|
-
this.listeners = {};
|
|
2503
|
-
serverSocket.on('message', (data) => this.emit('message', data));
|
|
2639
|
+
class MockSocket {
|
|
2640
|
+
get id() {
|
|
2641
|
+
return this.nsp.name;
|
|
2504
2642
|
}
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2643
|
+
constructor(url, opts) {
|
|
2644
|
+
this.url = url;
|
|
2645
|
+
this.socketEventHandlers = {};
|
|
2646
|
+
// @ts-ignore
|
|
2647
|
+
const [baseUrl, namespace] = [url, opts.path || '/'];
|
|
2648
|
+
const namespaceName = namespace || '/';
|
|
2649
|
+
const server = MockServer.from(url);
|
|
2650
|
+
const ns = server.of(namespaceName);
|
|
2651
|
+
ns.connect(this);
|
|
2652
|
+
}
|
|
2653
|
+
get nsp() {
|
|
2654
|
+
const self = this;
|
|
2655
|
+
return {
|
|
2656
|
+
get name() {
|
|
2657
|
+
return self.namespaceInstance?.name;
|
|
2658
|
+
},
|
|
2659
|
+
};
|
|
2510
2660
|
}
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2661
|
+
path() {
|
|
2662
|
+
return this.namespaceInstance?.name;
|
|
2663
|
+
}
|
|
2664
|
+
on(eventName, handler) {
|
|
2665
|
+
if (!this.socketEventHandlers[eventName]) {
|
|
2666
|
+
this.socketEventHandlers[eventName] =
|
|
2667
|
+
new Set();
|
|
2516
2668
|
}
|
|
2517
|
-
|
|
2518
|
-
|
|
2669
|
+
this.socketEventHandlers[eventName].add(handler);
|
|
2670
|
+
if (eventName === 'connect') {
|
|
2671
|
+
setTimeout(() => {
|
|
2672
|
+
this.emit('connect');
|
|
2673
|
+
});
|
|
2519
2674
|
}
|
|
2520
2675
|
}
|
|
2521
|
-
emit(
|
|
2522
|
-
|
|
2523
|
-
if (
|
|
2524
|
-
|
|
2676
|
+
emit(eventName, ...args) {
|
|
2677
|
+
eventName = eventName || '';
|
|
2678
|
+
if (eventName.includes(`:${Symbols.REALTIME.KEYroomSubscribe}`)) {
|
|
2679
|
+
const room = args[0];
|
|
2680
|
+
this.join(room);
|
|
2681
|
+
}
|
|
2682
|
+
else if (eventName.includes(`:${Symbols.REALTIME.KEYroomUnsubscribe}`)) {
|
|
2683
|
+
const room = args[0];
|
|
2684
|
+
this.leave(room);
|
|
2685
|
+
}
|
|
2686
|
+
else {
|
|
2687
|
+
if (this.namespaceInstance) {
|
|
2688
|
+
const namespaceEventHandlers = this.namespaceInstance.namespaceEventHandlers[eventName] || [];
|
|
2689
|
+
for (const namespaceEventHandler of namespaceEventHandlers) {
|
|
2690
|
+
if (namespaceEventHandler) {
|
|
2691
|
+
namespaceEventHandler(...args);
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
const allSocketsForNamespaceExceptCurrent = Array.from(this.namespaceInstance.allSocketsForNamespace.values()).filter(socket => socket !== this);
|
|
2695
|
+
for (const socket of allSocketsForNamespaceExceptCurrent) {
|
|
2696
|
+
const socketEventHandlers = socket.socketEventHandlers[eventName];
|
|
2697
|
+
for (const socketEventHandler of socketEventHandlers) {
|
|
2698
|
+
if (socketEventHandler) {
|
|
2699
|
+
socketEventHandler(...args);
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
const socketEventHandlers = this.socketEventHandlers[eventName] || [];
|
|
2704
|
+
for (const clientHandler of socketEventHandlers) {
|
|
2705
|
+
if (clientHandler) {
|
|
2706
|
+
clientHandler(...args);
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2525
2710
|
}
|
|
2526
2711
|
}
|
|
2527
|
-
|
|
2528
|
-
this.
|
|
2529
|
-
this.listeners = {};
|
|
2530
|
-
}
|
|
2531
|
-
join(room) {
|
|
2532
|
-
this.serverSocket.join(room);
|
|
2712
|
+
join(roomName) {
|
|
2713
|
+
this.namespaceInstance.joinRoom(roomName, this);
|
|
2533
2714
|
}
|
|
2534
|
-
leave(
|
|
2535
|
-
this.
|
|
2715
|
+
leave(roomName) {
|
|
2716
|
+
this.namespaceInstance.leaveRoom(roomName, this);
|
|
2536
2717
|
}
|
|
2537
2718
|
}
|
|
2538
|
-
function mockIo(server) {
|
|
2539
|
-
return (namespace = '/') => {
|
|
2540
|
-
const socketId = Math.random().toString(36).substring(2);
|
|
2541
|
-
const serverSocket = server.connect(socketId, namespace);
|
|
2542
|
-
return new MockClientSocket(serverSocket, server.contextName);
|
|
2543
|
-
};
|
|
2544
|
-
}
|
|
2545
|
-
;
|
|
2546
|
-
({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-mock-models/realtime-strategy-mock-client.ts
|
|
2547
|
-
|
|
2548
|
-
;
|
|
2549
|
-
({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-mock-models/index.ts
|
|
2550
|
-
|
|
2551
2719
|
/**
|
|
2552
2720
|
* Purpose:
|
|
2553
2721
|
* - browser-browser communication mock (in websql mode)
|
|
@@ -2560,15 +2728,15 @@ class RealtimeStrategyMock extends RealtimeStrategy {
|
|
|
2560
2728
|
super(ctx);
|
|
2561
2729
|
this.ctx = ctx;
|
|
2562
2730
|
}
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
;
|
|
2567
|
-
get io() {
|
|
2568
|
-
return mockIo;
|
|
2731
|
+
ioServer(url, opt) {
|
|
2732
|
+
const server = MockServer.from(url || this.ctx.uri.origin);
|
|
2733
|
+
return server.of(opt?.path || '/');
|
|
2569
2734
|
}
|
|
2570
|
-
|
|
2571
|
-
|
|
2735
|
+
get ioClient() {
|
|
2736
|
+
const clientIo = (uri, opts) => {
|
|
2737
|
+
return new MockSocket(uri || this.ctx.uri.origin, opts);
|
|
2738
|
+
};
|
|
2739
|
+
return clientIo;
|
|
2572
2740
|
}
|
|
2573
2741
|
}
|
|
2574
2742
|
;
|
|
@@ -2587,18 +2755,14 @@ class RealtimeStrategySocketIO extends RealtimeStrategy {
|
|
|
2587
2755
|
super(ctx);
|
|
2588
2756
|
this.ctx = ctx;
|
|
2589
2757
|
}
|
|
2590
|
-
|
|
2758
|
+
ioServer(...args) {
|
|
2591
2759
|
/* */
|
|
2592
2760
|
/* */
|
|
2593
2761
|
return (void 0);
|
|
2594
2762
|
}
|
|
2595
|
-
|
|
2596
|
-
get io() {
|
|
2763
|
+
get ioClient() {
|
|
2597
2764
|
return io;
|
|
2598
2765
|
}
|
|
2599
|
-
establishConnection() {
|
|
2600
|
-
throw new Error('Method not implemented.');
|
|
2601
|
-
}
|
|
2602
2766
|
}
|
|
2603
2767
|
;
|
|
2604
2768
|
({}); // @--end-of-file-for-module=taon lib/realtime/realtime-strategy/realtime-strategy-socket-io.ts
|
|
@@ -2625,14 +2789,22 @@ class RealtimeCore {
|
|
|
2625
2789
|
'OPTIONS',
|
|
2626
2790
|
'HEAD',
|
|
2627
2791
|
];
|
|
2792
|
+
this.ctx = ctx;
|
|
2628
2793
|
this.strategy = this.resolveStrategy();
|
|
2629
|
-
ctx.
|
|
2794
|
+
this.ctx.logRealtime &&
|
|
2630
2795
|
console.log(`[taon] realtime strategy: ${this.strategy}`);
|
|
2631
|
-
|
|
2632
|
-
|
|
2796
|
+
if (Helpers.isWebSQL) {
|
|
2797
|
+
this.server = new RealtimeServer(this);
|
|
2798
|
+
this.client = new RealtimeClient(this);
|
|
2799
|
+
}
|
|
2800
|
+
else {
|
|
2801
|
+
this.client = new RealtimeClient(this);
|
|
2802
|
+
this.server = new RealtimeServer(this);
|
|
2803
|
+
}
|
|
2633
2804
|
}
|
|
2634
2805
|
resolveStrategy() {
|
|
2635
|
-
if (this.ctx.mode === 'backend-frontend(websql)'
|
|
2806
|
+
if (this.ctx.mode === 'backend-frontend(websql)' ||
|
|
2807
|
+
this.ctx.mode === 'backend-frontend(websql-electron)') {
|
|
2636
2808
|
return new RealtimeStrategyMock(this.ctx);
|
|
2637
2809
|
}
|
|
2638
2810
|
if (this.ctx.mode === 'backend-frontend(ipc-electron)') {
|
|
@@ -2645,11 +2817,11 @@ class RealtimeCore {
|
|
|
2645
2817
|
let nsp = namespace ? namespace : '';
|
|
2646
2818
|
nsp = nsp === '/' ? '' : nsp;
|
|
2647
2819
|
const pathname = uri.pathname !== '/' ? uri.pathname : '';
|
|
2648
|
-
let prefix = `taonContext
|
|
2820
|
+
let prefix = `taonContext`;
|
|
2649
2821
|
if (Helpers.isElectron) {
|
|
2650
2822
|
prefix = ``;
|
|
2651
2823
|
}
|
|
2652
|
-
const href = `${uri.origin}${pathname}/${prefix}${nsp}`;
|
|
2824
|
+
const href = `${uri.origin}${pathname}/${prefix}${prefix && nsp ? '-' + nsp : nsp}`;
|
|
2653
2825
|
return new URL(href);
|
|
2654
2826
|
}
|
|
2655
2827
|
}
|
|
@@ -2807,7 +2979,12 @@ class EndpointContext {
|
|
|
2807
2979
|
this.mode = 'remote-backend(tcp+udp)';
|
|
2808
2980
|
}
|
|
2809
2981
|
if (this.config.useIpcWhenElectron && Helpers.isElectron) {
|
|
2810
|
-
|
|
2982
|
+
if (Helpers.isWebSQL) {
|
|
2983
|
+
this.mode = 'backend-frontend(websql-electron)';
|
|
2984
|
+
}
|
|
2985
|
+
else {
|
|
2986
|
+
this.mode = 'backend-frontend(ipc-electron)';
|
|
2987
|
+
}
|
|
2811
2988
|
}
|
|
2812
2989
|
if (!this.mode && !this.config.abstract) {
|
|
2813
2990
|
Helpers.error(`[taon] Context "${this.contextName}": You need to provide host or remoteHost or useIpcWhenElectron`, false, true);
|
|
@@ -3015,6 +3192,7 @@ class EndpointContext {
|
|
|
3015
3192
|
/* */
|
|
3016
3193
|
/* */
|
|
3017
3194
|
/* */
|
|
3195
|
+
/* */
|
|
3018
3196
|
return (void 0);
|
|
3019
3197
|
}
|
|
3020
3198
|
get ngZone() {
|
|
@@ -3288,14 +3466,6 @@ class EndpointContext {
|
|
|
3288
3466
|
return this.uri?.origin;
|
|
3289
3467
|
}
|
|
3290
3468
|
async initSubscribers() {
|
|
3291
|
-
return; // TODO
|
|
3292
|
-
/* */
|
|
3293
|
-
/* */
|
|
3294
|
-
/* */
|
|
3295
|
-
/* */
|
|
3296
|
-
/* */
|
|
3297
|
-
/* */
|
|
3298
|
-
/* */
|
|
3299
3469
|
/* */
|
|
3300
3470
|
/* */
|
|
3301
3471
|
/* */
|
|
@@ -3310,132 +3480,6 @@ class EndpointContext {
|
|
|
3310
3480
|
/* */
|
|
3311
3481
|
/* */
|
|
3312
3482
|
return (void 0);
|
|
3313
|
-
/* */
|
|
3314
|
-
/* */
|
|
3315
|
-
/* */
|
|
3316
|
-
/* */
|
|
3317
|
-
/* */
|
|
3318
|
-
/* */
|
|
3319
|
-
/* */
|
|
3320
|
-
/* */
|
|
3321
|
-
/* */
|
|
3322
|
-
/* */
|
|
3323
|
-
/* */
|
|
3324
|
-
/* */
|
|
3325
|
-
/* */
|
|
3326
|
-
/* */
|
|
3327
|
-
/* */
|
|
3328
|
-
/* */
|
|
3329
|
-
/* */
|
|
3330
|
-
/* */
|
|
3331
|
-
/* */
|
|
3332
|
-
/* */
|
|
3333
|
-
/* */
|
|
3334
|
-
/* */
|
|
3335
|
-
/* */
|
|
3336
|
-
/* */
|
|
3337
|
-
/* */
|
|
3338
|
-
/* */
|
|
3339
|
-
/* */
|
|
3340
|
-
/* */
|
|
3341
|
-
/* */
|
|
3342
|
-
/* */
|
|
3343
|
-
/* */
|
|
3344
|
-
/* */
|
|
3345
|
-
/* */
|
|
3346
|
-
/* */
|
|
3347
|
-
/* */
|
|
3348
|
-
/* */
|
|
3349
|
-
/* */
|
|
3350
|
-
/* */
|
|
3351
|
-
/* */
|
|
3352
|
-
/* */
|
|
3353
|
-
/* */
|
|
3354
|
-
/* */
|
|
3355
|
-
/* */
|
|
3356
|
-
/* */
|
|
3357
|
-
/* */
|
|
3358
|
-
/* */
|
|
3359
|
-
/* */
|
|
3360
|
-
/* */
|
|
3361
|
-
/* */
|
|
3362
|
-
/* */
|
|
3363
|
-
/* */
|
|
3364
|
-
/* */
|
|
3365
|
-
/* */
|
|
3366
|
-
/* */
|
|
3367
|
-
/* */
|
|
3368
|
-
/* */
|
|
3369
|
-
/* */
|
|
3370
|
-
/* */
|
|
3371
|
-
/* */
|
|
3372
|
-
/* */
|
|
3373
|
-
/* */
|
|
3374
|
-
/* */
|
|
3375
|
-
/* */
|
|
3376
|
-
/* */
|
|
3377
|
-
/* */
|
|
3378
|
-
/* */
|
|
3379
|
-
/* */
|
|
3380
|
-
/* */
|
|
3381
|
-
/* */
|
|
3382
|
-
/* */
|
|
3383
|
-
/* */
|
|
3384
|
-
/* */
|
|
3385
|
-
/* */
|
|
3386
|
-
/* */
|
|
3387
|
-
/* */
|
|
3388
|
-
/* */
|
|
3389
|
-
/* */
|
|
3390
|
-
/* */
|
|
3391
|
-
/* */
|
|
3392
|
-
/* */
|
|
3393
|
-
/* */
|
|
3394
|
-
/* */
|
|
3395
|
-
/* */
|
|
3396
|
-
/* */
|
|
3397
|
-
/* */
|
|
3398
|
-
/* */
|
|
3399
|
-
/* */
|
|
3400
|
-
/* */
|
|
3401
|
-
/* */
|
|
3402
|
-
/* */
|
|
3403
|
-
/* */
|
|
3404
|
-
/* */
|
|
3405
|
-
/* */
|
|
3406
|
-
/* */
|
|
3407
|
-
/* */
|
|
3408
|
-
/* */
|
|
3409
|
-
/* */
|
|
3410
|
-
/* */
|
|
3411
|
-
/* */
|
|
3412
|
-
/* */
|
|
3413
|
-
/* */
|
|
3414
|
-
/* */
|
|
3415
|
-
/* */
|
|
3416
|
-
/* */
|
|
3417
|
-
/* */
|
|
3418
|
-
/* */
|
|
3419
|
-
/* */
|
|
3420
|
-
/* */
|
|
3421
|
-
/* */
|
|
3422
|
-
/* */
|
|
3423
|
-
/* */
|
|
3424
|
-
/* */
|
|
3425
|
-
/* */
|
|
3426
|
-
/* */
|
|
3427
|
-
/* */
|
|
3428
|
-
/* */
|
|
3429
|
-
/* */
|
|
3430
|
-
/* */
|
|
3431
|
-
/* */
|
|
3432
|
-
/* */
|
|
3433
|
-
/* */
|
|
3434
|
-
/* */
|
|
3435
|
-
/* */
|
|
3436
|
-
/* */
|
|
3437
|
-
/* */
|
|
3438
|
-
/* */
|
|
3439
3483
|
}
|
|
3440
3484
|
async initEntities() {
|
|
3441
3485
|
/* */
|
|
@@ -3548,6 +3592,8 @@ class EndpointContext {
|
|
|
3548
3592
|
/* */
|
|
3549
3593
|
/* */
|
|
3550
3594
|
/* */
|
|
3595
|
+
/* */
|
|
3596
|
+
/* */
|
|
3551
3597
|
return (void 0);
|
|
3552
3598
|
}
|
|
3553
3599
|
initMetadata() {
|
|
@@ -4470,6 +4516,7 @@ const createContext = (configFn) => {
|
|
|
4470
4516
|
return config.contextName;
|
|
4471
4517
|
},
|
|
4472
4518
|
/**
|
|
4519
|
+
* @deprecated
|
|
4473
4520
|
* - get reference to internal context
|
|
4474
4521
|
*/
|
|
4475
4522
|
async __ref() {
|
|
@@ -4480,6 +4527,10 @@ const createContext = (configFn) => {
|
|
|
4480
4527
|
}
|
|
4481
4528
|
return endpointContextRef;
|
|
4482
4529
|
},
|
|
4530
|
+
/**
|
|
4531
|
+
* only for internal use
|
|
4532
|
+
* @deprecated
|
|
4533
|
+
*/
|
|
4483
4534
|
get __refSync() {
|
|
4484
4535
|
return endpointContextRef;
|
|
4485
4536
|
},
|
|
@@ -4522,6 +4573,20 @@ const createContext = (configFn) => {
|
|
|
4522
4573
|
});
|
|
4523
4574
|
});
|
|
4524
4575
|
},
|
|
4576
|
+
/**
|
|
4577
|
+
* realtime communication with server
|
|
4578
|
+
* Udp socket.io (or ipc) based.
|
|
4579
|
+
*/
|
|
4580
|
+
get realtime() {
|
|
4581
|
+
return {
|
|
4582
|
+
get client() {
|
|
4583
|
+
return endpointContextRef.realtimeClient;
|
|
4584
|
+
},
|
|
4585
|
+
get server() {
|
|
4586
|
+
return endpointContextRef.realtimeServer;
|
|
4587
|
+
}
|
|
4588
|
+
};
|
|
4589
|
+
},
|
|
4525
4590
|
};
|
|
4526
4591
|
return res;
|
|
4527
4592
|
};
|
|
@@ -4544,172 +4609,151 @@ var baseContext = /*#__PURE__*/Object.freeze({
|
|
|
4544
4609
|
BaseContext: BaseContext
|
|
4545
4610
|
});
|
|
4546
4611
|
|
|
4547
|
-
class TaonSubscriberOptions extends Models.DecoratorAbstractOpt {
|
|
4548
|
-
}
|
|
4549
4612
|
function TaonSubscriber(options) {
|
|
4550
4613
|
return function (constructor) {
|
|
4551
4614
|
Reflect.defineMetadata(Symbols.metadata.options.repository, options, constructor);
|
|
4552
4615
|
Reflect.defineMetadata(Symbols.metadata.className, options?.className || constructor.name, constructor);
|
|
4553
4616
|
ClassHelpers.setName(constructor, options?.className);
|
|
4554
|
-
return class extends constructor {
|
|
4555
|
-
constructor(...args) {
|
|
4556
|
-
super(...args);
|
|
4557
|
-
const methodNamesAll = ClassHelpers.getMethodsNames(constructor.prototype);
|
|
4558
|
-
const methodNames = methodNamesAll.filter(m => {
|
|
4559
|
-
return (!['__trigger_event__', 'clone'].includes(m) &&
|
|
4560
|
-
!m.startsWith('_') &&
|
|
4561
|
-
!m.startsWith('inject'));
|
|
4562
|
-
});
|
|
4563
|
-
methodNames.forEach(methodName => {
|
|
4564
|
-
const originalMethod = this[methodName];
|
|
4565
|
-
this[methodName] = async (...methodArgs) => {
|
|
4566
|
-
const result = originalMethod.apply(this, methodArgs);
|
|
4567
|
-
if (result instanceof Promise) {
|
|
4568
|
-
await result;
|
|
4569
|
-
}
|
|
4570
|
-
if (options.allowedEvents === undefined ||
|
|
4571
|
-
options.allowedEvents.includes(methodName)) {
|
|
4572
|
-
// @ts-ignore
|
|
4573
|
-
this.__trigger_event__(methodName);
|
|
4574
|
-
}
|
|
4575
|
-
return result;
|
|
4576
|
-
};
|
|
4577
|
-
});
|
|
4578
|
-
}
|
|
4579
|
-
};
|
|
4580
4617
|
};
|
|
4581
4618
|
}
|
|
4619
|
+
class TaonSubscriberOptions extends Models.DecoratorAbstractOpt {
|
|
4620
|
+
}
|
|
4582
4621
|
;
|
|
4583
4622
|
({}); // @--end-of-file-for-module=taon lib/decorators/classes/subscriber-decorator.ts
|
|
4584
4623
|
|
|
4585
|
-
let BaseSubscriber = class BaseSubscriber extends BaseInjector {
|
|
4586
|
-
__trigger_event__(eventName) {
|
|
4587
|
-
const ctx = this.__endpoint_context__;
|
|
4588
|
-
console.log('Trigger event', eventName, ctx);
|
|
4589
|
-
}
|
|
4590
|
-
};
|
|
4591
|
-
BaseSubscriber = __decorate([
|
|
4592
|
-
TaonSubscriber({
|
|
4593
|
-
className: 'BaseSubscriber',
|
|
4594
|
-
})
|
|
4595
|
-
], BaseSubscriber);
|
|
4596
|
-
;
|
|
4597
|
-
({}); // @--end-of-file-for-module=taon lib/base-classes/base-subscriber.ts
|
|
4598
|
-
|
|
4599
4624
|
let BaseSubscriberForEntity = class BaseSubscriberForEntity extends BaseInjector {
|
|
4600
4625
|
/**
|
|
4601
4626
|
* Called after entity is loaded.
|
|
4602
4627
|
*/
|
|
4603
4628
|
afterLoad(entity) {
|
|
4604
|
-
|
|
4629
|
+
this.__endpoint_context__.logDb &&
|
|
4630
|
+
console.log(`AFTER ENTITY LOADED: `, entity);
|
|
4605
4631
|
}
|
|
4606
4632
|
/**
|
|
4607
4633
|
* Called before query execution.
|
|
4608
4634
|
*/
|
|
4609
4635
|
beforeQuery(event) {
|
|
4610
|
-
|
|
4636
|
+
this.__endpoint_context__.logDb &&
|
|
4637
|
+
console.log(`BEFORE QUERY: `, event.query);
|
|
4611
4638
|
}
|
|
4612
4639
|
/**
|
|
4613
4640
|
* Called after query execution.
|
|
4614
4641
|
*/
|
|
4615
4642
|
afterQuery(event) {
|
|
4616
|
-
|
|
4643
|
+
this.__endpoint_context__.logDb &&
|
|
4644
|
+
console.log(`AFTER QUERY: `, event.query);
|
|
4617
4645
|
}
|
|
4618
4646
|
/**
|
|
4619
4647
|
* Called before entity insertion.
|
|
4620
4648
|
*/
|
|
4621
4649
|
beforeInsert(event) {
|
|
4622
|
-
|
|
4650
|
+
this.__endpoint_context__.logDb &&
|
|
4651
|
+
console.log(`BEFORE ENTITY INSERTED: `, event.entity);
|
|
4623
4652
|
}
|
|
4624
4653
|
/**
|
|
4625
4654
|
* Called after entity insertion.
|
|
4626
4655
|
*/
|
|
4627
4656
|
afterInsert(event) {
|
|
4628
|
-
|
|
4657
|
+
this.__endpoint_context__.logDb &&
|
|
4658
|
+
console.log(`AFTER ENTITY INSERTED: `, event.entity);
|
|
4629
4659
|
}
|
|
4630
4660
|
/**
|
|
4631
4661
|
* Called before entity update.
|
|
4632
4662
|
*/
|
|
4633
4663
|
beforeUpdate(event) {
|
|
4634
|
-
|
|
4664
|
+
this.__endpoint_context__.logDb &&
|
|
4665
|
+
console.log(`BEFORE ENTITY UPDATED: `, event.entity);
|
|
4635
4666
|
}
|
|
4636
4667
|
/**
|
|
4637
4668
|
* Called after entity update.
|
|
4638
4669
|
*/
|
|
4639
4670
|
afterUpdate(event) {
|
|
4640
|
-
|
|
4671
|
+
this.__endpoint_context__.logDb &&
|
|
4672
|
+
console.log(`AFTER ENTITY UPDATED: `, event.entity);
|
|
4641
4673
|
}
|
|
4642
4674
|
/**
|
|
4643
4675
|
* Called before entity removal.
|
|
4644
4676
|
*/
|
|
4645
4677
|
beforeRemove(event) {
|
|
4646
|
-
|
|
4678
|
+
this.__endpoint_context__.logDb &&
|
|
4679
|
+
console.log(`BEFORE ENTITY WITH ID ${event.entityId} REMOVED: `, event.entity);
|
|
4647
4680
|
}
|
|
4648
4681
|
/**
|
|
4649
4682
|
* Called after entity removal.
|
|
4650
4683
|
*/
|
|
4651
4684
|
afterRemove(event) {
|
|
4652
|
-
|
|
4685
|
+
this.__endpoint_context__.logDb &&
|
|
4686
|
+
console.log(`AFTER ENTITY WITH ID ${event.entityId} REMOVED: `, event.entity);
|
|
4653
4687
|
}
|
|
4654
4688
|
/**
|
|
4655
4689
|
* Called before entity removal.
|
|
4656
4690
|
*/
|
|
4657
4691
|
beforeSoftRemove(event) {
|
|
4658
|
-
|
|
4692
|
+
this.__endpoint_context__.logDb &&
|
|
4693
|
+
console.log(`BEFORE ENTITY WITH ID ${event.entityId} SOFT REMOVED: `, event.entity);
|
|
4659
4694
|
}
|
|
4660
4695
|
/**
|
|
4661
4696
|
* Called after entity removal.
|
|
4662
4697
|
*/
|
|
4663
4698
|
afterSoftRemove(event) {
|
|
4664
|
-
|
|
4699
|
+
this.__endpoint_context__.logDb &&
|
|
4700
|
+
console.log(`AFTER ENTITY WITH ID ${event.entityId} SOFT REMOVED: `, event.entity);
|
|
4665
4701
|
}
|
|
4666
4702
|
/**
|
|
4667
4703
|
* Called before entity recovery.
|
|
4668
4704
|
*/
|
|
4669
4705
|
beforeRecover(event) {
|
|
4670
|
-
|
|
4706
|
+
this.__endpoint_context__.logDb &&
|
|
4707
|
+
console.log(`BEFORE ENTITY WITH ID ${event.entityId} RECOVERED: `, event.entity);
|
|
4671
4708
|
}
|
|
4672
4709
|
/**
|
|
4673
4710
|
* Called after entity recovery.
|
|
4674
4711
|
*/
|
|
4675
4712
|
afterRecover(event) {
|
|
4676
|
-
|
|
4713
|
+
this.__endpoint_context__.logDb &&
|
|
4714
|
+
console.log(`AFTER ENTITY WITH ID ${event.entityId} RECOVERED: `, event.entity);
|
|
4677
4715
|
}
|
|
4678
4716
|
/**
|
|
4679
4717
|
* Called before transaction start.
|
|
4680
4718
|
*/
|
|
4681
4719
|
beforeTransactionStart(event) {
|
|
4682
|
-
|
|
4720
|
+
this.__endpoint_context__.logDb &&
|
|
4721
|
+
console.log(`BEFORE TRANSACTION STARTED: `, event);
|
|
4683
4722
|
}
|
|
4684
4723
|
/**
|
|
4685
4724
|
* Called after transaction start.
|
|
4686
4725
|
*/
|
|
4687
4726
|
afterTransactionStart(event) {
|
|
4688
|
-
|
|
4727
|
+
this.__endpoint_context__.logDb &&
|
|
4728
|
+
console.log(`AFTER TRANSACTION STARTED: `, event);
|
|
4689
4729
|
}
|
|
4690
4730
|
/**
|
|
4691
4731
|
* Called before transaction commit.
|
|
4692
4732
|
*/
|
|
4693
4733
|
beforeTransactionCommit(event) {
|
|
4694
|
-
|
|
4734
|
+
this.__endpoint_context__.logDb &&
|
|
4735
|
+
console.log(`BEFORE TRANSACTION COMMITTED: `, event);
|
|
4695
4736
|
}
|
|
4696
4737
|
/**
|
|
4697
4738
|
* Called after transaction commit.
|
|
4698
4739
|
*/
|
|
4699
4740
|
afterTransactionCommit(event) {
|
|
4700
|
-
|
|
4741
|
+
this.__endpoint_context__.logDb &&
|
|
4742
|
+
console.log(`AFTER TRANSACTION COMMITTED: `, event);
|
|
4701
4743
|
}
|
|
4702
4744
|
/**
|
|
4703
4745
|
* Called before transaction rollback.
|
|
4704
4746
|
*/
|
|
4705
4747
|
beforeTransactionRollback(event) {
|
|
4706
|
-
|
|
4748
|
+
this.__endpoint_context__.logDb &&
|
|
4749
|
+
console.log(`BEFORE TRANSACTION ROLLBACK: `, event);
|
|
4707
4750
|
}
|
|
4708
4751
|
/**
|
|
4709
4752
|
* Called after transaction rollback.
|
|
4710
4753
|
*/
|
|
4711
4754
|
afterTransactionRollback(event) {
|
|
4712
|
-
|
|
4755
|
+
this.__endpoint_context__.logDb &&
|
|
4756
|
+
console.log(`AFTER TRANSACTION ROLLBACK: `, event);
|
|
4713
4757
|
}
|
|
4714
4758
|
};
|
|
4715
4759
|
BaseSubscriberForEntity = __decorate([
|
|
@@ -4729,7 +4773,6 @@ var Base;
|
|
|
4729
4773
|
Base.Provider = BaseProvider;
|
|
4730
4774
|
Base.Class = BaseClass;
|
|
4731
4775
|
Base.Repository = BaseRepository;
|
|
4732
|
-
Base.Subscriber = BaseSubscriber;
|
|
4733
4776
|
Base.SubscriberForEntity = BaseSubscriberForEntity;
|
|
4734
4777
|
Base.Context = BaseContext;
|
|
4735
4778
|
})(Base || (Base = {}));
|
|
@@ -4797,42 +4840,9 @@ const inject = (entity) => {
|
|
|
4797
4840
|
},
|
|
4798
4841
|
});
|
|
4799
4842
|
};
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
const obs = eventsSrc.asObservable();
|
|
4804
|
-
let isFirstSubscription = true;
|
|
4805
|
-
const proxiedObservable = new Proxy(obs, {
|
|
4806
|
-
get(target, prop, receiver) {
|
|
4807
|
-
if (prop === 'subscribe') {
|
|
4808
|
-
return (...args) => {
|
|
4809
|
-
if (isFirstSubscription) {
|
|
4810
|
-
isFirstSubscription = false;
|
|
4811
|
-
const subscriberClassFN = subscriberClassResolveFn();
|
|
4812
|
-
const ctx = subscriberClassFN[Symbols.ctxInClassOrClassObj];
|
|
4813
|
-
if (!ctx) {
|
|
4814
|
-
throw new Error(`You are trying to inject class without context. Use context like this;
|
|
4815
|
-
|
|
4816
|
-
Taon.injectSubscriberEvents( ()=> ` +
|
|
4817
|
-
`MyContext.getInstance(${subscriberClassFN?.name}), '${eventName}' )
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
`);
|
|
4821
|
-
}
|
|
4822
|
-
const subscriberInstance = ctx.getInstanceBy(subscriberClassFN);
|
|
4823
|
-
console.log('First subscription, you can access arguments here:', {
|
|
4824
|
-
subscriberClassFN,
|
|
4825
|
-
eventName,
|
|
4826
|
-
});
|
|
4827
|
-
}
|
|
4828
|
-
return target.subscribe(...args);
|
|
4829
|
-
};
|
|
4830
|
-
}
|
|
4831
|
-
return Reflect.get(target, prop, receiver);
|
|
4832
|
-
},
|
|
4833
|
-
});
|
|
4834
|
-
return proxiedObservable;
|
|
4835
|
-
};
|
|
4843
|
+
/**
|
|
4844
|
+
* TODO
|
|
4845
|
+
*/
|
|
4836
4846
|
;
|
|
4837
4847
|
({}); // @--end-of-file-for-module=taon lib/inject.ts
|
|
4838
4848
|
|
|
@@ -4849,21 +4859,9 @@ var Taon;
|
|
|
4849
4859
|
Taon.Provider = TaonProvider;
|
|
4850
4860
|
Taon.Repository = TaonRepository;
|
|
4851
4861
|
Taon.Subscriber = TaonSubscriber;
|
|
4852
|
-
/**
|
|
4853
|
-
* @deprecated
|
|
4854
|
-
*/
|
|
4855
4862
|
Taon.isBrowser = coreHelpers.Helpers.isBrowser;
|
|
4856
|
-
/**
|
|
4857
|
-
* @deprecated
|
|
4858
|
-
*/
|
|
4859
4863
|
Taon.isNode = coreHelpers.Helpers.isNode;
|
|
4860
|
-
/**
|
|
4861
|
-
* @deprecated
|
|
4862
|
-
*/
|
|
4863
4864
|
Taon.isWebSQL = coreHelpers.Helpers.isWebSQL;
|
|
4864
|
-
/**
|
|
4865
|
-
* @deprecated
|
|
4866
|
-
*/
|
|
4867
4865
|
Taon.isElectron = coreHelpers.Helpers.isElectron;
|
|
4868
4866
|
Taon.createContext = createContext;
|
|
4869
4867
|
Taon.inject = inject;
|
|
@@ -4897,5 +4895,5 @@ var Taon;
|
|
|
4897
4895
|
* Generated bundle index. Do not edit.
|
|
4898
4896
|
*/
|
|
4899
4897
|
|
|
4900
|
-
export { BaseContext, BaseController, BaseEntity, BaseProvider, BaseRepository,
|
|
4898
|
+
export { BaseContext, BaseController, BaseEntity, BaseProvider, BaseRepository, ClassHelpers, Models, Taon, createContext, inject };
|
|
4901
4899
|
//# sourceMappingURL=taon.mjs.map
|