arvo-core 3.0.19 → 3.0.21
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/.nvmrc +1 -0
- package/Dockerfile +7 -0
- package/Dockerfile.install +23 -0
- package/Dockerfile.test +7 -0
- package/README.md +34 -151
- package/dist/ArvoContract/VersionedArvoContract/index.js +4 -7
- package/dist/ArvoContract/VersionedArvoContract/types.d.ts +1 -1
- package/justfile +126 -0
- package/package.json +50 -31
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v20.17.0
|
package/Dockerfile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
ARG NODE_VERSION=18
|
|
2
|
+
FROM node:${NODE_VERSION}-alpine
|
|
3
|
+
|
|
4
|
+
RUN npm install -g @aikidosec/safe-chain
|
|
5
|
+
RUN safe-chain setup-ci
|
|
6
|
+
|
|
7
|
+
WORKDIR /install
|
|
8
|
+
COPY package*.json ./
|
|
9
|
+
COPY .npmrc ./
|
|
10
|
+
|
|
11
|
+
# Build arguments for optional package installation
|
|
12
|
+
ARG PACKAGES=""
|
|
13
|
+
ARG DEV=""
|
|
14
|
+
|
|
15
|
+
# Install dependencies in isolation
|
|
16
|
+
# Lifecycle scripts can run but have no access to host secrets
|
|
17
|
+
# If PACKAGES specified: install those specific packages
|
|
18
|
+
# Otherwise: install all dependencies from package.json
|
|
19
|
+
RUN if [ -n "$PACKAGES" ]; then \
|
|
20
|
+
[ "$DEV" = "true" ] && npm install -D $PACKAGES || npm install $PACKAGES; \
|
|
21
|
+
else \
|
|
22
|
+
npm install; \
|
|
23
|
+
fi
|
package/Dockerfile.test
ADDED
package/README.md
CHANGED
|
@@ -1,199 +1,83 @@
|
|
|
1
1
|
[](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
|
2
2
|
[](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
|
3
3
|
|
|
4
|
+
# Arvo - A toolkit for event driven application (arvo-core)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
In the landscape of event-driven systems, Arvo attempts to stand apart through its unique approach to complexity. Rather than prescribing rigid solutions, Arvo provides a thoughtful pattern language and methodology for building distributed systems. It achieves this by striking a careful balance between structure and freedom, offering strong conventions while remaining deliberately unopinionated about implementation details.
|
|
6
|
+
The foundational package of, Arvo, a TypeScript toolkit for building event-driven applications that are distributed system-compliant. Arvo Core provides CloudEvents-compliant event primitives, type-safe contract validation, and OpenTelemetry observability without infrastructure lock-in.
|
|
7
7
|
|
|
8
|
-
## Core
|
|
9
|
-
Arvo's fundamental principle is that distributed systems thrive on trust and clear contracts, yet must remain flexible in their technical implementation. While the framework ensures reliability and type safety across service boundaries through these contracts, it consciously avoids dictating how you should implement core functionalities like security, event brokerage, event handling, telemetry, or workflow orchestration. This approach enables seamless integration with your existing infrastructure and tools, whether you're using cloud providers like AWS and Azure or your own on-premise solutions.
|
|
10
|
-
Understanding that teams shouldn't need to reinvent common patterns, Arvo provides thoughtfully designed tools to reduce implementation complexity. The Arvo suite includes libraries like arvo-xstate for workflow orchestration using state machines and arvo-event-handler for implementing contract-based event handlers. However, these tools remain entirely optional – they exist to accelerate development when they align with your needs, but Arvo fully supports teams who choose different approaches that better suit their specific requirements.
|
|
11
|
-
This philosophy particularly benefits teams focusing on business logic who want to avoid rebuilding fundamental event-driven patterns. By providing essential building blocks for event creation, contract validation, state management, and telemetry, while maintaining cloud agnosticism and extensibility, Arvo reduces the complexity of distributed system development without constraining technical choices.
|
|
8
|
+
## What is Arvo Core?
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
Arvo addresses the inherent complexity of distributed systems by establishing clear patterns for event handling, state management, and service communication. Instead of enforcing a rigid framework, it provides a flexible foundation that helps teams reduce cognitive load while preserving their ability to innovate and adapt. This approach ensures that whether you're building a small microservice or orchestrating a large-scale distributed system, Arvo's lightweight core and extensible architecture can grow alongside your needs, allowing you to progressively adopt more sophisticated patterns as your system evolves.
|
|
10
|
+
Arvo Core gives you three essential building blocks for event-driven architecture:
|
|
15
11
|
|
|
12
|
+
**ArvoEvent** - CloudEvents-compliant event primitives with built-in validation, tracing, and execution cost tracking.
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
The Arvo framework provides a cohesive set of libraries for building event-driven systems. While designed to work together seamlessly, each component remains independent - adopt what serves your needs and integrate at your own pace.
|
|
14
|
+
**ArvoContract** - Type-safe service interfaces with semantic versioning. Define what events your services accept and emit with automatic runtime validation and compile-time type inference.
|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
| ------------ | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- |
|
|
22
|
-
| Orchestration | https://www.npmjs.com/package/arvo-xstate?activeTab=readme | https://github.com/SaadAhmad123/arvo-xstate | https://saadahmad123.github.io/arvo-xstate/index.html |
|
|
23
|
-
| Core | https://www.npmjs.com/package/arvo-core?activeTab=readme | https://github.com/SaadAhmad123/arvo-core | https://saadahmad123.github.io/arvo-core/index.html |
|
|
24
|
-
| Event Handling | https://www.npmjs.com/package/arvo-event-handler?activeTab=readme | https://github.com/SaadAhmad123/arvo-event-handler | https://saadahmad123.github.io/arvo-event-handler/index.html |
|
|
16
|
+
**ArvoEventFactory** - Contract-bound factories that create validated events with full IntelliSense support and OpenTelemetry integration.
|
|
25
17
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Arvo Core provides the foundational building blocks for creating robust event-driven systems. It implements industry standards while adding enterprise-grade features, enabling developers to build reliable distributed systems without sacrificing flexibility or introducing vendor lock-in.
|
|
30
|
-
|
|
31
|
-
## Core Concepts
|
|
32
|
-
|
|
33
|
-
Understanding Arvo Core begins with its three fundamental components that work together to create a robust event-driven architecture:
|
|
34
|
-
|
|
35
|
-
### 1. Events (ArvoEvent)
|
|
36
|
-
|
|
37
|
-
ArvoEvent extends the CloudEvents specification to provide a standardized way to describe events in your system. Every event is an immutable, validated instance that includes:
|
|
38
|
-
|
|
39
|
-
```typescript
|
|
40
|
-
import { createArvoEvent } from 'arvo-core';
|
|
41
|
-
|
|
42
|
-
const event = createArvoEvent({
|
|
43
|
-
source: 'user-service',
|
|
44
|
-
type: 'user.created',
|
|
45
|
-
subject: 'user/123',
|
|
46
|
-
data: {
|
|
47
|
-
userId: 'usr_123',
|
|
48
|
-
email: 'user@example.com'
|
|
49
|
-
}
|
|
50
|
-
});
|
|
18
|
+
## Installation
|
|
19
|
+
```bash
|
|
20
|
+
npm install arvo-core zod@3
|
|
51
21
|
```
|
|
52
22
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
ArvoContract defines and enforces agreements between services, ensuring type safety and validation across your distributed system:
|
|
56
|
-
|
|
23
|
+
## Quick Start
|
|
57
24
|
```typescript
|
|
58
|
-
import { createArvoContract,
|
|
25
|
+
import { createArvoContract, createArvoEventFactory } from 'arvo-core';
|
|
26
|
+
import { z } from 'zod';
|
|
59
27
|
|
|
28
|
+
// Define a contract
|
|
60
29
|
const userContract = createArvoContract({
|
|
61
30
|
uri: '#/contracts/user',
|
|
62
|
-
type: 'user.
|
|
31
|
+
type: 'user.create',
|
|
63
32
|
versions: {
|
|
64
33
|
'1.0.0': {
|
|
65
34
|
accepts: z.object({
|
|
66
|
-
|
|
67
|
-
|
|
35
|
+
email: z.string().email(),
|
|
36
|
+
name: z.string()
|
|
68
37
|
}),
|
|
69
38
|
emits: {
|
|
70
|
-
'user.
|
|
39
|
+
'evt.user.create.success': z.object({
|
|
71
40
|
userId: z.string(),
|
|
72
|
-
timestamp: z.
|
|
41
|
+
timestamp: z.string()
|
|
73
42
|
})
|
|
74
43
|
}
|
|
75
44
|
}
|
|
76
45
|
}
|
|
77
46
|
});
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### 3. Event Factory (ArvoEventFactory)
|
|
81
|
-
|
|
82
|
-
ArvoEventFactory provides a type-safe way to create events that conform to your contracts. It handles validation, OpenTelemetry integration, and ensures events meet their contract specifications:
|
|
83
47
|
|
|
84
|
-
|
|
85
|
-
import { createArvoEventFactory } from 'arvo-core';
|
|
86
|
-
|
|
87
|
-
// Create a factory for a specific contract version
|
|
48
|
+
// Create events with type safety
|
|
88
49
|
const factory = createArvoEventFactory(userContract.version('1.0.0'));
|
|
89
50
|
|
|
90
|
-
|
|
91
|
-
const inputEvent = factory.accepts({
|
|
51
|
+
const event = factory.accepts({
|
|
92
52
|
source: 'api/users',
|
|
93
|
-
subject: 'user/creation',
|
|
94
|
-
data: {
|
|
95
|
-
userId: 'usr_123',
|
|
96
|
-
email: 'user@example.com'
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// Create an event that emits output
|
|
101
|
-
const outputEvent = factory.emits({
|
|
102
|
-
type: 'user.notification.sent',
|
|
103
|
-
source: 'notification-service',
|
|
104
|
-
subject: 'notification/sent',
|
|
105
53
|
data: {
|
|
106
|
-
|
|
107
|
-
|
|
54
|
+
email: 'user@example.com',
|
|
55
|
+
name: 'John Doe'
|
|
108
56
|
}
|
|
109
57
|
});
|
|
110
|
-
|
|
111
|
-
// Create a system error event
|
|
112
|
-
const errorEvent = factory.systemError({
|
|
113
|
-
error: new Error('Validation failed'),
|
|
114
|
-
source: 'validation-service',
|
|
115
|
-
subject: 'validation/error'
|
|
116
|
-
});
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## Installation
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
# Using npm
|
|
123
|
-
npm install arvo-core
|
|
124
|
-
|
|
125
|
-
# Using yarn
|
|
126
|
-
yarn add arvo-core
|
|
127
58
|
```
|
|
128
59
|
|
|
129
|
-
##
|
|
130
|
-
|
|
131
|
-
### Working with Contract Versions
|
|
132
|
-
|
|
133
|
-
The versioning system in ArvoContract allows you to evolve your APIs while maintaining compatibility:
|
|
134
|
-
|
|
135
|
-
```typescript
|
|
136
|
-
const versionedContract = createArvoContract({
|
|
137
|
-
uri: '#/contracts/order',
|
|
138
|
-
type: 'order.process',
|
|
139
|
-
versions: {
|
|
140
|
-
'1.0.0': {
|
|
141
|
-
accepts: z.object({ orderId: z.string() }),
|
|
142
|
-
emits: {
|
|
143
|
-
'order.processed': z.object({ status: z.string() })
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
'2.0.0': {
|
|
147
|
-
accepts: z.object({
|
|
148
|
-
orderId: z.string(),
|
|
149
|
-
metadata: z.record(z.string())
|
|
150
|
-
}),
|
|
151
|
-
emits: {
|
|
152
|
-
'order.processed': z.object({
|
|
153
|
-
status: z.string(),
|
|
154
|
-
metrics: z.object({ duration: z.number() })
|
|
155
|
-
})
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
// Create version-specific factories
|
|
162
|
-
const v1Factory = createArvoEventFactory(versionedContract.version('1.0.0'));
|
|
163
|
-
const v2Factory = createArvoEventFactory(versionedContract.version('2.0.0'));
|
|
164
|
-
```
|
|
60
|
+
## Why Arvo?
|
|
165
61
|
|
|
166
|
-
|
|
62
|
+
Arvo abstracts infrastructure concerns from your business logic. Write application code once and deploy it anywhere - Node.js servers, serverless functions, browsers, or distributed clusters. Your business logic encapsulated in event handlers and contracts remain unchanged while you swap infrastructure integrations.
|
|
167
63
|
|
|
168
|
-
|
|
169
|
-
- arvo-event-handler: For processing events
|
|
170
|
-
- arvo-xstate: For orchestration and workflow management
|
|
64
|
+
The same primitives work for simple request-response services, complex multi-service workflows, AI agent systems, and everything in between. No framework lock-in, no mandatory infrastructure, just clean event-driven code that integrates with your existing stack.
|
|
171
65
|
|
|
172
|
-
|
|
66
|
+
## What is `arvo-core`?
|
|
173
67
|
|
|
174
|
-
|
|
68
|
+
The `arvo-core` is one of the two foundational packages in the Arvo ecosystem, alongside `arvo-event-handler`. Together, they provide the complete foundation for building event-driven applications that are distributed system-compliant. Explore additional tools and integrations in the `@arvo-tools` namespace.
|
|
175
69
|
|
|
176
|
-
|
|
177
|
-
2. Implement proper error handling using the standard error schema
|
|
178
|
-
3. Enable distributed tracing in production systems
|
|
179
|
-
4. Share contracts as separate packages or monorepo internals
|
|
180
|
-
5. Utilize version-specific factories for different API versions
|
|
70
|
+
Learn more at the official Arvo website: [https://www.arvo.land/](https://www.arvo.land/)
|
|
181
71
|
|
|
182
|
-
##
|
|
72
|
+
## Documentation
|
|
183
73
|
|
|
184
|
-
|
|
185
|
-
|--------------|-------------------------------------------------------------|
|
|
186
|
-
| Documentation | https://saadahmad123.github.io/arvo-core/index.html |
|
|
187
|
-
| GitHub | https://github.com/SaadAhmad123/arvo-core |
|
|
188
|
-
| NPM Package | https://www.npmjs.com/package/arvo-core |
|
|
74
|
+
Complete guides, API reference, and tutorials at [https://www.arvo.land/](https://www.arvo.land/)
|
|
189
75
|
|
|
190
76
|
## License
|
|
191
77
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
## Change Logs
|
|
78
|
+
MIT - See [LICENSE.md](LICENSE.md)
|
|
195
79
|
|
|
196
|
-
|
|
80
|
+
---
|
|
197
81
|
|
|
198
82
|
### SonarCloud Metrics
|
|
199
83
|
|
|
@@ -207,5 +91,4 @@ For a detailed list of changes and updates, please refer to the [document](CHANG
|
|
|
207
91
|
[](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
|
208
92
|
[](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
|
209
93
|
[](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
|
210
|
-
[](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
|
211
|
-
|
|
94
|
+
[](https://sonarcloud.io/summary/new_code?id=SaadAhmad123_arvo-core)
|
|
@@ -10,12 +10,9 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
14
|
exports.VersionedArvoContract = void 0;
|
|
18
|
-
var zod_to_json_schema_1 =
|
|
15
|
+
var zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
19
16
|
var OpenTelemetry_1 = require("../../OpenTelemetry");
|
|
20
17
|
var utils_1 = require("../../utils");
|
|
21
18
|
var WildCardArvoSemanticVersion_1 = require("../WildCardArvoSemanticVersion");
|
|
@@ -119,17 +116,17 @@ var VersionedArvoContract = /** @class */ (function () {
|
|
|
119
116
|
metadata: this.metadata,
|
|
120
117
|
accepts: {
|
|
121
118
|
type: this._accepts.type,
|
|
122
|
-
schema: (0, zod_to_json_schema_1.
|
|
119
|
+
schema: (0, zod_to_json_schema_1.zodToJsonSchema)(this._accepts.schema),
|
|
123
120
|
},
|
|
124
121
|
systemError: {
|
|
125
122
|
type: this.systemError.type,
|
|
126
|
-
schema: (0, zod_to_json_schema_1.
|
|
123
|
+
schema: (0, zod_to_json_schema_1.zodToJsonSchema)(this.systemError.schema),
|
|
127
124
|
},
|
|
128
125
|
emits: Object.entries(this._emits).map(function (_a) {
|
|
129
126
|
var key = _a[0], value = _a[1];
|
|
130
127
|
return ({
|
|
131
128
|
type: key,
|
|
132
|
-
schema: (0, zod_to_json_schema_1.
|
|
129
|
+
schema: (0, zod_to_json_schema_1.zodToJsonSchema)(value),
|
|
133
130
|
});
|
|
134
131
|
}),
|
|
135
132
|
};
|
package/justfile
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Docker-Isolated NPM Development Environment
|
|
2
|
+
#
|
|
3
|
+
# This justfile provides Docker-based sandbox isolation for npm operations to protect against
|
|
4
|
+
# supply chain attacks during local development on local machine. All npm operations
|
|
5
|
+
# run in ephemeral containers with no access to your host filesystem, environment
|
|
6
|
+
# variables, or secrets.
|
|
7
|
+
#
|
|
8
|
+
# WHAT THIS PROTECTS AGAINST:
|
|
9
|
+
# - Malicious install scripts stealing SSH keys, AWS credentials, or other secrets
|
|
10
|
+
# - Package typosquatting attacks that exfiltrate local environment variables
|
|
11
|
+
# - Compromised packages accessing your home directory during installation
|
|
12
|
+
# - Supply chain attacks that attempt to modify files outside node_modules
|
|
13
|
+
# - Malicious code execution during build and test phases (runs in isolated containers)
|
|
14
|
+
#
|
|
15
|
+
# WHAT THIS DOESN'T PROTECT AGAINST:
|
|
16
|
+
# - Malicious code in package runtime logic when you actually run your application
|
|
17
|
+
# - Sophisticated obfuscated malware that bypasses basic pattern detection
|
|
18
|
+
# - Attacks that only activate in production environments
|
|
19
|
+
#
|
|
20
|
+
# **Disclaimer:** This does not gate against malware in node_modules or in your code
|
|
21
|
+
# (you need to update the Docker.install to add that gate as per your requirments
|
|
22
|
+
# - if you need one). Rather, its scope is **strictly limited** to attempting to protect
|
|
23
|
+
# the host device from exposure if the malware gets excuted.
|
|
24
|
+
#
|
|
25
|
+
# HOW IT WORKS:
|
|
26
|
+
# INSTALL PHASE:
|
|
27
|
+
# 1. npm install runs inside a clean Docker container with no volume mounts
|
|
28
|
+
# 2. Basic placeholder malware detection (so the you can add more complex methods if you want) scans run after installation completes
|
|
29
|
+
# 3. Only node_modules and package files are extracted back to your host
|
|
30
|
+
# 4. Container is destroyed, leaving no trace of potentially malicious install scripts
|
|
31
|
+
#
|
|
32
|
+
# BUILD PHASE:
|
|
33
|
+
# 1. Source code and dependencies are copied into a fresh container
|
|
34
|
+
# 2. Build process (TypeScript compilation, bundling, etc.) runs isolated
|
|
35
|
+
# 3. Only the compiled output (dist/) is extracted back to host
|
|
36
|
+
# 4. Any malicious code that tries to run during build is contained
|
|
37
|
+
#
|
|
38
|
+
# TEST PHASE:
|
|
39
|
+
# 1. Tests run in an isolated container with optional .env file mounting
|
|
40
|
+
# 2. Test dependencies can't access your host system during execution
|
|
41
|
+
# 3. Container is destroyed after tests complete
|
|
42
|
+
# 4. Secrets in .env are passed at runtime, never baked into image layers
|
|
43
|
+
#
|
|
44
|
+
# USAGE:
|
|
45
|
+
# just install # Install all dependencies from package.json
|
|
46
|
+
# just install <package> # Install specific package(s)
|
|
47
|
+
# just install-dev <package> # Install as dev dependency
|
|
48
|
+
# just test # Run tests in isolated container
|
|
49
|
+
# just build # Build project in isolated container
|
|
50
|
+
# just clean # Remove node_modules
|
|
51
|
+
|
|
52
|
+
node_version := `cat .nvmrc | tr -d 'v\n\r'`
|
|
53
|
+
|
|
54
|
+
install *PACKAGES:
|
|
55
|
+
#!/usr/bin/env bash
|
|
56
|
+
set -euo pipefail
|
|
57
|
+
NODE_VERSION={{node_version}}
|
|
58
|
+
echo "Installing dependencies with Node $NODE_VERSION..."
|
|
59
|
+
docker build --progress=plain -f Dockerfile.install --build-arg NODE_VERSION=$NODE_VERSION --build-arg PACKAGES="{{PACKAGES}}" -t npm-installer .
|
|
60
|
+
CONTAINER_ID=$(docker create --name npm-temp npm-installer)
|
|
61
|
+
docker logs $CONTAINER_ID
|
|
62
|
+
echo "Extracting node_modules..."
|
|
63
|
+
docker cp npm-temp:/install/node_modules ./node_modules
|
|
64
|
+
docker cp npm-temp:/install/package.json ./package.json
|
|
65
|
+
docker cp npm-temp:/install/package-lock.json ./package-lock.json 2>/dev/null || true
|
|
66
|
+
echo "Cleaning up..."
|
|
67
|
+
docker rm npm-temp
|
|
68
|
+
docker rmi npm-installer
|
|
69
|
+
echo "Done."
|
|
70
|
+
|
|
71
|
+
install-dev *PACKAGES:
|
|
72
|
+
#!/usr/bin/env bash
|
|
73
|
+
set -euo pipefail
|
|
74
|
+
NODE_VERSION={{node_version}}
|
|
75
|
+
echo "Installing dev dependencies with Node $NODE_VERSION..."
|
|
76
|
+
docker build --progress=plain -f Dockerfile.install --build-arg NODE_VERSION=$NODE_VERSION --build-arg PACKAGES="{{PACKAGES}}" --build-arg DEV=true -t npm-installer .
|
|
77
|
+
CONTAINER_ID=$(docker create --name npm-temp npm-installer)
|
|
78
|
+
docker logs $CONTAINER_ID
|
|
79
|
+
echo "Extracting node_modules..."
|
|
80
|
+
docker cp npm-temp:/install/node_modules ./node_modules
|
|
81
|
+
docker cp npm-temp:/install/package.json ./package.json
|
|
82
|
+
docker cp npm-temp:/install/package-lock.json ./package-lock.json 2>/dev/null || true
|
|
83
|
+
echo "Cleaning up..."
|
|
84
|
+
docker rm npm-temp
|
|
85
|
+
docker rmi npm-installer
|
|
86
|
+
echo "Done."
|
|
87
|
+
|
|
88
|
+
build:
|
|
89
|
+
#!/usr/bin/env bash
|
|
90
|
+
set -euo pipefail
|
|
91
|
+
NODE_VERSION=$(cat .nvmrc | tr -d 'v\n\r')
|
|
92
|
+
echo "Building with Node $NODE_VERSION..."
|
|
93
|
+
# Build does not need network. So it must not use it
|
|
94
|
+
docker build --network none --progress=plain -f Dockerfile --build-arg NODE_VERSION=$NODE_VERSION -t npm-build .
|
|
95
|
+
CONTAINER_ID=$(docker create npm-build)
|
|
96
|
+
echo "Extracting build artifacts..."
|
|
97
|
+
docker cp $CONTAINER_ID:/app/dist ./dist
|
|
98
|
+
echo "Cleaning up..."
|
|
99
|
+
docker rm $CONTAINER_ID
|
|
100
|
+
docker rmi npm-build
|
|
101
|
+
echo "Build complete. Output in ./dist"
|
|
102
|
+
|
|
103
|
+
test:
|
|
104
|
+
#!/usr/bin/env bash
|
|
105
|
+
set -euo pipefail
|
|
106
|
+
NODE_VERSION=$(cat .nvmrc | tr -d 'v\n\r')
|
|
107
|
+
echo "Running tests with Node $NODE_VERSION..."
|
|
108
|
+
docker build --progress=plain -f Dockerfile.test --build-arg NODE_VERSION=$NODE_VERSION -t npm-test .
|
|
109
|
+
|
|
110
|
+
# Run tests with .env file mounted if it exists
|
|
111
|
+
if [ -f .env ]; then
|
|
112
|
+
echo "Found .env file, mounting it..."
|
|
113
|
+
docker run --rm --env-file .env npm-test
|
|
114
|
+
else
|
|
115
|
+
echo "No .env file found, running without environment variables..."
|
|
116
|
+
## If the .env is not there then I can safely assume the there is
|
|
117
|
+
## no need so making netowrk calls
|
|
118
|
+
docker run --rm --network none npm-test
|
|
119
|
+
fi
|
|
120
|
+
echo "Tests complete."
|
|
121
|
+
|
|
122
|
+
clean:
|
|
123
|
+
rm -rf node_modules
|
|
124
|
+
|
|
125
|
+
install-biome:
|
|
126
|
+
npm i -D @biomejs/biome@1.9.4
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arvo-core",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"description": "This core package contains all the core classes and components of the Arvo Event Driven System",
|
|
3
|
+
"version": "3.0.21",
|
|
5
4
|
"main": "dist/index.js",
|
|
5
|
+
"description": "The core Arvo package which provides application tier core primitives and contract system for building production-grade event-driven application. Provides ArvoEvent (CloudEvents-compliant), ArvoContract for type-safe service interfaces, event factories, OpenTelemetry integration, and orchestration utilities - enabling infrastructure-agnostic, composable, and observable distributed systems-compliant applications.",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/SaadAhmad123/arvo-core"
|
|
9
|
+
},
|
|
6
10
|
"scripts": {
|
|
7
11
|
"build": "tsc",
|
|
8
12
|
"start": "node ./dist/index.js",
|
|
@@ -12,40 +16,55 @@
|
|
|
12
16
|
"format": "biome format --fix",
|
|
13
17
|
"doc": "npx typedoc"
|
|
14
18
|
},
|
|
15
|
-
"keywords": [
|
|
19
|
+
"keywords": [
|
|
20
|
+
"arvo",
|
|
21
|
+
"event-driven",
|
|
22
|
+
"cloudevents",
|
|
23
|
+
"opentelemetry",
|
|
24
|
+
"distributed-systems",
|
|
25
|
+
"event-sourcing",
|
|
26
|
+
"messaging",
|
|
27
|
+
"microservices",
|
|
28
|
+
"observability",
|
|
29
|
+
"type-safe",
|
|
30
|
+
"orchestration",
|
|
31
|
+
"async",
|
|
32
|
+
"workflow",
|
|
33
|
+
"telemetry",
|
|
34
|
+
"events"
|
|
35
|
+
],
|
|
16
36
|
"author": "Saad Ahmad <saadkwi12@hotmail.com>",
|
|
17
37
|
"license": "MIT",
|
|
18
38
|
"devDependencies": {
|
|
19
|
-
"@biomejs/biome": "
|
|
20
|
-
"@jest/globals": "
|
|
21
|
-
"@opentelemetry/auto-instrumentations-node": "
|
|
22
|
-
"@opentelemetry/exporter-metrics-otlp-proto": "
|
|
23
|
-
"@opentelemetry/exporter-trace-otlp-proto": "
|
|
24
|
-
"@opentelemetry/resources": "
|
|
25
|
-
"@opentelemetry/sdk-metrics": "
|
|
26
|
-
"@opentelemetry/sdk-node": "
|
|
27
|
-
"@opentelemetry/sdk-trace-node": "
|
|
28
|
-
"@opentelemetry/semantic-conventions": "
|
|
29
|
-
"@types/jest": "
|
|
30
|
-
"@types/node": "
|
|
31
|
-
"@types/pako": "
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"jest": "
|
|
35
|
-
"ts-
|
|
36
|
-
"
|
|
37
|
-
"typedoc": "
|
|
38
|
-
"typedoc-
|
|
39
|
-
"
|
|
40
|
-
"typescript": "^5.5.4"
|
|
39
|
+
"@biomejs/biome": "1.9.4",
|
|
40
|
+
"@jest/globals": "29.7.0",
|
|
41
|
+
"@opentelemetry/auto-instrumentations-node": "0.49.1",
|
|
42
|
+
"@opentelemetry/exporter-metrics-otlp-proto": "0.52.1",
|
|
43
|
+
"@opentelemetry/exporter-trace-otlp-proto": "0.52.1",
|
|
44
|
+
"@opentelemetry/resources": "1.25.1",
|
|
45
|
+
"@opentelemetry/sdk-metrics": "1.25.1",
|
|
46
|
+
"@opentelemetry/sdk-node": "0.52.1",
|
|
47
|
+
"@opentelemetry/sdk-trace-node": "1.25.1",
|
|
48
|
+
"@opentelemetry/semantic-conventions": "1.38.0",
|
|
49
|
+
"@types/jest": "29.5.12",
|
|
50
|
+
"@types/node": "22.19.1",
|
|
51
|
+
"@types/pako": "2.0.4",
|
|
52
|
+
"dotenv": "16.6.1",
|
|
53
|
+
"jest": "29.7.0",
|
|
54
|
+
"ts-jest": "29.4.5",
|
|
55
|
+
"ts-node": "10.9.2",
|
|
56
|
+
"typedoc": "0.28.15",
|
|
57
|
+
"typedoc-github-theme": "0.3.1",
|
|
58
|
+
"typedoc-plugin-zod": "1.4.3",
|
|
59
|
+
"typescript": "5.9.3"
|
|
41
60
|
},
|
|
42
61
|
"dependencies": {
|
|
43
|
-
"@opentelemetry/api": "
|
|
44
|
-
"@opentelemetry/core": "
|
|
45
|
-
"pako": "
|
|
46
|
-
"uuid": "
|
|
47
|
-
"zod": "
|
|
48
|
-
"zod-to-json-schema": "
|
|
62
|
+
"@opentelemetry/api": "1.9.0",
|
|
63
|
+
"@opentelemetry/core": "1.30.1",
|
|
64
|
+
"pako": "2.1.0",
|
|
65
|
+
"uuid": "11.1.0",
|
|
66
|
+
"zod": "3.25.74",
|
|
67
|
+
"zod-to-json-schema": "3.25.0"
|
|
49
68
|
},
|
|
50
69
|
"engines": {
|
|
51
70
|
"node": ">=18.0.0"
|