harperdb 4.5.7 → 4.6.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 (89) hide show
  1. package/README.md +22 -22
  2. package/bin/harperdb.js +79 -80
  3. package/bin/lite.js +77 -78
  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 +2 -2
  9. package/launchServiceScripts/launchNatsIngestService.js +77 -78
  10. package/launchServiceScripts/launchNatsReplyService.js +77 -78
  11. package/launchServiceScripts/launchUpdateNodes4-0-0.js +77 -78
  12. package/npm-shrinkwrap.json +40 -40
  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 +16 -16
  19. package/resources/ResourceInterface.d.ts +27 -12
  20. package/resources/Resources.d.ts +5 -5
  21. package/resources/Table.d.ts +72 -72
  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 +99 -99
  29. package/resources/search.d.ts +8 -8
  30. package/resources/tracked.d.ts +6 -6
  31. package/resources/transaction.d.ts +3 -3
  32. package/resources/transactionBroadcast.d.ts +5 -5
  33. package/security/auth.d.ts +9 -0
  34. package/security/tokenAuthentication.d.ts +35 -0
  35. package/server/Server.d.ts +3 -2
  36. package/server/jobs/jobProcess.js +77 -78
  37. package/server/operationsServer.d.ts +30 -0
  38. package/server/replication/knownNodes.d.ts +35 -0
  39. package/server/replication/nodeIdMapping.d.ts +6 -0
  40. package/server/replication/replicationConnection.d.ts +58 -0
  41. package/server/replication/replicator.d.ts +65 -0
  42. package/server/replication/setNode.d.ts +15 -0
  43. package/server/replication/subscriptionManager.d.ts +13 -0
  44. package/server/serverHelpers/Headers.d.ts +2 -2
  45. package/server/serverHelpers/OperationFunctionObject.d.ts +8 -0
  46. package/server/serverHelpers/contentTypes.d.ts +7 -7
  47. package/server/serverHelpers/serverUtilities.d.ts +23 -0
  48. package/server/status.d.ts +12 -0
  49. package/server/threads/threadServer.js +78 -79
  50. package/studio/build-local/asset-manifest.json +33 -33
  51. package/studio/build-local/index.html +1 -1
  52. package/studio/build-local/static/js/{153.4789ff87.chunk.js → 101.de926db6.chunk.js} +2 -2
  53. package/studio/build-local/static/js/{833.52829e9a.chunk.js → 833.475ee615.chunk.js} +1 -1
  54. package/studio/build-local/static/js/{browse-csvupload.952e3db5.chunk.js → browse-csvupload.cfcf1c79.chunk.js} +1 -1
  55. package/studio/build-local/static/js/{browse-datatable.571e41b5.chunk.js → browse-datatable.85de5169.chunk.js} +1 -1
  56. package/studio/build-local/static/js/{browse-entitymanager.f32bbc12.chunk.js → browse-entitymanager.dddb5da8.chunk.js} +1 -1
  57. package/studio/build-local/static/js/{browse-jsonviewer.f7c88853.chunk.js → browse-jsonviewer.059b4189.chunk.js} +1 -1
  58. package/studio/build-local/static/js/{custom-functions.fce857f6.chunk.js → custom-functions.2c2e634c.chunk.js} +1 -1
  59. package/studio/build-local/static/js/{instance-cluster.989f54d0.chunk.js → instance-cluster.daef89d8.chunk.js} +1 -1
  60. package/studio/build-local/static/js/{instance-config.41346a1c.chunk.js → instance-config.ba645bea.chunk.js} +1 -1
  61. package/studio/build-local/static/js/{instance-logs.70be591c.chunk.js → instance-logs.33ace406.chunk.js} +1 -1
  62. package/studio/build-local/static/js/{instance-roles.00c558b1.chunk.js → instance-roles.0276d83f.chunk.js} +1 -1
  63. package/studio/build-local/static/js/{instance-status.3e2a5f15.chunk.js → instance-status.2f3aaaf7.chunk.js} +1 -1
  64. package/studio/build-local/static/js/{instance-users-datatable.536f91b4.chunk.js → instance-users-datatable.f75cf637.chunk.js} +1 -1
  65. package/studio/build-local/static/js/{instance-users-edit.4d42f079.chunk.js → instance-users-edit.3a3bc76f.chunk.js} +1 -1
  66. package/studio/build-local/static/js/{instance-users.c8146c89.chunk.js → instance-users.70ee5db2.chunk.js} +1 -1
  67. package/studio/build-local/static/js/{instance.25742318.chunk.js → instance.0bbb9d0e.chunk.js} +1 -1
  68. package/studio/build-local/static/js/{instances.a3850b41.chunk.js → instances.e86d288b.chunk.js} +1 -1
  69. package/studio/build-local/static/js/main.24eae3d8.js +2 -0
  70. package/studio/build-local/static/js/{offline-app.ac5f38b0.chunk.js → offline-app.edb4be85.chunk.js} +1 -1
  71. package/studio/build-local/static/js/{online-app.3d563d0e.chunk.js → online-app.45440c0e.chunk.js} +1 -1
  72. package/studio/build-local/static/js/{organization-billing.8a2cd6ec.chunk.js → organization-billing.3ff0b995.chunk.js} +1 -1
  73. package/studio/build-local/static/js/{organization-users.138f50eb.chunk.js → organization-users.710f96e7.chunk.js} +1 -1
  74. package/studio/build-local/static/js/{organization.000a9206.chunk.js → organization.1aa3da8e.chunk.js} +1 -1
  75. package/studio/build-local/static/js/{organizations.73f9a526.chunk.js → organizations.259e09d3.chunk.js} +1 -1
  76. package/studio/build-local/static/js/{profile.9dc96422.chunk.js → profile.c1840496.chunk.js} +1 -1
  77. package/studio/build-local/static/js/{resetPassword.6198e026.chunk.js → resetPassword.37769fbe.chunk.js} +1 -1
  78. package/studio/build-local/static/js/{roles-jsonviewer.7ad3544a.chunk.js → roles-jsonviewer.b8cc0628.chunk.js} +1 -1
  79. package/studio/build-local/static/js/{signIn.c7a547bb.chunk.js → signIn.061b438e.chunk.js} +1 -1
  80. package/studio/build-local/static/js/{signUp.9c346cab.chunk.js → signUp.cabe1d80.chunk.js} +1 -1
  81. package/studio/build-local/static/js/{structure-reloader.71285544.chunk.js → structure-reloader.fd360bad.chunk.js} +1 -1
  82. package/studio/build-local/static/js/{topnav.491ca3cb.chunk.js → topnav.1fce7836.chunk.js} +1 -1
  83. package/studio/build-local/static/js/{updatePassword.452f5cbc.chunk.js → updatePassword.dc41627a.chunk.js} +1 -1
  84. package/utility/hdbTerms.d.ts +7 -0
  85. package/utility/password.d.ts +20 -0
  86. package/utility/scripts/restartHdb.js +77 -78
  87. package/studio/build-local/static/js/main.4ff4a176.js +0 -2
  88. /package/studio/build-local/static/js/{153.4789ff87.chunk.js.LICENSE.txt → 101.de926db6.chunk.js.LICENSE.txt} +0 -0
  89. /package/studio/build-local/static/js/{main.4ff4a176.js.LICENSE.txt → main.24eae3d8.js.LICENSE.txt} +0 -0
@@ -0,0 +1,483 @@
1
+ export declare const nodeIds: Map<string, number>;
2
+ export declare function getAnalyticsHostnameTable(): {
3
+ new (identifier: import("../ResourceInterface.js").Id, source: any): {
4
+ "__#5@#record": any;
5
+ "__#5@#changes": any;
6
+ "__#5@#version": number;
7
+ "__#5@#entry": {
8
+ key: any;
9
+ value: any;
10
+ version: number;
11
+ localTime: number;
12
+ expiresAt: number;
13
+ deref?: () => any;
14
+ };
15
+ "__#5@#saveMode": boolean;
16
+ "__#5@#loadedFromSource": boolean;
17
+ ensureLoaded(): any;
18
+ get(query?: import("../ResourceInterface.js").Query | string): Promise<object | void> | object | void;
19
+ allowRead(user: any, query: any): any;
20
+ allowUpdate(user: any, updatedData: any): boolean;
21
+ allowCreate(user: any, newData: {}): boolean;
22
+ allowDelete(user: any): boolean;
23
+ update(updates?: any, fullUpdate?: boolean): /*elided*/ any;
24
+ addTo(property: any, value: any): void;
25
+ subtractFrom(property: any, value: any): void;
26
+ getMetadata(): {
27
+ key: any;
28
+ value: any;
29
+ version: number;
30
+ localTime: number;
31
+ expiresAt: number;
32
+ deref?: () => any;
33
+ };
34
+ getRecord(): any;
35
+ getChanges(): any;
36
+ _setChanges(changes: any): void;
37
+ setRecord(record: any): void;
38
+ invalidate(): void;
39
+ _writeInvalidate(partialRecord?: any, options?: any): void;
40
+ _writeRelocate(options: any): void;
41
+ lock(): void;
42
+ put(record: any): void;
43
+ patch(recordUpdate: any): void;
44
+ _writeUpdate(recordUpdate: any, fullUpdate: boolean, options?: any): void;
45
+ delete(request?: import("../ResourceInterface.js").Query | string): Promise<boolean>;
46
+ _writeDelete(options?: any): boolean;
47
+ search(request: import("../ResourceInterface.js").Query): AsyncIterable<any>;
48
+ subscribe(request: import("../ResourceInterface.js").SubscriptionRequest): Promise<{
49
+ listener: (key: any) => any;
50
+ subscriptions: [];
51
+ startTime?: number;
52
+ end(): void;
53
+ toJSON(): {
54
+ name: string;
55
+ };
56
+ resolveNext: Function;
57
+ queue: any[];
58
+ hasDataListeners: boolean;
59
+ drainCloseListener: boolean;
60
+ currentDrainResolver: Function;
61
+ push(message: any): void;
62
+ send(message: any): void;
63
+ getNextMessage(): any;
64
+ waitForDrain(): Promise<boolean>;
65
+ on(eventName: any, listener: any): /*elided*/ any;
66
+ [Symbol.asyncIterator](): {
67
+ queue: import("../IterableEventQueue.js").IterableEventQueue;
68
+ push(message: any): void;
69
+ next(): Promise<unknown> | {
70
+ value: any;
71
+ };
72
+ return(value: any): {
73
+ value: any;
74
+ done: boolean;
75
+ };
76
+ throw(error: any): {
77
+ done: boolean;
78
+ };
79
+ };
80
+ [EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
81
+ addListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
82
+ once<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
83
+ removeListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
84
+ off<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
85
+ removeAllListeners(eventName?: string | symbol): /*elided*/ any;
86
+ setMaxListeners(n: number): /*elided*/ any;
87
+ getMaxListeners(): number;
88
+ listeners<K>(eventName: string | symbol): Function[];
89
+ rawListeners<K>(eventName: string | symbol): Function[];
90
+ emit<K>(eventName: string | symbol, ...args: any[]): boolean;
91
+ listenerCount<K>(eventName: string | symbol, listener?: Function): number;
92
+ prependListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
93
+ prependOnceListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
94
+ eventNames(): (string | symbol)[];
95
+ }>;
96
+ doesExist(): boolean;
97
+ publish(message: any, options?: any): void;
98
+ _writePublish(message: any, options?: any): void;
99
+ validate(record: any, patch?: any): void;
100
+ getUpdatedTime(): number;
101
+ wasLoadedFromSource(): boolean | void;
102
+ readonly "__#6@#id": import("../ResourceInterface.js").Id;
103
+ readonly "__#6@#context": import("../ResourceInterface.js").Context;
104
+ "__#6@#isCollection": boolean;
105
+ post(newRecord: any): Promise<any>;
106
+ readonly isCollection: boolean;
107
+ connect(query?: {}): AsyncIterable<any>;
108
+ getId(): import("../ResourceInterface.js").Id;
109
+ getContext(): import("../ResourceInterface.js").Context;
110
+ };
111
+ name: any;
112
+ primaryStore: any;
113
+ auditStore: any;
114
+ primaryKey: any;
115
+ tableName: any;
116
+ tableId: any;
117
+ indices: any;
118
+ audit: any;
119
+ databasePath: any;
120
+ databaseName: any;
121
+ attributes: any;
122
+ replicate: any;
123
+ sealed: any;
124
+ splitSegments: any;
125
+ createdTimeProperty: {
126
+ name: string;
127
+ type: string;
128
+ assignCreatedTime?: boolean;
129
+ assignUpdatedTime?: boolean;
130
+ expiresAt?: boolean;
131
+ isPrimaryKey?: boolean;
132
+ };
133
+ updatedTimeProperty: {
134
+ name: string;
135
+ type: string;
136
+ assignCreatedTime?: boolean;
137
+ assignUpdatedTime?: boolean;
138
+ expiresAt?: boolean;
139
+ isPrimaryKey?: boolean;
140
+ };
141
+ propertyResolvers: any;
142
+ userResolvers: {};
143
+ sources: any[];
144
+ getResidencyById: (id: import("../ResourceInterface.js").Id) => number | void;
145
+ readonly expirationMS: any;
146
+ dbisDB: any;
147
+ schemaDefined: any;
148
+ sourcedFrom(source: any, options: any): /*elided*/ any;
149
+ readonly isCaching: any;
150
+ readonly shouldRevalidateEvents: boolean;
151
+ getResource(id: import("../ResourceInterface.js").Id, request: import("../ResourceInterface.js").Context, resourceOptions?: any): Promise<{
152
+ "__#5@#record": any;
153
+ "__#5@#changes": any;
154
+ "__#5@#version": number;
155
+ "__#5@#entry": {
156
+ key: any;
157
+ value: any;
158
+ version: number;
159
+ localTime: number;
160
+ expiresAt: number;
161
+ deref?: () => any;
162
+ };
163
+ "__#5@#saveMode": boolean;
164
+ "__#5@#loadedFromSource": boolean;
165
+ ensureLoaded(): any;
166
+ get(query?: import("../ResourceInterface.js").Query | string): Promise<object | void> | object | void;
167
+ allowRead(user: any, query: any): any;
168
+ allowUpdate(user: any, updatedData: any): boolean;
169
+ allowCreate(user: any, newData: {}): boolean;
170
+ allowDelete(user: any): boolean;
171
+ update(updates?: any, fullUpdate?: boolean): /*elided*/ any;
172
+ addTo(property: any, value: any): void;
173
+ subtractFrom(property: any, value: any): void;
174
+ getMetadata(): {
175
+ key: any;
176
+ value: any;
177
+ version: number;
178
+ localTime: number;
179
+ expiresAt: number;
180
+ deref?: () => any;
181
+ };
182
+ getRecord(): any;
183
+ getChanges(): any;
184
+ _setChanges(changes: any): void;
185
+ setRecord(record: any): void;
186
+ invalidate(): void;
187
+ _writeInvalidate(partialRecord?: any, options?: any): void;
188
+ _writeRelocate(options: any): void;
189
+ lock(): void;
190
+ put(record: any): void;
191
+ patch(recordUpdate: any): void;
192
+ _writeUpdate(recordUpdate: any, fullUpdate: boolean, options?: any): void;
193
+ delete(request?: import("../ResourceInterface.js").Query | string): Promise<boolean>;
194
+ _writeDelete(options?: any): boolean;
195
+ search(request: import("../ResourceInterface.js").Query): AsyncIterable<any>;
196
+ subscribe(request: import("../ResourceInterface.js").SubscriptionRequest): Promise<{
197
+ listener: (key: any) => any;
198
+ subscriptions: [];
199
+ startTime?: number;
200
+ end(): void;
201
+ toJSON(): {
202
+ name: string;
203
+ };
204
+ resolveNext: Function;
205
+ queue: any[];
206
+ hasDataListeners: boolean;
207
+ drainCloseListener: boolean;
208
+ currentDrainResolver: Function;
209
+ push(message: any): void;
210
+ send(message: any): void;
211
+ getNextMessage(): any;
212
+ waitForDrain(): Promise<boolean>;
213
+ on(eventName: any, listener: any): /*elided*/ any;
214
+ [Symbol.asyncIterator](): {
215
+ queue: import("../IterableEventQueue.js").IterableEventQueue;
216
+ push(message: any): void;
217
+ next(): Promise<unknown> | {
218
+ value: any;
219
+ };
220
+ return(value: any): {
221
+ value: any;
222
+ done: boolean;
223
+ };
224
+ throw(error: any): {
225
+ done: boolean;
226
+ };
227
+ };
228
+ [EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
229
+ addListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
230
+ once<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
231
+ removeListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
232
+ off<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
233
+ removeAllListeners(eventName?: string | symbol): /*elided*/ any;
234
+ setMaxListeners(n: number): /*elided*/ any;
235
+ getMaxListeners(): number;
236
+ listeners<K>(eventName: string | symbol): Function[];
237
+ rawListeners<K>(eventName: string | symbol): Function[];
238
+ emit<K>(eventName: string | symbol, ...args: any[]): boolean;
239
+ listenerCount<K>(eventName: string | symbol, listener?: Function): number;
240
+ prependListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
241
+ prependOnceListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
242
+ eventNames(): (string | symbol)[];
243
+ }>;
244
+ doesExist(): boolean;
245
+ publish(message: any, options?: any): void;
246
+ _writePublish(message: any, options?: any): void;
247
+ validate(record: any, patch?: any): void;
248
+ getUpdatedTime(): number;
249
+ wasLoadedFromSource(): boolean | void;
250
+ readonly "__#6@#id": import("../ResourceInterface.js").Id;
251
+ readonly "__#6@#context": import("../ResourceInterface.js").Context;
252
+ "__#6@#isCollection": boolean;
253
+ post(newRecord: any): Promise<any>;
254
+ readonly isCollection: boolean;
255
+ connect(query?: {}): AsyncIterable<any>;
256
+ getId(): import("../ResourceInterface.js").Id;
257
+ getContext(): import("../ResourceInterface.js").Context;
258
+ }> | {
259
+ "__#5@#record": any;
260
+ "__#5@#changes": any;
261
+ "__#5@#version": number;
262
+ "__#5@#entry": {
263
+ key: any;
264
+ value: any;
265
+ version: number;
266
+ localTime: number;
267
+ expiresAt: number;
268
+ deref?: () => any;
269
+ };
270
+ "__#5@#saveMode": boolean;
271
+ "__#5@#loadedFromSource": boolean;
272
+ ensureLoaded(): any;
273
+ get(query?: import("../ResourceInterface.js").Query | string): Promise<object | void> | object | void;
274
+ allowRead(user: any, query: any): any;
275
+ allowUpdate(user: any, updatedData: any): boolean;
276
+ allowCreate(user: any, newData: {}): boolean;
277
+ allowDelete(user: any): boolean;
278
+ update(updates?: any, fullUpdate?: boolean): /*elided*/ any;
279
+ addTo(property: any, value: any): void;
280
+ subtractFrom(property: any, value: any): void;
281
+ getMetadata(): {
282
+ key: any;
283
+ value: any;
284
+ version: number;
285
+ localTime: number;
286
+ expiresAt: number;
287
+ deref?: () => any;
288
+ };
289
+ getRecord(): any;
290
+ getChanges(): any;
291
+ _setChanges(changes: any): void;
292
+ setRecord(record: any): void;
293
+ invalidate(): void;
294
+ _writeInvalidate(partialRecord?: any, options?: any): void;
295
+ _writeRelocate(options: any): void;
296
+ lock(): void;
297
+ put(record: any): void;
298
+ patch(recordUpdate: any): void;
299
+ _writeUpdate(recordUpdate: any, fullUpdate: boolean, options?: any): void;
300
+ delete(request?: import("../ResourceInterface.js").Query | string): Promise<boolean>;
301
+ _writeDelete(options?: any): boolean;
302
+ search(request: import("../ResourceInterface.js").Query): AsyncIterable<any>;
303
+ subscribe(request: import("../ResourceInterface.js").SubscriptionRequest): Promise<{
304
+ listener: (key: any) => any;
305
+ subscriptions: [];
306
+ startTime?: number;
307
+ end(): void;
308
+ toJSON(): {
309
+ name: string;
310
+ };
311
+ resolveNext: Function;
312
+ queue: any[];
313
+ hasDataListeners: boolean;
314
+ drainCloseListener: boolean;
315
+ currentDrainResolver: Function;
316
+ push(message: any): void;
317
+ send(message: any): void;
318
+ getNextMessage(): any;
319
+ waitForDrain(): Promise<boolean>;
320
+ on(eventName: any, listener: any): /*elided*/ any;
321
+ [Symbol.asyncIterator](): {
322
+ queue: import("../IterableEventQueue.js").IterableEventQueue;
323
+ push(message: any): void;
324
+ next(): Promise<unknown> | {
325
+ value: any;
326
+ };
327
+ return(value: any): {
328
+ value: any;
329
+ done: boolean;
330
+ };
331
+ throw(error: any): {
332
+ done: boolean;
333
+ };
334
+ };
335
+ [EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
336
+ addListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
337
+ once<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
338
+ removeListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
339
+ off<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
340
+ removeAllListeners(eventName?: string | symbol): /*elided*/ any;
341
+ setMaxListeners(n: number): /*elided*/ any;
342
+ getMaxListeners(): number;
343
+ listeners<K>(eventName: string | symbol): Function[];
344
+ rawListeners<K>(eventName: string | symbol): Function[];
345
+ emit<K>(eventName: string | symbol, ...args: any[]): boolean;
346
+ listenerCount<K>(eventName: string | symbol, listener?: Function): number;
347
+ prependListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
348
+ prependOnceListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
349
+ eventNames(): (string | symbol)[];
350
+ }>;
351
+ doesExist(): boolean;
352
+ publish(message: any, options?: any): void;
353
+ _writePublish(message: any, options?: any): void;
354
+ validate(record: any, patch?: any): void;
355
+ getUpdatedTime(): number;
356
+ wasLoadedFromSource(): boolean | void;
357
+ readonly "__#6@#id": import("../ResourceInterface.js").Id;
358
+ readonly "__#6@#context": import("../ResourceInterface.js").Context;
359
+ "__#6@#isCollection": boolean;
360
+ post(newRecord: any): Promise<any>;
361
+ readonly isCollection: boolean;
362
+ connect(query?: {}): AsyncIterable<any>;
363
+ getId(): import("../ResourceInterface.js").Id;
364
+ getContext(): import("../ResourceInterface.js").Context;
365
+ };
366
+ _updateResource(resource: any, entry: any): void;
367
+ getNewId(): any;
368
+ setTTLExpiration(expiration: number | {
369
+ expiration: number;
370
+ eviction?: number;
371
+ scanInterval?: number;
372
+ }): void;
373
+ getResidencyRecord(id: any): any;
374
+ setResidency(getResidency?: (record: object, context: import("../ResourceInterface.js").Context) => number | void | string[]): void;
375
+ setResidencyById(getResidencyById?: (id: import("../ResourceInterface.js").Id) => number | void): void;
376
+ getResidency(record: object, context: import("../ResourceInterface.js").Context): number | void | string[];
377
+ enableAuditing(auditEnabled?: boolean): void;
378
+ coerceId(id: string): number | string;
379
+ dropTable(): Promise<void>;
380
+ _recordRelocate(existingEntry: any, entry: any): void;
381
+ evict(id: any, existingRecord: any, existingVersion: any): Promise<void>;
382
+ operation(operation: any, context: any): any;
383
+ transformToOrderedSelect(entries: any[], select: (string | import("../ResourceInterface.js").SubSelect)[], sort: import("../ResourceInterface.js").Sort, context: import("../ResourceInterface.js").Context, readTxn: any, transformToRecord: Function): any;
384
+ transformEntryForSelect(select: any, context: any, readTxn: any, filtered: any, ensure_loaded?: any, canSkip?: any): (entry: any) => any;
385
+ subscribeOnThisThread(workerIndex: any, options: any): boolean;
386
+ addAttributes(attributesToAdd: any): Promise<any>;
387
+ removeAttributes(names: string[]): Promise<any>;
388
+ getSize(): number;
389
+ getAuditSize(): number;
390
+ getStorageStats(): {
391
+ available: number;
392
+ free: number;
393
+ size: number;
394
+ };
395
+ getRecordCount(options?: any): Promise<{
396
+ recordCount: number;
397
+ estimatedRange: number[];
398
+ } | {
399
+ recordCount: number;
400
+ estimatedRange?: undefined;
401
+ }>;
402
+ updatedAttributes(): void;
403
+ setComputedAttribute(attribute_name: any, resolver: any): void;
404
+ deleteHistory(endTime?: number, cleanupDeletedRecords?: boolean): Promise<void>;
405
+ getHistory(startTime?: number, endTime?: number): AsyncGenerator<{
406
+ id: import("ordered-binary").Key;
407
+ localTime: any;
408
+ version: any;
409
+ type: any;
410
+ value: any;
411
+ user: import("ordered-binary").Key;
412
+ operation: any;
413
+ }, void, unknown>;
414
+ getHistoryOfRecord(id: any): Promise<any[]>;
415
+ cleanup(): void;
416
+ transactions: import("../DatabaseTransaction.js").Transaction[] & {
417
+ timestamp: number;
418
+ };
419
+ directURLMapping: boolean;
420
+ get(identifier: import("../ResourceInterface.js").Id, context?: import("../ResourceInterface.js").Context): Promise<import("../Resource.js").Resource>;
421
+ get(query: import("../ResourceInterface.js").Query, context?: import("../ResourceInterface.js").Context): Promise<AsyncIterable<object>>;
422
+ put: {
423
+ (idOrQuery: string | import("../ResourceInterface.js").Id, dataOrContext?: any, context?: import("../ResourceInterface.js").Context): any;
424
+ reliesOnPrototype: boolean;
425
+ };
426
+ patch: {
427
+ (idOrQuery: string | import("../ResourceInterface.js").Id, dataOrContext?: any, context?: import("../ResourceInterface.js").Context): any;
428
+ reliesOnPrototype: boolean;
429
+ };
430
+ delete(identifier: import("../ResourceInterface.js").Id, context?: import("../ResourceInterface.js").Context): Promise<boolean>;
431
+ delete(request: import("../ResourceInterface.js").Context, context?: import("../ResourceInterface.js").Context): Promise<object>;
432
+ create(idPrefix: import("../ResourceInterface.js").Id, record: any, context: import("../ResourceInterface.js").Context): Promise<import("../ResourceInterface.js").Id>;
433
+ create(record: any, context: import("../ResourceInterface.js").Context): Promise<import("../ResourceInterface.js").Id>;
434
+ invalidate: {
435
+ (idOrQuery: string | import("../ResourceInterface.js").Id, dataOrContext?: any, context?: import("../ResourceInterface.js").Context): any;
436
+ reliesOnPrototype: boolean;
437
+ };
438
+ post: {
439
+ (idOrQuery: string | import("../ResourceInterface.js").Id, dataOrContext?: any, context?: import("../ResourceInterface.js").Context): any;
440
+ reliesOnPrototype: boolean;
441
+ };
442
+ connect: {
443
+ (idOrQuery: string | import("../ResourceInterface.js").Id, dataOrContext?: any, context?: import("../ResourceInterface.js").Context): any;
444
+ reliesOnPrototype: boolean;
445
+ };
446
+ subscribe(request: import("../ResourceInterface.js").SubscriptionRequest): Promise<AsyncIterable<{
447
+ id: any;
448
+ operation: string;
449
+ value: object;
450
+ }>>;
451
+ publish: {
452
+ (idOrQuery: string | import("../ResourceInterface.js").Id, dataOrContext?: any, context?: import("../ResourceInterface.js").Context): any;
453
+ reliesOnPrototype: boolean;
454
+ };
455
+ search: {
456
+ (idOrQuery: string | import("../ResourceInterface.js").Id, dataOrContext?: any, context?: import("../ResourceInterface.js").Context): any;
457
+ reliesOnPrototype: boolean;
458
+ };
459
+ query: {
460
+ (idOrQuery: string | import("../ResourceInterface.js").Id, dataOrContext?: any, context?: import("../ResourceInterface.js").Context): any;
461
+ reliesOnPrototype: boolean;
462
+ };
463
+ copy: {
464
+ (idOrQuery: string | import("../ResourceInterface.js").Id, dataOrContext?: any, context?: import("../ResourceInterface.js").Context): any;
465
+ reliesOnPrototype: boolean;
466
+ };
467
+ move: {
468
+ (idOrQuery: string | import("../ResourceInterface.js").Id, dataOrContext?: any, context?: import("../ResourceInterface.js").Context): any;
469
+ reliesOnPrototype: boolean;
470
+ };
471
+ isCollection(resource: any): any;
472
+ parseQuery(search: any): any;
473
+ parsePath(path: any, context: any, query: any): any;
474
+ };
475
+ export declare function normalizeIPv6(ipv6: string): string;
476
+ /** stableNodeId takes a hostname or IP address and returns a number containing
477
+ * the 32-bit SHAKE128 hash of the hostname or IP address. The astute among you
478
+ * will now be thinking, "Why return a 32-bit hash of a 32-bit IPv4 address?"
479
+ * And the answer is that this is primarily intended for identifying cluster
480
+ * nodes, and in production those should always use hostnames for TLS security.
481
+ * So it doesn't make much sense to optimize the IPv4 use case.
482
+ */
483
+ export declare function stableNodeId(nodeAddrOrName: string): number;
@@ -0,0 +1,9 @@
1
+ export declare const METRIC: {
2
+ readonly TABLE_SIZE: "table-size";
3
+ readonly DATABASE_SIZE: "database-size";
4
+ readonly STORAGE_VOLUME: "storage-volume";
5
+ readonly MAIN_THREAD_UTILIZATION: "main-thread-utilization";
6
+ readonly RESOURCE_USAGE: "resource-usage";
7
+ readonly UTILIZATION: "utilization";
8
+ };
9
+ export type BuiltInMetricName = (typeof METRIC)[keyof typeof METRIC];
@@ -0,0 +1,26 @@
1
+ import type { Metric } from './write.ts';
2
+ interface GetAnalyticsRequest {
3
+ metric: string;
4
+ start_time?: number;
5
+ end_time?: number;
6
+ get_attributes?: string[];
7
+ }
8
+ type GetAnalyticsResponse = Metric[];
9
+ export declare function getOp(req: GetAnalyticsRequest): Promise<GetAnalyticsResponse>;
10
+ export declare function get(metric: string, getAttributes?: string[], startTime?: number, endTime?: number): Promise<Metric[]>;
11
+ type MetricType = 'builtin' | 'custom';
12
+ interface ListMetricsRequest {
13
+ metric_types: MetricType[];
14
+ }
15
+ type ListMetricsResponse = string[];
16
+ export declare function listMetricsOp(req: ListMetricsRequest): Promise<ListMetricsResponse>;
17
+ export declare function listMetrics(metricTypes?: MetricType[]): Promise<string[]>;
18
+ interface DescribeMetricRequest {
19
+ metric: string;
20
+ }
21
+ interface DescribeMetricResponse {
22
+ attributes?: string[];
23
+ }
24
+ export declare function describeMetricOp(req: DescribeMetricRequest): Promise<DescribeMetricResponse>;
25
+ export declare function describeMetric(metric: string): Promise<DescribeMetricResponse>;
26
+ export {};
@@ -24,16 +24,22 @@ export declare function setAnalyticsEnabled(enabled: boolean): void;
24
24
  export declare function recordAction(value: Value, metric: string, path?: string, method?: string, type?: string): void;
25
25
  export declare function recordActionBinary(value: any, metric: any, path?: any, method?: any, type?: any): void;
26
26
  export declare function addAnalyticsListener(callback: any): void;
27
+ export declare function recordHostname(): Promise<void>;
28
+ export interface Metric {
29
+ [key: string]: any;
30
+ }
27
31
  interface ResourceUsage extends Partial<NodeJS.ResourceUsage> {
28
32
  time?: number;
29
33
  period?: number;
30
34
  cpuUtilization?: number;
35
+ userCPUTime?: number;
36
+ systemCPUTime?: number;
31
37
  }
32
- /** calculateCPUUtilization takes a ResourceUsage with at least userCPUTime & systemCPUTime set
33
- * with millisecond values (NB: Node's process.resourceUsage returns values in microseconds for
34
- * these fields so divide them by 1000 to get milliseconds) and a time period in milliseconds
35
- * and returns the percentage of that time the CPU was being utilized as a decimal value
36
- * between 0 and 1. So for example, 50% utilization will be returned as 0.5.
38
+ /** calculateCPUUtilization takes a ResourceUsage with at least userCPUTime &
39
+ * systemCPUTime set with millisecond values and a time period in milliseconds
40
+ * and returns the percentage of that time the CPU was being utilized as a
41
+ * decimal value between 0 and 1. So for example, 50% utilization will be
42
+ * returned as 0.5.
37
43
  */
38
44
  export declare function calculateCPUUtilization(resourceUsage: ResourceUsage, period: number): number;
39
45
  /** diffResourceUsage takes a ResourceUsage representing the last time we stored them and a new
@@ -54,13 +60,13 @@ function addToBucket(action, value) {
54
60
  let jump = BUCKET_COUNT >> 1; // amount to jump with each iteration
55
61
  let position = jump; // start at halfway point
56
62
  while ((jump = jump >> 1) > 0) {
57
- const bucket_value = values[position];
58
- if (bucket_value === 0) {
63
+ const bucketValue = values[position];
64
+ if (bucketValue === 0) {
59
65
  // unused slot, immediately put our value in
60
66
  counts[position] = 1;
61
67
  values[position] = value;
62
68
  }
63
- if (value > bucket_value) {
69
+ if (value > bucketValue) {
64
70
  position += jump;
65
71
  } else {
66
72
  position -= jump;
@@ -88,36 +94,36 @@ function newBuckets() {
88
94
  };
89
95
  }
90
96
 
91
- let balancing_buckets;
97
+ let balancingBuckets;
92
98
 
93
99
  /**
94
100
  * Rebalance the buckets, we can reset the counts at the same time, if this occurred after a delivery
95
101
  * @param param
96
- * @param reset_counts
102
+ * @param resetCounts
97
103
  *
98
- function rebalance({ counts, values, totalCount }, reset_counts: boolean) {
99
- const count_per_bucket = totalCount / BUCKET_COUNT;
100
- let target_position = 0;
101
- let target_count = 0;
102
- let last_target_value = 0;
103
- const { values: target_values, counts: target_counts } = balancing_buckets || (balancing_buckets = newBuckets());
104
+ function rebalance({ counts, values, totalCount }, resetCounts: boolean) {
105
+ const countPerBucket = totalCount / BUCKET_COUNT;
106
+ let targetPosition = 0;
107
+ let targetCount = 0;
108
+ let lastTargetValue = 0;
109
+ const { values: targetValues, counts: targetCounts } = balancingBuckets || (balancingBuckets = newBuckets());
104
110
  for (let i = 0; i < BUCKET_COUNT; i++) {
105
111
  // iterate through the existing buckets, filling up the target buckets in a balanced way
106
112
  let count = counts[i];
107
- while ((count_per_bucket - target_count) < count) {
113
+ while ((countPerBucket - targetCount) < count) {
108
114
  const value = values[i];
109
- last_target_value = ((count_per_bucket - target_count) / count) * (value - last_target_value) + last_target_value;
110
- target_values[target_position] = last_target_value;
111
- target_counts[target_position] = count_per_bucket;
112
- count -= count_per_bucket;
113
- target_position++;
114
- target_count = 0;
115
+ lastTargetValue = ((countPerBucket - targetCount) / count) * (value - lastTargetValue) + lastTargetValue;
116
+ targetValues[targetPosition] = lastTargetValue;
117
+ targetCounts[targetPosition] = countPerBucket;
118
+ count -= countPerBucket;
119
+ targetPosition++;
120
+ targetCount = 0;
115
121
  }
116
- target_count += count;
122
+ targetCount += count;
117
123
  }
118
124
  // now copy the balanced buckets back into the original buckets
119
- values.set(target_values);
120
- if (reset_counts) counts.fill(0);
121
- else counts.set(target_counts);
125
+ values.set(targetValues);
126
+ if (resetCounts) counts.fill(0);
127
+ else counts.set(targetCounts);
122
128
  }
123
129
  */