nesoi 3.2.8 → 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 +24 -22
- 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 +102 -30
- 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
|
@@ -33,233 +33,20 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
36
|
+
exports.TypescriptParserError = void 0;
|
|
37
37
|
const ts = __importStar(require("typescript"));
|
|
38
|
-
class
|
|
39
|
-
constructor(message) {
|
|
40
|
-
super(message);
|
|
41
|
-
}
|
|
42
|
-
static DirectoryDoesntExists(dir) {
|
|
43
|
-
return new MetaError(`Directory doesnt exists: ${dir}.`);
|
|
44
|
-
}
|
|
45
|
-
static FileDoesntExist(path) {
|
|
46
|
-
return new MetaError(`File doesn't exist: ${path}`);
|
|
47
|
-
}
|
|
48
|
-
static NoModulesFolder() {
|
|
49
|
-
return new MetaError('No modules folder found on project root.');
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.MetaError = MetaError;
|
|
53
|
-
class ParserError extends Error {
|
|
38
|
+
class TypescriptParserError extends Error {
|
|
54
39
|
constructor(message) {
|
|
55
40
|
super(message);
|
|
56
41
|
}
|
|
57
42
|
static ObjectPropertyIsNotAssignment() {
|
|
58
|
-
return new
|
|
43
|
+
return new TypescriptParserError('Object property is not an assignment.');
|
|
59
44
|
}
|
|
60
45
|
static StrangeValueKind(kind) {
|
|
61
|
-
throw new
|
|
46
|
+
throw new TypescriptParserError(`Strange value kind ${ts.SyntaxKind[kind]}`);
|
|
62
47
|
}
|
|
63
48
|
static StrangeTypeKind(kind) {
|
|
64
|
-
throw new
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
exports.ParserError = ParserError;
|
|
68
|
-
class ConstParserError extends Error {
|
|
69
|
-
constructor(message) {
|
|
70
|
-
super(message);
|
|
71
|
-
}
|
|
72
|
-
static ConstValueIsWrongKind(kind) {
|
|
73
|
-
throw new MetaError(`Constant value is of wrong kind (${kind})`);
|
|
74
|
-
}
|
|
75
|
-
static ConstValueIsStrange() {
|
|
76
|
-
throw new MetaError('Constant value should be $.static or $.app');
|
|
77
|
-
}
|
|
78
|
-
static ConstEnumIsWrongKind(kind) {
|
|
79
|
-
throw new MetaError(`Constant enum is of wrong kind (${kind})`);
|
|
80
|
-
}
|
|
81
|
-
static ConstEnumReturnIsWrongKind(kind) {
|
|
82
|
-
throw new MetaError(`Constant enum return is of wrong kind (${kind})`);
|
|
83
|
-
}
|
|
84
|
-
static ConstEnumOptionIsWrongKind(kind) {
|
|
85
|
-
throw new MetaError(`Constant enum option is of wrong kind (${kind})`);
|
|
86
|
-
}
|
|
87
|
-
static ConstEnumOptionIsStrange() {
|
|
88
|
-
throw new MetaError('Constant enum option should be $.opt');
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
exports.ConstParserError = ConstParserError;
|
|
92
|
-
class ControllerParserError extends Error {
|
|
93
|
-
constructor(message) {
|
|
94
|
-
super(message);
|
|
95
|
-
}
|
|
96
|
-
static ControllerIsWrongKind(kind) {
|
|
97
|
-
throw new MetaError(`Controller is of wrong kind (${kind})`);
|
|
98
|
-
}
|
|
99
|
-
static ControllerEndpointIsWrongKind(kind) {
|
|
100
|
-
throw new MetaError(`Controller endpoint is of wrong kind (${kind})`);
|
|
101
|
-
}
|
|
102
|
-
static ControllerEndpointDefIsWrongKind(kind) {
|
|
103
|
-
throw new MetaError(`Controller endpoint def is of wrong kind (${kind})`);
|
|
104
|
-
}
|
|
105
|
-
static ControllerEndpointHasNoName() {
|
|
106
|
-
throw new MetaError('Controller endpoint has no name');
|
|
107
|
-
}
|
|
108
|
-
static ControllerEndpointHasNoMessage() {
|
|
109
|
-
throw new MetaError('Controller endpoint declares no .msg()');
|
|
110
|
-
}
|
|
111
|
-
static ControllerGroupIsWrongKind(kind) {
|
|
112
|
-
throw new MetaError(`Controller group is of wrong kind (${kind})`);
|
|
113
|
-
}
|
|
114
|
-
static ControllerGroupHasNoName() {
|
|
115
|
-
throw new MetaError('Controller group has no name');
|
|
116
|
-
}
|
|
117
|
-
static ControllerGroupDefIsWrongKind(kind) {
|
|
118
|
-
throw new MetaError(`Controller group def is of wrong kind (${kind})`);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
exports.ControllerParserError = ControllerParserError;
|
|
122
|
-
class MsgParserError extends Error {
|
|
123
|
-
constructor(message) {
|
|
124
|
-
super(message);
|
|
125
|
-
}
|
|
126
|
-
static MessageHasNoTemplate() {
|
|
127
|
-
throw new MetaError('Message has no template');
|
|
128
|
-
}
|
|
129
|
-
static MessageTemplateIsWrongKind(kind) {
|
|
130
|
-
throw new MetaError(`Message template is of wrong kind (${kind})`);
|
|
131
|
-
}
|
|
132
|
-
static MessageTemplateFieldIsWrongKind(kind) {
|
|
133
|
-
throw new MetaError(`Message template field is of wrong kind (${kind})`);
|
|
134
|
-
}
|
|
135
|
-
static MessageTemplateFieldHasNoType() {
|
|
136
|
-
throw new MetaError('Message template field has no type');
|
|
137
|
-
}
|
|
138
|
-
static MessageMultiTemplateIsWrongKind(kind) {
|
|
139
|
-
throw new MetaError(`Message multi template is of wrong kind (${kind})`);
|
|
140
|
-
}
|
|
141
|
-
static MessageTemplateFieldEnumIsWrongKind(kind) {
|
|
142
|
-
throw new MetaError(`Message template field enum is of wrong kind (${kind})`);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
exports.MsgParserError = MsgParserError;
|
|
146
|
-
class EnumParserError extends Error {
|
|
147
|
-
constructor(message) {
|
|
148
|
-
super(message);
|
|
149
|
-
}
|
|
150
|
-
static ModelFieldEnumIsWrongKind(kind) {
|
|
151
|
-
throw new MetaError(`Model field enum is of wrong kind (${kind})`);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
exports.EnumParserError = EnumParserError;
|
|
155
|
-
class BucketParserError extends Error {
|
|
156
|
-
constructor(message) {
|
|
157
|
-
super(message);
|
|
158
|
-
}
|
|
159
|
-
static BucketHasNoModel() {
|
|
160
|
-
throw new MetaError('Bucket has no model');
|
|
161
|
-
}
|
|
162
|
-
static BucketModelIsWrongKind(kind) {
|
|
163
|
-
throw new MetaError(`Bucket model is of wrong kind (${kind})`);
|
|
164
|
-
}
|
|
165
|
-
static BucketModelFieldIsWrongKind(kind) {
|
|
166
|
-
throw new MetaError(`Bucket model field is of wrong kind (${kind})`);
|
|
167
|
-
}
|
|
168
|
-
static BucketModelFieldHasNoType() {
|
|
169
|
-
throw new MetaError('Bucket model field has no type');
|
|
170
|
-
}
|
|
171
|
-
static BucketHasNoGraph() {
|
|
172
|
-
throw new MetaError('Bucket has no graph');
|
|
173
|
-
}
|
|
174
|
-
static BucketGraphIsWrongKind(kind) {
|
|
175
|
-
throw new MetaError(`Bucket graph is of wrong kind (${kind})`);
|
|
176
|
-
}
|
|
177
|
-
static BucketGraphLinkIsWrongKind(kind) {
|
|
178
|
-
throw new MetaError(`Bucket graph field is of wrong kind (${kind})`);
|
|
179
|
-
}
|
|
180
|
-
static BucketGraphLinkHasNoType() {
|
|
181
|
-
throw new MetaError('Bucket graph field has no type');
|
|
182
|
-
}
|
|
183
|
-
static BucketGraphLinkInvalid() {
|
|
184
|
-
throw new MetaError('Bucket graph link is invalid');
|
|
185
|
-
}
|
|
186
|
-
static BucketHasNoView() {
|
|
187
|
-
throw new MetaError('Bucket has no view');
|
|
188
|
-
}
|
|
189
|
-
static BucketViewHasNoTemplate() {
|
|
190
|
-
throw new MetaError('Bucket view has no template');
|
|
191
|
-
}
|
|
192
|
-
static BucketViewIsWrongKind(kind) {
|
|
193
|
-
throw new MetaError(`Bucket view is of wrong kind (${kind})`);
|
|
194
|
-
}
|
|
195
|
-
static BucketViewFieldIsWrongKind(kind) {
|
|
196
|
-
throw new MetaError(`Bucket view field is of wrong kind (${kind})`);
|
|
197
|
-
}
|
|
198
|
-
static BucketViewFieldHasNoType() {
|
|
199
|
-
throw new MetaError('Bucket view field has no type');
|
|
200
|
-
}
|
|
201
|
-
static BucketViewFieldInvalid() {
|
|
202
|
-
throw new MetaError('Bucket view field is invalid');
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
exports.BucketParserError = BucketParserError;
|
|
206
|
-
class JobParserError extends Error {
|
|
207
|
-
constructor(message) {
|
|
208
|
-
super(message);
|
|
209
|
-
}
|
|
210
|
-
static JobHasNoTemplate() {
|
|
211
|
-
throw new MetaError('Job has no template');
|
|
212
|
-
}
|
|
213
|
-
static JobTemplateIsWrongKind(kind) {
|
|
214
|
-
throw new MetaError(`Job template is of wrong kind (${kind})`);
|
|
215
|
-
}
|
|
216
|
-
static JobTemplateFieldIsWrongKind(kind) {
|
|
217
|
-
throw new MetaError(`Job template field is of wrong kind (${kind})`);
|
|
218
|
-
}
|
|
219
|
-
static JobTemplateFieldHasNoType() {
|
|
220
|
-
throw new MetaError('Job template field has no type');
|
|
221
|
-
}
|
|
222
|
-
static JobAuthnHasInvalidValue() {
|
|
223
|
-
throw new MetaError('Job authn has invalid value');
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
exports.JobParserError = JobParserError;
|
|
227
|
-
class ResourceParserError extends Error {
|
|
228
|
-
constructor(message) {
|
|
229
|
-
super(message);
|
|
230
|
-
}
|
|
231
|
-
static ResourceJobInputHasNoTemplate() {
|
|
232
|
-
throw new MetaError('Resource job input has no template');
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
exports.ResourceParserError = ResourceParserError;
|
|
236
|
-
class HelperError extends Error {
|
|
237
|
-
constructor(message) {
|
|
238
|
-
super(message);
|
|
239
|
-
}
|
|
240
|
-
static ArrayElementIsNotString(kind) {
|
|
241
|
-
throw new MetaError(`Array element is not a string (${kind})`);
|
|
242
|
-
}
|
|
243
|
-
static NotAStringOrArray(kind) {
|
|
244
|
-
throw new MetaError(`Not a string or array (${kind})`);
|
|
245
|
-
}
|
|
246
|
-
static StringIsUndefined() {
|
|
247
|
-
throw new MetaError('String is undefined');
|
|
248
|
-
}
|
|
249
|
-
static NotAString(kind) {
|
|
250
|
-
throw new MetaError(`Not a string (${kind})`);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
exports.HelperError = HelperError;
|
|
254
|
-
class TypegenError extends Error {
|
|
255
|
-
constructor(message) {
|
|
256
|
-
super(message);
|
|
257
|
-
}
|
|
258
|
-
static BuildMethodNotCalled(context) {
|
|
259
|
-
return new MetaError(`Build method not called on ${context}.`);
|
|
260
|
-
}
|
|
261
|
-
static Resource_BucketRequired(context) {
|
|
262
|
-
return new MetaError(`Resource ${context} should specify a bucket.`);
|
|
49
|
+
throw new TypescriptParserError(`Strange type kind ${ts.SyntaxKind[kind]}`);
|
|
263
50
|
}
|
|
264
51
|
}
|
|
265
|
-
exports.
|
|
52
|
+
exports.TypescriptParserError = TypescriptParserError;
|
|
@@ -294,7 +294,7 @@ class Parser {
|
|
|
294
294
|
return new ParsedNode(node, 'value', 'token', '??');
|
|
295
295
|
}
|
|
296
296
|
console.error(node.getText());
|
|
297
|
-
throw error_1.
|
|
297
|
+
throw error_1.TypescriptParserError.StrangeValueKind(node.kind);
|
|
298
298
|
}
|
|
299
299
|
static parseObjectMembers(node) {
|
|
300
300
|
if (DEBUG_LOG)
|
|
@@ -306,7 +306,7 @@ class Parser {
|
|
|
306
306
|
continue;
|
|
307
307
|
}
|
|
308
308
|
if (!ts.isPropertyAssignment(prop)) {
|
|
309
|
-
throw error_1.
|
|
309
|
+
throw error_1.TypescriptParserError.ObjectPropertyIsNotAssignment();
|
|
310
310
|
}
|
|
311
311
|
const name = Parser.parseNode(prop.name).value;
|
|
312
312
|
properties[name] = Parser.parseNode(prop.initializer);
|
|
@@ -558,7 +558,7 @@ class Parser {
|
|
|
558
558
|
return new ParsedNode(node, 'type', 'identifier', this.parseNode(node.typeName)?.value);
|
|
559
559
|
}
|
|
560
560
|
console.error(node);
|
|
561
|
-
throw error_1.
|
|
561
|
+
throw error_1.TypescriptParserError.StrangeTypeKind(node.kind);
|
|
562
562
|
}
|
|
563
563
|
static parseTypeMembers(nodes) {
|
|
564
564
|
const parsed = {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as ts from 'typescript';
|
|
2
|
-
import {
|
|
2
|
+
import { ElementType } from "../../schema";
|
|
3
3
|
export declare class MetaSource {
|
|
4
4
|
sourceFile: ts.SourceFile;
|
|
5
5
|
filename: string;
|
|
6
6
|
imports: ts.ImportDeclaration[];
|
|
7
7
|
interfaces: Record<string, ts.InterfaceDeclaration>;
|
|
8
8
|
newExpressions: ts.NewExpression[];
|
|
9
|
-
nesoiCallExpressions: Partial<Record<
|
|
9
|
+
nesoiCallExpressions: Partial<Record<ElementType, Record<string, ts.CallExpression>>>;
|
|
10
10
|
constructor(sourceFile: ts.SourceFile);
|
|
11
11
|
private parseFile;
|
|
12
12
|
}
|
|
@@ -39,12 +39,15 @@ const parser_1 = require("../parser");
|
|
|
39
39
|
function makeAppInjectTransformer(modules) {
|
|
40
40
|
// @ts-expect-error This is according to documentation, but the type is broken for some reason
|
|
41
41
|
const transformer = (context) => {
|
|
42
|
+
let esnext = false;
|
|
42
43
|
const visit = (node) => {
|
|
43
44
|
// Find leaf node of builder which is a NewExpression
|
|
44
45
|
if (ts.isNewExpression(node)) {
|
|
45
|
-
|
|
46
|
+
const name = parser_1.Parser.parseNode(node.expression).value;
|
|
47
|
+
if (name !== 'MonolythApp' && name !== 'BrowserApp') {
|
|
46
48
|
return { monolyth: false, node };
|
|
47
49
|
}
|
|
50
|
+
esnext = name === 'BrowserApp';
|
|
48
51
|
return {
|
|
49
52
|
monolyth: true,
|
|
50
53
|
node: ts.factory.updateNewExpression(node, node.expression, node.typeArguments, [
|
|
@@ -69,9 +72,15 @@ function makeAppInjectTransformer(modules) {
|
|
|
69
72
|
return {
|
|
70
73
|
monolyth: true,
|
|
71
74
|
node: ts.factory.updateCallExpression(cNode, ts.factory.updatePropertyAccessExpression(cNode.expression, cNode.expression.expression, ts.factory.createIdentifier('inject')), cNode.typeArguments, [
|
|
72
|
-
ts.factory.createArrayLiteralExpression(modules.map(module =>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
ts.factory.createArrayLiteralExpression(modules.map(module => esnext
|
|
76
|
+
// (await import('...')).default
|
|
77
|
+
? ts.factory.createPropertyAccessExpression(ts.factory.createParenthesizedExpression(ts.factory.createAwaitExpression(ts.factory.createCallExpression(ts.factory.createIdentifier('import'), undefined, [
|
|
78
|
+
ts.factory.createStringLiteral(`./modules/${module}`, true)
|
|
79
|
+
]))), ts.factory.createIdentifier('default'))
|
|
80
|
+
// require('...').default
|
|
81
|
+
: ts.factory.createPropertyAccessExpression(ts.factory.createCallExpression(ts.factory.createIdentifier('require'), undefined, [
|
|
82
|
+
ts.factory.createStringLiteral(`./modules/${module}`, true)
|
|
83
|
+
]), ts.factory.createIdentifier('default'))), true)
|
|
75
84
|
])
|
|
76
85
|
};
|
|
77
86
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ts from 'typescript';
|
|
2
2
|
import { AnySpace } from "../../engine/space";
|
|
3
|
-
import {
|
|
3
|
+
import { ElementType } from "../../schema";
|
|
4
4
|
export type tsQueryResult<T = ts.Node> = {
|
|
5
5
|
path: string;
|
|
6
6
|
node: T;
|
|
@@ -33,14 +33,14 @@ export declare class TypeScriptCompiler {
|
|
|
33
33
|
private runQuery;
|
|
34
34
|
getReturnNode(node: ts.FunctionExpression | ts.ArrowFunction): ts.Expression | undefined;
|
|
35
35
|
getReturnType(node: ts.FunctionExpression | ts.ArrowFunction): string;
|
|
36
|
-
getFnText(node: ts.FunctionExpression | ts.ArrowFunction): string;
|
|
36
|
+
getFnText(node: ts.FunctionExpression | ts.ArrowFunction, type?: string): string;
|
|
37
37
|
getFnType(node: ts.FunctionExpression | ts.ArrowFunction): string;
|
|
38
38
|
getCallName(node: ts.Node): ts.__String | undefined;
|
|
39
39
|
isCall(node: ts.Node, from: ts.Symbol, method?: string): boolean;
|
|
40
40
|
private getSource;
|
|
41
41
|
getNesoiSymbol(name: string, path: string): ts.Symbol;
|
|
42
42
|
getPropPath(node: ts.PropertyAssignment): string;
|
|
43
|
-
findAllNesoiBuilders(node: ts.Node): Partial<Record<
|
|
43
|
+
findAllNesoiBuilders(node: ts.Node): Partial<Record<ElementType, Record<string, ts.Node>>>;
|
|
44
44
|
findAll(node: ts.Node, predicate: (node: ts.Node) => ts.Node[] | undefined): ts.Node[];
|
|
45
45
|
private findParent;
|
|
46
46
|
private findInCallChain;
|
|
@@ -363,11 +363,11 @@ class TypeScriptCompiler {
|
|
|
363
363
|
return this.checker.typeToString(fnReturnType, undefined, ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.NoTypeReduction | ts.TypeFormatFlags.UseFullyQualifiedType // TODO: this causes freaky imports
|
|
364
364
|
);
|
|
365
365
|
}
|
|
366
|
-
getFnText(node) {
|
|
366
|
+
getFnText(node, type) {
|
|
367
367
|
// This method is only used to generated intermediate schemas
|
|
368
368
|
// (the ones on the .nesoi folder). The function should have been
|
|
369
369
|
// evaluated before generating this schema, so the typing is useless here
|
|
370
|
-
return `(${node.getFullText()}) as (...args: any[]) => any`;
|
|
370
|
+
return `(${node.getFullText()})${type ?? ' as (...args: any[]) => any'}`;
|
|
371
371
|
}
|
|
372
372
|
getFnType(node) {
|
|
373
373
|
const type = this.checker.getTypeAtLocation(node);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { $Module, $Space } from "../../schema";
|
|
2
2
|
import { $BlockOutput, $BlockType } from './block.schema';
|
|
3
3
|
import { MessageTemplateDef } from "../entities/message/template/message_template.builder";
|
|
4
|
-
import {
|
|
4
|
+
import { BuilderNode, Dependency } from "../../engine/dependency";
|
|
5
5
|
/**
|
|
6
6
|
* @category Builders
|
|
7
7
|
* @subcategory Block
|
|
@@ -11,9 +11,12 @@ export declare abstract class BlockBuilder<Space extends $Space, Module extends
|
|
|
11
11
|
protected type: Type;
|
|
12
12
|
protected name: string;
|
|
13
13
|
protected _alias?: string;
|
|
14
|
-
protected
|
|
14
|
+
protected _auth: {
|
|
15
|
+
provider: string;
|
|
16
|
+
resolver?: (user: any) => boolean;
|
|
17
|
+
}[];
|
|
15
18
|
protected _inlineNodes: BuilderNode[];
|
|
16
|
-
protected _inputMsgs:
|
|
19
|
+
protected _inputMsgs: Dependency[];
|
|
17
20
|
protected _output?: $BlockOutput;
|
|
18
21
|
constructor(module: string, type: Type, name: string);
|
|
19
22
|
/** Block "human" name */
|
|
@@ -25,7 +28,7 @@ export declare abstract class BlockBuilder<Space extends $Space, Module extends
|
|
|
25
28
|
* @returns The Builder, for call-chaining
|
|
26
29
|
*/
|
|
27
30
|
protected message<Name extends string, Def extends MessageTemplateDef<Space, Module, Name>>(name: Name, def: Def): unknown;
|
|
28
|
-
|
|
31
|
+
auth<U extends keyof Space['authnUsers']>(provider: U, resolver?: (user: Space['authnUsers'][U]) => boolean): unknown;
|
|
29
32
|
protected _input(...names: string[]): unknown;
|
|
30
33
|
protected outputRaw(): unknown;
|
|
31
34
|
protected outputMsg(...msgs: string[]): unknown;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BlockBuilder = void 0;
|
|
4
4
|
const message_builder_1 = require("../entities/message/message.builder");
|
|
5
5
|
const dependency_1 = require("../../engine/dependency");
|
|
6
|
-
const name_helpers_1 = require("../../
|
|
6
|
+
const name_helpers_1 = require("../../engine/util/name_helpers");
|
|
7
7
|
/**
|
|
8
8
|
* @category Builders
|
|
9
9
|
* @subcategory Block
|
|
@@ -13,7 +13,7 @@ class BlockBuilder {
|
|
|
13
13
|
this.module = module;
|
|
14
14
|
this.type = type;
|
|
15
15
|
this.name = name;
|
|
16
|
-
this.
|
|
16
|
+
this._auth = [];
|
|
17
17
|
// References to all inline nodes, set during builder declaration (before build)
|
|
18
18
|
this._inlineNodes = [];
|
|
19
19
|
this._inputMsgs = [];
|
|
@@ -35,9 +35,7 @@ class BlockBuilder {
|
|
|
35
35
|
const builder = new message_builder_1.MessageBuilder(this.module, msgName)
|
|
36
36
|
.template(def);
|
|
37
37
|
this._inlineNodes.push(new dependency_1.BuilderNode({
|
|
38
|
-
|
|
39
|
-
type: 'message',
|
|
40
|
-
name: msgName,
|
|
38
|
+
tag: new dependency_1.Tag(this.module, 'message', msgName),
|
|
41
39
|
builder,
|
|
42
40
|
isInline: true,
|
|
43
41
|
filepath: [], // This is added later by Treeshake.blockInlineNodes()
|
|
@@ -46,18 +44,25 @@ class BlockBuilder {
|
|
|
46
44
|
return this;
|
|
47
45
|
}
|
|
48
46
|
// Authentication
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
auth(provider, resolver) {
|
|
48
|
+
this._auth ?? (this._auth = []);
|
|
49
|
+
// Replace by provider name
|
|
50
|
+
const match = this._auth.findIndex(opt => opt.provider === provider);
|
|
51
|
+
if (match >= 0) {
|
|
52
|
+
this._auth.splice(match, 1);
|
|
52
53
|
}
|
|
53
|
-
this.
|
|
54
|
+
this._auth.push({
|
|
55
|
+
provider: provider,
|
|
56
|
+
resolver
|
|
57
|
+
});
|
|
54
58
|
return this;
|
|
55
59
|
}
|
|
56
60
|
// Input/Output
|
|
57
61
|
_input(...names) {
|
|
58
62
|
names.forEach((name) => {
|
|
59
63
|
const fullName = name_helpers_1.NameHelpers.unabbrevName(name, this.name);
|
|
60
|
-
const
|
|
64
|
+
const tag = dependency_1.Tag.fromNameOrShort(this.module, 'message', fullName);
|
|
65
|
+
const dep = new dependency_1.Dependency(this.module, tag, { compile: true, runtime: true });
|
|
61
66
|
this._inputMsgs.push(dep);
|
|
62
67
|
});
|
|
63
68
|
return this;
|
|
@@ -70,7 +75,9 @@ class BlockBuilder {
|
|
|
70
75
|
this._output ?? (this._output = {});
|
|
71
76
|
(_a = this._output).msg ?? (_a.msg = []);
|
|
72
77
|
msgs.forEach(msg => {
|
|
73
|
-
|
|
78
|
+
const tag = dependency_1.Tag.fromNameOrShort(this.module, 'message', msg);
|
|
79
|
+
const dep = new dependency_1.Dependency(this.module, tag, { compile: true, runtime: true });
|
|
80
|
+
this._output.msg.push(dep.tag);
|
|
74
81
|
});
|
|
75
82
|
return this;
|
|
76
83
|
}
|
|
@@ -79,8 +86,10 @@ class BlockBuilder {
|
|
|
79
86
|
this._output ?? (this._output = {});
|
|
80
87
|
(_a = this._output).obj ?? (_a.obj = []);
|
|
81
88
|
objs.forEach(obj => {
|
|
89
|
+
const tag = dependency_1.Tag.fromNameOrShort(this.module, 'bucket', obj);
|
|
90
|
+
const dep = new dependency_1.Dependency(this.module, tag, { compile: true, runtime: true });
|
|
82
91
|
this._output?.obj?.push({
|
|
83
|
-
|
|
92
|
+
tag: dep.tag,
|
|
84
93
|
many: false
|
|
85
94
|
});
|
|
86
95
|
});
|
|
@@ -91,8 +100,10 @@ class BlockBuilder {
|
|
|
91
100
|
this._output ?? (this._output = {});
|
|
92
101
|
(_a = this._output).obj ?? (_a.obj = []);
|
|
93
102
|
objs.forEach(obj => {
|
|
103
|
+
const tag = dependency_1.Tag.fromNameOrShort(this.module, 'bucket', obj);
|
|
104
|
+
const dep = new dependency_1.Dependency(this.module, tag, { compile: true, runtime: true });
|
|
94
105
|
this._output?.obj?.push({
|
|
95
|
-
|
|
106
|
+
tag: dep.tag,
|
|
96
107
|
many: true
|
|
97
108
|
});
|
|
98
109
|
});
|
|
@@ -20,7 +20,7 @@ class Block {
|
|
|
20
20
|
if (typeof raw.$ !== 'string') {
|
|
21
21
|
throw error_1.NesoiError.Message.InvalidType({ type: raw.$ });
|
|
22
22
|
}
|
|
23
|
-
if (!this.schema.input.some(
|
|
23
|
+
if (!this.schema.input.some(tag => tag.module === this.module.name && tag.name === raw.$)) {
|
|
24
24
|
throw error_1.NesoiError.Block.MessageNotSupported({ block: this.schema.name, message: raw.$ });
|
|
25
25
|
}
|
|
26
26
|
const msg = (await trx.message(raw));
|
|
@@ -28,7 +28,7 @@ class Block {
|
|
|
28
28
|
}
|
|
29
29
|
async consume(trx, msg, ctx) {
|
|
30
30
|
log_1.Log.debug('trx', trx.globalId, `${(0, log_1.scopeTag)(this.type, this.schema.name)} Consume`, msg);
|
|
31
|
-
if (!this.schema.input.some(
|
|
31
|
+
if (!this.schema.input.some(tag => tag.module === this.module.name && tag.name === msg.$)) {
|
|
32
32
|
throw error_1.NesoiError.Block.MessageNotSupported({ block: this.schema.name, message: msg.$ });
|
|
33
33
|
}
|
|
34
34
|
return this.run(trx, msg, ctx);
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { TypeAsObj } from "../../
|
|
1
|
+
import { TypeAsObj } from "../../engine/util/type";
|
|
2
2
|
import { $Message } from "../entities/message/message.schema";
|
|
3
|
-
import {
|
|
4
|
-
import { $Dependency } from "../../engine/dependency";
|
|
3
|
+
import { Tag } from "../../engine/dependency";
|
|
5
4
|
export type $BlockType = 'job' | 'resource' | 'machine' | 'queue' | 'topic';
|
|
6
5
|
export type $BlockOutput = {
|
|
7
6
|
raw?: TypeAsObj;
|
|
8
|
-
msg?:
|
|
7
|
+
msg?: Tag[];
|
|
9
8
|
obj?: {
|
|
10
|
-
|
|
9
|
+
tag: Tag;
|
|
11
10
|
many: boolean;
|
|
12
11
|
}[];
|
|
13
12
|
};
|
|
13
|
+
export type $BlockAuth = {
|
|
14
|
+
provider: string;
|
|
15
|
+
resolver?: (user: Record<string, any>) => boolean;
|
|
16
|
+
};
|
|
14
17
|
/**
|
|
15
18
|
* @category Schemas
|
|
16
19
|
* @subcategory Block
|
|
@@ -19,12 +22,12 @@ export declare class $Block {
|
|
|
19
22
|
module: string;
|
|
20
23
|
name: string;
|
|
21
24
|
alias: string;
|
|
22
|
-
|
|
23
|
-
input:
|
|
25
|
+
auth: $BlockAuth[];
|
|
26
|
+
input: Tag[];
|
|
24
27
|
output?: $BlockOutput | undefined;
|
|
25
28
|
$t: $BlockType;
|
|
26
|
-
'#authn':
|
|
29
|
+
'#authn': {};
|
|
27
30
|
'#input': $Message;
|
|
28
31
|
'#output': unknown;
|
|
29
|
-
constructor(module: string, name: string, alias: string,
|
|
32
|
+
constructor(module: string, name: string, alias: string, auth: $BlockAuth[], input: Tag[], output?: $BlockOutput | undefined);
|
|
30
33
|
}
|
|
@@ -6,11 +6,11 @@ exports.$Block = void 0;
|
|
|
6
6
|
* @subcategory Block
|
|
7
7
|
*/
|
|
8
8
|
class $Block {
|
|
9
|
-
constructor(module, name, alias,
|
|
9
|
+
constructor(module, name, alias, auth, input, output) {
|
|
10
10
|
this.module = module;
|
|
11
11
|
this.name = name;
|
|
12
12
|
this.alias = alias;
|
|
13
|
-
this.
|
|
13
|
+
this.auth = auth;
|
|
14
14
|
this.input = input;
|
|
15
15
|
this.output = output;
|
|
16
16
|
this.$t = 'block';
|
|
@@ -2,8 +2,9 @@ import { $Module, $Space } from "../../../../schema";
|
|
|
2
2
|
import { $Job, $JobAssert, $JobMethod } from '../job.schema';
|
|
3
3
|
import { TrxNode } from "../../../../engine/transaction/trx_node";
|
|
4
4
|
import { BlockBuilder } from '../../block.builder';
|
|
5
|
-
import {
|
|
5
|
+
import { Dependency, ResolvedBuilderNode, Tag } from "../../../../engine/dependency";
|
|
6
6
|
import { Overlay } from "../../../../engine/util/type";
|
|
7
|
+
import { $BlockAuth } from '../../block.schema';
|
|
7
8
|
/**
|
|
8
9
|
* @category Builders
|
|
9
10
|
* @subcategory Block
|
|
@@ -12,14 +13,14 @@ export declare class MachineJobBuilder<Space extends $Space, Module extends $Mod
|
|
|
12
13
|
protected module: string;
|
|
13
14
|
protected name: Name;
|
|
14
15
|
private alias;
|
|
15
|
-
protected
|
|
16
|
-
protected _inputMsgs:
|
|
16
|
+
protected _auth: $BlockAuth[];
|
|
17
|
+
protected _inputMsgs: Dependency[];
|
|
17
18
|
$b: "job";
|
|
18
19
|
$j: "MachineJob";
|
|
19
20
|
private _extrasAndAsserts;
|
|
20
21
|
private _method?;
|
|
21
22
|
private machine;
|
|
22
|
-
constructor(module: string, name: Name, alias: string,
|
|
23
|
+
constructor(module: string, name: Name, alias: string, _auth?: $BlockAuth[], _inputMsgs?: Dependency[]);
|
|
23
24
|
/**
|
|
24
25
|
* A function that will build new fields on the input message to be
|
|
25
26
|
* consumed by the job.
|
|
@@ -45,7 +46,7 @@ export declare class MachineJobBuilder<Space extends $Space, Module extends $Mod
|
|
|
45
46
|
*/
|
|
46
47
|
method<Trx = NoInfer<TrxNode<Space, Module, Job['#authn']>>, Msg = NoInfer<Job['#input']['#parsed']>, Extras = NoInfer<Job['#extra']>, C = NoInfer<Ctx>>(action: $JobMethod<Trx, Msg, any, Extras, C>): this;
|
|
47
48
|
/** Build */
|
|
48
|
-
static build(node: MachineJobBuilderNode, input:
|
|
49
|
+
static build(node: MachineJobBuilderNode, input: Tag[]): $Job;
|
|
49
50
|
}
|
|
50
51
|
export type AnyMachineJobBuilder = MachineJobBuilder<any, any, any, any, any>;
|
|
51
52
|
export type MachineJobDef<S extends $Space, M extends $Module, Name extends string, Job extends $Job, Ctx = {}> = ($: MachineJobBuilder<S, M, Name, Job, Ctx>) => void;
|
|
@@ -12,12 +12,12 @@ const error_1 = require("../../../../engine/data/error");
|
|
|
12
12
|
* @subcategory Block
|
|
13
13
|
*/
|
|
14
14
|
class MachineJobBuilder extends block_builder_1.BlockBuilder {
|
|
15
|
-
constructor(module, name, alias,
|
|
15
|
+
constructor(module, name, alias, _auth = [], _inputMsgs = []) {
|
|
16
16
|
super(module, 'job', name);
|
|
17
17
|
this.module = module;
|
|
18
18
|
this.name = name;
|
|
19
19
|
this.alias = alias;
|
|
20
|
-
this.
|
|
20
|
+
this._auth = _auth;
|
|
21
21
|
this._inputMsgs = _inputMsgs;
|
|
22
22
|
this.$b = 'job';
|
|
23
23
|
this.$j = 'MachineJob';
|
|
@@ -67,7 +67,7 @@ class MachineJobBuilder extends block_builder_1.BlockBuilder {
|
|
|
67
67
|
if (!node.builder._method) {
|
|
68
68
|
throw error_1.NesoiError.Builder.Job.NoMethod({ job: node.builder.name });
|
|
69
69
|
}
|
|
70
|
-
node.schema = new job_schema_1.$Job(node.builder.module, node.builder.name, node.builder.alias || node.builder.name, node.builder.
|
|
70
|
+
node.schema = new job_schema_1.$Job(node.builder.module, node.builder.name, node.builder.alias || node.builder.name, node.builder._auth, [...node.builder._inputMsgs.map(m => m.tag), ...input], {}, node.builder._extrasAndAsserts, node.builder._method, {
|
|
71
71
|
module: node.builder.module,
|
|
72
72
|
machine: node.builder.machine
|
|
73
73
|
});
|