@dereekb/model 13.11.14 → 13.11.16

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/index.esm.js CHANGED
@@ -33,7 +33,7 @@ import { BaseError } from 'make-error';
33
33
  * Returns the shared {@link EMPTY_ARKTYPE_TYPE} cast to the requested type, providing a typed empty-object schema
34
34
  * without creating a new ArkType instance each time.
35
35
  *
36
- * @returns the singleton empty type schema typed as `Type<T>`
36
+ * @returns The singleton empty type schema typed as `Type<T>`
37
37
  *
38
38
  * @example
39
39
  * ```typescript
@@ -121,8 +121,8 @@ function clearable(definition) {
121
121
  /**
122
122
  * Checks whether the given string is a valid {@link WebsiteLinkType}.
123
123
  *
124
- * @param input - the string to validate
125
- * @returns true if it matches the alphanumeric 1-32 character pattern
124
+ * @param input - Value to test against the website link type pattern.
125
+ * @returns True if it matches the alphanumeric 1-32 character pattern.
126
126
  *
127
127
  * @example
128
128
  * ```typescript
@@ -247,8 +247,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
247
247
  /**
248
248
  * Converts a {@link WebsiteFileLink} to a {@link WebsiteLink} by encoding its fields into the data string.
249
249
  *
250
- * @param input - the file link to convert
251
- * @returns a WebsiteLink with type "f" and pipe-encoded data
250
+ * @param input - The file link to convert.
251
+ * @returns A WebsiteLink with type "f" and pipe-encoded data.
252
252
  *
253
253
  * @example
254
254
  * ```typescript
@@ -265,8 +265,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
265
265
  /**
266
266
  * Converts a {@link WebsiteLink} back to a {@link WebsiteFileLink} by decoding the pipe-separated data string.
267
267
  *
268
- * @param input - a WebsiteLink whose data field contains an encoded file link
269
- * @returns the decoded file link with type, MIME, name, and data fields
268
+ * @param input - A WebsiteLink whose data field contains an encoded file link.
269
+ * @returns The decoded file link with type, MIME, name, and data fields.
270
270
  *
271
271
  * @example
272
272
  * ```typescript
@@ -286,8 +286,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
286
286
  *
287
287
  * Fields are encoded in order: type, MIME, data, name. Empty/undefined fields become empty strings.
288
288
  *
289
- * @param input - the file link to encode
290
- * @returns a pipe-separated encoded string
289
+ * @param input - The file link to encode.
290
+ * @returns A pipe-separated encoded string.
291
291
  *
292
292
  * @example
293
293
  * ```typescript
@@ -314,8 +314,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
314
314
  *
315
315
  * Empty fields in the encoded string are omitted from the result (falsy values are filtered out).
316
316
  *
317
- * @param input - the pipe-separated encoded string
318
- * @returns the decoded file link
317
+ * @param input - The pipe-separated encoded string.
318
+ * @returns The decoded file link.
319
319
  *
320
320
  * @example
321
321
  * ```typescript
@@ -356,9 +356,9 @@ function _unsupported_iterable_to_array$2(o, minLen) {
356
356
  *
357
357
  * Optionally prepends a prefix (e.g., "@" for TikTok, "$" for Cash App).
358
358
  *
359
- * @param input - a username or full profile URL
360
- * @param prefix - optional prefix to prepend to the extracted username
361
- * @returns the isolated username, optionally prefixed
359
+ * @param input - A username or full profile URL.
360
+ * @param prefix - Optional prefix to prepend to the extracted username.
361
+ * @returns The isolated username, optionally prefixed.
362
362
  *
363
363
  * @example
364
364
  * ```typescript
@@ -377,9 +377,9 @@ function _unsupported_iterable_to_array$2(o, minLen) {
377
377
  *
378
378
  * Used for platforms with non-standard URL patterns (e.g., Snapchat's `/add/{username}`, YouTube's `/c/{username}`).
379
379
  *
380
- * @param input - a username or full profile URL
381
- * @param isolateFn - custom function that extracts the relevant path segment from the URL
382
- * @returns the isolated username
380
+ * @param input - A username or full profile URL.
381
+ * @param isolateFn - Custom function that extracts the relevant path segment from the URL.
382
+ * @returns The isolated username.
383
383
  */ function usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername(input, isolateFn) {
384
384
  return toRelativeSlashPathStartType(isolateFn(usernameOrWebsiteUrlToWebsiteUrl(input)));
385
385
  }
@@ -388,8 +388,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
388
388
  *
389
389
  * If the input has a website domain, it is returned as-is. Otherwise, it is treated as a path and converted to an absolute slash path.
390
390
  *
391
- * @param input - a username or website URL
392
- * @returns a normalized website URL
391
+ * @param input - A username or website URL.
392
+ * @returns A normalized website URL.
393
393
  */ function usernameOrWebsiteUrlToWebsiteUrl(input) {
394
394
  return hasWebsiteDomain(input) ? input : toAbsoluteSlashPathStartType(removeHttpFromUrl(input));
395
395
  }
@@ -400,8 +400,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
400
400
  /**
401
401
  * Converts a generic website URL into a {@link WebsiteLink}, stripping the HTTP/HTTPS protocol.
402
402
  *
403
- * @param input - the full website URL
404
- * @returns a WebsiteLink with the protocol removed from the data
403
+ * @param input - The full website URL.
404
+ * @returns A WebsiteLink with the protocol removed from the data.
405
405
  *
406
406
  * @example
407
407
  * ```typescript
@@ -421,8 +421,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
421
421
  /**
422
422
  * Converts an email address into a {@link WebsiteLink}.
423
423
  *
424
- * @param input - the email address
425
- * @returns a WebsiteLink storing the email as data
424
+ * @param input - The email address.
425
+ * @returns A WebsiteLink storing the email as data.
426
426
  */ function emailAddressToWebsiteLink(input) {
427
427
  return {
428
428
  t: EMAIL_URL_WEBSITE_LINK_TYPE,
@@ -436,8 +436,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
436
436
  /**
437
437
  * Converts an E.164 phone number into a {@link WebsiteLink}.
438
438
  *
439
- * @param input - the phone number in E.164 format
440
- * @returns a WebsiteLink storing the phone number as data
439
+ * @param input - The phone number in E.164 format.
440
+ * @returns A WebsiteLink storing the phone number as data.
441
441
  */ function phoneNumberToWebsiteLink(input) {
442
442
  return {
443
443
  t: PHONE_URL_WEBSITE_LINK_TYPE,
@@ -456,8 +456,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
456
456
  *
457
457
  * Accepts either a raw username or a full Facebook profile URL.
458
458
  *
459
- * @param input - a Facebook profile ID or full profile URL
460
- * @returns a WebsiteLink with the isolated username as data
459
+ * @param input - A Facebook profile ID or full profile URL.
460
+ * @returns A WebsiteLink with the isolated username as data.
461
461
  *
462
462
  * @example
463
463
  * ```typescript
@@ -476,8 +476,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
476
476
  /**
477
477
  * Constructs a full Facebook profile URL from a profile ID.
478
478
  *
479
- * @param profileId - the Facebook profile ID or username
480
- * @returns the full profile URL
479
+ * @param profileId - The Facebook profile ID or username.
480
+ * @returns The full profile URL.
481
481
  */ function facebookProfileUrl(profileId) {
482
482
  return "".concat(FACEBOOK_BASE_URL, "/").concat(profileId);
483
483
  }
@@ -491,8 +491,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
491
491
  /**
492
492
  * Converts an Instagram profile ID or URL into a {@link WebsiteLink}.
493
493
  *
494
- * @param input - an Instagram username or full profile URL
495
- * @returns a WebsiteLink with the isolated username as data
494
+ * @param input - An Instagram username or full profile URL.
495
+ * @returns A WebsiteLink with the isolated username as data.
496
496
  */ function instagramProfileUrlToWebsiteLink(input) {
497
497
  return {
498
498
  t: INSTAGRAM_WEBSITE_LINK_TYPE,
@@ -502,8 +502,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
502
502
  /**
503
503
  * Constructs a full Instagram profile URL from a profile ID.
504
504
  *
505
- * @param profileId - the Instagram username
506
- * @returns the full profile URL
505
+ * @param profileId - The Instagram username.
506
+ * @returns The full profile URL.
507
507
  */ function instagramProfileUrl(profileId) {
508
508
  return "".concat(INSTAGRAM_BASE_URL, "/").concat(profileId);
509
509
  }
@@ -517,8 +517,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
517
517
  /**
518
518
  * Converts a Twitter profile ID or URL into a {@link WebsiteLink}.
519
519
  *
520
- * @param input - a Twitter username or full profile URL
521
- * @returns a WebsiteLink with the isolated username as data
520
+ * @param input - A Twitter username or full profile URL.
521
+ * @returns A WebsiteLink with the isolated username as data.
522
522
  */ function twitterProfileUrlToWebsiteLink(input) {
523
523
  return {
524
524
  t: TWITTER_WEBSITE_LINK_TYPE,
@@ -528,8 +528,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
528
528
  /**
529
529
  * Constructs a full Twitter profile URL from a profile ID.
530
530
  *
531
- * @param profileId - the Twitter username
532
- * @returns the full profile URL
531
+ * @param profileId - The Twitter username.
532
+ * @returns The full profile URL.
533
533
  */ function twitterProfileUrl(profileId) {
534
534
  return "".concat(TWITTER_BASE_URL, "/").concat(profileId);
535
535
  }
@@ -548,8 +548,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
548
548
  *
549
549
  * Automatically prepends the "@" prefix if not already present.
550
550
  *
551
- * @param input - a TikTok username (with or without "@") or full profile URL
552
- * @returns a WebsiteLink with the "@"-prefixed username as data
551
+ * @param input - A TikTok username (with or without "@") or full profile URL.
552
+ * @returns A WebsiteLink with the "@"-prefixed username as data.
553
553
  */ function tiktokProfileUrlToWebsiteLink(input) {
554
554
  return {
555
555
  t: TIKTOK_WEBSITE_LINK_TYPE,
@@ -559,8 +559,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
559
559
  /**
560
560
  * Constructs a full TikTok profile URL from a profile ID.
561
561
  *
562
- * @param profileId - the TikTok username (without "@" prefix)
563
- * @returns the full profile URL with "@" prefix
562
+ * @param profileId - The TikTok username (without "@" prefix)
563
+ * @returns The full profile URL with "@" prefix.
564
564
  */ function tiktokProfileUrl(profileId) {
565
565
  return "".concat(TIKTOK_BASE_URL, "/@").concat(profileId);
566
566
  }
@@ -584,8 +584,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
584
584
  *
585
585
  * Handles Snapchat's `/add/{username}` URL pattern.
586
586
  *
587
- * @param input - a Snapchat username or full profile URL
588
- * @returns a WebsiteLink with the isolated username as data
587
+ * @param input - A Snapchat username or full profile URL.
588
+ * @returns A WebsiteLink with the isolated username as data.
589
589
  */ function snapchatProfileUrlToWebsiteLink(input) {
590
590
  return {
591
591
  t: SNAPCHAT_WEBSITE_LINK_TYPE,
@@ -595,8 +595,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
595
595
  /**
596
596
  * Constructs a full Snapchat profile URL from a profile ID.
597
597
  *
598
- * @param profileId - the Snapchat username
599
- * @returns the full profile URL with `/add/` path
598
+ * @param profileId - The Snapchat username.
599
+ * @returns The full profile URL with `/add/` path.
600
600
  */ function snapchatProfileUrl(profileId) {
601
601
  return "".concat(SNAPCHAT_BASE_URL, "/add/").concat(profileId);
602
602
  }
@@ -620,8 +620,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
620
620
  *
621
621
  * Handles YouTube's `/c/{channel}` URL pattern.
622
622
  *
623
- * @param input - a YouTube channel name or full channel URL
624
- * @returns a WebsiteLink with the isolated channel name as data
623
+ * @param input - A YouTube channel name or full channel URL.
624
+ * @returns A WebsiteLink with the isolated channel name as data.
625
625
  */ function youtubeProfileUrlToWebsiteLink(input) {
626
626
  return {
627
627
  t: YOUTUBE_WEBSITE_LINK_TYPE,
@@ -631,8 +631,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
631
631
  /**
632
632
  * Constructs a full YouTube channel URL from a profile ID.
633
633
  *
634
- * @param profileId - the YouTube channel name
635
- * @returns the full channel URL with `/c/` path
634
+ * @param profileId - The YouTube channel name.
635
+ * @returns The full channel URL with `/c/` path.
636
636
  */ function youtubeProfileUrl(profileId) {
637
637
  return "".concat(YOUTUBE_BASE_URL, "/c/").concat(profileId);
638
638
  }
@@ -646,8 +646,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
646
646
  /**
647
647
  * Converts a PayPal profile ID or URL into a {@link WebsiteLink}.
648
648
  *
649
- * @param input - a PayPal username or full PayPal.me URL
650
- * @returns a WebsiteLink with the isolated username as data
649
+ * @param input - A PayPal username or full PayPal.me URL.
650
+ * @returns A WebsiteLink with the isolated username as data.
651
651
  */ function paypalProfileUrlToWebsiteLink(input) {
652
652
  return {
653
653
  t: PAYPAL_WEBSITE_LINK_TYPE,
@@ -657,8 +657,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
657
657
  /**
658
658
  * Constructs a full PayPal.me profile URL from a profile ID.
659
659
  *
660
- * @param profileId - the PayPal username
661
- * @returns the full PayPal.me URL
660
+ * @param profileId - The PayPal username.
661
+ * @returns The full PayPal.me URL.
662
662
  */ function paypalProfileUrl(profileId) {
663
663
  return "".concat(PAYPAL_BASE_URL, "/").concat(profileId);
664
664
  }
@@ -677,8 +677,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
677
677
  *
678
678
  * Automatically prepends the "$" prefix if not already present.
679
679
  *
680
- * @param input - a Cash App username (with or without "$") or full profile URL
681
- * @returns a WebsiteLink with the "$"-prefixed username as data
680
+ * @param input - A Cash App username (with or without "$") or full profile URL.
681
+ * @returns A WebsiteLink with the "$"-prefixed username as data.
682
682
  */ function cashappProfileUrlToWebsiteLink(input) {
683
683
  return {
684
684
  t: CASHAPP_WEBSITE_LINK_TYPE,
@@ -688,8 +688,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
688
688
  /**
689
689
  * Constructs a full Cash App profile URL from a profile ID.
690
690
  *
691
- * @param profileId - the Cash App username (without "$" prefix)
692
- * @returns the full Cash App URL with "$" prefix
691
+ * @param profileId - The Cash App username (without "$" prefix)
692
+ * @returns The full Cash App URL with "$" prefix.
693
693
  */ function cashappProfileUrl(profileId) {
694
694
  return "".concat(CASHAPP_BASE_URL, "/$").concat(profileId);
695
695
  }
@@ -713,8 +713,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
713
713
  *
714
714
  * Handles Venmo's `/u/{username}` URL pattern.
715
715
  *
716
- * @param input - a Venmo username or full profile URL
717
- * @returns a WebsiteLink with the isolated username as data
716
+ * @param input - A Venmo username or full profile URL.
717
+ * @returns A WebsiteLink with the isolated username as data.
718
718
  */ function venmoProfileUrlToWebsiteLink(input) {
719
719
  return {
720
720
  t: VENMO_WEBSITE_LINK_TYPE,
@@ -724,8 +724,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
724
724
  /**
725
725
  * Constructs a full Venmo profile URL from a profile ID.
726
726
  *
727
- * @param profileId - the Venmo username
728
- * @returns the full profile URL with `/u/` path
727
+ * @param profileId - The Venmo username.
728
+ * @returns The full profile URL with `/u/` path.
729
729
  */ function venmoProfileUrl(profileId) {
730
730
  return "".concat(VENMO_BASE_URL, "/u/").concat(profileId);
731
731
  }
@@ -749,8 +749,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
749
749
  *
750
750
  * Handles Spotify's `/user/{username}` URL pattern.
751
751
  *
752
- * @param input - a Spotify username or full profile URL
753
- * @returns a WebsiteLink with the isolated username as data
752
+ * @param input - A Spotify username or full profile URL.
753
+ * @returns A WebsiteLink with the isolated username as data.
754
754
  */ function spotifyProfileUrlToWebsiteLink(input) {
755
755
  return {
756
756
  t: SPOTIFY_WEBSITE_LINK_TYPE,
@@ -760,8 +760,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
760
760
  /**
761
761
  * Constructs a full Spotify profile URL from a profile ID.
762
762
  *
763
- * @param profileId - the Spotify username
764
- * @returns the full profile URL with `/user/` path
763
+ * @param profileId - The Spotify username.
764
+ * @returns The full profile URL with `/user/` path.
765
765
  */ function spotifyProfileUrl(profileId) {
766
766
  return "".concat(SPOTIFY_BASE_URL, "/user/").concat(profileId);
767
767
  }
@@ -849,8 +849,8 @@ var GRANTED_ADMIN_ROLE_KEY = 'admin';
849
849
  /**
850
850
  * Checks whether the given role represents an admin-level permission (either "admin" or "owner").
851
851
  *
852
- * @param role - the role to check
853
- * @returns true if the role is an admin or owner role
852
+ * @param role - The role to check.
853
+ * @returns True if the role is an admin or owner role.
854
854
  *
855
855
  * @example
856
856
  * ```typescript
@@ -869,7 +869,7 @@ var NO_ACCESS_ROLE_KEY = '__EMPTY__';
869
869
  /**
870
870
  * Creates a {@link GrantedRoleMap} that explicitly denies all access.
871
871
  *
872
- * @returns a role map with only the no-access marker set
872
+ * @returns A role map with only the no-access marker set.
873
873
  *
874
874
  * @example
875
875
  * ```typescript
@@ -882,15 +882,15 @@ var NO_ACCESS_ROLE_KEY = '__EMPTY__';
882
882
  /**
883
883
  * Type guard that checks whether a role map is a no-access map.
884
884
  *
885
- * @param input - the role map to check
886
- * @returns true if the map has the no-access marker
885
+ * @param input - The role map to check.
886
+ * @returns True if the map has the no-access marker.
887
887
  */ function isNoAccessRoleMap(input) {
888
888
  return input[NO_ACCESS_ROLE_KEY] === true;
889
889
  }
890
890
  /**
891
891
  * Creates a {@link GrantedRoleMap} that grants full access to all roles.
892
892
  *
893
- * @returns a role map with the full-access marker set
893
+ * @returns A role map with the full-access marker set.
894
894
  *
895
895
  * @example
896
896
  * ```typescript
@@ -903,8 +903,8 @@ var NO_ACCESS_ROLE_KEY = '__EMPTY__';
903
903
  /**
904
904
  * Type guard that checks whether a role map is a full-access map.
905
905
  *
906
- * @param input - the role map to check
907
- * @returns true if the map has the full-access marker
906
+ * @param input - The role map to check.
907
+ * @returns True if the map has the full-access marker.
908
908
  */ function isFullAccessRoleMap(input) {
909
909
  return input[FULL_ACCESS_ROLE_KEY] === true;
910
910
  }
@@ -914,8 +914,8 @@ var NO_ACCESS_ROLE_KEY = '__EMPTY__';
914
914
  * The reader handles full-access and no-access maps as special cases, and provides methods
915
915
  * for checking individual roles or sets of roles.
916
916
  *
917
- * @param map - the granted role map to read from
918
- * @returns a reader instance for querying the map
917
+ * @param map - The granted role map to read from.
918
+ * @returns A reader instance for querying the map.
919
919
  *
920
920
  * @example
921
921
  * ```typescript
@@ -1044,9 +1044,9 @@ var GrantedRoleMapReaderInstance = /*#__PURE__*/ function() {
1044
1044
  /**
1045
1045
  * Converts an array of role strings into a {@link GrantedRoleKeysMap} where each role is mapped to the given boolean value.
1046
1046
  *
1047
- * @param roles - the role strings to include
1048
- * @param value - the boolean value to assign to each role (defaults to true)
1049
- * @returns a map of roles to boolean values
1047
+ * @param roles - Role keys to include in the resulting map.
1048
+ * @param value - Truthiness to assign to every role entry (defaults to true).
1049
+ * @returns Map keyed by role with the supplied truthiness for each entry.
1050
1050
  *
1051
1051
  * @example
1052
1052
  * ```typescript
@@ -1065,9 +1065,9 @@ var GrantedRoleMapReaderInstance = /*#__PURE__*/ function() {
1065
1065
  /**
1066
1066
  * Creates a {@link ContextGrantedModelRoles} with a no-access role map, indicating the context has no permissions.
1067
1067
  *
1068
- * @param context - the context that was evaluated
1069
- * @param data - optional model data, if it was loaded
1070
- * @returns a ContextGrantedModelRoles with no access
1068
+ * @param context - The context that was evaluated.
1069
+ * @param data - Optional model data, if it was loaded.
1070
+ * @returns A ContextGrantedModelRoles with no access.
1071
1071
  *
1072
1072
  * @example
1073
1073
  * ```typescript
@@ -1080,9 +1080,9 @@ var GrantedRoleMapReaderInstance = /*#__PURE__*/ function() {
1080
1080
  /**
1081
1081
  * Creates a {@link ContextGrantedModelRoles} with a full-access role map, granting all permissions.
1082
1082
  *
1083
- * @param context - the context that was evaluated
1084
- * @param data - optional model data
1085
- * @returns a ContextGrantedModelRoles with full access
1083
+ * @param context - The context that was evaluated.
1084
+ * @param data - Optional model data.
1085
+ * @returns A ContextGrantedModelRoles with full access.
1086
1086
  *
1087
1087
  * @example
1088
1088
  * ```typescript
@@ -1095,10 +1095,10 @@ var GrantedRoleMapReaderInstance = /*#__PURE__*/ function() {
1095
1095
  /**
1096
1096
  * Creates a {@link ContextGrantedModelRoles} with the given role map, data, and context.
1097
1097
  *
1098
- * @param context - the context that was evaluated
1099
- * @param data - the model data, if loaded
1100
- * @param roles - the granted role map
1101
- * @returns a ContextGrantedModelRoles combining all inputs
1098
+ * @param context - The context that was evaluated.
1099
+ * @param data - The model data, if loaded.
1100
+ * @param roles - The granted role map.
1101
+ * @returns A ContextGrantedModelRoles combining all inputs.
1102
1102
  */ function contextGrantedModelRoles(context, data, roles) {
1103
1103
  return {
1104
1104
  data: data,
@@ -1403,8 +1403,8 @@ function _ts_generator$3(thisArg, body) {
1403
1403
  * If the input is a string, it is treated as a commonId and paired with the given commonType.
1404
1404
  * If the input is already a pair, it is returned as-is.
1405
1405
  *
1406
- * @param commonType - the default common type to use when input is a plain string
1407
- * @returns a factory function that produces SyncEntityCommonTypeIdPair instances
1406
+ * @param commonType - The default common type to use when input is a plain string.
1407
+ * @returns A factory function that produces SyncEntityCommonTypeIdPair instances.
1408
1408
  *
1409
1409
  * @example
1410
1410
  * ```typescript
@@ -1412,6 +1412,7 @@ function _ts_generator$3(thisArg, body) {
1412
1412
  * factory('abc123'); // { commonType: 'user', commonId: 'abc123' }
1413
1413
  * factory({ commonType: 'user', commonId: 'abc123' }); // passed through as-is
1414
1414
  * ```
1415
+ *
1415
1416
  * @__NO_SIDE_EFFECTS__
1416
1417
  */ function syncEntityCommonTypeIdPairFactory(commonType) {
1417
1418
  return function(input) {
@@ -1433,8 +1434,8 @@ function _ts_generator$3(thisArg, body) {
1433
1434
  * The factory attaches the configured source info and optionally transforms the commonId into an entity id
1434
1435
  * using the provided idFactory (defaults to identity).
1435
1436
  *
1436
- * @param config - source info and optional id factory
1437
- * @returns a factory that creates SyncEntity instances
1437
+ * @param config - Source info and optional id factory.
1438
+ * @returns A factory that creates SyncEntity instances.
1438
1439
  *
1439
1440
  * @example
1440
1441
  * ```typescript
@@ -1445,6 +1446,7 @@ function _ts_generator$3(thisArg, body) {
1445
1446
  * const entity = factory({ commonType: 'user', commonId: 'abc123' });
1446
1447
  * // entity.id === 'abc123', entity.sourceInfo.id === 'api'
1447
1448
  * ```
1449
+ *
1448
1450
  * @__NO_SIDE_EFFECTS__
1449
1451
  */ function syncEntityFactory(config) {
1450
1452
  var inputIdFactory = config.idFactory, sourceInfo = config.sourceInfo;
@@ -1602,9 +1604,9 @@ function _is_native_reflect_construct() {
1602
1604
  * Registers common type synchronizers and provides lookup by common type. Throws
1603
1605
  * {@link UnregisteredSyncEntityCommonTypeError} if an unregistered common type is requested.
1604
1606
  *
1605
- * @param config - contains the list of common type synchronizers to register
1606
- * @returns a synchronizer that delegates to the appropriate common type synchronizer
1607
- * @throws {UnregisteredSyncEntityCommonTypeError} when requesting an unregistered common type
1607
+ * @param config - Contains the list of common type synchronizers to register.
1608
+ * @returns A synchronizer that delegates to the appropriate common type synchronizer.
1609
+ * @throws {UnregisteredSyncEntityCommonTypeError} When requesting an unregistered common type.
1608
1610
  *
1609
1611
  * @example
1610
1612
  * ```typescript
@@ -1882,11 +1884,12 @@ function _ts_generator$2(thisArg, body) {
1882
1884
  * 2. Secondary sources are synchronized sequentially; if a secondary reports deletion while primary did not, the sync restarts once.
1883
1885
  * 3. Replica sources are synchronized concurrently (up to 3 in parallel).
1884
1886
  *
1885
- * @param config - common type, sources, and context loader
1886
- * @returns a synchronizer for the configured common type
1887
- * @throws {NoPrimarySyncSourceError} when no primary source is found
1888
- * @throws {MultiplePrimarySyncSourceError} when more than one primary source is found
1889
- * @throws {SynchronizationFailedError} when primary or secondary sync returns failed/error
1887
+ * @param config - Common type, sources, and context loader.
1888
+ * @returns A synchronizer for the configured common type.
1889
+ * @throws {NoPrimarySyncSourceError} When no primary source is found.
1890
+ * @throws {MultiplePrimarySyncSourceError} When more than one primary source is found.
1891
+ * @throws {SynchronizationFailedError} When primary or secondary sync returns failed/error.
1892
+ *
1890
1893
  * @__NO_SIDE_EFFECTS__
1891
1894
  */ function basicSyncEntityCommonTypeSynchronizerInstanceFactory(config) {
1892
1895
  var _sourcesByContextType_get, _sourcesByContextType_get1;
@@ -1900,8 +1903,8 @@ function _ts_generator$2(thisArg, body) {
1900
1903
  /**
1901
1904
  * Loads the relevant sources for the given entity and context.
1902
1905
  *
1903
- * @param entityCommonTypeIdPair The common type/id pair identifying the entity.
1904
- * @param entitySourceContext The contextual information for the entity.
1906
+ * @param entityCommonTypeIdPair - The common type/id pair identifying the entity.
1907
+ * @param entitySourceContext - The contextual information for the entity.
1905
1908
  * @returns The relevant sources for the entity.
1906
1909
  */ function loadSources(entityCommonTypeIdPair, entitySourceContext) {
1907
1910
  var globalSources = entitySourceContext.globalSources, contextSources = entitySourceContext.contextSources;
@@ -2015,7 +2018,7 @@ function _ts_generator$2(thisArg, body) {
2015
2018
  /**
2016
2019
  * Performs the synchronization for this entity instance.
2017
2020
  *
2018
- * @param context Optional synchronization context with additional configuration.
2021
+ * @param context - Optional synchronization context with additional configuration.
2019
2022
  * @returns The result of the synchronization operation.
2020
2023
  */ synchronize = function synchronize(context) {
2021
2024
  return _async_to_generator$2(function() {
@@ -2439,8 +2442,8 @@ function _ts_generator$1(thisArg, body) {
2439
2442
  *
2440
2443
  * On validation success, calls the configured handler function. On validation failure, delegates to the error handler.
2441
2444
  *
2442
- * @param config - schema, handler function, and validation error handler
2443
- * @returns a function that validates and processes input objects
2445
+ * @param config - Schema, handler function, and validation error handler.
2446
+ * @returns Wrapped function that runs validation then either invokes the handler or routes failures to the error handler.
2444
2447
  *
2445
2448
  * @example
2446
2449
  * ```typescript
@@ -2457,7 +2460,7 @@ function _ts_generator$1(thisArg, body) {
2457
2460
  var handleValidationError = config.handleValidationError;
2458
2461
  return function(input, context) {
2459
2462
  return _async_to_generator$1(function() {
2460
- var x, result;
2463
+ var x, output, result;
2461
2464
  return _ts_generator$1(this, function(_state) {
2462
2465
  switch(_state.label){
2463
2466
  case 0:
@@ -2467,27 +2470,34 @@ function _ts_generator$1(thisArg, body) {
2467
2470
  ];
2468
2471
  case 1:
2469
2472
  x = _state.sent();
2470
- if (x.success) {
2471
- return [
2472
- 2,
2473
- {
2474
- object: x.object,
2475
- result: x.result
2476
- }
2477
- ];
2478
- }
2473
+ if (!x.success) return [
2474
+ 3,
2475
+ 2
2476
+ ];
2477
+ output = {
2478
+ object: x.object,
2479
+ result: x.result
2480
+ };
2481
+ return [
2482
+ 3,
2483
+ 4
2484
+ ];
2485
+ case 2:
2479
2486
  return [
2480
2487
  4,
2481
2488
  handleValidationError(x.validationErrors)
2482
2489
  ];
2483
- case 2:
2490
+ case 3:
2484
2491
  result = _state.sent();
2492
+ output = {
2493
+ object: undefined,
2494
+ result: result
2495
+ };
2496
+ _state.label = 4;
2497
+ case 4:
2485
2498
  return [
2486
2499
  2,
2487
- {
2488
- object: undefined,
2489
- result: result
2490
- }
2500
+ output
2491
2501
  ];
2492
2502
  }
2493
2503
  });
@@ -2500,8 +2510,9 @@ function _ts_generator$1(thisArg, body) {
2500
2510
  * The factory pre-configures error handling so individual function calls
2501
2511
  * only need to specify the schema and handler.
2502
2512
  *
2503
- * @param defaults - default error handler
2504
- * @returns a factory function that creates TransformAndValidateObjectFunction instances
2513
+ * @param defaults - Default error handler.
2514
+ * @returns A factory function that creates TransformAndValidateObjectFunction instances.
2515
+ *
2505
2516
  * @__NO_SIDE_EFFECTS__
2506
2517
  */ function transformAndValidateObjectFactory(defaults) {
2507
2518
  var defaultHandleValidationError = defaults.handleValidationError;
@@ -2520,8 +2531,8 @@ function _ts_generator$1(thisArg, body) {
2520
2531
  * Returns `{ success: true, object, result }` on valid input, or `{ success: false, validationErrors }` on failure.
2521
2532
  * The caller is responsible for handling the error case.
2522
2533
  *
2523
- * @param config - schema and handler function
2524
- * @returns a function that returns a success/error discriminated result
2534
+ * @param config - Schema and handler function.
2535
+ * @returns Wrapped function that yields a discriminated result so the caller can branch on success or validation failure.
2525
2536
  *
2526
2537
  * @example
2527
2538
  * ```typescript
@@ -2541,34 +2552,41 @@ function _ts_generator$1(thisArg, body) {
2541
2552
  var schema = config.schema, fn = config.fn;
2542
2553
  return function(input) {
2543
2554
  return _async_to_generator$1(function() {
2544
- var out, object, result;
2555
+ var out, output, object, result;
2545
2556
  return _ts_generator$1(this, function(_state) {
2546
2557
  switch(_state.label){
2547
2558
  case 0:
2548
2559
  out = schema(input);
2549
- if (_instanceof(out, type.errors)) {
2550
- return [
2551
- 2,
2552
- {
2553
- validationErrors: out,
2554
- success: false
2555
- }
2556
- ];
2557
- }
2560
+ if (!_instanceof(out, type.errors)) return [
2561
+ 3,
2562
+ 1
2563
+ ];
2564
+ output = {
2565
+ validationErrors: out,
2566
+ success: false
2567
+ };
2568
+ return [
2569
+ 3,
2570
+ 3
2571
+ ];
2572
+ case 1:
2558
2573
  object = out;
2559
2574
  return [
2560
2575
  4,
2561
2576
  fn(object)
2562
2577
  ];
2563
- case 1:
2578
+ case 2:
2564
2579
  result = _state.sent();
2580
+ output = {
2581
+ object: object,
2582
+ result: result,
2583
+ success: true
2584
+ };
2585
+ _state.label = 3;
2586
+ case 3:
2565
2587
  return [
2566
2588
  2,
2567
- {
2568
- object: object,
2569
- result: result,
2570
- success: true
2571
- }
2589
+ output
2572
2590
  ];
2573
2591
  }
2574
2592
  });
@@ -2579,8 +2597,9 @@ function _ts_generator$1(thisArg, body) {
2579
2597
  /**
2580
2598
  * Creates a factory for transform-and-validate functions that return the result with the parsed object attached as `params`.
2581
2599
  *
2582
- * @param defaults - shared error handler defaults
2583
- * @returns a factory that produces functions returning {@link TransformAndValidateFunctionResult}
2600
+ * @param defaults - Shared error handler defaults.
2601
+ * @returns A factory that produces functions returning {@link TransformAndValidateFunctionResult}
2602
+ *
2584
2603
  * @__NO_SIDE_EFFECTS__
2585
2604
  */ function transformAndValidateFunctionResultFactory(defaults) {
2586
2605
  return toTransformAndValidateFunctionResultFactory(transformAndValidateObjectFactory(defaults));
@@ -2589,8 +2608,9 @@ function _ts_generator$1(thisArg, body) {
2589
2608
  * Wraps an existing {@link TransformAndValidateObjectFactory} to produce functions that attach the parsed object
2590
2609
  * as `params` on the result.
2591
2610
  *
2592
- * @param transformAndValidateObjectFactory - the base factory to wrap
2593
- * @returns a factory that produces functions returning results with `params` attached
2611
+ * @param transformAndValidateObjectFactory - The base factory to wrap.
2612
+ * @returns A factory that produces functions returning results with `params` attached.
2613
+ *
2594
2614
  * @__NO_SIDE_EFFECTS__
2595
2615
  */ function toTransformAndValidateFunctionResultFactory(transformAndValidateObjectFactory) {
2596
2616
  return function(schema, fn, handleValidationError) {
@@ -2742,8 +2762,9 @@ function _ts_generator(thisArg, body) {
2742
2762
  *
2743
2763
  * Useful when you only need the processed output and don't need access to the validated input.
2744
2764
  *
2745
- * @param defaults - shared error handler defaults
2746
- * @returns a factory that produces functions returning only the handler's result
2765
+ * @param defaults - Shared error handler defaults.
2766
+ * @returns A factory that produces functions returning only the handler's result.
2767
+ *
2747
2768
  * @__NO_SIDE_EFFECTS__
2748
2769
  */ function transformAndValidateResultFactory(defaults) {
2749
2770
  var factory = transformAndValidateObjectFactory(defaults);
@@ -2817,8 +2838,8 @@ function _ts_generator(thisArg, body) {
2817
2838
  /**
2818
2839
  * Creates an ArkType schema that validates an array has no duplicate keys.
2819
2840
  *
2820
- * @param readKey - function that extracts the key from each array element
2821
- * @returns an ArkType schema that narrows `T[]` to ensure uniqueness
2841
+ * @param readKey - Function that extracts the key from each array element.
2842
+ * @returns An ArkType schema that narrows `T[]` to ensure uniqueness.
2822
2843
  *
2823
2844
  * @example
2824
2845
  * ```typescript