@fedify/vocab 2.5.0-dev.2562 → 2.5.0-dev.2597
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 +792 -248
- package/dist/mod.d.cts +50 -0
- package/dist/mod.d.ts +50 -0
- package/dist/mod.js +792 -248
- package/dist-tests/{actor-BjR7XMY3.mjs → actor-Bv4E58SY.mjs} +2 -2
- package/dist-tests/actor.test.mjs +2 -2
- package/dist-tests/application.yaml +16 -0
- package/dist-tests/attribution-domains.test.mjs +122 -0
- package/dist-tests/deep-clone.test.mjs +1 -1
- package/dist-tests/gateway.test.mjs +2 -2
- package/dist-tests/group.yaml +16 -0
- package/dist-tests/license.test.mjs +2 -2
- package/dist-tests/{lookup-DLoLCARL.mjs → lookup-CE08Sr09.mjs} +2 -2
- package/dist-tests/lookup.test.mjs +2 -2
- package/dist-tests/organization.yaml +16 -0
- package/dist-tests/person.yaml +16 -0
- package/dist-tests/portable-lookup.test.mjs +3 -3
- package/dist-tests/service.yaml +16 -0
- package/dist-tests/signed-representation.test.mjs +1 -1
- package/dist-tests/sparse-arrays.test.mjs +1 -1
- package/dist-tests/{src-l_qXemk3.mjs → src-BfQX2hVK.mjs} +3 -3
- package/dist-tests/translation.test.mjs +2 -2
- package/dist-tests/type.test.mjs +1 -1
- package/dist-tests/update.yaml +3 -0
- package/dist-tests/{vocab-fx-0u7cy.mjs → vocab-BcGkZqeH.mjs} +791 -247
- package/dist-tests/vocab.test.mjs +12 -3
- package/package.json +5 -5
- package/src/__snapshots__/vocab.test.ts.snap +15 -0
- package/src/application.yaml +16 -0
- package/src/attribution-domains.test.ts +177 -0
- package/src/group.yaml +16 -0
- package/src/organization.yaml +16 -0
- package/src/person.yaml +16 -0
- package/src/service.yaml +16 -0
- package/src/update.yaml +3 -0
- package/src/vocab.test.ts +8 -0
- package/tsconfig.check.json +14 -0
|
@@ -2,7 +2,7 @@ import { Temporal } from "temporal-polyfill";
|
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
3
|
import { i as __toESM } from "./rolldown-runtime-BWJg4WE8.mjs";
|
|
4
4
|
import { t as esm_default } from "./esm-BIqRhjGA.mjs";
|
|
5
|
-
import { A as Note, B as Question, C as Image, D as Link, E as InteractionRule, F as Organization, G as Source, H as QuoteRequest, I as Person, K as Tombstone, L as Place, M as Offer, O as Measure, P as OrderedCollectionPage, Q as vocab_exports, R as PropertyValue, S as Hashtag, T as InteractionPolicy, U as Reject, V as QuoteAuthorization, W as Service, _ as FeatureRequest, a as Application, b as Follow, d as CryptographicKey, g as FeatureAuthorization, h as Endpoints, i as Announce, j as Object$1, k as Multikey, l as Commitment, m as Document, n as Activity, p as Delete, r as Agreement, s as Collection, t as Accept, u as Create, v as FeaturedCollection, w as Intent, x as Group, y as FeaturedItem, z as Proposal } from "./vocab-
|
|
5
|
+
import { A as Note, B as Question, C as Image, D as Link, E as InteractionRule, F as Organization, G as Source, H as QuoteRequest, I as Person, K as Tombstone, L as Place, M as Offer, O as Measure, P as OrderedCollectionPage, Q as vocab_exports, R as PropertyValue, S as Hashtag, T as InteractionPolicy, U as Reject, V as QuoteAuthorization, W as Service, _ as FeatureRequest, a as Application, b as Follow, d as CryptographicKey, g as FeatureAuthorization, h as Endpoints, i as Announce, j as Object$1, k as Multikey, l as Commitment, m as Document, n as Activity, p as Delete, r as Agreement, s as Collection, t as Accept, u as Create, v as FeaturedCollection, w as Intent, x as Group, y as FeaturedItem, z as Proposal } from "./vocab-BcGkZqeH.mjs";
|
|
6
6
|
import { t as assertInstanceOf } from "./utils-Df2odC27.mjs";
|
|
7
7
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
8
8
|
import { deepStrictEqual, notDeepStrictEqual, ok, rejects, strictEqual, throws } from "node:assert/strict";
|
|
@@ -17,7 +17,7 @@ import { areAllScalarTypes, loadSchemaFiles } from "@fedify/vocab-tools";
|
|
|
17
17
|
import { inspect } from "node:util";
|
|
18
18
|
//#region ../vocab-runtime/deno.json
|
|
19
19
|
var name = "@fedify/vocab-runtime";
|
|
20
|
-
var version = "2.5.0-dev.
|
|
20
|
+
var version = "2.5.0-dev.2597+7bed9e2b";
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region ../vocab-runtime/src/url.ts
|
|
23
23
|
var UrlError = class extends Error {
|
|
@@ -318,7 +318,8 @@ function createActivityPubRequest(url, options = {}) {
|
|
|
318
318
|
*/
|
|
319
319
|
function getUserAgent({ software, url } = {}) {
|
|
320
320
|
const fedify = `Fedify/${version}`;
|
|
321
|
-
const
|
|
321
|
+
const deno = globalThis.Deno;
|
|
322
|
+
const runtime = deno?.version?.deno != null ? `Deno/${deno.version.deno}` : globalThis.process?.versions?.bun != null ? `Bun/${process.versions.bun}` : "navigator" in globalThis && navigator.userAgent === "Cloudflare-Workers" ? navigator.userAgent : globalThis.process?.versions?.node != null ? `Node.js/${process.versions.node}` : null;
|
|
322
323
|
const userAgent = software == null ? [fedify] : [software, fedify];
|
|
323
324
|
if (runtime != null) userAgent.push(runtime);
|
|
324
325
|
if (url != null) userAgent.push(`+${url.toString()}`);
|
|
@@ -7709,6 +7710,10 @@ test("Person.toJsonLd()", async () => {
|
|
|
7709
7710
|
"@id": "toot:featuredTags",
|
|
7710
7711
|
"@type": "@id"
|
|
7711
7712
|
},
|
|
7713
|
+
attributionDomains: {
|
|
7714
|
+
"@id": "toot:attributionDomains",
|
|
7715
|
+
"@container": "@set"
|
|
7716
|
+
},
|
|
7712
7717
|
indexable: "toot:indexable",
|
|
7713
7718
|
_misskey_followedMessage: "misskey:_misskey_followedMessage",
|
|
7714
7719
|
isCat: "misskey:isCat",
|
|
@@ -8209,6 +8214,10 @@ test("InteractionPolicy.canFeature", async () => {
|
|
|
8209
8214
|
"@id": "toot:featuredTags",
|
|
8210
8215
|
"@type": "@id"
|
|
8211
8216
|
},
|
|
8217
|
+
attributionDomains: {
|
|
8218
|
+
"@id": "toot:attributionDomains",
|
|
8219
|
+
"@container": "@set"
|
|
8220
|
+
},
|
|
8212
8221
|
indexable: "toot:indexable",
|
|
8213
8222
|
isCat: "misskey:isCat",
|
|
8214
8223
|
manuallyApprovesFollowers: "as:manuallyApprovesFollowers",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/vocab",
|
|
3
|
-
"version": "2.5.0-dev.
|
|
3
|
+
"version": "2.5.0-dev.2597+7bed9e2b",
|
|
4
4
|
"homepage": "https://fedify.dev/",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"jsonld": "^9.0.0",
|
|
44
44
|
"pkijs": "^3.3.3",
|
|
45
45
|
"temporal-polyfill": "^1.0.1",
|
|
46
|
-
"@fedify/vocab-tools": "2.5.0-dev.
|
|
47
|
-
"@fedify/webfinger": "2.5.0-dev.
|
|
48
|
-
"@fedify/vocab-runtime": "2.5.0-dev.
|
|
46
|
+
"@fedify/vocab-tools": "2.5.0-dev.2597+7bed9e2b",
|
|
47
|
+
"@fedify/webfinger": "2.5.0-dev.2597+7bed9e2b",
|
|
48
|
+
"@fedify/vocab-runtime": "2.5.0-dev.2597+7bed9e2b"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@dprint/formatter": "0.6.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"fast-check": "^3.22.0",
|
|
55
55
|
"fetch-mock": "^12.5.4",
|
|
56
56
|
"tsdown": "^0.22.0",
|
|
57
|
-
"typescript": "^6.0.
|
|
57
|
+
"typescript": "^6.0.3",
|
|
58
58
|
"@fedify/fixture": "2.0.0"
|
|
59
59
|
},
|
|
60
60
|
"keywords": [
|
|
@@ -3628,6 +3628,7 @@ snapshot[`Deno.inspect(Application) [auto] 1`] = `
|
|
|
3628
3628
|
suspended: true,
|
|
3629
3629
|
memorial: true,
|
|
3630
3630
|
indexable: true,
|
|
3631
|
+
attributionDomains: [ "hello" ],
|
|
3631
3632
|
successor: Application {},
|
|
3632
3633
|
aliases: [ Application {}, Group {}, Organization {}, Person {}, Service {} ],
|
|
3633
3634
|
service: DidService {},
|
|
@@ -3698,6 +3699,7 @@ snapshot[`Deno.inspect(Application) [auto] 2`] = `
|
|
|
3698
3699
|
suspended: true,
|
|
3699
3700
|
memorial: true,
|
|
3700
3701
|
indexable: true,
|
|
3702
|
+
attributionDomains: [ "hello" ],
|
|
3701
3703
|
successor: URL "https://example.com/",
|
|
3702
3704
|
alias: URL "https://example.com/",
|
|
3703
3705
|
service: URL "https://example.com/",
|
|
@@ -3771,6 +3773,7 @@ snapshot[`Deno.inspect(Application) [auto] 3`] = `
|
|
|
3771
3773
|
suspended: true,
|
|
3772
3774
|
memorial: true,
|
|
3773
3775
|
indexable: true,
|
|
3776
|
+
attributionDomains: [ "hello", "hello" ],
|
|
3774
3777
|
successor: Application {},
|
|
3775
3778
|
aliases: [ Application {}, Application {} ],
|
|
3776
3779
|
services: [ DidService {}, DidService {} ],
|
|
@@ -5914,6 +5917,7 @@ snapshot[`Deno.inspect(Group) [auto] 1`] = `
|
|
|
5914
5917
|
suspended: true,
|
|
5915
5918
|
memorial: true,
|
|
5916
5919
|
indexable: true,
|
|
5920
|
+
attributionDomains: [ "hello" ],
|
|
5917
5921
|
successor: Application {},
|
|
5918
5922
|
aliases: [ Application {}, Group {}, Organization {}, Person {}, Service {} ],
|
|
5919
5923
|
service: DidService {},
|
|
@@ -5984,6 +5988,7 @@ snapshot[`Deno.inspect(Group) [auto] 2`] = `
|
|
|
5984
5988
|
suspended: true,
|
|
5985
5989
|
memorial: true,
|
|
5986
5990
|
indexable: true,
|
|
5991
|
+
attributionDomains: [ "hello" ],
|
|
5987
5992
|
successor: URL "https://example.com/",
|
|
5988
5993
|
alias: URL "https://example.com/",
|
|
5989
5994
|
service: URL "https://example.com/",
|
|
@@ -6057,6 +6062,7 @@ snapshot[`Deno.inspect(Group) [auto] 3`] = `
|
|
|
6057
6062
|
suspended: true,
|
|
6058
6063
|
memorial: true,
|
|
6059
6064
|
indexable: true,
|
|
6065
|
+
attributionDomains: [ "hello", "hello" ],
|
|
6060
6066
|
successor: Application {},
|
|
6061
6067
|
aliases: [ Application {}, Application {} ],
|
|
6062
6068
|
services: [ DidService {}, DidService {} ],
|
|
@@ -8581,6 +8587,7 @@ snapshot[`Deno.inspect(Organization) [auto] 1`] = `
|
|
|
8581
8587
|
suspended: true,
|
|
8582
8588
|
memorial: true,
|
|
8583
8589
|
indexable: true,
|
|
8590
|
+
attributionDomains: [ "hello" ],
|
|
8584
8591
|
successor: Application {},
|
|
8585
8592
|
aliases: [ Application {}, Group {}, Organization {}, Person {}, Service {} ],
|
|
8586
8593
|
service: DidService {},
|
|
@@ -8651,6 +8658,7 @@ snapshot[`Deno.inspect(Organization) [auto] 2`] = `
|
|
|
8651
8658
|
suspended: true,
|
|
8652
8659
|
memorial: true,
|
|
8653
8660
|
indexable: true,
|
|
8661
|
+
attributionDomains: [ "hello" ],
|
|
8654
8662
|
successor: URL "https://example.com/",
|
|
8655
8663
|
alias: URL "https://example.com/",
|
|
8656
8664
|
service: URL "https://example.com/",
|
|
@@ -8724,6 +8732,7 @@ snapshot[`Deno.inspect(Organization) [auto] 3`] = `
|
|
|
8724
8732
|
suspended: true,
|
|
8725
8733
|
memorial: true,
|
|
8726
8734
|
indexable: true,
|
|
8735
|
+
attributionDomains: [ "hello", "hello" ],
|
|
8727
8736
|
successor: Application {},
|
|
8728
8737
|
aliases: [ Application {}, Application {} ],
|
|
8729
8738
|
services: [ DidService {}, DidService {} ],
|
|
@@ -8941,6 +8950,7 @@ snapshot[`Deno.inspect(Person) [auto] 1`] = `
|
|
|
8941
8950
|
suspended: true,
|
|
8942
8951
|
memorial: true,
|
|
8943
8952
|
indexable: true,
|
|
8953
|
+
attributionDomains: [ "hello" ],
|
|
8944
8954
|
successor: Application {},
|
|
8945
8955
|
aliases: [ Application {}, Group {}, Organization {}, Person {}, Service {} ],
|
|
8946
8956
|
service: DidService {},
|
|
@@ -9011,6 +9021,7 @@ snapshot[`Deno.inspect(Person) [auto] 2`] = `
|
|
|
9011
9021
|
suspended: true,
|
|
9012
9022
|
memorial: true,
|
|
9013
9023
|
indexable: true,
|
|
9024
|
+
attributionDomains: [ "hello" ],
|
|
9014
9025
|
successor: URL "https://example.com/",
|
|
9015
9026
|
alias: URL "https://example.com/",
|
|
9016
9027
|
service: URL "https://example.com/",
|
|
@@ -9084,6 +9095,7 @@ snapshot[`Deno.inspect(Person) [auto] 3`] = `
|
|
|
9084
9095
|
suspended: true,
|
|
9085
9096
|
memorial: true,
|
|
9086
9097
|
indexable: true,
|
|
9098
|
+
attributionDomains: [ "hello", "hello" ],
|
|
9087
9099
|
successor: Application {},
|
|
9088
9100
|
aliases: [ Application {}, Application {} ],
|
|
9089
9101
|
services: [ DidService {}, DidService {} ],
|
|
@@ -10243,6 +10255,7 @@ snapshot[`Deno.inspect(Service) [auto] 1`] = `
|
|
|
10243
10255
|
suspended: true,
|
|
10244
10256
|
memorial: true,
|
|
10245
10257
|
indexable: true,
|
|
10258
|
+
attributionDomains: [ "hello" ],
|
|
10246
10259
|
successor: Application {},
|
|
10247
10260
|
aliases: [ Application {}, Group {}, Organization {}, Person {}, Service {} ],
|
|
10248
10261
|
service: DidService {},
|
|
@@ -10313,6 +10326,7 @@ snapshot[`Deno.inspect(Service) [auto] 2`] = `
|
|
|
10313
10326
|
suspended: true,
|
|
10314
10327
|
memorial: true,
|
|
10315
10328
|
indexable: true,
|
|
10329
|
+
attributionDomains: [ "hello" ],
|
|
10316
10330
|
successor: URL "https://example.com/",
|
|
10317
10331
|
alias: URL "https://example.com/",
|
|
10318
10332
|
service: URL "https://example.com/",
|
|
@@ -10386,6 +10400,7 @@ snapshot[`Deno.inspect(Service) [auto] 3`] = `
|
|
|
10386
10400
|
suspended: true,
|
|
10387
10401
|
memorial: true,
|
|
10388
10402
|
indexable: true,
|
|
10403
|
+
attributionDomains: [ "hello", "hello" ],
|
|
10389
10404
|
successor: Application {},
|
|
10390
10405
|
aliases: [ Application {}, Application {} ],
|
|
10391
10406
|
services: [ DidService {}, DidService {} ],
|
package/src/application.yaml
CHANGED
|
@@ -36,6 +36,9 @@ defaultContext:
|
|
|
36
36
|
suspended: "toot:suspended"
|
|
37
37
|
memorial: "toot:memorial"
|
|
38
38
|
indexable: "toot:indexable"
|
|
39
|
+
attributionDomains:
|
|
40
|
+
"@id": "toot:attributionDomains"
|
|
41
|
+
"@container": "@set"
|
|
39
42
|
schema: "http://schema.org#"
|
|
40
43
|
PropertyValue: "schema:PropertyValue"
|
|
41
44
|
value: "schema:value"
|
|
@@ -284,6 +287,19 @@ properties:
|
|
|
284
287
|
range:
|
|
285
288
|
- "http://www.w3.org/2001/XMLSchema#boolean"
|
|
286
289
|
|
|
290
|
+
- pluralName: attributionDomains
|
|
291
|
+
singularName: attributionDomain
|
|
292
|
+
compactName: attributionDomains
|
|
293
|
+
uri: "http://joinmastodon.org/ns#attributionDomains"
|
|
294
|
+
description: |
|
|
295
|
+
Domains this actor claims as its own, so that Mastodon can credit the
|
|
296
|
+
actor on link preview cards that point at one of them. Each value is a
|
|
297
|
+
bare host name, without a scheme, port, path, or leading `*.`. Fedify
|
|
298
|
+
treats the values as opaque strings and does not normalize or validate
|
|
299
|
+
them; applications are responsible for producing normalized host names.
|
|
300
|
+
range:
|
|
301
|
+
- "http://www.w3.org/2001/XMLSchema#string"
|
|
302
|
+
|
|
287
303
|
- singularName: successor
|
|
288
304
|
functional: true
|
|
289
305
|
compactName: movedTo
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { test } from "@fedify/fixture";
|
|
2
|
+
import { deepStrictEqual, ok } from "node:assert/strict";
|
|
3
|
+
import {
|
|
4
|
+
Application,
|
|
5
|
+
Group,
|
|
6
|
+
type Object as ASObject,
|
|
7
|
+
Organization,
|
|
8
|
+
Person,
|
|
9
|
+
Service,
|
|
10
|
+
Update,
|
|
11
|
+
} from "./mod.ts";
|
|
12
|
+
|
|
13
|
+
const AS = "https://www.w3.org/ns/activitystreams";
|
|
14
|
+
const MASTODON = "http://joinmastodon.org/ns";
|
|
15
|
+
const aliceId = new URL("https://social.example/users/alice");
|
|
16
|
+
const updateId = new URL("https://social.example/activities/1");
|
|
17
|
+
|
|
18
|
+
interface ActorLike extends ASObject {
|
|
19
|
+
attributionDomains: string[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface ActorConstructor {
|
|
23
|
+
new (values: {
|
|
24
|
+
id: URL;
|
|
25
|
+
attributionDomains: string[];
|
|
26
|
+
}): ActorLike;
|
|
27
|
+
fromJsonLd(
|
|
28
|
+
document: unknown,
|
|
29
|
+
options?: { documentLoader?: DocumentLoader },
|
|
30
|
+
): Promise<ActorLike>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface DocumentLoader {
|
|
34
|
+
(url: string): Promise<{
|
|
35
|
+
contextUrl: string | null;
|
|
36
|
+
documentUrl: string;
|
|
37
|
+
document: unknown;
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function record(value: unknown): Record<string, unknown> {
|
|
42
|
+
ok(value != null && typeof value === "object" && !Array.isArray(value));
|
|
43
|
+
return value as Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
test("attributionDomains round-trips through every actor type", async () => {
|
|
47
|
+
const actorTypes: [string, ActorConstructor][] = [
|
|
48
|
+
["Application", Application],
|
|
49
|
+
["Group", Group],
|
|
50
|
+
["Organization", Organization],
|
|
51
|
+
["Person", Person],
|
|
52
|
+
["Service", Service],
|
|
53
|
+
];
|
|
54
|
+
for (const [name, Actor] of actorTypes) {
|
|
55
|
+
const id = new URL(`https://social.example/${name.toLowerCase()}/alice`);
|
|
56
|
+
const actor = new Actor({
|
|
57
|
+
id,
|
|
58
|
+
attributionDomains: ["blog.example", "photos.example"],
|
|
59
|
+
});
|
|
60
|
+
const json = record(await actor.toJsonLd());
|
|
61
|
+
deepStrictEqual(json.attributionDomains, [
|
|
62
|
+
"blog.example",
|
|
63
|
+
"photos.example",
|
|
64
|
+
]);
|
|
65
|
+
|
|
66
|
+
const context = json["@context"] as unknown[];
|
|
67
|
+
deepStrictEqual(record(context.at(-1))["attributionDomains"], {
|
|
68
|
+
"@id": "toot:attributionDomains",
|
|
69
|
+
"@container": "@set",
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const parsed = await Actor.fromJsonLd(json);
|
|
73
|
+
deepStrictEqual(parsed.id, id);
|
|
74
|
+
deepStrictEqual(parsed.attributionDomains, [
|
|
75
|
+
"blog.example",
|
|
76
|
+
"photos.example",
|
|
77
|
+
]);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test("attributionDomains single value fast path and compact form", async () => {
|
|
82
|
+
const person = new Person({
|
|
83
|
+
id: aliceId,
|
|
84
|
+
attributionDomains: ["blog.example"],
|
|
85
|
+
});
|
|
86
|
+
const compactDefault = record(await person.toJsonLd());
|
|
87
|
+
deepStrictEqual(compactDefault.attributionDomains, "blog.example");
|
|
88
|
+
|
|
89
|
+
const compact = record(await person.toJsonLd({ format: "compact" }));
|
|
90
|
+
deepStrictEqual(compact.attributionDomains, ["blog.example"]);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test("attributionDomains omitted when missing or empty", async () => {
|
|
94
|
+
for (
|
|
95
|
+
const person of [
|
|
96
|
+
new Person({ id: aliceId }),
|
|
97
|
+
new Person({ id: aliceId, attributionDomains: [] }),
|
|
98
|
+
]
|
|
99
|
+
) {
|
|
100
|
+
const json = record(await person.toJsonLd());
|
|
101
|
+
ok(!("attributionDomains" in json));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const parsed = await Person.fromJsonLd({
|
|
105
|
+
"@context": AS,
|
|
106
|
+
id: aliceId.href,
|
|
107
|
+
type: "Person",
|
|
108
|
+
});
|
|
109
|
+
deepStrictEqual(parsed.attributionDomains, []);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test("attributionDomains ignores non-string values", async () => {
|
|
113
|
+
const person = await Person.fromJsonLd({
|
|
114
|
+
"@context": [AS, MASTODON],
|
|
115
|
+
id: aliceId.href,
|
|
116
|
+
type: "Person",
|
|
117
|
+
attributionDomains: [42, "blog.example", true, { "@value": null }],
|
|
118
|
+
});
|
|
119
|
+
deepStrictEqual(person.attributionDomains, ["blog.example"]);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test("Update serializes the bare attributionDomains key in its object", async () => {
|
|
123
|
+
const alice = new Person({
|
|
124
|
+
id: aliceId,
|
|
125
|
+
attributionDomains: ["blog.example"],
|
|
126
|
+
});
|
|
127
|
+
const update = new Update({
|
|
128
|
+
id: updateId,
|
|
129
|
+
actor: aliceId,
|
|
130
|
+
object: alice,
|
|
131
|
+
});
|
|
132
|
+
const json = record(await update.toJsonLd());
|
|
133
|
+
const object = record(json.object);
|
|
134
|
+
deepStrictEqual(object.attributionDomains, ["blog.example"]);
|
|
135
|
+
ok(!("toot:attributionDomains" in object));
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test("parses Mastodon's published actor shape with a single string", async () => {
|
|
139
|
+
const document = {
|
|
140
|
+
"@context": [
|
|
141
|
+
AS,
|
|
142
|
+
"https://w3id.org/security/v1",
|
|
143
|
+
{
|
|
144
|
+
toot: `${MASTODON}#`,
|
|
145
|
+
attributionDomains: {
|
|
146
|
+
"@id": "toot:attributionDomains",
|
|
147
|
+
"@container": "@set",
|
|
148
|
+
},
|
|
149
|
+
discoverable: "toot:discoverable",
|
|
150
|
+
indexable: "toot:indexable",
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
id: aliceId.href,
|
|
154
|
+
type: "Person",
|
|
155
|
+
preferredUsername: "alice",
|
|
156
|
+
inbox: `${aliceId.href}/inbox`,
|
|
157
|
+
outbox: `${aliceId.href}/outbox`,
|
|
158
|
+
attributionDomains: "blog.example",
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const person = await Person.fromJsonLd(document);
|
|
162
|
+
deepStrictEqual(person.attributionDomains, ["blog.example"]);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
test("parses attributionDomains through the preloaded Mastodon context", async () => {
|
|
166
|
+
const document = {
|
|
167
|
+
"@context": [AS, MASTODON],
|
|
168
|
+
id: aliceId.href,
|
|
169
|
+
type: "Person",
|
|
170
|
+
attributionDomains: ["blog.example"],
|
|
171
|
+
};
|
|
172
|
+
const person = await Person.fromJsonLd(document);
|
|
173
|
+
deepStrictEqual(person.attributionDomains, ["blog.example"]);
|
|
174
|
+
|
|
175
|
+
const json = record(await person.toJsonLd({ format: "compact" }));
|
|
176
|
+
deepStrictEqual(json.attributionDomains, ["blog.example"]);
|
|
177
|
+
});
|
package/src/group.yaml
CHANGED
|
@@ -36,6 +36,9 @@ defaultContext:
|
|
|
36
36
|
suspended: "toot:suspended"
|
|
37
37
|
memorial: "toot:memorial"
|
|
38
38
|
indexable: "toot:indexable"
|
|
39
|
+
attributionDomains:
|
|
40
|
+
"@id": "toot:attributionDomains"
|
|
41
|
+
"@container": "@set"
|
|
39
42
|
schema: "http://schema.org#"
|
|
40
43
|
PropertyValue: "schema:PropertyValue"
|
|
41
44
|
value: "schema:value"
|
|
@@ -284,6 +287,19 @@ properties:
|
|
|
284
287
|
range:
|
|
285
288
|
- "http://www.w3.org/2001/XMLSchema#boolean"
|
|
286
289
|
|
|
290
|
+
- pluralName: attributionDomains
|
|
291
|
+
singularName: attributionDomain
|
|
292
|
+
compactName: attributionDomains
|
|
293
|
+
uri: "http://joinmastodon.org/ns#attributionDomains"
|
|
294
|
+
description: |
|
|
295
|
+
Domains this actor claims as its own, so that Mastodon can credit the
|
|
296
|
+
actor on link preview cards that point at one of them. Each value is a
|
|
297
|
+
bare host name, without a scheme, port, path, or leading `*.`. Fedify
|
|
298
|
+
treats the values as opaque strings and does not normalize or validate
|
|
299
|
+
them; applications are responsible for producing normalized host names.
|
|
300
|
+
range:
|
|
301
|
+
- "http://www.w3.org/2001/XMLSchema#string"
|
|
302
|
+
|
|
287
303
|
- singularName: successor
|
|
288
304
|
functional: true
|
|
289
305
|
compactName: movedTo
|
package/src/organization.yaml
CHANGED
|
@@ -36,6 +36,9 @@ defaultContext:
|
|
|
36
36
|
suspended: "toot:suspended"
|
|
37
37
|
memorial: "toot:memorial"
|
|
38
38
|
indexable: "toot:indexable"
|
|
39
|
+
attributionDomains:
|
|
40
|
+
"@id": "toot:attributionDomains"
|
|
41
|
+
"@container": "@set"
|
|
39
42
|
schema: "http://schema.org#"
|
|
40
43
|
PropertyValue: "schema:PropertyValue"
|
|
41
44
|
value: "schema:value"
|
|
@@ -284,6 +287,19 @@ properties:
|
|
|
284
287
|
range:
|
|
285
288
|
- "http://www.w3.org/2001/XMLSchema#boolean"
|
|
286
289
|
|
|
290
|
+
- pluralName: attributionDomains
|
|
291
|
+
singularName: attributionDomain
|
|
292
|
+
compactName: attributionDomains
|
|
293
|
+
uri: "http://joinmastodon.org/ns#attributionDomains"
|
|
294
|
+
description: |
|
|
295
|
+
Domains this actor claims as its own, so that Mastodon can credit the
|
|
296
|
+
actor on link preview cards that point at one of them. Each value is a
|
|
297
|
+
bare host name, without a scheme, port, path, or leading `*.`. Fedify
|
|
298
|
+
treats the values as opaque strings and does not normalize or validate
|
|
299
|
+
them; applications are responsible for producing normalized host names.
|
|
300
|
+
range:
|
|
301
|
+
- "http://www.w3.org/2001/XMLSchema#string"
|
|
302
|
+
|
|
287
303
|
- singularName: successor
|
|
288
304
|
functional: true
|
|
289
305
|
compactName: movedTo
|
package/src/person.yaml
CHANGED
|
@@ -36,6 +36,9 @@ defaultContext:
|
|
|
36
36
|
suspended: "toot:suspended"
|
|
37
37
|
memorial: "toot:memorial"
|
|
38
38
|
indexable: "toot:indexable"
|
|
39
|
+
attributionDomains:
|
|
40
|
+
"@id": "toot:attributionDomains"
|
|
41
|
+
"@container": "@set"
|
|
39
42
|
schema: "http://schema.org#"
|
|
40
43
|
PropertyValue: "schema:PropertyValue"
|
|
41
44
|
value: "schema:value"
|
|
@@ -284,6 +287,19 @@ properties:
|
|
|
284
287
|
range:
|
|
285
288
|
- "http://www.w3.org/2001/XMLSchema#boolean"
|
|
286
289
|
|
|
290
|
+
- pluralName: attributionDomains
|
|
291
|
+
singularName: attributionDomain
|
|
292
|
+
compactName: attributionDomains
|
|
293
|
+
uri: "http://joinmastodon.org/ns#attributionDomains"
|
|
294
|
+
description: |
|
|
295
|
+
Domains this actor claims as its own, so that Mastodon can credit the
|
|
296
|
+
actor on link preview cards that point at one of them. Each value is a
|
|
297
|
+
bare host name, without a scheme, port, path, or leading `*.`. Fedify
|
|
298
|
+
treats the values as opaque strings and does not normalize or validate
|
|
299
|
+
them; applications are responsible for producing normalized host names.
|
|
300
|
+
range:
|
|
301
|
+
- "http://www.w3.org/2001/XMLSchema#string"
|
|
302
|
+
|
|
287
303
|
- singularName: successor
|
|
288
304
|
functional: true
|
|
289
305
|
compactName: movedTo
|
package/src/service.yaml
CHANGED
|
@@ -36,6 +36,9 @@ defaultContext:
|
|
|
36
36
|
suspended: "toot:suspended"
|
|
37
37
|
memorial: "toot:memorial"
|
|
38
38
|
indexable: "toot:indexable"
|
|
39
|
+
attributionDomains:
|
|
40
|
+
"@id": "toot:attributionDomains"
|
|
41
|
+
"@container": "@set"
|
|
39
42
|
schema: "http://schema.org#"
|
|
40
43
|
PropertyValue: "schema:PropertyValue"
|
|
41
44
|
value: "schema:value"
|
|
@@ -284,6 +287,19 @@ properties:
|
|
|
284
287
|
range:
|
|
285
288
|
- "http://www.w3.org/2001/XMLSchema#boolean"
|
|
286
289
|
|
|
290
|
+
- pluralName: attributionDomains
|
|
291
|
+
singularName: attributionDomain
|
|
292
|
+
compactName: attributionDomains
|
|
293
|
+
uri: "http://joinmastodon.org/ns#attributionDomains"
|
|
294
|
+
description: |
|
|
295
|
+
Domains this actor claims as its own, so that Mastodon can credit the
|
|
296
|
+
actor on link preview cards that point at one of them. Each value is a
|
|
297
|
+
bare host name, without a scheme, port, path, or leading `*.`. Fedify
|
|
298
|
+
treats the values as opaque strings and does not normalize or validate
|
|
299
|
+
them; applications are responsible for producing normalized host names.
|
|
300
|
+
range:
|
|
301
|
+
- "http://www.w3.org/2001/XMLSchema#string"
|
|
302
|
+
|
|
287
303
|
- singularName: successor
|
|
288
304
|
functional: true
|
|
289
305
|
compactName: movedTo
|
package/src/update.yaml
CHANGED
|
@@ -38,6 +38,9 @@ defaultContext:
|
|
|
38
38
|
suspended: "toot:suspended"
|
|
39
39
|
memorial: "toot:memorial"
|
|
40
40
|
indexable: "toot:indexable"
|
|
41
|
+
attributionDomains:
|
|
42
|
+
"@id": "toot:attributionDomains"
|
|
43
|
+
"@container": "@set"
|
|
41
44
|
votersCount:
|
|
42
45
|
"@id": "toot:votersCount"
|
|
43
46
|
"@type": "http://www.w3.org/2001/XMLSchema#nonNegativeInteger"
|
package/src/vocab.test.ts
CHANGED
|
@@ -2527,6 +2527,10 @@ test("Person.toJsonLd()", async () => {
|
|
|
2527
2527
|
"@id": "toot:featuredTags",
|
|
2528
2528
|
"@type": "@id",
|
|
2529
2529
|
},
|
|
2530
|
+
attributionDomains: {
|
|
2531
|
+
"@id": "toot:attributionDomains",
|
|
2532
|
+
"@container": "@set",
|
|
2533
|
+
},
|
|
2530
2534
|
indexable: "toot:indexable",
|
|
2531
2535
|
_misskey_followedMessage: "misskey:_misskey_followedMessage",
|
|
2532
2536
|
isCat: "misskey:isCat",
|
|
@@ -3306,6 +3310,10 @@ test("InteractionPolicy.canFeature", async () => {
|
|
|
3306
3310
|
"@id": "toot:featuredTags",
|
|
3307
3311
|
"@type": "@id",
|
|
3308
3312
|
},
|
|
3313
|
+
attributionDomains: {
|
|
3314
|
+
"@id": "toot:attributionDomains",
|
|
3315
|
+
"@container": "@set",
|
|
3316
|
+
},
|
|
3309
3317
|
indexable: "toot:indexable",
|
|
3310
3318
|
isCat: "misskey:isCat",
|
|
3311
3319
|
manuallyApprovesFollowers: "as:manuallyApprovesFollowers",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.node.json",
|
|
3
|
+
"include": ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
|
4
|
+
"exclude": [
|
|
5
|
+
"dist",
|
|
6
|
+
"dist-tests",
|
|
7
|
+
"node_modules",
|
|
8
|
+
// Uses Deno's @std/testing snapshots; owned by check:types:deno until
|
|
9
|
+
// #1288.
|
|
10
|
+
"src/vocab.test.ts",
|
|
11
|
+
// Deno benchmarks (Deno.bench); owned by check:types:deno.
|
|
12
|
+
"src/vocab.bench.ts"
|
|
13
|
+
]
|
|
14
|
+
}
|