arvo-core 3.0.6 → 3.0.8
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/ArvoEvent/helpers.js +11 -11
 - package/dist/ArvoEvent/id.d.ts +18 -0
 - package/dist/ArvoEvent/id.js +39 -0
 - package/dist/ArvoEvent/types.d.ts +22 -2
 - package/dist/ArvoOrchestrationSubject/schema.d.ts +4 -4
 - package/dist/errors.d.ts +21 -0
 - package/dist/errors.js +35 -1
 - package/dist/index.d.ts +3 -2
 - package/dist/index.js +6 -1
 - package/package.json +3 -3
 
| 
         @@ -4,16 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) { 
     | 
|
| 
       4 
4 
     | 
    
         
             
            };
         
     | 
| 
       5 
5 
     | 
    
         
             
            Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
       6 
6 
     | 
    
         
             
            exports.createArvoEvent = void 0;
         
     | 
| 
       7 
     | 
    
         
            -
            var uuid_1 = require("uuid");
         
     | 
| 
       8 
7 
     | 
    
         
             
            var _1 = __importDefault(require("."));
         
     | 
| 
       9 
8 
     | 
    
         
             
            var OpenTelemetry_1 = require("../OpenTelemetry");
         
     | 
| 
       10 
9 
     | 
    
         
             
            var utils_1 = require("../utils");
         
     | 
| 
      
 10 
     | 
    
         
            +
            var id_1 = require("./id");
         
     | 
| 
       11 
11 
     | 
    
         
             
            var schema_1 = require("./schema");
         
     | 
| 
       12 
12 
     | 
    
         
             
            /**
         
     | 
| 
       13 
13 
     | 
    
         
             
             * Internal generator function for creating  instances.
         
     | 
| 
       14 
14 
     | 
    
         
             
             */
         
     | 
| 
       15 
15 
     | 
    
         
             
            var generator = function (event, extensions, otelHeaders) {
         
     | 
| 
       16 
     | 
    
         
            -
                var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k 
     | 
| 
      
 16 
     | 
    
         
            +
                var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
         
     | 
| 
       17 
17 
     | 
    
         
             
                if (event.datacontenttype && event.datacontenttype !== schema_1.ArvoDataContentType) {
         
     | 
| 
       18 
18 
     | 
    
         
             
                    var warning = (0, utils_1.cleanString)("\n    Warning! The provided datacontenttype(=".concat(event.datacontenttype, ")\n    is not ArvoEvent compatible (=").concat(schema_1.ArvoDataContentType, "). There may \n    be some limited functionality.\n  "));
         
     | 
| 
       19 
19 
     | 
    
         
             
                    (0, OpenTelemetry_1.logToSpan)({
         
     | 
| 
         @@ -22,22 +22,22 @@ var generator = function (event, extensions, otelHeaders) { 
     | 
|
| 
       22 
22 
     | 
    
         
             
                    });
         
     | 
| 
       23 
23 
     | 
    
         
             
                }
         
     | 
| 
       24 
24 
     | 
    
         
             
                return new _1.default({
         
     | 
| 
       25 
     | 
    
         
            -
                    id: ( 
     | 
| 
      
 25 
     | 
    
         
            +
                    id: (0, id_1.createArvoEventId)(event.id),
         
     | 
| 
       26 
26 
     | 
    
         
             
                    type: event.type,
         
     | 
| 
       27 
     | 
    
         
            -
                    accesscontrol: ( 
     | 
| 
       28 
     | 
    
         
            -
                    executionunits: ( 
     | 
| 
       29 
     | 
    
         
            -
                    traceparent: ( 
     | 
| 
       30 
     | 
    
         
            -
                    tracestate: ( 
     | 
| 
       31 
     | 
    
         
            -
                    datacontenttype: ( 
     | 
| 
       32 
     | 
    
         
            -
                    specversion: ( 
     | 
| 
       33 
     | 
    
         
            -
                    time: ( 
     | 
| 
      
 27 
     | 
    
         
            +
                    accesscontrol: (_a = event.accesscontrol) !== null && _a !== void 0 ? _a : null,
         
     | 
| 
      
 28 
     | 
    
         
            +
                    executionunits: (_b = event.executionunits) !== null && _b !== void 0 ? _b : null,
         
     | 
| 
      
 29 
     | 
    
         
            +
                    traceparent: (_d = (_c = event.traceparent) !== null && _c !== void 0 ? _c : otelHeaders.traceparent) !== null && _d !== void 0 ? _d : null,
         
     | 
| 
      
 30 
     | 
    
         
            +
                    tracestate: (_f = (_e = event.tracestate) !== null && _e !== void 0 ? _e : otelHeaders.tracestate) !== null && _f !== void 0 ? _f : null,
         
     | 
| 
      
 31 
     | 
    
         
            +
                    datacontenttype: (_g = event.datacontenttype) !== null && _g !== void 0 ? _g : schema_1.ArvoDataContentType,
         
     | 
| 
      
 32 
     | 
    
         
            +
                    specversion: (_h = event.specversion) !== null && _h !== void 0 ? _h : '1.0',
         
     | 
| 
      
 33 
     | 
    
         
            +
                    time: (_j = event.time) !== null && _j !== void 0 ? _j : (0, utils_1.createTimestamp)(),
         
     | 
| 
       34 
34 
     | 
    
         
             
                    source: encodeURI(event.source),
         
     | 
| 
       35 
35 
     | 
    
         
             
                    subject: encodeURI(event.subject),
         
     | 
| 
       36 
36 
     | 
    
         
             
                    to: event.to ? encodeURI(event.to) : encodeURI(event.type),
         
     | 
| 
       37 
37 
     | 
    
         
             
                    redirectto: event.redirectto ? encodeURI(event.redirectto) : null,
         
     | 
| 
       38 
38 
     | 
    
         
             
                    dataschema: event.dataschema ? encodeURI(event.dataschema) : null,
         
     | 
| 
       39 
39 
     | 
    
         
             
                    parentid: event.parentid ? encodeURI(event.parentid) : null,
         
     | 
| 
       40 
     | 
    
         
            -
                    domain: ( 
     | 
| 
      
 40 
     | 
    
         
            +
                    domain: (_k = event.domain) !== null && _k !== void 0 ? _k : null,
         
     | 
| 
       41 
41 
     | 
    
         
             
                }, event.data, extensions);
         
     | 
| 
       42 
42 
     | 
    
         
             
            };
         
     | 
| 
       43 
43 
     | 
    
         
             
            /**
         
     | 
| 
         @@ -0,0 +1,18 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { z } from 'zod';
         
     | 
| 
      
 2 
     | 
    
         
            +
            import type { CreateArvoEvent } from './types';
         
     | 
| 
      
 3 
     | 
    
         
            +
            export declare const ArvoEventIdObjectSchema: z.ZodObject<{
         
     | 
| 
      
 4 
     | 
    
         
            +
                uuid: z.ZodString;
         
     | 
| 
      
 5 
     | 
    
         
            +
                value: z.ZodString;
         
     | 
| 
      
 6 
     | 
    
         
            +
            }, "strip", z.ZodTypeAny, {
         
     | 
| 
      
 7 
     | 
    
         
            +
                value: string;
         
     | 
| 
      
 8 
     | 
    
         
            +
                uuid: string;
         
     | 
| 
      
 9 
     | 
    
         
            +
            }, {
         
     | 
| 
      
 10 
     | 
    
         
            +
                value: string;
         
     | 
| 
      
 11 
     | 
    
         
            +
                uuid: string;
         
     | 
| 
      
 12 
     | 
    
         
            +
            }>;
         
     | 
| 
      
 13 
     | 
    
         
            +
            export type ArvoEventIdObject = z.infer<typeof ArvoEventIdObjectSchema>;
         
     | 
| 
      
 14 
     | 
    
         
            +
            export declare const createArvoEventId: (id?: CreateArvoEvent<Record<string, unknown>, string>["id"]) => string;
         
     | 
| 
      
 15 
     | 
    
         
            +
            export declare const parseArvoEventId: (id: string) => readonly [{
         
     | 
| 
      
 16 
     | 
    
         
            +
                value: string;
         
     | 
| 
      
 17 
     | 
    
         
            +
                uuid: string;
         
     | 
| 
      
 18 
     | 
    
         
            +
            }, null] | readonly [string, Error];
         
     | 
| 
         @@ -0,0 +1,39 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            "use strict";
         
     | 
| 
      
 2 
     | 
    
         
            +
            var __importDefault = (this && this.__importDefault) || function (mod) {
         
     | 
| 
      
 3 
     | 
    
         
            +
                return (mod && mod.__esModule) ? mod : { "default": mod };
         
     | 
| 
      
 4 
     | 
    
         
            +
            };
         
     | 
| 
      
 5 
     | 
    
         
            +
            Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
      
 6 
     | 
    
         
            +
            exports.parseArvoEventId = exports.createArvoEventId = exports.ArvoEventIdObjectSchema = void 0;
         
     | 
| 
      
 7 
     | 
    
         
            +
            var pako_1 = __importDefault(require("pako"));
         
     | 
| 
      
 8 
     | 
    
         
            +
            var uuid_1 = require("uuid");
         
     | 
| 
      
 9 
     | 
    
         
            +
            var zod_1 = require("zod");
         
     | 
| 
      
 10 
     | 
    
         
            +
            exports.ArvoEventIdObjectSchema = zod_1.z.object({
         
     | 
| 
      
 11 
     | 
    
         
            +
                uuid: zod_1.z.string(),
         
     | 
| 
      
 12 
     | 
    
         
            +
                value: zod_1.z.string(),
         
     | 
| 
      
 13 
     | 
    
         
            +
            });
         
     | 
| 
      
 14 
     | 
    
         
            +
            var createArvoEventId = function (id) {
         
     | 
| 
      
 15 
     | 
    
         
            +
                if ((id === null || id === void 0 ? void 0 : id.deduplication) === 'ARVO_MANAGED' && id.value.trim()) {
         
     | 
| 
      
 16 
     | 
    
         
            +
                    var data = exports.ArvoEventIdObjectSchema.parse({ uuid: (0, uuid_1.v4)(), value: id.value.trim() });
         
     | 
| 
      
 17 
     | 
    
         
            +
                    var jsonString = JSON.stringify(data);
         
     | 
| 
      
 18 
     | 
    
         
            +
                    var compressed = pako_1.default.deflate(new TextEncoder().encode(jsonString));
         
     | 
| 
      
 19 
     | 
    
         
            +
                    return Buffer.from(compressed).toString('base64');
         
     | 
| 
      
 20 
     | 
    
         
            +
                }
         
     | 
| 
      
 21 
     | 
    
         
            +
                if ((id === null || id === void 0 ? void 0 : id.deduplication) === 'DEVELOPER_MANAGED' && id.value.trim()) {
         
     | 
| 
      
 22 
     | 
    
         
            +
                    return id.value.trim();
         
     | 
| 
      
 23 
     | 
    
         
            +
                }
         
     | 
| 
      
 24 
     | 
    
         
            +
                return (0, uuid_1.v4)();
         
     | 
| 
      
 25 
     | 
    
         
            +
            };
         
     | 
| 
      
 26 
     | 
    
         
            +
            exports.createArvoEventId = createArvoEventId;
         
     | 
| 
      
 27 
     | 
    
         
            +
            var parseArvoEventId = function (id) {
         
     | 
| 
      
 28 
     | 
    
         
            +
                try {
         
     | 
| 
      
 29 
     | 
    
         
            +
                    var compressed = Buffer.from(id, 'base64');
         
     | 
| 
      
 30 
     | 
    
         
            +
                    var decompressed = pako_1.default.inflate(compressed);
         
     | 
| 
      
 31 
     | 
    
         
            +
                    var jsonString = new TextDecoder().decode(decompressed);
         
     | 
| 
      
 32 
     | 
    
         
            +
                    var parsed = JSON.parse(jsonString);
         
     | 
| 
      
 33 
     | 
    
         
            +
                    return [exports.ArvoEventIdObjectSchema.parse(parsed), null];
         
     | 
| 
      
 34 
     | 
    
         
            +
                }
         
     | 
| 
      
 35 
     | 
    
         
            +
                catch (e) {
         
     | 
| 
      
 36 
     | 
    
         
            +
                    return [id, e];
         
     | 
| 
      
 37 
     | 
    
         
            +
                }
         
     | 
| 
      
 38 
     | 
    
         
            +
            };
         
     | 
| 
      
 39 
     | 
    
         
            +
            exports.parseArvoEventId = parseArvoEventId;
         
     | 
| 
         @@ -26,8 +26,28 @@ export type OpenTelemetryExtension = z.infer<typeof OpenTelemetryExtensionSchema 
     | 
|
| 
       26 
26 
     | 
    
         
             
             * @template TType - The type name of the event
         
     | 
| 
       27 
27 
     | 
    
         
             
             */
         
     | 
| 
       28 
28 
     | 
    
         
             
            export type CreateArvoEvent<TData extends ArvoEventData, TType extends string> = {
         
     | 
| 
       29 
     | 
    
         
            -
                /** 
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
      
 29 
     | 
    
         
            +
                /**
         
     | 
| 
      
 30 
     | 
    
         
            +
                 * The event id serves as the primary deduplication key within the Arvo system,
         
     | 
| 
      
 31 
     | 
    
         
            +
                 * ensuring idempotent event processing. If not provided, a UUID v4 will be automatically generated.
         
     | 
| 
      
 32 
     | 
    
         
            +
                 */
         
     | 
| 
      
 33 
     | 
    
         
            +
                id?: {
         
     | 
| 
      
 34 
     | 
    
         
            +
                    /**
         
     | 
| 
      
 35 
     | 
    
         
            +
                     * Deduplication identifier management strategy.
         
     | 
| 
      
 36 
     | 
    
         
            +
                     *
         
     | 
| 
      
 37 
     | 
    
         
            +
                     * - `DEVELOPER_MANAGED`: You, the developer, guarantee uniqueness of the identifier value.
         
     | 
| 
      
 38 
     | 
    
         
            +
                     *   The provided value is used directly as the deduplication key without modification.
         
     | 
| 
      
 39 
     | 
    
         
            +
                     *
         
     | 
| 
      
 40 
     | 
    
         
            +
                     * - `ARVO_MANAGED`: Arvo manages identifier uniqueness by generating a composite key.
         
     | 
| 
      
 41 
     | 
    
         
            +
                     *   The final identifier follows the format `base64({uuid: uuid4(), value: value})`,
         
     | 
| 
      
 42 
     | 
    
         
            +
                     *   where a UUID v4 prefix ensures global uniqueness while preserving the developer's
         
     | 
| 
      
 43 
     | 
    
         
            +
                     *   value for reference.
         
     | 
| 
      
 44 
     | 
    
         
            +
                     */
         
     | 
| 
      
 45 
     | 
    
         
            +
                    deduplication: 'DEVELOPER_MANAGED' | 'ARVO_MANAGED';
         
     | 
| 
      
 46 
     | 
    
         
            +
                    /**
         
     | 
| 
      
 47 
     | 
    
         
            +
                     * The id value
         
     | 
| 
      
 48 
     | 
    
         
            +
                     */
         
     | 
| 
      
 49 
     | 
    
         
            +
                    value: string;
         
     | 
| 
      
 50 
     | 
    
         
            +
                };
         
     | 
| 
       31 
51 
     | 
    
         
             
                /** Timestamp of when the occurrence happened. Must be in ISO 8601 format with timezone offset. */
         
     | 
| 
       32 
52 
     | 
    
         
             
                time?: string;
         
     | 
| 
       33 
53 
     | 
    
         
             
                /** Identifies the context in which an event happened. Must be a valid URI representing the event producer. */
         
     | 
| 
         @@ -4,11 +4,11 @@ export declare const ArvoOrchestrationSubjectContentSchema: z.ZodObject<{ 
     | 
|
| 
       4 
4 
     | 
    
         
             
                    name: z.ZodEffects<z.ZodString, string, string>;
         
     | 
| 
       5 
5 
     | 
    
         
             
                    version: z.ZodString;
         
     | 
| 
       6 
6 
     | 
    
         
             
                }, "strip", z.ZodTypeAny, {
         
     | 
| 
       7 
     | 
    
         
            -
                    version: string;
         
     | 
| 
       8 
7 
     | 
    
         
             
                    name: string;
         
     | 
| 
       9 
     | 
    
         
            -
                }, {
         
     | 
| 
       10 
8 
     | 
    
         
             
                    version: string;
         
     | 
| 
      
 9 
     | 
    
         
            +
                }, {
         
     | 
| 
       11 
10 
     | 
    
         
             
                    name: string;
         
     | 
| 
      
 11 
     | 
    
         
            +
                    version: string;
         
     | 
| 
       12 
12 
     | 
    
         
             
                }>;
         
     | 
| 
       13 
13 
     | 
    
         
             
                execution: z.ZodObject<{
         
     | 
| 
       14 
14 
     | 
    
         
             
                    id: z.ZodEffects<z.ZodString, string, string>;
         
     | 
| 
         @@ -26,8 +26,8 @@ export declare const ArvoOrchestrationSubjectContentSchema: z.ZodObject<{ 
     | 
|
| 
       26 
26 
     | 
    
         
             
                meta: z.ZodRecord<z.ZodString, z.ZodString>;
         
     | 
| 
       27 
27 
     | 
    
         
             
            }, "strip", z.ZodTypeAny, {
         
     | 
| 
       28 
28 
     | 
    
         
             
                orchestrator: {
         
     | 
| 
       29 
     | 
    
         
            -
                    version: string;
         
     | 
| 
       30 
29 
     | 
    
         
             
                    name: string;
         
     | 
| 
      
 30 
     | 
    
         
            +
                    version: string;
         
     | 
| 
       31 
31 
     | 
    
         
             
                };
         
     | 
| 
       32 
32 
     | 
    
         
             
                execution: {
         
     | 
| 
       33 
33 
     | 
    
         
             
                    id: string;
         
     | 
| 
         @@ -37,8 +37,8 @@ export declare const ArvoOrchestrationSubjectContentSchema: z.ZodObject<{ 
     | 
|
| 
       37 
37 
     | 
    
         
             
                meta: Record<string, string>;
         
     | 
| 
       38 
38 
     | 
    
         
             
            }, {
         
     | 
| 
       39 
39 
     | 
    
         
             
                orchestrator: {
         
     | 
| 
       40 
     | 
    
         
            -
                    version: string;
         
     | 
| 
       41 
40 
     | 
    
         
             
                    name: string;
         
     | 
| 
      
 41 
     | 
    
         
            +
                    version: string;
         
     | 
| 
       42 
42 
     | 
    
         
             
                };
         
     | 
| 
       43 
43 
     | 
    
         
             
                execution: {
         
     | 
| 
       44 
44 
     | 
    
         
             
                    id: string;
         
     | 
    
        package/dist/errors.d.ts
    CHANGED
    
    | 
         @@ -26,6 +26,8 @@ export declare class ViolationError<T extends string = string> extends Error { 
     | 
|
| 
       26 
26 
     | 
    
         
             
                readonly type: T;
         
     | 
| 
       27 
27 
     | 
    
         
             
                /** Additional structured data about the violation */
         
     | 
| 
       28 
28 
     | 
    
         
             
                readonly metadata: Record<string, any> | null;
         
     | 
| 
      
 29 
     | 
    
         
            +
                /** An additional flag to determine if it is an Arvo specific violation error */
         
     | 
| 
      
 30 
     | 
    
         
            +
                readonly isArvoViolationError = true;
         
     | 
| 
       29 
31 
     | 
    
         
             
                /**
         
     | 
| 
       30 
32 
     | 
    
         
             
                 * The error name, formatted as ViolationError<TYPE>
         
     | 
| 
       31 
33 
     | 
    
         
             
                 * This helps with error identification in logs and stack traces
         
     | 
| 
         @@ -33,3 +35,22 @@ export declare class ViolationError<T extends string = string> extends Error { 
     | 
|
| 
       33 
35 
     | 
    
         
             
                readonly name: `ViolationError<${T}>`;
         
     | 
| 
       34 
36 
     | 
    
         
             
                constructor({ type, message, metadata }: ViolationErrorParam<T>);
         
     | 
| 
       35 
37 
     | 
    
         
             
            }
         
     | 
| 
      
 38 
     | 
    
         
            +
            /**
         
     | 
| 
      
 39 
     | 
    
         
            +
             * Type guard to determine if an unknown value is a ViolationError, an instance
         
     | 
| 
      
 40 
     | 
    
         
            +
             * of a class that inherits from ViolationError.
         
     | 
| 
      
 41 
     | 
    
         
            +
             *
         
     | 
| 
      
 42 
     | 
    
         
            +
             * @param e - The value to check, typically an unknown error or exception
         
     | 
| 
      
 43 
     | 
    
         
            +
             * @returns `true` if the value is a ViolationError, inherits from it, or has the isArvoViolationError flag, `false` otherwise
         
     | 
| 
      
 44 
     | 
    
         
            +
             *
         
     | 
| 
      
 45 
     | 
    
         
            +
             * ```typescript
         
     | 
| 
      
 46 
     | 
    
         
            +
             * const error = new ViolationError({
         
     | 
| 
      
 47 
     | 
    
         
            +
             *   type: 'RATE_LIMIT',
         
     | 
| 
      
 48 
     | 
    
         
            +
             *   message: 'API rate limit exceeded'
         
     | 
| 
      
 49 
     | 
    
         
            +
             * });
         
     | 
| 
      
 50 
     | 
    
         
            +
             *
         
     | 
| 
      
 51 
     | 
    
         
            +
             * console.log(isViolationError(error)); // true
         
     | 
| 
      
 52 
     | 
    
         
            +
             * console.log(isViolationError(new Error())); // false
         
     | 
| 
      
 53 
     | 
    
         
            +
             * console.log(isViolationError(null)); // false
         
     | 
| 
      
 54 
     | 
    
         
            +
             * ```
         
     | 
| 
      
 55 
     | 
    
         
            +
             */
         
     | 
| 
      
 56 
     | 
    
         
            +
            export declare const isViolationError: (e: unknown) => boolean;
         
     | 
    
        package/dist/errors.js
    CHANGED
    
    | 
         @@ -14,8 +14,12 @@ var __extends = (this && this.__extends) || (function () { 
     | 
|
| 
       14 
14 
     | 
    
         
             
                    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
         
     | 
| 
       15 
15 
     | 
    
         
             
                };
         
     | 
| 
       16 
16 
     | 
    
         
             
            })();
         
     | 
| 
      
 17 
     | 
    
         
            +
            var __importDefault = (this && this.__importDefault) || function (mod) {
         
     | 
| 
      
 18 
     | 
    
         
            +
                return (mod && mod.__esModule) ? mod : { "default": mod };
         
     | 
| 
      
 19 
     | 
    
         
            +
            };
         
     | 
| 
       17 
20 
     | 
    
         
             
            Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
       18 
     | 
    
         
            -
            exports.ViolationError = void 0;
         
     | 
| 
      
 21 
     | 
    
         
            +
            exports.isViolationError = exports.ViolationError = void 0;
         
     | 
| 
      
 22 
     | 
    
         
            +
            var zod_1 = __importDefault(require("zod"));
         
     | 
| 
       19 
23 
     | 
    
         
             
            /**
         
     | 
| 
       20 
24 
     | 
    
         
             
             * ViolationError represents errors that require explicit handling in the system.
         
     | 
| 
       21 
25 
     | 
    
         
             
             * These are distinct from recoverable errors that can be automatically handled
         
     | 
| 
         @@ -33,6 +37,8 @@ var ViolationError = /** @class */ (function (_super) { 
     | 
|
| 
       33 
37 
     | 
    
         
             
                function ViolationError(_a) {
         
     | 
| 
       34 
38 
     | 
    
         
             
                    var type = _a.type, message = _a.message, metadata = _a.metadata;
         
     | 
| 
       35 
39 
     | 
    
         
             
                    var _this = _super.call(this, "ViolationError<".concat(type, "> ").concat(message)) || this;
         
     | 
| 
      
 40 
     | 
    
         
            +
                    /** An additional flag to determine if it is an Arvo specific violation error */
         
     | 
| 
      
 41 
     | 
    
         
            +
                    _this.isArvoViolationError = true;
         
     | 
| 
       36 
42 
     | 
    
         
             
                    _this.type = type;
         
     | 
| 
       37 
43 
     | 
    
         
             
                    _this.name = "ViolationError<".concat(_this.type, ">");
         
     | 
| 
       38 
44 
     | 
    
         
             
                    _this.metadata = metadata !== null && metadata !== void 0 ? metadata : null;
         
     | 
| 
         @@ -41,3 +47,31 @@ var ViolationError = /** @class */ (function (_super) { 
     | 
|
| 
       41 
47 
     | 
    
         
             
                return ViolationError;
         
     | 
| 
       42 
48 
     | 
    
         
             
            }(Error));
         
     | 
| 
       43 
49 
     | 
    
         
             
            exports.ViolationError = ViolationError;
         
     | 
| 
      
 50 
     | 
    
         
            +
            /**
         
     | 
| 
      
 51 
     | 
    
         
            +
             * Type guard to determine if an unknown value is a ViolationError, an instance
         
     | 
| 
      
 52 
     | 
    
         
            +
             * of a class that inherits from ViolationError.
         
     | 
| 
      
 53 
     | 
    
         
            +
             *
         
     | 
| 
      
 54 
     | 
    
         
            +
             * @param e - The value to check, typically an unknown error or exception
         
     | 
| 
      
 55 
     | 
    
         
            +
             * @returns `true` if the value is a ViolationError, inherits from it, or has the isArvoViolationError flag, `false` otherwise
         
     | 
| 
      
 56 
     | 
    
         
            +
             *
         
     | 
| 
      
 57 
     | 
    
         
            +
             * ```typescript
         
     | 
| 
      
 58 
     | 
    
         
            +
             * const error = new ViolationError({
         
     | 
| 
      
 59 
     | 
    
         
            +
             *   type: 'RATE_LIMIT',
         
     | 
| 
      
 60 
     | 
    
         
            +
             *   message: 'API rate limit exceeded'
         
     | 
| 
      
 61 
     | 
    
         
            +
             * });
         
     | 
| 
      
 62 
     | 
    
         
            +
             *
         
     | 
| 
      
 63 
     | 
    
         
            +
             * console.log(isViolationError(error)); // true
         
     | 
| 
      
 64 
     | 
    
         
            +
             * console.log(isViolationError(new Error())); // false
         
     | 
| 
      
 65 
     | 
    
         
            +
             * console.log(isViolationError(null)); // false
         
     | 
| 
      
 66 
     | 
    
         
            +
             * ```
         
     | 
| 
      
 67 
     | 
    
         
            +
             */
         
     | 
| 
      
 68 
     | 
    
         
            +
            var isViolationError = function (e) {
         
     | 
| 
      
 69 
     | 
    
         
            +
                var ViolationErrorSchema = zod_1.default.object({
         
     | 
| 
      
 70 
     | 
    
         
            +
                    isArvoViolationError: zod_1.default.literal(true),
         
     | 
| 
      
 71 
     | 
    
         
            +
                    type: zod_1.default.string().min(1),
         
     | 
| 
      
 72 
     | 
    
         
            +
                    name: zod_1.default.string().min(1),
         
     | 
| 
      
 73 
     | 
    
         
            +
                    message: zod_1.default.string().min(1),
         
     | 
| 
      
 74 
     | 
    
         
            +
                });
         
     | 
| 
      
 75 
     | 
    
         
            +
                return e instanceof Error && ViolationErrorSchema.safeParse(e).success;
         
     | 
| 
      
 76 
     | 
    
         
            +
            };
         
     | 
| 
      
 77 
     | 
    
         
            +
            exports.isViolationError = isViolationError;
         
     | 
    
        package/dist/index.d.ts
    CHANGED
    
    | 
         @@ -13,6 +13,7 @@ import { VersionedArvoContract } from './ArvoContract/VersionedArvoContract'; 
     | 
|
| 
       13 
13 
     | 
    
         
             
            import { WildCardArvoSemanticVersion, isWildCardArvoSematicVersion } from './ArvoContract/WildCardArvoSemanticVersion';
         
     | 
| 
       14 
14 
     | 
    
         
             
            import { ArvoContractJSONSchema, ArvoContractRecord, IArvoContract, ResolveArvoContractRecord } from './ArvoContract/types';
         
     | 
| 
       15 
15 
     | 
    
         
             
            import { ArvoContractValidators } from './ArvoContract/validators';
         
     | 
| 
      
 16 
     | 
    
         
            +
            import { ArvoEventIdObject, ArvoEventIdObjectSchema, createArvoEventId, parseArvoEventId } from './ArvoEvent/id';
         
     | 
| 
       16 
17 
     | 
    
         
             
            import ArvoEventFactory from './ArvoEventFactory';
         
     | 
| 
       17 
18 
     | 
    
         
             
            import { ArvoOrchestratorEventFactory } from './ArvoEventFactory/Orchestrator';
         
     | 
| 
       18 
19 
     | 
    
         
             
            import { createArvoEventFactory, createArvoOrchestratorEventFactory } from './ArvoEventFactory/helpers';
         
     | 
| 
         @@ -26,7 +27,7 @@ import ArvoExecution from './OpenTelemetry/ArvoExecution'; 
     | 
|
| 
       26 
27 
     | 
    
         
             
            import { ArvoExecutionSpanKind } from './OpenTelemetry/ArvoExecution/types';
         
     | 
| 
       27 
28 
     | 
    
         
             
            import OpenInference from './OpenTelemetry/OpenInference';
         
     | 
| 
       28 
29 
     | 
    
         
             
            import { OpenInferenceSpanKind } from './OpenTelemetry/OpenInference/types';
         
     | 
| 
       29 
     | 
    
         
            -
            import { ViolationError, ViolationErrorParam } from './errors';
         
     | 
| 
      
 30 
     | 
    
         
            +
            import { ViolationError, ViolationErrorParam, isViolationError } from './errors';
         
     | 
| 
       30 
31 
     | 
    
         
             
            import { ArvoErrorSchema, ArvoSemanticVersionSchema, isValidArvoSemanticVersion } from './schema';
         
     | 
| 
       31 
32 
     | 
    
         
             
            import { ArvoErrorType, ArvoSemanticVersion, InferArvoEvent, InferVersionedArvoContract } from './types';
         
     | 
| 
       32 
33 
     | 
    
         
             
            /**
         
     | 
| 
         @@ -109,4 +110,4 @@ declare const ArvoEventSchema: { 
     | 
|
| 
       109 
110 
     | 
    
         
             
                    parentSubject$$: string | null;
         
     | 
| 
       110 
111 
     | 
    
         
             
                }>;
         
     | 
| 
       111 
112 
     | 
    
         
             
            };
         
     | 
| 
       112 
     | 
    
         
            -
            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, createArvoError, };
         
     | 
| 
      
 113 
     | 
    
         
            +
            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, createArvoError, createArvoEventId, parseArvoEventId, ArvoEventIdObjectSchema, ArvoEventIdObject, isViolationError, };
         
     | 
    
        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.createArvoError = 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;
         
     | 
| 
      
 6 
     | 
    
         
            +
            exports.isViolationError = exports.ArvoEventIdObjectSchema = exports.parseArvoEventId = exports.createArvoEventId = exports.createArvoError = 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 ArvoContract_1 = __importDefault(require("./ArvoContract"));
         
     | 
| 
       8 
8 
     | 
    
         
             
            exports.ArvoContract = ArvoContract_1.default;
         
     | 
| 
       9 
9 
     | 
    
         
             
            var helpers_1 = require("./ArvoContract/helpers");
         
     | 
| 
         @@ -36,6 +36,10 @@ Object.defineProperty(exports, "WildCardArvoSemanticVersion", { enumerable: true 
     | 
|
| 
       36 
36 
     | 
    
         
             
            Object.defineProperty(exports, "isWildCardArvoSematicVersion", { enumerable: true, get: function () { return WildCardArvoSemanticVersion_1.isWildCardArvoSematicVersion; } });
         
     | 
| 
       37 
37 
     | 
    
         
             
            var validators_1 = require("./ArvoContract/validators");
         
     | 
| 
       38 
38 
     | 
    
         
             
            Object.defineProperty(exports, "ArvoContractValidators", { enumerable: true, get: function () { return validators_1.ArvoContractValidators; } });
         
     | 
| 
      
 39 
     | 
    
         
            +
            var id_1 = require("./ArvoEvent/id");
         
     | 
| 
      
 40 
     | 
    
         
            +
            Object.defineProperty(exports, "ArvoEventIdObjectSchema", { enumerable: true, get: function () { return id_1.ArvoEventIdObjectSchema; } });
         
     | 
| 
      
 41 
     | 
    
         
            +
            Object.defineProperty(exports, "createArvoEventId", { enumerable: true, get: function () { return id_1.createArvoEventId; } });
         
     | 
| 
      
 42 
     | 
    
         
            +
            Object.defineProperty(exports, "parseArvoEventId", { enumerable: true, get: function () { return id_1.parseArvoEventId; } });
         
     | 
| 
       39 
43 
     | 
    
         
             
            var ArvoEventFactory_1 = __importDefault(require("./ArvoEventFactory"));
         
     | 
| 
       40 
44 
     | 
    
         
             
            exports.ArvoEventFactory = ArvoEventFactory_1.default;
         
     | 
| 
       41 
45 
     | 
    
         
             
            var Orchestrator_1 = require("./ArvoEventFactory/Orchestrator");
         
     | 
| 
         @@ -62,6 +66,7 @@ var types_2 = require("./OpenTelemetry/OpenInference/types"); 
     | 
|
| 
       62 
66 
     | 
    
         
             
            Object.defineProperty(exports, "OpenInferenceSpanKind", { enumerable: true, get: function () { return types_2.OpenInferenceSpanKind; } });
         
     | 
| 
       63 
67 
     | 
    
         
             
            var errors_1 = require("./errors");
         
     | 
| 
       64 
68 
     | 
    
         
             
            Object.defineProperty(exports, "ViolationError", { enumerable: true, get: function () { return errors_1.ViolationError; } });
         
     | 
| 
      
 69 
     | 
    
         
            +
            Object.defineProperty(exports, "isViolationError", { enumerable: true, get: function () { return errors_1.isViolationError; } });
         
     | 
| 
       65 
70 
     | 
    
         
             
            var schema_4 = require("./schema");
         
     | 
| 
       66 
71 
     | 
    
         
             
            Object.defineProperty(exports, "ArvoErrorSchema", { enumerable: true, get: function () { return schema_4.ArvoErrorSchema; } });
         
     | 
| 
       67 
72 
     | 
    
         
             
            Object.defineProperty(exports, "ArvoSemanticVersionSchema", { enumerable: true, get: function () { return schema_4.ArvoSemanticVersionSchema; } });
         
     | 
    
        package/package.json
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            {
         
     | 
| 
       2 
2 
     | 
    
         
             
              "name": "arvo-core",
         
     | 
| 
       3 
     | 
    
         
            -
              "version": "3.0. 
     | 
| 
      
 3 
     | 
    
         
            +
              "version": "3.0.8",
         
     | 
| 
       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": {
         
     | 
| 
         @@ -44,8 +44,8 @@ 
     | 
|
| 
       44 
44 
     | 
    
         
             
                "@opentelemetry/core": "^1.30.1",
         
     | 
| 
       45 
45 
     | 
    
         
             
                "pako": "^2.1.0",
         
     | 
| 
       46 
46 
     | 
    
         
             
                "uuid": "^11.1.0",
         
     | 
| 
       47 
     | 
    
         
            -
                "zod": "^3.25. 
     | 
| 
       48 
     | 
    
         
            -
                "zod-to-json-schema": "^3.24. 
     | 
| 
      
 47 
     | 
    
         
            +
                "zod": "^3.25.74",
         
     | 
| 
      
 48 
     | 
    
         
            +
                "zod-to-json-schema": "^3.24.6"
         
     | 
| 
       49 
49 
     | 
    
         
             
              },
         
     | 
| 
       50 
50 
     | 
    
         
             
              "engines": {
         
     | 
| 
       51 
51 
     | 
    
         
             
                "node": ">=18.0.0"
         
     |