@fedify/fedify 0.10.0-dev.221 → 0.11.0-dev.223
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGES.md +23 -1
- package/README.md +1 -1
- package/esm/runtime/contexts.js +629 -0
- package/esm/runtime/docloader.js +17 -5
- package/package.json +1 -1
- package/types/runtime/contexts.d.ts +3 -0
- package/types/runtime/contexts.d.ts.map +1 -0
- package/types/runtime/docloader.d.ts +9 -5
- package/types/runtime/docloader.d.ts.map +1 -1
package/CHANGES.md
CHANGED
@@ -3,11 +3,33 @@
|
|
3
3
|
Fedify changelog
|
4
4
|
================
|
5
5
|
|
6
|
-
Version 0.
|
6
|
+
Version 0.11.0
|
7
7
|
--------------
|
8
8
|
|
9
9
|
To be released.
|
10
10
|
|
11
|
+
- Frequently used JSON-LD contexts are now preloaded. [[74]]
|
12
|
+
|
13
|
+
- The `fetchDocumentLoader()` function now preloads the following JSON-LD
|
14
|
+
contexts:
|
15
|
+
|
16
|
+
- <https://www.w3.org/ns/activitystreams>
|
17
|
+
- <https://w3id.org/security/v1>
|
18
|
+
- <https://w3id.org/security/data-integrity/v1>
|
19
|
+
- <https://www.w3.org/ns/did/v1>
|
20
|
+
- <https://w3id.org/security/multikey/v1>
|
21
|
+
|
22
|
+
- The default `rules` for `kvCache()` function are now 5 minutes for all
|
23
|
+
URLs.
|
24
|
+
|
25
|
+
[#74]: https://github.com/dahlia/fedify/issues/74
|
26
|
+
|
27
|
+
|
28
|
+
Version 0.10.0
|
29
|
+
--------------
|
30
|
+
|
31
|
+
Released on June 18, 2024.
|
32
|
+
|
11
33
|
Starting with this release, Fedify, previously distributed under [AGPL 3.0],
|
12
34
|
is now distributed under the [MIT License] to encourage wider adoption.
|
13
35
|
|
package/README.md
CHANGED
@@ -0,0 +1,629 @@
|
|
1
|
+
// Preloaded context documents
|
2
|
+
// https://github.com/dahlia/fedify/issues/74
|
3
|
+
// cSpell: disable
|
4
|
+
const preloadedContexts = {
|
5
|
+
"https://www.w3.org/ns/activitystreams": {
|
6
|
+
"@context": {
|
7
|
+
"@vocab": "_:",
|
8
|
+
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
9
|
+
"as": "https://www.w3.org/ns/activitystreams#",
|
10
|
+
"ldp": "http://www.w3.org/ns/ldp#",
|
11
|
+
"vcard": "http://www.w3.org/2006/vcard/ns#",
|
12
|
+
"id": "@id",
|
13
|
+
"type": "@type",
|
14
|
+
"Accept": "as:Accept",
|
15
|
+
"Activity": "as:Activity",
|
16
|
+
"IntransitiveActivity": "as:IntransitiveActivity",
|
17
|
+
"Add": "as:Add",
|
18
|
+
"Announce": "as:Announce",
|
19
|
+
"Application": "as:Application",
|
20
|
+
"Arrive": "as:Arrive",
|
21
|
+
"Article": "as:Article",
|
22
|
+
"Audio": "as:Audio",
|
23
|
+
"Block": "as:Block",
|
24
|
+
"Collection": "as:Collection",
|
25
|
+
"CollectionPage": "as:CollectionPage",
|
26
|
+
"Relationship": "as:Relationship",
|
27
|
+
"Create": "as:Create",
|
28
|
+
"Delete": "as:Delete",
|
29
|
+
"Dislike": "as:Dislike",
|
30
|
+
"Document": "as:Document",
|
31
|
+
"Event": "as:Event",
|
32
|
+
"Follow": "as:Follow",
|
33
|
+
"Flag": "as:Flag",
|
34
|
+
"Group": "as:Group",
|
35
|
+
"Ignore": "as:Ignore",
|
36
|
+
"Image": "as:Image",
|
37
|
+
"Invite": "as:Invite",
|
38
|
+
"Join": "as:Join",
|
39
|
+
"Leave": "as:Leave",
|
40
|
+
"Like": "as:Like",
|
41
|
+
"Link": "as:Link",
|
42
|
+
"Mention": "as:Mention",
|
43
|
+
"Note": "as:Note",
|
44
|
+
"Object": "as:Object",
|
45
|
+
"Offer": "as:Offer",
|
46
|
+
"OrderedCollection": "as:OrderedCollection",
|
47
|
+
"OrderedCollectionPage": "as:OrderedCollectionPage",
|
48
|
+
"Organization": "as:Organization",
|
49
|
+
"Page": "as:Page",
|
50
|
+
"Person": "as:Person",
|
51
|
+
"Place": "as:Place",
|
52
|
+
"Profile": "as:Profile",
|
53
|
+
"Question": "as:Question",
|
54
|
+
"Reject": "as:Reject",
|
55
|
+
"Remove": "as:Remove",
|
56
|
+
"Service": "as:Service",
|
57
|
+
"TentativeAccept": "as:TentativeAccept",
|
58
|
+
"TentativeReject": "as:TentativeReject",
|
59
|
+
"Tombstone": "as:Tombstone",
|
60
|
+
"Undo": "as:Undo",
|
61
|
+
"Update": "as:Update",
|
62
|
+
"Video": "as:Video",
|
63
|
+
"View": "as:View",
|
64
|
+
"Listen": "as:Listen",
|
65
|
+
"Read": "as:Read",
|
66
|
+
"Move": "as:Move",
|
67
|
+
"Travel": "as:Travel",
|
68
|
+
"IsFollowing": "as:IsFollowing",
|
69
|
+
"IsFollowedBy": "as:IsFollowedBy",
|
70
|
+
"IsContact": "as:IsContact",
|
71
|
+
"IsMember": "as:IsMember",
|
72
|
+
"subject": {
|
73
|
+
"@id": "as:subject",
|
74
|
+
"@type": "@id",
|
75
|
+
},
|
76
|
+
"relationship": {
|
77
|
+
"@id": "as:relationship",
|
78
|
+
"@type": "@id",
|
79
|
+
},
|
80
|
+
"actor": {
|
81
|
+
"@id": "as:actor",
|
82
|
+
"@type": "@id",
|
83
|
+
},
|
84
|
+
"attributedTo": {
|
85
|
+
"@id": "as:attributedTo",
|
86
|
+
"@type": "@id",
|
87
|
+
},
|
88
|
+
"attachment": {
|
89
|
+
"@id": "as:attachment",
|
90
|
+
"@type": "@id",
|
91
|
+
},
|
92
|
+
"bcc": {
|
93
|
+
"@id": "as:bcc",
|
94
|
+
"@type": "@id",
|
95
|
+
},
|
96
|
+
"bto": {
|
97
|
+
"@id": "as:bto",
|
98
|
+
"@type": "@id",
|
99
|
+
},
|
100
|
+
"cc": {
|
101
|
+
"@id": "as:cc",
|
102
|
+
"@type": "@id",
|
103
|
+
},
|
104
|
+
"context": {
|
105
|
+
"@id": "as:context",
|
106
|
+
"@type": "@id",
|
107
|
+
},
|
108
|
+
"current": {
|
109
|
+
"@id": "as:current",
|
110
|
+
"@type": "@id",
|
111
|
+
},
|
112
|
+
"first": {
|
113
|
+
"@id": "as:first",
|
114
|
+
"@type": "@id",
|
115
|
+
},
|
116
|
+
"generator": {
|
117
|
+
"@id": "as:generator",
|
118
|
+
"@type": "@id",
|
119
|
+
},
|
120
|
+
"icon": {
|
121
|
+
"@id": "as:icon",
|
122
|
+
"@type": "@id",
|
123
|
+
},
|
124
|
+
"image": {
|
125
|
+
"@id": "as:image",
|
126
|
+
"@type": "@id",
|
127
|
+
},
|
128
|
+
"inReplyTo": {
|
129
|
+
"@id": "as:inReplyTo",
|
130
|
+
"@type": "@id",
|
131
|
+
},
|
132
|
+
"items": {
|
133
|
+
"@id": "as:items",
|
134
|
+
"@type": "@id",
|
135
|
+
},
|
136
|
+
"instrument": {
|
137
|
+
"@id": "as:instrument",
|
138
|
+
"@type": "@id",
|
139
|
+
},
|
140
|
+
"orderedItems": {
|
141
|
+
"@id": "as:items",
|
142
|
+
"@type": "@id",
|
143
|
+
"@container": "@list",
|
144
|
+
},
|
145
|
+
"last": {
|
146
|
+
"@id": "as:last",
|
147
|
+
"@type": "@id",
|
148
|
+
},
|
149
|
+
"location": {
|
150
|
+
"@id": "as:location",
|
151
|
+
"@type": "@id",
|
152
|
+
},
|
153
|
+
"next": {
|
154
|
+
"@id": "as:next",
|
155
|
+
"@type": "@id",
|
156
|
+
},
|
157
|
+
"object": {
|
158
|
+
"@id": "as:object",
|
159
|
+
"@type": "@id",
|
160
|
+
},
|
161
|
+
"oneOf": {
|
162
|
+
"@id": "as:oneOf",
|
163
|
+
"@type": "@id",
|
164
|
+
},
|
165
|
+
"anyOf": {
|
166
|
+
"@id": "as:anyOf",
|
167
|
+
"@type": "@id",
|
168
|
+
},
|
169
|
+
"closed": {
|
170
|
+
"@id": "as:closed",
|
171
|
+
"@type": "xsd:dateTime",
|
172
|
+
},
|
173
|
+
"origin": {
|
174
|
+
"@id": "as:origin",
|
175
|
+
"@type": "@id",
|
176
|
+
},
|
177
|
+
"accuracy": {
|
178
|
+
"@id": "as:accuracy",
|
179
|
+
"@type": "xsd:float",
|
180
|
+
},
|
181
|
+
"prev": {
|
182
|
+
"@id": "as:prev",
|
183
|
+
"@type": "@id",
|
184
|
+
},
|
185
|
+
"preview": {
|
186
|
+
"@id": "as:preview",
|
187
|
+
"@type": "@id",
|
188
|
+
},
|
189
|
+
"replies": {
|
190
|
+
"@id": "as:replies",
|
191
|
+
"@type": "@id",
|
192
|
+
},
|
193
|
+
"result": {
|
194
|
+
"@id": "as:result",
|
195
|
+
"@type": "@id",
|
196
|
+
},
|
197
|
+
"audience": {
|
198
|
+
"@id": "as:audience",
|
199
|
+
"@type": "@id",
|
200
|
+
},
|
201
|
+
"partOf": {
|
202
|
+
"@id": "as:partOf",
|
203
|
+
"@type": "@id",
|
204
|
+
},
|
205
|
+
"tag": {
|
206
|
+
"@id": "as:tag",
|
207
|
+
"@type": "@id",
|
208
|
+
},
|
209
|
+
"target": {
|
210
|
+
"@id": "as:target",
|
211
|
+
"@type": "@id",
|
212
|
+
},
|
213
|
+
"to": {
|
214
|
+
"@id": "as:to",
|
215
|
+
"@type": "@id",
|
216
|
+
},
|
217
|
+
"url": {
|
218
|
+
"@id": "as:url",
|
219
|
+
"@type": "@id",
|
220
|
+
},
|
221
|
+
"altitude": {
|
222
|
+
"@id": "as:altitude",
|
223
|
+
"@type": "xsd:float",
|
224
|
+
},
|
225
|
+
"content": "as:content",
|
226
|
+
"contentMap": {
|
227
|
+
"@id": "as:content",
|
228
|
+
"@container": "@language",
|
229
|
+
},
|
230
|
+
"name": "as:name",
|
231
|
+
"nameMap": {
|
232
|
+
"@id": "as:name",
|
233
|
+
"@container": "@language",
|
234
|
+
},
|
235
|
+
"duration": {
|
236
|
+
"@id": "as:duration",
|
237
|
+
"@type": "xsd:duration",
|
238
|
+
},
|
239
|
+
"endTime": {
|
240
|
+
"@id": "as:endTime",
|
241
|
+
"@type": "xsd:dateTime",
|
242
|
+
},
|
243
|
+
"height": {
|
244
|
+
"@id": "as:height",
|
245
|
+
"@type": "xsd:nonNegativeInteger",
|
246
|
+
},
|
247
|
+
"href": {
|
248
|
+
"@id": "as:href",
|
249
|
+
"@type": "@id",
|
250
|
+
},
|
251
|
+
"hreflang": "as:hreflang",
|
252
|
+
"latitude": {
|
253
|
+
"@id": "as:latitude",
|
254
|
+
"@type": "xsd:float",
|
255
|
+
},
|
256
|
+
"longitude": {
|
257
|
+
"@id": "as:longitude",
|
258
|
+
"@type": "xsd:float",
|
259
|
+
},
|
260
|
+
"mediaType": "as:mediaType",
|
261
|
+
"published": {
|
262
|
+
"@id": "as:published",
|
263
|
+
"@type": "xsd:dateTime",
|
264
|
+
},
|
265
|
+
"radius": {
|
266
|
+
"@id": "as:radius",
|
267
|
+
"@type": "xsd:float",
|
268
|
+
},
|
269
|
+
"rel": "as:rel",
|
270
|
+
"startIndex": {
|
271
|
+
"@id": "as:startIndex",
|
272
|
+
"@type": "xsd:nonNegativeInteger",
|
273
|
+
},
|
274
|
+
"startTime": {
|
275
|
+
"@id": "as:startTime",
|
276
|
+
"@type": "xsd:dateTime",
|
277
|
+
},
|
278
|
+
"summary": "as:summary",
|
279
|
+
"summaryMap": {
|
280
|
+
"@id": "as:summary",
|
281
|
+
"@container": "@language",
|
282
|
+
},
|
283
|
+
"totalItems": {
|
284
|
+
"@id": "as:totalItems",
|
285
|
+
"@type": "xsd:nonNegativeInteger",
|
286
|
+
},
|
287
|
+
"units": "as:units",
|
288
|
+
"updated": {
|
289
|
+
"@id": "as:updated",
|
290
|
+
"@type": "xsd:dateTime",
|
291
|
+
},
|
292
|
+
"width": {
|
293
|
+
"@id": "as:width",
|
294
|
+
"@type": "xsd:nonNegativeInteger",
|
295
|
+
},
|
296
|
+
"describes": {
|
297
|
+
"@id": "as:describes",
|
298
|
+
"@type": "@id",
|
299
|
+
},
|
300
|
+
"formerType": {
|
301
|
+
"@id": "as:formerType",
|
302
|
+
"@type": "@id",
|
303
|
+
},
|
304
|
+
"deleted": {
|
305
|
+
"@id": "as:deleted",
|
306
|
+
"@type": "xsd:dateTime",
|
307
|
+
},
|
308
|
+
"inbox": {
|
309
|
+
"@id": "ldp:inbox",
|
310
|
+
"@type": "@id",
|
311
|
+
},
|
312
|
+
"outbox": {
|
313
|
+
"@id": "as:outbox",
|
314
|
+
"@type": "@id",
|
315
|
+
},
|
316
|
+
"following": {
|
317
|
+
"@id": "as:following",
|
318
|
+
"@type": "@id",
|
319
|
+
},
|
320
|
+
"followers": {
|
321
|
+
"@id": "as:followers",
|
322
|
+
"@type": "@id",
|
323
|
+
},
|
324
|
+
"streams": {
|
325
|
+
"@id": "as:streams",
|
326
|
+
"@type": "@id",
|
327
|
+
},
|
328
|
+
"preferredUsername": "as:preferredUsername",
|
329
|
+
"endpoints": {
|
330
|
+
"@id": "as:endpoints",
|
331
|
+
"@type": "@id",
|
332
|
+
},
|
333
|
+
"uploadMedia": {
|
334
|
+
"@id": "as:uploadMedia",
|
335
|
+
"@type": "@id",
|
336
|
+
},
|
337
|
+
"proxyUrl": {
|
338
|
+
"@id": "as:proxyUrl",
|
339
|
+
"@type": "@id",
|
340
|
+
},
|
341
|
+
"liked": {
|
342
|
+
"@id": "as:liked",
|
343
|
+
"@type": "@id",
|
344
|
+
},
|
345
|
+
"oauthAuthorizationEndpoint": {
|
346
|
+
"@id": "as:oauthAuthorizationEndpoint",
|
347
|
+
"@type": "@id",
|
348
|
+
},
|
349
|
+
"oauthTokenEndpoint": {
|
350
|
+
"@id": "as:oauthTokenEndpoint",
|
351
|
+
"@type": "@id",
|
352
|
+
},
|
353
|
+
"provideClientKey": {
|
354
|
+
"@id": "as:provideClientKey",
|
355
|
+
"@type": "@id",
|
356
|
+
},
|
357
|
+
"signClientKey": {
|
358
|
+
"@id": "as:signClientKey",
|
359
|
+
"@type": "@id",
|
360
|
+
},
|
361
|
+
"sharedInbox": {
|
362
|
+
"@id": "as:sharedInbox",
|
363
|
+
"@type": "@id",
|
364
|
+
},
|
365
|
+
"Public": {
|
366
|
+
"@id": "as:Public",
|
367
|
+
"@type": "@id",
|
368
|
+
},
|
369
|
+
"source": "as:source",
|
370
|
+
"likes": {
|
371
|
+
"@id": "as:likes",
|
372
|
+
"@type": "@id",
|
373
|
+
},
|
374
|
+
"shares": {
|
375
|
+
"@id": "as:shares",
|
376
|
+
"@type": "@id",
|
377
|
+
},
|
378
|
+
"alsoKnownAs": {
|
379
|
+
"@id": "as:alsoKnownAs",
|
380
|
+
"@type": "@id",
|
381
|
+
},
|
382
|
+
},
|
383
|
+
},
|
384
|
+
"https://w3id.org/security/v1": {
|
385
|
+
"@context": {
|
386
|
+
"id": "@id",
|
387
|
+
"type": "@type",
|
388
|
+
"dc": "http://purl.org/dc/terms/",
|
389
|
+
"sec": "https://w3id.org/security#",
|
390
|
+
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
391
|
+
"EcdsaKoblitzSignature2016": "sec:EcdsaKoblitzSignature2016",
|
392
|
+
"Ed25519Signature2018": "sec:Ed25519Signature2018",
|
393
|
+
"EncryptedMessage": "sec:EncryptedMessage",
|
394
|
+
"GraphSignature2012": "sec:GraphSignature2012",
|
395
|
+
"LinkedDataSignature2015": "sec:LinkedDataSignature2015",
|
396
|
+
"LinkedDataSignature2016": "sec:LinkedDataSignature2016",
|
397
|
+
"CryptographicKey": "sec:Key",
|
398
|
+
"authenticationTag": "sec:authenticationTag",
|
399
|
+
"canonicalizationAlgorithm": "sec:canonicalizationAlgorithm",
|
400
|
+
"cipherAlgorithm": "sec:cipherAlgorithm",
|
401
|
+
"cipherData": "sec:cipherData",
|
402
|
+
"cipherKey": "sec:cipherKey",
|
403
|
+
"created": {
|
404
|
+
"@id": "dc:created",
|
405
|
+
"@type": "xsd:dateTime",
|
406
|
+
},
|
407
|
+
"creator": {
|
408
|
+
"@id": "dc:creator",
|
409
|
+
"@type": "@id",
|
410
|
+
},
|
411
|
+
"digestAlgorithm": "sec:digestAlgorithm",
|
412
|
+
"digestValue": "sec:digestValue",
|
413
|
+
"domain": "sec:domain",
|
414
|
+
"encryptionKey": "sec:encryptionKey",
|
415
|
+
"expiration": {
|
416
|
+
"@id": "sec:expiration",
|
417
|
+
"@type": "xsd:dateTime",
|
418
|
+
},
|
419
|
+
"expires": {
|
420
|
+
"@id": "sec:expiration",
|
421
|
+
"@type": "xsd:dateTime",
|
422
|
+
},
|
423
|
+
"initializationVector": "sec:initializationVector",
|
424
|
+
"iterationCount": "sec:iterationCount",
|
425
|
+
"nonce": "sec:nonce",
|
426
|
+
"normalizationAlgorithm": "sec:normalizationAlgorithm",
|
427
|
+
"owner": {
|
428
|
+
"@id": "sec:owner",
|
429
|
+
"@type": "@id",
|
430
|
+
},
|
431
|
+
"password": "sec:password",
|
432
|
+
"privateKey": {
|
433
|
+
"@id": "sec:privateKey",
|
434
|
+
"@type": "@id",
|
435
|
+
},
|
436
|
+
"privateKeyPem": "sec:privateKeyPem",
|
437
|
+
"publicKey": {
|
438
|
+
"@id": "sec:publicKey",
|
439
|
+
"@type": "@id",
|
440
|
+
},
|
441
|
+
"publicKeyBase58": "sec:publicKeyBase58",
|
442
|
+
"publicKeyPem": "sec:publicKeyPem",
|
443
|
+
"publicKeyWif": "sec:publicKeyWif",
|
444
|
+
"publicKeyService": {
|
445
|
+
"@id": "sec:publicKeyService",
|
446
|
+
"@type": "@id",
|
447
|
+
},
|
448
|
+
"revoked": {
|
449
|
+
"@id": "sec:revoked",
|
450
|
+
"@type": "xsd:dateTime",
|
451
|
+
},
|
452
|
+
"salt": "sec:salt",
|
453
|
+
"signature": "sec:signature",
|
454
|
+
"signatureAlgorithm": "sec:signingAlgorithm",
|
455
|
+
"signatureValue": "sec:signatureValue",
|
456
|
+
},
|
457
|
+
},
|
458
|
+
"https://w3id.org/security/data-integrity/v1": {
|
459
|
+
"@context": {
|
460
|
+
"id": "@id",
|
461
|
+
"type": "@type",
|
462
|
+
"@protected": true,
|
463
|
+
"digestMultibase": {
|
464
|
+
"@id": "https://w3id.org/security#digestMultibase",
|
465
|
+
"@type": "https://w3id.org/security#multibase",
|
466
|
+
},
|
467
|
+
"proof": {
|
468
|
+
"@id": "https://w3id.org/security#proof",
|
469
|
+
"@type": "@id",
|
470
|
+
"@container": "@graph",
|
471
|
+
},
|
472
|
+
"DataIntegrityProof": {
|
473
|
+
"@id": "https://w3id.org/security#DataIntegrityProof",
|
474
|
+
"@context": {
|
475
|
+
"@protected": true,
|
476
|
+
"id": "@id",
|
477
|
+
"type": "@type",
|
478
|
+
"challenge": "https://w3id.org/security#challenge",
|
479
|
+
"created": {
|
480
|
+
"@id": "http://purl.org/dc/terms/created",
|
481
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime",
|
482
|
+
},
|
483
|
+
"domain": "https://w3id.org/security#domain",
|
484
|
+
"expires": {
|
485
|
+
"@id": "https://w3id.org/security#expiration",
|
486
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime",
|
487
|
+
},
|
488
|
+
"nonce": "https://w3id.org/security#nonce",
|
489
|
+
"proofPurpose": {
|
490
|
+
"@id": "https://w3id.org/security#proofPurpose",
|
491
|
+
"@type": "@vocab",
|
492
|
+
"@context": {
|
493
|
+
"@protected": true,
|
494
|
+
"id": "@id",
|
495
|
+
"type": "@type",
|
496
|
+
"assertionMethod": {
|
497
|
+
"@id": "https://w3id.org/security#assertionMethod",
|
498
|
+
"@type": "@id",
|
499
|
+
"@container": "@set",
|
500
|
+
},
|
501
|
+
"authentication": {
|
502
|
+
"@id": "https://w3id.org/security#authenticationMethod",
|
503
|
+
"@type": "@id",
|
504
|
+
"@container": "@set",
|
505
|
+
},
|
506
|
+
"capabilityInvocation": {
|
507
|
+
"@id": "https://w3id.org/security#capabilityInvocationMethod",
|
508
|
+
"@type": "@id",
|
509
|
+
"@container": "@set",
|
510
|
+
},
|
511
|
+
"capabilityDelegation": {
|
512
|
+
"@id": "https://w3id.org/security#capabilityDelegationMethod",
|
513
|
+
"@type": "@id",
|
514
|
+
"@container": "@set",
|
515
|
+
},
|
516
|
+
"keyAgreement": {
|
517
|
+
"@id": "https://w3id.org/security#keyAgreementMethod",
|
518
|
+
"@type": "@id",
|
519
|
+
"@container": "@set",
|
520
|
+
},
|
521
|
+
},
|
522
|
+
},
|
523
|
+
"cryptosuite": "https://w3id.org/security#cryptosuite",
|
524
|
+
"proofValue": {
|
525
|
+
"@id": "https://w3id.org/security#proofValue",
|
526
|
+
"@type": "https://w3id.org/security#multibase",
|
527
|
+
},
|
528
|
+
"verificationMethod": {
|
529
|
+
"@id": "https://w3id.org/security#verificationMethod",
|
530
|
+
"@type": "@id",
|
531
|
+
},
|
532
|
+
},
|
533
|
+
},
|
534
|
+
},
|
535
|
+
},
|
536
|
+
"https://www.w3.org/ns/did/v1": {
|
537
|
+
"@context": {
|
538
|
+
"@protected": true,
|
539
|
+
"id": "@id",
|
540
|
+
"type": "@type",
|
541
|
+
"alsoKnownAs": {
|
542
|
+
"@id": "https://www.w3.org/ns/activitystreams#alsoKnownAs",
|
543
|
+
"@type": "@id",
|
544
|
+
},
|
545
|
+
"assertionMethod": {
|
546
|
+
"@id": "https://w3id.org/security#assertionMethod",
|
547
|
+
"@type": "@id",
|
548
|
+
"@container": "@set",
|
549
|
+
},
|
550
|
+
"authentication": {
|
551
|
+
"@id": "https://w3id.org/security#authenticationMethod",
|
552
|
+
"@type": "@id",
|
553
|
+
"@container": "@set",
|
554
|
+
},
|
555
|
+
"capabilityDelegation": {
|
556
|
+
"@id": "https://w3id.org/security#capabilityDelegationMethod",
|
557
|
+
"@type": "@id",
|
558
|
+
"@container": "@set",
|
559
|
+
},
|
560
|
+
"capabilityInvocation": {
|
561
|
+
"@id": "https://w3id.org/security#capabilityInvocationMethod",
|
562
|
+
"@type": "@id",
|
563
|
+
"@container": "@set",
|
564
|
+
},
|
565
|
+
"controller": {
|
566
|
+
"@id": "https://w3id.org/security#controller",
|
567
|
+
"@type": "@id",
|
568
|
+
},
|
569
|
+
"keyAgreement": {
|
570
|
+
"@id": "https://w3id.org/security#keyAgreementMethod",
|
571
|
+
"@type": "@id",
|
572
|
+
"@container": "@set",
|
573
|
+
},
|
574
|
+
"service": {
|
575
|
+
"@id": "https://www.w3.org/ns/did#service",
|
576
|
+
"@type": "@id",
|
577
|
+
"@context": {
|
578
|
+
"@protected": true,
|
579
|
+
"id": "@id",
|
580
|
+
"type": "@type",
|
581
|
+
"serviceEndpoint": {
|
582
|
+
"@id": "https://www.w3.org/ns/did#serviceEndpoint",
|
583
|
+
"@type": "@id",
|
584
|
+
},
|
585
|
+
},
|
586
|
+
},
|
587
|
+
"verificationMethod": {
|
588
|
+
"@id": "https://w3id.org/security#verificationMethod",
|
589
|
+
"@type": "@id",
|
590
|
+
},
|
591
|
+
},
|
592
|
+
},
|
593
|
+
"https://w3id.org/security/multikey/v1": {
|
594
|
+
"@context": {
|
595
|
+
"id": "@id",
|
596
|
+
"type": "@type",
|
597
|
+
"@protected": true,
|
598
|
+
"Multikey": {
|
599
|
+
"@id": "https://w3id.org/security#Multikey",
|
600
|
+
"@context": {
|
601
|
+
"@protected": true,
|
602
|
+
"id": "@id",
|
603
|
+
"type": "@type",
|
604
|
+
"controller": {
|
605
|
+
"@id": "https://w3id.org/security#controller",
|
606
|
+
"@type": "@id",
|
607
|
+
},
|
608
|
+
"revoked": {
|
609
|
+
"@id": "https://w3id.org/security#revoked",
|
610
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime",
|
611
|
+
},
|
612
|
+
"expires": {
|
613
|
+
"@id": "https://w3id.org/security#expiration",
|
614
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime",
|
615
|
+
},
|
616
|
+
"publicKeyMultibase": {
|
617
|
+
"@id": "https://w3id.org/security#publicKeyMultibase",
|
618
|
+
"@type": "https://w3id.org/security#multibase",
|
619
|
+
},
|
620
|
+
"secretKeyMultibase": {
|
621
|
+
"@id": "https://w3id.org/security#secretKeyMultibase",
|
622
|
+
"@type": "https://w3id.org/security#multibase",
|
623
|
+
},
|
624
|
+
},
|
625
|
+
},
|
626
|
+
},
|
627
|
+
},
|
628
|
+
};
|
629
|
+
export default preloadedContexts;
|
package/esm/runtime/docloader.js
CHANGED
@@ -2,6 +2,7 @@ import * as dntShim from "../_dnt.shims.js";
|
|
2
2
|
import { getLogger } from "@logtape/logtape";
|
3
3
|
import { signRequest } from "../sig/http.js";
|
4
4
|
import { validateCryptoKey } from "../sig/key.js";
|
5
|
+
import preloadedContexts from "./contexts.js";
|
5
6
|
const logger = getLogger(["fedify", "runtime", "docloader"]);
|
6
7
|
/**
|
7
8
|
* Error thrown when fetching a JSON-LD document failed.
|
@@ -61,10 +62,26 @@ async function getRemoteDocument(url, response) {
|
|
61
62
|
}
|
62
63
|
/**
|
63
64
|
* A JSON-LD document loader that utilizes the browser's `fetch` API.
|
65
|
+
*
|
66
|
+
* This loader preloads the below frequently used contexts:
|
67
|
+
*
|
68
|
+
* - <https://www.w3.org/ns/activitystreams>
|
69
|
+
* - <https://w3id.org/security/v1>
|
70
|
+
* - <https://w3id.org/security/data-integrity/v1>
|
71
|
+
* - <https://www.w3.org/ns/did/v1>
|
72
|
+
* - <https://w3id.org/security/multikey/v1>
|
64
73
|
* @param url The URL of the document to load.
|
65
74
|
* @returns The remote document.
|
66
75
|
*/
|
67
76
|
export async function fetchDocumentLoader(url) {
|
77
|
+
if (url in preloadedContexts) {
|
78
|
+
logger.debug("Using preloaded context: {url}.", { url });
|
79
|
+
return {
|
80
|
+
contextUrl: null,
|
81
|
+
document: preloadedContexts[url],
|
82
|
+
documentUrl: url,
|
83
|
+
};
|
84
|
+
}
|
68
85
|
const request = createRequest(url);
|
69
86
|
logRequest(request);
|
70
87
|
const response = await fetch(request, {
|
@@ -119,11 +136,6 @@ export function getAuthenticatedDocumentLoader(identity) {
|
|
119
136
|
export function kvCache({ loader, kv, prefix, rules }) {
|
120
137
|
const keyPrefix = prefix ?? ["_fedify", "remoteDocument"];
|
121
138
|
rules ??= [
|
122
|
-
[
|
123
|
-
"https://www.w3.org/ns/activitystreams",
|
124
|
-
dntShim.Temporal.Duration.from({ days: 30 }),
|
125
|
-
],
|
126
|
-
["https://w3id.org/security/v1", dntShim.Temporal.Duration.from({ days: 30 })],
|
127
139
|
[new dntShim.URLPattern({}), dntShim.Temporal.Duration.from({ minutes: 5 })],
|
128
140
|
];
|
129
141
|
for (const [p, duration] of rules) {
|
package/package.json
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../src/runtime/contexts.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAonB9C,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
@@ -47,6 +47,14 @@ export declare class FetchError extends Error {
|
|
47
47
|
}
|
48
48
|
/**
|
49
49
|
* A JSON-LD document loader that utilizes the browser's `fetch` API.
|
50
|
+
*
|
51
|
+
* This loader preloads the below frequently used contexts:
|
52
|
+
*
|
53
|
+
* - <https://www.w3.org/ns/activitystreams>
|
54
|
+
* - <https://w3id.org/security/v1>
|
55
|
+
* - <https://w3id.org/security/data-integrity/v1>
|
56
|
+
* - <https://www.w3.org/ns/did/v1>
|
57
|
+
* - <https://w3id.org/security/multikey/v1>
|
50
58
|
* @param url The URL of the document to load.
|
51
59
|
* @returns The remote document.
|
52
60
|
*/
|
@@ -88,11 +96,7 @@ export interface KvCacheParameters {
|
|
88
96
|
* a {@link URLPattern} and `duration` is a {@link Temporal.Duration}.
|
89
97
|
* The `duration` is allowed to be at most 30 days.
|
90
98
|
*
|
91
|
-
*
|
92
|
-
*
|
93
|
-
* - `https://www.w3.org/ns/activitystreams` for 30 days
|
94
|
-
* - `https://w3id.org/security/v1` for 30 days
|
95
|
-
* - Everything else for 5 minutes
|
99
|
+
* By default, 5 minutes for all URLs.
|
96
100
|
*/
|
97
101
|
rules?: [string | URL | dntShim.URLPattern, dntShim.Temporal.Duration][];
|
98
102
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"docloader.d.ts","sourceRoot":"","sources":["../../src/runtime/docloader.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAE5C,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;
|
1
|
+
{"version":3,"file":"docloader.d.ts","sourceRoot":"","sources":["../../src/runtime/docloader.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAE5C,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAO1D;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;AAEtE;;;;;;;;GAQG;AACH,MAAM,MAAM,kCAAkC,GAAG,CAC/C,QAAQ,EAAE;IAAE,KAAK,EAAE,GAAG,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC,SAAS,CAAA;CAAE,KACpD,cAAc,CAAC;AAEpB;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC;;OAEG;IACH,GAAG,EAAE,GAAG,CAAC;IAET;;;;;OAKG;gBACS,GAAG,EAAE,GAAG,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAKhD;AAwDD;;;;;;;;;;;;GAYG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,cAAc,CAAC,CAyBzB;AAED;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE;IAAE,KAAK,EAAE,GAAG,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC,SAAS,CAAA;CAAE,GACtD,cAAc,CAsBhB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,MAAM,EAAE,cAAc,CAAC;IAEvB;;OAEG;IACH,EAAE,EAAE,OAAO,CAAC;IAEZ;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC;IAEf;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,CAAC,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;CAC1E;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CACrB,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,iBAAiB,GAC/C,cAAc,CA2ChB"}
|