@drfed/models 0.2.0-dev.714 → 0.2.0-dev.717
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/README.md +58 -4
- package/dist/activity-delivery.d.mts +1 -1
- package/dist/{db-BBw4F4HU.d.mts → db-CcbUSnp2.d.mts} +84 -3
- package/dist/{db-BBw4F4HU.d.mts.map → db-CcbUSnp2.d.mts.map} +1 -1
- package/dist/db.d.mts +1 -1
- package/dist/document.d.mts +24 -2
- package/dist/document.d.mts.map +1 -1
- package/dist/document.mjs +120 -26
- package/dist/document.mjs.map +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +3 -3
- package/dist/instance.d.mts +1 -1
- package/dist/key.d.mts +1 -1
- package/dist/login.d.mts +8 -2
- package/dist/login.d.mts.map +1 -1
- package/dist/login.mjs +8 -1
- package/dist/login.mjs.map +1 -1
- package/dist/migrations-manifest.json +8 -0
- package/dist/relations.d.mts +1 -1
- package/dist/relations.mjs +19 -2
- package/dist/relations.mjs.map +1 -1
- package/dist/{resource-revision-iQ8HZ699.mjs → resource-revision-bTQyJ7aw.mjs} +28 -3
- package/dist/resource-revision-bTQyJ7aw.mjs.map +1 -0
- package/dist/{resource-revision-BauDwFIn.d.mts → resource-revision-rDmHhNCj.d.mts} +19 -3
- package/dist/resource-revision-rDmHhNCj.d.mts.map +1 -0
- package/dist/resource-revision.d.mts +2 -2
- package/dist/resource-revision.mjs +1 -1
- package/dist/resource.d.mts +1 -1
- package/dist/schema.d.mts +2 -2
- package/dist/schema.mjs +27 -1
- package/dist/schema.mjs.map +1 -1
- package/drizzle/20261113080536_revision_embeddings/migration.sql +14 -0
- package/drizzle/20261113080536_revision_embeddings/snapshot.json +4634 -0
- package/drizzle/20261113080537_guard_revision_embeddings/migration.sql +42 -0
- package/drizzle/20261113080537_guard_revision_embeddings/snapshot.json +4634 -0
- package/package.json +6 -6
- package/dist/resource-revision-BauDwFIn.d.mts.map +0 -1
- package/dist/resource-revision-iQ8HZ699.mjs.map +0 -1
package/dist/document.mjs
CHANGED
|
@@ -28,6 +28,10 @@ const DIAGNOSTIC_REASONS = {
|
|
|
28
28
|
category: "vocabulary",
|
|
29
29
|
severity: "error"
|
|
30
30
|
},
|
|
31
|
+
mutually_exclusive_properties: {
|
|
32
|
+
category: "vocabulary",
|
|
33
|
+
severity: "error"
|
|
34
|
+
},
|
|
31
35
|
property_not_applicable: {
|
|
32
36
|
category: "vocabulary",
|
|
33
37
|
severity: "error"
|
|
@@ -44,6 +48,10 @@ const DIAGNOSTIC_REASONS = {
|
|
|
44
48
|
category: "authority",
|
|
45
49
|
severity: "error"
|
|
46
50
|
},
|
|
51
|
+
source_unavailable: {
|
|
52
|
+
category: "authority",
|
|
53
|
+
severity: "error"
|
|
54
|
+
},
|
|
47
55
|
context_unavailable_offline: {
|
|
48
56
|
category: "support",
|
|
49
57
|
severity: "error"
|
|
@@ -87,11 +95,20 @@ const DIAGNOSTIC_REASONS = {
|
|
|
87
95
|
absent_identifier: {
|
|
88
96
|
category: "compatibility",
|
|
89
97
|
severity: "warning"
|
|
98
|
+
},
|
|
99
|
+
poll_choices_not_list: {
|
|
100
|
+
category: "compatibility",
|
|
101
|
+
severity: "warning"
|
|
102
|
+
},
|
|
103
|
+
poll_choice_reference: {
|
|
104
|
+
category: "compatibility",
|
|
105
|
+
severity: "warning"
|
|
90
106
|
}
|
|
91
107
|
};
|
|
92
108
|
const ACTIVITY_STREAMS_CONTEXT = "https://www.w3.org/ns/activitystreams";
|
|
93
109
|
const MAXIMUM_DIAGNOSTICS = 100;
|
|
94
110
|
const MAXIMUM_PATH_DEPTH = 64;
|
|
111
|
+
const IRI_SCHEME_PATTERN = /^[a-z][a-z\d+.-]*:/iu;
|
|
95
112
|
const ACTOR_TYPES = [
|
|
96
113
|
Application,
|
|
97
114
|
Group,
|
|
@@ -199,6 +216,8 @@ const IDENTIFIER_PROPERTIES = /* @__PURE__ */ new Set([
|
|
|
199
216
|
...ADDRESSING_PROPERTIES,
|
|
200
217
|
"items",
|
|
201
218
|
"orderedItems",
|
|
219
|
+
"oneOf",
|
|
220
|
+
"anyOf",
|
|
202
221
|
"current",
|
|
203
222
|
"first",
|
|
204
223
|
"last",
|
|
@@ -287,20 +306,24 @@ function readDocument(document, path, report) {
|
|
|
287
306
|
function isJsonValueShape(value) {
|
|
288
307
|
return value === null || typeof value === "object" || typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value);
|
|
289
308
|
}
|
|
290
|
-
function
|
|
309
|
+
function hasInvalidIriCharacters(value) {
|
|
310
|
+
const hasControlOrSpace = Array.from(value).some((character) => {
|
|
311
|
+
const point = character.codePointAt(0);
|
|
312
|
+
return point <= 32 || point >= 127 && point <= 159;
|
|
313
|
+
});
|
|
314
|
+
return !value.isWellFormed() || hasControlOrSpace || /[<>"{}|\\^`]/u.test(value) || /%(?![\da-f]{2})/iu.test(value);
|
|
315
|
+
}
|
|
316
|
+
function checkReference(value, path, report, context) {
|
|
291
317
|
if (value === null) return;
|
|
292
318
|
if (typeof value !== "string") {
|
|
293
319
|
if (typeof value === "object") report("unsupported_value_form", path, "Embedded values are not checked yet.");
|
|
294
320
|
else report("invalid_value_shape", path, "Expected a resource reference, embedded object, or allowed list.");
|
|
295
321
|
return;
|
|
296
322
|
}
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if (!value.isWellFormed() || hasControlOrSpace || /[<>"{}|\\^`]/u.test(value) || /%(?![\da-f]{2})/iu.test(value)) report("invalid_iri", path, "Expected a syntactically valid IRI reference.");
|
|
302
|
-
else if (!/^[a-z][a-z\d+.-]*:/iu.test(value)) report("unsupported_value_form", path, "Relative references need a base-IRI policy.");
|
|
303
|
-
else if (!URL.canParse(value)) report("unsupported_value_form", path, "This IRI cannot be represented by the current URL parser.");
|
|
323
|
+
const iri = context == null ? value : expandIdentifier(value, context);
|
|
324
|
+
if (hasInvalidIriCharacters(value) || iri !== value && hasInvalidIriCharacters(iri)) report("invalid_iri", path, "Expected a syntactically valid IRI reference.");
|
|
325
|
+
else if (!IRI_SCHEME_PATTERN.test(iri)) report("unsupported_value_form", path, "Relative references need a base-IRI policy.");
|
|
326
|
+
else if (!URL.canParse(iri)) report("unsupported_value_form", path, iri === value ? "This IRI cannot be represented by the current URL parser." : "The expanded IRI cannot be represented by the current URL parser.");
|
|
304
327
|
}
|
|
305
328
|
function checkReferenceEntry(value, path, report, check) {
|
|
306
329
|
if (value === null) return;
|
|
@@ -344,7 +367,7 @@ function sameContextTerm(actual, expected) {
|
|
|
344
367
|
return actual != null && actual.iri === expected.iri && actual.type === expected.type && actual.container === expected.container && actual.prefix === expected.prefix;
|
|
345
368
|
}
|
|
346
369
|
function isSupportedContextUri(value) {
|
|
347
|
-
return
|
|
370
|
+
return IRI_SCHEME_PATTERN.test(value) && !Array.from(value).some((character) => {
|
|
348
371
|
const point = character.codePointAt(0);
|
|
349
372
|
return point <= 32 || point >= 127 && point <= 159 || "<>\"{}|\\^`".includes(character);
|
|
350
373
|
}) && URL.canParse(value);
|
|
@@ -608,8 +631,25 @@ function checkEmbeddedFedifyRange(Type, expected, path, report) {
|
|
|
608
631
|
}
|
|
609
632
|
function getEmbeddedFedifyRange(property, collectionRange) {
|
|
610
633
|
if (property === "actor" || property === "attributedTo") return ACTOR_TYPES;
|
|
634
|
+
if (isQuestionChoice(property)) return [Object$1];
|
|
611
635
|
return collectionRange?.filter((Expected) => Expected !== Link);
|
|
612
636
|
}
|
|
637
|
+
function getReferenceRange(property, collectionRange) {
|
|
638
|
+
if (isQuestionChoice(property)) return [Object$1, Link];
|
|
639
|
+
return collectionRange;
|
|
640
|
+
}
|
|
641
|
+
function isQuestionChoice(property) {
|
|
642
|
+
return property === "oneOf" || property === "anyOf";
|
|
643
|
+
}
|
|
644
|
+
function conflictingChoiceSources(Type, fields, values) {
|
|
645
|
+
if (!isTypeOrSubtype(Type, Question)) return /* @__PURE__ */ new Set();
|
|
646
|
+
const choices = {
|
|
647
|
+
oneOf: [],
|
|
648
|
+
anyOf: []
|
|
649
|
+
};
|
|
650
|
+
for (const { name, compatible, source } of fields) if (compatible && isQuestionChoice(name) && countValues(values[source]) > 0) choices[name].push(source);
|
|
651
|
+
return new Set(choices.oneOf.length > 0 && choices.anyOf.length > 0 ? [...choices.oneOf, ...choices.anyOf] : []);
|
|
652
|
+
}
|
|
613
653
|
function checkDocumentType(values, fields, path, context, report) {
|
|
614
654
|
const types = fields.filter(({ name }) => name === "type");
|
|
615
655
|
if (types.length > 1) {
|
|
@@ -642,6 +682,7 @@ function getCollectionRange(Type, property) {
|
|
|
642
682
|
}
|
|
643
683
|
function isFunctionalProperty(Type, property) {
|
|
644
684
|
if (["id", "mediaType"].includes(property)) return true;
|
|
685
|
+
if (isTypeOrSubtype(Type, Question) && property === "closed") return true;
|
|
645
686
|
if (getCollectionRange(Type, property) != null) return true;
|
|
646
687
|
if (isTypeOrSubtype(Type, Link)) return [
|
|
647
688
|
"href",
|
|
@@ -683,11 +724,17 @@ function findMultipleAliases(Type, fields, values) {
|
|
|
683
724
|
}
|
|
684
725
|
return multiple;
|
|
685
726
|
}
|
|
727
|
+
function checkFieldMultiplicity(field, path, report, conflictingChoice, multipleAliases) {
|
|
728
|
+
if (conflictingChoice) report("mutually_exclusive_properties", path, "Use either oneOf or anyOf, but not both.");
|
|
729
|
+
if (!multipleAliases.has(field.source)) return;
|
|
730
|
+
if (field.name === "closed") report("unsupported_value_form", path, "DrFed supports one closing value across all aliases.");
|
|
731
|
+
else report("invalid_multiplicity", path, "Multiple aliases supply values for one functional property.");
|
|
732
|
+
}
|
|
686
733
|
function checkNonNegativeInteger(value, path, report) {
|
|
687
734
|
if (value === null) return;
|
|
688
735
|
if (typeof value !== "number" || !Number.isInteger(value) || value < 0) report("invalid_value_shape", path, "Expected a non-negative integer.");
|
|
689
736
|
}
|
|
690
|
-
function checkSingleValue(value, path, report, check) {
|
|
737
|
+
function checkSingleValue(value, path, report, check, multiplicityReason = "invalid_multiplicity") {
|
|
691
738
|
if (!Array.isArray(value)) {
|
|
692
739
|
check(value, path, report);
|
|
693
740
|
return;
|
|
@@ -703,7 +750,7 @@ function checkSingleValue(value, path, report, check) {
|
|
|
703
750
|
path: entryPath
|
|
704
751
|
});
|
|
705
752
|
});
|
|
706
|
-
if (entries.length > 1) report(
|
|
753
|
+
if (entries.length > 1) report(multiplicityReason, path, "Expected at most one non-null value.");
|
|
707
754
|
for (const entry of entries) checkReferenceEntry(entry.value, entry.path, report, check);
|
|
708
755
|
}
|
|
709
756
|
function checkLanguageTag(value, path, report) {
|
|
@@ -797,7 +844,13 @@ function checkDateTime(value, path, report) {
|
|
|
797
844
|
report("unsupported_value_form", path, "This date-time matches the ActivityStreams format, but cannot be parsed as an instant without rewriting; provide a timestamp such as 2024-01-01T12:34:00Z.");
|
|
798
845
|
}
|
|
799
846
|
}
|
|
847
|
+
function checkQuestionClosed(value, path, report) {
|
|
848
|
+
if (value === null || typeof value === "boolean") return;
|
|
849
|
+
if (typeof value === "object" && !Array.isArray(value) || typeof value === "string" && IRI_SCHEME_PATTERN.test(value)) report("unsupported_value_form", path, "Fedify supports boolean or date-time closing conditions, not resource values.");
|
|
850
|
+
else checkDateTime(value, path, report);
|
|
851
|
+
}
|
|
800
852
|
function getCommonPropertyKind(Type, property) {
|
|
853
|
+
if (isTypeOrSubtype(Type, Question) && property === "closed") return "closed";
|
|
801
854
|
const object = isTypeOrSubtype(Type, Object$1);
|
|
802
855
|
const actor = ACTOR_TYPES.some((Actor) => isTypeOrSubtype(Type, Actor));
|
|
803
856
|
const textProperties = object ? [
|
|
@@ -816,13 +869,14 @@ function getCommonPropertyKind(Type, property) {
|
|
|
816
869
|
].includes(property)) return "datetime";
|
|
817
870
|
if (property === "id" || property === "mediaType") return property;
|
|
818
871
|
}
|
|
819
|
-
function checkCommonProperty(kind, property, value, path, report) {
|
|
872
|
+
function checkCommonProperty(kind, property, value, path, report, identifierContext) {
|
|
820
873
|
if (kind === "text") checkReferenceValues(value, path, report, (entry, entryPath) => checkText(entry, entryPath, report, property === "name"));
|
|
821
874
|
else if (kind === "languageMap") checkLanguageMap(value, path, report, property === "nameMap");
|
|
822
875
|
else if (kind === "datetime") checkSingleValue(value, path, report, checkDateTime);
|
|
876
|
+
else if (kind === "closed") checkSingleValue(value, path, report, checkQuestionClosed, "unsupported_value_form");
|
|
823
877
|
else if (kind === "id") {
|
|
824
878
|
if (typeof value !== "string") report("invalid_value_shape", path, "Expected an IRI identifier string.");
|
|
825
|
-
else checkReference(value, path, report);
|
|
879
|
+
else checkReference(value, path, report, identifierContext);
|
|
826
880
|
} else if (kind === "mediaType") checkSingleValue(value, path, report, (entry, entryPath) => checkLinkProperty(property, entry, entryPath, report));
|
|
827
881
|
else return value === null;
|
|
828
882
|
return true;
|
|
@@ -854,7 +908,7 @@ function proposePropertyOmission(value, path, report, changes, identifier) {
|
|
|
854
908
|
function checkLinkRelation(value, path, report) {
|
|
855
909
|
if (value === null) return;
|
|
856
910
|
if (typeof value !== "string" || value.length === 0 || Array.from(value).some((character) => character.charCodeAt(0) <= 32 || character.charCodeAt(0) === 127 || character === ",")) report("invalid_value_shape", path, "Expected a relation token or absolute IRI without whitespace or commas.");
|
|
857
|
-
else if (
|
|
911
|
+
else if (IRI_SCHEME_PATTERN.test(value)) checkReference(value, path, report);
|
|
858
912
|
else if (!/^[a-z][a-z\d.-]*$/iu.test(value)) report("invalid_value_shape", path, "Expected a relation token or absolute IRI.");
|
|
859
913
|
}
|
|
860
914
|
function checkLinkProperty(property, value, path, report) {
|
|
@@ -929,7 +983,24 @@ function checkExtensionKeywords(values, path, report) {
|
|
|
929
983
|
return jsonLiteral;
|
|
930
984
|
}
|
|
931
985
|
function getInapplicableProperties(Type) {
|
|
932
|
-
|
|
986
|
+
const properties = new Set(isTypeOrSubtype(Type, Link) ? OBJECT_ONLY_PROPERTIES : []);
|
|
987
|
+
if (!isTypeOrSubtype(Type, Question)) {
|
|
988
|
+
properties.add("oneOf");
|
|
989
|
+
properties.add("anyOf");
|
|
990
|
+
properties.add("closed");
|
|
991
|
+
}
|
|
992
|
+
return properties;
|
|
993
|
+
}
|
|
994
|
+
function checkInapplicableProperty(property, value, path, report) {
|
|
995
|
+
if (value === null) return;
|
|
996
|
+
if ((isQuestionChoice(property) || property === "closed") && Array.isArray(value) && value.length > 0) {
|
|
997
|
+
let hasValue = false;
|
|
998
|
+
checkReferenceValues(value, path, report, () => {
|
|
999
|
+
hasValue = true;
|
|
1000
|
+
});
|
|
1001
|
+
if (!hasValue) return;
|
|
1002
|
+
}
|
|
1003
|
+
report("property_not_applicable", path, "This property does not apply to this document's type.");
|
|
933
1004
|
}
|
|
934
1005
|
function checkPathDepth(path, report) {
|
|
935
1006
|
if (path.length <= MAXIMUM_PATH_DEPTH) return true;
|
|
@@ -972,7 +1043,7 @@ function checkDocumentValue(rootDocument, rootPath, reporter, changes, onDocumen
|
|
|
972
1043
|
}
|
|
973
1044
|
for (const child of children.reverse()) pending.push(child);
|
|
974
1045
|
}
|
|
975
|
-
function checkDocument(document, path, inherited, expectedTypes, fedifyTypes) {
|
|
1046
|
+
function checkDocument(document, path, inherited, expectedTypes, fedifyTypes, embeddedAsChoice) {
|
|
976
1047
|
if (!checkPathDepth(path, report)) {
|
|
977
1048
|
onUnavailableDocument(path);
|
|
978
1049
|
return;
|
|
@@ -1019,7 +1090,11 @@ function checkDocumentValue(rootDocument, rootPath, reporter, changes, onDocumen
|
|
|
1019
1090
|
"rel"
|
|
1020
1091
|
] : [];
|
|
1021
1092
|
const integerProperties = isLink ? ["height", "width"] : isOrderedPage ? ["totalItems", "startIndex"] : isCollection ? ["totalItems"] : [];
|
|
1022
|
-
const referenceProperties = [
|
|
1093
|
+
const referenceProperties = [
|
|
1094
|
+
"preview",
|
|
1095
|
+
"oneOf",
|
|
1096
|
+
"anyOf"
|
|
1097
|
+
];
|
|
1023
1098
|
if (isObject) referenceProperties.push("attributedTo", "location", ...ADDRESSING_PROPERTIES);
|
|
1024
1099
|
if (isActivity) referenceProperties.push("actor", "object", "target", "origin", "result", "instrument");
|
|
1025
1100
|
if (isCollection) referenceProperties.push("items", "orderedItems");
|
|
@@ -1030,6 +1105,8 @@ function checkDocumentValue(rootDocument, rootPath, reporter, changes, onDocumen
|
|
|
1030
1105
|
]);
|
|
1031
1106
|
const multipleAliases = findMultipleAliases(Type, fields, values);
|
|
1032
1107
|
const inapplicableProperties = getInapplicableProperties(Type);
|
|
1108
|
+
const conflictingChoices = conflictingChoiceSources(Type, fields, values);
|
|
1109
|
+
const choiceWarnings = /* @__PURE__ */ new Set();
|
|
1033
1110
|
ancestors.add(sourceDocument);
|
|
1034
1111
|
pending.push(() => {
|
|
1035
1112
|
ancestors.delete(sourceDocument);
|
|
@@ -1037,6 +1114,8 @@ function checkDocumentValue(rootDocument, rootPath, reporter, changes, onDocumen
|
|
|
1037
1114
|
for (const field of fields.filter(({ name }) => name !== "type").reverse()) {
|
|
1038
1115
|
const { source, name: key } = field;
|
|
1039
1116
|
const intransitiveObject = isIntransitive && key === "object";
|
|
1117
|
+
const isChoice = isQuestionChoice(key);
|
|
1118
|
+
const conflictingChoice = conflictingChoices.has(source);
|
|
1040
1119
|
pending.push(() => {
|
|
1041
1120
|
const value = values[source];
|
|
1042
1121
|
const fieldPath = [...path, source];
|
|
@@ -1054,11 +1133,10 @@ function checkDocumentValue(rootDocument, rootPath, reporter, changes, onDocumen
|
|
|
1054
1133
|
return;
|
|
1055
1134
|
}
|
|
1056
1135
|
if (inapplicableProperties.has(key)) {
|
|
1057
|
-
|
|
1058
|
-
report("property_not_applicable", fieldPath, "This property applies to Object documents, not Link documents.");
|
|
1136
|
+
checkInapplicableProperty(key, value, fieldPath, report);
|
|
1059
1137
|
return;
|
|
1060
1138
|
}
|
|
1061
|
-
|
|
1139
|
+
checkFieldMultiplicity(field, fieldPath, report, conflictingChoice, multipleAliases);
|
|
1062
1140
|
const collectionRange = getCollectionRange(Type, key);
|
|
1063
1141
|
const commonKind = getCommonPropertyKind(Type, key);
|
|
1064
1142
|
if ((omittableProperties.has(key) || collectionRange != null || commonKind != null) && proposePropertyOmission(value, fieldPath, report, changes, commonKind === "id")) return;
|
|
@@ -1066,14 +1144,29 @@ function checkDocumentValue(rootDocument, rootPath, reporter, changes, onDocumen
|
|
|
1066
1144
|
else if (linkProperties.includes(key)) {
|
|
1067
1145
|
if (key === "rel") checkLinkProperty(key, value, fieldPath, report);
|
|
1068
1146
|
else checkSingleValue(value, fieldPath, report, (entry, entryPath) => checkLinkProperty(key, entry, entryPath, report));
|
|
1069
|
-
} else if (checkCommonProperty(commonKind, key, value, fieldPath, report)) {} else if (intransitiveObject) checkReferenceValues(value, fieldPath, report, (entry, entryPath) => {
|
|
1147
|
+
} else if (checkCommonProperty(commonKind, key, value, fieldPath, report, embeddedAsChoice ? context : void 0)) {} else if (intransitiveObject) checkReferenceValues(value, fieldPath, report, (entry, entryPath) => {
|
|
1070
1148
|
if (entry !== null) report("property_not_applicable", entryPath, "The object property does not apply to intransitive activities.");
|
|
1071
1149
|
});
|
|
1072
1150
|
else if (referenceProperties.includes(key) || collectionRange != null) {
|
|
1073
1151
|
const checks = [];
|
|
1074
1152
|
(collectionRange == null ? checkReferenceValues : checkSingleReference)(value, fieldPath, report, (entry, entryPath) => {
|
|
1075
|
-
if (entry !== null && typeof entry === "object" && !Array.isArray(entry))
|
|
1076
|
-
|
|
1153
|
+
if (entry !== null && typeof entry === "object" && !Array.isArray(entry)) {
|
|
1154
|
+
if (isChoice && !conflictingChoice && !choiceWarnings.has("poll_choices_not_list") && !Array.isArray(value)) {
|
|
1155
|
+
choiceWarnings.add("poll_choices_not_list");
|
|
1156
|
+
report("poll_choices_not_list", entryPath, "Mastodon expects a list of choices, even for one choice.");
|
|
1157
|
+
}
|
|
1158
|
+
checkDocument(entry, entryPath, context, getReferenceRange(key, collectionRange), getEmbeddedFedifyRange(key, collectionRange), isChoice);
|
|
1159
|
+
} else if (isChoice && typeof entry === "string") {
|
|
1160
|
+
let validReference = true;
|
|
1161
|
+
checkReference(entry, entryPath, (reason, diagnosticPath, message) => {
|
|
1162
|
+
validReference = false;
|
|
1163
|
+
report(reason, diagnosticPath, message);
|
|
1164
|
+
}, context);
|
|
1165
|
+
if (validReference && !conflictingChoice && !choiceWarnings.has("poll_choice_reference")) {
|
|
1166
|
+
choiceWarnings.add("poll_choice_reference");
|
|
1167
|
+
report("poll_choice_reference", entryPath, "Mastodon expects embedded choices and may not read this IRI reference.");
|
|
1168
|
+
}
|
|
1169
|
+
} else checkReference(entry, entryPath, report);
|
|
1077
1170
|
}, (check) => checks.push(check));
|
|
1078
1171
|
for (const check of checks.reverse()) pending.push(check);
|
|
1079
1172
|
} else report("unsupported_property", fieldPath, "This property is not checked by the initial implementation.");
|
|
@@ -1126,8 +1219,8 @@ function createPreview(document, changes) {
|
|
|
1126
1219
|
* Checks the implemented Activity Vocabulary types, including nested
|
|
1127
1220
|
* activity objects, without network access or writes. Embedded objects inherit
|
|
1128
1221
|
* the parent's context. Collections add member, count, and navigation checks.
|
|
1129
|
-
* Question
|
|
1130
|
-
*
|
|
1222
|
+
* Question adds exclusive/inclusive choices and boolean/date-time closing
|
|
1223
|
+
* conditions to shared intransitive rules.
|
|
1131
1224
|
*
|
|
1132
1225
|
* Supports allowlisted bundled contexts and simple inline aliases/prefixes,
|
|
1133
1226
|
* single types, id, string content,
|
|
@@ -1551,7 +1644,8 @@ function describeDocument(document) {
|
|
|
1551
1644
|
path,
|
|
1552
1645
|
type: Type.typeId.href,
|
|
1553
1646
|
kind: nodeKind(Type),
|
|
1554
|
-
...describeProperties(values, path, fields.filter(({ compatible }) => compatible), context)
|
|
1647
|
+
...describeProperties(values, path, fields.filter(({ compatible }) => compatible), context),
|
|
1648
|
+
extensionProperties: fields.filter(({ name }) => name == null).map(({ source }) => source)
|
|
1555
1649
|
}));
|
|
1556
1650
|
const described = [...extensions.map(({ values, path, context }) => describeExtensionNode(values, path, context)), ...[...visited, ...extensions].flatMap(({ values, path, context }) => context == null ? [] : languageMapObjects(values, path, context).map((object) => describeExtensionNode({}, object, null)))];
|
|
1557
1651
|
const holders = new Map(described.flatMap(({ node, children }) => children.map(([path, property]) => [JSON.stringify(path), {
|