@dereekb/model 13.12.1 → 13.12.3
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 +191 -0
- package/index.esm.js +187 -1
- package/package.json +2 -2
- package/src/lib/validator/date.d.ts +10 -0
- package/src/lib/validator/index.d.ts +1 -0
- package/src/lib/validator/number.d.ts +40 -0
- package/src/lib/validator/phone.d.ts +33 -0
- package/src/lib/validator/point.d.ts +22 -0
- package/src/lib/validator/string.d.ts +54 -0
- package/src/lib/validator/unique.d.ts +7 -0
- package/src/lib/validator/url.d.ts +22 -0
package/index.cjs.js
CHANGED
|
@@ -2934,34 +2934,126 @@ function _ts_generator(thisArg, body) {
|
|
|
2934
2934
|
|
|
2935
2935
|
/**
|
|
2936
2936
|
* ArkType schema for a valid ISO 8601 day string (e.g., "2024-01-15").
|
|
2937
|
+
*
|
|
2938
|
+
* @dbxUtil
|
|
2939
|
+
* @dbxUtilCategory validator
|
|
2940
|
+
* @dbxUtilKind const
|
|
2941
|
+
* @dbxUtilTags validator, arktype, date, iso8601, day, string
|
|
2942
|
+
*
|
|
2943
|
+
* @example
|
|
2944
|
+
* ```ts
|
|
2945
|
+
* type({ startsOn: iso8601DayStringType });
|
|
2946
|
+
* ```
|
|
2937
2947
|
*/ var iso8601DayStringType = arktype.type('string > 0').narrow(function(val, ctx) {
|
|
2938
2948
|
return val != null && util.isISO8601DayString(val) || ctx.mustBe('a valid ISO 8601 day string');
|
|
2939
2949
|
});
|
|
2940
2950
|
|
|
2951
|
+
/**
|
|
2952
|
+
* A number greater than or equal to 0.
|
|
2953
|
+
*
|
|
2954
|
+
* @dbxUtil
|
|
2955
|
+
* @dbxUtilCategory validator
|
|
2956
|
+
* @dbxUtilKind const
|
|
2957
|
+
* @dbxUtilTags validator, arktype, number, non-negative
|
|
2958
|
+
* @dbxUtilRelated non-negative-integer
|
|
2959
|
+
*
|
|
2960
|
+
* @example
|
|
2961
|
+
* ```ts
|
|
2962
|
+
* type({ price: NON_NEGATIVE_NUMBER });
|
|
2963
|
+
* ```
|
|
2964
|
+
*/ var NON_NEGATIVE_NUMBER = 'number >= 0';
|
|
2965
|
+
/**
|
|
2966
|
+
* A non-negative integer.
|
|
2967
|
+
*
|
|
2968
|
+
* @dbxUtil
|
|
2969
|
+
* @dbxUtilCategory validator
|
|
2970
|
+
* @dbxUtilKind const
|
|
2971
|
+
* @dbxUtilTags validator, arktype, number, non-negative, integer
|
|
2972
|
+
* @dbxUtilRelated non-negative-number
|
|
2973
|
+
*
|
|
2974
|
+
* @example
|
|
2975
|
+
* ```ts
|
|
2976
|
+
* type({ count: NON_NEGATIVE_INTEGER });
|
|
2977
|
+
* ```
|
|
2978
|
+
*/ var NON_NEGATIVE_INTEGER = 'number.integer >= 0';
|
|
2941
2979
|
/**
|
|
2942
2980
|
* ArkType schema for a valid minute of the day (0-1439).
|
|
2981
|
+
*
|
|
2982
|
+
* @dbxUtil
|
|
2983
|
+
* @dbxUtilCategory validator
|
|
2984
|
+
* @dbxUtilKind const
|
|
2985
|
+
* @dbxUtilTags validator, arktype, number, minute-of-day, time
|
|
2986
|
+
*
|
|
2987
|
+
* @example
|
|
2988
|
+
* ```ts
|
|
2989
|
+
* type({ startMinute: minuteOfDayType });
|
|
2990
|
+
* ```
|
|
2943
2991
|
*/ var minuteOfDayType = arktype.type('number').narrow(function(val, ctx) {
|
|
2944
2992
|
return val != null && util.isMinuteOfDay(val) || ctx.mustBe('a valid minute of the day (0-1439)');
|
|
2945
2993
|
});
|
|
2946
2994
|
|
|
2947
2995
|
/**
|
|
2948
2996
|
* ArkType schema for a valid E.164 phone number without an extension.
|
|
2997
|
+
*
|
|
2998
|
+
* @dbxUtil
|
|
2999
|
+
* @dbxUtilCategory validator
|
|
3000
|
+
* @dbxUtilKind const
|
|
3001
|
+
* @dbxUtilTags validator, arktype, phone, e164, string
|
|
3002
|
+
* @dbxUtilRelated e164-phone-number-with-optional-extension-type, e164-phone-number-with-extension-type
|
|
3003
|
+
*
|
|
3004
|
+
* @example
|
|
3005
|
+
* ```ts
|
|
3006
|
+
* type({ phone: e164PhoneNumberType });
|
|
3007
|
+
* ```
|
|
2949
3008
|
*/ var e164PhoneNumberType = arktype.type('string > 0').narrow(function(val, ctx) {
|
|
2950
3009
|
return val != null && util.isE164PhoneNumber(val, false) || ctx.mustBe('a valid E.164 phone number without an extension');
|
|
2951
3010
|
});
|
|
2952
3011
|
/**
|
|
2953
3012
|
* ArkType schema for a valid E.164 phone number, optionally with an extension.
|
|
3013
|
+
*
|
|
3014
|
+
* @dbxUtil
|
|
3015
|
+
* @dbxUtilCategory validator
|
|
3016
|
+
* @dbxUtilKind const
|
|
3017
|
+
* @dbxUtilTags validator, arktype, phone, e164, extension, string
|
|
3018
|
+
* @dbxUtilRelated e164-phone-number-type, e164-phone-number-with-extension-type
|
|
3019
|
+
*
|
|
3020
|
+
* @example
|
|
3021
|
+
* ```ts
|
|
3022
|
+
* type({ phone: e164PhoneNumberWithOptionalExtensionType });
|
|
3023
|
+
* ```
|
|
2954
3024
|
*/ var e164PhoneNumberWithOptionalExtensionType = arktype.type('string > 0').narrow(function(val, ctx) {
|
|
2955
3025
|
return val != null && util.isE164PhoneNumber(val, true) || ctx.mustBe('a valid E.164 phone number');
|
|
2956
3026
|
});
|
|
2957
3027
|
/**
|
|
2958
3028
|
* ArkType schema for a valid E.164 phone number that includes an extension.
|
|
3029
|
+
*
|
|
3030
|
+
* @dbxUtil
|
|
3031
|
+
* @dbxUtilCategory validator
|
|
3032
|
+
* @dbxUtilKind const
|
|
3033
|
+
* @dbxUtilTags validator, arktype, phone, e164, extension, string
|
|
3034
|
+
* @dbxUtilRelated e164-phone-number-type, e164-phone-number-with-optional-extension-type
|
|
3035
|
+
*
|
|
3036
|
+
* @example
|
|
3037
|
+
* ```ts
|
|
3038
|
+
* type({ phone: e164PhoneNumberWithExtensionType });
|
|
3039
|
+
* ```
|
|
2959
3040
|
*/ var e164PhoneNumberWithExtensionType = arktype.type('string > 0').narrow(function(val, ctx) {
|
|
2960
3041
|
return val != null && util.isE164PhoneNumberWithExtension(val) || ctx.mustBe('a valid E.164 phone number with an extension');
|
|
2961
3042
|
});
|
|
2962
3043
|
|
|
2963
3044
|
/**
|
|
2964
3045
|
* ArkType schema for a valid {@link LatLngPoint} with lat in [-90, 90] and lng in [-180, 180].
|
|
3046
|
+
*
|
|
3047
|
+
* @dbxUtil
|
|
3048
|
+
* @dbxUtilCategory validator
|
|
3049
|
+
* @dbxUtilKind const
|
|
3050
|
+
* @dbxUtilTags validator, arktype, lat-lng, point, geo, coordinates
|
|
3051
|
+
* @dbxUtilRelated lat-lng-string-type
|
|
3052
|
+
*
|
|
3053
|
+
* @example
|
|
3054
|
+
* ```ts
|
|
3055
|
+
* type({ location: latLngPointType });
|
|
3056
|
+
* ```
|
|
2965
3057
|
*/ var latLngPointType = arktype.type({
|
|
2966
3058
|
lat: '-90 <= number <= 90',
|
|
2967
3059
|
lng: '-180 <= number <= 180'
|
|
@@ -2970,20 +3062,92 @@ function _ts_generator(thisArg, body) {
|
|
|
2970
3062
|
});
|
|
2971
3063
|
/**
|
|
2972
3064
|
* ArkType schema for a valid {@link LatLngString} (comma-separated lat/lng, e.g. "30.5,-96.3").
|
|
3065
|
+
*
|
|
3066
|
+
* @dbxUtil
|
|
3067
|
+
* @dbxUtilCategory validator
|
|
3068
|
+
* @dbxUtilKind const
|
|
3069
|
+
* @dbxUtilTags validator, arktype, lat-lng, geo, coordinates, string
|
|
3070
|
+
* @dbxUtilRelated lat-lng-point-type
|
|
3071
|
+
*
|
|
3072
|
+
* @example
|
|
3073
|
+
* ```ts
|
|
3074
|
+
* type({ location: latLngStringType });
|
|
3075
|
+
* ```
|
|
2973
3076
|
*/ var latLngStringType = arktype.type('string > 0').narrow(function(val, ctx) {
|
|
2974
3077
|
return val != null && util.isLatLngString(val) || ctx.mustBe('a valid lat,lng string (e.g. "30.5,-96.3")');
|
|
2975
3078
|
});
|
|
2976
3079
|
|
|
3080
|
+
/**
|
|
3081
|
+
* A string with at least one character (non-empty).
|
|
3082
|
+
*
|
|
3083
|
+
* @dbxUtil
|
|
3084
|
+
* @dbxUtilCategory validator
|
|
3085
|
+
* @dbxUtilKind const
|
|
3086
|
+
* @dbxUtilTags validator, arktype, string, non-empty, required
|
|
3087
|
+
* @dbxUtilRelated email-string, non-empty-string-with-max-length
|
|
3088
|
+
*
|
|
3089
|
+
* @example
|
|
3090
|
+
* ```ts
|
|
3091
|
+
* type({ name: NON_EMPTY_STRING });
|
|
3092
|
+
* ```
|
|
3093
|
+
*/ var NON_EMPTY_STRING = 'string > 0';
|
|
3094
|
+
/**
|
|
3095
|
+
* A valid email address string.
|
|
3096
|
+
*
|
|
3097
|
+
* @dbxUtil
|
|
3098
|
+
* @dbxUtilCategory validator
|
|
3099
|
+
* @dbxUtilKind const
|
|
3100
|
+
* @dbxUtilTags validator, arktype, string, email
|
|
3101
|
+
*
|
|
3102
|
+
* @example
|
|
3103
|
+
* ```ts
|
|
3104
|
+
* type({ email: EMAIL_STRING });
|
|
3105
|
+
* ```
|
|
3106
|
+
*/ var EMAIL_STRING = 'string.email';
|
|
3107
|
+
/**
|
|
3108
|
+
* Creates an ArkType string definition for a non-empty string with a maximum length.
|
|
3109
|
+
*
|
|
3110
|
+
* Composes {@link NON_EMPTY_STRING} with an upper-bound length constraint, producing a
|
|
3111
|
+
* DSL fragment that can be interpolated directly into an ArkType `type({ ... })` schema.
|
|
3112
|
+
*
|
|
3113
|
+
* @param maxLength - The maximum number of characters allowed (inclusive).
|
|
3114
|
+
* @returns The ArkType string definition.
|
|
3115
|
+
*
|
|
3116
|
+
* @dbxUtil
|
|
3117
|
+
* @dbxUtilCategory validator
|
|
3118
|
+
* @dbxUtilKind factory
|
|
3119
|
+
* @dbxUtilTags validator, arktype, string, non-empty, max-length, bounded
|
|
3120
|
+
* @dbxUtilRelated non-empty-string
|
|
3121
|
+
*
|
|
3122
|
+
* @example
|
|
3123
|
+
* ```ts
|
|
3124
|
+
* const userType = type({
|
|
3125
|
+
* displayName: nonEmptyStringWithMaxLength(64)
|
|
3126
|
+
* });
|
|
3127
|
+
* ```
|
|
3128
|
+
*
|
|
3129
|
+
* @__NO_SIDE_EFFECTS__
|
|
3130
|
+
*/ function nonEmptyStringWithMaxLength(maxLength) {
|
|
3131
|
+
return "".concat(NON_EMPTY_STRING, " & string <= ").concat(maxLength);
|
|
3132
|
+
}
|
|
3133
|
+
|
|
2977
3134
|
/**
|
|
2978
3135
|
* Creates an ArkType schema that validates an array has no duplicate keys.
|
|
2979
3136
|
*
|
|
2980
3137
|
* @param readKey - Function that extracts the key from each array element.
|
|
2981
3138
|
* @returns An ArkType schema that narrows `T[]` to ensure uniqueness.
|
|
2982
3139
|
*
|
|
3140
|
+
* @dbxUtil
|
|
3141
|
+
* @dbxUtilCategory validator
|
|
3142
|
+
* @dbxUtilKind factory
|
|
3143
|
+
* @dbxUtilTags validator, arktype, array, unique, uniqueness, keyed
|
|
3144
|
+
*
|
|
2983
3145
|
* @example
|
|
2984
3146
|
* ```typescript
|
|
2985
3147
|
* const uniqueItemsType = uniqueKeyedType((item: Item) => item.id);
|
|
2986
3148
|
* ```
|
|
3149
|
+
*
|
|
3150
|
+
* @__NO_SIDE_EFFECTS__
|
|
2987
3151
|
*/ function uniqueKeyedType(readKey) {
|
|
2988
3152
|
var isUniqueKeyed = util.isUniqueKeyedFunction(readKey);
|
|
2989
3153
|
return arktype.type('unknown[]').narrow(function(val, ctx) {
|
|
@@ -2993,11 +3157,33 @@ function _ts_generator(thisArg, body) {
|
|
|
2993
3157
|
|
|
2994
3158
|
/**
|
|
2995
3159
|
* ArkType schema for a valid website URL (with or without protocol prefix).
|
|
3160
|
+
*
|
|
3161
|
+
* @dbxUtil
|
|
3162
|
+
* @dbxUtilCategory validator
|
|
3163
|
+
* @dbxUtilKind const
|
|
3164
|
+
* @dbxUtilTags validator, arktype, url, website, string
|
|
3165
|
+
* @dbxUtilRelated website-url-with-prefix-type
|
|
3166
|
+
*
|
|
3167
|
+
* @example
|
|
3168
|
+
* ```ts
|
|
3169
|
+
* type({ website: websiteUrlType });
|
|
3170
|
+
* ```
|
|
2996
3171
|
*/ var websiteUrlType = arktype.type('string > 0').narrow(function(val, ctx) {
|
|
2997
3172
|
return val != null && util.isWebsiteUrl(val) || ctx.mustBe('a valid website URL');
|
|
2998
3173
|
});
|
|
2999
3174
|
/**
|
|
3000
3175
|
* ArkType schema for a valid website URL that starts with `http://` or `https://`.
|
|
3176
|
+
*
|
|
3177
|
+
* @dbxUtil
|
|
3178
|
+
* @dbxUtilCategory validator
|
|
3179
|
+
* @dbxUtilKind const
|
|
3180
|
+
* @dbxUtilTags validator, arktype, url, website, prefix, https, string
|
|
3181
|
+
* @dbxUtilRelated website-url-type
|
|
3182
|
+
*
|
|
3183
|
+
* @example
|
|
3184
|
+
* ```ts
|
|
3185
|
+
* type({ website: websiteUrlWithPrefixType });
|
|
3186
|
+
* ```
|
|
3001
3187
|
*/ var websiteUrlWithPrefixType = arktype.type('string > 0').narrow(function(val, ctx) {
|
|
3002
3188
|
return val != null && util.isWebsiteUrlWithPrefix(val) || ctx.mustBe('a valid website URL starting with http:// or https://');
|
|
3003
3189
|
});
|
|
@@ -3013,6 +3199,7 @@ exports.AbstractModelPermissionService = AbstractModelPermissionService;
|
|
|
3013
3199
|
exports.CASHAPP_BASE_URL = CASHAPP_BASE_URL;
|
|
3014
3200
|
exports.CASHAPP_USERNAME_PREFIX = CASHAPP_USERNAME_PREFIX;
|
|
3015
3201
|
exports.CASHAPP_WEBSITE_LINK_TYPE = CASHAPP_WEBSITE_LINK_TYPE;
|
|
3202
|
+
exports.EMAIL_STRING = EMAIL_STRING;
|
|
3016
3203
|
exports.EMAIL_URL_WEBSITE_LINK_TYPE = EMAIL_URL_WEBSITE_LINK_TYPE;
|
|
3017
3204
|
exports.EMPTY_ARKTYPE_TYPE = EMPTY_ARKTYPE_TYPE;
|
|
3018
3205
|
exports.FACEBOOK_BASE_URL = FACEBOOK_BASE_URL;
|
|
@@ -3027,6 +3214,9 @@ exports.GRANTED_UPDATE_ROLE_KEY = GRANTED_UPDATE_ROLE_KEY;
|
|
|
3027
3214
|
exports.GrantedRoleMapReaderInstance = GrantedRoleMapReaderInstance;
|
|
3028
3215
|
exports.INSTAGRAM_BASE_URL = INSTAGRAM_BASE_URL;
|
|
3029
3216
|
exports.INSTAGRAM_WEBSITE_LINK_TYPE = INSTAGRAM_WEBSITE_LINK_TYPE;
|
|
3217
|
+
exports.NON_EMPTY_STRING = NON_EMPTY_STRING;
|
|
3218
|
+
exports.NON_NEGATIVE_INTEGER = NON_NEGATIVE_INTEGER;
|
|
3219
|
+
exports.NON_NEGATIVE_NUMBER = NON_NEGATIVE_NUMBER;
|
|
3030
3220
|
exports.NO_ACCESS_ROLE_KEY = NO_ACCESS_ROLE_KEY;
|
|
3031
3221
|
exports.PAYPAL_BASE_URL = PAYPAL_BASE_URL;
|
|
3032
3222
|
exports.PAYPAL_WEBSITE_LINK_TYPE = PAYPAL_WEBSITE_LINK_TYPE;
|
|
@@ -3096,6 +3286,7 @@ exports.modelIdType = modelIdType;
|
|
|
3096
3286
|
exports.modelKeyType = modelKeyType;
|
|
3097
3287
|
exports.noAccessContextGrantedModelRoles = noAccessContextGrantedModelRoles;
|
|
3098
3288
|
exports.noAccessRoleMap = noAccessRoleMap;
|
|
3289
|
+
exports.nonEmptyStringWithMaxLength = nonEmptyStringWithMaxLength;
|
|
3099
3290
|
exports.paypalProfileUrl = paypalProfileUrl;
|
|
3100
3291
|
exports.paypalProfileUrlToWebsiteLink = paypalProfileUrlToWebsiteLink;
|
|
3101
3292
|
exports.phoneNumberToWebsiteLink = phoneNumberToWebsiteLink;
|
package/index.esm.js
CHANGED
|
@@ -2932,34 +2932,126 @@ function _ts_generator(thisArg, body) {
|
|
|
2932
2932
|
|
|
2933
2933
|
/**
|
|
2934
2934
|
* ArkType schema for a valid ISO 8601 day string (e.g., "2024-01-15").
|
|
2935
|
+
*
|
|
2936
|
+
* @dbxUtil
|
|
2937
|
+
* @dbxUtilCategory validator
|
|
2938
|
+
* @dbxUtilKind const
|
|
2939
|
+
* @dbxUtilTags validator, arktype, date, iso8601, day, string
|
|
2940
|
+
*
|
|
2941
|
+
* @example
|
|
2942
|
+
* ```ts
|
|
2943
|
+
* type({ startsOn: iso8601DayStringType });
|
|
2944
|
+
* ```
|
|
2935
2945
|
*/ var iso8601DayStringType = type('string > 0').narrow(function(val, ctx) {
|
|
2936
2946
|
return val != null && isISO8601DayString(val) || ctx.mustBe('a valid ISO 8601 day string');
|
|
2937
2947
|
});
|
|
2938
2948
|
|
|
2949
|
+
/**
|
|
2950
|
+
* A number greater than or equal to 0.
|
|
2951
|
+
*
|
|
2952
|
+
* @dbxUtil
|
|
2953
|
+
* @dbxUtilCategory validator
|
|
2954
|
+
* @dbxUtilKind const
|
|
2955
|
+
* @dbxUtilTags validator, arktype, number, non-negative
|
|
2956
|
+
* @dbxUtilRelated non-negative-integer
|
|
2957
|
+
*
|
|
2958
|
+
* @example
|
|
2959
|
+
* ```ts
|
|
2960
|
+
* type({ price: NON_NEGATIVE_NUMBER });
|
|
2961
|
+
* ```
|
|
2962
|
+
*/ var NON_NEGATIVE_NUMBER = 'number >= 0';
|
|
2963
|
+
/**
|
|
2964
|
+
* A non-negative integer.
|
|
2965
|
+
*
|
|
2966
|
+
* @dbxUtil
|
|
2967
|
+
* @dbxUtilCategory validator
|
|
2968
|
+
* @dbxUtilKind const
|
|
2969
|
+
* @dbxUtilTags validator, arktype, number, non-negative, integer
|
|
2970
|
+
* @dbxUtilRelated non-negative-number
|
|
2971
|
+
*
|
|
2972
|
+
* @example
|
|
2973
|
+
* ```ts
|
|
2974
|
+
* type({ count: NON_NEGATIVE_INTEGER });
|
|
2975
|
+
* ```
|
|
2976
|
+
*/ var NON_NEGATIVE_INTEGER = 'number.integer >= 0';
|
|
2939
2977
|
/**
|
|
2940
2978
|
* ArkType schema for a valid minute of the day (0-1439).
|
|
2979
|
+
*
|
|
2980
|
+
* @dbxUtil
|
|
2981
|
+
* @dbxUtilCategory validator
|
|
2982
|
+
* @dbxUtilKind const
|
|
2983
|
+
* @dbxUtilTags validator, arktype, number, minute-of-day, time
|
|
2984
|
+
*
|
|
2985
|
+
* @example
|
|
2986
|
+
* ```ts
|
|
2987
|
+
* type({ startMinute: minuteOfDayType });
|
|
2988
|
+
* ```
|
|
2941
2989
|
*/ var minuteOfDayType = type('number').narrow(function(val, ctx) {
|
|
2942
2990
|
return val != null && isMinuteOfDay(val) || ctx.mustBe('a valid minute of the day (0-1439)');
|
|
2943
2991
|
});
|
|
2944
2992
|
|
|
2945
2993
|
/**
|
|
2946
2994
|
* ArkType schema for a valid E.164 phone number without an extension.
|
|
2995
|
+
*
|
|
2996
|
+
* @dbxUtil
|
|
2997
|
+
* @dbxUtilCategory validator
|
|
2998
|
+
* @dbxUtilKind const
|
|
2999
|
+
* @dbxUtilTags validator, arktype, phone, e164, string
|
|
3000
|
+
* @dbxUtilRelated e164-phone-number-with-optional-extension-type, e164-phone-number-with-extension-type
|
|
3001
|
+
*
|
|
3002
|
+
* @example
|
|
3003
|
+
* ```ts
|
|
3004
|
+
* type({ phone: e164PhoneNumberType });
|
|
3005
|
+
* ```
|
|
2947
3006
|
*/ var e164PhoneNumberType = type('string > 0').narrow(function(val, ctx) {
|
|
2948
3007
|
return val != null && isE164PhoneNumber(val, false) || ctx.mustBe('a valid E.164 phone number without an extension');
|
|
2949
3008
|
});
|
|
2950
3009
|
/**
|
|
2951
3010
|
* ArkType schema for a valid E.164 phone number, optionally with an extension.
|
|
3011
|
+
*
|
|
3012
|
+
* @dbxUtil
|
|
3013
|
+
* @dbxUtilCategory validator
|
|
3014
|
+
* @dbxUtilKind const
|
|
3015
|
+
* @dbxUtilTags validator, arktype, phone, e164, extension, string
|
|
3016
|
+
* @dbxUtilRelated e164-phone-number-type, e164-phone-number-with-extension-type
|
|
3017
|
+
*
|
|
3018
|
+
* @example
|
|
3019
|
+
* ```ts
|
|
3020
|
+
* type({ phone: e164PhoneNumberWithOptionalExtensionType });
|
|
3021
|
+
* ```
|
|
2952
3022
|
*/ var e164PhoneNumberWithOptionalExtensionType = type('string > 0').narrow(function(val, ctx) {
|
|
2953
3023
|
return val != null && isE164PhoneNumber(val, true) || ctx.mustBe('a valid E.164 phone number');
|
|
2954
3024
|
});
|
|
2955
3025
|
/**
|
|
2956
3026
|
* ArkType schema for a valid E.164 phone number that includes an extension.
|
|
3027
|
+
*
|
|
3028
|
+
* @dbxUtil
|
|
3029
|
+
* @dbxUtilCategory validator
|
|
3030
|
+
* @dbxUtilKind const
|
|
3031
|
+
* @dbxUtilTags validator, arktype, phone, e164, extension, string
|
|
3032
|
+
* @dbxUtilRelated e164-phone-number-type, e164-phone-number-with-optional-extension-type
|
|
3033
|
+
*
|
|
3034
|
+
* @example
|
|
3035
|
+
* ```ts
|
|
3036
|
+
* type({ phone: e164PhoneNumberWithExtensionType });
|
|
3037
|
+
* ```
|
|
2957
3038
|
*/ var e164PhoneNumberWithExtensionType = type('string > 0').narrow(function(val, ctx) {
|
|
2958
3039
|
return val != null && isE164PhoneNumberWithExtension(val) || ctx.mustBe('a valid E.164 phone number with an extension');
|
|
2959
3040
|
});
|
|
2960
3041
|
|
|
2961
3042
|
/**
|
|
2962
3043
|
* ArkType schema for a valid {@link LatLngPoint} with lat in [-90, 90] and lng in [-180, 180].
|
|
3044
|
+
*
|
|
3045
|
+
* @dbxUtil
|
|
3046
|
+
* @dbxUtilCategory validator
|
|
3047
|
+
* @dbxUtilKind const
|
|
3048
|
+
* @dbxUtilTags validator, arktype, lat-lng, point, geo, coordinates
|
|
3049
|
+
* @dbxUtilRelated lat-lng-string-type
|
|
3050
|
+
*
|
|
3051
|
+
* @example
|
|
3052
|
+
* ```ts
|
|
3053
|
+
* type({ location: latLngPointType });
|
|
3054
|
+
* ```
|
|
2963
3055
|
*/ var latLngPointType = type({
|
|
2964
3056
|
lat: '-90 <= number <= 90',
|
|
2965
3057
|
lng: '-180 <= number <= 180'
|
|
@@ -2968,20 +3060,92 @@ function _ts_generator(thisArg, body) {
|
|
|
2968
3060
|
});
|
|
2969
3061
|
/**
|
|
2970
3062
|
* ArkType schema for a valid {@link LatLngString} (comma-separated lat/lng, e.g. "30.5,-96.3").
|
|
3063
|
+
*
|
|
3064
|
+
* @dbxUtil
|
|
3065
|
+
* @dbxUtilCategory validator
|
|
3066
|
+
* @dbxUtilKind const
|
|
3067
|
+
* @dbxUtilTags validator, arktype, lat-lng, geo, coordinates, string
|
|
3068
|
+
* @dbxUtilRelated lat-lng-point-type
|
|
3069
|
+
*
|
|
3070
|
+
* @example
|
|
3071
|
+
* ```ts
|
|
3072
|
+
* type({ location: latLngStringType });
|
|
3073
|
+
* ```
|
|
2971
3074
|
*/ var latLngStringType = type('string > 0').narrow(function(val, ctx) {
|
|
2972
3075
|
return val != null && isLatLngString(val) || ctx.mustBe('a valid lat,lng string (e.g. "30.5,-96.3")');
|
|
2973
3076
|
});
|
|
2974
3077
|
|
|
3078
|
+
/**
|
|
3079
|
+
* A string with at least one character (non-empty).
|
|
3080
|
+
*
|
|
3081
|
+
* @dbxUtil
|
|
3082
|
+
* @dbxUtilCategory validator
|
|
3083
|
+
* @dbxUtilKind const
|
|
3084
|
+
* @dbxUtilTags validator, arktype, string, non-empty, required
|
|
3085
|
+
* @dbxUtilRelated email-string, non-empty-string-with-max-length
|
|
3086
|
+
*
|
|
3087
|
+
* @example
|
|
3088
|
+
* ```ts
|
|
3089
|
+
* type({ name: NON_EMPTY_STRING });
|
|
3090
|
+
* ```
|
|
3091
|
+
*/ var NON_EMPTY_STRING = 'string > 0';
|
|
3092
|
+
/**
|
|
3093
|
+
* A valid email address string.
|
|
3094
|
+
*
|
|
3095
|
+
* @dbxUtil
|
|
3096
|
+
* @dbxUtilCategory validator
|
|
3097
|
+
* @dbxUtilKind const
|
|
3098
|
+
* @dbxUtilTags validator, arktype, string, email
|
|
3099
|
+
*
|
|
3100
|
+
* @example
|
|
3101
|
+
* ```ts
|
|
3102
|
+
* type({ email: EMAIL_STRING });
|
|
3103
|
+
* ```
|
|
3104
|
+
*/ var EMAIL_STRING = 'string.email';
|
|
3105
|
+
/**
|
|
3106
|
+
* Creates an ArkType string definition for a non-empty string with a maximum length.
|
|
3107
|
+
*
|
|
3108
|
+
* Composes {@link NON_EMPTY_STRING} with an upper-bound length constraint, producing a
|
|
3109
|
+
* DSL fragment that can be interpolated directly into an ArkType `type({ ... })` schema.
|
|
3110
|
+
*
|
|
3111
|
+
* @param maxLength - The maximum number of characters allowed (inclusive).
|
|
3112
|
+
* @returns The ArkType string definition.
|
|
3113
|
+
*
|
|
3114
|
+
* @dbxUtil
|
|
3115
|
+
* @dbxUtilCategory validator
|
|
3116
|
+
* @dbxUtilKind factory
|
|
3117
|
+
* @dbxUtilTags validator, arktype, string, non-empty, max-length, bounded
|
|
3118
|
+
* @dbxUtilRelated non-empty-string
|
|
3119
|
+
*
|
|
3120
|
+
* @example
|
|
3121
|
+
* ```ts
|
|
3122
|
+
* const userType = type({
|
|
3123
|
+
* displayName: nonEmptyStringWithMaxLength(64)
|
|
3124
|
+
* });
|
|
3125
|
+
* ```
|
|
3126
|
+
*
|
|
3127
|
+
* @__NO_SIDE_EFFECTS__
|
|
3128
|
+
*/ function nonEmptyStringWithMaxLength(maxLength) {
|
|
3129
|
+
return "".concat(NON_EMPTY_STRING, " & string <= ").concat(maxLength);
|
|
3130
|
+
}
|
|
3131
|
+
|
|
2975
3132
|
/**
|
|
2976
3133
|
* Creates an ArkType schema that validates an array has no duplicate keys.
|
|
2977
3134
|
*
|
|
2978
3135
|
* @param readKey - Function that extracts the key from each array element.
|
|
2979
3136
|
* @returns An ArkType schema that narrows `T[]` to ensure uniqueness.
|
|
2980
3137
|
*
|
|
3138
|
+
* @dbxUtil
|
|
3139
|
+
* @dbxUtilCategory validator
|
|
3140
|
+
* @dbxUtilKind factory
|
|
3141
|
+
* @dbxUtilTags validator, arktype, array, unique, uniqueness, keyed
|
|
3142
|
+
*
|
|
2981
3143
|
* @example
|
|
2982
3144
|
* ```typescript
|
|
2983
3145
|
* const uniqueItemsType = uniqueKeyedType((item: Item) => item.id);
|
|
2984
3146
|
* ```
|
|
3147
|
+
*
|
|
3148
|
+
* @__NO_SIDE_EFFECTS__
|
|
2985
3149
|
*/ function uniqueKeyedType(readKey) {
|
|
2986
3150
|
var isUniqueKeyed = isUniqueKeyedFunction(readKey);
|
|
2987
3151
|
return type('unknown[]').narrow(function(val, ctx) {
|
|
@@ -2991,13 +3155,35 @@ function _ts_generator(thisArg, body) {
|
|
|
2991
3155
|
|
|
2992
3156
|
/**
|
|
2993
3157
|
* ArkType schema for a valid website URL (with or without protocol prefix).
|
|
3158
|
+
*
|
|
3159
|
+
* @dbxUtil
|
|
3160
|
+
* @dbxUtilCategory validator
|
|
3161
|
+
* @dbxUtilKind const
|
|
3162
|
+
* @dbxUtilTags validator, arktype, url, website, string
|
|
3163
|
+
* @dbxUtilRelated website-url-with-prefix-type
|
|
3164
|
+
*
|
|
3165
|
+
* @example
|
|
3166
|
+
* ```ts
|
|
3167
|
+
* type({ website: websiteUrlType });
|
|
3168
|
+
* ```
|
|
2994
3169
|
*/ var websiteUrlType = type('string > 0').narrow(function(val, ctx) {
|
|
2995
3170
|
return val != null && isWebsiteUrl(val) || ctx.mustBe('a valid website URL');
|
|
2996
3171
|
});
|
|
2997
3172
|
/**
|
|
2998
3173
|
* ArkType schema for a valid website URL that starts with `http://` or `https://`.
|
|
3174
|
+
*
|
|
3175
|
+
* @dbxUtil
|
|
3176
|
+
* @dbxUtilCategory validator
|
|
3177
|
+
* @dbxUtilKind const
|
|
3178
|
+
* @dbxUtilTags validator, arktype, url, website, prefix, https, string
|
|
3179
|
+
* @dbxUtilRelated website-url-type
|
|
3180
|
+
*
|
|
3181
|
+
* @example
|
|
3182
|
+
* ```ts
|
|
3183
|
+
* type({ website: websiteUrlWithPrefixType });
|
|
3184
|
+
* ```
|
|
2999
3185
|
*/ var websiteUrlWithPrefixType = type('string > 0').narrow(function(val, ctx) {
|
|
3000
3186
|
return val != null && isWebsiteUrlWithPrefix(val) || ctx.mustBe('a valid website URL starting with http:// or https://');
|
|
3001
3187
|
});
|
|
3002
3188
|
|
|
3003
|
-
export { ADDRESS_CITY_MAX_LENGTH, ADDRESS_COUNTRY_MAX_LENGTH, ADDRESS_LINE_MAX_LENGTH, ADDRESS_STATE_CODE_MAX_LENGTH, ADDRESS_STATE_MAX_LENGTH, ADDRESS_ZIP_MAX_LENGTH, ARKTYPE_DATE_DTO_TYPE, AbstractModelPermissionService, CASHAPP_BASE_URL, CASHAPP_USERNAME_PREFIX, CASHAPP_WEBSITE_LINK_TYPE, EMAIL_URL_WEBSITE_LINK_TYPE, EMPTY_ARKTYPE_TYPE, FACEBOOK_BASE_URL, FACEBOOK_WEBSITE_LINK_TYPE, FULL_ACCESS_ROLE_KEY, GRANTED_ADMIN_ROLE_KEY, GRANTED_DELETE_ROLE_KEY, GRANTED_OWNER_ROLE_KEY, GRANTED_READ_ROLE_KEY, GRANTED_SYS_ADMIN_ROLE_KEY, GRANTED_UPDATE_ROLE_KEY, GrantedRoleMapReaderInstance, INSTAGRAM_BASE_URL, INSTAGRAM_WEBSITE_LINK_TYPE, NO_ACCESS_ROLE_KEY, PAYPAL_BASE_URL, PAYPAL_WEBSITE_LINK_TYPE, PHONE_URL_WEBSITE_LINK_TYPE, SNAPCHAT_BASE_URL, SNAPCHAT_WEBSITE_LINK_ISOLATE_PROFILE_ID, SNAPCHAT_WEBSITE_LINK_TYPE, SPOTIFY_BASE_URL, SPOTIFY_WEBSITE_LINK_ISOLATE_PROFILE_ID, SPOTIFY_WEBSITE_LINK_TYPE, TIKTOK_BASE_URL, TIKTOK_USERNAME_PREFIX, TIKTOK_WEBSITE_LINK_TYPE, TWITTER_BASE_URL, TWITTER_WEBSITE_LINK_TYPE, UNKNOWN_WEBSITE_LINK_TYPE, VENMO_BASE_URL, VENMO_WEBSITE_LINK_ISOLATE_PROFILE_ID, VENMO_WEBSITE_LINK_TYPE, WEBSITE_FILE_LINK_DATA_MAX_LENGTH, WEBSITE_FILE_LINK_DATA_REGEX, WEBSITE_FILE_LINK_ENCODE_SEPARATOR, WEBSITE_FILE_LINK_MIME_TYPE_MAX_LENGTH, WEBSITE_FILE_LINK_MIME_TYPE_REGEX, WEBSITE_FILE_LINK_NAME_MAX_LENGTH, WEBSITE_FILE_LINK_TYPE_MAX_LENGTH, WEBSITE_FILE_LINK_TYPE_REGEX, WEBSITE_FILE_LINK_WEBSITE_LINK_TYPE, WEBSITE_LINK_ENCODED_DATA_MAX_LENGTH, WEBSITE_LINK_ISOLATE_BASE_URL_PROFILE_ID, WEBSITE_LINK_TYPE_MAX_LENGTH, WEBSITE_LINK_TYPE_REGEX, WEBSITE_URL_WEBSITE_LINK_TYPE, YOUTUBE_BASE_URL, YOUTUBE_WEBSITE_LINK_ISOLATE_PROFILE_ID, YOUTUBE_WEBSITE_LINK_TYPE, arktypeToJsonSchemaForExport, basicSyncEntityCommonTypeSynchronizerInstanceFactory, cashappProfileUrl, cashappProfileUrlToWebsiteLink, clearable, contextGrantedModelRoles, decodeWebsiteLinkEncodedDataToWebsiteFileLink, e164PhoneNumberType, e164PhoneNumberWithExtensionType, e164PhoneNumberWithOptionalExtensionType, emailAddressToWebsiteLink, emptyType, encodeWebsiteFileLinkToWebsiteLinkEncodedData, facebookProfileUrl, facebookProfileUrlToWebsiteLink, fullAccessGrantedModelRoles, fullAccessRoleMap, grantedRoleKeysMapFromArray, grantedRoleMapReader, instagramProfileUrl, instagramProfileUrlToWebsiteLink, isFullAccessRoleMap, isGrantedAdminLevelRole, isNoAccessRoleMap, isValidWebsiteLinkType, iso8601DayStringType, latLngPointType, latLngStringType, minuteOfDayType, modelIdType, modelKeyType, noAccessContextGrantedModelRoles, noAccessRoleMap, paypalProfileUrl, paypalProfileUrlToWebsiteLink, phoneNumberToWebsiteLink, pruneFalseUnionBranches, snapchatProfileUrl, snapchatProfileUrlToWebsiteLink, spotifyProfileUrl, spotifyProfileUrlToWebsiteLink, syncEntityCommonTypeIdPairFactory, syncEntityFactory, syncEntitySynchronizer, targetModelIdParamsType, targetModelParamsType, tiktokProfileUrl, tiktokProfileUrlToWebsiteLink, toTransformAndValidateFunctionResult, toTransformAndValidateFunctionResultFactory, transformAndValidateFunctionResultFactory, transformAndValidateObject, transformAndValidateObjectFactory, transformAndValidateObjectResult, transformAndValidateResultFactory, twitterProfileUrl, twitterProfileUrlToWebsiteLink, uniqueKeyedType, unitedStatesAddressWithStateCodeType, unitedStatesAddressWithStateStringType, usernameFromUsernameOrWebsiteWithBaseUrlUsername, usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername, usernameOrWebsiteUrlToWebsiteUrl, venmoProfileUrl, venmoProfileUrlToWebsiteLink, websiteFileLinkToWebsiteLink, websiteFileLinkType, websiteLinkToWebsiteLinkFile, websiteLinkType, websiteUrlToWebsiteLink, websiteUrlType, websiteUrlWithPrefixType, youtubeProfileUrl, youtubeProfileUrlToWebsiteLink };
|
|
3189
|
+
export { ADDRESS_CITY_MAX_LENGTH, ADDRESS_COUNTRY_MAX_LENGTH, ADDRESS_LINE_MAX_LENGTH, ADDRESS_STATE_CODE_MAX_LENGTH, ADDRESS_STATE_MAX_LENGTH, ADDRESS_ZIP_MAX_LENGTH, ARKTYPE_DATE_DTO_TYPE, AbstractModelPermissionService, CASHAPP_BASE_URL, CASHAPP_USERNAME_PREFIX, CASHAPP_WEBSITE_LINK_TYPE, EMAIL_STRING, EMAIL_URL_WEBSITE_LINK_TYPE, EMPTY_ARKTYPE_TYPE, FACEBOOK_BASE_URL, FACEBOOK_WEBSITE_LINK_TYPE, FULL_ACCESS_ROLE_KEY, GRANTED_ADMIN_ROLE_KEY, GRANTED_DELETE_ROLE_KEY, GRANTED_OWNER_ROLE_KEY, GRANTED_READ_ROLE_KEY, GRANTED_SYS_ADMIN_ROLE_KEY, GRANTED_UPDATE_ROLE_KEY, GrantedRoleMapReaderInstance, INSTAGRAM_BASE_URL, INSTAGRAM_WEBSITE_LINK_TYPE, NON_EMPTY_STRING, NON_NEGATIVE_INTEGER, NON_NEGATIVE_NUMBER, NO_ACCESS_ROLE_KEY, PAYPAL_BASE_URL, PAYPAL_WEBSITE_LINK_TYPE, PHONE_URL_WEBSITE_LINK_TYPE, SNAPCHAT_BASE_URL, SNAPCHAT_WEBSITE_LINK_ISOLATE_PROFILE_ID, SNAPCHAT_WEBSITE_LINK_TYPE, SPOTIFY_BASE_URL, SPOTIFY_WEBSITE_LINK_ISOLATE_PROFILE_ID, SPOTIFY_WEBSITE_LINK_TYPE, TIKTOK_BASE_URL, TIKTOK_USERNAME_PREFIX, TIKTOK_WEBSITE_LINK_TYPE, TWITTER_BASE_URL, TWITTER_WEBSITE_LINK_TYPE, UNKNOWN_WEBSITE_LINK_TYPE, VENMO_BASE_URL, VENMO_WEBSITE_LINK_ISOLATE_PROFILE_ID, VENMO_WEBSITE_LINK_TYPE, WEBSITE_FILE_LINK_DATA_MAX_LENGTH, WEBSITE_FILE_LINK_DATA_REGEX, WEBSITE_FILE_LINK_ENCODE_SEPARATOR, WEBSITE_FILE_LINK_MIME_TYPE_MAX_LENGTH, WEBSITE_FILE_LINK_MIME_TYPE_REGEX, WEBSITE_FILE_LINK_NAME_MAX_LENGTH, WEBSITE_FILE_LINK_TYPE_MAX_LENGTH, WEBSITE_FILE_LINK_TYPE_REGEX, WEBSITE_FILE_LINK_WEBSITE_LINK_TYPE, WEBSITE_LINK_ENCODED_DATA_MAX_LENGTH, WEBSITE_LINK_ISOLATE_BASE_URL_PROFILE_ID, WEBSITE_LINK_TYPE_MAX_LENGTH, WEBSITE_LINK_TYPE_REGEX, WEBSITE_URL_WEBSITE_LINK_TYPE, YOUTUBE_BASE_URL, YOUTUBE_WEBSITE_LINK_ISOLATE_PROFILE_ID, YOUTUBE_WEBSITE_LINK_TYPE, arktypeToJsonSchemaForExport, basicSyncEntityCommonTypeSynchronizerInstanceFactory, cashappProfileUrl, cashappProfileUrlToWebsiteLink, clearable, contextGrantedModelRoles, decodeWebsiteLinkEncodedDataToWebsiteFileLink, e164PhoneNumberType, e164PhoneNumberWithExtensionType, e164PhoneNumberWithOptionalExtensionType, emailAddressToWebsiteLink, emptyType, encodeWebsiteFileLinkToWebsiteLinkEncodedData, facebookProfileUrl, facebookProfileUrlToWebsiteLink, fullAccessGrantedModelRoles, fullAccessRoleMap, grantedRoleKeysMapFromArray, grantedRoleMapReader, instagramProfileUrl, instagramProfileUrlToWebsiteLink, isFullAccessRoleMap, isGrantedAdminLevelRole, isNoAccessRoleMap, isValidWebsiteLinkType, iso8601DayStringType, latLngPointType, latLngStringType, minuteOfDayType, modelIdType, modelKeyType, noAccessContextGrantedModelRoles, noAccessRoleMap, nonEmptyStringWithMaxLength, paypalProfileUrl, paypalProfileUrlToWebsiteLink, phoneNumberToWebsiteLink, pruneFalseUnionBranches, snapchatProfileUrl, snapchatProfileUrlToWebsiteLink, spotifyProfileUrl, spotifyProfileUrlToWebsiteLink, syncEntityCommonTypeIdPairFactory, syncEntityFactory, syncEntitySynchronizer, targetModelIdParamsType, targetModelParamsType, tiktokProfileUrl, tiktokProfileUrlToWebsiteLink, toTransformAndValidateFunctionResult, toTransformAndValidateFunctionResultFactory, transformAndValidateFunctionResultFactory, transformAndValidateObject, transformAndValidateObjectFactory, transformAndValidateObjectResult, transformAndValidateResultFactory, twitterProfileUrl, twitterProfileUrlToWebsiteLink, uniqueKeyedType, unitedStatesAddressWithStateCodeType, unitedStatesAddressWithStateStringType, usernameFromUsernameOrWebsiteWithBaseUrlUsername, usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername, usernameOrWebsiteUrlToWebsiteUrl, venmoProfileUrl, venmoProfileUrlToWebsiteLink, websiteFileLinkToWebsiteLink, websiteFileLinkType, websiteLinkToWebsiteLinkFile, websiteLinkType, websiteUrlToWebsiteLink, websiteUrlType, websiteUrlWithPrefixType, youtubeProfileUrl, youtubeProfileUrlToWebsiteLink };
|
package/package.json
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ArkType schema for a valid ISO 8601 day string (e.g., "2024-01-15").
|
|
3
|
+
*
|
|
4
|
+
* @dbxUtil
|
|
5
|
+
* @dbxUtilCategory validator
|
|
6
|
+
* @dbxUtilKind const
|
|
7
|
+
* @dbxUtilTags validator, arktype, date, iso8601, day, string
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* type({ startsOn: iso8601DayStringType });
|
|
12
|
+
* ```
|
|
3
13
|
*/
|
|
4
14
|
export declare const iso8601DayStringType: import("arktype/internal/variants/string.ts").StringType<string, {}>;
|
|
@@ -1,4 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A number greater than or equal to 0.
|
|
3
|
+
*
|
|
4
|
+
* @dbxUtil
|
|
5
|
+
* @dbxUtilCategory validator
|
|
6
|
+
* @dbxUtilKind const
|
|
7
|
+
* @dbxUtilTags validator, arktype, number, non-negative
|
|
8
|
+
* @dbxUtilRelated non-negative-integer
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* type({ price: NON_NEGATIVE_NUMBER });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare const NON_NEGATIVE_NUMBER: "number >= 0";
|
|
16
|
+
/**
|
|
17
|
+
* A non-negative integer.
|
|
18
|
+
*
|
|
19
|
+
* @dbxUtil
|
|
20
|
+
* @dbxUtilCategory validator
|
|
21
|
+
* @dbxUtilKind const
|
|
22
|
+
* @dbxUtilTags validator, arktype, number, non-negative, integer
|
|
23
|
+
* @dbxUtilRelated non-negative-number
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* type({ count: NON_NEGATIVE_INTEGER });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const NON_NEGATIVE_INTEGER: "number.integer >= 0";
|
|
1
31
|
/**
|
|
2
32
|
* ArkType schema for a valid minute of the day (0-1439).
|
|
33
|
+
*
|
|
34
|
+
* @dbxUtil
|
|
35
|
+
* @dbxUtilCategory validator
|
|
36
|
+
* @dbxUtilKind const
|
|
37
|
+
* @dbxUtilTags validator, arktype, number, minute-of-day, time
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* type({ startMinute: minuteOfDayType });
|
|
42
|
+
* ```
|
|
3
43
|
*/
|
|
4
44
|
export declare const minuteOfDayType: import("arktype/internal/variants/number.ts").NumberType<number, {}>;
|
|
@@ -1,12 +1,45 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ArkType schema for a valid E.164 phone number without an extension.
|
|
3
|
+
*
|
|
4
|
+
* @dbxUtil
|
|
5
|
+
* @dbxUtilCategory validator
|
|
6
|
+
* @dbxUtilKind const
|
|
7
|
+
* @dbxUtilTags validator, arktype, phone, e164, string
|
|
8
|
+
* @dbxUtilRelated e164-phone-number-with-optional-extension-type, e164-phone-number-with-extension-type
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* type({ phone: e164PhoneNumberType });
|
|
13
|
+
* ```
|
|
3
14
|
*/
|
|
4
15
|
export declare const e164PhoneNumberType: import("arktype/internal/variants/string.ts").StringType<string, {}>;
|
|
5
16
|
/**
|
|
6
17
|
* ArkType schema for a valid E.164 phone number, optionally with an extension.
|
|
18
|
+
*
|
|
19
|
+
* @dbxUtil
|
|
20
|
+
* @dbxUtilCategory validator
|
|
21
|
+
* @dbxUtilKind const
|
|
22
|
+
* @dbxUtilTags validator, arktype, phone, e164, extension, string
|
|
23
|
+
* @dbxUtilRelated e164-phone-number-type, e164-phone-number-with-extension-type
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* type({ phone: e164PhoneNumberWithOptionalExtensionType });
|
|
28
|
+
* ```
|
|
7
29
|
*/
|
|
8
30
|
export declare const e164PhoneNumberWithOptionalExtensionType: import("arktype/internal/variants/string.ts").StringType<string, {}>;
|
|
9
31
|
/**
|
|
10
32
|
* ArkType schema for a valid E.164 phone number that includes an extension.
|
|
33
|
+
*
|
|
34
|
+
* @dbxUtil
|
|
35
|
+
* @dbxUtilCategory validator
|
|
36
|
+
* @dbxUtilKind const
|
|
37
|
+
* @dbxUtilTags validator, arktype, phone, e164, extension, string
|
|
38
|
+
* @dbxUtilRelated e164-phone-number-type, e164-phone-number-with-optional-extension-type
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* type({ phone: e164PhoneNumberWithExtensionType });
|
|
43
|
+
* ```
|
|
11
44
|
*/
|
|
12
45
|
export declare const e164PhoneNumberWithExtensionType: import("arktype/internal/variants/string.ts").StringType<string, {}>;
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ArkType schema for a valid {@link LatLngPoint} with lat in [-90, 90] and lng in [-180, 180].
|
|
3
|
+
*
|
|
4
|
+
* @dbxUtil
|
|
5
|
+
* @dbxUtilCategory validator
|
|
6
|
+
* @dbxUtilKind const
|
|
7
|
+
* @dbxUtilTags validator, arktype, lat-lng, point, geo, coordinates
|
|
8
|
+
* @dbxUtilRelated lat-lng-string-type
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* type({ location: latLngPointType });
|
|
13
|
+
* ```
|
|
3
14
|
*/
|
|
4
15
|
export declare const latLngPointType: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
5
16
|
lat: number;
|
|
@@ -7,5 +18,16 @@ export declare const latLngPointType: import("arktype/internal/variants/object.t
|
|
|
7
18
|
}, {}>;
|
|
8
19
|
/**
|
|
9
20
|
* ArkType schema for a valid {@link LatLngString} (comma-separated lat/lng, e.g. "30.5,-96.3").
|
|
21
|
+
*
|
|
22
|
+
* @dbxUtil
|
|
23
|
+
* @dbxUtilCategory validator
|
|
24
|
+
* @dbxUtilKind const
|
|
25
|
+
* @dbxUtilTags validator, arktype, lat-lng, geo, coordinates, string
|
|
26
|
+
* @dbxUtilRelated lat-lng-point-type
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* type({ location: latLngStringType });
|
|
31
|
+
* ```
|
|
10
32
|
*/
|
|
11
33
|
export declare const latLngStringType: import("arktype/internal/variants/string.ts").StringType<string, {}>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A string with at least one character (non-empty).
|
|
3
|
+
*
|
|
4
|
+
* @dbxUtil
|
|
5
|
+
* @dbxUtilCategory validator
|
|
6
|
+
* @dbxUtilKind const
|
|
7
|
+
* @dbxUtilTags validator, arktype, string, non-empty, required
|
|
8
|
+
* @dbxUtilRelated email-string, non-empty-string-with-max-length
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* type({ name: NON_EMPTY_STRING });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare const NON_EMPTY_STRING: "string > 0";
|
|
16
|
+
/**
|
|
17
|
+
* A valid email address string.
|
|
18
|
+
*
|
|
19
|
+
* @dbxUtil
|
|
20
|
+
* @dbxUtilCategory validator
|
|
21
|
+
* @dbxUtilKind const
|
|
22
|
+
* @dbxUtilTags validator, arktype, string, email
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* type({ email: EMAIL_STRING });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare const EMAIL_STRING: "string.email";
|
|
30
|
+
/**
|
|
31
|
+
* Creates an ArkType string definition for a non-empty string with a maximum length.
|
|
32
|
+
*
|
|
33
|
+
* Composes {@link NON_EMPTY_STRING} with an upper-bound length constraint, producing a
|
|
34
|
+
* DSL fragment that can be interpolated directly into an ArkType `type({ ... })` schema.
|
|
35
|
+
*
|
|
36
|
+
* @param maxLength - The maximum number of characters allowed (inclusive).
|
|
37
|
+
* @returns The ArkType string definition.
|
|
38
|
+
*
|
|
39
|
+
* @dbxUtil
|
|
40
|
+
* @dbxUtilCategory validator
|
|
41
|
+
* @dbxUtilKind factory
|
|
42
|
+
* @dbxUtilTags validator, arktype, string, non-empty, max-length, bounded
|
|
43
|
+
* @dbxUtilRelated non-empty-string
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* const userType = type({
|
|
48
|
+
* displayName: nonEmptyStringWithMaxLength(64)
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @__NO_SIDE_EFFECTS__
|
|
53
|
+
*/
|
|
54
|
+
export declare function nonEmptyStringWithMaxLength<N extends number>(maxLength: N): `string > 0 & string <= ${N}`;
|
|
@@ -5,9 +5,16 @@ import { type ReadKeyFunction } from '@dereekb/util';
|
|
|
5
5
|
* @param readKey - Function that extracts the key from each array element.
|
|
6
6
|
* @returns An ArkType schema that narrows `T[]` to ensure uniqueness.
|
|
7
7
|
*
|
|
8
|
+
* @dbxUtil
|
|
9
|
+
* @dbxUtilCategory validator
|
|
10
|
+
* @dbxUtilKind factory
|
|
11
|
+
* @dbxUtilTags validator, arktype, array, unique, uniqueness, keyed
|
|
12
|
+
*
|
|
8
13
|
* @example
|
|
9
14
|
* ```typescript
|
|
10
15
|
* const uniqueItemsType = uniqueKeyedType((item: Item) => item.id);
|
|
11
16
|
* ```
|
|
17
|
+
*
|
|
18
|
+
* @__NO_SIDE_EFFECTS__
|
|
12
19
|
*/
|
|
13
20
|
export declare function uniqueKeyedType<T>(readKey: ReadKeyFunction<T>): import("arktype/internal/variants/array.ts").ArrayType<unknown[], {}>;
|
|
@@ -1,8 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ArkType schema for a valid website URL (with or without protocol prefix).
|
|
3
|
+
*
|
|
4
|
+
* @dbxUtil
|
|
5
|
+
* @dbxUtilCategory validator
|
|
6
|
+
* @dbxUtilKind const
|
|
7
|
+
* @dbxUtilTags validator, arktype, url, website, string
|
|
8
|
+
* @dbxUtilRelated website-url-with-prefix-type
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* type({ website: websiteUrlType });
|
|
13
|
+
* ```
|
|
3
14
|
*/
|
|
4
15
|
export declare const websiteUrlType: import("arktype/internal/variants/string.ts").StringType<string, {}>;
|
|
5
16
|
/**
|
|
6
17
|
* ArkType schema for a valid website URL that starts with `http://` or `https://`.
|
|
18
|
+
*
|
|
19
|
+
* @dbxUtil
|
|
20
|
+
* @dbxUtilCategory validator
|
|
21
|
+
* @dbxUtilKind const
|
|
22
|
+
* @dbxUtilTags validator, arktype, url, website, prefix, https, string
|
|
23
|
+
* @dbxUtilRelated website-url-type
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* type({ website: websiteUrlWithPrefixType });
|
|
28
|
+
* ```
|
|
7
29
|
*/
|
|
8
30
|
export declare const websiteUrlWithPrefixType: import("arktype/internal/variants/string.ts").StringType<string, {}>;
|