arvo-core 1.0.28 → 1.0.30
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 +19 -0
- package/dist/ArvoContract/helpers.d.ts +1 -1
- package/dist/ArvoContract/helpers.js +1 -1
- package/dist/ArvoContract/index.js +2 -1
- package/dist/ArvoEvent/helpers.js +9 -8
- package/dist/ArvoEvent/index.d.ts +6 -6
- package/dist/ArvoEvent/index.js +11 -10
- package/dist/ArvoEventFactory/index.js +2 -1
- package/dist/OpenTelemetry/index.d.ts +0 -2
- package/dist/OpenTelemetry/index.js +0 -2
- package/package.json +3 -2
package/README.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
[](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
2
|
+
[](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
|
+
[](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
97
|
+
[](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
98
|
+
[](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
99
|
+
[](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
100
|
+
[](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
101
|
+
[](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
102
|
+
[](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
103
|
+
[](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
104
|
+
[](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
105
|
+
[](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
106
|
+
[](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.
|
@@ -31,10 +31,11 @@ var ArvoContract = /** @class */ (function () {
|
|
31
31
|
* @param params - The contract parameters.
|
32
32
|
*/
|
33
33
|
function ArvoContract(params) {
|
34
|
+
var _a;
|
34
35
|
this._uri = validators_1.ArvoContractValidators.contract.uri.parse(params.uri);
|
35
36
|
this._accepts = this._validateAccepts(params.accepts);
|
36
37
|
this._emits = this._validateEmits(params.emits);
|
37
|
-
this.description = params.description
|
38
|
+
this.description = (_a = params.description) !== null && _a !== void 0 ? _a : null;
|
38
39
|
}
|
39
40
|
Object.defineProperty(ArvoContract.prototype, "uri", {
|
40
41
|
/**
|
@@ -47,6 +47,7 @@ var uuid_1 = require("uuid");
|
|
47
47
|
var createArvoEvent = function (event, extensions) {
|
48
48
|
var span = OpenTelemetry_1.ArvoCoreTracer.startSpan("createArvoEvent<".concat(event.type, ">"), {});
|
49
49
|
return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), function () {
|
50
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
50
51
|
span.setStatus({ code: api_1.SpanStatusCode.OK });
|
51
52
|
try {
|
52
53
|
if (event.datacontenttype &&
|
@@ -58,15 +59,15 @@ var createArvoEvent = function (event, extensions) {
|
|
58
59
|
});
|
59
60
|
}
|
60
61
|
return new _1.default({
|
61
|
-
id: event.id
|
62
|
+
id: (_a = event.id) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)(),
|
62
63
|
type: event.type,
|
63
|
-
accesscontrol: event.accesscontrol
|
64
|
-
executionunits: event.executionunits
|
65
|
-
traceparent: event.traceparent
|
66
|
-
tracestate: event.tracestate
|
67
|
-
datacontenttype: event.datacontenttype
|
68
|
-
specversion: event.specversion
|
69
|
-
time: event.time
|
64
|
+
accesscontrol: (_b = event.accesscontrol) !== null && _b !== void 0 ? _b : null,
|
65
|
+
executionunits: (_c = event.executionunits) !== null && _c !== void 0 ? _c : null,
|
66
|
+
traceparent: (_d = event.traceparent) !== null && _d !== void 0 ? _d : null,
|
67
|
+
tracestate: (_e = event.tracestate) !== null && _e !== void 0 ? _e : null,
|
68
|
+
datacontenttype: (_f = event.datacontenttype) !== null && _f !== void 0 ? _f : schema_1.ArvoDataContentType,
|
69
|
+
specversion: (_g = event.specversion) !== null && _g !== void 0 ? _g : '1.0',
|
70
|
+
time: (_h = event.time) !== null && _h !== void 0 ? _h : (0, utils_1.createTimestamp)(),
|
70
71
|
source: encodeURI(event.source),
|
71
72
|
subject: encodeURI(event.subject),
|
72
73
|
to: event.to ? encodeURI(event.to) : null,
|
@@ -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
@@ -105,6 +105,7 @@ var ArvoEvent = /** @class */ (function () {
|
|
105
105
|
* as `cloudevents.arvo.event_*` fields
|
106
106
|
*/
|
107
107
|
get: function () {
|
108
|
+
var _a, _b, _c, _d;
|
108
109
|
return {
|
109
110
|
'cloudevents.event_id': this.id || OpenTelemetry_1.OTelNull,
|
110
111
|
'cloudevents.event_source': this.source || OpenTelemetry_1.OTelNull,
|
@@ -113,10 +114,10 @@ var ArvoEvent = /** @class */ (function () {
|
|
113
114
|
'cloudevents.event_type': this.type || OpenTelemetry_1.OTelNull,
|
114
115
|
'cloudevents.event_time': this.time || OpenTelemetry_1.OTelNull,
|
115
116
|
'cloudevents.event_datacontenttype': this.datacontenttype || OpenTelemetry_1.OTelNull,
|
116
|
-
'cloudevents.event_dataschema': this.dataschema
|
117
|
-
'cloudevents.arvo.event_redirectto': this.extensions.redirectto
|
118
|
-
'cloudevents.arvo.event_to': this.extensions.to
|
119
|
-
'cloudevents.arvo.event_executionunits': this.extensions.executionunits
|
117
|
+
'cloudevents.event_dataschema': (_a = this.dataschema) !== null && _a !== void 0 ? _a : OpenTelemetry_1.OTelNull,
|
118
|
+
'cloudevents.arvo.event_redirectto': (_b = this.extensions.redirectto) !== null && _b !== void 0 ? _b : OpenTelemetry_1.OTelNull,
|
119
|
+
'cloudevents.arvo.event_to': (_c = this.extensions.to) !== null && _c !== void 0 ? _c : OpenTelemetry_1.OTelNull,
|
120
|
+
'cloudevents.arvo.event_executionunits': (_d = this.extensions.executionunits) !== null && _d !== void 0 ? _d : OpenTelemetry_1.OTelNull,
|
120
121
|
};
|
121
122
|
},
|
122
123
|
enumerable: false,
|
@@ -128,7 +129,7 @@ var ArvoEvent = /** @class */ (function () {
|
|
128
129
|
* This field represents the intended recipient or destination of the event.
|
129
130
|
* @returns The value of the 'to' field.
|
130
131
|
*
|
131
|
-
* @
|
132
|
+
* @remarks
|
132
133
|
* This is a convenience getter for the data in `this.extensions.to` as this
|
133
134
|
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
134
135
|
* spec.
|
@@ -145,7 +146,7 @@ var ArvoEvent = /** @class */ (function () {
|
|
145
146
|
* This field contains access control information for the event.
|
146
147
|
* @returns The value of the 'accesscontrol' field.
|
147
148
|
*
|
148
|
-
* @
|
149
|
+
* @remarks
|
149
150
|
* This is a convenience getter for the data in `this.extensions.accesscontrol` as this
|
150
151
|
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
151
152
|
* spec.
|
@@ -162,7 +163,7 @@ var ArvoEvent = /** @class */ (function () {
|
|
162
163
|
* This field indicate an alternative destination for the event.
|
163
164
|
* @returns The value of the 'redirectto' field.
|
164
165
|
*
|
165
|
-
* @
|
166
|
+
* @remarks
|
166
167
|
* This is a convenience getter for the data in `this.extensions.redirectto` as this
|
167
168
|
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
168
169
|
* spec.
|
@@ -179,7 +180,7 @@ var ArvoEvent = /** @class */ (function () {
|
|
179
180
|
* This field contains information about the execution units associated with the event.
|
180
181
|
* @returns The value of the 'executionunits' field.
|
181
182
|
*
|
182
|
-
* @
|
183
|
+
* @remarks
|
183
184
|
* This is a convenience getter for the data in `this.extensions.executionunits` as this
|
184
185
|
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
185
186
|
* spec.
|
@@ -196,7 +197,7 @@ var ArvoEvent = /** @class */ (function () {
|
|
196
197
|
* This field contains the W3C Trace Context traceparent header.
|
197
198
|
* @returns The value of the 'traceparent' field.
|
198
199
|
*
|
199
|
-
* @
|
200
|
+
* @remarks
|
200
201
|
* This is a convenience getter for the data in `this.extensions.traceparent` as this
|
201
202
|
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
202
203
|
* spec.
|
@@ -213,7 +214,7 @@ var ArvoEvent = /** @class */ (function () {
|
|
213
214
|
* This field contains the W3C Trace Context tracestate header.
|
214
215
|
* @returns The value of the 'tracestate' field, or undefined if not set.
|
215
216
|
*
|
216
|
-
* @
|
217
|
+
* @remarks
|
217
218
|
* This is a convenience getter for the data in `this.extensions.tracestate` as this
|
218
219
|
* is an ArvoEvent object which natively defines this extension on the CloudEvent
|
219
220
|
* spec.
|
@@ -124,13 +124,14 @@ var ArvoEventFactory = /** @class */ (function () {
|
|
124
124
|
var _this = this;
|
125
125
|
var span = OpenTelemetry_1.ArvoCoreTracer.startSpan("ArvoEventFactory<".concat(this.contract.uri, ">.systemError<sys.").concat(this.contract.accepts.type, ".error>.create"));
|
126
126
|
return api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), function () {
|
127
|
+
var _a;
|
127
128
|
span.setStatus({ code: api_1.SpanStatusCode.OK });
|
128
129
|
try {
|
129
130
|
var error = event.error, _events = __rest(event, ["error"]);
|
130
131
|
return (0, helpers_1.createArvoEvent)(__assign(__assign({}, event), { type: "sys.".concat(_this.contract.accepts.type, ".error"), data: {
|
131
132
|
errorName: error.name,
|
132
133
|
errorMessage: error.message,
|
133
|
-
errorStack: error.stack
|
134
|
+
errorStack: (_a = error.stack) !== null && _a !== void 0 ? _a : null,
|
134
135
|
}, datacontenttype: schema_1.ArvoDataContentType, dataschema: _this.contract.uri }), extensions);
|
135
136
|
}
|
136
137
|
catch (error) {
|
@@ -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/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "arvo-core",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.30",
|
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": {
|
@@ -42,7 +42,8 @@
|
|
42
42
|
"ts-node": "^10.9.2",
|
43
43
|
"typedoc": "^0.26.6",
|
44
44
|
"typedoc-plugin-zod": "^1.2.1",
|
45
|
-
"typescript": "^5.5.4"
|
45
|
+
"typescript": "^5.5.4",
|
46
|
+
"typedoc-github-theme": "^0.1.2"
|
46
47
|
},
|
47
48
|
"dependencies": {
|
48
49
|
"@opentelemetry/api": "^1.9.0",
|