@fedify/fedify 1.8.1-pr.334.1193 → 1.8.1-pr.340.1214

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 (107) hide show
  1. package/dist/{actor-CeBMq8qR.js → actor-0406z0yr.js} +1 -1
  2. package/dist/{actor-BxYrc06V.js → actor-BaC4dvrg.js} +179 -179
  3. package/dist/{actor-B4TBtqRP.d.ts → actor-CWNAGvnO.d.ts} +2 -2
  4. package/dist/{authdocloader-D64rqKxU.js → authdocloader-CEsK8iV_.js} +3 -3
  5. package/dist/{authdocloader-mGQvrIQ2.js → authdocloader-CtMSv_Pw.js} +3 -3
  6. package/dist/{builder-BMWyrhEH.js → builder-BMJsk4Fm.js} +74 -4
  7. package/dist/{client-BQ4AQGKo.d.ts → client-B0IOer6B.d.ts} +1 -1
  8. package/dist/{client-CTC5x_Sz.js → client-BKDCmXzu.js} +1 -1
  9. package/dist/compat/mod.d.ts +11 -11
  10. package/dist/compat/mod.js +1 -1
  11. package/dist/compat/transformers.test.js +16 -16
  12. package/dist/{context-B6mUZhs_.d.ts → context-BNA3vzcr.d.ts} +273 -60
  13. package/dist/{docloader-BeCtcTOJ.d.ts → docloader-CLolPVL_.d.ts} +1 -1
  14. package/dist/{docloader-BU0Mbf3M.js → docloader-DWk5FlEW.js} +1 -1
  15. package/dist/{esm-LMB9p-G5.js → esm-CXrO8Uio.js} +1 -1
  16. package/dist/federation/builder.test.js +25 -6
  17. package/dist/federation/collection.test.js +3 -3
  18. package/dist/federation/handler.test.js +327 -17
  19. package/dist/federation/inbox.test.js +4 -4
  20. package/dist/federation/keycache.test.js +4 -4
  21. package/dist/federation/kv.test.js +3 -3
  22. package/dist/federation/middleware.test.js +49 -18
  23. package/dist/federation/mod.d.ts +11 -11
  24. package/dist/federation/mod.js +11 -11
  25. package/dist/federation/mq.test.js +3 -3
  26. package/dist/federation/retry.test.js +3 -3
  27. package/dist/federation/router.test.js +3 -3
  28. package/dist/federation/send.test.js +10 -10
  29. package/dist/{http-D3g0NXG1.js → http-CO1FrcSi.js} +2 -2
  30. package/dist/{http-D1uoUH4N.d.ts → http-COez3YdK.d.ts} +4 -4
  31. package/dist/{http-CYR3mIVn.js → http-DhcY_6sW.js} +3 -3
  32. package/dist/{inbox-CKssCQNk.js → inbox-BU_xB7k0.js} +1 -1
  33. package/dist/{key-BBZcKCrH.js → key-B09hs4s0.js} +3 -3
  34. package/dist/{key-CmOXs0Mq.js → key-BdLJwUgz.js} +3 -3
  35. package/dist/{key-YOEsvep6.js → key-CnJoBmuO.js} +3 -3
  36. package/dist/{key-CuNvhgVd.js → key-DOtg5R6v.js} +4 -4
  37. package/dist/{keycache-DGObidvq.js → keycache-lSDCpE3z.js} +1 -1
  38. package/dist/{keys-CPhbsrsX.js → keys-DAWEhOVZ.js} +1 -1
  39. package/dist/{kv-DDdb1hMa.d.ts → kv-BqOK6zss.d.ts} +1 -1
  40. package/dist/{ld-D8ugSU-x.js → ld-wWks9TWo.js} +2 -2
  41. package/dist/{lookup-rBByGTyy.js → lookup-B7MyB44I.js} +1 -1
  42. package/dist/{lookup-B0_qPExk.js → lookup-Cph3FzCE.js} +1 -1
  43. package/dist/{lookup-J_m4YZg0.d.ts → lookup-tSXYzgYs.d.ts} +1 -1
  44. package/dist/middleware-B3Vppi4s.js +26 -0
  45. package/dist/{middleware-u2WBeCjB.js → middleware-B93u9XJg.js} +552 -17
  46. package/dist/middleware-B_dKx4Hf.js +17 -0
  47. package/dist/{middleware-B_To0NZ3.js → middleware-BrIs_Xfo.js} +616 -11
  48. package/dist/{mod-BCl7t-Ka.d.ts → mod-Bf-mThHd.d.ts} +4 -4
  49. package/dist/{mod-BFwgZ7_K.d.ts → mod-C2jQirfr.d.ts} +2 -2
  50. package/dist/{mod-D9qE4iHP.d.ts → mod-CxD6XXBN.d.ts} +5 -5
  51. package/dist/{mod-0L5jhGYM.d.ts → mod-UTC30uNC.d.ts} +2 -2
  52. package/dist/mod.d.ts +14 -14
  53. package/dist/mod.js +11 -11
  54. package/dist/nodeinfo/client.test.js +5 -5
  55. package/dist/nodeinfo/handler.test.js +16 -16
  56. package/dist/nodeinfo/mod.d.ts +3 -3
  57. package/dist/nodeinfo/mod.js +2 -2
  58. package/dist/nodeinfo/semver.test.js +3 -3
  59. package/dist/nodeinfo/types.test.js +3 -3
  60. package/dist/{owner-CEv_PfyK.d.ts → owner-BlxMNrL4.d.ts} +3 -3
  61. package/dist/{owner-D1TBvEbO.js → owner-D5LGiRcJ.js} +2 -2
  62. package/dist/{proof-CUsFh6B-.js → proof-B2bSQ9mB.js} +4 -4
  63. package/dist/{proof-CyWfFsKS.js → proof-DMbQihAa.js} +3 -3
  64. package/dist/runtime/authdocloader.test.js +9 -9
  65. package/dist/runtime/docloader.test.js +4 -4
  66. package/dist/runtime/key.test.js +5 -5
  67. package/dist/runtime/langstr.test.js +3 -3
  68. package/dist/runtime/mod.d.ts +5 -5
  69. package/dist/runtime/mod.js +6 -6
  70. package/dist/runtime/multibase/multibase.test.js +3 -3
  71. package/dist/runtime/url.test.js +3 -3
  72. package/dist/{send-CrjrTnXW.js → send-CHfFIhLs.js} +2 -2
  73. package/dist/sig/http.test.js +8 -8
  74. package/dist/sig/key.test.js +6 -6
  75. package/dist/sig/ld.test.js +7 -7
  76. package/dist/sig/mod.d.ts +7 -7
  77. package/dist/sig/mod.js +6 -6
  78. package/dist/sig/owner.test.js +7 -7
  79. package/dist/sig/proof.test.js +7 -7
  80. package/dist/testing/docloader.test.js +3 -3
  81. package/dist/testing/mod.d.ts +260 -48
  82. package/dist/testing/mod.js +3 -3
  83. package/dist/{testing-CROcCUCq.js → testing-B1f6X3bJ.js} +4 -3
  84. package/dist/{transformers-ghwJuzGY.js → transformers-DJRB0yFF.js} +3 -3
  85. package/dist/{type-DGlR8Urb.js → type-DDS4cl1h.js} +179 -179
  86. package/dist/{types-DZdBK266.js → types-DqEgOZ7x.js} +1 -1
  87. package/dist/vocab/actor.test.js +5 -5
  88. package/dist/vocab/lookup.test.js +4 -4
  89. package/dist/vocab/mod.d.ts +5 -5
  90. package/dist/vocab/mod.js +4 -4
  91. package/dist/vocab/type.test.js +3 -3
  92. package/dist/vocab/vocab.test.js +4 -4
  93. package/dist/{vocab-BLQ-_oLb.js → vocab-4bE35CsS.js} +3 -3
  94. package/dist/{vocab-By6mpzr-.d.ts → vocab-Cyrb7_co.d.ts} +1 -1
  95. package/dist/webfinger/handler.test.js +16 -16
  96. package/dist/webfinger/lookup.test.js +4 -4
  97. package/dist/webfinger/mod.d.ts +3 -3
  98. package/dist/webfinger/mod.js +2 -2
  99. package/dist/x/cfworkers.d.ts +1 -1
  100. package/dist/x/cfworkers.test.js +3 -3
  101. package/dist/x/hono.d.ts +14 -14
  102. package/dist/x/hono.js +2 -2
  103. package/dist/x/sveltekit.d.ts +11 -11
  104. package/dist/x/sveltekit.js +1 -1
  105. package/package.json +1 -1
  106. package/dist/middleware-DbDzHrt7.js +0 -17
  107. package/dist/middleware-JUbAKlS5.js +0 -26
@@ -6872,13 +6872,13 @@ interface SenderKeyPair {
6872
6872
  /**
6873
6873
  * A callback that dispatches a {@link NodeInfo} object.
6874
6874
  *
6875
- * @typeParam TContextData The context data to pass to the {@link Context}.
6875
+ * @template TContextData The context data to pass to the {@link Context}.
6876
6876
  */
6877
6877
  type NodeInfoDispatcher<TContextData> = (context: RequestContext<TContextData>) => NodeInfo | Promise<NodeInfo>;
6878
6878
  /**
6879
6879
  * A callback that dispatches an {@link Actor} object.
6880
6880
  *
6881
- * @typeParam TContextData The context data to pass to the {@link Context}.
6881
+ * @template TContextData The context data to pass to the {@link Context}.
6882
6882
  * @param context The request context.
6883
6883
  * @param identifier The actor's internal identifier or username.
6884
6884
  */
@@ -6886,7 +6886,7 @@ type ActorDispatcher<TContextData> = (context: RequestContext<TContextData>, ide
6886
6886
  /**
6887
6887
  * A callback that dispatches key pairs for an actor.
6888
6888
  *
6889
- * @typeParam TContextData The context data to pass to the {@link Context}.
6889
+ * @template TContextData The context data to pass to the {@link Context}.
6890
6890
  * @param context The context.
6891
6891
  * @param identifier The actor's internal identifier or username.
6892
6892
  * @returns The key pairs.
@@ -6896,7 +6896,7 @@ type ActorKeyPairsDispatcher<TContextData> = (context: Context<TContextData>, id
6896
6896
  /**
6897
6897
  * A callback that maps a WebFinger username to the corresponding actor's
6898
6898
  * internal identifier, or `null` if the username is not found.
6899
- * @typeParam TContextData The context data to pass to the {@link Context}.
6899
+ * @template TContextData The context data to pass to the {@link Context}.
6900
6900
  * @param context The context.
6901
6901
  * @param username The WebFinger username.
6902
6902
  * @returns The actor's internal identifier, or `null` if the username is not
@@ -6907,7 +6907,7 @@ type ActorHandleMapper<TContextData> = (context: Context<TContextData>, username
6907
6907
  /**
6908
6908
  * A callback that maps a WebFinger query to the corresponding actor's
6909
6909
  * internal identifier or username, or `null` if the query is not found.
6910
- * @typeParam TContextData The context data to pass to the {@link Context}.
6910
+ * @template TContextData The context data to pass to the {@link Context}.
6911
6911
  * @param context The request context.
6912
6912
  * @param resource The URL that was queried through WebFinger.
6913
6913
  * @returns The actor's internal identifier or username, or `null` if the query
@@ -6926,20 +6926,20 @@ type ActorAliasMapper<TContextData> = (context: RequestContext<TContextData>, re
6926
6926
  /**
6927
6927
  * A callback that dispatches an object.
6928
6928
  *
6929
- * @typeParam TContextData The context data to pass to the {@link Context}.
6930
- * @typeParam TObject The type of object to dispatch.
6931
- * @typeParam TParam The parameter names of the requested URL.
6929
+ * @template TContextData The context data to pass to the {@link Context}.
6930
+ * @template TObject The type of object to dispatch.
6931
+ * @template TParam The parameter names of the requested URL.
6932
6932
  * @since 0.7.0
6933
6933
  */
6934
6934
  type ObjectDispatcher<TContextData, TObject extends Object$1, TParam extends string> = (context: RequestContext<TContextData>, values: Record<TParam, string>) => TObject | null | Promise<TObject | null>;
6935
6935
  /**
6936
6936
  * A callback that dispatches a collection.
6937
6937
  *
6938
- * @typeParam TItem The type of items in the collection.
6939
- * @typeParam TContext The type of the context. {@link Context} or
6938
+ * @template TItem The type of items in the collection.
6939
+ * @template TContext The type of the context. {@link Context} or
6940
6940
  * {@link RequestContext}.
6941
- * @typeParam TContextData The context data to pass to the `TContext`.
6942
- * @typeParam TFilter The type of the filter, if any.
6941
+ * @template TContextData The context data to pass to the `TContext`.
6942
+ * @template TFilter The type of the filter, if any.
6943
6943
  * @param context The context.
6944
6944
  * @param identifier The internal identifier or the username of the collection
6945
6945
  * owner.
@@ -6951,7 +6951,7 @@ type CollectionDispatcher<TItem, TContext extends Context<TContextData>, TContex
6951
6951
  /**
6952
6952
  * A callback that counts the number of items in a collection.
6953
6953
  *
6954
- * @typeParam TContextData The context data to pass to the {@link Context}.
6954
+ * @template TContextData The context data to pass to the {@link Context}.
6955
6955
  * @param context The context.
6956
6956
  * @param identifier The internal identifier or the username of the collection
6957
6957
  * owner.
@@ -6961,10 +6961,10 @@ type CollectionCounter<TContextData, TFilter> = (context: RequestContext<TContex
6961
6961
  /**
6962
6962
  * A callback that returns a cursor for a collection.
6963
6963
  *
6964
- * @typeParam TContext The type of the context. {@link Context} or
6964
+ * @template TContext The type of the context. {@link Context} or
6965
6965
  * {@link RequestContext}.
6966
- * @typeParam TContextData The context data to pass to the {@link Context}.
6967
- * @typeParam TFilter The type of the filter, if any.
6966
+ * @template TContextData The context data to pass to the {@link Context}.
6967
+ * @template TFilter The type of the filter, if any.
6968
6968
  * @param context The context.
6969
6969
  * @param identifier The internal identifier or the username of the collection
6970
6970
  * owner.
@@ -6974,8 +6974,8 @@ type CollectionCursor<TContext extends Context<TContextData>, TContextData, TFil
6974
6974
  /**
6975
6975
  * A callback that listens for activities in an inbox.
6976
6976
  *
6977
- * @typeParam TContextData The context data to pass to the {@link Context}.
6978
- * @typeParam TActivity The type of activity to listen for.
6977
+ * @template TContextData The context data to pass to the {@link Context}.
6978
+ * @template TActivity The type of activity to listen for.
6979
6979
  * @param context The inbox context.
6980
6980
  * @param activity The activity that was received.
6981
6981
  */
@@ -6983,7 +6983,7 @@ type InboxListener<TContextData, TActivity extends Activity> = (context: InboxCo
6983
6983
  /**
6984
6984
  * A callback that handles errors in an inbox.
6985
6985
  *
6986
- * @typeParam TContextData The context data to pass to the {@link Context}.
6986
+ * @template TContextData The context data to pass to the {@link Context}.
6987
6987
  * @param context The inbox context.
6988
6988
  */
6989
6989
  type InboxErrorHandler<TContextData> = (context: Context<TContextData>, error: Error) => void | Promise<void>;
@@ -6991,7 +6991,7 @@ type InboxErrorHandler<TContextData> = (context: Context<TContextData>, error: E
6991
6991
  * A callback that dispatches the key pair for the authenticated document loader
6992
6992
  * of the {@link Context} passed to the shared inbox listener.
6993
6993
  *
6994
- * @typeParam TContextData The context data to pass to the {@link Context}.
6994
+ * @template TContextData The context data to pass to the {@link Context}.
6995
6995
  * @param context The context.
6996
6996
  * @returns The username or the internal identifier of the actor or the key pair
6997
6997
  * for the authenticated document loader of the {@link Context} passed
@@ -7024,7 +7024,7 @@ type SharedInboxKeyDispatcher<TContextData> = (context: Context<TContextData>) =
7024
7024
  /**
7025
7025
  * A callback that determines if a request is authorized or not.
7026
7026
  *
7027
- * @typeParam TContextData The context data to pass to the {@link Context}.
7027
+ * @template TContextData The context data to pass to the {@link Context}.
7028
7028
  * @param context The request context.
7029
7029
  * @param identifier The internal identifier of the actor that is being requested.
7030
7030
  * @param signedKey *Deprecated in Fedify 1.5.0 in favor of
@@ -7044,8 +7044,8 @@ type AuthorizePredicate<TContextData> = (context: RequestContext<TContextData>,
7044
7044
  /**
7045
7045
  * A callback that determines if a request is authorized or not.
7046
7046
  *
7047
- * @typeParam TContextData The context data to pass to the {@link Context}.
7048
- * @typeParam TParam The parameter names of the requested URL.
7047
+ * @template TContextData The context data to pass to the {@link Context}.
7048
+ * @template TParam The parameter names of the requested URL.
7049
7049
  * @param context The request context.
7050
7050
  * @param values The parameters of the requested URL.
7051
7051
  * @param signedKey *Deprecated in Fedify 1.5.0 in favor of
@@ -7062,6 +7062,45 @@ 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
+ * @template TItem The type of items in the collection.
7069
+ * @template TParams The parameter names of the requested URL.
7070
+ * @template TContext The type of the context. {@link Context} or
7071
+ * {@link RequestContext}.
7072
+ * @template TContextData The context data to pass to the `TContext`.
7073
+ * @template 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
+ * @template TParams The parameter names of the requested URL.
7085
+ * @template 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
+ * @template TParams The parameter names of the requested URL.
7095
+ * @template TContext The type of the context. {@link Context} or
7096
+ * {@link RequestContext}.
7097
+ * @template TContextData The context data to pass to the {@link Context}.
7098
+ * @template 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>;
7065
7104
  //#endregion
7066
7105
  //#region federation/queue.d.ts
7067
7106
  interface SenderKeyJwkPair {
@@ -7139,7 +7178,7 @@ interface FederationStartQueueOptions {
7139
7178
  }
7140
7179
  /**
7141
7180
  * A common interface between {@link Federation} and {@link FederationBuilder}.
7142
- * @typeParam TContextData The context data to pass to the {@link Context}.
7181
+ * @template TContextData The context data to pass to the {@link Context}.
7143
7182
  * @since 1.6.0
7144
7183
  */
7145
7184
  interface Federatable<TContextData> {
@@ -7181,9 +7220,9 @@ interface Federatable<TContextData> {
7181
7220
  /**
7182
7221
  * Registers an object dispatcher.
7183
7222
  *
7184
- * @typeParam TContextData The context data to pass to the {@link Context}.
7185
- * @typeParam TObject The type of object to dispatch.
7186
- * @typeParam TParam The parameter names of the requested URL.
7223
+ * @template TContextData The context data to pass to the {@link Context}.
7224
+ * @template TObject The type of object to dispatch.
7225
+ * @template TParam The parameter names of the requested URL.
7187
7226
  * @param cls The Activity Vocabulary class of the object to dispatch.
7188
7227
  * @param path The URI path pattern for the object dispatcher. The syntax is
7189
7228
  * based on URI Template
@@ -7197,9 +7236,9 @@ interface Federatable<TContextData> {
7197
7236
  /**
7198
7237
  * Registers an object dispatcher.
7199
7238
  *
7200
- * @typeParam TContextData The context data to pass to the {@link Context}.
7201
- * @typeParam TObject The type of object to dispatch.
7202
- * @typeParam TParam The parameter names of the requested URL.
7239
+ * @template TContextData The context data to pass to the {@link Context}.
7240
+ * @template TObject The type of object to dispatch.
7241
+ * @template TParam The parameter names of the requested URL.
7203
7242
  * @param cls The Activity Vocabulary class of the object to dispatch.
7204
7243
  * @param path The URI path pattern for the object dispatcher. The syntax is
7205
7244
  * based on URI Template
@@ -7213,9 +7252,9 @@ interface Federatable<TContextData> {
7213
7252
  /**
7214
7253
  * Registers an object dispatcher.
7215
7254
  *
7216
- * @typeParam TContextData The context data to pass to the {@link Context}.
7217
- * @typeParam TObject The type of object to dispatch.
7218
- * @typeParam TParam The parameter names of the requested URL.
7255
+ * @template TContextData The context data to pass to the {@link Context}.
7256
+ * @template TObject The type of object to dispatch.
7257
+ * @template TParam The parameter names of the requested URL.
7219
7258
  * @param cls The Activity Vocabulary class of the object to dispatch.
7220
7259
  * @param path The URI path pattern for the object dispatcher. The syntax is
7221
7260
  * based on URI Template
@@ -7229,9 +7268,9 @@ interface Federatable<TContextData> {
7229
7268
  /**
7230
7269
  * Registers an object dispatcher.
7231
7270
  *
7232
- * @typeParam TContextData The context data to pass to the {@link Context}.
7233
- * @typeParam TObject The type of object to dispatch.
7234
- * @typeParam TParam The parameter names of the requested URL.
7271
+ * @template TContextData The context data to pass to the {@link Context}.
7272
+ * @template TObject The type of object to dispatch.
7273
+ * @template TParam The parameter names of the requested URL.
7235
7274
  * @param cls The Activity Vocabulary class of the object to dispatch.
7236
7275
  * @param path The URI path pattern for the object dispatcher. The syntax is
7237
7276
  * based on URI Template
@@ -7245,9 +7284,9 @@ interface Federatable<TContextData> {
7245
7284
  /**
7246
7285
  * Registers an object dispatcher.
7247
7286
  *
7248
- * @typeParam TContextData The context data to pass to the {@link Context}.
7249
- * @typeParam TObject The type of object to dispatch.
7250
- * @typeParam TParam The parameter names of the requested URL.
7287
+ * @template TContextData The context data to pass to the {@link Context}.
7288
+ * @template TObject The type of object to dispatch.
7289
+ * @template TParam The parameter names of the requested URL.
7251
7290
  * @param cls The Activity Vocabulary class of the object to dispatch.
7252
7291
  * @param path The URI path pattern for the object dispatcher. The syntax is
7253
7292
  * based on URI Template
@@ -7261,9 +7300,9 @@ interface Federatable<TContextData> {
7261
7300
  /**
7262
7301
  * Registers an object dispatcher.
7263
7302
  *
7264
- * @typeParam TContextData The context data to pass to the {@link Context}.
7265
- * @typeParam TObject The type of object to dispatch.
7266
- * @typeParam TParam The parameter names of the requested URL.
7303
+ * @template TContextData The context data to pass to the {@link Context}.
7304
+ * @template TObject The type of object to dispatch.
7305
+ * @template TParam The parameter names of the requested URL.
7267
7306
  * @param cls The Activity Vocabulary class of the object to dispatch.
7268
7307
  * @param path The URI path pattern for the object dispatcher. The syntax is
7269
7308
  * based on URI Template
@@ -7400,6 +7439,36 @@ interface Federatable<TContextData> {
7400
7439
  * @throws {RouteError} Thrown if the path pattern is invalid.
7401
7440
  */
7402
7441
  setInboxListeners(inboxPath: `${string}{identifier}${string}` | `${string}{handle}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
7442
+ /**
7443
+ * Registers a collection of objects dispatcher.
7444
+ *
7445
+ * @template TContextData The context data to pass to the {@link Context}.
7446
+ * @template TObject The type of objects to dispatch.
7447
+ * @template 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
+ * @template TContextData The context data to pass to the {@link Context}.
7461
+ * @template TObject The type of objects to dispatch.
7462
+ * @template 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>;
7403
7472
  }
7404
7473
  /**
7405
7474
  * An object that registers federation-related business logic and dispatches
@@ -7407,7 +7476,7 @@ interface Federatable<TContextData> {
7407
7476
  *
7408
7477
  * It also provides a middleware interface for handling requests before your
7409
7478
  * web framework's router; see {@link Federation.fetch}.
7410
- * @typeParam TContextData The context data to pass to the {@link Context}.
7479
+ * @template TContextData The context data to pass to the {@link Context}.
7411
7480
  * @since 0.13.0
7412
7481
  */
7413
7482
  interface Federation<TContextData> extends Federatable<TContextData> {
@@ -7466,7 +7535,7 @@ interface Federation<TContextData> extends Federatable<TContextData> {
7466
7535
  * instantiation of the {@link Federation} object until the {@link build}
7467
7536
  * method is called so that dispatchers and listeners can be registered
7468
7537
  * before the {@link Federation} object is instantiated.
7469
- * @typeParam TContextData The context data to pass to the {@link Context}.
7538
+ * @template TContextData The context data to pass to the {@link Context}.
7470
7539
  * @since 1.6.0
7471
7540
  */
7472
7541
 
@@ -7538,10 +7607,10 @@ interface ObjectCallbackSetters<TContextData, TObject extends Object$1, TParam e
7538
7607
  /**
7539
7608
  * Additional settings for a collection dispatcher.
7540
7609
  *
7541
- * @typeParam TContext The type of the context. {@link Context} or
7610
+ * @template TContext The type of the context. {@link Context} or
7542
7611
  * {@link RequestContext}.
7543
- * @typeParam TContextData The context data to pass to the {@link Context}.
7544
- * @typeParam TFilter The type of filter for the collection.
7612
+ * @template TContextData The context data to pass to the {@link Context}.
7613
+ * @template TFilter The type of filter for the collection.
7545
7614
  */
7546
7615
  interface CollectionCallbackSetters<TContext extends Context<TContextData>, TContextData, TFilter> {
7547
7616
  /**
@@ -7604,7 +7673,7 @@ interface InboxListenerSetters<TContextData> {
7604
7673
  /**
7605
7674
  * Parameters of {@link Federation.fetch} method.
7606
7675
  *
7607
- * @typeParam TContextData The context data to pass to the {@link Context}.
7676
+ * @template TContextData The context data to pass to the {@link Context}.
7608
7677
  * @since 0.6.0
7609
7678
  */
7610
7679
  interface FederationFetchOptions<TContextData> {
@@ -7635,6 +7704,119 @@ interface FederationFetchOptions<TContextData> {
7635
7704
  */
7636
7705
  onUnauthorized?: (request: Request) => Response | Promise<Response>;
7637
7706
  }
7707
+ /**
7708
+ * Additional settings for a custom collection dispatcher.
7709
+ *
7710
+ * @template TParams The type of the parameters in the URL path.
7711
+ * @template TContext The type of the context. {@link Context} or
7712
+ * {@link RequestContext}.
7713
+ * @template TContextData The context data to pass to the {@link Context}.
7714
+ * @template 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
+ * @template 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
+ * @template 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;
7638
7820
  //#endregion
7639
7821
  //#region federation/context.d.ts
7640
7822
  /**
@@ -7989,6 +8171,16 @@ interface Context<TContextData> {
7989
8171
  * @since 1.3.0
7990
8172
  */
7991
8173
  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;
7992
8184
  }
7993
8185
  /**
7994
8186
  * A context for a request.
@@ -8239,6 +8431,26 @@ type ParseUriResult =
8239
8431
  readonly type: "featuredTags";
8240
8432
  readonly identifier: string;
8241
8433
  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>;
8242
8454
  };
8243
8455
  /**
8244
8456
  * 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-DGlR8Urb.js";
7
- import "../lookup-B0_qPExk.js";
8
- import { createInboxContext, createRequestContext, test, testDefinitions } from "../testing-CROcCUCq.js";
6
+ import "../type-DDS4cl1h.js";
7
+ import "../lookup-Cph3FzCE.js";
8
+ import { createInboxContext, createRequestContext, test, testDefinitions } from "../testing-B1f6X3bJ.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-DGlR8Urb.js";
7
- import { RouterError, lookupObject, traverseCollection } from "./lookup-B0_qPExk.js";
6
+ import { __require, lookupWebFinger } from "./type-DDS4cl1h.js";
7
+ import { RouterError, lookupObject, traverseCollection } from "./lookup-Cph3FzCE.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, 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, getCollectionUri, 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,6 +91,7 @@ function createContext(values) {
91
91
  getNodeInfoUri: getNodeInfoUri ?? throwRouteError,
92
92
  getActorUri: getActorUri ?? throwRouteError,
93
93
  getObjectUri: getObjectUri ?? throwRouteError,
94
+ getCollectionUri: getCollectionUri ?? throwRouteError,
94
95
  getOutboxUri: getOutboxUri ?? throwRouteError,
95
96
  getInboxUri: getInboxUri ?? throwRouteError,
96
97
  getFollowingUri: getFollowingUri ?? throwRouteError,
@@ -22,7 +22,7 @@ const logger = getLogger([
22
22
  * https://example.com/#Follow/12345678-1234-5678-1234-567812345678
23
23
  * ```
24
24
  *
25
- * @typeParam TContextData The type of the context data.
25
+ * @template TContextData The type of the context data.
26
26
  * @param activity The activity to assign an ID to.
27
27
  * @param context The context of the activity.
28
28
  * @return The activity with an ID assigned.
@@ -73,7 +73,7 @@ function autoIdAssigner(activity, context) {
73
73
  *
74
74
  * As some ActivityPub implementations like Threads fail to deal with inlined
75
75
  * actor objects, this transformer can be used to work around this issue.
76
- * @typeParam TContextData The type of the context data.
76
+ * @template TContextData The type of the context data.
77
77
  * @param activity The activity to dehydrate the actor property of.
78
78
  * @param context The context of the activity.
79
79
  * @returns The dehydrated activity.
@@ -86,7 +86,7 @@ function actorDehydrator(activity, _context) {
86
86
  /**
87
87
  * Gets the default activity transformers that are applied to all outgoing
88
88
  * activities.
89
- * @typeParam TContextData The type of the context data.
89
+ * @template TContextData The type of the context data.
90
90
  * @returns The default activity transformers.
91
91
  * @since 1.4.0
92
92
  */