@hotmeshio/hotmesh 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/build/{package.json → cjs/package.json} +12 -5
- package/build/{services → cjs/services}/activities/activity.d.ts +2 -0
- package/build/{services → cjs/services}/activities/activity.js +27 -9
- package/build/{services → cjs/services}/activities/trigger.js +2 -2
- package/build/{services → cjs/services}/activities/worker.js +1 -0
- package/build/{services → cjs/services}/collator/index.d.ts +7 -5
- package/build/{services → cjs/services}/collator/index.js +29 -6
- package/build/{services → cjs/services}/compiler/deployer.d.ts +4 -3
- package/build/{services → cjs/services}/compiler/deployer.js +14 -0
- package/build/{services → cjs/services}/connector/index.js +3 -3
- package/build/{services → cjs/services}/dimension/index.d.ts +1 -1
- package/build/{services → cjs/services}/durable/client.js +2 -2
- package/build/{services → cjs/services}/durable/connection.js +2 -2
- package/build/{services → cjs/services}/durable/handle.d.ts +1 -1
- package/build/{services → cjs/services}/engine/index.d.ts +1 -1
- package/build/{services → cjs/services}/engine/index.js +22 -5
- package/build/{services → cjs/services}/hotmesh/index.d.ts +1 -1
- package/build/{services → cjs/services}/hotmesh/index.js +4 -4
- package/build/{services → cjs/services}/mapper/index.d.ts +3 -3
- package/build/{services → cjs/services}/serializer/index.d.ts +6 -1
- package/build/{services → cjs/services}/serializer/index.js +55 -22
- package/build/{services → cjs/services}/signaler/stream.js +1 -0
- package/build/{services → cjs/services}/store/index.d.ts +3 -3
- package/build/{services → cjs/services}/store/index.js +11 -24
- package/build/{types → cjs/types}/activity.d.ts +1 -0
- package/build/esm/index.d.ts +4 -0
- package/build/esm/index.js +3 -0
- package/build/esm/modules/errors.d.ts +28 -0
- package/build/esm/modules/errors.js +41 -0
- package/build/esm/modules/key.d.ts +75 -0
- package/build/esm/modules/key.js +111 -0
- package/build/esm/modules/utils.d.ts +34 -0
- package/build/esm/modules/utils.js +154 -0
- package/build/esm/package.json +80 -0
- package/build/esm/services/activities/activity.d.ts +61 -0
- package/build/esm/services/activities/activity.js +411 -0
- package/build/esm/services/activities/await.d.ts +16 -0
- package/build/esm/services/activities/await.js +140 -0
- package/build/esm/services/activities/emit.d.ts +9 -0
- package/build/esm/services/activities/emit.js +10 -0
- package/build/esm/services/activities/index.d.ts +15 -0
- package/build/esm/services/activities/index.js +14 -0
- package/build/esm/services/activities/iterate.d.ts +9 -0
- package/build/esm/services/activities/iterate.js +10 -0
- package/build/esm/services/activities/trigger.d.ts +22 -0
- package/build/esm/services/activities/trigger.js +158 -0
- package/build/esm/services/activities/worker.d.ts +17 -0
- package/build/esm/services/activities/worker.js +162 -0
- package/build/esm/services/collator/index.d.ts +56 -0
- package/build/esm/services/collator/index.js +191 -0
- package/build/esm/services/compiler/deployer.d.ts +36 -0
- package/build/esm/services/compiler/deployer.js +423 -0
- package/build/esm/services/compiler/index.d.ts +30 -0
- package/build/esm/services/compiler/index.js +82 -0
- package/build/esm/services/compiler/validator.d.ts +32 -0
- package/build/esm/services/compiler/validator.js +131 -0
- package/build/esm/services/connector/clients/ioredis.d.ts +13 -0
- package/build/esm/services/connector/clients/ioredis.js +47 -0
- package/build/esm/services/connector/clients/redis.d.ts +13 -0
- package/build/esm/services/connector/clients/redis.js +59 -0
- package/build/esm/services/connector/index.d.ts +5 -0
- package/build/esm/services/connector/index.js +27 -0
- package/build/esm/services/dimension/index.d.ts +29 -0
- package/build/esm/services/dimension/index.js +32 -0
- package/build/esm/services/durable/asyncLocalStorage.d.ts +3 -0
- package/build/esm/services/durable/asyncLocalStorage.js +2 -0
- package/build/esm/services/durable/client.d.ts +15 -0
- package/build/esm/services/durable/client.js +114 -0
- package/build/esm/services/durable/connection.d.ts +4 -0
- package/build/esm/services/durable/connection.js +47 -0
- package/build/esm/services/durable/factory.d.ts +3 -0
- package/build/esm/services/durable/factory.js +119 -0
- package/build/esm/services/durable/handle.d.ts +8 -0
- package/build/esm/services/durable/handle.js +34 -0
- package/build/esm/services/durable/index.d.ts +57 -0
- package/build/esm/services/durable/index.js +55 -0
- package/build/esm/services/durable/native.d.ts +4 -0
- package/build/esm/services/durable/native.js +43 -0
- package/build/esm/services/durable/worker.d.ts +36 -0
- package/build/esm/services/durable/worker.js +258 -0
- package/build/esm/services/durable/workflow.d.ts +6 -0
- package/build/esm/services/durable/workflow.js +128 -0
- package/build/esm/services/engine/index.d.ts +82 -0
- package/build/esm/services/engine/index.js +522 -0
- package/build/esm/services/hotmesh/index.d.ts +45 -0
- package/build/esm/services/hotmesh/index.js +131 -0
- package/build/esm/services/logger/index.d.ts +17 -0
- package/build/esm/services/logger/index.js +70 -0
- package/build/esm/services/mapper/index.d.ts +24 -0
- package/build/esm/services/mapper/index.js +69 -0
- package/build/esm/services/pipe/functions/array.d.ts +24 -0
- package/build/esm/services/pipe/functions/array.js +66 -0
- package/build/esm/services/pipe/functions/bitwise.d.ts +9 -0
- package/build/esm/services/pipe/functions/bitwise.js +21 -0
- package/build/esm/services/pipe/functions/conditional.d.ts +10 -0
- package/build/esm/services/pipe/functions/conditional.js +24 -0
- package/build/esm/services/pipe/functions/date.d.ts +57 -0
- package/build/esm/services/pipe/functions/date.js +164 -0
- package/build/esm/services/pipe/functions/index.d.ts +25 -0
- package/build/esm/services/pipe/functions/index.js +24 -0
- package/build/esm/services/pipe/functions/json.d.ts +5 -0
- package/build/esm/services/pipe/functions/json.js +9 -0
- package/build/esm/services/pipe/functions/math.d.ts +38 -0
- package/build/esm/services/pipe/functions/math.js +108 -0
- package/build/esm/services/pipe/functions/number.d.ts +25 -0
- package/build/esm/services/pipe/functions/number.js +130 -0
- package/build/esm/services/pipe/functions/object.d.ts +22 -0
- package/build/esm/services/pipe/functions/object.js +60 -0
- package/build/esm/services/pipe/functions/string.d.ts +23 -0
- package/build/esm/services/pipe/functions/string.js +66 -0
- package/build/esm/services/pipe/functions/symbol.d.ts +12 -0
- package/build/esm/services/pipe/functions/symbol.js +30 -0
- package/build/esm/services/pipe/functions/unary.d.ts +7 -0
- package/build/esm/services/pipe/functions/unary.js +15 -0
- package/build/esm/services/pipe/index.d.ts +30 -0
- package/build/esm/services/pipe/index.js +122 -0
- package/build/esm/services/quorum/index.d.ts +34 -0
- package/build/esm/services/quorum/index.js +144 -0
- package/build/esm/services/reporter/index.d.ts +47 -0
- package/build/esm/services/reporter/index.js +327 -0
- package/build/esm/services/serializer/index.d.ts +41 -0
- package/build/esm/services/serializer/index.js +251 -0
- package/build/esm/services/signaler/store.d.ts +15 -0
- package/build/esm/services/signaler/store.js +50 -0
- package/build/esm/services/signaler/stream.d.ts +43 -0
- package/build/esm/services/signaler/stream.js +315 -0
- package/build/esm/services/store/cache.d.ts +66 -0
- package/build/esm/services/store/cache.js +124 -0
- package/build/esm/services/store/clients/ioredis.d.ts +27 -0
- package/build/esm/services/store/clients/ioredis.js +93 -0
- package/build/esm/services/store/clients/redis.d.ts +29 -0
- package/build/esm/services/store/clients/redis.js +140 -0
- package/build/esm/services/store/index.d.ts +88 -0
- package/build/esm/services/store/index.js +623 -0
- package/build/esm/services/stream/clients/ioredis.d.ts +23 -0
- package/build/esm/services/stream/clients/ioredis.js +112 -0
- package/build/esm/services/stream/clients/redis.d.ts +23 -0
- package/build/esm/services/stream/clients/redis.js +116 -0
- package/build/esm/services/stream/index.d.ts +21 -0
- package/build/esm/services/stream/index.js +6 -0
- package/build/esm/services/sub/clients/ioredis.d.ts +20 -0
- package/build/esm/services/sub/clients/ioredis.js +69 -0
- package/build/esm/services/sub/clients/redis.d.ts +20 -0
- package/build/esm/services/sub/clients/redis.js +60 -0
- package/build/esm/services/sub/index.d.ts +18 -0
- package/build/esm/services/sub/index.js +6 -0
- package/build/esm/services/task/index.d.ts +18 -0
- package/build/esm/services/task/index.js +70 -0
- package/build/esm/services/telemetry/index.d.ts +49 -0
- package/build/esm/services/telemetry/index.js +217 -0
- package/build/esm/services/worker/index.d.ts +30 -0
- package/build/esm/services/worker/index.js +102 -0
- package/build/esm/types/activity.d.ts +87 -0
- package/build/esm/types/activity.js +1 -0
- package/build/esm/types/app.d.ts +16 -0
- package/build/esm/types/app.js +1 -0
- package/build/esm/types/async.d.ts +5 -0
- package/build/esm/types/async.js +1 -0
- package/build/esm/types/cache.d.ts +1 -0
- package/build/esm/types/cache.js +1 -0
- package/build/esm/types/collator.d.ts +8 -0
- package/build/esm/types/collator.js +8 -0
- package/build/esm/types/durable.d.ts +59 -0
- package/build/esm/types/durable.js +1 -0
- package/build/esm/types/hook.d.ts +31 -0
- package/build/esm/types/hook.js +6 -0
- package/build/esm/types/hotmesh.d.ts +82 -0
- package/build/esm/types/hotmesh.js +1 -0
- package/build/esm/types/index.d.ts +20 -0
- package/build/esm/types/index.js +5 -0
- package/build/esm/types/ioredisclient.d.ts +5 -0
- package/build/esm/types/ioredisclient.js +2 -0
- package/build/esm/types/job.d.ts +50 -0
- package/build/esm/types/job.js +1 -0
- package/build/esm/types/logger.d.ts +6 -0
- package/build/esm/types/logger.js +1 -0
- package/build/esm/types/map.d.ts +4 -0
- package/build/esm/types/map.js +1 -0
- package/build/esm/types/pipe.d.ts +4 -0
- package/build/esm/types/pipe.js +1 -0
- package/build/esm/types/quorum.d.ts +46 -0
- package/build/esm/types/quorum.js +1 -0
- package/build/esm/types/redis.d.ts +8 -0
- package/build/esm/types/redis.js +1 -0
- package/build/esm/types/redisclient.d.ts +25 -0
- package/build/esm/types/redisclient.js +1 -0
- package/build/esm/types/serializer.d.ts +33 -0
- package/build/esm/types/serializer.js +1 -0
- package/build/esm/types/stats.d.ts +83 -0
- package/build/esm/types/stats.js +1 -0
- package/build/esm/types/stream.d.ts +67 -0
- package/build/esm/types/stream.js +22 -0
- package/build/esm/types/telemetry.d.ts +1 -0
- package/build/esm/types/telemetry.js +1 -0
- package/build/esm/types/transition.d.ts +17 -0
- package/build/esm/types/transition.js +1 -0
- package/package.json +12 -5
- package/services/activities/activity.ts +28 -9
- package/services/activities/trigger.ts +2 -2
- package/services/activities/worker.ts +1 -0
- package/services/collator/index.ts +38 -13
- package/services/compiler/deployer.ts +24 -9
- package/services/connector/index.ts +3 -3
- package/services/dimension/index.ts +1 -1
- package/services/durable/client.ts +2 -2
- package/services/durable/connection.ts +2 -2
- package/services/durable/handle.ts +2 -2
- package/services/engine/index.ts +23 -5
- package/services/hotmesh/index.ts +4 -4
- package/services/mapper/index.ts +6 -8
- package/services/serializer/index.ts +57 -22
- package/services/signaler/stream.ts +1 -0
- package/services/store/index.ts +13 -25
- package/tsconfig.cjs.json +8 -0
- package/tsconfig.esm.json +9 -0
- package/types/activity.ts +1 -0
- /package/build/{index.d.ts → cjs/index.d.ts} +0 -0
- /package/build/{index.js → cjs/index.js} +0 -0
- /package/build/{modules → cjs/modules}/errors.d.ts +0 -0
- /package/build/{modules → cjs/modules}/errors.js +0 -0
- /package/build/{modules → cjs/modules}/key.d.ts +0 -0
- /package/build/{modules → cjs/modules}/key.js +0 -0
- /package/build/{modules → cjs/modules}/utils.d.ts +0 -0
- /package/build/{modules → cjs/modules}/utils.js +0 -0
- /package/build/{services → cjs/services}/activities/await.d.ts +0 -0
- /package/build/{services → cjs/services}/activities/await.js +0 -0
- /package/build/{services → cjs/services}/activities/emit.d.ts +0 -0
- /package/build/{services → cjs/services}/activities/emit.js +0 -0
- /package/build/{services → cjs/services}/activities/index.d.ts +0 -0
- /package/build/{services → cjs/services}/activities/index.js +0 -0
- /package/build/{services → cjs/services}/activities/iterate.d.ts +0 -0
- /package/build/{services → cjs/services}/activities/iterate.js +0 -0
- /package/build/{services → cjs/services}/activities/trigger.d.ts +0 -0
- /package/build/{services → cjs/services}/activities/worker.d.ts +0 -0
- /package/build/{services → cjs/services}/compiler/index.d.ts +0 -0
- /package/build/{services → cjs/services}/compiler/index.js +0 -0
- /package/build/{services → cjs/services}/compiler/validator.d.ts +0 -0
- /package/build/{services → cjs/services}/compiler/validator.js +0 -0
- /package/build/{services → cjs/services}/connector/clients/ioredis.d.ts +0 -0
- /package/build/{services → cjs/services}/connector/clients/ioredis.js +0 -0
- /package/build/{services → cjs/services}/connector/clients/redis.d.ts +0 -0
- /package/build/{services → cjs/services}/connector/clients/redis.js +0 -0
- /package/build/{services → cjs/services}/connector/index.d.ts +0 -0
- /package/build/{services → cjs/services}/dimension/index.js +0 -0
- /package/build/{services → cjs/services}/durable/asyncLocalStorage.d.ts +0 -0
- /package/build/{services → cjs/services}/durable/asyncLocalStorage.js +0 -0
- /package/build/{services → cjs/services}/durable/client.d.ts +0 -0
- /package/build/{services → cjs/services}/durable/connection.d.ts +0 -0
- /package/build/{services → cjs/services}/durable/factory.d.ts +0 -0
- /package/build/{services → cjs/services}/durable/factory.js +0 -0
- /package/build/{services → cjs/services}/durable/handle.js +0 -0
- /package/build/{services → cjs/services}/durable/index.d.ts +0 -0
- /package/build/{services → cjs/services}/durable/index.js +0 -0
- /package/build/{services → cjs/services}/durable/native.d.ts +0 -0
- /package/build/{services → cjs/services}/durable/native.js +0 -0
- /package/build/{services → cjs/services}/durable/worker.d.ts +0 -0
- /package/build/{services → cjs/services}/durable/worker.js +0 -0
- /package/build/{services → cjs/services}/durable/workflow.d.ts +0 -0
- /package/build/{services → cjs/services}/durable/workflow.js +0 -0
- /package/build/{services → cjs/services}/logger/index.d.ts +0 -0
- /package/build/{services → cjs/services}/logger/index.js +0 -0
- /package/build/{services → cjs/services}/mapper/index.js +0 -0
- /package/build/{services → cjs/services}/pipe/functions/array.d.ts +0 -0
- /package/build/{services → cjs/services}/pipe/functions/array.js +0 -0
- /package/build/{services → cjs/services}/pipe/functions/bitwise.d.ts +0 -0
- /package/build/{services → cjs/services}/pipe/functions/bitwise.js +0 -0
- /package/build/{services → cjs/services}/pipe/functions/conditional.d.ts +0 -0
- /package/build/{services → cjs/services}/pipe/functions/conditional.js +0 -0
- /package/build/{services → cjs/services}/pipe/functions/date.d.ts +0 -0
- /package/build/{services → cjs/services}/pipe/functions/date.js +0 -0
- /package/build/{services → cjs/services}/pipe/functions/index.d.ts +0 -0
- /package/build/{services → cjs/services}/pipe/functions/index.js +0 -0
- /package/build/{services → cjs/services}/pipe/functions/json.d.ts +0 -0
- /package/build/{services → cjs/services}/pipe/functions/json.js +0 -0
- /package/build/{services → cjs/services}/pipe/functions/math.d.ts +0 -0
- /package/build/{services → cjs/services}/pipe/functions/math.js +0 -0
- /package/build/{services → cjs/services}/pipe/functions/number.d.ts +0 -0
- /package/build/{services → cjs/services}/pipe/functions/number.js +0 -0
- /package/build/{services → cjs/services}/pipe/functions/object.d.ts +0 -0
- /package/build/{services → cjs/services}/pipe/functions/object.js +0 -0
- /package/build/{services → cjs/services}/pipe/functions/string.d.ts +0 -0
- /package/build/{services → cjs/services}/pipe/functions/string.js +0 -0
- /package/build/{services → cjs/services}/pipe/functions/symbol.d.ts +0 -0
- /package/build/{services → cjs/services}/pipe/functions/symbol.js +0 -0
- /package/build/{services → cjs/services}/pipe/functions/unary.d.ts +0 -0
- /package/build/{services → cjs/services}/pipe/functions/unary.js +0 -0
- /package/build/{services → cjs/services}/pipe/index.d.ts +0 -0
- /package/build/{services → cjs/services}/pipe/index.js +0 -0
- /package/build/{services → cjs/services}/quorum/index.d.ts +0 -0
- /package/build/{services → cjs/services}/quorum/index.js +0 -0
- /package/build/{services → cjs/services}/reporter/index.d.ts +0 -0
- /package/build/{services → cjs/services}/reporter/index.js +0 -0
- /package/build/{services → cjs/services}/signaler/store.d.ts +0 -0
- /package/build/{services → cjs/services}/signaler/store.js +0 -0
- /package/build/{services → cjs/services}/signaler/stream.d.ts +0 -0
- /package/build/{services → cjs/services}/store/cache.d.ts +0 -0
- /package/build/{services → cjs/services}/store/cache.js +0 -0
- /package/build/{services → cjs/services}/store/clients/ioredis.d.ts +0 -0
- /package/build/{services → cjs/services}/store/clients/ioredis.js +0 -0
- /package/build/{services → cjs/services}/store/clients/redis.d.ts +0 -0
- /package/build/{services → cjs/services}/store/clients/redis.js +0 -0
- /package/build/{services → cjs/services}/stream/clients/ioredis.d.ts +0 -0
- /package/build/{services → cjs/services}/stream/clients/ioredis.js +0 -0
- /package/build/{services → cjs/services}/stream/clients/redis.d.ts +0 -0
- /package/build/{services → cjs/services}/stream/clients/redis.js +0 -0
- /package/build/{services → cjs/services}/stream/index.d.ts +0 -0
- /package/build/{services → cjs/services}/stream/index.js +0 -0
- /package/build/{services → cjs/services}/sub/clients/ioredis.d.ts +0 -0
- /package/build/{services → cjs/services}/sub/clients/ioredis.js +0 -0
- /package/build/{services → cjs/services}/sub/clients/redis.d.ts +0 -0
- /package/build/{services → cjs/services}/sub/clients/redis.js +0 -0
- /package/build/{services → cjs/services}/sub/index.d.ts +0 -0
- /package/build/{services → cjs/services}/sub/index.js +0 -0
- /package/build/{services → cjs/services}/task/index.d.ts +0 -0
- /package/build/{services → cjs/services}/task/index.js +0 -0
- /package/build/{services → cjs/services}/telemetry/index.d.ts +0 -0
- /package/build/{services → cjs/services}/telemetry/index.js +0 -0
- /package/build/{services → cjs/services}/worker/index.d.ts +0 -0
- /package/build/{services → cjs/services}/worker/index.js +0 -0
- /package/build/{types → cjs/types}/activity.js +0 -0
- /package/build/{types → cjs/types}/app.d.ts +0 -0
- /package/build/{types → cjs/types}/app.js +0 -0
- /package/build/{types → cjs/types}/async.d.ts +0 -0
- /package/build/{types → cjs/types}/async.js +0 -0
- /package/build/{types → cjs/types}/cache.d.ts +0 -0
- /package/build/{types → cjs/types}/cache.js +0 -0
- /package/build/{types → cjs/types}/collator.d.ts +0 -0
- /package/build/{types → cjs/types}/collator.js +0 -0
- /package/build/{types → cjs/types}/durable.d.ts +0 -0
- /package/build/{types → cjs/types}/durable.js +0 -0
- /package/build/{types → cjs/types}/hook.d.ts +0 -0
- /package/build/{types → cjs/types}/hook.js +0 -0
- /package/build/{types → cjs/types}/hotmesh.d.ts +0 -0
- /package/build/{types → cjs/types}/hotmesh.js +0 -0
- /package/build/{types → cjs/types}/index.d.ts +0 -0
- /package/build/{types → cjs/types}/index.js +0 -0
- /package/build/{types → cjs/types}/ioredisclient.d.ts +0 -0
- /package/build/{types → cjs/types}/ioredisclient.js +0 -0
- /package/build/{types → cjs/types}/job.d.ts +0 -0
- /package/build/{types → cjs/types}/job.js +0 -0
- /package/build/{types → cjs/types}/logger.d.ts +0 -0
- /package/build/{types → cjs/types}/logger.js +0 -0
- /package/build/{types → cjs/types}/map.d.ts +0 -0
- /package/build/{types → cjs/types}/map.js +0 -0
- /package/build/{types → cjs/types}/pipe.d.ts +0 -0
- /package/build/{types → cjs/types}/pipe.js +0 -0
- /package/build/{types → cjs/types}/quorum.d.ts +0 -0
- /package/build/{types → cjs/types}/quorum.js +0 -0
- /package/build/{types → cjs/types}/redis.d.ts +0 -0
- /package/build/{types → cjs/types}/redis.js +0 -0
- /package/build/{types → cjs/types}/redisclient.d.ts +0 -0
- /package/build/{types → cjs/types}/redisclient.js +0 -0
- /package/build/{types → cjs/types}/serializer.d.ts +0 -0
- /package/build/{types → cjs/types}/serializer.js +0 -0
- /package/build/{types → cjs/types}/stats.d.ts +0 -0
- /package/build/{types → cjs/types}/stats.js +0 -0
- /package/build/{types → cjs/types}/stream.d.ts +0 -0
- /package/build/{types → cjs/types}/stream.js +0 -0
- /package/build/{types → cjs/types}/telemetry.d.ts +0 -0
- /package/build/{types → cjs/types}/telemetry.js +0 -0
- /package/build/{types → cjs/types}/transition.d.ts +0 -0
- /package/build/{types → cjs/types}/transition.js +0 -0
|
@@ -1,18 +1,28 @@
|
|
|
1
|
-
import { CollationError } from
|
|
2
|
-
import { RedisMulti } from
|
|
3
|
-
import { CollationFaultType, CollationStage } from
|
|
4
|
-
import { ActivityDuplex } from
|
|
5
|
-
import { HotMeshGraph } from
|
|
6
|
-
import { Activity } from
|
|
1
|
+
import { CollationError } from '../../modules/errors';
|
|
2
|
+
import { RedisMulti } from '../../types/redis';
|
|
3
|
+
import { CollationFaultType, CollationStage } from '../../types/collator';
|
|
4
|
+
import { ActivityDuplex } from '../../types/activity';
|
|
5
|
+
import { HotMeshGraph } from '../../types/hotmesh';
|
|
6
|
+
import { Activity } from '../activities/activity';
|
|
7
7
|
|
|
8
8
|
class CollatorService {
|
|
9
9
|
|
|
10
10
|
//max int digit count that supports `hincrby`
|
|
11
|
-
static targetLength = 15;
|
|
11
|
+
static targetLength = 15;
|
|
12
|
+
|
|
13
|
+
static getDimensionalAddress(activity: Activity): Record<string, string> {
|
|
14
|
+
let dad = activity.context.metadata.dad || activity.metadata.dad;
|
|
15
|
+
//todo: unsure about this reset
|
|
16
|
+
// if (dad && activity.leg === 2) {
|
|
17
|
+
// console.log('setting dad index back to 0=>', dad);
|
|
18
|
+
// dad = `${dad.substring(0, dad.lastIndexOf(','))},0`;
|
|
19
|
+
// }
|
|
20
|
+
return CollatorService.getDimensionsById([...activity.config.ancestors, activity.metadata.aid], dad);
|
|
21
|
+
}
|
|
12
22
|
|
|
13
23
|
static async notarizeEntry(activity: Activity, multi?: RedisMulti): Promise<number> {
|
|
14
24
|
//decrement by -100_000_000_000_000
|
|
15
|
-
const amount = await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, -100_000_000_000_000, multi);
|
|
25
|
+
const amount = await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, -100_000_000_000_000, this.getDimensionalAddress(activity), multi);
|
|
16
26
|
this.verifyInteger(amount, 1, 'enter');
|
|
17
27
|
return amount;
|
|
18
28
|
};
|
|
@@ -20,31 +30,31 @@ class CollatorService {
|
|
|
20
30
|
static async authorizeReentry(activity: Activity, multi?: RedisMulti): Promise<number> {
|
|
21
31
|
//set second digit to 8, allowing for re-entry
|
|
22
32
|
//decrement by -10_000_000_000_000
|
|
23
|
-
const amount = await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, -10_000_000_000_000, multi);
|
|
33
|
+
const amount = await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, -10_000_000_000_000, this.getDimensionalAddress(activity), multi);
|
|
24
34
|
//this.verifyInteger(amount, 1, 'exit');
|
|
25
35
|
return amount;
|
|
26
36
|
}
|
|
27
37
|
|
|
28
38
|
static async notarizeEarlyCompletion(activity: Activity, multi?: RedisMulti): Promise<number> {
|
|
29
39
|
//initialize both `possible` (1m) and `actualized` (1) zero dimension, while decrementing the 2nd and 3rd digits to deactivate the activity
|
|
30
|
-
return await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, 1_000_001 - 11_000_000_000_000, multi);
|
|
40
|
+
return await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, 1_000_001 - 11_000_000_000_000, this.getDimensionalAddress(activity), multi);
|
|
31
41
|
};
|
|
32
42
|
|
|
33
43
|
static async notarizeReentry(activity: Activity, multi?: RedisMulti): Promise<number> {
|
|
34
44
|
//increment by 1_000_000 (indicates re-entry and is used to drive the 'dimensional address' for adjacent activities (minus 1))
|
|
35
|
-
const amount = await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, 1_000_000, multi);
|
|
45
|
+
const amount = await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, 1_000_000, this.getDimensionalAddress(activity), multi);
|
|
36
46
|
this.verifyInteger(amount, 2, 'enter');
|
|
37
47
|
return amount;
|
|
38
48
|
};
|
|
39
49
|
|
|
40
50
|
static async notarizeContinuation(activity: Activity, multi?: RedisMulti): Promise<number> {
|
|
41
51
|
//keep open; actualize the leg2 dimension (+1)
|
|
42
|
-
return await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, 1, multi);
|
|
52
|
+
return await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, 1, this.getDimensionalAddress(activity), multi);
|
|
43
53
|
};
|
|
44
54
|
|
|
45
55
|
static async notarizeCompletion(activity: Activity, multi?: RedisMulti): Promise<number> {
|
|
46
56
|
//close out; actualize leg2 dimension (+1) and decrement the 3rd digit (-1_000_000_000_000)
|
|
47
|
-
return await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, 1 - 1_000_000_000_000, multi);
|
|
57
|
+
return await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, 1 - 1_000_000_000_000, this.getDimensionalAddress(activity), multi);
|
|
48
58
|
};
|
|
49
59
|
|
|
50
60
|
static getDigitAtIndex(num: number, targetDigitIndex: number): number | null {
|
|
@@ -112,6 +122,21 @@ class CollatorService {
|
|
|
112
122
|
}
|
|
113
123
|
}
|
|
114
124
|
|
|
125
|
+
static getDimensionsById(ancestors: string[], dad: string): Record<string, string> {
|
|
126
|
+
//ancestors is an ordered list of all ancestors, starting with the trigger (['t1', 'a1', 'a2'])
|
|
127
|
+
//dad is the dimensional address of the ancestors list (',0,5,3')
|
|
128
|
+
//loop through the ancestors list and create a map of the ancestor to the dimensional address.
|
|
129
|
+
//return { 't1': ',0', 'a1': ',0,5', 'a1': ',0,5,3', $ADJACENT: ',0,5,3,0' };
|
|
130
|
+
// `adjacent` is a special key that is used to track the dimensional address of adjacent activities
|
|
131
|
+
const map: Record<string, string> = { '$ADJACENT': `${dad},0` };
|
|
132
|
+
let dadStr = dad;
|
|
133
|
+
ancestors.reverse().forEach((ancestor) => {
|
|
134
|
+
map[ancestor] = dadStr;
|
|
135
|
+
dadStr = dadStr.substring(0, dadStr.lastIndexOf(','));
|
|
136
|
+
});
|
|
137
|
+
return map;
|
|
138
|
+
}
|
|
139
|
+
|
|
115
140
|
/**
|
|
116
141
|
* All non-trigger activities are assigned a status seed by their parent
|
|
117
142
|
*/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { KeyStoreParams, KeyType } from
|
|
2
|
-
import { getSymKey } from
|
|
3
|
-
import { CollatorService } from
|
|
4
|
-
import { SerializerService } from
|
|
1
|
+
import { KeyStoreParams, KeyType } from '../../modules/key';
|
|
2
|
+
import { getSymKey } from '../../modules/utils';
|
|
3
|
+
import { CollatorService } from '../collator';
|
|
4
|
+
import { SerializerService } from '../serializer';
|
|
5
5
|
import { StoreService } from '../store';
|
|
6
|
-
import { ActivityType } from
|
|
7
|
-
import { HookRule } from
|
|
8
|
-
import { HotMeshGraph, HotMeshManifest } from
|
|
9
|
-
import { RedisClient, RedisMulti } from
|
|
10
|
-
import { StringAnyType, Symbols } from
|
|
6
|
+
import { ActivityType } from '../../types/activity';
|
|
7
|
+
import { HookRule } from '../../types/hook';
|
|
8
|
+
import { HotMeshGraph, HotMeshManifest } from '../../types/hotmesh';
|
|
9
|
+
import { RedisClient, RedisMulti } from '../../types/redis';
|
|
10
|
+
import { StringAnyType, Symbols } from '../../types/serializer';
|
|
11
11
|
|
|
12
12
|
const DEFAULT_METADATA_RANGE_SIZE = 26; //metadata is 26 slots ([a-z] * 1)
|
|
13
13
|
const DEFAULT_DATA_RANGE_SIZE = 260; //data is 260 slots ([a-zA-Z] * 5)
|
|
@@ -63,6 +63,7 @@ class Deployer {
|
|
|
63
63
|
for (const [activityId, activity] of Object.entries(graph.activities)) {
|
|
64
64
|
const [lower, upper, symbols] = await this.store.reserveSymbolRange(activityId, DEFAULT_RANGE_SIZE, 'ACTIVITY');
|
|
65
65
|
const prefix = `${activityId}/`; //activity meta/data is namespaced
|
|
66
|
+
this.bindSelf(activity.consumes, activity.produces, activityId);
|
|
66
67
|
const newSymbols = this.bindSymbols(lower, upper, symbols, prefix, activity.produces);
|
|
67
68
|
if (Object.keys(newSymbols).length) {
|
|
68
69
|
await this.store.addSymbols(activityId, newSymbols);
|
|
@@ -71,6 +72,20 @@ class Deployer {
|
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
|
|
75
|
+
bindSelf(consumes: Record<string, string[]>, produces: string[], activityId: string) {
|
|
76
|
+
//bind self-referential mappings
|
|
77
|
+
for (const selfId of [activityId, '$self']) {
|
|
78
|
+
const selfConsumes = consumes[selfId];
|
|
79
|
+
if (selfConsumes) {
|
|
80
|
+
for (const path of selfConsumes) {
|
|
81
|
+
if (!produces.includes(path)) {
|
|
82
|
+
produces.push(path);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
74
89
|
bindSymbols(startIndex: number, maxIndex: number, existingSymbols: Symbols, prefix: string, produces: string[]): Symbols {
|
|
75
90
|
let newSymbols: Symbols = {};
|
|
76
91
|
let currentSymbols: Symbols = {...existingSymbols};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
2
2
|
|
|
3
3
|
import { identifyRedisTypeFromClass } from '../../modules/utils';
|
|
4
4
|
import { RedisConnection as IORedisConnection } from '../connector/clients/ioredis';
|
|
@@ -23,14 +23,14 @@ export class ConnectorService {
|
|
|
23
23
|
if (identifyRedisTypeFromClass(Redis) === 'redis') {
|
|
24
24
|
for (let i = 1; i <= 3; i++) {
|
|
25
25
|
instances.push(RedisConnection.connect(
|
|
26
|
-
|
|
26
|
+
uuidv4(),
|
|
27
27
|
Redis as RedisClassType,
|
|
28
28
|
options as RedisClientOptions));
|
|
29
29
|
}
|
|
30
30
|
} else {
|
|
31
31
|
for (let i = 1; i <= 3; i++) {
|
|
32
32
|
instances.push(IORedisConnection.connect(
|
|
33
|
-
|
|
33
|
+
uuidv4(),
|
|
34
34
|
Redis as IORedisClassType,
|
|
35
35
|
options as IORedisClientOptions));
|
|
36
36
|
}
|
|
@@ -12,7 +12,7 @@ Here is an example of how the methods in this file are used:
|
|
|
12
12
|
import { Durable } from '@hotmeshio/hotmesh';
|
|
13
13
|
import Redis from 'ioredis';
|
|
14
14
|
import { example } from './workflows';
|
|
15
|
-
import {
|
|
15
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
16
16
|
|
|
17
17
|
async function run() {
|
|
18
18
|
const connection = await Durable.Connection.connect({
|
|
@@ -31,7 +31,7 @@ async function run() {
|
|
|
31
31
|
args: ['HotMesh'],
|
|
32
32
|
taskQueue: 'hello-world',
|
|
33
33
|
workflowName: 'example',
|
|
34
|
-
workflowId: 'workflow-' +
|
|
34
|
+
workflowId: 'workflow-' + uuidv4(),
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
console.log(`Started workflow ${handle.workflowId}`);
|
|
@@ -7,7 +7,7 @@ Here is an example of how the methods in this file are used:
|
|
|
7
7
|
|
|
8
8
|
import { Durable } from '@hotmeshio/hotmesh';
|
|
9
9
|
import Redis from 'ioredis';
|
|
10
|
-
import {
|
|
10
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
11
11
|
|
|
12
12
|
async function run() {
|
|
13
13
|
const connection = await Durable.Connection.connect({
|
|
@@ -26,7 +26,7 @@ async function run() {
|
|
|
26
26
|
taskQueue: 'hello-world',
|
|
27
27
|
args: ['HotMesh'],
|
|
28
28
|
workflowName: 'example',
|
|
29
|
-
workflowId:
|
|
29
|
+
workflowId: uuidv4(),
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
console.log(`Started workflow ${handle.workflowId}`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JobOutput } from
|
|
2
|
-
import { HotMeshService as HotMesh } from
|
|
1
|
+
import { JobOutput } from '../../types/job';
|
|
2
|
+
import { HotMeshService as HotMesh } from '../hotmesh';
|
|
3
3
|
|
|
4
4
|
export class WorkflowHandleService {
|
|
5
5
|
hotMesh: HotMesh;
|
package/services/engine/index.ts
CHANGED
|
@@ -63,6 +63,7 @@ import {
|
|
|
63
63
|
StreamError,
|
|
64
64
|
StreamRole,
|
|
65
65
|
StreamStatus } from '../../types/stream';
|
|
66
|
+
import { StringStringType } from '../../types';
|
|
66
67
|
|
|
67
68
|
//wait time to see if a job is complete
|
|
68
69
|
const OTT_WAIT_TIME = 1000;
|
|
@@ -408,21 +409,37 @@ class EngineService {
|
|
|
408
409
|
}
|
|
409
410
|
|
|
410
411
|
// ****************** `HOOK` ACTIVITY RE-ENTRY POINT *****************
|
|
411
|
-
async hook(topic: string, data: JobData): Promise<JobStatus | void> {
|
|
412
|
+
async hook(topic: string, data: JobData, dad?: string): Promise<JobStatus | void> {
|
|
412
413
|
const hookRule = await this.storeSignaler.getHookRule(topic);
|
|
414
|
+
const [aid, schema] = await this.getSchema(`.${hookRule.to}`);
|
|
415
|
+
if (!dad) {
|
|
416
|
+
//assume dimensional address is singular (0)
|
|
417
|
+
// for ancestors and self if not provided
|
|
418
|
+
// todo: register
|
|
419
|
+
dad = ',0'.repeat(schema.ancestors.length + 1);
|
|
420
|
+
}
|
|
413
421
|
const streamData: StreamData = {
|
|
414
422
|
type: StreamDataType.WEBHOOK,
|
|
415
|
-
metadata: {
|
|
423
|
+
metadata: {
|
|
424
|
+
//jid is unknown at this point; will be resolved using the data
|
|
425
|
+
aid,
|
|
426
|
+
dad,
|
|
427
|
+
topic
|
|
428
|
+
},
|
|
416
429
|
data,
|
|
417
430
|
};
|
|
418
431
|
await this.streamSignaler.publishMessage(null, streamData);
|
|
419
432
|
}
|
|
420
433
|
async hookTime(jobId: string, activityId: string): Promise<JobStatus | void> {
|
|
434
|
+
//the activityid is concatenated with its dimensional address (dad); split to resolve
|
|
435
|
+
const [aid, ...dimensions] = activityId.split(',');
|
|
436
|
+
const dad = `,${dimensions.join(',')}`;
|
|
421
437
|
const streamData: StreamData = {
|
|
422
438
|
type: StreamDataType.TIMEHOOK,
|
|
423
439
|
metadata: {
|
|
424
440
|
jid: jobId,
|
|
425
|
-
aid
|
|
441
|
+
aid,
|
|
442
|
+
dad,
|
|
426
443
|
},
|
|
427
444
|
data: { timestamp: Date.now() },
|
|
428
445
|
};
|
|
@@ -586,12 +603,13 @@ class EngineService {
|
|
|
586
603
|
// (e.g, if {dimensions:true}, use hscan to deliver
|
|
587
604
|
// the full set of dimensional job data)
|
|
588
605
|
async getState(topic: string, jobId: string): Promise<JobOutput> {
|
|
589
|
-
const { id: appId } = await this.getVID();
|
|
590
606
|
const jobSymbols = await this.store.getSymbols(`$${topic}`);
|
|
591
607
|
const consumes: Consumes = {
|
|
592
608
|
[`$${topic}`]: Object.keys(jobSymbols)
|
|
593
609
|
}
|
|
594
|
-
|
|
610
|
+
//job data exists at the 'zero' dimension; pass an empty object
|
|
611
|
+
const dIds = {} as StringStringType;
|
|
612
|
+
const output = await this.store.getState(jobId, consumes, dIds);
|
|
595
613
|
if (!output) {
|
|
596
614
|
throw new Error(`not found ${jobId}`);
|
|
597
615
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
2
2
|
import { PSNS } from '../../modules/key';
|
|
3
3
|
import { EngineService } from '../engine';
|
|
4
4
|
import { LoggerService, ILogger } from '../logger';
|
|
@@ -53,7 +53,7 @@ class HotMeshService {
|
|
|
53
53
|
|
|
54
54
|
static async init(config: HotMeshConfig) {
|
|
55
55
|
const instance = new HotMeshService();
|
|
56
|
-
instance.guid =
|
|
56
|
+
instance.guid = uuidv4();
|
|
57
57
|
instance.verifyAndSetNamespace(config.namespace);
|
|
58
58
|
instance.verifyAndSetAppId(config.appId);
|
|
59
59
|
instance.logger = new LoggerService(config.appId, instance.guid, config.name || '', config.logLevel);
|
|
@@ -161,9 +161,9 @@ class HotMeshService {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
// ****** `HOOK` ACTIVITY RE-ENTRY POINT ******
|
|
164
|
-
async hook(topic: string, data: JobData): Promise<JobStatus | void> {
|
|
164
|
+
async hook(topic: string, data: JobData, dad?: string): Promise<JobStatus | void> {
|
|
165
165
|
//return collation int
|
|
166
|
-
return await this.engine?.hook(topic, data);
|
|
166
|
+
return await this.engine?.hook(topic, data, dad);
|
|
167
167
|
}
|
|
168
168
|
async hookAll(hookTopic: string, data: JobData, query: JobStatsInput, queryFacets: string[] = []): Promise<string[]> {
|
|
169
169
|
return await this.engine?.hookAll(hookTopic, data, query, queryFacets);
|
package/services/mapper/index.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { StreamCode, StreamStatus } from "../../types";
|
|
1
|
+
import { Pipe } from '../pipe';
|
|
2
|
+
import { JobState } from '../../types/job';
|
|
3
|
+
import { Pipe as PipeType } from '../../types/pipe';
|
|
4
|
+
import { TransitionMatch, TransitionRule } from '../../types/transition';
|
|
5
|
+
import { StreamCode } from '../../types';
|
|
7
6
|
|
|
8
7
|
type RuleType = null | undefined | boolean | string | number | Date | Record<string, any>;
|
|
9
8
|
|
|
@@ -80,5 +79,4 @@ class MapperService {
|
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
export { MapperService }
|
|
82
|
+
export { MapperService }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getSymVal } from '../../modules/utils';
|
|
2
|
+
import { Consumes } from '../../types/activity';
|
|
2
3
|
import {
|
|
3
4
|
StringStringType,
|
|
4
5
|
StringAnyType,
|
|
@@ -26,16 +27,53 @@ export const MDATA_SYMBOLS = {
|
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
export class SerializerService {
|
|
30
|
+
dIds: StringStringType;
|
|
29
31
|
symKeys: SymbolMaps;
|
|
30
32
|
symReverseKeys: SymbolMaps;
|
|
31
33
|
symValMaps: SymbolMap;
|
|
32
34
|
symValReverseMaps: SymbolMap;
|
|
33
35
|
|
|
34
36
|
constructor() {
|
|
35
|
-
this.resetSymbols({}, {});
|
|
37
|
+
this.resetSymbols({}, {}, {});
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
abbreviate(consumes: Consumes, symbolNames: string[], fields: string[] = []): string[] {
|
|
41
|
+
for (const symbolName of symbolNames) {
|
|
42
|
+
const symbolSet = this.symKeys.get(symbolName);
|
|
43
|
+
const symbolPaths = consumes[symbolName];
|
|
44
|
+
for (const symbolPath of symbolPaths) {
|
|
45
|
+
const abbreviation = symbolSet.get(symbolPath);
|
|
46
|
+
if (abbreviation) {
|
|
47
|
+
const dimensionalIndex = this.resolveDimensionalIndex(symbolPath);
|
|
48
|
+
fields.push(`${abbreviation}${dimensionalIndex}`);
|
|
49
|
+
} else {
|
|
50
|
+
fields.push(symbolPath);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return fields;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
resolveDimensionalIndex(path: string): string {
|
|
58
|
+
if (this.isJobPath(path)) {
|
|
59
|
+
return '';
|
|
60
|
+
} else {
|
|
61
|
+
const [activityId] = path.split('/');
|
|
62
|
+
if (activityId in this.dIds) {
|
|
63
|
+
return this.dIds[activityId];
|
|
64
|
+
} else if ('$ADJACENT' in this.dIds) {
|
|
65
|
+
//else=> pre-authorizing adjacent activity entry
|
|
66
|
+
return this.dIds['$ADJACENT'];
|
|
67
|
+
}
|
|
68
|
+
return ',0';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
isJobPath(path: string): boolean {
|
|
73
|
+
return path.startsWith('data/') || path.startsWith('metadata/');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
resetSymbols(symKeys: SymbolSets, symVals: Symbols, dIds: StringStringType): void {
|
|
39
77
|
this.symKeys = new Map();
|
|
40
78
|
this.symReverseKeys = new Map();
|
|
41
79
|
for (const id in symKeys) {
|
|
@@ -43,6 +81,7 @@ export class SerializerService {
|
|
|
43
81
|
}
|
|
44
82
|
this.symValMaps = new Map(Object.entries(symVals));
|
|
45
83
|
this.symValReverseMaps = this.getReverseValueMap(this.symValMaps);
|
|
84
|
+
this.dIds = dIds;
|
|
46
85
|
}
|
|
47
86
|
|
|
48
87
|
getReverseKeyMap(keyMap: SymbolMap, id?: string): SymbolMap {
|
|
@@ -87,25 +126,23 @@ export class SerializerService {
|
|
|
87
126
|
if (this.symKeys.size === 0) {
|
|
88
127
|
return document;
|
|
89
128
|
}
|
|
90
|
-
let
|
|
129
|
+
let source: StringStringType = { ...document };
|
|
130
|
+
let result: StringStringType = { };
|
|
91
131
|
|
|
92
|
-
const compressWithMap = (abbreviationMap: SymbolMap) => {
|
|
93
|
-
for (let key in
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
result[
|
|
99
|
-
if (safeKey !== key) {
|
|
100
|
-
delete result[key];
|
|
132
|
+
const compressWithMap = (abbreviationMap: SymbolMap, id: string) => {
|
|
133
|
+
for (let key in source) {
|
|
134
|
+
if (key.startsWith(`${id}/`) || (id.startsWith('$') && ['data', 'metadata'].includes(key.split('/')[0]))) {
|
|
135
|
+
const dimensionalIndex = this.resolveDimensionalIndex(key);
|
|
136
|
+
let shortKey = abbreviationMap.get(key) || key;
|
|
137
|
+
const shortDimensionalKey = `${shortKey}${dimensionalIndex}`;
|
|
138
|
+
result[shortDimensionalKey] = source[key];
|
|
101
139
|
}
|
|
102
|
-
}
|
|
103
140
|
}
|
|
104
141
|
};
|
|
105
142
|
for (let id of ids) {
|
|
106
143
|
const abbreviationMap = this.symKeys.get(id);
|
|
107
144
|
if (abbreviationMap) {
|
|
108
|
-
compressWithMap(abbreviationMap);
|
|
145
|
+
compressWithMap(abbreviationMap, id);
|
|
109
146
|
}
|
|
110
147
|
}
|
|
111
148
|
return result;
|
|
@@ -120,14 +157,12 @@ export class SerializerService {
|
|
|
120
157
|
const inflateWithMap = (abbreviationMap: SymbolMap, id: string) => {
|
|
121
158
|
const reversedAbbreviationMap = this.getReverseKeyMap(abbreviationMap, id);
|
|
122
159
|
for (let key in result) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
let
|
|
126
|
-
if (
|
|
127
|
-
result[
|
|
128
|
-
|
|
129
|
-
delete result[key];
|
|
130
|
-
}
|
|
160
|
+
//strip dimensional index from key
|
|
161
|
+
const shortKey = key.split(',')[0];
|
|
162
|
+
let longKey = reversedAbbreviationMap.get(shortKey);
|
|
163
|
+
if (longKey) {
|
|
164
|
+
result[longKey] = result[key];
|
|
165
|
+
delete result[key];
|
|
131
166
|
}
|
|
132
167
|
}
|
|
133
168
|
};
|
package/services/store/index.ts
CHANGED
|
@@ -175,9 +175,9 @@ abstract class StoreService<T, U extends AbstractRedisClient> {
|
|
|
175
175
|
if (settings) {
|
|
176
176
|
return settings;
|
|
177
177
|
} else {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
const version: string = packageJson.
|
|
178
|
+
if (bCreate) {
|
|
179
|
+
const packageJson = await import('../../package.json');
|
|
180
|
+
const version: string = packageJson['version'] || '0.0.0';
|
|
181
181
|
settings = { namespace: PSNS, version } as HotMeshSettings;
|
|
182
182
|
await this.setSettings(settings);
|
|
183
183
|
return settings;
|
|
@@ -452,12 +452,12 @@ abstract class StoreService<T, U extends AbstractRedisClient> {
|
|
|
452
452
|
return Number(status);
|
|
453
453
|
}
|
|
454
454
|
|
|
455
|
-
async setState({ ...state }: StringAnyType, status: number | null, jobId: string,
|
|
455
|
+
async setState({ ...state }: StringAnyType, status: number | null, jobId: string, symbolNames: string[], dIds: StringStringType, multi? : U): Promise<string> {
|
|
456
456
|
delete state['metadata/js'];
|
|
457
|
-
const hashKey = this.mintKey(KeyType.JOB_STATE, { appId, jobId });
|
|
457
|
+
const hashKey = this.mintKey(KeyType.JOB_STATE, { appId: this.appId, jobId });
|
|
458
458
|
const symKeys = await this.getSymbolKeys(symbolNames);
|
|
459
459
|
const symVals = await this.getSymbolValues();
|
|
460
|
-
this.serializer.resetSymbols(symKeys, symVals);
|
|
460
|
+
this.serializer.resetSymbols(symKeys, symVals, dIds);
|
|
461
461
|
|
|
462
462
|
const hashData = this.serializer.package(state, symbolNames);
|
|
463
463
|
if (status !== null) {
|
|
@@ -469,26 +469,14 @@ abstract class StoreService<T, U extends AbstractRedisClient> {
|
|
|
469
469
|
return jobId;
|
|
470
470
|
}
|
|
471
471
|
|
|
472
|
-
async getState(jobId: string, consumes: Consumes): Promise<[StringAnyType, number] | undefined> {
|
|
473
|
-
//
|
|
472
|
+
async getState(jobId: string, consumes: Consumes, dIds: StringStringType): Promise<[StringAnyType, number] | undefined> {
|
|
473
|
+
//get abbreviated field list (the symbols for the paths)
|
|
474
474
|
const key = this.mintKey(KeyType.JOB_STATE, { appId: this.appId, jobId });
|
|
475
475
|
const symbolNames = Object.keys(consumes);
|
|
476
476
|
const symKeys = await this.getSymbolKeys(symbolNames);
|
|
477
|
+
this.serializer.resetSymbols(symKeys, {}, dIds);
|
|
478
|
+
const fields = this.serializer.abbreviate(consumes, symbolNames, [':']);
|
|
477
479
|
|
|
478
|
-
//always fetch the job status (':') when fetching state
|
|
479
|
-
const fields = [':'];
|
|
480
|
-
for (const symbolName of symbolNames) {
|
|
481
|
-
const symbolSet = symKeys[symbolName];
|
|
482
|
-
const symbolPaths = consumes[symbolName];
|
|
483
|
-
for (const symbolPath of symbolPaths) {
|
|
484
|
-
const abbreviation = symbolSet[symbolPath];
|
|
485
|
-
if (abbreviation) {
|
|
486
|
-
fields.push(abbreviation);
|
|
487
|
-
} else {
|
|
488
|
-
fields.push(symbolPath);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
480
|
const jobDataArray = await this.redisClient[this.commands.hmget](key, fields);
|
|
493
481
|
const jobData: StringAnyType = {};
|
|
494
482
|
let atLeast1 = false; //if status field (':') isn't present assume 404
|
|
@@ -500,7 +488,7 @@ abstract class StoreService<T, U extends AbstractRedisClient> {
|
|
|
500
488
|
});
|
|
501
489
|
if (atLeast1) {
|
|
502
490
|
const symVals = await this.getSymbolValues();
|
|
503
|
-
this.serializer.resetSymbols(symKeys, symVals);
|
|
491
|
+
this.serializer.resetSymbols(symKeys, symVals, dIds);
|
|
504
492
|
const state = this.serializer.unpackage(jobData, symbolNames);
|
|
505
493
|
let status = 0;
|
|
506
494
|
if (state[':']) {
|
|
@@ -512,13 +500,13 @@ abstract class StoreService<T, U extends AbstractRedisClient> {
|
|
|
512
500
|
}
|
|
513
501
|
}
|
|
514
502
|
|
|
515
|
-
async collate(jobId: string, activityId: string, amount: number, multi? : U): Promise<number> {
|
|
503
|
+
async collate(jobId: string, activityId: string, amount: number, dIds: StringStringType, multi? : U): Promise<number> {
|
|
516
504
|
const jobKey = this.mintKey(KeyType.JOB_STATE, { appId: this.appId, jobId });
|
|
517
505
|
const collationKey = `${activityId}/output/metadata/as`; //activity state
|
|
518
506
|
const symbolNames = [activityId];
|
|
519
507
|
const symKeys = await this.getSymbolKeys(symbolNames);
|
|
520
508
|
const symVals = await this.getSymbolValues();
|
|
521
|
-
this.serializer.resetSymbols(symKeys, symVals);
|
|
509
|
+
this.serializer.resetSymbols(symKeys, symVals, dIds);
|
|
522
510
|
|
|
523
511
|
const payload = { [collationKey]: amount.toString() }
|
|
524
512
|
const hashData = this.serializer.package(payload, symbolNames);
|
package/types/activity.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|