@globalart/nestjs-temporal 1.1.4 → 1.1.5

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
@@ -6,6 +6,7 @@ let _nestjs_common = require("@nestjs/common");
6
6
  let _nestjs_core = require("@nestjs/core");
7
7
  let rxjs = require("rxjs");
8
8
  let _temporalio_worker = require("@temporalio/worker");
9
+ let _temporalio_activity = require("@temporalio/activity");
9
10
  let _temporalio_client = require("@temporalio/client");
10
11
  let _nestjs_common_constants = require("@nestjs/common/constants");
11
12
 
@@ -82,8 +83,8 @@ let TemporalParamType = /* @__PURE__ */ function(TemporalParamType$1) {
82
83
  }({});
83
84
 
84
85
  //#endregion
85
- //#region src/activity-execution-context.ts
86
- var ActivityExecutionContext = class {
86
+ //#region src/temporal-execution-context.ts
87
+ var TemporalExecutionContext = class {
87
88
  constructor(instance, handler, args) {
88
89
  this.instance = instance;
89
90
  this.handler = handler;
@@ -98,6 +99,9 @@ var ActivityExecutionContext = class {
98
99
  getArgs() {
99
100
  return this.args;
100
101
  }
102
+ getWorkflowInfo() {
103
+ return this.args[0];
104
+ }
101
105
  getArgByIndex(index) {
102
106
  return this.args[index];
103
107
  }
@@ -125,7 +129,7 @@ var TemporalParamsFactory = class {
125
129
  exchangeKeyForValue(type, data, args) {
126
130
  switch (type) {
127
131
  case TemporalParamType.PAYLOAD: return data && args[0] && typeof args[0] === "object" ? args[0][data] : args[0];
128
- case TemporalParamType.CONTEXT: return new ActivityExecutionContext(this.instance, this.handler, args);
132
+ case TemporalParamType.CONTEXT: return new TemporalExecutionContext(this.instance, this.handler, args);
129
133
  default: return null;
130
134
  }
131
135
  }
@@ -264,7 +268,7 @@ let TemporalExplorer = _TemporalExplorer = class TemporalExplorer$1 {
264
268
  const handler = this.externalContextCreator.create(instance, instance[key], key, TEMPORAL_ARGS_METADATA, paramsFactory, void 0, void 0, void 0, "temporal");
265
269
  Reflect.defineMetadata(TEMPORAL_ARGS_METADATA, paramsFactory, instance[key]);
266
270
  activitiesMethod[key] = async (...args) => {
267
- const result = handler(...args);
271
+ const result = handler(...args, _temporalio_activity.Context.current().info);
268
272
  return (0, rxjs.isObservable)(result) ? await (0, rxjs.lastValueFrom)(result) : await result;
269
273
  };
270
274
  }
@@ -1695,10 +1699,10 @@ function Context() {
1695
1699
  //#endregion
1696
1700
  exports.Activities = Activities;
1697
1701
  exports.Activity = Activity;
1698
- exports.ActivityExecutionContext = ActivityExecutionContext;
1699
1702
  exports.Context = Context;
1700
1703
  exports.InjectTemporalClient = InjectTemporalClient;
1701
1704
  exports.Payload = Payload;
1705
+ exports.TemporalExecutionContext = TemporalExecutionContext;
1702
1706
  Object.defineProperty(exports, 'TemporalExplorer', {
1703
1707
  enumerable: true,
1704
1708
  get: function () {