arvo-core 0.0.1 → 0.0.2
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/README.md +0 -5
- package/dist/ArvoContract/helpers.d.ts +24 -4
- package/dist/ArvoContract/helpers.js +25 -5
- package/dist/ArvoContract/index.d.ts +46 -5
- package/dist/ArvoContract/index.js +51 -3
- package/dist/ArvoContract/types.d.ts +2 -0
- package/dist/ArvoContractLibrary/helpers.d.ts +10 -0
- package/dist/ArvoContractLibrary/helpers.js +22 -0
- package/dist/ArvoContractLibrary/index.d.ts +53 -0
- package/dist/ArvoContractLibrary/index.js +74 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +11 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,15 +1,35 @@
|
|
1
1
|
import { IArvoContract } from './types';
|
2
2
|
import ArvoContract from '.';
|
3
|
-
import { TelemetryContext } from '../OpenTelemetry/types';
|
4
3
|
/**
|
5
4
|
* Infers the ArvoContract type from a given IArvoContract.
|
6
5
|
*/
|
7
6
|
export type InferArvoContract<T> = T extends IArvoContract<infer U, infer V, infer W> ? ArvoContract<U, V, W> : never;
|
8
7
|
/**
|
9
8
|
* Creates an ArvoContract instance from the given contract specification.
|
9
|
+
*
|
10
|
+
* This function provides a convenient way to create and initialize an ArvoContract
|
11
|
+
* with proper type inference.
|
12
|
+
*
|
10
13
|
* @template TContract - The type of the contract specification.
|
11
|
-
* @param {TContract} contractSpec - The contract specification.
|
12
|
-
*
|
14
|
+
* @param {TContract} contractSpec - The contract specification object.
|
15
|
+
* This should include the URI, accepts, and emits properties as defined in IArvoContract.
|
16
|
+
*
|
13
17
|
* @returns {InferArvoContract<TContract>} The created ArvoContract instance.
|
18
|
+
* The returned type is inferred from the input contract specification.
|
19
|
+
*
|
20
|
+
* @example
|
21
|
+
* const myContract = createArvoContract({
|
22
|
+
* uri: 'https://example.com/contracts/myContract',
|
23
|
+
* accepts: {
|
24
|
+
* type: 'com.example.input',
|
25
|
+
* schema: z.object({ name: z.string() }),
|
26
|
+
* },
|
27
|
+
* emits: [
|
28
|
+
* {
|
29
|
+
* type: 'com.example.output',
|
30
|
+
* schema: z.object({ result: z.number() }),
|
31
|
+
* },
|
32
|
+
* ],
|
33
|
+
* });
|
14
34
|
*/
|
15
|
-
export declare const createArvoContract: <const TContract extends IArvoContract>(contract: TContract
|
35
|
+
export declare const createArvoContract: <const TContract extends IArvoContract>(contract: TContract) => InferArvoContract<TContract>;
|
@@ -5,15 +5,35 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.createArvoContract = void 0;
|
7
7
|
var _1 = __importDefault(require("."));
|
8
|
-
var OpenTelemetry_1 = require("../OpenTelemetry");
|
9
8
|
/**
|
10
9
|
* Creates an ArvoContract instance from the given contract specification.
|
10
|
+
*
|
11
|
+
* This function provides a convenient way to create and initialize an ArvoContract
|
12
|
+
* with proper type inference.
|
13
|
+
*
|
11
14
|
* @template TContract - The type of the contract specification.
|
12
|
-
* @param {TContract} contractSpec - The contract specification.
|
13
|
-
*
|
15
|
+
* @param {TContract} contractSpec - The contract specification object.
|
16
|
+
* This should include the URI, accepts, and emits properties as defined in IArvoContract.
|
17
|
+
*
|
14
18
|
* @returns {InferArvoContract<TContract>} The created ArvoContract instance.
|
19
|
+
* The returned type is inferred from the input contract specification.
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* const myContract = createArvoContract({
|
23
|
+
* uri: 'https://example.com/contracts/myContract',
|
24
|
+
* accepts: {
|
25
|
+
* type: 'com.example.input',
|
26
|
+
* schema: z.object({ name: z.string() }),
|
27
|
+
* },
|
28
|
+
* emits: [
|
29
|
+
* {
|
30
|
+
* type: 'com.example.output',
|
31
|
+
* schema: z.object({ result: z.number() }),
|
32
|
+
* },
|
33
|
+
* ],
|
34
|
+
* });
|
15
35
|
*/
|
16
|
-
var createArvoContract = function (contract
|
17
|
-
return
|
36
|
+
var createArvoContract = function (contract) {
|
37
|
+
return new _1.default(contract);
|
18
38
|
};
|
19
39
|
exports.createArvoContract = createArvoContract;
|
@@ -19,18 +19,19 @@ export default class ArvoContract<T extends string = string, TAccepts extends Ar
|
|
19
19
|
private readonly _uri;
|
20
20
|
private readonly _accepts;
|
21
21
|
private readonly _emits;
|
22
|
+
readonly description: string | null;
|
22
23
|
/**
|
23
24
|
* Creates an instance of ArvoContract.
|
24
25
|
* @param {IArvoContract<T, TAccepts, TEmits>} params - The contract parameters.
|
25
26
|
*/
|
26
27
|
constructor(params: IArvoContract<T, TAccepts, TEmits>);
|
27
28
|
get uri(): T;
|
28
|
-
get accepts():
|
29
|
+
get accepts(): TAccepts;
|
29
30
|
/**
|
30
31
|
* Gets all emitted event types and schemas as a readonly record.
|
31
32
|
* Use this when you need to access all emitted events at once.
|
32
33
|
*/
|
33
|
-
get emits():
|
34
|
+
get emits(): Record<ExtractEventType<TEmits>, TEmits>;
|
34
35
|
/**
|
35
36
|
* Gets a specific emitted event type and schema.
|
36
37
|
* Use this when you need to access a single emitted event by its type.
|
@@ -39,9 +40,9 @@ export default class ArvoContract<T extends string = string, TAccepts extends Ar
|
|
39
40
|
* @returns {Readonly<Extract<TEmits, { type: U }>>} The emit record.
|
40
41
|
* @throws {Error} If the emit type is not found in the contract.
|
41
42
|
*/
|
42
|
-
getEmit<U extends ExtractEventType<TEmits>>(type: U):
|
43
|
+
getEmit<U extends ExtractEventType<TEmits>>(type: U): Extract<TEmits, {
|
43
44
|
type: U;
|
44
|
-
}
|
45
|
+
}>;
|
45
46
|
/**
|
46
47
|
* Validates the input against the contract's accept schema.
|
47
48
|
* @template U - The type of the input to validate.
|
@@ -72,9 +73,49 @@ export default class ArvoContract<T extends string = string, TAccepts extends Ar
|
|
72
73
|
/**
|
73
74
|
* Validates the emits records.
|
74
75
|
* @param {TEmits[]} emits - The emits records to validate.
|
75
|
-
* @returns {
|
76
|
+
* @returns {Array<TEmits>} The validated emits records.
|
76
77
|
* @private
|
77
78
|
*/
|
78
79
|
private validateEmits;
|
80
|
+
/**
|
81
|
+
* Exports the ArvoContract instance as a plain object conforming to the IArvoContract interface.
|
82
|
+
* This method can be used to serialize the contract or to create a new instance with the same parameters.
|
83
|
+
*
|
84
|
+
* @returns {IArvoContract<T, TAccepts, TEmits>} An object representing the contract, including its URI, accepts, and emits properties.
|
85
|
+
*/
|
86
|
+
export(): IArvoContract<T, TAccepts, TEmits>;
|
87
|
+
/**
|
88
|
+
* Converts the ArvoContract instance to a JSON Schema representation.
|
89
|
+
* This method provides a way to represent the contract's structure and validation rules
|
90
|
+
* in a format that conforms to the JSON Schema specification.
|
91
|
+
*
|
92
|
+
* @returns An object representing the contract in JSON Schema format, including:
|
93
|
+
* - uri: The contract's URI
|
94
|
+
* - description: The contract's description (if available)
|
95
|
+
* - accepts: An object containing the accepted input type and its JSON Schema representation
|
96
|
+
* - emits: An array of objects, each containing an emitted event type and its JSON Schema representation
|
97
|
+
*/
|
98
|
+
toJsonSchema(): {
|
99
|
+
uri: T;
|
100
|
+
description: string | null;
|
101
|
+
accepts: {
|
102
|
+
type: string;
|
103
|
+
schema: import("zod-to-json-schema").JsonSchema7Type & {
|
104
|
+
$schema?: string | undefined;
|
105
|
+
definitions?: {
|
106
|
+
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
107
|
+
} | undefined;
|
108
|
+
};
|
109
|
+
};
|
110
|
+
emits: {
|
111
|
+
type: z.ZodLiteral<string>;
|
112
|
+
schema: import("zod-to-json-schema").JsonSchema7Type & {
|
113
|
+
$schema?: string | undefined;
|
114
|
+
definitions?: {
|
115
|
+
[key: string]: import("zod-to-json-schema").JsonSchema7Type;
|
116
|
+
} | undefined;
|
117
|
+
};
|
118
|
+
}[];
|
119
|
+
};
|
79
120
|
}
|
80
121
|
export {};
|
@@ -1,6 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
var zod_1 = require("zod");
|
3
4
|
var validators_1 = require("./validators");
|
5
|
+
var zod_to_json_schema_1 = require("zod-to-json-schema");
|
4
6
|
/**
|
5
7
|
* ArvoContract class represents a contract with defined input and output schemas.
|
6
8
|
* It provides methods for validating inputs and outputs based on the contract's specifications.
|
@@ -18,6 +20,7 @@ var ArvoContract = /** @class */ (function () {
|
|
18
20
|
this._uri = validators_1.ArvoContractValidators.contract.uri.parse(params.uri);
|
19
21
|
this._accepts = this.validateAccepts(params.accepts);
|
20
22
|
this._emits = this.validateEmits(params.emits);
|
23
|
+
this.description = params.description || null;
|
21
24
|
Object.freeze(this);
|
22
25
|
}
|
23
26
|
Object.defineProperty(ArvoContract.prototype, "uri", {
|
@@ -29,7 +32,7 @@ var ArvoContract = /** @class */ (function () {
|
|
29
32
|
});
|
30
33
|
Object.defineProperty(ArvoContract.prototype, "accepts", {
|
31
34
|
get: function () {
|
32
|
-
return this._accepts;
|
35
|
+
return Object.freeze(this._accepts);
|
33
36
|
},
|
34
37
|
enumerable: false,
|
35
38
|
configurable: true
|
@@ -62,7 +65,7 @@ var ArvoContract = /** @class */ (function () {
|
|
62
65
|
if (!emit) {
|
63
66
|
throw new Error("Emit type \"".concat(type, "\" not found in contract"));
|
64
67
|
}
|
65
|
-
return emit;
|
68
|
+
return Object.freeze(emit);
|
66
69
|
};
|
67
70
|
/**
|
68
71
|
* Validates the input against the contract's accept schema.
|
@@ -108,7 +111,7 @@ var ArvoContract = /** @class */ (function () {
|
|
108
111
|
/**
|
109
112
|
* Validates the emits records.
|
110
113
|
* @param {TEmits[]} emits - The emits records to validate.
|
111
|
-
* @returns {
|
114
|
+
* @returns {Array<TEmits>} The validated emits records.
|
112
115
|
* @private
|
113
116
|
*/
|
114
117
|
ArvoContract.prototype.validateEmits = function (emits) {
|
@@ -117,6 +120,51 @@ var ArvoContract = /** @class */ (function () {
|
|
117
120
|
schema: item.schema,
|
118
121
|
}); }));
|
119
122
|
};
|
123
|
+
/**
|
124
|
+
* Exports the ArvoContract instance as a plain object conforming to the IArvoContract interface.
|
125
|
+
* This method can be used to serialize the contract or to create a new instance with the same parameters.
|
126
|
+
*
|
127
|
+
* @returns {IArvoContract<T, TAccepts, TEmits>} An object representing the contract, including its URI, accepts, and emits properties.
|
128
|
+
*/
|
129
|
+
ArvoContract.prototype.export = function () {
|
130
|
+
return {
|
131
|
+
uri: this._uri,
|
132
|
+
description: this.description,
|
133
|
+
accepts: {
|
134
|
+
type: this._accepts.type,
|
135
|
+
schema: this._accepts.schema,
|
136
|
+
},
|
137
|
+
emits: this._emits.map(function (emit) { return ({
|
138
|
+
type: emit.type,
|
139
|
+
schema: emit.schema,
|
140
|
+
}); }),
|
141
|
+
};
|
142
|
+
};
|
143
|
+
/**
|
144
|
+
* Converts the ArvoContract instance to a JSON Schema representation.
|
145
|
+
* This method provides a way to represent the contract's structure and validation rules
|
146
|
+
* in a format that conforms to the JSON Schema specification.
|
147
|
+
*
|
148
|
+
* @returns An object representing the contract in JSON Schema format, including:
|
149
|
+
* - uri: The contract's URI
|
150
|
+
* - description: The contract's description (if available)
|
151
|
+
* - accepts: An object containing the accepted input type and its JSON Schema representation
|
152
|
+
* - emits: An array of objects, each containing an emitted event type and its JSON Schema representation
|
153
|
+
*/
|
154
|
+
ArvoContract.prototype.toJsonSchema = function () {
|
155
|
+
return {
|
156
|
+
uri: this._uri,
|
157
|
+
description: this.description,
|
158
|
+
accepts: {
|
159
|
+
type: this._accepts.type,
|
160
|
+
schema: (0, zod_to_json_schema_1.zodToJsonSchema)(this._accepts.schema),
|
161
|
+
},
|
162
|
+
emits: this._emits.map(function (item) { return ({
|
163
|
+
type: zod_1.z.literal(item.type),
|
164
|
+
schema: (0, zod_to_json_schema_1.zodToJsonSchema)(item.schema),
|
165
|
+
}); }),
|
166
|
+
};
|
167
|
+
};
|
120
168
|
return ArvoContract;
|
121
169
|
}());
|
122
170
|
exports.default = ArvoContract;
|
@@ -23,6 +23,8 @@ export interface IArvoContract<TUri extends string = string, TAccepts extends Ar
|
|
23
23
|
accepts: TAccepts;
|
24
24
|
/** An array of record types that the contract can emit */
|
25
25
|
emits: TEmits[];
|
26
|
+
/** (Optional) The description of the contract or its handler */
|
27
|
+
description?: string | null;
|
26
28
|
}
|
27
29
|
/**
|
28
30
|
* Resolves the inferred type of an ArvoContractRecord's schema.
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import ArvoContractLibrary from '.';
|
2
|
+
import ArvoContract from '../ArvoContract';
|
3
|
+
/**
|
4
|
+
* Creates a new ArvoContractLibrary instance with the given ArvoContract instances.
|
5
|
+
*
|
6
|
+
* @template T - The type of ArvoContract to be stored in the library.
|
7
|
+
* @param {...T[]} args - One or more ArvoContract instances to initialize the library.
|
8
|
+
* @returns {ArvoContractLibrary<T>} A new ArvoContractLibrary instance containing the provided contracts.
|
9
|
+
*/
|
10
|
+
export declare const createArvoContractLibrary: <T extends ArvoContract>(...args: T[]) => ArvoContractLibrary<T>;
|
@@ -0,0 +1,22 @@
|
|
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.createArvoContractLibrary = void 0;
|
7
|
+
var _1 = __importDefault(require("."));
|
8
|
+
/**
|
9
|
+
* Creates a new ArvoContractLibrary instance with the given ArvoContract instances.
|
10
|
+
*
|
11
|
+
* @template T - The type of ArvoContract to be stored in the library.
|
12
|
+
* @param {...T[]} args - One or more ArvoContract instances to initialize the library.
|
13
|
+
* @returns {ArvoContractLibrary<T>} A new ArvoContractLibrary instance containing the provided contracts.
|
14
|
+
*/
|
15
|
+
var createArvoContractLibrary = function () {
|
16
|
+
var args = [];
|
17
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
18
|
+
args[_i] = arguments[_i];
|
19
|
+
}
|
20
|
+
return new _1.default(args);
|
21
|
+
};
|
22
|
+
exports.createArvoContractLibrary = createArvoContractLibrary;
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import ArvoContract from '../ArvoContract';
|
2
|
+
/**
|
3
|
+
* Extracts the URI type from a given ArvoContract type.
|
4
|
+
* @template T - The ArvoContract type to extract from.
|
5
|
+
*/
|
6
|
+
type ExtractContractUri<T> = T extends {
|
7
|
+
uri: infer U;
|
8
|
+
} ? U : never;
|
9
|
+
/**
|
10
|
+
* A library class for managing and accessing ArvoContract instances.
|
11
|
+
* @template T - The type of ArvoContract stored in the library.
|
12
|
+
*/
|
13
|
+
export default class ArvoContractLibrary<T extends ArvoContract> {
|
14
|
+
/**
|
15
|
+
* The array of ArvoContract instances stored in the library.
|
16
|
+
* @private
|
17
|
+
* @readonly
|
18
|
+
*/
|
19
|
+
private readonly _contracts;
|
20
|
+
/**
|
21
|
+
* Creates an instance of ArvoContractLibrary.
|
22
|
+
* @param {T[]} contracts - An array of ArvoContract instances to initialize the library.
|
23
|
+
* @throws An error in case the URI are duplicated
|
24
|
+
*/
|
25
|
+
constructor(contracts: T[]);
|
26
|
+
/**
|
27
|
+
* Returns a readonly array of all ArvoContract instances in the library.
|
28
|
+
* @returns {Array<T>} A readonly array of ArvoContract instances.
|
29
|
+
*/
|
30
|
+
list(): Array<T>;
|
31
|
+
/**
|
32
|
+
* Retrieves an ArvoContract instance by its URI.
|
33
|
+
* @template U - The type of the URI to search for.
|
34
|
+
* @param {U} uri - The URI of the contract to retrieve.
|
35
|
+
* @returns {Extract<T, { uri: U }>} A readonly ArvoContract instance matching the given URI.
|
36
|
+
* @throws {Error} If no contract with the given URI is found in the library.
|
37
|
+
*/
|
38
|
+
get<U extends ExtractContractUri<T>>(uri: U): Extract<T, {
|
39
|
+
uri: U;
|
40
|
+
}>;
|
41
|
+
/**
|
42
|
+
* Checks if the library contains a contract with the given URI.
|
43
|
+
* @param {string} uri - The URI to check for.
|
44
|
+
* @returns {boolean} True if a contract with the given URI exists in the library, false otherwise.
|
45
|
+
*/
|
46
|
+
has(uri: string): boolean;
|
47
|
+
/**
|
48
|
+
* Returns the number of contracts in the library.
|
49
|
+
* @returns {number} The number of contracts in the library.
|
50
|
+
*/
|
51
|
+
get size(): number;
|
52
|
+
}
|
53
|
+
export {};
|
@@ -0,0 +1,74 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
4
|
+
if (ar || !(i in from)) {
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
6
|
+
ar[i] = from[i];
|
7
|
+
}
|
8
|
+
}
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
/**
|
13
|
+
* A library class for managing and accessing ArvoContract instances.
|
14
|
+
* @template T - The type of ArvoContract stored in the library.
|
15
|
+
*/
|
16
|
+
var ArvoContractLibrary = /** @class */ (function () {
|
17
|
+
/**
|
18
|
+
* Creates an instance of ArvoContractLibrary.
|
19
|
+
* @param {T[]} contracts - An array of ArvoContract instances to initialize the library.
|
20
|
+
* @throws An error in case the URI are duplicated
|
21
|
+
*/
|
22
|
+
function ArvoContractLibrary(contracts) {
|
23
|
+
var uriSet = new Set();
|
24
|
+
contracts.forEach(function (contract) {
|
25
|
+
if (uriSet.has(contract.uri)) {
|
26
|
+
throw new Error("Duplicate contract URI found: ".concat(contract.uri));
|
27
|
+
}
|
28
|
+
uriSet.add(contract.uri);
|
29
|
+
});
|
30
|
+
this._contracts = __spreadArray([], contracts, true);
|
31
|
+
}
|
32
|
+
/**
|
33
|
+
* Returns a readonly array of all ArvoContract instances in the library.
|
34
|
+
* @returns {Array<T>} A readonly array of ArvoContract instances.
|
35
|
+
*/
|
36
|
+
ArvoContractLibrary.prototype.list = function () {
|
37
|
+
return Object.freeze(__spreadArray([], this._contracts, true));
|
38
|
+
};
|
39
|
+
/**
|
40
|
+
* Retrieves an ArvoContract instance by its URI.
|
41
|
+
* @template U - The type of the URI to search for.
|
42
|
+
* @param {U} uri - The URI of the contract to retrieve.
|
43
|
+
* @returns {Extract<T, { uri: U }>} A readonly ArvoContract instance matching the given URI.
|
44
|
+
* @throws {Error} If no contract with the given URI is found in the library.
|
45
|
+
*/
|
46
|
+
ArvoContractLibrary.prototype.get = function (uri) {
|
47
|
+
var contract = this._contracts.find(function (item) { return item.uri === uri; });
|
48
|
+
if (!contract) {
|
49
|
+
throw new Error("ArvoContract with URI \"".concat(uri, "\" not found in the library"));
|
50
|
+
}
|
51
|
+
return Object.freeze(contract);
|
52
|
+
};
|
53
|
+
/**
|
54
|
+
* Checks if the library contains a contract with the given URI.
|
55
|
+
* @param {string} uri - The URI to check for.
|
56
|
+
* @returns {boolean} True if a contract with the given URI exists in the library, false otherwise.
|
57
|
+
*/
|
58
|
+
ArvoContractLibrary.prototype.has = function (uri) {
|
59
|
+
return this._contracts.some(function (contract) { return contract.uri === uri; });
|
60
|
+
};
|
61
|
+
Object.defineProperty(ArvoContractLibrary.prototype, "size", {
|
62
|
+
/**
|
63
|
+
* Returns the number of contracts in the library.
|
64
|
+
* @returns {number} The number of contracts in the library.
|
65
|
+
*/
|
66
|
+
get: function () {
|
67
|
+
return this._contracts.length;
|
68
|
+
},
|
69
|
+
enumerable: false,
|
70
|
+
configurable: true
|
71
|
+
});
|
72
|
+
return ArvoContractLibrary;
|
73
|
+
}());
|
74
|
+
exports.default = ArvoContractLibrary;
|
package/dist/index.d.ts
CHANGED
@@ -5,6 +5,12 @@ import { CloudEventContext, CloudEventExtension, ArvoEventData, ArvoExtension, O
|
|
5
5
|
import { exceptionToSpan, logToSpan, getTelemetryContext, getTelemetryCarrier, createOtelSpan, OTelNull } from './OpenTelemetry';
|
6
6
|
import { TelemetryCarrier, TelemetryContext, TelemetryLogLevel } from './OpenTelemetry/types';
|
7
7
|
import { validateURI, cleanString } from './utils';
|
8
|
+
import ArvoContract from './ArvoContract';
|
9
|
+
import { createArvoContract, InferArvoContract } from './ArvoContract/helpers';
|
10
|
+
import { ArvoContractValidators } from './ArvoContract/validators';
|
11
|
+
import { ArvoContractRecord, IArvoContract, ResolveArvoContractRecord } from './ArvoContract/types';
|
12
|
+
import ArvoContractLibrary from './ArvoContractLibrary';
|
13
|
+
import { createArvoContractLibrary } from './ArvoContractLibrary/helpers';
|
8
14
|
/**
|
9
15
|
* Collection of Zod schemas for validating various aspects of Arvo events.
|
10
16
|
* @property {z.ZodObject} CloudEventContextSchema - Schema for core CloudEvent properties.
|
@@ -71,4 +77,4 @@ declare const ArvoEventSchemas: {
|
|
71
77
|
tracestate: string | null;
|
72
78
|
}>;
|
73
79
|
};
|
74
|
-
export { ArvoEvent, createArvoEvent, ArvoDataContentType, ArvoEventData, CloudEventExtension, ArvoEventSchemas, CloudEventContext, ArvoExtension, OpenTelemetryExtension, CreateArvoEvent, exceptionToSpan, logToSpan, getTelemetryCarrier, getTelemetryContext, createOtelSpan, TelemetryCarrier, TelemetryContext, TelemetryLogLevel, OTelNull, validateURI, cleanString, };
|
80
|
+
export { ArvoEvent, createArvoEvent, ArvoDataContentType, ArvoEventData, CloudEventExtension, ArvoEventSchemas, CloudEventContext, ArvoExtension, OpenTelemetryExtension, CreateArvoEvent, exceptionToSpan, logToSpan, getTelemetryCarrier, getTelemetryContext, createOtelSpan, TelemetryCarrier, TelemetryContext, TelemetryLogLevel, OTelNull, validateURI, cleanString, ArvoContract, createArvoContract, ArvoContractValidators, ArvoContractRecord, InferArvoContract, IArvoContract, ResolveArvoContractRecord, ArvoContractLibrary, createArvoContractLibrary, };
|
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.cleanString = exports.validateURI = exports.OTelNull = exports.createOtelSpan = exports.getTelemetryContext = exports.getTelemetryCarrier = exports.logToSpan = exports.exceptionToSpan = exports.ArvoEventSchemas = exports.ArvoDataContentType = exports.createArvoEvent = exports.ArvoEvent = void 0;
|
6
|
+
exports.createArvoContractLibrary = exports.ArvoContractLibrary = exports.ArvoContractValidators = exports.createArvoContract = exports.ArvoContract = exports.cleanString = exports.validateURI = exports.OTelNull = exports.createOtelSpan = exports.getTelemetryContext = exports.getTelemetryCarrier = exports.logToSpan = exports.exceptionToSpan = exports.ArvoEventSchemas = 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");
|
@@ -20,6 +20,16 @@ Object.defineProperty(exports, "OTelNull", { enumerable: true, get: function ()
|
|
20
20
|
var utils_1 = require("./utils");
|
21
21
|
Object.defineProperty(exports, "validateURI", { enumerable: true, get: function () { return utils_1.validateURI; } });
|
22
22
|
Object.defineProperty(exports, "cleanString", { enumerable: true, get: function () { return utils_1.cleanString; } });
|
23
|
+
var ArvoContract_1 = __importDefault(require("./ArvoContract"));
|
24
|
+
exports.ArvoContract = ArvoContract_1.default;
|
25
|
+
var helpers_2 = require("./ArvoContract/helpers");
|
26
|
+
Object.defineProperty(exports, "createArvoContract", { enumerable: true, get: function () { return helpers_2.createArvoContract; } });
|
27
|
+
var validators_1 = require("./ArvoContract/validators");
|
28
|
+
Object.defineProperty(exports, "ArvoContractValidators", { enumerable: true, get: function () { return validators_1.ArvoContractValidators; } });
|
29
|
+
var ArvoContractLibrary_1 = __importDefault(require("./ArvoContractLibrary"));
|
30
|
+
exports.ArvoContractLibrary = ArvoContractLibrary_1.default;
|
31
|
+
var helpers_3 = require("./ArvoContractLibrary/helpers");
|
32
|
+
Object.defineProperty(exports, "createArvoContractLibrary", { enumerable: true, get: function () { return helpers_3.createArvoContractLibrary; } });
|
23
33
|
/**
|
24
34
|
* Collection of Zod schemas for validating various aspects of Arvo events.
|
25
35
|
* @property {z.ZodObject} CloudEventContextSchema - Schema for core CloudEvent properties.
|