|
1 | 1 | import { checkExtends, Replace } from '@temporalio/common/lib/type-helpers'; |
2 | | -import { Duration, SearchAttributes, Workflow } from '@temporalio/common'; |
| 2 | +import { Duration, SearchAttributes, Workflow, TypedSearchAttributes, SearchAttributePair } from '@temporalio/common'; |
3 | 3 | import { makeProtoEnumConverters } from '@temporalio/common/lib/internal-workflow'; |
4 | 4 | import type { temporal } from '@temporalio/proto'; |
5 | 5 | import { WorkflowStartOptions } from './workflow-options'; |
@@ -70,8 +70,21 @@ export interface ScheduleOptions<A extends ScheduleOptionsAction = ScheduleOptio |
70 | 70 | * https://docs.temporal.io/docs/typescript/search-attributes |
71 | 71 | * |
72 | 72 | * Values are always converted using {@link JsonPayloadConverter}, even when a custom Data Converter is provided. |
| 73 | + * |
| 74 | + * @deprecated Use {@link typedSearchAttributes} instead. |
73 | 75 | */ |
74 | | - searchAttributes?: SearchAttributes; |
| 76 | + searchAttributes?: SearchAttributes; // eslint-disable-line deprecation/deprecation |
| 77 | + |
| 78 | + /** |
| 79 | + * Additional indexed information attached to the Schedule. More info: |
| 80 | + * https://docs.temporal.io/docs/typescript/search-attributes |
| 81 | + * |
| 82 | + * Values are always converted using {@link JsonPayloadConverter}, even when a custom Data Converter is provided. |
| 83 | + * |
| 84 | + * If both {@link searchAttributes} and {@link typedSearchAttributes} are provided, conflicting keys will be overwritten |
| 85 | + * by {@link typedSearchAttributes}. |
| 86 | + */ |
| 87 | + typedSearchAttributes?: SearchAttributePair[] | TypedSearchAttributes; |
75 | 88 |
|
76 | 89 | /** |
77 | 90 | * The initial state of the schedule, right after creation or update. |
@@ -129,7 +142,7 @@ export type CompiledScheduleOptions = Replace< |
129 | 142 | * The specification of an updated Schedule, as expected by {@link ScheduleHandle.update}. |
130 | 143 | */ |
131 | 144 | export type ScheduleUpdateOptions<A extends ScheduleOptionsAction = ScheduleOptionsAction> = Replace< |
132 | | - Omit<ScheduleOptions, 'scheduleId' | 'memo' | 'searchAttributes'>, |
| 145 | + Omit<ScheduleOptions, 'scheduleId' | 'memo' | 'searchAttributes' | 'typedSearchAttributes'>, |
133 | 146 | { |
134 | 147 | action: A; |
135 | 148 | state: Omit<ScheduleOptions['state'], 'triggerImmediately' | 'backfill'>; |
@@ -172,12 +185,22 @@ export interface ScheduleSummary { |
172 | 185 | memo?: Record<string, unknown>; |
173 | 186 |
|
174 | 187 | /** |
175 | | - * Additional indexed information attached to the Schedule. |
176 | | - * More info: https://docs.temporal.io/docs/typescript/search-attributes |
| 188 | + * Additional indexed information attached to the Schedule. More info: |
| 189 | + * https://docs.temporal.io/docs/typescript/search-attributes |
177 | 190 | * |
178 | 191 | * Values are always converted using {@link JsonPayloadConverter}, even when a custom Data Converter is provided. |
| 192 | + * |
| 193 | + * @deprecated Use {@link typedSearchAttributes} instead. |
179 | 194 | */ |
180 | | - searchAttributes?: SearchAttributes; |
| 195 | + searchAttributes?: SearchAttributes; // eslint-disable-line deprecation/deprecation |
| 196 | + |
| 197 | + /** |
| 198 | + * Additional indexed information attached to the Schedule. More info: |
| 199 | + * https://docs.temporal.io/docs/typescript/search-attributes |
| 200 | + * |
| 201 | + * Values are always converted using {@link JsonPayloadConverter}, even when a custom Data Converter is provided. |
| 202 | + */ |
| 203 | + typedSearchAttributes?: TypedSearchAttributes; |
181 | 204 |
|
182 | 205 | state: { |
183 | 206 | /** |
@@ -284,12 +307,22 @@ export type ScheduleDescription = { |
284 | 307 | memo?: Record<string, unknown>; |
285 | 308 |
|
286 | 309 | /** |
287 | | - * Additional indexed information attached to the Schedule. |
288 | | - * More info: https://docs.temporal.io/docs/typescript/search-attributes |
| 310 | + * Additional indexed information attached to the Schedule. More info: |
| 311 | + * https://docs.temporal.io/docs/typescript/search-attributes |
| 312 | + * |
| 313 | + * Values are always converted using {@link JsonPayloadConverter}, even when a custom Data Converter is provided. |
| 314 | + * |
| 315 | + * @deprecated Use {@link typedSearchAttributes} instead. |
| 316 | + */ |
| 317 | + searchAttributes: SearchAttributes; // eslint-disable-line deprecation/deprecation |
| 318 | + |
| 319 | + /** |
| 320 | + * Additional indexed information attached to the Schedule. More info: |
| 321 | + * https://docs.temporal.io/docs/typescript/search-attributes |
289 | 322 | * |
290 | 323 | * Values are always converted using {@link JsonPayloadConverter}, even when a custom Data Converter is provided. |
291 | 324 | */ |
292 | | - searchAttributes: SearchAttributes; |
| 325 | + typedSearchAttributes: TypedSearchAttributes; |
293 | 326 |
|
294 | 327 | state: { |
295 | 328 | /** |
@@ -745,6 +778,7 @@ export type ScheduleOptionsStartWorkflowAction<W extends Workflow> = { |
745 | 778 | | 'args' |
746 | 779 | | 'memo' |
747 | 780 | | 'searchAttributes' |
| 781 | + | 'typedSearchAttributes' |
748 | 782 | | 'retry' |
749 | 783 | | 'workflowExecutionTimeout' |
750 | 784 | | 'workflowRunTimeout' |
@@ -776,6 +810,7 @@ export type ScheduleDescriptionStartWorkflowAction = ScheduleSummaryStartWorkflo |
776 | 810 | | 'args' |
777 | 811 | | 'memo' |
778 | 812 | | 'searchAttributes' |
| 813 | + | 'typedSearchAttributes' |
779 | 814 | | 'retry' |
780 | 815 | | 'workflowExecutionTimeout' |
781 | 816 | | 'workflowRunTimeout' |
|
0 commit comments