@fedify/testing 2.4.0-dev.2030 → 2.4.0-dev.2047
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.cjs +9 -1
- package/dist/mod.js +9 -1
- package/package.json +4 -4
package/dist/mod.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
let _fedify_fedify_sig = require("@fedify/fedify/sig");
|
|
4
4
|
let _fedify_vocab = require("@fedify/vocab");
|
|
5
|
+
let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
|
|
5
6
|
let _fedify_fedify_federation = require("@fedify/fedify/federation");
|
|
6
7
|
let es_toolkit = require("es-toolkit");
|
|
7
8
|
let node_assert_strict = require("node:assert/strict");
|
|
@@ -38,7 +39,7 @@ const noopMeterProvider$1 = { getMeter: () => ({
|
|
|
38
39
|
removeBatchObservableCallback: () => void 0
|
|
39
40
|
}) };
|
|
40
41
|
function createContext(values) {
|
|
41
|
-
const { federation, url = new URL("http://example.com/"), canonicalOrigin, data, documentLoader, contextLoader, meterProvider, tracerProvider, clone, getNodeInfoUri, getActorUri, getObjectUri, getCollectionUri, getOutboxUri, getMediaUploaderUri, getInboxUri, getFollowingUri, getFollowersUri, getLikedUri, getFeaturedUri, getFeaturedTagsUri, parseUri, getActorKeyPairs, getDocumentLoader, lookupObject, traverseCollection, lookupNodeInfo, lookupWebFinger, sendActivity, routeActivity, enqueueTask, enqueueTaskMany } = values;
|
|
42
|
+
const { federation, url = new URL("http://example.com/"), canonicalOrigin, data, documentLoader, contextLoader, meterProvider, tracerProvider, clone, getNodeInfoUri, getActorUri, getObjectUri, getPortableObjectUri, getCollectionUri, getOutboxUri, getMediaUploaderUri, getInboxUri, getFollowingUri, getFollowersUri, getLikedUri, getFeaturedUri, getFeaturedTagsUri, parseUri, getActorKeyPairs, getDocumentLoader, lookupObject, traverseCollection, lookupNodeInfo, lookupWebFinger, sendActivity, routeActivity, enqueueTask, enqueueTaskMany } = values;
|
|
42
43
|
function throwRouterError() {
|
|
43
44
|
throw new _fedify_fedify_federation.RouterError("Not implemented");
|
|
44
45
|
}
|
|
@@ -60,6 +61,7 @@ function createContext(values) {
|
|
|
60
61
|
getNodeInfoUri: getNodeInfoUri ?? throwRouterError,
|
|
61
62
|
getActorUri: getActorUri ?? throwRouterError,
|
|
62
63
|
getObjectUri: getObjectUri ?? throwRouterError,
|
|
64
|
+
getPortableObjectUri: getPortableObjectUri ?? throwRouterError,
|
|
63
65
|
getCollectionUri: getCollectionUri ?? throwRouterError,
|
|
64
66
|
getOutboxUri: getOutboxUri ?? throwRouterError,
|
|
65
67
|
getMediaUploaderUri: getMediaUploaderUri ?? throwRouterError,
|
|
@@ -124,6 +126,7 @@ function createRequestContext(args) {
|
|
|
124
126
|
})),
|
|
125
127
|
request: args.request ?? new Request(args.url),
|
|
126
128
|
url: args.url,
|
|
129
|
+
portableRequest: args.portableRequest,
|
|
127
130
|
getActor: args.getActor ?? (() => Promise.resolve(null)),
|
|
128
131
|
getObject: args.getObject ?? (() => Promise.resolve(null)),
|
|
129
132
|
getSignedKey: args.getSignedKey ?? (() => Promise.resolve(null)),
|
|
@@ -826,6 +829,11 @@ var MockContext = class MockContext {
|
|
|
826
829
|
const path = globalThis.Object.entries(values).map(([key, value]) => `${key}/${value}`).join("/");
|
|
827
830
|
return new URL(`/objects/${cls.name.toLowerCase()}/${path}`, this.origin);
|
|
828
831
|
}
|
|
832
|
+
getPortableObjectUri(cls, values, authority) {
|
|
833
|
+
if (!/^did:[a-z0-9]+:[^/?#]+$/i.test(authority)) throw new TypeError("The authority of a portable ID must be a DID without a path, query, or fragment.");
|
|
834
|
+
const { pathname } = this.getObjectUri(cls, values);
|
|
835
|
+
return (0, _fedify_vocab_runtime.parseIri)(`ap+ef61://${authority}${pathname}`);
|
|
836
|
+
}
|
|
829
837
|
getOutboxUri(identifier) {
|
|
830
838
|
if (this.federation instanceof MockFederation && this.federation.outboxPath) {
|
|
831
839
|
const path = expandUriTemplate(this.federation.outboxPath, { identifier });
|
package/dist/mod.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { hasProofLike, hasSignatureLike } from "@fedify/fedify/sig";
|
|
3
3
|
import { Activity, CryptographicKey, Multikey, lookupObject, traverseCollection } from "@fedify/vocab";
|
|
4
|
+
import { parseIri } from "@fedify/vocab-runtime";
|
|
4
5
|
import { RouterError } from "@fedify/fedify/federation";
|
|
5
6
|
import { delay } from "es-toolkit";
|
|
6
7
|
import { deepStrictEqual, ok, strictEqual } from "node:assert/strict";
|
|
@@ -37,7 +38,7 @@ const noopMeterProvider$1 = { getMeter: () => ({
|
|
|
37
38
|
removeBatchObservableCallback: () => void 0
|
|
38
39
|
}) };
|
|
39
40
|
function createContext(values) {
|
|
40
|
-
const { federation, url = new URL("http://example.com/"), canonicalOrigin, data, documentLoader, contextLoader, meterProvider, tracerProvider, clone, getNodeInfoUri, getActorUri, getObjectUri, getCollectionUri, getOutboxUri, getMediaUploaderUri, getInboxUri, getFollowingUri, getFollowersUri, getLikedUri, getFeaturedUri, getFeaturedTagsUri, parseUri, getActorKeyPairs, getDocumentLoader, lookupObject: lookupObject$1, traverseCollection: traverseCollection$1, lookupNodeInfo, lookupWebFinger, sendActivity, routeActivity, enqueueTask, enqueueTaskMany } = values;
|
|
41
|
+
const { federation, url = new URL("http://example.com/"), canonicalOrigin, data, documentLoader, contextLoader, meterProvider, tracerProvider, clone, getNodeInfoUri, getActorUri, getObjectUri, getPortableObjectUri, getCollectionUri, getOutboxUri, getMediaUploaderUri, getInboxUri, getFollowingUri, getFollowersUri, getLikedUri, getFeaturedUri, getFeaturedTagsUri, parseUri, getActorKeyPairs, getDocumentLoader, lookupObject: lookupObject$1, traverseCollection: traverseCollection$1, lookupNodeInfo, lookupWebFinger, sendActivity, routeActivity, enqueueTask, enqueueTaskMany } = values;
|
|
41
42
|
function throwRouterError() {
|
|
42
43
|
throw new RouterError("Not implemented");
|
|
43
44
|
}
|
|
@@ -59,6 +60,7 @@ function createContext(values) {
|
|
|
59
60
|
getNodeInfoUri: getNodeInfoUri ?? throwRouterError,
|
|
60
61
|
getActorUri: getActorUri ?? throwRouterError,
|
|
61
62
|
getObjectUri: getObjectUri ?? throwRouterError,
|
|
63
|
+
getPortableObjectUri: getPortableObjectUri ?? throwRouterError,
|
|
62
64
|
getCollectionUri: getCollectionUri ?? throwRouterError,
|
|
63
65
|
getOutboxUri: getOutboxUri ?? throwRouterError,
|
|
64
66
|
getMediaUploaderUri: getMediaUploaderUri ?? throwRouterError,
|
|
@@ -123,6 +125,7 @@ function createRequestContext(args) {
|
|
|
123
125
|
})),
|
|
124
126
|
request: args.request ?? new Request(args.url),
|
|
125
127
|
url: args.url,
|
|
128
|
+
portableRequest: args.portableRequest,
|
|
126
129
|
getActor: args.getActor ?? (() => Promise.resolve(null)),
|
|
127
130
|
getObject: args.getObject ?? (() => Promise.resolve(null)),
|
|
128
131
|
getSignedKey: args.getSignedKey ?? (() => Promise.resolve(null)),
|
|
@@ -825,6 +828,11 @@ var MockContext = class MockContext {
|
|
|
825
828
|
const path = globalThis.Object.entries(values).map(([key, value]) => `${key}/${value}`).join("/");
|
|
826
829
|
return new URL(`/objects/${cls.name.toLowerCase()}/${path}`, this.origin);
|
|
827
830
|
}
|
|
831
|
+
getPortableObjectUri(cls, values, authority) {
|
|
832
|
+
if (!/^did:[a-z0-9]+:[^/?#]+$/i.test(authority)) throw new TypeError("The authority of a portable ID must be a DID without a path, query, or fragment.");
|
|
833
|
+
const { pathname } = this.getObjectUri(cls, values);
|
|
834
|
+
return parseIri(`ap+ef61://${authority}${pathname}`);
|
|
835
|
+
}
|
|
828
836
|
getOutboxUri(identifier) {
|
|
829
837
|
if (this.federation instanceof MockFederation && this.federation.outboxPath) {
|
|
830
838
|
const path = expandUriTemplate(this.federation.outboxPath, { identifier });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/testing",
|
|
3
|
-
"version": "2.4.0-dev.
|
|
3
|
+
"version": "2.4.0-dev.2047+140b94db",
|
|
4
4
|
"description": "Testing utilities for Fedify applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fedify",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"package.json"
|
|
48
48
|
],
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@fedify/fedify": "^2.4.0-dev.
|
|
50
|
+
"@fedify/fedify": "^2.4.0-dev.2047+140b94db"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"es-toolkit": "1.46.1",
|
|
54
54
|
"temporal-polyfill": "^1.0.1",
|
|
55
|
-
"@fedify/vocab": "2.4.0-dev.
|
|
56
|
-
"@fedify/vocab-runtime": "^2.4.0-dev.
|
|
55
|
+
"@fedify/vocab": "2.4.0-dev.2047+140b94db",
|
|
56
|
+
"@fedify/vocab-runtime": "^2.4.0-dev.2047+140b94db"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@standard-schema/spec": "^1.1.0",
|