@dereekb/model 13.11.13 → 13.11.15

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