@fedify/testing 2.4.0-dev.2065 → 2.4.0-dev.2073

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 CHANGED
@@ -39,7 +39,7 @@ const noopMeterProvider$1 = { getMeter: () => ({
39
39
  removeBatchObservableCallback: () => void 0
40
40
  }) };
41
41
  function createContext(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
+ const { federation, url = new URL("http://example.com/"), canonicalOrigin, data, documentLoader, contextLoader, meterProvider, tracerProvider, clone, getNodeInfoUri, getActorUri, getObjectUri, getPortableObjectUri, getPortableInboxUri, getCollectionUri, getOutboxUri, getMediaUploaderUri, getInboxUri, getFollowingUri, getFollowersUri, getLikedUri, getFeaturedUri, getFeaturedTagsUri, parseUri, getActorKeyPairs, getDocumentLoader, lookupObject, traverseCollection, lookupNodeInfo, lookupWebFinger, sendActivity, routeActivity, enqueueTask, enqueueTaskMany } = values;
43
43
  function throwRouterError() {
44
44
  throw new _fedify_fedify_federation.RouterError("Not implemented");
45
45
  }
@@ -62,6 +62,7 @@ function createContext(values) {
62
62
  getActorUri: getActorUri ?? throwRouterError,
63
63
  getObjectUri: getObjectUri ?? throwRouterError,
64
64
  getPortableObjectUri: getPortableObjectUri ?? throwRouterError,
65
+ getPortableInboxUri: getPortableInboxUri ?? throwRouterError,
65
66
  getCollectionUri: getCollectionUri ?? throwRouterError,
66
67
  getOutboxUri: getOutboxUri ?? throwRouterError,
67
68
  getMediaUploaderUri: getMediaUploaderUri ?? throwRouterError,
@@ -343,15 +344,17 @@ var MockFederation = class {
343
344
  setActorDispatcher(path, dispatcher) {
344
345
  this.actorDispatchers.set(path, dispatcher);
345
346
  this.actorPath = path;
346
- return {
347
+ const setters = {
347
348
  setKeyPairsDispatcher: (keyPairsDispatcher) => {
348
349
  this.actorKeyPairsDispatcher = keyPairsDispatcher;
349
350
  return this;
350
351
  },
351
352
  mapHandle: () => this,
352
353
  mapAlias: () => this,
354
+ mapPortableActorId: () => setters,
353
355
  authorize: () => this
354
356
  };
357
+ return setters;
355
358
  }
356
359
  setObjectDispatcher(cls, path, dispatcher) {
357
360
  this.objectDispatchers.set(path, dispatcher);
@@ -839,6 +842,11 @@ var MockContext = class MockContext {
839
842
  const { pathname } = this.getObjectUri(cls, values);
840
843
  return (0, _fedify_vocab_runtime.parseIri)(`ap+ef61://${authority}${pathname}`);
841
844
  }
845
+ getPortableInboxUri(identifier, authority) {
846
+ 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.");
847
+ const { pathname } = this.getInboxUri(identifier);
848
+ return (0, _fedify_vocab_runtime.parseIri)(`ap+ef61://${authority}${pathname}`);
849
+ }
842
850
  getOutboxUri(identifier) {
843
851
  if (this.federation instanceof MockFederation && this.federation.outboxPath) {
844
852
  const path = expandUriTemplate(this.federation.outboxPath, { identifier });
package/dist/mod.js 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, 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
+ const { federation, url = new URL("http://example.com/"), canonicalOrigin, data, documentLoader, contextLoader, meterProvider, tracerProvider, clone, getNodeInfoUri, getActorUri, getObjectUri, getPortableObjectUri, getPortableInboxUri, 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;
42
42
  function throwRouterError() {
43
43
  throw new RouterError("Not implemented");
44
44
  }
@@ -61,6 +61,7 @@ function createContext(values) {
61
61
  getActorUri: getActorUri ?? throwRouterError,
62
62
  getObjectUri: getObjectUri ?? throwRouterError,
63
63
  getPortableObjectUri: getPortableObjectUri ?? throwRouterError,
64
+ getPortableInboxUri: getPortableInboxUri ?? throwRouterError,
64
65
  getCollectionUri: getCollectionUri ?? throwRouterError,
65
66
  getOutboxUri: getOutboxUri ?? throwRouterError,
66
67
  getMediaUploaderUri: getMediaUploaderUri ?? throwRouterError,
@@ -342,15 +343,17 @@ var MockFederation = class {
342
343
  setActorDispatcher(path, dispatcher) {
343
344
  this.actorDispatchers.set(path, dispatcher);
344
345
  this.actorPath = path;
345
- return {
346
+ const setters = {
346
347
  setKeyPairsDispatcher: (keyPairsDispatcher) => {
347
348
  this.actorKeyPairsDispatcher = keyPairsDispatcher;
348
349
  return this;
349
350
  },
350
351
  mapHandle: () => this,
351
352
  mapAlias: () => this,
353
+ mapPortableActorId: () => setters,
352
354
  authorize: () => this
353
355
  };
356
+ return setters;
354
357
  }
355
358
  setObjectDispatcher(cls, path, dispatcher) {
356
359
  this.objectDispatchers.set(path, dispatcher);
@@ -838,6 +841,11 @@ var MockContext = class MockContext {
838
841
  const { pathname } = this.getObjectUri(cls, values);
839
842
  return parseIri(`ap+ef61://${authority}${pathname}`);
840
843
  }
844
+ getPortableInboxUri(identifier, authority) {
845
+ 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.");
846
+ const { pathname } = this.getInboxUri(identifier);
847
+ return parseIri(`ap+ef61://${authority}${pathname}`);
848
+ }
841
849
  getOutboxUri(identifier) {
842
850
  if (this.federation instanceof MockFederation && this.federation.outboxPath) {
843
851
  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.2065+b09fdd33",
3
+ "version": "2.4.0-dev.2073+2152dfc6",
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.2065+b09fdd33"
50
+ "@fedify/fedify": "^2.4.0-dev.2073+2152dfc6"
51
51
  },
52
52
  "dependencies": {
53
53
  "es-toolkit": "1.46.1",
54
54
  "temporal-polyfill": "^1.0.1",
55
- "@fedify/vocab-runtime": "^2.4.0-dev.2065+b09fdd33",
56
- "@fedify/vocab": "2.4.0-dev.2065+b09fdd33"
55
+ "@fedify/vocab": "2.4.0-dev.2073+2152dfc6",
56
+ "@fedify/vocab-runtime": "^2.4.0-dev.2073+2152dfc6"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@standard-schema/spec": "^1.1.0",