@fedify/cfworkers 2.1.4 → 2.1.5
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/dist/mod.d.ts +43 -4
- package/package.json +4 -3
package/dist/mod.d.ts
CHANGED
|
@@ -1,7 +1,46 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Queue } from "@cloudflare/workers-types";
|
|
2
2
|
import { KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions } from "@fedify/fedify/federation";
|
|
3
3
|
|
|
4
4
|
//#region src/mod.d.ts
|
|
5
|
+
interface WorkersKvNamespaceGetWithMetadataResult<Value, Metadata> {
|
|
6
|
+
readonly value: Value | null;
|
|
7
|
+
readonly metadata: Metadata | null;
|
|
8
|
+
}
|
|
9
|
+
interface WorkersKvNamespaceListKey<Metadata, Key extends string = string> {
|
|
10
|
+
readonly name: Key;
|
|
11
|
+
readonly expiration?: number;
|
|
12
|
+
readonly metadata?: Metadata;
|
|
13
|
+
}
|
|
14
|
+
interface WorkersKvNamespaceListResult<Metadata, Key extends string = string> {
|
|
15
|
+
readonly list_complete: boolean;
|
|
16
|
+
readonly keys: readonly WorkersKvNamespaceListKey<Metadata, Key>[];
|
|
17
|
+
readonly cursor?: string;
|
|
18
|
+
}
|
|
19
|
+
interface WorkersKvNamespaceListOptions {
|
|
20
|
+
readonly limit?: number;
|
|
21
|
+
readonly prefix?: string | null;
|
|
22
|
+
readonly cursor?: string | null;
|
|
23
|
+
}
|
|
24
|
+
interface WorkersKvNamespacePutOptions {
|
|
25
|
+
readonly expiration?: number;
|
|
26
|
+
readonly expirationTtl?: number;
|
|
27
|
+
readonly metadata?: unknown;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Minimal Cloudflare Workers KV binding shape used by this package.
|
|
31
|
+
* Compatible with both `@cloudflare/workers-types` and `wrangler types`
|
|
32
|
+
* generated declarations.
|
|
33
|
+
* @since 2.0.12
|
|
34
|
+
*/
|
|
35
|
+
interface WorkersKvNamespaceLike<Key extends string = string> {
|
|
36
|
+
get(key: Key): Promise<string | null>;
|
|
37
|
+
get<ExpectedValue = unknown>(key: Key, type: "json"): Promise<ExpectedValue | null>;
|
|
38
|
+
getWithMetadata<Metadata = unknown>(key: Key): Promise<WorkersKvNamespaceGetWithMetadataResult<string, Metadata>>;
|
|
39
|
+
getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, type: "json"): Promise<WorkersKvNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;
|
|
40
|
+
put(key: Key, value: string, options?: WorkersKvNamespacePutOptions): Promise<void>;
|
|
41
|
+
delete(key: Key): Promise<void>;
|
|
42
|
+
list<Metadata = unknown>(options?: WorkersKvNamespaceListOptions): Promise<WorkersKvNamespaceListResult<Metadata, Key>>;
|
|
43
|
+
}
|
|
5
44
|
/**
|
|
6
45
|
* Result from {@link WorkersMessageQueue.processMessage}.
|
|
7
46
|
* @since 2.0.0
|
|
@@ -39,7 +78,7 @@ interface ProcessMessageResult {
|
|
|
39
78
|
*/
|
|
40
79
|
declare class WorkersKvStore implements KvStore {
|
|
41
80
|
#private;
|
|
42
|
-
constructor(namespace:
|
|
81
|
+
constructor(namespace: WorkersKvNamespaceLike<string>);
|
|
43
82
|
get<T = unknown>(key: KvKey): Promise<T | undefined>;
|
|
44
83
|
set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
|
|
45
84
|
delete(key: KvKey): Promise<void>;
|
|
@@ -62,7 +101,7 @@ interface WorkersMessageQueueOptions {
|
|
|
62
101
|
* guarantees are best-effort. For strict ordering requirements, consider
|
|
63
102
|
* using Durable Objects.
|
|
64
103
|
*/
|
|
65
|
-
readonly orderingKv?:
|
|
104
|
+
readonly orderingKv?: WorkersKvNamespaceLike<string>;
|
|
66
105
|
/**
|
|
67
106
|
* The prefix for ordering key lock keys. Defaults to `"__fedify_ordering_"`.
|
|
68
107
|
* @default `"__fedify_ordering_"`
|
|
@@ -145,4 +184,4 @@ declare class WorkersMessageQueue implements MessageQueue {
|
|
|
145
184
|
listen(_handler: (message: any) => Promise<void> | void, _options?: MessageQueueListenOptions): Promise<void>;
|
|
146
185
|
}
|
|
147
186
|
//#endregion
|
|
148
|
-
export { ProcessMessageResult, WorkersKvStore, WorkersMessageQueue, WorkersMessageQueueOptions };
|
|
187
|
+
export { ProcessMessageResult, WorkersKvNamespaceLike, WorkersKvStore, WorkersMessageQueue, WorkersMessageQueueOptions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/cfworkers",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"description": "Adapt Fedify with Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Fedify",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
],
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@cloudflare/workers-types": "^4.20250906.0",
|
|
55
|
-
"@fedify/fedify": "^2.1.
|
|
55
|
+
"@fedify/fedify": "^2.1.5"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@cloudflare/vitest-pool-workers": "^0.8.31",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"build:self": "tsdown",
|
|
66
66
|
"build": "pnpm --filter @fedify/cfworkers... run build:self",
|
|
67
67
|
"prepublish": "pnpm build",
|
|
68
|
-
"
|
|
68
|
+
"pretest": "pnpm build",
|
|
69
|
+
"test": "tsc -p test/typecheck/tsconfig.json --noEmit && vitest run"
|
|
69
70
|
}
|
|
70
71
|
}
|