@satoshibits/functional 1.0.2

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 (46) hide show
  1. package/README.md +242 -0
  2. package/dist/array-utils.d.mts +317 -0
  3. package/dist/array-utils.d.mts.map +1 -0
  4. package/dist/array-utils.mjs +370 -0
  5. package/dist/array-utils.mjs.map +1 -0
  6. package/dist/composition.d.mts +603 -0
  7. package/dist/composition.d.mts.map +1 -0
  8. package/dist/composition.mjs +516 -0
  9. package/dist/composition.mjs.map +1 -0
  10. package/dist/object-utils.d.mts +267 -0
  11. package/dist/object-utils.d.mts.map +1 -0
  12. package/dist/object-utils.mjs +258 -0
  13. package/dist/object-utils.mjs.map +1 -0
  14. package/dist/option.d.mts +622 -0
  15. package/dist/option.d.mts.map +1 -0
  16. package/dist/option.mjs +637 -0
  17. package/dist/option.mjs.map +1 -0
  18. package/dist/performance.d.mts +265 -0
  19. package/dist/performance.d.mts.map +1 -0
  20. package/dist/performance.mjs +453 -0
  21. package/dist/performance.mjs.map +1 -0
  22. package/dist/pipeline.d.mts +431 -0
  23. package/dist/pipeline.d.mts.map +1 -0
  24. package/dist/pipeline.mjs +460 -0
  25. package/dist/pipeline.mjs.map +1 -0
  26. package/dist/predicates.d.mts +722 -0
  27. package/dist/predicates.d.mts.map +1 -0
  28. package/dist/predicates.mjs +802 -0
  29. package/dist/predicates.mjs.map +1 -0
  30. package/dist/reader-result.d.mts +422 -0
  31. package/dist/reader-result.d.mts.map +1 -0
  32. package/dist/reader-result.mjs +758 -0
  33. package/dist/reader-result.mjs.map +1 -0
  34. package/dist/result.d.mts +684 -0
  35. package/dist/result.d.mts.map +1 -0
  36. package/dist/result.mjs +814 -0
  37. package/dist/result.mjs.map +1 -0
  38. package/dist/types.d.mts +439 -0
  39. package/dist/types.d.mts.map +1 -0
  40. package/dist/types.mjs +191 -0
  41. package/dist/types.mjs.map +1 -0
  42. package/dist/validation.d.mts +622 -0
  43. package/dist/validation.d.mts.map +1 -0
  44. package/dist/validation.mjs +852 -0
  45. package/dist/validation.mjs.map +1 -0
  46. package/package.json +46 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.mjs","sourceRoot":"","sources":["../src/result.mts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCH;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,MAAM,GAAG;IACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,EAAE,EAAE,UAAe,IAAO,IAAmB,OAAA,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,MAAA,EAAE,CAAC,EAAzB,CAAyB;IAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,GAAG,EAAE,UAAwB,KAAQ,IAAmB,OAAA,CAAC;QACvD,OAAO,EAAE,KAAK;QACd,KAAK,OAAA;KACN,CAAC,EAHsD,CAGtD;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,GAAG,EACD,UAAU,CAAiB;QAC3B,OAAA,UAAC,MAAoB;YACnB,OAAA,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAsB;QAAnE,CAAmE;IADrE,CACqE;IAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,OAAO,EACL,UAAU,CAA4B;QACtC,OAAA,UAAC,MAAoB;YACnB,OAAA,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAsB;QAAxD,CAAwD;IAD1D,CAC0D;IAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,QAAQ,EACN,UAAU,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,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,CAAC,IAAM,IAAI,GACf,UAAO,MAAqB,EAAE,YAAuC;IAAvC,6BAAA,EAAA,uCAAuC;IACrE,OAAA,UAAC,GAAM;QACL,IAAI,CAAC;YACH,IAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YAC1B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBAC1C,OAAO,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YAClC,CAAC;YACD,OAAO,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;QAAC,WAAM,CAAC;YACP,OAAO,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;AAVD,CAUC,CAAC"}
@@ -0,0 +1,439 @@
1
+ /**
2
+ * @module types
3
+ * @description Branded types and common type utilities for type-safe domain modeling.
4
+ * Provides compile-time guarantees for entity IDs and other domain primitives.
5
+ * Branded types (also known as nominal types) prevent accidental mixing of
6
+ * semantically different values that have the same underlying type. This module
7
+ * provides utilities for creating branded types, common domain types, and
8
+ * advanced TypeScript type utilities.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import { brand, Brand, UserId, Email, assertNever } from './types.mts';
13
+ *
14
+ * // create custom branded types
15
+ * type OrderId = Brand<string, 'OrderId'>;
16
+ * const OrderId = brand<string, 'OrderId'>('OrderId');
17
+ *
18
+ * // use predefined domain types
19
+ * const userId = UserId('usr_123');
20
+ * const email = Email('user@example.com');
21
+ *
22
+ * // type-safe function parameters
23
+ * function getUser(id: UserId): Promise<User> {
24
+ * // TypeScript prevents passing wrong ID types
25
+ * return userRepository.findById(id);
26
+ * }
27
+ *
28
+ * // exhaustive pattern matching
29
+ * type Status = 'pending' | 'active' | 'completed';
30
+ * function handleStatus(status: Status): string {
31
+ * switch (status) {
32
+ * case 'pending': return 'Waiting...';
33
+ * case 'active': return 'In progress';
34
+ * case 'completed': return 'Done!';
35
+ * default: return assertNever(status);
36
+ * }
37
+ * }
38
+ * ```
39
+ *
40
+ * @category Core
41
+ * @since 2025-07-03
42
+ */
43
+ /**
44
+ * Brand type helper that creates nominal types from structural types.
45
+ * Prevents accidental mixing of different ID types at compile time.
46
+ *
47
+ * @category Core Types
48
+ */
49
+ export type Brand<T, B> = T & {
50
+ readonly __brand: B;
51
+ };
52
+ /**
53
+ * Creates a branded type constructor.
54
+ *
55
+ * @category Constructors
56
+ * @example
57
+ * const UserId = brand<string, 'UserId'>('UserId');
58
+ * const userId = UserId('user_123');
59
+ *
60
+ * @example
61
+ * // Type-safe ID creation
62
+ * const AccountId = brand<string, 'AccountId'>('AccountId');
63
+ * const CampaignId = brand<string, 'CampaignId'>('CampaignId');
64
+ *
65
+ * // This will cause a compile error:
66
+ * // const wrong: AccountId = campaignId;
67
+ *
68
+ * @example
69
+ * // With validation
70
+ * const PositiveNumber = brand<number, 'PositiveNumber'>('PositiveNumber',
71
+ * (n) => n > 0 ? n : throw new Error('Must be positive')
72
+ * );
73
+ */
74
+ export declare const brand: <T, B extends string>(_brandName: B, validate?: (value: T) => T) => (value: T) => Brand<T, B>;
75
+ /**
76
+ * Extracts the underlying type from a branded type.
77
+ *
78
+ * @category Type Utilities
79
+ * @example
80
+ * type UserId = Brand<string, 'UserId'>;
81
+ * type RawId = Unbrand<UserId>; // string
82
+ */
83
+ export type Unbrand<T> = T extends Brand<infer U, unknown> ? U : T;
84
+ /**
85
+ * Common ID types for the application domain.
86
+ * These provide type safety for entity relationships.
87
+ *
88
+ * @category Domain Types
89
+ */
90
+ /**
91
+ * Account ID type - identifies a customer account.
92
+ *
93
+ * @example
94
+ * const accountId = AccountId('acc_123456');
95
+ *
96
+ * @example
97
+ * // Type-safe function parameters
98
+ * function getAccount(id: AccountId): Promise<Account> {
99
+ * return accountRepository.findById(id);
100
+ * }
101
+ *
102
+ * @example
103
+ * // Prevents mixing IDs
104
+ * const userId = UserId('usr_789');
105
+ * // getAccount(userId); // Compile error!
106
+ */
107
+ export type AccountId = Brand<string, 'AccountId'>;
108
+ export declare const AccountId: (value: string) => Brand<string, "AccountId">;
109
+ /**
110
+ * User ID type - identifies a user within an account.
111
+ *
112
+ * @example
113
+ * const userId = UserId('usr_789012');
114
+ *
115
+ * @example
116
+ * // Domain modeling
117
+ * interface User {
118
+ * id: UserId;
119
+ * accountId: AccountId;
120
+ * email: Email;
121
+ * name: string;
122
+ * }
123
+ */
124
+ export type UserId = Brand<string, 'UserId'>;
125
+ export declare const UserId: (value: string) => Brand<string, "UserId">;
126
+ /**
127
+ * Campaign ID type - identifies an email campaign.
128
+ *
129
+ * @example
130
+ * const campaignId = CampaignId('camp_abc123');
131
+ *
132
+ * @example
133
+ * // Repository methods
134
+ * class CampaignRepository {
135
+ * async findById(id: CampaignId): Promise<Campaign | null> {
136
+ * // Implementation
137
+ * }
138
+ * }
139
+ */
140
+ export type CampaignId = Brand<string, 'CampaignId'>;
141
+ export declare const CampaignId: (value: string) => Brand<string, "CampaignId">;
142
+ /**
143
+ * Profile ID type - identifies a subscriber profile.
144
+ *
145
+ * @example
146
+ * const profileId = ProfileId('prof_def456');
147
+ */
148
+ export type ProfileId = Brand<string, 'ProfileId'>;
149
+ export declare const ProfileId: (value: string) => Brand<string, "ProfileId">;
150
+ /**
151
+ * Segment ID type - identifies a subscriber segment.
152
+ *
153
+ * @example
154
+ * const segmentId = SegmentId('seg_ghi789');
155
+ */
156
+ export type SegmentId = Brand<string, 'SegmentId'>;
157
+ export declare const SegmentId: (value: string) => Brand<string, "SegmentId">;
158
+ /**
159
+ * Email Template ID type - identifies an email template.
160
+ *
161
+ * @example
162
+ * const templateId = EmailTemplateId('tpl_jkl012');
163
+ */
164
+ export type EmailTemplateId = Brand<string, 'EmailTemplateId'>;
165
+ export declare const EmailTemplateId: (value: string) => Brand<string, "EmailTemplateId">;
166
+ /**
167
+ * Engine ID type - identifies an automation engine.
168
+ *
169
+ * @example
170
+ * const engineId = EngineId('eng_mno345');
171
+ */
172
+ export type EngineId = Brand<string, 'EngineId'>;
173
+ export declare const EngineId: (value: string) => Brand<string, "EngineId">;
174
+ /**
175
+ * Import ID type - identifies a data import job.
176
+ *
177
+ * @example
178
+ * const importId = ImportId('imp_pqr678');
179
+ */
180
+ export type ImportId = Brand<string, 'ImportId'>;
181
+ export declare const ImportId: (value: string) => Brand<string, "ImportId">;
182
+ /**
183
+ * Value object types for domain modeling.
184
+ * These ensure data integrity at the type level.
185
+ *
186
+ * @category Value Objects
187
+ */
188
+ /**
189
+ * Email address type with basic validation.
190
+ *
191
+ * @example
192
+ * const email = Email('user@example.com');
193
+ *
194
+ * @example
195
+ * // With validation
196
+ * try {
197
+ * const email = Email('invalid-email');
198
+ * } catch (e) {
199
+ * console.error('Invalid email format');
200
+ * }
201
+ *
202
+ * @example
203
+ * // Type-safe email handling
204
+ * function sendEmail(to: Email, subject: string): Promise<void> {
205
+ * return emailService.send(to, subject);
206
+ * }
207
+ */
208
+ export type Email = Brand<string, 'Email'>;
209
+ export declare const Email: (value: string) => Brand<string, "Email">;
210
+ /**
211
+ * URL type with validation.
212
+ *
213
+ * @example
214
+ * const website = Url('https://example.com');
215
+ *
216
+ * @example
217
+ * // API endpoints
218
+ * const apiEndpoint = Url('https://api.example.com/v1/users');
219
+ *
220
+ * @example
221
+ * // Validation
222
+ * try {
223
+ * const invalid = Url('not-a-url');
224
+ * } catch (e) {
225
+ * console.error('Invalid URL');
226
+ * }
227
+ */
228
+ export type Url = Brand<string, 'Url'>;
229
+ export declare const Url: (value: string) => Brand<string, "Url">;
230
+ /**
231
+ * Positive integer type.
232
+ *
233
+ * @example
234
+ * const count = PositiveInt(42);
235
+ *
236
+ * @example
237
+ * // Domain constraints
238
+ * interface PaginationParams {
239
+ * page: PositiveInt;
240
+ * limit: PositiveInt;
241
+ * }
242
+ *
243
+ * @example
244
+ * // Validation
245
+ * try {
246
+ * const invalid = PositiveInt(-5);
247
+ * } catch (e) {
248
+ * console.error('Must be positive');
249
+ * }
250
+ */
251
+ export type PositiveInt = Brand<number, 'PositiveInt'>;
252
+ export declare const PositiveInt: (value: number) => Brand<number, "PositiveInt">;
253
+ /**
254
+ * Percentage type (0-100).
255
+ *
256
+ * @example
257
+ * const discount = Percentage(15);
258
+ *
259
+ * @example
260
+ * // Business rules
261
+ * interface Campaign {
262
+ * openRate: Percentage;
263
+ * clickRate: Percentage;
264
+ * bounceRate: Percentage;
265
+ * }
266
+ */
267
+ export type Percentage = Brand<number, 'Percentage'>;
268
+ export declare const Percentage: (value: number) => Brand<number, "Percentage">;
269
+ /**
270
+ * ISO date string type.
271
+ *
272
+ * @example
273
+ * const date = ISODateString('2024-01-15T10:30:00Z');
274
+ *
275
+ * @example
276
+ * // API contracts
277
+ * interface Event {
278
+ * id: string;
279
+ * timestamp: ISODateString;
280
+ * type: string;
281
+ * }
282
+ */
283
+ export type ISODateString = Brand<string, 'ISODateString'>;
284
+ export declare const ISODateString: (value: string) => Brand<string, "ISODateString">;
285
+ /**
286
+ * Non-empty string type.
287
+ *
288
+ * @example
289
+ * const name = NonEmptyString('John Doe');
290
+ *
291
+ * @example
292
+ * // Form validation
293
+ * interface UserForm {
294
+ * firstName: NonEmptyString;
295
+ * lastName: NonEmptyString;
296
+ * bio?: string;
297
+ * }
298
+ */
299
+ export type NonEmptyString = Brand<string, 'NonEmptyString'>;
300
+ export declare const NonEmptyString: (value: string) => Brand<string, "NonEmptyString">;
301
+ /**
302
+ * Utility type helpers.
303
+ *
304
+ * @category Type Utilities
305
+ */
306
+ /**
307
+ * Deep readonly type for immutable data structures.
308
+ *
309
+ * @example
310
+ * type Config = DeepReadonly<{
311
+ * api: {
312
+ * endpoint: string;
313
+ * timeout: number;
314
+ * };
315
+ * }>;
316
+ */
317
+ export type DeepReadonly<T> = {
318
+ readonly [P in keyof T]: T[P] extends object ? DeepReadonly<T[P]> : T[P];
319
+ };
320
+ /**
321
+ * Makes specified keys required while keeping others optional.
322
+ *
323
+ * @example
324
+ * type User = {
325
+ * id?: string;
326
+ * name?: string;
327
+ * email?: string;
328
+ * };
329
+ *
330
+ * type SavedUser = RequireKeys<User, 'id'>;
331
+ * // { id: string; name?: string; email?: string; }
332
+ */
333
+ export type RequireKeys<T, K extends keyof T> = T & Required<Pick<T, K>>;
334
+ /**
335
+ * Makes specified keys optional while keeping others required.
336
+ *
337
+ * @example
338
+ * type Config = {
339
+ * apiKey: string;
340
+ * timeout: number;
341
+ * debug: boolean;
342
+ * };
343
+ *
344
+ * type PartialConfig = OptionalKeys<Config, 'timeout' | 'debug'>;
345
+ * // { apiKey: string; timeout?: number; debug?: boolean; }
346
+ */
347
+ export type OptionalKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
348
+ /**
349
+ * Extracts keys of type T that have values of type V.
350
+ *
351
+ * @example
352
+ * type User = {
353
+ * id: string;
354
+ * name: string;
355
+ * age: number;
356
+ * isActive: boolean;
357
+ * };
358
+ *
359
+ * type StringKeys = KeysOfType<User, string>; // 'id' | 'name'
360
+ * type NumberKeys = KeysOfType<User, number>; // 'age'
361
+ */
362
+ export type KeysOfType<T, V> = {
363
+ [K in keyof T]: T[K] extends V ? K : never;
364
+ }[keyof T];
365
+ /**
366
+ * Nominal type helper for creating distinct types from primitives.
367
+ * Similar to Brand but more lightweight.
368
+ *
369
+ * @example
370
+ * type Miles = Nominal<number, 'Miles'>;
371
+ * type Kilometers = Nominal<number, 'Kilometers'>;
372
+ *
373
+ * const distance: Miles = 100 as Miles;
374
+ * // const wrong: Kilometers = distance; // Error!
375
+ */
376
+ export type Nominal<T, K> = T & {
377
+ readonly __nominal: K;
378
+ };
379
+ /**
380
+ * Type guard creator for branded types.
381
+ *
382
+ * @category Type Guards
383
+ * @example
384
+ * const isUserId = isBrand<string, 'UserId'>('UserId');
385
+ *
386
+ * if (isUserId(value)) {
387
+ * // TypeScript knows value is UserId
388
+ * }
389
+ *
390
+ * @example
391
+ * // Array filtering
392
+ * const userIds = mixedIds.filter(isUserId);
393
+ */
394
+ export declare const isBrand: <T, B extends string>(brandName: B) => (value: unknown) => value is Brand<T, B>;
395
+ /**
396
+ * Creates a type-safe enum from an object.
397
+ *
398
+ * @category Enum Utilities
399
+ * @example
400
+ * const Status = createEnum({
401
+ * PENDING: 'pending',
402
+ * ACTIVE: 'active',
403
+ * COMPLETED: 'completed'
404
+ * });
405
+ *
406
+ * type Status = EnumType<typeof Status>;
407
+ * // 'pending' | 'active' | 'completed'
408
+ *
409
+ * @example
410
+ * // Usage in interfaces
411
+ * interface Task {
412
+ * id: string;
413
+ * status: Status;
414
+ * }
415
+ */
416
+ export declare const createEnum: <T extends Record<string, string>>(obj: T) => Readonly<T>;
417
+ export type EnumType<T> = T[keyof T];
418
+ /**
419
+ * Assertion function for exhaustive checks.
420
+ *
421
+ * @category Type Guards
422
+ * @example
423
+ * type Status = 'pending' | 'active' | 'completed';
424
+ *
425
+ * function handleStatus(status: Status) {
426
+ * switch (status) {
427
+ * case 'pending':
428
+ * return 'Waiting...';
429
+ * case 'active':
430
+ * return 'In progress';
431
+ * case 'completed':
432
+ * return 'Done!';
433
+ * default:
434
+ * return assertNever(status); // Ensures all cases handled
435
+ * }
436
+ * }
437
+ */
438
+ export declare const assertNever: (value: never) => never;
439
+ //# sourceMappingURL=types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,CAAC,SAAS,MAAM,cAC3B,C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js ADDED
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+ /**
3
+ * @module types
4
+ * @description Branded types and common type utilities for type-safe domain modeling.
5
+ * Provides compile-time guarantees for entity IDs and other domain primitives.
6
+ * Branded types (also known as nominal types) prevent accidental mixing of
7
+ * semantically different values that have the same underlying type. This module
8
+ * provides utilities for creating branded types, common domain types, and
9
+ * advanced TypeScript type utilities.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { brand, Brand, UserId, Email, assertNever } from './types.mts';
14
+ *
15
+ * // create custom branded types
16
+ * type OrderId = Brand<string, 'OrderId'>;
17
+ * const OrderId = brand<string, 'OrderId'>('OrderId');
18
+ *
19
+ * // use predefined domain types
20
+ * const userId = UserId('usr_123');
21
+ * const email = Email('user@example.com');
22
+ *
23
+ * // type-safe function parameters
24
+ * function getUser(id: UserId): Promise<User> {
25
+ * // TypeScript prevents passing wrong ID types
26
+ * return userRepository.findById(id);
27
+ * }
28
+ *
29
+ * // exhaustive pattern matching
30
+ * type Status = 'pending' | 'active' | 'completed';
31
+ * function handleStatus(status: Status): string {
32
+ * switch (status) {
33
+ * case 'pending': return 'Waiting...';
34
+ * case 'active': return 'In progress';
35
+ * case 'completed': return 'Done!';
36
+ * default: return assertNever(status);
37
+ * }
38
+ * }
39
+ * ```
40
+ *
41
+ * @category Core
42
+ * @since 2025-07-03
43
+ */
44
+ /**
45
+ * Creates a branded type constructor.
46
+ *
47
+ * @category Constructors
48
+ * @example
49
+ * const UserId = brand<string, 'UserId'>('UserId');
50
+ * const userId = UserId('user_123');
51
+ *
52
+ * @example
53
+ * // Type-safe ID creation
54
+ * const AccountId = brand<string, 'AccountId'>('AccountId');
55
+ * const CampaignId = brand<string, 'CampaignId'>('CampaignId');
56
+ *
57
+ * // This will cause a compile error:
58
+ * // const wrong: AccountId = campaignId;
59
+ *
60
+ * @example
61
+ * // With validation
62
+ * const PositiveNumber = brand<number, 'PositiveNumber'>('PositiveNumber',
63
+ * (n) => n > 0 ? n : throw new Error('Must be positive')
64
+ * );
65
+ */
66
+ export var brand = function (_brandName, validate) {
67
+ return function (value) {
68
+ var validated = validate ? validate(value) : value;
69
+ return validated;
70
+ };
71
+ };
72
+ export var AccountId = brand('AccountId');
73
+ export var UserId = brand('UserId');
74
+ export var CampaignId = brand('CampaignId');
75
+ export var ProfileId = brand('ProfileId');
76
+ export var SegmentId = brand('SegmentId');
77
+ export var EmailTemplateId = brand('EmailTemplateId');
78
+ export var EngineId = brand('EngineId');
79
+ export var ImportId = brand('ImportId');
80
+ export var Email = brand('Email', function (value) {
81
+ var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
82
+ if (!emailRegex.test(value)) {
83
+ throw new Error("Invalid email format: ".concat(value));
84
+ }
85
+ return value.toLowerCase();
86
+ });
87
+ export var Url = brand('Url', function (value) {
88
+ try {
89
+ new URL(value);
90
+ return value;
91
+ }
92
+ catch (_a) {
93
+ throw new Error("Invalid URL format: ".concat(value));
94
+ }
95
+ });
96
+ export var PositiveInt = brand('PositiveInt', function (value) {
97
+ if (!Number.isInteger(value) || value <= 0) {
98
+ throw new Error("Value must be a positive integer: ".concat(value));
99
+ }
100
+ return value;
101
+ });
102
+ export var Percentage = brand('Percentage', function (value) {
103
+ if (value < 0 || value > 100) {
104
+ throw new Error("Percentage must be between 0 and 100: ".concat(value));
105
+ }
106
+ return value;
107
+ });
108
+ export var ISODateString = brand('ISODateString', function (value) {
109
+ var date = new Date(value);
110
+ if (isNaN(date.getTime())) {
111
+ throw new Error("Invalid ISO date string: ".concat(value));
112
+ }
113
+ return value;
114
+ });
115
+ export var NonEmptyString = brand('NonEmptyString', function (value) {
116
+ if (value.trim().length === 0) {
117
+ throw new Error('String cannot be empty');
118
+ }
119
+ return value;
120
+ });
121
+ /**
122
+ * Type guard creator for branded types.
123
+ *
124
+ * @category Type Guards
125
+ * @example
126
+ * const isUserId = isBrand<string, 'UserId'>('UserId');
127
+ *
128
+ * if (isUserId(value)) {
129
+ * // TypeScript knows value is UserId
130
+ * }
131
+ *
132
+ * @example
133
+ * // Array filtering
134
+ * const userIds = mixedIds.filter(isUserId);
135
+ */
136
+ export var isBrand = function (brandName) {
137
+ return function (value) {
138
+ return typeof value === 'object' &&
139
+ value !== null &&
140
+ '__brand' in value &&
141
+ value.__brand === brandName;
142
+ };
143
+ };
144
+ /**
145
+ * Creates a type-safe enum from an object.
146
+ *
147
+ * @category Enum Utilities
148
+ * @example
149
+ * const Status = createEnum({
150
+ * PENDING: 'pending',
151
+ * ACTIVE: 'active',
152
+ * COMPLETED: 'completed'
153
+ * });
154
+ *
155
+ * type Status = EnumType<typeof Status>;
156
+ * // 'pending' | 'active' | 'completed'
157
+ *
158
+ * @example
159
+ * // Usage in interfaces
160
+ * interface Task {
161
+ * id: string;
162
+ * status: Status;
163
+ * }
164
+ */
165
+ export var createEnum = function (obj) {
166
+ return Object.freeze(obj);
167
+ };
168
+ /**
169
+ * Assertion function for exhaustive checks.
170
+ *
171
+ * @category Type Guards
172
+ * @example
173
+ * type Status = 'pending' | 'active' | 'completed';
174
+ *
175
+ * function handleStatus(status: Status) {
176
+ * switch (status) {
177
+ * case 'pending':
178
+ * return 'Waiting...';
179
+ * case 'active':
180
+ * return 'In progress';
181
+ * case 'completed':
182
+ * return 'Done!';
183
+ * default:
184
+ * return assertNever(status); // Ensures all cases handled
185
+ * }
186
+ * }
187
+ */
188
+ export var assertNever = function (value) {
189
+ throw new Error("Unexpected value: ".concat(JSON.stringify(value)));
190
+ };
191
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.mts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAUH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,IAAM,KAAK,GAAG,UACnB,UAAa,EACb,QAA0B;IAE1B,OAAO,UAAC,KAAQ;QACd,IAAM,SAAS,GAAG,QAA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