@serfab/quereus-plugin-sereus 0.10.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/README.md +367 -361
- package/dist/cached-storage.d.ts +95 -0
- package/dist/cached-storage.js +156 -0
- package/dist/cached-storage.js.map +1 -0
- package/dist/compose-strand.d.ts +16 -3
- package/dist/compose-strand.js +96 -50
- package/dist/compose-strand.js.map +1 -1
- package/dist/connect-browser.js +2 -1
- package/dist/connect-browser.js.map +1 -1
- package/dist/connect.js +2 -1
- package/dist/connect.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/parse-config.js +23 -11
- package/dist/parse-config.js.map +1 -1
- package/dist/plugin-browser.js +77326 -74471
- package/dist/plugin-browser.js.map +4 -4
- package/dist/strand-schema.d.ts +1 -1
- package/dist/strand-schema.js +544 -503
- package/dist/strand-schema.js.map +1 -1
- package/dist/types.d.ts +37 -10
- package/package.json +8 -8
- package/src/cached-storage.ts +178 -0
- package/src/cluster-size.ts +248 -248
- package/src/compose-strand.ts +396 -325
- package/src/connect-browser.ts +2 -1
- package/src/connect.ts +2 -1
- package/src/index.ts +2 -1
- package/src/parse-config.ts +70 -55
- package/src/plugin-browser.ts +29 -29
- package/src/plugin.ts +39 -39
- package/src/strand-schema.ts +574 -533
- package/src/types.ts +106 -78
package/dist/parse-config.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
const STRAND_TRANSACTORS = ['local', 'network', 'test'];
|
|
2
|
+
/**
|
|
3
|
+
* Read the optional `transactor` key. Unlike `fret_profile` (whose unknown
|
|
4
|
+
* values fall back to the default), an unrecognised transactor throws: silently
|
|
5
|
+
* running on the network when the caller asked for local storage is the kind of
|
|
6
|
+
* mistake that only surfaces as a mysterious hang on a machine with no peers.
|
|
7
|
+
*/
|
|
8
|
+
function parseTransactor(raw) {
|
|
9
|
+
if (raw === undefined || raw === null || raw === '')
|
|
10
|
+
return undefined;
|
|
11
|
+
if (typeof raw !== 'string' || !STRAND_TRANSACTORS.includes(raw)) {
|
|
12
|
+
throw new Error(`quereus-plugin-sereus: transactor must be one of ${STRAND_TRANSACTORS.join(', ')} (got ${JSON.stringify(raw)})`);
|
|
13
|
+
}
|
|
14
|
+
return raw;
|
|
15
|
+
}
|
|
1
16
|
/**
|
|
2
17
|
* Parse the plugin-loader SqlValue config into typed StrandConnectionOptions.
|
|
3
18
|
* Shared by the Node (`plugin.ts`) and browser (`plugin-browser.ts`) entries.
|
|
@@ -17,16 +32,14 @@ export function parseConfig(config) {
|
|
|
17
32
|
const port = typeof config.port === 'number' ? config.port : 0;
|
|
18
33
|
const enableCache = config.enable_cache !== false && config.enable_cache !== 0;
|
|
19
34
|
const fretProfile = config.fret_profile === 'core' ? 'core' : 'edge';
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
? config.transactor
|
|
29
|
-
: undefined;
|
|
35
|
+
// Storage engine — see `StrandConnectionOptions.transactor`. Left out entirely
|
|
36
|
+
// when unset so `composeStrand` applies its own default.
|
|
37
|
+
const transactor = parseTransactor(config.transactor);
|
|
38
|
+
// NOTE: `parseConfig` reads the keys it knows and ignores every other key in
|
|
39
|
+
// the map — there is no allowlist, so a misspelled or retired setting (e.g.
|
|
40
|
+
// the `mode` this package used to carry) is silently dropped rather than
|
|
41
|
+
// rejected. Deliberate: the plugin loader hands through whatever the host's
|
|
42
|
+
// settings file holds.
|
|
30
43
|
// NOTE: persistent storage cannot ride a `Record<string, SqlValue>` — an
|
|
31
44
|
// `IRawStorage` is not an `SqlValue`. The Node loader (`plugin.ts`) reads the
|
|
32
45
|
// platform-only `storage_path` key directly and resolves it to a concrete
|
|
@@ -40,7 +53,6 @@ export function parseConfig(config) {
|
|
|
40
53
|
port,
|
|
41
54
|
enableCache,
|
|
42
55
|
fretProfile,
|
|
43
|
-
...(mode && { mode }),
|
|
44
56
|
...(transactor && { transactor }),
|
|
45
57
|
};
|
|
46
58
|
}
|
package/dist/parse-config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-config.js","sourceRoot":"","sources":["../src/parse-config.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,MAAgC;IAC3D,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC;IAClC,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,iBAAiB,GAAG,MAAM,CAAC,eAAe,CAAC;IACjD,MAAM,cAAc,GAAG,OAAO,iBAAiB,KAAK,QAAQ,IAAI,iBAAiB;QAChF,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;QACjE,CAAC,CAAC,EAAE,CAAC;IAEN,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7E,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/E,MAAM,WAAW,GAAG,OAAO,MAAM,CAAC,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC;IAC5F,MAAM,IAAI,GAAG,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAA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