@fedify/vocab 2.2.0-dev.628 → 2.2.0-dev.700

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.
@@ -1,10 +1,10 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { _ as Place, a as Create, b as Source, c as Follow, d as Link, f as Note, g as Person, i as Collection, m as OrderedCollectionPage, n as Announce, o as CryptographicKey, p as Object$1, s as Endpoints, t as Activity, u as Hashtag, v as Question, x as vocab_exports } from "./vocab-ZNOT6nzY.mjs";
3
+ import { _ as Place, a as Create, b as Source, c as Follow, d as Link, f as Note, g as Person, i as Collection, m as OrderedCollectionPage, n as Announce, o as CryptographicKey, p as Object$1, s as Endpoints, t as Activity, u as Hashtag, v as Question, x as vocab_exports } from "./vocab-CGZuHaxe.mjs";
4
4
  import { t as assertInstanceOf } from "./utils-CE8Dk5hm.mjs";
5
5
  import { mockDocumentLoader, test } from "@fedify/fixture";
6
6
  import { deepStrictEqual, notDeepStrictEqual, ok, rejects, throws } from "node:assert/strict";
7
- import { LanguageString, decodeMultibase } from "@fedify/vocab-runtime";
7
+ import { LanguageString, decodeMultibase, parseDecimal } from "@fedify/vocab-runtime";
8
8
  import { pascalCase } from "es-toolkit";
9
9
  import { areAllScalarTypes, loadSchemaFiles } from "@fedify/vocab-tools";
10
10
  //#region src/vocab.test.ts
@@ -1222,6 +1222,7 @@ const sampleValues = {
1222
1222
  "http://www.w3.org/2001/XMLSchema#integer": -123,
1223
1223
  "http://www.w3.org/2001/XMLSchema#nonNegativeInteger": 123,
1224
1224
  "http://www.w3.org/2001/XMLSchema#float": 12.34,
1225
+ "http://www.w3.org/2001/XMLSchema#decimal": parseDecimal("12.34"),
1225
1226
  "http://www.w3.org/2001/XMLSchema#string": "hello",
1226
1227
  "http://www.w3.org/2001/XMLSchema#anyURI": new URL("https://example.com/"),
1227
1228
  "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString": new LanguageString("hello", "en"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab",
3
- "version": "2.2.0-dev.628+7f7a1e9b",
3
+ "version": "2.2.0-dev.700+5323388d",
4
4
  "homepage": "https://fedify.dev/",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,9 +46,9 @@
46
46
  "es-toolkit": "1.43.0",
47
47
  "jsonld": "^9.0.0",
48
48
  "pkijs": "^3.3.3",
49
- "@fedify/webfinger": "2.2.0-dev.628+7f7a1e9b",
50
- "@fedify/vocab-tools": "2.2.0-dev.628+7f7a1e9b",
51
- "@fedify/vocab-runtime": "2.2.0-dev.628+7f7a1e9b"
49
+ "@fedify/vocab-tools": "2.2.0-dev.700+5323388d",
50
+ "@fedify/vocab-runtime": "2.2.0-dev.700+5323388d",
51
+ "@fedify/webfinger": "2.2.0-dev.700+5323388d"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^22.17.0",
@@ -414,6 +414,30 @@ snapshot[`Deno.inspect(PropertyValue) [auto] 2`] = `'PropertyValue { id: URL "ht
414
414
 
415
415
  snapshot[`Deno.inspect(PropertyValue) [auto] 3`] = `'PropertyValue { id: URL "https://example.com/", name: "hello", value: "hello" }'`;
416
416
 
417
+ snapshot[`Deno.inspect(Measure) [auto] 1`] = `
418
+ 'Measure {
419
+ id: URL "https://example.com/",
420
+ unit: "hello",
421
+ numericalValue: "12.34"
422
+ }'
423
+ `;
424
+
425
+ snapshot[`Deno.inspect(Measure) [auto] 2`] = `
426
+ 'Measure {
427
+ id: URL "https://example.com/",
428
+ unit: "hello",
429
+ numericalValue: "12.34"
430
+ }'
431
+ `;
432
+
433
+ snapshot[`Deno.inspect(Measure) [auto] 3`] = `
434
+ 'Measure {
435
+ id: URL "https://example.com/",
436
+ unit: "hello",
437
+ numericalValue: "12.34"
438
+ }'
439
+ `;
440
+
417
441
  snapshot[`Deno.inspect(AnnounceAuthorization) [auto] 1`] = `
418
442
  'AnnounceAuthorization {
419
443
  id: URL "https://example.com/",
@@ -1479,6 +1503,180 @@ snapshot[`Deno.inspect(Multikey) [auto] 3`] = `
1479
1503
  }'
1480
1504
  `;
1481
1505
 
1506
+ snapshot[`Deno.inspect(Intent) [auto] 1`] = `
1507
+ 'Intent {
1508
+ id: URL "https://example.com/",
1509
+ action: "hello",
1510
+ resourceConformsTo: URL "https://example.com/",
1511
+ resourceQuantity: Measure {},
1512
+ availableQuantity: Measure {},
1513
+ minimumQuantity: Measure {}
1514
+ }'
1515
+ `;
1516
+
1517
+ snapshot[`Deno.inspect(Intent) [auto] 2`] = `
1518
+ 'Intent {
1519
+ id: URL "https://example.com/",
1520
+ action: "hello",
1521
+ resourceConformsTo: URL "https://example.com/",
1522
+ resourceQuantity: Measure {},
1523
+ availableQuantity: Measure {},
1524
+ minimumQuantity: Measure {}
1525
+ }'
1526
+ `;
1527
+
1528
+ snapshot[`Deno.inspect(Intent) [auto] 3`] = `
1529
+ 'Intent {
1530
+ id: URL "https://example.com/",
1531
+ action: "hello",
1532
+ resourceConformsTo: URL "https://example.com/",
1533
+ resourceQuantity: Measure {},
1534
+ availableQuantity: Measure {},
1535
+ minimumQuantity: Measure {}
1536
+ }'
1537
+ `;
1538
+
1539
+ snapshot[`Deno.inspect(Proposal) [auto] 1`] = `
1540
+ 'Proposal {
1541
+ id: URL "https://example.com/",
1542
+ attachments: [ Object {}, Link {}, PropertyValue {} ],
1543
+ attributions: [ Application {}, Group {}, Organization {}, Person {}, Service {} ],
1544
+ audience: Object {},
1545
+ contents: [ "hello", <en> "hello" ],
1546
+ contexts: [ Object {}, Link {} ],
1547
+ names: [ "hello", <en> "hello" ],
1548
+ endTime: 2024-03-03T08:30:06.796196096Z,
1549
+ generators: [ Object {}, Link {} ],
1550
+ icon: Image {},
1551
+ image: Image {},
1552
+ replyTargets: [ Object {}, Link {} ],
1553
+ locations: [ Object {}, Link {} ],
1554
+ previews: [ Link {}, Object {} ],
1555
+ published: 2024-03-03T08:30:06.796196096Z,
1556
+ replies: Collection {},
1557
+ shares: Collection {},
1558
+ likes: Collection {},
1559
+ emojiReactions: Collection {},
1560
+ startTime: 2024-03-03T08:30:06.796196096Z,
1561
+ summaries: [ "hello", <en> "hello" ],
1562
+ tags: [ Object {}, Link {} ],
1563
+ updated: 2024-03-03T08:30:06.796196096Z,
1564
+ urls: [ URL "https://example.com/", Link {} ],
1565
+ to: Object {},
1566
+ bto: Object {},
1567
+ cc: Object {},
1568
+ bcc: Object {},
1569
+ mediaType: "hello",
1570
+ duration: PT1H,
1571
+ sensitive: true,
1572
+ source: Source {},
1573
+ proof: DataIntegrityProof {},
1574
+ interactionPolicy: InteractionPolicy {},
1575
+ approvedBy: URL "https://example.com/",
1576
+ likeAuthorization: LikeAuthorization {},
1577
+ replyAuthorization: ReplyAuthorization {},
1578
+ announceAuthorization: AnnounceAuthorization {},
1579
+ purpose: "hello",
1580
+ publishes: Intent {},
1581
+ reciprocal: Intent {},
1582
+ unitBased: true
1583
+ }'
1584
+ `;
1585
+
1586
+ snapshot[`Deno.inspect(Proposal) [auto] 2`] = `
1587
+ 'Proposal {
1588
+ id: URL "https://example.com/",
1589
+ attachments: [ URL "https://example.com/" ],
1590
+ attribution: URL "https://example.com/",
1591
+ audience: URL "https://example.com/",
1592
+ contents: [ "hello", <en> "hello" ],
1593
+ contexts: [ URL "https://example.com/" ],
1594
+ names: [ "hello", <en> "hello" ],
1595
+ endTime: 2024-03-03T08:30:06.796196096Z,
1596
+ generators: [ URL "https://example.com/" ],
1597
+ icon: URL "https://example.com/",
1598
+ image: URL "https://example.com/",
1599
+ replyTarget: URL "https://example.com/",
1600
+ location: URL "https://example.com/",
1601
+ preview: URL "https://example.com/",
1602
+ published: 2024-03-03T08:30:06.796196096Z,
1603
+ replies: URL "https://example.com/",
1604
+ shares: URL "https://example.com/",
1605
+ likes: URL "https://example.com/",
1606
+ emojiReactions: URL "https://example.com/",
1607
+ startTime: 2024-03-03T08:30:06.796196096Z,
1608
+ summaries: [ "hello", <en> "hello" ],
1609
+ tags: [ URL "https://example.com/" ],
1610
+ updated: 2024-03-03T08:30:06.796196096Z,
1611
+ urls: [ URL "https://example.com/", Link {} ],
1612
+ to: URL "https://example.com/",
1613
+ bto: URL "https://example.com/",
1614
+ cc: URL "https://example.com/",
1615
+ bcc: URL "https://example.com/",
1616
+ mediaType: "hello",
1617
+ duration: PT1H,
1618
+ sensitive: true,
1619
+ source: Source {},
1620
+ proof: URL "https://example.com/",
1621
+ interactionPolicy: InteractionPolicy {},
1622
+ approvedBy: URL "https://example.com/",
1623
+ likeAuthorization: URL "https://example.com/",
1624
+ replyAuthorization: URL "https://example.com/",
1625
+ announceAuthorization: URL "https://example.com/",
1626
+ purpose: "hello",
1627
+ publishes: Intent {},
1628
+ reciprocal: Intent {},
1629
+ unitBased: true
1630
+ }'
1631
+ `;
1632
+
1633
+ snapshot[`Deno.inspect(Proposal) [auto] 3`] = `
1634
+ 'Proposal {
1635
+ id: URL "https://example.com/",
1636
+ attachments: [ Object {}, Object {} ],
1637
+ attributions: [ Application {}, Application {} ],
1638
+ audiences: [ Object {}, Object {} ],
1639
+ contents: [ "hello", "hello" ],
1640
+ contexts: [ Object {}, Object {} ],
1641
+ names: [ "hello", "hello" ],
1642
+ endTime: 2024-03-03T08:30:06.796196096Z,
1643
+ generators: [ Object {}, Object {} ],
1644
+ icons: [ Image {}, Image {} ],
1645
+ images: [ Image {}, Image {} ],
1646
+ replyTargets: [ Object {}, Object {} ],
1647
+ locations: [ Object {}, Object {} ],
1648
+ previews: [ Link {}, Link {} ],
1649
+ published: 2024-03-03T08:30:06.796196096Z,
1650
+ replies: Collection {},
1651
+ shares: Collection {},
1652
+ likes: Collection {},
1653
+ emojiReactions: Collection {},
1654
+ startTime: 2024-03-03T08:30:06.796196096Z,
1655
+ summaries: [ "hello", "hello" ],
1656
+ tags: [ Object {}, Object {} ],
1657
+ updated: 2024-03-03T08:30:06.796196096Z,
1658
+ urls: [ URL "https://example.com/", URL "https://example.com/" ],
1659
+ tos: [ Object {}, Object {} ],
1660
+ btos: [ Object {}, Object {} ],
1661
+ ccs: [ Object {}, Object {} ],
1662
+ bccs: [ Object {}, Object {} ],
1663
+ mediaType: "hello",
1664
+ duration: PT1H,
1665
+ sensitive: true,
1666
+ source: Source {},
1667
+ proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ],
1668
+ interactionPolicy: InteractionPolicy {},
1669
+ approvedBy: URL "https://example.com/",
1670
+ likeAuthorization: LikeAuthorization {},
1671
+ replyAuthorization: ReplyAuthorization {},
1672
+ announceAuthorization: AnnounceAuthorization {},
1673
+ purpose: "hello",
1674
+ publishes: Intent {},
1675
+ reciprocal: Intent {},
1676
+ unitBased: true
1677
+ }'
1678
+ `;
1679
+
1482
1680
  snapshot[`Deno.inspect(Accept) [auto] 1`] = `
1483
1681
  'Accept {
1484
1682
  id: URL "https://example.com/",
@@ -0,0 +1,72 @@
1
+ $schema: ../../vocab-tools/schema.yaml
2
+ name: Intent
3
+ compactName: Intent
4
+ uri: "https://w3id.org/valueflows/ont/vf#Intent"
5
+ entity: false
6
+ description: |
7
+ A proposed economic transaction describing what is being offered or requested
8
+ in a {@link Proposal}.
9
+ defaultContext:
10
+ - "https://www.w3.org/ns/activitystreams"
11
+ - vf: "https://w3id.org/valueflows/ont/vf#"
12
+ om2: "http://www.ontology-of-units-of-measure.org/resource/om-2/"
13
+ Intent: "vf:Intent"
14
+ action: "vf:action"
15
+ resourceConformsTo:
16
+ "@id": "vf:resourceConformsTo"
17
+ "@type": "@id"
18
+ resourceQuantity: "vf:resourceQuantity"
19
+ availableQuantity: "vf:availableQuantity"
20
+ minimumQuantity: "vf:minimumQuantity"
21
+ hasUnit: "om2:hasUnit"
22
+ hasNumericalValue: "om2:hasNumericalValue"
23
+
24
+ properties:
25
+ - singularName: action
26
+ functional: true
27
+ compactName: action
28
+ uri: "https://w3id.org/valueflows/ont/vf#action"
29
+ description: |
30
+ The type of economic transaction. The value of this property should be
31
+ either `"deliverService"` or `"transfer"`.
32
+ range:
33
+ - "http://www.w3.org/2001/XMLSchema#string"
34
+
35
+ - singularName: resourceConformsTo
36
+ functional: true
37
+ compactName: resourceConformsTo
38
+ uri: "https://w3id.org/valueflows/ont/vf#resourceConformsTo"
39
+ description: |
40
+ The type of an economic resource. Could be any URI.
41
+ range:
42
+ - "http://www.w3.org/2001/XMLSchema#anyURI"
43
+
44
+ - singularName: resourceQuantity
45
+ functional: true
46
+ compactName: resourceQuantity
47
+ uri: "https://w3id.org/valueflows/ont/vf#resourceQuantity"
48
+ untyped: true
49
+ description: |
50
+ The amount and unit of the economic resource.
51
+ range:
52
+ - "http://www.ontology-of-units-of-measure.org/resource/om-2/Measure"
53
+
54
+ - singularName: availableQuantity
55
+ functional: true
56
+ compactName: availableQuantity
57
+ uri: "https://w3id.org/valueflows/ont/vf#availableQuantity"
58
+ untyped: true
59
+ description: |
60
+ The quantity of the offered resource currently available.
61
+ range:
62
+ - "http://www.ontology-of-units-of-measure.org/resource/om-2/Measure"
63
+
64
+ - singularName: minimumQuantity
65
+ functional: true
66
+ compactName: minimumQuantity
67
+ uri: "https://w3id.org/valueflows/ont/vf#minimumQuantity"
68
+ untyped: true
69
+ description: |
70
+ The minimum possible quantity of the resource.
71
+ range:
72
+ - "http://www.ontology-of-units-of-measure.org/resource/om-2/Measure"
@@ -0,0 +1,32 @@
1
+ $schema: ../../vocab-tools/schema.yaml
2
+ name: Measure
3
+ compactName: om2:Measure
4
+ uri: "http://www.ontology-of-units-of-measure.org/resource/om-2/Measure"
5
+ entity: false
6
+ description: A quantity with a unit of measure.
7
+ defaultContext:
8
+ - "https://www.w3.org/ns/activitystreams"
9
+ - om2: "http://www.ontology-of-units-of-measure.org/resource/om-2/"
10
+ hasUnit: "om2:hasUnit"
11
+ hasNumericalValue: "om2:hasNumericalValue"
12
+
13
+ properties:
14
+ - singularName: unit
15
+ functional: true
16
+ compactName: hasUnit
17
+ uri: "http://www.ontology-of-units-of-measure.org/resource/om-2/hasUnit"
18
+ description: |
19
+ The name of the unit, according to the Ontology of units of Measure
20
+ classification. The recommended unit for countable items is `"one"`.
21
+ range:
22
+ - "http://www.w3.org/2001/XMLSchema#string"
23
+
24
+ - singularName: numericalValue
25
+ functional: true
26
+ compactName: hasNumericalValue
27
+ uri: "http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue"
28
+ description: |
29
+ The amount of the resource. If not specified, arbitrary amounts can be
30
+ used when responding to the proposal.
31
+ range:
32
+ - "http://www.w3.org/2001/XMLSchema#decimal"
@@ -0,0 +1,90 @@
1
+ $schema: ../../vocab-tools/schema.yaml
2
+ name: Proposal
3
+ compactName: Proposal
4
+ uri: "https://w3id.org/valueflows/ont/vf#Proposal"
5
+ extends: "https://www.w3.org/ns/activitystreams#Object"
6
+ entity: true
7
+ description: |
8
+ A published request or offer, sometimes with what is expected in return.
9
+
10
+ Proposals contain a primary {@link Intent} (via `publishes`) describing
11
+ what is being offered or requested, and optionally a reciprocal
12
+ {@link Intent} describing what is expected or offered in return.
13
+
14
+ Note: This type extends ActivityStreams `Object` for practical
15
+ interoperability within ActivityPub federation, even though FEP-0837
16
+ defines `Proposal` as a pure ValueFlows type. Extending `Object`
17
+ provides useful inherited properties such as `name`, `content`,
18
+ `attributedTo`, `published`, `to`, and `location` without needing to
19
+ redefine them.
20
+ # NOTE: The context includes mappings for Intent and Measure properties
21
+ # (action, resourceConformsTo, hasUnit, etc.) because the code generator
22
+ # does not automatically merge contexts from referenced types. Proposal
23
+ # must declare all mappings needed for correct JSON-LD serialization of
24
+ # its embedded Intent and Measure objects.
25
+ defaultContext:
26
+ - "https://www.w3.org/ns/activitystreams"
27
+ - "https://w3id.org/security/data-integrity/v1"
28
+ - "https://gotosocial.org/ns"
29
+ - vf: "https://w3id.org/valueflows/ont/vf#"
30
+ om2: "http://www.ontology-of-units-of-measure.org/resource/om-2/"
31
+ fedibird: "http://fedibird.com/ns#"
32
+ sensitive: "as:sensitive"
33
+ emojiReactions:
34
+ "@id": "fedibird:emojiReactions"
35
+ "@type": "@id"
36
+ Proposal: "vf:Proposal"
37
+ Intent: "vf:Intent"
38
+ purpose: "vf:purpose"
39
+ unitBased: "vf:unitBased"
40
+ publishes: "vf:publishes"
41
+ reciprocal: "vf:reciprocal"
42
+ action: "vf:action"
43
+ resourceConformsTo:
44
+ "@id": "vf:resourceConformsTo"
45
+ "@type": "@id"
46
+ resourceQuantity: "vf:resourceQuantity"
47
+ availableQuantity: "vf:availableQuantity"
48
+ minimumQuantity: "vf:minimumQuantity"
49
+ hasUnit: "om2:hasUnit"
50
+ hasNumericalValue: "om2:hasNumericalValue"
51
+
52
+ properties:
53
+ - singularName: purpose
54
+ functional: true
55
+ compactName: purpose
56
+ uri: "https://w3id.org/valueflows/ont/vf#purpose"
57
+ description: |
58
+ The type of proposal. Possible values are `"offer"` and `"request"`.
59
+ range:
60
+ - "http://www.w3.org/2001/XMLSchema#string"
61
+
62
+ - singularName: publishes
63
+ functional: true
64
+ compactName: publishes
65
+ uri: "https://w3id.org/valueflows/ont/vf#publishes"
66
+ description: |
67
+ The primary intent of this proposal, describing what is being offered
68
+ or requested.
69
+ range:
70
+ - "https://w3id.org/valueflows/ont/vf#Intent"
71
+
72
+ - singularName: reciprocal
73
+ functional: true
74
+ compactName: reciprocal
75
+ uri: "https://w3id.org/valueflows/ont/vf#reciprocal"
76
+ description: |
77
+ The reciprocal intent of this proposal, describing what is expected
78
+ or offered in return.
79
+ range:
80
+ - "https://w3id.org/valueflows/ont/vf#Intent"
81
+
82
+ - singularName: unitBased
83
+ functional: true
84
+ compactName: unitBased
85
+ uri: "https://w3id.org/valueflows/ont/vf#unitBased"
86
+ description: |
87
+ Indicates whether the quantities expressed in the proposal can be
88
+ multiplied or not. The default is `false`.
89
+ range:
90
+ - "http://www.w3.org/2001/XMLSchema#boolean"
package/src/vocab.test.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  import { mockDocumentLoader, test } from "@fedify/fixture";
2
- import { decodeMultibase, LanguageString } from "@fedify/vocab-runtime";
2
+ import {
3
+ decodeMultibase,
4
+ LanguageString,
5
+ parseDecimal,
6
+ } from "@fedify/vocab-runtime";
3
7
  import {
4
8
  areAllScalarTypes,
5
9
  loadSchemaFiles,
@@ -1915,6 +1919,7 @@ const sampleValues: Record<string, any> = {
1915
1919
  "http://www.w3.org/2001/XMLSchema#integer": -123,
1916
1920
  "http://www.w3.org/2001/XMLSchema#nonNegativeInteger": 123,
1917
1921
  "http://www.w3.org/2001/XMLSchema#float": 12.34,
1922
+ "http://www.w3.org/2001/XMLSchema#decimal": parseDecimal("12.34"),
1918
1923
  "http://www.w3.org/2001/XMLSchema#string": "hello",
1919
1924
  "http://www.w3.org/2001/XMLSchema#anyURI": new URL("https://example.com/"),
1920
1925
  "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString": new LanguageString(