@feltdb/core 0.4.20 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +179 -0
- package/dist/cli/index.js +1 -1
- package/dist/collection.d.ts +45 -0
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +83 -1
- package/dist/create/package-versions.js +1 -1
- package/dist/create/server-source/Cargo.lock +12 -0
- package/dist/create/server-source/crates/feltdb/src/application.rs +183 -8
- package/dist/create/server-source/crates/feltdb-server/Cargo.toml +1 -0
- package/dist/create/server-source/crates/feltdb-server/src/lib.rs +2 -0
- package/dist/create/server-source/crates/feltdb-server/src/main.rs +206 -45
- package/dist/create/server-source/crates/feltdb-server/src/request_telemetry.rs +381 -0
- package/dist/create/server-source/crates/feltdb-server/src/transaction_idempotency.rs +280 -0
- package/dist/error-codes.d.ts +53 -0
- package/dist/error-codes.d.ts.map +1 -0
- package/dist/error-codes.js +46 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/memory-db.d.ts +12 -0
- package/dist/memory-db.d.ts.map +1 -1
- package/dist/memory-db.js +36 -0
- package/dist/revision-recovery.d.ts +162 -0
- package/dist/revision-recovery.d.ts.map +1 -0
- package/dist/revision-recovery.js +69 -0
- package/dist/state-contract.d.ts +2 -0
- package/dist/state-contract.d.ts.map +1 -1
- package/dist/state-contract.js +17 -7
- package/dist/studio-app/assets/{feltdb_wasm-CBGD0zRu.js → feltdb_wasm-DYPuS6Ky.js} +1 -1
- package/dist/studio-app/assets/{feltdb_wasm_bg-C6ATF9mJ.wasm → feltdb_wasm_bg-DEwA82pF.wasm} +0 -0
- package/dist/studio-app/assets/{index-CGQV6zGa.js → index-_qqVLfw1.js} +5 -5
- package/dist/studio-app/index.html +1 -1
- package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;GAEG;AACH,oBAAY,eAAe;IACzB,6BAA6B;IAC7B,EAAE,OAAO;IAET,wEAAwE;IACxE,QAAQ,aAAa;IAErB,2DAA2D;IAC3D,mBAAmB,wBAAwB;IAE3C,gEAAgE;IAChE,QAAQ,aAAa;IAErB,6DAA6D;IAC7D,cAAc,mBAAmB;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,wCAAwC;IACxC,IAAI,EAAE,eAAe,GAAG,MAAM,CAAC;IAE/B,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC;IAEhB,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;IAEnB,mCAAmC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;IAEpB,gEAAgE;IAChE,aAAa,CAAC,EAAE,eAAe,GAAG,YAAY,GAAG,mBAAmB,GAAG,iBAAiB,CAAC;CAC1F;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,GAAG,OAAO,CAExE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,GAAG,qBAAqB,GAAG,gBAAgB,GAAG,YAAY,CAQxH"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FeltDB Deterministic Error Codes
|
|
3
|
+
*
|
|
4
|
+
* All FeltDB API responses use these semantic error codes.
|
|
5
|
+
* Never returns empty {} or untyped errors.
|
|
6
|
+
*
|
|
7
|
+
* Clients must handle each code appropriately:
|
|
8
|
+
* - CONFLICT: Retry with backoff (CAS mismatch)
|
|
9
|
+
* - PRECONDITION_FAILED: Do not retry (validation error)
|
|
10
|
+
* - TOO_BUSY: Retry with exponential backoff (queue full)
|
|
11
|
+
* - INTERNAL_ERROR: Log and escalate (server error)
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Semantic error codes matching HTTP status codes
|
|
15
|
+
*/
|
|
16
|
+
export var FeltDBErrorCode;
|
|
17
|
+
(function (FeltDBErrorCode) {
|
|
18
|
+
/** 200: Request succeeded */
|
|
19
|
+
FeltDBErrorCode["OK"] = "OK";
|
|
20
|
+
/** 409: Version conflict; concurrent writer won; retry intelligently */
|
|
21
|
+
FeltDBErrorCode["CONFLICT"] = "CONFLICT";
|
|
22
|
+
/** 422: Validation or precondition failed; do not retry */
|
|
23
|
+
FeltDBErrorCode["PRECONDITION_FAILED"] = "PRECONDITION_FAILED";
|
|
24
|
+
/** 429: Queue depth exceeded; retry with exponential backoff */
|
|
25
|
+
FeltDBErrorCode["TOO_BUSY"] = "TOO_BUSY";
|
|
26
|
+
/** 500: Unrecoverable server error; audit trail available */
|
|
27
|
+
FeltDBErrorCode["INTERNAL_ERROR"] = "INTERNAL_ERROR";
|
|
28
|
+
})(FeltDBErrorCode || (FeltDBErrorCode = {}));
|
|
29
|
+
/**
|
|
30
|
+
* Determines if a FeltDB error is retryable
|
|
31
|
+
*/
|
|
32
|
+
export function isRetryableError(code) {
|
|
33
|
+
return code === FeltDBErrorCode.CONFLICT || code === FeltDBErrorCode.TOO_BUSY;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Determines retry strategy based on error code
|
|
37
|
+
*/
|
|
38
|
+
export function getRetryStrategy(code) {
|
|
39
|
+
if (code === FeltDBErrorCode.CONFLICT) {
|
|
40
|
+
return 'exponential_backoff';
|
|
41
|
+
}
|
|
42
|
+
if (code === FeltDBErrorCode.TOO_BUSY) {
|
|
43
|
+
return 'exponential_backoff';
|
|
44
|
+
}
|
|
45
|
+
return 'dont_retry';
|
|
46
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,9 @@ export * from './file-db.js';
|
|
|
31
31
|
export * from './flowspec.js';
|
|
32
32
|
export * from './application-manifest.js';
|
|
33
33
|
export * from './state-contract.js';
|
|
34
|
+
export * from './revision-recovery.js';
|
|
35
|
+
export * from './operation-admission.js';
|
|
36
|
+
export * from './error-codes.js';
|
|
34
37
|
export * from './authorization.js';
|
|
35
38
|
export * from './sync-contract.js';
|
|
36
39
|
export * from './workload.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cA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1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,KAAK,OAAO,EACZ,KAAK,SAAS,IAAI,iBAAiB,EACnC,KAAK,QAAQ,IAAI,gBAAgB,GAClC,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AAEnC;;GAEG;AACH,YAAY,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,9 @@ export * from './file-db.js';
|
|
|
31
31
|
export * from './flowspec.js';
|
|
32
32
|
export * from './application-manifest.js';
|
|
33
33
|
export * from './state-contract.js';
|
|
34
|
+
export * from './revision-recovery.js';
|
|
35
|
+
export * from './operation-admission.js';
|
|
36
|
+
export * from './error-codes.js';
|
|
34
37
|
export * from './authorization.js';
|
|
35
38
|
export * from './sync-contract.js';
|
|
36
39
|
export * from './workload.js';
|
package/dist/memory-db.d.ts
CHANGED
|
@@ -27,6 +27,18 @@ export declare class MemoryJsDb implements JsDb {
|
|
|
27
27
|
update(key: string, value: string): JsResult;
|
|
28
28
|
get(key: string): JsResult;
|
|
29
29
|
delete(key: string): JsResult;
|
|
30
|
+
putIfAbsent(key: string, value: string): Promise<{
|
|
31
|
+
inserted: boolean;
|
|
32
|
+
value: string;
|
|
33
|
+
}>;
|
|
34
|
+
cas(params: {
|
|
35
|
+
key: string;
|
|
36
|
+
expectedVersion: number;
|
|
37
|
+
value: string;
|
|
38
|
+
}): Promise<{
|
|
39
|
+
updated: boolean;
|
|
40
|
+
currentVersion: number;
|
|
41
|
+
}>;
|
|
30
42
|
query(capability: string): JsResult;
|
|
31
43
|
get_capability_records(capability: string): JsResult;
|
|
32
44
|
execute_op(): JsResult;
|
package/dist/memory-db.d.ts.map
CHANGED
|
@@ -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;AAExC,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;AAIrK,mEAAmE;AACnE,qBAAa,UAAW,YAAW,IAAI;IACrC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAuB;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuB;IAC9C,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;gBAE/B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,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;IACtB,YAAY;IACZ,iBAAiB,CAAC,aAAa,EAAE,MAAM;IACvC,uBAAuB,CAAC,UAAU,EAAE,aAAa,EAAE;;;;CAapD"}
|
package/dist/memory-db.js
CHANGED
|
@@ -45,6 +45,42 @@ export class MemoryJsDb {
|
|
|
45
45
|
this.event(key.split(':')[0], key, 'delete');
|
|
46
46
|
return { success: true, data: key };
|
|
47
47
|
}
|
|
48
|
+
putIfAbsent(key, value) {
|
|
49
|
+
const existing = this.rows.get(key);
|
|
50
|
+
if (existing !== undefined) {
|
|
51
|
+
return Promise.resolve({
|
|
52
|
+
inserted: false,
|
|
53
|
+
value: JSON.stringify(existing),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const parsed = JSON.parse(value);
|
|
57
|
+
this.rows.set(key, parsed);
|
|
58
|
+
this.event(key.split(':')[0], key, 'put', parsed);
|
|
59
|
+
return Promise.resolve({
|
|
60
|
+
inserted: true,
|
|
61
|
+
value,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
cas(params) {
|
|
65
|
+
const existing = this.rows.get(params.key);
|
|
66
|
+
const parsed = JSON.parse(params.value);
|
|
67
|
+
if (existing === undefined) {
|
|
68
|
+
// Key doesn't exist - conflict: current version is 0
|
|
69
|
+
return Promise.resolve({ updated: false, currentVersion: 0 });
|
|
70
|
+
}
|
|
71
|
+
const existingRecord = existing;
|
|
72
|
+
const currentVersion = existingRecord.__version ?? 1;
|
|
73
|
+
if (currentVersion !== params.expectedVersion) {
|
|
74
|
+
// Version mismatch - conflict
|
|
75
|
+
return Promise.resolve({ updated: false, currentVersion });
|
|
76
|
+
}
|
|
77
|
+
// Version matches - update atomically
|
|
78
|
+
const newVersion = params.expectedVersion + 1;
|
|
79
|
+
const updated = { ...parsed, __version: newVersion };
|
|
80
|
+
this.rows.set(params.key, updated);
|
|
81
|
+
this.event(params.key.split(':')[0], params.key, 'put', updated);
|
|
82
|
+
return Promise.resolve({ updated: true, currentVersion: newVersion });
|
|
83
|
+
}
|
|
48
84
|
query(capability) {
|
|
49
85
|
const prefix = `${capability}:`;
|
|
50
86
|
const values = [...this.rows]
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Revision Recovery: Audited Recovery from Invalid Historical Revisions
|
|
3
|
+
*
|
|
4
|
+
* Provides mechanisms to safely recover from corrupt/invalid historical revisions
|
|
5
|
+
* under strict safety constraints and comprehensive audit trail requirements.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Authorization level required for revision recovery operations
|
|
9
|
+
*/
|
|
10
|
+
export type RecoveryAuthorization = 'ELEVATED' | 'ADMIN' | 'EMERGENCY';
|
|
11
|
+
/**
|
|
12
|
+
* Compatibility classification for manifest changes
|
|
13
|
+
*/
|
|
14
|
+
export type CompatibilityClassification = 'COMPATIBLE' | 'WARNING' | 'INCOMPATIBLE';
|
|
15
|
+
/**
|
|
16
|
+
* Recovery mode indicating what was approved
|
|
17
|
+
*/
|
|
18
|
+
export type RecoveryMode = 'SAFE_COMPATIBLE' | 'WARNING_APPROVED' | 'DESTRUCTIVE_APPROVED';
|
|
19
|
+
/**
|
|
20
|
+
* Input for recovering an application revision
|
|
21
|
+
*/
|
|
22
|
+
export interface RevisionRecoveryInput {
|
|
23
|
+
/** Application ID being recovered */
|
|
24
|
+
applicationId: string;
|
|
25
|
+
/** Current revision that is invalid/corrupt (must match actual current) */
|
|
26
|
+
expectedCurrentRevision: string;
|
|
27
|
+
/** Target revision to promote to (must be valid and integrity-checked) */
|
|
28
|
+
targetRevision: string;
|
|
29
|
+
/** Elevated authorization level required */
|
|
30
|
+
authorization: RecoveryAuthorization;
|
|
31
|
+
/** Actor (user/service) approving recovery */
|
|
32
|
+
actor: string;
|
|
33
|
+
/** Explicit reason for recovery */
|
|
34
|
+
reason: string;
|
|
35
|
+
/** Environment being recovered */
|
|
36
|
+
environment?: string;
|
|
37
|
+
/** Allow destructive schema changes if compatibility check requires it */
|
|
38
|
+
allowDestructiveChange?: boolean;
|
|
39
|
+
/** Explicit reason for approving destructive changes (required if allowDestructiveChange=true) */
|
|
40
|
+
destructiveChangeReason?: string;
|
|
41
|
+
/** Idempotency key for recovery operation */
|
|
42
|
+
recoveryId?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Audit record for a completed revision recovery
|
|
46
|
+
*/
|
|
47
|
+
export interface RevisionRecoveryAudit {
|
|
48
|
+
/** Unique audit record ID */
|
|
49
|
+
auditId: string;
|
|
50
|
+
/** Application being recovered */
|
|
51
|
+
applicationId: string;
|
|
52
|
+
/** Source (corrupt) revision being abandoned */
|
|
53
|
+
sourceRevision: string;
|
|
54
|
+
/** Recomputed hash of source revision (for verification) */
|
|
55
|
+
sourceRevisionHash: string;
|
|
56
|
+
/** Target revision being promoted to */
|
|
57
|
+
targetRevision: string;
|
|
58
|
+
/** Hash of target revision */
|
|
59
|
+
targetRevisionHash: string;
|
|
60
|
+
/** Hash of previous audit record in chain (for immutability) */
|
|
61
|
+
previousAuditHash?: string;
|
|
62
|
+
/** Hash of this audit record */
|
|
63
|
+
auditHash: string;
|
|
64
|
+
/** Actor who approved recovery */
|
|
65
|
+
approvedBy: string;
|
|
66
|
+
/** Recovery reason provided */
|
|
67
|
+
reason: string;
|
|
68
|
+
/** Authorization level that was required */
|
|
69
|
+
authorizationLevel: RecoveryAuthorization;
|
|
70
|
+
/** Mode of recovery (what was approved) */
|
|
71
|
+
recoveryMode: RecoveryMode;
|
|
72
|
+
/** Compatibility classification from diff analysis */
|
|
73
|
+
compatibilityClassification: CompatibilityClassification;
|
|
74
|
+
/** Detailed compatibility issues found (if any) */
|
|
75
|
+
compatibilityIssues?: string[];
|
|
76
|
+
/** Destructive change approval reason (if applicable) */
|
|
77
|
+
destructiveChangeReason?: string;
|
|
78
|
+
/** Timestamp of recovery */
|
|
79
|
+
recoveredAt: number;
|
|
80
|
+
/** Idempotency key for the recovery operation */
|
|
81
|
+
recoveryId: string;
|
|
82
|
+
/** Status of recovery operation */
|
|
83
|
+
status: 'COMPLETED' | 'PARTIAL' | 'ROLLED_BACK';
|
|
84
|
+
/** Marker indicating source revision must never be moved back to */
|
|
85
|
+
markedUntrustedUntilRevision: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Result of a revision recovery attempt
|
|
89
|
+
*/
|
|
90
|
+
export interface RevisionRecoveryResult {
|
|
91
|
+
/** Whether recovery succeeded */
|
|
92
|
+
success: boolean;
|
|
93
|
+
/** Error code if recovery failed */
|
|
94
|
+
errorCode?: 'PERMISSION_DENIED' | 'CONFLICT' | 'INCOMPATIBLE_SCHEMA' | 'CORRUPT_REVISION_UNMOVABLE' | 'STORAGE_FAILURE' | 'VALIDATION_FAILED';
|
|
95
|
+
/** Human-readable error message */
|
|
96
|
+
errorMessage?: string;
|
|
97
|
+
/** Audit record created (present if recovery succeeds or partially completes) */
|
|
98
|
+
audit?: RevisionRecoveryAudit;
|
|
99
|
+
/** Current revision pointer after recovery attempt */
|
|
100
|
+
currentRevision: string;
|
|
101
|
+
/** Whether audit record was durable persisted */
|
|
102
|
+
auditDurable: boolean;
|
|
103
|
+
/** Pointer was successfully moved to target */
|
|
104
|
+
pointerMoved: boolean;
|
|
105
|
+
/** Source revision was marked untrusted */
|
|
106
|
+
sourceMarkedUntrusted: boolean;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Revision state tracking for corrupt/untrusted revisions
|
|
110
|
+
*/
|
|
111
|
+
export interface RevisionState {
|
|
112
|
+
/** Revision ID */
|
|
113
|
+
revisionId: string;
|
|
114
|
+
/** Whether revision is valid/trusted */
|
|
115
|
+
trusted: boolean;
|
|
116
|
+
/** Marker: any revision equal to or before this cannot be promoted to */
|
|
117
|
+
untrustedUntilRevision?: string;
|
|
118
|
+
/** Reason revision was marked untrusted (if applicable) */
|
|
119
|
+
untrustedReason?: string;
|
|
120
|
+
/** Timestamp when marked untrusted */
|
|
121
|
+
markedUntrustedAt?: number;
|
|
122
|
+
/** Reference to recovery audit that marked it untrusted */
|
|
123
|
+
recoveryAuditId?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Compatibility check result
|
|
127
|
+
*/
|
|
128
|
+
export interface CompatibilityCheckResult {
|
|
129
|
+
/** Overall compatibility classification */
|
|
130
|
+
classification: CompatibilityClassification;
|
|
131
|
+
/** List of specific issues or warnings found */
|
|
132
|
+
issues: Array<{
|
|
133
|
+
category: 'SCHEMA_CHANGE' | 'DATA_LOSS' | 'REFERENCE_BREAKING' | 'INDEX_REMOVAL';
|
|
134
|
+
severity: 'WARNING' | 'INCOMPATIBLE';
|
|
135
|
+
detail: string;
|
|
136
|
+
}>;
|
|
137
|
+
/** Whether any data loss would occur */
|
|
138
|
+
causesDataLoss: boolean;
|
|
139
|
+
/** Whether this is a breaking change */
|
|
140
|
+
isBreakingChange: boolean;
|
|
141
|
+
/** Recommended action */
|
|
142
|
+
recommendation: string;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Validates revision recovery input
|
|
146
|
+
*/
|
|
147
|
+
export declare function validateRevisionRecoveryInput(input: RevisionRecoveryInput): {
|
|
148
|
+
valid: boolean;
|
|
149
|
+
error?: string;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Generates cryptographic hash for audit record chain
|
|
153
|
+
*/
|
|
154
|
+
export declare function generateAuditHash(data: Record<string, unknown>, previousHash?: string): string;
|
|
155
|
+
/**
|
|
156
|
+
* Checks if a revision pointer transition would violate untrust markers
|
|
157
|
+
*/
|
|
158
|
+
export declare function wouldViolateUntrustworthiness(fromRevision: string, toRevision: string, revisionStates: Map<string, RevisionState>): {
|
|
159
|
+
violates: boolean;
|
|
160
|
+
reason?: string;
|
|
161
|
+
};
|
|
162
|
+
//# sourceMappingURL=revision-recovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revision-recovery.d.ts","sourceRoot":"","sources":["../src/revision-recovery.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG,OAAO,GAAG,WAAW,CAAC;AAEvE;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,YAAY,GAAG,SAAS,GAAG,cAAc,CAAC;AAEpF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,sBAAsB,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,qCAAqC;IACrC,aAAa,EAAE,MAAM,CAAC;IAEtB,2EAA2E;IAC3E,uBAAuB,EAAE,MAAM,CAAC;IAEhC,0EAA0E;IAC1E,cAAc,EAAE,MAAM,CAAC;IAEvB,4CAA4C;IAC5C,aAAa,EAAE,qBAAqB,CAAC;IAErC,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IAEd,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IAEf,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,0EAA0E;IAC1E,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC,kGAAkG;IAClG,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAEjC,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAEhB,kCAAkC;IAClC,aAAa,EAAE,MAAM,CAAC;IAEtB,gDAAgD;IAChD,cAAc,EAAE,MAAM,CAAC;IAEvB,4DAA4D;IAC5D,kBAAkB,EAAE,MAAM,CAAC;IAE3B,wCAAwC;IACxC,cAAc,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Q,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAgBxC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Revision Recovery: Audited Recovery from Invalid Historical Revisions
|
|
3
|
+
*
|
|
4
|
+
* Provides mechanisms to safely recover from corrupt/invalid historical revisions
|
|
5
|
+
* under strict safety constraints and comprehensive audit trail requirements.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Validates revision recovery input
|
|
9
|
+
*/
|
|
10
|
+
export function validateRevisionRecoveryInput(input) {
|
|
11
|
+
if (!input.applicationId || typeof input.applicationId !== 'string') {
|
|
12
|
+
return { valid: false, error: 'applicationId must be a non-empty string' };
|
|
13
|
+
}
|
|
14
|
+
if (!input.expectedCurrentRevision || typeof input.expectedCurrentRevision !== 'string') {
|
|
15
|
+
return { valid: false, error: 'expectedCurrentRevision must be a non-empty string' };
|
|
16
|
+
}
|
|
17
|
+
if (!input.targetRevision || typeof input.targetRevision !== 'string') {
|
|
18
|
+
return { valid: false, error: 'targetRevision must be a non-empty string' };
|
|
19
|
+
}
|
|
20
|
+
if (!input.authorization || !['ELEVATED', 'ADMIN', 'EMERGENCY'].includes(input.authorization)) {
|
|
21
|
+
return { valid: false, error: 'authorization must be ELEVATED, ADMIN, or EMERGENCY' };
|
|
22
|
+
}
|
|
23
|
+
if (!input.actor || typeof input.actor !== 'string') {
|
|
24
|
+
return { valid: false, error: 'actor must be a non-empty string' };
|
|
25
|
+
}
|
|
26
|
+
if (!input.reason || typeof input.reason !== 'string' || input.reason.length < 10) {
|
|
27
|
+
return { valid: false, error: 'reason must be a string with at least 10 characters' };
|
|
28
|
+
}
|
|
29
|
+
if (input.expectedCurrentRevision === input.targetRevision) {
|
|
30
|
+
return { valid: false, error: 'expectedCurrentRevision and targetRevision must be different' };
|
|
31
|
+
}
|
|
32
|
+
if (input.allowDestructiveChange === true) {
|
|
33
|
+
if (!input.destructiveChangeReason || typeof input.destructiveChangeReason !== 'string' || input.destructiveChangeReason.length < 10) {
|
|
34
|
+
return { valid: false, error: 'destructiveChangeReason must be provided and at least 10 characters when allowDestructiveChange=true' };
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return { valid: true };
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Generates cryptographic hash for audit record chain
|
|
41
|
+
*/
|
|
42
|
+
export function generateAuditHash(data, previousHash) {
|
|
43
|
+
// In production, use SHA-256 or similar
|
|
44
|
+
// For now, use a simple hash based on JSON serialization
|
|
45
|
+
const payload = JSON.stringify({ ...data, previousHash });
|
|
46
|
+
// Use Buffer for Node.js, or btoa for browser environments
|
|
47
|
+
const encoded = typeof btoa !== 'undefined'
|
|
48
|
+
? btoa(payload)
|
|
49
|
+
: Buffer.from(payload).toString('base64');
|
|
50
|
+
return encoded.substring(0, 64);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Checks if a revision pointer transition would violate untrust markers
|
|
54
|
+
*/
|
|
55
|
+
export function wouldViolateUntrustworthiness(fromRevision, toRevision, revisionStates) {
|
|
56
|
+
const state = revisionStates.get(fromRevision);
|
|
57
|
+
if (!state || !state.untrustedUntilRevision) {
|
|
58
|
+
return { violates: false };
|
|
59
|
+
}
|
|
60
|
+
// Check if trying to move back to or through an untrusted revision
|
|
61
|
+
// This is a simplified check; production would need proper revision ordering
|
|
62
|
+
if (toRevision === state.untrustedUntilRevision || state.untrustedUntilRevision === fromRevision) {
|
|
63
|
+
return {
|
|
64
|
+
violates: true,
|
|
65
|
+
reason: `Revision ${fromRevision} is marked untrusted and cannot be moved back to`,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return { violates: false };
|
|
69
|
+
}
|
package/dist/state-contract.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RevisionRecoveryInput, RevisionRecoveryResult } from './revision-recovery.js';
|
|
1
2
|
/** Transport types for the Rust-owned FeltDB state contract. */
|
|
2
3
|
export type PrimitiveType = 'string' | 'integer' | 'number' | 'boolean' | 'timestamp' | 'date' | 'time' | 'json' | 'uuid' | 'decimal' | 'money' | 'bigint' | 'email' | 'url' | 'phone' | 'binary' | 'file' | 'geo_point' | 'object';
|
|
3
4
|
export type FieldType = {
|
|
@@ -174,6 +175,7 @@ export declare class StateContractClient {
|
|
|
174
175
|
transactionId?: string;
|
|
175
176
|
causalParent?: number;
|
|
176
177
|
}): Promise<TransactionResult>;
|
|
178
|
+
recoverApplicationRevision(input: RevisionRecoveryInput): Promise<RevisionRecoveryResult>;
|
|
177
179
|
}
|
|
178
180
|
export {};
|
|
179
181
|
//# sourceMappingURL=state-contract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-contract.d.ts","sourceRoot":"","sources":["../src/state-contract.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,MAAM,MAAM,aAAa,GAAC,QAAQ,GAAC,SAAS,GAAC,QAAQ,GAAC,SAAS,GAAC,WAAW,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,SAAS,GAAC,OAAO,GAAC,QAAQ,GAAC,OAAO,GAAC,KAAK,GAAC,OAAO,GAAC,QAAQ,GAAC,MAAM,GAAC,WAAW,GAAC,QAAQ,CAAC;AAC9L,MAAM,MAAM,SAAS,GAAC;IAAC,IAAI,EAAC,WAAW,CAAC;IAAA,SAAS,EAAC,aAAa,CAAA;CAAC,GAAC;IAAC,IAAI,EAAC,MAAM,CAAC;IAAA,MAAM,EAAC,MAAM,EAAE,CAAA;CAAC,GAAC;IAAC,IAAI,EAAC,WAAW,CAAC;IAAA,UAAU,EAAC,MAAM,CAAA;CAAC,GAAC;IAAC,IAAI,EAAC,OAAO,CAAC;IAAA,KAAK,EAAC,SAAS,CAAA;CAAC,GAAC;IAAC,IAAI,EAAC,KAAK,CAAC;IAAA,MAAM,EAAC,SAAS,CAAA;CAAC,GAAC;IAAC,IAAI,EAAC,QA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C,OAAO;gBAA5F,MAAM,EAAC;QAAC,aAAa,EAAC,MAAM,CAAC;QAAA,UAAU,EAAC,MAAM,CAAC;QAAA,WAAW,CAAC,EAAC,MAAM,CAAA;KAAC,EAAkB,OAAO,SAAG;YAC9G,OAAO;IAmBrB,MAAM;gBAA4L,WAAW;;IAC7M,YAAY;IACZ,KAAK,CAAC,CAAC,GAAC,MAAM,CAAC,MAAM,EAAC,OAAO,CAAC,EAAE,KAAK,EAAC,cAAc;IAC9C,WAAW,CAAC,IAAI,EAAC,CAAC,EAAE,EAAC,kBAAkB,KAAG,IAAI,GAAC,OAAO,CAAC,IAAI,CAAC,EAAC,OAAO,CAAC,EAAC;QAAC,aAAa,CAAC,EAAC,MAAM,CAAC;QAAA,YAAY,CAAC,EAAC,MAAM,CAAA;KAAC;IACxH,0BAA0B,CAAC,KAAK,EAAC,qBAAqB;CACvD"}
|
package/dist/state-contract.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FeltDBErrorCode } from './error-codes.js';
|
|
1
2
|
class TransactionBuilder {
|
|
2
3
|
constructor() {
|
|
3
4
|
this.operations = [];
|
|
@@ -9,16 +10,25 @@ export class StateContractClient {
|
|
|
9
10
|
this.target = target;
|
|
10
11
|
this.baseUrl = baseUrl;
|
|
11
12
|
}
|
|
12
|
-
async request(path, options) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
async request(path, options) {
|
|
14
|
+
const response = await fetch(`${this.baseUrl}${path}`, { ...options, headers: { ...(options?.body ? { 'Content-Type': 'application/json' } : {}), ...options?.headers } });
|
|
15
|
+
const body = await response.json();
|
|
16
|
+
if (!response.ok) {
|
|
17
|
+
const error = {
|
|
18
|
+
code: body.code || FeltDBErrorCode.INTERNAL_ERROR,
|
|
19
|
+
message: body.message || 'FeltDB request failed',
|
|
20
|
+
request_id: body.request_id || 'unknown',
|
|
21
|
+
transaction_id: body.transaction_id,
|
|
22
|
+
http_status: response.status,
|
|
23
|
+
recovery_hint: body.recovery_hint,
|
|
24
|
+
};
|
|
25
|
+
throw Object.assign(new Error(error.message), { status: response.status, feltdb_error: error });
|
|
16
26
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} return body; }
|
|
27
|
+
return body;
|
|
28
|
+
}
|
|
20
29
|
schema() { const q = new URLSearchParams({ application_id: this.target.applicationId, revision_id: this.target.revisionId, environment: this.target.environment || 'production' }); return this.request(`/v1/schema?${q}`); }
|
|
21
30
|
stateVersion() { const q = new URLSearchParams({ application_id: this.target.applicationId, revision_id: this.target.revisionId, environment: this.target.environment || 'production' }); return this.request(`/v1/state/version?${q}`); }
|
|
22
31
|
query(query) { return this.request('/v1/query', { method: 'POST', body: JSON.stringify({ application_id: this.target.applicationId, revision_id: this.target.revisionId, environment: this.target.environment || 'production', query }) }); }
|
|
23
32
|
async transaction(work, options) { const tx = new TransactionBuilder(); await work(tx); return this.request('/v1/transactions', { method: 'POST', body: JSON.stringify({ application_id: this.target.applicationId, revision_id: this.target.revisionId, environment: this.target.environment || 'production', transaction: { transaction_id: options?.transactionId, tenant_id: 'transport', application_id: this.target.applicationId, revision_id: this.target.revisionId, schema_version: 0, causal_parent: options?.causalParent, authorization: { subject: 'transport', tenant_id: 'transport', application_id: this.target.applicationId, revision_id: this.target.revisionId, capabilities: [] }, operations: tx.operations } }) }); }
|
|
33
|
+
recoverApplicationRevision(input) { return this.request('/v1/revision/recover', { method: 'POST', body: JSON.stringify({ ...input, environment: input.environment || this.target.environment || 'production' }) }); }
|
|
24
34
|
}
|
|
@@ -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-C6ATF9mJ.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-DEwA82pF.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};
|