@fedify/testing 2.4.0-dev.1583 → 2.4.0-dev.1618
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 +3582 -2
- package/dist/mod.js +23 -2
- package/package.json +4 -4
package/dist/mod.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Temporal } from "
|
|
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
4
|
import { RouterError } from "@fedify/fedify/federation";
|
|
@@ -37,7 +37,7 @@ const noopMeterProvider$1 = { getMeter: () => ({
|
|
|
37
37
|
removeBatchObservableCallback: () => void 0
|
|
38
38
|
}) };
|
|
39
39
|
function createContext(values) {
|
|
40
|
-
const { federation, url = new URL("http://example.com/"), canonicalOrigin, data, documentLoader, contextLoader, meterProvider, tracerProvider, clone, getNodeInfoUri, getActorUri, getObjectUri, getCollectionUri, getOutboxUri, getInboxUri, getFollowingUri, getFollowersUri, getLikedUri, getFeaturedUri, getFeaturedTagsUri, parseUri, getActorKeyPairs, getDocumentLoader, lookupObject: lookupObject$1, traverseCollection: traverseCollection$1, lookupNodeInfo, lookupWebFinger, sendActivity, routeActivity, enqueueTask, enqueueTaskMany } = 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
41
|
function throwRouterError() {
|
|
42
42
|
throw new RouterError("Not implemented");
|
|
43
43
|
}
|
|
@@ -61,6 +61,7 @@ function createContext(values) {
|
|
|
61
61
|
getObjectUri: getObjectUri ?? throwRouterError,
|
|
62
62
|
getCollectionUri: getCollectionUri ?? throwRouterError,
|
|
63
63
|
getOutboxUri: getOutboxUri ?? throwRouterError,
|
|
64
|
+
getMediaUploaderUri: getMediaUploaderUri ?? throwRouterError,
|
|
64
65
|
getInboxUri: getInboxUri ?? throwRouterError,
|
|
65
66
|
getFollowingUri: getFollowingUri ?? throwRouterError,
|
|
66
67
|
getFollowersUri: getFollowersUri ?? throwRouterError,
|
|
@@ -282,6 +283,7 @@ var MockFederation = class {
|
|
|
282
283
|
actorPath;
|
|
283
284
|
inboxPath;
|
|
284
285
|
outboxPath;
|
|
286
|
+
mediaUploaderPath;
|
|
285
287
|
followingPath;
|
|
286
288
|
followersPath;
|
|
287
289
|
likedPath;
|
|
@@ -297,6 +299,8 @@ var MockFederation = class {
|
|
|
297
299
|
outboxAuthorizePredicate;
|
|
298
300
|
outboxDispatcherAuthorizePredicate;
|
|
299
301
|
outboxListenerErrorHandler;
|
|
302
|
+
mediaUploaderCallback;
|
|
303
|
+
mediaUploaderAuthorizePredicate;
|
|
300
304
|
followingDispatcher;
|
|
301
305
|
followersDispatcher;
|
|
302
306
|
likedDispatcher;
|
|
@@ -469,6 +473,16 @@ var MockFederation = class {
|
|
|
469
473
|
}
|
|
470
474
|
};
|
|
471
475
|
}
|
|
476
|
+
setMediaUploader(path, callback) {
|
|
477
|
+
if (this.mediaUploaderCallback != null) throw new TypeError("Media uploader already set.");
|
|
478
|
+
this.mediaUploaderPath = path;
|
|
479
|
+
this.mediaUploaderCallback = callback;
|
|
480
|
+
const self = this;
|
|
481
|
+
return { authorize(predicate) {
|
|
482
|
+
self.mediaUploaderAuthorizePredicate = predicate;
|
|
483
|
+
return this;
|
|
484
|
+
} };
|
|
485
|
+
}
|
|
472
486
|
setOutboxPermanentFailureHandler(_handler) {}
|
|
473
487
|
async startQueue(contextData, options) {
|
|
474
488
|
this.contextData = contextData;
|
|
@@ -818,6 +832,13 @@ var MockContext = class MockContext {
|
|
|
818
832
|
}
|
|
819
833
|
return new URL(`/users/${identifier}/outbox`, this.origin);
|
|
820
834
|
}
|
|
835
|
+
getMediaUploaderUri(identifier) {
|
|
836
|
+
if (this.federation instanceof MockFederation && this.federation.mediaUploaderPath) {
|
|
837
|
+
const path = expandUriTemplate(this.federation.mediaUploaderPath, { identifier });
|
|
838
|
+
return new URL(path, this.origin);
|
|
839
|
+
}
|
|
840
|
+
return new URL(`/users/${identifier}/media`, this.origin);
|
|
841
|
+
}
|
|
821
842
|
getInboxUri(identifier) {
|
|
822
843
|
if (identifier) {
|
|
823
844
|
if (this.federation instanceof MockFederation && this.federation.inboxPath) {
|
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.1618+58858243",
|
|
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.1618+58858243"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"es-toolkit": "1.46.1"
|
|
53
|
+
"es-toolkit": "1.46.1",
|
|
54
|
+
"temporal-polyfill": "^1.0.1"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
|
-
"@js-temporal/polyfill": "^0.5.1",
|
|
57
57
|
"@standard-schema/spec": "^1.1.0",
|
|
58
58
|
"@std/assert": "npm:@jsr/std__assert@^1.0.13",
|
|
59
59
|
"@std/async": "npm:@jsr/std__async@^1.0.13",
|