@antfly/embedded 0.3.0-rc.1 → 0.3.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{database-BY3WSLgt.d.cts → database-D9gL3wnT.d.cts} +27 -0
- package/dist/{database-BY3WSLgt.d.ts → database-D9gL3wnT.d.ts} +27 -0
- package/dist/index.cjs +196 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +196 -0
- package/dist/kysely.d.cts +1 -1
- package/dist/kysely.d.ts +1 -1
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ separate; a source build or native archive does not imply wheel/npm support.
|
|
|
24
24
|
Source checkouts
|
|
25
25
|
can build the shared library with "Library discovery" below. From the
|
|
26
26
|
`antfly` monorepo source tree, build it
|
|
27
|
-
with `cd zig && zig build
|
|
27
|
+
with `cd zig && zig build libantfly` (produces `zig/zig-out/lib/libantfly.*`);
|
|
28
28
|
this package does not build it for you.
|
|
29
29
|
|
|
30
30
|
## Quick start
|
|
@@ -358,6 +358,19 @@ interface NativeLibrary {
|
|
|
358
358
|
dbGetRaw: KoffiFunc<(handle: unknown, key: object, out: object) => number>;
|
|
359
359
|
dbGetSchemaJson: KoffiFunc<(handle: unknown, out: object) => number>;
|
|
360
360
|
dbSetSchemaJson: KoffiFunc<(handle: unknown, schema: object) => number>;
|
|
361
|
+
dbRenderResolverKeyJson: KoffiFunc<(handle: unknown, arg0: object, arg1: object, out: object) => number>;
|
|
362
|
+
dbMemoryJson: KoffiFunc<(handle: unknown, space: object, request: object, out: object) => number>;
|
|
363
|
+
dbResolveQueryJson: KoffiFunc<(handle: unknown, arg0: object, arg1: object, out: object) => number>;
|
|
364
|
+
dbMergeResolverKeysJson: KoffiFunc<(handle: unknown, arg0: object, arg1: object) => number>;
|
|
365
|
+
dbUnmergeResolverKeyJson: KoffiFunc<(handle: unknown, arg0: object, arg1: object, out: object) => number>;
|
|
366
|
+
dbSuppressResolverKeysJson: KoffiFunc<(handle: unknown, arg0: object, arg1: object, out: object) => number>;
|
|
367
|
+
dbUnsuppressResolverKeyJson: KoffiFunc<(handle: unknown, arg0: object, arg1: object, out: object) => number>;
|
|
368
|
+
dbResolverCurationJson: KoffiFunc<(handle: unknown, arg0: object, out: object) => number>;
|
|
369
|
+
dbResolverReviewsJson: KoffiFunc<(handle: unknown, arg0: object, out: object) => number>;
|
|
370
|
+
dbCurateEntityJson: KoffiFunc<(handle: unknown, arg0: object, arg1: object, arg2: object, out: object) => number>;
|
|
371
|
+
dbListResolverIdentitiesJson: KoffiFunc<(handle: unknown, out: object) => number>;
|
|
372
|
+
dbSetResolverNamespaceJson: KoffiFunc<(handle: unknown, arg0: object, arg1: object) => number>;
|
|
373
|
+
dbDropResolverIdentity: KoffiFunc<(handle: unknown, name: object, out: object) => number>;
|
|
361
374
|
dbListIndexesJson: KoffiFunc<(handle: unknown, out: object) => number>;
|
|
362
375
|
dbAddIndexJson: KoffiFunc<(handle: unknown, config: object) => number>;
|
|
363
376
|
dbDeleteIndex: KoffiFunc<(handle: unknown, name: object, outDeleted: boolean[]) => number>;
|
|
@@ -486,6 +499,20 @@ declare class Database implements AsyncDisposable {
|
|
|
486
499
|
getSchemaRaw(): Promise<Buffer>;
|
|
487
500
|
getSchema(): Promise<unknown>;
|
|
488
501
|
setSchema(schema: JsonInput): Promise<void>;
|
|
502
|
+
renderResolverKey(resolver: string, request: JsonInput): Promise<unknown>;
|
|
503
|
+
/** Execute native memory policy using the shared action/body envelope. */
|
|
504
|
+
memory(space: string, request: JsonInput): Promise<unknown>;
|
|
505
|
+
resolveQuery(resolver: string, request: JsonInput): Promise<unknown>;
|
|
506
|
+
mergeResolverKeys(resolver: string, request: JsonInput): Promise<void>;
|
|
507
|
+
unmergeResolverKey(resolver: string, request: JsonInput): Promise<unknown>;
|
|
508
|
+
suppressResolverKeys(resolver: string, request: JsonInput): Promise<unknown>;
|
|
509
|
+
unsuppressResolverKey(resolver: string, request: JsonInput): Promise<unknown>;
|
|
510
|
+
resolverCuration(resolver?: string): Promise<unknown>;
|
|
511
|
+
resolverReviews(request: JsonInput): Promise<unknown>;
|
|
512
|
+
curateEntity(table: string, key: string, request: JsonInput): Promise<unknown>;
|
|
513
|
+
listResolverIdentities(): Promise<unknown>;
|
|
514
|
+
setResolverNamespace(resolver: string, request: JsonInput): Promise<void>;
|
|
515
|
+
dropResolverIdentity(resolver: string): Promise<boolean>;
|
|
489
516
|
listIndexesRaw(): Promise<Buffer>;
|
|
490
517
|
listIndexes(): Promise<unknown>;
|
|
491
518
|
addIndex(config: JsonInput): Promise<void>;
|
|
@@ -358,6 +358,19 @@ interface NativeLibrary {
|
|
|
358
358
|
dbGetRaw: KoffiFunc<(handle: unknown, key: object, out: object) => number>;
|
|
359
359
|
dbGetSchemaJson: KoffiFunc<(handle: unknown, out: object) => number>;
|
|
360
360
|
dbSetSchemaJson: KoffiFunc<(handle: unknown, schema: object) => number>;
|
|
361
|
+
dbRenderResolverKeyJson: KoffiFunc<(handle: unknown, arg0: object, arg1: object, out: object) => number>;
|
|
362
|
+
dbMemoryJson: KoffiFunc<(handle: unknown, space: object, request: object, out: object) => number>;
|
|
363
|
+
dbResolveQueryJson: KoffiFunc<(handle: unknown, arg0: object, arg1: object, out: object) => number>;
|
|
364
|
+
dbMergeResolverKeysJson: KoffiFunc<(handle: unknown, arg0: object, arg1: object) => number>;
|
|
365
|
+
dbUnmergeResolverKeyJson: KoffiFunc<(handle: unknown, arg0: object, arg1: object, out: object) => number>;
|
|
366
|
+
dbSuppressResolverKeysJson: KoffiFunc<(handle: unknown, arg0: object, arg1: object, out: object) => number>;
|
|
367
|
+
dbUnsuppressResolverKeyJson: KoffiFunc<(handle: unknown, arg0: object, arg1: object, out: object) => number>;
|
|
368
|
+
dbResolverCurationJson: KoffiFunc<(handle: unknown, arg0: object, out: object) => number>;
|
|
369
|
+
dbResolverReviewsJson: KoffiFunc<(handle: unknown, arg0: object, out: object) => number>;
|
|
370
|
+
dbCurateEntityJson: KoffiFunc<(handle: unknown, arg0: object, arg1: object, arg2: object, out: object) => number>;
|
|
371
|
+
dbListResolverIdentitiesJson: KoffiFunc<(handle: unknown, out: object) => number>;
|
|
372
|
+
dbSetResolverNamespaceJson: KoffiFunc<(handle: unknown, arg0: object, arg1: object) => number>;
|
|
373
|
+
dbDropResolverIdentity: KoffiFunc<(handle: unknown, name: object, out: object) => number>;
|
|
361
374
|
dbListIndexesJson: KoffiFunc<(handle: unknown, out: object) => number>;
|
|
362
375
|
dbAddIndexJson: KoffiFunc<(handle: unknown, config: object) => number>;
|
|
363
376
|
dbDeleteIndex: KoffiFunc<(handle: unknown, name: object, outDeleted: boolean[]) => number>;
|
|
@@ -486,6 +499,20 @@ declare class Database implements AsyncDisposable {
|
|
|
486
499
|
getSchemaRaw(): Promise<Buffer>;
|
|
487
500
|
getSchema(): Promise<unknown>;
|
|
488
501
|
setSchema(schema: JsonInput): Promise<void>;
|
|
502
|
+
renderResolverKey(resolver: string, request: JsonInput): Promise<unknown>;
|
|
503
|
+
/** Execute native memory policy using the shared action/body envelope. */
|
|
504
|
+
memory(space: string, request: JsonInput): Promise<unknown>;
|
|
505
|
+
resolveQuery(resolver: string, request: JsonInput): Promise<unknown>;
|
|
506
|
+
mergeResolverKeys(resolver: string, request: JsonInput): Promise<void>;
|
|
507
|
+
unmergeResolverKey(resolver: string, request: JsonInput): Promise<unknown>;
|
|
508
|
+
suppressResolverKeys(resolver: string, request: JsonInput): Promise<unknown>;
|
|
509
|
+
unsuppressResolverKey(resolver: string, request: JsonInput): Promise<unknown>;
|
|
510
|
+
resolverCuration(resolver?: string): Promise<unknown>;
|
|
511
|
+
resolverReviews(request: JsonInput): Promise<unknown>;
|
|
512
|
+
curateEntity(table: string, key: string, request: JsonInput): Promise<unknown>;
|
|
513
|
+
listResolverIdentities(): Promise<unknown>;
|
|
514
|
+
setResolverNamespace(resolver: string, request: JsonInput): Promise<void>;
|
|
515
|
+
dropResolverIdentity(resolver: string): Promise<boolean>;
|
|
489
516
|
listIndexesRaw(): Promise<Buffer>;
|
|
490
517
|
listIndexes(): Promise<unknown>;
|
|
491
518
|
addIndex(config: JsonInput): Promise<void>;
|
package/dist/index.cjs
CHANGED
|
@@ -701,6 +701,78 @@ function buildNative() {
|
|
|
701
701
|
dbGetRaw: f("antfly_db_get_raw", "uint32_t", [PAntflyDb, AntflySlice, PAntflyBufferOut]),
|
|
702
702
|
dbGetSchemaJson: f("antfly_db_get_schema_json", "uint32_t", [PAntflyDb, PAntflyBufferOut]),
|
|
703
703
|
dbSetSchemaJson: f("antfly_db_set_schema_json", "uint32_t", [PAntflyDb, AntflySlice]),
|
|
704
|
+
dbRenderResolverKeyJson: f("antfly_db_render_resolver_key_json", "uint32_t", [
|
|
705
|
+
PAntflyDb,
|
|
706
|
+
AntflySlice,
|
|
707
|
+
AntflySlice,
|
|
708
|
+
PAntflyBufferOut
|
|
709
|
+
]),
|
|
710
|
+
dbMemoryJson: f("antfly_db_memory_json", "uint32_t", [
|
|
711
|
+
PAntflyDb,
|
|
712
|
+
AntflySlice,
|
|
713
|
+
AntflySlice,
|
|
714
|
+
PAntflyBufferOut
|
|
715
|
+
]),
|
|
716
|
+
dbResolveQueryJson: f("antfly_db_resolve_query_json", "uint32_t", [
|
|
717
|
+
PAntflyDb,
|
|
718
|
+
AntflySlice,
|
|
719
|
+
AntflySlice,
|
|
720
|
+
PAntflyBufferOut
|
|
721
|
+
]),
|
|
722
|
+
dbMergeResolverKeysJson: f("antfly_db_merge_resolver_keys_json", "uint32_t", [
|
|
723
|
+
PAntflyDb,
|
|
724
|
+
AntflySlice,
|
|
725
|
+
AntflySlice
|
|
726
|
+
]),
|
|
727
|
+
dbUnmergeResolverKeyJson: f("antfly_db_unmerge_resolver_key_json", "uint32_t", [
|
|
728
|
+
PAntflyDb,
|
|
729
|
+
AntflySlice,
|
|
730
|
+
AntflySlice,
|
|
731
|
+
PAntflyBufferOut
|
|
732
|
+
]),
|
|
733
|
+
dbSuppressResolverKeysJson: f("antfly_db_suppress_resolver_keys_json", "uint32_t", [
|
|
734
|
+
PAntflyDb,
|
|
735
|
+
AntflySlice,
|
|
736
|
+
AntflySlice,
|
|
737
|
+
PAntflyBufferOut
|
|
738
|
+
]),
|
|
739
|
+
dbUnsuppressResolverKeyJson: f("antfly_db_unsuppress_resolver_key_json", "uint32_t", [
|
|
740
|
+
PAntflyDb,
|
|
741
|
+
AntflySlice,
|
|
742
|
+
AntflySlice,
|
|
743
|
+
PAntflyBufferOut
|
|
744
|
+
]),
|
|
745
|
+
dbResolverCurationJson: f("antfly_db_resolver_curation_json", "uint32_t", [
|
|
746
|
+
PAntflyDb,
|
|
747
|
+
AntflySlice,
|
|
748
|
+
PAntflyBufferOut
|
|
749
|
+
]),
|
|
750
|
+
dbResolverReviewsJson: f("antfly_db_resolver_reviews_json", "uint32_t", [
|
|
751
|
+
PAntflyDb,
|
|
752
|
+
AntflySlice,
|
|
753
|
+
PAntflyBufferOut
|
|
754
|
+
]),
|
|
755
|
+
dbCurateEntityJson: f("antfly_db_curate_entity_json", "uint32_t", [
|
|
756
|
+
PAntflyDb,
|
|
757
|
+
AntflySlice,
|
|
758
|
+
AntflySlice,
|
|
759
|
+
AntflySlice,
|
|
760
|
+
PAntflyBufferOut
|
|
761
|
+
]),
|
|
762
|
+
dbListResolverIdentitiesJson: f("antfly_db_list_resolver_identities_json", "uint32_t", [
|
|
763
|
+
PAntflyDb,
|
|
764
|
+
PAntflyBufferOut
|
|
765
|
+
]),
|
|
766
|
+
dbSetResolverNamespaceJson: f("antfly_db_set_resolver_namespace_json", "uint32_t", [
|
|
767
|
+
PAntflyDb,
|
|
768
|
+
AntflySlice,
|
|
769
|
+
AntflySlice
|
|
770
|
+
]),
|
|
771
|
+
dbDropResolverIdentity: f("antfly_db_drop_resolver_identity", "uint32_t", [
|
|
772
|
+
PAntflyDb,
|
|
773
|
+
AntflySlice,
|
|
774
|
+
PBoolOut
|
|
775
|
+
]),
|
|
704
776
|
dbListIndexesJson: f("antfly_db_list_indexes_json", "uint32_t", [PAntflyDb, PAntflyBufferOut]),
|
|
705
777
|
dbAddIndexJson: f("antfly_db_add_index_json", "uint32_t", [PAntflyDb, AntflySlice]),
|
|
706
778
|
dbDeleteIndex: f("antfly_db_delete_index", "uint32_t", [PAntflyDb, AntflySlice, PBoolOut]),
|
|
@@ -935,6 +1007,7 @@ var import_node_path2 = require("path");
|
|
|
935
1007
|
// src/marshal.ts
|
|
936
1008
|
var import_node_util = require("util");
|
|
937
1009
|
var import_koffi3 = __toESM(require("koffi"), 1);
|
|
1010
|
+
var import_lossless_json = require("lossless-json");
|
|
938
1011
|
function toRawBytes(input) {
|
|
939
1012
|
if (Buffer.isBuffer(input)) {
|
|
940
1013
|
return input;
|
|
@@ -1020,6 +1093,28 @@ function txnIdBytes(id) {
|
|
|
1020
1093
|
}
|
|
1021
1094
|
return buf;
|
|
1022
1095
|
}
|
|
1096
|
+
function memoryJsonSlice(input) {
|
|
1097
|
+
if (typeof input === "string" || input instanceof Uint8Array) return jsonSlice(input);
|
|
1098
|
+
const text = (0, import_lossless_json.stringify)(input, (_key, value) => {
|
|
1099
|
+
if (typeof value === "number" && (!Number.isFinite(value) || Number.isInteger(value) && !Number.isSafeInteger(value))) {
|
|
1100
|
+
throw new RangeError(
|
|
1101
|
+
"Memory integers must be safe numbers or bigint; unsafe numbers have already lost precision"
|
|
1102
|
+
);
|
|
1103
|
+
}
|
|
1104
|
+
return value;
|
|
1105
|
+
});
|
|
1106
|
+
if (text === void 0) throw new TypeError("Memory requests must be JSON values");
|
|
1107
|
+
return stringSlice(text);
|
|
1108
|
+
}
|
|
1109
|
+
function parseMemoryJson(buf) {
|
|
1110
|
+
if (buf.length === 0) return null;
|
|
1111
|
+
return (0, import_lossless_json.parse)(buf.toString("utf8"), null, {
|
|
1112
|
+
parseNumber: (token) => {
|
|
1113
|
+
const value = Number(token);
|
|
1114
|
+
return (0, import_lossless_json.isInteger)(token) && !Number.isSafeInteger(value) ? BigInt(token) : value;
|
|
1115
|
+
}
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1023
1118
|
|
|
1024
1119
|
// src/sql-types.ts
|
|
1025
1120
|
var SqlError = class extends Error {
|
|
@@ -1332,6 +1427,107 @@ var Database = class _Database {
|
|
|
1332
1427
|
setSchema(schema) {
|
|
1333
1428
|
return this.#invokeCode(this.#native.dbSetSchemaJson, jsonSlice(schema));
|
|
1334
1429
|
}
|
|
1430
|
+
async renderResolverKey(resolver, request2) {
|
|
1431
|
+
return parseJson(
|
|
1432
|
+
await this.#invokeBuffer(
|
|
1433
|
+
this.#native.dbRenderResolverKeyJson,
|
|
1434
|
+
stringSlice(resolver),
|
|
1435
|
+
jsonSlice(request2)
|
|
1436
|
+
)
|
|
1437
|
+
);
|
|
1438
|
+
}
|
|
1439
|
+
/** Execute native memory policy using the shared action/body envelope. */
|
|
1440
|
+
async memory(space, request2) {
|
|
1441
|
+
return parseMemoryJson(
|
|
1442
|
+
await this.#invokeBuffer(
|
|
1443
|
+
this.#native.dbMemoryJson,
|
|
1444
|
+
stringSlice(space),
|
|
1445
|
+
memoryJsonSlice(request2)
|
|
1446
|
+
)
|
|
1447
|
+
);
|
|
1448
|
+
}
|
|
1449
|
+
async resolveQuery(resolver, request2) {
|
|
1450
|
+
return parseJson(
|
|
1451
|
+
await this.#invokeBuffer(
|
|
1452
|
+
this.#native.dbResolveQueryJson,
|
|
1453
|
+
stringSlice(resolver),
|
|
1454
|
+
jsonSlice(request2)
|
|
1455
|
+
)
|
|
1456
|
+
);
|
|
1457
|
+
}
|
|
1458
|
+
async mergeResolverKeys(resolver, request2) {
|
|
1459
|
+
await this.#invokeCode(
|
|
1460
|
+
this.#native.dbMergeResolverKeysJson,
|
|
1461
|
+
stringSlice(resolver),
|
|
1462
|
+
jsonSlice(request2)
|
|
1463
|
+
);
|
|
1464
|
+
}
|
|
1465
|
+
async unmergeResolverKey(resolver, request2) {
|
|
1466
|
+
return parseJson(
|
|
1467
|
+
await this.#invokeBuffer(
|
|
1468
|
+
this.#native.dbUnmergeResolverKeyJson,
|
|
1469
|
+
stringSlice(resolver),
|
|
1470
|
+
jsonSlice(request2)
|
|
1471
|
+
)
|
|
1472
|
+
);
|
|
1473
|
+
}
|
|
1474
|
+
async suppressResolverKeys(resolver, request2) {
|
|
1475
|
+
return parseJson(
|
|
1476
|
+
await this.#invokeBuffer(
|
|
1477
|
+
this.#native.dbSuppressResolverKeysJson,
|
|
1478
|
+
stringSlice(resolver),
|
|
1479
|
+
jsonSlice(request2)
|
|
1480
|
+
)
|
|
1481
|
+
);
|
|
1482
|
+
}
|
|
1483
|
+
async unsuppressResolverKey(resolver, request2) {
|
|
1484
|
+
return parseJson(
|
|
1485
|
+
await this.#invokeBuffer(
|
|
1486
|
+
this.#native.dbUnsuppressResolverKeyJson,
|
|
1487
|
+
stringSlice(resolver),
|
|
1488
|
+
jsonSlice(request2)
|
|
1489
|
+
)
|
|
1490
|
+
);
|
|
1491
|
+
}
|
|
1492
|
+
async resolverCuration(resolver = "") {
|
|
1493
|
+
return parseJson(
|
|
1494
|
+
await this.#invokeBuffer(this.#native.dbResolverCurationJson, stringSlice(resolver))
|
|
1495
|
+
);
|
|
1496
|
+
}
|
|
1497
|
+
async resolverReviews(request2) {
|
|
1498
|
+
return parseJson(
|
|
1499
|
+
await this.#invokeBuffer(this.#native.dbResolverReviewsJson, jsonSlice(request2))
|
|
1500
|
+
);
|
|
1501
|
+
}
|
|
1502
|
+
async curateEntity(table, key, request2) {
|
|
1503
|
+
return parseJson(
|
|
1504
|
+
await this.#invokeBuffer(
|
|
1505
|
+
this.#native.dbCurateEntityJson,
|
|
1506
|
+
stringSlice(table),
|
|
1507
|
+
stringSlice(key),
|
|
1508
|
+
jsonSlice(request2)
|
|
1509
|
+
)
|
|
1510
|
+
);
|
|
1511
|
+
}
|
|
1512
|
+
async listResolverIdentities() {
|
|
1513
|
+
return parseJson(await this.#invokeBuffer(this.#native.dbListResolverIdentitiesJson));
|
|
1514
|
+
}
|
|
1515
|
+
async setResolverNamespace(resolver, request2) {
|
|
1516
|
+
await this.#invokeCode(
|
|
1517
|
+
this.#native.dbSetResolverNamespaceJson,
|
|
1518
|
+
stringSlice(resolver),
|
|
1519
|
+
jsonSlice(request2)
|
|
1520
|
+
);
|
|
1521
|
+
}
|
|
1522
|
+
dropResolverIdentity(resolver) {
|
|
1523
|
+
return this.#run(async (handle) => {
|
|
1524
|
+
const out = [false];
|
|
1525
|
+
checkCode(
|
|
1526
|
+
await callAsync(this.#native.dbDropResolverIdentity, handle, stringSlice(resolver), out)
|
|
1527
|
+
);
|
|
1528
|
+
return Boolean(out[0]);
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1335
1531
|
listIndexesRaw() {
|
|
1336
1532
|
return this.#invokeBuffer(this.#native.dbListIndexesJson);
|
|
1337
1533
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CheckReport, S as StableSnapshotReport, R as RestoreOptions, N as NativeLibrary, I as InferenceOptions, J as JsonInput, P as PullProgress, D as Database, U as Uint64Like } from './database-
|
|
2
|
-
export { a as Capabilities, b as CompactReport, G as GraphDirection, c as InferenceMode, d as InferenceStatus, L as LibraryNotFoundError, e as LibrarySource, f as MIN_THREAD_STACK_SIZE, M as MemoryAdmissionStats, O as OpenMode, g as OpenOptions, h as PendingWorkStatus, i as Profile, j as ReplayGeneratedEnrichmentsResult, k as ResolvedLibrary, l as SUPPORTED_ABI_VERSION, m as Status, n as Storage, o as StorageStatus, T as THREADING_SERIALIZED, p as TTLCleanupOptions, q as TxnStatus, r as UnsupportedPlatformError, V as VacuumReport, W as WriteIntent, s as create, t as createHosted, u as createWithOptions, v as embeddedPlatformPackageName, w as open, x as openHosted, y as openReadonly, z as openStatusOnly, A as openWithOptions, B as platformLibraryFileName, E as resolveLibrary } from './database-
|
|
1
|
+
import { C as CheckReport, S as StableSnapshotReport, R as RestoreOptions, N as NativeLibrary, I as InferenceOptions, J as JsonInput, P as PullProgress, D as Database, U as Uint64Like } from './database-D9gL3wnT.cjs';
|
|
2
|
+
export { a as Capabilities, b as CompactReport, G as GraphDirection, c as InferenceMode, d as InferenceStatus, L as LibraryNotFoundError, e as LibrarySource, f as MIN_THREAD_STACK_SIZE, M as MemoryAdmissionStats, O as OpenMode, g as OpenOptions, h as PendingWorkStatus, i as Profile, j as ReplayGeneratedEnrichmentsResult, k as ResolvedLibrary, l as SUPPORTED_ABI_VERSION, m as Status, n as Storage, o as StorageStatus, T as THREADING_SERIALIZED, p as TTLCleanupOptions, q as TxnStatus, r as UnsupportedPlatformError, V as VacuumReport, W as WriteIntent, s as create, t as createHosted, u as createWithOptions, v as embeddedPlatformPackageName, w as open, x as openHosted, y as openReadonly, z as openStatusOnly, A as openWithOptions, B as platformLibraryFileName, E as resolveLibrary } from './database-D9gL3wnT.cjs';
|
|
3
3
|
import 'koffi';
|
|
4
4
|
|
|
5
5
|
/** Thrown by validateAbi() when the loaded libantfly does not match the header this binding was written against. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CheckReport, S as StableSnapshotReport, R as RestoreOptions, N as NativeLibrary, I as InferenceOptions, J as JsonInput, P as PullProgress, D as Database, U as Uint64Like } from './database-
|
|
2
|
-
export { a as Capabilities, b as CompactReport, G as GraphDirection, c as InferenceMode, d as InferenceStatus, L as LibraryNotFoundError, e as LibrarySource, f as MIN_THREAD_STACK_SIZE, M as MemoryAdmissionStats, O as OpenMode, g as OpenOptions, h as PendingWorkStatus, i as Profile, j as ReplayGeneratedEnrichmentsResult, k as ResolvedLibrary, l as SUPPORTED_ABI_VERSION, m as Status, n as Storage, o as StorageStatus, T as THREADING_SERIALIZED, p as TTLCleanupOptions, q as TxnStatus, r as UnsupportedPlatformError, V as VacuumReport, W as WriteIntent, s as create, t as createHosted, u as createWithOptions, v as embeddedPlatformPackageName, w as open, x as openHosted, y as openReadonly, z as openStatusOnly, A as openWithOptions, B as platformLibraryFileName, E as resolveLibrary } from './database-
|
|
1
|
+
import { C as CheckReport, S as StableSnapshotReport, R as RestoreOptions, N as NativeLibrary, I as InferenceOptions, J as JsonInput, P as PullProgress, D as Database, U as Uint64Like } from './database-D9gL3wnT.js';
|
|
2
|
+
export { a as Capabilities, b as CompactReport, G as GraphDirection, c as InferenceMode, d as InferenceStatus, L as LibraryNotFoundError, e as LibrarySource, f as MIN_THREAD_STACK_SIZE, M as MemoryAdmissionStats, O as OpenMode, g as OpenOptions, h as PendingWorkStatus, i as Profile, j as ReplayGeneratedEnrichmentsResult, k as ResolvedLibrary, l as SUPPORTED_ABI_VERSION, m as Status, n as Storage, o as StorageStatus, T as THREADING_SERIALIZED, p as TTLCleanupOptions, q as TxnStatus, r as UnsupportedPlatformError, V as VacuumReport, W as WriteIntent, s as create, t as createHosted, u as createWithOptions, v as embeddedPlatformPackageName, w as open, x as openHosted, y as openReadonly, z as openStatusOnly, A as openWithOptions, B as platformLibraryFileName, E as resolveLibrary } from './database-D9gL3wnT.js';
|
|
3
3
|
import 'koffi';
|
|
4
4
|
|
|
5
5
|
/** Thrown by validateAbi() when the loaded libantfly does not match the header this binding was written against. */
|
package/dist/index.js
CHANGED
|
@@ -614,6 +614,78 @@ function buildNative() {
|
|
|
614
614
|
dbGetRaw: f("antfly_db_get_raw", "uint32_t", [PAntflyDb, AntflySlice, PAntflyBufferOut]),
|
|
615
615
|
dbGetSchemaJson: f("antfly_db_get_schema_json", "uint32_t", [PAntflyDb, PAntflyBufferOut]),
|
|
616
616
|
dbSetSchemaJson: f("antfly_db_set_schema_json", "uint32_t", [PAntflyDb, AntflySlice]),
|
|
617
|
+
dbRenderResolverKeyJson: f("antfly_db_render_resolver_key_json", "uint32_t", [
|
|
618
|
+
PAntflyDb,
|
|
619
|
+
AntflySlice,
|
|
620
|
+
AntflySlice,
|
|
621
|
+
PAntflyBufferOut
|
|
622
|
+
]),
|
|
623
|
+
dbMemoryJson: f("antfly_db_memory_json", "uint32_t", [
|
|
624
|
+
PAntflyDb,
|
|
625
|
+
AntflySlice,
|
|
626
|
+
AntflySlice,
|
|
627
|
+
PAntflyBufferOut
|
|
628
|
+
]),
|
|
629
|
+
dbResolveQueryJson: f("antfly_db_resolve_query_json", "uint32_t", [
|
|
630
|
+
PAntflyDb,
|
|
631
|
+
AntflySlice,
|
|
632
|
+
AntflySlice,
|
|
633
|
+
PAntflyBufferOut
|
|
634
|
+
]),
|
|
635
|
+
dbMergeResolverKeysJson: f("antfly_db_merge_resolver_keys_json", "uint32_t", [
|
|
636
|
+
PAntflyDb,
|
|
637
|
+
AntflySlice,
|
|
638
|
+
AntflySlice
|
|
639
|
+
]),
|
|
640
|
+
dbUnmergeResolverKeyJson: f("antfly_db_unmerge_resolver_key_json", "uint32_t", [
|
|
641
|
+
PAntflyDb,
|
|
642
|
+
AntflySlice,
|
|
643
|
+
AntflySlice,
|
|
644
|
+
PAntflyBufferOut
|
|
645
|
+
]),
|
|
646
|
+
dbSuppressResolverKeysJson: f("antfly_db_suppress_resolver_keys_json", "uint32_t", [
|
|
647
|
+
PAntflyDb,
|
|
648
|
+
AntflySlice,
|
|
649
|
+
AntflySlice,
|
|
650
|
+
PAntflyBufferOut
|
|
651
|
+
]),
|
|
652
|
+
dbUnsuppressResolverKeyJson: f("antfly_db_unsuppress_resolver_key_json", "uint32_t", [
|
|
653
|
+
PAntflyDb,
|
|
654
|
+
AntflySlice,
|
|
655
|
+
AntflySlice,
|
|
656
|
+
PAntflyBufferOut
|
|
657
|
+
]),
|
|
658
|
+
dbResolverCurationJson: f("antfly_db_resolver_curation_json", "uint32_t", [
|
|
659
|
+
PAntflyDb,
|
|
660
|
+
AntflySlice,
|
|
661
|
+
PAntflyBufferOut
|
|
662
|
+
]),
|
|
663
|
+
dbResolverReviewsJson: f("antfly_db_resolver_reviews_json", "uint32_t", [
|
|
664
|
+
PAntflyDb,
|
|
665
|
+
AntflySlice,
|
|
666
|
+
PAntflyBufferOut
|
|
667
|
+
]),
|
|
668
|
+
dbCurateEntityJson: f("antfly_db_curate_entity_json", "uint32_t", [
|
|
669
|
+
PAntflyDb,
|
|
670
|
+
AntflySlice,
|
|
671
|
+
AntflySlice,
|
|
672
|
+
AntflySlice,
|
|
673
|
+
PAntflyBufferOut
|
|
674
|
+
]),
|
|
675
|
+
dbListResolverIdentitiesJson: f("antfly_db_list_resolver_identities_json", "uint32_t", [
|
|
676
|
+
PAntflyDb,
|
|
677
|
+
PAntflyBufferOut
|
|
678
|
+
]),
|
|
679
|
+
dbSetResolverNamespaceJson: f("antfly_db_set_resolver_namespace_json", "uint32_t", [
|
|
680
|
+
PAntflyDb,
|
|
681
|
+
AntflySlice,
|
|
682
|
+
AntflySlice
|
|
683
|
+
]),
|
|
684
|
+
dbDropResolverIdentity: f("antfly_db_drop_resolver_identity", "uint32_t", [
|
|
685
|
+
PAntflyDb,
|
|
686
|
+
AntflySlice,
|
|
687
|
+
PBoolOut
|
|
688
|
+
]),
|
|
617
689
|
dbListIndexesJson: f("antfly_db_list_indexes_json", "uint32_t", [PAntflyDb, PAntflyBufferOut]),
|
|
618
690
|
dbAddIndexJson: f("antfly_db_add_index_json", "uint32_t", [PAntflyDb, AntflySlice]),
|
|
619
691
|
dbDeleteIndex: f("antfly_db_delete_index", "uint32_t", [PAntflyDb, AntflySlice, PBoolOut]),
|
|
@@ -848,6 +920,7 @@ import { basename, dirname as dirname2, join as join2 } from "path";
|
|
|
848
920
|
// src/marshal.ts
|
|
849
921
|
import { promisify } from "util";
|
|
850
922
|
import koffi3 from "koffi";
|
|
923
|
+
import { isInteger, parse as parseExact, stringify as stringifyExact } from "lossless-json";
|
|
851
924
|
function toRawBytes(input) {
|
|
852
925
|
if (Buffer.isBuffer(input)) {
|
|
853
926
|
return input;
|
|
@@ -933,6 +1006,28 @@ function txnIdBytes(id) {
|
|
|
933
1006
|
}
|
|
934
1007
|
return buf;
|
|
935
1008
|
}
|
|
1009
|
+
function memoryJsonSlice(input) {
|
|
1010
|
+
if (typeof input === "string" || input instanceof Uint8Array) return jsonSlice(input);
|
|
1011
|
+
const text = stringifyExact(input, (_key, value) => {
|
|
1012
|
+
if (typeof value === "number" && (!Number.isFinite(value) || Number.isInteger(value) && !Number.isSafeInteger(value))) {
|
|
1013
|
+
throw new RangeError(
|
|
1014
|
+
"Memory integers must be safe numbers or bigint; unsafe numbers have already lost precision"
|
|
1015
|
+
);
|
|
1016
|
+
}
|
|
1017
|
+
return value;
|
|
1018
|
+
});
|
|
1019
|
+
if (text === void 0) throw new TypeError("Memory requests must be JSON values");
|
|
1020
|
+
return stringSlice(text);
|
|
1021
|
+
}
|
|
1022
|
+
function parseMemoryJson(buf) {
|
|
1023
|
+
if (buf.length === 0) return null;
|
|
1024
|
+
return parseExact(buf.toString("utf8"), null, {
|
|
1025
|
+
parseNumber: (token) => {
|
|
1026
|
+
const value = Number(token);
|
|
1027
|
+
return isInteger(token) && !Number.isSafeInteger(value) ? BigInt(token) : value;
|
|
1028
|
+
}
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
936
1031
|
|
|
937
1032
|
// src/database.ts
|
|
938
1033
|
var OPEN_FLAG_NO_SYNC = 1 << 0;
|
|
@@ -1231,6 +1326,107 @@ var Database = class _Database {
|
|
|
1231
1326
|
setSchema(schema) {
|
|
1232
1327
|
return this.#invokeCode(this.#native.dbSetSchemaJson, jsonSlice(schema));
|
|
1233
1328
|
}
|
|
1329
|
+
async renderResolverKey(resolver, request) {
|
|
1330
|
+
return parseJson(
|
|
1331
|
+
await this.#invokeBuffer(
|
|
1332
|
+
this.#native.dbRenderResolverKeyJson,
|
|
1333
|
+
stringSlice(resolver),
|
|
1334
|
+
jsonSlice(request)
|
|
1335
|
+
)
|
|
1336
|
+
);
|
|
1337
|
+
}
|
|
1338
|
+
/** Execute native memory policy using the shared action/body envelope. */
|
|
1339
|
+
async memory(space, request) {
|
|
1340
|
+
return parseMemoryJson(
|
|
1341
|
+
await this.#invokeBuffer(
|
|
1342
|
+
this.#native.dbMemoryJson,
|
|
1343
|
+
stringSlice(space),
|
|
1344
|
+
memoryJsonSlice(request)
|
|
1345
|
+
)
|
|
1346
|
+
);
|
|
1347
|
+
}
|
|
1348
|
+
async resolveQuery(resolver, request) {
|
|
1349
|
+
return parseJson(
|
|
1350
|
+
await this.#invokeBuffer(
|
|
1351
|
+
this.#native.dbResolveQueryJson,
|
|
1352
|
+
stringSlice(resolver),
|
|
1353
|
+
jsonSlice(request)
|
|
1354
|
+
)
|
|
1355
|
+
);
|
|
1356
|
+
}
|
|
1357
|
+
async mergeResolverKeys(resolver, request) {
|
|
1358
|
+
await this.#invokeCode(
|
|
1359
|
+
this.#native.dbMergeResolverKeysJson,
|
|
1360
|
+
stringSlice(resolver),
|
|
1361
|
+
jsonSlice(request)
|
|
1362
|
+
);
|
|
1363
|
+
}
|
|
1364
|
+
async unmergeResolverKey(resolver, request) {
|
|
1365
|
+
return parseJson(
|
|
1366
|
+
await this.#invokeBuffer(
|
|
1367
|
+
this.#native.dbUnmergeResolverKeyJson,
|
|
1368
|
+
stringSlice(resolver),
|
|
1369
|
+
jsonSlice(request)
|
|
1370
|
+
)
|
|
1371
|
+
);
|
|
1372
|
+
}
|
|
1373
|
+
async suppressResolverKeys(resolver, request) {
|
|
1374
|
+
return parseJson(
|
|
1375
|
+
await this.#invokeBuffer(
|
|
1376
|
+
this.#native.dbSuppressResolverKeysJson,
|
|
1377
|
+
stringSlice(resolver),
|
|
1378
|
+
jsonSlice(request)
|
|
1379
|
+
)
|
|
1380
|
+
);
|
|
1381
|
+
}
|
|
1382
|
+
async unsuppressResolverKey(resolver, request) {
|
|
1383
|
+
return parseJson(
|
|
1384
|
+
await this.#invokeBuffer(
|
|
1385
|
+
this.#native.dbUnsuppressResolverKeyJson,
|
|
1386
|
+
stringSlice(resolver),
|
|
1387
|
+
jsonSlice(request)
|
|
1388
|
+
)
|
|
1389
|
+
);
|
|
1390
|
+
}
|
|
1391
|
+
async resolverCuration(resolver = "") {
|
|
1392
|
+
return parseJson(
|
|
1393
|
+
await this.#invokeBuffer(this.#native.dbResolverCurationJson, stringSlice(resolver))
|
|
1394
|
+
);
|
|
1395
|
+
}
|
|
1396
|
+
async resolverReviews(request) {
|
|
1397
|
+
return parseJson(
|
|
1398
|
+
await this.#invokeBuffer(this.#native.dbResolverReviewsJson, jsonSlice(request))
|
|
1399
|
+
);
|
|
1400
|
+
}
|
|
1401
|
+
async curateEntity(table, key, request) {
|
|
1402
|
+
return parseJson(
|
|
1403
|
+
await this.#invokeBuffer(
|
|
1404
|
+
this.#native.dbCurateEntityJson,
|
|
1405
|
+
stringSlice(table),
|
|
1406
|
+
stringSlice(key),
|
|
1407
|
+
jsonSlice(request)
|
|
1408
|
+
)
|
|
1409
|
+
);
|
|
1410
|
+
}
|
|
1411
|
+
async listResolverIdentities() {
|
|
1412
|
+
return parseJson(await this.#invokeBuffer(this.#native.dbListResolverIdentitiesJson));
|
|
1413
|
+
}
|
|
1414
|
+
async setResolverNamespace(resolver, request) {
|
|
1415
|
+
await this.#invokeCode(
|
|
1416
|
+
this.#native.dbSetResolverNamespaceJson,
|
|
1417
|
+
stringSlice(resolver),
|
|
1418
|
+
jsonSlice(request)
|
|
1419
|
+
);
|
|
1420
|
+
}
|
|
1421
|
+
dropResolverIdentity(resolver) {
|
|
1422
|
+
return this.#run(async (handle) => {
|
|
1423
|
+
const out = [false];
|
|
1424
|
+
checkCode(
|
|
1425
|
+
await callAsync(this.#native.dbDropResolverIdentity, handle, stringSlice(resolver), out)
|
|
1426
|
+
);
|
|
1427
|
+
return Boolean(out[0]);
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1234
1430
|
listIndexesRaw() {
|
|
1235
1431
|
return this.#invokeBuffer(this.#native.dbListIndexesJson);
|
|
1236
1432
|
}
|
package/dist/kysely.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dialect, Driver, PostgresQueryCompiler, PostgresAdapter, Kysely, MigrationLockOptions, DatabaseIntrospector } from 'kysely';
|
|
2
|
-
import { D as Database } from './database-
|
|
2
|
+
import { D as Database } from './database-D9gL3wnT.cjs';
|
|
3
3
|
import 'koffi';
|
|
4
4
|
|
|
5
5
|
declare class AntflyAdapter extends PostgresAdapter {
|
package/dist/kysely.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dialect, Driver, PostgresQueryCompiler, PostgresAdapter, Kysely, MigrationLockOptions, DatabaseIntrospector } from 'kysely';
|
|
2
|
-
import { D as Database } from './database-
|
|
2
|
+
import { D as Database } from './database-D9gL3wnT.js';
|
|
3
3
|
import 'koffi';
|
|
4
4
|
|
|
5
5
|
declare class AntflyAdapter extends PostgresAdapter {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antfly/embedded",
|
|
3
|
-
"version": "0.3.0-rc.
|
|
3
|
+
"version": "0.3.0-rc.4",
|
|
4
4
|
"description": "TypeScript/Node binding for local Antfly databases and inference (libantfly C ABI)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -63,7 +63,8 @@
|
|
|
63
63
|
"vitest": "^4.1.9"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"koffi": "^3.3.1"
|
|
66
|
+
"koffi": "^3.3.1",
|
|
67
|
+
"lossless-json": "^4.3.2"
|
|
67
68
|
},
|
|
68
69
|
"engines": {
|
|
69
70
|
"node": ">=24.0"
|
|
@@ -74,9 +75,9 @@
|
|
|
74
75
|
"win32"
|
|
75
76
|
],
|
|
76
77
|
"optionalDependencies": {
|
|
77
|
-
"@antfly/embedded-darwin-arm64": "0.3.0-rc.
|
|
78
|
-
"@antfly/embedded-linux-arm64": "0.3.0-rc.
|
|
79
|
-
"@antfly/embedded-linux-x64": "0.3.0-rc.
|
|
78
|
+
"@antfly/embedded-darwin-arm64": "0.3.0-rc.4",
|
|
79
|
+
"@antfly/embedded-linux-arm64": "0.3.0-rc.4",
|
|
80
|
+
"@antfly/embedded-linux-x64": "0.3.0-rc.4"
|
|
80
81
|
},
|
|
81
82
|
"peerDependencies": {
|
|
82
83
|
"kysely": "^0.29.6"
|