@vandenberghinc/volt 1.1.5 → 1.1.7
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/backend/dist/cjs/database.d.ts +41 -68
- package/backend/dist/cjs/database.js +127 -76
- package/backend/dist/cjs/endpoint.d.ts +23 -9
- package/backend/dist/cjs/endpoint.js +98 -21
- package/backend/dist/cjs/frontend.d.ts +0 -2
- package/backend/dist/cjs/frontend.js +9 -9
- package/backend/dist/cjs/image_endpoint.d.ts +3 -1
- package/backend/dist/cjs/image_endpoint.js +2 -1
- package/backend/dist/cjs/payments/paddle.js +10 -2
- package/backend/dist/cjs/plugins/css.d.ts +6 -5
- package/backend/dist/cjs/plugins/css.js +32 -7
- package/backend/dist/cjs/plugins/ts/compiler.d.ts +6 -1
- package/backend/dist/cjs/plugins/ts/compiler.js +26 -2
- package/backend/dist/cjs/plugins/ts/preprocessing.js +5 -3
- package/backend/dist/cjs/server.d.ts +7 -13
- package/backend/dist/cjs/server.js +184 -303
- package/backend/dist/cjs/status.d.ts +1 -0
- package/backend/dist/cjs/status.js +2 -1
- package/backend/dist/cjs/stream.d.ts +5 -3
- package/backend/dist/cjs/stream.js +13 -4
- package/backend/dist/cjs/users.d.ts +1 -1
- package/backend/dist/cjs/users.js +87 -72
- package/backend/dist/cjs/utils.d.ts +17 -9
- package/backend/dist/cjs/utils.js +22 -64
- package/backend/dist/cjs/view.d.ts +2 -2
- package/backend/dist/cjs/view.js +38 -40
- package/backend/dist/cjs/volt.d.ts +3 -2
- package/backend/dist/cjs/volt.js +2 -2
- package/backend/dist/css/volt.css +5 -0
- package/backend/dist/esm/database.d.ts +41 -68
- package/backend/dist/esm/database.js +127 -76
- package/backend/dist/esm/endpoint.d.ts +23 -9
- package/backend/dist/esm/endpoint.js +99 -22
- package/backend/dist/esm/frontend.d.ts +0 -2
- package/backend/dist/esm/frontend.js +9 -9
- package/backend/dist/esm/image_endpoint.d.ts +3 -1
- package/backend/dist/esm/image_endpoint.js +2 -1
- package/backend/dist/esm/payments/paddle.js +11 -3
- package/backend/dist/esm/plugins/css.d.ts +6 -5
- package/backend/dist/esm/plugins/css.js +32 -6
- package/backend/dist/esm/plugins/ts/compiler.d.ts +6 -1
- package/backend/dist/esm/plugins/ts/compiler.js +26 -2
- package/backend/dist/esm/plugins/ts/preprocessing.js +5 -3
- package/backend/dist/esm/server.d.ts +7 -13
- package/backend/dist/esm/server.js +182 -301
- package/backend/dist/esm/status.d.ts +1 -0
- package/backend/dist/esm/status.js +1 -0
- package/backend/dist/esm/stream.d.ts +5 -3
- package/backend/dist/esm/stream.js +13 -4
- package/backend/dist/esm/users.d.ts +1 -1
- package/backend/dist/esm/users.js +87 -72
- package/backend/dist/esm/utils.d.ts +17 -9
- package/backend/dist/esm/utils.js +21 -62
- package/backend/dist/esm/view.d.ts +2 -2
- package/backend/dist/esm/view.js +38 -40
- package/backend/dist/esm/volt.d.ts +3 -2
- package/backend/dist/esm/volt.js +2 -1
- package/backend/dist/esm-dev/blacklist.js +1 -1
- package/backend/dist/esm-dev/cli.js +2 -2
- package/backend/dist/esm-dev/database.d.ts +41 -68
- package/backend/dist/esm-dev/database.js +128 -77
- package/backend/dist/esm-dev/endpoint.d.ts +23 -9
- package/backend/dist/esm-dev/endpoint.js +100 -23
- package/backend/dist/esm-dev/file_watcher.js +1 -1
- package/backend/dist/esm-dev/frontend.d.ts +0 -2
- package/backend/dist/esm-dev/frontend.js +9 -9
- package/backend/dist/esm-dev/image_endpoint.d.ts +3 -1
- package/backend/dist/esm-dev/image_endpoint.js +2 -1
- package/backend/dist/esm-dev/logger.js +1 -1
- package/backend/dist/esm-dev/payments/paddle.js +12 -4
- package/backend/dist/esm-dev/plugins/css.d.ts +6 -5
- package/backend/dist/esm-dev/plugins/css.js +33 -7
- package/backend/dist/esm-dev/plugins/ts/compiler.d.ts +6 -1
- package/backend/dist/esm-dev/plugins/ts/compiler.js +27 -3
- package/backend/dist/esm-dev/plugins/ts/preprocessing.js +7 -5
- package/backend/dist/esm-dev/rate_limit.js +1 -1
- package/backend/dist/esm-dev/server.d.ts +7 -13
- package/backend/dist/esm-dev/server.js +184 -303
- package/backend/dist/esm-dev/status.d.ts +1 -0
- package/backend/dist/esm-dev/status.js +1 -0
- package/backend/dist/esm-dev/stream.d.ts +5 -3
- package/backend/dist/esm-dev/stream.js +13 -4
- package/backend/dist/esm-dev/users.d.ts +1 -1
- package/backend/dist/esm-dev/users.js +88 -73
- package/backend/dist/esm-dev/utils.d.ts +17 -9
- package/backend/dist/esm-dev/utils.js +22 -63
- package/backend/dist/esm-dev/view.d.ts +2 -2
- package/backend/dist/esm-dev/view.js +39 -41
- package/backend/dist/esm-dev/volt.d.ts +3 -2
- package/backend/dist/esm-dev/volt.js +2 -1
- package/backend/src/database.ts +163 -152
- package/backend/src/endpoint.ts +123 -31
- package/backend/src/frontend.ts +9 -8
- package/backend/src/image_endpoint.ts +4 -0
- package/backend/src/payments/paddle.ts +11 -3
- package/backend/src/plugins/css.ts +36 -8
- package/backend/src/plugins/ts/compiler.ts +37 -1
- package/backend/src/plugins/ts/preprocessing.ts +5 -3
- package/backend/src/server.ts +167 -306
- package/backend/src/status.ts +1 -0
- package/backend/src/stream.ts +28 -8
- package/backend/src/users.ts +87 -72
- package/backend/src/utils.ts +58 -25
- package/backend/src/view.ts +30 -28
- package/backend/src/{volt.js → volt.ts} +2 -1
- package/backend/tsconfig.cjs.json +3 -3
- package/backend/tsconfig.esm.json +3 -3
- package/frontend/dist/elements/base.d.ts +397 -415
- package/frontend/dist/elements/base.js +565 -328
- package/frontend/dist/elements/module.d.ts +26 -12
- package/frontend/dist/elements/module.js +69 -32
- package/frontend/dist/elements/register_element.d.ts +3 -0
- package/frontend/dist/elements/register_element.js +22 -0
- package/frontend/dist/modules/auth.d.ts +1 -0
- package/frontend/dist/modules/auth.js +6 -5
- package/frontend/dist/modules/color.d.ts +159 -0
- package/frontend/dist/modules/color.js +315 -0
- package/frontend/dist/modules/colors.d.ts +1 -26
- package/frontend/dist/modules/colors.js +417 -338
- package/frontend/dist/modules/cookies.d.ts +1 -0
- package/frontend/dist/modules/cookies.js +1 -0
- package/frontend/dist/modules/events.d.ts +1 -0
- package/frontend/dist/modules/events.js +1 -0
- package/frontend/dist/modules/google.d.ts +1 -0
- package/frontend/dist/modules/google.js +1 -0
- package/frontend/dist/modules/meta.d.ts +1 -0
- package/frontend/dist/modules/meta.js +1 -0
- package/frontend/dist/modules/mutex.d.ts +1 -2
- package/frontend/dist/modules/mutex.js +3 -4
- package/frontend/dist/modules/paddle.d.ts +1 -0
- package/frontend/dist/modules/paddle.js +14 -13
- package/frontend/dist/modules/scheme.d.ts +1 -0
- package/frontend/dist/modules/scheme.js +4 -2
- package/frontend/dist/modules/statics.d.ts +1 -0
- package/frontend/dist/modules/statics.js +1 -0
- package/frontend/dist/modules/support.d.ts +1 -0
- package/frontend/dist/modules/support.js +3 -2
- package/frontend/dist/modules/theme.d.ts +56 -0
- package/frontend/dist/{ui → modules}/theme.js +186 -75
- package/frontend/dist/modules/themes.d.ts +1 -1
- package/frontend/dist/modules/themes.js +1 -0
- package/frontend/dist/modules/user.d.ts +1 -0
- package/frontend/dist/modules/user.js +11 -10
- package/frontend/dist/modules/utils.d.ts +23 -2
- package/frontend/dist/modules/utils.js +93 -1
- package/frontend/dist/types/gradient.js +4 -0
- package/frontend/dist/ui/border_button.d.ts +0 -25
- package/frontend/dist/ui/border_button.js +50 -51
- package/frontend/dist/ui/button.d.ts +0 -21
- package/frontend/dist/ui/button.js +41 -46
- package/frontend/dist/ui/canvas.js +15 -15
- package/frontend/dist/ui/checkbox.d.ts +3 -17
- package/frontend/dist/ui/checkbox.js +36 -30
- package/frontend/dist/ui/code.d.ts +15 -82
- package/frontend/dist/ui/code.js +150 -125
- package/frontend/dist/ui/color.d.ts +0 -1
- package/frontend/dist/ui/color.js +1 -1
- package/frontend/dist/ui/context_menu.d.ts +4 -2
- package/frontend/dist/ui/context_menu.js +16 -17
- package/frontend/dist/ui/css.js +2 -0
- package/frontend/dist/ui/divider.d.ts +0 -7
- package/frontend/dist/ui/divider.js +21 -25
- package/frontend/dist/ui/dropdown.d.ts +13 -7
- package/frontend/dist/ui/dropdown.js +65 -30
- package/frontend/dist/ui/for_each.d.ts +0 -5
- package/frontend/dist/ui/for_each.js +17 -22
- package/frontend/dist/ui/form.d.ts +17 -12
- package/frontend/dist/ui/form.js +21 -18
- package/frontend/dist/ui/frame_modes.d.ts +9 -12
- package/frontend/dist/ui/frame_modes.js +8 -10
- package/frontend/dist/ui/google_map.d.ts +0 -11
- package/frontend/dist/ui/google_map.js +23 -28
- package/frontend/dist/ui/gradient.d.ts +0 -5
- package/frontend/dist/ui/gradient.js +17 -22
- package/frontend/dist/ui/image.d.ts +27 -58
- package/frontend/dist/ui/image.js +99 -93
- package/frontend/dist/ui/input.d.ts +20 -97
- package/frontend/dist/ui/input.js +192 -170
- package/frontend/dist/ui/link.d.ts +0 -18
- package/frontend/dist/ui/link.js +42 -48
- package/frontend/dist/ui/list.js +36 -37
- package/frontend/dist/ui/loader_button.d.ts +4 -19
- package/frontend/dist/ui/loader_button.js +35 -37
- package/frontend/dist/ui/loaders.d.ts +0 -8
- package/frontend/dist/ui/loaders.js +20 -25
- package/frontend/dist/ui/popup.d.ts +11 -8
- package/frontend/dist/ui/popup.js +183 -24
- package/frontend/dist/ui/pseudo.d.ts +3 -3
- package/frontend/dist/ui/pseudo.js +14 -17
- package/frontend/dist/ui/scroller.d.ts +10 -48
- package/frontend/dist/ui/scroller.js +306 -300
- package/frontend/dist/ui/slider.d.ts +9 -3
- package/frontend/dist/ui/slider.js +31 -17
- package/frontend/dist/ui/spacer.d.ts +0 -9
- package/frontend/dist/ui/spacer.js +21 -26
- package/frontend/dist/ui/span.js +13 -15
- package/frontend/dist/ui/stack.d.ts +14 -75
- package/frontend/dist/ui/stack.js +166 -169
- package/frontend/dist/ui/steps.d.ts +10 -23
- package/frontend/dist/ui/steps.js +47 -34
- package/frontend/dist/ui/style.d.ts +4 -3
- package/frontend/dist/ui/style.js +13 -18
- package/frontend/dist/ui/switch.d.ts +10 -4
- package/frontend/dist/ui/switch.js +24 -16
- package/frontend/dist/ui/table.d.ts +0 -23
- package/frontend/dist/ui/table.js +113 -119
- package/frontend/dist/ui/tabs.d.ts +3 -19
- package/frontend/dist/ui/tabs.js +35 -29
- package/frontend/dist/ui/text.d.ts +0 -8
- package/frontend/dist/ui/text.js +20 -25
- package/frontend/dist/ui/title.d.ts +0 -15
- package/frontend/dist/ui/title.js +39 -45
- package/frontend/dist/ui/ui.d.ts +0 -2
- package/frontend/dist/ui/ui.js +0 -2
- package/frontend/dist/ui/view.d.ts +3 -17
- package/frontend/dist/ui/view.js +27 -32
- package/frontend/dist/volt.d.ts +2 -1
- package/frontend/dist/volt.js +3 -1
- package/frontend/examples/dashboard/dashboard.ts +774 -0
- package/frontend/examples/theme/theme.ts +58 -0
- package/frontend/src/css/volt.css +5 -0
- package/frontend/src/elements/base.ts +767 -545
- package/frontend/src/elements/module.ts +90 -29
- package/frontend/src/elements/register_element.ts +24 -0
- package/frontend/src/modules/auth.ts +7 -6
- package/frontend/src/modules/color.ts +348 -0
- package/frontend/src/modules/colors.ts +468 -449
- package/frontend/src/modules/cookies.ts +1 -0
- package/frontend/src/modules/events.ts +1 -0
- package/frontend/src/modules/google.ts +1 -0
- package/frontend/src/modules/meta.ts +2 -1
- package/frontend/src/modules/mutex.ts +2 -4
- package/frontend/src/modules/paddle.ts +21 -20
- package/frontend/src/modules/scheme.ts +4 -3
- package/frontend/src/modules/statics.ts +2 -1
- package/frontend/src/modules/support.ts +3 -2
- package/frontend/src/modules/theme.ts +413 -0
- package/frontend/src/modules/themes.ts +2 -1
- package/frontend/src/modules/user.ts +12 -11
- package/frontend/src/modules/utils.ts +125 -2
- package/frontend/src/ui/border_button.ts +41 -37
- package/frontend/src/ui/button.ts +33 -32
- package/frontend/src/ui/canvas.ts +5 -2
- package/frontend/src/ui/checkbox.ts +21 -22
- package/frontend/src/ui/code.ts +92 -86
- package/frontend/src/ui/context_menu.ts +7 -5
- package/frontend/src/ui/css.ts +1 -1
- package/frontend/src/ui/divider.ts +15 -10
- package/frontend/src/ui/dropdown.ts +38 -21
- package/frontend/src/ui/for_each.ts +9 -8
- package/frontend/src/ui/form.ts +26 -21
- package/frontend/src/ui/frame_modes.ts +13 -17
- package/frontend/src/ui/google_map.ts +15 -13
- package/frontend/src/ui/gradient.ts +9 -8
- package/frontend/src/ui/image.ts +108 -86
- package/frontend/src/ui/input.ts +145 -144
- package/frontend/src/ui/link.ts +25 -23
- package/frontend/src/ui/list.ts +12 -6
- package/frontend/src/ui/loader_button.ts +26 -25
- package/frontend/src/ui/loaders.ts +12 -11
- package/frontend/src/ui/popup.ts +168 -14
- package/frontend/src/ui/pseudo.ts +5 -3
- package/frontend/src/ui/scroller.ts +303 -294
- package/frontend/src/ui/slider.ts +15 -10
- package/frontend/src/ui/spacer.ts +14 -11
- package/frontend/src/ui/span.ts +6 -2
- package/frontend/src/ui/stack.ts +196 -183
- package/frontend/src/ui/steps.ts +38 -22
- package/frontend/src/ui/style.ts +7 -4
- package/frontend/src/ui/switch.ts +16 -11
- package/frontend/src/ui/table.ts +42 -34
- package/frontend/src/ui/tabs.ts +20 -19
- package/frontend/src/ui/text.ts +12 -11
- package/frontend/src/ui/title.ts +22 -20
- package/frontend/src/ui/ui.ts +0 -2
- package/frontend/src/ui/view.ts +20 -19
- package/frontend/src/volt.ts +3 -1
- package/frontend/{compile.js → tools/compile.old.js} +2 -2
- package/frontend/tools/embed_scripts.js +69 -0
- package/frontend/tsconfig.json +26 -0
- package/package.json +8 -8
- package/frontend/dist/ui/theme.d.ts +0 -25
- package/frontend/exports.json +0 -1340
- package/frontend/src/modules/date.js +0 -535
- package/frontend/src/ui/color.ts +0 -117
- package/frontend/src/ui/theme.ts +0 -279
- /package/backend/src/{vinc.dev.js → vinc.dev.ts} +0 -0
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { ChildProcess } from "child_process";
|
|
2
2
|
import { MongoClient, Collection as MongoCollection } from 'mongodb';
|
|
3
|
+
import { vlib } from "./vinc.js";
|
|
4
|
+
interface BaseOptions {
|
|
5
|
+
options?: Record<string, any>;
|
|
6
|
+
commit_quorum?: any;
|
|
7
|
+
forced?: boolean;
|
|
8
|
+
}
|
|
9
|
+
type IndexOptions = (BaseOptions & {
|
|
10
|
+
key: string;
|
|
11
|
+
keys?: never;
|
|
12
|
+
}) | (BaseOptions & {
|
|
13
|
+
key?: never;
|
|
14
|
+
keys: string[];
|
|
15
|
+
});
|
|
3
16
|
declare class Collection {
|
|
4
17
|
static chunk_size: number;
|
|
5
18
|
static constructor_scheme: {
|
|
@@ -47,21 +60,13 @@ declare class Collection {
|
|
|
47
60
|
uid_based: boolean;
|
|
48
61
|
ttl: number | null;
|
|
49
62
|
ttl_enabled: boolean;
|
|
50
|
-
constructor(name: string, collection: MongoCollection, ttl?: number | null,
|
|
51
|
-
|
|
52
|
-
options?: Record<string, any>;
|
|
53
|
-
commit_quorum?: any;
|
|
54
|
-
forced?: boolean;
|
|
55
|
-
}>, uid_based?: boolean);
|
|
63
|
+
constructor(name: string, collection: MongoCollection, ttl?: number | null, // ttl in msec
|
|
64
|
+
indexes?: IndexOptions[], uid_based?: boolean);
|
|
56
65
|
private _process_doc;
|
|
57
66
|
private _load_chunked;
|
|
58
67
|
private _save_chunked;
|
|
59
|
-
create_index({
|
|
60
|
-
|
|
61
|
-
options?: Record<string, any> | null;
|
|
62
|
-
commit_quorum?: any;
|
|
63
|
-
forced?: boolean;
|
|
64
|
-
}): Promise<string>;
|
|
68
|
+
create_index({ key, keys, // following the IndexOptions "key" or "keys" must be defined in typescript but not in raw js.
|
|
69
|
+
options, commit_quorum, forced }: IndexOptions): Promise<string>;
|
|
65
70
|
find(query: Record<string, any>): Promise<any>;
|
|
66
71
|
exists(path: string | Record<string, any>): Promise<boolean>;
|
|
67
72
|
load(path: string | Record<string, any>, opts?: {
|
|
@@ -101,16 +106,8 @@ declare class Collection {
|
|
|
101
106
|
declare class UIDCollection {
|
|
102
107
|
private _col;
|
|
103
108
|
col: MongoCollection;
|
|
104
|
-
constructor(name: string, collection: MongoCollection, indexes?:
|
|
105
|
-
|
|
106
|
-
options?: Record<string, any>;
|
|
107
|
-
commit_quorum?: any;
|
|
108
|
-
}>, ttl?: number | null);
|
|
109
|
-
create_index({ keys, options, commit_quorum }: {
|
|
110
|
-
keys: string[] | string | Record<string, any>;
|
|
111
|
-
options?: Record<string, any> | null;
|
|
112
|
-
commit_quorum?: any;
|
|
113
|
-
}): Promise<string>;
|
|
109
|
+
constructor(name: string, collection: MongoCollection, indexes?: IndexOptions[], ttl?: number | null);
|
|
110
|
+
create_index(args: IndexOptions): Promise<string>;
|
|
114
111
|
find(uid?: string | null, query?: Record<string, any>): Promise<any>;
|
|
115
112
|
exists(uid: string, path: string | Record<string, any>): Promise<boolean>;
|
|
116
113
|
load(uid: string, path: string | Record<string, any>, opts?: {
|
|
@@ -275,90 +272,66 @@ declare class Database {
|
|
|
275
272
|
type: string[];
|
|
276
273
|
default: {};
|
|
277
274
|
};
|
|
278
|
-
_server:
|
|
275
|
+
_server: {
|
|
276
|
+
type: string[];
|
|
277
|
+
};
|
|
279
278
|
};
|
|
280
279
|
uri: string | null;
|
|
281
|
-
preview: boolean;
|
|
282
|
-
preview_ip_whitelist: string[];
|
|
283
280
|
client_opts: Record<string, any> | null;
|
|
284
281
|
config: Record<string, any>;
|
|
285
|
-
source:
|
|
282
|
+
source: vlib.Path | undefined;
|
|
286
283
|
start_args: string[];
|
|
287
|
-
_collections:
|
|
284
|
+
_collections: {
|
|
288
285
|
name: string;
|
|
289
286
|
ttl?: number | null;
|
|
290
|
-
indexes?:
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
commit_quorum?: any;
|
|
294
|
-
}>;
|
|
295
|
-
}>;
|
|
296
|
-
_uid_collections: Array<{
|
|
287
|
+
indexes?: string[] | IndexOptions[];
|
|
288
|
+
}[];
|
|
289
|
+
_uid_collections: {
|
|
297
290
|
name: string;
|
|
298
291
|
ttl?: number | null;
|
|
299
|
-
indexes?:
|
|
300
|
-
|
|
301
|
-
options?: Record<string, any>;
|
|
302
|
-
commit_quorum?: any;
|
|
303
|
-
}>;
|
|
304
|
-
}>;
|
|
292
|
+
indexes?: string[] | IndexOptions[];
|
|
293
|
+
}[];
|
|
305
294
|
server: any;
|
|
306
295
|
client: MongoClient | null;
|
|
307
296
|
collections: Record<string, Collection | UIDCollection>;
|
|
308
297
|
proc?: ChildProcess;
|
|
309
298
|
daemon?: any;
|
|
310
299
|
db?: any;
|
|
311
|
-
|
|
300
|
+
_listed_cols: any;
|
|
301
|
+
constructor({ uri, source, config, start_args, client, collections, uid_collections, daemon, _server, }: {
|
|
312
302
|
uri?: string | null;
|
|
313
303
|
source?: string | null;
|
|
314
304
|
config?: Record<string, any> | null;
|
|
315
305
|
start_args?: string[];
|
|
316
306
|
client?: Record<string, any> | null;
|
|
317
|
-
collections?:
|
|
307
|
+
collections?: {
|
|
318
308
|
name: string;
|
|
319
309
|
ttl?: number | null;
|
|
320
|
-
indexes?:
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
commit_quorum?: any;
|
|
324
|
-
}>;
|
|
325
|
-
}>;
|
|
326
|
-
uid_collections?: Array<{
|
|
310
|
+
indexes?: string[] | IndexOptions[];
|
|
311
|
+
}[];
|
|
312
|
+
uid_collections?: {
|
|
327
313
|
name: string;
|
|
328
314
|
ttl?: number | null;
|
|
329
|
-
indexes?:
|
|
330
|
-
|
|
331
|
-
options?: Record<string, any>;
|
|
332
|
-
commit_quorum?: any;
|
|
333
|
-
}>;
|
|
334
|
-
}>;
|
|
315
|
+
indexes?: string[] | IndexOptions[];
|
|
316
|
+
}[];
|
|
335
317
|
preview?: boolean;
|
|
336
318
|
preview_ip_whitelist?: string[];
|
|
337
319
|
daemon?: Record<string, any> | boolean;
|
|
338
320
|
_server: any;
|
|
339
321
|
});
|
|
340
|
-
_initialize_db_preview(): void;
|
|
341
322
|
connect(): Promise<void>;
|
|
342
323
|
initialize(): Promise<void>;
|
|
343
324
|
close(): Promise<void>;
|
|
344
325
|
create_collection(info: {
|
|
345
326
|
name: string;
|
|
346
|
-
indexes?:
|
|
347
|
-
keys: string[] | string | Record<string, any>;
|
|
348
|
-
options?: Record<string, any>;
|
|
349
|
-
commit_quorum?: any;
|
|
350
|
-
}>;
|
|
327
|
+
indexes?: IndexOptions[];
|
|
351
328
|
ttl?: number | null;
|
|
352
|
-
} | string): Collection
|
|
329
|
+
} | string): Promise<Collection>;
|
|
353
330
|
create_uid_collection(info: {
|
|
354
331
|
name: string;
|
|
355
|
-
indexes?:
|
|
356
|
-
keys: string[] | string | Record<string, any>;
|
|
357
|
-
options?: Record<string, any>;
|
|
358
|
-
commit_quorum?: any;
|
|
359
|
-
}>;
|
|
332
|
+
indexes?: IndexOptions[];
|
|
360
333
|
ttl?: number | null;
|
|
361
|
-
} | string): UIDCollection
|
|
334
|
+
} | string): Promise<UIDCollection>;
|
|
362
335
|
get_collections(): Promise<string[]>;
|
|
363
336
|
}
|
|
364
337
|
export { Collection, UIDCollection, Database };
|
|
@@ -34,7 +34,7 @@ class Collection {
|
|
|
34
34
|
static constructor_scheme = {
|
|
35
35
|
name: "string",
|
|
36
36
|
uid_based: "boolean",
|
|
37
|
-
ttl: { type: "number", default: null },
|
|
37
|
+
ttl: { type: "number", default: null }, // ttl in msec
|
|
38
38
|
indexes: {
|
|
39
39
|
type: "array",
|
|
40
40
|
default: [],
|
|
@@ -43,7 +43,7 @@ class Collection {
|
|
|
43
43
|
scheme: {
|
|
44
44
|
key: { type: "string", required: (data) => data.key == null && data.keys == null },
|
|
45
45
|
keys: {
|
|
46
|
-
type: ["
|
|
46
|
+
type: ["array"],
|
|
47
47
|
required: (data) => data.key == null && data.keys == null, value_scheme: "string",
|
|
48
48
|
postprocess: (keys) => typeof keys === "string" ? [keys] : keys,
|
|
49
49
|
},
|
|
@@ -54,11 +54,6 @@ class Collection {
|
|
|
54
54
|
postprocess: (info) => {
|
|
55
55
|
if (typeof info === "string")
|
|
56
56
|
return { keys: [info] };
|
|
57
|
-
if (typeof info === "object" && info.key) {
|
|
58
|
-
info.keys = info.key;
|
|
59
|
-
delete info.key;
|
|
60
|
-
return info;
|
|
61
|
-
}
|
|
62
57
|
return info;
|
|
63
58
|
},
|
|
64
59
|
},
|
|
@@ -68,9 +63,10 @@ class Collection {
|
|
|
68
63
|
col;
|
|
69
64
|
name;
|
|
70
65
|
uid_based;
|
|
71
|
-
ttl;
|
|
66
|
+
ttl; // ttl in msec
|
|
72
67
|
ttl_enabled;
|
|
73
|
-
constructor(name, collection, ttl = null,
|
|
68
|
+
constructor(name, collection, ttl = null, // ttl in msec
|
|
69
|
+
indexes = [], uid_based = false) {
|
|
74
70
|
// Verify scheme.
|
|
75
71
|
({ indexes, ttl } = _vinc_1.vlib.Scheme.verify({
|
|
76
72
|
object: {
|
|
@@ -110,13 +106,8 @@ class Collection {
|
|
|
110
106
|
}
|
|
111
107
|
// Create indexes.
|
|
112
108
|
if (Array.isArray(indexes) && indexes.length > 0) {
|
|
113
|
-
for (
|
|
114
|
-
this.create_index(
|
|
115
|
-
keys: index.keys,
|
|
116
|
-
options: index.options,
|
|
117
|
-
commit_quorum: index.commit_quorum,
|
|
118
|
-
forced: index.forced,
|
|
119
|
-
});
|
|
109
|
+
for (let item of indexes) {
|
|
110
|
+
this.create_index(item);
|
|
120
111
|
}
|
|
121
112
|
}
|
|
122
113
|
}
|
|
@@ -231,23 +222,22 @@ class Collection {
|
|
|
231
222
|
@name: commitQuorum
|
|
232
223
|
@desc: The `commitQuorum` argument for the orignal mongodb `createIndex()` function.
|
|
233
224
|
*/
|
|
234
|
-
async create_index({
|
|
225
|
+
async create_index({ key = undefined, keys = undefined, // following the IndexOptions "key" or "keys" must be defined in typescript but not in raw js.
|
|
226
|
+
options = undefined, commit_quorum = undefined, forced = false }) {
|
|
227
|
+
// Create keys objs per input type.
|
|
235
228
|
let keys_obj = {};
|
|
236
|
-
if (
|
|
229
|
+
if (key) {
|
|
237
230
|
keys_obj = {};
|
|
238
|
-
keys_obj[
|
|
231
|
+
keys_obj[key] = 1;
|
|
239
232
|
}
|
|
240
|
-
else if (Array.isArray(keys)) {
|
|
233
|
+
else if (Array.isArray(keys) && keys.length > 0) {
|
|
241
234
|
keys_obj = {};
|
|
242
235
|
for (const key of keys) {
|
|
243
236
|
keys_obj[key] = 1;
|
|
244
237
|
}
|
|
245
238
|
}
|
|
246
|
-
else if (keys == null || typeof keys !== "object") {
|
|
247
|
-
_vinc_1.vlib.Scheme.throw_invalid_type("keys", keys, ["string", "string[]", "object"], true);
|
|
248
|
-
}
|
|
249
239
|
else {
|
|
250
|
-
|
|
240
|
+
throw new Error("Define one of the following parameters: [key, keys].");
|
|
251
241
|
}
|
|
252
242
|
// Drop index.
|
|
253
243
|
if (forced) {
|
|
@@ -780,8 +770,8 @@ class UIDCollection {
|
|
|
780
770
|
@name: commitQuorum
|
|
781
771
|
@desc: The `commitQuorum` argument for the orignal mongodb `createIndex()` function.
|
|
782
772
|
*/
|
|
783
|
-
async create_index(
|
|
784
|
-
return this._col.create_index(
|
|
773
|
+
async create_index(args) {
|
|
774
|
+
return this._col.create_index(args);
|
|
785
775
|
}
|
|
786
776
|
/* @docs:
|
|
787
777
|
* @title: Find
|
|
@@ -1170,11 +1160,11 @@ class Database {
|
|
|
1170
1160
|
preview: { type: "boolean", default: true },
|
|
1171
1161
|
preview_ip_whitelist: { type: "array", default: [] },
|
|
1172
1162
|
daemon: { type: ["object", "boolean"], default: {} },
|
|
1173
|
-
_server: "object",
|
|
1163
|
+
_server: { type: ["object", "undefined"] },
|
|
1174
1164
|
};
|
|
1175
1165
|
uri;
|
|
1176
|
-
preview;
|
|
1177
|
-
preview_ip_whitelist;
|
|
1166
|
+
// preview: boolean;
|
|
1167
|
+
// preview_ip_whitelist: string[];
|
|
1178
1168
|
client_opts;
|
|
1179
1169
|
config;
|
|
1180
1170
|
source; // Using vlib.Path type
|
|
@@ -1187,9 +1177,14 @@ class Database {
|
|
|
1187
1177
|
proc;
|
|
1188
1178
|
daemon;
|
|
1189
1179
|
db;
|
|
1190
|
-
|
|
1180
|
+
// System.
|
|
1181
|
+
_listed_cols;
|
|
1182
|
+
constructor({ uri = null, source = null, config = null, start_args = [], client = null, collections = [], uid_collections = [],
|
|
1183
|
+
// preview = true,
|
|
1184
|
+
// preview_ip_whitelist = [],
|
|
1185
|
+
daemon = {}, _server = undefined, }) {
|
|
1191
1186
|
// Checks.
|
|
1192
|
-
if (_server.is_primary && uri == null) {
|
|
1187
|
+
if (!_server || (_server.is_primary && uri == null)) {
|
|
1193
1188
|
({ uri, config, start_args, config, client } = _vinc_1.vlib.Scheme.verify({
|
|
1194
1189
|
object: arguments[0],
|
|
1195
1190
|
check_unknown: true,
|
|
@@ -1198,24 +1193,27 @@ class Database {
|
|
|
1198
1193
|
}
|
|
1199
1194
|
// Arguments.
|
|
1200
1195
|
this.uri = uri;
|
|
1201
|
-
this.preview = preview;
|
|
1202
|
-
this.preview_ip_whitelist = preview_ip_whitelist;
|
|
1196
|
+
// this.preview = preview;
|
|
1197
|
+
// this.preview_ip_whitelist = preview_ip_whitelist;
|
|
1203
1198
|
this.client_opts = client;
|
|
1204
1199
|
this.config = config || {};
|
|
1205
|
-
this.source = source != null ? new _vinc_1.vlib.Path(source) : _server
|
|
1200
|
+
this.source = source != null ? new _vinc_1.vlib.Path(source) : _server?.source.join(".db");
|
|
1206
1201
|
this.start_args = start_args;
|
|
1207
|
-
this._collections = collections;
|
|
1208
|
-
this._uid_collections = uid_collections;
|
|
1202
|
+
this._collections = collections ?? [];
|
|
1203
|
+
this._uid_collections = uid_collections ?? [];
|
|
1209
1204
|
this.server = _server;
|
|
1210
1205
|
// Attributes.
|
|
1211
1206
|
this.client = null;
|
|
1212
1207
|
this.collections = {};
|
|
1213
1208
|
// Initialize the service daemon.
|
|
1214
|
-
if (this.server
|
|
1209
|
+
if (this.server?.daemon && daemon !== false) {
|
|
1215
1210
|
const log_source = this.server.source.join(".logs");
|
|
1216
1211
|
if (!log_source.exists()) {
|
|
1217
1212
|
log_source.mkdir_sync();
|
|
1218
1213
|
}
|
|
1214
|
+
if (!this.server) {
|
|
1215
|
+
throw new Error("Parameter 'Database._server' must be defined for this behaviour.");
|
|
1216
|
+
}
|
|
1219
1217
|
this.daemon = new _vinc_1.vlib.Daemon({
|
|
1220
1218
|
name: this.server.daemon.name + ".mongodb",
|
|
1221
1219
|
user: daemon.user || this.server.daemon.user,
|
|
@@ -1231,9 +1229,9 @@ class Database {
|
|
|
1231
1229
|
});
|
|
1232
1230
|
}
|
|
1233
1231
|
}
|
|
1234
|
-
|
|
1235
|
-
_initialize_db_preview() {
|
|
1236
|
-
|
|
1232
|
+
/* Database preview.
|
|
1233
|
+
_initialize_db_preview(): void {
|
|
1234
|
+
|
|
1237
1235
|
if (this.preview && this.server.production === false) {
|
|
1238
1236
|
this.server.endpoint(
|
|
1239
1237
|
|
|
@@ -1758,8 +1756,7 @@ class Database {
|
|
|
1758
1756
|
},
|
|
1759
1757
|
)
|
|
1760
1758
|
}
|
|
1761
|
-
|
|
1762
|
-
}
|
|
1759
|
+
}*/
|
|
1763
1760
|
// Connect.
|
|
1764
1761
|
async connect() {
|
|
1765
1762
|
try {
|
|
@@ -1779,7 +1776,7 @@ class Database {
|
|
|
1779
1776
|
if (this.config.systemLog === undefined) {
|
|
1780
1777
|
this.config.systemLog = {};
|
|
1781
1778
|
}
|
|
1782
|
-
this.config.systemLog.path = this.source
|
|
1779
|
+
this.config.systemLog.path = this.source?.join("mongod.log").str();
|
|
1783
1780
|
if (this.config.systemLog.destination === undefined) {
|
|
1784
1781
|
this.config.systemLog.destination = "file";
|
|
1785
1782
|
}
|
|
@@ -1789,21 +1786,23 @@ class Database {
|
|
|
1789
1786
|
if (this.config.systemLog.logRotate === undefined) {
|
|
1790
1787
|
this.config.systemLog.logRotate = "reopen";
|
|
1791
1788
|
}
|
|
1792
|
-
if (this.config.systemLog.verbosity === undefined) {
|
|
1789
|
+
if (this.config.systemLog.verbosity === undefined && this.server) {
|
|
1793
1790
|
this.config.systemLog.verbosity = this.server.production ? 0 : 1;
|
|
1794
1791
|
}
|
|
1795
1792
|
if (this.config.storage === undefined) {
|
|
1796
1793
|
this.config.storage = {};
|
|
1797
1794
|
}
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
db_path.
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
this.config.processManagement
|
|
1795
|
+
if (this.source) {
|
|
1796
|
+
const db_path = this.source.join("db");
|
|
1797
|
+
this.config.storage.dbPath = db_path.str();
|
|
1798
|
+
if (!db_path.exists()) {
|
|
1799
|
+
db_path.mkdir_sync();
|
|
1800
|
+
}
|
|
1801
|
+
if (this.config.processManagement === undefined) {
|
|
1802
|
+
this.config.processManagement = {};
|
|
1803
|
+
}
|
|
1804
|
+
this.config.processManagement.pidFilePath = this.source.join("mongod.pid").str();
|
|
1805
1805
|
}
|
|
1806
|
-
this.config.processManagement.pidFilePath = this.source.join("mongod.pid").str();
|
|
1807
1806
|
if (this.config.net === undefined) {
|
|
1808
1807
|
this.config.net = {};
|
|
1809
1808
|
}
|
|
@@ -1814,7 +1813,7 @@ class Database {
|
|
|
1814
1813
|
this.config.net.bindIp = "127.0.0.1";
|
|
1815
1814
|
}
|
|
1816
1815
|
// Mode 2: Start database.
|
|
1817
|
-
if (this.server
|
|
1816
|
+
if (this.server?.is_primary && this.uri == null) {
|
|
1818
1817
|
// Create the database.
|
|
1819
1818
|
if (!this.source.exists()) {
|
|
1820
1819
|
this.source.mkdir_sync();
|
|
@@ -1844,7 +1843,7 @@ class Database {
|
|
|
1844
1843
|
});
|
|
1845
1844
|
}
|
|
1846
1845
|
// Assign URI.
|
|
1847
|
-
else if (!this.server.is_primary && this.uri == null) {
|
|
1846
|
+
else if (this.server && !this.server.is_primary && this.uri == null) {
|
|
1848
1847
|
this.uri = `mongodb://${this.config.net.bindIp}:${this.config.net.port}/main`;
|
|
1849
1848
|
}
|
|
1850
1849
|
// Initialize client.
|
|
@@ -1859,33 +1858,65 @@ class Database {
|
|
|
1859
1858
|
}
|
|
1860
1859
|
// Connect.
|
|
1861
1860
|
await this.connect();
|
|
1861
|
+
// Batch.
|
|
1862
|
+
const multiprocessing = true;
|
|
1863
|
+
const promises = [];
|
|
1862
1864
|
// Create collections.
|
|
1863
|
-
this._collections
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1865
|
+
for (const info of this._collections) {
|
|
1866
|
+
const promise = new Promise(resolve => {
|
|
1867
|
+
if (this[info.name] !== undefined) {
|
|
1868
|
+
throw Error(`Unable to initialize database collection "${info.name}", this attribute name is reserved for a system value.`);
|
|
1869
|
+
}
|
|
1870
|
+
if (Array.isArray(info.indexes)) {
|
|
1871
|
+
for (let index = 0; index < info.indexes.length; index++) {
|
|
1872
|
+
let item = info.indexes[index];
|
|
1873
|
+
if (typeof item === "string") {
|
|
1874
|
+
info.indexes[index] = item = { keys: [item] };
|
|
1875
|
+
}
|
|
1871
1876
|
}
|
|
1872
1877
|
}
|
|
1878
|
+
this.create_collection(info).then(data => {
|
|
1879
|
+
this[info.name] = data;
|
|
1880
|
+
resolve();
|
|
1881
|
+
});
|
|
1882
|
+
});
|
|
1883
|
+
if (multiprocessing) {
|
|
1884
|
+
promises.push(promise);
|
|
1873
1885
|
}
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
this._uid_collections.forEach((info) => {
|
|
1877
|
-
if (this[info.name] !== undefined) {
|
|
1878
|
-
throw Error(`Unable to initialize database collection "${info.name}", this attribute name is already used.`);
|
|
1886
|
+
else {
|
|
1887
|
+
await promise;
|
|
1879
1888
|
}
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1889
|
+
}
|
|
1890
|
+
for (const info of this._uid_collections) {
|
|
1891
|
+
const promise = new Promise(resolve => {
|
|
1892
|
+
if (this[info.name] !== undefined) {
|
|
1893
|
+
throw Error(`Unable to initialize database collection "${info.name}", this attribute name is reserved for a system value.`);
|
|
1894
|
+
}
|
|
1895
|
+
if (Array.isArray(info.indexes)) {
|
|
1896
|
+
for (let index = 0; index < info.indexes.length; index++) {
|
|
1897
|
+
let item = info.indexes[index];
|
|
1898
|
+
if (typeof item === "string") {
|
|
1899
|
+
info.indexes[index] = item = {
|
|
1900
|
+
key: item,
|
|
1901
|
+
};
|
|
1902
|
+
}
|
|
1884
1903
|
}
|
|
1885
1904
|
}
|
|
1905
|
+
this.create_uid_collection(info).then(data => {
|
|
1906
|
+
this[info.name] = data;
|
|
1907
|
+
resolve();
|
|
1908
|
+
});
|
|
1909
|
+
});
|
|
1910
|
+
if (multiprocessing) {
|
|
1911
|
+
promises.push(promise);
|
|
1886
1912
|
}
|
|
1887
|
-
|
|
1888
|
-
|
|
1913
|
+
else {
|
|
1914
|
+
await promise;
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
if (multiprocessing) {
|
|
1918
|
+
await Promise.all(promises);
|
|
1919
|
+
}
|
|
1889
1920
|
}
|
|
1890
1921
|
// Close.
|
|
1891
1922
|
async close() {
|
|
@@ -1896,7 +1927,7 @@ class Database {
|
|
|
1896
1927
|
* @title: Create Collection
|
|
1897
1928
|
* @description: Create a database collection.
|
|
1898
1929
|
*/
|
|
1899
|
-
create_collection(info) {
|
|
1930
|
+
async create_collection(info) {
|
|
1900
1931
|
// Set name by single string argument.
|
|
1901
1932
|
let name;
|
|
1902
1933
|
let indexes = [];
|
|
@@ -1913,6 +1944,17 @@ class Database {
|
|
|
1913
1944
|
if (name in this.collections) {
|
|
1914
1945
|
throw Error(`Collection "${name}" is already initialized.`);
|
|
1915
1946
|
}
|
|
1947
|
+
// Logs.
|
|
1948
|
+
logger_js_1.logger.log(1, log_source, `Initializing collection "${name}".`);
|
|
1949
|
+
// Check if the collection exists
|
|
1950
|
+
if (this._listed_cols == null) {
|
|
1951
|
+
this._listed_cols = await this.db.listCollections().toArray();
|
|
1952
|
+
}
|
|
1953
|
+
if (!this._listed_cols.find(x => x.name === name)) {
|
|
1954
|
+
logger_js_1.logger.log(0, log_source, `Creating collection "${name}".`);
|
|
1955
|
+
await this.db.createCollection(name);
|
|
1956
|
+
}
|
|
1957
|
+
// Create collection.
|
|
1916
1958
|
const col = new Collection(name, this.db.collection(name), ttl, indexes);
|
|
1917
1959
|
this.collections[name] = col;
|
|
1918
1960
|
return col;
|
|
@@ -1921,7 +1963,7 @@ class Database {
|
|
|
1921
1963
|
* @title: Create UID Based Collection
|
|
1922
1964
|
* @description: Create a UID based database collection.
|
|
1923
1965
|
*/
|
|
1924
|
-
create_uid_collection(info) {
|
|
1966
|
+
async create_uid_collection(info) {
|
|
1925
1967
|
// Set name by single string argument.
|
|
1926
1968
|
let name;
|
|
1927
1969
|
let indexes = [];
|
|
@@ -1934,10 +1976,19 @@ class Database {
|
|
|
1934
1976
|
indexes = info.indexes || [];
|
|
1935
1977
|
ttl = info.ttl || null;
|
|
1936
1978
|
}
|
|
1937
|
-
// Check collection.
|
|
1979
|
+
// Check duplicate collection.
|
|
1938
1980
|
if (name in this.collections) {
|
|
1939
1981
|
throw Error(`Collection "${name}" is already initialized.`);
|
|
1940
1982
|
}
|
|
1983
|
+
// Logs.
|
|
1984
|
+
logger_js_1.logger.log(1, log_source, `Initializing uid collection "${name}".`);
|
|
1985
|
+
// Check if the collection exists
|
|
1986
|
+
const collections = await this.db.listCollections({ name: name }).toArray();
|
|
1987
|
+
if (collections.length === 0) {
|
|
1988
|
+
logger_js_1.logger.log(0, log_source, `Creating uid collection "${name}".`);
|
|
1989
|
+
await this.db.createCollection(name);
|
|
1990
|
+
}
|
|
1991
|
+
// Collection.
|
|
1941
1992
|
const col = new UIDCollection(name, this.db.collection(name), indexes, ttl);
|
|
1942
1993
|
this.collections[name] = col;
|
|
1943
1994
|
return col;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { View } from './view.js';
|
|
2
2
|
import { RateLimitGroup } from "./rate_limit.js";
|
|
3
3
|
import { Stream, AuthStream, Params } from "./stream.js";
|
|
4
|
+
import type { Server } from "./server.js";
|
|
4
5
|
type EndpointCallback = ((stream: Stream, params: Params) => any) | ((stream: AuthStream, params: Params) => any);
|
|
5
|
-
|
|
6
|
+
interface BaseEndpointOptions {
|
|
6
7
|
method?: string;
|
|
7
8
|
endpoint: string | RegExp;
|
|
8
9
|
authenticated?: boolean;
|
|
9
10
|
rate_limit?: string | RateLimitGroup | RateLimitGroup[] | null;
|
|
10
11
|
params?: Record<string, any> | null;
|
|
11
12
|
callback?: EndpointCallback;
|
|
12
|
-
view?: View | Record<string, any> | null;
|
|
13
13
|
data?: any;
|
|
14
|
-
|
|
15
|
-
compress?: boolean;
|
|
14
|
+
compress?: "auto" | boolean;
|
|
16
15
|
cache?: boolean | number;
|
|
17
16
|
ip_whitelist?: string[] | null;
|
|
18
17
|
sitemap?: boolean | null;
|
|
@@ -21,15 +20,25 @@ export interface EndpointOptions {
|
|
|
21
20
|
_path?: string | null;
|
|
22
21
|
_is_static?: boolean;
|
|
23
22
|
}
|
|
23
|
+
interface EndpointOptionsWithView extends Omit<BaseEndpointOptions, "content_type" | "view"> {
|
|
24
|
+
view: View | Record<string, any>;
|
|
25
|
+
content_type?: string;
|
|
26
|
+
}
|
|
27
|
+
interface EndpointOptionsWithoutView extends BaseEndpointOptions {
|
|
28
|
+
view?: null | undefined;
|
|
29
|
+
content_type: string;
|
|
30
|
+
}
|
|
31
|
+
export type EndpointOptions = EndpointOptionsWithView | EndpointOptionsWithoutView;
|
|
24
32
|
declare class Endpoint {
|
|
25
33
|
static rate_limits: Map<string, any>;
|
|
34
|
+
static compressed_content_types: string[];
|
|
26
35
|
method: string;
|
|
27
36
|
endpoint: string | RegExp;
|
|
28
37
|
authenticated: boolean;
|
|
29
38
|
params: Record<string, any> | null;
|
|
30
39
|
callback?: EndpointCallback;
|
|
31
40
|
data: any;
|
|
32
|
-
content_type
|
|
41
|
+
content_type?: string;
|
|
33
42
|
compress: boolean;
|
|
34
43
|
cache: boolean | number;
|
|
35
44
|
sitemap: boolean | null;
|
|
@@ -46,12 +55,17 @@ declare class Endpoint {
|
|
|
46
55
|
raw_data?: any;
|
|
47
56
|
content_length?: number;
|
|
48
57
|
is_image_endpoint?: boolean;
|
|
49
|
-
|
|
50
|
-
|
|
58
|
+
_initialized: boolean;
|
|
59
|
+
_server: any;
|
|
60
|
+
constructor({ method, endpoint, authenticated, rate_limit, params, callback, view, data, content_type, // = "text/plain",
|
|
61
|
+
compress, cache, ip_whitelist, sitemap, robots, _templates, // only used in loading static files.
|
|
62
|
+
_path, _is_static, _server, }: EndpointOptions & {
|
|
63
|
+
_server: Server;
|
|
64
|
+
});
|
|
51
65
|
_load_data_by_path(server: any): this;
|
|
52
66
|
_set_headers(stream: any): void;
|
|
53
67
|
_refresh(server: any): Promise<void>;
|
|
54
|
-
|
|
55
|
-
_serve(stream:
|
|
68
|
+
_dynamic_initialize(): Promise<void>;
|
|
69
|
+
_serve(stream: Stream, status_code?: number): Promise<void>;
|
|
56
70
|
}
|
|
57
71
|
export { Endpoint };
|