From eb02a61d9efe23d7af7f2131f7216325c7d7d97f Mon Sep 17 00:00:00 2001 From: jycouet Date: Thu, 1 Sep 2022 09:18:34 +0200 Subject: [PATCH 01/10] :construction: IMPROVE: doc url depending on the pck version --- pnpm-lock.yaml | 223 ++++++++++++++-------- src/cmd/generate.ts | 3 +- src/cmd/generators/typescript/index.ts | 3 +- src/cmd/transforms/list.ts | 11 +- src/cmd/transforms/schema.ts | 27 ++- src/cmd/validators/typeCheck.ts | 7 +- src/constants.ts | 7 + src/runtime/index.ts | 3 +- src/runtime/lib/network.ts | 3 +- src/runtime/stores/pagination/cursor.ts | 3 +- src/runtime/stores/pagination/fragment.ts | 3 +- src/runtime/stores/pagination/pageInfo.ts | 3 +- 12 files changed, 190 insertions(+), 106 deletions(-) create mode 100644 src/constants.ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c740d71c99..78fd32effe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: 5.3 +lockfileVersion: 5.4 importers: .: @@ -108,7 +108,7 @@ importers: '@rollup/plugin-node-resolve': 13.3.0_rollup@2.68.0 '@rollup/plugin-replace': 4.0.0_rollup@2.68.0 '@sveltejs/kit': 1.0.0-next.445_svelte@3.49.0+vite@3.0.9 - '@theguild/eslint-config': 0.0.1_eslint@8.23.0+typescript@4.7.4 + '@theguild/eslint-config': 0.0.1_sorwav4hsh5vncerguqybud76i '@trivago/prettier-plugin-sort-imports': 3.3.0_prettier@2.7.1 '@types/fs-extra': 9.0.13 '@types/glob': 7.2.0 @@ -142,8 +142,8 @@ importers: pretty-quick: 3.1.3_prettier@2.7.1 prompts: 2.4.2 rollup: 2.68.0 - rollup-plugin-typescript2: 0.31.2_rollup@2.68.0+typescript@4.7.4 - ts-jest: 26.5.6_jest@26.6.3+typescript@4.7.4 + rollup-plugin-typescript2: 0.31.2_jrqhcdvvfzmrsc4z5p6zs2uiwy + ts-jest: 26.5.6_rnfpnlbz3wqspag7uftsmccrvy ts-node: 9.1.1_typescript@4.7.4 tslib: 2.4.0 typescript: 4.7.4 @@ -177,7 +177,7 @@ importers: graphql: 15.5.0 houdini: link:.. svelte: 3.49.0 - svelte-preprocess: 4.10.7_8865006ef6c5ca9c2621594fcc5b0f9f + svelte-preprocess: 4.10.7_uslzfc62di2n2otc2tvfklnwji tslib: 2.4.0 typescript: 4.7.4 vite: 3.0.9 @@ -224,20 +224,20 @@ importers: '@replayio/playwright': 0.2.23_@playwright+test@1.25.0 '@sveltejs/adapter-auto': 1.0.0-next.66 '@sveltejs/kit': 1.0.0-next.445_svelte@3.49.0+vite@3.0.8 - '@typescript-eslint/eslint-plugin': 5.35.1_3e381c73f64a66ea3e0ad47e9c76e5d1 - '@typescript-eslint/parser': 5.35.1_eslint@8.23.0+typescript@4.6.4 + '@typescript-eslint/eslint-plugin': 5.35.1_hy4by47wjjtoupqk2r7jy5xf2e + '@typescript-eslint/parser': 5.35.1_pyvvhc3zqdua4akflcggygkl44 concurrently: 7.1.0 cross-env: 7.0.3 eslint: 8.23.0 eslint-config-prettier: 8.5.0_eslint@8.23.0 - eslint-plugin-svelte3: 4.0.0_eslint@8.23.0+svelte@3.49.0 + eslint-plugin-svelte3: 4.0.0_sfdub7vxhxkt5wmgvhhmmgyu2e graphql: 15.5.0 houdini: link:.. prettier: 2.7.1 - prettier-plugin-svelte: 2.7.0_prettier@2.7.1+svelte@3.49.0 + prettier-plugin-svelte: 2.7.0_o3ioganyptcsrh6x4hnxvjkpqi svelte: 3.49.0 - svelte-check: 2.8.1_c3e56b326347f79cbefa7b54654977f5 - svelte-preprocess: 4.10.7_280a73da7875c18e2397c4f760f243fd + svelte-check: 2.8.1_svelte@3.49.0 + svelte-preprocess: 4.10.7_ueozcsexptisi2awlbuwt6eqmq tslib: 2.4.0 typescript: 4.6.4 vite: 3.0.8 @@ -284,20 +284,20 @@ importers: prismjs: 1.29.0 rehype-autolink-headings: 6.1.1 rehype-slug: 5.0.1 - svelte-preprocess: 4.10.7_bcee8d2d2825c991128217423905a22e + svelte-preprocess: 4.10.7_vg3dtoa6m5cwrgayrz5b3xtqh4 vite-plugin-replace: 0.1.1_vite@3.0.9 devDependencies: - '@typescript-eslint/eslint-plugin': 5.35.1_36ed1c84a055476afaa601b60019bc92 - '@typescript-eslint/parser': 5.35.1_eslint@8.23.0+typescript@4.5.4 + '@typescript-eslint/eslint-plugin': 5.35.1_g3wrzbfakvdwv6vgag3aagn4si + '@typescript-eslint/parser': 5.35.1_svqrduhulcrphxzql7zpeoisfy eslint: 8.23.0 eslint-config-prettier: 8.5.0_eslint@8.23.0 - eslint-plugin-svelte3: 4.0.0_eslint@8.23.0+svelte@3.49.0 + eslint-plugin-svelte3: 4.0.0_sfdub7vxhxkt5wmgvhhmmgyu2e husky: 7.0.4 lint-staged: 12.5.0 prettier: 2.7.1 - prettier-plugin-svelte: 2.7.0_prettier@2.7.1+svelte@3.49.0 + prettier-plugin-svelte: 2.7.0_o3ioganyptcsrh6x4hnxvjkpqi svelte: 3.49.0 - svelte-check: 2.8.1_c3e56b326347f79cbefa7b54654977f5 + svelte-check: 2.8.1_svelte@3.49.0 svelte-kit-cookie-session: 3.0.6 tslib: 2.4.0 typescript: 4.5.4 @@ -2319,7 +2319,7 @@ packages: '@envelop/types': 2.3.1_graphql@15.5.0 graphql: 15.5.0 - /@envelop/parser-cache/4.6.0_116b5e51298b3580e1b5ec2e4f035c9a: + /@envelop/parser-cache/4.6.0_cfvv4ujjrm2ybynv5qxe6a24ti: resolution: { integrity: sha512-Oi3nX76tk5L7K6MdpPr4AjtpMW1XoyISeiaodYD8WxUWY7JzOA7qetuYguUZv/lK5VaLMsJuoWAwxbu1JKEe9A==, @@ -2342,7 +2342,7 @@ packages: dependencies: graphql: 15.5.0 - /@envelop/validation-cache/4.6.0_116b5e51298b3580e1b5ec2e4f035c9a: + /@envelop/validation-cache/4.6.0_cfvv4ujjrm2ybynv5qxe6a24ti: resolution: { integrity: sha512-Xn5u/tQHid6GzWDenCJkIn5GsDm2fUCNnAudN1BGjXcRvAEFfTHuchpp1PJxvRAqGdYjznng+NkOcqrP5brQrw==, @@ -2453,8 +2453,8 @@ packages: graphql: ^15.2.0 || ^16.0.0 dependencies: '@envelop/core': 2.5.0_graphql@15.5.0 - '@envelop/parser-cache': 4.6.0_116b5e51298b3580e1b5ec2e4f035c9a - '@envelop/validation-cache': 4.6.0_116b5e51298b3580e1b5ec2e4f035c9a + '@envelop/parser-cache': 4.6.0_cfvv4ujjrm2ybynv5qxe6a24ti + '@envelop/validation-cache': 4.6.0_cfvv4ujjrm2ybynv5qxe6a24ti '@graphql-tools/schema': 8.5.1_graphql@15.5.0 '@graphql-tools/utils': 8.10.0_graphql@15.5.0 '@graphql-typed-document-node/core': 3.1.1_graphql@15.5.0 @@ -3011,7 +3011,6 @@ packages: { integrity: sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==, } - dev: true /@repeaterjs/repeater/3.0.4: resolution: @@ -3432,7 +3431,7 @@ packages: transitivePeerDependencies: - supports-color - /@theguild/eslint-config/0.0.1_eslint@8.23.0+typescript@4.7.4: + /@theguild/eslint-config/0.0.1_sorwav4hsh5vncerguqybud76i: resolution: { integrity: sha512-VnvXqU+xqPI9UXNR4T3Ii/EHYc49Ltk4vExPd726hAsQIXcJlLtVMOxGqJXaUcZgiiaqMVCH6B7Ns6+lp5fa7A==, @@ -3441,11 +3440,11 @@ packages: eslint: ^8 dependencies: '@rushstack/eslint-patch': 1.1.4 - '@typescript-eslint/eslint-plugin': 5.35.1_9ee15843f434f89835d0a3adcc936f96 - '@typescript-eslint/parser': 5.35.1_eslint@8.23.0+typescript@4.7.4 + '@typescript-eslint/eslint-plugin': 5.35.1_t3qvqq7ugt4jqnoquow4ze3psy + '@typescript-eslint/parser': 5.35.1_sorwav4hsh5vncerguqybud76i eslint: 8.23.0 eslint-config-prettier: 8.5.0_eslint@8.23.0 - eslint-plugin-import: 2.26.0_eslint@8.23.0 + eslint-plugin-import: 2.26.0_kavhtzjob4obuugpatbfgsyfbm eslint-plugin-promise: 6.0.1_eslint@8.23.0 eslint-plugin-sonarjs: 0.13.0_eslint@8.23.0 eslint-plugin-unicorn: 42.0.0_eslint@8.23.0 @@ -3455,6 +3454,8 @@ packages: eslint-plugin-react: 7.31.1_eslint@8.23.0 eslint-plugin-react-hooks: 4.6.0_eslint@8.23.0 transitivePeerDependencies: + - eslint-import-resolver-typescript + - eslint-import-resolver-webpack - supports-color - typescript dev: true @@ -3852,7 +3853,7 @@ packages: '@types/yargs-parser': 21.0.0 dev: true - /@typescript-eslint/eslint-plugin/5.35.1_36ed1c84a055476afaa601b60019bc92: + /@typescript-eslint/eslint-plugin/5.35.1_g3wrzbfakvdwv6vgag3aagn4si: resolution: { integrity: sha512-RBZZXZlI4XCY4Wzgy64vB+0slT9+yAPQRjj/HSaRwUot33xbDjF1oN9BLwOLTewoOI0jothIltZRe9uJCHf8gg==, @@ -3866,10 +3867,10 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.35.1_eslint@8.23.0+typescript@4.5.4 + '@typescript-eslint/parser': 5.35.1_svqrduhulcrphxzql7zpeoisfy '@typescript-eslint/scope-manager': 5.35.1 - '@typescript-eslint/type-utils': 5.35.1_eslint@8.23.0+typescript@4.5.4 - '@typescript-eslint/utils': 5.35.1_eslint@8.23.0+typescript@4.5.4 + '@typescript-eslint/type-utils': 5.35.1_svqrduhulcrphxzql7zpeoisfy + '@typescript-eslint/utils': 5.35.1_svqrduhulcrphxzql7zpeoisfy debug: 4.3.4 eslint: 8.23.0 functional-red-black-tree: 1.0.1 @@ -3882,7 +3883,7 @@ packages: - supports-color dev: true - /@typescript-eslint/eslint-plugin/5.35.1_3e381c73f64a66ea3e0ad47e9c76e5d1: + /@typescript-eslint/eslint-plugin/5.35.1_hy4by47wjjtoupqk2r7jy5xf2e: resolution: { integrity: sha512-RBZZXZlI4XCY4Wzgy64vB+0slT9+yAPQRjj/HSaRwUot33xbDjF1oN9BLwOLTewoOI0jothIltZRe9uJCHf8gg==, @@ -3896,10 +3897,10 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.35.1_eslint@8.23.0+typescript@4.6.4 + '@typescript-eslint/parser': 5.35.1_pyvvhc3zqdua4akflcggygkl44 '@typescript-eslint/scope-manager': 5.35.1 - '@typescript-eslint/type-utils': 5.35.1_eslint@8.23.0+typescript@4.6.4 - '@typescript-eslint/utils': 5.35.1_eslint@8.23.0+typescript@4.6.4 + '@typescript-eslint/type-utils': 5.35.1_pyvvhc3zqdua4akflcggygkl44 + '@typescript-eslint/utils': 5.35.1_pyvvhc3zqdua4akflcggygkl44 debug: 4.3.4 eslint: 8.23.0 functional-red-black-tree: 1.0.1 @@ -3912,7 +3913,7 @@ packages: - supports-color dev: true - /@typescript-eslint/eslint-plugin/5.35.1_9ee15843f434f89835d0a3adcc936f96: + /@typescript-eslint/eslint-plugin/5.35.1_t3qvqq7ugt4jqnoquow4ze3psy: resolution: { integrity: sha512-RBZZXZlI4XCY4Wzgy64vB+0slT9+yAPQRjj/HSaRwUot33xbDjF1oN9BLwOLTewoOI0jothIltZRe9uJCHf8gg==, @@ -3926,10 +3927,10 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.35.1_eslint@8.23.0+typescript@4.7.4 + '@typescript-eslint/parser': 5.35.1_sorwav4hsh5vncerguqybud76i '@typescript-eslint/scope-manager': 5.35.1 - '@typescript-eslint/type-utils': 5.35.1_eslint@8.23.0+typescript@4.7.4 - '@typescript-eslint/utils': 5.35.1_eslint@8.23.0+typescript@4.7.4 + '@typescript-eslint/type-utils': 5.35.1_sorwav4hsh5vncerguqybud76i + '@typescript-eslint/utils': 5.35.1_sorwav4hsh5vncerguqybud76i debug: 4.3.4 eslint: 8.23.0 functional-red-black-tree: 1.0.1 @@ -3942,7 +3943,7 @@ packages: - supports-color dev: true - /@typescript-eslint/parser/5.35.1_eslint@8.23.0+typescript@4.5.4: + /@typescript-eslint/parser/5.35.1_pyvvhc3zqdua4akflcggygkl44: resolution: { integrity: sha512-XL2TBTSrh3yWAsMYpKseBYTVpvudNf69rPOWXWVBI08My2JVT5jR66eTt4IgQFHA/giiKJW5dUD4x/ZviCKyGg==, @@ -3957,15 +3958,15 @@ packages: dependencies: '@typescript-eslint/scope-manager': 5.35.1 '@typescript-eslint/types': 5.35.1 - '@typescript-eslint/typescript-estree': 5.35.1_typescript@4.5.4 + '@typescript-eslint/typescript-estree': 5.35.1_typescript@4.6.4 debug: 4.3.4 eslint: 8.23.0 - typescript: 4.5.4 + typescript: 4.6.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser/5.35.1_eslint@8.23.0+typescript@4.6.4: + /@typescript-eslint/parser/5.35.1_sorwav4hsh5vncerguqybud76i: resolution: { integrity: sha512-XL2TBTSrh3yWAsMYpKseBYTVpvudNf69rPOWXWVBI08My2JVT5jR66eTt4IgQFHA/giiKJW5dUD4x/ZviCKyGg==, @@ -3980,15 +3981,15 @@ packages: dependencies: '@typescript-eslint/scope-manager': 5.35.1 '@typescript-eslint/types': 5.35.1 - '@typescript-eslint/typescript-estree': 5.35.1_typescript@4.6.4 + '@typescript-eslint/typescript-estree': 5.35.1_typescript@4.7.4 debug: 4.3.4 eslint: 8.23.0 - typescript: 4.6.4 + typescript: 4.7.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser/5.35.1_eslint@8.23.0+typescript@4.7.4: + /@typescript-eslint/parser/5.35.1_svqrduhulcrphxzql7zpeoisfy: resolution: { integrity: sha512-XL2TBTSrh3yWAsMYpKseBYTVpvudNf69rPOWXWVBI08My2JVT5jR66eTt4IgQFHA/giiKJW5dUD4x/ZviCKyGg==, @@ -4003,10 +4004,10 @@ packages: dependencies: '@typescript-eslint/scope-manager': 5.35.1 '@typescript-eslint/types': 5.35.1 - '@typescript-eslint/typescript-estree': 5.35.1_typescript@4.7.4 + '@typescript-eslint/typescript-estree': 5.35.1_typescript@4.5.4 debug: 4.3.4 eslint: 8.23.0 - typescript: 4.7.4 + typescript: 4.5.4 transitivePeerDependencies: - supports-color dev: true @@ -4022,7 +4023,7 @@ packages: '@typescript-eslint/visitor-keys': 5.35.1 dev: true - /@typescript-eslint/type-utils/5.35.1_eslint@8.23.0+typescript@4.5.4: + /@typescript-eslint/type-utils/5.35.1_pyvvhc3zqdua4akflcggygkl44: resolution: { integrity: sha512-8xT8ljvo43Mp7BiTn1vxLXkjpw8wS4oAc00hMSB4L1/jIiYbjjnc3Qp2GAUOG/v8zsNCd1qwcqfCQ0BuishHkw==, @@ -4035,16 +4036,16 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/utils': 5.35.1_eslint@8.23.0+typescript@4.5.4 + '@typescript-eslint/utils': 5.35.1_pyvvhc3zqdua4akflcggygkl44 debug: 4.3.4 eslint: 8.23.0 - tsutils: 3.21.0_typescript@4.5.4 - typescript: 4.5.4 + tsutils: 3.21.0_typescript@4.6.4 + typescript: 4.6.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/type-utils/5.35.1_eslint@8.23.0+typescript@4.6.4: + /@typescript-eslint/type-utils/5.35.1_sorwav4hsh5vncerguqybud76i: resolution: { integrity: sha512-8xT8ljvo43Mp7BiTn1vxLXkjpw8wS4oAc00hMSB4L1/jIiYbjjnc3Qp2GAUOG/v8zsNCd1qwcqfCQ0BuishHkw==, @@ -4057,16 +4058,16 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/utils': 5.35.1_eslint@8.23.0+typescript@4.6.4 + '@typescript-eslint/utils': 5.35.1_sorwav4hsh5vncerguqybud76i debug: 4.3.4 eslint: 8.23.0 - tsutils: 3.21.0_typescript@4.6.4 - typescript: 4.6.4 + tsutils: 3.21.0_typescript@4.7.4 + typescript: 4.7.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/type-utils/5.35.1_eslint@8.23.0+typescript@4.7.4: + /@typescript-eslint/type-utils/5.35.1_svqrduhulcrphxzql7zpeoisfy: resolution: { integrity: sha512-8xT8ljvo43Mp7BiTn1vxLXkjpw8wS4oAc00hMSB4L1/jIiYbjjnc3Qp2GAUOG/v8zsNCd1qwcqfCQ0BuishHkw==, @@ -4079,11 +4080,11 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/utils': 5.35.1_eslint@8.23.0+typescript@4.7.4 + '@typescript-eslint/utils': 5.35.1_svqrduhulcrphxzql7zpeoisfy debug: 4.3.4 eslint: 8.23.0 - tsutils: 3.21.0_typescript@4.7.4 - typescript: 4.7.4 + tsutils: 3.21.0_typescript@4.5.4 + typescript: 4.5.4 transitivePeerDependencies: - supports-color dev: true @@ -4168,7 +4169,7 @@ packages: - supports-color dev: true - /@typescript-eslint/utils/5.35.1_eslint@8.23.0+typescript@4.5.4: + /@typescript-eslint/utils/5.35.1_pyvvhc3zqdua4akflcggygkl44: resolution: { integrity: sha512-v6F8JNXgeBWI4pzZn36hT2HXXzoBBBJuOYvoQiaQaEEjdi5STzux3Yj8v7ODIpx36i/5s8TdzuQ54TPc5AITQQ==, @@ -4180,7 +4181,7 @@ packages: '@types/json-schema': 7.0.11 '@typescript-eslint/scope-manager': 5.35.1 '@typescript-eslint/types': 5.35.1 - '@typescript-eslint/typescript-estree': 5.35.1_typescript@4.5.4 + '@typescript-eslint/typescript-estree': 5.35.1_typescript@4.6.4 eslint: 8.23.0 eslint-scope: 5.1.1 eslint-utils: 3.0.0_eslint@8.23.0 @@ -4189,7 +4190,7 @@ packages: - typescript dev: true - /@typescript-eslint/utils/5.35.1_eslint@8.23.0+typescript@4.6.4: + /@typescript-eslint/utils/5.35.1_sorwav4hsh5vncerguqybud76i: resolution: { integrity: sha512-v6F8JNXgeBWI4pzZn36hT2HXXzoBBBJuOYvoQiaQaEEjdi5STzux3Yj8v7ODIpx36i/5s8TdzuQ54TPc5AITQQ==, @@ -4201,7 +4202,7 @@ packages: '@types/json-schema': 7.0.11 '@typescript-eslint/scope-manager': 5.35.1 '@typescript-eslint/types': 5.35.1 - '@typescript-eslint/typescript-estree': 5.35.1_typescript@4.6.4 + '@typescript-eslint/typescript-estree': 5.35.1_typescript@4.7.4 eslint: 8.23.0 eslint-scope: 5.1.1 eslint-utils: 3.0.0_eslint@8.23.0 @@ -4210,7 +4211,7 @@ packages: - typescript dev: true - /@typescript-eslint/utils/5.35.1_eslint@8.23.0+typescript@4.7.4: + /@typescript-eslint/utils/5.35.1_svqrduhulcrphxzql7zpeoisfy: resolution: { integrity: sha512-v6F8JNXgeBWI4pzZn36hT2HXXzoBBBJuOYvoQiaQaEEjdi5STzux3Yj8v7ODIpx36i/5s8TdzuQ54TPc5AITQQ==, @@ -4222,7 +4223,7 @@ packages: '@types/json-schema': 7.0.11 '@typescript-eslint/scope-manager': 5.35.1 '@typescript-eslint/types': 5.35.1 - '@typescript-eslint/typescript-estree': 5.35.1_typescript@4.7.4 + '@typescript-eslint/typescript-estree': 5.35.1_typescript@4.5.4 eslint: 8.23.0 eslint-scope: 5.1.1 eslint-utils: 3.0.0_eslint@8.23.0 @@ -4271,7 +4272,6 @@ packages: } dependencies: sirv: 2.0.2 - dev: true /@yarn-tool/resolve-package/1.0.47: resolution: @@ -4461,6 +4461,8 @@ packages: dependencies: micromatch: 3.1.10 normalize-path: 2.1.1 + transitivePeerDependencies: + - supports-color dev: true /anymatch/3.1.2: @@ -4993,6 +4995,8 @@ packages: snapdragon-node: 2.1.1 split-string: 3.1.0 to-regex: 3.0.2 + transitivePeerDependencies: + - supports-color dev: true /braces/3.0.2: @@ -5907,6 +5911,11 @@ packages: { integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==, } + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true dependencies: ms: 2.0.0 dev: true @@ -5916,6 +5925,11 @@ packages: { integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==, } + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true dependencies: ms: 2.1.2 dev: true @@ -6683,6 +6697,8 @@ packages: dependencies: debug: 3.2.7 resolve: 1.22.1 + transitivePeerDependencies: + - supports-color dev: true /eslint-mdx/1.17.1_eslint@8.23.0: @@ -6706,38 +6722,59 @@ packages: dev: true optional: true - /eslint-module-utils/2.7.4_eslint@8.23.0: + /eslint-module-utils/2.7.4_623cbjb5syc5t6zi3e23jxeu34: resolution: { integrity: sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==, } engines: { node: '>=4' } peerDependencies: + '@typescript-eslint/parser': '*' eslint: '*' + eslint-import-resolver-node: '*' + eslint-import-resolver-typescript: '*' + eslint-import-resolver-webpack: '*' peerDependenciesMeta: + '@typescript-eslint/parser': + optional: true eslint: optional: true + eslint-import-resolver-node: + optional: true + eslint-import-resolver-typescript: + optional: true + eslint-import-resolver-webpack: + optional: true dependencies: + '@typescript-eslint/parser': 5.35.1_sorwav4hsh5vncerguqybud76i debug: 3.2.7 eslint: 8.23.0 + eslint-import-resolver-node: 0.3.6 + transitivePeerDependencies: + - supports-color dev: true - /eslint-plugin-import/2.26.0_eslint@8.23.0: + /eslint-plugin-import/2.26.0_kavhtzjob4obuugpatbfgsyfbm: resolution: { integrity: sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==, } engines: { node: '>=4' } peerDependencies: + '@typescript-eslint/parser': '*' eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 + peerDependenciesMeta: + '@typescript-eslint/parser': + optional: true dependencies: + '@typescript-eslint/parser': 5.35.1_sorwav4hsh5vncerguqybud76i array-includes: 3.1.5 array.prototype.flat: 1.3.0 debug: 2.6.9 doctrine: 2.1.0 eslint: 8.23.0 eslint-import-resolver-node: 0.3.6 - eslint-module-utils: 2.7.4_eslint@8.23.0 + eslint-module-utils: 2.7.4_623cbjb5syc5t6zi3e23jxeu34 has: 1.0.3 is-core-module: 2.10.0 is-glob: 4.0.3 @@ -6745,6 +6782,10 @@ packages: object.values: 1.1.5 resolve: 1.22.1 tsconfig-paths: 3.14.1 + transitivePeerDependencies: + - eslint-import-resolver-typescript + - eslint-import-resolver-webpack + - supports-color dev: true /eslint-plugin-jsx-a11y/6.6.1_eslint@8.23.0: @@ -6877,7 +6918,7 @@ packages: eslint: 8.23.0 dev: true - /eslint-plugin-svelte3/4.0.0_eslint@8.23.0+svelte@3.49.0: + /eslint-plugin-svelte3/4.0.0_sfdub7vxhxkt5wmgvhhmmgyu2e: resolution: { integrity: sha512-OIx9lgaNzD02+MDFNLw0GEUbuovNcglg+wnd/UY0fbZmlQSz7GlQiQ1f+yX0XvC07XPcDOnFcichqI3xCwp71g==, @@ -7189,6 +7230,8 @@ packages: regex-not: 1.0.2 snapdragon: 0.8.2 to-regex: 3.0.2 + transitivePeerDependencies: + - supports-color dev: true /expect/26.6.2: @@ -7280,6 +7323,8 @@ packages: regex-not: 1.0.2 snapdragon: 0.8.2 to-regex: 3.0.2 + transitivePeerDependencies: + - supports-color dev: true /fast-deep-equal/3.1.3: @@ -9131,6 +9176,8 @@ packages: walker: 1.0.8 optionalDependencies: fsevents: 2.3.2 + transitivePeerDependencies: + - supports-color dev: true /jest-haste-map/28.1.3: @@ -9313,6 +9360,8 @@ packages: '@jest/types': 26.6.2 jest-regex-util: 26.0.0 jest-snapshot: 26.6.2 + transitivePeerDependencies: + - supports-color dev: true /jest-resolve/26.6.2: @@ -9444,6 +9493,8 @@ packages: natural-compare: 1.4.0 pretty-format: 26.6.2 semver: 7.3.7 + transitivePeerDependencies: + - supports-color dev: true /jest-snapshot/28.1.3: @@ -10287,6 +10338,8 @@ packages: regex-not: 1.0.2 snapdragon: 0.8.2 to-regex: 3.0.2 + transitivePeerDependencies: + - supports-color dev: true /micromatch/4.0.5: @@ -10520,6 +10573,8 @@ packages: regex-not: 1.0.2 snapdragon: 0.8.2 to-regex: 3.0.2 + transitivePeerDependencies: + - supports-color dev: true /natural-compare/1.4.0: @@ -11324,7 +11379,7 @@ packages: engines: { node: '>= 0.8.0' } dev: true - /prettier-plugin-svelte/2.7.0_prettier@2.7.1+svelte@3.49.0: + /prettier-plugin-svelte/2.7.0_o3ioganyptcsrh6x4hnxvjkpqi: resolution: { integrity: sha512-fQhhZICprZot2IqEyoiUYLTRdumULGRvw0o4dzl5jt0jfzVWdGqeYW27QTWAeXhoupEZJULmNoH3ueJwUWFLIA==, @@ -12010,7 +12065,7 @@ packages: dependencies: glob: 7.2.3 - /rollup-plugin-typescript2/0.31.2_rollup@2.68.0+typescript@4.7.4: + /rollup-plugin-typescript2/0.31.2_jrqhcdvvfzmrsc4z5p6zs2uiwy: resolution: { integrity: sha512-hRwEYR1C8xDGVVMFJQdEVnNAeWRvpaY97g5mp3IeLnzhNXzSVq78Ye/BJ9PAaUfN4DXa/uDnqerifMOaMFY54Q==, @@ -12176,6 +12231,8 @@ packages: micromatch: 3.1.10 minimist: 1.2.6 walker: 1.0.8 + transitivePeerDependencies: + - supports-color dev: true /saxes/5.0.1: @@ -12332,7 +12389,6 @@ packages: '@polka/url': 1.0.0-next.21 mrmime: 1.0.1 totalist: 3.0.0 - dev: true /sisteransi/1.0.5: resolution: @@ -12437,6 +12493,8 @@ packages: source-map: 0.5.7 source-map-resolve: 0.5.3 use: 3.1.1 + transitivePeerDependencies: + - supports-color dev: true /sorcery/0.10.0: @@ -12871,7 +12929,7 @@ packages: } engines: { node: '>= 0.4' } - /svelte-check/2.8.1_c3e56b326347f79cbefa7b54654977f5: + /svelte-check/2.8.1_svelte@3.49.0: resolution: { integrity: sha512-cibyY1sgt3ONIDnQbSgV2X9AJFhwEslRHNo95lijrYfPzVEvTvbmL2ohsUyqB5L7j1GhLXtQbjCJ4lZZ/fwbeQ==, @@ -12887,7 +12945,7 @@ packages: picocolors: 1.0.0 sade: 1.8.1 svelte: 3.49.0 - svelte-preprocess: 4.10.7_8865006ef6c5ca9c2621594fcc5b0f9f + svelte-preprocess: 4.10.7_uslzfc62di2n2otc2tvfklnwji typescript: 4.7.4 transitivePeerDependencies: - '@babel/core' @@ -12922,7 +12980,7 @@ packages: zencrypt: 0.0.7 dev: true - /svelte-preprocess/4.10.7_280a73da7875c18e2397c4f760f243fd: + /svelte-preprocess/4.10.7_ueozcsexptisi2awlbuwt6eqmq: resolution: { integrity: sha512-sNPBnqYD6FnmdBrUmBCaqS00RyCsCpj2BG58A1JBswNF7b0OKviwxqVrOL/CKyJrLSClrSeqQv5BXNg2RUbPOw==, @@ -12966,7 +13024,6 @@ packages: typescript: optional: true dependencies: - '@babel/core': 7.18.13 '@types/pug': 2.0.6 '@types/sass': 1.43.1 detect-indent: 6.1.0 @@ -12977,7 +13034,7 @@ packages: typescript: 4.6.4 dev: true - /svelte-preprocess/4.10.7_8865006ef6c5ca9c2621594fcc5b0f9f: + /svelte-preprocess/4.10.7_uslzfc62di2n2otc2tvfklnwji: resolution: { integrity: sha512-sNPBnqYD6FnmdBrUmBCaqS00RyCsCpj2BG58A1JBswNF7b0OKviwxqVrOL/CKyJrLSClrSeqQv5BXNg2RUbPOw==, @@ -13021,7 +13078,6 @@ packages: typescript: optional: true dependencies: - '@babel/core': 7.18.13 '@types/pug': 2.0.6 '@types/sass': 1.43.1 detect-indent: 6.1.0 @@ -13032,7 +13088,7 @@ packages: typescript: 4.7.4 dev: true - /svelte-preprocess/4.10.7_bcee8d2d2825c991128217423905a22e: + /svelte-preprocess/4.10.7_vg3dtoa6m5cwrgayrz5b3xtqh4: resolution: { integrity: sha512-sNPBnqYD6FnmdBrUmBCaqS00RyCsCpj2BG58A1JBswNF7b0OKviwxqVrOL/CKyJrLSClrSeqQv5BXNg2RUbPOw==, @@ -13076,7 +13132,6 @@ packages: typescript: optional: true dependencies: - '@babel/core': 7.18.13 '@types/pug': 2.0.6 '@types/sass': 1.43.1 detect-indent: 6.1.0 @@ -13275,7 +13330,6 @@ packages: integrity: sha512-eM+pCBxXO/njtF7vdFsHuqb+ElbxqtI4r5EAvk6grfAFyJ6IvWlSkfZ5T9ozC6xWw3Fj1fGoSmrl0gUs46JVIw==, } engines: { node: '>=6' } - dev: true /tough-cookie/4.1.2: resolution: @@ -13367,7 +13421,7 @@ packages: } dev: false - /ts-jest/26.5.6_jest@26.6.3+typescript@4.7.4: + /ts-jest/26.5.6_rnfpnlbz3wqspag7uftsmccrvy: resolution: { integrity: sha512-rua+rCP8DxpA8b4DQD/6X2HQS8Zy/xzViVYfEs2OQu68tkCuKLV0Md8pmX55+W24uRIyAsf/BajRfxOs+R2MKA==, @@ -13574,7 +13628,6 @@ packages: } engines: { node: '>=4.2.0' } hasBin: true - dev: true /typescript/4.6.4: resolution: @@ -13688,6 +13741,7 @@ packages: integrity: sha512-vx2Z0vY+a3YoTj8+pttM3tiJHCwY5UFbYdiWrwBEbHmK8pvsPj2rtAX2BFfgXen8T39CJWblWRDT4L5WGXtDdg==, } dependencies: + '@types/unist': 2.0.6 bail: 1.0.5 extend: 3.0.2 is-buffer: 2.0.5 @@ -13703,6 +13757,7 @@ packages: integrity: sha512-Sg7j110mtefBD+qunSLO1lqOEKdrwBFBrR6Qd8f4uwkhWNlbkaqwHse6e7QvD3AP/MNoJdEDLaf8OxYyoWgorQ==, } dependencies: + '@types/unist': 2.0.6 bail: 1.0.5 extend: 3.0.2 is-buffer: 2.0.5 diff --git a/src/cmd/generate.ts b/src/cmd/generate.ts index 2c751841a3..882c62f6f4 100755 --- a/src/cmd/generate.ts +++ b/src/cmd/generate.ts @@ -17,6 +17,7 @@ import { parseJS, HoudiniError, } from '../common' +import { getSiteUrl } from '../constants' import * as generators from './generators' import * as transforms from './transforms' import { CollectedGraphQLDocument, ArtifactKind } from './types' @@ -159,7 +160,7 @@ export async function runPipeline(config: Config, docs: CollectedGraphQLDocument const major = parseInt(previousVersion.split('.')[1]) if (major < 16) { console.log( - `❓ For a description of what's changed, visit this guide: http://docs-next-kohl.vercel.app/guides/release-notes` + `❓ For a description of what's changed, visit this guide: ${getSiteUrl()}/guides/release-notes` ) } } diff --git a/src/cmd/generators/typescript/index.ts b/src/cmd/generators/typescript/index.ts index 89f62d4ce0..e4ebcc3834 100644 --- a/src/cmd/generators/typescript/index.ts +++ b/src/cmd/generators/typescript/index.ts @@ -4,6 +4,7 @@ import * as graphql from 'graphql' import path from 'path' import * as recast from 'recast' +import { getSiteUrl } from '../../../../build/constants' import { Config, HoudiniError, writeFile } from '../../../common' import { CollectedGraphQLDocument } from '../../types' import { flattenSelections } from '../../utils' @@ -151,7 +152,7 @@ ${[...missingScalars] } } -For more information, please visit this link: https://www.houdinigraphql.com/api/config#custom-scalars`) +For more information, please visit this link: ${getSiteUrl()}/api/config#custom-scalars`) } } diff --git a/src/cmd/transforms/list.ts b/src/cmd/transforms/list.ts index 58d656accf..5216a7aee2 100644 --- a/src/cmd/transforms/list.ts +++ b/src/cmd/transforms/list.ts @@ -2,6 +2,7 @@ import { logGreen, logYellow } from '@kitql/helper' import * as graphql from 'graphql' import { Config, parentTypeFromAncestors, HoudiniError } from '../../common' +import { getSiteUrl } from '../../constants' import { ArtifactKind } from '../../runtime/lib/types' import { CollectedGraphQLDocument } from '../types' import { TypeWrapper, unwrapType } from '../utils' @@ -449,7 +450,7 @@ const missingPaginationArgMessage = ( )} directive on a field but have not provided a ${logYellow('first')}, ${logYellow( 'last' )}, or ${logYellow('limit')} argument. Please add one and try again. -For more information, visit this link: https://www.houdinigraphql.com/guides/pagination` +For more information, visit this link: ${getSiteUrl()}/guides/pagination` const missingEdgeSelectionMessage = ( config: Config @@ -458,7 +459,7 @@ const missingEdgeSelectionMessage = ( )} directive on a field but your selection does not contain an ${logYellow( 'edges' )} field. Please add one and try again. -For more information, visit this link: https://www.houdinigraphql.com/guides/pagination` +For more information, visit this link: ${getSiteUrl()}/guides/pagination` const missingNodeSelectionMessage = ( config: Config @@ -467,14 +468,14 @@ const missingNodeSelectionMessage = ( )} directive on a field but your selection does not contain a ${logYellow( 'node' )} field. Please add one and try again. -For more information, visit this link: https://www.houdinigraphql.com/guides/pagination` +For more information, visit this link: ${getSiteUrl()}/guides/pagination` const edgeInvalidTypeMessage = (config: Config) => `Looks like you are trying to use the ${logGreen( `@${config.paginateDirective}` )} directive on a field but your field does not conform to the connection spec: your edges field seems strange. -For more information, visit this link: https://www.houdinigraphql.com/guides/pagination` +For more information, visit this link: ${getSiteUrl()}/guides/pagination` const nodeNotDefinedMessage = (config: Config) => `Looks like you are trying to use the ${logGreen( `@${config.paginateDirective}` )} directive on a field but your field does not conform to the connection spec: your edge type does not have node as a field. -For more information, visit this link: https://www.houdinigraphql.com/guides/pagination` +For more information, visit this link: ${getSiteUrl()}/guides/pagination` diff --git a/src/cmd/transforms/schema.ts b/src/cmd/transforms/schema.ts index a223640413..303538a655 100644 --- a/src/cmd/transforms/schema.ts +++ b/src/cmd/transforms/schema.ts @@ -2,6 +2,7 @@ import { mergeSchemas } from '@graphql-tools/schema' import * as graphql from 'graphql' import { Config } from '../../common' +import { getSiteUrl } from '../../constants' import { CachePolicy } from '../../runtime/lib/types' import { CollectedGraphQLDocument } from '../types' @@ -27,7 +28,7 @@ directive @${config.listDirective}(${config.listNameArg}: String!, connection: B """ @${config.paginateDirective} is used to to mark a field for pagination. - More info in the [doc](https://www.houdinigraphql.com/guides/pagination). + More info in the [doc](${getSiteUrl()}/guides/pagination). """ directive @${config.paginateDirective}(${config.paginateNameArg}: String) on FIELD @@ -39,23 +40,31 @@ directive @${config.listPrependDirective}( ) on FRAGMENT_SPREAD """ - @${config.listAppendDirective} is used to tell the runtime to add the result to the start of the list + @${ + config.listAppendDirective + } is used to tell the runtime to add the result to the start of the list """ directive @${config.listAppendDirective}(${config.listDirectiveParentIDArg}: ID) on FRAGMENT_SPREAD """ - @${config.listParentDirective} is used to provide a parentID without specifying position or in situations + @${ + config.listParentDirective + } is used to provide a parentID without specifying position or in situations where it doesn't make sense (eg when deleting a node.) """ directive @${config.listParentDirective}(value: ID!) on FRAGMENT_SPREAD """ - @${config.whenDirective} is used to provide a conditional or in situations where it doesn't make sense (eg when removing or deleting a node.) + @${ + config.whenDirective + } is used to provide a conditional or in situations where it doesn't make sense (eg when removing or deleting a node.) """ directive @${config.whenDirective} on FRAGMENT_SPREAD """ - @${config.whenNotDirective} is used to provide a conditional or in situations where it doesn't make sense (eg when removing or deleting a node.) + @${ + config.whenNotDirective + } is used to provide a conditional or in situations where it doesn't make sense (eg when removing or deleting a node.) """ directive @${config.whenNotDirective} on FRAGMENT_SPREAD @@ -67,10 +76,14 @@ directive @${config.argumentsDirective} on FRAGMENT_DEFINITION """ @${config.cacheDirective} is used to specify cache rules for a query """ -directive @${config.cacheDirective}(${config.cachePolicyArg}: CachePolicy, ${config.cachePartialArg}: Boolean) on QUERY +directive @${config.cacheDirective}(${config.cachePolicyArg}: CachePolicy, ${ + config.cachePartialArg + }: Boolean) on QUERY """ - @${config.houdiniDirective} is used to configure houdini's internal behavior such as opting-in an automatic load + @${ + config.houdiniDirective + } is used to configure houdini's internal behavior such as opting-in an automatic load """ directive @${config.houdiniDirective}(load: Boolean = true) on QUERY ` diff --git a/src/cmd/validators/typeCheck.ts b/src/cmd/validators/typeCheck.ts index 5644cbfd62..36fec88b86 100755 --- a/src/cmd/validators/typeCheck.ts +++ b/src/cmd/validators/typeCheck.ts @@ -7,6 +7,7 @@ import { parentTypeFromAncestors, HoudiniError, } from '../../common' +import { getSiteUrl } from '../../constants' import { FragmentArgument, fragmentArguments as collectFragmentArguments, @@ -1017,7 +1018,7 @@ extend type Query { For more information, please visit these links: - https://graphql.org/learn/global-object-identification/ -- https://www.houdinigraphql.com/guides/caching-data#custom-ids +- ${getSiteUrl()}/guides/caching-data#custom-ids ` const paginateOnNonNodeMessage = (config: Config, directiveName: string) => @@ -1026,6 +1027,6 @@ If this is happening inside of a fragment, make sure that the fragment either im have defined a resolver entry for the fragment type. For more information, please visit these links: -- https://www.houdinigraphql.com/guides/pagination#paginated-fragments -- https://www.houdinigraphql.com/guides/caching-data#custom-ids +- ${getSiteUrl()}/guides/pagination#paginated-fragments +- ${getSiteUrl()}/guides/caching-data#custom-ids ` diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 0000000000..a7a322697c --- /dev/null +++ b/src/constants.ts @@ -0,0 +1,7 @@ +export const getSiteUrl = () => { + const version = 'HOUDINI_VERSION' + if (version.includes('next')) { + return 'https://docs-next-kohl.vercel.app' + } + return 'https://www.houdinigraphql.com' +} diff --git a/src/runtime/index.ts b/src/runtime/index.ts index 8c2afb0266..3aa770820b 100644 --- a/src/runtime/index.ts +++ b/src/runtime/index.ts @@ -1,3 +1,4 @@ +import { getSiteUrl } from '../constants' import { GraphQLTagResult } from './lib/types' export * from './lib' @@ -22,6 +23,6 @@ export function graphql(str: TemplateStringsArray): any { // if this is executed, the preprocessor is not enabled throw new Error(`⚠️ graphql template was invoked at runtime. This should never happen and usually means that your project isn't properly configured. -Please make sure you have the appropriate plugin/preprocessor enabled. For more information, visit this link: https://www.houdinigraphql.com/guides/setting-up-your-project +Please make sure you have the appropriate plugin/preprocessor enabled. For more information, visit this link: ${getSiteUrl()}/guides/setting-up-your-project `) } diff --git a/src/runtime/lib/network.ts b/src/runtime/lib/network.ts index 0492df44bb..4964302210 100644 --- a/src/runtime/lib/network.ts +++ b/src/runtime/lib/network.ts @@ -1,6 +1,7 @@ import { LoadEvent, error, redirect } from '@sveltejs/kit' import { get } from 'svelte/store' +import { getSiteUrl } from '../../constants' import cache from '../cache' import { QueryResult } from '../stores/query' import type { ConfigFile } from './config' @@ -68,7 +69,7 @@ import { HoudiniClient } from '$houdini/runtime' export default new HoudiniClient(fetchQuery) -For more information, please visit this link: https://www.houdinigraphql.com/guides/migrating-to-0.15.0#environment +For more information, please visit this link: ${getSiteUrl()}/guides/migrating-to-0.15.0#environment ` ) } diff --git a/src/runtime/stores/pagination/cursor.ts b/src/runtime/stores/pagination/cursor.ts index 4eb46aa820..5c8c00e80f 100644 --- a/src/runtime/stores/pagination/cursor.ts +++ b/src/runtime/stores/pagination/cursor.ts @@ -1,5 +1,6 @@ import { Writable, writable } from 'svelte/store' +import { getSiteUrl } from '../../../constants' import cache from '../../cache' import { ConfigFile } from '../../lib/config' import { deepEquals } from '../../lib/deepEquals' @@ -77,7 +78,7 @@ export function cursorHandlers<_Data extends GraphQLObject, _Input>({ // make sure we have a type config for the pagination target type if (!config.types?.[targetType]?.resolve) { throw new Error( - `Missing type resolve configuration for ${targetType}. For more information, see https://www.houdinigraphql.com/guides/pagination#paginated-fragments` + `Missing type resolve configuration for ${targetType}. For more information, see ${getSiteUrl()}/guides/pagination#paginated-fragments` ) } diff --git a/src/runtime/stores/pagination/fragment.ts b/src/runtime/stores/pagination/fragment.ts index 7375d50543..61d8a7d5ac 100644 --- a/src/runtime/stores/pagination/fragment.ts +++ b/src/runtime/stores/pagination/fragment.ts @@ -1,5 +1,6 @@ import { derived, get, readable, Readable, Subscriber, Writable, writable } from 'svelte/store' +import { getSiteUrl } from '../../../constants' import { keyFieldsForType, getCurrentConfig } from '../../lib/config' import { GraphQLObject, @@ -43,7 +44,7 @@ class BasePaginatedFragmentStore<_Data extends GraphQLObject, _Input> extends Ba const typeConfig = config.types?.[targetType || ''] if (!typeConfig) { throw new Error( - `Missing type refetch configuration for ${targetType}. For more information, see https://www.houdinigraphql.com/guides/pagination#paginated-fragments` + `Missing type refetch configuration for ${targetType}. For more information, see ${getSiteUrl()}/guides/pagination#paginated-fragments` ) } diff --git a/src/runtime/stores/pagination/pageInfo.ts b/src/runtime/stores/pagination/pageInfo.ts index b432d4504e..65ca49e76c 100644 --- a/src/runtime/stores/pagination/pageInfo.ts +++ b/src/runtime/stores/pagination/pageInfo.ts @@ -1,3 +1,4 @@ +import { getSiteUrl } from '../../../constants' import { GraphQLObject } from '../../lib' import * as log from '../../lib/log' @@ -14,7 +15,7 @@ export type PageInfo = { export function missingPageSizeError(fnName: string) { return { - message: `${fnName} is missing the required page arguments. For more information, please visit this link: https://www.houdinigraphql.com/guides/pagination`, + message: `${fnName} is missing the required page arguments. For more information, please visit this link: ${getSiteUrl()}/guides/pagination`, } } From 0efd499a4001b2b55fb2034c940c73db4648f5ad Mon Sep 17 00:00:00 2001 From: jycouet Date: Thu, 1 Sep 2022 09:45:50 +0200 Subject: [PATCH 02/10] :children_crossing: IMPROVE: inline msg --- src/runtime/inline/mutation.ts | 9 +++++++++ src/runtime/inline/query.ts | 16 ++++++++++++++++ src/runtime/inline/subscription.ts | 12 ++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 src/runtime/inline/mutation.ts create mode 100644 src/runtime/inline/query.ts create mode 100644 src/runtime/inline/subscription.ts diff --git a/src/runtime/inline/mutation.ts b/src/runtime/inline/mutation.ts new file mode 100644 index 0000000000..d9a7e4ed84 --- /dev/null +++ b/src/runtime/inline/mutation.ts @@ -0,0 +1,9 @@ +import { getSiteUrl } from '../../common/constants' +import { GraphQLTagResult, Operation } from '../lib/index' + +export function mutation<_Mutation extends Operation>(store: GraphQLTagResult) { + // no longer exist! + throw new Error( + `inline mutation( ... ) no longer exist, check this guide: ${getSiteUrl()}/guides/release-notes#0160` + ) +} diff --git a/src/runtime/inline/query.ts b/src/runtime/inline/query.ts new file mode 100644 index 0000000000..00bc20f670 --- /dev/null +++ b/src/runtime/inline/query.ts @@ -0,0 +1,16 @@ +import { getSiteUrl } from '../../common/constants' +import { GraphQLTagResult, Operation } from '../lib/types' + +export function query<_Query extends Operation>(store: GraphQLTagResult) { + // no longer exist! + throw new Error( + `inline query( ... ) no longer exist, check this guide: ${getSiteUrl()}/guides/release-notes#0160` + ) +} + +export function paginatedQuery<_Query extends Operation>(document: GraphQLTagResult) { + // no longer exist! + throw new Error( + `inline paginatedQuery( ... ) no longer exist, check this guide: ${getSiteUrl()}/guides/release-notes#0160` + ) +} diff --git a/src/runtime/inline/subscription.ts b/src/runtime/inline/subscription.ts new file mode 100644 index 0000000000..95af29af9e --- /dev/null +++ b/src/runtime/inline/subscription.ts @@ -0,0 +1,12 @@ +import { getSiteUrl } from '../../common/constants' +import { GraphQLTagResult, Operation } from '../lib/types' + +export function subscription<_Subscription extends Operation>( + store: GraphQLTagResult, + variables?: _Subscription['input'] +) { + // no longer exist! + throw new Error( + `inline mutation( ... ) no longer exist, check this guide: ${getSiteUrl()}/guides/release-notes#0160` + ) +} From 108fe911bbb076410fff08b3348dd6039a455966 Mon Sep 17 00:00:00 2001 From: jycouet Date: Thu, 1 Sep 2022 09:46:02 +0200 Subject: [PATCH 03/10] :recycle: UPDATE: constants location --- src/cmd/generate.ts | 2 +- src/cmd/generators/typescript/index.ts | 2 +- src/cmd/transforms/list.ts | 2 +- src/cmd/transforms/schema.ts | 2 +- src/cmd/validators/typeCheck.ts | 2 +- src/{ => common}/constants.ts | 0 src/runtime/index.ts | 2 +- src/runtime/lib/network.ts | 2 +- src/runtime/stores/pagination/cursor.ts | 2 +- src/runtime/stores/pagination/fragment.ts | 2 +- src/runtime/stores/pagination/pageInfo.ts | 2 +- 11 files changed, 10 insertions(+), 10 deletions(-) rename src/{ => common}/constants.ts (100%) diff --git a/src/cmd/generate.ts b/src/cmd/generate.ts index 882c62f6f4..b01d5dbd00 100755 --- a/src/cmd/generate.ts +++ b/src/cmd/generate.ts @@ -17,7 +17,7 @@ import { parseJS, HoudiniError, } from '../common' -import { getSiteUrl } from '../constants' +import { getSiteUrl } from '../common/constants' import * as generators from './generators' import * as transforms from './transforms' import { CollectedGraphQLDocument, ArtifactKind } from './types' diff --git a/src/cmd/generators/typescript/index.ts b/src/cmd/generators/typescript/index.ts index e4ebcc3834..b12057f1a3 100644 --- a/src/cmd/generators/typescript/index.ts +++ b/src/cmd/generators/typescript/index.ts @@ -4,8 +4,8 @@ import * as graphql from 'graphql' import path from 'path' import * as recast from 'recast' -import { getSiteUrl } from '../../../../build/constants' import { Config, HoudiniError, writeFile } from '../../../common' +import { getSiteUrl } from '../../../common/constants' import { CollectedGraphQLDocument } from '../../types' import { flattenSelections } from '../../utils' import { addReferencedInputTypes } from './addReferencedInputTypes' diff --git a/src/cmd/transforms/list.ts b/src/cmd/transforms/list.ts index 5216a7aee2..ac30824bf8 100644 --- a/src/cmd/transforms/list.ts +++ b/src/cmd/transforms/list.ts @@ -2,7 +2,7 @@ import { logGreen, logYellow } from '@kitql/helper' import * as graphql from 'graphql' import { Config, parentTypeFromAncestors, HoudiniError } from '../../common' -import { getSiteUrl } from '../../constants' +import { getSiteUrl } from '../../common/constants' import { ArtifactKind } from '../../runtime/lib/types' import { CollectedGraphQLDocument } from '../types' import { TypeWrapper, unwrapType } from '../utils' diff --git a/src/cmd/transforms/schema.ts b/src/cmd/transforms/schema.ts index 303538a655..6a4250a693 100644 --- a/src/cmd/transforms/schema.ts +++ b/src/cmd/transforms/schema.ts @@ -2,7 +2,7 @@ import { mergeSchemas } from '@graphql-tools/schema' import * as graphql from 'graphql' import { Config } from '../../common' -import { getSiteUrl } from '../../constants' +import { getSiteUrl } from '../../common/constants' import { CachePolicy } from '../../runtime/lib/types' import { CollectedGraphQLDocument } from '../types' diff --git a/src/cmd/validators/typeCheck.ts b/src/cmd/validators/typeCheck.ts index 36fec88b86..73431b547b 100755 --- a/src/cmd/validators/typeCheck.ts +++ b/src/cmd/validators/typeCheck.ts @@ -7,7 +7,7 @@ import { parentTypeFromAncestors, HoudiniError, } from '../../common' -import { getSiteUrl } from '../../constants' +import { getSiteUrl } from '../../common/constants' import { FragmentArgument, fragmentArguments as collectFragmentArguments, diff --git a/src/constants.ts b/src/common/constants.ts similarity index 100% rename from src/constants.ts rename to src/common/constants.ts diff --git a/src/runtime/index.ts b/src/runtime/index.ts index 3aa770820b..7ed8a6faa5 100644 --- a/src/runtime/index.ts +++ b/src/runtime/index.ts @@ -1,4 +1,4 @@ -import { getSiteUrl } from '../constants' +import { getSiteUrl } from '../common/constants' import { GraphQLTagResult } from './lib/types' export * from './lib' diff --git a/src/runtime/lib/network.ts b/src/runtime/lib/network.ts index 4964302210..af29cea5e2 100644 --- a/src/runtime/lib/network.ts +++ b/src/runtime/lib/network.ts @@ -1,7 +1,7 @@ import { LoadEvent, error, redirect } from '@sveltejs/kit' import { get } from 'svelte/store' -import { getSiteUrl } from '../../constants' +import { getSiteUrl } from '../../common/constants' import cache from '../cache' import { QueryResult } from '../stores/query' import type { ConfigFile } from './config' diff --git a/src/runtime/stores/pagination/cursor.ts b/src/runtime/stores/pagination/cursor.ts index 5c8c00e80f..3724d977b6 100644 --- a/src/runtime/stores/pagination/cursor.ts +++ b/src/runtime/stores/pagination/cursor.ts @@ -1,6 +1,6 @@ import { Writable, writable } from 'svelte/store' -import { getSiteUrl } from '../../../constants' +import { getSiteUrl } from '../../../common/constants' import cache from '../../cache' import { ConfigFile } from '../../lib/config' import { deepEquals } from '../../lib/deepEquals' diff --git a/src/runtime/stores/pagination/fragment.ts b/src/runtime/stores/pagination/fragment.ts index 61d8a7d5ac..ff2b66304c 100644 --- a/src/runtime/stores/pagination/fragment.ts +++ b/src/runtime/stores/pagination/fragment.ts @@ -1,6 +1,6 @@ import { derived, get, readable, Readable, Subscriber, Writable, writable } from 'svelte/store' -import { getSiteUrl } from '../../../constants' +import { getSiteUrl } from '../../../common/constants' import { keyFieldsForType, getCurrentConfig } from '../../lib/config' import { GraphQLObject, diff --git a/src/runtime/stores/pagination/pageInfo.ts b/src/runtime/stores/pagination/pageInfo.ts index 65ca49e76c..7a22bdf3ce 100644 --- a/src/runtime/stores/pagination/pageInfo.ts +++ b/src/runtime/stores/pagination/pageInfo.ts @@ -1,4 +1,4 @@ -import { getSiteUrl } from '../../../constants' +import { getSiteUrl } from '../../../common/constants' import { GraphQLObject } from '../../lib' import * as log from '../../lib/log' From d390dfb1540ecf55f12b49424c8ba2e016589b98 Mon Sep 17 00:00:00 2001 From: jycouet Date: Thu, 1 Sep 2022 13:29:22 +0200 Subject: [PATCH 04/10] :sparkles: NEW: HoudiniRTError --- src/runtime/inline/index.ts | 3 +++ src/runtime/inline/mutation.ts | 15 ++++++++---- src/runtime/inline/query.ts | 29 ++++++++++++++++------- src/runtime/inline/subscription.ts | 15 ++++++++---- src/runtime/lib/HoudiniRTError.ts | 28 ++++++++++++++++++++++ src/runtime/lib/constants.ts | 37 ++++++++++++++++++++++++++++++ 6 files changed, 111 insertions(+), 16 deletions(-) create mode 100644 src/runtime/lib/HoudiniRTError.ts create mode 100644 src/runtime/lib/constants.ts diff --git a/src/runtime/inline/index.ts b/src/runtime/inline/index.ts index 08ccda82d1..4dc7c69d61 100644 --- a/src/runtime/inline/index.ts +++ b/src/runtime/inline/index.ts @@ -1 +1,4 @@ export { fragment, paginatedFragment } from './fragment' +export { query, paginatedQuery } from './query' +export { mutation } from './mutation' +export { subscription } from './subscription' diff --git a/src/runtime/inline/mutation.ts b/src/runtime/inline/mutation.ts index d9a7e4ed84..915f4f111a 100644 --- a/src/runtime/inline/mutation.ts +++ b/src/runtime/inline/mutation.ts @@ -1,9 +1,16 @@ -import { getSiteUrl } from '../../common/constants' +import { HoudiniRTError } from '../lib/HoudiniRTError' +import { InfoReleaseNote, OutdatedFunctionInlineInfo } from '../lib/constants' import { GraphQLTagResult, Operation } from '../lib/index' export function mutation<_Mutation extends Operation>(store: GraphQLTagResult) { // no longer exist! - throw new Error( - `inline mutation( ... ) no longer exist, check this guide: ${getSiteUrl()}/guides/release-notes#0160` - ) + throw new HoudiniRTError({ + type: 'OutdatedFunction', + message: 'mutation', + extraInfo: [ + OutdatedFunctionInlineInfo('mutation', store.artifact.name), + InfoReleaseNote('#0160'), + ], + quiet: true, + }) } diff --git a/src/runtime/inline/query.ts b/src/runtime/inline/query.ts index 00bc20f670..eb3ec9c541 100644 --- a/src/runtime/inline/query.ts +++ b/src/runtime/inline/query.ts @@ -1,16 +1,29 @@ -import { getSiteUrl } from '../../common/constants' +import { HoudiniRTError } from '../lib/HoudiniRTError' +import { getSiteUrl, InfoReleaseNote, OutdatedFunctionInlineInfo } from '../lib/constants' import { GraphQLTagResult, Operation } from '../lib/types' export function query<_Query extends Operation>(store: GraphQLTagResult) { // no longer exist! - throw new Error( - `inline query( ... ) no longer exist, check this guide: ${getSiteUrl()}/guides/release-notes#0160` - ) + throw new HoudiniRTError({ + type: 'OutdatedFunction', + message: 'query', + extraInfo: [ + OutdatedFunctionInlineInfo('query', store.artifact.name), + InfoReleaseNote('#0160'), + ], + quiet: true, + }) } -export function paginatedQuery<_Query extends Operation>(document: GraphQLTagResult) { +export function paginatedQuery<_Query extends Operation>(store: GraphQLTagResult) { // no longer exist! - throw new Error( - `inline paginatedQuery( ... ) no longer exist, check this guide: ${getSiteUrl()}/guides/release-notes#0160` - ) + throw new HoudiniRTError({ + type: 'OutdatedFunction', + message: 'paginatedQuery', + extraInfo: [ + OutdatedFunctionInlineInfo('paginatedQuery', store.artifact.name), + InfoReleaseNote('#0160'), + ], + quiet: true, + }) } diff --git a/src/runtime/inline/subscription.ts b/src/runtime/inline/subscription.ts index 95af29af9e..baf9b7f0c3 100644 --- a/src/runtime/inline/subscription.ts +++ b/src/runtime/inline/subscription.ts @@ -1,4 +1,5 @@ -import { getSiteUrl } from '../../common/constants' +import { HoudiniRTError } from '../lib/HoudiniRTError' +import { InfoReleaseNote, OutdatedFunctionInlineInfo } from '../lib/constants' import { GraphQLTagResult, Operation } from '../lib/types' export function subscription<_Subscription extends Operation>( @@ -6,7 +7,13 @@ export function subscription<_Subscription extends Operation>( variables?: _Subscription['input'] ) { // no longer exist! - throw new Error( - `inline mutation( ... ) no longer exist, check this guide: ${getSiteUrl()}/guides/release-notes#0160` - ) + throw new HoudiniRTError({ + type: 'OutdatedFunction', + message: 'subscription', + extraInfo: [ + OutdatedFunctionInlineInfo('subscription', store.artifact.name), + InfoReleaseNote('#0160'), + ], + quiet: true, + }) } diff --git a/src/runtime/lib/HoudiniRTError.ts b/src/runtime/lib/HoudiniRTError.ts new file mode 100644 index 0000000000..77d6647ec3 --- /dev/null +++ b/src/runtime/lib/HoudiniRTError.ts @@ -0,0 +1,28 @@ +export type RTErrorType = 'default' | 'OutdatedFunction' + +// Houdini Runtime Error (something light-weighted) +export class HoudiniRTError extends Error { + constructor({ + message, + type = 'default', + extraInfo = [], + quiet = false, + }: { + message: string + type?: RTErrorType + extraInfo?: string[] + quiet?: boolean + }) { + // log extra info before throwing error + extraInfo?.forEach((line) => { + console.log(line) + }) + + super(type === 'OutdatedFunction' ? `Outdated function "${message}"` : message) + + // if quiet, don't log the stack trace + if (quiet) { + this.stack = '' + } + } +} diff --git a/src/runtime/lib/constants.ts b/src/runtime/lib/constants.ts new file mode 100644 index 0000000000..503363af7c --- /dev/null +++ b/src/runtime/lib/constants.ts @@ -0,0 +1,37 @@ +export const getSiteUrl = () => { + const nextUrl = 'https://docs-next-kohl.vercel.app' + const currenttUrl = 'https://www.houdinigraphql.com' + + // in test, return currenttUrl + if (process.env.TEST === 'true') { + return currenttUrl + } + + // Now, manual return... until automatic detection (hint bellow) + return nextUrl + + // HOUDINI_VERSION is not replaced in runtime, only cmd + // maybe in runtime we could check meta.json? + // const version = 'HOUDINI_VERSION' + + // if (version.includes('next')) { + // return 'https://docs-next-kohl.vercel.app' + // } + // return 'https://www.houdinigraphql.com' +} + +/** + * @param focus example "#0160" + */ +export const InfoReleaseNote = (focus?: string) => { + return `❓ For more info, visit this guide: ${getSiteUrl()}/guides/release-notes${ + focus ? `${focus}` : '' + }` +} + +export const OutdatedFunctionInlineInfo = ( + type: 'query' | 'paginatedQuery' | 'mutation' | 'subscription', + name: string +) => { + return `❌ inline function "${type}" no longer exist (used with: '${name}' ${type}).` +} From e0988909e0d44ed189b2148b0a753edd1b30cf6c Mon Sep 17 00:00:00 2001 From: jycouet Date: Thu, 1 Sep 2022 13:32:48 +0200 Subject: [PATCH 05/10] :construction: UPDATE: location --- src/cmd/generate.ts | 2 +- src/cmd/generators/typescript/index.ts | 2 +- src/cmd/transforms/list.ts | 2 +- src/cmd/transforms/schema.ts | 2 +- src/cmd/validators/typeCheck.ts | 2 +- src/common/constants.ts | 7 ------- src/runtime/index.ts | 2 +- src/runtime/lib/constants.ts | 2 +- src/runtime/lib/network.ts | 2 +- src/runtime/stores/pagination/cursor.ts | 2 +- src/runtime/stores/pagination/fragment.ts | 2 +- src/runtime/stores/pagination/pageInfo.ts | 2 +- 12 files changed, 11 insertions(+), 18 deletions(-) delete mode 100644 src/common/constants.ts diff --git a/src/cmd/generate.ts b/src/cmd/generate.ts index b01d5dbd00..4d116bca98 100755 --- a/src/cmd/generate.ts +++ b/src/cmd/generate.ts @@ -17,7 +17,7 @@ import { parseJS, HoudiniError, } from '../common' -import { getSiteUrl } from '../common/constants' +import { getSiteUrl } from '../runtime/lib/constants' import * as generators from './generators' import * as transforms from './transforms' import { CollectedGraphQLDocument, ArtifactKind } from './types' diff --git a/src/cmd/generators/typescript/index.ts b/src/cmd/generators/typescript/index.ts index b12057f1a3..2e11978362 100644 --- a/src/cmd/generators/typescript/index.ts +++ b/src/cmd/generators/typescript/index.ts @@ -5,7 +5,7 @@ import path from 'path' import * as recast from 'recast' import { Config, HoudiniError, writeFile } from '../../../common' -import { getSiteUrl } from '../../../common/constants' +import { getSiteUrl } from '../../../runtime/lib/constants' import { CollectedGraphQLDocument } from '../../types' import { flattenSelections } from '../../utils' import { addReferencedInputTypes } from './addReferencedInputTypes' diff --git a/src/cmd/transforms/list.ts b/src/cmd/transforms/list.ts index ac30824bf8..e6f583c5fd 100644 --- a/src/cmd/transforms/list.ts +++ b/src/cmd/transforms/list.ts @@ -2,7 +2,7 @@ import { logGreen, logYellow } from '@kitql/helper' import * as graphql from 'graphql' import { Config, parentTypeFromAncestors, HoudiniError } from '../../common' -import { getSiteUrl } from '../../common/constants' +import { getSiteUrl } from '../../runtime/lib/constants' import { ArtifactKind } from '../../runtime/lib/types' import { CollectedGraphQLDocument } from '../types' import { TypeWrapper, unwrapType } from '../utils' diff --git a/src/cmd/transforms/schema.ts b/src/cmd/transforms/schema.ts index 6a4250a693..e46154ed63 100644 --- a/src/cmd/transforms/schema.ts +++ b/src/cmd/transforms/schema.ts @@ -2,7 +2,7 @@ import { mergeSchemas } from '@graphql-tools/schema' import * as graphql from 'graphql' import { Config } from '../../common' -import { getSiteUrl } from '../../common/constants' +import { getSiteUrl } from '../../runtime/lib/constants' import { CachePolicy } from '../../runtime/lib/types' import { CollectedGraphQLDocument } from '../types' diff --git a/src/cmd/validators/typeCheck.ts b/src/cmd/validators/typeCheck.ts index 73431b547b..e074d721c5 100755 --- a/src/cmd/validators/typeCheck.ts +++ b/src/cmd/validators/typeCheck.ts @@ -7,7 +7,7 @@ import { parentTypeFromAncestors, HoudiniError, } from '../../common' -import { getSiteUrl } from '../../common/constants' +import { getSiteUrl } from '../../runtime/lib/constants' import { FragmentArgument, fragmentArguments as collectFragmentArguments, diff --git a/src/common/constants.ts b/src/common/constants.ts deleted file mode 100644 index a7a322697c..0000000000 --- a/src/common/constants.ts +++ /dev/null @@ -1,7 +0,0 @@ -export const getSiteUrl = () => { - const version = 'HOUDINI_VERSION' - if (version.includes('next')) { - return 'https://docs-next-kohl.vercel.app' - } - return 'https://www.houdinigraphql.com' -} diff --git a/src/runtime/index.ts b/src/runtime/index.ts index 7ed8a6faa5..a402581b4c 100644 --- a/src/runtime/index.ts +++ b/src/runtime/index.ts @@ -1,4 +1,4 @@ -import { getSiteUrl } from '../common/constants' +import { getSiteUrl } from './lib/constants' import { GraphQLTagResult } from './lib/types' export * from './lib' diff --git a/src/runtime/lib/constants.ts b/src/runtime/lib/constants.ts index 503363af7c..79842f999c 100644 --- a/src/runtime/lib/constants.ts +++ b/src/runtime/lib/constants.ts @@ -33,5 +33,5 @@ export const OutdatedFunctionInlineInfo = ( type: 'query' | 'paginatedQuery' | 'mutation' | 'subscription', name: string ) => { - return `❌ inline function "${type}" no longer exist (used with: '${name}' ${type}).` + return `❌ inline function "${type}" no longer exist (update: '${name}' ${type}).` } diff --git a/src/runtime/lib/network.ts b/src/runtime/lib/network.ts index af29cea5e2..e45fb8d1cd 100644 --- a/src/runtime/lib/network.ts +++ b/src/runtime/lib/network.ts @@ -1,10 +1,10 @@ import { LoadEvent, error, redirect } from '@sveltejs/kit' import { get } from 'svelte/store' -import { getSiteUrl } from '../../common/constants' import cache from '../cache' import { QueryResult } from '../stores/query' import type { ConfigFile } from './config' +import { getSiteUrl } from './constants' import * as log from './log' import { marshalInputs } from './scalars' import { diff --git a/src/runtime/stores/pagination/cursor.ts b/src/runtime/stores/pagination/cursor.ts index 3724d977b6..deaceb1c83 100644 --- a/src/runtime/stores/pagination/cursor.ts +++ b/src/runtime/stores/pagination/cursor.ts @@ -1,8 +1,8 @@ import { Writable, writable } from 'svelte/store' -import { getSiteUrl } from '../../../common/constants' import cache from '../../cache' import { ConfigFile } from '../../lib/config' +import { getSiteUrl } from '../../lib/constants' import { deepEquals } from '../../lib/deepEquals' import { executeQuery } from '../../lib/network' import { GraphQLObject, QueryArtifact } from '../../lib/types' diff --git a/src/runtime/stores/pagination/fragment.ts b/src/runtime/stores/pagination/fragment.ts index ff2b66304c..a4e1d83dee 100644 --- a/src/runtime/stores/pagination/fragment.ts +++ b/src/runtime/stores/pagination/fragment.ts @@ -1,7 +1,7 @@ import { derived, get, readable, Readable, Subscriber, Writable, writable } from 'svelte/store' -import { getSiteUrl } from '../../../common/constants' import { keyFieldsForType, getCurrentConfig } from '../../lib/config' +import { getSiteUrl } from '../../lib/constants' import { GraphQLObject, FragmentArtifact, diff --git a/src/runtime/stores/pagination/pageInfo.ts b/src/runtime/stores/pagination/pageInfo.ts index 7a22bdf3ce..e06a0d20da 100644 --- a/src/runtime/stores/pagination/pageInfo.ts +++ b/src/runtime/stores/pagination/pageInfo.ts @@ -1,5 +1,5 @@ -import { getSiteUrl } from '../../../common/constants' import { GraphQLObject } from '../../lib' +import { getSiteUrl } from '../../lib/constants' import * as log from '../../lib/log' export function nullPageInfo(): PageInfo { From 1ce6e0ec32350cf7611c71ccea71ba98880c0e53 Mon Sep 17 00:00:00 2001 From: jycouet Date: Thu, 1 Sep 2022 13:42:31 +0200 Subject: [PATCH 06/10] :sparkles: NEW: HoudiniRTError --- src/runtime/inline/mutation.ts | 3 +-- src/runtime/inline/query.ts | 7 +++---- src/runtime/inline/subscription.ts | 3 +-- src/runtime/lib/HoudiniRTError.ts | 23 ++++++++++++----------- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/runtime/inline/mutation.ts b/src/runtime/inline/mutation.ts index 915f4f111a..64d82fff20 100644 --- a/src/runtime/inline/mutation.ts +++ b/src/runtime/inline/mutation.ts @@ -4,9 +4,8 @@ import { GraphQLTagResult, Operation } from '../lib/index' export function mutation<_Mutation extends Operation>(store: GraphQLTagResult) { // no longer exist! - throw new HoudiniRTError({ + throw new HoudiniRTError('mutation', { type: 'OutdatedFunction', - message: 'mutation', extraInfo: [ OutdatedFunctionInlineInfo('mutation', store.artifact.name), InfoReleaseNote('#0160'), diff --git a/src/runtime/inline/query.ts b/src/runtime/inline/query.ts index eb3ec9c541..778874db84 100644 --- a/src/runtime/inline/query.ts +++ b/src/runtime/inline/query.ts @@ -4,9 +4,9 @@ import { GraphQLTagResult, Operation } from '../lib/types' export function query<_Query extends Operation>(store: GraphQLTagResult) { // no longer exist! - throw new HoudiniRTError({ + throw new HoudiniRTError('query', { type: 'OutdatedFunction', - message: 'query', + extraInfo: [ OutdatedFunctionInlineInfo('query', store.artifact.name), InfoReleaseNote('#0160'), @@ -17,9 +17,8 @@ export function query<_Query extends Operation>(store: GraphQLTagResul export function paginatedQuery<_Query extends Operation>(store: GraphQLTagResult) { // no longer exist! - throw new HoudiniRTError({ + throw new HoudiniRTError('paginatedQuery', { type: 'OutdatedFunction', - message: 'paginatedQuery', extraInfo: [ OutdatedFunctionInlineInfo('paginatedQuery', store.artifact.name), InfoReleaseNote('#0160'), diff --git a/src/runtime/inline/subscription.ts b/src/runtime/inline/subscription.ts index baf9b7f0c3..ff15c4d54a 100644 --- a/src/runtime/inline/subscription.ts +++ b/src/runtime/inline/subscription.ts @@ -7,9 +7,8 @@ export function subscription<_Subscription extends Operation>( variables?: _Subscription['input'] ) { // no longer exist! - throw new HoudiniRTError({ + throw new HoudiniRTError('subscription', { type: 'OutdatedFunction', - message: 'subscription', extraInfo: [ OutdatedFunctionInlineInfo('subscription', store.artifact.name), InfoReleaseNote('#0160'), diff --git a/src/runtime/lib/HoudiniRTError.ts b/src/runtime/lib/HoudiniRTError.ts index 77d6647ec3..2fee5f5975 100644 --- a/src/runtime/lib/HoudiniRTError.ts +++ b/src/runtime/lib/HoudiniRTError.ts @@ -2,17 +2,18 @@ export type RTErrorType = 'default' | 'OutdatedFunction' // Houdini Runtime Error (something light-weighted) export class HoudiniRTError extends Error { - constructor({ - message, - type = 'default', - extraInfo = [], - quiet = false, - }: { - message: string - type?: RTErrorType - extraInfo?: string[] - quiet?: boolean - }) { + constructor( + message: string, + { + type = 'default', + extraInfo = [], + quiet = false, + }: { + type?: RTErrorType + extraInfo?: string[] + quiet?: boolean + } + ) { // log extra info before throwing error extraInfo?.forEach((line) => { console.log(line) From d2ec9c72fb979a276e64b77cce2dae833a491d06 Mon Sep 17 00:00:00 2001 From: jycouet Date: Thu, 1 Sep 2022 14:17:44 +0200 Subject: [PATCH 07/10] :bug: FIX: page migrating-to-0.15.0#environment no longer exist --- src/cmd/generators/runtime/copyRuntime.test.ts | 3 --- src/runtime/lib/network.ts | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/cmd/generators/runtime/copyRuntime.test.ts b/src/cmd/generators/runtime/copyRuntime.test.ts index 79fb9d95c0..6a550236f4 100644 --- a/src/cmd/generators/runtime/copyRuntime.test.ts +++ b/src/cmd/generators/runtime/copyRuntime.test.ts @@ -124,9 +124,6 @@ test('updates the network file with the client path', async function () { import { HoudiniClient } from '$houdini/runtime' export default new HoudiniClient(fetchQuery) - - - For more information, please visit this link: https://www.houdinigraphql.com/guides/migrating-to-0.15.0#environment \`); } } diff --git a/src/runtime/lib/network.ts b/src/runtime/lib/network.ts index e45fb8d1cd..191273398f 100644 --- a/src/runtime/lib/network.ts +++ b/src/runtime/lib/network.ts @@ -67,9 +67,6 @@ You should update your client to look something like the following: import { HoudiniClient } from '$houdini/runtime' export default new HoudiniClient(fetchQuery) - - -For more information, please visit this link: ${getSiteUrl()}/guides/migrating-to-0.15.0#environment ` ) } From 664480d59c1db3a114242db9c2dc5f682ad57e00 Mon Sep 17 00:00:00 2001 From: jycouet Date: Thu, 1 Sep 2022 14:28:01 +0200 Subject: [PATCH 08/10] :pencil2: UPDATE: changeset --- .changeset/beige-cherries-shave.md | 5 +++++ src/runtime/lib/constants.ts | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 .changeset/beige-cherries-shave.md diff --git a/.changeset/beige-cherries-shave.md b/.changeset/beige-cherries-shave.md new file mode 100644 index 0000000000..cfcd9f6caf --- /dev/null +++ b/.changeset/beige-cherries-shave.md @@ -0,0 +1,5 @@ +--- +'houdini': patch +--- + +warn users that inline functions no longer exist diff --git a/src/runtime/lib/constants.ts b/src/runtime/lib/constants.ts index 79842f999c..8c60f459f4 100644 --- a/src/runtime/lib/constants.ts +++ b/src/runtime/lib/constants.ts @@ -1,17 +1,23 @@ export const getSiteUrl = () => { - const nextUrl = 'https://docs-next-kohl.vercel.app' - const currenttUrl = 'https://www.houdinigraphql.com' + const next_url = 'https://docs-next-kohl.vercel.app' + const current_url = 'https://www.houdinigraphql.com' - // in test, return currenttUrl - if (process.env.TEST === 'true') { - return currenttUrl + // in TEST, return current Url (for stable snapshots) + try { + if (process?.env?.TEST === 'true') { + return current_url + } + } catch (error) { + // This is failing in a client site navigation! + // That's why it's in a try catch } // Now, manual return... until automatic detection (hint bellow) - return nextUrl + return next_url // HOUDINI_VERSION is not replaced in runtime, only cmd // maybe in runtime we could check meta.json? + // const version = 'HOUDINI_VERSION' // if (version.includes('next')) { From c6bca26e098901df44ea7089c472480bdcd3e483 Mon Sep 17 00:00:00 2001 From: jycouet Date: Thu, 1 Sep 2022 18:49:47 +0200 Subject: [PATCH 09/10] :recycle: REMOVE: comments --- src/runtime/lib/constants.ts | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/src/runtime/lib/constants.ts b/src/runtime/lib/constants.ts index 8c60f459f4..bbead42993 100644 --- a/src/runtime/lib/constants.ts +++ b/src/runtime/lib/constants.ts @@ -1,29 +1,10 @@ export const getSiteUrl = () => { + // Now, manual return const next_url = 'https://docs-next-kohl.vercel.app' - const current_url = 'https://www.houdinigraphql.com' - - // in TEST, return current Url (for stable snapshots) - try { - if (process?.env?.TEST === 'true') { - return current_url - } - } catch (error) { - // This is failing in a client site navigation! - // That's why it's in a try catch - } - - // Now, manual return... until automatic detection (hint bellow) return next_url - // HOUDINI_VERSION is not replaced in runtime, only cmd - // maybe in runtime we could check meta.json? - - // const version = 'HOUDINI_VERSION' - - // if (version.includes('next')) { - // return 'https://docs-next-kohl.vercel.app' - // } - // return 'https://www.houdinigraphql.com' + // const current_url = 'https://www.houdinigraphql.com' + // return next_url } /** From 4c5d12704e15250f93727a9091f05709cb267642 Mon Sep 17 00:00:00 2001 From: jycouet Date: Thu, 1 Sep 2022 18:57:39 +0200 Subject: [PATCH 10/10] :recycle: UPDATE: snap --- src/cmd/generators/definitions/schema.test.ts | 6 +++--- src/runtime/lib/constants.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cmd/generators/definitions/schema.test.ts b/src/cmd/generators/definitions/schema.test.ts index 2ba88e75b6..8688a95536 100644 --- a/src/cmd/generators/definitions/schema.test.ts +++ b/src/cmd/generators/definitions/schema.test.ts @@ -35,7 +35,7 @@ test('adds internal documents to schema', async function () { """ @paginate is used to to mark a field for pagination. - More info in the [doc](https://www.houdinigraphql.com/guides/pagination). + More info in the [doc](https://docs-next-kohl.vercel.app/guides/pagination). """ directive @paginate(name: String) on FIELD @@ -96,7 +96,7 @@ test('list operations are included', async function () { """ @paginate is used to to mark a field for pagination. - More info in the [doc](https://www.houdinigraphql.com/guides/pagination). + More info in the [doc](https://docs-next-kohl.vercel.app/guides/pagination). """ directive @paginate(name: String) on FIELD @@ -176,7 +176,7 @@ test("writing twice doesn't duplicate definitions", async function () { """ @paginate is used to to mark a field for pagination. - More info in the [doc](https://www.houdinigraphql.com/guides/pagination). + More info in the [doc](https://docs-next-kohl.vercel.app/guides/pagination). """ directive @paginate(name: String) on FIELD diff --git a/src/runtime/lib/constants.ts b/src/runtime/lib/constants.ts index bbead42993..70427c3dd3 100644 --- a/src/runtime/lib/constants.ts +++ b/src/runtime/lib/constants.ts @@ -1,5 +1,6 @@ export const getSiteUrl = () => { // Now, manual return + // TESTS Snapshots needs to be updated as well when changing this. const next_url = 'https://docs-next-kohl.vercel.app' return next_url