├── .changeset ├── README.md └── config.json ├── .commitlintrc.json ├── .editorconfig ├── .eslintignore ├── .eslintrc.json ├── .gitattributes ├── .github ├── .kodiak.toml ├── actions │ ├── nx-affected │ │ └── action.yml │ └── setup-job │ │ └── action.yml ├── banner-4.png ├── nx-latest-issue-template.md ├── renovate.json5 └── workflows │ ├── __build.yml │ ├── __changesets.yml │ ├── __code-analysis--codeql.yml │ ├── __code-analysis--sonar.yml │ ├── __deploy-vercel.yml │ ├── __deploy.yml │ ├── __e2e.yml │ ├── __generators.yml │ ├── __lint.yml │ ├── __test.yml │ ├── code-analysis.yml │ ├── delete-cache.yml │ ├── main.yml │ ├── nx-latest.yml │ ├── pull-request.yml │ ├── sponsors-label.yml │ ├── stale.yml │ └── welcome.yml ├── .gitignore ├── .husky ├── .gitignore ├── commit-msg └── pre-commit ├── .lintstagedrc.mjs ├── .npmrc ├── .npmrc-vercel ├── .prettierignore ├── .prettierrc ├── .vscode ├── extensions.json └── settings.json ├── LICENSE ├── README.md ├── babel.config.json ├── examples ├── api-gateway-openapi--javascript-wiki-e2e │ ├── .eslintrc.json │ ├── cypress.config.ts │ ├── project.json │ ├── src │ │ ├── e2e │ │ │ └── app.cy.ts │ │ ├── fixtures │ │ │ └── example.json │ │ └── support │ │ │ ├── app.po.ts │ │ │ ├── commands.ts │ │ │ └── e2e.ts │ └── tsconfig.json ├── api-gateway-openapi--javascript-wiki │ ├── .eslintrc.json │ ├── .meshrc.json │ ├── jest.config.ts │ ├── project.json │ ├── tsconfig.app.json │ ├── tsconfig.json │ └── tsconfig.spec.json ├── sdk-graphql--star-wars │ ├── .eslintrc.json │ ├── .meshrc.yml │ ├── .swcrc │ ├── codegen.ts │ ├── jest.config.ts │ ├── project.json │ ├── src │ │ ├── graphql │ │ │ └── getMovies.query.graphql │ │ ├── index.ts │ │ └── lib │ │ │ ├── client.ts │ │ │ ├── sdk.ts │ │ │ ├── server.ts │ │ │ └── types.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json ├── sdk-json-schema--fake-api │ ├── .eslintrc.json │ ├── .meshrc.yml │ ├── .swcrc │ ├── jest.config.ts │ ├── project.json │ ├── src │ │ ├── graphql │ │ │ └── getMe.query.graphql │ │ ├── index.ts │ │ ├── json-samples │ │ │ └── user-input.json │ │ ├── json-schemas │ │ │ ├── company.json │ │ │ └── user.json │ │ └── lib │ │ │ ├── sdk.ts │ │ │ ├── server.ts │ │ │ └── types.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json ├── sdk-mysql--rfam │ ├── .eslintrc.json │ ├── .meshrc.yml │ ├── .swcrc │ ├── codegen.ts │ ├── jest.config.ts │ ├── project.json │ ├── src │ │ ├── graphql │ │ │ └── getAlignmentTree.query.graphql │ │ ├── index.ts │ │ └── lib │ │ │ ├── client.ts │ │ │ ├── sdk.ts │ │ │ ├── server.ts │ │ │ └── types.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json ├── sdk-neo4j--movies │ ├── .eslintrc.json │ ├── .meshrc.yml │ ├── .swcrc │ ├── jest.config.ts │ ├── project.json │ ├── src │ │ ├── graphql │ │ │ └── example.query.graphql │ │ ├── index.ts │ │ └── lib │ │ │ ├── sdk.ts │ │ │ ├── server.ts │ │ │ └── types.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json ├── sdk-nextjs-e2e │ ├── .eslintrc.json │ ├── cypress.config.ts │ ├── project.json │ ├── src │ │ ├── e2e │ │ │ └── sources │ │ │ │ ├── odata │ │ │ │ └── trippin.cy.ts │ │ │ │ ├── openapi │ │ │ │ └── javascript-wiki.cy.ts │ │ │ │ └── soap │ │ │ │ └── country-info.cy.ts │ │ └── support │ │ │ ├── app.po.ts │ │ │ ├── commands.ts │ │ │ └── e2e.ts │ └── tsconfig.json ├── sdk-nextjs │ ├── .eslintrc.json │ ├── index.d.ts │ ├── jest.config.ts │ ├── next-env.d.ts │ ├── next.config.js │ ├── pages │ │ ├── _app.tsx │ │ ├── _document.tsx │ │ ├── index.tsx │ │ ├── sources │ │ │ ├── odata │ │ │ │ └── trippin.tsx │ │ │ ├── openapi │ │ │ │ └── javascript-wiki.tsx │ │ │ └── soap │ │ │ │ └── country-info.tsx │ │ └── styles.css │ ├── project.json │ ├── public │ │ └── .gitkeep │ ├── specs │ │ ├── index.spec.tsx │ │ └── sources │ │ │ ├── odata │ │ │ ├── trippin.json │ │ │ └── trippin.spec.tsx │ │ │ ├── openapi │ │ │ ├── javascript-wiki.json │ │ │ └── javascript-wiki.spec.tsx │ │ │ └── soap │ │ │ ├── country-info.json │ │ │ └── country-info.spec.tsx │ ├── tsconfig.json │ └── tsconfig.spec.json ├── sdk-odata--trippin │ ├── .babelrc │ ├── .eslintrc.json │ ├── .meshrc.js │ ├── jest.config.ts │ ├── package.json │ ├── project.json │ ├── src │ │ ├── graphql │ │ │ └── airports │ │ │ │ └── getAirports.query.graphql │ │ ├── index.ts │ │ └── lib │ │ │ ├── sdk.ts │ │ │ ├── server.ts │ │ │ └── types.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json ├── sdk-openapi--javascript-wiki │ ├── .eslintrc.json │ ├── .meshrc.yml │ ├── .swcrc │ ├── jest.config.ts │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.ts │ │ └── lib │ │ │ ├── sdk.ts │ │ │ ├── server.ts │ │ │ ├── types.ts │ │ │ └── utils │ │ │ ├── index.ts │ │ │ └── is-availability.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json ├── sdk-openapi--stackexchange │ ├── .babelrc │ ├── .eslintrc.json │ ├── .meshrc.json │ ├── jest.config.ts │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.ts │ │ └── lib │ │ │ ├── sdk.ts │ │ │ ├── server.ts │ │ │ └── types.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json └── sdk-soap--country-info │ ├── .eslintrc.json │ ├── .meshrc.cjs │ ├── .swcrc │ ├── __snapshots__ │ └── -284307766.json │ ├── jest.config.ts │ ├── package.json │ ├── project.json │ ├── src │ ├── graphql │ │ └── queries │ │ │ └── GetLanguages.query.graphql │ ├── index.ts │ └── lib │ │ ├── sdk.ts │ │ ├── server.ts │ │ └── types.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json ├── jest.config.ts ├── jest.preset.js ├── nx.json ├── package.json ├── packages └── nx-mesh │ ├── .eslintrc.json │ ├── CHANGELOG.md │ ├── executors.json │ ├── generators.json │ ├── jest.config.ts │ ├── migrations.json │ ├── package.json │ ├── project.json │ ├── src │ ├── executors │ │ ├── build-gateway │ │ │ ├── build-gateway.ts │ │ │ ├── hasher.spec.ts │ │ │ ├── hasher.ts │ │ │ ├── index.ts │ │ │ ├── schema.json │ │ │ └── schema.ts │ │ ├── build-swc │ │ │ ├── build-swc.ts │ │ │ ├── hasher.spec.ts │ │ │ ├── hasher.ts │ │ │ ├── index.ts │ │ │ ├── schema.json │ │ │ ├── schema.ts │ │ │ └── swc-executor │ │ │ │ ├── README.md │ │ │ │ ├── compile-swc.ts │ │ │ │ └── swc.impl.ts │ │ ├── build │ │ │ ├── build.ts │ │ │ ├── hasher.spec.ts │ │ │ ├── hasher.ts │ │ │ ├── schema.json │ │ │ └── schema.ts │ │ ├── dev │ │ │ ├── dev.ts │ │ │ ├── hasher.spec.ts │ │ │ ├── hasher.ts │ │ │ ├── index.ts │ │ │ ├── lib │ │ │ │ └── get-serve-location.ts │ │ │ ├── schema.d.ts │ │ │ └── schema.json │ │ ├── serve │ │ │ ├── hasher.spec.ts │ │ │ ├── hasher.ts │ │ │ ├── index.ts │ │ │ ├── schema.d.ts │ │ │ ├── schema.json │ │ │ └── serve.ts │ │ ├── start │ │ │ ├── hasher.spec.ts │ │ │ ├── hasher.ts │ │ │ ├── index.ts │ │ │ ├── lib │ │ │ │ └── get-serve-location.ts │ │ │ ├── schema.json │ │ │ ├── schema.ts │ │ │ └── start.ts │ │ └── validate │ │ │ ├── hasher.spec.ts │ │ │ ├── hasher.ts │ │ │ ├── index.ts │ │ │ ├── schema.json │ │ │ ├── schema.ts │ │ │ └── validate.ts │ ├── generators │ │ ├── application │ │ │ ├── application.ts │ │ │ ├── index.ts │ │ │ ├── schema.d.ts │ │ │ └── schema.json │ │ ├── base │ │ │ ├── __snapshots__ │ │ │ │ └── base.spec.ts.snap │ │ │ ├── base.spec.ts │ │ │ ├── base.ts │ │ │ ├── files │ │ │ │ ├── app │ │ │ │ │ ├── tsconfig.app.json__tmpl__ │ │ │ │ │ └── tsconfig.json__tmpl__ │ │ │ │ └── lib │ │ │ │ │ └── src │ │ │ │ │ ├── index.__tmpl__ts │ │ │ │ │ └── lib │ │ │ │ │ └── sdk.__tmpl__ts │ │ │ ├── index.ts │ │ │ ├── lib │ │ │ │ ├── add-cypress.ts │ │ │ │ ├── add-jest.ts │ │ │ │ ├── add-linting.ts │ │ │ │ ├── add-project-config.ts │ │ │ │ ├── create-files.ts │ │ │ │ ├── index.ts │ │ │ │ ├── node-generator.ts │ │ │ │ ├── normalize-options.ts │ │ │ │ └── set-defaults.ts │ │ │ ├── schema.d.ts │ │ │ └── schema.json │ │ ├── preset │ │ │ ├── index.ts │ │ │ ├── preset.spec.ts │ │ │ ├── preset.ts │ │ │ ├── schema.d.ts │ │ │ └── schema.json │ │ ├── sdk │ │ │ ├── index.ts │ │ │ ├── schema.json │ │ │ ├── schema.ts │ │ │ └── sdk.ts │ │ └── utils │ │ │ └── create-mesh-example │ │ │ ├── __snapshots__ │ │ │ ├── create-codegen-files.spec.ts.snap │ │ │ └── create-shared-files.spec.ts.snap │ │ │ ├── add-dependencies.spec.ts │ │ │ ├── add-dependencies.ts │ │ │ ├── create-codegen-files.spec.ts │ │ │ ├── create-codegen-files.ts │ │ │ ├── create-mesh-example.spec.ts │ │ │ ├── create-mesh-example.ts │ │ │ ├── create-shared-files.spec.ts │ │ │ ├── create-shared-files.ts │ │ │ ├── examples │ │ │ ├── country-info │ │ │ │ ├── codegen │ │ │ │ │ ├── codegen.__tmpl__ts │ │ │ │ │ └── src │ │ │ │ │ │ └── lib │ │ │ │ │ │ └── client.__tmpl__ts │ │ │ │ ├── dependencies.ts │ │ │ │ ├── index.ts │ │ │ │ └── shared │ │ │ │ │ ├── .meshrc.__configExtension__ │ │ │ │ │ └── src │ │ │ │ │ └── graphql │ │ │ │ │ └── GetLanguages.query.graphql__tmpl__ │ │ │ ├── fake-api │ │ │ │ ├── codegen │ │ │ │ │ ├── codegen.__tmpl__ts │ │ │ │ │ └── src │ │ │ │ │ │ └── lib │ │ │ │ │ │ └── client.__tmpl__ts │ │ │ │ ├── dependencies.ts │ │ │ │ ├── index.ts │ │ │ │ └── shared │ │ │ │ │ ├── .meshrc.__configExtension__ │ │ │ │ │ └── src │ │ │ │ │ ├── graphql │ │ │ │ │ └── getMe.query.graphql__tmpl__ │ │ │ │ │ ├── json-samples │ │ │ │ │ └── user-input.json__tmpl__ │ │ │ │ │ └── json-schemas │ │ │ │ │ ├── company.json__tmpl__ │ │ │ │ │ └── user.json__tmpl__ │ │ │ ├── index.ts │ │ │ ├── javascript-wiki │ │ │ │ ├── codegen │ │ │ │ │ ├── codegen.__tmpl__ts │ │ │ │ │ └── src │ │ │ │ │ │ └── lib │ │ │ │ │ │ └── client.__tmpl__ts │ │ │ │ ├── dependencies.ts │ │ │ │ ├── index.ts │ │ │ │ └── shared │ │ │ │ │ └── .meshrc.__configExtension__ │ │ │ ├── movies │ │ │ │ ├── codegen │ │ │ │ │ ├── codegen.__tmpl__ts │ │ │ │ │ └── src │ │ │ │ │ │ └── lib │ │ │ │ │ │ └── client.__tmpl__ts │ │ │ │ ├── dependencies.ts │ │ │ │ ├── index.ts │ │ │ │ └── shared │ │ │ │ │ ├── .meshrc.__configExtension__ │ │ │ │ │ └── src │ │ │ │ │ └── graphql │ │ │ │ │ └── example.query.graphql__tmpl__ │ │ │ ├── rfam │ │ │ │ ├── codegen │ │ │ │ │ ├── codegen.__tmpl__ts │ │ │ │ │ └── src │ │ │ │ │ │ └── lib │ │ │ │ │ │ └── client.__tmpl__ts │ │ │ │ ├── dependencies.ts │ │ │ │ ├── index.ts │ │ │ │ └── shared │ │ │ │ │ ├── .meshrc.__configExtension__ │ │ │ │ │ └── src │ │ │ │ │ └── graphql │ │ │ │ │ └── getAlignmentTree.query.graphql__tmpl__ │ │ │ ├── stackexchange │ │ │ │ ├── codegen │ │ │ │ │ ├── codegen.__tmpl__ts │ │ │ │ │ └── src │ │ │ │ │ │ └── lib │ │ │ │ │ │ └── client.__tmpl__ts │ │ │ │ ├── dependencies.ts │ │ │ │ ├── index.ts │ │ │ │ └── shared │ │ │ │ │ └── .meshrc.__configExtension__ │ │ │ ├── star-wars │ │ │ │ ├── codegen │ │ │ │ │ ├── codegen.__tmpl__ts │ │ │ │ │ └── src │ │ │ │ │ │ └── lib │ │ │ │ │ │ └── client.__tmpl__ts │ │ │ │ ├── dependencies.ts │ │ │ │ ├── index.ts │ │ │ │ └── shared │ │ │ │ │ ├── .meshrc.__configExtension__ │ │ │ │ │ └── src │ │ │ │ │ └── graphql │ │ │ │ │ └── getMovies.query.graphql__tmpl__ │ │ │ └── trippin │ │ │ │ ├── codegen │ │ │ │ ├── codegen.__tmpl__ts │ │ │ │ └── src │ │ │ │ │ └── lib │ │ │ │ │ └── client.__tmpl__ts │ │ │ │ ├── dependencies.ts │ │ │ │ ├── index.ts │ │ │ │ └── shared │ │ │ │ ├── .meshrc.__configExtension__ │ │ │ │ └── src │ │ │ │ └── graphql │ │ │ │ └── airports │ │ │ │ └── getAirports.query.graphql__tmpl__ │ │ │ ├── index.ts │ │ │ └── types.ts │ ├── index.ts │ ├── migrations │ │ └── 4.0.0 │ │ │ └── rename-swcrc-config │ │ │ ├── index.ts │ │ │ ├── rename-swcrc-config.spec.ts │ │ │ └── rename-swcrc-config.ts │ └── utils │ │ ├── create-package-json.ts │ │ ├── get-mesh-packages.spec.ts │ │ ├── get-mesh-packages.ts │ │ ├── get-package-versions.spec.ts │ │ ├── get-package-versions.ts │ │ ├── get-source-file.ts │ │ ├── get-wildcard-packages.spec.ts │ │ ├── get-wildcard-packages.ts │ │ ├── graphql-codegen-cli │ │ ├── arguments.spec.ts │ │ ├── arguments.ts │ │ ├── cli.ts │ │ └── index.ts │ │ ├── index.ts │ │ ├── mesh-cli │ │ ├── arguments.spec.ts │ │ ├── arguments.ts │ │ ├── cli.ts │ │ ├── commands.spec.ts │ │ ├── commands.ts │ │ ├── env.spec.ts │ │ ├── env.ts │ │ └── index.ts │ │ ├── mesh-packages.ts │ │ ├── run-tasks-in-serial │ │ ├── index.ts │ │ ├── run-tasks-in-serial.spec.ts │ │ └── run-tasks-in-serial.ts │ │ ├── typescript.ts │ │ ├── versions.ts │ │ └── watcher │ │ ├── index.ts │ │ └── watcher.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── socket.yml ├── sonar-project.properties ├── tools ├── scripts │ └── nx-update.sh └── tsconfig.tools.json ├── tsconfig.base.json └── vercel.json /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@2.0.0/schema.json", 3 | "changelog": [ 4 | "@changesets/changelog-github", 5 | { "repo": "domjtalbot/nx-mesh" } 6 | ], 7 | "commit": false, 8 | "linked": [], 9 | "fixed": [["nx-mesh", "*"]], 10 | "access": "public", 11 | "baseBranch": "main", 12 | "updateInternalDependencies": "patch", 13 | "ignore": [], 14 | "snapshot": { 15 | "useCalculatedVersion": true 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.commitlintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["@commitlint/config-angular"], 3 | "rules": {} 4 | } 5 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | pnpm-lock.yaml 3 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "ignorePatterns": ["**/*"], 4 | "plugins": ["@nrwl/nx"], 5 | "overrides": [ 6 | { 7 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 8 | "rules": { 9 | "@nrwl/nx/enforce-module-boundaries": [ 10 | "error", 11 | { 12 | "enforceBuildableLibDependency": true, 13 | "allow": [], 14 | "depConstraints": [ 15 | { 16 | "sourceTag": "*", 17 | "onlyDependOnLibsWithTags": ["*"] 18 | } 19 | ] 20 | } 21 | ] 22 | } 23 | }, 24 | { 25 | "files": ["*.ts", "*.tsx"], 26 | "extends": ["plugin:@nrwl/nx/typescript"], 27 | "rules": {} 28 | }, 29 | { 30 | "files": ["*.js", "*.jsx"], 31 | "extends": ["plugin:@nrwl/nx/javascript"], 32 | "rules": {} 33 | }, 34 | { 35 | "files": "*.json", 36 | "parser": "jsonc-eslint-parser", 37 | "rules": {} 38 | } 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /.github/.kodiak.toml: -------------------------------------------------------------------------------- 1 | # Kodiak GitHub App config 2 | # https://kodiakhq.com 3 | # https://github.com/marketplace/kodiakhq#pricing-and-setup 4 | 5 | # Minimal config. version is the only required field. 6 | version = 1 7 | -------------------------------------------------------------------------------- /.github/banner-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domjtalbot/nx-mesh/397cc741550cc552c6b24cc71aceed60093a1339/.github/banner-4.png -------------------------------------------------------------------------------- /.github/nx-latest-issue-template.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Compatibility issues with Nx `v{{ env.latest_tag }}` 3 | assignees: domjtalbot 4 | labels: bug, enhancement 5 | --- 6 | 7 | Automated tests failed against Nx `v{{ env.latest_tag }}`. 8 | These errors need to be addressed, before `v{{ env.latest_tag }}` can be supported. 9 | 10 | | Package | Change | 11 | | ---------------------------------------- | --------------------------------------------------- | 12 | | 🐋 [nrwl/nx](https://github.com/nrwl/nx) | `v{{ env.current_tag }}` -> `v{{ env.latest_tag }}` | 13 | 14 | ## Release Notes 15 | 16 |
17 | nrwl/nx v{{ env.latest_tag }} 18 | 19 | ### [`v{{ env.latest_tag }}`](https://github.com/nrwl/nx/releases/tag/v{{ env.latest_tag }}) 20 | 21 | {{ env.release_notes }} 22 | 23 |
24 | 25 | [Compare v{{ env.latest_tag }} with v{{ env.current_tag }}](https://github.com/nrwl/nx/compare/{{ env.current_tag }}...{{ env.latest_tag }}) 26 | 27 |
28 | 29 | --- 30 | 31 | ## Configuration 32 | 33 | 📅 **Schedule**: Daily at midnight (UTC). 34 | 35 | _This issue has been generated by the [nx-latest](.github/workflows/nx-latest.yml) workflow. 🖖_ 36 | -------------------------------------------------------------------------------- /.github/renovate.json5: -------------------------------------------------------------------------------- 1 | { 2 | /* 3 | * Extend configuration presets. 4 | * 5 | * @link Documentation - https://docs.renovatebot.com/configuration-options/#extends 6 | * @link Shareable Config Presets - https://docs.renovatebot.com/config-presets/ 7 | */ 8 | extends: ['github>domjtalbot/renovate:nx.json5'], 9 | 10 | /* 11 | * Limit the number of concurrent branches and 12 | * pull requests created by Renovate. 13 | * 14 | * This helps to reduce the noise of created 15 | * pull requests. 16 | * 17 | * @link Documentation - https://docs.renovatebot.com/configuration-options/#prconcurrentlimit 18 | */ 19 | prConcurrentLimit: 1, 20 | } 21 | -------------------------------------------------------------------------------- /.github/workflows/__code-analysis--codeql.yml: -------------------------------------------------------------------------------- 1 | name: 'Code Analysis - CodeQL' 2 | 3 | on: 4 | workflow_call: 5 | 6 | concurrency: 7 | group: code-analysis--codeql-${{ github.workflow }}-${{ github.ref }} 8 | 9 | permissions: 10 | contents: read 11 | 12 | jobs: 13 | codeql: 14 | # CodeQL runs on ubuntu-latest, windows-latest, and macos-latest 15 | runs-on: ubuntu-latest 16 | 17 | permissions: 18 | # required for all workflows 19 | security-events: write 20 | 21 | # only required for workflows in private repositories 22 | actions: read 23 | contents: read 24 | 25 | steps: 26 | - name: Checkout repository 27 | uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3 28 | with: 29 | fetch-depth: 0 30 | 31 | # Initializes the CodeQL tools for scanning. 32 | - name: Initialize CodeQL 33 | uses: github/codeql-action/init@b2c19fb9a2a485599ccf4ed5d65527d94bc57226 # v2 34 | with: 35 | languages: javascript 36 | 37 | # Autobuild attempts to build any compiled languages 38 | - name: Autobuild 39 | uses: github/codeql-action/autobuild@b2c19fb9a2a485599ccf4ed5d65527d94bc57226 # v2 40 | 41 | - name: Perform CodeQL Analysis 42 | uses: github/codeql-action/analyze@b2c19fb9a2a485599ccf4ed5d65527d94bc57226 # v2 43 | 44 | - name: Setup Job 45 | id: setup 46 | uses: ./.github/actions/setup-job 47 | with: 48 | node_version: 'lts/*' 49 | 50 | - name: Nx-mesh Lint CodeQL 51 | run: | 52 | pnpm nx run nx-mesh:lint \ 53 | --configuration=codeql 54 | 55 | - name: Upload Lint CodeQL 56 | uses: github/codeql-action/upload-sarif@b2c19fb9a2a485599ccf4ed5d65527d94bc57226 # v2 57 | with: 58 | sarif_file: reports/packages/nx-mesh/lint.sarif 59 | wait-for-processing: true 60 | -------------------------------------------------------------------------------- /.github/workflows/code-analysis.yml: -------------------------------------------------------------------------------- 1 | name: 'Code Analysis' 2 | 3 | on: 4 | workflow_call: 5 | secrets: 6 | NX__TRIPPIN__API_KEY: 7 | description: 'The Trippin API Key' 8 | required: true 9 | NX_CLOUD_ACCESS_TOKEN: 10 | description: 'The NX Cloud API token' 11 | required: true 12 | 13 | workflow_dispatch: 14 | 15 | concurrency: 16 | group: code-analysis-${{ github.workflow }}-${{ github.ref }} 17 | 18 | env: 19 | NX__TRIPPIN__API_KEY: ${{ secrets.NX__TRIPPIN__API_KEY }} 20 | NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} 21 | 22 | jobs: 23 | codeql: 24 | name: CodeQL 25 | uses: ./.github/workflows/__code-analysis--codeql.yml 26 | secrets: inherit 27 | 28 | sonar: 29 | name: Sonar 30 | uses: ./.github/workflows/__code-analysis--sonar.yml 31 | secrets: inherit 32 | -------------------------------------------------------------------------------- /.github/workflows/delete-cache.yml: -------------------------------------------------------------------------------- 1 | name: 'Delete Cache' 2 | 3 | on: 4 | pull_request: 5 | types: [closed] 6 | 7 | workflow_dispatch: 8 | inputs: 9 | branchName: 10 | type: string 11 | required: false 12 | description: > 13 | The branch to clear cache for. 14 | 15 | pullRequestId: 16 | type: number 17 | required: false 18 | description: > 19 | The pull request ID to clear cache for. 20 | 21 | jobs: 22 | deletePullRequest: 23 | if: ${{ github.event.number || inputs.pullRequestId }} 24 | runs-on: ubuntu-latest 25 | steps: 26 | - uses: snnaplab/delete-branch-cache-action@v1 27 | with: 28 | # Specify explicitly because the ref at the time of merging will be a branch name such as 'main', 'develop' 29 | ref: refs/pull/${{ github.event.number || inputs.pullRequestId }}/merge 30 | 31 | deleteBranch: 32 | if: ${{ inputs.branchName }} 33 | runs-on: ubuntu-latest 34 | steps: 35 | - uses: snnaplab/delete-branch-cache-action@v1 36 | with: 37 | ref: refs/heads/${{ inputs.branchName }} 38 | -------------------------------------------------------------------------------- /.github/workflows/sponsors-label.yml: -------------------------------------------------------------------------------- 1 | name: Sponsor Label 2 | 3 | on: 4 | pull_request: 5 | types: [opened] 6 | 7 | issues: 8 | types: [opened] 9 | 10 | jobs: 11 | label: 12 | name: is-sponsor-label 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: JasonEtco/is-sponsor-label-action@39d88e461a53ecb1b3c0a13673e6252f9976f2f5 # v1 16 | env: 17 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 18 | with: 19 | label: sponsor 20 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: Sync labels 2 | 3 | permissions: 4 | issues: write 5 | pull-requests: write 6 | 7 | on: 8 | push: 9 | branches: 10 | - main 11 | paths: 12 | - .github/workflows/stale.yml 13 | 14 | schedule: 15 | # Checkout for updates daily at midnight 16 | - cron: '0 0 * * *' 17 | 18 | workflow_dispatch: 19 | 20 | concurrency: 21 | group: ${{ github.workflow }}-${{ github.ref }} 22 | cancel-in-progress: true 23 | 24 | jobs: 25 | stale: 26 | runs-on: ubuntu-20.04 27 | steps: 28 | - name: Sync Labels 29 | uses: actions/stale@1160a2240286f5da8ec72b1c0816ce2481aabf84 # v8 30 | env: 31 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 32 | with: 33 | stale-issue-message: | 34 | > **Warning** 35 | 36 | This issue is stale because it has been open for 60 days with no activity. 💤 37 | 38 | Either remove the `stale` label or leave a comment else this issue will be closed in 7 days. 39 | stale-pr-message: | 40 | > **Warning** 41 | 42 | This pull request is stale because it has been open for 60 days with no activity. 💤 43 | 44 | Either remove the `stale` label, leave a comment or push a commit else this pull request will be closed in 7 days. 45 | close-issue-message: 'This issue was closed because it has been stale for 67 days with no activity.' 46 | -------------------------------------------------------------------------------- /.github/workflows/welcome.yml: -------------------------------------------------------------------------------- 1 | name: Welcome 👋 2 | 3 | permissions: 4 | issues: write 5 | pull-requests: write 6 | 7 | on: 8 | pull_request: 9 | types: ['opened'] 10 | issues: 11 | types: ['opened'] 12 | 13 | jobs: 14 | welcome: 15 | runs-on: ubuntu-20.04 16 | steps: 17 | - name: 'Welcome 👋' 18 | uses: actions/first-interaction@1d8459ca65b335265f1285568221e229d45a995e # v1.1.1 19 | with: 20 | issue-message: | 21 | Welcome, ${{github.actor}}! 👋 22 | Thanks for submitting your first issue! :rocket: 23 | pr-message: | 24 | Welcome, ${{github.actor}}! :wave: 25 | Thanks for submitting your first pull request! :rocket: 26 | repo-token: ${{ secrets.GITHUB_TOKEN }} 27 | 28 | - name: Add label to first time contributoins 29 | uses: Code-Hex/first-label-interaction@68f71358707a913224afdbf8dc47764807345d4c # tag=v1.0.2 30 | with: 31 | github-token: ${{ secrets.GITHUB_TOKEN }} 32 | issue-labels: '["first time contribution"]' 33 | pr-labels: '["first time contribution"]' 34 | -------------------------------------------------------------------------------- /.husky/.gitignore: -------------------------------------------------------------------------------- 1 | _ 2 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | pnpm commitlint --edit $1 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | pnpm lint-staged 5 | -------------------------------------------------------------------------------- /.lintstagedrc.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | '*': () => ['nx-cloud record -- nx format:write'], 3 | '{nx,workspace}.json': () => ['nx-cloud record -- nx workspace-lint --fix'], 4 | '**/*.{js,jsx,ts,tsx}': () => ['nx affected --target=lint --fix'], 5 | '{examples,packages}/**/*.*': () => [ 6 | 'nx affected --target=build --parallel=2', 7 | 'nx affected --target=build --configuration=production --parallel=2', 8 | 'nx affected --target=test --parallel=2', 9 | ], 10 | }; 11 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | strict-peer-dependencies=false 2 | auto-install-peers=false 3 | 4 | use-node-version=18.15.0 5 | -------------------------------------------------------------------------------- /.npmrc-vercel: -------------------------------------------------------------------------------- 1 | strict-peer-dependencies=false 2 | auto-install-peers=false 3 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Add files here to ignore them from prettier formatting 2 | 3 | /coverage 4 | /dist 5 | pnpm-lock.yaml 6 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true 3 | } 4 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "nrwl.angular-console", 4 | "esbenp.prettier-vscode", 5 | "firsttris.vscode-jest-runner", 6 | "dbaeumer.vscode-eslint", 7 | "sonarsource.sonarlint-vscode" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "eslint.validate": ["json"], 3 | "sonarlint.connectedMode.project": { 4 | "connectionId": "domjtalbot", 5 | "projectKey": "domjtalbot_nx-mesh" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Dom Talbot 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /babel.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "babelrcRoots": ["*"] 3 | } 4 | -------------------------------------------------------------------------------- /examples/api-gateway-openapi--javascript-wiki-e2e/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["plugin:cypress/recommended", "../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /examples/api-gateway-openapi--javascript-wiki-e2e/cypress.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'cypress'; 2 | import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset'; 3 | 4 | export default defineConfig({ 5 | e2e: { 6 | ...nxE2EPreset(__dirname), 7 | /** 8 | * TODO(@nrwl/cypress): In Cypress v12,the testIsolation option is turned on by default. 9 | * This can cause tests to start breaking where not indended. 10 | * You should consider enabling this once you verify tests do not depend on each other 11 | * More Info: https://docs.cypress.io/guides/references/migration-guide#Test-Isolation 12 | **/ 13 | testIsolation: false, 14 | }, 15 | }); 16 | -------------------------------------------------------------------------------- /examples/api-gateway-openapi--javascript-wiki-e2e/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "examples-api-gateway-openapi--javascript-wiki-e2e", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "examples/api-gateway-openapi--javascript-wiki-e2e/src", 5 | "projectType": "application", 6 | "implicitDependencies": ["examples-api-gateway-openapi--javascript-wiki"], 7 | "targets": { 8 | "e2e": { 9 | "executor": "@nrwl/cypress:cypress", 10 | "options": { 11 | "cypressConfig": "examples/api-gateway-openapi--javascript-wiki-e2e/cypress.config.ts", 12 | "devServerTarget": "examples-api-gateway-openapi--javascript-wiki:serve", 13 | "testingType": "e2e" 14 | }, 15 | "configurations": { 16 | "production": { 17 | "devServerTarget": "examples-api-gateway-openapi--javascript-wiki:serve:production" 18 | } 19 | } 20 | }, 21 | "lint": { 22 | "executor": "@nrwl/linter:eslint", 23 | "outputs": ["{options.outputFile}"], 24 | "options": { 25 | "lintFilePatterns": [ 26 | "examples/api-gateway-openapi--javascript-wiki-e2e/**/*.{js,ts}" 27 | ] 28 | } 29 | } 30 | }, 31 | "tags": [] 32 | } 33 | -------------------------------------------------------------------------------- /examples/api-gateway-openapi--javascript-wiki-e2e/src/e2e/app.cy.ts: -------------------------------------------------------------------------------- 1 | describe('javascript-wiki', () => { 2 | it('should start a mesh server', () => { 3 | cy.request('/health').then((resp) => { 4 | expect(resp.status).to.eq(200); 5 | }); 6 | }); 7 | 8 | it('should still be running after 15 seconds', () => { 9 | cy.wait(1000 * 15) 10 | .request('/health') 11 | .then((resp) => { 12 | expect(resp.status).to.eq(200); 13 | }); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /examples/api-gateway-openapi--javascript-wiki-e2e/src/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Using fixtures to represent data", 3 | "email": "hello@cypress.io" 4 | } 5 | -------------------------------------------------------------------------------- /examples/api-gateway-openapi--javascript-wiki-e2e/src/support/app.po.ts: -------------------------------------------------------------------------------- 1 | export const getGreeting = () => cy.get('h1'); 2 | -------------------------------------------------------------------------------- /examples/api-gateway-openapi--javascript-wiki-e2e/src/support/commands.ts: -------------------------------------------------------------------------------- 1 | // *********************************************** 2 | // This example commands.js shows you how to 3 | // create various custom commands and overwrite 4 | // existing commands. 5 | // 6 | // For more comprehensive examples of custom 7 | // commands please read more here: 8 | // https://on.cypress.io/custom-commands 9 | // *********************************************** 10 | 11 | // eslint-disable-next-line @typescript-eslint/no-namespace 12 | declare namespace Cypress { 13 | // eslint-disable-next-line @typescript-eslint/no-unused-vars 14 | interface Chainable { 15 | login(email: string, password: string): void; 16 | } 17 | } 18 | // 19 | // -- This is a parent command -- 20 | Cypress.Commands.add('login', (email, password) => { 21 | console.log('Custom command example: Login', email, password); 22 | }); 23 | // 24 | // -- This is a child command -- 25 | // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) 26 | // 27 | // 28 | // -- This is a dual command -- 29 | // Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) 30 | // 31 | // 32 | // -- This will overwrite an existing command -- 33 | // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) 34 | -------------------------------------------------------------------------------- /examples/api-gateway-openapi--javascript-wiki-e2e/src/support/e2e.ts: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/index.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands'; 18 | -------------------------------------------------------------------------------- /examples/api-gateway-openapi--javascript-wiki-e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "sourceMap": false, 5 | "outDir": "../../dist/out-tsc", 6 | "allowJs": true, 7 | "types": ["cypress", "node"] 8 | }, 9 | "include": ["src/**/*.ts", "src/**/*.js"] 10 | } 11 | -------------------------------------------------------------------------------- /examples/api-gateway-openapi--javascript-wiki/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*", ".mesh"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /examples/api-gateway-openapi--javascript-wiki/.meshrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "sources": [ 3 | { 4 | "name": "JavaScript Wiki", 5 | "handler": { 6 | "openapi": { 7 | "source": "https://api.apis.guru/v2/specs/wikimedia.org/1.0.0/swagger.yaml" 8 | } 9 | } 10 | } 11 | ], 12 | "serve": { 13 | "browser": false 14 | }, 15 | "sdk": { 16 | "generateOperations": { 17 | "selectionSetDepth": 6 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /examples/api-gateway-openapi--javascript-wiki/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'examples-api-gateway-openapi--javascript-wiki', 4 | preset: '../../jest.preset.js', 5 | globals: { 6 | 'ts-jest': { 7 | tsconfig: '/tsconfig.spec.json', 8 | }, 9 | }, 10 | testEnvironment: 'node', 11 | transform: { 12 | '^.+\\.[tj]s$': 'ts-jest', 13 | }, 14 | moduleFileExtensions: ['ts', 'js', 'html'], 15 | coverageDirectory: 16 | '../../coverage/examples/api-gateway-openapi--javascript-wiki', 17 | }; 18 | -------------------------------------------------------------------------------- /examples/api-gateway-openapi--javascript-wiki/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "examples-api-gateway-openapi--javascript-wiki", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "application", 5 | "sourceRoot": "examples/api-gateway-openapi--javascript-wiki/", 6 | "implicitDependencies": ["nx-mesh"], 7 | "targets": { 8 | "build": { 9 | "executor": "nx-mesh:build-gateway", 10 | "outputs": ["{projectRoot}/.mesh", "{options.outputPath}"], 11 | "options": { 12 | "dir": "examples/api-gateway-openapi--javascript-wiki", 13 | "main": "examples/api-gateway-openapi--javascript-wiki/src/index.ts", 14 | "outputPath": "dist/examples/api-gateway-openapi--javascript-wiki", 15 | "tsConfig": "examples/api-gateway-openapi--javascript-wiki/tsconfig.lib.json" 16 | } 17 | }, 18 | "serve": { 19 | "executor": "nx-mesh:serve", 20 | "options": { 21 | "dev": true, 22 | "dir": "examples/api-gateway-openapi--javascript-wiki" 23 | } 24 | }, 25 | "validate": { 26 | "executor": "nx-mesh:validate", 27 | "options": { 28 | "dir": "examples/api-gateway-openapi--javascript-wiki" 29 | } 30 | }, 31 | "test": { 32 | "executor": "@nrwl/jest:jest", 33 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 34 | "options": { 35 | "jestConfig": "examples/api-gateway-openapi--javascript-wiki/jest.config.ts", 36 | "passWithNoTests": true 37 | } 38 | }, 39 | "lint": { 40 | "executor": "@nrwl/linter:eslint", 41 | "outputs": ["{options.outputFile}"], 42 | "options": { 43 | "lintFilePatterns": [ 44 | "examples/api-gateway-openapi--javascript-wiki/**/*.ts" 45 | ] 46 | } 47 | } 48 | }, 49 | "tags": ["type:api-gateway", "type:example"] 50 | } 51 | -------------------------------------------------------------------------------- /examples/api-gateway-openapi--javascript-wiki/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["node"] 7 | }, 8 | "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"], 9 | "include": ["**/*.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /examples/api-gateway-openapi--javascript-wiki/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.app.json" 8 | }, 9 | { 10 | "path": "./tsconfig.spec.json" 11 | } 12 | ], 13 | "compilerOptions": { 14 | "types": ["jest", "node"] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/api-gateway-openapi--javascript-wiki/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /examples/sdk-graphql--star-wars/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*", ".mesh"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /examples/sdk-graphql--star-wars/.meshrc.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | - name: StarWarsApi 3 | handler: 4 | graphql: 5 | endpoint: https://swapi-graphql.netlify.app/.netlify/functions/index 6 | 7 | serve: 8 | browser: false 9 | 10 | documents: 11 | - ./src/graphql/**/*.*.graphql 12 | -------------------------------------------------------------------------------- /examples/sdk-graphql--star-wars/.swcrc: -------------------------------------------------------------------------------- 1 | { 2 | "jsc": { 3 | "target": "es2017", 4 | "parser": { 5 | "syntax": "typescript", 6 | "decorators": true, 7 | "dynamicImport": true 8 | }, 9 | "transform": { 10 | "decoratorMetadata": true, 11 | "legacyDecorator": true 12 | }, 13 | "keepClassNames": true, 14 | "externalHelpers": true, 15 | "loose": true 16 | }, 17 | "module": { 18 | "type": "commonjs", 19 | "strict": true, 20 | "noInterop": true 21 | }, 22 | "sourceMaps": true, 23 | "exclude": [ 24 | "jest.config.ts", 25 | ".*.spec.tsx?$", 26 | ".*.test.tsx?$", 27 | "./src/jest-setup.ts$", 28 | "./**/jest-setup.ts$", 29 | ".*.js$" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /examples/sdk-graphql--star-wars/codegen.ts: -------------------------------------------------------------------------------- 1 | import type { CodegenConfig } from '@graphql-codegen/cli'; 2 | 3 | const config: CodegenConfig = { 4 | overwrite: true, 5 | schema: 'examples/sdk-graphql--star-wars/.mesh/schema.graphql', 6 | documents: 'examples/sdk-graphql--star-wars/src/graphql/**/*.*.graphql', 7 | generates: { 8 | 'examples/sdk-graphql--star-wars/.codegen/': { 9 | preset: 'client', 10 | plugins: [], 11 | }, 12 | }, 13 | }; 14 | 15 | export default config; 16 | -------------------------------------------------------------------------------- /examples/sdk-graphql--star-wars/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'examples-sdk-graphql--star-wars', 4 | preset: '../../jest.preset.js', 5 | testEnvironment: 'node', 6 | transform: { 7 | '^.+\\.[tj]sx?$': [ 8 | '@swc/jest', 9 | { jsc: { transform: { react: { runtime: 'automatic' } } } }, 10 | ], 11 | }, 12 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], 13 | coverageDirectory: '../../coverage/examples/sdk-graphql--star-wars', 14 | }; 15 | -------------------------------------------------------------------------------- /examples/sdk-graphql--star-wars/src/graphql/getMovies.query.graphql: -------------------------------------------------------------------------------- 1 | query getMovies { 2 | allFilms { 3 | films { 4 | title 5 | director 6 | releaseDate 7 | speciesConnection { 8 | species { 9 | name 10 | classification 11 | homeworld { 12 | name 13 | } 14 | } 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /examples/sdk-graphql--star-wars/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/sdk'; 2 | -------------------------------------------------------------------------------- /examples/sdk-graphql--star-wars/src/lib/client.ts: -------------------------------------------------------------------------------- 1 | export * from '../../.codegen'; 2 | -------------------------------------------------------------------------------- /examples/sdk-graphql--star-wars/src/lib/sdk.ts: -------------------------------------------------------------------------------- 1 | export { getMeshSDK } from '../../.mesh'; 2 | -------------------------------------------------------------------------------- /examples/sdk-graphql--star-wars/src/lib/server.ts: -------------------------------------------------------------------------------- 1 | export { createBuiltMeshHTTPHandler } from '../../.mesh'; 2 | -------------------------------------------------------------------------------- /examples/sdk-graphql--star-wars/src/lib/types.ts: -------------------------------------------------------------------------------- 1 | import type * as Types from '../../.mesh'; 2 | 3 | export { Types }; 4 | export default Types; 5 | -------------------------------------------------------------------------------- /examples/sdk-graphql--star-wars/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.lib.json" 8 | }, 9 | { 10 | "path": "./tsconfig.spec.json" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /examples/sdk-graphql--star-wars/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "outDir": "../../dist/out-tsc", 6 | "declaration": true, 7 | "types": ["node"] 8 | }, 9 | "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"], 10 | "include": ["**/*.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /examples/sdk-graphql--star-wars/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": [ 9 | "jest.config.ts", 10 | "**/*.test.ts", 11 | "**/*.spec.ts", 12 | "**/*.test.tsx", 13 | "**/*.spec.tsx", 14 | "**/*.test.js", 15 | "**/*.spec.js", 16 | "**/*.test.jsx", 17 | "**/*.spec.jsx", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /examples/sdk-json-schema--fake-api/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*", ".mesh"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /examples/sdk-json-schema--fake-api/.swcrc: -------------------------------------------------------------------------------- 1 | { 2 | "jsc": { 3 | "target": "es2017", 4 | "parser": { 5 | "syntax": "typescript", 6 | "decorators": true, 7 | "dynamicImport": true 8 | }, 9 | "transform": { 10 | "decoratorMetadata": true, 11 | "legacyDecorator": true 12 | }, 13 | "keepClassNames": true, 14 | "externalHelpers": true, 15 | "loose": true 16 | }, 17 | "module": { 18 | "type": "commonjs", 19 | "strict": true, 20 | "noInterop": true 21 | }, 22 | "sourceMaps": true, 23 | "exclude": [ 24 | "jest.config.ts", 25 | ".*.spec.tsx?$", 26 | ".*.test.tsx?$", 27 | "./src/jest-setup.ts$", 28 | "./**/jest-setup.ts$", 29 | ".*.js$" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /examples/sdk-json-schema--fake-api/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'examples-sdk-json-schema--fake-api', 4 | preset: '../../jest.preset.js', 5 | testEnvironment: 'node', 6 | transform: { 7 | '^.+\\.[tj]sx?$': [ 8 | '@swc/jest', 9 | { jsc: { transform: { react: { runtime: 'automatic' } } } }, 10 | ], 11 | }, 12 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], 13 | coverageDirectory: '../../coverage/examples/sdk-json-schema--fake-api', 14 | }; 15 | -------------------------------------------------------------------------------- /examples/sdk-json-schema--fake-api/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "examples-sdk-json-schema--fake-api", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "examples/sdk-json-schema--fake-api/src", 5 | "projectType": "library", 6 | "implicitDependencies": ["nx-mesh"], 7 | "targets": { 8 | "lint": { 9 | "executor": "@nrwl/linter:eslint", 10 | "outputs": ["{options.outputFile}"], 11 | "options": { 12 | "lintFilePatterns": ["examples/sdk-json-schema--fake-api/**/*.ts"] 13 | } 14 | }, 15 | "test": { 16 | "executor": "@nrwl/jest:jest", 17 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 18 | "options": { 19 | "jestConfig": "examples/sdk-json-schema--fake-api/jest.config.ts", 20 | "passWithNoTests": true 21 | } 22 | }, 23 | "build": { 24 | "executor": "nx-mesh:build-swc", 25 | "outputs": ["{projectRoot}/.mesh", "{options.outputPath}"], 26 | "options": { 27 | "dir": "examples/sdk-json-schema--fake-api", 28 | "main": "examples/sdk-json-schema--fake-api/src/index.ts", 29 | "outputPath": "dist/examples/sdk-json-schema--fake-api", 30 | "tsConfig": "examples/sdk-json-schema--fake-api/tsconfig.lib.json" 31 | } 32 | }, 33 | "serve": { 34 | "executor": "nx-mesh:serve", 35 | "options": { 36 | "dev": true, 37 | "dir": "examples/sdk-json-schema--fake-api" 38 | } 39 | }, 40 | "validate": { 41 | "executor": "nx-mesh:validate", 42 | "options": { 43 | "dir": "examples/sdk-json-schema--fake-api" 44 | } 45 | } 46 | }, 47 | "tags": ["type:example", "type:sdk"] 48 | } 49 | -------------------------------------------------------------------------------- /examples/sdk-json-schema--fake-api/src/graphql/getMe.query.graphql: -------------------------------------------------------------------------------- 1 | query getMe { 2 | me { 3 | firstName 4 | lastName 5 | jobTitle 6 | company { 7 | name 8 | type 9 | employers { 10 | firstName 11 | lastName 12 | jobTitle 13 | } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/sdk-json-schema--fake-api/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/sdk'; 2 | -------------------------------------------------------------------------------- /examples/sdk-json-schema--fake-api/src/json-samples/user-input.json: -------------------------------------------------------------------------------- 1 | { 2 | "firstName": "John", 3 | "lastName": "Doe", 4 | "jobTitle": "Software Developer" 5 | } 6 | -------------------------------------------------------------------------------- /examples/sdk-json-schema--fake-api/src/json-schemas/company.json: -------------------------------------------------------------------------------- 1 | { 2 | "definitions": { 3 | "Company": { 4 | "type": "object", 5 | "title": "Company", 6 | "description": "Fake Company", 7 | "properties": { 8 | "name": { 9 | "type": "string" 10 | }, 11 | "type": { 12 | "type": "object", 13 | "items": { 14 | "$ref": "#/definitions/CompanyType" 15 | } 16 | } 17 | } 18 | }, 19 | "CompanyType": { 20 | "type": "string", 21 | "title": "CompanyType", 22 | "enum": ["Public Limited", "Private Limited", "One Person"] 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /examples/sdk-json-schema--fake-api/src/json-schemas/user.json: -------------------------------------------------------------------------------- 1 | { 2 | "definitions": { 3 | "User": { 4 | "type": "object", 5 | "title": "User", 6 | "description": "Fake User Object", 7 | "properties": { 8 | "firstName": { 9 | "type": "string" 10 | }, 11 | "lastName": { 12 | "type": "string" 13 | }, 14 | "jobTitle": { 15 | "type": "string" 16 | }, 17 | "companyId": { 18 | "type": "string" 19 | }, 20 | "birthDate": { 21 | "type": "string", 22 | "example": "1993-12-20" 23 | }, 24 | "foos": { 25 | "type": "array", 26 | "items": { 27 | "$ref": "user.json#/definitions/Foo" 28 | } 29 | } 30 | } 31 | }, 32 | "Foo": { 33 | "type": "object", 34 | "properties": { 35 | "id": { 36 | "type": "string" 37 | } 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/sdk-json-schema--fake-api/src/lib/sdk.ts: -------------------------------------------------------------------------------- 1 | export { getMeshSDK } from '../../.mesh'; 2 | -------------------------------------------------------------------------------- /examples/sdk-json-schema--fake-api/src/lib/server.ts: -------------------------------------------------------------------------------- 1 | export { createBuiltMeshHTTPHandler } from '../../.mesh'; 2 | -------------------------------------------------------------------------------- /examples/sdk-json-schema--fake-api/src/lib/types.ts: -------------------------------------------------------------------------------- 1 | import type * as Types from '../../.mesh'; 2 | 3 | export { Types }; 4 | export default Types; 5 | -------------------------------------------------------------------------------- /examples/sdk-json-schema--fake-api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.lib.json" 8 | }, 9 | { 10 | "path": "./tsconfig.spec.json" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /examples/sdk-json-schema--fake-api/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "outDir": "../../dist/out-tsc", 6 | "declaration": true, 7 | "types": ["node"] 8 | }, 9 | "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"], 10 | "include": ["**/*.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /examples/sdk-json-schema--fake-api/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": [ 9 | "jest.config.ts", 10 | "**/*.test.ts", 11 | "**/*.spec.ts", 12 | "**/*.test.tsx", 13 | "**/*.spec.tsx", 14 | "**/*.test.js", 15 | "**/*.spec.js", 16 | "**/*.test.jsx", 17 | "**/*.spec.jsx", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /examples/sdk-mysql--rfam/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*", ".mesh"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /examples/sdk-mysql--rfam/.meshrc.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | - name: Rfam 3 | handler: 4 | mysql: 5 | database: Rfam 6 | host: mysql-rfam-public.ebi.ac.uk 7 | port: 4497 8 | user: rfamro 9 | 10 | documents: 11 | - ./src/graphql/**/*.*.graphql 12 | 13 | serve: 14 | playground: false 15 | -------------------------------------------------------------------------------- /examples/sdk-mysql--rfam/.swcrc: -------------------------------------------------------------------------------- 1 | { 2 | "jsc": { 3 | "target": "es2017", 4 | "parser": { 5 | "syntax": "typescript", 6 | "decorators": true, 7 | "dynamicImport": true 8 | }, 9 | "transform": { 10 | "decoratorMetadata": true, 11 | "legacyDecorator": true 12 | }, 13 | "keepClassNames": true, 14 | "externalHelpers": true, 15 | "loose": true 16 | }, 17 | "module": { 18 | "type": "commonjs", 19 | "strict": true, 20 | "noInterop": true 21 | }, 22 | "sourceMaps": true, 23 | "exclude": [ 24 | "jest.config.ts", 25 | ".*.spec.tsx?$", 26 | ".*.test.tsx?$", 27 | "./src/jest-setup.ts$", 28 | "./**/jest-setup.ts$", 29 | ".*.js$" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /examples/sdk-mysql--rfam/codegen.ts: -------------------------------------------------------------------------------- 1 | import type { CodegenConfig } from '@graphql-codegen/cli'; 2 | 3 | const config: CodegenConfig = { 4 | overwrite: true, 5 | schema: 'examples/sdk-mysql--rfam/.mesh/schema.graphql', 6 | documents: 'examples/sdk-mysql--rfam/src/graphql/**/*.*.graphql', 7 | generates: { 8 | 'examples/sdk-mysql--rfam/.codegen/': { 9 | preset: 'client', 10 | plugins: [], 11 | config: { 12 | enumsAsTypes: true, 13 | }, 14 | }, 15 | }, 16 | }; 17 | 18 | export default config; 19 | -------------------------------------------------------------------------------- /examples/sdk-mysql--rfam/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'examples-sdk-mysql-rfam', 4 | preset: '../../jest.preset.js', 5 | testEnvironment: 'node', 6 | transform: { 7 | '^.+\\.[tj]sx?$': [ 8 | '@swc/jest', 9 | { jsc: { transform: { react: { runtime: 'automatic' } } } }, 10 | ], 11 | }, 12 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], 13 | coverageDirectory: '../../coverage/examples/sdk-mysql--rfam', 14 | }; 15 | -------------------------------------------------------------------------------- /examples/sdk-mysql--rfam/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "examples-sdk-mysql--rfam", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "examples/sdk-mysql--rfam/src", 5 | "projectType": "library", 6 | "implicitDependencies": ["nx-mesh"], 7 | "targets": { 8 | "lint": { 9 | "executor": "@nrwl/linter:eslint", 10 | "outputs": ["{options.outputFile}"], 11 | "options": { 12 | "lintFilePatterns": ["examples/sdk-mysql--rfam/**/*.ts"] 13 | } 14 | }, 15 | "test": { 16 | "executor": "@nrwl/jest:jest", 17 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 18 | "options": { 19 | "jestConfig": "examples/sdk-mysql--rfam/jest.config.ts", 20 | "passWithNoTests": true 21 | } 22 | }, 23 | "build": { 24 | "executor": "nx-mesh:build-swc", 25 | "outputs": ["{projectRoot}/.mesh", "{options.outputPath}"], 26 | "options": { 27 | "dir": "examples/sdk-mysql--rfam", 28 | "main": "examples/sdk-mysql--rfam/src/index.ts", 29 | "outputPath": "dist/examples/sdk-mysql--rfam", 30 | "tsConfig": "examples/sdk-mysql--rfam/tsconfig.lib.json", 31 | "codegen": { 32 | "config": "examples/sdk-mysql--rfam/codegen.ts" 33 | } 34 | } 35 | }, 36 | "serve": { 37 | "executor": "nx-mesh:serve", 38 | "options": { 39 | "dev": true, 40 | "dir": "examples/sdk-mysql--rfam" 41 | } 42 | }, 43 | "validate": { 44 | "executor": "nx-mesh:validate", 45 | "options": { 46 | "dir": "examples/sdk-mysql--rfam" 47 | } 48 | } 49 | }, 50 | "tags": ["type:example", "type:sdk"] 51 | } 52 | -------------------------------------------------------------------------------- /examples/sdk-mysql--rfam/src/graphql/getAlignmentTree.query.graphql: -------------------------------------------------------------------------------- 1 | query getAlignmentTree { 2 | alignment_and_tree(limit: 5) { 3 | rfam_acc 4 | family(limit: 1) { 5 | type 6 | description 7 | comment 8 | author 9 | created 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/sdk-mysql--rfam/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/sdk'; 2 | -------------------------------------------------------------------------------- /examples/sdk-mysql--rfam/src/lib/client.ts: -------------------------------------------------------------------------------- 1 | export * from '../../.codegen'; 2 | -------------------------------------------------------------------------------- /examples/sdk-mysql--rfam/src/lib/sdk.ts: -------------------------------------------------------------------------------- 1 | export { getMeshSDK } from '../../.mesh'; 2 | -------------------------------------------------------------------------------- /examples/sdk-mysql--rfam/src/lib/server.ts: -------------------------------------------------------------------------------- 1 | export { createBuiltMeshHTTPHandler } from '../../.mesh'; 2 | -------------------------------------------------------------------------------- /examples/sdk-mysql--rfam/src/lib/types.ts: -------------------------------------------------------------------------------- 1 | import type * as Types from '../../.mesh'; 2 | 3 | export { Types }; 4 | export default Types; 5 | -------------------------------------------------------------------------------- /examples/sdk-mysql--rfam/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.lib.json" 8 | }, 9 | { 10 | "path": "./tsconfig.spec.json" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /examples/sdk-mysql--rfam/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "outDir": "../../dist/out-tsc", 6 | "declaration": true, 7 | "types": ["node"] 8 | }, 9 | "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"], 10 | "include": ["**/*.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /examples/sdk-mysql--rfam/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": [ 9 | "jest.config.ts", 10 | "**/*.test.ts", 11 | "**/*.spec.ts", 12 | "**/*.test.tsx", 13 | "**/*.spec.tsx", 14 | "**/*.test.js", 15 | "**/*.spec.js", 16 | "**/*.test.jsx", 17 | "**/*.spec.jsx", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /examples/sdk-neo4j--movies/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*", ".mesh"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /examples/sdk-neo4j--movies/.meshrc.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | - name: Movies 3 | handler: 4 | neo4j: 5 | database: movies 6 | password: movies 7 | url: bolt+s://demo.neo4jlabs.com:7687 8 | username: movies 9 | 10 | documents: 11 | - ./src/graphql/**/*.*.graphql 12 | 13 | serve: 14 | playground: false 15 | -------------------------------------------------------------------------------- /examples/sdk-neo4j--movies/.swcrc: -------------------------------------------------------------------------------- 1 | { 2 | "jsc": { 3 | "target": "es2017", 4 | "parser": { 5 | "syntax": "typescript", 6 | "decorators": true, 7 | "dynamicImport": true 8 | }, 9 | "transform": { 10 | "decoratorMetadata": true, 11 | "legacyDecorator": true 12 | }, 13 | "keepClassNames": true, 14 | "externalHelpers": true, 15 | "loose": true 16 | }, 17 | "module": { 18 | "type": "commonjs", 19 | "strict": true, 20 | "noInterop": true 21 | }, 22 | "sourceMaps": true, 23 | "exclude": [ 24 | "jest.config.ts", 25 | ".*.spec.tsx?$", 26 | ".*.test.tsx?$", 27 | "./src/jest-setup.ts$", 28 | "./**/jest-setup.ts$", 29 | ".*.js$" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /examples/sdk-neo4j--movies/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'examples-sdk-neo4j-movies', 4 | preset: '../../jest.preset.js', 5 | testEnvironment: 'node', 6 | transform: { 7 | '^.+\\.[tj]sx?$': [ 8 | '@swc/jest', 9 | { jsc: { transform: { react: { runtime: 'automatic' } } } }, 10 | ], 11 | }, 12 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], 13 | coverageDirectory: '../../coverage/examples/sdk-neo4j--movies', 14 | }; 15 | -------------------------------------------------------------------------------- /examples/sdk-neo4j--movies/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "examples-sdk-neo4j--movies", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "examples/sdk-neo4j--movies/src", 5 | "projectType": "library", 6 | "implicitDependencies": ["nx-mesh"], 7 | "targets": { 8 | "lint": { 9 | "executor": "@nrwl/linter:eslint", 10 | "outputs": ["{options.outputFile}"], 11 | "options": { 12 | "lintFilePatterns": ["examples/sdk-neo4j--movies/**/*.ts"] 13 | } 14 | }, 15 | "test": { 16 | "executor": "@nrwl/jest:jest", 17 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 18 | "options": { 19 | "jestConfig": "examples/sdk-neo4j--movies/jest.config.ts", 20 | "passWithNoTests": true 21 | } 22 | }, 23 | "disabled-build": { 24 | "executor": "nx-mesh:build-swc", 25 | "outputs": ["{projectRoot}/.mesh", "{options.outputPath}"], 26 | "options": { 27 | "dir": "examples/sdk-neo4j--movies", 28 | "main": "examples/sdk-neo4j--movies/src/index.ts", 29 | "outputPath": "dist/examples/sdk-neo4j--movies", 30 | "tsConfig": "examples/sdk-neo4j--movies/tsconfig.lib.json" 31 | } 32 | }, 33 | "disabled-serve": { 34 | "executor": "nx-mesh:serve", 35 | "options": { 36 | "dev": true, 37 | "dir": "examples/sdk-neo4j--movies" 38 | } 39 | }, 40 | "disabled-validate": { 41 | "executor": "nx-mesh:validate", 42 | "options": { 43 | "dir": "examples/sdk-neo4j--movies" 44 | } 45 | } 46 | }, 47 | "tags": ["type:sdk", "type:example"] 48 | } 49 | -------------------------------------------------------------------------------- /examples/sdk-neo4j--movies/src/graphql/example.query.graphql: -------------------------------------------------------------------------------- 1 | query MovieWithActedIn { 2 | movies(options: { limit: 2 }) { 3 | title 4 | released 5 | tagline 6 | peopleActedIn(options: { limit: 2 }) { 7 | name 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/sdk-neo4j--movies/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/sdk'; 2 | -------------------------------------------------------------------------------- /examples/sdk-neo4j--movies/src/lib/sdk.ts: -------------------------------------------------------------------------------- 1 | export { getMeshSDK } from '../../.mesh'; 2 | -------------------------------------------------------------------------------- /examples/sdk-neo4j--movies/src/lib/server.ts: -------------------------------------------------------------------------------- 1 | export { createBuiltMeshHTTPHandler } from '../../.mesh'; 2 | -------------------------------------------------------------------------------- /examples/sdk-neo4j--movies/src/lib/types.ts: -------------------------------------------------------------------------------- 1 | import type * as Types from '../../.mesh'; 2 | 3 | export { Types }; 4 | export default Types; 5 | -------------------------------------------------------------------------------- /examples/sdk-neo4j--movies/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.lib.json" 8 | }, 9 | { 10 | "path": "./tsconfig.spec.json" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /examples/sdk-neo4j--movies/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "outDir": "../../dist/out-tsc", 6 | "declaration": true, 7 | "types": ["node"] 8 | }, 9 | "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"], 10 | "include": ["**/*.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /examples/sdk-neo4j--movies/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": [ 9 | "jest.config.ts", 10 | "**/*.test.ts", 11 | "**/*.spec.ts", 12 | "**/*.test.tsx", 13 | "**/*.spec.tsx", 14 | "**/*.test.js", 15 | "**/*.spec.js", 16 | "**/*.test.jsx", 17 | "**/*.spec.jsx", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /examples/sdk-nextjs-e2e/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["plugin:cypress/recommended", "../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /examples/sdk-nextjs-e2e/cypress.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'cypress'; 2 | import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset'; 3 | 4 | export default defineConfig({ 5 | e2e: { 6 | ...nxE2EPreset(__dirname), 7 | /** 8 | * TODO(@nrwl/cypress): In Cypress v12,the testIsolation option is turned on by default. 9 | * This can cause tests to start breaking where not indended. 10 | * You should consider enabling this once you verify tests do not depend on each other 11 | * More Info: https://docs.cypress.io/guides/references/migration-guide#Test-Isolation 12 | **/ 13 | testIsolation: false, 14 | }, 15 | }); 16 | -------------------------------------------------------------------------------- /examples/sdk-nextjs-e2e/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "examples-sdk-nextjs-e2e", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "examples/sdk-nextjs-e2e/src", 5 | "projectType": "application", 6 | "targets": { 7 | "e2e": { 8 | "executor": "@nrwl/cypress:cypress", 9 | "options": { 10 | "cypressConfig": "examples/sdk-nextjs-e2e/cypress.config.ts", 11 | "devServerTarget": "examples-sdk-nextjs:serve:development", 12 | "testingType": "e2e" 13 | }, 14 | "configurations": { 15 | "production": { 16 | "devServerTarget": "examples-sdk-nextjs:serve:production" 17 | } 18 | } 19 | }, 20 | "lint": { 21 | "executor": "@nrwl/linter:eslint", 22 | "outputs": ["{options.outputFile}"], 23 | "options": { 24 | "lintFilePatterns": ["examples/sdk-nextjs-e2e/**/*.{js,ts}"] 25 | } 26 | } 27 | }, 28 | "tags": [], 29 | "implicitDependencies": ["examples-sdk-nextjs"] 30 | } 31 | -------------------------------------------------------------------------------- /examples/sdk-nextjs-e2e/src/e2e/sources/odata/trippin.cy.ts: -------------------------------------------------------------------------------- 1 | describe('odata/trippin', () => { 2 | beforeEach(() => cy.visit('/sources/odata/trippin')); 3 | 4 | it('should display airports', () => { 5 | cy.get('[data-airport]').should('have.length.greaterThan', 0); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /examples/sdk-nextjs-e2e/src/e2e/sources/openapi/javascript-wiki.cy.ts: -------------------------------------------------------------------------------- 1 | describe('openapi/javascript-wiki', () => { 2 | beforeEach(() => cy.visit('/sources/openapi/javascript-wiki')); 3 | 4 | it('should display wiki data', () => { 5 | cy.get('[data-wiki]').should('have.length.greaterThan', 0); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /examples/sdk-nextjs-e2e/src/e2e/sources/soap/country-info.cy.ts: -------------------------------------------------------------------------------- 1 | describe('soap/country-info', () => { 2 | beforeEach(() => cy.visit('/sources/soap/country-info')); 3 | 4 | it('should display daily forecast', () => { 5 | cy.get('[data-language]').should('have.length.greaterThan', 0); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /examples/sdk-nextjs-e2e/src/support/app.po.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domjtalbot/nx-mesh/397cc741550cc552c6b24cc71aceed60093a1339/examples/sdk-nextjs-e2e/src/support/app.po.ts -------------------------------------------------------------------------------- /examples/sdk-nextjs-e2e/src/support/commands.ts: -------------------------------------------------------------------------------- 1 | // *********************************************** 2 | // This example commands.js shows you how to 3 | // create various custom commands and overwrite 4 | // existing commands. 5 | // 6 | // For more comprehensive examples of custom 7 | // commands please read more here: 8 | // https://on.cypress.io/custom-commands 9 | // *********************************************** 10 | 11 | // eslint-disable-next-line @typescript-eslint/no-namespace 12 | declare namespace Cypress { 13 | // eslint-disable-next-line @typescript-eslint/no-unused-vars 14 | // interface Chainable {} 15 | } 16 | -------------------------------------------------------------------------------- /examples/sdk-nextjs-e2e/src/support/e2e.ts: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/index.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands'; 18 | -------------------------------------------------------------------------------- /examples/sdk-nextjs-e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "sourceMap": false, 5 | "outDir": "../../dist/out-tsc", 6 | "allowJs": true, 7 | "types": ["cypress", "node"] 8 | }, 9 | "include": ["src/**/*.ts", "src/**/*.js", "cypress.config.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "plugin:@nrwl/nx/react-typescript", 4 | "next", 5 | "next/core-web-vitals", 6 | "../../.eslintrc.json" 7 | ], 8 | "ignorePatterns": ["!**/*", ".next/**/*"], 9 | "overrides": [ 10 | { 11 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 12 | "rules": { 13 | "@next/next/no-html-link-for-pages": [ 14 | "error", 15 | "examples/sdk-nextjs/pages" 16 | ] 17 | } 18 | }, 19 | { 20 | "files": ["*.ts", "*.tsx"], 21 | "rules": {} 22 | }, 23 | { 24 | "files": ["*.js", "*.jsx"], 25 | "rules": {} 26 | } 27 | ], 28 | "rules": { 29 | "@next/next/no-html-link-for-pages": "off" 30 | }, 31 | "env": { 32 | "jest": true 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/index.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | declare module '*.svg' { 3 | const content: any; 4 | export const ReactComponent: any; 5 | export default content; 6 | } 7 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'examples-sdk-nextjs', 4 | preset: '../../jest.preset.js', 5 | transform: { 6 | '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest', 7 | '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nrwl/next/babel'] }], 8 | }, 9 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], 10 | coverageDirectory: '../../coverage/examples/sdk-nextjs', 11 | }; 12 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/next.config.js: -------------------------------------------------------------------------------- 1 | //@ts-check 2 | 3 | // eslint-disable-next-line @typescript-eslint/no-var-requires 4 | const { withNx } = require('@nrwl/next/plugins/with-nx'); 5 | 6 | /** 7 | * @type {import('@nrwl/next/plugins/with-nx').WithNxOptions} 8 | **/ 9 | const nextConfig = { 10 | nx: { 11 | // Set this to true if you would like to to use SVGR 12 | // See: https://github.com/gregberge/svgr 13 | svgr: false, 14 | }, 15 | }; 16 | 17 | module.exports = withNx(nextConfig); 18 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import type { AppProps } from 'next/app'; 2 | 3 | interface LayoutProps { 4 | children: React.ReactNode; 5 | } 6 | 7 | const Layout = ({ children }: LayoutProps) => ( 8 |
{children}
9 | ); 10 | 11 | export default function App({ Component, pageProps }: AppProps) { 12 | return ( 13 | 14 | 15 | 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/pages/_document.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable react/display-name */ 2 | import Document, { 3 | Html, 4 | Head, 5 | Main, 6 | NextScript, 7 | DocumentContext, 8 | DocumentInitialProps, 9 | } from 'next/document'; 10 | import { ServerStyleSheet } from 'styled-components'; 11 | 12 | export default class CustomDocument extends Document { 13 | static async getInitialProps( 14 | ctx: DocumentContext 15 | ): Promise { 16 | const originalRenderPage = ctx.renderPage; 17 | 18 | const sheet = new ServerStyleSheet(); 19 | 20 | ctx.renderPage = () => 21 | originalRenderPage({ 22 | enhanceApp: (App) => (props) => sheet.collectStyles(), 23 | enhanceComponent: (Component) => Component, 24 | }); 25 | 26 | const intialProps = await Document.getInitialProps(ctx); 27 | const styles = sheet.getStyleElement(); 28 | 29 | return { ...intialProps, styles }; 30 | } 31 | 32 | render() { 33 | return ( 34 | 35 | {this.props.styles} 36 | 37 |
38 | 39 | 40 | 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import Link from 'next/link'; 2 | import styled from 'styled-components'; 3 | 4 | const StyledPage = styled.div` 5 | .page { 6 | } 7 | `; 8 | 9 | export function Index() { 10 | return ( 11 | 12 |

Nx Mesh Examples

13 | 28 |
29 | ); 30 | } 31 | 32 | export default Index; 33 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/pages/sources/odata/trippin.tsx: -------------------------------------------------------------------------------- 1 | import type { GetStaticProps, NextPage } from 'next'; 2 | import type { Trippin } from '@nx-mesh/examples-sdk-odata--trippin'; 3 | 4 | type PageData = Trippin.getAirportsQuery; 5 | 6 | export const getStaticProps: GetStaticProps = async () => { 7 | const { getMeshSDK } = await import( 8 | '@nx-mesh/examples-sdk-odata--trippin/sdk' 9 | ); 10 | 11 | const data = await getMeshSDK().getAirports(); 12 | 13 | return { 14 | props: data, 15 | revalidate: 60 * 60 * 24 * 31, // 1 month 16 | }; 17 | }; 18 | 19 | export const TrippinRoute: NextPage = (props) => { 20 | return ( 21 | <> 22 |

TripPin

23 |
    24 | {props.Airports?.map(({ Name, Location }) => ( 25 |
  • 26 | {Name} - {Location.City?.Name}, {Location.City?.Region},{' '} 27 | {Location.City?.CountryRegion} 28 |
  • 29 | ))} 30 |
31 | 32 | ); 33 | }; 34 | 35 | export default TrippinRoute; 36 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/pages/sources/openapi/javascript-wiki.tsx: -------------------------------------------------------------------------------- 1 | import type { GetStaticProps, NextPage } from 'next'; 2 | import type { JavascriptWiki } from '@nx-mesh/examples-sdk-openapi--javascript-wiki'; 3 | 4 | import { isAvailability } from '@nx-mesh/examples-sdk-openapi--javascript-wiki/utils'; 5 | 6 | type PageData = JavascriptWiki.feed_availability_queryQuery; 7 | 8 | export const getStaticProps: GetStaticProps = async () => { 9 | const { getMeshSDK } = await import( 10 | '@nx-mesh/examples-sdk-openapi--javascript-wiki/sdk' 11 | ); 12 | 13 | const data = await getMeshSDK().feed_availability_query(); 14 | 15 | return { 16 | props: data, 17 | revalidate: 60 * 60 * 24 * 31, // 1 month 18 | }; 19 | }; 20 | 21 | export const JavascriptWikiRoute: NextPage = (props) => { 22 | const inTheNews = isAvailability(props.feed_availability) 23 | ? props.feed_availability?.in_the_news 24 | : undefined; 25 | 26 | return ( 27 | <> 28 |

JavaScript Wiki

29 |
    30 | {inTheNews?.map((wiki) => ( 31 |
  • 32 | {wiki} 33 |
  • 34 | ))} 35 |
36 | 37 | ); 38 | }; 39 | 40 | export default JavascriptWikiRoute; 41 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/pages/sources/soap/country-info.tsx: -------------------------------------------------------------------------------- 1 | import type { GetStaticProps, NextPage } from 'next'; 2 | import { CountryInfo } from '@nx-mesh/examples-sdk-soap--country-info'; 3 | 4 | type PageData = CountryInfo.GetLanguagesQuery | undefined; 5 | 6 | export const getStaticProps: GetStaticProps = async () => { 7 | const { getMeshSDK } = await import( 8 | '@nx-mesh/examples-sdk-soap--country-info/sdk' 9 | ); 10 | 11 | const data = await getMeshSDK().GetLanguages(); 12 | 13 | return { 14 | props: data, 15 | revalidate: 2, // 60 * 60 * 24 * 31, // 1 month 16 | }; 17 | }; 18 | 19 | export const CountryInfoRoute: NextPage = (props) => { 20 | return ( 21 |
22 |
23 |

Languages

24 |
25 | 26 |
    27 | {props.CountryInfoService_CountryInfoService_CountryInfoServiceSoap_ListOfLanguagesByName?.ListOfLanguagesByNameResult.tLanguage.map( 28 | (item) => ( 29 |
  • 30 | {item?.sName} 31 |
  • 32 | ) 33 | )} 34 |
35 |
36 | ); 37 | }; 38 | 39 | export default CountryInfoRoute; 40 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/public/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domjtalbot/nx-mesh/397cc741550cc552c6b24cc71aceed60093a1339/examples/sdk-nextjs/public/.gitkeep -------------------------------------------------------------------------------- /examples/sdk-nextjs/specs/index.spec.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import Index from '../pages/sources/soap/country-info'; 5 | 6 | describe('Index', () => { 7 | it('should render successfully', () => { 8 | const { baseElement } = render(); 9 | expect(baseElement).toBeTruthy(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/specs/sources/odata/trippin.json: -------------------------------------------------------------------------------- 1 | { 2 | "Airports": [ 3 | { 4 | "Name": "San Francisco International Airport", 5 | "Location": { 6 | "Address": "South McDonnell Road, San Francisco, CA 94128", 7 | "City": { 8 | "Name": "San Francisco", 9 | "Region": "California", 10 | "CountryRegion": "United States" 11 | } 12 | } 13 | }, 14 | { 15 | "Name": "Los Angeles International Airport", 16 | "Location": { 17 | "Address": "1 World Way, Los Angeles, CA, 90045", 18 | "City": { 19 | "Name": "Los Angeles", 20 | "Region": "California", 21 | "CountryRegion": "United States" 22 | } 23 | } 24 | }, 25 | { 26 | "Name": "Shanghai Hongqiao International Airport", 27 | "Location": { 28 | "Address": "Hongqiao Road 2550, Changning District", 29 | "City": { 30 | "Name": "Shanghai", 31 | "Region": "Shanghai", 32 | "CountryRegion": "China" 33 | } 34 | } 35 | }, 36 | { 37 | "Name": "Beijing Capital International Airport", 38 | "Location": { 39 | "Address": "Airport Road, Chaoyang District, Beijing, 100621", 40 | "City": { 41 | "Name": "Beijing", 42 | "Region": "Beijing", 43 | "CountryRegion": "China" 44 | } 45 | } 46 | }, 47 | { 48 | "Name": "John F. Kennedy International Airport", 49 | "Location": { 50 | "Address": "Jamaica, New York, NY 11430", 51 | "City": { 52 | "Name": "New York City", 53 | "Region": "New York", 54 | "CountryRegion": "United States" 55 | } 56 | } 57 | } 58 | ] 59 | } 60 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/specs/sources/odata/trippin.spec.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import { TrippinRoute } from '../../../pages/sources/odata/trippin'; 5 | 6 | import exampleData from './trippin.json'; 7 | 8 | describe('CountryIfno', () => { 9 | it('should render successfully', () => { 10 | const { baseElement } = render(); 11 | 12 | expect(baseElement).toBeTruthy(); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/specs/sources/openapi/javascript-wiki.json: -------------------------------------------------------------------------------- 1 | { 2 | "feed_availability": { 3 | "in_the_news": [ 4 | "test.wikipedia.org", 5 | "bs.wikipedia.org", 6 | "da.wikipedia.org", 7 | "de.wikipedia.org", 8 | "el.wikipedia.org", 9 | "en.wikipedia.org", 10 | "es.wikipedia.org", 11 | "fi.wikipedia.org", 12 | "fr.wikipedia.org", 13 | "he.wikipedia.org", 14 | "ko.wikipedia.org", 15 | "no.wikipedia.org", 16 | "pl.wikipedia.org", 17 | "pt.wikipedia.org", 18 | "ru.wikipedia.org", 19 | "sco.wikipedia.org", 20 | "sv.wikipedia.org", 21 | "vi.wikipedia.org" 22 | ], 23 | "todays_featured_article": [ 24 | "bg.wikipedia.org", 25 | "bn.wikipedia.org", 26 | "bs.wikipedia.org", 27 | "cs.wikipedia.org", 28 | "de.wikipedia.org", 29 | "el.wikipedia.org", 30 | "en.wikipedia.org", 31 | "fa.wikipedia.org", 32 | "he.wikipedia.org", 33 | "hu.wikipedia.org", 34 | "it.wikipedia.org", 35 | "ja.wikipedia.org", 36 | "la.wikipedia.org", 37 | "no.wikipedia.org", 38 | "sco.wikipedia.org", 39 | "sd.wikipedia.org", 40 | "sv.wikipedia.org", 41 | "tr.wikipedia.org", 42 | "ur.wikipedia.org", 43 | "vi.wikipedia.org", 44 | "zh.wikipedia.org" 45 | ], 46 | "picture_of_the_day": ["*.wikipedia.org"], 47 | "on_this_day": [ 48 | "en.wikipedia.org", 49 | "de.wikipedia.org", 50 | "fr.wikipedia.org", 51 | "sv.wikipedia.org", 52 | "pt.wikipedia.org", 53 | "ru.wikipedia.org", 54 | "es.wikipedia.org", 55 | "ar.wikipedia.org", 56 | "bs.wikipedia.org", 57 | "uk.wikipedia.org", 58 | "it.wikipedia.org", 59 | "tr.wikipedia.org" 60 | ], 61 | "most_read": ["*.wikipedia.org"] 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/specs/sources/openapi/javascript-wiki.spec.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import { JavascriptWikiRoute } from '../../../pages/sources/openapi/javascript-wiki'; 5 | 6 | import exampleData from './javascript-wiki.json'; 7 | 8 | describe('CountryIfno', () => { 9 | it('should render successfully', () => { 10 | const { baseElement } = render(); 11 | 12 | expect(baseElement).toBeTruthy(); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/specs/sources/soap/country-info.spec.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | 4 | import { CountryInfoRoute } from '../../../pages/sources/soap/country-info'; 5 | 6 | import exampleData from './country-info.json'; 7 | 8 | describe('CountryIfno', () => { 9 | it('should render successfully', () => { 10 | const { baseElement } = render(); 11 | 12 | expect(baseElement).toBeTruthy(); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "jsx": "preserve", 5 | "allowJs": true, 6 | "esModuleInterop": true, 7 | "allowSyntheticDefaultImports": true, 8 | "strict": false, 9 | "forceConsistentCasingInFileNames": true, 10 | "noEmit": true, 11 | "resolveJsonModule": true, 12 | "isolatedModules": true, 13 | "incremental": true, 14 | "types": ["jest", "node"] 15 | }, 16 | "include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "next-env.d.ts"], 17 | "exclude": ["node_modules", "jest.config.ts"] 18 | } 19 | -------------------------------------------------------------------------------- /examples/sdk-nextjs/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "jsx": "react" 8 | }, 9 | "include": [ 10 | "jest.config.ts", 11 | "**/*.test.ts", 12 | "**/*.spec.ts", 13 | "**/*.test.tsx", 14 | "**/*.spec.tsx", 15 | "**/*.test.js", 16 | "**/*.spec.js", 17 | "**/*.test.jsx", 18 | "**/*.spec.jsx", 19 | "**/*.d.ts" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /examples/sdk-odata--trippin/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "@nrwl/js/babel", 5 | { 6 | "useBuiltIns": "usage" 7 | } 8 | ] 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /examples/sdk-odata--trippin/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*", ".mesh"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /examples/sdk-odata--trippin/.meshrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | sources: [ 3 | { 4 | name: 'Trippin', 5 | handler: { 6 | odata: { 7 | endpoint: 8 | 'https://services.odata.org/TripPinRESTierService/(S({env.NX__TRIPPIN__API_KEY}))/', 9 | batch: 'multipart', 10 | expandNavProps: true, 11 | }, 12 | }, 13 | }, 14 | ], 15 | serve: { 16 | browser: false, 17 | }, 18 | documents: ['./src/graphql/**/*.*.graphql'], 19 | }; 20 | -------------------------------------------------------------------------------- /examples/sdk-odata--trippin/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'examples-sdk-odata-trippin', 4 | preset: '../../jest.preset.js', 5 | globals: { 6 | 'ts-jest': { 7 | tsconfig: '/tsconfig.spec.json', 8 | }, 9 | }, 10 | testEnvironment: 'node', 11 | transform: { 12 | '^.+\\.[tj]sx?$': 'ts-jest', 13 | }, 14 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], 15 | coverageDirectory: '../../coverage/examples/sdk-odata--trippin', 16 | }; 17 | -------------------------------------------------------------------------------- /examples/sdk-odata--trippin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "exports": { 3 | "./sdk": "./src/lib/sdk", 4 | "./server": "./src/lib/server", 5 | "./types": "./src/lib/types" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/sdk-odata--trippin/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "examples-sdk-odata--trippin", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "examples/sdk-odata--trippin/src", 5 | "projectType": "library", 6 | "implicitDependencies": ["nx-mesh"], 7 | "targets": { 8 | "lint": { 9 | "executor": "@nrwl/linter:eslint", 10 | "outputs": ["{options.outputFile}"], 11 | "options": { 12 | "lintFilePatterns": ["examples/sdk-odata--trippin/**/*.ts"] 13 | } 14 | }, 15 | "test": { 16 | "executor": "@nrwl/jest:jest", 17 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 18 | "options": { 19 | "jestConfig": "examples/sdk-odata--trippin/jest.config.ts", 20 | "passWithNoTests": true 21 | } 22 | }, 23 | "build": { 24 | "executor": "nx-mesh:build", 25 | "outputs": ["{projectRoot}/.mesh", "{options.outputPath}"], 26 | "options": { 27 | "dir": "examples/sdk-odata--trippin", 28 | "main": "examples/sdk-odata--trippin/src/index.ts", 29 | "outputPath": "dist/examples/sdk-odata--trippin", 30 | "tsConfig": "examples/sdk-odata--trippin/tsconfig.lib.json" 31 | } 32 | }, 33 | "serve": { 34 | "executor": "nx-mesh:serve", 35 | "options": { 36 | "dev": true, 37 | "dir": "examples/sdk-odata--trippin" 38 | } 39 | }, 40 | "validate": { 41 | "executor": "nx-mesh:validate", 42 | "options": { 43 | "dir": "examples/sdk-odata--trippin" 44 | } 45 | } 46 | }, 47 | "tags": ["type:sdk", "type:example"] 48 | } 49 | -------------------------------------------------------------------------------- /examples/sdk-odata--trippin/src/graphql/airports/getAirports.query.graphql: -------------------------------------------------------------------------------- 1 | query getAirports { 2 | Airports { 3 | Name 4 | Location { 5 | Address 6 | City { 7 | Name 8 | Region 9 | CountryRegion 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /examples/sdk-odata--trippin/src/index.ts: -------------------------------------------------------------------------------- 1 | export type { Types as Trippin } from './lib/types'; 2 | -------------------------------------------------------------------------------- /examples/sdk-odata--trippin/src/lib/sdk.ts: -------------------------------------------------------------------------------- 1 | export { getMeshSDK } from '../../.mesh'; 2 | -------------------------------------------------------------------------------- /examples/sdk-odata--trippin/src/lib/server.ts: -------------------------------------------------------------------------------- 1 | export { createBuiltMeshHTTPHandler } from '../../.mesh'; 2 | -------------------------------------------------------------------------------- /examples/sdk-odata--trippin/src/lib/types.ts: -------------------------------------------------------------------------------- 1 | import type * as Types from '../../.mesh'; 2 | 3 | export { Types }; 4 | export default Types; 5 | -------------------------------------------------------------------------------- /examples/sdk-odata--trippin/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.lib.json" 8 | }, 9 | { 10 | "path": "./tsconfig.spec.json" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /examples/sdk-odata--trippin/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "outDir": "../../dist/out-tsc", 6 | "declaration": true, 7 | "types": ["node"] 8 | }, 9 | "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"], 10 | "include": ["**/*.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /examples/sdk-odata--trippin/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": [ 9 | "jest.config.ts", 10 | "**/*.test.ts", 11 | "**/*.spec.ts", 12 | "**/*.test.tsx", 13 | "**/*.spec.tsx", 14 | "**/*.test.js", 15 | "**/*.spec.js", 16 | "**/*.test.jsx", 17 | "**/*.spec.jsx", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /examples/sdk-openapi--javascript-wiki/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*", ".mesh"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /examples/sdk-openapi--javascript-wiki/.meshrc.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | - name: JavaScript Wiki 3 | handler: 4 | openapi: 5 | source: https://api.apis.guru/v2/specs/wikimedia.org/1.0.0/swagger.yaml 6 | 7 | serve: 8 | browser: false 9 | 10 | sdk: 11 | generateOperations: 12 | selectionSetDepth: 6 13 | -------------------------------------------------------------------------------- /examples/sdk-openapi--javascript-wiki/.swcrc: -------------------------------------------------------------------------------- 1 | { 2 | "jsc": { 3 | "target": "es2017", 4 | "parser": { 5 | "syntax": "typescript", 6 | "decorators": true, 7 | "dynamicImport": true 8 | }, 9 | "transform": { 10 | "decoratorMetadata": true, 11 | "legacyDecorator": true 12 | }, 13 | "keepClassNames": true, 14 | "externalHelpers": true, 15 | "loose": true 16 | }, 17 | "module": { 18 | "type": "commonjs", 19 | "strict": true, 20 | "noInterop": true 21 | }, 22 | "sourceMaps": true, 23 | "exclude": [ 24 | "jest.config.ts", 25 | ".*.spec.tsx?$", 26 | ".*.test.tsx?$", 27 | "./src/jest-setup.ts$", 28 | "./**/jest-setup.ts$", 29 | ".*.js$" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /examples/sdk-openapi--javascript-wiki/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'examples-sdk-openapi-javascript-wiki', 4 | preset: '../../jest.preset.js', 5 | testEnvironment: 'node', 6 | transform: { 7 | '^.+\\.[tj]sx?$': [ 8 | '@swc/jest', 9 | { jsc: { transform: { react: { runtime: 'automatic' } } } }, 10 | ], 11 | }, 12 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], 13 | coverageDirectory: '../../coverage/examples/sdk-openapi--javascript-wiki', 14 | }; 15 | -------------------------------------------------------------------------------- /examples/sdk-openapi--javascript-wiki/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "exports": { 3 | "./sdk": "./src/lib/sdk", 4 | "./server": "./src/lib/server", 5 | "./types": "./src/lib/types", 6 | "./utils": "./src/lib/utils" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/sdk-openapi--javascript-wiki/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "examples-sdk-openapi--javascript-wiki", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "examples/sdk-openapi--javascript-wiki/src", 5 | "projectType": "library", 6 | "implicitDependencies": ["nx-mesh"], 7 | "targets": { 8 | "lint": { 9 | "executor": "@nrwl/linter:eslint", 10 | "outputs": ["{options.outputFile}"], 11 | "options": { 12 | "lintFilePatterns": ["examples/sdk-openapi--javascript-wiki/**/*.ts"] 13 | } 14 | }, 15 | "test": { 16 | "executor": "@nrwl/jest:jest", 17 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 18 | "options": { 19 | "jestConfig": "examples/sdk-openapi--javascript-wiki/jest.config.ts", 20 | "passWithNoTests": true 21 | } 22 | }, 23 | "build": { 24 | "executor": "nx-mesh:build-swc", 25 | "outputs": ["{projectRoot}/.mesh", "{options.outputPath}"], 26 | "options": { 27 | "dir": "examples/sdk-openapi--javascript-wiki", 28 | "main": "examples/sdk-openapi--javascript-wiki/src/index.ts", 29 | "outputPath": "dist/examples/sdk-openapi--javascript-wiki", 30 | "tsConfig": "examples/sdk-openapi--javascript-wiki/tsconfig.lib.json" 31 | } 32 | }, 33 | "serve": { 34 | "executor": "nx-mesh:serve", 35 | "options": { 36 | "dev": true, 37 | "dir": "examples/sdk-openapi--javascript-wiki" 38 | } 39 | }, 40 | "validate": { 41 | "executor": "nx-mesh:validate", 42 | "options": { 43 | "dir": "examples/sdk-openapi--javascript-wiki" 44 | } 45 | } 46 | }, 47 | "tags": ["type:example", "type:sdk"] 48 | } 49 | -------------------------------------------------------------------------------- /examples/sdk-openapi--javascript-wiki/src/index.ts: -------------------------------------------------------------------------------- 1 | export type { Types as JavascriptWiki } from './lib/types'; 2 | -------------------------------------------------------------------------------- /examples/sdk-openapi--javascript-wiki/src/lib/sdk.ts: -------------------------------------------------------------------------------- 1 | export { getMeshSDK } from '../../.mesh'; 2 | -------------------------------------------------------------------------------- /examples/sdk-openapi--javascript-wiki/src/lib/server.ts: -------------------------------------------------------------------------------- 1 | export { createBuiltMeshHTTPHandler } from '../../.mesh'; 2 | -------------------------------------------------------------------------------- /examples/sdk-openapi--javascript-wiki/src/lib/types.ts: -------------------------------------------------------------------------------- 1 | import type * as Types from '../../.mesh'; 2 | 3 | export { Types }; 4 | export default Types; 5 | -------------------------------------------------------------------------------- /examples/sdk-openapi--javascript-wiki/src/lib/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './is-availability'; 2 | -------------------------------------------------------------------------------- /examples/sdk-openapi--javascript-wiki/src/lib/utils/is-availability.ts: -------------------------------------------------------------------------------- 1 | import type { Types } from '../types'; 2 | 3 | export const isAvailability = ( 4 | value: T | Types.availability 5 | ): value is Types.availability => 6 | [ 7 | 'in_the_news', 8 | 'most_read', 9 | 'on_this_day', 10 | 'picture_of_the_day', 11 | 'todays_featured_article', 12 | ].some((name) => Object.prototype.hasOwnProperty.call(value, name)); 13 | 14 | export default isAvailability; 15 | -------------------------------------------------------------------------------- /examples/sdk-openapi--javascript-wiki/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.lib.json" 8 | }, 9 | { 10 | "path": "./tsconfig.spec.json" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /examples/sdk-openapi--javascript-wiki/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "outDir": "../../dist/out-tsc", 6 | "declaration": true, 7 | "types": ["node"] 8 | }, 9 | "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"], 10 | "include": ["**/*.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /examples/sdk-openapi--javascript-wiki/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": [ 9 | "jest.config.ts", 10 | "**/*.test.ts", 11 | "**/*.spec.ts", 12 | "**/*.test.tsx", 13 | "**/*.spec.tsx", 14 | "**/*.test.js", 15 | "**/*.spec.js", 16 | "**/*.test.jsx", 17 | "**/*.spec.jsx", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /examples/sdk-openapi--stackexchange/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "@nrwl/js/babel", 5 | { 6 | "useBuiltIns": "usage" 7 | } 8 | ] 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /examples/sdk-openapi--stackexchange/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*", ".mesh"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /examples/sdk-openapi--stackexchange/.meshrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "sources": [ 3 | { 4 | "name": "StackExchange", 5 | "handler": { 6 | "openapi": { 7 | "source": "https://raw.githubusercontent.com/grokify/api-specs/master/stackexchange/stackexchange-api-v2.2_openapi-v3.0.yaml" 8 | } 9 | } 10 | } 11 | ], 12 | "serve": { 13 | "browser": false 14 | }, 15 | "sdk": { 16 | "generateOperations": { 17 | "selectionSetDepth": 6 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /examples/sdk-openapi--stackexchange/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'examples-sdk-openapi-stackexchange', 4 | preset: '../../jest.preset.js', 5 | globals: { 6 | 'ts-jest': { 7 | tsconfig: '/tsconfig.spec.json', 8 | }, 9 | }, 10 | testEnvironment: 'node', 11 | transform: { 12 | '^.+\\.[tj]sx?$': 'ts-jest', 13 | }, 14 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], 15 | coverageDirectory: '../../coverage/examples/sdk-openapi--stackexchange', 16 | }; 17 | -------------------------------------------------------------------------------- /examples/sdk-openapi--stackexchange/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "exports": { 3 | "./sdk": "./src/lib/sdk", 4 | "./server": "./src/lib/server", 5 | "./types": "./src/lib/types" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/sdk-openapi--stackexchange/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "examples-sdk-openapi--stackexchange", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "examples/sdk-openapi--stackexchange/src", 5 | "projectType": "library", 6 | "implicitDependencies": ["nx-mesh"], 7 | "targets": { 8 | "lint": { 9 | "executor": "@nrwl/linter:eslint", 10 | "outputs": ["{options.outputFile}"], 11 | "options": { 12 | "lintFilePatterns": ["examples/sdk-openapi--stackexchange/**/*.ts"] 13 | } 14 | }, 15 | "test": { 16 | "executor": "@nrwl/jest:jest", 17 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 18 | "options": { 19 | "jestConfig": "examples/sdk-openapi--stackexchange/jest.config.ts", 20 | "passWithNoTests": true 21 | } 22 | }, 23 | "build": { 24 | "executor": "nx-mesh:build", 25 | "outputs": ["{projectRoot}/.mesh", "{options.outputPath}"], 26 | "options": { 27 | "dir": "examples/sdk-openapi--stackexchange", 28 | "main": "examples/sdk-openapi--stackexchange/src/index.ts", 29 | "outputPath": "dist/examples/sdk-openapi--stackexchange", 30 | "tsConfig": "examples/sdk-openapi--stackexchange/tsconfig.lib.json" 31 | } 32 | }, 33 | "serve": { 34 | "executor": "nx-mesh:serve", 35 | "options": { 36 | "dev": true, 37 | "dir": "examples/sdk-openapi--stackexchange" 38 | } 39 | }, 40 | "validate": { 41 | "executor": "nx-mesh:validate", 42 | "options": { 43 | "dir": "examples/sdk-openapi--stackexchange" 44 | } 45 | } 46 | }, 47 | "tags": ["type:example", "type:sdk"] 48 | } 49 | -------------------------------------------------------------------------------- /examples/sdk-openapi--stackexchange/src/index.ts: -------------------------------------------------------------------------------- 1 | export type { Types as Stackexchange } from './lib/types'; 2 | -------------------------------------------------------------------------------- /examples/sdk-openapi--stackexchange/src/lib/sdk.ts: -------------------------------------------------------------------------------- 1 | export { getMeshSDK } from '../../.mesh'; 2 | -------------------------------------------------------------------------------- /examples/sdk-openapi--stackexchange/src/lib/server.ts: -------------------------------------------------------------------------------- 1 | export { createBuiltMeshHTTPHandler } from '../../.mesh'; 2 | -------------------------------------------------------------------------------- /examples/sdk-openapi--stackexchange/src/lib/types.ts: -------------------------------------------------------------------------------- 1 | import type * as Types from '../../.mesh'; 2 | 3 | export { Types }; 4 | export default Types; 5 | -------------------------------------------------------------------------------- /examples/sdk-openapi--stackexchange/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.lib.json" 8 | }, 9 | { 10 | "path": "./tsconfig.spec.json" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /examples/sdk-openapi--stackexchange/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "outDir": "../../dist/out-tsc", 6 | "declaration": true, 7 | "types": ["node"] 8 | }, 9 | "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"], 10 | "include": ["**/*.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /examples/sdk-openapi--stackexchange/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": [ 9 | "jest.config.ts", 10 | "**/*.test.ts", 11 | "**/*.spec.ts", 12 | "**/*.test.tsx", 13 | "**/*.spec.tsx", 14 | "**/*.test.js", 15 | "**/*.spec.js", 16 | "**/*.test.jsx", 17 | "**/*.spec.jsx", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /examples/sdk-soap--country-info/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*", ".mesh"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /examples/sdk-soap--country-info/.meshrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | sources: [ 3 | { 4 | name: 'CountryInfo', 5 | handler: { 6 | soap: { 7 | source: 8 | 'http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL', 9 | }, 10 | }, 11 | }, 12 | ], 13 | serve: { 14 | browser: false, 15 | }, 16 | documents: ['./src/graphql/**/*.*.graphql'], 17 | }; 18 | -------------------------------------------------------------------------------- /examples/sdk-soap--country-info/.swcrc: -------------------------------------------------------------------------------- 1 | { 2 | "jsc": { 3 | "target": "es2017", 4 | "parser": { 5 | "syntax": "typescript", 6 | "decorators": true, 7 | "dynamicImport": true 8 | }, 9 | "transform": { 10 | "decoratorMetadata": true, 11 | "legacyDecorator": true 12 | }, 13 | "keepClassNames": true, 14 | "externalHelpers": true, 15 | "loose": true 16 | }, 17 | "module": { 18 | "type": "commonjs", 19 | "strict": true, 20 | "noInterop": true 21 | }, 22 | "sourceMaps": true, 23 | "exclude": [ 24 | "jest.config.ts", 25 | ".*.spec.tsx?$", 26 | ".*.test.tsx?$", 27 | "./src/jest-setup.ts$", 28 | "./**/jest-setup.ts$", 29 | ".*.js$" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /examples/sdk-soap--country-info/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'examples-sdk-soap-country-info', 4 | preset: '../../jest.preset.js', 5 | testEnvironment: 'node', 6 | transform: { 7 | '^.+\\.[tj]sx?$': [ 8 | '@swc/jest', 9 | { jsc: { transform: { react: { runtime: 'automatic' } } } }, 10 | ], 11 | }, 12 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], 13 | coverageDirectory: '../../coverage/examples/sdk-soap--country-info', 14 | }; 15 | -------------------------------------------------------------------------------- /examples/sdk-soap--country-info/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "exports": { 3 | "./sdk": "./src/lib/sdk", 4 | "./server": "./src/lib/server", 5 | "./types": "./src/lib/types" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /examples/sdk-soap--country-info/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "examples-sdk-soap--country-info", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "examples/sdk-soap--country-info/src", 5 | "projectType": "library", 6 | "implicitDependencies": ["nx-mesh"], 7 | "targets": { 8 | "lint": { 9 | "executor": "@nrwl/linter:eslint", 10 | "outputs": ["{options.outputFile}"], 11 | "options": { 12 | "lintFilePatterns": ["examples/sdk-soap--country-info/**/*.ts"] 13 | } 14 | }, 15 | "test": { 16 | "executor": "@nrwl/jest:jest", 17 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 18 | "options": { 19 | "jestConfig": "examples/sdk-soap--country-info/jest.config.ts", 20 | "passWithNoTests": true 21 | } 22 | }, 23 | "build": { 24 | "executor": "nx-mesh:build-swc", 25 | "outputs": ["{projectRoot}/.mesh", "{options.outputPath}"], 26 | "options": { 27 | "dir": "examples/sdk-soap--country-info", 28 | "main": "examples/sdk-soap--country-info/src/index.ts", 29 | "outputPath": "dist/examples/sdk-soap--country-info", 30 | "tsConfig": "examples/sdk-soap--country-info/tsconfig.lib.json" 31 | } 32 | }, 33 | "serve": { 34 | "executor": "nx-mesh:serve", 35 | "options": { 36 | "dev": true, 37 | "dir": "examples/sdk-soap--country-info" 38 | } 39 | } 40 | }, 41 | "tags": ["type:sdk", "type:example"] 42 | } 43 | -------------------------------------------------------------------------------- /examples/sdk-soap--country-info/src/graphql/queries/GetLanguages.query.graphql: -------------------------------------------------------------------------------- 1 | query GetLanguages { 2 | CountryInfoService_CountryInfoService_CountryInfoServiceSoap_ListOfLanguagesByName { 3 | ListOfLanguagesByNameResult { 4 | tLanguage { 5 | sISOCode 6 | sName 7 | } 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/sdk-soap--country-info/src/index.ts: -------------------------------------------------------------------------------- 1 | export type { Types as CountryInfo } from './lib/types'; 2 | -------------------------------------------------------------------------------- /examples/sdk-soap--country-info/src/lib/sdk.ts: -------------------------------------------------------------------------------- 1 | export { getMeshSDK } from '../../.mesh'; 2 | -------------------------------------------------------------------------------- /examples/sdk-soap--country-info/src/lib/server.ts: -------------------------------------------------------------------------------- 1 | export { createBuiltMeshHTTPHandler } from '../../.mesh'; 2 | -------------------------------------------------------------------------------- /examples/sdk-soap--country-info/src/lib/types.ts: -------------------------------------------------------------------------------- 1 | import type * as Types from '../../.mesh'; 2 | 3 | export { Types }; 4 | export default Types; 5 | -------------------------------------------------------------------------------- /examples/sdk-soap--country-info/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.lib.json" 8 | }, 9 | { 10 | "path": "./tsconfig.spec.json" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /examples/sdk-soap--country-info/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "outDir": "../../dist/out-tsc", 6 | "declaration": true, 7 | "types": ["node"] 8 | }, 9 | "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"], 10 | "include": ["**/*.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /examples/sdk-soap--country-info/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": [ 9 | "jest.config.ts", 10 | "**/*.test.ts", 11 | "**/*.spec.ts", 12 | "**/*.test.tsx", 13 | "**/*.spec.tsx", 14 | "**/*.test.js", 15 | "**/*.spec.js", 16 | "**/*.test.jsx", 17 | "**/*.spec.jsx", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /jest.config.ts: -------------------------------------------------------------------------------- 1 | import { getJestProjects } from '@nrwl/jest'; 2 | 3 | export default { 4 | projects: getJestProjects(), 5 | }; 6 | -------------------------------------------------------------------------------- /jest.preset.js: -------------------------------------------------------------------------------- 1 | const nxPreset = require('@nrwl/jest/preset').default; 2 | 3 | module.exports = { 4 | ...nxPreset, 5 | coverageReporters: [ 6 | 'clover', 7 | 'cobertura', 8 | 'html', 9 | 'json', 10 | 'lcov', 11 | 'text', 12 | 'text-summary', 13 | ], 14 | }; 15 | -------------------------------------------------------------------------------- /packages/nx-mesh/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | }, 17 | { 18 | "files": ["./package.json", "./generators.json", "./executors.json"], 19 | "parser": "jsonc-eslint-parser", 20 | "rules": { 21 | "@nrwl/nx/nx-plugin-checks": "error" 22 | } 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /packages/nx-mesh/jest.config.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | displayName: 'nx-mesh', 3 | preset: '../../jest.preset.js', 4 | globals: { 5 | 'ts-jest': { 6 | tsconfig: '/tsconfig.spec.json', 7 | }, 8 | }, 9 | transform: { 10 | '^.+\\.[tj]s$': 'ts-jest', 11 | }, 12 | moduleFileExtensions: ['ts', 'js', 'html'], 13 | coverageDirectory: '../../coverage/packages/nx-mesh', 14 | }; 15 | -------------------------------------------------------------------------------- /packages/nx-mesh/migrations.json: -------------------------------------------------------------------------------- 1 | { 2 | "generators": { 3 | "rename-swcrc-config": { 4 | "version": "4.0.0", 5 | "description": "Rename .lib.swcrc to .swcrc for better SWC support throughout the workspace", 6 | "cli": "nx", 7 | "implementation": "./src/migrations/4.0.0/rename-swcrc-config" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/nx-mesh/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nx-mesh", 3 | "author": "Dom Talbot", 4 | "description": "GraphQL Mesh support for Nx", 5 | "version": "4.0.0", 6 | "license": "MIT", 7 | "main": "src/index.js", 8 | "generators": "./generators.json", 9 | "executors": "./executors.json", 10 | "peerDependencies": { 11 | "@graphql-mesh/cli": ">=0.82.27", 12 | "graphql": "^16.6.0", 13 | "nx": ">=15.7.1" 14 | }, 15 | "dependencies": { 16 | "@nrwl/cypress": "^15.7.1", 17 | "@nrwl/devkit": "^15.7.1", 18 | "@nrwl/js": "^15.7.1", 19 | "@nrwl/linter": "^15.7.1", 20 | "@nrwl/node": "^15.7.1", 21 | "@nrwl/workspace": "^15.7.1", 22 | "@swc-node/register": "^1.6.2", 23 | "@swc/core": "^1.3.42", 24 | "@swc/helpers": "^0.4.14" 25 | }, 26 | "keywords": [ 27 | "Monorepo", 28 | "Node", 29 | "Jest", 30 | "Cypress", 31 | "CLI", 32 | "GraphQL", 33 | "GraphQL-Mesh", 34 | "Mesh", 35 | "Nx", 36 | "nx-plugin", 37 | "plugin" 38 | ], 39 | "bugs": { 40 | "url": "git://github.com/domjtalbot/nx-mesh/issues" 41 | }, 42 | "repository": { 43 | "directory": "packages/nx-mesh", 44 | "type": "git", 45 | "url": "git://github.com/domjtalbot/nx-mesh.git" 46 | }, 47 | "funding": { 48 | "type": "GitHub", 49 | "url": "https://github.com/sponsors/domjtalbot" 50 | }, 51 | "nx-migrations": { 52 | "migrations": "./migrations.json" 53 | }, 54 | "exports": { 55 | "./package.json": "./package.json" 56 | }, 57 | "type": "commonjs" 58 | } 59 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/build-gateway/build-gateway.ts: -------------------------------------------------------------------------------- 1 | import type { ExecutorContext } from '@nrwl/devkit'; 2 | 3 | import { logger } from '@nrwl/devkit'; 4 | import { directoryExists } from '@nrwl/workspace/src/utilities/fileutils'; 5 | import { copySync, mkdir } from 'fs-extra'; 6 | import { join, resolve } from 'node:path'; 7 | 8 | import { createPackageJson } from '../../utils'; 9 | import { runMeshCli } from '../../utils/mesh-cli'; 10 | import { BuildGatewayExecutorSchema } from './schema'; 11 | 12 | export default async function* buildExecutor( 13 | options: BuildGatewayExecutorSchema, 14 | context: ExecutorContext 15 | ) { 16 | if (options.dir === undefined) { 17 | throw new Error("Please define the 'dir' value"); 18 | } 19 | 20 | const dir = resolve(context.root, options.dir); 21 | 22 | if (!directoryExists(options.outputPath)) { 23 | mkdir(options.outputPath, { 24 | recursive: true, 25 | }); 26 | } 27 | 28 | await runMeshCli( 29 | 'build', 30 | { 31 | args: { 32 | dir, 33 | require: options.require, 34 | }, 35 | env: { 36 | debug: options.debug, 37 | }, 38 | }, 39 | context 40 | ); 41 | 42 | copySync(join(dir, '.mesh'), join(options.outputPath, '.mesh')); 43 | 44 | logger.info(''); 45 | logger.info('Creating package.json...'); 46 | 47 | await createPackageJson( 48 | { 49 | dir: options.dir, 50 | outputPath: options.outputPath, 51 | }, 52 | context 53 | ); 54 | 55 | logger.info('Done.'); 56 | 57 | yield { 58 | success: true, 59 | }; 60 | } 61 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/build-gateway/hasher.spec.ts: -------------------------------------------------------------------------------- 1 | import { Hasher, HasherContext } from '@nrwl/devkit'; 2 | 3 | import { buildGatewayHasher } from './hasher'; 4 | 5 | describe('buildGatewayHasher', () => { 6 | it('should generate hash', async () => { 7 | const mockHasher: Hasher = { 8 | hashTask: jest.fn().mockReturnValue({ value: 'hashed-task' }), 9 | } as unknown as Hasher; 10 | const hash = await buildGatewayHasher( 11 | { 12 | id: 'my-task-id', 13 | target: { 14 | project: 'proj', 15 | target: 'target', 16 | }, 17 | overrides: {}, 18 | }, 19 | { 20 | hasher: mockHasher, 21 | } as unknown as HasherContext 22 | ); 23 | expect(hash).toEqual({ value: 'hashed-task' }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/build-gateway/hasher.ts: -------------------------------------------------------------------------------- 1 | import { CustomHasher } from '@nrwl/devkit'; 2 | 3 | /** 4 | * This is a boilerplate custom hasher that matches 5 | * the default Nx hasher. If you need to extend the behavior, 6 | * you can consume workspace details from the context. 7 | */ 8 | export const buildGatewayHasher: CustomHasher = async (task, context) => { 9 | return context.hasher.hashTask(task); 10 | }; 11 | 12 | export default buildGatewayHasher; 13 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/build-gateway/index.ts: -------------------------------------------------------------------------------- 1 | export * from './build-gateway'; 2 | export * from './hasher'; 3 | export * from './schema'; 4 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/build-gateway/schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2, 3 | "outputCapture": "direct-nodejs", 4 | "$schema": "http://json-schema.org/schema", 5 | "cli": "nx", 6 | "title": "Build Gateway executor", 7 | "description": "Builds artifacts to be used as an API Gateway", 8 | "type": "object", 9 | "properties": { 10 | "debug": { 11 | "type": "boolean", 12 | "description": "Display debugging info.", 13 | "default": false 14 | }, 15 | "dir": { 16 | "description": "The path of the directory containing the GraphQL Mesh config.", 17 | "type": "string" 18 | }, 19 | "require": { 20 | "type": "array", 21 | "description": "Loads specific require.extensions before running the codegen and reading the configuration.", 22 | "items": { 23 | "type": "string" 24 | }, 25 | "default": [] 26 | }, 27 | "outputPath": { 28 | "type": "string", 29 | "description": "The output path of the generated files." 30 | } 31 | }, 32 | "required": ["dir", "outputPath"] 33 | } 34 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/build-gateway/schema.ts: -------------------------------------------------------------------------------- 1 | import type { Options } from '../../utils/mesh-cli'; 2 | 3 | type MeshBuildSchema = Options<'build'>; 4 | 5 | export type BuildGatewayExecutorSchema = MeshBuildSchema['args'] & 6 | MeshBuildSchema['env'] & { 7 | /** 8 | * The output path of the generated files. 9 | */ 10 | outputPath: string; 11 | }; 12 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/build-swc/hasher.spec.ts: -------------------------------------------------------------------------------- 1 | import { Hasher, HasherContext } from '@nrwl/devkit'; 2 | 3 | import { buildSwcHasher } from './hasher'; 4 | 5 | describe('buildSwcHasher', () => { 6 | it('should generate hash', async () => { 7 | const mockHasher: Hasher = { 8 | hashTask: jest.fn().mockReturnValue({ value: 'hashed-task' }), 9 | } as unknown as Hasher; 10 | const hash = await buildSwcHasher( 11 | { 12 | id: 'my-task-id', 13 | target: { 14 | project: 'proj', 15 | target: 'target', 16 | }, 17 | overrides: {}, 18 | }, 19 | { 20 | hasher: mockHasher, 21 | } as unknown as HasherContext 22 | ); 23 | expect(hash).toEqual({ value: 'hashed-task' }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/build-swc/hasher.ts: -------------------------------------------------------------------------------- 1 | import { CustomHasher } from '@nrwl/devkit'; 2 | 3 | /** 4 | * This is a boilerplate custom hasher that matches 5 | * the default Nx hasher. If you need to extend the behavior, 6 | * you can consume workspace details from the context. 7 | */ 8 | export const buildSwcHasher: CustomHasher = async (task, context) => { 9 | return context.hasher.hashTask(task); 10 | }; 11 | 12 | export default buildSwcHasher; 13 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/build-swc/index.ts: -------------------------------------------------------------------------------- 1 | export * from './build-swc'; 2 | export * from './hasher'; 3 | export * from './schema'; 4 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/build-swc/schema.ts: -------------------------------------------------------------------------------- 1 | import type { Arguments } from '../../utils/graphql-codegen-cli'; 2 | import type { Options } from '../../utils/mesh-cli'; 3 | 4 | interface SwcExecutorSchema { 5 | assets: string[]; 6 | buildableProjectDepsInPackageJsonType: boolean; 7 | main: string; 8 | skipTypeCheck: boolean; 9 | swcrc?: string; 10 | transformers: unknown[]; 11 | tsConfig: string; 12 | updateBuildableProjectDepsInPackageJson: boolean; 13 | watch: boolean; 14 | } 15 | 16 | type MeshBuildSchema = Options<'build'>; 17 | 18 | export type BuildSWCExecutorSchema = SwcExecutorSchema & 19 | MeshBuildSchema['args'] & 20 | MeshBuildSchema['env'] & { 21 | /** 22 | * GraphQL Codegen config 23 | */ 24 | codegen?: Arguments; 25 | 26 | /** 27 | * The output path of the generated files. 28 | */ 29 | outputPath: string; 30 | }; 31 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/build-swc/swc-executor/README.md: -------------------------------------------------------------------------------- 1 | > **Note** 2 | > 3 | > This is a modifed version the the Nx SWC compile with support dotfiles. 4 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/build/hasher.spec.ts: -------------------------------------------------------------------------------- 1 | import { Hasher, HasherContext } from '@nrwl/devkit'; 2 | 3 | import { buildHasher } from './hasher'; 4 | 5 | describe('buildHasher', () => { 6 | it('should generate hash', async () => { 7 | const mockHasher: Hasher = { 8 | hashTask: jest.fn().mockReturnValue({ value: 'hashed-task' }), 9 | } as unknown as Hasher; 10 | const hash = await buildHasher( 11 | { 12 | id: 'my-task-id', 13 | target: { 14 | project: 'proj', 15 | target: 'target', 16 | }, 17 | overrides: {}, 18 | }, 19 | { 20 | hasher: mockHasher, 21 | } as unknown as HasherContext 22 | ); 23 | expect(hash).toEqual({ value: 'hashed-task' }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/build/hasher.ts: -------------------------------------------------------------------------------- 1 | import { CustomHasher } from '@nrwl/devkit'; 2 | 3 | /** 4 | * This is a boilerplate custom hasher that matches 5 | * the default Nx hasher. If you need to extend the behavior, 6 | * you can consume workspace details from the context. 7 | */ 8 | export const buildHasher: CustomHasher = async (task, context) => { 9 | return context.hasher.hashTask(task); 10 | }; 11 | 12 | export default buildHasher; 13 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/build/schema.ts: -------------------------------------------------------------------------------- 1 | import type { Arguments } from '../../utils/graphql-codegen-cli'; 2 | import type { Options } from '../../utils/mesh-cli'; 3 | 4 | interface TscExecutorSchema { 5 | assets: string[]; 6 | buildableProjectDepsInPackageJsonType: boolean; 7 | main: string; 8 | transformers: unknown[]; 9 | tsConfig: string; 10 | updateBuildableProjectDepsInPackageJson: boolean; 11 | watch: boolean; 12 | } 13 | 14 | type MeshBuildSchema = Options<'build'>; 15 | 16 | export type BuildExecutorSchema = TscExecutorSchema & 17 | MeshBuildSchema['args'] & 18 | MeshBuildSchema['env'] & { 19 | /** 20 | * GraphQL Codegen config 21 | */ 22 | codegen?: Arguments; 23 | 24 | /** 25 | * The output path of the generated files. 26 | */ 27 | outputPath: string; 28 | }; 29 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/dev/dev.ts: -------------------------------------------------------------------------------- 1 | import type { ExecutorContext } from '@nrwl/devkit'; 2 | 3 | import { logger } from '@nrwl/devkit'; 4 | import { resolve } from 'node:path'; 5 | 6 | import { childProcess, runMeshCli } from '../../utils/mesh-cli'; 7 | import getServeLocation from './lib/get-serve-location'; 8 | import { DevExecutorSchema } from './schema'; 9 | 10 | const readyWhenMsg = 'Serving GraphQL Mesh:'; 11 | 12 | export async function* devExecutor( 13 | options: DevExecutorSchema, 14 | context: ExecutorContext 15 | ) { 16 | const { baseUrl, port } = await getServeLocation(options); 17 | 18 | logger.info('Starting GraphQL Mesh dev server...'); 19 | 20 | runMeshCli( 21 | 'dev', 22 | { 23 | args: { 24 | dir: resolve(context.root, options.dir), 25 | port, 26 | require: options.require, 27 | }, 28 | env: { 29 | debug: options.debug, 30 | }, 31 | }, 32 | context, 33 | { 34 | stdio: 'pipe', 35 | } 36 | ); 37 | 38 | childProcess?.stdout?.on('data', (chunk) => { 39 | process.stdout.write(chunk); 40 | }); 41 | 42 | childProcess?.stderr?.on('data', (chunk) => { 43 | process.stderr.write(chunk); 44 | }); 45 | 46 | await new Promise((resolve) => { 47 | childProcess?.stdout?.on('data', (chunk) => { 48 | if (chunk.toString().indexOf(readyWhenMsg) > -1) { 49 | resolve(); 50 | } 51 | }); 52 | }); 53 | 54 | yield { 55 | baseUrl, 56 | success: true, 57 | }; 58 | 59 | await new Promise<{ success: boolean }>(() => { 60 | // This Promise intentionally never resolves, leaving the process running. 61 | }); 62 | } 63 | 64 | export default devExecutor; 65 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/dev/hasher.spec.ts: -------------------------------------------------------------------------------- 1 | import { Hasher, HasherContext } from '@nrwl/devkit'; 2 | 3 | import { devHasher } from './hasher'; 4 | 5 | describe('devHasher', () => { 6 | it('should generate hash', async () => { 7 | const mockHasher: Hasher = { 8 | hashTask: jest.fn().mockReturnValue({ value: 'hashed-task' }), 9 | } as unknown as Hasher; 10 | const hash = await devHasher( 11 | { 12 | id: 'my-task-id', 13 | target: { 14 | project: 'proj', 15 | target: 'target', 16 | }, 17 | overrides: {}, 18 | }, 19 | { 20 | hasher: mockHasher, 21 | } as unknown as HasherContext 22 | ); 23 | expect(hash).toEqual({ value: 'hashed-task' }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/dev/hasher.ts: -------------------------------------------------------------------------------- 1 | import { CustomHasher } from '@nrwl/devkit'; 2 | 3 | /** 4 | * This is a boilerplate custom hasher that matches 5 | * the default Nx hasher. If you need to extend the behavior, 6 | * you can consume workspace details from the context. 7 | */ 8 | export const devHasher: CustomHasher = async (task, context) => { 9 | return context.hasher.hashTask(task); 10 | }; 11 | 12 | export default devHasher; 13 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/dev/index.ts: -------------------------------------------------------------------------------- 1 | export * from './dev'; 2 | export * from './hasher'; 3 | export * from './schema'; 4 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/dev/lib/get-serve-location.ts: -------------------------------------------------------------------------------- 1 | import type { DevExecutorSchema } from '../schema'; 2 | 3 | import getPort from 'get-port'; 4 | 5 | export async function getServeLocation(options: DevExecutorSchema) { 6 | let port = options.port.number ?? 4200; 7 | const isRange = options.port.range !== undefined; 8 | const range = getPort.makeRange( 9 | options.port.range?.from ?? 1024, 10 | options.port.range?.to ?? 65535 11 | ); 12 | 13 | if (options.port.auto) { 14 | port = await getPort({ 15 | port: isRange ? range : undefined, 16 | }); 17 | } else { 18 | if (options.port.fallback === 'auto') { 19 | port = await getPort({ 20 | port: isRange ? range : options.port.number, 21 | host: options.port.host, 22 | }); 23 | } 24 | } 25 | 26 | return { 27 | baseUrl: `http://${options.port.host}:${port}`, 28 | host: options.port.host, 29 | port, 30 | }; 31 | } 32 | 33 | export default getServeLocation; 34 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/dev/schema.d.ts: -------------------------------------------------------------------------------- 1 | export interface DevExecutorSchema { 2 | /** 3 | * Display debugging info. 4 | */ 5 | debug: boolean; 6 | 7 | /** 8 | * The path of the directory containing the GraphQL Mesh config. 9 | */ 10 | dir: string; 11 | 12 | /** 13 | * The port number settings 14 | */ 15 | port: { 16 | /** 17 | * Use the first available port 18 | */ 19 | auto: boolean; 20 | 21 | /** 22 | * The range of ports to select from. 23 | */ 24 | range?: { 25 | /** 26 | * The first port of the range. 27 | * Must be in the range `1024`...`65535`. 28 | */ 29 | from?: number; 30 | 31 | /** 32 | * The last port of the range. 33 | * Must be in the range `1024`...`65535` and must be greater 34 | * than `from`. 35 | */ 36 | to?: number; 37 | }; 38 | 39 | /** 40 | * Fallback action to take if the define port is unavailable. 41 | */ 42 | fallback: 'auto' | 'none'; 43 | 44 | /** 45 | * The port number to run on. 46 | */ 47 | number: number; 48 | 49 | /** 50 | * The host to listern on. 51 | */ 52 | host: string; 53 | }; 54 | 55 | /** 56 | * Loads specific require.extensions before running the codegen 57 | * and reading the configuration. 58 | */ 59 | require: string[]; 60 | } 61 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/serve/hasher.spec.ts: -------------------------------------------------------------------------------- 1 | import { Hasher, HasherContext } from '@nrwl/devkit'; 2 | 3 | import { serveHasher } from './hasher'; 4 | 5 | describe('serveHasher', () => { 6 | it('should generate hash', async () => { 7 | const mockHasher: Hasher = { 8 | hashTask: jest.fn().mockReturnValue({ value: 'hashed-task' }), 9 | } as unknown as Hasher; 10 | const hash = await serveHasher( 11 | { 12 | id: 'my-task-id', 13 | target: { 14 | project: 'proj', 15 | target: 'target', 16 | }, 17 | overrides: {}, 18 | }, 19 | { 20 | hasher: mockHasher, 21 | } as unknown as HasherContext 22 | ); 23 | expect(hash).toEqual({ value: 'hashed-task' }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/serve/hasher.ts: -------------------------------------------------------------------------------- 1 | import { CustomHasher } from '@nrwl/devkit'; 2 | 3 | /** 4 | * This is a boilerplate custom hasher that matches 5 | * the default Nx hasher. If you need to extend the behavior, 6 | * you can consume workspace details from the context. 7 | */ 8 | export const serveHasher: CustomHasher = async (task, context) => { 9 | return context.hasher.hashTask(task); 10 | }; 11 | 12 | export default serveHasher; 13 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/serve/index.ts: -------------------------------------------------------------------------------- 1 | export * from './serve'; 2 | export * from './hasher'; 3 | export * from './schema'; 4 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/serve/schema.d.ts: -------------------------------------------------------------------------------- 1 | import type { DevExecutorSchema } from '../dev/schema'; 2 | import type { StartExecutorSchema } from '../start/schema'; 3 | 4 | export interface ServeExecutorSchema 5 | extends DevExecutorSchema, 6 | StartExecutorSchema { 7 | dev: boolean; 8 | } 9 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/serve/serve.ts: -------------------------------------------------------------------------------- 1 | import type { ExecutorContext } from '@nrwl/devkit'; 2 | 3 | import type { ServeExecutorSchema } from './schema'; 4 | 5 | import { devExecutor } from '../dev/dev'; 6 | import { startExecutor } from '../start/start'; 7 | 8 | export async function* serveExecutor( 9 | options: ServeExecutorSchema, 10 | context: ExecutorContext 11 | ) { 12 | if (options.dev) { 13 | return yield* devExecutor(options, context); 14 | } 15 | 16 | return yield* startExecutor(options, context); 17 | } 18 | 19 | export default serveExecutor; 20 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/start/hasher.spec.ts: -------------------------------------------------------------------------------- 1 | import { Hasher, HasherContext } from '@nrwl/devkit'; 2 | 3 | import { startHasher } from './hasher'; 4 | 5 | describe('startHasher', () => { 6 | it('should generate hash', async () => { 7 | const mockHasher: Hasher = { 8 | hashTask: jest.fn().mockReturnValue({ value: 'hashed-task' }), 9 | } as unknown as Hasher; 10 | const hash = await startHasher( 11 | { 12 | id: 'my-task-id', 13 | target: { 14 | project: 'proj', 15 | target: 'target', 16 | }, 17 | overrides: {}, 18 | }, 19 | { 20 | hasher: mockHasher, 21 | } as unknown as HasherContext 22 | ); 23 | expect(hash).toEqual({ value: 'hashed-task' }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/start/hasher.ts: -------------------------------------------------------------------------------- 1 | import { CustomHasher } from '@nrwl/devkit'; 2 | 3 | /** 4 | * This is a boilerplate custom hasher that matches 5 | * the default Nx hasher. If you need to extend the behavior, 6 | * you can consume workspace details from the context. 7 | */ 8 | export const startHasher: CustomHasher = async (task, context) => { 9 | return context.hasher.hashTask(task); 10 | }; 11 | 12 | export default startHasher; 13 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/start/index.ts: -------------------------------------------------------------------------------- 1 | export * from './start'; 2 | export * from './hasher'; 3 | export * from './schema'; 4 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/start/lib/get-serve-location.ts: -------------------------------------------------------------------------------- 1 | import type { StartExecutorSchema } from '../schema'; 2 | 3 | import getPort from 'get-port'; 4 | 5 | export async function getServeLocation(options: StartExecutorSchema) { 6 | let port = options.port.number ?? 4200; 7 | const isRange = options.port.range !== undefined; 8 | const range = getPort.makeRange( 9 | options.port.range?.from ?? 1024, 10 | options.port.range?.to ?? 65535 11 | ); 12 | 13 | if (options.port.auto) { 14 | port = await getPort({ 15 | port: isRange ? range : undefined, 16 | }); 17 | } else { 18 | if (options.port.fallback === 'auto') { 19 | port = await getPort({ 20 | port: isRange ? range : options.port.number, 21 | host: options.port.host, 22 | }); 23 | } 24 | } 25 | 26 | return { 27 | baseUrl: `http://${options.port.host}:${port}`, 28 | host: options.port.host, 29 | port, 30 | }; 31 | } 32 | 33 | export default getServeLocation; 34 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/start/schema.ts: -------------------------------------------------------------------------------- 1 | import type { Options } from '../../utils/mesh-cli'; 2 | 3 | type MeshStartSchema = Options<'start'>; 4 | 5 | export type StartExecutorSchema = Omit & 6 | MeshStartSchema['env'] & { 7 | /** 8 | * The port number settings 9 | */ 10 | port: { 11 | /** 12 | * Use the first available port 13 | */ 14 | auto: boolean; 15 | 16 | /** 17 | * The range of ports to select from. 18 | */ 19 | range?: { 20 | /** 21 | * The first port of the range. 22 | * Must be in the range `1024`...`65535`. 23 | */ 24 | from?: number; 25 | 26 | /** 27 | * The last port of the range. 28 | * Must be in the range `1024`...`65535` and must be greater 29 | * than `from`. 30 | */ 31 | to?: number; 32 | }; 33 | 34 | /** 35 | * Fallback action to take if the define port is unavailable. 36 | */ 37 | fallback: 'auto' | 'none'; 38 | 39 | /** 40 | * The port number to run on. 41 | */ 42 | number: number; 43 | 44 | /** 45 | * The host to listern on. 46 | */ 47 | host: string; 48 | }; 49 | }; 50 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/start/start.ts: -------------------------------------------------------------------------------- 1 | import type { ExecutorContext } from '@nrwl/devkit'; 2 | 3 | import { logger } from '@nrwl/devkit'; 4 | import { resolve } from 'node:path'; 5 | 6 | import { childProcess, runMeshCli } from '../../utils/mesh-cli'; 7 | import getServeLocation from './lib/get-serve-location'; 8 | import { StartExecutorSchema } from './schema'; 9 | 10 | const readyWhenMsg = 'Serving GraphQL Mesh:'; 11 | 12 | export async function* startExecutor( 13 | options: StartExecutorSchema, 14 | context: ExecutorContext 15 | ) { 16 | if (options.dir === undefined) { 17 | throw new Error("Please define the 'dir' value"); 18 | } 19 | 20 | const { baseUrl, port } = await getServeLocation(options); 21 | 22 | logger.info('Starting GraphQL Mesh start server...'); 23 | 24 | runMeshCli( 25 | 'start', 26 | { 27 | args: { 28 | dir: resolve(context.root, options.dir), 29 | port, 30 | require: options.require, 31 | }, 32 | env: { 33 | debug: options.debug, 34 | }, 35 | }, 36 | context, 37 | { 38 | stdio: 'pipe', 39 | } 40 | ); 41 | 42 | childProcess?.stdout?.on('data', (chunk) => { 43 | process.stdout.write(chunk); 44 | }); 45 | 46 | childProcess?.stderr?.on('data', (chunk) => { 47 | process.stderr.write(chunk); 48 | }); 49 | 50 | await new Promise((resolve) => { 51 | childProcess?.stdout?.on('data', (chunk) => { 52 | if (chunk.toString().indexOf(readyWhenMsg) > -1) { 53 | resolve(); 54 | } 55 | }); 56 | }); 57 | 58 | yield { 59 | baseUrl, 60 | success: true, 61 | }; 62 | 63 | await new Promise<{ success: boolean }>(() => { 64 | // This Promise intentionally never resolves, leaving the process running. 65 | }); 66 | } 67 | 68 | export default startExecutor; 69 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/validate/hasher.spec.ts: -------------------------------------------------------------------------------- 1 | import { Hasher, HasherContext } from '@nrwl/devkit'; 2 | 3 | import { validateHasher } from './hasher'; 4 | 5 | describe('validateHasher', () => { 6 | it('should generate hash', async () => { 7 | const mockHasher: Hasher = { 8 | hashTask: jest.fn().mockReturnValue({ value: 'hashed-task' }), 9 | } as unknown as Hasher; 10 | const hash = await validateHasher( 11 | { 12 | id: 'my-task-id', 13 | target: { 14 | project: 'proj', 15 | target: 'target', 16 | }, 17 | overrides: {}, 18 | }, 19 | { 20 | hasher: mockHasher, 21 | } as unknown as HasherContext 22 | ); 23 | expect(hash).toEqual({ value: 'hashed-task' }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/validate/hasher.ts: -------------------------------------------------------------------------------- 1 | import { CustomHasher } from '@nrwl/devkit'; 2 | 3 | /** 4 | * This is a boilerplate custom hasher that matches 5 | * the default Nx hasher. If you need to extend the behavior, 6 | * you can consume workspace details from the context. 7 | */ 8 | export const validateHasher: CustomHasher = async (task, context) => { 9 | return context.hasher.hashTask(task); 10 | }; 11 | 12 | export default validateHasher; 13 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/validate/index.ts: -------------------------------------------------------------------------------- 1 | export * from './validate'; 2 | export * from './hasher'; 3 | export * from './schema'; 4 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/validate/schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2, 3 | "outputCapture": "direct-nodejs", 4 | "$schema": "http://json-schema.org/schema", 5 | "cli": "nx", 6 | "title": "Start executor", 7 | "description": "Validates artifacts", 8 | "type": "object", 9 | "properties": { 10 | "debug": { 11 | "type": "boolean", 12 | "description": "Display debugging info.", 13 | "default": false 14 | }, 15 | "dir": { 16 | "description": "The directory containing built GraphQL Mesh assets (.mesh).", 17 | "type": "string" 18 | }, 19 | "require": { 20 | "type": "array", 21 | "description": "Loads specific require.extensions before running the codegen and reading the configuration.", 22 | "items": { 23 | "type": "string" 24 | }, 25 | "default": [] 26 | } 27 | }, 28 | "required": ["dir"] 29 | } 30 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/validate/schema.ts: -------------------------------------------------------------------------------- 1 | import type { Options } from '../../utils/mesh-cli'; 2 | 3 | type MeshValidateSchema = Options<'validate'>; 4 | 5 | export type ValidateExecutorSchema = MeshValidateSchema['args'] & 6 | MeshValidateSchema['env']; 7 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/executors/validate/validate.ts: -------------------------------------------------------------------------------- 1 | import type { ExecutorContext } from '@nrwl/devkit'; 2 | 3 | import { logger } from '@nrwl/devkit'; 4 | import { resolve } from 'node:path'; 5 | 6 | import { runMeshCli } from '../../utils/mesh-cli'; 7 | 8 | import { ValidateExecutorSchema } from './schema'; 9 | 10 | export default async function* startExecutor( 11 | options: ValidateExecutorSchema, 12 | context: ExecutorContext 13 | ) { 14 | if (options.dir === undefined) { 15 | throw new Error("Please define the 'dir' value"); 16 | } 17 | 18 | logger.info('Validating GraphQL Mesh artifacts...'); 19 | 20 | await runMeshCli( 21 | 'validate', 22 | { 23 | args: { 24 | dir: resolve(context.root, options.dir), 25 | require: options.require, 26 | }, 27 | env: { 28 | debug: options.debug, 29 | }, 30 | }, 31 | context 32 | ); 33 | 34 | yield { 35 | success: true, 36 | }; 37 | } 38 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/application/application.ts: -------------------------------------------------------------------------------- 1 | import type { Tree } from '@nrwl/devkit'; 2 | 3 | import type { AppGeneratorSchema } from './schema'; 4 | 5 | import { convertNxGenerator } from '@nrwl/devkit'; 6 | import { baseGenerator } from '../base'; 7 | 8 | export async function applicationGenerator( 9 | tree: Tree, 10 | options: AppGeneratorSchema 11 | ) { 12 | return await baseGenerator(tree, { 13 | ...options, 14 | projectType: 'app', 15 | }); 16 | } 17 | 18 | export const applicationSchematic = convertNxGenerator(applicationGenerator); 19 | 20 | export default applicationGenerator; 21 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/application/index.ts: -------------------------------------------------------------------------------- 1 | export * from './application'; 2 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/application/schema.d.ts: -------------------------------------------------------------------------------- 1 | import type { Linter } from '@nrwl/linter'; 2 | 3 | export type MeshConfigExtensions = 'cjs' | 'js' | 'json' | 'yml'; 4 | 5 | export interface AppGeneratorSchema { 6 | babelJest?: boolean; 7 | directory?: string; 8 | e2eTestRunner?: 'cypress' | 'none'; 9 | linter?: Linter; 10 | meshConfig?: SupportedStyles; 11 | name: string; 12 | setParserOptionsProject?: boolean; 13 | skipFormat?: boolean; 14 | standaloneConfig?: boolean; 15 | tags?: string; 16 | unitTestRunner?: 'jest' | 'none'; 17 | } 18 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/base/base.ts: -------------------------------------------------------------------------------- 1 | import type { GeneratorCallback, Tree } from '@nrwl/devkit'; 2 | 3 | import type { BaseOptions } from './schema'; 4 | 5 | import { formatFiles } from '@nrwl/devkit'; 6 | 7 | import { runTasksInSerial } from '../../utils/run-tasks-in-serial'; 8 | import { createMeshExample } from '../utils/create-mesh-example'; 9 | import { 10 | addCypress, 11 | addJest, 12 | addLinting, 13 | addProjectConfig, 14 | createFiles, 15 | nodeGenerator, 16 | normalizeOptions, 17 | setDefaults, 18 | } from './lib'; 19 | 20 | /** 21 | * Generate the foundation for a GraphQL Mesh project 22 | */ 23 | export async function baseGenerator(tree: Tree, baseOptions: BaseOptions) { 24 | const options = normalizeOptions(tree, baseOptions); 25 | const { isCypress, isApp, isLibrary, skipFormat } = options; 26 | 27 | const tasks: GeneratorCallback[] = [await nodeGenerator(tree, options)]; 28 | 29 | createFiles(tree, options); 30 | addProjectConfig(tree, options); 31 | setDefaults(tree, options); 32 | createMeshExample(tree, { 33 | codegen: options.codegen, 34 | configExtension: options.meshConfigExt, 35 | example: options.example, 36 | isSdk: isLibrary, 37 | projectDirectory: options.projectDirectory, 38 | }); 39 | 40 | if (isApp) { 41 | tasks.push(await addJest(tree, options)); 42 | } 43 | 44 | if (isCypress) { 45 | tasks.push(await addCypress(tree, options)); 46 | } 47 | 48 | if (options.linter) { 49 | tasks.push(await addLinting(tree, options)); 50 | } 51 | 52 | if (!skipFormat) { 53 | formatFiles(tree); 54 | } 55 | 56 | return runTasksInSerial(...tasks); 57 | } 58 | 59 | export default baseGenerator; 60 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/base/files/app/tsconfig.app.json__tmpl__: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "<%= offsetFromRoot %>dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["node"] 7 | }, 8 | "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"], 9 | "include": ["**/*.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/base/files/app/tsconfig.json__tmpl__: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "<%= rootTsConfigPath %>", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.app.json" 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/base/files/lib/src/index.__tmpl__ts: -------------------------------------------------------------------------------- 1 | export * from './lib/sdk'; 2 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/base/files/lib/src/lib/sdk.__tmpl__ts: -------------------------------------------------------------------------------- 1 | export * from '../../.mesh'; 2 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/base/index.ts: -------------------------------------------------------------------------------- 1 | import { convertNxGenerator } from '@nrwl/devkit'; 2 | 3 | import { baseGenerator } from './base'; 4 | 5 | export const baseSchematic = convertNxGenerator(baseGenerator); 6 | 7 | export { baseGenerator } from './base'; 8 | 9 | export default baseGenerator; 10 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/base/lib/add-cypress.ts: -------------------------------------------------------------------------------- 1 | import type { Tree } from '@nrwl/devkit'; 2 | import type { NormalizedOptions } from './normalize-options'; 3 | 4 | import { cypressProjectGenerator } from '@nrwl/cypress'; 5 | import { Linter } from '@nrwl/linter'; 6 | 7 | export async function addCypress(host: Tree, options: NormalizedOptions) { 8 | const task = await cypressProjectGenerator(host, { 9 | ...options, 10 | directory: options.projectParentDirectory, 11 | linter: Linter.EsLint, 12 | name: `${options.name}-e2e`, 13 | project: options.projectName, 14 | }); 15 | 16 | const specFile = `${options.projectE2eDirectory}/src/integration/app.spec.${ 17 | options.js ? 'js' : 'ts' 18 | }`; 19 | 20 | const content = ` 21 | describe('${options.name}', () => { 22 | it('should start a mesh server', () => { 23 | cy.request('/graphql/health').then((resp) => { 24 | expect(resp.status).to.eq(200); 25 | expect(resp.body).to.have.property('message', 'alive'); 26 | }); 27 | }); 28 | 29 | it('should still be running after 15 seconds', () => { 30 | cy.wait(1000 * 15) 31 | .request('/graphql/health') 32 | .then((resp) => { 33 | expect(resp.status).to.eq(200); 34 | expect(resp.body).to.have.property('message', 'alive'); 35 | }); 36 | }); 37 | }); 38 | `; 39 | 40 | if (content) { 41 | host.write(specFile, content); 42 | } 43 | 44 | return task; 45 | } 46 | 47 | export default addCypress; 48 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/base/lib/add-linting.ts: -------------------------------------------------------------------------------- 1 | import type { GeneratorCallback, Tree } from '@nrwl/devkit'; 2 | 3 | import type { NormalizedOptions } from './normalize-options'; 4 | 5 | import { joinPathFragments, updateJson } from '@nrwl/devkit'; 6 | import { lintProjectGenerator } from '@nrwl/linter'; 7 | 8 | export async function addLinting( 9 | host: Tree, 10 | options: NormalizedOptions 11 | ): Promise { 12 | const linting = await lintProjectGenerator(host, { 13 | linter: options.linter, 14 | project: options.projectName, 15 | tsConfigPaths: [ 16 | joinPathFragments( 17 | options.projectDirectory, 18 | `tsconfig.${options.isApp ? 'app' : 'lib'}.json` 19 | ), 20 | ], 21 | eslintFilePatterns: [ 22 | `${options.projectDirectory}/**/*.${options.js ? 'js' : 'ts'}`, 23 | ], 24 | skipFormat: options.skipFormat ?? false, 25 | setParserOptionsProject: options.setParserOptionsProject, 26 | }); 27 | 28 | if (options.linter === 'eslint') { 29 | updateJson( 30 | host, 31 | joinPathFragments(options.projectDirectory, '.eslintrc.json'), 32 | (value) => { 33 | const config = { 34 | ...value, 35 | }; 36 | 37 | config['ignorePatterns'] = [ 38 | ...config['ignorePatterns'], 39 | '.mesh', 40 | '.codegen', 41 | ]; 42 | 43 | return config; 44 | } 45 | ); 46 | } 47 | 48 | return linting; 49 | } 50 | 51 | export default addLinting; 52 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/base/lib/create-files.ts: -------------------------------------------------------------------------------- 1 | import type { Tree } from '@nrwl/devkit'; 2 | 3 | import type { NormalizedOptions } from './normalize-options'; 4 | 5 | import { generateFiles } from '@nrwl/devkit'; 6 | import * as path from 'node:path'; 7 | 8 | export function createFiles(tree: Tree, options: NormalizedOptions) { 9 | if (options.isApp) { 10 | generateFiles( 11 | tree, 12 | path.join(__dirname, '../files/app'), 13 | options.projectDirectory, 14 | { ...options, tmpl: '' } 15 | ); 16 | } 17 | 18 | if (options.isLibrary) { 19 | tree.delete( 20 | `${options.projectDirectory}/src/lib/${options.projectName}.spec.ts` 21 | ); 22 | tree.delete( 23 | `${options.projectDirectory}/src/lib/${options.projectName}.ts` 24 | ); 25 | tree.delete(`${options.projectDirectory}/src/index.ts`); 26 | 27 | if ( 28 | options.isSwc && 29 | tree.exists(`${options.projectDirectory}/.lib.swcrc`) 30 | ) { 31 | tree.rename( 32 | `${options.projectDirectory}/.lib.swcrc`, 33 | `${options.projectDirectory}/.swcrc` 34 | ); 35 | } 36 | 37 | generateFiles( 38 | tree, 39 | path.join(__dirname, '../files/lib'), 40 | options.projectDirectory, 41 | { 42 | ...options, 43 | tmpl: '', 44 | } 45 | ); 46 | } 47 | } 48 | 49 | export default createFiles; 50 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/base/lib/index.ts: -------------------------------------------------------------------------------- 1 | export * from './add-cypress'; 2 | export * from './add-jest'; 3 | export * from './add-linting'; 4 | export * from './add-project-config'; 5 | export * from './create-files'; 6 | export * from './node-generator'; 7 | export * from './normalize-options'; 8 | export * from './set-defaults'; 9 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/base/lib/node-generator.ts: -------------------------------------------------------------------------------- 1 | import type { Tree } from '@nrwl/devkit'; 2 | 3 | import type { NormalizedOptions } from './normalize-options'; 4 | 5 | import { initGenerator, libraryGenerator } from '@nrwl/node'; 6 | 7 | export const nodeGenerator = async (tree: Tree, options: NormalizedOptions) => { 8 | if (options.isApp) { 9 | return initGenerator(tree, { 10 | js: options.js, 11 | skipFormat: options.skipFormat, 12 | unitTestRunner: options.unitTestRunner, 13 | }); 14 | } 15 | 16 | return libraryGenerator(tree, { 17 | babelJest: options.babelJest, 18 | buildable: options.buildable, 19 | compiler: options.compiler, 20 | directory: options._raw.directory, 21 | importPath: options.importPath, 22 | js: options.js, 23 | linter: options.linter, 24 | name: options.name, 25 | pascalCaseFiles: options.pascalCaseFiles, 26 | publishable: options.publishable, 27 | rootDir: options.rootDir, 28 | setParserOptionsProject: options.setParserOptionsProject, 29 | simpleModuleName: options.simpleModuleName, 30 | skipFormat: options.skipFormat, 31 | skipTsConfig: options.skipTsConfig, 32 | strict: options.strict, 33 | tags: options._raw.tags, 34 | testEnvironment: options.testEnvironment, 35 | unitTestRunner: options.unitTestRunner, 36 | }); 37 | }; 38 | 39 | export default nodeGenerator; 40 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/base/lib/set-defaults.ts: -------------------------------------------------------------------------------- 1 | import type { Tree } from '@nrwl/devkit'; 2 | 3 | import type { NormalizedOptions } from './normalize-options'; 4 | 5 | import { 6 | readWorkspaceConfiguration, 7 | updateWorkspaceConfiguration, 8 | } from '@nrwl/devkit'; 9 | 10 | export function setDefaults(host: Tree, options: NormalizedOptions) { 11 | const workspace = readWorkspaceConfiguration(host); 12 | 13 | if (!workspace.defaultProject) { 14 | workspace.defaultProject = options.projectName; 15 | } 16 | 17 | if (workspace.targetDefaults) { 18 | workspace.targetDefaults = { 19 | ...workspace.targetDefaults, 20 | validate: { 21 | dependsOn: ['build'], 22 | }, 23 | }; 24 | } 25 | 26 | workspace.generators = workspace.generators || {}; 27 | workspace.generators['nx-mesh'] = workspace.generators['nx-mesh'] || {}; 28 | 29 | const prev = workspace.generators['nx-mesh']; 30 | 31 | workspace.generators = { 32 | ...workspace.generators, 33 | 'nx-mesh': { 34 | ...prev, 35 | [options.isApp ? 'application' : 'sdk']: { 36 | meshConfig: options.meshConfigExt, 37 | linter: options.linter, 38 | ...prev[options.isApp ? 'application' : 'sdk'], 39 | }, 40 | }, 41 | }; 42 | 43 | if (!workspace.defaultProject) { 44 | workspace.defaultProject = options.name; 45 | } 46 | 47 | updateWorkspaceConfiguration(host, workspace); 48 | } 49 | 50 | export default setDefaults; 51 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/base/schema.d.ts: -------------------------------------------------------------------------------- 1 | import type { SetOptional } from 'type-fest'; 2 | import type { Schema as NodeLibrarySchema } from '@nrwl/node/src/generators/library/schema'; 3 | 4 | import type { ExampleName } from '../utils/create-mesh-example'; 5 | 6 | export type MeshConfigExtensions = 'cjs' | 'js' | 'json' | 'yml'; 7 | 8 | export interface BaseOptions 9 | extends SetOptional { 10 | codegen?: boolean; 11 | e2eTestRunner?: 'cypress' | 'none'; 12 | example?: ExampleName; 13 | meshConfig?: MeshConfigExtensions; 14 | projectType?: 'app' | 'lib'; 15 | } 16 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/preset/index.ts: -------------------------------------------------------------------------------- 1 | import { convertNxGenerator } from '@nrwl/devkit'; 2 | 3 | import { presetGenerator } from './preset'; 4 | 5 | export const presetSchematic = convertNxGenerator(presetGenerator); 6 | 7 | export { presetGenerator } from './preset'; 8 | 9 | export default presetGenerator; 10 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/preset/preset.spec.ts: -------------------------------------------------------------------------------- 1 | import type { Tree } from '@nrwl/devkit'; 2 | 3 | import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; 4 | import { readProjectConfiguration } from '@nrwl/devkit'; 5 | 6 | import { presetGenerator } from './preset'; 7 | 8 | describe('generators/preset', () => { 9 | let tree: Tree; 10 | 11 | beforeEach(() => { 12 | tree = createTreeWithEmptyWorkspace(); 13 | }); 14 | 15 | it('should create a workspace with the graphql-mesh sdk preset', async () => { 16 | await presetGenerator(tree, { 17 | name: 'hello-world', 18 | compiler: 'tsc', 19 | }); 20 | 21 | const config = readProjectConfiguration(tree, 'hello-world'); 22 | 23 | expect(config).toBeDefined(); 24 | expect(tree.exists('hello-world/.meshrc.yml')).toBe(true); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/preset/preset.ts: -------------------------------------------------------------------------------- 1 | import type { Tree } from '@nrwl/devkit'; 2 | 3 | import type { PresetGeneratorSchema } from './schema'; 4 | 5 | import { convertNxGenerator } from '@nrwl/devkit'; 6 | 7 | import { sdkGenerator } from '../sdk'; 8 | 9 | export async function presetGenerator( 10 | tree: Tree, 11 | options: PresetGeneratorSchema 12 | ) { 13 | return await sdkGenerator(tree, options); 14 | } 15 | 16 | export const presetSchematic = convertNxGenerator(presetGenerator); 17 | 18 | export default presetGenerator; 19 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/preset/schema.d.ts: -------------------------------------------------------------------------------- 1 | import type { SdkGeneratorSchema } from '../sdk/schema'; 2 | 3 | export type PresetGeneratorSchema = SdkGeneratorSchema; 4 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/sdk/index.ts: -------------------------------------------------------------------------------- 1 | import { convertNxGenerator } from '@nrwl/devkit'; 2 | 3 | import { sdkGenerator } from './sdk'; 4 | 5 | export const sdkSchematic = convertNxGenerator(sdkGenerator); 6 | 7 | export { sdkGenerator } from './sdk'; 8 | 9 | export default sdkGenerator; 10 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/sdk/schema.ts: -------------------------------------------------------------------------------- 1 | import type { Schema as NodeLibrarySchema } from '@nrwl/node/src/generators/library/schema'; 2 | 3 | export type MeshConfigExtensions = 'cjs' | 'js' | 'json' | 'yml'; 4 | 5 | export interface SdkGeneratorSchema extends NodeLibrarySchema { 6 | codegen?: boolean; 7 | meshConfig?: MeshConfigExtensions; 8 | } 9 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/sdk/sdk.ts: -------------------------------------------------------------------------------- 1 | import type { Tree } from '@nrwl/devkit'; 2 | 3 | import type { SdkGeneratorSchema } from './schema'; 4 | 5 | import { convertNxGenerator } from '@nrwl/devkit'; 6 | import { baseGenerator } from '../base'; 7 | 8 | export async function sdkGenerator(tree: Tree, options: SdkGeneratorSchema) { 9 | return await baseGenerator(tree, { 10 | ...options, 11 | projectType: 'lib', 12 | }); 13 | } 14 | 15 | export const sdkSchematic = convertNxGenerator(sdkGenerator); 16 | 17 | export default sdkGenerator; 18 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/add-dependencies.ts: -------------------------------------------------------------------------------- 1 | import type { Tree } from '@nrwl/devkit'; 2 | 3 | import type { CreateMeshExampleOptions } from './types'; 4 | 5 | import { addDependenciesToPackageJson } from '@nrwl/devkit'; 6 | 7 | import { versions } from '../../../utils/versions'; 8 | import examples from './examples'; 9 | 10 | export function addDependencies( 11 | host: Tree, 12 | options: Pick 13 | ) { 14 | let exampleDeps = { 15 | ...versions['@graphql-mesh/cli'], 16 | ...versions['@graphql-mesh/runtime'], 17 | ...versions['@graphql-mesh/utils'], 18 | ...versions['graphql'], 19 | ...versions['@graphql-typed-document-node/core'], 20 | }; 21 | 22 | examples[options.example].dependencies.forEach((dep) => { 23 | exampleDeps = { 24 | ...exampleDeps, 25 | ...versions[dep], 26 | }; 27 | }); 28 | 29 | if (options.codegen) { 30 | exampleDeps = { 31 | ...exampleDeps, 32 | ...versions['@graphql-codegen/cli'], 33 | }; 34 | 35 | examples[options.example].codegenDependencies.forEach((dep) => { 36 | exampleDeps = { 37 | ...exampleDeps, 38 | ...versions[dep], 39 | }; 40 | }); 41 | } 42 | 43 | return addDependenciesToPackageJson(host, exampleDeps, {}); 44 | } 45 | 46 | export default addDependencies; 47 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/create-codegen-files.spec.ts: -------------------------------------------------------------------------------- 1 | import type { Tree } from '@nrwl/devkit'; 2 | import type { CreateMeshExampleOptions } from './types'; 3 | 4 | import { getWorkspaceLayout, joinPathFragments } from '@nrwl/devkit'; 5 | import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; 6 | 7 | import { createCodegenFiles } from './create-codegen-files'; 8 | 9 | describe('createCodegenFiles', () => { 10 | let tree: Tree; 11 | let projectDirectory: string; 12 | 13 | beforeEach(() => { 14 | tree = createTreeWithEmptyWorkspace(); 15 | 16 | const workspace = getWorkspaceLayout(tree); 17 | 18 | projectDirectory = joinPathFragments(workspace.libsDir, 'test'); 19 | }); 20 | 21 | afterEach(() => { 22 | jest.restoreAllMocks(); 23 | }); 24 | 25 | describe.each([ 26 | 'country-info', 27 | 'fake-api', 28 | 'javascript-wiki', 29 | 'movies', 30 | 'rfam', 31 | 'stackexchange', 32 | 'star-wars', 33 | 'trippin', 34 | ])(`codegen - %s`, (example) => { 35 | it('should create a codegen files', () => { 36 | const expectedConfigPath = `${projectDirectory}/codegen.ts`; 37 | 38 | createCodegenFiles(tree, { 39 | example, 40 | projectDirectory, 41 | }); 42 | 43 | expect(tree.exists(`${projectDirectory}/codegen.ts`)).toBeTruthy(); 44 | expect(tree.exists(`${projectDirectory}/src/lib/client.ts`)).toBeTruthy(); 45 | 46 | const meshConfig = tree.read(expectedConfigPath, 'utf-8'); 47 | 48 | expect(meshConfig).toMatchSnapshot(); 49 | }); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/create-codegen-files.ts: -------------------------------------------------------------------------------- 1 | import type { Tree } from '@nrwl/devkit'; 2 | import type { SetOptional } from 'type-fest'; 3 | 4 | import type { CreateMeshExampleOptions } from './types'; 5 | 6 | import { generateFiles } from '@nrwl/devkit'; 7 | import * as path from 'node:path'; 8 | 9 | export function createCodegenFiles( 10 | tree: Tree, 11 | options: SetOptional 12 | ) { 13 | const examplePath = `./examples/${options.example}/codegen`; 14 | 15 | generateFiles( 16 | tree, 17 | path.join(__dirname, examplePath), 18 | options.projectDirectory, 19 | { 20 | projectDirectory: options.projectDirectory, 21 | tmpl: '', 22 | } 23 | ); 24 | } 25 | 26 | export default createCodegenFiles; 27 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/create-mesh-example.ts: -------------------------------------------------------------------------------- 1 | import type { Tree } from '@nrwl/devkit'; 2 | import type { CreateMeshExampleOptions } from './types'; 3 | 4 | import { addDependencies } from './add-dependencies'; 5 | import { createCodegenFiles } from './create-codegen-files'; 6 | import { createSharedFiles } from './create-shared-files'; 7 | 8 | export function createMeshExample( 9 | tree: Tree, 10 | options: CreateMeshExampleOptions 11 | ) { 12 | createSharedFiles(tree, options); 13 | 14 | addDependencies(tree, { 15 | codegen: options.codegen, 16 | example: options.example, 17 | }); 18 | 19 | if (options.isSdk && options.codegen) { 20 | createCodegenFiles(tree, options); 21 | } 22 | } 23 | 24 | export default createMeshExample; 25 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/create-shared-files.ts: -------------------------------------------------------------------------------- 1 | import type { Tree } from '@nrwl/devkit'; 2 | import type { CreateMeshExampleOptions } from './types'; 3 | 4 | import { generateFiles } from '@nrwl/devkit'; 5 | import * as path from 'node:path'; 6 | 7 | export function createSharedFiles( 8 | tree: Tree, 9 | options: CreateMeshExampleOptions 10 | ) { 11 | const examplePath = `./examples/${options.example}/shared`; 12 | 13 | generateFiles( 14 | tree, 15 | path.join(__dirname, examplePath), 16 | options.projectDirectory, 17 | { 18 | configExtension: options.configExtension, 19 | isSdk: options.isSdk, 20 | projectDirectory: options.projectDirectory, 21 | tmpl: '', 22 | } 23 | ); 24 | } 25 | 26 | export default createSharedFiles; 27 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/country-info/codegen/codegen.__tmpl__ts: -------------------------------------------------------------------------------- 1 | <% 2 | // Test output in playground 3 | // https://ionicabizau.github.io/ejs-playground/ 4 | 5 | // Input variables 6 | // const projectDirectory = ''; 7 | 8 | -%> 9 | 10 | import type { CodegenConfig } from '@graphql-codegen/cli'; 11 | 12 | const config: CodegenConfig = { 13 | overwrite: true, 14 | schema: '<%= projectDirectory %>/.mesh/schema.graphql', 15 | documents: 16 | '<%= projectDirectory %>/src/graphql/**/*.*.graphql', 17 | generates: { 18 | '<%= projectDirectory %>/.codegen/': { 19 | preset: 'client', 20 | plugins: [], 21 | }, 22 | }, 23 | }; 24 | 25 | export default config; 26 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/country-info/codegen/src/lib/client.__tmpl__ts: -------------------------------------------------------------------------------- 1 | export * from '../../.codegen'; 2 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/country-info/dependencies.ts: -------------------------------------------------------------------------------- 1 | import type { CodegenDependencies, MeshDependencies } from '../../types'; 2 | 3 | export const dependencies: MeshDependencies = ['@graphql-mesh/soap']; 4 | 5 | export const codegenDependencies: CodegenDependencies = [ 6 | '@graphql-codegen/client-preset', 7 | ]; 8 | 9 | export default dependencies; 10 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/country-info/index.ts: -------------------------------------------------------------------------------- 1 | import type { ExampleDependencies } from '../../types'; 2 | 3 | import { codegenDependencies, dependencies } from './dependencies'; 4 | 5 | export const config: ExampleDependencies = { 6 | codegenDependencies, 7 | dependencies, 8 | }; 9 | 10 | export default config; 11 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/country-info/shared/.meshrc.__configExtension__: -------------------------------------------------------------------------------- 1 | <% 2 | // Test output in playground 3 | // https://ionicabizau.github.io/ejs-playground/ 4 | 5 | // Input variables 6 | // const configExtension = 'yml'; 7 | // const isSdk = true; 8 | 9 | // Inline variables 10 | const name = 'CountryInfo'; 11 | const handler = 'soap' 12 | const source = 'http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL'; 13 | const browser = false; 14 | const fileRoot = './src/'; 15 | const documents = `${fileRoot}graphql/**/*.*.graphql`; 16 | 17 | if (configExtension === 'cjs' || configExtension ==='js') { -%> 18 | module.exports = { 19 | sources: [ 20 | { 21 | name: '<%= name %>', 22 | handler: { 23 | <%= handler %>: { 24 | source: 25 | '<%= source %>', 26 | }, 27 | }, 28 | }, 29 | ], 30 | serve: { 31 | browser: <%= browser %>, 32 | }, 33 | documents: ['<%= documents %>'], 34 | }; 35 | <% } else if (configExtension === 'json') { -%> 36 | { 37 | "sources": [ 38 | { 39 | "name": "<%= name %>", 40 | "handler": { 41 | "<%= handler %>": { 42 | "source": "<%= source %>" 43 | } 44 | } 45 | } 46 | ], 47 | "serve": { 48 | "browser": <%= browser %> 49 | }, 50 | "documents": ['<%= documents %>'] 51 | } 52 | <% } else if (configExtension === 'yml') { -%> 53 | sources: 54 | - name: <%= name %> 55 | handler: 56 | <%= handler %>: 57 | source: <%= source %> 58 | 59 | serve: 60 | browser: false 61 | 62 | documents: 63 | - <%= documents %> 64 | <% }-%> 65 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/country-info/shared/src/graphql/GetLanguages.query.graphql__tmpl__: -------------------------------------------------------------------------------- 1 | query GetLanguages { 2 | CountryInfoService_CountryInfoService_CountryInfoServiceSoap_ListOfLanguagesByName { 3 | ListOfLanguagesByNameResult { 4 | tLanguage { 5 | sISOCode 6 | sName 7 | } 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/fake-api/codegen/codegen.__tmpl__ts: -------------------------------------------------------------------------------- 1 | <% 2 | // Test output in playground 3 | // https://ionicabizau.github.io/ejs-playground/ 4 | 5 | // Input variables 6 | // const projectDirectory = ''; 7 | 8 | -%> 9 | 10 | import type { CodegenConfig } from '@graphql-codegen/cli'; 11 | 12 | const config: CodegenConfig = { 13 | overwrite: true, 14 | schema: '<%= projectDirectory %>/.mesh/schema.graphql', 15 | documents: 16 | '<%= projectDirectory %>/src/graphql/**/*.*.graphql', 17 | generates: { 18 | '<%= projectDirectory %>/.codegen/': { 19 | preset: 'client', 20 | plugins: [], 21 | }, 22 | }, 23 | }; 24 | 25 | export default config; 26 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/fake-api/codegen/src/lib/client.__tmpl__ts: -------------------------------------------------------------------------------- 1 | export * from '../../.codegen'; 2 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/fake-api/dependencies.ts: -------------------------------------------------------------------------------- 1 | import type { CodegenDependencies, MeshDependencies } from '../../types'; 2 | 3 | export const dependencies: MeshDependencies = [ 4 | '@graphql-mesh/json-schema', 5 | '@graphql-mesh/plugin-mock', 6 | ]; 7 | 8 | export const codegenDependencies: CodegenDependencies = [ 9 | '@graphql-codegen/client-preset', 10 | ]; 11 | 12 | export default dependencies; 13 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/fake-api/index.ts: -------------------------------------------------------------------------------- 1 | import type { ExampleDependencies } from '../../types'; 2 | 3 | import { codegenDependencies, dependencies } from './dependencies'; 4 | 5 | export const config: ExampleDependencies = { 6 | codegenDependencies, 7 | dependencies, 8 | }; 9 | 10 | export default config; 11 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/fake-api/shared/src/graphql/getMe.query.graphql__tmpl__: -------------------------------------------------------------------------------- 1 | query getMe { 2 | me { 3 | firstName 4 | lastName 5 | jobTitle 6 | company { 7 | name 8 | type 9 | employers { 10 | firstName 11 | lastName 12 | jobTitle 13 | } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/fake-api/shared/src/json-samples/user-input.json__tmpl__: -------------------------------------------------------------------------------- 1 | { 2 | "firstName": "John", 3 | "lastName": "Doe", 4 | "jobTitle": "Software Developer" 5 | } 6 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/fake-api/shared/src/json-schemas/company.json__tmpl__: -------------------------------------------------------------------------------- 1 | { 2 | "definitions": { 3 | "Company": { 4 | "type": "object", 5 | "title": "Company", 6 | "description": "Fake Company", 7 | "properties": { 8 | "name": { 9 | "type": "string" 10 | }, 11 | "type": { 12 | "type": "object", 13 | "items": { 14 | "$ref": "#/definitions/CompanyType" 15 | } 16 | } 17 | } 18 | }, 19 | "CompanyType": { 20 | "type": "string", 21 | "title": "CompanyType", 22 | "enum": ["Public Limited", "Private Limited", "One Person"] 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/fake-api/shared/src/json-schemas/user.json__tmpl__: -------------------------------------------------------------------------------- 1 | { 2 | "definitions": { 3 | "User": { 4 | "type": "object", 5 | "title": "User", 6 | "description": "Fake User Object", 7 | "properties": { 8 | "firstName": { 9 | "type": "string" 10 | }, 11 | "lastName": { 12 | "type": "string" 13 | }, 14 | "jobTitle": { 15 | "type": "string" 16 | }, 17 | "companyId": { 18 | "type": "string" 19 | }, 20 | "birthDate": { 21 | "type": "string", 22 | "example": "1993-12-20" 23 | }, 24 | "foos": { 25 | "type": "array", 26 | "items": { 27 | "$ref": "user.json#/definitions/Foo" 28 | } 29 | } 30 | } 31 | }, 32 | "Foo": { 33 | "type": "object", 34 | "properties": { 35 | "id": { 36 | "type": "string" 37 | } 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/index.ts: -------------------------------------------------------------------------------- 1 | import type { ExampleConfig } from '../types'; 2 | 3 | import * as countryInfo from './country-info'; 4 | import * as fakeApi from './fake-api'; 5 | import * as javascriptWiki from './javascript-wiki'; 6 | import * as movies from './movies'; 7 | import * as rfam from './rfam'; 8 | import * as stackexchange from './stackexchange'; 9 | import * as starWarsApi from './star-wars'; 10 | import * as trippin from './trippin'; 11 | 12 | export const examples: ExampleConfig = { 13 | 'country-info': countryInfo.config, 14 | 'fake-api': fakeApi.config, 15 | 'javascript-wiki': javascriptWiki.config, 16 | movies: movies.config, 17 | rfam: rfam.config, 18 | stackexchange: stackexchange.config, 19 | 'star-wars': starWarsApi.config, 20 | trippin: trippin.config, 21 | }; 22 | 23 | export default examples; 24 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/javascript-wiki/codegen/codegen.__tmpl__ts: -------------------------------------------------------------------------------- 1 | <% 2 | // Test output in playground 3 | // https://ionicabizau.github.io/ejs-playground/ 4 | 5 | // Input variables 6 | // const projectDirectory = ''; 7 | 8 | -%> 9 | 10 | import type { CodegenConfig } from '@graphql-codegen/cli'; 11 | 12 | const config: CodegenConfig = { 13 | overwrite: true, 14 | schema: '<%= projectDirectory %>/.mesh/schema.graphql', 15 | generates: { 16 | '<%= projectDirectory %>/.codegen/': { 17 | preset: 'client', 18 | plugins: [], 19 | }, 20 | }, 21 | }; 22 | 23 | export default config; 24 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/javascript-wiki/codegen/src/lib/client.__tmpl__ts: -------------------------------------------------------------------------------- 1 | export * from '../../.codegen'; 2 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/javascript-wiki/dependencies.ts: -------------------------------------------------------------------------------- 1 | import type { CodegenDependencies, MeshDependencies } from '../../types'; 2 | 3 | export const dependencies: MeshDependencies = ['@graphql-mesh/openapi']; 4 | 5 | export const codegenDependencies: CodegenDependencies = [ 6 | '@graphql-codegen/client-preset', 7 | ]; 8 | 9 | export default dependencies; 10 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/javascript-wiki/index.ts: -------------------------------------------------------------------------------- 1 | import type { ExampleDependencies } from '../../types'; 2 | 3 | import { codegenDependencies, dependencies } from './dependencies'; 4 | 5 | export const config: ExampleDependencies = { 6 | codegenDependencies, 7 | dependencies, 8 | }; 9 | 10 | export default config; 11 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/javascript-wiki/shared/.meshrc.__configExtension__: -------------------------------------------------------------------------------- 1 | <% 2 | // Test output in playground 3 | // https://ionicabizau.github.io/ejs-playground/ 4 | 5 | // Input variables 6 | // const configExtension = 'yml'; 7 | // const isSdk = true; 8 | 9 | // Inline variables 10 | const name = 'JavaScript Wiki'; 11 | const handler = 'openapi'; 12 | const source = 'https://api.apis.guru/v2/specs/wikimedia.org/1.0.0/swagger.yaml'; 13 | const browser = false; 14 | const selectionSetDepth = 6; 15 | 16 | if (configExtension === 'cjs' || configExtension ==='js') { -%> 17 | module.exports = { 18 | sources: [ 19 | { 20 | name: '<%= name %>', 21 | handler: { 22 | <%= handler %>: { 23 | source: 24 | '<%= source %>', 25 | }, 26 | }, 27 | }, 28 | ], 29 | serve: { 30 | browser: <%= browser %>, 31 | }, 32 | <% if (isSdk) { -%> 33 | sdk: { 34 | generateOperations: { 35 | selectionSetDepth: <%= selectionSetDepth %>, 36 | }, 37 | }, 38 | <% } -%> 39 | }; 40 | <% } else if (configExtension === 'json') { -%> 41 | { 42 | "sources": [ 43 | { 44 | "name": "<%= name %>", 45 | "handler": { 46 | "<%= handler %>": { 47 | "source": "<%= source %>" 48 | } 49 | } 50 | } 51 | ], 52 | "serve": { 53 | "browser": <%= browser %> 54 | }<% if (isSdk) { -%>, 55 | "sdk": { 56 | "generateOperations": { 57 | "selectionSetDepth": <%= selectionSetDepth %> 58 | } 59 | } 60 | <% } -%> 61 | } 62 | <% } else if (configExtension === 'yml') { -%> 63 | sources: 64 | - name: <%= name %> 65 | handler: 66 | <%= handler %>: 67 | source: <%= source %> 68 | 69 | serve: 70 | browser: false 71 | 72 | <% if (isSdk) { -%> 73 | sdk: 74 | generateOperations: 75 | selectionSetDepth: <%= selectionSetDepth %> 76 | <% } -%> 77 | <% }-%> 78 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/movies/codegen/codegen.__tmpl__ts: -------------------------------------------------------------------------------- 1 | <% 2 | // Test output in playground 3 | // https://ionicabizau.github.io/ejs-playground/ 4 | 5 | // Input variables 6 | // const projectDirectory = ''; 7 | 8 | -%> 9 | 10 | import type { CodegenConfig } from '@graphql-codegen/cli'; 11 | 12 | const config: CodegenConfig = { 13 | overwrite: true, 14 | schema: '<%= projectDirectory %>/.mesh/schema.graphql', 15 | documents: 16 | '<%= projectDirectory %>/src/graphql/**/*.*.graphql', 17 | generates: { 18 | '<%= projectDirectory %>/.codegen/': { 19 | preset: 'client', 20 | plugins: [], 21 | }, 22 | }, 23 | }; 24 | 25 | export default config; 26 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/movies/codegen/src/lib/client.__tmpl__ts: -------------------------------------------------------------------------------- 1 | export * from '../../.codegen'; 2 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/movies/dependencies.ts: -------------------------------------------------------------------------------- 1 | import type { CodegenDependencies, MeshDependencies } from '../../types'; 2 | 3 | export const dependencies: MeshDependencies = ['@graphql-mesh/neo4j']; 4 | 5 | export const codegenDependencies: CodegenDependencies = [ 6 | '@graphql-codegen/client-preset', 7 | ]; 8 | 9 | export default dependencies; 10 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/movies/index.ts: -------------------------------------------------------------------------------- 1 | import type { ExampleDependencies } from '../../types'; 2 | 3 | import { codegenDependencies, dependencies } from './dependencies'; 4 | 5 | export const config: ExampleDependencies = { 6 | codegenDependencies, 7 | dependencies, 8 | }; 9 | 10 | export default config; 11 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/movies/shared/src/graphql/example.query.graphql__tmpl__: -------------------------------------------------------------------------------- 1 | query MovieWithActedIn { 2 | movies(options: { limit: 2 }) { 3 | title 4 | released 5 | tagline 6 | peopleActedIn(options: { limit: 2 }) { 7 | name 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/rfam/codegen/codegen.__tmpl__ts: -------------------------------------------------------------------------------- 1 | <% 2 | // Test output in playground 3 | // https://ionicabizau.github.io/ejs-playground/ 4 | 5 | // Input variables 6 | // const projectDirectory = ''; 7 | 8 | -%> 9 | 10 | import type { CodegenConfig } from '@graphql-codegen/cli'; 11 | 12 | const config: CodegenConfig = { 13 | overwrite: true, 14 | schema: '<%= projectDirectory %>/.mesh/schema.graphql', 15 | documents: 16 | '<%= projectDirectory %>/src/graphql/**/*.*.graphql', 17 | generates: { 18 | '<%= projectDirectory %>/.codegen/': { 19 | preset: 'client', 20 | plugins: [], 21 | config: { 22 | enumsAsTypes: true, 23 | }, 24 | }, 25 | }, 26 | }; 27 | 28 | export default config; 29 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/rfam/codegen/src/lib/client.__tmpl__ts: -------------------------------------------------------------------------------- 1 | export * from '../../.codegen'; 2 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/rfam/dependencies.ts: -------------------------------------------------------------------------------- 1 | import type { CodegenDependencies, MeshDependencies } from '../../types'; 2 | 3 | export const dependencies: MeshDependencies = ['@graphql-mesh/mysql']; 4 | 5 | export const codegenDependencies: CodegenDependencies = [ 6 | '@graphql-codegen/client-preset', 7 | ]; 8 | 9 | export default dependencies; 10 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/rfam/index.ts: -------------------------------------------------------------------------------- 1 | import type { ExampleDependencies } from '../../types'; 2 | 3 | import { codegenDependencies, dependencies } from './dependencies'; 4 | 5 | export const config: ExampleDependencies = { 6 | codegenDependencies, 7 | dependencies, 8 | }; 9 | 10 | export default config; 11 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/rfam/shared/src/graphql/getAlignmentTree.query.graphql__tmpl__: -------------------------------------------------------------------------------- 1 | query getAlignmentTree { 2 | alignment_and_tree(limit: 5) { 3 | rfam_acc 4 | family(limit: 1) { 5 | type 6 | description 7 | comment 8 | author 9 | created 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/stackexchange/codegen/codegen.__tmpl__ts: -------------------------------------------------------------------------------- 1 | <% 2 | // Test output in playground 3 | // https://ionicabizau.github.io/ejs-playground/ 4 | 5 | // Input variables 6 | // const projectDirectory = ''; 7 | 8 | -%> 9 | 10 | import type { CodegenConfig } from '@graphql-codegen/cli'; 11 | 12 | const config: CodegenConfig = { 13 | overwrite: true, 14 | schema: '<%= projectDirectory %>/.mesh/schema.graphql', 15 | generates: { 16 | '<%= projectDirectory %>/.codegen/': { 17 | preset: 'client', 18 | plugins: [], 19 | }, 20 | }, 21 | }; 22 | 23 | export default config; 24 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/stackexchange/codegen/src/lib/client.__tmpl__ts: -------------------------------------------------------------------------------- 1 | export * from '../../.codegen'; 2 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/stackexchange/dependencies.ts: -------------------------------------------------------------------------------- 1 | import type { CodegenDependencies, MeshDependencies } from '../../types'; 2 | 3 | export const dependencies: MeshDependencies = ['@graphql-mesh/openapi']; 4 | 5 | export const codegenDependencies: CodegenDependencies = [ 6 | '@graphql-codegen/client-preset', 7 | ]; 8 | 9 | export default dependencies; 10 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/stackexchange/index.ts: -------------------------------------------------------------------------------- 1 | import type { ExampleDependencies } from '../../types'; 2 | 3 | import { codegenDependencies, dependencies } from './dependencies'; 4 | 5 | export const config: ExampleDependencies = { 6 | codegenDependencies, 7 | dependencies, 8 | }; 9 | 10 | export default config; 11 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/star-wars/codegen/codegen.__tmpl__ts: -------------------------------------------------------------------------------- 1 | <% 2 | // Test output in playground 3 | // https://ionicabizau.github.io/ejs-playground/ 4 | 5 | // Input variables 6 | // const projectDirectory = ''; 7 | 8 | -%> 9 | 10 | import type { CodegenConfig } from '@graphql-codegen/cli'; 11 | 12 | const config: CodegenConfig = { 13 | overwrite: true, 14 | schema: '<%= projectDirectory %>/.mesh/schema.graphql', 15 | documents: 16 | '<%= projectDirectory %>/src/graphql/**/*.*.graphql', 17 | generates: { 18 | '<%= projectDirectory %>/.codegen/': { 19 | preset: 'client', 20 | plugins: [], 21 | }, 22 | }, 23 | }; 24 | 25 | export default config; 26 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/star-wars/codegen/src/lib/client.__tmpl__ts: -------------------------------------------------------------------------------- 1 | export * from '../../.codegen'; 2 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/star-wars/dependencies.ts: -------------------------------------------------------------------------------- 1 | import type { CodegenDependencies, MeshDependencies } from '../../types'; 2 | 3 | export const dependencies: MeshDependencies = ['@graphql-mesh/graphql']; 4 | 5 | export const codegenDependencies: CodegenDependencies = [ 6 | '@graphql-codegen/client-preset', 7 | ]; 8 | 9 | export default dependencies; 10 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/star-wars/index.ts: -------------------------------------------------------------------------------- 1 | import type { ExampleDependencies } from '../../types'; 2 | 3 | import { codegenDependencies, dependencies } from './dependencies'; 4 | 5 | export const config: ExampleDependencies = { 6 | codegenDependencies, 7 | dependencies, 8 | }; 9 | 10 | export default config; 11 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/star-wars/shared/.meshrc.__configExtension__: -------------------------------------------------------------------------------- 1 | <% 2 | // Test output in playground 3 | // https://ionicabizau.github.io/ejs-playground/ 4 | 5 | // Input variables 6 | // const configExtension = 'yml'; 7 | // const isSdk = true; 8 | 9 | // Inline variables 10 | const name = 'StarWarsApi'; 11 | const handler = 'graphql' 12 | const source = 'https://swapi-graphql.netlify.app/.netlify/functions/index'; 13 | const browser = false; 14 | const fileRoot = './src/'; 15 | const documents = `${fileRoot}graphql/**/*.*.graphql`; 16 | 17 | if (configExtension === 'cjs' || configExtension ==='js') { -%> 18 | module.exports = { 19 | sources: [ 20 | { 21 | name: '<%= name %>', 22 | handler: { 23 | <%= handler %>: { 24 | endpoint: 25 | '<%= source %>', 26 | }, 27 | }, 28 | }, 29 | ], 30 | serve: { 31 | browser: <%= browser %>, 32 | }, 33 | documents: ['<%= documents %>'], 34 | }; 35 | <% } else if (configExtension === 'json') { -%> 36 | { 37 | "sources": [ 38 | { 39 | "name": "<%= name %>", 40 | "handler": { 41 | "<%= handler %>": { 42 | "endpoint": "<%= source %>" 43 | } 44 | } 45 | } 46 | ], 47 | "serve": { 48 | "browser": <%= browser %> 49 | }, 50 | "documents": ['<%= documents %>'] 51 | } 52 | <% } else if (configExtension === 'yml') { -%> 53 | sources: 54 | - name: <%= name %> 55 | handler: 56 | <%= handler %>: 57 | endpoint: <%= source %> 58 | 59 | serve: 60 | browser: false 61 | 62 | documents: 63 | - <%= documents %> 64 | <% }-%> 65 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/star-wars/shared/src/graphql/getMovies.query.graphql__tmpl__: -------------------------------------------------------------------------------- 1 | query getMovies { 2 | allFilms { 3 | films { 4 | title 5 | director 6 | releaseDate 7 | speciesConnection { 8 | species { 9 | name 10 | classification 11 | homeworld { 12 | name 13 | } 14 | } 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/trippin/codegen/codegen.__tmpl__ts: -------------------------------------------------------------------------------- 1 | <% 2 | // Test output in playground 3 | // https://ionicabizau.github.io/ejs-playground/ 4 | 5 | // Input variables 6 | // const projectDirectory = ''; 7 | 8 | -%> 9 | 10 | import type { CodegenConfig } from '@graphql-codegen/cli'; 11 | 12 | const config: CodegenConfig = { 13 | overwrite: true, 14 | schema: '<%= projectDirectory %>/.mesh/schema.graphql', 15 | documents: 16 | '<%= projectDirectory %>/src/graphql/**/*.*.graphql', 17 | generates: { 18 | '<%= projectDirectory %>/.codegen/': { 19 | preset: 'client', 20 | plugins: [], 21 | }, 22 | }, 23 | }; 24 | 25 | export default config; 26 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/trippin/codegen/src/lib/client.__tmpl__ts: -------------------------------------------------------------------------------- 1 | export * from '../../.codegen'; 2 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/trippin/dependencies.ts: -------------------------------------------------------------------------------- 1 | import type { CodegenDependencies, MeshDependencies } from '../../types'; 2 | 3 | export const dependencies: MeshDependencies = ['@graphql-mesh/odata']; 4 | 5 | export const codegenDependencies: CodegenDependencies = [ 6 | '@graphql-codegen/client-preset', 7 | ]; 8 | 9 | export default dependencies; 10 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/trippin/index.ts: -------------------------------------------------------------------------------- 1 | import type { ExampleDependencies } from '../../types'; 2 | 3 | import { codegenDependencies, dependencies } from './dependencies'; 4 | 5 | export const config: ExampleDependencies = { 6 | codegenDependencies, 7 | dependencies, 8 | }; 9 | 10 | export default config; 11 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/examples/trippin/shared/src/graphql/airports/getAirports.query.graphql__tmpl__: -------------------------------------------------------------------------------- 1 | query getAirports { 2 | Airports { 3 | Name 4 | Location { 5 | Address 6 | City { 7 | Name 8 | Region 9 | CountryRegion 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/index.ts: -------------------------------------------------------------------------------- 1 | export * from './create-mesh-example'; 2 | export * from './types'; 3 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/generators/utils/create-mesh-example/types.ts: -------------------------------------------------------------------------------- 1 | import type { CodegenPackages, MeshPackages } from '../../../utils'; 2 | 3 | export type CodegenDependencies = CodegenPackages[]; 4 | 5 | export type MeshDependencies = MeshPackages[]; 6 | 7 | export type ExampleName = 8 | | 'country-info' 9 | | 'fake-api' 10 | | 'javascript-wiki' 11 | | 'movies' 12 | | 'rfam' 13 | | 'stackexchange' 14 | | 'star-wars' 15 | | 'trippin'; 16 | 17 | export type ExampleDependencies = { 18 | dependencies: MeshDependencies; 19 | codegenDependencies: CodegenDependencies; 20 | }; 21 | 22 | export type ExampleConfig = Record; 23 | 24 | export type CreateMeshExampleOptions = { 25 | codegen?: boolean; 26 | configExtension: 'cjs' | 'js' | 'json' | 'yml'; 27 | example: ExampleName; 28 | isSdk: boolean; 29 | projectDirectory: string; 30 | }; 31 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './utils'; 2 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/migrations/4.0.0/rename-swcrc-config/index.ts: -------------------------------------------------------------------------------- 1 | export * from './rename-swcrc-config'; 2 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/get-mesh-packages.spec.ts: -------------------------------------------------------------------------------- 1 | import { meshPackages } from './mesh-packages'; 2 | 3 | import { getMeshPackages } from './get-mesh-packages'; 4 | 5 | const createMockFile = (packages: string[]) => { 6 | let contents = ''; 7 | 8 | packages.forEach((packageName) => { 9 | contents = `${contents} import abc from '${packageName}';`; 10 | }); 11 | 12 | return contents; 13 | }; 14 | 15 | const mockFile = createMockFile(meshPackages); 16 | 17 | describe('getMeshPackages', () => { 18 | it.each([...meshPackages])( 19 | 'should detect "%s" as a dependency', 20 | async (packageName) => { 21 | const deps = getMeshPackages(mockFile, meshPackages); 22 | 23 | expect(deps).toContain(packageName); 24 | } 25 | ); 26 | }); 27 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/get-mesh-packages.ts: -------------------------------------------------------------------------------- 1 | export const getMeshPackages = (source: string, packages: string[]) => { 2 | const deps: string[] = []; 3 | 4 | packages.forEach((packageName) => { 5 | if (source.indexOf(packageName) > -1) { 6 | deps.push(packageName); 7 | } 8 | }); 9 | 10 | return deps; 11 | }; 12 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/get-package-versions.spec.ts: -------------------------------------------------------------------------------- 1 | import type { ProjectGraphExternalNode } from '@nrwl/devkit'; 2 | 3 | import { meshPackages } from './mesh-packages'; 4 | 5 | import { getPackageVersions } from './get-package-versions'; 6 | 7 | const mockExternalNodes: Record = 8 | Object.fromEntries( 9 | [...meshPackages, 'graphql'].map((name) => [ 10 | `npm:${name}`, 11 | { 12 | type: 'npm', 13 | name: `npm:${name}`, 14 | data: { 15 | version: '0.0.0', 16 | packageName: name, 17 | }, 18 | }, 19 | ]) 20 | ); 21 | 22 | describe('getPackageVersions', () => { 23 | it.each([...meshPackages])('should get the version of "%s"', async (name) => { 24 | const expected = { 25 | [name]: '0.0.0', 26 | }; 27 | 28 | const deps = getPackageVersions([name], mockExternalNodes); 29 | 30 | expect(deps).toMatchObject(expected); 31 | }); 32 | 33 | it.each([...meshPackages])( 34 | 'should skip %s if not listed in external nodes', 35 | (name) => { 36 | const expected = {}; 37 | 38 | const deps = getPackageVersions([name], mockExternalNodes); 39 | 40 | expect(deps).toMatchObject(expected); 41 | } 42 | ); 43 | 44 | it('should return skip lookup if there are no external nodes', () => { 45 | const expected = {}; 46 | 47 | const deps = getPackageVersions(['graphql']); 48 | 49 | expect(deps).toMatchObject(expected); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/get-package-versions.ts: -------------------------------------------------------------------------------- 1 | import type { ProjectGraphExternalNode } from '@nrwl/devkit'; 2 | 3 | export const getPackageVersions = ( 4 | packages: string[], 5 | externalNodes?: Record 6 | ) => { 7 | if (externalNodes === undefined) { 8 | return {}; 9 | } 10 | 11 | const deps: Record = {}; 12 | 13 | packages.forEach((name) => { 14 | const depNode = externalNodes[`npm:${name}`]; 15 | 16 | if (depNode) { 17 | deps[name] = depNode.data.version; 18 | } 19 | }); 20 | 21 | return deps; 22 | }; 23 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/get-source-file.ts: -------------------------------------------------------------------------------- 1 | import { readFile } from 'node:fs/promises'; 2 | import { resolve, join } from 'node:path'; 3 | 4 | export type GetSourceFileProps = { 5 | dir: string; 6 | root: string; 7 | sourcePath?: string; 8 | }; 9 | 10 | export const getSourceFile = async (props: GetSourceFileProps) => { 11 | const { root, dir, sourcePath } = Object.assign( 12 | { 13 | sourcePath: '.mesh/index.ts', 14 | }, 15 | props 16 | ); 17 | 18 | const dirPath = resolve(root, dir); 19 | const sourceFilePath = join(dirPath, sourcePath); 20 | 21 | return await readFile(sourceFilePath, 'utf8'); 22 | }; 23 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/get-wildcard-packages.spec.ts: -------------------------------------------------------------------------------- 1 | import { getWildcardPackages } from './get-wildcard-packages'; 2 | 3 | describe('getWildcardPackages', () => { 4 | it('should get the package names listed in dependencies where the version is *', async () => { 5 | const expected = ['abc', '@test/abc']; 6 | 7 | const deps = getWildcardPackages({ 8 | abc: '*', 9 | '@test/abc': '*', 10 | '@test/not-this': '1.0.0', 11 | }); 12 | 13 | expect(deps).toStrictEqual(expected); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/get-wildcard-packages.ts: -------------------------------------------------------------------------------- 1 | export const getWildcardPackages = (dependencies: Record) => 2 | Object.keys(dependencies).filter((name) => dependencies[name] === '*'); 3 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/graphql-codegen-cli/cli.ts: -------------------------------------------------------------------------------- 1 | import type { ExecutorContext } from '@nrwl/devkit'; 2 | import type { ChildProcess, ForkOptions } from 'node:child_process'; 3 | 4 | import type { Arguments } from './arguments'; 5 | 6 | import { spawn } from 'node:child_process'; 7 | 8 | import { getCliArguments, flatternCliArguments } from './arguments'; 9 | 10 | export let childProcess: ChildProcess; 11 | 12 | export async function runCodegenCli( 13 | options: Arguments, 14 | context: ExecutorContext, 15 | processOptions?: Pick 16 | ) { 17 | const args = getCliArguments(options); 18 | const cliArgs = flatternCliArguments(args); 19 | 20 | return new Promise((resolve, reject) => { 21 | childProcess = spawn('npx', ['graphql-codegen', ...cliArgs], { 22 | stdio: processOptions?.stdio ?? [0, 1, 2], 23 | cwd: context.root, 24 | env: { 25 | ...process.env, 26 | FORCE_COLOR: 'true', 27 | }, 28 | }); 29 | 30 | // Ensure the child process is killed when the parent exits 31 | process.on('exit', () => childProcess.kill()); 32 | process.on('SIGTERM', () => childProcess.kill()); 33 | 34 | childProcess.on('error', (err) => { 35 | reject(err); 36 | }); 37 | 38 | childProcess.on('exit', (code) => { 39 | if (code === 0) { 40 | resolve(code); 41 | } else { 42 | reject(code); 43 | } 44 | }); 45 | }); 46 | } 47 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/graphql-codegen-cli/index.ts: -------------------------------------------------------------------------------- 1 | export * from './arguments'; 2 | export * from './cli'; 3 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './create-package-json'; 2 | export * from './get-mesh-packages'; 3 | export * from './get-package-versions'; 4 | export * from './get-source-file'; 5 | export * from './get-wildcard-packages'; 6 | export * from './mesh-packages'; 7 | export * from './watcher'; 8 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/mesh-cli/arguments.ts: -------------------------------------------------------------------------------- 1 | import type { StringKeyOf } from 'type-fest'; 2 | 3 | /** 4 | * Arguments that can be passed to the GraphQL Mesh CLI. 5 | */ 6 | export type Arguments = { 7 | /** 8 | * The directory where the mesh config is located. 9 | */ 10 | dir?: string; 11 | 12 | fileType?: 'json' | 'ts' | 'js'; 13 | 14 | /** 15 | * The port number to run on. 16 | */ 17 | port?: number; 18 | 19 | /** 20 | * Loads specific require.extensions before running the codegen 21 | * and reading the configuration. 22 | */ 23 | require?: string | string[]; 24 | }; 25 | 26 | /** 27 | * Arguments in a format accepted by the GraphQL Mesh CLI. 28 | */ 29 | export type CliArguments = { 30 | [Arg in StringKeyOf as `--${Arg}`]?: string; 31 | }; 32 | 33 | /** 34 | * Get a list of arguments that can be passed to the 35 | * GraphQL Mesh CLI. 36 | */ 37 | export const getCliArguments = (options: Arguments): CliArguments => { 38 | const cliArguments: CliArguments = {}; 39 | 40 | Object.entries(options).forEach(([key, value]) => { 41 | const cliKey = `--${key}` as keyof CliArguments; 42 | let cliValue; 43 | 44 | if (Array.isArray(value)) { 45 | cliValue = value.join(' '); 46 | } else { 47 | cliValue = value; 48 | } 49 | 50 | if (cliValue !== undefined && cliValue !== '') { 51 | cliArguments[cliKey] = `${cliValue}`; 52 | } 53 | }); 54 | 55 | return cliArguments; 56 | }; 57 | 58 | export const flatternCliArguments = (args: CliArguments) => 59 | Object.entries(args).flat(); 60 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/mesh-cli/cli.ts: -------------------------------------------------------------------------------- 1 | import type { ExecutorContext } from '@nrwl/devkit'; 2 | import type { ChildProcess, ForkOptions } from 'node:child_process'; 3 | 4 | import type { Command, Options } from './commands'; 5 | 6 | import { spawn } from 'node:child_process'; 7 | 8 | import { flatternCliArguments } from './arguments'; 9 | import { getCommandOptions } from './commands'; 10 | 11 | export let childProcess: ChildProcess; 12 | 13 | export async function runMeshCli< 14 | TCommand extends Command, 15 | TOptions extends Options = Options 16 | >( 17 | command: TCommand, 18 | options: TOptions, 19 | context: ExecutorContext, 20 | processOptions?: Pick 21 | ) { 22 | const { args, env } = getCommandOptions(options); 23 | const cliArgs = flatternCliArguments(args); 24 | 25 | return new Promise((resolve, reject) => { 26 | childProcess = spawn(`npx`, ['graphql-mesh', command, ...cliArgs], { 27 | stdio: processOptions?.stdio ?? [0, 1, 2], 28 | cwd: context.root, 29 | env: { 30 | ...process.env, 31 | ...env, 32 | FORCE_COLOR: 'true', 33 | }, 34 | }); 35 | 36 | // Ensure the child process is killed when the parent exits 37 | process.on('exit', () => childProcess.kill()); 38 | process.on('SIGTERM', () => childProcess.kill()); 39 | 40 | childProcess.on('error', (err) => { 41 | reject(err); 42 | }); 43 | 44 | childProcess.on('exit', (code) => { 45 | if (code === 0) { 46 | resolve(code); 47 | } else { 48 | reject(code); 49 | } 50 | }); 51 | }); 52 | } 53 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/mesh-cli/env.spec.ts: -------------------------------------------------------------------------------- 1 | import type { Env, CliEnv } from './env'; 2 | 3 | import { getCliEnv } from './env'; 4 | 5 | describe('MeshCli Env variables', () => { 6 | describe('getCliEnv', () => { 7 | it('should return an empty object by default', () => { 8 | const result = getCliEnv({}); 9 | expect(result).toStrictEqual({}); 10 | }); 11 | 12 | it.each<[keyof Env, Env, CliEnv]>([ 13 | [ 14 | 'debug', 15 | { 16 | debug: true, 17 | }, 18 | { 19 | DEBUG: '1', 20 | }, 21 | ], 22 | ])('should support the %s Env variable', (argument, input, expected) => { 23 | const result = getCliEnv(input); 24 | expect(result).toStrictEqual(expected); 25 | }); 26 | 27 | it('should remove Env variables with undefined values', () => { 28 | const result = getCliEnv({ 29 | debug: undefined, 30 | }); 31 | 32 | expect(result).toStrictEqual({}); 33 | }); 34 | 35 | it.each([ 36 | [true, '1'], 37 | [false, '0'], 38 | ])('should output DEBUG=$s as %s', (input, expected) => { 39 | const result = getCliEnv({ 40 | debug: input, 41 | }); 42 | 43 | expect(result.DEBUG).toBe(expected); 44 | }); 45 | }); 46 | }); 47 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/mesh-cli/env.ts: -------------------------------------------------------------------------------- 1 | import type { StringKeyOf } from 'type-fest'; 2 | 3 | /** 4 | * Env variables that can be passed to the GraphQL Mesh CLI. 5 | */ 6 | export type Env = { 7 | /** 8 | * Enable debug logging. 9 | */ 10 | debug?: boolean; 11 | }; 12 | 13 | /** 14 | * Env variables in a format accepted by the GraphQL Mesh CLI. 15 | */ 16 | export type CliEnv = { 17 | [E in StringKeyOf as Uppercase]?: E extends 'debug' 18 | ? '0' | '1' 19 | : string; 20 | }; 21 | 22 | /** 23 | * Get a list of Env variables that can be passed to the 24 | * GraphQL Mesh CLI. 25 | */ 26 | export const getCliEnv = (options: Env): CliEnv => { 27 | const CliEnv: CliEnv = {}; 28 | 29 | (Object.keys(options) as (keyof Env)[]).forEach((key) => { 30 | const value = options[key]; 31 | const cliKey = key.toUpperCase() as keyof CliEnv; 32 | 33 | if (key === 'debug' && value !== undefined) { 34 | CliEnv[cliKey] = (+value).toString() as typeof CliEnv['DEBUG']; 35 | } 36 | }); 37 | 38 | return CliEnv; 39 | }; 40 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/mesh-cli/index.ts: -------------------------------------------------------------------------------- 1 | export * from './arguments'; 2 | export * from './cli'; 3 | export * from './commands'; 4 | export * from './env'; 5 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/run-tasks-in-serial/index.ts: -------------------------------------------------------------------------------- 1 | export * from './run-tasks-in-serial'; 2 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/run-tasks-in-serial/run-tasks-in-serial.ts: -------------------------------------------------------------------------------- 1 | import type { GeneratorCallback } from '@nrwl/devkit'; 2 | 3 | /** 4 | * Run Generator async tasks in priority order. 5 | * 6 | * @param tasks - An array of generator tasks, listed in priority order. 7 | * @returns 8 | */ 9 | export const runTasksInSerial = 10 | (...tasks: GeneratorCallback[]): GeneratorCallback => 11 | async () => { 12 | for (const task of tasks) { 13 | if (task instanceof Promise) { 14 | await task(); 15 | } else { 16 | task(); 17 | } 18 | } 19 | }; 20 | 21 | export type { GeneratorCallback } from '@nrwl/devkit'; 22 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/typescript.ts: -------------------------------------------------------------------------------- 1 | import type { Tree } from '@nrwl/devkit'; 2 | 3 | import { offsetFromRoot } from '@nrwl/devkit'; 4 | 5 | export function getRootTsConfigPathInTree(tree: Tree): string | null { 6 | for (const path of ['tsconfig.base.json', 'tsconfig.json']) { 7 | if (tree.exists(path)) { 8 | return path; 9 | } 10 | } 11 | 12 | return 'tsconfig.base.json'; 13 | } 14 | 15 | export const getRelativePathToRootTsConfig = ( 16 | tree: Tree, 17 | targetPath: string 18 | ): string => offsetFromRoot(targetPath) + getRootTsConfigPathInTree(tree); 19 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/versions.ts: -------------------------------------------------------------------------------- 1 | import { MeshPackages } from './mesh-packages'; 2 | 3 | export type MeshPackageVersions = { 4 | [P in MeshPackages]?: Record; 5 | } & { 6 | '@graphql-typed-document-node/core': { 7 | '@graphql-typed-document-node/core': string; 8 | }; 9 | graphql: { 10 | graphql: string; 11 | }; 12 | }; 13 | 14 | export const versions: MeshPackageVersions = { 15 | '@graphql-typed-document-node/core': { 16 | '@graphql-typed-document-node/core': '^3.2.0', 17 | }, 18 | '@graphql-codegen/cli': { 19 | '@graphql-codegen/cli': '^3.2.2', 20 | }, 21 | '@graphql-codegen/client-preset': { 22 | '@graphql-codegen/client-preset': '^2.1.1', 23 | }, 24 | '@graphql-mesh/cli': { 25 | '@graphql-mesh/cli': '^0.82.34', 26 | }, 27 | '@graphql-mesh/graphql': { 28 | '@graphql-mesh/graphql': '^1.0.0', 29 | }, 30 | '@graphql-mesh/json-schema': { 31 | '@graphql-mesh/json-schema': '^1.0.0', 32 | }, 33 | '@graphql-mesh/mysql': { 34 | '@graphql-mesh/mysql': '^1.0.0', 35 | }, 36 | '@graphql-mesh/neo4j': { 37 | '@graphql-mesh/neo4j': '^1.0.0', 38 | }, 39 | '@graphql-mesh/new-openapi': { '@graphql-mesh/new-openapi': '^0.8.2' }, 40 | '@graphql-mesh/odata': { '@graphql-mesh/odata': '^1.0.0' }, 41 | '@graphql-mesh/openapi': { '@graphql-mesh/openapi': '^1.0.0' }, 42 | '@graphql-mesh/plugin-mock': { 43 | '@graphql-mesh/plugin-mock': '^1.0.0', 44 | }, 45 | '@graphql-mesh/plugin-snapshot': { 46 | '@graphql-mesh/plugin-snapshot': '^1.0.0', 47 | }, 48 | '@graphql-mesh/runtime': { '@graphql-mesh/runtime': '^1.0.0' }, 49 | '@graphql-mesh/soap': { '@graphql-mesh/soap': '^1.0.0' }, 50 | // '@graphql-mesh/utils': { '@graphql-mesh/utils': '0.42.6' }, 51 | graphql: { graphql: '^16.6.0' }, 52 | }; 53 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/watcher/index.ts: -------------------------------------------------------------------------------- 1 | export * from './watcher'; 2 | -------------------------------------------------------------------------------- /packages/nx-mesh/src/utils/watcher/watcher.ts: -------------------------------------------------------------------------------- 1 | import type { WatcherOptions } from 'watchpack'; 2 | 3 | import { logger } from '@nrwl/devkit'; 4 | import Watchpack from 'watchpack'; 5 | 6 | export type WatchFunc = () => Promise; 7 | 8 | export type Options = Omit & { 9 | dir: string; 10 | watch?: boolean; 11 | }; 12 | 13 | export async function watcher(func: WatchFunc, options: Options) { 14 | const { dir, watch, ...watcherOptions } = options; 15 | 16 | if (watch === true) { 17 | const wp = new Watchpack({ 18 | ...watcherOptions, 19 | ignored: [ 20 | '.eslintrc.json', 21 | '.swcrc', 22 | '**/.codegen', 23 | '**/.git', 24 | '**/.mesh', 25 | '**/node_modules', 26 | 'jest.config.ts', 27 | 'project.json', 28 | ], 29 | }); 30 | 31 | wp.watch({ directories: [dir], startTime: 0 }); 32 | 33 | wp.on('aggregated', async () => { 34 | await func(); 35 | 36 | logger.info(''); 37 | logger.info(''); 38 | logger.info('Watching for changes...'); 39 | }); 40 | 41 | await new Promise<{ success: boolean }>(() => { 42 | // This Promise intentionally never resolves, leaving the process running. 43 | }); 44 | } else { 45 | await func(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /packages/nx-mesh/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "module": "commonjs" 5 | }, 6 | "files": [], 7 | "include": [], 8 | "references": [ 9 | { 10 | "path": "./tsconfig.lib.json" 11 | }, 12 | { 13 | "path": "./tsconfig.spec.json" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/nx-mesh/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "declaration": true, 6 | "types": ["node"] 7 | }, 8 | "include": ["**/*.ts"], 9 | "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/nx-mesh/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": [ 9 | "jest.config.ts", 10 | "**/*.test.ts", 11 | "**/*.spec.ts", 12 | "**/*.d.ts", 13 | "src/executors/build-gateway/schema.ts", 14 | "src/executors/build/schema.ts", 15 | "src/executors/build-swc/schema.ts", 16 | "src/executors/validate/schema.ts", 17 | "src/generators/sdk/schema.ts" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - packages/* 3 | -------------------------------------------------------------------------------- /socket.yml: -------------------------------------------------------------------------------- 1 | issues: 2 | binScriptConfusion: false 3 | # enable/disable GitHub app pull request alert checks 4 | # pullRequestAlertsEnabled: true 5 | 6 | # enable/disable Github app project report checks 7 | # projectReportsEnabled: true 8 | -------------------------------------------------------------------------------- /sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.organization=domjtalbot 2 | sonar.projectKey=domjtalbot_nx-mesh 3 | 4 | # compile-swc.ts & swc.impl.ts are both modified files 5 | # from the Nx source code. 6 | sonar.exclusions=**/example/*,./packages/nx-mesh/src/executors/build-swc/swc-executor/compile-swc.ts,./packages/nx-mesh/src/executors/build-swc/swc-executor/swc.impl.ts 7 | sonar.sources=packages/nx-mesh 8 | 9 | sonar.eslint.reportPaths=./reports/packages/nx-mesh/lint.json 10 | sonar.javascript.lcov.reportPaths=./coverage/packages/nx-mesh/lcov.info 11 | sonar.test.inclusions=packages/nx-mesh/**/*.spec.* 12 | -------------------------------------------------------------------------------- /tools/tsconfig.tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "../dist/out-tsc/tools", 5 | "rootDir": ".", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": ["node"], 9 | "importHelpers": false 10 | }, 11 | "include": ["**/*.ts"] 12 | } 13 | -------------------------------------------------------------------------------- /vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "buildCommand": "pnpm nx run examples-sdk-nextjs:build", 3 | "github": { 4 | "enabled": false 5 | }, 6 | "installCommand": "mv .npmrc .npmrc-dev && mv .npmrc-vercel .npmrc && pnpm install", 7 | "outputDirectory": "dist/examples/sdk-nextjs/.next" 8 | } 9 | --------------------------------------------------------------------------------