rdflib 2.3.1-c71dde13 → 2.3.2-075b5109
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/515.rdflib.min.js +1 -1
- package/dist/515.rdflib.min.js.map +1 -1
- package/dist/rdflib.min.js +1 -1
- package/dist/rdflib.min.js.LICENSE.txt +0 -7
- package/dist/rdflib.min.js.map +1 -1
- package/esm/fetcher.js +11 -2
- package/esm/n3parser.js +1 -2
- package/lib/collection.d.ts +1 -1
- package/lib/fetcher.js +11 -2
- package/lib/index.d.ts +1 -1
- package/lib/n3parser.js +1 -2
- package/lib/rdfaparser.d.ts +9 -9
- package/lib/rdfxmlparser.d.ts +1 -1
- package/lib/serializer.d.ts +3 -3
- package/lib/xsd-internal.d.ts +7 -7
- package/lib/xsd.d.ts +7 -7
- package/package.json +21 -18
- package/src/fetcher.ts +11 -2
- package/src/jsonldparser.js +2 -2
- package/src/n3parser.js +669 -670
- package/src/serializer.js +6 -6
- package/src/xsd-internal.js +1 -1
- package/src/xsd.js +4 -4
package/esm/fetcher.js
CHANGED
|
@@ -475,10 +475,19 @@ export default class Fetcher {
|
|
|
475
475
|
this.timeout = options.timeout || 30000;
|
|
476
476
|
|
|
477
477
|
// solidFetcher is deprecated
|
|
478
|
-
|
|
479
|
-
if (!
|
|
478
|
+
let fetchFunc = options.fetch || typeof global !== 'undefined' && (global.solidFetcher || global.solidFetch) || typeof window !== 'undefined' && (window.solidFetcher || window.solidFetch) || crossFetch;
|
|
479
|
+
if (!fetchFunc) {
|
|
480
480
|
throw new Error('No _fetch function available for Fetcher');
|
|
481
481
|
}
|
|
482
|
+
// Bind fetch to its context to avoid "Illegal invocation" errors
|
|
483
|
+
// Check if it's the native browser fetch or global fetch that needs binding
|
|
484
|
+
if (typeof window !== 'undefined' && fetchFunc === window.fetch) {
|
|
485
|
+
this._fetch = fetchFunc.bind(window);
|
|
486
|
+
} else if (typeof global !== 'undefined' && fetchFunc === global.fetch) {
|
|
487
|
+
this._fetch = fetchFunc.bind(global);
|
|
488
|
+
} else {
|
|
489
|
+
this._fetch = fetchFunc;
|
|
490
|
+
}
|
|
482
491
|
// This is the name of the graph we store all the HTTP metadata in
|
|
483
492
|
this.appNode = this.store.sym('chrome://TheCurrentSession');
|
|
484
493
|
// this.appNode = this.store.rdfFactory.blankNode() // Needs to have a URI in tests
|
package/esm/n3parser.js
CHANGED
|
@@ -588,8 +588,7 @@ export class SinkParser {
|
|
|
588
588
|
while ("!^.".indexOf(str.slice(j, j + 1)) >= 0) {
|
|
589
589
|
var ch = str.slice(j, j + 1);
|
|
590
590
|
if (ch == ".") {
|
|
591
|
-
|
|
592
|
-
if (!ahead || _notNameChars.indexOf(ahead) >= 0 && ":?<[{(".indexOf(ahead) < 0) {
|
|
591
|
+
if (dotTerminatesName(str, j)) {
|
|
593
592
|
break;
|
|
594
593
|
}
|
|
595
594
|
}
|
package/lib/collection.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export default class Collection<T extends Node = Node | RdflibBlankNode | Collec
|
|
|
49
49
|
* Creates a new Collection with the substituting bindings applied
|
|
50
50
|
* @param bindings - The bindings to substitute
|
|
51
51
|
*/
|
|
52
|
-
substitute(bindings: Bindings): any
|
|
52
|
+
substitute(bindings: Bindings): Collection<Node | Collection<any> | Literal | Variable>;
|
|
53
53
|
toNT(): string;
|
|
54
54
|
static toNT(collection: any): string;
|
|
55
55
|
/**
|
package/lib/fetcher.js
CHANGED
|
@@ -484,10 +484,19 @@ class Fetcher {
|
|
|
484
484
|
this.timeout = options.timeout || 30000;
|
|
485
485
|
|
|
486
486
|
// solidFetcher is deprecated
|
|
487
|
-
|
|
488
|
-
if (!
|
|
487
|
+
let fetchFunc = options.fetch || typeof global !== 'undefined' && (global.solidFetcher || global.solidFetch) || typeof window !== 'undefined' && (window.solidFetcher || window.solidFetch) || _crossFetch.default;
|
|
488
|
+
if (!fetchFunc) {
|
|
489
489
|
throw new Error('No _fetch function available for Fetcher');
|
|
490
490
|
}
|
|
491
|
+
// Bind fetch to its context to avoid "Illegal invocation" errors
|
|
492
|
+
// Check if it's the native browser fetch or global fetch that needs binding
|
|
493
|
+
if (typeof window !== 'undefined' && fetchFunc === window.fetch) {
|
|
494
|
+
this._fetch = fetchFunc.bind(window);
|
|
495
|
+
} else if (typeof global !== 'undefined' && fetchFunc === global.fetch) {
|
|
496
|
+
this._fetch = fetchFunc.bind(global);
|
|
497
|
+
} else {
|
|
498
|
+
this._fetch = fetchFunc;
|
|
499
|
+
}
|
|
491
500
|
// This is the name of the graph we store all the HTTP metadata in
|
|
492
501
|
this.appNode = this.store.sym('chrome://TheCurrentSession');
|
|
493
502
|
// this.appNode = this.store.rdfFactory.blankNode() // Needs to have a URI in tests
|
package/lib/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ import * as uri from './uri';
|
|
|
28
28
|
import * as Util from './utils-js';
|
|
29
29
|
import Variable from './variable';
|
|
30
30
|
import DataFactory from './factories/rdflib-data-factory';
|
|
31
|
-
declare const fetcher: (store: Store, options: any) => Fetcher, graph: (features?: any, opts?: any) => Store, lit: (val: string, lang?: string
|
|
31
|
+
declare const fetcher: (store: Store, options: any) => Fetcher, graph: (features?: any, opts?: any) => Store, lit: (val: string, lang?: string, dt?: import("./tf-types").NamedNode) => Literal, st: (subject: import("./tf-types").Quad_Subject, predicate: import("./tf-types").Quad_Predicate, object: import("./tf-types").Quad_Object, graph?: import("./tf-types").Quad_Graph) => Statement, namedNode: (value: string) => NamedNode, variable: (value: string) => Variable, blankNode: (value?: string) => BlankNode, defaultGraph: () => import("./default-graph").default, literal: (value: string, languageOrDatatype?: string | import("./tf-types").NamedNode) => Literal, quad: (subject: import("./tf-types").Term, predicate: import("./tf-types").Term, object: import("./tf-types").Term, graph?: import("./tf-types").Term) => Statement, triple: (subject: import("./tf-types").Term, predicate: import("./tf-types").Term, object: import("./tf-types").Term, graph?: import("./tf-types").Term) => import("./tf-types").Quad<any, any, any, any>;
|
|
32
32
|
declare const fromNT: (str: any) => any;
|
|
33
33
|
declare const term: <T extends import("./types").FromValueReturns>(value: import("./types").ValueType) => T;
|
|
34
34
|
declare const NextId: number;
|
package/lib/n3parser.js
CHANGED
|
@@ -596,8 +596,7 @@ class SinkParser {
|
|
|
596
596
|
while ("!^.".indexOf(str.slice(j, j + 1)) >= 0) {
|
|
597
597
|
var ch = str.slice(j, j + 1);
|
|
598
598
|
if (ch == ".") {
|
|
599
|
-
|
|
600
|
-
if (!ahead || _notNameChars.indexOf(ahead) >= 0 && ":?<[{(".indexOf(ahead) < 0) {
|
|
599
|
+
if (dotTerminatesName(str, j)) {
|
|
601
600
|
break;
|
|
602
601
|
}
|
|
603
602
|
}
|
package/lib/rdfaparser.d.ts
CHANGED
|
@@ -61,15 +61,15 @@ declare class RDFaProcessor {
|
|
|
61
61
|
trim(str: any): any;
|
|
62
62
|
}
|
|
63
63
|
declare namespace RDFaProcessor {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
let XMLLiteralURI: string;
|
|
65
|
+
let HTMLLiteralURI: string;
|
|
66
|
+
let PlainLiteralURI: string;
|
|
67
|
+
let objectURI: string;
|
|
68
|
+
let typeURI: string;
|
|
69
|
+
let nameChar: string;
|
|
70
|
+
let nameStartChar: string;
|
|
71
|
+
let NCNAME: RegExp;
|
|
72
|
+
let dateTimeTypes: {
|
|
73
73
|
pattern: RegExp;
|
|
74
74
|
type: string;
|
|
75
75
|
}[];
|
package/lib/rdfxmlparser.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export default class RDFParser {
|
|
|
25
25
|
};
|
|
26
26
|
constructor(store: any);
|
|
27
27
|
/** Our triple store reference @private */
|
|
28
|
-
store
|
|
28
|
+
private store; /** Our identified blank nodes @private */
|
|
29
29
|
bnodes: {}; /** A context for context-aware stores @private */
|
|
30
30
|
why: any; /** Reification flag */
|
|
31
31
|
reify: boolean;
|
package/lib/serializer.d.ts
CHANGED
|
@@ -21,14 +21,14 @@ export class Serializer {
|
|
|
21
21
|
langString: import("./named-node").default;
|
|
22
22
|
string: import("./named-node").default;
|
|
23
23
|
};
|
|
24
|
-
setBase(base: any):
|
|
24
|
+
setBase(base: any): this;
|
|
25
25
|
/**
|
|
26
26
|
* Set serializer behavior flags. Letters can be combined with spaces.
|
|
27
27
|
* Examples: 'si', 'deinprstux', 'si dr', 'o'.
|
|
28
28
|
* Notable flags:
|
|
29
29
|
* - 'o': do not abbreviate to a prefixed name when the local part contains a dot
|
|
30
30
|
*/
|
|
31
|
-
setFlags(flags: any):
|
|
31
|
+
setFlags(flags: any): this;
|
|
32
32
|
toStr(x: any): any;
|
|
33
33
|
fromStr(s: any): any;
|
|
34
34
|
/**
|
|
@@ -45,7 +45,7 @@ export class Serializer {
|
|
|
45
45
|
*/
|
|
46
46
|
setPrefix(prefix: any, uri: any): void;
|
|
47
47
|
suggestPrefix(prefix: any, uri: any): void;
|
|
48
|
-
suggestNamespaces(namespaces: any):
|
|
48
|
+
suggestNamespaces(namespaces: any): this;
|
|
49
49
|
checkIntegrity(): void;
|
|
50
50
|
makeUpPrefix(uri: any): any;
|
|
51
51
|
rootSubjects(sts: any): {
|
package/lib/xsd-internal.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare namespace _default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
let boolean: NamedNode;
|
|
3
|
+
let dateTime: NamedNode;
|
|
4
|
+
let decimal: NamedNode;
|
|
5
|
+
let double: NamedNode;
|
|
6
|
+
let integer: NamedNode;
|
|
7
|
+
let langString: NamedNode;
|
|
8
|
+
let string: NamedNode;
|
|
9
9
|
}
|
|
10
10
|
export default _default;
|
|
11
11
|
import NamedNode from './named-node';
|
package/lib/xsd.d.ts
CHANGED
|
@@ -9,11 +9,11 @@ export function createXSD(localFactory?: import("./factories/factory-types").Dat
|
|
|
9
9
|
};
|
|
10
10
|
export default defaultXSD;
|
|
11
11
|
declare namespace defaultXSD {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
let boolean: import("./named-node").default;
|
|
13
|
+
let dateTime: import("./named-node").default;
|
|
14
|
+
let decimal: import("./named-node").default;
|
|
15
|
+
let double: import("./named-node").default;
|
|
16
|
+
let integer: import("./named-node").default;
|
|
17
|
+
let langString: import("./named-node").default;
|
|
18
|
+
let string: import("./named-node").default;
|
|
19
19
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rdflib",
|
|
3
3
|
"description": "an RDF library for node.js. Suitable for client and server side.",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.2-075b5109",
|
|
5
5
|
"private": false,
|
|
6
6
|
"browserslist": [
|
|
7
7
|
"> 0.5%"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@babel/runtime": "^7.28.4",
|
|
48
48
|
"@frogcat/ttl2jsonld": "^0.0.10",
|
|
49
49
|
"@rdfjs/types": "^2.0.1",
|
|
50
|
-
"@xmldom/xmldom": "^0.8.
|
|
50
|
+
"@xmldom/xmldom": "^0.8.11",
|
|
51
51
|
"cross-fetch": "^4.1.0",
|
|
52
52
|
"jsonld": "^9.0.0",
|
|
53
53
|
"n3": "^1.26.0",
|
|
@@ -61,30 +61,31 @@
|
|
|
61
61
|
"@babel/preset-env": "^7.28.5",
|
|
62
62
|
"@babel/preset-typescript": "^7.28.5",
|
|
63
63
|
"@babel/register": "^7.28.3",
|
|
64
|
-
"@types/chai": "^
|
|
64
|
+
"@types/chai": "^5.2.3",
|
|
65
65
|
"@types/dirty-chai": "^2.0.5",
|
|
66
|
-
"@types/express": "^
|
|
66
|
+
"@types/express": "^5.0.6",
|
|
67
67
|
"@types/jsonld": "^1.5.15",
|
|
68
68
|
"@types/mocha": "^10.0.10",
|
|
69
|
-
"@types/
|
|
70
|
-
"
|
|
71
|
-
"
|
|
69
|
+
"@types/node": "^25.0.1",
|
|
70
|
+
"@types/sinon-chai": "^4.0.0",
|
|
71
|
+
"babel-loader": "^10.0.0",
|
|
72
|
+
"chai": "^6.2.1",
|
|
73
|
+
"colors": "^1.4.0",
|
|
72
74
|
"diff": "^8.0.2",
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"fs-grep": "0.0.5",
|
|
75
|
+
"eslint": "^9.39.2",
|
|
76
|
+
"globals": "^16.5.0",
|
|
76
77
|
"locate-path": "^8.0.0",
|
|
77
|
-
"mocha": "^
|
|
78
|
-
"nock": "^
|
|
78
|
+
"mocha": "^11.7.5",
|
|
79
|
+
"nock": "^14.0.10",
|
|
79
80
|
"node-fetch": "^3.3.2",
|
|
80
|
-
"node-polyfill-webpack-plugin": "^
|
|
81
|
+
"node-polyfill-webpack-plugin": "^4.1.0",
|
|
81
82
|
"rimraf": "^6.1.2",
|
|
82
|
-
"sinon": "^
|
|
83
|
-
"sinon-chai": "^
|
|
84
|
-
"source-map-loader": "^
|
|
83
|
+
"sinon": "^21.0.0",
|
|
84
|
+
"sinon-chai": "^4.0.1",
|
|
85
|
+
"source-map-loader": "^5.0.0",
|
|
85
86
|
"ts-node": "^10.9.2",
|
|
86
87
|
"typedoc": "^0.28.15",
|
|
87
|
-
"typescript": "^5.
|
|
88
|
+
"typescript": "^5.9.3",
|
|
88
89
|
"webpack": "^5.103.0",
|
|
89
90
|
"webpack-cli": "^6.0.1",
|
|
90
91
|
"webpack-dev-server": "^5.2.2"
|
|
@@ -96,6 +97,8 @@
|
|
|
96
97
|
"build:types": "tsc --emitDeclarationOnly -d --moduleResolution node --declarationDir lib",
|
|
97
98
|
"build:all": "npm run build && npm run build:types && npm run build:browser && npm run build:esm",
|
|
98
99
|
"doc": "typedoc --out ./doc ./src/index.ts --excludePrivate --excludeInternal --tsconfig ./tsconfig.json",
|
|
100
|
+
"lint": "eslint src tests",
|
|
101
|
+
"lint:fix": "eslint src tests --fix",
|
|
99
102
|
"ignore:prepublishOnly": "npm ci && npm run build:all && npm run doc && npm run test",
|
|
100
103
|
"postversion": "git push --follow-tags",
|
|
101
104
|
"start": "webpack serve --port 4800",
|
|
@@ -103,7 +106,7 @@
|
|
|
103
106
|
"test:clean": "rimraf tests/serialize/,*",
|
|
104
107
|
"test:serialize": "npm run build && npm run test:serialize:all && npm run test:clean",
|
|
105
108
|
"test:serialize:all": "npm run test:serialize:1 && npm run test:serialize:2 && npm run test:serialize:3 && npm run test:serialize:4 && npm run test:serialize:5 && npm run test:serialize:6 && npm run test:serialize:7 && npm run test:serialize:8 && npm run test:serialize:10 && npm run test:serialize:11 && npm run test:serialize:12 && npm run test:serialize:13 && npm run test:serialize:14 && npm run test:serialize:15 && npm run test:serialize:16 && npm run test:serialize:17 && npm run test:serialize:18",
|
|
106
|
-
"test:serialize:1": "cd ./tests/serialize && node ./data.js -in=t1.ttl -format=application/rdf+xml -out=,t1.xml &&
|
|
109
|
+
"test:serialize:1": "cd ./tests/serialize && node ./data.js -in=t1.ttl -format=application/rdf+xml -out=,t1.xml && node diff ,t1.xml t1-ref.xml",
|
|
107
110
|
"test:serialize:2": "cd ./tests/serialize && node ./data.js -in=t2.ttl -format=application/rdf+xml -out=,t2.xml && node diff ,t2.xml t2-ref.xml",
|
|
108
111
|
"test:serialize:3": "cd ./tests/serialize && node ./data.js -in=t3.ttl -format=application/rdf+xml -out=,t3.xml && node diff ,t3.xml t3-ref.xml",
|
|
109
112
|
"test:serialize:4": "cd ./tests/serialize && node ./data.js -in=t3.ttl -out=,t4.ttl && node diff ,t4.ttl t4-ref.ttl",
|
package/src/fetcher.ts
CHANGED
|
@@ -756,13 +756,22 @@ export default class Fetcher implements CallbackifyInterface {
|
|
|
756
756
|
this.timeout = options.timeout || 30000
|
|
757
757
|
|
|
758
758
|
// solidFetcher is deprecated
|
|
759
|
-
|
|
759
|
+
let fetchFunc = options.fetch
|
|
760
760
|
|| (typeof global !== 'undefined' && (global.solidFetcher || global.solidFetch))
|
|
761
761
|
|| (typeof window !== 'undefined' && (window.solidFetcher || window.solidFetch))
|
|
762
762
|
|| crossFetch
|
|
763
|
-
if (!
|
|
763
|
+
if (!fetchFunc) {
|
|
764
764
|
throw new Error('No _fetch function available for Fetcher')
|
|
765
765
|
}
|
|
766
|
+
// Bind fetch to its context to avoid "Illegal invocation" errors
|
|
767
|
+
// Check if it's the native browser fetch or global fetch that needs binding
|
|
768
|
+
if (typeof window !== 'undefined' && fetchFunc === window.fetch) {
|
|
769
|
+
this._fetch = fetchFunc.bind(window)
|
|
770
|
+
} else if (typeof global !== 'undefined' && fetchFunc === global.fetch) {
|
|
771
|
+
this._fetch = fetchFunc.bind(global)
|
|
772
|
+
} else {
|
|
773
|
+
this._fetch = fetchFunc
|
|
774
|
+
}
|
|
766
775
|
// This is the name of the graph we store all the HTTP metadata in
|
|
767
776
|
this.appNode = this.store.sym('chrome://TheCurrentSession')
|
|
768
777
|
// this.appNode = this.store.rdfFactory.blankNode() // Needs to have a URI in tests
|
package/src/jsonldparser.js
CHANGED
|
@@ -78,10 +78,10 @@ export default async function jsonldParser(str, kb, base) {
|
|
|
78
78
|
function nodeType(kb, obj) {
|
|
79
79
|
if (obj['@id'].startsWith('_:')) {
|
|
80
80
|
// This object is a Blank Node. Pass the id without the `_:` prefix
|
|
81
|
-
return kb.rdfFactory.blankNode(obj['@id'].substring(2))
|
|
81
|
+
return kb.rdfFactory.blankNode(obj['@id'].substring(2))
|
|
82
82
|
} else {
|
|
83
83
|
// This object is a Named Node
|
|
84
|
-
return kb.rdfFactory.namedNode(obj['@id'])
|
|
84
|
+
return kb.rdfFactory.namedNode(obj['@id'])
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|