arvo-core 1.0.29 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +4 -0
- package/README.md +19 -0
- package/dist/ArvoContract/helpers.d.ts +1 -1
- package/dist/ArvoContract/helpers.js +1 -1
- package/dist/ArvoEvent/index.d.ts +6 -6
- package/dist/ArvoEvent/index.js +6 -6
- package/dist/ArvoOrchestrationSubject/index.d.ts +36 -0
- package/dist/ArvoOrchestrationSubject/index.js +102 -0
- package/dist/ArvoOrchestrationSubject/schema.d.ts +42 -0
- package/dist/ArvoOrchestrationSubject/schema.js +34 -0
- package/dist/ArvoOrchestrationSubject/type.d.ts +65 -0
- package/dist/ArvoOrchestrationSubject/type.js +2 -0
- package/dist/OpenTelemetry/index.d.ts +0 -2
- package/dist/OpenTelemetry/index.js +0 -2
- package/dist/index.d.ts +4 -1
- package/dist/index.js +6 -1
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
[![SonarCloud](https://sonarcloud.io/images/project_badges/sonarcloud-white.svg)](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
2
|
+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=SaadAhmad123_arvo-core&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
3
|
+
|
4
|
+
|
1
5
|
# Arvo
|
2
6
|
|
3
7
|
## What is Arvo
|
@@ -86,3 +90,18 @@ This package is available under the MIT License. For more details, refer to the
|
|
86
90
|
## Change Logs
|
87
91
|
|
88
92
|
For a detailed list of changes and updates, please refer to the [document](CHANGELOG.md) file.
|
93
|
+
|
94
|
+
### SonarCloud Metrics
|
95
|
+
|
96
|
+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=SaadAhmad123_arvo-core&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
97
|
+
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=SaadAhmad123_arvo-core&metric=bugs)](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
98
|
+
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=SaadAhmad123_arvo-core&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
99
|
+
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=SaadAhmad123_arvo-core&metric=coverage)](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
100
|
+
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=SaadAhmad123_arvo-core&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
101
|
+
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=SaadAhmad123_arvo-core&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
102
|
+
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=SaadAhmad123_arvo-core&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
103
|
+
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=SaadAhmad123_arvo-core&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
104
|
+
[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=SaadAhmad123_arvo-core&metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
105
|
+
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=SaadAhmad123_arvo-core&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
106
|
+
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=SaadAhmad123_arvo-core&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
107
|
+
|
@@ -12,7 +12,7 @@ export type InferArvoContract<T> = T extends IArvoContract<infer S, infer U, inf
|
|
12
12
|
*
|
13
13
|
* @template TContract - The type of the contract specification.
|
14
14
|
*
|
15
|
-
* @param
|
15
|
+
* @param contract - The contract specification object.
|
16
16
|
* This should include the URI, accepts, and emits properties as defined in IArvoContract.
|
17
17
|
*
|
18
18
|
* @returns The created ArvoContract instance.
|
@@ -13,7 +13,7 @@ var _1 = __importDefault(require("."));
|
|
13
13
|
*
|
14
14
|
* @template TContract - The type of the contract specification.
|
15
15
|
*
|
16
|
-
* @param
|
16
|
+
* @param contract - The contract specification object.
|
17
17
|
* This should include the URI, accepts, and emits properties as defined in IArvoContract.
|
18
18
|
*
|
19
19
|
* @returns The created ArvoContract instance.
|
@@ -91,7 +91,7 @@ export default class ArvoEvent<TData extends ArvoEventData = ArvoEventData, TExt
|
|
91
91
|
* This field represents the intended recipient or destination of the event.
|
92
92
|
* @returns The value of the 'to' field.
|
93
93
|
*
|
94
|
-
* @
|
94
|
+
* @remarks
|
95
95
|
* This is a convenience getter for the data in `this.extensions.to` as this
|
96
96
|
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
97
97
|
* spec.
|
@@ -102,7 +102,7 @@ export default class ArvoEvent<TData extends ArvoEventData = ArvoEventData, TExt
|
|
102
102
|
* This field contains access control information for the event.
|
103
103
|
* @returns The value of the 'accesscontrol' field.
|
104
104
|
*
|
105
|
-
* @
|
105
|
+
* @remarks
|
106
106
|
* This is a convenience getter for the data in `this.extensions.accesscontrol` as this
|
107
107
|
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
108
108
|
* spec.
|
@@ -113,7 +113,7 @@ export default class ArvoEvent<TData extends ArvoEventData = ArvoEventData, TExt
|
|
113
113
|
* This field indicate an alternative destination for the event.
|
114
114
|
* @returns The value of the 'redirectto' field.
|
115
115
|
*
|
116
|
-
* @
|
116
|
+
* @remarks
|
117
117
|
* This is a convenience getter for the data in `this.extensions.redirectto` as this
|
118
118
|
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
119
119
|
* spec.
|
@@ -124,7 +124,7 @@ export default class ArvoEvent<TData extends ArvoEventData = ArvoEventData, TExt
|
|
124
124
|
* This field contains information about the execution units associated with the event.
|
125
125
|
* @returns The value of the 'executionunits' field.
|
126
126
|
*
|
127
|
-
* @
|
127
|
+
* @remarks
|
128
128
|
* This is a convenience getter for the data in `this.extensions.executionunits` as this
|
129
129
|
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
130
130
|
* spec.
|
@@ -135,7 +135,7 @@ export default class ArvoEvent<TData extends ArvoEventData = ArvoEventData, TExt
|
|
135
135
|
* This field contains the W3C Trace Context traceparent header.
|
136
136
|
* @returns The value of the 'traceparent' field.
|
137
137
|
*
|
138
|
-
* @
|
138
|
+
* @remarks
|
139
139
|
* This is a convenience getter for the data in `this.extensions.traceparent` as this
|
140
140
|
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
141
141
|
* spec.
|
@@ -146,7 +146,7 @@ export default class ArvoEvent<TData extends ArvoEventData = ArvoEventData, TExt
|
|
146
146
|
* This field contains the W3C Trace Context tracestate header.
|
147
147
|
* @returns The value of the 'tracestate' field, or undefined if not set.
|
148
148
|
*
|
149
|
-
* @
|
149
|
+
* @remarks
|
150
150
|
* This is a convenience getter for the data in `this.extensions.tracestate` as this
|
151
151
|
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
152
152
|
* spec.
|
package/dist/ArvoEvent/index.js
CHANGED
@@ -129,7 +129,7 @@ var ArvoEvent = /** @class */ (function () {
|
|
129
129
|
* This field represents the intended recipient or destination of the event.
|
130
130
|
* @returns The value of the 'to' field.
|
131
131
|
*
|
132
|
-
* @
|
132
|
+
* @remarks
|
133
133
|
* This is a convenience getter for the data in `this.extensions.to` as this
|
134
134
|
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
135
135
|
* spec.
|
@@ -146,7 +146,7 @@ var ArvoEvent = /** @class */ (function () {
|
|
146
146
|
* This field contains access control information for the event.
|
147
147
|
* @returns The value of the 'accesscontrol' field.
|
148
148
|
*
|
149
|
-
* @
|
149
|
+
* @remarks
|
150
150
|
* This is a convenience getter for the data in `this.extensions.accesscontrol` as this
|
151
151
|
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
152
152
|
* spec.
|
@@ -163,7 +163,7 @@ var ArvoEvent = /** @class */ (function () {
|
|
163
163
|
* This field indicate an alternative destination for the event.
|
164
164
|
* @returns The value of the 'redirectto' field.
|
165
165
|
*
|
166
|
-
* @
|
166
|
+
* @remarks
|
167
167
|
* This is a convenience getter for the data in `this.extensions.redirectto` as this
|
168
168
|
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
169
169
|
* spec.
|
@@ -180,7 +180,7 @@ var ArvoEvent = /** @class */ (function () {
|
|
180
180
|
* This field contains information about the execution units associated with the event.
|
181
181
|
* @returns The value of the 'executionunits' field.
|
182
182
|
*
|
183
|
-
* @
|
183
|
+
* @remarks
|
184
184
|
* This is a convenience getter for the data in `this.extensions.executionunits` as this
|
185
185
|
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
186
186
|
* spec.
|
@@ -197,7 +197,7 @@ var ArvoEvent = /** @class */ (function () {
|
|
197
197
|
* This field contains the W3C Trace Context traceparent header.
|
198
198
|
* @returns The value of the 'traceparent' field.
|
199
199
|
*
|
200
|
-
* @
|
200
|
+
* @remarks
|
201
201
|
* This is a convenience getter for the data in `this.extensions.traceparent` as this
|
202
202
|
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
203
203
|
* spec.
|
@@ -214,7 +214,7 @@ var ArvoEvent = /** @class */ (function () {
|
|
214
214
|
* This field contains the W3C Trace Context tracestate header.
|
215
215
|
* @returns The value of the 'tracestate' field, or undefined if not set.
|
216
216
|
*
|
217
|
-
* @
|
217
|
+
* @remarks
|
218
218
|
* This is a convenience getter for the data in `this.extensions.tracestate` as this
|
219
219
|
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
220
220
|
* spec.
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { ArvoOchestratorVersion, ArvoOrchestrationSubjectContent } from "./type";
|
2
|
+
/**
|
3
|
+
* Handles the creation and parsing of Arvo orchestration subjects.
|
4
|
+
*/
|
5
|
+
export default class ArvoOrchestrationSubject {
|
6
|
+
/**
|
7
|
+
* Creates a new Arvo orchestration subject.
|
8
|
+
*
|
9
|
+
* @param param - Parameters for creating the subject
|
10
|
+
* @param param.orchestrator - Name of the orchestrator
|
11
|
+
* @param param.version - Version of the orchestrator
|
12
|
+
* @param param.initiator - Initiator of the orchestration
|
13
|
+
* @returns A base64 encoded string representing the orchestration subject
|
14
|
+
*/
|
15
|
+
static new(param: {
|
16
|
+
orchestator: string;
|
17
|
+
version: ArvoOchestratorVersion;
|
18
|
+
initiator: string;
|
19
|
+
}): string;
|
20
|
+
/**
|
21
|
+
* Creates an Arvo orchestration subject from the provided content.
|
22
|
+
*
|
23
|
+
* @param param - The orchestration subject content
|
24
|
+
* @returns A base64 encoded string representing the orchestration subject
|
25
|
+
* @throws Error if the provided content is invalid or if compression fails
|
26
|
+
*/
|
27
|
+
static create(param: ArvoOrchestrationSubjectContent): string;
|
28
|
+
/**
|
29
|
+
* Parses a base64 encoded Arvo orchestration subject string.
|
30
|
+
*
|
31
|
+
* @param subject - The base64 encoded subject string to parse
|
32
|
+
* @returns The parsed ArvoOrchestrationSubjectContent
|
33
|
+
* @throws Error if parsing or validation fails
|
34
|
+
*/
|
35
|
+
static parse(subject: string): ArvoOrchestrationSubjectContent;
|
36
|
+
}
|
@@ -0,0 +1,102 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
var schema_1 = require("./schema");
|
27
|
+
var zlib = __importStar(require("zlib"));
|
28
|
+
var utils_1 = require("../utils");
|
29
|
+
var uuid_1 = require("uuid");
|
30
|
+
/**
|
31
|
+
* Handles the creation and parsing of Arvo orchestration subjects.
|
32
|
+
*/
|
33
|
+
var ArvoOrchestrationSubject = /** @class */ (function () {
|
34
|
+
function ArvoOrchestrationSubject() {
|
35
|
+
}
|
36
|
+
/**
|
37
|
+
* Creates a new Arvo orchestration subject.
|
38
|
+
*
|
39
|
+
* @param param - Parameters for creating the subject
|
40
|
+
* @param param.orchestrator - Name of the orchestrator
|
41
|
+
* @param param.version - Version of the orchestrator
|
42
|
+
* @param param.initiator - Initiator of the orchestration
|
43
|
+
* @returns A base64 encoded string representing the orchestration subject
|
44
|
+
*/
|
45
|
+
ArvoOrchestrationSubject.new = function (param) {
|
46
|
+
return ArvoOrchestrationSubject.create({
|
47
|
+
orchestrator: {
|
48
|
+
name: param.orchestator,
|
49
|
+
version: param.version,
|
50
|
+
},
|
51
|
+
execution: {
|
52
|
+
id: (0, uuid_1.v4)(),
|
53
|
+
initiator: param.initiator
|
54
|
+
}
|
55
|
+
});
|
56
|
+
};
|
57
|
+
/**
|
58
|
+
* Creates an Arvo orchestration subject from the provided content.
|
59
|
+
*
|
60
|
+
* @param param - The orchestration subject content
|
61
|
+
* @returns A base64 encoded string representing the orchestration subject
|
62
|
+
* @throws Error if the provided content is invalid or if compression fails
|
63
|
+
*/
|
64
|
+
ArvoOrchestrationSubject.create = function (param) {
|
65
|
+
try {
|
66
|
+
var validationResult = schema_1.ArvoOrchestrationSubjectContentSchema.safeParse(param);
|
67
|
+
if (!validationResult.success) {
|
68
|
+
throw new Error("Invalid ArvoOrchestrationContextType: ".concat(validationResult.error));
|
69
|
+
}
|
70
|
+
var jsonString = JSON.stringify(param);
|
71
|
+
var compressed = zlib.deflateSync(jsonString);
|
72
|
+
return compressed.toString('base64');
|
73
|
+
}
|
74
|
+
catch (e) {
|
75
|
+
throw new Error((0, utils_1.cleanString)("\n Error creating orchestration subject string from the provided context. \n Error -> ".concat(e.message, " \n Context -> ").concat(JSON.stringify(param, null, 2), "\n ")));
|
76
|
+
}
|
77
|
+
};
|
78
|
+
/**
|
79
|
+
* Parses a base64 encoded Arvo orchestration subject string.
|
80
|
+
*
|
81
|
+
* @param subject - The base64 encoded subject string to parse
|
82
|
+
* @returns The parsed ArvoOrchestrationSubjectContent
|
83
|
+
* @throws Error if parsing or validation fails
|
84
|
+
*/
|
85
|
+
ArvoOrchestrationSubject.parse = function (subject) {
|
86
|
+
try {
|
87
|
+
var compressed = Buffer.from(subject, 'base64');
|
88
|
+
var jsonString = zlib.inflateSync(compressed).toString();
|
89
|
+
var parsed = JSON.parse(jsonString);
|
90
|
+
var validationResult = schema_1.ArvoOrchestrationSubjectContentSchema.safeParse(parsed);
|
91
|
+
if (!validationResult.success) {
|
92
|
+
throw new Error("Invalid ArvoOrchestrationContextType: ".concat(validationResult.error));
|
93
|
+
}
|
94
|
+
return parsed;
|
95
|
+
}
|
96
|
+
catch (e) {
|
97
|
+
throw new Error((0, utils_1.cleanString)("\n Error parsing orchestration subject string to the context. \n Error -> ".concat(e.message, " \n subject -> ").concat(subject, "\n ")));
|
98
|
+
}
|
99
|
+
};
|
100
|
+
return ArvoOrchestrationSubject;
|
101
|
+
}());
|
102
|
+
exports.default = ArvoOrchestrationSubject;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export declare const ArvoOchestratorVersionSchema: z.ZodEffects<z.ZodString, string, string>;
|
3
|
+
export declare const ArvoOrchestrationSubjectContentSchema: z.ZodObject<{
|
4
|
+
orchestrator: z.ZodObject<{
|
5
|
+
name: z.ZodEffects<z.ZodString, string, string>;
|
6
|
+
version: z.ZodEffects<z.ZodString, string, string>;
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
8
|
+
name: string;
|
9
|
+
version: string;
|
10
|
+
}, {
|
11
|
+
name: string;
|
12
|
+
version: string;
|
13
|
+
}>;
|
14
|
+
execution: z.ZodObject<{
|
15
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
16
|
+
initiator: z.ZodEffects<z.ZodString, string, string>;
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
18
|
+
id: string;
|
19
|
+
initiator: string;
|
20
|
+
}, {
|
21
|
+
id: string;
|
22
|
+
initiator: string;
|
23
|
+
}>;
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
25
|
+
orchestrator: {
|
26
|
+
name: string;
|
27
|
+
version: string;
|
28
|
+
};
|
29
|
+
execution: {
|
30
|
+
id: string;
|
31
|
+
initiator: string;
|
32
|
+
};
|
33
|
+
}, {
|
34
|
+
orchestrator: {
|
35
|
+
name: string;
|
36
|
+
version: string;
|
37
|
+
};
|
38
|
+
execution: {
|
39
|
+
id: string;
|
40
|
+
initiator: string;
|
41
|
+
};
|
42
|
+
}>;
|
@@ -0,0 +1,34 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ArvoOrchestrationSubjectContentSchema = exports.ArvoOchestratorVersionSchema = void 0;
|
4
|
+
var zod_1 = require("zod");
|
5
|
+
// Zod schema for ArvoOchestratorVersion
|
6
|
+
exports.ArvoOchestratorVersionSchema = zod_1.z
|
7
|
+
.string()
|
8
|
+
.regex(/^\d+\.\d+\.\d+$/, 'Invalid version format')
|
9
|
+
.refine(function (value) { return !value.includes(';'); }, 'Version must not contain semicolon')
|
10
|
+
.describe('Semantic version of the Arvo Orchestrator in the format X.Y.Z');
|
11
|
+
// Zod schema for ArvoOrchestrationSubjectContent
|
12
|
+
exports.ArvoOrchestrationSubjectContentSchema = zod_1.z.object({
|
13
|
+
orchestrator: zod_1.z.object({
|
14
|
+
name: zod_1.z
|
15
|
+
.string()
|
16
|
+
.regex(/^[a-z0-9]+(\.[a-z0-9]+)+\.[a-z0-9]+$/, 'Orchestrator name should be prefixed with a reverse-DNS name')
|
17
|
+
.refine(function (value) { return !value.includes(';'); }, 'Orchestrator name must not contain semicolon')
|
18
|
+
.describe('Name of the orchestrator'),
|
19
|
+
version: exports.ArvoOchestratorVersionSchema,
|
20
|
+
})
|
21
|
+
.describe('Information about the orchestrator'),
|
22
|
+
execution: zod_1.z.object({
|
23
|
+
id: zod_1.z
|
24
|
+
.string()
|
25
|
+
.min(1, 'ID must be a non-empty string')
|
26
|
+
.refine(function (value) { return !value.includes(';'); }, 'ID must not contain semicolon')
|
27
|
+
.describe('Unique identifier for the execution'),
|
28
|
+
initiator: zod_1.z
|
29
|
+
.string()
|
30
|
+
.regex(/^[a-z0-9]+(\.[a-z0-9]+)+\.[a-z0-9]+$/, 'Orchestration initiator should be prefixed with a reverse-DNS name')
|
31
|
+
.refine(function (value) { return !value.includes(';'); }, 'Initiator must not contain semicolon')
|
32
|
+
.describe('Entity or process that initiated the execution'),
|
33
|
+
}).describe('Details about the current execution'),
|
34
|
+
}).describe('Context information for Arvo orchestration');
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/**
|
2
|
+
* Represents the version of the Arvo Orchestrator.
|
3
|
+
*
|
4
|
+
* @remark
|
5
|
+
* The version follows the Semantic Versioning format: MAJOR.MINOR.PATCH
|
6
|
+
* **Note**: The string must not contain ';'
|
7
|
+
*
|
8
|
+
* @example
|
9
|
+
* "1.0.0", "2.3.1", "0.5.2"
|
10
|
+
*/
|
11
|
+
export type ArvoOchestratorVersion = `${number}.${number}.${number}`;
|
12
|
+
/**
|
13
|
+
* Represents the content for Arvo orchestration subject.
|
14
|
+
* This type provides information about the orchestrator and the current execution.
|
15
|
+
*/
|
16
|
+
export type ArvoOrchestrationSubjectContent = {
|
17
|
+
/**
|
18
|
+
* Information about the orchestrator.
|
19
|
+
*/
|
20
|
+
orchestrator: {
|
21
|
+
/**
|
22
|
+
* The name of the orchestrator.
|
23
|
+
*
|
24
|
+
* @remark
|
25
|
+
* Should be prefixed with a reverse-DNS name.
|
26
|
+
* **Note**: The string must not contain ';'
|
27
|
+
*
|
28
|
+
* @example
|
29
|
+
* "com.example.myorchestrator"
|
30
|
+
*/
|
31
|
+
name: string;
|
32
|
+
/**
|
33
|
+
* The version of the orchestrator.
|
34
|
+
*/
|
35
|
+
version: ArvoOchestratorVersion;
|
36
|
+
};
|
37
|
+
/**
|
38
|
+
* Details about the current execution.
|
39
|
+
*/
|
40
|
+
execution: {
|
41
|
+
/**
|
42
|
+
* A unique identifier for the execution.
|
43
|
+
*
|
44
|
+
* @remark
|
45
|
+
* Should be a non-empty string. The recomendation
|
46
|
+
* is to use uuid v4 to generate these ids.
|
47
|
+
* **Note**: The string must not contain ';'
|
48
|
+
*
|
49
|
+
* @example
|
50
|
+
* "abc123", "execution-2023-05-15-001"
|
51
|
+
*/
|
52
|
+
id: string;
|
53
|
+
/**
|
54
|
+
* The entity or process that initiated the execution.
|
55
|
+
*
|
56
|
+
* @remark
|
57
|
+
* Should be prefixed with a reverse-DNS name.
|
58
|
+
* **Note**: The string must not contain ';'
|
59
|
+
*
|
60
|
+
* @example
|
61
|
+
* "com.example.initiator-service"
|
62
|
+
*/
|
63
|
+
initiator: string;
|
64
|
+
};
|
65
|
+
};
|
@@ -7,8 +7,6 @@ export declare const ArvoCoreTracer: import("@opentelemetry/api").Tracer;
|
|
7
7
|
/**
|
8
8
|
* Logs a message to a span with additional parameters.
|
9
9
|
* @param params - The parameters for the log message.
|
10
|
-
* @param params.level - The log level of the message.
|
11
|
-
* @param params.message - The main content of the log message.
|
12
10
|
* @param span - The span to log the message to. If not provided, the active span is used.
|
13
11
|
* If no active span is available, the message is logged to the console.
|
14
12
|
*/
|
@@ -24,8 +24,6 @@ exports.ArvoCoreTracer = api_1.trace.getTracer(pkg.name, pkg.version);
|
|
24
24
|
/**
|
25
25
|
* Logs a message to a span with additional parameters.
|
26
26
|
* @param params - The parameters for the log message.
|
27
|
-
* @param params.level - The log level of the message.
|
28
|
-
* @param params.message - The main content of the log message.
|
29
27
|
* @param span - The span to log the message to. If not provided, the active span is used.
|
30
28
|
* If no active span is available, the message is logged to the console.
|
31
29
|
*/
|
package/dist/index.d.ts
CHANGED
@@ -18,6 +18,9 @@ import OpenInference from './OpenTelemetry/OpenInference';
|
|
18
18
|
import ArvoExecution from './OpenTelemetry/ArvoExecution';
|
19
19
|
import { ArvoExecutionSpanKind } from './OpenTelemetry/ArvoExecution/types';
|
20
20
|
import { OpenInferenceSpanKind } from './OpenTelemetry/OpenInference/types';
|
21
|
+
import ArvoOrchestrationSubject from './ArvoOrchestrationSubject';
|
22
|
+
import { ArvoOrchestrationSubjectContentSchema, ArvoOchestratorVersionSchema } from './ArvoOrchestrationSubject/schema';
|
23
|
+
import { ArvoOrchestrationSubjectContent, ArvoOchestratorVersion } from './ArvoOrchestrationSubject/type';
|
21
24
|
/**
|
22
25
|
* Collection of Zod schemas for validating various aspects of Arvo events.
|
23
26
|
* @property {z.ZodObject} CloudEventContextSchema - Schema for core CloudEvent properties.
|
@@ -84,4 +87,4 @@ declare const ArvoEventSchemas: {
|
|
84
87
|
tracestate: string | null;
|
85
88
|
}>;
|
86
89
|
};
|
87
|
-
export { ArvoEvent, createArvoEvent, ArvoDataContentType, ArvoEventData, CloudEventExtension, ArvoEventSchemas, CloudEventContext, ArvoExtension, OpenTelemetryExtension, CreateArvoEvent, exceptionToSpan, logToSpan, OpenTelemetryHeaders, TelemetryLogLevel, OTelNull, validateURI, cleanString, ArvoContract, createArvoContract, ArvoContractValidators, ArvoContractRecord, InferArvoContract, IArvoContract, ResolveArvoContractRecord, ArvoContractLibrary, createArvoContractLibrary, ArvoEventFactory, createArvoEventFactory, ArvoErrorSchema, currentOpenTelemetryHeaders, OpenInference, OpenInferenceSpanKind, ArvoExecution, ArvoExecutionSpanKind, ArvoContractJSONSchema, };
|
90
|
+
export { ArvoEvent, createArvoEvent, ArvoDataContentType, ArvoEventData, CloudEventExtension, ArvoEventSchemas, CloudEventContext, ArvoExtension, OpenTelemetryExtension, CreateArvoEvent, exceptionToSpan, logToSpan, OpenTelemetryHeaders, TelemetryLogLevel, OTelNull, validateURI, cleanString, ArvoContract, createArvoContract, ArvoContractValidators, ArvoContractRecord, InferArvoContract, IArvoContract, ResolveArvoContractRecord, ArvoContractLibrary, createArvoContractLibrary, ArvoEventFactory, createArvoEventFactory, ArvoErrorSchema, currentOpenTelemetryHeaders, OpenInference, OpenInferenceSpanKind, ArvoExecution, ArvoExecutionSpanKind, ArvoContractJSONSchema, ArvoOrchestrationSubject, ArvoOrchestrationSubjectContentSchema, ArvoOchestratorVersionSchema, ArvoOrchestrationSubjectContent, ArvoOchestratorVersion, };
|
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.ArvoExecutionSpanKind = exports.ArvoExecution = exports.OpenInferenceSpanKind = exports.OpenInference = exports.currentOpenTelemetryHeaders = exports.ArvoErrorSchema = exports.createArvoEventFactory = exports.ArvoEventFactory = exports.createArvoContractLibrary = exports.ArvoContractLibrary = exports.ArvoContractValidators = exports.createArvoContract = exports.ArvoContract = exports.cleanString = exports.validateURI = exports.OTelNull = exports.logToSpan = exports.exceptionToSpan = exports.ArvoEventSchemas = exports.ArvoDataContentType = exports.createArvoEvent = exports.ArvoEvent = void 0;
|
6
|
+
exports.ArvoOchestratorVersionSchema = exports.ArvoOrchestrationSubjectContentSchema = exports.ArvoOrchestrationSubject = exports.ArvoExecutionSpanKind = exports.ArvoExecution = exports.OpenInferenceSpanKind = exports.OpenInference = exports.currentOpenTelemetryHeaders = exports.ArvoErrorSchema = exports.createArvoEventFactory = exports.ArvoEventFactory = exports.createArvoContractLibrary = exports.ArvoContractLibrary = exports.ArvoContractValidators = exports.createArvoContract = exports.ArvoContract = exports.cleanString = exports.validateURI = exports.OTelNull = 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");
|
@@ -42,6 +42,11 @@ var types_1 = require("./OpenTelemetry/ArvoExecution/types");
|
|
42
42
|
Object.defineProperty(exports, "ArvoExecutionSpanKind", { enumerable: true, get: function () { return types_1.ArvoExecutionSpanKind; } });
|
43
43
|
var types_2 = require("./OpenTelemetry/OpenInference/types");
|
44
44
|
Object.defineProperty(exports, "OpenInferenceSpanKind", { enumerable: true, get: function () { return types_2.OpenInferenceSpanKind; } });
|
45
|
+
var ArvoOrchestrationSubject_1 = __importDefault(require("./ArvoOrchestrationSubject"));
|
46
|
+
exports.ArvoOrchestrationSubject = ArvoOrchestrationSubject_1.default;
|
47
|
+
var schema_3 = require("./ArvoOrchestrationSubject/schema");
|
48
|
+
Object.defineProperty(exports, "ArvoOrchestrationSubjectContentSchema", { enumerable: true, get: function () { return schema_3.ArvoOrchestrationSubjectContentSchema; } });
|
49
|
+
Object.defineProperty(exports, "ArvoOchestratorVersionSchema", { enumerable: true, get: function () { return schema_3.ArvoOchestratorVersionSchema; } });
|
45
50
|
/**
|
46
51
|
* Collection of Zod schemas for validating various aspects of Arvo events.
|
47
52
|
* @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": "1.0
|
3
|
+
"version": "1.1.0",
|
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": {
|
@@ -41,12 +41,14 @@
|
|
41
41
|
"ts-jest": "^29.2.5",
|
42
42
|
"ts-node": "^10.9.2",
|
43
43
|
"typedoc": "^0.26.6",
|
44
|
+
"typedoc-github-theme": "^0.1.2",
|
44
45
|
"typedoc-plugin-zod": "^1.2.1",
|
45
46
|
"typescript": "^5.5.4"
|
46
47
|
},
|
47
48
|
"dependencies": {
|
48
49
|
"@opentelemetry/api": "^1.9.0",
|
49
50
|
"uuid": "^10.0.0",
|
51
|
+
"zlib": "^1.0.5",
|
50
52
|
"zod": "^3.23.8",
|
51
53
|
"zod-to-json-schema": "^3.23.2"
|
52
54
|
}
|