arvo-core 1.1.19 → 1.1.21

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.
@@ -1,6 +1,6 @@
1
1
  import ArvoEvent from '.';
2
2
  import { ArvoEventData, CloudEventExtension, CreateArvoEvent } from './types';
3
- import { ExecutionOpenTelemetryConfiguration } from '../types';
3
+ import { ExecutionOpenTelemetryConfiguration } from '../OpenTelemetry/types';
4
4
  /**
5
5
  * Creates an ArvoEvent with the provided data and extensions.
6
6
  *
@@ -12,6 +12,7 @@ import { ExecutionOpenTelemetryConfiguration } from '../types';
12
12
  *
13
13
  * @param {CreateArvoEvent<TData>} event - The event data and metadata to create the ArvoEvent.
14
14
  * @param {TExtension} [extensions] - Optional cloud event extensions.
15
+ * @param {ExecutionOpenTelemetryConfiguration} [opentelemetry] - Optional opentelemetry configuration object
15
16
  *
16
17
  * @returns {ArvoEvent<TData, TExtension>} The created ArvoEvent instance.
17
18
  *
@@ -21,6 +21,7 @@ var uuid_1 = require("uuid");
21
21
  *
22
22
  * @param {CreateArvoEvent<TData>} event - The event data and metadata to create the ArvoEvent.
23
23
  * @param {TExtension} [extensions] - Optional cloud event extensions.
24
+ * @param {ExecutionOpenTelemetryConfiguration} [opentelemetry] - Optional opentelemetry configuration object
24
25
  *
25
26
  * @returns {ArvoEvent<TData, TExtension>} The created ArvoEvent instance.
26
27
  *
@@ -46,9 +47,9 @@ var uuid_1 = require("uuid");
46
47
  * );
47
48
  */
48
49
  var createArvoEvent = function (event, extensions, opentelemetry) {
49
- if (opentelemetry === void 0) { opentelemetry = {
50
+ opentelemetry = opentelemetry !== null && opentelemetry !== void 0 ? opentelemetry : {
50
51
  tracer: (0, OpenTelemetry_1.fetchOpenTelemetryTracer)(),
51
- }; }
52
+ };
52
53
  var span = opentelemetry.tracer.startSpan("createArvoEvent<".concat(event.type, ">"), {});
53
54
  return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), function () {
54
55
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
@@ -1,7 +1,7 @@
1
1
  import ArvoContract from '../ArvoContract';
2
2
  import { z } from 'zod';
3
3
  import { CreateArvoEvent } from '../ArvoEvent/types';
4
- import { ExecutionOpenTelemetryConfiguration } from '../types';
4
+ import { ExecutionOpenTelemetryConfiguration } from '../OpenTelemetry/types';
5
5
  /**
6
6
  * A factory class for creating contractual ArvoEvents based on a given ArvoContract.
7
7
  *
@@ -24,6 +24,7 @@ export default class ArvoEventFactory<TUri extends string = string, TType extend
24
24
  * @template TExtension - The type of extensions to add to the event.
25
25
  * @param event - The event to create. The field 'type' is automatically infered
26
26
  * @param [extensions] - Optional extensions to add to the event.
27
+ * @param [opentelemetry] - Optional opentelemetry configuration object
27
28
  * @returns The created ArvoEvent as per the accept record of the contract.
28
29
  * @throws If the event data fails validation against the contract.
29
30
  */
@@ -35,6 +36,7 @@ export default class ArvoEventFactory<TUri extends string = string, TType extend
35
36
  * @template TExtension - The type of extensions to add to the event.
36
37
  * @param event - The event to create.
37
38
  * @param [extensions] - Optional extensions to add to the event.
39
+ * @param [opentelemetry] - Optional opentelemetry configuration object
38
40
  * @returns The created ArvoEvent as per one of the emits records of the contract.
39
41
  * @throws If the event data fails validation against the contract.
40
42
  */
@@ -45,6 +47,7 @@ export default class ArvoEventFactory<TUri extends string = string, TType extend
45
47
  * @template TExtension - The type of extensions to add to the event.
46
48
  * @param event - The event to create, including the error.
47
49
  * @param [extensions] - Optional extensions to add to the event.
50
+ * @param [opentelemetry] - Optional opentelemtry configuration object
48
51
  * @returns The created system error ArvoEvent.
49
52
  */
50
53
  systemError<TExtension extends Record<string, any>>(event: Omit<CreateArvoEvent<any, any>, 'data' | 'type' | 'datacontenttype' | 'dataschema'> & {
@@ -49,14 +49,15 @@ var ArvoEventFactory = /** @class */ (function () {
49
49
  * @template TExtension - The type of extensions to add to the event.
50
50
  * @param event - The event to create. The field 'type' is automatically infered
51
51
  * @param [extensions] - Optional extensions to add to the event.
52
+ * @param [opentelemetry] - Optional opentelemetry configuration object
52
53
  * @returns The created ArvoEvent as per the accept record of the contract.
53
54
  * @throws If the event data fails validation against the contract.
54
55
  */
55
56
  ArvoEventFactory.prototype.accepts = function (event, extensions, opentelemetry) {
56
57
  var _this = this;
57
- if (opentelemetry === void 0) { opentelemetry = {
58
+ opentelemetry = opentelemetry !== null && opentelemetry !== void 0 ? opentelemetry : {
58
59
  tracer: (0, OpenTelemetry_1.fetchOpenTelemetryTracer)(),
59
- }; }
60
+ };
60
61
  var span = opentelemetry.tracer.startSpan("ArvoEventFactory<".concat(this.contract.uri, ">.accepts<").concat(this.contract.accepts.type, ">.create"));
61
62
  return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), function () {
62
63
  var _a, _b, _c, _d;
@@ -89,14 +90,15 @@ var ArvoEventFactory = /** @class */ (function () {
89
90
  * @template TExtension - The type of extensions to add to the event.
90
91
  * @param event - The event to create.
91
92
  * @param [extensions] - Optional extensions to add to the event.
93
+ * @param [opentelemetry] - Optional opentelemetry configuration object
92
94
  * @returns The created ArvoEvent as per one of the emits records of the contract.
93
95
  * @throws If the event data fails validation against the contract.
94
96
  */
95
97
  ArvoEventFactory.prototype.emits = function (event, extensions, opentelemetry) {
96
98
  var _this = this;
97
- if (opentelemetry === void 0) { opentelemetry = {
98
- tracer: (0, OpenTelemetry_1.fetchOpenTelemetryTracer)(),
99
- }; }
99
+ opentelemetry = opentelemetry !== null && opentelemetry !== void 0 ? opentelemetry : {
100
+ tracer: (0, OpenTelemetry_1.fetchOpenTelemetryTracer)()
101
+ };
100
102
  var span = opentelemetry.tracer.startSpan("ArvoEventFactory<".concat(this.contract.uri, ">.emits<").concat(event.type, ">.create"));
101
103
  return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), function () {
102
104
  var _a, _b, _c, _d;
@@ -128,13 +130,14 @@ var ArvoEventFactory = /** @class */ (function () {
128
130
  * @template TExtension - The type of extensions to add to the event.
129
131
  * @param event - The event to create, including the error.
130
132
  * @param [extensions] - Optional extensions to add to the event.
133
+ * @param [opentelemetry] - Optional opentelemtry configuration object
131
134
  * @returns The created system error ArvoEvent.
132
135
  */
133
136
  ArvoEventFactory.prototype.systemError = function (event, extensions, opentelemetry) {
134
137
  var _this = this;
135
- if (opentelemetry === void 0) { opentelemetry = {
138
+ opentelemetry = opentelemetry !== null && opentelemetry !== void 0 ? opentelemetry : {
136
139
  tracer: (0, OpenTelemetry_1.fetchOpenTelemetryTracer)(),
137
- }; }
140
+ };
138
141
  var span = opentelemetry.tracer.startSpan("ArvoEventFactory<".concat(this.contract.uri, ">.systemError<sys.").concat(this.contract.accepts.type, ".error>.create"));
139
142
  return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), function () {
140
143
  var _a, _b, _c, _d, _e;
@@ -1,3 +1,4 @@
1
+ import { Tracer } from '@opentelemetry/api';
1
2
  /**
2
3
  * Represents the available log levels for telemetry.
3
4
  * - DEBUG: Used for detailed information, typically of interest only when diagnosing problems.
@@ -17,3 +18,16 @@ export type OpenTelemetryHeaders = {
17
18
  /** The tracestate header value */
18
19
  tracestate: string | null;
19
20
  };
21
+ /**
22
+ * Configuration options for OpenTelemetry integration in execution context.
23
+ *
24
+ * This type defines how tracing should be configured and inherited within
25
+ * the execution pipeline.
26
+ */
27
+ export type ExecutionOpenTelemetryConfiguration = {
28
+ /**
29
+ * OpenTelemetry tracer instance to use for creating spans.
30
+ * If not provided, a default tracer may be used depending on the implementation.
31
+ */
32
+ tracer: Tracer;
33
+ };
package/dist/index.d.ts CHANGED
@@ -23,11 +23,12 @@ import { ArvoOrchestrationSubjectContentSchema, ArvoOrchestratorVersionSchema }
23
23
  import { ArvoOrchestrationSubjectContent, ArvoOrchestratorVersion } from './ArvoOrchestrationSubject/type';
24
24
  import ArvoEventHttp from './ArvoEventHttp';
25
25
  import { ArvoEventHttpConfig } from './ArvoEventHttp/types';
26
- import { InferArvoContract, InferArvoEvent, InferArvoOrchestratorContract, ExecutionOpenTelemetryConfiguration } from './types';
26
+ import { InferArvoContract, InferArvoEvent, InferArvoOrchestratorContract } from './types';
27
27
  import { createArvoOrchestratorContract } from './ArvoOrchestratorContract/helpers';
28
28
  import ArvoOrchestratorContract from './ArvoOrchestratorContract';
29
29
  import { ICreateArvoOrchestratorContract, IArvoOrchestratorContract } from './ArvoOrchestratorContract/types';
30
30
  import { ArvoOrchestratorEventTypeGen } from './ArvoOrchestratorContract/typegen';
31
+ import { ExecutionOpenTelemetryConfiguration } from './OpenTelemetry/types';
31
32
  /**
32
33
  * Collection of Zod schemas for validating various aspects of Arvo events.
33
34
  * @property {z.ZodObject} CloudEventContextSchema - Schema for core CloudEvent properties.
package/dist/types.d.ts CHANGED
@@ -3,20 +3,6 @@ import ArvoContract from './ArvoContract';
3
3
  import ArvoEvent from './ArvoEvent';
4
4
  import { ArvoExtension, OpenTelemetryExtension } from './ArvoEvent/types';
5
5
  import ArvoOrchestratorContract from './ArvoOrchestratorContract';
6
- import { Tracer } from '@opentelemetry/api';
7
- /**
8
- * Configuration options for OpenTelemetry integration in execution context.
9
- *
10
- * This type defines how tracing should be configured and inherited within
11
- * the execution pipeline.
12
- */
13
- export type ExecutionOpenTelemetryConfiguration = {
14
- /**
15
- * OpenTelemetry tracer instance to use for creating spans.
16
- * If not provided, a default tracer may be used depending on the implementation.
17
- */
18
- tracer: Tracer;
19
- };
20
6
  /**
21
7
  * A type utility that infers the structure of an ArvoEvent.
22
8
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arvo-core",
3
- "version": "1.1.19",
3
+ "version": "1.1.21",
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": {
@@ -47,8 +47,9 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@opentelemetry/api": "^1.9.0",
50
+ "@opentelemetry/core": "^1.27.0",
50
51
  "uuid": "^10.0.0",
51
52
  "zod": "^3.23.8",
52
- "zod-to-json-schema": "^3.23.2"
53
+ "zod-to-json-schema": "^3.23.5"
53
54
  }
54
55
  }