Added workflowId and appOrigin to the @trigger.dev/sdk run metadata
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"),
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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...");
|
||||
|
||||
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user