@temporalio/core-bridge 1.4.4 → 1.5.1

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 (123) hide show
  1. package/Cargo.lock +327 -419
  2. package/Cargo.toml +1 -1
  3. package/index.js +25 -2
  4. package/lib/errors.d.ts +22 -0
  5. package/lib/errors.js +65 -0
  6. package/lib/errors.js.map +1 -0
  7. package/lib/index.d.ts +440 -0
  8. package/lib/index.js +8 -0
  9. package/lib/index.js.map +1 -0
  10. package/package.json +11 -5
  11. package/releases/aarch64-apple-darwin/index.node +0 -0
  12. package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
  13. package/releases/x86_64-apple-darwin/index.node +0 -0
  14. package/releases/x86_64-pc-windows-msvc/index.node +0 -0
  15. package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
  16. package/sdk-core/.buildkite/docker/Dockerfile +1 -1
  17. package/sdk-core/.buildkite/docker/docker-compose.yaml +2 -2
  18. package/sdk-core/bridge-ffi/Cargo.toml +1 -1
  19. package/sdk-core/bridge-ffi/include/sdk-core-bridge.h +0 -25
  20. package/sdk-core/bridge-ffi/src/lib.rs +29 -108
  21. package/sdk-core/bridge-ffi/src/wrappers.rs +35 -25
  22. package/sdk-core/client/Cargo.toml +1 -1
  23. package/sdk-core/client/src/lib.rs +12 -20
  24. package/sdk-core/client/src/raw.rs +9 -8
  25. package/sdk-core/client/src/retry.rs +100 -23
  26. package/sdk-core/core/Cargo.toml +5 -5
  27. package/sdk-core/core/benches/workflow_replay.rs +13 -10
  28. package/sdk-core/core/src/abstractions.rs +22 -22
  29. package/sdk-core/core/src/core_tests/activity_tasks.rs +1 -1
  30. package/sdk-core/core/src/core_tests/local_activities.rs +228 -6
  31. package/sdk-core/core/src/core_tests/queries.rs +247 -89
  32. package/sdk-core/core/src/core_tests/workers.rs +2 -2
  33. package/sdk-core/core/src/core_tests/workflow_cancels.rs +1 -1
  34. package/sdk-core/core/src/core_tests/workflow_tasks.rs +46 -27
  35. package/sdk-core/core/src/lib.rs +139 -32
  36. package/sdk-core/core/src/replay/mod.rs +185 -41
  37. package/sdk-core/core/src/telemetry/log_export.rs +190 -0
  38. package/sdk-core/core/src/telemetry/metrics.rs +184 -139
  39. package/sdk-core/core/src/telemetry/mod.rs +296 -318
  40. package/sdk-core/core/src/telemetry/prometheus_server.rs +4 -3
  41. package/sdk-core/core/src/test_help/mod.rs +9 -7
  42. package/sdk-core/core/src/worker/activities/local_activities.rs +2 -1
  43. package/sdk-core/core/src/worker/activities.rs +40 -23
  44. package/sdk-core/core/src/worker/client/mocks.rs +1 -1
  45. package/sdk-core/core/src/worker/client.rs +30 -4
  46. package/sdk-core/core/src/worker/mod.rs +22 -18
  47. package/sdk-core/core/src/worker/workflow/driven_workflow.rs +10 -19
  48. package/sdk-core/core/src/worker/workflow/history_update.rs +99 -25
  49. package/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +1 -5
  50. package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +1 -5
  51. package/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +1 -5
  52. package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +1 -5
  53. package/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +1 -5
  54. package/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +2 -6
  55. package/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +1 -5
  56. package/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +18 -21
  57. package/sdk-core/core/src/worker/workflow/machines/mod.rs +12 -38
  58. package/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +178 -0
  59. package/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +1 -5
  60. package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +1 -5
  61. package/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +1 -5
  62. package/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +8 -2
  63. package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +1 -5
  64. package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +232 -216
  65. package/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +1 -6
  66. package/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +4 -4
  67. package/sdk-core/core/src/worker/workflow/managed_run.rs +13 -5
  68. package/sdk-core/core/src/worker/workflow/mod.rs +61 -9
  69. package/sdk-core/core/src/worker/workflow/wft_poller.rs +2 -2
  70. package/sdk-core/core/src/worker/workflow/workflow_stream.rs +56 -11
  71. package/sdk-core/core-api/Cargo.toml +4 -3
  72. package/sdk-core/core-api/src/lib.rs +1 -43
  73. package/sdk-core/core-api/src/telemetry.rs +147 -0
  74. package/sdk-core/core-api/src/worker.rs +13 -0
  75. package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +1 -1
  76. package/sdk-core/histories/evict_while_la_running_no_interference-23_history.bin +0 -0
  77. package/sdk-core/histories/evict_while_la_running_no_interference-85_history.bin +0 -0
  78. package/sdk-core/protos/api_upstream/.github/CODEOWNERS +1 -1
  79. package/sdk-core/protos/api_upstream/buf.yaml +0 -3
  80. package/sdk-core/protos/api_upstream/temporal/api/batch/v1/message.proto +3 -7
  81. package/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +8 -0
  82. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +1 -2
  83. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +2 -0
  84. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +3 -0
  85. package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +13 -0
  86. package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +19 -59
  87. package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +0 -19
  88. package/sdk-core/protos/api_upstream/temporal/api/schedule/v1/message.proto +108 -29
  89. package/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +2 -2
  90. package/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +1 -0
  91. package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +47 -8
  92. package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +15 -1
  93. package/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +2 -0
  94. package/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +8 -1
  95. package/sdk-core/sdk/src/interceptors.rs +36 -3
  96. package/sdk-core/sdk/src/lib.rs +7 -4
  97. package/sdk-core/sdk/src/workflow_context.rs +13 -2
  98. package/sdk-core/sdk-core-protos/src/history_builder.rs +47 -1
  99. package/sdk-core/sdk-core-protos/src/history_info.rs +22 -22
  100. package/sdk-core/sdk-core-protos/src/lib.rs +49 -27
  101. package/sdk-core/test-utils/Cargo.toml +1 -0
  102. package/sdk-core/test-utils/src/lib.rs +81 -29
  103. package/sdk-core/tests/integ_tests/metrics_tests.rs +37 -0
  104. package/sdk-core/tests/integ_tests/polling_tests.rs +0 -13
  105. package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +145 -4
  106. package/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +53 -0
  107. package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +106 -20
  108. package/sdk-core/tests/integ_tests/workflow_tests.rs +18 -8
  109. package/sdk-core/tests/main.rs +6 -4
  110. package/src/conversions.rs +52 -47
  111. package/src/errors.rs +28 -86
  112. package/src/helpers.rs +3 -4
  113. package/src/lib.rs +2 -2
  114. package/src/runtime.rs +132 -61
  115. package/src/testing.rs +7 -4
  116. package/src/worker.rs +67 -50
  117. package/ts/errors.ts +55 -0
  118. package/{index.d.ts → ts/index.ts} +121 -15
  119. package/sdk-core/core/src/log_export.rs +0 -62
  120. package/sdk-core/core/src/worker/workflow/machines/mutable_side_effect_state_machine.rs +0 -127
  121. package/sdk-core/core/src/worker/workflow/machines/side_effect_state_machine.rs +0 -71
  122. package/sdk-core/protos/api_upstream/temporal/api/cluster/v1/message.proto +0 -83
  123. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/cluster.proto +0 -40
@@ -53,12 +53,10 @@ message BatchOperationInfo {
53
53
  // Keep the parameter in sync with temporal.api.workflowservice.v1.TerminateWorkflowExecutionRequest.
54
54
  // Ignore first_execution_run_id because this is used for single workflow operation.
55
55
  message BatchOperationTermination {
56
- // Reason of terminate workflows
57
- string reason = 1;
58
56
  // Serialized value(s) to provide to the termination event
59
- temporal.api.common.v1.Payloads details = 2;
57
+ temporal.api.common.v1.Payloads details = 1;
60
58
  // The identity of the worker/client
61
- string identity = 3;
59
+ string identity = 2;
62
60
  }
63
61
 
64
62
  // BatchOperationSignal sends signals to batch workflows.
@@ -79,8 +77,6 @@ message BatchOperationSignal {
79
77
  // Keep the parameter in sync with temporal.api.workflowservice.v1.RequestCancelWorkflowExecutionRequest.
80
78
  // Ignore first_execution_run_id because this is used for single workflow operation.
81
79
  message BatchOperationCancellation {
82
- // Reason of cancel workflows
83
- string reason = 1;
84
80
  // The identity of the worker/client
85
- string identity = 2;
81
+ string identity = 1;
86
82
  }
@@ -155,6 +155,13 @@ message UpsertWorkflowSearchAttributesCommandAttributes {
155
155
  temporal.api.common.v1.SearchAttributes search_attributes = 1;
156
156
  }
157
157
 
158
+ message ModifyWorkflowPropertiesCommandAttributes {
159
+ // If set, update the workflow memo with the provided values. The values will be merged with
160
+ // the existing memo. If the user wants to delete values, a default/empty Payload should be
161
+ // used as the value for the key being deleted.
162
+ temporal.api.common.v1.Memo upserted_memo = 1;
163
+ }
164
+
158
165
  message RecordMarkerCommandAttributes {
159
166
  string marker_name = 1;
160
167
  map<string, temporal.api.common.v1.Payloads> details = 2;
@@ -255,5 +262,6 @@ message Command {
255
262
  UpsertWorkflowSearchAttributesCommandAttributes upsert_workflow_search_attributes_command_attributes = 14;
256
263
  AcceptWorkflowUpdateCommandAttributes accept_workflow_update_command_attributes = 15;
257
264
  CompleteWorkflowUpdateCommandAttributes complete_workflow_update_command_attributes = 16;
265
+ ModifyWorkflowPropertiesCommandAttributes modify_workflow_properties_command_attributes = 17;
258
266
  }
259
267
  }
@@ -47,11 +47,10 @@ enum CommandType {
47
47
  COMMAND_TYPE_START_CHILD_WORKFLOW_EXECUTION = 11;
48
48
  COMMAND_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION = 12;
49
49
  COMMAND_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES = 13;
50
-
51
50
  // Indicates that an update has been accepted for processing workflow code
52
51
  COMMAND_TYPE_ACCEPT_WORKFLOW_UPDATE = 14;
53
-
54
52
  // Indicates that an update has completed and carries either the success or
55
53
  // failure outcome of said update.
56
54
  COMMAND_TYPE_COMPLETE_WORKFLOW_UPDATE = 15;
55
+ COMMAND_TYPE_MODIFY_WORKFLOW_PROPERTIES = 16;
57
56
  }
@@ -165,4 +165,6 @@ enum EventType {
165
165
  // The distinction of external vs. command-based modification is important so the SDK can
166
166
  // maintain determinism when using the command-based approach.
167
167
  EVENT_TYPE_ACTIVITY_PROPERTIES_MODIFIED_EXTERNALLY = 45;
168
+ // Workflow properties modified by user workflow code
169
+ EVENT_TYPE_WORKFLOW_PROPERTIES_MODIFIED = 46;
168
170
  }
@@ -66,6 +66,7 @@ enum WorkflowTaskFailedCause {
66
66
  // The worker encountered a mismatch while replaying history between what was expected, and
67
67
  // what the workflow code actually did.
68
68
  WORKFLOW_TASK_FAILED_CAUSE_NON_DETERMINISTIC_ERROR = 24;
69
+ WORKFLOW_TASK_FAILED_CAUSE_BAD_MODIFY_WORKFLOW_PROPERTIES_ATTRIBUTES = 25;
69
70
  }
70
71
 
71
72
  enum StartChildWorkflowExecutionFailedCause {
@@ -94,4 +95,6 @@ enum ResourceExhaustedCause {
94
95
  RESOURCE_EXHAUSTED_CAUSE_CONCURRENT_LIMIT = 2;
95
96
  // System overloaded.
96
97
  RESOURCE_EXHAUSTED_CAUSE_SYSTEM_OVERLOADED = 3;
98
+ // Namespace exceeds persistence rate limit.
99
+ RESOURCE_EXHAUSTED_CAUSE_PERSISTENCE_LIMIT = 4;
97
100
  }
@@ -192,6 +192,9 @@ message WorkflowTaskCompletedEventAttributes {
192
192
  string identity = 3;
193
193
  // Binary ID of the worker who completed this task
194
194
  string binary_checksum = 4;
195
+ // ID of the worker who picked up this workflow task, or missing if worker
196
+ // is not using versioning.
197
+ temporal.api.taskqueue.v1.VersionId worker_versioning_id = 5;
195
198
  }
196
199
 
197
200
  message WorkflowTaskTimedOutEventAttributes {
@@ -506,6 +509,15 @@ message UpsertWorkflowSearchAttributesEventAttributes {
506
509
  temporal.api.common.v1.SearchAttributes search_attributes = 2;
507
510
  }
508
511
 
512
+ message WorkflowPropertiesModifiedEventAttributes {
513
+ // The `WORKFLOW_TASK_COMPLETED` event which this command was reported with
514
+ int64 workflow_task_completed_event_id = 1;
515
+ // If set, update the workflow memo with the provided values. The values will be merged with
516
+ // the existing memo. If the user wants to delete values, a default/empty Payload should be
517
+ // used as the value for the key being deleted.
518
+ temporal.api.common.v1.Memo upserted_memo = 2;
519
+ }
520
+
509
521
  message StartChildWorkflowExecutionInitiatedEventAttributes {
510
522
  // Namespace of the child workflow.
511
523
  // SDKs and UI tools should use `namespace` field but server must use `namespace_id` only.
@@ -743,6 +755,7 @@ message HistoryEvent {
743
755
  WorkflowUpdateCompletedEventAttributes workflow_update_completed_event_attributes = 48;
744
756
  WorkflowPropertiesModifiedExternallyEventAttributes workflow_properties_modified_externally_event_attributes = 49;
745
757
  ActivityPropertiesModifiedExternallyEventAttributes activity_properties_modified_externally_event_attributes = 50;
758
+ WorkflowPropertiesModifiedEventAttributes workflow_properties_modified_event_attributes = 51;
746
759
  }
747
760
  }
748
761
 
@@ -31,15 +31,7 @@ option java_outer_classname = "RequestResponseProto";
31
31
  option ruby_package = "Temporal::Api::OperatorService::V1";
32
32
  option csharp_namespace = "Temporal.Api.OperatorService.V1";
33
33
 
34
- import "dependencies/gogoproto/gogo.proto";
35
- import "google/protobuf/timestamp.proto";
36
- import "google/protobuf/duration.proto";
37
-
38
- import "temporal/api/cluster/v1/message.proto";
39
- import "temporal/api/common/v1/message.proto";
40
- import "temporal/api/enums/v1/cluster.proto";
41
34
  import "temporal/api/enums/v1/common.proto";
42
- import "temporal/api/version/v1/message.proto";
43
35
 
44
36
  // (-- Search Attribute --)
45
37
 
@@ -84,21 +76,10 @@ message DeleteNamespaceResponse {
84
76
  string deleted_namespace = 1;
85
77
  }
86
78
 
87
- // (-- api-linter: core::0135::request-unknown-fields=disabled
88
- // aip.dev/not-precedent: DeleteNamespace RPC doesn't follow Google API format. --)
89
- // (-- api-linter: core::0135::request-name-required=disabled
90
- // aip.dev/not-precedent: DeleteNamespace RPC doesn't follow Google API format. --)
91
- message DeleteWorkflowExecutionRequest {
92
- string namespace = 1;
93
- // Workflow Execution to delete. If run_id is not specified, the latest one is used.
94
- temporal.api.common.v1.WorkflowExecution workflow_execution = 2;
95
- }
96
-
97
- message DeleteWorkflowExecutionResponse {
98
- }
99
-
100
79
  message AddOrUpdateRemoteClusterRequest {
80
+ // Frontend Address is a cross cluster accessible address.
101
81
  string frontend_address = 1;
82
+ // Flag to enable / disable the cross cluster connection.
102
83
  bool enable_remote_cluster_connection = 2;
103
84
  }
104
85
 
@@ -106,56 +87,35 @@ message AddOrUpdateRemoteClusterResponse {
106
87
  }
107
88
 
108
89
  message RemoveRemoteClusterRequest {
90
+ // Remote cluster name to be removed.
109
91
  string cluster_name = 1;
110
92
  }
111
93
 
112
94
  message RemoveRemoteClusterResponse {
113
95
  }
114
96
 
115
- message DescribeClusterRequest {
116
- string cluster_name = 1;
117
- }
118
-
119
- message DescribeClusterResponse {
120
- map<string,string> supported_clients = 1;
121
- string server_version = 2;
122
- temporal.api.cluster.v1.MembershipInfo membership_info = 3;
123
- string cluster_id = 4;
124
- string cluster_name = 5;
125
- int32 history_shard_count = 6;
126
- string persistence_store = 7;
127
- string visibility_store = 8;
128
- temporal.api.version.v1.VersionInfo version_info = 9;
129
- int64 failover_version_increment = 10;
130
- int64 initial_failover_version = 11;
131
- bool is_global_namespace_enabled = 12;
132
- }
133
-
134
97
  message ListClustersRequest {
135
98
  int32 page_size = 1;
136
99
  bytes next_page_token = 2;
137
100
  }
138
101
 
139
102
  message ListClustersResponse {
140
- repeated temporal.api.cluster.v1.ClusterMetadata clusters = 1;
141
- bytes next_page_token = 2;
142
- }
143
-
144
- message ListClusterMembersRequest {
145
- // (-- api-linter: core::0140::prepositions=disabled
146
- // aip.dev/not-precedent: "within" is used to indicate a time range. --)
147
- google.protobuf.Duration last_heartbeat_within = 1 [(gogoproto.stdduration) = true];
148
- string rpc_address = 2;
149
- string host_id = 3;
150
- temporal.api.enums.v1.ClusterMemberRole role = 4;
151
- // (-- api-linter: core::0140::prepositions=disabled
152
- // aip.dev/not-precedent: "after" is used to indicate a time range. --)
153
- google.protobuf.Timestamp session_started_after_time = 5 [(gogoproto.stdtime) = true];
154
- int32 page_size = 6;
155
- bytes next_page_token = 7;
103
+ // List of all cluster information
104
+ repeated ClusterMetadata clusters = 1;
105
+ bytes next_page_token = 4;
156
106
  }
157
107
 
158
- message ListClusterMembersResponse {
159
- repeated temporal.api.cluster.v1.ClusterMember active_members = 1;
160
- bytes next_page_token = 2;
108
+ message ClusterMetadata {
109
+ // Name of the cluster name.
110
+ string cluster_name = 1;
111
+ // Id of the cluster.
112
+ string cluster_id = 2;
113
+ // Cluster accessible address.
114
+ string address = 3;
115
+ // A unique failover version across all connected clusters.
116
+ int64 initial_failover_version = 4;
117
+ // History service shard number.
118
+ int32 history_shard_count = 5;
119
+ // A flag to indicate if a connection is active.
120
+ bool is_connection_enabled = 6;
161
121
  }
@@ -66,17 +66,6 @@ service OperatorService {
66
66
  rpc DeleteNamespace (DeleteNamespaceRequest) returns (DeleteNamespaceResponse) {
67
67
  }
68
68
 
69
- // DeleteWorkflowExecution asynchronously deletes a specific Workflow Execution (when
70
- // WorkflowExecution.run_id is provided) or the latest Workflow Execution (when
71
- // WorkflowExecution.run_id is not provided). If the Workflow Execution is Running, it will be
72
- // terminated before deletion.
73
- // (-- api-linter: core::0135::method-signature=disabled
74
- // aip.dev/not-precedent: DeleteNamespace RPC doesn't follow Google API format. --)
75
- // (-- api-linter: core::0135::response-message-name=disabled
76
- // aip.dev/not-precedent: DeleteNamespace RPC doesn't follow Google API format. --)
77
- rpc DeleteWorkflowExecution (DeleteWorkflowExecutionRequest) returns (DeleteWorkflowExecutionResponse) {
78
- }
79
-
80
69
  // AddOrUpdateRemoteCluster adds or updates remote cluster.
81
70
  rpc AddOrUpdateRemoteCluster(AddOrUpdateRemoteClusterRequest) returns (AddOrUpdateRemoteClusterResponse) {
82
71
  }
@@ -85,15 +74,7 @@ service OperatorService {
85
74
  rpc RemoveRemoteCluster(RemoveRemoteClusterRequest) returns (RemoveRemoteClusterResponse) {
86
75
  }
87
76
 
88
- // DescribeCluster returns information about Temporal cluster.
89
- rpc DescribeCluster(DescribeClusterRequest) returns (DescribeClusterResponse) {
90
- }
91
-
92
77
  // ListClusters returns information about Temporal clusters.
93
78
  rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) {
94
79
  }
95
-
96
- // ListClusterMembers returns information about Temporal cluster members.
97
- rpc ListClusterMembers(ListClusterMembersRequest) returns (ListClusterMembersResponse) {
98
- }
99
80
  }
@@ -20,6 +20,11 @@
20
20
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
21
  // THE SOFTWARE.
22
22
 
23
+ // (-- api-linter: core::0203::optional=disabled
24
+ // aip.dev/not-precedent: field_behavior annotation not available in our gogo fork --)
25
+ // (-- api-linter: core::0203::input-only=disabled
26
+ // aip.dev/not-precedent: field_behavior annotation not available in our gogo fork --)
27
+
23
28
  syntax = "proto3";
24
29
 
25
30
  package temporal.api.schedule.v1;
@@ -41,7 +46,8 @@ import "temporal/api/enums/v1/schedule.proto";
41
46
  import "temporal/api/workflow/v1/message.proto";
42
47
 
43
48
  // CalendarSpec describes an event specification relative to the calendar,
44
- // similar to a traditional cron specification. Each field can be one of:
49
+ // similar to a traditional cron specification, but with labeled fields. Each
50
+ // field can be one of:
45
51
  // *: matches always
46
52
  // x: matches when the field equals x
47
53
  // x/y : matches when the field equals x+n*y where n is an integer
@@ -49,13 +55,14 @@ import "temporal/api/workflow/v1/message.proto";
49
55
  // w,x,y,...: matches when the field is one of the listed values
50
56
  // Each x, y, z, ... is either a decimal integer, or a month or day of week name
51
57
  // or abbreviation (in the appropriate fields).
52
- // A second in time matches if all fields match.
58
+ // A timestamp matches if all fields match.
59
+ // Note that fields have different default values, for convenience.
53
60
  // Note that the special case that some cron implementations have for treating
54
61
  // day_of_month and day_of_week as "or" instead of "and" when both are set is
55
62
  // not implemented.
56
63
  // day_of_week can accept 0 or 7 as Sunday
57
- // TODO: add relative-to-end-of-month
58
- // TODO: add nth day-of-week in month
64
+ // CalendarSpec gets compiled into StructuredCalendarSpec, which is what will be
65
+ // returned if you describe the schedule.
59
66
  message CalendarSpec {
60
67
  // Expression to match seconds. Default: 0
61
68
  string second = 1;
@@ -73,6 +80,51 @@ message CalendarSpec {
73
80
  string year = 6;
74
81
  // Expression to match days of the week. Default: *
75
82
  string day_of_week = 7;
83
+ // Free-form comment describing the intention of this spec.
84
+ string comment = 8;
85
+ }
86
+
87
+ // Range represents a set of integer values, used to match fields of a calendar
88
+ // time in StructuredCalendarSpec. If end < start, then end is interpreted as
89
+ // equal to start. This means you can use a Range with start set to a value, and
90
+ // end and step unset (defaulting to 0) to represent a single value.
91
+ message Range {
92
+ // Start of range (inclusive).
93
+ int32 start = 1;
94
+ // End of range (inclusive).
95
+ int32 end = 2;
96
+ // Step (optional, default 1).
97
+ int32 step = 3;
98
+ }
99
+
100
+ // StructuredCalendarSpec describes an event specification relative to the
101
+ // calendar, in a form that's easy to work with programmatically. Each field can
102
+ // be one or more ranges.
103
+ // A timestamp matches if at least one range of each field matches the
104
+ // corresponding fields of the timestamp, except for year: if year is missing,
105
+ // that means all years match. For all fields besides year, at least one Range
106
+ // must be present to match anything.
107
+ // TODO: add relative-to-end-of-month
108
+ // TODO: add nth day-of-week in month
109
+ message StructuredCalendarSpec {
110
+ // Match seconds (0-59)
111
+ repeated Range second = 1;
112
+ // Match minutes (0-59)
113
+ repeated Range minute = 2;
114
+ // Match hours (0-23)
115
+ repeated Range hour = 3;
116
+ // Match days of the month (1-31)
117
+ // (-- api-linter: core::0140::prepositions=disabled
118
+ // aip.dev/not-precedent: standard name of field --)
119
+ repeated Range day_of_month = 4;
120
+ // Match months (1-12)
121
+ repeated Range month = 5;
122
+ // Match years.
123
+ repeated Range year = 6;
124
+ // Match days of the week (0-6; 0 is Sunday).
125
+ repeated Range day_of_week = 7;
126
+ // Free-form comment describing the intention of this spec.
127
+ string comment = 8;
76
128
  }
77
129
 
78
130
  // IntervalSpec matches times that can be expressed as:
@@ -97,24 +149,56 @@ message IntervalSpec {
97
149
  // definition of a time zone can change over time (most commonly, when daylight
98
150
  // saving time policy changes for an area). To create a totally self-contained
99
151
  // ScheduleSpec, use UTC or include timezone_data.
152
+ //
153
+ // For input, you can provide zero or more of: structured_calendar, calendar,
154
+ // cron_string, interval, and exclude_structured_calendar, and all of them will
155
+ // be used (the schedule will take action at the union of all of their times,
156
+ // minus the ones that match exclude_structured_calendar).
157
+ //
158
+ // On input, calendar and cron_string fields will be compiled into
159
+ // structured_calendar (and maybe interval and timezone_name), so if you
160
+ // Describe a schedule, you'll see only structured_calendar, interval, etc.
100
161
  message ScheduleSpec {
162
+ // Calendar-based specifications of times.
163
+ repeated StructuredCalendarSpec structured_calendar = 7;
164
+ // cron_string holds a traditional cron specification as a string. It
165
+ // accepts 5, 6, or 7 fields, separated by spaces, and interprets them the
166
+ // same way as CalendarSpec.
167
+ // 5 fields: minute, hour, day_of_month, month, day_of_week
168
+ // 6 fields: minute, hour, day_of_month, month, day_of_week, year
169
+ // 7 fields: second, minute, hour, day_of_month, month, day_of_week, year
170
+ // If year is not given, it defaults to *. If second is not given, it
171
+ // defaults to 0.
172
+ // Shorthands @yearly, @monthly, @weekly, @daily, and @hourly are also
173
+ // accepted instead of the 5-7 time fields.
174
+ // Optionally, the string can be preceded by CRON_TZ=<timezone name> or
175
+ // TZ=<timezone name>, which will get copied to timezone_name. (There must
176
+ // not also be a timezone_name present.)
177
+ // Optionally "#" followed by a comment can appear at the end of the string.
178
+ // Note that the special case that some cron implementations have for
179
+ // treating day_of_month and day_of_week as "or" instead of "and" when both
180
+ // are set is not implemented.
181
+ // @every <interval>[/<phase>] is accepted and gets compiled into an
182
+ // IntervalSpec instead. <interval> and <phase> should be a decimal integer
183
+ // with a unit suffix s, m, h, or d.
184
+ repeated string cron_string = 8;
101
185
  // Calendar-based specifications of times.
102
186
  repeated CalendarSpec calendar = 1;
103
187
  // Interval-based specifications of times.
104
188
  repeated IntervalSpec interval = 2;
105
- // Any timestamps matching any of the exclude_calendar specs will be
106
- // skipped.
107
- repeated CalendarSpec exclude_calendar = 3;
108
- // Any timestamps before start_time will be skipped. Together, start_time
109
- // and end_time make an inclusive interval.
189
+ // Any timestamps matching any of exclude_* will be skipped.
190
+ repeated CalendarSpec exclude_calendar = 3 [deprecated = true]; // use exclude_structured_calendar
191
+ repeated StructuredCalendarSpec exclude_structured_calendar = 9;
192
+ // If start_time is set, any timestamps before start_time will be skipped.
193
+ // (Together, start_time and end_time make an inclusive interval.)
110
194
  google.protobuf.Timestamp start_time = 4 [(gogoproto.stdtime) = true];
111
- // Any timestamps after end_time will be skipped.
195
+ // If end_time is set, any timestamps after end_time will be skipped.
112
196
  google.protobuf.Timestamp end_time = 5 [(gogoproto.stdtime) = true];
113
197
  // All timestamps will be incremented by a random value from 0 to this
114
- // amount of jitter. Default: 1 second
198
+ // amount of jitter. Default: 0
115
199
  google.protobuf.Duration jitter = 6 [(gogoproto.stdduration) = true];
116
200
 
117
- // Time zone to interpret all CalendarSpecs in.
201
+ // Time zone to interpret all calendar-based specs in.
118
202
  //
119
203
  // If unset, defaults to UTC. We recommend using UTC for your application if
120
204
  // at all possible, to avoid various surprising properties of time zones.
@@ -134,21 +218,17 @@ message ScheduleSpec {
134
218
  // at 2:30am and specify a time zone that follows DST, that action will not
135
219
  // be triggered on the day that has no 2:30am. Similarly, an action that
136
220
  // fires at 1:30am will be triggered twice on the day that has two 1:30s.
221
+ //
222
+ // Also note that no actions are taken on leap-seconds (e.g. 23:59:60 UTC).
137
223
  string timezone_name = 10;
138
224
  bytes timezone_data = 11;
139
225
  }
140
226
 
141
227
  message SchedulePolicies {
142
228
  // Policy for overlaps.
143
- // Note that this can be changed after a schedule has taken some actions, and we can't
144
- // provide 100% sensible semantics for all changes. The most confusing case would be
145
- // changes to/from ALLOW_ALL: with that policy multiple scheduled workflows can run
146
- // concurrently, but for all other policies only one can run at a time. Changing
147
- // between these two classes will leave all workflows with the other class alone.
148
- // E.g., if changing from ALLOW_ALL to CANCEL_OTHER, and there are workflows running,
149
- // those workflows will not be cancelled. If changing from ALLOW_ALL to SKIP with
150
- // workflows running, the running workflows will not cause the next action to be
151
- // skipped.
229
+ // Note that this can be changed after a schedule has taken some actions,
230
+ // and some changes might produce unintuitive results. In general, the later
231
+ // policy overrides the earlier policy.
152
232
  temporal.api.enums.v1.ScheduleOverlapPolicy overlap_policy = 1;
153
233
 
154
234
  // Policy for catchups:
@@ -195,10 +275,11 @@ message ScheduleState {
195
275
  // If true, do not take any actions based on the schedule spec.
196
276
  bool paused = 2;
197
277
 
198
- // If limited_actions is true, decrement remaining_actions after each action, and do
199
- // not take any more scheduled actions if remaining_actions is zero. Actions may still
200
- // be taken by explicit request. Skipped actions (due to overlap policy) do not count
201
- // against remaining actions.
278
+ // If limited_actions is true, decrement remaining_actions after each
279
+ // action, and do not take any more scheduled actions if remaining_actions
280
+ // is zero. Actions may still be taken by explicit request (i.e. trigger
281
+ // immediately or backfill). Skipped actions (due to overlap policy) do not
282
+ // count against remaining actions.
202
283
  bool limited_actions = 3;
203
284
  int64 remaining_actions = 4;
204
285
  }
@@ -258,8 +339,7 @@ message ScheduleInfo {
258
339
  google.protobuf.Timestamp create_time = 6 [(gogoproto.stdtime) = true];
259
340
  google.protobuf.Timestamp update_time = 7 [(gogoproto.stdtime) = true];
260
341
 
261
- // Error for invalid schedule. If this is set, no actions will be taken.
262
- string invalid_schedule_error = 8;
342
+ string invalid_schedule_error = 8 [deprecated = true];
263
343
  }
264
344
 
265
345
  message Schedule {
@@ -273,8 +353,7 @@ message Schedule {
273
353
  // that's returned in ListSchedules.
274
354
  message ScheduleListInfo {
275
355
  // From spec:
276
- // Some fields are too large/unimportant for the purpose of listing, so we'll clear them
277
- // from this copy of spec: exclude_calendar, jitter, timezone_data.
356
+ // Some fields are dropped from this copy of spec: timezone_data
278
357
  ScheduleSpec spec = 1;
279
358
 
280
359
  // From action:
@@ -77,7 +77,7 @@ message PollerInfo {
77
77
  double rate_per_second = 3;
78
78
  // If a worker has specified an ID for use with the worker versioning feature while polling,
79
79
  // that id must appear here.
80
- string worker_versioning_build_id = 4;
80
+ VersionId worker_versioning_id = 4;
81
81
  }
82
82
 
83
83
  message StickyExecutionAttributes {
@@ -98,7 +98,7 @@ message VersionIdNode {
98
98
  }
99
99
 
100
100
  // Used by the worker versioning APIs, represents a specific version of something
101
- // Currently, that's just a whole-worker id. In the future, if we support
101
+ // Currently, that's just a whole-worker id. In the future, if we support
102
102
  // WASM workflow bundle based versioning, for example, then the inside of this
103
103
  // message may become a oneof of different version types.
104
104
  message VersionId {
@@ -56,6 +56,7 @@ message WorkflowExecutionInfo {
56
56
  ResetPoints auto_reset_points = 12;
57
57
  string task_queue = 13;
58
58
  int64 state_transition_count = 14;
59
+ int64 history_size_bytes = 15;
59
60
  }
60
61
 
61
62
  message WorkflowExecutionConfig {
@@ -222,11 +222,11 @@ message PollWorkflowTaskQueueRequest {
222
222
  // "checksum" in this field name isn't very accurate, it should be though of as an id.
223
223
  string binary_checksum = 4;
224
224
  // If set, the worker is opting in to build-id based versioning and wishes to only
225
- // receive tasks that are considered compatible with the version provided in the string.
225
+ // receive tasks that are considered compatible with the version provided.
226
226
  // Doing so only makes sense in conjunction with the `UpdateWorkerBuildIdOrdering` API.
227
- // When set, and `binary_checksum` is not, this value should also be considered as the
228
- // `binary_checksum`.
229
- string worker_versioning_build_id = 5;
227
+ // When `worker_versioning_id` has a `worker_build_id`, and `binary_checksum` is not
228
+ // set, that value should also be considered as the `binary_checksum`.
229
+ temporal.api.taskqueue.v1.VersionId worker_versioning_id = 5;
230
230
  }
231
231
 
232
232
  message PollWorkflowTaskQueueResponse {
@@ -292,6 +292,11 @@ message RespondWorkflowTaskCompletedRequest {
292
292
  // Responses to the `queries` field in the task being responded to
293
293
  map<string, temporal.api.query.v1.WorkflowQueryResult> query_results = 8;
294
294
  string namespace = 9;
295
+ // If using versioning, worker should send the same id here that it used to
296
+ // poll for the workflow task.
297
+ // When `worker_versioning_id` has a `worker_build_id`, and `binary_checksum` is not
298
+ // set, that value should also be considered as the `binary_checksum`.
299
+ temporal.api.taskqueue.v1.VersionId worker_versioning_id = 10;
295
300
  }
296
301
 
297
302
  message RespondWorkflowTaskCompletedResponse {
@@ -326,9 +331,9 @@ message PollActivityTaskQueueRequest {
326
331
  string identity = 3;
327
332
  temporal.api.taskqueue.v1.TaskQueueMetadata task_queue_metadata = 4;
328
333
  // If set, the worker is opting in to build-id based versioning and wishes to only
329
- // receive tasks that are considered compatible with the version provided in the string.
334
+ // receive tasks that are considered compatible with the version provided.
330
335
  // Doing so only makes sense in conjunction with the `UpdateWorkerBuildIdOrdering` API.
331
- string worker_versioning_build_id = 5;
336
+ temporal.api.taskqueue.v1.VersionId worker_versioning_id = 5;
332
337
  }
333
338
 
334
339
  message PollActivityTaskQueueResponse {
@@ -630,6 +635,19 @@ message TerminateWorkflowExecutionRequest {
630
635
  message TerminateWorkflowExecutionResponse {
631
636
  }
632
637
 
638
+ // (-- api-linter: core::0135::request-unknown-fields=disabled
639
+ // aip.dev/not-precedent: DeleteNamespace RPC doesn't follow Google API format. --)
640
+ // (-- api-linter: core::0135::request-name-required=disabled
641
+ // aip.dev/not-precedent: DeleteNamespace RPC doesn't follow Google API format. --)
642
+ message DeleteWorkflowExecutionRequest {
643
+ string namespace = 1;
644
+ // Workflow Execution to delete. If run_id is not specified, the latest one is used.
645
+ temporal.api.common.v1.WorkflowExecution workflow_execution = 2;
646
+ }
647
+
648
+ message DeleteWorkflowExecutionResponse {
649
+ }
650
+
633
651
  message ListOpenWorkflowExecutionsRequest {
634
652
  string namespace = 1;
635
653
  int32 maximum_page_size = 2;
@@ -821,6 +839,14 @@ message GetSystemInfoResponse {
821
839
 
822
840
  // True if server uses protos that include temporal.api.failure.v1.Failure.encoded_attributes
823
841
  bool encoded_failure_attributes = 5;
842
+
843
+ // True if server supports dispatching Workflow and Activity tasks based on a worker's build_id
844
+ // (see:
845
+ // https://github.com/temporalio/proposals/blob/a123af3b559f43db16ea6dd31870bfb754c4dc5e/versioning/worker-versions.md)
846
+ bool build_id_based_versioning = 6;
847
+
848
+ // True if server supports upserting workflow memo
849
+ bool upsert_memo = 7;
824
850
  }
825
851
  }
826
852
 
@@ -874,6 +900,9 @@ message DescribeScheduleRequest {
874
900
  message DescribeScheduleResponse {
875
901
  // The complete current schedule details. This may not match the schedule as
876
902
  // created because:
903
+ // - some types of schedule specs may get compiled into others (e.g.
904
+ // CronString into StructuredCalendarSpec)
905
+ // - some unspecified fields may be replaced by defaults
877
906
  // - some fields in the state are modified automatically
878
907
  // - the schedule may have been modified by UpdateSchedule or PatchSchedule
879
908
  temporal.api.schedule.v1.Schedule schedule = 1;
@@ -1059,6 +1088,10 @@ message StartBatchOperationRequest {
1059
1088
  string namespace = 1;
1060
1089
  // Visibility query defines the the group of workflow to do batch operation
1061
1090
  string visibility_query = 2;
1091
+ // Job ID defines the unique ID for the batch job
1092
+ string job_id = 3;
1093
+ // Reason to perform the batch operation
1094
+ string reason = 4;
1062
1095
  // Operation input
1063
1096
  oneof operation {
1064
1097
  temporal.api.batch.v1.BatchOperationTermination termination_operation = 10;
@@ -1068,8 +1101,6 @@ message StartBatchOperationRequest {
1068
1101
  }
1069
1102
 
1070
1103
  message StartBatchOperationResponse {
1071
- // Batch job id
1072
- string job_id = 1;
1073
1104
  }
1074
1105
 
1075
1106
  message StopBatchOperationRequest {
@@ -1077,6 +1108,10 @@ message StopBatchOperationRequest {
1077
1108
  string namespace = 1;
1078
1109
  // Batch job id
1079
1110
  string job_id = 2;
1111
+ // Reason to stop a batch operation
1112
+ string reason = 3;
1113
+ // Identity of the operator
1114
+ string identity = 4;
1080
1115
  }
1081
1116
 
1082
1117
  message StopBatchOperationResponse {
@@ -1106,6 +1141,10 @@ message DescribeBatchOperationResponse {
1106
1141
  int64 complete_operation_count = 7;
1107
1142
  // Failure operation count
1108
1143
  int64 failure_operation_count = 8;
1144
+ // Identity indicates the operator identity
1145
+ string identity = 9;
1146
+ // Reason indicates the reason to stop a operation
1147
+ string reason = 10;
1109
1148
  }
1110
1149
 
1111
1150
  message ListBatchOperationsRequest {