@proompteng/temporal-bun-sdk 0.1.0
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 +387 -0
- package/dist/bin/start-worker.js +3 -0
- package/dist/bin/temporal-bun.js +3 -0
- package/dist/src/activities/index.d.ts +6 -0
- package/dist/src/activities/index.d.ts.map +1 -0
- package/dist/src/activities/index.js +5 -0
- package/dist/src/activities/index.js.map +1 -0
- package/dist/src/activities/lifecycle.d.ts +48 -0
- package/dist/src/activities/lifecycle.d.ts.map +1 -0
- package/dist/src/activities/lifecycle.js +306 -0
- package/dist/src/activities/lifecycle.js.map +1 -0
- package/dist/src/bin/replay-command.d.ts +104 -0
- package/dist/src/bin/replay-command.d.ts.map +1 -0
- package/dist/src/bin/replay-command.js +582 -0
- package/dist/src/bin/replay-command.js.map +1 -0
- package/dist/src/bin/start-worker.d.ts +3 -0
- package/dist/src/bin/start-worker.d.ts.map +1 -0
- package/dist/src/bin/start-worker.js +29 -0
- package/dist/src/bin/start-worker.js.map +1 -0
- package/dist/src/bin/temporal-bun.d.ts +25 -0
- package/dist/src/bin/temporal-bun.d.ts.map +1 -0
- package/dist/src/bin/temporal-bun.js +427 -0
- package/dist/src/bin/temporal-bun.js.map +1 -0
- package/dist/src/build_id_preflight.d.ts +7 -0
- package/dist/src/build_id_preflight.d.ts.map +1 -0
- package/dist/src/build_id_preflight.js +123 -0
- package/dist/src/build_id_preflight.js.map +1 -0
- package/dist/src/client/headers.d.ts +4 -0
- package/dist/src/client/headers.d.ts.map +1 -0
- package/dist/src/client/headers.js +79 -0
- package/dist/src/client/headers.js.map +1 -0
- package/dist/src/client/index.d.ts +2 -0
- package/dist/src/client/index.d.ts.map +1 -0
- package/dist/src/client/index.js +2 -0
- package/dist/src/client/index.js.map +1 -0
- package/dist/src/client/interceptors.d.ts +17 -0
- package/dist/src/client/interceptors.d.ts.map +1 -0
- package/dist/src/client/interceptors.js +71 -0
- package/dist/src/client/interceptors.js.map +1 -0
- package/dist/src/client/layer.d.ts +10 -0
- package/dist/src/client/layer.d.ts.map +1 -0
- package/dist/src/client/layer.js +7 -0
- package/dist/src/client/layer.js.map +1 -0
- package/dist/src/client/retries.d.ts +13 -0
- package/dist/src/client/retries.d.ts.map +1 -0
- package/dist/src/client/retries.js +51 -0
- package/dist/src/client/retries.js.map +1 -0
- package/dist/src/client/serialization.d.ts +48 -0
- package/dist/src/client/serialization.d.ts.map +1 -0
- package/dist/src/client/serialization.js +310 -0
- package/dist/src/client/serialization.js.map +1 -0
- package/dist/src/client/serialization.test.d.ts +2 -0
- package/dist/src/client/serialization.test.d.ts.map +1 -0
- package/dist/src/client/serialization.test.js +251 -0
- package/dist/src/client/serialization.test.js.map +1 -0
- package/dist/src/client/transport.d.ts +12 -0
- package/dist/src/client/transport.d.ts.map +1 -0
- package/dist/src/client/transport.js +36 -0
- package/dist/src/client/transport.js.map +1 -0
- package/dist/src/client/types.d.ts +51 -0
- package/dist/src/client/types.d.ts.map +1 -0
- package/dist/src/client/types.js +7 -0
- package/dist/src/client/types.js.map +1 -0
- package/dist/src/client.d.ts +92 -0
- package/dist/src/client.d.ts.map +1 -0
- package/dist/src/client.js +666 -0
- package/dist/src/client.js.map +1 -0
- package/dist/src/common/duration.d.ts +4 -0
- package/dist/src/common/duration.d.ts.map +1 -0
- package/dist/src/common/duration.js +14 -0
- package/dist/src/common/duration.js.map +1 -0
- package/dist/src/common/index.d.ts +2 -0
- package/dist/src/common/index.d.ts.map +1 -0
- package/dist/src/common/index.js +2 -0
- package/dist/src/common/index.js.map +1 -0
- package/dist/src/common/payloads/converter.d.ts +16 -0
- package/dist/src/common/payloads/converter.d.ts.map +1 -0
- package/dist/src/common/payloads/converter.js +33 -0
- package/dist/src/common/payloads/converter.js.map +1 -0
- package/dist/src/common/payloads/failure.d.ts +7 -0
- package/dist/src/common/payloads/failure.d.ts.map +1 -0
- package/dist/src/common/payloads/failure.js +53 -0
- package/dist/src/common/payloads/failure.js.map +1 -0
- package/dist/src/common/payloads/index.d.ts +4 -0
- package/dist/src/common/payloads/index.d.ts.map +1 -0
- package/dist/src/common/payloads/index.js +4 -0
- package/dist/src/common/payloads/index.js.map +1 -0
- package/dist/src/common/payloads/json-codec.d.ts +16 -0
- package/dist/src/common/payloads/json-codec.d.ts.map +1 -0
- package/dist/src/common/payloads/json-codec.js +185 -0
- package/dist/src/common/payloads/json-codec.js.map +1 -0
- package/dist/src/common/sleep.d.ts +2 -0
- package/dist/src/common/sleep.d.ts.map +1 -0
- package/dist/src/common/sleep.js +3 -0
- package/dist/src/common/sleep.js.map +1 -0
- package/dist/src/config.d.ts +115 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +505 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/core-bridge/client.d.ts +36 -0
- package/dist/src/core-bridge/client.d.ts.map +1 -0
- package/dist/src/core-bridge/client.js +111 -0
- package/dist/src/core-bridge/client.js.map +1 -0
- package/dist/src/core-bridge/index.d.ts +4 -0
- package/dist/src/core-bridge/index.d.ts.map +1 -0
- package/dist/src/core-bridge/index.js +4 -0
- package/dist/src/core-bridge/index.js.map +1 -0
- package/dist/src/core-bridge/runtime.d.ts +20 -0
- package/dist/src/core-bridge/runtime.d.ts.map +1 -0
- package/dist/src/core-bridge/runtime.js +62 -0
- package/dist/src/core-bridge/runtime.js.map +1 -0
- package/dist/src/core-bridge/runtime.test.d.ts +2 -0
- package/dist/src/core-bridge/runtime.test.d.ts.map +1 -0
- package/dist/src/core-bridge/runtime.test.js +68 -0
- package/dist/src/core-bridge/runtime.test.js.map +1 -0
- package/dist/src/index.d.ts +11 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +7 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/internal/core-bridge/native.d.ts +176 -0
- package/dist/src/internal/core-bridge/native.d.ts.map +1 -0
- package/dist/src/internal/core-bridge/native.js +1208 -0
- package/dist/src/internal/core-bridge/native.js.map +1 -0
- package/dist/src/observability/index.d.ts +21 -0
- package/dist/src/observability/index.d.ts.map +1 -0
- package/dist/src/observability/index.js +19 -0
- package/dist/src/observability/index.js.map +1 -0
- package/dist/src/observability/logger.d.ts +28 -0
- package/dist/src/observability/logger.d.ts.map +1 -0
- package/dist/src/observability/logger.js +53 -0
- package/dist/src/observability/logger.js.map +1 -0
- package/dist/src/observability/metrics.d.ts +28 -0
- package/dist/src/observability/metrics.d.ts.map +1 -0
- package/dist/src/observability/metrics.js +355 -0
- package/dist/src/observability/metrics.js.map +1 -0
- package/dist/src/proto/google/api/annotations_pb.d.ts +14 -0
- package/dist/src/proto/google/api/annotations_pb.d.ts.map +1 -0
- package/dist/src/proto/google/api/annotations_pb.js +27 -0
- package/dist/src/proto/google/api/annotations_pb.js.map +1 -0
- package/dist/src/proto/google/api/http_pb.d.ts +441 -0
- package/dist/src/proto/google/api/http_pb.d.ts.map +1 -0
- package/dist/src/proto/google/api/http_pb.js +34 -0
- package/dist/src/proto/google/api/http_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/activity/v1/message_pb.d.ts +67 -0
- package/dist/src/proto/temporal/api/activity/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/activity/v1/message_pb.js +17 -0
- package/dist/src/proto/temporal/api/activity/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/batch/v1/message_pb.d.ts +464 -0
- package/dist/src/proto/temporal/api/batch/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/batch/v1/message_pb.js +71 -0
- package/dist/src/proto/temporal/api/batch/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/command/v1/message_pb.d.ts +796 -0
- package/dist/src/proto/temporal/api/command/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/command/v1/message_pb.js +106 -0
- package/dist/src/proto/temporal/api/command/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/common/v1/message_pb.d.ts +751 -0
- package/dist/src/proto/temporal/api/common/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/common/v1/message_pb.js +133 -0
- package/dist/src/proto/temporal/api/common/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/deployment/v1/message_pb.d.ts +639 -0
- package/dist/src/proto/temporal/api/deployment/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/deployment/v1/message_pb.js +83 -0
- package/dist/src/proto/temporal/api/deployment/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/batch_operation_pb.d.ts +80 -0
- package/dist/src/proto/temporal/api/enums/v1/batch_operation_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/batch_operation_pb.js +85 -0
- package/dist/src/proto/temporal/api/enums/v1/batch_operation_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/command_type_pb.d.ts +89 -0
- package/dist/src/proto/temporal/api/enums/v1/command_type_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/command_type_pb.js +93 -0
- package/dist/src/proto/temporal/api/enums/v1/command_type_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/common_pb.d.ts +314 -0
- package/dist/src/proto/temporal/api/enums/v1/common_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/common_pb.js +326 -0
- package/dist/src/proto/temporal/api/enums/v1/common_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/deployment_pb.d.ts +186 -0
- package/dist/src/proto/temporal/api/enums/v1/deployment_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/deployment_pb.js +193 -0
- package/dist/src/proto/temporal/api/enums/v1/deployment_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/event_type_pb.d.ts +407 -0
- package/dist/src/proto/temporal/api/enums/v1/event_type_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/event_type_pb.js +411 -0
- package/dist/src/proto/temporal/api/enums/v1/event_type_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/failed_cause_pb.d.ts +371 -0
- package/dist/src/proto/temporal/api/enums/v1/failed_cause_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/failed_cause_pb.js +380 -0
- package/dist/src/proto/temporal/api/enums/v1/failed_cause_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/namespace_pb.d.ts +73 -0
- package/dist/src/proto/temporal/api/enums/v1/namespace_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/namespace_pb.js +79 -0
- package/dist/src/proto/temporal/api/enums/v1/namespace_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/nexus_pb.d.ts +35 -0
- package/dist/src/proto/temporal/api/enums/v1/nexus_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/nexus_pb.js +39 -0
- package/dist/src/proto/temporal/api/enums/v1/nexus_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/query_pb.d.ts +58 -0
- package/dist/src/proto/temporal/api/enums/v1/query_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/query_pb.js +63 -0
- package/dist/src/proto/temporal/api/enums/v1/query_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/reset_pb.d.ts +108 -0
- package/dist/src/proto/temporal/api/enums/v1/reset_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/reset_pb.js +114 -0
- package/dist/src/proto/temporal/api/enums/v1/reset_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/schedule_pb.d.ts +67 -0
- package/dist/src/proto/temporal/api/enums/v1/schedule_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/schedule_pb.js +71 -0
- package/dist/src/proto/temporal/api/enums/v1/schedule_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/task_queue_pb.d.ts +249 -0
- package/dist/src/proto/temporal/api/enums/v1/task_queue_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/task_queue_pb.js +259 -0
- package/dist/src/proto/temporal/api/enums/v1/task_queue_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/update_pb.d.ts +78 -0
- package/dist/src/proto/temporal/api/enums/v1/update_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/update_pb.js +83 -0
- package/dist/src/proto/temporal/api/enums/v1/update_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/workflow_pb.d.ts +408 -0
- package/dist/src/proto/temporal/api/enums/v1/workflow_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/enums/v1/workflow_pb.js +422 -0
- package/dist/src/proto/temporal/api/enums/v1/workflow_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/errordetails/v1/message_pb.d.ts +331 -0
- package/dist/src/proto/temporal/api/errordetails/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/errordetails/v1/message_pb.js +104 -0
- package/dist/src/proto/temporal/api/errordetails/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/export/v1/message_pb.d.ts +39 -0
- package/dist/src/proto/temporal/api/export/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/export/v1/message_pb.js +20 -0
- package/dist/src/proto/temporal/api/export/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/failure/v1/message_pb.d.ts +381 -0
- package/dist/src/proto/temporal/api/failure/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/failure/v1/message_pb.js +74 -0
- package/dist/src/proto/temporal/api/failure/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/filter/v1/message_pb.d.ts +73 -0
- package/dist/src/proto/temporal/api/filter/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/filter/v1/message_pb.js +31 -0
- package/dist/src/proto/temporal/api/filter/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/history/v1/message_pb.d.ts +3136 -0
- package/dist/src/proto/temporal/api/history/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/history/v1/message_pb.js +317 -0
- package/dist/src/proto/temporal/api/history/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/namespace/v1/message_pb.d.ts +242 -0
- package/dist/src/proto/temporal/api/namespace/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/namespace/v1/message_pb.js +46 -0
- package/dist/src/proto/temporal/api/namespace/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/nexus/v1/message_pb.d.ts +549 -0
- package/dist/src/proto/temporal/api/nexus/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/nexus/v1/message_pb.js +97 -0
- package/dist/src/proto/temporal/api/nexus/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/operatorservice/v1/request_response_pb.d.ts +499 -0
- package/dist/src/proto/temporal/api/operatorservice/v1/request_response_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/operatorservice/v1/request_response_pb.js +137 -0
- package/dist/src/proto/temporal/api/operatorservice/v1/request_response_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/operatorservice/v1/service_pb.d.ts +153 -0
- package/dist/src/proto/temporal/api/operatorservice/v1/service_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/operatorservice/v1/service_pb.js +22 -0
- package/dist/src/proto/temporal/api/operatorservice/v1/service_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/protocol/v1/message_pb.d.ts +64 -0
- package/dist/src/proto/temporal/api/protocol/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/protocol/v1/message_pb.js +15 -0
- package/dist/src/proto/temporal/api/protocol/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/query/v1/message_pb.d.ts +96 -0
- package/dist/src/proto/temporal/api/query/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/query/v1/message_pb.js +28 -0
- package/dist/src/proto/temporal/api/query/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/replication/v1/message_pb.d.ts +67 -0
- package/dist/src/proto/temporal/api/replication/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/replication/v1/message_pb.js +26 -0
- package/dist/src/proto/temporal/api/replication/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/rules/v1/message_pb.d.ts +172 -0
- package/dist/src/proto/temporal/api/rules/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/rules/v1/message_pb.js +35 -0
- package/dist/src/proto/temporal/api/rules/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/schedule/v1/message_pb.d.ts +779 -0
- package/dist/src/proto/temporal/api/schedule/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/schedule/v1/message_pb.js +95 -0
- package/dist/src/proto/temporal/api/schedule/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/sdk/v1/enhanced_stack_trace_pb.d.ts +157 -0
- package/dist/src/proto/temporal/api/sdk/v1/enhanced_stack_trace_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/sdk/v1/enhanced_stack_trace_pb.js +34 -0
- package/dist/src/proto/temporal/api/sdk/v1/enhanced_stack_trace_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/sdk/v1/task_complete_metadata_pb.d.ts +71 -0
- package/dist/src/proto/temporal/api/sdk/v1/task_complete_metadata_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/sdk/v1/task_complete_metadata_pb.js +14 -0
- package/dist/src/proto/temporal/api/sdk/v1/task_complete_metadata_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/sdk/v1/user_metadata_pb.d.ts +37 -0
- package/dist/src/proto/temporal/api/sdk/v1/user_metadata_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/sdk/v1/user_metadata_pb.js +15 -0
- package/dist/src/proto/temporal/api/sdk/v1/user_metadata_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/sdk/v1/worker_config_pb.d.ts +84 -0
- package/dist/src/proto/temporal/api/sdk/v1/worker_config_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/sdk/v1/worker_config_pb.js +24 -0
- package/dist/src/proto/temporal/api/sdk/v1/worker_config_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/sdk/v1/workflow_metadata_pb.d.ts +99 -0
- package/dist/src/proto/temporal/api/sdk/v1/workflow_metadata_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/sdk/v1/workflow_metadata_pb.js +24 -0
- package/dist/src/proto/temporal/api/sdk/v1/workflow_metadata_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/taskqueue/v1/message_pb.d.ts +757 -0
- package/dist/src/proto/temporal/api/taskqueue/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/taskqueue/v1/message_pb.js +138 -0
- package/dist/src/proto/temporal/api/taskqueue/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/update/v1/message_pb.d.ts +230 -0
- package/dist/src/proto/temporal/api/update/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/update/v1/message_pb.js +57 -0
- package/dist/src/proto/temporal/api/update/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/version/v1/message_pb.d.ts +85 -0
- package/dist/src/proto/temporal/api/version/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/version/v1/message_pb.js +26 -0
- package/dist/src/proto/temporal/api/version/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/worker/v1/message_pb.d.ts +311 -0
- package/dist/src/proto/temporal/api/worker/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/worker/v1/message_pb.js +42 -0
- package/dist/src/proto/temporal/api/worker/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/workflow/v1/message_pb.d.ts +1500 -0
- package/dist/src/proto/temporal/api/workflow/v1/message_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/workflow/v1/message_pb.js +183 -0
- package/dist/src/proto/temporal/api/workflow/v1/message_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/workflowservice/v1/request_response_pb.d.ts +6967 -0
- package/dist/src/proto/temporal/api/workflowservice/v1/request_response_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/workflowservice/v1/request_response_pb.js +1073 -0
- package/dist/src/proto/temporal/api/workflowservice/v1/request_response_pb.js.map +1 -0
- package/dist/src/proto/temporal/api/workflowservice/v1/service_pb.d.ts +1305 -0
- package/dist/src/proto/temporal/api/workflowservice/v1/service_pb.d.ts.map +1 -0
- package/dist/src/proto/temporal/api/workflowservice/v1/service_pb.js +27 -0
- package/dist/src/proto/temporal/api/workflowservice/v1/service_pb.js.map +1 -0
- package/dist/src/runtime/cli-layer.d.ts +12 -0
- package/dist/src/runtime/cli-layer.d.ts.map +1 -0
- package/dist/src/runtime/cli-layer.js +19 -0
- package/dist/src/runtime/cli-layer.js.map +1 -0
- package/dist/src/runtime/config-layer.d.ts +9 -0
- package/dist/src/runtime/config-layer.d.ts.map +1 -0
- package/dist/src/runtime/config-layer.js +15 -0
- package/dist/src/runtime/config-layer.js.map +1 -0
- package/dist/src/runtime/effect-layers.d.ts +518 -0
- package/dist/src/runtime/effect-layers.d.ts.map +1 -0
- package/dist/src/runtime/effect-layers.js +68 -0
- package/dist/src/runtime/effect-layers.js.map +1 -0
- package/dist/src/runtime/worker-app.d.ts +14 -0
- package/dist/src/runtime/worker-app.d.ts.map +1 -0
- package/dist/src/runtime/worker-app.js +58 -0
- package/dist/src/runtime/worker-app.js.map +1 -0
- package/dist/src/telemetry/runtime.d.ts +5 -0
- package/dist/src/telemetry/runtime.d.ts.map +1 -0
- package/dist/src/telemetry/runtime.js +94 -0
- package/dist/src/telemetry/runtime.js.map +1 -0
- package/dist/src/worker/activity-context.d.ts +30 -0
- package/dist/src/worker/activity-context.d.ts.map +1 -0
- package/dist/src/worker/activity-context.js +9 -0
- package/dist/src/worker/activity-context.js.map +1 -0
- package/dist/src/worker/build-id.d.ts +20 -0
- package/dist/src/worker/build-id.d.ts.map +1 -0
- package/dist/src/worker/build-id.js +98 -0
- package/dist/src/worker/build-id.js.map +1 -0
- package/dist/src/worker/concurrency.d.ts +31 -0
- package/dist/src/worker/concurrency.d.ts.map +1 -0
- package/dist/src/worker/concurrency.js +129 -0
- package/dist/src/worker/concurrency.js.map +1 -0
- package/dist/src/worker/defaults.d.ts +9 -0
- package/dist/src/worker/defaults.d.ts.map +1 -0
- package/dist/src/worker/defaults.js +53 -0
- package/dist/src/worker/defaults.js.map +1 -0
- package/dist/src/worker/index.d.ts +7 -0
- package/dist/src/worker/index.d.ts.map +1 -0
- package/dist/src/worker/index.js +4 -0
- package/dist/src/worker/index.js.map +1 -0
- package/dist/src/worker/layer.d.ts +19 -0
- package/dist/src/worker/layer.d.ts.map +1 -0
- package/dist/src/worker/layer.js +71 -0
- package/dist/src/worker/layer.js.map +1 -0
- package/dist/src/worker/runtime.d.ts +59 -0
- package/dist/src/worker/runtime.d.ts.map +1 -0
- package/dist/src/worker/runtime.js +1415 -0
- package/dist/src/worker/runtime.js.map +1 -0
- package/dist/src/worker/service.d.ts +19 -0
- package/dist/src/worker/service.d.ts.map +1 -0
- package/dist/src/worker/service.js +14 -0
- package/dist/src/worker/service.js.map +1 -0
- package/dist/src/worker/sticky-cache.d.ts +41 -0
- package/dist/src/worker/sticky-cache.d.ts.map +1 -0
- package/dist/src/worker/sticky-cache.js +127 -0
- package/dist/src/worker/sticky-cache.js.map +1 -0
- package/dist/src/worker.d.ts +30 -0
- package/dist/src/worker.d.ts.map +1 -0
- package/dist/src/worker.js +82 -0
- package/dist/src/worker.js.map +1 -0
- package/dist/src/workflow/commands.d.ts +84 -0
- package/dist/src/workflow/commands.d.ts.map +1 -0
- package/dist/src/workflow/commands.js +159 -0
- package/dist/src/workflow/commands.js.map +1 -0
- package/dist/src/workflow/context.d.ts +119 -0
- package/dist/src/workflow/context.d.ts.map +1 -0
- package/dist/src/workflow/context.js +197 -0
- package/dist/src/workflow/context.js.map +1 -0
- package/dist/src/workflow/definition.d.ts +15 -0
- package/dist/src/workflow/definition.d.ts.map +1 -0
- package/dist/src/workflow/definition.js +19 -0
- package/dist/src/workflow/definition.js.map +1 -0
- package/dist/src/workflow/determinism.d.ts +54 -0
- package/dist/src/workflow/determinism.d.ts.map +1 -0
- package/dist/src/workflow/determinism.js +147 -0
- package/dist/src/workflow/determinism.js.map +1 -0
- package/dist/src/workflow/errors.d.ts +37 -0
- package/dist/src/workflow/errors.d.ts.map +1 -0
- package/dist/src/workflow/errors.js +35 -0
- package/dist/src/workflow/errors.js.map +1 -0
- package/dist/src/workflow/executor.d.ts +35 -0
- package/dist/src/workflow/executor.d.ts.map +1 -0
- package/dist/src/workflow/executor.js +178 -0
- package/dist/src/workflow/executor.js.map +1 -0
- package/dist/src/workflow/index.d.ts +8 -0
- package/dist/src/workflow/index.d.ts.map +1 -0
- package/dist/src/workflow/index.js +8 -0
- package/dist/src/workflow/index.js.map +1 -0
- package/dist/src/workflow/registry.d.ts +9 -0
- package/dist/src/workflow/registry.d.ts.map +1 -0
- package/dist/src/workflow/registry.js +51 -0
- package/dist/src/workflow/registry.js.map +1 -0
- package/dist/src/workflow/replay.d.ts +87 -0
- package/dist/src/workflow/replay.d.ts.map +1 -0
- package/dist/src/workflow/replay.js +759 -0
- package/dist/src/workflow/replay.js.map +1 -0
- package/dist/src/workflow/runtime/bootstrap.d.ts +15 -0
- package/dist/src/workflow/runtime/bootstrap.d.ts.map +1 -0
- package/dist/src/workflow/runtime/bootstrap.js +124 -0
- package/dist/src/workflow/runtime/bootstrap.js.map +1 -0
- package/dist/src/workflow/runtime/engine.d.ts +21 -0
- package/dist/src/workflow/runtime/engine.d.ts.map +1 -0
- package/dist/src/workflow/runtime/engine.js +73 -0
- package/dist/src/workflow/runtime/engine.js.map +1 -0
- package/dist/src/workflow/runtime/environment.d.ts +29 -0
- package/dist/src/workflow/runtime/environment.d.ts.map +1 -0
- package/dist/src/workflow/runtime/environment.js +298 -0
- package/dist/src/workflow/runtime/environment.js.map +1 -0
- package/dist/src/workflow/runtime/index.d.ts +7 -0
- package/dist/src/workflow/runtime/index.d.ts.map +1 -0
- package/dist/src/workflow/runtime/index.js +4 -0
- package/dist/src/workflow/runtime/index.js.map +1 -0
- package/dist/src/workflow/runtime/info.d.ts +5 -0
- package/dist/src/workflow/runtime/info.d.ts.map +1 -0
- package/dist/src/workflow/runtime/info.js +22 -0
- package/dist/src/workflow/runtime/info.js.map +1 -0
- package/dist/src/workflow/runtime/replay.d.ts +26 -0
- package/dist/src/workflow/runtime/replay.d.ts.map +1 -0
- package/dist/src/workflow/runtime/replay.js +254 -0
- package/dist/src/workflow/runtime/replay.js.map +1 -0
- package/dist/src/workflows/index.d.ts +3 -0
- package/dist/src/workflows/index.d.ts.map +1 -0
- package/dist/src/workflows/index.js +15 -0
- package/dist/src/workflows/index.js.map +1 -0
- package/package.json +74 -0
package/README.md
ADDED
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
# `@proompteng/temporal-bun-sdk`
|
|
2
|
+
|
|
3
|
+
A Bun-first Temporal SDK implemented entirely in TypeScript. It speaks gRPC over HTTP/2 using [Connect](https://connectrpc.com/) and executes workflows with the [Effect](https://effect.website/) runtime so you can run Temporal workers without shipping Node.js or any native bridge.
|
|
4
|
+
|
|
5
|
+
## Highlights
|
|
6
|
+
- **TypeScript-only runtime** – workflow polling, activity execution, and command generation run in Bun using generated Temporal protobuf stubs.
|
|
7
|
+
- **Effect-based workflows** – define deterministic workflows with `Effect` and let the runtime translate results/failures into Temporal commands.
|
|
8
|
+
- **Connect-powered client** – `createTemporalClient` gives you a fully typed Temporal WorkflowService client backed by @bufbuild/protobuf.
|
|
9
|
+
- **Simple data conversion** – JSON payload conversion out of the box with hooks for custom codecs.
|
|
10
|
+
- **Bun CLI** – `temporal-bun` scaffolds workers and ships lightweight Docker helpers (no Zig build steps required).
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
- **Bun ≥ 1.1.20** – required for the runtime and CLI.
|
|
14
|
+
- **Temporal CLI ≥ 1.4** – optional, but useful for spinning up a local dev server.
|
|
15
|
+
|
|
16
|
+
## Quickstart
|
|
17
|
+
1. **Install dependencies**
|
|
18
|
+
```bash
|
|
19
|
+
bun install
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
2. **Configure Temporal access**
|
|
23
|
+
Create an `.env` (or export variables in your shell) with the connection details. `loadTemporalConfig` reads these at runtime:
|
|
24
|
+
```env
|
|
25
|
+
TEMPORAL_ADDRESS=temporal.example.com:7233
|
|
26
|
+
TEMPORAL_NAMESPACE=default
|
|
27
|
+
TEMPORAL_API_KEY=temporal-cloud-api-key-123 # optional
|
|
28
|
+
TEMPORAL_TLS_CA_PATH=certs/cloud-ca.pem # optional – enable TLS
|
|
29
|
+
TEMPORAL_TLS_CERT_PATH=certs/worker.crt # optional – only for mTLS
|
|
30
|
+
TEMPORAL_TLS_KEY_PATH=certs/worker.key # optional – only for mTLS
|
|
31
|
+
TEMPORAL_TLS_SERVER_NAME=temporal.example.com # optional – SNI override
|
|
32
|
+
TEMPORAL_CLIENT_RETRY_MAX_ATTEMPTS=5 # optional – WorkflowService RPC attempts
|
|
33
|
+
TEMPORAL_CLIENT_RETRY_INITIAL_MS=200 # optional – first retry delay in ms
|
|
34
|
+
TEMPORAL_CLIENT_RETRY_MAX_MS=5000 # optional – max retry delay in ms
|
|
35
|
+
TEMPORAL_CLIENT_RETRY_BACKOFF=2 # optional – exponential backoff coefficient
|
|
36
|
+
TEMPORAL_CLIENT_RETRY_JITTER_FACTOR=0.2 # optional – decorrelated jitter (0-1)
|
|
37
|
+
TEMPORAL_CLIENT_RETRY_STATUS_CODES=UNAVAILABLE,DEADLINE_EXCEEDED # optional – retryable gRPC codes
|
|
38
|
+
TEMPORAL_TASK_QUEUE=prix
|
|
39
|
+
TEMPORAL_WORKFLOW_CONCURRENCY=4 # optional – workflow pollers
|
|
40
|
+
TEMPORAL_ACTIVITY_CONCURRENCY=4 # optional – activity pollers
|
|
41
|
+
TEMPORAL_STICKY_CACHE_SIZE=256 # optional – determinism cache capacity
|
|
42
|
+
TEMPORAL_STICKY_TTL_MS=300000 # optional – eviction TTL in ms
|
|
43
|
+
TEMPORAL_STICKY_SCHEDULING_ENABLED=1 # optional – disable to bypass sticky scheduling
|
|
44
|
+
TEMPORAL_ACTIVITY_HEARTBEAT_INTERVAL_MS=4000 # optional – heartbeat throttle interval in ms
|
|
45
|
+
TEMPORAL_ACTIVITY_HEARTBEAT_RPC_TIMEOUT_MS=5000 # optional – heartbeat RPC timeout in ms
|
|
46
|
+
TEMPORAL_WORKER_DEPLOYMENT_NAME=prix-deploy # optional – worker deployment metadata
|
|
47
|
+
TEMPORAL_WORKER_BUILD_ID=git-sha # optional – build-id for versioning
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
> Running against `temporal server start-dev`? Omit TLS variables and set `TEMPORAL_ADDRESS=127.0.0.1:7233`. Set `TEMPORAL_ALLOW_INSECURE=1` when testing with self-signed certificates.
|
|
51
|
+
|
|
52
|
+
3. **Build the SDK once**
|
|
53
|
+
```bash
|
|
54
|
+
bun run build
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
4. **Run the Bun worker**
|
|
58
|
+
```bash
|
|
59
|
+
# optional: in another shell
|
|
60
|
+
bun scripts/start-temporal-cli.ts
|
|
61
|
+
|
|
62
|
+
# run the worker
|
|
63
|
+
bun run start:worker
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
5. **Scaffold a new worker project**
|
|
67
|
+
```bash
|
|
68
|
+
temporal-bun init hello-worker
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## WorkflowService client resilience
|
|
72
|
+
|
|
73
|
+
`createTemporalClient()` now includes built-in resilience features:
|
|
74
|
+
|
|
75
|
+
- **Configurable retries** – `loadTemporalConfig()` populates `config.rpcRetryPolicy` from the `TEMPORAL_CLIENT_RETRY_*` env vars (or from defaults). Every WorkflowService RPC is wrapped in `withTemporalRetry()` (decorrelated jitter + exponential backoff). Override per-call values with the new `TemporalClientCallOptions.retryPolicy` field when you need a bespoke attempt budget.
|
|
76
|
+
- **Optional call options on every method** – `startWorkflow`, `signalWorkflow`, `queryWorkflow`, `signalWithStart`, `terminateWorkflow`, and `describeNamespace` accept an optional trailing `callOptions` argument. Wrap them with `temporalCallOptions()` so payload objects are never mistaken for options:
|
|
77
|
+
```ts
|
|
78
|
+
import { temporalCallOptions } from '@proompteng/temporal-bun-sdk'
|
|
79
|
+
|
|
80
|
+
await client.queryWorkflow(
|
|
81
|
+
handle,
|
|
82
|
+
'currentState',
|
|
83
|
+
{ kind: 'snapshot' },
|
|
84
|
+
temporalCallOptions({
|
|
85
|
+
timeoutMs: 15_000,
|
|
86
|
+
headers: { 'x-trace-id': traceId },
|
|
87
|
+
}),
|
|
88
|
+
)
|
|
89
|
+
```
|
|
90
|
+
- **Telemetry-friendly interceptors** – the default interceptor builder injects namespace/identity headers, logs RPC attempts, and records latency/error counters with your configured metrics registry/exporter. Provide `interceptors` when creating a client to append custom tracing or auth middleware.
|
|
91
|
+
- **Memo & search attribute helpers** – `client.memo.encode/decode` and `client.searchAttributes.encode/decode` reuse the client’s `DataConverter`, making it trivial to prepare `Memo`/`SearchAttributes` payloads for raw WorkflowService requests.
|
|
92
|
+
- **TLS validation & handshake errors** – TLS buffers are validated up front (missing files, invalid PEMs, and mismatched cert/key pairs throw `TemporalTlsConfigurationError`). Runtime handshake failures raise `TemporalTlsHandshakeError` with remediation hints (verify CA bundles, check `TEMPORAL_TLS_SERVER_NAME`, or use `TEMPORAL_ALLOW_INSECURE=1` in trusted dev clusters).
|
|
93
|
+
|
|
94
|
+
## Workflow surface
|
|
95
|
+
|
|
96
|
+
Workflow handlers receive a rich context that captures command intents deterministically. Alongside `input` you now get:
|
|
97
|
+
|
|
98
|
+
- `activities.schedule(type, args, options)` – buffers a `SCHEDULE_ACTIVITY_TASK` command. Activity IDs default to `activity-{n}` and inherit the workflow task queue unless overridden.
|
|
99
|
+
- `timers.start({ timeoutMs })` – emits a `START_TIMER` command and returns a handle for bookkeeping.
|
|
100
|
+
- `childWorkflows.start(type, args, options)` – records `START_CHILD_WORKFLOW_EXECUTION` with optional `workflowId`, retry policy, and task queue overrides.
|
|
101
|
+
- `signals.signal(name, args, options)` – queues `SIGNAL_EXTERNAL_WORKFLOW_EXECUTION` for another run or child.
|
|
102
|
+
- `continueAsNew(options)` – records a `CONTINUE_AS_NEW_WORKFLOW_EXECUTION` command and short-circuits the current run.
|
|
103
|
+
- `determinism.now()` / `determinism.random()` – shims for wall clock time and randomness that log values into the replay ledger so replays must produce identical sequences.
|
|
104
|
+
|
|
105
|
+
Example:
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
import { Effect } from 'effect'
|
|
109
|
+
import * as Schema from 'effect/Schema'
|
|
110
|
+
import { defineWorkflow } from '@proompteng/temporal-bun-sdk/workflow'
|
|
111
|
+
|
|
112
|
+
export const workflows = [
|
|
113
|
+
defineWorkflow('greet', Schema.Array(Schema.String), ({ input, activities, timers, determinism }) => {
|
|
114
|
+
const [name = 'Temporal'] = input
|
|
115
|
+
return Effect.flatMap(activities.schedule('recordGreeting', [name]), () =>
|
|
116
|
+
Effect.flatMap(timers.start({ timeoutMs: 1_000 }), () =>
|
|
117
|
+
Effect.sync(() => {
|
|
118
|
+
const iso = new Date(determinism.now()).toISOString()
|
|
119
|
+
return `Greeting enqueued for ${name} at ${iso}`
|
|
120
|
+
}),
|
|
121
|
+
),
|
|
122
|
+
)
|
|
123
|
+
}),
|
|
124
|
+
]
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
On each workflow task the executor compares newly emitted intents, random values, and logical timestamps against the stored determinism state. Mismatches raise `WorkflowNondeterminismError` and cause the worker to fail the task with `WORKFLOW_TASK_FAILED_CAUSE_NON_DETERMINISTIC_ERROR`, mirroring Temporal’s official SDK behavior. Determinism snapshots are recorded as `temporal-bun-sdk/determinism` markers in workflow history and optionally cached via a sticky determinism cache. Tune cache behaviour with `TEMPORAL_STICKY_CACHE_SIZE` and `TEMPORAL_STICKY_TTL_MS`; the sticky worker queue inherits its schedule-to-start timeout from the TTL value.
|
|
128
|
+
|
|
129
|
+
## Activity lifecycle
|
|
130
|
+
|
|
131
|
+
Activities run with an ambient `ActivityContext` (available through `currentActivityContext()`) so you can send heartbeats, observe cancellation, and inspect attempt metadata:
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
import { currentActivityContext } from '@proompteng/temporal-bun-sdk/worker'
|
|
135
|
+
|
|
136
|
+
export const ingestLargeFile = async (chunks: Iterable<string>) => {
|
|
137
|
+
const ctx = currentActivityContext()
|
|
138
|
+
let processed = 0
|
|
139
|
+
for (const chunk of chunks) {
|
|
140
|
+
// do expensive work
|
|
141
|
+
await writeChunk(chunk)
|
|
142
|
+
processed += 1
|
|
143
|
+
await ctx?.heartbeat({ processed })
|
|
144
|
+
ctx?.throwIfCancelled()
|
|
145
|
+
}
|
|
146
|
+
return processed
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
- `activityContext.heartbeat(...details)` is throttled by `TEMPORAL_ACTIVITY_HEARTBEAT_INTERVAL_MS` and retried with exponential backoff (tunable via `TEMPORAL_ACTIVITY_HEARTBEAT_RPC_TIMEOUT_MS`) so transient RPC failures do not kill the attempt.
|
|
151
|
+
- The latest heartbeat payload automatically flows into cancellation/failure responses so Temporal UI surfaces helpful metadata.
|
|
152
|
+
- WorkerRuntime honours workflow `retry` policies locally: `maximumAttempts`, `initialInterval`, `maximumInterval`, `backoffCoefficient`, and `nonRetryableErrorTypes` all apply before a terminal failure is reported back to the server. Errors flagged as non-retryable (`error.nonRetryable = true` or matching the configured type list) short-circuit the retry loop.
|
|
153
|
+
- Activity attempts that exhaust the policy are reported as `nonRetryable` failures so the Temporal service does not perform redundant retries.
|
|
154
|
+
|
|
155
|
+
## Integration harness
|
|
156
|
+
|
|
157
|
+
The SDK ships an integration harness that wraps the Temporal CLI dev server scripts. It can execute workflows through `temporal workflow execute`/`temporal workflow show`, turn the emitted history into `HistoryEvent[]`, and feed the ingestion pipeline. To use it locally:
|
|
158
|
+
|
|
159
|
+
1. Install the [Temporal CLI](https://github.com/temporalio/cli) and ensure the `temporal` binary is on your `PATH` (or set `TEMPORAL_CLI_PATH`).
|
|
160
|
+
2. Start the dev server with `bun scripts/start-temporal-cli.ts` or let the harness do it for you.
|
|
161
|
+
3. Run the integration suite:
|
|
162
|
+
```bash
|
|
163
|
+
bun test tests/integration/history-replay.test.ts
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
If the CLI is missing the tests log a skip and continue so the rest of the suite still passes. The harness lives in `tests/integration/harness.ts` and exposes helpers for bespoke scenarios if you need to extend coverage.
|
|
167
|
+
|
|
168
|
+
## Worker load & performance tests
|
|
169
|
+
|
|
170
|
+
The TBS-003 load harness lives under `tests/integration/load/**` and uses CPU-heavy workflows, I/O-heavy activities, and the worker runtime's file metrics exporter to guard throughput, poll latency, and sticky cache hit ratios. There are two supported entry points:
|
|
171
|
+
|
|
172
|
+
1. **Bun test suite** (reuses the Temporal CLI harness):
|
|
173
|
+
```bash
|
|
174
|
+
TEMPORAL_INTEGRATION_TESTS=1 pnpm --filter @proompteng/temporal-bun-sdk exec bun test tests/integration/worker-load.test.ts
|
|
175
|
+
```
|
|
176
|
+
2. **Developer-friendly CLI runner** (wraps the same scenario without `bun test`):
|
|
177
|
+
```bash
|
|
178
|
+
pnpm --filter @proompteng/temporal-bun-sdk run test:load
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Both commands start the Temporal CLI dev server (unless `TEMPORAL_TEST_SERVER=1` is set), run the worker load scenario, and write artefacts to `.artifacts/worker-load/`:
|
|
182
|
+
|
|
183
|
+
- `metrics.jsonl` – raw JSONL stream from the file metrics exporter.
|
|
184
|
+
- `report.json` – human-readable summary (config, peak concurrency, throughput, latency percentiles, sticky cache hit ratio).
|
|
185
|
+
- `temporal-cli.log` – CLI stdout/stderr captured during the run.
|
|
186
|
+
|
|
187
|
+
The default profile now submits 36 workflows (roughly a 2:1 mix of CPU-heavy to IO-heavy types) with worker poller concurrency of 10/14 (workflow/activity) and a 100-second workflow deadline. That keeps the CI run comfortably under two minutes while actually saturating the scheduler. The Bun test wrapper adds a 15-second safety buffer on top of `TEMPORAL_LOAD_TEST_TIMEOUT_MS + TEMPORAL_LOAD_TEST_METRICS_FLUSH_MS`, so keep that env var in sync with any threshold tweaks.
|
|
188
|
+
|
|
189
|
+
### Tuning the load harness
|
|
190
|
+
|
|
191
|
+
The harness is driven by env vars (also exposed as CLI flags via `--workflows`, `--workflow-concurrency`, `--activity-concurrency`, and `--timeout` when calling `pnpm run test:load`). Key overrides:
|
|
192
|
+
|
|
193
|
+
- `TEMPORAL_LOAD_TEST_WORKFLOWS` – total workflows to submit.
|
|
194
|
+
- `TEMPORAL_LOAD_TEST_WORKFLOW_CONCURRENCY` / `TEMPORAL_LOAD_TEST_ACTIVITY_CONCURRENCY` – poller counts / concurrency targets.
|
|
195
|
+
- `TEMPORAL_LOAD_TEST_WORKFLOW_POLL_P95_MS` / `TEMPORAL_LOAD_TEST_ACTIVITY_POLL_P95_MS` – max allowed P95 poll latency.
|
|
196
|
+
- `TEMPORAL_LOAD_TEST_STICKY_MIN_RATIO` – minimum sticky cache hit ratio before the suite fails.
|
|
197
|
+
- `TEMPORAL_LOAD_TEST_TIMEOUT_MS` – overall completion timeout per batch.
|
|
198
|
+
- `TEMPORAL_LOAD_TEST_ACTIVITY_BURSTS`, `TEMPORAL_LOAD_TEST_COMPUTE_ITERATIONS`, `TEMPORAL_LOAD_TEST_ACTIVITY_DELAY_MS`, `TEMPORAL_LOAD_TEST_ACTIVITY_PAYLOAD_BYTES` – fine-tune CPU/IO stress.
|
|
199
|
+
|
|
200
|
+
CI runs `pnpm --filter @proompteng/temporal-bun-sdk run test:load` inside `.github/workflows/temporal-bun-sdk.yml` and uploads `.artifacts/worker-load/{metrics.jsonl,report.json,temporal-cli.log}` so reviewers can inspect regressions. When running locally on slower hardware, lower the concurrency knobs or bump the latency thresholds to avoid spurious failures.
|
|
201
|
+
|
|
202
|
+
## Effect service integration
|
|
203
|
+
|
|
204
|
+
```ts
|
|
205
|
+
import { Effect, Layer } from 'effect'
|
|
206
|
+
import { WorkerService } from '@proompteng/temporal-bun-sdk/worker'
|
|
207
|
+
|
|
208
|
+
const workerLayer = WorkerService({
|
|
209
|
+
workflowsPath: new URL('./workflows/index.ts', import.meta.url).pathname,
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
const program = Effect.gen(function* () {
|
|
213
|
+
const { run } = yield* WorkerService
|
|
214
|
+
yield* run
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
await Effect.provide(program, workerLayer)
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Define workflows with the Effect runtime:
|
|
221
|
+
|
|
222
|
+
```ts
|
|
223
|
+
import { Effect } from 'effect'
|
|
224
|
+
import { defineWorkflow } from '@proompteng/temporal-bun-sdk/workflow'
|
|
225
|
+
|
|
226
|
+
export const workflows = [
|
|
227
|
+
defineWorkflow('helloWorkflow', ({ input }) =>
|
|
228
|
+
Effect.sync(() => {
|
|
229
|
+
const [name] = Array.isArray(input) ? input : []
|
|
230
|
+
return typeof name === 'string' && name.length > 0 ? `Hello, ${name}!` : 'Hello, Temporal!'
|
|
231
|
+
}),
|
|
232
|
+
),
|
|
233
|
+
]
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Point the worker at a module exporting either `workflows` or a default array of definitions. Activity handlers remain plain async functions:
|
|
237
|
+
|
|
238
|
+
```ts
|
|
239
|
+
import { createWorker } from '@proompteng/temporal-bun-sdk/worker'
|
|
240
|
+
import * as activities from './activities'
|
|
241
|
+
|
|
242
|
+
const { worker } = await createWorker({
|
|
243
|
+
activities,
|
|
244
|
+
workflowsPath: new URL('./workflows/index.ts', import.meta.url).pathname,
|
|
245
|
+
})
|
|
246
|
+
|
|
247
|
+
await worker.run()
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Layer-based worker bootstrap
|
|
251
|
+
|
|
252
|
+
```ts
|
|
253
|
+
import { runWorkerApp } from '@proompteng/temporal-bun-sdk/runtime/worker-app'
|
|
254
|
+
import * as activities from './activities'
|
|
255
|
+
|
|
256
|
+
await runWorkerApp({
|
|
257
|
+
config: {
|
|
258
|
+
defaults: {
|
|
259
|
+
address: '127.0.0.1:7233',
|
|
260
|
+
namespace: 'staging',
|
|
261
|
+
taskQueue: 'staging-worker',
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
worker: {
|
|
265
|
+
activities,
|
|
266
|
+
workflowsPath: new URL('./workflows/index.ts', import.meta.url).pathname,
|
|
267
|
+
},
|
|
268
|
+
})
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### CLI layer helpers
|
|
272
|
+
|
|
273
|
+
Use `runTemporalCliEffect` to run ad-hoc Effect programs (doctor checks, replay helpers,
|
|
274
|
+
tests) against the same layered config/logging/workflow stack without hand-loading env vars:
|
|
275
|
+
|
|
276
|
+
```ts
|
|
277
|
+
import { Effect } from 'effect'
|
|
278
|
+
import { runTemporalCliEffect } from '@proompteng/temporal-bun-sdk/runtime/cli-layer'
|
|
279
|
+
import { TemporalConfigService } from '@proompteng/temporal-bun-sdk/runtime/effect-layers'
|
|
280
|
+
|
|
281
|
+
await runTemporalCliEffect(
|
|
282
|
+
Effect.gen(function* () {
|
|
283
|
+
const config = yield* TemporalConfigService
|
|
284
|
+
console.log('Active namespace:', config.namespace)
|
|
285
|
+
}),
|
|
286
|
+
{
|
|
287
|
+
config: {
|
|
288
|
+
defaults: {
|
|
289
|
+
address: '127.0.0.1:7233',
|
|
290
|
+
namespace: 'cli-layer',
|
|
291
|
+
taskQueue: 'cli-layer',
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
)
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## CLI commands
|
|
299
|
+
```
|
|
300
|
+
temporal-bun init [directory] Scaffold a new worker project
|
|
301
|
+
temporal-bun docker-build Build a Docker image for the current project
|
|
302
|
+
temporal-bun doctor Validate config + observability sinks
|
|
303
|
+
temporal-bun replay Replay workflow histories and diff determinism
|
|
304
|
+
temporal-bun help Show available commands
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Replay workflow histories
|
|
308
|
+
|
|
309
|
+
`temporal-bun replay` ingests workflow histories from JSON files or live
|
|
310
|
+
executions, reuses the existing determinism ingestion pipeline, and exits with a
|
|
311
|
+
non-zero status when mismatches surface (`0` success, `2` nondeterminism, `1`
|
|
312
|
+
configuration or IO failures).
|
|
313
|
+
|
|
314
|
+
- **History files** – accept either raw `temporal workflow show --history --output
|
|
315
|
+
json` output or fixture-style envelopes containing `history` + `info`.
|
|
316
|
+
- **Live executions** – pass `--execution <workflowId/runId>` and the command
|
|
317
|
+
shells out to the Temporal CLI (`--source cli`) or the WorkflowService RPC API
|
|
318
|
+
(`--source service`). `--source auto` (default) tries the CLI first and falls
|
|
319
|
+
back to WorkflowService when the binary is missing.
|
|
320
|
+
- **Observability** – the command composes `runTemporalCliEffect` layers (config,
|
|
321
|
+
observability, WorkflowService) before running and increments
|
|
322
|
+
`temporal_bun_replay_runs_total` / `temporal_bun_replay_mismatches_total`.
|
|
323
|
+
- **Troubleshooting** – surface the mismatching command index, event ids, and
|
|
324
|
+
workflow-task metadata on stdout plus a JSON summary when `--json` is set.
|
|
325
|
+
|
|
326
|
+
Examples:
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
# Replay a captured history file
|
|
330
|
+
bunx temporal-bun replay \
|
|
331
|
+
--history-file packages/temporal-bun-sdk/tests/replay/fixtures/timer-workflow.json \
|
|
332
|
+
--workflow-type timerWorkflow \
|
|
333
|
+
--json
|
|
334
|
+
|
|
335
|
+
# Diff a live execution using the Temporal CLI harness
|
|
336
|
+
TEMPORAL_ADDRESS=127.0.0.1:7233 TEMPORAL_NAMESPACE=temporal-bun-integration \
|
|
337
|
+
bunx temporal-bun replay \
|
|
338
|
+
--execution workflow-id/run-id \
|
|
339
|
+
--workflow-type integrationWorkflow \
|
|
340
|
+
--namespace temporal-bun-integration \
|
|
341
|
+
--source cli
|
|
342
|
+
|
|
343
|
+
# Force WorkflowService RPCs (no CLI installed)
|
|
344
|
+
bunx temporal-bun replay \
|
|
345
|
+
--execution workflow-id/run-id \
|
|
346
|
+
--workflow-type integrationWorkflow \
|
|
347
|
+
--namespace temporal-bun-integration \
|
|
348
|
+
--source service
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
Set `TEMPORAL_CLI_PATH` or `--temporal-cli` if the Temporal CLI binary is not on
|
|
352
|
+
your `PATH`. TLS, API key, and namespace overrides rely on the same environment
|
|
353
|
+
variables consumed by worker/client code (`TEMPORAL_ADDRESS`,
|
|
354
|
+
`TEMPORAL_NAMESPACE`, `TEMPORAL_TLS_*`, etc.).
|
|
355
|
+
|
|
356
|
+
## Data conversion
|
|
357
|
+
`createDefaultDataConverter()` encodes payloads as JSON. Implement `DataConverter` if you need a custom codec or encryption layer:
|
|
358
|
+
|
|
359
|
+
```ts
|
|
360
|
+
import { createDefaultDataConverter } from '@proompteng/temporal-bun-sdk/common/payloads'
|
|
361
|
+
|
|
362
|
+
const dataConverter = createDefaultDataConverter()
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
Pass your converter to both the worker and client factories to keep payload handling consistent.
|
|
366
|
+
|
|
367
|
+
## License
|
|
368
|
+
MIT © Proompt Engineering
|
|
369
|
+
|
|
370
|
+
## Worker versioning and build IDs
|
|
371
|
+
|
|
372
|
+
Workers derive their build ID from `TEMPORAL_WORKER_BUILD_ID`, the package version, or the configured identity. When `deployment.versioningMode` is `WorkerVersioningMode.VERSIONED`, `WorkerRuntime.create()` now:
|
|
373
|
+
|
|
374
|
+
1. Calls `GetWorkerBuildIdCompatibility` to confirm the WorkflowService supports worker versioning for the namespace/task queue.
|
|
375
|
+
2. Registers the build ID via `UpdateWorkerBuildIdCompatibility` before any pollers start, retrying transient `Unavailable`, `DeadlineExceeded`, `Aborted`, and `Internal` errors with incremental backoff.
|
|
376
|
+
3. Emits an info log so deploy pipelines can trace which build IDs were registered.
|
|
377
|
+
|
|
378
|
+
If the capability probe returns `Unimplemented` or `FailedPrecondition`, the runtime logs a warning and skips registration so local development servers (for example, the Temporal CLI dev server started via `bun scripts/start-temporal-cli.ts`) continue working even though they lack worker versioning APIs. Any other error aborts startup because versioned task queues will refuse to hand out work without a registered build ID.
|
|
379
|
+
|
|
380
|
+
Example logs:
|
|
381
|
+
|
|
382
|
+
```
|
|
383
|
+
[temporal-bun-sdk] registered worker build ID prix-worker@1.2.3 for default/prix
|
|
384
|
+
[temporal-bun-sdk] skipping worker build ID registration for default/prix: worker versioning API unavailable (Unimplemented (12)). If you are running against the Temporal CLI dev server via bun scripts/start-temporal-cli.ts this warning is expected because that server does not implement worker versioning APIs yet.
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
Production clusters should enable worker versioning, watch for the registration log during deploys, and alert on failures so versioned queues stay healthy.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/activities/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,YAAY,GAAU,aAAa,iBAAiB,KAAG,OAAO,CAAC,MAAM,CAEjF,CAAA;AAED,eAAO,MAAM,aAAa,GAAU,cAAc,MAAM,KAAG,OAAO,CAAC,IAAI,CACJ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/activities/index.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,EAAE,OAAO,EAAqB,EAAmB,EAAE;IACpF,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,YAAoB,EAAiB,EAAE,CACzE,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { DataConverter } from '../common/payloads';
|
|
3
|
+
import type { Logger } from '../observability/logger';
|
|
4
|
+
import type { Counter } from '../observability/metrics';
|
|
5
|
+
import type { ActivityContext } from '../worker/activity-context';
|
|
6
|
+
import type { WorkflowServiceClient } from '../worker/runtime';
|
|
7
|
+
import type { WorkflowRetryPolicyInput } from '../workflow/determinism';
|
|
8
|
+
export interface ActivityRetryState {
|
|
9
|
+
readonly attempt: number;
|
|
10
|
+
readonly retryCount: number;
|
|
11
|
+
readonly nextDelayMs: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ActivityLifecycleConfig {
|
|
14
|
+
readonly heartbeatIntervalMs: number;
|
|
15
|
+
readonly heartbeatRpcTimeoutMs: number;
|
|
16
|
+
readonly heartbeatRetry: {
|
|
17
|
+
readonly initialIntervalMs: number;
|
|
18
|
+
readonly maxIntervalMs: number;
|
|
19
|
+
readonly backoffCoefficient: number;
|
|
20
|
+
readonly maxAttempts: number;
|
|
21
|
+
readonly jitterRatio?: number;
|
|
22
|
+
};
|
|
23
|
+
readonly observability?: ActivityLifecycleObservability;
|
|
24
|
+
}
|
|
25
|
+
export interface ActivityLifecycleObservability {
|
|
26
|
+
readonly logger: Logger;
|
|
27
|
+
readonly heartbeatRetryCounter: Counter;
|
|
28
|
+
readonly heartbeatFailureCounter: Counter;
|
|
29
|
+
}
|
|
30
|
+
export interface ActivityHeartbeatRegistrationOptions {
|
|
31
|
+
readonly context: ActivityContext;
|
|
32
|
+
readonly workflowService: WorkflowServiceClient;
|
|
33
|
+
readonly taskToken: Uint8Array;
|
|
34
|
+
readonly identity: string;
|
|
35
|
+
readonly namespace: string;
|
|
36
|
+
readonly dataConverter: DataConverter;
|
|
37
|
+
readonly abortController: AbortController;
|
|
38
|
+
}
|
|
39
|
+
export interface ActivityHeartbeatRegistration {
|
|
40
|
+
readonly heartbeat: (details: unknown[]) => Effect.Effect<void, unknown, never>;
|
|
41
|
+
readonly shutdown: Effect.Effect<void, never, never>;
|
|
42
|
+
}
|
|
43
|
+
export interface ActivityLifecycle {
|
|
44
|
+
readonly registerHeartbeat: (options: ActivityHeartbeatRegistrationOptions) => Effect.Effect<ActivityHeartbeatRegistration, unknown, never>;
|
|
45
|
+
readonly nextRetryDelay: (retry: WorkflowRetryPolicyInput | undefined, state: ActivityRetryState) => Effect.Effect<ActivityRetryState | undefined, never, never>;
|
|
46
|
+
}
|
|
47
|
+
export declare const makeActivityLifecycle: (config: ActivityLifecycleConfig) => Effect.Effect<ActivityLifecycle, never, never>;
|
|
48
|
+
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../src/activities/lifecycle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGvD,OAAO,KAAK,EAAa,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAGvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAevE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAA;IACpC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAA;IACtC,QAAQ,CAAC,cAAc,EAAE;QACvB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;QAClC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;QAC9B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAA;QACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;QAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAC9B,CAAA;IACD,QAAQ,CAAC,aAAa,CAAC,EAAE,8BAA8B,CAAA;CACxD;AAED,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAA;IACvC,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAA;CAC1C;AAED,MAAM,WAAW,oCAAoC;IACnD,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;IACjC,QAAQ,CAAC,eAAe,EAAE,qBAAqB,CAAA;IAC/C,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAA;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAA;IACrC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAA;CAC1C;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAA;IAC/E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;CACrD;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,iBAAiB,EAAE,CAC1B,OAAO,EAAE,oCAAoC,KAC1C,MAAM,CAAC,MAAM,CAAC,6BAA6B,EAAE,OAAO,EAAE,KAAK,CAAC,CAAA;IACjE,QAAQ,CAAC,cAAc,EAAE,CACvB,KAAK,EAAE,wBAAwB,GAAG,SAAS,EAC3C,KAAK,EAAE,kBAAkB,KACtB,MAAM,CAAC,MAAM,CAAC,kBAAkB,GAAG,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;CACjE;AAED,eAAO,MAAM,qBAAqB,GAChC,QAAQ,uBAAuB,KAC9B,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,KAAK,EAAE,KAAK,CA4C5C,CAAA"}
|