mindoodb 0.0.57 → 0.0.59

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 (68) hide show
  1. package/README-server.md +25 -1
  2. package/dist/browser/index.mjs +1 -0
  3. package/dist/core/appendonlystores/network/IrohNetworkTransport.d.ts +93 -0
  4. package/dist/core/appendonlystores/network/IrohNetworkTransport.d.ts.map +1 -0
  5. package/dist/core/appendonlystores/network/IrohNetworkTransport.js +260 -0
  6. package/dist/core/appendonlystores/network/IrohNetworkTransport.js.map +1 -0
  7. package/dist/core/appendonlystores/network/IrohStreamIO.d.ts +121 -0
  8. package/dist/core/appendonlystores/network/IrohStreamIO.d.ts.map +1 -0
  9. package/dist/core/appendonlystores/network/IrohStreamIO.js +213 -0
  10. package/dist/core/appendonlystores/network/IrohStreamIO.js.map +1 -0
  11. package/dist/core/appendonlystores/network/irohLocator.d.ts +28 -0
  12. package/dist/core/appendonlystores/network/irohLocator.d.ts.map +1 -0
  13. package/dist/core/appendonlystores/network/irohLocator.js +94 -0
  14. package/dist/core/appendonlystores/network/irohLocator.js.map +1 -0
  15. package/dist/core/appendonlystores/network/reactNativeIrohStreamIO.d.ts +7 -0
  16. package/dist/core/appendonlystores/network/reactNativeIrohStreamIO.d.ts.map +1 -0
  17. package/dist/core/appendonlystores/network/reactNativeIrohStreamIO.js +48 -0
  18. package/dist/core/appendonlystores/network/reactNativeIrohStreamIO.js.map +1 -0
  19. package/dist/core/appendonlystores/sqlite/SqliteContentAddressedStore.d.ts +60 -0
  20. package/dist/core/appendonlystores/sqlite/SqliteContentAddressedStore.d.ts.map +1 -0
  21. package/dist/core/appendonlystores/sqlite/SqliteContentAddressedStore.js +349 -0
  22. package/dist/core/appendonlystores/sqlite/SqliteContentAddressedStore.js.map +1 -0
  23. package/dist/core/appendonlystores/sqlite/SqliteDriver.d.ts +51 -0
  24. package/dist/core/appendonlystores/sqlite/SqliteDriver.d.ts.map +1 -0
  25. package/dist/core/appendonlystores/sqlite/SqliteDriver.js +290 -0
  26. package/dist/core/appendonlystores/sqlite/SqliteDriver.js.map +1 -0
  27. package/dist/core/appendonlystores/sqlite/expoSqliteDriver.d.ts +13 -0
  28. package/dist/core/appendonlystores/sqlite/expoSqliteDriver.d.ts.map +1 -0
  29. package/dist/core/appendonlystores/sqlite/expoSqliteDriver.js +26 -0
  30. package/dist/core/appendonlystores/sqlite/expoSqliteDriver.js.map +1 -0
  31. package/dist/core/index.d.ts +1 -0
  32. package/dist/core/index.d.ts.map +1 -1
  33. package/dist/core/index.js +4 -2
  34. package/dist/core/index.js.map +1 -1
  35. package/dist/iroh/index.d.ts +8 -0
  36. package/dist/iroh/index.d.ts.map +1 -0
  37. package/dist/iroh/index.js +25 -0
  38. package/dist/iroh/index.js.map +1 -0
  39. package/dist/node/server/IrohServerEndpoint.d.ts +23 -0
  40. package/dist/node/server/IrohServerEndpoint.d.ts.map +1 -0
  41. package/dist/node/server/IrohServerEndpoint.js +156 -0
  42. package/dist/node/server/IrohServerEndpoint.js.map +1 -0
  43. package/dist/node/server/IrohServerRpc.d.ts +52 -0
  44. package/dist/node/server/IrohServerRpc.d.ts.map +1 -0
  45. package/dist/node/server/IrohServerRpc.js +120 -0
  46. package/dist/node/server/IrohServerRpc.js.map +1 -0
  47. package/dist/node/server/MindooDBServer.d.ts +3 -0
  48. package/dist/node/server/MindooDBServer.d.ts.map +1 -1
  49. package/dist/node/server/MindooDBServer.js +34 -0
  50. package/dist/node/server/MindooDBServer.js.map +1 -1
  51. package/dist/node/server/config.d.ts.map +1 -1
  52. package/dist/node/server/config.js +28 -0
  53. package/dist/node/server/config.js.map +1 -1
  54. package/dist/node/server/serverinit.js +2 -0
  55. package/dist/node/server/serverinit.js.map +1 -1
  56. package/dist/node/server/types.d.ts +16 -0
  57. package/dist/node/server/types.d.ts.map +1 -1
  58. package/dist/node/server/types.js +6 -1
  59. package/dist/node/server/types.js.map +1 -1
  60. package/dist/reactnative/index.d.ts +5 -0
  61. package/dist/reactnative/index.d.ts.map +1 -1
  62. package/dist/reactnative/index.js +20 -1
  63. package/dist/reactnative/index.js.map +1 -1
  64. package/dist/sqlite/index.d.ts +7 -0
  65. package/dist/sqlite/index.d.ts.map +1 -0
  66. package/dist/sqlite/index.js +16 -0
  67. package/dist/sqlite/index.js.map +1 -0
  68. package/package.json +14 -2
@@ -0,0 +1,213 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MINDOODB_IROH_ALPN = void 0;
4
+ exports.encodeIrohFrame = encodeIrohFrame;
5
+ exports.wrapLengthPrefixedByteStream = wrapLengthPrefixedByteStream;
6
+ exports.decodeIrohFrame = decodeIrohFrame;
7
+ exports.createLoopbackIrohPair = createLoopbackIrohPair;
8
+ /**
9
+ * Byte-stream IO used by {@link IrohNetworkTransport}.
10
+ *
11
+ * `react-native-iroh` implements this with `endpoint.streams` (ALPN
12
+ * `mindoodb/sync-v5`). The Node server uses `@number0/iroh`. Tests use
13
+ * {@link createLoopbackIrohPair}.
14
+ */
15
+ exports.MINDOODB_IROH_ALPN = "mindoodb/sync-v5";
16
+ const textEncoder = new TextEncoder();
17
+ const textDecoder = new TextDecoder();
18
+ /**
19
+ * Serialize an RPC request or response to UTF-8 JSON. `Uint8Array` fields
20
+ * become `{ $bytes: "<base64>" }` so they survive `JSON.stringify`.
21
+ *
22
+ * @param payload {@link IrohRpcRequest} or {@link IrohRpcResponse}
23
+ */
24
+ function encodeIrohFrame(payload) {
25
+ return textEncoder.encode(JSON.stringify(payload, replacer));
26
+ }
27
+ /**
28
+ * Length-prefix a message-oriented {@link IrohByteStream} on top of a raw
29
+ * QUIC/byte stream. Each `send` writes a big-endian uint32 length plus the
30
+ * payload; `recv` reads that header and then exactly that many bytes.
31
+ * Frames larger than 32 MiB are rejected. Loopback tests stay
32
+ * message-oriented and do not use this.
33
+ *
34
+ * @param raw Unframed write/read/close used by `@number0/iroh` (and similar)
35
+ */
36
+ function wrapLengthPrefixedByteStream(raw) {
37
+ let pending = new Uint8Array(0);
38
+ const readExact = async (need) => {
39
+ while (pending.length < need) {
40
+ const chunk = await raw.read(64 * 1024);
41
+ if (!chunk || chunk.length === 0) {
42
+ return null;
43
+ }
44
+ const next = new Uint8Array(pending.length + chunk.length);
45
+ next.set(pending);
46
+ next.set(chunk, pending.length);
47
+ pending = next;
48
+ }
49
+ const out = pending.subarray(0, need);
50
+ pending = pending.subarray(need);
51
+ return out;
52
+ };
53
+ return {
54
+ async send(bytes) {
55
+ const header = new Uint8Array(4);
56
+ new DataView(header.buffer).setUint32(0, bytes.length);
57
+ const framed = new Uint8Array(4 + bytes.length);
58
+ framed.set(header);
59
+ framed.set(bytes, 4);
60
+ await raw.write(framed);
61
+ },
62
+ async recv() {
63
+ const header = await readExact(4);
64
+ if (!header) {
65
+ return null;
66
+ }
67
+ const length = new DataView(header.buffer, header.byteOffset, header.byteLength).getUint32(0);
68
+ if (length > 32 * 1024 * 1024) {
69
+ throw new Error(`Iroh frame too large: ${length}`);
70
+ }
71
+ return readExact(length);
72
+ },
73
+ close: () => raw.close(),
74
+ };
75
+ }
76
+ /**
77
+ * Inverse of {@link encodeIrohFrame}: parse UTF-8 JSON and restore
78
+ * `{ $bytes }` objects to `Uint8Array`.
79
+ *
80
+ * @param bytes One complete frame from {@link IrohByteStream.recv}
81
+ */
82
+ function decodeIrohFrame(bytes) {
83
+ return JSON.parse(textDecoder.decode(bytes), reviver);
84
+ }
85
+ function replacer(_key, value) {
86
+ if (value instanceof Uint8Array) {
87
+ return { $bytes: bytesToBase64(value) };
88
+ }
89
+ return value;
90
+ }
91
+ function reviver(_key, value) {
92
+ if (value && typeof value === "object" && "$bytes" in value) {
93
+ return base64ToBytes(String(value.$bytes));
94
+ }
95
+ return value;
96
+ }
97
+ function bytesToBase64(bytes) {
98
+ if (typeof Buffer !== "undefined") {
99
+ return Buffer.from(bytes).toString("base64");
100
+ }
101
+ let binary = "";
102
+ for (const byte of bytes) {
103
+ binary += String.fromCharCode(byte);
104
+ }
105
+ return btoa(binary);
106
+ }
107
+ function base64ToBytes(value) {
108
+ if (typeof Buffer !== "undefined") {
109
+ return new Uint8Array(Buffer.from(value, "base64"));
110
+ }
111
+ const binary = atob(value);
112
+ const out = new Uint8Array(binary.length);
113
+ for (let i = 0; i < binary.length; i += 1) {
114
+ out[i] = binary.charCodeAt(i);
115
+ }
116
+ return out;
117
+ }
118
+ class LoopbackStream {
119
+ constructor() {
120
+ this.inbound = [];
121
+ this.waiter = null;
122
+ this.closed = false;
123
+ this.peer = null;
124
+ }
125
+ async send(bytes) {
126
+ if (!this.peer) {
127
+ throw new Error("Loopback stream has no peer");
128
+ }
129
+ this.peer.push(bytes);
130
+ }
131
+ push(bytes) {
132
+ if (this.waiter) {
133
+ const resolve = this.waiter;
134
+ this.waiter = null;
135
+ resolve(bytes);
136
+ return;
137
+ }
138
+ this.inbound.push(bytes);
139
+ }
140
+ async recv() {
141
+ if (this.inbound.length > 0) {
142
+ return this.inbound.shift() ?? null;
143
+ }
144
+ if (this.closed) {
145
+ return null;
146
+ }
147
+ return new Promise((resolve) => {
148
+ this.waiter = resolve;
149
+ });
150
+ }
151
+ async close() {
152
+ this.closed = true;
153
+ if (this.waiter) {
154
+ const resolve = this.waiter;
155
+ this.waiter = null;
156
+ resolve(null);
157
+ }
158
+ }
159
+ }
160
+ /**
161
+ * Two {@link IrohStreamIO} instances that dial each other in-process
162
+ * (`loopback:a` ↔ `loopback:b`). Used by unit tests and the Expo two-peer
163
+ * spike without native Iroh. Streams are already message-oriented; do not
164
+ * wrap them with {@link wrapLengthPrefixedByteStream}.
165
+ *
166
+ * @returns Pair whose `connect` only accepts the other side's ticket
167
+ */
168
+ function createLoopbackIrohPair() {
169
+ const listenersA = [];
170
+ const listenersB = [];
171
+ const makeIo = (ticket, peerTicket, localListeners, remoteListeners) => ({
172
+ async getLocalTicket() {
173
+ return ticket;
174
+ },
175
+ async connect(target) {
176
+ if (target !== peerTicket) {
177
+ throw new Error(`Unknown loopback peer ${target}`);
178
+ }
179
+ const local = new LoopbackStream();
180
+ const remote = new LoopbackStream();
181
+ local.peer = remote;
182
+ remote.peer = local;
183
+ for (const listener of remoteListeners) {
184
+ listener(remote);
185
+ }
186
+ return local;
187
+ },
188
+ async *listen() {
189
+ const pending = [];
190
+ let notify = null;
191
+ localListeners.push((stream) => {
192
+ pending.push(stream);
193
+ notify?.();
194
+ });
195
+ while (true) {
196
+ if (pending.length === 0) {
197
+ await new Promise((resolve) => {
198
+ notify = resolve;
199
+ });
200
+ }
201
+ const next = pending.shift();
202
+ if (next) {
203
+ yield next;
204
+ }
205
+ }
206
+ },
207
+ });
208
+ return {
209
+ a: makeIo("loopback:a", "loopback:b", listenersA, listenersB),
210
+ b: makeIo("loopback:b", "loopback:a", listenersB, listenersA),
211
+ };
212
+ }
213
+ //# sourceMappingURL=IrohStreamIO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IrohStreamIO.js","sourceRoot":"","sources":["../../../../src/core/appendonlystores/network/IrohStreamIO.ts"],"names":[],"mappings":";;;AA+FA,0CAEC;AAWD,oEA6CC;AAQD,0CAEC;AA4FD,wDAmDC;AAlTD;;;;;;GAMG;AACU,QAAA,kBAAkB,GAAG,kBAAkB,CAAC;AA+ErD,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AACtC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AAEtC;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,OAAgB;IAC9C,OAAO,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,4BAA4B,CAAC,GAI5C;IACC,IAAI,OAAO,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IAEhC,MAAM,SAAS,GAAG,KAAK,EAAE,IAAY,EAA8B,EAAE;QACnE,OAAO,OAAO,CAAC,MAAM,GAAG,IA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ator for an Iroh-reachable MindooDB server.
3
+ *
4
+ * Paste forms:
5
+ * - `iroh:<ticket>` (ticket already starts with `endpoint`)
6
+ * - raw `endpoint…` ticket
7
+ *
8
+ * Stored locator is `iroh:<endpointId>` so IP changes in the ticket do not
9
+ * create a new connection row. The full ticket stays in `irohTicket`.
10
+ */
11
+ export interface ParsedIrohLocator {
12
+ kind: "iroh";
13
+ /** Full ticket used to dial (with or without the `iroh:` prefix stripped). */
14
+ ticket: string;
15
+ /** Stable connection key, `iroh:<endpointId>` when the id can be parsed. */
16
+ locator: string;
17
+ /** Endpoint id when we can read it from the ticket; otherwise undefined. */
18
+ endpointId?: string;
19
+ }
20
+ export declare function isIrohLocator(value: string): boolean;
21
+ export declare function parseIrohLocator(value: string): ParsedIrohLocator;
22
+ /**
23
+ * Iroh endpoint tickets are `endpoint` + base32(postcard(EndpointAddr)).
24
+ * The first 32 bytes of the payload are the public key / endpoint id.
25
+ * If decoding fails we still accept the ticket and use it as the locator.
26
+ */
27
+ export declare function extractEndpointIdFromTicket(ticket: string): string | undefined;
28
+ //# sourceMappingURL=irohLocator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"irohLocator.d.ts","sourceRoot":"","sources":["../../../../src/core/appendonlystores/network/irohLocator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGpD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,CA4BjE;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAc9E"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ /**
3
+ * Haven / CLI locator for an Iroh-reachable MindooDB server.
4
+ *
5
+ * Paste forms:
6
+ * - `iroh:<ticket>` (ticket already starts with `endpoint`)
7
+ * - raw `endpoint…` ticket
8
+ *
9
+ * Stored locator is `iroh:<endpointId>` so IP changes in the ticket do not
10
+ * create a new connection row. The full ticket stays in `irohTicket`.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.isIrohLocator = isIrohLocator;
14
+ exports.parseIrohLocator = parseIrohLocator;
15
+ exports.extractEndpointIdFromTicket = extractEndpointIdFromTicket;
16
+ const IROH_SCHEME = "iroh:";
17
+ const ENDPOINT_PREFIX = "endpoint";
18
+ function isIrohLocator(value) {
19
+ const trimmed = value.trim();
20
+ return trimmed.startsWith(IROH_SCHEME) || trimmed.startsWith(ENDPOINT_PREFIX);
21
+ }
22
+ function parseIrohLocator(value) {
23
+ const trimmed = value.trim();
24
+ if (!trimmed) {
25
+ throw new Error("Enter an Iroh ticket first.");
26
+ }
27
+ const storedId = /^iroh:([0-9a-f]{64})$/i.exec(trimmed);
28
+ if (storedId) {
29
+ const endpointId = storedId[1].toLowerCase();
30
+ return {
31
+ kind: "iroh",
32
+ ticket: "",
33
+ locator: `${IROH_SCHEME}${endpointId}`,
34
+ endpointId,
35
+ };
36
+ }
37
+ const ticket = trimmed.startsWith(IROH_SCHEME)
38
+ ? trimmed.slice(IROH_SCHEME.length)
39
+ : trimmed;
40
+ if (!ticket.startsWith(ENDPOINT_PREFIX) || ticket.length < ENDPOINT_PREFIX.length + 8) {
41
+ throw new Error("Enter a valid Iroh endpoint ticket (or iroh:<ticket>).");
42
+ }
43
+ const endpointId = extractEndpointIdFromTicket(ticket);
44
+ return {
45
+ kind: "iroh",
46
+ ticket,
47
+ locator: endpointId ? `${IROH_SCHEME}${endpointId}` : `${IROH_SCHEME}${ticket}`,
48
+ endpointId,
49
+ };
50
+ }
51
+ /**
52
+ * Iroh endpoint tickets are `endpoint` + base32(postcard(EndpointAddr)).
53
+ * The first 32 bytes of the payload are the public key / endpoint id.
54
+ * If decoding fails we still accept the ticket and use it as the locator.
55
+ */
56
+ function extractEndpointIdFromTicket(ticket) {
57
+ if (!ticket.startsWith(ENDPOINT_PREFIX)) {
58
+ return undefined;
59
+ }
60
+ const encoded = ticket.slice(ENDPOINT_PREFIX.length).toUpperCase();
61
+ try {
62
+ const bytes = decodeBase32NoPad(encoded);
63
+ if (bytes.length < 32) {
64
+ return undefined;
65
+ }
66
+ return bytesToHex(bytes.subarray(0, 32));
67
+ }
68
+ catch {
69
+ return undefined;
70
+ }
71
+ }
72
+ function decodeBase32NoPad(input) {
73
+ const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
74
+ let bits = 0;
75
+ let value = 0;
76
+ const out = [];
77
+ for (const char of input) {
78
+ const idx = alphabet.indexOf(char);
79
+ if (idx === -1) {
80
+ throw new Error("invalid base32");
81
+ }
82
+ value = (value << 5) | idx;
83
+ bits += 5;
84
+ if (bits >= 8) {
85
+ bits -= 8;
86
+ out.push((value >>> bits) & 0xff);
87
+ }
88
+ }
89
+ return new Uint8Array(out);
90
+ }
91
+ function bytesToHex(bytes) {
92
+ return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
93
+ }
94
+ //# sourceMappingURL=irohLocator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"irohLocator.js","sourceRoot":"","sources":["../../../../src/core/appendonlystores/network/irohLocator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAeH,sCAGC;AAED,4CA4BC;AAOD,kEAcC;AAnED,MAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,MAAM,eAAe,GAAG,UAAU,CAAC;AAYnC,SAAgB,aAAa,CAAC,KAAa;IACzC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,OAAO,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC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AAC;AAED,SAAS,UAAU,CAAC,KAAiB;IACnC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAClF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type IrohStreamIO } from "./IrohStreamIO";
2
+ /**
3
+ * Optional adapter for `react-native-iroh`. Loaded dynamically so mindoodb
4
+ * does not hard-depend on that package.
5
+ */
6
+ export declare function createReactNativeIrohStreamIO(): Promise<IrohStreamIO>;
7
+ //# sourceMappingURL=reactNativeIrohStreamIO.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactNativeIrohStreamIO.d.ts","sourceRoot":"","sources":["../../../../src/core/appendonlystores/network/reactNativeIrohStreamIO.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE5F;;;GAGG;AACH,wBAAsB,6BAA6B,IAAI,OAAO,CAAC,YAAY,CAAC,CAkE3E"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createReactNativeIrohStreamIO = createReactNativeIrohStreamIO;
4
+ const IrohStreamIO_1 = require("./IrohStreamIO");
5
+ /**
6
+ * Optional adapter for `react-native-iroh`. Loaded dynamically so mindoodb
7
+ * does not hard-depend on that package.
8
+ */
9
+ async function createReactNativeIrohStreamIO() {
10
+ // The specifier is kept in a variable so web bundlers cannot see it: with a
11
+ // literal, Rollup resolves the import while bundling and fails the build of
12
+ // every consumer that has no React-Native dependency, guard or not.
13
+ const specifier = "react-native-iroh";
14
+ const mod = await import(/* @vite-ignore */ specifier).catch(() => null);
15
+ if (!mod?.Endpoint) {
16
+ throw new Error("react-native-iroh is not installed");
17
+ }
18
+ const endpoint = await mod.Endpoint.create({ alpns: [IrohStreamIO_1.MINDOODB_IROH_ALPN], preset: "n0" });
19
+ const ticket = typeof endpoint.ticket === "function" ? await endpoint.ticket() : endpoint.id;
20
+ const toByteStream = async (stream) => {
21
+ const iterator = stream.data[Symbol.asyncIterator]();
22
+ return {
23
+ send: (bytes) => stream.send(bytes),
24
+ recv: async () => {
25
+ const next = await iterator.next();
26
+ return next.done ? null : next.value;
27
+ },
28
+ close: async () => undefined,
29
+ };
30
+ };
31
+ return {
32
+ async getLocalTicket() {
33
+ return ticket;
34
+ },
35
+ async connect(peerTicket, alpn = IrohStreamIO_1.MINDOODB_IROH_ALPN) {
36
+ const connection = await endpoint.streams.connect(peerTicket, alpn);
37
+ return toByteStream(await connection.openStream());
38
+ },
39
+ async *listen(alpn = IrohStreamIO_1.MINDOODB_IROH_ALPN) {
40
+ for await (const connection of endpoint.streams.listen(alpn)) {
41
+ for await (const inbound of connection.incoming) {
42
+ yield toByteStream(inbound);
43
+ }
44
+ }
45
+ },
46
+ };
47
+ }
48
+ //# sourceMappingURL=reactNativeIrohStreamIO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactNativeIrohStreamIO.js","sourceRoot":"","sources":["../../../../src/core/appendonlystores/network/reactNativeIrohStreamIO.ts"],"names":[],"mappings":";;AAMA,sEAkEC;AAxED,iDAA4F;AAE5F;;;GAGG;AACI,KAAK,UAAU,6BAA6B;IACjD,4EAA4E;IAC5E,4EAA4E;IAC5E,oEAAoE;IACpE,MAAM,SAAS,GAAG,mBAAmB,CAAC;IACtC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAuB/D,CAAC;IACT,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACxD,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,GAAG,CAA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AAI,CAAC,EAAE,CAAC;gBAC7D,IAAI,KAAK,EAAE,MAAM,OAAO,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;oBAChD,MAAM,YAAY,CAAC,OAAO,CAAC,CAAC;gBAC9B,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,60 @@
1
+ import type { AttachmentReadPlan, AttachmentReadPlanOptions, ContentAddressedStore, ContentAddressedStoreFactory, CreateStoreResult, DocumentMaterializationBatchPlan, DocumentMaterializationPlan, MaterializationPlanOptions, OpenStoreOptions, StoreHead, StoreIdBloomSummary, StoreIndexBuildStatus, StoreScanCursor, StoreScanFilters, StoreScanResult } from "../types";
2
+ import { StoreKind } from "../types";
3
+ import type { StoreEntry, StoreEntryMetadata, StoreEntryType } from "../../types";
4
+ import { Logger } from "../../logging";
5
+ import { type SqliteStoreBackend } from "./SqliteDriver";
6
+ /**
7
+ * Persistent ContentAddressedStore backed by SQLite-shaped tables.
8
+ * Not imported by `mindoodb/browser`.
9
+ */
10
+ export declare class SqliteContentAddressedStore implements ContentAddressedStore {
11
+ private readonly dbId;
12
+ private readonly storeKind;
13
+ private readonly backend;
14
+ private ready;
15
+ private nextReceiptOrder;
16
+ private storeEpoch;
17
+ private readonly logger;
18
+ private readonly indexingEnabled;
19
+ constructor(dbId: string, storeKind: StoreKind, backend: SqliteStoreBackend, logger?: Logger, options?: OpenStoreOptions);
20
+ private bootstrap;
21
+ private persistCounters;
22
+ getId(): string;
23
+ getStoreKind(): StoreKind;
24
+ getCacheIdentity(): string;
25
+ putEntries(entries: StoreEntry[]): Promise<void>;
26
+ applyWitnessReceipts(receipts: StoreEntryMetadata[]): Promise<void>;
27
+ getEntries(ids: string[]): Promise<StoreEntry[]>;
28
+ getEntryMetadata(id: string): Promise<StoreEntryMetadata | null>;
29
+ planAttachmentReadByWalkingMetadata(lastChunkId: string, attachmentSize: number, options: AttachmentReadPlanOptions): Promise<AttachmentReadPlan>;
30
+ hasEntries(ids: string[]): Promise<string[]>;
31
+ findNewEntries(knownIds: string[]): Promise<StoreEntryMetadata[]>;
32
+ findNewEntriesForDoc(knownIds: string[], docId: string): Promise<StoreEntryMetadata[]>;
33
+ findEntries(type: StoreEntryType, creationDateFrom: number | null, creationDateUntil: number | null): Promise<StoreEntryMetadata[]>;
34
+ getAllIds(): Promise<string[]>;
35
+ scanEntriesSince(cursor: StoreScanCursor | null, limit?: number, filters?: StoreScanFilters): Promise<StoreScanResult>;
36
+ getIdBloomSummary(): Promise<StoreIdBloomSummary>;
37
+ getStoreHead(): Promise<StoreHead>;
38
+ planDocumentMaterialization(docId: string, options?: MaterializationPlanOptions): Promise<DocumentMaterializationPlan>;
39
+ planDocumentMaterializationBatch(docIds: string[], options?: MaterializationPlanOptions): Promise<DocumentMaterializationBatchPlan>;
40
+ resolveDependencies(startId: string, options?: Record<string, unknown>): Promise<string[]>;
41
+ purgeDocHistory(docId: string): Promise<void>;
42
+ deleteEntriesById(entryIds: string[]): Promise<number>;
43
+ clearAllLocalData(): Promise<void>;
44
+ awaitIndexReady(): Promise<StoreIndexBuildStatus>;
45
+ getIndexBuildStatus(): StoreIndexBuildStatus;
46
+ getStats(): Promise<{
47
+ entryCount: number;
48
+ contentCount: number;
49
+ docCount: number;
50
+ }>;
51
+ private allMetadata;
52
+ private metadataForDoc;
53
+ private matchesScanFilters;
54
+ }
55
+ export declare class SqliteContentAddressedStoreFactory implements ContentAddressedStoreFactory {
56
+ private readonly createBackend;
57
+ constructor(createBackend?: (dbId: string, kind: StoreKind) => SqliteStoreBackend);
58
+ createStore(dbId: string, options?: OpenStoreOptions): CreateStoreResult;
59
+ }
60
+ //# sourceMappingURL=SqliteContentAddressedStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SqliteContentAddressedStore.d.ts","sourceRoot":"","sources":["../../../../src/core/appendonlystores/sqlite/SqliteContentAddressedStore.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,kBAAkB,EAClB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