File tree Expand file tree Collapse file tree
packages/console/resource Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,14 @@ export const waitUntil = async (promise: Promise<any>) => {
66 await promise
77}
88
9+ type KvBulkGetResult = {
10+ values ?: Record < string , string >
11+ }
12+
13+ type KvListResult = {
14+ result : KVNamespaceListResult < unknown , string > [ "keys" ]
15+ }
16+
917export const Resource = new Proxy (
1018 { } ,
1119 {
@@ -34,7 +42,9 @@ export const Resource = new Proxy(
3442 keys : Array . isArray ( k ) ? k : [ k ] ,
3543 account_id : accountId ,
3644 } )
37- . then ( ( result ) => ( isMulti ? new Map ( Object . entries ( result ?. values ?? { } ) ) : result ?. values ?. [ k ] ) )
45+ . then ( ( result : KvBulkGetResult ) =>
46+ isMulti ? new Map ( Object . entries ( result . values ?? { } ) ) : result . values ?. [ k ] ,
47+ )
3848 } ,
3949 put : ( k : string , v : string , opts ?: KVNamespacePutOptions ) =>
4050 client . kv . namespaces . values . update ( namespaceId , k , {
@@ -54,7 +64,7 @@ export const Resource = new Proxy(
5464 account_id : accountId ,
5565 prefix : opts ?. prefix ?? undefined ,
5666 } )
57- . then ( ( result ) => {
67+ . then ( ( result : KvListResult ) => {
5868 return {
5969 keys : result . result ,
6070 list_complete : true ,
You can’t perform that action at this time.
0 commit comments