@temporalio/core-bridge 0.23.0 → 1.0.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 (135) hide show
  1. package/Cargo.lock +118 -15
  2. package/Cargo.toml +2 -1
  3. package/LICENSE.md +1 -1
  4. package/README.md +1 -1
  5. package/index.d.ts +47 -18
  6. package/package.json +7 -7
  7. package/releases/aarch64-apple-darwin/index.node +0 -0
  8. package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
  9. package/releases/x86_64-apple-darwin/index.node +0 -0
  10. package/releases/x86_64-pc-windows-msvc/index.node +0 -0
  11. package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
  12. package/sdk-core/.buildkite/docker/docker-compose.yaml +4 -2
  13. package/sdk-core/ARCHITECTURE.md +9 -7
  14. package/sdk-core/README.md +5 -1
  15. package/sdk-core/arch_docs/diagrams/workflow_internals.svg +1 -0
  16. package/sdk-core/bridge-ffi/src/wrappers.rs +0 -3
  17. package/sdk-core/client/src/lib.rs +26 -8
  18. package/sdk-core/client/src/raw.rs +166 -54
  19. package/sdk-core/client/src/retry.rs +9 -4
  20. package/sdk-core/client/src/workflow_handle/mod.rs +4 -2
  21. package/sdk-core/core/Cargo.toml +2 -0
  22. package/sdk-core/core/src/abstractions.rs +137 -16
  23. package/sdk-core/core/src/core_tests/activity_tasks.rs +258 -63
  24. package/sdk-core/core/src/core_tests/child_workflows.rs +1 -2
  25. package/sdk-core/core/src/core_tests/determinism.rs +2 -2
  26. package/sdk-core/core/src/core_tests/local_activities.rs +8 -7
  27. package/sdk-core/core/src/core_tests/queries.rs +146 -60
  28. package/sdk-core/core/src/core_tests/replay_flag.rs +1 -1
  29. package/sdk-core/core/src/core_tests/workers.rs +39 -23
  30. package/sdk-core/core/src/core_tests/workflow_cancels.rs +1 -1
  31. package/sdk-core/core/src/core_tests/workflow_tasks.rs +387 -280
  32. package/sdk-core/core/src/lib.rs +6 -4
  33. package/sdk-core/core/src/pollers/poll_buffer.rs +16 -10
  34. package/sdk-core/core/src/protosext/mod.rs +6 -6
  35. package/sdk-core/core/src/retry_logic.rs +1 -1
  36. package/sdk-core/core/src/telemetry/metrics.rs +21 -7
  37. package/sdk-core/core/src/telemetry/mod.rs +18 -4
  38. package/sdk-core/core/src/test_help/mod.rs +341 -109
  39. package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +18 -9
  40. package/sdk-core/core/src/worker/activities/local_activities.rs +19 -16
  41. package/sdk-core/core/src/worker/activities.rs +156 -29
  42. package/sdk-core/core/src/worker/client.rs +1 -0
  43. package/sdk-core/core/src/worker/mod.rs +132 -659
  44. package/sdk-core/core/src/{workflow → worker/workflow}/bridge.rs +1 -1
  45. package/sdk-core/core/src/{workflow → worker/workflow}/driven_workflow.rs +1 -1
  46. package/sdk-core/core/src/{workflow → worker/workflow}/history_update.rs +16 -2
  47. package/sdk-core/core/src/{workflow → worker/workflow}/machines/activity_state_machine.rs +39 -4
  48. package/sdk-core/core/src/{workflow → worker/workflow}/machines/cancel_external_state_machine.rs +5 -2
  49. package/sdk-core/core/src/{workflow → worker/workflow}/machines/cancel_workflow_state_machine.rs +1 -1
  50. package/sdk-core/core/src/{workflow → worker/workflow}/machines/child_workflow_state_machine.rs +2 -4
  51. package/sdk-core/core/src/{workflow → worker/workflow}/machines/complete_workflow_state_machine.rs +0 -0
  52. package/sdk-core/core/src/{workflow → worker/workflow}/machines/continue_as_new_workflow_state_machine.rs +1 -1
  53. package/sdk-core/core/src/{workflow → worker/workflow}/machines/fail_workflow_state_machine.rs +0 -0
  54. package/sdk-core/core/src/{workflow → worker/workflow}/machines/local_activity_state_machine.rs +2 -5
  55. package/sdk-core/core/src/{workflow → worker/workflow}/machines/mod.rs +1 -1
  56. package/sdk-core/core/src/{workflow → worker/workflow}/machines/mutable_side_effect_state_machine.rs +0 -0
  57. package/sdk-core/core/src/{workflow → worker/workflow}/machines/patch_state_machine.rs +1 -1
  58. package/sdk-core/core/src/{workflow → worker/workflow}/machines/side_effect_state_machine.rs +0 -0
  59. package/sdk-core/core/src/{workflow → worker/workflow}/machines/signal_external_state_machine.rs +4 -2
  60. package/sdk-core/core/src/{workflow → worker/workflow}/machines/timer_state_machine.rs +1 -2
  61. package/sdk-core/core/src/{workflow → worker/workflow}/machines/transition_coverage.rs +1 -1
  62. package/sdk-core/core/src/{workflow → worker/workflow}/machines/upsert_search_attributes_state_machine.rs +5 -7
  63. package/sdk-core/core/src/{workflow → worker/workflow}/machines/workflow_machines/local_acts.rs +2 -2
  64. package/sdk-core/core/src/{workflow → worker/workflow}/machines/workflow_machines.rs +40 -16
  65. package/sdk-core/core/src/{workflow → worker/workflow}/machines/workflow_task_state_machine.rs +0 -0
  66. package/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +198 -0
  67. package/sdk-core/core/src/worker/workflow/managed_run.rs +627 -0
  68. package/sdk-core/core/src/worker/workflow/mod.rs +1115 -0
  69. package/sdk-core/core/src/worker/workflow/run_cache.rs +143 -0
  70. package/sdk-core/core/src/worker/workflow/wft_poller.rs +88 -0
  71. package/sdk-core/core/src/worker/workflow/workflow_stream.rs +936 -0
  72. package/sdk-core/core-api/src/errors.rs +3 -10
  73. package/sdk-core/core-api/src/lib.rs +2 -1
  74. package/sdk-core/core-api/src/worker.rs +26 -2
  75. package/sdk-core/etc/dynamic-config.yaml +2 -0
  76. package/sdk-core/integ-with-otel.sh +1 -1
  77. package/sdk-core/protos/api_upstream/Makefile +4 -4
  78. package/sdk-core/protos/api_upstream/api-linter.yaml +2 -0
  79. package/sdk-core/protos/api_upstream/buf.yaml +8 -9
  80. package/sdk-core/protos/api_upstream/temporal/api/cluster/v1/message.proto +83 -0
  81. package/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +7 -1
  82. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/cluster.proto +40 -0
  83. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +3 -0
  84. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +3 -1
  85. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/schedule.proto +60 -0
  86. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +3 -0
  87. package/sdk-core/protos/api_upstream/temporal/api/errordetails/v1/message.proto +32 -4
  88. package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +69 -19
  89. package/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +13 -0
  90. package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +163 -0
  91. package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +97 -0
  92. package/sdk-core/protos/api_upstream/temporal/api/schedule/v1/message.proto +300 -0
  93. package/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +25 -0
  94. package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +180 -3
  95. package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +53 -3
  96. package/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +2 -2
  97. package/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +6 -5
  98. package/sdk-core/protos/local/temporal/sdk/core/bridge/bridge.proto +0 -1
  99. package/sdk-core/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +2 -1
  100. package/sdk-core/protos/local/temporal/sdk/core/common/common.proto +0 -64
  101. package/sdk-core/protos/local/temporal/sdk/core/core_interface.proto +2 -1
  102. package/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +11 -8
  103. package/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +30 -25
  104. package/sdk-core/sdk/src/activity_context.rs +12 -5
  105. package/sdk-core/sdk/src/app_data.rs +37 -0
  106. package/sdk-core/sdk/src/lib.rs +76 -43
  107. package/sdk-core/sdk/src/workflow_context/options.rs +8 -6
  108. package/sdk-core/sdk/src/workflow_context.rs +14 -19
  109. package/sdk-core/sdk/src/workflow_future.rs +11 -6
  110. package/sdk-core/sdk-core-protos/src/history_builder.rs +19 -5
  111. package/sdk-core/sdk-core-protos/src/history_info.rs +11 -6
  112. package/sdk-core/sdk-core-protos/src/lib.rs +74 -176
  113. package/sdk-core/test-utils/src/lib.rs +85 -72
  114. package/sdk-core/tests/integ_tests/heartbeat_tests.rs +11 -9
  115. package/sdk-core/tests/integ_tests/polling_tests.rs +12 -0
  116. package/sdk-core/tests/integ_tests/queries_tests.rs +39 -22
  117. package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +49 -4
  118. package/sdk-core/tests/integ_tests/workflow_tests/appdata_propagation.rs +61 -0
  119. package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +1 -1
  120. package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +74 -13
  121. package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +19 -0
  122. package/sdk-core/tests/integ_tests/workflow_tests/resets.rs +1 -1
  123. package/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +6 -3
  124. package/sdk-core/tests/integ_tests/workflow_tests.rs +10 -23
  125. package/sdk-core/tests/load_tests.rs +8 -3
  126. package/sdk-core/tests/main.rs +2 -1
  127. package/src/conversions.rs +47 -39
  128. package/src/errors.rs +10 -21
  129. package/src/lib.rs +342 -325
  130. package/sdk-core/core/src/pending_activations.rs +0 -173
  131. package/sdk-core/core/src/worker/wft_delivery.rs +0 -81
  132. package/sdk-core/core/src/workflow/mod.rs +0 -478
  133. package/sdk-core/core/src/workflow/workflow_tasks/cache_manager.rs +0 -194
  134. package/sdk-core/core/src/workflow/workflow_tasks/concurrency_manager.rs +0 -418
  135. package/sdk-core/core/src/workflow/workflow_tasks/mod.rs +0 -989
@@ -0,0 +1,300 @@
1
+ // The MIT License
2
+ //
3
+ // Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
4
+ //
5
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ // of this software and associated documentation files (the "Software"), to deal
7
+ // in the Software without restriction, including without limitation the rights
8
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ // copies of the Software, and to permit persons to whom the Software is
10
+ // furnished to do so, subject to the following conditions:
11
+ //
12
+ // The above copyright notice and this permission notice shall be included in
13
+ // all copies or substantial portions of the Software.
14
+ //
15
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ // THE SOFTWARE.
22
+
23
+ syntax = "proto3";
24
+
25
+ package temporal.api.schedule.v1;
26
+
27
+ option go_package = "go.temporal.io/api/schedule/v1;schedule";
28
+ option java_package = "io.temporal.api.schedule.v1";
29
+ option java_multiple_files = true;
30
+ option java_outer_classname = "MessageProto";
31
+ option ruby_package = "Temporal::Api::Schedule::V1";
32
+ option csharp_namespace = "Temporal.Api.Schedule.V1";
33
+
34
+ import "google/protobuf/duration.proto";
35
+ import "google/protobuf/timestamp.proto";
36
+
37
+ import "dependencies/gogoproto/gogo.proto";
38
+
39
+ import "temporal/api/common/v1/message.proto";
40
+ import "temporal/api/enums/v1/schedule.proto";
41
+ import "temporal/api/workflow/v1/message.proto";
42
+
43
+ // CalendarSpec describes an event specification relative to the calendar,
44
+ // similar to a traditional cron specification. Each field can be one of:
45
+ // *: matches always
46
+ // x: matches when the field equals x
47
+ // x/y : matches when the field equals x+n*y where n is an integer
48
+ // x-z: matches when the field is between x and z inclusive
49
+ // w,x,y,...: matches when the field is one of the listed values
50
+ // Each x, y, z, ... is either a decimal integer, or a month or day of week name
51
+ // or abbreviation (in the appropriate fields).
52
+ // A second in time matches if all fields match.
53
+ // Note that the special case that some cron implementations have for treating
54
+ // day_of_month and day_of_week as "or" instead of "and" when both are set is
55
+ // not implemented.
56
+ // 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
59
+ message CalendarSpec {
60
+ // Expression to match seconds. Default: 0
61
+ string second = 1;
62
+ // Expression to match minutes. Default: 0
63
+ string minute = 2;
64
+ // Expression to match hours. Default: 0
65
+ string hour = 3;
66
+ // Expression to match days of the month. Default: *
67
+ // (-- api-linter: core::0140::prepositions=disabled
68
+ // aip.dev/not-precedent: standard name of field --)
69
+ string day_of_month = 4;
70
+ // Expression to match months. Default: *
71
+ string month = 5;
72
+ // Expression to match years. Default: *
73
+ string year = 6;
74
+ // Expression to match days of the week. Default: *
75
+ string day_of_week = 7;
76
+ }
77
+
78
+ // IntervalSpec matches times that can be expressed as:
79
+ // epoch + n * interval + phase
80
+ // where n is an integer.
81
+ // phase defaults to zero if missing. interval is required.
82
+ // Both interval and phase must be non-negative and are truncated to the nearest
83
+ // second before any calculations.
84
+ // For example, an interval of 1 hour with phase of zero would match every hour,
85
+ // on the hour. The same interval but a phase of 19 minutes would match every
86
+ // xx:19:00. An interval of 28 days with phase zero would match
87
+ // 2022-02-17T00:00:00Z (among other times). The same interval with a phase of 3
88
+ // days, 5 hours, and 23 minutes would match 2022-02-20T05:23:00Z instead.
89
+ message IntervalSpec {
90
+ google.protobuf.Duration interval = 1 [(gogoproto.stdduration) = true];
91
+ google.protobuf.Duration phase = 2 [(gogoproto.stdduration) = true];
92
+ }
93
+
94
+ // ScheduleSpec is a complete description of a set of absolute timestamps
95
+ // (possibly infinite) that an action should occur at. The meaning of a
96
+ // ScheduleSpec depends only on its contents and never changes, except that the
97
+ // definition of a time zone can change over time (most commonly, when daylight
98
+ // saving time policy changes for an area). To create a totally self-contained
99
+ // ScheduleSpec, use UTC or include timezone_data.
100
+ message ScheduleSpec {
101
+ // Calendar-based specifications of times.
102
+ repeated CalendarSpec calendar = 1;
103
+ // Interval-based specifications of times.
104
+ 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.
110
+ google.protobuf.Timestamp start_time = 4 [(gogoproto.stdtime) = true];
111
+ // Any timestamps after end_time will be skipped.
112
+ google.protobuf.Timestamp end_time = 5 [(gogoproto.stdtime) = true];
113
+ // All timestamps will be incremented by a random value from 0 to this
114
+ // amount of jitter. Default: 1 second
115
+ google.protobuf.Duration jitter = 6 [(gogoproto.stdduration) = true];
116
+
117
+ // Time zone to interpret all CalendarSpecs in.
118
+ //
119
+ // If unset, defaults to UTC. We recommend using UTC for your application if
120
+ // at all possible, to avoid various surprising properties of time zones.
121
+ //
122
+ // Time zones may be provided by name, corresponding to names in the IANA
123
+ // time zone database (see https://www.iana.org/time-zones). The definition
124
+ // will be loaded by the Temporal server from the environment it runs in.
125
+ //
126
+ // If your application requires more control over the time zone definition
127
+ // used, it may pass in a complete definition in the form of a TZif file
128
+ // from the time zone database. If present, this will be used instead of
129
+ // loading anything from the environment. You are then responsible for
130
+ // updating timezone_data when the definition changes.
131
+ //
132
+ // Calendar spec matching is based on literal matching of the clock time
133
+ // with no special handling of DST: if you write a calendar spec that fires
134
+ // at 2:30am and specify a time zone that follows DST, that action will not
135
+ // be triggered on the day that has no 2:30am. Similarly, an action that
136
+ // fires at 1:30am will be triggered twice on the day that has two 1:30s.
137
+ string timezone_name = 10;
138
+ bytes timezone_data = 11;
139
+ }
140
+
141
+ message SchedulePolicies {
142
+ // 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.
152
+ temporal.api.enums.v1.ScheduleOverlapPolicy overlap_policy = 1;
153
+
154
+ // Policy for catchups:
155
+ // If the Temporal server misses an action due to one or more components
156
+ // being down, and comes back up, the action will be run if the scheduled
157
+ // time is within this window from the current time.
158
+ // This value defaults to 60 seconds, and can't be less than 10 seconds.
159
+ google.protobuf.Duration catchup_window = 2 [(gogoproto.stdduration) = true];
160
+
161
+ // If true, and a workflow run fails or times out, turn on "paused".
162
+ // This applies after retry policies: the full chain of retries must fail to
163
+ // trigger a pause here.
164
+ bool pause_on_failure = 3;
165
+ }
166
+
167
+ message ScheduleAction {
168
+ oneof action {
169
+ // All fields of NewWorkflowExecutionInfo are valid except for:
170
+ // - workflow_id_reuse_policy
171
+ // - cron_schedule
172
+ // The workflow id of the started workflow may not match this exactly,
173
+ // it may have a timestamp appended for uniqueness.
174
+ temporal.api.workflow.v1.NewWorkflowExecutionInfo start_workflow = 1;
175
+ }
176
+ }
177
+
178
+ message ScheduleActionResult {
179
+ // Time that the action was taken (according to the schedule, including jitter).
180
+ google.protobuf.Timestamp schedule_time = 1 [(gogoproto.stdtime) = true];
181
+
182
+ // Time that the action was taken (real time).
183
+ google.protobuf.Timestamp actual_time = 2 [(gogoproto.stdtime) = true];
184
+
185
+ // If action was start_workflow:
186
+ temporal.api.common.v1.WorkflowExecution start_workflow_result = 11;
187
+ }
188
+
189
+ message ScheduleState {
190
+ // Informative human-readable message with contextual notes, e.g. the reason
191
+ // a schedule is paused. The system may overwrite this message on certain
192
+ // conditions, e.g. when pause-on-failure happens.
193
+ string notes = 1;
194
+
195
+ // If true, do not take any actions based on the schedule spec.
196
+ bool paused = 2;
197
+
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.
202
+ bool limited_actions = 3;
203
+ int64 remaining_actions = 4;
204
+ }
205
+
206
+ message TriggerImmediatelyRequest {
207
+ // Override overlap policy for this one request.
208
+ temporal.api.enums.v1.ScheduleOverlapPolicy overlap_policy = 1;
209
+ }
210
+
211
+ message BackfillRequest {
212
+ // Time range to evaluate schedule in.
213
+ google.protobuf.Timestamp start_time = 1 [(gogoproto.stdtime) = true];
214
+ google.protobuf.Timestamp end_time = 2 [(gogoproto.stdtime) = true];
215
+ // Override overlap policy for this request.
216
+ temporal.api.enums.v1.ScheduleOverlapPolicy overlap_policy = 3;
217
+ }
218
+
219
+ message SchedulePatch {
220
+ // If set, trigger one action immediately.
221
+ TriggerImmediatelyRequest trigger_immediately = 1;
222
+
223
+ // If set, runs though the specified time period(s) and takes actions as if that time
224
+ // passed by right now, all at once. The overlap policy can be overridden for the
225
+ // scope of the backfill.
226
+ repeated BackfillRequest backfill_request = 2;
227
+
228
+ // If set, change the state to paused or unpaused (respectively) and set the
229
+ // notes field to the value of the string.
230
+ string pause = 3;
231
+ string unpause = 4;
232
+ }
233
+
234
+ message ScheduleInfo {
235
+ // Number of actions taken so far.
236
+ int64 action_count = 1;
237
+
238
+ // Number of times a scheduled action was skipped due to missing the catchup window.
239
+ int64 missed_catchup_window = 2;
240
+
241
+ // Number of skipped actions due to overlap.
242
+ int64 overlap_skipped = 3;
243
+
244
+ // Currently-running workflows started by this schedule. (There might be
245
+ // more than one if the overlap policy allows overlaps.)
246
+ // Note that the run_ids in here are the original execution run ids as
247
+ // started by the schedule. If the workflows retried, did continue-as-new,
248
+ // or were reset, they might still be running but with a different run_id.
249
+ repeated temporal.api.common.v1.WorkflowExecution running_workflows = 9;
250
+
251
+ // Most recent ten actual action times (including manual triggers).
252
+ repeated ScheduleActionResult recent_actions = 4;
253
+
254
+ // Next ten scheduled action times.
255
+ repeated google.protobuf.Timestamp future_action_times = 5 [(gogoproto.stdtime) = true];
256
+
257
+ // Timestamps of schedule creation and last update.
258
+ google.protobuf.Timestamp create_time = 6 [(gogoproto.stdtime) = true];
259
+ google.protobuf.Timestamp update_time = 7 [(gogoproto.stdtime) = true];
260
+
261
+ // Error for invalid schedule. If this is set, no actions will be taken.
262
+ string invalid_schedule_error = 8;
263
+ }
264
+
265
+ message Schedule {
266
+ ScheduleSpec spec = 1;
267
+ ScheduleAction action = 2;
268
+ SchedulePolicies policies = 3;
269
+ ScheduleState state = 4;
270
+ }
271
+
272
+ // ScheduleListInfo is an abbreviated set of values from Schedule and ScheduleInfo
273
+ // that's returned in ListSchedules.
274
+ message ScheduleListInfo {
275
+ // 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.
278
+ ScheduleSpec spec = 1;
279
+
280
+ // From action:
281
+ // Action is a oneof field, but we need to encode this in JSON and oneof fields don't work
282
+ // well with JSON. If action is start_workflow, this is set:
283
+ temporal.api.common.v1.WorkflowType workflow_type = 2;
284
+
285
+ // From state:
286
+ string notes = 3;
287
+ bool paused = 4;
288
+
289
+ // From info (maybe fewer entries):
290
+ repeated ScheduleActionResult recent_actions = 5;
291
+ repeated google.protobuf.Timestamp future_action_times = 6 [(gogoproto.stdtime) = true];
292
+ }
293
+
294
+ // ScheduleListEntry is returned by ListSchedules.
295
+ message ScheduleListEntry {
296
+ string schedule_id = 1;
297
+ temporal.api.common.v1.Memo memo = 2;
298
+ temporal.api.common.v1.SearchAttributes search_attributes = 3;
299
+ ScheduleListInfo info = 4;
300
+ }
@@ -117,3 +117,28 @@ message ResetPointInfo {
117
117
  // false if the reset point has pending childWFs/reqCancels/signalExternals.
118
118
  bool resettable = 6;
119
119
  }
120
+
121
+ // NewWorkflowExecutionInfo is a shared message that encapsulates all the
122
+ // required arguments to starting a workflow in different contexts.
123
+ message NewWorkflowExecutionInfo {
124
+ string workflow_id = 1;
125
+ temporal.api.common.v1.WorkflowType workflow_type = 2;
126
+ temporal.api.taskqueue.v1.TaskQueue task_queue = 3;
127
+ // Serialized arguments to the workflow.
128
+ temporal.api.common.v1.Payloads input = 4;
129
+ // Total workflow execution timeout including retries and continue as new.
130
+ google.protobuf.Duration workflow_execution_timeout = 5 [(gogoproto.stdduration) = true];
131
+ // Timeout of a single workflow run.
132
+ google.protobuf.Duration workflow_run_timeout = 6 [(gogoproto.stdduration) = true];
133
+ // Timeout of a single workflow task.
134
+ google.protobuf.Duration workflow_task_timeout = 7 [(gogoproto.stdduration) = true];
135
+ // Default: WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE.
136
+ temporal.api.enums.v1.WorkflowIdReusePolicy workflow_id_reuse_policy = 8;
137
+ // The retry policy for the workflow. Will never exceed `workflow_execution_timeout`.
138
+ temporal.api.common.v1.RetryPolicy retry_policy = 9;
139
+ // See https://docs.temporal.io/docs/content/what-is-a-temporal-cron-job/
140
+ string cron_schedule = 10;
141
+ temporal.api.common.v1.Memo memo = 11;
142
+ temporal.api.common.v1.SearchAttributes search_attributes = 12;
143
+ temporal.api.common.v1.Header header = 13;
144
+ }
@@ -47,6 +47,7 @@ import "temporal/api/filter/v1/message.proto";
47
47
  import "temporal/api/namespace/v1/message.proto";
48
48
  import "temporal/api/query/v1/message.proto";
49
49
  import "temporal/api/replication/v1/message.proto";
50
+ import "temporal/api/schedule/v1/message.proto";
50
51
  import "temporal/api/taskqueue/v1/message.proto";
51
52
  import "temporal/api/version/v1/message.proto";
52
53
 
@@ -80,6 +81,7 @@ message RegisterNamespaceResponse {
80
81
  message ListNamespacesRequest {
81
82
  int32 page_size = 1;
82
83
  bytes next_page_token = 2;
84
+ temporal.api.namespace.v1.NamespaceFilter namespace_filter = 3;
83
85
  }
84
86
 
85
87
  message ListNamespacesResponse {
@@ -191,6 +193,19 @@ message GetWorkflowExecutionHistoryResponse {
191
193
  bool archived = 4;
192
194
  }
193
195
 
196
+ message GetWorkflowExecutionHistoryReverseRequest {
197
+ string namespace = 1;
198
+ temporal.api.common.v1.WorkflowExecution execution = 2;
199
+ int32 maximum_page_size = 3;
200
+ bytes next_page_token = 4;
201
+ }
202
+
203
+ message GetWorkflowExecutionHistoryReverseResponse {
204
+ temporal.api.history.v1.History history = 1;
205
+ // Will be set if there are more history events than were included in this response
206
+ bytes next_page_token = 3;
207
+ }
208
+
194
209
  message PollWorkflowTaskQueueRequest {
195
210
  string namespace = 1;
196
211
  temporal.api.taskqueue.v1.TaskQueue task_queue = 2;
@@ -268,6 +283,8 @@ message RespondWorkflowTaskCompletedRequest {
268
283
  message RespondWorkflowTaskCompletedResponse {
269
284
  // See `RespondWorkflowTaskCompletedResponse::return_new_workflow_task`
270
285
  PollWorkflowTaskQueueResponse workflow_task = 1;
286
+ // See `ScheduleActivityTaskCommandAttributes::request_start`
287
+ repeated PollActivityTaskQueueResponse activity_tasks = 2;
271
288
  }
272
289
 
273
290
  message RespondWorkflowTaskFailedRequest {
@@ -420,9 +437,14 @@ message RespondActivityTaskFailedRequest {
420
437
  // The identity of the worker/client
421
438
  string identity = 3;
422
439
  string namespace = 4;
440
+ // Additional details to be stored as last activity heartbeat
441
+ temporal.api.common.v1.Payloads last_heartbeat_details = 5;
423
442
  }
424
443
 
425
444
  message RespondActivityTaskFailedResponse {
445
+ // Server validation failures could include
446
+ // last_heartbeat_details payload is too large, request failure is too large
447
+ repeated temporal.api.failure.v1.Failure failures = 1;
426
448
  }
427
449
 
428
450
  message RespondActivityTaskFailedByIdRequest {
@@ -438,9 +460,14 @@ message RespondActivityTaskFailedByIdRequest {
438
460
  temporal.api.failure.v1.Failure failure = 5;
439
461
  // The identity of the worker/client
440
462
  string identity = 6;
463
+ // Additional details to be stored as last activity heartbeat
464
+ temporal.api.common.v1.Payloads last_heartbeat_details = 7;
441
465
  }
442
466
 
443
467
  message RespondActivityTaskFailedByIdResponse {
468
+ // Server validation failures could include
469
+ // last_heartbeat_details payload is too large, request failure is too large
470
+ repeated temporal.api.failure.v1.Failure failures = 1;
444
471
  }
445
472
 
446
473
  message RespondActivityTaskCanceledRequest {
@@ -481,8 +508,12 @@ message RequestCancelWorkflowExecutionRequest {
481
508
  string identity = 3;
482
509
  // Used to de-dupe cancellation requests
483
510
  string request_id = 4;
484
- // Should be removed. Appears unused.
511
+ // If set, this call will error if the most recent (if no run id is set on
512
+ // `workflow_execution`), or specified (if it is) workflow execution is not part of the same
513
+ // execution chain as this id.
485
514
  string first_execution_run_id = 5;
515
+ // Reason for requesting the cancellation
516
+ string reason = 6;
486
517
  }
487
518
 
488
519
  message RequestCancelWorkflowExecutionResponse {
@@ -556,7 +587,7 @@ message ResetWorkflowExecutionRequest {
556
587
  int64 workflow_task_finish_event_id = 4;
557
588
  // Used to de-dupe reset requests
558
589
  string request_id = 5;
559
- // Should be removed. Appears unused.
590
+ // Reset reapplay(replay) options.
560
591
  temporal.api.enums.v1.ResetReapplyType reset_reapply_type = 6;
561
592
  }
562
593
 
@@ -572,7 +603,9 @@ message TerminateWorkflowExecutionRequest {
572
603
  temporal.api.common.v1.Payloads details = 4;
573
604
  // The identity of the worker/client
574
605
  string identity = 5;
575
- // Should be removed. Appears unused.
606
+ // If set, this call will error if the most recent (if no run id is set on
607
+ // `workflow_execution`), or specified (if it is) workflow execution is not part of the same
608
+ // execution chain as this id.
576
609
  string first_execution_run_id = 6;
577
610
  }
578
611
 
@@ -761,6 +794,12 @@ message GetSystemInfoResponse {
761
794
  // When unset/false, clients retry all failures. When true, clients should only retry
762
795
  // non-internal errors.
763
796
  bool internal_error_differentiation = 2;
797
+
798
+ // True if RespondActivityTaskFailed API supports including heartbeat details
799
+ bool activity_failure_include_heartbeat = 3;
800
+
801
+ // Supports scheduled workflow features.
802
+ bool supports_schedules = 4;
764
803
  }
765
804
  }
766
805
 
@@ -773,3 +812,141 @@ message ListTaskQueuePartitionsResponse {
773
812
  repeated temporal.api.taskqueue.v1.TaskQueuePartitionMetadata activity_task_queue_partitions = 1;
774
813
  repeated temporal.api.taskqueue.v1.TaskQueuePartitionMetadata workflow_task_queue_partitions = 2;
775
814
  }
815
+
816
+ // (-- api-linter: core::0133::request-parent-required=disabled
817
+ // aip.dev/not-precedent: CreateSchedule doesn't follow Google API format --)
818
+ // (-- api-linter: core::0133::request-unknown-fields=disabled
819
+ // aip.dev/not-precedent: CreateSchedule doesn't follow Google API format --)
820
+ // (-- api-linter: core::0133::request-resource-behavior=disabled
821
+ // aip.dev/not-precedent: field_behavior annotation not available in our gogo fork --)
822
+ // (-- api-linter: core::0203::optional=disabled
823
+ // aip.dev/not-precedent: field_behavior annotation not available in our gogo fork --)
824
+ message CreateScheduleRequest {
825
+ // The namespace the schedule should be created in.
826
+ string namespace = 1;
827
+ // The id of the new schedule.
828
+ string schedule_id = 2;
829
+ // The schedule spec, policies, action, and initial state.
830
+ temporal.api.schedule.v1.Schedule schedule = 3;
831
+ // Optional initial patch (e.g. to run the action once immediately).
832
+ temporal.api.schedule.v1.SchedulePatch initial_patch = 4;
833
+ // The identity of the client who initiated this request.
834
+ string identity = 5;
835
+ // A unique identifier for this create request for idempotence. Typically UUIDv4.
836
+ string request_id = 6;
837
+ // Memo and search attributes to attach to the schedule itself.
838
+ temporal.api.common.v1.Memo memo = 7;
839
+ temporal.api.common.v1.SearchAttributes search_attributes = 8;
840
+ }
841
+
842
+ message CreateScheduleResponse {
843
+ bytes conflict_token = 1;
844
+ }
845
+
846
+ message DescribeScheduleRequest {
847
+ // The namespace of the schedule to describe.
848
+ string namespace = 1;
849
+ // The id of the schedule to describe.
850
+ string schedule_id = 2;
851
+ }
852
+
853
+ message DescribeScheduleResponse {
854
+ // The complete current schedule details. This may not match the schedule as
855
+ // created because:
856
+ // - some fields in the state are modified automatically
857
+ // - the schedule may have been modified by UpdateSchedule or PatchSchedule
858
+ temporal.api.schedule.v1.Schedule schedule = 1;
859
+ // Extra schedule state info.
860
+ temporal.api.schedule.v1.ScheduleInfo info = 2;
861
+ // The memo and search attributes that the schedule was created with.
862
+ temporal.api.common.v1.Memo memo = 3;
863
+ temporal.api.common.v1.SearchAttributes search_attributes = 4;
864
+
865
+ // This value can be passed back to UpdateSchedule to ensure that the
866
+ // schedule was not modified between a Describe and an Update, which could
867
+ // lead to lost updates and other confusion.
868
+ bytes conflict_token = 5;
869
+ }
870
+
871
+ // (-- api-linter: core::0134::request-mask-required=disabled
872
+ // aip.dev/not-precedent: UpdateSchedule doesn't follow Google API format --)
873
+ message UpdateScheduleRequest {
874
+ // The namespace of the schedule to update.
875
+ string namespace = 1;
876
+ // The id of the schedule to update.
877
+ string schedule_id = 2;
878
+ // The new schedule. The four main fields of the schedule (spec, action,
879
+ // policies, state) are replaced completely by the values in this message.
880
+ temporal.api.schedule.v1.Schedule schedule = 3;
881
+ // This can be the value of conflict_token from a DescribeScheduleResponse,
882
+ // which will cause this request to fail if the schedule has been modified
883
+ // between the Describe and this Update.
884
+ // If missing, the schedule will be updated unconditionally.
885
+ bytes conflict_token = 4;
886
+ // The identity of the client who initiated this request.
887
+ string identity = 5;
888
+ // A unique identifier for this update request for idempotence. Typically UUIDv4.
889
+ string request_id = 6;
890
+ }
891
+
892
+ message UpdateScheduleResponse {
893
+ }
894
+
895
+ message PatchScheduleRequest {
896
+ // The namespace of the schedule to patch.
897
+ string namespace = 1;
898
+ // The id of the schedule to patch.
899
+ string schedule_id = 2;
900
+ temporal.api.schedule.v1.SchedulePatch patch = 3;
901
+ // The identity of the client who initiated this request.
902
+ string identity = 4;
903
+ // A unique identifier for this update request for idempotence. Typically UUIDv4.
904
+ string request_id = 5;
905
+ }
906
+
907
+ message PatchScheduleResponse {
908
+ }
909
+
910
+ message ListScheduleMatchingTimesRequest {
911
+ // The namespace of the schedule to query.
912
+ string namespace = 1;
913
+ // The id of the schedule to query.
914
+ string schedule_id = 2;
915
+ // Time range to query.
916
+ google.protobuf.Timestamp start_time = 3 [(gogoproto.stdtime) = true];
917
+ google.protobuf.Timestamp end_time = 4 [(gogoproto.stdtime) = true];
918
+ }
919
+
920
+ message ListScheduleMatchingTimesResponse {
921
+ repeated google.protobuf.Timestamp start_time = 1 [(gogoproto.stdtime) = true];
922
+ }
923
+
924
+ // (-- api-linter: core::0135::request-name-required=disabled
925
+ // aip.dev/not-precedent: DeleteSchedule doesn't follow Google API format --)
926
+ // (-- api-linter: core::0135::request-unknown-fields=disabled
927
+ // aip.dev/not-precedent: DeleteSchedule doesn't follow Google API format --)
928
+ message DeleteScheduleRequest {
929
+ // The namespace of the schedule to delete.
930
+ string namespace = 1;
931
+ // The id of the schedule to delete.
932
+ string schedule_id = 2;
933
+ // The identity of the client who initiated this request.
934
+ string identity = 3;
935
+ }
936
+
937
+ message DeleteScheduleResponse {
938
+ }
939
+
940
+ message ListSchedulesRequest {
941
+ // The namespace to list schedules in.
942
+ string namespace = 1;
943
+ // How many to return at once.
944
+ int32 maximum_page_size = 2;
945
+ // Token to get the next page of results.
946
+ bytes next_page_token = 3;
947
+ }
948
+
949
+ message ListSchedulesResponse {
950
+ repeated temporal.api.schedule.v1.ScheduleListEntry schedules = 1;
951
+ bytes next_page_token = 2;
952
+ }
@@ -94,6 +94,12 @@ service WorkflowService {
94
94
  // `NotFound` if the specified workflow execution is unknown to the service.
95
95
  rpc GetWorkflowExecutionHistory (GetWorkflowExecutionHistoryRequest) returns (GetWorkflowExecutionHistoryResponse) {
96
96
  }
97
+
98
+ // GetWorkflowExecutionHistoryReverse returns the history of specified workflow execution in reverse
99
+ // order (starting from last event). Fails with`NotFound` if the specified workflow execution is
100
+ // unknown to the service.
101
+ rpc GetWorkflowExecutionHistoryReverse (GetWorkflowExecutionHistoryReverseRequest) returns (GetWorkflowExecutionHistoryReverseResponse) {
102
+ }
97
103
 
98
104
  // PollWorkflowTaskQueue is called by workers to make progress on workflows.
99
105
  //
@@ -209,9 +215,9 @@ service WorkflowService {
209
215
  // RequestCancelWorkflowExecution is called by workers when they want to request cancellation of
210
216
  // a workflow execution.
211
217
  //
212
- // This result in a new `WORKFLOW_EXECUTION_CANCEL_REQUESTED` event being written to the
213
- // workflow history and a new workflow task created for the workflow. Fails with `NotFound` if
214
- // the workflow is already completed or doesn't exist.
218
+ // This results in a new `WORKFLOW_EXECUTION_CANCEL_REQUESTED` event being written to the
219
+ // workflow history and a new workflow task created for the workflow. It returns success if the requested
220
+ // workflow is already closed. It fails with 'NotFound' if the requested workflow doesn't exist.
215
221
  rpc RequestCancelWorkflowExecution (RequestCancelWorkflowExecutionRequest) returns (RequestCancelWorkflowExecutionResponse) {
216
222
  }
217
223
 
@@ -318,4 +324,48 @@ service WorkflowService {
318
324
 
319
325
  rpc ListTaskQueuePartitions(ListTaskQueuePartitionsRequest) returns (ListTaskQueuePartitionsResponse) {
320
326
  }
327
+
328
+ // Creates a new schedule.
329
+ // (-- api-linter: core::0133::method-signature=disabled
330
+ // aip.dev/not-precedent: CreateSchedule doesn't follow Google API format --)
331
+ // (-- api-linter: core::0133::response-message-name=disabled
332
+ // aip.dev/not-precedent: CreateSchedule doesn't follow Google API format --)
333
+ // (-- api-linter: core::0133::http-uri-parent=disabled
334
+ // aip.dev/not-precedent: CreateSchedule doesn't follow Google API format --)
335
+ rpc CreateSchedule (CreateScheduleRequest) returns (CreateScheduleResponse) {
336
+ }
337
+
338
+ // Returns the schedule description and current state of an existing schedule.
339
+ rpc DescribeSchedule (DescribeScheduleRequest) returns (DescribeScheduleResponse) {
340
+ }
341
+
342
+ // Changes the configuration or state of an existing schedule.
343
+ // (-- api-linter: core::0134::response-message-name=disabled
344
+ // aip.dev/not-precedent: UpdateSchedule RPC doesn't follow Google API format. --)
345
+ // (-- api-linter: core::0134::method-signature=disabled
346
+ // aip.dev/not-precedent: UpdateSchedule RPC doesn't follow Google API format. --)
347
+ rpc UpdateSchedule (UpdateScheduleRequest) returns (UpdateScheduleResponse) {
348
+ }
349
+
350
+ // Makes a specific change to a schedule or triggers an immediate action.
351
+ // (-- api-linter: core::0134::synonyms=disabled
352
+ // aip.dev/not-precedent: we have both patch and update. --)
353
+ rpc PatchSchedule (PatchScheduleRequest) returns (PatchScheduleResponse) {
354
+ }
355
+
356
+ // Lists matching times within a range.
357
+ rpc ListScheduleMatchingTimes (ListScheduleMatchingTimesRequest) returns (ListScheduleMatchingTimesResponse) {
358
+ }
359
+
360
+ // Deletes a schedule, removing it from the system.
361
+ // (-- api-linter: core::0135::method-signature=disabled
362
+ // aip.dev/not-precedent: DeleteSchedule doesn't follow Google API format --)
363
+ // (-- api-linter: core::0135::response-message-name=disabled
364
+ // aip.dev/not-precedent: DeleteSchedule doesn't follow Google API format --)
365
+ rpc DeleteSchedule (DeleteScheduleRequest) returns (DeleteScheduleResponse) {
366
+ }
367
+
368
+ // List all schedules in a namespace.
369
+ rpc ListSchedules (ListSchedulesRequest) returns (ListSchedulesResponse) {
370
+ }
321
371
  }