@open-captable-protocol/canton 0.2.145 → 0.2.147

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.
@@ -0,0 +1,225 @@
1
+ /**
2
+ * Centralized input validation utilities for OCF operations.
3
+ *
4
+ * These utilities provide consistent, actionable error messages and
5
+ * reduce duplicated validation logic across the codebase.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { validateRequiredString, validateRequiredNumeric, ValidationError } from './validation';
10
+ *
11
+ * function createStakeholder(params: CreateStakeholderParams) {
12
+ * validateRequiredString(params.data.id, 'stakeholder.id');
13
+ * validateRequiredString(params.data.name.legal_name, 'stakeholder.name.legal_name');
14
+ * // ...
15
+ * }
16
+ * ```
17
+ */
18
+ /**
19
+ * Custom error class for validation failures.
20
+ * Includes the field path for easier debugging.
21
+ */
22
+ export declare class ValidationError extends Error {
23
+ /** The field path that failed validation (e.g., "stakeholder.name.legal_name") */
24
+ readonly fieldPath: string;
25
+ /** The expected type or format */
26
+ readonly expected: string;
27
+ /** The actual value received (stringified for display) */
28
+ readonly received: string;
29
+ constructor(fieldPath: string, expected: string, received: unknown);
30
+ }
31
+ /**
32
+ * Validate that a value is a non-empty string.
33
+ *
34
+ * @param value - The value to validate
35
+ * @param fieldPath - Dot-notation path for error messages (e.g., "stakeholder.id")
36
+ * @throws {ValidationError} if the value is not a non-empty string
37
+ */
38
+ export declare function validateRequiredString(value: unknown, fieldPath: string): asserts value is string;
39
+ /**
40
+ * Validate that a value is a string or undefined/null.
41
+ * Returns the string or null for DAML optional fields.
42
+ *
43
+ * @param value - The value to validate
44
+ * @param fieldPath - Dot-notation path for error messages
45
+ * @returns The string value or null
46
+ * @throws {ValidationError} if the value is not a string, undefined, or null
47
+ */
48
+ export declare function validateOptionalString(value: unknown, fieldPath: string): string | null;
49
+ /**
50
+ * Validate that a value is a valid numeric (number or numeric string).
51
+ *
52
+ * @param value - The value to validate
53
+ * @param fieldPath - Dot-notation path for error messages
54
+ * @throws {ValidationError} if the value is not a valid numeric
55
+ */
56
+ export declare function validateRequiredNumeric(value: unknown, fieldPath: string): asserts value is string | number;
57
+ /**
58
+ * Validate and convert a numeric value to string for DAML.
59
+ * Returns null for undefined/null values.
60
+ *
61
+ * @param value - The value to validate
62
+ * @param fieldPath - Dot-notation path for error messages
63
+ * @returns The numeric value as a string, or null
64
+ */
65
+ export declare function validateOptionalNumeric(value: unknown, fieldPath: string): string | null;
66
+ /**
67
+ * Validate that a numeric value is within a range (inclusive).
68
+ *
69
+ * @param value - The value to validate
70
+ * @param fieldPath - Dot-notation path for error messages
71
+ * @param min - Minimum allowed value
72
+ * @param max - Maximum allowed value
73
+ * @throws {ValidationError} if the value is outside the range
74
+ */
75
+ export declare function validateNumericRange(value: number | string, fieldPath: string, min: number, max: number): void;
76
+ /**
77
+ * Validate that a numeric value is positive (> 0).
78
+ *
79
+ * @param value - The value to validate
80
+ * @param fieldPath - Dot-notation path for error messages
81
+ * @throws {ValidationError} if the value is not positive
82
+ */
83
+ export declare function validatePositiveNumeric(value: number | string, fieldPath: string): void;
84
+ /**
85
+ * Validate that a numeric value is non-negative (>= 0).
86
+ *
87
+ * @param value - The value to validate
88
+ * @param fieldPath - Dot-notation path for error messages
89
+ * @throws {ValidationError} if the value is negative
90
+ */
91
+ export declare function validateNonNegativeNumeric(value: number | string, fieldPath: string): void;
92
+ /**
93
+ * Validate that a value is a valid ISO date string (YYYY-MM-DD).
94
+ *
95
+ * @param value - The value to validate
96
+ * @param fieldPath - Dot-notation path for error messages
97
+ * @throws {ValidationError} if the value is not a valid ISO date string
98
+ */
99
+ export declare function validateRequiredDate(value: unknown, fieldPath: string): asserts value is string;
100
+ /**
101
+ * Validate that a value is a valid ISO date string or undefined/null.
102
+ *
103
+ * @param value - The value to validate
104
+ * @param fieldPath - Dot-notation path for error messages
105
+ * @returns The date string or null
106
+ */
107
+ export declare function validateOptionalDate(value: unknown, fieldPath: string): string | null;
108
+ /**
109
+ * Validate that a value is one of the allowed enum values.
110
+ *
111
+ * @param value - The value to validate
112
+ * @param fieldPath - Dot-notation path for error messages
113
+ * @param allowedValues - Array of allowed values
114
+ * @throws {ValidationError} if the value is not in the allowed list
115
+ */
116
+ export declare function validateEnum<T extends string>(value: unknown, fieldPath: string, allowedValues: readonly T[]): asserts value is T;
117
+ /**
118
+ * Validate an optional enum value.
119
+ *
120
+ * @param value - The value to validate
121
+ * @param fieldPath - Dot-notation path for error messages
122
+ * @param allowedValues - Array of allowed values
123
+ * @returns The value or null
124
+ */
125
+ export declare function validateOptionalEnum<T extends string>(value: unknown, fieldPath: string, allowedValues: readonly T[]): T | null;
126
+ /**
127
+ * Validate that a value is a non-empty array.
128
+ *
129
+ * @param value - The value to validate
130
+ * @param fieldPath - Dot-notation path for error messages
131
+ * @throws {ValidationError} if the value is not a non-empty array
132
+ */
133
+ export declare function validateRequiredArray<T>(value: unknown, fieldPath: string): asserts value is T[];
134
+ /**
135
+ * Validate an optional array (can be undefined/null or array with items).
136
+ *
137
+ * @param value - The value to validate
138
+ * @param fieldPath - Dot-notation path for error messages
139
+ * @returns The array or null
140
+ */
141
+ export declare function validateOptionalArray<T>(value: unknown, fieldPath: string): T[] | null;
142
+ /**
143
+ * Validate that a value is a non-null object.
144
+ *
145
+ * @param value - The value to validate
146
+ * @param fieldPath - Dot-notation path for error messages
147
+ * @throws {ValidationError} if the value is not a non-null object
148
+ */
149
+ export declare function validateRequiredObject(value: unknown, fieldPath: string): asserts value is Record<string, unknown>;
150
+ /**
151
+ * Validate an optional object.
152
+ *
153
+ * @param value - The value to validate
154
+ * @param fieldPath - Dot-notation path for error messages
155
+ * @returns The object or null
156
+ */
157
+ export declare function validateOptionalObject(value: unknown, fieldPath: string): Record<string, unknown> | null;
158
+ /**
159
+ * Monetary object structure for validation.
160
+ */
161
+ export interface ValidatedMonetary {
162
+ amount: string;
163
+ currency: string;
164
+ }
165
+ /**
166
+ * Validate that a value is a valid Monetary object.
167
+ *
168
+ * @param value - The value to validate
169
+ * @param fieldPath - Dot-notation path for error messages
170
+ * @throws {ValidationError} if the value is not a valid Monetary object
171
+ */
172
+ export declare function validateRequiredMonetary(value: unknown, fieldPath: string): asserts value is ValidatedMonetary;
173
+ /**
174
+ * Validate an optional Monetary object.
175
+ *
176
+ * @param value - The value to validate
177
+ * @param fieldPath - Dot-notation path for error messages
178
+ * @returns The validated monetary object or null
179
+ */
180
+ export declare function validateOptionalMonetary(value: unknown, fieldPath: string): ValidatedMonetary | null;
181
+ /**
182
+ * Validate that a value is a valid Canton contract ID.
183
+ * Contract IDs are typically in format: hexdigits:hexdigits or just hexdigits.
184
+ *
185
+ * @param value - The value to validate
186
+ * @param fieldPath - Dot-notation path for error messages
187
+ * @throws {ValidationError} if the value is not a valid contract ID
188
+ */
189
+ export declare function validateContractId(value: unknown, fieldPath: string): asserts value is string;
190
+ /**
191
+ * Validate that a value is a valid Canton party ID.
192
+ * Party IDs typically follow the format: identifier::fingerprint
193
+ *
194
+ * @param value - The value to validate
195
+ * @param fieldPath - Dot-notation path for error messages
196
+ * @throws {ValidationError} if the value is not a valid party ID
197
+ */
198
+ export declare function validatePartyId(value: unknown, fieldPath: string): asserts value is string;
199
+ /**
200
+ * Validate all items in an array using a validator function.
201
+ *
202
+ * @param items - The array of items to validate
203
+ * @param fieldPath - Base path for error messages
204
+ * @param itemValidator - Function to validate each item
205
+ */
206
+ export declare function validateArrayItems<T>(items: unknown[], fieldPath: string, itemValidator: (item: unknown, itemPath: string) => asserts item is T): asserts items is T[];
207
+ /**
208
+ * Create a composite validator that runs multiple validations.
209
+ *
210
+ * @example
211
+ * ```typescript
212
+ * const validateStakeholder = createValidator<OcfStakeholder>(
213
+ * (value, path) => {
214
+ * validateRequiredString(value.id, `${path}.id`);
215
+ * validateRequiredObject(value.name, `${path}.name`);
216
+ * validateRequiredString(value.name?.legal_name, `${path}.name.legal_name`);
217
+ * validateEnum(value.stakeholder_type, `${path}.stakeholder_type`, ['INDIVIDUAL', 'INSTITUTION']);
218
+ * }
219
+ * );
220
+ *
221
+ * validateStakeholder(data, 'stakeholder');
222
+ * ```
223
+ */
224
+ export declare function createValidator<T>(validatorFn: (value: Record<string, unknown>, fieldPath: string) => void): (value: unknown, fieldPath: string) => asserts value is T;
225
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,kFAAkF;IAClF,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,kCAAkC;IAClC,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,0DAA0D;IAC1D,SAAgB,QAAQ,EAAE,MAAM,CAAC;gBAErB,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO;CASnE;AAID;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM,CAOjG;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQvF;AAID;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM,GAAG,MAAM,CAkB3G;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMxF;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GA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AM,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,GACvE,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,IAAI,CAAC,CAK3D"}
@@ -0,0 +1,401 @@
1
+ "use strict";
2
+ /**
3
+ * Centralized input validation utilities for OCF operations.
4
+ *
5
+ * These utilities provide consistent, actionable error messages and
6
+ * reduce duplicated validation logic across the codebase.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { validateRequiredString, validateRequiredNumeric, ValidationError } from './validation';
11
+ *
12
+ * function createStakeholder(params: CreateStakeholderParams) {
13
+ * validateRequiredString(params.data.id, 'stakeholder.id');
14
+ * validateRequiredString(params.data.name.legal_name, 'stakeholder.name.legal_name');
15
+ * // ...
16
+ * }
17
+ * ```
18
+ */
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.ValidationError = void 0;
21
+ exports.validateRequiredString = validateRequiredString;
22
+ exports.validateOptionalString = validateOptionalString;
23
+ exports.validateRequiredNumeric = validateRequiredNumeric;
24
+ exports.validateOptionalNumeric = validateOptionalNumeric;
25
+ exports.validateNumericRange = validateNumericRange;
26
+ exports.validatePositiveNumeric = validatePositiveNumeric;
27
+ exports.validateNonNegativeNumeric = validateNonNegativeNumeric;
28
+ exports.validateRequiredDate = validateRequiredDate;
29
+ exports.validateOptionalDate = validateOptionalDate;
30
+ exports.validateEnum = validateEnum;
31
+ exports.validateOptionalEnum = validateOptionalEnum;
32
+ exports.validateRequiredArray = validateRequiredArray;
33
+ exports.validateOptionalArray = validateOptionalArray;
34
+ exports.validateRequiredObject = validateRequiredObject;
35
+ exports.validateOptionalObject = validateOptionalObject;
36
+ exports.validateRequiredMonetary = validateRequiredMonetary;
37
+ exports.validateOptionalMonetary = validateOptionalMonetary;
38
+ exports.validateContractId = validateContractId;
39
+ exports.validatePartyId = validatePartyId;
40
+ exports.validateArrayItems = validateArrayItems;
41
+ exports.createValidator = createValidator;
42
+ /**
43
+ * Custom error class for validation failures.
44
+ * Includes the field path for easier debugging.
45
+ */
46
+ class ValidationError extends Error {
47
+ constructor(fieldPath, expected, received) {
48
+ const receivedStr = received === undefined ? 'undefined' : received === null ? 'null' : JSON.stringify(received);
49
+ const message = `Validation failed for '${fieldPath}': expected ${expected}, received ${receivedStr}`;
50
+ super(message);
51
+ this.name = 'ValidationError';
52
+ this.fieldPath = fieldPath;
53
+ this.expected = expected;
54
+ this.received = receivedStr;
55
+ }
56
+ }
57
+ exports.ValidationError = ValidationError;
58
+ // ===== String Validation =====
59
+ /**
60
+ * Validate that a value is a non-empty string.
61
+ *
62
+ * @param value - The value to validate
63
+ * @param fieldPath - Dot-notation path for error messages (e.g., "stakeholder.id")
64
+ * @throws {ValidationError} if the value is not a non-empty string
65
+ */
66
+ function validateRequiredString(value, fieldPath) {
67
+ if (typeof value !== 'string') {
68
+ throw new ValidationError(fieldPath, 'non-empty string', value);
69
+ }
70
+ if (value.length === 0) {
71
+ throw new ValidationError(fieldPath, 'non-empty string', '""');
72
+ }
73
+ }
74
+ /**
75
+ * Validate that a value is a string or undefined/null.
76
+ * Returns the string or null for DAML optional fields.
77
+ *
78
+ * @param value - The value to validate
79
+ * @param fieldPath - Dot-notation path for error messages
80
+ * @returns The string value or null
81
+ * @throws {ValidationError} if the value is not a string, undefined, or null
82
+ */
83
+ function validateOptionalString(value, fieldPath) {
84
+ if (value === undefined || value === null) {
85
+ return null;
86
+ }
87
+ if (typeof value !== 'string') {
88
+ throw new ValidationError(fieldPath, 'string, undefined, or null', value);
89
+ }
90
+ return value.length > 0 ? value : null;
91
+ }
92
+ // ===== Numeric Validation =====
93
+ /**
94
+ * Validate that a value is a valid numeric (number or numeric string).
95
+ *
96
+ * @param value - The value to validate
97
+ * @param fieldPath - Dot-notation path for error messages
98
+ * @throws {ValidationError} if the value is not a valid numeric
99
+ */
100
+ function validateRequiredNumeric(value, fieldPath) {
101
+ if (typeof value === 'number') {
102
+ if (Number.isNaN(value)) {
103
+ throw new ValidationError(fieldPath, 'valid number', 'NaN');
104
+ }
105
+ return;
106
+ }
107
+ if (typeof value === 'string') {
108
+ if (value.length === 0) {
109
+ throw new ValidationError(fieldPath, 'non-empty numeric string', '""');
110
+ }
111
+ const num = Number(value);
112
+ if (Number.isNaN(num)) {
113
+ throw new ValidationError(fieldPath, 'valid numeric string', value);
114
+ }
115
+ return;
116
+ }
117
+ throw new ValidationError(fieldPath, 'number or numeric string', value);
118
+ }
119
+ /**
120
+ * Validate and convert a numeric value to string for DAML.
121
+ * Returns null for undefined/null values.
122
+ *
123
+ * @param value - The value to validate
124
+ * @param fieldPath - Dot-notation path for error messages
125
+ * @returns The numeric value as a string, or null
126
+ */
127
+ function validateOptionalNumeric(value, fieldPath) {
128
+ if (value === undefined || value === null) {
129
+ return null;
130
+ }
131
+ validateRequiredNumeric(value, fieldPath);
132
+ return typeof value === 'number' ? value.toString() : value;
133
+ }
134
+ /**
135
+ * Validate that a numeric value is within a range (inclusive).
136
+ *
137
+ * @param value - The value to validate
138
+ * @param fieldPath - Dot-notation path for error messages
139
+ * @param min - Minimum allowed value
140
+ * @param max - Maximum allowed value
141
+ * @throws {ValidationError} if the value is outside the range
142
+ */
143
+ function validateNumericRange(value, fieldPath, min, max) {
144
+ const num = typeof value === 'string' ? Number(value) : value;
145
+ if (num < min || num > max) {
146
+ throw new ValidationError(fieldPath, `number between ${min} and ${max}`, num);
147
+ }
148
+ }
149
+ /**
150
+ * Validate that a numeric value is positive (> 0).
151
+ *
152
+ * @param value - The value to validate
153
+ * @param fieldPath - Dot-notation path for error messages
154
+ * @throws {ValidationError} if the value is not positive
155
+ */
156
+ function validatePositiveNumeric(value, fieldPath) {
157
+ const num = typeof value === 'string' ? Number(value) : value;
158
+ if (num <= 0) {
159
+ throw new ValidationError(fieldPath, 'positive number (> 0)', num);
160
+ }
161
+ }
162
+ /**
163
+ * Validate that a numeric value is non-negative (>= 0).
164
+ *
165
+ * @param value - The value to validate
166
+ * @param fieldPath - Dot-notation path for error messages
167
+ * @throws {ValidationError} if the value is negative
168
+ */
169
+ function validateNonNegativeNumeric(value, fieldPath) {
170
+ const num = typeof value === 'string' ? Number(value) : value;
171
+ if (num < 0) {
172
+ throw new ValidationError(fieldPath, 'non-negative number (>= 0)', num);
173
+ }
174
+ }
175
+ // ===== Date Validation =====
176
+ /**
177
+ * Validate that a value is a valid ISO date string (YYYY-MM-DD).
178
+ *
179
+ * @param value - The value to validate
180
+ * @param fieldPath - Dot-notation path for error messages
181
+ * @throws {ValidationError} if the value is not a valid ISO date string
182
+ */
183
+ function validateRequiredDate(value, fieldPath) {
184
+ if (typeof value !== 'string') {
185
+ throw new ValidationError(fieldPath, 'ISO date string (YYYY-MM-DD)', value);
186
+ }
187
+ const match = /^\d{4}-\d{2}-\d{2}$/.exec(value);
188
+ if (!match) {
189
+ throw new ValidationError(fieldPath, 'ISO date string (YYYY-MM-DD)', value);
190
+ }
191
+ const date = new Date(value);
192
+ if (Number.isNaN(date.getTime())) {
193
+ throw new ValidationError(fieldPath, 'valid date', value);
194
+ }
195
+ }
196
+ /**
197
+ * Validate that a value is a valid ISO date string or undefined/null.
198
+ *
199
+ * @param value - The value to validate
200
+ * @param fieldPath - Dot-notation path for error messages
201
+ * @returns The date string or null
202
+ */
203
+ function validateOptionalDate(value, fieldPath) {
204
+ if (value === undefined || value === null) {
205
+ return null;
206
+ }
207
+ validateRequiredDate(value, fieldPath);
208
+ return value;
209
+ }
210
+ // ===== Enum Validation =====
211
+ /**
212
+ * Validate that a value is one of the allowed enum values.
213
+ *
214
+ * @param value - The value to validate
215
+ * @param fieldPath - Dot-notation path for error messages
216
+ * @param allowedValues - Array of allowed values
217
+ * @throws {ValidationError} if the value is not in the allowed list
218
+ */
219
+ function validateEnum(value, fieldPath, allowedValues) {
220
+ if (typeof value !== 'string') {
221
+ throw new ValidationError(fieldPath, `one of: ${allowedValues.join(', ')}`, value);
222
+ }
223
+ if (!allowedValues.includes(value)) {
224
+ throw new ValidationError(fieldPath, `one of: ${allowedValues.join(', ')}`, value);
225
+ }
226
+ }
227
+ /**
228
+ * Validate an optional enum value.
229
+ *
230
+ * @param value - The value to validate
231
+ * @param fieldPath - Dot-notation path for error messages
232
+ * @param allowedValues - Array of allowed values
233
+ * @returns The value or null
234
+ */
235
+ function validateOptionalEnum(value, fieldPath, allowedValues) {
236
+ if (value === undefined || value === null) {
237
+ return null;
238
+ }
239
+ validateEnum(value, fieldPath, allowedValues);
240
+ return value;
241
+ }
242
+ // ===== Array Validation =====
243
+ /**
244
+ * Validate that a value is a non-empty array.
245
+ *
246
+ * @param value - The value to validate
247
+ * @param fieldPath - Dot-notation path for error messages
248
+ * @throws {ValidationError} if the value is not a non-empty array
249
+ */
250
+ function validateRequiredArray(value, fieldPath) {
251
+ if (!Array.isArray(value)) {
252
+ throw new ValidationError(fieldPath, 'non-empty array', value);
253
+ }
254
+ if (value.length === 0) {
255
+ throw new ValidationError(fieldPath, 'non-empty array', '[]');
256
+ }
257
+ }
258
+ /**
259
+ * Validate an optional array (can be undefined/null or array with items).
260
+ *
261
+ * @param value - The value to validate
262
+ * @param fieldPath - Dot-notation path for error messages
263
+ * @returns The array or null
264
+ */
265
+ function validateOptionalArray(value, fieldPath) {
266
+ if (value === undefined || value === null) {
267
+ return null;
268
+ }
269
+ if (!Array.isArray(value)) {
270
+ throw new ValidationError(fieldPath, 'array, undefined, or null', value);
271
+ }
272
+ return value.length > 0 ? value : null;
273
+ }
274
+ // ===== Object Validation =====
275
+ /**
276
+ * Validate that a value is a non-null object.
277
+ *
278
+ * @param value - The value to validate
279
+ * @param fieldPath - Dot-notation path for error messages
280
+ * @throws {ValidationError} if the value is not a non-null object
281
+ */
282
+ function validateRequiredObject(value, fieldPath) {
283
+ if (typeof value !== 'object' || value === null) {
284
+ throw new ValidationError(fieldPath, 'non-null object', value);
285
+ }
286
+ }
287
+ /**
288
+ * Validate an optional object.
289
+ *
290
+ * @param value - The value to validate
291
+ * @param fieldPath - Dot-notation path for error messages
292
+ * @returns The object or null
293
+ */
294
+ function validateOptionalObject(value, fieldPath) {
295
+ if (value === undefined || value === null) {
296
+ return null;
297
+ }
298
+ validateRequiredObject(value, fieldPath);
299
+ return value;
300
+ }
301
+ /**
302
+ * Validate that a value is a valid Monetary object.
303
+ *
304
+ * @param value - The value to validate
305
+ * @param fieldPath - Dot-notation path for error messages
306
+ * @throws {ValidationError} if the value is not a valid Monetary object
307
+ */
308
+ function validateRequiredMonetary(value, fieldPath) {
309
+ validateRequiredObject(value, fieldPath);
310
+ const obj = value;
311
+ validateRequiredNumeric(obj.amount, `${fieldPath}.amount`);
312
+ validateRequiredString(obj.currency, `${fieldPath}.currency`);
313
+ }
314
+ /**
315
+ * Validate an optional Monetary object.
316
+ *
317
+ * @param value - The value to validate
318
+ * @param fieldPath - Dot-notation path for error messages
319
+ * @returns The validated monetary object or null
320
+ */
321
+ function validateOptionalMonetary(value, fieldPath) {
322
+ if (value === undefined || value === null) {
323
+ return null;
324
+ }
325
+ validateRequiredMonetary(value, fieldPath);
326
+ const obj = value;
327
+ return {
328
+ amount: typeof obj.amount === 'number' ? obj.amount.toString() : obj.amount,
329
+ currency: obj.currency,
330
+ };
331
+ }
332
+ // ===== Contract ID Validation =====
333
+ /**
334
+ * Validate that a value is a valid Canton contract ID.
335
+ * Contract IDs are typically in format: hexdigits:hexdigits or just hexdigits.
336
+ *
337
+ * @param value - The value to validate
338
+ * @param fieldPath - Dot-notation path for error messages
339
+ * @throws {ValidationError} if the value is not a valid contract ID
340
+ */
341
+ function validateContractId(value, fieldPath) {
342
+ validateRequiredString(value, fieldPath);
343
+ // Contract IDs should be non-empty strings; the exact format is flexible
344
+ // but they should not contain whitespace
345
+ if (/\s/.test(value)) {
346
+ throw new ValidationError(fieldPath, 'contract ID without whitespace', value);
347
+ }
348
+ }
349
+ // ===== Party ID Validation =====
350
+ /**
351
+ * Validate that a value is a valid Canton party ID.
352
+ * Party IDs typically follow the format: identifier::fingerprint
353
+ *
354
+ * @param value - The value to validate
355
+ * @param fieldPath - Dot-notation path for error messages
356
+ * @throws {ValidationError} if the value is not a valid party ID
357
+ */
358
+ function validatePartyId(value, fieldPath) {
359
+ validateRequiredString(value, fieldPath);
360
+ // Basic validation - party IDs should not contain whitespace
361
+ if (/\s/.test(value)) {
362
+ throw new ValidationError(fieldPath, 'party ID without whitespace', value);
363
+ }
364
+ }
365
+ // ===== Composite Validators =====
366
+ /**
367
+ * Validate all items in an array using a validator function.
368
+ *
369
+ * @param items - The array of items to validate
370
+ * @param fieldPath - Base path for error messages
371
+ * @param itemValidator - Function to validate each item
372
+ */
373
+ function validateArrayItems(items, fieldPath, itemValidator) {
374
+ for (let i = 0; i < items.length; i++) {
375
+ itemValidator(items[i], `${fieldPath}[${i}]`);
376
+ }
377
+ }
378
+ /**
379
+ * Create a composite validator that runs multiple validations.
380
+ *
381
+ * @example
382
+ * ```typescript
383
+ * const validateStakeholder = createValidator<OcfStakeholder>(
384
+ * (value, path) => {
385
+ * validateRequiredString(value.id, `${path}.id`);
386
+ * validateRequiredObject(value.name, `${path}.name`);
387
+ * validateRequiredString(value.name?.legal_name, `${path}.name.legal_name`);
388
+ * validateEnum(value.stakeholder_type, `${path}.stakeholder_type`, ['INDIVIDUAL', 'INSTITUTION']);
389
+ * }
390
+ * );
391
+ *
392
+ * validateStakeholder(data, 'stakeholder');
393
+ * ```
394
+ */
395
+ function createValidator(validatorFn) {
396
+ return (value, fieldPath) => {
397
+ validateRequiredObject(value, fieldPath);
398
+ validatorFn(value, fieldPath);
399
+ };
400
+ }
401
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAkCH,wDAOC;AAWD,wDAQC;AAWD,0DAkBC;AAUD,0DAMC;AAWD,oDAKC;AASD,0DAKC;AASD,gEAKC;AAWD,oDAYC;AASD,oDAMC;AAYD,oCAWC;AA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CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-captable-protocol/canton",
3
- "version": "0.2.145",
3
+ "version": "0.2.147",
4
4
  "description": "A TypeScript SDK for interacting with the Open CapTable Protocol (OCP) Factory contract on Canton blockchain",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",