@temporalio/workflow 1.14.2-canary-release-testing.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/workflow.ts CHANGED
@@ -24,6 +24,7 @@ import {
24
24
  WorkflowUpdateValidatorType,
25
25
  SearchAttributeUpdatePair,
26
26
  WorkflowDefinitionOptionsOrGetter,
27
+ encodeInitialVersioningBehavior,
27
28
  } from '@temporalio/common';
28
29
  import { userMetadataToPayload } from '@temporalio/common/lib/user-metadata';
29
30
  import {
@@ -202,7 +203,7 @@ function scheduleActivityNextHandler({ options, args, headers, seq, activityType
202
203
  headers,
203
204
  cancellationType: encodeActivityCancellationType(options.cancellationType),
204
205
  doNotEagerlyExecute: !(options.allowEagerDispatch ?? true),
205
- versioningIntent: versioningIntentToProto(options.versioningIntent), // eslint-disable-line deprecation/deprecation
206
+ versioningIntent: versioningIntentToProto(options.versioningIntent), // eslint-disable-line @typescript-eslint/no-deprecated
206
207
  priority: options.priority ? compilePriority(options.priority) : undefined,
207
208
  },
208
209
  userMetadata: userMetadataToPayload(activator.payloadConverter, options.summary, undefined),
@@ -401,11 +402,11 @@ function startChildWorkflowExecutionNextHandler({
401
402
  parentClosePolicy: encodeParentClosePolicy(options.parentClosePolicy),
402
403
  cronSchedule: options.cronSchedule,
403
404
  searchAttributes:
404
- options.searchAttributes || options.typedSearchAttributes // eslint-disable-line deprecation/deprecation
405
- ? encodeUnifiedSearchAttributes(options.searchAttributes, options.typedSearchAttributes) // eslint-disable-line deprecation/deprecation
405
+ options.searchAttributes || options.typedSearchAttributes // eslint-disable-line @typescript-eslint/no-deprecated
406
+ ? { indexedFields: encodeUnifiedSearchAttributes(options.searchAttributes, options.typedSearchAttributes) } // eslint-disable-line @typescript-eslint/no-deprecated
406
407
  : undefined,
407
408
  memo: options.memo && mapToPayloads(activator.payloadConverter, options.memo),
408
- versioningIntent: versioningIntentToProto(options.versioningIntent), // eslint-disable-line deprecation/deprecation
409
+ versioningIntent: versioningIntentToProto(options.versioningIntent), // eslint-disable-line @typescript-eslint/no-deprecated
409
410
  priority: options.priority ? compilePriority(options.priority) : undefined,
410
411
  },
411
412
  userMetadata: userMetadataToPayload(activator.payloadConverter, options?.staticSummary, options?.staticDetails),
@@ -1018,12 +1019,13 @@ export function makeContinueAsNewFunc<F extends Workflow>(
1018
1019
  taskQueue: options.taskQueue,
1019
1020
  memo: options.memo && mapToPayloads(activator.payloadConverter, options.memo),
1020
1021
  searchAttributes:
1021
- options.searchAttributes || options.typedSearchAttributes // eslint-disable-line deprecation/deprecation
1022
- ? encodeUnifiedSearchAttributes(options.searchAttributes, options.typedSearchAttributes) // eslint-disable-line deprecation/deprecation
1022
+ options.searchAttributes || options.typedSearchAttributes // eslint-disable-line @typescript-eslint/no-deprecated
1023
+ ? { indexedFields: encodeUnifiedSearchAttributes(options.searchAttributes, options.typedSearchAttributes) } // eslint-disable-line @typescript-eslint/no-deprecated
1023
1024
  : undefined,
1024
1025
  workflowRunTimeout: msOptionalToTs(options.workflowRunTimeout),
1025
1026
  workflowTaskTimeout: msOptionalToTs(options.workflowTaskTimeout),
1026
- versioningIntent: versioningIntentToProto(options.versioningIntent), // eslint-disable-line deprecation/deprecation
1027
+ versioningIntent: versioningIntentToProto(options.versioningIntent), // eslint-disable-line @typescript-eslint/no-deprecated
1028
+ initialVersioningBehavior: encodeInitialVersioningBehavior(options.initialVersioningBehavior),
1027
1029
  });
1028
1030
  });
1029
1031
  return fn({
@@ -1509,7 +1511,7 @@ export function setDefaultQueryHandler(handler: DefaultQueryHandler | undefined)
1509
1511
  * If using SearchAttributeUpdatePair[] (preferred), set a value to null to remove the search attribute.
1510
1512
  * If using SearchAttributes (deprecated), set a value to undefined or an empty list to remove the search attribute.
1511
1513
  */
1512
- // eslint-disable-next-line deprecation/deprecation
1514
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
1513
1515
  export function upsertSearchAttributes(searchAttributes: SearchAttributes | SearchAttributeUpdatePair[]): void {
1514
1516
  const activator = assertInWorkflowContext(
1515
1517
  'Workflow.upsertSearchAttributes(...) may only be used from a Workflow Execution.'
@@ -1523,13 +1525,15 @@ export function upsertSearchAttributes(searchAttributes: SearchAttributes | Sear
1523
1525
  // Typed search attributes
1524
1526
  activator.pushCommand({
1525
1527
  upsertWorkflowSearchAttributes: {
1526
- searchAttributes: encodeUnifiedSearchAttributes(undefined, searchAttributes),
1528
+ searchAttributes: {
1529
+ indexedFields: encodeUnifiedSearchAttributes(undefined, searchAttributes),
1530
+ },
1527
1531
  },
1528
1532
  });
1529
1533
 
1530
1534
  activator.mutateWorkflowInfo((info: WorkflowInfo): WorkflowInfo => {
1531
1535
  // Create a copy of the current state.
1532
- const newSearchAttributes: SearchAttributes = { ...info.searchAttributes }; // eslint-disable-line deprecation/deprecation
1536
+ const newSearchAttributes: SearchAttributes = { ...info.searchAttributes }; // eslint-disable-line @typescript-eslint/no-deprecated
1533
1537
  for (const pair of searchAttributes) {
1534
1538
  if (pair.value == null) {
1535
1539
  // If the value is null, remove the search attribute.
@@ -1538,7 +1542,7 @@ export function upsertSearchAttributes(searchAttributes: SearchAttributes | Sear
1538
1542
  } else {
1539
1543
  newSearchAttributes[pair.key.name] = Array.isArray(pair.value)
1540
1544
  ? pair.value
1541
- : ([pair.value] as SearchAttributeValue); // eslint-disable-line deprecation/deprecation
1545
+ : ([pair.value] as SearchAttributeValue); // eslint-disable-line @typescript-eslint/no-deprecated
1542
1546
  }
1543
1547
  }
1544
1548
  return {
@@ -1552,14 +1556,16 @@ export function upsertSearchAttributes(searchAttributes: SearchAttributes | Sear
1552
1556
  // Legacy search attributes
1553
1557
  activator.pushCommand({
1554
1558
  upsertWorkflowSearchAttributes: {
1555
- searchAttributes: mapToPayloads(searchAttributePayloadConverter, searchAttributes),
1559
+ searchAttributes: {
1560
+ indexedFields: mapToPayloads(searchAttributePayloadConverter, searchAttributes),
1561
+ },
1556
1562
  },
1557
1563
  });
1558
1564
 
1559
1565
  activator.mutateWorkflowInfo((info: WorkflowInfo): WorkflowInfo => {
1560
1566
  // Create a new copy of the current state.
1561
1567
  let typedSearchAttributes = info.typedSearchAttributes.updateCopy([]);
1562
- const newSearchAttributes: SearchAttributes = { ...info.searchAttributes }; // eslint-disable-line deprecation/deprecation
1568
+ const newSearchAttributes: SearchAttributes = { ...info.searchAttributes }; // eslint-disable-line @typescript-eslint/no-deprecated
1563
1569
 
1564
1570
  // Upsert legacy search attributes into typedSearchAttributes.
1565
1571
  for (const [k, v] of Object.entries(searchAttributes)) {