arvo-core 1.1.21 → 1.1.22

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.
@@ -4,33 +4,72 @@ import { ArvoOrchestratorVersion, ArvoOrchestrationSubjectContent } from './type
4
4
  */
5
5
  export default class ArvoOrchestrationSubject {
6
6
  /**
7
- * Creates a new Arvo orchestration subject.
7
+ * Represents a wildcard version number used when version matching is not required.
8
+ * Format follows semantic versioning pattern.
9
+ */
10
+ static readonly WildCardMachineVersion: ArvoOrchestratorVersion;
11
+ /**
12
+ * Creates a new Arvo orchestration subject with basic required parameters.
13
+ * This is a convenience method that wraps the more detailed {@link create} method.
14
+ *
15
+ * @param param - Configuration object for the orchestration subject
16
+ * @param param.orchestator - Name identifier of the orchestrator
17
+ * @param param.version - Version of the orchestrator. If null, defaults to {@link WildCardMachineVersion}
18
+ * @param param.initiator - Identifier of the entity initiating the orchestration
19
+ * @returns A base64 encoded string containing the compressed orchestration subject data
20
+ * @throws Error if the provided parameters result in invalid subject content
8
21
  *
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
22
+ * @example
23
+ * ```typescript
24
+ * const subject = ArvoOrchestrationSubject.new({
25
+ * orchestator: "mainProcess",
26
+ * version: "1.0.0",
27
+ * initiator: "systemA"
28
+ * });
29
+ * ```
14
30
  */
15
31
  static new(param: {
16
32
  orchestator: string;
17
- version: ArvoOrchestratorVersion;
33
+ version: ArvoOrchestratorVersion | null;
18
34
  initiator: string;
19
35
  }): string;
20
36
  /**
21
- * Creates an Arvo orchestration subject from the provided content.
37
+ * Creates an Arvo orchestration subject from detailed content parameters.
38
+ * The content is validated, compressed using zlib, and encoded in base64 format.
22
39
  *
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
40
+ * @param param - Detailed orchestration subject content following the {@link ArvoOrchestrationSubjectContent} structure
41
+ * @returns A base64 encoded string containing the compressed orchestration subject data
42
+ * @throws Error if validation fails or compression encounters an error
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * const subject = ArvoOrchestrationSubject.create({
47
+ * orchestrator: {
48
+ * name: "mainProcess",
49
+ * version: "1.0.0"
50
+ * },
51
+ * execution: {
52
+ * id: "550e8400-e29b-41d4-a716-446655440000",
53
+ * initiator: "systemA"
54
+ * }
55
+ * });
56
+ * ```
26
57
  */
27
58
  static create(param: ArvoOrchestrationSubjectContent): string;
28
59
  /**
29
- * Parses a base64 encoded Arvo orchestration subject string.
60
+ * Parses a base64 encoded orchestration subject string back into its structured content form.
61
+ * Performs decompression, JSON parsing, and validation of the subject content.
62
+ *
63
+ * @param subject - Base64 encoded string representing the compressed orchestration subject
64
+ * @returns The decoded and validated {@link ArvoOrchestrationSubjectContent}
65
+ * @throws Error if decompression, parsing, or validation fails
30
66
  *
31
- * @param subject - The base64 encoded subject string to parse
32
- * @returns The parsed ArvoOrchestrationSubjectContent
33
- * @throws Error if parsing or validation fails
67
+ * @example
68
+ * ```typescript
69
+ * const content = ArvoOrchestrationSubject.parse(encodedSubject);
70
+ * console.log(content.orchestrator.name);
71
+ * console.log(content.execution.id);
72
+ * ```
34
73
  */
35
74
  static parse(subject: string): ArvoOrchestrationSubjectContent;
36
75
  }
@@ -34,19 +34,31 @@ var ArvoOrchestrationSubject = /** @class */ (function () {
34
34
  function ArvoOrchestrationSubject() {
35
35
  }
36
36
  /**
37
- * Creates a new Arvo orchestration subject.
37
+ * Creates a new Arvo orchestration subject with basic required parameters.
38
+ * This is a convenience method that wraps the more detailed {@link create} method.
38
39
  *
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
40
+ * @param param - Configuration object for the orchestration subject
41
+ * @param param.orchestator - Name identifier of the orchestrator
42
+ * @param param.version - Version of the orchestrator. If null, defaults to {@link WildCardMachineVersion}
43
+ * @param param.initiator - Identifier of the entity initiating the orchestration
44
+ * @returns A base64 encoded string containing the compressed orchestration subject data
45
+ * @throws Error if the provided parameters result in invalid subject content
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * const subject = ArvoOrchestrationSubject.new({
50
+ * orchestator: "mainProcess",
51
+ * version: "1.0.0",
52
+ * initiator: "systemA"
53
+ * });
54
+ * ```
44
55
  */
45
56
  ArvoOrchestrationSubject.new = function (param) {
57
+ var _a;
46
58
  return ArvoOrchestrationSubject.create({
47
59
  orchestrator: {
48
60
  name: param.orchestator,
49
- version: param.version,
61
+ version: (_a = param.version) !== null && _a !== void 0 ? _a : ArvoOrchestrationSubject.WildCardMachineVersion,
50
62
  },
51
63
  execution: {
52
64
  id: (0, uuid_1.v4)(),
@@ -55,11 +67,26 @@ var ArvoOrchestrationSubject = /** @class */ (function () {
55
67
  });
56
68
  };
57
69
  /**
58
- * Creates an Arvo orchestration subject from the provided content.
70
+ * Creates an Arvo orchestration subject from detailed content parameters.
71
+ * The content is validated, compressed using zlib, and encoded in base64 format.
72
+ *
73
+ * @param param - Detailed orchestration subject content following the {@link ArvoOrchestrationSubjectContent} structure
74
+ * @returns A base64 encoded string containing the compressed orchestration subject data
75
+ * @throws Error if validation fails or compression encounters an error
59
76
  *
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
77
+ * @example
78
+ * ```typescript
79
+ * const subject = ArvoOrchestrationSubject.create({
80
+ * orchestrator: {
81
+ * name: "mainProcess",
82
+ * version: "1.0.0"
83
+ * },
84
+ * execution: {
85
+ * id: "550e8400-e29b-41d4-a716-446655440000",
86
+ * initiator: "systemA"
87
+ * }
88
+ * });
89
+ * ```
63
90
  */
64
91
  ArvoOrchestrationSubject.create = function (param) {
65
92
  try {
@@ -76,11 +103,19 @@ var ArvoOrchestrationSubject = /** @class */ (function () {
76
103
  }
77
104
  };
78
105
  /**
79
- * Parses a base64 encoded Arvo orchestration subject string.
106
+ * Parses a base64 encoded orchestration subject string back into its structured content form.
107
+ * Performs decompression, JSON parsing, and validation of the subject content.
108
+ *
109
+ * @param subject - Base64 encoded string representing the compressed orchestration subject
110
+ * @returns The decoded and validated {@link ArvoOrchestrationSubjectContent}
111
+ * @throws Error if decompression, parsing, or validation fails
80
112
  *
81
- * @param subject - The base64 encoded subject string to parse
82
- * @returns The parsed ArvoOrchestrationSubjectContent
83
- * @throws Error if parsing or validation fails
113
+ * @example
114
+ * ```typescript
115
+ * const content = ArvoOrchestrationSubject.parse(encodedSubject);
116
+ * console.log(content.orchestrator.name);
117
+ * console.log(content.execution.id);
118
+ * ```
84
119
  */
85
120
  ArvoOrchestrationSubject.parse = function (subject) {
86
121
  try {
@@ -97,6 +132,11 @@ var ArvoOrchestrationSubject = /** @class */ (function () {
97
132
  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
133
  }
99
134
  };
135
+ /**
136
+ * Represents a wildcard version number used when version matching is not required.
137
+ * Format follows semantic versioning pattern.
138
+ */
139
+ ArvoOrchestrationSubject.WildCardMachineVersion = '0.0.0';
100
140
  return ArvoOrchestrationSubject;
101
141
  }());
102
142
  exports.default = ArvoOrchestrationSubject;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arvo-core",
3
- "version": "1.1.21",
3
+ "version": "1.1.22",
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": {