@krantho/seo 0.0.0-stage → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/LICENSE +21 -0
  2. package/dist/archetypes/define-archetype.d.ts +23 -0
  3. package/dist/archetypes/define-archetype.d.ts.map +1 -0
  4. package/dist/archetypes/define-archetype.js +51 -0
  5. package/dist/archetypes/define-archetype.js.map +1 -0
  6. package/dist/archetypes/index.d.ts +4 -0
  7. package/dist/archetypes/index.d.ts.map +1 -0
  8. package/dist/archetypes/index.js +3 -0
  9. package/dist/archetypes/index.js.map +1 -0
  10. package/dist/archetypes/presets.d.ts +21 -0
  11. package/dist/archetypes/presets.d.ts.map +1 -0
  12. package/dist/archetypes/presets.js +42 -0
  13. package/dist/archetypes/presets.js.map +1 -0
  14. package/dist/archetypes/types.d.ts +20 -0
  15. package/dist/archetypes/types.d.ts.map +1 -0
  16. package/dist/archetypes/types.js +2 -0
  17. package/dist/archetypes/types.js.map +1 -0
  18. package/dist/catalog/auto-mappings.d.ts +39 -0
  19. package/dist/catalog/auto-mappings.d.ts.map +1 -0
  20. package/dist/catalog/auto-mappings.js +64 -0
  21. package/dist/catalog/auto-mappings.js.map +1 -0
  22. package/dist/catalog/index.d.ts +7 -0
  23. package/dist/catalog/index.d.ts.map +1 -0
  24. package/dist/catalog/index.js +4 -0
  25. package/dist/catalog/index.js.map +1 -0
  26. package/dist/catalog/properties.d.ts +9 -0
  27. package/dist/catalog/properties.d.ts.map +1 -0
  28. package/dist/catalog/properties.js +630 -0
  29. package/dist/catalog/properties.js.map +1 -0
  30. package/dist/catalog/property-atoms.d.ts +53 -0
  31. package/dist/catalog/property-atoms.d.ts.map +1 -0
  32. package/dist/catalog/property-atoms.js +170 -0
  33. package/dist/catalog/property-atoms.js.map +1 -0
  34. package/dist/catalog/types.d.ts +53 -0
  35. package/dist/catalog/types.d.ts.map +1 -0
  36. package/dist/catalog/types.js +423 -0
  37. package/dist/catalog/types.js.map +1 -0
  38. package/dist/create-seo.d.ts +70 -0
  39. package/dist/create-seo.d.ts.map +1 -0
  40. package/dist/create-seo.js +137 -0
  41. package/dist/create-seo.js.map +1 -0
  42. package/dist/decorators/breadcrumb.d.ts +12 -0
  43. package/dist/decorators/breadcrumb.d.ts.map +1 -0
  44. package/dist/decorators/breadcrumb.js +36 -0
  45. package/dist/decorators/breadcrumb.js.map +1 -0
  46. package/dist/decorators/index.d.ts +8 -0
  47. package/dist/decorators/index.d.ts.map +1 -0
  48. package/dist/decorators/index.js +13 -0
  49. package/dist/decorators/index.js.map +1 -0
  50. package/dist/decorators/nodes.d.ts +12 -0
  51. package/dist/decorators/nodes.d.ts.map +1 -0
  52. package/dist/decorators/nodes.js +29 -0
  53. package/dist/decorators/nodes.js.map +1 -0
  54. package/dist/decorators/page.d.ts +13 -0
  55. package/dist/decorators/page.d.ts.map +1 -0
  56. package/dist/decorators/page.js +68 -0
  57. package/dist/decorators/page.js.map +1 -0
  58. package/dist/decorators/registry.d.ts +11 -0
  59. package/dist/decorators/registry.d.ts.map +1 -0
  60. package/dist/decorators/registry.js +29 -0
  61. package/dist/decorators/registry.js.map +1 -0
  62. package/dist/decorators/sequence.d.ts +8 -0
  63. package/dist/decorators/sequence.d.ts.map +1 -0
  64. package/dist/decorators/sequence.js +22 -0
  65. package/dist/decorators/sequence.js.map +1 -0
  66. package/dist/decorators/types.d.ts +30 -0
  67. package/dist/decorators/types.d.ts.map +1 -0
  68. package/dist/decorators/types.js +2 -0
  69. package/dist/decorators/types.js.map +1 -0
  70. package/dist/define-seo.d.ts +21 -0
  71. package/dist/define-seo.d.ts.map +1 -0
  72. package/dist/define-seo.js +31 -0
  73. package/dist/define-seo.js.map +1 -0
  74. package/dist/graph/build-entity.d.ts +47 -0
  75. package/dist/graph/build-entity.d.ts.map +1 -0
  76. package/dist/graph/build-entity.js +69 -0
  77. package/dist/graph/build-entity.js.map +1 -0
  78. package/dist/graph/compose-from-config.d.ts +89 -0
  79. package/dist/graph/compose-from-config.d.ts.map +1 -0
  80. package/dist/graph/compose-from-config.js +189 -0
  81. package/dist/graph/compose-from-config.js.map +1 -0
  82. package/dist/graph/compose-graph.d.ts +40 -0
  83. package/dist/graph/compose-graph.d.ts.map +1 -0
  84. package/dist/graph/compose-graph.js +30 -0
  85. package/dist/graph/compose-graph.js.map +1 -0
  86. package/dist/graph/effective-config.d.ts +36 -0
  87. package/dist/graph/effective-config.d.ts.map +1 -0
  88. package/dist/graph/effective-config.js +84 -0
  89. package/dist/graph/effective-config.js.map +1 -0
  90. package/dist/graph/id-conventions.d.ts +47 -0
  91. package/dist/graph/id-conventions.d.ts.map +1 -0
  92. package/dist/graph/id-conventions.js +78 -0
  93. package/dist/graph/id-conventions.js.map +1 -0
  94. package/dist/graph/index.d.ts +9 -0
  95. package/dist/graph/index.d.ts.map +1 -0
  96. package/dist/graph/index.js +4 -0
  97. package/dist/graph/index.js.map +1 -0
  98. package/dist/graph/resolve-properties.d.ts +36 -0
  99. package/dist/graph/resolve-properties.d.ts.map +1 -0
  100. package/dist/graph/resolve-properties.js +141 -0
  101. package/dist/graph/resolve-properties.js.map +1 -0
  102. package/dist/graph/resolve-references.d.ts +14 -0
  103. package/dist/graph/resolve-references.d.ts.map +1 -0
  104. package/dist/graph/resolve-references.js +49 -0
  105. package/dist/graph/resolve-references.js.map +1 -0
  106. package/dist/graph/typed-value.d.ts +7 -0
  107. package/dist/graph/typed-value.d.ts.map +1 -0
  108. package/dist/graph/typed-value.js +43 -0
  109. package/dist/graph/typed-value.js.map +1 -0
  110. package/dist/graph/types.d.ts +34 -0
  111. package/dist/graph/types.d.ts.map +1 -0
  112. package/dist/graph/types.js +2 -0
  113. package/dist/graph/types.js.map +1 -0
  114. package/dist/graph/value-scope.d.ts +19 -0
  115. package/dist/graph/value-scope.d.ts.map +1 -0
  116. package/dist/graph/value-scope.js +30 -0
  117. package/dist/graph/value-scope.js.map +1 -0
  118. package/dist/index.d.ts +28 -0
  119. package/dist/index.d.ts.map +1 -0
  120. package/dist/index.js +29 -0
  121. package/dist/index.js.map +1 -0
  122. package/dist/json-ld.d.ts +24 -0
  123. package/dist/json-ld.d.ts.map +1 -0
  124. package/dist/json-ld.js +24 -0
  125. package/dist/json-ld.js.map +1 -0
  126. package/dist/profiles/bing.d.ts +10 -0
  127. package/dist/profiles/bing.d.ts.map +1 -0
  128. package/dist/profiles/bing.js +13 -0
  129. package/dist/profiles/bing.js.map +1 -0
  130. package/dist/profiles/check.d.ts +11 -0
  131. package/dist/profiles/check.d.ts.map +1 -0
  132. package/dist/profiles/check.js +66 -0
  133. package/dist/profiles/check.js.map +1 -0
  134. package/dist/profiles/eligibility.d.ts +26 -0
  135. package/dist/profiles/eligibility.d.ts.map +1 -0
  136. package/dist/profiles/eligibility.js +49 -0
  137. package/dist/profiles/eligibility.js.map +1 -0
  138. package/dist/profiles/google.d.ts +4 -0
  139. package/dist/profiles/google.d.ts.map +1 -0
  140. package/dist/profiles/google.js +387 -0
  141. package/dist/profiles/google.js.map +1 -0
  142. package/dist/profiles/index.d.ts +10 -0
  143. package/dist/profiles/index.d.ts.map +1 -0
  144. package/dist/profiles/index.js +13 -0
  145. package/dist/profiles/index.js.map +1 -0
  146. package/dist/profiles/registry.d.ts +16 -0
  147. package/dist/profiles/registry.d.ts.map +1 -0
  148. package/dist/profiles/registry.js +66 -0
  149. package/dist/profiles/registry.js.map +1 -0
  150. package/dist/profiles/types.d.ts +29 -0
  151. package/dist/profiles/types.d.ts.map +1 -0
  152. package/dist/profiles/types.js +2 -0
  153. package/dist/profiles/types.js.map +1 -0
  154. package/dist/seo-graph.d.ts +39 -0
  155. package/dist/seo-graph.d.ts.map +1 -0
  156. package/dist/seo-graph.js +34 -0
  157. package/dist/seo-graph.js.map +1 -0
  158. package/dist/types/built-in/content.d.ts +12 -0
  159. package/dist/types/built-in/content.d.ts.map +1 -0
  160. package/dist/types/built-in/content.js +79 -0
  161. package/dist/types/built-in/content.js.map +1 -0
  162. package/dist/types/built-in/events.d.ts +23 -0
  163. package/dist/types/built-in/events.d.ts.map +1 -0
  164. package/dist/types/built-in/events.js +93 -0
  165. package/dist/types/built-in/events.js.map +1 -0
  166. package/dist/types/built-in/index.d.ts +4 -0
  167. package/dist/types/built-in/index.d.ts.map +1 -0
  168. package/dist/types/built-in/index.js +26 -0
  169. package/dist/types/built-in/index.js.map +1 -0
  170. package/dist/types/built-in/media.d.ts +21 -0
  171. package/dist/types/built-in/media.d.ts.map +1 -0
  172. package/dist/types/built-in/media.js +104 -0
  173. package/dist/types/built-in/media.js.map +1 -0
  174. package/dist/types/built-in/site.d.ts +14 -0
  175. package/dist/types/built-in/site.d.ts.map +1 -0
  176. package/dist/types/built-in/site.js +35 -0
  177. package/dist/types/built-in/site.js.map +1 -0
  178. package/dist/types/context.d.ts +26 -0
  179. package/dist/types/context.d.ts.map +1 -0
  180. package/dist/types/context.js +44 -0
  181. package/dist/types/context.js.map +1 -0
  182. package/dist/types/definition.d.ts +58 -0
  183. package/dist/types/definition.d.ts.map +1 -0
  184. package/dist/types/definition.js +2 -0
  185. package/dist/types/definition.js.map +1 -0
  186. package/dist/types/index.d.ts +4 -0
  187. package/dist/types/index.d.ts.map +1 -0
  188. package/dist/types/index.js +3 -0
  189. package/dist/types/index.js.map +1 -0
  190. package/dist/types/registry.d.ts +14 -0
  191. package/dist/types/registry.d.ts.map +1 -0
  192. package/dist/types/registry.js +37 -0
  193. package/dist/types/registry.js.map +1 -0
  194. package/dist/types/values.d.ts +23 -0
  195. package/dist/types/values.d.ts.map +1 -0
  196. package/dist/types/values.js +52 -0
  197. package/dist/types/values.js.map +1 -0
  198. package/dist/validate/check-terms.d.ts +15 -0
  199. package/dist/validate/check-terms.d.ts.map +1 -0
  200. package/dist/validate/check-terms.js +42 -0
  201. package/dist/validate/check-terms.js.map +1 -0
  202. package/dist/validate/check-value.d.ts +19 -0
  203. package/dist/validate/check-value.d.ts.map +1 -0
  204. package/dist/validate/check-value.js +77 -0
  205. package/dist/validate/check-value.js.map +1 -0
  206. package/dist/validate/graph-nodes.d.ts +22 -0
  207. package/dist/validate/graph-nodes.d.ts.map +1 -0
  208. package/dist/validate/graph-nodes.js +50 -0
  209. package/dist/validate/graph-nodes.js.map +1 -0
  210. package/dist/validate/index.d.ts +4 -0
  211. package/dist/validate/index.d.ts.map +1 -0
  212. package/dist/validate/index.js +2 -0
  213. package/dist/validate/index.js.map +1 -0
  214. package/dist/validate/types.d.ts +22 -0
  215. package/dist/validate/types.d.ts.map +1 -0
  216. package/dist/validate/types.js +2 -0
  217. package/dist/validate/types.js.map +1 -0
  218. package/dist/validate/validate-graph.d.ts +18 -0
  219. package/dist/validate/validate-graph.d.ts.map +1 -0
  220. package/dist/validate/validate-graph.js +109 -0
  221. package/dist/validate/validate-graph.js.map +1 -0
  222. package/dist/vocabulary/datatypes.d.ts +7 -0
  223. package/dist/vocabulary/datatypes.d.ts.map +1 -0
  224. package/dist/vocabulary/datatypes.js +46 -0
  225. package/dist/vocabulary/datatypes.js.map +1 -0
  226. package/dist/vocabulary/index.d.ts +5 -0
  227. package/dist/vocabulary/index.d.ts.map +1 -0
  228. package/dist/vocabulary/index.js +4 -0
  229. package/dist/vocabulary/index.js.map +1 -0
  230. package/dist/vocabulary/schemaorg.generated.d.ts +4 -0
  231. package/dist/vocabulary/schemaorg.generated.d.ts.map +1 -0
  232. package/dist/vocabulary/schemaorg.generated.js +3038 -0
  233. package/dist/vocabulary/schemaorg.generated.js.map +1 -0
  234. package/dist/vocabulary/types.d.ts +38 -0
  235. package/dist/vocabulary/types.d.ts.map +1 -0
  236. package/dist/vocabulary/types.js +2 -0
  237. package/dist/vocabulary/types.js.map +1 -0
  238. package/dist/vocabulary/vocabulary.d.ts +28 -0
  239. package/dist/vocabulary/vocabulary.d.ts.map +1 -0
  240. package/dist/vocabulary/vocabulary.js +89 -0
  241. package/dist/vocabulary/vocabulary.js.map +1 -0
  242. package/package.json +41 -3
  243. package/README.md +0 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/profiles/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAI5D;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,IAAI,CAkBlE;AAED,iDAAiD;AACjD,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAEhE;AAED,sCAAsC;AACtC,wBAAgB,kBAAkB,IAAI,SAAS,aAAa,EAAE,CAE7D;AAaD,kFAAkF;AAClF,wBAAgB,OAAO,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAarF"}
@@ -0,0 +1,66 @@
1
+ import { ancestorsOf, getVocabularyType } from '../vocabulary/index.js';
2
+ const profiles = new Map();
3
+ /**
4
+ * Register a reader's rule set. A site registers its own readers the same way
5
+ * krantho registers Google's and Bing's; a later registration under one id
6
+ * replaces the earlier one. Throws for a rule whose type the vocabulary does
7
+ * not have, or without a source and verification date. Returns a function
8
+ * that restores the previous registration.
9
+ */
10
+ export function registerProfile(profile) {
11
+ for (const rule of profile.rules) {
12
+ if (!getVocabularyType(rule.type)) {
13
+ throw new Error(`registerProfile(${profile.id}): "${rule.type}" is not a Schema.org type.`);
14
+ }
15
+ if (!rule.source || !/^\d{4}-\d{2}-\d{2}$/.test(rule.verifiedAt)) {
16
+ throw new Error(`registerProfile(${profile.id}): the ${rule.type} rule needs a source and a verifiedAt date.`);
17
+ }
18
+ }
19
+ const previous = profiles.get(profile.id);
20
+ profiles.set(profile.id, profile);
21
+ return () => {
22
+ if (profiles.get(profile.id) !== profile)
23
+ return;
24
+ if (previous)
25
+ profiles.set(profile.id, previous);
26
+ else
27
+ profiles.delete(profile.id);
28
+ };
29
+ }
30
+ /** The reader profile registered under the id */
31
+ export function getProfile(id) {
32
+ return profiles.get(id);
33
+ }
34
+ /** Every registered reader profile */
35
+ export function registeredProfiles() {
36
+ return [...profiles.values()];
37
+ }
38
+ /** How many inheritance steps separate a type from an ancestor; Infinity when it is none */
39
+ function distance(type, ancestor) {
40
+ if (type === ancestor)
41
+ return 0;
42
+ let level = [type];
43
+ for (let steps = 1; level.length > 0 && steps < 32; steps++) {
44
+ level = level.flatMap((t) => getVocabularyType(t)?.parents ?? []);
45
+ if (level.includes(ancestor))
46
+ return steps;
47
+ }
48
+ return Number.POSITIVE_INFINITY;
49
+ }
50
+ /** The profile's rule for a type: its own, or the one for its nearest ancestor */
51
+ export function ruleFor(profile, type) {
52
+ const ancestors = ancestorsOf(type);
53
+ let best;
54
+ let bestDistance = Number.POSITIVE_INFINITY;
55
+ for (const rule of profile.rules) {
56
+ if (!ancestors.has(rule.type))
57
+ continue;
58
+ const d = distance(type, rule.type);
59
+ if (d < bestDistance) {
60
+ best = rule;
61
+ bestDistance = d;
62
+ }
63
+ }
64
+ return best;
65
+ }
66
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/profiles/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAGvE,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAyB,CAAA;AAEjD;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,OAAsB;IACpD,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACjC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,mBAAmB,OAAO,CAAC,EAAE,OAAO,IAAI,CAAC,IAAI,6BAA6B,CAAC,CAAA;QAC7F,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,UA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,EAAE,CAAC,CAAA;QACjE,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAAE,OAAO,KAAK,CAAA;IAC5C,CAAC;IACD,OAAO,MAAM,CAAC,iBAAiB,CAAA;AACjC,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,OAAO,CAAC,OAAsB,EAAE,IAAY;IAC1D,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,CAAC,CAAA;IACnC,IAAI,IAA6B,CAAA;IACjC,IAAI,YAAY,GAAG,MAAM,CAAC,iBAAiB,CAAA;IAC3C,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACjC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,SAAQ;QACvC,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;QACnC,IAAI,CAAC,GAAG,YAAY,EAAE,CAAC;YACrB,IAAI,GAAG,IAAI,CAAA;YACX,YAAY,GAAG,CAAC,CAAA;QAClB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -0,0 +1,29 @@
1
+ /** Whether a reader shows a feature: available, shown only under conditions, retired, or no feature at all */
2
+ export type FeatureStatus = 'active' | 'restricted' | 'retired' | 'none';
3
+ /** One reader's rule for a Schema.org type, with the documentation it comes from */
4
+ export interface ProfileRule {
5
+ /** The Schema.org type the rule applies to — and its subtypes, unless a subtype has its own rule */
6
+ readonly type: string;
7
+ /** The search feature the rule makes a page eligible for, as the reader names it */
8
+ readonly feature?: string | undefined;
9
+ readonly status: FeatureStatus;
10
+ /** Properties the feature needs */
11
+ readonly required?: readonly string[] | undefined;
12
+ /** Groups of properties of which the feature needs at least one each */
13
+ readonly oneOf?: ReadonlyArray<readonly string[]> | undefined;
14
+ /** Properties the reader recommends */
15
+ readonly recommended?: readonly string[] | undefined;
16
+ /** Conditions the reader states in words, e.g. who a restricted feature is shown for */
17
+ readonly conditions?: readonly string[] | undefined;
18
+ /** The documentation the rule comes from */
19
+ readonly source: string;
20
+ /** The date the rule was last checked against its source, ISO 8601 */
21
+ readonly verifiedAt: string;
22
+ }
23
+ /** A reader's published rules — a search engine's or an assistant's — on top of the Schema.org baseline */
24
+ export interface ReaderProfile {
25
+ readonly id: string;
26
+ readonly name: string;
27
+ readonly rules: readonly ProfileRule[];
28
+ }
29
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/profiles/types.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,CAAA;AAExE,oFAAoF;AACpF,MAAM,WAAW,WAAW;IAC1B,oGAAoG;IACpG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,oFAAoF;IACpF,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;IAC9B,mCAAmC;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;IACjD,wEAAwE;IACxE,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,SAAS,MAAM,EAAE,CAAC,GAAG,SAAS,CAAA;IAC7D,uCAAuC;IACvC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;IACpD,wFAAwF;IACxF,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;IACnD,4CAA4C;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,sEAAsE;IACtE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAED,2GAA2G;AAC3G,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAA;CACvC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/profiles/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ import type { PageStructure } from '@krantho/core';
2
+ import type { Archetype } from './archetypes/types.js';
3
+ import type { SeoGraphConfig } from './graph/types.js';
4
+ export interface SEOGraphProps {
5
+ /** The archetype defining which schemas to render */
6
+ archetype: Archetype;
7
+ /** Page fields (already resolved by resolvePageContent) */
8
+ fields: Record<string, unknown>;
9
+ /** Site configuration from krantho.config.ts */
10
+ config: SeoGraphConfig;
11
+ /** Current page path, e.g., '/about' */
12
+ path: string;
13
+ /** The structure the page renders: its trail, its place in a sequence, its kind */
14
+ structure?: PageStructure | undefined;
15
+ /** Optional FAQ pairs */
16
+ faq?: ReadonlyArray<{
17
+ question: string;
18
+ answer: string;
19
+ }> | undefined;
20
+ }
21
+ /**
22
+ * Renders a composed `@graph` JSON-LD block from an archetype and page data.
23
+ *
24
+ * Replaces manual composition of individual schema components
25
+ * (BusinessStructuredData, BreadcrumbJsonLd, FAQSchema) with a single
26
+ * declarative component.
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * <SEOGraph
31
+ * archetype={homePageArchetype}
32
+ * fields={content.hero.fields}
33
+ * config={siteConfig}
34
+ * path="/"
35
+ * />
36
+ * ```
37
+ */
38
+ export declare function SEOGraph(props: SEOGraphProps): React.JSX.Element;
39
+ //# sourceMappingURL=seo-graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seo-graph.d.ts","sourceRoot":"","sources":["../src/seo-graph.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEtD,MAAM,WAAW,aAAa;IAC5B,qDAAqD;IACrD,SAAS,EAAE,SAAS,CAAA;IACpB,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,gDAAgD;IAChD,MAAM,EAAE,cAAc,CAAA;IACtB,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAA;IACZ,mFAAmF;IACnF,SAAS,CAAC,EAAE,aAAa,GAAG,SAAS,CAAA;IACrC,yBAAyB;IACzB,GAAG,CAAC,EAAE,aAAa,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,SAAS,CAAA;CACtE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAiBhE"}
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { serializeJsonLd } from '@krantho/seo-shared';
3
+ import { composeGraph } from './graph/compose-graph.js';
4
+ /**
5
+ * Renders a composed `@graph` JSON-LD block from an archetype and page data.
6
+ *
7
+ * Replaces manual composition of individual schema components
8
+ * (BusinessStructuredData, BreadcrumbJsonLd, FAQSchema) with a single
9
+ * declarative component.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * <SEOGraph
14
+ * archetype={homePageArchetype}
15
+ * fields={content.hero.fields}
16
+ * config={siteConfig}
17
+ * path="/"
18
+ * />
19
+ * ```
20
+ */
21
+ export function SEOGraph(props) {
22
+ const graph = composeGraph({
23
+ archetype: props.archetype,
24
+ fields: props.fields,
25
+ config: props.config,
26
+ path: props.path,
27
+ structure: props.structure,
28
+ faq: props.faq,
29
+ });
30
+ return (_jsx("script", { type: "application/ld+json",
31
+ // biome-ignore lint/security/noDangerouslySetInnerHtml: serializeJsonLd escapes `<`, so the JSON cannot end the script tag
32
+ dangerouslySetInnerHTML: { __html: serializeJsonLd(graph) } }));
33
+ }
34
+ //# sourceMappingURL=seo-graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seo-graph.js","sourceRoot":"","sources":["../src/seo-graph.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAkBvD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAoB;IAC3C,MAAM,KAAK,GAAG,YAAY,CAAC;QACzB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,GAAG,EAAE,KAAK,CAAC,GAAG;KACf,CAAC,CAAA;IAEF,OAAO,CACL,iBACE,IAAI,EAAC,qBAAqB;QAC1B,2HAA2H;QAC3H,uBAAuB,EAAE,EAAE,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,GAC3D,CACH,CAAA;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { TypeDefinition } from '../definition.js';
2
+ /** An article: headline, author and publisher; dates, image and description are carried */
3
+ export declare const articleType: TypeDefinition;
4
+ /** A service the site's organization provides */
5
+ export declare const serviceType: TypeDefinition;
6
+ /** A product; its name, description and offers are carried */
7
+ export declare const productType: TypeDefinition;
8
+ /** The page's trail; configured items win over the trail the page renders */
9
+ export declare const breadcrumbListType: TypeDefinition;
10
+ /** Questions and answers the page renders */
11
+ export declare const faqPageType: TypeDefinition;
12
+ //# sourceMappingURL=content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/types/built-in/content.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAgB,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGpE,2FAA2F;AAC3F,eAAO,MAAM,WAAW,EAAE,cAezB,CAAA;AAED,iDAAiD;AACjD,eAAO,MAAM,WAAW,EAAE,cAWzB,CAAA;AAED,8DAA8D;AAC9D,eAAO,MAAM,WAAW,EAAE,cAMzB,CAAA;AAeD,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB,EAAE,cAUhC,CAAA;AAED,6CAA6C;AAC7C,eAAO,MAAM,WAAW,EAAE,cAczB,CAAA"}
@@ -0,0 +1,79 @@
1
+ import { breadcrumbItems } from '../../decorators/breadcrumb.js';
2
+ import { AUTHOR_RULE, authorOf, ORGANIZATION_RULE, propertyValue, siteOrganization, siteWebsite, textOf, WEBSITE_RULE, } from '../context.js';
3
+ import { compact } from '../values.js';
4
+ /** An article: headline, author and publisher; dates, image and description are carried */
5
+ export const articleType = {
6
+ type: 'Article',
7
+ scope: 'document',
8
+ idFragment: 'article',
9
+ fields: { headline: [], author: [] },
10
+ references: { author: AUTHOR_RULE, publisher: ORGANIZATION_RULE, isPartOf: WEBSITE_RULE },
11
+ build: (context) => compact({
12
+ '@type': context.type,
13
+ '@id': context.id,
14
+ headline: textOf(context, 'headline'),
15
+ author: authorOf(context),
16
+ publisher: siteOrganization(context),
17
+ isPartOf: siteWebsite(context),
18
+ }),
19
+ };
20
+ /** A service the site's organization provides */
21
+ export const serviceType = {
22
+ type: 'Service',
23
+ scope: 'document',
24
+ idFragment: 'service',
25
+ fields: { name: [], description: [] },
26
+ references: { provider: ORGANIZATION_RULE },
27
+ build: (context) => ({
28
+ '@type': context.type,
29
+ '@id': context.id,
30
+ provider: siteOrganization(context),
31
+ }),
32
+ };
33
+ /** A product; its name, description and offers are carried */
34
+ export const productType = {
35
+ type: 'Product',
36
+ scope: 'document',
37
+ idFragment: 'product',
38
+ fields: { name: [], description: [] },
39
+ build: (context) => ({ '@type': context.type, '@id': context.id }),
40
+ };
41
+ /** The configured items, else the page's trail, else Home › the page */
42
+ function trailItems(context) {
43
+ const configured = propertyValue(context, 'itemListElement');
44
+ if (Array.isArray(configured) && configured.length > 0)
45
+ return configured;
46
+ const page = `${context.site.baseUrl}${context.path}`;
47
+ return breadcrumbItems(context.trail ?? [
48
+ { name: 'Home', url: context.site.baseUrl },
49
+ { name: context.title ?? '', url: page },
50
+ ]);
51
+ }
52
+ /** The page's trail; configured items win over the trail the page renders */
53
+ export const breadcrumbListType = {
54
+ type: 'BreadcrumbList',
55
+ scope: 'document',
56
+ idFragment: 'breadcrumb',
57
+ computed: [],
58
+ build: (context) => ({
59
+ '@type': context.type,
60
+ '@id': context.id,
61
+ itemListElement: trailItems(context),
62
+ }),
63
+ };
64
+ /** Questions and answers the page renders */
65
+ export const faqPageType = {
66
+ type: 'FAQPage',
67
+ scope: 'document',
68
+ idFragment: 'faq',
69
+ build: (context) => compact({
70
+ '@type': context.type,
71
+ '@id': context.id,
72
+ mainEntity: (context.faq ?? []).map((q) => ({
73
+ '@type': 'Question',
74
+ name: q.question,
75
+ acceptedAnswer: { '@type': 'Answer', text: q.answer },
76
+ })),
77
+ }),
78
+ };
79
+ //# sourceMappingURL=content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.js","sourceRoot":"","sources":["../../../src/types/built-in/content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAEhE,OAAO,EACL,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,MAAM,EACN,YAAY,GACb,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,2FAA2F;AAC3F,MAAM,CAAC,MAAM,WAAW,GAAmB;IACzC,IAAI,EAAE,S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AAO,CAAC,IAAI;QACrB,KAAK,EAAE,OAAO,CAAC,EAAE;QACjB,UAAU,EAAE,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC1C,OAAO,EAAE,UAAU;YACnB,IAAI,EAAE,CAAC,CAAC,QAAQ;YAChB,cAAc,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;SACtD,CAAC,CAAC;KACJ,CAAC;CACL,CAAA"}
@@ -0,0 +1,23 @@
1
+ import type { TypeDefinition } from '../definition.js';
2
+ /**
3
+ * An event, organized by the site's organization. A location or offer given
4
+ * as text becomes a Place or Offer.
5
+ *
6
+ * @see https://developers.google.com/search/docs/appearance/structured-data/event
7
+ */
8
+ export declare const eventType: TypeDefinition;
9
+ /**
10
+ * A course the site's organization provides. Without a configured course
11
+ * instance it gets an online one, which the Course list rich result needs.
12
+ *
13
+ * @see https://developers.google.com/search/docs/appearance/structured-data/course
14
+ */
15
+ export declare const courseType: TypeDefinition;
16
+ /**
17
+ * A job posting by the site's organization. A salary or location given as
18
+ * text becomes a MonetaryAmount or Place.
19
+ *
20
+ * @see https://developers.google.com/search/docs/appearance/structured-data/job-posting
21
+ */
22
+ export declare const jobPostingType: TypeDefinition;
23
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/types/built-in/events.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGpE;;;;;GAKG;AACH,eAAO,MAAM,SAAS,EAAE,cAwBvB,CAAA;AAQD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,cAmBxB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,cAsB5B,CAAA"}
@@ -0,0 +1,93 @@
1
+ import { ORGANIZATION_RULE, propertyValue, siteOrganization, textOf } from '../context.js';
2
+ import { asSubEntity, compact } from '../values.js';
3
+ /**
4
+ * An event, organized by the site's organization. A location or offer given
5
+ * as text becomes a Place or Offer.
6
+ *
7
+ * @see https://developers.google.com/search/docs/appearance/structured-data/event
8
+ */
9
+ export const eventType = {
10
+ type: 'Event',
11
+ scope: 'document',
12
+ idFragment: 'event',
13
+ fields: {
14
+ name: [],
15
+ description: [],
16
+ image: [],
17
+ startDate: ['start-date', 'date'],
18
+ endDate: ['end-date'],
19
+ eventStatus: [],
20
+ eventAttendanceMode: [],
21
+ location: [],
22
+ offers: [],
23
+ },
24
+ references: { organizer: ORGANIZATION_RULE },
25
+ build: (context) => compact({
26
+ '@type': context.type,
27
+ '@id': context.id,
28
+ location: asSubEntity(propertyValue(context, 'location'), 'Place', 'name'),
29
+ offers: asSubEntity(propertyValue(context, 'offers'), 'Offer', 'price'),
30
+ organizer: siteOrganization(context),
31
+ }),
32
+ };
33
+ function courseInstance(context) {
34
+ const configured = propertyValue(context, 'hasCourseInstance');
35
+ if (configured && typeof configured === 'object')
36
+ return configured;
37
+ return { '@type': 'CourseInstance', courseMode: textOf(context, 'courseMode') || 'Online' };
38
+ }
39
+ /**
40
+ * A course the site's organization provides. Without a configured course
41
+ * instance it gets an online one, which the Course list rich result needs.
42
+ *
43
+ * @see https://developers.google.com/search/docs/appearance/structured-data/course
44
+ */
45
+ export const courseType = {
46
+ type: 'Course',
47
+ scope: 'document',
48
+ idFragment: 'course',
49
+ fields: {
50
+ name: [],
51
+ description: [],
52
+ image: [],
53
+ courseCode: ['course-code'],
54
+ courseMode: ['course-mode'],
55
+ hasCourseInstance: [],
56
+ },
57
+ references: { provider: ORGANIZATION_RULE },
58
+ build: (context) => ({
59
+ '@type': context.type,
60
+ '@id': context.id,
61
+ provider: siteOrganization(context),
62
+ hasCourseInstance: courseInstance(context),
63
+ }),
64
+ };
65
+ /**
66
+ * A job posting by the site's organization. A salary or location given as
67
+ * text becomes a MonetaryAmount or Place.
68
+ *
69
+ * @see https://developers.google.com/search/docs/appearance/structured-data/job-posting
70
+ */
71
+ export const jobPostingType = {
72
+ type: 'JobPosting',
73
+ scope: 'document',
74
+ idFragment: 'jobposting',
75
+ fields: {
76
+ title: [],
77
+ description: [],
78
+ datePosted: ['date-posted', 'date'],
79
+ validThrough: ['valid-through'],
80
+ employmentType: ['employment-type'],
81
+ baseSalary: ['base-salary', 'salary'],
82
+ jobLocation: ['job-location'],
83
+ },
84
+ references: { hiringOrganization: ORGANIZATION_RULE },
85
+ build: (context) => compact({
86
+ '@type': context.type,
87
+ '@id': context.id,
88
+ baseSalary: asSubEntity(propertyValue(context, 'baseSalary'), 'MonetaryAmount', 'value'),
89
+ jobLocation: asSubEntity(propertyValue(context, 'jobLocation'), 'Place', 'name'),
90
+ hiringOrganization: siteOrganization(context),
91
+ }),
92
+ };
93
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/types/built-in/events.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE1F,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAmB;IACvC,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,UAAU;IACjB,UAAU,EAAE,OAAO;IACnB,MAAM,EAAE;QACN,IAAI,EAAE,EAAE;QACR,WAAW,EAAE,EAAE;QACf,KAAK,EAAE,EAAE;QACT,SAAS,EAAE,CAAC,YAAY,EAAE,MAAM,CAAC;QACjC,OAAO,EAAE,CAAC,UAAU,CAAC;QACrB,WAAW,EAAE,EAAE;QACf,mBAAmB,EAAE,EAAE;QACvB,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,EAAE;KACX;IACD,UAAU,EAAE,EAAE,SAAS,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EAAE,gBAAgB,CAAC,OAAO,CAAC;QACnC,iBAAiB,EAAE,cAAc,CAAC,OAAO,CAAC;KAC3C,CAAC;CACH,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,UAAU;IACjB,UAAU,EAAE,YAAY;IACxB,MAAM,EAAE;QACN,KAAK,EAAE,EAAE;QACT,WAAW,EAAE,EAAE;QACf,UAAU,EAAE,CAAC,aAAa,EAAE,MAAM,CAAC;QACnC,YAAY,EAAE,CAAC,eAAe,CAAC;QAC/B,cAAc,EAAE,CAAC,iBAAiB,CAAC;QACnC,UAAU,EAAE,CAAC,aAAa,EAAE,QAAQ,CAAC;QACrC,WAAW,EAAE,CAAC,cAAc,CAAC;KAC9B;IACD,UAAU,EAAE,EAAE,kBAAkB,EAAE,iBAAiB,EAAE;IACrD,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE,CACjB,OAAO,CAAC;QACN,OAAO,EAAE,OAAO,CAAC,IAAI;QACrB,KAAK,EAAE,OAAO,CAAC,EAAE;QACjB,UAAU,EAAE,WAAW,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE,gBAAgB,EAAE,OAAO,CAAC;QACxF,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC;QAChF,kBAAkB,EAAE,gBAAgB,CAAC,OAAO,CAAC;KAC9C,CAAC;CACL,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { TypeDefinition } from '../definition.js';
2
+ /** The types krantho builds with a dedicated definition */
3
+ export declare const BUILT_IN_TYPES: readonly TypeDefinition[];
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/built-in/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAatD,2DAA2D;AAC3D,eAAO,MAAM,cAAc,EAAE,SAAS,cAAc,EAgBnD,CAAA"}
@@ -0,0 +1,26 @@
1
+ import { registerType } from '../registry.js';
2
+ import { articleType, breadcrumbListType, faqPageType, productType, serviceType, } from './content.js';
3
+ import { courseType, eventType, jobPostingType } from './events.js';
4
+ import { howToType, recipeType, videoObjectType } from './media.js';
5
+ import { localBusinessType, organizationType, personType, webSiteType } from './site.js';
6
+ /** The types krantho builds with a dedicated definition */
7
+ export const BUILT_IN_TYPES = [
8
+ localBusinessType,
9
+ organizationType,
10
+ webSiteType,
11
+ personType,
12
+ articleType,
13
+ breadcrumbListType,
14
+ faqPageType,
15
+ serviceType,
16
+ productType,
17
+ eventType,
18
+ recipeType,
19
+ howToType,
20
+ courseType,
21
+ jobPostingType,
22
+ videoObjectType,
23
+ ];
24
+ for (const definition of BUILT_IN_TYPES)
25
+ registerType(definition);
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/built-in/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,WAAW,GACZ,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAExF,2DAA2D;AAC3D,MAAM,CAAC,MAAM,cAAc,GAA8B;IACvD,iBAAiB;IACjB,gBAAgB;IAChB,WAAW;IACX,UAAU;IACV,WAAW;IACX,kBAAkB;IAClB,WAAW;IACX,WAAW;IACX,WAAW;IACX,SAAS;IACT,UAAU;IACV,SAAS;IACT,UAAU;IACV,cAAc;IACd,eAAe;CAChB,CAAA;AAED,KAAK,MAAM,UAAU,IAAI,cAAc;IAAE,YAAY,CAAC,UAAU,CAAC,CAAA"}
@@ -0,0 +1,21 @@
1
+ import type { TypeDefinition } from '../definition.js';
2
+ /**
3
+ * A recipe. Ingredients and instructions accept a list, a comma-separated
4
+ * string or one string; instructions become HowToSteps.
5
+ *
6
+ * @see https://developers.google.com/search/docs/appearance/structured-data/recipe
7
+ */
8
+ export declare const recipeType: TypeDefinition;
9
+ /**
10
+ * A how-to guide: its steps, supplies and tools as HowTo sub-entities.
11
+ *
12
+ * @see https://developers.google.com/search/docs/appearance/structured-data/how-to
13
+ */
14
+ export declare const howToType: TypeDefinition;
15
+ /**
16
+ * A video, published by the site's organization.
17
+ *
18
+ * @see https://developers.google.com/search/docs/appearance/structured-data/video
19
+ */
20
+ export declare const videoObjectType: TypeDefinition;
21
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/types/built-in/media.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAOtD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,cA6BxB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,cA+BvB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,cAqB7B,CAAA"}
@@ -0,0 +1,104 @@
1
+ import { AUTHOR_RULE, authorOf, ORGANIZATION_RULE, propertyValue, siteOrganization, } from '../context.js';
2
+ import { asStringList, asSubEntity, compact } from '../values.js';
3
+ function steps(value) {
4
+ return asStringList(value).map((text) => ({ '@type': 'HowToStep', text }));
5
+ }
6
+ /**
7
+ * A recipe. Ingredients and instructions accept a list, a comma-separated
8
+ * string or one string; instructions become HowToSteps.
9
+ *
10
+ * @see https://developers.google.com/search/docs/appearance/structured-data/recipe
11
+ */
12
+ export const recipeType = {
13
+ type: 'Recipe',
14
+ scope: 'document',
15
+ idFragment: 'recipe',
16
+ fields: {
17
+ name: [],
18
+ description: [],
19
+ image: [],
20
+ author: [],
21
+ prepTime: ['prep-time'],
22
+ cookTime: ['cook-time'],
23
+ totalTime: ['total-time'],
24
+ recipeYield: ['yield'],
25
+ recipeCategory: ['category'],
26
+ recipeCuisine: ['cuisine'],
27
+ recipeIngredient: ['ingredients'],
28
+ recipeInstructions: ['instructions'],
29
+ nutrition: [],
30
+ },
31
+ references: { author: AUTHOR_RULE },
32
+ build: (context) => compact({
33
+ '@type': context.type,
34
+ '@id': context.id,
35
+ author: authorOf(context),
36
+ recipeIngredient: asStringList(propertyValue(context, 'recipeIngredient')),
37
+ recipeInstructions: steps(propertyValue(context, 'recipeInstructions')),
38
+ nutrition: asSubEntity(propertyValue(context, 'nutrition'), 'NutritionInformation', 'name'),
39
+ }),
40
+ };
41
+ /**
42
+ * A how-to guide: its steps, supplies and tools as HowTo sub-entities.
43
+ *
44
+ * @see https://developers.google.com/search/docs/appearance/structured-data/how-to
45
+ */
46
+ export const howToType = {
47
+ type: 'HowTo',
48
+ scope: 'document',
49
+ idFragment: 'howto',
50
+ fields: {
51
+ name: [],
52
+ description: [],
53
+ image: [],
54
+ author: [],
55
+ totalTime: ['total-time'],
56
+ estimatedCost: ['estimated-cost'],
57
+ step: ['steps'],
58
+ supply: [],
59
+ tool: [],
60
+ },
61
+ references: { author: AUTHOR_RULE },
62
+ build: (context) => compact({
63
+ '@type': context.type,
64
+ '@id': context.id,
65
+ author: authorOf(context),
66
+ step: steps(propertyValue(context, 'step')),
67
+ supply: asStringList(propertyValue(context, 'supply')).map((name) => ({
68
+ '@type': 'HowToSupply',
69
+ name,
70
+ })),
71
+ tool: asStringList(propertyValue(context, 'tool')).map((name) => ({
72
+ '@type': 'HowToTool',
73
+ name,
74
+ })),
75
+ }),
76
+ };
77
+ /**
78
+ * A video, published by the site's organization.
79
+ *
80
+ * @see https://developers.google.com/search/docs/appearance/structured-data/video
81
+ */
82
+ export const videoObjectType = {
83
+ type: 'VideoObject',
84
+ scope: 'document',
85
+ idFragment: 'video',
86
+ fields: {
87
+ name: [],
88
+ description: [],
89
+ author: [],
90
+ contentUrl: ['content-url'],
91
+ thumbnailUrl: ['thumbnail-url', 'thumbnail'],
92
+ uploadDate: ['upload-date', 'datePublished', 'date'],
93
+ duration: [],
94
+ embedUrl: ['embed-url'],
95
+ },
96
+ references: { author: AUTHOR_RULE, publisher: ORGANIZATION_RULE },
97
+ build: (context) => ({
98
+ '@type': context.type,
99
+ '@id': context.id,
100
+ publisher: siteOrganization(context),
101
+ author: authorOf(context),
102
+ }),
103
+ };
104
+ //# sourceMappingURL=media.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.js","sourceRoot":"","sources":["../../../src/types/built-in/media.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,aAAa,EACb,gBAAgB,GACjB,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEjE,SAAS,KAAK,CAAC,KAAc;IAC3B,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AAC5E,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAmB;IACxC,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,UAAU;IACjB,UAAU,EAAE,QAAQ;IACpB,MAAM,EAAE;QACN,IAAI,EAAE,EAAE;QACR,WAAW,EAAE,EAAE;QACf,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE,CAAC,WAAW,CAAC;QACvB,QAAQ,EAAE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ACjB,SAAS,EAAE,gBAAgB,CAAC,OAAO,CAAC;QACpC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC;KAC1B,CAAC;CACH,CAAA"}
@@ -0,0 +1,14 @@
1
+ import type { TypeDefinition } from '../definition.js';
2
+ /**
3
+ * The site's organization. Its identity — name, address, logo, description,
4
+ * profiles — comes from the site configuration and is carried by the
5
+ * composer; the builder only places it.
6
+ */
7
+ export declare const organizationType: TypeDefinition;
8
+ /** A business with a physical location, identified like the Organization */
9
+ export declare const localBusinessType: TypeDefinition;
10
+ /** The website, published by the site's organization */
11
+ export declare const webSiteType: TypeDefinition;
12
+ /** The person behind the site, named by the content's author when a page describes them */
13
+ export declare const personType: TypeDefinition;
14
+ //# sourceMappingURL=site.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../../../src/types/built-in/site.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEtD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAK9B,CAAA;AAED,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,EAAE,cAA+D,CAAA;AAE/F,wDAAwD;AACxD,eAAO,MAAM,WAAW,EAAE,cAUzB,CAAA;AAED,2FAA2F;AAC3F,eAAO,MAAM,UAAU,EAAE,cAMxB,CAAA"}