Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ To be released.
- Added `DocumentLoaderFactoryOptions.maxRedirection` to configure the
maximum number of redirects followed by `getDocumentLoader()`.

### @fedify/vocab

- Added vocabulary types for economic resource coordination
in federated networks. [[#578] by Samuel Brinkmann]

- Added `Proposal` class for publishing offers or requests.
- Added `Intent` class for describing economic transactions within
a proposal, with `action`, `resourceConformsTo`, `resourceQuantity`,
`availableQuantity`, and `minimumQuantity` properties.
- Added `Measure` class for representing quantities with units of
measure, with `unit` and `numericalValue` properties.

[#578]: https://github.com/fedify-dev/fedify/issues/578

### @fedify/solidstart

- Added `@fedify/solidstart` package for integrating Fedify with
Expand Down
4 changes: 4 additions & 0 deletions docs/manual/vocab.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ property.
> | [`alsoKnownAs`] | `Application.getAliases()`/`Group.getAliases()`/`Organization.getAliases()`/`Person.getAliases()`/`Service.getAliases()` |
> | [`anyOf`] | `Question.getInclusiveOptions()` |
> | [`attributedTo`] | `Object.getAttributions()` |
> | [`hasNumericalValue`] | `Measure.numericalValue` |
> | [`hasUnit`] | `Measure.unit` |
> | [`hreflang`] | `Link.language` |
> | [`inReplyTo`] | `Object.getReplyTargets()` |
> | [`isCat`] | `Application.cat`/`Group.cat`/`Organization.cat`/`Person.cat`/`Service.cat` |
Expand All @@ -174,6 +176,8 @@ property.
[`alsoKnownAs`]: https://www.w3.org/TR/did-core/#dfn-alsoknownas
[`anyOf`]: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-anyof
[`attributedTo`]: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-attributedto
[`hasNumericalValue`]: http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue
[`hasUnit`]: http://www.ontology-of-units-of-measure.org/resource/om-2/hasUnit
[`hreflang`]: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-hreflang
[`inReplyTo`]: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-inreplyto
[`isCat`]: https://misskey-hub.net/ns#iscat
Expand Down
2,311 changes: 2,300 additions & 11 deletions packages/vocab-tools/src/__snapshots__/class.test.ts.deno.snap

Large diffs are not rendered by default.

2,311 changes: 2,300 additions & 11 deletions packages/vocab-tools/src/__snapshots__/class.test.ts.node.snap

Large diffs are not rendered by default.

2,311 changes: 2,300 additions & 11 deletions packages/vocab-tools/src/__snapshots__/class.test.ts.snap

Large diffs are not rendered by default.

198 changes: 198 additions & 0 deletions packages/vocab/src/__snapshots__/vocab.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,30 @@ snapshot[`Deno.inspect(PropertyValue) [auto] 2`] = `'PropertyValue { id: URL "ht

snapshot[`Deno.inspect(PropertyValue) [auto] 3`] = `'PropertyValue { id: URL "https://example.com/", name: "hello", value: "hello" }'`;

snapshot[`Deno.inspect(Measure) [auto] 1`] = `
'Measure {
id: URL "https://example.com/",
unit: "hello",
numericalValue: "12.34"
}'
`;

snapshot[`Deno.inspect(Measure) [auto] 2`] = `
'Measure {
id: URL "https://example.com/",
unit: "hello",
numericalValue: "12.34"
}'
`;

snapshot[`Deno.inspect(Measure) [auto] 3`] = `
'Measure {
id: URL "https://example.com/",
unit: "hello",
numericalValue: "12.34"
}'
`;

snapshot[`Deno.inspect(AnnounceAuthorization) [auto] 1`] = `
'AnnounceAuthorization {
id: URL "https://example.com/",
Expand Down Expand Up @@ -1479,6 +1503,180 @@ snapshot[`Deno.inspect(Multikey) [auto] 3`] = `
}'
`;

snapshot[`Deno.inspect(Intent) [auto] 1`] = `
'Intent {
id: URL "https://example.com/",
action: "hello",
resourceConformsTo: URL "https://example.com/",
resourceQuantity: Measure {},
availableQuantity: Measure {},
minimumQuantity: Measure {}
}'
`;

snapshot[`Deno.inspect(Intent) [auto] 2`] = `
'Intent {
id: URL "https://example.com/",
action: "hello",
resourceConformsTo: URL "https://example.com/",
resourceQuantity: Measure {},
availableQuantity: Measure {},
minimumQuantity: Measure {}
}'
`;

snapshot[`Deno.inspect(Intent) [auto] 3`] = `
'Intent {
id: URL "https://example.com/",
action: "hello",
resourceConformsTo: URL "https://example.com/",
resourceQuantity: Measure {},
availableQuantity: Measure {},
minimumQuantity: Measure {}
}'
`;

snapshot[`Deno.inspect(Proposal) [auto] 1`] = `
'Proposal {
id: URL "https://example.com/",
attachments: [ Object {}, Link {}, PropertyValue {} ],
attributions: [ Application {}, Group {}, Organization {}, Person {}, Service {} ],
audience: Object {},
contents: [ "hello", <en> "hello" ],
contexts: [ Object {}, Link {} ],
names: [ "hello", <en> "hello" ],
endTime: 2024-03-03T08:30:06.796196096Z,
generators: [ Object {}, Link {} ],
icon: Image {},
image: Image {},
replyTargets: [ Object {}, Link {} ],
locations: [ Object {}, Link {} ],
previews: [ Link {}, Object {} ],
published: 2024-03-03T08:30:06.796196096Z,
replies: Collection {},
shares: Collection {},
likes: Collection {},
emojiReactions: Collection {},
startTime: 2024-03-03T08:30:06.796196096Z,
summaries: [ "hello", <en> "hello" ],
tags: [ Object {}, Link {} ],
updated: 2024-03-03T08:30:06.796196096Z,
urls: [ URL "https://example.com/", Link {} ],
to: Object {},
bto: Object {},
cc: Object {},
bcc: Object {},
mediaType: "hello",
duration: PT1H,
sensitive: true,
source: Source {},
proof: DataIntegrityProof {},
interactionPolicy: InteractionPolicy {},
approvedBy: URL "https://example.com/",
likeAuthorization: LikeAuthorization {},
replyAuthorization: ReplyAuthorization {},
announceAuthorization: AnnounceAuthorization {},
purpose: "hello",
publishes: Intent {},
reciprocal: Intent {},
unitBased: true
}'
`;

snapshot[`Deno.inspect(Proposal) [auto] 2`] = `
'Proposal {
id: URL "https://example.com/",
attachments: [ URL "https://example.com/" ],
attribution: URL "https://example.com/",
audience: URL "https://example.com/",
contents: [ "hello", <en> "hello" ],
contexts: [ URL "https://example.com/" ],
names: [ "hello", <en> "hello" ],
endTime: 2024-03-03T08:30:06.796196096Z,
generators: [ URL "https://example.com/" ],
icon: URL "https://example.com/",
image: URL "https://example.com/",
replyTarget: URL "https://example.com/",
location: URL "https://example.com/",
preview: URL "https://example.com/",
published: 2024-03-03T08:30:06.796196096Z,
replies: URL "https://example.com/",
shares: URL "https://example.com/",
likes: URL "https://example.com/",
emojiReactions: URL "https://example.com/",
startTime: 2024-03-03T08:30:06.796196096Z,
summaries: [ "hello", <en> "hello" ],
tags: [ URL "https://example.com/" ],
updated: 2024-03-03T08:30:06.796196096Z,
urls: [ URL "https://example.com/", Link {} ],
to: URL "https://example.com/",
bto: URL "https://example.com/",
cc: URL "https://example.com/",
bcc: URL "https://example.com/",
mediaType: "hello",
duration: PT1H,
sensitive: true,
source: Source {},
proof: URL "https://example.com/",
interactionPolicy: InteractionPolicy {},
approvedBy: URL "https://example.com/",
likeAuthorization: URL "https://example.com/",
replyAuthorization: URL "https://example.com/",
announceAuthorization: URL "https://example.com/",
purpose: "hello",
publishes: Intent {},
reciprocal: Intent {},
unitBased: true
}'
`;

snapshot[`Deno.inspect(Proposal) [auto] 3`] = `
'Proposal {
id: URL "https://example.com/",
attachments: [ Object {}, Object {} ],
attributions: [ Application {}, Application {} ],
audiences: [ Object {}, Object {} ],
contents: [ "hello", "hello" ],
contexts: [ Object {}, Object {} ],
names: [ "hello", "hello" ],
endTime: 2024-03-03T08:30:06.796196096Z,
generators: [ Object {}, Object {} ],
icons: [ Image {}, Image {} ],
images: [ Image {}, Image {} ],
replyTargets: [ Object {}, Object {} ],
locations: [ Object {}, Object {} ],
previews: [ Link {}, Link {} ],
published: 2024-03-03T08:30:06.796196096Z,
replies: Collection {},
shares: Collection {},
likes: Collection {},
emojiReactions: Collection {},
startTime: 2024-03-03T08:30:06.796196096Z,
summaries: [ "hello", "hello" ],
tags: [ Object {}, Object {} ],
updated: 2024-03-03T08:30:06.796196096Z,
urls: [ URL "https://example.com/", URL "https://example.com/" ],
tos: [ Object {}, Object {} ],
btos: [ Object {}, Object {} ],
ccs: [ Object {}, Object {} ],
bccs: [ Object {}, Object {} ],
mediaType: "hello",
duration: PT1H,
sensitive: true,
source: Source {},
proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ],
interactionPolicy: InteractionPolicy {},
approvedBy: URL "https://example.com/",
likeAuthorization: LikeAuthorization {},
replyAuthorization: ReplyAuthorization {},
announceAuthorization: AnnounceAuthorization {},
purpose: "hello",
publishes: Intent {},
reciprocal: Intent {},
unitBased: true
}'
`;

snapshot[`Deno.inspect(Accept) [auto] 1`] = `
'Accept {
id: URL "https://example.com/",
Expand Down
72 changes: 72 additions & 0 deletions packages/vocab/src/intent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
$schema: ../../vocab-tools/schema.yaml
name: Intent
compactName: Intent
uri: "https://w3id.org/valueflows/ont/vf#Intent"
entity: false
description: |
A proposed economic transaction describing what is being offered or requested
in a {@link Proposal}.
defaultContext:
- "https://www.w3.org/ns/activitystreams"
- vf: "https://w3id.org/valueflows/ont/vf#"
om2: "http://www.ontology-of-units-of-measure.org/resource/om-2/"
Intent: "vf:Intent"
action: "vf:action"
resourceConformsTo:
"@id": "vf:resourceConformsTo"
"@type": "@id"
resourceQuantity: "vf:resourceQuantity"
availableQuantity: "vf:availableQuantity"
minimumQuantity: "vf:minimumQuantity"
hasUnit: "om2:hasUnit"
hasNumericalValue: "om2:hasNumericalValue"

properties:
- singularName: action
functional: true
compactName: action
uri: "https://w3id.org/valueflows/ont/vf#action"
description: |
The type of economic transaction. The value of this property should be
either `"deliverService"` or `"transfer"`.
range:
- "http://www.w3.org/2001/XMLSchema#string"

- singularName: resourceConformsTo
functional: true
compactName: resourceConformsTo
uri: "https://w3id.org/valueflows/ont/vf#resourceConformsTo"
description: |
The type of an economic resource. Could be any URI.
range:
- "http://www.w3.org/2001/XMLSchema#anyURI"

- singularName: resourceQuantity
functional: true
compactName: resourceQuantity
uri: "https://w3id.org/valueflows/ont/vf#resourceQuantity"
untyped: true
description: |
The amount and unit of the economic resource.
range:
- "http://www.ontology-of-units-of-measure.org/resource/om-2/Measure"

- singularName: availableQuantity
functional: true
compactName: availableQuantity
uri: "https://w3id.org/valueflows/ont/vf#availableQuantity"
untyped: true
description: |
The quantity of the offered resource currently available.
range:
- "http://www.ontology-of-units-of-measure.org/resource/om-2/Measure"

- singularName: minimumQuantity
functional: true
compactName: minimumQuantity
uri: "https://w3id.org/valueflows/ont/vf#minimumQuantity"
untyped: true
description: |
The minimum possible quantity of the resource.
range:
- "http://www.ontology-of-units-of-measure.org/resource/om-2/Measure"
32 changes: 32 additions & 0 deletions packages/vocab/src/measure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
$schema: ../../vocab-tools/schema.yaml
name: Measure
compactName: om2:Measure
uri: "http://www.ontology-of-units-of-measure.org/resource/om-2/Measure"
entity: false
description: A quantity with a unit of measure.
defaultContext:
- "https://www.w3.org/ns/activitystreams"
- om2: "http://www.ontology-of-units-of-measure.org/resource/om-2/"
hasUnit: "om2:hasUnit"
hasNumericalValue: "om2:hasNumericalValue"

properties:
- singularName: unit
functional: true
compactName: hasUnit
uri: "http://www.ontology-of-units-of-measure.org/resource/om-2/hasUnit"
description: |
The name of the unit, according to the Ontology of units of Measure
classification. The recommended unit for countable items is `"one"`.
range:
- "http://www.w3.org/2001/XMLSchema#string"

- singularName: numericalValue
functional: true
compactName: hasNumericalValue
uri: "http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue"
description: |
The amount of the resource. If not specified, arbitrary amounts can be
used when responding to the proposal.
range:
- "http://www.w3.org/2001/XMLSchema#decimal"
Loading
Loading