arvo-core 2.1.15 → 2.2.1

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/CHANGELOG.md CHANGED
@@ -84,3 +84,7 @@
84
84
 
85
85
  - Tested Snyk upgrade, added more test coverage and added support for redirectto in orchestrator subject generation in init factory function
86
86
 
87
+ ## [2.2.0] - 2024-12-25
88
+
89
+ - Finalised the version 2 for Arvo core.
90
+
@@ -90,16 +90,19 @@ var ArvoOrchestratorEventFactory = /** @class */ (function (_super) {
90
90
  subject: parentSubject,
91
91
  version: _this.contract.version,
92
92
  meta: Object.fromEntries(Object.entries({
93
- redirectto: (_a = event.redirectto) !== null && _a !== void 0 ? _a : ArvoOrchestrationSubject_1.default.parse(parentSubject).execution.initiator
94
- }).filter(function (item) { return Boolean(item[1]); }))
93
+ redirectto: (_a = event.redirectto) !== null && _a !== void 0 ? _a : ArvoOrchestrationSubject_1.default.parse(parentSubject).execution
94
+ .initiator,
95
+ }).filter(function (item) { return Boolean(item[1]); })),
95
96
  })
96
97
  : ArvoOrchestrationSubject_1.default.new({
97
98
  orchestator: _this.contract.accepts.type,
98
99
  initiator: event.source,
99
100
  version: _this.contract.version,
100
- meta: event.redirectto ? {
101
- redirectto: event.redirectto
102
- } : undefined
101
+ meta: event.redirectto
102
+ ? {
103
+ redirectto: event.redirectto,
104
+ }
105
+ : undefined,
103
106
  });
104
107
  var generatedEvent = (0, helpers_1.createArvoEvent)(__assign(__assign({}, event), { subject: newSubject, traceparent: (_c = (_b = event.traceparent) !== null && _b !== void 0 ? _b : otelHeaders.traceparent) !== null && _c !== void 0 ? _c : undefined, tracestate: (_e = (_d = event.tracestate) !== null && _d !== void 0 ? _d : otelHeaders.tracestate) !== null && _e !== void 0 ? _e : undefined, type: _this.contract.accepts.type, datacontenttype: schema_1.ArvoDataContentType, dataschema: utils_1.EventDataschemaUtil.create(_this.contract), data: validationResult.data }), extensions, { disable: true });
105
108
  span.setAttributes(generatedEvent.otelAttributes);
@@ -5,14 +5,16 @@ import { TelemetryLogLevel, OpenTelemetryHeaders } from './types';
5
5
  */
6
6
  export declare class ArvoOpenTelemetry {
7
7
  /** OpenTelemetry tracer instance for creating spans */
8
- readonly tracer: Tracer;
8
+ tracer: Tracer;
9
9
  private static instance;
10
10
  private constructor();
11
11
  /**
12
12
  * Gets the instance of ArvoOpenTelemetry
13
13
  * @returns {ArvoOpenTelemetry} The singleton instance
14
14
  */
15
- static getInstance(): ArvoOpenTelemetry;
15
+ static getInstance(config?: {
16
+ tracer?: Tracer;
17
+ }): ArvoOpenTelemetry;
16
18
  /**
17
19
  * Creates and manages an active span for a given operation. This function provides two modes of operation:
18
20
  * 1. Automatic span management (default): Handles span lifecycle, status, and error recording
@@ -35,16 +35,16 @@ var types_1 = require("./ArvoExecution/types");
35
35
  * Singleton class for managing OpenTelemetry instrumentation across libraries
36
36
  */
37
37
  var ArvoOpenTelemetry = /** @class */ (function () {
38
- function ArvoOpenTelemetry() {
39
- this.tracer = api_1.trace.getTracer('arvo-instrumentation', '1.0.0');
38
+ function ArvoOpenTelemetry(tracer) {
39
+ this.tracer = tracer !== null && tracer !== void 0 ? tracer : api_1.trace.getTracer('arvo-instrumentation', '1.0.0');
40
40
  }
41
41
  /**
42
42
  * Gets the instance of ArvoOpenTelemetry
43
43
  * @returns {ArvoOpenTelemetry} The singleton instance
44
44
  */
45
- ArvoOpenTelemetry.getInstance = function () {
45
+ ArvoOpenTelemetry.getInstance = function (config) {
46
46
  if (ArvoOpenTelemetry.instance === null) {
47
- ArvoOpenTelemetry.instance = new ArvoOpenTelemetry();
47
+ ArvoOpenTelemetry.instance = new ArvoOpenTelemetry(config === null || config === void 0 ? void 0 : config.tracer);
48
48
  }
49
49
  return ArvoOpenTelemetry.instance;
50
50
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arvo-core",
3
- "version": "2.1.15",
3
+ "version": "2.2.1",
4
4
  "description": "This core package contains all the core classes and components of the Arvo Event Driven System",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {