diff --git a/Makefile b/Makefile index 5020c49a..c9d75f8f 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,10 @@ watch: graphql_generate: npm run graphql:generate +.PHONY: graphql_download_schema +graphql_download_schema: + npm run graphql:download + .PHONY: bump_version bump_version: npm version "$(bump)" @@ -46,13 +50,17 @@ test_in_container: watch_in_container: bash ./scripts/run-in-container.sh make watch +.PHONY: graphql_download_schema_in_container +graphql_download_schema_in_container: + bash ./scripts/run-in-container.sh make graphql_download_schema + .PHONY: graphql_generate_in_container graphql_generate_in_container: bash ./scripts/run-in-container.sh make graphql_generate -.PHONY: export_pontoon_graphql_schema -export_pontoon_graphql_schema: - CONTAINER_IMAGE='docker.io/library/python:3.13-bookworm' bash ./scripts/run-in-container.sh 'bash ./scripts/export-pontoon-graphql-schema.sh ./src/pontoon.graphql' +.PHONY: update_pontoon_graphql_schema +update_pontoon_graphql_schema: + make graphql_download_schema_in_container make graphql_generate_in_container .PHONY: bump_version_in_container diff --git a/package-lock.json b/package-lock.json index 15d84d78..aaecd5e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -64,6 +64,7 @@ "eslint-plugin-testing-library": "^7.1.1", "flush-promises": "^1.0.2", "generate-json-webpack-plugin": "^2.0.0", + "get-graphql-schema": "^2.1.2", "graphql-request": "^6.1.0", "html-webpack-plugin": "^5.6.3", "jest": "^28.1.3", @@ -11742,6 +11743,113 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/get-graphql-schema": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/get-graphql-schema/-/get-graphql-schema-2.1.2.tgz", + "integrity": "sha512-1z5Hw91VrE3GrpCZE6lE8Dy+jz4kXWesLS7rCSjwOxf5BOcIedAZeTUJRIeIzmmR+PA9CKOkPTYFRJbdgUtrxA==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^2.4.1", + "graphql": "^14.0.2", + "minimist": "^1.2.0", + "node-fetch": "^2.2.0" + }, + "bin": { + "get-graphql-schema": "dist/index.js" + } + }, + "node_modules/get-graphql-schema/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/get-graphql-schema/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/get-graphql-schema/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/get-graphql-schema/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/get-graphql-schema/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/get-graphql-schema/node_modules/graphql": { + "version": "14.7.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-14.7.0.tgz", + "integrity": "sha512-l0xWZpoPKpppFzMfvVyFmp9vLN7w/ZZJPefUicMCepfJeQ8sMcztloGYY9DfjVPo6tIUDzU5Hw3MUbIjj9AVVA==", + "dev": true, + "license": "MIT", + "dependencies": { + "iterall": "^1.2.2" + }, + "engines": { + "node": ">= 6.x" + } + }, + "node_modules/get-graphql-schema/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/get-graphql-schema/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/get-intrinsic": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.7.tgz", @@ -13480,6 +13588,13 @@ "node": ">=8" } }, + "node_modules/iterall": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/iterall/-/iterall-1.3.0.tgz", + "integrity": "sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg==", + "dev": true, + "license": "MIT" + }, "node_modules/iterator.prototype": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.5.tgz", @@ -29686,6 +29801,85 @@ "integrity": "sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==", "dev": true }, + "get-graphql-schema": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/get-graphql-schema/-/get-graphql-schema-2.1.2.tgz", + "integrity": "sha512-1z5Hw91VrE3GrpCZE6lE8Dy+jz4kXWesLS7rCSjwOxf5BOcIedAZeTUJRIeIzmmR+PA9CKOkPTYFRJbdgUtrxA==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "graphql": "^14.0.2", + "minimist": "^1.2.0", + "node-fetch": "^2.2.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true + }, + "graphql": { + "version": "14.7.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-14.7.0.tgz", + "integrity": "sha512-l0xWZpoPKpppFzMfvVyFmp9vLN7w/ZZJPefUicMCepfJeQ8sMcztloGYY9DfjVPo6tIUDzU5Hw3MUbIjj9AVVA==", + "dev": true, + "requires": { + "iterall": "^1.2.2" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "get-intrinsic": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.7.tgz", @@ -30826,6 +31020,12 @@ "istanbul-lib-report": "^3.0.0" } }, + "iterall": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/iterall/-/iterall-1.3.0.tgz", + "integrity": "sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg==", + "dev": true + }, "iterator.prototype": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.5.tgz", diff --git a/package.json b/package.json index 342b38e6..7277a2c0 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "webpack:watch:chromium": "cross-env MODE=development TARGET_BROWSER=chromium webpack --config ./configs/webpack.config.ts --watch", "jest:run": "jest --ci --config ./configs/jest.config.ts", "watch": "npm-run-all build:clean --parallel webpack:watch:*", + "graphql:download": "get-graphql-schema https://pontoon.mozilla.org/graphql/ > ./src/pontoon.graphql", "graphql:generate": "graphql-codegen --config ./configs/codegen.yml" }, "dependencies": { @@ -87,6 +88,7 @@ "eslint-plugin-testing-library": "^7.1.1", "flush-promises": "^1.0.2", "generate-json-webpack-plugin": "^2.0.0", + "get-graphql-schema": "^2.1.2", "graphql-request": "^6.1.0", "html-webpack-plugin": "^5.6.3", "jest": "^28.1.3", diff --git a/scripts/export-pontoon-graphql-schema.sh b/scripts/export-pontoon-graphql-schema.sh deleted file mode 100644 index d330cf3c..00000000 --- a/scripts/export-pontoon-graphql-schema.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e -set -o pipefail - -OUTPUT_FILE="${1}" - -PONTOON_REPO_DIR='./tmp/pontoon' - -# clone Pontoon -rm -rf "${PONTOON_REPO_DIR}" -git clone --depth 1 https://github.com/mozilla/pontoon.git "${PONTOON_REPO_DIR}" - -# install Pontoon dependencies -PIP_INSTALL='pip install --user --cache-dir ./tmp/.pip/cache --no-warn-script-location' -${PIP_INSTALL} mysql -${PIP_INSTALL} --require-hashes -r "${PONTOON_REPO_DIR}/requirements/default.txt" - -# export schema definition to file -SECRET_KEY='SECRET_KEY' ${PONTOON_REPO_DIR}/manage.py graphql_schema --schema pontoon.api.schema.schema --out=-.graphql > "${OUTPUT_FILE}" - -rm -r "${PONTOON_REPO_DIR}" diff --git a/src/generated/pontoon.graphql.ts b/src/generated/pontoon.graphql.ts index 5c567ad8..faba9ad6 100644 --- a/src/generated/pontoon.graphql.ts +++ b/src/generated/pontoon.graphql.ts @@ -86,116 +86,98 @@ export type DjangoDebugSql = { export type Locale = { __typename?: 'Locale'; - approvedStrings: Scalars['Int']['output']; + approvedStrings?: Maybe; /** - * - * A comma separated list of - * - * CLDR plural categories, where 0 represents zero, 1 one, 2 two, 3 few, 4 many, and 5 other. - * E.g. 1,5 - * + * A comma separated list of + * + * CLDR plural categories, where 0 represents zero, 1 one, 2 two, 3 few, 4 many, and 5 other. + * E.g. 1,5 */ cldrPlurals: Scalars['String']['output']; code: Scalars['String']['output']; complete?: Maybe; /** - * - * Writing direction of the script. Set to "right-to-left" if "rtl" value - * for the locale script is set to "YES" in - * - * CLDR scriptMetadata.json. - * + * Writing direction of the script. Set to "right-to-left" if "rtl" value + * for the locale script is set to "YES" in + * + * CLDR scriptMetadata.json. */ direction: BaseLocaleDirectionChoices; /** - * - * Google Translate maintains its own list of - * - * supported locales. Choose a matching locale from the list or leave blank to disable - * support for Google Cloud Translation machine translation service. - * + * Google Translate maintains its own list of + * + * supported locales. Choose a matching locale from the list or leave blank to disable + * support for Google Cloud Translation machine translation service. */ googleTranslateCode: Scalars['String']['output']; localizations?: Maybe>>; missingStrings?: Maybe; /** + * Microsoft Terminology uses language codes that include both the language and + * the country/region. Choose a matching locale from the list or leave blank to disable support + * for Microsoft terminology: * - * Microsoft Terminology uses language codes that include both the language and - * the country/region. Choose a matching locale from the list or leave blank to disable support - * for Microsoft terminology: - * - * af-za, am-et, ar-dz, ar-eg, ar-sa, as-in, az-latn-az, be-by, bg-bg, bn-bd, bn-in, - * bs-cyrl-ba, bs-latn-ba, ca-es, ca-es-valencia, chr-cher-us, cs-cz, cy-gb, da-dk, de-at, - * de-ch, de-de, el-gr, en-au, en-ca, en-gb, en-hk, en-ie, en-in, en-my, en-ng, en-nz, en-ph, - * en-pk, en-sg, en-tt, en-us, en-za, es-ar, es-bo, es-cl, es-co, es-cr, es-do, es-ec, es-es, - * es-gt, es-hn, es-mx, es-ni, es-pa, es-pe, es-pr, es-py, es-sv, es-us, es-uy, es-ve, et-ee, - * eu-es, fa-ir, fi-fi, fil-ph, fo-fo, fr-be, fr-ca, fr-ch, fr-dz, fr-fr, fr-ma, fr-tn, - * fuc-latn-sn, ga-ie, gd-gb, gl-es, gu-in, guc-ve, ha-latn-ng, he-il, hi-in, hr-hr, hu-hu, - * hy-am, id-id, ig-ng, is-is, it-ch, it-it, iu-latn-ca, ja-jp, ka-ge, kk-kz, km-kh, kn-in, - * ko-kr, kok-in, ku-arab-iq, ky-kg, lb-lu, lo-la, lt-lt, lv-lv, mi-nz, mk-mk, ml-in, mn-mn, - * mr-in, ms-bn, ms-my, mt-mt, my-mm, nb-no, ne-np, nl-be, nl-nl, nn-no, nso-za, or-in, - * pa-arab-pk, pa-in, pl-pl, prs-af, ps-af, pt-br, pt-pt, quc-latn-gt, quz-pe, ro-md, ro-ro, - * ru-kz, ru-ru, rw-rw, sd-arab-pk, si-lk, sk-sk, sl-si, sp-xl, sq-al, sr-cyrl-ba, sr-cyrl-rs, - * sr-latn-me, sr-latn-rs, sv-se, sw-ke, ta-in, te-in, tg-cyrl-tj, th-th, ti-et, tk-tm, tl-ph, - * tn-za, tr-tr, tt-ru, ug-cn, uk-ua, ur-pk, uz-cyrl-uz, uz-latn-uz, vi-vn, wo-sn, xh-za, - * yo-ng, zh-cn, zh-hk, zh-sg, zh-tw, zu-za - * + * af-za, am-et, ar-dz, ar-eg, ar-sa, as-in, az-latn-az, be-by, bg-bg, bn-bd, bn-in, + * bs-cyrl-ba, bs-latn-ba, ca-es, ca-es-valencia, chr-cher-us, cs-cz, cy-gb, da-dk, de-at, + * de-ch, de-de, el-gr, en-au, en-ca, en-gb, en-hk, en-ie, en-in, en-my, en-ng, en-nz, en-ph, + * en-pk, en-sg, en-tt, en-us, en-za, es-ar, es-bo, es-cl, es-co, es-cr, es-do, es-ec, es-es, + * es-gt, es-hn, es-mx, es-ni, es-pa, es-pe, es-pr, es-py, es-sv, es-us, es-uy, es-ve, et-ee, + * eu-es, fa-ir, fi-fi, fil-ph, fo-fo, fr-be, fr-ca, fr-ch, fr-dz, fr-fr, fr-ma, fr-tn, + * fuc-latn-sn, ga-ie, gd-gb, gl-es, gu-in, guc-ve, ha-latn-ng, he-il, hi-in, hr-hr, hu-hu, + * hy-am, id-id, ig-ng, is-is, it-ch, it-it, iu-latn-ca, ja-jp, ka-ge, kk-kz, km-kh, kn-in, + * ko-kr, kok-in, ku-arab-iq, ky-kg, lb-lu, lo-la, lt-lt, lv-lv, mi-nz, mk-mk, ml-in, mn-mn, + * mr-in, ms-bn, ms-my, mt-mt, my-mm, nb-no, ne-np, nl-be, nl-nl, nn-no, nso-za, or-in, + * pa-arab-pk, pa-in, pl-pl, prs-af, ps-af, pt-br, pt-pt, quc-latn-gt, quz-pe, ro-md, ro-ro, + * ru-kz, ru-ru, rw-rw, sd-arab-pk, si-lk, sk-sk, sl-si, sp-xl, sq-al, sr-cyrl-ba, sr-cyrl-rs, + * sr-latn-me, sr-latn-rs, sv-se, sw-ke, ta-in, te-in, tg-cyrl-tj, th-th, ti-et, tk-tm, tl-ph, + * tn-za, tr-tr, tt-ru, ug-cn, uk-ua, ur-pk, uz-cyrl-uz, uz-latn-uz, vi-vn, wo-sn, xh-za, + * yo-ng, zh-cn, zh-hk, zh-sg, zh-tw, zu-za */ msTerminologyCode: Scalars['String']['output']; /** - * - * Microsoft Translator maintains its own list of - * - * supported locales. Choose a matching locale from the list or leave blank to disable - * support for Microsoft Translator machine translation service. - * + * Microsoft Translator maintains its own list of + * + * supported locales. Choose a matching locale from the list or leave blank to disable + * support for Microsoft Translator machine translation service. */ msTranslatorCode: Scalars['String']['output']; name: Scalars['String']['output']; /** - * - * Plural rule is part of the plurals header in - * - * Gettext PO files - * , - * that follows the plural= string, without the trailing semicolon. - * E.g. (n != 1) - * + * Plural rule is part of the plurals header in + * + * Gettext PO files + * , + * that follows the plural= string, without the trailing semicolon. + * E.g. (n != 1) */ pluralRule: Scalars['String']['output']; /** - * - * Number of native speakers. Find locale code in - * CLDR territoryInfo.json - * and multiply its "_populationPercent" with the territory "_population". - * Repeat if multiple occurrences of locale code exist and sum products. - * + * Number of native speakers. Find locale code in + * CLDR territoryInfo.json + * and multiply its "_populationPercent" with the territory "_population". + * Repeat if multiple occurrences of locale code exist and sum products. */ population: Scalars['Int']['output']; - pretranslatedStrings: Scalars['Int']['output']; + pretranslatedStrings?: Maybe; /** - * - * The script used by this locale. Find it in - * - * CLDR Languages and Scripts. - * + * The script used by this locale. Find it in + * + * CLDR Languages and Scripts. */ script: Scalars['String']['output']; - stringsWithErrors: Scalars['Int']['output']; - stringsWithWarnings: Scalars['Int']['output']; + stringsWithErrors?: Maybe; + stringsWithWarnings?: Maybe; /** - * - * SYSTRAN maintains its own list of - * supported locales. - * Choose a matching locale from the list or leave blank to disable - * support for SYSTRAN machine translation service. - * + * SYSTRAN maintains its own list of + * supported locales. + * Choose a matching locale from the list or leave blank to disable + * support for SYSTRAN machine translation service. */ systranTranslateCode: Scalars['String']['output']; teamDescription: Scalars['String']['output']; - totalStrings: Scalars['Int']['output']; - unreviewedStrings: Scalars['Int']['output']; + totalStrings?: Maybe; + unreviewedStrings?: Maybe; }; @@ -206,64 +188,54 @@ export type LocaleLocalizationsArgs = { export type Project = { __typename?: 'Project'; - approvedStrings: Scalars['Int']['output']; + approvedStrings?: Maybe; complete?: Maybe; deadline?: Maybe; /** - * - * Hide project from the UI and only keep it accessible from the admin. - * Disable the project instead of deleting it to keep translation memory - * and attributions. Also prevents project from syncing with VCS. - * + * Hide project from the UI and only keep it accessible from the admin. + * Disable the project instead of deleting it to keep translation memory + * and attributions. Also prevents project from syncing with VCS. */ disabled: Scalars['Boolean']['output']; info: Scalars['String']['output']; localizations?: Maybe>>; missingStrings?: Maybe; name: Scalars['String']['output']; - pretranslatedStrings: Scalars['Int']['output']; + pretranslatedStrings?: Maybe; /** - * - * Pretranslate project strings using automated sources - * like translation memory and machine translation. - * + * Pretranslate project strings using automated sources + * like translation memory and machine translation. */ pretranslationEnabled: Scalars['Boolean']['output']; priority: Scalars['Int']['output']; slug: Scalars['String']['output']; - stringsWithErrors: Scalars['Int']['output']; - stringsWithWarnings: Scalars['Int']['output']; - /** - * - * Prevent project from syncing with VCS. - * - */ + stringsWithErrors?: Maybe; + stringsWithWarnings?: Maybe; + /** Prevent project from syncing with VCS. */ syncDisabled: Scalars['Boolean']['output']; /** - * - * System projects are built into Pontoon. They are accessible from the - * translate view, but hidden from dashboards. - * + * System projects are built into Pontoon. They are accessible from the + * translate view, but hidden from dashboards. */ systemProject: Scalars['Boolean']['output']; tags?: Maybe>>; - totalStrings: Scalars['Int']['output']; - unreviewedStrings: Scalars['Int']['output']; + totalStrings?: Maybe; + unreviewedStrings?: Maybe; visibility: Scalars['String']['output']; }; export type ProjectLocale = { __typename?: 'ProjectLocale'; - approvedStrings: Scalars['Int']['output']; + approvedStrings?: Maybe; complete?: Maybe; locale: Locale; missingStrings?: Maybe; - pretranslatedStrings: Scalars['Int']['output']; + pretranslatedStrings?: Maybe; project: Project; - stringsWithErrors: Scalars['Int']['output']; - stringsWithWarnings: Scalars['Int']['output']; - totalStrings: Scalars['Int']['output']; - unreviewedStrings: Scalars['Int']['output']; + stringsWithErrors?: Maybe; + stringsWithWarnings?: Maybe; + totalStrings?: Maybe; + unreviewedStrings?: Maybe; }; export type Query = { @@ -273,6 +245,8 @@ export type Query = { locales?: Maybe>>; project?: Maybe; projects?: Maybe>>; + termSearch?: Maybe>>; + tmSearch?: Maybe>>; }; @@ -291,6 +265,18 @@ export type QueryProjectsArgs = { includeSystem?: InputMaybe; }; + +export type QueryTermSearchArgs = { + locale: Scalars['String']['input']; + search: Scalars['String']['input']; +}; + + +export type QueryTmSearchArgs = { + locale: Scalars['String']['input']; + search: Scalars['String']['input']; +}; + export type Tag = { __typename?: 'Tag'; name: Scalars['String']['output']; @@ -298,10 +284,46 @@ export type Tag = { slug: Scalars['String']['output']; }; +export type Term = { + __typename?: 'Term'; + definition: Scalars['String']['output']; + partOfSpeech: TerminologyTermPartOfSpeechChoices; + text: Scalars['String']['output']; + translationText?: Maybe; + translations?: Maybe>>; + usage: Scalars['String']['output']; +}; + +export type TermTranslation = { + __typename?: 'TermTranslation'; + locale: Locale; + text: Scalars['String']['output']; +}; + +/** An enumeration. */ +export enum TerminologyTermPartOfSpeechChoices { + /** Adjective */ + Adjective = 'ADJECTIVE', + /** Adverb */ + Adverb = 'ADVERB', + /** Noun */ + Noun = 'NOUN', + /** Verb */ + Verb = 'VERB' +} + +export type TranslationMemoryEntry = { + __typename?: 'TranslationMemoryEntry'; + locale: Locale; + project?: Maybe; + source: Scalars['String']['output']; + target: Scalars['String']['output']; +}; + export type GetTeamsInfoQueryVariables = Exact<{ [key: string]: never; }>; -export type GetTeamsInfoQuery = { __typename?: 'Query', locales?: Array<{ __typename?: 'Locale', code: string, name: string, approvedStrings: number, pretranslatedStrings: number, stringsWithWarnings: number, stringsWithErrors: number, missingStrings?: number | null, unreviewedStrings: number, totalStrings: number } | null> | null }; +export type GetTeamsInfoQuery = { __typename?: 'Query', locales?: Array<{ __typename?: 'Locale', code: string, name: string, approvedStrings?: number | null, pretranslatedStrings?: number | null, stringsWithWarnings?: number | null, stringsWithErrors?: number | null, missingStrings?: number | null, unreviewedStrings?: number | null, totalStrings?: number | null } | null> | null }; export type GetProjectsInfoQueryVariables = Exact<{ [key: string]: never; }>; diff --git a/src/pontoon.graphql b/src/pontoon.graphql index 6d175c37..69accd7c 100644 --- a/src/pontoon.graphql +++ b/src/pontoon.graphql @@ -1,11 +1,25 @@ -type Query { - _debug: DjangoDebug - projects(includeDisabled: Boolean = false, includeSystem: Boolean = false): [Project] - project(slug: String): Project - locales: [Locale] - locale(code: String): Locale +"""Exposes a URL that specifies the behaviour of this scalar.""" +directive @specifiedBy( + """The URL that specifies the behaviour of this scalar.""" + url: String! +) on SCALAR + +"""An enumeration.""" +enum BaseLocaleDirectionChoices { + """left-to-right""" + LTR + + """right-to-left""" + RTL } +""" +The `Date` scalar type represents a Date +value as specified by +[iso8601](https://en.wikipedia.org/wiki/ISO_8601). +""" +scalar Date + """Debugging information for the current query.""" type DjangoDebug { """Executed SQL queries for this API query.""" @@ -15,6 +29,18 @@ type DjangoDebug { exceptions: [DjangoDebugException] } +"""Represents a single exception raised.""" +type DjangoDebugException { + """The class of the exception""" + excType: String! + + """The message of the exception""" + message: String! + + """The stack trace""" + stack: String! +} + """Represents a single database query made to a Django managed DB.""" type DjangoDebugSQL { """The type of database being used (e.g. postrgesql, mysql, sqlite).""" @@ -60,122 +86,241 @@ type DjangoDebugSQL { encoding: String } -"""Represents a single exception raised.""" -type DjangoDebugException { - """The class of the exception""" - excType: String! +type Locale { + code: String! - """The message of the exception""" - message: String! + """ + + Google Translate maintains its own list of + + supported locales. Choose a matching locale from the list or leave blank to disable + support for Google Cloud Translation machine translation service. + + """ + googleTranslateCode: String! - """The stack trace""" - stack: String! + """ + + Microsoft Translator maintains its own list of + + supported locales. Choose a matching locale from the list or leave blank to disable + support for Microsoft Translator machine translation service. + + """ + msTranslatorCode: String! + + """ + + Microsoft Terminology uses language codes that include both the language and + the country/region. Choose a matching locale from the list or leave blank to disable support + for Microsoft terminology: + + af-za, am-et, ar-dz, ar-eg, ar-sa, as-in, az-latn-az, be-by, bg-bg, bn-bd, bn-in, + bs-cyrl-ba, bs-latn-ba, ca-es, ca-es-valencia, chr-cher-us, cs-cz, cy-gb, da-dk, de-at, + de-ch, de-de, el-gr, en-au, en-ca, en-gb, en-hk, en-ie, en-in, en-my, en-ng, en-nz, en-ph, + en-pk, en-sg, en-tt, en-us, en-za, es-ar, es-bo, es-cl, es-co, es-cr, es-do, es-ec, es-es, + es-gt, es-hn, es-mx, es-ni, es-pa, es-pe, es-pr, es-py, es-sv, es-us, es-uy, es-ve, et-ee, + eu-es, fa-ir, fi-fi, fil-ph, fo-fo, fr-be, fr-ca, fr-ch, fr-dz, fr-fr, fr-ma, fr-tn, + fuc-latn-sn, ga-ie, gd-gb, gl-es, gu-in, guc-ve, ha-latn-ng, he-il, hi-in, hr-hr, hu-hu, + hy-am, id-id, ig-ng, is-is, it-ch, it-it, iu-latn-ca, ja-jp, ka-ge, kk-kz, km-kh, kn-in, + ko-kr, kok-in, ku-arab-iq, ky-kg, lb-lu, lo-la, lt-lt, lv-lv, mi-nz, mk-mk, ml-in, mn-mn, + mr-in, ms-bn, ms-my, mt-mt, my-mm, nb-no, ne-np, nl-be, nl-nl, nn-no, nso-za, or-in, + pa-arab-pk, pa-in, pl-pl, prs-af, ps-af, pt-br, pt-pt, quc-latn-gt, quz-pe, ro-md, ro-ro, + ru-kz, ru-ru, rw-rw, sd-arab-pk, si-lk, sk-sk, sl-si, sp-xl, sq-al, sr-cyrl-ba, sr-cyrl-rs, + sr-latn-me, sr-latn-rs, sv-se, sw-ke, ta-in, te-in, tg-cyrl-tj, th-th, ti-et, tk-tm, tl-ph, + tn-za, tr-tr, tt-ru, ug-cn, uk-ua, ur-pk, uz-cyrl-uz, uz-latn-uz, vi-vn, wo-sn, xh-za, + yo-ng, zh-cn, zh-hk, zh-sg, zh-tw, zu-za + + """ + msTerminologyCode: String! + + """ + + SYSTRAN maintains its own list of + supported locales. + Choose a matching locale from the list or leave blank to disable + support for SYSTRAN machine translation service. + + """ + systranTranslateCode: String! + name: String! + + """ + + Plural rule is part of the plurals header in + + Gettext PO files + , + that follows the plural= string, without the trailing semicolon. + E.g. (n != 1) + + """ + pluralRule: String! + + """ + + A comma separated list of + + CLDR plural categories, where 0 represents zero, 1 one, 2 two, 3 few, 4 many, and 5 other. + E.g. 1,5 + + """ + cldrPlurals: String! + + """ + + The script used by this locale. Find it in + + CLDR Languages and Scripts. + + """ + script: String! + + """ + + Writing direction of the script. Set to "right-to-left" if "rtl" value + for the locale script is set to "YES" in + + CLDR scriptMetadata.json. + + """ + direction: BaseLocaleDirectionChoices! + + """ + + Number of native speakers. Find locale code in + CLDR territoryInfo.json + and multiply its "_populationPercent" with the territory "_population". + Repeat if multiple occurrences of locale code exist and sum products. + + """ + population: Int! + teamDescription: String! + missingStrings: Int + complete: Boolean + totalStrings: Int + approvedStrings: Int + pretranslatedStrings: Int + stringsWithErrors: Int + stringsWithWarnings: Int + unreviewedStrings: Int + localizations(includeDisabled: Boolean = false, includeSystem: Boolean = false): [ProjectLocale] } type Project { - totalStrings: Int! - approvedStrings: Int! - pretranslatedStrings: Int! - stringsWithErrors: Int! - stringsWithWarnings: Int! - unreviewedStrings: Int! name: String! slug: String! - "\n Hide project from the UI and only keep it accessible from the admin.\n Disable the project instead of deleting it to keep translation memory\n and attributions. Also prevents project from syncing with VCS.\n " + """ + + Hide project from the UI and only keep it accessible from the admin. + Disable the project instead of deleting it to keep translation memory + and attributions. Also prevents project from syncing with VCS. + + """ disabled: Boolean! - "\n Prevent project from syncing with VCS.\n " + """ + + Prevent project from syncing with VCS. + + """ syncDisabled: Boolean! - "\n System projects are built into Pontoon. They are accessible from the\n translate view, but hidden from dashboards.\n " + """ + + System projects are built into Pontoon. They are accessible from the + translate view, but hidden from dashboards. + + """ systemProject: Boolean! visibility: String! info: String! deadline: Date priority: Int! - "\n Pretranslate project strings using automated sources\n like translation memory and machine translation.\n " + """ + + Pretranslate project strings using automated sources + like translation memory and machine translation. + + """ pretranslationEnabled: Boolean! missingStrings: Int complete: Boolean + totalStrings: Int + approvedStrings: Int + pretranslatedStrings: Int + stringsWithErrors: Int + stringsWithWarnings: Int + unreviewedStrings: Int localizations: [ProjectLocale] tags: [Tag] } -""" -The `Date` scalar type represents a Date -value as specified by -[iso8601](https://en.wikipedia.org/wiki/ISO_8601). -""" -scalar Date - type ProjectLocale { - totalStrings: Int! - approvedStrings: Int! - pretranslatedStrings: Int! - stringsWithErrors: Int! - stringsWithWarnings: Int! - unreviewedStrings: Int! project: Project! locale: Locale! missingStrings: Int complete: Boolean + totalStrings: Int + approvedStrings: Int + pretranslatedStrings: Int + stringsWithErrors: Int + stringsWithWarnings: Int + unreviewedStrings: Int } -type Locale { - totalStrings: Int! - approvedStrings: Int! - pretranslatedStrings: Int! - stringsWithErrors: Int! - stringsWithWarnings: Int! - unreviewedStrings: Int! - code: String! - - "\n Google Translate maintains its own list of\n \n supported locales. Choose a matching locale from the list or leave blank to disable\n support for Google Cloud Translation machine translation service.\n " - googleTranslateCode: String! - - "\n Microsoft Translator maintains its own list of\n \n supported locales. Choose a matching locale from the list or leave blank to disable\n support for Microsoft Translator machine translation service.\n " - msTranslatorCode: String! - - "\n Microsoft Terminology uses language codes that include both the language and\n the country/region. Choose a matching locale from the list or leave blank to disable support\n for Microsoft terminology:\n\n af-za, am-et, ar-dz, ar-eg, ar-sa, as-in, az-latn-az, be-by, bg-bg, bn-bd, bn-in,\n bs-cyrl-ba, bs-latn-ba, ca-es, ca-es-valencia, chr-cher-us, cs-cz, cy-gb, da-dk, de-at,\n de-ch, de-de, el-gr, en-au, en-ca, en-gb, en-hk, en-ie, en-in, en-my, en-ng, en-nz, en-ph,\n en-pk, en-sg, en-tt, en-us, en-za, es-ar, es-bo, es-cl, es-co, es-cr, es-do, es-ec, es-es,\n es-gt, es-hn, es-mx, es-ni, es-pa, es-pe, es-pr, es-py, es-sv, es-us, es-uy, es-ve, et-ee,\n eu-es, fa-ir, fi-fi, fil-ph, fo-fo, fr-be, fr-ca, fr-ch, fr-dz, fr-fr, fr-ma, fr-tn,\n fuc-latn-sn, ga-ie, gd-gb, gl-es, gu-in, guc-ve, ha-latn-ng, he-il, hi-in, hr-hr, hu-hu,\n hy-am, id-id, ig-ng, is-is, it-ch, it-it, iu-latn-ca, ja-jp, ka-ge, kk-kz, km-kh, kn-in,\n ko-kr, kok-in, ku-arab-iq, ky-kg, lb-lu, lo-la, lt-lt, lv-lv, mi-nz, mk-mk, ml-in, mn-mn,\n mr-in, ms-bn, ms-my, mt-mt, my-mm, nb-no, ne-np, nl-be, nl-nl, nn-no, nso-za, or-in,\n pa-arab-pk, pa-in, pl-pl, prs-af, ps-af, pt-br, pt-pt, quc-latn-gt, quz-pe, ro-md, ro-ro,\n ru-kz, ru-ru, rw-rw, sd-arab-pk, si-lk, sk-sk, sl-si, sp-xl, sq-al, sr-cyrl-ba, sr-cyrl-rs,\n sr-latn-me, sr-latn-rs, sv-se, sw-ke, ta-in, te-in, tg-cyrl-tj, th-th, ti-et, tk-tm, tl-ph,\n tn-za, tr-tr, tt-ru, ug-cn, uk-ua, ur-pk, uz-cyrl-uz, uz-latn-uz, vi-vn, wo-sn, xh-za,\n yo-ng, zh-cn, zh-hk, zh-sg, zh-tw, zu-za\n " - msTerminologyCode: String! +type Query { + _debug: DjangoDebug + projects(includeDisabled: Boolean = false, includeSystem: Boolean = false): [Project] + project(slug: String): Project + locales: [Locale] + locale(code: String): Locale + termSearch(search: String!, locale: String!): [Term] + tmSearch(search: String!, locale: String!): [TranslationMemoryEntry] +} - "\n SYSTRAN maintains its own list of\n supported locales.\n Choose a matching locale from the list or leave blank to disable\n support for SYSTRAN machine translation service.\n " - systranTranslateCode: String! +type Tag { + slug: String! name: String! + priority: Int +} - "\n Plural rule is part of the plurals header in\n \n Gettext PO files\n ,\n that follows the plural= string, without the trailing semicolon.\n E.g. (n != 1)\n " - pluralRule: String! +type Term { + text: String! + partOfSpeech: TerminologyTermPartOfSpeechChoices! + definition: String! + usage: String! + translations: [TermTranslation] + translationText: String +} - "\n A comma separated list of\n \n CLDR plural categories, where 0 represents zero, 1 one, 2 two, 3 few, 4 many, and 5 other.\n E.g. 1,5\n " - cldrPlurals: String! +"""An enumeration.""" +enum TerminologyTermPartOfSpeechChoices { + """Adjective""" + ADJECTIVE - "\n The script used by this locale. Find it in\n \n CLDR Languages and Scripts.\n " - script: String! + """Adverb""" + ADVERB - "\n Writing direction of the script. Set to \"right-to-left\" if \"rtl\" value\n for the locale script is set to \"YES\" in\n \n CLDR scriptMetadata.json.\n " - direction: BaseLocaleDirectionChoices! + """Noun""" + NOUN - "\n Number of native speakers. Find locale code in\n CLDR territoryInfo.json\n and multiply its \"_populationPercent\" with the territory \"_population\".\n Repeat if multiple occurrences of locale code exist and sum products.\n " - population: Int! - teamDescription: String! - missingStrings: Int - complete: Boolean - localizations(includeDisabled: Boolean = false, includeSystem: Boolean = false): [ProjectLocale] + """Verb""" + VERB } -"""An enumeration.""" -enum BaseLocaleDirectionChoices { - """left-to-right""" - LTR - - """right-to-left""" - RTL +type TermTranslation { + locale: Locale! + text: String! } -type Tag { - slug: String! - name: String! - priority: Int +type TranslationMemoryEntry { + source: String! + target: String! + locale: Locale! + project: Project } +