Added workflowId and appOrigin to the @trigger.dev/sdk run metadata

This commit is contained in:
Matt Aitken
2023-02-02 10:49:54 +00:00
parent b38961205a
commit c37edf970d
7 changed files with 10 additions and 0 deletions
@@ -688,6 +688,7 @@ function createTaskQueue() {
"x-workflow-run-id": run.id,
"x-ttl": run.workflow.triggerTtlInSeconds,
"x-is-test": run.isTest ? "true" : "false",
"x-app-origin": env.APP_ORIGIN,
},
{
eventTimestamp: run.event.timestamp.getTime(),
+2
View File
@@ -25,6 +25,7 @@ export type WorkflowRunControllerOptions = {
apiKey: string;
organizationId: string;
isTest: boolean;
appOrigin: string;
};
};
@@ -39,6 +40,7 @@ export class WorkflowRunController {
apiKey: string;
organizationId: string;
isTest: boolean;
appOrigin: string;
};
#logger: Logger;
+1
View File
@@ -420,6 +420,7 @@ export class TriggerServer {
organizationId: properties["x-org-id"],
environment: properties["x-env"],
apiKey: properties["x-api-key"],
appOrigin: properties["x-app-origin"],
isTest:
typeof properties["x-is-test"] === "string"
? properties["x-is-test"] === "true"
@@ -15,6 +15,7 @@ export const HostRPCSchema = {
organizationId: z.string(),
apiKey: z.string(),
isTest: z.boolean().default(false),
appOrigin: z.string(),
}),
}),
response: z.boolean(),
@@ -8,6 +8,7 @@ const Catalog = {
properties: WorkflowRunEventPropertiesSchema.extend({
"x-ttl": z.coerce.number().optional(),
"x-is-test": z.string().default("false"),
"x-app-origin": z.string().default("https://app.trigger.dev"),
}),
},
};
+2
View File
@@ -469,6 +469,8 @@ export class TriggerClient<TSchema extends z.ZodTypeAny> {
});
},
fetch: fetchFunction,
workflowId: data.meta.workflowId,
appOrigin: data.meta.appOrigin,
},
() => {
this.#logger.debug("Running trigger...");
+2
View File
@@ -18,6 +18,8 @@ type TriggerRunLocalStorage = {
) => Promise<z.infer<TSchema>>;
sendEvent: (key: string, event: TriggerCustomEvent) => Promise<void>;
fetch: TriggerFetch;
workflowId: string;
appOrigin: string;
};
export const triggerRunLocalStorage =