@lincs.project/webannotation-schema 1.6.0 → 1.7.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.mjs CHANGED
@@ -1343,40 +1343,69 @@ var definitionSchema = {
1343
1343
  };
1344
1344
 
1345
1345
  // src/v1/schema/root.ts
1346
+ import { z as z27 } from "zod";
1347
+
1348
+ // src/v1/schema/definitions/motivation.ts
1346
1349
  import { z as z26 } from "zod";
1350
+ var MotivationInstance = z26.union([
1351
+ z26.literal("identifying"),
1352
+ z26.literal("describing"),
1353
+ z26.literal("correcting"),
1354
+ z26.literal("tagging"),
1355
+ z26.literal("classifying"),
1356
+ z26.literal("linking"),
1357
+ z26.literal("citing")
1358
+ ]);
1359
+ var MotivationType = z26.object({
1360
+ type: z26.literal("crm:E55_Type")
1361
+ });
1362
+ var Motivation = z26.record(MotivationInstance, MotivationType).describe("The relationship between an Annotation and a Motivation.");
1363
+ var motivationType = {
1364
+ type: "object",
1365
+ properties: {
1366
+ type: { type: "string", const: "crm:E55_Type" }
1367
+ },
1368
+ required: ["type"]
1369
+ };
1370
+ var motivationSchema = {
1371
+ type: "object",
1372
+ description: "The relationship between an Annotation and a Motivation.",
1373
+ properties: {
1374
+ identifying: { ...motivationType, nullable: true },
1375
+ describing: { ...motivationType, nullable: true },
1376
+ correcting: { ...motivationType, nullable: true },
1377
+ tagging: { ...motivationType, nullable: true },
1378
+ classifying: { ...motivationType, nullable: true },
1379
+ linking: { ...motivationType, nullable: true },
1380
+ citing: { ...motivationType, nullable: true }
1381
+ }
1382
+ };
1383
+
1384
+ // src/v1/schema/root.ts
1347
1385
  var Status = ["edit:statusDraft", "edit:statusApproved", "edit:statusPublished"];
1348
- var Motivation = [
1349
- "identifying",
1350
- "describing",
1351
- "correcting",
1352
- "tagging",
1353
- "classifying",
1354
- "linking",
1355
- "citing"
1356
- ];
1357
- var WebAnnotation = z26.object({
1358
- "@context": z26.tuple([
1359
- z26.literal("http://www.w3.org/ns/anno.jsonld").describe("W3C Web Annotation Context."),
1360
- z26.literal(contextUri).describe("LINCS Web Annotation Context.")
1386
+ var WebAnnotation = z27.object({
1387
+ "@context": z27.tuple([
1388
+ z27.literal("http://www.w3.org/ns/anno.jsonld").describe("W3C Web Annotation Context."),
1389
+ z27.literal(contextUri).describe("LINCS Web Annotation Context.")
1361
1390
  ]).describe(
1362
1391
  "The context that determines the meaning of the JSON as an Annotation. The itens should point to a URI containing the defiintion used in this schema."
1363
1392
  ),
1364
- id: z26.string().url().describe("The identity of the Annotation."),
1365
- type: z26.tuple([z26.literal("Annotation"), z26.literal("crm:E33_Linguistic_Object")]).describe("The type of the Annotation."),
1366
- motivation: z26.tuple([z26.enum(Motivation), z26.literal("crm:E55_Type")]).describe("The relationship between an Annotation and a Motivation."),
1367
- created: z26.string().datetime().describe("The time at which the resource was created."),
1368
- modified: z26.string().datetime().optional().describe("The time at which the resource was modified, after creation."),
1393
+ id: z27.string().url().describe("The identity of the Annotation."),
1394
+ type: z27.tuple([z27.literal("Annotation"), z27.literal("crm:E33_Linguistic_Object")]).describe("The type of the Annotation."),
1395
+ motivation: Motivation,
1396
+ created: z27.string().datetime().describe("The time at which the resource was created."),
1397
+ modified: z27.string().datetime().optional().describe("The time at which the resource was modified, after creation."),
1369
1398
  creator: User.describe("The agent responsible for creating the resource.").optional(),
1370
- contributor: z26.array(User.describe("The agents responsible for modifying the resource.")).nonempty().optional().describe("The agents responsible for modifying the resource."),
1399
+ contributor: z27.array(User.describe("The agents responsible for modifying the resource.")).nonempty().optional().describe("The agents responsible for modifying the resource."),
1371
1400
  generator: Software.describe(
1372
1401
  "The agent responsible for generating the serialization of the Annotation. "
1373
1402
  ),
1374
1403
  target: Target.describe("The relationship between an Annotation and its Target."),
1375
- body: z26.union([BodyChoice, Body, z26.array(Body)]).describe("The relationship between an Annotation and its Body."),
1404
+ body: z27.union([BodyChoice, Body, z27.array(Body)]).describe("The relationship between an Annotation and its Body."),
1376
1405
  certainty: Certainty.optional(),
1377
1406
  precision: Precision.optional(),
1378
- label: z26.string().min(1, { message: "The label cannot be empty" }).optional().describe("The descriptive label for the annotation"),
1379
- status: z26.enum(Status).describe("The status of this annotation in a workflow.")
1407
+ label: z27.string().min(1, { message: "The label cannot be empty" }).optional().describe("The descriptive label for the annotation"),
1408
+ status: z27.enum(Status).describe("The status of this annotation in a workflow.")
1380
1409
  }).describe("Web Annotation Root");
1381
1410
  var webAnnotationSchema = {
1382
1411
  $id: schemaId,
@@ -1408,16 +1437,7 @@ var webAnnotationSchema = {
1408
1437
  ],
1409
1438
  description: "The type of the Annotation."
1410
1439
  },
1411
- motivation: {
1412
- type: "array",
1413
- minItems: 2,
1414
- maxItems: 2,
1415
- items: [
1416
- { type: "string", enum: Motivation },
1417
- { type: "string", const: "crm:E55_Type" }
1418
- ],
1419
- description: "The relationship between an Annotation and a Motivation."
1420
- },
1440
+ motivation: motivationSchema,
1421
1441
  created: {
1422
1442
  type: "string",
1423
1443
  format: "date-time",
@@ -1466,6 +1486,7 @@ var webAnnotationSchema = {
1466
1486
  "body",
1467
1487
  "status"
1468
1488
  ],
1489
+ additionalProperties: false,
1469
1490
  allOf: [
1470
1491
  {
1471
1492
  if: {
@@ -1494,13 +1515,15 @@ var webAnnotationSchema = {
1494
1515
  type: "object",
1495
1516
  properties: {
1496
1517
  motivation: {
1497
- type: "array",
1498
- minItems: 2,
1499
- maxItems: 2,
1500
- items: [
1501
- { type: "string", const: "identifying" },
1502
- { type: "string", const: "crm:E55_Type" }
1503
- ]
1518
+ type: "object",
1519
+ properties: {
1520
+ identifying: {
1521
+ type: "object",
1522
+ properties: {
1523
+ type: { type: "string", const: "crm:E55_Type" }
1524
+ }
1525
+ }
1526
+ }
1504
1527
  }
1505
1528
  }
1506
1529
  },
@@ -1520,13 +1543,15 @@ var webAnnotationSchema = {
1520
1543
  type: "object",
1521
1544
  properties: {
1522
1545
  motivation: {
1523
- type: "array",
1524
- minItems: 2,
1525
- maxItems: 2,
1526
- items: [
1527
- { type: "string", const: "describing" },
1528
- { type: "string", const: "crm:E55_Type" }
1529
- ]
1546
+ type: "object",
1547
+ properties: {
1548
+ describing: {
1549
+ type: "object",
1550
+ properties: {
1551
+ type: { type: "string", const: "crm:E55_Type" }
1552
+ }
1553
+ }
1554
+ }
1530
1555
  }
1531
1556
  }
1532
1557
  },
@@ -1546,13 +1571,15 @@ var webAnnotationSchema = {
1546
1571
  type: "object",
1547
1572
  properties: {
1548
1573
  motivation: {
1549
- type: "array",
1550
- minItems: 2,
1551
- maxItems: 2,
1552
- items: [
1553
- { type: "string", const: "correcting" },
1554
- { type: "string", const: "crm:E55_Type" }
1555
- ]
1574
+ type: "object",
1575
+ properties: {
1576
+ correcting: {
1577
+ type: "object",
1578
+ properties: {
1579
+ type: { type: "string", const: "crm:E55_Type" }
1580
+ }
1581
+ }
1582
+ }
1556
1583
  }
1557
1584
  }
1558
1585
  },
@@ -1572,13 +1599,15 @@ var webAnnotationSchema = {
1572
1599
  type: "object",
1573
1600
  properties: {
1574
1601
  motivation: {
1575
- type: "array",
1576
- minItems: 2,
1577
- maxItems: 2,
1578
- items: [
1579
- { type: "string", const: "tagging" },
1580
- { type: "string", const: "crm:E55_Type" }
1581
- ]
1602
+ type: "object",
1603
+ properties: {
1604
+ tagging: {
1605
+ type: "object",
1606
+ properties: {
1607
+ type: { type: "string", const: "crm:E55_Type" }
1608
+ }
1609
+ }
1610
+ }
1582
1611
  }
1583
1612
  }
1584
1613
  },
@@ -1598,13 +1627,15 @@ var webAnnotationSchema = {
1598
1627
  type: "object",
1599
1628
  properties: {
1600
1629
  motivation: {
1601
- type: "array",
1602
- minItems: 2,
1603
- maxItems: 2,
1604
- items: [
1605
- { type: "string", const: "classifying" },
1606
- { type: "string", const: "crm:E55_Type" }
1607
- ]
1630
+ type: "object",
1631
+ properties: {
1632
+ classifying: {
1633
+ type: "object",
1634
+ properties: {
1635
+ type: { type: "string", const: "crm:E55_Type" }
1636
+ }
1637
+ }
1638
+ }
1608
1639
  }
1609
1640
  }
1610
1641
  },
@@ -1624,13 +1655,15 @@ var webAnnotationSchema = {
1624
1655
  type: "object",
1625
1656
  properties: {
1626
1657
  motivation: {
1627
- type: "array",
1628
- minItems: 2,
1629
- maxItems: 2,
1630
- items: [
1631
- { type: "string", const: "linking" },
1632
- { type: "string", const: "crm:E55_Type" }
1633
- ]
1658
+ type: "object",
1659
+ properties: {
1660
+ linking: {
1661
+ type: "object",
1662
+ properties: {
1663
+ type: { type: "string", const: "crm:E55_Type" }
1664
+ }
1665
+ }
1666
+ }
1634
1667
  }
1635
1668
  }
1636
1669
  },
@@ -1650,13 +1683,15 @@ var webAnnotationSchema = {
1650
1683
  type: "object",
1651
1684
  properties: {
1652
1685
  motivation: {
1653
- type: "array",
1654
- minItems: 2,
1655
- maxItems: 2,
1656
- items: [
1657
- { type: "string", const: "citing" },
1658
- { type: "string", const: "crm:E55_Type" }
1659
- ]
1686
+ type: "object",
1687
+ properties: {
1688
+ citing: {
1689
+ type: "object",
1690
+ properties: {
1691
+ type: { type: "string", const: "crm:E55_Type" }
1692
+ }
1693
+ }
1694
+ }
1660
1695
  }
1661
1696
  }
1662
1697
  }
@@ -1667,8 +1702,7 @@ var webAnnotationSchema = {
1667
1702
  }
1668
1703
  }
1669
1704
  }
1670
- ],
1671
- additionalProperties: false
1705
+ ]
1672
1706
  };
1673
1707
 
1674
1708
  // src/v1/validator/index.ts
@@ -1677,18 +1711,18 @@ import Ajv from "ajv";
1677
1711
  import addFormats from "ajv-formats";
1678
1712
 
1679
1713
  // src/v1/validator/types.ts
1680
- import { z as z27 } from "zod";
1681
- var ValidationError = z27.object({
1682
- message: z27.string(),
1683
- path: z27.string(),
1684
- suggestion: z27.string().optional(),
1685
- context: z27.object({
1686
- errorType: z27.string()
1687
- }).and(z27.unknown())
1714
+ import { z as z28 } from "zod";
1715
+ var ValidationError = z28.object({
1716
+ message: z28.string(),
1717
+ path: z28.string(),
1718
+ suggestion: z28.string().optional(),
1719
+ context: z28.object({
1720
+ errorType: z28.string()
1721
+ }).and(z28.unknown())
1688
1722
  });
1689
- var ValidateResult = z27.object({
1690
- valid: z27.boolean(),
1691
- errors: z27.array(ValidationError).optional()
1723
+ var ValidateResult = z28.object({
1724
+ valid: z28.boolean(),
1725
+ errors: z28.array(ValidationError).optional()
1692
1726
  });
1693
1727
 
1694
1728
  // src/v1/validator/index.ts
@@ -1743,7 +1777,6 @@ __export(v1_exports, {
1743
1777
  KeywordFolksnomyEntityType: () => KeywordFolksnomyEntityType,
1744
1778
  Link: () => Link,
1745
1779
  LinkEntityType: () => LinkEntityType,
1746
- Motivation: () => Motivation,
1747
1780
  Note: () => Note,
1748
1781
  NoteEntityType: () => NoteEntityType,
1749
1782
  Organization: () => Organization,
@@ -1859,7 +1892,6 @@ export {
1859
1892
  KeywordFolksnomyEntityType,
1860
1893
  Link,
1861
1894
  LinkEntityType,
1862
- Motivation,
1863
1895
  Note,
1864
1896
  NoteEntityType,
1865
1897
  Organization,