harperdb 4.7.3 → 4.7.5
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 +80 -80
- package/bin/lite.js +75 -75
- package/components/EntryHandler.d.ts +2 -1
- package/components/Scope.d.ts +7 -0
- package/index.d.ts +3 -1
- package/launchServiceScripts/launchNatsIngestService.js +75 -75
- package/launchServiceScripts/launchNatsReplyService.js +75 -75
- package/launchServiceScripts/launchUpdateNodes4-0-0.js +75 -75
- package/npm-shrinkwrap.json +268 -268
- package/package.json +2 -2
- package/resources/DatabaseTransaction.d.ts +8 -0
- package/resources/IterableEventQueue.d.ts +9 -22
- package/resources/RequestTarget.d.ts +3 -29
- package/resources/ResourceInterface.d.ts +67 -39
- package/resources/Table.d.ts +27 -60
- package/resources/blob.d.ts +3 -4
- package/resources/tracked.d.ts +6 -6
- package/security/user.d.ts +81 -0
- package/server/jobs/jobProcess.js +75 -75
- package/server/operationsServer.d.ts +2 -2
- package/server/replication/knownNodes.d.ts +3 -2
- package/server/threads/threadServer.js +77 -77
- package/studio/web/assets/index-CNPtE0XQ.js +601 -0
- package/studio/web/assets/index-DAAAZCZd.css +4 -0
- package/studio/web/assets/{index-6-gJ5WC3.js → index-Dn_IqWNq.js} +1 -1
- package/studio/web/assets/{index-CSgNoGnC.js → index-OhIVM2M0.js} +10 -10
- package/studio/web/assets/{index-C03Y4API.css → index-YHth6Ryl.css} +1 -1
- package/studio/web/assets/index.lazy-D173BYf8.js +287 -0
- package/studio/web/assets/{profiler-CM1hwYor.js → profiler-DjvgK9z4.js} +1 -1
- package/studio/web/assets/{react-redux-Btk0svtM.js → react-redux-DQ-bSEyM.js} +1 -1
- package/studio/web/assets/{startRecording-DnAWdg8O.js → startRecording-DGFXrb7c.js} +1 -1
- package/studio/web/index.html +2 -2
- package/studio/web/running.css +148 -0
- package/studio/web/running.html +84 -72
- package/studio/web/running.js +111 -0
- package/utility/hdbTerms.d.ts +2 -0
- package/utility/scripts/restartHdb.js +75 -75
- package/studio/web/assets/index-BP6iofXy.css +0 -4
- package/studio/web/assets/index-CrWTuyjE.js +0 -490
- package/studio/web/assets/index.lazy-Cn-3uXi8.js +0 -287
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "harperdb",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.5",
|
|
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",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"json2csv": "5.0.7",
|
|
86
86
|
"jsonata": "1.8.7",
|
|
87
87
|
"jsonwebtoken": "9.0.2",
|
|
88
|
-
"lmdb": "3.4.
|
|
88
|
+
"lmdb": "3.4.4",
|
|
89
89
|
"lodash": "4.17.21",
|
|
90
90
|
"mathjs": "11.12.0",
|
|
91
91
|
"micromatch": "^4.0.8",
|
|
@@ -6,6 +6,8 @@ export declare const TRANSACTION_STATE: {
|
|
|
6
6
|
LINGERING: number;
|
|
7
7
|
};
|
|
8
8
|
export declare function replicationConfirmation(callback: any): void;
|
|
9
|
+
declare class StartedTransaction extends Error {
|
|
10
|
+
}
|
|
9
11
|
export declare class DatabaseTransaction implements Transaction {
|
|
10
12
|
#private;
|
|
11
13
|
writes: any[];
|
|
@@ -13,10 +15,16 @@ export declare class DatabaseTransaction implements Transaction {
|
|
|
13
15
|
readTxn: LMDBTransaction;
|
|
14
16
|
readTxnRefCount: number;
|
|
15
17
|
readTxnsUsed: number;
|
|
18
|
+
timeout: number;
|
|
16
19
|
validated: number;
|
|
17
20
|
timestamp: number;
|
|
18
21
|
next: DatabaseTransaction;
|
|
19
22
|
stale: boolean;
|
|
23
|
+
startedFrom?: {
|
|
24
|
+
resourceName: string;
|
|
25
|
+
method: string;
|
|
26
|
+
};
|
|
27
|
+
stackTraces?: StartedTransaction[];
|
|
20
28
|
overloadChecked: boolean;
|
|
21
29
|
open: number;
|
|
22
30
|
getReadTxn(): LMDBTransaction | void;
|
|
@@ -1,32 +1,19 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
export declare class IterableEventQueue extends EventEmitter {
|
|
3
|
-
resolveNext:
|
|
2
|
+
export declare class IterableEventQueue<Event extends object = any> extends EventEmitter {
|
|
3
|
+
resolveNext: null | ((args: {
|
|
4
|
+
value: Event;
|
|
5
|
+
}) => void);
|
|
4
6
|
queue: any[];
|
|
5
7
|
hasDataListeners: boolean;
|
|
6
8
|
drainCloseListener: boolean;
|
|
7
|
-
currentDrainResolver:
|
|
8
|
-
[Symbol.asyncIterator]():
|
|
9
|
-
push(message:
|
|
10
|
-
send(message:
|
|
9
|
+
currentDrainResolver: null | ((draining: boolean) => void);
|
|
10
|
+
[Symbol.asyncIterator](): AsyncIterator<Event>;
|
|
11
|
+
push(message: Event): void;
|
|
12
|
+
send(message: Event): void;
|
|
11
13
|
getNextMessage(): any;
|
|
12
14
|
/**
|
|
13
15
|
* Wait for the queue to be drained, resolving to true to continue or false if the queue was closed before draining.
|
|
14
16
|
*/
|
|
15
17
|
waitForDrain(): Promise<boolean>;
|
|
16
|
-
on(eventName:
|
|
18
|
+
on(eventName: 'data' | string, listener: ((data: Event) => void) | any): this;
|
|
17
19
|
}
|
|
18
|
-
declare class EventQueueIterator {
|
|
19
|
-
queue: IterableEventQueue;
|
|
20
|
-
push(message: any): void;
|
|
21
|
-
next(): Promise<unknown> | {
|
|
22
|
-
value: any;
|
|
23
|
-
};
|
|
24
|
-
return(value: any): {
|
|
25
|
-
value: any;
|
|
26
|
-
done: boolean;
|
|
27
|
-
};
|
|
28
|
-
throw(error: any): {
|
|
29
|
-
done: boolean;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UserRoleDatabasePermissions } from '../security/user.types.js';
|
|
1
2
|
import type { Conditions, Id, Select, Sort } from './ResourceInterface.ts';
|
|
2
3
|
export declare class RequestTarget extends URLSearchParams {
|
|
3
4
|
#private;
|
|
@@ -16,7 +17,7 @@ export declare class RequestTarget extends URLSearchParams {
|
|
|
16
17
|
/** The number of operator to use*/
|
|
17
18
|
operator?: 'AND' | 'OR';
|
|
18
19
|
/** The sort attribute and direction to use */
|
|
19
|
-
/** @ts-
|
|
20
|
+
/** @ts-expect-error USP has a sort method, we hide it */
|
|
20
21
|
sort?: Sort;
|
|
21
22
|
/** The selected attributes to return */
|
|
22
23
|
select?: Select;
|
|
@@ -36,7 +37,7 @@ export declare class RequestTarget extends URLSearchParams {
|
|
|
36
37
|
replicatedConfirmation?: number;
|
|
37
38
|
originatingOperation?: string;
|
|
38
39
|
previousResidency?: string[];
|
|
39
|
-
checkPermission?:
|
|
40
|
+
checkPermission?: UserRoleDatabasePermissions | boolean;
|
|
40
41
|
allowFullScan?: boolean;
|
|
41
42
|
allowConditionsOnDynamicAttributes?: boolean;
|
|
42
43
|
constructor(target?: string);
|
|
@@ -47,30 +48,3 @@ export declare class RequestTarget extends URLSearchParams {
|
|
|
47
48
|
append(name: string, value: string): void;
|
|
48
49
|
}
|
|
49
50
|
export type RequestTargetOrId = RequestTarget | Id;
|
|
50
|
-
interface Permission {
|
|
51
|
-
read: boolean;
|
|
52
|
-
update: boolean;
|
|
53
|
-
delete: boolean;
|
|
54
|
-
insert: boolean;
|
|
55
|
-
[database: string]: boolean | {
|
|
56
|
-
read: boolean;
|
|
57
|
-
update: boolean;
|
|
58
|
-
delete: boolean;
|
|
59
|
-
insert: boolean;
|
|
60
|
-
tables: {
|
|
61
|
-
[table: string]: {
|
|
62
|
-
read: boolean;
|
|
63
|
-
update: boolean;
|
|
64
|
-
delete: boolean;
|
|
65
|
-
insert: boolean;
|
|
66
|
-
attribute_permissions: {
|
|
67
|
-
attribute_name: string;
|
|
68
|
-
read: boolean;
|
|
69
|
-
update: boolean;
|
|
70
|
-
delete: boolean;
|
|
71
|
-
}[];
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
export {};
|
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { User } from '../security/user.ts';
|
|
2
2
|
import type { OperationFunctionName } from '../server/serverHelpers/serverUtilities.ts';
|
|
3
|
+
import { DatabaseTransaction } from './DatabaseTransaction.ts';
|
|
4
|
+
import { IterableEventQueue } from './IterableEventQueue.js';
|
|
5
|
+
import type { Entry, RecordObject } from './RecordEncoder.ts';
|
|
3
6
|
import { RequestTarget } from './RequestTarget.ts';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
get?(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
export interface ResourceInterface<Record extends object = any> extends RecordObject, Pick<UpdatableRecord<Record>, 'addTo' | 'subtractFrom'> {
|
|
8
|
+
new (identifier: Id, source: any): any;
|
|
9
|
+
allowRead(user: User, target: RequestTarget): boolean | Promise<boolean>;
|
|
10
|
+
get?(id: Id): Promise<Record & RecordObject>;
|
|
11
|
+
get?(query: RequestTargetOrId): Promise<AsyncIterable<Record & RecordObject>>;
|
|
12
|
+
search?(query: RequestTarget): AsyncIterable<Record & RecordObject>;
|
|
13
|
+
allowCreate(user: User, record: Record & RecordObject, target: RequestTarget): boolean | Promise<boolean>;
|
|
14
|
+
create?(target: RequestTargetOrId, record: Partial<Record & RecordObject>): void;
|
|
15
|
+
post?(target: RequestTargetOrId, record: Partial<Record & RecordObject>): void;
|
|
16
|
+
allowUpdate(user: User, record: Record & RecordObject, target: RequestTarget): boolean | Promise<boolean>;
|
|
17
|
+
put?(target: RequestTargetOrId, record: Record & RecordObject): void;
|
|
18
|
+
patch?(target: RequestTargetOrId, record: Partial<Record & RecordObject>): void;
|
|
19
|
+
update?(updates: Record & RecordObject, fullUpdate: true): ResourceInterface<Record & RecordObject>;
|
|
20
|
+
update?(updates: Partial<Record & RecordObject>, fullUpdate?: boolean): ResourceInterface<Record & RecordObject> | Promise<ResourceInterface<Record & RecordObject> | UpdatableRecord<Record & RecordObject>>;
|
|
21
|
+
allowDelete(user: User, target: RequestTarget): boolean | Promise<boolean>;
|
|
14
22
|
delete?(target: RequestTargetOrId): boolean;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
allowDelete(user: any, target: RequestTarget): boolean | Promise<boolean>;
|
|
21
|
-
}
|
|
22
|
-
export interface User {
|
|
23
|
-
username: string;
|
|
23
|
+
invalidate(target: RequestTargetOrId): void | Promise<void>;
|
|
24
|
+
publish?(target: RequestTargetOrId, record: Record): void;
|
|
25
|
+
subscribe?(request: SubscriptionRequest): Promise<Subscription<Record & RecordObject>>;
|
|
26
|
+
doesExist(): boolean;
|
|
27
|
+
wasLoadedFromSource(): boolean | void;
|
|
24
28
|
}
|
|
25
29
|
export interface Context {
|
|
26
30
|
/** The user making the request */
|
|
@@ -54,11 +58,11 @@ export interface Context {
|
|
|
54
58
|
resourceCache?: Map<Id, any>;
|
|
55
59
|
_freezeRecords?: boolean;
|
|
56
60
|
}
|
|
57
|
-
export interface SourceContext<TRequestContext = Context> {
|
|
61
|
+
export interface SourceContext<TRequestContext = Context, Record extends object = any> {
|
|
58
62
|
/** The original request context passed from the caching layer */
|
|
59
63
|
requestContext: TRequestContext;
|
|
60
64
|
/** The existing record, from the existing entry (if any) */
|
|
61
|
-
replacingRecord?:
|
|
65
|
+
replacingRecord?: Record;
|
|
62
66
|
/** The existing database entry (if any) */
|
|
63
67
|
replacingEntry?: Entry;
|
|
64
68
|
/** The version/timestamp of the existing record */
|
|
@@ -66,7 +70,7 @@ export interface SourceContext<TRequestContext = Context> {
|
|
|
66
70
|
/** Indicates that values from the source data should NOT be stored as a cached value */
|
|
67
71
|
noCacheStore?: boolean;
|
|
68
72
|
/** Reference to the source Resource instance */
|
|
69
|
-
source?: ResourceInterface
|
|
73
|
+
source?: ResourceInterface<Record>;
|
|
70
74
|
/** Shared resource cache from parent context for visibility of modifications */
|
|
71
75
|
resourceCache?: Map<Id, any>;
|
|
72
76
|
/** Database transaction for the context */
|
|
@@ -77,25 +81,26 @@ export interface SourceContext<TRequestContext = Context> {
|
|
|
77
81
|
lastModified?: number;
|
|
78
82
|
}
|
|
79
83
|
export type Operator = 'and' | 'or';
|
|
80
|
-
type Comparator = '
|
|
81
|
-
export
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
export type Comparator = 'between' | 'contains' | 'ends_with' | 'eq' | 'equals' | 'greater_than' | 'greater_than_equal' | 'less_than' | 'less_than_equal' | 'ne' | 'not_equal' | 'starts_with';
|
|
85
|
+
export type DirectCondition<Record extends object = any> = TypedDirectCondition<Record, keyof Record>;
|
|
86
|
+
interface TypedDirectCondition<Record extends object, Property extends keyof Record> {
|
|
87
|
+
attribute?: keyof Record | Array<keyof Record> | string | string[];
|
|
88
|
+
search_attribute?: keyof Record | Array<keyof Record> | string | string[];
|
|
84
89
|
comparator?: Comparator;
|
|
85
90
|
search_type?: Comparator;
|
|
86
|
-
value?:
|
|
87
|
-
search_value?:
|
|
91
|
+
value?: Record[Property];
|
|
92
|
+
search_value?: Record[Property];
|
|
88
93
|
}
|
|
89
|
-
interface ConditionGroup {
|
|
90
|
-
conditions?: Conditions
|
|
94
|
+
interface ConditionGroup<Record extends object = any> {
|
|
95
|
+
conditions?: Conditions<Record>;
|
|
91
96
|
operator?: Operator;
|
|
92
97
|
}
|
|
93
|
-
export type Condition = DirectCondition & ConditionGroup
|
|
94
|
-
export type Conditions = Condition[];
|
|
95
|
-
export interface Sort {
|
|
96
|
-
attribute:
|
|
98
|
+
export type Condition<Record extends object = any> = DirectCondition<Record> & ConditionGroup<Record>;
|
|
99
|
+
export type Conditions<Record extends object = any> = Condition<Record>[];
|
|
100
|
+
export interface Sort<Record extends object = any> {
|
|
101
|
+
attribute: keyof Record;
|
|
97
102
|
descending?: boolean;
|
|
98
|
-
next?: Sort
|
|
103
|
+
next?: Sort<Record>;
|
|
99
104
|
}
|
|
100
105
|
export interface SubSelect {
|
|
101
106
|
name: string;
|
|
@@ -113,12 +118,35 @@ export interface SubscriptionRequest {
|
|
|
113
118
|
includeDescendants?: boolean;
|
|
114
119
|
supportsTransactions?: boolean;
|
|
115
120
|
rawEvents?: boolean;
|
|
116
|
-
listener:
|
|
121
|
+
listener: Listener;
|
|
117
122
|
}
|
|
118
123
|
export type Query = RequestTarget;
|
|
119
124
|
export type RequestTargetOrId = RequestTarget | Id;
|
|
120
125
|
export type Id = number | string | (number | string | null)[] | null;
|
|
121
|
-
export type UpdatableRecord<
|
|
122
|
-
interface
|
|
126
|
+
export type UpdatableRecord<Record extends object = any> = TypedUpdatableRecord<Record, keyof Record>;
|
|
127
|
+
interface TypedUpdatableRecord<Record extends object, Property extends keyof Record> extends RecordObject {
|
|
128
|
+
set(property: Property, value: Record[Property]): void;
|
|
129
|
+
getProperty(property: Property): Record[Property];
|
|
130
|
+
addTo(property: Property, value: Record[Property]): void;
|
|
131
|
+
subtractFrom(property: Property, value: Record[Property]): void;
|
|
132
|
+
}
|
|
133
|
+
interface Subscription<Event extends object = any> extends IterableEventQueue<Event> {
|
|
134
|
+
new (listener: Listener<Event>): any;
|
|
135
|
+
listener: Listener<Event>;
|
|
136
|
+
subscriptions: Listener<Event>[];
|
|
137
|
+
startTime?: number;
|
|
138
|
+
end(): void;
|
|
139
|
+
toJSON(): {
|
|
140
|
+
name: 'subscription';
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
type Listener<Payload extends object = any> = (payload: ListenerPayload<Payload>) => void;
|
|
144
|
+
interface ListenerPayload<Payload extends object = any> {
|
|
145
|
+
id: Id;
|
|
146
|
+
localTime: number;
|
|
147
|
+
value: Payload;
|
|
148
|
+
version: number;
|
|
149
|
+
type: string;
|
|
150
|
+
beginTxn: boolean;
|
|
123
151
|
}
|
|
124
152
|
export {};
|
package/resources/Table.d.ts
CHANGED
|
@@ -99,11 +99,11 @@ export declare function makeTable(options: any): {
|
|
|
99
99
|
addTo(property: string, value: number | bigint): void;
|
|
100
100
|
subtractFrom(property: string, value: number | bigint): void;
|
|
101
101
|
"__#private@#record": any;
|
|
102
|
-
"__#private@#changes": any
|
|
102
|
+
"__#private@#changes": Partial<any>;
|
|
103
103
|
getRecord(): any;
|
|
104
104
|
setRecord(record: any): void;
|
|
105
|
-
getChanges(): any
|
|
106
|
-
_setChanges(changes: any): void;
|
|
105
|
+
getChanges(): Partial<any>;
|
|
106
|
+
_setChanges(changes: Partial<any>): void;
|
|
107
107
|
};
|
|
108
108
|
addTo(property: any, value: any): void;
|
|
109
109
|
subtractFrom(property: any, value: any): void;
|
|
@@ -143,30 +143,19 @@ export declare function makeTable(options: any): {
|
|
|
143
143
|
toJSON(): {
|
|
144
144
|
name: string;
|
|
145
145
|
};
|
|
146
|
-
resolveNext:
|
|
146
|
+
resolveNext: (args: {
|
|
147
|
+
value: any;
|
|
148
|
+
}) => void;
|
|
147
149
|
queue: any[];
|
|
148
150
|
hasDataListeners: boolean;
|
|
149
151
|
drainCloseListener: boolean;
|
|
150
|
-
currentDrainResolver:
|
|
152
|
+
currentDrainResolver: null | ((draining: boolean) => void);
|
|
151
153
|
push(message: any): void;
|
|
152
154
|
send(message: any): void;
|
|
153
155
|
getNextMessage(): any;
|
|
154
156
|
waitForDrain(): Promise<boolean>;
|
|
155
|
-
on(eventName:
|
|
156
|
-
[Symbol.asyncIterator]():
|
|
157
|
-
queue: import("./IterableEventQueue.js").IterableEventQueue;
|
|
158
|
-
push(message: any): void;
|
|
159
|
-
next(): Promise<unknown> | {
|
|
160
|
-
value: any;
|
|
161
|
-
};
|
|
162
|
-
return(value: any): {
|
|
163
|
-
value: any;
|
|
164
|
-
done: boolean;
|
|
165
|
-
};
|
|
166
|
-
throw(error: any): {
|
|
167
|
-
done: boolean;
|
|
168
|
-
};
|
|
169
|
-
};
|
|
157
|
+
on(eventName: "data" | string, listener: ((data: any) => void) | any): /*elided*/ any;
|
|
158
|
+
[Symbol.asyncIterator](): AsyncIterator<any, any, any>;
|
|
170
159
|
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
|
|
171
160
|
addListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
|
|
172
161
|
once<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
|
|
@@ -308,11 +297,11 @@ export declare function makeTable(options: any): {
|
|
|
308
297
|
addTo(property: string, value: number | bigint): void;
|
|
309
298
|
subtractFrom(property: string, value: number | bigint): void;
|
|
310
299
|
"__#private@#record": any;
|
|
311
|
-
"__#private@#changes": any
|
|
300
|
+
"__#private@#changes": Partial<any>;
|
|
312
301
|
getRecord(): any;
|
|
313
302
|
setRecord(record: any): void;
|
|
314
|
-
getChanges(): any
|
|
315
|
-
_setChanges(changes: any): void;
|
|
303
|
+
getChanges(): Partial<any>;
|
|
304
|
+
_setChanges(changes: Partial<any>): void;
|
|
316
305
|
};
|
|
317
306
|
addTo(property: any, value: any): void;
|
|
318
307
|
subtractFrom(property: any, value: any): void;
|
|
@@ -352,30 +341,19 @@ export declare function makeTable(options: any): {
|
|
|
352
341
|
toJSON(): {
|
|
353
342
|
name: string;
|
|
354
343
|
};
|
|
355
|
-
resolveNext:
|
|
344
|
+
resolveNext: (args: {
|
|
345
|
+
value: any;
|
|
346
|
+
}) => void;
|
|
356
347
|
queue: any[];
|
|
357
348
|
hasDataListeners: boolean;
|
|
358
349
|
drainCloseListener: boolean;
|
|
359
|
-
currentDrainResolver:
|
|
350
|
+
currentDrainResolver: null | ((draining: boolean) => void);
|
|
360
351
|
push(message: any): void;
|
|
361
352
|
send(message: any): void;
|
|
362
353
|
getNextMessage(): any;
|
|
363
354
|
waitForDrain(): Promise<boolean>;
|
|
364
|
-
on(eventName:
|
|
365
|
-
[Symbol.asyncIterator]():
|
|
366
|
-
queue: import("./IterableEventQueue.js").IterableEventQueue;
|
|
367
|
-
push(message: any): void;
|
|
368
|
-
next(): Promise<unknown> | {
|
|
369
|
-
value: any;
|
|
370
|
-
};
|
|
371
|
-
return(value: any): {
|
|
372
|
-
value: any;
|
|
373
|
-
done: boolean;
|
|
374
|
-
};
|
|
375
|
-
throw(error: any): {
|
|
376
|
-
done: boolean;
|
|
377
|
-
};
|
|
378
|
-
};
|
|
355
|
+
on(eventName: "data" | string, listener: ((data: any) => void) | any): /*elided*/ any;
|
|
356
|
+
[Symbol.asyncIterator](): AsyncIterator<any, any, any>;
|
|
379
357
|
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
|
|
380
358
|
addListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
|
|
381
359
|
once<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
|
|
@@ -470,11 +448,11 @@ export declare function makeTable(options: any): {
|
|
|
470
448
|
addTo(property: string, value: number | bigint): void;
|
|
471
449
|
subtractFrom(property: string, value: number | bigint): void;
|
|
472
450
|
"__#private@#record": any;
|
|
473
|
-
"__#private@#changes": any
|
|
451
|
+
"__#private@#changes": Partial<any>;
|
|
474
452
|
getRecord(): any;
|
|
475
453
|
setRecord(record: any): void;
|
|
476
|
-
getChanges(): any
|
|
477
|
-
_setChanges(changes: any): void;
|
|
454
|
+
getChanges(): Partial<any>;
|
|
455
|
+
_setChanges(changes: Partial<any>): void;
|
|
478
456
|
};
|
|
479
457
|
addTo(property: any, value: any): void;
|
|
480
458
|
subtractFrom(property: any, value: any): void;
|
|
@@ -514,30 +492,19 @@ export declare function makeTable(options: any): {
|
|
|
514
492
|
toJSON(): {
|
|
515
493
|
name: string;
|
|
516
494
|
};
|
|
517
|
-
resolveNext:
|
|
495
|
+
resolveNext: (args: {
|
|
496
|
+
value: any;
|
|
497
|
+
}) => void;
|
|
518
498
|
queue: any[];
|
|
519
499
|
hasDataListeners: boolean;
|
|
520
500
|
drainCloseListener: boolean;
|
|
521
|
-
currentDrainResolver:
|
|
501
|
+
currentDrainResolver: null | ((draining: boolean) => void);
|
|
522
502
|
push(message: any): void;
|
|
523
503
|
send(message: any): void;
|
|
524
504
|
getNextMessage(): any;
|
|
525
505
|
waitForDrain(): Promise<boolean>;
|
|
526
|
-
on(eventName:
|
|
527
|
-
[Symbol.asyncIterator]():
|
|
528
|
-
queue: import("./IterableEventQueue.js").IterableEventQueue;
|
|
529
|
-
push(message: any): void;
|
|
530
|
-
next(): Promise<unknown> | {
|
|
531
|
-
value: any;
|
|
532
|
-
};
|
|
533
|
-
return(value: any): {
|
|
534
|
-
value: any;
|
|
535
|
-
done: boolean;
|
|
536
|
-
};
|
|
537
|
-
throw(error: any): {
|
|
538
|
-
done: boolean;
|
|
539
|
-
};
|
|
540
|
-
};
|
|
506
|
+
on(eventName: "data" | string, listener: ((data: any) => void) | any): /*elided*/ any;
|
|
507
|
+
[Symbol.asyncIterator](): AsyncIterator<any, any, any>;
|
|
541
508
|
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
|
|
542
509
|
addListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
|
|
543
510
|
once<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
|
package/resources/blob.d.ts
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
* - Note that for compressed data, the size is the uncompressed size, and the compressed size in the file
|
|
12
12
|
*/
|
|
13
13
|
import type { LMDBStore } from 'lmdb';
|
|
14
|
-
import * as buffer from 'node:buffer';
|
|
15
14
|
type StorageInfo = {
|
|
16
15
|
storageIndex: number;
|
|
17
16
|
fileId: string;
|
|
@@ -40,7 +39,7 @@ export declare const Blob: {
|
|
|
40
39
|
arrayBuffer(): Promise<ArrayBufferLike>;
|
|
41
40
|
get size(): number;
|
|
42
41
|
slice(): /*elided*/ any;
|
|
43
|
-
bytes(): Promise<
|
|
42
|
+
bytes(): Promise<Buffer>;
|
|
44
43
|
get type(): string;
|
|
45
44
|
};
|
|
46
45
|
};
|
|
@@ -54,7 +53,7 @@ declare namespace InstanceOfBlobWithNoConstructor {
|
|
|
54
53
|
arrayBuffer(): Promise<ArrayBufferLike>;
|
|
55
54
|
get size(): number;
|
|
56
55
|
slice(): /*elided*/ any;
|
|
57
|
-
bytes(): Promise<
|
|
56
|
+
bytes(): Promise<Buffer>;
|
|
58
57
|
get type(): string;
|
|
59
58
|
};
|
|
60
59
|
}
|
|
@@ -156,5 +155,5 @@ export declare function startPreCommitBlobsForRecord(record: any, store: LMDBSto
|
|
|
156
155
|
* from the database, and if not, deletes them
|
|
157
156
|
* @param database
|
|
158
157
|
*/
|
|
159
|
-
export declare function cleanupOrphans(database: any): Promise<number>;
|
|
158
|
+
export declare function cleanupOrphans(database: any, databaseName?: string): Promise<number>;
|
|
160
159
|
export {};
|
package/resources/tracked.d.ts
CHANGED
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
* @param typeDef Type definition for determining property
|
|
11
11
|
*/
|
|
12
12
|
export declare function assignTrackedAccessors(Target: any, typeDef: any, useFullPropertyProxy?: boolean): void;
|
|
13
|
-
export declare class GenericTrackedObject {
|
|
13
|
+
export declare class GenericTrackedObject<T extends object = any> {
|
|
14
14
|
#private;
|
|
15
|
-
constructor(sourceObject
|
|
16
|
-
getRecord():
|
|
17
|
-
setRecord(record:
|
|
18
|
-
getChanges():
|
|
19
|
-
_setChanges(changes:
|
|
15
|
+
constructor(sourceObject?: GenericTrackedObject<T> | T);
|
|
16
|
+
getRecord(): T;
|
|
17
|
+
setRecord(record: T): void;
|
|
18
|
+
getChanges(): Partial<T>;
|
|
19
|
+
_setChanges(changes: Partial<T>): void;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Collapse the changed and transitive and source/record data into single object that
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
declare const USERNAME_REQUIRED = "username is required";
|
|
2
|
+
declare const ALTERUSER_NOTHING_TO_UPDATE = "nothing to update, must supply active, role or password to update";
|
|
3
|
+
declare const EMPTY_PASSWORD = "password cannot be an empty string";
|
|
4
|
+
declare const EMPTY_ROLE = "If role is specified, it cannot be empty.";
|
|
5
|
+
declare const ACTIVE_BOOLEAN = "active must be true or false";
|
|
6
|
+
export { addUser, alterUser, dropUser, getSuperUser, userInfo, listUsers, listUsersExternal, setUsersWithRolesCache, findAndValidateUser, getClusterUser, getUsersWithRolesCache, USERNAME_REQUIRED, ALTERUSER_NOTHING_TO_UPDATE, EMPTY_PASSWORD, EMPTY_ROLE, ACTIVE_BOOLEAN, };
|
|
7
|
+
export interface User {
|
|
8
|
+
active?: boolean;
|
|
9
|
+
username: string;
|
|
10
|
+
role?: UserRole;
|
|
11
|
+
__updatedtime__?: number;
|
|
12
|
+
__createdtime__?: number;
|
|
13
|
+
[other: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
export interface UserRole {
|
|
16
|
+
permission: UserRoleNamedPermissions & UserRoleDatabasePermissions;
|
|
17
|
+
role: string;
|
|
18
|
+
id: string;
|
|
19
|
+
__updatedtime__: number;
|
|
20
|
+
__createdtime__: number;
|
|
21
|
+
}
|
|
22
|
+
export interface UserRoleNamedPermissions extends Partial<CRUDPermissions> {
|
|
23
|
+
super_user?: boolean;
|
|
24
|
+
cluster_user?: boolean;
|
|
25
|
+
structure_user?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface UserRoleDatabasePermissions {
|
|
28
|
+
[databaseName: string]: UserRoleSchemaRecord;
|
|
29
|
+
}
|
|
30
|
+
export interface UserRoleSchemaRecord extends Partial<CRUDPermissions> {
|
|
31
|
+
tables: Record<string, UserRolePermissionTable | UserLegacyRolePermissionTable>;
|
|
32
|
+
}
|
|
33
|
+
export interface UserRolePermissionTable extends CRUDPermissions {
|
|
34
|
+
attribute_permissions: UserRoleAttributePermissionTable[];
|
|
35
|
+
}
|
|
36
|
+
export interface UserRoleAttributePermissionTable extends Omit<CRUDPermissions, 'delete'> {
|
|
37
|
+
attribute_name: string;
|
|
38
|
+
}
|
|
39
|
+
export interface UserLegacyRolePermissionTable extends CRUDPermissions {
|
|
40
|
+
attribute_restrictions: UserLegacyRoleAttributePermissionTable[];
|
|
41
|
+
}
|
|
42
|
+
export interface UserLegacyRoleAttributePermissionTable extends CRUDPermissions {
|
|
43
|
+
attribute_name: string;
|
|
44
|
+
}
|
|
45
|
+
export interface CRUDPermissions {
|
|
46
|
+
read: boolean;
|
|
47
|
+
insert: boolean;
|
|
48
|
+
update: boolean;
|
|
49
|
+
delete: boolean;
|
|
50
|
+
}
|
|
51
|
+
declare function addUser(user: User | any): Promise<string>;
|
|
52
|
+
declare function alterUser(jsonMessage: any): Promise<any>;
|
|
53
|
+
declare function dropUser(user: User | any): Promise<string>;
|
|
54
|
+
declare function userInfo(body: any): Promise<string | User>;
|
|
55
|
+
/**
|
|
56
|
+
* This function should be called by chooseOperation as it scrubs sensitive information before returning
|
|
57
|
+
* the results of list users.
|
|
58
|
+
*/
|
|
59
|
+
declare function listUsersExternal(): Promise<User[]>;
|
|
60
|
+
/**
|
|
61
|
+
* Queries system table for user records, adds role-based perms, scrubs list based on licensed role allowance and returns
|
|
62
|
+
* data in a Map with the username as the key for the entry
|
|
63
|
+
*/
|
|
64
|
+
declare function listUsers(): Promise<Map<string, User>>;
|
|
65
|
+
declare function setUsersWithRolesCache(cache?: any): Promise<void>;
|
|
66
|
+
declare function getUsersWithRolesCache(): Promise<any>;
|
|
67
|
+
/**
|
|
68
|
+
* iterates global.hdb_users to find and validate the username & optionally the password as well as if they are active.
|
|
69
|
+
* @param {string} username
|
|
70
|
+
* @param {string} pw
|
|
71
|
+
* @param {boolean} validatePassword
|
|
72
|
+
*/
|
|
73
|
+
declare function findAndValidateUser(username: string, pw?: string | null, validatePassword?: boolean): Promise<User>;
|
|
74
|
+
declare function getSuperUser(): Promise<User | undefined>;
|
|
75
|
+
/**
|
|
76
|
+
* Gets the cluster user provided in harperdb-config.yaml from the map of all user.
|
|
77
|
+
* Nats requires plain test passwords, this is why we pass decrypt_hash.
|
|
78
|
+
* The Nats routes require the decrypt_hash to be uri encoded.
|
|
79
|
+
* @returns {Promise<Object>}
|
|
80
|
+
*/
|
|
81
|
+
declare function getClusterUser(): Promise<User | undefined>;
|