@factoidal/core 0.11.0 → 0.12.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/CHANGELOG.md +382 -0
- package/README.md +63 -3
- package/api.d.ts +2 -3
- package/api.mjs +2 -2
- package/bin/factoidal.mjs +139 -3
- package/browser.d.ts +3 -2
- package/browser.js +1 -2
- package/fn.js +8 -12
- package/index.d.ts +83 -28
- package/index.mjs +1 -2
- package/l4-assets/l4factoidal.js +1 -1
- package/l4-assets/l4factoidal.wasm +0 -0
- package/l4-assets/version.json +6 -6
- package/lib/api.mjs +93 -203
- package/lib/dataset.mjs +40 -45
- package/lib/delta-log-hosts.mjs +9 -8
- package/lib/errors.mjs +97 -0
- package/lib/lean-entry.mjs +15 -10
- package/lib/store.mjs +4 -5
- package/lib/version.mjs +1 -1
- package/lws/README.md +70 -3
- package/lws/persist.mjs +237 -6
- package/lws/server.mjs +271 -9
- package/package.json +2 -1
- package/rdfjs.mjs +4 -2
- package/solid/server/index.mjs +7 -1
package/rdfjs.mjs
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
// ES module (0.9.0): the same file serves Node (index.mjs, and rdfjs.js for
|
|
16
16
|
// require()) and the browser (browser.js), with no build step.
|
|
17
17
|
|
|
18
|
+
import { FactoidalError } from './lib/errors.mjs';
|
|
19
|
+
|
|
18
20
|
// RDF/JS Data Model defaults of DataFactory.literal.
|
|
19
21
|
const XSD_STRING = 'http://www.w3.org/2001/XMLSchema#string'; // purity-lint: allow RDF/JS DataFactory default
|
|
20
22
|
const RDF_LANGSTRING =
|
|
@@ -330,10 +332,10 @@ function _setTextEngine(engine) { textEngine = engine; }
|
|
|
330
332
|
|
|
331
333
|
function needEngine(who) {
|
|
332
334
|
if (!textEngine) {
|
|
333
|
-
throw new
|
|
335
|
+
throw new FactoidalError(
|
|
334
336
|
`${who}: N-Quads text is read and written by the engine, which is not ` +
|
|
335
337
|
'loaded yet. Await any @factoidal/core call first (for example ' +
|
|
336
|
-
'`await ready()`), or use parse() and Dataset.toString().');
|
|
338
|
+
'`await ready()`), or use parse() and Dataset.toString().', { code: 'op.unknown' });
|
|
337
339
|
}
|
|
338
340
|
return textEngine;
|
|
339
341
|
}
|
package/solid/server/index.mjs
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
// stay distinct.
|
|
57
57
|
|
|
58
58
|
import { loadEngine } from '../../bin/engine.mjs'
|
|
59
|
-
import { readSnapshot, persistIfChanged } from '../../lws/persist.mjs'
|
|
59
|
+
import { readSnapshot, persistIfChanged, storageKeyText } from '../../lws/persist.mjs'
|
|
60
60
|
|
|
61
61
|
/** The ops this host needs from the engine. */
|
|
62
62
|
export const SOLID_SERVER_OPS = ['solidOpen', 'solidStep', 'solidClose', 'solidSnapshot',
|
|
@@ -169,6 +169,8 @@ function contentBytes (request) {
|
|
|
169
169
|
* @param {string} [options.owner] the WebID the storage advertises
|
|
170
170
|
* @param {string} [options.agent] the WebID of the requesting agent
|
|
171
171
|
* @param {boolean} [options.realClock] stamp each request with this host's clock
|
|
172
|
+
* @param {string|null} [options.storageKey] the storage key text (64 hex digits or base64url);
|
|
173
|
+
* default the environment variable FACTOIDAL_LWS_KEY; `null` reads no key
|
|
172
174
|
* @param {object} [options.engine] an engine handle to reuse
|
|
173
175
|
* @returns {Promise<{step: Function, close: Function, handle: string,
|
|
174
176
|
* engine: object}>}
|
|
@@ -186,6 +188,10 @@ export async function openSolidStorage (options = {}) {
|
|
|
186
188
|
if (options.insecureNoAuth === true) config.insecureNoAuth = true
|
|
187
189
|
if (typeof options.enforceWac === 'boolean') config.enforceWac = options.enforceWac
|
|
188
190
|
if (typeof options.rootAcl === 'string') config.rootAcl = options.rootAcl
|
|
191
|
+
// Encryption at rest (issue 921), as the LWS host: the key text from
|
|
192
|
+
// `storageKey` or FACTOIDAL_LWS_KEY, passed unread; the engine decides.
|
|
193
|
+
const storageKey = storageKeyText(options.storageKey)
|
|
194
|
+
if (storageKey !== undefined) config.storageKey = storageKey
|
|
189
195
|
// `dir` names the storage directory. The snapshot found there, if any,
|
|
190
196
|
// is the storage to continue from; the engine checks it.
|
|
191
197
|
const dir = typeof options.dir === 'string' ? options.dir : null
|