@unhead/schema-org 1.10.4 → 1.11.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const plugin = require('./shared/schema-org.b49caaf3.cjs');
3
+ const plugin = require('./shared/schema-org.99ac1ebf.cjs');
4
4
  const unhead = require('unhead');
5
5
  require('ufo');
6
6
 
package/dist/index.d.cts CHANGED
@@ -1,17 +1,10 @@
1
- import { T as Thing, S as SchemaOrgNodeDefinition, a as SchemaOrgNode, M as MetaInput, R as ResolvedMeta, b as SchemaOrgGraph, A as Arrayable, P as PostalAddress, c as AggregateOffer, d as AggregateRating, e as Article, B as BreadcrumbList, C as Comment, E as Event, F as FoodEstablishment, V as VirtualLocation, f as Place, H as HowTo, g as HowToStep, I as ImageObject, J as JobPosting, L as LocalBusiness, O as Offer, h as OpeningHoursSpecification, i as Organization, j as Person, k as Product, Q as Question, l as Recipe, m as Review, n as VideoObject, W as WebPage, o as WebSite, p as Book, q as Course, r as ItemList, s as ListItem, t as Movie, u as SearchAction, v as ReadAction, w as SoftwareApp, x as BookEdition } from './shared/schema-org.397d7cf9.cjs';
2
- export { z as AggregateOfferSimple, G as AggregateRatingSimple, N as ArticleSimple, Z as BookEditionSimple, Y as BookSimple, a1 as BreadcrumbSimple, a4 as CommentSimple, a6 as CourseSimple, a8 as EventSimple, af as FoodEstablishmentSimple, am as HowToDirection, ai as HowToId, ah as HowToSimple, ak as HowToStepSimple, bm as Id, bl as IdReference, bg as Identity, aq as ImageSimple, ao as ItemListSimple, as as JobPostingSimple, au as ListItemSimple, aw as LocalBusinessSimple, ay as MovieSimple, be as NodeRelation, bf as NodeRelations, aT as NutritionInformation, aA as OfferSimple, aC as OpeningHoursSimple, bi as OptionalSchemaOrgPrefix, aE as OrganizationSimple, aG as PersonSimple, ad as PlaceSimple, bc as PluginSchemaOrg, ba as PluginSchemaOrgOptions, aI as PostalAddressSimple, U as PrimaryArticleId, $ as PrimaryBookId, a2 as PrimaryBreadcrumbId, a9 as PrimaryEventId, b1 as PrimaryWebPageId, b6 as PrimaryWebSiteId, aL as ProductId, aK as ProductSimple, aN as QuestionSimple, aQ as Rating, aP as RatingSimple, b3 as ReadActionInput, aU as RecipeId, aS as RecipeSimple, bh as ResolvableDate, aY as ReviewSimple, bd as SchemaOrgUnheadPlugin, b8 as SearchActionInput, aW as SoftwareAppSimple, bb as UnheadSchemaOrg, bj as UserConfig, a_ as VideoSimple, ab as VirtualLocationSimple, b0 as WebPageSimple, b5 as WebSiteSimple, bk as WithResolver, aJ as addressResolver, D as aggregateOfferResolver, K as aggregateRatingResolver, X as articleResolver, _ as bookEditionResolver, a0 as bookResolver, a3 as breadcrumbResolver, a5 as commentResolver, a7 as courseResolver, y as createSchemaOrgGraph, aa as eventResolver, ag as foodEstablishmentResolver, aj as howToResolver, an as howToStepDirectionResolver, al as howToStepResolver, ar as imageResolver, ap as itemListResolver, at as jobPostingResolver, av as listItemResolver, ax as localBusinessResolver, az as movieResolver, aB as offerResolver, aD as openingHoursResolver, aF as organizationResolver, aH as personResolver, ae as placeResolver, aM as productResolver, aO as questionResolver, aR as ratingResolver, b4 as readActionResolver, aV as recipeResolver, aZ as reviewResolver, b9 as searchActionResolver, aX as softwareAppResolver, a$ as videoResolver, ac as virtualLocationResolver, b2 as webPageResolver, b7 as webSiteResolver } from './shared/schema-org.397d7cf9.cjs';
1
+ import { T as Thing, S as SchemaOrgNodeDefinition, M as MetaInput, R as ResolvedMeta, a as SchemaOrgGraph, A as Arrayable, b as SchemaOrgNode, P as PostalAddress, c as AggregateOffer, d as AggregateRating, e as Article, B as BreadcrumbList, C as Comment, E as Event, F as FoodEstablishment, V as VirtualLocation, f as Place, H as HowTo, g as HowToStep, I as ImageObject, J as JobPosting, L as LocalBusiness, O as Offer, h as OpeningHoursSpecification, i as Organization, j as Person, k as Product, Q as Question, l as Recipe, m as Review, n as VideoObject, W as WebPage, o as WebSite, p as Book, q as Course, r as ItemList, s as ListItem, t as Movie, u as SearchAction, v as ReadAction, w as SoftwareApp, x as BookEdition } from './shared/schema-org.d2b719c3.cjs';
2
+ export { z as AggregateOfferSimple, G as AggregateRatingSimple, N as ArticleSimple, Z as BookEditionSimple, Y as BookSimple, a1 as BreadcrumbSimple, a4 as CommentSimple, a6 as CourseSimple, a8 as EventSimple, af as FoodEstablishmentSimple, am as HowToDirection, ai as HowToId, ah as HowToSimple, ak as HowToStepSimple, bm as Id, bl as IdReference, bg as Identity, ao as ImageSimple, aq as ItemListSimple, as as JobPostingSimple, au as ListItemSimple, aw as LocalBusinessSimple, ay as MovieSimple, be as NodeRelation, bf as NodeRelations, aT as NutritionInformation, aA as OfferSimple, aC as OpeningHoursSimple, bi as OptionalSchemaOrgPrefix, aE as OrganizationSimple, aG as PersonSimple, ab as PlaceSimple, bc as PluginSchemaOrg, ba as PluginSchemaOrgOptions, aI as PostalAddressSimple, U as PrimaryArticleId, $ as PrimaryBookId, a2 as PrimaryBreadcrumbId, a9 as PrimaryEventId, b1 as PrimaryWebPageId, b6 as PrimaryWebSiteId, aL as ProductId, aK as ProductSimple, aN as QuestionSimple, aQ as Rating, aP as RatingSimple, b3 as ReadActionInput, aU as RecipeId, aS as RecipeSimple, bh as ResolvableDate, aW as ReviewSimple, bd as SchemaOrgUnheadPlugin, b8 as SearchActionInput, aY as SoftwareAppSimple, bb as UnheadSchemaOrg, bj as UserConfig, a_ as VideoSimple, ad as VirtualLocationSimple, b0 as WebPageSimple, b5 as WebSiteSimple, bk as WithResolver, aJ as addressResolver, D as aggregateOfferResolver, K as aggregateRatingResolver, X as articleResolver, _ as bookEditionResolver, a0 as bookResolver, a3 as breadcrumbResolver, a5 as commentResolver, a7 as courseResolver, y as createSchemaOrgGraph, aa as eventResolver, ag as foodEstablishmentResolver, aj as howToResolver, an as howToStepDirectionResolver, al as howToStepResolver, ap as imageResolver, ar as itemListResolver, at as jobPostingResolver, av as listItemResolver, ax as localBusinessResolver, az as movieResolver, aB as offerResolver, aD as openingHoursResolver, aF as organizationResolver, aH as personResolver, ac as placeResolver, aM as productResolver, aO as questionResolver, aR as ratingResolver, b4 as readActionResolver, aV as recipeResolver, aX as reviewResolver, b9 as searchActionResolver, aZ as softwareAppResolver, a$ as videoResolver, ae as virtualLocationResolver, b2 as webPageResolver, b7 as webSiteResolver } from './shared/schema-org.d2b719c3.cjs';
3
3
  import * as _unhead_schema from '@unhead/schema';
4
4
  import * as unhead from 'unhead';
5
5
 
6
6
  declare function defineSchemaOrgResolver<T extends Thing>(schema: SchemaOrgNodeDefinition<T>): SchemaOrgNodeDefinition<T>;
7
7
 
8
- /**
9
- * Dedupe, flatten and a collection of nodes. Will also sort node keys and remove meta keys.
10
- * @param nodes
11
- */
12
- declare function dedupeNodes(nodes: SchemaOrgNode[]): SchemaOrgNode[];
13
- declare function normaliseNodes(nodes: SchemaOrgNode[]): SchemaOrgNode[];
14
-
15
8
  interface ResolverOptions {
16
9
  /**
17
10
  * Return single images as an object.
@@ -30,9 +23,16 @@ interface ResolverOptions {
30
23
 
31
24
  declare function resolveMeta(meta: Partial<MetaInput>): ResolvedMeta;
32
25
  declare function resolveNode<T extends Thing>(node: T, ctx: SchemaOrgGraph, resolver: SchemaOrgNodeDefinition<T>): T;
33
- declare function resolveNodeId<T extends Thing>(node: T, ctx: SchemaOrgGraph, resolver: SchemaOrgNodeDefinition<T>, resolveAsRoot?: boolean): T;
26
+ declare function resolveNodeId<T extends Thing>(node: T, ctx: SchemaOrgGraph, resolver?: SchemaOrgNodeDefinition<T>, resolveAsRoot?: boolean): T;
34
27
  declare function resolveRelation(input: Arrayable<any>, ctx: SchemaOrgGraph, fallbackResolver?: SchemaOrgNodeDefinition<any>, options?: ResolverOptions): any;
35
28
 
29
+ /**
30
+ * Dedupe, flatten and a collection of nodes. Will also sort node keys and remove meta keys.
31
+ * @param nodes
32
+ */
33
+ declare function dedupeNodes(nodes: SchemaOrgNode[]): SchemaOrgNode[];
34
+ declare function normaliseNodes(nodes: SchemaOrgNode[]): SchemaOrgNode[];
35
+
36
36
  declare function defineAddress<T extends Record<string, any>>(input?: PostalAddress & T): PostalAddress & T;
37
37
  declare function defineAggregateOffer<T extends Record<string, any>>(input?: AggregateOffer & T): AggregateOffer & T;
38
38
  declare function defineAggregateRating<T extends Record<string, any>>(input?: AggregateRating & T): AggregateRating & T;
package/dist/index.d.mts CHANGED
@@ -1,17 +1,10 @@
1
- import { T as Thing, S as SchemaOrgNodeDefinition, a as SchemaOrgNode, M as MetaInput, R as ResolvedMeta, b as SchemaOrgGraph, A as Arrayable, P as PostalAddress, c as AggregateOffer, d as AggregateRating, e as Article, B as BreadcrumbList, C as Comment, E as Event, F as FoodEstablishment, V as VirtualLocation, f as Place, H as HowTo, g as HowToStep, I as ImageObject, J as JobPosting, L as LocalBusiness, O as Offer, h as OpeningHoursSpecification, i as Organization, j as Person, k as Product, Q as Question, l as Recipe, m as Review, n as VideoObject, W as WebPage, o as WebSite, p as Book, q as Course, r as ItemList, s as ListItem, t as Movie, u as SearchAction, v as ReadAction, w as SoftwareApp, x as BookEdition } from './shared/schema-org.397d7cf9.mjs';
2
- export { z as AggregateOfferSimple, G as AggregateRatingSimple, N as ArticleSimple, Z as BookEditionSimple, Y as BookSimple, a1 as BreadcrumbSimple, a4 as CommentSimple, a6 as CourseSimple, a8 as EventSimple, af as FoodEstablishmentSimple, am as HowToDirection, ai as HowToId, ah as HowToSimple, ak as HowToStepSimple, bm as Id, bl as IdReference, bg as Identity, aq as ImageSimple, ao as ItemListSimple, as as JobPostingSimple, au as ListItemSimple, aw as LocalBusinessSimple, ay as MovieSimple, be as NodeRelation, bf as NodeRelations, aT as NutritionInformation, aA as OfferSimple, aC as OpeningHoursSimple, bi as OptionalSchemaOrgPrefix, aE as OrganizationSimple, aG as PersonSimple, ad as PlaceSimple, bc as PluginSchemaOrg, ba as PluginSchemaOrgOptions, aI as PostalAddressSimple, U as PrimaryArticleId, $ as PrimaryBookId, a2 as PrimaryBreadcrumbId, a9 as PrimaryEventId, b1 as PrimaryWebPageId, b6 as PrimaryWebSiteId, aL as ProductId, aK as ProductSimple, aN as QuestionSimple, aQ as Rating, aP as RatingSimple, b3 as ReadActionInput, aU as RecipeId, aS as RecipeSimple, bh as ResolvableDate, aY as ReviewSimple, bd as SchemaOrgUnheadPlugin, b8 as SearchActionInput, aW as SoftwareAppSimple, bb as UnheadSchemaOrg, bj as UserConfig, a_ as VideoSimple, ab as VirtualLocationSimple, b0 as WebPageSimple, b5 as WebSiteSimple, bk as WithResolver, aJ as addressResolver, D as aggregateOfferResolver, K as aggregateRatingResolver, X as articleResolver, _ as bookEditionResolver, a0 as bookResolver, a3 as breadcrumbResolver, a5 as commentResolver, a7 as courseResolver, y as createSchemaOrgGraph, aa as eventResolver, ag as foodEstablishmentResolver, aj as howToResolver, an as howToStepDirectionResolver, al as howToStepResolver, ar as imageResolver, ap as itemListResolver, at as jobPostingResolver, av as listItemResolver, ax as localBusinessResolver, az as movieResolver, aB as offerResolver, aD as openingHoursResolver, aF as organizationResolver, aH as personResolver, ae as placeResolver, aM as productResolver, aO as questionResolver, aR as ratingResolver, b4 as readActionResolver, aV as recipeResolver, aZ as reviewResolver, b9 as searchActionResolver, aX as softwareAppResolver, a$ as videoResolver, ac as virtualLocationResolver, b2 as webPageResolver, b7 as webSiteResolver } from './shared/schema-org.397d7cf9.mjs';
1
+ import { T as Thing, S as SchemaOrgNodeDefinition, M as MetaInput, R as ResolvedMeta, a as SchemaOrgGraph, A as Arrayable, b as SchemaOrgNode, P as PostalAddress, c as AggregateOffer, d as AggregateRating, e as Article, B as BreadcrumbList, C as Comment, E as Event, F as FoodEstablishment, V as VirtualLocation, f as Place, H as HowTo, g as HowToStep, I as ImageObject, J as JobPosting, L as LocalBusiness, O as Offer, h as OpeningHoursSpecification, i as Organization, j as Person, k as Product, Q as Question, l as Recipe, m as Review, n as VideoObject, W as WebPage, o as WebSite, p as Book, q as Course, r as ItemList, s as ListItem, t as Movie, u as SearchAction, v as ReadAction, w as SoftwareApp, x as BookEdition } from './shared/schema-org.d2b719c3.mjs';
2
+ export { z as AggregateOfferSimple, G as AggregateRatingSimple, N as ArticleSimple, Z as BookEditionSimple, Y as BookSimple, a1 as BreadcrumbSimple, a4 as CommentSimple, a6 as CourseSimple, a8 as EventSimple, af as FoodEstablishmentSimple, am as HowToDirection, ai as HowToId, ah as HowToSimple, ak as HowToStepSimple, bm as Id, bl as IdReference, bg as Identity, ao as ImageSimple, aq as ItemListSimple, as as JobPostingSimple, au as ListItemSimple, aw as LocalBusinessSimple, ay as MovieSimple, be as NodeRelation, bf as NodeRelations, aT as NutritionInformation, aA as OfferSimple, aC as OpeningHoursSimple, bi as OptionalSchemaOrgPrefix, aE as OrganizationSimple, aG as PersonSimple, ab as PlaceSimple, bc as PluginSchemaOrg, ba as PluginSchemaOrgOptions, aI as PostalAddressSimple, U as PrimaryArticleId, $ as PrimaryBookId, a2 as PrimaryBreadcrumbId, a9 as PrimaryEventId, b1 as PrimaryWebPageId, b6 as PrimaryWebSiteId, aL as ProductId, aK as ProductSimple, aN as QuestionSimple, aQ as Rating, aP as RatingSimple, b3 as ReadActionInput, aU as RecipeId, aS as RecipeSimple, bh as ResolvableDate, aW as ReviewSimple, bd as SchemaOrgUnheadPlugin, b8 as SearchActionInput, aY as SoftwareAppSimple, bb as UnheadSchemaOrg, bj as UserConfig, a_ as VideoSimple, ad as VirtualLocationSimple, b0 as WebPageSimple, b5 as WebSiteSimple, bk as WithResolver, aJ as addressResolver, D as aggregateOfferResolver, K as aggregateRatingResolver, X as articleResolver, _ as bookEditionResolver, a0 as bookResolver, a3 as breadcrumbResolver, a5 as commentResolver, a7 as courseResolver, y as createSchemaOrgGraph, aa as eventResolver, ag as foodEstablishmentResolver, aj as howToResolver, an as howToStepDirectionResolver, al as howToStepResolver, ap as imageResolver, ar as itemListResolver, at as jobPostingResolver, av as listItemResolver, ax as localBusinessResolver, az as movieResolver, aB as offerResolver, aD as openingHoursResolver, aF as organizationResolver, aH as personResolver, ac as placeResolver, aM as productResolver, aO as questionResolver, aR as ratingResolver, b4 as readActionResolver, aV as recipeResolver, aX as reviewResolver, b9 as searchActionResolver, aZ as softwareAppResolver, a$ as videoResolver, ae as virtualLocationResolver, b2 as webPageResolver, b7 as webSiteResolver } from './shared/schema-org.d2b719c3.mjs';
3
3
  import * as _unhead_schema from '@unhead/schema';
4
4
  import * as unhead from 'unhead';
5
5
 
6
6
  declare function defineSchemaOrgResolver<T extends Thing>(schema: SchemaOrgNodeDefinition<T>): SchemaOrgNodeDefinition<T>;
7
7
 
8
- /**
9
- * Dedupe, flatten and a collection of nodes. Will also sort node keys and remove meta keys.
10
- * @param nodes
11
- */
12
- declare function dedupeNodes(nodes: SchemaOrgNode[]): SchemaOrgNode[];
13
- declare function normaliseNodes(nodes: SchemaOrgNode[]): SchemaOrgNode[];
14
-
15
8
  interface ResolverOptions {
16
9
  /**
17
10
  * Return single images as an object.
@@ -30,9 +23,16 @@ interface ResolverOptions {
30
23
 
31
24
  declare function resolveMeta(meta: Partial<MetaInput>): ResolvedMeta;
32
25
  declare function resolveNode<T extends Thing>(node: T, ctx: SchemaOrgGraph, resolver: SchemaOrgNodeDefinition<T>): T;
33
- declare function resolveNodeId<T extends Thing>(node: T, ctx: SchemaOrgGraph, resolver: SchemaOrgNodeDefinition<T>, resolveAsRoot?: boolean): T;
26
+ declare function resolveNodeId<T extends Thing>(node: T, ctx: SchemaOrgGraph, resolver?: SchemaOrgNodeDefinition<T>, resolveAsRoot?: boolean): T;
34
27
  declare function resolveRelation(input: Arrayable<any>, ctx: SchemaOrgGraph, fallbackResolver?: SchemaOrgNodeDefinition<any>, options?: ResolverOptions): any;
35
28
 
29
+ /**
30
+ * Dedupe, flatten and a collection of nodes. Will also sort node keys and remove meta keys.
31
+ * @param nodes
32
+ */
33
+ declare function dedupeNodes(nodes: SchemaOrgNode[]): SchemaOrgNode[];
34
+ declare function normaliseNodes(nodes: SchemaOrgNode[]): SchemaOrgNode[];
35
+
36
36
  declare function defineAddress<T extends Record<string, any>>(input?: PostalAddress & T): PostalAddress & T;
37
37
  declare function defineAggregateOffer<T extends Record<string, any>>(input?: AggregateOffer & T): AggregateOffer & T;
38
38
  declare function defineAggregateRating<T extends Record<string, any>>(input?: AggregateRating & T): AggregateRating & T;
package/dist/index.d.ts CHANGED
@@ -1,17 +1,10 @@
1
- import { T as Thing, S as SchemaOrgNodeDefinition, a as SchemaOrgNode, M as MetaInput, R as ResolvedMeta, b as SchemaOrgGraph, A as Arrayable, P as PostalAddress, c as AggregateOffer, d as AggregateRating, e as Article, B as BreadcrumbList, C as Comment, E as Event, F as FoodEstablishment, V as VirtualLocation, f as Place, H as HowTo, g as HowToStep, I as ImageObject, J as JobPosting, L as LocalBusiness, O as Offer, h as OpeningHoursSpecification, i as Organization, j as Person, k as Product, Q as Question, l as Recipe, m as Review, n as VideoObject, W as WebPage, o as WebSite, p as Book, q as Course, r as ItemList, s as ListItem, t as Movie, u as SearchAction, v as ReadAction, w as SoftwareApp, x as BookEdition } from './shared/schema-org.397d7cf9.js';
2
- export { z as AggregateOfferSimple, G as AggregateRatingSimple, N as ArticleSimple, Z as BookEditionSimple, Y as BookSimple, a1 as BreadcrumbSimple, a4 as CommentSimple, a6 as CourseSimple, a8 as EventSimple, af as FoodEstablishmentSimple, am as HowToDirection, ai as HowToId, ah as HowToSimple, ak as HowToStepSimple, bm as Id, bl as IdReference, bg as Identity, aq as ImageSimple, ao as ItemListSimple, as as JobPostingSimple, au as ListItemSimple, aw as LocalBusinessSimple, ay as MovieSimple, be as NodeRelation, bf as NodeRelations, aT as NutritionInformation, aA as OfferSimple, aC as OpeningHoursSimple, bi as OptionalSchemaOrgPrefix, aE as OrganizationSimple, aG as PersonSimple, ad as PlaceSimple, bc as PluginSchemaOrg, ba as PluginSchemaOrgOptions, aI as PostalAddressSimple, U as PrimaryArticleId, $ as PrimaryBookId, a2 as PrimaryBreadcrumbId, a9 as PrimaryEventId, b1 as PrimaryWebPageId, b6 as PrimaryWebSiteId, aL as ProductId, aK as ProductSimple, aN as QuestionSimple, aQ as Rating, aP as RatingSimple, b3 as ReadActionInput, aU as RecipeId, aS as RecipeSimple, bh as ResolvableDate, aY as ReviewSimple, bd as SchemaOrgUnheadPlugin, b8 as SearchActionInput, aW as SoftwareAppSimple, bb as UnheadSchemaOrg, bj as UserConfig, a_ as VideoSimple, ab as VirtualLocationSimple, b0 as WebPageSimple, b5 as WebSiteSimple, bk as WithResolver, aJ as addressResolver, D as aggregateOfferResolver, K as aggregateRatingResolver, X as articleResolver, _ as bookEditionResolver, a0 as bookResolver, a3 as breadcrumbResolver, a5 as commentResolver, a7 as courseResolver, y as createSchemaOrgGraph, aa as eventResolver, ag as foodEstablishmentResolver, aj as howToResolver, an as howToStepDirectionResolver, al as howToStepResolver, ar as imageResolver, ap as itemListResolver, at as jobPostingResolver, av as listItemResolver, ax as localBusinessResolver, az as movieResolver, aB as offerResolver, aD as openingHoursResolver, aF as organizationResolver, aH as personResolver, ae as placeResolver, aM as productResolver, aO as questionResolver, aR as ratingResolver, b4 as readActionResolver, aV as recipeResolver, aZ as reviewResolver, b9 as searchActionResolver, aX as softwareAppResolver, a$ as videoResolver, ac as virtualLocationResolver, b2 as webPageResolver, b7 as webSiteResolver } from './shared/schema-org.397d7cf9.js';
1
+ import { T as Thing, S as SchemaOrgNodeDefinition, M as MetaInput, R as ResolvedMeta, a as SchemaOrgGraph, A as Arrayable, b as SchemaOrgNode, P as PostalAddress, c as AggregateOffer, d as AggregateRating, e as Article, B as BreadcrumbList, C as Comment, E as Event, F as FoodEstablishment, V as VirtualLocation, f as Place, H as HowTo, g as HowToStep, I as ImageObject, J as JobPosting, L as LocalBusiness, O as Offer, h as OpeningHoursSpecification, i as Organization, j as Person, k as Product, Q as Question, l as Recipe, m as Review, n as VideoObject, W as WebPage, o as WebSite, p as Book, q as Course, r as ItemList, s as ListItem, t as Movie, u as SearchAction, v as ReadAction, w as SoftwareApp, x as BookEdition } from './shared/schema-org.d2b719c3.js';
2
+ export { z as AggregateOfferSimple, G as AggregateRatingSimple, N as ArticleSimple, Z as BookEditionSimple, Y as BookSimple, a1 as BreadcrumbSimple, a4 as CommentSimple, a6 as CourseSimple, a8 as EventSimple, af as FoodEstablishmentSimple, am as HowToDirection, ai as HowToId, ah as HowToSimple, ak as HowToStepSimple, bm as Id, bl as IdReference, bg as Identity, ao as ImageSimple, aq as ItemListSimple, as as JobPostingSimple, au as ListItemSimple, aw as LocalBusinessSimple, ay as MovieSimple, be as NodeRelation, bf as NodeRelations, aT as NutritionInformation, aA as OfferSimple, aC as OpeningHoursSimple, bi as OptionalSchemaOrgPrefix, aE as OrganizationSimple, aG as PersonSimple, ab as PlaceSimple, bc as PluginSchemaOrg, ba as PluginSchemaOrgOptions, aI as PostalAddressSimple, U as PrimaryArticleId, $ as PrimaryBookId, a2 as PrimaryBreadcrumbId, a9 as PrimaryEventId, b1 as PrimaryWebPageId, b6 as PrimaryWebSiteId, aL as ProductId, aK as ProductSimple, aN as QuestionSimple, aQ as Rating, aP as RatingSimple, b3 as ReadActionInput, aU as RecipeId, aS as RecipeSimple, bh as ResolvableDate, aW as ReviewSimple, bd as SchemaOrgUnheadPlugin, b8 as SearchActionInput, aY as SoftwareAppSimple, bb as UnheadSchemaOrg, bj as UserConfig, a_ as VideoSimple, ad as VirtualLocationSimple, b0 as WebPageSimple, b5 as WebSiteSimple, bk as WithResolver, aJ as addressResolver, D as aggregateOfferResolver, K as aggregateRatingResolver, X as articleResolver, _ as bookEditionResolver, a0 as bookResolver, a3 as breadcrumbResolver, a5 as commentResolver, a7 as courseResolver, y as createSchemaOrgGraph, aa as eventResolver, ag as foodEstablishmentResolver, aj as howToResolver, an as howToStepDirectionResolver, al as howToStepResolver, ap as imageResolver, ar as itemListResolver, at as jobPostingResolver, av as listItemResolver, ax as localBusinessResolver, az as movieResolver, aB as offerResolver, aD as openingHoursResolver, aF as organizationResolver, aH as personResolver, ac as placeResolver, aM as productResolver, aO as questionResolver, aR as ratingResolver, b4 as readActionResolver, aV as recipeResolver, aX as reviewResolver, b9 as searchActionResolver, aZ as softwareAppResolver, a$ as videoResolver, ae as virtualLocationResolver, b2 as webPageResolver, b7 as webSiteResolver } from './shared/schema-org.d2b719c3.js';
3
3
  import * as _unhead_schema from '@unhead/schema';
4
4
  import * as unhead from 'unhead';
5
5
 
6
6
  declare function defineSchemaOrgResolver<T extends Thing>(schema: SchemaOrgNodeDefinition<T>): SchemaOrgNodeDefinition<T>;
7
7
 
8
- /**
9
- * Dedupe, flatten and a collection of nodes. Will also sort node keys and remove meta keys.
10
- * @param nodes
11
- */
12
- declare function dedupeNodes(nodes: SchemaOrgNode[]): SchemaOrgNode[];
13
- declare function normaliseNodes(nodes: SchemaOrgNode[]): SchemaOrgNode[];
14
-
15
8
  interface ResolverOptions {
16
9
  /**
17
10
  * Return single images as an object.
@@ -30,9 +23,16 @@ interface ResolverOptions {
30
23
 
31
24
  declare function resolveMeta(meta: Partial<MetaInput>): ResolvedMeta;
32
25
  declare function resolveNode<T extends Thing>(node: T, ctx: SchemaOrgGraph, resolver: SchemaOrgNodeDefinition<T>): T;
33
- declare function resolveNodeId<T extends Thing>(node: T, ctx: SchemaOrgGraph, resolver: SchemaOrgNodeDefinition<T>, resolveAsRoot?: boolean): T;
26
+ declare function resolveNodeId<T extends Thing>(node: T, ctx: SchemaOrgGraph, resolver?: SchemaOrgNodeDefinition<T>, resolveAsRoot?: boolean): T;
34
27
  declare function resolveRelation(input: Arrayable<any>, ctx: SchemaOrgGraph, fallbackResolver?: SchemaOrgNodeDefinition<any>, options?: ResolverOptions): any;
35
28
 
29
+ /**
30
+ * Dedupe, flatten and a collection of nodes. Will also sort node keys and remove meta keys.
31
+ * @param nodes
32
+ */
33
+ declare function dedupeNodes(nodes: SchemaOrgNode[]): SchemaOrgNode[];
34
+ declare function normaliseNodes(nodes: SchemaOrgNode[]): SchemaOrgNode[];
35
+
36
36
  declare function defineAddress<T extends Record<string, any>>(input?: PostalAddress & T): PostalAddress & T;
37
37
  declare function defineAggregateOffer<T extends Record<string, any>>(input?: AggregateOffer & T): AggregateOffer & T;
38
38
  declare function defineAggregateRating<T extends Record<string, any>>(input?: AggregateRating & T): AggregateRating & T;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { U as UnheadSchemaOrg } from './shared/schema-org.967f487d.mjs';
2
- export { H as HowToId, a1 as PluginSchemaOrg, P as PrimaryArticleId, k as PrimaryBookId, m as PrimaryBreadcrumbId, s as PrimaryEventId, X as PrimaryWebPageId, _ as PrimaryWebSiteId, M as ProductId, R as RecipeId, a2 as SchemaOrgUnheadPlugin, L as addressResolver, g as aggregateOfferResolver, h as aggregateRatingResolver, i as articleResolver, j as bookEditionResolver, l as bookResolver, o as breadcrumbResolver, p as commentResolver, q as courseResolver, c as createSchemaOrgGraph, a as dedupeNodes, d as defineSchemaOrgResolver, t as eventResolver, w as foodEstablishmentResolver, x as howToResolver, z as howToStepDirectionResolver, y as howToStepResolver, B as imageResolver, A as itemListResolver, C as jobPostingResolver, D as listItemResolver, E as localBusinessResolver, F as movieResolver, n as normaliseNodes, G as offerResolver, I as openingHoursResolver, J as organizationResolver, K as personResolver, u as placeResolver, N as productResolver, O as questionResolver, Q as ratingResolver, Z as readActionResolver, S as recipeResolver, r as resolveMeta, b as resolveNode, e as resolveNodeId, f as resolveRelation, V as reviewResolver, a0 as searchActionResolver, T as softwareAppResolver, W as videoResolver, v as virtualLocationResolver, Y as webPageResolver, $ as webSiteResolver } from './shared/schema-org.967f487d.mjs';
1
+ import { U as UnheadSchemaOrg } from './shared/schema-org.7698b7cd.mjs';
2
+ export { H as HowToId, a1 as PluginSchemaOrg, P as PrimaryArticleId, k as PrimaryBookId, m as PrimaryBreadcrumbId, s as PrimaryEventId, X as PrimaryWebPageId, _ as PrimaryWebSiteId, M as ProductId, R as RecipeId, a2 as SchemaOrgUnheadPlugin, L as addressResolver, g as aggregateOfferResolver, h as aggregateRatingResolver, i as articleResolver, j as bookEditionResolver, l as bookResolver, o as breadcrumbResolver, p as commentResolver, q as courseResolver, c as createSchemaOrgGraph, f as dedupeNodes, d as defineSchemaOrgResolver, t as eventResolver, w as foodEstablishmentResolver, x as howToResolver, z as howToStepDirectionResolver, y as howToStepResolver, A as imageResolver, B as itemListResolver, C as jobPostingResolver, D as listItemResolver, E as localBusinessResolver, F as movieResolver, n as normaliseNodes, G as offerResolver, I as openingHoursResolver, J as organizationResolver, K as personResolver, u as placeResolver, N as productResolver, O as questionResolver, Q as ratingResolver, Z as readActionResolver, S as recipeResolver, r as resolveMeta, a as resolveNode, b as resolveNodeId, e as resolveRelation, T as reviewResolver, a0 as searchActionResolver, V as softwareAppResolver, W as videoResolver, v as virtualLocationResolver, Y as webPageResolver, $ as webSiteResolver } from './shared/schema-org.7698b7cd.mjs';
3
3
  import { getActiveHead, useHead } from 'unhead';
4
4
  import 'ufo';
5
5
 
@@ -56,7 +56,7 @@ function dedupeMerge(node, field, value) {
56
56
  function prefixId(url, id) {
57
57
  if (hasProtocol(id))
58
58
  return id;
59
- if (id[0] !== "#")
59
+ if (!id.includes("#"))
60
60
  id = `#${id}`;
61
61
  return withBase(id, url);
62
62
  }
@@ -226,59 +226,6 @@ const aggregateRatingResolver = defineSchemaOrgResolver({
226
226
  }
227
227
  });
228
228
 
229
- const searchActionResolver = defineSchemaOrgResolver({
230
- defaults: {
231
- "@type": "SearchAction",
232
- "target": {
233
- "@type": "EntryPoint"
234
- },
235
- "query-input": {
236
- "@type": "PropertyValueSpecification",
237
- "valueRequired": true,
238
- "valueName": "search_term_string"
239
- }
240
- },
241
- resolve(node, ctx) {
242
- if (typeof node.target === "string") {
243
- node.target = {
244
- "@type": "EntryPoint",
245
- "urlTemplate": resolveWithBase(ctx.meta.host, node.target)
246
- };
247
- }
248
- return node;
249
- }
250
- });
251
-
252
- const PrimaryWebSiteId = "#website";
253
- const webSiteResolver = defineSchemaOrgResolver({
254
- defaults: {
255
- "@type": "WebSite"
256
- },
257
- inheritMeta: [
258
- "inLanguage",
259
- { meta: "host", key: "url" }
260
- ],
261
- idPrefix: ["host", PrimaryWebSiteId],
262
- resolve(node, ctx) {
263
- node.potentialAction = resolveRelation(node.potentialAction, ctx, searchActionResolver, {
264
- array: true
265
- });
266
- node.publisher = resolveRelation(node.publisher, ctx);
267
- return node;
268
- },
269
- resolveRootNode(node, { find }) {
270
- if (resolveAsGraphKey(node["@id"]) === PrimaryWebSiteId) {
271
- const identity = find(IdentityId);
272
- if (identity)
273
- setIfEmpty(node, "publisher", idReference(identity));
274
- const webPage = find(PrimaryWebPageId);
275
- if (webPage)
276
- setIfEmpty(webPage, "isPartOf", idReference(node));
277
- }
278
- return node;
279
- }
280
- });
281
-
282
229
  const listItemResolver = defineSchemaOrgResolver({
283
230
  cast(node) {
284
231
  if (typeof node === "string") {
@@ -360,6 +307,59 @@ const addressResolver = defineSchemaOrgResolver({
360
307
  }
361
308
  });
362
309
 
310
+ const searchActionResolver = defineSchemaOrgResolver({
311
+ defaults: {
312
+ "@type": "SearchAction",
313
+ "target": {
314
+ "@type": "EntryPoint"
315
+ },
316
+ "query-input": {
317
+ "@type": "PropertyValueSpecification",
318
+ "valueRequired": true,
319
+ "valueName": "search_term_string"
320
+ }
321
+ },
322
+ resolve(node, ctx) {
323
+ if (typeof node.target === "string") {
324
+ node.target = {
325
+ "@type": "EntryPoint",
326
+ "urlTemplate": resolveWithBase(ctx.meta.host, node.target)
327
+ };
328
+ }
329
+ return node;
330
+ }
331
+ });
332
+
333
+ const PrimaryWebSiteId = "#website";
334
+ const webSiteResolver = defineSchemaOrgResolver({
335
+ defaults: {
336
+ "@type": "WebSite"
337
+ },
338
+ inheritMeta: [
339
+ "inLanguage",
340
+ { meta: "host", key: "url" }
341
+ ],
342
+ idPrefix: ["host", PrimaryWebSiteId],
343
+ resolve(node, ctx) {
344
+ node.potentialAction = resolveRelation(node.potentialAction, ctx, searchActionResolver, {
345
+ array: true
346
+ });
347
+ node.publisher = resolveRelation(node.publisher, ctx);
348
+ return node;
349
+ },
350
+ resolveRootNode(node, { find }) {
351
+ if (resolveAsGraphKey(node["@id"]) === PrimaryWebSiteId) {
352
+ const identity = find(IdentityId);
353
+ if (identity)
354
+ setIfEmpty(node, "publisher", idReference(identity));
355
+ const webPage = find(PrimaryWebPageId);
356
+ if (webPage)
357
+ setIfEmpty(webPage, "isPartOf", idReference(node));
358
+ }
359
+ return node;
360
+ }
361
+ });
362
+
363
363
  const organizationResolver = defineSchemaOrgResolver({
364
364
  defaults: {
365
365
  "@type": "Organization"
@@ -413,40 +413,6 @@ const organizationResolver = defineSchemaOrgResolver({
413
413
  }
414
414
  });
415
415
 
416
- const personResolver = defineSchemaOrgResolver({
417
- cast(node) {
418
- if (typeof node === "string") {
419
- return {
420
- name: node
421
- };
422
- }
423
- return node;
424
- },
425
- defaults: {
426
- "@type": "Person"
427
- },
428
- idPrefix: ["host", IdentityId],
429
- resolve(node, ctx) {
430
- if (node.url)
431
- node.url = resolveWithBase(ctx.meta.host, node.url);
432
- return node;
433
- },
434
- resolveRootNode(node, { find, meta }) {
435
- if (resolveAsGraphKey(node["@id"]) === IdentityId) {
436
- setIfEmpty(node, "url", meta.host);
437
- const webPage = find(PrimaryWebPageId);
438
- if (webPage)
439
- setIfEmpty(webPage, "about", idReference(node));
440
- const webSite = find(PrimaryWebSiteId);
441
- if (webSite)
442
- setIfEmpty(webSite, "publisher", idReference(node));
443
- }
444
- const article = find(PrimaryArticleId);
445
- if (article)
446
- setIfEmpty(article, "author", idReference(node));
447
- }
448
- });
449
-
450
416
  const readActionResolver = defineSchemaOrgResolver({
451
417
  defaults: {
452
418
  "@type": "ReadAction"
@@ -532,6 +498,40 @@ const webPageResolver = defineSchemaOrgResolver({
532
498
  }
533
499
  });
534
500
 
501
+ const personResolver = defineSchemaOrgResolver({
502
+ cast(node) {
503
+ if (typeof node === "string") {
504
+ return {
505
+ name: node
506
+ };
507
+ }
508
+ return node;
509
+ },
510
+ defaults: {
511
+ "@type": "Person"
512
+ },
513
+ idPrefix: ["host", IdentityId],
514
+ resolve(node, ctx) {
515
+ if (node.url)
516
+ node.url = resolveWithBase(ctx.meta.host, node.url);
517
+ return node;
518
+ },
519
+ resolveRootNode(node, { find, meta }) {
520
+ if (resolveAsGraphKey(node["@id"]) === IdentityId) {
521
+ setIfEmpty(node, "url", meta.host);
522
+ const webPage = find(PrimaryWebPageId);
523
+ if (webPage)
524
+ setIfEmpty(webPage, "about", idReference(node));
525
+ const webSite = find(PrimaryWebSiteId);
526
+ if (webSite)
527
+ setIfEmpty(webSite, "publisher", idReference(node));
528
+ }
529
+ const article = find(PrimaryArticleId);
530
+ if (article)
531
+ setIfEmpty(article, "author", idReference(node));
532
+ }
533
+ });
534
+
535
535
  const PrimaryArticleId = "#article";
536
536
  const articleResolver = defineSchemaOrgResolver({
537
537
  defaults: {
@@ -744,22 +744,6 @@ const eventResolver = defineSchemaOrgResolver({
744
744
  }
745
745
  });
746
746
 
747
- const ratingResolver = defineSchemaOrgResolver({
748
- cast(node) {
749
- if (node === "number") {
750
- return {
751
- ratingValue: node
752
- };
753
- }
754
- return node;
755
- },
756
- defaults: {
757
- "@type": "Rating",
758
- "bestRating": 5,
759
- "worstRating": 1
760
- }
761
- });
762
-
763
747
  const openingHoursResolver = defineSchemaOrgResolver({
764
748
  defaults: {
765
749
  "@type": "OpeningHoursSpecification",
@@ -790,6 +774,22 @@ const localBusinessResolver = defineSchemaOrgResolver({
790
774
  }
791
775
  });
792
776
 
777
+ const ratingResolver = defineSchemaOrgResolver({
778
+ cast(node) {
779
+ if (node === "number") {
780
+ return {
781
+ ratingValue: node
782
+ };
783
+ }
784
+ return node;
785
+ },
786
+ defaults: {
787
+ "@type": "Rating",
788
+ "bestRating": 5,
789
+ "worstRating": 1
790
+ }
791
+ });
792
+
793
793
  const foodEstablishmentResolver = defineSchemaOrgResolver({
794
794
  defaults: {
795
795
  "@type": ["Organization", "LocalBusiness", "FoodEstablishment"]
@@ -1910,13 +1910,13 @@ function resolveNode(node, ctx, resolver) {
1910
1910
  function resolveNodeId(node, ctx, resolver, resolveAsRoot = false) {
1911
1911
  if (node["@id"] && node["@id"].startsWith("http"))
1912
1912
  return node;
1913
- const prefix = (Array.isArray(resolver.idPrefix) ? resolver.idPrefix[0] : resolver.idPrefix) || "url";
1914
- const rootId = node["@id"] || (Array.isArray(resolver.idPrefix) ? resolver.idPrefix?.[1] : void 0);
1913
+ const prefix = resolver ? (Array.isArray(resolver.idPrefix) ? resolver.idPrefix[0] : resolver.idPrefix) || "url" : "url";
1914
+ const rootId = node["@id"] || (resolver ? Array.isArray(resolver.idPrefix) ? resolver.idPrefix?.[1] : void 0 : "");
1915
1915
  if (!node["@id"] && resolveAsRoot && rootId) {
1916
1916
  node["@id"] = prefixId(ctx.meta[prefix], rootId);
1917
1917
  return node;
1918
1918
  }
1919
- if (node["@id"]?.startsWith("#/schema/")) {
1919
+ if (node["@id"]?.startsWith("#/schema/") || node["@id"]?.startsWith("/")) {
1920
1920
  node["@id"] = prefixId(ctx.meta[prefix], node["@id"]);
1921
1921
  return node;
1922
1922
  }
@@ -1944,10 +1944,10 @@ function resolveRelation(input, ctx, fallbackResolver, options = {}) {
1944
1944
  const ids = asArray(input).map((a) => {
1945
1945
  const keys = Object.keys(a).length;
1946
1946
  if (keys === 1 && a["@id"] || keys === 2 && a["@id"] && a["@type"]) {
1947
- return {
1947
+ return resolveNodeId({
1948
1948
  // we drop @type
1949
1949
  "@id": ctx.find(a["@id"])?.["@id"] || a["@id"]
1950
- };
1950
+ }, ctx);
1951
1951
  }
1952
1952
  let resolver = fallbackResolver;
1953
1953
  if (a._resolver) {
@@ -2092,6 +2092,10 @@ function normaliseNodes(nodes) {
2092
2092
  return Object.values(dedupedNodes);
2093
2093
  }
2094
2094
 
2095
+ const baseRelationNodes = [
2096
+ "translationOfWork",
2097
+ "workTranslation"
2098
+ ];
2095
2099
  function createSchemaOrgGraph() {
2096
2100
  const ctx = {
2097
2101
  find(id) {
@@ -2121,6 +2125,9 @@ function createSchemaOrgGraph() {
2121
2125
  root: true
2122
2126
  });
2123
2127
  }
2128
+ baseRelationNodes.forEach((k) => {
2129
+ node[k] = resolveRelation(node[k], ctx);
2130
+ });
2124
2131
  if (node._resolver?.resolveRootNode)
2125
2132
  node._resolver.resolveRootNode(node, ctx);
2126
2133
  delete node._resolver;
@@ -2151,7 +2158,7 @@ function SchemaOrgUnheadPlugin(config, meta, options) {
2151
2158
  graph = createSchemaOrgGraph();
2152
2159
  },
2153
2160
  "tag:normalise": async ({ tag }) => {
2154
- if (tag.key === "schema-org-graph") {
2161
+ if (tag.key === "schema-org-graph" || tag.props.id === "schema-org-graph") {
2155
2162
  const { loadResolver } = await Promise.resolve().then(function () { return resolver; });
2156
2163
  const nodes = await tag.props.nodes;
2157
2164
  for (const node of Array.isArray(nodes) ? nodes : [nodes]) {
@@ -2209,4 +2216,4 @@ function SchemaOrgUnheadPlugin(config, meta, options) {
2209
2216
  }));
2210
2217
  }
2211
2218
 
2212
- export { webSiteResolver as $, itemListResolver as A, imageResolver as B, jobPostingResolver as C, listItemResolver as D, localBusinessResolver as E, movieResolver as F, offerResolver as G, HowToId as H, openingHoursResolver as I, organizationResolver as J, personResolver as K, addressResolver as L, ProductId as M, productResolver as N, questionResolver as O, PrimaryArticleId as P, ratingResolver as Q, RecipeId as R, recipeResolver as S, softwareAppResolver as T, UnheadSchemaOrg as U, reviewResolver as V, videoResolver as W, PrimaryWebPageId as X, webPageResolver as Y, readActionResolver as Z, PrimaryWebSiteId as _, dedupeNodes as a, searchActionResolver as a0, PluginSchemaOrg as a1, SchemaOrgUnheadPlugin as a2, resolveNode as b, createSchemaOrgGraph as c, defineSchemaOrgResolver as d, resolveNodeId as e, resolveRelation as f, aggregateOfferResolver as g, aggregateRatingResolver as h, articleResolver as i, bookEditionResolver as j, PrimaryBookId as k, bookResolver as l, PrimaryBreadcrumbId as m, normaliseNodes as n, breadcrumbResolver as o, commentResolver as p, courseResolver as q, resolveMeta as r, PrimaryEventId as s, eventResolver as t, placeResolver as u, virtualLocationResolver as v, foodEstablishmentResolver as w, howToResolver as x, howToStepResolver as y, howToStepDirectionResolver as z };
2219
+ export { webSiteResolver as $, imageResolver as A, itemListResolver as B, jobPostingResolver as C, listItemResolver as D, localBusinessResolver as E, movieResolver as F, offerResolver as G, HowToId as H, openingHoursResolver as I, organizationResolver as J, personResolver as K, addressResolver as L, ProductId as M, productResolver as N, questionResolver as O, PrimaryArticleId as P, ratingResolver as Q, RecipeId as R, recipeResolver as S, reviewResolver as T, UnheadSchemaOrg as U, softwareAppResolver as V, videoResolver as W, PrimaryWebPageId as X, webPageResolver as Y, readActionResolver as Z, PrimaryWebSiteId as _, resolveNode as a, searchActionResolver as a0, PluginSchemaOrg as a1, SchemaOrgUnheadPlugin as a2, resolveNodeId as b, createSchemaOrgGraph as c, defineSchemaOrgResolver as d, resolveRelation as e, dedupeNodes as f, aggregateOfferResolver as g, aggregateRatingResolver as h, articleResolver as i, bookEditionResolver as j, PrimaryBookId as k, bookResolver as l, PrimaryBreadcrumbId as m, normaliseNodes as n, breadcrumbResolver as o, commentResolver as p, courseResolver as q, resolveMeta as r, PrimaryEventId as s, eventResolver as t, placeResolver as u, virtualLocationResolver as v, foodEstablishmentResolver as w, howToResolver as x, howToStepResolver as y, howToStepDirectionResolver as z };