nesoi 3.0.0 → 3.0.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 +10 -0
- package/lib/adapters/postgres/src/migrator/bucket.d.ts +20 -0
- package/lib/adapters/postgres/src/migrator/bucket.js +184 -0
- package/lib/adapters/postgres/src/migrator/csv.d.ts +7 -0
- package/lib/adapters/postgres/src/migrator/csv.js +72 -0
- package/lib/adapters/postgres/src/migrator/migration.d.ts +2 -18
- package/lib/adapters/postgres/src/migrator/migration.js +10 -158
- package/lib/adapters/postgres/src/migrator/migrator.js +8 -5
- package/lib/adapters/postgres/src/migrator/runner.d.ts +16 -6
- package/lib/adapters/postgres/src/migrator/runner.js +103 -34
- package/lib/adapters/postgres/src/postgres.bucket_adapter.d.ts +19 -22
- package/lib/adapters/postgres/src/postgres.bucket_adapter.js +116 -100
- package/lib/adapters/postgres/src/postgres.cli.d.ts +23 -3
- package/lib/adapters/postgres/src/postgres.cli.js +70 -10
- package/lib/adapters/postgres/src/postgres.config.d.ts +5 -0
- package/lib/adapters/postgres/src/postgres.config.js +2 -0
- package/lib/adapters/postgres/src/postgres.nql.d.ts +7 -3
- package/lib/adapters/postgres/src/postgres.nql.js +86 -32
- package/lib/adapters/postgres/src/postgres.provider.d.ts +18 -0
- package/lib/adapters/postgres/src/postgres.provider.js +77 -0
- package/lib/adapters/postgres/test/postgres.bucket_adapter.test.js +76 -39
- package/lib/compiler/apps/monolyth/monolyth_compiler.d.ts +3 -0
- package/lib/compiler/apps/monolyth/monolyth_compiler.js +24 -0
- package/lib/compiler/apps/monolyth/stages/2_build_typescript_stage.js +2 -1
- package/lib/compiler/apps/monolyth/stages/5_dump_cli_stage.js +1 -1
- package/lib/compiler/elements/bucket.element.js +26 -11
- package/lib/compiler/elements/constants.element.js +1 -1
- package/lib/compiler/elements/element.d.ts +2 -0
- package/lib/compiler/elements/message.element.js +4 -4
- package/lib/compiler/helpers/dump_helpers.js +5 -2
- package/lib/compiler/stages/7_dump_stage.js +2 -0
- package/lib/compiler/treeshake.js +9 -37
- package/lib/compiler/typescript/bridge/extract.js +12 -0
- package/lib/compiler/typescript/bridge/inject.js +3 -0
- package/lib/compiler/typescript/bridge/organize.js +3 -3
- package/lib/elements/blocks/block.builder.js +4 -2
- package/lib/elements/blocks/job/internal/resource_job.builder.d.ts +22 -20
- package/lib/elements/blocks/job/internal/resource_job.d.ts +2 -1
- package/lib/elements/blocks/job/internal/resource_job.js +17 -4
- package/lib/elements/blocks/job/job.js +3 -0
- package/lib/elements/blocks/job/job.types.d.ts +7 -0
- package/lib/elements/blocks/job/job.types.js +2 -0
- package/lib/elements/blocks/machine/machine.js +3 -2
- package/lib/elements/blocks/resource/resource.builder.js +2 -4
- package/lib/elements/blocks/resource/resource.d.ts +5 -3
- package/lib/elements/blocks/resource/resource.js +26 -17
- package/lib/elements/edge/controller/adapters/controller_adapter.d.ts +2 -1
- package/lib/elements/edge/controller/adapters/controller_adapter.js +11 -2
- package/lib/elements/edge/controller/controller.builder.d.ts +4 -5
- package/lib/elements/edge/controller/controller.builder.js +7 -7
- package/lib/elements/edge/controller/controller.d.ts +2 -1
- package/lib/elements/edge/controller/controller.js +8 -6
- package/lib/elements/entities/bucket/adapters/bucket_adapter.d.ts +61 -23
- package/lib/elements/entities/bucket/adapters/bucket_adapter.js +22 -13
- package/lib/elements/entities/bucket/adapters/memory.bucket_adapter.d.ts +21 -22
- package/lib/elements/entities/bucket/adapters/memory.bucket_adapter.js +68 -2
- package/lib/elements/entities/bucket/adapters/memory.nql.d.ts +10 -6
- package/lib/elements/entities/bucket/adapters/memory.nql.js +38 -3
- package/lib/elements/entities/bucket/adapters/slow_memory.bucket_adapter.d.ts +0 -20
- package/lib/elements/entities/bucket/adapters/slow_memory.bucket_adapter.js +46 -30
- package/lib/elements/entities/bucket/bucket.builder.d.ts +8 -2
- package/lib/elements/entities/bucket/bucket.builder.js +13 -19
- package/lib/elements/entities/bucket/bucket.config.d.ts +5 -1
- package/lib/elements/entities/bucket/bucket.d.ts +180 -19
- package/lib/elements/entities/bucket/bucket.js +658 -48
- package/lib/elements/entities/bucket/bucket.schema.d.ts +7 -1
- package/lib/elements/entities/bucket/bucket.schema.js +2 -1
- package/lib/elements/entities/bucket/bucket.types.d.ts +2 -7
- package/lib/elements/entities/bucket/cache/bucket_cache.d.ts +6 -2
- package/lib/elements/entities/bucket/cache/bucket_cache.js +12 -12
- package/lib/elements/entities/bucket/graph/bucket_graph.d.ts +32 -5
- package/lib/elements/entities/bucket/graph/bucket_graph.js +80 -111
- package/lib/elements/entities/bucket/graph/bucket_graph.schema.d.ts +3 -6
- package/lib/elements/entities/bucket/graph/bucket_graph.schema.js +1 -4
- package/lib/elements/entities/bucket/graph/bucket_graph_link.builder.d.ts +3 -7
- package/lib/elements/entities/bucket/graph/bucket_graph_link.builder.js +6 -2
- package/lib/elements/entities/bucket/model/bucket_model.builder.js +1 -1
- package/lib/elements/entities/bucket/model/bucket_model.convert.js +3 -3
- package/lib/elements/entities/bucket/model/bucket_model.schema.d.ts +37 -8
- package/lib/elements/entities/bucket/model/bucket_model.schema.js +25 -4
- package/lib/elements/entities/bucket/model/bucket_model_field.builder.d.ts +33 -14
- package/lib/elements/entities/bucket/model/bucket_model_field.builder.js +56 -13
- package/lib/elements/entities/bucket/query/nql.schema.d.ts +1 -0
- package/lib/elements/entities/bucket/query/nql_compiler.js +13 -2
- package/lib/elements/entities/bucket/query/nql_engine.d.ts +11 -4
- package/lib/elements/entities/bucket/query/nql_engine.js +20 -11
- package/lib/elements/entities/bucket/view/bucket_view.js +63 -35
- package/lib/elements/entities/bucket/view/bucket_view.schema.d.ts +5 -2
- package/lib/elements/entities/bucket/view/bucket_view_field.builder.d.ts +6 -2
- package/lib/elements/entities/bucket/view/bucket_view_field.builder.js +21 -15
- package/lib/elements/entities/constants/constants.schema.d.ts +1 -1
- package/lib/elements/entities/drive/drive_adapter.d.ts +36 -0
- package/lib/elements/entities/drive/drive_adapter.js +10 -0
- package/lib/elements/entities/drive/local.drive_adapter.d.ts +8 -0
- package/lib/elements/entities/drive/local.drive_adapter.js +28 -0
- package/lib/elements/entities/message/message.schema.d.ts +1 -0
- package/lib/elements/entities/message/message.schema.js +33 -0
- package/lib/elements/entities/message/message_parser.d.ts +5 -1
- package/lib/elements/entities/message/message_parser.js +56 -35
- package/lib/elements/entities/message/template/message_template.schema.d.ts +10 -8
- package/lib/elements/entities/message/template/message_template_field.builder.d.ts +16 -6
- package/lib/elements/entities/message/template/message_template_field.builder.js +25 -0
- package/lib/elements/entities/message/template/message_template_parser.js +2 -1
- package/lib/engine/apps/app.config.d.ts +32 -11
- package/lib/engine/apps/app.config.js +12 -0
- package/lib/engine/apps/app.d.ts +2 -0
- package/lib/engine/apps/app.js +3 -0
- package/lib/engine/apps/inline.app.d.ts +5 -3
- package/lib/engine/apps/inline.app.js +27 -12
- package/lib/engine/apps/monolyth/monolyth.app.d.ts +4 -2
- package/lib/engine/apps/monolyth/monolyth.app.js +22 -10
- package/lib/engine/auth/authn.d.ts +5 -1
- package/lib/engine/auth/zero.authn_provider.d.ts +4 -2
- package/lib/engine/auth/zero.authn_provider.js +2 -2
- package/lib/engine/cli/cli.d.ts +3 -1
- package/lib/engine/cli/cli.js +22 -3
- package/lib/engine/cli/cli_adapter.d.ts +2 -1
- package/lib/engine/cli/cli_adapter.js +2 -1
- package/lib/engine/cli/cli_input.d.ts +19 -0
- package/lib/engine/cli/cli_input.js +207 -0
- package/lib/engine/cli/ui.d.ts +1 -1
- package/lib/engine/cli/ui.js +2 -2
- package/lib/engine/daemon.d.ts +3 -2
- package/lib/engine/daemon.js +14 -2
- package/lib/engine/data/date.js +2 -2
- package/lib/engine/data/datetime.d.ts +40 -4
- package/lib/engine/data/datetime.js +70 -11
- package/lib/engine/data/decimal.d.ts +1 -1
- package/lib/engine/data/decimal.js +3 -3
- package/lib/engine/data/error.d.ts +21 -4
- package/lib/engine/data/error.js +23 -7
- package/lib/engine/data/file.d.ts +23 -0
- package/lib/engine/data/file.js +53 -0
- package/lib/engine/data/json.d.ts +6 -0
- package/lib/engine/data/json.js +26 -0
- package/lib/engine/data/obj.d.ts +1 -1
- package/lib/engine/data/trash.d.ts +14 -0
- package/lib/engine/data/trash.js +2 -0
- package/lib/engine/data/tree.d.ts +7 -12
- package/lib/engine/data/tree.js +101 -49
- package/lib/engine/module.d.ts +2 -1
- package/lib/engine/module.js +2 -5
- package/lib/engine/space.d.ts +1 -0
- package/lib/engine/space.js +6 -0
- package/lib/engine/transaction/nodes/bucket.trx_node.d.ts +156 -24
- package/lib/engine/transaction/nodes/bucket.trx_node.js +297 -467
- package/lib/engine/transaction/nodes/bucket_query.trx_node.d.ts +4 -2
- package/lib/engine/transaction/nodes/bucket_query.trx_node.js +27 -15
- package/lib/engine/transaction/nodes/job.trx_node.d.ts +2 -1
- package/lib/engine/transaction/nodes/job.trx_node.js +6 -0
- package/lib/engine/transaction/trx.d.ts +5 -2
- package/lib/engine/transaction/trx.js +2 -2
- package/lib/engine/transaction/trx_engine.config.d.ts +1 -3
- package/lib/engine/transaction/trx_engine.d.ts +2 -2
- package/lib/engine/transaction/trx_engine.js +14 -11
- package/lib/engine/transaction/trx_node.d.ts +14 -4
- package/lib/engine/transaction/trx_node.js +50 -8
- package/lib/engine/tree.d.ts +1 -1
- package/lib/engine/util/crypto.d.ts +50 -0
- package/lib/engine/util/crypto.js +89 -0
- package/lib/engine/util/deep.d.ts +5 -0
- package/lib/engine/util/deep.js +46 -0
- package/lib/engine/util/dotenv.d.ts +2 -8
- package/lib/engine/util/dotenv.js +14 -36
- package/lib/engine/util/hash.d.ts +3 -0
- package/lib/engine/util/hash.js +23 -0
- package/lib/engine/util/log.js +1 -1
- package/lib/engine/util/mime.d.ts +10 -0
- package/lib/engine/util/mime.js +389 -0
- package/lib/engine/util/parse.d.ts +6 -5
- package/lib/engine/util/parse.js +16 -15
- package/lib/engine/util/path.d.ts +3 -0
- package/lib/engine/util/path.js +92 -0
- package/lib/engine/util/rules.d.ts +4 -0
- package/lib/engine/util/rules.js +12 -0
- package/package.json +1 -1
- package/tools/compile.js +2 -2
- package/tools/dotenv.d.ts +1 -0
- package/tools/dotenv.js +4 -0
- package/tools/joaquin/job.d.ts +5 -5
- package/tools/joaquin/mock.d.ts +23 -2
- package/tools/joaquin/mock.js +127 -21
- package/tsconfig.build.tsbuildinfo +1 -1
- package/lib/adapters/postgres/test/postgres.bucket_query.test.d.ts +0 -0
- package/lib/adapters/postgres/test/postgres.bucket_query.test.js +0 -136
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AppConfigFactory = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Factory
|
|
6
|
+
*/
|
|
4
7
|
class AppConfigFactory {
|
|
5
8
|
constructor(app) {
|
|
6
9
|
this.app = app;
|
|
@@ -18,10 +21,19 @@ class AppConfigFactory {
|
|
|
18
21
|
this.config.buckets = config;
|
|
19
22
|
return this.app;
|
|
20
23
|
}
|
|
24
|
+
trash(config) {
|
|
25
|
+
// TODO
|
|
26
|
+
// this.config.buckets = config as never;
|
|
27
|
+
return this.app;
|
|
28
|
+
}
|
|
21
29
|
controllers(config) {
|
|
22
30
|
this.config.controllers = config;
|
|
23
31
|
return this.app;
|
|
24
32
|
}
|
|
33
|
+
audit(config) {
|
|
34
|
+
this.config.i18n = config;
|
|
35
|
+
return this.app;
|
|
36
|
+
}
|
|
25
37
|
compiler(config) {
|
|
26
38
|
this.config.compiler = config;
|
|
27
39
|
return this.app;
|
package/lib/engine/apps/app.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export type AppProvider<out Name, T> = {
|
|
|
12
12
|
modules: Record<string, AnyModule>;
|
|
13
13
|
}) => T;
|
|
14
14
|
down: (provider: NoInfer<T>) => any;
|
|
15
|
+
libPaths?: string[];
|
|
15
16
|
};
|
|
16
17
|
export type AnyAppProvider = AppProvider<any, any>;
|
|
17
18
|
export declare abstract class App<S extends $Space, Modules extends string = ModuleName<S> & string, Providers extends Record<string, any> = Record<string, any>> {
|
|
@@ -62,6 +63,7 @@ export declare abstract class App<S extends $Space, Modules extends string = Mod
|
|
|
62
63
|
provider<Name extends string, T>($: AppProvider<Name, T>): App<S, Modules, Providers & { [K in Name]: T; }>;
|
|
63
64
|
get config(): AppConfigFactory<S, Modules, Providers>;
|
|
64
65
|
protected makeModules(): Record<string, AnyModule>;
|
|
66
|
+
static getProviders(app: AnyApp): Record<string, AnyAppProvider>;
|
|
65
67
|
static getInfo(app: AnyApp): {
|
|
66
68
|
spaceModules: (string | number | symbol)[];
|
|
67
69
|
config: AnyAppConfig;
|
package/lib/engine/apps/app.js
CHANGED
|
@@ -3,14 +3,13 @@ import { App, AppProvider } from './app';
|
|
|
3
3
|
import { AnyTrxEngine } from '../transaction/trx_engine';
|
|
4
4
|
import { AnyBuilder, AnyModule, Module } from '../module';
|
|
5
5
|
import { AnyDaemon, Daemon } from '../daemon';
|
|
6
|
+
import { AppConfigFactory } from './app.config';
|
|
6
7
|
export declare class InlineApp<S extends $Space, ModuleNames extends string = ModuleName<S> & string, Providers extends Record<string, any> = Record<string, any>> extends App<S, ModuleNames, Providers> {
|
|
7
8
|
protected _daemon?: Daemon<S, ModuleNames>;
|
|
8
9
|
protected _modules: Record<string, AnyModule>;
|
|
9
10
|
private packageJson?;
|
|
10
|
-
|
|
11
|
+
protected bootPromise?: Promise<void>;
|
|
11
12
|
constructor(name: string, builders: AnyBuilder[]);
|
|
12
|
-
modules<M extends ModuleName<S>>(modules: M[]): InlineApp<S, M & ModuleNames>;
|
|
13
|
-
provider<Name extends string, T>($: AppProvider<Name, T>): InlineApp<S, ModuleNames, Providers & { [K in Name]: T; }>;
|
|
14
13
|
boot(): InlineApp<S, ModuleNames, Providers>;
|
|
15
14
|
/**
|
|
16
15
|
* Treeshake and build modules declared for this application.
|
|
@@ -35,6 +34,9 @@ export declare class InlineApp<S extends $Space, ModuleNames extends string = Mo
|
|
|
35
34
|
* TODO: allow overriding this behavior with adapters
|
|
36
35
|
*/
|
|
37
36
|
protected linkExternals(modules: Record<string, Module<S, $Module>>): void;
|
|
37
|
+
modules<M extends ModuleName<S>>(modules: M[]): InlineApp<S, M & ModuleNames>;
|
|
38
|
+
provider<Name extends string, T>($: AppProvider<Name, T>): InlineApp<S, ModuleNames, Providers & { [K in Name]: T; }>;
|
|
39
|
+
get config(): AppConfigFactory<S, ModuleNames, Providers, typeof this>;
|
|
38
40
|
static package(app: InlineApp<any, any>, scripts: Record<string, string>, dependencies: Record<string, string>): {
|
|
39
41
|
name: string;
|
|
40
42
|
version: string;
|
|
@@ -6,20 +6,12 @@ const log_1 = require("../util/log");
|
|
|
6
6
|
const trx_engine_1 = require("../transaction/trx_engine");
|
|
7
7
|
const tree_1 = require("../tree");
|
|
8
8
|
const daemon_1 = require("../daemon");
|
|
9
|
+
const app_config_1 = require("./app.config");
|
|
9
10
|
class InlineApp extends app_1.App {
|
|
10
11
|
constructor(name, builders) {
|
|
11
12
|
super(name, { builders });
|
|
12
13
|
this._modules = {};
|
|
13
14
|
}
|
|
14
|
-
// Type Builder Overrides
|
|
15
|
-
modules(modules) {
|
|
16
|
-
super.modules(modules);
|
|
17
|
-
return this;
|
|
18
|
-
}
|
|
19
|
-
provider($) {
|
|
20
|
-
super.provider($);
|
|
21
|
-
return this;
|
|
22
|
-
}
|
|
23
15
|
// App abstract methods
|
|
24
16
|
boot() {
|
|
25
17
|
if (!this.bootPromise) {
|
|
@@ -58,13 +50,16 @@ class InlineApp extends app_1.App {
|
|
|
58
50
|
}
|
|
59
51
|
const modules = this._modules;
|
|
60
52
|
for (const key in this._injectedModules) {
|
|
61
|
-
|
|
53
|
+
const mod = this._injectedModules[key];
|
|
54
|
+
modules[mod.name] = mod;
|
|
62
55
|
}
|
|
63
56
|
const providers = {};
|
|
64
57
|
for (const key in this._providers) {
|
|
65
|
-
|
|
58
|
+
const provider = this._providers[key].up({
|
|
66
59
|
modules
|
|
67
60
|
});
|
|
61
|
+
provider.__down = this._providers[key].down;
|
|
62
|
+
providers[key] = provider;
|
|
68
63
|
}
|
|
69
64
|
log_1.Log.debug('app', this.name, 'Starting transaction engines');
|
|
70
65
|
const trxEngines = {};
|
|
@@ -72,7 +67,14 @@ class InlineApp extends app_1.App {
|
|
|
72
67
|
const module = modules[m];
|
|
73
68
|
module.start(this, providers);
|
|
74
69
|
const trxConfig = this._config.trxEngine?.[m];
|
|
75
|
-
|
|
70
|
+
const authn = {};
|
|
71
|
+
for (const a in this._config?.authn || {}) {
|
|
72
|
+
const prov = this._config.authn?.[a]?.();
|
|
73
|
+
if (prov) {
|
|
74
|
+
authn[a] = prov;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
trxEngines[m] = new trx_engine_1.TrxEngine(`app:${this.name}`, module, authn, trxConfig, providers);
|
|
76
78
|
}
|
|
77
79
|
log_1.Log.debug('app', this.name, 'Linking externals');
|
|
78
80
|
this.linkExternals(modules);
|
|
@@ -114,6 +116,7 @@ class InlineApp extends app_1.App {
|
|
|
114
116
|
const buckets = module.schema.externals.buckets;
|
|
115
117
|
Object.values(buckets).forEach(bucket => {
|
|
116
118
|
module.buckets[bucket.refName] = modules[bucket.module].buckets[bucket.name];
|
|
119
|
+
module.nql.linkExternal(modules[bucket.module].buckets[bucket.name]);
|
|
117
120
|
});
|
|
118
121
|
const jobs = module.schema.externals.jobs;
|
|
119
122
|
Object.values(jobs).forEach(job => {
|
|
@@ -125,6 +128,18 @@ class InlineApp extends app_1.App {
|
|
|
125
128
|
});
|
|
126
129
|
});
|
|
127
130
|
}
|
|
131
|
+
// Type Builder Overrides
|
|
132
|
+
modules(modules) {
|
|
133
|
+
super.modules(modules);
|
|
134
|
+
return this;
|
|
135
|
+
}
|
|
136
|
+
provider($) {
|
|
137
|
+
super.provider($);
|
|
138
|
+
return this;
|
|
139
|
+
}
|
|
140
|
+
get config() {
|
|
141
|
+
return new app_config_1.AppConfigFactory(this);
|
|
142
|
+
}
|
|
128
143
|
//
|
|
129
144
|
static package(app, scripts, dependencies) {
|
|
130
145
|
return {
|
|
@@ -4,17 +4,19 @@ import { InlineApp } from './../inline.app';
|
|
|
4
4
|
import { AnyTrxEngine } from '../../transaction/trx_engine';
|
|
5
5
|
import { Space } from '../../space';
|
|
6
6
|
import { Daemon } from "../../daemon";
|
|
7
|
+
import { AppConfigFactory } from '../app.config';
|
|
7
8
|
export declare class MonolythApp<S extends $Space, ModuleNames extends string = ModuleName<S> & string, Providers extends Record<string, any> = Record<string, any>> extends InlineApp<S, ModuleNames, Providers> {
|
|
8
9
|
private watcher?;
|
|
9
10
|
constructor(name: string, space?: Space<S>);
|
|
10
11
|
protected _packageJson?: Record<string, any>;
|
|
11
|
-
modules<M extends ModuleName<S>>(modules: M[]): MonolythApp<S, M & ModuleNames>;
|
|
12
|
-
provider<Name extends string, T>($: AppProvider<Name, T>): MonolythApp<S, ModuleNames, Providers & { [K in Name]: T; }>;
|
|
13
12
|
daemon($?: {
|
|
14
13
|
watch?: boolean;
|
|
15
14
|
}): Promise<Daemon<S, ModuleNames>>;
|
|
16
15
|
protected makeDaemon(trxEngines: Record<ModuleNames, AnyTrxEngine>, providers: Record<string, any>): MonolythDaemon<$Space, ModuleNames>;
|
|
17
16
|
remake(): Promise<void>;
|
|
17
|
+
modules<M extends ModuleName<S>>(modules: M[]): MonolythApp<S, M & ModuleNames>;
|
|
18
|
+
provider<Name extends string, T>($: AppProvider<Name, T>): MonolythApp<S, ModuleNames, Providers & { [K in Name]: T; }>;
|
|
19
|
+
get config(): AppConfigFactory<S, ModuleNames, Providers, typeof this>;
|
|
18
20
|
}
|
|
19
21
|
export declare class MonolythDaemon<S extends $Space, Modules extends ModuleName<S>> extends Daemon<S, Modules> {
|
|
20
22
|
}
|
|
@@ -38,21 +38,13 @@ const inline_app_1 = require("./../inline.app");
|
|
|
38
38
|
const space_1 = require("../../space");
|
|
39
39
|
const daemon_1 = require("../../daemon");
|
|
40
40
|
const log_1 = require("../../util/log");
|
|
41
|
+
const app_config_1 = require("../app.config");
|
|
41
42
|
class MonolythApp extends inline_app_1.InlineApp {
|
|
42
43
|
constructor(name, space) {
|
|
43
44
|
super(name, []);
|
|
44
45
|
this.builders = undefined;
|
|
45
46
|
this.space = space;
|
|
46
47
|
}
|
|
47
|
-
// Type Builder Overrides
|
|
48
|
-
modules(modules) {
|
|
49
|
-
super.modules(modules);
|
|
50
|
-
return this;
|
|
51
|
-
}
|
|
52
|
-
provider($) {
|
|
53
|
-
super.provider($);
|
|
54
|
-
return this;
|
|
55
|
-
}
|
|
56
48
|
// Override InlineApp abstract methods
|
|
57
49
|
async daemon($) {
|
|
58
50
|
/**
|
|
@@ -65,7 +57,13 @@ class MonolythApp extends inline_app_1.InlineApp {
|
|
|
65
57
|
*/
|
|
66
58
|
if (this.space && $?.watch) {
|
|
67
59
|
Promise.resolve().then(() => __importStar(require('chokidar'))).then(({ default: chokidar }) => {
|
|
68
|
-
this.watcher = chokidar.watch(space_1.Space.path(this.space,
|
|
60
|
+
this.watcher = chokidar.watch(space_1.Space.path(this.space), {
|
|
61
|
+
ignored: [
|
|
62
|
+
space_1.Space.path(this.space, 'node_modules'),
|
|
63
|
+
space_1.Space.path(this.space, '.nesoi'),
|
|
64
|
+
space_1.Space.path(this.space, 'build')
|
|
65
|
+
]
|
|
66
|
+
}); // TODO: change to .
|
|
69
67
|
this.watcher
|
|
70
68
|
.on('change', () => {
|
|
71
69
|
this.remake();
|
|
@@ -84,9 +82,23 @@ class MonolythApp extends inline_app_1.InlineApp {
|
|
|
84
82
|
log_1.Log.error('app', 'monolyth', `Attempt to remake app ${this.name} failed: Daemon not running.`);
|
|
85
83
|
return;
|
|
86
84
|
}
|
|
85
|
+
await daemon_1.Daemon.destroy(this._daemon);
|
|
86
|
+
this.bootPromise = undefined;
|
|
87
87
|
const app = await this.make();
|
|
88
88
|
await daemon_1.Daemon.reload(this._daemon, app.trxEngines, app.providers);
|
|
89
89
|
}
|
|
90
|
+
// Type Builder Overrides
|
|
91
|
+
modules(modules) {
|
|
92
|
+
super.modules(modules);
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
95
|
+
provider($) {
|
|
96
|
+
super.provider($);
|
|
97
|
+
return this;
|
|
98
|
+
}
|
|
99
|
+
get config() {
|
|
100
|
+
return new app_config_1.AppConfigFactory(this);
|
|
101
|
+
}
|
|
90
102
|
}
|
|
91
103
|
exports.MonolythApp = MonolythApp;
|
|
92
104
|
class MonolythDaemon extends daemon_1.Daemon {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NesoiObjId } from '../data/obj';
|
|
2
|
+
import { AnyTrxNode } from '../transaction/trx_node';
|
|
2
3
|
export type User = {
|
|
3
4
|
id: NesoiObjId;
|
|
4
5
|
[x: string]: any;
|
|
@@ -8,7 +9,10 @@ export type AuthnRequest<P extends keyof any> = {
|
|
|
8
9
|
[K in P]?: AuthnToken;
|
|
9
10
|
};
|
|
10
11
|
export declare abstract class AuthnProvider<U extends User> {
|
|
11
|
-
abstract authenticate(
|
|
12
|
+
abstract authenticate($: {
|
|
13
|
+
trx: AnyTrxNode;
|
|
14
|
+
token: AuthnToken;
|
|
15
|
+
}): Promise<U>;
|
|
12
16
|
}
|
|
13
17
|
export type AnyAuthnProviders = {
|
|
14
18
|
[K: string]: AuthnProvider<any>;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { NesoiObjId } from '../data/obj';
|
|
2
|
-
import { AuthnProvider
|
|
2
|
+
import { AuthnProvider } from './authn';
|
|
3
3
|
type ZeroUser = {
|
|
4
4
|
id: NesoiObjId;
|
|
5
5
|
name: string;
|
|
6
6
|
};
|
|
7
7
|
export declare class ZeroAuthnProvider extends AuthnProvider<ZeroUser> {
|
|
8
|
-
authenticate(
|
|
8
|
+
authenticate($: {
|
|
9
|
+
token: string;
|
|
10
|
+
}): Promise<{
|
|
9
11
|
id: number;
|
|
10
12
|
name: string;
|
|
11
13
|
}>;
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ZeroAuthnProvider = void 0;
|
|
4
4
|
const authn_1 = require("./authn");
|
|
5
5
|
class ZeroAuthnProvider extends authn_1.AuthnProvider {
|
|
6
|
-
|
|
6
|
+
authenticate($) {
|
|
7
7
|
return Promise.resolve({
|
|
8
8
|
id: 0,
|
|
9
|
-
name:
|
|
9
|
+
name: $.token
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
}
|
package/lib/engine/cli/cli.d.ts
CHANGED
|
@@ -11,9 +11,11 @@ export declare class CLI {
|
|
|
11
11
|
private app;
|
|
12
12
|
private ctx;
|
|
13
13
|
private adapters;
|
|
14
|
+
private input;
|
|
14
15
|
constructor(daemon: AnyDaemon, config?: CLIConfig<any> | undefined);
|
|
15
|
-
run(): Promise<void>;
|
|
16
|
+
run(cmd?: string): Promise<void>;
|
|
16
17
|
private runCmd;
|
|
17
18
|
private cmdHelp;
|
|
18
19
|
private cmdClear;
|
|
20
|
+
private getCmds;
|
|
19
21
|
}
|
package/lib/engine/cli/cli.js
CHANGED
|
@@ -9,6 +9,7 @@ const ui_1 = __importDefault(require("./ui"));
|
|
|
9
9
|
const console_1 = __importDefault(require("../util/console"));
|
|
10
10
|
const daemon_1 = require("../daemon");
|
|
11
11
|
const log_1 = require("../util/log");
|
|
12
|
+
const cli_input_1 = require("./cli_input");
|
|
12
13
|
class CLI {
|
|
13
14
|
constructor(daemon, config) {
|
|
14
15
|
this.daemon = daemon;
|
|
@@ -22,13 +23,20 @@ class CLI {
|
|
|
22
23
|
this.adapters[key] = val(daemon_1.Daemon.get(daemon, 'providers'));
|
|
23
24
|
this.adapters[key].name = key;
|
|
24
25
|
});
|
|
26
|
+
this.input = new cli_input_1.CLIInputHandler(this.getCmds());
|
|
25
27
|
}
|
|
26
|
-
async run() {
|
|
28
|
+
async run(cmd) {
|
|
29
|
+
if (cmd) {
|
|
30
|
+
this.runCmd(cmd);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
27
33
|
console_1.default.header('CLI');
|
|
28
34
|
// eslint-disable-next-line no-constant-condition
|
|
29
35
|
while (true) {
|
|
30
36
|
const ctx = `${(0, string_1.colored)(this.app, 'darkgray')}:${(0, string_1.colored)(this.ctx, 'lightcyan')}${(0, string_1.colored)('$', 'brown')}`;
|
|
31
|
-
const cmd = await
|
|
37
|
+
const cmd = await this.input.input(ctx);
|
|
38
|
+
if (!cmd)
|
|
39
|
+
continue;
|
|
32
40
|
try {
|
|
33
41
|
if (await this.runCmd(cmd)) {
|
|
34
42
|
break;
|
|
@@ -66,7 +74,7 @@ class CLI {
|
|
|
66
74
|
return false;
|
|
67
75
|
}
|
|
68
76
|
}
|
|
69
|
-
ui_1.default.error(
|
|
77
|
+
ui_1.default.error(`Invalid command '${payload}'`);
|
|
70
78
|
return false;
|
|
71
79
|
}
|
|
72
80
|
cmdHelp() {
|
|
@@ -84,5 +92,16 @@ class CLI {
|
|
|
84
92
|
async cmdClear() {
|
|
85
93
|
console.clear();
|
|
86
94
|
}
|
|
95
|
+
getCmds() {
|
|
96
|
+
const cmds = [];
|
|
97
|
+
for (const a in this.adapters) {
|
|
98
|
+
const adapter = this.adapters[a];
|
|
99
|
+
for (const c in adapter.commands) {
|
|
100
|
+
const command = adapter.commands[c];
|
|
101
|
+
cmds.push(adapter.name + ' ' + command.name);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return cmds;
|
|
105
|
+
}
|
|
87
106
|
}
|
|
88
107
|
exports.CLI = CLI;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { AnyDaemon } from '../daemon';
|
|
2
2
|
export declare abstract class CLICommand<T extends Record<string, any> = Record<string, any>> {
|
|
3
|
+
scope: 'dev' | 'prod' | 'any';
|
|
3
4
|
name: string;
|
|
4
5
|
syntax: string;
|
|
5
6
|
description: string;
|
|
6
7
|
regex?: RegExp | undefined;
|
|
7
8
|
groups?: string[] | undefined;
|
|
8
|
-
constructor(name: string, syntax: string, description: string, regex?: RegExp | undefined, groups?: string[] | undefined);
|
|
9
|
+
constructor(scope: 'dev' | 'prod' | 'any', name: string, syntax: string, description: string, regex?: RegExp | undefined, groups?: string[] | undefined);
|
|
9
10
|
input(payload: string): Record<string, any>;
|
|
10
11
|
abstract run(daemon: AnyDaemon, input: T): Promise<void>;
|
|
11
12
|
}
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CLIAdapter = exports.CLICommand = void 0;
|
|
4
4
|
const string_1 = require("../util/string");
|
|
5
5
|
class CLICommand {
|
|
6
|
-
constructor(name, syntax, description, regex, groups) {
|
|
6
|
+
constructor(scope, name, syntax, description, regex, groups) {
|
|
7
|
+
this.scope = scope;
|
|
7
8
|
this.name = name;
|
|
8
9
|
this.syntax = syntax;
|
|
9
10
|
this.description = description;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare class CLIInputHandler {
|
|
2
|
+
private suggestions;
|
|
3
|
+
private items;
|
|
4
|
+
private history;
|
|
5
|
+
private buffer;
|
|
6
|
+
private cursor;
|
|
7
|
+
private suggestion?;
|
|
8
|
+
constructor(suggestions?: string[]);
|
|
9
|
+
/**
|
|
10
|
+
* Wait for user input:
|
|
11
|
+
* - Some text + Enter
|
|
12
|
+
* - Special Keys: Up/Down/Tab
|
|
13
|
+
*/
|
|
14
|
+
input(ctx?: string): Promise<string | undefined>;
|
|
15
|
+
add(item: string): void;
|
|
16
|
+
up(): string | undefined;
|
|
17
|
+
down(): string | undefined;
|
|
18
|
+
suggest(_seed: string): string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.CLIInputHandler = void 0;
|
|
37
|
+
const stream_1 = require("stream");
|
|
38
|
+
const readline = __importStar(require("readline"));
|
|
39
|
+
class CLIInputHandler {
|
|
40
|
+
constructor(suggestions = []) {
|
|
41
|
+
this.suggestions = suggestions;
|
|
42
|
+
this.items = [];
|
|
43
|
+
this.history = 0;
|
|
44
|
+
this.buffer = '';
|
|
45
|
+
this.cursor = 0;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Wait for user input:
|
|
49
|
+
* - Some text + Enter
|
|
50
|
+
* - Special Keys: Up/Down/Tab
|
|
51
|
+
*/
|
|
52
|
+
async input(ctx) {
|
|
53
|
+
return new Promise(resolve => {
|
|
54
|
+
const mutableStdout = new stream_1.Writable({
|
|
55
|
+
write: function (chunk, encoding, callback) {
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
this.buffer = '';
|
|
59
|
+
this.cursor = 0;
|
|
60
|
+
this.suggestion = undefined;
|
|
61
|
+
const rl = readline.createInterface({
|
|
62
|
+
input: process.stdin,
|
|
63
|
+
output: mutableStdout,
|
|
64
|
+
terminal: true
|
|
65
|
+
});
|
|
66
|
+
const print = () => {
|
|
67
|
+
process.stdout.clearLine(0);
|
|
68
|
+
process.stdout.cursorTo(0);
|
|
69
|
+
process.stdout.write(ctx + ' ' + this.buffer);
|
|
70
|
+
process.stdout.moveCursor(this.cursor - this.buffer.length, 0);
|
|
71
|
+
};
|
|
72
|
+
print();
|
|
73
|
+
const onKeypress = (ch, key) => {
|
|
74
|
+
// History
|
|
75
|
+
if (key.name === 'up') {
|
|
76
|
+
this.buffer = this.up() || this.buffer;
|
|
77
|
+
this.cursor = this.buffer.length;
|
|
78
|
+
print();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (key.name === 'down') {
|
|
82
|
+
this.buffer = this.down() || '';
|
|
83
|
+
this.cursor = this.buffer.length;
|
|
84
|
+
print();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
// Suggestion
|
|
88
|
+
if (key.name === 'tab') {
|
|
89
|
+
this.buffer = this.suggest(this.buffer) || this.buffer;
|
|
90
|
+
this.cursor = this.buffer.length;
|
|
91
|
+
print();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
this.suggestion = undefined;
|
|
95
|
+
// Text Editing
|
|
96
|
+
if (key.name === 'left') {
|
|
97
|
+
if (this.cursor > 0) {
|
|
98
|
+
process.stdout.moveCursor(-1, 0);
|
|
99
|
+
this.cursor -= 1;
|
|
100
|
+
}
|
|
101
|
+
print();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (key.name === 'right') {
|
|
105
|
+
if (this.cursor < this.buffer.length) {
|
|
106
|
+
process.stdout.moveCursor(1, 0);
|
|
107
|
+
this.cursor += 1;
|
|
108
|
+
}
|
|
109
|
+
print();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (key.name === 'backspace') {
|
|
113
|
+
if (this.buffer.length == 0) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
this.buffer = this.buffer.slice(0, this.cursor - 1)
|
|
117
|
+
+ this.buffer.slice(this.cursor);
|
|
118
|
+
this.cursor -= 1;
|
|
119
|
+
print();
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (key.name === 'delete') {
|
|
123
|
+
if (this.buffer.length == 0) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
this.buffer = this.buffer.slice(0, this.cursor)
|
|
127
|
+
+ this.buffer.slice(this.cursor + 1);
|
|
128
|
+
print();
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
// Submit
|
|
132
|
+
if (key.name === 'return') {
|
|
133
|
+
submit(this.buffer);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
// Text Characters
|
|
137
|
+
else {
|
|
138
|
+
this.buffer = this.buffer.slice(0, this.cursor)
|
|
139
|
+
+ ch
|
|
140
|
+
+ this.buffer.slice(this.cursor);
|
|
141
|
+
this.cursor += 1;
|
|
142
|
+
print();
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
const onCancel = () => {
|
|
146
|
+
if (!this.buffer.length) {
|
|
147
|
+
process.stdout.clearLine(0);
|
|
148
|
+
process.stdout.cursorTo(0);
|
|
149
|
+
process.exit();
|
|
150
|
+
}
|
|
151
|
+
submit(undefined);
|
|
152
|
+
};
|
|
153
|
+
const submit = (value) => {
|
|
154
|
+
process.stdout.write('\n');
|
|
155
|
+
rl.close();
|
|
156
|
+
process.stdin.off('keypress', onKeypress);
|
|
157
|
+
rl.off('SIGINT', onCancel);
|
|
158
|
+
this.buffer = '';
|
|
159
|
+
if (value !== undefined) {
|
|
160
|
+
this.add(value);
|
|
161
|
+
}
|
|
162
|
+
resolve(value);
|
|
163
|
+
};
|
|
164
|
+
process.stdin.on('keypress', onKeypress);
|
|
165
|
+
rl.on('SIGINT', onCancel);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
add(item) {
|
|
169
|
+
this.history = 0;
|
|
170
|
+
this.suggestion = undefined;
|
|
171
|
+
if (this.items[0] === item) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
this.items.unshift(item);
|
|
175
|
+
}
|
|
176
|
+
up() {
|
|
177
|
+
if (this.history >= this.items.length)
|
|
178
|
+
return;
|
|
179
|
+
const item = this.items[this.history];
|
|
180
|
+
this.history += 1;
|
|
181
|
+
return item;
|
|
182
|
+
}
|
|
183
|
+
down() {
|
|
184
|
+
if (this.history <= 0)
|
|
185
|
+
return;
|
|
186
|
+
const item = this.items[this.history];
|
|
187
|
+
this.history -= 1;
|
|
188
|
+
return item;
|
|
189
|
+
}
|
|
190
|
+
suggest(_seed) {
|
|
191
|
+
const idx = this.suggestion?.idx || 0;
|
|
192
|
+
const seed = this.suggestion?.seed || _seed;
|
|
193
|
+
for (let i = idx; i < this.suggestions.length; i++) {
|
|
194
|
+
const sugg = this.suggestions[i];
|
|
195
|
+
if (sugg.startsWith(seed)) {
|
|
196
|
+
this.suggestion = {
|
|
197
|
+
seed,
|
|
198
|
+
idx: i + 1
|
|
199
|
+
};
|
|
200
|
+
return sugg;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
this.suggestion = undefined;
|
|
204
|
+
return seed;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
exports.CLIInputHandler = CLIInputHandler;
|
package/lib/engine/cli/ui.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export default class UI {
|
|
|
2
2
|
/**
|
|
3
3
|
* Show a list of options and let the user pick with up/down + enter
|
|
4
4
|
*/
|
|
5
|
-
static select(title: string, options:
|
|
5
|
+
static select<T>(title: string, options: T[], val?: NoInfer<(o: T) => string>, defaul?: number): Promise<T>;
|
|
6
6
|
/**
|
|
7
7
|
* Ask a question and wait for the answer
|
|
8
8
|
*/
|
package/lib/engine/cli/ui.js
CHANGED
|
@@ -40,7 +40,7 @@ class UI {
|
|
|
40
40
|
/**
|
|
41
41
|
* Show a list of options and let the user pick with up/down + enter
|
|
42
42
|
*/
|
|
43
|
-
static async select(title, options, defaul = 0) {
|
|
43
|
+
static async select(title, options, val = (o => o), defaul = 0) {
|
|
44
44
|
return new Promise(resolve => {
|
|
45
45
|
UI.step(title);
|
|
46
46
|
let mute = true;
|
|
@@ -61,7 +61,7 @@ class UI {
|
|
|
61
61
|
const print = () => {
|
|
62
62
|
mute = false;
|
|
63
63
|
for (let i = 0; i < options.length; i++) {
|
|
64
|
-
rl.write((0, string_1.colored)(`${i === selected ? '» ' : ' '}` + options[i] + '\n', i === selected ? 'lightgreen' : 'lightgray'));
|
|
64
|
+
rl.write((0, string_1.colored)(`${i === selected ? '» ' : ' '}` + val(options[i]) + '\n', i === selected ? 'lightgreen' : 'lightgray'));
|
|
65
65
|
}
|
|
66
66
|
mute = true;
|
|
67
67
|
};
|
package/lib/engine/daemon.d.ts
CHANGED
|
@@ -14,8 +14,9 @@ export declare abstract class Daemon<S extends $Space, Modules extends ModuleNam
|
|
|
14
14
|
private _cli?;
|
|
15
15
|
constructor(name: string, trxEngines: Record<Modules, AnyTrxEngine>, providers: Record<string, any>, app?: AnyAppConfig | undefined);
|
|
16
16
|
trx<K extends Modules & keyof S['modules']>(moduleName: K): DaemonTrx<S, S["modules"][K], {}>;
|
|
17
|
-
cli(): Promise<void>;
|
|
17
|
+
cli(cmd?: string): Promise<void>;
|
|
18
18
|
private bindControllers;
|
|
19
|
+
static destroy(daemon: AnyDaemon): Promise<void>;
|
|
19
20
|
static reload(daemon: AnyDaemon, trxEngines: Record<string, AnyTrxEngine>, providers: Record<string, any>): void;
|
|
20
21
|
static get<T extends {
|
|
21
22
|
name: string;
|
|
@@ -29,7 +30,7 @@ export declare class DaemonTrx<S extends $Space, M extends $Module, Authn extend
|
|
|
29
30
|
private trxEngine;
|
|
30
31
|
private _authn?;
|
|
31
32
|
constructor(trxEngine: AnyTrxEngine);
|
|
32
|
-
authn<Authn extends AuthnRequest<keyof S['authnUsers']>>(authn
|
|
33
|
+
authn<Authn extends AuthnRequest<keyof S['authnUsers']>>(authn?: Authn): DaemonTrx<S, M, { [K in keyof Authn]: S["authnUsers"][K & keyof S["authnUsers"]]; }>;
|
|
33
34
|
run<Output>(fn: (trx: TrxNode<S, M, Authn>) => Promise<Output>): Promise<TrxStatus<Output>>;
|
|
34
35
|
}
|
|
35
36
|
export type AnyDaemon = Daemon<any, any>;
|