@feltdb/core 0.8.3 → 0.8.4
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/cli/commands.js +4 -1
- package/dist/cli/provisioning-neutrality.js +79 -0
- package/dist/collection.d.ts +43 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +192 -22
- package/dist/create/create.js +25 -21
- package/dist/create/managed-account.js +11 -0
- package/dist/create/package-versions.js +1 -1
- package/dist/create/server-source/crates/feltdb/src/equality_index.rs +595 -0
- package/dist/create/server-source/crates/feltdb/src/lib.rs +547 -115
- package/dist/create/server-source/crates/feltdb/src/phase1c3_acceptance.rs +11 -2
- package/dist/create/server-source/crates/feltdb/src/query_execution_diagnostics.rs +126 -0
- package/dist/create/server-source/crates/feltdb/src/state_contract.rs +292 -2
- package/dist/create/server-source/crates/feltdb/src/sync.rs +12 -0
- package/dist/create/server-source/crates/feltdb/src/workload_diagnostics.rs +443 -0
- package/dist/create/server-source/crates/feltdb/tests/pr34_query_collection.rs +233 -0
- package/dist/create/server-source/crates/feltdb/tests/pr35_equality_index.rs +892 -0
- package/dist/create/server-source/crates/feltdb-server/src/audit.rs +1137 -29
- package/dist/create/server-source/crates/feltdb-server/src/main.rs +474 -28
- package/dist/db.d.ts +33 -34
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +74 -20
- package/dist/deployment.d.ts +30 -0
- package/dist/deployment.d.ts.map +1 -0
- package/dist/deployment.js +130 -0
- package/dist/embedded-transaction.d.ts +22 -4
- package/dist/embedded-transaction.d.ts.map +1 -1
- package/dist/embedded-transaction.js +51 -5
- package/dist/feltdb.d.ts +14 -2
- package/dist/feltdb.d.ts.map +1 -1
- package/dist/file-db.js +1 -1
- package/dist/http-client.d.ts +14 -0
- package/dist/http-client.d.ts.map +1 -1
- package/dist/http-client.js +23 -5
- package/dist/http-db.d.ts +119 -1
- package/dist/http-db.d.ts.map +1 -1
- package/dist/http-db.js +346 -31
- package/dist/index-core.d.ts +2 -0
- package/dist/index-core.d.ts.map +1 -1
- package/dist/index-core.js +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/indexeddb-db.d.ts.map +1 -1
- package/dist/indexeddb-db.js +35 -21
- package/dist/managed-recovery.d.ts +192 -0
- package/dist/managed-recovery.d.ts.map +1 -0
- package/dist/managed-recovery.js +242 -0
- package/dist/memory-db.js +1 -1
- package/dist/studio-app/assets/{feltdb_wasm-DB8cX151.js → feltdb_wasm-CVQWgXO-.js} +1 -1
- package/dist/studio-app/assets/feltdb_wasm_bg-CNVpvaZV.wasm +0 -0
- package/dist/studio-app/assets/index-DwgNAIIX.js +29 -0
- package/dist/studio-app/index.html +1 -1
- package/dist/transaction.d.ts +30 -0
- package/dist/transaction.d.ts.map +1 -1
- package/dist/transaction.js +41 -0
- package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
- package/package.json +1 -1
- package/dist/studio-app/assets/feltdb_wasm_bg-ClhDHp0S.wasm +0 -0
- package/dist/studio-app/assets/index-B0k4UAlI.js +0 -29
package/dist/indexeddb-db.js
CHANGED
|
@@ -101,18 +101,19 @@ export class IndexedDbJsDb {
|
|
|
101
101
|
async commit_transaction(request) {
|
|
102
102
|
const db = await this.database;
|
|
103
103
|
const before = this.sequence;
|
|
104
|
-
//
|
|
105
|
-
//
|
|
106
|
-
//
|
|
107
|
-
//
|
|
108
|
-
//
|
|
109
|
-
//
|
|
110
|
-
//
|
|
111
|
-
// transaction
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
104
|
+
// A transaction with no operations, or with no identity, would open an
|
|
105
|
+
// IndexedDB transaction that reads nothing and therefore never reaches a
|
|
106
|
+
// decision. Those two are settled first, before a transaction is opened.
|
|
107
|
+
//
|
|
108
|
+
// Nothing else is pre-decided here. Every other question this runtime has
|
|
109
|
+
// to answer -- does the record exist, what version does it hold -- is a
|
|
110
|
+
// question about stored state, and answering it outside the IndexedDB
|
|
111
|
+
// transaction would put another writer between the check and the write.
|
|
112
|
+
if (!request.transactionId?.trim() || request.operations.length === 0) {
|
|
113
|
+
const structural = decideTransaction(request, { exists: () => false, hasApplied: () => false });
|
|
114
|
+
if (structural.kind === 'reject')
|
|
115
|
+
throw new EmbeddedTransactionRejected(structural.reason, structural.failure);
|
|
116
|
+
}
|
|
116
117
|
// Applied transaction ids live in their own store so identity survives a
|
|
117
118
|
// page reload the same way records do.
|
|
118
119
|
const alreadyApplied = await this.request('transactions', store => store.get(request.transactionId));
|
|
@@ -130,14 +131,28 @@ export class IndexedDbJsDb {
|
|
|
130
131
|
const rows = transaction.objectStore('rows');
|
|
131
132
|
const changes = transaction.objectStore('changes');
|
|
132
133
|
const transactions = transaction.objectStore('transactions');
|
|
133
|
-
// Read every
|
|
134
|
+
// Read every record the transaction touches -- the ones it writes and
|
|
135
|
+
// the ones it only guards -- inside the transaction, so the precondition
|
|
134
136
|
// check and the write cannot be separated by another writer.
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
//
|
|
138
|
+
// The values are read, not merely their presence. A `__version`, an
|
|
139
|
+
// authority epoch and a lease all live in the record body, so reading
|
|
140
|
+
// only the key would leave this runtime unable to evaluate the very
|
|
141
|
+
// predicates every other runtime evaluates, and `putIfAbsent` and
|
|
142
|
+
// `updateIfVersion` would mean something weaker in a browser than they
|
|
143
|
+
// mean anywhere else. `get` is no less atomic than `getKey` here: both
|
|
144
|
+
// are issued inside the same readwrite transaction.
|
|
145
|
+
const records = new Map();
|
|
146
|
+
const touched = [...new Set([
|
|
147
|
+
...request.operations.map(operation => `${operation.collection}:${operation.id}`),
|
|
148
|
+
...(request.preconditions ?? []).map(condition => `${condition.collection}:${condition.id}`),
|
|
149
|
+
])];
|
|
150
|
+
let pending = touched.length;
|
|
137
151
|
let decided = null;
|
|
138
152
|
const finish = () => {
|
|
139
153
|
const plan = decideTransaction(request, {
|
|
140
|
-
exists: key =>
|
|
154
|
+
exists: key => records.get(key) !== undefined,
|
|
155
|
+
read: key => records.get(key),
|
|
141
156
|
hasApplied: () => false,
|
|
142
157
|
});
|
|
143
158
|
decided = plan;
|
|
@@ -163,11 +178,10 @@ export class IndexedDbJsDb {
|
|
|
163
178
|
}
|
|
164
179
|
transactions.put({ transactionId: request.transactionId, committedAt: timestamp }, request.transactionId);
|
|
165
180
|
};
|
|
166
|
-
for (const
|
|
167
|
-
const
|
|
168
|
-
const lookup = rows.getKey(key);
|
|
181
|
+
for (const key of touched) {
|
|
182
|
+
const lookup = rows.get(key);
|
|
169
183
|
lookup.onsuccess = () => {
|
|
170
|
-
|
|
184
|
+
records.set(key, lookup.result);
|
|
171
185
|
pending -= 1;
|
|
172
186
|
if (pending === 0)
|
|
173
187
|
finish();
|
|
@@ -190,7 +204,7 @@ export class IndexedDbJsDb {
|
|
|
190
204
|
if (plan.kind === 'duplicate')
|
|
191
205
|
return embeddedResult(request, true, before, this.sequence);
|
|
192
206
|
if (plan.kind === 'reject')
|
|
193
|
-
throw new EmbeddedTransactionRejected(plan.reason);
|
|
207
|
+
throw new EmbeddedTransactionRejected(plan.reason, plan.failure);
|
|
194
208
|
this.sequence += plan.mutations.length;
|
|
195
209
|
for (const mutation of plan.mutations)
|
|
196
210
|
this.announceLocalChange(mutation.collection, this.sequence);
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Managed-client recovery primitives.
|
|
3
|
+
*
|
|
4
|
+
* These exist because of one production incident and one line of code:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* this.activeRevision ??= this.application_request('/application')
|
|
8
|
+
* .then(value => value.revision_id);
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* `??=` caches whatever the expression produced — including a *rejected*
|
|
12
|
+
* promise. One transient timeout during canonical revision discovery therefore
|
|
13
|
+
* became permanent client state: every later operation awaited the same
|
|
14
|
+
* rejection, and the only recovery was to construct a new client. A long-lived
|
|
15
|
+
* `HttpJsDb` never recovered, however healthy the authority became.
|
|
16
|
+
*
|
|
17
|
+
* The distinction the fix rests on is between **sharing an in-flight
|
|
18
|
+
* operation** and **caching its outcome**. Those are different things, and
|
|
19
|
+
* conflating them is what turned a network blip into a poisoned client:
|
|
20
|
+
*
|
|
21
|
+
* ```text
|
|
22
|
+
* SUCCESS the value is cached, permanently
|
|
23
|
+
* IN-FLIGHT concurrent callers share one request
|
|
24
|
+
* FAILURE the in-flight state is cleared, the failure reaches every
|
|
25
|
+
* caller that was waiting, and the next caller starts fresh
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* Nothing here retries anything on its own. A retry happens when the
|
|
29
|
+
* application performs another operation, which is deliberate: a client that
|
|
30
|
+
* retried revision discovery by itself would turn a permanently misconfigured
|
|
31
|
+
* application into a request storm against the authority.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Why an operation failed, in the only two categories a client can act on.
|
|
35
|
+
*
|
|
36
|
+
* `transient` means the request may succeed later without anything being
|
|
37
|
+
* fixed: a timeout, a reset connection, a 5xx, a 429. `permanent` means it
|
|
38
|
+
* will not: bad credentials, a missing grant, an application that is not
|
|
39
|
+
* configured the way the client thinks it is. The difference decides whether
|
|
40
|
+
* an automatic reconnect loop should keep trying or stop and wait for someone
|
|
41
|
+
* to change something.
|
|
42
|
+
*/
|
|
43
|
+
export type FailureKind = 'transient' | 'permanent';
|
|
44
|
+
export type ManagedFailureClass = 'transient' | 'authentication' | 'authorization' | 'configuration' | 'closed';
|
|
45
|
+
/** A failure rendered for an operator, without swallowing the typed original. */
|
|
46
|
+
export interface ManagedFailure {
|
|
47
|
+
kind: FailureKind;
|
|
48
|
+
failure_class: ManagedFailureClass;
|
|
49
|
+
name: string;
|
|
50
|
+
message: string;
|
|
51
|
+
code?: string;
|
|
52
|
+
status?: number;
|
|
53
|
+
at: string;
|
|
54
|
+
}
|
|
55
|
+
/** Classify a failure without requiring applications to inspect messages. */
|
|
56
|
+
export declare function classifyFailureClass(error: unknown): ManagedFailureClass;
|
|
57
|
+
/**
|
|
58
|
+
* Classify a failure as transient or permanent.
|
|
59
|
+
*
|
|
60
|
+
* The default is `transient`, and deliberately so: misclassifying a transient
|
|
61
|
+
* failure as permanent reproduces the incident this module exists to fix,
|
|
62
|
+
* while misclassifying a permanent one as transient costs a retry the caller
|
|
63
|
+
* was going to make anyway. The asymmetry is the whole point.
|
|
64
|
+
*/
|
|
65
|
+
export declare function classifyFailure(error: unknown): FailureKind;
|
|
66
|
+
/** Render a failure for the health surface without discarding the original. */
|
|
67
|
+
export declare function describeFailure(error: unknown): ManagedFailure;
|
|
68
|
+
/** What a client knows about a value it discovers once and then caches. */
|
|
69
|
+
export type DiscoveryState = 'cached' | 'loading' | 'unavailable';
|
|
70
|
+
export interface DiscoverySnapshot {
|
|
71
|
+
state: DiscoveryState;
|
|
72
|
+
consecutive_failures: number;
|
|
73
|
+
last_failure?: ManagedFailure;
|
|
74
|
+
last_success_at?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A value discovered once, shared while in flight, and never cached when it
|
|
78
|
+
* fails.
|
|
79
|
+
*
|
|
80
|
+
* The three invariants, all of which the incident violated:
|
|
81
|
+
*
|
|
82
|
+
* 1. a successful value is cached and never re-fetched;
|
|
83
|
+
* 2. concurrent callers share one request rather than issuing N;
|
|
84
|
+
* 3. a failed request leaves **no** cached state, so the next caller starts a
|
|
85
|
+
* new request — and every caller that was waiting sees the same typed
|
|
86
|
+
* failure, not a different one each.
|
|
87
|
+
*/
|
|
88
|
+
export declare class SingleFlightValue<T> {
|
|
89
|
+
private cached?;
|
|
90
|
+
private inFlight?;
|
|
91
|
+
private failures;
|
|
92
|
+
private lastFailure?;
|
|
93
|
+
private lastSuccessAt?;
|
|
94
|
+
/** The cached value, if discovery has ever succeeded. */
|
|
95
|
+
get value(): T | undefined;
|
|
96
|
+
get state(): DiscoveryState;
|
|
97
|
+
snapshot(): DiscoverySnapshot;
|
|
98
|
+
/**
|
|
99
|
+
* Return the value, discovering it with `load` if necessary.
|
|
100
|
+
*
|
|
101
|
+
* `load` runs at most once per in-flight window. It is passed in rather than
|
|
102
|
+
* held so that this type stays a state machine and nothing else: it knows
|
|
103
|
+
* how to share and how to forget, and nothing about HTTP.
|
|
104
|
+
*/
|
|
105
|
+
get(load: () => Promise<T>): Promise<T>;
|
|
106
|
+
/**
|
|
107
|
+
* Adopt a value the caller already has, without a request.
|
|
108
|
+
*
|
|
109
|
+
* A revision supplied at construction is as good as one discovered, and the
|
|
110
|
+
* state should say `cached` rather than pretending nothing is known.
|
|
111
|
+
*/
|
|
112
|
+
seed(value: T): void;
|
|
113
|
+
/** Forget everything, including a successful value. */
|
|
114
|
+
reset(): void;
|
|
115
|
+
}
|
|
116
|
+
export interface BackoffOptions {
|
|
117
|
+
/** The first delay's ceiling, in milliseconds. */
|
|
118
|
+
base?: number;
|
|
119
|
+
/** The largest ceiling any delay may have. */
|
|
120
|
+
max?: number;
|
|
121
|
+
/** How much the ceiling grows per consecutive failure. */
|
|
122
|
+
factor?: number;
|
|
123
|
+
/** Injected for tests; defaults to Math.random. */
|
|
124
|
+
random?: () => number;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Exponential backoff with a cap and jitter.
|
|
128
|
+
*
|
|
129
|
+
* The jitter is **partial**, not full: a delay is drawn uniformly from the
|
|
130
|
+
* upper half of its ceiling, `[ceiling / 2, ceiling)`. Full jitter — `[0,
|
|
131
|
+
* ceiling)` — would let the fifth consecutive failure sleep for less than the
|
|
132
|
+
* first, which makes "increasing after consecutive failures" untrue and
|
|
133
|
+
* untestable. Partial jitter keeps both properties: every delay is strictly
|
|
134
|
+
* larger than every delay possible at a lower failure count, and two clients
|
|
135
|
+
* failing together still separate, because they draw independently.
|
|
136
|
+
*
|
|
137
|
+
* The previous behaviour was a flat one-second retry, forever. That is
|
|
138
|
+
* neither bounded in aggregate nor jittered, so a managed service coming back
|
|
139
|
+
* after an outage was met by every client it had ever served, in lockstep.
|
|
140
|
+
*/
|
|
141
|
+
export declare class BoundedBackoff {
|
|
142
|
+
private readonly base;
|
|
143
|
+
private readonly max;
|
|
144
|
+
private readonly factor;
|
|
145
|
+
private readonly random;
|
|
146
|
+
private consecutive;
|
|
147
|
+
constructor(options?: BackoffOptions);
|
|
148
|
+
/** How many consecutive failures have been recorded. */
|
|
149
|
+
get attempts(): number;
|
|
150
|
+
/** The ceiling this many consecutive failures in, capped. */
|
|
151
|
+
ceiling(attempt?: number): number;
|
|
152
|
+
/** Draw the next delay and count the failure that caused it. */
|
|
153
|
+
next(): number;
|
|
154
|
+
/** A connection that stayed up long enough to count returns us to base. */
|
|
155
|
+
reset(): void;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Sleep, unless the signal aborts first.
|
|
159
|
+
*
|
|
160
|
+
* Two properties matter and both were missing: the timer must not hold a Node
|
|
161
|
+
* process open on its own, and the abort listener must be removed when the
|
|
162
|
+
* timer fires normally. Without the second, a long-lived subscription
|
|
163
|
+
* accumulates one listener per reconnect attempt, which is a leak that only
|
|
164
|
+
* shows up on the clients that have been running longest.
|
|
165
|
+
*/
|
|
166
|
+
export declare function cancellableDelay(ms: number, signal: AbortSignal): Promise<void>;
|
|
167
|
+
/** Where the event-stream connection currently is. */
|
|
168
|
+
export type ConnectionState = 'closed' | 'connecting' | 'connected' | 'backoff' | 'failed';
|
|
169
|
+
/** Overall authority usability, independent of event-stream lifecycle. */
|
|
170
|
+
export type AuthorityAvailabilityState = 'unknown' | 'available' | 'recovering' | 'degraded' | 'closed';
|
|
171
|
+
/**
|
|
172
|
+
* Enough structured state to answer one question: is this client connected,
|
|
173
|
+
* recovering, or poisoned?
|
|
174
|
+
*
|
|
175
|
+
* Deliberately not a monitoring framework. It is the operational surface that
|
|
176
|
+
* sits beside — never instead of — the typed error the caller already gets:
|
|
177
|
+
* an application handles `FeltDBServiceError`, an operator reads this.
|
|
178
|
+
*/
|
|
179
|
+
export interface ManagedClientHealth {
|
|
180
|
+
connection_state: ConnectionState;
|
|
181
|
+
availability_state: AuthorityAvailabilityState;
|
|
182
|
+
usable: boolean;
|
|
183
|
+
recovery_possible: boolean;
|
|
184
|
+
revision_state: DiscoveryState;
|
|
185
|
+
revision_id?: string;
|
|
186
|
+
consecutive_failures: number;
|
|
187
|
+
last_success_at?: string;
|
|
188
|
+
last_error?: ManagedFailure;
|
|
189
|
+
next_retry_at?: string;
|
|
190
|
+
next_retry_in_ms?: number;
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=managed-recovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-recovery.d.ts","sourceRoot":"","sources":["../src/managed-recovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAQH;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;AAEpD,MAAM,MAAM,mBAAmB,GAC3B,WAAW,GACX,gBAAgB,GAChB,eAAe,GACf,eAAe,GACf,QAAQ,CAAC;AAEb,iFAAiF;AACjF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,WAAW,CAAC;IAClB,aAAa,EAAE,mBAAmB,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;CACZ;AAQD,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAYxE;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAE3D;AAED,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,CAY9D;AAMD,2EAA2E;AAC3E,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,SAAS,GAAG,aAAa,CAAC;AAElE,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,cAAc,CAAC;IACtB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,iBAAiB,CAAC,CAAC;IAC9B,OAAO,CAAC,MAAM,CAAC,CAAI;IACnB,OAAO,CAAC,QAAQ,CAAC,CAAa;IAC9B,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,WAAW,CAAC,CAAiB;IACrC,OAAO,CAAC,aAAa,CAAC,CAAS;IAE/B,yDAAyD;IACzD,IAAI,KAAK,IAAI,CAAC,GAAG,SAAS,CAEzB;IAED,IAAI,KAAK,IAAI,cAAc,CAI1B;IAED,QAAQ,IAAI,iBAAiB;IAS7B;;;;;;OAMG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAgCvC;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI;IAOpB,uDAAuD;IACvD,KAAK,IAAI,IAAI;CAMd;AAMD,MAAM,WAAW,cAAc;IAC7B,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;IACtC,OAAO,CAAC,WAAW,CAAK;gBAEZ,OAAO,GAAE,cAAmB;IAOxC,wDAAwD;IACxD,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,6DAA6D;IAC7D,OAAO,CAAC,OAAO,SAAmB,GAAG,MAAM;IAI3C,gEAAgE;IAChE,IAAI,IAAI,MAAM;IAOd,2EAA2E;IAC3E,KAAK,IAAI,IAAI;CAGd;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAY/E;AAMD,sDAAsD;AACtD,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,YAAY,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE3F,0EAA0E;AAC1E,MAAM,MAAM,0BAA0B,GAAG,SAAS,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,QAAQ,CAAC;AAExG;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC,gBAAgB,EAAE,eAAe,CAAC;IAClC,kBAAkB,EAAE,0BAA0B,CAAC;IAC/C,MAAM,EAAE,OAAO,CAAC;IAChB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,cAAc,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Managed-client recovery primitives.
|
|
3
|
+
*
|
|
4
|
+
* These exist because of one production incident and one line of code:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* this.activeRevision ??= this.application_request('/application')
|
|
8
|
+
* .then(value => value.revision_id);
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* `??=` caches whatever the expression produced — including a *rejected*
|
|
12
|
+
* promise. One transient timeout during canonical revision discovery therefore
|
|
13
|
+
* became permanent client state: every later operation awaited the same
|
|
14
|
+
* rejection, and the only recovery was to construct a new client. A long-lived
|
|
15
|
+
* `HttpJsDb` never recovered, however healthy the authority became.
|
|
16
|
+
*
|
|
17
|
+
* The distinction the fix rests on is between **sharing an in-flight
|
|
18
|
+
* operation** and **caching its outcome**. Those are different things, and
|
|
19
|
+
* conflating them is what turned a network blip into a poisoned client:
|
|
20
|
+
*
|
|
21
|
+
* ```text
|
|
22
|
+
* SUCCESS the value is cached, permanently
|
|
23
|
+
* IN-FLIGHT concurrent callers share one request
|
|
24
|
+
* FAILURE the in-flight state is cleared, the failure reaches every
|
|
25
|
+
* caller that was waiting, and the next caller starts fresh
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* Nothing here retries anything on its own. A retry happens when the
|
|
29
|
+
* application performs another operation, which is deliberate: a client that
|
|
30
|
+
* retried revision discovery by itself would turn a permanently misconfigured
|
|
31
|
+
* application into a request storm against the authority.
|
|
32
|
+
*/
|
|
33
|
+
import { FeltDBServiceError } from './error-codes.js';
|
|
34
|
+
const PERMANENT_STATUS = new Set([400, 401, 403, 404, 405, 409, 410, 422]);
|
|
35
|
+
const PERMANENT_CODES = new Set([
|
|
36
|
+
'AUTHENTICATION_REQUIRED', 'AUTHENTICATION_FAILED', 'FORBIDDEN', 'NOT_FOUND',
|
|
37
|
+
'VALIDATION_ERROR', 'QUERY_INVALID',
|
|
38
|
+
]);
|
|
39
|
+
/** Classify a failure without requiring applications to inspect messages. */
|
|
40
|
+
export function classifyFailureClass(error) {
|
|
41
|
+
const value = error;
|
|
42
|
+
const status = value?.status;
|
|
43
|
+
const code = typeof value?.code === 'string' ? value.code : undefined;
|
|
44
|
+
if (status === 401 || code === 'AUTHENTICATION_REQUIRED' || code === 'AUTHENTICATION_FAILED')
|
|
45
|
+
return 'authentication';
|
|
46
|
+
if (status === 403 || code === 'FORBIDDEN')
|
|
47
|
+
return 'authorization';
|
|
48
|
+
if ((typeof status === 'number' && [400, 404, 405, 409, 410, 422].includes(status))
|
|
49
|
+
|| (code !== undefined && ['NOT_FOUND', 'VALIDATION_ERROR', 'QUERY_INVALID'].includes(code)))
|
|
50
|
+
return 'configuration';
|
|
51
|
+
if (code === 'CLIENT_CLOSED')
|
|
52
|
+
return 'closed';
|
|
53
|
+
return 'transient';
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Classify a failure as transient or permanent.
|
|
57
|
+
*
|
|
58
|
+
* The default is `transient`, and deliberately so: misclassifying a transient
|
|
59
|
+
* failure as permanent reproduces the incident this module exists to fix,
|
|
60
|
+
* while misclassifying a permanent one as transient costs a retry the caller
|
|
61
|
+
* was going to make anyway. The asymmetry is the whole point.
|
|
62
|
+
*/
|
|
63
|
+
export function classifyFailure(error) {
|
|
64
|
+
return classifyFailureClass(error) === 'transient' ? 'transient' : 'permanent';
|
|
65
|
+
}
|
|
66
|
+
/** Render a failure for the health surface without discarding the original. */
|
|
67
|
+
export function describeFailure(error) {
|
|
68
|
+
const service = error instanceof FeltDBServiceError ? error : undefined;
|
|
69
|
+
const value = error;
|
|
70
|
+
return {
|
|
71
|
+
kind: classifyFailure(error),
|
|
72
|
+
failure_class: classifyFailureClass(error),
|
|
73
|
+
name: value?.name ?? 'Error',
|
|
74
|
+
message: value?.message ?? String(error),
|
|
75
|
+
...(service?.code !== undefined ? { code: String(service.code) } : {}),
|
|
76
|
+
...(typeof value?.status === 'number' ? { status: value.status } : {}),
|
|
77
|
+
at: new Date().toISOString(),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A value discovered once, shared while in flight, and never cached when it
|
|
82
|
+
* fails.
|
|
83
|
+
*
|
|
84
|
+
* The three invariants, all of which the incident violated:
|
|
85
|
+
*
|
|
86
|
+
* 1. a successful value is cached and never re-fetched;
|
|
87
|
+
* 2. concurrent callers share one request rather than issuing N;
|
|
88
|
+
* 3. a failed request leaves **no** cached state, so the next caller starts a
|
|
89
|
+
* new request — and every caller that was waiting sees the same typed
|
|
90
|
+
* failure, not a different one each.
|
|
91
|
+
*/
|
|
92
|
+
export class SingleFlightValue {
|
|
93
|
+
cached;
|
|
94
|
+
inFlight;
|
|
95
|
+
failures = 0;
|
|
96
|
+
lastFailure;
|
|
97
|
+
lastSuccessAt;
|
|
98
|
+
/** The cached value, if discovery has ever succeeded. */
|
|
99
|
+
get value() {
|
|
100
|
+
return this.cached;
|
|
101
|
+
}
|
|
102
|
+
get state() {
|
|
103
|
+
if (this.cached !== undefined)
|
|
104
|
+
return 'cached';
|
|
105
|
+
if (this.inFlight)
|
|
106
|
+
return 'loading';
|
|
107
|
+
return 'unavailable';
|
|
108
|
+
}
|
|
109
|
+
snapshot() {
|
|
110
|
+
return {
|
|
111
|
+
state: this.state,
|
|
112
|
+
consecutive_failures: this.failures,
|
|
113
|
+
...(this.lastFailure ? { last_failure: this.lastFailure } : {}),
|
|
114
|
+
...(this.lastSuccessAt ? { last_success_at: this.lastSuccessAt } : {}),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Return the value, discovering it with `load` if necessary.
|
|
119
|
+
*
|
|
120
|
+
* `load` runs at most once per in-flight window. It is passed in rather than
|
|
121
|
+
* held so that this type stays a state machine and nothing else: it knows
|
|
122
|
+
* how to share and how to forget, and nothing about HTTP.
|
|
123
|
+
*/
|
|
124
|
+
get(load) {
|
|
125
|
+
if (this.cached !== undefined)
|
|
126
|
+
return Promise.resolve(this.cached);
|
|
127
|
+
if (this.inFlight)
|
|
128
|
+
return this.inFlight;
|
|
129
|
+
const request = Promise.resolve()
|
|
130
|
+
.then(load)
|
|
131
|
+
.then(value => {
|
|
132
|
+
this.cached = value;
|
|
133
|
+
this.failures = 0;
|
|
134
|
+
this.lastFailure = undefined;
|
|
135
|
+
this.lastSuccessAt = new Date().toISOString();
|
|
136
|
+
return value;
|
|
137
|
+
}, error => {
|
|
138
|
+
// The rejection is recorded and re-thrown. It is never retained as
|
|
139
|
+
// the cached value, which is the entire fix.
|
|
140
|
+
this.failures += 1;
|
|
141
|
+
this.lastFailure = describeFailure(error);
|
|
142
|
+
throw error;
|
|
143
|
+
})
|
|
144
|
+
.finally(() => {
|
|
145
|
+
// Guarded: a slower failed request must not clear a newer in-flight
|
|
146
|
+
// one that a later caller has already started.
|
|
147
|
+
if (this.inFlight === request)
|
|
148
|
+
this.inFlight = undefined;
|
|
149
|
+
});
|
|
150
|
+
this.inFlight = request;
|
|
151
|
+
return request;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Adopt a value the caller already has, without a request.
|
|
155
|
+
*
|
|
156
|
+
* A revision supplied at construction is as good as one discovered, and the
|
|
157
|
+
* state should say `cached` rather than pretending nothing is known.
|
|
158
|
+
*/
|
|
159
|
+
seed(value) {
|
|
160
|
+
this.cached = value;
|
|
161
|
+
this.failures = 0;
|
|
162
|
+
this.lastFailure = undefined;
|
|
163
|
+
this.lastSuccessAt = new Date().toISOString();
|
|
164
|
+
}
|
|
165
|
+
/** Forget everything, including a successful value. */
|
|
166
|
+
reset() {
|
|
167
|
+
this.cached = undefined;
|
|
168
|
+
this.inFlight = undefined;
|
|
169
|
+
this.failures = 0;
|
|
170
|
+
this.lastFailure = undefined;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Exponential backoff with a cap and jitter.
|
|
175
|
+
*
|
|
176
|
+
* The jitter is **partial**, not full: a delay is drawn uniformly from the
|
|
177
|
+
* upper half of its ceiling, `[ceiling / 2, ceiling)`. Full jitter — `[0,
|
|
178
|
+
* ceiling)` — would let the fifth consecutive failure sleep for less than the
|
|
179
|
+
* first, which makes "increasing after consecutive failures" untrue and
|
|
180
|
+
* untestable. Partial jitter keeps both properties: every delay is strictly
|
|
181
|
+
* larger than every delay possible at a lower failure count, and two clients
|
|
182
|
+
* failing together still separate, because they draw independently.
|
|
183
|
+
*
|
|
184
|
+
* The previous behaviour was a flat one-second retry, forever. That is
|
|
185
|
+
* neither bounded in aggregate nor jittered, so a managed service coming back
|
|
186
|
+
* after an outage was met by every client it had ever served, in lockstep.
|
|
187
|
+
*/
|
|
188
|
+
export class BoundedBackoff {
|
|
189
|
+
base;
|
|
190
|
+
max;
|
|
191
|
+
factor;
|
|
192
|
+
random;
|
|
193
|
+
consecutive = 0;
|
|
194
|
+
constructor(options = {}) {
|
|
195
|
+
this.base = Math.max(1, options.base ?? 500);
|
|
196
|
+
this.max = Math.max(this.base, options.max ?? 30_000);
|
|
197
|
+
this.factor = Math.max(1, options.factor ?? 2);
|
|
198
|
+
this.random = options.random ?? Math.random;
|
|
199
|
+
}
|
|
200
|
+
/** How many consecutive failures have been recorded. */
|
|
201
|
+
get attempts() {
|
|
202
|
+
return this.consecutive;
|
|
203
|
+
}
|
|
204
|
+
/** The ceiling this many consecutive failures in, capped. */
|
|
205
|
+
ceiling(attempt = this.consecutive) {
|
|
206
|
+
return Math.min(this.max, Math.round(this.base * this.factor ** attempt));
|
|
207
|
+
}
|
|
208
|
+
/** Draw the next delay and count the failure that caused it. */
|
|
209
|
+
next() {
|
|
210
|
+
const ceiling = this.ceiling();
|
|
211
|
+
this.consecutive += 1;
|
|
212
|
+
const floor = ceiling / 2;
|
|
213
|
+
return Math.round(floor + this.random() * floor);
|
|
214
|
+
}
|
|
215
|
+
/** A connection that stayed up long enough to count returns us to base. */
|
|
216
|
+
reset() {
|
|
217
|
+
this.consecutive = 0;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Sleep, unless the signal aborts first.
|
|
222
|
+
*
|
|
223
|
+
* Two properties matter and both were missing: the timer must not hold a Node
|
|
224
|
+
* process open on its own, and the abort listener must be removed when the
|
|
225
|
+
* timer fires normally. Without the second, a long-lived subscription
|
|
226
|
+
* accumulates one listener per reconnect attempt, which is a leak that only
|
|
227
|
+
* shows up on the clients that have been running longest.
|
|
228
|
+
*/
|
|
229
|
+
export function cancellableDelay(ms, signal) {
|
|
230
|
+
if (signal.aborted)
|
|
231
|
+
return Promise.resolve();
|
|
232
|
+
return new Promise(resolve => {
|
|
233
|
+
const done = () => {
|
|
234
|
+
clearTimeout(timer);
|
|
235
|
+
signal.removeEventListener('abort', done);
|
|
236
|
+
resolve();
|
|
237
|
+
};
|
|
238
|
+
const timer = setTimeout(done, ms);
|
|
239
|
+
timer.unref?.();
|
|
240
|
+
signal.addEventListener('abort', done, { once: true });
|
|
241
|
+
});
|
|
242
|
+
}
|
package/dist/memory-db.js
CHANGED
|
@@ -56,7 +56,7 @@ export class MemoryJsDb {
|
|
|
56
56
|
if (plan.kind === 'duplicate')
|
|
57
57
|
return embeddedResult(request, true, before, this.sequence);
|
|
58
58
|
if (plan.kind === 'reject')
|
|
59
|
-
throw new EmbeddedTransactionRejected(plan.reason);
|
|
59
|
+
throw new EmbeddedTransactionRejected(plan.reason, plan.failure);
|
|
60
60
|
for (const mutation of plan.mutations) {
|
|
61
61
|
if (mutation.value === undefined) {
|
|
62
62
|
this.rows.delete(mutation.key);
|
|
@@ -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-ClhDHp0S.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-CNVpvaZV.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};
|
|
Binary file
|