@the-smithy/hearth-schema 0.21.0 → 0.22.0

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.d.ts CHANGED
@@ -2530,7 +2530,6 @@ declare function pinned<T extends {
2530
2530
  position: Position;
2531
2531
  })[];
2532
2532
 
2533
- declare const ORGANIZATION_TYPES: readonly ["Organization", "LocalBusiness", "NGO", "Corporation", "EducationalOrganization", "GovernmentOrganization", "MedicalOrganization", "SportsOrganization"];
2534
2533
  /** Languages a site can be in (Open Graph locale; the page's lang attribute is the part before the underscore). */
2535
2534
  declare const SITE_LOCALES: readonly ["en_US", "en_GB", "en_CA", "en_AU", "es_US", "es_ES", "es_MX", "fr_CA", "fr_FR", "de_DE", "pt_BR"];
2536
2535
  declare const SOCIAL_PLATFORMS: readonly ["facebook", "instagram", "linkedin", "x", "youtube", "tiktok", "other"];
@@ -2602,6 +2601,30 @@ declare const siteSettingsSchema: z.ZodObject<{
2602
2601
  GovernmentOrganization: "GovernmentOrganization";
2603
2602
  MedicalOrganization: "MedicalOrganization";
2604
2603
  SportsOrganization: "SportsOrganization";
2604
+ Hotel: "Hotel";
2605
+ BedAndBreakfast: "BedAndBreakfast";
2606
+ LodgingBusiness: "LodgingBusiness";
2607
+ Restaurant: "Restaurant";
2608
+ CafeOrCoffeeShop: "CafeOrCoffeeShop";
2609
+ BarOrPub: "BarOrPub";
2610
+ Store: "Store";
2611
+ ProfessionalService: "ProfessionalService";
2612
+ LegalService: "LegalService";
2613
+ AccountingService: "AccountingService";
2614
+ FinancialService: "FinancialService";
2615
+ RealEstateAgent: "RealEstateAgent";
2616
+ HomeAndConstructionBusiness: "HomeAndConstructionBusiness";
2617
+ AutomotiveBusiness: "AutomotiveBusiness";
2618
+ HealthAndBeautyBusiness: "HealthAndBeautyBusiness";
2619
+ MedicalClinic: "MedicalClinic";
2620
+ Dentist: "Dentist";
2621
+ ChildCare: "ChildCare";
2622
+ SportsActivityLocation: "SportsActivityLocation";
2623
+ EntertainmentBusiness: "EntertainmentBusiness";
2624
+ TouristAttraction: "TouristAttraction";
2625
+ Museum: "Museum";
2626
+ Church: "Church";
2627
+ School: "School";
2605
2628
  }>>;
2606
2629
  logo: z.ZodOptional<z.ZodObject<{
2607
2630
  src: z.ZodString;
@@ -2629,6 +2652,35 @@ declare const siteSettingsSchema: z.ZodObject<{
2629
2652
  google: z.ZodOptional<z.ZodString>;
2630
2653
  bing: z.ZodOptional<z.ZodString>;
2631
2654
  }, z.core.$strip>>;
2655
+ business: z.ZodDefault<z.ZodObject<{
2656
+ address: z.ZodDefault<z.ZodObject<{
2657
+ street: z.ZodOptional<z.ZodString>;
2658
+ city: z.ZodOptional<z.ZodString>;
2659
+ region: z.ZodOptional<z.ZodString>;
2660
+ postalCode: z.ZodOptional<z.ZodString>;
2661
+ country: z.ZodOptional<z.ZodString>;
2662
+ }, z.core.$strip>>;
2663
+ position: z.ZodOptional<z.ZodObject<{
2664
+ lat: z.ZodNumber;
2665
+ lng: z.ZodNumber;
2666
+ }, z.core.$strip>>;
2667
+ hours: z.ZodDefault<z.ZodArray<z.ZodObject<{
2668
+ days: z.ZodArray<z.ZodEnum<{
2669
+ Monday: "Monday";
2670
+ Tuesday: "Tuesday";
2671
+ Wednesday: "Wednesday";
2672
+ Thursday: "Thursday";
2673
+ Friday: "Friday";
2674
+ Saturday: "Saturday";
2675
+ Sunday: "Sunday";
2676
+ }>>;
2677
+ opens: z.ZodString;
2678
+ closes: z.ZodString;
2679
+ }, z.core.$strip>>>;
2680
+ priceRange: z.ZodOptional<z.ZodString>;
2681
+ checkinTime: z.ZodOptional<z.ZodString>;
2682
+ checkoutTime: z.ZodOptional<z.ZodString>;
2683
+ }, z.core.$strip>>;
2632
2684
  }, z.core.$strip>>;
2633
2685
  analytics: z.ZodDefault<z.ZodObject<{
2634
2686
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -2637,6 +2689,25 @@ declare const siteSettingsSchema: z.ZodObject<{
2637
2689
  type SiteSettings = z.infer<typeof siteSettingsSchema>;
2638
2690
  declare function parseSiteSettings(input: unknown): SiteSettings;
2639
2691
 
2692
+ /**
2693
+ * The schema.org types Hearth describes sites and their content with, for search engines and AI. Additive changes
2694
+ * only: sites store these names.
2695
+ */
2696
+ /** What kind of organization a site is (Settings → Search & sharing). */
2697
+ declare const ORGANIZATION_TYPES: readonly ["Organization", "LocalBusiness", "NGO", "Corporation", "EducationalOrganization", "GovernmentOrganization", "MedicalOrganization", "SportsOrganization", "Hotel", "BedAndBreakfast", "LodgingBusiness", "Restaurant", "CafeOrCoffeeShop", "BarOrPub", "Store", "ProfessionalService", "LegalService", "AccountingService", "FinancialService", "RealEstateAgent", "HomeAndConstructionBusiness", "AutomotiveBusiness", "HealthAndBeautyBusiness", "MedicalClinic", "Dentist", "ChildCare", "SportsActivityLocation", "EntertainmentBusiness", "TouristAttraction", "Museum", "Church", "School"];
2698
+ type OrganizationType = (typeof ORGANIZATION_TYPES)[number];
2699
+ /** Types that are a place people visit, so opening hours, a map position and a price range apply. */
2700
+ declare const PLACE_TYPES: readonly OrganizationType[];
2701
+ /** Places to stay: these also get check-in and check-out times. */
2702
+ declare const LODGING_TYPES: readonly OrganizationType[];
2703
+ declare const DAYS_OF_WEEK: readonly ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
2704
+ /**
2705
+ * What a page collection's entries are, for search engines: articles (the default), or rooms, services, people or
2706
+ * plain pages. Event collections' entries are always events.
2707
+ */
2708
+ declare const COLLECTION_SCHEMA_TYPES: readonly ["BlogPosting", "NewsArticle", "Article", "Service", "HotelRoom", "Person", "WebPage"];
2709
+ type CollectionSchemaType = (typeof COLLECTION_SCHEMA_TYPES)[number];
2710
+
2640
2711
  /**
2641
2712
  * A way to register for an event (sites with the Tickets feature), e.g. "Foursome · $500 · 4 golfers" or a free
2642
2713
  * "RSVP". Stored on the event; each registration keeps a snapshot of the ticket's name and price.
@@ -2922,6 +2993,8 @@ type Collection = CollectionRef & {
2922
2993
  /** The collection's own address, e.g. "/blog". */
2923
2994
  path: string;
2924
2995
  sort: "newest" | "oldest" | "title";
2996
+ /** What a page collection's entries are for search engines (BlogPosting, HotelRoom…). Missing from older Hearth versions. */
2997
+ schemaType?: CollectionSchemaType;
2925
2998
  };
2926
2999
  /** One page in a page collection, as listed (the full page comes from pages.get with its path). */
2927
3000
  type CollectionEntry = {
@@ -3179,4 +3252,4 @@ type ApiErrorBody = {
3179
3252
  };
3180
3253
  };
3181
3254
 
3182
- export { type AnalyticsReport, type AnalyticsRow, type ApiErrorBody, BLOCK_SCHEMA_VERSION, type Block, type BlockData, type BlockOf, type BlockType, type CategoryGroup, type CategoryRef, type Collection, type CollectionEntry, type CollectionRef, type CustomBlockDefinition, type CustomField, type CustomFieldKind, type DonationCheckout, type DonationInput, EMBED_ALLOW, EMBED_SANDBOX, type EntryDetails, type EventCustomFields, type EventRegistration, type EventTicket, type EventVolunteerShift, type EventVolunteering, type FormDefinition, type FormField, type Fundraiser, type FundraiserDetail, type HearthEvent, type HearthEventDetail, type HearthForm, type ImageRef, type KnownBlock, type LinkRef, ORGANIZATION_TYPES, type Page, type PageContent, type PageMeta, type PageSummary, type Position, type Redirect, type RegistrationInput, type RegistrationResult, type ResolvedBlock, SITE_LOCALES, SOCIAL_PLATFORMS, type Seo, type Site, type SiteAnalytics, type SiteSettings, type SitemapEntry, type TicketType, type UnknownBlock, VOLUNTEER_RESERVED_KEYS, type VolunteerForm, type VolunteerInput, type VolunteerResult, type VolunteerShift, type WebhookPayload, blockDataSchemas, blockFeature, blockSchema, blockTypes, customBlockDefinitionSchema, customBlockKey, customFieldSchema, customValuesSchema, directionsUrl, embedDocument, focalPosition, formDefinitionSchema, formFieldSchema, pageContentSchema, parseBlocks, parsePageContent, parseSiteSettings, parseTicketTypes, parseVolunteerForm, parseVolunteerShifts, pinned, seoSchema, siteSettingsSchema, ticketTypeSchema, ticketTypesSchema, videoEmbedUrl, volunteerFormSchema, volunteerShiftSchema, volunteerShiftsSchema };
3255
+ export { type AnalyticsReport, type AnalyticsRow, type ApiErrorBody, BLOCK_SCHEMA_VERSION, type Block, type BlockData, type BlockOf, type BlockType, COLLECTION_SCHEMA_TYPES, type CategoryGroup, type CategoryRef, type Collection, type CollectionEntry, type CollectionRef, type CollectionSchemaType, type CustomBlockDefinition, type CustomField, type CustomFieldKind, DAYS_OF_WEEK, type DonationCheckout, type DonationInput, EMBED_ALLOW, EMBED_SANDBOX, type EntryDetails, type EventCustomFields, type EventRegistration, type EventTicket, type EventVolunteerShift, type EventVolunteering, type FormDefinition, type FormField, type Fundraiser, type FundraiserDetail, type HearthEvent, type HearthEventDetail, type HearthForm, type ImageRef, type KnownBlock, LODGING_TYPES, type LinkRef, ORGANIZATION_TYPES, type OrganizationType, PLACE_TYPES, type Page, type PageContent, type PageMeta, type PageSummary, type Position, type Redirect, type RegistrationInput, type RegistrationResult, type ResolvedBlock, SITE_LOCALES, SOCIAL_PLATFORMS, type Seo, type Site, type SiteAnalytics, type SiteSettings, type SitemapEntry, type TicketType, type UnknownBlock, VOLUNTEER_RESERVED_KEYS, type VolunteerForm, type VolunteerInput, type VolunteerResult, type VolunteerShift, type WebhookPayload, blockDataSchemas, blockFeature, blockSchema, blockTypes, customBlockDefinitionSchema, customBlockKey, customFieldSchema, customValuesSchema, directionsUrl, embedDocument, focalPosition, formDefinitionSchema, formFieldSchema, pageContentSchema, parseBlocks, parsePageContent, parseSiteSettings, parseTicketTypes, parseVolunteerForm, parseVolunteerShifts, pinned, seoSchema, siteSettingsSchema, ticketTypeSchema, ticketTypesSchema, videoEmbedUrl, volunteerFormSchema, volunteerShiftSchema, volunteerShiftsSchema };
package/dist/index.js CHANGED
@@ -566,8 +566,76 @@ function pinned(places) {
566
566
 
567
567
  // src/site-settings.ts
568
568
  import { z as z2 } from "zod";
569
+
570
+ // src/structured-data.ts
571
+ var ORGANIZATION_TYPES = [
572
+ "Organization",
573
+ "LocalBusiness",
574
+ "NGO",
575
+ "Corporation",
576
+ "EducationalOrganization",
577
+ "GovernmentOrganization",
578
+ "MedicalOrganization",
579
+ "SportsOrganization",
580
+ // Places people visit: these also get the address, map position, opening hours and price range.
581
+ "Hotel",
582
+ "BedAndBreakfast",
583
+ "LodgingBusiness",
584
+ "Restaurant",
585
+ "CafeOrCoffeeShop",
586
+ "BarOrPub",
587
+ "Store",
588
+ "ProfessionalService",
589
+ "LegalService",
590
+ "AccountingService",
591
+ "FinancialService",
592
+ "RealEstateAgent",
593
+ "HomeAndConstructionBusiness",
594
+ "AutomotiveBusiness",
595
+ "HealthAndBeautyBusiness",
596
+ "MedicalClinic",
597
+ "Dentist",
598
+ "ChildCare",
599
+ "SportsActivityLocation",
600
+ "EntertainmentBusiness",
601
+ "TouristAttraction",
602
+ "Museum",
603
+ "Church",
604
+ "School"
605
+ ];
606
+ var PLACE_TYPES = [
607
+ "LocalBusiness",
608
+ "Hotel",
609
+ "BedAndBreakfast",
610
+ "LodgingBusiness",
611
+ "Restaurant",
612
+ "CafeOrCoffeeShop",
613
+ "BarOrPub",
614
+ "Store",
615
+ "ProfessionalService",
616
+ "LegalService",
617
+ "AccountingService",
618
+ "FinancialService",
619
+ "RealEstateAgent",
620
+ "HomeAndConstructionBusiness",
621
+ "AutomotiveBusiness",
622
+ "HealthAndBeautyBusiness",
623
+ "MedicalClinic",
624
+ "Dentist",
625
+ "ChildCare",
626
+ "SportsActivityLocation",
627
+ "EntertainmentBusiness",
628
+ "TouristAttraction",
629
+ "Museum",
630
+ "Church"
631
+ ];
632
+ var LODGING_TYPES = ["Hotel", "BedAndBreakfast", "LodgingBusiness"];
633
+ var DAYS_OF_WEEK = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
634
+ var COLLECTION_SCHEMA_TYPES = ["BlogPosting", "NewsArticle", "Article", "Service", "HotelRoom", "Person", "WebPage"];
635
+
636
+ // src/site-settings.ts
637
+ var time = z2.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "Use 24-hour time like 09:00 or 17:30.");
569
638
  var link2 = z2.object({ label: z2.string().trim().min(1, "Add link text."), href: z2.string().trim().min(1, "Add where it goes.") });
570
- var ORGANIZATION_TYPES = ["Organization", "LocalBusiness", "NGO", "Corporation", "EducationalOrganization", "GovernmentOrganization", "MedicalOrganization", "SportsOrganization"];
571
639
  var SITE_LOCALES = ["en_US", "en_GB", "en_CA", "en_AU", "es_US", "es_ES", "es_MX", "fr_CA", "fr_FR", "de_DE", "pt_BR"];
572
640
  var SOCIAL_PLATFORMS = ["facebook", "instagram", "linkedin", "x", "youtube", "tiktok", "other"];
573
641
  var siteSettingsSchema = z2.object({
@@ -652,8 +720,32 @@ var siteSettingsSchema = z2.object({
652
720
  verification: z2.object({
653
721
  google: z2.string().trim().max(120).regex(/^[A-Za-z0-9_-]*$/, `Paste only the code from the tag's content="\u2026".`).optional(),
654
722
  bing: z2.string().trim().max(120).regex(/^[A-Za-z0-9_-]*$/, `Paste only the code from the tag's content="\u2026".`).optional()
655
- }).default({})
656
- }).default({ organizationType: "Organization", locale: "en_US", verification: {} }),
723
+ }).default({}),
724
+ /**
725
+ * The business as search engines and AI answers describe it: the address in parts (the contact address is
726
+ * free text, as the design shows it), its map pin, opening hours, price range and, for places to stay,
727
+ * check-in and check-out times. Pin, hours and price apply to places people visit (PLACE_TYPES).
728
+ */
729
+ business: z2.object({
730
+ address: z2.object({
731
+ street: z2.string().trim().max(200).optional(),
732
+ city: z2.string().trim().max(100).optional(),
733
+ /** State, province or county, e.g. NH. */
734
+ region: z2.string().trim().max(100).optional(),
735
+ postalCode: z2.string().trim().max(20).optional(),
736
+ /** Two-letter country code, e.g. US. */
737
+ country: z2.string().trim().regex(/^[A-Za-z]{2}$/, "Use the two-letter country code, e.g. US.").optional()
738
+ }).default({}),
739
+ /** Its map pin, like a Location block's: found from the address, then adjusted. */
740
+ position: z2.object({ lat: z2.number().min(-90).max(90), lng: z2.number().min(-180).max(180) }).optional(),
741
+ /** Opening hours: each row is some days with the same hours. Days not listed are closed. */
742
+ hours: z2.array(z2.object({ days: z2.array(z2.enum(DAYS_OF_WEEK)).min(1, "Pick at least one day."), opens: time, closes: time })).max(14).default([]),
743
+ /** E.g. $$ or $120–$250. */
744
+ priceRange: z2.string().trim().max(40).optional(),
745
+ checkinTime: time.optional(),
746
+ checkoutTime: time.optional()
747
+ }).default({ address: {}, hours: [] })
748
+ }).default({ organizationType: "Organization", locale: "en_US", verification: {}, business: { address: {}, hours: [] } }),
657
749
  /** Built-in visitor analytics (cookieless; included in every plan). On unless the site turns it off. */
658
750
  analytics: z2.object({ enabled: z2.boolean().default(true) }).default({ enabled: true })
659
751
  });
@@ -737,9 +829,13 @@ function parseVolunteerForm(input) {
737
829
  }
738
830
  export {
739
831
  BLOCK_SCHEMA_VERSION,
832
+ COLLECTION_SCHEMA_TYPES,
833
+ DAYS_OF_WEEK,
740
834
  EMBED_ALLOW,
741
835
  EMBED_SANDBOX,
836
+ LODGING_TYPES,
742
837
  ORGANIZATION_TYPES,
838
+ PLACE_TYPES,
743
839
  SITE_LOCALES,
744
840
  SOCIAL_PLATFORMS,
745
841
  VOLUNTEER_RESERVED_KEYS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-smithy/hearth-schema",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "Content schemas and API types shared by Hearth and its SDK.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",