@unhead/schema-org 0.2.0 → 0.2.2
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/index.cjs +43 -41
- package/dist/index.d.ts +9 -1
- package/dist/index.mjs +43 -41
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -846,6 +846,47 @@ const reviewResolver = defineSchemaOrgResolver({
|
|
|
846
846
|
}
|
|
847
847
|
});
|
|
848
848
|
|
|
849
|
+
const videoResolver = defineSchemaOrgResolver({
|
|
850
|
+
cast(input) {
|
|
851
|
+
if (typeof input === "string") {
|
|
852
|
+
input = {
|
|
853
|
+
url: input
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
return input;
|
|
857
|
+
},
|
|
858
|
+
alias: "video",
|
|
859
|
+
defaults: {
|
|
860
|
+
"@type": "VideoObject"
|
|
861
|
+
},
|
|
862
|
+
inheritMeta: [
|
|
863
|
+
{ meta: "title", key: "name" },
|
|
864
|
+
"description",
|
|
865
|
+
"image",
|
|
866
|
+
"inLanguage",
|
|
867
|
+
{ meta: "datePublished", key: "uploadDate" }
|
|
868
|
+
],
|
|
869
|
+
idPrefix: "host",
|
|
870
|
+
resolve(video, ctx) {
|
|
871
|
+
if (video.uploadDate)
|
|
872
|
+
video.uploadDate = resolvableDateToIso(video.uploadDate);
|
|
873
|
+
video.url = resolveWithBase(ctx.meta.host, video.url);
|
|
874
|
+
if (video.caption && !video.description)
|
|
875
|
+
video.description = video.caption;
|
|
876
|
+
if (!video.description)
|
|
877
|
+
video.description = "No description";
|
|
878
|
+
if (video.thumbnailUrl)
|
|
879
|
+
video.thumbnailUrl = resolveRelation(video.thumbnailUrl, ctx, imageResolver);
|
|
880
|
+
return video;
|
|
881
|
+
},
|
|
882
|
+
resolveRootNode(video, { find }) {
|
|
883
|
+
if (video.image && !video.thumbnailUrl) {
|
|
884
|
+
const firstImage = asArray(video.image)[0];
|
|
885
|
+
setIfEmpty(video, "thumbnailUrl", find(firstImage["@id"])?.url);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
});
|
|
889
|
+
|
|
849
890
|
const movieResolver = defineSchemaOrgResolver({
|
|
850
891
|
defaults: {
|
|
851
892
|
"@type": "Movie"
|
|
@@ -854,6 +895,8 @@ const movieResolver = defineSchemaOrgResolver({
|
|
|
854
895
|
node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
|
|
855
896
|
node.review = resolveRelation(node.review, ctx, reviewResolver);
|
|
856
897
|
node.director = resolveRelation(node.director, ctx, personResolver);
|
|
898
|
+
node.actor = resolveRelation(node.actor, ctx, personResolver);
|
|
899
|
+
node.trailer = resolveRelation(node.trailer, ctx, videoResolver);
|
|
857
900
|
if (node.dateCreated)
|
|
858
901
|
node.dateCreated = resolvableDateToDate(node.dateCreated);
|
|
859
902
|
return node;
|
|
@@ -1450,47 +1493,6 @@ const softwareAppResolver = defineSchemaOrgResolver({
|
|
|
1450
1493
|
}
|
|
1451
1494
|
});
|
|
1452
1495
|
|
|
1453
|
-
const videoResolver = defineSchemaOrgResolver({
|
|
1454
|
-
cast(input) {
|
|
1455
|
-
if (typeof input === "string") {
|
|
1456
|
-
input = {
|
|
1457
|
-
url: input
|
|
1458
|
-
};
|
|
1459
|
-
}
|
|
1460
|
-
return input;
|
|
1461
|
-
},
|
|
1462
|
-
alias: "video",
|
|
1463
|
-
defaults: {
|
|
1464
|
-
"@type": "VideoObject"
|
|
1465
|
-
},
|
|
1466
|
-
inheritMeta: [
|
|
1467
|
-
{ meta: "title", key: "name" },
|
|
1468
|
-
"description",
|
|
1469
|
-
"image",
|
|
1470
|
-
"inLanguage",
|
|
1471
|
-
{ meta: "datePublished", key: "uploadDate" }
|
|
1472
|
-
],
|
|
1473
|
-
idPrefix: "host",
|
|
1474
|
-
resolve(video, ctx) {
|
|
1475
|
-
if (video.uploadDate)
|
|
1476
|
-
video.uploadDate = resolvableDateToIso(video.uploadDate);
|
|
1477
|
-
video.url = resolveWithBase(ctx.meta.host, video.url);
|
|
1478
|
-
if (video.caption && !video.description)
|
|
1479
|
-
video.description = video.caption;
|
|
1480
|
-
if (!video.description)
|
|
1481
|
-
video.description = "No description";
|
|
1482
|
-
if (video.thumbnailUrl)
|
|
1483
|
-
video.thumbnailUrl = resolveRelation(video.thumbnailUrl, ctx, imageResolver);
|
|
1484
|
-
return video;
|
|
1485
|
-
},
|
|
1486
|
-
resolveRootNode(video, { find }) {
|
|
1487
|
-
if (video.image && !video.thumbnailUrl) {
|
|
1488
|
-
const firstImage = asArray(video.image)[0];
|
|
1489
|
-
setIfEmpty(video, "thumbnailUrl", find(firstImage["@id"])?.url);
|
|
1490
|
-
}
|
|
1491
|
-
}
|
|
1492
|
-
});
|
|
1493
|
-
|
|
1494
1496
|
function loadResolver(resolver) {
|
|
1495
1497
|
switch (resolver) {
|
|
1496
1498
|
case "address":
|
package/dist/index.d.ts
CHANGED
|
@@ -1086,11 +1086,19 @@ interface MovieSimple extends Thing {
|
|
|
1086
1086
|
/**
|
|
1087
1087
|
* The director of the movie.
|
|
1088
1088
|
*/
|
|
1089
|
-
director?:
|
|
1089
|
+
director?: NodeRelations<Person | string>;
|
|
1090
|
+
/**
|
|
1091
|
+
* The director of the movie.
|
|
1092
|
+
*/
|
|
1093
|
+
actor?: NodeRelations<Person | string>;
|
|
1090
1094
|
/**
|
|
1091
1095
|
* A nested Review of the movie.
|
|
1092
1096
|
*/
|
|
1093
1097
|
review?: NodeRelations<Review>;
|
|
1098
|
+
/**
|
|
1099
|
+
* The trailer of a movie or TV/radio series, season, episode, etc.
|
|
1100
|
+
*/
|
|
1101
|
+
trailer?: NodeRelations<string | VideoObject>;
|
|
1094
1102
|
}
|
|
1095
1103
|
interface Movie extends MovieSimple {
|
|
1096
1104
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -844,6 +844,47 @@ const reviewResolver = defineSchemaOrgResolver({
|
|
|
844
844
|
}
|
|
845
845
|
});
|
|
846
846
|
|
|
847
|
+
const videoResolver = defineSchemaOrgResolver({
|
|
848
|
+
cast(input) {
|
|
849
|
+
if (typeof input === "string") {
|
|
850
|
+
input = {
|
|
851
|
+
url: input
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
return input;
|
|
855
|
+
},
|
|
856
|
+
alias: "video",
|
|
857
|
+
defaults: {
|
|
858
|
+
"@type": "VideoObject"
|
|
859
|
+
},
|
|
860
|
+
inheritMeta: [
|
|
861
|
+
{ meta: "title", key: "name" },
|
|
862
|
+
"description",
|
|
863
|
+
"image",
|
|
864
|
+
"inLanguage",
|
|
865
|
+
{ meta: "datePublished", key: "uploadDate" }
|
|
866
|
+
],
|
|
867
|
+
idPrefix: "host",
|
|
868
|
+
resolve(video, ctx) {
|
|
869
|
+
if (video.uploadDate)
|
|
870
|
+
video.uploadDate = resolvableDateToIso(video.uploadDate);
|
|
871
|
+
video.url = resolveWithBase(ctx.meta.host, video.url);
|
|
872
|
+
if (video.caption && !video.description)
|
|
873
|
+
video.description = video.caption;
|
|
874
|
+
if (!video.description)
|
|
875
|
+
video.description = "No description";
|
|
876
|
+
if (video.thumbnailUrl)
|
|
877
|
+
video.thumbnailUrl = resolveRelation(video.thumbnailUrl, ctx, imageResolver);
|
|
878
|
+
return video;
|
|
879
|
+
},
|
|
880
|
+
resolveRootNode(video, { find }) {
|
|
881
|
+
if (video.image && !video.thumbnailUrl) {
|
|
882
|
+
const firstImage = asArray(video.image)[0];
|
|
883
|
+
setIfEmpty(video, "thumbnailUrl", find(firstImage["@id"])?.url);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
});
|
|
887
|
+
|
|
847
888
|
const movieResolver = defineSchemaOrgResolver({
|
|
848
889
|
defaults: {
|
|
849
890
|
"@type": "Movie"
|
|
@@ -852,6 +893,8 @@ const movieResolver = defineSchemaOrgResolver({
|
|
|
852
893
|
node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
|
|
853
894
|
node.review = resolveRelation(node.review, ctx, reviewResolver);
|
|
854
895
|
node.director = resolveRelation(node.director, ctx, personResolver);
|
|
896
|
+
node.actor = resolveRelation(node.actor, ctx, personResolver);
|
|
897
|
+
node.trailer = resolveRelation(node.trailer, ctx, videoResolver);
|
|
855
898
|
if (node.dateCreated)
|
|
856
899
|
node.dateCreated = resolvableDateToDate(node.dateCreated);
|
|
857
900
|
return node;
|
|
@@ -1448,47 +1491,6 @@ const softwareAppResolver = defineSchemaOrgResolver({
|
|
|
1448
1491
|
}
|
|
1449
1492
|
});
|
|
1450
1493
|
|
|
1451
|
-
const videoResolver = defineSchemaOrgResolver({
|
|
1452
|
-
cast(input) {
|
|
1453
|
-
if (typeof input === "string") {
|
|
1454
|
-
input = {
|
|
1455
|
-
url: input
|
|
1456
|
-
};
|
|
1457
|
-
}
|
|
1458
|
-
return input;
|
|
1459
|
-
},
|
|
1460
|
-
alias: "video",
|
|
1461
|
-
defaults: {
|
|
1462
|
-
"@type": "VideoObject"
|
|
1463
|
-
},
|
|
1464
|
-
inheritMeta: [
|
|
1465
|
-
{ meta: "title", key: "name" },
|
|
1466
|
-
"description",
|
|
1467
|
-
"image",
|
|
1468
|
-
"inLanguage",
|
|
1469
|
-
{ meta: "datePublished", key: "uploadDate" }
|
|
1470
|
-
],
|
|
1471
|
-
idPrefix: "host",
|
|
1472
|
-
resolve(video, ctx) {
|
|
1473
|
-
if (video.uploadDate)
|
|
1474
|
-
video.uploadDate = resolvableDateToIso(video.uploadDate);
|
|
1475
|
-
video.url = resolveWithBase(ctx.meta.host, video.url);
|
|
1476
|
-
if (video.caption && !video.description)
|
|
1477
|
-
video.description = video.caption;
|
|
1478
|
-
if (!video.description)
|
|
1479
|
-
video.description = "No description";
|
|
1480
|
-
if (video.thumbnailUrl)
|
|
1481
|
-
video.thumbnailUrl = resolveRelation(video.thumbnailUrl, ctx, imageResolver);
|
|
1482
|
-
return video;
|
|
1483
|
-
},
|
|
1484
|
-
resolveRootNode(video, { find }) {
|
|
1485
|
-
if (video.image && !video.thumbnailUrl) {
|
|
1486
|
-
const firstImage = asArray(video.image)[0];
|
|
1487
|
-
setIfEmpty(video, "thumbnailUrl", find(firstImage["@id"])?.url);
|
|
1488
|
-
}
|
|
1489
|
-
}
|
|
1490
|
-
});
|
|
1491
|
-
|
|
1492
1494
|
function loadResolver(resolver) {
|
|
1493
1495
|
switch (resolver) {
|
|
1494
1496
|
case "address":
|
package/package.json
CHANGED