arvo-core 1.1.22 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/ArvoOrchestrationSubject/index.d.ts +52 -0
- package/dist/ArvoOrchestrationSubject/index.js +68 -1
- package/dist/ArvoOrchestrationSubject/schema.d.ts +3 -0
- package/dist/ArvoOrchestrationSubject/schema.js +4 -0
- package/dist/ArvoOrchestrationSubject/type.d.ts +6 -0
- package/package.json +1 -1
@@ -16,6 +16,7 @@ export default class ArvoOrchestrationSubject {
|
|
16
16
|
* @param param.orchestator - Name identifier of the orchestrator
|
17
17
|
* @param param.version - Version of the orchestrator. If null, defaults to {@link WildCardMachineVersion}
|
18
18
|
* @param param.initiator - Identifier of the entity initiating the orchestration
|
19
|
+
* @param param.meta - Optional metadata key-value pairs for additional orchestration context
|
19
20
|
* @returns A base64 encoded string containing the compressed orchestration subject data
|
20
21
|
* @throws Error if the provided parameters result in invalid subject content
|
21
22
|
*
|
@@ -26,12 +27,63 @@ export default class ArvoOrchestrationSubject {
|
|
26
27
|
* version: "1.0.0",
|
27
28
|
* initiator: "systemA"
|
28
29
|
* });
|
30
|
+
*
|
31
|
+
* // With metadata
|
32
|
+
* const subjectWithMeta = ArvoOrchestrationSubject.new({
|
33
|
+
* orchestator: "com.company.mainProcess",
|
34
|
+
* version: "1.0.0",
|
35
|
+
* initiator: "com.company.systemA",
|
36
|
+
* meta: {
|
37
|
+
* priority: "high",
|
38
|
+
* environment: "production"
|
39
|
+
* }
|
40
|
+
* });
|
29
41
|
* ```
|
30
42
|
*/
|
31
43
|
static new(param: {
|
32
44
|
orchestator: string;
|
33
45
|
version: ArvoOrchestratorVersion | null;
|
34
46
|
initiator: string;
|
47
|
+
meta?: Record<string, string>;
|
48
|
+
}): string;
|
49
|
+
/**
|
50
|
+
* Creates a new orchestration subject string from an existing parent subject.
|
51
|
+
* This method parses the parent subject, merges its metadata with new metadata (if available),
|
52
|
+
* and creates a new subject with updated orchestrator information while maintaining
|
53
|
+
* the relationship to the parent context.
|
54
|
+
*
|
55
|
+
* @param param - Configuration object for creating a new subject from a parent
|
56
|
+
* @param param.orchestator - Name identifier of the new orchestrator
|
57
|
+
* @param param.version - Version of the new orchestrator. If null, defaults to {@link WildCardMachineVersion}
|
58
|
+
* @param param.subject - Base64 encoded string of the parent orchestration subject
|
59
|
+
* @param param.meta - Optional additional metadata to merge with the parent's metadata
|
60
|
+
* @returns A new base64 encoded string containing the compressed orchestration subject data
|
61
|
+
* @throws Error if the parent subject is invalid or if the new parameters result in invalid subject content
|
62
|
+
*
|
63
|
+
* @example
|
64
|
+
* ```typescript
|
65
|
+
* // Create a parent subject
|
66
|
+
* const parentSubject = ArvoOrchestrationSubject.new({
|
67
|
+
* orchestator: "parentProcess",
|
68
|
+
* version: "1.0.0",
|
69
|
+
* initiator: "systemA",
|
70
|
+
* meta: { environment: "production" }
|
71
|
+
* });
|
72
|
+
*
|
73
|
+
* // Create a new subject from the parent
|
74
|
+
* const childSubject = ArvoOrchestrationSubject.from({
|
75
|
+
* orchestator: "childProcess",
|
76
|
+
* version: "2.0.0",
|
77
|
+
* subject: parentSubject,
|
78
|
+
* meta: { step: "processing" } // Will be merged with parent's metadata
|
79
|
+
* });
|
80
|
+
* ```
|
81
|
+
*/
|
82
|
+
static from(param: {
|
83
|
+
orchestator: string;
|
84
|
+
version: ArvoOrchestratorVersion | null;
|
85
|
+
subject: string;
|
86
|
+
meta?: Record<string, string>;
|
35
87
|
}): string;
|
36
88
|
/**
|
37
89
|
* Creates an Arvo orchestration subject from detailed content parameters.
|
@@ -1,4 +1,15 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
3
|
+
__assign = Object.assign || function(t) {
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5
|
+
s = arguments[i];
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7
|
+
t[p] = s[p];
|
8
|
+
}
|
9
|
+
return t;
|
10
|
+
};
|
11
|
+
return __assign.apply(this, arguments);
|
12
|
+
};
|
2
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
14
|
if (k2 === undefined) k2 = k;
|
4
15
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
@@ -41,6 +52,7 @@ var ArvoOrchestrationSubject = /** @class */ (function () {
|
|
41
52
|
* @param param.orchestator - Name identifier of the orchestrator
|
42
53
|
* @param param.version - Version of the orchestrator. If null, defaults to {@link WildCardMachineVersion}
|
43
54
|
* @param param.initiator - Identifier of the entity initiating the orchestration
|
55
|
+
* @param param.meta - Optional metadata key-value pairs for additional orchestration context
|
44
56
|
* @returns A base64 encoded string containing the compressed orchestration subject data
|
45
57
|
* @throws Error if the provided parameters result in invalid subject content
|
46
58
|
*
|
@@ -51,10 +63,21 @@ var ArvoOrchestrationSubject = /** @class */ (function () {
|
|
51
63
|
* version: "1.0.0",
|
52
64
|
* initiator: "systemA"
|
53
65
|
* });
|
66
|
+
*
|
67
|
+
* // With metadata
|
68
|
+
* const subjectWithMeta = ArvoOrchestrationSubject.new({
|
69
|
+
* orchestator: "com.company.mainProcess",
|
70
|
+
* version: "1.0.0",
|
71
|
+
* initiator: "com.company.systemA",
|
72
|
+
* meta: {
|
73
|
+
* priority: "high",
|
74
|
+
* environment: "production"
|
75
|
+
* }
|
76
|
+
* });
|
54
77
|
* ```
|
55
78
|
*/
|
56
79
|
ArvoOrchestrationSubject.new = function (param) {
|
57
|
-
var _a;
|
80
|
+
var _a, _b;
|
58
81
|
return ArvoOrchestrationSubject.create({
|
59
82
|
orchestrator: {
|
60
83
|
name: param.orchestator,
|
@@ -64,6 +87,50 @@ var ArvoOrchestrationSubject = /** @class */ (function () {
|
|
64
87
|
id: (0, uuid_1.v4)(),
|
65
88
|
initiator: param.initiator,
|
66
89
|
},
|
90
|
+
meta: (_b = param.meta) !== null && _b !== void 0 ? _b : {}
|
91
|
+
});
|
92
|
+
};
|
93
|
+
/**
|
94
|
+
* Creates a new orchestration subject string from an existing parent subject.
|
95
|
+
* This method parses the parent subject, merges its metadata with new metadata (if available),
|
96
|
+
* and creates a new subject with updated orchestrator information while maintaining
|
97
|
+
* the relationship to the parent context.
|
98
|
+
*
|
99
|
+
* @param param - Configuration object for creating a new subject from a parent
|
100
|
+
* @param param.orchestator - Name identifier of the new orchestrator
|
101
|
+
* @param param.version - Version of the new orchestrator. If null, defaults to {@link WildCardMachineVersion}
|
102
|
+
* @param param.subject - Base64 encoded string of the parent orchestration subject
|
103
|
+
* @param param.meta - Optional additional metadata to merge with the parent's metadata
|
104
|
+
* @returns A new base64 encoded string containing the compressed orchestration subject data
|
105
|
+
* @throws Error if the parent subject is invalid or if the new parameters result in invalid subject content
|
106
|
+
*
|
107
|
+
* @example
|
108
|
+
* ```typescript
|
109
|
+
* // Create a parent subject
|
110
|
+
* const parentSubject = ArvoOrchestrationSubject.new({
|
111
|
+
* orchestator: "parentProcess",
|
112
|
+
* version: "1.0.0",
|
113
|
+
* initiator: "systemA",
|
114
|
+
* meta: { environment: "production" }
|
115
|
+
* });
|
116
|
+
*
|
117
|
+
* // Create a new subject from the parent
|
118
|
+
* const childSubject = ArvoOrchestrationSubject.from({
|
119
|
+
* orchestator: "childProcess",
|
120
|
+
* version: "2.0.0",
|
121
|
+
* subject: parentSubject,
|
122
|
+
* meta: { step: "processing" } // Will be merged with parent's metadata
|
123
|
+
* });
|
124
|
+
* ```
|
125
|
+
*/
|
126
|
+
ArvoOrchestrationSubject.from = function (param) {
|
127
|
+
var _a, _b, _c;
|
128
|
+
var parsedSubject = ArvoOrchestrationSubject.parse(param.subject);
|
129
|
+
return ArvoOrchestrationSubject.new({
|
130
|
+
initiator: parsedSubject.orchestrator.name,
|
131
|
+
version: (_a = param.version) !== null && _a !== void 0 ? _a : ArvoOrchestrationSubject.WildCardMachineVersion,
|
132
|
+
orchestator: param.orchestator,
|
133
|
+
meta: __assign(__assign({}, ((_b = parsedSubject.meta) !== null && _b !== void 0 ? _b : {})), ((_c = param.meta) !== null && _c !== void 0 ? _c : {}))
|
67
134
|
});
|
68
135
|
};
|
69
136
|
/**
|
@@ -21,6 +21,7 @@ export declare const ArvoOrchestrationSubjectContentSchema: z.ZodObject<{
|
|
21
21
|
id: string;
|
22
22
|
initiator: string;
|
23
23
|
}>;
|
24
|
+
meta: z.ZodRecord<z.ZodString, z.ZodString>;
|
24
25
|
}, "strip", z.ZodTypeAny, {
|
25
26
|
orchestrator: {
|
26
27
|
name: string;
|
@@ -30,6 +31,7 @@ export declare const ArvoOrchestrationSubjectContentSchema: z.ZodObject<{
|
|
30
31
|
id: string;
|
31
32
|
initiator: string;
|
32
33
|
};
|
34
|
+
meta: Record<string, string>;
|
33
35
|
}, {
|
34
36
|
orchestrator: {
|
35
37
|
name: string;
|
@@ -39,4 +41,5 @@ export declare const ArvoOrchestrationSubjectContentSchema: z.ZodObject<{
|
|
39
41
|
id: string;
|
40
42
|
initiator: string;
|
41
43
|
};
|
44
|
+
meta: Record<string, string>;
|
42
45
|
}>;
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.ArvoOrchestrationSubjectContentSchema = exports.ArvoOrchestratorVersionSchema = void 0;
|
4
4
|
var zod_1 = require("zod");
|
5
|
+
var utils_1 = require("../utils");
|
5
6
|
// Zod schema for ArvoOchestratorVersion
|
6
7
|
exports.ArvoOrchestratorVersionSchema = zod_1.z
|
7
8
|
.string()
|
@@ -35,5 +36,8 @@ exports.ArvoOrchestrationSubjectContentSchema = zod_1.z
|
|
35
36
|
.describe('Entity or process that initiated the execution'),
|
36
37
|
})
|
37
38
|
.describe('Details about the current execution'),
|
39
|
+
meta: zod_1.z
|
40
|
+
.record(zod_1.z.string(), zod_1.z.string())
|
41
|
+
.describe((0, utils_1.cleanString)("\n Additional metadata for the orchestration process. Store essential key-value pairs \n that provide context or configuration details necessary for the orchestration. \n Use selectively to maintain clarity and avoid storing unnecessary information. \n "))
|
38
42
|
})
|
39
43
|
.describe('Context information for Arvo orchestration');
|
@@ -62,4 +62,10 @@ export type ArvoOrchestrationSubjectContent = {
|
|
62
62
|
*/
|
63
63
|
initiator: string;
|
64
64
|
};
|
65
|
+
/**
|
66
|
+
* Additional metadata for the orchestration process. Store essential key-value pairs
|
67
|
+
* that provide context or configuration details necessary for the orchestration.
|
68
|
+
* Use selectively to maintain clarity and avoid storing unnecessary information.
|
69
|
+
*/
|
70
|
+
meta: Record<string, string>;
|
65
71
|
};
|