@flowcore/data-pump 0.1.2
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/CHANGELOG.md +32 -0
- package/README.md +28 -0
- package/esm/_dnt.shims.d.ts +9 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +64 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/api-key/api-key.create.d.ts +46 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/api-key/api-key.create.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/api-key/api-key.create.js +94 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/api-key/api-key.delete.d.ts +28 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/api-key/api-key.delete.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/api-key/api-key.delete.js +60 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/api-key/api-key.list.d.ts +27 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/api-key/api-key.list.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/api-key/api-key.list.js +58 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.create.d.ts +43 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.create.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.create.js +44 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.delete-request.d.ts +37 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.delete-request.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.delete-request.js +94 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.exists.d.ts +37 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.exists.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.exists.js +33 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.fetch.d.ts +55 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.fetch.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.fetch.js +59 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.list.d.ts +33 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.list.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.list.js +40 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.update.d.ts +41 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.update.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.update.js +43 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.create.d.ts +39 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.create.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.create.js +44 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.delete-request.d.ts +41 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.delete-request.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.delete-request.js +107 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.exists.d.ts +37 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.exists.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.exists.js +33 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.fetch.d.ts +49 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.fetch.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.fetch.js +59 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.list.d.ts +31 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.list.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.list.js +36 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.truncate-request.d.ts +41 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.truncate-request.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.truncate-request.js +107 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.update.d.ts +37 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.update.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.update.js +39 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/events/events.fetch-time-buckets-by-names.d.ts +53 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/events/events.fetch-time-buckets-by-names.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/events/events.fetch-time-buckets-by-names.js +41 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/events/events.fetch.d.ts +58 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/events/events.fetch.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/events/events.fetch.js +54 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.create.d.ts +39 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.create.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.create.js +44 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.delete-request.d.ts +54 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.delete-request.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.delete-request.js +127 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.exists.d.ts +39 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.exists.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.exists.js +33 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.fetch.d.ts +55 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.fetch.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.fetch.js +59 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.list.d.ts +31 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.list.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.list.js +36 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.update.d.ts +37 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.update.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.update.js +39 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/index.d.ts +33 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/index.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/index.js +40 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/secret/secret.create.d.ts +30 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/secret/secret.create.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/secret/secret.create.js +60 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/secret/secret.delete.d.ts +28 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/secret/secret.delete.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/secret/secret.delete.js +60 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/secret/secret.list.d.ts +26 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/secret/secret.list.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/secret/secret.list.js +63 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/tenant/tenant.fetch.d.ts +42 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/tenant/tenant.fetch.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/tenant/tenant.fetch.js +79 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/tenant/tenant.list.d.ts +20 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/tenant/tenant.list.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/tenant/tenant.list.js +65 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/variable/variable.create.d.ts +31 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/variable/variable.create.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/variable/variable.create.js +66 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/variable/variable.delete.d.ts +28 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/variable/variable.delete.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/variable/variable.delete.js +63 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/variable/variable.list.d.ts +27 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/variable/variable.list.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/variable/variable.list.js +69 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/common/command.d.ts +85 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/common/command.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/common/command.js +129 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/common/flowcore-client.d.ts +56 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/common/flowcore-client.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/common/flowcore-client.js +126 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/common/notification-client.d.ts +90 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/common/notification-client.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/common/notification-client.js +247 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/api-key.d.ts +14 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/api-key.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/api-key.js +9 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/data-core.d.ts +41 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/data-core.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/data-core.js +42 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/event-type.d.ts +37 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/event-type.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/event-type.js +39 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/event.d.ts +20 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/event.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/event.js +15 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/flow-type.d.ts +34 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/flow-type.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/flow-type.js +34 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/index.d.ts +6 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/index.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/index.js +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/tenant.d.ts +50 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/tenant.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/tenant.js +33 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/variable.d.ts +13 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/variable.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/variable.js +8 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/client-error.d.ts +9 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/client-error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/client-error.js +20 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/command-error.d.ts +7 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/command-error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/command-error.js +8 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/index.d.ts +5 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/index.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/index.js +4 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/invalid-response.d.ts +8 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/invalid-response.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/invalid-response.js +15 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/not-found.d.ts +7 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/not-found.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/not-found.js +8 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/mod.d.ts +8 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/mod.js +7 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/utils/logger.d.ts +8 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/utils/logger.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/utils/logger.js +14 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/utils/parse-response-helper.d.ts +6 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/utils/parse-response-helper.d.ts.map +1 -0
- package/esm/deps/jsr.io/@flowcore/sdk/1.11.4/src/utils/parse-response-helper.js +16 -0
- package/esm/lib/data-pump-client.d.ts +30 -0
- package/esm/lib/data-pump-client.d.ts.map +1 -0
- package/esm/lib/data-pump-client.js +52 -0
- package/esm/lib/data-pump.d.ts +75 -0
- package/esm/lib/data-pump.d.ts.map +1 -0
- package/esm/lib/data-pump.js +364 -0
- package/esm/lib/nats-notifier.d.ts +18 -0
- package/esm/lib/nats-notifier.d.ts.map +1 -0
- package/esm/lib/nats-notifier.js +88 -0
- package/esm/lib/time-uuid.d.ts +13 -0
- package/esm/lib/time-uuid.d.ts.map +1 -0
- package/esm/lib/time-uuid.js +36 -0
- package/esm/lib/ws-notifier.d.ts +28 -0
- package/esm/lib/ws-notifier.d.ts.map +1 -0
- package/esm/lib/ws-notifier.js +87 -0
- package/esm/mod.d.ts +3 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +2 -0
- package/esm/package.json +3 -0
- package/package.json +38 -0
- package/script/_dnt.shims.d.ts +9 -0
- package/script/_dnt.shims.d.ts.map +1 -0
- package/script/_dnt.shims.js +72 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/api-key/api-key.create.d.ts +46 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/api-key/api-key.create.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/api-key/api-key.create.js +98 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/api-key/api-key.delete.d.ts +28 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/api-key/api-key.delete.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/api-key/api-key.delete.js +64 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/api-key/api-key.list.d.ts +27 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/api-key/api-key.list.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/api-key/api-key.list.js +62 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.create.d.ts +43 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.create.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.create.js +48 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.delete-request.d.ts +37 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.delete-request.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.delete-request.js +98 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.exists.d.ts +37 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.exists.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.exists.js +37 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.fetch.d.ts +55 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.fetch.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.fetch.js +63 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.list.d.ts +33 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.list.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.list.js +44 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.update.d.ts +41 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.update.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/data-core/data-core.update.js +47 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.create.d.ts +39 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.create.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.create.js +48 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.delete-request.d.ts +41 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.delete-request.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.delete-request.js +111 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.exists.d.ts +37 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.exists.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.exists.js +37 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.fetch.d.ts +49 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.fetch.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.fetch.js +63 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.list.d.ts +31 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.list.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.list.js +40 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.truncate-request.d.ts +41 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.truncate-request.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.truncate-request.js +111 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.update.d.ts +37 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.update.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/event-type/event-type.update.js +43 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/events/events.fetch-time-buckets-by-names.d.ts +53 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/events/events.fetch-time-buckets-by-names.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/events/events.fetch-time-buckets-by-names.js +45 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/events/events.fetch.d.ts +58 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/events/events.fetch.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/events/events.fetch.js +58 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.create.d.ts +39 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.create.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.create.js +48 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.delete-request.d.ts +54 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.delete-request.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.delete-request.js +131 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.exists.d.ts +39 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.exists.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.exists.js +37 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.fetch.d.ts +55 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.fetch.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.fetch.js +63 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.list.d.ts +31 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.list.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.list.js +40 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.update.d.ts +37 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.update.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/flow-type/flow-type.update.js +43 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/index.d.ts +33 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/index.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/index.js +56 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/secret/secret.create.d.ts +30 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/secret/secret.create.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/secret/secret.create.js +64 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/secret/secret.delete.d.ts +28 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/secret/secret.delete.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/secret/secret.delete.js +64 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/secret/secret.list.d.ts +26 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/secret/secret.list.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/secret/secret.list.js +67 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/tenant/tenant.fetch.d.ts +42 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/tenant/tenant.fetch.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/tenant/tenant.fetch.js +83 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/tenant/tenant.list.d.ts +20 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/tenant/tenant.list.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/tenant/tenant.list.js +69 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/variable/variable.create.d.ts +31 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/variable/variable.create.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/variable/variable.create.js +70 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/variable/variable.delete.d.ts +28 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/variable/variable.delete.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/variable/variable.delete.js +67 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/variable/variable.list.d.ts +27 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/variable/variable.list.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/commands/variable/variable.list.js +73 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/common/command.d.ts +85 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/common/command.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/common/command.js +134 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/common/flowcore-client.d.ts +56 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/common/flowcore-client.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/common/flowcore-client.js +130 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/common/notification-client.d.ts +90 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/common/notification-client.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/common/notification-client.js +274 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/api-key.d.ts +14 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/api-key.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/api-key.js +12 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/data-core.d.ts +41 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/data-core.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/data-core.js +46 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/event-type.d.ts +37 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/event-type.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/event-type.js +43 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/event.d.ts +20 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/event.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/event.js +18 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/flow-type.d.ts +34 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/flow-type.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/flow-type.js +38 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/index.d.ts +6 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/index.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/index.js +2 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/tenant.d.ts +50 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/tenant.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/tenant.js +37 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/variable.d.ts +13 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/variable.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/contracts/variable.js +11 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/client-error.d.ts +9 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/client-error.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/client-error.js +24 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/command-error.d.ts +7 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/command-error.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/command-error.js +12 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/index.d.ts +5 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/index.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/index.js +20 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/invalid-response.d.ts +8 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/invalid-response.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/invalid-response.js +19 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/not-found.d.ts +7 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/not-found.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/exceptions/not-found.js +12 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/mod.d.ts +8 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/mod.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/mod.js +23 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/utils/logger.d.ts +8 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/utils/logger.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/utils/logger.js +17 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/utils/parse-response-helper.d.ts +6 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/utils/parse-response-helper.d.ts.map +1 -0
- package/script/deps/jsr.io/@flowcore/sdk/1.11.4/src/utils/parse-response-helper.js +20 -0
- package/script/lib/data-pump-client.d.ts +30 -0
- package/script/lib/data-pump-client.d.ts.map +1 -0
- package/script/lib/data-pump-client.js +58 -0
- package/script/lib/data-pump.d.ts +75 -0
- package/script/lib/data-pump.d.ts.map +1 -0
- package/script/lib/data-pump.js +368 -0
- package/script/lib/nats-notifier.d.ts +18 -0
- package/script/lib/nats-notifier.d.ts.map +1 -0
- package/script/lib/nats-notifier.js +115 -0
- package/script/lib/time-uuid.d.ts +13 -0
- package/script/lib/time-uuid.d.ts.map +1 -0
- package/script/lib/time-uuid.js +40 -0
- package/script/lib/ws-notifier.d.ts +28 -0
- package/script/lib/ws-notifier.d.ts.map +1 -0
- package/script/lib/ws-notifier.js +94 -0
- package/script/mod.d.ts +3 -0
- package/script/mod.d.ts.map +1 -0
- package/script/mod.js +18 -0
- package/script/package.json +3 -0
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { DataCoreFetchCommand, EventsFetchCommand, EventsFetchTimeBucketsByNamesCommand, TenantFetchCommand, } from "../deps/jsr.io/@flowcore/sdk/1.11.4/src/mod.js";
|
|
2
|
+
import { TimeUuid } from "./time-uuid.js";
|
|
3
|
+
import { format, startOfHour } from "date-fns";
|
|
4
|
+
import { utc } from "@date-fns/utc";
|
|
5
|
+
var FlowcoreBufferEventStatus;
|
|
6
|
+
(function (FlowcoreBufferEventStatus) {
|
|
7
|
+
FlowcoreBufferEventStatus["OPEN"] = "open";
|
|
8
|
+
FlowcoreBufferEventStatus["DELIVERED"] = "delivered";
|
|
9
|
+
})(FlowcoreBufferEventStatus || (FlowcoreBufferEventStatus = {}));
|
|
10
|
+
export class DataPump {
|
|
11
|
+
constructor(options) {
|
|
12
|
+
Object.defineProperty(this, "options", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: options
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(this, "logger", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: void 0
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(this, "state", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
value: void 0
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(this, "_timeBuckets", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true,
|
|
33
|
+
writable: true,
|
|
34
|
+
value: []
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(this, "buffer", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
writable: true,
|
|
40
|
+
value: []
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(this, "bufferWaiter", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true,
|
|
45
|
+
writable: true,
|
|
46
|
+
value: null
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(this, "waiter", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
configurable: true,
|
|
51
|
+
writable: true,
|
|
52
|
+
value: null
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(this, "running", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
configurable: true,
|
|
57
|
+
writable: true,
|
|
58
|
+
value: false
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(this, "notifierAbortController", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
configurable: true,
|
|
63
|
+
writable: true,
|
|
64
|
+
value: void 0
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(this, "dataCoreId", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
configurable: true,
|
|
69
|
+
writable: true,
|
|
70
|
+
value: void 0
|
|
71
|
+
});
|
|
72
|
+
this.state = {
|
|
73
|
+
timeBucket: this.getNowTimeBucket(),
|
|
74
|
+
};
|
|
75
|
+
this.logger = options.logger ?? undefined;
|
|
76
|
+
}
|
|
77
|
+
async start() {
|
|
78
|
+
if (this.running) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
await this.updateTimeBuckets();
|
|
82
|
+
const newState = await this.options.stateManager.getState();
|
|
83
|
+
if (!newState) {
|
|
84
|
+
this.state.timeBucket = this.getClosestTimeBucket(this.getNowTimeBucket());
|
|
85
|
+
this.state.eventId = TimeUuid.fromNow().toString();
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
this.state.timeBucket = this.getClosestTimeBucket(newState.timeBucket);
|
|
89
|
+
this.state.eventId = newState.eventId;
|
|
90
|
+
}
|
|
91
|
+
this.running = true;
|
|
92
|
+
this.logger?.debug("Starting event buffer loop");
|
|
93
|
+
this.eventBufferLoop()
|
|
94
|
+
.then(() => this.logger?.debug("Event buffer loop stopped"))
|
|
95
|
+
.catch((error) => this.logger?.error("Error in event buffer loop", { error }))
|
|
96
|
+
.finally(() => this.stop());
|
|
97
|
+
if (this.options.processor) {
|
|
98
|
+
this.logger?.debug("Starting processor");
|
|
99
|
+
this.proceccor()
|
|
100
|
+
.then(() => this.logger?.debug("Processor stopped"))
|
|
101
|
+
.catch((error) => this.logger?.error("Error in processor", { error }))
|
|
102
|
+
.finally(() => this.stop());
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
stop() {
|
|
106
|
+
if (!this.running) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
this.logger?.debug("Stopping data pump");
|
|
110
|
+
this.running = false;
|
|
111
|
+
this.notifierAbortController?.abort("stopping");
|
|
112
|
+
this.bufferWaiter?.(true);
|
|
113
|
+
this.waiter?.(true);
|
|
114
|
+
}
|
|
115
|
+
async proceccor() {
|
|
116
|
+
if (!this.options.processor) {
|
|
117
|
+
throw new Error("Processor not set");
|
|
118
|
+
}
|
|
119
|
+
while (this.running) {
|
|
120
|
+
try {
|
|
121
|
+
const events = await this.pullInner(this.options.processor.concurrency);
|
|
122
|
+
if (!this.running) {
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
await this.options.processor.onEvents(events);
|
|
126
|
+
await this.acknowledgeInner(events.map((event) => event.eventId));
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
this.logger?.error("Error in processor", { error });
|
|
130
|
+
this.stop();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async eventBufferLoop() {
|
|
135
|
+
// Stop buffer loop if we are not running
|
|
136
|
+
if (!this.running) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
// Buffer is full, wait for some space
|
|
140
|
+
if (this.buffer.length >= this.options.buffer.size - this.options.buffer.threshold && this.running) {
|
|
141
|
+
this.logger?.debug("Buffer is full, waiting for some space");
|
|
142
|
+
await this.waitForBufferThreshold();
|
|
143
|
+
}
|
|
144
|
+
// Stop buffer loop if we are not running
|
|
145
|
+
if (!this.running) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
// How many events should we fetch
|
|
149
|
+
const eventsToFetch = this.options.buffer.size - this.buffer.length;
|
|
150
|
+
this.logger?.debug(`fetching ${eventsToFetch} events from ${this.state.timeBucket} @ ${this.state.eventId ?? "-"}`);
|
|
151
|
+
const timeStart = Date.now();
|
|
152
|
+
const command = new EventsFetchCommand({
|
|
153
|
+
tenant: this.options.dataSource.tenant,
|
|
154
|
+
dataCoreId: await this.getDataCoreId(),
|
|
155
|
+
flowType: this.options.dataSource.flowType,
|
|
156
|
+
eventTypes: this.options.dataSource.eventTypes,
|
|
157
|
+
timeBucket: this.state.timeBucket,
|
|
158
|
+
afterEventId: this.state.eventId,
|
|
159
|
+
pageSize: eventsToFetch,
|
|
160
|
+
});
|
|
161
|
+
const result = await this.options.flowcoreClient.execute(command);
|
|
162
|
+
const time = Date.now() - timeStart;
|
|
163
|
+
// Stop buffer loop if we are not running
|
|
164
|
+
if (!this.running) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const events = result.events.map((event) => ({
|
|
168
|
+
event,
|
|
169
|
+
status: FlowcoreBufferEventStatus.OPEN,
|
|
170
|
+
deliveryCount: 0,
|
|
171
|
+
deliveryTime: 0,
|
|
172
|
+
deliveryId: "",
|
|
173
|
+
}));
|
|
174
|
+
this.buffer.push(...events);
|
|
175
|
+
// Check if we have a waiter and if we have events, notify the waiter
|
|
176
|
+
events.length && this.waiter?.();
|
|
177
|
+
this.logger?.debug(`Got ${result.events.length} events from ${this.state.timeBucket} @ ${this.state.eventId ?? "-"} in ${time}ms. Buffer size ${this.buffer.length}`);
|
|
178
|
+
// Update buffer state
|
|
179
|
+
this.state.eventId = result.events[result.events.length - 1]?.eventId ?? this.state.eventId;
|
|
180
|
+
// If we don't have a next cursor move to next time bucket
|
|
181
|
+
if (!result.nextCursor) {
|
|
182
|
+
// Get next time bucket
|
|
183
|
+
const nextTimeBucketIndex = this.timeBuckets.indexOf(this.state.timeBucket) + 1;
|
|
184
|
+
// There is no next time bucket
|
|
185
|
+
if (!this.timeBuckets[nextTimeBucketIndex]) {
|
|
186
|
+
if (result.events.length) {
|
|
187
|
+
// If we got events, we can try to get more one more time
|
|
188
|
+
this.logger?.debug("Try to get more events");
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
// If we didn't get events, we wait for notifier
|
|
192
|
+
await this.waitForNotifier();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
// Set next time bucket
|
|
197
|
+
this.state.timeBucket = this.timeBuckets[nextTimeBucketIndex];
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return this.eventBufferLoop();
|
|
201
|
+
}
|
|
202
|
+
reOpen(eventIds, deliveryId) {
|
|
203
|
+
if (!eventIds.length) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
this.buffer.forEach((event) => {
|
|
207
|
+
if (event.deliveryId === deliveryId && eventIds.includes(event.event.eventId)) {
|
|
208
|
+
event.status = FlowcoreBufferEventStatus.OPEN;
|
|
209
|
+
event.deliveryId = "";
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
if (this.bufferWaiter && this.buffer.length <= this.options.buffer.size - this.options.buffer.threshold) {
|
|
213
|
+
this.bufferWaiter();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
updateState() {
|
|
217
|
+
const firstEvent = this.buffer[0];
|
|
218
|
+
if (!firstEvent) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
const timeUuid = TimeUuid.fromString(firstEvent.event.eventId);
|
|
222
|
+
const timeBucket = firstEvent.event.timeBucket;
|
|
223
|
+
return this.options.stateManager.setState({ timeBucket, eventId: timeUuid.getBefore().toString() });
|
|
224
|
+
}
|
|
225
|
+
get timeBuckets() {
|
|
226
|
+
const timeBucketNow = this.getNowTimeBucket();
|
|
227
|
+
if (this._timeBuckets[this._timeBuckets.length - 1] !== timeBucketNow) {
|
|
228
|
+
return [...this._timeBuckets, timeBucketNow];
|
|
229
|
+
}
|
|
230
|
+
return this._timeBuckets;
|
|
231
|
+
}
|
|
232
|
+
getClosestTimeBucket(timeBucket) {
|
|
233
|
+
if (!timeBucket.match(/^\d{14}$/)) {
|
|
234
|
+
throw new Error(`Invalid timebucket: ${timeBucket}`);
|
|
235
|
+
}
|
|
236
|
+
return (this.timeBuckets.find((t) => Number.parseFloat(t) >= Number.parseFloat(timeBucket)) ??
|
|
237
|
+
this.timeBuckets[this.timeBuckets.length - 1]);
|
|
238
|
+
}
|
|
239
|
+
async updateTimeBuckets() {
|
|
240
|
+
this._timeBuckets = [];
|
|
241
|
+
let first = true;
|
|
242
|
+
let cursor;
|
|
243
|
+
while (cursor !== undefined || first) {
|
|
244
|
+
first = false;
|
|
245
|
+
const command = new EventsFetchTimeBucketsByNamesCommand({
|
|
246
|
+
tenant: this.options.dataSource.tenant,
|
|
247
|
+
dataCoreId: await this.getDataCoreId(),
|
|
248
|
+
flowType: this.options.dataSource.flowType,
|
|
249
|
+
eventTypes: this.options.dataSource.eventTypes,
|
|
250
|
+
pageSize: 10_000,
|
|
251
|
+
});
|
|
252
|
+
// sdkCommandCount.labels("EventsFetchTimeBucketsByNamesCommand").inc(1)
|
|
253
|
+
const result = await this.options.flowcoreClient.execute(command);
|
|
254
|
+
this._timeBuckets.push(...result.timeBuckets);
|
|
255
|
+
cursor = result.nextCursor;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
async pullInner(amount) {
|
|
259
|
+
if (!this.running) {
|
|
260
|
+
throw new Error("Data pump not running");
|
|
261
|
+
}
|
|
262
|
+
const deliveryId = crypto.randomUUID();
|
|
263
|
+
const events = [];
|
|
264
|
+
for (const event of this.buffer) {
|
|
265
|
+
if (event.status === FlowcoreBufferEventStatus.OPEN) {
|
|
266
|
+
event.status = FlowcoreBufferEventStatus.DELIVERED;
|
|
267
|
+
event.deliveryCount++;
|
|
268
|
+
event.deliveryId = deliveryId;
|
|
269
|
+
events.push(event.event);
|
|
270
|
+
if (events.length >= amount) {
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (!events.length) {
|
|
276
|
+
await this.waitForEvents();
|
|
277
|
+
if (!this.running) {
|
|
278
|
+
return [];
|
|
279
|
+
}
|
|
280
|
+
return this.pullInner(amount);
|
|
281
|
+
}
|
|
282
|
+
setTimeout(() => {
|
|
283
|
+
this.reOpen(events.map((event) => event.eventId), deliveryId);
|
|
284
|
+
}, this.options.buffer.achknowledgeTimeoutMs);
|
|
285
|
+
return events;
|
|
286
|
+
}
|
|
287
|
+
async acknowledgeInner(eventIds) {
|
|
288
|
+
if (!eventIds.length) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
// this.logger.info("Acknowledging events", { events: eventIds.length })
|
|
292
|
+
this.buffer = this.buffer.filter((event) => {
|
|
293
|
+
if (eventIds.includes(event.event.eventId)) {
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
return true;
|
|
297
|
+
});
|
|
298
|
+
if (this.bufferWaiter && this.buffer.length <= this.options.buffer.size - this.options.buffer.threshold) {
|
|
299
|
+
this.bufferWaiter();
|
|
300
|
+
}
|
|
301
|
+
await this.updateState();
|
|
302
|
+
}
|
|
303
|
+
async waitForNotifier() {
|
|
304
|
+
this.logger?.debug("No more events, waiting for notifier...");
|
|
305
|
+
this.notifierAbortController = new AbortController();
|
|
306
|
+
await this.options.notifier.wait({ ...this.options.dataSource, dataCoreId: await this.getDataCoreId() }, this.notifierAbortController.signal);
|
|
307
|
+
this.notifierAbortController = undefined;
|
|
308
|
+
}
|
|
309
|
+
async waitForEvents() {
|
|
310
|
+
this.logger?.debug("No events, waiting for events");
|
|
311
|
+
await new Promise((resolve) => {
|
|
312
|
+
this.waiter = (stopping) => {
|
|
313
|
+
if (!stopping) {
|
|
314
|
+
this.logger?.debug("Notifying waiter that we have events");
|
|
315
|
+
}
|
|
316
|
+
resolve();
|
|
317
|
+
};
|
|
318
|
+
});
|
|
319
|
+
this.waiter = null;
|
|
320
|
+
}
|
|
321
|
+
async waitForBufferThreshold() {
|
|
322
|
+
if (this.buffer.length < this.options.buffer.size - this.options.buffer.threshold) {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
await new Promise((resolve) => {
|
|
326
|
+
this.bufferWaiter = (stopping) => {
|
|
327
|
+
if (!stopping) {
|
|
328
|
+
this.logger?.debug("Notifying buffer waiter that we are under threshold");
|
|
329
|
+
}
|
|
330
|
+
resolve();
|
|
331
|
+
};
|
|
332
|
+
});
|
|
333
|
+
this.bufferWaiter = null;
|
|
334
|
+
}
|
|
335
|
+
getNowTimeBucket() {
|
|
336
|
+
return format(startOfHour(utc(new Date())), "yyyyMMddHH0000");
|
|
337
|
+
}
|
|
338
|
+
async getDataCoreId() {
|
|
339
|
+
if (this.dataCoreId) {
|
|
340
|
+
return this.dataCoreId;
|
|
341
|
+
}
|
|
342
|
+
const tenant = await this.options.flowcoreClient.execute(new TenantFetchCommand({
|
|
343
|
+
tenant: this.options.dataSource.tenant,
|
|
344
|
+
}));
|
|
345
|
+
const dataCore = await this.options.flowcoreClient.execute(new DataCoreFetchCommand({
|
|
346
|
+
dataCore: this.options.dataSource.dataCore,
|
|
347
|
+
tenantId: tenant.id,
|
|
348
|
+
}));
|
|
349
|
+
this.dataCoreId = dataCore.id;
|
|
350
|
+
return this.dataCoreId;
|
|
351
|
+
}
|
|
352
|
+
pull(amount) {
|
|
353
|
+
if (this.options.processor) {
|
|
354
|
+
throw new Error("Pull is not supported when processor is set");
|
|
355
|
+
}
|
|
356
|
+
return this.pullInner(amount);
|
|
357
|
+
}
|
|
358
|
+
acknowledge(eventIds) {
|
|
359
|
+
if (this.options.processor) {
|
|
360
|
+
throw new Error("Acknowledge is not supported when processor is set");
|
|
361
|
+
}
|
|
362
|
+
return this.acknowledgeInner(eventIds);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DataPumpNotifier } from "./data-pump.js";
|
|
2
|
+
interface NatsClientOptions {
|
|
3
|
+
servers: string[];
|
|
4
|
+
timeoutMs?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class NatsNotifier {
|
|
7
|
+
private readonly options;
|
|
8
|
+
private nats;
|
|
9
|
+
private timeoutMs;
|
|
10
|
+
constructor(options: NatsClientOptions);
|
|
11
|
+
private start;
|
|
12
|
+
private stop;
|
|
13
|
+
private awaitMessage;
|
|
14
|
+
private getSubscription;
|
|
15
|
+
getNotifier(): DataPumpNotifier;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=nats-notifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nats-notifier.d.ts","sourceRoot":"","sources":["../../src/lib/nats-notifier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,UAAU,iBAAiB;IACzB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,qBAAa,YAAY;IAGX,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,IAAI,CAAiC;IAC7C,OAAO,CAAC,SAAS,CAAQ;gBACI,OAAO,EAAE,iBAAiB;YAIzC,KAAK;YAOL,IAAI;IAOlB,OAAO,CAAC,YAAY;IAoCpB,OAAO,CAAC,eAAe;IAgBhB,WAAW,IAAI,gBAAgB;CAavC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as Nats from "nats";
|
|
2
|
+
export class NatsNotifier {
|
|
3
|
+
constructor(options) {
|
|
4
|
+
Object.defineProperty(this, "options", {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true,
|
|
8
|
+
value: options
|
|
9
|
+
});
|
|
10
|
+
Object.defineProperty(this, "nats", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: void 0
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(this, "timeoutMs", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: void 0
|
|
21
|
+
});
|
|
22
|
+
this.timeoutMs = options.timeoutMs ?? 20_000;
|
|
23
|
+
}
|
|
24
|
+
async start() {
|
|
25
|
+
if (this.nats) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
this.nats = await Nats.connect({ servers: this.options.servers });
|
|
29
|
+
}
|
|
30
|
+
async stop() {
|
|
31
|
+
if (this.nats) {
|
|
32
|
+
await this.nats.close();
|
|
33
|
+
this.nats = undefined;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
awaitMessage(subjects, timeoutMs) {
|
|
37
|
+
const abortController = new AbortController();
|
|
38
|
+
const promise = new Promise((resolve) => {
|
|
39
|
+
const timer = setTimeout(() => {
|
|
40
|
+
for (const subscription of subscriptions) {
|
|
41
|
+
subscription.unsubscribe();
|
|
42
|
+
}
|
|
43
|
+
resolve();
|
|
44
|
+
}, timeoutMs);
|
|
45
|
+
const subscriptions = [];
|
|
46
|
+
for (const subject of subjects) {
|
|
47
|
+
subscriptions.push(this.getSubscription(subject, (_message) => {
|
|
48
|
+
for (const subscription of subscriptions) {
|
|
49
|
+
clearTimeout(timer);
|
|
50
|
+
subscription.unsubscribe();
|
|
51
|
+
}
|
|
52
|
+
resolve();
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
abortController.signal.addEventListener("abort", () => {
|
|
56
|
+
for (const subscription of subscriptions) {
|
|
57
|
+
subscription.unsubscribe();
|
|
58
|
+
clearTimeout(timer);
|
|
59
|
+
}
|
|
60
|
+
resolve();
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
return [promise, abortController];
|
|
64
|
+
}
|
|
65
|
+
getSubscription(subject, onMessage) {
|
|
66
|
+
if (!this.nats) {
|
|
67
|
+
throw new Error("NatsClient is not started");
|
|
68
|
+
}
|
|
69
|
+
const subscription = this.nats.subscribe(subject);
|
|
70
|
+
(async () => {
|
|
71
|
+
for await (const message of subscription) {
|
|
72
|
+
await onMessage(message, subscription);
|
|
73
|
+
}
|
|
74
|
+
})().catch(console.error);
|
|
75
|
+
return subscription;
|
|
76
|
+
}
|
|
77
|
+
getNotifier() {
|
|
78
|
+
return {
|
|
79
|
+
wait: async (dataSource, signal) => {
|
|
80
|
+
await this.start();
|
|
81
|
+
const topics = dataSource.eventTypes.map((eventType) => `stored.event.notify.0.${dataSource.dataCoreId}.${dataSource.flowType}.${eventType}`);
|
|
82
|
+
const [promise, abortController] = this.awaitMessage(topics, this.timeoutMs);
|
|
83
|
+
signal?.addEventListener("abort", () => abortController.abort());
|
|
84
|
+
await promise;
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Buffer } from "node:buffer";
|
|
2
|
+
import { types } from "cassandra-driver";
|
|
3
|
+
export declare class TimeUuid {
|
|
4
|
+
private readonly timeUuid;
|
|
5
|
+
constructor(timeUuid: types.TimeUuid);
|
|
6
|
+
static fromDate(date: Date, ticks?: number, nodeId?: string | Buffer, clockId?: string | Buffer): TimeUuid;
|
|
7
|
+
static fromString(value: string): TimeUuid;
|
|
8
|
+
private getDatePrecision;
|
|
9
|
+
getBefore(): TimeUuid;
|
|
10
|
+
static fromNow(): TimeUuid;
|
|
11
|
+
toString(): string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=time-uuid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time-uuid.d.ts","sourceRoot":"","sources":["../../src/lib/time-uuid.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAExC,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,KAAK,CAAC,QAAQ;WAEvC,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;WAIxF,UAAU,CAAC,KAAK,EAAE,MAAM;IAItC,OAAO,CAAC,gBAAgB;IAIjB,SAAS;WASF,OAAO;IAId,QAAQ,IAAI,MAAM;CAG1B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { subMilliseconds } from "date-fns";
|
|
2
|
+
import { utc } from "@date-fns/utc";
|
|
3
|
+
import { types } from "cassandra-driver";
|
|
4
|
+
export class TimeUuid {
|
|
5
|
+
constructor(timeUuid) {
|
|
6
|
+
Object.defineProperty(this, "timeUuid", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true,
|
|
10
|
+
value: timeUuid
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
static fromDate(date, ticks, nodeId, clockId) {
|
|
14
|
+
return new TimeUuid(types.TimeUuid.fromDate(utc(date), ticks, nodeId, clockId));
|
|
15
|
+
}
|
|
16
|
+
static fromString(value) {
|
|
17
|
+
return new TimeUuid(types.TimeUuid.fromString(value));
|
|
18
|
+
}
|
|
19
|
+
getDatePrecision() {
|
|
20
|
+
return this.timeUuid.getDatePrecision();
|
|
21
|
+
}
|
|
22
|
+
getBefore() {
|
|
23
|
+
const { date, ticks } = this.getDatePrecision();
|
|
24
|
+
const newTicks = ticks - 1;
|
|
25
|
+
if (newTicks < 0) {
|
|
26
|
+
return TimeUuid.fromDate(subMilliseconds(date, 1), 10_000);
|
|
27
|
+
}
|
|
28
|
+
return TimeUuid.fromDate(date, newTicks);
|
|
29
|
+
}
|
|
30
|
+
static fromNow() {
|
|
31
|
+
return TimeUuid.fromDate(new Date(), 10_000);
|
|
32
|
+
}
|
|
33
|
+
toString() {
|
|
34
|
+
return this.timeUuid.toString();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { DataPumpNotifier, Logger } from "./data-pump.js";
|
|
2
|
+
export declare class WebSocketNotifier {
|
|
3
|
+
private readonly authClient;
|
|
4
|
+
private subject?;
|
|
5
|
+
private notificationClient?;
|
|
6
|
+
private dataSource;
|
|
7
|
+
private eventResolver?;
|
|
8
|
+
private logger?;
|
|
9
|
+
private timeoutMs;
|
|
10
|
+
constructor(options: {
|
|
11
|
+
auth: {
|
|
12
|
+
clientId: string;
|
|
13
|
+
clientSecret: string;
|
|
14
|
+
authUrl: string;
|
|
15
|
+
};
|
|
16
|
+
dataSource: {
|
|
17
|
+
tenant: string;
|
|
18
|
+
dataCore: string;
|
|
19
|
+
flowType: string;
|
|
20
|
+
eventTypes: string[];
|
|
21
|
+
};
|
|
22
|
+
logger?: Logger;
|
|
23
|
+
timeoutMs?: number;
|
|
24
|
+
});
|
|
25
|
+
private onEvent;
|
|
26
|
+
getNotifier(): DataPumpNotifier;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=ws-notifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws-notifier.d.ts","sourceRoot":"","sources":["../../src/lib/ws-notifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAK9D,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAuB;IAClD,OAAO,CAAC,OAAO,CAAC,CAA4B;IAC5C,OAAO,CAAC,kBAAkB,CAAC,CAAoB;IAC/C,OAAO,CAAC,UAAU,CAKjB;IACD,OAAO,CAAC,aAAa,CAAC,CAAY;IAClC,OAAO,CAAC,MAAM,CAAC,CAAQ;IACvB,OAAO,CAAC,SAAS,CAAQ;gBAEb,OAAO,EAAE;QACnB,IAAI,EAAE;YACJ,QAAQ,EAAE,MAAM,CAAA;YAChB,YAAY,EAAE,MAAM,CAAA;YACpB,OAAO,EAAE,MAAM,CAAA;SAChB,CAAA;QACD,UAAU,EAAE;YACV,MAAM,EAAE,MAAM,CAAA;YACd,QAAQ,EAAE,MAAM,CAAA;YAChB,QAAQ,EAAE,MAAM,CAAA;YAChB,UAAU,EAAE,MAAM,EAAE,CAAA;SACrB,CAAA;QACD,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB;IAWD,OAAO,CAAC,OAAO;IAMR,WAAW,IAAI,gBAAgB;CAkCvC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Subject } from "rxjs";
|
|
2
|
+
import { NotificationClient } from "../deps/jsr.io/@flowcore/sdk/1.11.4/src/mod.js";
|
|
3
|
+
import OidcClient from "@flowcore/sdk-oidc-client";
|
|
4
|
+
export class WebSocketNotifier {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
Object.defineProperty(this, "authClient", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true,
|
|
10
|
+
value: void 0
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(this, "subject", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: void 0
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(this, "notificationClient", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: void 0
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(this, "dataSource", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
value: void 0
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(this, "eventResolver", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true,
|
|
33
|
+
writable: true,
|
|
34
|
+
value: void 0
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(this, "logger", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
writable: true,
|
|
40
|
+
value: void 0
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(this, "timeoutMs", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true,
|
|
45
|
+
writable: true,
|
|
46
|
+
value: void 0
|
|
47
|
+
});
|
|
48
|
+
this.authClient = new OidcClient.OidcClient(options.auth.clientId, options.auth.clientSecret, options.auth.authUrl);
|
|
49
|
+
this.dataSource = options.dataSource;
|
|
50
|
+
this.logger = options.logger;
|
|
51
|
+
this.timeoutMs = options.timeoutMs ?? 20_000;
|
|
52
|
+
}
|
|
53
|
+
onEvent(event) {
|
|
54
|
+
if (this.dataSource.eventTypes.includes(event.data.eventType)) {
|
|
55
|
+
this.eventResolver?.();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
getNotifier() {
|
|
59
|
+
return {
|
|
60
|
+
wait: async (_, signal) => {
|
|
61
|
+
this.subject = new Subject();
|
|
62
|
+
this.subject.subscribe({
|
|
63
|
+
next: this.onEvent.bind(this),
|
|
64
|
+
error: (error) => this.logger?.error("Notification stream error:", error),
|
|
65
|
+
complete: () => this.logger?.info("Notification stream completed"),
|
|
66
|
+
});
|
|
67
|
+
this.notificationClient = new NotificationClient(this.subject, this.authClient, {
|
|
68
|
+
tenant: this.dataSource.tenant,
|
|
69
|
+
dataCore: this.dataSource.dataCore,
|
|
70
|
+
flowType: this.dataSource.flowType,
|
|
71
|
+
}, {
|
|
72
|
+
logger: this.logger,
|
|
73
|
+
reconnectInterval: 1000,
|
|
74
|
+
});
|
|
75
|
+
await this.notificationClient.connect();
|
|
76
|
+
const promise = new Promise((resolve) => {
|
|
77
|
+
this.eventResolver = resolve;
|
|
78
|
+
});
|
|
79
|
+
setTimeout(() => this.eventResolver?.(), this.timeoutMs);
|
|
80
|
+
signal?.addEventListener("abort", () => this.eventResolver?.());
|
|
81
|
+
await promise;
|
|
82
|
+
this.eventResolver = undefined;
|
|
83
|
+
this.notificationClient.disconnect();
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
package/esm/mod.d.ts
ADDED
package/esm/mod.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,2BAA2B,CAAA"}
|
package/esm/mod.js
ADDED
package/esm/package.json
ADDED