schemaorg-kit 1.2.0 → 1.3.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.mts +2893 -1281
- package/dist/index.d.ts +2893 -1281
- package/dist/index.js +110 -50
- package/dist/index.mjs +110 -50
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -294,8 +294,9 @@ var ThingSchema = import_zod4.z.object({
|
|
|
294
294
|
sameAs: import_zod4.z.union([import_zod4.z.url(), import_zod4.z.array(import_zod4.z.url())]).optional(),
|
|
295
295
|
alternateName: import_zod4.z.string().optional(),
|
|
296
296
|
// Relationships (loose refs to avoid circular type inference)
|
|
297
|
-
|
|
298
|
-
|
|
297
|
+
// All accept { "@id": "..." } for @graph cross-referencing
|
|
298
|
+
subjectOf: import_zod4.z.union([import_zod4.z.object({ "@id": import_zod4.z.string() }), AnyThingRef]).optional(),
|
|
299
|
+
mainEntityOfPage: import_zod4.z.union([import_zod4.z.url(), import_zod4.z.object({ "@id": import_zod4.z.string() }), AnyThingRef]).optional()
|
|
299
300
|
});
|
|
300
301
|
function extendThing(type, shape) {
|
|
301
302
|
return ThingSchema.extend({
|
|
@@ -555,7 +556,10 @@ var OfferSchema = import_zod12.z.object({
|
|
|
555
556
|
validThrough: import_zod12.z.string().optional(),
|
|
556
557
|
// ISO 8601
|
|
557
558
|
url: import_zod12.z.url().optional(),
|
|
558
|
-
seller: import_zod12.z.
|
|
559
|
+
seller: import_zod12.z.union([
|
|
560
|
+
import_zod12.z.object({ "@id": import_zod12.z.string() }),
|
|
561
|
+
import_zod12.z.object({ "@type": import_zod12.z.string(), name: import_zod12.z.string() })
|
|
562
|
+
]).optional(),
|
|
559
563
|
category: import_zod12.z.string().optional(),
|
|
560
564
|
inventoryLevel: import_zod12.z.object({
|
|
561
565
|
"@type": import_zod12.z.literal("QuantitativeValue").default("QuantitativeValue"),
|
|
@@ -568,7 +572,10 @@ var OfferSchema = import_zod12.z.object({
|
|
|
568
572
|
import_zod12.z.array(UnitPriceSpecificationSchema)
|
|
569
573
|
]).optional(),
|
|
570
574
|
shippingDetails: import_zod12.z.union([OfferShippingDetailsSchema, import_zod12.z.array(OfferShippingDetailsSchema)]).optional(),
|
|
571
|
-
hasMerchantReturnPolicy: import_zod12.z.
|
|
575
|
+
hasMerchantReturnPolicy: import_zod12.z.union([
|
|
576
|
+
import_zod12.z.object({ "@id": import_zod12.z.string() }),
|
|
577
|
+
import_zod12.z.lazy(() => import_zod12.z.object({ "@type": import_zod12.z.string() }).catchall(import_zod12.z.unknown()))
|
|
578
|
+
]).optional()
|
|
572
579
|
});
|
|
573
580
|
var MerchantReturnPolicySchema = import_zod12.z.object({
|
|
574
581
|
"@type": import_zod12.z.literal("MerchantReturnPolicy").default("MerchantReturnPolicy"),
|
|
@@ -747,8 +754,9 @@ var OrganizationSchema = extendThing("Organization", {
|
|
|
747
754
|
interactionStatistic: import_zod15.z.union([InteractionCounterSchema, import_zod15.z.array(InteractionCounterSchema)]).optional(),
|
|
748
755
|
agentInteractionStatistic: import_zod15.z.union([InteractionCounterSchema, import_zod15.z.array(InteractionCounterSchema)]).optional(),
|
|
749
756
|
// Hierarchical organization (loose refs to avoid circular type inference):
|
|
750
|
-
|
|
751
|
-
|
|
757
|
+
// Accept { "@id": "..." } for @graph cross-referencing
|
|
758
|
+
subOrganization: import_zod15.z.union([import_zod15.z.object({ "@id": import_zod15.z.string() }), NestedOrgRef]).optional(),
|
|
759
|
+
parentOrganization: import_zod15.z.union([import_zod15.z.object({ "@id": import_zod15.z.string() }), NestedOrgRef]).optional(),
|
|
752
760
|
sameAs: import_zod15.z.union([import_zod15.z.url(), import_zod15.z.array(import_zod15.z.url())]).optional()
|
|
753
761
|
});
|
|
754
762
|
var createOrganization = makeFactory(OrganizationSchema);
|
|
@@ -801,7 +809,10 @@ var ReviewSchema = import_zod16.z.object({
|
|
|
801
809
|
// ISO 8601 date
|
|
802
810
|
publisher: PersonOrOrgRef.optional(),
|
|
803
811
|
// itemReviewed: any Thing — kept loose to avoid circular imports
|
|
804
|
-
itemReviewed: import_zod16.z.
|
|
812
|
+
itemReviewed: import_zod16.z.union([
|
|
813
|
+
import_zod16.z.object({ "@id": import_zod16.z.string() }),
|
|
814
|
+
import_zod16.z.lazy(() => import_zod16.z.object({ "@type": import_zod16.z.string() }).catchall(import_zod16.z.unknown()))
|
|
815
|
+
]).optional(),
|
|
805
816
|
name: import_zod16.z.string().optional(),
|
|
806
817
|
// Review headline
|
|
807
818
|
url: import_zod16.z.url().optional(),
|
|
@@ -810,9 +821,12 @@ var ReviewSchema = import_zod16.z.object({
|
|
|
810
821
|
});
|
|
811
822
|
var EmployerAggregateRatingSchema = AggregateRatingSchema.extend({
|
|
812
823
|
"@type": import_zod16.z.literal("EmployerAggregateRating").default("EmployerAggregateRating"),
|
|
813
|
-
itemReviewed: import_zod16.z.
|
|
814
|
-
|
|
815
|
-
|
|
824
|
+
itemReviewed: import_zod16.z.union([
|
|
825
|
+
import_zod16.z.object({ "@id": import_zod16.z.string() }),
|
|
826
|
+
import_zod16.z.lazy(
|
|
827
|
+
() => import_zod16.z.object({ "@type": import_zod16.z.string(), name: import_zod16.z.string() }).catchall(import_zod16.z.unknown())
|
|
828
|
+
)
|
|
829
|
+
]).optional()
|
|
816
830
|
});
|
|
817
831
|
|
|
818
832
|
// src/types/things/Product.ts
|
|
@@ -1026,6 +1040,7 @@ var EventAttendanceMode = import_zod19.z.enum([
|
|
|
1026
1040
|
]).transform((v) => `https://schema.org/${v}`);
|
|
1027
1041
|
var PlaceRef = import_zod19.z.union([
|
|
1028
1042
|
import_zod19.z.string(),
|
|
1043
|
+
import_zod19.z.object({ "@id": import_zod19.z.string() }),
|
|
1029
1044
|
import_zod19.z.object({
|
|
1030
1045
|
"@type": import_zod19.z.literal("Place").default("Place"),
|
|
1031
1046
|
name: import_zod19.z.string().optional(),
|
|
@@ -1058,11 +1073,17 @@ var EventSchema = extendThing("Event", {
|
|
|
1058
1073
|
previousStartDate: import_zod19.z.string().optional(),
|
|
1059
1074
|
// ISO 8601 — for rescheduled events
|
|
1060
1075
|
aggregateRating: AggregateRatingSchema.optional(),
|
|
1061
|
-
// Sub-events:
|
|
1076
|
+
// Sub-events (accept @id refs for @graph cross-referencing):
|
|
1062
1077
|
subEvent: import_zod19.z.lazy(
|
|
1063
|
-
() => import_zod19.z.array(import_zod19.z.
|
|
1078
|
+
() => import_zod19.z.array(import_zod19.z.union([
|
|
1079
|
+
import_zod19.z.object({ "@id": import_zod19.z.string() }),
|
|
1080
|
+
import_zod19.z.object({ "@type": import_zod19.z.string() }).catchall(import_zod19.z.unknown())
|
|
1081
|
+
]))
|
|
1064
1082
|
).optional(),
|
|
1065
|
-
superEvent: import_zod19.z.
|
|
1083
|
+
superEvent: import_zod19.z.union([
|
|
1084
|
+
import_zod19.z.object({ "@id": import_zod19.z.string() }),
|
|
1085
|
+
import_zod19.z.lazy(() => import_zod19.z.object({ "@type": import_zod19.z.string() }).catchall(import_zod19.z.unknown()))
|
|
1086
|
+
]).optional(),
|
|
1066
1087
|
// Additional:
|
|
1067
1088
|
inLanguage: import_zod19.z.union([
|
|
1068
1089
|
import_zod19.z.string(),
|
|
@@ -1117,9 +1138,12 @@ var PlaceSchema = extendThing("Place", {
|
|
|
1117
1138
|
value: import_zod21.z.union([import_zod21.z.boolean(), import_zod21.z.string(), import_zod21.z.number()])
|
|
1118
1139
|
})
|
|
1119
1140
|
).optional(),
|
|
1120
|
-
containedInPlace: import_zod21.z.
|
|
1121
|
-
|
|
1122
|
-
|
|
1141
|
+
containedInPlace: import_zod21.z.union([
|
|
1142
|
+
import_zod21.z.object({ "@id": import_zod21.z.string() }),
|
|
1143
|
+
import_zod21.z.lazy(
|
|
1144
|
+
() => import_zod21.z.object({ "@type": import_zod21.z.string(), name: import_zod21.z.string().optional() }).catchall(import_zod21.z.unknown())
|
|
1145
|
+
)
|
|
1146
|
+
]).optional()
|
|
1123
1147
|
});
|
|
1124
1148
|
var createPlace = makeFactory(PlaceSchema);
|
|
1125
1149
|
|
|
@@ -1170,11 +1194,15 @@ var LocalBusinessSchema = PlaceSchema.extend({
|
|
|
1170
1194
|
iso6523Code: import_zod22.z.string().optional(),
|
|
1171
1195
|
hasMerchantReturnPolicy: MerchantReturnPolicySchema.optional(),
|
|
1172
1196
|
sameAs: import_zod22.z.union([import_zod22.z.url(), import_zod22.z.array(import_zod22.z.url())]).optional(),
|
|
1173
|
-
// Departments (nested LocalBusiness):
|
|
1197
|
+
// Departments (nested LocalBusiness — accept @id refs for @graph cross-referencing):
|
|
1174
1198
|
department: import_zod22.z.lazy(
|
|
1175
1199
|
() => import_zod22.z.union([
|
|
1200
|
+
import_zod22.z.object({ "@id": import_zod22.z.string() }),
|
|
1176
1201
|
import_zod22.z.object({ "@type": import_zod22.z.string() }).catchall(import_zod22.z.unknown()),
|
|
1177
|
-
import_zod22.z.array(import_zod22.z.
|
|
1202
|
+
import_zod22.z.array(import_zod22.z.union([
|
|
1203
|
+
import_zod22.z.object({ "@id": import_zod22.z.string() }),
|
|
1204
|
+
import_zod22.z.object({ "@type": import_zod22.z.string() }).catchall(import_zod22.z.unknown())
|
|
1205
|
+
]))
|
|
1178
1206
|
])
|
|
1179
1207
|
).optional(),
|
|
1180
1208
|
// Opening hours in string format (alternative to openingHoursSpecification):
|
|
@@ -1314,12 +1342,15 @@ var BookSchema = import_zod24.z.object({
|
|
|
1314
1342
|
sameAs: import_zod24.z.union([import_zod24.z.string(), import_zod24.z.array(import_zod24.z.string())]).optional(),
|
|
1315
1343
|
/** Specific editions — each may have ReadAction / BorrowAction */
|
|
1316
1344
|
workExample: import_zod24.z.union([BookEditionSchema, import_zod24.z.array(BookEditionSchema)]).optional(),
|
|
1317
|
-
/** Publisher of the primary edition */
|
|
1318
|
-
publisher: import_zod24.z.
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1345
|
+
/** Publisher of the primary edition (accept @id refs for @graph cross-referencing) */
|
|
1346
|
+
publisher: import_zod24.z.union([
|
|
1347
|
+
import_zod24.z.object({ "@id": import_zod24.z.string() }),
|
|
1348
|
+
import_zod24.z.object({
|
|
1349
|
+
"@type": import_zod24.z.union([import_zod24.z.literal("Organization"), import_zod24.z.literal("Person")]),
|
|
1350
|
+
name: import_zod24.z.string(),
|
|
1351
|
+
url: import_zod24.z.url().optional()
|
|
1352
|
+
})
|
|
1353
|
+
]).optional(),
|
|
1323
1354
|
/** Number of pages */
|
|
1324
1355
|
numberOfPages: import_zod24.z.number().int().positive().optional(),
|
|
1325
1356
|
/** Original publication year */
|
|
@@ -1329,7 +1360,10 @@ var BookSchema = import_zod24.z.object({
|
|
|
1329
1360
|
/** BCP 47 language tag */
|
|
1330
1361
|
inLanguage: import_zod24.z.string().optional(),
|
|
1331
1362
|
/** Aggregate rating across editions */
|
|
1332
|
-
aggregateRating: import_zod24.z.
|
|
1363
|
+
aggregateRating: import_zod24.z.union([
|
|
1364
|
+
import_zod24.z.object({ "@id": import_zod24.z.string() }),
|
|
1365
|
+
import_zod24.z.lazy(() => import_zod24.z.object({ "@type": import_zod24.z.string() }).catchall(import_zod24.z.unknown()))
|
|
1366
|
+
]).optional()
|
|
1333
1367
|
});
|
|
1334
1368
|
var createBook = makeFactory(BookSchema);
|
|
1335
1369
|
|
|
@@ -1368,11 +1402,14 @@ var CreativeWorkSchema = extendThing("CreativeWork", {
|
|
|
1368
1402
|
cssSelector: import_zod25.z.string().optional()
|
|
1369
1403
|
})
|
|
1370
1404
|
).optional(),
|
|
1371
|
-
// For subscription / paywalled content
|
|
1372
|
-
isPartOf: import_zod25.z.
|
|
1373
|
-
"@
|
|
1374
|
-
|
|
1375
|
-
|
|
1405
|
+
// For subscription / paywalled content (accept @id refs for @graph cross-referencing)
|
|
1406
|
+
isPartOf: import_zod25.z.union([
|
|
1407
|
+
import_zod25.z.object({ "@id": import_zod25.z.string() }),
|
|
1408
|
+
import_zod25.z.object({
|
|
1409
|
+
"@type": import_zod25.z.string(),
|
|
1410
|
+
name: import_zod25.z.string().optional()
|
|
1411
|
+
})
|
|
1412
|
+
]).optional(),
|
|
1376
1413
|
text: import_zod25.z.string().optional(),
|
|
1377
1414
|
abstract: import_zod25.z.string().optional(),
|
|
1378
1415
|
encodingFormat: import_zod25.z.string().optional(),
|
|
@@ -1408,9 +1445,10 @@ var NewsArticleSchema = ArticleSchema.extend({
|
|
|
1408
1445
|
});
|
|
1409
1446
|
var BlogPostingSchema = ArticleSchema.extend({
|
|
1410
1447
|
"@type": import_zod26.z.literal("BlogPosting").default("BlogPosting"),
|
|
1411
|
-
sharedContent: import_zod26.z.
|
|
1412
|
-
|
|
1413
|
-
|
|
1448
|
+
sharedContent: import_zod26.z.union([
|
|
1449
|
+
import_zod26.z.object({ "@id": import_zod26.z.string() }),
|
|
1450
|
+
import_zod26.z.lazy(() => import_zod26.z.object({ "@type": import_zod26.z.string() }).catchall(import_zod26.z.unknown()))
|
|
1451
|
+
]).optional()
|
|
1414
1452
|
});
|
|
1415
1453
|
var createArticle = makeFactory(ArticleSchema);
|
|
1416
1454
|
var createNewsArticle = makeFactory(NewsArticleSchema);
|
|
@@ -1420,9 +1458,12 @@ var createBlogPosting = makeFactory(BlogPostingSchema);
|
|
|
1420
1458
|
var import_zod27 = require("zod");
|
|
1421
1459
|
var WebPageSchema = CreativeWorkSchema.extend({
|
|
1422
1460
|
"@type": import_zod27.z.literal("WebPage").default("WebPage"),
|
|
1423
|
-
breadcrumb: import_zod27.z.
|
|
1424
|
-
|
|
1425
|
-
|
|
1461
|
+
breadcrumb: import_zod27.z.union([
|
|
1462
|
+
import_zod27.z.object({ "@id": import_zod27.z.string() }),
|
|
1463
|
+
import_zod27.z.lazy(
|
|
1464
|
+
() => import_zod27.z.object({ "@type": import_zod27.z.literal("BreadcrumbList") }).catchall(import_zod27.z.unknown())
|
|
1465
|
+
)
|
|
1466
|
+
]).optional(),
|
|
1426
1467
|
lastReviewed: import_zod27.z.string().optional(),
|
|
1427
1468
|
reviewedBy: PersonOrOrgRef.optional(),
|
|
1428
1469
|
speakable: import_zod27.z.object({
|
|
@@ -1431,8 +1472,14 @@ var WebPageSchema = CreativeWorkSchema.extend({
|
|
|
1431
1472
|
xpath: import_zod27.z.union([import_zod27.z.string(), import_zod27.z.array(import_zod27.z.string())]).optional()
|
|
1432
1473
|
}).optional(),
|
|
1433
1474
|
significantLink: import_zod27.z.union([import_zod27.z.url(), import_zod27.z.array(import_zod27.z.url())]).optional(),
|
|
1434
|
-
mainContentOfPage: import_zod27.z.
|
|
1435
|
-
|
|
1475
|
+
mainContentOfPage: import_zod27.z.union([
|
|
1476
|
+
import_zod27.z.object({ "@id": import_zod27.z.string() }),
|
|
1477
|
+
import_zod27.z.object({ "@type": import_zod27.z.string() }).catchall(import_zod27.z.unknown())
|
|
1478
|
+
]).optional(),
|
|
1479
|
+
primaryImageOfPage: import_zod27.z.union([
|
|
1480
|
+
import_zod27.z.object({ "@id": import_zod27.z.string() }),
|
|
1481
|
+
import_zod27.z.object({ "@type": import_zod27.z.string() }).catchall(import_zod27.z.unknown())
|
|
1482
|
+
]).optional(),
|
|
1436
1483
|
relatedLink: import_zod27.z.union([import_zod27.z.url(), import_zod27.z.array(import_zod27.z.url())]).optional()
|
|
1437
1484
|
});
|
|
1438
1485
|
var createWebPage = makeFactory(WebPageSchema);
|
|
@@ -1467,8 +1514,11 @@ var WebSiteSchema = CreativeWorkSchema.extend({
|
|
|
1467
1514
|
publisher: PersonOrOrgRef.optional(),
|
|
1468
1515
|
// Site-level metadata
|
|
1469
1516
|
copyrightYear: import_zod28.z.number().int().optional(),
|
|
1470
|
-
// isPartOf — rarely used for WebSite itself but allowed
|
|
1471
|
-
isPartOf: import_zod28.z.
|
|
1517
|
+
// isPartOf — rarely used for WebSite itself but allowed (accept @id refs for @graph)
|
|
1518
|
+
isPartOf: import_zod28.z.union([
|
|
1519
|
+
import_zod28.z.object({ "@id": import_zod28.z.string() }),
|
|
1520
|
+
import_zod28.z.lazy(() => import_zod28.z.object({ "@type": import_zod28.z.string() }).catchall(import_zod28.z.unknown()))
|
|
1521
|
+
]).optional()
|
|
1472
1522
|
});
|
|
1473
1523
|
var createWebSite = makeFactory(WebSiteSchema);
|
|
1474
1524
|
|
|
@@ -1876,7 +1926,7 @@ var JobPostingSchema = import_zod37.z.object({
|
|
|
1876
1926
|
// Required by Google:
|
|
1877
1927
|
title: import_zod37.z.string(),
|
|
1878
1928
|
description: import_zod37.z.string(),
|
|
1879
|
-
hiringOrganization: HiringOrgRef,
|
|
1929
|
+
hiringOrganization: import_zod37.z.union([import_zod37.z.object({ "@id": import_zod37.z.string() }), HiringOrgRef]),
|
|
1880
1930
|
jobLocation: import_zod37.z.union([JobLocationRef, import_zod37.z.array(JobLocationRef)]).optional(),
|
|
1881
1931
|
datePosted: import_zod37.z.string(),
|
|
1882
1932
|
// ISO 8601 date
|
|
@@ -1990,7 +2040,10 @@ var QuizSchema = CreativeWorkSchema.extend({
|
|
|
1990
2040
|
"@type": import_zod38.z.literal("Quiz").default("Quiz"),
|
|
1991
2041
|
name: import_zod38.z.string().optional(),
|
|
1992
2042
|
educationalLevel: import_zod38.z.string().optional(),
|
|
1993
|
-
about: import_zod38.z.
|
|
2043
|
+
about: import_zod38.z.union([
|
|
2044
|
+
import_zod38.z.object({ "@id": import_zod38.z.string() }),
|
|
2045
|
+
import_zod38.z.lazy(() => import_zod38.z.object({ "@type": import_zod38.z.string() }).catchall(import_zod38.z.unknown()))
|
|
2046
|
+
]).optional(),
|
|
1994
2047
|
hasPart: import_zod38.z.array(QuestionSchema).optional(),
|
|
1995
2048
|
educationalAlignment: import_zod38.z.union([AlignmentObjectSchema, import_zod38.z.array(AlignmentObjectSchema)]).optional()
|
|
1996
2049
|
});
|
|
@@ -2030,9 +2083,12 @@ var DiscussionForumPostingSchema = CreativeWorkSchema.extend({
|
|
|
2030
2083
|
image: ImageOrUrl.optional(),
|
|
2031
2084
|
/** "published", "draft", "deleted" — or a schema.org enum URL */
|
|
2032
2085
|
creativeWorkStatus: import_zod39.z.string().optional(),
|
|
2033
|
-
mainEntityOfPage: import_zod39.z.union([import_zod39.z.url(), import_zod39.z.object({}).catchall(import_zod39.z.unknown())]).optional(),
|
|
2034
|
-
// For reposts:
|
|
2035
|
-
sharedContent: import_zod39.z.
|
|
2086
|
+
mainEntityOfPage: import_zod39.z.union([import_zod39.z.url(), import_zod39.z.object({ "@id": import_zod39.z.string() }), import_zod39.z.object({}).catchall(import_zod39.z.unknown())]).optional(),
|
|
2087
|
+
// For reposts (accept @id refs for @graph cross-referencing):
|
|
2088
|
+
sharedContent: import_zod39.z.union([
|
|
2089
|
+
import_zod39.z.object({ "@id": import_zod39.z.string() }),
|
|
2090
|
+
import_zod39.z.lazy(() => import_zod39.z.object({ "@type": import_zod39.z.string() }).catchall(import_zod39.z.unknown()))
|
|
2091
|
+
]).optional(),
|
|
2036
2092
|
interactionStatistic: import_zod39.z.union([InteractionCounterSchema, import_zod39.z.array(InteractionCounterSchema)]).optional()
|
|
2037
2093
|
});
|
|
2038
2094
|
var createDiscussionForumPosting = makeFactory(
|
|
@@ -2069,13 +2125,17 @@ var createItemList = makeFactory(ItemListSchema);
|
|
|
2069
2125
|
var import_zod41 = require("zod");
|
|
2070
2126
|
var ProfilePageSchema = WebPageSchema.extend({
|
|
2071
2127
|
"@type": import_zod41.z.literal("ProfilePage").default("ProfilePage"),
|
|
2072
|
-
// mainEntity: the person or org this profile is about (
|
|
2073
|
-
mainEntity: import_zod41.z.
|
|
2074
|
-
|
|
2075
|
-
|
|
2128
|
+
// mainEntity: the person or org this profile is about (accept @id refs for @graph)
|
|
2129
|
+
mainEntity: import_zod41.z.union([
|
|
2130
|
+
import_zod41.z.object({ "@id": import_zod41.z.string() }),
|
|
2131
|
+
import_zod41.z.lazy(() => import_zod41.z.object({ "@type": import_zod41.z.string() }).catchall(import_zod41.z.unknown()))
|
|
2132
|
+
]).optional(),
|
|
2076
2133
|
// hasPart: content published by/about this profile subject
|
|
2077
2134
|
hasPart: import_zod41.z.array(
|
|
2078
|
-
import_zod41.z.
|
|
2135
|
+
import_zod41.z.union([
|
|
2136
|
+
import_zod41.z.object({ "@id": import_zod41.z.string() }),
|
|
2137
|
+
import_zod41.z.lazy(() => import_zod41.z.object({ "@type": import_zod41.z.string() }).catchall(import_zod41.z.unknown()))
|
|
2138
|
+
])
|
|
2079
2139
|
).optional(),
|
|
2080
2140
|
dateCreated: import_zod41.z.string().optional(),
|
|
2081
2141
|
dateModified: import_zod41.z.string().optional()
|
package/dist/index.mjs
CHANGED
|
@@ -124,8 +124,9 @@ var ThingSchema = z4.object({
|
|
|
124
124
|
sameAs: z4.union([z4.url(), z4.array(z4.url())]).optional(),
|
|
125
125
|
alternateName: z4.string().optional(),
|
|
126
126
|
// Relationships (loose refs to avoid circular type inference)
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
// All accept { "@id": "..." } for @graph cross-referencing
|
|
128
|
+
subjectOf: z4.union([z4.object({ "@id": z4.string() }), AnyThingRef]).optional(),
|
|
129
|
+
mainEntityOfPage: z4.union([z4.url(), z4.object({ "@id": z4.string() }), AnyThingRef]).optional()
|
|
129
130
|
});
|
|
130
131
|
function extendThing(type, shape) {
|
|
131
132
|
return ThingSchema.extend({
|
|
@@ -385,7 +386,10 @@ var OfferSchema = z12.object({
|
|
|
385
386
|
validThrough: z12.string().optional(),
|
|
386
387
|
// ISO 8601
|
|
387
388
|
url: z12.url().optional(),
|
|
388
|
-
seller: z12.
|
|
389
|
+
seller: z12.union([
|
|
390
|
+
z12.object({ "@id": z12.string() }),
|
|
391
|
+
z12.object({ "@type": z12.string(), name: z12.string() })
|
|
392
|
+
]).optional(),
|
|
389
393
|
category: z12.string().optional(),
|
|
390
394
|
inventoryLevel: z12.object({
|
|
391
395
|
"@type": z12.literal("QuantitativeValue").default("QuantitativeValue"),
|
|
@@ -398,7 +402,10 @@ var OfferSchema = z12.object({
|
|
|
398
402
|
z12.array(UnitPriceSpecificationSchema)
|
|
399
403
|
]).optional(),
|
|
400
404
|
shippingDetails: z12.union([OfferShippingDetailsSchema, z12.array(OfferShippingDetailsSchema)]).optional(),
|
|
401
|
-
hasMerchantReturnPolicy: z12.
|
|
405
|
+
hasMerchantReturnPolicy: z12.union([
|
|
406
|
+
z12.object({ "@id": z12.string() }),
|
|
407
|
+
z12.lazy(() => z12.object({ "@type": z12.string() }).catchall(z12.unknown()))
|
|
408
|
+
]).optional()
|
|
402
409
|
});
|
|
403
410
|
var MerchantReturnPolicySchema = z12.object({
|
|
404
411
|
"@type": z12.literal("MerchantReturnPolicy").default("MerchantReturnPolicy"),
|
|
@@ -577,8 +584,9 @@ var OrganizationSchema = extendThing("Organization", {
|
|
|
577
584
|
interactionStatistic: z15.union([InteractionCounterSchema, z15.array(InteractionCounterSchema)]).optional(),
|
|
578
585
|
agentInteractionStatistic: z15.union([InteractionCounterSchema, z15.array(InteractionCounterSchema)]).optional(),
|
|
579
586
|
// Hierarchical organization (loose refs to avoid circular type inference):
|
|
580
|
-
|
|
581
|
-
|
|
587
|
+
// Accept { "@id": "..." } for @graph cross-referencing
|
|
588
|
+
subOrganization: z15.union([z15.object({ "@id": z15.string() }), NestedOrgRef]).optional(),
|
|
589
|
+
parentOrganization: z15.union([z15.object({ "@id": z15.string() }), NestedOrgRef]).optional(),
|
|
582
590
|
sameAs: z15.union([z15.url(), z15.array(z15.url())]).optional()
|
|
583
591
|
});
|
|
584
592
|
var createOrganization = makeFactory(OrganizationSchema);
|
|
@@ -631,7 +639,10 @@ var ReviewSchema = z16.object({
|
|
|
631
639
|
// ISO 8601 date
|
|
632
640
|
publisher: PersonOrOrgRef.optional(),
|
|
633
641
|
// itemReviewed: any Thing — kept loose to avoid circular imports
|
|
634
|
-
itemReviewed: z16.
|
|
642
|
+
itemReviewed: z16.union([
|
|
643
|
+
z16.object({ "@id": z16.string() }),
|
|
644
|
+
z16.lazy(() => z16.object({ "@type": z16.string() }).catchall(z16.unknown()))
|
|
645
|
+
]).optional(),
|
|
635
646
|
name: z16.string().optional(),
|
|
636
647
|
// Review headline
|
|
637
648
|
url: z16.url().optional(),
|
|
@@ -640,9 +651,12 @@ var ReviewSchema = z16.object({
|
|
|
640
651
|
});
|
|
641
652
|
var EmployerAggregateRatingSchema = AggregateRatingSchema.extend({
|
|
642
653
|
"@type": z16.literal("EmployerAggregateRating").default("EmployerAggregateRating"),
|
|
643
|
-
itemReviewed: z16.
|
|
644
|
-
|
|
645
|
-
|
|
654
|
+
itemReviewed: z16.union([
|
|
655
|
+
z16.object({ "@id": z16.string() }),
|
|
656
|
+
z16.lazy(
|
|
657
|
+
() => z16.object({ "@type": z16.string(), name: z16.string() }).catchall(z16.unknown())
|
|
658
|
+
)
|
|
659
|
+
]).optional()
|
|
646
660
|
});
|
|
647
661
|
|
|
648
662
|
// src/types/things/Product.ts
|
|
@@ -856,6 +870,7 @@ var EventAttendanceMode = z19.enum([
|
|
|
856
870
|
]).transform((v) => `https://schema.org/${v}`);
|
|
857
871
|
var PlaceRef = z19.union([
|
|
858
872
|
z19.string(),
|
|
873
|
+
z19.object({ "@id": z19.string() }),
|
|
859
874
|
z19.object({
|
|
860
875
|
"@type": z19.literal("Place").default("Place"),
|
|
861
876
|
name: z19.string().optional(),
|
|
@@ -888,11 +903,17 @@ var EventSchema = extendThing("Event", {
|
|
|
888
903
|
previousStartDate: z19.string().optional(),
|
|
889
904
|
// ISO 8601 — for rescheduled events
|
|
890
905
|
aggregateRating: AggregateRatingSchema.optional(),
|
|
891
|
-
// Sub-events:
|
|
906
|
+
// Sub-events (accept @id refs for @graph cross-referencing):
|
|
892
907
|
subEvent: z19.lazy(
|
|
893
|
-
() => z19.array(z19.
|
|
908
|
+
() => z19.array(z19.union([
|
|
909
|
+
z19.object({ "@id": z19.string() }),
|
|
910
|
+
z19.object({ "@type": z19.string() }).catchall(z19.unknown())
|
|
911
|
+
]))
|
|
894
912
|
).optional(),
|
|
895
|
-
superEvent: z19.
|
|
913
|
+
superEvent: z19.union([
|
|
914
|
+
z19.object({ "@id": z19.string() }),
|
|
915
|
+
z19.lazy(() => z19.object({ "@type": z19.string() }).catchall(z19.unknown()))
|
|
916
|
+
]).optional(),
|
|
896
917
|
// Additional:
|
|
897
918
|
inLanguage: z19.union([
|
|
898
919
|
z19.string(),
|
|
@@ -947,9 +968,12 @@ var PlaceSchema = extendThing("Place", {
|
|
|
947
968
|
value: z21.union([z21.boolean(), z21.string(), z21.number()])
|
|
948
969
|
})
|
|
949
970
|
).optional(),
|
|
950
|
-
containedInPlace: z21.
|
|
951
|
-
|
|
952
|
-
|
|
971
|
+
containedInPlace: z21.union([
|
|
972
|
+
z21.object({ "@id": z21.string() }),
|
|
973
|
+
z21.lazy(
|
|
974
|
+
() => z21.object({ "@type": z21.string(), name: z21.string().optional() }).catchall(z21.unknown())
|
|
975
|
+
)
|
|
976
|
+
]).optional()
|
|
953
977
|
});
|
|
954
978
|
var createPlace = makeFactory(PlaceSchema);
|
|
955
979
|
|
|
@@ -1000,11 +1024,15 @@ var LocalBusinessSchema = PlaceSchema.extend({
|
|
|
1000
1024
|
iso6523Code: z22.string().optional(),
|
|
1001
1025
|
hasMerchantReturnPolicy: MerchantReturnPolicySchema.optional(),
|
|
1002
1026
|
sameAs: z22.union([z22.url(), z22.array(z22.url())]).optional(),
|
|
1003
|
-
// Departments (nested LocalBusiness):
|
|
1027
|
+
// Departments (nested LocalBusiness — accept @id refs for @graph cross-referencing):
|
|
1004
1028
|
department: z22.lazy(
|
|
1005
1029
|
() => z22.union([
|
|
1030
|
+
z22.object({ "@id": z22.string() }),
|
|
1006
1031
|
z22.object({ "@type": z22.string() }).catchall(z22.unknown()),
|
|
1007
|
-
z22.array(z22.
|
|
1032
|
+
z22.array(z22.union([
|
|
1033
|
+
z22.object({ "@id": z22.string() }),
|
|
1034
|
+
z22.object({ "@type": z22.string() }).catchall(z22.unknown())
|
|
1035
|
+
]))
|
|
1008
1036
|
])
|
|
1009
1037
|
).optional(),
|
|
1010
1038
|
// Opening hours in string format (alternative to openingHoursSpecification):
|
|
@@ -1144,12 +1172,15 @@ var BookSchema = z24.object({
|
|
|
1144
1172
|
sameAs: z24.union([z24.string(), z24.array(z24.string())]).optional(),
|
|
1145
1173
|
/** Specific editions — each may have ReadAction / BorrowAction */
|
|
1146
1174
|
workExample: z24.union([BookEditionSchema, z24.array(BookEditionSchema)]).optional(),
|
|
1147
|
-
/** Publisher of the primary edition */
|
|
1148
|
-
publisher: z24.
|
|
1149
|
-
"@
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1175
|
+
/** Publisher of the primary edition (accept @id refs for @graph cross-referencing) */
|
|
1176
|
+
publisher: z24.union([
|
|
1177
|
+
z24.object({ "@id": z24.string() }),
|
|
1178
|
+
z24.object({
|
|
1179
|
+
"@type": z24.union([z24.literal("Organization"), z24.literal("Person")]),
|
|
1180
|
+
name: z24.string(),
|
|
1181
|
+
url: z24.url().optional()
|
|
1182
|
+
})
|
|
1183
|
+
]).optional(),
|
|
1153
1184
|
/** Number of pages */
|
|
1154
1185
|
numberOfPages: z24.number().int().positive().optional(),
|
|
1155
1186
|
/** Original publication year */
|
|
@@ -1159,7 +1190,10 @@ var BookSchema = z24.object({
|
|
|
1159
1190
|
/** BCP 47 language tag */
|
|
1160
1191
|
inLanguage: z24.string().optional(),
|
|
1161
1192
|
/** Aggregate rating across editions */
|
|
1162
|
-
aggregateRating: z24.
|
|
1193
|
+
aggregateRating: z24.union([
|
|
1194
|
+
z24.object({ "@id": z24.string() }),
|
|
1195
|
+
z24.lazy(() => z24.object({ "@type": z24.string() }).catchall(z24.unknown()))
|
|
1196
|
+
]).optional()
|
|
1163
1197
|
});
|
|
1164
1198
|
var createBook = makeFactory(BookSchema);
|
|
1165
1199
|
|
|
@@ -1198,11 +1232,14 @@ var CreativeWorkSchema = extendThing("CreativeWork", {
|
|
|
1198
1232
|
cssSelector: z25.string().optional()
|
|
1199
1233
|
})
|
|
1200
1234
|
).optional(),
|
|
1201
|
-
// For subscription / paywalled content
|
|
1202
|
-
isPartOf: z25.
|
|
1203
|
-
"@
|
|
1204
|
-
|
|
1205
|
-
|
|
1235
|
+
// For subscription / paywalled content (accept @id refs for @graph cross-referencing)
|
|
1236
|
+
isPartOf: z25.union([
|
|
1237
|
+
z25.object({ "@id": z25.string() }),
|
|
1238
|
+
z25.object({
|
|
1239
|
+
"@type": z25.string(),
|
|
1240
|
+
name: z25.string().optional()
|
|
1241
|
+
})
|
|
1242
|
+
]).optional(),
|
|
1206
1243
|
text: z25.string().optional(),
|
|
1207
1244
|
abstract: z25.string().optional(),
|
|
1208
1245
|
encodingFormat: z25.string().optional(),
|
|
@@ -1238,9 +1275,10 @@ var NewsArticleSchema = ArticleSchema.extend({
|
|
|
1238
1275
|
});
|
|
1239
1276
|
var BlogPostingSchema = ArticleSchema.extend({
|
|
1240
1277
|
"@type": z26.literal("BlogPosting").default("BlogPosting"),
|
|
1241
|
-
sharedContent: z26.
|
|
1242
|
-
|
|
1243
|
-
|
|
1278
|
+
sharedContent: z26.union([
|
|
1279
|
+
z26.object({ "@id": z26.string() }),
|
|
1280
|
+
z26.lazy(() => z26.object({ "@type": z26.string() }).catchall(z26.unknown()))
|
|
1281
|
+
]).optional()
|
|
1244
1282
|
});
|
|
1245
1283
|
var createArticle = makeFactory(ArticleSchema);
|
|
1246
1284
|
var createNewsArticle = makeFactory(NewsArticleSchema);
|
|
@@ -1250,9 +1288,12 @@ var createBlogPosting = makeFactory(BlogPostingSchema);
|
|
|
1250
1288
|
import { z as z27 } from "zod";
|
|
1251
1289
|
var WebPageSchema = CreativeWorkSchema.extend({
|
|
1252
1290
|
"@type": z27.literal("WebPage").default("WebPage"),
|
|
1253
|
-
breadcrumb: z27.
|
|
1254
|
-
|
|
1255
|
-
|
|
1291
|
+
breadcrumb: z27.union([
|
|
1292
|
+
z27.object({ "@id": z27.string() }),
|
|
1293
|
+
z27.lazy(
|
|
1294
|
+
() => z27.object({ "@type": z27.literal("BreadcrumbList") }).catchall(z27.unknown())
|
|
1295
|
+
)
|
|
1296
|
+
]).optional(),
|
|
1256
1297
|
lastReviewed: z27.string().optional(),
|
|
1257
1298
|
reviewedBy: PersonOrOrgRef.optional(),
|
|
1258
1299
|
speakable: z27.object({
|
|
@@ -1261,8 +1302,14 @@ var WebPageSchema = CreativeWorkSchema.extend({
|
|
|
1261
1302
|
xpath: z27.union([z27.string(), z27.array(z27.string())]).optional()
|
|
1262
1303
|
}).optional(),
|
|
1263
1304
|
significantLink: z27.union([z27.url(), z27.array(z27.url())]).optional(),
|
|
1264
|
-
mainContentOfPage: z27.
|
|
1265
|
-
|
|
1305
|
+
mainContentOfPage: z27.union([
|
|
1306
|
+
z27.object({ "@id": z27.string() }),
|
|
1307
|
+
z27.object({ "@type": z27.string() }).catchall(z27.unknown())
|
|
1308
|
+
]).optional(),
|
|
1309
|
+
primaryImageOfPage: z27.union([
|
|
1310
|
+
z27.object({ "@id": z27.string() }),
|
|
1311
|
+
z27.object({ "@type": z27.string() }).catchall(z27.unknown())
|
|
1312
|
+
]).optional(),
|
|
1266
1313
|
relatedLink: z27.union([z27.url(), z27.array(z27.url())]).optional()
|
|
1267
1314
|
});
|
|
1268
1315
|
var createWebPage = makeFactory(WebPageSchema);
|
|
@@ -1297,8 +1344,11 @@ var WebSiteSchema = CreativeWorkSchema.extend({
|
|
|
1297
1344
|
publisher: PersonOrOrgRef.optional(),
|
|
1298
1345
|
// Site-level metadata
|
|
1299
1346
|
copyrightYear: z28.number().int().optional(),
|
|
1300
|
-
// isPartOf — rarely used for WebSite itself but allowed
|
|
1301
|
-
isPartOf: z28.
|
|
1347
|
+
// isPartOf — rarely used for WebSite itself but allowed (accept @id refs for @graph)
|
|
1348
|
+
isPartOf: z28.union([
|
|
1349
|
+
z28.object({ "@id": z28.string() }),
|
|
1350
|
+
z28.lazy(() => z28.object({ "@type": z28.string() }).catchall(z28.unknown()))
|
|
1351
|
+
]).optional()
|
|
1302
1352
|
});
|
|
1303
1353
|
var createWebSite = makeFactory(WebSiteSchema);
|
|
1304
1354
|
|
|
@@ -1706,7 +1756,7 @@ var JobPostingSchema = z37.object({
|
|
|
1706
1756
|
// Required by Google:
|
|
1707
1757
|
title: z37.string(),
|
|
1708
1758
|
description: z37.string(),
|
|
1709
|
-
hiringOrganization: HiringOrgRef,
|
|
1759
|
+
hiringOrganization: z37.union([z37.object({ "@id": z37.string() }), HiringOrgRef]),
|
|
1710
1760
|
jobLocation: z37.union([JobLocationRef, z37.array(JobLocationRef)]).optional(),
|
|
1711
1761
|
datePosted: z37.string(),
|
|
1712
1762
|
// ISO 8601 date
|
|
@@ -1820,7 +1870,10 @@ var QuizSchema = CreativeWorkSchema.extend({
|
|
|
1820
1870
|
"@type": z38.literal("Quiz").default("Quiz"),
|
|
1821
1871
|
name: z38.string().optional(),
|
|
1822
1872
|
educationalLevel: z38.string().optional(),
|
|
1823
|
-
about: z38.
|
|
1873
|
+
about: z38.union([
|
|
1874
|
+
z38.object({ "@id": z38.string() }),
|
|
1875
|
+
z38.lazy(() => z38.object({ "@type": z38.string() }).catchall(z38.unknown()))
|
|
1876
|
+
]).optional(),
|
|
1824
1877
|
hasPart: z38.array(QuestionSchema).optional(),
|
|
1825
1878
|
educationalAlignment: z38.union([AlignmentObjectSchema, z38.array(AlignmentObjectSchema)]).optional()
|
|
1826
1879
|
});
|
|
@@ -1860,9 +1913,12 @@ var DiscussionForumPostingSchema = CreativeWorkSchema.extend({
|
|
|
1860
1913
|
image: ImageOrUrl.optional(),
|
|
1861
1914
|
/** "published", "draft", "deleted" — or a schema.org enum URL */
|
|
1862
1915
|
creativeWorkStatus: z39.string().optional(),
|
|
1863
|
-
mainEntityOfPage: z39.union([z39.url(), z39.object({}).catchall(z39.unknown())]).optional(),
|
|
1864
|
-
// For reposts:
|
|
1865
|
-
sharedContent: z39.
|
|
1916
|
+
mainEntityOfPage: z39.union([z39.url(), z39.object({ "@id": z39.string() }), z39.object({}).catchall(z39.unknown())]).optional(),
|
|
1917
|
+
// For reposts (accept @id refs for @graph cross-referencing):
|
|
1918
|
+
sharedContent: z39.union([
|
|
1919
|
+
z39.object({ "@id": z39.string() }),
|
|
1920
|
+
z39.lazy(() => z39.object({ "@type": z39.string() }).catchall(z39.unknown()))
|
|
1921
|
+
]).optional(),
|
|
1866
1922
|
interactionStatistic: z39.union([InteractionCounterSchema, z39.array(InteractionCounterSchema)]).optional()
|
|
1867
1923
|
});
|
|
1868
1924
|
var createDiscussionForumPosting = makeFactory(
|
|
@@ -1899,13 +1955,17 @@ var createItemList = makeFactory(ItemListSchema);
|
|
|
1899
1955
|
import { z as z41 } from "zod";
|
|
1900
1956
|
var ProfilePageSchema = WebPageSchema.extend({
|
|
1901
1957
|
"@type": z41.literal("ProfilePage").default("ProfilePage"),
|
|
1902
|
-
// mainEntity: the person or org this profile is about (
|
|
1903
|
-
mainEntity: z41.
|
|
1904
|
-
|
|
1905
|
-
|
|
1958
|
+
// mainEntity: the person or org this profile is about (accept @id refs for @graph)
|
|
1959
|
+
mainEntity: z41.union([
|
|
1960
|
+
z41.object({ "@id": z41.string() }),
|
|
1961
|
+
z41.lazy(() => z41.object({ "@type": z41.string() }).catchall(z41.unknown()))
|
|
1962
|
+
]).optional(),
|
|
1906
1963
|
// hasPart: content published by/about this profile subject
|
|
1907
1964
|
hasPart: z41.array(
|
|
1908
|
-
z41.
|
|
1965
|
+
z41.union([
|
|
1966
|
+
z41.object({ "@id": z41.string() }),
|
|
1967
|
+
z41.lazy(() => z41.object({ "@type": z41.string() }).catchall(z41.unknown()))
|
|
1968
|
+
])
|
|
1909
1969
|
).optional(),
|
|
1910
1970
|
dateCreated: z41.string().optional(),
|
|
1911
1971
|
dateModified: z41.string().optional()
|