@feltdb/core 0.6.13 → 0.6.14
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/agent-registry.js +1 -3
- package/dist/agent-runtime.js +8 -7
- package/dist/analytics-backend.js +3 -1
- package/dist/application-contract.js +1 -0
- package/dist/application-manifest.js +1 -0
- package/dist/artifact.js +2 -0
- package/dist/authorization.js +2 -0
- package/dist/bundle.js +2 -0
- package/dist/capability.js +1 -3
- package/dist/cell.js +9 -4
- package/dist/cli/commands.js +26 -2
- package/dist/cli/index.js +1 -1
- package/dist/collection.js +39 -31
- package/dist/create/package-versions.js +1 -1
- package/dist/create/server-source/crates/feltdb/src/bin/feltdb_node.rs +497 -27
- package/dist/create/server-source/crates/feltdb/src/causal_backlog_bound.rs +452 -0
- package/dist/create/server-source/crates/feltdb/src/causal_dependency_barrier.rs +208 -0
- package/dist/create/server-source/crates/feltdb/src/convergence.rs +16 -0
- package/dist/create/server-source/crates/feltdb/src/dedup_bound_investigation.rs +402 -0
- package/dist/create/server-source/crates/feltdb/src/distributed_transactions.rs +765 -24
- package/dist/create/server-source/crates/feltdb/src/durable_operation_identity.rs +418 -0
- package/dist/create/server-source/crates/feltdb/src/lib.rs +4 -0
- package/dist/create/server-source/crates/feltdb/src/replica_membership.rs +661 -0
- package/dist/db.js +19 -13
- package/dist/development-runtime-bridge.js +1 -1
- package/dist/distributed-indexing.js +7 -5
- package/dist/file-db.js +8 -3
- package/dist/flowspec.js +2 -1
- package/dist/http-client.js +2 -0
- package/dist/http-db.js +16 -1
- package/dist/identity.js +1 -0
- package/dist/index-analytics.js +6 -7
- package/dist/index-backend.js +3 -3
- package/dist/index-dashboard.js +10 -13
- package/dist/index-manager.js +12 -11
- package/dist/index-monitoring.js +9 -4
- package/dist/index-store.js +2 -0
- package/dist/indexeddb-db.js +27 -23
- package/dist/memory-db.js +7 -4
- package/dist/observe.js +2 -0
- package/dist/provider.js +2 -0
- package/dist/query-planner.js +2 -4
- package/dist/reactive-graph.js +6 -8
- package/dist/release.js +2 -0
- package/dist/sharding.js +11 -6
- package/dist/state-contract.js +3 -3
- package/dist/studio-app/assets/{feltdb_wasm-CJv3wHzi.js → feltdb_wasm-C9xpYtna.js} +1 -1
- package/dist/studio-app/assets/feltdb_wasm_bg-BsXHw7eX.wasm +0 -0
- package/dist/studio-app/assets/{index-DospFFYE.js → index-D4RZ44qs.js} +4 -4
- package/dist/studio-app/index.html +1 -1
- package/dist/sync-contract.js +9 -2
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +32 -12
- package/dist/transaction.js +4 -2
- package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
- package/dist/worker.js +2 -0
- package/dist/workload.js +2 -0
- package/dist/workspace/development-node.js +11 -10
- package/dist/workspace/investigation-lifecycle-manager.js +2 -0
- package/dist/workspace/investigation-supervisor.js +5 -3
- package/dist/workspace/workspace-connection.js +14 -5
- package/package.json +1 -1
- package/dist/studio-app/assets/feltdb_wasm_bg-C8TG8r2n.wasm +0 -0
package/dist/db.js
CHANGED
|
@@ -73,19 +73,25 @@ function observeRuntime(runtime, observation) {
|
|
|
73
73
|
* Applications use this to treat FeltDB collections as live application state.
|
|
74
74
|
*/
|
|
75
75
|
export class StateFirstDB {
|
|
76
|
+
jsDb;
|
|
77
|
+
collections = new Map();
|
|
78
|
+
cells = new Map();
|
|
79
|
+
runtimeInfo;
|
|
80
|
+
agentRegistry;
|
|
81
|
+
agentRuntime;
|
|
82
|
+
capabilityWorkers = new Map();
|
|
83
|
+
observation;
|
|
84
|
+
closeDevelopmentBridge;
|
|
85
|
+
workloads = new WorkloadClient();
|
|
86
|
+
artifacts = new ArtifactClient();
|
|
87
|
+
bundle = new BundleClient();
|
|
88
|
+
releases = new ReleaseClient();
|
|
89
|
+
observe = new ObserveClient();
|
|
90
|
+
providers = new ProviderClient();
|
|
91
|
+
workers = new WorkerClient();
|
|
92
|
+
workerPools = new WorkerPoolClient();
|
|
93
|
+
mesh = new MeshClient();
|
|
76
94
|
constructor(jsDb, observation, closeDevelopmentBridge) {
|
|
77
|
-
this.collections = new Map();
|
|
78
|
-
this.cells = new Map();
|
|
79
|
-
this.capabilityWorkers = new Map();
|
|
80
|
-
this.workloads = new WorkloadClient();
|
|
81
|
-
this.artifacts = new ArtifactClient();
|
|
82
|
-
this.bundle = new BundleClient();
|
|
83
|
-
this.releases = new ReleaseClient();
|
|
84
|
-
this.observe = new ObserveClient();
|
|
85
|
-
this.providers = new ProviderClient();
|
|
86
|
-
this.workers = new WorkerClient();
|
|
87
|
-
this.workerPools = new WorkerPoolClient();
|
|
88
|
-
this.mesh = new MeshClient();
|
|
89
95
|
this.jsDb = jsDb;
|
|
90
96
|
this.observation = observation;
|
|
91
97
|
this.closeDevelopmentBridge = closeDevelopmentBridge;
|
|
@@ -457,7 +463,7 @@ export class StateFirstDB {
|
|
|
457
463
|
throw new Error('Durable workflow coordination requires a server runtime');
|
|
458
464
|
return this.jsDb.command(`/workflows/${encodeURIComponent(name)}/runs`, { input });
|
|
459
465
|
}
|
|
460
|
-
async claimWorkflowStep(runId, step, worker, leaseMs =
|
|
466
|
+
async claimWorkflowStep(runId, step, worker, leaseMs = 30_000) {
|
|
461
467
|
if (!(this.jsDb instanceof HttpJsDb))
|
|
462
468
|
throw new Error('Durable workflow coordination requires a server runtime');
|
|
463
469
|
return this.jsDb.command(`/workflow-runs/${encodeURIComponent(runId)}/steps/${encodeURIComponent(step)}/claim`, { worker, lease_ms: leaseMs });
|
|
@@ -73,7 +73,7 @@ export function attachDevelopmentRuntimeBridge(input) {
|
|
|
73
73
|
if (!response.ok)
|
|
74
74
|
return;
|
|
75
75
|
if (!heartbeat) {
|
|
76
|
-
heartbeat = setInterval(() => { void register(activeSession); },
|
|
76
|
+
heartbeat = setInterval(() => { void register(activeSession); }, 2_000);
|
|
77
77
|
heartbeat.unref?.();
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
* Distributed Index Manager - TypeScript implementation
|
|
12
12
|
*/
|
|
13
13
|
export class DistributedIndexManager {
|
|
14
|
+
localPeerId;
|
|
15
|
+
replicationStates = new Map();
|
|
16
|
+
peerStates = new Map();
|
|
17
|
+
pendingOperations = [];
|
|
14
18
|
constructor(localPeerId) {
|
|
15
|
-
this.replicationStates = new Map();
|
|
16
|
-
this.peerStates = new Map();
|
|
17
|
-
this.pendingOperations = [];
|
|
18
19
|
this.localPeerId = localPeerId;
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
@@ -213,9 +214,10 @@ export class DistributedIndexManager {
|
|
|
213
214
|
* Synchronization coordinator for multi-node environments
|
|
214
215
|
*/
|
|
215
216
|
export class DistributedSyncCoordinator {
|
|
217
|
+
indexManager;
|
|
218
|
+
syncInterval = null;
|
|
219
|
+
syncIntervalMs = 5000; // 5 seconds
|
|
216
220
|
constructor(indexManager) {
|
|
217
|
-
this.syncInterval = null;
|
|
218
|
-
this.syncIntervalMs = 5000; // 5 seconds
|
|
219
221
|
this.indexManager = indexManager;
|
|
220
222
|
}
|
|
221
223
|
/**
|
package/dist/file-db.js
CHANGED
|
@@ -14,10 +14,15 @@ function getPathSync() {
|
|
|
14
14
|
throw new Error('FileJsDb is only available in Node.js environments');
|
|
15
15
|
}
|
|
16
16
|
export class FileJsDb {
|
|
17
|
+
dataPath;
|
|
18
|
+
statePath;
|
|
19
|
+
lockPath;
|
|
20
|
+
state;
|
|
21
|
+
origin;
|
|
22
|
+
peers = new Set();
|
|
23
|
+
lockFd = null;
|
|
24
|
+
applied = new Set();
|
|
17
25
|
constructor(path) {
|
|
18
|
-
this.peers = new Set();
|
|
19
|
-
this.lockFd = null;
|
|
20
|
-
this.applied = new Set();
|
|
21
26
|
const nodePath = getPathSync();
|
|
22
27
|
const nodeFs = getFsSync();
|
|
23
28
|
// Normalize and resolve the path to prevent directory traversal
|
package/dist/flowspec.js
CHANGED
|
@@ -79,9 +79,10 @@ function lex(source) {
|
|
|
79
79
|
return tokens;
|
|
80
80
|
}
|
|
81
81
|
class Parser {
|
|
82
|
+
tokens;
|
|
83
|
+
index = 0;
|
|
82
84
|
constructor(tokens) {
|
|
83
85
|
this.tokens = tokens;
|
|
84
|
-
this.index = 0;
|
|
85
86
|
}
|
|
86
87
|
peek(value) { return this.index < this.tokens.length && (value === undefined || this.tokens[this.index].value === value); }
|
|
87
88
|
take(value) { const token = this.tokens[this.index++]; if (!token || (value && token.value !== value))
|
package/dist/http-client.js
CHANGED
package/dist/http-db.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** Network adapter implementing the same collection runtime contract as WASM. */
|
|
2
2
|
export class HttpJsDb {
|
|
3
|
+
url;
|
|
4
|
+
token;
|
|
3
5
|
constructor(options) {
|
|
4
6
|
this.url = options.url.replace(/\/$/, '');
|
|
5
7
|
this.token = options.token;
|
|
@@ -280,6 +282,19 @@ export class HttpJsDb {
|
|
|
280
282
|
* is totally ordered. `GET /revision` reads it without performing a write.
|
|
281
283
|
*/
|
|
282
284
|
get_sequence() { return 0; }
|
|
285
|
+
/**
|
|
286
|
+
* The scope is the store's own instance id, reported by the server, not this
|
|
287
|
+
* client's URL.
|
|
288
|
+
*
|
|
289
|
+
* That distinction matters behind a load balancer or after a failover: the
|
|
290
|
+
* URL would stay the same across two different stores and make their counters
|
|
291
|
+
* look comparable. The store's identity changes, so the mismatch surfaces as
|
|
292
|
+
* a refusal in `readRevision` instead of a silently wrong comparison.
|
|
293
|
+
*
|
|
294
|
+
* It is remembered after the first read so the common path is one request,
|
|
295
|
+
* and a later disagreement is exactly the signal worth raising.
|
|
296
|
+
*/
|
|
297
|
+
advertisedScope;
|
|
283
298
|
async freshness() {
|
|
284
299
|
if (this.advertisedScope === undefined) {
|
|
285
300
|
// An authority that predates `/revision` cannot validate a cache by
|
|
@@ -316,7 +331,7 @@ export class HttpJsDb {
|
|
|
316
331
|
return await response.json();
|
|
317
332
|
}
|
|
318
333
|
absorb(body) {
|
|
319
|
-
this.advertisedScope
|
|
334
|
+
this.advertisedScope ??= body.scope;
|
|
320
335
|
return body;
|
|
321
336
|
}
|
|
322
337
|
}
|
package/dist/identity.js
CHANGED
package/dist/index-analytics.js
CHANGED
|
@@ -9,12 +9,10 @@
|
|
|
9
9
|
* Tracks index usage and query performance.
|
|
10
10
|
*/
|
|
11
11
|
export class IndexAnalytics {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
this.maxTraces = 10000; // Keep last 10K queries
|
|
17
|
-
}
|
|
12
|
+
metrics = new Map();
|
|
13
|
+
queryTraces = [];
|
|
14
|
+
fieldQueryCount = new Map();
|
|
15
|
+
maxTraces = 10000; // Keep last 10K queries
|
|
18
16
|
/**
|
|
19
17
|
* Record an index usage event.
|
|
20
18
|
*/
|
|
@@ -238,8 +236,9 @@ export class IndexAnalytics {
|
|
|
238
236
|
* Automatic tuning engine - applies recommendations automatically.
|
|
239
237
|
*/
|
|
240
238
|
export class AutoTuner {
|
|
239
|
+
analytics;
|
|
240
|
+
appliedRecommendations = new Set();
|
|
241
241
|
constructor(analytics) {
|
|
242
|
-
this.appliedRecommendations = new Set();
|
|
243
242
|
this.analytics = analytics;
|
|
244
243
|
}
|
|
245
244
|
/**
|
package/dist/index-backend.js
CHANGED
|
@@ -25,10 +25,10 @@ async function loadWasm() {
|
|
|
25
25
|
// Import TS implementation for fallback
|
|
26
26
|
import { IndexManager as TsIndexManager } from './index-manager.js';
|
|
27
27
|
export class IndexBackend {
|
|
28
|
+
tsBackend = null;
|
|
29
|
+
wasmBackend = null;
|
|
30
|
+
useWasm = false;
|
|
28
31
|
constructor() {
|
|
29
|
-
this.tsBackend = null;
|
|
30
|
-
this.wasmBackend = null;
|
|
31
|
-
this.useWasm = false;
|
|
32
32
|
this.tsBackend = new TsIndexManager();
|
|
33
33
|
}
|
|
34
34
|
async initializeWasm() {
|
package/dist/index-dashboard.js
CHANGED
|
@@ -130,11 +130,10 @@ export class DashboardFormatter {
|
|
|
130
130
|
* Real-time dashboard updates via events.
|
|
131
131
|
*/
|
|
132
132
|
export class LiveDashboard {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
133
|
+
metrics = null;
|
|
134
|
+
listeners = new Set();
|
|
135
|
+
updateInterval = 10000; // 10 seconds
|
|
136
|
+
intervalHandle;
|
|
138
137
|
/**
|
|
139
138
|
* Start streaming dashboard updates.
|
|
140
139
|
*/
|
|
@@ -181,14 +180,12 @@ export class LiveDashboard {
|
|
|
181
180
|
}
|
|
182
181
|
}
|
|
183
182
|
export class PerformanceAlerter {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
};
|
|
191
|
-
}
|
|
183
|
+
alerts = [];
|
|
184
|
+
thresholds = {
|
|
185
|
+
slowQueryMs: 100,
|
|
186
|
+
fullScanThreshold: 0.2, // 20% full scans is warning
|
|
187
|
+
indexOverhead: 0.1, // 10% write overhead is warning
|
|
188
|
+
};
|
|
192
189
|
/**
|
|
193
190
|
* Check dashboard against thresholds and generate alerts.
|
|
194
191
|
*/
|
package/dist/index-manager.js
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* Manages creation, maintenance, and query optimization using indexes.
|
|
5
5
|
*/
|
|
6
6
|
class HashIndex {
|
|
7
|
+
entries = new Map();
|
|
8
|
+
field;
|
|
9
|
+
stats = { reads: 0, writes: 0, selectivity: 0 };
|
|
7
10
|
constructor(field) {
|
|
8
|
-
this.entries = new Map();
|
|
9
|
-
this.stats = { reads: 0, writes: 0, selectivity: 0 };
|
|
10
11
|
this.field = field;
|
|
11
12
|
}
|
|
12
13
|
add(recordId, value) {
|
|
@@ -54,9 +55,10 @@ class HashIndex {
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
class SortedIndex {
|
|
58
|
+
entries = [];
|
|
59
|
+
field;
|
|
60
|
+
stats = { reads: 0, writes: 0, selectivity: 0 };
|
|
57
61
|
constructor(field) {
|
|
58
|
-
this.entries = [];
|
|
59
|
-
this.stats = { reads: 0, writes: 0, selectivity: 0 };
|
|
60
62
|
this.field = field;
|
|
61
63
|
}
|
|
62
64
|
add(recordId, value) {
|
|
@@ -122,9 +124,10 @@ class SortedIndex {
|
|
|
122
124
|
}
|
|
123
125
|
}
|
|
124
126
|
class TextIndex {
|
|
127
|
+
tokenIndex = new Map();
|
|
128
|
+
fields;
|
|
129
|
+
stats = { reads: 0, writes: 0, selectivity: 0 };
|
|
125
130
|
constructor(fields) {
|
|
126
|
-
this.tokenIndex = new Map();
|
|
127
|
-
this.stats = { reads: 0, writes: 0, selectivity: 0 };
|
|
128
131
|
this.fields = fields;
|
|
129
132
|
}
|
|
130
133
|
add(recordId, data) {
|
|
@@ -196,11 +199,9 @@ class TextIndex {
|
|
|
196
199
|
}
|
|
197
200
|
}
|
|
198
201
|
export class IndexManager {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
this.indexStats = new Map();
|
|
203
|
-
}
|
|
202
|
+
indexes = new Map();
|
|
203
|
+
config = new Map();
|
|
204
|
+
indexStats = new Map();
|
|
204
205
|
/** Construct an empty index from its configuration. */
|
|
205
206
|
buildIndex(config) {
|
|
206
207
|
if (config.type === 'hash' && config.field)
|
package/dist/index-monitoring.js
CHANGED
|
@@ -11,6 +11,13 @@ import { DashboardFormatter, LiveDashboard, PerformanceAlerter } from './index-d
|
|
|
11
11
|
* Uses Rust-backed analytics when available, with TypeScript fallback.
|
|
12
12
|
*/
|
|
13
13
|
export class IndexMonitor {
|
|
14
|
+
analyticsBackend;
|
|
15
|
+
analytics; // For compatibility with AutoTuner
|
|
16
|
+
autoTuner;
|
|
17
|
+
dashboard;
|
|
18
|
+
alerter;
|
|
19
|
+
config;
|
|
20
|
+
collectionName;
|
|
14
21
|
constructor(collectionName, config = {}) {
|
|
15
22
|
this.collectionName = collectionName;
|
|
16
23
|
this.config = {
|
|
@@ -136,10 +143,8 @@ export class IndexMonitor {
|
|
|
136
143
|
* Global monitoring registry for multiple collections.
|
|
137
144
|
*/
|
|
138
145
|
export class MonitoringRegistry {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
this.defaultConfig = {};
|
|
142
|
-
}
|
|
146
|
+
monitors = new Map();
|
|
147
|
+
defaultConfig = {};
|
|
143
148
|
/**
|
|
144
149
|
* Register a collection monitor.
|
|
145
150
|
*/
|
package/dist/index-store.js
CHANGED
package/dist/indexeddb-db.js
CHANGED
|
@@ -2,27 +2,21 @@ import { FreshnessContractViolation } from './freshness.js';
|
|
|
2
2
|
import { decideTransaction, embeddedResult, EmbeddedTransactionRejected, } from './embedded-transaction.js';
|
|
3
3
|
/** Durable browser runtime. Every mutation resolves only after its IndexedDB transaction commits. */
|
|
4
4
|
export class IndexedDbJsDb {
|
|
5
|
+
database;
|
|
6
|
+
channel;
|
|
7
|
+
sequence = 0;
|
|
8
|
+
origin;
|
|
9
|
+
peers = new Set();
|
|
10
|
+
changeListeners = new Map();
|
|
11
|
+
changeCursor = 0;
|
|
12
|
+
changePollGeneration = 0;
|
|
13
|
+
changePollRunning = false;
|
|
14
|
+
changePollTimer;
|
|
15
|
+
changeChannelListening = false;
|
|
16
|
+
changeCoordinatorReady = false;
|
|
17
|
+
pendingChangeAnnouncements = [];
|
|
18
|
+
announcedChangeSequences = new Set();
|
|
5
19
|
constructor(namespace) {
|
|
6
|
-
this.sequence = 0;
|
|
7
|
-
this.peers = new Set();
|
|
8
|
-
this.changeListeners = new Map();
|
|
9
|
-
this.changeCursor = 0;
|
|
10
|
-
this.changePollGeneration = 0;
|
|
11
|
-
this.changePollRunning = false;
|
|
12
|
-
this.changeChannelListening = false;
|
|
13
|
-
this.changeCoordinatorReady = false;
|
|
14
|
-
this.pendingChangeAnnouncements = [];
|
|
15
|
-
this.announcedChangeSequences = new Set();
|
|
16
|
-
this.receiveChangeMessage = (event) => {
|
|
17
|
-
if (!event.data?.collection)
|
|
18
|
-
return;
|
|
19
|
-
const announcement = { collection: event.data.collection, sequence: event.data.sequence };
|
|
20
|
-
if (!this.changeCoordinatorReady) {
|
|
21
|
-
this.pendingChangeAnnouncements.push(announcement);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
this.deliverChangeAnnouncement(announcement);
|
|
25
|
-
};
|
|
26
20
|
if (typeof indexedDB === 'undefined')
|
|
27
21
|
throw new Error('IndexedDB is unavailable in this browser');
|
|
28
22
|
this.database = this.open(`feltdb:${namespace}`);
|
|
@@ -77,8 +71,8 @@ export class IndexedDbJsDb {
|
|
|
77
71
|
change.onsuccess = () => {
|
|
78
72
|
const sequence = Number(change.result);
|
|
79
73
|
committedSequence = sequence;
|
|
80
|
-
if (sequence >
|
|
81
|
-
changes.delete(IDBKeyRange.upperBound(sequence -
|
|
74
|
+
if (sequence > 10_000)
|
|
75
|
+
changes.delete(IDBKeyRange.upperBound(sequence - 10_000));
|
|
82
76
|
};
|
|
83
77
|
transaction.oncomplete = () => resolve();
|
|
84
78
|
transaction.onerror = () => reject(transaction.error ?? new Error('IndexedDB mutation failed'));
|
|
@@ -318,6 +312,16 @@ export class IndexedDbJsDb {
|
|
|
318
312
|
this.stopChangeCoordinator();
|
|
319
313
|
};
|
|
320
314
|
}
|
|
315
|
+
receiveChangeMessage = (event) => {
|
|
316
|
+
if (!event.data?.collection)
|
|
317
|
+
return;
|
|
318
|
+
const announcement = { collection: event.data.collection, sequence: event.data.sequence };
|
|
319
|
+
if (!this.changeCoordinatorReady) {
|
|
320
|
+
this.pendingChangeAnnouncements.push(announcement);
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
this.deliverChangeAnnouncement(announcement);
|
|
324
|
+
};
|
|
321
325
|
deliverChangeAnnouncement(announcement) {
|
|
322
326
|
if (announcement.sequence !== undefined) {
|
|
323
327
|
if (announcement.sequence <= this.changeCursor)
|
|
@@ -339,7 +343,7 @@ export class IndexedDbJsDb {
|
|
|
339
343
|
this.announcedChangeSequences.add(sequence);
|
|
340
344
|
// The durable poll normally drains this set within one interval. Bound it
|
|
341
345
|
// defensively if a browser repeatedly delivers announcements while polling fails.
|
|
342
|
-
if (this.announcedChangeSequences.size >
|
|
346
|
+
if (this.announcedChangeSequences.size > 10_000) {
|
|
343
347
|
const oldest = this.announcedChangeSequences.values().next().value;
|
|
344
348
|
if (oldest !== undefined)
|
|
345
349
|
this.announcedChangeSequences.delete(oldest);
|
package/dist/memory-db.js
CHANGED
|
@@ -12,11 +12,14 @@ function namespaceRevision(namespace) {
|
|
|
12
12
|
}
|
|
13
13
|
/** In-process runtime used by the synchronous createFeltDB API. */
|
|
14
14
|
export class MemoryJsDb {
|
|
15
|
+
rows;
|
|
16
|
+
events = [];
|
|
17
|
+
sequence = 0;
|
|
18
|
+
origin;
|
|
19
|
+
revisionState;
|
|
20
|
+
peers = new Set();
|
|
21
|
+
applied = new Set();
|
|
15
22
|
constructor(namespace) {
|
|
16
|
-
this.events = [];
|
|
17
|
-
this.sequence = 0;
|
|
18
|
-
this.peers = new Set();
|
|
19
|
-
this.applied = new Set();
|
|
20
23
|
let rows = namespaces.get(namespace);
|
|
21
24
|
if (!rows) {
|
|
22
25
|
rows = new Map();
|
package/dist/observe.js
CHANGED
package/dist/provider.js
CHANGED
package/dist/query-planner.js
CHANGED
|
@@ -86,10 +86,8 @@ export class QueryPlanner {
|
|
|
86
86
|
* Compound query builder for multi-field searches.
|
|
87
87
|
*/
|
|
88
88
|
export class CompoundQuery {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
this.fields = [];
|
|
92
|
-
}
|
|
89
|
+
predicates = new Map();
|
|
90
|
+
fields = [];
|
|
93
91
|
/**
|
|
94
92
|
* Add a predicate for a field.
|
|
95
93
|
*/
|
package/dist/reactive-graph.js
CHANGED
|
@@ -8,14 +8,12 @@
|
|
|
8
8
|
* Tracks dependencies between collections and propagates changes
|
|
9
9
|
*/
|
|
10
10
|
export class ReactiveDependencyGraph {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
this.recentChanges = new Map();
|
|
18
|
-
}
|
|
11
|
+
/** Map of collection name to its dependents (derived collections) */
|
|
12
|
+
dependencies = new Map();
|
|
13
|
+
/** Map of collection name to its subscribers (callbacks) */
|
|
14
|
+
subscribers = new Map();
|
|
15
|
+
/** Recent changes for each collection (for differential updates) */
|
|
16
|
+
recentChanges = new Map();
|
|
19
17
|
/**
|
|
20
18
|
* Register a dependency: when sourceCollection changes, notify dependentCollection
|
|
21
19
|
*/
|
package/dist/release.js
CHANGED
package/dist/sharding.js
CHANGED
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
* Shard Manager - TypeScript implementation
|
|
12
12
|
*/
|
|
13
13
|
export class ShardManager {
|
|
14
|
+
shardingKey;
|
|
15
|
+
strategy;
|
|
16
|
+
shardRanges = [];
|
|
17
|
+
shardMetrics = new Map();
|
|
18
|
+
rebalanceHistory = [];
|
|
19
|
+
rebalanceThreshold = 0.5;
|
|
14
20
|
constructor(shardingKey, strategy = 'consistent-hash') {
|
|
15
|
-
this.shardRanges = [];
|
|
16
|
-
this.shardMetrics = new Map();
|
|
17
|
-
this.rebalanceHistory = [];
|
|
18
|
-
this.rebalanceThreshold = 0.5;
|
|
19
21
|
this.shardingKey = shardingKey;
|
|
20
22
|
this.strategy = strategy;
|
|
21
23
|
}
|
|
@@ -231,8 +233,9 @@ export class ShardManager {
|
|
|
231
233
|
* Shard Router - Routes queries to appropriate shards
|
|
232
234
|
*/
|
|
233
235
|
export class ShardRouter {
|
|
236
|
+
shardManager;
|
|
237
|
+
shardConnections = new Map(); // Map of shardId to connection
|
|
234
238
|
constructor(shardManager) {
|
|
235
|
-
this.shardConnections = new Map(); // Map of shardId to connection
|
|
236
239
|
this.shardManager = shardManager;
|
|
237
240
|
}
|
|
238
241
|
/**
|
|
@@ -275,8 +278,10 @@ export class ShardRouter {
|
|
|
275
278
|
* Rebalancer - Coordinates data migration between shards
|
|
276
279
|
*/
|
|
277
280
|
export class Rebalancer {
|
|
281
|
+
shardManager;
|
|
282
|
+
shardRouter;
|
|
283
|
+
rebalanceInProgress = false;
|
|
278
284
|
constructor(shardManager, shardRouter) {
|
|
279
|
-
this.rebalanceInProgress = false;
|
|
280
285
|
this.shardManager = shardManager;
|
|
281
286
|
this.shardRouter = shardRouter;
|
|
282
287
|
}
|
package/dist/state-contract.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { FeltDBErrorCode } from './error-codes.js';
|
|
2
2
|
class TransactionBuilder {
|
|
3
|
-
|
|
4
|
-
this.operations = [];
|
|
5
|
-
}
|
|
3
|
+
operations = [];
|
|
6
4
|
collection(name) { return { insert: (id, value) => { this.operations.push({ kind: 'insert', collection: name, id, value }); return id; }, update: (id, value, options) => { this.operations.push({ kind: 'update', collection: name, id, value, if_version: options?.ifVersion }); }, delete: (id, options) => { this.operations.push({ kind: 'delete', collection: name, id, if_version: options?.ifVersion }); } }; }
|
|
7
5
|
}
|
|
8
6
|
export class StateContractClient {
|
|
7
|
+
target;
|
|
8
|
+
baseUrl;
|
|
9
9
|
constructor(target, baseUrl = '') {
|
|
10
10
|
this.target = target;
|
|
11
11
|
this.baseUrl = baseUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=class e{static __wrap(t){let n=Object.create(e.prototype);return n.__wbg_ptr=t,T.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,T.unregister(this),e}free(){let e=this.__destroy_into_raw();U.__wbg_jsdb_free(e,0)}acknowledge_peer_operations(e,n){let r=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),i=H,a=U.jsdb_acknowledge_peer_operations(this.__wbg_ptr,r,i,n);return t.__wrap(a)}add_sync_peer(e){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=U.jsdb_add_sync_peer(this.__wbg_ptr,n,r);return t.__wrap(i)}delete(e){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=U.jsdb_delete(this.__wbg_ptr,n,r);return t.__wrap(i)}execute_canonical_query(e,n,r,i){let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),c=H,l=F(r,U.__wbindgen_malloc,U.__wbindgen_realloc),u=H,d=F(i,U.__wbindgen_malloc,U.__wbindgen_realloc),f=H,p=U.jsdb_execute_canonical_query(this.__wbg_ptr,a,o,s,c,l,u,d,f);return t.__wrap(p)}execute_canonical_transaction(e,n){let r=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),i=H,a=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.jsdb_execute_canonical_transaction(this.__wbg_ptr,r,i,a,o);return t.__wrap(s)}get(e){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=U.jsdb_get(this.__wbg_ptr,n,r);return t.__wrap(i)}get_capability_records(e){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=U.jsdb_get_capability_records(this.__wbg_ptr,n,r);return t.__wrap(i)}get_pending_for_peer(e,n){let r=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),i=H,a=U.jsdb_get_pending_for_peer(this.__wbg_ptr,r,i,n);return t.__wrap(a)}get_sequence(){let e=U.jsdb_get_sequence(this.__wbg_ptr);return BigInt.asUintN(64,e)}insert(e,n){let r=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),i=H,a=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.jsdb_insert(this.__wbg_ptr,r,i,a,o);return t.__wrap(s)}instance_id(){let e,t;try{let n=U.jsdb_instance_id(this.__wbg_ptr);return e=n[0],t=n[1],j(n[0],n[1])}finally{U.__wbindgen_free(e,t,1)}}is_auto_indexed(){return U.jsdb_is_auto_indexed(this.__wbg_ptr)!==0}query(e){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=U.jsdb_query(this.__wbg_ptr,n,r);return t.__wrap(i)}remove_sync_peer(e){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=U.jsdb_remove_sync_peer(this.__wbg_ptr,n,r);return t.__wrap(i)}sync_info(){let e=U.jsdb_sync_info(this.__wbg_ptr);return t.__wrap(e)}update(e,n){let r=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),i=H,a=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.jsdb_update(this.__wbg_ptr,r,i,a,o);return t.__wrap(s)}};Symbol.dispose&&(e.prototype[Symbol.dispose]=e.prototype.free);var t=class e{static __wrap(t){let n=Object.create(e.prototype);return n.__wbg_ptr=t,E.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,E.unregister(this),e}free(){let e=this.__destroy_into_raw();U.__wbg_jsresult_free(e,0)}get data(){let e=U.jsresult_data(this.__wbg_ptr),t;return e[0]!==0&&(t=j(e[0],e[1]),U.__wbindgen_free(e[0],e[1]*1,1)),t}get error(){let e=U.jsresult_error(this.__wbg_ptr),t;return e[0]!==0&&(t=j(e[0],e[1]),U.__wbindgen_free(e[0],e[1]*1,1)),t}get success(){return U.jsresult_success(this.__wbg_ptr)!==0}};Symbol.dispose&&(t.prototype[Symbol.dispose]=t.prototype.free);var n=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,D.unregister(this),e}free(){let e=this.__destroy_into_raw();U.__wbg_wasmanalytics_free(e,0)}generate_report(e,t){let n,r;try{let o=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),s=H,c=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),l=H,u=U.wasmanalytics_generate_report(this.__wbg_ptr,o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,I(u[2]);return n=i,r=a,j(i,a)}finally{U.__wbindgen_free(n,r,1)}}get_all_metrics(){let e,t;try{let i=U.wasmanalytics_get_all_metrics(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,I(i[2]);return e=n,t=r,j(n,r)}finally{U.__wbindgen_free(e,t,1)}}get_frequent_fields(e){let t,n;try{let a=U.wasmanalytics_get_frequent_fields(this.__wbg_ptr,e);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,I(a[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}get_index_metrics(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.wasmanalytics_get_index_metrics(this.__wbg_ptr,a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}get_slowest_queries(e){let t,n;try{let a=U.wasmanalytics_get_slowest_queries(this.__wbg_ptr,e);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,I(a[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}constructor(){let e=U.wasmanalytics_new();return this.__wbg_ptr=e,D.register(this,this.__wbg_ptr,this),this}record_index_usage(e,t,n){let r=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),i=H,a=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H;U.wasmanalytics_record_index_usage(this.__wbg_ptr,r,i,a,o,n)}record_query(e,t,n,r,i,a){let o=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),s=H,c=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),l=H;var u=P(a)?0:F(a,U.__wbindgen_malloc,U.__wbindgen_realloc),d=H;let f=U.wasmanalytics_record_query(this.__wbg_ptr,o,s,c,l,n,r,i,u,d);if(f[1])throw I(f[0])}reset(){U.wasmanalytics_reset(this.__wbg_ptr)}};Symbol.dispose&&(n.prototype[Symbol.dispose]=n.prototype.free);var r=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,O.unregister(this),e}free(){let e=this.__destroy_into_raw();U.__wbg_wasmdistributedindexmanager_free(e,0)}create_replicated_index(e,t,n){let r=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),i=H,a=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),c=H,l=U.wasmdistributedindexmanager_create_replicated_index(this.__wbg_ptr,r,i,a,o,s,c);if(l[1])throw I(l[0])}detect_conflicts(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.wasmdistributedindexmanager_detect_conflicts(this.__wbg_ptr,a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}get_replication_status(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.wasmdistributedindexmanager_get_replication_status(this.__wbg_ptr,a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}get_replication_targets(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.wasmdistributedindexmanager_get_replication_targets(this.__wbg_ptr,a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}get_sync_status(){let e,t;try{let i=U.wasmdistributedindexmanager_get_sync_status(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,I(i[2]);return e=n,t=r,j(n,r)}finally{U.__wbindgen_free(e,t,1)}}merge_versions(e){let t=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),n=H,r=U.wasmdistributedindexmanager_merge_versions(this.__wbg_ptr,t,n);if(r[1])throw I(r[0])}constructor(e){let t=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),n=H,r=U.wasmdistributedindexmanager_new(t,n);return this.__wbg_ptr=r,O.register(this,this.__wbg_ptr,this),this}register_peer(e){let t=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),n=H;U.wasmdistributedindexmanager_register_peer(this.__wbg_ptr,t,n)}set_peer_reachable(e,t){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H;U.wasmdistributedindexmanager_set_peer_reachable(this.__wbg_ptr,n,r,t)}};Symbol.dispose&&(r.prototype[Symbol.dispose]=r.prototype.free);var i=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,k.unregister(this),e}free(){let e=this.__destroy_into_raw();U.__wbg_wasmindexmanager_free(e,0)}create_index(e){let t=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),n=H,r=U.wasmindexmanager_create_index(this.__wbg_ptr,t,n);if(r[1])throw I(r[0])}get_stats(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.wasmindexmanager_get_stats(this.__wbg_ptr,a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}list_indexes(){let e,t;try{let i=U.wasmindexmanager_list_indexes(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,I(i[2]);return e=n,t=r,j(n,r)}finally{U.__wbindgen_free(e,t,1)}}constructor(){let e=U.wasmindexmanager_new();return this.__wbg_ptr=e,k.register(this,this.__wbg_ptr,this),this}query_index(e,t,n){let r,i;try{let s=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),c=H,l=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),u=H,d=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),f=H,p=U.wasmindexmanager_query_index(this.__wbg_ptr,s,c,l,u,d,f);var a=p[0],o=p[1];if(p[3])throw a=0,o=0,I(p[2]);return r=a,i=o,j(a,o)}finally{U.__wbindgen_free(r,i,1)}}update_record(e,t,n){let r=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),i=H;var a=P(t)?0:F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H;let s=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),c=H,l=U.wasmindexmanager_update_record(this.__wbg_ptr,r,i,a,o,s,c);if(l[1])throw I(l[0])}};Symbol.dispose&&(i.prototype[Symbol.dispose]=i.prototype.free);var a=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,A.unregister(this),e}free(){let e=this.__destroy_into_raw();U.__wbg_wasmshardmanager_free(e,0)}detect_hotspots(){let e,t;try{let i=U.wasmshardmanager_detect_hotspots(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,I(i[2]);return e=n,t=r,j(n,r)}finally{U.__wbindgen_free(e,t,1)}}generate_rebalance_ops(){let e,t;try{let i=U.wasmshardmanager_generate_rebalance_ops(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,I(i[2]);return e=n,t=r,j(n,r)}finally{U.__wbindgen_free(e,t,1)}}get_all_metrics(){let e,t;try{let i=U.wasmshardmanager_get_all_metrics(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,I(i[2]);return e=n,t=r,j(n,r)}finally{U.__wbindgen_free(e,t,1)}}get_distribution_summary(){let e,t;try{let i=U.wasmshardmanager_get_distribution_summary(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,I(i[2]);return e=n,t=r,j(n,r)}finally{U.__wbindgen_free(e,t,1)}}get_shard_for_key(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.wasmshardmanager_get_shard_for_key(this.__wbg_ptr,a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}initialize_shards(e){let t=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),n=H,r=U.wasmshardmanager_initialize_shards(this.__wbg_ptr,t,n);if(r[1])throw I(r[0])}constructor(e,t){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),a=H,o=U.wasmshardmanager_new(n,r,i,a);return this.__wbg_ptr=o,A.register(this,this.__wbg_ptr,this),this}record_shard_operation(e,t,n,r,i){let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),c=H;U.wasmshardmanager_record_shard_operation(this.__wbg_ptr,a,o,s,c,n,r,i)}};Symbol.dispose&&(a.prototype[Symbol.dispose]=a.prototype.free);function o(e,t){let n,r;try{let o=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),s=H,c=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),l=H,u=U.apply_sync_result(o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,I(u[2]);return n=i,r=a,j(i,a)}finally{U.__wbindgen_free(n,r,1)}}function s(e,t,n,r,i,a){let o,s;try{let u=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),d=H,f=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),p=H,m=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),h=H,g=F(r,U.__wbindgen_malloc,U.__wbindgen_realloc),_=H,v=F(i,U.__wbindgen_malloc,U.__wbindgen_realloc),y=H,b=F(a,U.__wbindgen_malloc,U.__wbindgen_realloc),x=H,S=U.authorize_offline(u,d,f,p,m,h,g,_,v,y,b,x);var c=S[0],l=S[1];if(S[3])throw c=0,l=0,I(S[2]);return o=c,s=l,j(c,l)}finally{U.__wbindgen_free(o,s,1)}}function c(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.canonical_bundle_hash(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}function l(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.canonicalize_application_manifest(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}function u(e,t){let n,r;try{let o=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),s=H,c=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),l=H,u=U.compare_state_schemas(o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,I(u[2]);return n=i,r=a,j(i,a)}finally{U.__wbindgen_free(n,r,1)}}function d(e,t){let n,r;try{var i=P(e)?0:F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),a=H;let c=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),l=H,u=U.diff_application_revisions(i,a,c,l);var o=u[0],s=u[1];if(u[3])throw o=0,s=0,I(u[2]);return n=o,r=s,j(o,s)}finally{U.__wbindgen_free(n,r,1)}}function f(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.hash_application_manifest(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}function p(e,t){let n,r;try{let o=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),s=H,c=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),l=H,u=U.hash_application_runtime(o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,I(u[2]);return n=i,r=a,j(i,a)}finally{U.__wbindgen_free(n,r,1)}}function m(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.hash_state_schema(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}function h(t){let n=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=U.open(n,r);if(i[2])throw I(i[1]);return e.__wrap(i[0])}function g(e,t){let n,r;try{let o=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),s=H,c=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),l=H,u=U.resolve_application_runtime(o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,I(u[2]);return n=i,r=a,j(i,a)}finally{U.__wbindgen_free(n,r,1)}}function _(e,t,n,r){let i=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),a=H,o=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),s=H,c=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),l=H,u=U.validate_mesh_claim(i,a,o,s,c,l,r);if(u[1])throw I(u[0])}function v(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.validate_state_schema(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}function y(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.validate_sync_operation(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}function b(e,t){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),a=H,o=U.validate_worker_transition(n,r,i,a);if(o[2])throw I(o[1]);return o[0]!==0}function x(e,t){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),a=H,o=U.validate_workload_transition(n,r,i,a);if(o[2])throw I(o[1]);return o[0]!==0}function S(e){let t=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),n=H,r=U.verify_bundle_integrity(t,n);if(r[2])throw I(r[1]);return r[0]!==0}function C(e,t,n,r,i,a){let o,s;try{let u=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),d=H,f=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),p=H,m=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),h=H,g=F(r,U.__wbindgen_malloc,U.__wbindgen_realloc),_=H,v=F(i,U.__wbindgen_malloc,U.__wbindgen_realloc),y=H,b=F(a,U.__wbindgen_malloc,U.__wbindgen_realloc),x=H,S=U.verify_signed_grant(u,d,f,p,m,h,g,_,v,y,b,x);var c=S[0],l=S[1];if(S[3])throw c=0,l=0,I(S[2]);return o=c,s=l,j(c,l)}finally{U.__wbindgen_free(o,s,1)}}function w(){return{__proto__:null,"./feltdb_wasm_bg.js":{__proto__:null,__wbg___wbindgen_throw_bb96b2010945f0bc:function(e,t){throw Error(j(e,t))},__wbindgen_cast_0000000000000001:function(e,t){return j(e,t)},__wbindgen_init_externref_table:function(){let e=U.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}var T=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>U.__wbg_jsdb_free(e,1)),E=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>U.__wbg_jsresult_free(e,1)),D=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>U.__wbg_wasmanalytics_free(e,1)),O=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>U.__wbg_wasmdistributedindexmanager_free(e,1)),k=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>U.__wbg_wasmindexmanager_free(e,1)),A=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>U.__wbg_wasmshardmanager_free(e,1));function j(e,t){return B(e>>>0,t)}var M=null;function N(){return(M===null||M.byteLength===0)&&(M=new Uint8Array(U.memory.buffer)),M}function P(e){return e==null}function F(e,t,n){if(n===void 0){let n=V.encode(e),r=t(n.length,1)>>>0;return N().subarray(r,r+n.length).set(n),H=n.length,r}let r=e.length,i=t(r,1)>>>0,a=N(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=N().subarray(i+o,i+r),a=V.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return H=o,i}function I(e){let t=U.__wbindgen_externrefs.get(e);return U.__externref_table_dealloc(e),t}var L=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});L.decode();var R=2146435072,z=0;function B(e,t){return z+=t,z>=R&&(L=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),L.decode(),z=t),L.decode(N().subarray(e,e+t))}var V=new TextEncoder;`encodeInto`in V||(V.encodeInto=function(e,t){let n=V.encode(e);return t.set(n),{read:e.length,written:n.length}});var H=0,U;function W(e,t){return U=e.exports,M=null,U.__wbindgen_start(),U}async function G(e,t){if(typeof Response==`function`&&e instanceof Response){if(!e.ok)throw Error(`failed to fetch Wasm: ${e.status} ${e.statusText} fetching '${e.url}'`);if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}function K(e){if(U!==void 0)return U;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=w();return e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e)),W(new WebAssembly.Instance(e,t),e)}async function q(e){if(U!==void 0)return U;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`)),e===void 0&&(e=new URL(`/assets/feltdb_wasm_bg-C8TG8r2n.wasm`,``+import.meta.url));let t=w();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await G(await e,t);return W(n,r)}export{e as JsDb,t as JsResult,n as WasmAnalytics,r as WasmDistributedIndexManager,i as WasmIndexManager,a as WasmShardManager,o as apply_sync_result,s as authorize_offline,c as canonical_bundle_hash,l as canonicalize_application_manifest,u as compare_state_schemas,q as default,d as diff_application_revisions,f as hash_application_manifest,p as hash_application_runtime,m as hash_state_schema,K as initSync,h as open,g as resolve_application_runtime,_ as validate_mesh_claim,v as validate_state_schema,y as validate_sync_operation,b as validate_worker_transition,x as validate_workload_transition,S as verify_bundle_integrity,C as verify_signed_grant};
|
|
1
|
+
var e=class e{static __wrap(t){let n=Object.create(e.prototype);return n.__wbg_ptr=t,T.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,T.unregister(this),e}free(){let e=this.__destroy_into_raw();U.__wbg_jsdb_free(e,0)}acknowledge_peer_operations(e,n){let r=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),i=H,a=U.jsdb_acknowledge_peer_operations(this.__wbg_ptr,r,i,n);return t.__wrap(a)}add_sync_peer(e){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=U.jsdb_add_sync_peer(this.__wbg_ptr,n,r);return t.__wrap(i)}delete(e){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=U.jsdb_delete(this.__wbg_ptr,n,r);return t.__wrap(i)}execute_canonical_query(e,n,r,i){let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),c=H,l=F(r,U.__wbindgen_malloc,U.__wbindgen_realloc),u=H,d=F(i,U.__wbindgen_malloc,U.__wbindgen_realloc),f=H,p=U.jsdb_execute_canonical_query(this.__wbg_ptr,a,o,s,c,l,u,d,f);return t.__wrap(p)}execute_canonical_transaction(e,n){let r=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),i=H,a=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.jsdb_execute_canonical_transaction(this.__wbg_ptr,r,i,a,o);return t.__wrap(s)}get(e){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=U.jsdb_get(this.__wbg_ptr,n,r);return t.__wrap(i)}get_capability_records(e){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=U.jsdb_get_capability_records(this.__wbg_ptr,n,r);return t.__wrap(i)}get_pending_for_peer(e,n){let r=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),i=H,a=U.jsdb_get_pending_for_peer(this.__wbg_ptr,r,i,n);return t.__wrap(a)}get_sequence(){let e=U.jsdb_get_sequence(this.__wbg_ptr);return BigInt.asUintN(64,e)}insert(e,n){let r=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),i=H,a=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.jsdb_insert(this.__wbg_ptr,r,i,a,o);return t.__wrap(s)}instance_id(){let e,t;try{let n=U.jsdb_instance_id(this.__wbg_ptr);return e=n[0],t=n[1],j(n[0],n[1])}finally{U.__wbindgen_free(e,t,1)}}is_auto_indexed(){return U.jsdb_is_auto_indexed(this.__wbg_ptr)!==0}query(e){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=U.jsdb_query(this.__wbg_ptr,n,r);return t.__wrap(i)}remove_sync_peer(e){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=U.jsdb_remove_sync_peer(this.__wbg_ptr,n,r);return t.__wrap(i)}sync_info(){let e=U.jsdb_sync_info(this.__wbg_ptr);return t.__wrap(e)}update(e,n){let r=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),i=H,a=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.jsdb_update(this.__wbg_ptr,r,i,a,o);return t.__wrap(s)}};Symbol.dispose&&(e.prototype[Symbol.dispose]=e.prototype.free);var t=class e{static __wrap(t){let n=Object.create(e.prototype);return n.__wbg_ptr=t,E.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,E.unregister(this),e}free(){let e=this.__destroy_into_raw();U.__wbg_jsresult_free(e,0)}get data(){let e=U.jsresult_data(this.__wbg_ptr),t;return e[0]!==0&&(t=j(e[0],e[1]),U.__wbindgen_free(e[0],e[1]*1,1)),t}get error(){let e=U.jsresult_error(this.__wbg_ptr),t;return e[0]!==0&&(t=j(e[0],e[1]),U.__wbindgen_free(e[0],e[1]*1,1)),t}get success(){return U.jsresult_success(this.__wbg_ptr)!==0}};Symbol.dispose&&(t.prototype[Symbol.dispose]=t.prototype.free);var n=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,D.unregister(this),e}free(){let e=this.__destroy_into_raw();U.__wbg_wasmanalytics_free(e,0)}generate_report(e,t){let n,r;try{let o=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),s=H,c=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),l=H,u=U.wasmanalytics_generate_report(this.__wbg_ptr,o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,I(u[2]);return n=i,r=a,j(i,a)}finally{U.__wbindgen_free(n,r,1)}}get_all_metrics(){let e,t;try{let i=U.wasmanalytics_get_all_metrics(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,I(i[2]);return e=n,t=r,j(n,r)}finally{U.__wbindgen_free(e,t,1)}}get_frequent_fields(e){let t,n;try{let a=U.wasmanalytics_get_frequent_fields(this.__wbg_ptr,e);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,I(a[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}get_index_metrics(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.wasmanalytics_get_index_metrics(this.__wbg_ptr,a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}get_slowest_queries(e){let t,n;try{let a=U.wasmanalytics_get_slowest_queries(this.__wbg_ptr,e);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,I(a[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}constructor(){let e=U.wasmanalytics_new();return this.__wbg_ptr=e,D.register(this,this.__wbg_ptr,this),this}record_index_usage(e,t,n){let r=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),i=H,a=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H;U.wasmanalytics_record_index_usage(this.__wbg_ptr,r,i,a,o,n)}record_query(e,t,n,r,i,a){let o=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),s=H,c=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),l=H;var u=P(a)?0:F(a,U.__wbindgen_malloc,U.__wbindgen_realloc),d=H;let f=U.wasmanalytics_record_query(this.__wbg_ptr,o,s,c,l,n,r,i,u,d);if(f[1])throw I(f[0])}reset(){U.wasmanalytics_reset(this.__wbg_ptr)}};Symbol.dispose&&(n.prototype[Symbol.dispose]=n.prototype.free);var r=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,O.unregister(this),e}free(){let e=this.__destroy_into_raw();U.__wbg_wasmdistributedindexmanager_free(e,0)}create_replicated_index(e,t,n){let r=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),i=H,a=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),c=H,l=U.wasmdistributedindexmanager_create_replicated_index(this.__wbg_ptr,r,i,a,o,s,c);if(l[1])throw I(l[0])}detect_conflicts(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.wasmdistributedindexmanager_detect_conflicts(this.__wbg_ptr,a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}get_replication_status(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.wasmdistributedindexmanager_get_replication_status(this.__wbg_ptr,a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}get_replication_targets(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.wasmdistributedindexmanager_get_replication_targets(this.__wbg_ptr,a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}get_sync_status(){let e,t;try{let i=U.wasmdistributedindexmanager_get_sync_status(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,I(i[2]);return e=n,t=r,j(n,r)}finally{U.__wbindgen_free(e,t,1)}}merge_versions(e){let t=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),n=H,r=U.wasmdistributedindexmanager_merge_versions(this.__wbg_ptr,t,n);if(r[1])throw I(r[0])}constructor(e){let t=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),n=H,r=U.wasmdistributedindexmanager_new(t,n);return this.__wbg_ptr=r,O.register(this,this.__wbg_ptr,this),this}register_peer(e){let t=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),n=H;U.wasmdistributedindexmanager_register_peer(this.__wbg_ptr,t,n)}set_peer_reachable(e,t){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H;U.wasmdistributedindexmanager_set_peer_reachable(this.__wbg_ptr,n,r,t)}};Symbol.dispose&&(r.prototype[Symbol.dispose]=r.prototype.free);var i=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,k.unregister(this),e}free(){let e=this.__destroy_into_raw();U.__wbg_wasmindexmanager_free(e,0)}create_index(e){let t=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),n=H,r=U.wasmindexmanager_create_index(this.__wbg_ptr,t,n);if(r[1])throw I(r[0])}get_stats(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.wasmindexmanager_get_stats(this.__wbg_ptr,a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}list_indexes(){let e,t;try{let i=U.wasmindexmanager_list_indexes(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,I(i[2]);return e=n,t=r,j(n,r)}finally{U.__wbindgen_free(e,t,1)}}constructor(){let e=U.wasmindexmanager_new();return this.__wbg_ptr=e,k.register(this,this.__wbg_ptr,this),this}query_index(e,t,n){let r,i;try{let s=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),c=H,l=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),u=H,d=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),f=H,p=U.wasmindexmanager_query_index(this.__wbg_ptr,s,c,l,u,d,f);var a=p[0],o=p[1];if(p[3])throw a=0,o=0,I(p[2]);return r=a,i=o,j(a,o)}finally{U.__wbindgen_free(r,i,1)}}update_record(e,t,n){let r=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),i=H;var a=P(t)?0:F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H;let s=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),c=H,l=U.wasmindexmanager_update_record(this.__wbg_ptr,r,i,a,o,s,c);if(l[1])throw I(l[0])}};Symbol.dispose&&(i.prototype[Symbol.dispose]=i.prototype.free);var a=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,A.unregister(this),e}free(){let e=this.__destroy_into_raw();U.__wbg_wasmshardmanager_free(e,0)}detect_hotspots(){let e,t;try{let i=U.wasmshardmanager_detect_hotspots(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,I(i[2]);return e=n,t=r,j(n,r)}finally{U.__wbindgen_free(e,t,1)}}generate_rebalance_ops(){let e,t;try{let i=U.wasmshardmanager_generate_rebalance_ops(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,I(i[2]);return e=n,t=r,j(n,r)}finally{U.__wbindgen_free(e,t,1)}}get_all_metrics(){let e,t;try{let i=U.wasmshardmanager_get_all_metrics(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,I(i[2]);return e=n,t=r,j(n,r)}finally{U.__wbindgen_free(e,t,1)}}get_distribution_summary(){let e,t;try{let i=U.wasmshardmanager_get_distribution_summary(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,I(i[2]);return e=n,t=r,j(n,r)}finally{U.__wbindgen_free(e,t,1)}}get_shard_for_key(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.wasmshardmanager_get_shard_for_key(this.__wbg_ptr,a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}initialize_shards(e){let t=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),n=H,r=U.wasmshardmanager_initialize_shards(this.__wbg_ptr,t,n);if(r[1])throw I(r[0])}constructor(e,t){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),a=H,o=U.wasmshardmanager_new(n,r,i,a);return this.__wbg_ptr=o,A.register(this,this.__wbg_ptr,this),this}record_shard_operation(e,t,n,r,i){let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),c=H;U.wasmshardmanager_record_shard_operation(this.__wbg_ptr,a,o,s,c,n,r,i)}};Symbol.dispose&&(a.prototype[Symbol.dispose]=a.prototype.free);function o(e,t){let n,r;try{let o=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),s=H,c=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),l=H,u=U.apply_sync_result(o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,I(u[2]);return n=i,r=a,j(i,a)}finally{U.__wbindgen_free(n,r,1)}}function s(e,t,n,r,i,a){let o,s;try{let u=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),d=H,f=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),p=H,m=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),h=H,g=F(r,U.__wbindgen_malloc,U.__wbindgen_realloc),_=H,v=F(i,U.__wbindgen_malloc,U.__wbindgen_realloc),y=H,b=F(a,U.__wbindgen_malloc,U.__wbindgen_realloc),x=H,S=U.authorize_offline(u,d,f,p,m,h,g,_,v,y,b,x);var c=S[0],l=S[1];if(S[3])throw c=0,l=0,I(S[2]);return o=c,s=l,j(c,l)}finally{U.__wbindgen_free(o,s,1)}}function c(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.canonical_bundle_hash(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}function l(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.canonicalize_application_manifest(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}function u(e,t){let n,r;try{let o=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),s=H,c=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),l=H,u=U.compare_state_schemas(o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,I(u[2]);return n=i,r=a,j(i,a)}finally{U.__wbindgen_free(n,r,1)}}function d(e,t){let n,r;try{var i=P(e)?0:F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),a=H;let c=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),l=H,u=U.diff_application_revisions(i,a,c,l);var o=u[0],s=u[1];if(u[3])throw o=0,s=0,I(u[2]);return n=o,r=s,j(o,s)}finally{U.__wbindgen_free(n,r,1)}}function f(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.hash_application_manifest(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}function p(e,t){let n,r;try{let o=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),s=H,c=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),l=H,u=U.hash_application_runtime(o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,I(u[2]);return n=i,r=a,j(i,a)}finally{U.__wbindgen_free(n,r,1)}}function m(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.hash_state_schema(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}function h(t){let n=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=U.open(n,r);if(i[2])throw I(i[1]);return e.__wrap(i[0])}function g(e,t){let n,r;try{let o=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),s=H,c=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),l=H,u=U.resolve_application_runtime(o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,I(u[2]);return n=i,r=a,j(i,a)}finally{U.__wbindgen_free(n,r,1)}}function _(e,t,n,r){let i=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),a=H,o=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),s=H,c=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),l=H,u=U.validate_mesh_claim(i,a,o,s,c,l,r);if(u[1])throw I(u[0])}function v(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.validate_state_schema(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}function y(e){let t,n;try{let a=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),o=H,s=U.validate_sync_operation(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,I(s[2]);return t=r,n=i,j(r,i)}finally{U.__wbindgen_free(t,n,1)}}function b(e,t){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),a=H,o=U.validate_worker_transition(n,r,i,a);if(o[2])throw I(o[1]);return o[0]!==0}function x(e,t){let n=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),r=H,i=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),a=H,o=U.validate_workload_transition(n,r,i,a);if(o[2])throw I(o[1]);return o[0]!==0}function S(e){let t=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),n=H,r=U.verify_bundle_integrity(t,n);if(r[2])throw I(r[1]);return r[0]!==0}function C(e,t,n,r,i,a){let o,s;try{let u=F(e,U.__wbindgen_malloc,U.__wbindgen_realloc),d=H,f=F(t,U.__wbindgen_malloc,U.__wbindgen_realloc),p=H,m=F(n,U.__wbindgen_malloc,U.__wbindgen_realloc),h=H,g=F(r,U.__wbindgen_malloc,U.__wbindgen_realloc),_=H,v=F(i,U.__wbindgen_malloc,U.__wbindgen_realloc),y=H,b=F(a,U.__wbindgen_malloc,U.__wbindgen_realloc),x=H,S=U.verify_signed_grant(u,d,f,p,m,h,g,_,v,y,b,x);var c=S[0],l=S[1];if(S[3])throw c=0,l=0,I(S[2]);return o=c,s=l,j(c,l)}finally{U.__wbindgen_free(o,s,1)}}function w(){return{__proto__:null,"./feltdb_wasm_bg.js":{__proto__:null,__wbg___wbindgen_throw_bb96b2010945f0bc:function(e,t){throw Error(j(e,t))},__wbindgen_cast_0000000000000001:function(e,t){return j(e,t)},__wbindgen_init_externref_table:function(){let e=U.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}var T=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>U.__wbg_jsdb_free(e,1)),E=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>U.__wbg_jsresult_free(e,1)),D=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>U.__wbg_wasmanalytics_free(e,1)),O=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>U.__wbg_wasmdistributedindexmanager_free(e,1)),k=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>U.__wbg_wasmindexmanager_free(e,1)),A=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>U.__wbg_wasmshardmanager_free(e,1));function j(e,t){return B(e>>>0,t)}var M=null;function N(){return(M===null||M.byteLength===0)&&(M=new Uint8Array(U.memory.buffer)),M}function P(e){return e==null}function F(e,t,n){if(n===void 0){let n=V.encode(e),r=t(n.length,1)>>>0;return N().subarray(r,r+n.length).set(n),H=n.length,r}let r=e.length,i=t(r,1)>>>0,a=N(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=N().subarray(i+o,i+r),a=V.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return H=o,i}function I(e){let t=U.__wbindgen_externrefs.get(e);return U.__externref_table_dealloc(e),t}var L=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});L.decode();var R=2146435072,z=0;function B(e,t){return z+=t,z>=R&&(L=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),L.decode(),z=t),L.decode(N().subarray(e,e+t))}var V=new TextEncoder;`encodeInto`in V||(V.encodeInto=function(e,t){let n=V.encode(e);return t.set(n),{read:e.length,written:n.length}});var H=0,U;function W(e,t){return U=e.exports,M=null,U.__wbindgen_start(),U}async function G(e,t){if(typeof Response==`function`&&e instanceof Response){if(!e.ok)throw Error(`failed to fetch Wasm: ${e.status} ${e.statusText} fetching '${e.url}'`);if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}function K(e){if(U!==void 0)return U;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=w();return e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e)),W(new WebAssembly.Instance(e,t),e)}async function q(e){if(U!==void 0)return U;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`)),e===void 0&&(e=new URL(`/assets/feltdb_wasm_bg-BsXHw7eX.wasm`,``+import.meta.url));let t=w();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await G(await e,t);return W(n,r)}export{e as JsDb,t as JsResult,n as WasmAnalytics,r as WasmDistributedIndexManager,i as WasmIndexManager,a as WasmShardManager,o as apply_sync_result,s as authorize_offline,c as canonical_bundle_hash,l as canonicalize_application_manifest,u as compare_state_schemas,q as default,d as diff_application_revisions,f as hash_application_manifest,p as hash_application_runtime,m as hash_state_schema,K as initSync,h as open,g as resolve_application_runtime,_ as validate_mesh_claim,v as validate_state_schema,y as validate_sync_operation,b as validate_worker_transition,x as validate_workload_transition,S as verify_bundle_integrity,C as verify_signed_grant};
|