@fedify/interaction-controls 2.5.0-dev.2494 → 2.5.0-dev.2496
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.cjs +14 -14
- package/dist/mod.d.cts +6 -6
- package/dist/mod.d.ts +6 -6
- package/dist/mod.js +14 -14
- package/package.json +4 -4
package/dist/mod.cjs
CHANGED
|
@@ -247,7 +247,7 @@ async function resolveAuthoritativeObject(id, options) {
|
|
|
247
247
|
ok: false,
|
|
248
248
|
failure: {
|
|
249
249
|
category: "invalid",
|
|
250
|
-
type: "
|
|
250
|
+
type: "credentials-in-url",
|
|
251
251
|
url: id
|
|
252
252
|
}
|
|
253
253
|
};
|
|
@@ -305,7 +305,7 @@ async function resolveAuthoritativeObject(id, options) {
|
|
|
305
305
|
ok: false,
|
|
306
306
|
failure: {
|
|
307
307
|
category: "invalid",
|
|
308
|
-
type: "
|
|
308
|
+
type: "invalid-interacting-object",
|
|
309
309
|
reason: "decoding",
|
|
310
310
|
cause: error
|
|
311
311
|
}
|
|
@@ -330,13 +330,13 @@ async function resolveAuthoritativeObject(id, options) {
|
|
|
330
330
|
const decoding = failures.find((failure) => failure.operation === "parse" && !collectCauses(failure.error).some((cause) => tracker.records.has(cause)));
|
|
331
331
|
if (decoding != null) return {
|
|
332
332
|
category: "invalid",
|
|
333
|
-
type: "
|
|
333
|
+
type: "invalid-interacting-object",
|
|
334
334
|
reason: "decoding",
|
|
335
335
|
cause: decoding.error
|
|
336
336
|
};
|
|
337
337
|
if (rejections.length > 0) return {
|
|
338
338
|
category: "invalid",
|
|
339
|
-
type: "
|
|
339
|
+
type: "invalid-interacting-object",
|
|
340
340
|
reason: rejections[rejections.length - 1]
|
|
341
341
|
};
|
|
342
342
|
return {
|
|
@@ -479,7 +479,7 @@ async function verifyRequest(context, options, config) {
|
|
|
479
479
|
requestId: request.id,
|
|
480
480
|
failure: {
|
|
481
481
|
category: "unauthorized",
|
|
482
|
-
type: "
|
|
482
|
+
type: "unauthenticated-requester"
|
|
483
483
|
}
|
|
484
484
|
};
|
|
485
485
|
}
|
|
@@ -496,7 +496,7 @@ async function verifyRequest(context, options, config) {
|
|
|
496
496
|
requestId: request.id,
|
|
497
497
|
failure: {
|
|
498
498
|
category: "unauthorized",
|
|
499
|
-
type: "
|
|
499
|
+
type: "unauthenticated-requester",
|
|
500
500
|
requester: request.actorId
|
|
501
501
|
}
|
|
502
502
|
};
|
|
@@ -590,7 +590,7 @@ async function verifyRequest(context, options, config) {
|
|
|
590
590
|
type: "missingActor"
|
|
591
591
|
} : {
|
|
592
592
|
category: "unauthorized",
|
|
593
|
-
type: "
|
|
593
|
+
type: "unauthenticated-requester",
|
|
594
594
|
...owner == null ? {} : { requester: owner }
|
|
595
595
|
}
|
|
596
596
|
};
|
|
@@ -975,12 +975,12 @@ function bindRequest(request, evidence, typeId) {
|
|
|
975
975
|
};
|
|
976
976
|
if (request.objectIds.length !== 1 || !sameId(request.objectIds[0], request.objectId)) return {
|
|
977
977
|
category: "invalid",
|
|
978
|
-
type: "
|
|
978
|
+
type: "ambiguous-request",
|
|
979
979
|
property: "object"
|
|
980
980
|
};
|
|
981
981
|
if (request.instrumentIds.length !== 1 || !sameId(request.instrumentIds[0], request.instrumentId)) return {
|
|
982
982
|
category: "invalid",
|
|
983
|
-
type: "
|
|
983
|
+
type: "ambiguous-request",
|
|
984
984
|
property: "instrument"
|
|
985
985
|
};
|
|
986
986
|
return null;
|
|
@@ -988,25 +988,25 @@ function bindRequest(request, evidence, typeId) {
|
|
|
988
988
|
const root = getRootNode(evidence.expanded);
|
|
989
989
|
if (root == null) return {
|
|
990
990
|
category: "invalid",
|
|
991
|
-
type: "
|
|
991
|
+
type: "ambiguous-request",
|
|
992
992
|
property: "id"
|
|
993
993
|
};
|
|
994
994
|
if (!hasType(root, typeId.href)) return {
|
|
995
995
|
category: "invalid",
|
|
996
|
-
type: "
|
|
996
|
+
type: "ambiguous-request",
|
|
997
997
|
property: "type"
|
|
998
998
|
};
|
|
999
999
|
const rootId = resolveNodeId(root, evidence.baseUrl);
|
|
1000
1000
|
if (rootId == null || !sameId(rootId, request.id)) return {
|
|
1001
1001
|
category: "invalid",
|
|
1002
|
-
type: "
|
|
1002
|
+
type: "ambiguous-request",
|
|
1003
1003
|
property: "id"
|
|
1004
1004
|
};
|
|
1005
1005
|
const base = evidence.baseUrl ?? rootId;
|
|
1006
1006
|
const actors = getPropertyValues(root, AS_ACTOR);
|
|
1007
1007
|
if (actors.length !== request.actorIds.length || !actors.every((actor, i) => sameId(resolveNodeId(actor, base), request.actorIds[i]))) return {
|
|
1008
1008
|
category: "invalid",
|
|
1009
|
-
type: "
|
|
1009
|
+
type: "ambiguous-request",
|
|
1010
1010
|
property: "actor"
|
|
1011
1011
|
};
|
|
1012
1012
|
for (const [iri, property, missing, id] of [[
|
|
@@ -1027,7 +1027,7 @@ function bindRequest(request, evidence, typeId) {
|
|
|
1027
1027
|
};
|
|
1028
1028
|
if (values.length !== 1 || !sameId(resolveNodeId(values[0], base), id)) return {
|
|
1029
1029
|
category: "invalid",
|
|
1030
|
-
type: "
|
|
1030
|
+
type: "ambiguous-request",
|
|
1031
1031
|
property
|
|
1032
1032
|
};
|
|
1033
1033
|
}
|
package/dist/mod.d.cts
CHANGED
|
@@ -534,12 +534,12 @@ interface QuoteRequestValidationOptions {
|
|
|
534
534
|
*
|
|
535
535
|
* - `"strict"` (default): if both are present they must agree, and the
|
|
536
536
|
* reference must equal the target.
|
|
537
|
-
* - `"
|
|
537
|
+
* - `"prefer-quote"`: `quote` must equal the target if present, otherwise
|
|
538
538
|
* `quoteUrl` must; a conflicting `quoteUrl` is ignored.
|
|
539
539
|
* - `"any"`: either `quote` or `quoteUrl` equal to the target suffices,
|
|
540
540
|
* even when the two disagree.
|
|
541
541
|
*/
|
|
542
|
-
readonly quoteReference?: "strict" | "
|
|
542
|
+
readonly quoteReference?: "strict" | "prefer-quote" | "any";
|
|
543
543
|
/**
|
|
544
544
|
* Which `attributedTo` entries of the quote post may match the requester:
|
|
545
545
|
*
|
|
@@ -638,7 +638,7 @@ type InteractionRequestVerificationFailure = {
|
|
|
638
638
|
* @since 2.5.0
|
|
639
639
|
*/
|
|
640
640
|
readonly category: "invalid";
|
|
641
|
-
readonly type: "
|
|
641
|
+
readonly type: "credentials-in-url";
|
|
642
642
|
readonly url: URL;
|
|
643
643
|
} | {
|
|
644
644
|
/**
|
|
@@ -654,7 +654,7 @@ type InteractionRequestVerificationFailure = {
|
|
|
654
654
|
* @since 2.5.0
|
|
655
655
|
*/
|
|
656
656
|
readonly category: "invalid";
|
|
657
|
-
readonly type: "
|
|
657
|
+
readonly type: "invalid-interacting-object";
|
|
658
658
|
readonly reason: "credentials" | "id" | "type" | "attribution" | "decoding";
|
|
659
659
|
readonly cause?: unknown;
|
|
660
660
|
} | {
|
|
@@ -666,7 +666,7 @@ type InteractionRequestVerificationFailure = {
|
|
|
666
666
|
* @since 2.5.0
|
|
667
667
|
*/
|
|
668
668
|
readonly category: "invalid";
|
|
669
|
-
readonly type: "
|
|
669
|
+
readonly type: "ambiguous-request";
|
|
670
670
|
readonly property: "type" | "id" | "actor" | "object" | "instrument";
|
|
671
671
|
} | {
|
|
672
672
|
/**
|
|
@@ -677,7 +677,7 @@ type InteractionRequestVerificationFailure = {
|
|
|
677
677
|
* @since 2.5.0
|
|
678
678
|
*/
|
|
679
679
|
readonly category: "unauthorized";
|
|
680
|
-
readonly type: "
|
|
680
|
+
readonly type: "unauthenticated-requester";
|
|
681
681
|
readonly requester?: URL;
|
|
682
682
|
};
|
|
683
683
|
interface InteractionPolicyEvaluationOptions<TContextData, TTarget extends Object$1> {
|
package/dist/mod.d.ts
CHANGED
|
@@ -93,12 +93,12 @@ interface QuoteRequestValidationOptions {
|
|
|
93
93
|
*
|
|
94
94
|
* - `"strict"` (default): if both are present they must agree, and the
|
|
95
95
|
* reference must equal the target.
|
|
96
|
-
* - `"
|
|
96
|
+
* - `"prefer-quote"`: `quote` must equal the target if present, otherwise
|
|
97
97
|
* `quoteUrl` must; a conflicting `quoteUrl` is ignored.
|
|
98
98
|
* - `"any"`: either `quote` or `quoteUrl` equal to the target suffices,
|
|
99
99
|
* even when the two disagree.
|
|
100
100
|
*/
|
|
101
|
-
readonly quoteReference?: "strict" | "
|
|
101
|
+
readonly quoteReference?: "strict" | "prefer-quote" | "any";
|
|
102
102
|
/**
|
|
103
103
|
* Which `attributedTo` entries of the quote post may match the requester:
|
|
104
104
|
*
|
|
@@ -197,7 +197,7 @@ type InteractionRequestVerificationFailure = {
|
|
|
197
197
|
* @since 2.5.0
|
|
198
198
|
*/
|
|
199
199
|
readonly category: "invalid";
|
|
200
|
-
readonly type: "
|
|
200
|
+
readonly type: "credentials-in-url";
|
|
201
201
|
readonly url: URL;
|
|
202
202
|
} | {
|
|
203
203
|
/**
|
|
@@ -213,7 +213,7 @@ type InteractionRequestVerificationFailure = {
|
|
|
213
213
|
* @since 2.5.0
|
|
214
214
|
*/
|
|
215
215
|
readonly category: "invalid";
|
|
216
|
-
readonly type: "
|
|
216
|
+
readonly type: "invalid-interacting-object";
|
|
217
217
|
readonly reason: "credentials" | "id" | "type" | "attribution" | "decoding";
|
|
218
218
|
readonly cause?: unknown;
|
|
219
219
|
} | {
|
|
@@ -225,7 +225,7 @@ type InteractionRequestVerificationFailure = {
|
|
|
225
225
|
* @since 2.5.0
|
|
226
226
|
*/
|
|
227
227
|
readonly category: "invalid";
|
|
228
|
-
readonly type: "
|
|
228
|
+
readonly type: "ambiguous-request";
|
|
229
229
|
readonly property: "type" | "id" | "actor" | "object" | "instrument";
|
|
230
230
|
} | {
|
|
231
231
|
/**
|
|
@@ -236,7 +236,7 @@ type InteractionRequestVerificationFailure = {
|
|
|
236
236
|
* @since 2.5.0
|
|
237
237
|
*/
|
|
238
238
|
readonly category: "unauthorized";
|
|
239
|
-
readonly type: "
|
|
239
|
+
readonly type: "unauthenticated-requester";
|
|
240
240
|
readonly requester?: URL;
|
|
241
241
|
};
|
|
242
242
|
interface InteractionPolicyEvaluationOptions<TContextData, TTarget extends Object$1> {
|
package/dist/mod.js
CHANGED
|
@@ -223,7 +223,7 @@ async function resolveAuthoritativeObject(id, options) {
|
|
|
223
223
|
ok: false,
|
|
224
224
|
failure: {
|
|
225
225
|
category: "invalid",
|
|
226
|
-
type: "
|
|
226
|
+
type: "credentials-in-url",
|
|
227
227
|
url: id
|
|
228
228
|
}
|
|
229
229
|
};
|
|
@@ -281,7 +281,7 @@ async function resolveAuthoritativeObject(id, options) {
|
|
|
281
281
|
ok: false,
|
|
282
282
|
failure: {
|
|
283
283
|
category: "invalid",
|
|
284
|
-
type: "
|
|
284
|
+
type: "invalid-interacting-object",
|
|
285
285
|
reason: "decoding",
|
|
286
286
|
cause: error
|
|
287
287
|
}
|
|
@@ -306,13 +306,13 @@ async function resolveAuthoritativeObject(id, options) {
|
|
|
306
306
|
const decoding = failures.find((failure) => failure.operation === "parse" && !collectCauses(failure.error).some((cause) => tracker.records.has(cause)));
|
|
307
307
|
if (decoding != null) return {
|
|
308
308
|
category: "invalid",
|
|
309
|
-
type: "
|
|
309
|
+
type: "invalid-interacting-object",
|
|
310
310
|
reason: "decoding",
|
|
311
311
|
cause: decoding.error
|
|
312
312
|
};
|
|
313
313
|
if (rejections.length > 0) return {
|
|
314
314
|
category: "invalid",
|
|
315
|
-
type: "
|
|
315
|
+
type: "invalid-interacting-object",
|
|
316
316
|
reason: rejections[rejections.length - 1]
|
|
317
317
|
};
|
|
318
318
|
return {
|
|
@@ -455,7 +455,7 @@ async function verifyRequest(context, options, config) {
|
|
|
455
455
|
requestId: request.id,
|
|
456
456
|
failure: {
|
|
457
457
|
category: "unauthorized",
|
|
458
|
-
type: "
|
|
458
|
+
type: "unauthenticated-requester"
|
|
459
459
|
}
|
|
460
460
|
};
|
|
461
461
|
}
|
|
@@ -472,7 +472,7 @@ async function verifyRequest(context, options, config) {
|
|
|
472
472
|
requestId: request.id,
|
|
473
473
|
failure: {
|
|
474
474
|
category: "unauthorized",
|
|
475
|
-
type: "
|
|
475
|
+
type: "unauthenticated-requester",
|
|
476
476
|
requester: request.actorId
|
|
477
477
|
}
|
|
478
478
|
};
|
|
@@ -566,7 +566,7 @@ async function verifyRequest(context, options, config) {
|
|
|
566
566
|
type: "missingActor"
|
|
567
567
|
} : {
|
|
568
568
|
category: "unauthorized",
|
|
569
|
-
type: "
|
|
569
|
+
type: "unauthenticated-requester",
|
|
570
570
|
...owner == null ? {} : { requester: owner }
|
|
571
571
|
}
|
|
572
572
|
};
|
|
@@ -951,12 +951,12 @@ function bindRequest(request, evidence, typeId) {
|
|
|
951
951
|
};
|
|
952
952
|
if (request.objectIds.length !== 1 || !sameId(request.objectIds[0], request.objectId)) return {
|
|
953
953
|
category: "invalid",
|
|
954
|
-
type: "
|
|
954
|
+
type: "ambiguous-request",
|
|
955
955
|
property: "object"
|
|
956
956
|
};
|
|
957
957
|
if (request.instrumentIds.length !== 1 || !sameId(request.instrumentIds[0], request.instrumentId)) return {
|
|
958
958
|
category: "invalid",
|
|
959
|
-
type: "
|
|
959
|
+
type: "ambiguous-request",
|
|
960
960
|
property: "instrument"
|
|
961
961
|
};
|
|
962
962
|
return null;
|
|
@@ -964,25 +964,25 @@ function bindRequest(request, evidence, typeId) {
|
|
|
964
964
|
const root = getRootNode(evidence.expanded);
|
|
965
965
|
if (root == null) return {
|
|
966
966
|
category: "invalid",
|
|
967
|
-
type: "
|
|
967
|
+
type: "ambiguous-request",
|
|
968
968
|
property: "id"
|
|
969
969
|
};
|
|
970
970
|
if (!hasType(root, typeId.href)) return {
|
|
971
971
|
category: "invalid",
|
|
972
|
-
type: "
|
|
972
|
+
type: "ambiguous-request",
|
|
973
973
|
property: "type"
|
|
974
974
|
};
|
|
975
975
|
const rootId = resolveNodeId(root, evidence.baseUrl);
|
|
976
976
|
if (rootId == null || !sameId(rootId, request.id)) return {
|
|
977
977
|
category: "invalid",
|
|
978
|
-
type: "
|
|
978
|
+
type: "ambiguous-request",
|
|
979
979
|
property: "id"
|
|
980
980
|
};
|
|
981
981
|
const base = evidence.baseUrl ?? rootId;
|
|
982
982
|
const actors = getPropertyValues(root, AS_ACTOR);
|
|
983
983
|
if (actors.length !== request.actorIds.length || !actors.every((actor, i) => sameId(resolveNodeId(actor, base), request.actorIds[i]))) return {
|
|
984
984
|
category: "invalid",
|
|
985
|
-
type: "
|
|
985
|
+
type: "ambiguous-request",
|
|
986
986
|
property: "actor"
|
|
987
987
|
};
|
|
988
988
|
for (const [iri, property, missing, id] of [[
|
|
@@ -1003,7 +1003,7 @@ function bindRequest(request, evidence, typeId) {
|
|
|
1003
1003
|
};
|
|
1004
1004
|
if (values.length !== 1 || !sameId(resolveNodeId(values[0], base), id)) return {
|
|
1005
1005
|
category: "invalid",
|
|
1006
|
-
type: "
|
|
1006
|
+
type: "ambiguous-request",
|
|
1007
1007
|
property
|
|
1008
1008
|
};
|
|
1009
1009
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/interaction-controls",
|
|
3
|
-
"version": "2.5.0-dev.
|
|
3
|
+
"version": "2.5.0-dev.2496+e18c05f8",
|
|
4
4
|
"description": "Interaction control helpers for Fedify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ActivityPub",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"README.md"
|
|
48
48
|
],
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@fedify/fedify": "^2.5.0-dev.
|
|
50
|
+
"@fedify/fedify": "^2.5.0-dev.2496+e18c05f8"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"temporal-polyfill": "^1.0.1",
|
|
54
|
-
"@fedify/vocab": "2.5.0-dev.
|
|
55
|
-
"@fedify/vocab-runtime": "^2.5.0-dev.
|
|
54
|
+
"@fedify/vocab": "2.5.0-dev.2496+e18c05f8",
|
|
55
|
+
"@fedify/vocab-runtime": "^2.5.0-dev.2496+e18c05f8"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"tsdown": "^0.22.0",
|