@fedify/fedify 1.8.1-pr.332.1180 → 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.
Files changed (86) hide show
  1. package/dist/{actor-CHLBVvcc.js → actor-BxYrc06V.js} +179 -179
  2. package/dist/{actor-DY2jOBlC.js → actor-CeBMq8qR.js} +1 -1
  3. package/dist/{authdocloader-Mr-8Pvno.js → authdocloader-D64rqKxU.js} +3 -3
  4. package/dist/{authdocloader-CnPexSez.js → authdocloader-mGQvrIQ2.js} +3 -3
  5. package/dist/{builder-AQzzgVb7.js → builder-BMWyrhEH.js} +4 -43
  6. package/dist/{client-DrErxHbD.js → client-CTC5x_Sz.js} +1 -1
  7. package/dist/compat/mod.d.ts +2 -2
  8. package/dist/compat/transformers.test.js +16 -16
  9. package/dist/{context-72aRESIE.d.ts → context-B6mUZhs_.d.ts} +1 -214
  10. package/dist/{docloader-BMNjmXei.js → docloader-BU0Mbf3M.js} +1 -1
  11. package/dist/{esm-CkeX4Z_e.js → esm-LMB9p-G5.js} +1 -1
  12. package/dist/federation/builder.test.js +5 -5
  13. package/dist/federation/collection.test.js +3 -3
  14. package/dist/federation/handler.test.js +17 -327
  15. package/dist/federation/inbox.test.js +4 -4
  16. package/dist/federation/keycache.test.js +4 -4
  17. package/dist/federation/kv.test.js +3 -3
  18. package/dist/federation/middleware.test.js +18 -19
  19. package/dist/federation/mod.d.ts +2 -2
  20. package/dist/federation/mod.js +10 -10
  21. package/dist/federation/mq.test.js +3 -3
  22. package/dist/federation/retry.test.js +3 -3
  23. package/dist/federation/router.test.js +3 -3
  24. package/dist/federation/send.test.js +10 -10
  25. package/dist/{http-B9bZVfoW.js → http-CYR3mIVn.js} +3 -3
  26. package/dist/{http-BEKI5Hou.js → http-D3g0NXG1.js} +2 -2
  27. package/dist/{inbox-DdH5OssY.js → inbox-CKssCQNk.js} +1 -1
  28. package/dist/{key-ClRK_LNW.js → key-BBZcKCrH.js} +2 -2
  29. package/dist/{key-CF4gUN_w.js → key-CmOXs0Mq.js} +3 -3
  30. package/dist/{key-BkDKGtUZ.js → key-CuNvhgVd.js} +4 -4
  31. package/dist/{key-_t2XvsRR.js → key-YOEsvep6.js} +2 -2
  32. package/dist/{keycache-C1F4HMt-.js → keycache-DGObidvq.js} +1 -1
  33. package/dist/{keys-3zMMlZii.js → keys-CPhbsrsX.js} +1 -1
  34. package/dist/{ld-DQJTs3PX.js → ld-D8ugSU-x.js} +2 -2
  35. package/dist/{lookup-DmrIfsZE.js → lookup-B0_qPExk.js} +1 -1
  36. package/dist/{lookup-BbrpqrfQ.js → lookup-rBByGTyy.js} +1 -1
  37. package/dist/{middleware-CTkxtnv3.js → middleware-B_To0NZ3.js} +10 -590
  38. package/dist/middleware-DbDzHrt7.js +17 -0
  39. package/dist/middleware-JUbAKlS5.js +26 -0
  40. package/dist/{middleware-DlG0C99f.js → middleware-u2WBeCjB.js} +14 -555
  41. package/dist/{mod-OU0GgfW6.d.ts → mod-D9qE4iHP.d.ts} +1 -1
  42. package/dist/mod.d.ts +3 -3
  43. package/dist/mod.js +10 -10
  44. package/dist/nodeinfo/client.test.js +5 -5
  45. package/dist/nodeinfo/handler.test.js +16 -16
  46. package/dist/nodeinfo/mod.js +2 -2
  47. package/dist/nodeinfo/semver.test.js +3 -3
  48. package/dist/nodeinfo/types.test.js +3 -3
  49. package/dist/{owner-DKd1nYEb.js → owner-D1TBvEbO.js} +2 -2
  50. package/dist/{proof-NSkkFrOi.js → proof-CUsFh6B-.js} +3 -3
  51. package/dist/{proof-Dk0reBe7.js → proof-CyWfFsKS.js} +2 -2
  52. package/dist/runtime/authdocloader.test.js +9 -9
  53. package/dist/runtime/docloader.test.js +4 -4
  54. package/dist/runtime/key.test.js +5 -5
  55. package/dist/runtime/langstr.test.js +3 -3
  56. package/dist/runtime/mod.js +6 -6
  57. package/dist/runtime/multibase/multibase.test.js +3 -3
  58. package/dist/runtime/url.test.js +3 -3
  59. package/dist/{send-D1L-K83i.js → send-CrjrTnXW.js} +2 -2
  60. package/dist/sig/http.test.js +8 -8
  61. package/dist/sig/key.test.js +6 -6
  62. package/dist/sig/ld.test.js +7 -7
  63. package/dist/sig/mod.js +6 -6
  64. package/dist/sig/owner.test.js +7 -7
  65. package/dist/sig/proof.test.js +7 -7
  66. package/dist/testing/docloader.test.js +3 -3
  67. package/dist/testing/mod.d.ts +0 -212
  68. package/dist/testing/mod.js +3 -3
  69. package/dist/{testing-3xSoXkQB.js → testing-CROcCUCq.js} +3 -4
  70. package/dist/{type-Dx19jzWd.js → type-DGlR8Urb.js} +179 -179
  71. package/dist/{types-Yo_BljxV.js → types-DZdBK266.js} +1 -1
  72. package/dist/vocab/actor.test.js +5 -5
  73. package/dist/vocab/lookup.test.js +4 -4
  74. package/dist/vocab/mod.js +4 -4
  75. package/dist/vocab/type.test.js +3 -3
  76. package/dist/vocab/vocab.test.js +4 -4
  77. package/dist/{vocab-CgUKDr2G.js → vocab-BLQ-_oLb.js} +3 -3
  78. package/dist/webfinger/handler.test.js +16 -16
  79. package/dist/webfinger/lookup.test.js +4 -4
  80. package/dist/webfinger/mod.js +2 -2
  81. package/dist/x/cfworkers.test.js +3 -3
  82. package/dist/x/hono.d.ts +1 -1
  83. package/dist/x/sveltekit.d.ts +1 -1
  84. package/package.json +1 -1
  85. package/dist/middleware-CHIEcZ7h.js +0 -17
  86. package/dist/middleware-DPT6Ob5T.js +0 -26
@@ -7062,45 +7062,6 @@ type AuthorizePredicate<TContextData> = (context: RequestContext<TContextData>,
7062
7062
  * @since 0.7.0
7063
7063
  */
7064
7064
  type ObjectAuthorizePredicate<TContextData, TParam extends string> = (context: RequestContext<TContextData>, values: Record<TParam, string>, signedKey: CryptographicKey | null, signedKeyOwner: Actor | null) => boolean | Promise<boolean>;
7065
- /**
7066
- * A callback that dispatches a custom collection.
7067
- *
7068
- * @typeParam TItem The type of items in the collection.
7069
- * @typeParam TParams The parameter names of the requested URL.
7070
- * @typeParam TContext The type of the context. {@link Context} or
7071
- * {@link RequestContext}.
7072
- * @typeParam TContextData The context data to pass to the `TContext`.
7073
- * @typeParam TFilter The type of the filter, if any.
7074
- * @param context The context.
7075
- * @param values The parameters of the requested URL.
7076
- * @param cursor The cursor to start the collection from, or `null` to dispatch
7077
- * the entire collection without pagination.
7078
- * @since 1.8.0
7079
- */
7080
- type CustomCollectionDispatcher<TItem, TParams extends Record<string, string>, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: TParams, cursor: string | null) => PageItems<TItem> | null | Promise<PageItems<TItem> | null>;
7081
- /**
7082
- * A callback that counts the number of items in a custom collection.
7083
- *
7084
- * @typeParam TParams The parameter names of the requested URL.
7085
- * @typeParam TContextData The context data to pass to the {@link Context}.
7086
- * @param context The context.
7087
- * @param values The parameters of the requested URL.
7088
- * @since 1.8.0
7089
- */
7090
- type CustomCollectionCounter<TParams extends Record<string, string>, TContextData> = (context: RequestContext<TContextData>, values: TParams) => number | bigint | null | Promise<number | bigint | null>;
7091
- /**
7092
- * A callback that returns a cursor for a custom collection.
7093
- *
7094
- * @typeParam TParams The parameter names of the requested URL.
7095
- * @typeParam TContext The type of the context. {@link Context} or
7096
- * {@link RequestContext}.
7097
- * @typeParam TContextData The context data to pass to the {@link Context}.
7098
- * @typeParam TFilter The type of the filter, if any.
7099
- * @param context The context.
7100
- * @param values The parameters of the requested URL.
7101
- * @since 1.8.0
7102
- */
7103
- type CustomCollectionCursor<TParams extends Record<string, string>, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: TParams) => string | null | Promise<string | null>;
7104
7065
  //#endregion
7105
7066
  //#region federation/queue.d.ts
7106
7067
  interface SenderKeyJwkPair {
@@ -7439,36 +7400,6 @@ interface Federatable<TContextData> {
7439
7400
  * @throws {RouteError} Thrown if the path pattern is invalid.
7440
7401
  */
7441
7402
  setInboxListeners(inboxPath: `${string}{identifier}${string}` | `${string}{handle}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
7442
- /**
7443
- * Registers a collection of objects dispatcher.
7444
- *
7445
- * @typeParam TContextData The context data to pass to the {@link Context}.
7446
- * @typeParam TObject The type of objects to dispatch.
7447
- * @typeParam TParam The parameter names of the requested URL.
7448
- * @param name A unique name for the collection dispatcher.
7449
- * @param itemType The Activity Vocabulary class of the object to dispatch.
7450
- * @param path The URI path pattern for the collection dispatcher.
7451
- * The syntax is based on URI Template
7452
- * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
7453
- * The path must have one or more variables.
7454
- * @param dispatcher A collection dispatcher callback to register.
7455
- */
7456
- setCollectionDispatcher<TObject extends Object$1, TParams extends Record<string, string>>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: ParamsKeyPath<TParams>, dispatcher: CustomCollectionDispatcher<TObject, TParams, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParams, RequestContext<TContextData>, TContextData>;
7457
- /**
7458
- * Registers an ordered collection of objects dispatcher.
7459
- *
7460
- * @typeParam TContextData The context data to pass to the {@link Context}.
7461
- * @typeParam TObject The type of objects to dispatch.
7462
- * @typeParam TParam The parameter names of the requested URL.
7463
- * @param name A unique name for the collection dispatcher.
7464
- * @param itemType The Activity Vocabulary class of the object to dispatch.
7465
- * @param path The URI path pattern for the collection dispatcher.
7466
- * The syntax is based on URI Template
7467
- * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
7468
- * The path must have one or more variables.
7469
- * @param dispatcher A collection dispatcher callback to register.
7470
- */
7471
- setOrderedCollectionDispatcher<TObject extends Object$1, TParams extends Record<string, string>>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: ParamsKeyPath<TParams>, dispatcher: CustomCollectionDispatcher<TObject, TParams, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParams, RequestContext<TContextData>, TContextData>;
7472
7403
  }
7473
7404
  /**
7474
7405
  * An object that registers federation-related business logic and dispatches
@@ -7704,119 +7635,6 @@ interface FederationFetchOptions<TContextData> {
7704
7635
  */
7705
7636
  onUnauthorized?: (request: Request) => Response | Promise<Response>;
7706
7637
  }
7707
- /**
7708
- * Additional settings for a custom collection dispatcher.
7709
- *
7710
- * @typeParam TParams The type of the parameters in the URL path.
7711
- * @typeParam TContext The type of the context. {@link Context} or
7712
- * {@link RequestContext}.
7713
- * @typeParam TContextData The context data to pass to the {@link Context}.
7714
- * @typeParam TFilter The type of filter for the collection.
7715
- */
7716
- interface CustomCollectionCallbackSetters<TParams extends Record<string, string>, TContext extends Context<TContextData>, TContextData> {
7717
- /**
7718
- * Sets the counter for the custom collection.
7719
- * @param counter A callback that returns the number of items in the custom collection.
7720
- * @returns The setters object so that settings can be chained.
7721
- */
7722
- setCounter(counter: CustomCollectionCounter<TParams, TContextData>): CustomCollectionCallbackSetters<TParams, TContext, TContextData>;
7723
- /**
7724
- * Sets the first cursor for the custom collection.
7725
- * @param cursor The cursor for the first item in the custom collection.
7726
- * @returns The setters object so that settings can be chained.
7727
- */
7728
- setFirstCursor(cursor: CustomCollectionCursor<TParams, TContext, TContextData>): CustomCollectionCallbackSetters<TParams, TContext, TContextData>;
7729
- /**
7730
- * Sets the last cursor for the custom collection.
7731
- * @param cursor The cursor for the last item in the custom collection.
7732
- * @returns The setters object so that settings can be chained.
7733
- */
7734
- setLastCursor(cursor: CustomCollectionCursor<TParams, TContext, TContextData>): CustomCollectionCallbackSetters<TParams, TContext, TContextData>;
7735
- /**
7736
- * Specifies the conditions under which requests are authorized.
7737
- * @param predicate A callback that returns whether a request is authorized.
7738
- * @returns The setters object so that settings can be chained.
7739
- * @since 0.7.0
7740
- */
7741
- authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<TParams, TContext, TContextData>;
7742
- }
7743
- /**
7744
- * Represents an object with a type ID, which is either a constructor or an
7745
- * instance of the object.
7746
- *
7747
- * @typeParam TObject The type of the object.
7748
- */
7749
- type ConstructorWithTypeId<TObject extends Object$1> = (new (...args: any[]) => TObject) & {
7750
- typeId: URL;
7751
- };
7752
- /**
7753
- * Represents a path from the key of parameter objects.
7754
- * @param Params - A record of parameters where keys are parameter names and
7755
- * values are their string representations.
7756
- * @returns A string representing the path with all parameters.
7757
- * @example
7758
- * ```ts
7759
- * type UserPostPath = ParamsKeyPath<{ userId: string; postId: string }>;
7760
- * let userPostPath: UserPostPath;
7761
- * // userPostPath = "/posts/{postId}"; // invalid - does not contain `{userId}`
7762
- * // userPostPath = "/users/{userId}"; // invalid - does not contain `{postId}`
7763
- * userPostPath = "/users/{userId}/posts/{postId}"; // valid
7764
- * userPostPath = "/posts/{postId}/users/{userId}"; // valid
7765
- * ```
7766
- */
7767
- type ParamsKeyPath<Params extends Record<string, string>> = ParamsPath<Extract<keyof Params, string>> & string;
7768
- /**
7769
- * Represents a path with multiple parameters.
7770
- * All permutations of the parameters are included in the union type.
7771
- * The path must have all parameters in the form of `{paramName}`.
7772
- * @param Params - A union of parameter names.
7773
- * @returns A string representing the path with all parameters.
7774
- * @example
7775
- * ```ts
7776
- * type UserPostPath = ParamsPath<"userId" | "postId">;
7777
- * // = `${string}{userId}${string}` & `${string}{postId}${string}`
7778
- * // =
7779
- * // | `${string}{userId}${string}{postId}${string}`
7780
- * // | `${string}{postId}${string}{userId}${string}`
7781
- * let userPostPath: UserPostPath;
7782
- * userPostPath = "/users/posts"; // ❌ invalid
7783
- * userPostPath = "/users/{userId}"; // ❌ invalid
7784
- * userPostPath = "/posts/{postId}"; // ❌ invalid
7785
- * userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
7786
- * userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
7787
- */
7788
- type ParamsPath<Params extends string> = UnionToIntersection<ParamPath<Params>>;
7789
- /**
7790
- * Represents a path with a single parameter.
7791
- * The path must have at least one of the parameters in the form of `{paramName}`.
7792
- * @param Param - The name of the parameter.
7793
- * @returns A string representing the path with the parameter.
7794
- * @example
7795
- * ```ts
7796
- * type UserPostPath = ParamPath<"userId" | "postId">;
7797
- * // = `${string}{userId}${string}` | `${string}{postId}${string}`
7798
- * let userPostPath: UserPostPath;
7799
- * userPostPath = "/users/posts"; // ❌ invalid
7800
- * userPostPath = "/users/{userId}"; // ✅ valid
7801
- * userPostPath = "/posts/{postId}"; // ✅ valid
7802
- * userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
7803
- * userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
7804
- */
7805
- type ParamPath<Param extends string> = `${string}{${Param}}${string}`;
7806
- /**
7807
- * Converts union types to intersection types.
7808
- *
7809
- * @typeParam U - The union type to convert.
7810
- * @returns The intersection type of the union.
7811
- * @example
7812
- * ```ts
7813
- * type A = { a: string };
7814
- * type B = { b: number };
7815
- * type AorB = A | B;
7816
- * type AandB = UnionToIntersection<AorB>;
7817
- * // AandB = { a: string; b: number }
7818
- */
7819
- type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never;
7820
7638
  //#endregion
7821
7639
  //#region federation/context.d.ts
7822
7640
  /**
@@ -8171,16 +7989,6 @@ interface Context<TContextData> {
8171
7989
  * @since 1.3.0
8172
7990
  */
8173
7991
  routeActivity(recipient: string | null, activity: Activity, options?: RouteActivityOptions): Promise<boolean>;
8174
- /**
8175
- * Builds the URI of a collection of objects with the given name and values.
8176
- * @param name The name of the collection, which can be a string or a symbol.
8177
- * @param values The values of the URI parameters.
8178
- * @return The URI of the collection.
8179
- * @throws {RouteError} If no object dispatcher is available for the name.
8180
- * @throws {TypeError} If values are invalid.
8181
- * @since 1.8.0
8182
- */
8183
- getCollectionUri<TParam extends Record<string, string>>(name: string | symbol, values: TParam): URL;
8184
7992
  }
8185
7993
  /**
8186
7994
  * A context for a request.
@@ -8431,26 +8239,6 @@ type ParseUriResult =
8431
8239
  readonly type: "featuredTags";
8432
8240
  readonly identifier: string;
8433
8241
  readonly handle: string;
8434
- }
8435
- /**
8436
- * The case of a custom collection URI.
8437
- * @since 1.8.0
8438
- */ | {
8439
- readonly type: "collection";
8440
- readonly name: string | symbol;
8441
- readonly class: ConstructorWithTypeId<Object$1>;
8442
- readonly typeId: URL;
8443
- readonly values: Record<string, string>;
8444
- }
8445
- /**
8446
- * The case of a custom ordered collection URI.
8447
- * @since 1.8.0
8448
- */ | {
8449
- readonly type: "orderedCollection";
8450
- readonly name: string | symbol;
8451
- readonly class: ConstructorWithTypeId<Object$1>;
8452
- readonly typeId: URL;
8453
- readonly values: Record<string, string>;
8454
8242
  };
8455
8243
  /**
8456
8244
  * Options for {@link Context.sendActivity} method.
@@ -3,8 +3,8 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import "../type-Dx19jzWd.js";
7
- import "../lookup-DmrIfsZE.js";
8
- import { createInboxContext, createRequestContext, test, testDefinitions } from "../testing-3xSoXkQB.js";
6
+ import "../type-DGlR8Urb.js";
7
+ import "../lookup-B0_qPExk.js";
8
+ import { createInboxContext, createRequestContext, test, testDefinitions } from "../testing-CROcCUCq.js";
9
9
 
10
10
  export { createInboxContext, createRequestContext, test, testDefinitions };
@@ -3,8 +3,8 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { __require, lookupWebFinger } from "./type-Dx19jzWd.js";
7
- import { RouterError, lookupObject, traverseCollection } from "./lookup-DmrIfsZE.js";
6
+ import { __require, lookupWebFinger } from "./type-DGlR8Urb.js";
7
+ import { RouterError, lookupObject, traverseCollection } from "./lookup-B0_qPExk.js";
8
8
  import { configure, getConsoleSink, getLogger, reset } from "@logtape/logtape";
9
9
  import { trace } from "@opentelemetry/api";
10
10
 
@@ -70,7 +70,7 @@ async function mockDocumentLoader(resource) {
70
70
  //#endregion
71
71
  //#region testing/context.ts
72
72
  function createContext(values) {
73
- 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;
73
+ 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;
74
74
  function throwRouteError() {
75
75
  throw new RouterError("Not implemented");
76
76
  }
@@ -91,7 +91,6 @@ function createContext(values) {
91
91
  getNodeInfoUri: getNodeInfoUri ?? throwRouteError,
92
92
  getActorUri: getActorUri ?? throwRouteError,
93
93
  getObjectUri: getObjectUri ?? throwRouteError,
94
- getCollectionUri: getCollectionUri ?? throwRouteError,
95
94
  getOutboxUri: getOutboxUri ?? throwRouteError,
96
95
  getInboxUri: getInboxUri ?? throwRouteError,
97
96
  getFollowingUri: getFollowingUri ?? throwRouteError,