@pod-os/core 0.3.1-e5ac107.0 → 0.4.0
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/dist/index.js +105 -55
- package/lib/index.js +105 -55
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -15005,7 +15005,7 @@ var require_MessageDigest_browser = __commonJS({
|
|
|
15005
15005
|
} else if (algorithm === "sha1") {
|
|
15006
15006
|
this.algorithm = { name: "SHA-1" };
|
|
15007
15007
|
} else {
|
|
15008
|
-
throw new Error(`
|
|
15008
|
+
throw new Error(`Unsupported algorithm "${algorithm}".`);
|
|
15009
15009
|
}
|
|
15010
15010
|
this._content = "";
|
|
15011
15011
|
}
|
|
@@ -15200,11 +15200,7 @@ var require_NQuads = __commonJS({
|
|
|
15200
15200
|
}
|
|
15201
15201
|
return quads.sort().join("");
|
|
15202
15202
|
}
|
|
15203
|
-
static
|
|
15204
|
-
const s = quad5.subject;
|
|
15205
|
-
const p = quad5.predicate;
|
|
15206
|
-
const o = quad5.object;
|
|
15207
|
-
const g = quad5.graph;
|
|
15203
|
+
static serializeQuadComponents(s, p, o, g) {
|
|
15208
15204
|
let nquad = "";
|
|
15209
15205
|
if (s.termType === TYPE_NAMED_NODE) {
|
|
15210
15206
|
nquad += `<${s.value}>`;
|
|
@@ -15234,6 +15230,14 @@ var require_NQuads = __commonJS({
|
|
|
15234
15230
|
nquad += " .\n";
|
|
15235
15231
|
return nquad;
|
|
15236
15232
|
}
|
|
15233
|
+
static serializeQuad(quad5) {
|
|
15234
|
+
return NQuads.serializeQuadComponents(
|
|
15235
|
+
quad5.subject,
|
|
15236
|
+
quad5.predicate,
|
|
15237
|
+
quad5.object,
|
|
15238
|
+
quad5.graph
|
|
15239
|
+
);
|
|
15240
|
+
}
|
|
15237
15241
|
static legacyDatasetToQuads(dataset) {
|
|
15238
15242
|
const quads = [];
|
|
15239
15243
|
const termTypeMap = {
|
|
@@ -15356,11 +15360,14 @@ var require_URDNA2015 = __commonJS({
|
|
|
15356
15360
|
var Permuter = require_Permuter();
|
|
15357
15361
|
var NQuads = require_NQuads();
|
|
15358
15362
|
module2.exports = class URDNA2015 {
|
|
15359
|
-
constructor({
|
|
15363
|
+
constructor({
|
|
15364
|
+
createMessageDigest = () => new MessageDigest("sha256"),
|
|
15365
|
+
maxDeepIterations = Infinity
|
|
15366
|
+
} = {}) {
|
|
15360
15367
|
this.name = "URDNA2015";
|
|
15361
15368
|
this.blankNodeInfo = /* @__PURE__ */ new Map();
|
|
15362
15369
|
this.canonicalIssuer = new IdentifierIssuer("_:c14n");
|
|
15363
|
-
this.
|
|
15370
|
+
this.createMessageDigest = createMessageDigest;
|
|
15364
15371
|
this.maxDeepIterations = maxDeepIterations;
|
|
15365
15372
|
this.quads = null;
|
|
15366
15373
|
this.deepIterations = null;
|
|
@@ -15414,11 +15421,13 @@ var require_URDNA2015 = __commonJS({
|
|
|
15414
15421
|
}
|
|
15415
15422
|
const normalized = [];
|
|
15416
15423
|
for (const quad5 of this.quads) {
|
|
15417
|
-
const
|
|
15418
|
-
|
|
15419
|
-
|
|
15420
|
-
|
|
15421
|
-
|
|
15424
|
+
const nQuad = NQuads.serializeQuadComponents(
|
|
15425
|
+
this._componentWithCanonicalId(quad5.subject),
|
|
15426
|
+
quad5.predicate,
|
|
15427
|
+
this._componentWithCanonicalId(quad5.object),
|
|
15428
|
+
this._componentWithCanonicalId(quad5.graph)
|
|
15429
|
+
);
|
|
15430
|
+
normalized.push(nQuad);
|
|
15422
15431
|
}
|
|
15423
15432
|
normalized.sort();
|
|
15424
15433
|
return normalized.join("");
|
|
@@ -15452,7 +15461,7 @@ var require_URDNA2015 = __commonJS({
|
|
|
15452
15461
|
nquads.push(NQuads.serializeQuad(copy));
|
|
15453
15462
|
}
|
|
15454
15463
|
nquads.sort();
|
|
15455
|
-
const md =
|
|
15464
|
+
const md = this.createMessageDigest();
|
|
15456
15465
|
for (const nquad of nquads) {
|
|
15457
15466
|
md.update(nquad);
|
|
15458
15467
|
}
|
|
@@ -15468,7 +15477,7 @@ var require_URDNA2015 = __commonJS({
|
|
|
15468
15477
|
} else {
|
|
15469
15478
|
id3 = this.blankNodeInfo.get(related).hash;
|
|
15470
15479
|
}
|
|
15471
|
-
const md =
|
|
15480
|
+
const md = this.createMessageDigest();
|
|
15472
15481
|
md.update(position);
|
|
15473
15482
|
if (position !== "g") {
|
|
15474
15483
|
md.update(this.getRelatedPredicate(quad5));
|
|
@@ -15484,7 +15493,7 @@ var require_URDNA2015 = __commonJS({
|
|
|
15484
15493
|
);
|
|
15485
15494
|
}
|
|
15486
15495
|
this.deepIterations.set(id3, deepIterations + 1);
|
|
15487
|
-
const md =
|
|
15496
|
+
const md = this.createMessageDigest();
|
|
15488
15497
|
const hashToRelated = await this.createHashToRelated(id3, issuer);
|
|
15489
15498
|
const hashes = [...hashToRelated.keys()].sort();
|
|
15490
15499
|
for (const hash of hashes) {
|
|
@@ -15630,7 +15639,7 @@ var require_URDNA2015 = __commonJS({
|
|
|
15630
15639
|
hashToRelated.set(hash, [related]);
|
|
15631
15640
|
}
|
|
15632
15641
|
}
|
|
15633
|
-
|
|
15642
|
+
_componentWithCanonicalId(component) {
|
|
15634
15643
|
if (component.termType === "BlankNode" && !component.value.startsWith(this.canonicalIssuer.prefix)) {
|
|
15635
15644
|
return {
|
|
15636
15645
|
termType: "BlankNode",
|
|
@@ -15653,12 +15662,13 @@ var require_URDNA2015 = __commonJS({
|
|
|
15653
15662
|
var require_URGNA2012 = __commonJS({
|
|
15654
15663
|
"../node_modules/rdf-canonize/lib/URGNA2012.js"(exports, module2) {
|
|
15655
15664
|
"use strict";
|
|
15665
|
+
var MessageDigest = require_MessageDigest_browser();
|
|
15656
15666
|
var URDNA2015 = require_URDNA2015();
|
|
15657
15667
|
module2.exports = class URDNA2012 extends URDNA2015 {
|
|
15658
15668
|
constructor() {
|
|
15659
15669
|
super();
|
|
15660
15670
|
this.name = "URGNA2012";
|
|
15661
|
-
this.
|
|
15671
|
+
this.createMessageDigest = () => new MessageDigest("sha1");
|
|
15662
15672
|
}
|
|
15663
15673
|
modifyFirstDegreeComponent(id3, component, key) {
|
|
15664
15674
|
if (component.termType !== "BlankNode") {
|
|
@@ -15725,11 +15735,14 @@ var require_URDNA2015Sync = __commonJS({
|
|
|
15725
15735
|
var Permuter = require_Permuter();
|
|
15726
15736
|
var NQuads = require_NQuads();
|
|
15727
15737
|
module2.exports = class URDNA2015Sync {
|
|
15728
|
-
constructor({
|
|
15738
|
+
constructor({
|
|
15739
|
+
createMessageDigest = () => new MessageDigest("sha256"),
|
|
15740
|
+
maxDeepIterations = Infinity
|
|
15741
|
+
} = {}) {
|
|
15729
15742
|
this.name = "URDNA2015";
|
|
15730
15743
|
this.blankNodeInfo = /* @__PURE__ */ new Map();
|
|
15731
15744
|
this.canonicalIssuer = new IdentifierIssuer("_:c14n");
|
|
15732
|
-
this.
|
|
15745
|
+
this.createMessageDigest = createMessageDigest;
|
|
15733
15746
|
this.maxDeepIterations = maxDeepIterations;
|
|
15734
15747
|
this.quads = null;
|
|
15735
15748
|
this.deepIterations = null;
|
|
@@ -15779,11 +15792,13 @@ var require_URDNA2015Sync = __commonJS({
|
|
|
15779
15792
|
}
|
|
15780
15793
|
const normalized = [];
|
|
15781
15794
|
for (const quad5 of this.quads) {
|
|
15782
|
-
const
|
|
15783
|
-
|
|
15784
|
-
|
|
15785
|
-
|
|
15786
|
-
|
|
15795
|
+
const nQuad = NQuads.serializeQuadComponents(
|
|
15796
|
+
this._componentWithCanonicalId({ component: quad5.subject }),
|
|
15797
|
+
quad5.predicate,
|
|
15798
|
+
this._componentWithCanonicalId({ component: quad5.object }),
|
|
15799
|
+
this._componentWithCanonicalId({ component: quad5.graph })
|
|
15800
|
+
);
|
|
15801
|
+
normalized.push(nQuad);
|
|
15787
15802
|
}
|
|
15788
15803
|
normalized.sort();
|
|
15789
15804
|
return normalized.join("");
|
|
@@ -15817,7 +15832,7 @@ var require_URDNA2015Sync = __commonJS({
|
|
|
15817
15832
|
nquads.push(NQuads.serializeQuad(copy));
|
|
15818
15833
|
}
|
|
15819
15834
|
nquads.sort();
|
|
15820
|
-
const md =
|
|
15835
|
+
const md = this.createMessageDigest();
|
|
15821
15836
|
for (const nquad of nquads) {
|
|
15822
15837
|
md.update(nquad);
|
|
15823
15838
|
}
|
|
@@ -15833,7 +15848,7 @@ var require_URDNA2015Sync = __commonJS({
|
|
|
15833
15848
|
} else {
|
|
15834
15849
|
id3 = this.blankNodeInfo.get(related).hash;
|
|
15835
15850
|
}
|
|
15836
|
-
const md =
|
|
15851
|
+
const md = this.createMessageDigest();
|
|
15837
15852
|
md.update(position);
|
|
15838
15853
|
if (position !== "g") {
|
|
15839
15854
|
md.update(this.getRelatedPredicate(quad5));
|
|
@@ -15849,7 +15864,7 @@ var require_URDNA2015Sync = __commonJS({
|
|
|
15849
15864
|
);
|
|
15850
15865
|
}
|
|
15851
15866
|
this.deepIterations.set(id3, deepIterations + 1);
|
|
15852
|
-
const md =
|
|
15867
|
+
const md = this.createMessageDigest();
|
|
15853
15868
|
const hashToRelated = this.createHashToRelated(id3, issuer);
|
|
15854
15869
|
const hashes = [...hashToRelated.keys()].sort();
|
|
15855
15870
|
for (const hash of hashes) {
|
|
@@ -15980,7 +15995,7 @@ var require_URDNA2015Sync = __commonJS({
|
|
|
15980
15995
|
hashToRelated.set(hash, [related]);
|
|
15981
15996
|
}
|
|
15982
15997
|
}
|
|
15983
|
-
|
|
15998
|
+
_componentWithCanonicalId({ component }) {
|
|
15984
15999
|
if (component.termType === "BlankNode" && !component.value.startsWith(this.canonicalIssuer.prefix)) {
|
|
15985
16000
|
return {
|
|
15986
16001
|
termType: "BlankNode",
|
|
@@ -16000,12 +16015,13 @@ var require_URDNA2015Sync = __commonJS({
|
|
|
16000
16015
|
var require_URGNA2012Sync = __commonJS({
|
|
16001
16016
|
"../node_modules/rdf-canonize/lib/URGNA2012Sync.js"(exports, module2) {
|
|
16002
16017
|
"use strict";
|
|
16018
|
+
var MessageDigest = require_MessageDigest_browser();
|
|
16003
16019
|
var URDNA2015Sync = require_URDNA2015Sync();
|
|
16004
16020
|
module2.exports = class URDNA2012Sync extends URDNA2015Sync {
|
|
16005
16021
|
constructor() {
|
|
16006
16022
|
super();
|
|
16007
16023
|
this.name = "URGNA2012";
|
|
16008
|
-
this.
|
|
16024
|
+
this.createMessageDigest = () => new MessageDigest("sha1");
|
|
16009
16025
|
}
|
|
16010
16026
|
modifyFirstDegreeComponent(id3, component, key) {
|
|
16011
16027
|
if (component.termType !== "BlankNode") {
|
|
@@ -16062,7 +16078,7 @@ var require_rdf_canonize_native = __commonJS({
|
|
|
16062
16078
|
|
|
16063
16079
|
// ../node_modules/rdf-canonize/lib/index.js
|
|
16064
16080
|
var require_lib = __commonJS({
|
|
16065
|
-
"../node_modules/rdf-canonize/lib/index.js"(exports
|
|
16081
|
+
"../node_modules/rdf-canonize/lib/index.js"(exports) {
|
|
16066
16082
|
"use strict";
|
|
16067
16083
|
var URDNA2015 = require_URDNA2015();
|
|
16068
16084
|
var URGNA2012 = require_URGNA2012();
|
|
@@ -16073,30 +16089,38 @@ var require_lib = __commonJS({
|
|
|
16073
16089
|
rdfCanonizeNative = require_rdf_canonize_native();
|
|
16074
16090
|
} catch (e) {
|
|
16075
16091
|
}
|
|
16076
|
-
|
|
16077
|
-
|
|
16078
|
-
|
|
16079
|
-
|
|
16080
|
-
|
|
16081
|
-
if (api2) {
|
|
16082
|
-
rdfCanonizeNative = api2;
|
|
16092
|
+
exports.NQuads = require_NQuads();
|
|
16093
|
+
exports.IdentifierIssuer = require_IdentifierIssuer();
|
|
16094
|
+
exports._rdfCanonizeNative = function(api) {
|
|
16095
|
+
if (api) {
|
|
16096
|
+
rdfCanonizeNative = api;
|
|
16083
16097
|
}
|
|
16084
16098
|
return rdfCanonizeNative;
|
|
16085
16099
|
};
|
|
16086
|
-
|
|
16100
|
+
exports.canonize = async function(dataset, options) {
|
|
16087
16101
|
if (!Array.isArray(dataset)) {
|
|
16088
|
-
dataset =
|
|
16102
|
+
dataset = exports.NQuads.legacyDatasetToQuads(dataset);
|
|
16089
16103
|
}
|
|
16090
16104
|
if (options.useNative) {
|
|
16091
16105
|
if (!rdfCanonizeNative) {
|
|
16092
16106
|
throw new Error("rdf-canonize-native not available");
|
|
16093
16107
|
}
|
|
16108
|
+
if (options.createMessageDigest) {
|
|
16109
|
+
throw new Error(
|
|
16110
|
+
'"createMessageDigest" cannot be used with "useNative".'
|
|
16111
|
+
);
|
|
16112
|
+
}
|
|
16094
16113
|
return new Promise((resolve, reject3) => rdfCanonizeNative.canonize(dataset, options, (err, canonical) => err ? reject3(err) : resolve(canonical)));
|
|
16095
16114
|
}
|
|
16096
16115
|
if (options.algorithm === "URDNA2015") {
|
|
16097
16116
|
return new URDNA2015(options).main(dataset);
|
|
16098
16117
|
}
|
|
16099
16118
|
if (options.algorithm === "URGNA2012") {
|
|
16119
|
+
if (options.createMessageDigest) {
|
|
16120
|
+
throw new Error(
|
|
16121
|
+
'"createMessageDigest" cannot be used with "URGNA2012".'
|
|
16122
|
+
);
|
|
16123
|
+
}
|
|
16100
16124
|
return new URGNA2012(options).main(dataset);
|
|
16101
16125
|
}
|
|
16102
16126
|
if (!("algorithm" in options)) {
|
|
@@ -16106,20 +16130,30 @@ var require_lib = __commonJS({
|
|
|
16106
16130
|
"Invalid RDF Dataset Canonicalization algorithm: " + options.algorithm
|
|
16107
16131
|
);
|
|
16108
16132
|
};
|
|
16109
|
-
|
|
16133
|
+
exports._canonizeSync = function(dataset, options) {
|
|
16110
16134
|
if (!Array.isArray(dataset)) {
|
|
16111
|
-
dataset =
|
|
16135
|
+
dataset = exports.NQuads.legacyDatasetToQuads(dataset);
|
|
16112
16136
|
}
|
|
16113
16137
|
if (options.useNative) {
|
|
16114
|
-
if (rdfCanonizeNative) {
|
|
16115
|
-
|
|
16138
|
+
if (!rdfCanonizeNative) {
|
|
16139
|
+
throw new Error("rdf-canonize-native not available");
|
|
16140
|
+
}
|
|
16141
|
+
if (options.createMessageDigest) {
|
|
16142
|
+
throw new Error(
|
|
16143
|
+
'"createMessageDigest" cannot be used with "useNative".'
|
|
16144
|
+
);
|
|
16116
16145
|
}
|
|
16117
|
-
|
|
16146
|
+
return rdfCanonizeNative.canonizeSync(dataset, options);
|
|
16118
16147
|
}
|
|
16119
16148
|
if (options.algorithm === "URDNA2015") {
|
|
16120
16149
|
return new URDNA2015Sync(options).main(dataset);
|
|
16121
16150
|
}
|
|
16122
16151
|
if (options.algorithm === "URGNA2012") {
|
|
16152
|
+
if (options.createMessageDigest) {
|
|
16153
|
+
throw new Error(
|
|
16154
|
+
'"createMessageDigest" cannot be used with "URGNA2012".'
|
|
16155
|
+
);
|
|
16156
|
+
}
|
|
16123
16157
|
return new URGNA2012Sync(options).main(dataset);
|
|
16124
16158
|
}
|
|
16125
16159
|
if (!("algorithm" in options)) {
|
|
@@ -22945,7 +22979,9 @@ var require_dom = __commonJS({
|
|
|
22945
22979
|
}
|
|
22946
22980
|
function copy(src, dest) {
|
|
22947
22981
|
for (var p in src) {
|
|
22948
|
-
|
|
22982
|
+
if (Object.prototype.hasOwnProperty.call(src, p)) {
|
|
22983
|
+
dest[p] = src[p];
|
|
22984
|
+
}
|
|
22949
22985
|
}
|
|
22950
22986
|
}
|
|
22951
22987
|
function _extends(Class, Super) {
|
|
@@ -23232,7 +23268,7 @@ var require_dom = __commonJS({
|
|
|
23232
23268
|
var map2 = el._nsMap;
|
|
23233
23269
|
if (map2) {
|
|
23234
23270
|
for (var n in map2) {
|
|
23235
|
-
if (map2[n]
|
|
23271
|
+
if (Object.prototype.hasOwnProperty.call(map2, n) && map2[n] === namespaceURI) {
|
|
23236
23272
|
return n;
|
|
23237
23273
|
}
|
|
23238
23274
|
}
|
|
@@ -23246,7 +23282,7 @@ var require_dom = __commonJS({
|
|
|
23246
23282
|
while (el) {
|
|
23247
23283
|
var map2 = el._nsMap;
|
|
23248
23284
|
if (map2) {
|
|
23249
|
-
if (prefix
|
|
23285
|
+
if (Object.prototype.hasOwnProperty.call(map2, prefix)) {
|
|
23250
23286
|
return map2[prefix];
|
|
23251
23287
|
}
|
|
23252
23288
|
}
|
|
@@ -23934,10 +23970,12 @@ var require_dom = __commonJS({
|
|
|
23934
23970
|
function cloneNode(doc, node, deep) {
|
|
23935
23971
|
var node2 = new node.constructor();
|
|
23936
23972
|
for (var n in node) {
|
|
23937
|
-
|
|
23938
|
-
|
|
23939
|
-
if (v !=
|
|
23940
|
-
node2[n]
|
|
23973
|
+
if (Object.prototype.hasOwnProperty.call(node, n)) {
|
|
23974
|
+
var v = node[n];
|
|
23975
|
+
if (typeof v != "object") {
|
|
23976
|
+
if (v != node2[n]) {
|
|
23977
|
+
node2[n] = v;
|
|
23978
|
+
}
|
|
23941
23979
|
}
|
|
23942
23980
|
}
|
|
23943
23981
|
}
|
|
@@ -24408,7 +24446,9 @@ var require_sax = __commonJS({
|
|
|
24408
24446
|
domBuilder.endElement(config.uri, config.localName, tagName);
|
|
24409
24447
|
if (localNSMap) {
|
|
24410
24448
|
for (var prefix in localNSMap) {
|
|
24411
|
-
|
|
24449
|
+
if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
|
|
24450
|
+
domBuilder.endPrefixMapping(prefix);
|
|
24451
|
+
}
|
|
24412
24452
|
}
|
|
24413
24453
|
}
|
|
24414
24454
|
if (!endMatch) {
|
|
@@ -24697,7 +24737,9 @@ var require_sax = __commonJS({
|
|
|
24697
24737
|
domBuilder.endElement(ns3, localName, tagName);
|
|
24698
24738
|
if (localNSMap) {
|
|
24699
24739
|
for (prefix in localNSMap) {
|
|
24700
|
-
|
|
24740
|
+
if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
|
|
24741
|
+
domBuilder.endPrefixMapping(prefix);
|
|
24742
|
+
}
|
|
24701
24743
|
}
|
|
24702
24744
|
}
|
|
24703
24745
|
} else {
|
|
@@ -24735,7 +24777,9 @@ var require_sax = __commonJS({
|
|
|
24735
24777
|
}
|
|
24736
24778
|
function _copy(source, target) {
|
|
24737
24779
|
for (var n in source) {
|
|
24738
|
-
|
|
24780
|
+
if (Object.prototype.hasOwnProperty.call(source, n)) {
|
|
24781
|
+
target[n] = source[n];
|
|
24782
|
+
}
|
|
24739
24783
|
}
|
|
24740
24784
|
}
|
|
24741
24785
|
function parseDCC(source, start, domBuilder, errorHandler) {
|
|
@@ -37942,6 +37986,12 @@ export {
|
|
|
37942
37986
|
PodOS,
|
|
37943
37987
|
Thing
|
|
37944
37988
|
};
|
|
37989
|
+
/*!
|
|
37990
|
+
* Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
|
|
37991
|
+
*/
|
|
37992
|
+
/*!
|
|
37993
|
+
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
37994
|
+
*/
|
|
37945
37995
|
/*!
|
|
37946
37996
|
* The buffer module from node.js, for the browser.
|
|
37947
37997
|
*
|
package/lib/index.js
CHANGED
|
@@ -14970,7 +14970,7 @@ ${newlined}
|
|
|
14970
14970
|
} else if (algorithm === "sha1") {
|
|
14971
14971
|
this.algorithm = { name: "SHA-1" };
|
|
14972
14972
|
} else {
|
|
14973
|
-
throw new Error(`
|
|
14973
|
+
throw new Error(`Unsupported algorithm "${algorithm}".`);
|
|
14974
14974
|
}
|
|
14975
14975
|
this._content = "";
|
|
14976
14976
|
}
|
|
@@ -15165,11 +15165,7 @@ ${newlined}
|
|
|
15165
15165
|
}
|
|
15166
15166
|
return quads.sort().join("");
|
|
15167
15167
|
}
|
|
15168
|
-
static
|
|
15169
|
-
const s = quad5.subject;
|
|
15170
|
-
const p = quad5.predicate;
|
|
15171
|
-
const o = quad5.object;
|
|
15172
|
-
const g = quad5.graph;
|
|
15168
|
+
static serializeQuadComponents(s, p, o, g) {
|
|
15173
15169
|
let nquad = "";
|
|
15174
15170
|
if (s.termType === TYPE_NAMED_NODE) {
|
|
15175
15171
|
nquad += `<${s.value}>`;
|
|
@@ -15199,6 +15195,14 @@ ${newlined}
|
|
|
15199
15195
|
nquad += " .\n";
|
|
15200
15196
|
return nquad;
|
|
15201
15197
|
}
|
|
15198
|
+
static serializeQuad(quad5) {
|
|
15199
|
+
return NQuads.serializeQuadComponents(
|
|
15200
|
+
quad5.subject,
|
|
15201
|
+
quad5.predicate,
|
|
15202
|
+
quad5.object,
|
|
15203
|
+
quad5.graph
|
|
15204
|
+
);
|
|
15205
|
+
}
|
|
15202
15206
|
static legacyDatasetToQuads(dataset) {
|
|
15203
15207
|
const quads = [];
|
|
15204
15208
|
const termTypeMap = {
|
|
@@ -15321,11 +15325,14 @@ ${newlined}
|
|
|
15321
15325
|
var Permuter = require_Permuter();
|
|
15322
15326
|
var NQuads = require_NQuads();
|
|
15323
15327
|
module2.exports = class URDNA2015 {
|
|
15324
|
-
constructor({
|
|
15328
|
+
constructor({
|
|
15329
|
+
createMessageDigest = () => new MessageDigest("sha256"),
|
|
15330
|
+
maxDeepIterations = Infinity
|
|
15331
|
+
} = {}) {
|
|
15325
15332
|
this.name = "URDNA2015";
|
|
15326
15333
|
this.blankNodeInfo = /* @__PURE__ */ new Map();
|
|
15327
15334
|
this.canonicalIssuer = new IdentifierIssuer("_:c14n");
|
|
15328
|
-
this.
|
|
15335
|
+
this.createMessageDigest = createMessageDigest;
|
|
15329
15336
|
this.maxDeepIterations = maxDeepIterations;
|
|
15330
15337
|
this.quads = null;
|
|
15331
15338
|
this.deepIterations = null;
|
|
@@ -15379,11 +15386,13 @@ ${newlined}
|
|
|
15379
15386
|
}
|
|
15380
15387
|
const normalized = [];
|
|
15381
15388
|
for (const quad5 of this.quads) {
|
|
15382
|
-
const
|
|
15383
|
-
|
|
15384
|
-
|
|
15385
|
-
|
|
15386
|
-
|
|
15389
|
+
const nQuad = NQuads.serializeQuadComponents(
|
|
15390
|
+
this._componentWithCanonicalId(quad5.subject),
|
|
15391
|
+
quad5.predicate,
|
|
15392
|
+
this._componentWithCanonicalId(quad5.object),
|
|
15393
|
+
this._componentWithCanonicalId(quad5.graph)
|
|
15394
|
+
);
|
|
15395
|
+
normalized.push(nQuad);
|
|
15387
15396
|
}
|
|
15388
15397
|
normalized.sort();
|
|
15389
15398
|
return normalized.join("");
|
|
@@ -15417,7 +15426,7 @@ ${newlined}
|
|
|
15417
15426
|
nquads.push(NQuads.serializeQuad(copy));
|
|
15418
15427
|
}
|
|
15419
15428
|
nquads.sort();
|
|
15420
|
-
const md =
|
|
15429
|
+
const md = this.createMessageDigest();
|
|
15421
15430
|
for (const nquad of nquads) {
|
|
15422
15431
|
md.update(nquad);
|
|
15423
15432
|
}
|
|
@@ -15433,7 +15442,7 @@ ${newlined}
|
|
|
15433
15442
|
} else {
|
|
15434
15443
|
id3 = this.blankNodeInfo.get(related).hash;
|
|
15435
15444
|
}
|
|
15436
|
-
const md =
|
|
15445
|
+
const md = this.createMessageDigest();
|
|
15437
15446
|
md.update(position);
|
|
15438
15447
|
if (position !== "g") {
|
|
15439
15448
|
md.update(this.getRelatedPredicate(quad5));
|
|
@@ -15449,7 +15458,7 @@ ${newlined}
|
|
|
15449
15458
|
);
|
|
15450
15459
|
}
|
|
15451
15460
|
this.deepIterations.set(id3, deepIterations + 1);
|
|
15452
|
-
const md =
|
|
15461
|
+
const md = this.createMessageDigest();
|
|
15453
15462
|
const hashToRelated = await this.createHashToRelated(id3, issuer);
|
|
15454
15463
|
const hashes = [...hashToRelated.keys()].sort();
|
|
15455
15464
|
for (const hash of hashes) {
|
|
@@ -15595,7 +15604,7 @@ ${newlined}
|
|
|
15595
15604
|
hashToRelated.set(hash, [related]);
|
|
15596
15605
|
}
|
|
15597
15606
|
}
|
|
15598
|
-
|
|
15607
|
+
_componentWithCanonicalId(component) {
|
|
15599
15608
|
if (component.termType === "BlankNode" && !component.value.startsWith(this.canonicalIssuer.prefix)) {
|
|
15600
15609
|
return {
|
|
15601
15610
|
termType: "BlankNode",
|
|
@@ -15618,12 +15627,13 @@ ${newlined}
|
|
|
15618
15627
|
var require_URGNA2012 = __commonJS({
|
|
15619
15628
|
"../node_modules/rdf-canonize/lib/URGNA2012.js"(exports, module2) {
|
|
15620
15629
|
"use strict";
|
|
15630
|
+
var MessageDigest = require_MessageDigest_browser();
|
|
15621
15631
|
var URDNA2015 = require_URDNA2015();
|
|
15622
15632
|
module2.exports = class URDNA2012 extends URDNA2015 {
|
|
15623
15633
|
constructor() {
|
|
15624
15634
|
super();
|
|
15625
15635
|
this.name = "URGNA2012";
|
|
15626
|
-
this.
|
|
15636
|
+
this.createMessageDigest = () => new MessageDigest("sha1");
|
|
15627
15637
|
}
|
|
15628
15638
|
modifyFirstDegreeComponent(id3, component, key) {
|
|
15629
15639
|
if (component.termType !== "BlankNode") {
|
|
@@ -15690,11 +15700,14 @@ ${newlined}
|
|
|
15690
15700
|
var Permuter = require_Permuter();
|
|
15691
15701
|
var NQuads = require_NQuads();
|
|
15692
15702
|
module2.exports = class URDNA2015Sync {
|
|
15693
|
-
constructor({
|
|
15703
|
+
constructor({
|
|
15704
|
+
createMessageDigest = () => new MessageDigest("sha256"),
|
|
15705
|
+
maxDeepIterations = Infinity
|
|
15706
|
+
} = {}) {
|
|
15694
15707
|
this.name = "URDNA2015";
|
|
15695
15708
|
this.blankNodeInfo = /* @__PURE__ */ new Map();
|
|
15696
15709
|
this.canonicalIssuer = new IdentifierIssuer("_:c14n");
|
|
15697
|
-
this.
|
|
15710
|
+
this.createMessageDigest = createMessageDigest;
|
|
15698
15711
|
this.maxDeepIterations = maxDeepIterations;
|
|
15699
15712
|
this.quads = null;
|
|
15700
15713
|
this.deepIterations = null;
|
|
@@ -15744,11 +15757,13 @@ ${newlined}
|
|
|
15744
15757
|
}
|
|
15745
15758
|
const normalized = [];
|
|
15746
15759
|
for (const quad5 of this.quads) {
|
|
15747
|
-
const
|
|
15748
|
-
|
|
15749
|
-
|
|
15750
|
-
|
|
15751
|
-
|
|
15760
|
+
const nQuad = NQuads.serializeQuadComponents(
|
|
15761
|
+
this._componentWithCanonicalId({ component: quad5.subject }),
|
|
15762
|
+
quad5.predicate,
|
|
15763
|
+
this._componentWithCanonicalId({ component: quad5.object }),
|
|
15764
|
+
this._componentWithCanonicalId({ component: quad5.graph })
|
|
15765
|
+
);
|
|
15766
|
+
normalized.push(nQuad);
|
|
15752
15767
|
}
|
|
15753
15768
|
normalized.sort();
|
|
15754
15769
|
return normalized.join("");
|
|
@@ -15782,7 +15797,7 @@ ${newlined}
|
|
|
15782
15797
|
nquads.push(NQuads.serializeQuad(copy));
|
|
15783
15798
|
}
|
|
15784
15799
|
nquads.sort();
|
|
15785
|
-
const md =
|
|
15800
|
+
const md = this.createMessageDigest();
|
|
15786
15801
|
for (const nquad of nquads) {
|
|
15787
15802
|
md.update(nquad);
|
|
15788
15803
|
}
|
|
@@ -15798,7 +15813,7 @@ ${newlined}
|
|
|
15798
15813
|
} else {
|
|
15799
15814
|
id3 = this.blankNodeInfo.get(related).hash;
|
|
15800
15815
|
}
|
|
15801
|
-
const md =
|
|
15816
|
+
const md = this.createMessageDigest();
|
|
15802
15817
|
md.update(position);
|
|
15803
15818
|
if (position !== "g") {
|
|
15804
15819
|
md.update(this.getRelatedPredicate(quad5));
|
|
@@ -15814,7 +15829,7 @@ ${newlined}
|
|
|
15814
15829
|
);
|
|
15815
15830
|
}
|
|
15816
15831
|
this.deepIterations.set(id3, deepIterations + 1);
|
|
15817
|
-
const md =
|
|
15832
|
+
const md = this.createMessageDigest();
|
|
15818
15833
|
const hashToRelated = this.createHashToRelated(id3, issuer);
|
|
15819
15834
|
const hashes = [...hashToRelated.keys()].sort();
|
|
15820
15835
|
for (const hash of hashes) {
|
|
@@ -15945,7 +15960,7 @@ ${newlined}
|
|
|
15945
15960
|
hashToRelated.set(hash, [related]);
|
|
15946
15961
|
}
|
|
15947
15962
|
}
|
|
15948
|
-
|
|
15963
|
+
_componentWithCanonicalId({ component }) {
|
|
15949
15964
|
if (component.termType === "BlankNode" && !component.value.startsWith(this.canonicalIssuer.prefix)) {
|
|
15950
15965
|
return {
|
|
15951
15966
|
termType: "BlankNode",
|
|
@@ -15965,12 +15980,13 @@ ${newlined}
|
|
|
15965
15980
|
var require_URGNA2012Sync = __commonJS({
|
|
15966
15981
|
"../node_modules/rdf-canonize/lib/URGNA2012Sync.js"(exports, module2) {
|
|
15967
15982
|
"use strict";
|
|
15983
|
+
var MessageDigest = require_MessageDigest_browser();
|
|
15968
15984
|
var URDNA2015Sync = require_URDNA2015Sync();
|
|
15969
15985
|
module2.exports = class URDNA2012Sync extends URDNA2015Sync {
|
|
15970
15986
|
constructor() {
|
|
15971
15987
|
super();
|
|
15972
15988
|
this.name = "URGNA2012";
|
|
15973
|
-
this.
|
|
15989
|
+
this.createMessageDigest = () => new MessageDigest("sha1");
|
|
15974
15990
|
}
|
|
15975
15991
|
modifyFirstDegreeComponent(id3, component, key) {
|
|
15976
15992
|
if (component.termType !== "BlankNode") {
|
|
@@ -16027,7 +16043,7 @@ ${newlined}
|
|
|
16027
16043
|
|
|
16028
16044
|
// ../node_modules/rdf-canonize/lib/index.js
|
|
16029
16045
|
var require_lib = __commonJS({
|
|
16030
|
-
"../node_modules/rdf-canonize/lib/index.js"(exports
|
|
16046
|
+
"../node_modules/rdf-canonize/lib/index.js"(exports) {
|
|
16031
16047
|
"use strict";
|
|
16032
16048
|
var URDNA2015 = require_URDNA2015();
|
|
16033
16049
|
var URGNA2012 = require_URGNA2012();
|
|
@@ -16038,30 +16054,38 @@ ${newlined}
|
|
|
16038
16054
|
rdfCanonizeNative = require_rdf_canonize_native();
|
|
16039
16055
|
} catch (e) {
|
|
16040
16056
|
}
|
|
16041
|
-
|
|
16042
|
-
|
|
16043
|
-
|
|
16044
|
-
|
|
16045
|
-
|
|
16046
|
-
if (api2) {
|
|
16047
|
-
rdfCanonizeNative = api2;
|
|
16057
|
+
exports.NQuads = require_NQuads();
|
|
16058
|
+
exports.IdentifierIssuer = require_IdentifierIssuer();
|
|
16059
|
+
exports._rdfCanonizeNative = function(api) {
|
|
16060
|
+
if (api) {
|
|
16061
|
+
rdfCanonizeNative = api;
|
|
16048
16062
|
}
|
|
16049
16063
|
return rdfCanonizeNative;
|
|
16050
16064
|
};
|
|
16051
|
-
|
|
16065
|
+
exports.canonize = async function(dataset, options) {
|
|
16052
16066
|
if (!Array.isArray(dataset)) {
|
|
16053
|
-
dataset =
|
|
16067
|
+
dataset = exports.NQuads.legacyDatasetToQuads(dataset);
|
|
16054
16068
|
}
|
|
16055
16069
|
if (options.useNative) {
|
|
16056
16070
|
if (!rdfCanonizeNative) {
|
|
16057
16071
|
throw new Error("rdf-canonize-native not available");
|
|
16058
16072
|
}
|
|
16073
|
+
if (options.createMessageDigest) {
|
|
16074
|
+
throw new Error(
|
|
16075
|
+
'"createMessageDigest" cannot be used with "useNative".'
|
|
16076
|
+
);
|
|
16077
|
+
}
|
|
16059
16078
|
return new Promise((resolve, reject3) => rdfCanonizeNative.canonize(dataset, options, (err, canonical) => err ? reject3(err) : resolve(canonical)));
|
|
16060
16079
|
}
|
|
16061
16080
|
if (options.algorithm === "URDNA2015") {
|
|
16062
16081
|
return new URDNA2015(options).main(dataset);
|
|
16063
16082
|
}
|
|
16064
16083
|
if (options.algorithm === "URGNA2012") {
|
|
16084
|
+
if (options.createMessageDigest) {
|
|
16085
|
+
throw new Error(
|
|
16086
|
+
'"createMessageDigest" cannot be used with "URGNA2012".'
|
|
16087
|
+
);
|
|
16088
|
+
}
|
|
16065
16089
|
return new URGNA2012(options).main(dataset);
|
|
16066
16090
|
}
|
|
16067
16091
|
if (!("algorithm" in options)) {
|
|
@@ -16071,20 +16095,30 @@ ${newlined}
|
|
|
16071
16095
|
"Invalid RDF Dataset Canonicalization algorithm: " + options.algorithm
|
|
16072
16096
|
);
|
|
16073
16097
|
};
|
|
16074
|
-
|
|
16098
|
+
exports._canonizeSync = function(dataset, options) {
|
|
16075
16099
|
if (!Array.isArray(dataset)) {
|
|
16076
|
-
dataset =
|
|
16100
|
+
dataset = exports.NQuads.legacyDatasetToQuads(dataset);
|
|
16077
16101
|
}
|
|
16078
16102
|
if (options.useNative) {
|
|
16079
|
-
if (rdfCanonizeNative) {
|
|
16080
|
-
|
|
16103
|
+
if (!rdfCanonizeNative) {
|
|
16104
|
+
throw new Error("rdf-canonize-native not available");
|
|
16105
|
+
}
|
|
16106
|
+
if (options.createMessageDigest) {
|
|
16107
|
+
throw new Error(
|
|
16108
|
+
'"createMessageDigest" cannot be used with "useNative".'
|
|
16109
|
+
);
|
|
16081
16110
|
}
|
|
16082
|
-
|
|
16111
|
+
return rdfCanonizeNative.canonizeSync(dataset, options);
|
|
16083
16112
|
}
|
|
16084
16113
|
if (options.algorithm === "URDNA2015") {
|
|
16085
16114
|
return new URDNA2015Sync(options).main(dataset);
|
|
16086
16115
|
}
|
|
16087
16116
|
if (options.algorithm === "URGNA2012") {
|
|
16117
|
+
if (options.createMessageDigest) {
|
|
16118
|
+
throw new Error(
|
|
16119
|
+
'"createMessageDigest" cannot be used with "URGNA2012".'
|
|
16120
|
+
);
|
|
16121
|
+
}
|
|
16088
16122
|
return new URGNA2012Sync(options).main(dataset);
|
|
16089
16123
|
}
|
|
16090
16124
|
if (!("algorithm" in options)) {
|
|
@@ -22910,7 +22944,9 @@ ${newlined}
|
|
|
22910
22944
|
}
|
|
22911
22945
|
function copy(src, dest) {
|
|
22912
22946
|
for (var p in src) {
|
|
22913
|
-
|
|
22947
|
+
if (Object.prototype.hasOwnProperty.call(src, p)) {
|
|
22948
|
+
dest[p] = src[p];
|
|
22949
|
+
}
|
|
22914
22950
|
}
|
|
22915
22951
|
}
|
|
22916
22952
|
function _extends(Class, Super) {
|
|
@@ -23197,7 +23233,7 @@ ${newlined}
|
|
|
23197
23233
|
var map2 = el._nsMap;
|
|
23198
23234
|
if (map2) {
|
|
23199
23235
|
for (var n in map2) {
|
|
23200
|
-
if (map2[n]
|
|
23236
|
+
if (Object.prototype.hasOwnProperty.call(map2, n) && map2[n] === namespaceURI) {
|
|
23201
23237
|
return n;
|
|
23202
23238
|
}
|
|
23203
23239
|
}
|
|
@@ -23211,7 +23247,7 @@ ${newlined}
|
|
|
23211
23247
|
while (el) {
|
|
23212
23248
|
var map2 = el._nsMap;
|
|
23213
23249
|
if (map2) {
|
|
23214
|
-
if (prefix
|
|
23250
|
+
if (Object.prototype.hasOwnProperty.call(map2, prefix)) {
|
|
23215
23251
|
return map2[prefix];
|
|
23216
23252
|
}
|
|
23217
23253
|
}
|
|
@@ -23899,10 +23935,12 @@ ${newlined}
|
|
|
23899
23935
|
function cloneNode(doc, node, deep) {
|
|
23900
23936
|
var node2 = new node.constructor();
|
|
23901
23937
|
for (var n in node) {
|
|
23902
|
-
|
|
23903
|
-
|
|
23904
|
-
if (v !=
|
|
23905
|
-
node2[n]
|
|
23938
|
+
if (Object.prototype.hasOwnProperty.call(node, n)) {
|
|
23939
|
+
var v = node[n];
|
|
23940
|
+
if (typeof v != "object") {
|
|
23941
|
+
if (v != node2[n]) {
|
|
23942
|
+
node2[n] = v;
|
|
23943
|
+
}
|
|
23906
23944
|
}
|
|
23907
23945
|
}
|
|
23908
23946
|
}
|
|
@@ -24373,7 +24411,9 @@ ${newlined}
|
|
|
24373
24411
|
domBuilder.endElement(config.uri, config.localName, tagName);
|
|
24374
24412
|
if (localNSMap) {
|
|
24375
24413
|
for (var prefix in localNSMap) {
|
|
24376
|
-
|
|
24414
|
+
if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
|
|
24415
|
+
domBuilder.endPrefixMapping(prefix);
|
|
24416
|
+
}
|
|
24377
24417
|
}
|
|
24378
24418
|
}
|
|
24379
24419
|
if (!endMatch) {
|
|
@@ -24662,7 +24702,9 @@ ${newlined}
|
|
|
24662
24702
|
domBuilder.endElement(ns3, localName, tagName);
|
|
24663
24703
|
if (localNSMap) {
|
|
24664
24704
|
for (prefix in localNSMap) {
|
|
24665
|
-
|
|
24705
|
+
if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
|
|
24706
|
+
domBuilder.endPrefixMapping(prefix);
|
|
24707
|
+
}
|
|
24666
24708
|
}
|
|
24667
24709
|
}
|
|
24668
24710
|
} else {
|
|
@@ -24700,7 +24742,9 @@ ${newlined}
|
|
|
24700
24742
|
}
|
|
24701
24743
|
function _copy(source, target) {
|
|
24702
24744
|
for (var n in source) {
|
|
24703
|
-
|
|
24745
|
+
if (Object.prototype.hasOwnProperty.call(source, n)) {
|
|
24746
|
+
target[n] = source[n];
|
|
24747
|
+
}
|
|
24704
24748
|
}
|
|
24705
24749
|
}
|
|
24706
24750
|
function parseDCC(source, start, domBuilder, errorHandler) {
|
|
@@ -37913,6 +37957,12 @@ ${newlined}
|
|
|
37913
37957
|
};
|
|
37914
37958
|
return __toCommonJS(src_exports);
|
|
37915
37959
|
})();
|
|
37960
|
+
/*!
|
|
37961
|
+
* Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
|
|
37962
|
+
*/
|
|
37963
|
+
/*!
|
|
37964
|
+
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
37965
|
+
*/
|
|
37916
37966
|
/*!
|
|
37917
37967
|
* The buffer module from node.js, for the browser.
|
|
37918
37968
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pod-os/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -24,19 +24,19 @@
|
|
|
24
24
|
"author": "Angelo Veltens",
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@babel/preset-env": "^7.
|
|
27
|
+
"@babel/preset-env": "^7.19.4",
|
|
28
28
|
"@babel/preset-typescript": "^7.18.6",
|
|
29
|
-
"@types/jest": "^29.
|
|
29
|
+
"@types/jest": "^29.2.0",
|
|
30
30
|
"@types/jest-when": "^3.5.2",
|
|
31
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
32
|
-
"@typescript-eslint/parser": "^5.
|
|
33
|
-
"esbuild": "^0.15.
|
|
34
|
-
"eslint": "^8.
|
|
35
|
-
"jest": "^29.
|
|
36
|
-
"jest-when": "^3.5.
|
|
31
|
+
"@typescript-eslint/eslint-plugin": "^5.41.0",
|
|
32
|
+
"@typescript-eslint/parser": "^5.41.0",
|
|
33
|
+
"esbuild": "^0.15.12",
|
|
34
|
+
"eslint": "^8.26.0",
|
|
35
|
+
"jest": "^29.2.2",
|
|
36
|
+
"jest-when": "^3.5.2",
|
|
37
37
|
"prettier": "^2.7.1",
|
|
38
38
|
"rimraf": "^3.0.2",
|
|
39
|
-
"typescript": "^4.8.
|
|
39
|
+
"typescript": "^4.8.4"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@inrupt/solid-client-authn-browser": "^1.12.2",
|