flatsql 3.11.1 → 3.12.1

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.
Files changed (181) hide show
  1. package/README.md +61 -795
  2. package/bin/flatsql.mjs +76 -0
  3. package/cpp/README.md +18 -0
  4. package/cpp/include/flatsql/flatsql.h +162 -0
  5. package/cpp/include/flatsql/flatsql_io.h +159 -0
  6. package/docs/API-3.12.md +126 -0
  7. package/package.json +28 -123
  8. package/wasm/flatsql.wasm +0 -0
  9. package/wasm/index.d.ts +61 -548
  10. package/wasm/index.js +280 -1281
  11. package/wasm/integrity.json +6 -26
  12. package/wasm/runtime/LICENSE.sdk.txt +190 -0
  13. package/wasm/runtime/NOTICE.txt +2 -0
  14. package/wasm/runtime/browser-guest.mjs +1 -0
  15. package/wasm/runtime/browser-host.mjs +1 -0
  16. package/wasm/runtime/node-guest.mjs +2 -0
  17. package/wasm/runtime/node-host.mjs +5 -0
  18. package/wasm/runtime/opfsIoWorker.mjs +1 -0
  19. package/wasm/runtime/wasiThreadBrowserWorker.mjs +1 -0
  20. package/dist/artifacts/index.d.ts +0 -3
  21. package/dist/artifacts/index.d.ts.map +0 -1
  22. package/dist/artifacts/index.js +0 -3
  23. package/dist/artifacts/index.js.map +0 -1
  24. package/dist/artifacts/transport.d.ts +0 -5
  25. package/dist/artifacts/transport.d.ts.map +0 -1
  26. package/dist/artifacts/transport.js +0 -45
  27. package/dist/artifacts/transport.js.map +0 -1
  28. package/dist/artifacts/types.d.ts +0 -34
  29. package/dist/artifacts/types.d.ts.map +0 -1
  30. package/dist/artifacts/types.js +0 -2
  31. package/dist/artifacts/types.js.map +0 -1
  32. package/dist/btree/btree.d.ts +0 -34
  33. package/dist/btree/btree.d.ts.map +0 -1
  34. package/dist/btree/btree.js +0 -234
  35. package/dist/btree/btree.js.map +0 -1
  36. package/dist/btree/index.d.ts +0 -3
  37. package/dist/btree/index.d.ts.map +0 -1
  38. package/dist/btree/index.js +0 -3
  39. package/dist/btree/index.js.map +0 -1
  40. package/dist/btree/types.d.ts +0 -36
  41. package/dist/btree/types.d.ts.map +0 -1
  42. package/dist/btree/types.js +0 -55
  43. package/dist/btree/types.js.map +0 -1
  44. package/dist/cluster/index.d.ts +0 -11
  45. package/dist/cluster/index.d.ts.map +0 -1
  46. package/dist/cluster/index.js +0 -59
  47. package/dist/cluster/index.js.map +0 -1
  48. package/dist/response/artifact.d.ts +0 -4
  49. package/dist/response/artifact.d.ts.map +0 -1
  50. package/dist/response/artifact.js +0 -102
  51. package/dist/response/artifact.js.map +0 -1
  52. package/dist/response/cache-key.d.ts +0 -6
  53. package/dist/response/cache-key.d.ts.map +0 -1
  54. package/dist/response/cache-key.js +0 -114
  55. package/dist/response/cache-key.js.map +0 -1
  56. package/dist/response/index.d.ts +0 -5
  57. package/dist/response/index.d.ts.map +0 -1
  58. package/dist/response/index.js +0 -5
  59. package/dist/response/index.js.map +0 -1
  60. package/dist/response/memory-cache.d.ts +0 -17
  61. package/dist/response/memory-cache.d.ts.map +0 -1
  62. package/dist/response/memory-cache.js +0 -76
  63. package/dist/response/memory-cache.js.map +0 -1
  64. package/dist/response/types.d.ts +0 -57
  65. package/dist/response/types.d.ts.map +0 -1
  66. package/dist/response/types.js +0 -2
  67. package/dist/response/types.js.map +0 -1
  68. package/dist/schema/index.d.ts +0 -3
  69. package/dist/schema/index.d.ts.map +0 -1
  70. package/dist/schema/index.js +0 -3
  71. package/dist/schema/index.js.map +0 -1
  72. package/dist/schema/parser.d.ts +0 -25
  73. package/dist/schema/parser.d.ts.map +0 -1
  74. package/dist/schema/parser.js +0 -474
  75. package/dist/schema/parser.js.map +0 -1
  76. package/dist/schema/types.d.ts +0 -33
  77. package/dist/schema/types.d.ts.map +0 -1
  78. package/dist/schema/types.js +0 -29
  79. package/dist/schema/types.js.map +0 -1
  80. package/dist/standalone/index.d.ts +0 -3
  81. package/dist/standalone/index.d.ts.map +0 -1
  82. package/dist/standalone/index.js +0 -3
  83. package/dist/standalone/index.js.map +0 -1
  84. package/dist/standalone/process-client.d.ts +0 -85
  85. package/dist/standalone/process-client.d.ts.map +0 -1
  86. package/dist/standalone/process-client.js +0 -537
  87. package/dist/standalone/process-client.js.map +0 -1
  88. package/dist/standalone/wasmedge-runner.d.ts +0 -19
  89. package/dist/standalone/wasmedge-runner.d.ts.map +0 -1
  90. package/dist/standalone/wasmedge-runner.js +0 -108
  91. package/dist/standalone/wasmedge-runner.js.map +0 -1
  92. package/dist/storage/index.d.ts +0 -3
  93. package/dist/storage/index.d.ts.map +0 -1
  94. package/dist/storage/index.js +0 -3
  95. package/dist/storage/index.js.map +0 -1
  96. package/dist/storage/stacked-flatbuffers.d.ts +0 -38
  97. package/dist/storage/stacked-flatbuffers.d.ts.map +0 -1
  98. package/dist/storage/stacked-flatbuffers.js +0 -253
  99. package/dist/storage/stacked-flatbuffers.js.map +0 -1
  100. package/dist/storage/types.d.ts +0 -23
  101. package/dist/storage/types.d.ts.map +0 -1
  102. package/dist/storage/types.js +0 -27
  103. package/dist/storage/types.js.map +0 -1
  104. package/dist/stress/aggregate.d.ts +0 -3
  105. package/dist/stress/aggregate.d.ts.map +0 -1
  106. package/dist/stress/aggregate.js +0 -61
  107. package/dist/stress/aggregate.js.map +0 -1
  108. package/dist/stress/docker-compose.d.ts +0 -17
  109. package/dist/stress/docker-compose.d.ts.map +0 -1
  110. package/dist/stress/docker-compose.js +0 -156
  111. package/dist/stress/docker-compose.js.map +0 -1
  112. package/dist/stress/index.d.ts +0 -10
  113. package/dist/stress/index.d.ts.map +0 -1
  114. package/dist/stress/index.js +0 -10
  115. package/dist/stress/index.js.map +0 -1
  116. package/dist/stress/metrics.d.ts +0 -3
  117. package/dist/stress/metrics.d.ts.map +0 -1
  118. package/dist/stress/metrics.js +0 -83
  119. package/dist/stress/metrics.js.map +0 -1
  120. package/dist/stress/native-publish-event-workload.d.ts +0 -3
  121. package/dist/stress/native-publish-event-workload.d.ts.map +0 -1
  122. package/dist/stress/native-publish-event-workload.js +0 -465
  123. package/dist/stress/native-publish-event-workload.js.map +0 -1
  124. package/dist/stress/production-gate.d.ts +0 -4
  125. package/dist/stress/production-gate.d.ts.map +0 -1
  126. package/dist/stress/production-gate.js +0 -12
  127. package/dist/stress/production-gate.js.map +0 -1
  128. package/dist/stress/report.d.ts +0 -3
  129. package/dist/stress/report.d.ts.map +0 -1
  130. package/dist/stress/report.js +0 -174
  131. package/dist/stress/report.js.map +0 -1
  132. package/dist/stress/sds-discovery.d.ts +0 -4
  133. package/dist/stress/sds-discovery.d.ts.map +0 -1
  134. package/dist/stress/sds-discovery.js +0 -40
  135. package/dist/stress/sds-discovery.js.map +0 -1
  136. package/dist/stress/smoke-runner.d.ts +0 -3
  137. package/dist/stress/smoke-runner.d.ts.map +0 -1
  138. package/dist/stress/smoke-runner.js +0 -64
  139. package/dist/stress/smoke-runner.js.map +0 -1
  140. package/dist/stress/types.d.ts +0 -219
  141. package/dist/stress/types.d.ts.map +0 -1
  142. package/dist/stress/types.js +0 -2
  143. package/dist/stress/types.js.map +0 -1
  144. package/dist/stress/workload.d.ts +0 -6
  145. package/dist/stress/workload.d.ts.map +0 -1
  146. package/dist/stress/workload.js +0 -144
  147. package/dist/stress/workload.js.map +0 -1
  148. package/docs/PARTITION-STORE-WASM.md +0 -338
  149. package/docs/PARTITION-STORE.md +0 -2380
  150. package/docs/agents/response-artifacts.md +0 -65
  151. package/docs/response-artifacts.md +0 -86
  152. package/scripts/stress-docker.sh +0 -279
  153. package/sdm/flatsql-spatial.wasm +0 -0
  154. package/sdm/index.d.ts +0 -88
  155. package/sdm/index.js +0 -253
  156. package/sdm/manifest.json +0 -402
  157. package/stress/docker/Dockerfile +0 -11
  158. package/stress/docker/docker-compose.yml +0 -51
  159. package/stress/sds/aggregate.mjs +0 -97
  160. package/stress/sds/run.mjs +0 -105
  161. package/stress/sds/write-compose.mjs +0 -96
  162. package/wasm/flatsql-client.js +0 -280
  163. package/wasm/flatsql-io.d.ts +0 -97
  164. package/wasm/flatsql-io.js +0 -625
  165. package/wasm/flatsql-p4-threads.wasm +0 -0
  166. package/wasm/flatsql-ps-threads.wasm +0 -0
  167. package/wasm/flatsql-wasi-noeh.wasm +0 -0
  168. package/wasm/flatsql-wasi.wasm +0 -0
  169. package/wasm/flatsql.js +0 -2
  170. package/wasm/flatsql.worker.js +0 -209
  171. package/wasm/native/flatsql_wasmedge_runner.cpp +0 -858
  172. package/wasm/ps-node-fault.d.mts +0 -23
  173. package/wasm/ps-node-fault.mjs +0 -381
  174. package/wasm/ps-node-guest.mjs +0 -173
  175. package/wasm/ps-node-host.d.mts +0 -95
  176. package/wasm/ps-node-host.mjs +0 -476
  177. package/wasm/ps-node-imports.mjs +0 -847
  178. package/wasm/ps.d.ts +0 -21
  179. package/wasm/ps.js +0 -75
  180. package/wasm/wasi.d.ts +0 -11
  181. package/wasm/wasi.js +0 -51
package/wasm/ps.d.ts DELETED
@@ -1,21 +0,0 @@
1
- // Types for wasm/ps.js (the partition store artifact, flatsql-ps-threads.wasm).
2
-
3
- export const FLATSQL_PS_THREADS_FILE: 'flatsql-ps-threads.wasm';
4
-
5
- /** URL of the packaged flatsql-ps-threads.wasm. */
6
- export function getFlatSQLPsThreadsURL(): URL;
7
-
8
- export interface LoadFlatSQLPsThreadsOptions {
9
- url?: string | URL;
10
- path?: string;
11
- /** false skips the integrity.json check. */
12
- verify?: boolean;
13
- /** SHA-256 (hex) provider outside Node; back it with WASM or native crypto. Browser WebCrypto is intentionally not used. */
14
- computeSHA256?: (bytes: Uint8Array) => string | Promise<string>;
15
- }
16
-
17
- /** The artifact's bytes, checked against integrity.json (Node, or with computeSHA256). */
18
- export function loadFlatSQLPsThreads(options?: LoadFlatSQLPsThreadsOptions): Promise<Uint8Array>;
19
-
20
- /** The artifact's sha256 (hex) from the packaged integrity.json, or null. */
21
- export function flatsqlPsThreadsSha256(): Promise<string | null>;
package/wasm/ps.js DELETED
@@ -1,75 +0,0 @@
1
- // The partition store artifact, flatsql-ps-threads.wasm (docs/PARTITION-STORE-WASM.md).
2
- //
3
- // A wasm32-wasip1-threads reactor: hosts instantiate it once per writer or
4
- // reader instance over a shared env.memory, provide WASI preview1,
5
- // wasi.thread-spawn and the seven env.flatsql_io_* imports, and drive it
6
- // through the flatsql_ps_* C ABI (cpp/include/flatsql/ps/flatsql_ps.h).
7
- // Node: flatsql/ps/node-host. Go/WasmEdge: the SDN host. Browsers: sdn-js.
8
-
9
- const PS_THREADS_URL = new URL('./flatsql-ps-threads.wasm', import.meta.url);
10
-
11
- /** File name of the artifact next to this module. */
12
- export const FLATSQL_PS_THREADS_FILE = 'flatsql-ps-threads.wasm';
13
-
14
- /** URL of the packaged flatsql-ps-threads.wasm. */
15
- export function getFlatSQLPsThreadsURL() {
16
- return PS_THREADS_URL;
17
- }
18
-
19
- /**
20
- * The artifact's bytes, checked against wasm/integrity.json: in Node with
21
- * node:crypto, elsewhere with `computeSHA256` (bytes -> hex), which the caller
22
- * backs with WASM or native crypto (browser WebCrypto is intentionally not
23
- * used, as in wasm/index.js). A mismatch throws.
24
- *
25
- * @param {{ url?: string | URL, path?: string, verify?: boolean,
26
- * computeSHA256?: (bytes: Uint8Array) => string | Promise<string> }} [options]
27
- * @returns {Promise<Uint8Array>}
28
- */
29
- export async function loadFlatSQLPsThreads(options = {}) {
30
- let bytes;
31
- const url = options.url ? new URL(options.url, import.meta.url) : PS_THREADS_URL;
32
- if (options.path || url.protocol === 'file:') {
33
- const [{ readFile }, { fileURLToPath }] = await Promise.all([import('node:fs/promises'), import('node:url')]);
34
- bytes = new Uint8Array(await readFile(options.path ?? fileURLToPath(url)));
35
- } else {
36
- const response = await fetch(url);
37
- if (!response.ok) throw new Error(`Failed to load ${FLATSQL_PS_THREADS_FILE}: ${response.status}`);
38
- bytes = new Uint8Array(await response.arrayBuffer());
39
- }
40
- if (options.verify === false || options.url || options.path) return bytes;
41
- const hash = options.computeSHA256 ?? (await nodeSha256());
42
- if (!hash) return bytes;
43
- const expected = await flatsqlPsThreadsSha256();
44
- if (!expected) throw new Error(`integrity.json has no sha256 for ${FLATSQL_PS_THREADS_FILE}`);
45
- const actual = await hash(bytes);
46
- if (actual !== expected) {
47
- throw new Error(`${FLATSQL_PS_THREADS_FILE}: sha256 ${actual} does not match integrity.json (${expected})`);
48
- }
49
- return bytes;
50
- }
51
-
52
- /** The artifact's sha256 (hex) from the packaged integrity.json, or null. */
53
- export async function flatsqlPsThreadsSha256() {
54
- const integrityUrl = new URL('./integrity.json', import.meta.url);
55
- let text;
56
- try {
57
- if (integrityUrl.protocol === 'file:') {
58
- const [{ readFile }, { fileURLToPath }] = await Promise.all([import('node:fs/promises'), import('node:url')]);
59
- text = await readFile(fileURLToPath(integrityUrl), 'utf8');
60
- } else {
61
- const response = await fetch(integrityUrl);
62
- if (!response.ok) return null;
63
- text = await response.text();
64
- }
65
- } catch {
66
- return null;
67
- }
68
- return JSON.parse(text)?.files?.[FLATSQL_PS_THREADS_FILE]?.sha256 ?? null;
69
- }
70
-
71
- async function nodeSha256() {
72
- if (!globalThis.process?.versions?.node) return null;
73
- const { createHash } = await import('node:crypto');
74
- return (bytes) => createHash('sha256').update(bytes).digest('hex');
75
- }
package/wasm/wasi.d.ts DELETED
@@ -1,11 +0,0 @@
1
- export interface FlatSQLWASILoadOptions {
2
- url?: string | URL;
3
- path?: string;
4
- as?: 'arrayBuffer' | 'uint8array';
5
- }
6
-
7
- export declare function getFlatSQLWASIURL(): URL;
8
-
9
- export declare function loadFlatSQLWASI(
10
- options?: FlatSQLWASILoadOptions
11
- ): Promise<ArrayBuffer | Uint8Array>;
package/wasm/wasi.js DELETED
@@ -1,51 +0,0 @@
1
- const DEFAULT_WASI_URL = new URL('./flatsql-wasi.wasm', import.meta.url);
2
-
3
- /**
4
- * Resolve the packaged FlatSQL WASI module URL.
5
- */
6
- export function getFlatSQLWASIURL() {
7
- return DEFAULT_WASI_URL;
8
- }
9
-
10
- async function readViaFsPath(path) {
11
- const fs = await import('node:fs/promises');
12
- return new Uint8Array(await fs.readFile(path));
13
- }
14
-
15
- /**
16
- * Load the packaged FlatSQL WASI module bytes.
17
- *
18
- * @param {{
19
- * url?: string | URL,
20
- * path?: string,
21
- * as?: 'arrayBuffer' | 'uint8array'
22
- * }} [options]
23
- * @returns {Promise<ArrayBuffer | Uint8Array>}
24
- */
25
- export async function loadFlatSQLWASI(options = {}) {
26
- const as = options.as === 'uint8array' ? 'uint8array' : 'arrayBuffer';
27
-
28
- let bytes;
29
- if (options.path) {
30
- bytes = await readViaFsPath(options.path);
31
- } else {
32
- const wasmUrl = options.url ? new URL(options.url, import.meta.url) : DEFAULT_WASI_URL;
33
-
34
- if (wasmUrl.protocol === 'file:') {
35
- const { fileURLToPath } = await import('node:url');
36
- bytes = await readViaFsPath(fileURLToPath(wasmUrl));
37
- } else {
38
- const response = await fetch(wasmUrl);
39
- if (!response.ok) {
40
- throw new Error(`Failed to load flatsql-wasi.wasm: ${response.status}`);
41
- }
42
- bytes = new Uint8Array(await response.arrayBuffer());
43
- }
44
- }
45
-
46
- if (as === 'uint8array') {
47
- return bytes;
48
- }
49
-
50
- return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
51
- }