diff --git a/Cargo.lock b/Cargo.lock index 193fe71cb9..db49daf380 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1600,7 +1600,7 @@ dependencies = [ [[package]] name = "common" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" dependencies = [ "anyhow", "async-trait", @@ -6891,7 +6891,7 @@ dependencies = [ [[package]] name = "meta-cli" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" dependencies = [ "actix", "assert_cmd", @@ -6958,7 +6958,7 @@ dependencies = [ [[package]] name = "metagen" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" dependencies = [ "color-eyre", "common", @@ -7307,7 +7307,7 @@ dependencies = [ [[package]] name = "mt_deno" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" dependencies = [ "anyhow", "deno", @@ -11268,7 +11268,7 @@ dependencies = [ [[package]] name = "substantial" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" dependencies = [ "anyhow", "chrono", @@ -12756,7 +12756,7 @@ dependencies = [ [[package]] name = "typegate" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" dependencies = [ "colored", "env_logger 0.11.0", @@ -12769,7 +12769,7 @@ dependencies = [ [[package]] name = "typegate_engine" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" dependencies = [ "anyhow", "base64 0.22.1", @@ -12814,7 +12814,7 @@ dependencies = [ [[package]] name = "typegraph_core" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" dependencies = [ "anyhow", "color-eyre", @@ -14567,7 +14567,7 @@ checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193" [[package]] name = "xtask" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index 4deca359b8..dc6aa63196 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ exclude = [ ] [workspace.package] -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" edition = "2021" [workspace.dependencies] diff --git a/deno.lock b/deno.lock index 9b89ecb14c..756ca5d198 100644 --- a/deno.lock +++ b/deno.lock @@ -2080,6 +2080,122 @@ "https://raw.githubusercontent.com/metatypedev/ghjk/v0.2.1/utils/unarchive.ts": "f6d0e9e75f470eeef5aecd0089169f4350fc30ebfdc05466bb7b30042294d6d3", "https://raw.githubusercontent.com/metatypedev/ghjk/v0.2.1/utils/url.ts": "e1ada6fd30fc796b8918c88456ea1b5bbd87a07d0a0538b092b91fd2bb9b7623", "https://raw.githubusercontent.com/metatypedev/ghjk/v0.2.1/utils/worker.ts": "ac4caf72a36d2e4af4f4e92f2e0a95f9fc2324b568640f24c7c2ff6dc0c11d62", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/engine/bindings.ts": "7c3e28ec60a0381030310228be6c02f1a434046b4cbcf793a537aaef47be949f", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/engine/runtime.js": "1ae55e76d3de8e79c37054d9127c92af496ce10aa905ea64021893048bb33794", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/config.ts": "63ea402f9a993888a9e3ec88d35112186f8f13bcd3a5fe358e69e0bb603311a5", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/config/loader.ts": "91cc2b67cc9bee413b0b44f9aa2ea7814f50e2465e6bc114eece248554d7477d", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/config/shared.ts": "252b42038eb68059b2cac85c792e36f5849b8e7392b98452341ccc3ee680a774", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/config/types.ts": "73357168542ef041da67997acdd98097444d92f0a1663be03ad1523fd20f768c", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/crypto.ts": "f550775b9e5bf9e7ec286a1596246a631b117fd91e093169bcad4898fb729634", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/computation_engine.ts": "07a3826fcf0bb13eb3912b8e5cbf69932848cd28c1c4ebda7042f977510d00a5", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/planner/args.ts": "de16ba5c087afae319f65d02ab39779146da37ea925f610da8887cffe7828060", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/planner/dependency_resolver.ts": "b851f4a6e2d500f9427dd1a59920d6c71f10904b31863bb1fac4d26e01d02b67", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/planner/injection_utils.ts": "6f9ad0f8f9cde9a985b6ad36bf58418637a85f50749abe6870c792ade7dc45a2", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/planner/mod.ts": "9a4429e7a579903f4f67ab53bd602b2d05a58138bdbd91c7cc5b1b44cf714b68", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/planner/parameter_transformer.ts": "3ba3b9603c6d28c0d54648f8177bce30b8b667e0e1be903d468af3f2645649ff", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/planner/policies.ts": "caf3cfd8a46e21a5d09fdb46882d6ea4ffb376c56070bdb1ccff92fa70989d63", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/query_engine.ts": "39281c309b3d72123fcd8695700bd2831956e09d2b1c082ef899886beea6ae82", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/stage_id.ts": "b3b3c62215ff421103788079b77943af8f0026a56eafaa929415cb39ccde3cca", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/code_generator.ts": "edb77e2b98da2f040d3f7567d204dba2a3d8c66ae1a7c2709c049e464763f0cd", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/common.ts": "b585975e1a978dfa966df1a549261049ab159077bc90203a33bfe8ae055b3c6f", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/inline_validators/common.ts": "112f56c8e590215b0af0c1b46dc84b85cb5b9b43621a52646876c35a43103499", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/inline_validators/constraints.ts": "3237d0acce31aca8b2f2bbc0cae8a82d86f3671fcc7fabc3158037c4f79008f5", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/inline_validators/list.ts": "bd70fef3bc3840cfb6255a518de5fdb3db79a68a4481594475aebcbdd6a10102", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/inline_validators/number.ts": "9890c8af998dca2e573fc2ad02e63d9abc9b506b4a0c451d31f5916a8888e401", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/inline_validators/object.ts": "bd4f8891ee823bf82481df2ee181256514fd7299b5fe4fd7cd7194defa228f57", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/inline_validators/string.ts": "914a2b809a344075279578cb35ac3d03cb6025eb9f62c1f9f86958191b9857da", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/input.ts": "cf24fcffa1891dfc2f2af941a64aade9da069a6ef92baa432e2d7dcf5f9a8b86", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/matching_variant.ts": "aca8db649194921a01aca42b02113d0735262bb63d41ec44174e61c4cfa85369", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/result.ts": "6544f206b67c32015950ec96134415c261a60f54c469c1cd73f8accadf87fff6", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/errors.ts": "29dfbfdc8b7a85ee9551831d6db882e50a4e0104102b5885b2bd9a42878365f6", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/libs/jsonpath.ts": "f6851288fb8600dec0e62d5f804f41332b6197b255b6497360ba7e4b7f375cba", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/log.ts": "1330c01d489956c7530e2f2e2e60967f30c6b3a0c5c1d6c18d161ea2cf44fa0e", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/main.ts": "f390cfd2b5b836f1a54fa9ea7d8a5f5ba80430b6e849032145c0a7c0ae7216f3", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/Runtime.ts": "cc476f09f7d32d10dec3812a9a589da2866247e2064ce149ea2dc68fca833730", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/deno.ts": "c893dcf170b38547239d550080a856aca46a788de9922f282bbacf9b5841b5fe", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/deno/deno.ts": "bb0cdad8e785d43f6c59232e214fab82d43476acbcef740f561708b064bae172", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/deno/deno_messenger.ts": "81160c8a9c9817b46b52c4eee15cde880fb3f6b013c3b5110ee07a4c9c7f7a5e", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/deno/shared_types.ts": "34d56aa89c5a34e943a34b623b20d13ca54ab5466ea5313e0543da68b7aebcb1", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/deno/worker.ts": "ffeabab915301a666ac06b28989d5be4b29e600fb2932e25005ec1c9f48aac1d", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/graphql.ts": "5f0f4125367fd5fc43ccb2b8c9e8ba1f9c84348595e70e5ed9870e776d2efed3", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/grpc.ts": "92b2f5214ebe0f7b61e582faa67d6759641feaf788166a939ec6db8d819708da", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/http.ts": "f598a33aa3cafcf37a1f33d84c06bfd0ef5fd768f72837042c83ac6ae1d90762", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/kv.ts": "7d87409d8f93a4f684e1a0aabd020e5f3e559669fe3ca8efee9cd5045fde99dd", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/mod.ts": "26c06f1bff03255c20df97e1a109944b6fd2872acbb27aa97ab38b081fb19d7e", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/patterns/messenger/async_messenger.ts": "40644e011e3a258138ff1fb7a5323754a547016da9c1deb2114cfc471ee28bf0", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/patterns/messenger/lazy_async_messenger.ts": "b93d5e7252231d27d6b76ec4172d67cc23880b78411fb371d0cba2db712e2161", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/prisma.ts": "e4b679c3b5e28a323d72bde5ebbcc113abe0efc8da82d70b3b2e390149c57d84", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/prisma/hooks/generate_schema.ts": "f55ffcb6fdfdfcb29eb5543ac23f89e224fc7e233f4ec598f7c5f44f05eefed2", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/prisma/hooks/mod.ts": "3e33752e3676b538c7016f3ddd4f1f49d75e217c410bcaa6319d33ed987d3c60", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/prisma/hooks/run_migrations.ts": "b94b09ecdc7d81ddcfd7596ae8cfb1ebbc8896d4c67207da627dcd79d19c658c", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/prisma/migration.ts": "f501540557b13a32f7b57e5a87f4ae1794cdd95214a49b34a429d7a33a96d5d8", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/prisma/mod.ts": "a0e44e86a45aad8b2bb0357ddbe8ba02802e6979451553940ec3688be571127f", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/prisma/prisma.ts": "bc370cfcb0f2aad520b8d2fd082e18dad5d41386225b50c9ce577b6c45df55b3", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/prisma/types.ts": "b4912f164aa8cdb1db3a98238a0271882864ff2778c10920dd7f0f3d59165dd6", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/python.ts": "77e7f683830962365ce7ce0af5fc5d326e11bc9751ab33d7add16d27feb32633", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/random.ts": "e7651e262ef5857e777ad46877c66f9098a2dfe774c13720a4cd38be327b53ff", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/s3.ts": "d7a0372faf555180bd4326550c1c6a07b156d3c5f0bbbcf9c0f6eb4b0f2bfff1", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/substantial.ts": "175644d75911d09919c06577bfa86239b3a44b1217664035551ff0989e22882a", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/substantial/agent.ts": "223288cb3d7baa02fa2d4e37207da7fa69cf4f16eb04ed7810d3e91ac725615b", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/substantial/types.ts": "8255ea84c5129ffc049d6fa88ad57eadf298d420ff11782c43eae9d2031efed1", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/substantial/workflow_worker_manager.ts": "589611456b82df0637db5f63af0881a459747d7c8963684bdcde291af13515cd", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/temporal.ts": "fef8a8f70d3f75957a5a741c275abea96cc492722784ea4aadffd9fce9cbff3f", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/typegate.ts": "52d49471d2682c1be323b53e4cca9866f2babb93708a855daa8c471ba4174b64", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/typegraph.ts": "e5808e5a20080fc260e54113e5941e5dffaeead5e3b7448dc17a48031d4799cf", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/utils/graphql_forward_vars.ts": "f0bb091aadd191eb1491dd86b7abd311ab60e09f532d226c8328b2cfa6025d9e", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/utils/graphql_inline_vars.ts": "9c3c339ee596c93cf65cda696d756c9ef08d34b78e4136472e27a92f2254ec8a", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/utils/http.ts": "842af99040fd0e3456690f7674311da3a0b9ea64c608d7bc588df1ab28f163a3", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/wasm_reflected.ts": "99d59cdd0c4b228c42ac90099036ecf5d2e14d6758916b27e4017d53b69cf481", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/wasm_wire.ts": "d10c891f12c9521bcd1a7e1cb459f642a5f4e0936f25f4e04174141691ba06d1", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/wit_wire/mod.ts": "78ff89ee3972aafd73be8965e1f682b5877c9d1fc4ec2bce0db09f7bc13a0252", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/artifact_service.ts": "282a9a6c3d89afc8955aabab6b3b242edccba664f5f41558e9c9b07d43dd8d13", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/cookies.ts": "ee17535cb19eab884732cefcdc46e63a2905041d5b5942e9ad6783c50a1f8624", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/mod.ts": "5b15823ec19cec1c985a77d525ee2e9e5c5aa367f5e24c96e305e485b6c633a9", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/protocols/basic.ts": "3c233ae1ccd0d3a8ff47a32c74682921abaf84e0de7c096f220f63b05756fc58", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/protocols/internal.ts": "7a9173406fbc1b885e08dd74a8dd34f168de2f1e9bedef4cdd88dad613e59166", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/protocols/jwt.ts": "e39249df7c2d088da07af1ccf5e97815addb46a994469efd4a335f6ae8618bc5", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/protocols/oauth2.ts": "7172cc6da5ecba71775bbc2d467d52d1f78505204e55452170f35004923b847b", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/protocols/protocol.ts": "158c55618be6165a9ee393ccd1a9da267b084ff04df7e627af1e4fc8fe636644", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/routes/mod.ts": "8fe85c16feb3da7086d3d6fd19a4579585b632893f3534c533c60aed84b9413a", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/routes/take.ts": "bc343c5d34870aeeaf9b0cc9473ba18fe7b324a23a630a57c9fd41eea4418a46", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/routes/validate.ts": "56e52bb6d1660735683bdd398a86936f24ad8a00e402b7d88790867ad559e476", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/graphql_service.ts": "458e3cedcd22a44e166e531bcac4c65972916d81f3776c8161b2440ad212626f", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/info_service.ts": "a9a1f6ebdcbe64d55806597b879dd5714c32b8b861bed695a944f5e2f1213beb", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/middlewares.ts": "8af6277ce67c940564538f4def8e6567b5783b51f7c5f38c902736d620ffe405", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/playground_service.ts": "2cc8689899be7c31ad6c2e9c2c5adde0c6cc1f1442b27a55e8ead830e867dbe5", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/responses.ts": "5c45923c1374aab1ac8dd5b1a09ae69062ab34a448f8e92630678a236e38b2ba", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/rest_service.ts": "ae6ffdbddaccdbc7ed11dfb86511f2917332dcf5ae22ed814e1059e640ff7b08", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/sync/replicated_map.ts": "6b94fb884ce81d7e17572ae0abbeb91ceadb31f9356c4e9255982a00edcfe729", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/sync/typegraph.ts": "78120bc4d35e728ed86a98781c5d60996050fa8b35fa91f563c3c8b2a964b5dd", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/system_typegraphs.ts": "51299d60c1bb75b3e74998eb77bdf1680ee9d4a2f29a267d3ca90b2867c577fb", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/transports/graphql/gq.ts": "78435e53ec1c5b7aec29364c051eb8f10802714050d24ee68a65e1e263495d7d", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/transports/graphql/graphql.ts": "9f4aa79276e05acc6020da2a18472a1cc54c0ecf42efcbf017d67a88b0b90af2", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/transports/graphql/request_parser.ts": "afbc95debcb1bbfa6fc2b88937d7abedbed1f4335bb2d17bf98c7293761cfdb0", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/transports/graphql/typegraph.ts": "fc0ba3f62e1dd687a0545adb1dbaf7185176e0f1e938bfdd29cfef7f85951635", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/transports/graphql/utils.ts": "d09147add80f5e53a643ed3126ee8675a1655480728311de2def04ffe6262a4b", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/transports/rest/rest_schema_generator.ts": "c776e83c6a55e9bee3ec72c36c1d771b3ca711e4086b3728e4983ab866472624", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegate/artifacts/local.ts": "d36ece0f53a56922744dd4d3e170101466b3816ba136f9574e799880e27d1a4b", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegate/artifacts/mod.ts": "fc931ffd49dc168da12882acf1055d3252e0cb3b666928e67d08d2a6c5be3447", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegate/artifacts/shared.ts": "5061a07eb880e33c1543e7397e945d50b476ed51d81fc01d109c53295f089131", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegate/hooks.ts": "ea97c08285388300802676d03dbc06caadf060093736abce07ef8f99a60e9a04", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegate/memory_register.ts": "6eab24914a941f85c233037013dc13749d8b689c5f9ffb38600df4c7b00a94f0", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegate/mod.ts": "d9f10b53a40192863a431c6be541effb4fd3c012ed8a716712d5176eba8c884a", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegate/no_limiter.ts": "1e98610a737bd74668f80b7014c64669a59a801355340eaa14411e07f4a8a94e", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegate/rate_limiter.ts": "b5718ab9e718314f11f5d88d84795bd0e61575856470793f1fe83d499f4a9d40", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegate/register.ts": "d7a8732386ad019d4dcee0372b6cab93bfc55e0146729842db2aaecf1411b15d", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegraph/mod.ts": "27c917783dd8cf99d06290c0768e852ab348c3e989e47c77e648ffcc564b79fb", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegraph/type_node.ts": "7f721cd5f6da2cbc7e66b804e0f81e0429aa2893e0a93244f9e66b39cb96b1a0", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegraph/types.ts": "fc813b5f18e71b58e5f7904cd7fe3d6cae38b3c7055a8875042588c1561df160", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegraph/utils.ts": "66fe8e1b5072f52ea2efebc5cf42001c3b858068b2d970ee3c8558032ff53103", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegraph/versions.ts": "cdab4b07960f78c1f18511a8cc464a7e97c4c1fd15c6e8678c109483d3c26508", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegraph/visitor.ts": "0fb0f89d92cb1654c1b010494a14c1aad88c7923102ea3e89866b232d3bcdf04", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegraphs/introspection.json": "bbcf2c4233371c7f36052e5fe9e1cb1d18a46d3f31391cfcba2a3063c9141adb", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegraphs/prisma_migration.json": "dfc346ff8fc2cef611c8f172b90e9d13eae6fed8b3dd65dea8631f9533159173", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegraphs/typegate.json": "bc0cbf4cd2c5de34410779994240993db4f1dd3d1eeda10b6045efdc37eb48a4", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/types.ts": "a36918c2bfab397edec906c23d2cd7558246337bb16fdf1ea4e353cffea5f2b4", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/utils.ts": "de1a17260e76607e1a8fd6d7384cbc21bb26e08f64bffc41d6508bf5a8359311", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/utils/hash.ts": "df6cf462c7a6a805b91dce9d3e7bbbd00ea3bfd8dcc973fb3e6c94e48e33d9b9", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/worker_utils.ts": "19f686d729b947ab3eb2f29e99ccd07578037a3bccced65fc0dce42d5338cd31", "https://raw.githubusercontent.com/metatypedev/metatype/54558c719cf3d491c396af019a50b68159c5209f/src/typegate/engine/bindings.ts": "4529b86703a1512302164bca346c29df2a246d0ebbf20248cc39ee9745490dc1", "https://raw.githubusercontent.com/metatypedev/metatype/54558c719cf3d491c396af019a50b68159c5209f/src/typegate/engine/runtime.js": "1ae55e76d3de8e79c37054d9127c92af496ce10aa905ea64021893048bb33794", "https://raw.githubusercontent.com/metatypedev/metatype/54558c719cf3d491c396af019a50b68159c5209f/src/typegate/src/config.ts": "63ea402f9a993888a9e3ec88d35112186f8f13bcd3a5fe358e69e0bb603311a5", diff --git a/examples/templates/deno/api/example.ts b/examples/templates/deno/api/example.ts index f852c3fab4..65ca612621 100644 --- a/examples/templates/deno/api/example.ts +++ b/examples/templates/deno/api/example.ts @@ -1,6 +1,6 @@ -import { Policy, t, typegraph } from "jsr:@typegraph/sdk@0.5.0-rc.4/index.ts"; -import { PythonRuntime } from "jsr:@typegraph/sdk@0.5.0-rc.4/runtimes/python.ts"; -import { DenoRuntime } from "jsr:@typegraph/sdk@0.5.0-rc.4/runtimes/deno.ts"; +import { Policy, t, typegraph } from "jsr:@typegraph/sdk@0.5.0-rc.5/index.ts"; +import { PythonRuntime } from "jsr:@typegraph/sdk@0.5.0-rc.5/runtimes/python.ts"; +import { DenoRuntime } from "jsr:@typegraph/sdk@0.5.0-rc.5/runtimes/deno.ts"; await typegraph("example", (g) => { const pub = Policy.public(); diff --git a/examples/templates/deno/compose.yml b/examples/templates/deno/compose.yml index 82d20d6cc6..32eaab03f6 100644 --- a/examples/templates/deno/compose.yml +++ b/examples/templates/deno/compose.yml @@ -1,6 +1,6 @@ services: typegate: - image: ghcr.io/metatypedev/typegate:v0.5.0-rc.4 + image: ghcr.io/metatypedev/typegate:v0.5.0-rc.5 restart: always ports: - "7890:7890" diff --git a/examples/templates/node/compose.yml b/examples/templates/node/compose.yml index 77c4f00ae7..1814897da9 100644 --- a/examples/templates/node/compose.yml +++ b/examples/templates/node/compose.yml @@ -1,6 +1,6 @@ services: typegate: - image: ghcr.io/metatypedev/typegate:v0.5.0-rc.4 + image: ghcr.io/metatypedev/typegate:v0.5.0-rc.5 restart: always ports: - "7890:7890" diff --git a/examples/templates/node/package.json b/examples/templates/node/package.json index 617098c32d..8fd1ab330a 100644 --- a/examples/templates/node/package.json +++ b/examples/templates/node/package.json @@ -6,7 +6,7 @@ "dev": "MCLI_LOADER_CMD='npm x tsx' meta dev" }, "dependencies": { - "@typegraph/sdk": "^0.5.0-rc.4" + "@typegraph/sdk": "^0.5.0-rc.5" }, "devDependencies": { "tsx": "^3.13.0", diff --git a/examples/templates/python/compose.yml b/examples/templates/python/compose.yml index 77c4f00ae7..1814897da9 100644 --- a/examples/templates/python/compose.yml +++ b/examples/templates/python/compose.yml @@ -1,6 +1,6 @@ services: typegate: - image: ghcr.io/metatypedev/typegate:v0.5.0-rc.4 + image: ghcr.io/metatypedev/typegate:v0.5.0-rc.5 restart: always ports: - "7890:7890" diff --git a/examples/templates/python/pyproject.toml b/examples/templates/python/pyproject.toml index a801a8b75a..4f7581522c 100644 --- a/examples/templates/python/pyproject.toml +++ b/examples/templates/python/pyproject.toml @@ -1,12 +1,12 @@ [tool.poetry] name = "example" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" description = "" authors = [] [tool.poetry.dependencies] python = ">=3.8,<4.0" -typegraph = "0.5.0-rc.4" +typegraph = "0.5.0-rc.5" [build-system] requires = ["poetry-core"] diff --git a/pyproject.toml b/pyproject.toml index b10c72007d..3fe6894989 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ [tool.poetry] name = "metatype" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" description = "" authors = [] diff --git a/src/meta-lsp/package.json b/src/meta-lsp/package.json index f088c8b096..6d5daf839f 100644 --- a/src/meta-lsp/package.json +++ b/src/meta-lsp/package.json @@ -4,7 +4,7 @@ "description": "VSCode extension for Metatype support", "icon": "logo.png", "author": "Metatype Team", - "version": "0.5.0-rc.4", + "version": "0.5.0-rc.5", "repository": { "type": "git", "url": "https://github.com/metatypedev/metatype" diff --git a/src/meta-lsp/ts-language-server/package.json b/src/meta-lsp/ts-language-server/package.json index 31c733135b..e3f80f4774 100644 --- a/src/meta-lsp/ts-language-server/package.json +++ b/src/meta-lsp/ts-language-server/package.json @@ -2,7 +2,7 @@ "name": "typegraph-ts-server", "description": "TypeScript language server for TypeGraph", "author": "Metatype Team", - "version": "0.5.0-rc.4", + "version": "0.5.0-rc.5", "repository": { "type": "git", "url": "https://github.com/metatypedev/metatype" diff --git a/src/meta-lsp/vscode-metatype-support/package.json b/src/meta-lsp/vscode-metatype-support/package.json index 9b7f735336..a8cf018d26 100644 --- a/src/meta-lsp/vscode-metatype-support/package.json +++ b/src/meta-lsp/vscode-metatype-support/package.json @@ -2,7 +2,7 @@ "name": "vscode-metatype-support", "description": "VSCode extension for Metatype support", "author": "Metatype Team", - "version": "0.5.0-rc.4", + "version": "0.5.0-rc.5", "repository": { "type": "git", "url": "https://github.com/metatypedev/metatype" diff --git a/src/pyrt_wit_wire/pyproject.toml b/src/pyrt_wit_wire/pyproject.toml index d25807c3c0..429c6d1d1c 100644 --- a/src/pyrt_wit_wire/pyproject.toml +++ b/src/pyrt_wit_wire/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pyrt_wit_wire" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" description = "Wasm component implementing the PythonRuntime host using wit_wire protocol." license = "MPL-2.0" readme = "README.md" diff --git a/src/typegate/src/runtimes/substantial.ts b/src/typegate/src/runtimes/substantial.ts index 8d294555a3..3f4ac726f2 100644 --- a/src/typegate/src/runtimes/substantial.ts +++ b/src/typegate/src/runtimes/substantial.ts @@ -15,12 +15,11 @@ import { Backend } from "../../engine/runtime.js"; import { Agent, AgentConfig, + type StdKwargs, WorkflowDescription, } from "./substantial/agent.ts"; import { closestWord } from "../utils.ts"; import { InternalAuth } from "../services/auth/protocols/internal.ts"; -import { TaskContext } from "./deno/shared_types.ts"; -import { globalConfig } from "../config.ts"; const logger = getLogger(import.meta); @@ -68,6 +67,7 @@ export class SubstantialRuntime extends Runtime { queue: string, agent: Agent, typegate: Typegate, + private secrets: Record, ) { super(typegraphName); this.logger = getLogger(`substantial:'${typegraphName}'`); @@ -112,20 +112,7 @@ export class SubstantialRuntime extends Runtime { maxAcquirePerTick: typegate.config.base.substantial_max_acquire_per_tick, } satisfies AgentConfig; - // Note: required for ctx.gql() - const token = await InternalAuth.emit(typegate.cryptoKeys); - const internalTCtx = { - context: {}, - secrets: {}, - effect: null, - meta: { - url: `http://127.0.0.1:${globalConfig.tg_port}/${tgName}`, - token, - }, - headers: {}, - } satisfies TaskContext; - - const agent = new Agent(backend, queue, agentConfig, internalTCtx); + const agent = new Agent(backend, queue, agentConfig); const wfDescriptions = await getWorkflowDescriptions( tgName, @@ -144,6 +131,7 @@ export class SubstantialRuntime extends Runtime { queue, agent, typegate, + secrets, ); await instance.#prepareWorkflowFiles( tg.meta.artifacts, @@ -211,9 +199,9 @@ export class SubstantialRuntime extends Runtime { switch (matName) { case "start": - return this.#startResolver(false); + return this.#startResolver(mat, false); case "start_raw": - return this.#startResolver(true); + return this.#startResolver(mat, true); case "stop": return this.#stopResolver(); case "send": @@ -240,13 +228,41 @@ export class SubstantialRuntime extends Runtime { } } - #startResolver(enableGenerics: boolean): Resolver { - return async ({ name: workflowName, kwargs }) => { + #startResolver(mat: TypeMaterializer, enableGenerics: boolean): Resolver { + const secrets = ((mat.data.secrets as []) ?? []).reduce( + (agg, secretName) => ({ ...agg, [secretName]: this.secrets[secretName] }), + {}, + ); + return async ({ + name: workflowName, + kwargs, + _: { + context, + parent, + info: { url, headers }, + }, + }) => { this.#checkWorkflowExistOrThrow(workflowName); const runId = Agent.nextId(workflowName); const schedule = new Date().toJSON(); + const token = await InternalAuth.emit(this.typegate.cryptoKeys); + const stdKwargs = { + kwargs: enableGenerics ? JSON.parse(kwargs) : kwargs, + taskContext: { + parent, + context, + secrets, + effect: mat.effect.effect ?? null, + meta: { + url: `${url.protocol}//${url.host}/${this.typegraphName}`, + token, + }, + headers, + }, + } satisfies StdKwargs; + logger.info( `Start request "${workflowName}" received: new run "${runId}" should be scheduled.`, ); @@ -259,7 +275,7 @@ export class SubstantialRuntime extends Runtime { at: schedule, event: { type: "Start", - kwargs: enableGenerics ? JSON.parse(kwargs) : kwargs, + kwargs: stdKwargs, }, }, }); diff --git a/src/typegate/src/runtimes/substantial/agent.ts b/src/typegate/src/runtimes/substantial/agent.ts index 709d29faa2..78439d637c 100644 --- a/src/typegate/src/runtimes/substantial/agent.ts +++ b/src/typegate/src/runtimes/substantial/agent.ts @@ -18,6 +18,11 @@ import { RunId, WorkerManager } from "./workflow_worker_manager.ts"; const logger = getLogger(); +export interface StdKwargs { + taskContext: TaskContext; + kwargs: Record; +} + export interface WorkflowDescription { name: string; path: string; @@ -39,7 +44,6 @@ export class Agent { private backend: Backend, private queue: string, private config: AgentConfig, - private internalTCtx: TaskContext, ) {} async schedule(input: AddScheduleInput) { @@ -247,6 +251,7 @@ export class Agent { return; } + const { taskContext, kwargs } = first.event.kwargs as unknown as StdKwargs; try { this.workerManager.triggerStart( workflow.name, @@ -254,8 +259,8 @@ export class Agent { workflow.path, run, next.schedule_date, - first.event.kwargs, - this.internalTCtx, + kwargs, + taskContext, ); this.workerManager.listen( diff --git a/src/typegate/src/runtimes/substantial/deno_context.ts b/src/typegate/src/runtimes/substantial/deno_context.ts index 03e73edb5f..32b85f66b3 100644 --- a/src/typegate/src/runtimes/substantial/deno_context.ts +++ b/src/typegate/src/runtimes/substantial/deno_context.ts @@ -1,9 +1,6 @@ // Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. // SPDX-License-Identifier: MPL-2.0 -// FIXME: DO NOT IMPORT any file that refers to Meta, this will be instantiated in a Worker -// import { sleep } from "../../utils.ts"; // will silently fail?? - import { make_internal } from "../../worker_utils.ts"; import { TaskContext } from "../deno/shared_types.ts"; import { appendIfOngoing, Interrupt, OperationEvent, Run } from "./types.ts"; diff --git a/src/typegate/src/runtimes/substantial/worker.ts b/src/typegate/src/runtimes/substantial/worker.ts index bff137738a..61f7a5dec5 100644 --- a/src/typegate/src/runtimes/substantial/worker.ts +++ b/src/typegate/src/runtimes/substantial/worker.ts @@ -28,7 +28,7 @@ self.onmessage = async function (event) { runCtx = new Context(run, kwargs, internal); - workflowFn(runCtx) + workflowFn(runCtx, internal) .then((wfResult: unknown) => { self.postMessage( Ok( diff --git a/src/typegate/src/runtimes/wit_wire/mod.ts b/src/typegate/src/runtimes/wit_wire/mod.ts index c0984b51fb..0270fd2214 100644 --- a/src/typegate/src/runtimes/wit_wire/mod.ts +++ b/src/typegate/src/runtimes/wit_wire/mod.ts @@ -9,7 +9,7 @@ import { getLogger } from "../../log.ts"; const logger = getLogger(import.meta); -const METATYPE_VERSION = "0.5.0-rc.4"; +const METATYPE_VERSION = "0.5.0-rc.5"; export class WitWireMessenger { static async init( diff --git a/src/typegraph/core/Cargo.toml b/src/typegraph/core/Cargo.toml index 2fd6f83b36..6752ff48f0 100644 --- a/src/typegraph/core/Cargo.toml +++ b/src/typegraph/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "typegraph_core" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" edition = "2021" [lib] diff --git a/src/typegraph/core/src/global_store.rs b/src/typegraph/core/src/global_store.rs index 118b5ac8ca..dd31e9f310 100644 --- a/src/typegraph/core/src/global_store.rs +++ b/src/typegraph/core/src/global_store.rs @@ -107,7 +107,7 @@ const PREDEFINED_DENO_FUNCTIONS: &[&str] = &["identity", "true"]; thread_local! { pub static STORE: RefCell = RefCell::new(Store::new()); - pub static SDK_VERSION: String = "0.5.0-rc.4".to_owned(); + pub static SDK_VERSION: String = "0.5.0-rc.5".to_owned(); } fn with_store T>(f: F) -> T { diff --git a/src/typegraph/core/src/lib.rs b/src/typegraph/core/src/lib.rs index f44c45e921..e13e0db35c 100644 --- a/src/typegraph/core/src/lib.rs +++ b/src/typegraph/core/src/lib.rs @@ -42,6 +42,7 @@ use wit::runtimes::{Guest, MaterializerDenoFunc}; pub mod wit { wit_bindgen::generate!({ + world: "typegraph" }); use crate::Lib; diff --git a/src/typegraph/core/src/runtimes/substantial.rs b/src/typegraph/core/src/runtimes/substantial.rs index 552cd78f85..23a8245538 100644 --- a/src/typegraph/core/src/runtimes/substantial.rs +++ b/src/typegraph/core/src/runtimes/substantial.rs @@ -10,15 +10,14 @@ use crate::types::WithRuntimeConfig; use crate::wit::core::FuncParams; use crate::wit::{ core::RuntimeId, runtimes::Effect as WitEffect, runtimes::SubstantialOperationData, - runtimes::SubstantialOperationType, }; use common::typegraph::Materializer; use serde_json::json; #[derive(Debug)] pub enum SubstantialMaterializer { - Start, - StartRaw, + Start { secrets: Vec }, + StartRaw { secrets: Vec }, Stop, Send, SendRaw, @@ -38,8 +37,15 @@ impl MaterializerConverter for SubstantialMaterializer { let runtime = c.register_runtime(runtime_id)?; let (name, data) = match self { - SubstantialMaterializer::Start => ("start".to_string(), json!({})), - SubstantialMaterializer::StartRaw => ("start_raw".to_string(), json!({})), + SubstantialMaterializer::Start { secrets } => { + ("start".to_string(), json!({ "secrets":secrets })) + } + SubstantialMaterializer::StartRaw { secrets } => ( + "start_raw".to_string(), + json!({ + "secrets": secrets + }), + ), SubstantialMaterializer::Stop => ("stop".to_string(), json!({})), SubstantialMaterializer::Send => ("send".to_string(), json!({})), SubstantialMaterializer::SendRaw => ("send_raw".to_string(), json!({})), @@ -65,23 +71,37 @@ pub fn substantial_operation( data: SubstantialOperationData, ) -> Result { let mut inp = t::struct_(); - let (effect, mat_data, out_ty) = match data.operation { - SubstantialOperationType::Start | SubstantialOperationType::StartRaw => { - let (mat, flag) = match data.operation { - SubstantialOperationType::Start => (SubstantialMaterializer::Start, true), - SubstantialOperationType::StartRaw => (SubstantialMaterializer::StartRaw, false), - _ => unreachable!(), - }; - + let (effect, mat_data, out_ty) = match data { + SubstantialOperationData::Start(data) => { inp.prop("name", t::string().build()?); inp.prop( "kwargs", - use_arg_or_json_string(data.func_arg, flag)?.into(), + data.func_arg + .ok_or("input or output shape is not defined on the typegraph".to_string())? + .into(), ); - (WitEffect::Create(true), mat, t::string().build()?) + ( + WitEffect::Create(true), + SubstantialMaterializer::Start { + secrets: data.secrets, + }, + t::string().build()?, + ) + } + SubstantialOperationData::StartRaw(data) => { + inp.prop("name", t::string().build()?); + inp.prop("kwargs", t_json_string()?.into()); + + ( + WitEffect::Create(true), + SubstantialMaterializer::StartRaw { + secrets: data.secrets, + }, + t::string().build()?, + ) } - SubstantialOperationType::Stop => { + SubstantialOperationData::Stop => { inp.prop("run_id", t::string().build()?); ( @@ -90,27 +110,37 @@ pub fn substantial_operation( t::list(t::string().build()?).build()?, ) } - SubstantialOperationType::Send | SubstantialOperationType::SendRaw => { - let (mat, flag) = match data.operation { - SubstantialOperationType::Send => (SubstantialMaterializer::Send, true), - SubstantialOperationType::SendRaw => (SubstantialMaterializer::SendRaw, false), - _ => unreachable!(), - }; + SubstantialOperationData::Send(data) => { + let event = t::struct_() + .prop("name", t::string().build()?) + .prop("payload", data.into()) + .build()?; + + inp.prop("run_id", t::string().build()?); + inp.prop("event", event); + ( + WitEffect::Create(false), + SubstantialMaterializer::Send, + t::string().build()?, + ) + } + SubstantialOperationData::SendRaw => { let event = t::struct_() .prop("name", t::string().build()?) - .prop( - "payload", - use_arg_or_json_string(data.func_arg, flag)?.into(), - ) + .prop("payload", t_json_string()?.into()) .build()?; inp.prop("run_id", t::string().build()?); inp.prop("event", event); - (WitEffect::Create(false), mat, t::string().build()?) + ( + WitEffect::Create(false), + SubstantialMaterializer::SendRaw, + t::string().build()?, + ) } - SubstantialOperationType::Resources => { + SubstantialOperationData::Resources => { inp.prop("name", t::string().build()?); let row = t::struct_() @@ -129,65 +159,23 @@ pub fn substantial_operation( (WitEffect::Read, SubstantialMaterializer::Resources, out) } - SubstantialOperationType::Results | SubstantialOperationType::ResultsRaw => { - let (mat, flag) = match data.operation { - SubstantialOperationType::Results => (SubstantialMaterializer::Results, true), - SubstantialOperationType::ResultsRaw => { - (SubstantialMaterializer::ResultsRaw, false) - } - _ => unreachable!(), - }; - + SubstantialOperationData::Results(data) => { inp.prop("name", t::string().build()?); - let out = use_arg_or_json_string(data.func_out, flag)?; - - let count = t::integer().build()?; - - let result = t::struct_() - .prop("status", t::string().build()?) - .prop("value", t::optional(out.into()).build()?) - .build()?; - - let ongoing_runs = t::list( - t::struct_() - .prop("run_id", t::string().build()?) - .prop("started_at", t::string().build()?) - .build()?, - ) - .build()?; - - let completed_runs = t::list( - t::struct_() - .prop("run_id", t::string().build()?) - .prop("started_at", t::string().build()?) - .prop("ended_at", t::string().build()?) - .prop("result", result) - .build()?, + ( + WitEffect::Read, + SubstantialMaterializer::Results, + results_op_results_ty(data)?, ) - .build()?; - + } + SubstantialOperationData::ResultsRaw => { + inp.prop("name", t::string().build()?); ( WitEffect::Read, - mat, - t::struct_() - .prop( - "ongoing", - t::struct_() - .prop("count", count) - .prop("runs", ongoing_runs) - .build()?, - ) - .prop( - "completed", - t::struct_() - .prop("count", count) - .prop("runs", completed_runs) - .build()?, - ) - .build()?, + SubstantialMaterializer::ResultsRaw, + results_op_results_ty(t_json_string()?)?, ) } - SubstantialOperationType::InternalLinkParentChild => { + SubstantialOperationData::InternalLinkParentChild => { inp.prop("parent_run_id", t::string().build()?); inp.prop("child_run_id", t::string().build()?); @@ -208,12 +196,7 @@ pub fn substantial_operation( }) } -fn use_arg_or_json_string(arg: Option, flag: bool) -> Result { - if flag { - let arg = arg.ok_or("input or output shape is not defined on the typegraph".to_string())?; - return Ok(arg); - }; - +fn t_json_string() -> Result { t::string() .build() .and_then(|r| { @@ -223,3 +206,47 @@ fn use_arg_or_json_string(arg: Option, flag: bool) -> Result { }) .map(|r| r.id().into()) } + +fn results_op_results_ty(out: u32) -> Result { + let count = t::integer().build()?; + + let result = t::struct_() + .prop("status", t::string().build()?) + .prop("value", t::optional(out.into()).build()?) + .build()?; + + let ongoing_runs = t::list( + t::struct_() + .prop("run_id", t::string().build()?) + .prop("started_at", t::string().build()?) + .build()?, + ) + .build()?; + + let completed_runs = t::list( + t::struct_() + .prop("run_id", t::string().build()?) + .prop("started_at", t::string().build()?) + .prop("ended_at", t::string().build()?) + .prop("result", result) + .build()?, + ) + .build()?; + + t::struct_() + .prop( + "ongoing", + t::struct_() + .prop("count", count) + .prop("runs", ongoing_runs) + .build()?, + ) + .prop( + "completed", + t::struct_() + .prop("count", count) + .prop("runs", completed_runs) + .build()?, + ) + .build() +} diff --git a/src/typegraph/core/wit/typegraph.wit b/src/typegraph/core/wit/typegraph.wit index 611fe47393..19ff85ccfa 100644 --- a/src/typegraph/core/wit/typegraph.wit +++ b/src/typegraph/core/wit/typegraph.wit @@ -514,24 +514,25 @@ interface runtimes { file-descriptions: list } - variant substantial-operation-type { - start, - start-raw, + record substantial-start-data { + func-arg: option, + secrets: list, + } + + variant substantial-operation-data { + start(substantial-start-data), + start-raw(substantial-start-data), stop, - send, + // type of send value + send(type-id), send-raw, resources, - results, + // type of result + results(type-id), results-raw, internal-link-parent-child } - record substantial-operation-data { - func-arg: option, - func-out: option, - operation: substantial-operation-type, - } - register-substantial-runtime: func(data: substantial-runtime-data) -> result; generate-substantial-operation: func(runtime: runtime-id, data: substantial-operation-data) -> result; diff --git a/src/typegraph/deno/deno.json b/src/typegraph/deno/deno.json index c63181d72d..99d2a8b2d9 100644 --- a/src/typegraph/deno/deno.json +++ b/src/typegraph/deno/deno.json @@ -1,6 +1,6 @@ { "name": "@typegraph/sdk", - "version": "0.5.0-rc.4", + "version": "0.5.0-rc.5", "publish": { "exclude": [ "!src/gen", diff --git a/src/typegraph/deno/src/runtimes/substantial.ts b/src/typegraph/deno/src/runtimes/substantial.ts index 63687739c5..7e9c81f858 100644 --- a/src/typegraph/deno/src/runtimes/substantial.ts +++ b/src/typegraph/deno/src/runtimes/substantial.ts @@ -7,28 +7,12 @@ import { Func, type Typedef } from "../types.ts"; import type { SubstantialBackend, SubstantialOperationData, - SubstantialOperationType, WorkflowFileDescription, WorkflowKind, } from "../gen/typegraph_core.d.ts"; -export class Backend { - static devMemory(): SubstantialBackend { - return { tag: "memory" }; - } - - static devFs(): SubstantialBackend { - return { tag: "fs" }; - } - - static redis(connectionStringSecret: string): SubstantialBackend { - return { - tag: "redis", - val: { - connectionStringSecret, - }, - }; - } +interface StartFunc { + secrets?: string[]; } export class SubstantialRuntime extends Runtime { @@ -47,31 +31,30 @@ export class SubstantialRuntime extends Runtime { } _genericSubstantialFunc( - operation: SubstantialOperationType, - funcArg?: Typedef, - funcOut?: Typedef, + data: SubstantialOperationData, ): Func { - const data = { - funcArg: funcArg?._id, - funcOut: funcOut?._id, - operation, - } as SubstantialOperationData; const funcData = runtimes.generateSubstantialOperation(this._id, data); return Func.fromTypeFunc(funcData); } - start(kwargs: Typedef): Func { + start( + kwargs: Typedef, + { secrets }: StartFunc = {}, + ): Func { return this._genericSubstantialFunc( { tag: "start", + val: { secrets: secrets ?? [], funcArg: kwargs._id }, }, - kwargs, ); } - startRaw(): Func { + startRaw( + { secrets }: StartFunc = {}, + ): Func { return this._genericSubstantialFunc({ tag: "start-raw", + val: { secrets: secrets ?? [] }, }); } @@ -85,8 +68,8 @@ export class SubstantialRuntime extends Runtime { return this._genericSubstantialFunc( { tag: "send", + val: payload._id, }, - payload, ); } @@ -106,9 +89,8 @@ export class SubstantialRuntime extends Runtime { return this._genericSubstantialFunc( { tag: "results", + val: output._id, }, - undefined, - output, ); } @@ -135,6 +117,25 @@ export class SubstantialRuntime extends Runtime { } } +export class Backend { + static devMemory(): SubstantialBackend { + return { tag: "memory" }; + } + + static devFs(): SubstantialBackend { + return { tag: "fs" }; + } + + static redis(connectionStringSecret: string): SubstantialBackend { + return { + tag: "redis", + val: { + connectionStringSecret, + }, + }; + } +} + export class WorkflowFile { private workflows: Array = []; diff --git a/src/typegraph/python/pyproject.toml b/src/typegraph/python/pyproject.toml index bdddb1e818..bc4c252bd3 100644 --- a/src/typegraph/python/pyproject.toml +++ b/src/typegraph/python/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "typegraph" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" description = "Declarative API development platform. Build backend components with WASM, Typescript and Python, no matter where and how your (legacy) systems are." authors = ["Metatype Contributors "] license = "MPL-2.0" diff --git a/src/typegraph/python/typegraph/__init__.py b/src/typegraph/python/typegraph/__init__.py index b73ccef9b1..ef07c55fd5 100644 --- a/src/typegraph/python/typegraph/__init__.py +++ b/src/typegraph/python/typegraph/__init__.py @@ -5,4 +5,4 @@ from typegraph.policy import Policy # noqa from typegraph import effects as fx # noqa -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" diff --git a/src/typegraph/python/typegraph/graph/tg_deploy.py b/src/typegraph/python/typegraph/graph/tg_deploy.py index e5fbdc6afe..af5d01e311 100644 --- a/src/typegraph/python/typegraph/graph/tg_deploy.py +++ b/src/typegraph/python/typegraph/graph/tg_deploy.py @@ -126,17 +126,17 @@ def tg_deploy(tg: TypegraphOutput, params: TypegraphDeployParams) -> DeployResul response = response.read().decode() response = handle_response(response) - if response.get("errors") is not None: - for err in response.errors: - Log.error(err.message) + if "errors" in response: + for err in response["errors"]: + Log.error(err["message"]) raise Exception(f"failed to deploy typegraph {tg.name}") add_typegraph = response.get("data").get("addTypegraph") """ # FIXME: read comments in similar section of typescript - if add_typegraph.get("failure") is not None: - Log.error(add_typegraph.failure) + if "failure" in add_typegraph: + Log.error(add_typegraph["failure"]) raise Exception(f"failed to deploy typegraph {tg.name}") """ return DeployResult(serialized=tg_json, response=add_typegraph) diff --git a/src/typegraph/python/typegraph/runtimes/deno.py b/src/typegraph/python/typegraph/runtimes/deno.py index 99a9c7e51d..58657df4a9 100644 --- a/src/typegraph/python/typegraph/runtimes/deno.py +++ b/src/typegraph/python/typegraph/runtimes/deno.py @@ -159,7 +159,7 @@ def import_policy( res = runtimes.import_deno_function( store, MaterializerDenoImport( - func_name=func_name, module=module, secrets=secrets or [] + func_name=func_name, module=module, secrets=secrets or [], deps=[] ), EffectRead(), ) diff --git a/src/typegraph/python/typegraph/runtimes/substantial.py b/src/typegraph/python/typegraph/runtimes/substantial.py index 836d35ccdd..f0cb7a80c6 100644 --- a/src/typegraph/python/typegraph/runtimes/substantial.py +++ b/src/typegraph/python/typegraph/runtimes/substantial.py @@ -1,7 +1,7 @@ # Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. # SPDX-License-Identifier: MPL-2.0 -from typing import List, Union +from typing import List, Optional from typegraph import t from typegraph.gen.exports.runtimes import ( RedisBackend, @@ -10,17 +10,17 @@ SubstantialBackendMemory, SubstantialBackendRedis, SubstantialOperationData, - SubstantialOperationType, - SubstantialOperationTypeSend, - SubstantialOperationTypeSendRaw, - SubstantialOperationTypeStart, - SubstantialOperationTypeStartRaw, - SubstantialOperationTypeStop, - SubstantialOperationTypeResources, - SubstantialOperationTypeResults, - SubstantialOperationTypeResultsRaw, - SubstantialOperationTypeInternalLinkParentChild, + SubstantialOperationDataInternalLinkParentChild, + SubstantialOperationDataResources, + SubstantialOperationDataResults, + SubstantialOperationDataResultsRaw, + SubstantialOperationDataSend, + SubstantialOperationDataSendRaw, + SubstantialOperationDataStart, + SubstantialOperationDataStartRaw, + SubstantialOperationDataStop, SubstantialRuntimeData, + SubstantialStartData, WorkflowFileDescription, WorkflowKind, ) @@ -29,17 +29,6 @@ from typegraph.wit import runtimes, store -class Backend: - def dev_memory(): - return SubstantialBackendMemory() - - def dev_fs(): - return SubstantialBackendFs() - - def redis(connection_string_secret: str): - return SubstantialBackendRedis(value=RedisBackend(connection_string_secret)) - - class SubstantialRuntime(Runtime): def __init__( self, @@ -47,62 +36,59 @@ def __init__( file_descriptions: List[WorkflowFileDescription], ): data = SubstantialRuntimeData(backend, file_descriptions) - super().__init__(runtimes.register_substantial_runtime(store, data)) + res = runtimes.register_substantial_runtime(store, data) + if isinstance(res, Err): + raise Exception(res.value) + super().__init__(res.value) self.backend = backend def _generic_substantial_func( self, - operation: SubstantialOperationType, - func_arg: Union[None, "t.typedef"] = None, - func_out: Union[None, "t.typedef"] = None, + data: SubstantialOperationData, ): - data = SubstantialOperationData( - func_arg=None if func_arg is None else func_arg._id, - func_out=None if func_out is None else func_out._id, - operation=operation, - ) - func_data = runtimes.generate_substantial_operation(store, self.id.value, data) + func_data = runtimes.generate_substantial_operation(store, self.id, data) if isinstance(func_data, Err): raise Exception(func_data.value) return t.func.from_type_func(func_data.value) - def start(self, kwargs: "t.struct"): - operation = SubstantialOperationTypeStart() - return self._generic_substantial_func(operation, kwargs, None) + def start(self, kwargs: "t.struct", *, secrets: Optional[List[str]] = None): + return self._generic_substantial_func( + SubstantialOperationDataStart( + SubstantialStartData(kwargs._id, secrets or []) + ) + ) - def start_raw(self): - operation = SubstantialOperationTypeStartRaw() - return self._generic_substantial_func(operation, None, None) + def start_raw(self, *, secrets: Optional[List[str]] = None): + return self._generic_substantial_func( + SubstantialOperationDataStartRaw(SubstantialStartData(None, secrets or [])) + ) def stop(self): - operation = SubstantialOperationTypeStop() - return self._generic_substantial_func(operation, None, None) + return self._generic_substantial_func(SubstantialOperationDataStop()) def send(self, payload: "t.typedef"): - operation = SubstantialOperationTypeSend() - return self._generic_substantial_func(operation, payload, None) + return self._generic_substantial_func(SubstantialOperationDataSend(payload._id)) def send_raw(self): - operation = SubstantialOperationTypeSendRaw() - return self._generic_substantial_func(operation, None, None) + return self._generic_substantial_func(SubstantialOperationDataSendRaw()) def query_resources(self): - operation = SubstantialOperationTypeResources() - return self._generic_substantial_func(operation, None, None) + return self._generic_substantial_func(SubstantialOperationDataResources()) def query_results(self, output: "t.typedef"): - operation = SubstantialOperationTypeResults() - return self._generic_substantial_func(operation, None, output) + return self._generic_substantial_func( + SubstantialOperationDataResults(output._id) + ) def query_results_raw(self): - operation = SubstantialOperationTypeResultsRaw() - return self._generic_substantial_func(operation, None, None) + return self._generic_substantial_func(SubstantialOperationDataResultsRaw()) def _internal_link_parent_child(self): - operation = SubstantialOperationTypeInternalLinkParentChild() - return self._generic_substantial_func(operation, None, None) + return self._generic_substantial_func( + SubstantialOperationDataInternalLinkParentChild() + ) def internals(self): return { @@ -114,6 +100,20 @@ def internals(self): } +class Backend: + @staticmethod + def dev_memory(): + return SubstantialBackendMemory() + + @staticmethod + def dev_fs(): + return SubstantialBackendFs() + + @staticmethod + def redis(connection_string_secret: str): + return SubstantialBackendRedis(value=RedisBackend(connection_string_secret)) + + class WorkflowFile: def __init__(self, file: str, kind: WorkflowKind, deps: List[str] = []): self.file = file diff --git a/src/xtask/Cargo.toml b/src/xtask/Cargo.toml index da75373dd1..a93a17451c 100644 --- a/src/xtask/Cargo.toml +++ b/src/xtask/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xtask" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" edition = "2021" # this allows us to exclude the rust files diff --git a/tests/metagen/__snapshots__/metagen_test.ts.snap b/tests/metagen/__snapshots__/metagen_test.ts.snap index 63a65f5e2b..87775e9dbe 100644 --- a/tests/metagen/__snapshots__/metagen_test.ts.snap +++ b/tests/metagen/__snapshots__/metagen_test.ts.snap @@ -448,7 +448,7 @@ impl Router { } pub fn init(&self, args: InitArgs) -> Result { - static MT_VERSION: &str = "0.5.0-rc.4"; + static MT_VERSION: &str = "0.5.0-rc.5"; if args.metatype_version != MT_VERSION { return Err(InitError::VersionMismatch(MT_VERSION.into())); } @@ -1254,7 +1254,7 @@ impl Router { } pub fn init(&self, args: InitArgs) -> Result { - static MT_VERSION: &str = "0.5.0-rc.4"; + static MT_VERSION: &str = "0.5.0-rc.5"; if args.metatype_version != MT_VERSION { return Err(InitError::VersionMismatch(MT_VERSION.into())); } diff --git a/tests/metagen/typegraphs/sample/py/client.py b/tests/metagen/typegraphs/sample/py/client.py index 10a2eb34dc..935d695e9a 100644 --- a/tests/metagen/typegraphs/sample/py/client.py +++ b/tests/metagen/typegraphs/sample/py/client.py @@ -608,7 +608,7 @@ class NodeDescs: @staticmethod def scalar(): return NodeMeta() - + @staticmethod def Post(): return NodeMeta( @@ -736,29 +736,42 @@ def RootMixedUnionFn(): }, ) + UserIdStringUuid = str PostSlugString = str -Post = typing.TypedDict("Post", { - "id": UserIdStringUuid, - "slug": PostSlugString, - "title": PostSlugString, -}, total=False) - -RootCompositeArgsFnInput = typing.TypedDict("RootCompositeArgsFnInput", { - "id": PostSlugString, -}, total=False) +Post = typing.TypedDict( + "Post", + { + "id": UserIdStringUuid, + "slug": PostSlugString, + "title": PostSlugString, + }, + total=False, +) + +RootCompositeArgsFnInput = typing.TypedDict( + "RootCompositeArgsFnInput", + { + "id": PostSlugString, + }, + total=False, +) UserEmailStringEmail = str UserPostsPostList = typing.List[Post] -User = typing.TypedDict("User", { - "id": UserIdStringUuid, - "email": UserEmailStringEmail, - "posts": UserPostsPostList, -}, total=False) +User = typing.TypedDict( + "User", + { + "id": UserIdStringUuid, + "email": UserEmailStringEmail, + "posts": UserPostsPostList, + }, + total=False, +) RootScalarUnionFnOutputT1Integer = int @@ -782,111 +795,140 @@ def RootMixedUnionFn(): ] - -PostSelections = typing.TypedDict("PostSelections", { - "_": SelectionFlags, - "id": ScalarSelectNoArgs, - "slug": ScalarSelectNoArgs, - "title": ScalarSelectNoArgs, -}, total=False) - -UserSelections = typing.TypedDict("UserSelections", { - "_": SelectionFlags, - "id": ScalarSelectNoArgs, - "email": ScalarSelectNoArgs, - "posts": CompositeSelectNoArgs["PostSelections"], -}, total=False) - -RootCompositeUnionFnOutputSelections = typing.TypedDict("RootCompositeUnionFnOutputSelections", { - "_": SelectionFlags, - "post": CompositeSelectNoArgs["PostSelections"], - "user": CompositeSelectNoArgs["UserSelections"], -}, total=False) - -RootMixedUnionFnOutputSelections = typing.TypedDict("RootMixedUnionFnOutputSelections", { - "_": SelectionFlags, - "post": CompositeSelectNoArgs["PostSelections"], - "user": CompositeSelectNoArgs["UserSelections"], -}, total=False) +PostSelections = typing.TypedDict( + "PostSelections", + { + "_": SelectionFlags, + "id": ScalarSelectNoArgs, + "slug": ScalarSelectNoArgs, + "title": ScalarSelectNoArgs, + }, + total=False, +) + +UserSelections = typing.TypedDict( + "UserSelections", + { + "_": SelectionFlags, + "id": ScalarSelectNoArgs, + "email": ScalarSelectNoArgs, + "posts": CompositeSelectNoArgs["PostSelections"], + }, + total=False, +) + +RootCompositeUnionFnOutputSelections = typing.TypedDict( + "RootCompositeUnionFnOutputSelections", + { + "_": SelectionFlags, + "post": CompositeSelectNoArgs["PostSelections"], + "user": CompositeSelectNoArgs["UserSelections"], + }, + total=False, +) + +RootMixedUnionFnOutputSelections = typing.TypedDict( + "RootMixedUnionFnOutputSelections", + { + "_": SelectionFlags, + "post": CompositeSelectNoArgs["PostSelections"], + "user": CompositeSelectNoArgs["UserSelections"], + }, + total=False, +) class QueryGraph(QueryGraphBase): def __init__(self): - super().__init__({ - "UserIdStringUuid": "String!", - "PostSlugString": "String!", - "post": "post!", - "user": "user!", - }) - + super().__init__( + { + "UserIdStringUuid": "String!", + "PostSlugString": "String!", + "post": "post!", + "user": "user!", + } + ) + def get_user(self, select: UserSelections) -> QueryNode[User]: node = selection_to_nodes( - {"getUser": select}, - {"getUser": NodeDescs.RootGetUserFn}, - "$q" + {"getUser": select}, {"getUser": NodeDescs.RootGetUserFn}, "$q" )[0] return QueryNode(node.node_name, node.instance_name, node.args, node.sub_nodes) def get_posts(self, select: PostSelections) -> QueryNode[Post]: node = selection_to_nodes( - {"getPosts": select}, - {"getPosts": NodeDescs.RootGetPostsFn}, - "$q" + {"getPosts": select}, {"getPosts": NodeDescs.RootGetPostsFn}, "$q" )[0] return QueryNode(node.node_name, node.instance_name, node.args, node.sub_nodes) def scalar_no_args(self) -> QueryNode[PostSlugString]: node = selection_to_nodes( - {"scalarNoArgs": True}, - {"scalarNoArgs": NodeDescs.RootScalarNoArgsFn}, - "$q" + {"scalarNoArgs": True}, {"scalarNoArgs": NodeDescs.RootScalarNoArgsFn}, "$q" )[0] return QueryNode(node.node_name, node.instance_name, node.args, node.sub_nodes) - def scalar_args(self, args: typing.Union[Post, PlaceholderArgs]) -> MutationNode[PostSlugString]: + def scalar_args( + self, args: typing.Union[Post, PlaceholderArgs] + ) -> MutationNode[PostSlugString]: node = selection_to_nodes( - {"scalarArgs": args}, - {"scalarArgs": NodeDescs.RootScalarArgsFn}, - "$q" + {"scalarArgs": args}, {"scalarArgs": NodeDescs.RootScalarArgsFn}, "$q" )[0] - return MutationNode(node.node_name, node.instance_name, node.args, node.sub_nodes) + return MutationNode( + node.node_name, node.instance_name, node.args, node.sub_nodes + ) def composite_no_args(self, select: PostSelections) -> MutationNode[Post]: node = selection_to_nodes( - {"compositeNoArgs": select}, - {"compositeNoArgs": NodeDescs.RootCompositeNoArgsFn}, - "$q" + {"compositeNoArgs": select}, + {"compositeNoArgs": NodeDescs.RootCompositeNoArgsFn}, + "$q", )[0] - return MutationNode(node.node_name, node.instance_name, node.args, node.sub_nodes) + return MutationNode( + node.node_name, node.instance_name, node.args, node.sub_nodes + ) - def composite_args(self, args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs], select: PostSelections) -> MutationNode[Post]: + def composite_args( + self, + args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs], + select: PostSelections, + ) -> MutationNode[Post]: node = selection_to_nodes( - {"compositeArgs": (args, select)}, - {"compositeArgs": NodeDescs.RootCompositeArgsFn}, - "$q" + {"compositeArgs": (args, select)}, + {"compositeArgs": NodeDescs.RootCompositeArgsFn}, + "$q", )[0] - return MutationNode(node.node_name, node.instance_name, node.args, node.sub_nodes) + return MutationNode( + node.node_name, node.instance_name, node.args, node.sub_nodes + ) - def scalar_union(self, args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs]) -> QueryNode[RootScalarUnionFnOutput]: + def scalar_union( + self, args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs] + ) -> QueryNode[RootScalarUnionFnOutput]: node = selection_to_nodes( - {"scalarUnion": args}, - {"scalarUnion": NodeDescs.RootScalarUnionFn}, - "$q" + {"scalarUnion": args}, {"scalarUnion": NodeDescs.RootScalarUnionFn}, "$q" )[0] return QueryNode(node.node_name, node.instance_name, node.args, node.sub_nodes) - def composite_union(self, args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs], select: RootCompositeUnionFnOutputSelections) -> QueryNode[RootCompositeUnionFnOutput]: + def composite_union( + self, + args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs], + select: RootCompositeUnionFnOutputSelections, + ) -> QueryNode[RootCompositeUnionFnOutput]: node = selection_to_nodes( - {"compositeUnion": (args, select)}, - {"compositeUnion": NodeDescs.RootCompositeUnionFn}, - "$q" + {"compositeUnion": (args, select)}, + {"compositeUnion": NodeDescs.RootCompositeUnionFn}, + "$q", )[0] return QueryNode(node.node_name, node.instance_name, node.args, node.sub_nodes) - def mixed_union(self, args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs], select: RootMixedUnionFnOutputSelections) -> QueryNode[RootMixedUnionFnOutput]: + def mixed_union( + self, + args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs], + select: RootMixedUnionFnOutputSelections, + ) -> QueryNode[RootMixedUnionFnOutput]: node = selection_to_nodes( - {"mixedUnion": (args, select)}, - {"mixedUnion": NodeDescs.RootMixedUnionFn}, - "$q" + {"mixedUnion": (args, select)}, + {"mixedUnion": NodeDescs.RootMixedUnionFn}, + "$q", )[0] return QueryNode(node.node_name, node.instance_name, node.args, node.sub_nodes) diff --git a/tests/runtimes/substantial/common.ts b/tests/runtimes/substantial/common.ts index 3cc42b1f5d..5aca8d3dda 100644 --- a/tests/runtimes/substantial/common.ts +++ b/tests/runtimes/substantial/common.ts @@ -47,7 +47,10 @@ export function basicTestTemplate( cleanup && t.addCleanup(cleanup); const e = await t.engine("runtimes/substantial/substantial.py", { - secrets, + secrets: { + MY_SECRET: "Hello", + ...secrets, + }, }); let currentRunId: string | null = null; @@ -173,7 +176,10 @@ export function concurrentWorkflowTestTemplate( cleanup && t.addCleanup(cleanup); const e = await t.engine("runtimes/substantial/substantial.py", { - secrets, + secrets: { + MY_SECRET: "Hello", + ...secrets, + }, }); const emails = [ @@ -349,7 +355,10 @@ export function retrySaveTestTemplate( cleanup && t.addCleanup(cleanup); const e = await t.engine("runtimes/substantial/substantial.py", { - secrets, + secrets: { + MY_SECRET: "Hello", + ...secrets, + }, }); let resolvedId: string, diff --git a/tests/runtimes/substantial/imports/common_types.ts b/tests/runtimes/substantial/imports/common_types.ts index 3e40785083..b3c0130651 100644 --- a/tests/runtimes/substantial/imports/common_types.ts +++ b/tests/runtimes/substantial/imports/common_types.ts @@ -1,7 +1,7 @@ // TODO: include this as part of the metagen generated code -// TODO: -export type Workflow = (ctx: Context) => Promise; +// TODO: merge these +export type Workflow = (ctx: Context, ctx2: TaskCtx) => Promise; export interface SerializableWorkflowHandle { runId?: string; @@ -45,6 +45,21 @@ export interface Context { ): ChildWorkflowHandle; } +export type TaskCtx = { + parent?: Record; + /** + * Request context extracted by auth extractors. + */ + context?: Record; + secrets: Record; + effect: "create" | "update" | "delete" | "read" | undefined | null; + meta: { + url: string; + token: string; + }; + headers: Record; +}; + export interface SaveOption { timeoutMs?: number; retry?: { diff --git a/tests/runtimes/substantial/substantial.py b/tests/runtimes/substantial/substantial.py index f079980563..55c2b82a9c 100644 --- a/tests/runtimes/substantial/substantial.py +++ b/tests/runtimes/substantial/substantial.py @@ -19,7 +19,14 @@ def substantial(g: Graph): file = ( WorkflowFile.deno(file="workflow.ts", deps=["imports/common_types.ts"]) - .import_(["saveAndSleepExample", "eventsAndExceptionExample", "retryExample"]) + .import_( + [ + "saveAndSleepExample", + "eventsAndExceptionExample", + "retryExample", + "secretsExample", + ] + ) .build() ) @@ -55,5 +62,9 @@ def substantial(g: Graph): start_retry=sub.start( t.struct({"fail": t.boolean(), "timeout": t.boolean()}) ).reduce({"name": "retryExample"}), + # secret + start_secret=sub.start(t.struct({}), secrets=["MY_SECRET"]).reduce( + {"name": "secretsExample"} + ), **sub.internals(), ) diff --git a/tests/runtimes/substantial/substantial_test.ts b/tests/runtimes/substantial/substantial_test.ts new file mode 100644 index 0000000000..f071401015 --- /dev/null +++ b/tests/runtimes/substantial/substantial_test.ts @@ -0,0 +1,6 @@ +import { basicTestTemplate } from "./common.ts"; + +basicTestTemplate("memory", { + secrets: { MY_SECRET: "Hello" }, + delays: { awaitSleepCompleteSec: 10 }, +}); diff --git a/tests/runtimes/substantial/workflow.ts b/tests/runtimes/substantial/workflow.ts index b4df2cb5f4..59d7a70737 100644 --- a/tests/runtimes/substantial/workflow.ts +++ b/tests/runtimes/substantial/workflow.ts @@ -3,9 +3,12 @@ import { queryThatTakesAWhile, sendSubscriptionEmail, sleep, + Workflow, } from "./imports/common_types.ts"; -export async function eventsAndExceptionExample(ctx: Context) { +export const eventsAndExceptionExample: Workflow = async ( + ctx: Context, +) => { const { to } = ctx.kwargs; const messageDialog = await ctx.save(() => sendSubscriptionEmail(to)); @@ -17,7 +20,7 @@ export async function eventsAndExceptionExample(ctx: Context) { } return `${messageDialog}: confirmed!`; -} +}; export async function saveAndSleepExample(ctx: Context) { const { a, b } = ctx.kwargs; @@ -28,18 +31,18 @@ export async function saveAndSleepExample(ctx: Context) { const sum = await ctx.save(async () => { const remoteAdd = new Date().getTime(); - const { data } = await ctx.gql/**/ `query { remote_add(a: $a, b: $b) }`.run( + const { data } = await ctx.gql /**/`query { remote_add(a: $a, b: $b) }`.run( { a: newA, b: newB, - } + }, ); const remoteAddEnd = new Date().getTime(); console.log( "Remote add:", (remoteAddEnd - remoteAdd) / 1000, ", Response:", - data + data, ); return (data as any)?.remote_add as number; @@ -67,7 +70,7 @@ export async function retryExample(ctx: Context) { maxBackoffMs: 5000, maxRetries: 4, }, - } + }, ); const timeoutRet = await ctx.save( @@ -86,8 +89,19 @@ export async function retryExample(ctx: Context) { maxBackoffMs: 3000, maxRetries: 5, }, - } + }, ); return [timeoutRet, retryRet].join(", "); } + +export const secretsExample: Workflow = (_, { secrets }) => { + const { MY_SECRET, ...rest } = secrets; + if (!MY_SECRET) { + throw new Error("unable to read secret"); + } + if (Object.keys(rest).length > 0) { + throw new Error("unexpected secrets found: ", rest); + } + return Promise.resolve(); +}; diff --git a/tests/runtimes/wasm_reflected/rust/Cargo.toml b/tests/runtimes/wasm_reflected/rust/Cargo.toml index 1a09a8c835..ea6f24c97d 100644 --- a/tests/runtimes/wasm_reflected/rust/Cargo.toml +++ b/tests/runtimes/wasm_reflected/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rust" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" edition = "2021" [lib] diff --git a/tools/Dockerfile b/tools/Dockerfile index 42f0e227b4..468d2e6fbb 100644 --- a/tools/Dockerfile +++ b/tools/Dockerfile @@ -53,7 +53,7 @@ RUN set -eux; \ apt clean autoclean; apt autoremove --yes; rm -rf /var/lib/{apt,dpkg,cache,log}/; ARG GHJK_VERSION=v0.2.1 -RUN GHJK_INSTALL_EXE_DIR=/usr/bin GHJK_INSTALL_HOOK_SHELLS=bash \ +RUN GHJK_INSTALL_EXE_DIR=/usr/bin \ deno run -A https://raw.github.com/metatypedev/ghjk/$GHJK_VERSION/install.ts COPY tools/ tools/ @@ -62,33 +62,31 @@ ENV GHJK_ENV=oci ENV GHJK_ACTIVATE=.ghjk/envs/$GHJK_ENV/activate.sh RUN ghjk envs cook +SHELL ["/bin/sh", "-c", ". .ghjk/envs/oci/activate.sh && sh -c \"$*\"", "sh"] + COPY --from=plan /app/recipe.json recipe.json ARG CARGO_PROFILE=release -RUN . "$GHJK_ACTIVATE" \ - && cargo chef cook --recipe-path recipe.json --profile $CARGO_PROFILE --package typegate \ +RUN cargo chef cook --recipe-path recipe.json --profile $CARGO_PROFILE --package typegate \ && rm recipe.json COPY . . -RUN . "$GHJK_ACTIVATE" \ - && cargo build --profile $CARGO_PROFILE --package typegate --locked \ +RUN cargo build --profile $CARGO_PROFILE --package typegate --locked \ && ( \ [ $CARGO_PROFILE = 'release' ] \ && cp target/release/typegate typegate-bin \ || cp target/debug/typegate typegate-bin \ ) -RUN . "$GHJK_ACTIVATE" \ - && deno run -A tools/update.ts --cache-only --src-only \ +RUN deno run -A tools/update.ts --cache-only --src-only \ && mkdir -p .metatype # FROM builder AS dev -RUN . "$GHJK_ACTIVATE" \ - && mv target /tmp/target \ +RUN mv target /tmp/target \ && rm -rf * \ && mv /tmp/target . @@ -100,8 +98,7 @@ ARG TARGETARCH ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini -RUN . "$GHJK_ACTIVATE" \ - && chmod +x /tini \ +RUN chmod +x /tini \ && mkdir -p /lib/sym \ && ln -s /lib/aarch64-linux-gnu /lib/sym/arm64 \ && ln -s /lib/x86_64-linux-gnu /lib/sym/amd64 diff --git a/tools/Dockerfile.dockerignore b/tools/Dockerfile.dockerignore index d7a2ead680..009d0d863c 100644 --- a/tools/Dockerfile.dockerignore +++ b/tools/Dockerfile.dockerignore @@ -8,8 +8,10 @@ !src/meta-cli/Cargo.toml !src/metagen/Cargo.toml !src/metagen/src/fdk_rust/static/Cargo.toml +!src/metagen/src/client_rs/static/Cargo.toml !src/mt_deno !src/pyrt_wit_wire +!src/substantial/ !src/typegate/ !src/typegraph/core/ !src/wit/ diff --git a/tools/consts.ts b/tools/consts.ts index 7b011efcee..4c11549171 100644 --- a/tools/consts.ts +++ b/tools/consts.ts @@ -1,8 +1,8 @@ // Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. // SPDX-License-Identifier: MPL-2.0 -export const METATYPE_VERSION = "0.5.0-rc.4"; -export const PUBLISHED_VERSION = "0.5.0-rc.3"; +export const METATYPE_VERSION = "0.5.0-rc.5"; +export const PUBLISHED_VERSION = "0.5.0-rc.4"; export const GHJK_VERSION = "v0.2.1"; export const GHJK_ACTION_VERSION = "318209a9d215f70716a4ac89dbeb9653a2deb8bc"; export const RUST_VERSION = "1.80.1";