@mastra/temporal 0.4.18-alpha.2 → 0.4.18-alpha.4

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/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_utils = require("./utils-D94W1i81.cjs");
2
+ const require_utils = require("./utils-BVE1AkTt.cjs");
3
3
  let _mastra_core_workflows = require("@mastra/core/workflows");
4
- //#region src/run.ts
4
+ // src/run.ts
5
5
  var TemporalRun = class extends _mastra_core_workflows.Run {
6
6
  client;
7
7
  taskQueue;
@@ -18,7 +18,7 @@ var TemporalRun = class extends _mastra_core_workflows.Run {
18
18
  return {
19
19
  status: "success",
20
20
  input,
21
- result: await (await this.client.workflow.start(require_utils.toWorkflowType(this.workflowId), {
21
+ result: (await (await this.client.workflow.start(require_utils.toWorkflowType(this.workflowId), {
22
22
  taskQueue: this.taskQueue,
23
23
  workflowId: this.runId,
24
24
  args: [{
@@ -31,7 +31,7 @@ var TemporalRun = class extends _mastra_core_workflows.Run {
31
31
  tracingOptions: args.tracingOptions,
32
32
  perStep: args.perStep
33
33
  }]
34
- })).result(),
34
+ })).result()).result,
35
35
  state: initialState,
36
36
  steps: {}
37
37
  };
@@ -97,8 +97,7 @@ var TemporalRun = class extends _mastra_core_workflows.Run {
97
97
  return { runId: this.runId };
98
98
  }
99
99
  };
100
- //#endregion
101
- //#region src/workflow.ts
100
+ // src/workflow.ts
102
101
  var TemporalWorkflow = class extends _mastra_core_workflows.Workflow {
103
102
  temporalClient;
104
103
  taskQueue;
@@ -147,7 +146,6 @@ function init(temporalParams) {
147
146
  createStep: _mastra_core_workflows.createStep
148
147
  };
149
148
  }
150
- //#endregion
151
149
  exports.init = init;
152
150
 
153
151
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["Run","toWorkflowType","Workflow"],"sources":["../src/run.ts","../src/workflow.ts"],"sourcesContent":["import type { RequestContext } from '@mastra/core/di';\nimport { Run } from '@mastra/core/workflows';\nimport type { Step, WorkflowResult, WorkflowRunStartOptions } from '@mastra/core/workflows';\nimport type { Client } from '@temporalio/client';\nimport type { TemporalEngineType } from './types';\nimport { toWorkflowType } from './utils';\n\ntype TemporalRunStartArgs<TState, TInput, TRequestContext> = {\n inputData?: TInput;\n initialState?: TState;\n requestContext?: RequestContext<TRequestContext>;\n} & WorkflowRunStartOptions;\n\nexport class TemporalRun<\n TSteps extends Step<string, any, any, any, any, any, TemporalEngineType, any>[] = Step<\n string,\n unknown,\n unknown,\n unknown,\n unknown,\n unknown,\n TemporalEngineType\n >[],\n TState = unknown,\n TInput = unknown,\n TOutput = unknown,\n TRequestContext extends Record<string, any> | unknown = unknown,\n> extends Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext> {\n private readonly client: Client;\n private readonly taskQueue: string;\n\n constructor(\n params: ConstructorParameters<typeof Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext>>[0],\n temporalParams: {\n client: Client;\n taskQueue: string;\n },\n ) {\n super(params);\n\n this.client = temporalParams.client;\n this.taskQueue = temporalParams.taskQueue;\n }\n\n async start(args: TemporalRunStartArgs<TState, TInput, TRequestContext> = {}) {\n const input = await this._validateInput(args.inputData);\n const initialState = await this._validateInitialState(args.initialState);\n await this._validateRequestContext(args.requestContext as RequestContext<unknown> | undefined);\n\n try {\n const handle = await this.client.workflow.start(toWorkflowType(this.workflowId), {\n taskQueue: this.taskQueue,\n workflowId: this.runId,\n args: [\n {\n inputData: input,\n initialState,\n requestContext: args.requestContext ? Object.fromEntries(args.requestContext.entries()) : {},\n runId: this.runId,\n resourceId: this.resourceId,\n outputOptions: args.outputOptions,\n tracingOptions: args.tracingOptions,\n perStep: args.perStep,\n },\n ],\n });\n const result = await handle.result();\n\n return {\n status: 'success',\n input: input as TInput,\n result: result as TOutput,\n state: initialState,\n steps: {},\n } as WorkflowResult<TState, TInput, TOutput, TSteps>;\n } catch (error) {\n return {\n status: 'failed',\n input: input as TInput,\n error: error instanceof Error ? error : new Error(String(error)),\n state: initialState,\n steps: {},\n } as WorkflowResult<TState, TInput, TOutput, TSteps>;\n }\n }\n\n async cancel() {\n await this.client.workflow.getHandle(this.runId).cancel();\n await super.cancel();\n }\n\n private unsupported(method: string): never {\n throw new Error(`@mastra/temporal does not support ${method}() yet. Use start() or startAsync() instead.`);\n }\n\n override stream(\n ..._args: Parameters<Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext>['stream']>\n ): never {\n return this.unsupported('stream');\n }\n\n override streamLegacy(\n ..._args: Parameters<Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext>['streamLegacy']>\n ): never {\n return this.unsupported('streamLegacy');\n }\n\n override resumeStream(..._args: unknown[]): never {\n return this.unsupported('resumeStream');\n }\n\n override resume(..._args: unknown[]): never {\n return this.unsupported('resume');\n }\n\n override resumeAsync(..._args: unknown[]): never {\n return this.unsupported('resumeAsync');\n }\n\n override restart(\n ..._args: Parameters<Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext>['restart']>\n ): never {\n return this.unsupported('restart');\n }\n\n override timeTravel(..._args: unknown[]): never {\n return this.unsupported('timeTravel');\n }\n\n override timeTravelStream(..._args: unknown[]): never {\n return this.unsupported('timeTravelStream');\n }\n\n async startAsync(args: TemporalRunStartArgs<TState, TInput, TRequestContext> = {}) {\n const input = await this._validateInput(args.inputData);\n const initialState = await this._validateInitialState(args.initialState);\n await this._validateRequestContext(args.requestContext as RequestContext<unknown> | undefined);\n\n await this.client.workflow.start(toWorkflowType(this.workflowId), {\n taskQueue: this.taskQueue,\n workflowId: this.runId,\n args: [\n {\n inputData: input,\n initialState,\n requestContext: args.requestContext ? Object.fromEntries(args.requestContext.entries()) : {},\n runId: this.runId,\n resourceId: this.resourceId,\n outputOptions: args.outputOptions,\n tracingOptions: args.tracingOptions,\n perStep: args.perStep,\n },\n ],\n });\n\n return { runId: this.runId };\n }\n}\n","import { Workflow, createStep } from '@mastra/core/workflows';\nimport type { Step, WorkflowConfig } from '@mastra/core/workflows';\nimport type { Client } from '@temporalio/client';\nimport type { ActivityOptions } from '@temporalio/workflow';\nimport { TemporalRun } from './run';\nimport type { TemporalEngineType } from './types';\n\nexport type TemporalWorkflowParams = {\n client: Client;\n taskQueue: string;\n startToCloseTimeout?: string;\n retry?: ActivityOptions['retry'];\n};\n\nexport class TemporalWorkflow<\n TSteps extends Step<string, any, any, any, any, any, TemporalEngineType, any>[] = Step<\n string,\n unknown,\n unknown,\n unknown,\n unknown,\n unknown,\n TemporalEngineType\n >[],\n TWorkflowId extends string = string,\n TState = unknown,\n TInput = unknown,\n TOutput = unknown,\n TPrevSchema = TInput,\n TRequestContext extends Record<string, any> | unknown = unknown,\n> extends Workflow<TemporalEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, TPrevSchema, TRequestContext> {\n private readonly temporalClient: Client;\n readonly taskQueue: string;\n readonly startToCloseTimeout: string;\n\n constructor(\n params: WorkflowConfig<TWorkflowId, TState, TInput, TOutput, TSteps, TRequestContext>,\n temporalParams: TemporalWorkflowParams,\n ) {\n super(params);\n\n this.engineType = 'temporal';\n this.temporalClient = temporalParams.client;\n this.taskQueue = temporalParams.taskQueue;\n this.startToCloseTimeout = temporalParams.startToCloseTimeout ?? '1 minute';\n }\n\n async createRun(options?: { runId?: string; resourceId?: string; disableScorers?: boolean }) {\n const runId = options?.runId ?? crypto.randomUUID();\n const run = new TemporalRun<TSteps, TState, TInput, TOutput, TRequestContext>(\n {\n workflowId: this.id,\n runId,\n resourceId: options?.resourceId,\n stateSchema: this.stateSchema,\n inputSchema: this.inputSchema,\n requestContextSchema: this.requestContextSchema,\n executionEngine: this.executionEngine,\n executionGraph: this.executionGraph,\n mastra: this.mastra,\n retryConfig: this.retryConfig,\n serializedStepGraph: this.serializedStepGraph,\n disableScorers: options?.disableScorers,\n tracingPolicy: this.options.tracingPolicy,\n workflowSteps: this.steps,\n validateInputs: this.options.validateInputs,\n workflowEngineType: this.engineType,\n cleanup: undefined,\n },\n {\n client: this.temporalClient,\n taskQueue: this.taskQueue,\n },\n );\n\n this.runs.set(runId, run);\n return run;\n }\n}\n\nexport function createWorkflow<\n TSteps extends Step<string, any, any, any, any, any, TemporalEngineType, any>[] = Step<\n string,\n unknown,\n unknown,\n unknown,\n unknown,\n unknown,\n TemporalEngineType\n >[],\n TWorkflowId extends string = string,\n TState = unknown,\n TInput = unknown,\n TOutput = unknown,\n TRequestContext extends Record<string, any> | unknown = unknown,\n>(\n config: WorkflowConfig<TWorkflowId, TState, TInput, TOutput, TSteps, TRequestContext>,\n temporal: TemporalWorkflowParams,\n) {\n return new TemporalWorkflow<TSteps, TWorkflowId, TState, TInput, TOutput, TInput, TRequestContext>(config, temporal);\n}\n\nexport function init(temporalParams: TemporalWorkflowParams) {\n return {\n createWorkflow: <\n TWorkflowId extends string,\n TState = unknown,\n TInput = unknown,\n TOutput = unknown,\n TSteps extends Step[] = Step[],\n TRequestContext extends Record<string, any> | unknown = unknown,\n >(\n config: WorkflowConfig<TWorkflowId, TState, TInput, TOutput, TSteps, TRequestContext>,\n ) => createWorkflow<TSteps, TWorkflowId, TState, TInput, TOutput, TRequestContext>(config, temporalParams),\n createStep,\n };\n}\n"],"mappings":";;;;AAaA,IAAa,cAAb,cAcUA,uBAAAA,IAA0E;CAClF;CACA;CAEA,YACE,QACA,gBAIA;EACA,MAAM,MAAM;EAEZ,KAAK,SAAS,eAAe;EAC7B,KAAK,YAAY,eAAe;CAClC;CAEA,MAAM,MAAM,OAA8D,CAAC,GAAG;EAC5E,MAAM,QAAQ,MAAM,KAAK,eAAe,KAAK,SAAS;EACtD,MAAM,eAAe,MAAM,KAAK,sBAAsB,KAAK,YAAY;EACvE,MAAM,KAAK,wBAAwB,KAAK,cAAqD;EAE7F,IAAI;GAmBF,OAAO;IACL,QAAQ;IACD;IACP,QAAQ,OALW,MAhBA,KAAK,OAAO,SAAS,MAA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O,GAAG;EACxB,OAAO;CACT;AACF;AAEA,SAAgB,eAgBd,QACA,UACA;CACA,OAAO,IAAI,iBAAwF,QAAQ,QAAQ;AACrH;AAEA,SAAgB,KAAK,gBAAwC;CAC3D,OAAO;EACL,iBAQE,WACG,eAA8E,QAAQ,cAAc;EACzG,YAAA,uBAAA;CACF;AACF"}
1
+ {"version":3,"file":"index.cjs","names":["Run","toWorkflowType","Workflow"],"sources":["../src/run.ts","../src/workflow.ts"],"sourcesContent":["import type { RequestContext } from '@mastra/core/di';\nimport { Run } from '@mastra/core/workflows';\nimport type { Step, WorkflowResult, WorkflowRunStartOptions } from '@mastra/core/workflows';\nimport type { Client } from '@temporalio/client';\nimport type { WorkflowExecutionResult } from './transforms/temporal-workflow-runtime';\nimport type { TemporalEngineType } from './types';\nimport { toWorkflowType } from './utils';\n\ntype TemporalRunStartArgs<TState, TInput, TRequestContext> = {\n inputData?: TInput;\n initialState?: TState;\n requestContext?: RequestContext<TRequestContext>;\n} & WorkflowRunStartOptions;\n\nexport class TemporalRun<\n TSteps extends Step<string, any, any, any, any, any, TemporalEngineType, any>[] = Step<\n string,\n unknown,\n unknown,\n unknown,\n unknown,\n unknown,\n TemporalEngineType\n >[],\n TState = unknown,\n TInput = unknown,\n TOutput = unknown,\n TRequestContext extends Record<string, any> | unknown = unknown,\n> extends Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext> {\n private readonly client: Client;\n private readonly taskQueue: string;\n\n constructor(\n params: ConstructorParameters<typeof Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext>>[0],\n temporalParams: {\n client: Client;\n taskQueue: string;\n },\n ) {\n super(params);\n\n this.client = temporalParams.client;\n this.taskQueue = temporalParams.taskQueue;\n }\n\n async start(args: TemporalRunStartArgs<TState, TInput, TRequestContext> = {}) {\n const input = await this._validateInput(args.inputData);\n const initialState = await this._validateInitialState(args.initialState);\n await this._validateRequestContext(args.requestContext as RequestContext<unknown> | undefined);\n\n try {\n const handle = await this.client.workflow.start(toWorkflowType(this.workflowId), {\n taskQueue: this.taskQueue,\n workflowId: this.runId,\n args: [\n {\n inputData: input,\n initialState,\n requestContext: args.requestContext ? Object.fromEntries(args.requestContext.entries()) : {},\n runId: this.runId,\n resourceId: this.resourceId,\n outputOptions: args.outputOptions,\n tracingOptions: args.tracingOptions,\n perStep: args.perStep,\n },\n ],\n });\n const result = (await handle.result()) as WorkflowExecutionResult;\n\n return {\n status: 'success',\n input: input as TInput,\n result: result.result as TOutput,\n state: initialState,\n steps: {},\n } as WorkflowResult<TState, TInput, TOutput, TSteps>;\n } catch (error) {\n return {\n status: 'failed',\n input: input as TInput,\n error: error instanceof Error ? error : new Error(String(error)),\n state: initialState,\n steps: {},\n } as WorkflowResult<TState, TInput, TOutput, TSteps>;\n }\n }\n\n async cancel() {\n await this.client.workflow.getHandle(this.runId).cancel();\n await super.cancel();\n }\n\n private unsupported(method: string): never {\n throw new Error(`@mastra/temporal does not support ${method}() yet. Use start() or startAsync() instead.`);\n }\n\n override stream(\n ..._args: Parameters<Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext>['stream']>\n ): never {\n return this.unsupported('stream');\n }\n\n override streamLegacy(\n ..._args: Parameters<Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext>['streamLegacy']>\n ): never {\n return this.unsupported('streamLegacy');\n }\n\n override resumeStream(..._args: unknown[]): never {\n return this.unsupported('resumeStream');\n }\n\n override resume(..._args: unknown[]): never {\n return this.unsupported('resume');\n }\n\n override resumeAsync(..._args: unknown[]): never {\n return this.unsupported('resumeAsync');\n }\n\n override restart(\n ..._args: Parameters<Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext>['restart']>\n ): never {\n return this.unsupported('restart');\n }\n\n override timeTravel(..._args: unknown[]): never {\n return this.unsupported('timeTravel');\n }\n\n override timeTravelStream(..._args: unknown[]): never {\n return this.unsupported('timeTravelStream');\n }\n\n async startAsync(args: TemporalRunStartArgs<TState, TInput, TRequestContext> = {}) {\n const input = await this._validateInput(args.inputData);\n const initialState = await this._validateInitialState(args.initialState);\n await this._validateRequestContext(args.requestContext as RequestContext<unknown> | undefined);\n\n await this.client.workflow.start(toWorkflowType(this.workflowId), {\n taskQueue: this.taskQueue,\n workflowId: this.runId,\n args: [\n {\n inputData: input,\n initialState,\n requestContext: args.requestContext ? Object.fromEntries(args.requestContext.entries()) : {},\n runId: this.runId,\n resourceId: this.resourceId,\n outputOptions: args.outputOptions,\n tracingOptions: args.tracingOptions,\n perStep: args.perStep,\n },\n ],\n });\n\n return { runId: this.runId };\n }\n}\n","import { Workflow, createStep } from '@mastra/core/workflows';\nimport type { Step, WorkflowConfig } from '@mastra/core/workflows';\nimport type { Client } from '@temporalio/client';\nimport type { ActivityOptions } from '@temporalio/workflow';\nimport { TemporalRun } from './run';\nimport type { TemporalEngineType } from './types';\n\nexport type TemporalWorkflowParams = {\n client: Client;\n taskQueue: string;\n startToCloseTimeout?: string;\n retry?: ActivityOptions['retry'];\n};\n\nexport class TemporalWorkflow<\n TSteps extends Step<string, any, any, any, any, any, TemporalEngineType, any>[] = Step<\n string,\n unknown,\n unknown,\n unknown,\n unknown,\n unknown,\n TemporalEngineType\n >[],\n TWorkflowId extends string = string,\n TState = unknown,\n TInput = unknown,\n TOutput = unknown,\n TPrevSchema = TInput,\n TRequestContext extends Record<string, any> | unknown = unknown,\n> extends Workflow<TemporalEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, TPrevSchema, TRequestContext> {\n private readonly temporalClient: Client;\n readonly taskQueue: string;\n readonly startToCloseTimeout: string;\n\n constructor(\n params: WorkflowConfig<TWorkflowId, TState, TInput, TOutput, TSteps, TRequestContext>,\n temporalParams: TemporalWorkflowParams,\n ) {\n super(params);\n\n this.engineType = 'temporal';\n this.temporalClient = temporalParams.client;\n this.taskQueue = temporalParams.taskQueue;\n this.startToCloseTimeout = temporalParams.startToCloseTimeout ?? '1 minute';\n }\n\n async createRun(options?: { runId?: string; resourceId?: string; disableScorers?: boolean }) {\n const runId = options?.runId ?? crypto.randomUUID();\n const run = new TemporalRun<TSteps, TState, TInput, TOutput, TRequestContext>(\n {\n workflowId: this.id,\n runId,\n resourceId: options?.resourceId,\n stateSchema: this.stateSchema,\n inputSchema: this.inputSchema,\n requestContextSchema: this.requestContextSchema,\n executionEngine: this.executionEngine,\n executionGraph: this.executionGraph,\n mastra: this.mastra,\n retryConfig: this.retryConfig,\n serializedStepGraph: this.serializedStepGraph,\n disableScorers: options?.disableScorers,\n tracingPolicy: this.options.tracingPolicy,\n workflowSteps: this.steps,\n validateInputs: this.options.validateInputs,\n workflowEngineType: this.engineType,\n cleanup: undefined,\n },\n {\n client: this.temporalClient,\n taskQueue: this.taskQueue,\n },\n );\n\n this.runs.set(runId, run);\n return run;\n }\n}\n\nexport function createWorkflow<\n TSteps extends Step<string, any, any, any, any, any, TemporalEngineType, any>[] = Step<\n string,\n unknown,\n unknown,\n unknown,\n unknown,\n unknown,\n TemporalEngineType\n >[],\n TWorkflowId extends string = string,\n TState = unknown,\n TInput = unknown,\n TOutput = unknown,\n TRequestContext extends Record<string, any> | unknown = unknown,\n>(\n config: WorkflowConfig<TWorkflowId, TState, TInput, TOutput, TSteps, TRequestContext>,\n temporal: TemporalWorkflowParams,\n) {\n return new TemporalWorkflow<TSteps, TWorkflowId, TState, TInput, TOutput, TInput, TRequestContext>(config, temporal);\n}\n\nexport function init(temporalParams: TemporalWorkflowParams) {\n return {\n createWorkflow: <\n TWorkflowId extends string,\n TState = unknown,\n TInput = unknown,\n TOutput = unknown,\n TSteps extends Step[] = Step[],\n TRequestContext extends Record<string, any> | unknown = unknown,\n >(\n config: WorkflowConfig<TWorkflowId, TState, TInput, TOutput, TSteps, TRequestContext>,\n ) => createWorkflow<TSteps, TWorkflowId, TState, TInput, TOutput, TRequestContext>(config, temporalParams),\n createStep,\n };\n}\n"],"mappings":";;;;AAcA,IAAa,cAAb,cAcUA,uBAAAA,IAA0E;CAClF;CACA;CAEA,YACE,QACA,gBA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AClB,aAAa,KAAK;GAClB,sBAAsB,KAAK;GAC3B,iBAAiB,KAAK;GACtB,gBAAgB,KAAK;GACrB,QAAQ,KAAK;GACb,aAAa,KAAK;GAClB,qBAAqB,KAAK;GAC1B,gBAAgB,SAAS;GACzB,eAAe,KAAK,QAAQ;GAC5B,eAAe,KAAK;GACpB,gBAAgB,KAAK,QAAQ;GAC7B,oBAAoB,KAAK;GACzB,SAAS,KAAA;EACX,GACA;GACE,QAAQ,KAAK;GACb,WAAW,KAAK;EAClB,CACF;EAEA,KAAK,KAAK,IAAI,OAAO,GAAG;EACxB,OAAO;CACT;AACF;AAEA,SAAgB,eAgBd,QACA,UACA;CACA,OAAO,IAAI,iBAAwF,QAAQ,QAAQ;AACrH;AAEA,SAAgB,KAAK,gBAAwC;CAC3D,OAAO;EACL,iBAQE,WACG,eAA8E,QAAQ,cAAc;EACzG,YAAA,uBAAA;CACF;AACF"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { t as toWorkflowType } from "./utils-B_iPTfDi.js";
1
+ import { t as toWorkflowType } from "./utils-R6cB86BM.js";
2
2
  import { Run, Workflow, createStep } from "@mastra/core/workflows";
3
- //#region src/run.ts
3
+ // src/run.ts
4
4
  var TemporalRun = class extends Run {
5
5
  client;
6
6
  taskQueue;
@@ -17,7 +17,7 @@ var TemporalRun = class extends Run {
17
17
  return {
18
18
  status: "success",
19
19
  input,
20
- result: await (await this.client.workflow.start(toWorkflowType(this.workflowId), {
20
+ result: (await (await this.client.workflow.start(toWorkflowType(this.workflowId), {
21
21
  taskQueue: this.taskQueue,
22
22
  workflowId: this.runId,
23
23
  args: [{
@@ -30,7 +30,7 @@ var TemporalRun = class extends Run {
30
30
  tracingOptions: args.tracingOptions,
31
31
  perStep: args.perStep
32
32
  }]
33
- })).result(),
33
+ })).result()).result,
34
34
  state: initialState,
35
35
  steps: {}
36
36
  };
@@ -96,8 +96,7 @@ var TemporalRun = class extends Run {
96
96
  return { runId: this.runId };
97
97
  }
98
98
  };
99
- //#endregion
100
- //#region src/workflow.ts
99
+ // src/workflow.ts
101
100
  var TemporalWorkflow = class extends Workflow {
102
101
  temporalClient;
103
102
  taskQueue;
@@ -146,7 +145,6 @@ function init(temporalParams) {
146
145
  createStep
147
146
  };
148
147
  }
149
- //#endregion
150
148
  export { init };
151
149
 
152
150
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/run.ts","../src/workflow.ts"],"sourcesContent":["import type { RequestContext } from '@mastra/core/di';\nimport { Run } from '@mastra/core/workflows';\nimport type { Step, WorkflowResult, WorkflowRunStartOptions } from '@mastra/core/workflows';\nimport type { Client } from '@temporalio/client';\nimport type { TemporalEngineType } from './types';\nimport { toWorkflowType } from './utils';\n\ntype TemporalRunStartArgs<TState, TInput, TRequestContext> = {\n inputData?: TInput;\n initialState?: TState;\n requestContext?: RequestContext<TRequestContext>;\n} & WorkflowRunStartOptions;\n\nexport class TemporalRun<\n TSteps extends Step<string, any, any, any, any, any, TemporalEngineType, any>[] = Step<\n string,\n unknown,\n unknown,\n unknown,\n unknown,\n unknown,\n TemporalEngineType\n >[],\n TState = unknown,\n TInput = unknown,\n TOutput = unknown,\n TRequestContext extends Record<string, any> | unknown = unknown,\n> extends Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext> {\n private readonly client: Client;\n private readonly taskQueue: string;\n\n constructor(\n params: ConstructorParameters<typeof Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext>>[0],\n temporalParams: {\n client: Client;\n taskQueue: string;\n },\n ) {\n super(params);\n\n this.client = temporalParams.client;\n this.taskQueue = temporalParams.taskQueue;\n }\n\n async start(args: TemporalRunStartArgs<TState, TInput, TRequestContext> = {}) {\n const input = await this._validateInput(args.inputData);\n const initialState = await this._validateInitialState(args.initialState);\n await this._validateRequestContext(args.requestContext as RequestContext<unknown> | undefined);\n\n try {\n const handle = await this.client.workflow.start(toWorkflowType(this.workflowId), {\n taskQueue: this.taskQueue,\n workflowId: this.runId,\n args: [\n {\n inputData: input,\n initialState,\n requestContext: args.requestContext ? Object.fromEntries(args.requestContext.entries()) : {},\n runId: this.runId,\n resourceId: this.resourceId,\n outputOptions: args.outputOptions,\n tracingOptions: args.tracingOptions,\n perStep: args.perStep,\n },\n ],\n });\n const result = await handle.result();\n\n return {\n status: 'success',\n input: input as TInput,\n result: result as TOutput,\n state: initialState,\n steps: {},\n } as WorkflowResult<TState, TInput, TOutput, TSteps>;\n } catch (error) {\n return {\n status: 'failed',\n input: input as TInput,\n error: error instanceof Error ? error : new Error(String(error)),\n state: initialState,\n steps: {},\n } as WorkflowResult<TState, TInput, TOutput, TSteps>;\n }\n }\n\n async cancel() {\n await this.client.workflow.getHandle(this.runId).cancel();\n await super.cancel();\n }\n\n private unsupported(method: string): never {\n throw new Error(`@mastra/temporal does not support ${method}() yet. Use start() or startAsync() instead.`);\n }\n\n override stream(\n ..._args: Parameters<Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext>['stream']>\n ): never {\n return this.unsupported('stream');\n }\n\n override streamLegacy(\n ..._args: Parameters<Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext>['streamLegacy']>\n ): never {\n return this.unsupported('streamLegacy');\n }\n\n override resumeStream(..._args: unknown[]): never {\n return this.unsupported('resumeStream');\n }\n\n override resume(..._args: unknown[]): never {\n return this.unsupported('resume');\n }\n\n override resumeAsync(..._args: unknown[]): never {\n return this.unsupported('resumeAsync');\n }\n\n override restart(\n ..._args: Parameters<Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext>['restart']>\n ): never {\n return this.unsupported('restart');\n }\n\n override timeTravel(..._args: unknown[]): never {\n return this.unsupported('timeTravel');\n }\n\n override timeTravelStream(..._args: unknown[]): never {\n return this.unsupported('timeTravelStream');\n }\n\n async startAsync(args: TemporalRunStartArgs<TState, TInput, TRequestContext> = {}) {\n const input = await this._validateInput(args.inputData);\n const initialState = await this._validateInitialState(args.initialState);\n await this._validateRequestContext(args.requestContext as RequestContext<unknown> | undefined);\n\n await this.client.workflow.start(toWorkflowType(this.workflowId), {\n taskQueue: this.taskQueue,\n workflowId: this.runId,\n args: [\n {\n inputData: input,\n initialState,\n requestContext: args.requestContext ? Object.fromEntries(args.requestContext.entries()) : {},\n runId: this.runId,\n resourceId: this.resourceId,\n outputOptions: args.outputOptions,\n tracingOptions: args.tracingOptions,\n perStep: args.perStep,\n },\n ],\n });\n\n return { runId: this.runId };\n }\n}\n","import { Workflow, createStep } from '@mastra/core/workflows';\nimport type { Step, WorkflowConfig } from '@mastra/core/workflows';\nimport type { Client } from '@temporalio/client';\nimport type { ActivityOptions } from '@temporalio/workflow';\nimport { TemporalRun } from './run';\nimport type { TemporalEngineType } from './types';\n\nexport type TemporalWorkflowParams = {\n client: Client;\n taskQueue: string;\n startToCloseTimeout?: string;\n retry?: ActivityOptions['retry'];\n};\n\nexport class TemporalWorkflow<\n TSteps extends Step<string, any, any, any, any, any, TemporalEngineType, any>[] = Step<\n string,\n unknown,\n unknown,\n unknown,\n unknown,\n unknown,\n TemporalEngineType\n >[],\n TWorkflowId extends string = string,\n TState = unknown,\n TInput = unknown,\n TOutput = unknown,\n TPrevSchema = TInput,\n TRequestContext extends Record<string, any> | unknown = unknown,\n> extends Workflow<TemporalEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, TPrevSchema, TRequestContext> {\n private readonly temporalClient: Client;\n readonly taskQueue: string;\n readonly startToCloseTimeout: string;\n\n constructor(\n params: WorkflowConfig<TWorkflowId, TState, TInput, TOutput, TSteps, TRequestContext>,\n temporalParams: TemporalWorkflowParams,\n ) {\n super(params);\n\n this.engineType = 'temporal';\n this.temporalClient = temporalParams.client;\n this.taskQueue = temporalParams.taskQueue;\n this.startToCloseTimeout = temporalParams.startToCloseTimeout ?? '1 minute';\n }\n\n async createRun(options?: { runId?: string; resourceId?: string; disableScorers?: boolean }) {\n const runId = options?.runId ?? crypto.randomUUID();\n const run = new TemporalRun<TSteps, TState, TInput, TOutput, TRequestContext>(\n {\n workflowId: this.id,\n runId,\n resourceId: options?.resourceId,\n stateSchema: this.stateSchema,\n inputSchema: this.inputSchema,\n requestContextSchema: this.requestContextSchema,\n executionEngine: this.executionEngine,\n executionGraph: this.executionGraph,\n mastra: this.mastra,\n retryConfig: this.retryConfig,\n serializedStepGraph: this.serializedStepGraph,\n disableScorers: options?.disableScorers,\n tracingPolicy: this.options.tracingPolicy,\n workflowSteps: this.steps,\n validateInputs: this.options.validateInputs,\n workflowEngineType: this.engineType,\n cleanup: undefined,\n },\n {\n client: this.temporalClient,\n taskQueue: this.taskQueue,\n },\n );\n\n this.runs.set(runId, run);\n return run;\n }\n}\n\nexport function createWorkflow<\n TSteps extends Step<string, any, any, any, any, any, TemporalEngineType, any>[] = Step<\n string,\n unknown,\n unknown,\n unknown,\n unknown,\n unknown,\n TemporalEngineType\n >[],\n TWorkflowId extends string = string,\n TState = unknown,\n TInput = unknown,\n TOutput = unknown,\n TRequestContext extends Record<string, any> | unknown = unknown,\n>(\n config: WorkflowConfig<TWorkflowId, TState, TInput, TOutput, TSteps, TRequestContext>,\n temporal: TemporalWorkflowParams,\n) {\n return new TemporalWorkflow<TSteps, TWorkflowId, TState, TInput, TOutput, TInput, TRequestContext>(config, temporal);\n}\n\nexport function init(temporalParams: TemporalWorkflowParams) {\n return {\n createWorkflow: <\n TWorkflowId extends string,\n TState = unknown,\n TInput = unknown,\n TOutput = unknown,\n TSteps extends Step[] = Step[],\n TRequestContext extends Record<string, any> | unknown = unknown,\n >(\n config: WorkflowConfig<TWorkflowId, TState, TInput, TOutput, TSteps, TRequestContext>,\n ) => createWorkflow<TSteps, TWorkflowId, TState, TInput, TOutput, TRequestContext>(config, temporalParams),\n createStep,\n };\n}\n"],"mappings":";;;AAaA,IAAa,cAAb,cAcU,IAA0E;CAClF;CACA;CAEA,YACE,QACA,gBAIA;EACA,MAAM,MAAM;EAEZ,KAAK,SAAS,eAAe;EAC7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QAAQ,KAAK;GACb,aAAa,KAAK;GAClB,qBAAqB,KAAK;GAC1B,gBAAgB,SAAS;GACzB,eAAe,KAAK,QAAQ;GAC5B,eAAe,KAAK;GACpB,gBAAgB,KAAK,QAAQ;GAC7B,oBAAoB,KAAK;GACzB,SAAS,KAAA;EACX,GACA;GACE,QAAQ,KAAK;GACb,WAAW,KAAK;EAClB,CACF;EAEA,KAAK,KAAK,IAAI,OAAO,GAAG;EACxB,OAAO;CACT;AACF;AAEA,SAAgB,eAgBd,QACA,UACA;CACA,OAAO,IAAI,iBAAwF,QAAQ,QAAQ;AACrH;AAEA,SAAgB,KAAK,gBAAwC;CAC3D,OAAO;EACL,iBAQE,WACG,eAA8E,QAAQ,cAAc;EACzG;CACF;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/run.ts","../src/workflow.ts"],"sourcesContent":["import type { RequestContext } from '@mastra/core/di';\nimport { Run } from '@mastra/core/workflows';\nimport type { Step, WorkflowResult, WorkflowRunStartOptions } from '@mastra/core/workflows';\nimport type { Client } from '@temporalio/client';\nimport type { WorkflowExecutionResult } from './transforms/temporal-workflow-runtime';\nimport type { TemporalEngineType } from './types';\nimport { toWorkflowType } from './utils';\n\ntype TemporalRunStartArgs<TState, TInput, TRequestContext> = {\n inputData?: TInput;\n initialState?: TState;\n requestContext?: RequestContext<TRequestContext>;\n} & WorkflowRunStartOptions;\n\nexport class TemporalRun<\n TSteps extends Step<string, any, any, any, any, any, TemporalEngineType, any>[] = Step<\n string,\n unknown,\n unknown,\n unknown,\n unknown,\n unknown,\n TemporalEngineType\n >[],\n TState = unknown,\n TInput = unknown,\n TOutput = unknown,\n TRequestContext extends Record<string, any> | unknown = unknown,\n> extends Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext> {\n private readonly client: Client;\n private readonly taskQueue: string;\n\n constructor(\n params: ConstructorParameters<typeof Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext>>[0],\n temporalParams: {\n client: Client;\n taskQueue: string;\n },\n ) {\n super(params);\n\n this.client = temporalParams.client;\n this.taskQueue = temporalParams.taskQueue;\n }\n\n async start(args: TemporalRunStartArgs<TState, TInput, TRequestContext> = {}) {\n const input = await this._validateInput(args.inputData);\n const initialState = await this._validateInitialState(args.initialState);\n await this._validateRequestContext(args.requestContext as RequestContext<unknown> | undefined);\n\n try {\n const handle = await this.client.workflow.start(toWorkflowType(this.workflowId), {\n taskQueue: this.taskQueue,\n workflowId: this.runId,\n args: [\n {\n inputData: input,\n initialState,\n requestContext: args.requestContext ? Object.fromEntries(args.requestContext.entries()) : {},\n runId: this.runId,\n resourceId: this.resourceId,\n outputOptions: args.outputOptions,\n tracingOptions: args.tracingOptions,\n perStep: args.perStep,\n },\n ],\n });\n const result = (await handle.result()) as WorkflowExecutionResult;\n\n return {\n status: 'success',\n input: input as TInput,\n result: result.result as TOutput,\n state: initialState,\n steps: {},\n } as WorkflowResult<TState, TInput, TOutput, TSteps>;\n } catch (error) {\n return {\n status: 'failed',\n input: input as TInput,\n error: error instanceof Error ? error : new Error(String(error)),\n state: initialState,\n steps: {},\n } as WorkflowResult<TState, TInput, TOutput, TSteps>;\n }\n }\n\n async cancel() {\n await this.client.workflow.getHandle(this.runId).cancel();\n await super.cancel();\n }\n\n private unsupported(method: string): never {\n throw new Error(`@mastra/temporal does not support ${method}() yet. Use start() or startAsync() instead.`);\n }\n\n override stream(\n ..._args: Parameters<Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext>['stream']>\n ): never {\n return this.unsupported('stream');\n }\n\n override streamLegacy(\n ..._args: Parameters<Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext>['streamLegacy']>\n ): never {\n return this.unsupported('streamLegacy');\n }\n\n override resumeStream(..._args: unknown[]): never {\n return this.unsupported('resumeStream');\n }\n\n override resume(..._args: unknown[]): never {\n return this.unsupported('resume');\n }\n\n override resumeAsync(..._args: unknown[]): never {\n return this.unsupported('resumeAsync');\n }\n\n override restart(\n ..._args: Parameters<Run<TemporalEngineType, TSteps, TState, TInput, TOutput, TRequestContext>['restart']>\n ): never {\n return this.unsupported('restart');\n }\n\n override timeTravel(..._args: unknown[]): never {\n return this.unsupported('timeTravel');\n }\n\n override timeTravelStream(..._args: unknown[]): never {\n return this.unsupported('timeTravelStream');\n }\n\n async startAsync(args: TemporalRunStartArgs<TState, TInput, TRequestContext> = {}) {\n const input = await this._validateInput(args.inputData);\n const initialState = await this._validateInitialState(args.initialState);\n await this._validateRequestContext(args.requestContext as RequestContext<unknown> | undefined);\n\n await this.client.workflow.start(toWorkflowType(this.workflowId), {\n taskQueue: this.taskQueue,\n workflowId: this.runId,\n args: [\n {\n inputData: input,\n initialState,\n requestContext: args.requestContext ? Object.fromEntries(args.requestContext.entries()) : {},\n runId: this.runId,\n resourceId: this.resourceId,\n outputOptions: args.outputOptions,\n tracingOptions: args.tracingOptions,\n perStep: args.perStep,\n },\n ],\n });\n\n return { runId: this.runId };\n }\n}\n","import { Workflow, createStep } from '@mastra/core/workflows';\nimport type { Step, WorkflowConfig } from '@mastra/core/workflows';\nimport type { Client } from '@temporalio/client';\nimport type { ActivityOptions } from '@temporalio/workflow';\nimport { TemporalRun } from './run';\nimport type { TemporalEngineType } from './types';\n\nexport type TemporalWorkflowParams = {\n client: Client;\n taskQueue: string;\n startToCloseTimeout?: string;\n retry?: ActivityOptions['retry'];\n};\n\nexport class TemporalWorkflow<\n TSteps extends Step<string, any, any, any, any, any, TemporalEngineType, any>[] = Step<\n string,\n unknown,\n unknown,\n unknown,\n unknown,\n unknown,\n TemporalEngineType\n >[],\n TWorkflowId extends string = string,\n TState = unknown,\n TInput = unknown,\n TOutput = unknown,\n TPrevSchema = TInput,\n TRequestContext extends Record<string, any> | unknown = unknown,\n> extends Workflow<TemporalEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, TPrevSchema, TRequestContext> {\n private readonly temporalClient: Client;\n readonly taskQueue: string;\n readonly startToCloseTimeout: string;\n\n constructor(\n params: WorkflowConfig<TWorkflowId, TState, TInput, TOutput, TSteps, TRequestContext>,\n temporalParams: TemporalWorkflowParams,\n ) {\n super(params);\n\n this.engineType = 'temporal';\n this.temporalClient = temporalParams.client;\n this.taskQueue = temporalParams.taskQueue;\n this.startToCloseTimeout = temporalParams.startToCloseTimeout ?? '1 minute';\n }\n\n async createRun(options?: { runId?: string; resourceId?: string; disableScorers?: boolean }) {\n const runId = options?.runId ?? crypto.randomUUID();\n const run = new TemporalRun<TSteps, TState, TInput, TOutput, TRequestContext>(\n {\n workflowId: this.id,\n runId,\n resourceId: options?.resourceId,\n stateSchema: this.stateSchema,\n inputSchema: this.inputSchema,\n requestContextSchema: this.requestContextSchema,\n executionEngine: this.executionEngine,\n executionGraph: this.executionGraph,\n mastra: this.mastra,\n retryConfig: this.retryConfig,\n serializedStepGraph: this.serializedStepGraph,\n disableScorers: options?.disableScorers,\n tracingPolicy: this.options.tracingPolicy,\n workflowSteps: this.steps,\n validateInputs: this.options.validateInputs,\n workflowEngineType: this.engineType,\n cleanup: undefined,\n },\n {\n client: this.temporalClient,\n taskQueue: this.taskQueue,\n },\n );\n\n this.runs.set(runId, run);\n return run;\n }\n}\n\nexport function createWorkflow<\n TSteps extends Step<string, any, any, any, any, any, TemporalEngineType, any>[] = Step<\n string,\n unknown,\n unknown,\n unknown,\n unknown,\n unknown,\n TemporalEngineType\n >[],\n TWorkflowId extends string = string,\n TState = unknown,\n TInput = unknown,\n TOutput = unknown,\n TRequestContext extends Record<string, any> | unknown = unknown,\n>(\n config: WorkflowConfig<TWorkflowId, TState, TInput, TOutput, TSteps, TRequestContext>,\n temporal: TemporalWorkflowParams,\n) {\n return new TemporalWorkflow<TSteps, TWorkflowId, TState, TInput, TOutput, TInput, TRequestContext>(config, temporal);\n}\n\nexport function init(temporalParams: TemporalWorkflowParams) {\n return {\n createWorkflow: <\n TWorkflowId extends string,\n TState = unknown,\n TInput = unknown,\n TOutput = unknown,\n TSteps extends Step[] = Step[],\n TRequestContext extends Record<string, any> | unknown = unknown,\n >(\n config: WorkflowConfig<TWorkflowId, TState, TInput, TOutput, TSteps, TRequestContext>,\n ) => createWorkflow<TSteps, TWorkflowId, TState, TInput, TOutput, TRequestContext>(config, temporalParams),\n createStep,\n };\n}\n"],"mappings":";;;AAcA,IAAa,cAAb,cAcU,IAA0E;CAClF;CACA;CAEA,YACE,QACA,gBAIA;EACA,MAAM,MAAM;EAEZ,KAAK,SAAS,eAAe;EAC7B,KAAK,YAAY,eAAe;CAClC;CAEA,MAAM,MAAM,OAA8D,CAAC,GAAG;EAC5E,MAAM,QAAQ,MAAM,KAAK,eAAe,KAAK,SAAS;EACtD,MAAM,eAAe,MAAM,KAAK,sBAAsB,KAAK,YAAY;EACvE,MAAM,KAAK,wBAAwB,KAAK,cAAqD;EAE7F,IAAI;GAmBF,OAAO;IACL,QAAQ;IACD;IACP,SAAQ,OALY,MAhBD,KAAK,OAAO,SAAS,MAAM,eAAe,KAAK,UAAU,GAAG;KAC/E,WAAW,KAAK;KAChB,YAAY,KAAK;KACjB,MAAM,CACJ;MACE,WAAW;MACX;MACA,gBAAgB,KAAK,iBAAiB,OAAO,YAAY,KAAK,eAAe,QAAQ,CAAC,IAAI,CAAC;MAC3F,OAAO,KAAK;MACZ,YAAY,KAAK;MACjB,eAAe,KAAK;MACpB,gBAAgB,KAAK;MACrB,SAAS,KAAK;KAChB,CACF;IACF,CAAC,EAAA,CAC4B,OAAO,EAAA,CAKnB;IACf,OAAO;IACP,OAAO,CAAC;GACV;EACF,SAAS,OAAO;GACd,OAAO;IACL,QAAQ;IACD;IACP,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;IAC/D,OAAO;IACP,OAAO,CAAC;GACV;EACF;CACF;CAEA,MAAM,SAAS;EACb,MAAM,KAAK,OAAO,SAAS,UAAU,KAAK,KAAK,CAAC,CAAC,OAAO;EACxD,MAAM,MAAM,OAAO;CACrB;CAEA,YAAoB,QAAuB;EACzC,MAAM,IAAI,MAAM,q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C,KAAK,sBAAsB,eAAe,uBAAuB;CACnE;CAEA,MAAM,UAAU,SAA6E;EAC3F,MAAM,QAAQ,SAAS,SAAS,OAAO,WAAW;EAClD,MAAM,MAAM,IAAI,YACd;GACE,YAAY,KAAK;GACjB;GACA,YAAY,SAAS;GACrB,aAAa,KAAK;GAClB,aAAa,KAAK;GAClB,sBAAsB,KAAK;GAC3B,iBAAiB,KAAK;GACtB,gBAAgB,KAAK;GACrB,QAAQ,KAAK;GACb,aAAa,KAAK;GAClB,qBAAqB,KAAK;GAC1B,gBAAgB,SAAS;GACzB,eAAe,KAAK,QAAQ;GAC5B,eAAe,KAAK;GACpB,gBAAgB,KAAK,QAAQ;GAC7B,oBAAoB,KAAK;GACzB,SAAS,KAAA;EACX,GACA;GACE,QAAQ,KAAK;GACb,WAAW,KAAK;EAClB,CACF;EAEA,KAAK,KAAK,IAAI,OAAO,GAAG;EACxB,OAAO;CACT;AACF;AAEA,SAAgB,eAgBd,QACA,UACA;CACA,OAAO,IAAI,iBAAwF,QAAQ,QAAQ;AACrH;AAEA,SAAgB,KAAK,gBAAwC;CAC3D,OAAO;EACL,iBAQE,WACG,eAA8E,QAAQ,cAAc;EACzG;CACF;AACF"}
@@ -1,5 +1,5 @@
1
1
  import { Bundler } from "@mastra/deployer/bundler";
2
- //#region src/mastra-deployer.ts
2
+ // src/mastra-deployer.ts
3
3
  var BuildBundler = class extends Bundler {
4
4
  constructor() {
5
5
  super("Temporal");
@@ -34,7 +34,6 @@ var BuildBundler = class extends Bundler {
34
34
  await super.lint(entryFile, outputDirectory, toolsPaths);
35
35
  }
36
36
  };
37
- //#endregion
38
37
  export { BuildBundler };
39
38
 
40
- //# sourceMappingURL=mastra-deployer-rZLKb1Em.js.map
39
+ //# sourceMappingURL=mastra-deployer-BtoNM1bq.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mastra-deployer-rZLKb1Em.js","names":[],"sources":["../src/mastra-deployer.ts"],"sourcesContent":["import type { Config } from '@mastra/core/mastra';\nimport { Bundler } from '@mastra/deployer/bundler';\n\nexport class BuildBundler extends Bundler {\n constructor() {\n super('Temporal');\n this.platform = process.versions?.bun ? 'neutral' : 'node';\n }\n\n protected async getUserBundlerOptions(\n mastraEntryFile: string,\n outputDirectory: string,\n ): Promise<NonNullable<Config['bundler']>> {\n const bundlerOptions = await super.getUserBundlerOptions(mastraEntryFile, outputDirectory);\n\n return {\n ...bundlerOptions,\n externals: true,\n sourcemap: true,\n };\n }\n\n getEnvFiles(): Promise<string[]> {\n return Promise.resolve([]);\n }\n\n protected installDependencies(): Promise<void> {\n return Promise.resolve();\n }\n\n protected copyPublic(): Promise<void> {\n return Promise.resolve();\n }\n\n writePackageJson(): Promise<void> {\n return Promise.resolve();\n }\n\n async bundle(\n entryFile: string,\n outputDirectory: string,\n { toolsPaths, projectRoot }: { toolsPaths: (string | string[])[]; projectRoot: string },\n ): Promise<void> {\n return this._bundle(entryFile, entryFile, { outputDirectory, projectRoot }, toolsPaths);\n }\n\n async lint(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n await super.lint(entryFile, outputDirectory, toolsPaths);\n }\n}\n"],"mappings":";;AAGA,IAAa,eAAb,cAAkC,QAAQ;CACxC,cAAc;EACZ,MAAM,UAAU;EAChB,KAAK,WAAW,QAAQ,UAAU,MAAM,YAAY;CACtD;CAEA,MAAgB,sBACd,iBACA,iBACyC;EAGzC,OAAO;GACL,GAAG,MAHwB,MAAM,sBAAsB,iBAAiB,eAAe;GAIvF,WAAW;GACX,WAAW;EACb;CACF;CAEA,cAAiC;EAC/B,OAAO,QAAQ,QAAQ,CAAC,CAAC;CAC3B;CAEA,sBAA+C;EAC7C,OAAO,QAAQ,QAAQ;CACzB;CAEA,aAAsC;EACpC,OAAO,QAAQ,QAAQ;CACzB;CAEA,mBAAkC;EAChC,OAAO,QAAQ,QAAQ;CACzB;CAEA,MAAM,OACJ,WACA,iBACA,EAAE,YAAY,eACC;EACf,OAAO,KAAK,QAAQ,WAAW,WAAW;GAAE;GAAiB;EAAY,GAAG,UAAU;CACxF;CAEA,MAAM,KAAK,WAAmB,iBAAyB,YAAkD;EACvG,MAAM,MAAM,KAAK,WAAW,iBAAiB,UAAU;CACzD;AACF"}
1
+ {"version":3,"file":"mastra-deployer-BtoNM1bq.js","names":[],"sources":["../src/mastra-deployer.ts"],"sourcesContent":["import type { Config } from '@mastra/core/mastra';\nimport { Bundler } from '@mastra/deployer/bundler';\n\nexport class BuildBundler extends Bundler {\n constructor() {\n super('Temporal');\n this.platform = process.versions?.bun ? 'neutral' : 'node';\n }\n\n protected async getUserBundlerOptions(\n mastraEntryFile: string,\n outputDirectory: string,\n ): Promise<NonNullable<Config['bundler']>> {\n const bundlerOptions = await super.getUserBundlerOptions(mastraEntryFile, outputDirectory);\n\n return {\n ...bundlerOptions,\n externals: true,\n sourcemap: true,\n };\n }\n\n getEnvFiles(): Promise<string[]> {\n return Promise.resolve([]);\n }\n\n protected installDependencies(): Promise<void> {\n return Promise.resolve();\n }\n\n protected copyPublic(): Promise<void> {\n return Promise.resolve();\n }\n\n writePackageJson(): Promise<void> {\n return Promise.resolve();\n }\n\n async bundle(\n entryFile: string,\n outputDirectory: string,\n { toolsPaths, projectRoot }: { toolsPaths: (string | string[])[]; projectRoot: string },\n ): Promise<void> {\n return this._bundle(entryFile, entryFile, { outputDirectory, projectRoot }, toolsPaths);\n }\n\n async lint(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n await super.lint(entryFile, outputDirectory, toolsPaths);\n }\n}\n"],"mappings":";;AAGA,IAAa,eAAb,cAAkC,QAAQ;CACxC,cAAc;EACZ,MAAM,UAAU;EAChB,KAAK,WAAW,QAAQ,UAAU,MAAM,YAAY;CACtD;CAEA,MAAgB,sBACd,iBACA,iBACyC;EAGzC,OAAO;GACL,GAAG,MAHwB,MAAM,sBAAsB,iBAAiB,eAAe;GAIvF,WAAW;GACX,WAAW;EACb;CACF;CAEA,cAAiC;EAC/B,OAAO,QAAQ,QAAQ,CAAC,CAAC;CAC3B;CAEA,sBAA+C;EAC7C,OAAO,QAAQ,QAAQ;CACzB;CAEA,aAAsC;EACpC,OAAO,QAAQ,QAAQ;CACzB;CAEA,mBAAkC;EAChC,OAAO,QAAQ,QAAQ;CACzB;CAEA,MAAM,OACJ,WACA,iBACA,EAAE,YAAY,eACC;EACf,OAAO,KAAK,QAAQ,WAAW,WAAW;GAAE;GAAiB;EAAY,GAAG,UAAU;CACxF;CAEA,MAAM,KAAK,WAAmB,iBAAyB,YAAkD;EACvG,MAAM,MAAM,KAAK,WAAW,iBAAiB,UAAU;CACzD;AACF"}
@@ -1,5 +1,5 @@
1
1
  let _mastra_deployer_bundler = require("@mastra/deployer/bundler");
2
- //#region src/mastra-deployer.ts
2
+ // src/mastra-deployer.ts
3
3
  var BuildBundler = class extends _mastra_deployer_bundler.Bundler {
4
4
  constructor() {
5
5
  super("Temporal");
@@ -34,7 +34,6 @@ var BuildBundler = class extends _mastra_deployer_bundler.Bundler {
34
34
  await super.lint(entryFile, outputDirectory, toolsPaths);
35
35
  }
36
36
  };
37
- //#endregion
38
37
  exports.BuildBundler = BuildBundler;
39
38
 
40
- //# sourceMappingURL=mastra-deployer-D6fHvmFM.cjs.map
39
+ //# sourceMappingURL=mastra-deployer-CxXfbT3P.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mastra-deployer-D6fHvmFM.cjs","names":["Bundler"],"sources":["../src/mastra-deployer.ts"],"sourcesContent":["import type { Config } from '@mastra/core/mastra';\nimport { Bundler } from '@mastra/deployer/bundler';\n\nexport class BuildBundler extends Bundler {\n constructor() {\n super('Temporal');\n this.platform = process.versions?.bun ? 'neutral' : 'node';\n }\n\n protected async getUserBundlerOptions(\n mastraEntryFile: string,\n outputDirectory: string,\n ): Promise<NonNullable<Config['bundler']>> {\n const bundlerOptions = await super.getUserBundlerOptions(mastraEntryFile, outputDirectory);\n\n return {\n ...bundlerOptions,\n externals: true,\n sourcemap: true,\n };\n }\n\n getEnvFiles(): Promise<string[]> {\n return Promise.resolve([]);\n }\n\n protected installDependencies(): Promise<void> {\n return Promise.resolve();\n }\n\n protected copyPublic(): Promise<void> {\n return Promise.resolve();\n }\n\n writePackageJson(): Promise<void> {\n return Promise.resolve();\n }\n\n async bundle(\n entryFile: string,\n outputDirectory: string,\n { toolsPaths, projectRoot }: { toolsPaths: (string | string[])[]; projectRoot: string },\n ): Promise<void> {\n return this._bundle(entryFile, entryFile, { outputDirectory, projectRoot }, toolsPaths);\n }\n\n async lint(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n await super.lint(entryFile, outputDirectory, toolsPaths);\n }\n}\n"],"mappings":";;AAGA,IAAa,eAAb,cAAkCA,yBAAAA,QAAQ;CACxC,cAAc;EACZ,MAAM,UAAU;EAChB,KAAK,WAAW,QAAQ,UAAU,MAAM,YAAY;CACtD;CAEA,MAAgB,sBACd,iBACA,iBACyC;EAGzC,OAAO;GACL,GAAG,MAHwB,MAAM,sBAAsB,iBAAiB,eAAe;GAIvF,WAAW;GACX,WAAW;EACb;CACF;CAEA,cAAiC;EAC/B,OAAO,QAAQ,QAAQ,CAAC,CAAC;CAC3B;CAEA,sBAA+C;EAC7C,OAAO,QAAQ,QAAQ;CACzB;CAEA,aAAsC;EACpC,OAAO,QAAQ,QAAQ;CACzB;CAEA,mBAAkC;EAChC,OAAO,QAAQ,QAAQ;CACzB;CAEA,MAAM,OACJ,WACA,iBACA,EAAE,YAAY,eACC;EACf,OAAO,KAAK,QAAQ,WAAW,WAAW;GAAE;GAAiB;EAAY,GAAG,UAAU;CACxF;CAEA,MAAM,KAAK,WAAmB,iBAAyB,YAAkD;EACvG,MAAM,MAAM,KAAK,WAAW,iBAAiB,UAAU;CACzD;AACF"}
1
+ {"version":3,"file":"mastra-deployer-CxXfbT3P.cjs","names":["Bundler"],"sources":["../src/mastra-deployer.ts"],"sourcesContent":["import type { Config } from '@mastra/core/mastra';\nimport { Bundler } from '@mastra/deployer/bundler';\n\nexport class BuildBundler extends Bundler {\n constructor() {\n super('Temporal');\n this.platform = process.versions?.bun ? 'neutral' : 'node';\n }\n\n protected async getUserBundlerOptions(\n mastraEntryFile: string,\n outputDirectory: string,\n ): Promise<NonNullable<Config['bundler']>> {\n const bundlerOptions = await super.getUserBundlerOptions(mastraEntryFile, outputDirectory);\n\n return {\n ...bundlerOptions,\n externals: true,\n sourcemap: true,\n };\n }\n\n getEnvFiles(): Promise<string[]> {\n return Promise.resolve([]);\n }\n\n protected installDependencies(): Promise<void> {\n return Promise.resolve();\n }\n\n protected copyPublic(): Promise<void> {\n return Promise.resolve();\n }\n\n writePackageJson(): Promise<void> {\n return Promise.resolve();\n }\n\n async bundle(\n entryFile: string,\n outputDirectory: string,\n { toolsPaths, projectRoot }: { toolsPaths: (string | string[])[]; projectRoot: string },\n ): Promise<void> {\n return this._bundle(entryFile, entryFile, { outputDirectory, projectRoot }, toolsPaths);\n }\n\n async lint(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n await super.lint(entryFile, outputDirectory, toolsPaths);\n }\n}\n"],"mappings":";;AAGA,IAAa,eAAb,cAAkCA,yBAAAA,QAAQ;CACxC,cAAc;EACZ,MAAM,UAAU;EAChB,KAAK,WAAW,QAAQ,UAAU,MAAM,YAAY;CACtD;CAEA,MAAgB,sBACd,iBACA,iBACyC;EAGzC,OAAO;GACL,GAAG,MAHwB,MAAM,sBAAsB,iBAAiB,eAAe;GAIvF,WAAW;GACX,WAAW;EACb;CACF;CAEA,cAAiC;EAC/B,OAAO,QAAQ,QAAQ,CAAC,CAAC;CAC3B;CAEA,sBAA+C;EAC7C,OAAO,QAAQ,QAAQ;CACzB;CAEA,aAAsC;EACpC,OAAO,QAAQ,QAAQ;CACzB;CAEA,mBAAkC;EAChC,OAAO,QAAQ,QAAQ;CACzB;CAEA,MAAM,OACJ,WACA,iBACA,EAAE,YAAY,eACC;EACf,OAAO,KAAK,QAAQ,WAAW,WAAW;GAAE;GAAiB;EAAY,G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AE,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC,GACzG,KAAK,CAEP;IAEQ,UAAU,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,GAAG,KAAK,CAE9C;IAEQ,gBAAgB,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,GAAG,KAAK,CAEpD;IAEK,UAAU,CAAC,IAAI,GAAE,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,CAAM;;OAuBhF;CACF"}
@@ -1,9 +1,8 @@
1
- //#region src/utils.ts
1
+ // src/utils.ts
2
2
  function toWorkflowType(id) {
3
3
  const camelCased = id.replace(/[-_]+([a-zA-Z0-9])/g, (_, char) => char.toUpperCase());
4
4
  return camelCased.endsWith("Workflow") ? camelCased : `${camelCased}Workflow`;
5
5
  }
6
- //#endregion
7
6
  Object.defineProperty(exports, "toWorkflowType", {
8
7
  enumerable: true,
9
8
  get: function() {
@@ -11,4 +10,4 @@ Object.defineProperty(exports, "toWorkflowType", {
11
10
  }
12
11
  });
13
12
 
14
- //# sourceMappingURL=utils-D94W1i81.cjs.map
13
+ //# sourceMappingURL=utils-BVE1AkTt.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-D94W1i81.cjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["export function toWorkflowType(id: string) {\n const camelCased = id.replace(/[-_]+([a-zA-Z0-9])/g, (_, char: string) => char.toUpperCase());\n return camelCased.endsWith('Workflow') ? camelCased : `${camelCased}Workflow`;\n}\n"],"mappings":";AAAA,SAAgB,eAAe,IAAY;CACzC,MAAM,aAAa,GAAG,QAAQ,wBAAwB,GAAG,SAAiB,KAAK,YAAY,CAAC;CAC5F,OAAO,WAAW,SAAS,UAAU,IAAI,aAAa,GAAG,WAAW;AACtE"}
1
+ {"version":3,"file":"utils-BVE1AkTt.cjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["export function toWorkflowType(id: string) {\n const camelCased = id.replace(/[-_]+([a-zA-Z0-9])/g, (_, char: string) => char.toUpperCase());\n return camelCased.endsWith('Workflow') ? camelCased : `${camelCased}Workflow`;\n}\n"],"mappings":";AAAA,SAAgB,eAAe,IAAY;CACzC,MAAM,aAAa,GAAG,QAAQ,wBAAwB,GAAG,SAAiB,KAAK,YAAY,CAAC;CAC5F,OAAO,WAAW,SAAS,UAAU,IAAI,aAAa,GAAG,WAAW;AACtE"}
@@ -1,9 +1,8 @@
1
- //#region src/utils.ts
1
+ // src/utils.ts
2
2
  function toWorkflowType(id) {
3
3
  const camelCased = id.replace(/[-_]+([a-zA-Z0-9])/g, (_, char) => char.toUpperCase());
4
4
  return camelCased.endsWith("Workflow") ? camelCased : `${camelCased}Workflow`;
5
5
  }
6
- //#endregion
7
6
  export { toWorkflowType as t };
8
7
 
9
- //# sourceMappingURL=utils-B_iPTfDi.js.map
8
+ //# sourceMappingURL=utils-R6cB86BM.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-B_iPTfDi.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["export function toWorkflowType(id: string) {\n const camelCased = id.replace(/[-_]+([a-zA-Z0-9])/g, (_, char: string) => char.toUpperCase());\n return camelCased.endsWith('Workflow') ? camelCased : `${camelCased}Workflow`;\n}\n"],"mappings":";AAAA,SAAgB,eAAe,IAAY;CACzC,MAAM,aAAa,GAAG,QAAQ,wBAAwB,GAAG,SAAiB,KAAK,YAAY,CAAC;CAC5F,OAAO,WAAW,SAAS,UAAU,IAAI,aAAa,GAAG,WAAW;AACtE"}
1
+ {"version":3,"file":"utils-R6cB86BM.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["export function toWorkflowType(id: string) {\n const camelCased = id.replace(/[-_]+([a-zA-Z0-9])/g, (_, char: string) => char.toUpperCase());\n return camelCased.endsWith('Workflow') ? camelCased : `${camelCased}Workflow`;\n}\n"],"mappings":";AAAA,SAAgB,eAAe,IAAY;CACzC,MAAM,aAAa,GAAG,QAAQ,wBAAwB,GAAG,SAAiB,KAAK,YAAY,CAAC;CAC5F,OAAO,WAAW,SAAS,UAAU,IAAI,aAAa,GAAG,WAAW;AACtE"}
package/dist/worker.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region \0rolldown/runtime.js
2
+ // \0rolldown/runtime.js
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -20,8 +20,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
20
20
  value: mod,
21
21
  enumerable: true
22
22
  }) : target, mod));
23
- //#endregion
24
- const require_utils = require("./utils-D94W1i81.cjs");
23
+ const require_utils = require("./utils-BVE1AkTt.cjs");
25
24
  let fs = require("fs");
26
25
  let fs_promises = require("fs/promises");
27
26
  let path = require("path");
@@ -33,7 +32,7 @@ let _babel_types = require("@babel/types");
33
32
  _babel_types = __toESM(_babel_types, 1);
34
33
  let rollup = require("rollup");
35
34
  let module$1 = require("module");
36
- //#region src/transforms/shared.ts
35
+ // src/transforms/shared.ts
37
36
  const parserPlugins = [
38
37
  "typescript",
39
38
  "jsx",
@@ -290,8 +289,7 @@ function pruneUnusedTopLevelBindings(statements) {
290
289
  });
291
290
  return prunedStatements;
292
291
  }
293
- //#endregion
294
- //#region src/transforms/activities.ts
292
+ // src/transforms/activities.ts
295
293
  function normalizeImportPath(importPath, extension) {
296
294
  const normalizedPath = importPath.split(path.default.sep).join("/");
297
295
  const pathWithExtension = extension === ".mjs" || extension === ".cjs" ? normalizedPath : normalizedPath.replace(/\.[cm]?[jt]sx?$/, "");
@@ -674,8 +672,7 @@ async function buildTemporalActivitiesModule(entryFile, outputDirectory, outputF
674
672
  await bundle.close();
675
673
  }
676
674
  }
677
- //#endregion
678
- //#region src/transforms/workflows.ts
675
+ // src/transforms/workflows.ts
679
676
  /**
680
677
  * Temporal workflow types must be static so the loader can deterministically map
681
678
  * a source workflow to the runtime export name used by the worker.
@@ -1126,8 +1123,7 @@ async function buildTemporalWorkflowModule(entryFile, outputDirectory, outputFil
1126
1123
  await bundle.close();
1127
1124
  }
1128
1125
  }
1129
- //#endregion
1130
- //#region src/plugin.ts
1126
+ // src/plugin.ts
1131
1127
  const CACHE_PATH = "node_modules/.mastra";
1132
1128
  const WORKFLOW_FILE_NAME = "workflow.mjs";
1133
1129
  const ACTIVITIES_FILE_NAME = "activities.mjs";
@@ -1153,7 +1149,7 @@ var MastraPlugin = class {
1153
1149
  this.projectRoot = projectRoot;
1154
1150
  }
1155
1151
  async #bundleMastra(entryFile, projectRoot, outputDirectory) {
1156
- const { BuildBundler } = await Promise.resolve().then(() => require("./mastra-deployer-D6fHvmFM.cjs"));
1152
+ const { BuildBundler } = await Promise.resolve().then(() => require("./mastra-deployer-CxXfbT3P.cjs"));
1157
1153
  const normalizedEntryFile = entryFile.startsWith("file:/") ? (0, url.fileURLToPath)(entryFile) : entryFile;
1158
1154
  const mastraBundler = new BuildBundler();
1159
1155
  await mastraBundler.prepare(outputDirectory);
@@ -1230,7 +1226,6 @@ var MastraPlugin = class {
1230
1226
  return augmentedOptions;
1231
1227
  }
1232
1228
  };
1233
- //#endregion
1234
1229
  exports.MastraPlugin = MastraPlugin;
1235
1230
 
1236
1231
  //# sourceMappingURL=worker.cjs.map