@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
package/LICENSE
CHANGED
|
@@ -178,13 +178,10 @@ Terms and Conditions for Use, Reproduction, and Distribution
|
|
|
178
178
|
product that includes the Work or any part of it, as a commercial
|
|
179
179
|
service to third parties, or in any other commercial context where
|
|
180
180
|
you derive direct or indirect financial benefit from the use of the
|
|
181
|
-
Work
|
|
182
|
-
|
|
183
|
-
integration-as-a-service
|
|
184
|
-
|
|
185
|
-
HotMesh's commercial offering of workflow and routing services.
|
|
186
|
-
Any such use requires explicit written permission from the
|
|
187
|
-
Licensor.
|
|
181
|
+
Work in a manner that would compete with the Licensor's commercial
|
|
182
|
+
service-mesh-as-a-service, bpm-as-a-service, workflow-as-a-service,
|
|
183
|
+
integration-as-a-service or similar orchestration-type service.
|
|
184
|
+
Any such use requires explicit written permission from the Licensor.
|
|
188
185
|
|
|
189
186
|
END OF TERMS AND CONDITIONS
|
|
190
187
|
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# HotMesh
|
|
2
2
|

|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
Elevate Redis from an in-memory data store to a game-changing [service mesh](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/faq.md#what-is-hotmesh). Turn your unpredictable functions into unbreakable workflows.
|
|
5
5
|
|
|
6
6
|
## Install
|
|
7
7
|
[](https://badge.fury.io/js/%40hotmeshio%2Fhotmesh)
|
|
@@ -11,94 +11,91 @@ npm install @hotmeshio/hotmesh
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Design
|
|
14
|
-
HotMesh
|
|
14
|
+
The HotMesh SDK is designed to keep your code front-and-center. Write functions as you normally would, then use the HotMesh to make them durable.
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
```javascript
|
|
18
|
-
|
|
19
|
-
return `Hello, ${name}!`;
|
|
20
|
-
}
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
**./workflows.ts**
|
|
24
|
-
```javascript
|
|
25
|
-
import { Durable } from '@hotmeshio/hotmesh';
|
|
26
|
-
import type * as activities from './activities';
|
|
27
|
-
|
|
28
|
-
const { greet } = Durable.workflow.proxyActivities<typeof activities>();
|
|
16
|
+
1. Start by defining **activities**. Activities are those functions that will be invoked by your workflow. They are commonly used to read and write to databases and invoke external services. They can be written in any style, using any framework, and can even be legacy functions you've already written. The only requirement is that they return a Promise.
|
|
17
|
+
```javascript
|
|
18
|
+
//activities.ts
|
|
29
19
|
|
|
30
|
-
export async function
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
**./worker.ts**
|
|
36
|
-
```javascript
|
|
37
|
-
import { Durable } from '@hotmeshio/hotmesh';
|
|
38
|
-
import Redis from 'ioredis'; //OR `import * as Redis from 'redis';`
|
|
39
|
-
import * as activities from './activities';
|
|
40
|
-
|
|
41
|
-
async function run() {
|
|
42
|
-
const connection = await Durable.NativeConnection.connect({
|
|
43
|
-
class: Redis,
|
|
44
|
-
options: {
|
|
45
|
-
host: 'localhost',
|
|
46
|
-
port: 6379,
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
const worker = await Durable.Worker.create({
|
|
50
|
-
connection,
|
|
51
|
-
namespace: 'default',
|
|
52
|
-
taskQueue: 'hello-world',
|
|
53
|
-
workflowsPath: require.resolve('./workflows'),
|
|
54
|
-
activities,
|
|
55
|
-
});
|
|
56
|
-
await worker.run();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
run().catch((err) => {
|
|
60
|
-
console.error(err);
|
|
61
|
-
process.exit(1);
|
|
62
|
-
});
|
|
63
|
-
```
|
|
20
|
+
export async function greet(name: string): Promise<string> {
|
|
21
|
+
return `Hello, ${name}!`;
|
|
22
|
+
}
|
|
64
23
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
24
|
+
export async function saludar(nombre: string): Promise<string> {
|
|
25
|
+
return `¡Hola, ${nombre}!`;
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
2. Define your **workflow** logic. Include conditional branching, loops, etc to control activity execution. It's vanilla code written in your own coding style. The only requirement is to use `proxyActivities`, ensuring your activities are executed with HotMesh's durability guarantee.
|
|
29
|
+
```javascript
|
|
30
|
+
//workflows.ts
|
|
31
|
+
|
|
32
|
+
import { Durable } from '@hotmeshio/hotmesh';
|
|
33
|
+
import * as activities from './activities';
|
|
34
|
+
|
|
35
|
+
const { greet, saludar } = Durable.workflow
|
|
36
|
+
.proxyActivities<typeof activities>({
|
|
37
|
+
activities
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export async function example(name: string, lang: string): Promise<string> {
|
|
41
|
+
if (lang === 'es') {
|
|
42
|
+
return await saludar(name);
|
|
43
|
+
} else {
|
|
44
|
+
return await greet(name);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
3. Although you could call your workflow directly (it's just a vanilla function), it's only durable when invoked and orchestrated via HotMesh. By using a HotMesh **client** to send the request, the function is guaranteed to return a result.
|
|
50
|
+
```javascript
|
|
51
|
+
//client.ts
|
|
52
|
+
|
|
53
|
+
import { Durable } from '@hotmeshio/hotmesh';
|
|
54
|
+
import Redis from 'ioredis'; //OR `import * as Redis from 'redis';`
|
|
55
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
56
|
+
|
|
57
|
+
async function run(): Promise<string> {
|
|
58
|
+
const client = new Durable.Client({
|
|
59
|
+
connection: {
|
|
60
|
+
class: Redis,
|
|
61
|
+
options: { host: 'localhost', port: 6379 }
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const handle = await client.workflow.start({
|
|
66
|
+
args: ['HotMesh', 'es'],
|
|
67
|
+
taskQueue: 'hello-world',
|
|
68
|
+
workflowName: 'example',
|
|
69
|
+
workflowId: uuidv4()
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
return await handle.result();
|
|
73
|
+
//returns '¡Hola, HotMesh!'
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
4. The last step is to create a **worker** that executes the workflow. Workers listen for tasks on their assigned channel, executing their assigned workflow function until it succeeds.
|
|
78
|
+
```javascript
|
|
79
|
+
//worker.ts
|
|
80
|
+
|
|
81
|
+
import { Durable } from '@hotmeshio/hotmesh';
|
|
82
|
+
import Redis from 'ioredis';
|
|
83
|
+
import * as workflows from './workflows';
|
|
84
|
+
|
|
85
|
+
async function run() {
|
|
86
|
+
const worker = await Durable.Worker.create({
|
|
87
|
+
connection: {
|
|
88
|
+
class: Redis,
|
|
89
|
+
options: { host: 'localhost', port: 6379 },
|
|
90
|
+
},
|
|
91
|
+
taskQueue: 'hello-world',
|
|
92
|
+
workflow: workflows.example,
|
|
93
|
+
});
|
|
94
|
+
await worker.run();
|
|
95
|
+
}
|
|
96
|
+
```
|
|
100
97
|
|
|
101
|
-
>HotMesh delivers durable
|
|
98
|
+
>HotMesh delivers durable workflows without the cost and complexity of a centralized service mesh. Refer to the [samples-typescript](https://github.com/hotmeshio/samples-typescript) Git Repo for a range of examples, including compositional workflows (where one workflow calls another) and remote execution (where calls are brokered across microservices).
|
|
102
99
|
|
|
103
100
|
## Advanced Design
|
|
104
101
|
HotMesh's TypeScript SDK is the easiest way to make your functions durable. But if you need full control over your function lifecycles (including high-volume, high-speed use cases), you can use HotMesh's underlying YAML models to optimize your durable workflows. The following model depicts a sequence of activities orchestrated by HotMesh. Any function you associate with a `topic` in your YAML definition is guaranteed to be durable.
|
|
@@ -25,7 +25,7 @@
|
|
|
25
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
26
|
* hmsh:<appid>:sym:vals: -> {hash} list of symbols for job values across all app versions
|
|
27
27
|
*/
|
|
28
|
-
declare const
|
|
28
|
+
declare const HMNS = "hmsh";
|
|
29
29
|
declare enum KeyType {
|
|
30
30
|
APP = 0,
|
|
31
31
|
ENGINE_ID = 1,
|
|
@@ -72,4 +72,4 @@ declare class KeyService {
|
|
|
72
72
|
*/
|
|
73
73
|
static mintKey(namespace: string, keyType: KeyType, params: KeyStoreParams): string;
|
|
74
74
|
}
|
|
75
|
-
export { KeyService, KeyType, KeyStoreParams,
|
|
75
|
+
export { KeyService, KeyType, KeyStoreParams, HMNS };
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
* hmsh:<appid>:sym:vals: -> {hash} list of symbols for job values across all app versions
|
|
28
28
|
*/
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.
|
|
30
|
+
exports.HMNS = exports.KeyType = exports.KeyService = void 0;
|
|
31
31
|
//default namespace for hotmesh
|
|
32
|
-
const
|
|
33
|
-
exports.
|
|
32
|
+
const HMNS = "hmsh";
|
|
33
|
+
exports.HMNS = HMNS;
|
|
34
34
|
//these are the entity types that are stored in the key/value store
|
|
35
35
|
var KeyType;
|
|
36
36
|
(function (KeyType) {
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotmeshio/hotmesh",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Durable Workflows",
|
|
5
|
-
"main": "build/
|
|
6
|
-
"
|
|
7
|
-
"types": "build/cjs/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
"import": "./build/esm/index.js",
|
|
10
|
-
"require": "./build/cjs/index.js"
|
|
11
|
-
},
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"types": "build/index.d.ts",
|
|
12
7
|
"repository": {
|
|
13
8
|
"type": "git",
|
|
14
9
|
"url": "https://github.com/hotmeshio/sdk-typescript.git"
|
|
@@ -19,9 +14,7 @@
|
|
|
19
14
|
},
|
|
20
15
|
"scripts": {
|
|
21
16
|
"clean": "rimraf ./build",
|
|
22
|
-
"build
|
|
23
|
-
"build:esm": "tsc --build tsconfig.esm.json",
|
|
24
|
-
"build": "npm run build:cjs && npm run build:esm",
|
|
17
|
+
"build": "tsc --build tsconfig.json",
|
|
25
18
|
"clean-build": "npm run clean && npm run build",
|
|
26
19
|
"lint": "eslint . --ext .ts",
|
|
27
20
|
"lint:fix": "eslint . --fix --ext .ts",
|
|
@@ -10,7 +10,7 @@ Here is an example of how the methods in this file are used:
|
|
|
10
10
|
import { Durable: { NativeConnection, Worker } } from '@hotmeshio/hotmesh';
|
|
11
11
|
import Redis from 'ioredis'; //OR `import * as Redis from 'redis';`
|
|
12
12
|
|
|
13
|
-
import * as
|
|
13
|
+
import * as workflows from './workflows';
|
|
14
14
|
|
|
15
15
|
async function run() {
|
|
16
16
|
const connection = await NativeConnection.connect({
|
|
@@ -22,9 +22,8 @@ async function run() {
|
|
|
22
22
|
});
|
|
23
23
|
const worker = await Worker.create({
|
|
24
24
|
connection,
|
|
25
|
-
namespace: 'default',
|
|
26
25
|
taskQueue: 'hello-world',
|
|
27
|
-
|
|
26
|
+
workflow: workflows.example,
|
|
28
27
|
activities,
|
|
29
28
|
});
|
|
30
29
|
await worker.run();
|
|
@@ -13,9 +13,7 @@ export declare class WorkerService {
|
|
|
13
13
|
* dynamically importing the user's workflow module. That file
|
|
14
14
|
* contains a call, `proxyActivities`, which needs this info.
|
|
15
15
|
*
|
|
16
|
-
* NOTE:
|
|
17
|
-
* as a natural result of importing worflows.ts. However,
|
|
18
|
-
* because the worker imports the workflows dynamically AFTER
|
|
16
|
+
* NOTE: Because the worker imports the workflows dynamically AFTER
|
|
19
17
|
* the activities are loaded, there will be items in the registry,
|
|
20
18
|
* allowing proxyActivities to succeed.
|
|
21
19
|
*/
|
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var _a;
|
|
26
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
4
|
exports.WorkerService = void 0;
|
|
@@ -37,7 +14,7 @@ Here is an example of how the methods in this file are used:
|
|
|
37
14
|
import { Durable: { NativeConnection, Worker } } from '@hotmeshio/hotmesh';
|
|
38
15
|
import Redis from 'ioredis'; //OR `import * as Redis from 'redis';`
|
|
39
16
|
|
|
40
|
-
import * as
|
|
17
|
+
import * as workflows from './workflows';
|
|
41
18
|
|
|
42
19
|
async function run() {
|
|
43
20
|
const connection = await NativeConnection.connect({
|
|
@@ -49,9 +26,8 @@ async function run() {
|
|
|
49
26
|
});
|
|
50
27
|
const worker = await Worker.create({
|
|
51
28
|
connection,
|
|
52
|
-
namespace: 'default',
|
|
53
29
|
taskQueue: 'hello-world',
|
|
54
|
-
|
|
30
|
+
workflow: workflows.example,
|
|
55
31
|
activities,
|
|
56
32
|
});
|
|
57
33
|
await worker.run();
|
|
@@ -92,19 +68,19 @@ class WorkerService {
|
|
|
92
68
|
* dynamically importing the user's workflow module. That file
|
|
93
69
|
* contains a call, `proxyActivities`, which needs this info.
|
|
94
70
|
*
|
|
95
|
-
* NOTE:
|
|
96
|
-
* as a natural result of importing worflows.ts. However,
|
|
97
|
-
* because the worker imports the workflows dynamically AFTER
|
|
71
|
+
* NOTE: Because the worker imports the workflows dynamically AFTER
|
|
98
72
|
* the activities are loaded, there will be items in the registry,
|
|
99
73
|
* allowing proxyActivities to succeed.
|
|
100
74
|
*/
|
|
101
75
|
static registerActivities(activities) {
|
|
102
|
-
if (typeof activities === 'function') {
|
|
76
|
+
if (typeof activities === 'function' && typeof WorkerService.activityRegistry[activities.name] !== 'function') {
|
|
103
77
|
WorkerService.activityRegistry[activities.name] = activities;
|
|
104
78
|
}
|
|
105
79
|
else {
|
|
106
80
|
Object.keys(activities).forEach(key => {
|
|
107
|
-
WorkerService.activityRegistry[activities[key].name]
|
|
81
|
+
if (activities[key].name && typeof WorkerService.activityRegistry[activities[key].name] !== 'function') {
|
|
82
|
+
WorkerService.activityRegistry[activities[key].name] = activities[key];
|
|
83
|
+
}
|
|
108
84
|
});
|
|
109
85
|
}
|
|
110
86
|
return WorkerService.activityRegistry;
|
|
@@ -112,8 +88,8 @@ class WorkerService {
|
|
|
112
88
|
static async create(config) {
|
|
113
89
|
//always call `registerActivities` before `import`
|
|
114
90
|
WorkerService.connection = config.connection;
|
|
115
|
-
|
|
116
|
-
const workflow =
|
|
91
|
+
//user can provide the workflow file directly
|
|
92
|
+
const workflow = config.workflow;
|
|
117
93
|
const [workflowFunctionName, workflowFunction] = WorkerService.resolveWorkflowTarget(workflow);
|
|
118
94
|
const baseTopic = `${config.taskQueue}-${workflowFunctionName}`;
|
|
119
95
|
const activityTopic = `${baseTopic}-activity`;
|
|
@@ -33,8 +33,10 @@ Here is an example of how the methods in this file are used:
|
|
|
33
33
|
./workflows.ts
|
|
34
34
|
|
|
35
35
|
import { Durable } from '@hotmeshio/hotmesh';
|
|
36
|
-
import
|
|
36
|
+
import * as activities from './activities';
|
|
37
|
+
|
|
37
38
|
const { greet } = Durable.workflow.proxyActivities<typeof activities>({
|
|
39
|
+
activities: activities,
|
|
38
40
|
startToCloseTimeout: '1 minute',
|
|
39
41
|
retryPolicy: {
|
|
40
42
|
initialInterval: '5 seconds', // Initial delay between retries
|
|
@@ -71,6 +73,9 @@ class WorkflowService {
|
|
|
71
73
|
return result;
|
|
72
74
|
}
|
|
73
75
|
static proxyActivities(options) {
|
|
76
|
+
if (options.activities) {
|
|
77
|
+
worker_1.WorkerService.registerActivities(options.activities);
|
|
78
|
+
}
|
|
74
79
|
const proxy = {};
|
|
75
80
|
const keys = Object.keys(worker_1.WorkerService.activityRegistry);
|
|
76
81
|
if (keys.length) {
|
|
@@ -17,7 +17,7 @@ class HotMeshService {
|
|
|
17
17
|
}
|
|
18
18
|
verifyAndSetNamespace(namespace) {
|
|
19
19
|
if (!namespace) {
|
|
20
|
-
this.namespace = key_1.
|
|
20
|
+
this.namespace = key_1.HMNS;
|
|
21
21
|
}
|
|
22
22
|
else if (!namespace.match(/^[A-Za-z0-9-]+$/)) {
|
|
23
23
|
throw new Error(`config.namespace [${namespace}] is invalid`);
|
|
@@ -58,7 +58,7 @@ class StoreService {
|
|
|
58
58
|
};
|
|
59
59
|
this.redisClient = redisClient;
|
|
60
60
|
}
|
|
61
|
-
async init(namespace = key_1.
|
|
61
|
+
async init(namespace = key_1.HMNS, appId, logger) {
|
|
62
62
|
this.namespace = namespace;
|
|
63
63
|
this.appId = appId;
|
|
64
64
|
this.logger = logger;
|
|
@@ -111,7 +111,7 @@ class StoreService {
|
|
|
111
111
|
if (bCreate) {
|
|
112
112
|
const packageJson = await Promise.resolve().then(() => __importStar(require('../../package.json')));
|
|
113
113
|
const version = packageJson['version'] || '0.0.0';
|
|
114
|
-
settings = { namespace: key_1.
|
|
114
|
+
settings = { namespace: key_1.HMNS, version };
|
|
115
115
|
await this.setSettings(settings);
|
|
116
116
|
return settings;
|
|
117
117
|
}
|
|
@@ -7,7 +7,7 @@ class IORedisStreamService extends index_1.StreamService {
|
|
|
7
7
|
constructor(redisClient) {
|
|
8
8
|
super(redisClient);
|
|
9
9
|
}
|
|
10
|
-
async init(namespace = key_1.
|
|
10
|
+
async init(namespace = key_1.HMNS, appId, logger) {
|
|
11
11
|
this.namespace = namespace;
|
|
12
12
|
this.logger = logger;
|
|
13
13
|
this.appId = appId;
|
|
@@ -7,7 +7,7 @@ class RedisStreamService extends index_1.StreamService {
|
|
|
7
7
|
constructor(redisClient) {
|
|
8
8
|
super(redisClient);
|
|
9
9
|
}
|
|
10
|
-
async init(namespace = key_1.
|
|
10
|
+
async init(namespace = key_1.HMNS, appId, logger) {
|
|
11
11
|
this.namespace = namespace;
|
|
12
12
|
this.logger = logger;
|
|
13
13
|
this.appId = appId;
|
|
@@ -7,7 +7,7 @@ class IORedisSubService extends index_1.SubService {
|
|
|
7
7
|
constructor(redisClient) {
|
|
8
8
|
super(redisClient);
|
|
9
9
|
}
|
|
10
|
-
async init(namespace = key_1.
|
|
10
|
+
async init(namespace = key_1.HMNS, appId, engineId, logger) {
|
|
11
11
|
this.namespace = namespace;
|
|
12
12
|
this.logger = logger;
|
|
13
13
|
this.appId = appId;
|
|
@@ -7,7 +7,7 @@ class RedisSubService extends index_1.SubService {
|
|
|
7
7
|
constructor(redisClient) {
|
|
8
8
|
super(redisClient);
|
|
9
9
|
}
|
|
10
|
-
async init(namespace = key_1.
|
|
10
|
+
async init(namespace = key_1.HMNS, appId, engineId, logger) {
|
|
11
11
|
this.namespace = namespace;
|
|
12
12
|
this.logger = logger;
|
|
13
13
|
this.appId = appId;
|
|
@@ -32,12 +32,9 @@ type Registry = {
|
|
|
32
32
|
};
|
|
33
33
|
type WorkerConfig = {
|
|
34
34
|
connection: Connection;
|
|
35
|
-
namespace
|
|
35
|
+
namespace?: string;
|
|
36
36
|
taskQueue: string;
|
|
37
|
-
|
|
38
|
-
activities: {
|
|
39
|
-
[key: string]: Function;
|
|
40
|
-
};
|
|
37
|
+
workflow: Function;
|
|
41
38
|
};
|
|
42
39
|
type ContextType = {
|
|
43
40
|
workflowId: string;
|
|
@@ -48,8 +45,9 @@ type ProxyType<ACT> = {
|
|
|
48
45
|
[K in keyof ACT]: FunctionSignature<ACT[K]>;
|
|
49
46
|
};
|
|
50
47
|
type ActivityConfig = {
|
|
51
|
-
startToCloseTimeout
|
|
52
|
-
|
|
48
|
+
startToCloseTimeout?: string;
|
|
49
|
+
activities?: any;
|
|
50
|
+
retryPolicy?: {
|
|
53
51
|
initialInterval: string;
|
|
54
52
|
maximumAttempts: number;
|
|
55
53
|
backoffCoefficient: number;
|
package/modules/key.ts
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
//default namespace for hotmesh
|
|
30
|
-
const
|
|
30
|
+
const HMNS = "hmsh";
|
|
31
31
|
|
|
32
32
|
//these are the entity types that are stored in the key/value store
|
|
33
33
|
enum KeyType {
|
|
@@ -126,4 +126,4 @@ class KeyService {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
export { KeyService, KeyType, KeyStoreParams,
|
|
129
|
+
export { KeyService, KeyType, KeyStoreParams, HMNS };
|
package/package.json
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotmeshio/hotmesh",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Durable Workflows",
|
|
5
|
-
"main": "build/
|
|
6
|
-
"
|
|
7
|
-
"types": "build/cjs/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
"import": "./build/esm/index.js",
|
|
10
|
-
"require": "./build/cjs/index.js"
|
|
11
|
-
},
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"types": "build/index.d.ts",
|
|
12
7
|
"repository": {
|
|
13
8
|
"type": "git",
|
|
14
9
|
"url": "https://github.com/hotmeshio/sdk-typescript.git"
|
|
@@ -19,9 +14,7 @@
|
|
|
19
14
|
},
|
|
20
15
|
"scripts": {
|
|
21
16
|
"clean": "rimraf ./build",
|
|
22
|
-
"build
|
|
23
|
-
"build:esm": "tsc --build tsconfig.esm.json",
|
|
24
|
-
"build": "npm run build:cjs && npm run build:esm",
|
|
17
|
+
"build": "tsc --build tsconfig.json",
|
|
25
18
|
"clean-build": "npm run clean && npm run build",
|
|
26
19
|
"lint": "eslint . --ext .ts",
|
|
27
20
|
"lint:fix": "eslint . --fix --ext .ts",
|
|
@@ -9,7 +9,7 @@ Here is an example of how the methods in this file are used:
|
|
|
9
9
|
import { Durable: { NativeConnection, Worker } } from '@hotmeshio/hotmesh';
|
|
10
10
|
import Redis from 'ioredis'; //OR `import * as Redis from 'redis';`
|
|
11
11
|
|
|
12
|
-
import * as
|
|
12
|
+
import * as workflows from './workflows';
|
|
13
13
|
|
|
14
14
|
async function run() {
|
|
15
15
|
const connection = await NativeConnection.connect({
|
|
@@ -21,9 +21,8 @@ async function run() {
|
|
|
21
21
|
});
|
|
22
22
|
const worker = await Worker.create({
|
|
23
23
|
connection,
|
|
24
|
-
namespace: 'default',
|
|
25
24
|
taskQueue: 'hello-world',
|
|
26
|
-
|
|
25
|
+
workflow: workflows.example,
|
|
27
26
|
activities,
|
|
28
27
|
});
|
|
29
28
|
await worker.run();
|
|
@@ -13,7 +13,7 @@ Here is an example of how the methods in this file are used:
|
|
|
13
13
|
import { Durable: { NativeConnection, Worker } } from '@hotmeshio/hotmesh';
|
|
14
14
|
import Redis from 'ioredis'; //OR `import * as Redis from 'redis';`
|
|
15
15
|
|
|
16
|
-
import * as
|
|
16
|
+
import * as workflows from './workflows';
|
|
17
17
|
|
|
18
18
|
async function run() {
|
|
19
19
|
const connection = await NativeConnection.connect({
|
|
@@ -25,9 +25,8 @@ async function run() {
|
|
|
25
25
|
});
|
|
26
26
|
const worker = await Worker.create({
|
|
27
27
|
connection,
|
|
28
|
-
namespace: 'default',
|
|
29
28
|
taskQueue: 'hello-world',
|
|
30
|
-
|
|
29
|
+
workflow: workflows.example,
|
|
31
30
|
activities,
|
|
32
31
|
});
|
|
33
32
|
await worker.run();
|
|
@@ -86,18 +85,18 @@ export class WorkerService {
|
|
|
86
85
|
* dynamically importing the user's workflow module. That file
|
|
87
86
|
* contains a call, `proxyActivities`, which needs this info.
|
|
88
87
|
*
|
|
89
|
-
* NOTE:
|
|
90
|
-
* as a natural result of importing worflows.ts. However,
|
|
91
|
-
* because the worker imports the workflows dynamically AFTER
|
|
88
|
+
* NOTE: Because the worker imports the workflows dynamically AFTER
|
|
92
89
|
* the activities are loaded, there will be items in the registry,
|
|
93
90
|
* allowing proxyActivities to succeed.
|
|
94
91
|
*/
|
|
95
92
|
static registerActivities<ACT>(activities: ACT): Registry {
|
|
96
|
-
if (typeof activities === 'function') {
|
|
93
|
+
if (typeof activities === 'function' && typeof WorkerService.activityRegistry[activities.name] !== 'function') {
|
|
97
94
|
WorkerService.activityRegistry[activities.name] = activities as Function;
|
|
98
95
|
} else {
|
|
99
96
|
Object.keys(activities).forEach(key => {
|
|
100
|
-
WorkerService.activityRegistry[activities[key].name]
|
|
97
|
+
if (activities[key].name && typeof WorkerService.activityRegistry[activities[key].name] !== 'function') {
|
|
98
|
+
WorkerService.activityRegistry[activities[key].name] = (activities as any)[key] as Function;
|
|
99
|
+
}
|
|
101
100
|
});
|
|
102
101
|
}
|
|
103
102
|
return WorkerService.activityRegistry;
|
|
@@ -106,8 +105,8 @@ export class WorkerService {
|
|
|
106
105
|
static async create(config: WorkerConfig) {
|
|
107
106
|
//always call `registerActivities` before `import`
|
|
108
107
|
WorkerService.connection = config.connection;
|
|
109
|
-
|
|
110
|
-
const workflow =
|
|
108
|
+
//user can provide the workflow file directly
|
|
109
|
+
const workflow = config.workflow;
|
|
111
110
|
const [workflowFunctionName, workflowFunction] = WorkerService.resolveWorkflowTarget(workflow);
|
|
112
111
|
const baseTopic = `${config.taskQueue}-${workflowFunctionName}`;
|
|
113
112
|
const activityTopic = `${baseTopic}-activity`;
|
|
@@ -31,8 +31,10 @@ Here is an example of how the methods in this file are used:
|
|
|
31
31
|
./workflows.ts
|
|
32
32
|
|
|
33
33
|
import { Durable } from '@hotmeshio/hotmesh';
|
|
34
|
-
import
|
|
34
|
+
import * as activities from './activities';
|
|
35
|
+
|
|
35
36
|
const { greet } = Durable.workflow.proxyActivities<typeof activities>({
|
|
37
|
+
activities: activities,
|
|
36
38
|
startToCloseTimeout: '1 minute',
|
|
37
39
|
retryPolicy: {
|
|
38
40
|
initialInterval: '5 seconds', // Initial delay between retries
|
|
@@ -72,6 +74,10 @@ export class WorkflowService {
|
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
static proxyActivities<ACT>(options?: ActivityConfig): ProxyType<ACT> {
|
|
77
|
+
if (options.activities) {
|
|
78
|
+
WorkerService.registerActivities(options.activities)
|
|
79
|
+
}
|
|
80
|
+
|
|
75
81
|
const proxy: any = {};
|
|
76
82
|
const keys = Object.keys(WorkerService.activityRegistry);
|
|
77
83
|
if (keys.length) {
|