@fedify/fedify 1.6.1-pr.239.854 → 1.6.1-pr.242.857
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/codegen/schema.js +2 -1
- package/dist/deno.js +7 -2
- package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/_common/dirname.js +1 -1
- package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/_common/normalize.js +1 -1
- package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/posix/dirname.js +1 -1
- package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/posix/normalize.js +1 -1
- package/dist/vocab/vocab.js +176 -176
- package/dist/vocab/vocab.test.js +2 -2
- package/dist/x/cfworkers.d.ts +28 -0
- package/dist/x/cfworkers.js +35 -0
- package/package.json +6 -1
package/dist/vocab/vocab.test.js
CHANGED
@@ -634,7 +634,7 @@ const sampleValues = {
|
|
634
634
|
"fedify:proofPurpose": "assertionMethod",
|
635
635
|
"fedify:units": "m"
|
636
636
|
};
|
637
|
-
const types = await loadSchemaFiles(import.meta.dirname);
|
637
|
+
const types = navigator?.userAgent === "Cloudflare-Workers" ? {} : await loadSchemaFiles(import.meta.dirname);
|
638
638
|
for (const typeUri in types) {
|
639
639
|
const type = types[typeUri];
|
640
640
|
const cls = vocab_exports[type.name];
|
@@ -823,7 +823,7 @@ for (const typeUri in types) {
|
|
823
823
|
}), TypeError);
|
824
824
|
});
|
825
825
|
if ("Deno" in globalThis) {
|
826
|
-
const { assertSnapshot } = await import("@std/testing/snapshot");
|
826
|
+
const { assertSnapshot } = await import("@std/testing/snapshot").catch(() => ({ assertSnapshot: () => Promise.resolve() }));
|
827
827
|
test(`Deno.inspect(${type.name}) [auto]`, async (t) => {
|
828
828
|
const empty = new cls({});
|
829
829
|
assertEquals(Deno.inspect(empty), `${type.name} {}`);
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
2
|
+
import { URLPattern } from "urlpattern-polyfill";
|
3
|
+
import { KvKey, KvStore, KvStoreSetOptions } from "../federation/kv.js";
|
4
|
+
import { KVNamespace } from "@cloudflare/workers-types/experimental";
|
5
|
+
|
6
|
+
//#region x/cfworkers.d.ts
|
7
|
+
/**
|
8
|
+
* Implementation of the KvStore interface for Cloudflare Workers KV binding.
|
9
|
+
* This class provides a wrapper around Cloudflare's KV namespace to store and
|
10
|
+
* retrieve JSON-serializable values using structured keys.
|
11
|
+
* @since 1.6.0
|
12
|
+
*/
|
13
|
+
/**
|
14
|
+
* Implementation of the KvStore interface for Cloudflare Workers KV binding.
|
15
|
+
* This class provides a wrapper around Cloudflare's KV namespace to store and
|
16
|
+
* retrieve JSON-serializable values using structured keys.
|
17
|
+
* @since 1.6.0
|
18
|
+
*/
|
19
|
+
declare class WorkersKvStore implements KvStore {
|
20
|
+
#private;
|
21
|
+
constructor(namespace: KVNamespace<string>);
|
22
|
+
get<T = unknown>(key: KvKey): Promise<T | undefined>;
|
23
|
+
set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
|
24
|
+
delete(key: KvKey): Promise<void>;
|
25
|
+
}
|
26
|
+
|
27
|
+
//#endregion
|
28
|
+
export { WorkersKvStore };
|
@@ -0,0 +1,35 @@
|
|
1
|
+
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
|
5
|
+
//#region x/cfworkers.ts
|
6
|
+
/**
|
7
|
+
* Implementation of the KvStore interface for Cloudflare Workers KV binding.
|
8
|
+
* This class provides a wrapper around Cloudflare's KV namespace to store and
|
9
|
+
* retrieve JSON-serializable values using structured keys.
|
10
|
+
* @since 1.6.0
|
11
|
+
*/
|
12
|
+
var WorkersKvStore = class {
|
13
|
+
#namespace;
|
14
|
+
constructor(namespace) {
|
15
|
+
this.#namespace = namespace;
|
16
|
+
}
|
17
|
+
#encodeKey(key) {
|
18
|
+
return JSON.stringify(key);
|
19
|
+
}
|
20
|
+
async get(key) {
|
21
|
+
const encodedKey = this.#encodeKey(key);
|
22
|
+
const value = await this.#namespace.get(encodedKey);
|
23
|
+
return value == null ? void 0 : JSON.parse(value);
|
24
|
+
}
|
25
|
+
async set(key, value, options) {
|
26
|
+
const encodedKey = this.#encodeKey(key);
|
27
|
+
await this.#namespace.put(encodedKey, JSON.stringify(value), options?.ttl == null ? {} : { expirationTtl: Math.max(options.ttl.total("seconds"), 60) });
|
28
|
+
}
|
29
|
+
delete(key) {
|
30
|
+
return this.#namespace.delete(this.#encodeKey(key));
|
31
|
+
}
|
32
|
+
};
|
33
|
+
|
34
|
+
//#endregion
|
35
|
+
export { WorkersKvStore };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fedify/fedify",
|
3
|
-
"version": "1.6.1-pr.
|
3
|
+
"version": "1.6.1-pr.242.857+3b03b99a",
|
4
4
|
"description": "An ActivityPub server framework",
|
5
5
|
"keywords": [
|
6
6
|
"ActivityPub",
|
@@ -68,6 +68,10 @@
|
|
68
68
|
"types": "./dist/webfinger/mod.d.ts",
|
69
69
|
"import": "./dist/webfinger/mod.js"
|
70
70
|
},
|
71
|
+
"./x/cfworkers": {
|
72
|
+
"types": "./dist/x/cfworkers.d.ts",
|
73
|
+
"import": "./dist/x/cfworkers.js"
|
74
|
+
},
|
71
75
|
"./x/hono": {
|
72
76
|
"types": "./dist/x/hono.d.ts",
|
73
77
|
"import": "./dist/x/hono.js"
|
@@ -99,6 +103,7 @@
|
|
99
103
|
"urlpattern-polyfill": "^10.1.0"
|
100
104
|
},
|
101
105
|
"devDependencies": {
|
106
|
+
"@cloudflare/workers-types": "^4.20250529.0",
|
102
107
|
"@hongminhee/deno-mock-fetch": "npm:@jsr/hongminhee__deno-mock-fetch@^0.3.2",
|
103
108
|
"@std/assert": "npm:@jsr/std__assert@^0.226.0",
|
104
109
|
"@std/path": "npm:@jsr/std__path@^1.0.9",
|