ml-cache 1.0.0
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/LICENSE +21 -0
- package/README.md +599 -0
- package/dist/client.d.ts +175 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +411 -0
- package/dist/client.js.map +1 -0
- package/dist/constants.d.ts +184 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +236 -0
- package/dist/constants.js.map +1 -0
- package/dist/esm/client.d.ts +175 -0
- package/dist/esm/client.d.ts.map +1 -0
- package/dist/esm/client.js +407 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/constants.d.ts +184 -0
- package/dist/esm/constants.d.ts.map +1 -0
- package/dist/esm/constants.js +233 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/index.d.ts +58 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/queue.d.ts +106 -0
- package/dist/esm/queue.d.ts.map +1 -0
- package/dist/esm/queue.js +207 -0
- package/dist/esm/queue.js.map +1 -0
- package/dist/esm/storage/glacier-storage.d.ts +77 -0
- package/dist/esm/storage/glacier-storage.d.ts.map +1 -0
- package/dist/esm/storage/glacier-storage.js +133 -0
- package/dist/esm/storage/glacier-storage.js.map +1 -0
- package/dist/esm/storage/index.d.ts +7 -0
- package/dist/esm/storage/index.d.ts.map +1 -0
- package/dist/esm/storage/index.js +7 -0
- package/dist/esm/storage/index.js.map +1 -0
- package/dist/esm/storage/s3-storage.d.ts +89 -0
- package/dist/esm/storage/s3-storage.d.ts.map +1 -0
- package/dist/esm/storage/s3-storage.js +161 -0
- package/dist/esm/storage/s3-storage.js.map +1 -0
- package/dist/esm/types/index.d.ts +337 -0
- package/dist/esm/types/index.d.ts.map +1 -0
- package/dist/esm/types/index.js +6 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/esm/utils/helpers.d.ts +132 -0
- package/dist/esm/utils/helpers.d.ts.map +1 -0
- package/dist/esm/utils/helpers.js +198 -0
- package/dist/esm/utils/helpers.js.map +1 -0
- package/dist/esm/utils/index.d.ts +8 -0
- package/dist/esm/utils/index.d.ts.map +1 -0
- package/dist/esm/utils/index.js +8 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/logger.d.ts +110 -0
- package/dist/esm/utils/logger.d.ts.map +1 -0
- package/dist/esm/utils/logger.js +177 -0
- package/dist/esm/utils/logger.js.map +1 -0
- package/dist/esm/utils/validator.d.ts +77 -0
- package/dist/esm/utils/validator.d.ts.map +1 -0
- package/dist/esm/utils/validator.js +208 -0
- package/dist/esm/utils/validator.js.map +1 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +100 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +72 -0
- package/dist/queue.d.ts +106 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/queue.js +211 -0
- package/dist/queue.js.map +1 -0
- package/dist/storage/glacier-storage.d.ts +77 -0
- package/dist/storage/glacier-storage.d.ts.map +1 -0
- package/dist/storage/glacier-storage.js +137 -0
- package/dist/storage/glacier-storage.js.map +1 -0
- package/dist/storage/index.d.ts +7 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +12 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/s3-storage.d.ts +89 -0
- package/dist/storage/s3-storage.d.ts.map +1 -0
- package/dist/storage/s3-storage.js +165 -0
- package/dist/storage/s3-storage.js.map +1 -0
- package/dist/types/index.d.ts +337 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/helpers.d.ts +132 -0
- package/dist/utils/helpers.d.ts.map +1 -0
- package/dist/utils/helpers.js +215 -0
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +35 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +110 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +181 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/validator.d.ts +77 -0
- package/dist/utils/validator.d.ts.map +1 -0
- package/dist/utils/validator.js +221 -0
- package/dist/utils/validator.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Validation utilities for ml-cache SDK
|
|
4
|
+
* @module ml-cache/utils/validator
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ValidationError = void 0;
|
|
8
|
+
exports.validateCredentials = validateCredentials;
|
|
9
|
+
exports.validateS3Config = validateS3Config;
|
|
10
|
+
exports.validateGlacierConfig = validateGlacierConfig;
|
|
11
|
+
exports.validateConfig = validateConfig;
|
|
12
|
+
exports.validateEventType = validateEventType;
|
|
13
|
+
exports.validateEventProperties = validateEventProperties;
|
|
14
|
+
exports.validateEvent = validateEvent;
|
|
15
|
+
exports.isValidTimestamp = isValidTimestamp;
|
|
16
|
+
exports.isValidUUID = isValidUUID;
|
|
17
|
+
const constants_1 = require("../constants");
|
|
18
|
+
/**
|
|
19
|
+
* Validation error class
|
|
20
|
+
* @class ValidationError
|
|
21
|
+
* @extends Error
|
|
22
|
+
*/
|
|
23
|
+
class ValidationError extends Error {
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new ValidationError
|
|
26
|
+
* @param {string} message - Error message
|
|
27
|
+
* @param {string} [field] - Field that failed validation
|
|
28
|
+
*/
|
|
29
|
+
constructor(message, field) {
|
|
30
|
+
super(message);
|
|
31
|
+
this.name = 'ValidationError';
|
|
32
|
+
this.code = constants_1.ERROR_CODES.VALIDATION_ERROR;
|
|
33
|
+
this.field = field;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.ValidationError = ValidationError;
|
|
37
|
+
/**
|
|
38
|
+
* Validates AWS credentials
|
|
39
|
+
* @param {AWSCredentials} credentials - AWS credentials to validate
|
|
40
|
+
* @throws {ValidationError} If credentials are invalid
|
|
41
|
+
*/
|
|
42
|
+
function validateCredentials(credentials) {
|
|
43
|
+
if (!credentials) {
|
|
44
|
+
throw new ValidationError('AWS credentials are required', 'credentials');
|
|
45
|
+
}
|
|
46
|
+
if (!credentials.accessKeyId || typeof credentials.accessKeyId !== 'string') {
|
|
47
|
+
throw new ValidationError('AWS access key ID is required and must be a string', 'credentials.accessKeyId');
|
|
48
|
+
}
|
|
49
|
+
if (!credentials.secretAccessKey ||
|
|
50
|
+
typeof credentials.secretAccessKey !== 'string') {
|
|
51
|
+
throw new ValidationError('AWS secret access key is required and must be a string', 'credentials.secretAccessKey');
|
|
52
|
+
}
|
|
53
|
+
if (credentials.sessionToken !== undefined &&
|
|
54
|
+
typeof credentials.sessionToken !== 'string') {
|
|
55
|
+
throw new ValidationError('AWS session token must be a string', 'credentials.sessionToken');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Validates S3 configuration
|
|
60
|
+
* @param {S3Config} config - S3 configuration to validate
|
|
61
|
+
* @throws {ValidationError} If configuration is invalid
|
|
62
|
+
*/
|
|
63
|
+
function validateS3Config(config) {
|
|
64
|
+
if (!config) {
|
|
65
|
+
throw new ValidationError('S3 configuration is required', 's3');
|
|
66
|
+
}
|
|
67
|
+
if (!config.bucket || typeof config.bucket !== 'string') {
|
|
68
|
+
throw new ValidationError('S3 bucket name is required and must be a string', 's3.bucket');
|
|
69
|
+
}
|
|
70
|
+
if (!config.region || typeof config.region !== 'string') {
|
|
71
|
+
throw new ValidationError('S3 region is required and must be a string', 's3.region');
|
|
72
|
+
}
|
|
73
|
+
if (config.prefix !== undefined && typeof config.prefix !== 'string') {
|
|
74
|
+
throw new ValidationError('S3 prefix must be a string', 's3.prefix');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Validates Glacier configuration
|
|
79
|
+
* @param {GlacierConfig} config - Glacier configuration to validate
|
|
80
|
+
* @throws {ValidationError} If configuration is invalid
|
|
81
|
+
*/
|
|
82
|
+
function validateGlacierConfig(config) {
|
|
83
|
+
if (!config) {
|
|
84
|
+
throw new ValidationError('Glacier configuration is required', 'glacier');
|
|
85
|
+
}
|
|
86
|
+
if (!config.vaultName || typeof config.vaultName !== 'string') {
|
|
87
|
+
throw new ValidationError('Glacier vault name is required and must be a string', 'glacier.vaultName');
|
|
88
|
+
}
|
|
89
|
+
if (!config.region || typeof config.region !== 'string') {
|
|
90
|
+
throw new ValidationError('Glacier region is required and must be a string', 'glacier.region');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Validates complete SDK configuration
|
|
95
|
+
* @param {MLCacheConfig} config - SDK configuration to validate
|
|
96
|
+
* @throws {ValidationError} If configuration is invalid
|
|
97
|
+
*/
|
|
98
|
+
function validateConfig(config) {
|
|
99
|
+
if (!config) {
|
|
100
|
+
throw new ValidationError('Configuration is required', 'config');
|
|
101
|
+
}
|
|
102
|
+
validateCredentials(config.credentials);
|
|
103
|
+
if (!config.storageMode) {
|
|
104
|
+
throw new ValidationError('Storage mode is required', 'storageMode');
|
|
105
|
+
}
|
|
106
|
+
const validModes = ['S3', 'GLACIER', 'S3_TO_GLACIER'];
|
|
107
|
+
if (!validModes.includes(config.storageMode)) {
|
|
108
|
+
throw new ValidationError(`Invalid storage mode. Must be one of: ${validModes.join(', ')}`, 'storageMode');
|
|
109
|
+
}
|
|
110
|
+
if (config.storageMode === 'S3' || config.storageMode === 'S3_TO_GLACIER') {
|
|
111
|
+
if (!config.s3) {
|
|
112
|
+
throw new ValidationError('S3 configuration is required for S3 or S3_TO_GLACIER storage mode', 's3');
|
|
113
|
+
}
|
|
114
|
+
validateS3Config(config.s3);
|
|
115
|
+
}
|
|
116
|
+
if (config.storageMode === 'GLACIER') {
|
|
117
|
+
if (!config.glacier) {
|
|
118
|
+
throw new ValidationError('Glacier configuration is required for GLACIER storage mode', 'glacier');
|
|
119
|
+
}
|
|
120
|
+
validateGlacierConfig(config.glacier);
|
|
121
|
+
}
|
|
122
|
+
if (config.batch) {
|
|
123
|
+
if (config.batch.maxSize !== undefined) {
|
|
124
|
+
if (typeof config.batch.maxSize !== 'number' ||
|
|
125
|
+
config.batch.maxSize < 1) {
|
|
126
|
+
throw new ValidationError('Batch max size must be a positive number', 'batch.maxSize');
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (config.batch.maxWaitMs !== undefined) {
|
|
130
|
+
if (typeof config.batch.maxWaitMs !== 'number' ||
|
|
131
|
+
config.batch.maxWaitMs < 0) {
|
|
132
|
+
throw new ValidationError('Batch max wait must be a non-negative number', 'batch.maxWaitMs');
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (config.retry) {
|
|
137
|
+
if (config.retry.maxRetries !== undefined) {
|
|
138
|
+
if (typeof config.retry.maxRetries !== 'number' ||
|
|
139
|
+
config.retry.maxRetries < 0) {
|
|
140
|
+
throw new ValidationError('Max retries must be a non-negative number', 'retry.maxRetries');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Validates an event type string
|
|
147
|
+
* @param {string} eventType - Event type to validate
|
|
148
|
+
* @throws {ValidationError} If event type is invalid
|
|
149
|
+
*/
|
|
150
|
+
function validateEventType(eventType) {
|
|
151
|
+
if (!eventType || typeof eventType !== 'string') {
|
|
152
|
+
throw new ValidationError('Event type is required and must be a string', 'eventType');
|
|
153
|
+
}
|
|
154
|
+
if (eventType.length > constants_1.MAX_EVENT_TYPE_LENGTH) {
|
|
155
|
+
throw new ValidationError(`Event type must be at most ${constants_1.MAX_EVENT_TYPE_LENGTH} characters`, 'eventType');
|
|
156
|
+
}
|
|
157
|
+
if (!constants_1.EVENT_TYPE_PATTERN.test(eventType)) {
|
|
158
|
+
throw new ValidationError('Event type must start with a letter and contain only alphanumeric characters and underscores', 'eventType');
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Validates event properties
|
|
163
|
+
* @param {Record<string, unknown>} properties - Properties to validate
|
|
164
|
+
* @throws {ValidationError} If properties are invalid
|
|
165
|
+
*/
|
|
166
|
+
function validateEventProperties(properties) {
|
|
167
|
+
if (properties === undefined || properties === null) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (typeof properties !== 'object' || Array.isArray(properties)) {
|
|
171
|
+
throw new ValidationError('Event properties must be an object', 'properties');
|
|
172
|
+
}
|
|
173
|
+
for (const key of Object.keys(properties)) {
|
|
174
|
+
if (key.length > constants_1.MAX_PROPERTY_KEY_LENGTH) {
|
|
175
|
+
throw new ValidationError(`Property key "${key}" exceeds maximum length of ${constants_1.MAX_PROPERTY_KEY_LENGTH}`, `properties.${key}`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Validates a complete event
|
|
181
|
+
* @param {MLCacheEvent} event - Event to validate
|
|
182
|
+
* @throws {ValidationError} If event is invalid
|
|
183
|
+
*/
|
|
184
|
+
function validateEvent(event) {
|
|
185
|
+
if (!event) {
|
|
186
|
+
throw new ValidationError('Event is required', 'event');
|
|
187
|
+
}
|
|
188
|
+
validateEventType(event.eventType);
|
|
189
|
+
if (event.properties !== undefined) {
|
|
190
|
+
validateEventProperties(event.properties);
|
|
191
|
+
}
|
|
192
|
+
const eventSize = Buffer.byteLength(JSON.stringify(event), 'utf8');
|
|
193
|
+
if (eventSize > constants_1.MAX_EVENT_SIZE_BYTES) {
|
|
194
|
+
throw new ValidationError(`Event size (${eventSize} bytes) exceeds maximum allowed size (${constants_1.MAX_EVENT_SIZE_BYTES} bytes)`, 'event');
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Checks if a value is a valid ISO 8601 timestamp
|
|
199
|
+
* @param {string} timestamp - Timestamp to validate
|
|
200
|
+
* @returns {boolean} Whether the timestamp is valid
|
|
201
|
+
*/
|
|
202
|
+
function isValidTimestamp(timestamp) {
|
|
203
|
+
if (!timestamp || typeof timestamp !== 'string') {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
const date = new Date(timestamp);
|
|
207
|
+
return !isNaN(date.getTime());
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Checks if a value is a valid UUID
|
|
211
|
+
* @param {string} uuid - UUID to validate
|
|
212
|
+
* @returns {boolean} Whether the UUID is valid
|
|
213
|
+
*/
|
|
214
|
+
function isValidUUID(uuid) {
|
|
215
|
+
if (!uuid || typeof uuid !== 'string') {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
219
|
+
return uuidPattern.test(uuid);
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/utils/validator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA+CH,kDA+BC;AAOD,4CAsBC;AAOD,sDAkBC;AAOD,wCA8EC;AAOD,8CAqBC;AAOD,0DAsBC;AAOD,sCAkBC;AAOD,4CAOC;AAOD,kCAQC;AA/TD,4CAMsB;AAEtB;;;;GAIG;AACH,MAAa,eAAgB,SAAQ,KAAK;IAOxC;;;;OAIG;IACH,YAAY,OAAe,EAAE,KAAc;QACzC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,uBAAW,CAAC,gBAAgB,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAC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@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ml-cache",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "SDK to collect and store business/product events for future ML training. Store now, train later when AI becomes affordable.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc && npm run build:esm",
|
|
20
|
+
"build:esm": "tsc --module ES2020 --outDir dist/esm && mv dist/esm/index.js dist/index.mjs 2>/dev/null || true",
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"test:watch": "vitest",
|
|
23
|
+
"test:coverage": "vitest run --coverage",
|
|
24
|
+
"lint": "tsc --noEmit",
|
|
25
|
+
"prepublishOnly": "npm run build && npm run test"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/nicolasmondain/ml-cache.git"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"ml",
|
|
33
|
+
"machine-learning",
|
|
34
|
+
"data-collection",
|
|
35
|
+
"analytics",
|
|
36
|
+
"events",
|
|
37
|
+
"s3",
|
|
38
|
+
"glacier",
|
|
39
|
+
"aws",
|
|
40
|
+
"cold-storage",
|
|
41
|
+
"future-proof",
|
|
42
|
+
"ai-training",
|
|
43
|
+
"data-lake"
|
|
44
|
+
],
|
|
45
|
+
"author": "Nicolas Mondain",
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/nicolasmondain/ml-cache/issues"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/nicolasmondain/ml-cache#readme",
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=18.0.0"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/node": "^25.0.3",
|
|
56
|
+
"@vitest/coverage-v8": "^4.0.16",
|
|
57
|
+
"typescript": "^5.9.3",
|
|
58
|
+
"vitest": "^4.0.16"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@aws-sdk/client-glacier": "^3.964.0",
|
|
62
|
+
"@aws-sdk/client-s3": "^3.964.0"
|
|
63
|
+
}
|
|
64
|
+
}
|