@temporalio/core-bridge 1.8.5 → 1.9.0-rc.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.
Files changed (196) hide show
  1. package/Cargo.lock +189 -152
  2. package/Cargo.toml +1 -0
  3. package/lib/index.d.ts +17 -44
  4. package/lib/index.js.map +1 -1
  5. package/package.json +3 -4
  6. package/releases/aarch64-apple-darwin/index.node +0 -0
  7. package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
  8. package/releases/x86_64-apple-darwin/index.node +0 -0
  9. package/releases/x86_64-pc-windows-msvc/index.node +0 -0
  10. package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
  11. package/sdk-core/.github/workflows/heavy.yml +4 -0
  12. package/sdk-core/.github/workflows/per-pr.yml +96 -0
  13. package/sdk-core/ARCHITECTURE.md +1 -1
  14. package/sdk-core/Cargo.toml +6 -0
  15. package/sdk-core/README.md +37 -21
  16. package/sdk-core/client/Cargo.toml +6 -3
  17. package/sdk-core/client/src/lib.rs +272 -138
  18. package/sdk-core/client/src/metrics.rs +68 -57
  19. package/sdk-core/client/src/raw.rs +191 -45
  20. package/sdk-core/client/src/retry.rs +20 -0
  21. package/sdk-core/client/src/worker_registry/mod.rs +264 -0
  22. package/sdk-core/client/src/workflow_handle/mod.rs +2 -1
  23. package/sdk-core/core/Cargo.toml +16 -18
  24. package/sdk-core/core/src/core_tests/child_workflows.rs +7 -7
  25. package/sdk-core/core/src/core_tests/mod.rs +1 -0
  26. package/sdk-core/core/src/core_tests/replay_flag.rs +29 -39
  27. package/sdk-core/core/src/core_tests/updates.rs +73 -0
  28. package/sdk-core/core/src/core_tests/workflow_tasks.rs +52 -1
  29. package/sdk-core/core/src/ephemeral_server/mod.rs +34 -11
  30. package/sdk-core/core/src/internal_flags.rs +7 -1
  31. package/sdk-core/core/src/lib.rs +19 -36
  32. package/sdk-core/core/src/protosext/mod.rs +11 -3
  33. package/sdk-core/core/src/protosext/protocol_messages.rs +102 -0
  34. package/sdk-core/core/src/replay/mod.rs +100 -48
  35. package/sdk-core/core/src/telemetry/log_export.rs +161 -28
  36. package/sdk-core/core/src/telemetry/metrics.rs +869 -248
  37. package/sdk-core/core/src/telemetry/mod.rs +135 -239
  38. package/sdk-core/core/src/telemetry/prometheus_server.rs +36 -31
  39. package/sdk-core/core/src/test_help/mod.rs +63 -4
  40. package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +12 -2
  41. package/sdk-core/core/src/worker/activities.rs +276 -10
  42. package/sdk-core/core/src/worker/client/mocks.rs +18 -0
  43. package/sdk-core/core/src/worker/client.rs +16 -3
  44. package/sdk-core/core/src/worker/mod.rs +50 -19
  45. package/sdk-core/core/src/worker/slot_provider.rs +175 -0
  46. package/sdk-core/core/src/worker/workflow/driven_workflow.rs +27 -34
  47. package/sdk-core/core/src/worker/workflow/history_update.rs +4 -1
  48. package/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +36 -94
  49. package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +34 -22
  50. package/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +50 -34
  51. package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +106 -92
  52. package/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +22 -21
  53. package/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +386 -499
  54. package/sdk-core/core/src/worker/workflow/machines/mod.rs +12 -2
  55. package/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +33 -26
  56. package/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +198 -215
  57. package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +66 -62
  58. package/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +88 -119
  59. package/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +3 -1
  60. package/sdk-core/core/src/worker/workflow/machines/update_state_machine.rs +411 -0
  61. package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +26 -25
  62. package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +302 -85
  63. package/sdk-core/core/src/worker/workflow/managed_run.rs +179 -132
  64. package/sdk-core/core/src/worker/workflow/mod.rs +121 -46
  65. package/sdk-core/core/src/worker/workflow/run_cache.rs +8 -12
  66. package/sdk-core/core/src/worker/workflow/workflow_stream.rs +45 -38
  67. package/sdk-core/core-api/Cargo.toml +7 -6
  68. package/sdk-core/core-api/src/lib.rs +4 -12
  69. package/sdk-core/core-api/src/telemetry/metrics.rs +334 -0
  70. package/sdk-core/core-api/src/telemetry.rs +53 -42
  71. package/sdk-core/core-api/src/worker.rs +7 -0
  72. package/sdk-core/{.buildkite/docker → docker}/docker-compose.yaml +1 -1
  73. package/sdk-core/etc/dynamic-config.yaml +11 -1
  74. package/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +1 -1
  75. package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +1 -3
  76. package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +2 -2
  77. package/sdk-core/sdk/Cargo.toml +1 -1
  78. package/sdk-core/sdk/src/lib.rs +85 -7
  79. package/sdk-core/sdk/src/workflow_context/options.rs +4 -0
  80. package/sdk-core/sdk/src/workflow_context.rs +43 -15
  81. package/sdk-core/sdk/src/workflow_future.rs +334 -204
  82. package/sdk-core/sdk-core-protos/Cargo.toml +2 -2
  83. package/sdk-core/sdk-core-protos/build.rs +14 -14
  84. package/sdk-core/sdk-core-protos/protos/api_upstream/.buildkite/Dockerfile +2 -0
  85. package/sdk-core/sdk-core-protos/protos/api_upstream/Makefile +99 -0
  86. package/sdk-core/sdk-core-protos/protos/api_upstream/api-linter.yaml +56 -0
  87. package/sdk-core/sdk-core-protos/protos/api_upstream/buf.gen.yaml +20 -0
  88. package/sdk-core/sdk-core-protos/protos/api_upstream/buf.lock +11 -0
  89. package/sdk-core/sdk-core-protos/protos/api_upstream/buf.yaml +18 -0
  90. package/sdk-core/sdk-core-protos/protos/api_upstream/google/api/annotations.proto +31 -0
  91. package/sdk-core/sdk-core-protos/protos/api_upstream/google/api/http.proto +379 -0
  92. package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/any.proto +162 -0
  93. package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/descriptor.proto +1212 -0
  94. package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/duration.proto +115 -0
  95. package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/empty.proto +51 -0
  96. package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/timestamp.proto +144 -0
  97. package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/wrappers.proto +123 -0
  98. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/batch/v1/message.proto +3 -5
  99. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/command/v1/message.proto +11 -13
  100. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/common/v1/message.proto +2 -4
  101. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/failed_cause.proto +2 -0
  102. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/reset.proto +1 -1
  103. package/sdk-core/{protos/api_upstream/build/tools.go → sdk-core-protos/protos/api_upstream/temporal/api/export/v1/message.proto} +22 -6
  104. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/filter/v1/message.proto +2 -4
  105. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/history/v1/message.proto +21 -23
  106. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/namespace/v1/message.proto +2 -4
  107. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/operatorservice/v1/request_response.proto +2 -0
  108. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/operatorservice/v1/service.proto +4 -0
  109. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/replication/v1/message.proto +1 -3
  110. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/schedule/v1/message.proto +36 -20
  111. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +13 -0
  112. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/taskqueue/v1/message.proto +2 -4
  113. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/update/v1/message.proto +1 -1
  114. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/version/v1/message.proto +2 -3
  115. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/workflow/v1/message.proto +18 -20
  116. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/workflowservice/v1/request_response.proto +84 -32
  117. package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/workflowservice/v1/service.proto +205 -47
  118. package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +57 -0
  119. package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +27 -0
  120. package/sdk-core/sdk-core-protos/src/history_builder.rs +67 -2
  121. package/sdk-core/sdk-core-protos/src/lib.rs +75 -2
  122. package/sdk-core/sdk-core-protos/src/utilities.rs +14 -0
  123. package/sdk-core/test-utils/Cargo.toml +5 -1
  124. package/sdk-core/test-utils/src/canned_histories.rs +3 -57
  125. package/sdk-core/test-utils/src/interceptors.rs +46 -0
  126. package/sdk-core/test-utils/src/lib.rs +106 -38
  127. package/sdk-core/tests/integ_tests/metrics_tests.rs +110 -15
  128. package/sdk-core/tests/integ_tests/queries_tests.rs +174 -3
  129. package/sdk-core/tests/integ_tests/update_tests.rs +908 -0
  130. package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +44 -1
  131. package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +1 -1
  132. package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +1 -1
  133. package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +4 -4
  134. package/sdk-core/tests/integ_tests/workflow_tests/eager.rs +61 -0
  135. package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +27 -2
  136. package/sdk-core/tests/integ_tests/workflow_tests.rs +1 -0
  137. package/sdk-core/tests/main.rs +2 -1
  138. package/sdk-core/tests/runner.rs +15 -2
  139. package/src/conversions.rs +75 -89
  140. package/src/helpers.rs +74 -0
  141. package/src/runtime.rs +17 -6
  142. package/src/worker.rs +14 -61
  143. package/ts/index.ts +21 -52
  144. package/sdk-core/.buildkite/docker/Dockerfile +0 -9
  145. package/sdk-core/.buildkite/docker/build.sh +0 -5
  146. package/sdk-core/.buildkite/docker/docker-compose-ci.yaml +0 -27
  147. package/sdk-core/.buildkite/pipeline.yml +0 -57
  148. package/sdk-core/.github/workflows/semgrep.yml +0 -25
  149. package/sdk-core/core/src/worker/workflow/bridge.rs +0 -35
  150. package/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +0 -215
  151. package/sdk-core/protos/api_upstream/.buildkite/Dockerfile +0 -2
  152. package/sdk-core/protos/api_upstream/Makefile +0 -80
  153. package/sdk-core/protos/api_upstream/api-linter.yaml +0 -40
  154. package/sdk-core/protos/api_upstream/buf.yaml +0 -9
  155. package/sdk-core/protos/api_upstream/build/go.mod +0 -7
  156. package/sdk-core/protos/api_upstream/build/go.sum +0 -5
  157. package/sdk-core/protos/api_upstream/go.mod +0 -6
  158. package/sdk-core/protos/testsrv_upstream/dependencies/gogoproto/gogo.proto +0 -141
  159. /package/sdk-core/{.buildkite/docker → docker}/docker-compose-telem.yaml +0 -0
  160. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/.buildkite/docker-compose.yml +0 -0
  161. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/.buildkite/pipeline.yml +0 -0
  162. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/.github/CODEOWNERS +0 -0
  163. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  164. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/.github/workflows/publish-docs.yml +0 -0
  165. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/.github/workflows/trigger-api-go-update.yml +0 -0
  166. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/LICENSE +0 -0
  167. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/README.md +0 -0
  168. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/batch_operation.proto +0 -0
  169. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/command_type.proto +0 -0
  170. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/common.proto +0 -0
  171. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/event_type.proto +0 -0
  172. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/namespace.proto +0 -0
  173. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/query.proto +0 -0
  174. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/schedule.proto +0 -0
  175. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/task_queue.proto +0 -0
  176. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/update.proto +0 -0
  177. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/enums/v1/workflow.proto +0 -0
  178. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/errordetails/v1/message.proto +0 -0
  179. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/failure/v1/message.proto +0 -0
  180. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/protocol/v1/message.proto +0 -0
  181. /package/sdk-core/{protos → sdk-core-protos/protos}/api_upstream/temporal/api/query/v1/message.proto +0 -0
  182. /package/sdk-core/{protos → sdk-core-protos/protos}/google/rpc/status.proto +0 -0
  183. /package/sdk-core/{protos → sdk-core-protos/protos}/grpc/health/v1/health.proto +0 -0
  184. /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/activity_result/activity_result.proto +0 -0
  185. /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/activity_task/activity_task.proto +0 -0
  186. /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/child_workflow/child_workflow.proto +0 -0
  187. /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/common/common.proto +0 -0
  188. /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/core_interface.proto +0 -0
  189. /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/external_data/external_data.proto +0 -0
  190. /package/sdk-core/{protos → sdk-core-protos/protos}/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +0 -0
  191. /package/sdk-core/{protos → sdk-core-protos/protos}/testsrv_upstream/Makefile +0 -0
  192. /package/sdk-core/{protos → sdk-core-protos/protos}/testsrv_upstream/api-linter.yaml +0 -0
  193. /package/sdk-core/{protos → sdk-core-protos/protos}/testsrv_upstream/buf.yaml +0 -0
  194. /package/sdk-core/{protos/api_upstream → sdk-core-protos/protos/testsrv_upstream}/dependencies/gogoproto/gogo.proto +0 -0
  195. /package/sdk-core/{protos → sdk-core-protos/protos}/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +0 -0
  196. /package/sdk-core/{protos → sdk-core-protos/protos}/testsrv_upstream/temporal/api/testservice/v1/service.proto +0 -0
package/Cargo.toml CHANGED
@@ -24,6 +24,7 @@ opentelemetry = "0.18"
24
24
  parking_lot = "0.12"
25
25
  prost = "0.11"
26
26
  prost-types = "0.11"
27
+ serde_json = "1.0"
27
28
  tokio = "1.13"
28
29
  once_cell = "1.7.2"
29
30
  temporal-sdk-core = { version = "*", path = "./sdk-core/core", features = ["ephemeral-server"] }
package/lib/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { SpanContext } from '@opentelemetry/api';
2
1
  import { LogLevel, Duration } from '@temporalio/common';
3
2
  import type { TLSConfig } from '@temporalio/common/lib/internal-non-workflow';
4
3
  export { TLSConfig };
@@ -103,12 +102,6 @@ export interface OtelCollectorExporter {
103
102
  };
104
103
  }
105
104
  /** @experimental */
106
- export type CompiledOtelTraceExporter = Shadow<OtelCollectorExporter, {
107
- otel: {
108
- metricsExportInterval?: never;
109
- };
110
- }>;
111
- /** @experimental */
112
105
  export type CompiledOtelMetricsExporter = Shadow<OtelCollectorExporter, {
113
106
  otel: {
114
107
  metricsExportInterval: number;
@@ -142,12 +135,6 @@ export interface PrometheusMetricsExporter {
142
135
  export type MetricsExporter = {
143
136
  temporality?: 'cumulative' | 'delta';
144
137
  } & (PrometheusMetricsExporter | OtelCollectorExporter);
145
- /**
146
- * Trace exporters supported by Core
147
- *
148
- * @experimental
149
- */
150
- export type TraceExporter = OtelCollectorExporter;
151
138
  /** @experimental */
152
139
  export interface TelemetryOptions {
153
140
  /**
@@ -156,7 +143,7 @@ export interface TelemetryOptions {
156
143
  *
157
144
  * Which determines what tracing data is collected in the Core SDK.
158
145
  *
159
- * @deprecated Use either `logging.filter` or `tracing.filter` instead
146
+ * @deprecated Use `logging.filter` instead
160
147
  */
161
148
  tracingFilter?: string;
162
149
  /**
@@ -188,35 +175,16 @@ export interface TelemetryOptions {
188
175
  */
189
176
  filter?: string;
190
177
  } & Partial<Logger>;
191
- /**
192
- * Control where to send traces generated by Rust Core, optional and turned off by default.
193
- *
194
- * This is typically used for profiling SDK internals.
195
- */
196
- tracing?: {
197
- /**
198
- * A string in (env filter format)[https://docs.rs/tracing-subscriber/0.2.20/tracing_subscriber/struct.EnvFilter.html]
199
- * which determines what tracing data is collected in the Core SDK.
200
- *
201
- * You can use {@link Runtime.makeTelemetryFilterString()} to easily build a correctly formatted filter
202
- * string based on desired log level for Core SDK and other native packages.
203
- *
204
- * **BACKWARD COMPATIBILITY**
205
- *
206
- * If `tracing.filter` is missing, the following legacy values (if present) will be used instead (in the given order):
207
- * - {@link TelemetryOptions.tracingFilter}
208
- * - Default value of `makeTelemetryFilterString({ core: 'INFO', other: 'INFO'})`
209
- *
210
- * @default `makeTelemetryFilterString({ core: 'INFO', other: 'INFO'})` (with some exceptions, as described in backward compatibility note above)
211
- */
212
- filter?: string;
213
- } & Partial<TraceExporter>;
214
178
  /**
215
179
  * Control exporting {@link NativeConnection} and {@link Worker} metrics.
216
180
  *
217
181
  * Turned off by default
218
182
  */
219
183
  metrics?: MetricsExporter;
184
+ /**
185
+ * @deprecated Core SDK tracing is no longer supported. This option is ignored.
186
+ */
187
+ tracing?: unknown;
220
188
  }
221
189
  /** @experimental */
222
190
  export type CompiledTelemetryOptions = {
@@ -228,9 +196,6 @@ export type CompiledTelemetryOptions = {
228
196
  } | {
229
197
  forward: {};
230
198
  });
231
- tracing?: {
232
- filter: string;
233
- } & CompiledOtelTraceExporter;
234
199
  metrics?: {
235
200
  temporality?: 'cumulative' | 'delta';
236
201
  } & (PrometheusMetricsExporter | CompiledOtelMetricsExporter);
@@ -258,6 +223,7 @@ export interface WorkerOptions {
258
223
  maxConcurrentActivityTaskExecutions: number;
259
224
  maxConcurrentWorkflowTaskExecutions: number;
260
225
  maxConcurrentLocalActivityExecutions: number;
226
+ nonStickyToStickyPollRatio: number;
261
227
  /**
262
228
  * Maximum number of Workflow tasks to poll concurrently.
263
229
  */
@@ -307,6 +273,9 @@ export interface WorkerOptions {
307
273
  */
308
274
  maxActivitiesPerSecond?: number;
309
275
  }
276
+ export type LogEntryMetadata = {
277
+ [key: string]: string | number | boolean | LogEntryMetadata;
278
+ };
310
279
  export interface LogEntry {
311
280
  /** Log message */
312
281
  message: string;
@@ -318,6 +287,10 @@ export interface LogEntry {
318
287
  timestamp: [number, number];
319
288
  /** Log level */
320
289
  level: LogLevel;
290
+ /** Name of the Core subsystem that emitted that log entry */
291
+ target: string;
292
+ /*** Metadata fields */
293
+ fields: LogEntryMetadata;
321
294
  }
322
295
  /**
323
296
  * Which version of the executable to run.
@@ -446,10 +419,10 @@ export declare function clientUpdateHeaders(client: Client, headers: Record<stri
446
419
  export declare function clientClose(client: Client): void;
447
420
  export declare function runtimeShutdown(runtime: Runtime, callback: VoidCallback): void;
448
421
  export declare function pollLogs(runtime: Runtime, callback: LogsCallback): void;
449
- export declare function workerPollWorkflowActivation(worker: Worker, spanContext: SpanContext, callback: PollCallback): void;
450
- export declare function workerCompleteWorkflowActivation(worker: Worker, spanContext: SpanContext, result: ArrayBuffer, callback: VoidCallback): void;
451
- export declare function workerPollActivityTask(worker: Worker, spanContext: SpanContext, callback: PollCallback): void;
452
- export declare function workerCompleteActivityTask(worker: Worker, spanContext: SpanContext, result: ArrayBuffer, callback: VoidCallback): void;
422
+ export declare function workerPollWorkflowActivation(worker: Worker, callback: PollCallback): void;
423
+ export declare function workerCompleteWorkflowActivation(worker: Worker, result: ArrayBuffer, callback: VoidCallback): void;
424
+ export declare function workerPollActivityTask(worker: Worker, callback: PollCallback): void;
425
+ export declare function workerCompleteActivityTask(worker: Worker, result: ArrayBuffer, callback: VoidCallback): void;
453
426
  export declare function workerRecordActivityHeartbeat(worker: Worker, heartbeat: ArrayBuffer): void;
454
427
  export declare function getTimeOfDay(): [number, number];
455
428
  export declare function startEphemeralServer(runtime: Runtime, config: EphemeralServerConfig, sdkVersion: string, callback: Callback<EphemeralServer>): void;
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":";;;AAqhBA,mCAA0E;AAAjE,uGAAA,aAAa,OAAA;AAAE,wGAAA,cAAc,OAAA;AAAE,yGAAA,eAAe,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":";;;AAsfA,mCAA0E;AAAjE,uGAAA,aAAa,OAAA;AAAE,wGAAA,cAAc,OAAA;AAAE,yGAAA,eAAe,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temporalio/core-bridge",
3
- "version": "1.8.5",
3
+ "version": "1.9.0-rc.0",
4
4
  "description": "Temporal.io SDK Core<>Node bridge",
5
5
  "main": "index.js",
6
6
  "types": "lib/index.d.ts",
@@ -22,8 +22,7 @@
22
22
  "author": "Temporal Technologies Inc. <sdk@temporal.io>",
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
- "@opentelemetry/api": "^1.4.1",
26
- "@temporalio/common": "1.8.5",
25
+ "@temporalio/common": "1.9.0-rc.0",
27
26
  "arg": "^5.0.2",
28
27
  "cargo-cp-artifact": "^0.1.6",
29
28
  "which": "^2.0.2"
@@ -53,5 +52,5 @@
53
52
  "publishConfig": {
54
53
  "access": "public"
55
54
  },
56
- "gitHead": "1a03096ceb2d63345c3f2c190d975c2a54c7b4a5"
55
+ "gitHead": "ca3e508e62de02b2c9bb40d0d889003cebba282d"
57
56
  }
@@ -6,6 +6,10 @@ on: # rebuild any PRs and main branch changes
6
6
  branches:
7
7
  - master
8
8
 
9
+ concurrency:
10
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11
+ cancel-in-progress: true
12
+
9
13
  jobs:
10
14
  build-and-test:
11
15
  timeout-minutes: 20
@@ -0,0 +1,96 @@
1
+ name: Per merge CI
2
+
3
+ on: # rebuild any PRs and main branch changes
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - master
8
+
9
+ concurrency:
10
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ jobs:
14
+ build-and-test:
15
+ name: "Format, docs, and lint"
16
+ timeout-minutes: 20
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+ with:
21
+ submodules: recursive
22
+ - uses: actions-rs/toolchain@v1
23
+ with:
24
+ profile: minimal
25
+ toolchain: 1.74.0
26
+ override: true
27
+ - name: Install protoc
28
+ uses: arduino/setup-protoc@v1
29
+ with:
30
+ version: '3.x'
31
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
32
+ - run: rustup component add rustfmt clippy
33
+ - uses: Swatinem/rust-cache@v2
34
+ - uses: actions-rs/cargo@v1
35
+ with:
36
+ command: fmt
37
+ args: --all -- --check
38
+ - uses: actions-rs/cargo@v1
39
+ with:
40
+ command: doc
41
+ args: --workspace --all-features --no-deps
42
+ - uses: actions-rs/cargo@v1
43
+ with:
44
+ command: lint
45
+ - uses: actions-rs/cargo@v1
46
+ with:
47
+ command: test-lint
48
+
49
+ test:
50
+ name: Unit Tests
51
+ runs-on: ubuntu-latest
52
+ steps:
53
+ - uses: actions/checkout@v2
54
+ - uses: actions-rs/toolchain@v1
55
+ with:
56
+ profile: minimal
57
+ toolchain: 1.74.0
58
+ override: true
59
+ - name: Install protoc
60
+ uses: arduino/setup-protoc@v1
61
+ with:
62
+ version: '3.x'
63
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
64
+ - uses: Swatinem/rust-cache@v2
65
+ - uses: actions-rs/cargo@v1
66
+ with:
67
+ command: test
68
+ args: -- --include-ignored
69
+ - uses: actions/upload-artifact@v3
70
+ with:
71
+ name: coverage-report
72
+ path: tarpaulin-report.html
73
+ - uses: actions/upload-artifact@v3
74
+ with:
75
+ name: state-machine-coverage
76
+ path: machine_coverage/
77
+
78
+ fmt:
79
+ name: Integ tests
80
+ runs-on: ubuntu-latest
81
+ steps:
82
+ - uses: actions/checkout@v2
83
+ - uses: actions-rs/toolchain@v1
84
+ with:
85
+ profile: minimal
86
+ toolchain: 1.74.0
87
+ override: true
88
+ - name: Install protoc
89
+ uses: arduino/setup-protoc@v1
90
+ with:
91
+ version: '3.x'
92
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
93
+ - uses: Swatinem/rust-cache@v2
94
+ - uses: actions-rs/cargo@v1
95
+ with:
96
+ command: integ-test
@@ -66,7 +66,7 @@ async fn hello_activity(name: &str) -> String {
66
66
 
67
67
  We define the interface between the core and lang SDKs in terms of gRPC service definitions. The actual implementations of this "service" are not generated by gRPC generators, but the messages themselves are, and make it easier to hit the ground running in new languages.
68
68
 
69
- See the latest API definition [here](https://github.com/temporalio/sdk-core/tree/master/protos/local/temporal/sdk/core)
69
+ See the latest API definition [here](https://github.com/temporalio/sdk-core/tree/master/sdk-core-protos/protos/local/temporal/sdk/core)
70
70
 
71
71
 
72
72
  ## Other topics
@@ -1,2 +1,8 @@
1
1
  [workspace]
2
2
  members = ["core", "client", "core-api", "fsm", "test-utils", "sdk-core-protos", "sdk"]
3
+ resolver = "2"
4
+
5
+ [workspace.dependencies]
6
+ tonic = "0.9"
7
+ tonic-build = "0.9"
8
+ opentelemetry = "0.21"
@@ -1,5 +1,7 @@
1
1
  [![Build status](https://badge.buildkite.com/c23f47f4a827f04daece909963bd3a248496f0cdbabfbecee4.svg?branch=master)](https://buildkite.com/temporal/core-sdk?branch=master)
2
2
 
3
+ # Temporal Core SDK
4
+
3
5
  Core SDK that can be used as a base for other Temporal SDKs. It is currently used as the base of:
4
6
 
5
7
  - [TypeScript SDK](https://github.com/temporalio/sdk-typescript/)
@@ -7,24 +9,31 @@ Core SDK that can be used as a base for other Temporal SDKs. It is currently use
7
9
  - [.NET SDK](https://github.com/temporalio/sdk-dotnet/)
8
10
  - [Ruby SDK](https://github.com/temporalio/sdk-ruby/)
9
11
 
10
- For the reasoning behind the Core SDK, see:
12
+ # Documentation
11
13
 
12
- - [Why Rust powers Temporal’s new Core SDK](https://temporal.io/blog/why-rust-powers-core-sdk).
14
+ Core SDK documentation can be generated with `cargo doc`, output will be placed in the
15
+ `target/doc` directory.
13
16
 
14
- See the [Architecture](ARCHITECTURE.md) doc for some high-level information about how Core works
17
+ [Architecture](ARCHITECTURE.md) doc provides some high-level information about how Core SDK works
15
18
  and how language layers interact with it.
16
19
 
20
+ For the reasoning behind the Core SDK, see blog post:
21
+
22
+ - [Why Rust powers Temporal’s new Core SDK](https://temporal.io/blog/why-rust-powers-core-sdk).
23
+
17
24
  # Development
18
25
 
19
- You will need the `protoc` protobuf compiler installed to build Core.
26
+ You will need the `protoc` [protobuf compiler](https://grpc.io/docs/protoc-installation)
27
+ installed to build Core.
20
28
 
21
29
  This repo is composed of multiple crates:
22
- * temporal-sdk-core-protos `./sdk-core-protos` - Holds the generated proto code and extensions
23
- * temporal-client `./client` - Defines client(s) for interacting with the Temporal gRPC service
24
- * temporal-sdk-core-api `./core-api` - Defines the API surface exposed by Core
25
- * temporal-sdk-core `./core` - The Core implementation
26
- * temporal-sdk `./sdk` - A (currently prototype) Rust SDK built on top of Core. Used for testing.
27
- * rustfsm `./fsm` - Implements a procedural macro used by core for defining state machines
30
+
31
+ - temporal-sdk-core-protos `./sdk-core-protos` - Holds the generated proto code and extensions
32
+ - temporal-client `./client` - Defines client(s) for interacting with the Temporal gRPC service
33
+ - temporal-sdk-core-api `./core-api` - Defines the API surface exposed by Core
34
+ - temporal-sdk-core `./core` - The Core implementation
35
+ - temporal-sdk `./sdk` - A (currently prototype) Rust SDK built on top of Core. Used for testing.
36
+ - rustfsm `./fsm` - Implements a procedural macro used by core for defining state machines
28
37
  (contains subcrates). It is temporal agnostic.
29
38
 
30
39
  Visualized (dev dependencies are in blue):
@@ -35,25 +44,28 @@ All the following commands are enforced for each pull request:
35
44
 
36
45
  ## Building and testing
37
46
 
38
- You can buld and test the project using cargo:
47
+ You can build and test the project using cargo:
39
48
  `cargo build`
40
49
  `cargo test`
41
50
 
42
- Run integ tests with `cargo integ-test`. You will need to already be running the server:
43
- `docker-compose -f .buildkite/docker/docker-compose.yaml up`
51
+ Run integ tests with `cargo integ-test`. By default it will start an ephemeral server. You can also
52
+ use an already-running server by passing `-s external`.
44
53
 
45
54
  Run load tests with `cargo test --features=save_wf_inputs --test heavy_tests`.
46
55
 
47
56
  ## Formatting
57
+
48
58
  To format all code run:
49
59
  `cargo fmt --all`
50
60
 
51
61
  ## Linting
62
+
52
63
  We are using [clippy](https://github.com/rust-lang/rust-clippy) for linting.
53
64
  You can run it using:
54
65
  `cargo clippy --all -- -D warnings`
55
66
 
56
67
  ## Debugging
68
+
57
69
  The crate uses [tracing](https://github.com/tokio-rs/tracing) to help with debugging. To enable
58
70
  it for a test, insert the below snippet at the start of the test. By default, tracing data is output
59
71
  to stdout in a (reasonably) pretty manner.
@@ -67,14 +79,14 @@ The passed in options to initialization can be customized to export to an OTel c
67
79
  To run integ tests with OTel collection on, you can use `integ-with-otel.sh`. You will want to make
68
80
  sure you are running the collector via docker, which can be done like so:
69
81
 
70
- `docker-compose -f .buildkite/docker/docker-compose.yaml -f .buildkite/docker/docker-compose-telem.yaml up`
82
+ `docker-compose -f docker/docker-compose.yaml -f docker/docker-compose-telem.yaml up`
71
83
 
72
84
  If you are working on a language SDK, you are expected to initialize tracing early in your `main`
73
85
  equivalent.
74
86
 
75
87
  ## Proto files
76
88
 
77
- This repo uses a subtree for upstream protobuf files. The path `protos/api_upstream` is a
89
+ This repo uses a subtree for upstream protobuf files. The path `sdk-core-protos/protos/api_upstream` is a
78
90
  subtree. To update it, use:
79
91
 
80
92
  `git pull --squash -s subtree ssh://git@github.com/temporalio/api.git master --allow-unrelated-histories`
@@ -83,17 +95,19 @@ Do not question why this git command is the way it is. It is not our place to in
83
95
 
84
96
  The java testserver protos are also pulled from the sdk-java repo, but since we only need a
85
97
  subdirectory of that repo, we just copy the files with read-tree:
98
+
86
99
  ```bash
87
100
  # add sdk-java as a remote if you have not already
88
101
  git remote add -f -t master --no-tags testsrv-protos git@github.com:temporalio/sdk-java.git
89
102
  # delete existing protos
90
- git rm -rf protos/testsrv_upstream
103
+ git rm -rf sdk-core-protos/protos/testsrv_upstream
91
104
  # pull from upstream & commit
92
- git read-tree --prefix protos/testsrv_upstream -u testsrv-protos/master:temporal-test-server/src/main/proto
105
+ git read-tree --prefix sdk-core-protos/protos/testsrv_upstream -u testsrv-protos/master:temporal-test-server/src/main/proto
93
106
  git commit
94
107
  ```
95
108
 
96
109
  ## Fetching Histories
110
+
97
111
  Tests which would like to replay stored histories rely on that history being made available in
98
112
  binary format. You can fetch histories in that format like so (from a local docker server):
99
113
 
@@ -104,16 +118,18 @@ You can change the `TEMPORAL_SERVICE_ADDRESS` env var to fetch from a different
104
118
  ## Style Guidelines
105
119
 
106
120
  ### Error handling
107
- Any error which is returned from a public interface should be well-typed, and we use
121
+
122
+ Any error which is returned from a public interface should be well-typed, and we use
108
123
  [thiserror](https://github.com/dtolnay/thiserror) for that purpose.
109
124
 
110
- Errors returned from things only used in testing are free to use
125
+ Errors returned from things only used in testing are free to use
111
126
  [anyhow](https://github.com/dtolnay/anyhow) for less verbosity.
112
127
 
113
-
114
128
  # The Rust "SDK"
129
+
115
130
  This repo contains a *prototype* Rust sdk in the `sdk/` directory. This SDK should be considered
116
131
  pre-alpha in terms of its API surface. Since it's still using Core underneath, it is generally
117
132
  functional. We do not currently have any firm plans to productionize this SDK. If you want to write
118
133
  workflows and activities in Rust, feel free to use it - but be aware that the API may change at any
119
- time without warning and we do not provide any support guarantees.
134
+ time without warning and we do not provide any support guarantees.
135
+
@@ -20,12 +20,13 @@ futures = "0.3"
20
20
  futures-retry = "0.6.0"
21
21
  http = "0.2"
22
22
  once_cell = "1.13"
23
- opentelemetry = { version = "0.18", features = ["metrics"] }
23
+ opentelemetry = { workspace = true, features = ["metrics"] }
24
24
  parking_lot = "0.12"
25
25
  prost-types = "0.11"
26
+ slotmap = "1.0"
26
27
  thiserror = "1.0"
27
28
  tokio = "1.1"
28
- tonic = { version = "0.8", features = ["tls", "tls-roots"] }
29
+ tonic = { workspace = true, features = ["tls", "tls-roots"] }
29
30
  tower = "0.4"
30
31
  tracing = "0.1"
31
32
  url = "2.2"
@@ -33,7 +34,9 @@ uuid = { version = "1.1", features = ["v4"] }
33
34
 
34
35
  [dependencies.temporal-sdk-core-protos]
35
36
  path = "../sdk-core-protos"
36
- version = "0.1"
37
+
38
+ [dependencies.temporal-sdk-core-api]
39
+ path = "../core-api"
37
40
 
38
41
  [dev-dependencies]
39
42
  assert_matches = "1"