@unhead/schema-org 0.5.0 → 1.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,1897 +1,118 @@
1
1
  'use strict';
2
2
 
3
+ const SchemaOrgUnheadPlugin = require('./shared/schema-org.96234618.cjs');
3
4
  const unhead = require('unhead');
5
+ require('ufo');
6
+ require('@unhead/shared');
4
7
 
5
- function defineSchemaOrgResolver(schema) {
6
- return schema;
8
+ function provideResolver(input, resolver) {
9
+ if (!input)
10
+ input = {};
11
+ input._resolver = resolver;
12
+ return input;
7
13
  }
8
-
9
- const PROTOCOL_STRICT_REGEX = /^\w{2,}:([/\\]{1,2})/;
10
- const PROTOCOL_REGEX = /^\w{2,}:([/\\]{2})?/;
11
- const PROTOCOL_RELATIVE_REGEX = /^[/\\]{2}[^/\\]+/;
12
- function hasProtocol(inputString, opts = {}) {
13
- if (typeof opts === "boolean") {
14
- opts = { acceptRelative: opts };
15
- }
16
- if (opts.strict) {
17
- return PROTOCOL_STRICT_REGEX.test(inputString);
18
- }
19
- return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);
14
+ function defineAddress(input) {
15
+ return provideResolver(input, "address");
20
16
  }
21
- const TRAILING_SLASH_RE = /\/$|\/\?/;
22
- function hasTrailingSlash(input = "", queryParameters = false) {
23
- if (!queryParameters) {
24
- return input.endsWith("/");
25
- }
26
- return TRAILING_SLASH_RE.test(input);
17
+ function defineAggregateOffer(input) {
18
+ return provideResolver(input, "aggregateOffer");
27
19
  }
28
- function withoutTrailingSlash(input = "", queryParameters = false) {
29
- if (!queryParameters) {
30
- return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
31
- }
32
- if (!hasTrailingSlash(input, true)) {
33
- return input || "/";
34
- }
35
- const [s0, ...s] = input.split("?");
36
- return (s0.slice(0, -1) || "/") + (s.length > 0 ? `?${s.join("?")}` : "");
20
+ function defineAggregateRating(input) {
21
+ return provideResolver(input, "aggregateRating");
37
22
  }
38
- function withTrailingSlash(input = "", queryParameters = false) {
39
- if (!queryParameters) {
40
- return input.endsWith("/") ? input : input + "/";
41
- }
42
- if (hasTrailingSlash(input, true)) {
43
- return input || "/";
44
- }
45
- const [s0, ...s] = input.split("?");
46
- return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "");
23
+ function defineArticle(input) {
24
+ return provideResolver(input, "article");
47
25
  }
48
- function hasLeadingSlash(input = "") {
49
- return input.startsWith("/");
26
+ function defineBreadcrumb(input) {
27
+ return provideResolver(input, "breadcrumb");
50
28
  }
51
- function withoutLeadingSlash(input = "") {
52
- return (hasLeadingSlash(input) ? input.slice(1) : input) || "/";
29
+ function defineComment(input) {
30
+ return provideResolver(input, "comment");
53
31
  }
54
- function withBase(input, base) {
55
- if (isEmptyURL(base) || hasProtocol(input)) {
56
- return input;
57
- }
58
- const _base = withoutTrailingSlash(base);
59
- if (input.startsWith(_base)) {
60
- return input;
61
- }
62
- return joinURL(_base, input);
32
+ function defineEvent(input) {
33
+ return provideResolver(input, "event");
63
34
  }
64
- function isEmptyURL(url) {
65
- return !url || url === "/";
35
+ function defineVirtualLocation(input) {
36
+ return provideResolver(input, "virtualLocation");
66
37
  }
67
- function isNonEmptyURL(url) {
68
- return url && url !== "/";
38
+ function definePlace(input) {
39
+ return provideResolver(input, "place");
69
40
  }
70
- function joinURL(base, ...input) {
71
- let url = base || "";
72
- for (const index of input.filter((url2) => isNonEmptyURL(url2))) {
73
- url = url ? withTrailingSlash(url) + withoutLeadingSlash(index) : index;
74
- }
75
- return url;
41
+ function defineHowTo(input) {
42
+ return provideResolver(input, "howTo");
76
43
  }
77
-
78
- const idReference = (node) => ({
79
- "@id": typeof node !== "string" ? node["@id"] : node
80
- });
81
- const resolvableDateToDate = (val) => {
82
- try {
83
- const date = val instanceof Date ? val : new Date(Date.parse(val));
84
- return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;
85
- } catch (e) {
86
- }
87
- return typeof val === "string" ? val : val.toString();
88
- };
89
- const resolvableDateToIso = (val) => {
90
- if (!val)
91
- return val;
92
- try {
93
- if (val instanceof Date)
94
- return val.toISOString();
95
- else
96
- return new Date(Date.parse(val)).toISOString();
97
- } catch (e) {
98
- }
99
- return typeof val === "string" ? val : val.toString();
100
- };
101
- const IdentityId = "#identity";
102
- const setIfEmpty = (node, field, value) => {
103
- if (!node?.[field] && value)
104
- node[field] = value;
105
- };
106
- const asArray = (input) => Array.isArray(input) ? input : [input];
107
- const dedupeMerge = (node, field, value) => {
108
- const dedupeMerge2 = [];
109
- const input = asArray(node[field]);
110
- dedupeMerge2.push(...input);
111
- const data = new Set(dedupeMerge2);
112
- data.add(value);
113
- node[field] = [...data.values()].filter(Boolean);
114
- };
115
- const prefixId = (url, id) => {
116
- if (hasProtocol(id))
117
- return url;
118
- if (!id.startsWith("#"))
119
- id = `#${id}`;
120
- return joinURL(url, id);
121
- };
122
- const trimLength = (val, length) => {
123
- if (!val)
124
- return val;
125
- if (val.length > length) {
126
- const trimmedString = val.substring(0, length);
127
- return trimmedString.substring(0, Math.min(trimmedString.length, trimmedString.lastIndexOf(" ")));
128
- }
129
- return val;
130
- };
131
- const resolveDefaultType = (node, defaultType) => {
132
- const val = node["@type"];
133
- if (val === defaultType)
134
- return;
135
- const types = /* @__PURE__ */ new Set([
136
- ...asArray(defaultType),
137
- ...asArray(val)
138
- ]);
139
- node["@type"] = types.size === 1 ? val : [...types.values()];
140
- };
141
- const resolveWithBase = (base, urlOrPath) => {
142
- if (!urlOrPath || hasProtocol(urlOrPath) || !urlOrPath.startsWith("/") && !urlOrPath.startsWith("#"))
143
- return urlOrPath;
144
- return withBase(urlOrPath, base);
145
- };
146
- const resolveAsGraphKey = (key) => {
147
- if (!key)
148
- return key;
149
- return key.substring(key.lastIndexOf("#"));
150
- };
151
- const stripEmptyProperties = (obj) => {
152
- Object.keys(obj).forEach((k) => {
153
- if (obj[k] && typeof obj[k] === "object") {
154
- if (obj[k].__v_isReadonly || obj[k].__v_isRef)
155
- return;
156
- stripEmptyProperties(obj[k]);
157
- return;
158
- }
159
- if (obj[k] === "" || obj[k] === null || typeof obj[k] === "undefined")
160
- delete obj[k];
161
- });
162
- return obj;
163
- };
164
- function hashCode(s) {
165
- let h = 9;
166
- for (let i = 0; i < s.length; )
167
- h = Math.imul(h ^ s.charCodeAt(i++), 9 ** 9);
168
- return ((h ^ h >>> 9) + 65536).toString(16).substring(1, 8).toLowerCase();
44
+ function defineHowToStep(input) {
45
+ return provideResolver(input, "howToStep");
169
46
  }
170
-
171
- const offerResolver = defineSchemaOrgResolver({
172
- cast(node) {
173
- if (typeof node === "number" || typeof node === "string") {
174
- return {
175
- price: node
176
- };
177
- }
178
- return node;
179
- },
180
- defaults: {
181
- "@type": "Offer",
182
- "availability": "InStock"
183
- },
184
- resolve(node, ctx) {
185
- setIfEmpty(node, "priceCurrency", ctx.meta.currency);
186
- setIfEmpty(node, "priceValidUntil", new Date(Date.UTC((/* @__PURE__ */ new Date()).getFullYear() + 1, 12, -1, 0, 0, 0)));
187
- if (node.url)
188
- resolveWithBase(ctx.meta.host, node.url);
189
- if (node.availability)
190
- node.availability = withBase(node.availability, "https://schema.org/");
191
- if (node.priceValidUntil)
192
- node.priceValidUntil = resolvableDateToIso(node.priceValidUntil);
193
- return node;
194
- }
195
- });
196
-
197
- const aggregateOfferResolver = defineSchemaOrgResolver({
198
- defaults: {
199
- "@type": "AggregateOffer"
200
- },
201
- inheritMeta: [
202
- { meta: "currency", key: "priceCurrency" }
203
- ],
204
- resolve(node, ctx) {
205
- node.offers = resolveRelation(node.offers, ctx, offerResolver);
206
- if (node.offers)
207
- setIfEmpty(node, "offerCount", asArray(node.offers).length);
208
- return node;
209
- }
210
- });
211
-
212
- const aggregateRatingResolver = defineSchemaOrgResolver({
213
- defaults: {
214
- "@type": "AggregateRating"
215
- }
216
- });
217
-
218
- const searchActionResolver = defineSchemaOrgResolver({
219
- defaults: {
220
- "@type": "SearchAction",
221
- "target": {
222
- "@type": "EntryPoint"
223
- },
224
- "query-input": {
225
- "@type": "PropertyValueSpecification",
226
- "valueRequired": true,
227
- "valueName": "search_term_string"
228
- }
229
- },
230
- resolve(node, ctx) {
231
- if (typeof node.target === "string") {
232
- node.target = {
233
- "@type": "EntryPoint",
234
- "urlTemplate": resolveWithBase(ctx.meta.host, node.target)
235
- };
236
- }
237
- return node;
238
- }
239
- });
240
-
241
- const PrimaryWebSiteId = "#website";
242
- const webSiteResolver = defineSchemaOrgResolver({
243
- defaults: {
244
- "@type": "WebSite"
245
- },
246
- inheritMeta: [
247
- "inLanguage",
248
- { meta: "host", key: "url" }
249
- ],
250
- idPrefix: ["host", PrimaryWebSiteId],
251
- resolve(node, ctx) {
252
- node.potentialAction = resolveRelation(node.potentialAction, ctx, searchActionResolver, {
253
- array: true
254
- });
255
- node.publisher = resolveRelation(node.publisher, ctx);
256
- return node;
257
- },
258
- resolveRootNode(node, { find }) {
259
- if (resolveAsGraphKey(node["@id"]) === PrimaryWebSiteId) {
260
- const identity = find(IdentityId);
261
- if (identity)
262
- setIfEmpty(node, "publisher", idReference(identity));
263
- const webPage = find(PrimaryWebPageId);
264
- if (webPage)
265
- setIfEmpty(webPage, "isPartOf", idReference(node));
266
- }
267
- return node;
268
- }
269
- });
270
-
271
- const listItemResolver = defineSchemaOrgResolver({
272
- cast(node) {
273
- if (typeof node === "string") {
274
- node = {
275
- name: node
276
- };
277
- }
278
- return node;
279
- },
280
- defaults: {
281
- "@type": "ListItem"
282
- },
283
- resolve(node, ctx) {
284
- if (typeof node.item === "string")
285
- node.item = resolveWithBase(ctx.meta.host, node.item);
286
- else if (typeof node.item === "object")
287
- node.item = resolveRelation(node.item, ctx);
288
- return node;
289
- }
290
- });
291
-
292
- const PrimaryBreadcrumbId = "#breadcrumb";
293
- const breadcrumbResolver = defineSchemaOrgResolver({
294
- defaults: {
295
- "@type": "BreadcrumbList"
296
- },
297
- idPrefix: ["url", PrimaryBreadcrumbId],
298
- resolve(breadcrumb, ctx) {
299
- if (breadcrumb.itemListElement) {
300
- let index = 1;
301
- breadcrumb.itemListElement = resolveRelation(breadcrumb.itemListElement, ctx, listItemResolver, {
302
- array: true,
303
- afterResolve(node) {
304
- setIfEmpty(node, "position", index++);
305
- }
306
- });
307
- }
308
- return breadcrumb;
309
- },
310
- resolveRootNode(node, { find }) {
311
- const webPage = find(PrimaryWebPageId);
312
- if (webPage)
313
- setIfEmpty(webPage, "breadcrumb", idReference(node));
314
- }
315
- });
316
-
317
- const imageResolver = defineSchemaOrgResolver({
318
- alias: "image",
319
- cast(input) {
320
- if (typeof input === "string") {
321
- input = {
322
- url: input
323
- };
324
- }
325
- return input;
326
- },
327
- defaults: {
328
- "@type": "ImageObject"
329
- },
330
- inheritMeta: [
331
- // @todo possibly only do if there's a caption
332
- "inLanguage"
333
- ],
334
- idPrefix: "host",
335
- resolve(image, { meta }) {
336
- image.url = resolveWithBase(meta.host, image.url);
337
- setIfEmpty(image, "contentUrl", image.url);
338
- if (image.height && !image.width)
339
- delete image.height;
340
- if (image.width && !image.height)
341
- delete image.width;
342
- return image;
343
- }
344
- });
345
-
346
- const addressResolver = defineSchemaOrgResolver({
347
- defaults: {
348
- "@type": "PostalAddress"
349
- }
350
- });
351
-
352
- const organizationResolver = defineSchemaOrgResolver({
353
- defaults: {
354
- "@type": "Organization"
355
- },
356
- idPrefix: ["host", IdentityId],
357
- inheritMeta: [
358
- { meta: "host", key: "url" }
359
- ],
360
- resolve(node, ctx) {
361
- resolveDefaultType(node, "Organization");
362
- node.address = resolveRelation(node.address, ctx, addressResolver);
363
- return node;
364
- },
365
- resolveRootNode(node, ctx) {
366
- const isIdentity = resolveAsGraphKey(node["@id"]) === IdentityId;
367
- const webPage = ctx.find(PrimaryWebPageId);
368
- if (node.logo) {
369
- node.logo = resolveRelation(node.logo, ctx, imageResolver, {
370
- root: true,
371
- afterResolve(logo) {
372
- if (isIdentity)
373
- logo["@id"] = prefixId(ctx.meta.host, "#logo");
374
- setIfEmpty(logo, "caption", node.name);
375
- }
376
- });
377
- if (webPage)
378
- setIfEmpty(webPage, "primaryImageOfPage", idReference(node.logo));
379
- }
380
- if (isIdentity && webPage)
381
- setIfEmpty(webPage, "about", idReference(node));
382
- const webSite = ctx.find(PrimaryWebSiteId);
383
- if (webSite)
384
- setIfEmpty(webSite, "publisher", idReference(node));
385
- }
386
- });
387
-
388
- const personResolver = defineSchemaOrgResolver({
389
- cast(node) {
390
- if (typeof node === "string") {
391
- return {
392
- name: node
393
- };
394
- }
395
- return node;
396
- },
397
- defaults: {
398
- "@type": "Person"
399
- },
400
- idPrefix: ["host", IdentityId],
401
- resolveRootNode(node, { find, meta }) {
402
- if (resolveAsGraphKey(node["@id"]) === IdentityId) {
403
- setIfEmpty(node, "url", meta.host);
404
- const webPage = find(PrimaryWebPageId);
405
- if (webPage)
406
- setIfEmpty(webPage, "about", idReference(node));
407
- const webSite = find(PrimaryWebSiteId);
408
- if (webSite)
409
- setIfEmpty(webSite, "publisher", idReference(node));
410
- }
411
- const article = find(PrimaryArticleId);
412
- if (article)
413
- setIfEmpty(article, "author", idReference(node));
414
- }
415
- });
416
-
417
- const readActionResolver = defineSchemaOrgResolver({
418
- defaults: {
419
- "@type": "ReadAction"
420
- },
421
- resolve(node, ctx) {
422
- if (!node.target.includes(ctx.meta.url))
423
- node.target.unshift(ctx.meta.url);
424
- return node;
425
- }
426
- });
427
-
428
- const PrimaryWebPageId = "#webpage";
429
- const webPageResolver = defineSchemaOrgResolver({
430
- defaults({ meta }) {
431
- const endPath = withoutTrailingSlash(meta.url.substring(meta.url.lastIndexOf("/") + 1));
432
- let type = "WebPage";
433
- switch (endPath) {
434
- case "about":
435
- case "about-us":
436
- type = "AboutPage";
437
- break;
438
- case "search":
439
- type = "SearchResultsPage";
440
- break;
441
- case "checkout":
442
- type = "CheckoutPage";
443
- break;
444
- case "contact":
445
- case "get-in-touch":
446
- case "contact-us":
447
- type = "ContactPage";
448
- break;
449
- case "faq":
450
- type = "FAQPage";
451
- break;
452
- }
453
- const defaults = {
454
- "@type": type
455
- };
456
- return defaults;
457
- },
458
- idPrefix: ["url", PrimaryWebPageId],
459
- inheritMeta: [
460
- { meta: "title", key: "name" },
461
- "description",
462
- "datePublished",
463
- "dateModified",
464
- "url"
465
- ],
466
- resolve(node, ctx) {
467
- node.dateModified = resolvableDateToIso(node.dateModified);
468
- node.datePublished = resolvableDateToIso(node.datePublished);
469
- resolveDefaultType(node, "WebPage");
470
- node.about = resolveRelation(node.about, ctx, organizationResolver);
471
- node.breadcrumb = resolveRelation(node.breadcrumb, ctx, breadcrumbResolver);
472
- node.author = resolveRelation(node.author, ctx, personResolver);
473
- node.primaryImageOfPage = resolveRelation(node.primaryImageOfPage, ctx, imageResolver);
474
- node.potentialAction = resolveRelation(node.potentialAction, ctx, readActionResolver);
475
- if (node["@type"] === "WebPage") {
476
- setIfEmpty(node, "potentialAction", [
477
- {
478
- "@type": "ReadAction",
479
- "target": [ctx.meta.url]
480
- }
481
- ]);
482
- }
483
- return node;
484
- },
485
- resolveRootNode(webPage, { find, meta }) {
486
- const identity = find(IdentityId);
487
- const webSite = find(PrimaryWebSiteId);
488
- const logo = find("#logo");
489
- if (identity && meta.url === meta.host)
490
- setIfEmpty(webPage, "about", idReference(identity));
491
- if (logo)
492
- setIfEmpty(webPage, "primaryImageOfPage", idReference(logo));
493
- if (webSite)
494
- setIfEmpty(webPage, "isPartOf", idReference(webSite));
495
- const breadcrumb = find(PrimaryBreadcrumbId);
496
- if (breadcrumb)
497
- setIfEmpty(webPage, "breadcrumb", idReference(breadcrumb));
498
- return webPage;
499
- }
500
- });
501
-
502
- const PrimaryArticleId = "#article";
503
- const articleResolver = defineSchemaOrgResolver({
504
- defaults: {
505
- "@type": "Article"
506
- },
507
- inheritMeta: [
508
- "inLanguage",
509
- "description",
510
- "image",
511
- "dateModified",
512
- "datePublished",
513
- { meta: "title", key: "headline" }
514
- ],
515
- idPrefix: ["url", PrimaryArticleId],
516
- resolve(node, ctx) {
517
- node.author = resolveRelation(node.author, ctx, personResolver, {
518
- root: true
519
- });
520
- node.publisher = resolveRelation(node.publisher, ctx);
521
- node.dateModified = resolvableDateToIso(node.dateModified);
522
- node.datePublished = resolvableDateToIso(node.datePublished);
523
- resolveDefaultType(node, "Article");
524
- node.headline = trimLength(node.headline, 110);
525
- return node;
526
- },
527
- resolveRootNode(node, { find, meta }) {
528
- const webPage = find(PrimaryWebPageId);
529
- const identity = find(IdentityId);
530
- if (node.image && !node.thumbnailUrl) {
531
- const firstImage = asArray(node.image)[0];
532
- if (typeof firstImage === "string")
533
- setIfEmpty(node, "thumbnailUrl", resolveWithBase(meta.host, firstImage));
534
- else if (firstImage?.["@id"])
535
- setIfEmpty(node, "thumbnailUrl", find(firstImage["@id"])?.url);
536
- }
537
- if (identity) {
538
- setIfEmpty(node, "publisher", idReference(identity));
539
- setIfEmpty(node, "author", idReference(identity));
540
- }
541
- if (webPage) {
542
- setIfEmpty(node, "isPartOf", idReference(webPage));
543
- setIfEmpty(node, "mainEntityOfPage", idReference(webPage));
544
- setIfEmpty(webPage, "potentialAction", [
545
- {
546
- "@type": "ReadAction",
547
- "target": [meta.url]
548
- }
549
- ]);
550
- setIfEmpty(webPage, "dateModified", node.dateModified);
551
- setIfEmpty(webPage, "datePublished", node.datePublished);
552
- }
553
- return node;
554
- }
555
- });
556
-
557
- const bookEditionResolver = defineSchemaOrgResolver({
558
- defaults: {
559
- "@type": "Book"
560
- },
561
- inheritMeta: [
562
- "inLanguage"
563
- ],
564
- resolve(node, ctx) {
565
- if (node.bookFormat)
566
- node.bookFormat = withBase(node.bookFormat, "https://schema.org/");
567
- if (node.datePublished)
568
- node.datePublished = resolvableDateToDate(node.datePublished);
569
- node.author = resolveRelation(node.author, ctx);
570
- return node;
571
- },
572
- resolveRootNode(node, { find }) {
573
- const identity = find(IdentityId);
574
- if (identity)
575
- setIfEmpty(node, "provider", idReference(identity));
576
- return node;
577
- }
578
- });
579
- const PrimaryBookId = "#book";
580
- const bookResolver = defineSchemaOrgResolver({
581
- defaults: {
582
- "@type": "Book"
583
- },
584
- inheritMeta: [
585
- "description",
586
- "url",
587
- { meta: "title", key: "name" }
588
- ],
589
- idPrefix: ["url", PrimaryBookId],
590
- resolve(node, ctx) {
591
- node.workExample = resolveRelation(node.workExample, ctx, bookEditionResolver);
592
- node.author = resolveRelation(node.author, ctx);
593
- if (node.url)
594
- withBase(node.url, ctx.meta.host);
595
- return node;
596
- },
597
- resolveRootNode(node, { find }) {
598
- const identity = find(IdentityId);
599
- if (identity)
600
- setIfEmpty(node, "author", idReference(identity));
601
- return node;
602
- }
603
- });
604
-
605
- const commentResolver = defineSchemaOrgResolver({
606
- defaults: {
607
- "@type": "Comment"
608
- },
609
- idPrefix: "url",
610
- resolve(node, ctx) {
611
- node.author = resolveRelation(node.author, ctx, personResolver, {
612
- root: true
613
- });
614
- return node;
615
- },
616
- resolveRootNode(node, { find }) {
617
- const article = find(PrimaryArticleId);
618
- if (article)
619
- setIfEmpty(node, "about", idReference(article));
620
- }
621
- });
622
-
623
- const courseResolver = defineSchemaOrgResolver({
624
- defaults: {
625
- "@type": "Course"
626
- },
627
- resolve(node, ctx) {
628
- node.provider = resolveRelation(node.provider, ctx, organizationResolver, {
629
- root: true
630
- });
631
- return node;
632
- },
633
- resolveRootNode(node, { find }) {
634
- const identity = find(IdentityId);
635
- if (identity)
636
- setIfEmpty(node, "provider", idReference(identity));
637
- return node;
638
- }
639
- });
640
-
641
- const placeResolver = defineSchemaOrgResolver({
642
- defaults: {
643
- "@type": "Place"
644
- },
645
- resolve(node, ctx) {
646
- if (typeof node.address !== "string")
647
- node.address = resolveRelation(node.address, ctx, addressResolver);
648
- return node;
649
- }
650
- });
651
-
652
- const virtualLocationResolver = defineSchemaOrgResolver({
653
- cast(node) {
654
- if (typeof node === "string") {
655
- return {
656
- url: node
657
- };
658
- }
659
- return node;
660
- },
661
- defaults: {
662
- "@type": "VirtualLocation"
663
- }
664
- });
665
-
666
- const PrimaryEventId = "#event";
667
- const eventResolver = defineSchemaOrgResolver({
668
- defaults: {
669
- "@type": "Event"
670
- },
671
- inheritMeta: [
672
- "inLanguage",
673
- "description",
674
- "image",
675
- { meta: "title", key: "name" }
676
- ],
677
- idPrefix: ["url", PrimaryEventId],
678
- resolve(node, ctx) {
679
- if (node.location) {
680
- const isVirtual = node.location === "string" || node.location?.url !== "undefined";
681
- node.location = resolveRelation(node.location, ctx, isVirtual ? virtualLocationResolver : placeResolver);
682
- }
683
- node.performer = resolveRelation(node.performer, ctx, personResolver, {
684
- root: true
685
- });
686
- node.organizer = resolveRelation(node.organizer, ctx, organizationResolver, {
687
- root: true
688
- });
689
- node.offers = resolveRelation(node.offers, ctx, offerResolver);
690
- if (node.eventAttendanceMode)
691
- node.eventAttendanceMode = withBase(node.eventAttendanceMode, "https://schema.org/");
692
- if (node.eventStatus)
693
- node.eventStatus = withBase(node.eventStatus, "https://schema.org/");
694
- const isOnline = node.eventStatus === "https://schema.org/EventMovedOnline";
695
- const dates = ["startDate", "previousStartDate", "endDate"];
696
- dates.forEach((date) => {
697
- if (!isOnline) {
698
- if (node[date] instanceof Date && node[date].getHours() === 0 && node[date].getMinutes() === 0)
699
- node[date] = resolvableDateToDate(node[date]);
700
- } else {
701
- node[date] = resolvableDateToIso(node[date]);
702
- }
703
- });
704
- setIfEmpty(node, "endDate", node.startDate);
705
- return node;
706
- },
707
- resolveRootNode(node, { find }) {
708
- const identity = find(IdentityId);
709
- if (identity)
710
- setIfEmpty(node, "organizer", idReference(identity));
711
- }
712
- });
713
-
714
- const howToStepDirectionResolver = defineSchemaOrgResolver({
715
- cast(node) {
716
- if (typeof node === "string") {
717
- return {
718
- text: node
719
- };
720
- }
721
- return node;
722
- },
723
- defaults: {
724
- "@type": "HowToDirection"
725
- }
726
- });
727
-
728
- const howToStepResolver = defineSchemaOrgResolver({
729
- cast(node) {
730
- if (typeof node === "string") {
731
- return {
732
- text: node
733
- };
734
- }
735
- return node;
736
- },
737
- defaults: {
738
- "@type": "HowToStep"
739
- },
740
- resolve(step, ctx) {
741
- if (step.url)
742
- step.url = resolveWithBase(ctx.meta.url, step.url);
743
- if (step.image) {
744
- step.image = resolveRelation(step.image, ctx, imageResolver, {
745
- root: true
746
- });
747
- }
748
- if (step.itemListElement)
749
- step.itemListElement = resolveRelation(step.itemListElement, ctx, howToStepDirectionResolver);
750
- return step;
751
- }
752
- });
753
-
754
- const HowToId = "#howto";
755
- const howToResolver = defineSchemaOrgResolver({
756
- defaults: {
757
- "@type": "HowTo"
758
- },
759
- inheritMeta: [
760
- "description",
761
- "image",
762
- "inLanguage",
763
- { meta: "title", key: "name" }
764
- ],
765
- idPrefix: ["url", HowToId],
766
- resolve(node, ctx) {
767
- node.step = resolveRelation(node.step, ctx, howToStepResolver);
768
- return node;
769
- },
770
- resolveRootNode(node, { find }) {
771
- const webPage = find(PrimaryWebPageId);
772
- if (webPage)
773
- setIfEmpty(node, "mainEntityOfPage", idReference(webPage));
774
- }
775
- });
776
-
777
- const itemListResolver = defineSchemaOrgResolver({
778
- defaults: {
779
- "@type": "ItemList"
780
- },
781
- resolve(node, ctx) {
782
- if (node.itemListElement) {
783
- let index = 1;
784
- node.itemListElement = resolveRelation(node.itemListElement, ctx, listItemResolver, {
785
- array: true,
786
- afterResolve(node2) {
787
- setIfEmpty(node2, "position", index++);
788
- }
789
- });
790
- }
791
- return node;
792
- }
793
- });
794
-
795
- const quantitativeValueResolver = defineSchemaOrgResolver({
796
- defaults: {
797
- "@type": "QuantitativeValue"
798
- }
799
- });
800
- const monetaryAmountResolver = defineSchemaOrgResolver({
801
- defaults: {
802
- "@type": "MonetaryAmount"
803
- },
804
- resolve(node, ctx) {
805
- node.value = resolveRelation(node.value, ctx, quantitativeValueResolver);
806
- return node;
807
- }
808
- });
809
-
810
- const jobPostingResolver = defineSchemaOrgResolver({
811
- defaults: {
812
- "@type": "JobPosting"
813
- },
814
- resolve(node, ctx) {
815
- node.datePosted = resolvableDateToIso(node.datePosted);
816
- node.hiringOrganization = resolveRelation(node.hiringOrganization, ctx, organizationResolver);
817
- node.jobLocation = resolveRelation(node.jobLocation, ctx, placeResolver);
818
- node.baseSalary = resolveRelation(node.baseSalary, ctx, monetaryAmountResolver);
819
- node.validThrough = resolvableDateToIso(node.validThrough);
820
- return node;
821
- }
822
- });
823
-
824
- const openingHoursResolver = defineSchemaOrgResolver({
825
- defaults: {
826
- "@type": "OpeningHoursSpecification",
827
- "opens": "00:00",
828
- "closes": "23:59"
829
- }
830
- });
831
-
832
- const localBusinessResolver = defineSchemaOrgResolver({
833
- defaults: {
834
- "@type": ["Organization", "LocalBusiness"]
835
- },
836
- inheritMeta: [
837
- { key: "url", meta: "host" },
838
- { key: "currenciesAccepted", meta: "currency" }
839
- ],
840
- idPrefix: ["host", IdentityId],
841
- resolve(node, ctx) {
842
- resolveDefaultType(node, ["Organization", "LocalBusiness"]);
843
- node.address = resolveRelation(node.address, ctx, addressResolver);
844
- node.openingHoursSpecification = resolveRelation(node.openingHoursSpecification, ctx, openingHoursResolver);
845
- node.logo = resolveRelation(node.logo, ctx, imageResolver, {
846
- afterResolve(logo) {
847
- const hasLogo = !!ctx.find("#logo");
848
- if (!hasLogo)
849
- logo["@id"] = prefixId(ctx.meta.host, "#logo");
850
- setIfEmpty(logo, "caption", node.name);
851
- }
852
- });
853
- return node;
854
- }
855
- });
856
-
857
- const ratingResolver = defineSchemaOrgResolver({
858
- cast(node) {
859
- if (node === "number") {
860
- return {
861
- ratingValue: node
862
- };
863
- }
864
- return node;
865
- },
866
- defaults: {
867
- "@type": "Rating",
868
- "bestRating": 5,
869
- "worstRating": 1
870
- }
871
- });
872
-
873
- const reviewResolver = defineSchemaOrgResolver({
874
- defaults: {
875
- "@type": "Review"
876
- },
877
- inheritMeta: [
878
- "inLanguage"
879
- ],
880
- resolve(review, ctx) {
881
- review.reviewRating = resolveRelation(review.reviewRating, ctx, ratingResolver);
882
- review.author = resolveRelation(review.author, ctx, personResolver);
883
- return review;
884
- }
885
- });
886
-
887
- const videoResolver = defineSchemaOrgResolver({
888
- cast(input) {
889
- if (typeof input === "string") {
890
- input = {
891
- url: input
892
- };
893
- }
894
- return input;
895
- },
896
- alias: "video",
897
- defaults: {
898
- "@type": "VideoObject"
899
- },
900
- inheritMeta: [
901
- { meta: "title", key: "name" },
902
- "description",
903
- "image",
904
- "inLanguage",
905
- { meta: "datePublished", key: "uploadDate" }
906
- ],
907
- idPrefix: "host",
908
- resolve(video, ctx) {
909
- if (video.uploadDate)
910
- video.uploadDate = resolvableDateToIso(video.uploadDate);
911
- video.url = resolveWithBase(ctx.meta.host, video.url);
912
- if (video.caption && !video.description)
913
- video.description = video.caption;
914
- if (!video.description)
915
- video.description = "No description";
916
- if (video.thumbnailUrl)
917
- video.thumbnailUrl = resolveRelation(video.thumbnailUrl, ctx, imageResolver);
918
- return video;
919
- },
920
- resolveRootNode(video, { find }) {
921
- if (video.image && !video.thumbnailUrl) {
922
- const firstImage = asArray(video.image)[0];
923
- setIfEmpty(video, "thumbnailUrl", find(firstImage["@id"])?.url);
924
- }
925
- }
926
- });
927
-
928
- const movieResolver = defineSchemaOrgResolver({
929
- defaults: {
930
- "@type": "Movie"
931
- },
932
- resolve(node, ctx) {
933
- node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
934
- node.review = resolveRelation(node.review, ctx, reviewResolver);
935
- node.director = resolveRelation(node.director, ctx, personResolver);
936
- node.actor = resolveRelation(node.actor, ctx, personResolver);
937
- node.trailer = resolveRelation(node.trailer, ctx, videoResolver);
938
- if (node.dateCreated)
939
- node.dateCreated = resolvableDateToDate(node.dateCreated);
940
- return node;
941
- }
942
- });
943
-
944
- const defaults = {
945
- ignoreUnknown: false,
946
- respectType: false,
947
- respectFunctionNames: false,
948
- respectFunctionProperties: false,
949
- unorderedObjects: true,
950
- unorderedArrays: false,
951
- unorderedSets: false
952
- };
953
- function objectHash(object, options = {}) {
954
- options = { ...defaults, ...options };
955
- const hasher = createHasher(options);
956
- hasher.dispatch(object);
957
- return hasher.toString();
47
+ function defineImage(input) {
48
+ return provideResolver(input, "image");
958
49
  }
959
- function createHasher(options) {
960
- const buff = [];
961
- let context = [];
962
- const write = (str) => {
963
- buff.push(str);
964
- };
965
- return {
966
- toString() {
967
- return buff.join("");
968
- },
969
- getContext() {
970
- return context;
971
- },
972
- dispatch(value) {
973
- if (options.replacer) {
974
- value = options.replacer(value);
975
- }
976
- const type = value === null ? "null" : typeof value;
977
- return this["_" + type](value);
978
- },
979
- _object(object) {
980
- const pattern = /\[object (.*)]/i;
981
- const objString = Object.prototype.toString.call(object);
982
- const _objType = pattern.exec(objString);
983
- const objType = _objType ? _objType[1].toLowerCase() : "unknown:[" + objString.toLowerCase() + "]";
984
- let objectNumber = null;
985
- if ((objectNumber = context.indexOf(object)) >= 0) {
986
- return this.dispatch("[CIRCULAR:" + objectNumber + "]");
987
- } else {
988
- context.push(object);
989
- }
990
- if (typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(object)) {
991
- write("buffer:");
992
- return write(object.toString("utf8"));
993
- }
994
- if (objType !== "object" && objType !== "function" && objType !== "asyncfunction") {
995
- if (this["_" + objType]) {
996
- this["_" + objType](object);
997
- } else if (options.ignoreUnknown) {
998
- return write("[" + objType + "]");
999
- } else {
1000
- throw new Error('Unknown object type "' + objType + '"');
1001
- }
1002
- } else {
1003
- let keys = Object.keys(object);
1004
- if (options.unorderedObjects) {
1005
- keys = keys.sort();
1006
- }
1007
- if (options.respectType !== false && !isNativeFunction(object)) {
1008
- keys.splice(0, 0, "prototype", "__proto__", "letructor");
1009
- }
1010
- if (options.excludeKeys) {
1011
- keys = keys.filter(function(key) {
1012
- return !options.excludeKeys(key);
1013
- });
1014
- }
1015
- write("object:" + keys.length + ":");
1016
- for (const key of keys) {
1017
- this.dispatch(key);
1018
- write(":");
1019
- if (!options.excludeValues) {
1020
- this.dispatch(object[key]);
1021
- }
1022
- write(",");
1023
- }
1024
- }
1025
- },
1026
- _array(arr, unordered) {
1027
- unordered = typeof unordered !== "undefined" ? unordered : options.unorderedArrays !== false;
1028
- write("array:" + arr.length + ":");
1029
- if (!unordered || arr.length <= 1) {
1030
- for (const entry of arr) {
1031
- this.dispatch(entry);
1032
- }
1033
- return;
1034
- }
1035
- const contextAdditions = [];
1036
- const entries = arr.map((entry) => {
1037
- const hasher = createHasher(options);
1038
- hasher.dispatch(entry);
1039
- contextAdditions.push(hasher.getContext());
1040
- return hasher.toString();
1041
- });
1042
- context = [...context, ...contextAdditions];
1043
- entries.sort();
1044
- return this._array(entries, false);
1045
- },
1046
- _date(date) {
1047
- return write("date:" + date.toJSON());
1048
- },
1049
- _symbol(sym) {
1050
- return write("symbol:" + sym.toString());
1051
- },
1052
- _error(err) {
1053
- return write("error:" + err.toString());
1054
- },
1055
- _boolean(bool) {
1056
- return write("bool:" + bool.toString());
1057
- },
1058
- _string(string) {
1059
- write("string:" + string.length + ":");
1060
- write(string.toString());
1061
- },
1062
- _function(fn) {
1063
- write("fn:");
1064
- if (isNativeFunction(fn)) {
1065
- this.dispatch("[native]");
1066
- } else {
1067
- this.dispatch(fn.toString());
1068
- }
1069
- if (options.respectFunctionNames !== false) {
1070
- this.dispatch("function-name:" + String(fn.name));
1071
- }
1072
- if (options.respectFunctionProperties) {
1073
- this._object(fn);
1074
- }
1075
- },
1076
- _number(number) {
1077
- return write("number:" + number.toString());
1078
- },
1079
- _xml(xml) {
1080
- return write("xml:" + xml.toString());
1081
- },
1082
- _null() {
1083
- return write("Null");
1084
- },
1085
- _undefined() {
1086
- return write("Undefined");
1087
- },
1088
- _regexp(regex) {
1089
- return write("regex:" + regex.toString());
1090
- },
1091
- _uint8array(arr) {
1092
- write("uint8array:");
1093
- return this.dispatch(Array.prototype.slice.call(arr));
1094
- },
1095
- _uint8clampedarray(arr) {
1096
- write("uint8clampedarray:");
1097
- return this.dispatch(Array.prototype.slice.call(arr));
1098
- },
1099
- _int8array(arr) {
1100
- write("int8array:");
1101
- return this.dispatch(Array.prototype.slice.call(arr));
1102
- },
1103
- _uint16array(arr) {
1104
- write("uint16array:");
1105
- return this.dispatch(Array.prototype.slice.call(arr));
1106
- },
1107
- _int16array(arr) {
1108
- write("int16array:");
1109
- return this.dispatch(Array.prototype.slice.call(arr));
1110
- },
1111
- _uint32array(arr) {
1112
- write("uint32array:");
1113
- return this.dispatch(Array.prototype.slice.call(arr));
1114
- },
1115
- _int32array(arr) {
1116
- write("int32array:");
1117
- return this.dispatch(Array.prototype.slice.call(arr));
1118
- },
1119
- _float32array(arr) {
1120
- write("float32array:");
1121
- return this.dispatch(Array.prototype.slice.call(arr));
1122
- },
1123
- _float64array(arr) {
1124
- write("float64array:");
1125
- return this.dispatch(Array.prototype.slice.call(arr));
1126
- },
1127
- _arraybuffer(arr) {
1128
- write("arraybuffer:");
1129
- return this.dispatch(new Uint8Array(arr));
1130
- },
1131
- _url(url) {
1132
- return write("url:" + url.toString());
1133
- },
1134
- _map(map) {
1135
- write("map:");
1136
- const arr = [...map];
1137
- return this._array(arr, options.unorderedSets !== false);
1138
- },
1139
- _set(set) {
1140
- write("set:");
1141
- const arr = [...set];
1142
- return this._array(arr, options.unorderedSets !== false);
1143
- },
1144
- _file(file) {
1145
- write("file:");
1146
- return this.dispatch([file.name, file.size, file.type, file.lastModfied]);
1147
- },
1148
- _blob() {
1149
- if (options.ignoreUnknown) {
1150
- return write("[blob]");
1151
- }
1152
- throw new Error('Hashing Blob objects is currently not supported\nUse "options.replacer" or "options.ignoreUnknown"\n');
1153
- },
1154
- _domwindow() {
1155
- return write("domwindow");
1156
- },
1157
- _bigint(number) {
1158
- return write("bigint:" + number.toString());
1159
- },
1160
- _process() {
1161
- return write("process");
1162
- },
1163
- _timer() {
1164
- return write("timer");
1165
- },
1166
- _pipe() {
1167
- return write("pipe");
1168
- },
1169
- _tcp() {
1170
- return write("tcp");
1171
- },
1172
- _udp() {
1173
- return write("udp");
1174
- },
1175
- _tty() {
1176
- return write("tty");
1177
- },
1178
- _statwatcher() {
1179
- return write("statwatcher");
1180
- },
1181
- _securecontext() {
1182
- return write("securecontext");
1183
- },
1184
- _connection() {
1185
- return write("connection");
1186
- },
1187
- _zlib() {
1188
- return write("zlib");
1189
- },
1190
- _context() {
1191
- return write("context");
1192
- },
1193
- _nodescript() {
1194
- return write("nodescript");
1195
- },
1196
- _httpparser() {
1197
- return write("httpparser");
1198
- },
1199
- _dataview() {
1200
- return write("dataview");
1201
- },
1202
- _signal() {
1203
- return write("signal");
1204
- },
1205
- _fsevent() {
1206
- return write("fsevent");
1207
- },
1208
- _tlswrap() {
1209
- return write("tlswrap");
1210
- }
1211
- };
50
+ function defineJobPosting(input) {
51
+ return provideResolver(input, "jobPosting");
1212
52
  }
1213
- function isNativeFunction(f) {
1214
- if (typeof f !== "function") {
1215
- return false;
1216
- }
1217
- const exp = /^function\s+\w*\s*\(\s*\)\s*{\s+\[native code]\s+}$/i;
1218
- return exp.exec(Function.prototype.toString.call(f)) != null;
53
+ function defineLocalBusiness(input) {
54
+ return provideResolver(input, "localBusiness");
1219
55
  }
1220
-
1221
- class WordArray {
1222
- constructor(words, sigBytes) {
1223
- words = this.words = words || [];
1224
- this.sigBytes = sigBytes !== void 0 ? sigBytes : words.length * 4;
1225
- }
1226
- toString(encoder) {
1227
- return (encoder || Hex).stringify(this);
1228
- }
1229
- concat(wordArray) {
1230
- this.clamp();
1231
- if (this.sigBytes % 4) {
1232
- for (let i = 0; i < wordArray.sigBytes; i++) {
1233
- const thatByte = wordArray.words[i >>> 2] >>> 24 - i % 4 * 8 & 255;
1234
- this.words[this.sigBytes + i >>> 2] |= thatByte << 24 - (this.sigBytes + i) % 4 * 8;
1235
- }
1236
- } else {
1237
- for (let j = 0; j < wordArray.sigBytes; j += 4) {
1238
- this.words[this.sigBytes + j >>> 2] = wordArray.words[j >>> 2];
1239
- }
1240
- }
1241
- this.sigBytes += wordArray.sigBytes;
1242
- return this;
1243
- }
1244
- clamp() {
1245
- this.words[this.sigBytes >>> 2] &= 4294967295 << 32 - this.sigBytes % 4 * 8;
1246
- this.words.length = Math.ceil(this.sigBytes / 4);
1247
- }
1248
- clone() {
1249
- return new WordArray([...this.words]);
1250
- }
56
+ function defineOffer(input) {
57
+ return provideResolver(input, "offer");
1251
58
  }
1252
- const Hex = {
1253
- stringify(wordArray) {
1254
- const hexChars = [];
1255
- for (let i = 0; i < wordArray.sigBytes; i++) {
1256
- const bite = wordArray.words[i >>> 2] >>> 24 - i % 4 * 8 & 255;
1257
- hexChars.push(
1258
- (bite >>> 4).toString(16),
1259
- (bite & 15).toString(16)
1260
- );
1261
- }
1262
- return hexChars.join("");
1263
- }
1264
- };
1265
- const Base64 = {
1266
- stringify(wordArray) {
1267
- const keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
1268
- const base64Chars = [];
1269
- for (let i = 0; i < wordArray.sigBytes; i += 3) {
1270
- const byte1 = wordArray.words[i >>> 2] >>> 24 - i % 4 * 8 & 255;
1271
- const byte2 = wordArray.words[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 255;
1272
- const byte3 = wordArray.words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 255;
1273
- const triplet = byte1 << 16 | byte2 << 8 | byte3;
1274
- for (let j = 0; j < 4 && i * 8 + j * 6 < wordArray.sigBytes * 8; j++) {
1275
- base64Chars.push(keyStr.charAt(triplet >>> 6 * (3 - j) & 63));
1276
- }
1277
- }
1278
- return base64Chars.join("");
1279
- }
1280
- };
1281
- const Latin1 = {
1282
- parse(latin1Str) {
1283
- const latin1StrLength = latin1Str.length;
1284
- const words = [];
1285
- for (let i = 0; i < latin1StrLength; i++) {
1286
- words[i >>> 2] |= (latin1Str.charCodeAt(i) & 255) << 24 - i % 4 * 8;
1287
- }
1288
- return new WordArray(words, latin1StrLength);
1289
- }
1290
- };
1291
- const Utf8 = {
1292
- parse(utf8Str) {
1293
- return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
1294
- }
1295
- };
1296
- class BufferedBlockAlgorithm {
1297
- constructor() {
1298
- this._minBufferSize = 0;
1299
- this.blockSize = 512 / 32;
1300
- this.reset();
1301
- }
1302
- reset() {
1303
- this._data = new WordArray();
1304
- this._nDataBytes = 0;
1305
- }
1306
- _append(data) {
1307
- if (typeof data === "string") {
1308
- data = Utf8.parse(data);
1309
- }
1310
- this._data.concat(data);
1311
- this._nDataBytes += data.sigBytes;
1312
- }
1313
- _doProcessBlock(_dataWords, _offset) {
1314
- }
1315
- _process(doFlush) {
1316
- let processedWords;
1317
- let nBlocksReady = this._data.sigBytes / (this.blockSize * 4);
1318
- if (doFlush) {
1319
- nBlocksReady = Math.ceil(nBlocksReady);
1320
- } else {
1321
- nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
1322
- }
1323
- const nWordsReady = nBlocksReady * this.blockSize;
1324
- const nBytesReady = Math.min(nWordsReady * 4, this._data.sigBytes);
1325
- if (nWordsReady) {
1326
- for (let offset = 0; offset < nWordsReady; offset += this.blockSize) {
1327
- this._doProcessBlock(this._data.words, offset);
1328
- }
1329
- processedWords = this._data.words.splice(0, nWordsReady);
1330
- this._data.sigBytes -= nBytesReady;
1331
- }
1332
- return new WordArray(processedWords, nBytesReady);
1333
- }
59
+ function defineOpeningHours(input) {
60
+ return provideResolver(input, "openingHours");
1334
61
  }
1335
- class Hasher extends BufferedBlockAlgorithm {
1336
- update(messageUpdate) {
1337
- this._append(messageUpdate);
1338
- this._process();
1339
- return this;
1340
- }
1341
- finalize(messageUpdate) {
1342
- if (messageUpdate) {
1343
- this._append(messageUpdate);
1344
- }
1345
- }
62
+ function defineOrganization(input) {
63
+ return provideResolver(input, "organization");
1346
64
  }
1347
-
1348
- const H = [1779033703, -1150833019, 1013904242, -1521486534, 1359893119, -1694144372, 528734635, 1541459225];
1349
- const K = [1116352408, 1899447441, -1245643825, -373957723, 961987163, 1508970993, -1841331548, -1424204075, -670586216, 310598401, 607225278, 1426881987, 1925078388, -2132889090, -1680079193, -1046744716, -459576895, -272742522, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, -1740746414, -1473132947, -1341970488, -1084653625, -958395405, -710438585, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, -2117940946, -1838011259, -1564481375, -1474664885, -1035236496, -949202525, -778901479, -694614492, -200395387, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, -2067236844, -1933114872, -1866530822, -1538233109, -1090935817, -965641998];
1350
- const W = [];
1351
- class SHA256 extends Hasher {
1352
- constructor() {
1353
- super();
1354
- this.reset();
1355
- }
1356
- reset() {
1357
- super.reset();
1358
- this._hash = new WordArray([...H]);
1359
- }
1360
- _doProcessBlock(M, offset) {
1361
- const H2 = this._hash.words;
1362
- let a = H2[0];
1363
- let b = H2[1];
1364
- let c = H2[2];
1365
- let d = H2[3];
1366
- let e = H2[4];
1367
- let f = H2[5];
1368
- let g = H2[6];
1369
- let h = H2[7];
1370
- for (let i = 0; i < 64; i++) {
1371
- if (i < 16) {
1372
- W[i] = M[offset + i] | 0;
1373
- } else {
1374
- const gamma0x = W[i - 15];
1375
- const gamma0 = (gamma0x << 25 | gamma0x >>> 7) ^ (gamma0x << 14 | gamma0x >>> 18) ^ gamma0x >>> 3;
1376
- const gamma1x = W[i - 2];
1377
- const gamma1 = (gamma1x << 15 | gamma1x >>> 17) ^ (gamma1x << 13 | gamma1x >>> 19) ^ gamma1x >>> 10;
1378
- W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
1379
- }
1380
- const ch = e & f ^ ~e & g;
1381
- const maj = a & b ^ a & c ^ b & c;
1382
- const sigma0 = (a << 30 | a >>> 2) ^ (a << 19 | a >>> 13) ^ (a << 10 | a >>> 22);
1383
- const sigma1 = (e << 26 | e >>> 6) ^ (e << 21 | e >>> 11) ^ (e << 7 | e >>> 25);
1384
- const t1 = h + sigma1 + ch + K[i] + W[i];
1385
- const t2 = sigma0 + maj;
1386
- h = g;
1387
- g = f;
1388
- f = e;
1389
- e = d + t1 | 0;
1390
- d = c;
1391
- c = b;
1392
- b = a;
1393
- a = t1 + t2 | 0;
1394
- }
1395
- H2[0] = H2[0] + a | 0;
1396
- H2[1] = H2[1] + b | 0;
1397
- H2[2] = H2[2] + c | 0;
1398
- H2[3] = H2[3] + d | 0;
1399
- H2[4] = H2[4] + e | 0;
1400
- H2[5] = H2[5] + f | 0;
1401
- H2[6] = H2[6] + g | 0;
1402
- H2[7] = H2[7] + h | 0;
1403
- }
1404
- finalize(messageUpdate) {
1405
- super.finalize(messageUpdate);
1406
- const nBitsTotal = this._nDataBytes * 8;
1407
- const nBitsLeft = this._data.sigBytes * 8;
1408
- this._data.words[nBitsLeft >>> 5] |= 128 << 24 - nBitsLeft % 32;
1409
- this._data.words[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 4294967296);
1410
- this._data.words[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal;
1411
- this._data.sigBytes = this._data.words.length * 4;
1412
- this._process();
1413
- return this._hash;
1414
- }
65
+ function definePerson(input) {
66
+ return provideResolver(input, "person");
1415
67
  }
1416
- function sha256base64(message) {
1417
- return new SHA256().finalize(message).toString(Base64);
68
+ function defineProduct(input) {
69
+ return provideResolver(input, "product");
1418
70
  }
1419
-
1420
- function hash(object, options = {}) {
1421
- const hashed = typeof object === "string" ? object : objectHash(object, options);
1422
- return sha256base64(hashed).slice(0, 10);
71
+ function defineQuestion(input) {
72
+ return provideResolver(input, "question");
1423
73
  }
1424
-
1425
- const ProductId = "#product";
1426
- const productResolver = defineSchemaOrgResolver({
1427
- defaults: {
1428
- "@type": "Product"
1429
- },
1430
- inheritMeta: [
1431
- "description",
1432
- "image",
1433
- { meta: "title", key: "name" }
1434
- ],
1435
- idPrefix: ["url", ProductId],
1436
- resolve(node, ctx) {
1437
- setIfEmpty(node, "sku", hash(node.name));
1438
- node.aggregateOffer = resolveRelation(node.aggregateOffer, ctx, aggregateOfferResolver);
1439
- node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
1440
- node.offers = resolveRelation(node.offers, ctx, offerResolver);
1441
- node.review = resolveRelation(node.review, ctx, reviewResolver);
1442
- return node;
1443
- },
1444
- resolveRootNode(product, { find }) {
1445
- const webPage = find(PrimaryWebPageId);
1446
- const identity = find(IdentityId);
1447
- if (identity)
1448
- setIfEmpty(product, "brand", idReference(identity));
1449
- if (webPage)
1450
- setIfEmpty(product, "mainEntityOfPage", idReference(webPage));
1451
- return product;
1452
- }
1453
- });
1454
-
1455
- const answerResolver = defineSchemaOrgResolver({
1456
- cast(node) {
1457
- if (typeof node === "string") {
1458
- return {
1459
- text: node
1460
- };
1461
- }
1462
- return node;
1463
- },
1464
- defaults: {
1465
- "@type": "Answer"
1466
- }
1467
- });
1468
-
1469
- const questionResolver = defineSchemaOrgResolver({
1470
- defaults: {
1471
- "@type": "Question"
1472
- },
1473
- inheritMeta: [
1474
- "inLanguage"
1475
- ],
1476
- idPrefix: "url",
1477
- resolve(question, ctx) {
1478
- if (question.question)
1479
- question.name = question.question;
1480
- if (question.answer)
1481
- question.acceptedAnswer = question.answer;
1482
- question.acceptedAnswer = resolveRelation(question.acceptedAnswer, ctx, answerResolver);
1483
- return question;
1484
- },
1485
- resolveRootNode(question, { find }) {
1486
- const webPage = find(PrimaryWebPageId);
1487
- if (webPage && asArray(webPage["@type"]).includes("FAQPage"))
1488
- dedupeMerge(webPage, "mainEntity", idReference(question));
1489
- }
1490
- });
1491
-
1492
- const RecipeId = "#recipe";
1493
- const recipeResolver = defineSchemaOrgResolver({
1494
- defaults: {
1495
- "@type": "Recipe"
1496
- },
1497
- inheritMeta: [
1498
- { meta: "title", key: "name" },
1499
- "description",
1500
- "image",
1501
- "datePublished"
1502
- ],
1503
- idPrefix: ["url", RecipeId],
1504
- resolve(node, ctx) {
1505
- node.recipeInstructions = resolveRelation(node.recipeInstructions, ctx, howToStepResolver);
1506
- return node;
1507
- },
1508
- resolveRootNode(node, { find }) {
1509
- const article = find(PrimaryArticleId);
1510
- const webPage = find(PrimaryWebPageId);
1511
- if (article)
1512
- setIfEmpty(node, "mainEntityOfPage", idReference(article));
1513
- else if (webPage)
1514
- setIfEmpty(node, "mainEntityOfPage", idReference(webPage));
1515
- if (article?.author)
1516
- setIfEmpty(node, "author", article.author);
1517
- return node;
1518
- }
1519
- });
1520
-
1521
- const softwareAppResolver = defineSchemaOrgResolver({
1522
- defaults: {
1523
- "@type": "SoftwareApplication"
1524
- },
1525
- resolve(node, ctx) {
1526
- resolveDefaultType(node, "SoftwareApplication");
1527
- node.offers = resolveRelation(node.offers, ctx, offerResolver);
1528
- node.aggregateRating = resolveRelation(node.aggregateRating, ctx, aggregateRatingResolver);
1529
- node.review = resolveRelation(node.review, ctx, reviewResolver);
1530
- return node;
1531
- }
1532
- });
1533
-
1534
- function loadResolver(resolver) {
1535
- switch (resolver) {
1536
- case "address":
1537
- return addressResolver;
1538
- case "aggregateOffer":
1539
- return aggregateOfferResolver;
1540
- case "aggregateRating":
1541
- return aggregateRatingResolver;
1542
- case "article":
1543
- return articleResolver;
1544
- case "breadcrumb":
1545
- return breadcrumbResolver;
1546
- case "comment":
1547
- return commentResolver;
1548
- case "event":
1549
- return eventResolver;
1550
- case "virtualLocation":
1551
- return virtualLocationResolver;
1552
- case "place":
1553
- return placeResolver;
1554
- case "howTo":
1555
- return howToResolver;
1556
- case "howToStep":
1557
- return howToStepResolver;
1558
- case "image":
1559
- return imageResolver;
1560
- case "localBusiness":
1561
- return localBusinessResolver;
1562
- case "offer":
1563
- return offerResolver;
1564
- case "openingHours":
1565
- return openingHoursResolver;
1566
- case "organization":
1567
- return organizationResolver;
1568
- case "person":
1569
- return personResolver;
1570
- case "product":
1571
- return productResolver;
1572
- case "question":
1573
- return questionResolver;
1574
- case "recipe":
1575
- return recipeResolver;
1576
- case "review":
1577
- return reviewResolver;
1578
- case "video":
1579
- return videoResolver;
1580
- case "webPage":
1581
- return webPageResolver;
1582
- case "webSite":
1583
- return webSiteResolver;
1584
- case "book":
1585
- return bookResolver;
1586
- case "course":
1587
- return courseResolver;
1588
- case "itemList":
1589
- return itemListResolver;
1590
- case "jobPosting":
1591
- return jobPostingResolver;
1592
- case "listItem":
1593
- return listItemResolver;
1594
- case "movie":
1595
- return movieResolver;
1596
- case "searchAction":
1597
- return searchActionResolver;
1598
- case "readAction":
1599
- return readActionResolver;
1600
- case "softwareApp":
1601
- return softwareAppResolver;
1602
- case "bookEdition":
1603
- return bookEditionResolver;
1604
- }
1605
- return null;
74
+ function defineRecipe(input) {
75
+ return provideResolver(input, "recipe");
1606
76
  }
1607
-
1608
- const resolver = {
1609
- __proto__: null,
1610
- loadResolver: loadResolver
1611
- };
1612
-
1613
- const resolveMeta = (meta) => {
1614
- if (!meta.host && meta.canonicalHost)
1615
- meta.host = meta.canonicalHost;
1616
- if (!meta.tagPosition && meta.position)
1617
- meta.tagPosition = meta.position;
1618
- if (!meta.currency && meta.defaultCurrency)
1619
- meta.currency = meta.defaultCurrency;
1620
- if (!meta.inLanguage && meta.defaultLanguage)
1621
- meta.inLanguage = meta.defaultLanguage;
1622
- if (!meta.path)
1623
- meta.path = "/";
1624
- if (!meta.host && typeof document !== "undefined")
1625
- meta.host = document.location.host;
1626
- if (!meta.url && meta.canonicalUrl)
1627
- meta.url = meta.canonicalUrl;
1628
- if (meta.path !== "/") {
1629
- if (meta.trailingSlash && !hasTrailingSlash(meta.path))
1630
- meta.path = withTrailingSlash(meta.path);
1631
- else if (!meta.trailingSlash && hasTrailingSlash(meta.path))
1632
- meta.path = withoutTrailingSlash(meta.path);
1633
- }
1634
- meta.url = joinURL(meta.host, meta.path);
1635
- return {
1636
- ...meta,
1637
- host: meta.host,
1638
- url: meta.url,
1639
- currency: meta.currency,
1640
- image: meta.image,
1641
- inLanguage: meta.inLanguage,
1642
- title: meta.title,
1643
- description: meta.description,
1644
- datePublished: meta.datePublished,
1645
- dateModified: meta.dateModified
1646
- };
1647
- };
1648
- const resolveNode = (node, ctx, resolver) => {
1649
- if (resolver?.cast)
1650
- node = resolver.cast(node, ctx);
1651
- if (resolver?.defaults) {
1652
- let defaults = resolver.defaults || {};
1653
- if (typeof defaults === "function")
1654
- defaults = defaults(ctx);
1655
- node = {
1656
- ...defaults,
1657
- ...node
1658
- };
1659
- }
1660
- resolver.inheritMeta?.forEach((entry) => {
1661
- if (typeof entry === "string")
1662
- setIfEmpty(node, entry, ctx.meta[entry]);
1663
- else
1664
- setIfEmpty(node, entry.key, ctx.meta[entry.meta]);
1665
- });
1666
- if (resolver?.resolve)
1667
- node = resolver.resolve(node, ctx);
1668
- for (const k in node) {
1669
- const v = node[k];
1670
- if (typeof v === "object" && v?._resolver)
1671
- node[k] = resolveRelation(v, ctx, v._resolver);
1672
- }
1673
- stripEmptyProperties(node);
1674
- return node;
1675
- };
1676
- const resolveNodeId = (node, ctx, resolver, resolveAsRoot = false) => {
1677
- const prefix = Array.isArray(resolver.idPrefix) ? resolver.idPrefix[0] : resolver.idPrefix;
1678
- if (!prefix)
1679
- return node;
1680
- if (node["@id"] && !node["@id"].startsWith(ctx.meta.host)) {
1681
- node["@id"] = prefixId(ctx.meta[prefix], node["@id"]);
1682
- return node;
1683
- }
1684
- const rootId = Array.isArray(resolver.idPrefix) ? resolver.idPrefix?.[1] : void 0;
1685
- if (resolveAsRoot && rootId) {
1686
- node["@id"] = prefixId(ctx.meta[prefix], rootId);
1687
- }
1688
- if (!node["@id"]) {
1689
- let alias = resolver?.alias;
1690
- if (!alias) {
1691
- const type = asArray(node["@type"])?.[0] || "";
1692
- alias = type.toLowerCase();
1693
- }
1694
- const hashNodeData = {};
1695
- Object.entries(node).forEach(([key, val]) => {
1696
- if (!key.startsWith("_"))
1697
- hashNodeData[key] = val;
1698
- });
1699
- node["@id"] = prefixId(ctx.meta[prefix], `#/schema/${alias}/${hashCode(JSON.stringify(hashNodeData))}`);
1700
- }
1701
- return node;
1702
- };
1703
- function resolveRelation(input, ctx, fallbackResolver, options = {}) {
1704
- if (!input)
1705
- return input;
1706
- const ids = asArray(input).map((a) => {
1707
- if (Object.keys(a).length === 1 && a["@id"])
1708
- return a;
1709
- let resolver = fallbackResolver;
1710
- if (a._resolver) {
1711
- resolver = a._resolver;
1712
- if (typeof resolver === "string")
1713
- resolver = loadResolver(resolver);
1714
- delete a._resolver;
1715
- }
1716
- if (!resolver)
1717
- return a;
1718
- let node = resolveNode(a, ctx, resolver);
1719
- if (options.afterResolve)
1720
- options.afterResolve(node);
1721
- if (options.generateId || options.root)
1722
- node = resolveNodeId(node, ctx, resolver, false);
1723
- if (options.root) {
1724
- if (resolver.resolveRootNode)
1725
- resolver.resolveRootNode(node, ctx);
1726
- ctx.push(node);
1727
- return idReference(node["@id"]);
1728
- }
1729
- return node;
1730
- });
1731
- if (!options.array && ids.length === 1)
1732
- return ids[0];
1733
- return ids;
77
+ function defineReview(input) {
78
+ return provideResolver(input, "review");
1734
79
  }
1735
-
1736
- const groupBy = (array, predicate) => array.reduce((acc, value, index, array2) => {
1737
- const key = predicate(value, index, array2);
1738
- if (!acc[key])
1739
- acc[key] = [];
1740
- acc[key].push(value);
1741
- return acc;
1742
- }, {});
1743
- const dedupeNodes = (nodes) => {
1744
- const sortedNodeKeys = nodes.keys();
1745
- const dedupedNodes = {};
1746
- for (const key of sortedNodeKeys) {
1747
- const n = nodes[key];
1748
- const nodeKey = resolveAsGraphKey(n["@id"] || hash(n));
1749
- const groupedKeys = groupBy(Object.keys(n), (key2) => {
1750
- const val = n[key2];
1751
- if (key2.startsWith("_"))
1752
- return "ignored";
1753
- if (Array.isArray(val) || typeof val === "object")
1754
- return "relations";
1755
- return "primitives";
1756
- });
1757
- const keys = [
1758
- ...(groupedKeys.primitives || []).sort(),
1759
- ...(groupedKeys.relations || []).sort()
1760
- ];
1761
- const newNode = {};
1762
- for (const key2 of keys)
1763
- newNode[key2] = n[key2];
1764
- dedupedNodes[nodeKey] = newNode;
1765
- }
1766
- return Object.values(dedupedNodes);
1767
- };
1768
-
1769
- const createSchemaOrgGraph = () => {
1770
- const ctx = {
1771
- find(id) {
1772
- const key = resolveAsGraphKey(id);
1773
- return ctx.nodes.filter((n) => !!n["@id"]).find((n) => resolveAsGraphKey(n["@id"]) === key);
1774
- },
1775
- push(input) {
1776
- asArray(input).forEach((node) => {
1777
- const registeredNode = node;
1778
- ctx.nodes.push(registeredNode);
1779
- });
1780
- },
1781
- resolveGraph(meta) {
1782
- ctx.meta = resolveMeta({ ...meta });
1783
- ctx.nodes.forEach((node, key) => {
1784
- const resolver = node._resolver;
1785
- if (resolver) {
1786
- node = resolveNode(node, ctx, resolver);
1787
- node = resolveNodeId(node, ctx, resolver, true);
1788
- }
1789
- ctx.nodes[key] = node;
1790
- });
1791
- ctx.nodes.forEach((node) => {
1792
- if (node.image && typeof node.image === "string") {
1793
- node.image = resolveRelation(node.image, ctx, imageResolver, {
1794
- root: true
1795
- });
1796
- }
1797
- if (node._resolver?.resolveRootNode)
1798
- node._resolver.resolveRootNode(node, ctx);
1799
- delete node._resolver;
1800
- });
1801
- return dedupeNodes(ctx.nodes);
1802
- },
1803
- nodes: [],
1804
- meta: {}
1805
- };
1806
- return ctx;
1807
- };
1808
-
1809
- function SchemaOrgUnheadPlugin(config, meta) {
1810
- config = resolveMeta({ ...config });
1811
- let graph;
1812
- const resolvedMeta = {};
1813
- return {
1814
- hooks: {
1815
- "entries:resolve": function() {
1816
- graph = createSchemaOrgGraph();
1817
- },
1818
- "tag:normalise": async function({ tag }) {
1819
- if (tag.key === "schema-org-graph") {
1820
- const { loadResolver } = await Promise.resolve().then(function () { return resolver; });
1821
- const nodes = await tag.props.nodes;
1822
- for (const node of Array.isArray(nodes) ? nodes : [nodes]) {
1823
- const newNode = {
1824
- ...node,
1825
- _resolver: loadResolver(await node._resolver)
1826
- };
1827
- graph.push(newNode);
1828
- }
1829
- tag.tagPosition = config.tagPosition === "head" ? "head" : "bodyClose";
1830
- }
1831
- if (tag.tag === "title")
1832
- resolvedMeta.title = tag.textContent;
1833
- else if (tag.tag === "meta" && tag.props.name === "description")
1834
- resolvedMeta.description = tag.props.content;
1835
- else if (tag.tag === "link" && tag.props.rel === "canonical")
1836
- resolvedMeta.url = tag.props.href;
1837
- else if (tag.tag === "meta" && tag.props.property === "og:image")
1838
- resolvedMeta.image = tag.props.content;
1839
- },
1840
- "tags:resolve": async function(ctx) {
1841
- for (const tag of ctx.tags) {
1842
- if (tag.tag === "script" && tag.key === "schema-org-graph") {
1843
- tag.innerHTML = JSON.stringify({
1844
- "@context": "https://schema.org",
1845
- "@graph": graph.resolveGraph({ ...config, ...resolvedMeta, ...await meta() })
1846
- }, null, 2);
1847
- delete tag.props.nodes;
1848
- }
1849
- }
1850
- }
1851
- }
1852
- };
80
+ function defineVideo(input) {
81
+ return provideResolver(input, "video");
82
+ }
83
+ function defineWebPage(input) {
84
+ return provideResolver(input, "webPage");
85
+ }
86
+ function defineWebSite(input) {
87
+ return provideResolver(input, "webSite");
88
+ }
89
+ function defineBook(input) {
90
+ return provideResolver(input, "book");
91
+ }
92
+ function defineCourse(input) {
93
+ return provideResolver(input, "course");
94
+ }
95
+ function defineItemList(input) {
96
+ return provideResolver(input, "itemList");
97
+ }
98
+ function defineListItem(input) {
99
+ return provideResolver(input, "listItem");
100
+ }
101
+ function defineMovie(input) {
102
+ return provideResolver(input, "movie");
103
+ }
104
+ function defineSearchAction(input) {
105
+ return provideResolver(input, "searchAction");
106
+ }
107
+ function defineReadAction(input) {
108
+ return provideResolver(input, "readAction");
109
+ }
110
+ function defineSoftwareApp(input) {
111
+ return provideResolver(input, "softwareApp");
112
+ }
113
+ function defineBookEdition(input) {
114
+ return provideResolver(input, "bookEdition");
1853
115
  }
1854
-
1855
- const provideResolver = (input, resolver) => {
1856
- if (!input)
1857
- input = {};
1858
- input._resolver = resolver;
1859
- return input;
1860
- };
1861
- const defineAddress = (input) => provideResolver(input, "address");
1862
- const defineAggregateOffer = (input) => provideResolver(input, "aggregateOffer");
1863
- const defineAggregateRating = (input) => provideResolver(input, "aggregateRating");
1864
- const defineArticle = (input) => provideResolver(input, "article");
1865
- const defineBreadcrumb = (input) => provideResolver(input, "breadcrumb");
1866
- const defineComment = (input) => provideResolver(input, "comment");
1867
- const defineEvent = (input) => provideResolver(input, "event");
1868
- const defineVirtualLocation = (input) => provideResolver(input, "virtualLocation");
1869
- const definePlace = (input) => provideResolver(input, "place");
1870
- const defineHowTo = (input) => provideResolver(input, "howTo");
1871
- const defineHowToStep = (input) => provideResolver(input, "howToStep");
1872
- const defineImage = (input) => provideResolver(input, "image");
1873
- const defineJobPosting = (input) => provideResolver(input, "jobPosting");
1874
- const defineLocalBusiness = (input) => provideResolver(input, "localBusiness");
1875
- const defineOffer = (input) => provideResolver(input, "offer");
1876
- const defineOpeningHours = (input) => provideResolver(input, "openingHours");
1877
- const defineOrganization = (input) => provideResolver(input, "organization");
1878
- const definePerson = (input) => provideResolver(input, "person");
1879
- const defineProduct = (input) => provideResolver(input, "product");
1880
- const defineQuestion = (input) => provideResolver(input, "question");
1881
- const defineRecipe = (input) => provideResolver(input, "recipe");
1882
- const defineReview = (input) => provideResolver(input, "review");
1883
- const defineVideo = (input) => provideResolver(input, "video");
1884
- const defineWebPage = (input) => provideResolver(input, "webPage");
1885
- const defineWebSite = (input) => provideResolver(input, "webSite");
1886
- const defineBook = (input) => provideResolver(input, "book");
1887
- const defineCourse = (input) => provideResolver(input, "course");
1888
- const defineItemList = (input) => provideResolver(input, "itemList");
1889
- const defineListItem = (input) => provideResolver(input, "listItem");
1890
- const defineMovie = (input) => provideResolver(input, "movie");
1891
- const defineSearchAction = (input) => provideResolver(input, "searchAction");
1892
- const defineReadAction = (input) => provideResolver(input, "readAction");
1893
- const defineSoftwareApp = (input) => provideResolver(input, "softwareApp");
1894
- const defineBookEdition = (input) => provideResolver(input, "bookEdition");
1895
116
  function useSchemaOrg(input) {
1896
117
  return unhead.useHead({
1897
118
  script: [
@@ -1901,30 +122,63 @@ function useSchemaOrg(input) {
1901
122
  nodes: input
1902
123
  }
1903
124
  ]
1904
- }, { mode: process.env.NODE_ENV === "development" ? "all" : "server" });
125
+ });
1905
126
  }
1906
127
 
1907
- exports.HowToId = HowToId;
1908
- exports.PrimaryArticleId = PrimaryArticleId;
1909
- exports.PrimaryBookId = PrimaryBookId;
1910
- exports.PrimaryBreadcrumbId = PrimaryBreadcrumbId;
1911
- exports.PrimaryEventId = PrimaryEventId;
1912
- exports.PrimaryWebPageId = PrimaryWebPageId;
1913
- exports.PrimaryWebSiteId = PrimaryWebSiteId;
1914
- exports.ProductId = ProductId;
1915
- exports.RecipeId = RecipeId;
1916
- exports.SchemaOrgUnheadPlugin = SchemaOrgUnheadPlugin;
1917
- exports.addressResolver = addressResolver;
1918
- exports.aggregateOfferResolver = aggregateOfferResolver;
1919
- exports.aggregateRatingResolver = aggregateRatingResolver;
1920
- exports.articleResolver = articleResolver;
1921
- exports.bookEditionResolver = bookEditionResolver;
1922
- exports.bookResolver = bookResolver;
1923
- exports.breadcrumbResolver = breadcrumbResolver;
1924
- exports.commentResolver = commentResolver;
1925
- exports.courseResolver = courseResolver;
1926
- exports.createSchemaOrgGraph = createSchemaOrgGraph;
1927
- exports.dedupeNodes = dedupeNodes;
128
+ exports.HowToId = SchemaOrgUnheadPlugin.HowToId;
129
+ exports.PrimaryArticleId = SchemaOrgUnheadPlugin.PrimaryArticleId;
130
+ exports.PrimaryBookId = SchemaOrgUnheadPlugin.PrimaryBookId;
131
+ exports.PrimaryBreadcrumbId = SchemaOrgUnheadPlugin.PrimaryBreadcrumbId;
132
+ exports.PrimaryEventId = SchemaOrgUnheadPlugin.PrimaryEventId;
133
+ exports.PrimaryWebPageId = SchemaOrgUnheadPlugin.PrimaryWebPageId;
134
+ exports.PrimaryWebSiteId = SchemaOrgUnheadPlugin.PrimaryWebSiteId;
135
+ exports.ProductId = SchemaOrgUnheadPlugin.ProductId;
136
+ exports.RecipeId = SchemaOrgUnheadPlugin.RecipeId;
137
+ exports.SchemaOrgUnheadPlugin = SchemaOrgUnheadPlugin.SchemaOrgUnheadPlugin;
138
+ exports.addressResolver = SchemaOrgUnheadPlugin.addressResolver;
139
+ exports.aggregateOfferResolver = SchemaOrgUnheadPlugin.aggregateOfferResolver;
140
+ exports.aggregateRatingResolver = SchemaOrgUnheadPlugin.aggregateRatingResolver;
141
+ exports.articleResolver = SchemaOrgUnheadPlugin.articleResolver;
142
+ exports.bookEditionResolver = SchemaOrgUnheadPlugin.bookEditionResolver;
143
+ exports.bookResolver = SchemaOrgUnheadPlugin.bookResolver;
144
+ exports.breadcrumbResolver = SchemaOrgUnheadPlugin.breadcrumbResolver;
145
+ exports.commentResolver = SchemaOrgUnheadPlugin.commentResolver;
146
+ exports.courseResolver = SchemaOrgUnheadPlugin.courseResolver;
147
+ exports.createSchemaOrgGraph = SchemaOrgUnheadPlugin.createSchemaOrgGraph;
148
+ exports.dedupeNodes = SchemaOrgUnheadPlugin.dedupeNodes;
149
+ exports.defineSchemaOrgResolver = SchemaOrgUnheadPlugin.defineSchemaOrgResolver;
150
+ exports.eventResolver = SchemaOrgUnheadPlugin.eventResolver;
151
+ exports.howToResolver = SchemaOrgUnheadPlugin.howToResolver;
152
+ exports.howToStepDirectionResolver = SchemaOrgUnheadPlugin.howToStepDirectionResolver;
153
+ exports.howToStepResolver = SchemaOrgUnheadPlugin.howToStepResolver;
154
+ exports.imageResolver = SchemaOrgUnheadPlugin.imageResolver;
155
+ exports.itemListResolver = SchemaOrgUnheadPlugin.itemListResolver;
156
+ exports.jobPostingResolver = SchemaOrgUnheadPlugin.jobPostingResolver;
157
+ exports.listItemResolver = SchemaOrgUnheadPlugin.listItemResolver;
158
+ exports.localBusinessResolver = SchemaOrgUnheadPlugin.localBusinessResolver;
159
+ exports.movieResolver = SchemaOrgUnheadPlugin.movieResolver;
160
+ exports.normaliseNodes = SchemaOrgUnheadPlugin.normaliseNodes;
161
+ exports.offerResolver = SchemaOrgUnheadPlugin.offerResolver;
162
+ exports.openingHoursResolver = SchemaOrgUnheadPlugin.openingHoursResolver;
163
+ exports.organizationResolver = SchemaOrgUnheadPlugin.organizationResolver;
164
+ exports.personResolver = SchemaOrgUnheadPlugin.personResolver;
165
+ exports.placeResolver = SchemaOrgUnheadPlugin.placeResolver;
166
+ exports.productResolver = SchemaOrgUnheadPlugin.productResolver;
167
+ exports.questionResolver = SchemaOrgUnheadPlugin.questionResolver;
168
+ exports.ratingResolver = SchemaOrgUnheadPlugin.ratingResolver;
169
+ exports.readActionResolver = SchemaOrgUnheadPlugin.readActionResolver;
170
+ exports.recipeResolver = SchemaOrgUnheadPlugin.recipeResolver;
171
+ exports.resolveMeta = SchemaOrgUnheadPlugin.resolveMeta;
172
+ exports.resolveNode = SchemaOrgUnheadPlugin.resolveNode;
173
+ exports.resolveNodeId = SchemaOrgUnheadPlugin.resolveNodeId;
174
+ exports.resolveRelation = SchemaOrgUnheadPlugin.resolveRelation;
175
+ exports.reviewResolver = SchemaOrgUnheadPlugin.reviewResolver;
176
+ exports.searchActionResolver = SchemaOrgUnheadPlugin.searchActionResolver;
177
+ exports.softwareAppResolver = SchemaOrgUnheadPlugin.softwareAppResolver;
178
+ exports.videoResolver = SchemaOrgUnheadPlugin.videoResolver;
179
+ exports.virtualLocationResolver = SchemaOrgUnheadPlugin.virtualLocationResolver;
180
+ exports.webPageResolver = SchemaOrgUnheadPlugin.webPageResolver;
181
+ exports.webSiteResolver = SchemaOrgUnheadPlugin.webSiteResolver;
1928
182
  exports.defineAddress = defineAddress;
1929
183
  exports.defineAggregateOffer = defineAggregateOffer;
1930
184
  exports.defineAggregateRating = defineAggregateRating;
@@ -1953,42 +207,10 @@ exports.defineQuestion = defineQuestion;
1953
207
  exports.defineReadAction = defineReadAction;
1954
208
  exports.defineRecipe = defineRecipe;
1955
209
  exports.defineReview = defineReview;
1956
- exports.defineSchemaOrgResolver = defineSchemaOrgResolver;
1957
210
  exports.defineSearchAction = defineSearchAction;
1958
211
  exports.defineSoftwareApp = defineSoftwareApp;
1959
212
  exports.defineVideo = defineVideo;
1960
213
  exports.defineVirtualLocation = defineVirtualLocation;
1961
214
  exports.defineWebPage = defineWebPage;
1962
215
  exports.defineWebSite = defineWebSite;
1963
- exports.eventResolver = eventResolver;
1964
- exports.howToResolver = howToResolver;
1965
- exports.howToStepDirectionResolver = howToStepDirectionResolver;
1966
- exports.howToStepResolver = howToStepResolver;
1967
- exports.imageResolver = imageResolver;
1968
- exports.itemListResolver = itemListResolver;
1969
- exports.jobPostingResolver = jobPostingResolver;
1970
- exports.listItemResolver = listItemResolver;
1971
- exports.localBusinessResolver = localBusinessResolver;
1972
- exports.movieResolver = movieResolver;
1973
- exports.offerResolver = offerResolver;
1974
- exports.openingHoursResolver = openingHoursResolver;
1975
- exports.organizationResolver = organizationResolver;
1976
- exports.personResolver = personResolver;
1977
- exports.placeResolver = placeResolver;
1978
- exports.productResolver = productResolver;
1979
- exports.questionResolver = questionResolver;
1980
- exports.ratingResolver = ratingResolver;
1981
- exports.readActionResolver = readActionResolver;
1982
- exports.recipeResolver = recipeResolver;
1983
- exports.resolveMeta = resolveMeta;
1984
- exports.resolveNode = resolveNode;
1985
- exports.resolveNodeId = resolveNodeId;
1986
- exports.resolveRelation = resolveRelation;
1987
- exports.reviewResolver = reviewResolver;
1988
- exports.searchActionResolver = searchActionResolver;
1989
- exports.softwareAppResolver = softwareAppResolver;
1990
216
  exports.useSchemaOrg = useSchemaOrg;
1991
- exports.videoResolver = videoResolver;
1992
- exports.virtualLocationResolver = virtualLocationResolver;
1993
- exports.webPageResolver = webPageResolver;
1994
- exports.webSiteResolver = webSiteResolver;