@hotmeshio/hotmesh 0.0.8 → 0.0.10
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/LICENSE +4 -7
- package/README.md +82 -85
- package/build/{cjs/modules → modules}/key.d.ts +2 -2
- package/build/{cjs/modules → modules}/key.js +3 -3
- package/build/{esm/package.json → package.json} +4 -11
- package/build/{cjs/services → services}/durable/native.js +2 -3
- package/build/{esm/services → services}/durable/worker.d.ts +1 -3
- package/build/{cjs/services → services}/durable/worker.js +9 -33
- package/build/{cjs/services → services}/durable/workflow.js +6 -1
- package/build/{cjs/services → services}/hotmesh/index.js +1 -1
- package/build/{cjs/services → services}/store/index.js +2 -2
- package/build/{cjs/services → services}/stream/clients/ioredis.js +1 -1
- package/build/{cjs/services → services}/stream/clients/redis.js +1 -1
- package/build/{cjs/services → services}/sub/clients/ioredis.js +1 -1
- package/build/{cjs/services → services}/sub/clients/redis.js +1 -1
- package/build/{cjs/types → types}/durable.d.ts +5 -7
- package/modules/key.ts +2 -2
- package/package.json +4 -11
- package/services/durable/native.ts +2 -3
- package/services/durable/worker.ts +9 -10
- package/services/durable/workflow.ts +7 -1
- package/services/hotmesh/index.ts +2 -2
- package/services/store/index.ts +3 -3
- package/services/stream/clients/ioredis.ts +2 -2
- package/services/stream/clients/redis.ts +2 -2
- package/services/sub/clients/ioredis.ts +2 -2
- package/services/sub/clients/redis.ts +2 -2
- package/types/durable.ts +5 -5
- package/build/cjs/package.json +0 -82
- package/build/cjs/services/durable/worker.d.ts +0 -38
- package/build/esm/index.d.ts +0 -4
- package/build/esm/index.js +0 -3
- package/build/esm/modules/errors.d.ts +0 -28
- package/build/esm/modules/errors.js +0 -41
- package/build/esm/modules/key.d.ts +0 -75
- package/build/esm/modules/key.js +0 -111
- package/build/esm/modules/utils.d.ts +0 -34
- package/build/esm/modules/utils.js +0 -154
- package/build/esm/services/activities/activity.d.ts +0 -67
- package/build/esm/services/activities/activity.js +0 -486
- package/build/esm/services/activities/await.d.ts +0 -16
- package/build/esm/services/activities/await.js +0 -140
- package/build/esm/services/activities/cycle.d.ts +0 -19
- package/build/esm/services/activities/cycle.js +0 -74
- package/build/esm/services/activities/emit.d.ts +0 -9
- package/build/esm/services/activities/emit.js +0 -10
- package/build/esm/services/activities/index.d.ts +0 -17
- package/build/esm/services/activities/index.js +0 -16
- package/build/esm/services/activities/iterate.d.ts +0 -9
- package/build/esm/services/activities/iterate.js +0 -10
- package/build/esm/services/activities/trigger.d.ts +0 -22
- package/build/esm/services/activities/trigger.js +0 -158
- package/build/esm/services/activities/worker.d.ts +0 -11
- package/build/esm/services/activities/worker.js +0 -70
- package/build/esm/services/collator/index.d.ts +0 -73
- package/build/esm/services/collator/index.js +0 -221
- package/build/esm/services/compiler/deployer.d.ts +0 -36
- package/build/esm/services/compiler/deployer.js +0 -423
- package/build/esm/services/compiler/index.d.ts +0 -30
- package/build/esm/services/compiler/index.js +0 -82
- package/build/esm/services/compiler/validator.d.ts +0 -32
- package/build/esm/services/compiler/validator.js +0 -131
- package/build/esm/services/connector/clients/ioredis.d.ts +0 -13
- package/build/esm/services/connector/clients/ioredis.js +0 -47
- package/build/esm/services/connector/clients/redis.d.ts +0 -13
- package/build/esm/services/connector/clients/redis.js +0 -59
- package/build/esm/services/connector/index.d.ts +0 -5
- package/build/esm/services/connector/index.js +0 -27
- package/build/esm/services/dimension/index.d.ts +0 -29
- package/build/esm/services/dimension/index.js +0 -32
- package/build/esm/services/durable/asyncLocalStorage.d.ts +0 -3
- package/build/esm/services/durable/asyncLocalStorage.js +0 -2
- package/build/esm/services/durable/client.d.ts +0 -15
- package/build/esm/services/durable/client.js +0 -114
- package/build/esm/services/durable/connection.d.ts +0 -4
- package/build/esm/services/durable/connection.js +0 -47
- package/build/esm/services/durable/factory.d.ts +0 -3
- package/build/esm/services/durable/factory.js +0 -135
- package/build/esm/services/durable/handle.d.ts +0 -8
- package/build/esm/services/durable/handle.js +0 -34
- package/build/esm/services/durable/index.d.ts +0 -57
- package/build/esm/services/durable/index.js +0 -55
- package/build/esm/services/durable/native.d.ts +0 -4
- package/build/esm/services/durable/native.js +0 -43
- package/build/esm/services/durable/worker.js +0 -267
- package/build/esm/services/durable/workflow.d.ts +0 -6
- package/build/esm/services/durable/workflow.js +0 -132
- package/build/esm/services/engine/index.d.ts +0 -82
- package/build/esm/services/engine/index.js +0 -522
- package/build/esm/services/hotmesh/index.d.ts +0 -45
- package/build/esm/services/hotmesh/index.js +0 -131
- package/build/esm/services/logger/index.d.ts +0 -17
- package/build/esm/services/logger/index.js +0 -70
- package/build/esm/services/mapper/index.d.ts +0 -24
- package/build/esm/services/mapper/index.js +0 -72
- package/build/esm/services/pipe/functions/array.d.ts +0 -24
- package/build/esm/services/pipe/functions/array.js +0 -66
- package/build/esm/services/pipe/functions/bitwise.d.ts +0 -9
- package/build/esm/services/pipe/functions/bitwise.js +0 -21
- package/build/esm/services/pipe/functions/conditional.d.ts +0 -10
- package/build/esm/services/pipe/functions/conditional.js +0 -24
- package/build/esm/services/pipe/functions/date.d.ts +0 -57
- package/build/esm/services/pipe/functions/date.js +0 -164
- package/build/esm/services/pipe/functions/index.d.ts +0 -25
- package/build/esm/services/pipe/functions/index.js +0 -24
- package/build/esm/services/pipe/functions/json.d.ts +0 -5
- package/build/esm/services/pipe/functions/json.js +0 -9
- package/build/esm/services/pipe/functions/math.d.ts +0 -38
- package/build/esm/services/pipe/functions/math.js +0 -108
- package/build/esm/services/pipe/functions/number.d.ts +0 -25
- package/build/esm/services/pipe/functions/number.js +0 -130
- package/build/esm/services/pipe/functions/object.d.ts +0 -22
- package/build/esm/services/pipe/functions/object.js +0 -60
- package/build/esm/services/pipe/functions/string.d.ts +0 -23
- package/build/esm/services/pipe/functions/string.js +0 -66
- package/build/esm/services/pipe/functions/symbol.d.ts +0 -12
- package/build/esm/services/pipe/functions/symbol.js +0 -30
- package/build/esm/services/pipe/functions/unary.d.ts +0 -7
- package/build/esm/services/pipe/functions/unary.js +0 -15
- package/build/esm/services/pipe/index.d.ts +0 -30
- package/build/esm/services/pipe/index.js +0 -122
- package/build/esm/services/quorum/index.d.ts +0 -34
- package/build/esm/services/quorum/index.js +0 -144
- package/build/esm/services/reporter/index.d.ts +0 -47
- package/build/esm/services/reporter/index.js +0 -327
- package/build/esm/services/serializer/index.d.ts +0 -41
- package/build/esm/services/serializer/index.js +0 -251
- package/build/esm/services/signaler/store.d.ts +0 -15
- package/build/esm/services/signaler/store.js +0 -50
- package/build/esm/services/signaler/stream.d.ts +0 -43
- package/build/esm/services/signaler/stream.js +0 -314
- package/build/esm/services/store/cache.d.ts +0 -66
- package/build/esm/services/store/cache.js +0 -124
- package/build/esm/services/store/clients/ioredis.d.ts +0 -27
- package/build/esm/services/store/clients/ioredis.js +0 -93
- package/build/esm/services/store/clients/redis.d.ts +0 -29
- package/build/esm/services/store/clients/redis.js +0 -140
- package/build/esm/services/store/index.d.ts +0 -88
- package/build/esm/services/store/index.js +0 -623
- package/build/esm/services/stream/clients/ioredis.d.ts +0 -23
- package/build/esm/services/stream/clients/ioredis.js +0 -112
- package/build/esm/services/stream/clients/redis.d.ts +0 -23
- package/build/esm/services/stream/clients/redis.js +0 -116
- package/build/esm/services/stream/index.d.ts +0 -21
- package/build/esm/services/stream/index.js +0 -6
- package/build/esm/services/sub/clients/ioredis.d.ts +0 -20
- package/build/esm/services/sub/clients/ioredis.js +0 -69
- package/build/esm/services/sub/clients/redis.d.ts +0 -20
- package/build/esm/services/sub/clients/redis.js +0 -60
- package/build/esm/services/sub/index.d.ts +0 -18
- package/build/esm/services/sub/index.js +0 -6
- package/build/esm/services/task/index.d.ts +0 -18
- package/build/esm/services/task/index.js +0 -70
- package/build/esm/services/telemetry/index.d.ts +0 -49
- package/build/esm/services/telemetry/index.js +0 -217
- package/build/esm/services/worker/index.d.ts +0 -30
- package/build/esm/services/worker/index.js +0 -102
- package/build/esm/types/activity.d.ts +0 -92
- package/build/esm/types/activity.js +0 -1
- package/build/esm/types/app.d.ts +0 -16
- package/build/esm/types/app.js +0 -1
- package/build/esm/types/async.d.ts +0 -5
- package/build/esm/types/async.js +0 -1
- package/build/esm/types/cache.d.ts +0 -1
- package/build/esm/types/cache.js +0 -1
- package/build/esm/types/collator.d.ts +0 -8
- package/build/esm/types/collator.js +0 -8
- package/build/esm/types/durable.d.ts +0 -59
- package/build/esm/types/durable.js +0 -1
- package/build/esm/types/hook.d.ts +0 -31
- package/build/esm/types/hook.js +0 -6
- package/build/esm/types/hotmesh.d.ts +0 -82
- package/build/esm/types/hotmesh.js +0 -1
- package/build/esm/types/index.d.ts +0 -20
- package/build/esm/types/index.js +0 -5
- package/build/esm/types/ioredisclient.d.ts +0 -5
- package/build/esm/types/ioredisclient.js +0 -2
- package/build/esm/types/job.d.ts +0 -50
- package/build/esm/types/job.js +0 -1
- package/build/esm/types/logger.d.ts +0 -6
- package/build/esm/types/logger.js +0 -1
- package/build/esm/types/map.d.ts +0 -4
- package/build/esm/types/map.js +0 -1
- package/build/esm/types/pipe.d.ts +0 -4
- package/build/esm/types/pipe.js +0 -1
- package/build/esm/types/quorum.d.ts +0 -46
- package/build/esm/types/quorum.js +0 -1
- package/build/esm/types/redis.d.ts +0 -8
- package/build/esm/types/redis.js +0 -1
- package/build/esm/types/redisclient.d.ts +0 -25
- package/build/esm/types/redisclient.js +0 -1
- package/build/esm/types/serializer.d.ts +0 -33
- package/build/esm/types/serializer.js +0 -1
- package/build/esm/types/stats.d.ts +0 -83
- package/build/esm/types/stats.js +0 -1
- package/build/esm/types/stream.d.ts +0 -67
- package/build/esm/types/stream.js +0 -22
- package/build/esm/types/telemetry.d.ts +0 -1
- package/build/esm/types/telemetry.js +0 -1
- package/build/esm/types/transition.d.ts +0 -17
- package/build/esm/types/transition.js +0 -1
- package/tsconfig.cjs.json +0 -8
- package/tsconfig.esm.json +0 -9
- /package/build/{cjs/index.d.ts → index.d.ts} +0 -0
- /package/build/{cjs/index.js → index.js} +0 -0
- /package/build/{cjs/modules → modules}/errors.d.ts +0 -0
- /package/build/{cjs/modules → modules}/errors.js +0 -0
- /package/build/{cjs/modules → modules}/utils.d.ts +0 -0
- /package/build/{cjs/modules → modules}/utils.js +0 -0
- /package/build/{cjs/services → services}/activities/activity.d.ts +0 -0
- /package/build/{cjs/services → services}/activities/activity.js +0 -0
- /package/build/{cjs/services → services}/activities/await.d.ts +0 -0
- /package/build/{cjs/services → services}/activities/await.js +0 -0
- /package/build/{cjs/services → services}/activities/cycle.d.ts +0 -0
- /package/build/{cjs/services → services}/activities/cycle.js +0 -0
- /package/build/{cjs/services → services}/activities/emit.d.ts +0 -0
- /package/build/{cjs/services → services}/activities/emit.js +0 -0
- /package/build/{cjs/services → services}/activities/index.d.ts +0 -0
- /package/build/{cjs/services → services}/activities/index.js +0 -0
- /package/build/{cjs/services → services}/activities/iterate.d.ts +0 -0
- /package/build/{cjs/services → services}/activities/iterate.js +0 -0
- /package/build/{cjs/services → services}/activities/trigger.d.ts +0 -0
- /package/build/{cjs/services → services}/activities/trigger.js +0 -0
- /package/build/{cjs/services → services}/activities/worker.d.ts +0 -0
- /package/build/{cjs/services → services}/activities/worker.js +0 -0
- /package/build/{cjs/services → services}/collator/index.d.ts +0 -0
- /package/build/{cjs/services → services}/collator/index.js +0 -0
- /package/build/{cjs/services → services}/compiler/deployer.d.ts +0 -0
- /package/build/{cjs/services → services}/compiler/deployer.js +0 -0
- /package/build/{cjs/services → services}/compiler/index.d.ts +0 -0
- /package/build/{cjs/services → services}/compiler/index.js +0 -0
- /package/build/{cjs/services → services}/compiler/validator.d.ts +0 -0
- /package/build/{cjs/services → services}/compiler/validator.js +0 -0
- /package/build/{cjs/services → services}/connector/clients/ioredis.d.ts +0 -0
- /package/build/{cjs/services → services}/connector/clients/ioredis.js +0 -0
- /package/build/{cjs/services → services}/connector/clients/redis.d.ts +0 -0
- /package/build/{cjs/services → services}/connector/clients/redis.js +0 -0
- /package/build/{cjs/services → services}/connector/index.d.ts +0 -0
- /package/build/{cjs/services → services}/connector/index.js +0 -0
- /package/build/{cjs/services → services}/dimension/index.d.ts +0 -0
- /package/build/{cjs/services → services}/dimension/index.js +0 -0
- /package/build/{cjs/services → services}/durable/asyncLocalStorage.d.ts +0 -0
- /package/build/{cjs/services → services}/durable/asyncLocalStorage.js +0 -0
- /package/build/{cjs/services → services}/durable/client.d.ts +0 -0
- /package/build/{cjs/services → services}/durable/client.js +0 -0
- /package/build/{cjs/services → services}/durable/connection.d.ts +0 -0
- /package/build/{cjs/services → services}/durable/connection.js +0 -0
- /package/build/{cjs/services → services}/durable/factory.d.ts +0 -0
- /package/build/{cjs/services → services}/durable/factory.js +0 -0
- /package/build/{cjs/services → services}/durable/handle.d.ts +0 -0
- /package/build/{cjs/services → services}/durable/handle.js +0 -0
- /package/build/{cjs/services → services}/durable/index.d.ts +0 -0
- /package/build/{cjs/services → services}/durable/index.js +0 -0
- /package/build/{cjs/services → services}/durable/native.d.ts +0 -0
- /package/build/{cjs/services → services}/durable/workflow.d.ts +0 -0
- /package/build/{cjs/services → services}/engine/index.d.ts +0 -0
- /package/build/{cjs/services → services}/engine/index.js +0 -0
- /package/build/{cjs/services → services}/hotmesh/index.d.ts +0 -0
- /package/build/{cjs/services → services}/logger/index.d.ts +0 -0
- /package/build/{cjs/services → services}/logger/index.js +0 -0
- /package/build/{cjs/services → services}/mapper/index.d.ts +0 -0
- /package/build/{cjs/services → services}/mapper/index.js +0 -0
- /package/build/{cjs/services → services}/pipe/functions/array.d.ts +0 -0
- /package/build/{cjs/services → services}/pipe/functions/array.js +0 -0
- /package/build/{cjs/services → services}/pipe/functions/bitwise.d.ts +0 -0
- /package/build/{cjs/services → services}/pipe/functions/bitwise.js +0 -0
- /package/build/{cjs/services → services}/pipe/functions/conditional.d.ts +0 -0
- /package/build/{cjs/services → services}/pipe/functions/conditional.js +0 -0
- /package/build/{cjs/services → services}/pipe/functions/date.d.ts +0 -0
- /package/build/{cjs/services → services}/pipe/functions/date.js +0 -0
- /package/build/{cjs/services → services}/pipe/functions/index.d.ts +0 -0
- /package/build/{cjs/services → services}/pipe/functions/index.js +0 -0
- /package/build/{cjs/services → services}/pipe/functions/json.d.ts +0 -0
- /package/build/{cjs/services → services}/pipe/functions/json.js +0 -0
- /package/build/{cjs/services → services}/pipe/functions/math.d.ts +0 -0
- /package/build/{cjs/services → services}/pipe/functions/math.js +0 -0
- /package/build/{cjs/services → services}/pipe/functions/number.d.ts +0 -0
- /package/build/{cjs/services → services}/pipe/functions/number.js +0 -0
- /package/build/{cjs/services → services}/pipe/functions/object.d.ts +0 -0
- /package/build/{cjs/services → services}/pipe/functions/object.js +0 -0
- /package/build/{cjs/services → services}/pipe/functions/string.d.ts +0 -0
- /package/build/{cjs/services → services}/pipe/functions/string.js +0 -0
- /package/build/{cjs/services → services}/pipe/functions/symbol.d.ts +0 -0
- /package/build/{cjs/services → services}/pipe/functions/symbol.js +0 -0
- /package/build/{cjs/services → services}/pipe/functions/unary.d.ts +0 -0
- /package/build/{cjs/services → services}/pipe/functions/unary.js +0 -0
- /package/build/{cjs/services → services}/pipe/index.d.ts +0 -0
- /package/build/{cjs/services → services}/pipe/index.js +0 -0
- /package/build/{cjs/services → services}/quorum/index.d.ts +0 -0
- /package/build/{cjs/services → services}/quorum/index.js +0 -0
- /package/build/{cjs/services → services}/reporter/index.d.ts +0 -0
- /package/build/{cjs/services → services}/reporter/index.js +0 -0
- /package/build/{cjs/services → services}/serializer/index.d.ts +0 -0
- /package/build/{cjs/services → services}/serializer/index.js +0 -0
- /package/build/{cjs/services → services}/signaler/store.d.ts +0 -0
- /package/build/{cjs/services → services}/signaler/store.js +0 -0
- /package/build/{cjs/services → services}/signaler/stream.d.ts +0 -0
- /package/build/{cjs/services → services}/signaler/stream.js +0 -0
- /package/build/{cjs/services → services}/store/cache.d.ts +0 -0
- /package/build/{cjs/services → services}/store/cache.js +0 -0
- /package/build/{cjs/services → services}/store/clients/ioredis.d.ts +0 -0
- /package/build/{cjs/services → services}/store/clients/ioredis.js +0 -0
- /package/build/{cjs/services → services}/store/clients/redis.d.ts +0 -0
- /package/build/{cjs/services → services}/store/clients/redis.js +0 -0
- /package/build/{cjs/services → services}/store/index.d.ts +0 -0
- /package/build/{cjs/services → services}/stream/clients/ioredis.d.ts +0 -0
- /package/build/{cjs/services → services}/stream/clients/redis.d.ts +0 -0
- /package/build/{cjs/services → services}/stream/index.d.ts +0 -0
- /package/build/{cjs/services → services}/stream/index.js +0 -0
- /package/build/{cjs/services → services}/sub/clients/ioredis.d.ts +0 -0
- /package/build/{cjs/services → services}/sub/clients/redis.d.ts +0 -0
- /package/build/{cjs/services → services}/sub/index.d.ts +0 -0
- /package/build/{cjs/services → services}/sub/index.js +0 -0
- /package/build/{cjs/services → services}/task/index.d.ts +0 -0
- /package/build/{cjs/services → services}/task/index.js +0 -0
- /package/build/{cjs/services → services}/telemetry/index.d.ts +0 -0
- /package/build/{cjs/services → services}/telemetry/index.js +0 -0
- /package/build/{cjs/services → services}/worker/index.d.ts +0 -0
- /package/build/{cjs/services → services}/worker/index.js +0 -0
- /package/build/{cjs/types → types}/activity.d.ts +0 -0
- /package/build/{cjs/types → types}/activity.js +0 -0
- /package/build/{cjs/types → types}/app.d.ts +0 -0
- /package/build/{cjs/types → types}/app.js +0 -0
- /package/build/{cjs/types → types}/async.d.ts +0 -0
- /package/build/{cjs/types → types}/async.js +0 -0
- /package/build/{cjs/types → types}/cache.d.ts +0 -0
- /package/build/{cjs/types → types}/cache.js +0 -0
- /package/build/{cjs/types → types}/collator.d.ts +0 -0
- /package/build/{cjs/types → types}/collator.js +0 -0
- /package/build/{cjs/types → types}/durable.js +0 -0
- /package/build/{cjs/types → types}/hook.d.ts +0 -0
- /package/build/{cjs/types → types}/hook.js +0 -0
- /package/build/{cjs/types → types}/hotmesh.d.ts +0 -0
- /package/build/{cjs/types → types}/hotmesh.js +0 -0
- /package/build/{cjs/types → types}/index.d.ts +0 -0
- /package/build/{cjs/types → types}/index.js +0 -0
- /package/build/{cjs/types → types}/ioredisclient.d.ts +0 -0
- /package/build/{cjs/types → types}/ioredisclient.js +0 -0
- /package/build/{cjs/types → types}/job.d.ts +0 -0
- /package/build/{cjs/types → types}/job.js +0 -0
- /package/build/{cjs/types → types}/logger.d.ts +0 -0
- /package/build/{cjs/types → types}/logger.js +0 -0
- /package/build/{cjs/types → types}/map.d.ts +0 -0
- /package/build/{cjs/types → types}/map.js +0 -0
- /package/build/{cjs/types → types}/pipe.d.ts +0 -0
- /package/build/{cjs/types → types}/pipe.js +0 -0
- /package/build/{cjs/types → types}/quorum.d.ts +0 -0
- /package/build/{cjs/types → types}/quorum.js +0 -0
- /package/build/{cjs/types → types}/redis.d.ts +0 -0
- /package/build/{cjs/types → types}/redis.js +0 -0
- /package/build/{cjs/types → types}/redisclient.d.ts +0 -0
- /package/build/{cjs/types → types}/redisclient.js +0 -0
- /package/build/{cjs/types → types}/serializer.d.ts +0 -0
- /package/build/{cjs/types → types}/serializer.js +0 -0
- /package/build/{cjs/types → types}/stats.d.ts +0 -0
- /package/build/{cjs/types → types}/stats.js +0 -0
- /package/build/{cjs/types → types}/stream.d.ts +0 -0
- /package/build/{cjs/types → types}/stream.js +0 -0
- /package/build/{cjs/types → types}/telemetry.d.ts +0 -0
- /package/build/{cjs/types → types}/telemetry.js +0 -0
- /package/build/{cjs/types → types}/transition.d.ts +0 -0
- /package/build/{cjs/types → types}/transition.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
-
import {
|
|
2
|
+
import { HMNS } from '../../modules/key';
|
|
3
3
|
import { EngineService } from '../engine';
|
|
4
4
|
import { LoggerService, ILogger } from '../logger';
|
|
5
5
|
import { StreamSignaler } from '../signaler/stream';
|
|
@@ -33,7 +33,7 @@ class HotMeshService {
|
|
|
33
33
|
|
|
34
34
|
verifyAndSetNamespace(namespace?: string) {
|
|
35
35
|
if (!namespace) {
|
|
36
|
-
this.namespace =
|
|
36
|
+
this.namespace = HMNS;
|
|
37
37
|
} else if (!namespace.match(/^[A-Za-z0-9-]+$/)) {
|
|
38
38
|
throw new Error(`config.namespace [${namespace}] is invalid`);
|
|
39
39
|
} else {
|
package/services/store/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
KeyService,
|
|
3
3
|
KeyStoreParams,
|
|
4
4
|
KeyType,
|
|
5
|
-
|
|
5
|
+
HMNS} from '../../modules/key';
|
|
6
6
|
import { ILogger } from '../logger';
|
|
7
7
|
import { MDATA_SYMBOLS, SerializerService as Serializer } from '../serializer';
|
|
8
8
|
import { Cache } from './cache';
|
|
@@ -119,7 +119,7 @@ abstract class StoreService<T, U extends AbstractRedisClient> {
|
|
|
119
119
|
this.redisClient = redisClient;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
async init(namespace =
|
|
122
|
+
async init(namespace = HMNS, appId: string, logger: ILogger): Promise<HotMeshApps> {
|
|
123
123
|
this.namespace = namespace;
|
|
124
124
|
this.appId = appId;
|
|
125
125
|
this.logger = logger;
|
|
@@ -178,7 +178,7 @@ abstract class StoreService<T, U extends AbstractRedisClient> {
|
|
|
178
178
|
if (bCreate) {
|
|
179
179
|
const packageJson = await import('../../package.json');
|
|
180
180
|
const version: string = packageJson['version'] || '0.0.0';
|
|
181
|
-
settings = { namespace:
|
|
181
|
+
settings = { namespace: HMNS, version } as HotMeshSettings;
|
|
182
182
|
await this.setSettings(settings);
|
|
183
183
|
return settings;
|
|
184
184
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KeyService, KeyStoreParams, KeyType,
|
|
1
|
+
import { KeyService, KeyStoreParams, KeyType, HMNS } from '../../../modules/key';
|
|
2
2
|
import { ILogger } from '../../logger';
|
|
3
3
|
import { StreamService } from '../index';
|
|
4
4
|
import { RedisClientType, RedisMultiType } from '../../../types/ioredisclient';
|
|
@@ -14,7 +14,7 @@ class IORedisStreamService extends StreamService<RedisClientType, RedisMultiType
|
|
|
14
14
|
super(redisClient);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
async init(namespace =
|
|
17
|
+
async init(namespace = HMNS, appId: string, logger: ILogger): Promise<void> {
|
|
18
18
|
this.namespace = namespace;
|
|
19
19
|
this.logger = logger;
|
|
20
20
|
this.appId = appId;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KeyService, KeyStoreParams, KeyType,
|
|
1
|
+
import { KeyService, KeyStoreParams, KeyType, HMNS } from '../../../modules/key';
|
|
2
2
|
import { ILogger } from '../../logger';
|
|
3
3
|
import { StreamService } from '../index';
|
|
4
4
|
import { RedisClientType, RedisMultiType } from '../../../types/redisclient';
|
|
@@ -14,7 +14,7 @@ class RedisStreamService extends StreamService<RedisClientType, RedisMultiType>
|
|
|
14
14
|
super(redisClient);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
async init(namespace =
|
|
17
|
+
async init(namespace = HMNS, appId: string, logger: ILogger): Promise<void> {
|
|
18
18
|
this.namespace = namespace;
|
|
19
19
|
this.logger = logger;
|
|
20
20
|
this.appId = appId;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KeyService, KeyStoreParams, KeyType,
|
|
1
|
+
import { KeyService, KeyStoreParams, KeyType, HMNS } from '../../../modules/key';
|
|
2
2
|
import { ILogger } from '../../logger';
|
|
3
3
|
import { SubService } from '../index';
|
|
4
4
|
import { RedisClientType, RedisMultiType } from '../../../types/ioredisclient';
|
|
@@ -14,7 +14,7 @@ class IORedisSubService extends SubService<RedisClientType, RedisMultiType> {
|
|
|
14
14
|
super(redisClient);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
async init(namespace =
|
|
17
|
+
async init(namespace = HMNS, appId: string, engineId: string, logger: ILogger): Promise<void> {
|
|
18
18
|
this.namespace = namespace;
|
|
19
19
|
this.logger = logger;
|
|
20
20
|
this.appId = appId;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KeyService, KeyStoreParams, KeyType,
|
|
1
|
+
import { KeyService, KeyStoreParams, KeyType, HMNS } from '../../../modules/key';
|
|
2
2
|
import { ILogger } from '../../logger';
|
|
3
3
|
import { SubService } from '../index';
|
|
4
4
|
import { RedisClientType, RedisMultiType } from '../../../types/redisclient';
|
|
@@ -14,7 +14,7 @@ class RedisSubService extends SubService<RedisClientType, RedisMultiType> {
|
|
|
14
14
|
super(redisClient);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
async init(namespace =
|
|
17
|
+
async init(namespace = HMNS, appId: string, engineId: string, logger: ILogger): Promise<void> {
|
|
18
18
|
this.namespace = namespace;
|
|
19
19
|
this.logger = logger;
|
|
20
20
|
this.appId = appId;
|
package/types/durable.ts
CHANGED
|
@@ -39,10 +39,9 @@ type Registry = {
|
|
|
39
39
|
|
|
40
40
|
type WorkerConfig = {
|
|
41
41
|
connection: Connection;
|
|
42
|
-
namespace
|
|
42
|
+
namespace?: string; //`appid` in the YAML (e.g, 'default')
|
|
43
43
|
taskQueue: string; //`subscribes` in the YAML (e.g, 'hello-world')
|
|
44
|
-
|
|
45
|
-
activities: { [key: string]: Function }; //vanilla activity exports
|
|
44
|
+
workflow: Function //target function to run
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
type ContextType = {
|
|
@@ -56,8 +55,9 @@ type ProxyType<ACT> = {
|
|
|
56
55
|
};
|
|
57
56
|
|
|
58
57
|
type ActivityConfig = {
|
|
59
|
-
startToCloseTimeout
|
|
60
|
-
|
|
58
|
+
startToCloseTimeout?: string;
|
|
59
|
+
activities?: any;
|
|
60
|
+
retryPolicy?: {
|
|
61
61
|
initialInterval: string;
|
|
62
62
|
maximumAttempts: number;
|
|
63
63
|
backoffCoefficient: number;
|
package/build/cjs/package.json
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@hotmeshio/hotmesh",
|
|
3
|
-
"version": "0.0.8",
|
|
4
|
-
"description": "Durable Workflows",
|
|
5
|
-
"main": "build/cjs/index.js",
|
|
6
|
-
"module": "build/esm/index.js",
|
|
7
|
-
"types": "build/cjs/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
"import": "./build/esm/index.js",
|
|
10
|
-
"require": "./build/cjs/index.js"
|
|
11
|
-
},
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "https://github.com/hotmeshio/sdk-typescript.git"
|
|
15
|
-
},
|
|
16
|
-
"homepage": "https://github.com/hotmeshio/sdk-typescript#readme",
|
|
17
|
-
"publishConfig": {
|
|
18
|
-
"access": "public"
|
|
19
|
-
},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"clean": "rimraf ./build",
|
|
22
|
-
"build:cjs": "tsc --build tsconfig.cjs.json",
|
|
23
|
-
"build:esm": "tsc --build tsconfig.esm.json",
|
|
24
|
-
"build": "npm run build:cjs && npm run build:esm",
|
|
25
|
-
"clean-build": "npm run clean && npm run build",
|
|
26
|
-
"lint": "eslint . --ext .ts",
|
|
27
|
-
"lint:fix": "eslint . --fix --ext .ts",
|
|
28
|
-
"start": "ts-node src/index.ts",
|
|
29
|
-
"test": "NODE_ENV=test jest --detectOpenHandles --forceExit --verbose",
|
|
30
|
-
"test:hmsh": "NODE_ENV=test jest ./tests/functional/index.test.ts --detectOpenHandles --verbose",
|
|
31
|
-
"test:compile": "NODE_ENV=test jest ./tests/functional/compile/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
32
|
-
"test:cycle": "NODE_ENV=test jest ./tests/functional/cycle/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
33
|
-
"test:connect": "NODE_ENV=test jest ./tests/unit/services/connector/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
34
|
-
"test:connect:redis": "NODE_ENV=test jest ./tests/unit/services/connector/clients/redis.test.ts --detectOpenHandles --forceExit --verbose",
|
|
35
|
-
"test:connect:ioredis": "NODE_ENV=test jest ./tests/unit/services/connector/clients/ioredis.test.ts --detectOpenHandles --forceExit --verbose",
|
|
36
|
-
"test:parallel": "NODE_ENV=test jest ./tests/functional/parallel/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
37
|
-
"test:sequence": "NODE_ENV=test jest ./tests/functional/sequence/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
38
|
-
"test:quorum": "NODE_ENV=test jest ./tests/functional/quorum/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
39
|
-
"test:reclaim": "NODE_ENV=test jest ./tests/functional/reclaim/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
40
|
-
"test:redeploy": "NODE_ENV=test jest ./tests/functional/redeploy/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
41
|
-
"test:retry": "NODE_ENV=test jest ./tests/functional/retry/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
42
|
-
"test:status": "NODE_ENV=test jest ./tests/functional/status/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
43
|
-
"test:store:redis": "NODE_ENV=test jest ./tests/functional/store/clients/redis.test.ts --detectOpenHandles --forceExit --verbose",
|
|
44
|
-
"test:store:ioredis": "NODE_ENV=test jest ./tests/functional/store/clients/ioredis.test.ts --detectOpenHandles --forceExit --verbose",
|
|
45
|
-
"test:stream:redis": "NODE_ENV=test jest ./tests/functional/stream/clients/redis.test.ts --detectOpenHandles --forceExit --verbose",
|
|
46
|
-
"test:stream:ioredis": "NODE_ENV=test jest ./tests/functional/stream/clients/ioredis.test.ts --detectOpenHandles --forceExit --verbose",
|
|
47
|
-
"test:sub:redis": "NODE_ENV=test jest ./tests/functional/sub/clients/redis.test.ts --detectOpenHandles --forceExit --verbose",
|
|
48
|
-
"test:sub:ioredis": "NODE_ENV=test jest ./tests/functional/sub/clients/ioredis.test.ts --detectOpenHandles --forceExit --verbose",
|
|
49
|
-
"test:durable": "NODE_ENV=test jest ./tests/durable/*/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
50
|
-
"test:durable:hello": "NODE_ENV=test jest ./tests/durable/helloworld/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
51
|
-
"test:durable:goodbye": "NODE_ENV=test jest ./tests/durable/goodbye/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
52
|
-
"test:durable:retry": "NODE_ENV=test jest ./tests/durable/retry/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
53
|
-
"test:durable:loopactivity": "NODE_ENV=test jest ./tests/durable/loopactivity/index.test.ts --detectOpenHandles --forceExit --verbose",
|
|
54
|
-
"test:durable:nested": "NODE_ENV=test jest ./tests/durable/nested/index.test.ts --detectOpenHandles --forceExit --verbose"
|
|
55
|
-
},
|
|
56
|
-
"keywords": [],
|
|
57
|
-
"author": "luke.birdeau@gmail.com",
|
|
58
|
-
"license": "SEE LICENSE IN LICENSE",
|
|
59
|
-
"dependencies": {
|
|
60
|
-
"@apidevtools/json-schema-ref-parser": "^10.1.0",
|
|
61
|
-
"@opentelemetry/api": "^1.4.1",
|
|
62
|
-
"js-yaml": "^4.1.0",
|
|
63
|
-
"ms": "^2.1.3",
|
|
64
|
-
"uuid": "^9.0.1",
|
|
65
|
-
"winston": "^3.8.2"
|
|
66
|
-
},
|
|
67
|
-
"devDependencies": {
|
|
68
|
-
"@types/jest": "^29.5.0",
|
|
69
|
-
"@types/node": "^18.15.11",
|
|
70
|
-
"@typescript-eslint/eslint-plugin": "^5.56.0",
|
|
71
|
-
"@typescript-eslint/parser": "^5.56.0",
|
|
72
|
-
"eslint": "^8.36.0",
|
|
73
|
-
"ioredis": "^5.3.2",
|
|
74
|
-
"jest": "^29.5.0",
|
|
75
|
-
"redis": "^4.6.6",
|
|
76
|
-
"rimraf": "^4.4.1",
|
|
77
|
-
"ts-jest": "^29.0.5",
|
|
78
|
-
"ts-node": "^10.9.1",
|
|
79
|
-
"ts-node-dev": "^2.0.0",
|
|
80
|
-
"typescript": "^5.0.4"
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { HotMeshService as HotMesh } from '../hotmesh';
|
|
2
|
-
import { Connection, Registry, WorkerConfig } from "../../types/durable";
|
|
3
|
-
export declare class WorkerService {
|
|
4
|
-
static activityRegistry: Registry;
|
|
5
|
-
static connection: Connection;
|
|
6
|
-
static instances: Map<string, HotMesh | Promise<HotMesh>>;
|
|
7
|
-
workflowRunner: HotMesh;
|
|
8
|
-
activityRunner: HotMesh;
|
|
9
|
-
static getHotMesh: (worflowTopic: string) => Promise<HotMesh>;
|
|
10
|
-
static activateWorkflow(hotMesh: HotMesh, topic: string, factory: Function): Promise<void>;
|
|
11
|
-
/**
|
|
12
|
-
* The `worker` calls `registerActivities` immediately BEFORE
|
|
13
|
-
* dynamically importing the user's workflow module. That file
|
|
14
|
-
* contains a call, `proxyActivities`, which needs this info.
|
|
15
|
-
*
|
|
16
|
-
* NOTE: The `worker` and `client` both call `proxyActivities`,
|
|
17
|
-
* as a natural result of importing worflows.ts. However,
|
|
18
|
-
* because the worker imports the workflows dynamically AFTER
|
|
19
|
-
* the activities are loaded, there will be items in the registry,
|
|
20
|
-
* allowing proxyActivities to succeed.
|
|
21
|
-
*/
|
|
22
|
-
static registerActivities<ACT>(activities: ACT): Registry;
|
|
23
|
-
static create(config: WorkerConfig): Promise<WorkerService>;
|
|
24
|
-
static resolveWorkflowTarget(workflow: object | Function): [string, Function];
|
|
25
|
-
run(): Promise<void>;
|
|
26
|
-
initActivityWorkflow(config: WorkerConfig, activityTopic: string): Promise<HotMesh>;
|
|
27
|
-
wrapActivityFunctions(): Function;
|
|
28
|
-
activateActivityWorkflow(hotMesh: HotMesh, activityTopic: string): Promise<void>;
|
|
29
|
-
initWorkerWorkflow(config: WorkerConfig, workflowTopic: string, workflowFunction: Function): Promise<HotMesh>;
|
|
30
|
-
static Context: {
|
|
31
|
-
info: () => {
|
|
32
|
-
workflowId: string;
|
|
33
|
-
workflowTopic: string;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
wrapWorkflowFunction(workflowFunction: Function, workflowTopic: string): Function;
|
|
37
|
-
static shutdown(): Promise<void>;
|
|
38
|
-
}
|
package/build/esm/index.d.ts
DELETED
package/build/esm/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ActivityDuplex } from "../types/activity";
|
|
2
|
-
import { CollationFaultType, CollationStage } from "../types/collator";
|
|
3
|
-
declare class GetStateError extends Error {
|
|
4
|
-
constructor();
|
|
5
|
-
}
|
|
6
|
-
declare class SetStateError extends Error {
|
|
7
|
-
constructor();
|
|
8
|
-
}
|
|
9
|
-
declare class MapDataError extends Error {
|
|
10
|
-
constructor();
|
|
11
|
-
}
|
|
12
|
-
declare class RegisterTimeoutError extends Error {
|
|
13
|
-
constructor();
|
|
14
|
-
}
|
|
15
|
-
declare class DuplicateJobError extends Error {
|
|
16
|
-
constructor(jobId: string);
|
|
17
|
-
}
|
|
18
|
-
declare class ExecActivityError extends Error {
|
|
19
|
-
constructor();
|
|
20
|
-
}
|
|
21
|
-
declare class CollationError extends Error {
|
|
22
|
-
status: number;
|
|
23
|
-
leg: ActivityDuplex;
|
|
24
|
-
stage: CollationStage;
|
|
25
|
-
fault: CollationFaultType;
|
|
26
|
-
constructor(status: number, leg: ActivityDuplex, stage: CollationStage, fault?: CollationFaultType);
|
|
27
|
-
}
|
|
28
|
-
export { CollationError, DuplicateJobError, GetStateError, SetStateError, MapDataError, RegisterTimeoutError, ExecActivityError };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
class GetStateError extends Error {
|
|
2
|
-
constructor() {
|
|
3
|
-
super("Error occurred while getting job state");
|
|
4
|
-
}
|
|
5
|
-
}
|
|
6
|
-
class SetStateError extends Error {
|
|
7
|
-
constructor() {
|
|
8
|
-
super("Error occurred while setting job state");
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
class MapDataError extends Error {
|
|
12
|
-
constructor() {
|
|
13
|
-
super("Error occurred while mapping data");
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
class RegisterTimeoutError extends Error {
|
|
17
|
-
constructor() {
|
|
18
|
-
super("Error occurred while registering activity timeout");
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
class DuplicateJobError extends Error {
|
|
22
|
-
constructor(jobId) {
|
|
23
|
-
super("Duplicate job");
|
|
24
|
-
this.message = `Duplicate job: ${jobId}`;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
class ExecActivityError extends Error {
|
|
28
|
-
constructor() {
|
|
29
|
-
super("Error occurred while executing activity");
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
class CollationError extends Error {
|
|
33
|
-
constructor(status, leg, stage, fault) {
|
|
34
|
-
super("collation-error");
|
|
35
|
-
this.leg = leg;
|
|
36
|
-
this.status = status;
|
|
37
|
-
this.stage = stage;
|
|
38
|
-
this.fault = fault;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
export { CollationError, DuplicateJobError, GetStateError, SetStateError, MapDataError, RegisterTimeoutError, ExecActivityError };
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Keys
|
|
3
|
-
*
|
|
4
|
-
* hmsh -> {hash} hotmesh config {version: "0.0.1", namespace: "hmsh"}
|
|
5
|
-
* hmsh:a:<appid> -> {hash} app profile { "id": "appid", "version": "2", "versions/1": "GMT", "versions/2": "GMT"}
|
|
6
|
-
* hmsh:<appid>:e:<engineId> -> {string} setnx to ensure only one engine of given id
|
|
7
|
-
* hmsh:<appid>:w: -> {zset} work items/tasks an engine must do like garbage collect or hook a set of matching records (hookAll)
|
|
8
|
-
* hmsh:<appid>:t: -> {zset} an ordered set of list (work lists) ids
|
|
9
|
-
* hmsh:<appid>:t:<timeValue?> -> {list} a worklist of `jobId+activityId` items that should be awakened
|
|
10
|
-
* hmsh:<appid>:q: -> {hash} quorum-wide messages
|
|
11
|
-
* hmsh:<appid>:q:<ngnid> -> {hash} engine-targeted messages (targeted quorum-oriented message)
|
|
12
|
-
* hmsh:<appid>:j:<jobid> -> {hash} job data
|
|
13
|
-
* hmsh:<appid>:j:<jobid>:<activityid> -> {hash} job activity data (a1)
|
|
14
|
-
* hmsh:<appid>:s:<jobkey>:<dateTime> -> {hash} job stats (general)
|
|
15
|
-
* hmsh:<appid>:s:<jobkey>:<dateTime>:mdn:<field/path>:<fieldvalue> -> {zset} job stats (median)
|
|
16
|
-
* hmsh:<appid>:s:<jobkey>:<dateTime>:index:<field/path>:<fieldvalue> -> {list} job stats (index of jobid[])
|
|
17
|
-
* hmsh:<appid>:v:<version>:activities -> {hash} schemas [cache]
|
|
18
|
-
* hmsh:<appid>:v:<version>:transitions -> {hash} transitions [cache]
|
|
19
|
-
* hmsh:<appid>:v:<version>:subscriptions -> {hash} subscriptions [cache]
|
|
20
|
-
* hmsh:<appid>:x: -> {xstream} when an engine is sent or reads a buffered task (engines read from their custom topic)
|
|
21
|
-
* hmsh:<appid>:x:<topic> -> {xstream} when a worker is sent or reads a buffered task (workers read from their custom topic)
|
|
22
|
-
* hmsh:<appid>:hooks -> {hash} hook patterns/rules; set at compile time
|
|
23
|
-
* hmsh:<appid>:signals -> {hash} dynamic hook signals (hget/hdel) when resolving (always self-clean); added/removed at runtime
|
|
24
|
-
* hmsh:<appid>:sym:keys: -> {hash} list of symbol ranges and :cursor assigned at version deploy time for job keys
|
|
25
|
-
* hmsh:<appid>:sym:keys:<activityid|$subscribes> -> {hash} list of symbols based upon schema enums (initially) and adaptively optimized (later) during runtime; if '$subscribes' is used as the activityid, it is a top-level `job` symbol set (for job keys)
|
|
26
|
-
* hmsh:<appid>:sym:vals: -> {hash} list of symbols for job values across all app versions
|
|
27
|
-
*/
|
|
28
|
-
declare const PSNS = "hmsh";
|
|
29
|
-
declare enum KeyType {
|
|
30
|
-
APP = 0,
|
|
31
|
-
ENGINE_ID = 1,
|
|
32
|
-
HOOKS = 2,
|
|
33
|
-
JOB_STATE = 3,
|
|
34
|
-
JOB_STATS_GENERAL = 4,
|
|
35
|
-
JOB_STATS_MEDIAN = 5,
|
|
36
|
-
JOB_STATS_INDEX = 6,
|
|
37
|
-
HOTMESH = 7,
|
|
38
|
-
QUORUM = 8,
|
|
39
|
-
SCHEMAS = 9,
|
|
40
|
-
SIGNALS = 10,
|
|
41
|
-
STREAMS = 11,
|
|
42
|
-
SUBSCRIPTIONS = 12,
|
|
43
|
-
SUBSCRIPTION_PATTERNS = 13,
|
|
44
|
-
SYMKEYS = 14,
|
|
45
|
-
SYMVALS = 15,
|
|
46
|
-
TIME_RANGE = 16,
|
|
47
|
-
WORK_ITEMS = 17
|
|
48
|
-
}
|
|
49
|
-
type KeyStoreParams = {
|
|
50
|
-
appId?: string;
|
|
51
|
-
engineId?: string;
|
|
52
|
-
appVersion?: string;
|
|
53
|
-
jobId?: string;
|
|
54
|
-
activityId?: string;
|
|
55
|
-
jobKey?: string;
|
|
56
|
-
dateTime?: string;
|
|
57
|
-
facet?: string;
|
|
58
|
-
topic?: string;
|
|
59
|
-
timeValue?: number;
|
|
60
|
-
};
|
|
61
|
-
declare class KeyService {
|
|
62
|
-
/**
|
|
63
|
-
* returns a key that can be used to access a value in the key/value store
|
|
64
|
-
* appropriate for the given key type; the keys have an implicit hierarchy
|
|
65
|
-
* and are used to organize data in the store in a tree-like structure
|
|
66
|
-
* via the use of colons as separators. The top-level entity is the hmsh manifest.
|
|
67
|
-
* This file will reveal the full scope of what is on the server (apps, versions, etc)
|
|
68
|
-
* @param namespace
|
|
69
|
-
* @param keyType
|
|
70
|
-
* @param params
|
|
71
|
-
* @returns {string}
|
|
72
|
-
*/
|
|
73
|
-
static mintKey(namespace: string, keyType: KeyType, params: KeyStoreParams): string;
|
|
74
|
-
}
|
|
75
|
-
export { KeyService, KeyType, KeyStoreParams, PSNS };
|
package/build/esm/modules/key.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Keys
|
|
3
|
-
*
|
|
4
|
-
* hmsh -> {hash} hotmesh config {version: "0.0.1", namespace: "hmsh"}
|
|
5
|
-
* hmsh:a:<appid> -> {hash} app profile { "id": "appid", "version": "2", "versions/1": "GMT", "versions/2": "GMT"}
|
|
6
|
-
* hmsh:<appid>:e:<engineId> -> {string} setnx to ensure only one engine of given id
|
|
7
|
-
* hmsh:<appid>:w: -> {zset} work items/tasks an engine must do like garbage collect or hook a set of matching records (hookAll)
|
|
8
|
-
* hmsh:<appid>:t: -> {zset} an ordered set of list (work lists) ids
|
|
9
|
-
* hmsh:<appid>:t:<timeValue?> -> {list} a worklist of `jobId+activityId` items that should be awakened
|
|
10
|
-
* hmsh:<appid>:q: -> {hash} quorum-wide messages
|
|
11
|
-
* hmsh:<appid>:q:<ngnid> -> {hash} engine-targeted messages (targeted quorum-oriented message)
|
|
12
|
-
* hmsh:<appid>:j:<jobid> -> {hash} job data
|
|
13
|
-
* hmsh:<appid>:j:<jobid>:<activityid> -> {hash} job activity data (a1)
|
|
14
|
-
* hmsh:<appid>:s:<jobkey>:<dateTime> -> {hash} job stats (general)
|
|
15
|
-
* hmsh:<appid>:s:<jobkey>:<dateTime>:mdn:<field/path>:<fieldvalue> -> {zset} job stats (median)
|
|
16
|
-
* hmsh:<appid>:s:<jobkey>:<dateTime>:index:<field/path>:<fieldvalue> -> {list} job stats (index of jobid[])
|
|
17
|
-
* hmsh:<appid>:v:<version>:activities -> {hash} schemas [cache]
|
|
18
|
-
* hmsh:<appid>:v:<version>:transitions -> {hash} transitions [cache]
|
|
19
|
-
* hmsh:<appid>:v:<version>:subscriptions -> {hash} subscriptions [cache]
|
|
20
|
-
* hmsh:<appid>:x: -> {xstream} when an engine is sent or reads a buffered task (engines read from their custom topic)
|
|
21
|
-
* hmsh:<appid>:x:<topic> -> {xstream} when a worker is sent or reads a buffered task (workers read from their custom topic)
|
|
22
|
-
* hmsh:<appid>:hooks -> {hash} hook patterns/rules; set at compile time
|
|
23
|
-
* hmsh:<appid>:signals -> {hash} dynamic hook signals (hget/hdel) when resolving (always self-clean); added/removed at runtime
|
|
24
|
-
* hmsh:<appid>:sym:keys: -> {hash} list of symbol ranges and :cursor assigned at version deploy time for job keys
|
|
25
|
-
* hmsh:<appid>:sym:keys:<activityid|$subscribes> -> {hash} list of symbols based upon schema enums (initially) and adaptively optimized (later) during runtime; if '$subscribes' is used as the activityid, it is a top-level `job` symbol set (for job keys)
|
|
26
|
-
* hmsh:<appid>:sym:vals: -> {hash} list of symbols for job values across all app versions
|
|
27
|
-
*/
|
|
28
|
-
//default namespace for hotmesh
|
|
29
|
-
const PSNS = "hmsh";
|
|
30
|
-
//these are the entity types that are stored in the key/value store
|
|
31
|
-
var KeyType;
|
|
32
|
-
(function (KeyType) {
|
|
33
|
-
KeyType[KeyType["APP"] = 0] = "APP";
|
|
34
|
-
KeyType[KeyType["ENGINE_ID"] = 1] = "ENGINE_ID";
|
|
35
|
-
KeyType[KeyType["HOOKS"] = 2] = "HOOKS";
|
|
36
|
-
KeyType[KeyType["JOB_STATE"] = 3] = "JOB_STATE";
|
|
37
|
-
KeyType[KeyType["JOB_STATS_GENERAL"] = 4] = "JOB_STATS_GENERAL";
|
|
38
|
-
KeyType[KeyType["JOB_STATS_MEDIAN"] = 5] = "JOB_STATS_MEDIAN";
|
|
39
|
-
KeyType[KeyType["JOB_STATS_INDEX"] = 6] = "JOB_STATS_INDEX";
|
|
40
|
-
KeyType[KeyType["HOTMESH"] = 7] = "HOTMESH";
|
|
41
|
-
KeyType[KeyType["QUORUM"] = 8] = "QUORUM";
|
|
42
|
-
KeyType[KeyType["SCHEMAS"] = 9] = "SCHEMAS";
|
|
43
|
-
KeyType[KeyType["SIGNALS"] = 10] = "SIGNALS";
|
|
44
|
-
KeyType[KeyType["STREAMS"] = 11] = "STREAMS";
|
|
45
|
-
KeyType[KeyType["SUBSCRIPTIONS"] = 12] = "SUBSCRIPTIONS";
|
|
46
|
-
KeyType[KeyType["SUBSCRIPTION_PATTERNS"] = 13] = "SUBSCRIPTION_PATTERNS";
|
|
47
|
-
KeyType[KeyType["SYMKEYS"] = 14] = "SYMKEYS";
|
|
48
|
-
KeyType[KeyType["SYMVALS"] = 15] = "SYMVALS";
|
|
49
|
-
KeyType[KeyType["TIME_RANGE"] = 16] = "TIME_RANGE";
|
|
50
|
-
KeyType[KeyType["WORK_ITEMS"] = 17] = "WORK_ITEMS";
|
|
51
|
-
})(KeyType || (KeyType = {}));
|
|
52
|
-
class KeyService {
|
|
53
|
-
/**
|
|
54
|
-
* returns a key that can be used to access a value in the key/value store
|
|
55
|
-
* appropriate for the given key type; the keys have an implicit hierarchy
|
|
56
|
-
* and are used to organize data in the store in a tree-like structure
|
|
57
|
-
* via the use of colons as separators. The top-level entity is the hmsh manifest.
|
|
58
|
-
* This file will reveal the full scope of what is on the server (apps, versions, etc)
|
|
59
|
-
* @param namespace
|
|
60
|
-
* @param keyType
|
|
61
|
-
* @param params
|
|
62
|
-
* @returns {string}
|
|
63
|
-
*/
|
|
64
|
-
static mintKey(namespace, keyType, params) {
|
|
65
|
-
switch (keyType) {
|
|
66
|
-
case KeyType.HOTMESH:
|
|
67
|
-
return namespace;
|
|
68
|
-
case KeyType.ENGINE_ID:
|
|
69
|
-
return `${namespace}:${params.appId}:e:${params.engineId}`;
|
|
70
|
-
case KeyType.WORK_ITEMS:
|
|
71
|
-
return `${namespace}:${params.appId}:w:`;
|
|
72
|
-
case KeyType.TIME_RANGE:
|
|
73
|
-
return `${namespace}:${params.appId}:t:${params.timeValue || ''}`;
|
|
74
|
-
case KeyType.APP:
|
|
75
|
-
return `${namespace}:a:${params.appId || ''}`;
|
|
76
|
-
case KeyType.QUORUM:
|
|
77
|
-
return `${namespace}:${params.appId}:q:${params.engineId || ''}`;
|
|
78
|
-
case KeyType.JOB_STATE:
|
|
79
|
-
return `${namespace}:${params.appId}:j:${params.jobId}`;
|
|
80
|
-
case KeyType.JOB_STATS_GENERAL:
|
|
81
|
-
return `${namespace}:${params.appId}:s:${params.jobKey}:${params.dateTime}`;
|
|
82
|
-
case KeyType.JOB_STATS_MEDIAN:
|
|
83
|
-
return `${namespace}:${params.appId}:s:${params.jobKey}:${params.dateTime}:${params.facet}`;
|
|
84
|
-
case KeyType.JOB_STATS_INDEX:
|
|
85
|
-
return `${namespace}:${params.appId}:s:${params.jobKey}:${params.dateTime}:${params.facet}`;
|
|
86
|
-
case KeyType.SCHEMAS:
|
|
87
|
-
return `${namespace}:${params.appId}:v:${params.appVersion}:schemas`;
|
|
88
|
-
case KeyType.SUBSCRIPTIONS:
|
|
89
|
-
return `${namespace}:${params.appId}:v:${params.appVersion}:subscriptions`;
|
|
90
|
-
case KeyType.SUBSCRIPTION_PATTERNS:
|
|
91
|
-
return `${namespace}:${params.appId}:v:${params.appVersion}:transitions`;
|
|
92
|
-
case KeyType.HOOKS:
|
|
93
|
-
//`hooks` provide the pattern to resolve a value
|
|
94
|
-
return `${namespace}:${params.appId}:hooks`;
|
|
95
|
-
case KeyType.SIGNALS:
|
|
96
|
-
//`signals` provide the registry of resolved values that link back to paused jobs
|
|
97
|
-
return `${namespace}:${params.appId}:signals`;
|
|
98
|
-
case KeyType.SYMKEYS:
|
|
99
|
-
//`symbol keys` provide the registry of replacement values for job keys
|
|
100
|
-
return `${namespace}:${params.appId}:sym:keys:${params.activityId || ''}`;
|
|
101
|
-
case KeyType.SYMVALS:
|
|
102
|
-
//`symbol vals` provide the registry of replacement values for job vals
|
|
103
|
-
return `${namespace}:${params.appId}:sym:vals:`;
|
|
104
|
-
case KeyType.STREAMS:
|
|
105
|
-
return `${namespace}:${params.appId || ''}:x:${params.topic || ''}`;
|
|
106
|
-
default:
|
|
107
|
-
throw new Error("Invalid key type.");
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
export { KeyService, KeyType, PSNS };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { StoreService } from "../services/store";
|
|
3
|
-
import { AppSubscriptions, AppTransitions, AppVID } from "../types/app";
|
|
4
|
-
import { RedisClient, RedisMulti } from "../types/redis";
|
|
5
|
-
import { StringAnyType } from "../types/serializer";
|
|
6
|
-
import { StreamCode, StreamStatus } from "../types/stream";
|
|
7
|
-
export declare function sleepFor(ms: number): Promise<unknown>;
|
|
8
|
-
export declare function identifyRedisType(redisInstance: any): 'redis' | 'ioredis' | null;
|
|
9
|
-
export declare function identifyRedisTypeFromClass(redisClass: any): 'redis' | 'ioredis' | null;
|
|
10
|
-
export declare function matchesStatusCode(code: StreamCode, pattern: string | RegExp): boolean;
|
|
11
|
-
export declare function matchesStatus(status: StreamStatus, targetStatus: StreamStatus): boolean;
|
|
12
|
-
export declare function XSleepFor(ms: number): {
|
|
13
|
-
promise: Promise<unknown>;
|
|
14
|
-
timerId: NodeJS.Timeout;
|
|
15
|
-
};
|
|
16
|
-
export declare function findTopKey(obj: AppTransitions, input: string): string | null;
|
|
17
|
-
export declare function findSubscriptionForTrigger(obj: AppSubscriptions, value: string): string | null;
|
|
18
|
-
/**
|
|
19
|
-
* Get the subscription topic for the flow to which @activityId belongs.
|
|
20
|
-
* TODO: resolve this value in the compiler...do not call this at runtime
|
|
21
|
-
*/
|
|
22
|
-
export declare function getSubscriptionTopic(activityId: string, store: StoreService<RedisClient, RedisMulti>, appVID: AppVID): Promise<string | undefined>;
|
|
23
|
-
/**
|
|
24
|
-
* returns the 12-digit format of the iso timestamp (e.g, 202101010000)
|
|
25
|
-
*/
|
|
26
|
-
export declare function getTimeSeries(granularity: string): string;
|
|
27
|
-
export declare function formatISODate(input: Date | string): string;
|
|
28
|
-
export declare function getSymKey(number: number): string;
|
|
29
|
-
export declare function getSymVal(number: number): string;
|
|
30
|
-
export declare function getIndexedHash<T>(hash: T, target: string): [number, T];
|
|
31
|
-
export declare function getValueByPath(obj: {
|
|
32
|
-
[key: string]: any;
|
|
33
|
-
}, path: string): any;
|
|
34
|
-
export declare function restoreHierarchy(obj: StringAnyType): StringAnyType;
|