rdflib 2.2.30-c488dd5d → 2.2.31-10c4e145
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/670.rdflib.min.js +1 -0
- package/dist/730.rdflib.min.js +3 -0
- package/dist/730.rdflib.min.js.LICENSE.txt +58 -0
- package/dist/730.rdflib.min.js.map +1 -0
- package/dist/rdflib.min.js +1 -1
- package/dist/rdflib.min.js.LICENSE.txt +0 -59
- package/dist/rdflib.min.js.map +1 -1
- package/esm/fetcher.js +39 -9
- package/esm/jsonldparser.js +4 -3
- package/esm/store.js +21 -1
- package/esm/update-manager.js +29 -16
- package/lib/fetcher.js +39 -9
- package/lib/jsonldparser.js +9 -3
- package/lib/store.d.ts +1 -1
- package/lib/store.js +21 -1
- package/lib/update-manager.d.ts +1 -1
- package/lib/update-manager.js +29 -16
- package/package.json +2 -2
- package/src/fetcher.ts +19 -6
- package/src/jsonldparser.js +2 -4
- package/src/store.ts +18 -1
- package/src/update-manager.ts +23 -14
package/src/store.ts
CHANGED
|
@@ -871,10 +871,27 @@ export default class IndexedFormula extends Formula { // IN future - allow pass
|
|
|
871
871
|
}
|
|
872
872
|
|
|
873
873
|
/**
|
|
874
|
-
* Removes all statements in a doc
|
|
874
|
+
* Removes all statements in a doc, along with the related metadata including request/response
|
|
875
875
|
* @param doc - The document / graph
|
|
876
876
|
*/
|
|
877
877
|
removeDocument(doc: Quad_Graph): IndexedFormula {
|
|
878
|
+
const meta = this.sym('chrome://TheCurrentSession') // or this.rdfFactory.namedNode('chrome://TheCurrentSession')
|
|
879
|
+
const linkNamespaceURI = 'http://www.w3.org/2007/ont/link#' // alain
|
|
880
|
+
// remove request/response and metadata
|
|
881
|
+
const requests = this.statementsMatching(undefined, this.sym(`${linkNamespaceURI}requestedURI`), this.rdfFactory.literal(doc.value), meta).map(st => st.subject)
|
|
882
|
+
for (var r = 0; r < requests.length; r++) {
|
|
883
|
+
const request = requests[r]
|
|
884
|
+
if (request !== undefined) {
|
|
885
|
+
this.removeMatches(request, null, null, meta)
|
|
886
|
+
const response = this.any(request, this.sym(`${linkNamespaceURI}response`), null, meta) as Quad_Subject
|
|
887
|
+
if (response !== undefined) { // ts
|
|
888
|
+
this.removeMatches(response, null, null, meta)
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
this.removeMatches(this.sym(doc.value), null, null, meta) // content-type
|
|
893
|
+
|
|
894
|
+
// remove document
|
|
878
895
|
var sts: Quad[] = this.statementsMatching(undefined, undefined, undefined, doc).slice() // Take a copy as this is the actual index
|
|
879
896
|
for (var i = 0; i < sts.length; i++) {
|
|
880
897
|
this.removeStatement(sts[i])
|
package/src/update-manager.ts
CHANGED
|
@@ -87,14 +87,16 @@ export default class UpdateManager {
|
|
|
87
87
|
* the user logs in, then that data misrepresents what would happen
|
|
88
88
|
* if the user tried again.
|
|
89
89
|
*/
|
|
90
|
-
flagAuthorizationMetadata () {
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
flagAuthorizationMetadata (kb?: IndexedFormula) {
|
|
91
|
+
if (!kb) {
|
|
92
|
+
kb = this.store
|
|
93
|
+
}
|
|
94
|
+
const meta = kb.fetcher?.appNode
|
|
93
95
|
const requests = kb.statementsMatching(undefined, this.ns.link('requestedURI'), undefined, meta).map(st => st.subject)
|
|
94
96
|
for (const request of requests) {
|
|
95
97
|
const response = kb.any(request, this.ns.link('response'), null, meta) as Quad_Subject
|
|
96
98
|
if (response !== undefined) { // ts
|
|
97
|
-
|
|
99
|
+
kb.add(response, this.ns.link('outOfDate'), true as any, meta) // @@ Boolean is fine - fix types
|
|
98
100
|
}
|
|
99
101
|
}
|
|
100
102
|
}
|
|
@@ -111,13 +113,20 @@ flagAuthorizationMetadata () {
|
|
|
111
113
|
* LOCALFILE or false if known, undefined if not known.
|
|
112
114
|
*/
|
|
113
115
|
async checkEditable (uri: string | NamedNode, kb?: IndexedFormula): Promise<string | boolean | undefined> {
|
|
114
|
-
|
|
116
|
+
if (!uri) {
|
|
117
|
+
return false // Eg subject is bnode, no known doc to write to
|
|
118
|
+
}
|
|
119
|
+
if (!kb) {
|
|
120
|
+
kb = this.store
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const initial = this.editable(uri, kb)
|
|
115
124
|
if (initial !== undefined) {
|
|
116
125
|
return initial
|
|
117
126
|
}
|
|
118
|
-
await
|
|
127
|
+
await kb.fetcher?.load(uri)
|
|
119
128
|
const final = this.editable(uri, kb)
|
|
120
|
-
console.log(`Loaded ${uri} just to check editable, result: ${final}.`)
|
|
129
|
+
// console.log(`Loaded ${uri} just to check editable, result: ${final}.`)
|
|
121
130
|
return final
|
|
122
131
|
}
|
|
123
132
|
/**
|
|
@@ -141,17 +150,17 @@ flagAuthorizationMetadata () {
|
|
|
141
150
|
uri = termValue(uri)
|
|
142
151
|
|
|
143
152
|
if ( !this.isHttpUri(uri as string) ) {
|
|
144
|
-
if (
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
153
|
+
if (kb.holds(
|
|
154
|
+
kb.rdfFactory.namedNode(uri),
|
|
155
|
+
kb.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
|
|
156
|
+
kb.rdfFactory.namedNode('http://www.w3.org/2007/ont/link#MachineEditableDocument'))) {
|
|
148
157
|
return 'LOCALFILE'
|
|
149
158
|
}
|
|
150
159
|
}
|
|
151
160
|
|
|
152
161
|
var request
|
|
153
162
|
var definitive = false
|
|
154
|
-
const meta =
|
|
163
|
+
const meta = kb.fetcher?.appNode
|
|
155
164
|
// const kb = s
|
|
156
165
|
|
|
157
166
|
// @ts-ignore passes a string to kb.each, which expects a term. Should this work?
|
|
@@ -160,10 +169,10 @@ flagAuthorizationMetadata () {
|
|
|
160
169
|
for (var r = 0; r < requests.length; r++) {
|
|
161
170
|
request = requests[r]
|
|
162
171
|
if (request !== undefined) {
|
|
163
|
-
const response = kb.any(request, this.ns.link('response')) as Quad_Subject
|
|
172
|
+
const response = kb.any(request, this.ns.link('response'), null, meta) as Quad_Subject
|
|
164
173
|
if (response !== undefined) { // ts
|
|
165
174
|
|
|
166
|
-
const outOfDate = kb.anyJS(response, this.ns.link('outOfDate')) as Quad_Subject
|
|
175
|
+
const outOfDate = kb.anyJS(response, this.ns.link('outOfDate'), null, meta) as Quad_Subject
|
|
167
176
|
if (outOfDate) continue
|
|
168
177
|
|
|
169
178
|
var wacAllow = kb.anyValue(response, this.ns.httph('wac-allow'))
|