@fedify/testing 1.8.14-pr.470.1821 → 1.8.14-pr.470.1832
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.d.ts +43 -18
- package/dist/mod.js +104 -96
- package/package.json +2 -2
package/dist/mod.d.ts
CHANGED
|
@@ -1,12 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TracerProvider } from "@opentelemetry/api";
|
|
2
2
|
import { Activity, Actor, Collection, Hashtag, LookupObjectOptions, Object as Object$1, Recipient, TraverseCollectionOptions } from "@fedify/fedify/vocab";
|
|
3
3
|
import { ResourceDescriptor } from "@fedify/fedify/webfinger";
|
|
4
|
-
import
|
|
4
|
+
import * as _fedify_fedify_federation4 from "@fedify/fedify/federation";
|
|
5
5
|
import { JsonValue, NodeInfo } from "@fedify/fedify/nodeinfo";
|
|
6
6
|
import { DocumentLoader } from "@fedify/fedify/runtime";
|
|
7
7
|
|
|
8
8
|
//#region src/mock.d.ts
|
|
9
|
-
|
|
9
|
+
type ActorCallbackSetters<TContextData> = _fedify_fedify_federation4.ActorCallbackSetters<TContextData>;
|
|
10
|
+
type ActorDispatcher<TContextData> = _fedify_fedify_federation4.ActorDispatcher<TContextData>;
|
|
11
|
+
type ActorKeyPair = _fedify_fedify_federation4.ActorKeyPair;
|
|
12
|
+
type Context$1<TContextData> = _fedify_fedify_federation4.Context<TContextData>;
|
|
13
|
+
type CollectionCallbackSetters<TContext extends Context$1<TContextData>, TContextData, TFilter> = _fedify_fedify_federation4.CollectionCallbackSetters<TContext, TContextData, TFilter>;
|
|
14
|
+
type CollectionDispatcher<TItem, TContext extends Context$1<TContextData>, TContextData, TFilter> = _fedify_fedify_federation4.CollectionDispatcher<TItem, TContext, TContextData, TFilter>;
|
|
15
|
+
type Federation$1<TContextData> = _fedify_fedify_federation4.Federation<TContextData>;
|
|
16
|
+
type FederationFetchOptions<TContextData> = _fedify_fedify_federation4.FederationFetchOptions<TContextData>;
|
|
17
|
+
type FederationStartQueueOptions = _fedify_fedify_federation4.FederationStartQueueOptions;
|
|
18
|
+
type InboxListenerSetters<TContextData> = _fedify_fedify_federation4.InboxListenerSetters<TContextData>;
|
|
19
|
+
type Message = _fedify_fedify_federation4.Message;
|
|
20
|
+
type NodeInfoDispatcher<TContextData> = _fedify_fedify_federation4.NodeInfoDispatcher<TContextData>;
|
|
21
|
+
type ObjectCallbackSetters<TContextData, TObject extends Object$1, TParam extends string> = _fedify_fedify_federation4.ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
22
|
+
type ObjectDispatcher<TContextData, TObject extends Object$1, TParam extends string> = _fedify_fedify_federation4.ObjectDispatcher<TContextData, TObject, TParam>;
|
|
23
|
+
type ParseUriResult = _fedify_fedify_federation4.ParseUriResult;
|
|
24
|
+
type RequestContext$1<TContextData> = _fedify_fedify_federation4.RequestContext<TContextData>;
|
|
25
|
+
type RouteActivityOptions = _fedify_fedify_federation4.RouteActivityOptions;
|
|
26
|
+
type SendActivityOptions = _fedify_fedify_federation4.SendActivityOptions;
|
|
27
|
+
type SendActivityOptionsForCollection = _fedify_fedify_federation4.SendActivityOptionsForCollection;
|
|
28
|
+
type SenderKeyPair = _fedify_fedify_federation4.SenderKeyPair;
|
|
10
29
|
/**
|
|
11
30
|
* Represents a sent activity with metadata about how it was sent.
|
|
12
31
|
* @since 1.8.0
|
|
@@ -54,7 +73,7 @@ interface SentActivity {
|
|
|
54
73
|
* @template TContextData The context data to pass to the {@link Context}.
|
|
55
74
|
* @since 1.8.0
|
|
56
75
|
*/
|
|
57
|
-
declare class MockFederation<TContextData> implements Federation<TContextData> {
|
|
76
|
+
declare class MockFederation<TContextData> implements Federation$1<TContextData> {
|
|
58
77
|
private options;
|
|
59
78
|
sentActivities: SentActivity[];
|
|
60
79
|
queueStarted: boolean;
|
|
@@ -94,18 +113,18 @@ declare class MockFederation<TContextData> implements Federation<TContextData> {
|
|
|
94
113
|
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
|
|
95
114
|
typeId: URL;
|
|
96
115
|
}, path: string, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
|
97
|
-
setInboxDispatcher(_path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
98
|
-
setOutboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
99
|
-
setFollowingDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
100
|
-
setFollowersDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
|
|
101
|
-
setLikedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
102
|
-
setFeaturedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
103
|
-
setFeaturedTagsDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
116
|
+
setInboxDispatcher(_path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext$1<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext$1<TContextData>, TContextData, void>;
|
|
117
|
+
setOutboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext$1<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext$1<TContextData>, TContextData, void>;
|
|
118
|
+
setFollowingDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext$1<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext$1<TContextData>, TContextData, void>;
|
|
119
|
+
setFollowersDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Recipient, Context$1<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context$1<TContextData>, TContextData, URL>;
|
|
120
|
+
setLikedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext$1<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext$1<TContextData>, TContextData, void>;
|
|
121
|
+
setFeaturedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext$1<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext$1<TContextData>, TContextData, void>;
|
|
122
|
+
setFeaturedTagsDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext$1<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext$1<TContextData>, TContextData, void>;
|
|
104
123
|
setInboxListeners(inboxPath: `${string}{identifier}${string}` | `${string}{handle}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
|
|
105
124
|
startQueue(contextData: TContextData, options?: FederationStartQueueOptions): Promise<void>;
|
|
106
125
|
processQueuedTask(contextData: TContextData, _message: Message): Promise<void>;
|
|
107
|
-
createContext(baseUrl: URL, contextData: TContextData): Context<TContextData>;
|
|
108
|
-
createContext(request: Request, contextData: TContextData): RequestContext<TContextData>;
|
|
126
|
+
createContext(baseUrl: URL, contextData: TContextData): Context$1<TContextData>;
|
|
127
|
+
createContext(request: Request, contextData: TContextData): RequestContext$1<TContextData>;
|
|
109
128
|
fetch(request: Request, options: FederationFetchOptions<TContextData>): Promise<Response>;
|
|
110
129
|
/**
|
|
111
130
|
* Simulates receiving an activity. This method is specific to the mock
|
|
@@ -165,13 +184,13 @@ declare class MockFederation<TContextData> implements Federation<TContextData> {
|
|
|
165
184
|
* @template TContextData The context data to pass to the {@link Context}.
|
|
166
185
|
* @since 1.8.0
|
|
167
186
|
*/
|
|
168
|
-
declare class MockContext<TContextData> implements Context<TContextData> {
|
|
187
|
+
declare class MockContext<TContextData> implements Context$1<TContextData> {
|
|
169
188
|
readonly origin: string;
|
|
170
189
|
readonly canonicalOrigin: string;
|
|
171
190
|
readonly host: string;
|
|
172
191
|
readonly hostname: string;
|
|
173
192
|
readonly data: TContextData;
|
|
174
|
-
readonly federation: Federation<TContextData>;
|
|
193
|
+
readonly federation: Federation$1<TContextData>;
|
|
175
194
|
readonly documentLoader: DocumentLoader;
|
|
176
195
|
readonly contextLoader: DocumentLoader;
|
|
177
196
|
readonly tracerProvider: TracerProvider;
|
|
@@ -179,12 +198,12 @@ declare class MockContext<TContextData> implements Context<TContextData> {
|
|
|
179
198
|
constructor(options: {
|
|
180
199
|
url?: URL;
|
|
181
200
|
data: TContextData;
|
|
182
|
-
federation: Federation<TContextData>;
|
|
201
|
+
federation: Federation$1<TContextData>;
|
|
183
202
|
documentLoader?: DocumentLoader;
|
|
184
203
|
contextLoader?: DocumentLoader;
|
|
185
204
|
tracerProvider?: TracerProvider;
|
|
186
205
|
});
|
|
187
|
-
clone(data: TContextData): Context<TContextData>;
|
|
206
|
+
clone(data: TContextData): Context$1<TContextData>;
|
|
188
207
|
getNodeInfoUri(): URL;
|
|
189
208
|
getActorUri(identifier: string): URL;
|
|
190
209
|
getObjectUri<TObject extends Object$1>(cls: (new (...args: any[]) => TObject) & {
|
|
@@ -211,7 +230,7 @@ declare class MockContext<TContextData> implements Context<TContextData> {
|
|
|
211
230
|
privateKey: CryptoKey;
|
|
212
231
|
}): DocumentLoader;
|
|
213
232
|
lookupObject(_uri: URL | string, _options?: LookupObjectOptions): Promise<Object$1 | null>;
|
|
214
|
-
traverseCollection<TItem, TContext extends Context<TContextData>>(_collection: Collection | URL | null, _options?: TraverseCollectionOptions): AsyncIterable<TItem>;
|
|
233
|
+
traverseCollection<TItem, TContext extends Context$1<TContextData>>(_collection: Collection | URL | null, _options?: TraverseCollectionOptions): AsyncIterable<TItem>;
|
|
215
234
|
lookupNodeInfo(url: URL | string, options?: {
|
|
216
235
|
parse?: "strict" | "best-effort";
|
|
217
236
|
} & any): Promise<NodeInfo | undefined>;
|
|
@@ -273,6 +292,12 @@ declare class MockContext<TContextData> implements Context<TContextData> {
|
|
|
273
292
|
*/
|
|
274
293
|
reset(): void;
|
|
275
294
|
}
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/context.d.ts
|
|
297
|
+
type Context<TContextData> = _fedify_fedify_federation4.Context<TContextData>;
|
|
298
|
+
type Federation<TContextData> = _fedify_fedify_federation4.Federation<TContextData>;
|
|
299
|
+
type InboxContext<TContextData> = _fedify_fedify_federation4.InboxContext<TContextData>;
|
|
300
|
+
type RequestContext<TContextData> = _fedify_fedify_federation4.RequestContext<TContextData>;
|
|
276
301
|
declare function createContext<TContextData>(values: Partial<Context<TContextData>> & {
|
|
277
302
|
url?: URL;
|
|
278
303
|
data: TContextData;
|
package/dist/mod.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { trace } from "@opentelemetry/api";
|
|
2
2
|
import { lookupObject, traverseCollection } from "@fedify/fedify/vocab";
|
|
3
3
|
import { lookupWebFinger } from "@fedify/fedify/webfinger";
|
|
4
|
-
import { trace } from "@opentelemetry/api";
|
|
5
4
|
|
|
6
5
|
//#region src/docloader.ts
|
|
7
6
|
const mockDocumentLoader = async (url) => ({
|
|
@@ -10,6 +9,109 @@ const mockDocumentLoader = async (url) => ({
|
|
|
10
9
|
documentUrl: url
|
|
11
10
|
});
|
|
12
11
|
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/context.ts
|
|
14
|
+
var RouterError = class extends Error {
|
|
15
|
+
constructor(message) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.name = "RouterError";
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
function createContext(values) {
|
|
21
|
+
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;
|
|
22
|
+
function throwRouteError() {
|
|
23
|
+
throw new RouterError("Not implemented");
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
federation,
|
|
27
|
+
data,
|
|
28
|
+
origin: url.origin,
|
|
29
|
+
canonicalOrigin: canonicalOrigin ?? url.origin,
|
|
30
|
+
host: url.host,
|
|
31
|
+
hostname: url.hostname,
|
|
32
|
+
documentLoader: documentLoader ?? mockDocumentLoader,
|
|
33
|
+
contextLoader: contextLoader ?? mockDocumentLoader,
|
|
34
|
+
tracerProvider: tracerProvider ?? trace.getTracerProvider(),
|
|
35
|
+
clone: clone ?? ((data$1) => createContext({
|
|
36
|
+
...values,
|
|
37
|
+
data: data$1
|
|
38
|
+
})),
|
|
39
|
+
getNodeInfoUri: getNodeInfoUri ?? throwRouteError,
|
|
40
|
+
getActorUri: getActorUri ?? throwRouteError,
|
|
41
|
+
getObjectUri: getObjectUri ?? throwRouteError,
|
|
42
|
+
getCollectionUri: getCollectionUri ?? throwRouteError,
|
|
43
|
+
getOutboxUri: getOutboxUri ?? throwRouteError,
|
|
44
|
+
getInboxUri: getInboxUri ?? throwRouteError,
|
|
45
|
+
getFollowingUri: getFollowingUri ?? throwRouteError,
|
|
46
|
+
getFollowersUri: getFollowersUri ?? throwRouteError,
|
|
47
|
+
getLikedUri: getLikedUri ?? throwRouteError,
|
|
48
|
+
getFeaturedUri: getFeaturedUri ?? throwRouteError,
|
|
49
|
+
getFeaturedTagsUri: getFeaturedTagsUri ?? throwRouteError,
|
|
50
|
+
parseUri: parseUri ?? ((_uri) => {
|
|
51
|
+
throw new Error("Not implemented");
|
|
52
|
+
}),
|
|
53
|
+
getDocumentLoader: getDocumentLoader ?? ((_params) => {
|
|
54
|
+
throw new Error("Not implemented");
|
|
55
|
+
}),
|
|
56
|
+
getActorKeyPairs: getActorKeyPairs ?? ((_handle) => Promise.resolve([])),
|
|
57
|
+
lookupObject: lookupObject$1 ?? ((uri, options = {}) => {
|
|
58
|
+
return lookupObject(uri, {
|
|
59
|
+
documentLoader: options.documentLoader ?? documentLoader ?? mockDocumentLoader,
|
|
60
|
+
contextLoader: options.contextLoader ?? contextLoader ?? mockDocumentLoader
|
|
61
|
+
});
|
|
62
|
+
}),
|
|
63
|
+
traverseCollection: traverseCollection$1 ?? ((collection, options = {}) => {
|
|
64
|
+
return traverseCollection(collection, {
|
|
65
|
+
documentLoader: options.documentLoader ?? documentLoader ?? mockDocumentLoader,
|
|
66
|
+
contextLoader: options.contextLoader ?? contextLoader ?? mockDocumentLoader
|
|
67
|
+
});
|
|
68
|
+
}),
|
|
69
|
+
lookupNodeInfo: lookupNodeInfo ?? ((_params) => {
|
|
70
|
+
throw new Error("Not implemented");
|
|
71
|
+
}),
|
|
72
|
+
lookupWebFinger: lookupWebFinger$1 ?? ((resource, options = {}) => {
|
|
73
|
+
return lookupWebFinger(resource, options);
|
|
74
|
+
}),
|
|
75
|
+
sendActivity: sendActivity ?? ((_params) => {
|
|
76
|
+
throw new Error("Not implemented");
|
|
77
|
+
}),
|
|
78
|
+
routeActivity: routeActivity ?? ((_params) => {
|
|
79
|
+
throw new Error("Not implemented");
|
|
80
|
+
})
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function createRequestContext(args) {
|
|
84
|
+
return {
|
|
85
|
+
...createContext(args),
|
|
86
|
+
clone: args.clone ?? ((data) => createRequestContext({
|
|
87
|
+
...args,
|
|
88
|
+
data
|
|
89
|
+
})),
|
|
90
|
+
request: args.request ?? new Request(args.url),
|
|
91
|
+
url: args.url,
|
|
92
|
+
getActor: args.getActor ?? (() => Promise.resolve(null)),
|
|
93
|
+
getObject: args.getObject ?? (() => Promise.resolve(null)),
|
|
94
|
+
getSignedKey: args.getSignedKey ?? (() => Promise.resolve(null)),
|
|
95
|
+
getSignedKeyOwner: args.getSignedKeyOwner ?? (() => Promise.resolve(null)),
|
|
96
|
+
sendActivity: args.sendActivity ?? ((_params) => {
|
|
97
|
+
throw new Error("Not implemented");
|
|
98
|
+
})
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function createInboxContext(args) {
|
|
102
|
+
return {
|
|
103
|
+
...createContext(args),
|
|
104
|
+
clone: args.clone ?? ((data) => createInboxContext({
|
|
105
|
+
...args,
|
|
106
|
+
data
|
|
107
|
+
})),
|
|
108
|
+
recipient: args.recipient ?? null,
|
|
109
|
+
forwardActivity: args.forwardActivity ?? ((_params) => {
|
|
110
|
+
throw new Error("Not implemented");
|
|
111
|
+
})
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
13
115
|
//#endregion
|
|
14
116
|
//#region src/mock.ts
|
|
15
117
|
/**
|
|
@@ -531,100 +633,6 @@ var MockContext = class MockContext {
|
|
|
531
633
|
this.sentActivities = [];
|
|
532
634
|
}
|
|
533
635
|
};
|
|
534
|
-
function createContext(values) {
|
|
535
|
-
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;
|
|
536
|
-
function throwRouteError() {
|
|
537
|
-
throw new RouterError("Not implemented");
|
|
538
|
-
}
|
|
539
|
-
return {
|
|
540
|
-
federation,
|
|
541
|
-
data,
|
|
542
|
-
origin: url.origin,
|
|
543
|
-
canonicalOrigin: canonicalOrigin ?? url.origin,
|
|
544
|
-
host: url.host,
|
|
545
|
-
hostname: url.hostname,
|
|
546
|
-
documentLoader: documentLoader ?? mockDocumentLoader,
|
|
547
|
-
contextLoader: contextLoader ?? mockDocumentLoader,
|
|
548
|
-
tracerProvider: tracerProvider ?? trace.getTracerProvider(),
|
|
549
|
-
clone: clone ?? ((data$1) => createContext({
|
|
550
|
-
...values,
|
|
551
|
-
data: data$1
|
|
552
|
-
})),
|
|
553
|
-
getNodeInfoUri: getNodeInfoUri ?? throwRouteError,
|
|
554
|
-
getActorUri: getActorUri ?? throwRouteError,
|
|
555
|
-
getObjectUri: getObjectUri ?? throwRouteError,
|
|
556
|
-
getCollectionUri: getCollectionUri ?? throwRouteError,
|
|
557
|
-
getOutboxUri: getOutboxUri ?? throwRouteError,
|
|
558
|
-
getInboxUri: getInboxUri ?? throwRouteError,
|
|
559
|
-
getFollowingUri: getFollowingUri ?? throwRouteError,
|
|
560
|
-
getFollowersUri: getFollowersUri ?? throwRouteError,
|
|
561
|
-
getLikedUri: getLikedUri ?? throwRouteError,
|
|
562
|
-
getFeaturedUri: getFeaturedUri ?? throwRouteError,
|
|
563
|
-
getFeaturedTagsUri: getFeaturedTagsUri ?? throwRouteError,
|
|
564
|
-
parseUri: parseUri ?? ((_uri) => {
|
|
565
|
-
throw new Error("Not implemented");
|
|
566
|
-
}),
|
|
567
|
-
getDocumentLoader: getDocumentLoader ?? ((_params) => {
|
|
568
|
-
throw new Error("Not implemented");
|
|
569
|
-
}),
|
|
570
|
-
getActorKeyPairs: getActorKeyPairs ?? ((_handle) => Promise.resolve([])),
|
|
571
|
-
lookupObject: lookupObject$1 ?? ((uri, options = {}) => {
|
|
572
|
-
return lookupObject(uri, {
|
|
573
|
-
documentLoader: options.documentLoader ?? documentLoader ?? mockDocumentLoader,
|
|
574
|
-
contextLoader: options.contextLoader ?? contextLoader ?? mockDocumentLoader
|
|
575
|
-
});
|
|
576
|
-
}),
|
|
577
|
-
traverseCollection: traverseCollection$1 ?? ((collection, options = {}) => {
|
|
578
|
-
return traverseCollection(collection, {
|
|
579
|
-
documentLoader: options.documentLoader ?? documentLoader ?? mockDocumentLoader,
|
|
580
|
-
contextLoader: options.contextLoader ?? contextLoader ?? mockDocumentLoader
|
|
581
|
-
});
|
|
582
|
-
}),
|
|
583
|
-
lookupNodeInfo: lookupNodeInfo ?? ((_params) => {
|
|
584
|
-
throw new Error("Not implemented");
|
|
585
|
-
}),
|
|
586
|
-
lookupWebFinger: lookupWebFinger$1 ?? ((resource, options = {}) => {
|
|
587
|
-
return lookupWebFinger(resource, options);
|
|
588
|
-
}),
|
|
589
|
-
sendActivity: sendActivity ?? ((_params) => {
|
|
590
|
-
throw new Error("Not implemented");
|
|
591
|
-
}),
|
|
592
|
-
routeActivity: routeActivity ?? ((_params) => {
|
|
593
|
-
throw new Error("Not implemented");
|
|
594
|
-
})
|
|
595
|
-
};
|
|
596
|
-
}
|
|
597
|
-
function createRequestContext(args) {
|
|
598
|
-
return {
|
|
599
|
-
...createContext(args),
|
|
600
|
-
clone: args.clone ?? ((data) => createRequestContext({
|
|
601
|
-
...args,
|
|
602
|
-
data
|
|
603
|
-
})),
|
|
604
|
-
request: args.request ?? new Request(args.url),
|
|
605
|
-
url: args.url,
|
|
606
|
-
getActor: args.getActor ?? (() => Promise.resolve(null)),
|
|
607
|
-
getObject: args.getObject ?? (() => Promise.resolve(null)),
|
|
608
|
-
getSignedKey: args.getSignedKey ?? (() => Promise.resolve(null)),
|
|
609
|
-
getSignedKeyOwner: args.getSignedKeyOwner ?? (() => Promise.resolve(null)),
|
|
610
|
-
sendActivity: args.sendActivity ?? ((_params) => {
|
|
611
|
-
throw new Error("Not implemented");
|
|
612
|
-
})
|
|
613
|
-
};
|
|
614
|
-
}
|
|
615
|
-
function createInboxContext(args) {
|
|
616
|
-
return {
|
|
617
|
-
...createContext(args),
|
|
618
|
-
clone: args.clone ?? ((data) => createInboxContext({
|
|
619
|
-
...args,
|
|
620
|
-
data
|
|
621
|
-
})),
|
|
622
|
-
recipient: args.recipient ?? null,
|
|
623
|
-
forwardActivity: args.forwardActivity ?? ((_params) => {
|
|
624
|
-
throw new Error("Not implemented");
|
|
625
|
-
})
|
|
626
|
-
};
|
|
627
|
-
}
|
|
628
636
|
|
|
629
637
|
//#endregion
|
|
630
638
|
export { MockContext, MockFederation, createContext, createInboxContext, createRequestContext };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/testing",
|
|
3
|
-
"version": "1.8.14-pr.470.
|
|
3
|
+
"version": "1.8.14-pr.470.1832+cbd179b1",
|
|
4
4
|
"description": "Testing utilities for Fedify applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fedify",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"package.json"
|
|
46
46
|
],
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@fedify/fedify": "^1.8.14-pr.470.
|
|
48
|
+
"@fedify/fedify": "^1.8.14-pr.470.1832+cbd179b1"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@opentelemetry/api": "^1.9.0"
|