@fedify/testing 1.8.1-pr.332.1182 → 1.8.1-pr.334.1193

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/context.ts CHANGED
@@ -1,16 +1,16 @@
1
+ import { trace } from "@opentelemetry/api";
1
2
  import type {
2
3
  Context,
3
- Federation,
4
4
  InboxContext,
5
5
  RequestContext,
6
6
  } from "@fedify/fedify/federation";
7
+ import type { Federation } from "@fedify/fedify/federation";
7
8
  import { RouterError } from "@fedify/fedify/federation";
8
9
  import {
9
10
  lookupObject as globalLookupObject,
10
11
  traverseCollection as globalTraverseCollection,
11
12
  } from "@fedify/fedify/vocab";
12
13
  import { lookupWebFinger as globalLookupWebFinger } from "@fedify/fedify/webfinger";
13
- import { trace } from "@opentelemetry/api";
14
14
  import { mockDocumentLoader } from "./docloader.ts";
15
15
 
16
16
  // NOTE: Copied from @fedify/fedify/testing/context.ts
@@ -34,7 +34,6 @@ export function createContext<TContextData>(
34
34
  getNodeInfoUri,
35
35
  getActorUri,
36
36
  getObjectUri,
37
- getCollectionUri,
38
37
  getOutboxUri,
39
38
  getInboxUri,
40
39
  getFollowingUri,
@@ -69,7 +68,6 @@ export function createContext<TContextData>(
69
68
  getNodeInfoUri: getNodeInfoUri ?? throwRouteError,
70
69
  getActorUri: getActorUri ?? throwRouteError,
71
70
  getObjectUri: getObjectUri ?? throwRouteError,
72
- getCollectionUri: getCollectionUri ?? throwRouteError,
73
71
  getOutboxUri: getOutboxUri ?? throwRouteError,
74
72
  getInboxUri: getInboxUri ?? throwRouteError,
75
73
  getFollowingUri: getFollowingUri ?? throwRouteError,
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/testing",
3
- "version": "1.8.1-pr.332.1182+9e7caef3",
3
+ "version": "1.8.1-pr.334.1193+17e63d2f",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./mod.ts"
package/dist/mod.d.ts CHANGED
@@ -124,8 +124,6 @@ declare class MockFederation<TContextData> implements Federation<TContextData> {
124
124
  * @since 1.8.0
125
125
  */
126
126
  reset(): void;
127
- setCollectionDispatcher<TObject extends Object$1, TParams extends Record<string, string>>(_name: string | symbol, _itemType: any, _path: any, _dispatcher: any): any;
128
- setOrderedCollectionDispatcher<TObject extends Object$1, TParams extends Record<string, string>>(_name: string | symbol, _itemType: any, _path: any, _dispatcher: any): any;
129
127
  }
130
128
  /**
131
129
  * A mock implementation of the {@link Context} interface for unit testing.
@@ -198,7 +196,6 @@ declare class MockContext<TContextData> implements Context<TContextData> {
198
196
  getLikedUri(identifier: string): URL;
199
197
  getFeaturedUri(identifier: string): URL;
200
198
  getFeaturedTagsUri(identifier: string): URL;
201
- getCollectionUri<TParam extends Record<string, string>>(_name: string | symbol, values: TParam): URL;
202
199
  parseUri(uri: URL): ParseUriResult | null;
203
200
  getActorKeyPairs(_identifier: string): Promise<ActorKeyPair[]>;
204
201
  getDocumentLoader(params: {
package/dist/mod.js CHANGED
@@ -13,7 +13,7 @@ const mockDocumentLoader = async (url) => ({
13
13
  //#endregion
14
14
  //#region context.ts
15
15
  function createContext(values) {
16
- const { federation, url = new URL("http://example.com/"), canonicalOrigin, data, documentLoader, contextLoader, tracerProvider, clone, getNodeInfoUri, getActorUri, getObjectUri, getCollectionUri, getOutboxUri, getInboxUri, getFollowingUri, getFollowersUri, getLikedUri, getFeaturedUri, getFeaturedTagsUri, parseUri, getActorKeyPairs, getDocumentLoader, lookupObject: lookupObject$1, traverseCollection: traverseCollection$1, lookupNodeInfo, lookupWebFinger: lookupWebFinger$1, sendActivity, routeActivity } = values;
16
+ const { federation, url = new URL("http://example.com/"), canonicalOrigin, data, documentLoader, contextLoader, tracerProvider, clone, getNodeInfoUri, getActorUri, getObjectUri, getOutboxUri, getInboxUri, getFollowingUri, getFollowersUri, getLikedUri, getFeaturedUri, getFeaturedTagsUri, parseUri, getActorKeyPairs, getDocumentLoader, lookupObject: lookupObject$1, traverseCollection: traverseCollection$1, lookupNodeInfo, lookupWebFinger: lookupWebFinger$1, sendActivity, routeActivity } = values;
17
17
  function throwRouteError() {
18
18
  throw new RouterError("Not implemented");
19
19
  }
@@ -34,7 +34,6 @@ function createContext(values) {
34
34
  getNodeInfoUri: getNodeInfoUri ?? throwRouteError,
35
35
  getActorUri: getActorUri ?? throwRouteError,
36
36
  getObjectUri: getObjectUri ?? throwRouteError,
37
- getCollectionUri: getCollectionUri ?? throwRouteError,
38
37
  getOutboxUri: getOutboxUri ?? throwRouteError,
39
38
  getInboxUri: getInboxUri ?? throwRouteError,
40
39
  getFollowingUri: getFollowingUri ?? throwRouteError,
@@ -364,22 +363,6 @@ var MockFederation = class {
364
363
  reset() {
365
364
  this.sentActivities = [];
366
365
  }
367
- setCollectionDispatcher(_name, _itemType, _path, _dispatcher) {
368
- return {
369
- setCounter: () => this,
370
- setFirstCursor: () => this,
371
- setLastCursor: () => this,
372
- authorize: () => this
373
- };
374
- }
375
- setOrderedCollectionDispatcher(_name, _itemType, _path, _dispatcher) {
376
- return {
377
- setCounter: () => this,
378
- setFirstCursor: () => this,
379
- setLastCursor: () => this,
380
- authorize: () => this
381
- };
382
- }
383
366
  };
384
367
  /**
385
368
  * A mock implementation of the {@link Context} interface for unit testing.
@@ -555,10 +538,6 @@ var MockContext = class MockContext {
555
538
  }
556
539
  return new URL(`/users/${identifier}/tags`, this.origin);
557
540
  }
558
- getCollectionUri(_name, values) {
559
- const path = globalThis.Object.entries(values).map(([key, value]) => `${key}/${value}`).join("/");
560
- return new URL(`/collections/${String(_name)}/${path}`, this.origin);
561
- }
562
541
  parseUri(uri) {
563
542
  if (uri.pathname.startsWith("/users/")) {
564
543
  const parts = uri.pathname.split("/");
package/mock.ts CHANGED
@@ -535,42 +535,6 @@ export class MockFederation<TContextData> implements Federation<TContextData> {
535
535
  reset(): void {
536
536
  this.sentActivities = [];
537
537
  }
538
-
539
- setCollectionDispatcher<
540
- TObject extends Object,
541
- TParams extends Record<string, string>,
542
- >(
543
- _name: string | symbol,
544
- _itemType: any,
545
- _path: any,
546
- _dispatcher: any,
547
- ): any {
548
- // Mock implementation - just return a mock callback setters object
549
- return {
550
- setCounter: () => this as any,
551
- setFirstCursor: () => this as any,
552
- setLastCursor: () => this as any,
553
- authorize: () => this as any,
554
- };
555
- }
556
-
557
- setOrderedCollectionDispatcher<
558
- TObject extends Object,
559
- TParams extends Record<string, string>,
560
- >(
561
- _name: string | symbol,
562
- _itemType: any,
563
- _path: any,
564
- _dispatcher: any,
565
- ): any {
566
- // Mock implementation - just return a mock callback setters object
567
- return {
568
- setCounter: () => this as any,
569
- setFirstCursor: () => this as any,
570
- setLastCursor: () => this as any,
571
- authorize: () => this as any,
572
- };
573
- }
574
538
  }
575
539
 
576
540
  // Type definitions for inbox listeners
@@ -816,17 +780,6 @@ export class MockContext<TContextData> implements Context<TContextData> {
816
780
  return new URL(`/users/${identifier}/tags`, this.origin);
817
781
  }
818
782
 
819
- getCollectionUri<TParam extends Record<string, string>>(
820
- _name: string | symbol,
821
- values: TParam,
822
- ): URL {
823
- // Mock implementation - construct a generic collection URI
824
- const path = globalThis.Object.entries(values)
825
- .map(([key, value]) => `${key}/${value}`)
826
- .join("/");
827
- return new URL(`/collections/${String(_name)}/${path}`, this.origin);
828
- }
829
-
830
783
  parseUri(uri: URL): ParseUriResult | null {
831
784
  if (uri.pathname.startsWith("/users/")) {
832
785
  const parts = uri.pathname.split("/");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/testing",
3
- "version": "1.8.1-pr.332.1182+9e7caef3",
3
+ "version": "1.8.1-pr.334.1193+17e63d2f",
4
4
  "description": "Testing utilities for Fedify applications",
5
5
  "keywords": [
6
6
  "fedify",
@@ -41,7 +41,7 @@
41
41
  "./package.json": "./package.json"
42
42
  },
43
43
  "peerDependencies": {
44
- "@fedify/fedify": "1.8.1-pr.332.1182+9e7caef3"
44
+ "@fedify/fedify": "1.8.1-pr.334.1193+17e63d2f"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@js-temporal/polyfill": "^0.5.1",