harperdb 4.6.0-alpha.2 → 4.6.0-alpha.3
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/application-template/README.md +26 -8
- package/application-template/config.yaml +18 -15
- package/application-template/web/index.html +29 -0
- package/application-template/web/index.js +18 -0
- package/application-template/web/styles.css +57 -0
- package/bin/harperdb.js +78 -78
- package/bin/lite.js +74 -74
- package/launchServiceScripts/launchInstallNATSServer.js +1 -1
- package/launchServiceScripts/launchNatsIngestService.js +74 -74
- package/launchServiceScripts/launchNatsReplyService.js +76 -76
- package/launchServiceScripts/launchUpdateNodes4-0-0.js +74 -74
- package/npm-shrinkwrap.json +228 -235
- package/package.json +2 -7
- package/resources/RecordEncoder.d.ts +15 -0
- package/resources/RequestTarget.d.ts +30 -0
- package/resources/Resource.d.ts +21 -13
- package/resources/ResourceInterface.d.ts +22 -29
- package/resources/Table.d.ts +96 -83
- package/resources/analytics/hostnames.d.ts +93 -130
- package/resources/analytics/read.d.ts +3 -1
- package/resources/databases.d.ts +93 -130
- package/resources/indexes/HierarchicalNavigableSmallWorld.d.ts +7 -4
- package/resources/search.d.ts +3 -9
- package/resources/tracked.d.ts +1 -1
- package/resources/transactionBroadcast.d.ts +5 -1
- package/server/Server.d.ts +1 -1
- package/server/jobs/jobProcess.js +74 -74
- package/server/status.d.ts +437 -1
- package/server/threads/threadServer.js +75 -75
- package/studio/build-local/asset-manifest.json +5 -5
- package/studio/build-local/index.html +1 -1
- package/studio/build-local/static/js/browse-datatable.3d9e9ccf.chunk.js +1 -0
- package/studio/build-local/static/js/instance.9de0a105.chunk.js +1 -0
- package/studio/build-local/static/js/{instances.f28e5ce7.chunk.js → instances.299d83e9.chunk.js} +1 -1
- package/studio/build-local/static/js/{main.5dea46bb.js → main.5a7cabb6.js} +2 -2
- package/utility/scripts/restartHdb.js +74 -74
- package/validation/statusValidator.d.ts +22 -0
- package/studio/build-local/static/js/browse-datatable.21e650e1.chunk.js +0 -1
- package/studio/build-local/static/js/instance.9689d62b.chunk.js +0 -1
- /package/studio/build-local/static/js/{main.5dea46bb.js.LICENSE.txt → main.5a7cabb6.js.LICENSE.txt} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "harperdb",
|
|
3
|
-
"version": "4.6.0-alpha.
|
|
3
|
+
"version": "4.6.0-alpha.3",
|
|
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",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"minimist": "1.2.8",
|
|
88
88
|
"moment": "2.30.1",
|
|
89
89
|
"mqtt-packet": "~9.0.1",
|
|
90
|
-
"msgpackr": "1.11.
|
|
90
|
+
"msgpackr": "1.11.4",
|
|
91
91
|
"nats": "2.19.0",
|
|
92
92
|
"needle": "3.3.1",
|
|
93
93
|
"node-forge": "^1.3.1",
|
|
@@ -119,11 +119,6 @@
|
|
|
119
119
|
"ws": "8.18.1",
|
|
120
120
|
"yaml": "2.7.0"
|
|
121
121
|
},
|
|
122
|
-
"overrides": {
|
|
123
|
-
"alasql": {
|
|
124
|
-
"xlsx": "0.18.5"
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
122
|
"optionalDependencies": {
|
|
128
123
|
"bufferutil": "^4.0.9",
|
|
129
124
|
"hdd-space": "^1.2.0",
|
|
@@ -6,12 +6,22 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { Encoder } from 'msgpackr';
|
|
8
8
|
import './blob.ts';
|
|
9
|
+
export type Entry = {
|
|
10
|
+
key: any;
|
|
11
|
+
value: any;
|
|
12
|
+
version: number;
|
|
13
|
+
localTime: number;
|
|
14
|
+
expiresAt: number;
|
|
15
|
+
metadataFlags: number;
|
|
16
|
+
deref?: () => any;
|
|
17
|
+
};
|
|
9
18
|
export declare const TIMESTAMP_PLACEHOLDER: Uint8Array<ArrayBuffer>;
|
|
10
19
|
export declare const LAST_TIMESTAMP_PLACEHOLDER: Uint8Array<ArrayBuffer>;
|
|
11
20
|
export declare const PREVIOUS_TIMESTAMP_PLACEHOLDER: Uint8Array<ArrayBuffer>;
|
|
12
21
|
export declare const NEW_TIMESTAMP_PLACEHOLDER: Uint8Array<ArrayBuffer>;
|
|
13
22
|
export declare const LOCAL_TIMESTAMP: unique symbol;
|
|
14
23
|
export declare const METADATA: unique symbol;
|
|
24
|
+
export declare const ENTRY: unique symbol;
|
|
15
25
|
export declare const NO_TIMESTAMP = 0;
|
|
16
26
|
export declare const TIMESTAMP_ASSIGN_NEW = 0;
|
|
17
27
|
export declare const TIMESTAMP_ASSIGN_LAST = 1;
|
|
@@ -21,6 +31,7 @@ export declare const HAS_EXPIRATION = 16;
|
|
|
21
31
|
export declare const HAS_RESIDENCY_ID = 32;
|
|
22
32
|
export declare const PENDING_LOCAL_TIME = 1;
|
|
23
33
|
export declare const HAS_STRUCTURE_UPDATE = 256;
|
|
34
|
+
export declare const entryMap: WeakMap<any, Entry>;
|
|
24
35
|
export declare class RecordEncoder extends Encoder {
|
|
25
36
|
constructor(options: any);
|
|
26
37
|
decode(buffer: any, options: any): any;
|
|
@@ -31,3 +42,7 @@ audit?: boolean, // true -> audit this record. false -> do not. null -> retain a
|
|
|
31
42
|
options?: any, type?: string, resolveRecord?: boolean, // indicates that we are resolving (from source) record that was previously invalidated
|
|
32
43
|
auditRecord?: any) => Promise<void>;
|
|
33
44
|
export declare function removeEntry(store: any, entry: any, existingVersion?: number): any;
|
|
45
|
+
export interface RecordObject {
|
|
46
|
+
getUpdatedTime(): number;
|
|
47
|
+
getExpiresAt(): number;
|
|
48
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Conditions, Id, Select, Sort } from './ResourceInterface';
|
|
2
|
+
export declare class RequestTarget extends URLSearchParams {
|
|
3
|
+
target?: string;
|
|
4
|
+
pathname: string;
|
|
5
|
+
search?: string;
|
|
6
|
+
/** Target a specific record, but can be combined with select */
|
|
7
|
+
id?: Id;
|
|
8
|
+
/** The conditions to use in the query, that the returned records must satisfy */
|
|
9
|
+
conditions?: Conditions;
|
|
10
|
+
/** The number of records to return */
|
|
11
|
+
limit?: number;
|
|
12
|
+
/** The number of records to skip */
|
|
13
|
+
offset?: number;
|
|
14
|
+
/** The number of operator to use*/
|
|
15
|
+
operator?: 'AND' | 'OR';
|
|
16
|
+
/** The sort attribute and direction to use */
|
|
17
|
+
/** @ts-ignore*/
|
|
18
|
+
sort?: Sort;
|
|
19
|
+
/** The selected attributes to return */
|
|
20
|
+
select?: Select;
|
|
21
|
+
/** Return an explanation of the query order */
|
|
22
|
+
explain?: boolean;
|
|
23
|
+
/** Force the query to be executed in the order of conditions */
|
|
24
|
+
enforceExecutionOrder?: boolean;
|
|
25
|
+
lazy?: boolean;
|
|
26
|
+
constructor(target?: string);
|
|
27
|
+
toString(): string;
|
|
28
|
+
get url(): string;
|
|
29
|
+
}
|
|
30
|
+
export type RequestTargetOrId = RequestTarget | Id;
|
package/resources/Resource.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { ResourceInterface, SubscriptionRequest, Id, Context, Query } from './ResourceInterface.ts';
|
|
2
|
-
import
|
|
2
|
+
import { Transaction } from './DatabaseTransaction.ts';
|
|
3
3
|
import { IterableEventQueue } from './IterableEventQueue.ts';
|
|
4
|
+
import { AsyncLocalStorage } from 'async_hooks';
|
|
5
|
+
import { RequestTarget } from './RequestTarget.ts';
|
|
6
|
+
export declare const contextStorage: AsyncLocalStorage<Context>;
|
|
4
7
|
/**
|
|
5
8
|
* This is the main class that can be extended for any resource in HarperDB and provides the essential reusable
|
|
6
9
|
* uniform interface for interacting with data, defining the API for providing data (data sources) and for consuming
|
|
@@ -19,23 +22,24 @@ export declare class Resource implements ResourceInterface {
|
|
|
19
22
|
timestamp: number;
|
|
20
23
|
};
|
|
21
24
|
static directURLMapping: boolean;
|
|
25
|
+
static loadAsInstance: boolean;
|
|
22
26
|
constructor(identifier: Id, source: any);
|
|
23
27
|
/**
|
|
24
28
|
* The get methods are for directly getting a resource, and called for HTTP GET requests.
|
|
25
29
|
*/
|
|
26
30
|
static get(identifier: Id, context?: Context): Promise<Resource>;
|
|
27
|
-
static get(
|
|
31
|
+
static get(target: RequestTarget, context?: Context): Promise<AsyncIterable<object>>;
|
|
28
32
|
static get: typeof Resource.get;
|
|
29
33
|
get?(query?: any): Promise<any>;
|
|
30
34
|
/**
|
|
31
35
|
* Store the provided record by the provided id. If no id is provided, it is auto-generated.
|
|
32
36
|
*/
|
|
33
37
|
static put: {
|
|
34
|
-
(idOrQuery: string | Id, dataOrContext?: any, context?: Context): any;
|
|
38
|
+
(idOrQuery: string | Id | Query, dataOrContext?: any, context?: Context): any;
|
|
35
39
|
reliesOnPrototype: boolean;
|
|
36
40
|
};
|
|
37
41
|
static patch: {
|
|
38
|
-
(idOrQuery: string | Id, dataOrContext?: any, context?: Context): any;
|
|
42
|
+
(idOrQuery: string | Id | Query, dataOrContext?: any, context?: Context): any;
|
|
39
43
|
reliesOnPrototype: boolean;
|
|
40
44
|
};
|
|
41
45
|
static delete(identifier: Id, context?: Context): Promise<boolean>;
|
|
@@ -55,15 +59,19 @@ export declare class Resource implements ResourceInterface {
|
|
|
55
59
|
static create(idPrefix: Id, record: any, context: Context): Promise<Id>;
|
|
56
60
|
static create(record: any, context: Context): Promise<Id>;
|
|
57
61
|
static invalidate: {
|
|
58
|
-
(idOrQuery: string | Id, dataOrContext?: any, context?: Context): any;
|
|
62
|
+
(idOrQuery: string | Id | Query, dataOrContext?: any, context?: Context): any;
|
|
59
63
|
reliesOnPrototype: boolean;
|
|
60
64
|
};
|
|
61
65
|
static post: {
|
|
62
|
-
(idOrQuery: string | Id, dataOrContext?: any, context?: Context): any;
|
|
66
|
+
(idOrQuery: string | Id | Query, dataOrContext?: any, context?: Context): any;
|
|
67
|
+
reliesOnPrototype: boolean;
|
|
68
|
+
};
|
|
69
|
+
static update: {
|
|
70
|
+
(idOrQuery: string | Id | Query, dataOrContext?: any, context?: Context): any;
|
|
63
71
|
reliesOnPrototype: boolean;
|
|
64
72
|
};
|
|
65
73
|
static connect: {
|
|
66
|
-
(idOrQuery: string | Id, dataOrContext?: any, context?: Context): any;
|
|
74
|
+
(idOrQuery: string | Id | Query, dataOrContext?: any, context?: Context): any;
|
|
67
75
|
reliesOnPrototype: boolean;
|
|
68
76
|
};
|
|
69
77
|
static subscribe(request: SubscriptionRequest): Promise<AsyncIterable<{
|
|
@@ -73,30 +81,30 @@ export declare class Resource implements ResourceInterface {
|
|
|
73
81
|
}>>;
|
|
74
82
|
static subscribe: typeof Resource.subscribe;
|
|
75
83
|
static publish: {
|
|
76
|
-
(idOrQuery: string | Id, dataOrContext?: any, context?: Context): any;
|
|
84
|
+
(idOrQuery: string | Id | Query, dataOrContext?: any, context?: Context): any;
|
|
77
85
|
reliesOnPrototype: boolean;
|
|
78
86
|
};
|
|
79
87
|
static search: {
|
|
80
|
-
(idOrQuery: string | Id, dataOrContext?: any, context?: Context): any;
|
|
88
|
+
(idOrQuery: string | Id | Query, dataOrContext?: any, context?: Context): any;
|
|
81
89
|
reliesOnPrototype: boolean;
|
|
82
90
|
};
|
|
83
91
|
static query: {
|
|
84
|
-
(idOrQuery: string | Id, dataOrContext?: any, context?: Context): any;
|
|
92
|
+
(idOrQuery: string | Id | Query, dataOrContext?: any, context?: Context): any;
|
|
85
93
|
reliesOnPrototype: boolean;
|
|
86
94
|
};
|
|
87
95
|
static copy: {
|
|
88
|
-
(idOrQuery: string | Id, dataOrContext?: any, context?: Context): any;
|
|
96
|
+
(idOrQuery: string | Id | Query, dataOrContext?: any, context?: Context): any;
|
|
89
97
|
reliesOnPrototype: boolean;
|
|
90
98
|
};
|
|
91
99
|
static move: {
|
|
92
|
-
(idOrQuery: string | Id, dataOrContext?: any, context?: Context): any;
|
|
100
|
+
(idOrQuery: string | Id | Query, dataOrContext?: any, context?: Context): any;
|
|
93
101
|
reliesOnPrototype: boolean;
|
|
94
102
|
};
|
|
95
103
|
post(newRecord: any): Promise<any>;
|
|
96
104
|
static isCollection(resource: any): any;
|
|
97
105
|
get isCollection(): boolean;
|
|
98
106
|
static coerceId(id: string): number | string;
|
|
99
|
-
static parseQuery(search: any):
|
|
107
|
+
static parseQuery(search: any, query: any): URLSearchParams | RequestTarget;
|
|
100
108
|
static parsePath(path: any, context: any, query: any): any;
|
|
101
109
|
/**
|
|
102
110
|
* Gets an instance of a resource by id
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { DatabaseTransaction } from './DatabaseTransaction.ts';
|
|
2
2
|
import { OperationFunctionName } from '../server/serverHelpers/serverUtilities.ts';
|
|
3
|
+
import { RequestTarget } from './RequestTarget';
|
|
3
4
|
export interface ResourceInterface<Key = any, Record = any> {
|
|
4
|
-
get?(): Promise<UpdatableRecord<Record>>;
|
|
5
|
-
get?(query:
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
get?(id: Id): Promise<UpdatableRecord<Record>>;
|
|
6
|
+
get?(query: RequestTargetOrId): Promise<AsyncIterable<Record>>;
|
|
7
|
+
put?(target: RequestTargetOrId, record: any): void;
|
|
8
|
+
post?(target: RequestTargetOrId, record: any): void;
|
|
9
|
+
patch?(target: RequestTargetOrId, record: any): void;
|
|
10
|
+
publish?(target: RequestTargetOrId, record: any): void;
|
|
8
11
|
update?(updates: any, fullUpdate?: boolean): Promise<UpdatableRecord<Record>>;
|
|
9
|
-
delete?(): boolean;
|
|
10
|
-
search?(query:
|
|
12
|
+
delete?(target: RequestTargetOrId): boolean;
|
|
13
|
+
search?(query: RequestTarget): AsyncIterable<any>;
|
|
11
14
|
subscribe?(request: SubscriptionRequest): Subscription;
|
|
12
|
-
allowRead(user: any,
|
|
15
|
+
allowRead(user: any, target: RequestTarget, context: Context): boolean | Promise<boolean>;
|
|
13
16
|
allowUpdate(user: any, record: any, fullUpdate?: boolean): boolean | Promise<boolean>;
|
|
14
17
|
allowCreate(user: any, record: any, context: Context): boolean | Promise<boolean>;
|
|
15
|
-
allowDelete(user: any,
|
|
18
|
+
allowDelete(user: any, target: RequestTarget, context: Context): boolean | Promise<boolean>;
|
|
16
19
|
}
|
|
17
20
|
export interface User {
|
|
18
21
|
username: string;
|
|
@@ -43,6 +46,10 @@ export interface Context {
|
|
|
43
46
|
replicateFrom?: boolean;
|
|
44
47
|
replicatedConfirmation?: number;
|
|
45
48
|
originatingOperation?: OperationFunctionName;
|
|
49
|
+
previousResidency?: string[];
|
|
50
|
+
loadedFromSource?: boolean;
|
|
51
|
+
nodeName?: string;
|
|
52
|
+
resourceCache?: Map<Id, any>;
|
|
46
53
|
}
|
|
47
54
|
export type Operator = 'and' | 'or';
|
|
48
55
|
type SearchType = 'equals' | 'contains' | 'starts_with' | 'ends_with' | 'greater_than' | 'greater_than_equal' | 'less_than' | 'less_than_equal' | 'between';
|
|
@@ -70,27 +77,6 @@ export interface SubSelect {
|
|
|
70
77
|
select: (string | SubSelect)[];
|
|
71
78
|
}
|
|
72
79
|
export type Select = (string | SubSelect)[];
|
|
73
|
-
export interface Query {
|
|
74
|
-
/** Retrieve a specific record, but can be combined with select */
|
|
75
|
-
id?: Id;
|
|
76
|
-
/** The conditions to use in the query, that the returned records must satisfy */
|
|
77
|
-
conditions?: Conditions;
|
|
78
|
-
/** The number of records to return */
|
|
79
|
-
limit?: number;
|
|
80
|
-
/** The number of records to skip */
|
|
81
|
-
offset?: number;
|
|
82
|
-
/** The number of operator to use*/
|
|
83
|
-
operator?: 'AND' | 'OR';
|
|
84
|
-
/** The sort attribute and direction to use */
|
|
85
|
-
sort?: Sort;
|
|
86
|
-
/** The selected attributes to return */
|
|
87
|
-
select?: Select;
|
|
88
|
-
/** Return an explanation of the query order */
|
|
89
|
-
explain?: boolean;
|
|
90
|
-
/** Force the query to be executed in the order of conditions */
|
|
91
|
-
enforceExecutionOrder?: boolean;
|
|
92
|
-
lazy?: boolean;
|
|
93
|
-
}
|
|
94
80
|
export interface SubscriptionRequest {
|
|
95
81
|
/** The starting time of events to return (defaults to now) */
|
|
96
82
|
startTime?: number;
|
|
@@ -98,7 +84,14 @@ export interface SubscriptionRequest {
|
|
|
98
84
|
previousCount?: number;
|
|
99
85
|
/** If the current record state should be omitted as the first event */
|
|
100
86
|
omitCurrent?: boolean;
|
|
87
|
+
onlyChildren?: boolean;
|
|
88
|
+
includeDescendants?: boolean;
|
|
89
|
+
supportsTransactions?: boolean;
|
|
90
|
+
rawEvents?: boolean;
|
|
91
|
+
listener: (data: any) => void;
|
|
101
92
|
}
|
|
93
|
+
export type Query = RequestTarget;
|
|
94
|
+
export type RequestTargetOrId = RequestTarget | Id;
|
|
102
95
|
export type Id = number | string | (number | string | null)[] | null;
|
|
103
96
|
type UpdatableRecord<T> = T;
|
|
104
97
|
interface Subscription {
|