@kravc/schema 2.7.6 → 2.8.0-alpha.1

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.
Files changed (176) hide show
  1. package/README.md +19 -14
  2. package/dist/CredentialFactory.d.ts +345 -0
  3. package/dist/CredentialFactory.d.ts.map +1 -0
  4. package/dist/CredentialFactory.js +381 -0
  5. package/dist/CredentialFactory.js.map +1 -0
  6. package/dist/Schema.d.ts +448 -0
  7. package/dist/Schema.d.ts.map +1 -0
  8. package/dist/Schema.js +506 -0
  9. package/dist/Schema.js.map +1 -0
  10. package/dist/ValidationError.d.ts +70 -0
  11. package/dist/ValidationError.d.ts.map +1 -0
  12. package/dist/ValidationError.js +78 -0
  13. package/dist/ValidationError.js.map +1 -0
  14. package/dist/Validator.d.ts +483 -0
  15. package/dist/Validator.d.ts.map +1 -0
  16. package/dist/Validator.js +570 -0
  17. package/dist/Validator.js.map +1 -0
  18. package/dist/helpers/JsonSchema.d.ts +99 -0
  19. package/dist/helpers/JsonSchema.d.ts.map +1 -0
  20. package/dist/helpers/JsonSchema.js +3 -0
  21. package/dist/helpers/JsonSchema.js.map +1 -0
  22. package/dist/helpers/cleanupAttributes.d.ts +34 -0
  23. package/dist/helpers/cleanupAttributes.d.ts.map +1 -0
  24. package/dist/helpers/cleanupAttributes.js +113 -0
  25. package/dist/helpers/cleanupAttributes.js.map +1 -0
  26. package/dist/helpers/cleanupNulls.d.ts +27 -0
  27. package/dist/helpers/cleanupNulls.d.ts.map +1 -0
  28. package/dist/helpers/cleanupNulls.js +96 -0
  29. package/dist/helpers/cleanupNulls.js.map +1 -0
  30. package/dist/helpers/createSchemasMap.d.ts +67 -0
  31. package/dist/helpers/createSchemasMap.d.ts.map +1 -0
  32. package/dist/helpers/createSchemasMap.js +200 -0
  33. package/dist/helpers/createSchemasMap.js.map +1 -0
  34. package/dist/helpers/getReferenceIds.d.ts +169 -0
  35. package/dist/helpers/getReferenceIds.d.ts.map +1 -0
  36. package/dist/helpers/getReferenceIds.js +241 -0
  37. package/dist/helpers/getReferenceIds.js.map +1 -0
  38. package/dist/helpers/got.d.ts +60 -0
  39. package/dist/helpers/got.d.ts.map +1 -0
  40. package/dist/helpers/got.js +72 -0
  41. package/dist/helpers/got.js.map +1 -0
  42. package/dist/helpers/mapObjectProperties.d.ts +150 -0
  43. package/dist/helpers/mapObjectProperties.d.ts.map +1 -0
  44. package/dist/helpers/mapObjectProperties.js +229 -0
  45. package/dist/helpers/mapObjectProperties.js.map +1 -0
  46. package/dist/helpers/normalizeAttributes.d.ts +213 -0
  47. package/dist/helpers/normalizeAttributes.d.ts.map +1 -0
  48. package/dist/helpers/normalizeAttributes.js +243 -0
  49. package/dist/helpers/normalizeAttributes.js.map +1 -0
  50. package/dist/helpers/normalizeProperties.d.ts +168 -0
  51. package/dist/helpers/normalizeProperties.d.ts.map +1 -0
  52. package/dist/helpers/normalizeProperties.js +223 -0
  53. package/dist/helpers/normalizeProperties.js.map +1 -0
  54. package/dist/helpers/normalizeRequired.d.ts +159 -0
  55. package/dist/helpers/normalizeRequired.d.ts.map +1 -0
  56. package/dist/helpers/normalizeRequired.js +206 -0
  57. package/dist/helpers/normalizeRequired.js.map +1 -0
  58. package/dist/helpers/normalizeType.d.ts +81 -0
  59. package/dist/helpers/normalizeType.d.ts.map +1 -0
  60. package/dist/helpers/normalizeType.js +210 -0
  61. package/dist/helpers/normalizeType.js.map +1 -0
  62. package/dist/helpers/nullifyEmptyValues.d.ts +139 -0
  63. package/dist/helpers/nullifyEmptyValues.d.ts.map +1 -0
  64. package/dist/helpers/nullifyEmptyValues.js +191 -0
  65. package/dist/helpers/nullifyEmptyValues.js.map +1 -0
  66. package/dist/helpers/removeRequiredAndDefault.d.ts +106 -0
  67. package/dist/helpers/removeRequiredAndDefault.d.ts.map +1 -0
  68. package/dist/helpers/removeRequiredAndDefault.js +138 -0
  69. package/dist/helpers/removeRequiredAndDefault.js.map +1 -0
  70. package/dist/helpers/validateId.d.ts +39 -0
  71. package/dist/helpers/validateId.d.ts.map +1 -0
  72. package/dist/helpers/validateId.js +51 -0
  73. package/dist/helpers/validateId.js.map +1 -0
  74. package/dist/index.d.ts +9 -0
  75. package/dist/index.d.ts.map +1 -0
  76. package/dist/index.js +21 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/ld/documentLoader.d.ts +8 -0
  79. package/dist/ld/documentLoader.d.ts.map +1 -0
  80. package/dist/ld/documentLoader.js +24 -0
  81. package/dist/ld/documentLoader.js.map +1 -0
  82. package/dist/ld/getLinkedDataAttributeType.d.ts +10 -0
  83. package/dist/ld/getLinkedDataAttributeType.d.ts.map +1 -0
  84. package/dist/ld/getLinkedDataAttributeType.js +32 -0
  85. package/dist/ld/getLinkedDataAttributeType.js.map +1 -0
  86. package/dist/ld/getLinkedDataContext.d.ts +19 -0
  87. package/dist/ld/getLinkedDataContext.d.ts.map +1 -0
  88. package/dist/ld/getLinkedDataContext.js +50 -0
  89. package/dist/ld/getLinkedDataContext.js.map +1 -0
  90. package/eslint.config.mjs +32 -52
  91. package/examples/credentials/createAccountCredential.ts +27 -0
  92. package/examples/credentials/createMineSweeperScoreCredential.ts +115 -0
  93. package/examples/index.ts +7 -0
  94. package/examples/schemas/FavoriteItemSchema.ts +27 -0
  95. package/examples/{Preferences.yaml → schemas/Preferences.yaml} +2 -0
  96. package/examples/schemas/PreferencesSchema.ts +29 -0
  97. package/examples/schemas/ProfileSchema.ts +91 -0
  98. package/examples/schemas/Status.yaml +3 -0
  99. package/examples/schemas/StatusSchema.ts +12 -0
  100. package/jest.config.mjs +5 -0
  101. package/package.json +27 -20
  102. package/src/CredentialFactory.ts +392 -0
  103. package/src/Schema.ts +583 -0
  104. package/src/ValidationError.ts +90 -0
  105. package/src/Validator.ts +603 -0
  106. package/src/__tests__/CredentialFactory.test.ts +588 -0
  107. package/src/__tests__/Schema.test.ts +371 -0
  108. package/src/__tests__/ValidationError.test.ts +235 -0
  109. package/src/__tests__/Validator.test.ts +787 -0
  110. package/src/helpers/JsonSchema.ts +119 -0
  111. package/src/helpers/__tests__/cleanupAttributes.test.ts +943 -0
  112. package/src/helpers/__tests__/cleanupNulls.test.ts +772 -0
  113. package/src/helpers/__tests__/createSchemasMap.test.ts +238 -0
  114. package/src/helpers/__tests__/getReferenceIds.test.ts +975 -0
  115. package/src/helpers/__tests__/got.test.ts +193 -0
  116. package/src/helpers/__tests__/mapObjectProperties.test.ts +1126 -0
  117. package/src/helpers/__tests__/normalizeAttributes.test.ts +1435 -0
  118. package/src/helpers/__tests__/normalizeProperties.test.ts +727 -0
  119. package/src/helpers/__tests__/normalizeRequired.test.ts +669 -0
  120. package/src/helpers/__tests__/normalizeType.test.ts +772 -0
  121. package/src/helpers/__tests__/nullifyEmptyValues.test.ts +735 -0
  122. package/src/helpers/__tests__/removeRequiredAndDefault.test.ts +734 -0
  123. package/src/helpers/__tests__/validateId.test.ts +118 -0
  124. package/src/helpers/cleanupAttributes.ts +151 -0
  125. package/src/helpers/cleanupNulls.ts +106 -0
  126. package/src/helpers/createSchemasMap.ts +212 -0
  127. package/src/helpers/getReferenceIds.ts +273 -0
  128. package/src/helpers/got.ts +73 -0
  129. package/src/helpers/mapObjectProperties.ts +272 -0
  130. package/src/helpers/normalizeAttributes.ts +247 -0
  131. package/src/helpers/normalizeProperties.ts +249 -0
  132. package/src/helpers/normalizeRequired.ts +233 -0
  133. package/src/helpers/normalizeType.ts +235 -0
  134. package/src/helpers/nullifyEmptyValues.ts +207 -0
  135. package/src/helpers/removeRequiredAndDefault.ts +151 -0
  136. package/src/helpers/validateId.ts +53 -0
  137. package/src/index.ts +17 -0
  138. package/src/ld/__tests__/documentLoader.test.ts +57 -0
  139. package/src/ld/__tests__/getLinkedDataAttributeType.test.ts +212 -0
  140. package/src/ld/__tests__/getLinkedDataContext.test.ts +378 -0
  141. package/src/ld/documentLoader.ts +28 -0
  142. package/src/ld/getLinkedDataAttributeType.ts +46 -0
  143. package/src/ld/getLinkedDataContext.ts +80 -0
  144. package/tsconfig.json +27 -0
  145. package/types/credentials-context.d.ts +14 -0
  146. package/types/security-context.d.ts +6 -0
  147. package/examples/Status.yaml +0 -3
  148. package/examples/createAccountCredential.js +0 -27
  149. package/examples/createMineSweeperScoreCredential.js +0 -63
  150. package/examples/index.js +0 -9
  151. package/src/CredentialFactory.js +0 -67
  152. package/src/CredentialFactory.spec.js +0 -131
  153. package/src/Schema.js +0 -104
  154. package/src/Schema.spec.js +0 -172
  155. package/src/ValidationError.js +0 -31
  156. package/src/Validator.js +0 -128
  157. package/src/Validator.spec.js +0 -355
  158. package/src/helpers/cleanupAttributes.js +0 -71
  159. package/src/helpers/cleanupNulls.js +0 -42
  160. package/src/helpers/getReferenceIds.js +0 -71
  161. package/src/helpers/mapObject.js +0 -65
  162. package/src/helpers/normalizeAttributes.js +0 -28
  163. package/src/helpers/normalizeProperties.js +0 -61
  164. package/src/helpers/normalizeRequired.js +0 -37
  165. package/src/helpers/normalizeType.js +0 -41
  166. package/src/helpers/nullifyEmptyValues.js +0 -57
  167. package/src/helpers/removeRequiredAndDefault.js +0 -30
  168. package/src/helpers/validateId.js +0 -19
  169. package/src/index.d.ts +0 -25
  170. package/src/index.js +0 -8
  171. package/src/ld/documentLoader.js +0 -25
  172. package/src/ld/documentLoader.spec.js +0 -12
  173. package/src/ld/getLinkedDataContext.js +0 -63
  174. package/src/ld/getLinkedDataType.js +0 -38
  175. /package/examples/{FavoriteItem.yaml → schemas/FavoriteItem.yaml} +0 -0
  176. /package/examples/{Profile.yaml → schemas/Profile.yaml} +0 -0
@@ -0,0 +1,570 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const z_schema_1 = __importDefault(require("z-schema"));
7
+ const lodash_1 = require("lodash");
8
+ const got_1 = __importDefault(require("./helpers/got"));
9
+ const cleanupNulls_1 = __importDefault(require("./helpers/cleanupNulls"));
10
+ const getReferenceIds_1 = __importDefault(require("./helpers/getReferenceIds"));
11
+ const ValidationError_1 = __importDefault(require("./ValidationError"));
12
+ const cleanupAttributes_1 = __importDefault(require("./helpers/cleanupAttributes"));
13
+ const nullifyEmptyValues_1 = __importDefault(require("./helpers/nullifyEmptyValues"));
14
+ const normalizeAttributes_1 = __importDefault(require("./helpers/normalizeAttributes"));
15
+ /**
16
+ * Validator for validating and normalizing objects against JSON schemas.
17
+ *
18
+ * **Intent:**
19
+ * The Validator class provides a comprehensive solution for validating objects against JSON schemas
20
+ * with built-in normalization, cleanup, and error handling capabilities. It serves as the primary
21
+ * interface for ensuring data integrity and consistency in applications that work with structured
22
+ * data, particularly in API endpoints, data transformation pipelines, and credential systems.
23
+ *
24
+ * The validator performs several key operations:
25
+ * - Validates objects against registered schemas using JSON Schema validation
26
+ * - Removes attributes not defined in the schema (cleanup)
27
+ * - Normalizes attribute types (e.g., string '1' → boolean true, string '180' → number 180)
28
+ * - Handles empty values by optionally nullifying them for non-required fields
29
+ * - Provides detailed validation errors with structured error information
30
+ *
31
+ * **Use Cases:**
32
+ *
33
+ * 1. **API Request/Response Validation:**
34
+ * - Validate incoming API requests against defined schemas
35
+ * - Ensure API responses conform to expected structure
36
+ * - Clean up extra fields sent by clients
37
+ * - Normalize data from query parameters or form submissions
38
+ *
39
+ * 2. **Data Integration & Third-Party Services:**
40
+ * - Integrate with external APIs that send loosely-typed data
41
+ * - Normalize data from URLs where types are strings (e.g., 'true', '1', '180')
42
+ * - Clean up payloads before sending to third-party services (e.g., Telegram, webhooks)
43
+ * - Handle data from systems that don't enforce strict typing
44
+ *
45
+ * 3. **Credential & Identity Systems:**
46
+ * - Validate verifiable credentials against schema definitions
47
+ * - Ensure credential subjects conform to expected schemas
48
+ * - Normalize credential data from various sources
49
+ *
50
+ * 4. **Data Transformation Pipelines:**
51
+ * - Normalize data types without full validation
52
+ * - Clean up data structures before processing
53
+ * - Transform data between different formats while maintaining schema compliance
54
+ *
55
+ * 5. **Form & User Input Processing:**
56
+ * - Validate and normalize form submissions
57
+ * - Handle empty values gracefully (nullify empty strings for optional fields)
58
+ * - Clean up null values from nested objects
59
+ *
60
+ * **Example - Basic Validation:**
61
+ * ```typescript
62
+ * const userSchema = new Schema({
63
+ * name: { type: 'string', required: true },
64
+ * email: { type: 'string', format: 'email', required: true },
65
+ * age: { type: 'number', minimum: 0 }
66
+ * }, 'User');
67
+ *
68
+ * const validator = new Validator([userSchema]);
69
+ *
70
+ * const validUser = validator.validate({
71
+ * name: 'John Doe',
72
+ * email: 'john@example.com',
73
+ * age: 30
74
+ * }, 'User');
75
+ * // Returns: { name: 'John Doe', email: 'john@example.com', age: 30 }
76
+ * ```
77
+ *
78
+ * **Example - Normalization (String to Type Conversion):**
79
+ * ```typescript
80
+ * // Useful when receiving data from URLs or forms where types are strings
81
+ * const preferencesSchema = new Schema({
82
+ * height: { type: 'number' },
83
+ * isNotificationEnabled: { type: 'boolean' }
84
+ * }, 'Preferences');
85
+ *
86
+ * const validator = new Validator([preferencesSchema]);
87
+ *
88
+ * const normalized = validator.validate({
89
+ * height: '180', // String '180' → number 180
90
+ * isNotificationEnabled: '1' // String '1' → boolean true
91
+ * }, 'Preferences');
92
+ * // Returns: { height: 180, isNotificationEnabled: true }
93
+ * ```
94
+ *
95
+ * **Example - Cleanup (Remove Extra Attributes):**
96
+ * ```typescript
97
+ * const profileSchema = new Schema({
98
+ * name: { type: 'string', required: true },
99
+ * email: { type: 'string', required: true }
100
+ * }, 'Profile');
101
+ *
102
+ * const validator = new Validator([profileSchema]);
103
+ *
104
+ * const cleaned = validator.validate({
105
+ * name: 'John',
106
+ * email: 'john@example.com',
107
+ * extraField: 'should be removed',
108
+ * _internalId: 'should be removed'
109
+ * }, 'Profile', false, true);
110
+ * // Returns: { name: 'John', email: 'john@example.com' }
111
+ * // extraField and _internalId are removed
112
+ * ```
113
+ *
114
+ * **Example - Nullify Empty Values:**
115
+ * ```typescript
116
+ * const profileSchema = new Schema({
117
+ * name: { type: 'string', required: true },
118
+ * gender: { enum: ['Male', 'Female', 'Other'] }, // Optional
119
+ * mobileNumber: { type: 'string', pattern: '^\\d+$' } // Optional
120
+ * }, 'Profile');
121
+ *
122
+ * const validator = new Validator([profileSchema]);
123
+ *
124
+ * const result = validator.validate({
125
+ * name: 'John',
126
+ * gender: '', // Empty string for optional enum
127
+ * mobileNumber: '' // Empty string for optional pattern field
128
+ * }, 'Profile', true); // shouldNullifyEmptyValues = true
129
+ * // Returns: { name: 'John', gender: null, mobileNumber: null }
130
+ * // Empty values are converted to null for non-required fields
131
+ * ```
132
+ *
133
+ * **Example - Normalization Only (Without Validation):**
134
+ * ```typescript
135
+ * const preferencesSchema = new Schema({
136
+ * height: { type: 'number' },
137
+ * isNotificationEnabled: { type: 'boolean', default: false }
138
+ * }, 'Preferences');
139
+ *
140
+ * const validator = new Validator([preferencesSchema]);
141
+ *
142
+ * // Normalize without validation - useful for partial data
143
+ * const normalized = validator.normalize({
144
+ * height: '180'
145
+ * }, 'Preferences');
146
+ * // Returns: { height: 180, isNotificationEnabled: false }
147
+ * // Applies normalization and defaults without validation
148
+ * ```
149
+ *
150
+ * **Example - Error Handling:**
151
+ * ```typescript
152
+ * const validator = new Validator([userSchema]);
153
+ *
154
+ * try {
155
+ * validator.validate({
156
+ * name: '', // Empty required field
157
+ * email: 'invalid-email' // Invalid format
158
+ * }, 'User');
159
+ * } catch (error) {
160
+ * if (error instanceof ValidationError) {
161
+ * const errorDetails = error.toJSON();
162
+ * console.error(errorDetails.schemaId); // 'User'
163
+ * console.error(errorDetails.validationErrors);
164
+ * // [
165
+ * // { path: '#/name', code: 'MIN_LENGTH', message: '...' },
166
+ * // { path: '#/email', code: 'INVALID_FORMAT', message: '...' }
167
+ * // ]
168
+ * }
169
+ * }
170
+ * ```
171
+ *
172
+ * **Example - Schema References:**
173
+ * ```typescript
174
+ * const addressSchema = new Schema({
175
+ * street: { type: 'string', required: true },
176
+ * city: { type: 'string', required: true }
177
+ * }, 'Address');
178
+ *
179
+ * const userSchema = new Schema({
180
+ * name: { type: 'string', required: true },
181
+ * address: { $ref: 'Address' }
182
+ * }, 'User');
183
+ *
184
+ * const validator = new Validator([addressSchema, userSchema]);
185
+ *
186
+ * // Get all schemas referenced by User schema
187
+ * const referencedIds = validator.getReferenceIds('User');
188
+ * // Returns: ['Address']
189
+ * ```
190
+ *
191
+ * **Example - Multiple Schemas:**
192
+ * ```typescript
193
+ * const statusSchema = new Schema({ enum: ['ACTIVE', 'INACTIVE'] }, 'Status');
194
+ * const profileSchema = new Schema({
195
+ * name: { type: 'string', required: true },
196
+ * status: { $ref: 'Status' }
197
+ * }, 'Profile');
198
+ *
199
+ * const validator = new Validator([statusSchema, profileSchema]);
200
+ *
201
+ * const result = validator.validate({
202
+ * name: 'John',
203
+ * status: 'ACTIVE'
204
+ * }, 'Profile');
205
+ * ```
206
+ */
207
+ class Validator {
208
+ _engine;
209
+ _schemasMap;
210
+ _jsonSchemasMap;
211
+ /**
212
+ * Creates a validator instance for a collection of schemas.
213
+ *
214
+ * **Intent:** Initialize a validator with a set of schemas that can be used for validation
215
+ * and normalization. The constructor validates that all schemas are valid JSON schemas and
216
+ * that there are no duplicate schema IDs.
217
+ *
218
+ * **Use Cases:**
219
+ * - Initialize a validator with all schemas needed for an application
220
+ * - Set up a validator for a specific domain or module
221
+ * - Create validators for different environments (dev, staging, production)
222
+ *
223
+ * @param schemas - Array of Schema instances to register with this validator.
224
+ * All schemas must have unique IDs and valid JSON Schema structure.
225
+ * Referenced schemas (via $ref) must be included in this array.
226
+ *
227
+ * @throws Error if no schemas are provided
228
+ * @throws Error if multiple schemas have the same ID
229
+ * @throws Error if any schema has invalid JSON Schema structure or missing references
230
+ *
231
+ * **Example:**
232
+ * ```typescript
233
+ * const userSchema = new Schema({ name: { type: 'string' } }, 'User');
234
+ * const statusSchema = new Schema({ enum: ['ACTIVE', 'INACTIVE'] }, 'Status');
235
+ *
236
+ * const validator = new Validator([userSchema, statusSchema]);
237
+ * ```
238
+ *
239
+ * **Example - With Schema References:**
240
+ * ```typescript
241
+ * const addressSchema = new Schema({
242
+ * street: { type: 'string' }
243
+ * }, 'Address');
244
+ *
245
+ * const userSchema = new Schema({
246
+ * name: { type: 'string' },
247
+ * address: { $ref: 'Address' } // References Address schema
248
+ * }, 'User');
249
+ *
250
+ * // Both schemas must be provided
251
+ * const validator = new Validator([addressSchema, userSchema]);
252
+ * ```
253
+ */
254
+ constructor(schemas) {
255
+ if (!schemas) {
256
+ throw new Error('No schemas provided');
257
+ }
258
+ const groupsById = (0, lodash_1.groupBy)(schemas, 'id');
259
+ for (const id in groupsById) {
260
+ const schemas = groupsById[id];
261
+ const hasDuplicates = schemas.length > 1;
262
+ if (hasDuplicates) {
263
+ throw new Error(`Multiple schemas provided for ID: ${id}`);
264
+ }
265
+ }
266
+ this._engine = new z_schema_1.default({
267
+ reportPathAsArray: false,
268
+ ignoreUnknownFormats: true,
269
+ });
270
+ const jsonSchemas = schemas.map(({ jsonSchema }) => jsonSchema);
271
+ const isValid = this._engine.validateSchema(jsonSchemas);
272
+ if (!isValid) {
273
+ const { errors } = this._engine.lastReport;
274
+ const errorsJson = JSON.stringify(errors, null, 2);
275
+ throw new Error(`Schemas validation failed, errors: ${errorsJson}`);
276
+ }
277
+ this._schemasMap = (0, lodash_1.keyBy)(schemas, 'id');
278
+ this._jsonSchemasMap = (0, lodash_1.keyBy)(jsonSchemas, 'id');
279
+ }
280
+ /**
281
+ * Validates, cleans, and normalizes an object against a registered schema.
282
+ *
283
+ * **Intent:** Perform comprehensive validation and transformation of objects to ensure they
284
+ * conform to schema definitions. This method combines validation, attribute cleanup, type
285
+ * normalization, and optional empty value handling in a single operation.
286
+ *
287
+ * **Use Cases:**
288
+ * - Validate API request payloads before processing
289
+ * - Clean up objects by removing undefined attributes
290
+ * - Normalize data types from loosely-typed sources (URLs, forms, external APIs)
291
+ * - Handle empty values gracefully for optional fields
292
+ * - Prepare data for storage or transmission
293
+ *
294
+ * **Processing Pipeline:**
295
+ * 1. Deep clones the input object
296
+ * 2. Optionally removes null values (if `shouldCleanupNulls` is true)
297
+ * 3. Removes attributes not defined in the schema
298
+ * 4. Normalizes attribute types (string → number/boolean, etc.)
299
+ * 5. Validates against JSON Schema
300
+ * 6. Optionally nullifies empty values for non-required fields
301
+ * 7. Returns validated and normalized object, or throws ValidationError
302
+ *
303
+ * @param object - The object to validate and normalize
304
+ * @param schemaId - The ID of the schema to validate against (must be registered in constructor)
305
+ * @param shouldNullifyEmptyValues - If true, converts empty strings to null for non-required
306
+ * fields that fail format/pattern/enum validation. Useful for
307
+ * handling form submissions where empty fields are sent as ''.
308
+ * @param shouldCleanupNulls - If true, removes null values from the object before processing.
309
+ * Useful for cleaning up data structures.
310
+ *
311
+ * @returns The validated, cleaned, and normalized object
312
+ *
313
+ * @throws Error if schema with `schemaId` is not found
314
+ * @throws ValidationError if validation fails (contains detailed error information)
315
+ *
316
+ * **Example - Basic Validation:**
317
+ * ```typescript
318
+ * const validator = new Validator([userSchema]);
319
+ *
320
+ * const result = validator.validate({
321
+ * name: 'John',
322
+ * email: 'john@example.com'
323
+ * }, 'User');
324
+ * ```
325
+ *
326
+ * **Example - With Cleanup:**
327
+ * ```typescript
328
+ * const result = validator.validate({
329
+ * name: 'John',
330
+ * extraField: 'removed',
331
+ * nullField: null
332
+ * }, 'User', false, true);
333
+ * // extraField and nullField are removed
334
+ * ```
335
+ *
336
+ * **Example - With Normalization:**
337
+ * ```typescript
338
+ * const result = validator.validate({
339
+ * name: 'John',
340
+ * age: '30', // String → number
341
+ * isActive: 'true' // String → boolean
342
+ * }, 'User');
343
+ * // age becomes 30, isActive becomes true
344
+ * ```
345
+ *
346
+ * **Example - Nullify Empty Values:**
347
+ * ```typescript
348
+ * const result = validator.validate({
349
+ * name: 'John',
350
+ * optionalEmail: '', // Empty string
351
+ * optionalPhone: '' // Empty string
352
+ * }, 'User', true);
353
+ * // optionalEmail and optionalPhone become null (if not required)
354
+ * ```
355
+ *
356
+ * **Example - Error Handling:**
357
+ * ```typescript
358
+ * try {
359
+ * validator.validate({ name: '' }, 'User');
360
+ * } catch (error) {
361
+ * if (error instanceof ValidationError) {
362
+ * const details = error.toJSON();
363
+ * // Access error.schemaId, error.validationErrors, etc.
364
+ * }
365
+ * }
366
+ * ```
367
+ */
368
+ validate(object, schemaId, shouldNullifyEmptyValues = false, shouldCleanupNulls = false) {
369
+ const jsonSchema = (0, got_1.default)(this._jsonSchemasMap, schemaId, 'Schema "$PATH" not found');
370
+ const objectJson = JSON.stringify(object);
371
+ let result = JSON.parse(objectJson);
372
+ if (shouldCleanupNulls) {
373
+ result = (0, cleanupNulls_1.default)(result);
374
+ }
375
+ try {
376
+ // NOTE: Drop attributes from objects that are not defined in schema.
377
+ // This is bad for FE developers, as they continue to send some
378
+ // trash to endpoints, but good for integrations with third party
379
+ // services, e.g. Telegram, when you do not want to define schema
380
+ // for the full payload. This method currently fails for cases when
381
+ // attribute is defined as object or array in schema, but value is
382
+ // a string. In this case validation method below would catch that.
383
+ (0, cleanupAttributes_1.default)(result, jsonSchema, this._jsonSchemasMap);
384
+ // NOTE: Normalize method helps to integrate objects built from URLs,
385
+ // where types are not defined, e.g. booleans are '1', 'yes' string
386
+ // or numbers are '1', '2'... strings.
387
+ (0, normalizeAttributes_1.default)(result, jsonSchema, this._jsonSchemasMap);
388
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
389
+ }
390
+ catch (error) {
391
+ // NOTE: Skip errors in cleanup and normalize attributes methods.
392
+ // Validation would fail below for objects with invalid value types.
393
+ }
394
+ const isValid = this._engine.validate(result, jsonSchema);
395
+ if (isValid) {
396
+ return result;
397
+ }
398
+ const validationErrors = this._engine.getLastErrors();
399
+ if (!shouldNullifyEmptyValues) {
400
+ throw new ValidationError_1.default(schemaId, result, validationErrors);
401
+ }
402
+ const [nullifiedResult, updatedValidationErrors] = (0, nullifyEmptyValues_1.default)(result, validationErrors);
403
+ const hasValidationErrors = updatedValidationErrors.length > 0;
404
+ if (hasValidationErrors) {
405
+ throw new ValidationError_1.default(schemaId, result, updatedValidationErrors);
406
+ }
407
+ return nullifiedResult;
408
+ }
409
+ /**
410
+ * Normalizes object attributes using a schema without performing validation.
411
+ *
412
+ * **Intent:** Apply type normalization and default values to an object without the strictness
413
+ * of full validation. This is useful when you want to transform data types but don't need
414
+ * complete schema compliance, or when working with partial/incomplete data.
415
+ *
416
+ * **Use Cases:**
417
+ * - Normalize data types from loosely-typed sources (URLs, query parameters, forms)
418
+ * - Apply default values from schemas to partial objects
419
+ * - Transform data before validation in a separate step
420
+ * - Prepare data for display or processing without strict validation
421
+ * - Handle partial updates where not all fields are present
422
+ *
423
+ * **What It Does:**
424
+ * - Deep clones the input object
425
+ * - Normalizes attribute types (string '1' → boolean true, string '180' → number 180)
426
+ * - Applies default values from schema definitions
427
+ * - Does NOT validate required fields, formats, patterns, or enums
428
+ * - Does NOT remove undefined attributes
429
+ *
430
+ * @param object - The object to normalize
431
+ * @param schemaId - The ID of the schema to use for normalization (must be registered)
432
+ *
433
+ * @returns A new object with normalized types and applied defaults
434
+ *
435
+ * @throws Error if schema with `schemaId` is not found
436
+ *
437
+ * **Example - Type Normalization:**
438
+ * ```typescript
439
+ * const preferencesSchema = new Schema({
440
+ * height: { type: 'number' },
441
+ * isNotificationEnabled: { type: 'boolean', default: false }
442
+ * }, 'Preferences');
443
+ *
444
+ * const validator = new Validator([preferencesSchema]);
445
+ *
446
+ * const normalized = validator.normalize({
447
+ * height: '180', // String → number
448
+ * isNotificationEnabled: '1' // String '1' → boolean true
449
+ * }, 'Preferences');
450
+ * // Returns: { height: 180, isNotificationEnabled: true }
451
+ * ```
452
+ *
453
+ * **Example - Apply Defaults:**
454
+ * ```typescript
455
+ * const userSchema = new Schema({
456
+ * name: { type: 'string', required: true },
457
+ * status: { enum: ['ACTIVE', 'INACTIVE'], default: 'ACTIVE' },
458
+ * role: { enum: ['USER', 'ADMIN'], default: 'USER' }
459
+ * }, 'User');
460
+ *
461
+ * const validator = new Validator([userSchema]);
462
+ *
463
+ * const normalized = validator.normalize({
464
+ * name: 'John'
465
+ * // status and role are not provided
466
+ * }, 'User');
467
+ * // Returns: { name: 'John', status: 'ACTIVE', role: 'USER' }
468
+ * ```
469
+ *
470
+ * **Example - Partial Data:**
471
+ * ```typescript
472
+ * // Useful for partial updates where validation might fail
473
+ * const partial = validator.normalize({
474
+ * age: '25' // Only updating age, other fields missing
475
+ * }, 'User');
476
+ * // Normalizes age to number without requiring other fields
477
+ * ```
478
+ */
479
+ normalize(object, schemaId) {
480
+ const jsonSchema = (0, got_1.default)(this._jsonSchemasMap, schemaId, 'Schema "$PATH" not found');
481
+ const result = JSON.parse(JSON.stringify(object));
482
+ (0, normalizeAttributes_1.default)(result, jsonSchema, this._jsonSchemasMap);
483
+ return result;
484
+ }
485
+ /**
486
+ * Returns a map of all registered schemas by their IDs.
487
+ *
488
+ * **Intent:** Provide access to all schemas registered with this validator, enabling
489
+ * inspection, iteration, or programmatic access to schema definitions.
490
+ *
491
+ * **Use Cases:**
492
+ * - Inspect all available schemas
493
+ * - Iterate over schemas for bulk operations
494
+ * - Access schema metadata or properties
495
+ * - Build UI components that list available schemas
496
+ * - Debug schema registration
497
+ *
498
+ * @returns A record mapping schema IDs to Schema instances
499
+ *
500
+ * **Example:**
501
+ * ```typescript
502
+ * const validator = new Validator([userSchema, statusSchema]);
503
+ *
504
+ * const schemas = validator.schemasMap;
505
+ * // { 'User': Schema instance, 'Status': Schema instance }
506
+ *
507
+ * // Access a specific schema
508
+ * const userSchema = schemas['User'];
509
+ *
510
+ * // Iterate over all schemas
511
+ * Object.keys(schemas).forEach(id => {
512
+ * console.log(`Schema ${id} is registered`);
513
+ * });
514
+ * ```
515
+ */
516
+ get schemasMap() {
517
+ return this._schemasMap;
518
+ }
519
+ /**
520
+ * Returns the IDs of all schemas referenced by the specified schema.
521
+ *
522
+ * **Intent:** Discover schema dependencies by finding all schemas referenced via `$ref`
523
+ * in a given schema. This is useful for understanding schema relationships and building
524
+ * dependency graphs.
525
+ *
526
+ * **Use Cases:**
527
+ * - Build schema dependency graphs
528
+ * - Validate that all referenced schemas are available
529
+ * - Generate documentation showing schema relationships
530
+ * - Determine which schemas need to be loaded together
531
+ * - Debug schema reference issues
532
+ *
533
+ * @param schemaId - The ID of the schema to analyze for references
534
+ *
535
+ * @returns An array of schema IDs that are referenced by the specified schema
536
+ *
537
+ * @throws Error if schema with `schemaId` is not found
538
+ *
539
+ * **Example:**
540
+ * ```typescript
541
+ * const addressSchema = new Schema({
542
+ * street: { type: 'string' }
543
+ * }, 'Address');
544
+ *
545
+ * const userSchema = new Schema({
546
+ * name: { type: 'string' },
547
+ * address: { $ref: 'Address' },
548
+ * status: { $ref: 'Status' }
549
+ * }, 'User');
550
+ *
551
+ * const validator = new Validator([addressSchema, statusSchema, userSchema]);
552
+ *
553
+ * const references = validator.getReferenceIds('User');
554
+ * // Returns: ['Address', 'Status']
555
+ * ```
556
+ *
557
+ * **Example - Nested References:**
558
+ * ```typescript
559
+ * // If Address schema also references Country schema
560
+ * const references = validator.getReferenceIds('User');
561
+ * // Returns: ['Address', 'Status', 'Country'] (includes nested references)
562
+ * ```
563
+ */
564
+ getReferenceIds(schemaId) {
565
+ const schema = (0, got_1.default)(this.schemasMap, schemaId, 'Schema "$PATH" not found');
566
+ return (0, getReferenceIds_1.default)(schema, this._schemasMap);
567
+ }
568
+ }
569
+ exports.default = Validator;
570
+ //# sourceMappingURL=Validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Validator.js","sourceRoot":"","sources":["../src/Validator.ts"],"names":[],"mappings":";;;;;AAAA,wDAA+B;AAC/B,mCAAwC;AAExC,wDAAgC;AAEhC,0EAAkD;AAClD,gFAAwD;AACxD,wEAAgD;AAChD,oFAA4D;AAC5D,sFAA8D;AAC9D,wFAAgE;AAGhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4CG;IACH,eAAe,CAAC,QAAgB;QAC9B,MAAM,MAAM,GAAG,IAAA,aAAG,EAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,0BAA0B,CAAC,CAAC;QAE1E,OAAO,IAAA,yBAAe,EAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACnD,CAAC;CACF;AAED,kBAAe,SAAS,CAAC"}
@@ -0,0 +1,99 @@
1
+ export type EnumSchema = {
2
+ id?: string;
3
+ enum: string[] | number[];
4
+ type?: 'string' | 'number';
5
+ default?: string | number;
6
+ example?: string | number;
7
+ required?: boolean;
8
+ 'x-title'?: string;
9
+ description?: string;
10
+ 'x-required'?: boolean;
11
+ };
12
+ export type ReferencePropertySchema = {
13
+ $ref: string;
14
+ default?: string | number | Record<string, unknown>;
15
+ example?: string | number | Record<string, unknown>;
16
+ required?: boolean;
17
+ 'x-title'?: string;
18
+ description?: string;
19
+ 'x-required'?: boolean;
20
+ };
21
+ export type StringPropertySchema = {
22
+ '@type'?: string;
23
+ type?: 'string';
24
+ format?: 'date' | 'date-time' | 'url' | 'email';
25
+ default?: string;
26
+ example?: string;
27
+ pattern?: string;
28
+ required?: boolean;
29
+ minLength?: number;
30
+ maxLength?: number;
31
+ 'x-title'?: string;
32
+ description?: string;
33
+ 'x-required'?: boolean;
34
+ };
35
+ export type NumberPropertySchema = {
36
+ type: 'number';
37
+ minimum?: number;
38
+ maximum?: number;
39
+ default?: number;
40
+ example?: number;
41
+ required?: boolean;
42
+ 'x-title'?: string;
43
+ description?: string;
44
+ 'x-required'?: boolean;
45
+ };
46
+ export type IntegerPropertySchema = {
47
+ type: 'integer';
48
+ minimum?: number;
49
+ maximum?: number;
50
+ default?: number;
51
+ example?: number;
52
+ required?: boolean;
53
+ 'x-title'?: string;
54
+ description?: string;
55
+ 'x-required'?: boolean;
56
+ };
57
+ export type BooleanPropertySchema = {
58
+ type: 'boolean';
59
+ default?: boolean;
60
+ example?: boolean;
61
+ required?: boolean;
62
+ 'x-title'?: string;
63
+ description?: string;
64
+ 'x-required'?: boolean;
65
+ };
66
+ export type ObjectPropertySchema = {
67
+ type?: 'object';
68
+ default?: Record<string, unknown>;
69
+ example?: unknown;
70
+ required?: boolean;
71
+ properties?: PropertiesSchema;
72
+ 'x-title'?: string;
73
+ description?: string;
74
+ 'x-required'?: boolean;
75
+ };
76
+ export type ArrayPropertySchema = {
77
+ type?: 'array';
78
+ items?: (ReferencePropertySchema | ObjectPropertySchema | StringPropertySchema | EnumSchema) & {
79
+ minItems?: number;
80
+ maxItems?: number;
81
+ };
82
+ default?: unknown[];
83
+ example?: unknown[];
84
+ required?: boolean;
85
+ 'x-title'?: string;
86
+ description?: string;
87
+ 'x-required'?: boolean;
88
+ };
89
+ export type PropertySchema = EnumSchema | ReferencePropertySchema | ObjectPropertySchema | ArrayPropertySchema | StringPropertySchema | NumberPropertySchema | IntegerPropertySchema | BooleanPropertySchema;
90
+ export type PropertiesSchema = Record<string, PropertySchema>;
91
+ export type ObjectSchema = {
92
+ id: string;
93
+ required?: string[];
94
+ properties: PropertiesSchema;
95
+ };
96
+ export type JsonSchema = EnumSchema | ObjectSchema;
97
+ export type JsonSchemasMap = Record<string, JsonSchema>;
98
+ export type TargetObject = Record<string, unknown>;
99
+ //# sourceMappingURL=JsonSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonSchema.d.ts","sourceRoot":"","sources":["../../src/helpers/JsonSchema.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,MA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