@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,30 +0,0 @@
|
|
|
1
|
-
import { ILogger } from '../logger';
|
|
2
|
-
import { StoreService } from '../store';
|
|
3
|
-
import { HotMeshManifest } from '../../types/hotmesh';
|
|
4
|
-
import { RedisClient, RedisMulti } from '../../types/redis';
|
|
5
|
-
/**
|
|
6
|
-
* The compiler service converts a graph into a executable program.
|
|
7
|
-
*/
|
|
8
|
-
declare class CompilerService {
|
|
9
|
-
store: StoreService<RedisClient, RedisMulti> | null;
|
|
10
|
-
logger: ILogger;
|
|
11
|
-
constructor(store: StoreService<RedisClient, RedisMulti>, logger: ILogger);
|
|
12
|
-
/**
|
|
13
|
-
* verifies and plans the deployment of an app to Redis; the app is not deployed yet
|
|
14
|
-
* @param path
|
|
15
|
-
*/
|
|
16
|
-
plan(mySchemaOrPath: string): Promise<HotMeshManifest>;
|
|
17
|
-
isPath(input: string): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* deploys an app to Redis but does NOT activate it.
|
|
20
|
-
*/
|
|
21
|
-
deploy(mySchemaOrPath: string): Promise<HotMeshManifest>;
|
|
22
|
-
/**
|
|
23
|
-
* activates a deployed version of an app;
|
|
24
|
-
* @param appId
|
|
25
|
-
* @param appVersion
|
|
26
|
-
*/
|
|
27
|
-
activate(appId: string, appVersion: string): Promise<boolean>;
|
|
28
|
-
saveAsJSON(originalPath: string, schema: HotMeshManifest): Promise<void>;
|
|
29
|
-
}
|
|
30
|
-
export { CompilerService };
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import $RefParser from '@apidevtools/json-schema-ref-parser';
|
|
2
|
-
import yaml from 'js-yaml';
|
|
3
|
-
import * as fs from 'fs/promises';
|
|
4
|
-
import * as path from 'path';
|
|
5
|
-
import { Deployer } from './deployer';
|
|
6
|
-
import { Validator } from './validator';
|
|
7
|
-
/**
|
|
8
|
-
* The compiler service converts a graph into a executable program.
|
|
9
|
-
*/
|
|
10
|
-
class CompilerService {
|
|
11
|
-
constructor(store, logger) {
|
|
12
|
-
this.store = store;
|
|
13
|
-
this.logger = logger;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* verifies and plans the deployment of an app to Redis; the app is not deployed yet
|
|
17
|
-
* @param path
|
|
18
|
-
*/
|
|
19
|
-
async plan(mySchemaOrPath) {
|
|
20
|
-
try {
|
|
21
|
-
let schema;
|
|
22
|
-
if (this.isPath(mySchemaOrPath)) {
|
|
23
|
-
schema = await $RefParser.dereference(mySchemaOrPath);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
schema = yaml.load(mySchemaOrPath);
|
|
27
|
-
}
|
|
28
|
-
// 1) validate the manifest file
|
|
29
|
-
const validator = new Validator(schema);
|
|
30
|
-
validator.validate(this.store);
|
|
31
|
-
// 2) todo: add a PlannerService module that will plan the deployment (what might break, drift, etc)
|
|
32
|
-
return schema;
|
|
33
|
-
}
|
|
34
|
-
catch (err) {
|
|
35
|
-
this.logger.error('compiler-plan-error', err);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
isPath(input) {
|
|
39
|
-
return !input.trim().startsWith('app:');
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* deploys an app to Redis but does NOT activate it.
|
|
43
|
-
*/
|
|
44
|
-
async deploy(mySchemaOrPath) {
|
|
45
|
-
try {
|
|
46
|
-
let schema;
|
|
47
|
-
if (this.isPath(mySchemaOrPath)) {
|
|
48
|
-
schema = await $RefParser.dereference(mySchemaOrPath);
|
|
49
|
-
await this.saveAsJSON(mySchemaOrPath, schema);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
schema = yaml.load(mySchemaOrPath);
|
|
53
|
-
}
|
|
54
|
-
// 2) validate the manifest file (synchronous operation...no callbacks)
|
|
55
|
-
const validator = new Validator(schema);
|
|
56
|
-
validator.validate(this.store);
|
|
57
|
-
// 3) deploy the schema (segment, optimize, etc; save to Redis)
|
|
58
|
-
const deployer = new Deployer(schema);
|
|
59
|
-
await deployer.deploy(this.store);
|
|
60
|
-
// 4) save the app version to Redis (so it can be activated later)
|
|
61
|
-
await this.store.setApp(schema.app.id, schema.app.version);
|
|
62
|
-
return schema;
|
|
63
|
-
}
|
|
64
|
-
catch (err) {
|
|
65
|
-
this.logger.error('compiler-deploy-error', err);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* activates a deployed version of an app;
|
|
70
|
-
* @param appId
|
|
71
|
-
* @param appVersion
|
|
72
|
-
*/
|
|
73
|
-
async activate(appId, appVersion) {
|
|
74
|
-
return await this.store.activateAppVersion(appId, appVersion);
|
|
75
|
-
}
|
|
76
|
-
async saveAsJSON(originalPath, schema) {
|
|
77
|
-
const json = JSON.stringify(schema, null, 2);
|
|
78
|
-
const newPath = path.join(path.dirname(originalPath), `.hotmesh.${schema.app.id}.${schema.app.version}.json`);
|
|
79
|
-
await fs.writeFile(newPath, json, 'utf8');
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
export { CompilerService };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { StoreService } from '../store';
|
|
2
|
-
import { MappingStatements } from "../../types/map";
|
|
3
|
-
import { HotMeshManifest } from "../../types/hotmesh";
|
|
4
|
-
import { RedisClient, RedisMulti } from "../../types/redis";
|
|
5
|
-
declare class Validator {
|
|
6
|
-
manifest: HotMeshManifest | null;
|
|
7
|
-
activityIds: string[];
|
|
8
|
-
mappingStatements: MappingStatements;
|
|
9
|
-
store: StoreService<RedisClient, RedisMulti> | null;
|
|
10
|
-
static SYS_VARS: string[];
|
|
11
|
-
constructor(manifest: HotMeshManifest);
|
|
12
|
-
/**
|
|
13
|
-
* validate the manifest file
|
|
14
|
-
*/
|
|
15
|
-
validate(store: StoreService<RedisClient, RedisMulti>): Promise<void>;
|
|
16
|
-
validateActivityIds(): void;
|
|
17
|
-
isMappingStatement(value: string): boolean;
|
|
18
|
-
extractMappingStatements(obj: any, result: MappingStatements, currentActivityId: string): void;
|
|
19
|
-
getMappingStatements(): void;
|
|
20
|
-
validateReferencedActivityIds(): void;
|
|
21
|
-
isFunction(value: string): boolean;
|
|
22
|
-
validateMappingStatements(): void;
|
|
23
|
-
validateTransitions(): void;
|
|
24
|
-
validateTransitionConditions(): void;
|
|
25
|
-
validateStats(): void;
|
|
26
|
-
validateSchemas(): void;
|
|
27
|
-
validateUniqueHandledTopics(): void;
|
|
28
|
-
validateGraphPublishSubscribe(): void;
|
|
29
|
-
validateHooks(): void;
|
|
30
|
-
validateConditionalStatements(): void;
|
|
31
|
-
}
|
|
32
|
-
export { Validator };
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { Pipe } from "../pipe";
|
|
2
|
-
class Validator {
|
|
3
|
-
constructor(manifest) {
|
|
4
|
-
this.manifest = null;
|
|
5
|
-
this.activityIds = [];
|
|
6
|
-
this.mappingStatements = {};
|
|
7
|
-
this.store = null;
|
|
8
|
-
this.manifest = manifest;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* validate the manifest file
|
|
12
|
-
*/
|
|
13
|
-
async validate(store) {
|
|
14
|
-
this.store = store;
|
|
15
|
-
this.getMappingStatements();
|
|
16
|
-
this.validateActivityIds();
|
|
17
|
-
this.validateReferencedActivityIds();
|
|
18
|
-
this.validateMappingStatements();
|
|
19
|
-
this.validateTransitions();
|
|
20
|
-
this.validateTransitionConditions();
|
|
21
|
-
this.validateStats();
|
|
22
|
-
this.validateSchemas();
|
|
23
|
-
this.validateUniqueHandledTopics();
|
|
24
|
-
this.validateGraphPublishSubscribe();
|
|
25
|
-
this.validateHooks();
|
|
26
|
-
this.validateConditionalStatements();
|
|
27
|
-
}
|
|
28
|
-
// 1.1) Validate the manifest file activity ids are unique (no duplicates)
|
|
29
|
-
validateActivityIds() {
|
|
30
|
-
const activityIdsSet = new Set();
|
|
31
|
-
this.manifest.app.graphs.forEach((graph) => {
|
|
32
|
-
const ids = Object.keys(graph.activities);
|
|
33
|
-
// Check for duplicates and add ids to the set
|
|
34
|
-
ids.forEach((id) => {
|
|
35
|
-
if (activityIdsSet.has(id)) {
|
|
36
|
-
throw new Error(`Duplicate activity id found: ${id}`);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
activityIdsSet.add(id);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
this.activityIds = Array.from(activityIdsSet);
|
|
44
|
-
}
|
|
45
|
-
isMappingStatement(value) {
|
|
46
|
-
return typeof value === 'string' && value.startsWith('{') && value.endsWith('}');
|
|
47
|
-
}
|
|
48
|
-
extractMappingStatements(obj, result, currentActivityId) {
|
|
49
|
-
for (const key in obj) {
|
|
50
|
-
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
|
51
|
-
this.extractMappingStatements(obj[key], result, currentActivityId);
|
|
52
|
-
}
|
|
53
|
-
else if (this.isMappingStatement(obj[key])) {
|
|
54
|
-
if (!result[currentActivityId]) {
|
|
55
|
-
result[currentActivityId] = [];
|
|
56
|
-
}
|
|
57
|
-
result[currentActivityId].push(obj[key]);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
getMappingStatements() {
|
|
62
|
-
const mappingStatements = {};
|
|
63
|
-
this.manifest.app.graphs.forEach((graph) => {
|
|
64
|
-
const activities = graph.activities;
|
|
65
|
-
for (const activityId in activities) {
|
|
66
|
-
const activity = activities[activityId];
|
|
67
|
-
this.extractMappingStatements(activity, mappingStatements, activityId);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
this.mappingStatements = mappingStatements;
|
|
71
|
-
}
|
|
72
|
-
// 1.2) Validate no activity ids are referenced that don't exist
|
|
73
|
-
validateReferencedActivityIds() {
|
|
74
|
-
// get list of all mapping statements and validate
|
|
75
|
-
const mappingStatements = this.mappingStatements;
|
|
76
|
-
const activityIds = this.activityIds;
|
|
77
|
-
for (const activity in mappingStatements) {
|
|
78
|
-
const statements = mappingStatements[activity];
|
|
79
|
-
statements.forEach((statement) => {
|
|
80
|
-
if (statement.startsWith('{') && statement.endsWith('}')) {
|
|
81
|
-
const statementParts = statement.slice(1, -1).split('.');
|
|
82
|
-
const referencedActivityId = statementParts[0];
|
|
83
|
-
if (!(Validator.SYS_VARS.includes(referencedActivityId) || activityIds.includes(referencedActivityId) || this.isFunction(statement))) {
|
|
84
|
-
throw new Error(`Mapping statement references non-existent activity: ${statement}`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
isFunction(value) {
|
|
91
|
-
return value.startsWith('{@') && Pipe.resolveFunction(value);
|
|
92
|
-
}
|
|
93
|
-
// 1.3) Validate the mapping/@pipe statements are valid
|
|
94
|
-
validateMappingStatements() {
|
|
95
|
-
// Implement the method content
|
|
96
|
-
}
|
|
97
|
-
// 1.4) Validate the transitions are valid
|
|
98
|
-
validateTransitions() {
|
|
99
|
-
// Implement the method content
|
|
100
|
-
}
|
|
101
|
-
// 1.5) Validate the transition conditions are valid
|
|
102
|
-
validateTransitionConditions() {
|
|
103
|
-
// Implement the method content
|
|
104
|
-
}
|
|
105
|
-
// 1.6) Validate the stats
|
|
106
|
-
validateStats() {
|
|
107
|
-
// Implement the method content
|
|
108
|
-
}
|
|
109
|
-
// 1.7) Validate the schemas
|
|
110
|
-
validateSchemas() {
|
|
111
|
-
// Implement the method content
|
|
112
|
-
}
|
|
113
|
-
// 1.8) Validate the topics are unique and handled
|
|
114
|
-
validateUniqueHandledTopics() {
|
|
115
|
-
// Implement the method content
|
|
116
|
-
}
|
|
117
|
-
// 1.9) Validate that every graph has publishes and subscribes
|
|
118
|
-
validateGraphPublishSubscribe() {
|
|
119
|
-
// Implement the method content
|
|
120
|
-
}
|
|
121
|
-
// 1.10) Validate hooks, including mapping statements
|
|
122
|
-
validateHooks() {
|
|
123
|
-
// Implement the method content
|
|
124
|
-
}
|
|
125
|
-
// 1.11) Validate conditional statements
|
|
126
|
-
validateConditionalStatements() {
|
|
127
|
-
// Implement the method content
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
Validator.SYS_VARS = ['$app', '$self', '$graph', '$job'];
|
|
131
|
-
export { Validator };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { RedisClientOptions, RedisClassType, RedisClientType } from '../../../types/ioredisclient';
|
|
2
|
-
declare class RedisConnection {
|
|
3
|
-
private connection;
|
|
4
|
-
private static instances;
|
|
5
|
-
private id;
|
|
6
|
-
private static clientOptions;
|
|
7
|
-
private createConnection;
|
|
8
|
-
getClient(): RedisClientType;
|
|
9
|
-
disconnect(): Promise<void>;
|
|
10
|
-
static connect(id: string, Redis: RedisClassType, options?: RedisClientOptions): Promise<RedisConnection>;
|
|
11
|
-
static disconnectAll(): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
export { RedisConnection };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
class RedisConnection {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.connection = null;
|
|
4
|
-
this.id = null;
|
|
5
|
-
}
|
|
6
|
-
async createConnection(Redis, options) {
|
|
7
|
-
return new Redis(options);
|
|
8
|
-
}
|
|
9
|
-
getClient() {
|
|
10
|
-
if (!this.connection) {
|
|
11
|
-
throw new Error('Redis client is not connected');
|
|
12
|
-
}
|
|
13
|
-
return this.connection;
|
|
14
|
-
}
|
|
15
|
-
async disconnect() {
|
|
16
|
-
if (this.connection) {
|
|
17
|
-
await this.connection.quit();
|
|
18
|
-
this.connection = null;
|
|
19
|
-
}
|
|
20
|
-
if (this.id) {
|
|
21
|
-
RedisConnection.instances.delete(this.id);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
static async connect(id, Redis, options) {
|
|
25
|
-
if (this.instances.has(id)) {
|
|
26
|
-
return this.instances.get(id);
|
|
27
|
-
}
|
|
28
|
-
const instance = new RedisConnection();
|
|
29
|
-
const opts = options ? { ...options } : { ...this.clientOptions };
|
|
30
|
-
instance.connection = await instance.createConnection(Redis, opts);
|
|
31
|
-
instance.id = id;
|
|
32
|
-
this.instances.set(id, instance);
|
|
33
|
-
return instance;
|
|
34
|
-
}
|
|
35
|
-
static async disconnectAll() {
|
|
36
|
-
await Promise.all(Array.from(this.instances.values()).map((instance) => instance.disconnect()));
|
|
37
|
-
this.instances.clear();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
RedisConnection.instances = new Map();
|
|
41
|
-
RedisConnection.clientOptions = {
|
|
42
|
-
host: 'localhost',
|
|
43
|
-
port: 6379,
|
|
44
|
-
//password: config.REDIS_PASSWORD,
|
|
45
|
-
//db: config.REDIS_DATABASE,
|
|
46
|
-
};
|
|
47
|
-
export { RedisConnection };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { RedisClientType, RedisClientOptions, RedisClassType } from '../../../types/redisclient';
|
|
2
|
-
declare class RedisConnection {
|
|
3
|
-
private connection;
|
|
4
|
-
private static instances;
|
|
5
|
-
private id;
|
|
6
|
-
private static clientOptions;
|
|
7
|
-
private createConnection;
|
|
8
|
-
getClient(): RedisClientType;
|
|
9
|
-
disconnect(): Promise<void>;
|
|
10
|
-
static connect(id: string, Redis: RedisClassType, options?: RedisClientOptions): Promise<RedisConnection>;
|
|
11
|
-
static disconnectAll(): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
export { RedisConnection, RedisClientType };
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
class RedisConnection {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.connection = null;
|
|
4
|
-
this.id = null;
|
|
5
|
-
}
|
|
6
|
-
async createConnection(Redis, options) {
|
|
7
|
-
return new Promise((resolve, reject) => {
|
|
8
|
-
const client = Redis.createClient(options);
|
|
9
|
-
client.on('error', (error) => {
|
|
10
|
-
reject(error);
|
|
11
|
-
});
|
|
12
|
-
client.on('ready', () => {
|
|
13
|
-
resolve(client);
|
|
14
|
-
});
|
|
15
|
-
client.connect();
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
getClient() {
|
|
19
|
-
if (!this.connection) {
|
|
20
|
-
throw new Error('Redis client is not connected');
|
|
21
|
-
}
|
|
22
|
-
return this.connection;
|
|
23
|
-
}
|
|
24
|
-
async disconnect() {
|
|
25
|
-
if (this.connection) {
|
|
26
|
-
await this.connection.quit();
|
|
27
|
-
this.connection = null;
|
|
28
|
-
}
|
|
29
|
-
if (this.id) {
|
|
30
|
-
RedisConnection.instances.delete(this.id);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
static async connect(id, Redis, options) {
|
|
34
|
-
if (this.instances.has(id)) {
|
|
35
|
-
return this.instances.get(id);
|
|
36
|
-
}
|
|
37
|
-
const instance = new RedisConnection();
|
|
38
|
-
const opts = options ? { ...options } : { ...this.clientOptions };
|
|
39
|
-
instance.connection = await instance.createConnection(Redis, opts);
|
|
40
|
-
instance.id = id;
|
|
41
|
-
this.instances.set(id, instance);
|
|
42
|
-
return instance;
|
|
43
|
-
}
|
|
44
|
-
static async disconnectAll() {
|
|
45
|
-
await Promise.all(Array.from(this.instances.values()).map((instance) => instance.disconnect()));
|
|
46
|
-
this.instances.clear();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
RedisConnection.instances = new Map();
|
|
50
|
-
RedisConnection.clientOptions = {
|
|
51
|
-
socket: {
|
|
52
|
-
host: 'localhost',
|
|
53
|
-
port: 6379,
|
|
54
|
-
tls: false,
|
|
55
|
-
},
|
|
56
|
-
//password: config.REDIS_PASSWORD,
|
|
57
|
-
//database: config.REDIS_DATABASE,
|
|
58
|
-
};
|
|
59
|
-
export { RedisConnection };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { HotMeshEngine, HotMeshWorker } from '../../types/hotmesh';
|
|
2
|
-
import { RedisClass, RedisOptions } from '../../types/redis';
|
|
3
|
-
export declare class ConnectorService {
|
|
4
|
-
static initRedisClients(Redis: RedisClass, options: RedisOptions, target: HotMeshEngine | HotMeshWorker): Promise<void>;
|
|
5
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
-
import { identifyRedisTypeFromClass } from '../../modules/utils';
|
|
3
|
-
import { RedisConnection as IORedisConnection } from '../connector/clients/ioredis';
|
|
4
|
-
import { RedisConnection } from '../connector/clients/redis';
|
|
5
|
-
export class ConnectorService {
|
|
6
|
-
//1) Initialize `store`, `stream`, and `subscription` Redis clients.
|
|
7
|
-
//2) Bind to the target if not already present
|
|
8
|
-
static async initRedisClients(Redis, options, target) {
|
|
9
|
-
if (!target.store || !target.stream || !target.sub) {
|
|
10
|
-
const instances = [];
|
|
11
|
-
if (identifyRedisTypeFromClass(Redis) === 'redis') {
|
|
12
|
-
for (let i = 1; i <= 3; i++) {
|
|
13
|
-
instances.push(RedisConnection.connect(uuidv4(), Redis, options));
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
for (let i = 1; i <= 3; i++) {
|
|
18
|
-
instances.push(IORedisConnection.connect(uuidv4(), Redis, options));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
const [store, stream, sub] = await Promise.all(instances);
|
|
22
|
-
target.store = target.store || store.getClient();
|
|
23
|
-
target.stream = target.stream || stream.getClient();
|
|
24
|
-
target.sub = target.sub || sub.getClient();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { HotMeshGraph } from '../../types/hotmesh';
|
|
2
|
-
declare class DimensionService {
|
|
3
|
-
static targetLength: number;
|
|
4
|
-
/**
|
|
5
|
-
* entry point for compiler-type activities. This is called by the compiler
|
|
6
|
-
* to bind the sorted activity IDs to the trigger activity. These are then used
|
|
7
|
-
* at runtime by the activities to track job/activity status.
|
|
8
|
-
* @param graphs
|
|
9
|
-
*/
|
|
10
|
-
static compile(graphs: HotMeshGraph[]): void;
|
|
11
|
-
/**
|
|
12
|
-
* All activities exist on a dimensional plane. Zero
|
|
13
|
-
* is the default and is implied if no dimension is
|
|
14
|
-
* present in the hash item key. EVERY value in the
|
|
15
|
-
* job ledger is dimensionalized even if the dimension
|
|
16
|
-
* is not present. The key, `AaA`, might not contain
|
|
17
|
-
* a dimensional index, but it is still implicitly
|
|
18
|
-
* dimensionalized as `AaA,0` (assuming a trigger).
|
|
19
|
-
* A value of `AxY,0,0,0,0,1,0,0` would reflect that
|
|
20
|
-
* an ancestor activity was dimensionalized beyond
|
|
21
|
-
* the default. The dimensional string must
|
|
22
|
-
* be included if not zero. There is likely a preceding
|
|
23
|
-
* sibling dimension, so it would not need to include
|
|
24
|
-
* the suffix, so these addresses are equivalent:
|
|
25
|
-
* `AxY,0,0,0,0,0,0,0` == `AxY` for said sibling.
|
|
26
|
-
*/
|
|
27
|
-
static getSeed(index?: number): string;
|
|
28
|
-
}
|
|
29
|
-
export { DimensionService };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
class DimensionService {
|
|
2
|
-
/**
|
|
3
|
-
* entry point for compiler-type activities. This is called by the compiler
|
|
4
|
-
* to bind the sorted activity IDs to the trigger activity. These are then used
|
|
5
|
-
* at runtime by the activities to track job/activity status.
|
|
6
|
-
* @param graphs
|
|
7
|
-
*/
|
|
8
|
-
static compile(graphs) {
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* All activities exist on a dimensional plane. Zero
|
|
12
|
-
* is the default and is implied if no dimension is
|
|
13
|
-
* present in the hash item key. EVERY value in the
|
|
14
|
-
* job ledger is dimensionalized even if the dimension
|
|
15
|
-
* is not present. The key, `AaA`, might not contain
|
|
16
|
-
* a dimensional index, but it is still implicitly
|
|
17
|
-
* dimensionalized as `AaA,0` (assuming a trigger).
|
|
18
|
-
* A value of `AxY,0,0,0,0,1,0,0` would reflect that
|
|
19
|
-
* an ancestor activity was dimensionalized beyond
|
|
20
|
-
* the default. The dimensional string must
|
|
21
|
-
* be included if not zero. There is likely a preceding
|
|
22
|
-
* sibling dimension, so it would not need to include
|
|
23
|
-
* the suffix, so these addresses are equivalent:
|
|
24
|
-
* `AxY,0,0,0,0,0,0,0` == `AxY` for said sibling.
|
|
25
|
-
*/
|
|
26
|
-
static getSeed(index = 0) {
|
|
27
|
-
return `,${index}`;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
//max int digit count that supports `hincrby`
|
|
31
|
-
DimensionService.targetLength = 15;
|
|
32
|
-
export { DimensionService };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { WorkflowHandleService } from './handle';
|
|
2
|
-
import { HotMeshService as HotMesh } from '../hotmesh';
|
|
3
|
-
import { ClientConfig, Connection, WorkflowOptions } from '../../types/durable';
|
|
4
|
-
export declare class ClientService {
|
|
5
|
-
connection: Connection;
|
|
6
|
-
options: WorkflowOptions;
|
|
7
|
-
static instances: Map<string, HotMesh | Promise<HotMesh>>;
|
|
8
|
-
constructor(config: ClientConfig);
|
|
9
|
-
getHotMesh: (worflowTopic: string) => Promise<HotMesh>;
|
|
10
|
-
workflow: {
|
|
11
|
-
start: (options: WorkflowOptions) => Promise<WorkflowHandleService>;
|
|
12
|
-
};
|
|
13
|
-
activateWorkflow(hotMesh: HotMesh, workflowTopic: string): Promise<void>;
|
|
14
|
-
static shutdown(): Promise<void>;
|
|
15
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { WorkflowHandleService } from './handle';
|
|
2
|
-
import { HotMeshService as HotMesh } from '../hotmesh';
|
|
3
|
-
import { getWorkflowYAML } from './factory';
|
|
4
|
-
/*
|
|
5
|
-
Here is an example of how the methods in this file are used:
|
|
6
|
-
|
|
7
|
-
./client.ts
|
|
8
|
-
|
|
9
|
-
import { Durable } from '@hotmeshio/hotmesh';
|
|
10
|
-
import Redis from 'ioredis';
|
|
11
|
-
import { example } from './workflows';
|
|
12
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
13
|
-
|
|
14
|
-
async function run() {
|
|
15
|
-
const connection = await Durable.Connection.connect({
|
|
16
|
-
class: Redis,
|
|
17
|
-
options: {
|
|
18
|
-
host: 'localhost',
|
|
19
|
-
port: 6379,
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const client = new Durable.Client({
|
|
24
|
-
connection,
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const handle = await client.workflow.start({
|
|
28
|
-
args: ['HotMesh'],
|
|
29
|
-
taskQueue: 'hello-world',
|
|
30
|
-
workflowName: 'example',
|
|
31
|
-
workflowId: 'workflow-' + uuidv4(),
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
console.log(`Started workflow ${handle.workflowId}`);
|
|
35
|
-
console.log(await handle.result());
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
run().catch((err) => {
|
|
39
|
-
console.error(err);
|
|
40
|
-
process.exit(1);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
*/
|
|
44
|
-
class ClientService {
|
|
45
|
-
constructor(config) {
|
|
46
|
-
this.getHotMesh = async (worflowTopic) => {
|
|
47
|
-
if (ClientService.instances.has(worflowTopic)) {
|
|
48
|
-
return await ClientService.instances.get(worflowTopic);
|
|
49
|
-
}
|
|
50
|
-
const hotMesh = HotMesh.init({
|
|
51
|
-
appId: worflowTopic,
|
|
52
|
-
engine: {
|
|
53
|
-
redis: {
|
|
54
|
-
class: this.connection.class,
|
|
55
|
-
options: this.connection.options,
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
ClientService.instances.set(worflowTopic, hotMesh);
|
|
60
|
-
await this.activateWorkflow(await hotMesh, worflowTopic);
|
|
61
|
-
return hotMesh;
|
|
62
|
-
};
|
|
63
|
-
this.workflow = {
|
|
64
|
-
start: async (options) => {
|
|
65
|
-
const taskQueueName = options.taskQueue;
|
|
66
|
-
const workflowName = options.workflowName;
|
|
67
|
-
const trc = options.workflowTrace;
|
|
68
|
-
const spn = options.workflowSpan;
|
|
69
|
-
const workflowTopic = `${taskQueueName}-${workflowName}`;
|
|
70
|
-
const hotMesh = await this.getHotMesh(workflowTopic);
|
|
71
|
-
const payload = {
|
|
72
|
-
arguments: [...options.args],
|
|
73
|
-
workflowId: options.workflowId,
|
|
74
|
-
};
|
|
75
|
-
const context = { metadata: { trc, spn }, data: {} };
|
|
76
|
-
const jobId = await hotMesh.pub(workflowTopic, payload, context);
|
|
77
|
-
return new WorkflowHandleService(hotMesh, workflowTopic, jobId);
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
this.connection = config.connection;
|
|
81
|
-
}
|
|
82
|
-
async activateWorkflow(hotMesh, workflowTopic) {
|
|
83
|
-
const version = '1';
|
|
84
|
-
const app = await hotMesh.engine.store.getApp(workflowTopic);
|
|
85
|
-
const appVersion = app?.version;
|
|
86
|
-
if (isNaN(appVersion)) {
|
|
87
|
-
try {
|
|
88
|
-
await hotMesh.deploy(getWorkflowYAML(workflowTopic, version));
|
|
89
|
-
await hotMesh.activate(version);
|
|
90
|
-
}
|
|
91
|
-
catch (err) {
|
|
92
|
-
hotMesh.engine.logger.error('durable-client-deploy-activate-err', err);
|
|
93
|
-
throw err;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else if (app && !app.active) {
|
|
97
|
-
try {
|
|
98
|
-
await hotMesh.activate(version);
|
|
99
|
-
}
|
|
100
|
-
catch (err) {
|
|
101
|
-
hotMesh.engine.logger.error('durable-client-activate-err', err);
|
|
102
|
-
throw err;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
static async shutdown() {
|
|
107
|
-
for (const [key, value] of ClientService.instances) {
|
|
108
|
-
const hotMesh = await value;
|
|
109
|
-
await hotMesh.stop();
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
ClientService.instances = new Map();
|
|
114
|
-
export { ClientService };
|