@onlineapps/infrastructure-tools 1.0.32 → 1.0.34
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 +36 -0
- package/package.json +3 -4
- package/src/index.js +7 -1
package/README.md
CHANGED
|
@@ -72,6 +72,25 @@ await initInfrastructureQueues(channel, {
|
|
|
72
72
|
});
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
+
### Storage Operations
|
|
76
|
+
|
|
77
|
+
Access MinIO storage for infrastructure services:
|
|
78
|
+
|
|
79
|
+
```javascript
|
|
80
|
+
const { StorageCore } = require('@onlineapps/infrastructure-tools');
|
|
81
|
+
|
|
82
|
+
const storage = new StorageCore({
|
|
83
|
+
endPoint: process.env.MINIO_HOST || 'api_shared_storage',
|
|
84
|
+
port: parseInt(process.env.MINIO_PORT || '9000'),
|
|
85
|
+
accessKey: process.env.MINIO_ACCESS_KEY || 'minioadmin',
|
|
86
|
+
secretKey: process.env.MINIO_SECRET_KEY || 'minioadmin'
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
await storage.initialize();
|
|
90
|
+
await storage.ensureBucket('workflow');
|
|
91
|
+
await storage.putObject('workflow', 'path/to/file', buffer);
|
|
92
|
+
```
|
|
93
|
+
|
|
75
94
|
## API
|
|
76
95
|
|
|
77
96
|
### `waitForInfrastructureReady(options)`
|
|
@@ -122,15 +141,32 @@ Creates health publisher adapter for BaseClient (from mq-client-core).
|
|
|
122
141
|
|
|
123
142
|
Creates health publisher adapter for amqplib (direct connection + channel).
|
|
124
143
|
|
|
144
|
+
### `StorageCore`
|
|
145
|
+
|
|
146
|
+
Re-exported from `@onlineapps/storage-core` for infrastructure services.
|
|
147
|
+
|
|
148
|
+
Provides core MinIO storage operations:
|
|
149
|
+
- `putObject(bucket, path, data, metadata?)` - Upload object
|
|
150
|
+
- `getObject(bucket, path)` - Download object
|
|
151
|
+
- `objectExists(bucket, path)` - Check if object exists
|
|
152
|
+
- `ensureBucket(bucket, region?)` - Ensure bucket exists
|
|
153
|
+
- `calculateFingerprint(content)` - Generate SHA256 fingerprint
|
|
154
|
+
- `getContentType(filename)` - Get MIME type from filename
|
|
155
|
+
- `getPresignedUrl(bucket, path, expiry?)` - Generate presigned URL
|
|
156
|
+
|
|
157
|
+
See [@onlineapps/storage-core](../storage/storage-core/README.md) for full API documentation.
|
|
158
|
+
|
|
125
159
|
## Dependencies
|
|
126
160
|
|
|
127
161
|
- `@onlineapps/mq-client-core` - For queue configuration
|
|
128
162
|
- `@onlineapps/service-common` - For `waitForInfrastructureReady` (shared utility)
|
|
163
|
+
- `@onlineapps/storage-core` - For core MinIO storage operations
|
|
129
164
|
|
|
130
165
|
## Related Libraries
|
|
131
166
|
|
|
132
167
|
- `@onlineapps/mq-client-core` - Core MQ operations and queue configuration
|
|
133
168
|
- `@onlineapps/monitoring-core` - Business monitoring (traces, metrics, logs)
|
|
169
|
+
- `@onlineapps/storage-core` - Core MinIO storage operations (re-exported here for infrastructure services)
|
|
134
170
|
|
|
135
171
|
## License
|
|
136
172
|
|
package/package.json
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onlineapps/infrastructure-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.34",
|
|
4
4
|
"description": "Infrastructure orchestration utilities for OA Drive infrastructure services (health tracking, queue initialization, service discovery)",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "jest",
|
|
8
8
|
"test:unit": "jest --testPathPattern=tests/unit",
|
|
9
9
|
"test:component": "jest --testPathPattern=tests/component",
|
|
10
|
-
"test:integration": "jest --testPathPattern=tests/integration"
|
|
11
|
-
"prepublishOnly": "cd $(git rev-parse --show-toplevel) && bash scripts/pre-publish-compatibility-check.sh shared/infrastructure-tools",
|
|
12
|
-
"postpublish": "cd $(git rev-parse --show-toplevel) && bash scripts/update-manifest-from-npm.sh && bash scripts/update-all-services.sh"
|
|
10
|
+
"test:integration": "jest --testPathPattern=tests/integration"
|
|
13
11
|
},
|
|
14
12
|
"keywords": [
|
|
15
13
|
"infrastructure",
|
|
@@ -22,6 +20,7 @@
|
|
|
22
20
|
"dependencies": {
|
|
23
21
|
"@onlineapps/mq-client-core": "^1.0.47",
|
|
24
22
|
"@onlineapps/service-common": "^1.0.5",
|
|
23
|
+
"@onlineapps/storage-core": "1.0.2",
|
|
25
24
|
"uuid": "^9.0.1",
|
|
26
25
|
"@onlineapps/infra-logger": "^1.0.0"
|
|
27
26
|
},
|
package/src/index.js
CHANGED
|
@@ -41,6 +41,9 @@ const queueConfig = require('@onlineapps/mq-client-core/src/config/queueConfig')
|
|
|
41
41
|
// Re-export infra-logger (infrastructure services should use infrastructure-tools, not infra-logger directly)
|
|
42
42
|
const { createLogger: createInfraLogger } = require('@onlineapps/infra-logger');
|
|
43
43
|
|
|
44
|
+
// Re-export storage-core (infrastructure services should use infrastructure-tools, not storage-core directly)
|
|
45
|
+
const { StorageCore } = require('@onlineapps/storage-core');
|
|
46
|
+
|
|
44
47
|
const { initInfrastructureQueues } = require('./orchestration/initInfrastructureQueues');
|
|
45
48
|
const {
|
|
46
49
|
createHealthPublisher,
|
|
@@ -93,6 +96,9 @@ module.exports = {
|
|
|
93
96
|
createInfraLogger,
|
|
94
97
|
|
|
95
98
|
// Monitoring utilities
|
|
96
|
-
sendQueueMismatchAlert
|
|
99
|
+
sendQueueMismatchAlert,
|
|
100
|
+
|
|
101
|
+
// Storage utilities (re-exported - infrastructure services should use infrastructure-tools, not storage-core directly)
|
|
102
|
+
StorageCore
|
|
97
103
|
};
|
|
98
104
|
|