harperdb 4.3.20 → 4.3.21
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 +57 -57
- package/bin/lite.js +19 -19
- package/index.d.ts +1 -0
- package/launchServiceScripts/launchInstallNATSServer.js +1 -1
- package/launchServiceScripts/launchNatsIngestService.js +19 -19
- package/launchServiceScripts/launchNatsReplyService.js +19 -19
- package/launchServiceScripts/launchUpdateNodes4-0-0.js +19 -19
- package/npm-shrinkwrap.json +1021 -1023
- package/package.json +14 -6
- package/resources/Resource.d.ts +0 -1
- package/resources/Table.d.ts +588 -0
- package/resources/databases.d.ts +417 -0
- package/server/jobs/jobProcess.js +19 -19
- package/server/threads/threadServer.js +19 -19
- package/studio/build-local/asset-manifest.json +36 -36
- package/studio/build-local/index.html +1 -1
- package/studio/build-local/static/css/main.6c0f1b63.css +13 -0
- package/studio/build-local/static/js/{424.7d57284b.chunk.js → 424.ad87c8fd.chunk.js} +1 -1
- package/studio/build-local/static/js/{662.02ce7b65.chunk.js → 662.92e32ffc.chunk.js} +1 -1
- package/studio/build-local/static/js/723.c58acced.chunk.js +2 -0
- package/studio/build-local/static/js/807.510f66df.chunk.js +2 -0
- package/studio/build-local/static/js/browse-csvupload.453237f3.chunk.js +1 -0
- package/studio/build-local/static/js/browse-datatable.b9ef2d28.chunk.js +1 -0
- package/studio/build-local/static/js/browse-entitymanager.50827a5a.chunk.js +1 -0
- package/studio/build-local/static/js/browse-jsonviewer.a2534004.chunk.js +1 -0
- package/studio/build-local/static/js/custom-functions.dd7e182c.chunk.js +1 -0
- package/studio/build-local/static/js/instance-charts.34d15f02.chunk.js +1 -0
- package/studio/build-local/static/js/instance-cluster.5bce430c.chunk.js +1 -0
- package/studio/build-local/static/js/instance-config.70c17b53.chunk.js +1 -0
- package/studio/build-local/static/js/instance-query.4f6eec62.chunk.js +1 -0
- package/studio/build-local/static/js/instance-roles.507a4ed0.chunk.js +1 -0
- package/studio/build-local/static/js/instance-status.ce9d7f64.chunk.js +1 -0
- package/studio/build-local/static/js/instance-users-datatable.190640fd.chunk.js +1 -0
- package/studio/build-local/static/js/{instance-users-edit.436e0908.chunk.js → instance-users-edit.d2444479.chunk.js} +1 -1
- package/studio/build-local/static/js/instance-users.eabfbbde.chunk.js +1 -0
- package/studio/build-local/static/js/instance.a163623f.chunk.js +1 -0
- package/studio/build-local/static/js/instances.6b88a87c.chunk.js +1 -0
- package/studio/build-local/static/js/{main.35352915.js → main.a22f6951.js} +2 -2
- package/studio/build-local/static/js/offline-app.7371216b.chunk.js +1 -0
- package/studio/build-local/static/js/online-app.db436eec.chunk.js +1 -0
- package/studio/build-local/static/js/organization-billing.b2f260f0.chunk.js +1 -0
- package/studio/build-local/static/js/organization-users.b6171b18.chunk.js +1 -0
- package/studio/build-local/static/js/organization.7800f16a.chunk.js +1 -0
- package/studio/build-local/static/js/organizations.8bb505f2.chunk.js +1 -0
- package/studio/build-local/static/js/profile.292bdd86.chunk.js +1 -0
- package/studio/build-local/static/js/roles-jsonviewer.c11f1816.chunk.js +1 -0
- package/studio/build-local/static/js/signIn.b11bdc50.chunk.js +1 -0
- package/studio/build-local/static/js/signUp.564d4e0b.chunk.js +1 -0
- package/studio/build-local/static/js/structure-reloader.b6de4091.chunk.js +1 -0
- package/studio/build-local/static/js/topnav.4fd41d60.chunk.js +1 -0
- package/utility/scripts/restartHdb.js +19 -19
- package/studio/build-local/static/css/main.038ec116.css +0 -13
- package/studio/build-local/static/js/723.36068040.chunk.js +0 -2
- package/studio/build-local/static/js/807.3473ab0a.chunk.js +0 -2
- package/studio/build-local/static/js/browse-csvupload.5e77eb8a.chunk.js +0 -1
- package/studio/build-local/static/js/browse-datatable.cd71d518.chunk.js +0 -1
- package/studio/build-local/static/js/browse-entitymanager.09237801.chunk.js +0 -1
- package/studio/build-local/static/js/browse-jsonviewer.fcccabdc.chunk.js +0 -1
- package/studio/build-local/static/js/custom-functions.98af4a5e.chunk.js +0 -1
- package/studio/build-local/static/js/instance-charts.f1a1969d.chunk.js +0 -1
- package/studio/build-local/static/js/instance-cluster.0dc3ac1b.chunk.js +0 -1
- package/studio/build-local/static/js/instance-config.19223fab.chunk.js +0 -1
- package/studio/build-local/static/js/instance-query.ed7e59f5.chunk.js +0 -1
- package/studio/build-local/static/js/instance-roles.9c3f140d.chunk.js +0 -1
- package/studio/build-local/static/js/instance-status.1687cd77.chunk.js +0 -1
- package/studio/build-local/static/js/instance-users-datatable.ced7813f.chunk.js +0 -1
- package/studio/build-local/static/js/instance-users.12c0c117.chunk.js +0 -1
- package/studio/build-local/static/js/instance.b8863754.chunk.js +0 -1
- package/studio/build-local/static/js/instances.5bd051eb.chunk.js +0 -1
- package/studio/build-local/static/js/offline-app.b3ad12ac.chunk.js +0 -1
- package/studio/build-local/static/js/online-app.2ac03c15.chunk.js +0 -1
- package/studio/build-local/static/js/organization-billing.a8014c6f.chunk.js +0 -1
- package/studio/build-local/static/js/organization-users.523136d9.chunk.js +0 -1
- package/studio/build-local/static/js/organization.0abc89ca.chunk.js +0 -1
- package/studio/build-local/static/js/organizations.e536b86f.chunk.js +0 -1
- package/studio/build-local/static/js/profile.92f9be59.chunk.js +0 -1
- package/studio/build-local/static/js/roles-jsonviewer.5fe72bc9.chunk.js +0 -1
- package/studio/build-local/static/js/signIn.97bded2f.chunk.js +0 -1
- package/studio/build-local/static/js/signUp.482f9fe4.chunk.js +0 -1
- package/studio/build-local/static/js/structure-reloader.9322abd3.chunk.js +0 -1
- package/studio/build-local/static/js/topnav.5e7913a5.chunk.js +0 -1
- /package/studio/build-local/static/js/{723.36068040.chunk.js.LICENSE.txt → 723.c58acced.chunk.js.LICENSE.txt} +0 -0
- /package/studio/build-local/static/js/{807.3473ab0a.chunk.js.LICENSE.txt → 807.510f66df.chunk.js.LICENSE.txt} +0 -0
- /package/studio/build-local/static/js/{main.35352915.js.LICENSE.txt → main.a22f6951.js.LICENSE.txt} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "harperdb",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.21",
|
|
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",
|
|
@@ -10,10 +10,18 @@
|
|
|
10
10
|
"broker",
|
|
11
11
|
"mqtt",
|
|
12
12
|
"real-time",
|
|
13
|
-
"cloud",
|
|
14
13
|
"enterprise",
|
|
15
14
|
"Fastify",
|
|
16
|
-
"NATS"
|
|
15
|
+
"NATS",
|
|
16
|
+
"HarperDB",
|
|
17
|
+
"Harper",
|
|
18
|
+
"clustering",
|
|
19
|
+
"replication",
|
|
20
|
+
"REST",
|
|
21
|
+
"WebSockets",
|
|
22
|
+
"decentralized",
|
|
23
|
+
"server-sent events",
|
|
24
|
+
"document store"
|
|
17
25
|
],
|
|
18
26
|
"main": "harperdb.js",
|
|
19
27
|
"bin": {
|
|
@@ -35,8 +43,8 @@
|
|
|
35
43
|
},
|
|
36
44
|
"license": "SEE LICENSE IN LICENSE",
|
|
37
45
|
"dependencies": {
|
|
38
|
-
"@aws-sdk/client-s3": "3.
|
|
39
|
-
"@aws-sdk/lib-storage": "3.
|
|
46
|
+
"@aws-sdk/client-s3": "3.635.0",
|
|
47
|
+
"@aws-sdk/lib-storage": "3.635.0",
|
|
40
48
|
"@endo/static-module-record": "^1.0.4",
|
|
41
49
|
"@fastify/autoload": "5.7.1",
|
|
42
50
|
"@fastify/compress": "~6.5.0",
|
|
@@ -69,7 +77,7 @@
|
|
|
69
77
|
"json2csv": "5.0.7",
|
|
70
78
|
"jsonata": "1.8.7",
|
|
71
79
|
"jsonwebtoken": "9.0.2",
|
|
72
|
-
"lmdb": "3.0.
|
|
80
|
+
"lmdb": "3.0.14",
|
|
73
81
|
"lodash": "4.17.21",
|
|
74
82
|
"mathjs": "11.12.0",
|
|
75
83
|
"minimist": "1.2.8",
|
package/resources/Resource.d.ts
CHANGED
|
@@ -20,7 +20,6 @@ export declare class Resource implements ResourceInterface {
|
|
|
20
20
|
static transactions: Transaction[] & {
|
|
21
21
|
timestamp: number;
|
|
22
22
|
};
|
|
23
|
-
[CONTEXT]: Context;
|
|
24
23
|
constructor(identifier: Id, source: any);
|
|
25
24
|
/**
|
|
26
25
|
* The get methods are for directly getting a resource, and called for HTTP GET requests.
|
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module provides the main table implementation of the Resource API, providing full access to HarperDB
|
|
3
|
+
* tables through the interface defined by the Resource class. This module is responsible for handling these
|
|
4
|
+
* table-level interactions, loading records, updating records, querying, and more.
|
|
5
|
+
*/
|
|
6
|
+
import { Database } from 'lmdb';
|
|
7
|
+
import { Query, ResourceInterface, SubscriptionRequest, Id, Context } from './ResourceInterface';
|
|
8
|
+
import { Resource } from './Resource';
|
|
9
|
+
export interface Table {
|
|
10
|
+
primaryStore: Database;
|
|
11
|
+
auditStore: Database;
|
|
12
|
+
indices: {};
|
|
13
|
+
databasePath: string;
|
|
14
|
+
tableName: string;
|
|
15
|
+
databaseName: string;
|
|
16
|
+
attributes: any[];
|
|
17
|
+
primaryKey: string;
|
|
18
|
+
subscriptions: Map<any, Function[]>;
|
|
19
|
+
expirationMS: number;
|
|
20
|
+
indexingOperations?: Promise<void>;
|
|
21
|
+
sources: {
|
|
22
|
+
new (): ResourceInterface;
|
|
23
|
+
}[];
|
|
24
|
+
Transaction: ReturnType<typeof makeTable>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* This returns a Table class for the given table settings (determined from the metadata table)
|
|
28
|
+
* Instances of the returned class are Resource instances, intended to provide a consistent view or transaction of the table
|
|
29
|
+
* @param options
|
|
30
|
+
*/
|
|
31
|
+
export declare function makeTable(options: any): {
|
|
32
|
+
new (identifier: Id, source: any): {
|
|
33
|
+
/**
|
|
34
|
+
* This is a request to explicitly ensure that the record is loaded from source, rather than only using the local record.
|
|
35
|
+
* This will load from source if the current record is expired, missing, or invalidated.
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
ensureLoaded(): any;
|
|
39
|
+
/**
|
|
40
|
+
* This retrieves the data of this resource. By default, with no argument, just return `this`.
|
|
41
|
+
* @param query - If included, specifies a query to perform on the record
|
|
42
|
+
*/
|
|
43
|
+
get(query?: Query | string): Promise<object | void> | object | void;
|
|
44
|
+
/**
|
|
45
|
+
* Determine if the user is allowed to get/read data from the current resource
|
|
46
|
+
* @param user The current, authenticated user
|
|
47
|
+
* @param query The parsed query from the search part of the URL
|
|
48
|
+
*/
|
|
49
|
+
allowRead(user: any, query: any): any;
|
|
50
|
+
/**
|
|
51
|
+
* Determine if the user is allowed to update data from the current resource
|
|
52
|
+
* @param user The current, authenticated user
|
|
53
|
+
* @param updated_data
|
|
54
|
+
* @param full_update
|
|
55
|
+
*/
|
|
56
|
+
allowUpdate(user: any, updated_data: any): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Determine if the user is allowed to create new data in the current resource
|
|
59
|
+
* @param user The current, authenticated user
|
|
60
|
+
* @param new_data
|
|
61
|
+
*/
|
|
62
|
+
allowCreate(user: any, new_data: {}): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Determine if the user is allowed to delete from the current resource
|
|
65
|
+
* @param user The current, authenticated user
|
|
66
|
+
*/
|
|
67
|
+
allowDelete(user: any): any;
|
|
68
|
+
/**
|
|
69
|
+
* Start updating a record. The returned resource will record changes which are written
|
|
70
|
+
* once the corresponding transaction is committed. These changes can (eventually) include CRDT type operations.
|
|
71
|
+
* @param updates This can be a record to update the current resource with.
|
|
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
|
+
*/
|
|
74
|
+
update(updates?: any, full_update?: boolean): any;
|
|
75
|
+
addTo(property: any, value: any): void;
|
|
76
|
+
subtractFrom(property: any, value: any): void;
|
|
77
|
+
getMetadata(): any;
|
|
78
|
+
invalidate(options: any): void;
|
|
79
|
+
/**
|
|
80
|
+
* This is intended to acquire a lock on a record from the whole cluster.
|
|
81
|
+
*/
|
|
82
|
+
lock(): void;
|
|
83
|
+
/**
|
|
84
|
+
* Store the provided record data into the current resource. This is not written
|
|
85
|
+
* until the corresponding transaction is committed. This will either immediately fail (synchronously) or always
|
|
86
|
+
* succeed. That doesn't necessarily mean it will "win", another concurrent put could come "after" (monotonically,
|
|
87
|
+
* even if not chronologically) this one.
|
|
88
|
+
* @param record
|
|
89
|
+
* @param options
|
|
90
|
+
*/
|
|
91
|
+
put(record: any): void;
|
|
92
|
+
patch(record_update: any): void;
|
|
93
|
+
_writeUpdate(record_update: any, full_update: boolean, options?: any): void;
|
|
94
|
+
delete(request?: Query | string): Promise<boolean>;
|
|
95
|
+
_writeDelete(options?: any): boolean;
|
|
96
|
+
search(request: Query): AsyncIterable<any>;
|
|
97
|
+
subscribe(request: SubscriptionRequest): Promise<{
|
|
98
|
+
listener: (key: any) => any;
|
|
99
|
+
subscriptions: [];
|
|
100
|
+
startTime?: number;
|
|
101
|
+
end(): void;
|
|
102
|
+
toJSON(): {
|
|
103
|
+
name: string;
|
|
104
|
+
};
|
|
105
|
+
resolveNext: Function;
|
|
106
|
+
queue: any[];
|
|
107
|
+
hasDataListeners: boolean;
|
|
108
|
+
push(message: any): void;
|
|
109
|
+
send(message: any): void;
|
|
110
|
+
getNextMessage(): any;
|
|
111
|
+
on(event_name: any, listener: any): any;
|
|
112
|
+
[Symbol.asyncIterator](): {
|
|
113
|
+
queue: import("./IterableEventQueue").IterableEventQueue;
|
|
114
|
+
push(message: any): void;
|
|
115
|
+
next(): Promise<unknown> | {
|
|
116
|
+
value: any;
|
|
117
|
+
};
|
|
118
|
+
return(value: any): {
|
|
119
|
+
value: any;
|
|
120
|
+
done: boolean;
|
|
121
|
+
};
|
|
122
|
+
throw(error: any): {
|
|
123
|
+
done: boolean;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
|
|
127
|
+
addListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
128
|
+
once<K>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
129
|
+
removeListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
130
|
+
off<K>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
131
|
+
removeAllListeners(eventName?: string | symbol): any;
|
|
132
|
+
setMaxListeners(n: number): any;
|
|
133
|
+
getMaxListeners(): number;
|
|
134
|
+
listeners<K>(eventName: string | symbol): Function[];
|
|
135
|
+
rawListeners<K>(eventName: string | symbol): Function[];
|
|
136
|
+
emit<K>(eventName: string | symbol, ...args: any[]): boolean;
|
|
137
|
+
listenerCount<K>(eventName: string | symbol, listener?: Function): number;
|
|
138
|
+
prependListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
139
|
+
prependOnceListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
140
|
+
eventNames(): (string | symbol)[];
|
|
141
|
+
}>;
|
|
142
|
+
doesExist(): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Publishing a message to a record adds an (observable) entry in the audit log, but does not change
|
|
145
|
+
* the record at all. This entries should be replicated and trigger subscription listeners.
|
|
146
|
+
* @param id
|
|
147
|
+
* @param message
|
|
148
|
+
* @param options
|
|
149
|
+
*/
|
|
150
|
+
publish(message: any, options?: any): void;
|
|
151
|
+
_writePublish(message: any, options?: any): void;
|
|
152
|
+
validate(record: any, patch?: any): void;
|
|
153
|
+
getUpdatedTime(): any;
|
|
154
|
+
wasLoadedFromSource(): boolean | void;
|
|
155
|
+
post(new_record: any): any;
|
|
156
|
+
connect(query?: {}): AsyncIterable<any>;
|
|
157
|
+
getId(): any;
|
|
158
|
+
getContext(): Context;
|
|
159
|
+
};
|
|
160
|
+
name: any;
|
|
161
|
+
primaryStore: any;
|
|
162
|
+
auditStore: any;
|
|
163
|
+
primaryKey: any;
|
|
164
|
+
tableName: any;
|
|
165
|
+
indices: any;
|
|
166
|
+
audit: any;
|
|
167
|
+
databasePath: any;
|
|
168
|
+
databaseName: any;
|
|
169
|
+
attributes: any;
|
|
170
|
+
expirationTimer: any;
|
|
171
|
+
createdTimeProperty: any;
|
|
172
|
+
updatedTimeProperty: any;
|
|
173
|
+
propertyResolvers: any;
|
|
174
|
+
sources: any[];
|
|
175
|
+
readonly expirationMS: any;
|
|
176
|
+
dbisDB: any;
|
|
177
|
+
schemaDefined: any;
|
|
178
|
+
/**
|
|
179
|
+
* This defines a source for a table. This effectively makes a table into a cache, where the canonical
|
|
180
|
+
* source of data (or source of truth) is provided here in the Resource argument. Additional options
|
|
181
|
+
* can be provided to indicate how the caching should be handled.
|
|
182
|
+
* @param source
|
|
183
|
+
* @param options
|
|
184
|
+
* @returns
|
|
185
|
+
*/
|
|
186
|
+
sourcedFrom(source: any, options: any): any;
|
|
187
|
+
/**
|
|
188
|
+
* Gets a resource instance, as defined by the Resource class, adding the table-specific handling
|
|
189
|
+
* of also loading the stored record into the resource instance.
|
|
190
|
+
* @param id
|
|
191
|
+
* @param request
|
|
192
|
+
* @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
|
+
* @returns
|
|
194
|
+
*/
|
|
195
|
+
getResource(id: Id, request: any, resource_options?: any): Promise<{
|
|
196
|
+
/**
|
|
197
|
+
* This is a request to explicitly ensure that the record is loaded from source, rather than only using the local record.
|
|
198
|
+
* This will load from source if the current record is expired, missing, or invalidated.
|
|
199
|
+
* @returns
|
|
200
|
+
*/
|
|
201
|
+
ensureLoaded(): any;
|
|
202
|
+
/**
|
|
203
|
+
* This retrieves the data of this resource. By default, with no argument, just return `this`.
|
|
204
|
+
* @param query - If included, specifies a query to perform on the record
|
|
205
|
+
*/
|
|
206
|
+
get(query?: Query | string): Promise<object | void> | object | void;
|
|
207
|
+
/**
|
|
208
|
+
* Determine if the user is allowed to get/read data from the current resource
|
|
209
|
+
* @param user The current, authenticated user
|
|
210
|
+
* @param query The parsed query from the search part of the URL
|
|
211
|
+
*/
|
|
212
|
+
allowRead(user: any, query: any): any;
|
|
213
|
+
/**
|
|
214
|
+
* Determine if the user is allowed to update data from the current resource
|
|
215
|
+
* @param user The current, authenticated user
|
|
216
|
+
* @param updated_data
|
|
217
|
+
* @param full_update
|
|
218
|
+
*/
|
|
219
|
+
allowUpdate(user: any, updated_data: any): boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Determine if the user is allowed to create new data in the current resource
|
|
222
|
+
* @param user The current, authenticated user
|
|
223
|
+
* @param new_data
|
|
224
|
+
*/
|
|
225
|
+
allowCreate(user: any, new_data: {}): boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Determine if the user is allowed to delete from the current resource
|
|
228
|
+
* @param user The current, authenticated user
|
|
229
|
+
*/
|
|
230
|
+
allowDelete(user: any): any;
|
|
231
|
+
/**
|
|
232
|
+
* Start updating a record. The returned resource will record changes which are written
|
|
233
|
+
* once the corresponding transaction is committed. These changes can (eventually) include CRDT type operations.
|
|
234
|
+
* @param updates This can be a record to update the current resource with.
|
|
235
|
+
* @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
|
|
236
|
+
*/
|
|
237
|
+
update(updates?: any, full_update?: boolean): any;
|
|
238
|
+
addTo(property: any, value: any): void;
|
|
239
|
+
subtractFrom(property: any, value: any): void;
|
|
240
|
+
getMetadata(): any;
|
|
241
|
+
invalidate(options: any): void;
|
|
242
|
+
/**
|
|
243
|
+
* This is intended to acquire a lock on a record from the whole cluster.
|
|
244
|
+
*/
|
|
245
|
+
lock(): void;
|
|
246
|
+
/**
|
|
247
|
+
* Store the provided record data into the current resource. This is not written
|
|
248
|
+
* until the corresponding transaction is committed. This will either immediately fail (synchronously) or always
|
|
249
|
+
* succeed. That doesn't necessarily mean it will "win", another concurrent put could come "after" (monotonically,
|
|
250
|
+
* even if not chronologically) this one.
|
|
251
|
+
* @param record
|
|
252
|
+
* @param options
|
|
253
|
+
*/
|
|
254
|
+
put(record: any): void;
|
|
255
|
+
patch(record_update: any): void;
|
|
256
|
+
_writeUpdate(record_update: any, full_update: boolean, options?: any): void;
|
|
257
|
+
delete(request?: Query | string): Promise<boolean>;
|
|
258
|
+
_writeDelete(options?: any): boolean;
|
|
259
|
+
search(request: Query): AsyncIterable<any>;
|
|
260
|
+
subscribe(request: SubscriptionRequest): Promise<{
|
|
261
|
+
listener: (key: any) => any;
|
|
262
|
+
subscriptions: [];
|
|
263
|
+
startTime?: number;
|
|
264
|
+
end(): void;
|
|
265
|
+
toJSON(): {
|
|
266
|
+
name: string;
|
|
267
|
+
};
|
|
268
|
+
resolveNext: Function;
|
|
269
|
+
queue: any[];
|
|
270
|
+
hasDataListeners: boolean;
|
|
271
|
+
push(message: any): void;
|
|
272
|
+
send(message: any): void;
|
|
273
|
+
getNextMessage(): any;
|
|
274
|
+
on(event_name: any, listener: any): any;
|
|
275
|
+
[Symbol.asyncIterator](): {
|
|
276
|
+
queue: import("./IterableEventQueue").IterableEventQueue;
|
|
277
|
+
push(message: any): void;
|
|
278
|
+
next(): Promise<unknown> | {
|
|
279
|
+
value: any;
|
|
280
|
+
};
|
|
281
|
+
return(value: any): {
|
|
282
|
+
value: any;
|
|
283
|
+
done: boolean;
|
|
284
|
+
};
|
|
285
|
+
throw(error: any): {
|
|
286
|
+
done: boolean;
|
|
287
|
+
};
|
|
288
|
+
};
|
|
289
|
+
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
|
|
290
|
+
addListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
291
|
+
once<K>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
292
|
+
removeListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
293
|
+
off<K>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
294
|
+
removeAllListeners(eventName?: string | symbol): any;
|
|
295
|
+
setMaxListeners(n: number): any;
|
|
296
|
+
getMaxListeners(): number;
|
|
297
|
+
listeners<K>(eventName: string | symbol): Function[];
|
|
298
|
+
rawListeners<K>(eventName: string | symbol): Function[];
|
|
299
|
+
emit<K>(eventName: string | symbol, ...args: any[]): boolean;
|
|
300
|
+
listenerCount<K>(eventName: string | symbol, listener?: Function): number;
|
|
301
|
+
prependListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
302
|
+
prependOnceListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
303
|
+
eventNames(): (string | symbol)[];
|
|
304
|
+
}>;
|
|
305
|
+
doesExist(): boolean;
|
|
306
|
+
/**
|
|
307
|
+
* Publishing a message to a record adds an (observable) entry in the audit log, but does not change
|
|
308
|
+
* the record at all. This entries should be replicated and trigger subscription listeners.
|
|
309
|
+
* @param id
|
|
310
|
+
* @param message
|
|
311
|
+
* @param options
|
|
312
|
+
*/
|
|
313
|
+
publish(message: any, options?: any): void;
|
|
314
|
+
_writePublish(message: any, options?: any): void;
|
|
315
|
+
validate(record: any, patch?: any): void;
|
|
316
|
+
getUpdatedTime(): any;
|
|
317
|
+
wasLoadedFromSource(): boolean | void;
|
|
318
|
+
post(new_record: any): any;
|
|
319
|
+
connect(query?: {}): AsyncIterable<any>;
|
|
320
|
+
getId(): any;
|
|
321
|
+
getContext(): Context;
|
|
322
|
+
}> | {
|
|
323
|
+
/**
|
|
324
|
+
* This is a request to explicitly ensure that the record is loaded from source, rather than only using the local record.
|
|
325
|
+
* This will load from source if the current record is expired, missing, or invalidated.
|
|
326
|
+
* @returns
|
|
327
|
+
*/
|
|
328
|
+
ensureLoaded(): any;
|
|
329
|
+
/**
|
|
330
|
+
* This retrieves the data of this resource. By default, with no argument, just return `this`.
|
|
331
|
+
* @param query - If included, specifies a query to perform on the record
|
|
332
|
+
*/
|
|
333
|
+
get(query?: Query | string): Promise<object | void> | object | void;
|
|
334
|
+
/**
|
|
335
|
+
* Determine if the user is allowed to get/read data from the current resource
|
|
336
|
+
* @param user The current, authenticated user
|
|
337
|
+
* @param query The parsed query from the search part of the URL
|
|
338
|
+
*/
|
|
339
|
+
allowRead(user: any, query: any): any;
|
|
340
|
+
/**
|
|
341
|
+
* Determine if the user is allowed to update data from the current resource
|
|
342
|
+
* @param user The current, authenticated user
|
|
343
|
+
* @param updated_data
|
|
344
|
+
* @param full_update
|
|
345
|
+
*/
|
|
346
|
+
allowUpdate(user: any, updated_data: any): boolean;
|
|
347
|
+
/**
|
|
348
|
+
* Determine if the user is allowed to create new data in the current resource
|
|
349
|
+
* @param user The current, authenticated user
|
|
350
|
+
* @param new_data
|
|
351
|
+
*/
|
|
352
|
+
allowCreate(user: any, new_data: {}): boolean;
|
|
353
|
+
/**
|
|
354
|
+
* Determine if the user is allowed to delete from the current resource
|
|
355
|
+
* @param user The current, authenticated user
|
|
356
|
+
*/
|
|
357
|
+
allowDelete(user: any): any;
|
|
358
|
+
/**
|
|
359
|
+
* Start updating a record. The returned resource will record changes which are written
|
|
360
|
+
* once the corresponding transaction is committed. These changes can (eventually) include CRDT type operations.
|
|
361
|
+
* @param updates This can be a record to update the current resource with.
|
|
362
|
+
* @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
|
|
363
|
+
*/
|
|
364
|
+
update(updates?: any, full_update?: boolean): any;
|
|
365
|
+
addTo(property: any, value: any): void;
|
|
366
|
+
subtractFrom(property: any, value: any): void;
|
|
367
|
+
getMetadata(): any;
|
|
368
|
+
invalidate(options: any): void;
|
|
369
|
+
/**
|
|
370
|
+
* This is intended to acquire a lock on a record from the whole cluster.
|
|
371
|
+
*/
|
|
372
|
+
lock(): void;
|
|
373
|
+
/**
|
|
374
|
+
* Store the provided record data into the current resource. This is not written
|
|
375
|
+
* until the corresponding transaction is committed. This will either immediately fail (synchronously) or always
|
|
376
|
+
* succeed. That doesn't necessarily mean it will "win", another concurrent put could come "after" (monotonically,
|
|
377
|
+
* even if not chronologically) this one.
|
|
378
|
+
* @param record
|
|
379
|
+
* @param options
|
|
380
|
+
*/
|
|
381
|
+
put(record: any): void;
|
|
382
|
+
patch(record_update: any): void;
|
|
383
|
+
_writeUpdate(record_update: any, full_update: boolean, options?: any): void;
|
|
384
|
+
delete(request?: Query | string): Promise<boolean>;
|
|
385
|
+
_writeDelete(options?: any): boolean;
|
|
386
|
+
search(request: Query): AsyncIterable<any>;
|
|
387
|
+
subscribe(request: SubscriptionRequest): Promise<{
|
|
388
|
+
listener: (key: any) => any;
|
|
389
|
+
subscriptions: [];
|
|
390
|
+
startTime?: number;
|
|
391
|
+
end(): void;
|
|
392
|
+
toJSON(): {
|
|
393
|
+
name: string;
|
|
394
|
+
};
|
|
395
|
+
resolveNext: Function;
|
|
396
|
+
queue: any[];
|
|
397
|
+
hasDataListeners: boolean;
|
|
398
|
+
push(message: any): void;
|
|
399
|
+
send(message: any): void;
|
|
400
|
+
getNextMessage(): any;
|
|
401
|
+
on(event_name: any, listener: any): any;
|
|
402
|
+
[Symbol.asyncIterator](): {
|
|
403
|
+
queue: import("./IterableEventQueue").IterableEventQueue;
|
|
404
|
+
push(message: any): void;
|
|
405
|
+
next(): Promise<unknown> | {
|
|
406
|
+
value: any;
|
|
407
|
+
};
|
|
408
|
+
return(value: any): {
|
|
409
|
+
value: any;
|
|
410
|
+
done: boolean;
|
|
411
|
+
};
|
|
412
|
+
throw(error: any): {
|
|
413
|
+
done: boolean;
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
|
|
417
|
+
addListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
418
|
+
once<K>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
419
|
+
removeListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
420
|
+
off<K>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
421
|
+
removeAllListeners(eventName?: string | symbol): any;
|
|
422
|
+
setMaxListeners(n: number): any;
|
|
423
|
+
getMaxListeners(): number;
|
|
424
|
+
listeners<K>(eventName: string | symbol): Function[];
|
|
425
|
+
rawListeners<K>(eventName: string | symbol): Function[];
|
|
426
|
+
emit<K>(eventName: string | symbol, ...args: any[]): boolean;
|
|
427
|
+
listenerCount<K>(eventName: string | symbol, listener?: Function): number;
|
|
428
|
+
prependListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
429
|
+
prependOnceListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
430
|
+
eventNames(): (string | symbol)[];
|
|
431
|
+
}>;
|
|
432
|
+
doesExist(): boolean;
|
|
433
|
+
/**
|
|
434
|
+
* Publishing a message to a record adds an (observable) entry in the audit log, but does not change
|
|
435
|
+
* the record at all. This entries should be replicated and trigger subscription listeners.
|
|
436
|
+
* @param id
|
|
437
|
+
* @param message
|
|
438
|
+
* @param options
|
|
439
|
+
*/
|
|
440
|
+
publish(message: any, options?: any): void;
|
|
441
|
+
_writePublish(message: any, options?: any): void;
|
|
442
|
+
validate(record: any, patch?: any): void;
|
|
443
|
+
getUpdatedTime(): any;
|
|
444
|
+
wasLoadedFromSource(): boolean | void;
|
|
445
|
+
post(new_record: any): any;
|
|
446
|
+
connect(query?: {}): AsyncIterable<any>;
|
|
447
|
+
getId(): any;
|
|
448
|
+
getContext(): Context;
|
|
449
|
+
};
|
|
450
|
+
/**
|
|
451
|
+
* Set TTL expiration for records in this table. On retrieval, record timestamps are checked for expiration.
|
|
452
|
+
* This also informs the scheduling for record eviction.
|
|
453
|
+
* @param expiration_time Time in seconds until records expire (are stale)
|
|
454
|
+
* @param eviction_time Time in seconds until records are evicted (removed)
|
|
455
|
+
*/
|
|
456
|
+
setTTLExpiration(expiration: number | {
|
|
457
|
+
expiration: number;
|
|
458
|
+
eviction?: number;
|
|
459
|
+
scanInterval?: number;
|
|
460
|
+
}): void;
|
|
461
|
+
/**
|
|
462
|
+
* Turn on auditing at runtime
|
|
463
|
+
*/
|
|
464
|
+
enableAuditing(audit_enabled?: boolean): void;
|
|
465
|
+
/**
|
|
466
|
+
* Coerce the id as a string to the correct type for the primary key
|
|
467
|
+
* @param id
|
|
468
|
+
* @returns
|
|
469
|
+
*/
|
|
470
|
+
coerceId(id: string): number | string;
|
|
471
|
+
dropTable(): Promise<void>;
|
|
472
|
+
/**
|
|
473
|
+
* 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
|
+
*/
|
|
475
|
+
evict(id: any, existing_record: any, existing_version: any): any;
|
|
476
|
+
operation(operation: any, context: any): any;
|
|
477
|
+
/**
|
|
478
|
+
* This is responsible for ordering and select()ing the attributes/properties from returned entries
|
|
479
|
+
* @param select
|
|
480
|
+
* @param context
|
|
481
|
+
* @param filtered
|
|
482
|
+
* @param ensure_loaded
|
|
483
|
+
* @param can_skip
|
|
484
|
+
* @returns
|
|
485
|
+
*/
|
|
486
|
+
transformToOrderedSelect(entries: any, select: any, sort: any, context: any, read_txn: any, transformToRecord: any): any;
|
|
487
|
+
/**
|
|
488
|
+
* This is responsible for select()ing the attributes/properties from returned entries
|
|
489
|
+
* @param select
|
|
490
|
+
* @param context
|
|
491
|
+
* @param filtered
|
|
492
|
+
* @param ensure_loaded
|
|
493
|
+
* @param can_skip
|
|
494
|
+
* @returns
|
|
495
|
+
*/
|
|
496
|
+
transformEntryForSelect(select: any, context: any, read_txn: any, filtered: any, ensure_loaded?: any, can_skip?: any): (entry: any) => any;
|
|
497
|
+
addAttributes(attributes_to_add: any): Promise<any>;
|
|
498
|
+
removeAttributes(names: string[]): Promise<any>;
|
|
499
|
+
getRecordCount(options: any): {
|
|
500
|
+
recordCount: number;
|
|
501
|
+
estimatedRange: number[];
|
|
502
|
+
} | {
|
|
503
|
+
recordCount: number;
|
|
504
|
+
estimatedRange?: undefined;
|
|
505
|
+
};
|
|
506
|
+
/**
|
|
507
|
+
* When attributes have been changed, we update the accessors that are assigned to this table
|
|
508
|
+
*/
|
|
509
|
+
updatedAttributes(): void;
|
|
510
|
+
deleteHistory(end_time?: number): Promise<void>;
|
|
511
|
+
getHistory(start_time?: number, end_time?: number): AsyncGenerator<{
|
|
512
|
+
id: import("ordered-binary").Key;
|
|
513
|
+
localTime: any;
|
|
514
|
+
version: any;
|
|
515
|
+
type: any;
|
|
516
|
+
value: any;
|
|
517
|
+
user: import("ordered-binary").Key;
|
|
518
|
+
}, void, unknown>;
|
|
519
|
+
getHistoryOfRecord(id: any): Promise<any[]>;
|
|
520
|
+
cleanup(): void;
|
|
521
|
+
transactions: import("./DatabaseTransaction").Transaction[] & {
|
|
522
|
+
timestamp: number;
|
|
523
|
+
};
|
|
524
|
+
get(identifier: Id, context?: Context): Promise<Resource>;
|
|
525
|
+
get(query: Query, context?: Context): Promise<AsyncIterable<object>>;
|
|
526
|
+
put: {
|
|
527
|
+
(id_or_query: string | Id, data_or_context?: any, context?: Context): any;
|
|
528
|
+
reliesOnPrototype: boolean;
|
|
529
|
+
};
|
|
530
|
+
patch: {
|
|
531
|
+
(id_or_query: string | Id, data_or_context?: any, context?: Context): any;
|
|
532
|
+
reliesOnPrototype: boolean;
|
|
533
|
+
};
|
|
534
|
+
delete(identifier: Id, context?: Context): Promise<boolean>;
|
|
535
|
+
delete(request: Context, context?: Context): Promise<object>;
|
|
536
|
+
getNewId(): `${string}-${string}-${string}-${string}-${string}`;
|
|
537
|
+
create(id_prefix: Id, record: any, context: Context): Promise<Id>;
|
|
538
|
+
create(record: any, context: Context): Promise<Id>;
|
|
539
|
+
invalidate: {
|
|
540
|
+
(id_or_query: string | Id, data_or_context?: any, context?: Context): any;
|
|
541
|
+
reliesOnPrototype: boolean;
|
|
542
|
+
};
|
|
543
|
+
post: {
|
|
544
|
+
(id_or_query: string | Id, data_or_context?: any, context?: Context): any;
|
|
545
|
+
reliesOnPrototype: boolean;
|
|
546
|
+
};
|
|
547
|
+
connect: {
|
|
548
|
+
(id_or_query: string | Id, data_or_context?: any, context?: Context): any;
|
|
549
|
+
reliesOnPrototype: boolean;
|
|
550
|
+
};
|
|
551
|
+
subscribe(request: SubscriptionRequest): Promise<AsyncIterable<{
|
|
552
|
+
id: any;
|
|
553
|
+
operation: string;
|
|
554
|
+
value: object;
|
|
555
|
+
}>>;
|
|
556
|
+
publish: {
|
|
557
|
+
(id_or_query: string | Id, data_or_context?: any, context?: Context): any;
|
|
558
|
+
reliesOnPrototype: boolean;
|
|
559
|
+
};
|
|
560
|
+
search: {
|
|
561
|
+
(id_or_query: string | Id, data_or_context?: any, context?: Context): any;
|
|
562
|
+
reliesOnPrototype: boolean;
|
|
563
|
+
};
|
|
564
|
+
query: {
|
|
565
|
+
(id_or_query: string | Id, data_or_context?: any, context?: Context): any;
|
|
566
|
+
reliesOnPrototype: boolean;
|
|
567
|
+
};
|
|
568
|
+
copy: {
|
|
569
|
+
(id_or_query: string | Id, data_or_context?: any, context?: Context): any;
|
|
570
|
+
reliesOnPrototype: boolean;
|
|
571
|
+
};
|
|
572
|
+
move: {
|
|
573
|
+
(id_or_query: string | Id, data_or_context?: any, context?: Context): any;
|
|
574
|
+
reliesOnPrototype: boolean;
|
|
575
|
+
};
|
|
576
|
+
isCollection(resource: any): any;
|
|
577
|
+
parseQuery(search: any): any;
|
|
578
|
+
parsePath(path: any, context: any, query: any): any;
|
|
579
|
+
};
|
|
580
|
+
export declare function setServerUtilities(utilities: any): void;
|
|
581
|
+
/**
|
|
582
|
+
* Coerce a string to the type defined by the attribute
|
|
583
|
+
* @param value
|
|
584
|
+
* @param attribute
|
|
585
|
+
* @returns
|
|
586
|
+
*/
|
|
587
|
+
export declare function coerceType(value: any, attribute: any): any;
|
|
588
|
+
export declare function updateResource(resource: any, entry: any): void;
|