nuxt-schema-org 6.1.3 → 6.2.1
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/devtools/components/schema-org/SchemaValidator.vue +326 -0
- package/dist/devtools/lib/schema-org/rpc.ts +47 -0
- package/dist/devtools/lib/schema-org/state.ts +15 -0
- package/dist/devtools/lib/schema-org/util/schema-validation.ts +470 -0
- package/dist/devtools/nuxt.config.ts +7 -0
- package/dist/devtools/pages/schema-org/debug.vue +23 -0
- package/dist/devtools/pages/schema-org/docs.vue +3 -0
- package/dist/devtools/pages/schema-org/index.vue +8 -0
- package/dist/devtools/pages/schema-org/raw.vue +25 -0
- package/dist/devtools/pages/schema-org.vue +56 -0
- package/dist/module.cjs +28 -7
- package/dist/module.d.cts +1 -1
- package/dist/module.d.mts +1 -1
- package/dist/module.d.ts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +28 -7
- package/dist/schema.cjs +2147 -9
- package/dist/schema.d.cts +185 -1
- package/dist/schema.d.mts +185 -1
- package/dist/schema.d.ts +185 -1
- package/dist/schema.mjs +2035 -1
- package/dist/shared/nuxt-schema-org.BQ-jW5j5.d.cts +2770 -0
- package/dist/shared/nuxt-schema-org.BQ-jW5j5.d.mts +2770 -0
- package/dist/shared/nuxt-schema-org.BQ-jW5j5.d.ts +2770 -0
- package/dist/vendor/schema-org-v2/LICENSE +21 -0
- package/dist/vendor/schema-org-v2/chunks/index.mjs +23 -0
- package/dist/vendor/schema-org-v2/chunks/index10.mjs +63 -0
- package/dist/vendor/schema-org-v2/chunks/index11.mjs +35 -0
- package/dist/vendor/schema-org-v2/chunks/index12.mjs +48 -0
- package/dist/vendor/schema-org-v2/chunks/index13.mjs +36 -0
- package/dist/vendor/schema-org-v2/chunks/index14.mjs +25 -0
- package/dist/vendor/schema-org-v2/chunks/index15.mjs +37 -0
- package/dist/vendor/schema-org-v2/chunks/index16.mjs +27 -0
- package/dist/vendor/schema-org-v2/chunks/index17.mjs +34 -0
- package/dist/vendor/schema-org-v2/chunks/index18.mjs +32 -0
- package/dist/vendor/schema-org-v2/chunks/index19.mjs +31 -0
- package/dist/vendor/schema-org-v2/chunks/index2.mjs +12 -0
- package/dist/vendor/schema-org-v2/chunks/index20.mjs +31 -0
- package/dist/vendor/schema-org-v2/chunks/index21.mjs +30 -0
- package/dist/vendor/schema-org-v2/chunks/index22.mjs +30 -0
- package/dist/vendor/schema-org-v2/chunks/index23.mjs +82 -0
- package/dist/vendor/schema-org-v2/chunks/index24.mjs +14 -0
- package/dist/vendor/schema-org-v2/chunks/index25.mjs +33 -0
- package/dist/vendor/schema-org-v2/chunks/index26.mjs +31 -0
- package/dist/vendor/schema-org-v2/chunks/index27.mjs +29 -0
- package/dist/vendor/schema-org-v2/chunks/index28.mjs +12 -0
- package/dist/vendor/schema-org-v2/chunks/index29.mjs +46 -0
- package/dist/vendor/schema-org-v2/chunks/index3.mjs +317 -0
- package/dist/vendor/schema-org-v2/chunks/index30.mjs +53 -0
- package/dist/vendor/schema-org-v2/chunks/index31.mjs +41 -0
- package/dist/vendor/schema-org-v2/chunks/index32.mjs +26 -0
- package/dist/vendor/schema-org-v2/chunks/index33.mjs +47 -0
- package/dist/vendor/schema-org-v2/chunks/index34.mjs +29 -0
- package/dist/vendor/schema-org-v2/chunks/index35.mjs +34 -0
- package/dist/vendor/schema-org-v2/chunks/index36.mjs +33 -0
- package/dist/vendor/schema-org-v2/chunks/index37.mjs +34 -0
- package/dist/vendor/schema-org-v2/chunks/index38.mjs +51 -0
- package/dist/vendor/schema-org-v2/chunks/index39.mjs +17 -0
- package/dist/vendor/schema-org-v2/chunks/index4.mjs +54 -0
- package/dist/vendor/schema-org-v2/chunks/index40.mjs +29 -0
- package/dist/vendor/schema-org-v2/chunks/index5.mjs +31 -0
- package/dist/vendor/schema-org-v2/chunks/index6.mjs +29 -0
- package/dist/vendor/schema-org-v2/chunks/index7.mjs +35 -0
- package/dist/vendor/schema-org-v2/chunks/index8.mjs +18 -0
- package/dist/vendor/schema-org-v2/chunks/index9.mjs +20 -0
- package/dist/vendor/schema-org-v2/index.d.mts +32 -0
- package/dist/vendor/schema-org-v2/index.d.ts +32 -0
- package/dist/vendor/schema-org-v2/index.mjs +46 -0
- package/dist/vendor/schema-org-v2/shared/schema-org.BR4WcSqZ.d.ts +21 -0
- package/dist/vendor/schema-org-v2/shared/schema-org.Ba7D0Hp1.mjs +19 -0
- package/dist/vendor/schema-org-v2/shared/schema-org.CAKsqzbX.d.ts +1022 -0
- package/dist/vendor/schema-org-v2/shared/schema-org.CFcsqFfN.d.mts +1824 -0
- package/dist/vendor/schema-org-v2/shared/schema-org.CFcsqFfN.d.ts +1824 -0
- package/dist/vendor/schema-org-v2/shared/schema-org.CHbRCiep.mjs +52 -0
- package/dist/vendor/schema-org-v2/shared/schema-org.Dryb3EoR.mjs +884 -0
- package/dist/vendor/schema-org-v2/shared/schema-org.F44ipjVJ.mjs +27 -0
- package/dist/vendor/schema-org-v2/shared/schema-org.UT1u1UYq.d.mts +1022 -0
- package/dist/vendor/schema-org-v2/shared/schema-org.oFHFm6my.d.mts +21 -0
- package/dist/vendor/schema-org-v2/vendor.json +4 -0
- package/dist/vendor/schema-org-v2/vue.d.mts +88 -0
- package/dist/vendor/schema-org-v2/vue.d.ts +88 -0
- package/dist/vendor/schema-org-v2/vue.mjs +262 -0
- package/dist/vendor/schema-org-v3/LICENSE +21 -0
- package/dist/vendor/schema-org-v3/index.d.mts +34 -0
- package/dist/vendor/schema-org-v3/index.d.ts +34 -0
- package/dist/vendor/schema-org-v3/index.mjs +4 -0
- package/dist/vendor/schema-org-v3/shared/schema-org.D9o9UOh2.d.mts +11 -0
- package/dist/vendor/schema-org-v3/shared/schema-org.DNQroCjX.d.mts +2770 -0
- package/dist/vendor/schema-org-v3/shared/schema-org.DNQroCjX.d.ts +2770 -0
- package/dist/vendor/schema-org-v3/shared/schema-org.DYFTMLZ0.mjs +2035 -0
- package/dist/vendor/schema-org-v3/shared/schema-org.DjDPlqPB.d.mts +150 -0
- package/dist/vendor/schema-org-v3/shared/schema-org.mKZYVZ3E.d.ts +150 -0
- package/dist/vendor/schema-org-v3/shared/schema-org.rS-TANmN.d.ts +11 -0
- package/dist/vendor/schema-org-v3/vendor.json +4 -0
- package/dist/vendor/schema-org-v3/vue.d.mts +100 -0
- package/dist/vendor/schema-org-v3/vue.d.ts +100 -0
- package/dist/vendor/schema-org-v3/vue.mjs +302 -0
- package/package.json +12 -12
- package/dist/devtools/200.html +0 -1
- package/dist/devtools/404.html +0 -1
- package/dist/devtools/_nuxt/B1DdtD2d.js +0 -30
- package/dist/devtools/_nuxt/BOpHBWj1.js +0 -1
- package/dist/devtools/_nuxt/BdQEHo9i.js +0 -1
- package/dist/devtools/_nuxt/BvDCh0XJ.js +0 -1
- package/dist/devtools/_nuxt/C6vgB62o.js +0 -1
- package/dist/devtools/_nuxt/CCjZBs6a.js +0 -3
- package/dist/devtools/_nuxt/CHHO6nw6.js +0 -1
- package/dist/devtools/_nuxt/CQr7N5ou.js +0 -6
- package/dist/devtools/_nuxt/CRABcd13.js +0 -1
- package/dist/devtools/_nuxt/Cy67RPmZ.js +0 -1
- package/dist/devtools/_nuxt/D-Oj-loM.js +0 -154
- package/dist/devtools/_nuxt/D6u4txBo.js +0 -1
- package/dist/devtools/_nuxt/DKZUJ--l.js +0 -1
- package/dist/devtools/_nuxt/DLXftbE1.js +0 -1
- package/dist/devtools/_nuxt/DevtoolsSnippet.CuW0O0Zu.css +0 -1
- package/dist/devtools/_nuxt/QcnxyHc5.js +0 -1
- package/dist/devtools/_nuxt/builds/latest.json +0 -1
- package/dist/devtools/_nuxt/builds/meta/b29085bd-1521-40f3-8c81-bdc818184bef.json +0 -1
- package/dist/devtools/_nuxt/entry.DprwPCib.css +0 -2
- package/dist/devtools/_nuxt/fira-code.Bc8wnsZt.woff2 +0 -0
- package/dist/devtools/_nuxt/hubot-sans.DLGyhQVu.woff2 +0 -0
- package/dist/devtools/_nuxt/pages.BpqfEWCe.css +0 -1
- package/dist/devtools/debug/index.html +0 -1
- package/dist/devtools/docs/index.html +0 -1
- package/dist/devtools/index.html +0 -1
- package/dist/devtools/nodes/index.html +0 -1
- package/dist/devtools/raw/index.html +0 -1
package/dist/schema.cjs
CHANGED
|
@@ -1,16 +1,2154 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const ufo = require('ufo');
|
|
4
|
+
const plugins = require('unhead/plugins');
|
|
5
|
+
const utils = require('unhead/utils');
|
|
4
6
|
|
|
7
|
+
function defineSchemaOrgResolver(schema) {
|
|
8
|
+
return schema;
|
|
9
|
+
}
|
|
5
10
|
|
|
11
|
+
function idReference(node) {
|
|
12
|
+
return {
|
|
13
|
+
"@id": typeof node !== "string" ? node["@id"] : node
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function resolvableDateToDate(val) {
|
|
17
|
+
try {
|
|
18
|
+
const date = val instanceof Date ? val : new Date(Date.parse(val));
|
|
19
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
20
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
21
|
+
return `${date.getFullYear()}-${month}-${day}`;
|
|
22
|
+
} catch {
|
|
23
|
+
}
|
|
24
|
+
return typeof val === "string" ? val : val.toString();
|
|
25
|
+
}
|
|
26
|
+
const IS_VALID_W3C_DATE = [
|
|
27
|
+
/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,
|
|
28
|
+
/^\d{4}-[01]\d-[0-3]\d$/,
|
|
29
|
+
/^\d{4}-[01]\d$/,
|
|
30
|
+
/^\d{4}$/
|
|
31
|
+
];
|
|
32
|
+
function isValidW3CDate(d) {
|
|
33
|
+
return IS_VALID_W3C_DATE.some((r) => r.test(d));
|
|
34
|
+
}
|
|
35
|
+
function resolvableDateToIso(val) {
|
|
36
|
+
if (!val)
|
|
37
|
+
return val;
|
|
38
|
+
try {
|
|
39
|
+
if (val instanceof Date)
|
|
40
|
+
return val.toISOString();
|
|
41
|
+
else if (isValidW3CDate(val))
|
|
42
|
+
return val;
|
|
43
|
+
else
|
|
44
|
+
return new Date(Date.parse(val)).toISOString();
|
|
45
|
+
} catch {
|
|
46
|
+
}
|
|
47
|
+
return typeof val === "string" ? val : val.toString();
|
|
48
|
+
}
|
|
49
|
+
const IdentityId = "#identity";
|
|
50
|
+
function setIfEmpty(node, field, value) {
|
|
51
|
+
if (node?.[field] === void 0 && value != null)
|
|
52
|
+
node[field] = value;
|
|
53
|
+
}
|
|
54
|
+
function asArray(input) {
|
|
55
|
+
return Array.isArray(input) ? input : [input];
|
|
56
|
+
}
|
|
57
|
+
function dedupeMerge(node, field, value) {
|
|
58
|
+
const data = new Set(asArray(node[field]));
|
|
59
|
+
data.add(value);
|
|
60
|
+
node[field] = [...data].filter(Boolean);
|
|
61
|
+
}
|
|
62
|
+
function prefixId(url, id) {
|
|
63
|
+
if (ufo.hasProtocol(id))
|
|
64
|
+
return id;
|
|
65
|
+
if (!id.includes("#"))
|
|
66
|
+
id = `#${id}`;
|
|
67
|
+
return `${url || ""}${id}`;
|
|
68
|
+
}
|
|
69
|
+
function trimLength(val, length) {
|
|
70
|
+
if (!val)
|
|
71
|
+
return val;
|
|
72
|
+
if (val.length > length) {
|
|
73
|
+
const trimmedString = val.substring(0, length);
|
|
74
|
+
return trimmedString.substring(0, Math.min(trimmedString.length, trimmedString.lastIndexOf(" ")));
|
|
75
|
+
}
|
|
76
|
+
return val;
|
|
77
|
+
}
|
|
78
|
+
function resolveDefaultType(node, defaultType) {
|
|
79
|
+
const val = node["@type"];
|
|
80
|
+
if (val === defaultType)
|
|
81
|
+
return;
|
|
82
|
+
if (typeof val === "string" && typeof defaultType === "string") {
|
|
83
|
+
if (val !== defaultType)
|
|
84
|
+
node["@type"] = [defaultType, val];
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const types = new Set(asArray(defaultType));
|
|
88
|
+
for (const t of asArray(val))
|
|
89
|
+
types.add(t);
|
|
90
|
+
node["@type"] = types.size === 1 ? val : [...types];
|
|
91
|
+
}
|
|
92
|
+
function resolveWithBase(base, urlOrPath) {
|
|
93
|
+
if (!urlOrPath || ufo.hasProtocol(urlOrPath) || urlOrPath[0] !== "/" && urlOrPath[0] !== "#")
|
|
94
|
+
return urlOrPath;
|
|
95
|
+
return ufo.withBase(urlOrPath, base);
|
|
96
|
+
}
|
|
97
|
+
function resolveAsGraphKey(key) {
|
|
98
|
+
if (!key)
|
|
99
|
+
return key;
|
|
100
|
+
return key.substring(key.lastIndexOf("#"));
|
|
101
|
+
}
|
|
102
|
+
function stripEmptyProperties(obj) {
|
|
103
|
+
for (const k in obj) {
|
|
104
|
+
if (!Object.hasOwn(obj, k))
|
|
105
|
+
continue;
|
|
106
|
+
const v = obj[k];
|
|
107
|
+
if (v === "" || v === void 0) {
|
|
108
|
+
delete obj[k];
|
|
109
|
+
} else if (typeof v === "object" && v !== null) {
|
|
110
|
+
if (v.__v_isReadonly || v.__v_isRef)
|
|
111
|
+
continue;
|
|
112
|
+
stripEmptyProperties(v);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return obj;
|
|
116
|
+
}
|
|
117
|
+
function stripNullProperties(obj) {
|
|
118
|
+
if (Array.isArray(obj)) {
|
|
119
|
+
for (let i = obj.length - 1; i >= 0; i--) {
|
|
120
|
+
const v = obj[i];
|
|
121
|
+
if (v === null)
|
|
122
|
+
obj.splice(i, 1);
|
|
123
|
+
else if (typeof v === "object" && v !== null)
|
|
124
|
+
stripNullProperties(v);
|
|
125
|
+
}
|
|
126
|
+
return obj;
|
|
127
|
+
}
|
|
128
|
+
for (const k in obj) {
|
|
129
|
+
if (!Object.hasOwn(obj, k))
|
|
130
|
+
continue;
|
|
131
|
+
const v = obj[k];
|
|
132
|
+
if (v === null) {
|
|
133
|
+
delete obj[k];
|
|
134
|
+
} else if (typeof v === "object") {
|
|
135
|
+
if (v.__v_isReadonly || v.__v_isRef)
|
|
136
|
+
continue;
|
|
137
|
+
stripNullProperties(v);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return obj;
|
|
141
|
+
}
|
|
6
142
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
143
|
+
const quantitativeValueResolver = defineSchemaOrgResolver({
|
|
144
|
+
cast(node) {
|
|
145
|
+
if (typeof node === "number") {
|
|
146
|
+
return {
|
|
147
|
+
value: node
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
return node;
|
|
151
|
+
},
|
|
152
|
+
defaults: {
|
|
153
|
+
"@type": "QuantitativeValue"
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
const monetaryAmountResolver = defineSchemaOrgResolver({
|
|
157
|
+
defaults: {
|
|
158
|
+
"@type": "MonetaryAmount"
|
|
159
|
+
},
|
|
160
|
+
resolve(node, ctx) {
|
|
161
|
+
if (typeof node.value !== "number")
|
|
162
|
+
node.value = resolveRelation(node.value, ctx, quantitativeValueResolver);
|
|
163
|
+
return node;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
const merchantReturnPolicyResolver = defineSchemaOrgResolver({
|
|
168
|
+
defaults: {
|
|
169
|
+
"@type": "MerchantReturnPolicy"
|
|
170
|
+
},
|
|
171
|
+
resolve(node, ctx) {
|
|
172
|
+
if (node.returnPolicyCategory)
|
|
173
|
+
node.returnPolicyCategory = ufo.withBase(node.returnPolicyCategory, "https://schema.org/");
|
|
174
|
+
if (node.returnFees)
|
|
175
|
+
node.returnFees = ufo.withBase(node.returnFees, "https://schema.org/");
|
|
176
|
+
if (node.returnMethod)
|
|
177
|
+
node.returnMethod = ufo.withBase(node.returnMethod, "https://schema.org/");
|
|
178
|
+
node.returnShippingFeesAmount = resolveRelation(node.returnShippingFeesAmount, ctx, monetaryAmountResolver);
|
|
179
|
+
return node;
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
const definedRegionResolver = defineSchemaOrgResolver({
|
|
184
|
+
defaults: {
|
|
185
|
+
"@type": "DefinedRegion"
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
const shippingDeliveryTimeResolver = defineSchemaOrgResolver({
|
|
190
|
+
defaults: {
|
|
191
|
+
"@type": "ShippingDeliveryTime"
|
|
192
|
+
},
|
|
193
|
+
resolve(node, ctx) {
|
|
194
|
+
node.handlingTime = resolveRelation(node.handlingTime, ctx, quantitativeValueResolver);
|
|
195
|
+
node.transitTime = resolveRelation(node.transitTime, ctx, quantitativeValueResolver);
|
|
196
|
+
return node;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
const offerShippingDetailsResolver = defineSchemaOrgResolver({
|
|
201
|
+
defaults: {
|
|
202
|
+
"@type": "OfferShippingDetails"
|
|
203
|
+
},
|
|
204
|
+
resolve(node, ctx) {
|
|
205
|
+
node.deliveryTime = resolveRelation(node.deliveryTime, ctx, shippingDeliveryTimeResolver);
|
|
206
|
+
node.shippingDestination = resolveRelation(node.shippingDestination, ctx, definedRegionResolver);
|
|
207
|
+
node.shippingRate = resolveRelation(node.shippingRate, ctx, monetaryAmountResolver);
|
|
208
|
+
return node;
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
const offerResolver = defineSchemaOrgResolver({
|
|
213
|
+
cast(node) {
|
|
214
|
+
if (typeof node === "number" || typeof node === "string") {
|
|
215
|
+
return {
|
|
216
|
+
price: node
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
return node;
|
|
220
|
+
},
|
|
221
|
+
defaults: {
|
|
222
|
+
"@type": "Offer",
|
|
223
|
+
"availability": "InStock"
|
|
224
|
+
},
|
|
225
|
+
resolve(node, ctx) {
|
|
226
|
+
setIfEmpty(node, "priceCurrency", ctx.meta.currency);
|
|
227
|
+
setIfEmpty(node, "priceValidUntil", new Date(Date.UTC((/* @__PURE__ */ new Date()).getFullYear() + 1, 12, -1, 0, 0, 0)));
|
|
228
|
+
if (node.url)
|
|
229
|
+
resolveWithBase(ctx.meta.host, node.url);
|
|
230
|
+
if (node.availability)
|
|
231
|
+
node.availability = ufo.withBase(node.availability, "https://schema.org/");
|
|
232
|
+
if (node.itemCondition)
|
|
233
|
+
node.itemCondition = ufo.withBase(node.itemCondition, "https://schema.org/");
|
|
234
|
+
if (node.priceValidUntil)
|
|
235
|
+
node.priceValidUntil = resolvableDateToIso(node.priceValidUntil);
|
|
236
|
+
node.hasMerchantReturnPolicy = resolveRelation(node.hasMerchantReturnPolicy, ctx, merchantReturnPolicyResolver);
|
|
237
|
+
node.shippingDetails = resolveRelation(node.shippingDetails, ctx, offerShippingDetailsResolver);
|
|
238
|
+
return node;
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
const aggregateOfferResolver = defineSchemaOrgResolver({
|
|
243
|
+
defaults: {
|
|
244
|
+
"@type": "AggregateOffer"
|
|
245
|
+
},
|
|
246
|
+
inheritMeta: [
|
|
247
|
+
{ meta: "currency", key: "priceCurrency" }
|
|
248
|
+
],
|
|
249
|
+
resolve(node, ctx) {
|
|
250
|
+
node.offers = resolveRelation(node.offers, ctx, offerResolver);
|
|
251
|
+
if (node.offers)
|
|
252
|
+
setIfEmpty(node, "offerCount", asArray(node.offers).length);
|
|
253
|
+
return node;
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
const aggregateRatingResolver = defineSchemaOrgResolver({
|
|
258
|
+
defaults: {
|
|
259
|
+
"@type": "AggregateRating"
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
const listItemResolver = defineSchemaOrgResolver({
|
|
264
|
+
cast(node) {
|
|
265
|
+
if (typeof node === "string") {
|
|
266
|
+
node = {
|
|
267
|
+
name: node
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
return node;
|
|
271
|
+
},
|
|
272
|
+
defaults: {
|
|
273
|
+
"@type": "ListItem"
|
|
274
|
+
},
|
|
275
|
+
resolve(node, ctx) {
|
|
276
|
+
if (typeof node.item === "string")
|
|
277
|
+
node.item = resolveWithBase(ctx.meta.host, node.item);
|
|
278
|
+
else if (typeof node.item === "object")
|
|
279
|
+
node.item = resolveRelation(node.item, ctx);
|
|
280
|
+
return node;
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
const PrimaryBreadcrumbId = "#breadcrumb";
|
|
285
|
+
const breadcrumbResolver = defineSchemaOrgResolver({
|
|
286
|
+
defaults: {
|
|
287
|
+
"@type": "BreadcrumbList"
|
|
288
|
+
},
|
|
289
|
+
idPrefix: ["url", PrimaryBreadcrumbId],
|
|
290
|
+
resolve(breadcrumb, ctx) {
|
|
291
|
+
if (breadcrumb.itemListElement) {
|
|
292
|
+
let index = 1;
|
|
293
|
+
breadcrumb.itemListElement = resolveRelation(breadcrumb.itemListElement, ctx, listItemResolver, {
|
|
294
|
+
array: true,
|
|
295
|
+
afterResolve(node) {
|
|
296
|
+
setIfEmpty(node, "position", index++);
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
return breadcrumb;
|
|
301
|
+
},
|
|
302
|
+
resolveRootNode(node, { find }) {
|
|
303
|
+
const webPage = find(PrimaryWebPageId);
|
|
304
|
+
if (webPage)
|
|
305
|
+
setIfEmpty(webPage, "breadcrumb", idReference(node));
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
const imageResolver = defineSchemaOrgResolver({
|
|
310
|
+
alias: "image",
|
|
311
|
+
cast(input) {
|
|
312
|
+
if (typeof input === "string") {
|
|
313
|
+
input = {
|
|
314
|
+
url: input
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
return input;
|
|
318
|
+
},
|
|
319
|
+
defaults: {
|
|
320
|
+
"@type": "ImageObject"
|
|
321
|
+
},
|
|
322
|
+
inheritMeta: [
|
|
323
|
+
// @todo possibly only do if there's a caption
|
|
324
|
+
"inLanguage"
|
|
325
|
+
],
|
|
326
|
+
idPrefix: "host",
|
|
327
|
+
resolve(image, { meta }) {
|
|
328
|
+
image.url = resolveWithBase(meta.host, image.url);
|
|
329
|
+
setIfEmpty(image, "contentUrl", image.url);
|
|
330
|
+
if (image.height && !image.width)
|
|
331
|
+
delete image.height;
|
|
332
|
+
if (image.width && !image.height)
|
|
333
|
+
delete image.width;
|
|
334
|
+
return image;
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
const addressResolver = defineSchemaOrgResolver({
|
|
339
|
+
defaults: {
|
|
340
|
+
"@type": "PostalAddress"
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
const searchActionResolver = defineSchemaOrgResolver({
|
|
345
|
+
defaults: {
|
|
346
|
+
"@type": "SearchAction",
|
|
347
|
+
"target": {
|
|
348
|
+
"@type": "EntryPoint"
|
|
349
|
+
},
|
|
350
|
+
"query-input": {
|
|
351
|
+
"@type": "PropertyValueSpecification",
|
|
352
|
+
"valueRequired": true,
|
|
353
|
+
"valueName": "search_term_string"
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
resolve(node, ctx) {
|
|
357
|
+
if (typeof node.target === "string") {
|
|
358
|
+
node.target = {
|
|
359
|
+
"@type": "EntryPoint",
|
|
360
|
+
"urlTemplate": resolveWithBase(ctx.meta.host, node.target)
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
return node;
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
const PrimaryWebSiteId = "#website";
|
|
368
|
+
const webSiteResolver = defineSchemaOrgResolver({
|
|
369
|
+
defaults: {
|
|
370
|
+
"@type": "WebSite"
|
|
371
|
+
},
|
|
372
|
+
inheritMeta: [
|
|
373
|
+
"inLanguage",
|
|
374
|
+
{ meta: "host", key: "url" }
|
|
375
|
+
],
|
|
376
|
+
idPrefix: ["host", PrimaryWebSiteId],
|
|
377
|
+
resolve(node, ctx) {
|
|
378
|
+
node.potentialAction = resolveRelation(node.potentialAction, ctx, searchActionResolver, {
|
|
379
|
+
array: true
|
|
380
|
+
});
|
|
381
|
+
node.publisher = resolveRelation(node.publisher, ctx);
|
|
382
|
+
node.dateModified = resolvableDateToIso(node.dateModified);
|
|
383
|
+
node.datePublished = resolvableDateToIso(node.datePublished);
|
|
384
|
+
return node;
|
|
385
|
+
},
|
|
386
|
+
resolveRootNode(node, { find }) {
|
|
387
|
+
if (resolveAsGraphKey(node["@id"]) === PrimaryWebSiteId) {
|
|
388
|
+
const identity = find(IdentityId);
|
|
389
|
+
if (identity)
|
|
390
|
+
setIfEmpty(node, "publisher", idReference(identity));
|
|
391
|
+
const webPage = find(PrimaryWebPageId);
|
|
392
|
+
if (webPage)
|
|
393
|
+
setIfEmpty(webPage, "isPartOf", idReference(node));
|
|
394
|
+
}
|
|
395
|
+
return node;
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
const organizationResolver = defineSchemaOrgResolver({
|
|
400
|
+
defaults: {
|
|
401
|
+
"@type": "Organization"
|
|
402
|
+
},
|
|
403
|
+
idPrefix: ["host", IdentityId],
|
|
404
|
+
inheritMeta: [
|
|
405
|
+
{ meta: "host", key: "url" }
|
|
406
|
+
],
|
|
407
|
+
resolve(node, ctx) {
|
|
408
|
+
resolveDefaultType(node, "Organization");
|
|
409
|
+
node.address = resolveRelation(node.address, ctx, addressResolver);
|
|
410
|
+
return node;
|
|
411
|
+
},
|
|
412
|
+
resolveRootNode(node, ctx) {
|
|
413
|
+
const isIdentity = resolveAsGraphKey(node["@id"]) === IdentityId;
|
|
414
|
+
const webPage = ctx.find(PrimaryWebPageId);
|
|
415
|
+
if (node.logo && isIdentity) {
|
|
416
|
+
if (!ctx.find("#organization")) {
|
|
417
|
+
const logoNode = resolveRelation(node.logo, ctx, imageResolver, {
|
|
418
|
+
root: true,
|
|
419
|
+
afterResolve(logo) {
|
|
420
|
+
logo["@id"] = prefixId(ctx.meta.host, "#logo");
|
|
421
|
+
setIfEmpty(logo, "caption", node.name);
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
if (webPage && logoNode)
|
|
425
|
+
setIfEmpty(webPage, "primaryImageOfPage", idReference(logoNode));
|
|
426
|
+
ctx.nodes.push({
|
|
427
|
+
// we want to make a simple node that has the essentials, this will allow parent nodes to inject
|
|
428
|
+
// as well without inserting invalid data (i.e LocalBusiness operatingHours)
|
|
429
|
+
"@type": "Organization",
|
|
430
|
+
"name": node.name,
|
|
431
|
+
"url": node.url,
|
|
432
|
+
"sameAs": node.sameAs,
|
|
433
|
+
// 'image': idReference(logoNode),
|
|
434
|
+
"address": node.address,
|
|
435
|
+
// needs to be a URL
|
|
436
|
+
"logo": resolveRelation(node.logo, ctx, imageResolver, { root: false }).url,
|
|
437
|
+
"_priority": -1,
|
|
438
|
+
"@id": prefixId(ctx.meta.host, "#organization")
|
|
439
|
+
// avoid the id so nothing can link to it
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
delete node.logo;
|
|
443
|
+
}
|
|
444
|
+
if (isIdentity && webPage)
|
|
445
|
+
setIfEmpty(webPage, "about", idReference(node));
|
|
446
|
+
const webSite = ctx.find(PrimaryWebSiteId);
|
|
447
|
+
if (webSite)
|
|
448
|
+
setIfEmpty(webSite, "publisher", idReference(node));
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
const readActionResolver = defineSchemaOrgResolver({
|
|
453
|
+
defaults: {
|
|
454
|
+
"@type": "ReadAction"
|
|
455
|
+
},
|
|
456
|
+
resolve(node, ctx) {
|
|
457
|
+
if (!node.target.includes(ctx.meta.url))
|
|
458
|
+
node.target.unshift(ctx.meta.url);
|
|
459
|
+
return node;
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
const PrimaryWebPageId = "#webpage";
|
|
464
|
+
const webPageResolver = defineSchemaOrgResolver({
|
|
465
|
+
defaults({ meta }) {
|
|
466
|
+
const endPath = ufo.withoutTrailingSlash(meta.url.substring(meta.url.lastIndexOf("/") + 1));
|
|
467
|
+
let type = "WebPage";
|
|
468
|
+
switch (endPath) {
|
|
469
|
+
case "about":
|
|
470
|
+
case "about-us":
|
|
471
|
+
type = "AboutPage";
|
|
472
|
+
break;
|
|
473
|
+
case "search":
|
|
474
|
+
type = "SearchResultsPage";
|
|
475
|
+
break;
|
|
476
|
+
case "checkout":
|
|
477
|
+
type = "CheckoutPage";
|
|
478
|
+
break;
|
|
479
|
+
case "contact":
|
|
480
|
+
case "get-in-touch":
|
|
481
|
+
case "contact-us":
|
|
482
|
+
type = "ContactPage";
|
|
483
|
+
break;
|
|
484
|
+
case "faq":
|
|
485
|
+
type = "FAQPage";
|
|
486
|
+
break;
|
|
487
|
+
}
|
|
488
|
+
const defaults = {
|
|
489
|
+
"@type": type
|
|
490
|
+
};
|
|
491
|
+
return defaults;
|
|
492
|
+
},
|
|
493
|
+
idPrefix: ["url", PrimaryWebPageId],
|
|
494
|
+
inheritMeta: [
|
|
495
|
+
{ meta: "title", key: "name" },
|
|
496
|
+
"description",
|
|
497
|
+
"datePublished",
|
|
498
|
+
"dateModified",
|
|
499
|
+
"url"
|
|
500
|
+
],
|
|
501
|
+
resolve(node, ctx) {
|
|
502
|
+
node.dateModified = resolvableDateToIso(node.dateModified);
|
|
503
|
+
node.datePublished = resolvableDateToIso(node.datePublished);
|
|
504
|
+
resolveDefaultType(node, "WebPage");
|
|
505
|
+
node.about = resolveRelation(node.about, ctx, organizationResolver);
|
|
506
|
+
node.breadcrumb = resolveRelation(node.breadcrumb, ctx, breadcrumbResolver);
|
|
507
|
+
node.author = resolveRelation(node.author, ctx, personResolver);
|
|
508
|
+
node.primaryImageOfPage = resolveRelation(node.primaryImageOfPage, ctx, imageResolver);
|
|
509
|
+
node.potentialAction = resolveRelation(node.potentialAction, ctx, readActionResolver);
|
|
510
|
+
if (node["@type"] === "WebPage" && ctx.meta.url) {
|
|
511
|
+
setIfEmpty(node, "potentialAction", [
|
|
512
|
+
{
|
|
513
|
+
"@type": "ReadAction",
|
|
514
|
+
"target": [ctx.meta.url]
|
|
515
|
+
}
|
|
516
|
+
]);
|
|
517
|
+
}
|
|
518
|
+
return node;
|
|
519
|
+
},
|
|
520
|
+
resolveRootNode(webPage, { find, meta }) {
|
|
521
|
+
const identity = find(IdentityId);
|
|
522
|
+
const webSite = find(PrimaryWebSiteId);
|
|
523
|
+
const logo = find("#logo");
|
|
524
|
+
if (identity && meta.url === meta.host)
|
|
525
|
+
setIfEmpty(webPage, "about", idReference(identity));
|
|
526
|
+
if (logo)
|
|
527
|
+
setIfEmpty(webPage, "primaryImageOfPage", idReference(logo));
|
|
528
|
+
if (webSite)
|
|
529
|
+
setIfEmpty(webPage, "isPartOf", idReference(webSite));
|
|
530
|
+
const breadcrumb = find(PrimaryBreadcrumbId);
|
|
531
|
+
if (breadcrumb)
|
|
532
|
+
setIfEmpty(webPage, "breadcrumb", idReference(breadcrumb));
|
|
533
|
+
return webPage;
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
const personResolver = defineSchemaOrgResolver({
|
|
538
|
+
cast(node) {
|
|
539
|
+
if (typeof node === "string") {
|
|
540
|
+
return {
|
|
541
|
+
name: node
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
return node;
|
|
545
|
+
},
|
|
546
|
+
defaults: {
|
|
547
|
+
"@type": "Person"
|
|
548
|
+
},
|
|
549
|
+
idPrefix: ["host", IdentityId],
|
|
550
|
+
resolve(node, ctx) {
|
|
551
|
+
if (node.url)
|
|
552
|
+
node.url = resolveWithBase(ctx.meta.host, node.url);
|
|
553
|
+
return node;
|
|
554
|
+
},
|
|
555
|
+
resolveRootNode(node, { find, meta }) {
|
|
556
|
+
if (resolveAsGraphKey(node["@id"]) === IdentityId) {
|
|
557
|
+
setIfEmpty(node, "url", meta.host);
|
|
558
|
+
const webPage = find(PrimaryWebPageId);
|
|
559
|
+
if (webPage)
|
|
560
|
+
setIfEmpty(webPage, "about", idReference(node));
|
|
561
|
+
const webSite = find(PrimaryWebSiteId);
|
|
562
|
+
if (webSite)
|
|
563
|
+
setIfEmpty(webSite, "publisher", idReference(node));
|
|
564
|
+
}
|
|
565
|
+
const article = find(PrimaryArticleId);
|
|
566
|
+
if (article)
|
|
567
|
+
setIfEmpty(article, "author", idReference(node));
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
const PrimaryArticleId = "#article";
|
|
572
|
+
const articleResolver = defineSchemaOrgResolver({
|
|
573
|
+
defaults: {
|
|
574
|
+
"@type": "Article"
|
|
575
|
+
},
|
|
576
|
+
inheritMeta: [
|
|
577
|
+
"inLanguage",
|
|
578
|
+
"description",
|
|
579
|
+
"image",
|
|
580
|
+
"dateModified",
|
|
581
|
+
"datePublished",
|
|
582
|
+
{ meta: "title", key: "headline" }
|
|
583
|
+
],
|
|
584
|
+
idPrefix: ["url", PrimaryArticleId],
|
|
585
|
+
resolve(node, ctx) {
|
|
586
|
+
node.author = resolveRelation(node.author, ctx, personResolver, {
|
|
587
|
+
root: true
|
|
588
|
+
});
|
|
589
|
+
node.publisher = resolveRelation(node.publisher, ctx);
|
|
590
|
+
node.dateModified = resolvableDateToIso(node.dateModified);
|
|
591
|
+
node.datePublished = resolvableDateToIso(node.datePublished);
|
|
592
|
+
resolveDefaultType(node, "Article");
|
|
593
|
+
node.headline = trimLength(node.headline, 110);
|
|
594
|
+
return node;
|
|
595
|
+
},
|
|
596
|
+
resolveRootNode(node, { find, meta }) {
|
|
597
|
+
const webPage = find(PrimaryWebPageId);
|
|
598
|
+
const identity = find(IdentityId);
|
|
599
|
+
if (node.image && !node.thumbnailUrl) {
|
|
600
|
+
const firstImage = asArray(node.image)[0];
|
|
601
|
+
if (typeof firstImage === "string")
|
|
602
|
+
setIfEmpty(node, "thumbnailUrl", resolveWithBase(meta.host, firstImage));
|
|
603
|
+
else if (firstImage?.["@id"])
|
|
604
|
+
setIfEmpty(node, "thumbnailUrl", find(firstImage["@id"])?.url);
|
|
605
|
+
}
|
|
606
|
+
if (identity) {
|
|
607
|
+
setIfEmpty(node, "publisher", idReference(identity));
|
|
608
|
+
setIfEmpty(node, "author", idReference(identity));
|
|
609
|
+
}
|
|
610
|
+
if (webPage) {
|
|
611
|
+
setIfEmpty(node, "isPartOf", idReference(webPage));
|
|
612
|
+
setIfEmpty(node, "mainEntityOfPage", idReference(webPage));
|
|
613
|
+
setIfEmpty(webPage, "potentialAction", [
|
|
614
|
+
{
|
|
615
|
+
"@type": "ReadAction",
|
|
616
|
+
"target": [meta.url]
|
|
617
|
+
}
|
|
618
|
+
]);
|
|
619
|
+
setIfEmpty(webPage, "dateModified", node.dateModified);
|
|
620
|
+
setIfEmpty(webPage, "datePublished", node.datePublished);
|
|
621
|
+
}
|
|
622
|
+
return node;
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
|
|
626
|
+
const bookEditionResolver = defineSchemaOrgResolver({
|
|
627
|
+
defaults: {
|
|
628
|
+
"@type": "Book"
|
|
629
|
+
},
|
|
630
|
+
inheritMeta: [
|
|
631
|
+
"inLanguage"
|
|
632
|
+
],
|
|
633
|
+
resolve(node, ctx) {
|
|
634
|
+
if (node.bookFormat)
|
|
635
|
+
node.bookFormat = ufo.withBase(node.bookFormat, "https://schema.org/");
|
|
636
|
+
if (node.datePublished)
|
|
637
|
+
node.datePublished = resolvableDateToDate(node.datePublished);
|
|
638
|
+
node.author = resolveRelation(node.author, ctx);
|
|
639
|
+
return node;
|
|
640
|
+
},
|
|
641
|
+
resolveRootNode(node, { find }) {
|
|
642
|
+
const identity = find(IdentityId);
|
|
643
|
+
if (identity)
|
|
644
|
+
setIfEmpty(node, "provider", idReference(identity));
|
|
645
|
+
return node;
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
const PrimaryBookId = "#book";
|
|
649
|
+
const bookResolver = defineSchemaOrgResolver({
|
|
650
|
+
defaults: {
|
|
651
|
+
"@type": "Book"
|
|
652
|
+
},
|
|
653
|
+
inheritMeta: [
|
|
654
|
+
"description",
|
|
655
|
+
"url",
|
|
656
|
+
{ meta: "title", key: "name" }
|
|
657
|
+
],
|
|
658
|
+
idPrefix: ["url", PrimaryBookId],
|
|
659
|
+
resolve(node, ctx) {
|
|
660
|
+
node.workExample = resolveRelation(node.workExample, ctx, bookEditionResolver);
|
|
661
|
+
node.author = resolveRelation(node.author, ctx);
|
|
662
|
+
if (node.url)
|
|
663
|
+
ufo.withBase(node.url, ctx.meta.host);
|
|
664
|
+
return node;
|
|
665
|
+
},
|
|
666
|
+
resolveRootNode(node, { find }) {
|
|
667
|
+
const identity = find(IdentityId);
|
|
668
|
+
if (identity)
|
|
669
|
+
setIfEmpty(node, "author", idReference(identity));
|
|
670
|
+
return node;
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
|
|
674
|
+
const commentResolver = defineSchemaOrgResolver({
|
|
675
|
+
defaults: {
|
|
676
|
+
"@type": "Comment"
|
|
677
|
+
},
|
|
678
|
+
idPrefix: "url",
|
|
679
|
+
resolve(node, ctx) {
|
|
680
|
+
node.author = resolveRelation(node.author, ctx, personResolver, {
|
|
681
|
+
root: true
|
|
682
|
+
});
|
|
683
|
+
node.dateCreated = resolvableDateToIso(node.dateCreated);
|
|
684
|
+
node.dateModified = resolvableDateToIso(node.dateModified);
|
|
685
|
+
return node;
|
|
686
|
+
},
|
|
687
|
+
resolveRootNode(node, { find }) {
|
|
688
|
+
const article = find(PrimaryArticleId);
|
|
689
|
+
if (article)
|
|
690
|
+
setIfEmpty(node, "about", idReference(article));
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
|
|
694
|
+
const courseResolver = defineSchemaOrgResolver({
|
|
695
|
+
defaults: {
|
|
696
|
+
"@type": "Course"
|
|
697
|
+
},
|
|
698
|
+
resolve(node, ctx) {
|
|
699
|
+
node.provider = resolveRelation(node.provider, ctx, organizationResolver, {
|
|
700
|
+
root: true
|
|
701
|
+
});
|
|
702
|
+
return node;
|
|
703
|
+
},
|
|
704
|
+
resolveRootNode(node, { find }) {
|
|
705
|
+
const identity = find(IdentityId);
|
|
706
|
+
if (identity)
|
|
707
|
+
setIfEmpty(node, "provider", idReference(identity));
|
|
708
|
+
return node;
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
|
|
712
|
+
const PrimaryDatasetId = "#dataset";
|
|
713
|
+
const datasetResolver = defineSchemaOrgResolver({
|
|
714
|
+
defaults: {
|
|
715
|
+
"@type": "Dataset"
|
|
716
|
+
},
|
|
717
|
+
inheritMeta: [
|
|
718
|
+
"description",
|
|
719
|
+
"url",
|
|
720
|
+
"dateModified",
|
|
721
|
+
"datePublished",
|
|
722
|
+
{ meta: "title", key: "name" }
|
|
723
|
+
],
|
|
724
|
+
idPrefix: ["url", PrimaryDatasetId],
|
|
725
|
+
resolve(node, ctx) {
|
|
726
|
+
resolveDefaultType(node, "Dataset");
|
|
727
|
+
node.creator = resolveRelation(node.creator, ctx, personResolver, {
|
|
728
|
+
root: true
|
|
729
|
+
});
|
|
730
|
+
node.dateModified = resolvableDateToIso(node.dateModified);
|
|
731
|
+
node.datePublished = resolvableDateToIso(node.datePublished);
|
|
732
|
+
return node;
|
|
733
|
+
}
|
|
734
|
+
});
|
|
735
|
+
|
|
736
|
+
const placeResolver = defineSchemaOrgResolver({
|
|
737
|
+
defaults: {
|
|
738
|
+
"@type": "Place"
|
|
739
|
+
},
|
|
740
|
+
resolve(node, ctx) {
|
|
741
|
+
if (typeof node.address !== "string")
|
|
742
|
+
node.address = resolveRelation(node.address, ctx, addressResolver);
|
|
743
|
+
return node;
|
|
744
|
+
}
|
|
745
|
+
});
|
|
746
|
+
|
|
747
|
+
const virtualLocationResolver = defineSchemaOrgResolver({
|
|
748
|
+
cast(node) {
|
|
749
|
+
if (typeof node === "string") {
|
|
750
|
+
return {
|
|
751
|
+
url: node
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
return node;
|
|
755
|
+
},
|
|
756
|
+
defaults: {
|
|
757
|
+
"@type": "VirtualLocation"
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
const PrimaryEventId = "#event";
|
|
762
|
+
const eventResolver = defineSchemaOrgResolver({
|
|
763
|
+
defaults: {
|
|
764
|
+
"@type": "Event"
|
|
765
|
+
},
|
|
766
|
+
inheritMeta: [
|
|
767
|
+
"inLanguage",
|
|
768
|
+
"description",
|
|
769
|
+
"image",
|
|
770
|
+
{ meta: "title", key: "name" }
|
|
771
|
+
],
|
|
772
|
+
idPrefix: ["url", PrimaryEventId],
|
|
773
|
+
resolve(node, ctx) {
|
|
774
|
+
if (node.location) {
|
|
775
|
+
const isVirtual = node.location === "string" || node.location?.url !== "undefined";
|
|
776
|
+
node.location = resolveRelation(node.location, ctx, isVirtual ? virtualLocationResolver : placeResolver);
|
|
777
|
+
}
|
|
778
|
+
node.performer = resolveRelation(node.performer, ctx, personResolver, {
|
|
779
|
+
root: true
|
|
780
|
+
});
|
|
781
|
+
node.organizer = resolveRelation(node.organizer, ctx, organizationResolver, {
|
|
782
|
+
root: true
|
|
783
|
+
});
|
|
784
|
+
node.offers = resolveRelation(node.offers, ctx, offerResolver);
|
|
785
|
+
if (node.eventAttendanceMode)
|
|
786
|
+
node.eventAttendanceMode = ufo.withBase(node.eventAttendanceMode, "https://schema.org/");
|
|
787
|
+
if (node.eventStatus)
|
|
788
|
+
node.eventStatus = ufo.withBase(node.eventStatus, "https://schema.org/");
|
|
789
|
+
const isOnline = node.eventStatus === "https://schema.org/EventMovedOnline";
|
|
790
|
+
const dates = ["startDate", "previousStartDate", "endDate"];
|
|
791
|
+
dates.forEach((date) => {
|
|
792
|
+
if (!isOnline) {
|
|
793
|
+
if (node[date] instanceof Date && node[date].getHours() === 0 && node[date].getMinutes() === 0)
|
|
794
|
+
node[date] = resolvableDateToDate(node[date]);
|
|
795
|
+
} else {
|
|
796
|
+
node[date] = resolvableDateToIso(node[date]);
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
setIfEmpty(node, "endDate", node.startDate);
|
|
800
|
+
return node;
|
|
801
|
+
},
|
|
802
|
+
resolveRootNode(node, { find }) {
|
|
803
|
+
const identity = find(IdentityId);
|
|
804
|
+
if (identity)
|
|
805
|
+
setIfEmpty(node, "organizer", idReference(identity));
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
const openingHoursResolver = defineSchemaOrgResolver({
|
|
810
|
+
defaults: {
|
|
811
|
+
"@type": "OpeningHoursSpecification",
|
|
812
|
+
"opens": "00:00",
|
|
813
|
+
"closes": "23:59"
|
|
814
|
+
}
|
|
815
|
+
});
|
|
816
|
+
|
|
817
|
+
const localBusinessResolver = defineSchemaOrgResolver({
|
|
818
|
+
defaults: {
|
|
819
|
+
"@type": ["Organization", "LocalBusiness"]
|
|
820
|
+
},
|
|
821
|
+
inheritMeta: [
|
|
822
|
+
{ key: "url", meta: "host" },
|
|
823
|
+
{ key: "currenciesAccepted", meta: "currency" }
|
|
824
|
+
],
|
|
825
|
+
idPrefix: ["host", IdentityId],
|
|
826
|
+
resolve(node, ctx) {
|
|
827
|
+
resolveDefaultType(node, ["Organization", "LocalBusiness"]);
|
|
828
|
+
node.address = resolveRelation(node.address, ctx, addressResolver);
|
|
829
|
+
node.openingHoursSpecification = resolveRelation(node.openingHoursSpecification, ctx, openingHoursResolver);
|
|
830
|
+
node = resolveNode({ ...node }, ctx, organizationResolver);
|
|
831
|
+
return node;
|
|
832
|
+
},
|
|
833
|
+
resolveRootNode(node, ctx) {
|
|
834
|
+
organizationResolver.resolveRootNode(node, ctx);
|
|
835
|
+
return node;
|
|
836
|
+
}
|
|
837
|
+
});
|
|
13
838
|
|
|
14
|
-
|
|
15
|
-
|
|
839
|
+
const ratingResolver = defineSchemaOrgResolver({
|
|
840
|
+
cast(node) {
|
|
841
|
+
if (node === "number") {
|
|
842
|
+
return {
|
|
843
|
+
ratingValue: node
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
return node;
|
|
847
|
+
},
|
|
848
|
+
defaults: {
|
|
849
|
+
"@type": "Rating",
|
|
850
|
+
"bestRating": 5,
|
|
851
|
+
"worstRating": 1
|
|
852
|
+
}
|
|
16
853
|
});
|
|
854
|
+
|
|
855
|
+
const foodEstablishmentResolver = defineSchemaOrgResolver({
|
|
856
|
+
defaults: {
|
|
857
|
+
"@type": ["Organization", "LocalBusiness", "FoodEstablishment"]
|
|
858
|
+
},
|
|
859
|
+
inheritMeta: [
|
|
860
|
+
{ key: "url", meta: "host" },
|
|
861
|
+
{ key: "currenciesAccepted", meta: "currency" }
|
|
862
|
+
],
|
|
863
|
+
idPrefix: ["host", IdentityId],
|
|
864
|
+
resolve(node, ctx) {
|
|
865
|
+
resolveDefaultType(node, ["Organization", "LocalBusiness", "FoodEstablishment"]);
|
|
866
|
+
node.starRating = resolveRelation(node.starRating, ctx, ratingResolver);
|
|
867
|
+
node = resolveNode(node, ctx, localBusinessResolver);
|
|
868
|
+
return node;
|
|
869
|
+
},
|
|
870
|
+
resolveRootNode(node, ctx) {
|
|
871
|
+
localBusinessResolver.resolveRootNode(node, ctx);
|
|
872
|
+
return node;
|
|
873
|
+
}
|
|
874
|
+
});
|
|
875
|
+
|
|
876
|
+
const howToStepDirectionResolver = defineSchemaOrgResolver({
|
|
877
|
+
cast(node) {
|
|
878
|
+
if (typeof node === "string") {
|
|
879
|
+
return {
|
|
880
|
+
text: node
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
return node;
|
|
884
|
+
},
|
|
885
|
+
defaults: {
|
|
886
|
+
"@type": "HowToDirection"
|
|
887
|
+
}
|
|
888
|
+
});
|
|
889
|
+
|
|
890
|
+
const howToStepResolver = defineSchemaOrgResolver({
|
|
891
|
+
cast(node) {
|
|
892
|
+
if (typeof node === "string") {
|
|
893
|
+
return {
|
|
894
|
+
text: node
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
return node;
|
|
898
|
+
},
|
|
899
|
+
defaults: {
|
|
900
|
+
"@type": "HowToStep"
|
|
901
|
+
},
|
|
902
|
+
resolve(step, ctx) {
|
|
903
|
+
if (step.url)
|
|
904
|
+
step.url = resolveWithBase(ctx.meta.url, step.url);
|
|
905
|
+
if (step.image) {
|
|
906
|
+
step.image = resolveRelation(step.image, ctx, imageResolver, {
|
|
907
|
+
root: true
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
if (step.itemListElement)
|
|
911
|
+
step.itemListElement = resolveRelation(step.itemListElement, ctx, howToStepDirectionResolver);
|
|
912
|
+
return step;
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
|
|
916
|
+
const HowToId = "#howto";
|
|
917
|
+
const howToResolver = defineSchemaOrgResolver({
|
|
918
|
+
defaults: {
|
|
919
|
+
"@type": "HowTo"
|
|
920
|
+
},
|
|
921
|
+
inheritMeta: [
|
|
922
|
+
"description",
|
|
923
|
+
"image",
|
|
924
|
+
"inLanguage",
|
|
925
|
+
{ meta: "title", key: "name" }
|
|
926
|
+
],
|
|
927
|
+
idPrefix: ["url", HowToId],
|
|
928
|
+
resolve(node, ctx) {
|
|
929
|
+
node.step = resolveRelation(node.step, ctx, howToStepResolver);
|
|
930
|
+
return node;
|
|
931
|
+
},
|
|
932
|
+
resolveRootNode(node, { find }) {
|
|
933
|
+
const webPage = find(PrimaryWebPageId);
|
|
934
|
+
if (webPage)
|
|
935
|
+
setIfEmpty(node, "mainEntityOfPage", idReference(webPage));
|
|
936
|
+
}
|
|
937
|
+
});
|
|
938
|
+
|
|
939
|
+
const itemListResolver = defineSchemaOrgResolver({
|
|
940
|
+
defaults: {
|
|
941
|
+
"@type": "ItemList"
|
|
942
|
+
},
|
|
943
|
+
resolve(node, ctx) {
|
|
944
|
+
if (node.itemListElement) {
|
|
945
|
+
let index = 1;
|
|
946
|
+
node.itemListElement = resolveRelation(node.itemListElement, ctx, listItemResolver, {
|
|
947
|
+
array: true,
|
|
948
|
+
afterResolve(node2) {
|
|
949
|
+
setIfEmpty(node2, "position", index++);
|
|
950
|
+
}
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
return node;
|
|
954
|
+
}
|
|
955
|
+
});
|
|
956
|
+
|
|
957
|
+
const jobPostingResolver = defineSchemaOrgResolver({
|
|
958
|
+
defaults: {
|
|
959
|
+
"@type": "JobPosting"
|
|
960
|
+
},
|
|
961
|
+
idPrefix: ["url", "#job-posting"],
|
|
962
|
+
resolve(node, ctx) {
|
|
963
|
+
node.datePosted = resolvableDateToIso(node.datePosted);
|
|
964
|
+
node.hiringOrganization = resolveRelation(node.hiringOrganization, ctx, organizationResolver);
|
|
965
|
+
node.jobLocation = resolveRelation(node.jobLocation, ctx, placeResolver);
|
|
966
|
+
node.baseSalary = resolveRelation(node.baseSalary, ctx, monetaryAmountResolver);
|
|
967
|
+
node.validThrough = resolvableDateToIso(node.validThrough);
|
|
968
|
+
return node;
|
|
969
|
+
},
|
|
970
|
+
resolveRootNode(jobPosting, { find }) {
|
|
971
|
+
const webPage = find(PrimaryWebPageId);
|
|
972
|
+
const identity = find(IdentityId);
|
|
973
|
+
if (identity)
|
|
974
|
+
setIfEmpty(jobPosting, "hiringOrganization", idReference(identity));
|
|
975
|
+
if (webPage)
|
|
976
|
+
setIfEmpty(jobPosting, "mainEntityOfPage", idReference(webPage));
|
|
977
|
+
return jobPosting;
|
|
978
|
+
}
|
|
979
|
+
});
|
|
980
|
+
|
|
981
|
+
const reviewResolver = defineSchemaOrgResolver({
|
|
982
|
+
defaults: {
|
|
983
|
+
"@type": "Review"
|
|
984
|
+
},
|
|
985
|
+
inheritMeta: [
|
|
986
|
+
"inLanguage"
|
|
987
|
+
],
|
|
988
|
+
resolve(review, ctx) {
|
|
989
|
+
review.reviewRating = resolveRelation(review.reviewRating, ctx, ratingResolver);
|
|
990
|
+
review.author = resolveRelation(review.author, ctx, personResolver);
|
|
991
|
+
return review;
|
|
992
|
+
}
|
|
993
|
+
});
|
|
994
|
+
|
|
995
|
+
const videoResolver = defineSchemaOrgResolver({
|
|
996
|
+
cast(input) {
|
|
997
|
+
if (typeof input === "string") {
|
|
998
|
+
input = {
|
|
999
|
+
url: input
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
return input;
|
|
1003
|
+
},
|
|
1004
|
+
alias: "video",
|
|
1005
|
+
defaults: {
|
|
1006
|
+
"@type": "VideoObject"
|
|
1007
|
+
},
|
|
1008
|
+
inheritMeta: [
|
|
1009
|
+
{ meta: "title", key: "name" },
|
|
1010
|
+
"description",
|
|
1011
|
+
"image",
|
|
1012
|
+
"inLanguage",
|
|
1013
|
+
{ meta: "datePublished", key: "uploadDate" }
|
|
1014
|
+
],
|
|
1015
|
+
idPrefix: "host",
|
|
1016
|
+
resolve(video, ctx) {
|
|
1017
|
+
if (video.uploadDate)
|
|
1018
|
+
video.uploadDate = resolvableDateToIso(video.uploadDate);
|
|
1019
|
+
video.url = resolveWithBase(ctx.meta.host, video.url);
|
|
1020
|
+
if (video.caption && !video.description)
|
|
1021
|
+
video.description = video.caption;
|
|
1022
|
+
if (!video.description)
|
|
1023
|
+
video.description = "No description";
|
|
1024
|
+
if (video.thumbnailUrl && (typeof video.thumbnailUrl === "string" || Array.isArray(video.thumbnailUrl))) {
|
|
1025
|
+
const images = asArray(video.thumbnailUrl).map((image) => resolveWithBase(ctx.meta.host, image));
|
|
1026
|
+
video.thumbnailUrl = images.length > 1 ? images : images[0];
|
|
1027
|
+
}
|
|
1028
|
+
if (video.thumbnail)
|
|
1029
|
+
video.thumbnail = resolveRelation(video.thumbnailUrl, ctx, imageResolver);
|
|
1030
|
+
return video;
|
|
1031
|
+
},
|
|
1032
|
+
resolveRootNode(video, { find }) {
|
|
1033
|
+
if (video.image && !video.thumbnail) {
|
|
1034
|
+
const firstImage = asArray(video.image)[0];
|
|
1035
|
+
setIfEmpty(video, "thumbnail", find(firstImage["@id"])?.url);
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
});
|
|
1039
|
+
|
|
1040
|
+
const movieResolver = defineSchemaOrgResolver({
|
|
1041
|
+
defaults: {
|
|
1042
|
+
"@type": "Movie"
|
|
1043
|
+
},
|
|
1044
|
+
resolve(node, ctx) {
|
|
1045
|
+
node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
|
|
1046
|
+
node.review = resolveRelation(node.review, ctx, reviewResolver);
|
|
1047
|
+
node.director = resolveRelation(node.director, ctx, personResolver);
|
|
1048
|
+
node.actor = resolveRelation(node.actor, ctx, personResolver);
|
|
1049
|
+
node.trailer = resolveRelation(node.trailer, ctx, videoResolver);
|
|
1050
|
+
node.productionCompany = resolveRelation(node.productionCompany, ctx, organizationResolver);
|
|
1051
|
+
if (node.dateCreated)
|
|
1052
|
+
node.dateCreated = resolvableDateToDate(node.dateCreated);
|
|
1053
|
+
return node;
|
|
1054
|
+
}
|
|
1055
|
+
});
|
|
1056
|
+
|
|
1057
|
+
const musicAlbumResolver = defineSchemaOrgResolver({
|
|
1058
|
+
defaults: {
|
|
1059
|
+
"@type": "MusicAlbum"
|
|
1060
|
+
},
|
|
1061
|
+
idPrefix: "host",
|
|
1062
|
+
resolve(node, ctx) {
|
|
1063
|
+
if (node.datePublished)
|
|
1064
|
+
node.datePublished = resolvableDateToIso(node.datePublished);
|
|
1065
|
+
if (node.url)
|
|
1066
|
+
node.url = resolveWithBase(ctx.meta.host, node.url);
|
|
1067
|
+
node.byArtist = resolveRelation(node.byArtist, ctx, personResolver);
|
|
1068
|
+
node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
|
|
1069
|
+
node.review = resolveRelation(node.review, ctx, reviewResolver);
|
|
1070
|
+
return node;
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
|
|
1074
|
+
const musicGroupResolver = defineSchemaOrgResolver({
|
|
1075
|
+
defaults: {
|
|
1076
|
+
"@type": "MusicGroup"
|
|
1077
|
+
},
|
|
1078
|
+
idPrefix: "host",
|
|
1079
|
+
inheritMeta: [
|
|
1080
|
+
{ meta: "host", key: "url" }
|
|
1081
|
+
],
|
|
1082
|
+
resolve(node, ctx) {
|
|
1083
|
+
if (node.foundingDate)
|
|
1084
|
+
node.foundingDate = resolvableDateToDate(node.foundingDate);
|
|
1085
|
+
if (node.dissolutionDate)
|
|
1086
|
+
node.dissolutionDate = resolvableDateToDate(node.dissolutionDate);
|
|
1087
|
+
if (node.url)
|
|
1088
|
+
node.url = resolveWithBase(ctx.meta.host, node.url);
|
|
1089
|
+
node.member = resolveRelation(node.member, ctx, personResolver);
|
|
1090
|
+
return node;
|
|
1091
|
+
}
|
|
1092
|
+
});
|
|
1093
|
+
|
|
1094
|
+
const musicPlaylistResolver = defineSchemaOrgResolver({
|
|
1095
|
+
defaults: {
|
|
1096
|
+
"@type": "MusicPlaylist"
|
|
1097
|
+
},
|
|
1098
|
+
idPrefix: "host",
|
|
1099
|
+
resolve(node, ctx) {
|
|
1100
|
+
if (node.datePublished)
|
|
1101
|
+
node.datePublished = resolvableDateToIso(node.datePublished);
|
|
1102
|
+
if (node.dateModified)
|
|
1103
|
+
node.dateModified = resolvableDateToIso(node.dateModified);
|
|
1104
|
+
if (node.url)
|
|
1105
|
+
node.url = resolveWithBase(ctx.meta.host, node.url);
|
|
1106
|
+
node.creator = resolveRelation(node.creator, ctx, personResolver);
|
|
1107
|
+
node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
|
|
1108
|
+
return node;
|
|
1109
|
+
}
|
|
1110
|
+
});
|
|
1111
|
+
|
|
1112
|
+
const musicRecordingResolver = defineSchemaOrgResolver({
|
|
1113
|
+
defaults: {
|
|
1114
|
+
"@type": "MusicRecording"
|
|
1115
|
+
},
|
|
1116
|
+
idPrefix: "host",
|
|
1117
|
+
resolve(node, ctx) {
|
|
1118
|
+
if (node.datePublished)
|
|
1119
|
+
node.datePublished = resolvableDateToIso(node.datePublished);
|
|
1120
|
+
if (node.url)
|
|
1121
|
+
node.url = resolveWithBase(ctx.meta.host, node.url);
|
|
1122
|
+
if (node.audio)
|
|
1123
|
+
node.audio = resolveWithBase(ctx.meta.host, node.audio);
|
|
1124
|
+
node.byArtist = resolveRelation(node.byArtist, ctx, personResolver);
|
|
1125
|
+
node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
|
|
1126
|
+
return node;
|
|
1127
|
+
}
|
|
1128
|
+
});
|
|
1129
|
+
|
|
1130
|
+
const podcastEpisodeResolver = defineSchemaOrgResolver({
|
|
1131
|
+
defaults: {
|
|
1132
|
+
"@type": "PodcastEpisode"
|
|
1133
|
+
},
|
|
1134
|
+
inheritMeta: [
|
|
1135
|
+
"inLanguage"
|
|
1136
|
+
],
|
|
1137
|
+
resolve(node, ctx) {
|
|
1138
|
+
node.author = resolveRelation(node.author, ctx, personResolver);
|
|
1139
|
+
node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
|
|
1140
|
+
node.review = resolveRelation(node.review, ctx, reviewResolver);
|
|
1141
|
+
if (node.datePublished)
|
|
1142
|
+
node.datePublished = resolvableDateToIso(node.datePublished);
|
|
1143
|
+
if (node.uploadDate)
|
|
1144
|
+
node.uploadDate = resolvableDateToIso(node.uploadDate);
|
|
1145
|
+
return node;
|
|
1146
|
+
}
|
|
1147
|
+
});
|
|
1148
|
+
|
|
1149
|
+
const podcastSeasonResolver = defineSchemaOrgResolver({
|
|
1150
|
+
defaults: {
|
|
1151
|
+
"@type": "PodcastSeason"
|
|
1152
|
+
},
|
|
1153
|
+
resolve(node, ctx) {
|
|
1154
|
+
node.actor = resolveRelation(node.actor, ctx, personResolver);
|
|
1155
|
+
node.director = resolveRelation(node.director, ctx, personResolver);
|
|
1156
|
+
node.productionCompany = resolveRelation(node.productionCompany, ctx, organizationResolver);
|
|
1157
|
+
node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
|
|
1158
|
+
if (node.datePublished)
|
|
1159
|
+
node.datePublished = resolvableDateToIso(node.datePublished);
|
|
1160
|
+
if (node.startDate)
|
|
1161
|
+
node.startDate = resolvableDateToIso(node.startDate);
|
|
1162
|
+
if (node.endDate)
|
|
1163
|
+
node.endDate = resolvableDateToIso(node.endDate);
|
|
1164
|
+
return node;
|
|
1165
|
+
}
|
|
1166
|
+
});
|
|
1167
|
+
|
|
1168
|
+
const podcastSeriesResolver = defineSchemaOrgResolver({
|
|
1169
|
+
defaults: {
|
|
1170
|
+
"@type": "PodcastSeries"
|
|
1171
|
+
},
|
|
1172
|
+
resolve(node, ctx) {
|
|
1173
|
+
node.author = resolveRelation(node.author, ctx, personResolver);
|
|
1174
|
+
node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
|
|
1175
|
+
if (node.datePublished)
|
|
1176
|
+
node.datePublished = resolvableDateToIso(node.datePublished);
|
|
1177
|
+
if (node.startDate)
|
|
1178
|
+
node.startDate = resolvableDateToIso(node.startDate);
|
|
1179
|
+
if (node.endDate)
|
|
1180
|
+
node.endDate = resolvableDateToIso(node.endDate);
|
|
1181
|
+
return node;
|
|
1182
|
+
}
|
|
1183
|
+
});
|
|
1184
|
+
|
|
1185
|
+
const ProductId = "#product";
|
|
1186
|
+
const productResolver = defineSchemaOrgResolver({
|
|
1187
|
+
defaults: {
|
|
1188
|
+
"@type": "Product"
|
|
1189
|
+
},
|
|
1190
|
+
inheritMeta: [
|
|
1191
|
+
"description",
|
|
1192
|
+
"image",
|
|
1193
|
+
{ meta: "title", key: "name" }
|
|
1194
|
+
],
|
|
1195
|
+
idPrefix: ["url", ProductId],
|
|
1196
|
+
resolve(node, ctx) {
|
|
1197
|
+
node.aggregateOffer = resolveRelation(node.aggregateOffer, ctx, aggregateOfferResolver);
|
|
1198
|
+
node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
|
|
1199
|
+
node.offers = resolveRelation(node.offers, ctx, offerResolver);
|
|
1200
|
+
node.review = resolveRelation(node.review, ctx, reviewResolver);
|
|
1201
|
+
return node;
|
|
1202
|
+
},
|
|
1203
|
+
resolveRootNode(product, { find }) {
|
|
1204
|
+
const webPage = find(PrimaryWebPageId);
|
|
1205
|
+
const identity = find(IdentityId);
|
|
1206
|
+
if (identity)
|
|
1207
|
+
setIfEmpty(product, "brand", idReference(identity));
|
|
1208
|
+
if (webPage)
|
|
1209
|
+
setIfEmpty(product, "mainEntityOfPage", idReference(webPage));
|
|
1210
|
+
return product;
|
|
1211
|
+
}
|
|
1212
|
+
});
|
|
1213
|
+
|
|
1214
|
+
const answerResolver = defineSchemaOrgResolver({
|
|
1215
|
+
cast(node) {
|
|
1216
|
+
if (typeof node === "string") {
|
|
1217
|
+
return {
|
|
1218
|
+
text: node
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
return node;
|
|
1222
|
+
},
|
|
1223
|
+
defaults: {
|
|
1224
|
+
"@type": "Answer"
|
|
1225
|
+
}
|
|
1226
|
+
});
|
|
1227
|
+
|
|
1228
|
+
const questionResolver = defineSchemaOrgResolver({
|
|
1229
|
+
defaults: {
|
|
1230
|
+
"@type": "Question"
|
|
1231
|
+
},
|
|
1232
|
+
inheritMeta: [
|
|
1233
|
+
"inLanguage"
|
|
1234
|
+
],
|
|
1235
|
+
idPrefix: "url",
|
|
1236
|
+
resolve(question, ctx) {
|
|
1237
|
+
if (question.question) {
|
|
1238
|
+
question.name = question.question;
|
|
1239
|
+
delete question.question;
|
|
1240
|
+
}
|
|
1241
|
+
if (question.answer) {
|
|
1242
|
+
question.acceptedAnswer = question.answer;
|
|
1243
|
+
delete question.answer;
|
|
1244
|
+
}
|
|
1245
|
+
question.acceptedAnswer = resolveRelation(question.acceptedAnswer, ctx, answerResolver);
|
|
1246
|
+
question.dateCreated = resolvableDateToIso(question.dateCreated);
|
|
1247
|
+
return question;
|
|
1248
|
+
},
|
|
1249
|
+
resolveRootNode(question, { find }) {
|
|
1250
|
+
const webPage = find(PrimaryWebPageId);
|
|
1251
|
+
if (webPage && asArray(webPage["@type"]).includes("FAQPage"))
|
|
1252
|
+
dedupeMerge(webPage, "mainEntity", idReference(question));
|
|
1253
|
+
}
|
|
1254
|
+
});
|
|
1255
|
+
|
|
1256
|
+
const RecipeId = "#recipe";
|
|
1257
|
+
const recipeResolver = defineSchemaOrgResolver({
|
|
1258
|
+
defaults: {
|
|
1259
|
+
"@type": "Recipe"
|
|
1260
|
+
},
|
|
1261
|
+
inheritMeta: [
|
|
1262
|
+
{ meta: "title", key: "name" },
|
|
1263
|
+
"description",
|
|
1264
|
+
"image",
|
|
1265
|
+
"datePublished"
|
|
1266
|
+
],
|
|
1267
|
+
idPrefix: ["url", RecipeId],
|
|
1268
|
+
resolve(node, ctx) {
|
|
1269
|
+
node.recipeInstructions = resolveRelation(node.recipeInstructions, ctx, howToStepResolver);
|
|
1270
|
+
return node;
|
|
1271
|
+
},
|
|
1272
|
+
resolveRootNode(node, { find }) {
|
|
1273
|
+
const article = find(PrimaryArticleId);
|
|
1274
|
+
const webPage = find(PrimaryWebPageId);
|
|
1275
|
+
if (article)
|
|
1276
|
+
setIfEmpty(node, "mainEntityOfPage", idReference(article));
|
|
1277
|
+
else if (webPage)
|
|
1278
|
+
setIfEmpty(node, "mainEntityOfPage", idReference(webPage));
|
|
1279
|
+
if (article?.author)
|
|
1280
|
+
setIfEmpty(node, "author", article.author);
|
|
1281
|
+
return node;
|
|
1282
|
+
}
|
|
1283
|
+
});
|
|
1284
|
+
|
|
1285
|
+
const ServiceId = "#service";
|
|
1286
|
+
const serviceResolver = defineSchemaOrgResolver({
|
|
1287
|
+
defaults: {
|
|
1288
|
+
"@type": "Service"
|
|
1289
|
+
},
|
|
1290
|
+
inheritMeta: [
|
|
1291
|
+
"description",
|
|
1292
|
+
"image",
|
|
1293
|
+
{ meta: "title", key: "name" }
|
|
1294
|
+
],
|
|
1295
|
+
idPrefix: ["url", ServiceId],
|
|
1296
|
+
resolve(node, ctx) {
|
|
1297
|
+
resolveDefaultType(node, "Service");
|
|
1298
|
+
node.offers = resolveRelation(node.offers, ctx, offerResolver);
|
|
1299
|
+
node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
|
|
1300
|
+
node.review = resolveRelation(node.review, ctx, reviewResolver);
|
|
1301
|
+
return node;
|
|
1302
|
+
},
|
|
1303
|
+
resolveRootNode(service, { find }) {
|
|
1304
|
+
const webPage = find(PrimaryWebPageId);
|
|
1305
|
+
const identity = find(IdentityId);
|
|
1306
|
+
if (identity)
|
|
1307
|
+
setIfEmpty(service, "provider", idReference(identity));
|
|
1308
|
+
if (identity)
|
|
1309
|
+
setIfEmpty(service, "brand", idReference(identity));
|
|
1310
|
+
if (webPage)
|
|
1311
|
+
setIfEmpty(service, "mainEntityOfPage", idReference(webPage));
|
|
1312
|
+
return service;
|
|
1313
|
+
}
|
|
1314
|
+
});
|
|
1315
|
+
|
|
1316
|
+
const softwareAppResolver = defineSchemaOrgResolver({
|
|
1317
|
+
defaults: {
|
|
1318
|
+
"@type": "SoftwareApplication"
|
|
1319
|
+
},
|
|
1320
|
+
resolve(node, ctx) {
|
|
1321
|
+
resolveDefaultType(node, "SoftwareApplication");
|
|
1322
|
+
node.offers = resolveRelation(node.offers, ctx, offerResolver);
|
|
1323
|
+
node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
|
|
1324
|
+
node.review = resolveRelation(node.review, ctx, reviewResolver);
|
|
1325
|
+
return node;
|
|
1326
|
+
}
|
|
1327
|
+
});
|
|
1328
|
+
|
|
1329
|
+
const tvEpisodeResolver = defineSchemaOrgResolver({
|
|
1330
|
+
defaults: {
|
|
1331
|
+
"@type": "TVEpisode"
|
|
1332
|
+
},
|
|
1333
|
+
resolve(node, ctx) {
|
|
1334
|
+
node.actor = resolveRelation(node.actor, ctx, personResolver);
|
|
1335
|
+
node.director = resolveRelation(node.director, ctx, personResolver);
|
|
1336
|
+
node.musicBy = resolveRelation(node.musicBy, ctx, personResolver);
|
|
1337
|
+
node.video = resolveRelation(node.video, ctx, videoResolver);
|
|
1338
|
+
node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
|
|
1339
|
+
node.review = resolveRelation(node.review, ctx, reviewResolver);
|
|
1340
|
+
if (node.datePublished)
|
|
1341
|
+
node.datePublished = resolvableDateToIso(node.datePublished);
|
|
1342
|
+
if (node.uploadDate)
|
|
1343
|
+
node.uploadDate = resolvableDateToIso(node.uploadDate);
|
|
1344
|
+
return node;
|
|
1345
|
+
}
|
|
1346
|
+
});
|
|
1347
|
+
|
|
1348
|
+
const tvSeasonResolver = defineSchemaOrgResolver({
|
|
1349
|
+
defaults: {
|
|
1350
|
+
"@type": "TVSeason"
|
|
1351
|
+
},
|
|
1352
|
+
resolve(node, ctx) {
|
|
1353
|
+
node.actor = resolveRelation(node.actor, ctx, personResolver);
|
|
1354
|
+
node.director = resolveRelation(node.director, ctx, personResolver);
|
|
1355
|
+
node.productionCompany = resolveRelation(node.productionCompany, ctx, organizationResolver);
|
|
1356
|
+
node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
|
|
1357
|
+
node.trailer = resolveRelation(node.trailer, ctx, videoResolver);
|
|
1358
|
+
if (node.datePublished)
|
|
1359
|
+
node.datePublished = resolvableDateToIso(node.datePublished);
|
|
1360
|
+
if (node.startDate)
|
|
1361
|
+
node.startDate = resolvableDateToIso(node.startDate);
|
|
1362
|
+
if (node.endDate)
|
|
1363
|
+
node.endDate = resolvableDateToIso(node.endDate);
|
|
1364
|
+
return node;
|
|
1365
|
+
}
|
|
1366
|
+
});
|
|
1367
|
+
|
|
1368
|
+
const tvSeriesResolver = defineSchemaOrgResolver({
|
|
1369
|
+
defaults: {
|
|
1370
|
+
"@type": "TVSeries"
|
|
1371
|
+
},
|
|
1372
|
+
resolve(node, ctx) {
|
|
1373
|
+
node.actor = resolveRelation(node.actor, ctx, personResolver);
|
|
1374
|
+
node.director = resolveRelation(node.director, ctx, personResolver);
|
|
1375
|
+
node.creator = resolveRelation(node.creator, ctx, personResolver);
|
|
1376
|
+
node.productionCompany = resolveRelation(node.productionCompany, ctx, organizationResolver);
|
|
1377
|
+
node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
|
|
1378
|
+
node.trailer = resolveRelation(node.trailer, ctx, videoResolver);
|
|
1379
|
+
if (node.datePublished)
|
|
1380
|
+
node.datePublished = resolvableDateToIso(node.datePublished);
|
|
1381
|
+
if (node.startDate)
|
|
1382
|
+
node.startDate = resolvableDateToIso(node.startDate);
|
|
1383
|
+
if (node.endDate)
|
|
1384
|
+
node.endDate = resolvableDateToIso(node.endDate);
|
|
1385
|
+
return node;
|
|
1386
|
+
}
|
|
1387
|
+
});
|
|
1388
|
+
|
|
1389
|
+
const ALIAS_RE = /([a-z])([A-Z])/g;
|
|
1390
|
+
function nextNodeId(ctx, alias) {
|
|
1391
|
+
ctx.nodeIdCounters[alias] = (ctx.nodeIdCounters[alias] || 0) + 1;
|
|
1392
|
+
return ctx.nodeIdCounters[alias].toString();
|
|
1393
|
+
}
|
|
1394
|
+
function resolveMeta(meta) {
|
|
1395
|
+
if (!meta.path)
|
|
1396
|
+
meta.path = "/";
|
|
1397
|
+
if (!meta.host && typeof document !== "undefined")
|
|
1398
|
+
meta.host = document.location.host;
|
|
1399
|
+
if (meta.path !== "/") {
|
|
1400
|
+
if (meta.trailingSlash && !ufo.hasTrailingSlash(meta.path))
|
|
1401
|
+
meta.path = ufo.withTrailingSlash(meta.path);
|
|
1402
|
+
else if (!meta.trailingSlash && ufo.hasTrailingSlash(meta.path))
|
|
1403
|
+
meta.path = ufo.withoutTrailingSlash(meta.path);
|
|
1404
|
+
}
|
|
1405
|
+
meta.url = ufo.joinURL(meta.host || "", meta.path);
|
|
1406
|
+
return {
|
|
1407
|
+
...meta,
|
|
1408
|
+
host: meta.host,
|
|
1409
|
+
url: meta.url,
|
|
1410
|
+
currency: meta.currency,
|
|
1411
|
+
image: meta.image,
|
|
1412
|
+
inLanguage: meta.inLanguage,
|
|
1413
|
+
title: meta.title,
|
|
1414
|
+
description: meta.description,
|
|
1415
|
+
datePublished: meta.datePublished,
|
|
1416
|
+
dateModified: meta.dateModified
|
|
1417
|
+
};
|
|
1418
|
+
}
|
|
1419
|
+
function resolveNode(node, ctx, resolver) {
|
|
1420
|
+
if (resolver?.cast)
|
|
1421
|
+
node = resolver.cast(node, ctx);
|
|
1422
|
+
if (resolver?.defaults) {
|
|
1423
|
+
let defaults = resolver.defaults;
|
|
1424
|
+
if (typeof defaults === "function")
|
|
1425
|
+
defaults = defaults(ctx);
|
|
1426
|
+
node = { ...defaults, ...node };
|
|
1427
|
+
}
|
|
1428
|
+
const inheritMeta = resolver?.inheritMeta;
|
|
1429
|
+
if (inheritMeta) {
|
|
1430
|
+
for (let i = 0; i < inheritMeta.length; i++) {
|
|
1431
|
+
const entry = inheritMeta[i];
|
|
1432
|
+
if (typeof entry === "string")
|
|
1433
|
+
setIfEmpty(node, entry, ctx.meta[entry]);
|
|
1434
|
+
else
|
|
1435
|
+
setIfEmpty(node, entry.key, ctx.meta[entry.meta]);
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
if (resolver?.resolve)
|
|
1439
|
+
node = resolver.resolve(node, ctx);
|
|
1440
|
+
for (const k in node) {
|
|
1441
|
+
const v = node[k];
|
|
1442
|
+
if (Array.isArray(v)) {
|
|
1443
|
+
for (let i = 0; i < v.length; i++) {
|
|
1444
|
+
const item = v[i];
|
|
1445
|
+
if (typeof item === "object" && item?._resolver)
|
|
1446
|
+
node[k][i] = resolveRelation(item, ctx, item._resolver);
|
|
1447
|
+
}
|
|
1448
|
+
} else if (typeof v === "object" && v?._resolver) {
|
|
1449
|
+
node[k] = resolveRelation(v, ctx, v._resolver);
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
stripEmptyProperties(node);
|
|
1453
|
+
return node;
|
|
1454
|
+
}
|
|
1455
|
+
function resolveNodeId(node, ctx, resolver, resolveAsRoot = false) {
|
|
1456
|
+
if (node["@id"] && node["@id"].startsWith("http"))
|
|
1457
|
+
return node;
|
|
1458
|
+
const prefix = resolver ? (Array.isArray(resolver.idPrefix) ? resolver.idPrefix[0] : resolver.idPrefix) || "url" : "url";
|
|
1459
|
+
const rootId = node["@id"] || (resolver ? Array.isArray(resolver.idPrefix) ? resolver.idPrefix?.[1] : void 0 : "");
|
|
1460
|
+
if (!node["@id"] && resolveAsRoot && rootId) {
|
|
1461
|
+
node["@id"] = prefixId(ctx.meta[prefix], rootId);
|
|
1462
|
+
return node;
|
|
1463
|
+
}
|
|
1464
|
+
if (node["@id"]?.startsWith("#/schema/") || node["@id"]?.startsWith("/")) {
|
|
1465
|
+
node["@id"] = prefixId(ctx.meta[prefix], node["@id"]);
|
|
1466
|
+
return node;
|
|
1467
|
+
}
|
|
1468
|
+
let alias = resolver?.alias;
|
|
1469
|
+
if (!alias) {
|
|
1470
|
+
const type = asArray(node["@type"])?.[0] || "";
|
|
1471
|
+
alias = type.replace(ALIAS_RE, "$1-$2").toLowerCase();
|
|
1472
|
+
}
|
|
1473
|
+
node["@id"] = prefixId(ctx.meta[prefix], `#/schema/${alias}/${node["@id"] || nextNodeId(ctx, alias)}`);
|
|
1474
|
+
return node;
|
|
1475
|
+
}
|
|
1476
|
+
function resolveRelation(input, ctx, fallbackResolver, options = {}) {
|
|
1477
|
+
if (!input)
|
|
1478
|
+
return input;
|
|
1479
|
+
const items = asArray(input);
|
|
1480
|
+
const ids = [];
|
|
1481
|
+
for (let i = 0; i < items.length; i++) {
|
|
1482
|
+
const a = items[i];
|
|
1483
|
+
let keyCount = 0;
|
|
1484
|
+
for (const _ in a) keyCount++;
|
|
1485
|
+
if (keyCount === 1 && a["@id"] || keyCount === 2 && a["@id"] && a["@type"]) {
|
|
1486
|
+
ids.push(resolveNodeId({
|
|
1487
|
+
"@id": ctx.find(a["@id"])?.["@id"] || a["@id"]
|
|
1488
|
+
}, ctx));
|
|
1489
|
+
continue;
|
|
1490
|
+
}
|
|
1491
|
+
let resolver = fallbackResolver;
|
|
1492
|
+
if (a._resolver && typeof a._resolver !== "string") {
|
|
1493
|
+
resolver = a._resolver;
|
|
1494
|
+
delete a._resolver;
|
|
1495
|
+
}
|
|
1496
|
+
if (!resolver) {
|
|
1497
|
+
ids.push(a);
|
|
1498
|
+
continue;
|
|
1499
|
+
}
|
|
1500
|
+
let node = resolveNode(a, ctx, resolver);
|
|
1501
|
+
if (options.afterResolve)
|
|
1502
|
+
options.afterResolve(node);
|
|
1503
|
+
if (options.generateId || options.root)
|
|
1504
|
+
node = resolveNodeId(node, ctx, resolver, false);
|
|
1505
|
+
if (options.root) {
|
|
1506
|
+
if (resolver.resolveRootNode)
|
|
1507
|
+
resolver.resolveRootNode(node, ctx);
|
|
1508
|
+
ctx.push(node);
|
|
1509
|
+
ids.push(idReference(node["@id"]));
|
|
1510
|
+
continue;
|
|
1511
|
+
}
|
|
1512
|
+
ids.push(node);
|
|
1513
|
+
}
|
|
1514
|
+
return !options.array && ids.length === 1 ? ids[0] : ids;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
const UNSAFE_KEYS$1 = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
1518
|
+
function merge(target, source) {
|
|
1519
|
+
if (!source)
|
|
1520
|
+
return target;
|
|
1521
|
+
for (const key in source) {
|
|
1522
|
+
if (!Object.hasOwn(source, key) || UNSAFE_KEYS$1.has(key))
|
|
1523
|
+
continue;
|
|
1524
|
+
const value = source[key];
|
|
1525
|
+
if (value === void 0)
|
|
1526
|
+
continue;
|
|
1527
|
+
if (Array.isArray(target[key])) {
|
|
1528
|
+
if (Array.isArray(value)) {
|
|
1529
|
+
const merged = [...target[key], ...value];
|
|
1530
|
+
if (key === "@type") {
|
|
1531
|
+
target[key] = [...new Set(merged)];
|
|
1532
|
+
} else if (key === "itemListElement") {
|
|
1533
|
+
merged.sort((a, b) => (a.position || 0) - (b.position || 0));
|
|
1534
|
+
for (let i = 0; i < merged.length; i++)
|
|
1535
|
+
merged[i].position = i + 1;
|
|
1536
|
+
target[key] = merged;
|
|
1537
|
+
} else if (key === "potentialAction") {
|
|
1538
|
+
const byType = /* @__PURE__ */ Object.create(null);
|
|
1539
|
+
for (const action of merged) {
|
|
1540
|
+
const type = action["@type"];
|
|
1541
|
+
if (byType[type]) {
|
|
1542
|
+
if (action.target && byType[type].target) {
|
|
1543
|
+
const a = Array.isArray(byType[type].target) ? byType[type].target : [byType[type].target];
|
|
1544
|
+
const b = Array.isArray(action.target) ? action.target : [action.target];
|
|
1545
|
+
byType[type].target = [.../* @__PURE__ */ new Set([...a, ...b])];
|
|
1546
|
+
}
|
|
1547
|
+
} else {
|
|
1548
|
+
byType[type] = { ...action };
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
target[key] = Object.values(byType);
|
|
1552
|
+
} else {
|
|
1553
|
+
const hasTypedObjects = merged.length > 0 && merged.every(
|
|
1554
|
+
(item) => item && typeof item === "object" && item["@type"]
|
|
1555
|
+
);
|
|
1556
|
+
if (hasTypedObjects) {
|
|
1557
|
+
const byType = /* @__PURE__ */ Object.create(null);
|
|
1558
|
+
for (const item of merged)
|
|
1559
|
+
byType[item["@type"]] = item;
|
|
1560
|
+
target[key] = Object.values(byType);
|
|
1561
|
+
} else {
|
|
1562
|
+
target[key] = merged;
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
} else {
|
|
1566
|
+
target[key] = merge(target[key], [value]);
|
|
1567
|
+
}
|
|
1568
|
+
} else if (target[key] && typeof target[key] === "object" && typeof value === "object" && !Array.isArray(value)) {
|
|
1569
|
+
target[key] = merge({ ...target[key] }, value);
|
|
1570
|
+
} else {
|
|
1571
|
+
target[key] = value;
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
return target;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
const DOMAIN_RE = /(?:https?:)?\/\//;
|
|
1578
|
+
function indexNode(index, node) {
|
|
1579
|
+
if (!node["@id"])
|
|
1580
|
+
return;
|
|
1581
|
+
const nodeId = node["@id"];
|
|
1582
|
+
const fragmentKey = resolveAsGraphKey(nodeId);
|
|
1583
|
+
index.set(fragmentKey, node);
|
|
1584
|
+
index.set(nodeId, node);
|
|
1585
|
+
const domainKey = nodeId.replace(DOMAIN_RE, "").split("/")[0];
|
|
1586
|
+
index.set(domainKey, node);
|
|
1587
|
+
}
|
|
1588
|
+
function createSchemaOrgGraph() {
|
|
1589
|
+
const ctx = {
|
|
1590
|
+
find(id) {
|
|
1591
|
+
let resolver = (s) => s;
|
|
1592
|
+
if (id[0] === "#") {
|
|
1593
|
+
resolver = resolveAsGraphKey;
|
|
1594
|
+
} else if (id[0] === "/") {
|
|
1595
|
+
resolver = (s) => s.replace(DOMAIN_RE, "").split("/")[0];
|
|
1596
|
+
}
|
|
1597
|
+
const key = resolver(id);
|
|
1598
|
+
if (ctx.nodeIndex.size > 0) {
|
|
1599
|
+
return ctx.nodeIndex.get(key) || null;
|
|
1600
|
+
}
|
|
1601
|
+
return ctx.nodes.filter((n) => !!n["@id"]).find((n) => resolver(n["@id"]) === key);
|
|
1602
|
+
},
|
|
1603
|
+
push(input) {
|
|
1604
|
+
asArray(input).forEach((node) => {
|
|
1605
|
+
const registeredNode = node;
|
|
1606
|
+
ctx.nodes.push(registeredNode);
|
|
1607
|
+
if (ctx.nodeIndex.size > 0)
|
|
1608
|
+
indexNode(ctx.nodeIndex, registeredNode);
|
|
1609
|
+
});
|
|
1610
|
+
},
|
|
1611
|
+
resolveGraph(meta) {
|
|
1612
|
+
for (const k in ctx.nodeIdCounters) delete ctx.nodeIdCounters[k];
|
|
1613
|
+
ctx.meta = resolveMeta({ ...meta });
|
|
1614
|
+
const len = ctx.nodes.length;
|
|
1615
|
+
for (let i = 0; i < len; i++) {
|
|
1616
|
+
let node = ctx.nodes[i];
|
|
1617
|
+
const resolver = node._resolver;
|
|
1618
|
+
node = resolveNode(node, ctx, resolver);
|
|
1619
|
+
node = resolveNodeId(node, ctx, resolver, true);
|
|
1620
|
+
ctx.nodes[i] = node;
|
|
1621
|
+
}
|
|
1622
|
+
const dedupedNodes = /* @__PURE__ */ Object.create(null);
|
|
1623
|
+
ctx.nodeIndex = /* @__PURE__ */ new Map();
|
|
1624
|
+
for (let i = 0; i < ctx.nodes.length; i++) {
|
|
1625
|
+
const n = ctx.nodes[i];
|
|
1626
|
+
const nodeKey = resolveAsGraphKey(n["@id"]);
|
|
1627
|
+
if (dedupedNodes[nodeKey]) {
|
|
1628
|
+
if (n._dedupeStrategy !== "replace")
|
|
1629
|
+
dedupedNodes[nodeKey] = merge(dedupedNodes[nodeKey], n);
|
|
1630
|
+
else
|
|
1631
|
+
dedupedNodes[nodeKey] = n;
|
|
1632
|
+
} else {
|
|
1633
|
+
dedupedNodes[nodeKey] = n;
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
ctx.nodes = Object.values(dedupedNodes);
|
|
1637
|
+
for (let i = 0; i < ctx.nodes.length; i++)
|
|
1638
|
+
indexNode(ctx.nodeIndex, ctx.nodes[i]);
|
|
1639
|
+
const countBeforeRelations = ctx.nodes.length;
|
|
1640
|
+
for (let i = 0; i < ctx.nodes.length; i++) {
|
|
1641
|
+
const node = ctx.nodes[i];
|
|
1642
|
+
if (node.image && typeof node.image === "string") {
|
|
1643
|
+
node.image = resolveRelation(node.image, ctx, imageResolver, {
|
|
1644
|
+
root: true
|
|
1645
|
+
});
|
|
1646
|
+
}
|
|
1647
|
+
node.translationOfWork = resolveRelation(node.translationOfWork, ctx);
|
|
1648
|
+
node.workTranslation = resolveRelation(node.workTranslation, ctx);
|
|
1649
|
+
if (node._resolver?.resolveRootNode)
|
|
1650
|
+
node._resolver.resolveRootNode(node, ctx);
|
|
1651
|
+
}
|
|
1652
|
+
for (let i = 0; i < ctx.nodes.length; i++)
|
|
1653
|
+
delete ctx.nodes[i]._resolver;
|
|
1654
|
+
for (let i = 0; i < ctx.nodes.length; i++)
|
|
1655
|
+
stripNullProperties(ctx.nodes[i]);
|
|
1656
|
+
const needsDedupe = ctx.nodes.length > countBeforeRelations;
|
|
1657
|
+
const normalizedNodes = needsDedupe ? /* @__PURE__ */ Object.create(null) : null;
|
|
1658
|
+
const result = needsDedupe ? null : [];
|
|
1659
|
+
for (let i = 0; i < ctx.nodes.length; i++) {
|
|
1660
|
+
const n = ctx.nodes[i];
|
|
1661
|
+
const nodeKey = resolveAsGraphKey(n["@id"]);
|
|
1662
|
+
const keys = Object.keys(n);
|
|
1663
|
+
const primitives = [];
|
|
1664
|
+
const relations = [];
|
|
1665
|
+
for (let j = 0; j < keys.length; j++) {
|
|
1666
|
+
const k = keys[j];
|
|
1667
|
+
if (k[0] === "_")
|
|
1668
|
+
continue;
|
|
1669
|
+
const v = n[k];
|
|
1670
|
+
if (v !== null && (Array.isArray(v) || typeof v === "object"))
|
|
1671
|
+
relations.push(k);
|
|
1672
|
+
else
|
|
1673
|
+
primitives.push(k);
|
|
1674
|
+
}
|
|
1675
|
+
primitives.sort();
|
|
1676
|
+
relations.sort();
|
|
1677
|
+
const newNode = {};
|
|
1678
|
+
for (let j = 0; j < primitives.length; j++)
|
|
1679
|
+
newNode[primitives[j]] = n[primitives[j]];
|
|
1680
|
+
for (let j = 0; j < relations.length; j++)
|
|
1681
|
+
newNode[relations[j]] = n[relations[j]];
|
|
1682
|
+
if (needsDedupe) {
|
|
1683
|
+
normalizedNodes[nodeKey] = normalizedNodes[nodeKey] ? merge(normalizedNodes[nodeKey], newNode) : newNode;
|
|
1684
|
+
} else {
|
|
1685
|
+
result.push(newNode);
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
return needsDedupe ? Object.values(normalizedNodes) : result;
|
|
1689
|
+
},
|
|
1690
|
+
nodes: [],
|
|
1691
|
+
nodeIndex: /* @__PURE__ */ new Map(),
|
|
1692
|
+
nodeIdCounters: /* @__PURE__ */ Object.create(null),
|
|
1693
|
+
meta: {}
|
|
1694
|
+
};
|
|
1695
|
+
return ctx;
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
const schemaAutoImports = [
|
|
1699
|
+
"defineAddress",
|
|
1700
|
+
"defineAggregateOffer",
|
|
1701
|
+
"defineAggregateRating",
|
|
1702
|
+
"defineArticle",
|
|
1703
|
+
"defineBook",
|
|
1704
|
+
"defineBookEdition",
|
|
1705
|
+
"defineBreadcrumb",
|
|
1706
|
+
"defineComment",
|
|
1707
|
+
"defineCourse",
|
|
1708
|
+
"defineDataset",
|
|
1709
|
+
"defineEvent",
|
|
1710
|
+
"defineFoodEstablishment",
|
|
1711
|
+
"defineHowTo",
|
|
1712
|
+
"defineHowToStep",
|
|
1713
|
+
"defineImage",
|
|
1714
|
+
"defineItemList",
|
|
1715
|
+
"defineJobPosting",
|
|
1716
|
+
"defineListItem",
|
|
1717
|
+
"defineLocalBusiness",
|
|
1718
|
+
"defineMovie",
|
|
1719
|
+
"defineMusicAlbum",
|
|
1720
|
+
"defineMusicGroup",
|
|
1721
|
+
"defineMusicPlaylist",
|
|
1722
|
+
"defineMusicRecording",
|
|
1723
|
+
"defineOffer",
|
|
1724
|
+
"defineOpeningHours",
|
|
1725
|
+
"defineOrganization",
|
|
1726
|
+
"definePerson",
|
|
1727
|
+
"definePlace",
|
|
1728
|
+
"definePodcastEpisode",
|
|
1729
|
+
"definePodcastSeason",
|
|
1730
|
+
"definePodcastSeries",
|
|
1731
|
+
"defineProduct",
|
|
1732
|
+
"defineQuestion",
|
|
1733
|
+
"defineReadAction",
|
|
1734
|
+
"defineRecipe",
|
|
1735
|
+
"defineReview",
|
|
1736
|
+
"defineSearchAction",
|
|
1737
|
+
"defineService",
|
|
1738
|
+
"defineSoftwareApp",
|
|
1739
|
+
"defineTVEpisode",
|
|
1740
|
+
"defineTVSeason",
|
|
1741
|
+
"defineTVSeries",
|
|
1742
|
+
"defineVideo",
|
|
1743
|
+
"defineVirtualLocation",
|
|
1744
|
+
"defineWebPage",
|
|
1745
|
+
"defineWebSite",
|
|
1746
|
+
"useSchemaOrg"
|
|
1747
|
+
];
|
|
1748
|
+
|
|
1749
|
+
const UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
1750
|
+
function mergeObjects(target, source) {
|
|
1751
|
+
const result = { ...target };
|
|
1752
|
+
for (const key in source) {
|
|
1753
|
+
if (!Object.hasOwn(source, key) || source[key] === void 0 || UNSAFE_KEYS.has(key))
|
|
1754
|
+
continue;
|
|
1755
|
+
const isNestedObject = result[key] && typeof result[key] === "object" && typeof source[key] === "object" && !Array.isArray(result[key]) && !Array.isArray(source[key]);
|
|
1756
|
+
if (isNestedObject)
|
|
1757
|
+
result[key] = mergeObjects(result[key], source[key]);
|
|
1758
|
+
else if (!result[key])
|
|
1759
|
+
result[key] = source[key];
|
|
1760
|
+
}
|
|
1761
|
+
return result;
|
|
1762
|
+
}
|
|
1763
|
+
function UnheadSchemaOrg(config = {}, meta = () => ({}), options) {
|
|
1764
|
+
config = resolveMeta({ ...config });
|
|
1765
|
+
let graph;
|
|
1766
|
+
let resolvedMeta = {};
|
|
1767
|
+
return plugins.defineHeadPlugin((head) => {
|
|
1768
|
+
head.use(plugins.TemplateParamsPlugin);
|
|
1769
|
+
return {
|
|
1770
|
+
key: "schema-org",
|
|
1771
|
+
hooks: {
|
|
1772
|
+
"entries:resolve": (ctx) => {
|
|
1773
|
+
graph = graph || createSchemaOrgGraph();
|
|
1774
|
+
graph.nodes = [];
|
|
1775
|
+
graph.nodeIndex = /* @__PURE__ */ new Map();
|
|
1776
|
+
for (const entry of ctx.entries) {
|
|
1777
|
+
delete entry._tags;
|
|
1778
|
+
}
|
|
1779
|
+
},
|
|
1780
|
+
"entries:normalize": ({ tags }) => {
|
|
1781
|
+
for (const tag of tags) {
|
|
1782
|
+
if (tag.tag === "script" && tag.props.type === "application/ld+json" && tag.props.nodes) {
|
|
1783
|
+
const nodes = tag.props.nodes;
|
|
1784
|
+
for (const node of Array.isArray(nodes) ? nodes : [nodes]) {
|
|
1785
|
+
if (typeof node !== "object" || node === null) {
|
|
1786
|
+
continue;
|
|
1787
|
+
}
|
|
1788
|
+
const newNode = {
|
|
1789
|
+
...node,
|
|
1790
|
+
_dedupeStrategy: tag.tagDuplicateStrategy
|
|
1791
|
+
};
|
|
1792
|
+
graph.push(newNode);
|
|
1793
|
+
}
|
|
1794
|
+
tag.tagPosition = tag.tagPosition || config.tagPosition === "head" ? "head" : "bodyClose";
|
|
1795
|
+
}
|
|
1796
|
+
if (tag.tag === "htmlAttrs" && tag.props.lang) {
|
|
1797
|
+
resolvedMeta.inLanguage = tag.props.lang;
|
|
1798
|
+
} else if (tag.tag === "title") {
|
|
1799
|
+
resolvedMeta.title = tag.textContent;
|
|
1800
|
+
} else if (tag.tag === "meta" && tag.props.name === "description") {
|
|
1801
|
+
resolvedMeta.description = tag.props.content;
|
|
1802
|
+
} else if (tag.tag === "link" && tag.props.rel === "canonical") {
|
|
1803
|
+
resolvedMeta.url = tag.props.href;
|
|
1804
|
+
if (resolvedMeta.url && !resolvedMeta.host) {
|
|
1805
|
+
try {
|
|
1806
|
+
resolvedMeta.host = new URL(resolvedMeta.url).origin;
|
|
1807
|
+
} catch {
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
} else if (tag.tag === "meta" && tag.props.property === "og:image") {
|
|
1811
|
+
resolvedMeta.image = tag.props.content;
|
|
1812
|
+
} else if (tag.tag === "templateParams" && tag.props.schemaOrg) {
|
|
1813
|
+
resolvedMeta = {
|
|
1814
|
+
...resolvedMeta,
|
|
1815
|
+
...tag.props.schemaOrg
|
|
1816
|
+
};
|
|
1817
|
+
delete tag.props.schemaOrg;
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
},
|
|
1821
|
+
"tags:resolve": async (ctx) => {
|
|
1822
|
+
for (const k in ctx.tags) {
|
|
1823
|
+
const tag = ctx.tags[k];
|
|
1824
|
+
if (tag.tag === "script" && tag.props.type === "application/ld+json" && tag.props.nodes) {
|
|
1825
|
+
delete tag.props.nodes;
|
|
1826
|
+
const resolvedGraph = graph.resolveGraph({ ...meta?.() || {}, ...config, ...resolvedMeta });
|
|
1827
|
+
if (!resolvedGraph.length) {
|
|
1828
|
+
tag.props = {};
|
|
1829
|
+
return;
|
|
1830
|
+
}
|
|
1831
|
+
const minify = options?.minify || process.env.NODE_ENV === "production";
|
|
1832
|
+
tag.innerHTML = JSON.stringify({
|
|
1833
|
+
"@context": "https://schema.org",
|
|
1834
|
+
"@graph": resolvedGraph
|
|
1835
|
+
}, (_, value) => {
|
|
1836
|
+
if (typeof value !== "object")
|
|
1837
|
+
return utils.processTemplateParams(value, head._templateParams, head._separator);
|
|
1838
|
+
return value;
|
|
1839
|
+
}, minify ? 0 : 2);
|
|
1840
|
+
return;
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
},
|
|
1844
|
+
"tags:afterResolve": (ctx) => {
|
|
1845
|
+
let firstNodeIdx;
|
|
1846
|
+
const toRemove = /* @__PURE__ */ new Set();
|
|
1847
|
+
for (let i = 0; i < ctx.tags.length; i++) {
|
|
1848
|
+
const tag = ctx.tags[i];
|
|
1849
|
+
if (!tag?.props)
|
|
1850
|
+
continue;
|
|
1851
|
+
if (tag.props.type === "application/ld+json" && tag.props.nodes || tag.key === "schema-org-graph") {
|
|
1852
|
+
delete tag.props.nodes;
|
|
1853
|
+
if (typeof firstNodeIdx === "undefined") {
|
|
1854
|
+
firstNodeIdx = i;
|
|
1855
|
+
continue;
|
|
1856
|
+
}
|
|
1857
|
+
ctx.tags[firstNodeIdx].props = mergeObjects(ctx.tags[firstNodeIdx].props, tag.props);
|
|
1858
|
+
delete ctx.tags[firstNodeIdx].props.nodes;
|
|
1859
|
+
toRemove.add(i);
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
ctx.tags = ctx.tags.filter((_, i) => !toRemove.has(i));
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
};
|
|
1866
|
+
});
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
function provideResolver(input, resolver) {
|
|
1870
|
+
if (!input)
|
|
1871
|
+
input = {};
|
|
1872
|
+
return { ...input, _resolver: resolver };
|
|
1873
|
+
}
|
|
1874
|
+
function defineAddress(input) {
|
|
1875
|
+
return provideResolver(input, addressResolver);
|
|
1876
|
+
}
|
|
1877
|
+
function defineAggregateOffer(input) {
|
|
1878
|
+
return provideResolver(input, aggregateOfferResolver);
|
|
1879
|
+
}
|
|
1880
|
+
function defineAggregateRating(input) {
|
|
1881
|
+
return provideResolver(input, aggregateRatingResolver);
|
|
1882
|
+
}
|
|
1883
|
+
function defineArticle(input) {
|
|
1884
|
+
return provideResolver(input, articleResolver);
|
|
1885
|
+
}
|
|
1886
|
+
function defineBreadcrumb(input) {
|
|
1887
|
+
return provideResolver(input, breadcrumbResolver);
|
|
1888
|
+
}
|
|
1889
|
+
function defineComment(input) {
|
|
1890
|
+
return provideResolver(input, commentResolver);
|
|
1891
|
+
}
|
|
1892
|
+
function defineEvent(input) {
|
|
1893
|
+
return provideResolver(input, eventResolver);
|
|
1894
|
+
}
|
|
1895
|
+
function defineFoodEstablishment(input) {
|
|
1896
|
+
return provideResolver(input, foodEstablishmentResolver);
|
|
1897
|
+
}
|
|
1898
|
+
function defineVirtualLocation(input) {
|
|
1899
|
+
return provideResolver(input, virtualLocationResolver);
|
|
1900
|
+
}
|
|
1901
|
+
function definePlace(input) {
|
|
1902
|
+
return provideResolver(input, placeResolver);
|
|
1903
|
+
}
|
|
1904
|
+
function defineHowTo(input) {
|
|
1905
|
+
return provideResolver(input, howToResolver);
|
|
1906
|
+
}
|
|
1907
|
+
function defineHowToStep(input) {
|
|
1908
|
+
return provideResolver(input, howToStepResolver);
|
|
1909
|
+
}
|
|
1910
|
+
function defineImage(input) {
|
|
1911
|
+
return provideResolver(input, imageResolver);
|
|
1912
|
+
}
|
|
1913
|
+
function defineJobPosting(input) {
|
|
1914
|
+
return provideResolver(input, jobPostingResolver);
|
|
1915
|
+
}
|
|
1916
|
+
function defineLocalBusiness(input) {
|
|
1917
|
+
return provideResolver(input, localBusinessResolver);
|
|
1918
|
+
}
|
|
1919
|
+
function defineOffer(input) {
|
|
1920
|
+
return provideResolver(input, offerResolver);
|
|
1921
|
+
}
|
|
1922
|
+
function defineOpeningHours(input) {
|
|
1923
|
+
return provideResolver(input, openingHoursResolver);
|
|
1924
|
+
}
|
|
1925
|
+
function defineOrganization(input) {
|
|
1926
|
+
return provideResolver(input, organizationResolver);
|
|
1927
|
+
}
|
|
1928
|
+
function definePerson(input) {
|
|
1929
|
+
return provideResolver(input, personResolver);
|
|
1930
|
+
}
|
|
1931
|
+
function defineProduct(input) {
|
|
1932
|
+
return provideResolver(input, productResolver);
|
|
1933
|
+
}
|
|
1934
|
+
function defineQuestion(input) {
|
|
1935
|
+
return provideResolver(input, questionResolver);
|
|
1936
|
+
}
|
|
1937
|
+
function defineRecipe(input) {
|
|
1938
|
+
return provideResolver(input, recipeResolver);
|
|
1939
|
+
}
|
|
1940
|
+
function defineReview(input) {
|
|
1941
|
+
return provideResolver(input, reviewResolver);
|
|
1942
|
+
}
|
|
1943
|
+
function defineVideo(input) {
|
|
1944
|
+
return provideResolver(input, videoResolver);
|
|
1945
|
+
}
|
|
1946
|
+
function defineWebPage(input) {
|
|
1947
|
+
return provideResolver(input, webPageResolver);
|
|
1948
|
+
}
|
|
1949
|
+
function defineWebSite(input) {
|
|
1950
|
+
return provideResolver(input, webSiteResolver);
|
|
1951
|
+
}
|
|
1952
|
+
function defineBook(input) {
|
|
1953
|
+
return provideResolver(input, bookResolver);
|
|
1954
|
+
}
|
|
1955
|
+
function defineCourse(input) {
|
|
1956
|
+
return provideResolver(input, courseResolver);
|
|
1957
|
+
}
|
|
1958
|
+
function defineItemList(input) {
|
|
1959
|
+
return provideResolver(input, itemListResolver);
|
|
1960
|
+
}
|
|
1961
|
+
function defineListItem(input) {
|
|
1962
|
+
return provideResolver(input, listItemResolver);
|
|
1963
|
+
}
|
|
1964
|
+
function defineMovie(input) {
|
|
1965
|
+
return provideResolver(input, movieResolver);
|
|
1966
|
+
}
|
|
1967
|
+
function defineSearchAction(input) {
|
|
1968
|
+
return provideResolver(input, searchActionResolver);
|
|
1969
|
+
}
|
|
1970
|
+
function defineReadAction(input) {
|
|
1971
|
+
return provideResolver(input, readActionResolver);
|
|
1972
|
+
}
|
|
1973
|
+
function defineDataset(input) {
|
|
1974
|
+
return provideResolver(input, datasetResolver);
|
|
1975
|
+
}
|
|
1976
|
+
function defineMusicRecording(input) {
|
|
1977
|
+
return provideResolver(input, musicRecordingResolver);
|
|
1978
|
+
}
|
|
1979
|
+
function defineMusicAlbum(input) {
|
|
1980
|
+
return provideResolver(input, musicAlbumResolver);
|
|
1981
|
+
}
|
|
1982
|
+
function defineMusicGroup(input) {
|
|
1983
|
+
return provideResolver(input, musicGroupResolver);
|
|
1984
|
+
}
|
|
1985
|
+
function defineMusicPlaylist(input) {
|
|
1986
|
+
return provideResolver(input, musicPlaylistResolver);
|
|
1987
|
+
}
|
|
1988
|
+
function definePodcastSeries(input) {
|
|
1989
|
+
return provideResolver(input, podcastSeriesResolver);
|
|
1990
|
+
}
|
|
1991
|
+
function definePodcastEpisode(input) {
|
|
1992
|
+
return provideResolver(input, podcastEpisodeResolver);
|
|
1993
|
+
}
|
|
1994
|
+
function definePodcastSeason(input) {
|
|
1995
|
+
return provideResolver(input, podcastSeasonResolver);
|
|
1996
|
+
}
|
|
1997
|
+
function defineTVSeries(input) {
|
|
1998
|
+
return provideResolver(input, tvSeriesResolver);
|
|
1999
|
+
}
|
|
2000
|
+
function defineTVSeason(input) {
|
|
2001
|
+
return provideResolver(input, tvSeasonResolver);
|
|
2002
|
+
}
|
|
2003
|
+
function defineTVEpisode(input) {
|
|
2004
|
+
return provideResolver(input, tvEpisodeResolver);
|
|
2005
|
+
}
|
|
2006
|
+
function defineService(input) {
|
|
2007
|
+
return provideResolver(input, serviceResolver);
|
|
2008
|
+
}
|
|
2009
|
+
function defineSoftwareApp(input) {
|
|
2010
|
+
return provideResolver(input, softwareAppResolver);
|
|
2011
|
+
}
|
|
2012
|
+
function defineBookEdition(input) {
|
|
2013
|
+
return provideResolver(input, bookEditionResolver);
|
|
2014
|
+
}
|
|
2015
|
+
function normalizeSchemaOrgInput(input) {
|
|
2016
|
+
if (input.script) {
|
|
2017
|
+
return input;
|
|
2018
|
+
}
|
|
2019
|
+
return {
|
|
2020
|
+
script: [
|
|
2021
|
+
{
|
|
2022
|
+
type: "application/ld+json",
|
|
2023
|
+
key: "schema-org-graph",
|
|
2024
|
+
nodes: input
|
|
2025
|
+
}
|
|
2026
|
+
]
|
|
2027
|
+
};
|
|
2028
|
+
}
|
|
2029
|
+
function useSchemaOrg(unhead, input = [], options = {}) {
|
|
2030
|
+
unhead.use(UnheadSchemaOrg());
|
|
2031
|
+
const entry = unhead.push(normalizeSchemaOrgInput(input), options);
|
|
2032
|
+
const corePatch = entry.patch;
|
|
2033
|
+
entry.patch = (input2) => corePatch(normalizeSchemaOrgInput(input2));
|
|
2034
|
+
return entry;
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
exports.HowToId = HowToId;
|
|
2038
|
+
exports.PrimaryArticleId = PrimaryArticleId;
|
|
2039
|
+
exports.PrimaryBookId = PrimaryBookId;
|
|
2040
|
+
exports.PrimaryBreadcrumbId = PrimaryBreadcrumbId;
|
|
2041
|
+
exports.PrimaryDatasetId = PrimaryDatasetId;
|
|
2042
|
+
exports.PrimaryEventId = PrimaryEventId;
|
|
2043
|
+
exports.PrimaryWebPageId = PrimaryWebPageId;
|
|
2044
|
+
exports.PrimaryWebSiteId = PrimaryWebSiteId;
|
|
2045
|
+
exports.ProductId = ProductId;
|
|
2046
|
+
exports.RecipeId = RecipeId;
|
|
2047
|
+
exports.ServiceId = ServiceId;
|
|
2048
|
+
exports.UnheadSchemaOrg = UnheadSchemaOrg;
|
|
2049
|
+
exports.addressResolver = addressResolver;
|
|
2050
|
+
exports.aggregateOfferResolver = aggregateOfferResolver;
|
|
2051
|
+
exports.aggregateRatingResolver = aggregateRatingResolver;
|
|
2052
|
+
exports.articleResolver = articleResolver;
|
|
2053
|
+
exports.bookEditionResolver = bookEditionResolver;
|
|
2054
|
+
exports.bookResolver = bookResolver;
|
|
2055
|
+
exports.breadcrumbResolver = breadcrumbResolver;
|
|
2056
|
+
exports.commentResolver = commentResolver;
|
|
2057
|
+
exports.courseResolver = courseResolver;
|
|
2058
|
+
exports.createSchemaOrgGraph = createSchemaOrgGraph;
|
|
2059
|
+
exports.datasetResolver = datasetResolver;
|
|
2060
|
+
exports.defineAddress = defineAddress;
|
|
2061
|
+
exports.defineAggregateOffer = defineAggregateOffer;
|
|
2062
|
+
exports.defineAggregateRating = defineAggregateRating;
|
|
2063
|
+
exports.defineArticle = defineArticle;
|
|
2064
|
+
exports.defineBook = defineBook;
|
|
2065
|
+
exports.defineBookEdition = defineBookEdition;
|
|
2066
|
+
exports.defineBreadcrumb = defineBreadcrumb;
|
|
2067
|
+
exports.defineComment = defineComment;
|
|
2068
|
+
exports.defineCourse = defineCourse;
|
|
2069
|
+
exports.defineDataset = defineDataset;
|
|
2070
|
+
exports.defineEvent = defineEvent;
|
|
2071
|
+
exports.defineFoodEstablishment = defineFoodEstablishment;
|
|
2072
|
+
exports.defineHowTo = defineHowTo;
|
|
2073
|
+
exports.defineHowToStep = defineHowToStep;
|
|
2074
|
+
exports.defineImage = defineImage;
|
|
2075
|
+
exports.defineItemList = defineItemList;
|
|
2076
|
+
exports.defineJobPosting = defineJobPosting;
|
|
2077
|
+
exports.defineListItem = defineListItem;
|
|
2078
|
+
exports.defineLocalBusiness = defineLocalBusiness;
|
|
2079
|
+
exports.defineMovie = defineMovie;
|
|
2080
|
+
exports.defineMusicAlbum = defineMusicAlbum;
|
|
2081
|
+
exports.defineMusicGroup = defineMusicGroup;
|
|
2082
|
+
exports.defineMusicPlaylist = defineMusicPlaylist;
|
|
2083
|
+
exports.defineMusicRecording = defineMusicRecording;
|
|
2084
|
+
exports.defineOffer = defineOffer;
|
|
2085
|
+
exports.defineOpeningHours = defineOpeningHours;
|
|
2086
|
+
exports.defineOrganization = defineOrganization;
|
|
2087
|
+
exports.definePerson = definePerson;
|
|
2088
|
+
exports.definePlace = definePlace;
|
|
2089
|
+
exports.definePodcastEpisode = definePodcastEpisode;
|
|
2090
|
+
exports.definePodcastSeason = definePodcastSeason;
|
|
2091
|
+
exports.definePodcastSeries = definePodcastSeries;
|
|
2092
|
+
exports.defineProduct = defineProduct;
|
|
2093
|
+
exports.defineQuestion = defineQuestion;
|
|
2094
|
+
exports.defineReadAction = defineReadAction;
|
|
2095
|
+
exports.defineRecipe = defineRecipe;
|
|
2096
|
+
exports.defineReview = defineReview;
|
|
2097
|
+
exports.defineSchemaOrgResolver = defineSchemaOrgResolver;
|
|
2098
|
+
exports.defineSearchAction = defineSearchAction;
|
|
2099
|
+
exports.defineService = defineService;
|
|
2100
|
+
exports.defineSoftwareApp = defineSoftwareApp;
|
|
2101
|
+
exports.defineTVEpisode = defineTVEpisode;
|
|
2102
|
+
exports.defineTVSeason = defineTVSeason;
|
|
2103
|
+
exports.defineTVSeries = defineTVSeries;
|
|
2104
|
+
exports.defineVideo = defineVideo;
|
|
2105
|
+
exports.defineVirtualLocation = defineVirtualLocation;
|
|
2106
|
+
exports.defineWebPage = defineWebPage;
|
|
2107
|
+
exports.defineWebSite = defineWebSite;
|
|
2108
|
+
exports.eventResolver = eventResolver;
|
|
2109
|
+
exports.foodEstablishmentResolver = foodEstablishmentResolver;
|
|
2110
|
+
exports.howToResolver = howToResolver;
|
|
2111
|
+
exports.howToStepDirectionResolver = howToStepDirectionResolver;
|
|
2112
|
+
exports.howToStepResolver = howToStepResolver;
|
|
2113
|
+
exports.imageResolver = imageResolver;
|
|
2114
|
+
exports.itemListResolver = itemListResolver;
|
|
2115
|
+
exports.jobPostingResolver = jobPostingResolver;
|
|
2116
|
+
exports.listItemResolver = listItemResolver;
|
|
2117
|
+
exports.localBusinessResolver = localBusinessResolver;
|
|
2118
|
+
exports.merge = merge;
|
|
2119
|
+
exports.movieResolver = movieResolver;
|
|
2120
|
+
exports.musicAlbumResolver = musicAlbumResolver;
|
|
2121
|
+
exports.musicGroupResolver = musicGroupResolver;
|
|
2122
|
+
exports.musicPlaylistResolver = musicPlaylistResolver;
|
|
2123
|
+
exports.musicRecordingResolver = musicRecordingResolver;
|
|
2124
|
+
exports.normalizeSchemaOrgInput = normalizeSchemaOrgInput;
|
|
2125
|
+
exports.offerResolver = offerResolver;
|
|
2126
|
+
exports.openingHoursResolver = openingHoursResolver;
|
|
2127
|
+
exports.organizationResolver = organizationResolver;
|
|
2128
|
+
exports.personResolver = personResolver;
|
|
2129
|
+
exports.placeResolver = placeResolver;
|
|
2130
|
+
exports.podcastEpisodeResolver = podcastEpisodeResolver;
|
|
2131
|
+
exports.podcastSeasonResolver = podcastSeasonResolver;
|
|
2132
|
+
exports.podcastSeriesResolver = podcastSeriesResolver;
|
|
2133
|
+
exports.productResolver = productResolver;
|
|
2134
|
+
exports.questionResolver = questionResolver;
|
|
2135
|
+
exports.ratingResolver = ratingResolver;
|
|
2136
|
+
exports.readActionResolver = readActionResolver;
|
|
2137
|
+
exports.recipeResolver = recipeResolver;
|
|
2138
|
+
exports.resolveMeta = resolveMeta;
|
|
2139
|
+
exports.resolveNode = resolveNode;
|
|
2140
|
+
exports.resolveNodeId = resolveNodeId;
|
|
2141
|
+
exports.resolveRelation = resolveRelation;
|
|
2142
|
+
exports.reviewResolver = reviewResolver;
|
|
2143
|
+
exports.schemaAutoImports = schemaAutoImports;
|
|
2144
|
+
exports.searchActionResolver = searchActionResolver;
|
|
2145
|
+
exports.serviceResolver = serviceResolver;
|
|
2146
|
+
exports.softwareAppResolver = softwareAppResolver;
|
|
2147
|
+
exports.tvEpisodeResolver = tvEpisodeResolver;
|
|
2148
|
+
exports.tvSeasonResolver = tvSeasonResolver;
|
|
2149
|
+
exports.tvSeriesResolver = tvSeriesResolver;
|
|
2150
|
+
exports.useSchemaOrg = useSchemaOrg;
|
|
2151
|
+
exports.videoResolver = videoResolver;
|
|
2152
|
+
exports.virtualLocationResolver = virtualLocationResolver;
|
|
2153
|
+
exports.webPageResolver = webPageResolver;
|
|
2154
|
+
exports.webSiteResolver = webSiteResolver;
|