arvo-core 1.0.0 → 1.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/CHANGELOG.md CHANGED
@@ -3,3 +3,8 @@
3
3
  ## [1.0.0] - 2024-08-31
4
4
 
5
5
  - Finalised the first release version of the core. This contains core class such as ArvoEvent, ArvoContract, and ArvoContractLibrary. Moreover, this release contains utility functions for string manipulation, validation and OpenTelemetry
6
+
7
+ ## [1.0.2] - 2024-08-31
8
+
9
+ - Update ArvoContract description
10
+
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
+
2
+
1
3
  # Arvo
2
4
 
3
5
  ## What is Arvo
@@ -24,10 +26,32 @@ Whether you're building a small microservice or a large-scale distributed system
24
26
 
25
27
  This core package defines primitive types and utility functions to help you quickly start building interesting and robust event-driven applications.
26
28
 
27
- At its core, Arvo has only two main data structures:
29
+ ## Documentation & Resources
30
+
31
+
32
+ | Source | Link |
33
+ | --------------- | ------------------------
34
+ | Package | https://www.npmjs.com/package/arvo-core?activeTab=readme |
35
+ | Github | https://github.com/SaadAhmad123/arvo-core |
36
+ | Documenation | https://saadahmad123.github.io/arvo-core/index.html |
37
+
38
+
39
+ ## Installation
40
+
41
+ You can install the core package via `npm` or `yarn`
42
+
43
+ ```bash
44
+ npm install arvo-core
45
+ ```
46
+ ```bash
47
+ yarn add arvo-core
48
+ ```
49
+
28
50
 
29
51
  ## Components
30
52
 
53
+ At its core, Arvo has only three main data structures:
54
+
31
55
  - [ArvoEvent](src/ArvoEvent/README.md) aims to provide a extendible variant of the open-source CloudEvent spec-ed object to define all the event in the system.
32
56
  - [ArvoContract](src/ArvoContract/README.md) is a basic class to define and impose contracts between services, ensuring trust in decoupled systems during build and development.
33
57
  - [ArvoContractLibrary](src/ArvoContractLibrary/README.md) is a utility class designed to manage and access multiple ArvoContract instances efficiently.
@@ -36,13 +60,24 @@ At its core, Arvo has only two main data structures:
36
60
 
37
61
  The package also includes utility functions for:
38
62
 
39
- - Creating ArvoEvents
63
+ - Creating ArvoEvents, ArvoContracts, and contract libraries
40
64
  - Integrating with OpenTelemetry
41
65
  - TypeScript types for core components
42
66
 
67
+ ## Getting Started
68
+
69
+ To start using Arvo in your project:
70
+
71
+ - Install the package as shown in the Installation section.
72
+ - Import the necessary components:
73
+ ```javascript
74
+ import { createArvoEvent, createArvoContract, createArvoContractLibrary } from 'arvo-core';
75
+ ```
76
+ - Begin defining your events and contracts using the provided classes.
77
+
43
78
  ## License
44
79
 
45
80
  This package is available under the MIT License. For more details, refer to the [LICENSE.md](LICENSE.md) file in the project repository.
46
81
 
47
82
  ## Change Logs
48
- See the package change logs [here](CHANGELOG.md).
83
+ For a detailed list of changes and updates, please refer to the [document](CHANGELOG.md) file.
@@ -19,17 +19,27 @@ 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
+ /** (Optional) The Contract description */
22
23
  readonly description: string | null;
23
24
  /**
24
25
  * Creates an instance of ArvoContract.
25
26
  * @param {IArvoContract<T, TAccepts, TEmits>} params - The contract parameters.
26
27
  */
27
28
  constructor(params: IArvoContract<T, TAccepts, TEmits>);
29
+ /**
30
+ * Gets the URI of the contract.
31
+ * @returns {T} The contract's URI.
32
+ */
28
33
  get uri(): T;
34
+ /**
35
+ * Gets the accepted record type and schema.
36
+ * @returns {Readonly<TAccepts>} The frozen accepts object.
37
+ */
29
38
  get accepts(): TAccepts;
30
39
  /**
31
40
  * Gets all emitted event types and schemas as a readonly record.
32
41
  * Use this when you need to access all emitted events at once.
42
+ * @returns {Readonly<Record<ExtractEventType<TEmits>, TEmits>>} A frozen record of all emitted events.
33
43
  */
34
44
  get emits(): Record<ExtractEventType<TEmits>, TEmits>;
35
45
  /**
@@ -89,7 +99,7 @@ export default class ArvoContract<T extends string = string, TAccepts extends Ar
89
99
  * This method provides a way to represent the contract's structure and validation rules
90
100
  * in a format that conforms to the JSON Schema specification.
91
101
  *
92
- * @returns An object representing the contract in JSON Schema format, including:
102
+ * @returns {Object} An object representing the contract in JSON Schema format, including:
93
103
  * - uri: The contract's URI
94
104
  * - description: The contract's description (if available)
95
105
  * - accepts: An object containing the accepted input type and its JSON Schema representation
@@ -24,6 +24,10 @@ var ArvoContract = /** @class */ (function () {
24
24
  Object.freeze(this);
25
25
  }
26
26
  Object.defineProperty(ArvoContract.prototype, "uri", {
27
+ /**
28
+ * Gets the URI of the contract.
29
+ * @returns {T} The contract's URI.
30
+ */
27
31
  get: function () {
28
32
  return this._uri;
29
33
  },
@@ -31,6 +35,10 @@ var ArvoContract = /** @class */ (function () {
31
35
  configurable: true
32
36
  });
33
37
  Object.defineProperty(ArvoContract.prototype, "accepts", {
38
+ /**
39
+ * Gets the accepted record type and schema.
40
+ * @returns {Readonly<TAccepts>} The frozen accepts object.
41
+ */
34
42
  get: function () {
35
43
  return Object.freeze(this._accepts);
36
44
  },
@@ -41,6 +49,7 @@ var ArvoContract = /** @class */ (function () {
41
49
  /**
42
50
  * Gets all emitted event types and schemas as a readonly record.
43
51
  * Use this when you need to access all emitted events at once.
52
+ * @returns {Readonly<Record<ExtractEventType<TEmits>, TEmits>>} A frozen record of all emitted events.
44
53
  */
45
54
  get: function () {
46
55
  return Object.freeze(this._emits.reduce(function (acc, emit) {
@@ -145,7 +154,7 @@ var ArvoContract = /** @class */ (function () {
145
154
  * This method provides a way to represent the contract's structure and validation rules
146
155
  * in a format that conforms to the JSON Schema specification.
147
156
  *
148
- * @returns An object representing the contract in JSON Schema format, including:
157
+ * @returns {Object} An object representing the contract in JSON Schema format, including:
149
158
  * - uri: The contract's URI
150
159
  * - description: The contract's description (if available)
151
160
  * - accepts: An object containing the accepted input type and its JSON Schema representation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arvo-core",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
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": {