@thewhateverapp/platform 0.7.23 → 0.7.24
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.
|
@@ -11,7 +11,7 @@ export declare class CloudflareKV implements KVProvider {
|
|
|
11
11
|
private kv;
|
|
12
12
|
constructor(kv: KVNamespace);
|
|
13
13
|
get<T = string>(key: string, type?: KVValueType): Promise<T | null>;
|
|
14
|
-
|
|
14
|
+
put(key: string, value: KVValue, options?: KVSetOptions): Promise<void>;
|
|
15
15
|
delete(key: string): Promise<void>;
|
|
16
16
|
deleteMany(keys: string[]): Promise<void>;
|
|
17
17
|
has(key: string): Promise<boolean>;
|
|
@@ -25,7 +25,7 @@ export class CloudflareKV {
|
|
|
25
25
|
return (await this.kv.get(key, 'text'));
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
async
|
|
28
|
+
async put(key, value, options) {
|
|
29
29
|
const kvOptions = {};
|
|
30
30
|
if (options?.ttl) {
|
|
31
31
|
kvOptions.expirationTtl = options.ttl;
|
|
@@ -101,7 +101,7 @@ export class CloudflareKV {
|
|
|
101
101
|
const current = await this.get(key, 'text');
|
|
102
102
|
const currentValue = current ? parseInt(current, 10) : 0;
|
|
103
103
|
const newValue = currentValue + amount;
|
|
104
|
-
await this.
|
|
104
|
+
await this.put(key, String(newValue));
|
|
105
105
|
return newValue;
|
|
106
106
|
}
|
|
107
107
|
/**
|
package/dist/kv/types.d.ts
CHANGED
|
@@ -15,12 +15,12 @@ export interface KVProvider {
|
|
|
15
15
|
*/
|
|
16
16
|
get<T = string>(key: string, type?: KVValueType): Promise<T | null>;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @param key - The key to
|
|
18
|
+
* Store a value by key (matches Cloudflare's native KV API)
|
|
19
|
+
* @param key - The key to store
|
|
20
20
|
* @param value - The value to store
|
|
21
21
|
* @param options - Optional storage options (TTL, metadata)
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
put(key: string, value: KVValue, options?: KVSetOptions): Promise<void>;
|
|
24
24
|
/**
|
|
25
25
|
* Delete a value by key
|
|
26
26
|
* @param key - The key to delete
|