harperdb 4.5.9 → 4.6.0-alpha.2
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/bin/harperdb.js +79 -80
- package/bin/lite.js +68 -69
- package/config/yaml/defaultConfig.yaml +1 -0
- package/index.d.ts +8 -8
- package/index.js +5 -5
- package/json/systemSchema.json +13 -1
- package/launchServiceScripts/launchInstallNATSServer.js +3 -3
- package/launchServiceScripts/launchNatsIngestService.js +68 -69
- package/launchServiceScripts/launchNatsReplyService.js +68 -69
- package/launchServiceScripts/launchUpdateNodes4-0-0.js +68 -69
- package/npm-shrinkwrap.json +7 -7
- package/package.json +2 -2
- package/resources/DatabaseTransaction.d.ts +8 -8
- package/resources/ErrorResource.d.ts +2 -2
- package/resources/IterableEventQueue.d.ts +1 -1
- package/resources/RecordEncoder.d.ts +6 -6
- package/resources/Resource.d.ts +17 -17
- package/resources/ResourceInterface.d.ts +27 -12
- package/resources/Resources.d.ts +7 -5
- package/resources/Table.d.ts +73 -73
- package/resources/analytics/hostnames.d.ts +483 -0
- package/resources/analytics/metadata.d.ts +9 -0
- package/resources/analytics/read.d.ts +26 -0
- package/resources/{analytics.d.ts → analytics/write.d.ts} +33 -27
- package/resources/auditStore.d.ts +15 -15
- package/resources/crdt.d.ts +4 -4
- package/resources/databases.d.ts +102 -102
- package/resources/indexes/HierarchicalNavigableSmallWorld.d.ts +84 -0
- package/resources/indexes/customIndexes.d.ts +4 -0
- package/resources/indexes/vector.d.ts +2 -0
- package/resources/search.d.ts +8 -8
- package/resources/tracked.d.ts +6 -6
- package/resources/transaction.d.ts +3 -3
- package/resources/transactionBroadcast.d.ts +5 -5
- package/security/auth.d.ts +9 -0
- package/security/tokenAuthentication.d.ts +35 -0
- package/server/Server.d.ts +5 -2
- package/server/jobs/jobProcess.js +68 -69
- package/server/operationsServer.d.ts +30 -0
- package/server/replication/knownNodes.d.ts +35 -0
- package/server/replication/nodeIdMapping.d.ts +6 -0
- package/server/replication/replicationConnection.d.ts +58 -0
- package/server/replication/replicator.d.ts +65 -0
- package/server/replication/setNode.d.ts +15 -0
- package/server/replication/subscriptionManager.d.ts +13 -0
- package/server/serverHelpers/Headers.d.ts +2 -2
- package/server/serverHelpers/OperationFunctionObject.d.ts +8 -0
- package/server/serverHelpers/contentTypes.d.ts +7 -7
- package/server/serverHelpers/serverUtilities.d.ts +23 -0
- package/server/status.d.ts +12 -0
- package/server/threads/threadServer.js +45 -46
- package/studio/build-local/asset-manifest.json +2 -2
- package/studio/build-local/index.html +1 -1
- package/studio/build-local/static/js/main.5dea46bb.js +2 -0
- package/utility/hdbTerms.d.ts +7 -0
- package/utility/password.d.ts +20 -0
- package/utility/scripts/restartHdb.js +68 -69
- package/studio/build-local/static/js/main.491129ee.js +0 -2
- /package/studio/build-local/static/js/{main.491129ee.js.LICENSE.txt → main.5dea46bb.js.LICENSE.txt} +0 -0
|
@@ -9,10 +9,10 @@ export declare const AUDIT_STORE_OPTIONS: {
|
|
|
9
9
|
readKey(buffer: any, start: any, end: any): any;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
export declare function openAuditStore(
|
|
13
|
-
export declare function removeAuditEntry(
|
|
14
|
-
export declare function getLastRemoved(
|
|
15
|
-
export declare function setAuditRetention(
|
|
12
|
+
export declare function openAuditStore(rootStore: any): any;
|
|
13
|
+
export declare function removeAuditEntry(auditStore: any, key: number, value: any): Promise<void>;
|
|
14
|
+
export declare function getLastRemoved(auditStore: any): number;
|
|
15
|
+
export declare function setAuditRetention(retentionTime: any, defaultDelay?: number): void;
|
|
16
16
|
export declare const ACTION_32_BIT = 14;
|
|
17
17
|
export declare const ACTION_64_BIT = 15;
|
|
18
18
|
/** Used to indicate we have received a remote local time update */
|
|
@@ -24,19 +24,19 @@ export declare const HAS_EXPIRATION_EXTENDED_TYPE = 4096;
|
|
|
24
24
|
export declare const HAS_BLOBS = 8192;
|
|
25
25
|
/**
|
|
26
26
|
* Creates a binary audit entry
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
27
|
+
* @param txnTime
|
|
28
|
+
* @param tableId
|
|
29
|
+
* @param recordId
|
|
30
|
+
* @param previousLocalTime
|
|
31
|
+
* @param nodeId
|
|
32
32
|
* @param username
|
|
33
33
|
* @param type
|
|
34
|
-
* @param
|
|
35
|
-
* @param
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
34
|
+
* @param encodedRecord
|
|
35
|
+
* @param extendedType
|
|
36
|
+
* @param residencyId
|
|
37
|
+
* @param previousResidencyId
|
|
38
38
|
*/
|
|
39
|
-
export declare function createAuditEntry(
|
|
39
|
+
export declare function createAuditEntry(txnTime: any, tableId: any, recordId: any, previousLocalTime: any, nodeId: any, username: any, type: any, encodedRecord: any, extendedType: any, residencyId: any, previousResidencyId: any, expiresAt: any, originatingOperation?: string): Buffer;
|
|
40
40
|
/**
|
|
41
41
|
* Reads a audit entry from binary data
|
|
42
42
|
* @param buffer
|
|
@@ -53,7 +53,7 @@ export declare function readAuditEntry(buffer: Uint8Array, start?: number, end?:
|
|
|
53
53
|
previousLocalTime: any;
|
|
54
54
|
readonly user: import("ordered-binary").Key;
|
|
55
55
|
readonly encoded: Uint8Array<ArrayBufferLike>;
|
|
56
|
-
getValue(store: any,
|
|
56
|
+
getValue(store: any, fullRecord?: any, auditTime?: any): any;
|
|
57
57
|
getBinaryValue(): Uint8Array<ArrayBufferLike>;
|
|
58
58
|
extendedType: any;
|
|
59
59
|
residencyId: any;
|
package/resources/crdt.d.ts
CHANGED
|
@@ -5,15 +5,15 @@ export declare namespace add {
|
|
|
5
5
|
/**
|
|
6
6
|
* Rebuild a record update that has a timestamp before the provided newer update
|
|
7
7
|
* @param update
|
|
8
|
-
* @param
|
|
8
|
+
* @param newerUpdate
|
|
9
9
|
*/
|
|
10
|
-
export declare function rebuildUpdateBefore(update: any,
|
|
10
|
+
export declare function rebuildUpdateBefore(update: any, newerUpdate: any, fullUpdate?: boolean): any;
|
|
11
11
|
export declare function applyReverse(record: any, update: any): void;
|
|
12
12
|
/**
|
|
13
13
|
* Reconstruct the record state at a given timestamp by going back through the audit history and reversing any changes
|
|
14
|
-
* @param
|
|
14
|
+
* @param currentEntry
|
|
15
15
|
* @param timestamp
|
|
16
16
|
* @param store
|
|
17
17
|
* @returns
|
|
18
18
|
*/
|
|
19
|
-
export declare function getRecordAtTime(
|
|
19
|
+
export declare function getRecordAtTime(currentEntry: any, timestamp: any, store: any): any;
|
package/resources/databases.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { makeTable } from './Table';
|
|
1
|
+
import { makeTable } from './Table.ts';
|
|
2
2
|
export type Table = ReturnType<typeof makeTable>;
|
|
3
3
|
export interface Tables {
|
|
4
|
-
[
|
|
4
|
+
[tableName: string]: Table;
|
|
5
5
|
}
|
|
6
6
|
export interface Databases {
|
|
7
|
-
[
|
|
7
|
+
[databaseName: string]: Tables;
|
|
8
8
|
}
|
|
9
9
|
export declare const tables: Tables;
|
|
10
10
|
export declare const databases: Databases;
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const databaseEnvs: Map<string, any>;
|
|
12
12
|
/**
|
|
13
13
|
* This gets the set of tables from the default database ("data").
|
|
14
14
|
*/
|
|
@@ -28,10 +28,10 @@ export declare function resetDatabases(): Databases;
|
|
|
28
28
|
* This is responsible for reading the internal dbi of a single database file to get a list of all the tables and
|
|
29
29
|
* their indexed or registered attributes
|
|
30
30
|
* @param path
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
31
|
+
* @param defaultTable
|
|
32
|
+
* @param databaseName
|
|
33
33
|
*/
|
|
34
|
-
export declare function readMetaDb(path: string,
|
|
34
|
+
export declare function readMetaDb(path: string, defaultTable?: string, databaseName?: string, auditPath?: string, isLegacy?: boolean): any;
|
|
35
35
|
interface TableDefinition {
|
|
36
36
|
table: string;
|
|
37
37
|
database?: string;
|
|
@@ -53,20 +53,20 @@ interface TableDefinition {
|
|
|
53
53
|
* @param options
|
|
54
54
|
* @returns
|
|
55
55
|
*/
|
|
56
|
-
export declare function database({ database:
|
|
56
|
+
export declare function database({ database: databaseName, table: tableName }: {
|
|
57
57
|
database: any;
|
|
58
58
|
table: any;
|
|
59
59
|
}): any;
|
|
60
60
|
/**
|
|
61
61
|
* Delete the database
|
|
62
|
-
* @param
|
|
62
|
+
* @param databaseName
|
|
63
63
|
*/
|
|
64
|
-
export declare function dropDatabase(
|
|
64
|
+
export declare function dropDatabase(databaseName: any): Promise<void>;
|
|
65
65
|
/**
|
|
66
66
|
* This can be called to ensure that the specified table exists and if it does not exist, it should be created.
|
|
67
|
-
* @param
|
|
68
|
-
* @param
|
|
69
|
-
* @param
|
|
67
|
+
* @param tableName
|
|
68
|
+
* @param databaseName
|
|
69
|
+
* @param customPath
|
|
70
70
|
* @param expiration
|
|
71
71
|
* @param eviction
|
|
72
72
|
* @param scanInterval
|
|
@@ -76,8 +76,8 @@ export declare function dropDatabase(database_name: any): Promise<void>;
|
|
|
76
76
|
* @param splitSegments
|
|
77
77
|
* @param replicate
|
|
78
78
|
*/
|
|
79
|
-
export declare function table(
|
|
80
|
-
new (identifier: import("./ResourceInterface").Id, source: any): {
|
|
79
|
+
export declare function table(tableDefinition: TableDefinition): {
|
|
80
|
+
new (identifier: import("./ResourceInterface.js").Id, source: any): {
|
|
81
81
|
"__#5@#record": any;
|
|
82
82
|
"__#5@#changes": any;
|
|
83
83
|
"__#5@#version": number;
|
|
@@ -92,12 +92,12 @@ export declare function table(table_definition: TableDefinition): {
|
|
|
92
92
|
"__#5@#saveMode": boolean;
|
|
93
93
|
"__#5@#loadedFromSource": boolean;
|
|
94
94
|
ensureLoaded(): any;
|
|
95
|
-
get(query?: import("./ResourceInterface").Query | string): Promise<object | void> | object | void;
|
|
95
|
+
get(query?: import("./ResourceInterface.js").Query | string): Promise<object | void> | object | void;
|
|
96
96
|
allowRead(user: any, query: any): any;
|
|
97
|
-
allowUpdate(user: any,
|
|
98
|
-
allowCreate(user: any,
|
|
97
|
+
allowUpdate(user: any, updatedData: any): boolean;
|
|
98
|
+
allowCreate(user: any, newData: {}): boolean;
|
|
99
99
|
allowDelete(user: any): boolean;
|
|
100
|
-
update(updates?: any,
|
|
100
|
+
update(updates?: any, fullUpdate?: boolean): /*elided*/ any;
|
|
101
101
|
addTo(property: any, value: any): void;
|
|
102
102
|
subtractFrom(property: any, value: any): void;
|
|
103
103
|
getMetadata(): {
|
|
@@ -113,16 +113,16 @@ export declare function table(table_definition: TableDefinition): {
|
|
|
113
113
|
_setChanges(changes: any): void;
|
|
114
114
|
setRecord(record: any): void;
|
|
115
115
|
invalidate(): void;
|
|
116
|
-
_writeInvalidate(
|
|
116
|
+
_writeInvalidate(partialRecord?: any, options?: any): void;
|
|
117
117
|
_writeRelocate(options: any): void;
|
|
118
118
|
lock(): void;
|
|
119
119
|
put(record: any): void;
|
|
120
|
-
patch(
|
|
121
|
-
_writeUpdate(
|
|
122
|
-
delete(request?: import("./ResourceInterface").Query | string): Promise<boolean>;
|
|
120
|
+
patch(recordUpdate: any): void;
|
|
121
|
+
_writeUpdate(recordUpdate: any, fullUpdate: boolean, options?: any): void;
|
|
122
|
+
delete(request?: import("./ResourceInterface.js").Query | string): Promise<boolean>;
|
|
123
123
|
_writeDelete(options?: any): boolean;
|
|
124
|
-
search(request: import("./ResourceInterface").Query): AsyncIterable<any>;
|
|
125
|
-
subscribe(request: import("./ResourceInterface").SubscriptionRequest): Promise<{
|
|
124
|
+
search(request: import("./ResourceInterface.js").Query): AsyncIterable<any>;
|
|
125
|
+
subscribe(request: import("./ResourceInterface.js").SubscriptionRequest): Promise<{
|
|
126
126
|
listener: (key: any) => any;
|
|
127
127
|
subscriptions: [];
|
|
128
128
|
startTime?: number;
|
|
@@ -139,9 +139,9 @@ export declare function table(table_definition: TableDefinition): {
|
|
|
139
139
|
send(message: any): void;
|
|
140
140
|
getNextMessage(): any;
|
|
141
141
|
waitForDrain(): Promise<boolean>;
|
|
142
|
-
on(
|
|
142
|
+
on(eventName: any, listener: any): /*elided*/ any;
|
|
143
143
|
[Symbol.asyncIterator](): {
|
|
144
|
-
queue: import("./IterableEventQueue").IterableEventQueue;
|
|
144
|
+
queue: import("./IterableEventQueue.js").IterableEventQueue;
|
|
145
145
|
push(message: any): void;
|
|
146
146
|
next(): Promise<unknown> | {
|
|
147
147
|
value: any;
|
|
@@ -176,14 +176,14 @@ export declare function table(table_definition: TableDefinition): {
|
|
|
176
176
|
validate(record: any, patch?: any): void;
|
|
177
177
|
getUpdatedTime(): number;
|
|
178
178
|
wasLoadedFromSource(): boolean | void;
|
|
179
|
-
readonly "__#6@#id": import("./ResourceInterface").Id;
|
|
180
|
-
readonly "__#6@#context": import("./ResourceInterface").Context;
|
|
179
|
+
readonly "__#6@#id": import("./ResourceInterface.js").Id;
|
|
180
|
+
readonly "__#6@#context": import("./ResourceInterface.js").Context;
|
|
181
181
|
"__#6@#isCollection": boolean;
|
|
182
|
-
post(
|
|
182
|
+
post(newRecord: any): Promise<any>;
|
|
183
183
|
readonly isCollection: boolean;
|
|
184
|
-
connect(incomingMessages: import("./IterableEventQueue").IterableEventQueue, query?: {}): AsyncIterable<any>;
|
|
185
|
-
getId(): import("./ResourceInterface").Id;
|
|
186
|
-
getContext(): import("./ResourceInterface").Context;
|
|
184
|
+
connect(incomingMessages: import("./IterableEventQueue.js").IterableEventQueue, query?: {}): AsyncIterable<any>;
|
|
185
|
+
getId(): import("./ResourceInterface.js").Id;
|
|
186
|
+
getContext(): import("./ResourceInterface.js").Context;
|
|
187
187
|
};
|
|
188
188
|
name: any;
|
|
189
189
|
primaryStore: any;
|
|
@@ -218,14 +218,14 @@ export declare function table(table_definition: TableDefinition): {
|
|
|
218
218
|
propertyResolvers: any;
|
|
219
219
|
userResolvers: {};
|
|
220
220
|
sources: any[];
|
|
221
|
-
getResidencyById: (id: import("./ResourceInterface").Id) => number | void;
|
|
221
|
+
getResidencyById: (id: import("./ResourceInterface.js").Id) => number | void;
|
|
222
222
|
readonly expirationMS: any;
|
|
223
223
|
dbisDB: any;
|
|
224
224
|
schemaDefined: any;
|
|
225
225
|
sourcedFrom(source: any, options: any): /*elided*/ any;
|
|
226
226
|
readonly isCaching: any;
|
|
227
227
|
readonly shouldRevalidateEvents: boolean;
|
|
228
|
-
getResource(id: import("./ResourceInterface").Id, request: import("./ResourceInterface").Context,
|
|
228
|
+
getResource(id: import("./ResourceInterface.js").Id, request: import("./ResourceInterface.js").Context, resourceOptions?: any): Promise<{
|
|
229
229
|
"__#5@#record": any;
|
|
230
230
|
"__#5@#changes": any;
|
|
231
231
|
"__#5@#version": number;
|
|
@@ -240,12 +240,12 @@ export declare function table(table_definition: TableDefinition): {
|
|
|
240
240
|
"__#5@#saveMode": boolean;
|
|
241
241
|
"__#5@#loadedFromSource": boolean;
|
|
242
242
|
ensureLoaded(): any;
|
|
243
|
-
get(query?: import("./ResourceInterface").Query | string): Promise<object | void> | object | void;
|
|
243
|
+
get(query?: import("./ResourceInterface.js").Query | string): Promise<object | void> | object | void;
|
|
244
244
|
allowRead(user: any, query: any): any;
|
|
245
|
-
allowUpdate(user: any,
|
|
246
|
-
allowCreate(user: any,
|
|
245
|
+
allowUpdate(user: any, updatedData: any): boolean;
|
|
246
|
+
allowCreate(user: any, newData: {}): boolean;
|
|
247
247
|
allowDelete(user: any): boolean;
|
|
248
|
-
update(updates?: any,
|
|
248
|
+
update(updates?: any, fullUpdate?: boolean): /*elided*/ any;
|
|
249
249
|
addTo(property: any, value: any): void;
|
|
250
250
|
subtractFrom(property: any, value: any): void;
|
|
251
251
|
getMetadata(): {
|
|
@@ -261,16 +261,16 @@ export declare function table(table_definition: TableDefinition): {
|
|
|
261
261
|
_setChanges(changes: any): void;
|
|
262
262
|
setRecord(record: any): void;
|
|
263
263
|
invalidate(): void;
|
|
264
|
-
_writeInvalidate(
|
|
264
|
+
_writeInvalidate(partialRecord?: any, options?: any): void;
|
|
265
265
|
_writeRelocate(options: any): void;
|
|
266
266
|
lock(): void;
|
|
267
267
|
put(record: any): void;
|
|
268
|
-
patch(
|
|
269
|
-
_writeUpdate(
|
|
270
|
-
delete(request?: import("./ResourceInterface").Query | string): Promise<boolean>;
|
|
268
|
+
patch(recordUpdate: any): void;
|
|
269
|
+
_writeUpdate(recordUpdate: any, fullUpdate: boolean, options?: any): void;
|
|
270
|
+
delete(request?: import("./ResourceInterface.js").Query | string): Promise<boolean>;
|
|
271
271
|
_writeDelete(options?: any): boolean;
|
|
272
|
-
search(request: import("./ResourceInterface").Query): AsyncIterable<any>;
|
|
273
|
-
subscribe(request: import("./ResourceInterface").SubscriptionRequest): Promise<{
|
|
272
|
+
search(request: import("./ResourceInterface.js").Query): AsyncIterable<any>;
|
|
273
|
+
subscribe(request: import("./ResourceInterface.js").SubscriptionRequest): Promise<{
|
|
274
274
|
listener: (key: any) => any;
|
|
275
275
|
subscriptions: [];
|
|
276
276
|
startTime?: number;
|
|
@@ -287,9 +287,9 @@ export declare function table(table_definition: TableDefinition): {
|
|
|
287
287
|
send(message: any): void;
|
|
288
288
|
getNextMessage(): any;
|
|
289
289
|
waitForDrain(): Promise<boolean>;
|
|
290
|
-
on(
|
|
290
|
+
on(eventName: any, listener: any): /*elided*/ any;
|
|
291
291
|
[Symbol.asyncIterator](): {
|
|
292
|
-
queue: import("./IterableEventQueue").IterableEventQueue;
|
|
292
|
+
queue: import("./IterableEventQueue.js").IterableEventQueue;
|
|
293
293
|
push(message: any): void;
|
|
294
294
|
next(): Promise<unknown> | {
|
|
295
295
|
value: any;
|
|
@@ -324,14 +324,14 @@ export declare function table(table_definition: TableDefinition): {
|
|
|
324
324
|
validate(record: any, patch?: any): void;
|
|
325
325
|
getUpdatedTime(): number;
|
|
326
326
|
wasLoadedFromSource(): boolean | void;
|
|
327
|
-
readonly "__#6@#id": import("./ResourceInterface").Id;
|
|
328
|
-
readonly "__#6@#context": import("./ResourceInterface").Context;
|
|
327
|
+
readonly "__#6@#id": import("./ResourceInterface.js").Id;
|
|
328
|
+
readonly "__#6@#context": import("./ResourceInterface.js").Context;
|
|
329
329
|
"__#6@#isCollection": boolean;
|
|
330
|
-
post(
|
|
330
|
+
post(newRecord: any): Promise<any>;
|
|
331
331
|
readonly isCollection: boolean;
|
|
332
|
-
connect(incomingMessages: import("./IterableEventQueue").IterableEventQueue, query?: {}): AsyncIterable<any>;
|
|
333
|
-
getId(): import("./ResourceInterface").Id;
|
|
334
|
-
getContext(): import("./ResourceInterface").Context;
|
|
332
|
+
connect(incomingMessages: import("./IterableEventQueue.js").IterableEventQueue, query?: {}): AsyncIterable<any>;
|
|
333
|
+
getId(): import("./ResourceInterface.js").Id;
|
|
334
|
+
getContext(): import("./ResourceInterface.js").Context;
|
|
335
335
|
}> | {
|
|
336
336
|
"__#5@#record": any;
|
|
337
337
|
"__#5@#changes": any;
|
|
@@ -347,12 +347,12 @@ export declare function table(table_definition: TableDefinition): {
|
|
|
347
347
|
"__#5@#saveMode": boolean;
|
|
348
348
|
"__#5@#loadedFromSource": boolean;
|
|
349
349
|
ensureLoaded(): any;
|
|
350
|
-
get(query?: import("./ResourceInterface").Query | string): Promise<object | void> | object | void;
|
|
350
|
+
get(query?: import("./ResourceInterface.js").Query | string): Promise<object | void> | object | void;
|
|
351
351
|
allowRead(user: any, query: any): any;
|
|
352
|
-
allowUpdate(user: any,
|
|
353
|
-
allowCreate(user: any,
|
|
352
|
+
allowUpdate(user: any, updatedData: any): boolean;
|
|
353
|
+
allowCreate(user: any, newData: {}): boolean;
|
|
354
354
|
allowDelete(user: any): boolean;
|
|
355
|
-
update(updates?: any,
|
|
355
|
+
update(updates?: any, fullUpdate?: boolean): /*elided*/ any;
|
|
356
356
|
addTo(property: any, value: any): void;
|
|
357
357
|
subtractFrom(property: any, value: any): void;
|
|
358
358
|
getMetadata(): {
|
|
@@ -368,16 +368,16 @@ export declare function table(table_definition: TableDefinition): {
|
|
|
368
368
|
_setChanges(changes: any): void;
|
|
369
369
|
setRecord(record: any): void;
|
|
370
370
|
invalidate(): void;
|
|
371
|
-
_writeInvalidate(
|
|
371
|
+
_writeInvalidate(partialRecord?: any, options?: any): void;
|
|
372
372
|
_writeRelocate(options: any): void;
|
|
373
373
|
lock(): void;
|
|
374
374
|
put(record: any): void;
|
|
375
|
-
patch(
|
|
376
|
-
_writeUpdate(
|
|
377
|
-
delete(request?: import("./ResourceInterface").Query | string): Promise<boolean>;
|
|
375
|
+
patch(recordUpdate: any): void;
|
|
376
|
+
_writeUpdate(recordUpdate: any, fullUpdate: boolean, options?: any): void;
|
|
377
|
+
delete(request?: import("./ResourceInterface.js").Query | string): Promise<boolean>;
|
|
378
378
|
_writeDelete(options?: any): boolean;
|
|
379
|
-
search(request: import("./ResourceInterface").Query): AsyncIterable<any>;
|
|
380
|
-
subscribe(request: import("./ResourceInterface").SubscriptionRequest): Promise<{
|
|
379
|
+
search(request: import("./ResourceInterface.js").Query): AsyncIterable<any>;
|
|
380
|
+
subscribe(request: import("./ResourceInterface.js").SubscriptionRequest): Promise<{
|
|
381
381
|
listener: (key: any) => any;
|
|
382
382
|
subscriptions: [];
|
|
383
383
|
startTime?: number;
|
|
@@ -394,9 +394,9 @@ export declare function table(table_definition: TableDefinition): {
|
|
|
394
394
|
send(message: any): void;
|
|
395
395
|
getNextMessage(): any;
|
|
396
396
|
waitForDrain(): Promise<boolean>;
|
|
397
|
-
on(
|
|
397
|
+
on(eventName: any, listener: any): /*elided*/ any;
|
|
398
398
|
[Symbol.asyncIterator](): {
|
|
399
|
-
queue: import("./IterableEventQueue").IterableEventQueue;
|
|
399
|
+
queue: import("./IterableEventQueue.js").IterableEventQueue;
|
|
400
400
|
push(message: any): void;
|
|
401
401
|
next(): Promise<unknown> | {
|
|
402
402
|
value: any;
|
|
@@ -431,14 +431,14 @@ export declare function table(table_definition: TableDefinition): {
|
|
|
431
431
|
validate(record: any, patch?: any): void;
|
|
432
432
|
getUpdatedTime(): number;
|
|
433
433
|
wasLoadedFromSource(): boolean | void;
|
|
434
|
-
readonly "__#6@#id": import("./ResourceInterface").Id;
|
|
435
|
-
readonly "__#6@#context": import("./ResourceInterface").Context;
|
|
434
|
+
readonly "__#6@#id": import("./ResourceInterface.js").Id;
|
|
435
|
+
readonly "__#6@#context": import("./ResourceInterface.js").Context;
|
|
436
436
|
"__#6@#isCollection": boolean;
|
|
437
|
-
post(
|
|
437
|
+
post(newRecord: any): Promise<any>;
|
|
438
438
|
readonly isCollection: boolean;
|
|
439
|
-
connect(incomingMessages: import("./IterableEventQueue").IterableEventQueue, query?: {}): AsyncIterable<any>;
|
|
440
|
-
getId(): import("./ResourceInterface").Id;
|
|
441
|
-
getContext(): import("./ResourceInterface").Context;
|
|
439
|
+
connect(incomingMessages: import("./IterableEventQueue.js").IterableEventQueue, query?: {}): AsyncIterable<any>;
|
|
440
|
+
getId(): import("./ResourceInterface.js").Id;
|
|
441
|
+
getContext(): import("./ResourceInterface.js").Context;
|
|
442
442
|
};
|
|
443
443
|
_updateResource(resource: any, entry: any): void;
|
|
444
444
|
getNewId(): any;
|
|
@@ -448,19 +448,19 @@ export declare function table(table_definition: TableDefinition): {
|
|
|
448
448
|
scanInterval?: number;
|
|
449
449
|
}): void;
|
|
450
450
|
getResidencyRecord(id: any): any;
|
|
451
|
-
setResidency(getResidency?: (record: object, context: import("./ResourceInterface").Context) => number | void | string[]): void;
|
|
452
|
-
setResidencyById(getResidencyById?: (id: import("./ResourceInterface").Id) => number | void): void;
|
|
453
|
-
getResidency(record: object, context: import("./ResourceInterface").Context): number | void | string[];
|
|
454
|
-
enableAuditing(
|
|
451
|
+
setResidency(getResidency?: (record: object, context: import("./ResourceInterface.js").Context) => number | void | string[]): void;
|
|
452
|
+
setResidencyById(getResidencyById?: (id: import("./ResourceInterface.js").Id) => number | void): void;
|
|
453
|
+
getResidency(record: object, context: import("./ResourceInterface.js").Context): number | void | string[];
|
|
454
|
+
enableAuditing(auditEnabled?: boolean): void;
|
|
455
455
|
coerceId(id: string): number | string;
|
|
456
456
|
dropTable(): Promise<void>;
|
|
457
|
-
_recordRelocate(
|
|
458
|
-
evict(id: any,
|
|
457
|
+
_recordRelocate(existingEntry: any, entry: any): void;
|
|
458
|
+
evict(id: any, existingRecord: any, existingVersion: any): Promise<void>;
|
|
459
459
|
operation(operation: any, context: any): any;
|
|
460
|
-
transformToOrderedSelect(entries: any[], select: (string | import("./ResourceInterface").SubSelect)[], sort: import("./ResourceInterface").Sort, context: import("./ResourceInterface").Context,
|
|
461
|
-
transformEntryForSelect(select: any, context: any,
|
|
462
|
-
subscribeOnThisThread(
|
|
463
|
-
addAttributes(
|
|
460
|
+
transformToOrderedSelect(entries: any[], select: (string | import("./ResourceInterface.js").SubSelect)[], sort: import("./ResourceInterface.js").Sort, context: import("./ResourceInterface.js").Context, readTxn: any, transformToRecord: Function): any;
|
|
461
|
+
transformEntryForSelect(select: any, context: any, readTxn: any, filtered: any, ensure_loaded?: any, canSkip?: any): (entry: any) => any;
|
|
462
|
+
subscribeOnThisThread(workerIndex: any, options: any): boolean;
|
|
463
|
+
addAttributes(attributesToAdd: any): Promise<any>;
|
|
464
464
|
removeAttributes(names: string[]): Promise<any>;
|
|
465
465
|
getSize(): number;
|
|
466
466
|
getAuditSize(): number;
|
|
@@ -478,8 +478,8 @@ export declare function table(table_definition: TableDefinition): {
|
|
|
478
478
|
}>;
|
|
479
479
|
updatedAttributes(): void;
|
|
480
480
|
setComputedAttribute(attribute_name: any, resolver: any): void;
|
|
481
|
-
deleteHistory(
|
|
482
|
-
getHistory(
|
|
481
|
+
deleteHistory(endTime?: number, cleanupDeletedRecords?: boolean): Promise<void>;
|
|
482
|
+
getHistory(startTime?: number, endTime?: number): AsyncGenerator<{
|
|
483
483
|
id: import("ordered-binary").Key;
|
|
484
484
|
localTime: any;
|
|
485
485
|
version: any;
|
|
@@ -490,66 +490,66 @@ export declare function table(table_definition: TableDefinition): {
|
|
|
490
490
|
}, void, unknown>;
|
|
491
491
|
getHistoryOfRecord(id: any): Promise<any[]>;
|
|
492
492
|
cleanup(): void;
|
|
493
|
-
transactions: import("./DatabaseTransaction").Transaction[] & {
|
|
493
|
+
transactions: import("./DatabaseTransaction.js").Transaction[] & {
|
|
494
494
|
timestamp: number;
|
|
495
495
|
};
|
|
496
496
|
directURLMapping: boolean;
|
|
497
|
-
get(identifier: import("./ResourceInterface").Id, context?: import("./ResourceInterface").Context): Promise<import("./Resource").Resource>;
|
|
498
|
-
get(query: import("./ResourceInterface").Query, context?: import("./ResourceInterface").Context): Promise<AsyncIterable<object>>;
|
|
497
|
+
get(identifier: import("./ResourceInterface.js").Id, context?: import("./ResourceInterface.js").Context): Promise<import("./Resource.js").Resource>;
|
|
498
|
+
get(query: import("./ResourceInterface.js").Query, context?: import("./ResourceInterface.js").Context): Promise<AsyncIterable<object>>;
|
|
499
499
|
put: {
|
|
500
|
-
(
|
|
500
|
+
(idOrQuery: string | import("./ResourceInterface.js").Id, dataOrContext?: any, context?: import("./ResourceInterface.js").Context): any;
|
|
501
501
|
reliesOnPrototype: boolean;
|
|
502
502
|
};
|
|
503
503
|
patch: {
|
|
504
|
-
(
|
|
504
|
+
(idOrQuery: string | import("./ResourceInterface.js").Id, dataOrContext?: any, context?: import("./ResourceInterface.js").Context): any;
|
|
505
505
|
reliesOnPrototype: boolean;
|
|
506
506
|
};
|
|
507
|
-
delete(identifier: import("./ResourceInterface").Id, context?: import("./ResourceInterface").Context): Promise<boolean>;
|
|
508
|
-
delete(request: import("./ResourceInterface").Context, context?: import("./ResourceInterface").Context): Promise<object>;
|
|
509
|
-
create(
|
|
510
|
-
create(record: any, context: import("./ResourceInterface").Context): Promise<import("./ResourceInterface").Id>;
|
|
507
|
+
delete(identifier: import("./ResourceInterface.js").Id, context?: import("./ResourceInterface.js").Context): Promise<boolean>;
|
|
508
|
+
delete(request: import("./ResourceInterface.js").Context, context?: import("./ResourceInterface.js").Context): Promise<object>;
|
|
509
|
+
create(idPrefix: import("./ResourceInterface.js").Id, record: any, context: import("./ResourceInterface.js").Context): Promise<import("./ResourceInterface.js").Id>;
|
|
510
|
+
create(record: any, context: import("./ResourceInterface.js").Context): Promise<import("./ResourceInterface.js").Id>;
|
|
511
511
|
invalidate: {
|
|
512
|
-
(
|
|
512
|
+
(idOrQuery: string | import("./ResourceInterface.js").Id, dataOrContext?: any, context?: import("./ResourceInterface.js").Context): any;
|
|
513
513
|
reliesOnPrototype: boolean;
|
|
514
514
|
};
|
|
515
515
|
post: {
|
|
516
|
-
(
|
|
516
|
+
(idOrQuery: string | import("./ResourceInterface.js").Id, dataOrContext?: any, context?: import("./ResourceInterface.js").Context): any;
|
|
517
517
|
reliesOnPrototype: boolean;
|
|
518
518
|
};
|
|
519
519
|
connect: {
|
|
520
|
-
(
|
|
520
|
+
(idOrQuery: string | import("./ResourceInterface.js").Id, dataOrContext?: any, context?: import("./ResourceInterface.js").Context): any;
|
|
521
521
|
reliesOnPrototype: boolean;
|
|
522
522
|
};
|
|
523
|
-
subscribe(request: import("./ResourceInterface").SubscriptionRequest): Promise<AsyncIterable<{
|
|
523
|
+
subscribe(request: import("./ResourceInterface.js").SubscriptionRequest): Promise<AsyncIterable<{
|
|
524
524
|
id: any;
|
|
525
525
|
operation: string;
|
|
526
526
|
value: object;
|
|
527
527
|
}>>;
|
|
528
528
|
publish: {
|
|
529
|
-
(
|
|
529
|
+
(idOrQuery: string | import("./ResourceInterface.js").Id, dataOrContext?: any, context?: import("./ResourceInterface.js").Context): any;
|
|
530
530
|
reliesOnPrototype: boolean;
|
|
531
531
|
};
|
|
532
532
|
search: {
|
|
533
|
-
(
|
|
533
|
+
(idOrQuery: string | import("./ResourceInterface.js").Id, dataOrContext?: any, context?: import("./ResourceInterface.js").Context): any;
|
|
534
534
|
reliesOnPrototype: boolean;
|
|
535
535
|
};
|
|
536
536
|
query: {
|
|
537
|
-
(
|
|
537
|
+
(idOrQuery: string | import("./ResourceInterface.js").Id, dataOrContext?: any, context?: import("./ResourceInterface.js").Context): any;
|
|
538
538
|
reliesOnPrototype: boolean;
|
|
539
539
|
};
|
|
540
540
|
copy: {
|
|
541
|
-
(
|
|
541
|
+
(idOrQuery: string | import("./ResourceInterface.js").Id, dataOrContext?: any, context?: import("./ResourceInterface.js").Context): any;
|
|
542
542
|
reliesOnPrototype: boolean;
|
|
543
543
|
};
|
|
544
544
|
move: {
|
|
545
|
-
(
|
|
545
|
+
(idOrQuery: string | import("./ResourceInterface.js").Id, dataOrContext?: any, context?: import("./ResourceInterface.js").Context): any;
|
|
546
546
|
reliesOnPrototype: boolean;
|
|
547
547
|
};
|
|
548
548
|
isCollection(resource: any): any;
|
|
549
549
|
parseQuery(search: any): any;
|
|
550
550
|
parsePath(path: any, context: any, query: any): any;
|
|
551
551
|
};
|
|
552
|
-
export declare function dropTableMeta({ table:
|
|
552
|
+
export declare function dropTableMeta({ table: tableName, database: databaseName }: {
|
|
553
553
|
table: any;
|
|
554
554
|
database: any;
|
|
555
555
|
}): Promise<any[]>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Id } from '../../resources/ResourceInterface.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a Hierarchical Navigable Small World (HNSW) index for approximate nearest neighbor search.
|
|
4
|
+
* This implementation is based on hierarchical graph navigation to efficiently index and search high-dimensional vectors.
|
|
5
|
+
* A HNSW is basically a multi-dimensional skip list. Each node has (potentially) higher levels that are used for quickly
|
|
6
|
+
* traversing the graph get in the neighborhood of the node, and then lower levels are used to more accurately find the
|
|
7
|
+
* closest neighbors.
|
|
8
|
+
*
|
|
9
|
+
* This implementation is based on the paper "Efficient and Robust Approximate Nearest Neighbor Search in High Dimensions"
|
|
10
|
+
* (mostly influenced AI's contributions)
|
|
11
|
+
*/
|
|
12
|
+
export declare class HierarchicalNavigableSmallWorld {
|
|
13
|
+
static useObjectStore: boolean;
|
|
14
|
+
indexStore: any;
|
|
15
|
+
M: number;
|
|
16
|
+
efConstruction: number;
|
|
17
|
+
efConstructionSearch: number;
|
|
18
|
+
mL: number;
|
|
19
|
+
optimizeRouting: number;
|
|
20
|
+
nodesVisitedCount: number;
|
|
21
|
+
idIncrementer: BigInt64Array | undefined;
|
|
22
|
+
distance: (a: number[], b: number[]) => number;
|
|
23
|
+
constructor(indexStore: any, options: any);
|
|
24
|
+
index(primaryKey: Id, vector: number[], existingVector?: number[]): void;
|
|
25
|
+
private getEntryPoint;
|
|
26
|
+
/**
|
|
27
|
+
* Search one layer of the skip-list using HNSW algorithm for creating a candidate list and navigating the graph
|
|
28
|
+
* TODO: This should be async, but we can't really do that with lmdb-js's transaction system right now. Should be
|
|
29
|
+
* doable with RocksDB. We could also create an async version for searching.
|
|
30
|
+
* @param queryVector
|
|
31
|
+
* @param entryPointId
|
|
32
|
+
* @param entryPoint
|
|
33
|
+
* @param ef
|
|
34
|
+
* @param level
|
|
35
|
+
* @param distanceFunction
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
private searchLayer;
|
|
39
|
+
/**
|
|
40
|
+
* This the main entry from Harper's query functionality, where we actually search for an ordered list of nearest
|
|
41
|
+
* neighbors, using the provided sort/order definition object and performing the multi-layer skip-list search.
|
|
42
|
+
* This returns an iterable of the nearest neighbors to the provided target vector, with nearest ordered first.
|
|
43
|
+
* @param target
|
|
44
|
+
* @param value
|
|
45
|
+
* @param descending
|
|
46
|
+
* @param distance
|
|
47
|
+
* @param comparator
|
|
48
|
+
* @param context
|
|
49
|
+
*/
|
|
50
|
+
search({ target, value, descending, distance, comparator, }: {
|
|
51
|
+
target: number[];
|
|
52
|
+
value: number;
|
|
53
|
+
descending: boolean;
|
|
54
|
+
distance: string;
|
|
55
|
+
comparator: string;
|
|
56
|
+
}): {
|
|
57
|
+
key: string;
|
|
58
|
+
distance: number;
|
|
59
|
+
}[];
|
|
60
|
+
private checkSymmetry;
|
|
61
|
+
private addConnection;
|
|
62
|
+
validateConnectivity(startLevel?: number): {
|
|
63
|
+
isFullyConnected: boolean;
|
|
64
|
+
averageConnections: number;
|
|
65
|
+
};
|
|
66
|
+
get totalNodes(): number;
|
|
67
|
+
/**
|
|
68
|
+
* This is used by the query planner to determine what order to apply conditions. Our best guess at an estimated count.
|
|
69
|
+
* This unit is typically the number of records that need to be accessed to satisfy the query. From my testing, the
|
|
70
|
+
* best guess at the number of nodes that need to be accessed is the geometric mean of the total number of nodes
|
|
71
|
+
* and the efConstruction parameter (for search).
|
|
72
|
+
*
|
|
73
|
+
* @returns
|
|
74
|
+
*/
|
|
75
|
+
estimateCount(): number;
|
|
76
|
+
/**
|
|
77
|
+
* This is used to resolve the vector property, which should be resolved to the distance when used in a sort comparator
|
|
78
|
+
* We also want to cache distance calculations so they can be accessed efficently later
|
|
79
|
+
* @param vector
|
|
80
|
+
* @param context
|
|
81
|
+
* @param entry
|
|
82
|
+
*/
|
|
83
|
+
propertyResolver(vector: number[], context: any, entry: any): any;
|
|
84
|
+
}
|