@nuggetslife/vc 0.0.27 → 0.0.29
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/package.json +6 -6
- package/test_jsonld_crossverify.mjs +74 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuggetslife/vc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"napi": {
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
},
|
|
39
39
|
"packageManager": "yarn@4.3.1",
|
|
40
40
|
"optionalDependencies": {
|
|
41
|
-
"@nuggetslife/vc-darwin-arm64": "0.0.
|
|
42
|
-
"@nuggetslife/vc-linux-arm64-gnu": "0.0.
|
|
43
|
-
"@nuggetslife/vc-linux-arm64-musl": "0.0.
|
|
44
|
-
"@nuggetslife/vc-linux-x64-gnu": "0.0.
|
|
45
|
-
"@nuggetslife/vc-linux-x64-musl": "0.0.
|
|
41
|
+
"@nuggetslife/vc-darwin-arm64": "0.0.29",
|
|
42
|
+
"@nuggetslife/vc-linux-arm64-gnu": "0.0.29",
|
|
43
|
+
"@nuggetslife/vc-linux-arm64-musl": "0.0.29",
|
|
44
|
+
"@nuggetslife/vc-linux-x64-gnu": "0.0.29",
|
|
45
|
+
"@nuggetslife/vc-linux-x64-musl": "0.0.29"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {}
|
|
48
48
|
}
|
|
@@ -254,3 +254,77 @@ test('cross-verify: expand → toRDF → fromRDF round-trip matches JS reference
|
|
|
254
254
|
|
|
255
255
|
assert.deepStrictEqual(napiResult, jsResult);
|
|
256
256
|
});
|
|
257
|
+
|
|
258
|
+
//
|
|
259
|
+
// Regression: subjects without @id must get blank node identifiers
|
|
260
|
+
// (https://github.com/NuggetsLtd/montpellier/issues/4642)
|
|
261
|
+
//
|
|
262
|
+
|
|
263
|
+
test('cross-verify: toRDF preserves nested typed objects without @id', async () => {
|
|
264
|
+
const doc = {
|
|
265
|
+
"@context": {
|
|
266
|
+
"schema": "http://schema.org/",
|
|
267
|
+
"metrics": "schema:metrics",
|
|
268
|
+
"name": "schema:name",
|
|
269
|
+
"count": "schema:count",
|
|
270
|
+
"MyType": {
|
|
271
|
+
"@id": "schema:MyType",
|
|
272
|
+
"@context": {
|
|
273
|
+
"type": "@type",
|
|
274
|
+
"count": { "@id": "schema:count", "@type": "http://www.w3.org/2001/XMLSchema#integer" },
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
"@id": "http://example.org/thing",
|
|
279
|
+
"name": "Test",
|
|
280
|
+
"metrics": {
|
|
281
|
+
"type": "MyType",
|
|
282
|
+
"count": 42,
|
|
283
|
+
},
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
const proc = new JsonLd();
|
|
287
|
+
|
|
288
|
+
const napiResult = await proc.toRDF(doc, { format: 'application/n-quads' });
|
|
289
|
+
const jsResult = await jsonld.toRDF(doc, { format: 'application/n-quads' });
|
|
290
|
+
|
|
291
|
+
const napiStmts = napiResult.split('\n').filter(s => s.trim()).sort();
|
|
292
|
+
const jsStmts = jsResult.split('\n').filter(s => s.trim()).sort();
|
|
293
|
+
|
|
294
|
+
assert.strictEqual(napiStmts.length, jsStmts.length,
|
|
295
|
+
`Statement count mismatch: NAPI=${napiStmts.length}, JS=${jsStmts.length}`);
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
test('cross-verify: canonize preserves nested typed objects without @id', async () => {
|
|
299
|
+
const doc = {
|
|
300
|
+
"@context": {
|
|
301
|
+
"schema": "http://schema.org/",
|
|
302
|
+
"metrics": "schema:metrics",
|
|
303
|
+
"name": "schema:name",
|
|
304
|
+
"MyType": {
|
|
305
|
+
"@id": "schema:MyType",
|
|
306
|
+
"@context": {
|
|
307
|
+
"type": "@type",
|
|
308
|
+
"count": { "@id": "schema:count", "@type": "http://www.w3.org/2001/XMLSchema#integer" },
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
"@id": "http://example.org/thing",
|
|
313
|
+
"name": "Test",
|
|
314
|
+
"metrics": {
|
|
315
|
+
"type": "MyType",
|
|
316
|
+
"count": 42,
|
|
317
|
+
},
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
const proc = new JsonLd();
|
|
321
|
+
|
|
322
|
+
const napiResult = await proc.canonize(doc);
|
|
323
|
+
const jsResult = await jsonld.canonize(doc, {
|
|
324
|
+
algorithm: 'URDNA2015',
|
|
325
|
+
format: 'application/n-quads',
|
|
326
|
+
safe: false,
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
assert.strictEqual(napiResult, jsResult);
|
|
330
|
+
});
|