From d464930ec243f463d24520f98c3ee89f36171e44 Mon Sep 17 00:00:00 2001 From: Mathias Vagni Date: Fri, 17 Nov 2023 14:10:35 +0100 Subject: [PATCH 01/10] first commit --- .gitignore | 6 +- package.json | 5 +- pnpm-lock.yaml | 374 ++++++++++++++++++ scripts/codegen-webhooks.sh | 7 + webhook-schema.ts | 737 ++++++++++++++++++++++++++++++++++++ 5 files changed, 1127 insertions(+), 2 deletions(-) create mode 100644 scripts/codegen-webhooks.sh create mode 100644 webhook-schema.ts diff --git a/.gitignore b/.gitignore index 399095b..8585dbb 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,8 @@ package-lock.json docs # cache -.eslintcache \ No newline at end of file +.eslintcache + +# Temporary +webhook-schema.json +webhook-schema-resolved.json \ No newline at end of file diff --git a/package.json b/package.json index cfcf7c3..9461e7e 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,9 @@ "scripts": { "build": "rm -rf dist && rollup -c", "build:docs": "typedoc --plugin typedoc-plugin-missing-exports src/index.ts", - "codegen": "graphql-codegen", + "codegen": "pnpm run codegen:graphql && pnpm run codegen:webhooks", + "codegen:graphql": "graphql-codegen", + "codegen:webhooks": "sh ./scripts/codegen-webhooks.sh", "typecheck": "tsc --noEmit", "lint": "pnpm run lint:eslint && pnpm run lint:prettier", "lint:eslint": "eslint 'src/**/*.ts'", @@ -33,6 +35,7 @@ "eslint-plugin-import": "^2.27.5", "eslint-plugin-simple-import-sort": "^10.0.0", "eslint-plugin-unused-imports": "^2.0.0", + "json-schema-to-typescript": "^13.1.1", "rollup": "^3.21.5", "rollup-plugin-dts": "^5.3.0", "rollup-plugin-esbuild": "^5.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8e6877a..8818303 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -58,6 +58,15 @@ devDependencies: eslint-plugin-unused-imports: specifier: ^2.0.0 version: 2.0.0(@typescript-eslint/eslint-plugin@5.59.2)(eslint@8.40.0) + json-refs: + specifier: ^3.0.15 + version: 3.0.15 + json-schema-to-typescript: + specifier: ^13.1.1 + version: 13.1.1 + json-schema-to-zod: + specifier: ^2.0.9 + version: 2.0.9 rollup: specifier: ^3.21.5 version: 3.21.5 @@ -703,6 +712,16 @@ packages: to-fast-properties: 2.0.0 dev: true + /@bcherny/json-schema-ref-parser@10.0.5-fork: + resolution: {integrity: sha512-E/jKbPoca1tfUPj3iSbitDZTGnq6FUFjkH6L8U2oDwSuwK1WhnnVtCG7oFOTg/DDnyoXbQYUiUiGOibHqaGVnw==} + engines: {node: '>= 16'} + dependencies: + '@jsdevtools/ono': 7.1.3 + '@types/json-schema': 7.0.12 + call-me-maybe: 1.0.2 + js-yaml: 4.1.0 + dev: true + /@changesets/apply-release-plan@6.1.4: resolution: {integrity: sha512-FMpKF1fRlJyCZVYHr3CbinpZZ+6MwvOtWUuO8uo+svcATEoc1zRDcj23pAurJ2TZ/uVz1wFHH6K3NlACy0PLew==} dependencies: @@ -1915,6 +1934,10 @@ packages: '@jridgewell/sourcemap-codec': 1.4.14 dev: true + /@jsdevtools/ono@7.1.3: + resolution: {integrity: sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==} + dev: true + /@manypkg/find-root@1.1.0: resolution: {integrity: sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA==} dependencies: @@ -2131,6 +2154,13 @@ packages: resolution: {integrity: sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==} dev: true + /@types/glob@7.2.0: + resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==} + dependencies: + '@types/minimatch': 5.1.2 + '@types/node': 20.4.1 + dev: true + /@types/is-ci@3.0.0: resolution: {integrity: sha512-Q0Op0hdWbYd1iahB+IFNQcWXFq4O0Q5MwQP7uN0souuQ4rPg1vEYcnIOfr1gY+M+6rc8FGoRaBO1mOOvL29sEQ==} dependencies: @@ -2153,6 +2183,14 @@ packages: resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} dev: true + /@types/lodash@4.14.201: + resolution: {integrity: sha512-y9euML0cim1JrykNxADLfaG0FgD1g/yTHwUs/Jg9ZIU7WKj2/4IW9Lbb1WZbvck78W/lfGXFfe+u2EGfIJXdLQ==} + dev: true + + /@types/minimatch@5.1.2: + resolution: {integrity: sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==} + dev: true + /@types/minimist@1.2.2: resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==} dev: true @@ -2173,6 +2211,10 @@ packages: resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==} dev: true + /@types/prettier@2.7.3: + resolution: {integrity: sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==} + dev: true + /@types/semver@6.2.3: resolution: {integrity: sha512-KQf+QAMWKMrtBMsB8/24w53tEsxllMj6TuA80TT/5igJalLI/zm0L3oXRbIAl4Ohfc85gyHX/jhMwsVkmhLU4A==} dev: true @@ -2465,6 +2507,10 @@ packages: engines: {node: '>=10'} dev: true + /any-promise@1.3.0: + resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} + dev: true + /argparse@1.0.10: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} dependencies: @@ -2545,6 +2591,10 @@ packages: engines: {node: '>=8'} dev: true + /asynckit@0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + dev: true + /auto-bind@4.0.0: resolution: {integrity: sha512-Hdw8qdNiqdJ8LqT0iK0sVzkFbzg6fhnQqqfWhBDxcHZvU75+B+ayzTy8x+k5Ix0Y92XOhOUlx74ps+bA6BeYMQ==} engines: {node: '>=8'} @@ -2692,6 +2742,10 @@ packages: get-intrinsic: 1.2.1 dev: true + /call-me-maybe@1.0.2: + resolution: {integrity: sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==} + dev: true + /callsites@3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} @@ -2810,6 +2864,17 @@ packages: engines: {node: '>=6'} dev: true + /cli-color@2.0.3: + resolution: {integrity: sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ==} + engines: {node: '>=0.10'} + dependencies: + d: 1.0.1 + es5-ext: 0.10.62 + es6-iterator: 2.0.3 + memoizee: 0.4.15 + timers-ext: 0.1.7 + dev: true + /cli-cursor@3.1.0: resolution: {integrity: sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==} engines: {node: '>=8'} @@ -2882,11 +2947,27 @@ packages: resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} dev: true + /combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} + dependencies: + delayed-stream: 1.0.0 + dev: true + + /commander@4.1.1: + resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} + engines: {node: '>= 6'} + dev: true + /common-tags@1.8.2: resolution: {integrity: sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==} engines: {node: '>=4.0.0'} dev: true + /component-emitter@1.3.1: + resolution: {integrity: sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==} + dev: true + /concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} dev: true @@ -2917,6 +2998,10 @@ packages: resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==} dev: true + /cookiejar@2.1.4: + resolution: {integrity: sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==} + dev: true + /cosmiconfig@7.1.0: resolution: {integrity: sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==} engines: {node: '>=10'} @@ -2985,6 +3070,13 @@ packages: stream-transform: 2.1.3 dev: true + /d@1.0.1: + resolution: {integrity: sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==} + dependencies: + es5-ext: 0.10.62 + type: 1.2.0 + dev: true + /dataloader@2.2.2: resolution: {integrity: sha512-8YnDaaf7N3k/q5HnTJVuzSyLETjoZjVmHc4AeKAzOvKHEFQKcn64OKBfzHYtE9zGjctNM7V9I0MfnUVLpi7M5g==} dev: true @@ -3061,6 +3153,11 @@ packages: object-keys: 1.1.1 dev: true + /delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + dev: true + /dependency-graph@0.11.0: resolution: {integrity: sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg==} engines: {node: '>= 0.6.0'} @@ -3077,6 +3174,13 @@ packages: hasBin: true dev: true + /dezalgo@1.0.4: + resolution: {integrity: sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==} + dependencies: + asap: 2.0.6 + wrappy: 1.0.2 + dev: true + /dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} @@ -3204,6 +3308,40 @@ packages: is-symbol: 1.0.4 dev: true + /es5-ext@0.10.62: + resolution: {integrity: sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==} + engines: {node: '>=0.10'} + requiresBuild: true + dependencies: + es6-iterator: 2.0.3 + es6-symbol: 3.1.3 + next-tick: 1.1.0 + dev: true + + /es6-iterator@2.0.3: + resolution: {integrity: sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==} + dependencies: + d: 1.0.1 + es5-ext: 0.10.62 + es6-symbol: 3.1.3 + dev: true + + /es6-symbol@3.1.3: + resolution: {integrity: sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==} + dependencies: + d: 1.0.1 + ext: 1.7.0 + dev: true + + /es6-weak-map@2.0.3: + resolution: {integrity: sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==} + dependencies: + d: 1.0.1 + es5-ext: 0.10.62 + es6-iterator: 2.0.3 + es6-symbol: 3.1.3 + dev: true + /esbuild@0.17.18: resolution: {integrity: sha512-z1lix43jBs6UKjcZVKOw2xx69ffE2aG0PygLL5qJ9OS/gy0Ewd1gW/PUQIOIQGXBHWNywSc0floSKoMFF8aK2w==} engines: {node: '>=12'} @@ -3497,6 +3635,19 @@ packages: engines: {node: '>=0.10.0'} dev: true + /event-emitter@0.3.5: + resolution: {integrity: sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==} + dependencies: + d: 1.0.1 + es5-ext: 0.10.62 + dev: true + + /ext@1.7.0: + resolution: {integrity: sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==} + dependencies: + type: 2.7.2 + dev: true + /extendable-error@0.1.7: resolution: {integrity: sha512-UOiS2in6/Q0FK0R0q6UY9vYpQ21mr/Qn1KOnte7vsACuNJf514WvCCUHSRCPcgjPT2bAhNIJdlE6bVap1GKmeg==} dev: true @@ -3552,6 +3703,10 @@ packages: fast-decode-uri-component: 1.0.1 dev: true + /fast-safe-stringify@2.1.1: + resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} + dev: true + /fast-url-parser@1.1.3: resolution: {integrity: sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ==} dependencies: @@ -3650,6 +3805,24 @@ packages: is-callable: 1.2.7 dev: true + /form-data@4.0.0: + resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} + engines: {node: '>= 6'} + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + mime-types: 2.1.35 + dev: true + + /formidable@2.1.2: + resolution: {integrity: sha512-CM3GuJ57US06mlpQ47YcunuUZ9jpm8Vx+P2CGt2j7HpgkKZO/DJYQ0Bobim8G6PFQmK5lOqOOdUXboU+h73A4g==} + dependencies: + dezalgo: 1.0.4 + hexoid: 1.0.0 + once: 1.4.0 + qs: 6.11.2 + dev: true + /fs-extra@7.0.1: resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==} engines: {node: '>=6 <7 || >=8'} @@ -3721,6 +3894,11 @@ packages: has-symbols: 1.0.3 dev: true + /get-stdin@8.0.0: + resolution: {integrity: sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==} + engines: {node: '>=10'} + dev: true + /get-symbol-description@1.0.0: resolution: {integrity: sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==} engines: {node: '>= 0.4'} @@ -3743,6 +3921,16 @@ packages: is-glob: 4.0.3 dev: true + /glob-promise@4.2.2(glob@7.2.3): + resolution: {integrity: sha512-xcUzJ8NWN5bktoTIX7eOclO1Npxd/dyVqUJxlLIDasT4C7KZyqlPIwkdJ0Ypiy3p2ZKahTjK4M9uC3sNSfNMzw==} + engines: {node: '>=12'} + peerDependencies: + glob: ^7.1.6 + dependencies: + '@types/glob': 7.2.0 + glob: 7.2.3 + dev: true + /glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} dependencies: @@ -3799,6 +3987,12 @@ packages: resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==} dev: true + /graphlib@2.1.8: + resolution: {integrity: sha512-jcLLfkpoVGmH7/InMC/1hIvOPSUh38oJtGhvrOFGzioE1DZ+0YW16RgmOJhHiuWTvGiJQ9Z1Ik43JvkRPRvE+A==} + dependencies: + lodash: 4.17.21 + dev: true + /graphql-config@4.5.0(graphql@16.6.0): resolution: {integrity: sha512-x6D0/cftpLUJ0Ch1e5sj1TZn6Wcxx4oMfmhaG9shM0DKajA9iR+j1z86GSTQ19fShbGvrSSvbIQsHku6aQ6BBw==} engines: {node: '>= 10.0.0'} @@ -3919,6 +4113,11 @@ packages: tslib: 2.5.3 dev: true + /hexoid@1.0.0: + resolution: {integrity: sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==} + engines: {node: '>=8'} + dev: true + /hosted-git-info@2.8.9: resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} dev: true @@ -4152,6 +4351,10 @@ packages: engines: {node: '>=0.10.0'} dev: true + /is-promise@2.2.2: + resolution: {integrity: sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==} + dev: true + /is-regex@1.1.4: resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} engines: {node: '>= 0.4'} @@ -4303,6 +4506,49 @@ packages: resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} dev: true + /json-refs@3.0.15: + resolution: {integrity: sha512-0vOQd9eLNBL18EGl5yYaO44GhixmImes2wiYn9Z3sag3QnehWrYWlB9AFtMxCL2Bj3fyxgDYkxGFEU/chlYssw==} + engines: {node: '>=0.8'} + hasBin: true + dependencies: + commander: 4.1.1 + graphlib: 2.1.8 + js-yaml: 3.14.1 + lodash: 4.17.21 + native-promise-only: 0.8.1 + path-loader: 1.0.12 + slash: 3.0.0 + uri-js: 4.4.1 + transitivePeerDependencies: + - supports-color + dev: true + + /json-schema-to-typescript@13.1.1: + resolution: {integrity: sha512-F3CYhtA7F3yPbb8vF7sFchk/2dnr1/yTKf8RcvoNpjnh67ZS/ZMH1ElLt5KHAtf2/bymiejLQQszszPWEeTdSw==} + engines: {node: '>=12.0.0'} + hasBin: true + dependencies: + '@bcherny/json-schema-ref-parser': 10.0.5-fork + '@types/json-schema': 7.0.12 + '@types/lodash': 4.14.201 + '@types/prettier': 2.7.3 + cli-color: 2.0.3 + get-stdin: 8.0.0 + glob: 7.2.3 + glob-promise: 4.2.2(glob@7.2.3) + is-glob: 4.0.3 + lodash: 4.17.21 + minimist: 1.2.8 + mkdirp: 1.0.4 + mz: 2.7.0 + prettier: 2.8.8 + dev: true + + /json-schema-to-zod@2.0.9: + resolution: {integrity: sha512-wsVZAy3F5EaBMRtvh7t0kaTXnEEqavLF6tV+NpwWwUgMTEW4Wtiio5zWxcLDHoUswc22hhP/uR9y7+4zutIE7Q==} + hasBin: true + dev: true + /json-schema-traverse@0.4.1: resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} dev: true @@ -4497,6 +4743,12 @@ packages: yallist: 4.0.0 dev: true + /lru-queue@0.1.0: + resolution: {integrity: sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==} + dependencies: + es5-ext: 0.10.62 + dev: true + /lunr@2.3.9: resolution: {integrity: sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==} dev: true @@ -4536,6 +4788,19 @@ packages: blueimp-md5: 2.19.0 dev: true + /memoizee@0.4.15: + resolution: {integrity: sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ==} + dependencies: + d: 1.0.1 + es5-ext: 0.10.62 + es6-weak-map: 2.0.3 + event-emitter: 0.3.5 + is-promise: 2.2.2 + lru-queue: 0.1.0 + next-tick: 1.1.0 + timers-ext: 0.1.7 + dev: true + /meow@6.1.1: resolution: {integrity: sha512-3YffViIt2QWgTy6Pale5QpopX/IvU3LPL03jOTqp6pGj3VjesdO/U8CuHMKpnQr4shCNCM5fd5XFFvIIl6JBHg==} engines: {node: '>=8'} @@ -4568,6 +4833,11 @@ packages: optional: true dev: true + /methods@1.1.2: + resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} + engines: {node: '>= 0.6'} + dev: true + /micromatch@4.0.5: resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} engines: {node: '>=8.6'} @@ -4576,6 +4846,24 @@ packages: picomatch: 2.3.1 dev: true + /mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + dev: true + + /mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + dependencies: + mime-db: 1.52.0 + dev: true + + /mime@2.6.0: + resolution: {integrity: sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==} + engines: {node: '>=4.0.0'} + hasBin: true + dev: true + /mimic-fn@2.1.0: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} engines: {node: '>=6'} @@ -4624,6 +4912,12 @@ packages: engines: {node: '>= 8.0.0'} dev: true + /mkdirp@1.0.4: + resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} + engines: {node: '>=10'} + hasBin: true + dev: true + /mlly@1.4.0: resolution: {integrity: sha512-ua8PAThnTwpprIaU47EPeZ/bPUVp2QYBbWMphUQpVdBI3Lgqzm5KZQ45Agm3YJedHXaIHl6pBGabaLSUPPSptg==} dependencies: @@ -4645,12 +4939,24 @@ packages: resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==} dev: true + /mz@2.7.0: + resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} + dependencies: + any-promise: 1.3.0 + object-assign: 4.1.1 + thenify-all: 1.6.0 + dev: true + /nanoid@3.3.6: resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true dev: true + /native-promise-only@0.8.1: + resolution: {integrity: sha512-zkVhZUA3y8mbz652WrL5x0fB0ehrBkulWT3TomAQ9iDtyXZvzKeEA6GPxAItBYeNYl5yngKRX612qHOhvMkDeg==} + dev: true + /natural-compare-lite@1.4.0: resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==} dev: true @@ -4659,6 +4965,10 @@ packages: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: true + /next-tick@1.1.0: + resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==} + dev: true + /no-case@3.0.4: resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} dependencies: @@ -4913,6 +5223,15 @@ packages: engines: {node: '>=8'} dev: true + /path-loader@1.0.12: + resolution: {integrity: sha512-n7oDG8B+k/p818uweWrOixY9/Dsr89o2TkCm6tOTex3fpdo2+BFDgR+KpB37mGKBRsBAlR8CIJMFN0OEy/7hIQ==} + dependencies: + native-promise-only: 0.8.1 + superagent: 7.1.6 + transitivePeerDependencies: + - supports-color + dev: true + /path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} dev: true @@ -5040,6 +5359,13 @@ packages: engines: {node: '>=6.0.0'} dev: true + /qs@6.11.2: + resolution: {integrity: sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==} + engines: {node: '>=0.6'} + dependencies: + side-channel: 1.0.4 + dev: true + /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} dev: true @@ -5542,6 +5868,26 @@ packages: acorn: 8.10.0 dev: true + /superagent@7.1.6: + resolution: {integrity: sha512-gZkVCQR1gy/oUXr+kxJMLDjla434KmSOKbx5iGD30Ql+AkJQ/YlPKECJy2nhqOsHLjGHzoDTXNSjhnvWhzKk7g==} + engines: {node: '>=6.4.0 <13 || >=14'} + deprecated: Please downgrade to v7.1.5 if you need IE/ActiveXObject support OR upgrade to v8.0.0 as we no longer support IE and published an incorrect patch version (see https://github.com/visionmedia/superagent/issues/1731) + dependencies: + component-emitter: 1.3.1 + cookiejar: 2.1.4 + debug: 4.3.4 + fast-safe-stringify: 2.1.1 + form-data: 4.0.0 + formidable: 2.1.2 + methods: 1.1.2 + mime: 2.6.0 + qs: 6.11.2 + readable-stream: 3.6.2 + semver: 7.5.4 + transitivePeerDependencies: + - supports-color + dev: true + /supports-color@5.5.0: resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} engines: {node: '>=4'} @@ -5576,6 +5922,19 @@ packages: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} dev: true + /thenify-all@1.6.0: + resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==} + engines: {node: '>=0.8'} + dependencies: + thenify: 3.3.1 + dev: true + + /thenify@3.3.1: + resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} + dependencies: + any-promise: 1.3.0 + dev: true + /through@2.3.8: resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} dev: true @@ -5585,6 +5944,13 @@ packages: engines: {node: '>=4'} dev: true + /timers-ext@0.1.7: + resolution: {integrity: sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ==} + dependencies: + es5-ext: 0.10.62 + next-tick: 1.1.0 + dev: true + /tinybench@2.5.0: resolution: {integrity: sha512-kRwSG8Zx4tjF9ZiyH4bhaebu+EDz1BOx9hOigYHlUW4xxI/wKIUQUqo018UlU4ar6ATPBsaMrdbKZ+tmPdohFA==} dev: true @@ -5719,6 +6085,14 @@ packages: engines: {node: '>=8'} dev: true + /type@1.2.0: + resolution: {integrity: sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==} + dev: true + + /type@2.7.2: + resolution: {integrity: sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==} + dev: true + /typed-array-length@1.0.4: resolution: {integrity: sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==} dependencies: diff --git a/scripts/codegen-webhooks.sh b/scripts/codegen-webhooks.sh new file mode 100644 index 0000000..4f298f2 --- /dev/null +++ b/scripts/codegen-webhooks.sh @@ -0,0 +1,7 @@ + +#!/bin/bash + +# Download the JSON schema +curl https://core-api.uk.plain.com/webhooks/schema.json -o ./webhook-schema.json + +./node_modules/.bin/json2ts --input webhook-schema.json --output webhook-schema.ts diff --git a/webhook-schema.ts b/webhook-schema.ts new file mode 100644 index 0000000..ee3d77e --- /dev/null +++ b/webhook-schema.ts @@ -0,0 +1,737 @@ +/* eslint-disable */ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + +export type Id = string; +export type EmailAddress = string; +export type Datetime = string; +export type InternalActor = UserActor | MachineUserActor | SystemActor; +export type CustomerGroupMemberships = CustomerGroupMembership[]; +export type Actor = UserActor | MachineUserActor | SystemActor | CustomerActor; +export type IssueTypeIcon = string; +export type IssueStatus = "OPEN" | "RESOLVED"; +export type EmailActor = + | UserActor + | CustomerActor + | { + actorType: "supportEmailAddress"; + supportEmailAddress: string; + } + | { + actorType: "deletedCustomer"; + customerId: Id; + }; +export type Component = + | ComponentText + | ComponentPlainText + | ComponentSpacer + | ComponentDivider + | ComponentLinkButton + | ComponentBadge + | ComponentCopyButton + | ComponentRow + | ComponentContainer; +export type ComponentTextSize = "S" | "M" | "L"; +export type ComponentTextColor = "NORMAL" | "MUTED" | "SUCCESS" | "WARNING" | "ERROR"; +export type ComponentPlainTextSize = "S" | "M" | "L"; +export type ComponentPlainTextColor = "NORMAL" | "MUTED" | "SUCCESS" | "WARNING" | "ERROR"; +export type ComponentSpacerSize = "XS" | "S" | "M" | "L" | "XL"; +export type ComponentDividerSpacingSize = "XS" | "S" | "M" | "L" | "XL"; +export type ComponentBadgeColor = "GREY" | "GREEN" | "YELLOW" | "RED" | "BLUE"; +export type ComponentRowContent = + | ComponentText + | ComponentPlainText + | ComponentSpacer + | ComponentDivider + | ComponentLinkButton + | ComponentBadge + | ComponentCopyButton; +export type ComponentContainerContent = + | ComponentText + | ComponentPlainText + | ComponentSpacer + | ComponentDivider + | ComponentLinkButton + | ComponentBadge + | ComponentCopyButton + | ComponentRow; +export type CustomerGroupChangedPayload = + | { + changeType: "ADDED"; + eventType: "customer.customer_group_changed"; + customerGroup: CustomerGroup; + } + | { + changeType: "UPDATED"; + eventType: "customer.customer_group_changed"; + customerGroup: CustomerGroup; + previousCustomerGroup: CustomerGroup; + } + | { + changeType: "REMOVED"; + eventType: "customer.customer_group_changed"; + previousCustomerGroup: CustomerGroup; + }; +export type ThreadStatus = "TODO" | "DONE" | "SNOOZED"; +export type ThreadStatusDetail = + | { + type: "CREATED"; + createdAt: string | string | unknown; + } + | { + type: "SNOOZED"; + snoozedAt: string | string | unknown; + snoozedUntil: string | string | unknown; + } + | { + type: "UNSNOOZED"; + snoozedAt: string | string | unknown; + } + | { + type: "NEW_REPLY"; + newReplyAt: string | string | unknown; + } + | { + type: "LINK_LINEAR_UPDATED"; + updatedAt: string | string | unknown; + linearIssueId: string; + }; +export type ThreadAssignee = + | User + | MachineUser + | { + id: + | "customer_status_state_machine" + | "thread_status_state_machine" + | "timeline_writer" + | "timeline_listener" + | "email_builder" + | "email_sender" + | "postmark_external_inbound_handler" + | "postmark_inbound_handler" + | "email_inbound_handler" + | "notifications" + | "slack_integrations_janitor" + | "slack_notifications_sender" + | "slack_webhook_handler" + | "customer_authentication" + | "unread_user_chat_messages_handler" + | "unread_user_chat_messages_publisher" + | "plain_cli" + | "public_event_builder" + | "webhook_subscription_handler" + | "slack_user_notification_builder" + | "slack_workspace_notification_builder" + | "discord_workspace_notification_builder" + | "backfill_external_email_settings_job" + | "customer_card_updater" + | "internal_customer_card_api" + | "linear_webhook_handler" + | "linear_integrations_janitor" + | "job" + | "search_indexer" + | "thread_snooze_handler" + | "timeline_events_writer" + | "thread_triage_handler"; + }; + +/** + * Webhook request + */ +export interface WebhooksSchemaDefinition { + timestamp: unknown; + workspaceId: Id; + payload: + | CustomerStatusTransitionedPayload + | CustomerChangedPayload + | CustomerGroupMembershipsChangedPayload + | TimelineEntryChangedPayload + | CustomerGroupChangedPayload + | ThreadCreatedPublicEventPayload + | ThreadStatusTransitionedPublicEventPayload + | ThreadAssignmentTransitionedPublicEventPayload + | ThreadEmailReceivedPublicEventPayload + | ThreadEmailSentPublicEventPayload + | ThreadLabelsChangedPublicEventPayload + | ThreadPriorityChangedPublicEventPayload + | ThreadChatSentPublicEventPayload + | CustomerCreatedPublicEventPayload + | CustomerUpdatedPublicEventPayload + | CustomerDeletedPublicEventPayload; + id: Id; + type: + | "thread.thread_created" + | "thread.thread_status_transitioned" + | "thread.thread_assignment_transitioned" + | "thread.email_received" + | "thread.email_sent" + | "thread.chat_sent" + | "thread.note_created" + | "thread.thread_labels_changed" + | "thread.thread_priority_changed" + | "customer.customer_created" + | "customer.customer_updated" + | "customer.customer_deleted" + | "customer.customer_status_transitioned" + | "customer.customer_changed" + | "customer.customer_group_changed" + | "customer.customer_group_memberships_changed" + | "timeline.timeline_entry_changed"; + webhookMetadata: { + webhookTargetId: Id; + webhookDeliveryAttemptId: Id; + webhookDeliveryAttemptNumber: number; + webhookDeliveryAttemptTimestamp: Datetime; + }; +} +/** + * The status of a customer has changed + */ +export interface CustomerStatusTransitionedPayload { + eventType: "customer.customer_status_transitioned"; + previousCustomer: Customer; + customer: Customer; +} +export interface Customer { + id: Id; + email: Email; + externalId: string | null; + fullName: string; + shortName: string | null; + assignedAt: Datetime | null; + assignedToUser: User | null; + status: "IDLE" | "ACTIVE" | "SNOOZED"; + statusChangedAt: Datetime; + markedAsSpamAt?: Datetime | null; + markedAsSpamBy?: InternalActor | null; + customerGroupMemberships: CustomerGroupMemberships; + createdAt: Datetime; + createdBy: Actor; + updatedAt: Datetime; + updatedBy: Actor; +} +export interface Email { + email: EmailAddress; + isVerified: boolean; + verifiedAt: Datetime | null; +} +export interface User { + id: Id; + email: EmailAddress; + fullName: string; + publicName: string; + status: "ONLINE" | "OFFLINE" | "BREAK"; + statusChangedAt: Datetime; + createdAt: Datetime; + createdBy: InternalActor; + updatedAt: Datetime; + updatedBy: InternalActor; + deletedAt: Datetime | null; + deletedBy: InternalActor | null; +} +export interface UserActor { + actorType: "user"; + userId: Id; +} +export interface MachineUserActor { + actorType: "machineUser"; + machineUserId: Id; +} +export interface SystemActor { + actorType: "system"; + system: + | "customer_status_state_machine" + | "thread_status_state_machine" + | "timeline_writer" + | "timeline_listener" + | "email_builder" + | "email_sender" + | "postmark_external_inbound_handler" + | "postmark_inbound_handler" + | "email_inbound_handler" + | "notifications" + | "slack_integrations_janitor" + | "slack_notifications_sender" + | "slack_webhook_handler" + | "customer_authentication" + | "unread_user_chat_messages_handler" + | "unread_user_chat_messages_publisher" + | "plain_cli" + | "public_event_builder" + | "webhook_subscription_handler" + | "slack_user_notification_builder" + | "slack_workspace_notification_builder" + | "discord_workspace_notification_builder" + | "backfill_external_email_settings_job" + | "customer_card_updater" + | "internal_customer_card_api" + | "linear_webhook_handler" + | "linear_integrations_janitor" + | "job" + | "search_indexer" + | "thread_snooze_handler" + | "timeline_events_writer" + | "thread_triage_handler"; +} +export interface CustomerGroupMembership { + customerId: Id; + customerGroupId: Id; + workspaceId: Id; + createdAt: Datetime; + createdBy: InternalActor; + updatedAt: Datetime; + updatedBy: InternalActor; + customerGroup: CustomerGroup; +} +export interface CustomerGroup { + id: Id; + workspaceId: Id; + name: string; + key: string; + color: string; + createdAt: Datetime; + createdBy: InternalActor; + updatedAt: Datetime; + updatedBy: InternalActor; +} +export interface CustomerActor { + actorType: "customer"; + customerId: Id; +} +/** + * A customer has been created or updated + */ +export interface CustomerChangedPayload { + changeType: "ADDED" | "UPDATED"; + eventType: "customer.customer_changed"; + customer: Customer; + previousCustomer: Customer | null; +} +export interface CustomerGroupMembershipsChangedPayload { + eventType: "customer.customer_group_memberships_changed"; + changeType: "ADDED" | "REMOVED"; + customer: Customer1; + previousCustomer: Customer1; +} +export interface Customer1 { + id: Id; + email: Email; + externalId: string | null; + fullName: string; + shortName: string | null; + markedAsSpamAt?: Datetime | null; + markedAsSpamBy?: InternalActor | null; + customerGroupMemberships: CustomerGroupMemberships; + createdAt: Datetime; + createdBy: Actor; + updatedAt: Datetime; + updatedBy: Actor; +} +/** + * A timeline entry has been added, updated or removed + */ +export interface TimelineEntryChangedPayload { + eventType: "timeline.timeline_entry_changed"; + /** + * null if changeType=ADDED + */ + previousTimelineEntry: TimelineEntry | null; + /** + * null if changeType=REMOVED + */ + timelineEntry: TimelineEntry | null; + changeType: "ADDED" | "UPDATED" | "REMOVED"; +} +export interface TimelineEntry { + id: Id; + customerId: Id; + timestamp: Datetime; + actor: Actor; + entry: + | IssueStatusTransitionedEntry + | IssueTypeChangedEntry + | IssuePriorityChangedEntry + | IssueDeletedEntry + | NoteEntry + | CustomerAssignmentTransitionedEntry + | ChatEntry + | CustomerStatusTransitionedEntry + | EmailEntry + | CustomEntry + | LinearIssueLinkStateTransitionedEntry; +} +export interface IssueStatusTransitionedEntry { + entryType: "issue_status_transitioned"; + issueId: Id; + issueKey: string; + issueTypeId: Id; + issueTypePublicName: string; + issueTypeIcon: IssueTypeIcon | null; + priority: IssuePriority; + previousStatus: IssueStatus | null; + nextStatus: IssueStatus; +} +export interface IssuePriority { + value: number; + label: string; +} +export interface IssueTypeChangedEntry { + entryType: "issue_issue_type_changed"; + issueId: Id; + issueKey: string; + previousIssueTypeId: Id; + previousIssueTypePublicName: string; + previousIssueTypeIcon: IssueTypeIcon | null; + nextIssueTypeId: Id; + nextIssueTypePublicName: string; + nextIssueTypeIcon: IssueTypeIcon | null; + status: IssueStatus; + priority: IssuePriority; +} +export interface IssuePriorityChangedEntry { + entryType: "issue_priority_changed"; + issueId: Id; + issueKey: string; + issueTypeId: Id; + issueTypePublicName: string; + issueTypeIcon: IssueTypeIcon | null; + previousPriority: IssuePriority; + nextPriority: IssuePriority; + status: IssueStatus; +} +export interface IssueDeletedEntry { + entryType: "issue_deleted"; + issueId: Id; + issueKey: string; + issueTypeId: Id; + issueTypePublicName: string; + issueTypeIcon: IssueTypeIcon | null; + status: IssueStatus; + priority: IssuePriority; +} +export interface NoteEntry { + entryType: "note"; + noteId: Id; + text: string; + markdown: string | null; +} +export interface CustomerAssignmentTransitionedEntry { + entryType: "customer_assignment_transitioned"; + previousUserId: Id | null; + previousUser: User | null; + nextUserId: Id | null; + nextUser: User | null; +} +export interface ChatEntry { + entryType: "chat"; + chatId: Id; + text: string | null; + attachments: ChatEntryAttachment[]; + customerReadAt: Datetime | null; +} +export interface ChatEntryAttachment { + id: Id; + fileName: string; + fileSizeBytes: number; + fileMimeType: string; + fileExtension: string | null; + createdAt: Datetime; + createdBy: Actor; + updatedAt: Datetime; + updatedBy: Actor; + type: "CHAT"; +} +export interface CustomerStatusTransitionedEntry { + entryType: "customer_status_transitioned"; + previousStatus: "IDLE" | "ACTIVE" | "SNOOZED"; + nextStatus: "IDLE" | "ACTIVE" | "SNOOZED"; +} +export interface EmailEntry { + entryType: "email"; + emailId: Id; + to: EmailParticipant; + from: EmailParticipant; + additionalRecipients: EmailParticipant[]; + hiddenRecipients: EmailParticipant[]; + subject: string | null; + textContent: string | null; + hasMoreTextContent: boolean; + markdownContent: string | null; + hasMoreMarkdownContent: boolean; + authenticity: "PASS" | "FAIL" | "UNKNOWN"; + sentAt: Datetime | null; + receivedAt: Datetime | null; + attachments: EmailEntryAttachment[]; + inReplyToEmailId: string | null; + isStartOfThread: boolean; +} +export interface EmailParticipant { + email: string; + name: string | null; + emailActor: EmailActor | null; +} +export interface EmailEntryAttachment { + id: Id; + fileName: string; + fileSizeBytes: number; + fileMimeType: string; + fileExtension: string | null; + createdAt: Datetime; + createdBy: Actor; + updatedAt: Datetime; + updatedBy: Actor; + type: "EMAIL"; + emailContentId: string; +} +export interface CustomEntry { + entryType: "custom"; + externalId: string | null; + title: string; + type: string | null; + /** + * @minItems 1 + */ + components: [Component, ...Component[]]; + attachments: CustomEntryAttachment[]; +} +export interface ComponentText { + type: "text"; + textSize: ComponentTextSize | null; + textColor: ComponentTextColor | null; + text: string; +} +export interface ComponentPlainText { + plainTextSize: ComponentPlainTextSize | null; + plainTextColor: ComponentPlainTextColor | null; + plainText: string; + type: "plainText"; +} +export interface ComponentSpacer { + spacerSize: ComponentSpacerSize; + type: "spacer"; +} +export interface ComponentDivider { + dividerSpacingSize: ComponentDividerSpacingSize | null; + type: "divider"; +} +export interface ComponentLinkButton { + linkButtonUrl: string; + linkButtonLabel: string; + type: "linkButton"; +} +export interface ComponentBadge { + badgeLabel: string; + badgeColor: ComponentBadgeColor | null; + type: "badge"; +} +export interface ComponentCopyButton { + copyButtonValue: string; + copyButtonTooltipLabel: string | null; + type: "copyButton"; +} +export interface ComponentRow { + type: "row"; + /** + * @minItems 1 + */ + rowMainContent: [ComponentRowContent, ...ComponentRowContent[]]; + rowAsideContent: ComponentRowContent[]; +} +export interface ComponentContainer { + type: "container"; + /** + * @minItems 1 + */ + containerContent: [ComponentContainerContent, ...ComponentContainerContent[]]; +} +export interface CustomEntryAttachment { + id: Id; + fileName: string; + fileSizeBytes: number; + fileMimeType: string; + fileExtension: string | null; + createdAt: Datetime; + createdBy: Actor; + updatedAt: Datetime; + updatedBy: Actor; + type: "CUSTOM_TIMELINE_ENTRY"; +} +export interface LinearIssueLinkStateTransitionedEntry { + entryType: "linear_issue_link_state_transitioned"; + customerId: Id; + issueId: Id; + issueKey: string; + issueTypeId: Id; + issueTypePublicName: string; + linearIssueId: string; + previousLinearStateId: string; + nextLinearStateId: string; +} +export interface ThreadCreatedPublicEventPayload { + eventType: "thread.thread_created"; + thread: Thread; +} +export interface Thread { + id: Id; + customer: Customer1; + title: string; + previewText?: string | null; + priority: number; + externalId: string | null; + status: ThreadStatus; + statusChangedAt: Datetime | null; + statusChangedBy?: Actor | null; + statusDetail: ThreadStatusDetail | null; + assignee: ThreadAssignee | null; + assignedAt: Datetime | null; + labels: Label[]; + firstInboundMessageInfo: ThreadMessageInfo | null; + firstOutboundMessageInfo: ThreadMessageInfo | null; + lastInboundMessageInfo: ThreadMessageInfo | null; + lastOutboundMessageInfo: ThreadMessageInfo | null; + supportEmailAddresses: string[]; + createdAt: Datetime; + createdBy: Actor; + updatedAt: Datetime; + updatedBy: Actor; +} +export interface MachineUser { + id: Id; + fullName: string; + publicName: string; + description: string | null; + createdAt: Datetime; + createdBy: InternalActor; + updatedAt: Datetime; + updatedBy: InternalActor; + deletedAt: Datetime | null; + deletedBy: InternalActor | null; +} +export interface Label { + id: Id; + labelType: LabelType; + createdAt: Datetime; + createdBy: Actor; + updatedAt: Datetime; + updatedBy: Actor; +} +export interface LabelType { + id: Id; + name: string; + icon?: string | null; + isArchived?: boolean; + archivedAt: Datetime | null; + archivedBy: InternalActor | null; + createdAt: Datetime; + createdBy: InternalActor; + updatedAt: Datetime; + updatedBy: InternalActor; +} +export interface ThreadMessageInfo { + timestamp: string | string | unknown; + messageSource: "CHAT" | "EMAIL" | "API" | "SLACK"; +} +export interface ThreadStatusTransitionedPublicEventPayload { + eventType: "thread.thread_status_transitioned"; + previousThread: Thread; + thread: Thread; +} +export interface ThreadAssignmentTransitionedPublicEventPayload { + eventType: "thread.thread_assignment_transitioned"; + previousThread: Thread; + thread: Thread; +} +export interface ThreadEmailReceivedPublicEventPayload { + eventType: "thread.email_received"; + thread: Thread; + email: Email1; +} +export interface Email1 { + timelineEntryId: Id; + id: Id; + to: EmailParticipant; + from: EmailParticipant; + replyTo: string | null; + additionalRecipients: EmailParticipant[]; + hiddenRecipients: EmailParticipant[]; + subject: string | null; + textContent: string | null; + markdownContent: string | null; + authenticity: "PASS" | "FAIL" | "UNKNOWN"; + sentAt: Datetime | null; + receivedAt: Datetime | null; + attachments: Attachment[]; + inReplyToEmailId: string | null; + createdAt: Datetime; + createdBy: Actor; + updatedAt: Datetime; + updatedBy: Actor; +} +export interface Attachment { + id: Id; + fileName: string; + fileSizeBytes: number; + fileMimeType: string; + fileExtension: string | null; + createdAt: Datetime; + createdBy: Actor; + updatedAt: Datetime; + updatedBy: Actor; +} +export interface ThreadEmailSentPublicEventPayload { + eventType: "thread.email_sent"; + thread: Thread; + email: Email1; +} +export interface ThreadLabelsChangedPublicEventPayload { + eventType: "thread.thread_labels_changed"; + changeType: "ADDED" | "REMOVED"; + thread: Thread; + previousThread: Thread; +} +export interface ThreadPriorityChangedPublicEventPayload { + eventType: "thread.thread_priority_changed"; + previousThread: Thread; + thread: Thread; +} +export interface ThreadChatSentPublicEventPayload { + eventType: "thread.chat_sent"; + chat: Chat; + thread: Thread; +} +export interface Chat { + timelineEntryId: Id; + id: Id; + customerReadAt: Datetime | null; + text?: string | null; + attachments: Attachment[]; + createdAt: Datetime; + createdBy: Actor; + updatedAt: Datetime; + updatedBy: Actor; +} +/** + * A customer has been created + */ +export interface CustomerCreatedPublicEventPayload { + eventType: "customer.customer_created"; + customer: Customer1; +} +/** + * A customer has been updated + */ +export interface CustomerUpdatedPublicEventPayload { + eventType: "customer.customer_updated"; + customer: Customer1; + previousCustomer: Customer1; +} +/** + * A customer has been deleted + */ +export interface CustomerDeletedPublicEventPayload { + eventType: "customer.customer_deleted"; + previousCustomer: Customer1; +} From 7ea7c90835567c2720667ae8f24631337f7d8d86 Mon Sep 17 00:00:00 2001 From: Jordan Drake Date: Thu, 29 Feb 2024 21:35:41 +0000 Subject: [PATCH 02/10] Generate zod model --- .gitignore | 2 +- package.json | 5 +- pnpm-lock.yaml | 615 ++++++++++------ scripts/codegen-webhooks.sh | 1 + src/tests/webhook-model.test.ts | 24 + .../webhook-payloads/customer-created.ts | 39 + src/tests/webhook-payloads/email-received.ts | 114 +++ src/tests/webhook-payloads/email-sent.ts | 117 +++ .../thread-assignment-transitioned.ts | 166 +++++ src/tests/webhook-payloads/thread-created.ts | 74 ++ .../thread-status-transitioned.ts | 147 ++++ webhook-model.ts | 670 ++++++++++++++++++ webhook-schema.ts | 177 +---- 13 files changed, 1768 insertions(+), 383 deletions(-) create mode 100644 src/tests/webhook-model.test.ts create mode 100644 src/tests/webhook-payloads/customer-created.ts create mode 100644 src/tests/webhook-payloads/email-received.ts create mode 100644 src/tests/webhook-payloads/email-sent.ts create mode 100644 src/tests/webhook-payloads/thread-assignment-transitioned.ts create mode 100644 src/tests/webhook-payloads/thread-created.ts create mode 100644 src/tests/webhook-payloads/thread-status-transitioned.ts create mode 100644 webhook-model.ts diff --git a/.gitignore b/.gitignore index 8585dbb..63eff27 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,4 @@ docs # Temporary webhook-schema.json -webhook-schema-resolved.json \ No newline at end of file +webhook-schema.ts \ No newline at end of file diff --git a/package.json b/package.json index 9461e7e..9d7440f 100644 --- a/package.json +++ b/package.json @@ -39,14 +39,15 @@ "rollup": "^3.21.5", "rollup-plugin-dts": "^5.3.0", "rollup-plugin-esbuild": "^5.0.0", + "ts-to-zod": "^3.7.3", "typedoc": "^0.24.7", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "^5.1.6", + "typescript": "^5.2.2", "vitest": "^0.31.0" }, "dependencies": { "@graphql-typed-document-node/core": "^3.2.0", "graphql": "^16.6.0", - "zod": "^3.21.4" + "zod": "3.22.4" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8818303..ee92d19 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ dependencies: specifier: ^16.6.0 version: 16.6.0 zod: - specifier: ^3.21.4 - version: 3.21.4 + specifier: 3.22.4 + version: 3.22.4 devDependencies: '@changesets/cli': @@ -39,10 +39,10 @@ devDependencies: version: 3.0.4(graphql@16.6.0) '@typescript-eslint/eslint-plugin': specifier: ^5.59.2 - version: 5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.40.0)(typescript@5.1.6) + version: 5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.40.0)(typescript@5.3.3) '@typescript-eslint/parser': specifier: ^5.59.2 - version: 5.59.2(eslint@8.40.0)(typescript@5.1.6) + version: 5.59.2(eslint@8.40.0)(typescript@5.3.3) esbuild: specifier: ^0.17.18 version: 0.17.18 @@ -58,33 +58,30 @@ devDependencies: eslint-plugin-unused-imports: specifier: ^2.0.0 version: 2.0.0(@typescript-eslint/eslint-plugin@5.59.2)(eslint@8.40.0) - json-refs: - specifier: ^3.0.15 - version: 3.0.15 json-schema-to-typescript: specifier: ^13.1.1 version: 13.1.1 - json-schema-to-zod: - specifier: ^2.0.9 - version: 2.0.9 rollup: specifier: ^3.21.5 version: 3.21.5 rollup-plugin-dts: specifier: ^5.3.0 - version: 5.3.0(rollup@3.21.5)(typescript@5.1.6) + version: 5.3.0(rollup@3.21.5)(typescript@5.3.3) rollup-plugin-esbuild: specifier: ^5.0.0 version: 5.0.0(esbuild@0.17.18)(rollup@3.21.5) + ts-to-zod: + specifier: ^3.7.3 + version: 3.7.3 typedoc: specifier: ^0.24.7 - version: 0.24.7(typescript@5.1.6) + version: 0.24.7(typescript@5.3.3) typedoc-plugin-missing-exports: specifier: ^2.0.0 version: 2.0.0(typedoc@0.24.7) typescript: - specifier: ^5.1.6 - version: 5.1.6 + specifier: ^5.2.2 + version: 5.3.3 vitest: specifier: ^0.31.0 version: 0.31.0 @@ -170,7 +167,7 @@ packages: '@babel/types': 7.22.5 '@nicolo-ribaudo/semver-v6': 6.3.3 convert-source-map: 1.9.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) gensync: 1.0.0-beta.2 json5: 2.2.3 transitivePeerDependencies: @@ -697,7 +694,7 @@ packages: '@babel/helper-split-export-declaration': 7.22.6 '@babel/parser': 7.22.7 '@babel/types': 7.22.5 - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -1322,7 +1319,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) espree: 9.6.0 globals: 13.20.0 ignore: 5.2.4 @@ -1777,7 +1774,7 @@ packages: '@types/json-stable-stringify': 1.0.34 '@whatwg-node/fetch': 0.8.8 chalk: 4.1.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) dotenv: 16.3.1 graphql: 16.6.0 graphql-request: 6.1.0(graphql@16.6.0) @@ -1885,7 +1882,7 @@ packages: engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 1.2.1 - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -1984,6 +1981,39 @@ packages: fastq: 1.15.0 dev: true + /@oclif/core@3.20.0: + resolution: {integrity: sha512-8BajhglY8frYGAS1whAukeouFZUN9MgQoLfNXtScPVEAjPlaD2BbSIAYQH2yF2qb/iVvbj/1DwYS3gqicYOq1A==} + engines: {node: '>=18.0.0'} + dependencies: + '@types/cli-progress': 3.11.5 + ansi-escapes: 4.3.2 + ansi-styles: 4.3.0 + cardinal: 2.1.1 + chalk: 4.1.2 + clean-stack: 3.0.1 + cli-progress: 3.12.0 + color: 4.2.3 + debug: 4.3.4(supports-color@8.1.1) + ejs: 3.1.9 + get-package-type: 0.1.0 + globby: 11.1.0 + hyperlinker: 1.0.0 + indent-string: 4.0.0 + is-wsl: 2.2.0 + js-yaml: 3.14.1 + natural-orderby: 2.0.3 + object-treeify: 1.1.33 + password-prompt: 1.1.3 + slice-ansi: 4.0.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + supports-color: 8.1.1 + supports-hyperlinks: 2.3.0 + widest-line: 3.1.0 + wordwrap: 1.0.0 + wrap-ansi: 7.0.0 + dev: true + /@parcel/watcher-android-arm64@2.2.0: resolution: {integrity: sha512-nU2wh00CTQT9rr1TIKTjdQ9lAGYpmz6XuKw0nAwAN+S2A5YiD55BK1u+E5WMCT8YOIDe/n6gaj4o/Bi9294SSQ==} engines: {node: '>= 10.0.0'} @@ -2150,6 +2180,12 @@ packages: resolution: {integrity: sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng==} dev: true + /@types/cli-progress@3.11.5: + resolution: {integrity: sha512-D4PbNRbviKyppS5ivBGyFO29POlySLmA2HyUFE4p5QGazAMM3CwkKWcvTl8gvElSuxRh6FPKL8XmidX873ou4g==} + dependencies: + '@types/node': 20.4.1 + dev: true + /@types/estree@1.0.1: resolution: {integrity: sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==} dev: true @@ -2229,7 +2265,7 @@ packages: '@types/node': 20.4.1 dev: true - /@typescript-eslint/eslint-plugin@5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.40.0)(typescript@5.1.6): + /@typescript-eslint/eslint-plugin@5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.40.0)(typescript@5.3.3): resolution: {integrity: sha512-yVrXupeHjRxLDcPKL10sGQ/QlVrA8J5IYOEWVqk0lJaSZP7X5DfnP7Ns3cc74/blmbipQ1htFNVGsHX6wsYm0A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2241,23 +2277,23 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.5.1 - '@typescript-eslint/parser': 5.59.2(eslint@8.40.0)(typescript@5.1.6) + '@typescript-eslint/parser': 5.59.2(eslint@8.40.0)(typescript@5.3.3) '@typescript-eslint/scope-manager': 5.59.2 - '@typescript-eslint/type-utils': 5.59.2(eslint@8.40.0)(typescript@5.1.6) - '@typescript-eslint/utils': 5.59.2(eslint@8.40.0)(typescript@5.1.6) - debug: 4.3.4 + '@typescript-eslint/type-utils': 5.59.2(eslint@8.40.0)(typescript@5.3.3) + '@typescript-eslint/utils': 5.59.2(eslint@8.40.0)(typescript@5.3.3) + debug: 4.3.4(supports-color@8.1.1) eslint: 8.40.0 grapheme-splitter: 1.0.4 ignore: 5.2.4 natural-compare-lite: 1.4.0 semver: 7.5.4 - tsutils: 3.21.0(typescript@5.1.6) - typescript: 5.1.6 + tsutils: 3.21.0(typescript@5.3.3) + typescript: 5.3.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser@5.59.2(eslint@8.40.0)(typescript@5.1.6): + /@typescript-eslint/parser@5.59.2(eslint@8.40.0)(typescript@5.3.3): resolution: {integrity: sha512-uq0sKyw6ao1iFOZZGk9F8Nro/8+gfB5ezl1cA06SrqbgJAt0SRoFhb9pXaHvkrxUpZaoLxt8KlovHNk8Gp6/HQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2269,10 +2305,10 @@ packages: dependencies: '@typescript-eslint/scope-manager': 5.59.2 '@typescript-eslint/types': 5.59.2 - '@typescript-eslint/typescript-estree': 5.59.2(typescript@5.1.6) - debug: 4.3.4 + '@typescript-eslint/typescript-estree': 5.59.2(typescript@5.3.3) + debug: 4.3.4(supports-color@8.1.1) eslint: 8.40.0 - typescript: 5.1.6 + typescript: 5.3.3 transitivePeerDependencies: - supports-color dev: true @@ -2285,7 +2321,7 @@ packages: '@typescript-eslint/visitor-keys': 5.59.2 dev: true - /@typescript-eslint/type-utils@5.59.2(eslint@8.40.0)(typescript@5.1.6): + /@typescript-eslint/type-utils@5.59.2(eslint@8.40.0)(typescript@5.3.3): resolution: {integrity: sha512-b1LS2phBOsEy/T381bxkkywfQXkV1dWda/z0PhnIy3bC5+rQWQDS7fk9CSpcXBccPY27Z6vBEuaPBCKCgYezyQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2295,12 +2331,12 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 5.59.2(typescript@5.1.6) - '@typescript-eslint/utils': 5.59.2(eslint@8.40.0)(typescript@5.1.6) - debug: 4.3.4 + '@typescript-eslint/typescript-estree': 5.59.2(typescript@5.3.3) + '@typescript-eslint/utils': 5.59.2(eslint@8.40.0)(typescript@5.3.3) + debug: 4.3.4(supports-color@8.1.1) eslint: 8.40.0 - tsutils: 3.21.0(typescript@5.1.6) - typescript: 5.1.6 + tsutils: 3.21.0(typescript@5.3.3) + typescript: 5.3.3 transitivePeerDependencies: - supports-color dev: true @@ -2310,7 +2346,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree@5.59.2(typescript@5.1.6): + /@typescript-eslint/typescript-estree@5.59.2(typescript@5.3.3): resolution: {integrity: sha512-+j4SmbwVmZsQ9jEyBMgpuBD0rKwi9RxRpjX71Brr73RsYnEr3Lt5QZ624Bxphp8HUkSKfqGnPJp1kA5nl0Sh7Q==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2321,17 +2357,17 @@ packages: dependencies: '@typescript-eslint/types': 5.59.2 '@typescript-eslint/visitor-keys': 5.59.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) globby: 11.1.0 is-glob: 4.0.3 semver: 7.5.4 - tsutils: 3.21.0(typescript@5.1.6) - typescript: 5.1.6 + tsutils: 3.21.0(typescript@5.3.3) + typescript: 5.3.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils@5.59.2(eslint@8.40.0)(typescript@5.1.6): + /@typescript-eslint/utils@5.59.2(eslint@8.40.0)(typescript@5.3.3): resolution: {integrity: sha512-kSuF6/77TZzyGPhGO4uVp+f0SBoYxCDf+lW3GKhtKru/L8k/Hd7NFQxyWUeY7Z/KGB2C6Fe3yf2vVi4V9TsCSQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2342,7 +2378,7 @@ packages: '@types/semver': 7.5.0 '@typescript-eslint/scope-manager': 5.59.2 '@typescript-eslint/types': 5.59.2 - '@typescript-eslint/typescript-estree': 5.59.2(typescript@5.1.6) + '@typescript-eslint/typescript-estree': 5.59.2(typescript@5.3.3) eslint: 8.40.0 eslint-scope: 5.1.1 semver: 7.5.4 @@ -2359,6 +2395,14 @@ packages: eslint-visitor-keys: 3.4.1 dev: true + /@typescript/vfs@1.5.0: + resolution: {integrity: sha512-AJS307bPgbsZZ9ggCT3wwpg3VbTKMFNHfaY/uF0ahSkYYrPF2dSSKDNIDIQAHm9qJqbLvCsSJH7yN4Vs/CsMMg==} + dependencies: + debug: 4.3.4(supports-color@8.1.1) + transitivePeerDependencies: + - supports-color + dev: true + /@vitest/expect@0.31.0: resolution: {integrity: sha512-Jlm8ZTyp6vMY9iz9Ny9a0BHnCG4fqBa8neCF6Pk/c/6vkUk49Ls6UBlgGAU82QnzzoaUs9E/mUhq/eq9uMOv/g==} dependencies: @@ -2445,7 +2489,7 @@ packages: resolution: {integrity: sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==} engines: {node: '>= 14'} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) transitivePeerDependencies: - supports-color dev: true @@ -2507,10 +2551,22 @@ packages: engines: {node: '>=10'} dev: true + /ansicolors@0.3.2: + resolution: {integrity: sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg==} + dev: true + /any-promise@1.3.0: resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} dev: true + /anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.1 + dev: true + /argparse@1.0.10: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} dependencies: @@ -2591,8 +2647,8 @@ packages: engines: {node: '>=8'} dev: true - /asynckit@0.4.0: - resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + /async@3.2.5: + resolution: {integrity: sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==} dev: true /auto-bind@4.0.0: @@ -2661,6 +2717,11 @@ packages: is-windows: 1.0.2 dev: true + /binary-extensions@2.2.0: + resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} + engines: {node: '>=8'} + dev: true + /bl@4.1.0: resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} dependencies: @@ -2784,6 +2845,19 @@ packages: upper-case-first: 2.0.2 dev: true + /cardinal@2.1.1: + resolution: {integrity: sha512-JSr5eOgoEymtYHBjNWyjrMqet9Am2miJhlfKNdqLp6zoeAh0KN5dRAcxlecj5mAJrmQomgiOBj35xHLrFjqBpw==} + hasBin: true + dependencies: + ansicolors: 0.3.2 + redeyed: 2.1.1 + dev: true + + /case@1.6.3: + resolution: {integrity: sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ==} + engines: {node: '>= 0.8.0'} + dev: true + /chai@4.3.7: resolution: {integrity: sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==} engines: {node: '>=4'} @@ -2854,6 +2928,21 @@ packages: resolution: {integrity: sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==} dev: true + /chokidar@3.6.0: + resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} + engines: {node: '>= 8.10.0'} + dependencies: + anymatch: 3.1.3 + braces: 3.0.2 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.2 + dev: true + /ci-info@3.8.0: resolution: {integrity: sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==} engines: {node: '>=8'} @@ -2864,6 +2953,13 @@ packages: engines: {node: '>=6'} dev: true + /clean-stack@3.0.1: + resolution: {integrity: sha512-lR9wNiMRcVQjSB3a7xXGLuz4cr4wJuuXlaAEbRutGowQTmlp7R72/DOgN21e8jdwblMWl9UOJMJXarX94pzKdg==} + engines: {node: '>=10'} + dependencies: + escape-string-regexp: 4.0.0 + dev: true + /cli-color@2.0.3: resolution: {integrity: sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ==} engines: {node: '>=0.10'} @@ -2882,6 +2978,13 @@ packages: restore-cursor: 3.1.0 dev: true + /cli-progress@3.12.0: + resolution: {integrity: sha512-tRkV3HJ1ASwm19THiiLIXLO7Im7wlTuKnvkYaTkyoAPefqjNg7W7DHKUlGRxy9vxDvbyCYQkQozvptuMkGCg8A==} + engines: {node: '>=4'} + dependencies: + string-width: 4.2.3 + dev: true + /cli-spinners@2.9.0: resolution: {integrity: sha512-4/aL9X3Wh0yiMQlE+eeRhWP6vclO3QRtw1JHKIT0FFUs5FjpFmESqtMvYZ0+lbzBw900b95mS0hohy+qn2VK/g==} engines: {node: '>=6'} @@ -2943,20 +3046,23 @@ packages: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} dev: true - /colorette@2.0.20: - resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} + /color-string@1.9.1: + resolution: {integrity: sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==} + dependencies: + color-name: 1.1.4 + simple-swizzle: 0.2.2 dev: true - /combined-stream@1.0.8: - resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} - engines: {node: '>= 0.8'} + /color@4.2.3: + resolution: {integrity: sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==} + engines: {node: '>=12.5.0'} dependencies: - delayed-stream: 1.0.0 + color-convert: 2.0.1 + color-string: 1.9.1 dev: true - /commander@4.1.1: - resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} - engines: {node: '>= 6'} + /colorette@2.0.20: + resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} dev: true /common-tags@1.8.2: @@ -2964,10 +3070,6 @@ packages: engines: {node: '>=4.0.0'} dev: true - /component-emitter@1.3.1: - resolution: {integrity: sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==} - dev: true - /concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} dev: true @@ -2998,10 +3100,6 @@ packages: resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==} dev: true - /cookiejar@2.1.4: - resolution: {integrity: sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==} - dev: true - /cosmiconfig@7.1.0: resolution: {integrity: sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==} engines: {node: '>=10'} @@ -3103,7 +3201,7 @@ packages: ms: 2.1.3 dev: true - /debug@4.3.4: + /debug@4.3.4(supports-color@8.1.1): resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} peerDependencies: @@ -3113,6 +3211,7 @@ packages: optional: true dependencies: ms: 2.1.2 + supports-color: 8.1.1 dev: true /decamelize-keys@1.1.1: @@ -3153,11 +3252,6 @@ packages: object-keys: 1.1.1 dev: true - /delayed-stream@1.0.0: - resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} - engines: {node: '>=0.4.0'} - dev: true - /dependency-graph@0.11.0: resolution: {integrity: sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg==} engines: {node: '>= 0.6.0'} @@ -3174,13 +3268,6 @@ packages: hasBin: true dev: true - /dezalgo@1.0.4: - resolution: {integrity: sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==} - dependencies: - asap: 2.0.6 - wrappy: 1.0.2 - dev: true - /dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} @@ -3219,6 +3306,14 @@ packages: engines: {node: '>=4'} dev: true + /ejs@3.1.9: + resolution: {integrity: sha512-rC+QVNMJWv+MtPgkt0y+0rVEIdbtxVADApW9JXrUVlzHetgcyczP/E7DJmWJ4fJCZF2cPcBk0laWO9ZHMG3DmQ==} + engines: {node: '>=0.10.0'} + hasBin: true + dependencies: + jake: 10.8.7 + dev: true + /electron-to-chromium@1.4.454: resolution: {integrity: sha512-pmf1rbAStw8UEQ0sr2cdJtWl48ZMuPD9Sto8HVQOq9vx9j2WgDEN6lYoaqFvqEHYOmGA9oRGn7LqWI9ta0YugQ==} dev: true @@ -3448,7 +3543,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.59.2(eslint@8.40.0)(typescript@5.1.6) + '@typescript-eslint/parser': 5.59.2(eslint@8.40.0)(typescript@5.3.3) debug: 3.2.7 eslint: 8.40.0 eslint-import-resolver-node: 0.3.7 @@ -3466,7 +3561,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.59.2(eslint@8.40.0)(typescript@5.1.6) + '@typescript-eslint/parser': 5.59.2(eslint@8.40.0)(typescript@5.3.3) array-includes: 3.1.6 array.prototype.flat: 1.3.1 array.prototype.flatmap: 1.3.1 @@ -3507,7 +3602,7 @@ packages: '@typescript-eslint/eslint-plugin': optional: true dependencies: - '@typescript-eslint/eslint-plugin': 5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.40.0)(typescript@5.1.6) + '@typescript-eslint/eslint-plugin': 5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.40.0)(typescript@5.3.3) eslint: 8.40.0 eslint-rule-composer: 0.3.0 dev: true @@ -3553,7 +3648,7 @@ packages: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.0 @@ -3587,6 +3682,13 @@ packages: - supports-color dev: true + /esm@3.2.25: + resolution: {integrity: sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==} + engines: {node: '>=6'} + requiresBuild: true + dev: true + optional: true + /espree@9.6.0: resolution: {integrity: sha512-1FH/IiruXZ84tpUlm0aCUEwMl2Ho5ilqVh0VvQXw+byAz/4SAciyHLlfmL5WYqsvD38oymdUwBss0LtK8m4s/A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -3703,10 +3805,6 @@ packages: fast-decode-uri-component: 1.0.1 dev: true - /fast-safe-stringify@2.1.1: - resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} - dev: true - /fast-url-parser@1.1.3: resolution: {integrity: sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ==} dependencies: @@ -3757,6 +3855,12 @@ packages: flat-cache: 3.0.4 dev: true + /filelist@1.0.4: + resolution: {integrity: sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==} + dependencies: + minimatch: 5.1.6 + dev: true + /fill-range@7.0.1: resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} engines: {node: '>=8'} @@ -3805,22 +3909,13 @@ packages: is-callable: 1.2.7 dev: true - /form-data@4.0.0: - resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} - engines: {node: '>= 6'} - dependencies: - asynckit: 0.4.0 - combined-stream: 1.0.8 - mime-types: 2.1.35 - dev: true - - /formidable@2.1.2: - resolution: {integrity: sha512-CM3GuJ57US06mlpQ47YcunuUZ9jpm8Vx+P2CGt2j7HpgkKZO/DJYQ0Bobim8G6PFQmK5lOqOOdUXboU+h73A4g==} + /fs-extra@11.2.0: + resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==} + engines: {node: '>=14.14'} dependencies: - dezalgo: 1.0.4 - hexoid: 1.0.0 - once: 1.4.0 - qs: 6.11.2 + graceful-fs: 4.2.11 + jsonfile: 6.1.0 + universalify: 2.0.1 dev: true /fs-extra@7.0.1: @@ -3894,6 +3989,11 @@ packages: has-symbols: 1.0.3 dev: true + /get-package-type@0.1.0: + resolution: {integrity: sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==} + engines: {node: '>=8.0.0'} + dev: true + /get-stdin@8.0.0: resolution: {integrity: sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==} engines: {node: '>=10'} @@ -3987,12 +4087,6 @@ packages: resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==} dev: true - /graphlib@2.1.8: - resolution: {integrity: sha512-jcLLfkpoVGmH7/InMC/1hIvOPSUh38oJtGhvrOFGzioE1DZ+0YW16RgmOJhHiuWTvGiJQ9Z1Ik43JvkRPRvE+A==} - dependencies: - lodash: 4.17.21 - dev: true - /graphql-config@4.5.0(graphql@16.6.0): resolution: {integrity: sha512-x6D0/cftpLUJ0Ch1e5sj1TZn6Wcxx4oMfmhaG9shM0DKajA9iR+j1z86GSTQ19fShbGvrSSvbIQsHku6aQ6BBw==} engines: {node: '>= 10.0.0'} @@ -4113,11 +4207,6 @@ packages: tslib: 2.5.3 dev: true - /hexoid@1.0.0: - resolution: {integrity: sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==} - engines: {node: '>=8'} - dev: true - /hosted-git-info@2.8.9: resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} dev: true @@ -4127,7 +4216,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) transitivePeerDependencies: - supports-color dev: true @@ -4137,7 +4226,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) transitivePeerDependencies: - supports-color dev: true @@ -4146,6 +4235,11 @@ packages: resolution: {integrity: sha512-UNopramDEhHJD+VR+ehk8rOslwSfByxPIZyJRfV739NDhN5LF1fa1MqnzKm2lGTQRjNrjK19Q5fhkgIfjlVUKw==} dev: true + /hyperlinker@1.0.0: + resolution: {integrity: sha512-Ty8UblRWFEcfSuIaajM34LdPXIhbs1ajEX/BBPv24J+enSVaEVY63xQ6lTO9VRYS5LAoghIG0IDJ+p+IPzKUQQ==} + engines: {node: '>=4'} + dev: true + /iconv-lite@0.4.24: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} engines: {node: '>=0.10.0'} @@ -4257,12 +4351,23 @@ packages: resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} dev: true + /is-arrayish@0.3.2: + resolution: {integrity: sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==} + dev: true + /is-bigint@1.0.4: resolution: {integrity: sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==} dependencies: has-bigints: 1.0.2 dev: true + /is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + dependencies: + binary-extensions: 2.2.0 + dev: true + /is-boolean-object@1.1.2: resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} engines: {node: '>= 0.4'} @@ -4296,6 +4401,12 @@ packages: has-tostringtag: 1.0.0 dev: true + /is-docker@2.2.1: + resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==} + engines: {node: '>=8'} + hasBin: true + dev: true + /is-extglob@2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} @@ -4341,6 +4452,11 @@ packages: engines: {node: '>=0.12.0'} dev: true + /is-observable@2.1.0: + resolution: {integrity: sha512-DailKdLb0WU+xX8K5w7VsJhapwHLZ9jjmazqCJq4X12CTgqq73TKnbRcnSLuXYPOoLQgV5IrD7ePiX/h1vnkBw==} + engines: {node: '>=8'} + dev: true + /is-path-inside@3.0.3: resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} engines: {node: '>=8'} @@ -4437,6 +4553,13 @@ packages: engines: {node: '>=0.10.0'} dev: true + /is-wsl@2.2.0: + resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==} + engines: {node: '>=8'} + dependencies: + is-docker: 2.2.1 + dev: true + /isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} dev: true @@ -4449,6 +4572,17 @@ packages: ws: 8.13.0 dev: true + /jake@10.8.7: + resolution: {integrity: sha512-ZDi3aP+fG/LchyBzUM804VjddnwfSfsdeYkwt8NcbKRvo4rFkjhs456iLFn3k2ZUWvNe4i48WACDbza8fhq2+w==} + engines: {node: '>=10'} + hasBin: true + dependencies: + async: 3.2.5 + chalk: 4.1.2 + filelist: 1.0.4 + minimatch: 3.1.2 + dev: true + /jiti@1.17.1: resolution: {integrity: sha512-NZIITw8uZQFuzQimqjUxIrIcEdxYDFIe/0xYfIlVXTkiBjjyBEvgasj5bb0/cHtPRD/NziPbT312sFrkI5ALpw==} hasBin: true @@ -4506,23 +4640,6 @@ packages: resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} dev: true - /json-refs@3.0.15: - resolution: {integrity: sha512-0vOQd9eLNBL18EGl5yYaO44GhixmImes2wiYn9Z3sag3QnehWrYWlB9AFtMxCL2Bj3fyxgDYkxGFEU/chlYssw==} - engines: {node: '>=0.8'} - hasBin: true - dependencies: - commander: 4.1.1 - graphlib: 2.1.8 - js-yaml: 3.14.1 - lodash: 4.17.21 - native-promise-only: 0.8.1 - path-loader: 1.0.12 - slash: 3.0.0 - uri-js: 4.4.1 - transitivePeerDependencies: - - supports-color - dev: true - /json-schema-to-typescript@13.1.1: resolution: {integrity: sha512-F3CYhtA7F3yPbb8vF7sFchk/2dnr1/yTKf8RcvoNpjnh67ZS/ZMH1ElLt5KHAtf2/bymiejLQQszszPWEeTdSw==} engines: {node: '>=12.0.0'} @@ -4544,11 +4661,6 @@ packages: prettier: 2.8.8 dev: true - /json-schema-to-zod@2.0.9: - resolution: {integrity: sha512-wsVZAy3F5EaBMRtvh7t0kaTXnEEqavLF6tV+NpwWwUgMTEW4Wtiio5zWxcLDHoUswc22hhP/uR9y7+4zutIE7Q==} - hasBin: true - dev: true - /json-schema-traverse@0.4.1: resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} dev: true @@ -4594,6 +4706,14 @@ packages: graceful-fs: 4.2.11 dev: true + /jsonfile@6.1.0: + resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} + dependencies: + universalify: 2.0.1 + optionalDependencies: + graceful-fs: 4.2.11 + dev: true + /jsonify@0.0.1: resolution: {integrity: sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==} dev: true @@ -4833,11 +4953,6 @@ packages: optional: true dev: true - /methods@1.1.2: - resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} - engines: {node: '>= 0.6'} - dev: true - /micromatch@4.0.5: resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} engines: {node: '>=8.6'} @@ -4846,24 +4961,6 @@ packages: picomatch: 2.3.1 dev: true - /mime-db@1.52.0: - resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} - engines: {node: '>= 0.6'} - dev: true - - /mime-types@2.1.35: - resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} - engines: {node: '>= 0.6'} - dependencies: - mime-db: 1.52.0 - dev: true - - /mime@2.6.0: - resolution: {integrity: sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==} - engines: {node: '>=4.0.0'} - hasBin: true - dev: true - /mimic-fn@2.1.0: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} engines: {node: '>=6'} @@ -4887,6 +4984,13 @@ packages: brace-expansion: 1.1.11 dev: true + /minimatch@5.1.6: + resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} + engines: {node: '>=10'} + dependencies: + brace-expansion: 2.0.1 + dev: true + /minimatch@9.0.3: resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} engines: {node: '>=16 || 14 >=14.17'} @@ -4953,10 +5057,6 @@ packages: hasBin: true dev: true - /native-promise-only@0.8.1: - resolution: {integrity: sha512-zkVhZUA3y8mbz652WrL5x0fB0ehrBkulWT3TomAQ9iDtyXZvzKeEA6GPxAItBYeNYl5yngKRX612qHOhvMkDeg==} - dev: true - /natural-compare-lite@1.4.0: resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==} dev: true @@ -4965,6 +5065,10 @@ packages: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: true + /natural-orderby@2.0.3: + resolution: {integrity: sha512-p7KTHxU0CUrcOXe62Zfrb5Z13nLvPhSWR/so3kFulUQU0sgUll2Z0LwpsLN351eOOD+hRGu/F1g+6xDfPeD++Q==} + dev: true + /next-tick@1.1.0: resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==} dev: true @@ -5016,6 +5120,11 @@ packages: remove-trailing-separator: 1.1.0 dev: true + /normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + dev: true + /nullthrows@1.1.1: resolution: {integrity: sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw==} dev: true @@ -5034,6 +5143,11 @@ packages: engines: {node: '>= 0.4'} dev: true + /object-treeify@1.1.33: + resolution: {integrity: sha512-EFVjAYfzWqWsBMRHPMAXLCDIJnpMhdWAqR7xG6M6a2cs6PMFpl/+Z20w9zDW4vkxOFfddegBKq9Rehd0bxWE7A==} + engines: {node: '>= 10'} + dev: true + /object.assign@4.1.4: resolution: {integrity: sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==} engines: {node: '>= 0.4'} @@ -5053,6 +5167,10 @@ packages: es-abstract: 1.21.2 dev: true + /observable-fns@0.6.1: + resolution: {integrity: sha512-9gRK4+sRWzeN6AOewNBTLXir7Zl/i3GB6Yl26gK4flxz8BXVpD3kt8amREmWNb0mxYOGDotvE5a4N+PtGGKdkg==} + dev: true + /once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} dependencies: @@ -5201,6 +5319,13 @@ packages: tslib: 2.5.3 dev: true + /password-prompt@1.1.3: + resolution: {integrity: sha512-HkrjG2aJlvF0t2BMH0e2LB/EHf3Lcq3fNMzy4GYHcQblAvOl+QQji1Lx7WRBMqpVK8p+KR7bCg7oqAMXtdgqyw==} + dependencies: + ansi-escapes: 4.3.2 + cross-spawn: 7.0.3 + dev: true + /path-case@3.0.4: resolution: {integrity: sha512-qO4qCFjXqVTrcbPt/hQfhTQ+VhFsqNKOPtytgNKkKxSoEp3XPUQ8ObFuePylOIok5gjn69ry8XiULxCwot3Wfg==} dependencies: @@ -5223,15 +5348,6 @@ packages: engines: {node: '>=8'} dev: true - /path-loader@1.0.12: - resolution: {integrity: sha512-n7oDG8B+k/p818uweWrOixY9/Dsr89o2TkCm6tOTex3fpdo2+BFDgR+KpB37mGKBRsBAlR8CIJMFN0OEy/7hIQ==} - dependencies: - native-promise-only: 0.8.1 - superagent: 7.1.6 - transitivePeerDependencies: - - supports-color - dev: true - /path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} dev: true @@ -5320,6 +5436,12 @@ packages: hasBin: true dev: true + /prettier@3.0.3: + resolution: {integrity: sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==} + engines: {node: '>=14'} + hasBin: true + dev: true + /pretty-format@27.5.1: resolution: {integrity: sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} @@ -5359,13 +5481,6 @@ packages: engines: {node: '>=6.0.0'} dev: true - /qs@6.11.2: - resolution: {integrity: sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==} - engines: {node: '>=0.6'} - dependencies: - side-channel: 1.0.4 - dev: true - /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} dev: true @@ -5417,6 +5532,13 @@ packages: util-deprecate: 1.0.2 dev: true + /readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + dependencies: + picomatch: 2.3.1 + dev: true + /redent@3.0.0: resolution: {integrity: sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==} engines: {node: '>=8'} @@ -5425,6 +5547,12 @@ packages: strip-indent: 3.0.0 dev: true + /redeyed@2.1.1: + resolution: {integrity: sha512-FNpGGo1DycYAdnrKFxCMmKYgo/mILAqtRYbkdQD8Ep/Hk2PQ5+aEAEx+IU713RTDmuBaH0c8P5ZozurNu5ObRQ==} + dependencies: + esprima: 4.0.1 + dev: true + /regenerator-runtime@0.13.11: resolution: {integrity: sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==} dev: true @@ -5512,7 +5640,7 @@ packages: glob: 7.2.3 dev: true - /rollup-plugin-dts@5.3.0(rollup@3.21.5)(typescript@5.1.6): + /rollup-plugin-dts@5.3.0(rollup@3.21.5)(typescript@5.3.3): resolution: {integrity: sha512-8FXp0ZkyZj1iU5klkIJYLjIq/YZSwBoERu33QBDxm/1yw5UU4txrEtcmMkrq+ZiKu3Q4qvPCNqc3ovX6rjqzbQ==} engines: {node: '>=v14'} peerDependencies: @@ -5521,7 +5649,7 @@ packages: dependencies: magic-string: 0.30.1 rollup: 3.21.5 - typescript: 5.1.6 + typescript: 5.3.3 optionalDependencies: '@babel/code-frame': 7.22.5 dev: true @@ -5534,7 +5662,7 @@ packages: rollup: ^1.20.0 || ^2.0.0 || ^3.0.0 dependencies: '@rollup/pluginutils': 5.0.2(rollup@3.21.5) - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) es-module-lexer: 1.3.0 esbuild: 0.17.18 joycon: 3.1.1 @@ -5688,6 +5816,12 @@ packages: resolution: {integrity: sha512-6+eerH9fEnNmi/hyM1DXcRK3pWdoMQtlkQ+ns0ntzunjKqp5i3sKCc80ym8Fib3iaYhdJUOPdhlJWj1tvge2Ww==} dev: true + /simple-swizzle@0.2.2: + resolution: {integrity: sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==} + dependencies: + is-arrayish: 0.3.2 + dev: true + /slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} @@ -5868,26 +6002,6 @@ packages: acorn: 8.10.0 dev: true - /superagent@7.1.6: - resolution: {integrity: sha512-gZkVCQR1gy/oUXr+kxJMLDjla434KmSOKbx5iGD30Ql+AkJQ/YlPKECJy2nhqOsHLjGHzoDTXNSjhnvWhzKk7g==} - engines: {node: '>=6.4.0 <13 || >=14'} - deprecated: Please downgrade to v7.1.5 if you need IE/ActiveXObject support OR upgrade to v8.0.0 as we no longer support IE and published an incorrect patch version (see https://github.com/visionmedia/superagent/issues/1731) - dependencies: - component-emitter: 1.3.1 - cookiejar: 2.1.4 - debug: 4.3.4 - fast-safe-stringify: 2.1.1 - form-data: 4.0.0 - formidable: 2.1.2 - methods: 1.1.2 - mime: 2.6.0 - qs: 6.11.2 - readable-stream: 3.6.2 - semver: 7.5.4 - transitivePeerDependencies: - - supports-color - dev: true - /supports-color@5.5.0: resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} engines: {node: '>=4'} @@ -5902,6 +6016,21 @@ packages: has-flag: 4.0.0 dev: true + /supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} + dependencies: + has-flag: 4.0.0 + dev: true + + /supports-hyperlinks@2.3.0: + resolution: {integrity: sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==} + engines: {node: '>=8'} + dependencies: + has-flag: 4.0.0 + supports-color: 7.2.0 + dev: true + /supports-preserve-symlinks-flag@1.0.0: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} @@ -5935,6 +6064,19 @@ packages: any-promise: 1.3.0 dev: true + /threads@1.7.0: + resolution: {integrity: sha512-Mx5NBSHX3sQYR6iI9VYbgHKBLisyB+xROCBGjjWm1O9wb9vfLxdaGtmT/KCjUqMsSNW6nERzCW3T6H43LqjDZQ==} + dependencies: + callsites: 3.1.0 + debug: 4.3.4(supports-color@8.1.1) + is-observable: 2.1.0 + observable-fns: 0.6.1 + optionalDependencies: + tiny-worker: 2.3.0 + transitivePeerDependencies: + - supports-color + dev: true + /through@2.3.8: resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} dev: true @@ -5951,6 +6093,14 @@ packages: next-tick: 1.1.0 dev: true + /tiny-worker@2.3.0: + resolution: {integrity: sha512-pJ70wq5EAqTAEl9IkGzA+fN0836rycEuz2Cn6yeZ6FRzlVS5IDOkFHpIoEsksPRQV34GDqXm65+OlnZqUSyK2g==} + requiresBuild: true + dependencies: + esm: 3.2.25 + dev: true + optional: true + /tinybench@2.5.0: resolution: {integrity: sha512-kRwSG8Zx4tjF9ZiyH4bhaebu+EDz1BOx9hOigYHlUW4xxI/wKIUQUqo018UlU4ar6ATPBsaMrdbKZ+tmPdohFA==} dev: true @@ -6003,6 +6153,30 @@ packages: resolution: {integrity: sha512-PGcnJoTBnVGy6yYNFxWVNkdcAuAMstvutN9MgDJIV6L0oG8fB+ZNNy1T+wJzah8RPGor1mZuPQkVfXNDpy9eHA==} dev: true + /ts-to-zod@3.7.3: + resolution: {integrity: sha512-JG9dS5E4/goWLVkYtA6hSwfLSKCA6t2T/hDbEXstkCYDEbct4qgEFk5cXmuYkWW9mlw+RClxD4SszMPtRKXjCw==} + hasBin: true + dependencies: + '@oclif/core': 3.20.0 + '@typescript/vfs': 1.5.0 + case: 1.6.3 + chokidar: 3.6.0 + fs-extra: 11.2.0 + inquirer: 8.2.5 + lodash: 4.17.21 + ora: 5.4.1 + prettier: 3.0.3 + rxjs: 7.8.1 + slash: 3.0.0 + threads: 1.7.0 + tslib: 2.6.2 + tsutils: 3.21.0(typescript@5.3.3) + typescript: 5.3.3 + zod: 3.22.4 + transitivePeerDependencies: + - supports-color + dev: true + /tsconfig-paths@3.14.2: resolution: {integrity: sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==} dependencies: @@ -6024,14 +6198,18 @@ packages: resolution: {integrity: sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==} dev: true - /tsutils@3.21.0(typescript@5.1.6): + /tslib@2.6.2: + resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} + dev: true + + /tsutils@3.21.0(typescript@5.3.3): resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} peerDependencies: typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' dependencies: tslib: 1.14.1 - typescript: 5.1.6 + typescript: 5.3.3 dev: true /tty-table@4.2.1: @@ -6106,10 +6284,10 @@ packages: peerDependencies: typedoc: 0.24.x dependencies: - typedoc: 0.24.7(typescript@5.1.6) + typedoc: 0.24.7(typescript@5.3.3) dev: true - /typedoc@0.24.7(typescript@5.1.6): + /typedoc@0.24.7(typescript@5.3.3): resolution: {integrity: sha512-zzfKDFIZADA+XRIp2rMzLe9xZ6pt12yQOhCr7cD7/PBTjhPmMyMvGrkZ2lPNJitg3Hj1SeiYFNzCsSDrlpxpKw==} engines: {node: '>= 14.14'} hasBin: true @@ -6120,11 +6298,11 @@ packages: marked: 4.3.0 minimatch: 9.0.3 shiki: 0.14.3 - typescript: 5.1.6 + typescript: 5.3.3 dev: true - /typescript@5.1.6: - resolution: {integrity: sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==} + /typescript@5.3.3: + resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==} engines: {node: '>=14.17'} hasBin: true dev: true @@ -6156,6 +6334,11 @@ packages: engines: {node: '>= 4.0.0'} dev: true + /universalify@2.0.1: + resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} + engines: {node: '>= 10.0.0'} + dev: true + /unixify@1.0.0: resolution: {integrity: sha512-6bc58dPYhCMHHuwxldQxO3RRNZ4eCogZ/st++0+fcC1nr0jiGUtAdBJ2qzmLQWSxbtz42pWt4QQMiZ9HvZf5cg==} engines: {node: '>=0.10.0'} @@ -6218,7 +6401,7 @@ packages: hasBin: true dependencies: cac: 6.7.14 - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) mlly: 1.4.0 pathe: 1.1.1 picocolors: 1.0.0 @@ -6314,7 +6497,7 @@ packages: cac: 6.7.14 chai: 4.3.7 concordance: 5.0.4 - debug: 4.3.4 + debug: 4.3.4(supports-color@8.1.1) local-pkg: 0.4.3 magic-string: 0.30.1 pathe: 1.1.1 @@ -6439,6 +6622,17 @@ packages: stackback: 0.0.2 dev: true + /widest-line@3.1.0: + resolution: {integrity: sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==} + engines: {node: '>=8'} + dependencies: + string-width: 4.2.3 + dev: true + + /wordwrap@1.0.0: + resolution: {integrity: sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==} + dev: true + /wrap-ansi@6.2.0: resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} engines: {node: '>=8'} @@ -6557,6 +6751,5 @@ packages: engines: {node: '>=12.20'} dev: true - /zod@3.21.4: - resolution: {integrity: sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==} - dev: false + /zod@3.22.4: + resolution: {integrity: sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==} diff --git a/scripts/codegen-webhooks.sh b/scripts/codegen-webhooks.sh index 4f298f2..d27fad0 100644 --- a/scripts/codegen-webhooks.sh +++ b/scripts/codegen-webhooks.sh @@ -5,3 +5,4 @@ curl https://core-api.uk.plain.com/webhooks/schema.json -o ./webhook-schema.json ./node_modules/.bin/json2ts --input webhook-schema.json --output webhook-schema.ts +./node_modules/.bin/ts-to-zod --skipValidation webhook-schema.ts webhook-model.ts diff --git a/src/tests/webhook-model.test.ts b/src/tests/webhook-model.test.ts new file mode 100644 index 0000000..ffdd20e --- /dev/null +++ b/src/tests/webhook-model.test.ts @@ -0,0 +1,24 @@ +import { describe, test } from 'vitest'; + +import { webhooksSchemaDefinitionSchema } from '../../webhook-model'; +import customerCreatedPayload from './webhook-payloads/customer-created'; +import emailReceivedPayload from './webhook-payloads/email-received'; +import emailSentPayload from './webhook-payloads/email-sent'; +import threadAssignmentTransitionedPayload from './webhook-payloads/thread-assignment-transitioned'; +import threadCreatedPayload from './webhook-payloads/thread-created'; +import threadStatusTransitionedPayload from './webhook-payloads/thread-status-transitioned'; + +describe('Webhook model tests', () => { + [ + customerCreatedPayload, + emailReceivedPayload, + emailSentPayload, + threadAssignmentTransitionedPayload, + threadCreatedPayload, + threadStatusTransitionedPayload, + ].forEach((payload) => { + test(`should parse the ${payload.type} payload`, () => { + webhooksSchemaDefinitionSchema.parse(payload); + }); + }); +}); diff --git a/src/tests/webhook-payloads/customer-created.ts b/src/tests/webhook-payloads/customer-created.ts new file mode 100644 index 0000000..6b2bfe7 --- /dev/null +++ b/src/tests/webhook-payloads/customer-created.ts @@ -0,0 +1,39 @@ +export default { + timestamp: '2023-10-19T14:12:25.142Z', + workspaceId: 'w_01GST0W989ZNAW53X6XYHAY87P', + payload: { + eventType: 'customer.customer_created', + customer: { + id: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', + email: { + email: 'peter@example.com', + isVerified: false, + verifiedAt: null, + }, + externalId: null, + fullName: 'Peter Santos', + shortName: 'Peter', + markedAsSpamAt: null, + markedAsSpamBy: null, + customerGroupMemberships: [], + createdAt: '2023-10-04T14:17:41.991Z', + createdBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + updatedAt: '2023-10-04T14:17:41.991Z', + updatedBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + }, + }, + id: 'pEv_01HD44FHDPMZ3YJB5GEB1EZKQV', + webhookMetadata: { + webhookTargetId: 'whTarget_01HD4400VTDJQ646V6RY37SR7K', + webhookDeliveryAttemptId: 'whAttempt_01HD44FJ45FJKVFHM3MDVYPGRS', + webhookDeliveryAttemptNumber: 1, + webhookDeliveryAttemptTimestamp: '2023-10-19T14:12:25.861Z', + }, + type: 'customer.customer_created', +}; diff --git a/src/tests/webhook-payloads/email-received.ts b/src/tests/webhook-payloads/email-received.ts new file mode 100644 index 0000000..432b83f --- /dev/null +++ b/src/tests/webhook-payloads/email-received.ts @@ -0,0 +1,114 @@ +export default { + timestamp: '2023-10-19T14:12:25.733Z', + workspaceId: 'w_01FXQ6A83FXNN9XA00415VR1XP', + payload: { + eventType: 'thread.email_received', + thread: { + id: 'th_01HD44FHMCDSSWE38N14FSYV6K', + customer: { + id: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', + email: { + email: 'peter@example.com', + isVerified: false, + verifiedAt: null, + }, + externalId: null, + fullName: 'Peter Santos', + shortName: 'Peter', + markedAsSpamAt: null, + markedAsSpamBy: null, + customerGroupMemberships: [], + createdAt: '2023-10-19T14:12:25.142Z', + createdBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + updatedAt: '2023-10-19T14:12:25.142Z', + updatedBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + }, + title: 'Unable to tail logs', + previewText: 'Hey, I am currently unable to tail the logs of the service svc-8af1e3', + priority: 2, + externalId: null, + status: 'TODO', + statusChangedAt: '2023-10-19T14:12:25.266Z', + statusChangedBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + statusDetail: { + type: 'CREATED', + createdAt: '2023-10-19T14:12:25.266Z', + }, + assignee: null, + assignedAt: null, + labels: [], + firstInboundMessageInfo: null, + firstOutboundMessageInfo: null, + lastInboundMessageInfo: null, + lastOutboundMessageInfo: null, + supportEmailAddresses: [], + createdAt: '2023-10-19T14:12:25.266Z', + createdBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + updatedAt: '2023-10-19T14:12:25.266Z', + updatedBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + }, + email: { + timelineEntryId: 't_01HD44FHHJ4DJC452ZTAR73PPF', + id: 'em_01HD44FF33QTSGW5JN37BFY6YE', + to: { + email: 'help@example.com', + name: null, + emailActor: { + actorType: 'supportEmailAddress', + supportEmailAddress: 'help@example.com', + }, + }, + from: { + email: 'peter@example.com', + name: 'Peter Santos', + emailActor: { + actorType: 'customer', + customerId: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', + }, + }, + additionalRecipients: [], + hiddenRecipients: [], + subject: 'Unable to tail logs', + textContent: 'Hey, I am currently unable to tail the logs of the service svc-8af1e3', + markdownContent: 'Hey, I am currently unable to tail the logs of the service svc-8af1e3', + authenticity: 'PASS', + sentAt: null, + receivedAt: '2023-10-19T14:12:22.757Z', + attachments: [], + inReplyToEmailId: null, + createdAt: '2023-10-19T14:12:25.733Z', + createdBy: { + actorType: 'customer', + customerId: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', + }, + updatedAt: '2023-10-19T14:12:25.733Z', + updatedBy: { + actorType: 'customer', + customerId: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', + }, + }, + }, + id: 'pEv_01HD44FJ053ZHW13SWS9556THX', + webhookMetadata: { + webhookTargetId: 'whTarget_01HD4400VTDJQ646V6RY37SR7K', + webhookDeliveryAttemptId: 'whAttempt_01HD44SZM21CPW0MXEQ73C2X7C', + webhookDeliveryAttemptNumber: 1, + webhookDeliveryAttemptTimestamp: '2023-10-19T14:18:07.362Z', + }, + type: 'thread.email_received', +}; diff --git a/src/tests/webhook-payloads/email-sent.ts b/src/tests/webhook-payloads/email-sent.ts new file mode 100644 index 0000000..ccbc494 --- /dev/null +++ b/src/tests/webhook-payloads/email-sent.ts @@ -0,0 +1,117 @@ +export default { + timestamp: '2023-10-19T21:44:01.325Z', + workspaceId: 'w_01FXQ6A83FXNN9XA00415VR1XP', + payload: { + eventType: 'thread.email_sent', + thread: { + id: 'th_01HD44FHMCDSSWE38N14FSYV6K', + customer: { + id: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', + email: { + email: 'peter@example.com', + isVerified: false, + verifiedAt: null, + }, + externalId: null, + fullName: 'Peter Santos', + shortName: 'Peter', + markedAsSpamAt: null, + markedAsSpamBy: null, + customerGroupMemberships: [], + createdAt: '2023-10-19T14:12:25.142Z', + createdBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + updatedAt: '2023-10-19T21:26:06.658Z', + updatedBy: { + actorType: 'user', + userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + }, + }, + title: 'Unable to tail logs', + previewText: 'Hey, I am currently unable to tail the logs of the service svc-8af1e3', + priority: 1, + externalId: null, + status: 'DONE', + statusChangedAt: '2023-10-19T21:24:36.108Z', + statusChangedBy: { + actorType: 'user', + userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + }, + statusDetail: null, + assignee: null, + assignedAt: null, + labels: [], + firstInboundMessageInfo: { + timestamp: '2023-10-19T14:12:25.733Z', + messageSource: 'EMAIL', + }, + firstOutboundMessageInfo: null, + lastInboundMessageInfo: { + timestamp: '2023-10-19T14:12:25.733Z', + messageSource: 'EMAIL', + }, + lastOutboundMessageInfo: null, + supportEmailAddresses: ['help@example.com'], + createdAt: '2023-10-19T14:12:25.266Z', + createdBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + updatedAt: '2023-10-19T21:38:54.335Z', + updatedBy: { + actorType: 'user', + userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + }, + }, + email: { + timelineEntryId: 't_01HD4YABRC74XY3D4SKAWKHXMH', + id: 'em_01HD4YABKW46E4Y8384T6ARDA5', + to: { + email: 'peter@example.com', + name: 'Peter Santos', + emailActor: { + actorType: 'customer', + customerId: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', + }, + }, + from: { + email: 'help@example.com', + name: 'Sam at Resolve', + emailActor: { + actorType: 'supportEmailAddress', + supportEmailAddress: 'help@example.com', + }, + }, + additionalRecipients: [], + hiddenRecipients: [], + subject: 'Re: Test', + textContent: 'Hey', + markdownContent: 'Hey', + authenticity: 'PASS', + sentAt: '2023-10-19T21:44:00.865Z', + receivedAt: null, + attachments: [], + inReplyToEmailId: 'em_01HD44FF33QTSGW5JN37BFY6YE', + createdAt: '2023-10-19T21:43:58.967Z', + createdBy: { + actorType: 'user', + userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + }, + updatedAt: '2023-10-19T21:44:01.201Z', + updatedBy: { + actorType: 'system', + system: 'email_sender', + }, + }, + }, + id: 'pEv_01HD4YAEHDHS2FW3F3VRSEGGVF', + webhookMetadata: { + webhookTargetId: 'whTarget_01HD4400VTDJQ646V6RY37SR7K', + webhookDeliveryAttemptId: 'whAttempt_01HD4YAFB6VN6AJ4TGVY4DJ0VR', + webhookDeliveryAttemptNumber: 1, + webhookDeliveryAttemptTimestamp: '2023-10-19T21:44:02.150Z', + }, + type: 'thread.email_sent', +}; diff --git a/src/tests/webhook-payloads/thread-assignment-transitioned.ts b/src/tests/webhook-payloads/thread-assignment-transitioned.ts new file mode 100644 index 0000000..f47f1a1 --- /dev/null +++ b/src/tests/webhook-payloads/thread-assignment-transitioned.ts @@ -0,0 +1,166 @@ +export default { + timestamp: '2023-10-19T21:24:51.660Z', + workspaceId: 'w_01GST0W989ZNAW53X6XYHAY87P', + payload: { + eventType: 'thread.thread_assignment_transitioned', + previousThread: { + id: 'th_01HD44FHMCDSSWE38N14FSYV6K', + customer: { + id: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', + email: { + email: 'peter@example.com', + isVerified: false, + verifiedAt: null, + }, + externalId: null, + fullName: 'Peter Santos', + shortName: 'Peter', + assignedAt: null, + assignedToUser: null, + status: 'IDLE', + statusChangedAt: '2023-10-19T21:24:36.109Z', + markedAsSpamAt: null, + markedAsSpamBy: null, + customerGroupMemberships: [], + createdAt: '2023-10-19T14:12:25.142Z', + createdBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + updatedAt: '2023-10-19T21:24:51.734Z', + updatedBy: { + actorType: 'user', + userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + }, + }, + title: 'Unable to tail logs', + previewText: 'Hey, I am currently unable to tail the logs of the service svc-8af1e3', + priority: 1, + externalId: null, + status: 'DONE', + statusChangedAt: '2023-10-19T21:24:36.108Z', + statusChangedBy: { + actorType: 'user', + userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + }, + statusDetail: null, + assignee: null, + assignedAt: null, + labels: [], + firstInboundMessageInfo: { + timestamp: '2023-10-19T14:12:25.733Z', + messageSource: 'EMAIL', + }, + firstOutboundMessageInfo: null, + lastInboundMessageInfo: { + timestamp: '2023-10-19T14:12:25.733Z', + messageSource: 'EMAIL', + }, + lastOutboundMessageInfo: null, + supportEmailAddresses: ['help@example.com'], + createdAt: '2023-10-19T14:12:25.266Z', + createdBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + updatedAt: '2023-10-19T21:24:36.108Z', + updatedBy: { + actorType: 'user', + userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + }, + }, + thread: { + id: 'th_01HD44FHMCDSSWE38N14FSYV6K', + customer: { + id: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', + email: { + email: 'peter@example.com', + isVerified: false, + verifiedAt: null, + }, + externalId: null, + fullName: 'Peter Santos', + shortName: 'Peter', + assignedAt: null, + assignedToUser: null, + status: 'IDLE', + statusChangedAt: '2023-10-19T21:24:36.109Z', + markedAsSpamAt: null, + markedAsSpamBy: null, + customerGroupMemberships: [], + createdAt: '2023-10-19T14:12:25.142Z', + createdBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + updatedAt: '2023-10-19T21:24:51.734Z', + updatedBy: { + actorType: 'user', + userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + }, + }, + title: 'Unable to tail logs', + previewText: 'Hey, I am currently unable to tail the logs of the service svc-8af1e3', + priority: 1, + externalId: null, + status: 'DONE', + statusChangedAt: '2023-10-19T21:24:36.108Z', + statusChangedBy: { + actorType: 'user', + userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + }, + statusDetail: null, + assignee: { + id: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + email: 'sam@example.com', + fullName: 'Sam', + publicName: 'Sam', + status: 'OFFLINE', + statusChangedAt: '2023-06-01T09:29:48.903Z', + createdAt: '2023-06-01T09:29:48.903Z', + createdBy: { + actorType: 'user', + userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + }, + updatedAt: '2023-06-01T09:29:48.903Z', + updatedBy: { + actorType: 'user', + userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + }, + deletedAt: null, + deletedBy: null, + }, + assignedAt: '2023-10-19T21:24:51.660Z', + labels: [], + firstInboundMessageInfo: { + timestamp: '2023-10-19T14:12:25.733Z', + messageSource: 'EMAIL', + }, + firstOutboundMessageInfo: null, + lastInboundMessageInfo: { + timestamp: '2023-10-19T14:12:25.733Z', + messageSource: 'EMAIL', + }, + lastOutboundMessageInfo: null, + supportEmailAddresses: ['help@example.com'], + createdAt: '2023-10-19T14:12:25.266Z', + createdBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + updatedAt: '2023-10-19T21:24:51.660Z', + updatedBy: { + actorType: 'user', + userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + }, + }, + }, + id: 'pEv_01HD4X7BTCJSP3NGTBKYSWGPSY', + webhookMetadata: { + webhookTargetId: 'whTarget_01HD4400VTDJQ646V6RY37SR7K', + webhookDeliveryAttemptId: 'whAttempt_01HD4XHSAX79QW8E34V86CKJRK', + webhookDeliveryAttemptNumber: 4, + webhookDeliveryAttemptTimestamp: '2023-10-19T21:30:33.181Z', + }, + type: 'thread.thread_assignment_transitioned', +}; diff --git a/src/tests/webhook-payloads/thread-created.ts b/src/tests/webhook-payloads/thread-created.ts new file mode 100644 index 0000000..a8de752 --- /dev/null +++ b/src/tests/webhook-payloads/thread-created.ts @@ -0,0 +1,74 @@ +export default { + timestamp: '2023-10-19T14:12:25.266Z', + workspaceId: 'w_01GST0W989ZNAW53X6XYHAY87P', + payload: { + eventType: 'thread.thread_created', + thread: { + id: 'th_01HD44FHMCDSSWE38N14FSYV6K', + customer: { + id: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', + email: { + email: 'peter@example.com', + isVerified: false, + verifiedAt: null, + }, + externalId: null, + fullName: 'Peter Santos', + shortName: 'Peter', + markedAsSpamAt: null, + markedAsSpamBy: null, + customerGroupMemberships: [], + createdAt: '2023-10-04T14:17:41.991Z', + createdBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + updatedAt: '2023-10-04T14:17:41.991Z', + updatedBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + }, + title: 'Unable to tail logs', + previewText: 'Hey, I am currently unable to tail the logs of the service svc-8af1e3', + priority: 2, + externalId: null, + status: 'TODO', + statusChangedAt: '2023-10-19T14:12:25.266Z', + statusChangedBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + statusDetail: { + type: 'CREATED', + createdAt: '2023-10-19T14:12:25.266Z', + }, + assignee: null, + assignedAt: null, + labels: [], + firstInboundMessageInfo: null, + firstOutboundMessageInfo: null, + lastInboundMessageInfo: null, + lastOutboundMessageInfo: null, + supportEmailAddresses: ['help@example.com'], + createdAt: '2023-10-19T14:12:25.266Z', + createdBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + updatedAt: '2023-10-19T14:12:25.266Z', + updatedBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + }, + }, + id: 'pEv_01HD44FHHJ0YABSNGKWMG3CJ5J', + webhookMetadata: { + webhookTargetId: 'whTarget_01HD4400VTDJQ646V6RY37SR7K', + webhookDeliveryAttemptId: 'whAttempt_01HD44FJASQM23MNHYDYPAXEG8', + webhookDeliveryAttemptNumber: 1, + webhookDeliveryAttemptTimestamp: '2023-10-19T14:12:26.073Z', + }, + type: 'thread.thread_created', +}; diff --git a/src/tests/webhook-payloads/thread-status-transitioned.ts b/src/tests/webhook-payloads/thread-status-transitioned.ts new file mode 100644 index 0000000..9d3124a --- /dev/null +++ b/src/tests/webhook-payloads/thread-status-transitioned.ts @@ -0,0 +1,147 @@ +export default { + timestamp: '2023-10-19T21:24:36.108Z', + workspaceId: 'w_01GST0W989ZNAW53X6XYHAY87P', + payload: { + eventType: 'thread.thread_status_transitioned', + previousThread: { + id: 'th_01HD44FHMCDSSWE38N14FSYV6K', + customer: { + id: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', + email: { + email: 'peter@example.com', + isVerified: false, + verifiedAt: null, + }, + externalId: null, + fullName: 'Peter Santos', + shortName: 'Peter', + assignedAt: null, + assignedToUser: null, + status: 'ACTIVE', + statusChangedAt: '2023-10-19T21:18:12.863Z', + markedAsSpamAt: null, + markedAsSpamBy: null, + customerGroupMemberships: [], + createdAt: '2023-10-19T14:12:25.142Z', + createdBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + updatedAt: '2023-10-19T21:18:12.863Z', + updatedBy: { + actorType: 'user', + userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + }, + }, + title: 'Unable to tail logs', + previewText: 'Hey, I am currently unable to tail the logs of the service svc-8af1e3', + priority: 1, + externalId: null, + status: 'TODO', + statusChangedAt: '2023-10-19T21:18:12.862Z', + statusChangedBy: { + actorType: 'user', + userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + }, + statusDetail: null, + assignee: null, + assignedAt: null, + labels: [], + firstInboundMessageInfo: { + timestamp: '2023-10-19T14:12:25.733Z', + messageSource: 'EMAIL', + }, + firstOutboundMessageInfo: null, + lastInboundMessageInfo: { + timestamp: '2023-10-19T14:12:25.733Z', + messageSource: 'EMAIL', + }, + lastOutboundMessageInfo: null, + supportEmailAddresses: ['help@example.com'], + createdAt: '2023-10-19T14:12:25.266Z', + createdBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + updatedAt: '2023-10-19T21:20:07.612Z', + updatedBy: { + actorType: 'user', + userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + }, + }, + thread: { + id: 'th_01HD44FHMCDSSWE38N14FSYV6K', + customer: { + id: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', + email: { + email: 'peter@example.com', + isVerified: false, + verifiedAt: null, + }, + externalId: null, + fullName: 'Peter Santos', + shortName: 'Peter', + assignedAt: null, + assignedToUser: null, + status: 'ACTIVE', + statusChangedAt: '2023-10-19T21:18:12.863Z', + markedAsSpamAt: null, + markedAsSpamBy: null, + customerGroupMemberships: [], + createdAt: '2023-10-19T14:12:25.142Z', + createdBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + updatedAt: '2023-10-19T21:18:12.863Z', + updatedBy: { + actorType: 'user', + userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + }, + }, + title: 'Unable to tail logs', + previewText: 'Hey, I am currently unable to tail the logs of the service svc-8af1e3', + priority: 1, + externalId: null, + status: 'DONE', + statusChangedAt: '2023-10-19T21:24:36.108Z', + statusChangedBy: { + actorType: 'user', + userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + }, + statusDetail: null, + assignee: null, + assignedAt: null, + labels: [], + firstInboundMessageInfo: { + timestamp: '2023-10-19T14:12:25.733Z', + messageSource: 'EMAIL', + }, + firstOutboundMessageInfo: null, + lastInboundMessageInfo: { + timestamp: '2023-10-19T14:12:25.733Z', + messageSource: 'EMAIL', + }, + lastOutboundMessageInfo: null, + supportEmailAddresses: ['help@example.com'], + createdAt: '2023-10-19T14:12:25.266Z', + createdBy: { + actorType: 'system', + system: 'email_inbound_handler', + }, + updatedAt: '2023-10-19T21:24:36.108Z', + updatedBy: { + actorType: 'user', + userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', + }, + }, + }, + id: 'pEv_01HD4X6WMCJSD8EHWDRHZ8WYDT', + webhookMetadata: { + webhookTargetId: 'whTarget_01HD4400VTDJQ646V6RY37SR7K', + webhookDeliveryAttemptId: 'whAttempt_01HD4XH9YE8CK6KT3G8VRX38R7', + webhookDeliveryAttemptNumber: 1, + webhookDeliveryAttemptTimestamp: '2023-10-19T21:30:17.422Z', + }, + type: 'thread.thread_status_transitioned', +}; diff --git a/webhook-model.ts b/webhook-model.ts new file mode 100644 index 0000000..09e1df8 --- /dev/null +++ b/webhook-model.ts @@ -0,0 +1,670 @@ +// Generated by ts-to-zod +import { z } from 'zod'; + +export const idSchema = z.string(); + +export const emailAddressSchema = z.string(); + +export const datetimeSchema = z.string(); + +export const userActorSchema = z.object({ + actorType: z.literal('user'), + userId: idSchema, +}); + +export const machineUserActorSchema = z.object({ + actorType: z.literal('machineUser'), + machineUserId: idSchema, +}); + +export const systemActorSchema = z.object({ + actorType: z.literal('system'), + system: z.string(), +}); + +export const customerActorSchema = z.object({ + actorType: z.literal('customer'), + customerId: idSchema, +}); + +export const emailActorSchema = z.union([ + userActorSchema, + customerActorSchema, + z.object({ + actorType: z.literal('supportEmailAddress'), + supportEmailAddress: z.string(), + }), + z.object({ + actorType: z.literal('deletedCustomer'), + customerId: idSchema, + }), +]); + +export const componentLinkButtonSchema = z.object({ + linkButtonUrl: z.string(), + linkButtonLabel: z.string(), + type: z.literal('linkButton'), +}); + +export const componentCopyButtonSchema = z.object({ + copyButtonValue: z.string(), + copyButtonTooltipLabel: z.string().nullable(), + type: z.literal('copyButton'), +}); + +export const componentTextSizeSchema = z.union([z.literal('S'), z.literal('M'), z.literal('L')]); + +export const componentTextColorSchema = z.union([ + z.literal('NORMAL'), + z.literal('MUTED'), + z.literal('SUCCESS'), + z.literal('WARNING'), + z.literal('ERROR'), +]); + +export const componentPlainTextSizeSchema = z.union([ + z.literal('S'), + z.literal('M'), + z.literal('L'), +]); + +export const componentPlainTextColorSchema = z.union([ + z.literal('NORMAL'), + z.literal('MUTED'), + z.literal('SUCCESS'), + z.literal('WARNING'), + z.literal('ERROR'), +]); + +export const componentSpacerSizeSchema = z.union([ + z.literal('XS'), + z.literal('S'), + z.literal('M'), + z.literal('L'), + z.literal('XL'), +]); + +export const componentDividerSpacingSizeSchema = z.union([ + z.literal('XS'), + z.literal('S'), + z.literal('M'), + z.literal('L'), + z.literal('XL'), +]); + +export const componentBadgeColorSchema = z.union([ + z.literal('GREY'), + z.literal('GREEN'), + z.literal('YELLOW'), + z.literal('RED'), + z.literal('BLUE'), +]); + +export const threadStatusSchema = z.union([ + z.literal('TODO'), + z.literal('DONE'), + z.literal('SNOOZED'), +]); + +export const threadStatusDetailSchema = z.union([ + z.object({ + type: z.literal('CREATED'), + createdAt: z.union([z.string(), z.string(), z.unknown()]), + }), + z.object({ + type: z.literal('SNOOZED'), + snoozedAt: z.union([z.string(), z.string(), z.unknown()]), + snoozedUntil: z.union([z.string(), z.string(), z.unknown()]), + }), + z.object({ + type: z.literal('UNSNOOZED'), + snoozedAt: z.union([z.string(), z.string(), z.unknown()]), + }), + z.object({ + type: z.literal('NEW_REPLY'), + newReplyAt: z.union([z.string(), z.string(), z.unknown()]), + }), + z.object({ + type: z.literal('LINK_LINEAR_UPDATED'), + updatedAt: z.union([z.string(), z.string(), z.unknown()]), + linearIssueId: z.string(), + }), +]); + +export const emailSchema = z.object({ + email: emailAddressSchema, + isVerified: z.boolean(), + verifiedAt: datetimeSchema.nullable(), +}); + +export const noteEntrySchema = z.object({ + entryType: z.literal('note'), + noteId: idSchema, + text: z.string(), + markdown: z.string().nullable(), +}); + +export const emailParticipantSchema = z.object({ + email: z.string(), + name: z.string().nullable(), + emailActor: emailActorSchema.nullable(), +}); + +export const threadMessageInfoSchema = z.object({ + timestamp: z.union([z.string(), z.string(), z.unknown()]), + messageSource: z.union([ + z.literal('CHAT'), + z.literal('EMAIL'), + z.literal('API'), + z.literal('SLACK'), + ]), +}); + +export const internalActorSchema = z.union([ + userActorSchema, + machineUserActorSchema, + systemActorSchema, +]); + +export const actorSchema = z.union([ + userActorSchema, + machineUserActorSchema, + systemActorSchema, + customerActorSchema, +]); + +export const componentTextSchema = z.object({ + type: z.literal('text'), + textSize: componentTextSizeSchema.nullable(), + textColor: componentTextColorSchema.nullable(), + text: z.string(), +}); + +export const componentPlainTextSchema = z.object({ + plainTextSize: componentPlainTextSizeSchema.nullable(), + plainTextColor: componentPlainTextColorSchema.nullable(), + plainText: z.string(), + type: z.literal('plainText'), +}); + +export const componentSpacerSchema = z.object({ + spacerSize: componentSpacerSizeSchema, + type: z.literal('spacer'), +}); + +export const componentDividerSchema = z.object({ + dividerSpacingSize: componentDividerSpacingSizeSchema.nullable(), + type: z.literal('divider'), +}); + +export const componentBadgeSchema = z.object({ + badgeLabel: z.string(), + badgeColor: componentBadgeColorSchema.nullable(), + type: z.literal('badge'), +}); + +export const componentRowContentSchema = z.union([ + componentTextSchema, + componentPlainTextSchema, + componentSpacerSchema, + componentDividerSchema, + componentLinkButtonSchema, + componentBadgeSchema, + componentCopyButtonSchema, +]); + +export const customerGroupSchema = z.object({ + id: idSchema, + workspaceId: idSchema, + name: z.string(), + key: z.string(), + color: z.string(), + createdAt: datetimeSchema, + createdBy: internalActorSchema, + updatedAt: datetimeSchema, + updatedBy: internalActorSchema, +}); + +export const userSchema = z.object({ + id: idSchema, + email: emailAddressSchema, + fullName: z.string(), + publicName: z.string(), + status: z.union([z.literal('ONLINE'), z.literal('OFFLINE'), z.literal('BREAK')]), + statusChangedAt: datetimeSchema, + createdAt: datetimeSchema, + createdBy: internalActorSchema, + updatedAt: datetimeSchema, + updatedBy: internalActorSchema, + deletedAt: datetimeSchema.nullable(), + deletedBy: internalActorSchema.nullable(), +}); + +export const machineUserSchema = z.object({ + id: idSchema, + fullName: z.string(), + publicName: z.string(), + description: z.string().nullable(), + createdAt: datetimeSchema, + createdBy: internalActorSchema, + updatedAt: datetimeSchema, + updatedBy: internalActorSchema, + deletedAt: datetimeSchema.nullable(), + deletedBy: internalActorSchema.nullable(), +}); + +export const chatEntryAttachmentSchema = z.object({ + id: idSchema, + fileName: z.string(), + fileSizeBytes: z.number(), + fileMimeType: z.string(), + fileExtension: z.string().nullable(), + createdAt: datetimeSchema, + createdBy: actorSchema, + updatedAt: datetimeSchema, + updatedBy: actorSchema, + type: z.literal('CHAT'), +}); + +export const emailEntryAttachmentSchema = z.object({ + id: idSchema, + fileName: z.string(), + fileSizeBytes: z.number(), + fileMimeType: z.string(), + fileExtension: z.string().nullable(), + createdAt: datetimeSchema, + createdBy: actorSchema, + updatedAt: datetimeSchema, + updatedBy: actorSchema, + type: z.literal('EMAIL'), + emailContentId: z.string(), +}); + +export const customEntryAttachmentSchema = z.object({ + id: idSchema, + fileName: z.string(), + fileSizeBytes: z.number(), + fileMimeType: z.string(), + fileExtension: z.string().nullable(), + createdAt: datetimeSchema, + createdBy: actorSchema, + updatedAt: datetimeSchema, + updatedBy: actorSchema, + type: z.literal('CUSTOM_TIMELINE_ENTRY'), +}); + +export const labelTypeSchema = z.object({ + id: idSchema, + name: z.string(), + icon: z.string().optional().nullable(), + isArchived: z.boolean().optional(), + archivedAt: datetimeSchema.nullable(), + archivedBy: internalActorSchema.nullable(), + createdAt: datetimeSchema, + createdBy: internalActorSchema, + updatedAt: datetimeSchema, + updatedBy: internalActorSchema, +}); + +export const attachmentSchema = z.object({ + id: idSchema, + fileName: z.string(), + fileSizeBytes: z.number(), + fileMimeType: z.string(), + fileExtension: z.string().nullable(), + createdAt: datetimeSchema, + createdBy: actorSchema, + updatedAt: datetimeSchema, + updatedBy: actorSchema, +}); + +export const chatSchema = z.object({ + timelineEntryId: idSchema, + id: idSchema, + customerReadAt: datetimeSchema.nullable(), + text: z.string().optional().nullable(), + attachments: z.array(attachmentSchema), + createdAt: datetimeSchema, + createdBy: actorSchema, + updatedAt: datetimeSchema, + updatedBy: actorSchema, +}); + +export const customerGroupMembershipSchema = z.object({ + customerId: idSchema, + customerGroupId: idSchema, + workspaceId: idSchema, + createdAt: datetimeSchema, + createdBy: internalActorSchema, + updatedAt: datetimeSchema, + updatedBy: internalActorSchema, + customerGroup: customerGroupSchema, +}); + +export const componentRowSchema = z.object({ + type: z.literal('row'), + rowMainContent: z.tuple([componentRowContentSchema, z.any()]), + rowAsideContent: z.array(componentRowContentSchema), +}); + +export const componentContainerContentSchema = z.union([ + componentTextSchema, + componentPlainTextSchema, + componentSpacerSchema, + componentDividerSchema, + componentLinkButtonSchema, + componentBadgeSchema, + componentCopyButtonSchema, + componentRowSchema, +]); + +export const customerGroupChangedPayloadSchema = z.union([ + z.object({ + changeType: z.literal('ADDED'), + eventType: z.literal('customer.customer_group_changed'), + customerGroup: customerGroupSchema, + }), + z.object({ + changeType: z.literal('UPDATED'), + eventType: z.literal('customer.customer_group_changed'), + customerGroup: customerGroupSchema, + previousCustomerGroup: customerGroupSchema, + }), + z.object({ + changeType: z.literal('REMOVED'), + eventType: z.literal('customer.customer_group_changed'), + previousCustomerGroup: customerGroupSchema, + }), +]); + +export const threadAssigneeSchema = z.union([ + userSchema, + machineUserSchema, + z.object({ + id: z.string(), + }), +]); + +export const chatEntrySchema = z.object({ + entryType: z.literal('chat'), + chatId: idSchema, + text: z.string().nullable(), + attachments: z.array(chatEntryAttachmentSchema), + customerReadAt: datetimeSchema.nullable(), +}); + +export const emailEntrySchema = z.object({ + entryType: z.literal('email'), + emailId: idSchema, + to: emailParticipantSchema, + from: emailParticipantSchema, + additionalRecipients: z.array(emailParticipantSchema), + hiddenRecipients: z.array(emailParticipantSchema), + subject: z.string().nullable(), + textContent: z.string().nullable(), + hasMoreTextContent: z.boolean(), + markdownContent: z.string().nullable(), + hasMoreMarkdownContent: z.boolean(), + authenticity: z.union([z.literal('PASS'), z.literal('FAIL'), z.literal('UNKNOWN')]), + sentAt: datetimeSchema.nullable(), + receivedAt: datetimeSchema.nullable(), + attachments: z.array(emailEntryAttachmentSchema), + inReplyToEmailId: z.string().nullable(), + isStartOfThread: z.boolean(), +}); + +export const labelSchema = z.object({ + id: idSchema, + labelType: labelTypeSchema, + createdAt: datetimeSchema, + createdBy: actorSchema, + updatedAt: datetimeSchema, + updatedBy: actorSchema, +}); + +export const email1Schema = z.object({ + timelineEntryId: idSchema, + id: idSchema, + to: emailParticipantSchema, + from: emailParticipantSchema, + replyTo: z.string().nullable(), + additionalRecipients: z.array(emailParticipantSchema), + hiddenRecipients: z.array(emailParticipantSchema), + subject: z.string().nullable(), + textContent: z.string().nullable(), + markdownContent: z.string().nullable(), + authenticity: z.union([z.literal('PASS'), z.literal('FAIL'), z.literal('UNKNOWN')]), + sentAt: datetimeSchema.nullable(), + receivedAt: datetimeSchema.nullable(), + attachments: z.array(attachmentSchema), + inReplyToEmailId: z.string().nullable(), + createdAt: datetimeSchema, + createdBy: actorSchema, + updatedAt: datetimeSchema, + updatedBy: actorSchema, +}); + +export const customerGroupMembershipsSchema = z.array(customerGroupMembershipSchema); + +export const componentContainerSchema = z.object({ + type: z.literal('container'), + containerContent: z.tuple([componentContainerContentSchema, z.any()]), +}); + +export const customerSchema = z.object({ + id: idSchema, + email: emailSchema, + externalId: z.string().nullable(), + fullName: z.string(), + shortName: z.string().nullable(), + assignedAt: datetimeSchema.nullable(), + assignedToUser: userSchema.nullable(), + markedAsSpamAt: datetimeSchema.optional().nullable(), + markedAsSpamBy: internalActorSchema.optional().nullable(), + customerGroupMemberships: customerGroupMembershipsSchema, + createdAt: datetimeSchema, + createdBy: actorSchema, + updatedAt: datetimeSchema, + updatedBy: actorSchema, +}); + +export const customer1Schema = z.object({ + id: idSchema, + email: emailSchema, + externalId: z.string().nullable(), + fullName: z.string(), + shortName: z.string().nullable(), + markedAsSpamAt: datetimeSchema.optional().nullable(), + markedAsSpamBy: internalActorSchema.optional().nullable(), + customerGroupMemberships: customerGroupMembershipsSchema, + createdAt: datetimeSchema, + createdBy: actorSchema, + updatedAt: datetimeSchema, + updatedBy: actorSchema, +}); + +export const threadSchema = z.object({ + id: idSchema, + customer: customer1Schema, + title: z.string(), + previewText: z.string().optional().nullable(), + priority: z.number(), + externalId: z.string().nullable(), + status: threadStatusSchema, + statusChangedAt: datetimeSchema.nullable(), + statusChangedBy: actorSchema.optional().nullable(), + statusDetail: threadStatusDetailSchema.nullable(), + assignee: threadAssigneeSchema.nullable(), + assignedAt: datetimeSchema.nullable(), + labels: z.array(labelSchema), + firstInboundMessageInfo: threadMessageInfoSchema.nullable(), + firstOutboundMessageInfo: threadMessageInfoSchema.nullable(), + lastInboundMessageInfo: threadMessageInfoSchema.nullable(), + lastOutboundMessageInfo: threadMessageInfoSchema.nullable(), + supportEmailAddresses: z.array(z.string()), + createdAt: datetimeSchema, + createdBy: actorSchema, + updatedAt: datetimeSchema, + updatedBy: actorSchema, +}); + +export const componentSchema = z.union([ + componentTextSchema, + componentPlainTextSchema, + componentSpacerSchema, + componentDividerSchema, + componentLinkButtonSchema, + componentBadgeSchema, + componentCopyButtonSchema, + componentRowSchema, + componentContainerSchema, +]); + +export const customerChangedPayloadSchema = z.object({ + changeType: z.union([z.literal('ADDED'), z.literal('UPDATED')]), + eventType: z.literal('customer.customer_changed'), + customer: customerSchema, + previousCustomer: customerSchema.nullable(), +}); + +export const customerGroupMembershipsChangedPayloadSchema = z.object({ + eventType: z.literal('customer.customer_group_memberships_changed'), + changeType: z.union([z.literal('ADDED'), z.literal('REMOVED')]), + customer: customer1Schema, + previousCustomer: customer1Schema, +}); + +export const threadCreatedPublicEventPayloadSchema = z.object({ + eventType: z.literal('thread.thread_created'), + thread: threadSchema, +}); + +export const threadStatusTransitionedPublicEventPayloadSchema = z.object({ + eventType: z.literal('thread.thread_status_transitioned'), + previousThread: threadSchema, + thread: threadSchema, +}); + +export const threadAssignmentTransitionedPublicEventPayloadSchema = z.object({ + eventType: z.literal('thread.thread_assignment_transitioned'), + previousThread: threadSchema, + thread: threadSchema, +}); + +export const threadEmailReceivedPublicEventPayloadSchema = z.object({ + eventType: z.literal('thread.email_received'), + thread: threadSchema, + email: email1Schema, +}); + +export const threadEmailSentPublicEventPayloadSchema = z.object({ + eventType: z.literal('thread.email_sent'), + thread: threadSchema, + email: email1Schema, +}); + +export const threadLabelsChangedPublicEventPayloadSchema = z.object({ + eventType: z.literal('thread.thread_labels_changed'), + changeType: z.union([z.literal('ADDED'), z.literal('REMOVED')]), + thread: threadSchema, + previousThread: threadSchema, +}); + +export const threadPriorityChangedPublicEventPayloadSchema = z.object({ + eventType: z.literal('thread.thread_priority_changed'), + previousThread: threadSchema, + thread: threadSchema, +}); + +export const threadChatSentPublicEventPayloadSchema = z.object({ + eventType: z.literal('thread.chat_sent'), + chat: chatSchema, + thread: threadSchema, +}); + +export const customerCreatedPublicEventPayloadSchema = z.object({ + eventType: z.literal('customer.customer_created'), + customer: customer1Schema, +}); + +export const customerUpdatedPublicEventPayloadSchema = z.object({ + eventType: z.literal('customer.customer_updated'), + customer: customer1Schema, + previousCustomer: customer1Schema, +}); + +export const customerDeletedPublicEventPayloadSchema = z.object({ + eventType: z.literal('customer.customer_deleted'), + previousCustomer: customer1Schema, +}); + +export const customEntrySchema = z.object({ + entryType: z.literal('custom'), + externalId: z.string().nullable(), + title: z.string(), + type: z.string().nullable(), + components: z.tuple([componentSchema, z.any()]), + attachments: z.array(customEntryAttachmentSchema), +}); + +export const timelineEntrySchema = z.object({ + id: idSchema, + customerId: idSchema, + timestamp: datetimeSchema, + actor: actorSchema, + entry: z.union([noteEntrySchema, chatEntrySchema, emailEntrySchema, customEntrySchema]), +}); + +export const timelineEntryChangedPayloadSchema = z.object({ + eventType: z.literal('timeline.timeline_entry_changed'), + previousTimelineEntry: timelineEntrySchema.nullable(), + timelineEntry: timelineEntrySchema.nullable(), + changeType: z.union([z.literal('ADDED'), z.literal('UPDATED'), z.literal('REMOVED')]), +}); + +export const webhooksSchemaDefinitionSchema = z.object({ + timestamp: z.unknown(), + workspaceId: idSchema, + payload: z.union([ + customerChangedPayloadSchema, + customerGroupMembershipsChangedPayloadSchema, + timelineEntryChangedPayloadSchema, + customerGroupChangedPayloadSchema, + threadCreatedPublicEventPayloadSchema, + threadStatusTransitionedPublicEventPayloadSchema, + threadAssignmentTransitionedPublicEventPayloadSchema, + threadEmailReceivedPublicEventPayloadSchema, + threadEmailSentPublicEventPayloadSchema, + threadLabelsChangedPublicEventPayloadSchema, + threadPriorityChangedPublicEventPayloadSchema, + threadChatSentPublicEventPayloadSchema, + customerCreatedPublicEventPayloadSchema, + customerUpdatedPublicEventPayloadSchema, + customerDeletedPublicEventPayloadSchema, + ]), + id: idSchema, + type: z.union([ + z.literal('thread.thread_created'), + z.literal('thread.thread_status_transitioned'), + z.literal('thread.thread_assignment_transitioned'), + z.literal('thread.email_received'), + z.literal('thread.email_sent'), + z.literal('thread.chat_sent'), + z.literal('thread.note_created'), + z.literal('thread.thread_labels_changed'), + z.literal('thread.thread_priority_changed'), + z.literal('customer.customer_created'), + z.literal('customer.customer_updated'), + z.literal('customer.customer_deleted'), + z.literal('customer.customer_changed'), + z.literal('customer.customer_group_changed'), + z.literal('customer.customer_group_memberships_changed'), + z.literal('timeline.timeline_entry_changed'), + ]), + webhookMetadata: z.object({ + webhookTargetId: idSchema, + webhookDeliveryAttemptId: idSchema, + webhookDeliveryAttemptNumber: z.number(), + webhookDeliveryAttemptTimestamp: datetimeSchema, + }), +}); diff --git a/webhook-schema.ts b/webhook-schema.ts index ee3d77e..fc1aba1 100644 --- a/webhook-schema.ts +++ b/webhook-schema.ts @@ -11,8 +11,6 @@ export type Datetime = string; export type InternalActor = UserActor | MachineUserActor | SystemActor; export type CustomerGroupMemberships = CustomerGroupMembership[]; export type Actor = UserActor | MachineUserActor | SystemActor | CustomerActor; -export type IssueTypeIcon = string; -export type IssueStatus = "OPEN" | "RESOLVED"; export type EmailActor = | UserActor | CustomerActor @@ -103,39 +101,7 @@ export type ThreadAssignee = | User | MachineUser | { - id: - | "customer_status_state_machine" - | "thread_status_state_machine" - | "timeline_writer" - | "timeline_listener" - | "email_builder" - | "email_sender" - | "postmark_external_inbound_handler" - | "postmark_inbound_handler" - | "email_inbound_handler" - | "notifications" - | "slack_integrations_janitor" - | "slack_notifications_sender" - | "slack_webhook_handler" - | "customer_authentication" - | "unread_user_chat_messages_handler" - | "unread_user_chat_messages_publisher" - | "plain_cli" - | "public_event_builder" - | "webhook_subscription_handler" - | "slack_user_notification_builder" - | "slack_workspace_notification_builder" - | "discord_workspace_notification_builder" - | "backfill_external_email_settings_job" - | "customer_card_updater" - | "internal_customer_card_api" - | "linear_webhook_handler" - | "linear_integrations_janitor" - | "job" - | "search_indexer" - | "thread_snooze_handler" - | "timeline_events_writer" - | "thread_triage_handler"; + id: string; }; /** @@ -145,7 +111,6 @@ export interface WebhooksSchemaDefinition { timestamp: unknown; workspaceId: Id; payload: - | CustomerStatusTransitionedPayload | CustomerChangedPayload | CustomerGroupMembershipsChangedPayload | TimelineEntryChangedPayload @@ -175,7 +140,6 @@ export interface WebhooksSchemaDefinition { | "customer.customer_created" | "customer.customer_updated" | "customer.customer_deleted" - | "customer.customer_status_transitioned" | "customer.customer_changed" | "customer.customer_group_changed" | "customer.customer_group_memberships_changed" @@ -188,12 +152,13 @@ export interface WebhooksSchemaDefinition { }; } /** - * The status of a customer has changed + * A customer has been created or updated */ -export interface CustomerStatusTransitionedPayload { - eventType: "customer.customer_status_transitioned"; - previousCustomer: Customer; +export interface CustomerChangedPayload { + changeType: "ADDED" | "UPDATED"; + eventType: "customer.customer_changed"; customer: Customer; + previousCustomer: Customer | null; } export interface Customer { id: Id; @@ -203,8 +168,6 @@ export interface Customer { shortName: string | null; assignedAt: Datetime | null; assignedToUser: User | null; - status: "IDLE" | "ACTIVE" | "SNOOZED"; - statusChangedAt: Datetime; markedAsSpamAt?: Datetime | null; markedAsSpamBy?: InternalActor | null; customerGroupMemberships: CustomerGroupMemberships; @@ -242,39 +205,7 @@ export interface MachineUserActor { } export interface SystemActor { actorType: "system"; - system: - | "customer_status_state_machine" - | "thread_status_state_machine" - | "timeline_writer" - | "timeline_listener" - | "email_builder" - | "email_sender" - | "postmark_external_inbound_handler" - | "postmark_inbound_handler" - | "email_inbound_handler" - | "notifications" - | "slack_integrations_janitor" - | "slack_notifications_sender" - | "slack_webhook_handler" - | "customer_authentication" - | "unread_user_chat_messages_handler" - | "unread_user_chat_messages_publisher" - | "plain_cli" - | "public_event_builder" - | "webhook_subscription_handler" - | "slack_user_notification_builder" - | "slack_workspace_notification_builder" - | "discord_workspace_notification_builder" - | "backfill_external_email_settings_job" - | "customer_card_updater" - | "internal_customer_card_api" - | "linear_webhook_handler" - | "linear_integrations_janitor" - | "job" - | "search_indexer" - | "thread_snooze_handler" - | "timeline_events_writer" - | "thread_triage_handler"; + system: string; } export interface CustomerGroupMembership { customerId: Id; @@ -301,15 +232,6 @@ export interface CustomerActor { actorType: "customer"; customerId: Id; } -/** - * A customer has been created or updated - */ -export interface CustomerChangedPayload { - changeType: "ADDED" | "UPDATED"; - eventType: "customer.customer_changed"; - customer: Customer; - previousCustomer: Customer | null; -} export interface CustomerGroupMembershipsChangedPayload { eventType: "customer.customer_group_memberships_changed"; changeType: "ADDED" | "REMOVED"; @@ -350,67 +272,7 @@ export interface TimelineEntry { customerId: Id; timestamp: Datetime; actor: Actor; - entry: - | IssueStatusTransitionedEntry - | IssueTypeChangedEntry - | IssuePriorityChangedEntry - | IssueDeletedEntry - | NoteEntry - | CustomerAssignmentTransitionedEntry - | ChatEntry - | CustomerStatusTransitionedEntry - | EmailEntry - | CustomEntry - | LinearIssueLinkStateTransitionedEntry; -} -export interface IssueStatusTransitionedEntry { - entryType: "issue_status_transitioned"; - issueId: Id; - issueKey: string; - issueTypeId: Id; - issueTypePublicName: string; - issueTypeIcon: IssueTypeIcon | null; - priority: IssuePriority; - previousStatus: IssueStatus | null; - nextStatus: IssueStatus; -} -export interface IssuePriority { - value: number; - label: string; -} -export interface IssueTypeChangedEntry { - entryType: "issue_issue_type_changed"; - issueId: Id; - issueKey: string; - previousIssueTypeId: Id; - previousIssueTypePublicName: string; - previousIssueTypeIcon: IssueTypeIcon | null; - nextIssueTypeId: Id; - nextIssueTypePublicName: string; - nextIssueTypeIcon: IssueTypeIcon | null; - status: IssueStatus; - priority: IssuePriority; -} -export interface IssuePriorityChangedEntry { - entryType: "issue_priority_changed"; - issueId: Id; - issueKey: string; - issueTypeId: Id; - issueTypePublicName: string; - issueTypeIcon: IssueTypeIcon | null; - previousPriority: IssuePriority; - nextPriority: IssuePriority; - status: IssueStatus; -} -export interface IssueDeletedEntry { - entryType: "issue_deleted"; - issueId: Id; - issueKey: string; - issueTypeId: Id; - issueTypePublicName: string; - issueTypeIcon: IssueTypeIcon | null; - status: IssueStatus; - priority: IssuePriority; + entry: NoteEntry | ChatEntry | EmailEntry | CustomEntry; } export interface NoteEntry { entryType: "note"; @@ -418,13 +280,6 @@ export interface NoteEntry { text: string; markdown: string | null; } -export interface CustomerAssignmentTransitionedEntry { - entryType: "customer_assignment_transitioned"; - previousUserId: Id | null; - previousUser: User | null; - nextUserId: Id | null; - nextUser: User | null; -} export interface ChatEntry { entryType: "chat"; chatId: Id; @@ -444,11 +299,6 @@ export interface ChatEntryAttachment { updatedBy: Actor; type: "CHAT"; } -export interface CustomerStatusTransitionedEntry { - entryType: "customer_status_transitioned"; - previousStatus: "IDLE" | "ACTIVE" | "SNOOZED"; - nextStatus: "IDLE" | "ACTIVE" | "SNOOZED"; -} export interface EmailEntry { entryType: "email"; emailId: Id; @@ -559,17 +409,6 @@ export interface CustomEntryAttachment { updatedBy: Actor; type: "CUSTOM_TIMELINE_ENTRY"; } -export interface LinearIssueLinkStateTransitionedEntry { - entryType: "linear_issue_link_state_transitioned"; - customerId: Id; - issueId: Id; - issueKey: string; - issueTypeId: Id; - issueTypePublicName: string; - linearIssueId: string; - previousLinearStateId: string; - nextLinearStateId: string; -} export interface ThreadCreatedPublicEventPayload { eventType: "thread.thread_created"; thread: Thread; From c40b1702ec5af0175cb383c691c4bd0c72da4352 Mon Sep 17 00:00:00 2001 From: Jordan Drake Date: Wed, 6 Mar 2024 14:53:08 +0000 Subject: [PATCH 03/10] Fix ajv --- .gitignore | 6 +- README.md | 35 +- package.json | 10 +- pnpm-lock.yaml | 415 ++- scripts/codegen-webhooks.sh | 7 +- src/index.ts | 2 + ...ok-model.test.ts => parse-webhook.test.ts} | 19 +- src/tests/webhook-payloads/email-received.ts | 119 +- src/tests/webhook-payloads/email-sent.ts | 117 - src/tests/webhook-payloads/invalid.ts | 56 + .../thread-assignment-transitioned.ts | 182 +- .../thread-status-transitioned.ts | 156 +- src/webhooks/index.ts | 1 + src/webhooks/parse.ts | 33 + src/webhooks/webhook-schema.json | 2736 +++++++++++++++++ .../webhooks/webhook-schema.ts | 1 + tsconfig.json | 3 +- webhook-model.ts | 670 ---- 18 files changed, 3386 insertions(+), 1182 deletions(-) rename src/tests/{webhook-model.test.ts => parse-webhook.test.ts} (53%) delete mode 100644 src/tests/webhook-payloads/email-sent.ts create mode 100644 src/tests/webhook-payloads/invalid.ts create mode 100644 src/webhooks/index.ts create mode 100644 src/webhooks/parse.ts create mode 100644 src/webhooks/webhook-schema.json rename webhook-schema.ts => src/webhooks/webhook-schema.ts (99%) delete mode 100644 webhook-model.ts diff --git a/.gitignore b/.gitignore index 63eff27..399095b 100644 --- a/.gitignore +++ b/.gitignore @@ -20,8 +20,4 @@ package-lock.json docs # cache -.eslintcache - -# Temporary -webhook-schema.json -webhook-schema.ts \ No newline at end of file +.eslintcache \ No newline at end of file diff --git a/README.md b/README.md index addcc5d..7152553 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,13 @@ [Changelog]('./CHANGELOG.md') +## Plain Client + This is the typescript/node SDK for Plain.com's Core GraphQL API. It makes it easy to make common API calls in just a few lines of code. If you run into any issues please open an issue or get in touch with us at . -## Basic example +#### Basic example ```ts import { PlainClient } from '@team-plain/typescript-sdk'; @@ -26,7 +28,7 @@ if (result.error) { You can find out how to make an API key in our documentation: -## Documentation +#### Documentation Every method in the SDK corresponds to a graphql [query](./src/graphql/queries/) or [mutation](./src/graphql/mutations/). @@ -36,7 +38,7 @@ You can find the generated documentation here: If you would like to add a query or mutation please open an issue and we can add it for you. -## Error handling +#### Error handling Every SDK method will return an object with either data or an error. @@ -62,7 +64,7 @@ function doThing() { An error can be **one of** the below: -### MutationError +###### MutationError [(view source)](./src/error.ts) This is the richest error type. It is called `MutationError` since it maps to the `MutationError` type in our GraphQL schema and is returned as part of every mutation in our API. @@ -80,28 +82,43 @@ Every mutation error will contain: type: one of `VALIDATION`, `REQUIRED`, `NOT_FOUND`. See [Error codes ](https://www.plain.com/docs/graphql/error-codes) in our docs for a description of each value. -### BadRequestError +###### BadRequestError [(view source)](./src/error.ts) Equivalent to a 400 response. If you are using typescript it's unlikely you will run into this since types will prevent this but if you are using javascript this likely means you are providing a wrong input/argument to a query or mutation. -### ForbiddenError +###### ForbiddenError [(view source)](./src/error.ts) Equivalent to a 401 or 403 response. Normally means your API key doesn't exist or that you are trying to query something that you do not have permissions for. -### InternalServerError +###### InternalServerError [(view source)](./src/error.ts) Equivalent to a 500 response. If this happens something unexpected within Plain happened. -### UnknownError +###### UnknownError [(view source)](./src/error.ts) Fallback error type when something unexpected happens. +## Webhooks + +This package also provides functionality to validate our [Webhook payloads](https://www.plain.com/docs/api-reference/webhooks). + +```ts +import { parsePlainWebhook } from '@team-plain/typescript-sdk'; + +const payload = { ... }; + +if(parsePlainWebhook(payload)) { + // payload is now typed! + doYourThing(payload); +} +``` + ## Contributing When submitting a PR, remember to run `pnpm changeset` and provide an easy to understand description of the changes you're making so that the changelog is populated. -When a PR with a changelog is merged a seperate PR will be automatically raised which rolls up any merged changes, handles assigning a new version for release and publishing to NPM. +When a PR with a changelog is merged a separate PR will be automatically raised which rolls up any merged changes and handles assigning a new version for release and publishing to NPM. diff --git a/package.json b/package.json index 9d7440f..1cd8585 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,8 @@ "@graphql-codegen/typescript-operations": "^3.0.4", "@typescript-eslint/eslint-plugin": "^5.59.2", "@typescript-eslint/parser": "^5.59.2", + "ajv": "^8.12.0", + "ajv-formats": "^2.1.1", "esbuild": "^0.17.18", "eslint": "^8.40.0", "eslint-plugin-import": "^2.27.5", @@ -42,12 +44,18 @@ "ts-to-zod": "^3.7.3", "typedoc": "^0.24.7", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "^5.2.2", + "typescript": "5.0.4", "vitest": "^0.31.0" }, "dependencies": { + "@apidevtools/json-schema-ref-parser": "^11.1.0", "@graphql-typed-document-node/core": "^3.2.0", "graphql": "^16.6.0", + "graphql-anywhere": "^4.2.8", + "json-refs": "^3.0.15", + "json-schema-ref-parser": "^9.0.9", + "json-schema-to-zod": "^2.0.14", + "jsonschema": "^1.4.1", "zod": "3.22.4" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ee92d19..9d44752 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,12 +5,30 @@ settings: excludeLinksFromLockfile: false dependencies: + '@apidevtools/json-schema-ref-parser': + specifier: ^11.1.0 + version: 11.1.0 '@graphql-typed-document-node/core': specifier: ^3.2.0 version: 3.2.0(graphql@16.6.0) graphql: specifier: ^16.6.0 version: 16.6.0 + graphql-anywhere: + specifier: ^4.2.8 + version: 4.2.8(graphql@16.6.0) + json-refs: + specifier: ^3.0.15 + version: 3.0.15 + json-schema-ref-parser: + specifier: ^9.0.9 + version: 9.0.9 + json-schema-to-zod: + specifier: ^2.0.14 + version: 2.0.14 + jsonschema: + specifier: ^1.4.1 + version: 1.4.1 zod: specifier: 3.22.4 version: 3.22.4 @@ -39,10 +57,16 @@ devDependencies: version: 3.0.4(graphql@16.6.0) '@typescript-eslint/eslint-plugin': specifier: ^5.59.2 - version: 5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.40.0)(typescript@5.3.3) + version: 5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.40.0)(typescript@5.0.4) '@typescript-eslint/parser': specifier: ^5.59.2 - version: 5.59.2(eslint@8.40.0)(typescript@5.3.3) + version: 5.59.2(eslint@8.40.0)(typescript@5.0.4) + ajv: + specifier: ^8.12.0 + version: 8.12.0 + ajv-formats: + specifier: ^2.1.1 + version: 2.1.1(ajv@8.12.0) esbuild: specifier: ^0.17.18 version: 0.17.18 @@ -66,7 +90,7 @@ devDependencies: version: 3.21.5 rollup-plugin-dts: specifier: ^5.3.0 - version: 5.3.0(rollup@3.21.5)(typescript@5.3.3) + version: 5.3.0(rollup@3.21.5)(typescript@5.0.4) rollup-plugin-esbuild: specifier: ^5.0.0 version: 5.0.0(esbuild@0.17.18)(rollup@3.21.5) @@ -75,13 +99,13 @@ devDependencies: version: 3.7.3 typedoc: specifier: ^0.24.7 - version: 0.24.7(typescript@5.3.3) + version: 0.24.7(typescript@5.0.4) typedoc-plugin-missing-exports: specifier: ^2.0.0 version: 2.0.0(typedoc@0.24.7) typescript: - specifier: ^5.2.2 - version: 5.3.3 + specifier: 5.0.4 + version: 5.0.4 vitest: specifier: ^0.31.0 version: 0.31.0 @@ -101,6 +125,26 @@ packages: '@jridgewell/trace-mapping': 0.3.18 dev: true + /@apidevtools/json-schema-ref-parser@11.1.0: + resolution: {integrity: sha512-g/VW9ZQEFJAOwAyUb8JFf7MLiLy2uEB4rU270rGzDwICxnxMlPy0O11KVePSgS36K1NI29gSlK84n5INGhd4Ag==} + engines: {node: '>= 16'} + dependencies: + '@jsdevtools/ono': 7.1.3 + '@types/json-schema': 7.0.15 + '@types/lodash.clonedeep': 4.5.9 + js-yaml: 4.1.0 + lodash.clonedeep: 4.5.0 + dev: false + + /@apidevtools/json-schema-ref-parser@9.0.9: + resolution: {integrity: sha512-GBD2Le9w2+lVFoc4vswGI/TjkNIZSVp7+9xPf+X3uidBfWnAeUWmquteSyt0+VCrhNMWj/FTABISQrD3Z/YA+w==} + dependencies: + '@jsdevtools/ono': 7.1.3 + '@types/json-schema': 7.0.12 + call-me-maybe: 1.0.2 + js-yaml: 4.1.0 + dev: false + /@ardatan/relay-compiler@12.0.0(graphql@16.6.0): resolution: {integrity: sha512-9anThAaj1dQr6IGmzBMcfzOQKTa5artjuPmw8NYK/fiGEMjADbSguBY2FMDykt+QhilR3wc9VA/3yVju7JHg7Q==} hasBin: true @@ -351,6 +395,7 @@ packages: /@babel/highlight@7.22.5: resolution: {integrity: sha512-BSKlD1hgnedS5XRnGOljZawtag7H1yPfQp0tdNJCHoH6AZ+Pcm9VvkrK59/Yy593Ypg0zMxH2BxD1VPYUQ7UIw==} engines: {node: '>=6.9.0'} + requiresBuild: true dependencies: '@babel/helper-validator-identifier': 7.22.5 chalk: 2.4.2 @@ -1933,7 +1978,6 @@ packages: /@jsdevtools/ono@7.1.3: resolution: {integrity: sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==} - dev: true /@manypkg/find-root@1.1.0: resolution: {integrity: sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA==} @@ -2209,7 +2253,10 @@ packages: /@types/json-schema@7.0.12: resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==} - dev: true + + /@types/json-schema@7.0.15: + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + dev: false /@types/json-stable-stringify@1.0.34: resolution: {integrity: sha512-s2cfwagOQAS8o06TcwKfr9Wx11dNGbH2E9vJz1cqV+a/LOyhWNLUNd6JSRYNzvB4d29UuJX2M0Dj9vE1T8fRXw==} @@ -2219,9 +2266,14 @@ packages: resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} dev: true + /@types/lodash.clonedeep@4.5.9: + resolution: {integrity: sha512-19429mWC+FyaAhOLzsS8kZUsI+/GmBAQ0HFiCPsKGU+7pBXOQWhyrY6xNNDwUSX8SMZMJvuFVMF9O5dQOlQK9Q==} + dependencies: + '@types/lodash': 4.14.201 + dev: false + /@types/lodash@4.14.201: resolution: {integrity: sha512-y9euML0cim1JrykNxADLfaG0FgD1g/yTHwUs/Jg9ZIU7WKj2/4IW9Lbb1WZbvck78W/lfGXFfe+u2EGfIJXdLQ==} - dev: true /@types/minimatch@5.1.2: resolution: {integrity: sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==} @@ -2265,7 +2317,7 @@ packages: '@types/node': 20.4.1 dev: true - /@typescript-eslint/eslint-plugin@5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.40.0)(typescript@5.3.3): + /@typescript-eslint/eslint-plugin@5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.40.0)(typescript@5.0.4): resolution: {integrity: sha512-yVrXupeHjRxLDcPKL10sGQ/QlVrA8J5IYOEWVqk0lJaSZP7X5DfnP7Ns3cc74/blmbipQ1htFNVGsHX6wsYm0A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2277,23 +2329,23 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.5.1 - '@typescript-eslint/parser': 5.59.2(eslint@8.40.0)(typescript@5.3.3) + '@typescript-eslint/parser': 5.59.2(eslint@8.40.0)(typescript@5.0.4) '@typescript-eslint/scope-manager': 5.59.2 - '@typescript-eslint/type-utils': 5.59.2(eslint@8.40.0)(typescript@5.3.3) - '@typescript-eslint/utils': 5.59.2(eslint@8.40.0)(typescript@5.3.3) + '@typescript-eslint/type-utils': 5.59.2(eslint@8.40.0)(typescript@5.0.4) + '@typescript-eslint/utils': 5.59.2(eslint@8.40.0)(typescript@5.0.4) debug: 4.3.4(supports-color@8.1.1) eslint: 8.40.0 grapheme-splitter: 1.0.4 ignore: 5.2.4 natural-compare-lite: 1.4.0 semver: 7.5.4 - tsutils: 3.21.0(typescript@5.3.3) - typescript: 5.3.3 + tsutils: 3.21.0(typescript@5.0.4) + typescript: 5.0.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser@5.59.2(eslint@8.40.0)(typescript@5.3.3): + /@typescript-eslint/parser@5.59.2(eslint@8.40.0)(typescript@5.0.4): resolution: {integrity: sha512-uq0sKyw6ao1iFOZZGk9F8Nro/8+gfB5ezl1cA06SrqbgJAt0SRoFhb9pXaHvkrxUpZaoLxt8KlovHNk8Gp6/HQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2305,10 +2357,10 @@ packages: dependencies: '@typescript-eslint/scope-manager': 5.59.2 '@typescript-eslint/types': 5.59.2 - '@typescript-eslint/typescript-estree': 5.59.2(typescript@5.3.3) + '@typescript-eslint/typescript-estree': 5.59.2(typescript@5.0.4) debug: 4.3.4(supports-color@8.1.1) eslint: 8.40.0 - typescript: 5.3.3 + typescript: 5.0.4 transitivePeerDependencies: - supports-color dev: true @@ -2321,7 +2373,7 @@ packages: '@typescript-eslint/visitor-keys': 5.59.2 dev: true - /@typescript-eslint/type-utils@5.59.2(eslint@8.40.0)(typescript@5.3.3): + /@typescript-eslint/type-utils@5.59.2(eslint@8.40.0)(typescript@5.0.4): resolution: {integrity: sha512-b1LS2phBOsEy/T381bxkkywfQXkV1dWda/z0PhnIy3bC5+rQWQDS7fk9CSpcXBccPY27Z6vBEuaPBCKCgYezyQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2331,12 +2383,12 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 5.59.2(typescript@5.3.3) - '@typescript-eslint/utils': 5.59.2(eslint@8.40.0)(typescript@5.3.3) + '@typescript-eslint/typescript-estree': 5.59.2(typescript@5.0.4) + '@typescript-eslint/utils': 5.59.2(eslint@8.40.0)(typescript@5.0.4) debug: 4.3.4(supports-color@8.1.1) eslint: 8.40.0 - tsutils: 3.21.0(typescript@5.3.3) - typescript: 5.3.3 + tsutils: 3.21.0(typescript@5.0.4) + typescript: 5.0.4 transitivePeerDependencies: - supports-color dev: true @@ -2346,7 +2398,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree@5.59.2(typescript@5.3.3): + /@typescript-eslint/typescript-estree@5.59.2(typescript@5.0.4): resolution: {integrity: sha512-+j4SmbwVmZsQ9jEyBMgpuBD0rKwi9RxRpjX71Brr73RsYnEr3Lt5QZ624Bxphp8HUkSKfqGnPJp1kA5nl0Sh7Q==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2361,13 +2413,13 @@ packages: globby: 11.1.0 is-glob: 4.0.3 semver: 7.5.4 - tsutils: 3.21.0(typescript@5.3.3) - typescript: 5.3.3 + tsutils: 3.21.0(typescript@5.0.4) + typescript: 5.0.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils@5.59.2(eslint@8.40.0)(typescript@5.3.3): + /@typescript-eslint/utils@5.59.2(eslint@8.40.0)(typescript@5.0.4): resolution: {integrity: sha512-kSuF6/77TZzyGPhGO4uVp+f0SBoYxCDf+lW3GKhtKru/L8k/Hd7NFQxyWUeY7Z/KGB2C6Fe3yf2vVi4V9TsCSQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2378,7 +2430,7 @@ packages: '@types/semver': 7.5.0 '@typescript-eslint/scope-manager': 5.59.2 '@typescript-eslint/types': 5.59.2 - '@typescript-eslint/typescript-estree': 5.59.2(typescript@5.3.3) + '@typescript-eslint/typescript-estree': 5.59.2(typescript@5.0.4) eslint: 8.40.0 eslint-scope: 5.1.1 semver: 7.5.4 @@ -2466,6 +2518,12 @@ packages: tslib: 2.6.0 dev: true + /@wry/equality@0.1.11: + resolution: {integrity: sha512-mwEVBDUVODlsQQ5dfuLUS5/Tf7jqUKyhKYHmVi4fPB6bDMOfWvUPJmKgS1Z7Za/sOI3vzWt4+O7yCiL/70MogA==} + dependencies: + tslib: 1.14.1 + dev: false + /acorn-jsx@5.3.2(acorn@8.10.0): resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: @@ -2502,6 +2560,17 @@ packages: indent-string: 4.0.0 dev: true + /ajv-formats@2.1.1(ajv@8.12.0): + resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} + peerDependencies: + ajv: ^8.0.0 + peerDependenciesMeta: + ajv: + optional: true + dependencies: + ajv: 8.12.0 + dev: true + /ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} dependencies: @@ -2511,6 +2580,15 @@ packages: uri-js: 4.4.1 dev: true + /ajv@8.12.0: + resolution: {integrity: sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==} + dependencies: + fast-deep-equal: 3.1.3 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + uri-js: 4.4.1 + dev: true + /ansi-colors@4.1.3: resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} engines: {node: '>=6'} @@ -2567,15 +2645,25 @@ packages: picomatch: 2.3.1 dev: true + /apollo-utilities@1.3.4(graphql@16.6.0): + resolution: {integrity: sha512-pk2hiWrCXMAy2fRPwEyhvka+mqwzeP60Jr1tRYi5xru+3ko94HI9o6lK0CT33/w4RDlxWchmdhDCrvdr+pHCig==} + peerDependencies: + graphql: ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 + dependencies: + '@wry/equality': 0.1.11 + fast-json-stable-stringify: 2.1.0 + graphql: 16.6.0 + ts-invariant: 0.4.4 + tslib: 1.14.1 + dev: false + /argparse@1.0.10: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} dependencies: sprintf-js: 1.0.3 - dev: true /argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} - dev: true /array-buffer-byte-length@1.0.0: resolution: {integrity: sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==} @@ -2627,7 +2715,6 @@ packages: /asap@2.0.6: resolution: {integrity: sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==} - dev: true /asn1js@3.0.5: resolution: {integrity: sha512-FVnvrKJwpt9LP2lAMl8qZswRNm3T4q9CON+bxldk2iwk3FFpuwhx2FfinyitizWHsVYyaY+y5JzDR0rCMV5yTQ==} @@ -2651,6 +2738,10 @@ packages: resolution: {integrity: sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==} dev: true + /asynckit@0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + dev: false + /auto-bind@4.0.0: resolution: {integrity: sha512-Hdw8qdNiqdJ8LqT0iK0sVzkFbzg6fhnQqqfWhBDxcHZvU75+B+ayzTy8x+k5Ix0Y92XOhOUlx74ps+bA6BeYMQ==} engines: {node: '>=8'} @@ -2801,11 +2892,9 @@ packages: dependencies: function-bind: 1.1.1 get-intrinsic: 1.2.1 - dev: true /call-me-maybe@1.0.2: resolution: {integrity: sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==} - dev: true /callsites@3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} @@ -3065,11 +3154,27 @@ packages: resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} dev: true + /combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} + dependencies: + delayed-stream: 1.0.0 + dev: false + + /commander@4.1.1: + resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} + engines: {node: '>= 6'} + dev: false + /common-tags@1.8.2: resolution: {integrity: sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==} engines: {node: '>=4.0.0'} dev: true + /component-emitter@1.3.1: + resolution: {integrity: sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==} + dev: false + /concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} dev: true @@ -3100,6 +3205,10 @@ packages: resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==} dev: true + /cookiejar@2.1.4: + resolution: {integrity: sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==} + dev: false + /cosmiconfig@7.1.0: resolution: {integrity: sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==} engines: {node: '>=10'} @@ -3212,7 +3321,6 @@ packages: dependencies: ms: 2.1.2 supports-color: 8.1.1 - dev: true /decamelize-keys@1.1.1: resolution: {integrity: sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==} @@ -3252,6 +3360,11 @@ packages: object-keys: 1.1.1 dev: true + /delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + dev: false + /dependency-graph@0.11.0: resolution: {integrity: sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg==} engines: {node: '>= 0.6.0'} @@ -3268,6 +3381,13 @@ packages: hasBin: true dev: true + /dezalgo@1.0.4: + resolution: {integrity: sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==} + dependencies: + asap: 2.0.6 + wrappy: 1.0.2 + dev: false + /dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} @@ -3543,7 +3663,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.59.2(eslint@8.40.0)(typescript@5.3.3) + '@typescript-eslint/parser': 5.59.2(eslint@8.40.0)(typescript@5.0.4) debug: 3.2.7 eslint: 8.40.0 eslint-import-resolver-node: 0.3.7 @@ -3561,7 +3681,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.59.2(eslint@8.40.0)(typescript@5.3.3) + '@typescript-eslint/parser': 5.59.2(eslint@8.40.0)(typescript@5.0.4) array-includes: 3.1.6 array.prototype.flat: 1.3.1 array.prototype.flatmap: 1.3.1 @@ -3602,7 +3722,7 @@ packages: '@typescript-eslint/eslint-plugin': optional: true dependencies: - '@typescript-eslint/eslint-plugin': 5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.40.0)(typescript@5.3.3) + '@typescript-eslint/eslint-plugin': 5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.40.0)(typescript@5.0.4) eslint: 8.40.0 eslint-rule-composer: 0.3.0 dev: true @@ -3702,7 +3822,6 @@ packages: resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} engines: {node: '>=4'} hasBin: true - dev: true /esquery@1.5.0: resolution: {integrity: sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==} @@ -3793,7 +3912,6 @@ packages: /fast-json-stable-stringify@2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} - dev: true /fast-levenshtein@2.0.6: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} @@ -3805,6 +3923,10 @@ packages: fast-decode-uri-component: 1.0.1 dev: true + /fast-safe-stringify@2.1.1: + resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} + dev: false + /fast-url-parser@1.1.3: resolution: {integrity: sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ==} dependencies: @@ -3909,6 +4031,24 @@ packages: is-callable: 1.2.7 dev: true + /form-data@4.0.0: + resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} + engines: {node: '>= 6'} + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + mime-types: 2.1.35 + dev: false + + /formidable@2.1.2: + resolution: {integrity: sha512-CM3GuJ57US06mlpQ47YcunuUZ9jpm8Vx+P2CGt2j7HpgkKZO/DJYQ0Bobim8G6PFQmK5lOqOOdUXboU+h73A4g==} + dependencies: + dezalgo: 1.0.4 + hexoid: 1.0.0 + once: 1.4.0 + qs: 6.11.2 + dev: false + /fs-extra@11.2.0: resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==} engines: {node: '>=14.14'} @@ -3950,7 +4090,6 @@ packages: /function-bind@1.1.1: resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==} - dev: true /function.prototype.name@1.1.5: resolution: {integrity: sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==} @@ -3987,7 +4126,6 @@ packages: has: 1.0.3 has-proto: 1.0.1 has-symbols: 1.0.3 - dev: true /get-package-type@0.1.0: resolution: {integrity: sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==} @@ -4087,6 +4225,23 @@ packages: resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==} dev: true + /graphlib@2.1.8: + resolution: {integrity: sha512-jcLLfkpoVGmH7/InMC/1hIvOPSUh38oJtGhvrOFGzioE1DZ+0YW16RgmOJhHiuWTvGiJQ9Z1Ik43JvkRPRvE+A==} + dependencies: + lodash: 4.17.21 + dev: false + + /graphql-anywhere@4.2.8(graphql@16.6.0): + resolution: {integrity: sha512-bKeJJoY9JyWMAiz5isKrtYUdIUBOBiXUOrA9CQgs9Drh9itFtxhWndQH4UBuYfrMticum6Oj1uQ6iSvZk94cMQ==} + peerDependencies: + graphql: '>= 0.11.0' + dependencies: + apollo-utilities: 1.3.4(graphql@16.6.0) + graphql: 16.6.0 + ts-invariant: 0.3.3 + tslib: 2.6.2 + dev: false + /graphql-config@4.5.0(graphql@16.6.0): resolution: {integrity: sha512-x6D0/cftpLUJ0Ch1e5sj1TZn6Wcxx4oMfmhaG9shM0DKajA9iR+j1z86GSTQ19fShbGvrSSvbIQsHku6aQ6BBw==} engines: {node: '>= 10.0.0'} @@ -4168,7 +4323,6 @@ packages: /has-flag@4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} - dev: true /has-property-descriptors@1.0.0: resolution: {integrity: sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==} @@ -4179,12 +4333,10 @@ packages: /has-proto@1.0.1: resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} engines: {node: '>= 0.4'} - dev: true /has-symbols@1.0.3: resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} engines: {node: '>= 0.4'} - dev: true /has-tostringtag@1.0.0: resolution: {integrity: sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==} @@ -4198,7 +4350,6 @@ packages: engines: {node: '>= 0.4.0'} dependencies: function-bind: 1.1.1 - dev: true /header-case@2.0.4: resolution: {integrity: sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q==} @@ -4207,6 +4358,11 @@ packages: tslib: 2.5.3 dev: true + /hexoid@1.0.0: + resolution: {integrity: sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==} + engines: {node: '>=8'} + dev: false + /hosted-git-info@2.8.9: resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} dev: true @@ -4293,7 +4449,6 @@ packages: /inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - dev: true /inquirer@8.2.5: resolution: {integrity: sha512-QAgPDQMEgrDssk1XiwwHoOGYF9BAbUcc1+j+FhEvaOt8/cKRqyLn0U5qA6F74fGhTMGxf92pOvPBeh29jQJDTQ==} @@ -4621,14 +4776,12 @@ packages: dependencies: argparse: 1.0.10 esprima: 4.0.1 - dev: true /js-yaml@4.1.0: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true dependencies: argparse: 2.0.1 - dev: true /jsesc@2.5.2: resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} @@ -4640,6 +4793,31 @@ packages: resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} dev: true + /json-refs@3.0.15: + resolution: {integrity: sha512-0vOQd9eLNBL18EGl5yYaO44GhixmImes2wiYn9Z3sag3QnehWrYWlB9AFtMxCL2Bj3fyxgDYkxGFEU/chlYssw==} + engines: {node: '>=0.8'} + hasBin: true + dependencies: + commander: 4.1.1 + graphlib: 2.1.8 + js-yaml: 3.14.1 + lodash: 4.17.21 + native-promise-only: 0.8.1 + path-loader: 1.0.12 + slash: 3.0.0 + uri-js: 4.4.1 + transitivePeerDependencies: + - supports-color + dev: false + + /json-schema-ref-parser@9.0.9: + resolution: {integrity: sha512-qcP2lmGy+JUoQJ4DOQeLaZDqH9qSkeGCK3suKWxJXS82dg728Mn3j97azDMaOUmJAN4uCq91LdPx4K7E8F1a7Q==} + engines: {node: '>=10'} + deprecated: Please switch to @apidevtools/json-schema-ref-parser + dependencies: + '@apidevtools/json-schema-ref-parser': 9.0.9 + dev: false + /json-schema-to-typescript@13.1.1: resolution: {integrity: sha512-F3CYhtA7F3yPbb8vF7sFchk/2dnr1/yTKf8RcvoNpjnh67ZS/ZMH1ElLt5KHAtf2/bymiejLQQszszPWEeTdSw==} engines: {node: '>=12.0.0'} @@ -4661,10 +4839,19 @@ packages: prettier: 2.8.8 dev: true + /json-schema-to-zod@2.0.14: + resolution: {integrity: sha512-Pp9wg1/AcMw5KA1RA7t6ybUTIes1yX0vp8PeE48cPnddHb+ZZWbAKPaFXVf4Pif4XSbo9u9i/hIzBcS1UHK/TA==} + hasBin: true + dev: false + /json-schema-traverse@0.4.1: resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} dev: true + /json-schema-traverse@1.0.0: + resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} + dev: true + /json-stable-stringify-without-jsonify@1.0.1: resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} dev: true @@ -4718,6 +4905,10 @@ packages: resolution: {integrity: sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==} dev: true + /jsonschema@1.4.1: + resolution: {integrity: sha512-S6cATIPVv1z0IlxdN+zUk5EPjkGCdnhN4wVSBlvoUO1tOLJootbo9CquNJmbIh4yikWHiUedhRYrNPn1arpEmQ==} + dev: false + /kind-of@6.0.3: resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} engines: {node: '>=0.10.0'} @@ -4788,6 +4979,10 @@ packages: p-locate: 5.0.0 dev: true + /lodash.clonedeep@4.5.0: + resolution: {integrity: sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==} + dev: false + /lodash.merge@4.6.2: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} dev: true @@ -4798,7 +4993,6 @@ packages: /lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} - dev: true /log-symbols@4.1.0: resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} @@ -4861,7 +5055,6 @@ packages: engines: {node: '>=10'} dependencies: yallist: 4.0.0 - dev: true /lru-queue@0.1.0: resolution: {integrity: sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==} @@ -4953,6 +5146,11 @@ packages: optional: true dev: true + /methods@1.1.2: + resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} + engines: {node: '>= 0.6'} + dev: false + /micromatch@4.0.5: resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} engines: {node: '>=8.6'} @@ -4961,6 +5159,24 @@ packages: picomatch: 2.3.1 dev: true + /mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + dev: false + + /mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + dependencies: + mime-db: 1.52.0 + dev: false + + /mime@2.6.0: + resolution: {integrity: sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==} + engines: {node: '>=4.0.0'} + hasBin: true + dev: false + /mimic-fn@2.1.0: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} engines: {node: '>=6'} @@ -5033,7 +5249,6 @@ packages: /ms@2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} - dev: true /ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} @@ -5057,6 +5272,10 @@ packages: hasBin: true dev: true + /native-promise-only@0.8.1: + resolution: {integrity: sha512-zkVhZUA3y8mbz652WrL5x0fB0ehrBkulWT3TomAQ9iDtyXZvzKeEA6GPxAItBYeNYl5yngKRX612qHOhvMkDeg==} + dev: false + /natural-compare-lite@1.4.0: resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==} dev: true @@ -5136,7 +5355,6 @@ packages: /object-inspect@1.12.3: resolution: {integrity: sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==} - dev: true /object-keys@1.1.1: resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} @@ -5175,7 +5393,6 @@ packages: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} dependencies: wrappy: 1.0.2 - dev: true /onetime@5.1.2: resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} @@ -5348,6 +5565,15 @@ packages: engines: {node: '>=8'} dev: true + /path-loader@1.0.12: + resolution: {integrity: sha512-n7oDG8B+k/p818uweWrOixY9/Dsr89o2TkCm6tOTex3fpdo2+BFDgR+KpB37mGKBRsBAlR8CIJMFN0OEy/7hIQ==} + dependencies: + native-promise-only: 0.8.1 + superagent: 7.1.6 + transitivePeerDependencies: + - supports-color + dev: false + /path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} dev: true @@ -5468,7 +5694,6 @@ packages: /punycode@2.3.0: resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==} engines: {node: '>=6'} - dev: true /pvtsutils@1.3.2: resolution: {integrity: sha512-+Ipe2iNUyrZz+8K/2IOo+kKikdtfhRKzNpQbruF2URmqPtoqAs8g3xS7TJvFF2GcPXjh7DkqMnpVveRFq4PgEQ==} @@ -5481,6 +5706,13 @@ packages: engines: {node: '>=6.0.0'} dev: true + /qs@6.11.2: + resolution: {integrity: sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==} + engines: {node: '>=0.6'} + dependencies: + side-channel: 1.0.4 + dev: false + /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} dev: true @@ -5530,7 +5762,6 @@ packages: inherits: 2.0.4 string_decoder: 1.3.0 util-deprecate: 1.0.2 - dev: true /readdirp@3.6.0: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} @@ -5593,6 +5824,11 @@ packages: engines: {node: '>=0.10.0'} dev: true + /require-from-string@2.0.2: + resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} + engines: {node: '>=0.10.0'} + dev: true + /require-main-filename@2.0.0: resolution: {integrity: sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==} dev: true @@ -5640,7 +5876,7 @@ packages: glob: 7.2.3 dev: true - /rollup-plugin-dts@5.3.0(rollup@3.21.5)(typescript@5.3.3): + /rollup-plugin-dts@5.3.0(rollup@3.21.5)(typescript@5.0.4): resolution: {integrity: sha512-8FXp0ZkyZj1iU5klkIJYLjIq/YZSwBoERu33QBDxm/1yw5UU4txrEtcmMkrq+ZiKu3Q4qvPCNqc3ovX6rjqzbQ==} engines: {node: '>=v14'} peerDependencies: @@ -5649,7 +5885,7 @@ packages: dependencies: magic-string: 0.30.1 rollup: 3.21.5 - typescript: 5.3.3 + typescript: 5.0.4 optionalDependencies: '@babel/code-frame': 7.22.5 dev: true @@ -5707,7 +5943,6 @@ packages: /safe-buffer@5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} - dev: true /safe-regex-test@1.0.0: resolution: {integrity: sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==} @@ -5741,7 +5976,6 @@ packages: hasBin: true dependencies: lru-cache: 6.0.0 - dev: true /sentence-case@3.0.4: resolution: {integrity: sha512-8LS0JInaQMCRoQ7YUytAo/xUu5W2XnQxV2HI/6uM6U7CITS1RqPElr30V6uIqyMKM9lJGRVFy5/4CuzcixNYSg==} @@ -5802,7 +6036,6 @@ packages: call-bind: 1.0.2 get-intrinsic: 1.2.1 object-inspect: 1.12.3 - dev: true /siginfo@2.0.0: resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} @@ -5825,7 +6058,6 @@ packages: /slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} - dev: true /slice-ansi@3.0.0: resolution: {integrity: sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==} @@ -5907,7 +6139,6 @@ packages: /sprintf-js@1.0.3: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} - dev: true /stackback@0.0.2: resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} @@ -5970,7 +6201,6 @@ packages: resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} dependencies: safe-buffer: 5.2.1 - dev: true /strip-ansi@6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} @@ -6002,6 +6232,26 @@ packages: acorn: 8.10.0 dev: true + /superagent@7.1.6: + resolution: {integrity: sha512-gZkVCQR1gy/oUXr+kxJMLDjla434KmSOKbx5iGD30Ql+AkJQ/YlPKECJy2nhqOsHLjGHzoDTXNSjhnvWhzKk7g==} + engines: {node: '>=6.4.0 <13 || >=14'} + deprecated: Please downgrade to v7.1.5 if you need IE/ActiveXObject support OR upgrade to v8.0.0 as we no longer support IE and published an incorrect patch version (see https://github.com/visionmedia/superagent/issues/1731) + dependencies: + component-emitter: 1.3.1 + cookiejar: 2.1.4 + debug: 4.3.4(supports-color@8.1.1) + fast-safe-stringify: 2.1.1 + form-data: 4.0.0 + formidable: 2.1.2 + methods: 1.1.2 + mime: 2.6.0 + qs: 6.11.2 + readable-stream: 3.6.2 + semver: 7.5.4 + transitivePeerDependencies: + - supports-color + dev: false + /supports-color@5.5.0: resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} engines: {node: '>=4'} @@ -6021,7 +6271,6 @@ packages: engines: {node: '>=10'} dependencies: has-flag: 4.0.0 - dev: true /supports-hyperlinks@2.3.0: resolution: {integrity: sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==} @@ -6149,6 +6398,18 @@ packages: engines: {node: '>=8'} dev: true + /ts-invariant@0.3.3: + resolution: {integrity: sha512-UReOKsrJFGC9tUblgSRWo+BsVNbEd77Cl6WiV/XpMlkifXwNIJbknViCucHvVZkXSC/mcWeRnIGdY7uprcwvdQ==} + dependencies: + tslib: 1.14.1 + dev: false + + /ts-invariant@0.4.4: + resolution: {integrity: sha512-uEtWkFM/sdZvRNNDL3Ehu4WVpwaulhwQszV8mrtcdeE8nN00BV9mAmQ88RkrBhFgl9gMgvjJLAQcZbnPXI9mlA==} + dependencies: + tslib: 1.14.1 + dev: false + /ts-log@2.2.5: resolution: {integrity: sha512-PGcnJoTBnVGy6yYNFxWVNkdcAuAMstvutN9MgDJIV6L0oG8fB+ZNNy1T+wJzah8RPGor1mZuPQkVfXNDpy9eHA==} dev: true @@ -6188,7 +6449,6 @@ packages: /tslib@1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} - dev: true /tslib@2.5.3: resolution: {integrity: sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==} @@ -6200,6 +6460,15 @@ packages: /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} + + /tsutils@3.21.0(typescript@5.0.4): + resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} + engines: {node: '>= 6'} + peerDependencies: + typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' + dependencies: + tslib: 1.14.1 + typescript: 5.0.4 dev: true /tsutils@3.21.0(typescript@5.3.3): @@ -6284,10 +6553,10 @@ packages: peerDependencies: typedoc: 0.24.x dependencies: - typedoc: 0.24.7(typescript@5.3.3) + typedoc: 0.24.7(typescript@5.0.4) dev: true - /typedoc@0.24.7(typescript@5.3.3): + /typedoc@0.24.7(typescript@5.0.4): resolution: {integrity: sha512-zzfKDFIZADA+XRIp2rMzLe9xZ6pt12yQOhCr7cD7/PBTjhPmMyMvGrkZ2lPNJitg3Hj1SeiYFNzCsSDrlpxpKw==} engines: {node: '>= 14.14'} hasBin: true @@ -6298,7 +6567,13 @@ packages: marked: 4.3.0 minimatch: 9.0.3 shiki: 0.14.3 - typescript: 5.3.3 + typescript: 5.0.4 + dev: true + + /typescript@5.0.4: + resolution: {integrity: sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==} + engines: {node: '>=12.20'} + hasBin: true dev: true /typescript@5.3.3: @@ -6373,7 +6648,6 @@ packages: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} dependencies: punycode: 2.3.0 - dev: true /urlpattern-polyfill@8.0.2: resolution: {integrity: sha512-Qp95D4TPJl1kC9SKigDcqgyM2VDVO4RiJc2d4qe5GrYm+zbIQCWWKAFaJNQ4BhdFeDGwBmAxqJBwWSJDb9T3BQ==} @@ -6381,7 +6655,6 @@ packages: /util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - dev: true /validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} @@ -6653,7 +6926,6 @@ packages: /wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - dev: true /ws@8.13.0: resolution: {integrity: sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==} @@ -6687,7 +6959,6 @@ packages: /yallist@4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} - dev: true /yaml-ast-parser@0.0.43: resolution: {integrity: sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==} diff --git a/scripts/codegen-webhooks.sh b/scripts/codegen-webhooks.sh index d27fad0..e041597 100644 --- a/scripts/codegen-webhooks.sh +++ b/scripts/codegen-webhooks.sh @@ -2,7 +2,8 @@ #!/bin/bash # Download the JSON schema -curl https://core-api.uk.plain.com/webhooks/schema.json -o ./webhook-schema.json +curl https://core-api.uk.plain.com/webhooks/schema.json -o ./src/webhooks/webhook-schema.json -./node_modules/.bin/json2ts --input webhook-schema.json --output webhook-schema.ts -./node_modules/.bin/ts-to-zod --skipValidation webhook-schema.ts webhook-model.ts +./node_modules/.bin/json2ts --input ./src/webhooks/webhook-schema.json --output ./src/webhooks/webhook-schema.ts + +# ./node_modules/.bin/json-refs resolve ./src/webhooks/webhook-schema.json | ./node_modules/.bin/json-schema-to-zod | ./node_modules/.bin/prettier --parser typescript > ./src/webhooks/webhook-schema.ts \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index e6f2f73..905943e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -31,6 +31,8 @@ import { export { PlainClient } from './client'; +export { parsePlainWebhook } from './webhooks'; + export { uiComponent } from './ui-components'; export { diff --git a/src/tests/webhook-model.test.ts b/src/tests/parse-webhook.test.ts similarity index 53% rename from src/tests/webhook-model.test.ts rename to src/tests/parse-webhook.test.ts index ffdd20e..4b665c4 100644 --- a/src/tests/webhook-model.test.ts +++ b/src/tests/parse-webhook.test.ts @@ -1,24 +1,27 @@ -import { describe, test } from 'vitest'; +import { describe, expect, test } from 'vitest'; -import { webhooksSchemaDefinitionSchema } from '../../webhook-model'; +import { parsePlainWebhook } from '../webhooks/parse'; import customerCreatedPayload from './webhook-payloads/customer-created'; import emailReceivedPayload from './webhook-payloads/email-received'; -import emailSentPayload from './webhook-payloads/email-sent'; +import invalidWebhook from './webhook-payloads/invalid'; import threadAssignmentTransitionedPayload from './webhook-payloads/thread-assignment-transitioned'; import threadCreatedPayload from './webhook-payloads/thread-created'; import threadStatusTransitionedPayload from './webhook-payloads/thread-status-transitioned'; -describe('Webhook model tests', () => { +describe('Parse webhook', () => { [ customerCreatedPayload, emailReceivedPayload, - emailSentPayload, threadAssignmentTransitionedPayload, threadCreatedPayload, threadStatusTransitionedPayload, - ].forEach((payload) => { - test(`should parse the ${payload.type} payload`, () => { - webhooksSchemaDefinitionSchema.parse(payload); + ].forEach((payload: { type: string }) => { + test(`should validate the ${payload?.type} payload successfully`, () => { + expect(parsePlainWebhook(payload).data).toBeTruthy(); }); }); + + test(`should fail to validate an invalid payload`, () => { + expect(parsePlainWebhook(invalidWebhook).error).toBeTruthy(); + }); }); diff --git a/src/tests/webhook-payloads/email-received.ts b/src/tests/webhook-payloads/email-received.ts index 432b83f..8c98d84 100644 --- a/src/tests/webhook-payloads/email-received.ts +++ b/src/tests/webhook-payloads/email-received.ts @@ -1,114 +1,85 @@ export default { - timestamp: '2023-10-19T14:12:25.733Z', + timestamp: '2024-03-06T12:37:10.228Z', workspaceId: 'w_01FXQ6A83FXNN9XA00415VR1XP', payload: { eventType: 'thread.email_received', thread: { - id: 'th_01HD44FHMCDSSWE38N14FSYV6K', + id: 'th_01HR9W9147XGMZWYF9D030XJ9J', customer: { - id: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', + id: 'c_01H0MHCVC5EGDGY3EJXTHHWTGR', email: { - email: 'peter@example.com', - isVerified: false, - verifiedAt: null, + email: 'john@example.com', + isVerified: true, + verifiedAt: '2023-05-17T09:41:55.715Z', }, - externalId: null, - fullName: 'Peter Santos', - shortName: 'Peter', + externalId: 'really_long_external_id_123456789_abcdefgh', + fullName: 'John Smith', + shortName: 'John', markedAsSpamAt: null, markedAsSpamBy: null, customerGroupMemberships: [], - createdAt: '2023-10-19T14:12:25.142Z', - createdBy: { - actorType: 'system', - system: 'email_inbound_handler', - }, - updatedAt: '2023-10-19T14:12:25.142Z', - updatedBy: { - actorType: 'system', - system: 'email_inbound_handler', - }, + createdAt: '2023-05-17T09:41:55.717Z', + createdBy: { actorType: 'system', system: 'email_inbound_handler' }, + updatedAt: '2024-03-06T12:37:09.796Z', + updatedBy: { actorType: 'system', system: 'email_inbound_handler' }, }, - title: 'Unable to tail logs', - previewText: 'Hey, I am currently unable to tail the logs of the service svc-8af1e3', + title: 'Webhook', + previewText: 'test', priority: 2, externalId: null, status: 'TODO', - statusChangedAt: '2023-10-19T14:12:25.266Z', - statusChangedBy: { - actorType: 'system', - system: 'email_inbound_handler', - }, - statusDetail: { - type: 'CREATED', - createdAt: '2023-10-19T14:12:25.266Z', - }, + statusChangedAt: '2024-03-06T12:37:09.732Z', + statusChangedBy: { actorType: 'customer', customerId: 'c_01H0MHCVC5EGDGY3EJXTHHWTGR' }, + statusDetail: { type: 'CREATED', createdAt: '2024-03-06T12:37:09.732Z' }, assignee: null, assignedAt: null, labels: [], - firstInboundMessageInfo: null, + firstInboundMessageInfo: { timestamp: '2024-03-06T12:37:09.732Z', messageSource: 'EMAIL' }, firstOutboundMessageInfo: null, - lastInboundMessageInfo: null, + lastInboundMessageInfo: { timestamp: '2024-03-06T12:37:09.732Z', messageSource: 'EMAIL' }, lastOutboundMessageInfo: null, - supportEmailAddresses: [], - createdAt: '2023-10-19T14:12:25.266Z', - createdBy: { - actorType: 'system', - system: 'email_inbound_handler', - }, - updatedAt: '2023-10-19T14:12:25.266Z', - updatedBy: { - actorType: 'system', - system: 'email_inbound_handler', - }, + supportEmailAddresses: ['help@getresolve.io'], + createdAt: '2024-03-06T12:37:09.732Z', + createdBy: { actorType: 'customer', customerId: 'c_01H0MHCVC5EGDGY3EJXTHHWTGR' }, + updatedAt: '2024-03-06T12:37:09.732Z', + updatedBy: { actorType: 'customer', customerId: 'c_01H0MHCVC5EGDGY3EJXTHHWTGR' }, }, email: { - timelineEntryId: 't_01HD44FHHJ4DJC452ZTAR73PPF', - id: 'em_01HD44FF33QTSGW5JN37BFY6YE', + timelineEntryId: 't_01HR9W90Z4CTRWNFPPKC4K6VK8', + id: 'em_01HR9W8ZSVE4Q8KVBK5CP65SRE', to: { - email: 'help@example.com', + email: 'help@getresolve.io', name: null, - emailActor: { - actorType: 'supportEmailAddress', - supportEmailAddress: 'help@example.com', - }, + emailActor: { actorType: 'supportEmailAddress', supportEmailAddress: 'help@getresolve.io' }, }, from: { - email: 'peter@example.com', - name: 'Peter Santos', - emailActor: { - actorType: 'customer', - customerId: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', - }, + email: 'john@example.com', + name: 'John Smith', + emailActor: { actorType: 'customer', customerId: 'c_01H0MHCVC5EGDGY3EJXTHHWTGR' }, }, + replyTo: null, additionalRecipients: [], hiddenRecipients: [], - subject: 'Unable to tail logs', - textContent: 'Hey, I am currently unable to tail the logs of the service svc-8af1e3', - markdownContent: 'Hey, I am currently unable to tail the logs of the service svc-8af1e3', + subject: 'Webhook', + textContent: 'test', + markdownContent: 'test', authenticity: 'PASS', sentAt: null, - receivedAt: '2023-10-19T14:12:22.757Z', + receivedAt: '2024-03-06T12:37:08.539Z', attachments: [], inReplyToEmailId: null, - createdAt: '2023-10-19T14:12:25.733Z', - createdBy: { - actorType: 'customer', - customerId: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', - }, - updatedAt: '2023-10-19T14:12:25.733Z', - updatedBy: { - actorType: 'customer', - customerId: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', - }, + createdAt: '2024-03-06T12:37:10.228Z', + createdBy: { actorType: 'customer', customerId: 'c_01H0MHCVC5EGDGY3EJXTHHWTGR' }, + updatedAt: '2024-03-06T12:37:10.228Z', + updatedBy: { actorType: 'customer', customerId: 'c_01H0MHCVC5EGDGY3EJXTHHWTGR' }, }, }, - id: 'pEv_01HD44FJ053ZHW13SWS9556THX', + id: 'pEv_01HR9W91EMR655WS6VC2867D3C', webhookMetadata: { - webhookTargetId: 'whTarget_01HD4400VTDJQ646V6RY37SR7K', - webhookDeliveryAttemptId: 'whAttempt_01HD44SZM21CPW0MXEQ73C2X7C', + webhookTargetId: 'whTarget_01HR9VYX2GYKX1XCTFXRG1K3MX', + webhookDeliveryAttemptId: 'whAttempt_01HR9W92RSJZA4011XDNHJ5VK7', webhookDeliveryAttemptNumber: 1, - webhookDeliveryAttemptTimestamp: '2023-10-19T14:18:07.362Z', + webhookDeliveryAttemptTimestamp: '2024-03-06T12:37:11.577Z', }, type: 'thread.email_received', }; diff --git a/src/tests/webhook-payloads/email-sent.ts b/src/tests/webhook-payloads/email-sent.ts deleted file mode 100644 index ccbc494..0000000 --- a/src/tests/webhook-payloads/email-sent.ts +++ /dev/null @@ -1,117 +0,0 @@ -export default { - timestamp: '2023-10-19T21:44:01.325Z', - workspaceId: 'w_01FXQ6A83FXNN9XA00415VR1XP', - payload: { - eventType: 'thread.email_sent', - thread: { - id: 'th_01HD44FHMCDSSWE38N14FSYV6K', - customer: { - id: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', - email: { - email: 'peter@example.com', - isVerified: false, - verifiedAt: null, - }, - externalId: null, - fullName: 'Peter Santos', - shortName: 'Peter', - markedAsSpamAt: null, - markedAsSpamBy: null, - customerGroupMemberships: [], - createdAt: '2023-10-19T14:12:25.142Z', - createdBy: { - actorType: 'system', - system: 'email_inbound_handler', - }, - updatedAt: '2023-10-19T21:26:06.658Z', - updatedBy: { - actorType: 'user', - userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - }, - }, - title: 'Unable to tail logs', - previewText: 'Hey, I am currently unable to tail the logs of the service svc-8af1e3', - priority: 1, - externalId: null, - status: 'DONE', - statusChangedAt: '2023-10-19T21:24:36.108Z', - statusChangedBy: { - actorType: 'user', - userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - }, - statusDetail: null, - assignee: null, - assignedAt: null, - labels: [], - firstInboundMessageInfo: { - timestamp: '2023-10-19T14:12:25.733Z', - messageSource: 'EMAIL', - }, - firstOutboundMessageInfo: null, - lastInboundMessageInfo: { - timestamp: '2023-10-19T14:12:25.733Z', - messageSource: 'EMAIL', - }, - lastOutboundMessageInfo: null, - supportEmailAddresses: ['help@example.com'], - createdAt: '2023-10-19T14:12:25.266Z', - createdBy: { - actorType: 'system', - system: 'email_inbound_handler', - }, - updatedAt: '2023-10-19T21:38:54.335Z', - updatedBy: { - actorType: 'user', - userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - }, - }, - email: { - timelineEntryId: 't_01HD4YABRC74XY3D4SKAWKHXMH', - id: 'em_01HD4YABKW46E4Y8384T6ARDA5', - to: { - email: 'peter@example.com', - name: 'Peter Santos', - emailActor: { - actorType: 'customer', - customerId: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', - }, - }, - from: { - email: 'help@example.com', - name: 'Sam at Resolve', - emailActor: { - actorType: 'supportEmailAddress', - supportEmailAddress: 'help@example.com', - }, - }, - additionalRecipients: [], - hiddenRecipients: [], - subject: 'Re: Test', - textContent: 'Hey', - markdownContent: 'Hey', - authenticity: 'PASS', - sentAt: '2023-10-19T21:44:00.865Z', - receivedAt: null, - attachments: [], - inReplyToEmailId: 'em_01HD44FF33QTSGW5JN37BFY6YE', - createdAt: '2023-10-19T21:43:58.967Z', - createdBy: { - actorType: 'user', - userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - }, - updatedAt: '2023-10-19T21:44:01.201Z', - updatedBy: { - actorType: 'system', - system: 'email_sender', - }, - }, - }, - id: 'pEv_01HD4YAEHDHS2FW3F3VRSEGGVF', - webhookMetadata: { - webhookTargetId: 'whTarget_01HD4400VTDJQ646V6RY37SR7K', - webhookDeliveryAttemptId: 'whAttempt_01HD4YAFB6VN6AJ4TGVY4DJ0VR', - webhookDeliveryAttemptNumber: 1, - webhookDeliveryAttemptTimestamp: '2023-10-19T21:44:02.150Z', - }, - type: 'thread.email_sent', -}; diff --git a/src/tests/webhook-payloads/invalid.ts b/src/tests/webhook-payloads/invalid.ts new file mode 100644 index 0000000..65919cb --- /dev/null +++ b/src/tests/webhook-payloads/invalid.ts @@ -0,0 +1,56 @@ +export default { + timestamp: '2024-03-06T12:33:25.295Z', + workspaceId: 'w_01FXQ6A83FXNN9XA00415VR1XP', + payload: { + eventType: 'thread.thread_status_transitioned', + user: { + id: 'th_01HR9VZR2VZT8GJAEY61VSJB0V', + customer: { + id: 'c_01HGX4W7D6ACNX5HAC5AYAZK94', + email: { + email: 'help@example.com', + isVerified: true, + verifiedAt: '2024-03-06T12:32:05.482Z', + }, + externalId: null, + fullName: 'John Smith', + shortName: 'John', + markedAsSpamAt: null, + markedAsSpamBy: null, + customerGroupMemberships: [], + createdAt: '2023-12-05T14:07:27.142Z', + createdBy: { actorType: 'system', system: 'email_inbound_handler' }, + updatedAt: '2024-03-06T12:32:05.481Z', + updatedBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, + }, + title: 'Support request', + previewText: 'This thread was created manually - this is not visible to the customer.', + priority: 2, + externalId: null, + status: 'DONE', + statusChangedAt: '2024-03-06T12:33:25.295Z', + statusChangedBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, + statusDetail: null, + assignee: null, + assignedAt: null, + labels: [], + firstInboundMessageInfo: { timestamp: '2024-03-06T12:32:05.710Z', messageSource: 'API' }, + firstOutboundMessageInfo: null, + lastInboundMessageInfo: { timestamp: '2024-03-06T12:32:05.723Z', messageSource: 'API' }, + lastOutboundMessageInfo: null, + supportEmailAddresses: [], + createdAt: '2024-03-06T12:32:05.723Z', + createdBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, + updatedAt: '2024-03-06T12:33:25.295Z', + updatedBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, + }, + }, + id: 'pEv_01HR9W25SFVMS2Y4Q8W75M86G4', + webhookMetadata: { + webhookTargetId: 'whTarget_01HR9VYX2GYKX1XCTFXRG1K3MX', + webhookDeliveryAttemptId: 'whAttempt_01HR9W26906XCJ64JQZG8RJCCQ', + webhookDeliveryAttemptNumber: 1, + webhookDeliveryAttemptTimestamp: '2024-03-06T12:33:25.792Z', + }, + type: 'thread.thread_status_transitioned', +}; diff --git a/src/tests/webhook-payloads/thread-assignment-transitioned.ts b/src/tests/webhook-payloads/thread-assignment-transitioned.ts index f47f1a1..58aa2c6 100644 --- a/src/tests/webhook-payloads/thread-assignment-transitioned.ts +++ b/src/tests/webhook-payloads/thread-assignment-transitioned.ts @@ -1,166 +1,110 @@ export default { - timestamp: '2023-10-19T21:24:51.660Z', - workspaceId: 'w_01GST0W989ZNAW53X6XYHAY87P', + timestamp: '2024-03-06T12:34:44.535Z', + workspaceId: 'w_01FXQ6A83FXNN9XA00415VR1XP', payload: { eventType: 'thread.thread_assignment_transitioned', previousThread: { - id: 'th_01HD44FHMCDSSWE38N14FSYV6K', + id: 'th_01HR9VZR2VZT8GJAEY61VSJB0V', customer: { - id: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', + id: 'c_01HGX4W7D6ACNX5HAC5AYAZK94', email: { - email: 'peter@example.com', - isVerified: false, - verifiedAt: null, + email: 'help@example.com', + isVerified: true, + verifiedAt: '2024-03-06T12:32:05.482Z', }, externalId: null, - fullName: 'Peter Santos', - shortName: 'Peter', - assignedAt: null, - assignedToUser: null, - status: 'IDLE', - statusChangedAt: '2023-10-19T21:24:36.109Z', + fullName: 'John Smith', + shortName: 'John', markedAsSpamAt: null, markedAsSpamBy: null, customerGroupMemberships: [], - createdAt: '2023-10-19T14:12:25.142Z', - createdBy: { - actorType: 'system', - system: 'email_inbound_handler', - }, - updatedAt: '2023-10-19T21:24:51.734Z', - updatedBy: { - actorType: 'user', - userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - }, + createdAt: '2023-12-05T14:07:27.142Z', + createdBy: { actorType: 'system', system: 'email_inbound_handler' }, + updatedAt: '2024-03-06T12:32:05.481Z', + updatedBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, }, - title: 'Unable to tail logs', - previewText: 'Hey, I am currently unable to tail the logs of the service svc-8af1e3', - priority: 1, + title: 'Support request', + previewText: 'This thread was created manually - this is not visible to the customer.', + priority: 2, externalId: null, status: 'DONE', - statusChangedAt: '2023-10-19T21:24:36.108Z', - statusChangedBy: { - actorType: 'user', - userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - }, + statusChangedAt: '2024-03-06T12:33:25.295Z', + statusChangedBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, statusDetail: null, assignee: null, assignedAt: null, labels: [], - firstInboundMessageInfo: { - timestamp: '2023-10-19T14:12:25.733Z', - messageSource: 'EMAIL', - }, + firstInboundMessageInfo: { timestamp: '2024-03-06T12:32:05.710Z', messageSource: 'API' }, firstOutboundMessageInfo: null, - lastInboundMessageInfo: { - timestamp: '2023-10-19T14:12:25.733Z', - messageSource: 'EMAIL', - }, + lastInboundMessageInfo: { timestamp: '2024-03-06T12:32:05.723Z', messageSource: 'API' }, lastOutboundMessageInfo: null, - supportEmailAddresses: ['help@example.com'], - createdAt: '2023-10-19T14:12:25.266Z', - createdBy: { - actorType: 'system', - system: 'email_inbound_handler', - }, - updatedAt: '2023-10-19T21:24:36.108Z', - updatedBy: { - actorType: 'user', - userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - }, + supportEmailAddresses: [], + createdAt: '2024-03-06T12:32:05.723Z', + createdBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, + updatedAt: '2024-03-06T12:33:25.295Z', + updatedBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, }, thread: { - id: 'th_01HD44FHMCDSSWE38N14FSYV6K', + id: 'th_01HR9VZR2VZT8GJAEY61VSJB0V', customer: { - id: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', + id: 'c_01HGX4W7D6ACNX5HAC5AYAZK94', email: { - email: 'peter@example.com', - isVerified: false, - verifiedAt: null, + email: 'help@example.com', + isVerified: true, + verifiedAt: '2024-03-06T12:32:05.482Z', }, externalId: null, - fullName: 'Peter Santos', - shortName: 'Peter', - assignedAt: null, - assignedToUser: null, - status: 'IDLE', - statusChangedAt: '2023-10-19T21:24:36.109Z', + fullName: 'John Smith', + shortName: 'John', markedAsSpamAt: null, markedAsSpamBy: null, customerGroupMemberships: [], - createdAt: '2023-10-19T14:12:25.142Z', - createdBy: { - actorType: 'system', - system: 'email_inbound_handler', - }, - updatedAt: '2023-10-19T21:24:51.734Z', - updatedBy: { - actorType: 'user', - userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - }, + createdAt: '2023-12-05T14:07:27.142Z', + createdBy: { actorType: 'system', system: 'email_inbound_handler' }, + updatedAt: '2024-03-06T12:32:05.481Z', + updatedBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, }, - title: 'Unable to tail logs', - previewText: 'Hey, I am currently unable to tail the logs of the service svc-8af1e3', - priority: 1, + title: 'Support request', + previewText: 'This thread was created manually - this is not visible to the customer.', + priority: 2, externalId: null, status: 'DONE', - statusChangedAt: '2023-10-19T21:24:36.108Z', - statusChangedBy: { - actorType: 'user', - userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - }, + statusChangedAt: '2024-03-06T12:33:25.295Z', + statusChangedBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, statusDetail: null, assignee: { - id: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - email: 'sam@example.com', - fullName: 'Sam', - publicName: 'Sam', + id: 'u_01GTVBT93M80K917N2FGAK3FD5', + email: 'jane@plain.com', + fullName: 'Jane Doe', + publicName: 'Jane', status: 'OFFLINE', - statusChangedAt: '2023-06-01T09:29:48.903Z', - createdAt: '2023-06-01T09:29:48.903Z', - createdBy: { - actorType: 'user', - userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - }, - updatedAt: '2023-06-01T09:29:48.903Z', - updatedBy: { - actorType: 'user', - userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - }, + statusChangedAt: '2023-03-06T11:44:56.257Z', + createdAt: '2023-03-06T11:44:56.257Z', + createdBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, + updatedAt: '2023-03-06T11:44:56.257Z', + updatedBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, deletedAt: null, deletedBy: null, }, - assignedAt: '2023-10-19T21:24:51.660Z', + assignedAt: '2024-03-06T12:34:44.535Z', labels: [], - firstInboundMessageInfo: { - timestamp: '2023-10-19T14:12:25.733Z', - messageSource: 'EMAIL', - }, + firstInboundMessageInfo: { timestamp: '2024-03-06T12:32:05.710Z', messageSource: 'API' }, firstOutboundMessageInfo: null, - lastInboundMessageInfo: { - timestamp: '2023-10-19T14:12:25.733Z', - messageSource: 'EMAIL', - }, + lastInboundMessageInfo: { timestamp: '2024-03-06T12:32:05.723Z', messageSource: 'API' }, lastOutboundMessageInfo: null, - supportEmailAddresses: ['help@example.com'], - createdAt: '2023-10-19T14:12:25.266Z', - createdBy: { - actorType: 'system', - system: 'email_inbound_handler', - }, - updatedAt: '2023-10-19T21:24:51.660Z', - updatedBy: { - actorType: 'user', - userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - }, + supportEmailAddresses: [], + createdAt: '2024-03-06T12:32:05.723Z', + createdBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, + updatedAt: '2024-03-06T12:34:44.535Z', + updatedBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, }, }, - id: 'pEv_01HD4X7BTCJSP3NGTBKYSWGPSY', + id: 'pEv_01HR9W4K5QEVAFQSYCKN2D8198', webhookMetadata: { - webhookTargetId: 'whTarget_01HD4400VTDJQ646V6RY37SR7K', - webhookDeliveryAttemptId: 'whAttempt_01HD4XHSAX79QW8E34V86CKJRK', - webhookDeliveryAttemptNumber: 4, - webhookDeliveryAttemptTimestamp: '2023-10-19T21:30:33.181Z', + webhookTargetId: 'whTarget_01HR9VYX2GYKX1XCTFXRG1K3MX', + webhookDeliveryAttemptId: 'whAttempt_01HR9W4KV3RHX435FPZJ46P5WY', + webhookDeliveryAttemptNumber: 1, + webhookDeliveryAttemptTimestamp: '2024-03-06T12:34:45.219Z', }, type: 'thread.thread_assignment_transitioned', }; diff --git a/src/tests/webhook-payloads/thread-status-transitioned.ts b/src/tests/webhook-payloads/thread-status-transitioned.ts index 9d3124a..08a245e 100644 --- a/src/tests/webhook-payloads/thread-status-transitioned.ts +++ b/src/tests/webhook-payloads/thread-status-transitioned.ts @@ -1,147 +1,97 @@ export default { - timestamp: '2023-10-19T21:24:36.108Z', - workspaceId: 'w_01GST0W989ZNAW53X6XYHAY87P', + timestamp: '2024-03-06T12:33:25.295Z', + workspaceId: 'w_01FXQ6A83FXNN9XA00415VR1XP', payload: { eventType: 'thread.thread_status_transitioned', previousThread: { - id: 'th_01HD44FHMCDSSWE38N14FSYV6K', + id: 'th_01HR9VZR2VZT8GJAEY61VSJB0V', customer: { - id: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', + id: 'c_01HGX4W7D6ACNX5HAC5AYAZK94', email: { - email: 'peter@example.com', - isVerified: false, - verifiedAt: null, + email: 'help@example.com', + isVerified: true, + verifiedAt: '2024-03-06T12:32:05.482Z', }, externalId: null, - fullName: 'Peter Santos', - shortName: 'Peter', - assignedAt: null, - assignedToUser: null, - status: 'ACTIVE', - statusChangedAt: '2023-10-19T21:18:12.863Z', + fullName: 'John Smith', + shortName: 'John', markedAsSpamAt: null, markedAsSpamBy: null, customerGroupMemberships: [], - createdAt: '2023-10-19T14:12:25.142Z', - createdBy: { - actorType: 'system', - system: 'email_inbound_handler', - }, - updatedAt: '2023-10-19T21:18:12.863Z', - updatedBy: { - actorType: 'user', - userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - }, + createdAt: '2023-12-05T14:07:27.142Z', + createdBy: { actorType: 'system', system: 'email_inbound_handler' }, + updatedAt: '2024-03-06T12:32:05.481Z', + updatedBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, }, - title: 'Unable to tail logs', - previewText: 'Hey, I am currently unable to tail the logs of the service svc-8af1e3', - priority: 1, + title: 'Support request', + previewText: 'This thread was created manually - this is not visible to the customer.', + priority: 2, externalId: null, status: 'TODO', - statusChangedAt: '2023-10-19T21:18:12.862Z', - statusChangedBy: { - actorType: 'user', - userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - }, - statusDetail: null, + statusChangedAt: '2024-03-06T12:32:05.723Z', + statusChangedBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, + statusDetail: { type: 'CREATED', createdAt: '2024-03-06T12:32:05.723Z' }, assignee: null, assignedAt: null, labels: [], - firstInboundMessageInfo: { - timestamp: '2023-10-19T14:12:25.733Z', - messageSource: 'EMAIL', - }, + firstInboundMessageInfo: { timestamp: '2024-03-06T12:32:05.710Z', messageSource: 'API' }, firstOutboundMessageInfo: null, - lastInboundMessageInfo: { - timestamp: '2023-10-19T14:12:25.733Z', - messageSource: 'EMAIL', - }, + lastInboundMessageInfo: { timestamp: '2024-03-06T12:32:05.723Z', messageSource: 'API' }, lastOutboundMessageInfo: null, - supportEmailAddresses: ['help@example.com'], - createdAt: '2023-10-19T14:12:25.266Z', - createdBy: { - actorType: 'system', - system: 'email_inbound_handler', - }, - updatedAt: '2023-10-19T21:20:07.612Z', - updatedBy: { - actorType: 'user', - userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - }, + supportEmailAddresses: [], + createdAt: '2024-03-06T12:32:05.723Z', + createdBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, + updatedAt: '2024-03-06T12:32:06.124Z', + updatedBy: { actorType: 'system', system: 'thread_status_state_machine' }, }, thread: { - id: 'th_01HD44FHMCDSSWE38N14FSYV6K', + id: 'th_01HR9VZR2VZT8GJAEY61VSJB0V', customer: { - id: 'c_01HD44FHDPG82VQ4QNHDR4N2T0', + id: 'c_01HGX4W7D6ACNX5HAC5AYAZK94', email: { - email: 'peter@example.com', - isVerified: false, - verifiedAt: null, + email: 'help@example.com', + isVerified: true, + verifiedAt: '2024-03-06T12:32:05.482Z', }, externalId: null, - fullName: 'Peter Santos', - shortName: 'Peter', - assignedAt: null, - assignedToUser: null, - status: 'ACTIVE', - statusChangedAt: '2023-10-19T21:18:12.863Z', + fullName: 'John Smith', + shortName: 'John', markedAsSpamAt: null, markedAsSpamBy: null, customerGroupMemberships: [], - createdAt: '2023-10-19T14:12:25.142Z', - createdBy: { - actorType: 'system', - system: 'email_inbound_handler', - }, - updatedAt: '2023-10-19T21:18:12.863Z', - updatedBy: { - actorType: 'user', - userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - }, + createdAt: '2023-12-05T14:07:27.142Z', + createdBy: { actorType: 'system', system: 'email_inbound_handler' }, + updatedAt: '2024-03-06T12:32:05.481Z', + updatedBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, }, - title: 'Unable to tail logs', - previewText: 'Hey, I am currently unable to tail the logs of the service svc-8af1e3', - priority: 1, + title: 'Support request', + previewText: 'This thread was created manually - this is not visible to the customer.', + priority: 2, externalId: null, status: 'DONE', - statusChangedAt: '2023-10-19T21:24:36.108Z', - statusChangedBy: { - actorType: 'user', - userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - }, + statusChangedAt: '2024-03-06T12:33:25.295Z', + statusChangedBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, statusDetail: null, assignee: null, assignedAt: null, labels: [], - firstInboundMessageInfo: { - timestamp: '2023-10-19T14:12:25.733Z', - messageSource: 'EMAIL', - }, + firstInboundMessageInfo: { timestamp: '2024-03-06T12:32:05.710Z', messageSource: 'API' }, firstOutboundMessageInfo: null, - lastInboundMessageInfo: { - timestamp: '2023-10-19T14:12:25.733Z', - messageSource: 'EMAIL', - }, + lastInboundMessageInfo: { timestamp: '2024-03-06T12:32:05.723Z', messageSource: 'API' }, lastOutboundMessageInfo: null, - supportEmailAddresses: ['help@example.com'], - createdAt: '2023-10-19T14:12:25.266Z', - createdBy: { - actorType: 'system', - system: 'email_inbound_handler', - }, - updatedAt: '2023-10-19T21:24:36.108Z', - updatedBy: { - actorType: 'user', - userId: 'u_01H1V4NA10RMHWFBXB6A1ZBYRA', - }, + supportEmailAddresses: [], + createdAt: '2024-03-06T12:32:05.723Z', + createdBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, + updatedAt: '2024-03-06T12:33:25.295Z', + updatedBy: { actorType: 'user', userId: 'u_01GTVBT93M80K917N2FGAK3FD5' }, }, }, - id: 'pEv_01HD4X6WMCJSD8EHWDRHZ8WYDT', + id: 'pEv_01HR9W25SFVMS2Y4Q8W75M86G4', webhookMetadata: { - webhookTargetId: 'whTarget_01HD4400VTDJQ646V6RY37SR7K', - webhookDeliveryAttemptId: 'whAttempt_01HD4XH9YE8CK6KT3G8VRX38R7', + webhookTargetId: 'whTarget_01HR9VYX2GYKX1XCTFXRG1K3MX', + webhookDeliveryAttemptId: 'whAttempt_01HR9W26906XCJ64JQZG8RJCCQ', webhookDeliveryAttemptNumber: 1, - webhookDeliveryAttemptTimestamp: '2023-10-19T21:30:17.422Z', + webhookDeliveryAttemptTimestamp: '2024-03-06T12:33:25.792Z', }, type: 'thread.thread_status_transitioned', }; diff --git a/src/webhooks/index.ts b/src/webhooks/index.ts new file mode 100644 index 0000000..cd953e5 --- /dev/null +++ b/src/webhooks/index.ts @@ -0,0 +1 @@ +export { parsePlainWebhook } from './parse'; diff --git a/src/webhooks/parse.ts b/src/webhooks/parse.ts new file mode 100644 index 0000000..dda881a --- /dev/null +++ b/src/webhooks/parse.ts @@ -0,0 +1,33 @@ +import Ajv from 'ajv'; +import addFormats from 'ajv-formats'; + +import type { Result } from '../result'; +import type { WebhooksSchemaDefinition } from './webhook-schema'; +import webhookSchema from './webhook-schema.json'; + +export function parsePlainWebhook(payload: unknown): Result { + const ajv = new Ajv({ + unicodeRegExp: false, + }); + addFormats(ajv); + + try { + if (ajv.validate(webhookSchema, payload)) { + return { + data: payload, + }; + } + } catch (e) { + console.log(e); + return { + error: + e instanceof Error + ? e + : new Error('An unknown error occurred while parsing the Plain webhook payload'), + }; + } + + return { + error: new Error('Plain webhook payload failed to parse: ' + ajv.errorsText()), + }; +} diff --git a/src/webhooks/webhook-schema.json b/src/webhooks/webhook-schema.json new file mode 100644 index 0000000..19bfc16 --- /dev/null +++ b/src/webhooks/webhook-schema.json @@ -0,0 +1,2736 @@ +{ + "title": "Webhooks schema definition", + "type": "object", + "properties": { + "timestamp": { + "$ref": "#/definitions/threadMessageInfo/properties/timestamp" + }, + "workspaceId": { + "$ref": "#/definitions/id" + }, + "payload": { + "anyOf": [ + { + "$ref": "#/definitions/customerChangedPayload" + }, + { + "$ref": "#/definitions/customerGroupMembershipsChangedPayload" + }, + { + "$ref": "#/definitions/timelineEntryChangedPayload" + }, + { + "$ref": "#/definitions/customerGroupChangedPayload" + }, + { + "$ref": "#/definitions/threadCreatedPublicEventPayload" + }, + { + "$ref": "#/definitions/threadStatusTransitionedPublicEventPayload" + }, + { + "$ref": "#/definitions/threadAssignmentTransitionedPublicEventPayload" + }, + { + "$ref": "#/definitions/threadEmailReceivedPublicEventPayload" + }, + { + "$ref": "#/definitions/threadEmailSentPublicEventPayload" + }, + { + "$ref": "#/definitions/threadLabelsChangedPublicEventPayload" + }, + { + "$ref": "#/definitions/threadPriorityChangedPublicEventPayload" + }, + { + "$ref": "#/definitions/threadChatSentPublicEventPayload" + }, + { + "$ref": "#/definitions/customerCreatedPublicEventPayload" + }, + { + "$ref": "#/definitions/customerUpdatedPublicEventPayload" + }, + { + "$ref": "#/definitions/customerDeletedPublicEventPayload" + } + ] + }, + "id": { + "$ref": "#/definitions/id" + }, + "type": { + "type": "string", + "enum": [ + "thread.thread_created", + "thread.thread_status_transitioned", + "thread.thread_assignment_transitioned", + "thread.email_received", + "thread.email_sent", + "thread.chat_sent", + "thread.note_created", + "thread.thread_labels_changed", + "thread.thread_priority_changed", + "customer.customer_created", + "customer.customer_updated", + "customer.customer_deleted", + "customer.customer_changed", + "customer.customer_group_changed", + "customer.customer_group_memberships_changed", + "timeline.timeline_entry_changed" + ] + }, + "webhookMetadata": { + "type": "object", + "properties": { + "webhookTargetId": { + "$ref": "#/definitions/id" + }, + "webhookDeliveryAttemptId": { + "$ref": "#/definitions/id" + }, + "webhookDeliveryAttemptNumber": { + "type": "integer", + "exclusiveMinimum": 0 + }, + "webhookDeliveryAttemptTimestamp": { + "$ref": "#/definitions/datetime" + } + }, + "required": [ + "webhookTargetId", + "webhookDeliveryAttemptId", + "webhookDeliveryAttemptNumber", + "webhookDeliveryAttemptTimestamp" + ], + "additionalProperties": false + } + }, + "required": [ + "timestamp", + "workspaceId", + "payload", + "id", + "type", + "webhookMetadata" + ], + "additionalProperties": false, + "description": "Webhook request", + "definitions": { + "id": { + "type": "string", + "minLength": 1, + "pattern": "^[a-zA-Z]+_[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$", + "maxLength": 50 + }, + "emailAddress": { + "type": "string", + "pattern": "^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|([^-]([a-zA-Z0-9-]*\\.)+[a-zA-Z]{2,}))$" + }, + "datetime": { + "type": "string", + "format": "date-time" + }, + "userActor": { + "type": "object", + "properties": { + "actorType": { + "type": "string", + "const": "user" + }, + "userId": { + "$ref": "#/definitions/id" + } + }, + "required": [ + "actorType", + "userId" + ], + "additionalProperties": false + }, + "customerActor": { + "type": "object", + "properties": { + "actorType": { + "type": "string", + "const": "customer" + }, + "customerId": { + "$ref": "#/definitions/id" + } + }, + "required": [ + "actorType", + "customerId" + ], + "additionalProperties": false + }, + "systemActor": { + "type": "object", + "properties": { + "actorType": { + "type": "string", + "const": "system" + }, + "system": { + "type": "string" + } + }, + "required": [ + "actorType", + "system" + ], + "additionalProperties": false + }, + "machineUserActor": { + "type": "object", + "properties": { + "actorType": { + "type": "string", + "const": "machineUser" + }, + "machineUserId": { + "$ref": "#/definitions/id" + } + }, + "required": [ + "actorType", + "machineUserId" + ], + "additionalProperties": false + }, + "actor": { + "anyOf": [ + { + "$ref": "#/definitions/userActor" + }, + { + "$ref": "#/definitions/machineUserActor" + }, + { + "$ref": "#/definitions/systemActor" + }, + { + "$ref": "#/definitions/customerActor" + } + ] + }, + "internalActor": { + "anyOf": [ + { + "$ref": "#/definitions/userActor" + }, + { + "$ref": "#/definitions/machineUserActor" + }, + { + "$ref": "#/definitions/systemActor" + } + ] + }, + "user": { + "type": "object", + "properties": { + "id": { + "$ref": "#/definitions/id" + }, + "email": { + "$ref": "#/definitions/emailAddress" + }, + "fullName": { + "type": "string" + }, + "publicName": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "ONLINE", + "OFFLINE", + "BREAK" + ] + }, + "statusChangedAt": { + "$ref": "#/definitions/datetime" + }, + "createdAt": { + "$ref": "#/definitions/datetime" + }, + "createdBy": { + "$ref": "#/definitions/internalActor" + }, + "updatedAt": { + "$ref": "#/definitions/datetime" + }, + "updatedBy": { + "$ref": "#/definitions/internalActor" + }, + "deletedAt": { + "anyOf": [ + { + "$ref": "#/definitions/datetime" + }, + { + "type": "null" + } + ] + }, + "deletedBy": { + "anyOf": [ + { + "$ref": "#/definitions/internalActor" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "id", + "email", + "fullName", + "publicName", + "status", + "statusChangedAt", + "createdAt", + "createdBy", + "updatedAt", + "updatedBy", + "deletedAt", + "deletedBy" + ], + "additionalProperties": false + }, + "machineUser": { + "type": "object", + "properties": { + "id": { + "$ref": "#/definitions/id" + }, + "fullName": { + "type": "string" + }, + "publicName": { + "type": "string" + }, + "description": { + "type": [ + "string", + "null" + ] + }, + "createdAt": { + "$ref": "#/definitions/datetime" + }, + "createdBy": { + "$ref": "#/definitions/internalActor" + }, + "updatedAt": { + "$ref": "#/definitions/datetime" + }, + "updatedBy": { + "$ref": "#/definitions/internalActor" + }, + "deletedAt": { + "$ref": "#/definitions/user/properties/deletedAt" + }, + "deletedBy": { + "$ref": "#/definitions/user/properties/deletedBy" + } + }, + "required": [ + "id", + "fullName", + "publicName", + "description", + "createdAt", + "createdBy", + "updatedAt", + "updatedBy", + "deletedAt", + "deletedBy" + ], + "additionalProperties": false + }, + "customer": { + "type": "object", + "properties": { + "id": { + "$ref": "#/definitions/id" + }, + "email": { + "type": "object", + "properties": { + "email": { + "$ref": "#/definitions/emailAddress" + }, + "isVerified": { + "type": "boolean" + }, + "verifiedAt": { + "anyOf": [ + { + "$ref": "#/definitions/datetime" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "email", + "isVerified", + "verifiedAt" + ], + "additionalProperties": false + }, + "externalId": { + "type": [ + "string", + "null" + ] + }, + "fullName": { + "type": "string" + }, + "shortName": { + "type": [ + "string", + "null" + ] + }, + "assignedAt": { + "anyOf": [ + { + "$ref": "#/definitions/datetime" + }, + { + "type": "null" + } + ] + }, + "assignedToUser": { + "anyOf": [ + { + "$ref": "#/definitions/user" + }, + { + "type": "null" + } + ] + }, + "markedAsSpamAt": { + "anyOf": [ + { + "$ref": "#/definitions/datetime" + }, + { + "type": "null" + } + ], + "default": null + }, + "markedAsSpamBy": { + "anyOf": [ + { + "$ref": "#/definitions/internalActor" + }, + { + "type": "null" + } + ], + "default": null + }, + "customerGroupMemberships": { + "type": "array", + "items": { + "$ref": "#/definitions/customerGroupMembership" + } + }, + "createdAt": { + "$ref": "#/definitions/datetime" + }, + "createdBy": { + "$ref": "#/definitions/actor" + }, + "updatedAt": { + "$ref": "#/definitions/datetime" + }, + "updatedBy": { + "$ref": "#/definitions/actor" + } + }, + "required": [ + "id", + "email", + "externalId", + "fullName", + "shortName", + "assignedAt", + "assignedToUser", + "customerGroupMemberships", + "createdAt", + "createdBy", + "updatedAt", + "updatedBy" + ], + "additionalProperties": false + }, + "customerGroup": { + "type": "object", + "properties": { + "id": { + "$ref": "#/definitions/id" + }, + "workspaceId": { + "$ref": "#/definitions/id" + }, + "name": { + "type": "string", + "minLength": 1, + "maxLength": 500 + }, + "key": { + "type": "string", + "minLength": 1, + "maxLength": 50 + }, + "color": { + "type": "string", + "pattern": "^#([a-f0-9]{3,4}|[a-f0-9]{4}(?:[a-f0-9]{2}){1,2})\\b$" + }, + "createdAt": { + "$ref": "#/definitions/datetime" + }, + "createdBy": { + "$ref": "#/definitions/internalActor" + }, + "updatedAt": { + "$ref": "#/definitions/datetime" + }, + "updatedBy": { + "$ref": "#/definitions/internalActor" + } + }, + "required": [ + "id", + "workspaceId", + "name", + "key", + "color", + "createdAt", + "createdBy", + "updatedAt", + "updatedBy" + ], + "additionalProperties": false + }, + "customerGroupMembership": { + "type": "object", + "properties": { + "customerId": { + "$ref": "#/definitions/id" + }, + "customerGroupId": { + "$ref": "#/definitions/id" + }, + "workspaceId": { + "$ref": "#/definitions/id" + }, + "createdAt": { + "$ref": "#/definitions/datetime" + }, + "createdBy": { + "$ref": "#/definitions/internalActor" + }, + "updatedAt": { + "$ref": "#/definitions/datetime" + }, + "updatedBy": { + "$ref": "#/definitions/internalActor" + }, + "customerGroup": { + "$ref": "#/definitions/customerGroup" + } + }, + "required": [ + "customerId", + "customerGroupId", + "workspaceId", + "createdAt", + "createdBy", + "updatedAt", + "updatedBy", + "customerGroup" + ], + "additionalProperties": false + }, + "attachment": { + "type": "object", + "properties": { + "id": { + "$ref": "#/definitions/id" + }, + "fileName": { + "type": "string", + "minLength": 1 + }, + "fileSizeBytes": { + "type": "integer", + "minimum": 0 + }, + "fileMimeType": { + "type": "string", + "minLength": 1 + }, + "fileExtension": { + "type": [ + "string", + "null" + ] + }, + "createdAt": { + "$ref": "#/definitions/datetime" + }, + "createdBy": { + "$ref": "#/definitions/actor" + }, + "updatedAt": { + "$ref": "#/definitions/datetime" + }, + "updatedBy": { + "$ref": "#/definitions/actor" + } + }, + "required": [ + "id", + "fileName", + "fileSizeBytes", + "fileMimeType", + "fileExtension", + "createdAt", + "createdBy", + "updatedAt", + "updatedBy" + ], + "additionalProperties": false + }, + "emailActor": { + "anyOf": [ + { + "$ref": "#/definitions/userActor" + }, + { + "$ref": "#/definitions/customerActor" + }, + { + "type": "object", + "properties": { + "actorType": { + "type": "string", + "const": "supportEmailAddress" + }, + "supportEmailAddress": { + "type": "string" + } + }, + "required": [ + "actorType", + "supportEmailAddress" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "actorType": { + "type": "string", + "const": "deletedCustomer" + }, + "customerId": { + "$ref": "#/definitions/id" + } + }, + "required": [ + "actorType", + "customerId" + ], + "additionalProperties": false + } + ] + }, + "email": { + "type": "object", + "properties": { + "timelineEntryId": { + "$ref": "#/definitions/id" + }, + "id": { + "$ref": "#/definitions/id" + }, + "to": { + "$ref": "#/definitions/emailParticipant" + }, + "from": { + "$ref": "#/definitions/emailParticipant" + }, + "replyTo": { + "type": [ + "string", + "null" + ] + }, + "additionalRecipients": { + "type": "array", + "items": { + "$ref": "#/definitions/emailParticipant" + } + }, + "hiddenRecipients": { + "type": "array", + "items": { + "$ref": "#/definitions/emailParticipant" + } + }, + "subject": { + "type": [ + "string", + "null" + ] + }, + "textContent": { + "type": [ + "string", + "null" + ] + }, + "markdownContent": { + "type": [ + "string", + "null" + ] + }, + "authenticity": { + "type": "string", + "enum": [ + "PASS", + "FAIL", + "UNKNOWN" + ] + }, + "sentAt": { + "anyOf": [ + { + "$ref": "#/definitions/datetime" + }, + { + "type": "null" + } + ] + }, + "receivedAt": { + "anyOf": [ + { + "$ref": "#/definitions/datetime" + }, + { + "type": "null" + } + ] + }, + "attachments": { + "type": "array", + "items": { + "$ref": "#/definitions/attachment" + } + }, + "inReplyToEmailId": { + "type": [ + "string", + "null" + ] + }, + "createdAt": { + "$ref": "#/definitions/datetime" + }, + "createdBy": { + "$ref": "#/definitions/actor" + }, + "updatedAt": { + "$ref": "#/definitions/datetime" + }, + "updatedBy": { + "$ref": "#/definitions/actor" + } + }, + "required": [ + "timelineEntryId", + "id", + "to", + "from", + "replyTo", + "additionalRecipients", + "hiddenRecipients", + "subject", + "textContent", + "markdownContent", + "authenticity", + "sentAt", + "receivedAt", + "attachments", + "inReplyToEmailId", + "createdAt", + "createdBy", + "updatedAt", + "updatedBy" + ], + "additionalProperties": false + }, + "chat": { + "type": "object", + "properties": { + "timelineEntryId": { + "$ref": "#/definitions/id" + }, + "id": { + "$ref": "#/definitions/id" + }, + "customerReadAt": { + "anyOf": [ + { + "$ref": "#/definitions/datetime" + }, + { + "type": "null" + } + ] + }, + "text": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "maxLength": 5000 + }, + { + "type": "null" + } + ], + "default": null + }, + "attachments": { + "type": "array", + "items": { + "$ref": "#/definitions/attachment" + } + }, + "createdAt": { + "$ref": "#/definitions/datetime" + }, + "createdBy": { + "$ref": "#/definitions/actor" + }, + "updatedAt": { + "$ref": "#/definitions/datetime" + }, + "updatedBy": { + "$ref": "#/definitions/actor" + } + }, + "required": [ + "timelineEntryId", + "id", + "customerReadAt", + "attachments", + "createdAt", + "createdBy", + "updatedAt", + "updatedBy" + ], + "additionalProperties": false + }, + "customEntryAttachment": { + "type": "object", + "properties": { + "id": { + "$ref": "#/definitions/id" + }, + "fileName": { + "$ref": "#/definitions/attachment/properties/fileName" + }, + "fileSizeBytes": { + "$ref": "#/definitions/attachment/properties/fileSizeBytes" + }, + "fileMimeType": { + "$ref": "#/definitions/attachment/properties/fileMimeType" + }, + "fileExtension": { + "$ref": "#/definitions/attachment/properties/fileExtension" + }, + "createdAt": { + "$ref": "#/definitions/datetime" + }, + "createdBy": { + "$ref": "#/definitions/actor" + }, + "updatedAt": { + "$ref": "#/definitions/datetime" + }, + "updatedBy": { + "$ref": "#/definitions/actor" + }, + "type": { + "type": "string", + "const": "CUSTOM_TIMELINE_ENTRY" + } + }, + "required": [ + "id", + "fileName", + "fileSizeBytes", + "fileMimeType", + "fileExtension", + "createdAt", + "createdBy", + "updatedAt", + "updatedBy", + "type" + ], + "additionalProperties": false + }, + "chatEntryAttachment": { + "type": "object", + "properties": { + "id": { + "$ref": "#/definitions/id" + }, + "fileName": { + "$ref": "#/definitions/attachment/properties/fileName" + }, + "fileSizeBytes": { + "$ref": "#/definitions/attachment/properties/fileSizeBytes" + }, + "fileMimeType": { + "$ref": "#/definitions/attachment/properties/fileMimeType" + }, + "fileExtension": { + "$ref": "#/definitions/attachment/properties/fileExtension" + }, + "createdAt": { + "$ref": "#/definitions/datetime" + }, + "createdBy": { + "$ref": "#/definitions/actor" + }, + "updatedAt": { + "$ref": "#/definitions/datetime" + }, + "updatedBy": { + "$ref": "#/definitions/actor" + }, + "type": { + "type": "string", + "const": "CHAT" + } + }, + "required": [ + "id", + "fileName", + "fileSizeBytes", + "fileMimeType", + "fileExtension", + "createdAt", + "createdBy", + "updatedAt", + "updatedBy", + "type" + ], + "additionalProperties": false + }, + "emailEntryAttachment": { + "type": "object", + "properties": { + "id": { + "$ref": "#/definitions/id" + }, + "fileName": { + "$ref": "#/definitions/attachment/properties/fileName" + }, + "fileSizeBytes": { + "$ref": "#/definitions/attachment/properties/fileSizeBytes" + }, + "fileMimeType": { + "$ref": "#/definitions/attachment/properties/fileMimeType" + }, + "fileExtension": { + "$ref": "#/definitions/attachment/properties/fileExtension" + }, + "createdAt": { + "$ref": "#/definitions/datetime" + }, + "createdBy": { + "$ref": "#/definitions/actor" + }, + "updatedAt": { + "$ref": "#/definitions/datetime" + }, + "updatedBy": { + "$ref": "#/definitions/actor" + }, + "type": { + "type": "string", + "const": "EMAIL" + }, + "emailContentId": { + "type": "string" + } + }, + "required": [ + "id", + "fileName", + "fileSizeBytes", + "fileMimeType", + "fileExtension", + "createdAt", + "createdBy", + "updatedAt", + "updatedBy", + "type", + "emailContentId" + ], + "additionalProperties": false + }, + "componentTextSize": { + "type": "string", + "enum": [ + "S", + "M", + "L" + ] + }, + "componentTextColor": { + "type": "string", + "enum": [ + "NORMAL", + "MUTED", + "SUCCESS", + "WARNING", + "ERROR" + ] + }, + "componentPlainTextSize": { + "type": "string", + "enum": [ + "S", + "M", + "L" + ] + }, + "componentPlainTextColor": { + "type": "string", + "enum": [ + "NORMAL", + "MUTED", + "SUCCESS", + "WARNING", + "ERROR" + ] + }, + "componentSpacerSize": { + "type": "string", + "enum": [ + "XS", + "S", + "M", + "L", + "XL" + ] + }, + "componentDividerSpacingSize": { + "type": "string", + "enum": [ + "XS", + "S", + "M", + "L", + "XL" + ] + }, + "componentBadgeColor": { + "type": "string", + "enum": [ + "GREY", + "GREEN", + "YELLOW", + "RED", + "BLUE" + ] + }, + "componentText": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "text" + }, + "textSize": { + "anyOf": [ + { + "$ref": "#/definitions/componentTextSize" + }, + { + "type": "null" + } + ] + }, + "textColor": { + "anyOf": [ + { + "$ref": "#/definitions/componentTextColor" + }, + { + "type": "null" + } + ] + }, + "text": { + "type": "string", + "minLength": 1, + "maxLength": 5000 + } + }, + "required": [ + "type", + "textSize", + "textColor", + "text" + ], + "additionalProperties": false + }, + "componentPlainText": { + "type": "object", + "properties": { + "plainTextSize": { + "anyOf": [ + { + "$ref": "#/definitions/componentPlainTextSize" + }, + { + "type": "null" + } + ] + }, + "plainTextColor": { + "anyOf": [ + { + "$ref": "#/definitions/componentPlainTextColor" + }, + { + "type": "null" + } + ] + }, + "plainText": { + "type": "string", + "minLength": 1, + "maxLength": 5000 + }, + "type": { + "type": "string", + "const": "plainText" + } + }, + "required": [ + "plainTextSize", + "plainTextColor", + "plainText", + "type" + ], + "additionalProperties": false + }, + "componentSpacer": { + "type": "object", + "properties": { + "spacerSize": { + "$ref": "#/definitions/componentSpacerSize" + }, + "type": { + "type": "string", + "const": "spacer" + } + }, + "required": [ + "spacerSize", + "type" + ], + "additionalProperties": false + }, + "componentDivider": { + "type": "object", + "properties": { + "dividerSpacingSize": { + "anyOf": [ + { + "$ref": "#/definitions/componentDividerSpacingSize" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string", + "const": "divider" + } + }, + "required": [ + "dividerSpacingSize", + "type" + ], + "additionalProperties": false + }, + "componentLinkButton": { + "type": "object", + "properties": { + "linkButtonUrl": { + "type": "string", + "format": "uri" + }, + "linkButtonLabel": { + "type": "string", + "maxLength": 500 + }, + "type": { + "type": "string", + "const": "linkButton" + } + }, + "required": [ + "linkButtonUrl", + "linkButtonLabel", + "type" + ], + "additionalProperties": false + }, + "componentBadge": { + "type": "object", + "properties": { + "badgeLabel": { + "type": "string", + "maxLength": 500 + }, + "badgeColor": { + "anyOf": [ + { + "$ref": "#/definitions/componentBadgeColor" + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string", + "const": "badge" + } + }, + "required": [ + "badgeLabel", + "badgeColor", + "type" + ], + "additionalProperties": false + }, + "componentCopyButton": { + "type": "object", + "properties": { + "copyButtonValue": { + "type": "string", + "maxLength": 1000 + }, + "copyButtonTooltipLabel": { + "anyOf": [ + { + "type": "string", + "maxLength": 500 + }, + { + "type": "null" + } + ] + }, + "type": { + "type": "string", + "const": "copyButton" + } + }, + "required": [ + "copyButtonValue", + "copyButtonTooltipLabel", + "type" + ], + "additionalProperties": false + }, + "componentRow": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "row" + }, + "rowMainContent": { + "type": "array", + "items": { + "$ref": "#/definitions/componentRowContent" + }, + "minItems": 1 + }, + "rowAsideContent": { + "type": "array", + "items": { + "$ref": "#/definitions/componentRowContent" + } + } + }, + "required": [ + "type", + "rowMainContent", + "rowAsideContent" + ], + "additionalProperties": false + }, + "componentContainer": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "container" + }, + "containerContent": { + "type": "array", + "items": { + "$ref": "#/definitions/componentContainerContent" + }, + "minItems": 1 + } + }, + "required": [ + "type", + "containerContent" + ], + "additionalProperties": false + }, + "componentContainerContent": { + "anyOf": [ + { + "$ref": "#/definitions/componentText" + }, + { + "$ref": "#/definitions/componentPlainText" + }, + { + "$ref": "#/definitions/componentSpacer" + }, + { + "$ref": "#/definitions/componentDivider" + }, + { + "$ref": "#/definitions/componentLinkButton" + }, + { + "$ref": "#/definitions/componentBadge" + }, + { + "$ref": "#/definitions/componentCopyButton" + }, + { + "$ref": "#/definitions/componentRow" + } + ] + }, + "componentRowContent": { + "anyOf": [ + { + "$ref": "#/definitions/componentText" + }, + { + "$ref": "#/definitions/componentPlainText" + }, + { + "$ref": "#/definitions/componentSpacer" + }, + { + "$ref": "#/definitions/componentDivider" + }, + { + "$ref": "#/definitions/componentLinkButton" + }, + { + "$ref": "#/definitions/componentBadge" + }, + { + "$ref": "#/definitions/componentCopyButton" + } + ] + }, + "component": { + "anyOf": [ + { + "$ref": "#/definitions/componentText" + }, + { + "$ref": "#/definitions/componentPlainText" + }, + { + "$ref": "#/definitions/componentSpacer" + }, + { + "$ref": "#/definitions/componentDivider" + }, + { + "$ref": "#/definitions/componentLinkButton" + }, + { + "$ref": "#/definitions/componentBadge" + }, + { + "$ref": "#/definitions/componentCopyButton" + }, + { + "$ref": "#/definitions/componentRow" + }, + { + "$ref": "#/definitions/componentContainer" + } + ] + }, + "emailParticipant": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "name": { + "type": [ + "string", + "null" + ] + }, + "emailActor": { + "anyOf": [ + { + "$ref": "#/definitions/emailActor" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "email", + "name", + "emailActor" + ], + "additionalProperties": false + }, + "label": { + "type": "object", + "properties": { + "id": { + "$ref": "#/definitions/id" + }, + "labelType": { + "$ref": "#/definitions/labelType" + }, + "createdAt": { + "$ref": "#/definitions/datetime" + }, + "createdBy": { + "$ref": "#/definitions/actor" + }, + "updatedAt": { + "$ref": "#/definitions/datetime" + }, + "updatedBy": { + "$ref": "#/definitions/actor" + } + }, + "required": [ + "id", + "labelType", + "createdAt", + "createdBy", + "updatedAt", + "updatedBy" + ], + "additionalProperties": false + }, + "labelType": { + "type": "object", + "properties": { + "id": { + "$ref": "#/definitions/id" + }, + "name": { + "type": "string", + "minLength": 1, + "maxLength": 500 + }, + "icon": { + "type": [ + "string", + "null" + ], + "default": null + }, + "isArchived": { + "type": "boolean", + "default": false + }, + "archivedAt": { + "anyOf": [ + { + "$ref": "#/definitions/datetime" + }, + { + "type": "null" + } + ] + }, + "archivedBy": { + "anyOf": [ + { + "$ref": "#/definitions/internalActor" + }, + { + "type": "null" + } + ] + }, + "createdAt": { + "$ref": "#/definitions/datetime" + }, + "createdBy": { + "$ref": "#/definitions/internalActor" + }, + "updatedAt": { + "$ref": "#/definitions/datetime" + }, + "updatedBy": { + "$ref": "#/definitions/internalActor" + } + }, + "required": [ + "id", + "name", + "archivedAt", + "archivedBy", + "createdAt", + "createdBy", + "updatedAt", + "updatedBy" + ], + "additionalProperties": false + }, + "threadAssignee": { + "anyOf": [ + { + "$ref": "#/definitions/user" + }, + { + "$ref": "#/definitions/machineUser" + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": [ + "id" + ], + "additionalProperties": false + } + ] + }, + "threadStatus": { + "type": "string", + "enum": [ + "TODO", + "DONE", + "SNOOZED" + ] + }, + "threadMessageInfo": { + "type": "object", + "properties": { + "timestamp": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "string" + }, + {} + ] + }, + "messageSource": { + "type": "string", + "enum": [ + "CHAT", + "EMAIL", + "API", + "SLACK" + ] + } + }, + "required": [ + "timestamp", + "messageSource" + ], + "additionalProperties": false + }, + "threadStatusDetail": { + "anyOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "CREATED" + }, + "createdAt": { + "$ref": "#/definitions/threadMessageInfo/properties/timestamp" + } + }, + "required": [ + "type", + "createdAt" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "SNOOZED" + }, + "snoozedAt": { + "$ref": "#/definitions/threadMessageInfo/properties/timestamp" + }, + "snoozedUntil": { + "$ref": "#/definitions/threadMessageInfo/properties/timestamp" + } + }, + "required": [ + "type", + "snoozedAt", + "snoozedUntil" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "UNSNOOZED" + }, + "snoozedAt": { + "$ref": "#/definitions/threadMessageInfo/properties/timestamp" + } + }, + "required": [ + "type", + "snoozedAt" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "NEW_REPLY" + }, + "newReplyAt": { + "$ref": "#/definitions/threadMessageInfo/properties/timestamp" + } + }, + "required": [ + "type", + "newReplyAt" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "LINK_LINEAR_UPDATED" + }, + "updatedAt": { + "$ref": "#/definitions/threadMessageInfo/properties/timestamp" + }, + "linearIssueId": { + "type": "string", + "format": "uuid" + } + }, + "required": [ + "type", + "updatedAt", + "linearIssueId" + ], + "additionalProperties": false + } + ] + }, + "thread": { + "type": "object", + "properties": { + "id": { + "$ref": "#/definitions/id" + }, + "customer": { + "type": "object", + "properties": { + "id": { + "$ref": "#/definitions/id" + }, + "email": { + "$ref": "#/definitions/customer/properties/email" + }, + "externalId": { + "$ref": "#/definitions/customer/properties/externalId" + }, + "fullName": { + "$ref": "#/definitions/customer/properties/fullName" + }, + "shortName": { + "$ref": "#/definitions/customer/properties/shortName" + }, + "markedAsSpamAt": { + "$ref": "#/definitions/customer/properties/markedAsSpamAt" + }, + "markedAsSpamBy": { + "$ref": "#/definitions/customer/properties/markedAsSpamBy" + }, + "customerGroupMemberships": { + "$ref": "#/definitions/customer/properties/customerGroupMemberships" + }, + "createdAt": { + "$ref": "#/definitions/datetime" + }, + "createdBy": { + "$ref": "#/definitions/actor" + }, + "updatedAt": { + "$ref": "#/definitions/datetime" + }, + "updatedBy": { + "$ref": "#/definitions/actor" + } + }, + "required": [ + "id", + "email", + "externalId", + "fullName", + "shortName", + "customerGroupMemberships", + "createdAt", + "createdBy", + "updatedAt", + "updatedBy" + ], + "additionalProperties": false + }, + "title": { + "type": "string", + "minLength": 1, + "maxLength": 500 + }, + "previewText": { + "anyOf": [ + { + "type": "string", + "maxLength": 500 + }, + { + "type": "null" + } + ], + "default": null + }, + "priority": { + "type": "number" + }, + "externalId": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "maxLength": 500 + }, + { + "type": "null" + } + ] + }, + "status": { + "$ref": "#/definitions/threadStatus" + }, + "statusChangedAt": { + "anyOf": [ + { + "$ref": "#/definitions/datetime" + }, + { + "type": "null" + } + ] + }, + "statusChangedBy": { + "anyOf": [ + { + "$ref": "#/definitions/actor" + }, + { + "type": "null" + } + ], + "default": null + }, + "statusDetail": { + "anyOf": [ + { + "$ref": "#/definitions/threadStatusDetail" + }, + { + "type": "null" + } + ] + }, + "assignee": { + "anyOf": [ + { + "$ref": "#/definitions/threadAssignee" + }, + { + "type": "null" + } + ] + }, + "assignedAt": { + "anyOf": [ + { + "$ref": "#/definitions/datetime" + }, + { + "type": "null" + } + ] + }, + "labels": { + "type": "array", + "items": { + "$ref": "#/definitions/label" + } + }, + "firstInboundMessageInfo": { + "anyOf": [ + { + "$ref": "#/definitions/threadMessageInfo" + }, + { + "type": "null" + } + ] + }, + "firstOutboundMessageInfo": { + "anyOf": [ + { + "$ref": "#/definitions/threadMessageInfo" + }, + { + "type": "null" + } + ] + }, + "lastInboundMessageInfo": { + "anyOf": [ + { + "$ref": "#/definitions/threadMessageInfo" + }, + { + "type": "null" + } + ] + }, + "lastOutboundMessageInfo": { + "anyOf": [ + { + "$ref": "#/definitions/threadMessageInfo" + }, + { + "type": "null" + } + ] + }, + "supportEmailAddresses": { + "type": "array", + "items": { + "type": "string" + } + }, + "createdAt": { + "$ref": "#/definitions/datetime" + }, + "createdBy": { + "$ref": "#/definitions/actor" + }, + "updatedAt": { + "$ref": "#/definitions/datetime" + }, + "updatedBy": { + "$ref": "#/definitions/actor" + } + }, + "required": [ + "id", + "customer", + "title", + "priority", + "externalId", + "status", + "statusChangedAt", + "statusDetail", + "assignee", + "assignedAt", + "labels", + "firstInboundMessageInfo", + "firstOutboundMessageInfo", + "lastInboundMessageInfo", + "lastOutboundMessageInfo", + "supportEmailAddresses", + "createdAt", + "createdBy", + "updatedAt", + "updatedBy" + ], + "additionalProperties": false + }, + "noteEntry": { + "type": "object", + "properties": { + "entryType": { + "type": "string", + "const": "note" + }, + "noteId": { + "$ref": "#/definitions/id" + }, + "text": { + "type": "string", + "minLength": 1, + "maxLength": 5000 + }, + "markdown": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "maxLength": 10000 + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "entryType", + "noteId", + "text", + "markdown" + ], + "additionalProperties": false + }, + "chatEntry": { + "type": "object", + "properties": { + "entryType": { + "type": "string", + "const": "chat" + }, + "chatId": { + "$ref": "#/definitions/id" + }, + "text": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "maxLength": 5000 + }, + { + "type": "null" + } + ] + }, + "attachments": { + "type": "array", + "items": { + "$ref": "#/definitions/chatEntryAttachment" + } + }, + "customerReadAt": { + "anyOf": [ + { + "$ref": "#/definitions/datetime" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "entryType", + "chatId", + "text", + "attachments", + "customerReadAt" + ], + "additionalProperties": false + }, + "emailEntry": { + "type": "object", + "properties": { + "entryType": { + "type": "string", + "const": "email" + }, + "emailId": { + "$ref": "#/definitions/id" + }, + "to": { + "$ref": "#/definitions/emailParticipant" + }, + "from": { + "$ref": "#/definitions/emailParticipant" + }, + "additionalRecipients": { + "type": "array", + "items": { + "$ref": "#/definitions/emailParticipant" + } + }, + "hiddenRecipients": { + "type": "array", + "items": { + "$ref": "#/definitions/emailParticipant" + } + }, + "subject": { + "type": [ + "string", + "null" + ] + }, + "textContent": { + "type": [ + "string", + "null" + ] + }, + "hasMoreTextContent": { + "type": "boolean" + }, + "markdownContent": { + "type": [ + "string", + "null" + ] + }, + "hasMoreMarkdownContent": { + "type": "boolean" + }, + "authenticity": { + "type": "string", + "enum": [ + "PASS", + "FAIL", + "UNKNOWN" + ] + }, + "sentAt": { + "anyOf": [ + { + "$ref": "#/definitions/datetime" + }, + { + "type": "null" + } + ] + }, + "receivedAt": { + "anyOf": [ + { + "$ref": "#/definitions/datetime" + }, + { + "type": "null" + } + ] + }, + "attachments": { + "type": "array", + "items": { + "$ref": "#/definitions/emailEntryAttachment" + } + }, + "inReplyToEmailId": { + "type": [ + "string", + "null" + ] + }, + "isStartOfThread": { + "type": "boolean" + } + }, + "required": [ + "entryType", + "emailId", + "to", + "from", + "additionalRecipients", + "hiddenRecipients", + "subject", + "textContent", + "hasMoreTextContent", + "markdownContent", + "hasMoreMarkdownContent", + "authenticity", + "sentAt", + "receivedAt", + "attachments", + "inReplyToEmailId", + "isStartOfThread" + ], + "additionalProperties": false + }, + "customEntry": { + "type": "object", + "properties": { + "entryType": { + "type": "string", + "const": "custom" + }, + "externalId": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "maxLength": 500 + }, + { + "type": "null" + } + ] + }, + "title": { + "type": "string", + "maxLength": 500 + }, + "type": { + "type": [ + "string", + "null" + ] + }, + "components": { + "type": "array", + "items": { + "$ref": "#/definitions/component" + }, + "minItems": 1 + }, + "attachments": { + "type": "array", + "items": { + "$ref": "#/definitions/customEntryAttachment" + } + } + }, + "required": [ + "entryType", + "externalId", + "title", + "type", + "components", + "attachments" + ], + "additionalProperties": false + }, + "timelineEntry": { + "type": "object", + "properties": { + "id": { + "$ref": "#/definitions/id" + }, + "customerId": { + "$ref": "#/definitions/id" + }, + "threadId": { + "anyOf": [ + { + "$ref": "#/definitions/id" + }, + { + "type": "null" + } + ], + "default": null + }, + "timestamp": { + "$ref": "#/definitions/datetime" + }, + "actor": { + "$ref": "#/definitions/actor" + }, + "entry": { + "anyOf": [ + { + "$ref": "#/definitions/noteEntry" + }, + { + "$ref": "#/definitions/chatEntry" + }, + { + "$ref": "#/definitions/emailEntry" + }, + { + "$ref": "#/definitions/customEntry" + } + ] + } + }, + "required": [ + "id", + "customerId", + "timestamp", + "actor", + "entry" + ], + "additionalProperties": false + }, + "customerChangedPayload": { + "type": "object", + "properties": { + "changeType": { + "type": "string", + "enum": [ + "ADDED", + "UPDATED" + ] + }, + "eventType": { + "type": "string", + "const": "customer.customer_changed" + }, + "customer": { + "$ref": "#/definitions/customer" + }, + "previousCustomer": { + "anyOf": [ + { + "$ref": "#/definitions/customer" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "changeType", + "eventType", + "customer", + "previousCustomer" + ], + "additionalProperties": false, + "description": "A customer has been created or updated" + }, + "timelineEntryChangedPayload": { + "type": "object", + "properties": { + "eventType": { + "type": "string", + "const": "timeline.timeline_entry_changed" + }, + "previousTimelineEntry": { + "anyOf": [ + { + "$ref": "#/definitions/timelineEntry" + }, + { + "type": "null" + } + ], + "description": "null if changeType=ADDED" + }, + "timelineEntry": { + "anyOf": [ + { + "$ref": "#/definitions/timelineEntry" + }, + { + "type": "null" + } + ], + "description": "null if changeType=REMOVED" + }, + "changeType": { + "type": "string", + "enum": [ + "ADDED", + "UPDATED", + "REMOVED" + ] + } + }, + "required": [ + "eventType", + "previousTimelineEntry", + "timelineEntry", + "changeType" + ], + "additionalProperties": false, + "description": "A timeline entry has been added, updated or removed" + }, + "customerGroupMembershipsChangedPayload": { + "type": "object", + "properties": { + "eventType": { + "type": "string", + "const": "customer.customer_group_memberships_changed" + }, + "changeType": { + "type": "string", + "enum": [ + "ADDED", + "REMOVED" + ] + }, + "customer": { + "$ref": "#/definitions/thread/properties/customer" + }, + "previousCustomer": { + "$ref": "#/definitions/thread/properties/customer" + } + }, + "required": [ + "eventType", + "changeType", + "customer", + "previousCustomer" + ], + "additionalProperties": false + }, + "customerGroupChangedPayload": { + "anyOf": [ + { + "type": "object", + "properties": { + "changeType": { + "type": "string", + "const": "ADDED" + }, + "eventType": { + "type": "string", + "const": "customer.customer_group_changed" + }, + "customerGroup": { + "$ref": "#/definitions/customerGroup" + } + }, + "required": [ + "changeType", + "eventType", + "customerGroup" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "changeType": { + "type": "string", + "const": "UPDATED" + }, + "eventType": { + "type": "string", + "const": "customer.customer_group_changed" + }, + "customerGroup": { + "$ref": "#/definitions/customerGroup" + }, + "previousCustomerGroup": { + "$ref": "#/definitions/customerGroup" + } + }, + "required": [ + "changeType", + "eventType", + "customerGroup", + "previousCustomerGroup" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "changeType": { + "type": "string", + "const": "REMOVED" + }, + "eventType": { + "type": "string", + "const": "customer.customer_group_changed" + }, + "previousCustomerGroup": { + "$ref": "#/definitions/customerGroup" + } + }, + "required": [ + "changeType", + "eventType", + "previousCustomerGroup" + ], + "additionalProperties": false + } + ] + }, + "threadCreatedPublicEventPayload": { + "type": "object", + "properties": { + "eventType": { + "type": "string", + "const": "thread.thread_created" + }, + "thread": { + "$ref": "#/definitions/thread" + } + }, + "required": [ + "eventType", + "thread" + ], + "additionalProperties": false + }, + "threadStatusTransitionedPublicEventPayload": { + "type": "object", + "properties": { + "eventType": { + "type": "string", + "const": "thread.thread_status_transitioned" + }, + "previousThread": { + "$ref": "#/definitions/thread" + }, + "thread": { + "$ref": "#/definitions/thread" + } + }, + "required": [ + "eventType", + "previousThread", + "thread" + ], + "additionalProperties": false + }, + "threadAssignmentTransitionedPublicEventPayload": { + "type": "object", + "properties": { + "eventType": { + "type": "string", + "const": "thread.thread_assignment_transitioned" + }, + "previousThread": { + "$ref": "#/definitions/thread" + }, + "thread": { + "$ref": "#/definitions/thread" + } + }, + "required": [ + "eventType", + "previousThread", + "thread" + ], + "additionalProperties": false + }, + "threadEmailReceivedPublicEventPayload": { + "type": "object", + "properties": { + "eventType": { + "type": "string", + "const": "thread.email_received" + }, + "thread": { + "$ref": "#/definitions/thread" + }, + "email": { + "$ref": "#/definitions/email" + } + }, + "required": [ + "eventType", + "thread", + "email" + ], + "additionalProperties": false + }, + "threadEmailSentPublicEventPayload": { + "type": "object", + "properties": { + "eventType": { + "type": "string", + "const": "thread.email_sent" + }, + "thread": { + "$ref": "#/definitions/thread" + }, + "email": { + "$ref": "#/definitions/email" + } + }, + "required": [ + "eventType", + "thread", + "email" + ], + "additionalProperties": false + }, + "threadLabelsChangedPublicEventPayload": { + "type": "object", + "properties": { + "eventType": { + "type": "string", + "const": "thread.thread_labels_changed" + }, + "changeType": { + "type": "string", + "enum": [ + "ADDED", + "REMOVED" + ] + }, + "thread": { + "$ref": "#/definitions/thread" + }, + "previousThread": { + "$ref": "#/definitions/thread" + } + }, + "required": [ + "eventType", + "changeType", + "thread", + "previousThread" + ], + "additionalProperties": false + }, + "threadPriorityChangedPublicEventPayload": { + "type": "object", + "properties": { + "eventType": { + "type": "string", + "const": "thread.thread_priority_changed" + }, + "previousThread": { + "$ref": "#/definitions/thread" + }, + "thread": { + "$ref": "#/definitions/thread" + } + }, + "required": [ + "eventType", + "previousThread", + "thread" + ], + "additionalProperties": false + }, + "threadChatSentPublicEventPayload": { + "type": "object", + "properties": { + "eventType": { + "type": "string", + "const": "thread.chat_sent" + }, + "chat": { + "$ref": "#/definitions/chat" + }, + "thread": { + "$ref": "#/definitions/thread" + } + }, + "required": [ + "eventType", + "chat", + "thread" + ], + "additionalProperties": false + }, + "threadNoteCreatedEventPayload": { + "type": "object", + "properties": { + "eventType": { + "type": "string", + "const": "thread.note_created" + }, + "thread": { + "$ref": "#/definitions/thread" + }, + "note": { + "type": "object", + "properties": { + "timelineEntryId": { + "$ref": "#/definitions/id" + }, + "id": { + "$ref": "#/definitions/id" + }, + "text": { + "type": "string", + "minLength": 1, + "maxLength": 5000 + }, + "markdown": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "maxLength": 10000 + }, + { + "type": "null" + } + ] + }, + "createdAt": { + "$ref": "#/definitions/datetime" + }, + "createdBy": { + "$ref": "#/definitions/internalActor" + }, + "updatedAt": { + "$ref": "#/definitions/datetime" + }, + "updatedBy": { + "$ref": "#/definitions/internalActor" + }, + "deletedAt": { + "$ref": "#/definitions/user/properties/deletedAt" + }, + "deletedBy": { + "$ref": "#/definitions/user/properties/deletedBy" + } + }, + "required": [ + "timelineEntryId", + "id", + "text", + "markdown", + "createdAt", + "createdBy", + "updatedAt", + "updatedBy", + "deletedAt", + "deletedBy" + ], + "additionalProperties": false + } + }, + "required": [ + "eventType", + "thread", + "note" + ], + "additionalProperties": false + }, + "customerCreatedPublicEventPayload": { + "type": "object", + "properties": { + "eventType": { + "type": "string", + "const": "customer.customer_created" + }, + "customer": { + "$ref": "#/definitions/thread/properties/customer" + } + }, + "required": [ + "eventType", + "customer" + ], + "additionalProperties": false, + "description": "A customer has been created" + }, + "customerUpdatedPublicEventPayload": { + "type": "object", + "properties": { + "eventType": { + "type": "string", + "const": "customer.customer_updated" + }, + "customer": { + "$ref": "#/definitions/thread/properties/customer" + }, + "previousCustomer": { + "$ref": "#/definitions/thread/properties/customer" + } + }, + "required": [ + "eventType", + "customer", + "previousCustomer" + ], + "additionalProperties": false, + "description": "A customer has been updated" + }, + "customerDeletedPublicEventPayload": { + "type": "object", + "properties": { + "eventType": { + "type": "string", + "const": "customer.customer_deleted" + }, + "previousCustomer": { + "$ref": "#/definitions/thread/properties/customer" + } + }, + "required": [ + "eventType", + "previousCustomer" + ], + "additionalProperties": false, + "description": "A customer has been deleted" + } + }, + "$schema": "http://json-schema.org/draft-07/schema#" +} \ No newline at end of file diff --git a/webhook-schema.ts b/src/webhooks/webhook-schema.ts similarity index 99% rename from webhook-schema.ts rename to src/webhooks/webhook-schema.ts index fc1aba1..964438e 100644 --- a/webhook-schema.ts +++ b/src/webhooks/webhook-schema.ts @@ -270,6 +270,7 @@ export interface TimelineEntryChangedPayload { export interface TimelineEntry { id: Id; customerId: Id; + threadId?: Id | null; timestamp: Datetime; actor: Actor; entry: NoteEntry | ChatEntry | EmailEntry | CustomEntry; diff --git a/tsconfig.json b/tsconfig.json index 78495dd..1f54bd3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,6 +5,7 @@ "skipLibCheck": true, "esModuleInterop": true, "moduleResolution": "node", - "verbatimModuleSyntax": true + "verbatimModuleSyntax": true, + "resolveJsonModule": true } } diff --git a/webhook-model.ts b/webhook-model.ts deleted file mode 100644 index 09e1df8..0000000 --- a/webhook-model.ts +++ /dev/null @@ -1,670 +0,0 @@ -// Generated by ts-to-zod -import { z } from 'zod'; - -export const idSchema = z.string(); - -export const emailAddressSchema = z.string(); - -export const datetimeSchema = z.string(); - -export const userActorSchema = z.object({ - actorType: z.literal('user'), - userId: idSchema, -}); - -export const machineUserActorSchema = z.object({ - actorType: z.literal('machineUser'), - machineUserId: idSchema, -}); - -export const systemActorSchema = z.object({ - actorType: z.literal('system'), - system: z.string(), -}); - -export const customerActorSchema = z.object({ - actorType: z.literal('customer'), - customerId: idSchema, -}); - -export const emailActorSchema = z.union([ - userActorSchema, - customerActorSchema, - z.object({ - actorType: z.literal('supportEmailAddress'), - supportEmailAddress: z.string(), - }), - z.object({ - actorType: z.literal('deletedCustomer'), - customerId: idSchema, - }), -]); - -export const componentLinkButtonSchema = z.object({ - linkButtonUrl: z.string(), - linkButtonLabel: z.string(), - type: z.literal('linkButton'), -}); - -export const componentCopyButtonSchema = z.object({ - copyButtonValue: z.string(), - copyButtonTooltipLabel: z.string().nullable(), - type: z.literal('copyButton'), -}); - -export const componentTextSizeSchema = z.union([z.literal('S'), z.literal('M'), z.literal('L')]); - -export const componentTextColorSchema = z.union([ - z.literal('NORMAL'), - z.literal('MUTED'), - z.literal('SUCCESS'), - z.literal('WARNING'), - z.literal('ERROR'), -]); - -export const componentPlainTextSizeSchema = z.union([ - z.literal('S'), - z.literal('M'), - z.literal('L'), -]); - -export const componentPlainTextColorSchema = z.union([ - z.literal('NORMAL'), - z.literal('MUTED'), - z.literal('SUCCESS'), - z.literal('WARNING'), - z.literal('ERROR'), -]); - -export const componentSpacerSizeSchema = z.union([ - z.literal('XS'), - z.literal('S'), - z.literal('M'), - z.literal('L'), - z.literal('XL'), -]); - -export const componentDividerSpacingSizeSchema = z.union([ - z.literal('XS'), - z.literal('S'), - z.literal('M'), - z.literal('L'), - z.literal('XL'), -]); - -export const componentBadgeColorSchema = z.union([ - z.literal('GREY'), - z.literal('GREEN'), - z.literal('YELLOW'), - z.literal('RED'), - z.literal('BLUE'), -]); - -export const threadStatusSchema = z.union([ - z.literal('TODO'), - z.literal('DONE'), - z.literal('SNOOZED'), -]); - -export const threadStatusDetailSchema = z.union([ - z.object({ - type: z.literal('CREATED'), - createdAt: z.union([z.string(), z.string(), z.unknown()]), - }), - z.object({ - type: z.literal('SNOOZED'), - snoozedAt: z.union([z.string(), z.string(), z.unknown()]), - snoozedUntil: z.union([z.string(), z.string(), z.unknown()]), - }), - z.object({ - type: z.literal('UNSNOOZED'), - snoozedAt: z.union([z.string(), z.string(), z.unknown()]), - }), - z.object({ - type: z.literal('NEW_REPLY'), - newReplyAt: z.union([z.string(), z.string(), z.unknown()]), - }), - z.object({ - type: z.literal('LINK_LINEAR_UPDATED'), - updatedAt: z.union([z.string(), z.string(), z.unknown()]), - linearIssueId: z.string(), - }), -]); - -export const emailSchema = z.object({ - email: emailAddressSchema, - isVerified: z.boolean(), - verifiedAt: datetimeSchema.nullable(), -}); - -export const noteEntrySchema = z.object({ - entryType: z.literal('note'), - noteId: idSchema, - text: z.string(), - markdown: z.string().nullable(), -}); - -export const emailParticipantSchema = z.object({ - email: z.string(), - name: z.string().nullable(), - emailActor: emailActorSchema.nullable(), -}); - -export const threadMessageInfoSchema = z.object({ - timestamp: z.union([z.string(), z.string(), z.unknown()]), - messageSource: z.union([ - z.literal('CHAT'), - z.literal('EMAIL'), - z.literal('API'), - z.literal('SLACK'), - ]), -}); - -export const internalActorSchema = z.union([ - userActorSchema, - machineUserActorSchema, - systemActorSchema, -]); - -export const actorSchema = z.union([ - userActorSchema, - machineUserActorSchema, - systemActorSchema, - customerActorSchema, -]); - -export const componentTextSchema = z.object({ - type: z.literal('text'), - textSize: componentTextSizeSchema.nullable(), - textColor: componentTextColorSchema.nullable(), - text: z.string(), -}); - -export const componentPlainTextSchema = z.object({ - plainTextSize: componentPlainTextSizeSchema.nullable(), - plainTextColor: componentPlainTextColorSchema.nullable(), - plainText: z.string(), - type: z.literal('plainText'), -}); - -export const componentSpacerSchema = z.object({ - spacerSize: componentSpacerSizeSchema, - type: z.literal('spacer'), -}); - -export const componentDividerSchema = z.object({ - dividerSpacingSize: componentDividerSpacingSizeSchema.nullable(), - type: z.literal('divider'), -}); - -export const componentBadgeSchema = z.object({ - badgeLabel: z.string(), - badgeColor: componentBadgeColorSchema.nullable(), - type: z.literal('badge'), -}); - -export const componentRowContentSchema = z.union([ - componentTextSchema, - componentPlainTextSchema, - componentSpacerSchema, - componentDividerSchema, - componentLinkButtonSchema, - componentBadgeSchema, - componentCopyButtonSchema, -]); - -export const customerGroupSchema = z.object({ - id: idSchema, - workspaceId: idSchema, - name: z.string(), - key: z.string(), - color: z.string(), - createdAt: datetimeSchema, - createdBy: internalActorSchema, - updatedAt: datetimeSchema, - updatedBy: internalActorSchema, -}); - -export const userSchema = z.object({ - id: idSchema, - email: emailAddressSchema, - fullName: z.string(), - publicName: z.string(), - status: z.union([z.literal('ONLINE'), z.literal('OFFLINE'), z.literal('BREAK')]), - statusChangedAt: datetimeSchema, - createdAt: datetimeSchema, - createdBy: internalActorSchema, - updatedAt: datetimeSchema, - updatedBy: internalActorSchema, - deletedAt: datetimeSchema.nullable(), - deletedBy: internalActorSchema.nullable(), -}); - -export const machineUserSchema = z.object({ - id: idSchema, - fullName: z.string(), - publicName: z.string(), - description: z.string().nullable(), - createdAt: datetimeSchema, - createdBy: internalActorSchema, - updatedAt: datetimeSchema, - updatedBy: internalActorSchema, - deletedAt: datetimeSchema.nullable(), - deletedBy: internalActorSchema.nullable(), -}); - -export const chatEntryAttachmentSchema = z.object({ - id: idSchema, - fileName: z.string(), - fileSizeBytes: z.number(), - fileMimeType: z.string(), - fileExtension: z.string().nullable(), - createdAt: datetimeSchema, - createdBy: actorSchema, - updatedAt: datetimeSchema, - updatedBy: actorSchema, - type: z.literal('CHAT'), -}); - -export const emailEntryAttachmentSchema = z.object({ - id: idSchema, - fileName: z.string(), - fileSizeBytes: z.number(), - fileMimeType: z.string(), - fileExtension: z.string().nullable(), - createdAt: datetimeSchema, - createdBy: actorSchema, - updatedAt: datetimeSchema, - updatedBy: actorSchema, - type: z.literal('EMAIL'), - emailContentId: z.string(), -}); - -export const customEntryAttachmentSchema = z.object({ - id: idSchema, - fileName: z.string(), - fileSizeBytes: z.number(), - fileMimeType: z.string(), - fileExtension: z.string().nullable(), - createdAt: datetimeSchema, - createdBy: actorSchema, - updatedAt: datetimeSchema, - updatedBy: actorSchema, - type: z.literal('CUSTOM_TIMELINE_ENTRY'), -}); - -export const labelTypeSchema = z.object({ - id: idSchema, - name: z.string(), - icon: z.string().optional().nullable(), - isArchived: z.boolean().optional(), - archivedAt: datetimeSchema.nullable(), - archivedBy: internalActorSchema.nullable(), - createdAt: datetimeSchema, - createdBy: internalActorSchema, - updatedAt: datetimeSchema, - updatedBy: internalActorSchema, -}); - -export const attachmentSchema = z.object({ - id: idSchema, - fileName: z.string(), - fileSizeBytes: z.number(), - fileMimeType: z.string(), - fileExtension: z.string().nullable(), - createdAt: datetimeSchema, - createdBy: actorSchema, - updatedAt: datetimeSchema, - updatedBy: actorSchema, -}); - -export const chatSchema = z.object({ - timelineEntryId: idSchema, - id: idSchema, - customerReadAt: datetimeSchema.nullable(), - text: z.string().optional().nullable(), - attachments: z.array(attachmentSchema), - createdAt: datetimeSchema, - createdBy: actorSchema, - updatedAt: datetimeSchema, - updatedBy: actorSchema, -}); - -export const customerGroupMembershipSchema = z.object({ - customerId: idSchema, - customerGroupId: idSchema, - workspaceId: idSchema, - createdAt: datetimeSchema, - createdBy: internalActorSchema, - updatedAt: datetimeSchema, - updatedBy: internalActorSchema, - customerGroup: customerGroupSchema, -}); - -export const componentRowSchema = z.object({ - type: z.literal('row'), - rowMainContent: z.tuple([componentRowContentSchema, z.any()]), - rowAsideContent: z.array(componentRowContentSchema), -}); - -export const componentContainerContentSchema = z.union([ - componentTextSchema, - componentPlainTextSchema, - componentSpacerSchema, - componentDividerSchema, - componentLinkButtonSchema, - componentBadgeSchema, - componentCopyButtonSchema, - componentRowSchema, -]); - -export const customerGroupChangedPayloadSchema = z.union([ - z.object({ - changeType: z.literal('ADDED'), - eventType: z.literal('customer.customer_group_changed'), - customerGroup: customerGroupSchema, - }), - z.object({ - changeType: z.literal('UPDATED'), - eventType: z.literal('customer.customer_group_changed'), - customerGroup: customerGroupSchema, - previousCustomerGroup: customerGroupSchema, - }), - z.object({ - changeType: z.literal('REMOVED'), - eventType: z.literal('customer.customer_group_changed'), - previousCustomerGroup: customerGroupSchema, - }), -]); - -export const threadAssigneeSchema = z.union([ - userSchema, - machineUserSchema, - z.object({ - id: z.string(), - }), -]); - -export const chatEntrySchema = z.object({ - entryType: z.literal('chat'), - chatId: idSchema, - text: z.string().nullable(), - attachments: z.array(chatEntryAttachmentSchema), - customerReadAt: datetimeSchema.nullable(), -}); - -export const emailEntrySchema = z.object({ - entryType: z.literal('email'), - emailId: idSchema, - to: emailParticipantSchema, - from: emailParticipantSchema, - additionalRecipients: z.array(emailParticipantSchema), - hiddenRecipients: z.array(emailParticipantSchema), - subject: z.string().nullable(), - textContent: z.string().nullable(), - hasMoreTextContent: z.boolean(), - markdownContent: z.string().nullable(), - hasMoreMarkdownContent: z.boolean(), - authenticity: z.union([z.literal('PASS'), z.literal('FAIL'), z.literal('UNKNOWN')]), - sentAt: datetimeSchema.nullable(), - receivedAt: datetimeSchema.nullable(), - attachments: z.array(emailEntryAttachmentSchema), - inReplyToEmailId: z.string().nullable(), - isStartOfThread: z.boolean(), -}); - -export const labelSchema = z.object({ - id: idSchema, - labelType: labelTypeSchema, - createdAt: datetimeSchema, - createdBy: actorSchema, - updatedAt: datetimeSchema, - updatedBy: actorSchema, -}); - -export const email1Schema = z.object({ - timelineEntryId: idSchema, - id: idSchema, - to: emailParticipantSchema, - from: emailParticipantSchema, - replyTo: z.string().nullable(), - additionalRecipients: z.array(emailParticipantSchema), - hiddenRecipients: z.array(emailParticipantSchema), - subject: z.string().nullable(), - textContent: z.string().nullable(), - markdownContent: z.string().nullable(), - authenticity: z.union([z.literal('PASS'), z.literal('FAIL'), z.literal('UNKNOWN')]), - sentAt: datetimeSchema.nullable(), - receivedAt: datetimeSchema.nullable(), - attachments: z.array(attachmentSchema), - inReplyToEmailId: z.string().nullable(), - createdAt: datetimeSchema, - createdBy: actorSchema, - updatedAt: datetimeSchema, - updatedBy: actorSchema, -}); - -export const customerGroupMembershipsSchema = z.array(customerGroupMembershipSchema); - -export const componentContainerSchema = z.object({ - type: z.literal('container'), - containerContent: z.tuple([componentContainerContentSchema, z.any()]), -}); - -export const customerSchema = z.object({ - id: idSchema, - email: emailSchema, - externalId: z.string().nullable(), - fullName: z.string(), - shortName: z.string().nullable(), - assignedAt: datetimeSchema.nullable(), - assignedToUser: userSchema.nullable(), - markedAsSpamAt: datetimeSchema.optional().nullable(), - markedAsSpamBy: internalActorSchema.optional().nullable(), - customerGroupMemberships: customerGroupMembershipsSchema, - createdAt: datetimeSchema, - createdBy: actorSchema, - updatedAt: datetimeSchema, - updatedBy: actorSchema, -}); - -export const customer1Schema = z.object({ - id: idSchema, - email: emailSchema, - externalId: z.string().nullable(), - fullName: z.string(), - shortName: z.string().nullable(), - markedAsSpamAt: datetimeSchema.optional().nullable(), - markedAsSpamBy: internalActorSchema.optional().nullable(), - customerGroupMemberships: customerGroupMembershipsSchema, - createdAt: datetimeSchema, - createdBy: actorSchema, - updatedAt: datetimeSchema, - updatedBy: actorSchema, -}); - -export const threadSchema = z.object({ - id: idSchema, - customer: customer1Schema, - title: z.string(), - previewText: z.string().optional().nullable(), - priority: z.number(), - externalId: z.string().nullable(), - status: threadStatusSchema, - statusChangedAt: datetimeSchema.nullable(), - statusChangedBy: actorSchema.optional().nullable(), - statusDetail: threadStatusDetailSchema.nullable(), - assignee: threadAssigneeSchema.nullable(), - assignedAt: datetimeSchema.nullable(), - labels: z.array(labelSchema), - firstInboundMessageInfo: threadMessageInfoSchema.nullable(), - firstOutboundMessageInfo: threadMessageInfoSchema.nullable(), - lastInboundMessageInfo: threadMessageInfoSchema.nullable(), - lastOutboundMessageInfo: threadMessageInfoSchema.nullable(), - supportEmailAddresses: z.array(z.string()), - createdAt: datetimeSchema, - createdBy: actorSchema, - updatedAt: datetimeSchema, - updatedBy: actorSchema, -}); - -export const componentSchema = z.union([ - componentTextSchema, - componentPlainTextSchema, - componentSpacerSchema, - componentDividerSchema, - componentLinkButtonSchema, - componentBadgeSchema, - componentCopyButtonSchema, - componentRowSchema, - componentContainerSchema, -]); - -export const customerChangedPayloadSchema = z.object({ - changeType: z.union([z.literal('ADDED'), z.literal('UPDATED')]), - eventType: z.literal('customer.customer_changed'), - customer: customerSchema, - previousCustomer: customerSchema.nullable(), -}); - -export const customerGroupMembershipsChangedPayloadSchema = z.object({ - eventType: z.literal('customer.customer_group_memberships_changed'), - changeType: z.union([z.literal('ADDED'), z.literal('REMOVED')]), - customer: customer1Schema, - previousCustomer: customer1Schema, -}); - -export const threadCreatedPublicEventPayloadSchema = z.object({ - eventType: z.literal('thread.thread_created'), - thread: threadSchema, -}); - -export const threadStatusTransitionedPublicEventPayloadSchema = z.object({ - eventType: z.literal('thread.thread_status_transitioned'), - previousThread: threadSchema, - thread: threadSchema, -}); - -export const threadAssignmentTransitionedPublicEventPayloadSchema = z.object({ - eventType: z.literal('thread.thread_assignment_transitioned'), - previousThread: threadSchema, - thread: threadSchema, -}); - -export const threadEmailReceivedPublicEventPayloadSchema = z.object({ - eventType: z.literal('thread.email_received'), - thread: threadSchema, - email: email1Schema, -}); - -export const threadEmailSentPublicEventPayloadSchema = z.object({ - eventType: z.literal('thread.email_sent'), - thread: threadSchema, - email: email1Schema, -}); - -export const threadLabelsChangedPublicEventPayloadSchema = z.object({ - eventType: z.literal('thread.thread_labels_changed'), - changeType: z.union([z.literal('ADDED'), z.literal('REMOVED')]), - thread: threadSchema, - previousThread: threadSchema, -}); - -export const threadPriorityChangedPublicEventPayloadSchema = z.object({ - eventType: z.literal('thread.thread_priority_changed'), - previousThread: threadSchema, - thread: threadSchema, -}); - -export const threadChatSentPublicEventPayloadSchema = z.object({ - eventType: z.literal('thread.chat_sent'), - chat: chatSchema, - thread: threadSchema, -}); - -export const customerCreatedPublicEventPayloadSchema = z.object({ - eventType: z.literal('customer.customer_created'), - customer: customer1Schema, -}); - -export const customerUpdatedPublicEventPayloadSchema = z.object({ - eventType: z.literal('customer.customer_updated'), - customer: customer1Schema, - previousCustomer: customer1Schema, -}); - -export const customerDeletedPublicEventPayloadSchema = z.object({ - eventType: z.literal('customer.customer_deleted'), - previousCustomer: customer1Schema, -}); - -export const customEntrySchema = z.object({ - entryType: z.literal('custom'), - externalId: z.string().nullable(), - title: z.string(), - type: z.string().nullable(), - components: z.tuple([componentSchema, z.any()]), - attachments: z.array(customEntryAttachmentSchema), -}); - -export const timelineEntrySchema = z.object({ - id: idSchema, - customerId: idSchema, - timestamp: datetimeSchema, - actor: actorSchema, - entry: z.union([noteEntrySchema, chatEntrySchema, emailEntrySchema, customEntrySchema]), -}); - -export const timelineEntryChangedPayloadSchema = z.object({ - eventType: z.literal('timeline.timeline_entry_changed'), - previousTimelineEntry: timelineEntrySchema.nullable(), - timelineEntry: timelineEntrySchema.nullable(), - changeType: z.union([z.literal('ADDED'), z.literal('UPDATED'), z.literal('REMOVED')]), -}); - -export const webhooksSchemaDefinitionSchema = z.object({ - timestamp: z.unknown(), - workspaceId: idSchema, - payload: z.union([ - customerChangedPayloadSchema, - customerGroupMembershipsChangedPayloadSchema, - timelineEntryChangedPayloadSchema, - customerGroupChangedPayloadSchema, - threadCreatedPublicEventPayloadSchema, - threadStatusTransitionedPublicEventPayloadSchema, - threadAssignmentTransitionedPublicEventPayloadSchema, - threadEmailReceivedPublicEventPayloadSchema, - threadEmailSentPublicEventPayloadSchema, - threadLabelsChangedPublicEventPayloadSchema, - threadPriorityChangedPublicEventPayloadSchema, - threadChatSentPublicEventPayloadSchema, - customerCreatedPublicEventPayloadSchema, - customerUpdatedPublicEventPayloadSchema, - customerDeletedPublicEventPayloadSchema, - ]), - id: idSchema, - type: z.union([ - z.literal('thread.thread_created'), - z.literal('thread.thread_status_transitioned'), - z.literal('thread.thread_assignment_transitioned'), - z.literal('thread.email_received'), - z.literal('thread.email_sent'), - z.literal('thread.chat_sent'), - z.literal('thread.note_created'), - z.literal('thread.thread_labels_changed'), - z.literal('thread.thread_priority_changed'), - z.literal('customer.customer_created'), - z.literal('customer.customer_updated'), - z.literal('customer.customer_deleted'), - z.literal('customer.customer_changed'), - z.literal('customer.customer_group_changed'), - z.literal('customer.customer_group_memberships_changed'), - z.literal('timeline.timeline_entry_changed'), - ]), - webhookMetadata: z.object({ - webhookTargetId: idSchema, - webhookDeliveryAttemptId: idSchema, - webhookDeliveryAttemptNumber: z.number(), - webhookDeliveryAttemptTimestamp: datetimeSchema, - }), -}); From 858ad40ae60627f67c56e3031251bad09e67355a Mon Sep 17 00:00:00 2001 From: Jordan Drake Date: Wed, 6 Mar 2024 15:14:15 +0000 Subject: [PATCH 04/10] Remove console.log --- src/webhooks/parse.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/webhooks/parse.ts b/src/webhooks/parse.ts index dda881a..31c1791 100644 --- a/src/webhooks/parse.ts +++ b/src/webhooks/parse.ts @@ -18,7 +18,6 @@ export function parsePlainWebhook(payload: unknown): Result Date: Wed, 6 Mar 2024 15:18:40 +0000 Subject: [PATCH 05/10] Remove unused packages --- package.json | 11 +-- pnpm-lock.yaml | 206 ++++++++++++++++++++++--------------------------- 2 files changed, 98 insertions(+), 119 deletions(-) diff --git a/package.json b/package.json index f776891..4607ee2 100644 --- a/package.json +++ b/package.json @@ -28,16 +28,15 @@ "@graphql-codegen/typescript": "^3.0.4", "@graphql-codegen/typescript-document-nodes": "^3.0.4", "@graphql-codegen/typescript-operations": "^3.0.4", + "@rollup/plugin-json": "^6.1.0", "@typescript-eslint/eslint-plugin": "^5.59.2", "@typescript-eslint/parser": "^5.59.2", - "ajv": "^8.12.0", - "ajv-formats": "^2.1.1", "esbuild": "^0.17.18", "eslint": "^8.40.0", "eslint-plugin-import": "^2.27.5", "eslint-plugin-simple-import-sort": "^10.0.0", "eslint-plugin-unused-imports": "^2.0.0", - "json-schema-to-typescript": "^13.1.1", + "json-schema-to-typescript": "^13.1.2", "rollup": "^3.21.5", "rollup-plugin-dts": "^5.3.0", "rollup-plugin-esbuild": "^5.0.0", @@ -48,14 +47,12 @@ "vitest": "^0.31.0" }, "dependencies": { - "@apidevtools/json-schema-ref-parser": "^11.1.0", "@graphql-typed-document-node/core": "^3.2.0", + "ajv": "^8.12.0", + "ajv-formats": "^2.1.1", "graphql": "^16.6.0", "graphql-anywhere": "^4.2.8", "json-refs": "^3.0.15", - "json-schema-ref-parser": "^9.0.9", - "json-schema-to-zod": "^2.0.14", - "jsonschema": "^1.4.1", "zod": "3.22.4" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9d44752..1ea67dc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,12 +5,15 @@ settings: excludeLinksFromLockfile: false dependencies: - '@apidevtools/json-schema-ref-parser': - specifier: ^11.1.0 - version: 11.1.0 '@graphql-typed-document-node/core': specifier: ^3.2.0 version: 3.2.0(graphql@16.6.0) + ajv: + specifier: ^8.12.0 + version: 8.12.0 + ajv-formats: + specifier: ^2.1.1 + version: 2.1.1(ajv@8.12.0) graphql: specifier: ^16.6.0 version: 16.6.0 @@ -20,15 +23,6 @@ dependencies: json-refs: specifier: ^3.0.15 version: 3.0.15 - json-schema-ref-parser: - specifier: ^9.0.9 - version: 9.0.9 - json-schema-to-zod: - specifier: ^2.0.14 - version: 2.0.14 - jsonschema: - specifier: ^1.4.1 - version: 1.4.1 zod: specifier: 3.22.4 version: 3.22.4 @@ -55,18 +49,15 @@ devDependencies: '@graphql-codegen/typescript-operations': specifier: ^3.0.4 version: 3.0.4(graphql@16.6.0) + '@rollup/plugin-json': + specifier: ^6.1.0 + version: 6.1.0(rollup@3.21.5) '@typescript-eslint/eslint-plugin': specifier: ^5.59.2 version: 5.59.2(@typescript-eslint/parser@5.59.2)(eslint@8.40.0)(typescript@5.0.4) '@typescript-eslint/parser': specifier: ^5.59.2 version: 5.59.2(eslint@8.40.0)(typescript@5.0.4) - ajv: - specifier: ^8.12.0 - version: 8.12.0 - ajv-formats: - specifier: ^2.1.1 - version: 2.1.1(ajv@8.12.0) esbuild: specifier: ^0.17.18 version: 0.17.18 @@ -83,8 +74,8 @@ devDependencies: specifier: ^2.0.0 version: 2.0.0(@typescript-eslint/eslint-plugin@5.59.2)(eslint@8.40.0) json-schema-to-typescript: - specifier: ^13.1.1 - version: 13.1.1 + specifier: ^13.1.2 + version: 13.1.2 rollup: specifier: ^3.21.5 version: 3.21.5 @@ -125,26 +116,6 @@ packages: '@jridgewell/trace-mapping': 0.3.18 dev: true - /@apidevtools/json-schema-ref-parser@11.1.0: - resolution: {integrity: sha512-g/VW9ZQEFJAOwAyUb8JFf7MLiLy2uEB4rU270rGzDwICxnxMlPy0O11KVePSgS36K1NI29gSlK84n5INGhd4Ag==} - engines: {node: '>= 16'} - dependencies: - '@jsdevtools/ono': 7.1.3 - '@types/json-schema': 7.0.15 - '@types/lodash.clonedeep': 4.5.9 - js-yaml: 4.1.0 - lodash.clonedeep: 4.5.0 - dev: false - - /@apidevtools/json-schema-ref-parser@9.0.9: - resolution: {integrity: sha512-GBD2Le9w2+lVFoc4vswGI/TjkNIZSVp7+9xPf+X3uidBfWnAeUWmquteSyt0+VCrhNMWj/FTABISQrD3Z/YA+w==} - dependencies: - '@jsdevtools/ono': 7.1.3 - '@types/json-schema': 7.0.12 - call-me-maybe: 1.0.2 - js-yaml: 4.1.0 - dev: false - /@ardatan/relay-compiler@12.0.0(graphql@16.6.0): resolution: {integrity: sha512-9anThAaj1dQr6IGmzBMcfzOQKTa5artjuPmw8NYK/fiGEMjADbSguBY2FMDykt+QhilR3wc9VA/3yVju7JHg7Q==} hasBin: true @@ -1978,6 +1949,7 @@ packages: /@jsdevtools/ono@7.1.3: resolution: {integrity: sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==} + dev: true /@manypkg/find-root@1.1.0: resolution: {integrity: sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA==} @@ -2199,6 +2171,19 @@ packages: resolution: {integrity: sha512-AW8PKd6iX3vAZ0vA43nOUOnbq/X5ihgU+mSXXqunMkeQADGiqw/PY0JNeYtD5sr0PAy51YPgAPbDoeapv9r8WA==} dev: true + /@rollup/plugin-json@6.1.0(rollup@3.21.5): + resolution: {integrity: sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@rollup/pluginutils': 5.1.0(rollup@3.21.5) + rollup: 3.21.5 + dev: true + /@rollup/pluginutils@5.0.2(rollup@3.21.5): resolution: {integrity: sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==} engines: {node: '>=14.0.0'} @@ -2214,6 +2199,21 @@ packages: rollup: 3.21.5 dev: true + /@rollup/pluginutils@5.1.0(rollup@3.21.5): + resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@types/estree': 1.0.1 + estree-walker: 2.0.2 + picomatch: 2.3.1 + rollup: 3.21.5 + dev: true + /@types/chai-subset@1.3.3: resolution: {integrity: sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==} dependencies: @@ -2253,10 +2253,7 @@ packages: /@types/json-schema@7.0.12: resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==} - - /@types/json-schema@7.0.15: - resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - dev: false + dev: true /@types/json-stable-stringify@1.0.34: resolution: {integrity: sha512-s2cfwagOQAS8o06TcwKfr9Wx11dNGbH2E9vJz1cqV+a/LOyhWNLUNd6JSRYNzvB4d29UuJX2M0Dj9vE1T8fRXw==} @@ -2266,14 +2263,9 @@ packages: resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} dev: true - /@types/lodash.clonedeep@4.5.9: - resolution: {integrity: sha512-19429mWC+FyaAhOLzsS8kZUsI+/GmBAQ0HFiCPsKGU+7pBXOQWhyrY6xNNDwUSX8SMZMJvuFVMF9O5dQOlQK9Q==} - dependencies: - '@types/lodash': 4.14.201 - dev: false - - /@types/lodash@4.14.201: - resolution: {integrity: sha512-y9euML0cim1JrykNxADLfaG0FgD1g/yTHwUs/Jg9ZIU7WKj2/4IW9Lbb1WZbvck78W/lfGXFfe+u2EGfIJXdLQ==} + /@types/lodash@4.14.202: + resolution: {integrity: sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ==} + dev: true /@types/minimatch@5.1.2: resolution: {integrity: sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==} @@ -2569,7 +2561,7 @@ packages: optional: true dependencies: ajv: 8.12.0 - dev: true + dev: false /ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} @@ -2587,7 +2579,7 @@ packages: json-schema-traverse: 1.0.0 require-from-string: 2.0.2 uri-js: 4.4.1 - dev: true + dev: false /ansi-colors@4.1.3: resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} @@ -2664,6 +2656,7 @@ packages: /argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + dev: true /array-buffer-byte-length@1.0.0: resolution: {integrity: sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==} @@ -2895,6 +2888,7 @@ packages: /call-me-maybe@1.0.2: resolution: {integrity: sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==} + dev: true /callsites@3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} @@ -3049,12 +3043,12 @@ packages: escape-string-regexp: 4.0.0 dev: true - /cli-color@2.0.3: - resolution: {integrity: sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ==} + /cli-color@2.0.4: + resolution: {integrity: sha512-zlnpg0jNcibNrO7GG9IeHH7maWFeCz+Ja1wx/7tZNU5ASSSSZ+/qZciM0/LHCYxSdqv5h2sdbQ/PXYdOuetXvA==} engines: {node: '>=0.10'} dependencies: - d: 1.0.1 - es5-ext: 0.10.62 + d: 1.0.2 + es5-ext: 0.10.64 es6-iterator: 2.0.3 memoizee: 0.4.15 timers-ext: 0.1.7 @@ -3277,11 +3271,12 @@ packages: stream-transform: 2.1.3 dev: true - /d@1.0.1: - resolution: {integrity: sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==} + /d@1.0.2: + resolution: {integrity: sha512-MOqHvMWF9/9MX6nza0KgvFH4HpMU0EF5uUDXqX/BtxtU8NfB0QzRtJ8Oe/6SuS4kbhyzVJwjd97EA4PKrzJ8bw==} + engines: {node: '>=0.12'} dependencies: - es5-ext: 0.10.62 - type: 1.2.0 + es5-ext: 0.10.64 + type: 2.7.2 dev: true /dataloader@2.2.2: @@ -3523,38 +3518,40 @@ packages: is-symbol: 1.0.4 dev: true - /es5-ext@0.10.62: - resolution: {integrity: sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==} + /es5-ext@0.10.64: + resolution: {integrity: sha512-p2snDhiLaXe6dahss1LddxqEm+SkuDvV8dnIQG0MWjyHpcMNfXKPE+/Cc0y+PhxJX3A4xGNeFCj5oc0BUh6deg==} engines: {node: '>=0.10'} requiresBuild: true dependencies: es6-iterator: 2.0.3 - es6-symbol: 3.1.3 + es6-symbol: 3.1.4 + esniff: 2.0.1 next-tick: 1.1.0 dev: true /es6-iterator@2.0.3: resolution: {integrity: sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==} dependencies: - d: 1.0.1 - es5-ext: 0.10.62 - es6-symbol: 3.1.3 + d: 1.0.2 + es5-ext: 0.10.64 + es6-symbol: 3.1.4 dev: true - /es6-symbol@3.1.3: - resolution: {integrity: sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==} + /es6-symbol@3.1.4: + resolution: {integrity: sha512-U9bFFjX8tFiATgtkJ1zg25+KviIXpgRvRHS8sau3GfhVzThRQrOeksPeT0BWW2MNZs1OEWJ1DPXOQMn0KKRkvg==} + engines: {node: '>=0.12'} dependencies: - d: 1.0.1 + d: 1.0.2 ext: 1.7.0 dev: true /es6-weak-map@2.0.3: resolution: {integrity: sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==} dependencies: - d: 1.0.1 - es5-ext: 0.10.62 + d: 1.0.2 + es5-ext: 0.10.64 es6-iterator: 2.0.3 - es6-symbol: 3.1.3 + es6-symbol: 3.1.4 dev: true /esbuild@0.17.18: @@ -3809,6 +3806,16 @@ packages: dev: true optional: true + /esniff@2.0.1: + resolution: {integrity: sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg==} + engines: {node: '>=0.10'} + dependencies: + d: 1.0.2 + es5-ext: 0.10.64 + event-emitter: 0.3.5 + type: 2.7.2 + dev: true + /espree@9.6.0: resolution: {integrity: sha512-1FH/IiruXZ84tpUlm0aCUEwMl2Ho5ilqVh0VvQXw+byAz/4SAciyHLlfmL5WYqsvD38oymdUwBss0LtK8m4s/A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -3859,8 +3866,8 @@ packages: /event-emitter@0.3.5: resolution: {integrity: sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==} dependencies: - d: 1.0.1 - es5-ext: 0.10.62 + d: 1.0.2 + es5-ext: 0.10.64 dev: true /ext@1.7.0: @@ -3893,7 +3900,6 @@ packages: /fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} - dev: true /fast-diff@1.3.0: resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} @@ -4782,6 +4788,7 @@ packages: hasBin: true dependencies: argparse: 2.0.1 + dev: true /jsesc@2.5.2: resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} @@ -4810,24 +4817,16 @@ packages: - supports-color dev: false - /json-schema-ref-parser@9.0.9: - resolution: {integrity: sha512-qcP2lmGy+JUoQJ4DOQeLaZDqH9qSkeGCK3suKWxJXS82dg728Mn3j97azDMaOUmJAN4uCq91LdPx4K7E8F1a7Q==} - engines: {node: '>=10'} - deprecated: Please switch to @apidevtools/json-schema-ref-parser - dependencies: - '@apidevtools/json-schema-ref-parser': 9.0.9 - dev: false - - /json-schema-to-typescript@13.1.1: - resolution: {integrity: sha512-F3CYhtA7F3yPbb8vF7sFchk/2dnr1/yTKf8RcvoNpjnh67ZS/ZMH1ElLt5KHAtf2/bymiejLQQszszPWEeTdSw==} + /json-schema-to-typescript@13.1.2: + resolution: {integrity: sha512-17G+mjx4nunvOpkPvcz7fdwUwYCEwyH8vR3Ym3rFiQ8uzAL3go+c1306Kk7iGRk8HuXBXqy+JJJmpYl0cvOllw==} engines: {node: '>=12.0.0'} hasBin: true dependencies: '@bcherny/json-schema-ref-parser': 10.0.5-fork '@types/json-schema': 7.0.12 - '@types/lodash': 4.14.201 + '@types/lodash': 4.14.202 '@types/prettier': 2.7.3 - cli-color: 2.0.3 + cli-color: 2.0.4 get-stdin: 8.0.0 glob: 7.2.3 glob-promise: 4.2.2(glob@7.2.3) @@ -4839,18 +4838,13 @@ packages: prettier: 2.8.8 dev: true - /json-schema-to-zod@2.0.14: - resolution: {integrity: sha512-Pp9wg1/AcMw5KA1RA7t6ybUTIes1yX0vp8PeE48cPnddHb+ZZWbAKPaFXVf4Pif4XSbo9u9i/hIzBcS1UHK/TA==} - hasBin: true - dev: false - /json-schema-traverse@0.4.1: resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} dev: true /json-schema-traverse@1.0.0: resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} - dev: true + dev: false /json-stable-stringify-without-jsonify@1.0.1: resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} @@ -4905,10 +4899,6 @@ packages: resolution: {integrity: sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==} dev: true - /jsonschema@1.4.1: - resolution: {integrity: sha512-S6cATIPVv1z0IlxdN+zUk5EPjkGCdnhN4wVSBlvoUO1tOLJootbo9CquNJmbIh4yikWHiUedhRYrNPn1arpEmQ==} - dev: false - /kind-of@6.0.3: resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} engines: {node: '>=0.10.0'} @@ -4979,10 +4969,6 @@ packages: p-locate: 5.0.0 dev: true - /lodash.clonedeep@4.5.0: - resolution: {integrity: sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==} - dev: false - /lodash.merge@4.6.2: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} dev: true @@ -5059,7 +5045,7 @@ packages: /lru-queue@0.1.0: resolution: {integrity: sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==} dependencies: - es5-ext: 0.10.62 + es5-ext: 0.10.64 dev: true /lunr@2.3.9: @@ -5104,8 +5090,8 @@ packages: /memoizee@0.4.15: resolution: {integrity: sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ==} dependencies: - d: 1.0.1 - es5-ext: 0.10.62 + d: 1.0.2 + es5-ext: 0.10.64 es6-weak-map: 2.0.3 event-emitter: 0.3.5 is-promise: 2.2.2 @@ -5827,7 +5813,7 @@ packages: /require-from-string@2.0.2: resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} engines: {node: '>=0.10.0'} - dev: true + dev: false /require-main-filename@2.0.0: resolution: {integrity: sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==} @@ -6338,7 +6324,7 @@ packages: /timers-ext@0.1.7: resolution: {integrity: sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ==} dependencies: - es5-ext: 0.10.62 + es5-ext: 0.10.64 next-tick: 1.1.0 dev: true @@ -6532,10 +6518,6 @@ packages: engines: {node: '>=8'} dev: true - /type@1.2.0: - resolution: {integrity: sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==} - dev: true - /type@2.7.2: resolution: {integrity: sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==} dev: true From 1fc3b535851ee2046976922344cc7496ab323fc1 Mon Sep 17 00:00:00 2001 From: Jordan Drake Date: Wed, 6 Mar 2024 15:19:55 +0000 Subject: [PATCH 06/10] Move some deps to dev deps --- package.json | 2 +- pnpm-lock.yaml | 77 ++++++++++++++++++++++++++++++++++---------------- 2 files changed, 54 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 4607ee2..ba66b22 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "eslint-plugin-import": "^2.27.5", "eslint-plugin-simple-import-sort": "^10.0.0", "eslint-plugin-unused-imports": "^2.0.0", + "json-refs": "^3.0.15", "json-schema-to-typescript": "^13.1.2", "rollup": "^3.21.5", "rollup-plugin-dts": "^5.3.0", @@ -52,7 +53,6 @@ "ajv-formats": "^2.1.1", "graphql": "^16.6.0", "graphql-anywhere": "^4.2.8", - "json-refs": "^3.0.15", "zod": "3.22.4" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1ea67dc..d52f138 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,9 +20,6 @@ dependencies: graphql-anywhere: specifier: ^4.2.8 version: 4.2.8(graphql@16.6.0) - json-refs: - specifier: ^3.0.15 - version: 3.0.15 zod: specifier: 3.22.4 version: 3.22.4 @@ -73,6 +70,9 @@ devDependencies: eslint-plugin-unused-imports: specifier: ^2.0.0 version: 2.0.0(@typescript-eslint/eslint-plugin@5.59.2)(eslint@8.40.0) + json-refs: + specifier: ^3.0.15 + version: 3.0.15 json-schema-to-typescript: specifier: ^13.1.2 version: 13.1.2 @@ -2653,6 +2653,7 @@ packages: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} dependencies: sprintf-js: 1.0.3 + dev: true /argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} @@ -2708,6 +2709,7 @@ packages: /asap@2.0.6: resolution: {integrity: sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==} + dev: true /asn1js@3.0.5: resolution: {integrity: sha512-FVnvrKJwpt9LP2lAMl8qZswRNm3T4q9CON+bxldk2iwk3FFpuwhx2FfinyitizWHsVYyaY+y5JzDR0rCMV5yTQ==} @@ -2733,7 +2735,7 @@ packages: /asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - dev: false + dev: true /auto-bind@4.0.0: resolution: {integrity: sha512-Hdw8qdNiqdJ8LqT0iK0sVzkFbzg6fhnQqqfWhBDxcHZvU75+B+ayzTy8x+k5Ix0Y92XOhOUlx74ps+bA6BeYMQ==} @@ -2885,6 +2887,7 @@ packages: dependencies: function-bind: 1.1.1 get-intrinsic: 1.2.1 + dev: true /call-me-maybe@1.0.2: resolution: {integrity: sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==} @@ -3153,12 +3156,12 @@ packages: engines: {node: '>= 0.8'} dependencies: delayed-stream: 1.0.0 - dev: false + dev: true /commander@4.1.1: resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} engines: {node: '>= 6'} - dev: false + dev: true /common-tags@1.8.2: resolution: {integrity: sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==} @@ -3167,7 +3170,7 @@ packages: /component-emitter@1.3.1: resolution: {integrity: sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==} - dev: false + dev: true /concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} @@ -3201,7 +3204,7 @@ packages: /cookiejar@2.1.4: resolution: {integrity: sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==} - dev: false + dev: true /cosmiconfig@7.1.0: resolution: {integrity: sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==} @@ -3316,6 +3319,7 @@ packages: dependencies: ms: 2.1.2 supports-color: 8.1.1 + dev: true /decamelize-keys@1.1.1: resolution: {integrity: sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==} @@ -3358,7 +3362,7 @@ packages: /delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} - dev: false + dev: true /dependency-graph@0.11.0: resolution: {integrity: sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg==} @@ -3381,7 +3385,7 @@ packages: dependencies: asap: 2.0.6 wrappy: 1.0.2 - dev: false + dev: true /dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} @@ -3829,6 +3833,7 @@ packages: resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} engines: {node: '>=4'} hasBin: true + dev: true /esquery@1.5.0: resolution: {integrity: sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==} @@ -3931,7 +3936,7 @@ packages: /fast-safe-stringify@2.1.1: resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} - dev: false + dev: true /fast-url-parser@1.1.3: resolution: {integrity: sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ==} @@ -4044,7 +4049,7 @@ packages: asynckit: 0.4.0 combined-stream: 1.0.8 mime-types: 2.1.35 - dev: false + dev: true /formidable@2.1.2: resolution: {integrity: sha512-CM3GuJ57US06mlpQ47YcunuUZ9jpm8Vx+P2CGt2j7HpgkKZO/DJYQ0Bobim8G6PFQmK5lOqOOdUXboU+h73A4g==} @@ -4053,7 +4058,7 @@ packages: hexoid: 1.0.0 once: 1.4.0 qs: 6.11.2 - dev: false + dev: true /fs-extra@11.2.0: resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==} @@ -4096,6 +4101,7 @@ packages: /function-bind@1.1.1: resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==} + dev: true /function.prototype.name@1.1.5: resolution: {integrity: sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==} @@ -4132,6 +4138,7 @@ packages: has: 1.0.3 has-proto: 1.0.1 has-symbols: 1.0.3 + dev: true /get-package-type@0.1.0: resolution: {integrity: sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==} @@ -4235,7 +4242,7 @@ packages: resolution: {integrity: sha512-jcLLfkpoVGmH7/InMC/1hIvOPSUh38oJtGhvrOFGzioE1DZ+0YW16RgmOJhHiuWTvGiJQ9Z1Ik43JvkRPRvE+A==} dependencies: lodash: 4.17.21 - dev: false + dev: true /graphql-anywhere@4.2.8(graphql@16.6.0): resolution: {integrity: sha512-bKeJJoY9JyWMAiz5isKrtYUdIUBOBiXUOrA9CQgs9Drh9itFtxhWndQH4UBuYfrMticum6Oj1uQ6iSvZk94cMQ==} @@ -4329,6 +4336,7 @@ packages: /has-flag@4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} + dev: true /has-property-descriptors@1.0.0: resolution: {integrity: sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==} @@ -4339,10 +4347,12 @@ packages: /has-proto@1.0.1: resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} engines: {node: '>= 0.4'} + dev: true /has-symbols@1.0.3: resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} engines: {node: '>= 0.4'} + dev: true /has-tostringtag@1.0.0: resolution: {integrity: sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==} @@ -4356,6 +4366,7 @@ packages: engines: {node: '>= 0.4.0'} dependencies: function-bind: 1.1.1 + dev: true /header-case@2.0.4: resolution: {integrity: sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q==} @@ -4367,7 +4378,7 @@ packages: /hexoid@1.0.0: resolution: {integrity: sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==} engines: {node: '>=8'} - dev: false + dev: true /hosted-git-info@2.8.9: resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} @@ -4455,6 +4466,7 @@ packages: /inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + dev: true /inquirer@8.2.5: resolution: {integrity: sha512-QAgPDQMEgrDssk1XiwwHoOGYF9BAbUcc1+j+FhEvaOt8/cKRqyLn0U5qA6F74fGhTMGxf92pOvPBeh29jQJDTQ==} @@ -4782,6 +4794,7 @@ packages: dependencies: argparse: 1.0.10 esprima: 4.0.1 + dev: true /js-yaml@4.1.0: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} @@ -4815,7 +4828,7 @@ packages: uri-js: 4.4.1 transitivePeerDependencies: - supports-color - dev: false + dev: true /json-schema-to-typescript@13.1.2: resolution: {integrity: sha512-17G+mjx4nunvOpkPvcz7fdwUwYCEwyH8vR3Ym3rFiQ8uzAL3go+c1306Kk7iGRk8HuXBXqy+JJJmpYl0cvOllw==} @@ -4979,6 +4992,7 @@ packages: /lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + dev: true /log-symbols@4.1.0: resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} @@ -5041,6 +5055,7 @@ packages: engines: {node: '>=10'} dependencies: yallist: 4.0.0 + dev: true /lru-queue@0.1.0: resolution: {integrity: sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==} @@ -5135,7 +5150,7 @@ packages: /methods@1.1.2: resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} engines: {node: '>= 0.6'} - dev: false + dev: true /micromatch@4.0.5: resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} @@ -5148,20 +5163,20 @@ packages: /mime-db@1.52.0: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} - dev: false + dev: true /mime-types@2.1.35: resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} engines: {node: '>= 0.6'} dependencies: mime-db: 1.52.0 - dev: false + dev: true /mime@2.6.0: resolution: {integrity: sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==} engines: {node: '>=4.0.0'} hasBin: true - dev: false + dev: true /mimic-fn@2.1.0: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} @@ -5235,6 +5250,7 @@ packages: /ms@2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + dev: true /ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} @@ -5260,7 +5276,7 @@ packages: /native-promise-only@0.8.1: resolution: {integrity: sha512-zkVhZUA3y8mbz652WrL5x0fB0ehrBkulWT3TomAQ9iDtyXZvzKeEA6GPxAItBYeNYl5yngKRX612qHOhvMkDeg==} - dev: false + dev: true /natural-compare-lite@1.4.0: resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==} @@ -5341,6 +5357,7 @@ packages: /object-inspect@1.12.3: resolution: {integrity: sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==} + dev: true /object-keys@1.1.1: resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} @@ -5379,6 +5396,7 @@ packages: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} dependencies: wrappy: 1.0.2 + dev: true /onetime@5.1.2: resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} @@ -5558,7 +5576,7 @@ packages: superagent: 7.1.6 transitivePeerDependencies: - supports-color - dev: false + dev: true /path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} @@ -5697,7 +5715,7 @@ packages: engines: {node: '>=0.6'} dependencies: side-channel: 1.0.4 - dev: false + dev: true /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} @@ -5748,6 +5766,7 @@ packages: inherits: 2.0.4 string_decoder: 1.3.0 util-deprecate: 1.0.2 + dev: true /readdirp@3.6.0: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} @@ -5929,6 +5948,7 @@ packages: /safe-buffer@5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + dev: true /safe-regex-test@1.0.0: resolution: {integrity: sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==} @@ -5962,6 +5982,7 @@ packages: hasBin: true dependencies: lru-cache: 6.0.0 + dev: true /sentence-case@3.0.4: resolution: {integrity: sha512-8LS0JInaQMCRoQ7YUytAo/xUu5W2XnQxV2HI/6uM6U7CITS1RqPElr30V6uIqyMKM9lJGRVFy5/4CuzcixNYSg==} @@ -6022,6 +6043,7 @@ packages: call-bind: 1.0.2 get-intrinsic: 1.2.1 object-inspect: 1.12.3 + dev: true /siginfo@2.0.0: resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} @@ -6044,6 +6066,7 @@ packages: /slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} + dev: true /slice-ansi@3.0.0: resolution: {integrity: sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==} @@ -6125,6 +6148,7 @@ packages: /sprintf-js@1.0.3: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} + dev: true /stackback@0.0.2: resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} @@ -6187,6 +6211,7 @@ packages: resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} dependencies: safe-buffer: 5.2.1 + dev: true /strip-ansi@6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} @@ -6236,7 +6261,7 @@ packages: semver: 7.5.4 transitivePeerDependencies: - supports-color - dev: false + dev: true /supports-color@5.5.0: resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} @@ -6257,6 +6282,7 @@ packages: engines: {node: '>=10'} dependencies: has-flag: 4.0.0 + dev: true /supports-hyperlinks@2.3.0: resolution: {integrity: sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==} @@ -6637,6 +6663,7 @@ packages: /util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + dev: true /validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} @@ -6908,6 +6935,7 @@ packages: /wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + dev: true /ws@8.13.0: resolution: {integrity: sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==} @@ -6941,6 +6969,7 @@ packages: /yallist@4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} + dev: true /yaml-ast-parser@0.0.43: resolution: {integrity: sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==} From b7082dcfa607eb51daa7f725499ec244b284c10a Mon Sep 17 00:00:00 2001 From: Jordan Drake Date: Wed, 6 Mar 2024 15:21:37 +0000 Subject: [PATCH 07/10] Fix build to support importing JSON --- rollup.config.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index 8e791a6..d49eae4 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -1,3 +1,4 @@ +import json from '@rollup/plugin-json'; import dts from 'rollup-plugin-dts'; import esbuild from 'rollup-plugin-esbuild'; @@ -9,7 +10,7 @@ const bundle = (config) => ({ export default [ bundle({ - plugins: [esbuild()], + plugins: [esbuild(), json()], output: [ { file: `dist/index.js`, From f806d39bcee807511ab066757ecf54ead34d151e Mon Sep 17 00:00:00 2001 From: Jordan Drake Date: Wed, 6 Mar 2024 15:41:51 +0000 Subject: [PATCH 08/10] Add generated file to prettierignore --- .prettierignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.prettierignore b/.prettierignore index ffd3828..f210126 100644 --- a/.prettierignore +++ b/.prettierignore @@ -9,3 +9,4 @@ src/graphql/types.ts CHANGELOG.md package-lock.json package.json +src/webhooks/webhook-schema.ts \ No newline at end of file From e87c1fa627ff7b4c01d920475903e0ed609964ba Mon Sep 17 00:00:00 2001 From: Jordan Drake Date: Tue, 12 Mar 2024 09:44:39 +0000 Subject: [PATCH 09/10] Drop commented out script --- scripts/codegen-webhooks.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/codegen-webhooks.sh b/scripts/codegen-webhooks.sh index e041597..e099583 100644 --- a/scripts/codegen-webhooks.sh +++ b/scripts/codegen-webhooks.sh @@ -4,6 +4,4 @@ # Download the JSON schema curl https://core-api.uk.plain.com/webhooks/schema.json -o ./src/webhooks/webhook-schema.json -./node_modules/.bin/json2ts --input ./src/webhooks/webhook-schema.json --output ./src/webhooks/webhook-schema.ts - -# ./node_modules/.bin/json-refs resolve ./src/webhooks/webhook-schema.json | ./node_modules/.bin/json-schema-to-zod | ./node_modules/.bin/prettier --parser typescript > ./src/webhooks/webhook-schema.ts \ No newline at end of file +./node_modules/.bin/json2ts --input ./src/webhooks/webhook-schema.json --output ./src/webhooks/webhook-schema.ts \ No newline at end of file From 1c8d316587f12d58dc2fae570f8ad2e15baf7d1b Mon Sep 17 00:00:00 2001 From: Andrew Blaney Date: Tue, 12 Mar 2024 09:50:06 +0000 Subject: [PATCH 10/10] add isStartOfThread --- src/graphql/types.ts | 430 ++++++++++++++++--- src/tests/webhook-payloads/email-received.ts | 1 + src/webhooks/webhook-schema.json | 4 + src/webhooks/webhook-schema.ts | 1 + 4 files changed, 383 insertions(+), 53 deletions(-) diff --git a/src/graphql/types.ts b/src/graphql/types.ts index bcb50ad..8b2a6e0 100644 --- a/src/graphql/types.ts +++ b/src/graphql/types.ts @@ -12,6 +12,7 @@ export type Scalars = { Boolean: boolean; Int: number; Float: number; + DateTimeISO: any; }; export type AcceptWorkspaceInviteInput = { @@ -94,23 +95,6 @@ export type ArchiveLabelTypeOutput = { labelType: Maybe; }; -export type AssignCustomerToUserInput = { - /** - * Should the mutation change the customer's status to Active. - * - * Defaults to true. - */ - changeCustomerStatusToActive?: InputMaybe; - customerId: Scalars['ID']; - userId?: InputMaybe; -}; - -export type AssignCustomerToUserOutput = { - __typename?: 'AssignCustomerToUserOutput'; - customer: Maybe; - error: Maybe; -}; - export type AssignRolesToUserInput = { roleIds: Array; userId: Scalars['ID']; @@ -243,11 +227,26 @@ export type ChatEntry = { text: Maybe; }; +/** Query to search for companies. */ +export type CompaniesSearchQuery = { + /** + * The term to search for. It must be at least 2 characters long. The search is case-insensitive on these two fields: + * - the company name (partial match) + * - the company domain name (partial match) + */ + term: Scalars['String']; +}; + export type Company = { __typename?: 'Company'; + createdAt: DateTime; + createdBy: InternalActor; + domainName: Scalars['String']; id: Scalars['ID']; logoUrl: Maybe; name: Scalars['String']; + updatedAt: DateTime; + updatedBy: InternalActor; }; @@ -255,6 +254,42 @@ export type CompanyLogoUrlArgs = { size?: InputMaybe; }; +export type CompanyConnection = { + __typename?: 'CompanyConnection'; + edges: Array; + pageInfo: PageInfo; +}; + +export type CompanyEdge = { + __typename?: 'CompanyEdge'; + cursor: Scalars['String']; + node: Company; +}; + +export type CompanyIdentifier = { + /** The domain name of the company (e.g. plain.com). Alternatively, you can provide a full URL (e.g. https://www.plain.com) and we will do our best to extract the domain name. */ + companyDomainName?: InputMaybe; + /** Plain's internal identifier for the company. */ + companyId?: InputMaybe; +}; + +export type CompanySearchResult = { + __typename?: 'CompanySearchResult'; + company: Company; +}; + +export type CompanySearchResultConnection = { + __typename?: 'CompanySearchResultConnection'; + edges: Array; + pageInfo: PageInfo; +}; + +export type CompanySearchResultEdge = { + __typename?: 'CompanySearchResultEdge'; + cursor: Scalars['String']; + node: CompanySearchResult; +}; + export type ComponentBadge = { __typename?: 'ComponentBadge'; badgeColor: Maybe; @@ -548,6 +583,7 @@ export type CreateCustomerEventOutput = { export type CreateCustomerGroupInput = { color: Scalars['String']; + externalId?: InputMaybe; key: Scalars['String']; name: Scalars['String']; }; @@ -855,6 +891,7 @@ export type Customer = { export type CustomerCustomerGroupMembershipsArgs = { after?: InputMaybe; before?: InputMaybe; + filters?: InputMaybe; first?: InputMaybe; last?: InputMaybe; }; @@ -865,14 +902,6 @@ export type CustomerActor = { customerId: Scalars['ID']; }; -export type CustomerAssignmentTransitionedEntry = { - __typename?: 'CustomerAssignmentTransitionedEntry'; - nextUser: Maybe; - nextUserId: Maybe; - previousUser: Maybe; - previousUserId: Maybe; -}; - export type CustomerCardComponent = ComponentBadge | ComponentContainer | ComponentCopyButton | ComponentDivider | ComponentLinkButton | ComponentPlainText | ComponentRow | ComponentSpacer | ComponentText; /** @@ -1131,6 +1160,7 @@ export type CustomerGroup = { color: Scalars['String']; createdAt: DateTime; createdBy: InternalActor; + externalId: Maybe; id: Scalars['ID']; key: Scalars['String']; name: Scalars['String']; @@ -1153,6 +1183,7 @@ export type CustomerGroupEdge = { export type CustomerGroupIdentifier = { customerGroupId?: InputMaybe; customerGroupKey?: InputMaybe; + externalId?: InputMaybe; }; export type CustomerGroupMembership = { @@ -1177,6 +1208,14 @@ export type CustomerGroupMembershipEdge = { node: CustomerGroupMembership; }; +export type CustomerGroupMembershipsFilter = { + customerGroupExternalIds?: InputMaybe>; +}; + +export type CustomerGroupsFilter = { + externalIds?: InputMaybe>; +}; + /** Only one of the fields can be set. */ export type CustomerIdentifierInput = { customerId?: InputMaybe; @@ -1226,7 +1265,6 @@ export enum CustomerStatus { } export type CustomersFilter = { - assignedToUser?: InputMaybe>; /** * Filters customers to those with at least one of the given customer group IDs. * Customers with no groups will not be included. @@ -1239,7 +1277,6 @@ export type CustomersFilter = { * Can be combined with other group filters. */ customerGroupKeys?: InputMaybe>; - isAssigned?: InputMaybe; isMarkedAsSpam?: InputMaybe; }; @@ -1354,6 +1391,10 @@ export type DeleteThreadLinkOutput = { error: Maybe; }; +export type DeleteUserAuthSlackIntegrationInput = { + slackTeamId: Scalars['String']; +}; + export type DeleteUserAuthSlackIntegrationOutput = { __typename?: 'DeleteUserAuthSlackIntegrationOutput'; error: Maybe; @@ -1402,6 +1443,10 @@ export type DeleteWorkspaceInviteOutput = { invite: Maybe; }; +export type DeleteWorkspaceSlackChannelIntegrationInput = { + integrationId: Scalars['ID']; +}; + export type DeleteWorkspaceSlackChannelIntegrationOutput = { __typename?: 'DeleteWorkspaceSlackChannelIntegrationOutput'; error: Maybe; @@ -1564,7 +1609,7 @@ export type EmailSignature = { }; /** A union of all possible entries that can appear in a timeline. */ -export type Entry = ChatEntry | CustomEntry | CustomerAssignmentTransitionedEntry | CustomerEventEntry | EmailEntry | LinearIssueThreadLinkStateTransitionedEntry | NoteEntry | SlackMessageEntry | SlackReplyEntry | ThreadAssignmentTransitionedEntry | ThreadEventEntry | ThreadLabelsChangedEntry | ThreadPriorityChangedEntry | ThreadStatusTransitionedEntry; +export type Entry = ChatEntry | CustomEntry | CustomerEventEntry | EmailEntry | LinearIssueThreadLinkStateTransitionedEntry | NoteEntry | SlackMessageEntry | SlackReplyEntry | ThreadAssignmentTransitionedEntry | ThreadEventEntry | ThreadLabelsChangedEntry | ThreadPriorityChangedEntry | ThreadStatusTransitionedEntry; export type EventComponent = ComponentBadge | ComponentCopyButton | ComponentDivider | ComponentLinkButton | ComponentPlainText | ComponentRow | ComponentSpacer | ComponentText; @@ -1778,7 +1823,6 @@ export type Mutation = { addLabels: AddLabelsOutput; addWorkspaceAlternateSupportEmailAddress: AddWorkspaceAlternateSupportEmailAddressOutput; archiveLabelType: ArchiveLabelTypeOutput; - assignCustomerToUser: AssignCustomerToUserOutput; assignRolesToUser: AssignRolesToUserOutput; assignThread: AssignThreadOutput; changeThreadPriority: ChangeThreadPriorityOutput; @@ -1872,12 +1916,13 @@ export type Mutation = { sendSlackMessage: SendSlackMessageOutput; snoozeThread: SnoozeThreadOutput; unarchiveLabelType: UnarchiveLabelTypeOutput; - unassignAllCustomers: UnassignAllCustomersOutput; unassignThread: UnassignThreadOutput; /** Removes the spam mark from a customer. */ unmarkCustomerAsSpam: UnmarkCustomerAsSpamOutput; /** Partially updates a customer card config. */ updateCustomerCardConfig: UpdateCustomerCardConfigOutput; + /** Changes the company of a customer. */ + updateCustomerCompany: UpdateCustomerCompanyOutput; /** Update a customer group. */ updateCustomerGroup: UpdateCustomerGroupOutput; updateLabelType: UpdateLabelTypeOutput; @@ -1891,9 +1936,14 @@ export type Mutation = { updateWorkspace: UpdateWorkspaceOutput; updateWorkspaceEmailSettings: UpdateWorkspaceEmailSettingsOutput; upsertAutoresponder: UpsertAutoresponderOutput; + upsertCompany: UpsertCompanyOutput; upsertCustomTimelineEntry: UpsertCustomTimelineEntryOutput; + /** Creates or updates a customer. */ upsertCustomer: UpsertCustomerOutput; + /** Creates or updates a customer group. */ + upsertCustomerGroup: UpsertCustomerGroupOutput; upsertMyEmailSignature: UpsertMyEmailSignatureOutput; + upsertTenant: UpsertTenantOutput; verifyWorkspaceEmailDnsSettings: VerifyWorkspaceEmailDnsSettingsOutput; verifyWorkspaceEmailForwardingSettings: VerifyWorkspaceEmailForwardingSettingsOutput; }; @@ -1924,11 +1974,6 @@ export type MutationArchiveLabelTypeArgs = { }; -export type MutationAssignCustomerToUserArgs = { - input: AssignCustomerToUserInput; -}; - - export type MutationAssignRolesToUserArgs = { input: AssignRolesToUserInput; }; @@ -2114,6 +2159,11 @@ export type MutationDeleteUserArgs = { }; +export type MutationDeleteUserAuthSlackIntegrationArgs = { + input?: InputMaybe; +}; + + export type MutationDeleteWebhookTargetArgs = { input: DeleteWebhookTargetInput; }; @@ -2129,6 +2179,11 @@ export type MutationDeleteWorkspaceInviteArgs = { }; +export type MutationDeleteWorkspaceSlackChannelIntegrationArgs = { + input?: InputMaybe; +}; + + export type MutationDeleteWorkspaceSlackIntegrationArgs = { input: DeleteWorkspaceSlackIntegrationInput; }; @@ -2229,11 +2284,6 @@ export type MutationUnarchiveLabelTypeArgs = { }; -export type MutationUnassignAllCustomersArgs = { - input: UnassignAllCustomersInput; -}; - - export type MutationUnassignThreadArgs = { input: UnassignThreadInput; }; @@ -2249,6 +2299,11 @@ export type MutationUpdateCustomerCardConfigArgs = { }; +export type MutationUpdateCustomerCompanyArgs = { + input: UpdateCustomerCompanyInput; +}; + + export type MutationUpdateCustomerGroupArgs = { input: UpdateCustomerGroupInput; }; @@ -2299,6 +2354,11 @@ export type MutationUpsertAutoresponderArgs = { }; +export type MutationUpsertCompanyArgs = { + input: UpsertCompanyInput; +}; + + export type MutationUpsertCustomTimelineEntryArgs = { input: UpsertCustomTimelineEntryInput; }; @@ -2309,11 +2369,21 @@ export type MutationUpsertCustomerArgs = { }; +export type MutationUpsertCustomerGroupArgs = { + input: UpsertCustomerGroupInput; +}; + + export type MutationUpsertMyEmailSignatureArgs = { input: UpsertMyEmailSignatureInput; }; +export type MutationUpsertTenantArgs = { + input: UpsertTenantInput; +}; + + export type MutationVerifyWorkspaceEmailForwardingSettingsArgs = { input: VerifyWorkspaceEmailForwardingSettingsInput; }; @@ -2404,6 +2474,8 @@ export type Permissions = { export type Query = { __typename?: 'Query'; autoresponder: Maybe; + companies: CompanyConnection; + company: Maybe; customer: Maybe; customerByEmail: Maybe; /** Get a customer by its external ID. A customer's external ID is unique within a workspace. */ @@ -2444,11 +2516,13 @@ export type Query = { myWorkspaces: WorkspaceConnection; permissions: Permissions; roles: RoleConnection; + searchCompanies: CompanySearchResultConnection; /** * Search for customers based on the provided query. Returned customers are sorted by how recently * they changed status (most recent first). */ searchCustomers: CustomerSearchConnection; + searchTenants: TenantSearchResultConnection; searchThreads: ThreadSearchResultConnection; /** Gets a single setting based on the code and the scope. */ setting: Maybe; @@ -2456,6 +2530,8 @@ export type Query = { snippets: SnippetConnection; /** List all the events types you can subscribe to. */ subscriptionEventTypes: Array; + tenant: Maybe; + tenants: TenantConnection; /** Get a thread by its ID. */ thread: Maybe; /** Get a thread by its external ID. A thread's external ID is unique within a customer, hence why the customer ID is required. */ @@ -2466,11 +2542,13 @@ export type Query = { */ threadSlackUsers: SlackUserConnection; threads: ThreadConnection; + timeSeriesMetric: Maybe; timelineEntries: TimelineEntryConnection; timelineEntry: Maybe; user: Maybe; userAuthSlackInstallationInfo: UserAuthSlackInstallationInfo; userAuthSlackIntegration: Maybe; + userAuthSlackIntegrationByThreadId: Maybe; /** * Returns a user by email or null if the user is not found. * @@ -2490,12 +2568,26 @@ export type Query = { workspaceInvites: WorkspaceInviteConnection; workspaceSlackChannelInstallationInfo: WorkspaceSlackChannelInstallationInfo; workspaceSlackChannelIntegration: Maybe; + workspaceSlackChannelIntegrations: WorkspaceSlackChannelIntegrationConnection; workspaceSlackInstallationInfo: WorkspaceSlackInstallationInfo; workspaceSlackIntegration: Maybe; workspaceSlackIntegrations: WorkspaceSlackIntegrationConnection; }; +export type QueryCompaniesArgs = { + after?: InputMaybe; + before?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; +}; + + +export type QueryCompanyArgs = { + companyId: Scalars['ID']; +}; + + export type QueryCustomerArgs = { customerId: Scalars['ID']; }; @@ -2518,6 +2610,7 @@ export type QueryCustomerCardConfigArgs = { export type QueryCustomerCardInstancesArgs = { customerId: Scalars['ID']; + threadId?: InputMaybe; }; @@ -2529,6 +2622,7 @@ export type QueryCustomerGroupArgs = { export type QueryCustomerGroupsArgs = { after?: InputMaybe; before?: InputMaybe; + filters?: InputMaybe; first?: InputMaybe; last?: InputMaybe; }; @@ -2605,6 +2699,15 @@ export type QueryRolesArgs = { }; +export type QuerySearchCompaniesArgs = { + after?: InputMaybe; + before?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; + searchQuery: CompaniesSearchQuery; +}; + + export type QuerySearchCustomersArgs = { after?: InputMaybe; before?: InputMaybe; @@ -2614,6 +2717,15 @@ export type QuerySearchCustomersArgs = { }; +export type QuerySearchTenantsArgs = { + after?: InputMaybe; + before?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; + searchQuery: TenantsSearchQuery; +}; + + export type QuerySearchThreadsArgs = { after?: InputMaybe; before?: InputMaybe; @@ -2642,6 +2754,19 @@ export type QuerySnippetsArgs = { }; +export type QueryTenantArgs = { + tenantId: Scalars['ID']; +}; + + +export type QueryTenantsArgs = { + after?: InputMaybe; + before?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; +}; + + export type QueryThreadArgs = { threadId: Scalars['ID']; }; @@ -2672,6 +2797,12 @@ export type QueryThreadsArgs = { }; +export type QueryTimeSeriesMetricArgs = { + name: Scalars['String']; + options?: InputMaybe; +}; + + export type QueryTimelineEntriesArgs = { after?: InputMaybe; before?: InputMaybe; @@ -2697,6 +2828,16 @@ export type QueryUserAuthSlackInstallationInfoArgs = { }; +export type QueryUserAuthSlackIntegrationArgs = { + slackTeamId?: InputMaybe; +}; + + +export type QueryUserAuthSlackIntegrationByThreadIdArgs = { + threadId: Scalars['ID']; +}; + + export type QueryUserByEmailArgs = { email: Scalars['String']; }; @@ -2755,6 +2896,19 @@ export type QueryWorkspaceSlackChannelInstallationInfoArgs = { }; +export type QueryWorkspaceSlackChannelIntegrationArgs = { + integrationId?: InputMaybe; +}; + + +export type QueryWorkspaceSlackChannelIntegrationsArgs = { + after?: InputMaybe; + before?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; +}; + + export type QueryWorkspaceSlackInstallationInfoArgs = { redirectUrl: Scalars['String']; }; @@ -2775,6 +2929,7 @@ export type QueryWorkspaceSlackIntegrationsArgs = { export type ReloadCustomerCardInstanceInput = { customerCardConfigId: Scalars['ID']; customerId: Scalars['ID']; + threadId?: InputMaybe; }; export type ReloadCustomerCardInstanceOutput = { @@ -2951,7 +3106,7 @@ export type SendSlackMessageOutput = { }; /** A union of different types of settings. */ -export type Setting = BooleanSetting; +export type Setting = BooleanSetting | StringSetting; export type SettingScope = { __typename?: 'SettingScope'; @@ -3008,6 +3163,8 @@ export enum SettingScopeType { export type SettingValueInput = { /** If the setting is a boolean value then this field should be set. */ boolean?: InputMaybe; + /** If the setting is a string value then this field should be set. */ + string?: InputMaybe; }; export type SlackMessageEntry = { @@ -3121,6 +3278,17 @@ export type StringSearchExpression = { caseInsensitiveContains?: InputMaybe; }; +/** A string setting */ +export type StringSetting = { + __typename?: 'StringSetting'; + /** The setting code. */ + code: Scalars['String']; + /** The scope of the setting. */ + scope: SettingScope; + /** The value of the setting. This is named uniquely (instead of just `value`) so that the union has unique fields. */ + stringValue: Scalars['String']; +}; + export type Subscription = { __typename?: 'Subscription'; customerCardInstanceChanges: CustomerCardInstanceChangesResult; @@ -3177,6 +3345,62 @@ export type SystemActor = { systemId: Scalars['ID']; }; +export type Tenant = { + __typename?: 'Tenant'; + createdAt: DateTime; + createdBy: InternalActor; + externalId: Scalars['String']; + id: Scalars['ID']; + name: Scalars['String']; + updatedAt: DateTime; + updatedBy: InternalActor; + url: Maybe; +}; + +export type TenantConnection = { + __typename?: 'TenantConnection'; + edges: Array; + pageInfo: PageInfo; +}; + +export type TenantEdge = { + __typename?: 'TenantEdge'; + cursor: Scalars['String']; + node: Tenant; +}; + +export type TenantIdentifierInput = { + externalId?: InputMaybe; + tenantId?: InputMaybe; +}; + +export type TenantSearchResult = { + __typename?: 'TenantSearchResult'; + tenant: Tenant; +}; + +export type TenantSearchResultConnection = { + __typename?: 'TenantSearchResultConnection'; + edges: Array; + pageInfo: PageInfo; +}; + +export type TenantSearchResultEdge = { + __typename?: 'TenantSearchResultEdge'; + cursor: Scalars['String']; + node: TenantSearchResult; +}; + +/** Query to search for tenants. */ +export type TenantsSearchQuery = { + /** + * The term to search for. It must be at least 2 characters long. The search is case-insensitive on these two fields: + * - the tenant name (partial match) + * - the tenant external id (exact match) + */ + term: Scalars['String']; +}; + /** A thread represents a conversation with a customer, around a specific topic. */ export type Thread = { __typename?: 'Thread'; @@ -3441,7 +3665,7 @@ export type ThreadsFilter = { * - the customer's email */ export type ThreadsSearchQuery = { - /** The term to search for. It must be at least 3 characters long. The search is case-insensitive. */ + /** The term to search for. It must be at least 2 characters long. The search is case-insensitive. */ term: Scalars['String']; }; @@ -3455,6 +3679,46 @@ export enum ThreadsSortField { StatusChangedAt = 'STATUS_CHANGED_AT' } +export type TimeSeriesMetric = { + __typename?: 'TimeSeriesMetric'; + series: Array; + timestamps: Array; +}; + +export type TimeSeriesMetricDimension = { + __typename?: 'TimeSeriesMetricDimension'; + type: TimeSeriesMetricDimensionType; + value: Scalars['String']; +}; + +export enum TimeSeriesMetricDimensionType { + CustomerGroup = 'CUSTOMER_GROUP', + LabelType = 'LABEL_TYPE', + MessageSource = 'MESSAGE_SOURCE' +} + +export type TimeSeriesMetricInterval = { + unit?: InputMaybe; +}; + +export enum TimeSeriesMetricIntervalUnit { + Day = 'DAY', + Hour = 'HOUR' +} + +export type TimeSeriesMetricOptions = { + dimension?: InputMaybe; + from?: InputMaybe; + interval?: InputMaybe; + to?: InputMaybe; +}; + +export type TimeSeriesSeries = { + __typename?: 'TimeSeriesSeries'; + dimension: Maybe; + values: Array>; +}; + export type TimelineEntry = { __typename?: 'TimelineEntry'; actor: Actor; @@ -3501,16 +3765,6 @@ export type UnarchiveLabelTypeOutput = { labelType: Maybe; }; -export type UnassignAllCustomersInput = { - userId: Scalars['ID']; -}; - -export type UnassignAllCustomersOutput = { - __typename?: 'UnassignAllCustomersOutput'; - error: Maybe; - unassignedCustomerCount: Maybe; -}; - export type UnassignThreadInput = { threadId: Scalars['ID']; }; @@ -3558,9 +3812,23 @@ export type UpdateCustomerCardConfigOutput = { error: Maybe; }; +export type UpdateCustomerCompanyInput = { + /** The identifier of the company we want to update the customer with. Pass null if you want to remove the company from the customer. */ + companyIdentifier?: InputMaybe; + /** The identifier of the customer we want to update the company for. */ + customerId: Scalars['ID']; +}; + +export type UpdateCustomerCompanyOutput = { + __typename?: 'UpdateCustomerCompanyOutput'; + customer: Maybe; + error: Maybe; +}; + export type UpdateCustomerGroupInput = { color?: InputMaybe; customerGroupId: Scalars['ID']; + externalId?: InputMaybe; key?: InputMaybe; name?: InputMaybe; }; @@ -3695,6 +3963,19 @@ export type UpsertAutoresponderOutput = { result: Maybe; }; +export type UpsertCompanyInput = { + domainName: Scalars['String']; + identifier: CompanyIdentifier; + name: Scalars['String']; +}; + +export type UpsertCompanyOutput = { + __typename?: 'UpsertCompanyOutput'; + company: Maybe; + error: Maybe; + result: Maybe; +}; + export type UpsertCustomTimelineEntryInput = { attachmentIds?: InputMaybe>; /** @@ -3727,6 +4008,21 @@ export type UpsertCustomTimelineEntryOutput = { timelineEntry: Maybe; }; +export type UpsertCustomerGroupInput = { + color: Scalars['String']; + externalId?: InputMaybe; + identifier: CustomerGroupIdentifier; + key: Scalars['String']; + name: Scalars['String']; +}; + +export type UpsertCustomerGroupOutput = { + __typename?: 'UpsertCustomerGroupOutput'; + customerGroup: Maybe; + error: Maybe; + result: Maybe; +}; + export type UpsertCustomerIdentifierInput = { customerId?: InputMaybe; emailAddress?: InputMaybe; @@ -3779,6 +4075,20 @@ export enum UpsertResult { Updated = 'UPDATED' } +export type UpsertTenantInput = { + externalId: Scalars['String']; + identifier: TenantIdentifierInput; + name: Scalars['String']; + url: OptionalStringInput; +}; + +export type UpsertTenantOutput = { + __typename?: 'UpsertTenantOutput'; + error: Maybe; + result: Maybe; + tenant: Maybe; +}; + export type User = { __typename?: 'User'; /** The avatar URL of the user. */ @@ -3831,6 +4141,7 @@ export type UserAuthSlackIntegration = { createdBy: InternalActor; integrationId: Scalars['ID']; isReinstallRequired: Scalars['Boolean']; + slackTeamId: Scalars['String']; slackTeamName: Scalars['String']; updatedAt: DateTime; updatedBy: InternalActor; @@ -4076,12 +4387,25 @@ export type WorkspaceSlackChannelIntegration = { createdBy: InternalActor; integrationId: Scalars['ID']; isReinstallRequired: Scalars['Boolean']; + slackTeamId: Scalars['String']; slackTeamImageUrl68px: Maybe; slackTeamName: Scalars['String']; updatedAt: DateTime; updatedBy: InternalActor; }; +export type WorkspaceSlackChannelIntegrationConnection = { + __typename?: 'WorkspaceSlackChannelIntegrationConnection'; + edges: Array; + pageInfo: PageInfo; +}; + +export type WorkspaceSlackChannelIntegrationEdge = { + __typename?: 'WorkspaceSlackChannelIntegrationEdge'; + cursor: Scalars['String']; + node: WorkspaceSlackChannelIntegration; +}; + export type WorkspaceSlackInstallationInfo = { __typename?: 'WorkspaceSlackInstallationInfo'; installationUrl: Scalars['String']; @@ -4200,7 +4524,7 @@ export type ThreadEventPartsFragment = { __typename?: 'ThreadEvent', id: string, export type ThreadPartsFragment = { __typename: 'Thread', id: string, externalId: string | null, status: ThreadStatus, title: string, description: string | null, previewText: string | null, priority: number, customer: { __typename?: 'Customer', id: string }, statusChangedAt: { __typename: 'DateTime', iso8601: string, unixTimestamp: string }, labels: Array<{ __typename: 'Label', id: string, labelType: { __typename: 'LabelType', id: string, name: string, icon: string | null, isArchived: boolean, archivedAt: { __typename: 'DateTime', iso8601: string, unixTimestamp: string } | null, archivedBy: { __typename: 'MachineUserActor', machineUserId: string } | { __typename: 'SystemActor', systemId: string } | { __typename: 'UserActor', userId: string } | null, createdAt: { __typename: 'DateTime', iso8601: string, unixTimestamp: string }, createdBy: { __typename: 'MachineUserActor', machineUserId: string } | { __typename: 'SystemActor', systemId: string } | { __typename: 'UserActor', userId: string }, updatedAt: { __typename: 'DateTime', iso8601: string, unixTimestamp: string }, updatedBy: { __typename: 'MachineUserActor', machineUserId: string } | { __typename: 'SystemActor', systemId: string } | { __typename: 'UserActor', userId: string } }, createdAt: { __typename: 'DateTime', iso8601: string, unixTimestamp: string }, createdBy: { __typename: 'MachineUserActor', machineUserId: string } | { __typename: 'SystemActor', systemId: string } | { __typename: 'UserActor', userId: string }, updatedAt: { __typename: 'DateTime', iso8601: string, unixTimestamp: string }, updatedBy: { __typename: 'MachineUserActor', machineUserId: string } | { __typename: 'SystemActor', systemId: string } | { __typename: 'UserActor', userId: string } }>, assignedAt: { __typename: 'DateTime', iso8601: string, unixTimestamp: string } | null, assignedTo: { __typename: 'MachineUser', id: string, fullName: string, publicName: string, description: string | null, updatedAt: { __typename: 'DateTime', iso8601: string, unixTimestamp: string } } | { __typename: 'System', id: string } | { __typename: 'User', id: string, fullName: string, publicName: string, email: string, updatedAt: { __typename: 'DateTime', iso8601: string, unixTimestamp: string } } | null, createdAt: { __typename: 'DateTime', iso8601: string, unixTimestamp: string }, createdBy: { __typename: 'CustomerActor', customerId: string } | { __typename: 'DeletedCustomerActor', customerId: string } | { __typename: 'MachineUserActor', machineUserId: string } | { __typename: 'SystemActor', systemId: string } | { __typename: 'UserActor', userId: string }, updatedAt: { __typename: 'DateTime', iso8601: string, unixTimestamp: string }, updatedBy: { __typename: 'CustomerActor', customerId: string } | { __typename: 'DeletedCustomerActor', customerId: string } | { __typename: 'MachineUserActor', machineUserId: string } | { __typename: 'SystemActor', systemId: string } | { __typename: 'UserActor', userId: string } }; -export type TimelineEntryPartsFragment = { __typename?: 'TimelineEntry', id: string, customerId: string, timestamp: { __typename?: 'DateTime', iso8601: string }, actor: { __typename: 'CustomerActor', customerId: string } | { __typename: 'DeletedCustomerActor', customerId: string } | { __typename: 'MachineUserActor', machineUserId: string } | { __typename: 'SystemActor', systemId: string } | { __typename: 'UserActor', userId: string }, entry: { __typename: 'ChatEntry' } | { __typename: 'CustomEntry' } | { __typename: 'CustomerAssignmentTransitionedEntry' } | { __typename: 'CustomerEventEntry' } | { __typename: 'EmailEntry' } | { __typename: 'LinearIssueThreadLinkStateTransitionedEntry' } | { __typename: 'NoteEntry' } | { __typename: 'SlackMessageEntry' } | { __typename: 'SlackReplyEntry' } | { __typename: 'ThreadAssignmentTransitionedEntry' } | { __typename: 'ThreadEventEntry' } | { __typename: 'ThreadLabelsChangedEntry' } | { __typename: 'ThreadPriorityChangedEntry' } | { __typename: 'ThreadStatusTransitionedEntry' } }; +export type TimelineEntryPartsFragment = { __typename?: 'TimelineEntry', id: string, customerId: string, timestamp: { __typename?: 'DateTime', iso8601: string }, actor: { __typename: 'CustomerActor', customerId: string } | { __typename: 'DeletedCustomerActor', customerId: string } | { __typename: 'MachineUserActor', machineUserId: string } | { __typename: 'SystemActor', systemId: string } | { __typename: 'UserActor', userId: string }, entry: { __typename: 'ChatEntry' } | { __typename: 'CustomEntry' } | { __typename: 'CustomerEventEntry' } | { __typename: 'EmailEntry' } | { __typename: 'LinearIssueThreadLinkStateTransitionedEntry' } | { __typename: 'NoteEntry' } | { __typename: 'SlackMessageEntry' } | { __typename: 'SlackReplyEntry' } | { __typename: 'ThreadAssignmentTransitionedEntry' } | { __typename: 'ThreadEventEntry' } | { __typename: 'ThreadLabelsChangedEntry' } | { __typename: 'ThreadPriorityChangedEntry' } | { __typename: 'ThreadStatusTransitionedEntry' } }; export type UserActorPartsFragment = { __typename: 'UserActor', userId: string }; diff --git a/src/tests/webhook-payloads/email-received.ts b/src/tests/webhook-payloads/email-received.ts index 8c98d84..353199b 100644 --- a/src/tests/webhook-payloads/email-received.ts +++ b/src/tests/webhook-payloads/email-received.ts @@ -68,6 +68,7 @@ export default { receivedAt: '2024-03-06T12:37:08.539Z', attachments: [], inReplyToEmailId: null, + isStartOfThread: false, createdAt: '2024-03-06T12:37:10.228Z', createdBy: { actorType: 'customer', customerId: 'c_01H0MHCVC5EGDGY3EJXTHHWTGR' }, updatedAt: '2024-03-06T12:37:10.228Z', diff --git a/src/webhooks/webhook-schema.json b/src/webhooks/webhook-schema.json index 19bfc16..2f80326 100644 --- a/src/webhooks/webhook-schema.json +++ b/src/webhooks/webhook-schema.json @@ -754,6 +754,9 @@ "null" ] }, + "isStartOfThread": { + "type": "boolean" + }, "createdAt": { "$ref": "#/definitions/datetime" }, @@ -783,6 +786,7 @@ "receivedAt", "attachments", "inReplyToEmailId", + "isStartOfThread", "createdAt", "createdBy", "updatedAt", diff --git a/src/webhooks/webhook-schema.ts b/src/webhooks/webhook-schema.ts index 964438e..7ea4e03 100644 --- a/src/webhooks/webhook-schema.ts +++ b/src/webhooks/webhook-schema.ts @@ -505,6 +505,7 @@ export interface Email1 { receivedAt: Datetime | null; attachments: Attachment[]; inReplyToEmailId: string | null; + isStartOfThread: boolean; createdAt: Datetime; createdBy: Actor; updatedAt: Datetime;