nesoi 3.0.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/lib/adapters/postgres/src/migrator/database.d.ts +37 -0
- package/lib/adapters/postgres/src/migrator/database.js +88 -0
- package/lib/adapters/postgres/src/migrator/index.d.ts +1 -0
- package/lib/adapters/postgres/src/migrator/index.js +5 -0
- package/lib/adapters/postgres/src/migrator/migration.d.ts +73 -0
- package/lib/adapters/postgres/src/migrator/migration.js +351 -0
- package/lib/adapters/postgres/src/migrator/migrator.d.ts +21 -0
- package/lib/adapters/postgres/src/migrator/migrator.js +73 -0
- package/lib/adapters/postgres/src/migrator/runner.d.ts +61 -0
- package/lib/adapters/postgres/src/migrator/runner.js +202 -0
- package/lib/adapters/postgres/src/postgres.bucket_adapter.d.ts +45 -0
- package/lib/adapters/postgres/src/postgres.bucket_adapter.js +278 -0
- package/lib/adapters/postgres/src/postgres.cli.d.ts +46 -0
- package/lib/adapters/postgres/src/postgres.cli.js +124 -0
- package/lib/adapters/postgres/src/postgres.nql.d.ts +12 -0
- package/lib/adapters/postgres/src/postgres.nql.js +69 -0
- package/lib/adapters/postgres/test/postgres.bucket_adapter.test.d.ts +1 -0
- package/lib/adapters/postgres/test/postgres.bucket_adapter.test.js +173 -0
- package/lib/adapters/postgres/test/postgres.bucket_query.test.d.ts +0 -0
- package/lib/adapters/postgres/test/postgres.bucket_query.test.js +136 -0
- package/lib/compiler/apps/monolyth/monolyth_compiler.d.ts +21 -0
- package/lib/compiler/apps/monolyth/monolyth_compiler.js +95 -0
- package/lib/compiler/apps/monolyth/stages/1_mkdir_stage.d.ts +12 -0
- package/lib/compiler/apps/monolyth/stages/1_mkdir_stage.js +80 -0
- package/lib/compiler/apps/monolyth/stages/2_build_typescript_stage.d.ts +12 -0
- package/lib/compiler/apps/monolyth/stages/2_build_typescript_stage.js +128 -0
- package/lib/compiler/apps/monolyth/stages/3_copy_types_stage.d.ts +12 -0
- package/lib/compiler/apps/monolyth/stages/3_copy_types_stage.js +75 -0
- package/lib/compiler/apps/monolyth/stages/4_dump_modules_stage.d.ts +13 -0
- package/lib/compiler/apps/monolyth/stages/4_dump_modules_stage.js +130 -0
- package/lib/compiler/apps/monolyth/stages/5_dump_cli_stage.d.ts +12 -0
- package/lib/compiler/apps/monolyth/stages/5_dump_cli_stage.js +65 -0
- package/lib/compiler/apps/monolyth/stages/6_dump_package_json_stage.d.ts +12 -0
- package/lib/compiler/apps/monolyth/stages/6_dump_package_json_stage.js +74 -0
- package/lib/compiler/compiler.d.ts +19 -0
- package/lib/compiler/compiler.js +83 -0
- package/lib/compiler/elements/bucket.element.d.ts +23 -0
- package/lib/compiler/elements/bucket.element.js +304 -0
- package/lib/compiler/elements/constants.element.d.ts +9 -0
- package/lib/compiler/elements/constants.element.js +88 -0
- package/lib/compiler/elements/controller.element.d.ts +6 -0
- package/lib/compiler/elements/controller.element.js +22 -0
- package/lib/compiler/elements/element.d.ts +49 -0
- package/lib/compiler/elements/element.js +105 -0
- package/lib/compiler/elements/externals.element.d.ts +19 -0
- package/lib/compiler/elements/externals.element.js +83 -0
- package/lib/compiler/elements/job.element.d.ts +7 -0
- package/lib/compiler/elements/job.element.js +62 -0
- package/lib/compiler/elements/machine.element.d.ts +10 -0
- package/lib/compiler/elements/machine.element.js +98 -0
- package/lib/compiler/elements/message.element.d.ts +9 -0
- package/lib/compiler/elements/message.element.js +175 -0
- package/lib/compiler/elements/queue.element.d.ts +6 -0
- package/lib/compiler/elements/queue.element.js +24 -0
- package/lib/compiler/elements/resource.element.d.ts +7 -0
- package/lib/compiler/elements/resource.element.js +64 -0
- package/lib/compiler/error.d.ts +21 -0
- package/lib/compiler/error.js +57 -0
- package/lib/compiler/helpers/dump_helpers.d.ts +11 -0
- package/lib/compiler/helpers/dump_helpers.js +157 -0
- package/lib/compiler/helpers/name_helpers.d.ts +20 -0
- package/lib/compiler/helpers/name_helpers.js +44 -0
- package/lib/compiler/index.d.ts +2 -0
- package/lib/compiler/index.js +7 -0
- package/lib/compiler/module.d.ts +24 -0
- package/lib/compiler/module.js +122 -0
- package/lib/compiler/stages/1_scan_stage.d.ts +10 -0
- package/lib/compiler/stages/1_scan_stage.js +23 -0
- package/lib/compiler/stages/2_treeshake_stage.d.ts +11 -0
- package/lib/compiler/stages/2_treeshake_stage.js +24 -0
- package/lib/compiler/stages/3_extract_ts_stage.d.ts +10 -0
- package/lib/compiler/stages/3_extract_ts_stage.js +71 -0
- package/lib/compiler/stages/4_build_schemas_stage.d.ts +10 -0
- package/lib/compiler/stages/4_build_schemas_stage.js +25 -0
- package/lib/compiler/stages/5_inject_ts_stage.d.ts +10 -0
- package/lib/compiler/stages/5_inject_ts_stage.js +22 -0
- package/lib/compiler/stages/6_build_elements_stage.d.ts +11 -0
- package/lib/compiler/stages/6_build_elements_stage.js +22 -0
- package/lib/compiler/stages/7_dump_stage.d.ts +14 -0
- package/lib/compiler/stages/7_dump_stage.js +208 -0
- package/lib/compiler/stages/8_diagnose_stage.d.ts +16 -0
- package/lib/compiler/stages/8_diagnose_stage.js +43 -0
- package/lib/compiler/treeshake.d.ts +58 -0
- package/lib/compiler/treeshake.js +424 -0
- package/lib/compiler/typescript/bridge/extract.d.ts +11 -0
- package/lib/compiler/typescript/bridge/extract.js +270 -0
- package/lib/compiler/typescript/bridge/inject.d.ts +10 -0
- package/lib/compiler/typescript/bridge/inject.js +140 -0
- package/lib/compiler/typescript/bridge/organize.d.ts +61 -0
- package/lib/compiler/typescript/bridge/organize.js +258 -0
- package/lib/compiler/typescript/error.d.ts +88 -0
- package/lib/compiler/typescript/error.js +265 -0
- package/lib/compiler/typescript/parser.d.ts +48 -0
- package/lib/compiler/typescript/parser.js +581 -0
- package/lib/compiler/typescript/source.d.ts +12 -0
- package/lib/compiler/typescript/source.js +87 -0
- package/lib/compiler/typescript/transformers/app_inject.transformer.d.ts +2 -0
- package/lib/compiler/typescript/transformers/app_inject.transformer.js +89 -0
- package/lib/compiler/typescript/transformers/replace_import.transformer.d.ts +4 -0
- package/lib/compiler/typescript/transformers/replace_import.transformer.js +102 -0
- package/lib/compiler/typescript/typescript_compiler.d.ts +63 -0
- package/lib/compiler/typescript/typescript_compiler.js +602 -0
- package/lib/elements/blocks/block.builder.d.ts +29 -0
- package/lib/elements/blocks/block.builder.js +87 -0
- package/lib/elements/blocks/block.d.ts +15 -0
- package/lib/elements/blocks/block.js +37 -0
- package/lib/elements/blocks/block.schema.d.ts +23 -0
- package/lib/elements/blocks/block.schema.js +15 -0
- package/lib/elements/blocks/externals/externals.builder.d.ts +30 -0
- package/lib/elements/blocks/externals/externals.builder.js +37 -0
- package/lib/elements/blocks/externals/externals.schema.d.ts +11 -0
- package/lib/elements/blocks/externals/externals.schema.js +19 -0
- package/lib/elements/blocks/job/internal/machine_job.builder.d.ts +52 -0
- package/lib/elements/blocks/job/internal/machine_job.builder.js +74 -0
- package/lib/elements/blocks/job/internal/machine_job.schema.d.ts +5 -0
- package/lib/elements/blocks/job/internal/machine_job.schema.js +10 -0
- package/lib/elements/blocks/job/internal/resource_job.builder.d.ts +109 -0
- package/lib/elements/blocks/job/internal/resource_job.builder.js +146 -0
- package/lib/elements/blocks/job/internal/resource_job.d.ts +14 -0
- package/lib/elements/blocks/job/internal/resource_job.js +30 -0
- package/lib/elements/blocks/job/internal/resource_job.schema.d.ts +11 -0
- package/lib/elements/blocks/job/internal/resource_job.schema.js +15 -0
- package/lib/elements/blocks/job/job.builder.d.ts +118 -0
- package/lib/elements/blocks/job/job.builder.js +137 -0
- package/lib/elements/blocks/job/job.d.ts +13 -0
- package/lib/elements/blocks/job/job.js +40 -0
- package/lib/elements/blocks/job/job.schema.d.ts +26 -0
- package/lib/elements/blocks/job/job.schema.js +20 -0
- package/lib/elements/blocks/machine/machine.builder.d.ts +58 -0
- package/lib/elements/blocks/machine/machine.builder.js +135 -0
- package/lib/elements/blocks/machine/machine.d.ts +86 -0
- package/lib/elements/blocks/machine/machine.js +228 -0
- package/lib/elements/blocks/machine/machine.schema.d.ts +85 -0
- package/lib/elements/blocks/machine/machine.schema.js +64 -0
- package/lib/elements/blocks/machine/machine_state.builder.d.ts +58 -0
- package/lib/elements/blocks/machine/machine_state.builder.js +186 -0
- package/lib/elements/blocks/machine/machine_transition.builder.d.ts +48 -0
- package/lib/elements/blocks/machine/machine_transition.builder.js +98 -0
- package/lib/elements/blocks/queue/adapters/bucket.queue_adapter.d.ts +10 -0
- package/lib/elements/blocks/queue/adapters/bucket.queue_adapter.js +17 -0
- package/lib/elements/blocks/queue/adapters/queue_adapter.d.ts +6 -0
- package/lib/elements/blocks/queue/adapters/queue_adapter.js +6 -0
- package/lib/elements/blocks/queue/queue.builder.d.ts +40 -0
- package/lib/elements/blocks/queue/queue.builder.js +31 -0
- package/lib/elements/blocks/queue/queue.d.ts +9 -0
- package/lib/elements/blocks/queue/queue.js +11 -0
- package/lib/elements/blocks/queue/queue.schema.d.ts +12 -0
- package/lib/elements/blocks/queue/queue.schema.js +17 -0
- package/lib/elements/blocks/resource/resource.builder.d.ts +60 -0
- package/lib/elements/blocks/resource/resource.builder.js +224 -0
- package/lib/elements/blocks/resource/resource.d.ts +48 -0
- package/lib/elements/blocks/resource/resource.js +125 -0
- package/lib/elements/blocks/resource/resource.schema.d.ts +32 -0
- package/lib/elements/blocks/resource/resource.schema.js +30 -0
- package/lib/elements/blocks/resource/resource.types.d.ts +38 -0
- package/lib/elements/blocks/resource/resource.types.js +3 -0
- package/lib/elements/edge/controller/adapters/cli.controller_adapter.d.ts +8 -0
- package/lib/elements/edge/controller/adapters/cli.controller_adapter.js +17 -0
- package/lib/elements/edge/controller/adapters/controller_adapter.d.ts +14 -0
- package/lib/elements/edge/controller/adapters/controller_adapter.js +44 -0
- package/lib/elements/edge/controller/controller.builder.d.ts +78 -0
- package/lib/elements/edge/controller/controller.builder.js +178 -0
- package/lib/elements/edge/controller/controller.config.d.ts +6 -0
- package/lib/elements/edge/controller/controller.config.js +2 -0
- package/lib/elements/edge/controller/controller.d.ts +22 -0
- package/lib/elements/edge/controller/controller.js +41 -0
- package/lib/elements/edge/controller/controller.schema.d.ts +44 -0
- package/lib/elements/edge/controller/controller.schema.js +51 -0
- package/lib/elements/entities/bucket/adapters/bucket_adapter.d.ts +107 -0
- package/lib/elements/entities/bucket/adapters/bucket_adapter.js +41 -0
- package/lib/elements/entities/bucket/adapters/memory.bucket_adapter.d.ts +37 -0
- package/lib/elements/entities/bucket/adapters/memory.bucket_adapter.js +149 -0
- package/lib/elements/entities/bucket/adapters/memory.bucket_query copy.d.ts +0 -0
- package/lib/elements/entities/bucket/adapters/memory.bucket_query copy.js +218 -0
- package/lib/elements/entities/bucket/adapters/memory.nql.d.ts +19 -0
- package/lib/elements/entities/bucket/adapters/memory.nql.js +212 -0
- package/lib/elements/entities/bucket/adapters/slow_memory.bucket_adapter.d.ts +20 -0
- package/lib/elements/entities/bucket/adapters/slow_memory.bucket_adapter.js +31 -0
- package/lib/elements/entities/bucket/bucket.builder.d.ts +61 -0
- package/lib/elements/entities/bucket/bucket.builder.js +130 -0
- package/lib/elements/entities/bucket/bucket.config.d.ts +29 -0
- package/lib/elements/entities/bucket/bucket.config.js +2 -0
- package/lib/elements/entities/bucket/bucket.d.ts +36 -0
- package/lib/elements/entities/bucket/bucket.infer.d.ts +22 -0
- package/lib/elements/entities/bucket/bucket.infer.js +85 -0
- package/lib/elements/entities/bucket/bucket.js +125 -0
- package/lib/elements/entities/bucket/bucket.schema.d.ts +24 -0
- package/lib/elements/entities/bucket/bucket.schema.js +16 -0
- package/lib/elements/entities/bucket/bucket.types.d.ts +32 -0
- package/lib/elements/entities/bucket/bucket.types.js +2 -0
- package/lib/elements/entities/bucket/cache/bucket_cache.d.ts +35 -0
- package/lib/elements/entities/bucket/cache/bucket_cache.js +182 -0
- package/lib/elements/entities/bucket/graph/bucket_graph.builder.d.ts +11 -0
- package/lib/elements/entities/bucket/graph/bucket_graph.builder.js +27 -0
- package/lib/elements/entities/bucket/graph/bucket_graph.d.ts +16 -0
- package/lib/elements/entities/bucket/graph/bucket_graph.infer.d.ts +9 -0
- package/lib/elements/entities/bucket/graph/bucket_graph.infer.js +2 -0
- package/lib/elements/entities/bucket/graph/bucket_graph.js +136 -0
- package/lib/elements/entities/bucket/graph/bucket_graph.schema.d.ts +28 -0
- package/lib/elements/entities/bucket/graph/bucket_graph.schema.js +27 -0
- package/lib/elements/entities/bucket/graph/bucket_graph_link.builder.d.ts +36 -0
- package/lib/elements/entities/bucket/graph/bucket_graph_link.builder.js +56 -0
- package/lib/elements/entities/bucket/model/bucket_model.builder.d.ts +13 -0
- package/lib/elements/entities/bucket/model/bucket_model.builder.js +24 -0
- package/lib/elements/entities/bucket/model/bucket_model.convert.d.ts +5 -0
- package/lib/elements/entities/bucket/model/bucket_model.convert.js +51 -0
- package/lib/elements/entities/bucket/model/bucket_model.infer.d.ts +13 -0
- package/lib/elements/entities/bucket/model/bucket_model.infer.js +2 -0
- package/lib/elements/entities/bucket/model/bucket_model.schema.d.ts +35 -0
- package/lib/elements/entities/bucket/model/bucket_model.schema.js +47 -0
- package/lib/elements/entities/bucket/model/bucket_model_field.builder.d.ts +119 -0
- package/lib/elements/entities/bucket/model/bucket_model_field.builder.js +154 -0
- package/lib/elements/entities/bucket/query/nql.schema.d.ts +140 -0
- package/lib/elements/entities/bucket/query/nql.schema.js +2 -0
- package/lib/elements/entities/bucket/query/nql_compiler.d.ts +44 -0
- package/lib/elements/entities/bucket/query/nql_compiler.js +620 -0
- package/lib/elements/entities/bucket/query/nql_engine.d.ts +16 -0
- package/lib/elements/entities/bucket/query/nql_engine.js +42 -0
- package/lib/elements/entities/bucket/view/bucket_view.builder.d.ts +14 -0
- package/lib/elements/entities/bucket/view/bucket_view.builder.js +24 -0
- package/lib/elements/entities/bucket/view/bucket_view.d.ts +10 -0
- package/lib/elements/entities/bucket/view/bucket_view.js +102 -0
- package/lib/elements/entities/bucket/view/bucket_view.schema.d.ts +55 -0
- package/lib/elements/entities/bucket/view/bucket_view.schema.js +42 -0
- package/lib/elements/entities/bucket/view/bucket_view_field.builder.d.ts +37 -0
- package/lib/elements/entities/bucket/view/bucket_view_field.builder.js +138 -0
- package/lib/elements/entities/constants/constants.builder.d.ts +57 -0
- package/lib/elements/entities/constants/constants.builder.js +116 -0
- package/lib/elements/entities/constants/constants.d.ts +7 -0
- package/lib/elements/entities/constants/constants.js +15 -0
- package/lib/elements/entities/constants/constants.schema.d.ts +51 -0
- package/lib/elements/entities/constants/constants.schema.js +45 -0
- package/lib/elements/entities/message/message.builder.d.ts +33 -0
- package/lib/elements/entities/message/message.builder.js +41 -0
- package/lib/elements/entities/message/message.d.ts +11 -0
- package/lib/elements/entities/message/message.infer.d.ts +63 -0
- package/lib/elements/entities/message/message.infer.js +2 -0
- package/lib/elements/entities/message/message.js +52 -0
- package/lib/elements/entities/message/message.schema.d.ts +15 -0
- package/lib/elements/entities/message/message.schema.js +13 -0
- package/lib/elements/entities/message/message_parser.d.ts +12 -0
- package/lib/elements/entities/message/message_parser.js +112 -0
- package/lib/elements/entities/message/template/message_template.builder.d.ts +14 -0
- package/lib/elements/entities/message/template/message_template.builder.js +20 -0
- package/lib/elements/entities/message/template/message_template.schema.d.ts +57 -0
- package/lib/elements/entities/message/template/message_template.schema.js +28 -0
- package/lib/elements/entities/message/template/message_template_field.builder.d.ts +225 -0
- package/lib/elements/entities/message/template/message_template_field.builder.js +172 -0
- package/lib/elements/entities/message/template/message_template_parser.d.ts +3 -0
- package/lib/elements/entities/message/template/message_template_parser.js +83 -0
- package/lib/elements/index.d.ts +11 -0
- package/lib/elements/index.js +23 -0
- package/lib/engine/apps/app.config.d.ts +49 -0
- package/lib/engine/apps/app.config.js +38 -0
- package/lib/engine/apps/app.d.ts +70 -0
- package/lib/engine/apps/app.js +101 -0
- package/lib/engine/apps/inline.app.d.ts +48 -0
- package/lib/engine/apps/inline.app.js +144 -0
- package/lib/engine/apps/monolyth/monolyth.app.d.ts +20 -0
- package/lib/engine/apps/monolyth/monolyth.app.js +94 -0
- package/lib/engine/apps/monolyth/monolyth.cli.d.ts +45 -0
- package/lib/engine/apps/monolyth/monolyth.cli.js +362 -0
- package/lib/engine/auth/authn.d.ts +18 -0
- package/lib/engine/auth/authn.js +9 -0
- package/lib/engine/auth/zero.authn_provider.d.ts +13 -0
- package/lib/engine/auth/zero.authn_provider.js +13 -0
- package/lib/engine/cli/cli.d.ts +19 -0
- package/lib/engine/cli/cli.js +88 -0
- package/lib/engine/cli/cli_adapter.d.ts +18 -0
- package/lib/engine/cli/cli_adapter.js +61 -0
- package/lib/engine/cli/ui.d.ts +36 -0
- package/lib/engine/cli/ui.js +188 -0
- package/lib/engine/daemon.d.ts +35 -0
- package/lib/engine/daemon.js +66 -0
- package/lib/engine/data/date.d.ts +10 -0
- package/lib/engine/data/date.js +32 -0
- package/lib/engine/data/datetime.d.ts +12 -0
- package/lib/engine/data/datetime.js +31 -0
- package/lib/engine/data/decimal.d.ts +11 -0
- package/lib/engine/data/decimal.js +70 -0
- package/lib/engine/data/error.d.ts +213 -0
- package/lib/engine/data/error.js +386 -0
- package/lib/engine/data/obj.d.ts +16 -0
- package/lib/engine/data/obj.js +5 -0
- package/lib/engine/data/tree.d.ts +17 -0
- package/lib/engine/data/tree.js +111 -0
- package/lib/engine/dependency.d.ts +68 -0
- package/lib/engine/dependency.js +91 -0
- package/lib/engine/module.d.ts +97 -0
- package/lib/engine/module.js +335 -0
- package/lib/engine/space.d.ts +54 -0
- package/lib/engine/space.js +138 -0
- package/lib/engine/transaction/nodes/bucket.trx_node.d.ts +53 -0
- package/lib/engine/transaction/nodes/bucket.trx_node.js +522 -0
- package/lib/engine/transaction/nodes/bucket_query.trx_node.d.ts +17 -0
- package/lib/engine/transaction/nodes/bucket_query.trx_node.js +82 -0
- package/lib/engine/transaction/nodes/job.trx_node.d.ts +13 -0
- package/lib/engine/transaction/nodes/job.trx_node.js +40 -0
- package/lib/engine/transaction/nodes/machine.trx_node.d.ts +12 -0
- package/lib/engine/transaction/nodes/machine.trx_node.js +39 -0
- package/lib/engine/transaction/nodes/queue.trx_node.d.ts +10 -0
- package/lib/engine/transaction/nodes/queue.trx_node.js +24 -0
- package/lib/engine/transaction/nodes/resource.trx_node.d.ts +24 -0
- package/lib/engine/transaction/nodes/resource.trx_node.js +77 -0
- package/lib/engine/transaction/trx.d.ts +50 -0
- package/lib/engine/transaction/trx.js +94 -0
- package/lib/engine/transaction/trx_engine.config.d.ts +15 -0
- package/lib/engine/transaction/trx_engine.config.js +2 -0
- package/lib/engine/transaction/trx_engine.d.ts +27 -0
- package/lib/engine/transaction/trx_engine.js +95 -0
- package/lib/engine/transaction/trx_node.d.ts +61 -0
- package/lib/engine/transaction/trx_node.js +175 -0
- package/lib/engine/tree.d.ts +34 -0
- package/lib/engine/tree.js +237 -0
- package/lib/engine/util/cache.d.ts +6 -0
- package/lib/engine/util/cache.js +20 -0
- package/lib/engine/util/console.d.ts +4 -0
- package/lib/engine/util/console.js +24 -0
- package/lib/engine/util/deep.d.ts +7 -0
- package/lib/engine/util/deep.js +2 -0
- package/lib/engine/util/dotenv.d.ts +15 -0
- package/lib/engine/util/dotenv.js +94 -0
- package/lib/engine/util/i18n.d.ts +5 -0
- package/lib/engine/util/i18n.js +19 -0
- package/lib/engine/util/log.d.ts +17 -0
- package/lib/engine/util/log.js +93 -0
- package/lib/engine/util/parse.d.ts +63 -0
- package/lib/engine/util/parse.js +229 -0
- package/lib/engine/util/promise.d.ts +3 -0
- package/lib/engine/util/promise.js +14 -0
- package/lib/engine/util/shell.d.ts +6 -0
- package/lib/engine/util/shell.js +44 -0
- package/lib/engine/util/string.d.ts +18 -0
- package/lib/engine/util/string.js +25 -0
- package/lib/engine/util/type.d.ts +7 -0
- package/lib/engine/util/type.js +3 -0
- package/lib/schema.d.ts +63 -0
- package/lib/schema.js +2 -0
- package/package.json +22 -0
- package/tools/compile.d.ts +1 -0
- package/tools/compile.js +68 -0
- package/tools/joaquin/job.d.ts +40 -0
- package/tools/joaquin/job.js +47 -0
- package/tools/joaquin/message.d.ts +12 -0
- package/tools/joaquin/message.js +47 -0
- package/tools/joaquin/mock.d.ts +28 -0
- package/tools/joaquin/mock.js +128 -0
- package/tsconfig.build.tsbuildinfo +1 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.TSBridgeExtract = void 0;
|
|
37
|
+
const ts = __importStar(require("typescript"));
|
|
38
|
+
const log_1 = require("../../../engine/util/log");
|
|
39
|
+
class TSBridgeExtract {
|
|
40
|
+
static imports(compiler, node) {
|
|
41
|
+
const { tsCompiler } = compiler;
|
|
42
|
+
if (Array.isArray(node.filepath)) {
|
|
43
|
+
if (!['constants', 'externals'].includes(node.builder.$b)) {
|
|
44
|
+
log_1.Log.warn('compiler', 'bridge.extract', 'It\'s currently not possible to transfer ts code from multiple builder files to a single schema. Skipping this node.', { tag: node.tag, filepath: node.filepath });
|
|
45
|
+
}
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const imports = tsCompiler.extractImports(node.filepath, {
|
|
49
|
+
ignore: [] // TODO: ignore space file
|
|
50
|
+
});
|
|
51
|
+
if (imports.length) {
|
|
52
|
+
log_1.Log.debug('compiler', 'bridge.extract', `Extracted TS imports from ${node.filepath}`, imports);
|
|
53
|
+
}
|
|
54
|
+
return imports;
|
|
55
|
+
}
|
|
56
|
+
static types(compiler, node) {
|
|
57
|
+
const { tsCompiler } = compiler;
|
|
58
|
+
if (Array.isArray(node.filepath)) {
|
|
59
|
+
if (!['constants', 'externals'].includes(node.builder.$b)) {
|
|
60
|
+
log_1.Log.warn('compiler', 'bridge.extract', 'It\'s currently not possible to transfer ts code from multiple builder files to a single schema. Skipping this node.', { tag: node.tag, filepath: node.filepath });
|
|
61
|
+
}
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const types = [];
|
|
65
|
+
if (node.builder.$b === 'job') {
|
|
66
|
+
const rawOutputs = tsCompiler.query(node.filepath, {
|
|
67
|
+
query: 'job.*.output.raw',
|
|
68
|
+
expectedKinds: [ts.SyntaxKind.CallExpression]
|
|
69
|
+
});
|
|
70
|
+
rawOutputs.forEach(raw => {
|
|
71
|
+
const sig = tsCompiler.checker.getResolvedSignature(raw.node);
|
|
72
|
+
if (!sig)
|
|
73
|
+
return;
|
|
74
|
+
const args = tsCompiler.checker.getTypeArgumentsForResolvedSignature(sig);
|
|
75
|
+
if (!args)
|
|
76
|
+
return;
|
|
77
|
+
const type = tsCompiler.checker.typeToString(args[0], undefined, ts.TypeFormatFlags.NoTruncation);
|
|
78
|
+
types.push({
|
|
79
|
+
path: raw.path,
|
|
80
|
+
type
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (types.length) {
|
|
85
|
+
log_1.Log.debug('compiler', 'bridge.extract', `Extracted TS type from ${node.filepath}`, types.map(f => f.path));
|
|
86
|
+
}
|
|
87
|
+
return types;
|
|
88
|
+
}
|
|
89
|
+
static functions(compiler, node) {
|
|
90
|
+
const { tsCompiler } = compiler;
|
|
91
|
+
if (Array.isArray(node.filepath)) {
|
|
92
|
+
if (!['constants', 'externals'].includes(node.builder.$b)) {
|
|
93
|
+
log_1.Log.warn('compiler', 'bridge.extract', 'It\'s currently not possible to transfer ts code from multiple builder files to a single schema. Skipping this node.', { tag: node.tag, filepath: node.filepath });
|
|
94
|
+
}
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const functions = [];
|
|
98
|
+
if (node.builder.$b === 'bucket') {
|
|
99
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
100
|
+
query: 'bucket.*.view.1.return.**.computed.0',
|
|
101
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
if (node.builder.$b === 'message') {
|
|
105
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
106
|
+
query: 'message.*.template.0.return.**.rule.0',
|
|
107
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
if (node.builder.$b === 'job') {
|
|
111
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
112
|
+
query: 'job.*.messages.0.return.*.**.rule.0',
|
|
113
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
114
|
+
}));
|
|
115
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
116
|
+
query: 'job.*.extra.0',
|
|
117
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
118
|
+
}));
|
|
119
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
120
|
+
query: 'job.*.assert.0',
|
|
121
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
122
|
+
}));
|
|
123
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
124
|
+
query: 'job.*.method.0',
|
|
125
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
128
|
+
if (node.builder.$b === 'resource') {
|
|
129
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
130
|
+
query: 'resource.*.create.0.return.input.0.return.**.rule.0',
|
|
131
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
132
|
+
}));
|
|
133
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
134
|
+
query: 'resource.*.create.0.return.assert.0',
|
|
135
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
136
|
+
}));
|
|
137
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
138
|
+
query: 'resource.*.create.0.return.prepare.0',
|
|
139
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
140
|
+
}));
|
|
141
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
142
|
+
query: 'resource.*.create.0.return.after.0',
|
|
143
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
144
|
+
}));
|
|
145
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
146
|
+
query: 'resource.*.update.0.return.input.0.return.**.rule.0',
|
|
147
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
148
|
+
}));
|
|
149
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
150
|
+
query: 'resource.*.update.0.return.assert.0',
|
|
151
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
152
|
+
}));
|
|
153
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
154
|
+
query: 'resource.*.update.0.return.prepare.0',
|
|
155
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
156
|
+
}));
|
|
157
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
158
|
+
query: 'resource.*.update.0.return.after.0',
|
|
159
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
160
|
+
}));
|
|
161
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
162
|
+
query: 'resource.*.delete.0.return.input.0.return.**.rule.0',
|
|
163
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
164
|
+
}));
|
|
165
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
166
|
+
query: 'resource.*.delete.0.return.assert.0',
|
|
167
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
168
|
+
}));
|
|
169
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
170
|
+
query: 'resource.*.delete.0.return.prepare.0',
|
|
171
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
172
|
+
}));
|
|
173
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
174
|
+
query: 'resource.*.delete.0.return.after.0',
|
|
175
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
176
|
+
}));
|
|
177
|
+
}
|
|
178
|
+
if (node.builder.$b === 'machine') {
|
|
179
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
180
|
+
query: 'machine.*.messages.0.return.*.**.rule.0',
|
|
181
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
182
|
+
}));
|
|
183
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
184
|
+
query: 'machine.*.{state.1.return}.beforeEnter.0.return.extra.0',
|
|
185
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
186
|
+
}));
|
|
187
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
188
|
+
query: 'machine.*.{state.1.return}.beforeEnter.0.return.assert.0',
|
|
189
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
190
|
+
}));
|
|
191
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
192
|
+
query: 'machine.*.{state.1.return}.beforeEnter.0.return.method.0',
|
|
193
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
194
|
+
}));
|
|
195
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
196
|
+
query: 'machine.*.{state.1.return}.afterEnter.0.return.extra.0',
|
|
197
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
198
|
+
}));
|
|
199
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
200
|
+
query: 'machine.*.{state.1.return}.afterEnter.0.return.assert.0',
|
|
201
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
202
|
+
}));
|
|
203
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
204
|
+
query: 'machine.*.{state.1.return}.afterEnter.0.return.method.0',
|
|
205
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
206
|
+
}));
|
|
207
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
208
|
+
query: 'machine.*.{state.1.return}.beforeLeave.0.return.extra.0',
|
|
209
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
210
|
+
}));
|
|
211
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
212
|
+
query: 'machine.*.{state.1.return}.beforeLeave.0.return.assert.0',
|
|
213
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
214
|
+
}));
|
|
215
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
216
|
+
query: 'machine.*.{state.1.return}.beforeLeave.0.return.method.0',
|
|
217
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
218
|
+
}));
|
|
219
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
220
|
+
query: 'machine.*.{state.1.return}.afterLeave.0.return.extra.0',
|
|
221
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
222
|
+
}));
|
|
223
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
224
|
+
query: 'machine.*.{state.1.return}.afterLeave.0.return.assert.0',
|
|
225
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
226
|
+
}));
|
|
227
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
228
|
+
query: 'machine.*.{state.1.return}.afterLeave.0.return.method.0',
|
|
229
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
230
|
+
}));
|
|
231
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
232
|
+
query: 'machine.*.{state.1.return}.transition.1.return.if.0',
|
|
233
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
234
|
+
}));
|
|
235
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
236
|
+
query: 'machine.*.{state.1.return}.transition.1.return.{else.0.return}.if.0',
|
|
237
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
238
|
+
}));
|
|
239
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
240
|
+
query: 'machine.*.{state.1.return}.transition.1.return.runJob.0.return.extra.0',
|
|
241
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
242
|
+
}));
|
|
243
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
244
|
+
query: 'machine.*.{state.1.return}.transition.1.return.{else.0.return}.runJob.0.return.extra.0',
|
|
245
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
246
|
+
}));
|
|
247
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
248
|
+
query: 'machine.*.{state.1.return}.transition.1.return.runJob.0.return.assert.0',
|
|
249
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
250
|
+
}));
|
|
251
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
252
|
+
query: 'machine.*.{state.1.return}.transition.1.return.{else.0.return}.runJob.0.return.assert.0',
|
|
253
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
254
|
+
}));
|
|
255
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
256
|
+
query: 'machine.*.{state.1.return}.transition.1.return.runJob.0.return.method.0',
|
|
257
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
258
|
+
}));
|
|
259
|
+
functions.push(...tsCompiler.query(node.filepath, {
|
|
260
|
+
query: 'machine.*.{state.1.return}.transition.1.return.{else.0.return}.runJob.0.return.method.0',
|
|
261
|
+
expectedKinds: [ts.SyntaxKind.FunctionExpression, ts.SyntaxKind.ArrowFunction, ts.SyntaxKind.Identifier, ts.SyntaxKind.CallExpression]
|
|
262
|
+
}));
|
|
263
|
+
}
|
|
264
|
+
if (functions.length) {
|
|
265
|
+
log_1.Log.debug('compiler', 'bridge.extract', `Extracted TS code from ${node.filepath}`, functions.map(f => f.path));
|
|
266
|
+
}
|
|
267
|
+
return functions;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
exports.TSBridgeExtract = TSBridgeExtract;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ResolvedBuilderNode } from "../../../engine/dependency";
|
|
2
|
+
import { Compiler } from "../../compiler";
|
|
3
|
+
export declare class TSBridgeInject {
|
|
4
|
+
static inject(compiler: Compiler, nodes: ResolvedBuilderNode[]): void;
|
|
5
|
+
private static bucket;
|
|
6
|
+
private static message;
|
|
7
|
+
private static job;
|
|
8
|
+
private static machine;
|
|
9
|
+
private static machineTransitions;
|
|
10
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TSBridgeInject = void 0;
|
|
4
|
+
const log_1 = require("../../../engine/util/log");
|
|
5
|
+
const name_helpers_1 = require("../../helpers/name_helpers");
|
|
6
|
+
class TSBridgeInject {
|
|
7
|
+
static inject(compiler, nodes) {
|
|
8
|
+
const { tsCompiler } = compiler;
|
|
9
|
+
nodes.forEach(node => {
|
|
10
|
+
log_1.Log.debug('compiler', 'bridge.inject', `Injecting TS code on ${node.tag}`);
|
|
11
|
+
const schema = node.schema;
|
|
12
|
+
if (schema.$t === 'bucket') {
|
|
13
|
+
const extract = node.bridge?.extract;
|
|
14
|
+
if (!extract)
|
|
15
|
+
return;
|
|
16
|
+
this.bucket(compiler, extract, node);
|
|
17
|
+
}
|
|
18
|
+
if (schema.$t === 'message') {
|
|
19
|
+
const extract = node.bridge?.extract;
|
|
20
|
+
if (!extract)
|
|
21
|
+
return;
|
|
22
|
+
this.message(compiler, extract, node);
|
|
23
|
+
}
|
|
24
|
+
if (schema.$t === 'job') {
|
|
25
|
+
const extract = node.bridge?.extract;
|
|
26
|
+
if (!extract)
|
|
27
|
+
return;
|
|
28
|
+
this.job(compiler, extract, node);
|
|
29
|
+
}
|
|
30
|
+
if (schema.$t === 'machine') {
|
|
31
|
+
const extract = node.bridge?.extract;
|
|
32
|
+
if (!extract)
|
|
33
|
+
return;
|
|
34
|
+
this.machine(compiler, extract, node);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
static bucket(compiler, extract, node) {
|
|
39
|
+
const { tsCompiler } = compiler;
|
|
40
|
+
const schema = node.schema;
|
|
41
|
+
const typeName = name_helpers_1.NameHelpers.names(schema).type;
|
|
42
|
+
Object.entries(extract.views).forEach(([name, view]) => {
|
|
43
|
+
Object.entries(view?.computed || {}).forEach(([prop, node]) => {
|
|
44
|
+
let f = { children: schema.views[name].fields };
|
|
45
|
+
prop.split('.').forEach(p => {
|
|
46
|
+
f = f.children[p];
|
|
47
|
+
});
|
|
48
|
+
f.value.computed = { fn: {
|
|
49
|
+
__fn: tsCompiler.getFnText(node),
|
|
50
|
+
__fn_type: '(...args: any[]) => any', // TODO: evaluate
|
|
51
|
+
} };
|
|
52
|
+
f['#data'] = tsCompiler.getReturnType(node);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
static message(compiler, extract, node) {
|
|
57
|
+
const { tsCompiler } = compiler;
|
|
58
|
+
const schema = node.schema;
|
|
59
|
+
const typeName = name_helpers_1.NameHelpers.names(schema).type;
|
|
60
|
+
Object.entries(extract.rules).forEach(([prop, node]) => {
|
|
61
|
+
let f = { children: schema.template.fields };
|
|
62
|
+
let addr = '';
|
|
63
|
+
prop.split('.').forEach(p => {
|
|
64
|
+
f = f.children[p];
|
|
65
|
+
addr += `['${p}${f.type === 'id' ? '_id' : ''}']`;
|
|
66
|
+
});
|
|
67
|
+
const type = `$MessageTemplateRule<${typeName}['#raw']${addr}, ${typeName}['#raw']>`;
|
|
68
|
+
f.rules = node.map(fn => ({
|
|
69
|
+
__fn: tsCompiler.getFnText(fn),
|
|
70
|
+
__fn_type: '(...args: any[]) => any', // TODO: evaluate
|
|
71
|
+
}));
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
static job(compiler, extract, node) {
|
|
75
|
+
const { tsCompiler } = compiler;
|
|
76
|
+
const schema = node.schema;
|
|
77
|
+
if (extract.extrasAndAsserts) {
|
|
78
|
+
schema.extrasAndAsserts = extract.extrasAndAsserts.map(e => {
|
|
79
|
+
const t = Object.keys(e)[0];
|
|
80
|
+
return {
|
|
81
|
+
[t]: {
|
|
82
|
+
__fn: tsCompiler.getFnText(e[t]),
|
|
83
|
+
__fn_type: '(...args: any[]) => any', // TODO: evaluate
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (extract.method) {
|
|
89
|
+
schema.method = {
|
|
90
|
+
__fn: tsCompiler.getFnText(extract.method),
|
|
91
|
+
__fn_type: '(...args: any[]) => any', // TODO: evaluate
|
|
92
|
+
};
|
|
93
|
+
// No output specified, infer from function
|
|
94
|
+
if (!schema.output) {
|
|
95
|
+
schema['#output'] = tsCompiler.getReturnType(extract.method);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (extract.prepare) {
|
|
99
|
+
const scope = schema.scope;
|
|
100
|
+
scope.prepareMethod = {
|
|
101
|
+
__fn: tsCompiler.getFnText(extract.prepare),
|
|
102
|
+
__fn_type: '(...args: any[]) => any', // TODO: evaluate
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
if (extract.after) {
|
|
106
|
+
const scope = schema.scope;
|
|
107
|
+
scope.afterMethod = {
|
|
108
|
+
__fn: tsCompiler.getFnText(extract.after),
|
|
109
|
+
__fn_type: '(...args: any[]) => any', // TODO: evaluate
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
if (extract.outputRaw) {
|
|
113
|
+
schema.output ?? (schema.output = {});
|
|
114
|
+
schema.output.raw = extract.outputRaw;
|
|
115
|
+
schema['#output'] = undefined; // Will be recalculated by element based on output
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
static machine(compiler, extract, node) {
|
|
119
|
+
const { tsCompiler } = compiler;
|
|
120
|
+
const schema = node.schema;
|
|
121
|
+
Object.entries(extract.states).forEach(([sname, state]) => {
|
|
122
|
+
Object.entries(state.transitions || {}).forEach(([tname, trst]) => {
|
|
123
|
+
const transitions = schema.transitions.from[sname][tname];
|
|
124
|
+
TSBridgeInject.machineTransitions(compiler, trst, transitions);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
static machineTransitions(compiler, extract, transitions) {
|
|
129
|
+
const { tsCompiler } = compiler;
|
|
130
|
+
extract.forEach((fn, i) => {
|
|
131
|
+
if (fn.if) {
|
|
132
|
+
transitions[i].condition = {
|
|
133
|
+
__fn: tsCompiler.getFnText(fn.if),
|
|
134
|
+
__fn_type: '(...args: any[]) => any', // TODO: evaluate
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.TSBridgeInject = TSBridgeInject;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as ts from 'typescript';
|
|
2
|
+
import { tsFnQueryResult } from '../typescript_compiler';
|
|
3
|
+
export type tsFn = ts.FunctionExpression | ts.ArrowFunction;
|
|
4
|
+
export type tsImport = ts.ImportDeclaration;
|
|
5
|
+
export type BucketFnExtract = {
|
|
6
|
+
views: {
|
|
7
|
+
[name: string]: {
|
|
8
|
+
computed: Record<string, tsFn>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type MessageFnExtract = {
|
|
13
|
+
rules: Record<string, tsFn[]>;
|
|
14
|
+
};
|
|
15
|
+
export type JobFnExtract = {
|
|
16
|
+
extrasAndAsserts?: ({
|
|
17
|
+
extra: tsFn;
|
|
18
|
+
} | {
|
|
19
|
+
assert: tsFn;
|
|
20
|
+
})[];
|
|
21
|
+
method?: tsFn;
|
|
22
|
+
prepare?: tsFn;
|
|
23
|
+
after?: tsFn;
|
|
24
|
+
outputRaw?: string;
|
|
25
|
+
};
|
|
26
|
+
export type MachineFnExtract = {
|
|
27
|
+
states: {
|
|
28
|
+
[name: string]: MachineStateFnExtract;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export type MachineStateFnExtract = {
|
|
32
|
+
transitions?: {
|
|
33
|
+
[msg: string]: MachineTransitionFnExtract[];
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export type MachineTransitionFnExtract = {
|
|
37
|
+
if?: tsFn;
|
|
38
|
+
};
|
|
39
|
+
export type OrganizedExtract = {
|
|
40
|
+
buckets: Record<string, BucketFnExtract>;
|
|
41
|
+
messages: Record<string, MessageFnExtract>;
|
|
42
|
+
jobs: Record<string, JobFnExtract>;
|
|
43
|
+
machines: Record<string, MachineFnExtract>;
|
|
44
|
+
};
|
|
45
|
+
export declare class TSBridgeOrganize {
|
|
46
|
+
static functions(types?: {
|
|
47
|
+
path: string;
|
|
48
|
+
type: string;
|
|
49
|
+
}[], functions?: tsFnQueryResult[]): OrganizedExtract;
|
|
50
|
+
private static bucket;
|
|
51
|
+
private static message;
|
|
52
|
+
private static inlineMessage;
|
|
53
|
+
private static inputMessage;
|
|
54
|
+
private static job;
|
|
55
|
+
private static type_job;
|
|
56
|
+
private static resourceJob;
|
|
57
|
+
private static resource;
|
|
58
|
+
private static machine;
|
|
59
|
+
private static machineState;
|
|
60
|
+
private static machineTransition;
|
|
61
|
+
}
|