harperdb 4.3.21 → 4.4.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +1 -1
  2. package/bin/harperdb.js +85 -72
  3. package/bin/lite.js +32 -22
  4. package/config/yaml/defaultConfig.yaml +9 -41
  5. package/config/yaml/defaultNatsConfig.yaml +36 -0
  6. package/json/systemSchema.json +32 -79
  7. package/launchServiceScripts/launchInstallNATSServer.js +4 -4
  8. package/launchServiceScripts/launchNatsIngestService.js +32 -22
  9. package/launchServiceScripts/launchNatsReplyService.js +32 -22
  10. package/launchServiceScripts/launchUpdateNodes4-0-0.js +32 -22
  11. package/npm-shrinkwrap.json +634 -312
  12. package/package.json +17 -15
  13. package/resources/DatabaseTransaction.d.ts +1 -0
  14. package/resources/RecordEncoder.d.ts +3 -1
  15. package/resources/Resource.d.ts +8 -1
  16. package/resources/ResourceInterface.d.ts +7 -3
  17. package/resources/Resources.d.ts +5 -4
  18. package/resources/Table.d.ts +47 -16
  19. package/resources/auditStore.d.ts +45 -1
  20. package/resources/databases.d.ts +54 -17
  21. package/resources/search.d.ts +6 -0
  22. package/resources/transactionBroadcast.d.ts +2 -1
  23. package/server/Server.d.ts +1 -1
  24. package/server/jobs/jobProcess.js +32 -22
  25. package/server/serverHelpers/Headers.d.ts +8 -0
  26. package/server/threads/threadServer.js +32 -22
  27. package/studio/build-local/asset-manifest.json +2 -2
  28. package/studio/build-local/index.html +1 -1
  29. package/studio/build-local/static/js/main.4fd117ad.js +2 -0
  30. package/utility/scripts/restartHdb.js +32 -22
  31. package/studio/build-local/static/js/main.a22f6951.js +0 -2
  32. /package/studio/build-local/static/js/{main.a22f6951.js.LICENSE.txt → main.4fd117ad.js.LICENSE.txt} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harperdb",
3
- "version": "4.3.21",
3
+ "version": "4.4.0-alpha.1",
4
4
  "description": "HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.",
5
5
  "keywords": [
6
6
  "database",
@@ -46,10 +46,10 @@
46
46
  "@aws-sdk/client-s3": "3.635.0",
47
47
  "@aws-sdk/lib-storage": "3.635.0",
48
48
  "@endo/static-module-record": "^1.0.4",
49
- "@fastify/autoload": "5.7.1",
49
+ "@fastify/autoload": "5.10.0",
50
50
  "@fastify/compress": "~6.5.0",
51
- "@fastify/cors": "~8.5.0",
52
- "@fastify/static": "~6.12.0",
51
+ "@fastify/cors": "~9.0.1",
52
+ "@fastify/static": "~7.0.4",
53
53
  "@turf/area": "6.5.0",
54
54
  "@turf/boolean-contains": "6.5.0",
55
55
  "@turf/boolean-disjoint": "6.5.0",
@@ -60,15 +60,16 @@
60
60
  "@turf/helpers": "6.5.0",
61
61
  "@turf/length": "6.5.0",
62
62
  "alasql": "4.1.10",
63
- "cbor-x": "1.5.8",
63
+ "cbor-x": "1.6.0",
64
64
  "chalk": "4.1.2",
65
65
  "cli-progress": "3.12.0",
66
66
  "clone": "2.1.2",
67
67
  "fast-glob": "3.3.2",
68
- "fastify": "~4.26.2",
68
+ "fastify": "~4.28.1",
69
69
  "fastify-plugin": "~4.5.1",
70
70
  "fs-extra": "11.2.0",
71
- "graphql": "^16.8.1",
71
+ "graphql": "^16.9.0",
72
+ "gunzip-maybe": "1.4.2",
72
73
  "human-readable-ids": "1.0.4",
73
74
  "inquirer": "8.2.6",
74
75
  "is-number": "7.0.0",
@@ -81,12 +82,12 @@
81
82
  "lodash": "4.17.21",
82
83
  "mathjs": "11.12.0",
83
84
  "minimist": "1.2.8",
84
- "mkcert": "1.5.1",
85
85
  "moment": "2.30.1",
86
- "mqtt-packet": "~8.2.1",
87
- "msgpackr": "1.10.1",
86
+ "mqtt-packet": "~9.0.0",
87
+ "msgpackr": "1.11.0",
88
88
  "nats": "2.19.0",
89
89
  "needle": "3.3.1",
90
+ "node-forge": "^1.3.1",
90
91
  "node-stream-zip": "1.15.0",
91
92
  "node-unix-socket": "0.2.5",
92
93
  "normalize-path": "^3.0.0",
@@ -107,13 +108,13 @@
107
108
  "ses": "1.1.0",
108
109
  "stream-chain": "2.2.5",
109
110
  "stream-json": "1.8.0",
110
- "systeminformation": "5.22.9",
111
- "tar-fs": "2.1.1",
111
+ "systeminformation": "5.23.5",
112
+ "tar-fs": "3.0.6",
112
113
  "ulidx": "0.5.0",
113
- "uuid": "9.0.1",
114
+ "uuid": "10.0.0",
114
115
  "validate.js": "0.13.1",
115
- "ws": "8.17.1",
116
- "yaml": "2.4.1"
116
+ "ws": "8.18.0",
117
+ "yaml": "2.5.0"
117
118
  },
118
119
  "overrides": {
119
120
  "eslint-plugin-radar": {
@@ -125,6 +126,7 @@
125
126
  },
126
127
  "optionalDependencies": {
127
128
  "bufferutil": "^4.0.7",
129
+ "segfault-handler": "^1.3.0",
128
130
  "utf-8-validate": "^5.0.10"
129
131
  },
130
132
  "scripts": {
@@ -4,6 +4,7 @@ export declare enum TRANSACTION_STATE {
4
4
  OPEN = 1,// the transaction is open and can be used for reads and writes
5
5
  LINGERING = 2
6
6
  }
7
+ export declare function replicationConfirmation(callback: any): void;
7
8
  export declare class DatabaseTransaction implements Transaction {
8
9
  writes: any[];
9
10
  lmdbDb: RootDatabase;
@@ -16,10 +16,12 @@ 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 HAS_RESIDENCY_ID = 32;
19
20
  export declare const PENDING_LOCAL_TIME = 1;
21
+ export declare const HAS_STRUCTURE_UPDATE = 256;
20
22
  export declare class RecordEncoder extends Encoder {
21
23
  constructor(options: any);
22
24
  decode(buffer: any, options: any): any;
23
25
  }
24
26
  export declare function handleLocalTimeForGets(store: any): any;
25
- export declare function getUpdateRecord(store: any, table_id: any, audit_store: any): (id: any, record: any, existing_entry: any, new_version: any, assign_metadata?: number, audit?: boolean, context?: any, expires_at?: number, type?: string, resolve_record?: boolean, audit_record?: any) => any;
27
+ export declare function getUpdateRecord(store: any, table_id: any, audit_store: any): (id: any, record: any, existing_entry: any, new_version: any, assign_metadata?: number, audit?: boolean, options?: any, type?: string, resolve_record?: boolean, audit_record?: any) => any;
@@ -46,6 +46,13 @@ export declare class Resource implements ResourceInterface {
46
46
  * Generate a new primary key for a resource; by default we use UUIDs (for now).
47
47
  */
48
48
  static getNewId(): `${string}-${string}-${string}-${string}-${string}`;
49
+ /**
50
+ * Create a new resource with the provided record and id. If no id is provided, it is auto-generated. Note that this
51
+ * facilitates creating a new resource, but does not guarantee that this is not overwriting an existing entry.
52
+ * @param id_prefix
53
+ * @param record
54
+ * @param context
55
+ */
49
56
  static create(id_prefix: Id, record: any, context: Context): Promise<Id>;
50
57
  static create(record: any, context: Context): Promise<Id>;
51
58
  static invalidate: {
@@ -86,7 +93,7 @@ export declare class Resource implements ResourceInterface {
86
93
  (id_or_query: string | Id, data_or_context?: any, context?: Context): any;
87
94
  reliesOnPrototype: boolean;
88
95
  };
89
- post(new_record: any): any;
96
+ post(new_record: any): Promise<any>;
90
97
  static isCollection(resource: any): any;
91
98
  static coerceId(id: string): number | string;
92
99
  static parseQuery(search: any): any;
@@ -34,6 +34,8 @@ export interface Context {
34
34
  staleIfError?: boolean;
35
35
  /** Indicates any cached data must be revalidated */
36
36
  mustRevalidate?: boolean;
37
+ /** An array of nodes to replicate to */
38
+ replicateTo?: string[];
37
39
  }
38
40
  interface DirectCondition {
39
41
  attribute: string;
@@ -44,17 +46,19 @@ interface ConditionGroup {
44
46
  conditions: Condition[];
45
47
  operator?: string;
46
48
  }
47
- type Condition = DirectCondition | ConditionGroup;
48
- interface Sort {
49
+ export type Condition = DirectCondition | ConditionGroup;
50
+ export interface Sort {
49
51
  attribute: string;
50
52
  descending?: boolean;
51
53
  next?: Sort;
52
54
  }
53
- interface SubSelect {
55
+ export interface SubSelect {
54
56
  name: string;
55
57
  select: (string | SubSelect)[];
56
58
  }
57
59
  export interface Query {
60
+ /** Retrieve a specific record, but can be combined with select */
61
+ id?: Id;
58
62
  /** The conditions to use in the query, that the returned records must satisfy */
59
63
  conditions?: Condition[];
60
64
  /** The number of records to return */
@@ -5,16 +5,17 @@ import { Resource } from './Resource';
5
5
  export declare class Resources extends Map<string, typeof Resource> {
6
6
  isWorker: boolean;
7
7
  loginPath?: (request: any) => string;
8
- set(path: any, resource: any, type?: string, force?: boolean): void;
8
+ set(path: any, resource: any, export_types?: string[], force?: boolean): void;
9
9
  /**
10
10
  * Find the best (longest) match resource path that matches the (beginning of the) provided path, in order to find
11
11
  * the correct Resource to handle this URL path.
12
12
  * @param path The URL Path
13
- * @param type Optional request content type, allows layering of resources, specifically for defining HTML handlers
14
- * that can further transform data from the main structured object resources.
13
+ * @param export_type Optional request content or protocol type, allows control of which protocols can access a resource
14
+ * and future layering of resources (for defining HTML handlers
15
+ * that can further transform data from the main structured object resources).
15
16
  * @return The matched Resource class. Note that the remaining path is "returned" by setting the relativeURL property
16
17
  */
17
- getMatch(url: string, type?: string): any;
18
+ getMatch(url: string, export_type?: string): any;
18
19
  getResource(path: string, resource_info: any): any;
19
20
  call(path: string, request: any, callback: Function): Promise<any>;
20
21
  setRepresentation(path: any, type: any, representation: any): void;
@@ -4,8 +4,16 @@
4
4
  * table-level interactions, loading records, updating records, querying, and more.
5
5
  */
6
6
  import { Database } from 'lmdb';
7
- import { Query, ResourceInterface, SubscriptionRequest, Id, Context } from './ResourceInterface';
7
+ import { Query, ResourceInterface, SubscriptionRequest, Id, Context, Sort, SubSelect } from './ResourceInterface';
8
8
  import { Resource } from './Resource';
9
+ type Attribute = {
10
+ name: string;
11
+ type: string;
12
+ assignCreatedTime?: boolean;
13
+ assignUpdatedTime?: boolean;
14
+ expiresAt?: boolean;
15
+ isPrimaryKey?: boolean;
16
+ };
9
17
  export interface Table {
10
18
  primaryStore: Database;
11
19
  auditStore: Database;
@@ -15,6 +23,7 @@ export interface Table {
15
23
  databaseName: string;
16
24
  attributes: any[];
17
25
  primaryKey: string;
26
+ replicate?: boolean;
18
27
  subscriptions: Map<any, Function[]>;
19
28
  expirationMS: number;
20
29
  indexingOperations?: Promise<void>;
@@ -64,7 +73,7 @@ export declare function makeTable(options: any): {
64
73
  * Determine if the user is allowed to delete from the current resource
65
74
  * @param user The current, authenticated user
66
75
  */
67
- allowDelete(user: any): any;
76
+ allowDelete(user: any): boolean;
68
77
  /**
69
78
  * Start updating a record. The returned resource will record changes which are written
70
79
  * once the corresponding transaction is committed. These changes can (eventually) include CRDT type operations.
@@ -75,7 +84,9 @@ export declare function makeTable(options: any): {
75
84
  addTo(property: any, value: any): void;
76
85
  subtractFrom(property: any, value: any): void;
77
86
  getMetadata(): any;
78
- invalidate(options: any): void;
87
+ invalidate(): void;
88
+ _writeInvalidate(options: any): void;
89
+ _writeRelocate(options: any): void;
79
90
  /**
80
91
  * This is intended to acquire a lock on a record from the whole cluster.
81
92
  */
@@ -152,7 +163,7 @@ export declare function makeTable(options: any): {
152
163
  validate(record: any, patch?: any): void;
153
164
  getUpdatedTime(): any;
154
165
  wasLoadedFromSource(): boolean | void;
155
- post(new_record: any): any;
166
+ post(new_record: any): Promise<any>;
156
167
  connect(query?: {}): AsyncIterable<any>;
157
168
  getId(): any;
158
169
  getContext(): Context;
@@ -162,15 +173,18 @@ export declare function makeTable(options: any): {
162
173
  auditStore: any;
163
174
  primaryKey: any;
164
175
  tableName: any;
176
+ tableId: any;
165
177
  indices: any;
166
178
  audit: any;
167
179
  databasePath: any;
168
180
  databaseName: any;
169
181
  attributes: any;
170
- expirationTimer: any;
171
- createdTimeProperty: any;
172
- updatedTimeProperty: any;
182
+ replicate: any;
183
+ sealed: any;
184
+ createdTimeProperty: Attribute;
185
+ updatedTimeProperty: Attribute;
173
186
  propertyResolvers: any;
187
+ userResolvers: {};
174
188
  sources: any[];
175
189
  readonly expirationMS: any;
176
190
  dbisDB: any;
@@ -192,7 +206,7 @@ export declare function makeTable(options: any): {
192
206
  * @param options An important option is ensureLoaded, which can be used to indicate that it is necessary for a caching table to load data from the source if there is not a local copy of the data in the table (usually not necessary for a delete, for example).
193
207
  * @returns
194
208
  */
195
- getResource(id: Id, request: any, resource_options?: any): Promise<{
209
+ getResource(id: Id, request: Context, resource_options?: any): Promise<{
196
210
  /**
197
211
  * This is a request to explicitly ensure that the record is loaded from source, rather than only using the local record.
198
212
  * This will load from source if the current record is expired, missing, or invalidated.
@@ -227,7 +241,7 @@ export declare function makeTable(options: any): {
227
241
  * Determine if the user is allowed to delete from the current resource
228
242
  * @param user The current, authenticated user
229
243
  */
230
- allowDelete(user: any): any;
244
+ allowDelete(user: any): boolean;
231
245
  /**
232
246
  * Start updating a record. The returned resource will record changes which are written
233
247
  * once the corresponding transaction is committed. These changes can (eventually) include CRDT type operations.
@@ -238,7 +252,9 @@ export declare function makeTable(options: any): {
238
252
  addTo(property: any, value: any): void;
239
253
  subtractFrom(property: any, value: any): void;
240
254
  getMetadata(): any;
241
- invalidate(options: any): void;
255
+ invalidate(): void;
256
+ _writeInvalidate(options: any): void;
257
+ _writeRelocate(options: any): void;
242
258
  /**
243
259
  * This is intended to acquire a lock on a record from the whole cluster.
244
260
  */
@@ -315,7 +331,7 @@ export declare function makeTable(options: any): {
315
331
  validate(record: any, patch?: any): void;
316
332
  getUpdatedTime(): any;
317
333
  wasLoadedFromSource(): boolean | void;
318
- post(new_record: any): any;
334
+ post(new_record: any): Promise<any>;
319
335
  connect(query?: {}): AsyncIterable<any>;
320
336
  getId(): any;
321
337
  getContext(): Context;
@@ -354,7 +370,7 @@ export declare function makeTable(options: any): {
354
370
  * Determine if the user is allowed to delete from the current resource
355
371
  * @param user The current, authenticated user
356
372
  */
357
- allowDelete(user: any): any;
373
+ allowDelete(user: any): boolean;
358
374
  /**
359
375
  * Start updating a record. The returned resource will record changes which are written
360
376
  * once the corresponding transaction is committed. These changes can (eventually) include CRDT type operations.
@@ -365,7 +381,9 @@ export declare function makeTable(options: any): {
365
381
  addTo(property: any, value: any): void;
366
382
  subtractFrom(property: any, value: any): void;
367
383
  getMetadata(): any;
368
- invalidate(options: any): void;
384
+ invalidate(): void;
385
+ _writeInvalidate(options: any): void;
386
+ _writeRelocate(options: any): void;
369
387
  /**
370
388
  * This is intended to acquire a lock on a record from the whole cluster.
371
389
  */
@@ -442,11 +460,12 @@ export declare function makeTable(options: any): {
442
460
  validate(record: any, patch?: any): void;
443
461
  getUpdatedTime(): any;
444
462
  wasLoadedFromSource(): boolean | void;
445
- post(new_record: any): any;
463
+ post(new_record: any): Promise<any>;
446
464
  connect(query?: {}): AsyncIterable<any>;
447
465
  getId(): any;
448
466
  getContext(): Context;
449
467
  };
468
+ getNewId(): any;
450
469
  /**
451
470
  * Set TTL expiration for records in this table. On retrieval, record timestamps are checked for expiration.
452
471
  * This also informs the scheduling for record eviction.
@@ -458,6 +477,10 @@ export declare function makeTable(options: any): {
458
477
  eviction?: number;
459
478
  scanInterval?: number;
460
479
  }): void;
480
+ getResidencyRecord(id: any): any;
481
+ setResidency(getResidency: (record: object, context: Context, previous_residency: string[]) => string[]): void;
482
+ setResidencyById(getResidencyById: (id: Id) => string[]): void;
483
+ getResidency(record: object, context: Context, previous_residency: string[]): any;
461
484
  /**
462
485
  * Turn on auditing at runtime
463
486
  */
@@ -469,6 +492,12 @@ export declare function makeTable(options: any): {
469
492
  */
470
493
  coerceId(id: string): number | string;
471
494
  dropTable(): Promise<void>;
495
+ /**
496
+ * Record the relocation of an entry (when a record is moved to a different node)
497
+ * @param existing_entry
498
+ * @param entry
499
+ */
500
+ _recordRelocate(existing_entry: any, entry: any): void;
472
501
  /**
473
502
  * Evicting a record will remove it from a caching table. This is not considered a canonical data change, and it is assumed that retrieving this record from the source will still yield the same record, this is only removing the local copy of the record.
474
503
  */
@@ -483,7 +512,7 @@ export declare function makeTable(options: any): {
483
512
  * @param can_skip
484
513
  * @returns
485
514
  */
486
- transformToOrderedSelect(entries: any, select: any, sort: any, context: any, read_txn: any, transformToRecord: any): any;
515
+ transformToOrderedSelect(entries: any[], select: (string | SubSelect)[], sort: Sort, context: Context, read_txn: any, transformToRecord: Function): any;
487
516
  /**
488
517
  * This is responsible for select()ing the attributes/properties from returned entries
489
518
  * @param select
@@ -507,6 +536,7 @@ export declare function makeTable(options: any): {
507
536
  * When attributes have been changed, we update the accessors that are assigned to this table
508
537
  */
509
538
  updatedAttributes(): void;
539
+ setComputedAttribute(attribute_name: any, resolver: any): void;
510
540
  deleteHistory(end_time?: number): Promise<void>;
511
541
  getHistory(start_time?: number, end_time?: number): AsyncGenerator<{
512
542
  id: import("ordered-binary").Key;
@@ -515,6 +545,7 @@ export declare function makeTable(options: any): {
515
545
  type: any;
516
546
  value: any;
517
547
  user: import("ordered-binary").Key;
548
+ operation: any;
518
549
  }, void, unknown>;
519
550
  getHistoryOfRecord(id: any): Promise<any[]>;
520
551
  cleanup(): void;
@@ -533,7 +564,6 @@ export declare function makeTable(options: any): {
533
564
  };
534
565
  delete(identifier: Id, context?: Context): Promise<boolean>;
535
566
  delete(request: Context, context?: Context): Promise<object>;
536
- getNewId(): `${string}-${string}-${string}-${string}-${string}`;
537
567
  create(id_prefix: Id, record: any, context: Context): Promise<Id>;
538
568
  create(record: any, context: Context): Promise<Id>;
539
569
  invalidate: {
@@ -586,3 +616,4 @@ export declare function setServerUtilities(utilities: any): void;
586
616
  */
587
617
  export declare function coerceType(value: any, attribute: any): any;
588
618
  export declare function updateResource(resource: any, entry: any): void;
619
+ export {};
@@ -10,22 +10,66 @@ export declare const AUDIT_STORE_OPTIONS: {
10
10
  };
11
11
  };
12
12
  export declare function openAuditStore(root_store: any): any;
13
+ export declare function getLastRemoved(audit_store: any): number;
13
14
  export declare function setAuditRetention(retention_time: any, default_delay?: number): void;
14
- 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;
15
+ /** Used to indicate we have received a remote local time update */
16
+ export declare const REMOTE_SEQUENCE_UPDATE = 11;
17
+ export declare const HAS_CURRENT_RESIDENCY_ID = 512;
18
+ export declare const HAS_PREVIOUS_RESIDENCY_ID = 1024;
19
+ export declare const HAS_ORIGINATING_OPERATION = 2048;
20
+ export declare const HAS_EXPIRATION_EXTENDED_TYPE = 4096;
21
+ /**
22
+ * Creates a binary audit entry
23
+ * @param txn_time
24
+ * @param table_id
25
+ * @param record_id
26
+ * @param previous_local_time
27
+ * @param node_id
28
+ * @param username
29
+ * @param type
30
+ * @param encoded_record
31
+ * @param extended_type
32
+ * @param residency_id
33
+ * @param previous_residency_id
34
+ */
35
+ 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;
15
36
  export declare function readAuditEntry(buffer: any): {
16
37
  type: any;
17
38
  tableId: any;
39
+ nodeId: any;
18
40
  readonly recordId: import("ordered-binary").Key;
41
+ getBinaryRecordId(): any;
19
42
  version: any;
20
43
  previousLocalTime: any;
21
44
  readonly user: import("ordered-binary").Key;
45
+ encoded: any;
22
46
  getValue(store: any, full_record?: any, audit_time?: any): any;
47
+ getBinaryValue(): any;
48
+ extendedType: any;
49
+ residencyId: any;
50
+ previousResidencyId: any;
51
+ expiresAt: any;
52
+ originatingOperation: any;
23
53
  } | {
24
54
  type?: undefined;
25
55
  tableId?: undefined;
56
+ nodeId?: undefined;
26
57
  readonly recordId?: undefined;
58
+ getBinaryRecordId?: undefined;
27
59
  version?: undefined;
28
60
  previousLocalTime?: undefined;
29
61
  readonly user?: undefined;
62
+ encoded?: undefined;
30
63
  getValue?: undefined;
64
+ getBinaryValue?: undefined;
65
+ extendedType?: undefined;
66
+ residencyId?: undefined;
67
+ previousResidencyId?: undefined;
68
+ expiresAt?: undefined;
69
+ originatingOperation?: undefined;
31
70
  };
71
+ export declare class Decoder extends DataView {
72
+ position: number;
73
+ readInt(): any;
74
+ readFloat64(): number;
75
+ }
@@ -39,6 +39,7 @@ interface TableDefinition {
39
39
  scanInterval?: number;
40
40
  audit?: boolean;
41
41
  sealed?: boolean;
42
+ replicate?: boolean;
42
43
  trackDeletes?: boolean;
43
44
  attributes: any[];
44
45
  schemaDefined?: boolean;
@@ -69,20 +70,23 @@ export declare function dropDatabase(database_name: any): Promise<void>;
69
70
  * @param attributes
70
71
  * @param audit
71
72
  * @param sealed
73
+ * @param replicate
72
74
  */
73
- export declare function table({ table: table_name, database: database_name, expiration, eviction, scanInterval: scan_interval, attributes, audit, sealed, trackDeletes: track_deletes, schemaDefined: schema_defined, origin, }: TableDefinition): {
75
+ export declare function table({ table: table_name, database: database_name, expiration, eviction, scanInterval: scan_interval, attributes, audit, sealed, replicate, trackDeletes: track_deletes, schemaDefined: schema_defined, origin, }: TableDefinition): {
74
76
  new (identifier: import("./ResourceInterface").Id, source: any): {
75
77
  ensureLoaded(): any;
76
78
  get(query?: import("./ResourceInterface").Query | string): Promise<object | void> | object | void;
77
79
  allowRead(user: any, query: any): any;
78
80
  allowUpdate(user: any, updated_data: any): boolean;
79
81
  allowCreate(user: any, new_data: {}): boolean;
80
- allowDelete(user: any): any;
82
+ allowDelete(user: any): boolean;
81
83
  update(updates?: any, full_update?: boolean): any;
82
84
  addTo(property: any, value: any): void;
83
85
  subtractFrom(property: any, value: any): void;
84
86
  getMetadata(): any;
85
- invalidate(options: any): void;
87
+ invalidate(): void;
88
+ _writeInvalidate(options: any): void;
89
+ _writeRelocate(options: any): void;
86
90
  lock(): void;
87
91
  put(record: any): void;
88
92
  patch(record_update: any): void;
@@ -141,7 +145,7 @@ export declare function table({ table: table_name, database: database_name, expi
141
145
  validate(record: any, patch?: any): void;
142
146
  getUpdatedTime(): any;
143
147
  wasLoadedFromSource(): boolean | void;
144
- post(new_record: any): any;
148
+ post(new_record: any): Promise<any>;
145
149
  connect(query?: {}): AsyncIterable<any>;
146
150
  getId(): any;
147
151
  getContext(): import("./ResourceInterface").Context;
@@ -151,32 +155,51 @@ export declare function table({ table: table_name, database: database_name, expi
151
155
  auditStore: any;
152
156
  primaryKey: any;
153
157
  tableName: any;
158
+ tableId: any;
154
159
  indices: any;
155
160
  audit: any;
156
161
  databasePath: any;
157
162
  databaseName: any;
158
163
  attributes: any;
159
- expirationTimer: any;
160
- createdTimeProperty: any;
161
- updatedTimeProperty: any;
164
+ replicate: any;
165
+ sealed: any;
166
+ createdTimeProperty: {
167
+ name: string;
168
+ type: string;
169
+ assignCreatedTime?: boolean;
170
+ assignUpdatedTime?: boolean;
171
+ expiresAt?: boolean;
172
+ isPrimaryKey?: boolean;
173
+ };
174
+ updatedTimeProperty: {
175
+ name: string;
176
+ type: string;
177
+ assignCreatedTime?: boolean;
178
+ assignUpdatedTime?: boolean;
179
+ expiresAt?: boolean;
180
+ isPrimaryKey?: boolean;
181
+ };
162
182
  propertyResolvers: any;
183
+ userResolvers: {};
163
184
  sources: any[];
164
185
  readonly expirationMS: any;
165
186
  dbisDB: any;
166
187
  schemaDefined: any;
167
188
  sourcedFrom(source: any, options: any): any;
168
- getResource(id: import("./ResourceInterface").Id, request: any, resource_options?: any): Promise<{
189
+ getResource(id: import("./ResourceInterface").Id, request: import("./ResourceInterface").Context, resource_options?: any): Promise<{
169
190
  ensureLoaded(): any;
170
191
  get(query?: import("./ResourceInterface").Query | string): Promise<object | void> | object | void;
171
192
  allowRead(user: any, query: any): any;
172
193
  allowUpdate(user: any, updated_data: any): boolean;
173
194
  allowCreate(user: any, new_data: {}): boolean;
174
- allowDelete(user: any): any;
195
+ allowDelete(user: any): boolean;
175
196
  update(updates?: any, full_update?: boolean): any;
176
197
  addTo(property: any, value: any): void;
177
198
  subtractFrom(property: any, value: any): void;
178
199
  getMetadata(): any;
179
- invalidate(options: any): void;
200
+ invalidate(): void;
201
+ _writeInvalidate(options: any): void;
202
+ _writeRelocate(options: any): void;
180
203
  lock(): void;
181
204
  put(record: any): void;
182
205
  patch(record_update: any): void;
@@ -235,7 +258,7 @@ export declare function table({ table: table_name, database: database_name, expi
235
258
  validate(record: any, patch?: any): void;
236
259
  getUpdatedTime(): any;
237
260
  wasLoadedFromSource(): boolean | void;
238
- post(new_record: any): any;
261
+ post(new_record: any): Promise<any>;
239
262
  connect(query?: {}): AsyncIterable<any>;
240
263
  getId(): any;
241
264
  getContext(): import("./ResourceInterface").Context;
@@ -245,12 +268,14 @@ export declare function table({ table: table_name, database: database_name, expi
245
268
  allowRead(user: any, query: any): any;
246
269
  allowUpdate(user: any, updated_data: any): boolean;
247
270
  allowCreate(user: any, new_data: {}): boolean;
248
- allowDelete(user: any): any;
271
+ allowDelete(user: any): boolean;
249
272
  update(updates?: any, full_update?: boolean): any;
250
273
  addTo(property: any, value: any): void;
251
274
  subtractFrom(property: any, value: any): void;
252
275
  getMetadata(): any;
253
- invalidate(options: any): void;
276
+ invalidate(): void;
277
+ _writeInvalidate(options: any): void;
278
+ _writeRelocate(options: any): void;
254
279
  lock(): void;
255
280
  put(record: any): void;
256
281
  patch(record_update: any): void;
@@ -309,22 +334,28 @@ export declare function table({ table: table_name, database: database_name, expi
309
334
  validate(record: any, patch?: any): void;
310
335
  getUpdatedTime(): any;
311
336
  wasLoadedFromSource(): boolean | void;
312
- post(new_record: any): any;
337
+ post(new_record: any): Promise<any>;
313
338
  connect(query?: {}): AsyncIterable<any>;
314
339
  getId(): any;
315
340
  getContext(): import("./ResourceInterface").Context;
316
341
  };
342
+ getNewId(): any;
317
343
  setTTLExpiration(expiration: number | {
318
344
  expiration: number;
319
345
  eviction?: number;
320
346
  scanInterval?: number;
321
347
  }): void;
348
+ getResidencyRecord(id: any): any;
349
+ setResidency(getResidency: (record: object, context: import("./ResourceInterface").Context, previous_residency: string[]) => string[]): void;
350
+ setResidencyById(getResidencyById: (id: import("./ResourceInterface").Id) => string[]): void;
351
+ getResidency(record: object, context: import("./ResourceInterface").Context, previous_residency: string[]): any;
322
352
  enableAuditing(audit_enabled?: boolean): void;
323
353
  coerceId(id: string): number | string;
324
354
  dropTable(): Promise<void>;
355
+ _recordRelocate(existing_entry: any, entry: any): void;
325
356
  evict(id: any, existing_record: any, existing_version: any): any;
326
357
  operation(operation: any, context: any): any;
327
- transformToOrderedSelect(entries: any, select: any, sort: any, context: any, read_txn: any, transformToRecord: any): any;
358
+ transformToOrderedSelect(entries: any[], select: (string | import("./ResourceInterface").SubSelect)[], sort: import("./ResourceInterface").Sort, context: import("./ResourceInterface").Context, read_txn: any, transformToRecord: Function): any;
328
359
  transformEntryForSelect(select: any, context: any, read_txn: any, filtered: any, ensure_loaded?: any, can_skip?: any): (entry: any) => any;
329
360
  addAttributes(attributes_to_add: any): Promise<any>;
330
361
  removeAttributes(names: string[]): Promise<any>;
@@ -336,6 +367,7 @@ export declare function table({ table: table_name, database: database_name, expi
336
367
  estimatedRange?: undefined;
337
368
  };
338
369
  updatedAttributes(): void;
370
+ setComputedAttribute(attribute_name: any, resolver: any): void;
339
371
  deleteHistory(end_time?: number): Promise<void>;
340
372
  getHistory(start_time?: number, end_time?: number): AsyncGenerator<{
341
373
  id: import("ordered-binary").Key;
@@ -344,6 +376,7 @@ export declare function table({ table: table_name, database: database_name, expi
344
376
  type: any;
345
377
  value: any;
346
378
  user: import("ordered-binary").Key;
379
+ operation: any;
347
380
  }, void, unknown>;
348
381
  getHistoryOfRecord(id: any): Promise<any[]>;
349
382
  cleanup(): void;
@@ -362,7 +395,6 @@ export declare function table({ table: table_name, database: database_name, expi
362
395
  };
363
396
  delete(identifier: import("./ResourceInterface").Id, context?: import("./ResourceInterface").Context): Promise<boolean>;
364
397
  delete(request: import("./ResourceInterface").Context, context?: import("./ResourceInterface").Context): Promise<object>;
365
- getNewId(): `${string}-${string}-${string}-${string}-${string}`;
366
398
  create(id_prefix: import("./ResourceInterface").Id, record: any, context: import("./ResourceInterface").Context): Promise<import("./ResourceInterface").Id>;
367
399
  create(record: any, context: import("./ResourceInterface").Context): Promise<import("./ResourceInterface").Id>;
368
400
  invalidate: {
@@ -410,7 +442,12 @@ export declare function dropTableMeta({ table: table_name, database: database_na
410
442
  table: any;
411
443
  database: any;
412
444
  }): Promise<any[]>;
413
- export declare function onUpdatedTable(listener: any): void;
445
+ export declare function onUpdatedTable(listener: any): {
446
+ remove(): void;
447
+ };
448
+ export declare function onRemovedDB(listener: any): {
449
+ remove(): void;
450
+ };
414
451
  export declare function getDefaultCompression(): {
415
452
  startingOffset: number;
416
453
  };
@@ -24,3 +24,9 @@ export declare function estimateCondition(table: any): (condition: any) => any;
24
24
  export declare function parseQuery(query_to_parse: any): any;
25
25
  export declare function flattenKey(key: any): any;
26
26
  export declare function intersectionEstimate(store: any, left: any, right: any): number;
27
+ export declare class SimpleURLQuery {
28
+ url: string;
29
+ constructor(url: string);
30
+ get(): void;
31
+ [Symbol.iterator](): IterableIterator<any>;
32
+ }