arvo-core 2.2.3 → 2.2.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.
@@ -0,0 +1,11 @@
1
+ export type ViolationErrorParam<T extends string = string> = {
2
+ type: T;
3
+ message: string;
4
+ metadata?: Record<string, any>;
5
+ };
6
+ export declare class ViolationError<T extends string = string> extends Error {
7
+ readonly type: T;
8
+ readonly metadata: Record<string, any> | null;
9
+ readonly name: `ViolationError<${T}>`;
10
+ constructor({ type, message, metadata }: ViolationErrorParam<T>);
11
+ }
@@ -15,22 +15,17 @@ var __extends = (this && this.__extends) || (function () {
15
15
  };
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.ArvoContractViolationError = void 0;
19
- /**
20
- * Custom error class representing a violation of an ArvoContract.
21
- */
22
- var ArvoContractViolationError = /** @class */ (function (_super) {
23
- __extends(ArvoContractViolationError, _super);
24
- /**
25
- * Creates an instance of ArvoContractViolationError.
26
- * @param {string} [message='ArvoContract violated'] - The error message. Default is 'ArvoContract violated'.
27
- */
28
- function ArvoContractViolationError(message) {
29
- if (message === void 0) { message = 'ArvoContract violated'; }
30
- var _this = _super.call(this, message) || this;
31
- _this.name = 'ArvoContractViolationError';
18
+ exports.ViolationError = void 0;
19
+ var ViolationError = /** @class */ (function (_super) {
20
+ __extends(ViolationError, _super);
21
+ function ViolationError(_a) {
22
+ var type = _a.type, message = _a.message, metadata = _a.metadata;
23
+ var _this = _super.call(this, "ViolationError<".concat(type, "> ").concat(message)) || this;
24
+ _this.type = type;
25
+ _this.name = "ViolationError<".concat(_this.type, ">");
26
+ _this.metadata = metadata !== null && metadata !== void 0 ? metadata : null;
32
27
  return _this;
33
28
  }
34
- return ArvoContractViolationError;
29
+ return ViolationError;
35
30
  }(Error));
36
- exports.ArvoContractViolationError = ArvoContractViolationError;
31
+ exports.ViolationError = ViolationError;
package/dist/index.d.ts CHANGED
@@ -28,7 +28,7 @@ import { isWildCardArvoSematicVersion, WildCardArvoSemanticVersion } from './Arv
28
28
  import { createSimpleArvoContract } from './ArvoContract/SimpleArvoContract';
29
29
  import { SimpleArvoContract } from './ArvoContract/SimpleArvoContract/types';
30
30
  import { ArvoOrchestratorEventFactory } from './ArvoEventFactory/Orchestrator';
31
- import { ArvoContractViolationError } from './ArvoContract/errors';
31
+ import { ViolationError, ViolationErrorParam } from './errors';
32
32
  /**
33
33
  * Collection of Zod schemas for validating various aspects of Arvo events.
34
34
  * @property {z.ZodObject} CloudEventContextSchema - Schema for core CloudEvent properties.
@@ -103,4 +103,4 @@ declare const ArvoEventSchema: {
103
103
  parentSubject$$: string | null;
104
104
  }>;
105
105
  };
106
- export { ArvoEvent, createArvoEvent, ArvoDataContentType, ArvoEventData, CloudEventExtension, ArvoEventSchema, CloudEventContext, ArvoExtension, OpenTelemetryExtension, CreateArvoEvent, exceptionToSpan, logToSpan, OpenTelemetryHeaders, TelemetryLogLevel, OTelNull, validateURI, cleanString, ArvoContract, ArvoContractViolationError, createArvoContract, ArvoContractValidators, ArvoContractRecord, IArvoContract, ResolveArvoContractRecord, ArvoEventFactory, createArvoEventFactory, currentOpenTelemetryHeaders, OpenInference, OpenInferenceSpanKind, ArvoExecution, ArvoExecutionSpanKind, ArvoContractJSONSchema, ArvoOrchestrationSubject, ArvoOrchestrationSubjectContent, ArvoSemanticVersion, InferArvoEvent, createArvoOrchestratorContract, ICreateArvoOrchestratorContract, ArvoOrchestratorEventTypeGen, EventDataschemaUtil, ArvoOrchestrationSubjectContentSchema, ArvoSemanticVersionSchema, ArvoErrorSchema, ArvoErrorType, compareSemanticVersions, parseSemanticVersion, createSimpleArvoContract, ArvoOrchestratorContract, VersionedArvoContract, InferVersionedArvoContract, isWildCardArvoSematicVersion, WildCardArvoSemanticVersion, isValidArvoSemanticVersion, SimpleArvoContract, ArvoOrchestratorEventFactory, createArvoOrchestratorEventFactory, ArvoOpenTelemetry, };
106
+ export { ArvoEvent, createArvoEvent, ArvoDataContentType, ArvoEventData, CloudEventExtension, ArvoEventSchema, CloudEventContext, ArvoExtension, OpenTelemetryExtension, CreateArvoEvent, exceptionToSpan, logToSpan, OpenTelemetryHeaders, TelemetryLogLevel, OTelNull, validateURI, cleanString, ArvoContract, createArvoContract, ArvoContractValidators, ArvoContractRecord, IArvoContract, ResolveArvoContractRecord, ArvoEventFactory, createArvoEventFactory, currentOpenTelemetryHeaders, OpenInference, OpenInferenceSpanKind, ArvoExecution, ArvoExecutionSpanKind, ArvoContractJSONSchema, ArvoOrchestrationSubject, ArvoOrchestrationSubjectContent, ArvoSemanticVersion, InferArvoEvent, createArvoOrchestratorContract, ICreateArvoOrchestratorContract, ArvoOrchestratorEventTypeGen, EventDataschemaUtil, ArvoOrchestrationSubjectContentSchema, ArvoSemanticVersionSchema, ArvoErrorSchema, ArvoErrorType, compareSemanticVersions, parseSemanticVersion, createSimpleArvoContract, ArvoOrchestratorContract, VersionedArvoContract, InferVersionedArvoContract, isWildCardArvoSematicVersion, WildCardArvoSemanticVersion, isValidArvoSemanticVersion, SimpleArvoContract, ArvoOrchestratorEventFactory, createArvoOrchestratorEventFactory, ArvoOpenTelemetry, ViolationError, ViolationErrorParam, };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ArvoOpenTelemetry = exports.createArvoOrchestratorEventFactory = exports.ArvoOrchestratorEventFactory = exports.isValidArvoSemanticVersion = exports.WildCardArvoSemanticVersion = exports.isWildCardArvoSematicVersion = exports.VersionedArvoContract = exports.createSimpleArvoContract = exports.parseSemanticVersion = exports.compareSemanticVersions = exports.ArvoErrorSchema = exports.ArvoSemanticVersionSchema = exports.ArvoOrchestrationSubjectContentSchema = exports.EventDataschemaUtil = exports.ArvoOrchestratorEventTypeGen = exports.createArvoOrchestratorContract = exports.ArvoOrchestrationSubject = exports.ArvoExecutionSpanKind = exports.ArvoExecution = exports.OpenInferenceSpanKind = exports.OpenInference = exports.currentOpenTelemetryHeaders = exports.createArvoEventFactory = exports.ArvoEventFactory = exports.ArvoContractValidators = exports.createArvoContract = exports.ArvoContractViolationError = exports.ArvoContract = exports.cleanString = exports.validateURI = exports.OTelNull = exports.logToSpan = exports.exceptionToSpan = exports.ArvoEventSchema = exports.ArvoDataContentType = exports.createArvoEvent = exports.ArvoEvent = void 0;
6
+ exports.ViolationError = exports.ArvoOpenTelemetry = exports.createArvoOrchestratorEventFactory = exports.ArvoOrchestratorEventFactory = exports.isValidArvoSemanticVersion = exports.WildCardArvoSemanticVersion = exports.isWildCardArvoSematicVersion = exports.VersionedArvoContract = exports.createSimpleArvoContract = exports.parseSemanticVersion = exports.compareSemanticVersions = exports.ArvoErrorSchema = exports.ArvoSemanticVersionSchema = exports.ArvoOrchestrationSubjectContentSchema = exports.EventDataschemaUtil = exports.ArvoOrchestratorEventTypeGen = exports.createArvoOrchestratorContract = exports.ArvoOrchestrationSubject = exports.ArvoExecutionSpanKind = exports.ArvoExecution = exports.OpenInferenceSpanKind = exports.OpenInference = exports.currentOpenTelemetryHeaders = exports.createArvoEventFactory = exports.ArvoEventFactory = exports.ArvoContractValidators = exports.createArvoContract = exports.ArvoContract = exports.cleanString = exports.validateURI = exports.OTelNull = exports.logToSpan = exports.exceptionToSpan = exports.ArvoEventSchema = exports.ArvoDataContentType = exports.createArvoEvent = exports.ArvoEvent = void 0;
7
7
  var ArvoEvent_1 = __importDefault(require("./ArvoEvent"));
8
8
  exports.ArvoEvent = ArvoEvent_1.default;
9
9
  var schema_1 = require("./ArvoEvent/schema");
@@ -63,8 +63,8 @@ var SimpleArvoContract_1 = require("./ArvoContract/SimpleArvoContract");
63
63
  Object.defineProperty(exports, "createSimpleArvoContract", { enumerable: true, get: function () { return SimpleArvoContract_1.createSimpleArvoContract; } });
64
64
  var Orchestrator_1 = require("./ArvoEventFactory/Orchestrator");
65
65
  Object.defineProperty(exports, "ArvoOrchestratorEventFactory", { enumerable: true, get: function () { return Orchestrator_1.ArvoOrchestratorEventFactory; } });
66
- var errors_1 = require("./ArvoContract/errors");
67
- Object.defineProperty(exports, "ArvoContractViolationError", { enumerable: true, get: function () { return errors_1.ArvoContractViolationError; } });
66
+ var errors_1 = require("./errors");
67
+ Object.defineProperty(exports, "ViolationError", { enumerable: true, get: function () { return errors_1.ViolationError; } });
68
68
  /**
69
69
  * Collection of Zod schemas for validating various aspects of Arvo events.
70
70
  * @property {z.ZodObject} CloudEventContextSchema - Schema for core CloudEvent properties.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arvo-core",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
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": {
@@ -1,10 +0,0 @@
1
- /**
2
- * Custom error class representing a violation of an ArvoContract.
3
- */
4
- export declare class ArvoContractViolationError extends Error {
5
- /**
6
- * Creates an instance of ArvoContractViolationError.
7
- * @param {string} [message='ArvoContract violated'] - The error message. Default is 'ArvoContract violated'.
8
- */
9
- constructor(message?: string);
10
- }