harperdb 4.3.0-alpha.1 → 4.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harperdb",
3
- "version": "4.3.0-alpha.1",
3
+ "version": "4.3.0-alpha.2",
4
4
  "description": "HarperDB is a distributed SQL & NoSQL data platform focused on speed, flexibility, and ease of use.",
5
5
  "keywords": [
6
6
  "database",
@@ -68,14 +68,14 @@
68
68
  "json2csv": "5.0.7",
69
69
  "jsonata": "1.8.6",
70
70
  "jsonwebtoken": "9.0.2",
71
- "lmdb": "2.9.2",
71
+ "lmdb": "2.9.3-beta.2",
72
72
  "lodash": "4.17.21",
73
73
  "mathjs": "11.11.2",
74
74
  "minimist": "1.2.8",
75
75
  "mkcert": "1.5.1",
76
76
  "moment": "2.29.4",
77
77
  "mqtt-packet": "~8.2.1",
78
- "msgpackr": "1.10.0",
78
+ "msgpackr": "1.10.1",
79
79
  "nats": "2.17.0",
80
80
  "needle": "3.2.0",
81
81
  "node-stream-zip": "1.15.0",
@@ -23,7 +23,7 @@ export declare class DatabaseTransaction implements Transaction {
23
23
  close?: boolean;
24
24
  timestamp?: number;
25
25
  }): Promise<CommitResolution>;
26
- abort(options: any): void;
26
+ abort(): void;
27
27
  }
28
28
  interface CommitResolution {
29
29
  txnTime: number;
@@ -16,6 +16,7 @@ export declare const TIMESTAMP_ASSIGN_LAST = 1;
16
16
  export declare const TIMESTAMP_ASSIGN_PREVIOUS = 3;
17
17
  export declare const TIMESTAMP_RECORD_PREVIOUS = 4;
18
18
  export declare const HAS_EXPIRATION = 16;
19
+ export declare const PENDING_LOCAL_TIME = 1;
19
20
  export declare class RecordEncoder extends Encoder {
20
21
  constructor(options: any);
21
22
  decode(buffer: any, options: any): any;
@@ -3,7 +3,6 @@ import { Transaction } from './DatabaseTransaction';
3
3
  export declare const CONTEXT: unique symbol;
4
4
  export declare const ID_PROPERTY: unique symbol;
5
5
  export declare const IS_COLLECTION: unique symbol;
6
- export declare const SAVE_UPDATES_PROPERTY: unique symbol;
7
6
  export declare const RECORD_PROPERTY: unique symbol;
8
7
  /**
9
8
  * This is the main class that can be extended for any resource in HarperDB and provides the essential reusable
@@ -37,6 +36,10 @@ export declare class Resource implements ResourceInterface {
37
36
  (id_or_query: Id, data_or_context?: any, context?: Context): any;
38
37
  reliesOnPrototype: boolean;
39
38
  };
39
+ static patch: {
40
+ (id_or_query: Id, data_or_context?: any, context?: Context): any;
41
+ reliesOnPrototype: boolean;
42
+ };
40
43
  static delete(identifier: Id, context?: Context): Promise<boolean>;
41
44
  static delete(request: Request, context?: Context): Promise<object>;
42
45
  static delete: typeof Resource.delete;
@@ -72,6 +72,8 @@ export declare function makeTable(options: any): {
72
72
  * @param full_update The provided data in updates is the full intended record; any properties in the existing record that are not in the updates, should be removed
73
73
  */
74
74
  update(updates?: any, full_update?: boolean): any;
75
+ addTo(property: any, value: any): void;
76
+ subtractFrom(property: any, value: any): void;
75
77
  invalidate(options: any): void;
76
78
  /**
77
79
  * This is intended to acquire a lock on a record from the whole cluster.
@@ -85,8 +87,9 @@ export declare function makeTable(options: any): {
85
87
  * @param record
86
88
  * @param options
87
89
  */
88
- put(record: any): Promise<void>;
89
- _writeUpdate(record: any, options?: any): void;
90
+ put(record: any): void;
91
+ patch(record_update: any): void;
92
+ _writeUpdate(record_update: any, full_update: boolean, options?: any): void;
90
93
  delete(request: Request): Promise<boolean>;
91
94
  _writeDelete(options?: any): boolean;
92
95
  search(request: Query): AsyncIterable<any>;
@@ -145,7 +148,7 @@ export declare function makeTable(options: any): {
145
148
  */
146
149
  publish(message: any, options?: any): void;
147
150
  _writePublish(message: any, options?: any): void;
148
- validate(record: any): void;
151
+ validate(record: any, patch?: any): void;
149
152
  getUpdatedTime(): any;
150
153
  wasLoadedFromSource(): boolean | void;
151
154
  post(new_record: any): any;
@@ -231,6 +234,8 @@ export declare function makeTable(options: any): {
231
234
  * @param full_update The provided data in updates is the full intended record; any properties in the existing record that are not in the updates, should be removed
232
235
  */
233
236
  update(updates?: any, full_update?: boolean): any;
237
+ addTo(property: any, value: any): void;
238
+ subtractFrom(property: any, value: any): void;
234
239
  invalidate(options: any): void;
235
240
  /**
236
241
  * This is intended to acquire a lock on a record from the whole cluster.
@@ -244,8 +249,9 @@ export declare function makeTable(options: any): {
244
249
  * @param record
245
250
  * @param options
246
251
  */
247
- put(record: any): Promise<void>;
248
- _writeUpdate(record: any, options?: any): void;
252
+ put(record: any): void;
253
+ patch(record_update: any): void;
254
+ _writeUpdate(record_update: any, full_update: boolean, options?: any): void;
249
255
  delete(request: Request): Promise<boolean>;
250
256
  _writeDelete(options?: any): boolean;
251
257
  search(request: Query): AsyncIterable<any>;
@@ -304,7 +310,7 @@ export declare function makeTable(options: any): {
304
310
  */
305
311
  publish(message: any, options?: any): void;
306
312
  _writePublish(message: any, options?: any): void;
307
- validate(record: any): void;
313
+ validate(record: any, patch?: any): void;
308
314
  getUpdatedTime(): any;
309
315
  wasLoadedFromSource(): boolean | void;
310
316
  post(new_record: any): any;
@@ -354,6 +360,8 @@ export declare function makeTable(options: any): {
354
360
  * @param full_update The provided data in updates is the full intended record; any properties in the existing record that are not in the updates, should be removed
355
361
  */
356
362
  update(updates?: any, full_update?: boolean): any;
363
+ addTo(property: any, value: any): void;
364
+ subtractFrom(property: any, value: any): void;
357
365
  invalidate(options: any): void;
358
366
  /**
359
367
  * This is intended to acquire a lock on a record from the whole cluster.
@@ -367,8 +375,9 @@ export declare function makeTable(options: any): {
367
375
  * @param record
368
376
  * @param options
369
377
  */
370
- put(record: any): Promise<void>;
371
- _writeUpdate(record: any, options?: any): void;
378
+ put(record: any): void;
379
+ patch(record_update: any): void;
380
+ _writeUpdate(record_update: any, full_update: boolean, options?: any): void;
372
381
  delete(request: Request): Promise<boolean>;
373
382
  _writeDelete(options?: any): boolean;
374
383
  search(request: Query): AsyncIterable<any>;
@@ -427,7 +436,7 @@ export declare function makeTable(options: any): {
427
436
  */
428
437
  publish(message: any, options?: any): void;
429
438
  _writePublish(message: any, options?: any): void;
430
- validate(record: any): void;
439
+ validate(record: any, patch?: any): void;
431
440
  getUpdatedTime(): any;
432
441
  wasLoadedFromSource(): boolean | void;
433
442
  post(new_record: any): any;
@@ -462,6 +471,16 @@ export declare function makeTable(options: any): {
462
471
  */
463
472
  evict(id: any, existing_record: any, existing_version: any): any;
464
473
  operation(operation: any, context: any): any;
474
+ /**
475
+ * This is responsible for ordering and select()ing the attributes/properties from returned entries
476
+ * @param select
477
+ * @param context
478
+ * @param filtered
479
+ * @param ensure_loaded
480
+ * @param can_skip
481
+ * @returns
482
+ */
483
+ transformToOrderedSelect(entries: any, select: any, sort: any, context: any, transformToRecord: any): any;
465
484
  /**
466
485
  * This is responsible for select()ing the attributes/properties from returned entries
467
486
  * @param select
@@ -506,6 +525,10 @@ export declare function makeTable(options: any): {
506
525
  (id_or_query: Id, data_or_context?: any, context?: Context): any;
507
526
  reliesOnPrototype: boolean;
508
527
  };
528
+ patch: {
529
+ (id_or_query: Id, data_or_context?: any, context?: Context): any;
530
+ reliesOnPrototype: boolean;
531
+ };
509
532
  delete(identifier: Id, context?: Context): Promise<boolean>;
510
533
  delete(request: Request, context?: Context): Promise<object>;
511
534
  getNewId(): `${string}-${string}-${string}-${string}-${string}`;
@@ -11,7 +11,7 @@ export declare const AUDIT_STORE_OPTIONS: {
11
11
  };
12
12
  };
13
13
  export declare function openAuditStore(root_store: any): any;
14
- export declare function setAuditRetention(retention_time: any): void;
14
+ export declare function setAuditRetention(retention_time: any, default_delay?: number): void;
15
15
  export declare function createAuditEntry(txn_time: any, table_id: any, record_id: any, previous_local_time: any, username: any, type: any, encoded_record: any): Buffer;
16
16
  export declare function readAuditEntry(buffer: any): {
17
17
  type: any;
@@ -20,7 +20,7 @@ export declare function readAuditEntry(buffer: any): {
20
20
  version: any;
21
21
  previousLocalTime: any;
22
22
  readonly user: import("ordered-binary").Key;
23
- getValue(store: any): any;
23
+ getValue(store: any, full_record?: any, audit_time?: any): any;
24
24
  } | {
25
25
  type?: undefined;
26
26
  tableId?: undefined;
@@ -0,0 +1,19 @@
1
+ export declare function add(record: any, property: any, action: any): void;
2
+ export declare namespace add {
3
+ var reverse: (record: any, property: any, action: any) => void;
4
+ }
5
+ /**
6
+ * Rebuild a record update that has a timestamp before the provided newer update
7
+ * @param update
8
+ * @param newer_update
9
+ */
10
+ export declare function rebuildUpdateBefore(update: any, newer_update: any): any;
11
+ export declare function applyReverse(record: any, update: any): void;
12
+ /**
13
+ * Reconstruct the record state at a given timestamp by going back through the audit history and reversing any changes
14
+ * @param current_entry
15
+ * @param timestamp
16
+ * @param store
17
+ * @returns
18
+ */
19
+ export declare function getRecordAtTime(current_entry: any, timestamp: any, store: any): any;
@@ -78,10 +78,13 @@ export declare function table({ table: table_name, database: database_name, expi
78
78
  allowCreate(user: any, new_data: {}): boolean;
79
79
  allowDelete(user: any): any;
80
80
  update(updates?: any, full_update?: boolean): any;
81
+ addTo(property: any, value: any): void;
82
+ subtractFrom(property: any, value: any): void;
81
83
  invalidate(options: any): void;
82
84
  lock(): void;
83
- put(record: any): Promise<void>;
84
- _writeUpdate(record: any, options?: any): void;
85
+ put(record: any): void;
86
+ patch(record_update: any): void;
87
+ _writeUpdate(record_update: any, full_update: boolean, options?: any): void;
85
88
  delete(request: import("./ResourceInterface").Request): Promise<boolean>;
86
89
  _writeDelete(options?: any): boolean;
87
90
  search(request: import("./ResourceInterface").Query): AsyncIterable<any>;
@@ -133,7 +136,7 @@ export declare function table({ table: table_name, database: database_name, expi
133
136
  doesExist(): boolean;
134
137
  publish(message: any, options?: any): void;
135
138
  _writePublish(message: any, options?: any): void;
136
- validate(record: any): void;
139
+ validate(record: any, patch?: any): void;
137
140
  getUpdatedTime(): any;
138
141
  wasLoadedFromSource(): boolean | void;
139
142
  post(new_record: any): any;
@@ -168,10 +171,13 @@ export declare function table({ table: table_name, database: database_name, expi
168
171
  allowCreate(user: any, new_data: {}): boolean;
169
172
  allowDelete(user: any): any;
170
173
  update(updates?: any, full_update?: boolean): any;
174
+ addTo(property: any, value: any): void;
175
+ subtractFrom(property: any, value: any): void;
171
176
  invalidate(options: any): void;
172
177
  lock(): void;
173
- put(record: any): Promise<void>;
174
- _writeUpdate(record: any, options?: any): void;
178
+ put(record: any): void;
179
+ patch(record_update: any): void;
180
+ _writeUpdate(record_update: any, full_update: boolean, options?: any): void;
175
181
  delete(request: import("./ResourceInterface").Request): Promise<boolean>;
176
182
  _writeDelete(options?: any): boolean;
177
183
  search(request: import("./ResourceInterface").Query): AsyncIterable<any>;
@@ -223,7 +229,7 @@ export declare function table({ table: table_name, database: database_name, expi
223
229
  doesExist(): boolean;
224
230
  publish(message: any, options?: any): void;
225
231
  _writePublish(message: any, options?: any): void;
226
- validate(record: any): void;
232
+ validate(record: any, patch?: any): void;
227
233
  getUpdatedTime(): any;
228
234
  wasLoadedFromSource(): boolean | void;
229
235
  post(new_record: any): any;
@@ -238,10 +244,13 @@ export declare function table({ table: table_name, database: database_name, expi
238
244
  allowCreate(user: any, new_data: {}): boolean;
239
245
  allowDelete(user: any): any;
240
246
  update(updates?: any, full_update?: boolean): any;
247
+ addTo(property: any, value: any): void;
248
+ subtractFrom(property: any, value: any): void;
241
249
  invalidate(options: any): void;
242
250
  lock(): void;
243
- put(record: any): Promise<void>;
244
- _writeUpdate(record: any, options?: any): void;
251
+ put(record: any): void;
252
+ patch(record_update: any): void;
253
+ _writeUpdate(record_update: any, full_update: boolean, options?: any): void;
245
254
  delete(request: import("./ResourceInterface").Request): Promise<boolean>;
246
255
  _writeDelete(options?: any): boolean;
247
256
  search(request: import("./ResourceInterface").Query): AsyncIterable<any>;
@@ -293,7 +302,7 @@ export declare function table({ table: table_name, database: database_name, expi
293
302
  doesExist(): boolean;
294
303
  publish(message: any, options?: any): void;
295
304
  _writePublish(message: any, options?: any): void;
296
- validate(record: any): void;
305
+ validate(record: any, patch?: any): void;
297
306
  getUpdatedTime(): any;
298
307
  wasLoadedFromSource(): boolean | void;
299
308
  post(new_record: any): any;
@@ -311,6 +320,7 @@ export declare function table({ table: table_name, database: database_name, expi
311
320
  dropTable(): Promise<void>;
312
321
  evict(id: any, existing_record: any, existing_version: any): any;
313
322
  operation(operation: any, context: any): any;
323
+ transformToOrderedSelect(entries: any, select: any, sort: any, context: any, transformToRecord: any): any;
314
324
  transformEntryForSelect(select: any, context: any, filtered: any, ensure_loaded?: any, can_skip?: any): (entry: any) => any;
315
325
  addAttributes(attributes_to_add: any): Promise<any>;
316
326
  removeAttributes(names: string[]): Promise<any>;
@@ -343,6 +353,10 @@ export declare function table({ table: table_name, database: database_name, expi
343
353
  (id_or_query: import("./ResourceInterface").Id, data_or_context?: any, context?: import("./ResourceInterface").Context): any;
344
354
  reliesOnPrototype: boolean;
345
355
  };
356
+ patch: {
357
+ (id_or_query: import("./ResourceInterface").Id, data_or_context?: any, context?: import("./ResourceInterface").Context): any;
358
+ reliesOnPrototype: boolean;
359
+ };
346
360
  delete(identifier: import("./ResourceInterface").Id, context?: import("./ResourceInterface").Context): Promise<boolean>;
347
361
  delete(request: import("./ResourceInterface").Request, context?: import("./ResourceInterface").Context): Promise<object>;
348
362
  getNewId(): `${string}-${string}-${string}-${string}-${string}`;
@@ -24,7 +24,7 @@ export declare function collapseData(target: any): any;
24
24
  * @param target
25
25
  * @returns
26
26
  */
27
- export declare function deepFreeze(target: any): any;
27
+ export declare function deepFreeze(target: any, changes?: any): any;
28
28
  /**
29
29
  * Determine if any changes have been made to this tracked object
30
30
  * @param target
@@ -34,3 +34,9 @@ export declare function hasChanges(target: any): boolean;
34
34
  export declare function copyRecord(record: any, target_resource: any, attributes: any): void;
35
35
  export declare const NOT_COPIED_YET: {};
36
36
  export declare function withoutCopying(callback: any): any;
37
+ export declare class Addition {
38
+ value: any;
39
+ __op__: string;
40
+ constructor(value: any);
41
+ update(previous_value: any): any;
42
+ }