diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index a8ff9b25a0..cb9d567e83 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -18,7 +18,7 @@ Having a good title and description is important for the users to get readable c #### Migration notes -... +--- - [ ] The change comes with new or modified tests - [ ] Hard-to-understand functions have explanatory comments diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 69eda3d166..711d3433fe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -337,6 +337,9 @@ jobs: - build-docker - pub-docker runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write steps: - uses: actions/checkout@v4 with: @@ -357,3 +360,8 @@ jobs: title: "chore(release): prepare for ${{ steps.bump.outputs.version }}" body: "Automatic suggested bump" base: main + # since PRs created from workflows won't have actions run + # on them, we create it as a draft PR + # the actions will then run when it's readied for review + # https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs + draft: always-true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3538414d9d..68f5564379 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -82,7 +82,17 @@ repos: - id: check-merge-conflict - id: end-of-file-fixer # exclude all generated files - exclude: (?x)( .ghjk/.* |.*deno.lock |.*\.snap$|typegate/src/typegraphs/.*\.json |website/docs/reference/ |libs/pyrt_wit_wire/pyrt | migration_lock.toml | tests/metagen/typegraphs/sample/[rs|ts|py]/client\.[rs|ts|py]) + exclude: (?x)( + .ghjk/.*| + .*deno.lock| + CHANGELOG.md| + .*\.snap$| + typegate/src/typegraphs/.*\.json| + website/docs/reference/| + libs/pyrt_wit_wire/pyrt| + migration_lock.toml| + tests/metagen/typegraphs/sample/[rs|ts|py]/client\.[rs|ts|py] + ) - repo: https://github.com/Lucas-C/pre-commit-hooks rev: v1.5.5 hooks: diff --git a/Cargo.lock b/Cargo.lock index 0385cb603c..0101ae43fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1605,7 +1605,7 @@ dependencies = [ [[package]] name = "common" -version = "0.5.0-rc.2" +version = "0.5.0-rc.3" dependencies = [ "anyhow", "async-trait", @@ -6897,7 +6897,7 @@ dependencies = [ [[package]] name = "meta-cli" -version = "0.5.0-rc.2" +version = "0.5.0-rc.3" dependencies = [ "actix", "assert_cmd", @@ -6963,7 +6963,7 @@ dependencies = [ [[package]] name = "metagen" -version = "0.5.0-rc.2" +version = "0.5.0-rc.3" dependencies = [ "color-eyre", "common", @@ -7322,7 +7322,7 @@ dependencies = [ [[package]] name = "mt_deno" -version = "0.5.0-rc.2" +version = "0.5.0-rc.3" dependencies = [ "anyhow", "deno", @@ -11286,7 +11286,7 @@ dependencies = [ [[package]] name = "substantial" -version = "0.5.0-rc.2" +version = "0.5.0-rc.3" dependencies = [ "anyhow", "chrono", @@ -12774,7 +12774,7 @@ dependencies = [ [[package]] name = "typegate" -version = "0.5.0-rc.2" +version = "0.5.0-rc.3" dependencies = [ "colored", "env_logger 0.11.0", @@ -12787,7 +12787,7 @@ dependencies = [ [[package]] name = "typegate_engine" -version = "0.5.0-rc.2" +version = "0.5.0-rc.3" dependencies = [ "anyhow", "base64 0.22.1", @@ -12832,7 +12832,7 @@ dependencies = [ [[package]] name = "typegraph_core" -version = "0.5.0-rc.2" +version = "0.5.0-rc.3" dependencies = [ "anyhow", "color-eyre", @@ -14598,7 +14598,7 @@ checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193" [[package]] name = "xtask" -version = "0.5.0-rc.2" +version = "0.5.0-rc.3" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index d921b54a2f..4f70d18aeb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ exclude = [ ] [workspace.package] -version = "0.5.0-rc.2" +version = "0.5.0-rc.3" edition = "2021" [workspace.dependencies] diff --git a/deno.lock b/deno.lock index 4124d6e754..9a679f2d84 100644 --- a/deno.lock +++ b/deno.lock @@ -9,6 +9,7 @@ "jsr:@std/assert@^1.0.2": "jsr:@std/assert@1.0.4", "jsr:@std/assert@^1.0.4": "jsr:@std/assert@1.0.6", "jsr:@std/assert@^1.0.6": "jsr:@std/assert@1.0.6", + "jsr:@std/async@^1.0.3": "jsr:@std/async@1.0.3", "jsr:@std/bytes@^0.221.0": "jsr:@std/bytes@0.221.0", "jsr:@std/bytes@^1.0.2": "jsr:@std/bytes@1.0.2", "jsr:@std/bytes@^1.0.2-rc.3": "jsr:@std/bytes@1.0.2", @@ -46,6 +47,7 @@ "jsr:@std/semver@^1.0.1": "jsr:@std/semver@1.0.2", "jsr:@std/streams@0.221.0": "jsr:@std/streams@0.221.0", "jsr:@std/streams@1": "jsr:@std/streams@1.0.4", + "jsr:@std/streams@^1.0.2": "jsr:@std/streams@1.0.4", "jsr:@std/testing@^1.0.1": "jsr:@std/testing@1.0.2", "jsr:@std/url@^0.225.0": "jsr:@std/url@0.225.0", "jsr:@std/uuid@^1.0.1": "jsr:@std/uuid@1.0.2", @@ -59,6 +61,7 @@ "npm:lodash@4.17.21": "npm:lodash@4.17.21", "npm:mathjs@11.11.1": "npm:mathjs@11.11.1", "npm:multiformats@13.1.0": "npm:multiformats@13.1.0", + "npm:pg@8.12.0": "npm:pg@8.12.0", "npm:validator@13.12.0": "npm:validator@13.12.0", "npm:zod-validation-error@3.3.0": "npm:zod-validation-error@3.3.0_zod@3.23.8", "npm:zod@3.23.8": "npm:zod@3.23.8" @@ -111,6 +114,9 @@ "jsr:@std/internal@^1.0.4" ] }, + "@std/async@1.0.3": { + "integrity": "6ed64678db43451683c6c176a21426a2ccd21ba0269ebb2c36133ede3f165792" + }, "@std/bytes@0.221.0": { "integrity": "64a047011cf833890a4a2ab7293ac55a1b4f5a050624ebc6a0159c357de91966" }, @@ -438,6 +444,73 @@ "integrity": "sha512-HzdtdBwxsIkzpeXzhQ5mAhhuxcHbjEHH+JQoxt7hG/2HGFjjwyolLo7hbaexcnhoEuV4e0TNJ8kkpMjiEYY4VQ==", "dependencies": {} }, + "pg-cloudflare@1.1.1": { + "integrity": "sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q==", + "dependencies": {} + }, + "pg-connection-string@2.6.4": { + "integrity": "sha512-v+Z7W/0EO707aNMaAEfiGnGL9sxxumwLl2fJvCQtMn9Fxsg+lPpPkdcyBSv/KFgpGdYkMfn+EI1Or2EHjpgLCA==", + "dependencies": {} + }, + "pg-int8@1.0.1": { + "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", + "dependencies": {} + }, + "pg-pool@3.6.2_pg@8.12.0": { + "integrity": "sha512-Htjbg8BlwXqSBQ9V8Vjtc+vzf/6fVUuak/3/XXKA9oxZprwW3IMDQTGHP+KDmVL7rtd+R1QjbnCFPuTHm3G4hg==", + "dependencies": { + "pg": "pg@8.12.0" + } + }, + "pg-protocol@1.6.1": { + "integrity": "sha512-jPIlvgoD63hrEuihvIg+tJhoGjUsLPn6poJY9N5CnlPd91c2T18T/9zBtLxZSb1EhYxBRoZJtzScCaWlYLtktg==", + "dependencies": {} + }, + "pg-types@2.2.0": { + "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", + "dependencies": { + "pg-int8": "pg-int8@1.0.1", + "postgres-array": "postgres-array@2.0.0", + "postgres-bytea": "postgres-bytea@1.0.0", + "postgres-date": "postgres-date@1.0.7", + "postgres-interval": "postgres-interval@1.2.0" + } + }, + "pg@8.12.0": { + "integrity": "sha512-A+LHUSnwnxrnL/tZ+OLfqR1SxLN3c/pgDztZ47Rpbsd4jUytsTtwQo/TLPRzPJMp/1pbhYVhH9cuSZLAajNfjQ==", + "dependencies": { + "pg-cloudflare": "pg-cloudflare@1.1.1", + "pg-connection-string": "pg-connection-string@2.6.4", + "pg-pool": "pg-pool@3.6.2_pg@8.12.0", + "pg-protocol": "pg-protocol@1.6.1", + "pg-types": "pg-types@2.2.0", + "pgpass": "pgpass@1.0.5" + } + }, + "pgpass@1.0.5": { + "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==", + "dependencies": { + "split2": "split2@4.2.0" + } + }, + "postgres-array@2.0.0": { + "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", + "dependencies": {} + }, + "postgres-bytea@1.0.0": { + "integrity": "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==", + "dependencies": {} + }, + "postgres-date@1.0.7": { + "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", + "dependencies": {} + }, + "postgres-interval@1.2.0": { + "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", + "dependencies": { + "xtend": "xtend@4.0.2" + } + }, "regenerator-runtime@0.14.1": { "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", "dependencies": {} @@ -446,6 +519,10 @@ "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==", "dependencies": {} }, + "split2@4.2.0": { + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "dependencies": {} + }, "tiny-emitter@2.1.0": { "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==", "dependencies": {} @@ -462,6 +539,10 @@ "integrity": "sha512-c1Q0mCiPlgdTVVVIJIrBuxNicYE+t/7oKeI9MWLj3fh/uq2Pxh/3eeWbVZ4OcGW1TUf53At0njHw5SMdA3tmMg==", "dependencies": {} }, + "xtend@4.0.2": { + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dependencies": {} + }, "zod-validation-error@3.3.0_zod@3.23.8": { "integrity": "sha512-Syib9oumw1NTqEv4LT0e6U83Td9aVRk9iTXPUQr1otyV1PuXQKOvOwhMNqZIq5hluzHP2pMgnOmHEo7kPdI2mw==", "dependencies": { diff --git a/docs/metatype.dev/blog/2024-08-27-distributed-execution-flow-paradigms/index.mdx b/docs/metatype.dev/blog/2024-08-27-distributed-execution-flow-paradigms/index.mdx index c023251111..1546215f5c 100644 --- a/docs/metatype.dev/blog/2024-08-27-distributed-execution-flow-paradigms/index.mdx +++ b/docs/metatype.dev/blog/2024-08-27-distributed-execution-flow-paradigms/index.mdx @@ -366,7 +366,6 @@ typegate: secrets: example: POSTGRES: "postgresql://postgres:password@postgres:5432/db" - MONGO: "mongodb://root:password@mongo:27017/db" HOST: "http://localhost:7233" NAMESPACE: "default" ``` diff --git a/docs/metatype.dev/docs/tutorials/metatype-basics/index.mdx b/docs/metatype.dev/docs/tutorials/metatype-basics/index.mdx index b4649e99f3..97297a73dc 100644 --- a/docs/metatype.dev/docs/tutorials/metatype-basics/index.mdx +++ b/docs/metatype.dev/docs/tutorials/metatype-basics/index.mdx @@ -123,7 +123,8 @@ docker compose version ...and if not, the official installation guide can be found [here](https://docs.docker.com/compose/install/). -If you have your docker runtime installed and running correctly, you will be able to launch the `compose.yml` file that's bundled in every template. The compose file by default includes the `postgres` and `mongo` databases. You can disable the latter by commenting it out or removing it as we'll not be needing it for this tutorial. +If you have your docker runtime installed and running correctly, you will be able to launch the `compose.yml` file that's bundled in every template. +The compose file also includes the `postgres` databases that we'll be using. To launch the services, navigate your shell to the project directory and run the following command: diff --git a/docs/metatype.dev/src/pages/index.tsx b/docs/metatype.dev/src/pages/index.tsx index 85b78f8bdd..b17d926a3c 100644 --- a/docs/metatype.dev/src/pages/index.tsx +++ b/docs/metatype.dev/src/pages/index.tsx @@ -301,10 +301,10 @@ function TryIt(): JSX.Element { } const runtimeList = [ - { + /* { name: "MongoDB", logo: "/images/runtimes/mongodb.svg", - }, + }, */ { name: "GraphQL", logo: "/images/runtimes/graphql.svg", @@ -333,10 +333,10 @@ const runtimeList = [ name: "Google APIs Explorer", logo: "/images/runtimes/google-apis-explorer.svg", }, - { + /* { name: "MariaDB", logo: "/images/runtimes/mariadb.svg", - }, + }, */ { name: "Python", logo: "/images/runtimes/python.svg", diff --git a/examples/templates/deno/api/example.ts b/examples/templates/deno/api/example.ts index 42fe0f6ae9..0668d7c991 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.2/index.ts"; -import { PythonRuntime } from "jsr:@typegraph/sdk@0.5.0-rc.2/runtimes/python.ts"; -import { DenoRuntime } from "jsr:@typegraph/sdk@0.5.0-rc.2/runtimes/deno.ts"; +import { Policy, t, typegraph } from "jsr:@typegraph/sdk@0.5.0-rc.3/index.ts"; +import { PythonRuntime } from "jsr:@typegraph/sdk@0.5.0-rc.3/runtimes/python.ts"; +import { DenoRuntime } from "jsr:@typegraph/sdk@0.5.0-rc.3/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 b19ee177dc..26bdac6ca7 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.2 + image: ghcr.io/metatypedev/typegate:v0.5.0-rc.3 restart: always ports: - "7890:7890" @@ -35,20 +35,5 @@ services: volumes: - pgdata:/var/lib/postgresql/data - # for prisma runtime with mongo - # mongodb://root:password@mongo:27017/db - # see metatype.yml - mongo: - image: mongo:7 - restart: always - environment: - MONGO_INITDB_ROOT_USERNAME: root - MONGO_INITDB_ROOT_PASSWORD: password - ports: - - "27017:27017" - volumes: - - mongodata:/data/db - volumes: pgdata: - mongodata: diff --git a/examples/templates/deno/metatype.yaml b/examples/templates/deno/metatype.yaml index 03084f4f71..f42f7911d4 100644 --- a/examples/templates/deno/metatype.yaml +++ b/examples/templates/deno/metatype.yaml @@ -6,7 +6,6 @@ typegates: secrets: example: POSTGRES: "postgresql://postgres:password@postgres:5432/db" - MONGO: "mongodb://root:password@mongo:27017/db" deploy: url: "https://cloud.metatype.dev" username: admin @@ -14,4 +13,3 @@ typegates: secrets: example: POSTGRES: "postgresql://postgres:password@localhost:5432/db" - MONGO: "mongodb://root:password@mongo:27017/db" diff --git a/examples/templates/node/compose.yml b/examples/templates/node/compose.yml index 99bdf6f3a3..0509dfbdbf 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.2 + image: ghcr.io/metatypedev/typegate:v0.5.0-rc.3 restart: always ports: - "7890:7890" @@ -34,20 +34,5 @@ services: volumes: - pgdata:/var/lib/postgresql/data - # for prisma runtime with mongo - # mongodb://root:password@mongo:27017/db - # see metatype.yml - mongo: - image: mongo:7 - restart: always - environment: - MONGO_INITDB_ROOT_USERNAME: root - MONGO_INITDB_ROOT_PASSWORD: password - ports: - - "27017:27017" - volumes: - - mongodata:/data/db - volumes: pgdata: - mongodata: diff --git a/examples/templates/node/metatype.yaml b/examples/templates/node/metatype.yaml index b66298cc78..f42f7911d4 100644 --- a/examples/templates/node/metatype.yaml +++ b/examples/templates/node/metatype.yaml @@ -3,10 +3,9 @@ typegates: url: "http://localhost:7890" username: admin password: password - secrets": + secrets: example: POSTGRES: "postgresql://postgres:password@postgres:5432/db" - MONGO: "mongodb://root:password@mongo:27017/db" deploy: url: "https://cloud.metatype.dev" username: admin @@ -14,4 +13,3 @@ typegates: secrets: example: POSTGRES: "postgresql://postgres:password@localhost:5432/db" - MONGO: "mongodb://root:password@mongo:27017/db" diff --git a/examples/templates/node/package.json b/examples/templates/node/package.json index dce90bee8d..98c0c0e60c 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.2" + "@typegraph/sdk": "^0.5.0-rc.3" }, "devDependencies": { "tsx": "^3.13.0", diff --git a/examples/templates/python/compose.yml b/examples/templates/python/compose.yml index 99bdf6f3a3..0509dfbdbf 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.2 + image: ghcr.io/metatypedev/typegate:v0.5.0-rc.3 restart: always ports: - "7890:7890" @@ -34,20 +34,5 @@ services: volumes: - pgdata:/var/lib/postgresql/data - # for prisma runtime with mongo - # mongodb://root:password@mongo:27017/db - # see metatype.yml - mongo: - image: mongo:7 - restart: always - environment: - MONGO_INITDB_ROOT_USERNAME: root - MONGO_INITDB_ROOT_PASSWORD: password - ports: - - "27017:27017" - volumes: - - mongodata:/data/db - volumes: pgdata: - mongodata: diff --git a/examples/templates/python/metatype.yaml b/examples/templates/python/metatype.yaml index 03084f4f71..f42f7911d4 100644 --- a/examples/templates/python/metatype.yaml +++ b/examples/templates/python/metatype.yaml @@ -6,7 +6,6 @@ typegates: secrets: example: POSTGRES: "postgresql://postgres:password@postgres:5432/db" - MONGO: "mongodb://root:password@mongo:27017/db" deploy: url: "https://cloud.metatype.dev" username: admin @@ -14,4 +13,3 @@ typegates: secrets: example: POSTGRES: "postgresql://postgres:password@localhost:5432/db" - MONGO: "mongodb://root:password@mongo:27017/db" diff --git a/examples/templates/python/pyproject.toml b/examples/templates/python/pyproject.toml index 8e4ca3ab64..1775d71bfa 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.2" +version = "0.5.0-rc.3" description = "" authors = [] [tool.poetry.dependencies] python = ">=3.8,<4.0" -typegraph = "0.5.0-rc.2" +typegraph = "0.5.0-rc.3" [build-system] requires = ["poetry-core"] diff --git a/examples/typegraphs/metagen/rs/fdk.rs b/examples/typegraphs/metagen/rs/fdk.rs index ea3c02629f..06e8b0b0a3 100644 --- a/examples/typegraphs/metagen/rs/fdk.rs +++ b/examples/typegraphs/metagen/rs/fdk.rs @@ -109,7 +109,7 @@ impl Router { } pub fn init(&self, args: InitArgs) -> Result { - static MT_VERSION: &str = "0.5.0-rc.1"; + static MT_VERSION: &str = "0.5.0-rc.3"; if args.metatype_version != MT_VERSION { return Err(InitError::VersionMismatch(MT_VERSION.into())); } diff --git a/pyproject.toml b/pyproject.toml index 5dac4dd3bc..9f4eeb3b4c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ [tool.poetry] name = "metatype" -version = "0.5.0-rc.2" +version = "0.5.0-rc.3" description = "" authors = [] diff --git a/src/meta-lsp/package.json b/src/meta-lsp/package.json index d834ed70ec..b9e8a999af 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.2", + "version": "0.5.0-rc.3", "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 6bec9f60fa..452699155f 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.2", + "version": "0.5.0-rc.3", "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 264815ccfd..cad77aa27b 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.2", + "version": "0.5.0-rc.3", "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 079f0fdf16..9c5769482c 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.2" +version = "0.5.0-rc.3" description = "Wasm component implementing the PythonRuntime host using wit_wire protocol." license = "Elastic-2.0" readme = "README.md" diff --git a/src/typegate/engine/bindings.ts b/src/typegate/engine/bindings.ts index 444edc38e1..3c125c6fcb 100644 --- a/src/typegate/engine/bindings.ts +++ b/src/typegate/engine/bindings.ts @@ -20,8 +20,7 @@ import type { } from "./runtime.js"; export function get_version() { - return "0.4.10"; - // return Meta.version(); + return Meta.version(); } export function init_native() { diff --git a/src/typegate/src/engine/typecheck/input.ts b/src/typegate/src/engine/typecheck/input.ts index 00d71f90fa..f128d04129 100644 --- a/src/typegate/src/engine/typecheck/input.ts +++ b/src/typegate/src/engine/typecheck/input.ts @@ -13,7 +13,8 @@ import { } from "./common.ts"; export function generateValidator(tg: TypeGraph, typeIdx: number): Validator { - const validatorName = (typeIdx: number) => `validate_${typeIdx}`; + const validatorName = (typeIdx: number) => + `validate_${tg.type(typeIdx).title.replace(/[^1-9a-zA-Z_$]/g, "_")}`; const validatorCode = new InputValidationCompiler(tg, validatorName) .generate(typeIdx); @@ -24,7 +25,9 @@ export function generateValidator(tg: TypeGraph, typeIdx: number): Validator { if (errors.length > 0) { const messages = errors.map(([path, msg]) => ` - at ${path}: ${msg}\n`) .join(""); - throw new Error(`Validation errors:\n${messages}`); + throw new Error( + `Validation errors on ${tg.type(typeIdx).title}:\n${messages}`, + ); } }; } diff --git a/src/typegate/src/runtimes/deno/deno.ts b/src/typegate/src/runtimes/deno/deno.ts index b710fdf940..92c4af3a8d 100644 --- a/src/typegate/src/runtimes/deno/deno.ts +++ b/src/typegate/src/runtimes/deno/deno.ts @@ -110,8 +110,6 @@ export class DenoRuntime extends Runtime { depMetas, ); - logger.info(`Resolved runtime artifacts at ${basePath}`); - // Note: // Worker destruction seems to have no effect on the import cache? (deinit() => stop(worker)) // hence the use of contentHash @@ -140,7 +138,7 @@ export class DenoRuntime extends Runtime { ); if (Deno.env.get("DENO_TESTING") === "true") { - await w.disableLazyness(); + w.disableLazyness(); } const rt = new DenoRuntime( diff --git a/src/typegate/src/runtimes/deno/worker.ts b/src/typegate/src/runtimes/deno/worker.ts index ddfc87dde1..b2f76a4419 100644 --- a/src/typegate/src/runtimes/deno/worker.ts +++ b/src/typegate/src/runtimes/deno/worker.ts @@ -7,6 +7,7 @@ import { getLogger } from "../../log.ts"; import { make_internal } from "../../worker_utils.ts"; import type { Answer, Message } from "../patterns/messenger/types.ts"; +import { toFileUrl } from "@std/path/to-file-url"; import type { FuncTask, @@ -65,7 +66,7 @@ async function register_import_func(_: null, task: RegisterImportFuncTask) { verbose && logger.info(`register import func "${op}" from "${modulePath.toString()}`); - registry.set(op, await import(modulePath)); + registry.set(op, await import(toFileUrl(modulePath).toString())); } function register_func(_: null, task: RegisterFuncTask) { diff --git a/src/typegate/src/runtimes/kv.ts b/src/typegate/src/runtimes/kv.ts index ca5175b6ab..7ceec77696 100644 --- a/src/typegate/src/runtimes/kv.ts +++ b/src/typegate/src/runtimes/kv.ts @@ -24,8 +24,6 @@ export class KvRuntime extends Runtime { } static async init(params: RuntimeInitParams): Promise { - logger.info("Initializing KvRuntime"); - logger.debug(`Init params: ${JSON.stringify(params)}`); const { typegraph, args, secretManager } = params as RuntimeInitParams< KvRuntimeData >; @@ -51,39 +49,43 @@ export class KvRuntime extends Runtime { ): ComputeStage[] | Promise { const name = stage.props.materializer?.name; - const resolver: Resolver = async (args) => { - if (name == "kv_set") { + let resolver: Resolver; + if (name == "kv_set") { + resolver = async (args) => { const { key, value } = args; return await this.redis.set(key, value); - } - - if (name == "kv_get") { + }; + } else if (name == "kv_get") { + resolver = async (args) => { const { key } = args; - return await this.redis.get(key); - } - - if (name == "kv_delete") { + const resp = await this.redis.get(key); + return resp; + }; + } else if (name == "kv_delete") { + resolver = async (args) => { const { key } = args; return await this.redis.del(key); - } - - if (name == "kv_keys") { + }; + } else if (name == "kv_keys") { + resolver = async (args) => { const { filter } = args; return await this.redis.keys(filter ?? "*"); - } - - if (name === "kv_values") { + }; + } else if (name === "kv_values") { + resolver = async (args) => { const { filter } = args; const keys = await this.redis.keys(filter ?? "*"); const values = await Promise.all( - keys.map(async (key) => { + keys.map(async (key: string) => { const value = await this.redis.get(key); return value; }), ); return values; - } - }; + }; + } else { + throw new Error(`unrecognized mat name: ${name}`); + } return [new ComputeStage({ ...stage.props, resolver })]; } } diff --git a/src/typegate/src/runtimes/prisma/hooks/run_migrations.ts b/src/typegate/src/runtimes/prisma/hooks/run_migrations.ts index 35a647bcf1..31ccf54572 100644 --- a/src/typegate/src/runtimes/prisma/hooks/run_migrations.ts +++ b/src/typegate/src/runtimes/prisma/hooks/run_migrations.ts @@ -44,8 +44,6 @@ export class MigrationFailure extends Error { ) { const err = new MigrationFailure(message, runtimeName); - console.log({ message }); - const prefix = "ERROR: "; const prefixLen = prefix.length; err.errors = message diff --git a/src/typegate/src/runtimes/prisma/prisma.ts b/src/typegate/src/runtimes/prisma/prisma.ts index c6c4c35d37..9daf9cb847 100644 --- a/src/typegate/src/runtimes/prisma/prisma.ts +++ b/src/typegate/src/runtimes/prisma/prisma.ts @@ -158,7 +158,7 @@ export class PrismaRuntime extends Runtime { return ret; } - execute( + #executeResolver( q: GenQuery, path: string[], renames: Record, @@ -286,11 +286,11 @@ export class PrismaRuntime extends Runtime { const fields = [stage, ...Runtime.collectRelativeStages(stage, waitlist)]; - const [query, renames] = this.buildQuery(fields); + const [queryFn, renames] = this.buildQuery(fields); const queryStage = stage.withResolver( - this.execute( - query, + this.#executeResolver( + queryFn, stage.props.materializer?.data.path as string[] ?? [stage.props.node], renames, diff --git a/src/typegate/src/runtimes/python.ts b/src/typegate/src/runtimes/python.ts index aa3ac4d081..0514eefea7 100644 --- a/src/typegate/src/runtimes/python.ts +++ b/src/typegate/src/runtimes/python.ts @@ -31,8 +31,6 @@ export class PythonRuntime extends Runtime { } static async init(params: RuntimeInitParams): Promise { - logger.info("initializing PythonRuntime"); - logger.debug("init params: " + JSON.stringify(params)); const { materializers, typegraphName, typegraph, typegate } = params; const artifacts = typegraph.meta.artifacts; @@ -139,7 +137,6 @@ export class PythonRuntime extends Runtime { typegraphUrl: new URL(`internal+witwire://typegate/${typegraphName}`), }, ); - logger.info("WitWireMessenger initialized"); return new PythonRuntime(typegraphName, typegraph, uuid, wire); } diff --git a/src/typegate/src/runtimes/temporal.ts b/src/typegate/src/runtimes/temporal.ts index 33d2db0390..7c4687a1f9 100644 --- a/src/typegate/src/runtimes/temporal.ts +++ b/src/typegate/src/runtimes/temporal.ts @@ -27,8 +27,6 @@ export class TemporalRuntime extends Runtime { static async init( params: RuntimeInitParams, ): Promise { - logger.info("initializing TemporalRuntime"); - logger.debug(`init params: ${JSON.stringify(params)}`); const { typegraph, args, secretManager } = params as RuntimeInitParams< TemporalRuntimeData >; diff --git a/src/typegate/src/runtimes/wit_wire/mod.ts b/src/typegate/src/runtimes/wit_wire/mod.ts index 1c7be1be54..5917f46505 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.2"; +const METATYPE_VERSION = "0.5.0-rc.3"; export class WitWireMessenger { static async init( diff --git a/src/typegate/src/typegate/artifacts/mod.ts b/src/typegate/src/typegate/artifacts/mod.ts index 7e5fed2d48..e7ede30440 100644 --- a/src/typegate/src/typegate/artifacts/mod.ts +++ b/src/typegate/src/typegate/artifacts/mod.ts @@ -169,10 +169,14 @@ export class ArtifactStore implements AsyncDisposable { } #resolveLocalPath(dep: ArtifactMeta, parentDirName: string) { - let promise = this.#localPathMemo.get(dep.hash); + // we combine the parentDirName with the hash for the local + // memo since the same artifact might be by different + // relative solutions + // FIXME: use the artifact set solution from substantial for Deno rt + let promise = this.#localPathMemo.get(dep.hash + parentDirName); if (!promise) { promise = readyLocalPath(dep, parentDirName, this.persistence.dirs); - this.#localPathMemo.set(dep.hash, promise); + this.#localPathMemo.set(dep.hash + parentDirName, promise); } return promise; } diff --git a/src/typegate/src/typegate/mod.ts b/src/typegate/src/typegate/mod.ts index 24dd65b8a6..0deb05fc9a 100644 --- a/src/typegate/src/typegate/mod.ts +++ b/src/typegate/src/typegate/mod.ts @@ -195,7 +195,9 @@ export class Typegate implements AsyncDisposable { res = await handler(res, secretManager, response); } catch (e) { logger.error(`Error in onPush hook: ${e}`); - if (e instanceof MigrationFailure) { + // FIXME: MigrationFailur err message parser doesn't support all errors like + // can't reach database errs + if (e instanceof MigrationFailure && e.errors[0]) { response.setFailure(e.errors[0]); } else { response.setFailure({ diff --git a/src/typegate/src/typegraph/mod.ts b/src/typegate/src/typegraph/mod.ts index 4b6df1fe6f..77d50c45ae 100644 --- a/src/typegate/src/typegraph/mod.ts +++ b/src/typegate/src/typegraph/mod.ts @@ -42,6 +42,9 @@ import { initRuntime } from "../runtimes/mod.ts"; import randomizeRecursively, { GeneratorNode } from "../runtimes/random.ts"; import type { Typegate } from "../typegate/mod.ts"; import { TypeUtils } from "./utils.ts"; +import { getLogger } from "../log.ts"; + +const logger = getLogger(import.meta); export type { Cors, @@ -219,6 +222,7 @@ export class TypeGraph implements AsyncDisposable { (mat) => mat.runtime === idx, ); + logger.info("initializing runtime {}", { name: runtime.name }) return initRuntime(runtime.name, { typegate, typegraph, @@ -380,13 +384,13 @@ export class TypeGraph implements AsyncDisposable { } ensure( isObject(type) || - isInteger(type) || - isNumber(type) || - isBoolean(type) || - isFunction(type) || - isString(type) || - isUnion(type) || - isEither(type), + isInteger(type) || + isNumber(type) || + isBoolean(type) || + isFunction(type) || + isString(type) || + isUnion(type) || + isEither(type), `object expected but got ${type.type}`, ); return (x: any) => { diff --git a/src/typegraph/core/Cargo.toml b/src/typegraph/core/Cargo.toml index 569df10d32..f33bb12786 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.2" +version = "0.5.0-rc.3" edition = "2021" [lib] diff --git a/src/typegraph/core/src/global_store.rs b/src/typegraph/core/src/global_store.rs index f46a194e3d..395674ad25 100644 --- a/src/typegraph/core/src/global_store.rs +++ b/src/typegraph/core/src/global_store.rs @@ -39,6 +39,7 @@ pub struct SavedState { runtimes: usize, materializers: usize, policies: usize, + deno_modules: usize, } #[derive(Default)] @@ -54,7 +55,7 @@ pub struct Store { deno_runtime: RuntimeId, predefined_deno_functions: HashMap, - deno_modules: HashMap, + deno_modules: IndexMap, public_policy_id: PolicyId, @@ -106,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.2".to_owned(); + pub static SDK_VERSION: String = "0.5.0-rc.3".to_owned(); } fn with_store T>(f: F) -> T { @@ -137,6 +138,7 @@ impl Store { runtimes: s.runtimes.len(), materializers: s.materializers.len(), policies: s.policies.len(), + deno_modules: s.deno_modules.len(), }) } @@ -147,6 +149,7 @@ impl Store { s.runtimes.truncate(saved_state.runtimes); s.materializers.truncate(saved_state.materializers); s.policies.truncate(saved_state.policies); + s.deno_modules.truncate(saved_state.deno_modules); }) } diff --git a/src/typegraph/core/src/runtimes/prisma/context.rs b/src/typegraph/core/src/runtimes/prisma/context.rs index 6b55be95e3..c1067e7272 100644 --- a/src/typegraph/core/src/runtimes/prisma/context.rs +++ b/src/typegraph/core/src/runtimes/prisma/context.rs @@ -209,8 +209,8 @@ impl PrismaContext { if let Entry::Vacant(e) = self.models.entry(model_id) { let model: ModelRef = Rc::new(RefCell::new(model_id.try_into()?)).into(); e.insert(model.clone()); - self.models_by_name - .insert(model.borrow().model_type.name(), model_id); + let model_name = model.borrow().model_type.name(); + self.models_by_name.insert(model_name, model_id); let mut res = vec![model_id]; diff --git a/src/typegraph/core/src/typegraph.rs b/src/typegraph/core/src/typegraph.rs index e9f7b79ae7..4a5afd9a40 100644 --- a/src/typegraph/core/src/typegraph.rs +++ b/src/typegraph/core/src/typegraph.rs @@ -397,7 +397,8 @@ impl TypegraphContext { let idx = self.materializers.len(); e.insert(idx as u32); self.materializers.push(None); - let converted = convert_materializer(self, Store::get_materializer(id)?)?; + let mat_internal = Store::get_materializer(id)?; + let converted = convert_materializer(self, mat_internal)?; self.materializers[idx] = Some(converted); Ok(idx as MaterializerId) } diff --git a/src/typegraph/core/src/utils/archive.rs b/src/typegraph/core/src/utils/archive.rs index b8de8ffd0c..e33a8cb4e0 100644 --- a/src/typegraph/core/src/utils/archive.rs +++ b/src/typegraph/core/src/utils/archive.rs @@ -36,7 +36,6 @@ impl FsContext { impl ArchiveExt for FsContext { fn compress_and_encode(&self, path: impl AsRef) -> Result { let path = path.as_ref(); - crate::logger::debug!("compress_and_encode: {path:?}"); let ignore = { let tg_ignore_path = Path::new(".tgignore"); let mut ignore = self.load_tg_ignore(tg_ignore_path)?; diff --git a/src/typegraph/core/wit/typegraph.wit b/src/typegraph/core/wit/typegraph.wit index 766757e8bf..611fe47393 100644 --- a/src/typegraph/core/wit/typegraph.wit +++ b/src/typegraph/core/wit/typegraph.wit @@ -49,6 +49,7 @@ interface core { } record prisma-migration-config { + // Path towards the migrations for the specific typegraph. migrations-dir: string, migration-actions: list>, default-migration-action: migration-action, diff --git a/src/typegraph/deno/deno.json b/src/typegraph/deno/deno.json index 6d368cd926..82eefbb127 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.2", + "version": "0.5.0-rc.3", "publish": { "exclude": [ "!src/gen", diff --git a/src/typegraph/deno/src/runtimes/kv.ts b/src/typegraph/deno/src/runtimes/kv.ts index 14d5a81597..d3965b3a65 100644 --- a/src/typegraph/deno/src/runtimes/kv.ts +++ b/src/typegraph/deno/src/runtimes/kv.ts @@ -45,7 +45,8 @@ export class KvRuntime extends Runtime { get() { const mat = this.#operation("get", fx.read()); - return t.func(t.struct({ "key": t.string() }), t.string(), mat); + // FIXME: consolidate response type construction inside tg_core + return t.func(t.struct({ "key": t.string() }), t.string().optional(), mat); } delete() { diff --git a/src/typegraph/deno/src/tg_deploy.ts b/src/typegraph/deno/src/tg_deploy.ts index 868ed18027..a748bd99d3 100644 --- a/src/typegraph/deno/src/tg_deploy.ts +++ b/src/typegraph/deno/src/tg_deploy.ts @@ -117,9 +117,20 @@ export async function tgDeploy( throw new Error(`failed to deploy typegraph ${typegraph.name}`); } + const addTypegraph = response.data.addTypegraph; + + /* + // FIXME: failure field is used by interactive deployment + // which means errors need to be ignored here but this + // allows deployment errors in non-interactive scenarios + if (addTypegraph.failure) { + console.error(addTypegraph.failure); + throw new Error(`failed to deploy typegraph ${typegraph.name}`); + } */ + return { serialized: tgJson, - response: response.data.addTypegraph, + response: addTypegraph, }; } diff --git a/src/typegraph/deno/src/typegraph.ts b/src/typegraph/deno/src/typegraph.ts index 1d7a4fd4e9..efb015183a 100644 --- a/src/typegraph/deno/src/typegraph.ts +++ b/src/typegraph/deno/src/typegraph.ts @@ -187,6 +187,7 @@ export async function typegraph( rate: rate ? { ...defaultRateFields, ...rate } : undefined, }; + core.initTypegraph({ name, dynamic, path, ...tgParams }); const g: TypegraphBuilderArgs = { diff --git a/src/typegraph/deno/src/utils/func_utils.ts b/src/typegraph/deno/src/utils/func_utils.ts index 7f39df0c2b..b227f4875a 100644 --- a/src/typegraph/deno/src/utils/func_utils.ts +++ b/src/typegraph/deno/src/utils/func_utils.ts @@ -167,7 +167,7 @@ export async function execRequest( try { const response = await fetch(url, reqInit); if (!response.ok) { - log.debug("error", response.json()); + log.error("error response json", await response.json().catch(_err => 'non json response')); throw Error( `${errMsg}: request failed with status ${response.status} (${response.statusText})`, ); @@ -176,7 +176,7 @@ export async function execRequest( if (response.headers.get("Content-Type") == "application/json") { return await response.json(); } - log.debug("response", response); + log.error("non json response", response); throw Error( `${errMsg}: expected json object, got "${await response.text()}"`, ); diff --git a/src/typegraph/python/pyproject.toml b/src/typegraph/python/pyproject.toml index 0e112e67c0..b51836e82a 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.2" +version = "0.5.0-rc.3" 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 8755acca68..e6bb4a8db7 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.2" +version = "0.5.0-rc.3" diff --git a/src/typegraph/python/typegraph/graph/tg_deploy.py b/src/typegraph/python/typegraph/graph/tg_deploy.py index b300f46393..e5fbdc6afe 100644 --- a/src/typegraph/python/typegraph/graph/tg_deploy.py +++ b/src/typegraph/python/typegraph/graph/tg_deploy.py @@ -15,6 +15,7 @@ from typegraph.graph.typegraph import TypegraphOutput from typegraph.wit import ErrorStack, SerializeParams, store, wit_utils from typegraph import version as sdk_version +from typegraph.io import Log @dataclass @@ -123,10 +124,22 @@ def tg_deploy(tg: TypegraphOutput, params: TypegraphDeployParams) -> DeployResul response = exec_request(req) response = response.read().decode() - return DeployResult( - serialized=tg_json, - response=handle_response(response).get("data").get("addTypegraph"), - ) + response = handle_response(response) + + if response.get("errors") is not None: + 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) + raise Exception(f"failed to deploy typegraph {tg.name}") """ + + return DeployResult(serialized=tg_json, response=add_typegraph) def tg_remove(typegraph_name: str, params: TypegraphRemoveParams): diff --git a/src/typegraph/python/typegraph/runtimes/kv.py b/src/typegraph/python/typegraph/runtimes/kv.py index 4c7090ce14..653adc33a4 100644 --- a/src/typegraph/python/typegraph/runtimes/kv.py +++ b/src/typegraph/python/typegraph/runtimes/kv.py @@ -29,7 +29,7 @@ def __init__(self, url: str): def get(self): mat = self.__operation(KvMaterializer.GET, fx.read()) - return t.func(t.struct({"key": t.string()}), t.string(), mat) + return t.func(t.struct({"key": t.string()}), t.string().optional(), mat) def set(self): mat = self.__operation(KvMaterializer.SET, fx.update()) diff --git a/src/xtask/Cargo.toml b/src/xtask/Cargo.toml index a7ff09e091..8112185b0e 100644 --- a/src/xtask/Cargo.toml +++ b/src/xtask/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xtask" -version = "0.5.0-rc.2" +version = "0.5.0-rc.3" 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 6b6c159d94..56a75cdc17 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.2"; + static MT_VERSION: &str = "0.5.0-rc.3"; 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.2"; + static MT_VERSION: &str = "0.5.0-rc.3"; if args.metatype_version != MT_VERSION { return Err(InitError::VersionMismatch(MT_VERSION.into())); } diff --git a/tests/metagen/typegraphs/identities/rs/fdk.rs b/tests/metagen/typegraphs/identities/rs/fdk.rs index 920fb2e967..fc9bdd9610 100644 --- a/tests/metagen/typegraphs/identities/rs/fdk.rs +++ b/tests/metagen/typegraphs/identities/rs/fdk.rs @@ -109,7 +109,7 @@ impl Router { } pub fn init(&self, args: InitArgs) -> Result { - static MT_VERSION: &str = "0.5.0-rc.2"; + static MT_VERSION: &str = "0.5.0-rc.3"; if args.metatype_version != MT_VERSION { return Err(InitError::VersionMismatch(MT_VERSION.into())); } diff --git a/tests/runtimes/kv/__snapshots__/kv_test.ts.snap b/tests/runtimes/kv/__snapshots__/kv_test.ts.snap index 4501a8ab5f..64b059222e 100644 --- a/tests/runtimes/kv/__snapshots__/kv_test.ts.snap +++ b/tests/runtimes/kv/__snapshots__/kv_test.ts.snap @@ -10,10 +10,10 @@ snapshot[`Typegraph using kv 1`] = ` "policies": [], "properties": { "get": 1, - "set": 4, - "delete": 6, - "keys": 8, - "values": 12 + "set": 5, + "delete": 7, + "keys": 9, + "values": 13 }, "id": [], "required": [ @@ -31,7 +31,7 @@ snapshot[`Typegraph using kv 1`] = ` 0 ], "input": 2, - "output": 3, + "output": 4, "injections": {}, "runtimeConfig": null, "materializer": 0, @@ -53,13 +53,20 @@ snapshot[`Typegraph using kv 1`] = ` "title": "root_get_fn_input_key_string", "policies": [] }, + { + "type": "optional", + "title": "root_get_fn_output", + "policies": [], + "item": 3, + "default_value": null + }, { "type": "function", "title": "root_set_fn", "policies": [ 0 ], - "input": 5, + "input": 6, "output": 3, "injections": {}, "runtimeConfig": null, @@ -85,7 +92,7 @@ snapshot[`Typegraph using kv 1`] = ` 0 ], "input": 2, - "output": 7, + "output": 8, "injections": {}, "runtimeConfig": null, "materializer": 3, @@ -103,8 +110,8 @@ snapshot[`Typegraph using kv 1`] = ` "policies": [ 0 ], - "input": 9, - "output": 11, + "input": 10, + "output": 12, "injections": {}, "runtimeConfig": null, "materializer": 4, @@ -116,7 +123,7 @@ snapshot[`Typegraph using kv 1`] = ` "title": "root_keys_fn_input", "policies": [], "properties": { - "filter": 10 + "filter": 11 }, "id": [], "required": [] @@ -140,8 +147,8 @@ snapshot[`Typegraph using kv 1`] = ` "policies": [ 0 ], - "input": 13, - "output": 15, + "input": 14, + "output": 16, "injections": {}, "runtimeConfig": null, "materializer": 5, @@ -153,7 +160,7 @@ snapshot[`Typegraph using kv 1`] = ` "title": "root_values_fn_input", "policies": [], "properties": { - "filter": 14 + "filter": 15 }, "id": [], "required": [] @@ -286,10 +293,10 @@ snapshot[`Typegraph using kv 2`] = ` "policies": [], "properties": { "get": 1, - "set": 4, - "delete": 6, - "keys": 8, - "values": 12 + "set": 5, + "delete": 7, + "keys": 9, + "values": 13 }, "id": [], "required": [ @@ -307,7 +314,7 @@ snapshot[`Typegraph using kv 2`] = ` 0 ], "input": 2, - "output": 3, + "output": 4, "injections": {}, "runtimeConfig": null, "materializer": 0, @@ -329,13 +336,20 @@ snapshot[`Typegraph using kv 2`] = ` "title": "root_get_fn_input_key_string", "policies": [] }, + { + "type": "optional", + "title": "root_get_fn_output", + "policies": [], + "item": 3, + "default_value": null + }, { "type": "function", "title": "root_set_fn", "policies": [ 0 ], - "input": 5, + "input": 6, "output": 3, "injections": {}, "runtimeConfig": null, @@ -361,7 +375,7 @@ snapshot[`Typegraph using kv 2`] = ` 0 ], "input": 2, - "output": 7, + "output": 8, "injections": {}, "runtimeConfig": null, "materializer": 3, @@ -379,8 +393,8 @@ snapshot[`Typegraph using kv 2`] = ` "policies": [ 0 ], - "input": 9, - "output": 11, + "input": 10, + "output": 12, "injections": {}, "runtimeConfig": null, "materializer": 4, @@ -392,7 +406,7 @@ snapshot[`Typegraph using kv 2`] = ` "title": "root_keys_fn_input", "policies": [], "properties": { - "filter": 10 + "filter": 11 }, "id": [], "required": [] @@ -416,8 +430,8 @@ snapshot[`Typegraph using kv 2`] = ` "policies": [ 0 ], - "input": 13, - "output": 15, + "input": 14, + "output": 16, "injections": {}, "runtimeConfig": null, "materializer": 5, @@ -429,7 +443,7 @@ snapshot[`Typegraph using kv 2`] = ` "title": "root_values_fn_input", "policies": [], "properties": { - "filter": 14 + "filter": 15 }, "id": [], "required": [] diff --git a/tests/runtimes/kv/kv_test.ts b/tests/runtimes/kv/kv_test.ts index 9cefe67a6b..3a1f9b2508 100644 --- a/tests/runtimes/kv/kv_test.ts +++ b/tests/runtimes/kv/kv_test.ts @@ -51,6 +51,18 @@ Meta.test( .on(e); }); + await t.should("return null when key not found", async () => { + await gql` + query { + get(key: "INEXISTENT") + } + ` + .expectData({ + get: null, + }) + .on(e); + }); + await t.should("get all keys from redis", async () => { await gql` query { diff --git a/tests/runtimes/wasm_reflected/rust/Cargo.toml b/tests/runtimes/wasm_reflected/rust/Cargo.toml index 6b972c9783..205930032c 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.2" +version = "0.5.0-rc.3" edition = "2021" [lib] diff --git a/tests/runtimes/wasm_wire/rust/fdk.rs b/tests/runtimes/wasm_wire/rust/fdk.rs index c2b9ff4707..7b3e201923 100644 --- a/tests/runtimes/wasm_wire/rust/fdk.rs +++ b/tests/runtimes/wasm_wire/rust/fdk.rs @@ -109,7 +109,7 @@ impl Router { } pub fn init(&self, args: InitArgs) -> Result { - static MT_VERSION: &str = "0.4.11-rc.0"; + static MT_VERSION: &str = "0.5.0-rc.3"; if args.metatype_version != MT_VERSION { return Err(InitError::VersionMismatch(MT_VERSION.into())); } diff --git a/tests/type_nodes/__snapshots__/array_of_optional_test.ts.snap b/tests/type_nodes/__snapshots__/array_of_optional_test.ts.snap index ebf9187e2d..22773921b3 100644 --- a/tests/type_nodes/__snapshots__/array_of_optional_test.ts.snap +++ b/tests/type_nodes/__snapshots__/array_of_optional_test.ts.snap @@ -2,7 +2,7 @@ export const snapshot = {}; snapshot[`array of optional 1`] = ` [ - "Validation errors: + "Validation errors on root_testNonNull_fn_input: - at .struct_array[2]: exptected a non-null object, got null - at .string_array[2]: expected a string, got object - at .integer_array[2]: expected number, got object diff --git a/tests/type_nodes/__snapshots__/either_test.ts.snap b/tests/type_nodes/__snapshots__/either_test.ts.snap index e9f0801b3c..02891807f6 100644 --- a/tests/type_nodes/__snapshots__/either_test.ts.snap +++ b/tests/type_nodes/__snapshots__/either_test.ts.snap @@ -2,7 +2,7 @@ export const snapshot = {}; snapshot[`Either type 1`] = ` [ - "Validation errors: + "Validation errors on root_regist_user_fn_input: - at .user: Value does not match to any variant of the either type #0 .user.school,expected a string, got undefined, .user,unexpected fields: company #1 .user.age,expected minimum value: 17, got 5, .user.college,expected a string, got undefined, .user,unexpected fields: company diff --git a/tests/type_nodes/__snapshots__/union_test.ts.snap b/tests/type_nodes/__snapshots__/union_test.ts.snap index 24658291be..241810400c 100644 --- a/tests/type_nodes/__snapshots__/union_test.ts.snap +++ b/tests/type_nodes/__snapshots__/union_test.ts.snap @@ -2,7 +2,7 @@ export const snapshot = {}; snapshot[`Union type 1`] = ` [ - "Validation errors: + "Validation errors on root_convert_fn_input: - at .color: Value does not match to any variant of the union type #0 .color,expected an array, got string #1 .color,expected an object, got string diff --git a/tests/typecheck/__snapshots__/input_validator_test.ts.snap b/tests/typecheck/__snapshots__/input_validator_test.ts.snap index 51a9673cf2..0cad272f18 100644 --- a/tests/typecheck/__snapshots__/input_validator_test.ts.snap +++ b/tests/typecheck/__snapshots__/input_validator_test.ts.snap @@ -95,7 +95,7 @@ return validate_32" `; snapshot[`input validator compiler 2`] = ` -"Validation errors: +"Validation errors on root_createPost_fn_input: - at .title: expected minimum length: 10, got 6 - at .content: expected minimum length: 100, got 13 - at .authorId: string does not statisfy the required format 'uuid' @@ -105,7 +105,7 @@ snapshot[`input validator compiler 2`] = ` snapshot[`input validator compiler 3`] = ` [ - "Validation errors: + "Validation errors on User: - at .username: string does not match to the pattern /^[a-z]+\$/ - at .email: string does not statisfy the required format 'email' - at .website: string does not statisfy the required format 'uri' @@ -165,7 +165,7 @@ return validate_36" snapshot[`input validator compiler 5`] = ` [ - "Validation errors: + "Validation errors on root_enums_fn_input: - at .userRole: value did not match to any of the enum values ", ] @@ -173,7 +173,7 @@ snapshot[`input validator compiler 5`] = ` snapshot[`input validator compiler 6`] = ` [ - "Validation errors: + "Validation errors on root_enums_fn_input: - at .availableItems[0]: value did not match to any of the enum values - at .availableItems[2]: value did not match to any of the enum values ", @@ -393,7 +393,7 @@ return validate_9" snapshot[`input validator compiler 8`] = ` [ - "Validation errors: + "Validation errors on root_posts_fn_input: - at .authorId: string does not statisfy the required format 'uuid' ", ] @@ -401,7 +401,7 @@ snapshot[`input validator compiler 8`] = ` snapshot[`input validator compiler 9`] = ` [ - "Validation errors: + "Validation errors on root_posts_fn_input: - at .tag: Value does not match to any variant of the union type #0 .tag,expected a string, got object #1 .tag[1],expected maximum length: 10, got 11 @@ -410,7 +410,7 @@ snapshot[`input validator compiler 9`] = ` `; snapshot[`input validator compiler 10`] = ` -"Validation errors: +"Validation errors on root_posts_fn_input: - at .search: Value does not match to any variant of the either type #0 .search.title,Value match to more than one variant of the either type #1 .search.content,Value does not match to any variant of the either type @@ -420,7 +420,7 @@ snapshot[`input validator compiler 10`] = ` `; snapshot[`input validator compiler 11`] = ` -"Validation errors: +"Validation errors on root_posts_fn_input: - at .search: Value does not match to any variant of the either type #0 .search.title,Value does not match to any variant of the either type #0 .search.title,expected a string, got undefined diff --git a/tools/compose/compose.base.yml b/tools/compose/compose.base.yml index 9c902066bc..855d48dd3f 100644 --- a/tools/compose/compose.base.yml +++ b/tools/compose/compose.base.yml @@ -19,7 +19,7 @@ services: REDIS_PASSWORD: password minio: - image: bitnami/minio:2024 + image: docker.io/bitnami/minio:2024 platform: linux/amd64 restart: unless-stopped ports: diff --git a/tools/consts.ts b/tools/consts.ts index 26f38d8454..88154dba7e 100644 --- a/tools/consts.ts +++ b/tools/consts.ts @@ -1,8 +1,8 @@ // Copyright Metatype OÜ, licensed under the Elastic License 2.0. // SPDX-License-Identifier: Elastic-2.0 -export const METATYPE_VERSION = "0.5.0-rc.2"; -export const PUBLISHED_VERSION = "0.5.0-rc.1"; +export const METATYPE_VERSION = "0.5.0-rc.3"; +export const PUBLISHED_VERSION = "0.5.0-rc.2"; export const GHJK_VERSION = "v0.2.1"; export const GHJK_ACTION_VERSION = "318209a9d215f70716a4ac89dbeb9653a2deb8bc"; export const RUST_VERSION = "1.80.1";