@fedify/testing 2.4.0-dev.1599 → 2.4.0-dev.1634
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 +22 -1
- package/dist/mod.js +22 -1
- package/package.json +2 -2
package/dist/mod.cjs
CHANGED
|
@@ -38,7 +38,7 @@ const noopMeterProvider$1 = { getMeter: () => ({
|
|
|
38
38
|
removeBatchObservableCallback: () => void 0
|
|
39
39
|
}) };
|
|
40
40
|
function createContext(values) {
|
|
41
|
-
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, traverseCollection, 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, getCollectionUri, getOutboxUri, getMediaUploaderUri, getInboxUri, getFollowingUri, getFollowersUri, getLikedUri, getFeaturedUri, getFeaturedTagsUri, parseUri, getActorKeyPairs, getDocumentLoader, lookupObject, traverseCollection, lookupNodeInfo, lookupWebFinger, sendActivity, routeActivity, enqueueTask, enqueueTaskMany } = values;
|
|
42
42
|
function throwRouterError() {
|
|
43
43
|
throw new _fedify_fedify_federation.RouterError("Not implemented");
|
|
44
44
|
}
|
|
@@ -62,6 +62,7 @@ function createContext(values) {
|
|
|
62
62
|
getObjectUri: getObjectUri ?? throwRouterError,
|
|
63
63
|
getCollectionUri: getCollectionUri ?? throwRouterError,
|
|
64
64
|
getOutboxUri: getOutboxUri ?? throwRouterError,
|
|
65
|
+
getMediaUploaderUri: getMediaUploaderUri ?? throwRouterError,
|
|
65
66
|
getInboxUri: getInboxUri ?? throwRouterError,
|
|
66
67
|
getFollowingUri: getFollowingUri ?? throwRouterError,
|
|
67
68
|
getFollowersUri: getFollowersUri ?? throwRouterError,
|
|
@@ -283,6 +284,7 @@ var MockFederation = class {
|
|
|
283
284
|
actorPath;
|
|
284
285
|
inboxPath;
|
|
285
286
|
outboxPath;
|
|
287
|
+
mediaUploaderPath;
|
|
286
288
|
followingPath;
|
|
287
289
|
followersPath;
|
|
288
290
|
likedPath;
|
|
@@ -298,6 +300,8 @@ var MockFederation = class {
|
|
|
298
300
|
outboxAuthorizePredicate;
|
|
299
301
|
outboxDispatcherAuthorizePredicate;
|
|
300
302
|
outboxListenerErrorHandler;
|
|
303
|
+
mediaUploaderCallback;
|
|
304
|
+
mediaUploaderAuthorizePredicate;
|
|
301
305
|
followingDispatcher;
|
|
302
306
|
followersDispatcher;
|
|
303
307
|
likedDispatcher;
|
|
@@ -470,6 +474,16 @@ var MockFederation = class {
|
|
|
470
474
|
}
|
|
471
475
|
};
|
|
472
476
|
}
|
|
477
|
+
setMediaUploader(path, callback) {
|
|
478
|
+
if (this.mediaUploaderCallback != null) throw new TypeError("Media uploader already set.");
|
|
479
|
+
this.mediaUploaderPath = path;
|
|
480
|
+
this.mediaUploaderCallback = callback;
|
|
481
|
+
const self = this;
|
|
482
|
+
return { authorize(predicate) {
|
|
483
|
+
self.mediaUploaderAuthorizePredicate = predicate;
|
|
484
|
+
return this;
|
|
485
|
+
} };
|
|
486
|
+
}
|
|
473
487
|
setOutboxPermanentFailureHandler(_handler) {}
|
|
474
488
|
async startQueue(contextData, options) {
|
|
475
489
|
this.contextData = contextData;
|
|
@@ -819,6 +833,13 @@ var MockContext = class MockContext {
|
|
|
819
833
|
}
|
|
820
834
|
return new URL(`/users/${identifier}/outbox`, this.origin);
|
|
821
835
|
}
|
|
836
|
+
getMediaUploaderUri(identifier) {
|
|
837
|
+
if (this.federation instanceof MockFederation && this.federation.mediaUploaderPath) {
|
|
838
|
+
const path = expandUriTemplate(this.federation.mediaUploaderPath, { identifier });
|
|
839
|
+
return new URL(path, this.origin);
|
|
840
|
+
}
|
|
841
|
+
return new URL(`/users/${identifier}/media`, this.origin);
|
|
842
|
+
}
|
|
822
843
|
getInboxUri(identifier) {
|
|
823
844
|
if (identifier) {
|
|
824
845
|
if (this.federation instanceof MockFederation && this.federation.inboxPath) {
|
package/dist/mod.js
CHANGED
|
@@ -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.1634+3b4bfbb6",
|
|
4
4
|
"description": "Testing utilities for Fedify applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fedify",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"package.json"
|
|
48
48
|
],
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@fedify/fedify": "^2.4.0-dev.
|
|
50
|
+
"@fedify/fedify": "^2.4.0-dev.1634+3b4bfbb6"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"es-toolkit": "1.46.1",
|