nesoi 3.2.9 → 3.3.0
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 +33 -2
- package/lib/bundler/browser/browser.app.d.ts +32 -0
- package/lib/bundler/browser/browser.app.js +51 -0
- package/lib/bundler/browser/browser.bundler.d.ts +5 -0
- package/lib/bundler/browser/browser.bundler.js +27 -0
- package/lib/bundler/browser/stages/8_replace_nesoi_for_browser_stage.d.ts +13 -0
- package/lib/bundler/browser/stages/8_replace_nesoi_for_browser_stage.js +74 -0
- package/lib/bundler/distributed/distributed.app.config.d.ts +43 -0
- package/lib/{engine/apps → bundler}/distributed/distributed.app.config.js +1 -1
- package/lib/{engine/apps → bundler}/distributed/distributed.app.d.ts +14 -14
- package/lib/{engine/apps → bundler}/distributed/distributed.app.js +8 -3
- package/lib/{compiler/apps/distributed/distributed_compiler.d.ts → bundler/distributed/distributed.bundler.d.ts} +7 -7
- package/lib/{compiler/apps/distributed/distributed_compiler.js → bundler/distributed/distributed.bundler.js} +11 -11
- package/lib/{engine/apps → bundler}/distributed/distributed_node.app.d.ts +14 -20
- package/lib/{engine/apps → bundler}/distributed/distributed_node.app.js +18 -50
- package/lib/bundler/distributed/stages/1_mkdir_stage.d.ts +15 -0
- package/lib/{compiler/apps → bundler}/distributed/stages/1_mkdir_stage.js +6 -6
- package/lib/bundler/distributed/stages/2_build_typescript_stage.d.ts +15 -0
- package/lib/{compiler/apps → bundler}/distributed/stages/2_build_typescript_stage.js +7 -7
- package/lib/bundler/distributed/stages/3_copy_types_stage.d.ts +15 -0
- package/lib/{compiler/apps → bundler}/distributed/stages/3_copy_types_stage.js +7 -7
- package/lib/bundler/distributed/stages/4_dump_modules_stage.d.ts +16 -0
- package/lib/{compiler/apps → bundler}/distributed/stages/4_dump_modules_stage.js +5 -5
- package/lib/{compiler/apps → bundler}/distributed/stages/5_copy_static_stage.js +3 -3
- package/lib/{compiler/apps → bundler}/distributed/stages/6_dump_cli_stage.js +3 -3
- package/lib/{compiler/apps → bundler}/distributed/stages/7_dump_package_json_stage.js +3 -3
- package/lib/{engine/apps → bundler}/monolyth/monolyth.app.d.ts +13 -13
- package/lib/{engine/apps → bundler}/monolyth/monolyth.app.js +13 -10
- package/lib/{compiler/apps/monolyth/monolyth_compiler.d.ts → bundler/monolyth/monolyth.bundler.d.ts} +9 -7
- package/lib/{compiler/apps/monolyth/monolyth_compiler.js → bundler/monolyth/monolyth.bundler.js} +13 -12
- package/lib/bundler/monolyth/stages/1_mkdir_stage.d.ts +15 -0
- package/lib/{compiler/apps → bundler}/monolyth/stages/1_mkdir_stage.js +6 -6
- package/lib/bundler/monolyth/stages/2_build_typescript_stage.d.ts +15 -0
- package/lib/{compiler/apps → bundler}/monolyth/stages/2_build_typescript_stage.js +8 -7
- package/lib/bundler/monolyth/stages/3_copy_types_stage.d.ts +15 -0
- package/lib/{compiler/apps → bundler}/monolyth/stages/3_copy_types_stage.js +7 -7
- package/lib/{compiler/apps → bundler}/monolyth/stages/4_dump_modules_stage.d.ts +4 -4
- package/lib/{compiler/apps → bundler}/monolyth/stages/4_dump_modules_stage.js +29 -16
- package/lib/{compiler/apps → bundler}/monolyth/stages/5_copy_static_stage.d.ts +4 -4
- package/lib/{compiler/apps → bundler}/monolyth/stages/5_copy_static_stage.js +7 -7
- package/lib/bundler/monolyth/stages/6_dump_cli_stage.d.ts +15 -0
- package/lib/{compiler/apps → bundler}/monolyth/stages/6_dump_cli_stage.js +4 -4
- package/lib/{compiler/apps → bundler}/monolyth/stages/7_dump_package_json_stage.d.ts +4 -4
- package/lib/{compiler/apps → bundler}/monolyth/stages/7_dump_package_json_stage.js +13 -10
- package/lib/compiler/compiler.d.ts +1 -6
- package/lib/compiler/compiler.js +1 -1
- package/lib/compiler/elements/bucket.element.d.ts +2 -1
- package/lib/compiler/elements/bucket.element.js +16 -21
- package/lib/compiler/elements/cached.element.d.ts +1 -1
- package/lib/compiler/elements/cached.element.js +2 -2
- package/lib/compiler/elements/constants.element.d.ts +1 -1
- package/lib/compiler/elements/constants.element.js +2 -0
- package/lib/compiler/elements/controller.element.js +3 -3
- package/lib/compiler/elements/element.d.ts +6 -13
- package/lib/compiler/elements/element.js +11 -9
- package/lib/compiler/elements/externals.element.js +2 -2
- package/lib/compiler/elements/job.element.d.ts +1 -1
- package/lib/compiler/elements/job.element.js +1 -1
- package/lib/compiler/elements/machine.element.d.ts +2 -2
- package/lib/compiler/elements/machine.element.js +7 -7
- package/lib/compiler/elements/message.element.d.ts +1 -1
- package/lib/compiler/elements/message.element.js +26 -26
- package/lib/compiler/elements/queue.element.js +1 -1
- package/lib/compiler/elements/resource.element.d.ts +1 -1
- package/lib/compiler/elements/resource.element.js +9 -9
- package/lib/compiler/elements/topic.element.js +1 -1
- package/lib/compiler/error.d.ts +1 -5
- package/lib/compiler/error.js +3 -15
- package/lib/compiler/helpers/dump_helpers.d.ts +1 -1
- package/lib/compiler/helpers/dump_helpers.js +1 -1
- package/lib/compiler/index.d.ts +1 -3
- package/lib/compiler/index.js +15 -7
- package/lib/compiler/module.js +12 -12
- package/lib/compiler/progressive.d.ts +3 -4
- package/lib/compiler/progressive.js +3 -4
- package/lib/compiler/stages/2_treeshake_stage.js +4 -0
- package/lib/compiler/stages/3_extract_ts_stage.js +7 -7
- package/lib/compiler/stages/4_build_schemas_stage.js +3 -16
- package/lib/compiler/stages/6_build_elements_stage.js +1 -1
- package/lib/compiler/stages/7_dump_stage.js +35 -10
- package/lib/compiler/typescript/bridge/extract.js +24 -0
- package/lib/compiler/typescript/bridge/inject.js +18 -3
- package/lib/compiler/typescript/bridge/organize.d.ts +4 -0
- package/lib/compiler/typescript/bridge/organize.js +41 -22
- package/lib/compiler/typescript/error.d.ts +2 -83
- package/lib/compiler/typescript/error.js +6 -219
- package/lib/compiler/typescript/parser.js +3 -3
- package/lib/compiler/typescript/source.d.ts +2 -2
- package/lib/compiler/typescript/transformers/app_inject.transformer.js +13 -4
- package/lib/compiler/typescript/typescript_compiler.d.ts +3 -3
- package/lib/compiler/typescript/typescript_compiler.js +2 -2
- package/lib/elements/blocks/block.builder.d.ts +7 -4
- package/lib/elements/blocks/block.builder.js +24 -13
- package/lib/elements/blocks/block.js +2 -2
- package/lib/elements/blocks/block.schema.d.ts +12 -9
- package/lib/elements/blocks/block.schema.js +2 -2
- package/lib/elements/blocks/job/internal/machine_job.builder.d.ts +6 -5
- package/lib/elements/blocks/job/internal/machine_job.builder.js +3 -3
- package/lib/elements/blocks/job/internal/resource_job.builder.d.ts +11 -10
- package/lib/elements/blocks/job/internal/resource_job.builder.js +9 -6
- package/lib/elements/blocks/job/internal/resource_job.js +3 -6
- package/lib/elements/blocks/job/job.builder.d.ts +5 -5
- package/lib/elements/blocks/job/job.builder.js +7 -7
- package/lib/elements/blocks/job/job.js +1 -1
- package/lib/elements/blocks/job/job.schema.d.ts +5 -5
- package/lib/elements/blocks/job/job.schema.js +3 -3
- package/lib/elements/blocks/machine/machine.builder.d.ts +2 -2
- package/lib/elements/blocks/machine/machine.builder.js +12 -9
- package/lib/elements/blocks/machine/machine.js +7 -7
- package/lib/elements/blocks/machine/machine.schema.d.ts +23 -23
- package/lib/elements/blocks/machine/machine.schema.js +9 -9
- package/lib/elements/blocks/machine/machine_state.builder.d.ts +1 -0
- package/lib/elements/blocks/machine/machine_state.builder.js +31 -29
- package/lib/elements/blocks/machine/machine_transition.builder.d.ts +2 -2
- package/lib/elements/blocks/machine/machine_transition.builder.js +8 -8
- package/lib/elements/blocks/queue/queue.builder.d.ts +3 -3
- package/lib/elements/blocks/queue/queue.builder.js +3 -3
- package/lib/elements/blocks/queue/queue.schema.d.ts +6 -6
- package/lib/elements/blocks/queue/queue.schema.js +3 -3
- package/lib/elements/blocks/resource/resource.builder.d.ts +2 -2
- package/lib/elements/blocks/resource/resource.builder.js +37 -40
- package/lib/elements/blocks/resource/resource.d.ts +2 -2
- package/lib/elements/blocks/resource/resource.js +10 -18
- package/lib/elements/blocks/resource/resource.schema.d.ts +15 -15
- package/lib/elements/blocks/resource/resource.schema.js +8 -8
- package/lib/elements/blocks/topic/topic.builder.d.ts +2 -2
- package/lib/elements/blocks/topic/topic.builder.js +4 -4
- package/lib/elements/blocks/topic/topic.d.ts +2 -2
- package/lib/elements/blocks/topic/topic.js +7 -7
- package/lib/elements/blocks/topic/topic.schema.d.ts +6 -6
- package/lib/elements/blocks/topic/topic.schema.js +3 -3
- package/lib/elements/edge/controller/adapters/cli.controller_adapter.js +1 -1
- package/lib/elements/edge/controller/adapters/controller_adapter.d.ts +2 -2
- package/lib/elements/edge/controller/adapters/controller_adapter.js +2 -2
- package/lib/elements/edge/controller/controller.builder.d.ts +14 -13
- package/lib/elements/edge/controller/controller.builder.js +52 -42
- package/lib/elements/edge/controller/controller.d.ts +3 -3
- package/lib/elements/edge/controller/controller.js +12 -12
- package/lib/elements/edge/controller/controller.schema.d.ts +17 -16
- package/lib/elements/edge/controller/controller.schema.js +11 -11
- package/lib/elements/edge/externals/externals.builder.d.ts +8 -13
- package/lib/elements/edge/externals/externals.builder.js +43 -11
- package/lib/elements/edge/externals/externals.schema.d.ts +8 -7
- package/lib/elements/edge/externals/externals.schema.js +5 -3
- package/lib/elements/entities/bucket/adapters/browserdb.bucket_adapter.d.ts +45 -0
- package/lib/elements/entities/bucket/adapters/browserdb.bucket_adapter.js +164 -0
- package/lib/elements/entities/bucket/adapters/browserdb.service.d.ts +30 -0
- package/lib/elements/entities/bucket/adapters/browserdb.service.js +97 -0
- package/lib/elements/entities/bucket/adapters/bucket_adapter.d.ts +6 -1
- package/lib/elements/entities/bucket/adapters/bucket_adapter.js +7 -6
- package/lib/elements/entities/bucket/adapters/json.bucket_adapter.d.ts +1 -1
- package/lib/elements/entities/bucket/adapters/json.bucket_adapter.js +1 -0
- package/lib/elements/entities/bucket/adapters/memory.bucket_adapter.d.ts +1 -0
- package/lib/elements/entities/bucket/adapters/memory.bucket_adapter.js +14 -13
- package/lib/elements/entities/bucket/adapters/memory.nql.js +41 -35
- package/lib/elements/entities/bucket/bucket.builder.d.ts +6 -8
- package/lib/elements/entities/bucket/bucket.builder.js +19 -34
- package/lib/elements/entities/bucket/bucket.d.ts +2 -2
- package/lib/elements/entities/bucket/bucket.infer.d.ts +5 -5
- package/lib/elements/entities/bucket/bucket.js +19 -17
- package/lib/elements/entities/bucket/bucket.schema.d.ts +3 -3
- package/lib/elements/entities/bucket/bucket.schema.js +2 -2
- package/lib/elements/entities/bucket/cache/bucket_cache.js +14 -2
- package/lib/elements/entities/bucket/graph/bucket_graph.d.ts +3 -3
- package/lib/elements/entities/bucket/graph/bucket_graph.js +101 -29
- package/lib/elements/entities/bucket/graph/bucket_graph.schema.d.ts +3 -3
- package/lib/elements/entities/bucket/graph/bucket_graph_link.builder.d.ts +2 -2
- package/lib/elements/entities/bucket/graph/bucket_graph_link.builder.js +5 -3
- package/lib/elements/entities/bucket/model/bucket_model.builder.d.ts +2 -1
- package/lib/elements/entities/bucket/model/bucket_model.builder.js +2 -2
- package/lib/elements/entities/bucket/model/bucket_model.convert.js +3 -6
- package/lib/elements/entities/bucket/model/bucket_model.d.ts +13 -0
- package/lib/elements/entities/bucket/model/bucket_model.js +93 -0
- package/lib/elements/entities/bucket/model/bucket_model.schema.d.ts +4 -8
- package/lib/elements/entities/bucket/model/bucket_model.schema.js +0 -68
- package/lib/elements/entities/bucket/model/bucket_model_field.builder.d.ts +12 -4
- package/lib/elements/entities/bucket/model/bucket_model_field.builder.js +30 -33
- package/lib/elements/entities/bucket/query/nql.schema.d.ts +1 -1
- package/lib/elements/entities/bucket/query/nql_compiler.d.ts +8 -4
- package/lib/elements/entities/bucket/query/nql_compiler.js +44 -38
- package/lib/elements/entities/bucket/query/nql_engine.d.ts +1 -1
- package/lib/elements/entities/bucket/query/nql_engine.js +5 -2
- package/lib/elements/entities/bucket/view/bucket_view.builder.d.ts +2 -2
- package/lib/elements/entities/bucket/view/bucket_view.js +113 -81
- package/lib/elements/entities/bucket/view/bucket_view_field.builder.d.ts +9 -8
- package/lib/elements/entities/bucket/view/bucket_view_field.builder.js +8 -10
- package/lib/elements/entities/constants/constants.builder.d.ts +3 -3
- package/lib/elements/entities/constants/constants.builder.js +8 -8
- package/lib/elements/entities/constants/constants.schema.d.ts +8 -3
- package/lib/elements/entities/constants/constants.schema.js +7 -2
- package/lib/elements/entities/message/message.infer.d.ts +1 -5
- package/lib/elements/entities/message/message.js +2 -7
- package/lib/elements/entities/message/message.schema.js +1 -1
- package/lib/elements/entities/message/template/message_template.schema.d.ts +7 -5
- package/lib/elements/entities/message/template/message_template_field.builder.d.ts +18 -3
- package/lib/elements/entities/message/template/message_template_field.builder.js +49 -30
- package/lib/elements/entities/message/template/message_template_parser.js +2 -2
- package/lib/engine/{apps → app}/app.config.d.ts +11 -5
- package/lib/engine/{apps → app}/app.config.js +2 -2
- package/lib/engine/{apps → app}/app.d.ts +3 -2
- package/lib/engine/{apps → app}/app.js +3 -1
- package/lib/engine/{apps/distributed → app}/inc/inc.client.js +1 -1
- package/lib/engine/{apps/distributed → app}/inc/inc.server.js +3 -3
- package/lib/engine/{apps/distributed → app}/inc/sandbox.js +1 -1
- package/lib/engine/{apps → app}/inline.app.d.ts +2 -12
- package/lib/engine/{apps → app}/inline.app.js +37 -34
- package/lib/engine/auth/authn.d.ts +10 -12
- package/lib/engine/auth/zero.authn_provider.d.ts +3 -4
- package/lib/engine/auth/zero.authn_provider.js +0 -1
- package/lib/engine/builder.d.ts +28 -0
- package/lib/engine/builder.js +99 -0
- package/lib/engine/cli/cli.js +3 -2
- package/lib/engine/cli/ui.js +1 -0
- package/lib/engine/daemon.d.ts +28 -25
- package/lib/engine/daemon.js +37 -8
- package/lib/engine/data/error.d.ts +37 -3
- package/lib/engine/data/error.js +58 -16
- package/lib/engine/data/file.d.ts +1 -0
- package/lib/engine/data/file.js +4 -0
- package/lib/engine/dependency.d.ts +53 -81
- package/lib/engine/dependency.js +246 -120
- package/lib/engine/module.d.ts +18 -48
- package/lib/engine/module.js +78 -158
- package/lib/engine/space.d.ts +2 -2
- package/lib/engine/space.js +6 -6
- package/lib/engine/transaction/nodes/bucket.trx_node.d.ts +7 -4
- package/lib/engine/transaction/nodes/bucket.trx_node.js +66 -43
- package/lib/engine/transaction/nodes/bucket_query.trx_node.d.ts +10 -4
- package/lib/engine/transaction/nodes/bucket_query.trx_node.js +56 -45
- package/lib/engine/transaction/nodes/external.trx_node.d.ts +15 -0
- package/lib/engine/transaction/nodes/external.trx_node.js +53 -0
- package/lib/engine/transaction/nodes/job.trx_node.d.ts +7 -3
- package/lib/engine/transaction/nodes/job.trx_node.js +49 -29
- package/lib/engine/transaction/nodes/machine.trx_node.js +6 -6
- package/lib/engine/transaction/nodes/queue.trx_node.js +3 -3
- package/lib/engine/transaction/nodes/resource.trx_node.d.ts +7 -4
- package/lib/engine/transaction/nodes/resource.trx_node.js +68 -51
- package/lib/engine/transaction/nodes/topic.trx_node.js +9 -9
- package/lib/engine/transaction/trx.d.ts +15 -12
- package/lib/engine/transaction/trx.js +19 -3
- package/lib/engine/transaction/trx_engine.config.d.ts +4 -4
- package/lib/engine/transaction/trx_engine.d.ts +25 -7
- package/lib/engine/transaction/trx_engine.js +67 -16
- package/lib/engine/transaction/trx_node.d.ts +25 -21
- package/lib/engine/transaction/trx_node.js +99 -57
- package/lib/engine/tree.d.ts +4 -16
- package/lib/engine/tree.js +87 -57
- package/lib/{compiler → engine}/treeshake.d.ts +32 -32
- package/lib/{compiler → engine}/treeshake.js +272 -242
- package/lib/engine/util/console.js +3 -0
- package/lib/engine/util/crypto.d.ts +4 -3
- package/lib/engine/util/crypto.js +15 -5
- package/lib/engine/util/hash.js +5 -0
- package/lib/engine/util/log.d.ts +6 -8
- package/lib/engine/util/log.js +1 -1
- package/lib/engine/util/name_helpers.d.ts +37 -0
- package/lib/{compiler/helpers → engine/util}/name_helpers.js +33 -0
- package/lib/engine/util/parse.d.ts +4 -3
- package/lib/engine/util/parse.js +13 -28
- package/lib/engine/util/path.d.ts +1 -0
- package/lib/engine/util/path.js +14 -0
- package/lib/engine/util/random.d.ts +4 -0
- package/lib/engine/util/random.js +31 -0
- package/lib/engine/util/type.d.ts +8 -0
- package/lib/schema.d.ts +1 -1
- package/package.json +4 -1
- package/tools/joaquin/bucket.js +1 -1
- package/tools/joaquin/job.js +1 -1
- package/tools/joaquin/message.js +1 -1
- package/tools/joaquin/mock.js +2 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/lib/compiler/apps/distributed/stages/1_mkdir_stage.d.ts +0 -15
- package/lib/compiler/apps/distributed/stages/2_build_typescript_stage.d.ts +0 -15
- package/lib/compiler/apps/distributed/stages/3_copy_types_stage.d.ts +0 -15
- package/lib/compiler/apps/distributed/stages/4_dump_modules_stage.d.ts +0 -16
- package/lib/compiler/apps/monolyth/stages/1_mkdir_stage.d.ts +0 -15
- package/lib/compiler/apps/monolyth/stages/2_build_typescript_stage.d.ts +0 -15
- package/lib/compiler/apps/monolyth/stages/3_copy_types_stage.d.ts +0 -15
- package/lib/compiler/apps/monolyth/stages/6_dump_cli_stage.d.ts +0 -15
- package/lib/compiler/helpers/name_helpers.d.ts +0 -20
- package/lib/engine/apps/distributed/distributed.app.config.d.ts +0 -44
- package/lib/engine/apps/distributed/elements/distributed_job.d.ts +0 -7
- package/lib/engine/apps/distributed/elements/distributed_job.js +0 -11
- /package/lib/{compiler/apps → bundler}/distributed/stages/5_copy_static_stage.d.ts +0 -0
- /package/lib/{compiler/apps → bundler}/distributed/stages/6_dump_cli_stage.d.ts +0 -0
- /package/lib/{compiler/apps → bundler}/distributed/stages/7_dump_package_json_stage.d.ts +0 -0
- /package/lib/engine/{apps/distributed → app}/inc/inc.client.d.ts +0 -0
- /package/lib/engine/{apps/distributed → app}/inc/inc.server.d.ts +0 -0
- /package/lib/engine/{apps/distributed → app}/inc/sandbox.d.ts +0 -0
- /package/lib/engine/{apps → app}/service.d.ts +0 -0
- /package/lib/engine/{apps → app}/service.js +0 -0
|
@@ -18,7 +18,7 @@ export declare class NesoiCrypto {
|
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
*
|
|
21
|
-
* @param {
|
|
21
|
+
* @param {string} password - The password to be used for generating key
|
|
22
22
|
*
|
|
23
23
|
*/
|
|
24
24
|
static getKeyFromPassword(password: string, salt: string): string;
|
|
@@ -30,12 +30,13 @@ export declare class NesoiCrypto {
|
|
|
30
30
|
static encrypt(value: any, key: string): Promise<string>;
|
|
31
31
|
/**
|
|
32
32
|
*
|
|
33
|
-
* @param {
|
|
34
|
-
* @param {
|
|
33
|
+
* @param {string} ciphertext - Cipher text
|
|
34
|
+
* @param {string} key - The key to be used for decryption
|
|
35
35
|
*
|
|
36
36
|
* The caller of this function has the responsibility to clear
|
|
37
37
|
* the Buffer after the decryption to prevent the message text
|
|
38
38
|
* and the key from lingering in the memory
|
|
39
39
|
*/
|
|
40
40
|
static decrypt(ciphertext: string, key: string): Promise<any>;
|
|
41
|
+
static createHmac(text: string, sigKey: string): string;
|
|
41
42
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// TODO: Jest breaks with crypto types.
|
|
3
2
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4
3
|
//@ts-nocheck
|
|
5
4
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
@@ -7,11 +6,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
7
6
|
};
|
|
8
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
8
|
exports.NesoiCrypto = void 0;
|
|
9
|
+
/* @nesoi:browser ignore-start */
|
|
10
10
|
const crypto_1 = __importDefault(require("crypto"));
|
|
11
|
+
/* @nesoi:browser ignore-end */
|
|
12
|
+
/* @nesoi:browser add
|
|
13
|
+
const crypto = (window.crypto || window.msCrypto);
|
|
14
|
+
*/
|
|
15
|
+
const random_1 = require("./random");
|
|
11
16
|
class NesoiCrypto {
|
|
12
17
|
/**
|
|
13
18
|
*
|
|
14
|
-
* @param {
|
|
19
|
+
* @param {string} password - The password to be used for generating key
|
|
15
20
|
*
|
|
16
21
|
*/
|
|
17
22
|
static getKeyFromPassword(password, salt) {
|
|
@@ -26,7 +31,7 @@ class NesoiCrypto {
|
|
|
26
31
|
* @param {string} key - The key to be used for encryption
|
|
27
32
|
*/
|
|
28
33
|
static async encrypt(value, key) {
|
|
29
|
-
const iv =
|
|
34
|
+
const iv = random_1.Random.bytes(this.C.iv_bytes);
|
|
30
35
|
const aes_key = await crypto_1.default.subtle.importKey('raw', Buffer.from(key), 'AES-GCM', true, ['encrypt', 'decrypt']);
|
|
31
36
|
const encrypted = await crypto_1.default.subtle.encrypt({
|
|
32
37
|
name: 'AES-GCM',
|
|
@@ -37,8 +42,8 @@ class NesoiCrypto {
|
|
|
37
42
|
}
|
|
38
43
|
/**
|
|
39
44
|
*
|
|
40
|
-
* @param {
|
|
41
|
-
* @param {
|
|
45
|
+
* @param {string} ciphertext - Cipher text
|
|
46
|
+
* @param {string} key - The key to be used for decryption
|
|
42
47
|
*
|
|
43
48
|
* The caller of this function has the responsibility to clear
|
|
44
49
|
* the Buffer after the decryption to prevent the message text
|
|
@@ -57,6 +62,11 @@ class NesoiCrypto {
|
|
|
57
62
|
const decoded = Buffer.from(decrypted).toString('utf8');
|
|
58
63
|
return JSON.parse(decoded);
|
|
59
64
|
}
|
|
65
|
+
static createHmac(text, sigKey) {
|
|
66
|
+
return crypto_1.default.createHmac('sha1', sigKey)
|
|
67
|
+
.update(text)
|
|
68
|
+
.digest('hex');
|
|
69
|
+
}
|
|
60
70
|
}
|
|
61
71
|
exports.NesoiCrypto = NesoiCrypto;
|
|
62
72
|
NesoiCrypto.C = {
|
package/lib/engine/util/hash.js
CHANGED
|
@@ -5,7 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Hash = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
/* @nesoi:browser ignore-start */
|
|
8
9
|
const crypto_1 = __importDefault(require("crypto"));
|
|
10
|
+
/* @nesoi:browser ignore-end */
|
|
11
|
+
/* @nesoi:browser add
|
|
12
|
+
const crypto = (window.crypto || window.msCrypto);
|
|
13
|
+
*/
|
|
9
14
|
class Hash {
|
|
10
15
|
static file(filepath, algorithm = 'sha256') {
|
|
11
16
|
return new Promise(resolve => {
|
package/lib/engine/util/log.d.ts
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { $BlockType } from "../../elements/blocks/block.schema";
|
|
2
1
|
declare const LogLevel: readonly ["off", "error", "warn", "info", "debug", "trace"];
|
|
3
2
|
export type LogLevel = typeof LogLevel[number];
|
|
4
|
-
export
|
|
5
|
-
export declare function scopeTag(scope: LogScope, scope_id: string): string;
|
|
3
|
+
export declare function scopeTag(scope: string, scope_id: string): string;
|
|
6
4
|
export declare function anyScopeTag(scopeWithId: string): string;
|
|
7
5
|
export declare class Log {
|
|
8
6
|
static level: LogLevel;
|
|
9
7
|
private static l;
|
|
10
|
-
static error(scope:
|
|
11
|
-
static warn(scope:
|
|
12
|
-
static info(scope:
|
|
13
|
-
static debug(scope:
|
|
14
|
-
static trace(scope:
|
|
8
|
+
static error(scope: string, scope_id: string, message: string, obj?: Record<string, any>): void;
|
|
9
|
+
static warn(scope: string, scope_id: string, message: string, obj?: Record<string, any>): void;
|
|
10
|
+
static info(scope: string, scope_id: string, message: string, obj?: Record<string, any>): void;
|
|
11
|
+
static debug(scope: string, scope_id: string, message: string, obj?: Record<string, any>): void;
|
|
12
|
+
static trace(scope: string, scope_id: string, message: string, obj?: Record<string, any>): void;
|
|
15
13
|
private static push;
|
|
16
14
|
}
|
|
17
15
|
export {};
|
package/lib/engine/util/log.js
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ElementType } from "../../schema";
|
|
2
|
+
import { Tag, TagType } from '../dependency';
|
|
3
|
+
export type ParsedType = string | ({
|
|
4
|
+
[x: string]: ParsedType;
|
|
5
|
+
} & {
|
|
6
|
+
__array?: boolean;
|
|
7
|
+
__optional?: boolean;
|
|
8
|
+
});
|
|
9
|
+
export declare class NameHelpers {
|
|
10
|
+
static nameLowToHigh(low: string): string;
|
|
11
|
+
static nameHighToLow(high: string): string;
|
|
12
|
+
static unabbrevName(name: string, context: string): string;
|
|
13
|
+
static parseRefName(refName: string): {
|
|
14
|
+
module: string;
|
|
15
|
+
name: string;
|
|
16
|
+
} | {
|
|
17
|
+
name: string;
|
|
18
|
+
module?: undefined;
|
|
19
|
+
};
|
|
20
|
+
static names(schema: {
|
|
21
|
+
$t: ElementType | TagType;
|
|
22
|
+
name: string;
|
|
23
|
+
}): {
|
|
24
|
+
low: string;
|
|
25
|
+
high: string;
|
|
26
|
+
type: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Return the type name (UpperCamel) of the element
|
|
30
|
+
* referenced by a dependency.
|
|
31
|
+
*
|
|
32
|
+
* @param dep A `$Dependency` instance
|
|
33
|
+
* @param fromModule Name of dependant module
|
|
34
|
+
* @returns The type name of the dependency
|
|
35
|
+
*/
|
|
36
|
+
static tagType(tag: Tag, fromModule: string): string;
|
|
37
|
+
}
|
|
@@ -19,11 +19,20 @@ class NameHelpers {
|
|
|
19
19
|
}
|
|
20
20
|
return name;
|
|
21
21
|
}
|
|
22
|
+
static parseRefName(refName) {
|
|
23
|
+
if (refName.includes('::')) {
|
|
24
|
+
const [module, name] = refName.split('::');
|
|
25
|
+
return { module, name };
|
|
26
|
+
}
|
|
27
|
+
return { name: refName };
|
|
28
|
+
}
|
|
22
29
|
static names(schema) {
|
|
23
30
|
const lowName = schema.name;
|
|
24
31
|
const highName = this.nameLowToHigh(lowName);
|
|
25
32
|
const suffix = {
|
|
26
33
|
'constants': 'Constants',
|
|
34
|
+
'constants.enum': 'ConstantsEnum',
|
|
35
|
+
'constants.value': 'ConstantsValue',
|
|
27
36
|
'externals': 'Externals',
|
|
28
37
|
'bucket': 'Bucket',
|
|
29
38
|
'message': 'Message',
|
|
@@ -41,5 +50,29 @@ class NameHelpers {
|
|
|
41
50
|
type: typeName
|
|
42
51
|
};
|
|
43
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Return the type name (UpperCamel) of the element
|
|
55
|
+
* referenced by a dependency.
|
|
56
|
+
*
|
|
57
|
+
* @param dep A `$Dependency` instance
|
|
58
|
+
* @param fromModule Name of dependant module
|
|
59
|
+
* @returns The type name of the dependency
|
|
60
|
+
*/
|
|
61
|
+
static tagType(tag, fromModule) {
|
|
62
|
+
if (tag.module !== fromModule) {
|
|
63
|
+
const moduleHigh = NameHelpers.nameLowToHigh(tag.module);
|
|
64
|
+
// WARN: this might break non-regular plural block types in the future
|
|
65
|
+
const el_t = tag.type + 's';
|
|
66
|
+
return `${moduleHigh}Module['${el_t}']['${tag.name}']`;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
if (tag.type === 'constants.enum' || tag.type === 'constants.value') {
|
|
70
|
+
throw new Error('Constants/Enums have no direct Type');
|
|
71
|
+
}
|
|
72
|
+
return NameHelpers
|
|
73
|
+
.names({ $t: tag.type, name: tag.name })
|
|
74
|
+
.type;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
44
77
|
}
|
|
45
78
|
exports.NameHelpers = NameHelpers;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { NesoiDate } from '../data/date';
|
|
2
|
-
import { $MessageTemplateField, $MessageTemplateFields } from '../../elements/entities/message/template/message_template.schema';
|
|
2
|
+
import { $MessageTemplateField, $MessageTemplateFieldMeta, $MessageTemplateFields } from '../../elements/entities/message/template/message_template.schema';
|
|
3
3
|
import { $Module, BucketName, ViewName } from "../../schema";
|
|
4
4
|
import { AnyTrxNode } from '../transaction/trx_node';
|
|
5
5
|
import { NesoiDecimal } from '../data/decimal';
|
|
6
6
|
import { NesoiDatetime } from '../data/datetime';
|
|
7
7
|
import { NesoiFile } from '../data/file';
|
|
8
8
|
import { NesoiDuration } from '../data/duration';
|
|
9
|
+
import { Tag } from '../dependency';
|
|
9
10
|
export declare function parseBoolean(field: {
|
|
10
11
|
pathRaw: string;
|
|
11
12
|
alias: string;
|
|
@@ -30,7 +31,7 @@ export declare function parseEnum(raw: Record<string, any>, field: {
|
|
|
30
31
|
pathRaw: string;
|
|
31
32
|
name: string;
|
|
32
33
|
alias: string;
|
|
33
|
-
}, path: string[], value: any,
|
|
34
|
+
}, path: string[], value: any, meta: NonNullable<$MessageTemplateFieldMeta['enum']>, trx: AnyTrxNode): string;
|
|
34
35
|
export declare function parseFile(field: {
|
|
35
36
|
pathRaw: string;
|
|
36
37
|
name: string;
|
|
@@ -46,7 +47,7 @@ export declare function parseFloat_(field: {
|
|
|
46
47
|
export declare function parseId<M extends $Module, Name extends BucketName<M>, View extends ViewName<M['buckets'][Name]> | undefined>(field: {
|
|
47
48
|
pathRaw: string;
|
|
48
49
|
alias: string;
|
|
49
|
-
}, path: string[], value: any, trx: AnyTrxNode, bucket:
|
|
50
|
+
}, path: string[], value: any, trx: AnyTrxNode, bucket: Tag, type?: 'int' | 'string', view?: View): Promise<{
|
|
50
51
|
id: string | number;
|
|
51
52
|
obj: any;
|
|
52
53
|
}>;
|
package/lib/engine/util/parse.js
CHANGED
|
@@ -60,25 +60,18 @@ function parseDecimal(field, path, value) {
|
|
|
60
60
|
}
|
|
61
61
|
throw error_1.NesoiError.Message.InvalidFieldType({ alias: field.alias, path: path.join('.'), value, type: 'decimal' });
|
|
62
62
|
}
|
|
63
|
-
function parseEnum(raw, field, path, value,
|
|
63
|
+
function parseEnum(raw, field, path, value, meta, trx) {
|
|
64
64
|
if (typeof value === 'string') {
|
|
65
|
-
if (
|
|
66
|
-
let enumName = options;
|
|
67
|
-
const enumPath = enumName.match(/(.*)\.\{(.*)\}$/);
|
|
65
|
+
if (meta.enumpath) {
|
|
68
66
|
let _enum;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
try {
|
|
73
|
-
_enum = trx.enum(enumName);
|
|
74
|
-
}
|
|
75
|
-
catch {
|
|
76
|
-
throw error_1.NesoiError.Message.InvalidEnumScope({ alias: field.alias, path: path.join('.'), value: v, fieldpath: enumPath[2] });
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
67
|
+
const v = tree_1.Tree.get(raw, meta.enumpath[1]);
|
|
68
|
+
const enumName = meta.enumpath[0] + '.' + v;
|
|
69
|
+
try {
|
|
80
70
|
_enum = trx.enum(enumName);
|
|
81
71
|
}
|
|
72
|
+
catch {
|
|
73
|
+
throw error_1.NesoiError.Message.InvalidEnumScope({ alias: field.alias, path: path.join('.'), value: v, fieldpath: meta.enumpath[1] });
|
|
74
|
+
}
|
|
82
75
|
const keys = _enum.keys();
|
|
83
76
|
if (keys.includes(value)) {
|
|
84
77
|
return value;
|
|
@@ -87,20 +80,12 @@ function parseEnum(raw, field, path, value, options, trx) {
|
|
|
87
80
|
throw error_1.NesoiError.Message.InvalidFieldEnumValue({ alias: field.alias, path: path.join('.'), value, type: 'enum', options: keys });
|
|
88
81
|
}
|
|
89
82
|
}
|
|
90
|
-
else
|
|
91
|
-
if (options
|
|
83
|
+
else {
|
|
84
|
+
if (value in meta.options) {
|
|
92
85
|
return value;
|
|
93
86
|
}
|
|
94
87
|
else {
|
|
95
|
-
throw error_1.NesoiError.Message.InvalidFieldEnumValue({ alias: field.alias, path: path.join('.'), value, type: 'enum', options });
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
else if (typeof options === 'object') {
|
|
99
|
-
if (value in options) {
|
|
100
|
-
return options[value];
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
throw error_1.NesoiError.Message.InvalidFieldEnumValue({ alias: field.alias, path: path.join('.'), value, type: 'enum', options: Object.keys(options) });
|
|
88
|
+
throw error_1.NesoiError.Message.InvalidFieldEnumValue({ alias: field.alias, path: path.join('.'), value, type: 'enum', options: Object.keys(meta.options) });
|
|
104
89
|
}
|
|
105
90
|
}
|
|
106
91
|
}
|
|
@@ -147,8 +132,8 @@ async function parseId(field, path, value, trx, bucket, type, view) {
|
|
|
147
132
|
return {
|
|
148
133
|
id: val,
|
|
149
134
|
obj: view
|
|
150
|
-
? await trx.bucket(bucket).viewOneOrFail(val, view)
|
|
151
|
-
: await trx.bucket(bucket).readOneOrFail(val)
|
|
135
|
+
? await trx.bucket(bucket.short).viewOneOrFail(val, view)
|
|
136
|
+
: await trx.bucket(bucket.short).readOneOrFail(val)
|
|
152
137
|
};
|
|
153
138
|
}
|
|
154
139
|
function parseInt_(field, path, value) {
|
package/lib/engine/util/path.js
CHANGED
|
@@ -88,5 +88,19 @@ class Path {
|
|
|
88
88
|
}
|
|
89
89
|
return paths;
|
|
90
90
|
}
|
|
91
|
+
static allFiles(dir, filelist = []) {
|
|
92
|
+
const files = fs.readdirSync(dir);
|
|
93
|
+
filelist ?? (filelist = []);
|
|
94
|
+
files.forEach(file => {
|
|
95
|
+
const p = path.join(dir, file);
|
|
96
|
+
if (fs.statSync(p).isDirectory()) {
|
|
97
|
+
filelist = this.allFiles(p, filelist);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
filelist.push(p);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
return filelist;
|
|
104
|
+
}
|
|
91
105
|
}
|
|
92
106
|
exports.Path = Path;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Random = void 0;
|
|
7
|
+
/* @nesoi:browser ignore-start */
|
|
8
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
9
|
+
/* @nesoi:browser ignore-end */
|
|
10
|
+
/* @nesoi:browser add
|
|
11
|
+
const crypto = (window.crypto || window.msCrypto);
|
|
12
|
+
*/
|
|
13
|
+
class Random {
|
|
14
|
+
static uuid() {
|
|
15
|
+
return crypto_1.default.randomUUID();
|
|
16
|
+
}
|
|
17
|
+
static bytes(n) {
|
|
18
|
+
/* @nesoi:browser ignore-start */
|
|
19
|
+
return crypto_1.default.randomBytes(n);
|
|
20
|
+
/* @nesoi:browser ignore-end */
|
|
21
|
+
/* @nesoi:browser add
|
|
22
|
+
const QUOTA = 65536;
|
|
23
|
+
const a = new Uint8Array(n);
|
|
24
|
+
for (let i = 0; i < n; i += QUOTA) {
|
|
25
|
+
crypto.getRandomValues(a.subarray(i, i + Math.min(n - i, QUOTA)));
|
|
26
|
+
}
|
|
27
|
+
return a;
|
|
28
|
+
*/
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.Random = Random;
|
|
@@ -8,3 +8,11 @@ export type MergeUnion<T> = {
|
|
|
8
8
|
export type UnionToIntersection<T> = {
|
|
9
9
|
[K in T as K & string]: K;
|
|
10
10
|
}[any];
|
|
11
|
+
export type TypeAsObj = string | ({
|
|
12
|
+
[x: string]: TypeAsObj;
|
|
13
|
+
} & {
|
|
14
|
+
__array?: boolean;
|
|
15
|
+
__optional?: boolean;
|
|
16
|
+
__or?: TypeAsObj;
|
|
17
|
+
});
|
|
18
|
+
export type ObjTypeAsObj = TypeAsObj & Record<string, any>;
|
package/lib/schema.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { $Resource } from './elements/blocks/resource/resource.schema';
|
|
|
9
9
|
import { $Queue } from './elements/blocks/queue/queue.schema';
|
|
10
10
|
import { $Externals } from './elements/edge/externals/externals.schema';
|
|
11
11
|
import { $Topic } from './elements/blocks/topic/topic.schema';
|
|
12
|
-
export type
|
|
12
|
+
export type ElementType = 'constants' | 'externals' | 'message' | 'bucket' | 'job' | 'resource' | 'machine' | 'controller' | 'queue' | 'topic';
|
|
13
13
|
export type $Space = {
|
|
14
14
|
authnUsers: {
|
|
15
15
|
[x: string]: User;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nesoi",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Declarative framework for data-driven applications",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,5 +17,8 @@
|
|
|
17
17
|
"homepage": "https://github.com/nesoi-org/nesoi#readme",
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"@types/node": ">=20"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@types/web": "^0.0.262"
|
|
20
23
|
}
|
|
21
24
|
}
|
package/tools/joaquin/bucket.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.givenBucket = givenBucket;
|
|
4
4
|
exports.expectBucket = expectBucket;
|
|
5
5
|
const bucket_builder_1 = require("../../src/elements/entities/bucket/bucket.builder");
|
|
6
|
-
const inline_app_1 = require("../../src/engine/
|
|
6
|
+
const inline_app_1 = require("../../src/engine/app/inline.app");
|
|
7
7
|
const elements_1 = require("../../src/elements");
|
|
8
8
|
function givenBucket(name, def) {
|
|
9
9
|
const builder = new bucket_builder_1.BucketBuilder('test', name);
|
package/tools/joaquin/job.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.expectJob = expectJob;
|
|
4
4
|
const job_builder_1 = require("../../src/elements/blocks/job/job.builder");
|
|
5
|
-
const inline_app_1 = require("../../src/engine/
|
|
5
|
+
const inline_app_1 = require("../../src/engine/app/inline.app");
|
|
6
6
|
function expectJob(def) {
|
|
7
7
|
const builder = new job_builder_1.JobBuilder('test', 'test');
|
|
8
8
|
def(builder);
|
package/tools/joaquin/message.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.expectMessage = expectMessage;
|
|
4
4
|
const message_builder_1 = require("../../src/elements/entities/message/message.builder");
|
|
5
|
-
const inline_app_1 = require("../../src/engine/
|
|
5
|
+
const inline_app_1 = require("../../src/engine/app/inline.app");
|
|
6
6
|
function expectMessage(def, inject = []) {
|
|
7
7
|
const builder = new message_builder_1.MessageBuilder('test', 'test');
|
|
8
8
|
builder.template(def);
|
package/tools/joaquin/mock.js
CHANGED
|
@@ -86,7 +86,8 @@ class BucketMockObj {
|
|
|
86
86
|
return dict;
|
|
87
87
|
}
|
|
88
88
|
else if (field.type === 'enum') {
|
|
89
|
-
|
|
89
|
+
const options = Object.values(field.meta.enum.options);
|
|
90
|
+
return options[Math.floor(Math.random() * options.length)];
|
|
90
91
|
}
|
|
91
92
|
else if (field.type === 'file') {
|
|
92
93
|
// TODO
|