@@ -30,10 +30,10 @@ export function validateKey(key: string): void {
3030
3131export function validateKeyLength ( key : string ) : void {
3232 const keyLength = Buffer . byteLength ( key ) ;
33- if ( keyLength > KVLimits . MAX_KEY_SIZE ) {
33+ if ( keyLength > KVLimits . MAX_KEY_SIZE_BYTES ) {
3434 throw new HttpError (
3535 414 ,
36- `UTF-8 encoded length of ${ keyLength } exceeds key length limit of ${ KVLimits . MAX_KEY_SIZE } .`
36+ `UTF-8 encoded length of ${ keyLength } exceeds key length limit of ${ KVLimits . MAX_KEY_SIZE_BYTES } .`
3737 ) ;
3838 }
3939}
@@ -48,11 +48,11 @@ export function validateGetOptions(
4848 const cacheTtl = options ?. cacheTtl ;
4949 if (
5050 cacheTtl !== undefined &&
51- ( isNaN ( cacheTtl ) || cacheTtl < KVLimits . MIN_CACHE_TTL )
51+ ( isNaN ( cacheTtl ) || cacheTtl < KVLimits . MIN_CACHE_TTL_SECONDS )
5252 ) {
5353 throw new HttpError (
5454 400 ,
55- `Invalid ${ KVParams . CACHE_TTL } of ${ cacheTtl } . Cache TTL must be at least ${ KVLimits . MIN_CACHE_TTL } .`
55+ `Invalid ${ KVParams . CACHE_TTL } of ${ cacheTtl } . Cache TTL must be at least ${ KVLimits . MIN_CACHE_TTL_SECONDS } .`
5656 ) ;
5757 }
5858}
@@ -80,10 +80,10 @@ export function validatePutOptions(
8080 `Invalid ${ KVParams . EXPIRATION_TTL } of ${ rawExpirationTtl } . Please specify integer greater than 0.`
8181 ) ;
8282 }
83- if ( expirationTtl < KVLimits . MIN_CACHE_TTL ) {
83+ if ( expirationTtl < KVLimits . MIN_EXPIRATION_TTL_SECONDS ) {
8484 throw new HttpError (
8585 400 ,
86- `Invalid ${ KVParams . EXPIRATION_TTL } of ${ rawExpirationTtl } . Expiration TTL must be at least ${ KVLimits . MIN_CACHE_TTL } .`
86+ `Invalid ${ KVParams . EXPIRATION_TTL } of ${ rawExpirationTtl } . Expiration TTL must be at least ${ KVLimits . MIN_EXPIRATION_TTL_SECONDS } .`
8787 ) ;
8888 }
8989 expiration = now + expirationTtl ;
@@ -95,10 +95,10 @@ export function validatePutOptions(
9595 `Invalid ${ KVParams . EXPIRATION } of ${ rawExpiration } . Please specify integer greater than the current number of seconds since the UNIX epoch.`
9696 ) ;
9797 }
98- if ( expiration < now + KVLimits . MIN_CACHE_TTL ) {
98+ if ( expiration < now + KVLimits . MIN_EXPIRATION_TTL_SECONDS ) {
9999 throw new HttpError (
100100 400 ,
101- `Invalid ${ KVParams . EXPIRATION } of ${ rawExpiration } . Expiration times must be at least ${ KVLimits . MIN_CACHE_TTL } seconds in the future.`
101+ `Invalid ${ KVParams . EXPIRATION } of ${ rawExpiration } . Expiration times must be at least ${ KVLimits . MIN_EXPIRATION_TTL_SECONDS } seconds in the future.`
102102 ) ;
103103 }
104104 }
@@ -107,10 +107,10 @@ export function validatePutOptions(
107107 let metadata : unknown | undefined ;
108108 if ( rawMetadata !== null ) {
109109 const metadataLength = Buffer . byteLength ( rawMetadata ) ;
110- if ( metadataLength > KVLimits . MAX_METADATA_SIZE ) {
110+ if ( metadataLength > KVLimits . MAX_METADATA_SIZE_BYTES ) {
111111 throw new HttpError (
112112 413 ,
113- `Metadata length of ${ metadataLength } exceeds limit of ${ KVLimits . MAX_METADATA_SIZE } .`
113+ `Metadata length of ${ metadataLength } exceeds limit of ${ KVLimits . MAX_METADATA_SIZE_BYTES } .`
114114 ) ;
115115 }
116116 metadata = JSON . parse ( rawMetadata ) ;
0 commit comments