jsonld-streaming-parser
Advanced tools
Comparing version 3.2.0 to 3.2.1
@@ -182,3 +182,2 @@ "use strict"; | ||
} | ||
exports.EntryHandlerContainer = EntryHandlerContainer; | ||
EntryHandlerContainer.CONTAINER_HANDLERS = { | ||
@@ -190,2 +189,3 @@ '@id': new ContainerHandlerIdentifier_1.ContainerHandlerIdentifier(), | ||
}; | ||
exports.EntryHandlerContainer = EntryHandlerContainer; | ||
//# sourceMappingURL=EntryHandlerContainer.js.map |
@@ -45,3 +45,2 @@ "use strict"; | ||
} | ||
exports.EntryHandlerKeywordUnknownFallback = EntryHandlerKeywordUnknownFallback; | ||
EntryHandlerKeywordUnknownFallback.VALID_KEYWORDS_TYPES = { | ||
@@ -54,2 +53,3 @@ '@index': { type: 'string', errorCode: jsonld_context_parser_1.ERROR_CODES.INVALID_INDEX_VALUE }, | ||
}; | ||
exports.EntryHandlerKeywordUnknownFallback = EntryHandlerKeywordUnknownFallback; | ||
//# sourceMappingURL=EntryHandlerKeywordUnknownFallback.js.map |
@@ -375,9 +375,4 @@ "use strict"; | ||
} | ||
else if (keys[depth] === '@type' | ||
|| typeof keys[depth] === 'number' && keys[depth - 1] === '@type') { // Also capture @type with array values | ||
// Remove @type from keys, because we want it to apply to parent later on | ||
this.typeJobs.push({ job: valueJobCb, keys: keys.slice(0, keys.length - 1) }); | ||
} | ||
else { | ||
this.contextAwaitingJobs.push({ job: valueJobCb, keys }); | ||
this.contextAwaitingJobs.push({ job: valueJobCb, keys, depth }); | ||
} | ||
@@ -428,4 +423,15 @@ } | ||
this.parsingContext.unaliasedKeywordCacheStack.splice(0); | ||
const contextAwaitingJobs = []; | ||
for (const job of this.contextAwaitingJobs) { | ||
if ((await this.util.unaliasKeyword(job.keys[job.depth], job.keys, job.depth, true)) === '@type' | ||
|| typeof job.keys[job.depth] === 'number' && (await this.util.unaliasKeyword(job.keys[job.depth - 1], job.keys, job.depth - 1, true)) === '@type') { // Also capture @type with array values | ||
// Remove @type from keys, because we want it to apply to parent later on | ||
this.typeJobs.push({ job: job.job, keys: job.keys.slice(0, job.keys.length - 1) }); | ||
} | ||
else { | ||
contextAwaitingJobs.push(job); | ||
} | ||
} | ||
// Handle non-context jobs | ||
for (const job of this.contextAwaitingJobs) { | ||
for (const job of contextAwaitingJobs) { | ||
// Check if we have a type (with possible type-scoped context) that should be handled before. | ||
@@ -461,3 +467,2 @@ // We check all possible parent nodes for the current job, from root to leaves. | ||
} | ||
exports.JsonLdParser = JsonLdParser; | ||
JsonLdParser.DEFAULT_PROCESSING_MODE = '1.1'; | ||
@@ -479,2 +484,3 @@ JsonLdParser.ENTRY_HANDLERS = [ | ||
]; | ||
exports.JsonLdParser = JsonLdParser; | ||
//# sourceMappingURL=JsonLdParser.js.map |
@@ -335,3 +335,2 @@ "use strict"; | ||
} | ||
exports.ParsingContext = ParsingContext; | ||
ParsingContext.EXPAND_OPTIONS = { | ||
@@ -349,2 +348,3 @@ 1.0: { | ||
}; | ||
exports.ParsingContext = ParsingContext; | ||
//# sourceMappingURL=ParsingContext.js.map |
@@ -903,3 +903,2 @@ "use strict"; | ||
} | ||
exports.Util = Util; | ||
Util.XSD = 'http://www.w3.org/2001/XMLSchema#'; | ||
@@ -910,2 +909,3 @@ Util.XSD_BOOLEAN = Util.XSD + 'boolean'; | ||
Util.RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'; | ||
exports.Util = Util; | ||
//# sourceMappingURL=Util.js.map |
{ | ||
"name": "jsonld-streaming-parser", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "A fast and lightweight streaming JSON-LD parser", | ||
@@ -51,8 +51,8 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/jest": "^28.0.0", | ||
"@types/jest": "^29.0.0", | ||
"@types/jest-each": "^24.3.0", | ||
"arrayify-stream": "^2.0.0", | ||
"coveralls": "^3.0.0", | ||
"jest": "^28.0.0", | ||
"jest-each": "^28.0.0", | ||
"jest": "^29.0.0", | ||
"jest-each": "^29.0.0", | ||
"jest-rdf": "^1.7.0", | ||
@@ -63,9 +63,9 @@ "manual-git-changelog": "^1.0.1", | ||
"streamify-string": "^1.0.1", | ||
"ts-jest": "^28.0.0", | ||
"ts-jest": "^29.0.0", | ||
"ts-loader": "^9.3.1", | ||
"tslint": "^6.0.0", | ||
"tslint-eslint-rules": "^5.3.1", | ||
"typescript": "^4.0.2", | ||
"typescript": "^5.0.0", | ||
"webpack": "^5.73.0", | ||
"webpack-cli": "^4.10.0" | ||
"webpack-cli": "^5.0.0" | ||
}, | ||
@@ -72,0 +72,0 @@ "jest": { |
@@ -84,2 +84,19 @@ # JSON-LD Streaming Parser | ||
### Convert a JSON-LD string to an RDF/JS dataset | ||
```javascript | ||
import { Store } from 'n3'; | ||
import { JsonLdParser } from 'jsonld-streaming-parser'; | ||
import { promisifyEventEmitter } from 'event-emitter-promisify'; | ||
const store = new Store(); | ||
const parser = new JsonLdParser(); | ||
parser.write('{"@id": "http://example.org/jesse", "@type": "http://example.org/Thing"}'); | ||
parser.end(); | ||
await promisifyEventEmitter(store.import(parser)); | ||
// Logs all the quads in the store | ||
console.log(...store); | ||
``` | ||
### Import streams | ||
@@ -86,0 +103,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
451887
4065
316