@fedify/vocab-tools 2.4.0-dev.1618 → 2.4.0-dev.1655
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 +28 -2
- package/dist/mod.js +28 -2
- package/package.json +1 -1
- package/src/__snapshots__/class.test.ts.deno.snap +1150 -53
- package/src/__snapshots__/class.test.ts.node.snap +1150 -53
- package/src/__snapshots__/class.test.ts.snap +1150 -53
- package/src/class.ts +2 -0
- package/src/type.ts +24 -0
package/src/class.ts
CHANGED
package/src/type.ts
CHANGED
|
@@ -6,8 +6,10 @@ const HEURISTICS_CONTEXTS: string[] = [
|
|
|
6
6
|
"https://www.w3.org/ns/activitystreams",
|
|
7
7
|
"https://w3id.org/security/v1",
|
|
8
8
|
"https://w3id.org/security/data-integrity/v1",
|
|
9
|
+
"https://w3id.org/security/data-integrity/v2",
|
|
9
10
|
"https://www.w3.org/ns/did/v1",
|
|
10
11
|
"https://w3id.org/security/multikey/v1",
|
|
12
|
+
"https://w3id.org/fep/ef61",
|
|
11
13
|
];
|
|
12
14
|
|
|
13
15
|
interface ScalarType {
|
|
@@ -324,6 +326,28 @@ const scalarTypes: Record<string, ScalarType> = {
|
|
|
324
326
|
return `parseIri(${v}["@value"])`;
|
|
325
327
|
},
|
|
326
328
|
},
|
|
329
|
+
"fedify:gatewayUrl": {
|
|
330
|
+
name: "URL",
|
|
331
|
+
typeGuard(v) {
|
|
332
|
+
return `${v} instanceof URL && isGatewayUrl(${v})`;
|
|
333
|
+
},
|
|
334
|
+
encoder(v) {
|
|
335
|
+
return `{ "@id": formatIri(${v}) }`;
|
|
336
|
+
},
|
|
337
|
+
compactEncoder(v) {
|
|
338
|
+
return `formatIri(${v})`;
|
|
339
|
+
},
|
|
340
|
+
dataCheck(v) {
|
|
341
|
+
return `${v} != null && typeof ${v} === "object" &&
|
|
342
|
+
(("@id" in ${v} && typeof ${v}["@id"] === "string" &&
|
|
343
|
+
${v}["@id"] !== "" && ${v}["@id"] !== "/") ||
|
|
344
|
+
("@value" in ${v} && typeof ${v}["@value"] === "string" &&
|
|
345
|
+
${v}["@value"] !== "" && ${v}["@value"] !== "/"))`;
|
|
346
|
+
},
|
|
347
|
+
decoder(v) {
|
|
348
|
+
return `parseGatewayUrl(typeof ${v}["@id"] === "string" ? ${v}["@id"] : ${v}["@value"])`;
|
|
349
|
+
},
|
|
350
|
+
},
|
|
327
351
|
"fedify:publicKey": {
|
|
328
352
|
name: "CryptoKey",
|
|
329
353
|
typeGuard(v) {
|