@fedify/vocab 2.3.0-dev.1377 → 2.3.0-dev.1404
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/deno.json +1 -1
- package/dist/mod.cjs +629 -1
- package/dist/mod.d.cts +310 -2
- package/dist/mod.d.ts +310 -2
- package/dist/mod.js +628 -2
- package/dist-tests/{actor-jYtlkHBx.mjs → actor-C8afdVf-.mjs} +2 -2
- package/dist-tests/actor.test.mjs +2 -2
- package/dist-tests/agreement.yaml +68 -0
- package/dist-tests/commitment.yaml +47 -0
- package/dist-tests/lookup.test.mjs +2 -2
- package/dist-tests/type.test.mjs +1 -1
- package/dist-tests/{vocab-BBRml5cy.mjs → vocab-DPq6zc4j.mjs} +629 -1
- package/dist-tests/vocab.test.mjs +208 -1
- package/package.json +4 -4
- package/src/__snapshots__/vocab.test.ts.snap +159 -0
- package/src/agreement.yaml +68 -0
- package/src/commitment.yaml +47 -0
- package/src/vocab.test.ts +342 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import { C as
|
|
3
|
+
import { A as QuoteAuthorization, C as Offer, D as Place, E as Person, F as Tombstone, M as Reject, O as Proposal, P as Source, R as vocab_exports, S as Object$1, _ as InteractionPolicy, b as Measure, c as Create, d as Document, f as Endpoints, g as Intent, h as Hashtag, i as Announce, j as QuoteRequest, k as Question, l as CryptographicKey, n as Activity, o as Collection, p as Follow, r as Agreement, s as Commitment, t as Accept, u as Delete, v as InteractionRule, w as OrderedCollectionPage, x as Note, y as Link } from "./vocab-DPq6zc4j.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";
|
|
@@ -1852,6 +1852,213 @@ test("FEP-fe34: Embedded objects in arrays from JSON-LD respect cross-origin pol
|
|
|
1852
1852
|
assertInstanceOf(items[1], Note);
|
|
1853
1853
|
deepStrictEqual(items[1].content, "Legitimate note from actual origin");
|
|
1854
1854
|
});
|
|
1855
|
+
test("FEP-0837: Commitment roundtrip preserves satisfies and resourceQuantity", async () => {
|
|
1856
|
+
const commitment = new Commitment({
|
|
1857
|
+
id: new URL("https://market.example/agreements/abc#primary"),
|
|
1858
|
+
satisfies: new URL("https://market.example/proposals/abc#primary"),
|
|
1859
|
+
resourceQuantity: new Measure({
|
|
1860
|
+
unit: "one",
|
|
1861
|
+
numericalValue: parseDecimal("1")
|
|
1862
|
+
})
|
|
1863
|
+
});
|
|
1864
|
+
const jsonLd = await commitment.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
1865
|
+
const restored = await Commitment.fromJsonLd(jsonLd, {
|
|
1866
|
+
documentLoader: mockDocumentLoader,
|
|
1867
|
+
contextLoader: mockDocumentLoader
|
|
1868
|
+
});
|
|
1869
|
+
deepStrictEqual(restored.id?.href, commitment.id?.href);
|
|
1870
|
+
deepStrictEqual(restored.satisfies, commitment.satisfies);
|
|
1871
|
+
deepStrictEqual(restored.resourceQuantity?.unit, "one");
|
|
1872
|
+
deepStrictEqual(restored.resourceQuantity?.numericalValue, parseDecimal("1"));
|
|
1873
|
+
});
|
|
1874
|
+
test("FEP-0837: Agreement roundtrip with both commitments", async () => {
|
|
1875
|
+
const agreement = new Agreement({
|
|
1876
|
+
id: new URL("https://market.example/agreements/edc374aa-e580-4a58-9404-f3e8bf8556b2"),
|
|
1877
|
+
attribution: new URL("https://market.example/users/alice"),
|
|
1878
|
+
stipulates: new Commitment({
|
|
1879
|
+
id: new URL("https://market.example/agreements/edc374aa-e580-4a58-9404-f3e8bf8556b2#primary"),
|
|
1880
|
+
satisfies: new URL("https://market.example/proposals/ddde9d6f#primary"),
|
|
1881
|
+
resourceQuantity: new Measure({
|
|
1882
|
+
unit: "one",
|
|
1883
|
+
numericalValue: parseDecimal("1")
|
|
1884
|
+
})
|
|
1885
|
+
}),
|
|
1886
|
+
stipulatesReciprocal: new Commitment({
|
|
1887
|
+
id: new URL("https://market.example/agreements/edc374aa-e580-4a58-9404-f3e8bf8556b2#reciprocal"),
|
|
1888
|
+
satisfies: new URL("https://market.example/proposals/ddde9d6f#reciprocal"),
|
|
1889
|
+
resourceQuantity: new Measure({
|
|
1890
|
+
unit: "currencyAmount",
|
|
1891
|
+
numericalValue: parseDecimal("30.00")
|
|
1892
|
+
})
|
|
1893
|
+
})
|
|
1894
|
+
});
|
|
1895
|
+
const jsonLd = await agreement.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
1896
|
+
const restored = await Agreement.fromJsonLd(jsonLd, {
|
|
1897
|
+
documentLoader: mockDocumentLoader,
|
|
1898
|
+
contextLoader: mockDocumentLoader
|
|
1899
|
+
});
|
|
1900
|
+
deepStrictEqual(restored.id?.href, agreement.id?.href);
|
|
1901
|
+
deepStrictEqual(restored.stipulates?.id?.href, agreement.stipulates?.id?.href);
|
|
1902
|
+
deepStrictEqual(restored.stipulates?.satisfies?.href, agreement.stipulates?.satisfies?.href);
|
|
1903
|
+
deepStrictEqual(restored.stipulates?.resourceQuantity?.numericalValue, parseDecimal("1"));
|
|
1904
|
+
deepStrictEqual(restored.stipulatesReciprocal?.id?.href, agreement.stipulatesReciprocal?.id?.href);
|
|
1905
|
+
deepStrictEqual(restored.stipulatesReciprocal?.satisfies?.href, agreement.stipulatesReciprocal?.satisfies?.href);
|
|
1906
|
+
deepStrictEqual(restored.stipulatesReciprocal?.resourceQuantity?.unit, "currencyAmount");
|
|
1907
|
+
deepStrictEqual(restored.stipulatesReciprocal?.resourceQuantity?.numericalValue, parseDecimal("30.00"));
|
|
1908
|
+
});
|
|
1909
|
+
test("FEP-0837: Agreement parses Accept-result example adapted from spec", async () => {
|
|
1910
|
+
const agreement = await Agreement.fromJsonLd({
|
|
1911
|
+
"@context": ["https://www.w3.org/ns/activitystreams", {
|
|
1912
|
+
vf: "https://w3id.org/valueflows/ont/vf#",
|
|
1913
|
+
Agreement: "vf:Agreement",
|
|
1914
|
+
stipulates: "vf:stipulates",
|
|
1915
|
+
stipulatesReciprocal: "vf:stipulatesReciprocal",
|
|
1916
|
+
Commitment: "vf:Commitment",
|
|
1917
|
+
satisfies: {
|
|
1918
|
+
"@id": "vf:satisfies",
|
|
1919
|
+
"@type": "@id"
|
|
1920
|
+
},
|
|
1921
|
+
resourceQuantity: "vf:resourceQuantity",
|
|
1922
|
+
hasUnit: "om2:hasUnit",
|
|
1923
|
+
hasNumericalValue: "om2:hasNumericalValue",
|
|
1924
|
+
om2: "http://www.ontology-of-units-of-measure.org/resource/om-2/"
|
|
1925
|
+
}],
|
|
1926
|
+
type: "Agreement",
|
|
1927
|
+
id: "https://market.example/agreements/edc374aa-e580-4a58-9404-f3e8bf8556b2",
|
|
1928
|
+
attributedTo: "https://market.example/users/alice",
|
|
1929
|
+
stipulates: {
|
|
1930
|
+
id: "https://market.example/agreements/edc374aa-e580-4a58-9404-f3e8bf8556b2#primary",
|
|
1931
|
+
type: "Commitment",
|
|
1932
|
+
satisfies: "https://market.example/proposals/ddde9d6f-6f3b-4770-a966-3a18ef006930#primary",
|
|
1933
|
+
resourceQuantity: {
|
|
1934
|
+
hasUnit: "one",
|
|
1935
|
+
hasNumericalValue: "1"
|
|
1936
|
+
}
|
|
1937
|
+
},
|
|
1938
|
+
stipulatesReciprocal: {
|
|
1939
|
+
id: "https://market.example/agreements/edc374aa-e580-4a58-9404-f3e8bf8556b2#reciprocal",
|
|
1940
|
+
type: "Commitment",
|
|
1941
|
+
satisfies: "https://market.example/proposals/ddde9d6f-6f3b-4770-a966-3a18ef006930#reciprocal",
|
|
1942
|
+
resourceQuantity: {
|
|
1943
|
+
hasUnit: "currencyAmount",
|
|
1944
|
+
hasNumericalValue: "30.00"
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
}, {
|
|
1948
|
+
documentLoader: mockDocumentLoader,
|
|
1949
|
+
contextLoader: mockDocumentLoader
|
|
1950
|
+
});
|
|
1951
|
+
deepStrictEqual(agreement.id?.href, "https://market.example/agreements/edc374aa-e580-4a58-9404-f3e8bf8556b2");
|
|
1952
|
+
deepStrictEqual(agreement.attributionId?.href, "https://market.example/users/alice");
|
|
1953
|
+
deepStrictEqual(agreement.stipulates?.id?.href, "https://market.example/agreements/edc374aa-e580-4a58-9404-f3e8bf8556b2#primary");
|
|
1954
|
+
deepStrictEqual(agreement.stipulates?.satisfies?.href, "https://market.example/proposals/ddde9d6f-6f3b-4770-a966-3a18ef006930#primary");
|
|
1955
|
+
deepStrictEqual(agreement.stipulates?.resourceQuantity?.numericalValue, parseDecimal("1"));
|
|
1956
|
+
deepStrictEqual(agreement.stipulatesReciprocal?.id?.href, "https://market.example/agreements/edc374aa-e580-4a58-9404-f3e8bf8556b2#reciprocal");
|
|
1957
|
+
deepStrictEqual(agreement.stipulatesReciprocal?.satisfies?.href, "https://market.example/proposals/ddde9d6f-6f3b-4770-a966-3a18ef006930#reciprocal");
|
|
1958
|
+
deepStrictEqual(agreement.stipulatesReciprocal?.resourceQuantity?.numericalValue, parseDecimal("30.00"));
|
|
1959
|
+
});
|
|
1960
|
+
test("FEP-0837: Full marketplace flow - Proposal => Offer => Accept => Confirmation", async () => {
|
|
1961
|
+
const proposal = new Proposal({
|
|
1962
|
+
id: new URL("https://market.example/proposals/ddde9d6f-6f3b-4770-a966-3a18ef006930"),
|
|
1963
|
+
attribution: new URL("https://market.example/users/alice"),
|
|
1964
|
+
purpose: "offer",
|
|
1965
|
+
publishes: new Intent({
|
|
1966
|
+
action: "transfer",
|
|
1967
|
+
resourceConformsTo: new URL("https://www.wikidata.org/wiki/Q11442"),
|
|
1968
|
+
resourceQuantity: new Measure({
|
|
1969
|
+
unit: "one",
|
|
1970
|
+
numericalValue: parseDecimal("1")
|
|
1971
|
+
})
|
|
1972
|
+
}),
|
|
1973
|
+
to: new URL("https://www.w3.org/ns/activitystreams#Public")
|
|
1974
|
+
});
|
|
1975
|
+
ok(proposal.purpose === "offer");
|
|
1976
|
+
const primaryIntent = new URL(`${proposal.id?.href}#primary`);
|
|
1977
|
+
const offerId = new URL("https://social.example/objects/fc4af0d2-c3a1-409b-947c-3c5be29f49b0/offer");
|
|
1978
|
+
const offerJson = await new Offer({
|
|
1979
|
+
id: offerId,
|
|
1980
|
+
actor: new URL("https://social.example/users/bob"),
|
|
1981
|
+
object: new Agreement({ stipulates: new Commitment({
|
|
1982
|
+
satisfies: primaryIntent,
|
|
1983
|
+
resourceQuantity: new Measure({
|
|
1984
|
+
unit: "one",
|
|
1985
|
+
numericalValue: parseDecimal("1")
|
|
1986
|
+
})
|
|
1987
|
+
}) }),
|
|
1988
|
+
to: new URL("https://market.example/users/alice")
|
|
1989
|
+
}).toJsonLd({ contextLoader: mockDocumentLoader });
|
|
1990
|
+
const restoredAgreement = await (await Offer.fromJsonLd(offerJson, {
|
|
1991
|
+
documentLoader: mockDocumentLoader,
|
|
1992
|
+
contextLoader: mockDocumentLoader
|
|
1993
|
+
})).getObject({
|
|
1994
|
+
documentLoader: mockDocumentLoader,
|
|
1995
|
+
contextLoader: mockDocumentLoader
|
|
1996
|
+
});
|
|
1997
|
+
assertInstanceOf(restoredAgreement, Agreement);
|
|
1998
|
+
deepStrictEqual(restoredAgreement.stipulates?.satisfies?.href, primaryIntent.href);
|
|
1999
|
+
deepStrictEqual(restoredAgreement.stipulates?.resourceQuantity?.numericalValue, parseDecimal("1"));
|
|
2000
|
+
const agreementId = new URL("https://market.example/agreements/edc374aa-e580-4a58-9404-f3e8bf8556b2");
|
|
2001
|
+
const acceptJson = await new Accept({
|
|
2002
|
+
id: new URL("https://market.example/activities/059f08fa-31b1-4136-8d76-5987d705a0ab"),
|
|
2003
|
+
actor: new URL("https://market.example/users/alice"),
|
|
2004
|
+
object: offerId,
|
|
2005
|
+
result: new Agreement({
|
|
2006
|
+
id: agreementId,
|
|
2007
|
+
attribution: new URL("https://market.example/users/alice"),
|
|
2008
|
+
stipulates: new Commitment({
|
|
2009
|
+
satisfies: primaryIntent,
|
|
2010
|
+
resourceQuantity: new Measure({
|
|
2011
|
+
unit: "one",
|
|
2012
|
+
numericalValue: parseDecimal("1")
|
|
2013
|
+
})
|
|
2014
|
+
})
|
|
2015
|
+
}),
|
|
2016
|
+
to: new URL("https://social.example/users/bob")
|
|
2017
|
+
}).toJsonLd({ contextLoader: mockDocumentLoader });
|
|
2018
|
+
const acceptRestored = await Accept.fromJsonLd(acceptJson, {
|
|
2019
|
+
documentLoader: mockDocumentLoader,
|
|
2020
|
+
contextLoader: mockDocumentLoader
|
|
2021
|
+
});
|
|
2022
|
+
deepStrictEqual(acceptRestored.objectId?.href, offerId.href);
|
|
2023
|
+
const acceptResult = await acceptRestored.getResult({
|
|
2024
|
+
documentLoader: mockDocumentLoader,
|
|
2025
|
+
contextLoader: mockDocumentLoader
|
|
2026
|
+
});
|
|
2027
|
+
assertInstanceOf(acceptResult, Agreement);
|
|
2028
|
+
deepStrictEqual(acceptResult.id?.href, agreementId.href);
|
|
2029
|
+
const rejectJson = await new Reject({
|
|
2030
|
+
actor: new URL("https://market.example/users/alice"),
|
|
2031
|
+
object: offerId,
|
|
2032
|
+
content: "Not available",
|
|
2033
|
+
to: new URL("https://social.example/users/bob")
|
|
2034
|
+
}).toJsonLd({ contextLoader: mockDocumentLoader });
|
|
2035
|
+
const rejectRestored = await Reject.fromJsonLd(rejectJson, {
|
|
2036
|
+
documentLoader: mockDocumentLoader,
|
|
2037
|
+
contextLoader: mockDocumentLoader
|
|
2038
|
+
});
|
|
2039
|
+
deepStrictEqual(rejectRestored.objectId?.href, offerId.href);
|
|
2040
|
+
deepStrictEqual(rejectRestored.content?.toString(), "Not available");
|
|
2041
|
+
const receiptJson = await new Create({
|
|
2042
|
+
id: new URL("https://market.example/receipts/ad2f7ee1-6567-413e-a10b-72650cbdc743/create"),
|
|
2043
|
+
actor: new URL("https://market.example/users/alice"),
|
|
2044
|
+
object: new Document({
|
|
2045
|
+
id: new URL("https://market.example/receipts/ad2f7ee1-6567-413e-a10b-72650cbdc743"),
|
|
2046
|
+
name: "Receipt",
|
|
2047
|
+
contexts: [agreementId],
|
|
2048
|
+
published: Temporal.Instant.from("2023-07-03T14:13:41.843794Z")
|
|
2049
|
+
}),
|
|
2050
|
+
to: new URL("https://social.example/users/bob")
|
|
2051
|
+
}).toJsonLd({ contextLoader: mockDocumentLoader });
|
|
2052
|
+
const receiptObject = await (await Create.fromJsonLd(receiptJson, {
|
|
2053
|
+
documentLoader: mockDocumentLoader,
|
|
2054
|
+
contextLoader: mockDocumentLoader
|
|
2055
|
+
})).getObject({
|
|
2056
|
+
documentLoader: mockDocumentLoader,
|
|
2057
|
+
contextLoader: mockDocumentLoader
|
|
2058
|
+
});
|
|
2059
|
+
assertInstanceOf(receiptObject, Document);
|
|
2060
|
+
deepStrictEqual(receiptObject.contextIds[0]?.href, agreementId.href);
|
|
2061
|
+
});
|
|
1855
2062
|
function getAllProperties(type, types) {
|
|
1856
2063
|
const props = type.properties;
|
|
1857
2064
|
if (type.extends != null) props.push(...getAllProperties(types[type.extends], types));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/vocab",
|
|
3
|
-
"version": "2.3.0-dev.
|
|
3
|
+
"version": "2.3.0-dev.1404+275c2d11",
|
|
4
4
|
"homepage": "https://fedify.dev/",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"es-toolkit": "1.46.1",
|
|
47
47
|
"jsonld": "^9.0.0",
|
|
48
48
|
"pkijs": "^3.3.3",
|
|
49
|
-
"@fedify/webfinger": "2.3.0-dev.
|
|
50
|
-
"@fedify/vocab-runtime": "2.3.0-dev.
|
|
51
|
-
"@fedify/vocab-tools": "2.3.0-dev.
|
|
49
|
+
"@fedify/webfinger": "2.3.0-dev.1404+275c2d11",
|
|
50
|
+
"@fedify/vocab-runtime": "2.3.0-dev.1404+275c2d11",
|
|
51
|
+
"@fedify/vocab-tools": "2.3.0-dev.1404+275c2d11"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/node": "^22.17.0",
|
|
@@ -1794,6 +1794,165 @@ snapshot[`Deno.inspect(Multikey) [auto] 3`] = `
|
|
|
1794
1794
|
}'
|
|
1795
1795
|
`;
|
|
1796
1796
|
|
|
1797
|
+
snapshot[`Deno.inspect(Agreement) [auto] 1`] = `
|
|
1798
|
+
'Agreement {
|
|
1799
|
+
id: URL "https://example.com/",
|
|
1800
|
+
attachments: [ Object {}, Link {}, PropertyValue {} ],
|
|
1801
|
+
attributions: [ Application {}, Group {}, Organization {}, Person {}, Service {} ],
|
|
1802
|
+
audience: Object {},
|
|
1803
|
+
contents: [ "hello", <en> "hello" ],
|
|
1804
|
+
contexts: [ Object {}, Link {} ],
|
|
1805
|
+
names: [ "hello", <en> "hello" ],
|
|
1806
|
+
endTime: 2024-03-03T08:30:06.796196096Z,
|
|
1807
|
+
generators: [ Object {}, Link {} ],
|
|
1808
|
+
icon: Image {},
|
|
1809
|
+
image: Image {},
|
|
1810
|
+
replyTargets: [ Object {}, Link {} ],
|
|
1811
|
+
locations: [ Object {}, Link {} ],
|
|
1812
|
+
previews: [ Link {}, Object {} ],
|
|
1813
|
+
published: 2024-03-03T08:30:06.796196096Z,
|
|
1814
|
+
replies: Collection {},
|
|
1815
|
+
shares: Collection {},
|
|
1816
|
+
likes: Collection {},
|
|
1817
|
+
emojiReactions: Collection {},
|
|
1818
|
+
startTime: 2024-03-03T08:30:06.796196096Z,
|
|
1819
|
+
summaries: [ "hello", <en> "hello" ],
|
|
1820
|
+
tags: [ Object {}, Link {} ],
|
|
1821
|
+
updated: 2024-03-03T08:30:06.796196096Z,
|
|
1822
|
+
urls: [ URL "https://example.com/", Link {} ],
|
|
1823
|
+
to: Object {},
|
|
1824
|
+
bto: Object {},
|
|
1825
|
+
cc: Object {},
|
|
1826
|
+
bcc: Object {},
|
|
1827
|
+
mediaType: "hello",
|
|
1828
|
+
duration: PT1H,
|
|
1829
|
+
sensitive: true,
|
|
1830
|
+
source: Source {},
|
|
1831
|
+
proof: DataIntegrityProof {},
|
|
1832
|
+
interactionPolicy: InteractionPolicy {},
|
|
1833
|
+
approvedBy: URL "https://example.com/",
|
|
1834
|
+
likeAuthorization: LikeAuthorization {},
|
|
1835
|
+
replyAuthorization: ReplyAuthorization {},
|
|
1836
|
+
announceAuthorization: AnnounceAuthorization {},
|
|
1837
|
+
stipulates: Commitment {},
|
|
1838
|
+
stipulatesReciprocal: Commitment {}
|
|
1839
|
+
}'
|
|
1840
|
+
`;
|
|
1841
|
+
|
|
1842
|
+
snapshot[`Deno.inspect(Agreement) [auto] 2`] = `
|
|
1843
|
+
'Agreement {
|
|
1844
|
+
id: URL "https://example.com/",
|
|
1845
|
+
attachments: [ URL "https://example.com/" ],
|
|
1846
|
+
attribution: URL "https://example.com/",
|
|
1847
|
+
audience: URL "https://example.com/",
|
|
1848
|
+
contents: [ "hello", <en> "hello" ],
|
|
1849
|
+
contexts: [ URL "https://example.com/" ],
|
|
1850
|
+
names: [ "hello", <en> "hello" ],
|
|
1851
|
+
endTime: 2024-03-03T08:30:06.796196096Z,
|
|
1852
|
+
generators: [ URL "https://example.com/" ],
|
|
1853
|
+
icon: URL "https://example.com/",
|
|
1854
|
+
image: URL "https://example.com/",
|
|
1855
|
+
replyTarget: URL "https://example.com/",
|
|
1856
|
+
location: URL "https://example.com/",
|
|
1857
|
+
preview: URL "https://example.com/",
|
|
1858
|
+
published: 2024-03-03T08:30:06.796196096Z,
|
|
1859
|
+
replies: URL "https://example.com/",
|
|
1860
|
+
shares: URL "https://example.com/",
|
|
1861
|
+
likes: URL "https://example.com/",
|
|
1862
|
+
emojiReactions: URL "https://example.com/",
|
|
1863
|
+
startTime: 2024-03-03T08:30:06.796196096Z,
|
|
1864
|
+
summaries: [ "hello", <en> "hello" ],
|
|
1865
|
+
tags: [ URL "https://example.com/" ],
|
|
1866
|
+
updated: 2024-03-03T08:30:06.796196096Z,
|
|
1867
|
+
urls: [ URL "https://example.com/", Link {} ],
|
|
1868
|
+
to: URL "https://example.com/",
|
|
1869
|
+
bto: URL "https://example.com/",
|
|
1870
|
+
cc: URL "https://example.com/",
|
|
1871
|
+
bcc: URL "https://example.com/",
|
|
1872
|
+
mediaType: "hello",
|
|
1873
|
+
duration: PT1H,
|
|
1874
|
+
sensitive: true,
|
|
1875
|
+
source: Source {},
|
|
1876
|
+
proof: URL "https://example.com/",
|
|
1877
|
+
interactionPolicy: InteractionPolicy {},
|
|
1878
|
+
approvedBy: URL "https://example.com/",
|
|
1879
|
+
likeAuthorization: URL "https://example.com/",
|
|
1880
|
+
replyAuthorization: URL "https://example.com/",
|
|
1881
|
+
announceAuthorization: URL "https://example.com/",
|
|
1882
|
+
stipulates: Commitment {},
|
|
1883
|
+
stipulatesReciprocal: Commitment {}
|
|
1884
|
+
}'
|
|
1885
|
+
`;
|
|
1886
|
+
|
|
1887
|
+
snapshot[`Deno.inspect(Agreement) [auto] 3`] = `
|
|
1888
|
+
'Agreement {
|
|
1889
|
+
id: URL "https://example.com/",
|
|
1890
|
+
attachments: [ Object {}, Object {} ],
|
|
1891
|
+
attributions: [ Application {}, Application {} ],
|
|
1892
|
+
audiences: [ Object {}, Object {} ],
|
|
1893
|
+
contents: [ "hello", "hello" ],
|
|
1894
|
+
contexts: [ Object {}, Object {} ],
|
|
1895
|
+
names: [ "hello", "hello" ],
|
|
1896
|
+
endTime: 2024-03-03T08:30:06.796196096Z,
|
|
1897
|
+
generators: [ Object {}, Object {} ],
|
|
1898
|
+
icons: [ Image {}, Image {} ],
|
|
1899
|
+
images: [ Image {}, Image {} ],
|
|
1900
|
+
replyTargets: [ Object {}, Object {} ],
|
|
1901
|
+
locations: [ Object {}, Object {} ],
|
|
1902
|
+
previews: [ Link {}, Link {} ],
|
|
1903
|
+
published: 2024-03-03T08:30:06.796196096Z,
|
|
1904
|
+
replies: Collection {},
|
|
1905
|
+
shares: Collection {},
|
|
1906
|
+
likes: Collection {},
|
|
1907
|
+
emojiReactions: Collection {},
|
|
1908
|
+
startTime: 2024-03-03T08:30:06.796196096Z,
|
|
1909
|
+
summaries: [ "hello", "hello" ],
|
|
1910
|
+
tags: [ Object {}, Object {} ],
|
|
1911
|
+
updated: 2024-03-03T08:30:06.796196096Z,
|
|
1912
|
+
urls: [ URL "https://example.com/", URL "https://example.com/" ],
|
|
1913
|
+
tos: [ Object {}, Object {} ],
|
|
1914
|
+
btos: [ Object {}, Object {} ],
|
|
1915
|
+
ccs: [ Object {}, Object {} ],
|
|
1916
|
+
bccs: [ Object {}, Object {} ],
|
|
1917
|
+
mediaType: "hello",
|
|
1918
|
+
duration: PT1H,
|
|
1919
|
+
sensitive: true,
|
|
1920
|
+
source: Source {},
|
|
1921
|
+
proofs: [ DataIntegrityProof {}, DataIntegrityProof {} ],
|
|
1922
|
+
interactionPolicy: InteractionPolicy {},
|
|
1923
|
+
approvedBy: URL "https://example.com/",
|
|
1924
|
+
likeAuthorization: LikeAuthorization {},
|
|
1925
|
+
replyAuthorization: ReplyAuthorization {},
|
|
1926
|
+
announceAuthorization: AnnounceAuthorization {},
|
|
1927
|
+
stipulates: Commitment {},
|
|
1928
|
+
stipulatesReciprocal: Commitment {}
|
|
1929
|
+
}'
|
|
1930
|
+
`;
|
|
1931
|
+
|
|
1932
|
+
snapshot[`Deno.inspect(Commitment) [auto] 1`] = `
|
|
1933
|
+
'Commitment {
|
|
1934
|
+
id: URL "https://example.com/",
|
|
1935
|
+
satisfies: URL "https://example.com/",
|
|
1936
|
+
resourceQuantity: Measure {}
|
|
1937
|
+
}'
|
|
1938
|
+
`;
|
|
1939
|
+
|
|
1940
|
+
snapshot[`Deno.inspect(Commitment) [auto] 2`] = `
|
|
1941
|
+
'Commitment {
|
|
1942
|
+
id: URL "https://example.com/",
|
|
1943
|
+
satisfies: URL "https://example.com/",
|
|
1944
|
+
resourceQuantity: Measure {}
|
|
1945
|
+
}'
|
|
1946
|
+
`;
|
|
1947
|
+
|
|
1948
|
+
snapshot[`Deno.inspect(Commitment) [auto] 3`] = `
|
|
1949
|
+
'Commitment {
|
|
1950
|
+
id: URL "https://example.com/",
|
|
1951
|
+
satisfies: URL "https://example.com/",
|
|
1952
|
+
resourceQuantity: Measure {}
|
|
1953
|
+
}'
|
|
1954
|
+
`;
|
|
1955
|
+
|
|
1797
1956
|
snapshot[`Deno.inspect(Intent) [auto] 1`] = `
|
|
1798
1957
|
'Intent {
|
|
1799
1958
|
id: URL "https://example.com/",
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
$schema: ../../vocab-tools/schema.yaml
|
|
2
|
+
name: Agreement
|
|
3
|
+
compactName: Agreement
|
|
4
|
+
uri: "https://w3id.org/valueflows/ont/vf#Agreement"
|
|
5
|
+
extends: "https://www.w3.org/ns/activitystreams#Object"
|
|
6
|
+
entity: true
|
|
7
|
+
description: |
|
|
8
|
+
The agreement reached between parties responding to a {@link Proposal}.
|
|
9
|
+
|
|
10
|
+
An interested party sends an `Agreement` wrapped in an {@link Offer}
|
|
11
|
+
activity. The proposing party then either finalizes the agreement by
|
|
12
|
+
sending an {@link Accept} activity with the finalized `Agreement` as
|
|
13
|
+
its `result`, or sends a {@link Reject} activity.
|
|
14
|
+
|
|
15
|
+
Note: This type extends ActivityStreams `Object` for practical
|
|
16
|
+
interoperability within ActivityPub federation, even though FEP-0837
|
|
17
|
+
defines `Agreement` as a pure ValueFlows type. Extending `Object`
|
|
18
|
+
provides useful inherited properties such as `id`, `attributedTo`,
|
|
19
|
+
`url`, `to`, and `published` without needing to redefine them.
|
|
20
|
+
# NOTE: The context includes mappings for Commitment and Measure properties
|
|
21
|
+
# (satisfies, resourceQuantity, hasUnit, hasNumericalValue) because the
|
|
22
|
+
# code generator does not automatically merge contexts from referenced
|
|
23
|
+
# types. Agreement must declare all mappings needed for correct JSON-LD
|
|
24
|
+
# serialization of its embedded Commitment 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
|
+
Agreement: "vf:Agreement"
|
|
37
|
+
Commitment: "vf:Commitment"
|
|
38
|
+
stipulates: "vf:stipulates"
|
|
39
|
+
stipulatesReciprocal: "vf:stipulatesReciprocal"
|
|
40
|
+
satisfies:
|
|
41
|
+
"@id": "vf:satisfies"
|
|
42
|
+
"@type": "@id"
|
|
43
|
+
resourceQuantity: "vf:resourceQuantity"
|
|
44
|
+
hasUnit: "om2:hasUnit"
|
|
45
|
+
hasNumericalValue: "om2:hasNumericalValue"
|
|
46
|
+
|
|
47
|
+
properties:
|
|
48
|
+
- singularName: stipulates
|
|
49
|
+
functional: true
|
|
50
|
+
compactName: stipulates
|
|
51
|
+
uri: "https://w3id.org/valueflows/ont/vf#stipulates"
|
|
52
|
+
description: |
|
|
53
|
+
The primary {@link Commitment} associated with the agreement. This
|
|
54
|
+
commitment satisfies the primary {@link Intent} of the corresponding
|
|
55
|
+
{@link Proposal}.
|
|
56
|
+
range:
|
|
57
|
+
- "https://w3id.org/valueflows/ont/vf#Commitment"
|
|
58
|
+
|
|
59
|
+
- singularName: stipulatesReciprocal
|
|
60
|
+
functional: true
|
|
61
|
+
compactName: stipulatesReciprocal
|
|
62
|
+
uri: "https://w3id.org/valueflows/ont/vf#stipulatesReciprocal"
|
|
63
|
+
description: |
|
|
64
|
+
The reciprocal {@link Commitment} associated with the agreement.
|
|
65
|
+
Required if the corresponding {@link Proposal} has a reciprocal
|
|
66
|
+
{@link Intent}.
|
|
67
|
+
range:
|
|
68
|
+
- "https://w3id.org/valueflows/ont/vf#Commitment"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
$schema: ../../vocab-tools/schema.yaml
|
|
2
|
+
name: Commitment
|
|
3
|
+
compactName: Commitment
|
|
4
|
+
uri: "https://w3id.org/valueflows/ont/vf#Commitment"
|
|
5
|
+
entity: false
|
|
6
|
+
description: |
|
|
7
|
+
A promised economic transaction, referenced by an {@link Agreement}.
|
|
8
|
+
|
|
9
|
+
A commitment satisfies an {@link Intent} of a {@link Proposal} and
|
|
10
|
+
specifies the actual amount of the economic resource being committed.
|
|
11
|
+
defaultContext:
|
|
12
|
+
- "https://www.w3.org/ns/activitystreams"
|
|
13
|
+
- vf: "https://w3id.org/valueflows/ont/vf#"
|
|
14
|
+
om2: "http://www.ontology-of-units-of-measure.org/resource/om-2/"
|
|
15
|
+
Commitment: "vf:Commitment"
|
|
16
|
+
satisfies:
|
|
17
|
+
"@id": "vf:satisfies"
|
|
18
|
+
"@type": "@id"
|
|
19
|
+
resourceQuantity: "vf:resourceQuantity"
|
|
20
|
+
hasUnit: "om2:hasUnit"
|
|
21
|
+
hasNumericalValue: "om2:hasNumericalValue"
|
|
22
|
+
|
|
23
|
+
properties:
|
|
24
|
+
- singularName: satisfies
|
|
25
|
+
functional: true
|
|
26
|
+
compactName: satisfies
|
|
27
|
+
uri: "https://w3id.org/valueflows/ont/vf#satisfies"
|
|
28
|
+
description: |
|
|
29
|
+
The {@link Intent} of a {@link Proposal} that this commitment
|
|
30
|
+
satisfies. The value is the proposal's URI with a
|
|
31
|
+
[fragment](https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Fragment)
|
|
32
|
+
appended to identify the intent. Recommended fragments are
|
|
33
|
+
`primary` and `reciprocal`.
|
|
34
|
+
range:
|
|
35
|
+
- "http://www.w3.org/2001/XMLSchema#anyURI"
|
|
36
|
+
|
|
37
|
+
- singularName: resourceQuantity
|
|
38
|
+
functional: true
|
|
39
|
+
compactName: resourceQuantity
|
|
40
|
+
uri: "https://w3id.org/valueflows/ont/vf#resourceQuantity"
|
|
41
|
+
untyped: true
|
|
42
|
+
description: |
|
|
43
|
+
The amount and unit of the economic resource being committed. The
|
|
44
|
+
unit must match the unit specified in the corresponding {@link Intent}
|
|
45
|
+
of the proposal.
|
|
46
|
+
range:
|
|
47
|
+
- "http://www.ontology-of-units-of-measure.org/resource/om-2/Measure"
|