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.
Files changed (60) hide show
  1. package/README.md +1 -1
  2. package/bin/harperdb.js +79 -80
  3. package/bin/lite.js +68 -69
  4. package/config/yaml/defaultConfig.yaml +1 -0
  5. package/index.d.ts +8 -8
  6. package/index.js +5 -5
  7. package/json/systemSchema.json +13 -1
  8. package/launchServiceScripts/launchInstallNATSServer.js +3 -3
  9. package/launchServiceScripts/launchNatsIngestService.js +68 -69
  10. package/launchServiceScripts/launchNatsReplyService.js +68 -69
  11. package/launchServiceScripts/launchUpdateNodes4-0-0.js +68 -69
  12. package/npm-shrinkwrap.json +7 -7
  13. package/package.json +2 -2
  14. package/resources/DatabaseTransaction.d.ts +8 -8
  15. package/resources/ErrorResource.d.ts +2 -2
  16. package/resources/IterableEventQueue.d.ts +1 -1
  17. package/resources/RecordEncoder.d.ts +6 -6
  18. package/resources/Resource.d.ts +17 -17
  19. package/resources/ResourceInterface.d.ts +27 -12
  20. package/resources/Resources.d.ts +7 -5
  21. package/resources/Table.d.ts +73 -73
  22. package/resources/analytics/hostnames.d.ts +483 -0
  23. package/resources/analytics/metadata.d.ts +9 -0
  24. package/resources/analytics/read.d.ts +26 -0
  25. package/resources/{analytics.d.ts → analytics/write.d.ts} +33 -27
  26. package/resources/auditStore.d.ts +15 -15
  27. package/resources/crdt.d.ts +4 -4
  28. package/resources/databases.d.ts +102 -102
  29. package/resources/indexes/HierarchicalNavigableSmallWorld.d.ts +84 -0
  30. package/resources/indexes/customIndexes.d.ts +4 -0
  31. package/resources/indexes/vector.d.ts +2 -0
  32. package/resources/search.d.ts +8 -8
  33. package/resources/tracked.d.ts +6 -6
  34. package/resources/transaction.d.ts +3 -3
  35. package/resources/transactionBroadcast.d.ts +5 -5
  36. package/security/auth.d.ts +9 -0
  37. package/security/tokenAuthentication.d.ts +35 -0
  38. package/server/Server.d.ts +5 -2
  39. package/server/jobs/jobProcess.js +68 -69
  40. package/server/operationsServer.d.ts +30 -0
  41. package/server/replication/knownNodes.d.ts +35 -0
  42. package/server/replication/nodeIdMapping.d.ts +6 -0
  43. package/server/replication/replicationConnection.d.ts +58 -0
  44. package/server/replication/replicator.d.ts +65 -0
  45. package/server/replication/setNode.d.ts +15 -0
  46. package/server/replication/subscriptionManager.d.ts +13 -0
  47. package/server/serverHelpers/Headers.d.ts +2 -2
  48. package/server/serverHelpers/OperationFunctionObject.d.ts +8 -0
  49. package/server/serverHelpers/contentTypes.d.ts +7 -7
  50. package/server/serverHelpers/serverUtilities.d.ts +23 -0
  51. package/server/status.d.ts +12 -0
  52. package/server/threads/threadServer.js +45 -46
  53. package/studio/build-local/asset-manifest.json +2 -2
  54. package/studio/build-local/index.html +1 -1
  55. package/studio/build-local/static/js/main.5dea46bb.js +2 -0
  56. package/utility/hdbTerms.d.ts +7 -0
  57. package/utility/password.d.ts +20 -0
  58. package/utility/scripts/restartHdb.js +68 -69
  59. package/studio/build-local/static/js/main.491129ee.js +0 -2
  60. /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(root_store: any): any;
13
- export declare function removeAuditEntry(audit_store: any, key: number, value: any): Promise<void>;
14
- export declare function getLastRemoved(audit_store: any): number;
15
- export declare function setAuditRetention(retention_time: any, default_delay?: number): void;
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 txn_time
28
- * @param table_id
29
- * @param record_id
30
- * @param previous_local_time
31
- * @param node_id
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 encoded_record
35
- * @param extended_type
36
- * @param residency_id
37
- * @param previous_residency_id
34
+ * @param encodedRecord
35
+ * @param extendedType
36
+ * @param residencyId
37
+ * @param previousResidencyId
38
38
  */
39
- export declare function createAuditEntry(txn_time: any, table_id: any, record_id: any, previous_local_time: any, node_id: any, username: any, type: any, encoded_record: any, extended_type: any, residency_id: any, previous_residency_id: any, expires_at: any, originating_operation?: string): Buffer;
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, full_record?: any, audit_time?: any): any;
56
+ getValue(store: any, fullRecord?: any, auditTime?: any): any;
57
57
  getBinaryValue(): Uint8Array<ArrayBufferLike>;
58
58
  extendedType: any;
59
59
  residencyId: any;
@@ -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 newer_update
8
+ * @param newerUpdate
9
9
  */
10
- export declare function rebuildUpdateBefore(update: any, newer_update: any, full_update?: boolean): 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 current_entry
14
+ * @param currentEntry
15
15
  * @param timestamp
16
16
  * @param store
17
17
  * @returns
18
18
  */
19
- export declare function getRecordAtTime(current_entry: any, timestamp: any, store: any): any;
19
+ export declare function getRecordAtTime(currentEntry: any, timestamp: any, store: any): any;
@@ -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
- [table_name: string]: Table;
4
+ [tableName: string]: Table;
5
5
  }
6
6
  export interface Databases {
7
- [database_name: string]: Tables;
7
+ [databaseName: string]: Tables;
8
8
  }
9
9
  export declare const tables: Tables;
10
10
  export declare const databases: Databases;
11
- export declare const database_envs: Map<string, any>;
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 default_table
32
- * @param database_name
31
+ * @param defaultTable
32
+ * @param databaseName
33
33
  */
34
- export declare function readMetaDb(path: string, default_table?: string, database_name?: string, audit_path?: string, is_legacy?: boolean): any;
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: database_name, table: table_name }: {
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 database_name
62
+ * @param databaseName
63
63
  */
64
- export declare function dropDatabase(database_name: any): Promise<void>;
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 table_name
68
- * @param database_name
69
- * @param custom_path
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(table_definition: TableDefinition): {
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, updated_data: any): boolean;
98
- allowCreate(user: any, new_data: {}): boolean;
97
+ allowUpdate(user: any, updatedData: any): boolean;
98
+ allowCreate(user: any, newData: {}): boolean;
99
99
  allowDelete(user: any): boolean;
100
- update(updates?: any, full_update?: boolean): /*elided*/ 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(partial_record?: any, options?: any): void;
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(record_update: any): void;
121
- _writeUpdate(record_update: any, full_update: boolean, options?: any): void;
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(event_name: any, listener: any): /*elided*/ any;
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(new_record: any): Promise<any>;
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, resource_options?: any): Promise<{
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, updated_data: any): boolean;
246
- allowCreate(user: any, new_data: {}): boolean;
245
+ allowUpdate(user: any, updatedData: any): boolean;
246
+ allowCreate(user: any, newData: {}): boolean;
247
247
  allowDelete(user: any): boolean;
248
- update(updates?: any, full_update?: boolean): /*elided*/ 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(partial_record?: any, options?: any): void;
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(record_update: any): void;
269
- _writeUpdate(record_update: any, full_update: boolean, options?: any): void;
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(event_name: any, listener: any): /*elided*/ any;
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(new_record: any): Promise<any>;
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, updated_data: any): boolean;
353
- allowCreate(user: any, new_data: {}): boolean;
352
+ allowUpdate(user: any, updatedData: any): boolean;
353
+ allowCreate(user: any, newData: {}): boolean;
354
354
  allowDelete(user: any): boolean;
355
- update(updates?: any, full_update?: boolean): /*elided*/ 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(partial_record?: any, options?: any): void;
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(record_update: any): void;
376
- _writeUpdate(record_update: any, full_update: boolean, options?: any): void;
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(event_name: any, listener: any): /*elided*/ any;
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(new_record: any): Promise<any>;
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(audit_enabled?: boolean): void;
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(existing_entry: any, entry: any): void;
458
- evict(id: any, existing_record: any, existing_version: any): Promise<void>;
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, read_txn: any, transformToRecord: Function): any;
461
- transformEntryForSelect(select: any, context: any, read_txn: any, filtered: any, ensure_loaded?: any, can_skip?: any): (entry: any) => any;
462
- subscribeOnThisThread(worker_index: any, options: any): boolean;
463
- addAttributes(attributes_to_add: any): Promise<any>;
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(end_time?: number, cleanup_deleted_records?: boolean): Promise<void>;
482
- getHistory(start_time?: number, end_time?: number): AsyncGenerator<{
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
- (id_or_query: string | import("./ResourceInterface").Id, data_or_context?: any, context?: import("./ResourceInterface").Context): any;
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
- (id_or_query: string | import("./ResourceInterface").Id, data_or_context?: any, context?: import("./ResourceInterface").Context): any;
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(id_prefix: import("./ResourceInterface").Id, record: any, context: import("./ResourceInterface").Context): Promise<import("./ResourceInterface").Id>;
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
- (id_or_query: string | import("./ResourceInterface").Id, data_or_context?: any, context?: import("./ResourceInterface").Context): any;
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
- (id_or_query: string | import("./ResourceInterface").Id, data_or_context?: any, context?: import("./ResourceInterface").Context): any;
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
- (id_or_query: string | import("./ResourceInterface").Id, data_or_context?: any, context?: import("./ResourceInterface").Context): any;
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
- (id_or_query: string | import("./ResourceInterface").Id, data_or_context?: any, context?: import("./ResourceInterface").Context): any;
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
- (id_or_query: string | import("./ResourceInterface").Id, data_or_context?: any, context?: import("./ResourceInterface").Context): any;
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
- (id_or_query: string | import("./ResourceInterface").Id, data_or_context?: any, context?: import("./ResourceInterface").Context): any;
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
- (id_or_query: string | import("./ResourceInterface").Id, data_or_context?: any, context?: import("./ResourceInterface").Context): any;
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
- (id_or_query: string | import("./ResourceInterface").Id, data_or_context?: any, context?: import("./ResourceInterface").Context): any;
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: table_name, database: database_name }: {
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
+ }
@@ -0,0 +1,4 @@
1
+ import { HierarchicalNavigableSmallWorld } from './HierarchicalNavigableSmallWorld.ts';
2
+ export declare const CUSTOM_INDEXES: {
3
+ HNSW: typeof HierarchicalNavigableSmallWorld;
4
+ };
@@ -0,0 +1,2 @@
1
+ export declare function euclideanDistance(a: number[], b: number[]): number;
2
+ export declare function cosineDistance(a: number[], b: number[]): number;