Skip to content

Commit 89c99da

Browse files
committed
feat: rm keepTriggerConfig option and make it true by default in trigger
1 parent ae0a973 commit 89c99da

File tree

7 files changed

+11
-28
lines changed

7 files changed

+11
-28
lines changed

src/client/index.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ describe("workflow client", () => {
237237
"upstash-workflow-url": "https://requestcatcher.com/api",
238238
"upstash-delay": "1s",
239239
"content-type": "application/json",
240-
"upstash-feature-set": "LazyFetch,InitialBody,WF_DetectTrigger",
240+
"upstash-feature-set": "LazyFetch,InitialBody,WF_DetectTrigger,WF_TriggerOnConfig",
241241
"upstash-forward-upstash-label": "test-label",
242242
"upstash-label": "test-label",
243243
"upstash-telemetry-framework": "unknown",
@@ -278,7 +278,6 @@ describe("workflow client", () => {
278278
retryDelay: "2000",
279279
notBefore: new Date("2100-01-01T00:00:00Z").getTime() / 1000,
280280
useFailureFunction: true,
281-
keepTriggerConfig: true,
282281
},
283282
]);
284283
expect(result).toEqual([
@@ -308,7 +307,7 @@ describe("workflow client", () => {
308307
"upstash-workflow-url": "https://requestcatcher.com/api",
309308
"upstash-delay": "1s",
310309
"content-type": "application/json",
311-
"upstash-feature-set": "LazyFetch,InitialBody,WF_DetectTrigger",
310+
"upstash-feature-set": "LazyFetch,InitialBody,WF_DetectTrigger,WF_TriggerOnConfig",
312311
"upstash-telemetry-framework": "unknown",
313312
"upstash-telemetry-runtime": expect.stringMatching(/bun@/),
314313
"upstash-telemetry-sdk": expect.stringContaining("@upstash/workflow"),
@@ -392,7 +391,7 @@ describe("workflow client", () => {
392391
"upstash-delay": "1s",
393392
"upstash-failure-callback": "https://requestcatcher.com/some-failure-callback",
394393
"content-type": "application/json",
395-
"upstash-feature-set": "LazyFetch,InitialBody,WF_DetectTrigger",
394+
"upstash-feature-set": "LazyFetch,InitialBody,WF_DetectTrigger,WF_TriggerOnConfig",
396395
"upstash-failure-callback-feature-set": "LazyFetch,InitialBody,WF_DetectTrigger",
397396
"upstash-failure-callback-forward-upstash-workflow-failure-callback": "true",
398397
"upstash-failure-callback-forward-upstash-workflow-is-failure": "true",

src/client/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ export class Client {
266266
telemetry: option.disableTelemetry ? undefined : { sdk: SDK_TELEMETRY },
267267
delay: option.delay,
268268
notBefore: option.notBefore,
269-
keepTriggerConfig: option.keepTriggerConfig,
270269
};
271270
});
272271
const result = await triggerFirstInvocation(invocations);

src/client/types.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -419,13 +419,6 @@ export type TriggerOptions = {
419419
* Can be used to filter the workflow run logs.
420420
*/
421421
label?: string;
422-
/**
423-
* Whether to apply the configuration (flow control,
424-
* retries, failure url, retry delay) passed in trigger
425-
*
426-
* @default false
427-
*/
428-
keepTriggerConfig?: boolean;
429422
/**
430423
* By default, Workflow SDK sends telemetry about SDK version, framework or runtime.
431424
*

src/receiver.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ describe("receiver", () => {
206206
destination: WORKFLOW_ENDPOINT,
207207
headers: {
208208
"content-type": "application/json",
209-
"upstash-feature-set": "LazyFetch,InitialBody,WF_DetectTrigger",
209+
"upstash-feature-set": "LazyFetch,InitialBody,WF_DetectTrigger,WF_TriggerOnConfig",
210210
"upstash-forward-authorization": expect.stringMatching(/Bearer /),
211211
"upstash-forward-upstash-signature": expect.any(String),
212212
"upstash-forward-upstash-workflow-sdk-version": "1",

src/serve/serve.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe("serve", () => {
8282
destination: WORKFLOW_ENDPOINT,
8383
headers: {
8484
"content-type": "application/json",
85-
"upstash-feature-set": "LazyFetch,InitialBody,WF_DetectTrigger",
85+
"upstash-feature-set": "LazyFetch,InitialBody,WF_DetectTrigger,WF_TriggerOnConfig",
8686
"upstash-label": labelValue,
8787
"upstash-forward-upstash-label": labelValue,
8888
"upstash-flow-control-key": "my-key",
@@ -190,7 +190,8 @@ describe("serve", () => {
190190
headers: {
191191
"upstash-workflow-sdk-version": "1",
192192
"content-type": "application/json",
193-
"upstash-feature-set": "LazyFetch,InitialBody,WF_DetectTrigger",
193+
"upstash-feature-set":
194+
"LazyFetch,InitialBody,WF_DetectTrigger,WF_TriggerOnConfig",
194195
"upstash-forward-upstash-workflow-sdk-version": "1",
195196
"upstash-forward-upstash-workflow-invoke-count": "2",
196197
"upstash-retries": "2",

src/workflow-requests.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ describe("Workflow Requests", () => {
127127
destination: WORKFLOW_ENDPOINT,
128128
headers: {
129129
"content-type": "application/json",
130-
"upstash-feature-set": "LazyFetch,InitialBody,WF_DetectTrigger",
130+
"upstash-feature-set": "LazyFetch,InitialBody,WF_DetectTrigger,WF_TriggerOnConfig",
131131
"upstash-forward-upstash-workflow-sdk-version": "1",
132132
"upstash-method": "POST",
133133
"upstash-retries": "0",
@@ -1069,7 +1069,7 @@ describe("Workflow Requests", () => {
10691069
"Upstash-Workflow-Init": "true",
10701070
"Upstash-Workflow-RunId": workflowRunId,
10711071
"Upstash-Workflow-Url": WORKFLOW_ENDPOINT,
1072-
"Upstash-Feature-Set": "LazyFetch,InitialBody,WF_DetectTrigger",
1072+
"Upstash-Feature-Set": "LazyFetch,InitialBody,WF_DetectTrigger,WF_TriggerOnConfig",
10731073
[WORKFLOW_PROTOCOL_VERSION_HEADER]: WORKFLOW_PROTOCOL_VERSION,
10741074
"Upstash-Forward-Upstash-Workflow-Sdk-Version": "1",
10751075
"Upstash-Retries": "0",

src/workflow-requests.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ type TriggerFirstInvocationParams<TInitialPayload> = {
4040
invokeCount?: number;
4141
delay?: PublishRequest["delay"];
4242
notBefore?: PublishRequest["notBefore"];
43-
keepTriggerConfig?: boolean;
4443
};
4544

4645
export const triggerFirstInvocation = async <TInitialPayload>(
@@ -52,15 +51,7 @@ export const triggerFirstInvocation = async <TInitialPayload>(
5251
const workflowContextClient = firstInvocationParams[0].workflowContext.qstashClient;
5352

5453
const invocationBatch = firstInvocationParams.map(
55-
({
56-
workflowContext,
57-
useJSONContent,
58-
telemetry,
59-
invokeCount,
60-
delay,
61-
notBefore,
62-
keepTriggerConfig,
63-
}) => {
54+
({ workflowContext, useJSONContent, telemetry, invokeCount, delay, notBefore }) => {
6455
const { headers } = getHeaders({
6556
initHeaderValue: "true",
6657
workflowConfig: {
@@ -75,7 +66,7 @@ export const triggerFirstInvocation = async <TInitialPayload>(
7566
},
7667
invokeCount: invokeCount ?? 0,
7768
userHeaders: workflowContext.headers,
78-
keepTriggerConfig: keepTriggerConfig,
69+
keepTriggerConfig: true,
7970
});
8071

8172
// QStash doesn't forward content-type when passed in `upstash-forward-content-type`

0 commit comments

Comments
 (0)