nesoi 3.3.1 → 3.3.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/lib/bundler/distributed/distributed.bundler.d.ts +1 -1
- package/lib/bundler/distributed/distributed.bundler.js +1 -1
- package/lib/bundler/distributed/stages/1_mkdir_stage.d.ts +1 -1
- package/lib/bundler/distributed/stages/2_build_typescript_stage.d.ts +1 -1
- package/lib/bundler/distributed/stages/3_copy_types_stage.d.ts +1 -1
- package/lib/bundler/distributed/stages/4_dump_modules_stage.d.ts +1 -1
- package/lib/bundler/distributed/stages/5_copy_static_stage.js +1 -1
- package/lib/bundler/distributed/stages/6_dump_cli_stage.js +1 -1
- package/lib/bundler/distributed/stages/7_dump_package_json_stage.js +1 -1
- package/lib/bundler/monolyth/monolyth.bundler.d.ts +2 -8
- package/lib/bundler/monolyth/monolyth.bundler.js +1 -1
- package/lib/bundler/monolyth/stages/1_mkdir_stage.d.ts +1 -1
- package/lib/bundler/monolyth/stages/2_build_typescript_stage.d.ts +1 -1
- package/lib/bundler/monolyth/stages/3_copy_types_stage.d.ts +1 -1
- package/lib/bundler/monolyth/stages/4_dump_modules_stage.d.ts +1 -1
- package/lib/bundler/monolyth/stages/5_copy_static_stage.d.ts +1 -1
- package/lib/bundler/monolyth/stages/6_dump_cli_stage.d.ts +1 -1
- package/lib/bundler/monolyth/stages/7_dump_package_json_stage.d.ts +1 -1
- package/lib/bundler/monolyth/stages/7_dump_package_json_stage.js +2 -2
- package/lib/{bundler/browser → engine/app/native}/browser.app.d.ts +8 -11
- package/lib/{bundler/browser → engine/app/native}/browser.app.js +3 -9
- package/lib/{bundler/distributed → engine/app/native}/distributed.app.config.d.ts +6 -6
- package/lib/{bundler/distributed → engine/app/native}/distributed.app.d.ts +6 -9
- package/lib/{bundler/distributed → engine/app/native}/distributed.app.js +2 -7
- package/lib/{bundler/distributed → engine/app/native}/distributed_node.app.d.ts +8 -8
- package/lib/{bundler/distributed → engine/app/native}/distributed_node.app.js +8 -8
- package/lib/engine/app/native/monolyth.app.config.d.ts +7 -0
- package/lib/engine/app/native/monolyth.app.config.js +2 -0
- package/lib/{bundler/monolyth → engine/app/native}/monolyth.app.d.ts +9 -12
- package/lib/{bundler/monolyth → engine/app/native}/monolyth.app.js +6 -12
- package/lib/engine/daemon.d.ts +11 -3
- package/lib/engine/daemon.js +23 -4
- package/lib/engine/transaction/nodes/bucket.trx_node.d.ts +3 -2
- package/lib/engine/transaction/nodes/bucket.trx_node.js +16 -10
- package/lib/engine/transaction/nodes/external.trx_node.js +3 -1
- package/lib/engine/transaction/trx_engine.d.ts +4 -4
- package/lib/engine/transaction/trx_engine.js +9 -9
- package/lib/engine/transaction/trx_node.d.ts +1 -1
- package/lib/engine/transaction/trx_node.js +7 -3
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- /package/lib/{bundler/distributed → engine/app/native}/distributed.app.config.js +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Compiler } from "../../compiler/compiler";
|
|
2
2
|
import { AnyApp } from "../../engine/app/app";
|
|
3
|
-
import { DistributedApp } from
|
|
3
|
+
import { DistributedApp } from "../../engine/app/native/distributed.app";
|
|
4
4
|
export type DistributedBundlerConfig = {
|
|
5
5
|
libPaths?: string[];
|
|
6
6
|
staticPaths?: string[];
|
|
@@ -50,7 +50,7 @@ const _4_dump_modules_stage_1 = require("./stages/4_dump_modules_stage");
|
|
|
50
50
|
// import { DumpPackageJsonStage } from './stages/7_dump_package_json_stage';
|
|
51
51
|
const log_1 = require("../../engine/util/log");
|
|
52
52
|
const app_1 = require("../../engine/app/app");
|
|
53
|
-
const distributed_app_1 = require("
|
|
53
|
+
const distributed_app_1 = require("../../engine/app/native/distributed.app");
|
|
54
54
|
const path_1 = require("../../engine/util/path");
|
|
55
55
|
class DistributedBundler {
|
|
56
56
|
constructor(compiler, appPath, config = {}) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DistributedBundler } from '../distributed.bundler';
|
|
2
|
-
import { DistributedApp } from
|
|
2
|
+
import { DistributedApp } from "../../../engine/app/native/distributed.app";
|
|
3
3
|
/**
|
|
4
4
|
* [distributed Compiler Stage #4]
|
|
5
5
|
* Dump modules to build/modules folder.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// import * as fs from 'fs';
|
|
3
3
|
// import * as path from 'path';
|
|
4
4
|
// import { Log } from '~/engine/util/log';
|
|
5
|
-
// import { MonolythApp } from '~/
|
|
5
|
+
// import { MonolythApp } from '~/engine/app/native/monolyth.app';
|
|
6
6
|
// import { MonolythBundler } from '../monolyth.bundler';
|
|
7
7
|
// import { Space } from '~/engine/space';
|
|
8
8
|
// /**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// import * as fs from 'fs';
|
|
3
3
|
// import * as path from 'path';
|
|
4
4
|
// import { Log } from '~/engine/util/log';
|
|
5
|
-
// import { MonolythApp } from '~/
|
|
5
|
+
// import { MonolythApp } from '~/engine/app/native/monolyth.app';
|
|
6
6
|
// import { MonolythBundler } from '../monolyth.bundler';
|
|
7
7
|
// /**
|
|
8
8
|
// * [Monolyth Compiler Stage #6]
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// import { Log } from '~/engine/util/log';
|
|
5
5
|
// import { MonolythBundler } from '../monolyth.bundler';
|
|
6
6
|
// import { Space } from '~/engine/space';
|
|
7
|
-
// import { MonolythApp } from '~/
|
|
7
|
+
// import { MonolythApp } from '~/engine/app/native/monolyth.app';
|
|
8
8
|
// /**
|
|
9
9
|
// * [Monolyth Compiler Stage #7]
|
|
10
10
|
// * Dump the package.json file to build folder.
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { Compiler } from "../../compiler/compiler";
|
|
2
2
|
import { AnyApp } from "../../engine/app/app";
|
|
3
|
-
import { MonolythApp } from "
|
|
4
|
-
|
|
5
|
-
libPaths?: string[];
|
|
6
|
-
staticPaths?: string[];
|
|
7
|
-
scripts?: Record<string, string>;
|
|
8
|
-
nesoiPath?: string;
|
|
9
|
-
nesoiVersion?: string;
|
|
10
|
-
};
|
|
3
|
+
import { MonolythApp } from "../../engine/app/native/monolyth.app";
|
|
4
|
+
import { MonolythBundlerConfig } from "../../engine/app/native/monolyth.app.config";
|
|
11
5
|
export declare class MonolythBundler {
|
|
12
6
|
compiler: Compiler;
|
|
13
7
|
appPath: string;
|
|
@@ -50,7 +50,7 @@ const _7_dump_package_json_stage_1 = require("./stages/7_dump_package_json_stage
|
|
|
50
50
|
const _2_build_typescript_stage_1 = require("./stages/2_build_typescript_stage");
|
|
51
51
|
const log_1 = require("../../engine/util/log");
|
|
52
52
|
const app_1 = require("../../engine/app/app");
|
|
53
|
-
const monolyth_app_1 = require("
|
|
53
|
+
const monolyth_app_1 = require("../../engine/app/native/monolyth.app");
|
|
54
54
|
const path_1 = require("../../engine/util/path");
|
|
55
55
|
class MonolythBundler {
|
|
56
56
|
constructor(compiler, appPath, config = {}) {
|
|
@@ -38,7 +38,7 @@ const fs = __importStar(require("fs"));
|
|
|
38
38
|
const path = __importStar(require("path"));
|
|
39
39
|
const log_1 = require("../../../engine/util/log");
|
|
40
40
|
const space_1 = require("../../../engine/space");
|
|
41
|
-
const monolyth_app_1 = require("
|
|
41
|
+
const monolyth_app_1 = require("../../../engine/app/native/monolyth.app");
|
|
42
42
|
const app_1 = require("../../../engine/app/app");
|
|
43
43
|
/**
|
|
44
44
|
* [Monolyth Compiler Stage #7]
|
|
@@ -69,7 +69,7 @@ class DumpPackageJsonStage {
|
|
|
69
69
|
scripts[name] = `node ${jspath}`;
|
|
70
70
|
});
|
|
71
71
|
const info = app_1.App.getInfo(this.app);
|
|
72
|
-
const { nesoi: _, spaceDependencies } = spacePackageJson.dependencies || {};
|
|
72
|
+
const { nesoi: _, ...spaceDependencies } = spacePackageJson.dependencies || {};
|
|
73
73
|
const dependencies = {
|
|
74
74
|
...spaceDependencies,
|
|
75
75
|
[info.nesoiNpmPkg]: config.nesoiPath
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { $Space, ModuleName } from "
|
|
2
|
-
import { MonolythDaemon } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { Space } from "../../engine/space";
|
|
9
|
-
import { AnyTrxEngine } from "../../engine/transaction/trx_engine";
|
|
1
|
+
import { $Space, ModuleName } from "../../../schema";
|
|
2
|
+
import { MonolythDaemon } from './monolyth.app';
|
|
3
|
+
import { AppConfigBuilder } from "../app.config";
|
|
4
|
+
import { InlineApp } from "../inline.app";
|
|
5
|
+
import { IService } from "../service";
|
|
6
|
+
import { Space } from "../../space";
|
|
7
|
+
import { AnyTrxEngine } from "../../transaction/trx_engine";
|
|
10
8
|
/**
|
|
11
9
|
* @category App
|
|
12
10
|
* @subcategory Browser
|
|
@@ -15,10 +13,9 @@ export declare class BrowserApp<S extends $Space, ModuleNames extends string = M
|
|
|
15
13
|
protected _nesoiNpmPkg: string;
|
|
16
14
|
constructor(name: string, space?: Space<S>);
|
|
17
15
|
protected _packageJson?: Record<string, any>;
|
|
18
|
-
static bundle(compiler: Compiler, appPath: string, config?: MonolythBundlerConfig): Promise<void>;
|
|
19
16
|
daemon($?: {
|
|
20
17
|
watch?: boolean;
|
|
21
|
-
}): Promise<import("../../
|
|
18
|
+
}): Promise<import("../../daemon").Daemon<S, ModuleNames>>;
|
|
22
19
|
protected makeDaemon(trxEngines: Record<ModuleNames, AnyTrxEngine>, services: Record<string, IService>): BrowserDaemon<$Space, ModuleNames>;
|
|
23
20
|
modules<M extends ModuleName<S>>(modules: M[]): BrowserApp<S, M & ModuleNames>;
|
|
24
21
|
service<T extends IService>($: T): BrowserApp<S, ModuleNames, Services & { [K in T["name"]]: T; }>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BrowserDaemon = exports.BrowserApp = void 0;
|
|
4
|
-
const monolyth_app_1 = require("
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const inline_app_1 = require("../../engine/app/inline.app");
|
|
4
|
+
const monolyth_app_1 = require("./monolyth.app");
|
|
5
|
+
const app_config_1 = require("../app.config");
|
|
6
|
+
const inline_app_1 = require("../inline.app");
|
|
8
7
|
/**
|
|
9
8
|
* @category App
|
|
10
9
|
* @subcategory Browser
|
|
@@ -16,11 +15,6 @@ class BrowserApp extends inline_app_1.InlineApp {
|
|
|
16
15
|
this.builders = undefined;
|
|
17
16
|
this.space = space;
|
|
18
17
|
}
|
|
19
|
-
//
|
|
20
|
-
static bundle(compiler, appPath, config) {
|
|
21
|
-
return new browser_bundler_1.BrowserBundler(compiler, appPath, config)
|
|
22
|
-
.run();
|
|
23
|
-
}
|
|
24
18
|
// Override InlineApp abstract methods
|
|
25
19
|
async daemon($) {
|
|
26
20
|
return super.daemon();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { $Space, ModuleName } from "
|
|
2
|
-
import { AppConfig, AppControllerConfig, AppI18nConfig, AppTrashConfig, AppAuthConfig, CompilerConfig } from "
|
|
3
|
-
import { CLIConfig } from "../../
|
|
1
|
+
import { $Space, ModuleName } from "../../../schema";
|
|
2
|
+
import { AppConfig, AppControllerConfig, AppI18nConfig, AppTrashConfig, AppAuthConfig, CompilerConfig } from "../app.config";
|
|
3
|
+
import { CLIConfig } from "../../cli/cli";
|
|
4
4
|
import { DistributedNodeApp } from './distributed_node.app';
|
|
5
|
-
import { TrxEngineConfig } from "../../
|
|
6
|
-
import { BucketConfig } from "
|
|
7
|
-
import { IService } from "
|
|
5
|
+
import { TrxEngineConfig } from "../../transaction/trx_engine.config";
|
|
6
|
+
import { BucketConfig } from "../../../elements/entities/bucket/bucket.config";
|
|
7
|
+
import { IService } from "../service";
|
|
8
8
|
export type DistributedAppModuleConfig<S extends $Space, M extends ModuleName<S>, Nodes extends Record<string, DistributedNodeApp<any, any, any, any>>, Services extends Record<string, IService>> = {
|
|
9
9
|
buckets?: DistributedAppBucketConfig<S, M, Nodes, Services>;
|
|
10
10
|
jobs?: DistributedAppJobConfig<S, M, Nodes>;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { $Space } from "
|
|
2
|
-
import { Space } from "../../
|
|
3
|
-
import { Daemon } from "../../
|
|
1
|
+
import { $Space } from "../../../schema";
|
|
2
|
+
import { Space } from "../../space";
|
|
3
|
+
import { Daemon } from "../../daemon";
|
|
4
4
|
import { DistributedAppConfig } from './distributed.app.config';
|
|
5
|
-
import { App } from "
|
|
5
|
+
import { App } from "../app";
|
|
6
6
|
import { DistributedNodeApp, DistributedAppNodeDef, DistributedNodeDaemon } from './distributed_node.app';
|
|
7
|
-
import { AnyElementSchema } from "../../
|
|
8
|
-
import {
|
|
9
|
-
import { Tag } from "../../engine/dependency";
|
|
10
|
-
import { DistributedBundlerConfig } from './distributed.bundler';
|
|
7
|
+
import { AnyElementSchema } from "../../module";
|
|
8
|
+
import { Tag } from "../../dependency";
|
|
11
9
|
/**
|
|
12
10
|
* @category App
|
|
13
11
|
* @subcategory Distributed
|
|
@@ -15,7 +13,6 @@ import { DistributedBundlerConfig } from './distributed.bundler';
|
|
|
15
13
|
export declare class DistributedApp<S extends $Space, Name extends string, Nodes extends Record<string, DistributedNodeApp<any, any, any, any>> = {}> extends App<S, never, never> {
|
|
16
14
|
nodes: Nodes;
|
|
17
15
|
constructor(name: Name, space?: Space<S>);
|
|
18
|
-
static compile(compiler: Compiler, appPath: string, config?: DistributedBundlerConfig): Promise<void>;
|
|
19
16
|
boot(): DistributedApp<S, Name, Nodes>;
|
|
20
17
|
daemon(): Promise<DistributedDaemon<S, { [N in keyof Nodes as `${Name}-${N & string}`]: Nodes[N]; }>>;
|
|
21
18
|
node<N extends string, ModuleNames extends string, Services extends Record<string, any>, Def extends DistributedAppNodeDef<S, Nodes, ModuleNames, Services>>(name: N, def: Def): DistributedApp<S, Name, Nodes & {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DistributedDaemon = exports.DistributedApp = void 0;
|
|
4
|
-
const daemon_1 = require("../../
|
|
5
|
-
const app_1 = require("
|
|
4
|
+
const daemon_1 = require("../../daemon");
|
|
5
|
+
const app_1 = require("../app");
|
|
6
6
|
const distributed_node_app_1 = require("./distributed_node.app");
|
|
7
|
-
const distributed_bundler_1 = require("./distributed.bundler");
|
|
8
7
|
/**
|
|
9
8
|
* @category App
|
|
10
9
|
* @subcategory Distributed
|
|
@@ -17,10 +16,6 @@ class DistributedApp extends app_1.App {
|
|
|
17
16
|
this.space = space;
|
|
18
17
|
}
|
|
19
18
|
// Override App abstract methods
|
|
20
|
-
static compile(compiler, appPath, config) {
|
|
21
|
-
return new distributed_bundler_1.DistributedBundler(compiler, appPath, config)
|
|
22
|
-
.run();
|
|
23
|
-
}
|
|
24
19
|
boot() {
|
|
25
20
|
return this;
|
|
26
21
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { $Module, $Space, ModuleName } from "
|
|
2
|
-
import { AnyTrxEngine } from "../../
|
|
3
|
-
import { AnyModule, Module } from "../../
|
|
4
|
-
import { Space } from "../../
|
|
5
|
-
import { App } from "
|
|
6
|
-
import { AppConfigBuilder } from "
|
|
7
|
-
import { IService } from "
|
|
8
|
-
import { MonolythDaemon } from
|
|
1
|
+
import { $Module, $Space, ModuleName } from "../../../schema";
|
|
2
|
+
import { AnyTrxEngine } from "../../transaction/trx_engine";
|
|
3
|
+
import { AnyModule, Module } from "../../module";
|
|
4
|
+
import { Space } from "../../space";
|
|
5
|
+
import { App } from "../app";
|
|
6
|
+
import { AppConfigBuilder } from "../app.config";
|
|
7
|
+
import { IService } from "../service";
|
|
8
|
+
import { MonolythDaemon } from "./monolyth.app";
|
|
9
9
|
import { DistributedAppConfig } from './distributed.app.config';
|
|
10
10
|
export declare class DistributedNodeApp<S extends $Space, Nodes extends Record<string, DistributedNodeApp<any, any, any, any>>, ModuleNames extends string, Services extends Record<string, any>> extends App<S, ModuleNames, Services> {
|
|
11
11
|
_host: {
|
|
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.DistributedNodeDaemon = exports.DistributedNodeApp = void 0;
|
|
7
|
-
const trx_engine_1 = require("../../
|
|
8
|
-
const tree_1 = require("../../
|
|
9
|
-
const log_1 = require("../../
|
|
10
|
-
const promise_1 = __importDefault(require("../../
|
|
11
|
-
const builder_1 = require("../../
|
|
12
|
-
const app_1 = require("
|
|
13
|
-
const inc_server_1 = require("
|
|
14
|
-
const monolyth_app_1 = require("
|
|
7
|
+
const trx_engine_1 = require("../../transaction/trx_engine");
|
|
8
|
+
const tree_1 = require("../../tree");
|
|
9
|
+
const log_1 = require("../../util/log");
|
|
10
|
+
const promise_1 = __importDefault(require("../../util/promise"));
|
|
11
|
+
const builder_1 = require("../../builder");
|
|
12
|
+
const app_1 = require("../app");
|
|
13
|
+
const inc_server_1 = require("../inc/inc.server");
|
|
14
|
+
const monolyth_app_1 = require("./monolyth.app");
|
|
15
15
|
const distributed_app_config_1 = require("./distributed.app.config");
|
|
16
16
|
class DistributedNodeApp extends app_1.App {
|
|
17
17
|
constructor(name, space) {
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { $Space, ModuleName } from "
|
|
2
|
-
import { Daemon } from "../../
|
|
3
|
-
import { AnyElementSchema } from "../../
|
|
4
|
-
import { Tag } from "../../
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { Space } from "../../engine/space";
|
|
11
|
-
import { AnyTrxEngine } from "../../engine/transaction/trx_engine";
|
|
1
|
+
import { $Space, ModuleName } from "../../../schema";
|
|
2
|
+
import { Daemon } from "../../daemon";
|
|
3
|
+
import { AnyElementSchema } from "../../module";
|
|
4
|
+
import { Tag } from "../../dependency";
|
|
5
|
+
import { AppConfigBuilder } from "../app.config";
|
|
6
|
+
import { InlineApp } from "../inline.app";
|
|
7
|
+
import { IService } from "../service";
|
|
8
|
+
import { Space } from "../../space";
|
|
9
|
+
import { AnyTrxEngine } from "../../transaction/trx_engine";
|
|
12
10
|
/**
|
|
13
11
|
* @category App
|
|
14
12
|
* @subcategory Monolyth
|
|
@@ -17,7 +15,6 @@ export declare class MonolythApp<S extends $Space, ModuleNames extends string =
|
|
|
17
15
|
private watcher?;
|
|
18
16
|
constructor(name: string, space?: Space<S>);
|
|
19
17
|
protected _packageJson?: Record<string, any>;
|
|
20
|
-
static bundle(compiler: Compiler, appPath: string, config?: MonolythBundlerConfig): Promise<void>;
|
|
21
18
|
daemon($?: {
|
|
22
19
|
watch?: boolean;
|
|
23
20
|
}): Promise<Daemon<S, ModuleNames>>;
|
|
@@ -34,13 +34,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.MonolythDaemon = exports.MonolythApp = void 0;
|
|
37
|
-
const daemon_1 = require("../../
|
|
38
|
-
const log_1 = require("../../
|
|
39
|
-
const dependency_1 = require("../../
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const space_1 = require("../../engine/space");
|
|
37
|
+
const daemon_1 = require("../../daemon");
|
|
38
|
+
const log_1 = require("../../util/log");
|
|
39
|
+
const dependency_1 = require("../../dependency");
|
|
40
|
+
const app_config_1 = require("../app.config");
|
|
41
|
+
const inline_app_1 = require("../inline.app");
|
|
42
|
+
const space_1 = require("../../space");
|
|
44
43
|
/**
|
|
45
44
|
* @category App
|
|
46
45
|
* @subcategory Monolyth
|
|
@@ -51,11 +50,6 @@ class MonolythApp extends inline_app_1.InlineApp {
|
|
|
51
50
|
this.builders = undefined;
|
|
52
51
|
this.space = space;
|
|
53
52
|
}
|
|
54
|
-
//
|
|
55
|
-
static bundle(compiler, appPath, config) {
|
|
56
|
-
return new monolyth_bundler_1.MonolythBundler(compiler, appPath, config)
|
|
57
|
-
.run();
|
|
58
|
-
}
|
|
59
53
|
// Override InlineApp abstract methods
|
|
60
54
|
async daemon($) {
|
|
61
55
|
/**
|
package/lib/engine/daemon.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ModuleName } from "../schema";
|
|
|
3
3
|
import { AnyTrxEngine, HeldTrxNode } from './transaction/trx_engine';
|
|
4
4
|
import { AnyAppConfig } from './app/app.config';
|
|
5
5
|
import { AnyUsers, AuthRequest } from './auth/authn';
|
|
6
|
-
import { TrxNode } from './transaction/trx_node';
|
|
6
|
+
import { AnyTrxNode, TrxNode } from './transaction/trx_node';
|
|
7
7
|
import { TrxStatus } from './transaction/trx';
|
|
8
8
|
import { AnyModule } from './module';
|
|
9
9
|
import { IService } from './app/service';
|
|
@@ -114,21 +114,29 @@ export declare abstract class Daemon<S extends $Space, Modules extends ModuleNam
|
|
|
114
114
|
*/
|
|
115
115
|
export declare class DaemonTrx<S extends $Space, M extends $Module, AuthUsers extends AnyUsers = {}> {
|
|
116
116
|
private trxEngine;
|
|
117
|
+
/**
|
|
118
|
+
* The node from which this transaction was inherited
|
|
119
|
+
*/
|
|
120
|
+
private _inherit?;
|
|
117
121
|
/**
|
|
118
122
|
* The authentication request which will be used to
|
|
119
123
|
* authenticate this transaction prior to running.
|
|
120
124
|
*/
|
|
121
|
-
private
|
|
125
|
+
private tokens?;
|
|
122
126
|
/**
|
|
123
127
|
* @param trxEngine The transaction engine where to run the transaction.
|
|
124
128
|
*/
|
|
125
129
|
constructor(trxEngine: AnyTrxEngine);
|
|
130
|
+
/**
|
|
131
|
+
* Inherit authentication from another transaction node.
|
|
132
|
+
*/
|
|
133
|
+
auth_inherit(trx: AnyTrxNode): this;
|
|
126
134
|
/**
|
|
127
135
|
* Authenticate/authorize the transaction with the given credentials.
|
|
128
136
|
* You can specify one or more credentials, so the transaction
|
|
129
137
|
* is able to access elements with different authn providers.
|
|
130
138
|
*/
|
|
131
|
-
auth<Auth extends AuthRequest<keyof S['authnUsers']>>(
|
|
139
|
+
auth<Auth extends AuthRequest<keyof S['authnUsers']>>(tokens?: Auth): DaemonTrx<S, M, { [K in keyof Auth]: S["authnUsers"][K & keyof S["authnUsers"]]; }>;
|
|
132
140
|
/**
|
|
133
141
|
* Run a method inside the transaction.
|
|
134
142
|
*
|
package/lib/engine/daemon.js
CHANGED
|
@@ -168,13 +168,20 @@ class DaemonTrx {
|
|
|
168
168
|
constructor(trxEngine) {
|
|
169
169
|
this.trxEngine = trxEngine;
|
|
170
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Inherit authentication from another transaction node.
|
|
173
|
+
*/
|
|
174
|
+
auth_inherit(trx) {
|
|
175
|
+
this._inherit = trx;
|
|
176
|
+
return this;
|
|
177
|
+
}
|
|
171
178
|
/**
|
|
172
179
|
* Authenticate/authorize the transaction with the given credentials.
|
|
173
180
|
* You can specify one or more credentials, so the transaction
|
|
174
181
|
* is able to access elements with different authn providers.
|
|
175
182
|
*/
|
|
176
|
-
auth(
|
|
177
|
-
this.
|
|
183
|
+
auth(tokens) {
|
|
184
|
+
this.tokens = tokens;
|
|
178
185
|
return this;
|
|
179
186
|
}
|
|
180
187
|
/**
|
|
@@ -184,7 +191,13 @@ class DaemonTrx {
|
|
|
184
191
|
* @returns A `TrxStatus` containing metadata about the transaction and the function response
|
|
185
192
|
*/
|
|
186
193
|
run(fn, id) {
|
|
187
|
-
|
|
194
|
+
const inheritedAuth = this._inherit?.auth;
|
|
195
|
+
const tokens = {
|
|
196
|
+
...inheritedAuth?.tokens,
|
|
197
|
+
...this.tokens
|
|
198
|
+
};
|
|
199
|
+
const users = inheritedAuth?.users;
|
|
200
|
+
return this.trxEngine.trx(fn, id, tokens, users);
|
|
188
201
|
}
|
|
189
202
|
/**
|
|
190
203
|
* Run a method inside the transaction, and hold it until
|
|
@@ -194,7 +207,13 @@ class DaemonTrx {
|
|
|
194
207
|
* @returns A `TrxStatus` containing metadata about the transaction and the function response
|
|
195
208
|
*/
|
|
196
209
|
run_and_hold(fn, id) {
|
|
197
|
-
|
|
210
|
+
const inheritedAuth = this._inherit.auth;
|
|
211
|
+
const tokens = {
|
|
212
|
+
...inheritedAuth?.tokens,
|
|
213
|
+
...this.tokens
|
|
214
|
+
};
|
|
215
|
+
const users = inheritedAuth?.users;
|
|
216
|
+
return this.trxEngine.trx_hold(fn, id, tokens, users);
|
|
198
217
|
}
|
|
199
218
|
}
|
|
200
219
|
exports.DaemonTrx = DaemonTrx;
|
|
@@ -7,6 +7,7 @@ import { CreateObj, PatchObj, PutObj } from "../../../elements/entities/bucket/b
|
|
|
7
7
|
import { NQL_Query } from "../../../elements/entities/bucket/query/nql.schema";
|
|
8
8
|
import { NesoiFile } from "../../data/file";
|
|
9
9
|
import { Tag } from "../../dependency";
|
|
10
|
+
import { DriveAdapter } from "../../../elements/entities/drive/drive_adapter";
|
|
10
11
|
/**
|
|
11
12
|
* @category Engine
|
|
12
13
|
* @subcategory Transaction
|
|
@@ -229,8 +230,8 @@ export declare class BucketUnsafeTrxNode<M extends $Module, $ extends $Bucket> {
|
|
|
229
230
|
*/
|
|
230
231
|
export declare class BucketDriveTrxNode<M extends $Module, $ extends $Bucket> {
|
|
231
232
|
private bucketTrx;
|
|
232
|
-
private
|
|
233
|
-
constructor(bucketTrx: BucketTrxNode<M, $>,
|
|
233
|
+
private drive;
|
|
234
|
+
constructor(bucketTrx: BucketTrxNode<M, $>, drive: DriveAdapter);
|
|
234
235
|
/**
|
|
235
236
|
* Read the contents of a File of this bucket's drive
|
|
236
237
|
*/
|
|
@@ -6,6 +6,7 @@ const bucket_query_trx_node_1 = require("./bucket_query.trx_node");
|
|
|
6
6
|
const error_1 = require("../../data/error");
|
|
7
7
|
const dependency_1 = require("../../dependency");
|
|
8
8
|
const external_trx_node_1 = require("./external.trx_node");
|
|
9
|
+
const daemon_1 = require("../../daemon");
|
|
9
10
|
/**
|
|
10
11
|
* @category Engine
|
|
11
12
|
* @subcategory Transaction
|
|
@@ -328,10 +329,18 @@ class BucketTrxNode {
|
|
|
328
329
|
* Methods to use the Bucket's drive (file storage).
|
|
329
330
|
*/
|
|
330
331
|
get drive() {
|
|
332
|
+
let drive;
|
|
331
333
|
if (!this.bucket) {
|
|
332
|
-
|
|
334
|
+
const module = trx_node_1.TrxNode.getModule(this.trx);
|
|
335
|
+
drive = daemon_1.Daemon.getBucketDrive(module.daemon, this.tag);
|
|
333
336
|
}
|
|
334
|
-
|
|
337
|
+
else {
|
|
338
|
+
drive = this.bucket.drive;
|
|
339
|
+
}
|
|
340
|
+
if (!drive) {
|
|
341
|
+
throw error_1.NesoiError.Bucket.Drive.NoAdapter({ bucket: this.bucket?.schema.alias || this.tag.full });
|
|
342
|
+
}
|
|
343
|
+
return new BucketDriveTrxNode(this, drive);
|
|
335
344
|
}
|
|
336
345
|
/*
|
|
337
346
|
Unsafe
|
|
@@ -436,19 +445,16 @@ exports.BucketUnsafeTrxNode = BucketUnsafeTrxNode;
|
|
|
436
445
|
* @subcategory Transaction
|
|
437
446
|
*/
|
|
438
447
|
class BucketDriveTrxNode {
|
|
439
|
-
constructor(bucketTrx,
|
|
448
|
+
constructor(bucketTrx, drive) {
|
|
440
449
|
this.bucketTrx = bucketTrx;
|
|
441
|
-
this.
|
|
442
|
-
if (!this.bucket.drive) {
|
|
443
|
-
throw error_1.NesoiError.Bucket.Drive.NoAdapter({ bucket: this.bucket.schema.alias });
|
|
444
|
-
}
|
|
450
|
+
this.drive = drive;
|
|
445
451
|
}
|
|
446
452
|
/**
|
|
447
453
|
* Read the contents of a File of this bucket's drive
|
|
448
454
|
*/
|
|
449
455
|
read(file, options) {
|
|
450
456
|
try {
|
|
451
|
-
return this.
|
|
457
|
+
return this.drive.read(file);
|
|
452
458
|
}
|
|
453
459
|
catch (e) {
|
|
454
460
|
if (options?.silent) {
|
|
@@ -463,7 +469,7 @@ class BucketDriveTrxNode {
|
|
|
463
469
|
*/
|
|
464
470
|
move(file, to, options) {
|
|
465
471
|
try {
|
|
466
|
-
return this.
|
|
472
|
+
return this.drive.move(file, to);
|
|
467
473
|
}
|
|
468
474
|
catch (e) {
|
|
469
475
|
if (options?.silent) {
|
|
@@ -478,7 +484,7 @@ class BucketDriveTrxNode {
|
|
|
478
484
|
*/
|
|
479
485
|
delete(file, options) {
|
|
480
486
|
try {
|
|
481
|
-
return this.
|
|
487
|
+
return this.drive.delete(file);
|
|
482
488
|
}
|
|
483
489
|
catch (e) {
|
|
484
490
|
if (options?.silent) {
|
|
@@ -26,7 +26,9 @@ class ExternalTrxNode {
|
|
|
26
26
|
});
|
|
27
27
|
let out;
|
|
28
28
|
try {
|
|
29
|
-
const res = await this.daemon.trx(this.tag.module)
|
|
29
|
+
const res = await this.daemon.trx(this.tag.module)
|
|
30
|
+
.auth_inherit(trx)
|
|
31
|
+
.run_and_hold(async (extTrx) => {
|
|
30
32
|
try {
|
|
31
33
|
return await fn(extTrx, element(extTrx));
|
|
32
34
|
}
|