@fedify/vocab 2.4.0-dev.2010 → 2.4.0-dev.2027

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,13 +1,13 @@
1
1
  import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { M as Organization, N as Person, V as Service, a as Application, y as Group } from "./vocab-D3s0_CFf.mjs";
3
+ import { H as Service, N as Organization, P as Person, a as Application, y as Group } from "./vocab-Dw_Vm0NE.mjs";
4
4
  import { t as getTypeId } from "./type-BMdjm4Eg.mjs";
5
5
  import { lookupWebFinger } from "@fedify/webfinger";
6
6
  import { SpanStatusCode, trace } from "@opentelemetry/api";
7
7
  import { domainToASCII, domainToUnicode } from "node:url";
8
8
  //#region deno.json
9
9
  var name = "@fedify/vocab";
10
- var version = "2.4.0-dev.2010+498229f4";
10
+ var version = "2.4.0-dev.2027+fcf88bfc";
11
11
  //#endregion
12
12
  //#region src/actor.ts
13
13
  const ACTOR_DISCOVERY_HISTOGRAM_BUCKETS = [
@@ -1,8 +1,8 @@
1
1
  import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { M as Organization, N as Person, V as Service, X as __exportAll, a as Application, y as Group } from "./vocab-D3s0_CFf.mjs";
4
- import { t as esm_default } from "./esm-BcWVaclW.mjs";
5
- import { a as normalizeActorHandle, i as isActor, n as getActorHandle, r as getActorTypeName, t as getActorClassByTypeName } from "./actor-D9HgOn9e.mjs";
3
+ import { H as Service, N as Organization, P as Person, Z as __exportAll, a as Application, y as Group } from "./vocab-Dw_Vm0NE.mjs";
4
+ import { t as esm_default } from "./esm-C_FjLvhG.mjs";
5
+ import { a as normalizeActorHandle, i as isActor, n as getActorHandle, r as getActorTypeName, t as getActorClassByTypeName } from "./actor-m-0r8gyJ.mjs";
6
6
  import { createTestMeterProvider, test } from "@fedify/fixture";
7
7
  import { deepStrictEqual, ok, rejects, strictEqual, throws } from "node:assert/strict";
8
8
  //#region ../../node_modules/.pnpm/fast-check@3.23.2/node_modules/fast-check/lib/esm/check/precondition/PreconditionFailure.js
@@ -1,6 +1,6 @@
1
1
  import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { Y as __commonJSMin, Z as __toESM } from "./vocab-D3s0_CFf.mjs";
3
+ import { Q as __toESM, X as __commonJSMin } from "./vocab-Dw_Vm0NE.mjs";
4
4
  //#endregion
5
5
  //#region ../../node_modules/.pnpm/regexparam@3.0.0/node_modules/regexparam/dist/index.mjs
6
6
  var import_glob_to_regexp = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { k as Object$1 } from "./vocab-D3s0_CFf.mjs";
4
- import { i as isActor, o as name, s as version } from "./actor-D9HgOn9e.mjs";
3
+ import { k as Object$1 } from "./vocab-Dw_Vm0NE.mjs";
4
+ import { i as isActor, o as name, s as version } from "./actor-m-0r8gyJ.mjs";
5
5
  import { t as getTypeId } from "./type-BMdjm4Eg.mjs";
6
6
  import { lookupWebFinger } from "@fedify/webfinger";
7
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1,8 +1,8 @@
1
1
  import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { N as Person, O as Note, k as Object$1, s as Collection } from "./vocab-D3s0_CFf.mjs";
4
- import { t as esm_default } from "./esm-BcWVaclW.mjs";
5
- import { n as traverseCollection, t as lookupObject } from "./lookup-CqmPTouw.mjs";
3
+ import { O as Note, P as Person, k as Object$1, s as Collection } from "./vocab-Dw_Vm0NE.mjs";
4
+ import { t as esm_default } from "./esm-C_FjLvhG.mjs";
5
+ import { n as traverseCollection, t as lookupObject } from "./lookup-DTg4VF7D.mjs";
6
6
  import { t as assertInstanceOf } from "./utils-Df2odC27.mjs";
7
7
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
8
8
  import { deepStrictEqual, equal, ok, rejects } from "node:assert/strict";
@@ -0,0 +1,189 @@
1
+ import "temporal-polyfill";
2
+ globalThis.addEventListener = () => {};
3
+ import { O as Note, R as Question, Y as vocab_exports, i as Announce, j as OrderedCollection, l as Create } from "./vocab-Dw_Vm0NE.mjs";
4
+ import { mockDocumentLoader, test } from "@fedify/fixture";
5
+ import { deepStrictEqual, ok } from "node:assert/strict";
6
+ import { isMarkerSafeContext, retainSignedRepresentation } from "@fedify/vocab-runtime/internal/signed-representation";
7
+ //#region src/signed-representation.test.ts
8
+ const securedNote = {
9
+ "@context": [
10
+ "https://www.w3.org/ns/activitystreams",
11
+ "https://w3id.org/security/data-integrity/v1",
12
+ { ex: "https://example.com/ns#" }
13
+ ],
14
+ id: "https://example.com/notes/1",
15
+ type: "Note",
16
+ content: "Hello",
17
+ proof: {
18
+ "@context": [
19
+ "https://www.w3.org/ns/activitystreams",
20
+ "https://w3id.org/security/data-integrity/v1",
21
+ { ex: "https://example.com/ns#" }
22
+ ],
23
+ type: "DataIntegrityProof",
24
+ cryptosuite: "eddsa-jcs-2022",
25
+ created: "2023-02-24T23:36:38Z",
26
+ verificationMethod: "https://example.com/person#ed25519-key",
27
+ proofPurpose: "assertionMethod",
28
+ proofValue: "z3FXQ"
29
+ }
30
+ };
31
+ const options = { contextLoader: mockDocumentLoader };
32
+ function retainedNote() {
33
+ const note = new Note({
34
+ id: new URL("https://example.com/notes/1"),
35
+ content: "Hello"
36
+ });
37
+ retainSignedRepresentation(note, structuredClone(securedNote));
38
+ return note;
39
+ }
40
+ test("nested serialization embeds a retained signed representation", async () => {
41
+ deepStrictEqual((await new Create({
42
+ id: new URL("https://example.com/activities/1"),
43
+ actor: new URL("https://example.com/person"),
44
+ object: retainedNote()
45
+ }).toJsonLd({
46
+ format: "compact",
47
+ ...options
48
+ })).object, securedNote);
49
+ });
50
+ test("nested serialization embeds a retained representation through a compactable parent", async () => {
51
+ const wrapper = new Note({
52
+ id: new URL("https://example.com/notes/wrapper"),
53
+ attachments: [retainedNote()]
54
+ });
55
+ deepStrictEqual((await wrapper.toJsonLd(options)).attachment, securedNote);
56
+ const embeddedWrapper = (await new Question({
57
+ id: new URL("https://example.com/questions/1"),
58
+ exclusiveOptions: [wrapper]
59
+ }).toJsonLd(options)).oneOf;
60
+ deepStrictEqual(embeddedWrapper.attachment, securedNote);
61
+ });
62
+ test("nested serialization embeds one retained representation many times", async () => {
63
+ const note = retainedNote();
64
+ const compact = await new Create({
65
+ id: new URL("https://example.com/activities/1"),
66
+ actor: new URL("https://example.com/person"),
67
+ objects: [note, note],
68
+ tags: [note]
69
+ }).toJsonLd({
70
+ format: "compact",
71
+ ...options
72
+ });
73
+ const objects = compact.object;
74
+ deepStrictEqual(objects.length, 2);
75
+ deepStrictEqual(objects[0], securedNote);
76
+ deepStrictEqual(objects[1], securedNote);
77
+ deepStrictEqual(compact.tag, securedNote);
78
+ ok(objects[0] !== objects[1]);
79
+ ok(objects[0] !== compact.tag);
80
+ });
81
+ test("nested serialization embeds a retained representation at any depth", async () => {
82
+ const create = (await new Announce({
83
+ id: new URL("https://example.com/activities/2"),
84
+ actor: new URL("https://example.com/person"),
85
+ object: new Create({
86
+ id: new URL("https://example.com/activities/1"),
87
+ actor: new URL("https://example.com/person"),
88
+ object: retainedNote()
89
+ })
90
+ }).toJsonLd({
91
+ format: "compact",
92
+ ...options
93
+ })).object;
94
+ deepStrictEqual(create.object, securedNote);
95
+ });
96
+ test("expanded serialization ignores a retained signed representation", async () => {
97
+ const objects = (await new Create({
98
+ id: new URL("https://example.com/activities/1"),
99
+ actor: new URL("https://example.com/person"),
100
+ object: retainedNote()
101
+ }).toJsonLd({
102
+ format: "expand",
103
+ ...options
104
+ }))[0]["https://www.w3.org/ns/activitystreams#object"];
105
+ deepStrictEqual(objects[0]["@id"], "https://example.com/notes/1");
106
+ deepStrictEqual(objects[0]["@type"], ["https://www.w3.org/ns/activitystreams#Note"]);
107
+ });
108
+ test("a context that could hide a placeholder turns retention off", async () => {
109
+ const embedded = (await new Create({
110
+ id: new URL("https://example.com/activities/1"),
111
+ actor: new URL("https://example.com/person"),
112
+ object: retainedNote()
113
+ }).toJsonLd({
114
+ format: "compact",
115
+ context: [
116
+ "https://www.w3.org/ns/activitystreams",
117
+ "https://w3id.org/security/data-integrity/v1",
118
+ { identifier: "@id" }
119
+ ],
120
+ ...options
121
+ })).object;
122
+ deepStrictEqual(embedded["@context"], void 0);
123
+ deepStrictEqual(embedded.proof, void 0);
124
+ });
125
+ test("a clone does not inherit a retained signed representation", async () => {
126
+ const note = retainedNote();
127
+ const embedded = (await new Create({
128
+ id: new URL("https://example.com/activities/1"),
129
+ actor: new URL("https://example.com/person"),
130
+ object: note.clone({ content: "Changed" })
131
+ }).toJsonLd({
132
+ format: "compact",
133
+ ...options
134
+ })).object;
135
+ deepStrictEqual(embedded["@context"], void 0);
136
+ deepStrictEqual(embedded.content, "Changed");
137
+ });
138
+ test("every generated default context keeps placeholders recoverable", async () => {
139
+ const classes = Object.values(vocab_exports).filter((value) => typeof value === "function" && value.typeId instanceof URL);
140
+ ok(classes.length > 0);
141
+ for (const cls of classes) ok(isMarkerSafeContext((await new cls({ id: new URL("https://example.com/objects/1") }).toJsonLd())["@context"]), `${cls.typeId.href} has a default context that could hide a placeholder`);
142
+ });
143
+ test("a subtype that redefines an inherited property still embeds a retained representation", async () => {
144
+ const compact = await new OrderedCollection({
145
+ id: new URL("https://example.com/collections/1"),
146
+ items: [retainedNote()]
147
+ }).toJsonLd(options);
148
+ deepStrictEqual(compact.items, void 0);
149
+ deepStrictEqual(compact.orderedItems, [securedNote]);
150
+ });
151
+ test("a context that shadows the placeholder scheme turns retention off", async () => {
152
+ const embedded = (await new Create({
153
+ id: new URL("https://example.com/activities/1"),
154
+ actor: new URL("https://example.com/person"),
155
+ object: retainedNote()
156
+ }).toJsonLd({
157
+ format: "compact",
158
+ context: [
159
+ "https://www.w3.org/ns/activitystreams",
160
+ "https://w3id.org/security/data-integrity/v1",
161
+ { urn: "https://example.com/ns#" }
162
+ ],
163
+ ...options
164
+ })).object;
165
+ deepStrictEqual(embedded["@context"], void 0);
166
+ deepStrictEqual(embedded.proof, void 0);
167
+ });
168
+ test("a context that aliases `@id` indirectly turns retention off", async () => {
169
+ const embedded = (await new Create({
170
+ id: new URL("https://example.com/activities/1"),
171
+ actor: new URL("https://example.com/person"),
172
+ object: retainedNote()
173
+ }).toJsonLd({
174
+ format: "compact",
175
+ context: [
176
+ "https://www.w3.org/ns/activitystreams",
177
+ "https://w3id.org/security/data-integrity/v1",
178
+ {
179
+ i: "id",
180
+ object: "as:object"
181
+ }
182
+ ],
183
+ ...options
184
+ })).object;
185
+ deepStrictEqual(embedded["@context"], void 0);
186
+ deepStrictEqual(embedded.proof, void 0);
187
+ });
188
+ //#endregion
189
+ export {};
@@ -1,8 +1,8 @@
1
1
  import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { F as PropertyValue, G as Update, M as Organization, N as Person, O as Note, T as Link, V as Service, W as Translation, a as Application, k as Object$1, l as Create, o as Article, s as Collection, y as Group } from "./vocab-D3s0_CFf.mjs";
4
- import "./actor-D9HgOn9e.mjs";
5
- import "./lookup-CqmPTouw.mjs";
3
+ import { G as Translation, H as Service, I as PropertyValue, K as Update, N as Organization, O as Note, P as Person, T as Link, a as Application, k as Object$1, l as Create, o as Article, s as Collection, y as Group } from "./vocab-Dw_Vm0NE.mjs";
4
+ import "./actor-m-0r8gyJ.mjs";
5
+ import "./lookup-DTg4VF7D.mjs";
6
6
  import { test } from "@fedify/fixture";
7
7
  import { deepStrictEqual, ok, rejects } from "node:assert/strict";
8
8
  import { LanguageString as LanguageString$1, getDocumentLoader, preloadedContexts } from "@fedify/vocab-runtime";
@@ -1,6 +1,6 @@
1
1
  import "temporal-polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { K as getEntityTypeById, N as Person, T as Link, q as isEntityType } from "./vocab-D3s0_CFf.mjs";
3
+ import { J as isEntityType, P as Person, T as Link, q as getEntityTypeById } from "./vocab-Dw_Vm0NE.mjs";
4
4
  import { t as getTypeId } from "./type-BMdjm4Eg.mjs";
5
5
  import { test } from "@fedify/fixture";
6
6
  import { deepStrictEqual } from "node:assert/strict";