@feltdb/core 0.11.2 → 0.11.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.
Files changed (50) hide show
  1. package/README.md +8 -6
  2. package/dist/collection.d.ts +11 -1
  3. package/dist/collection.d.ts.map +1 -1
  4. package/dist/collection.js +34 -5
  5. package/dist/create/package-versions.js +1 -1
  6. package/dist/create/server-source/crates/feltdb/src/lib.rs +31 -30
  7. package/dist/create/server-source/crates/feltdb/src/semantic_decision.rs +1917 -0
  8. package/dist/create/server-source/crates/feltdb/tests/semantic_decision.rs +1165 -0
  9. package/dist/create/server-source/crates/feltdb-server/src/main.rs +232 -95
  10. package/dist/create/server-source/crates/feltdb-wasm/src/lib.rs +73 -8
  11. package/dist/db.d.ts +10 -5
  12. package/dist/db.d.ts.map +1 -1
  13. package/dist/db.js +22 -6
  14. package/dist/embedded-query.d.ts +43 -0
  15. package/dist/embedded-query.d.ts.map +1 -0
  16. package/dist/embedded-query.js +327 -0
  17. package/dist/feltdb.d.ts +5 -1
  18. package/dist/feltdb.d.ts.map +1 -1
  19. package/dist/file-db.d.ts +8 -0
  20. package/dist/file-db.d.ts.map +1 -1
  21. package/dist/file-db.js +24 -0
  22. package/dist/http-db.d.ts +15 -0
  23. package/dist/http-db.d.ts.map +1 -1
  24. package/dist/http-db.js +3 -0
  25. package/dist/index-core.d.ts +2 -0
  26. package/dist/index-core.d.ts.map +1 -1
  27. package/dist/index-core.js +1 -0
  28. package/dist/index-types.d.ts +5 -1
  29. package/dist/index-types.d.ts.map +1 -1
  30. package/dist/indexeddb-db.d.ts +18 -0
  31. package/dist/indexeddb-db.d.ts.map +1 -1
  32. package/dist/indexeddb-db.js +28 -0
  33. package/dist/memory-db.d.ts +8 -0
  34. package/dist/memory-db.d.ts.map +1 -1
  35. package/dist/memory-db.js +19 -0
  36. package/dist/semantic-decision.d.ts +167 -0
  37. package/dist/semantic-decision.d.ts.map +1 -0
  38. package/dist/semantic-decision.js +1 -0
  39. package/dist/studio-app/assets/feltdb_wasm-BGgGSBOP.js +1 -0
  40. package/dist/studio-app/assets/feltdb_wasm_bg-ClM6Qpod.wasm +0 -0
  41. package/dist/studio-app/assets/index-ptUom553.js +30 -0
  42. package/dist/studio-app/index.html +1 -1
  43. package/dist/wasm/feltdb_wasm.d.ts +20 -0
  44. package/dist/wasm/feltdb_wasm.js +91 -0
  45. package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
  46. package/dist/wasm/feltdb_wasm_bg.wasm.d.ts +4 -0
  47. package/package.json +2 -2
  48. package/dist/studio-app/assets/feltdb_wasm-Dlr_kLlk.js +0 -1
  49. package/dist/studio-app/assets/feltdb_wasm_bg-CkozAQKb.wasm +0 -0
  50. package/dist/studio-app/assets/index-H_L5pjur.js +0 -30
@@ -1 +1 @@
1
- {"version":3,"file":"indexeddb-db.d.ts","sourceRoot":"","sources":["../src/indexeddb-db.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAA8B,KAAK,mBAAmB,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrG,OAAO,KAAK,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAQ1F,UAAU,QAAQ;IAAG,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE;AACtE,UAAU,YAAY;IAAG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,KAAK,GAAG,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE;AACrK,KAAK,cAAc,G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;IAKrB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,IAAI;IAoB5E,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAQnC;IAEF,OAAO,CAAC,yBAAyB;IASjC,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,yBAAyB;IAUjC,OAAO,CAAC,qBAAqB;YAQf,sBAAsB;YAwBtB,oBAAoB;YASpB,WAAW;IAyBzB,OAAO,CAAC,qBAAqB;IAc7B,KAAK,IAAI,IAAI;IAMb,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAC7D,UAAU,IAAI,QAAQ;IACtB,SAAS,IAAI,QAAQ;IACrB,QAAQ,IAAI,QAAQ;IACpB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ;IACvC,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ;IAC1C,oBAAoB,IAAI,QAAQ;IAChC,2BAA2B,IAAI,QAAQ;IACvC,WAAW,IAAI,MAAM;IACrB,YAAY,IAAI,MAAM;IAEtB;;;;;;;;;;;OAWG;IACH,SAAS,IAAI,mBAAmB;IAiBhC;;;;;;OAMG;IACG,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;IAS7B,YAAY,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IACvC,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IACjE,uBAAuB,CAAC,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAwBzG"}
@@ -1,5 +1,6 @@
1
1
  import { FreshnessContractViolation } from './freshness.js';
2
2
  import { decideTransaction, embeddedResult, EmbeddedTransactionRejected, } from './embedded-transaction.js';
3
+ import { EmbeddedQueryEngine } from './embedded-query.js';
3
4
  /** Durable browser runtime. Every mutation resolves only after its IndexedDB transaction commits. */
4
5
  export class IndexedDbJsDb {
5
6
  database;
@@ -305,6 +306,33 @@ export class IndexedDbJsDb {
305
306
  return { success: false, error: String(error) };
306
307
  }
307
308
  }
309
+ /**
310
+ * Browser bounded-query fallback. IndexedDB schema indexes are static, so a
311
+ * dynamically declared FeltDB index is not claimed here until it has a
312
+ * durable object-store representation. The fallback stays correct and its
313
+ * plan truthfully reports a full scan.
314
+ */
315
+ async authority_query(query) {
316
+ const db = await this.database;
317
+ const rows = await new Promise((resolve, reject) => {
318
+ const request = db.transaction('rows').objectStore('rows').openCursor();
319
+ const output = [];
320
+ request.onsuccess = () => {
321
+ const cursor = request.result;
322
+ if (!cursor)
323
+ return resolve(output);
324
+ if (String(cursor.key).startsWith(`${query.collection}:`))
325
+ output.push([String(cursor.key), cursor.value]);
326
+ cursor.continue();
327
+ };
328
+ request.onerror = () => reject(request.error);
329
+ });
330
+ return new EmbeddedQueryEngine(() => rows).execute(query);
331
+ }
332
+ explain_query(query) {
333
+ return { plan: 'full-scan', reason: 'no compatible durable IndexedDB index', order: [...(query.orderBy ?? []).map(value => `${value.field} ${value.direction.toUpperCase()}`), 'id ASC'].join(', '), limit: query.limit, cursor: Boolean(query.cursor) };
334
+ }
335
+ rebuild_indexes() { }
308
336
  async request(storeName, create) {
309
337
  const db = await this.database;
310
338
  return new Promise((resolve, reject) => { const request = create(db.transaction(storeName).objectStore(storeName)); request.onsuccess = () => resolve(request.result); request.onerror = () => reject(request.error); });
@@ -1,6 +1,7 @@
1
1
  import type { JsDb } from './feltdb.js';
2
2
  import { type FreshnessCapability, type Revision } from './freshness.js';
3
3
  import type { AtomicTransactionRequest, AtomicTransactionResult } from './transaction.js';
4
+ import type { AuthorityQueryRequest } from './http-db.js';
4
5
  interface JsResult {
5
6
  success: boolean;
6
7
  data?: string;
@@ -25,6 +26,8 @@ export declare class MemoryJsDb implements JsDb {
25
26
  private readonly revisionState;
26
27
  private readonly peers;
27
28
  private readonly applied;
29
+ private readonly queryEngine;
30
+ private indexedRevision;
28
31
  constructor(namespace: string);
29
32
  private event;
30
33
  /**
@@ -59,6 +62,11 @@ export declare class MemoryJsDb implements JsDb {
59
62
  item?: any;
60
63
  }>;
61
64
  query(capability: string): JsResult;
65
+ authority_query<T = Record<string, unknown>>(query: AuthorityQueryRequest): Promise<import("./http-db.js").AuthorityQueryPage<T> & {
66
+ stats: import("./embedded-query.js").EmbeddedQueryStats;
67
+ }>;
68
+ explain_query(query: AuthorityQueryRequest): import("./embedded-query.js").EmbeddedQueryExplanation;
69
+ rebuild_indexes(): void;
62
70
  get_capability_records(capability: string): JsResult;
63
71
  execute_op(): JsResult;
64
72
  sync_info(): JsResult;
@@ -1 +1 @@
1
- {"version":3,"file":"memory-db.d.ts","sourceRoot":"","sources":["../src/memory-db.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAA8B,KAAK,mBAAmB,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrG,OAAO,KAAK,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAO1F,UAAU,QAAQ;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,aAAa;IAAG,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,KAAK,GAAG,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE;AA6BrK,mEAAmE;AACnE,qBAAa,UAAW,YAAW,IAAI;IACrC,OAAO,CAAC,QAAQ,CA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E,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAiCtL,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ;IAQ7B,eAAe,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,qBAAqB;;;IAQ/E,aAAa,CAAC,KAAK,EAAE,qBAAqB;IAC1C,eAAe,IAAI,IAAI;IAEvB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ;IAIpD,UAAU,IAAI,QAAQ;IAItB,SAAS,IAAI,QAAQ;IAIrB,QAAQ,IAAI,QAAQ;IACpB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ;IACvC,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ;IAC1C,2BAA2B,IAAI,QAAQ;IACvC,oBAAoB,IAAI,QAAQ;IAChC,WAAW,IAAI,MAAM;IACrB,YAAY,IAAI,MAAM;IAEtB;;;;;;;OAOG;IACH,SAAS,IAAI,mBAAmB;IAiB1B,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;IAQnC,YAAY;IACZ,iBAAiB,CAAC,aAAa,EAAE,MAAM;IACvC,uBAAuB,CAAC,UAAU,EAAE,aAAa,EAAE;;;;CAyBpD"}
package/dist/memory-db.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { FreshnessContractViolation } from './freshness.js';
2
2
  import { decideTransaction, embeddedResult, EmbeddedTransactionRejected, } from './embedded-transaction.js';
3
+ import { EmbeddedQueryEngine } from './embedded-query.js';
3
4
  const namespaces = new Map();
4
5
  const revisions = new Map();
5
6
  function namespaceRevision(namespace) {
@@ -19,6 +20,8 @@ export class MemoryJsDb {
19
20
  revisionState;
20
21
  peers = new Set();
21
22
  applied = new Set();
23
+ queryEngine;
24
+ indexedRevision;
22
25
  constructor(namespace) {
23
26
  let rows = namespaces.get(namespace);
24
27
  if (!rows) {
@@ -28,12 +31,16 @@ export class MemoryJsDb {
28
31
  this.rows = rows;
29
32
  this.revisionState = namespaceRevision(namespace);
30
33
  this.origin = `memory:${namespace}`;
34
+ this.queryEngine = new EmbeddedQueryEngine(() => this.rows.entries());
35
+ this.indexedRevision = this.revisionState.value;
31
36
  }
32
37
  event(collection, key, type, value) {
33
38
  this.sequence += 1;
34
39
  this.revisionState.value += 1;
35
40
  const timestamp = Date.now();
36
41
  this.events.push({ sequence: this.sequence, collection, key, type, value, timestamp, origin: this.origin, id: `${this.origin}:${timestamp}:${this.sequence}` });
42
+ this.queryEngine.apply(key, type === 'put' ? this.rows.get(key) : undefined);
43
+ this.indexedRevision = this.revisionState.value;
37
44
  }
38
45
  /**
39
46
  * Commit several operations atomically.
@@ -146,6 +153,15 @@ export class MemoryJsDb {
146
153
  .map(([, value]) => value);
147
154
  return { success: true, data: JSON.stringify(values) };
148
155
  }
156
+ async authority_query(query) {
157
+ if (this.indexedRevision !== this.revisionState.value) {
158
+ this.queryEngine.rebuild();
159
+ this.indexedRevision = this.revisionState.value;
160
+ }
161
+ return this.queryEngine.execute(query);
162
+ }
163
+ explain_query(query) { return this.queryEngine.explain(query); }
164
+ rebuild_indexes() { this.queryEngine.rebuild(); this.indexedRevision = this.revisionState.value; }
149
165
  get_capability_records(capability) {
150
166
  return this.query(capability);
151
167
  }
@@ -219,6 +235,9 @@ export class MemoryJsDb {
219
235
  this.rows.delete(operation.key);
220
236
  else
221
237
  this.rows.set(operation.key, operation.value);
238
+ this.queryEngine.apply(operation.key, operation.type === 'delete' ? undefined : operation.value);
239
+ this.revisionState.value += 1;
240
+ this.indexedRevision = this.revisionState.value;
222
241
  applied++;
223
242
  }
224
243
  else
@@ -0,0 +1,167 @@
1
+ export interface DecisionRecordRef {
2
+ collection: string;
3
+ record_id: string;
4
+ }
5
+ export interface DecisionPrincipal {
6
+ subject: {
7
+ kind: 'human' | 'service' | 'workload' | 'agent' | 'connection' | 'worker';
8
+ id: string;
9
+ };
10
+ tenant_id: string;
11
+ application_id: string;
12
+ capability?: string;
13
+ }
14
+ export interface DecisionTransportAuthorization {
15
+ allowed_fields?: string[];
16
+ principal?: DecisionPrincipal;
17
+ }
18
+ export interface WeightedOption {
19
+ value: string;
20
+ probability: number;
21
+ }
22
+ export type DecisionDefinition = {
23
+ kind: 'binary';
24
+ predicate: string;
25
+ } | {
26
+ kind: 'choice';
27
+ question: string;
28
+ options: string[];
29
+ } | {
30
+ kind: 'score';
31
+ question: string;
32
+ levels: string[];
33
+ };
34
+ export type DecisionResult = {
35
+ kind: 'binary';
36
+ decision: boolean;
37
+ option_mass: number;
38
+ supporting_fields?: string[];
39
+ } | {
40
+ kind: 'choice';
41
+ selected: string;
42
+ options: WeightedOption[];
43
+ option_mass: number;
44
+ supporting_fields?: string[];
45
+ } | {
46
+ kind: 'score';
47
+ selected: string;
48
+ levels: WeightedOption[];
49
+ option_mass: number;
50
+ supporting_fields?: string[];
51
+ };
52
+ export interface DecisionRuntimeMetadata {
53
+ runtime: string;
54
+ model?: string;
55
+ model_revision?: string;
56
+ prompt_revision?: string;
57
+ execution_method?: DecisionExecutionMethod;
58
+ decision_schema_revision?: string;
59
+ }
60
+ export type DecisionExecutionMethod = 'logit' | 'structured' | 'generated' | 'head';
61
+ export interface DecisionRuntimeCapabilities {
62
+ binary: boolean;
63
+ choice: boolean;
64
+ score: boolean;
65
+ batch: boolean;
66
+ probability_distribution: boolean;
67
+ execution_methods: DecisionExecutionMethod[];
68
+ }
69
+ export interface DecisionRuntime {
70
+ metadata(): DecisionRuntimeMetadata;
71
+ capabilities(): DecisionRuntimeCapabilities;
72
+ execute(request: DecisionRequest): Promise<DecisionResult>;
73
+ executeBatch(batch: DecisionBatch): Promise<DecisionBatchEvaluation[]>;
74
+ }
75
+ export type DecisionRequest = {
76
+ kind: 'binary';
77
+ predicate: string;
78
+ context: Record<string, unknown>;
79
+ } | {
80
+ kind: 'choice';
81
+ question: string;
82
+ options: string[];
83
+ context: Record<string, unknown>;
84
+ } | {
85
+ kind: 'score';
86
+ question: string;
87
+ levels: string[];
88
+ context: Record<string, unknown>;
89
+ };
90
+ export type DecisionTransportRuntime = {
91
+ kind: 'deterministic';
92
+ metadata: DecisionRuntimeMetadata;
93
+ responses: Record<string, DecisionResult>;
94
+ } | {
95
+ kind: 'recording';
96
+ metadata: DecisionRuntimeMetadata;
97
+ result: DecisionResult;
98
+ };
99
+ export interface DecisionOptions {
100
+ fields?: string[];
101
+ application_id?: string;
102
+ decision_collection?: string;
103
+ schema_version?: string;
104
+ }
105
+ export interface DecisionEvidenceField {
106
+ field: string;
107
+ value: unknown;
108
+ }
109
+ export interface DecisionEvidence {
110
+ decision_id: string;
111
+ kind: 'binary' | 'choice' | 'score';
112
+ input: DecisionDefinition;
113
+ result: DecisionResult;
114
+ supporting_context: DecisionEvidenceField[];
115
+ runtime: DecisionRuntimeMetadata;
116
+ state: {
117
+ collection: string;
118
+ record_id: string;
119
+ record_version?: number;
120
+ reference: string;
121
+ relevant_state_version: string;
122
+ withheld_fields: string[];
123
+ };
124
+ }
125
+ export interface DecisionEvaluation {
126
+ result: DecisionResult;
127
+ cached: boolean;
128
+ evidence: DecisionEvidence[];
129
+ provenance: {
130
+ runtime: string;
131
+ model?: string;
132
+ model_revision?: string;
133
+ prompt_revision?: string;
134
+ context_hash: string;
135
+ relevant_state_version: string;
136
+ cache_key: string;
137
+ source: string;
138
+ evaluated_at: number;
139
+ served_at: number;
140
+ };
141
+ }
142
+ export interface DecisionTransportExecutionRequest {
143
+ target?: DecisionRecordRef;
144
+ context?: Record<string, unknown>;
145
+ definition: DecisionDefinition;
146
+ options?: DecisionOptions;
147
+ authorization?: DecisionTransportAuthorization;
148
+ runtime: DecisionTransportRuntime;
149
+ }
150
+ export interface DecisionTransportExecutionResponse {
151
+ evaluation: DecisionEvaluation;
152
+ runtime_requests: DecisionRequest[];
153
+ }
154
+ export interface DecisionBatchDecision {
155
+ id: string;
156
+ definition: DecisionDefinition;
157
+ context?: Record<string, unknown>;
158
+ }
159
+ export interface DecisionBatch {
160
+ context?: Record<string, unknown>;
161
+ decisions: DecisionBatchDecision[];
162
+ }
163
+ export interface DecisionBatchEvaluation {
164
+ id: string;
165
+ result: DecisionResult;
166
+ }
167
+ //# sourceMappingURL=semantic-decision.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semantic-decision.d.ts","sourceRoot":"","sources":["../src/semantic-decision.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE;QAAE,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,GAAG,QAAQ,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACpG,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,8BAA8B;IAC7C,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE1D,MAAM,MAAM,cAAc,GACtB;IAAE,IAA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Ae,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,kBAAkB,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,SAAS,EAAE,qBAAqB,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,cAAc,CAAC;CACxB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ var e=class e{static __wrap(t){let n=Object.create(e.prototype);return n.__wbg_ptr=t,O.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,O.unregister(this),e}free(){let e=this.__destroy_into_raw();K.__wbg_jsdb_free(e,0)}acknowledge_peer_operations(e,n){let r=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),i=G,a=K.jsdb_acknowledge_peer_operations(this.__wbg_ptr,r,i,n);return t.__wrap(a)}add_sync_peer(e){let n=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),r=G,i=K.jsdb_add_sync_peer(this.__wbg_ptr,n,r);return t.__wrap(i)}delete(e){let n=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),r=G,i=K.jsdb_delete(this.__wbg_ptr,n,r);return t.__wrap(i)}execute_canonical_query(e,n,r,i){let a=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=R(n,K.__wbindgen_malloc,K.__wbindgen_realloc),c=G,l=R(r,K.__wbindgen_malloc,K.__wbindgen_realloc),u=G,d=R(i,K.__wbindgen_malloc,K.__wbindgen_realloc),f=G,p=K.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=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),i=G,a=R(n,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=K.jsdb_execute_canonical_transaction(this.__wbg_ptr,r,i,a,o);return t.__wrap(s)}execute_semantic_decision(e){let n=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),r=G,i=K.jsdb_execute_semantic_decision(this.__wbg_ptr,n,r);return t.__wrap(i)}get(e){let n=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),r=G,i=K.jsdb_get(this.__wbg_ptr,n,r);return t.__wrap(i)}get_capability_records(e){let n=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),r=G,i=K.jsdb_get_capability_records(this.__wbg_ptr,n,r);return t.__wrap(i)}get_pending_for_peer(e,n){let r=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),i=G,a=K.jsdb_get_pending_for_peer(this.__wbg_ptr,r,i,n);return t.__wrap(a)}get_sequence(){let e=K.jsdb_get_sequence(this.__wbg_ptr);return BigInt.asUintN(64,e)}insert(e,n){let r=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),i=G,a=R(n,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=K.jsdb_insert(this.__wbg_ptr,r,i,a,o);return t.__wrap(s)}instance_id(){let e,t;try{let n=K.jsdb_instance_id(this.__wbg_ptr);return e=n[0],t=n[1],P(n[0],n[1])}finally{K.__wbindgen_free(e,t,1)}}is_auto_indexed(){return K.jsdb_is_auto_indexed(this.__wbg_ptr)!==0}query(e){let n=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),r=G,i=K.jsdb_query(this.__wbg_ptr,n,r);return t.__wrap(i)}remove_sync_peer(e){let n=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),r=G,i=K.jsdb_remove_sync_peer(this.__wbg_ptr,n,r);return t.__wrap(i)}sync_info(){let e=K.jsdb_sync_info(this.__wbg_ptr);return t.__wrap(e)}update(e,n){let r=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),i=G,a=R(n,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=K.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,k.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,k.unregister(this),e}free(){let e=this.__destroy_into_raw();K.__wbg_jsresult_free(e,0)}get data(){let e=K.jsresult_data(this.__wbg_ptr),t;return e[0]!==0&&(t=P(e[0],e[1]),K.__wbindgen_free(e[0],e[1]*1,1)),t}get error(){let e=K.jsresult_error(this.__wbg_ptr),t;return e[0]!==0&&(t=P(e[0],e[1]),K.__wbindgen_free(e[0],e[1]*1,1)),t}get success(){return K.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,A.unregister(this),e}free(){let e=this.__destroy_into_raw();K.__wbg_wasmanalytics_free(e,0)}generate_report(e,t){let n,r;try{let o=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),s=G,c=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),l=G,u=K.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,z(u[2]);return n=i,r=a,P(i,a)}finally{K.__wbindgen_free(n,r,1)}}get_all_metrics(){let e,t;try{let i=K.wasmanalytics_get_all_metrics(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,z(i[2]);return e=n,t=r,P(n,r)}finally{K.__wbindgen_free(e,t,1)}}get_frequent_fields(e){let t,n;try{let a=K.wasmanalytics_get_frequent_fields(this.__wbg_ptr,e);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,z(a[2]);return t=r,n=i,P(r,i)}finally{K.__wbindgen_free(t,n,1)}}get_index_metrics(e){let t,n;try{let a=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=K.wasmanalytics_get_index_metrics(this.__wbg_ptr,a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,z(s[2]);return t=r,n=i,P(r,i)}finally{K.__wbindgen_free(t,n,1)}}get_slowest_queries(e){let t,n;try{let a=K.wasmanalytics_get_slowest_queries(this.__wbg_ptr,e);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,z(a[2]);return t=r,n=i,P(r,i)}finally{K.__wbindgen_free(t,n,1)}}constructor(){let e=K.wasmanalytics_new();return this.__wbg_ptr=e,A.register(this,this.__wbg_ptr,this),this}record_index_usage(e,t,n){let r=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),i=G,a=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G;K.wasmanalytics_record_index_usage(this.__wbg_ptr,r,i,a,o,n)}record_query(e,t,n,r,i,a){let o=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),s=G,c=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),l=G;var u=L(a)?0:R(a,K.__wbindgen_malloc,K.__wbindgen_realloc),d=G;let f=K.wasmanalytics_record_query(this.__wbg_ptr,o,s,c,l,n,r,i,u,d);if(f[1])throw z(f[0])}reset(){K.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,j.unregister(this),e}free(){let e=this.__destroy_into_raw();K.__wbg_wasmdistributedindexmanager_free(e,0)}create_replicated_index(e,t,n){let r=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),i=G,a=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=R(n,K.__wbindgen_malloc,K.__wbindgen_realloc),c=G,l=K.wasmdistributedindexmanager_create_replicated_index(this.__wbg_ptr,r,i,a,o,s,c);if(l[1])throw z(l[0])}detect_conflicts(e){let t,n;try{let a=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=K.wasmdistributedindexmanager_detect_conflicts(this.__wbg_ptr,a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,z(s[2]);return t=r,n=i,P(r,i)}finally{K.__wbindgen_free(t,n,1)}}get_replication_status(e){let t,n;try{let a=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=K.wasmdistributedindexmanager_get_replication_status(this.__wbg_ptr,a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,z(s[2]);return t=r,n=i,P(r,i)}finally{K.__wbindgen_free(t,n,1)}}get_replication_targets(e){let t,n;try{let a=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=K.wasmdistributedindexmanager_get_replication_targets(this.__wbg_ptr,a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,z(s[2]);return t=r,n=i,P(r,i)}finally{K.__wbindgen_free(t,n,1)}}get_sync_status(){let e,t;try{let i=K.wasmdistributedindexmanager_get_sync_status(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,z(i[2]);return e=n,t=r,P(n,r)}finally{K.__wbindgen_free(e,t,1)}}merge_versions(e){let t=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),n=G,r=K.wasmdistributedindexmanager_merge_versions(this.__wbg_ptr,t,n);if(r[1])throw z(r[0])}constructor(e){let t=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),n=G,r=K.wasmdistributedindexmanager_new(t,n);return this.__wbg_ptr=r,j.register(this,this.__wbg_ptr,this),this}register_peer(e){let t=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),n=G;K.wasmdistributedindexmanager_register_peer(this.__wbg_ptr,t,n)}set_peer_reachable(e,t){let n=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),r=G;K.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,M.unregister(this),e}free(){let e=this.__destroy_into_raw();K.__wbg_wasmindexmanager_free(e,0)}create_index(e){let t=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),n=G,r=K.wasmindexmanager_create_index(this.__wbg_ptr,t,n);if(r[1])throw z(r[0])}get_stats(e){let t,n;try{let a=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=K.wasmindexmanager_get_stats(this.__wbg_ptr,a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,z(s[2]);return t=r,n=i,P(r,i)}finally{K.__wbindgen_free(t,n,1)}}list_indexes(){let e,t;try{let i=K.wasmindexmanager_list_indexes(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,z(i[2]);return e=n,t=r,P(n,r)}finally{K.__wbindgen_free(e,t,1)}}constructor(){let e=K.wasmindexmanager_new();return this.__wbg_ptr=e,M.register(this,this.__wbg_ptr,this),this}query_index(e,t,n){let r,i;try{let s=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),c=G,l=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),u=G,d=R(n,K.__wbindgen_malloc,K.__wbindgen_realloc),f=G,p=K.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,z(p[2]);return r=a,i=o,P(a,o)}finally{K.__wbindgen_free(r,i,1)}}update_record(e,t,n){let r=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),i=G;var a=L(t)?0:R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G;let s=R(n,K.__wbindgen_malloc,K.__wbindgen_realloc),c=G,l=K.wasmindexmanager_update_record(this.__wbg_ptr,r,i,a,o,s,c);if(l[1])throw z(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,N.unregister(this),e}free(){let e=this.__destroy_into_raw();K.__wbg_wasmshardmanager_free(e,0)}detect_hotspots(){let e,t;try{let i=K.wasmshardmanager_detect_hotspots(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,z(i[2]);return e=n,t=r,P(n,r)}finally{K.__wbindgen_free(e,t,1)}}generate_rebalance_ops(){let e,t;try{let i=K.wasmshardmanager_generate_rebalance_ops(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,z(i[2]);return e=n,t=r,P(n,r)}finally{K.__wbindgen_free(e,t,1)}}get_all_metrics(){let e,t;try{let i=K.wasmshardmanager_get_all_metrics(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,z(i[2]);return e=n,t=r,P(n,r)}finally{K.__wbindgen_free(e,t,1)}}get_distribution_summary(){let e,t;try{let i=K.wasmshardmanager_get_distribution_summary(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,z(i[2]);return e=n,t=r,P(n,r)}finally{K.__wbindgen_free(e,t,1)}}get_shard_for_key(e){let t,n;try{let a=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=K.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,z(s[2]);return t=r,n=i,P(r,i)}finally{K.__wbindgen_free(t,n,1)}}initialize_shards(e){let t=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),n=G,r=K.wasmshardmanager_initialize_shards(this.__wbg_ptr,t,n);if(r[1])throw z(r[0])}constructor(e,t){let n=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),r=G,i=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),a=G,o=K.wasmshardmanager_new(n,r,i,a);return this.__wbg_ptr=o,N.register(this,this.__wbg_ptr,this),this}record_shard_operation(e,t,n,r,i){let a=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),c=G;K.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=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),s=G,c=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),l=G,u=K.apply_sync_result(o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,z(u[2]);return n=i,r=a,P(i,a)}finally{K.__wbindgen_free(n,r,1)}}function s(e,t,n,r,i,a){let o,s;try{let u=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),d=G,f=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),p=G,m=R(n,K.__wbindgen_malloc,K.__wbindgen_realloc),h=G,g=R(r,K.__wbindgen_malloc,K.__wbindgen_realloc),_=G,v=R(i,K.__wbindgen_malloc,K.__wbindgen_realloc),y=G,b=R(a,K.__wbindgen_malloc,K.__wbindgen_realloc),x=G,S=K.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,z(S[2]);return o=c,s=l,P(c,l)}finally{K.__wbindgen_free(o,s,1)}}function c(e){let t,n;try{let a=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=K.canonical_bundle_hash(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,z(s[2]);return t=r,n=i,P(r,i)}finally{K.__wbindgen_free(t,n,1)}}function l(e){let t,n;try{let a=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=K.canonicalize_application_manifest(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,z(s[2]);return t=r,n=i,P(r,i)}finally{K.__wbindgen_free(t,n,1)}}function u(e,t){let n,r;try{let o=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),s=G,c=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),l=G,u=K.compare_state_schemas(o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,z(u[2]);return n=i,r=a,P(i,a)}finally{K.__wbindgen_free(n,r,1)}}function d(e,t){let n,r;try{var i=L(e)?0:R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),a=G;let c=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),l=G,u=K.diff_application_revisions(i,a,c,l);var o=u[0],s=u[1];if(u[3])throw o=0,s=0,z(u[2]);return n=o,r=s,P(o,s)}finally{K.__wbindgen_free(n,r,1)}}function f(e){let t,n;try{let a=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=K.execute_semantic_decision(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,z(s[2]);return t=r,n=i,P(r,i)}finally{K.__wbindgen_free(t,n,1)}}function p(e){let t,n;try{let a=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=K.hash_application_manifest(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,z(s[2]);return t=r,n=i,P(r,i)}finally{K.__wbindgen_free(t,n,1)}}function m(e,t){let n,r;try{let o=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),s=G,c=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),l=G,u=K.hash_application_runtime(o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,z(u[2]);return n=i,r=a,P(i,a)}finally{K.__wbindgen_free(n,r,1)}}function h(e){let t,n;try{let a=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=K.hash_state_schema(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,z(s[2]);return t=r,n=i,P(r,i)}finally{K.__wbindgen_free(t,n,1)}}function g(t){let n=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),r=G,i=K.open(n,r);if(i[2])throw z(i[1]);return e.__wrap(i[0])}function _(e,t){let n,r;try{let o=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),s=G,c=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),l=G,u=K.resolve_application_runtime(o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,z(u[2]);return n=i,r=a,P(i,a)}finally{K.__wbindgen_free(n,r,1)}}function v(e,t,n,r){let i=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),a=G,o=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),s=G,c=R(n,K.__wbindgen_malloc,K.__wbindgen_realloc),l=G,u=K.validate_mesh_claim(i,a,o,s,c,l,r);if(u[1])throw z(u[0])}function y(e){let t,n;try{let a=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=K.validate_semantic_decision_definition(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,z(s[2]);return t=r,n=i,P(r,i)}finally{K.__wbindgen_free(t,n,1)}}function b(e,t){let n,r;try{let o=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),s=G,c=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),l=G,u=K.validate_semantic_decision_result(o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,z(u[2]);return n=i,r=a,P(i,a)}finally{K.__wbindgen_free(n,r,1)}}function x(e){let t,n;try{let a=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=K.validate_state_schema(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,z(s[2]);return t=r,n=i,P(r,i)}finally{K.__wbindgen_free(t,n,1)}}function S(e){let t,n;try{let a=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),o=G,s=K.validate_sync_operation(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,z(s[2]);return t=r,n=i,P(r,i)}finally{K.__wbindgen_free(t,n,1)}}function C(e,t){let n=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),r=G,i=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),a=G,o=K.validate_worker_transition(n,r,i,a);if(o[2])throw z(o[1]);return o[0]!==0}function w(e,t){let n=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),r=G,i=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),a=G,o=K.validate_workload_transition(n,r,i,a);if(o[2])throw z(o[1]);return o[0]!==0}function T(e){let t=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),n=G,r=K.verify_bundle_integrity(t,n);if(r[2])throw z(r[1]);return r[0]!==0}function E(e,t,n,r,i,a){let o,s;try{let u=R(e,K.__wbindgen_malloc,K.__wbindgen_realloc),d=G,f=R(t,K.__wbindgen_malloc,K.__wbindgen_realloc),p=G,m=R(n,K.__wbindgen_malloc,K.__wbindgen_realloc),h=G,g=R(r,K.__wbindgen_malloc,K.__wbindgen_realloc),_=G,v=R(i,K.__wbindgen_malloc,K.__wbindgen_realloc),y=G,b=R(a,K.__wbindgen_malloc,K.__wbindgen_realloc),x=G,S=K.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,z(S[2]);return o=c,s=l,P(c,l)}finally{K.__wbindgen_free(o,s,1)}}function D(){return{__proto__:null,"./feltdb_wasm_bg.js":{__proto__:null,__wbg___wbindgen_throw_bb96b2010945f0bc:function(e,t){throw Error(P(e,t))},__wbindgen_cast_0000000000000001:function(e,t){return P(e,t)},__wbindgen_init_externref_table:function(){let e=K.__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 O=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>K.__wbg_jsdb_free(e,1)),k=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>K.__wbg_jsresult_free(e,1)),A=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>K.__wbg_wasmanalytics_free(e,1)),j=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>K.__wbg_wasmdistributedindexmanager_free(e,1)),M=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>K.__wbg_wasmindexmanager_free(e,1)),N=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>K.__wbg_wasmshardmanager_free(e,1));function P(e,t){return U(e>>>0,t)}var F=null;function I(){return(F===null||F.byteLength===0)&&(F=new Uint8Array(K.memory.buffer)),F}function L(e){return e==null}function R(e,t,n){if(n===void 0){let n=W.encode(e),r=t(n.length,1)>>>0;return I().subarray(r,r+n.length).set(n),G=n.length,r}let r=e.length,i=t(r,1)>>>0,a=I(),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=I().subarray(i+o,i+r),a=W.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return G=o,i}function z(e){let t=K.__wbindgen_externrefs.get(e);return K.__externref_table_dealloc(e),t}var B=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});B.decode();var V=2146435072,H=0;function U(e,t){return H+=t,H>=V&&(B=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),B.decode(),H=t),B.decode(I().subarray(e,e+t))}var W=new TextEncoder;`encodeInto`in W||(W.encodeInto=function(e,t){let n=W.encode(e);return t.set(n),{read:e.length,written:n.length}});var G=0,K;function q(e,t){return K=e.exports,F=null,K.__wbindgen_start(),K}async function J(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 Y(e){if(K!==void 0)return K;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=D();return e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e)),q(new WebAssembly.Instance(e,t),e)}async function X(e){if(K!==void 0)return K;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-ClM6Qpod.wasm`,``+import.meta.url));let t=D();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await J(await e,t);return q(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,X as default,d as diff_application_revisions,f as execute_semantic_decision,p as hash_application_manifest,m as hash_application_runtime,h as hash_state_schema,Y as initSync,g as open,_ as resolve_application_runtime,v as validate_mesh_claim,y as validate_semantic_decision_definition,b as validate_semantic_decision_result,x as validate_state_schema,S as validate_sync_operation,C as validate_worker_transition,w as validate_workload_transition,T as verify_bundle_integrity,E as verify_signed_grant};