@@ -165,19 +165,69 @@ export interface ContinueAsNewOptions {
165
165
searchAttributes ?: SearchAttributes ;
166
166
}
167
167
168
+ /**
169
+ * Specifies:
170
+ * - whether cancellation requests are sent to the Child
171
+ * - whether and when a {@link CanceledFailure} is thrown from {@link executeChild} or
172
+ * {@link ChildWorkflowHandle.result}
173
+ *
174
+ * @default {@link ChildWorkflowCancellationType.WAIT_CANCELLATION_COMPLETED }
175
+ */
168
176
export enum ChildWorkflowCancellationType {
177
+ /**
178
+ * Don't send a cancellation request to the Child.
179
+ */
169
180
ABANDON = 0 ,
181
+
182
+ /**
183
+ * Send a cancellation request to the Child. Immediately throw the error.
184
+ */
170
185
TRY_CANCEL = 1 ,
186
+
187
+ /**
188
+ * Send a cancellation request to the Child. The Child may respect cancellation, in which case an error will be thrown
189
+ * when cancellation has completed, and {@link isCancellation}(error) will be true. On the other hand, the Child may
190
+ * ignore the cancellation request, in which case an error might be thrown with a different cause, or the Child may
191
+ * complete successfully.
192
+ *
193
+ * @default
194
+ */
171
195
WAIT_CANCELLATION_COMPLETED = 2 ,
196
+
197
+ /**
198
+ * Send a cancellation request to the Child. Throw the error once the Server receives the Child cancellation request.
199
+ */
172
200
WAIT_CANCELLATION_REQUESTED = 3 ,
173
201
}
174
202
175
203
checkExtends < coresdk . child_workflow . ChildWorkflowCancellationType , ChildWorkflowCancellationType > ( ) ;
176
204
205
+ /**
206
+ * Concept: [Parent Close Policy](https://docs.temporal.io/concepts/what-is-a-parent-close-policy/)
207
+ *
208
+ * How a Child Workflow reacts to the Parent Workflow reaching a Closed state.
209
+ */
177
210
export enum ParentClosePolicy {
211
+ /**
212
+ * If a `ParentClosePolicy` is set to this, or is not set at all, the server default value will be used.
213
+ */
178
214
PARENT_CLOSE_POLICY_UNSPECIFIED = 0 ,
215
+
216
+ /**
217
+ * When the Parent is Closed, the Child is Terminated.
218
+ *
219
+ * @default
220
+ */
179
221
PARENT_CLOSE_POLICY_TERMINATE = 1 ,
222
+
223
+ /**
224
+ * When the Parent is Closed, nothing is done to the Child.
225
+ */
180
226
PARENT_CLOSE_POLICY_ABANDON = 2 ,
227
+
228
+ /**
229
+ * When the Parent is Closed, the Child is Cancelled.
230
+ */
181
231
PARENT_CLOSE_POLICY_REQUEST_CANCEL = 3 ,
182
232
}
183
233
@@ -198,13 +248,19 @@ export interface ChildWorkflowOptions extends CommonWorkflowOptions {
198
248
taskQueue ?: string ;
199
249
200
250
/**
201
- * In case of a child workflow cancellation it fails with a CanceledFailure.
202
- * The type defines at which point the exception is thrown.
203
- * @default ChildWorkflowCancellationType.WAIT_CANCELLATION_COMPLETED
251
+ * Specifies:
252
+ * - whether cancellation requests are sent to the Child
253
+ * - whether and when an error is thrown from {@link executeChild} or
254
+ * {@link ChildWorkflowHandle.result}
255
+ *
256
+ * @default {@link ChildWorkflowCancellationType.WAIT_CANCELLATION_COMPLETED }
204
257
*/
205
258
cancellationType ?: ChildWorkflowCancellationType ;
259
+
206
260
/**
207
- * Specifies how this workflow reacts to the death of the parent workflow.
261
+ * Specifies how the Child reacts to the Parent Workflow reaching a Closed state.
262
+ *
263
+ * @default {@link ParentClosePolicy.PARENT_CLOSE_POLICY_TERMINATE }
208
264
*/
209
265
parentClosePolicy ?: ParentClosePolicy ;
210
266
}
0 commit comments